Saravanan666/pypi-org huggingface dataset:
Package: simple-injection
Simple InjectionIntroductionSimple Injection is a simple, objected-oriented approach to dependency injection in python.
The goal of Simple Injection is to allow simple and effective dependency injection in python applications without the use of anything other than what is natively in your application. This means no decorators or anything else anywhere in your code is required for Simple Injection. All that is required is python typings.FeaturesOnly dependent on native python code and typings. Services are injected through typing annotations, rather than variable names or decorators in your code.Easily define service lifetimes.Enforces typings in your application.Bind abstract services to their implementations.Add services in any order, resolution occurs when a service is request.InstallationSimply install Simple Injection throughpip.pipinstallsimple-injectionUsageDue to Simple Injection relying only on typings, it is easy to add to your application.fromsimple_injectionimportServiceCollectionclassDependency:defhello(self):print("Hello from Dependency!")classService:def__init__(self,dependency:Dependency):self._dependency=dependencydefhello(self):self._dependency.hello()collection=ServiceCollection()collection.add_transient(Dependency)collection.add_transient(Service)collection.resolve(Service).hello()# Outputs: Hello from Dependency!This approach to dependency injection makes it easy to use mocks when developing and unit testing.classMockDependency:defhello(self):print("Hello from MockDependency!")collection=ServiceCollection()collection.add_transient(Dependency,MockDependency)collection.add_transient(Service)collection.resolve(Service).hello()# Outputs: Hello from MockDependency!This can also be achieved through the use of an interface (or base class) that both the dependency and the mock inherit from, but as the above example shows, it is not required.Simple Injection will also allow you to simply inject strings and other constants to your dependencies, easily injecting the needed dependency to your class with the constant.fromsimple_injectionimportServiceCollection,ServiceResolverFlagsclassDependency:def__init__(self,my_str:str):self.my_str=my_strclassService:def__init__(self,dependency:Dependency,my_int:int):self.my_intself._dependency=dependencydefget_str(self):returnself._dependency.my_strcollection=ServiceCollection()collection.add_transient(Dependency,args=["Example string!"])collection.add_transient(Service,args=[ServiceResolverFlags.REQUIRED_SERVICE,23])service=collection.resolve(Service)service.my_int# 23service.get_str()# Example string!Seeexamplesfor more examples.DocumentationDocumentation for Simple Injection can be found onreadthedocs.ContributingContributions are more than welcome. Feel welcome to add issues or make pull requests!LicenseMIT
Package: simple-injector
Dependency Injection made simple.Instalationpip instal simple-injectorGetting Startedfromsimple_injectorimportSimpleInjector,injectfromrandomimportrandomclassRepository():def__init__(self):self.number=random()defget_a_number(self):returnself.numberclassService():def__init__(self,repo:Repository):self.repo=repodefget_number(self):return{"n":self.repo.get_a_number()}defbootstrap():SimpleInjector().register(Repository)SimpleInjector().singleton(Service)bootstrap()repo=inject(Repository)serv=inject(Service)Reference GuideSimpleInjector()This will always return the same instance of the SimpleInjector.SimpleInjector().register(class, obj_or_callable=None)Used to register a class on the dependencies list.Can also receive an instance of the object that you want to assign to it.Can also receive a callable with one parameter, that will be the instance of the Reference.Can also receive a callable with 0 parameters.Any lambda received as a parameter should always return the instance that will be injected.SimpleInjector().singleton(class)Used to register a class as a singleton on the dependencies list.This class' dependencies will be resolved at the moment of this method call, so all its dependencies must be already registered with SimpleInjector.SimpleInjector().lazy(class, obj)Used to register a class with its instantiate object on the dependencies list.Any call toSimpleInjector().resolve(class)to this class will be resolved with the object previously provided.SimpleInjector().resolve(class)orinjectUsed to resolve a dependency of a class that has been registered prior to the execution of this resolve method.This method will return an object it has on the dependency list for this class, if it is a singleton, or a registered object, otherwise it will return a new instance for the class provided, injecting all needed dependencies, if they were registered prior to the execution of this method.SimpleInjector().instantiate(class, extraParams={})Can be used if you need to get a new instance of some class, or if you want a new instance and want to override some param on the constructor of the class.SimpleInjector().reset()Can be used if you need to be sure that the SimpleInjector has no dependencies registered on its list
Package: simple-ioc
# Simple IoC[![Build Status](https://travis-ci.org/agroptima/simple-ioc.svg)](https://travis-ci.org/agroptima/simple-ioc)[![License GPLv3](https://img.shields.io/badge/license-GPLv3-red.svg)](https://opensource.org/licenses/GPL-3.0)![Python versions](https://img.shields.io/badge/python-3.x-blue.svg)## Install```$ pipenv install simple-ioc```or```$ pip install simple-ioc```## UsageIn order to have the IoC (Inversion of Control) working in your application, you must register your services in the IoC container:```pythonfrom simple_ioc import Containerclass AService:# Your service implementation comes hereContainer().register('an_identifier', lambda: AService())```Then, from any point in your application, you can retrieve the service by calling `get`:```pythona_service = Container().get('an_identifier')```
Package: simple-iot-device
Simple IOT DeviceIOT device simulator.The simulated device takes a number of measurements at some fixed point of time.The measurements data returned as Python dictionary.IOT Device Measurementstemperature, in °C;pressure, in kPa;relative humidity, in %;Basic Usagefromsimple_iot_deviceimportSimpleIOTDevice# create Simple IOT Devicedevice=SimpleIOTDevice(name="SDM-120230")# make measurementmeasurement=device.make_measurement()# print measurement resultprint(measurement)
Package: simple-ipc
simple-ipcInter-process communication based on stdioA simple python interface for inter-process communication, a way to asynchronously
exchange data with external programs at runtime. The internal mechanism functions
by writing data tostdoutand reading fromstdinusing multi threading.Installationpip install simple-ipcUsageImport the module first:import ipcfrom ipc import WorkerParametersWorker(command, callback=None, start=True, verbose=False)commanda path to an executable along with optional argumentslist:may include spacesstr:no support for spacescallback(optional)a function that is called after new data has been receivedmust take exactly one argumentstart(optional)start the worker automatically when createdverbose(optional)print status messagesExamplesworker=Worker(['with space.exe','spaced arg'],start=False)withWorker('program.exe',verbose=True)asworker:...Worker('path/to/program.exe arg',lambdadata:print(data))A worker objectAll data will be converted to typestrinternally.Methodsstart()starts the workersend(data)sends the data to the external processstop()initiates the termination of all threads and clears all dataPropertiesrunningindicates the status of the worker(read-only)datacontains the most recent value(read-only)Example programfromrandomimportrandintfromipcimportWorkerdefprocess(data):ifint(data)==5:print('Process data...')worker=Worker('program.exe',process)whileworker.running:number=randint(1,10)worker.send(number)print(f'Data:{worker.data}')More example code can be foundhere.
Package: simpleir
Language:
    🇺🇸🇨🇳«SimpleIR» provides a simple framework for Image RetrievalTable of ContentsTable of ContentsBackgroundInstallationUsageMaintainersThanksContributingLicenseBackgroundSince the traditional image processing, the field of image retrieval has been a research hotspot. Up to now, image
retrieval algorithms based on deep learning have been continuously proposed. Although this field has developed for many
years, there are still great barriers to research and practice. In order to better practice image retrieval algorithms,
I developed this warehouse, hoping to better promote the landing and optimization of image retrieval algorithms.InstallationSeeinstallUsageSeeGet StartedMaintainerszhujian -Initial work-zjykzjThanksZJCV/ZCls2PyRetri/PyRetriFor more thanks, checkTHANKSContributingAnyone's participation is welcome! Open anissueor submit PRs.Small note:Git submission specifications should be complied
withConventional CommitsIf versioned, please conform to theSemantic Versioning 2.0.0specificationIf editing the README, please conform to thestandard-readmespecification.LicenseApache License 2.0© 2022 zjykzj
Package: simpleisy
Python library for Universal Devices ISY994 Insteon/ZWave controller hubThis library transforms the XML from the ISY into more pythonic data structures and provides both an object model interface as
well as a more procedural/lower interface for commands.UsageTheISYControllerobject provides methods to get devices and programs. GetDevice and GetProgram returnISYDeviceandISYProgramobjects, respectively, and those objects provide methods to tunr devices on/off, run programs, etc.fromsimpleisyimportISYControllerisy=ISYController("1.2.3.4","admin","password")dev=isy.GetDevice("Living room lights")printdev.GetState()dev.TurnOn()Output:OffYou can also use device/program commands more directly if you want by directly callingNodeCommandorProgramCommandfromsimpleisyimportISYControllerisy=ISYController("1.2.3.4","admin","password")node_address="1A 2B 3C"# Turn on the deviceisy.NodeCommand(node_address,"DON")# Turn off the deviceisy.NodeCommand(node_address,"DOF")
Package: simpleitem
SimpleItemPython SimpleItem Library.InstallingInstall and update usingpip3:$ pip3 install simpleitemPython 3 and newer.SimpleItem ExampleEasy to define and use features.>>fromsimpleitemimportSimpleItem>>item1=SimpleItem()>>item1.node1=1>>item1['node2']node3=3>>item1['node1']1>>item1.node2.node33>>item1['node2'].node33>>item1.node2['node3']3>>item1['node2']['node3']3Other Usage Examples>>item2=SimpleItem()>>item2['node1']=1>>item2['node2']['node3']=3>>item3=SimpleItem(node1=1,node2={'node3':3})>>item4=SimpleItem(**{'node1':1,'node2':{'node3':3}})>>item5=SimpleItem()>>item5(node1=1,node2={'node3':3})>>item6=SimpleItem()>>item6(**{'node1':1,'node2':{'node3':3}})path; test.yamlsettings:username: adminhost: 0.0.0.0>>item=SimpleItem()>>item.from_yaml(path)>>item.setting.usernameadmin>>setting=item.setting>>setting.host0.0.0.0MemoryStorage ExampleMemoryStorage designed as singleton pattern, define somewhere use everywhere.>>fromsimpleitemimportMemoryStorage>>storage=MemoryStorage()>>settings=storage.settings>>settings.sleep=1>>settings.sleep1>>settings(debug=True)>>storage.settings.debugTrueSupportPython 3.xSupports all operating systemsLinksLicense:MIT LicenseCode:https://github.com/dinceraslancom/simpleitem
Package: simpleJDB
simpleJDBsimpleJDB is a lightweight and easy-to-use python database that allows you to store, retrieve, and manipulate data with minimal code.FeaturesSupport for multiple data types: simpleJDB supports storing integers, strings, floats, and lists as values.Concurrency Support: simpleJDB is thread-safe and can handle simultaneous access and modification of data by multiple users.Staging/Commit: simpleJDB has a staging/commit feature that allows you to make changes to the data before committing them to the json file.Documentation: simpleJDB is well-documented and easy to understand, making it easier to get started with the library.Unit testing: simpleJDB has a comprehensive test suite to ensure that the library is working as expected and to catch any bugs before they are released to the public.Getting StartedTo initialize the database, simply import the simpleJDB module and create a new database object, passing in a name for the database as an argument:import simpleJDB db = simpleJDB.database("my_database")Adding and Updating KeysTo add a new key-value pair to the database, use the setkey() method and pass in the key name and the value to be stored:db.setkey("age", 22)You can also update the value of an existing key by calling setkey() with the same key name and a new value:db.setkey("age", 23)When you are ready to commit the changes to the json file, use the commit() method:db.commit()Retrieving and Deleting KeysTo retrieve the value of a key, use the getkey() method and pass in the key name:age = db.getkey("age")To delete a key, use the delkey() method and pass in the key name:db.delkey("age")Key TypeTo check the data type of a key, use the gettype() method and pass in the key name:data_type = db.gettype("age")ConclusionWith simpleJDB, you can easily store and manipulate data in a pythonic way. With the added features, you can do more complex data manipulation and you can use it in a concurrent environment. Give it a try and see how it can simplify your project.
Package: simple-job-files
simple-job-filesEmulate theGalaxyjob files API forPulsartesting.$ python3 -m venv .venv
$ . .venv/bin/activate
$ pip install simple-job-filesHistory0.1.1 (2022-10-12)Fix up project to parameterize application for Docker.0.1.0 (2022-10-12)Inital version.
Package: simple-jquery-django-auto-logout
simple_jquery_django_auto_logoutRequirements:Django >=2.2,<4.0Jquery✨ Coffee ✨This is python package that make your web app autologout system look easier with minimal configurations
Adapted FROMdjango-auto-logoutpackageInstallationpipinstallsimple_jquery_django_auto_logoutUsageAdd This to your django settings.pySIMPLE_AUTO_LOGOUT={'AUTO_LOGOUT_IDLE_TIME':timedelta(minutes=10),'AUTO_LOGOUT_MESSAGE':'Sesi Anda sudah habis, silahkan login kembali.','AUTO_LOGOUT_URL':'app:logout',}Add this line to your context processor list'simple_jquery_django_auto_logout.context_processors.auto_logout_context'Add this to your base template or page that you want to activate auto logout<scriptsrc="https://code.jquery.com/jquery-3.7.1.min.js"></script>{{jquery_django_auto_logout}}And you are DONE !!!
Test your web app, it should be auto logout after several time you depend on your settings value above.NoteIf you want to add some message show while redirect to login page, you should use message framework from djangohttps://docs.djangoproject.com/en/3.2/ref/contrib/messages/and add some configuration in your logout URL like@method_decorator(login_required(),name='dispatch')classLogoutViews(View):defget(self,request):logout_message=request.GET.get('logout_message',None)iflogout_messageisnotNone:messages.info(request,logout_message)logout(request)returnredirect(request.META['HTTP_REFERER'])LicenseMITFree Software, Hell Yeah!
Package: simplejson
simplejson is a simple, fast, complete, correct and extensible
JSON <http://json.org> encoder and decoder for Python 3.3+
with legacy support for Python 2.5+.  It is pure Python code
with no dependencies, but includes an optional C extension
for a serious speed boost.The latest documentation for simplejson can be read online here:https://simplejson.readthedocs.io/simplejson is the externally maintained development version of the
json library included with Python (since 2.6). This version is tested
with the latest Python 3.8 and maintains backwards compatibility
with Python 3.3+ and the legacy Python 2.5 - Python 2.7 releases.The encoder can be specialized to provide serialization in any kind of
situation, without any special support by the objects to be serialized
(somewhat like pickle). This is best done with thedefaultkwarg
to dumps.The decoder can handle incoming JSON strings of any specified encoding
(UTF-8 by default). It can also be specialized to post-process JSON
objects with theobject_hookorobject_pairs_hookkwargs. This
is particularly useful for implementing protocols such as JSON-RPC
that have a richer type system than JSON itself.For those of you that have legacy systems to maintain, there is a
very old fork of simplejson in thepython2.2branch that supports
Python 2.2. This is based on a very old version of simplejson,
is not maintained, and should only be used as a last resort.
Package: simple-jsondiff
Simple JSONDiffSimple tools for diffing JSON documents.This package was mainly developed for debugging purposes, to quickly see
which values are different in comparable JSON documents.Free software: MIT licenseDocumentation:https://simple-jsondiff.readthedocs.io.FeaturesGet a JSON string of just the added or changed values(coming soon) Get a JSON string of just the removed valuesCreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.History0.2.0 (2018-10-14)Added tests0.1.0 (2018-10-14)First release on PyPI.
Package: simple-json-log-formatter
This is a fork ofsimple_json_logger, extracting the formatter into
it’s own project.It formats the Python logging.Record into a JSON suitable for indexing
engines like Logstash and AWS CloudWatch Logs.Installationpip install simple_json_log_formatterUsageSimply set the formatter in a log handler and add it to the current
logger.For example, to print the JSON logs to the current stream, set up the
logger with the following:importjson,loggingfromsimple_json_log_formatterimportSimpleJsonFormatterhandler=logging.StreamHandler()handler.setFormatter(SimpleJsonFormatter(json.dumps))logging.getLogger().addHandler(handler)logging.getLogger().setLevel(logging.INFO)And then simply calllogging.info('TEST'). It should print something
like this:{"timestamp":"2017-09-08T17:01:26.408975","line_number": 1, "function":"<module>","module":"<input>","level": "INFO", "path":"<input>","msg": "TEST"}Testingpython setup.py testCompatibilityPython versions 2.7 and 3.4+ are supported.
Package: simplejsonobject
simplejsonobjectA simple python object which can easily transform to and from json with compression supportInstallpipinstallsimplejsonobjectUsagefromsimplejsonobjectimportJsonObjectclassSample(JsonObject):def__init__(self):self.a="8"self.b=3self.c=Nonedefmain():smp=Sample()smp.to_dict()# {"a": tdata, "b": 3, "c": None}smp.to_dict_compressed()# {"a": tdata, "b": 3}smp.to_json()# '{\n    "a": 8,\n    "b": 3,\n    "c": null\n}'smp.to_json_compressed()# '{"a": 8, "b": 3}'# or you can import from any compressed/notcompressed json/dict# all below results same objecttsmp.from_dict({"a":tdata,"b":3,"c":None}tsmp.from_dict({"a":tdata,"b":3})tsmp.from_json('{\n"a": "8",\n"b": 3,\n"c": null\n}')tsmp.from_json('{"a": "8", "b": 3}')if__name__=='__main__':main()
Package: simplejsonrpc
Simple JSON-RPC 2.0 compilant middleware for python using decorators.
With just a few lines of code you get a JSONRPC 2.0 compilant web API
running and ready for your needs!UsageJust create a service class to store your API calls and decorate your
methods:fromsimplejsonrpcimport*loginservice=SimpleJSONRPCService(api_version=1)@jsonremote(loginservice,name='login',doc='Method used to log a user in')deflogin(request,user_name,user_pass):(...)More complex example interating it into [Web.py!]importweburls=('/','index','/api/','json_handler','/api','json_handler')app=web.application(urls,globals())api_service=SimpleJSONRPCService(api_version=1)classindex:defGET(self,name):ifnotname:name='World'return'Hello, '+name+'!'classjson_handler:defPOST(self):returnapi_service(web.webapi.data())@jsonremote(api_service,doc='print api documentation')defapi(request):returnapi_service.api()@jsonremote(api_service,doc='ping server')defping(request):return"pong"if__name__=="__main__":app.run()Adding API versioning to the previous exampleimportweburls=('/','index','/api/1/','json_handler_v1','/api/1','json_handler_v1','/api/2/','json_handler_v2','/api/2','json_handler_v2')app=web.application(urls,globals())api_service_v1=SimpleJSONRPCService(api_version=1)api_service_v2=SimpleJSONRPCService(api_version=2)classindex:defGET(self,name):ifnotname:name='World'return'Hello, '+name+'!'classjson_handler_v1:defPOST(self):returnapi_service_v1(web.webapi.data())classjson_handler_v1:defPOST(self):returnapi_service_v2(web.webapi.data())@jsonremote(api_service_v1,doc='print api documentation')defapi(request):returnapi_service_v1.api()@jsonremote(api_service_v1,doc='ping server')defping(request):return"pong"@jsonremote(api_service_v2,name='api',doc='print api documentation')defapi_v2(request):returnapi_service_v2.api()@jsonremote(api_service_v2,name='ping',doc='ping server')defping_v2(request):return"pong"if__name__=="__main__":app.run()LicenseThe MIT License (MIT)Copyright (c) 2014-2016 Moritz WundkePermission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Package: simple-json-yaml-toml-converter
simple-json-yaml-toml-converterDescriptionSimple json/yaml/toml converter.How to useUsage: simple-json-yaml-toml-converter [OPTIONS] [INPUT_FILES]...

Options:
  -o, --output-format TEXT
  --debug / --no-debug
  -e, --encoding TEXT
  --help                    Show this message and exit.
Package: simplejwt
simplejwtA dead simple JWT library.Supported algorithmsHS256HS384HS512UsageEncodeReturns a new token.from simplejwt import encode
token = encode('secret', {'my_payload': 'some_data'}, 'HS256')
# eyJ0eXBlIjogIkpXVCIsICJhbGciOiAiSFMyNTYifQ.eyJteV9wYXlsb2FkIjogInNvbWVfZGF0YSJ9.BXAs5tYkARpGHhegb8g8bfj8KhjFUTTjdEf81Ma1VhYNameTypeDefaultDescriptionsecretstrN/AThe secret used to create the token.payloaddictN/AThe payload data contained within the token.algintHS256The algorithm to use to create the token.MakeReturns a new token. This function has arguments for registered claims as specified inrfc7519.Any registered claims provided in the payload will take precedence over any provided as arguments.from simplejwt import make
token = make('secret', {'my_payload': 'some_data'}, 'HS256', issuer='acme', valid_to=1234567)
# eyJ0eXBlIjogIkpXVCIsICJhbGciOiAiSFMyNTYifQ.eyJteV9wYXlsb2FkIjogInNvbWVfZGF0YSIsICJpc3MiOiAiYWNtZSIsICJleHAiOiAxMjM0NTY3fQ.Nr5IADzsOhlzjxnghquBrRwewg10srDHu__-HN7GGGANameTypeDefaultDescriptionsecretstrN/AThe secret used to create the token.payloaddictN/AThe payload data contained within the token.algintHS256The algorithm to use to create the token.issuerstrNoneThe issuer of the token.subjectstrNoneThe subject of the token.audiencestrNoneThe audience of the token.valid_tointNoneThe expiry date of the token as a timestamp.valid_fromintNoneThe date the token is valid from as a timestamp.issued_atintNoneThe date the token was issued as a timestamp.idstrNoneThe id of the token.DecodeReturns the payload from a token.from simplejwt import encode, decode
token = encode('secret', {'my_payload': 'some_data'}, 'HS256')
payload = decode('secret', token, 'HS256')
# {'my_payload': 'some_data'}NameTypeDefaultDescriptionsecretstrN/AThe secret used to decode the token.payloaddictN/AThe token to decode.algintHS256The algorithm to use to create the token.Running testsInstall the package with test dependenciespip install -e ".[test]"Run toxtox