
Research
/Security News
Contagious Interview Campaign Escalates With 67 Malicious npm Packages and New Malware Loader
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
.. image:: https://travis-ci.org/remcohaszing/grunt-angular-templatecache.png?branch=master :target: https://travis-ci.org/remcohaszing/python-audiolayer
A simple dependency injection library.
First decorate a class with @provides('a lookup name')
.
import syringe
@syringe.provides('cure') ... class Syrup: ... def drink(self, person): ... print('Nom nom') ... person.health = 100 ...
Instantiate it. Note that it is not possible to instanciate another instance of
a class decorated with the name cure
.
syrup = Syrup()
Next inject it in another class using inject('a lookup name')
.
class Person: ... cure = syringe.inject('cure') ... ... def drink_medicine(self): ... self.cure.drink(self) ...
When an instance of the Person
class is created, the value of the injecte name
is the instance of the provided and instantiated class.
person = Person() person.health = 20 assert person.cure == syrup person.drink_medicine() Nom nom assert person.health == 100
A mock instance can be inserted using syringe.mock('a lookup name')
try: ... from unittest import mock ... except: ... import mock ... m = syringe.mock('cure') person.drink_medicine() m.drink.assert_called_once_with(person)
The package can be installed from the cheese shop by typing::
pip install syringe
FAQs
A simple dependency injection library
We found that syringe demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.