Saravanan666/pypi-org huggingface dataset:
Package: dynamic-i18n
dynamic-i18nIntroductiondynamic-i18n is a python package that helps to flatten complex JSON files into a simple and accessible format. It also provides functionality to modify the text of specific properties and get an object that only contains properties of a specified language.InstallationTo install dynamic-i18n, run the following command:pipinstalldynamic-i18nUsageTo use dynamic-i18n, you need to pass either a file name or a dictionary to the I18NFlatten class. You can also specify a language prefix to limit the properties to a specific language.importjsonfromdynamic_i18n.flattenimportI18NFlatten# Using a filejson_file='file.json'i18n=I18NFlatten(json_file=json_file)# Using a dictionaryjson_dict={...}i18n=I18NFlatten(json_dict=json_dict)Theflattened propertiescan be accessed as attributes of the I18NFlatten object.property_value=i18n.property_nameThemodify_textmethod can be used to modify the text of a specified property by replacing placeholders with the provided parameters.modified_text=i18n.modify_text('property_name',param1='value1',param2='value2')Theget_language_objectmethod can be used to get a newI18NFlattenobject that only contains properties of a specified language.language_object=i18n.get_language_object('en')Practical Examplefromdynamic_i18n.flattenimportI18NFlattendata_json={'i18n':{'welcome_message':{'en_us':"Hello World{name}",'pt_br':"Olá Mundo",'es':"Hola mundo"},'other_message':{'en_us':"{programming_language}programming language",'pt_br':"{programming_language}linguagem de programação",'es':"{programming_language}lenguaje de programación"}}}data=I18NFlatten(json_dict=data_json)print(data._fields)# {'i18n_welcome_message_en_us': 'Hello World {name}', 'i18n_welcome_message_pt_br': 'Olá Mundo', 'i18n_welcome_message_es': 'Hola mundo', 'i18n_other_message_en_us': '{programming_language} programming language', 'i18n_other_message_pt_br': '{programming_language} linguagem de programação', 'i18n_other_message_es': '{programming_language} lenguaje de programación'}print(data.modify_text('i18n_welcome_message_en_us',name='Jeferson Peter'))# IN: 'Hello World {name}'# OUT: 'Hello World Jeferson Peter'print(data.modify_text('i18n_other_message_pt_br',programming_language='Python'))# IN: '{programming_language} linguagem de programação'# OUT: 'Python linguagem de programação'data_en=data.get_language_object(language_prefix='en_us')print(data_en._fields)# {'i18n_welcome_message_en_us': 'Hello World {name}', 'i18n_other_message_en_us': '{programming_language} programming language'}Conclusiondynamic-i18n provides a simple and convenient way to access and manipulate complex JSON files for internationalization purposes. Give it a try and see how it can help you in your next project.
Package: dynamic-imports
Dynamically discover and import Python modules, classes, and functions.Installpip install dynamic_importsExamplesImport a module via module name or file pathfromdynamic_importsimportimport_modulemodule=import_module('my_package.my_module')# ormodule=import_module('/home/user/my_package/my_module.py')Import a module attributefromdynamic_importsimportimport_module_attrfunction=import_module_attr('my_package.my_module','my_function')# orfunction=import_module_attr('/home/user/my_package/my_module.py','my_function')Find all modules in a package or nested packagesfromdynamic_importsimportdiscover_modulesmodules=discover_modules(package=my_package,# str `my_package' works too.search_subpackages=True,# return the actual module objects, not str names.names_only=False# this is the default value...)Thesearch_inargument for all functions below can be an imported package or module, string name of the package (e.g."my_package") or module (e.g."my_package.my_module"), or path to a python file (e.g."/home/user/my_package/my_module.py")Find all implementations of a base class within a module.fromdynamic_importsimportclass_implsfrommy_package.my_moduleimportBasefrommy_packageimportmy_modulemy_classes=class_impls(base_class=Base,# str 'Base' works toosearch_in=my_module,names_only=False# this is the default value...)Find all implementations of a base class within nested packages.fromdynamic_importsimportclass_implsfrommy_package.my_moduleimportBaseimportmy_packagemy_classes=class_impls(base_class=Base,# str 'Base' works too.search_in=my_packagesearch_subpackages=True,names_only=False# this is the default value...)Find all instances of a class within a module.fromdynamic_importsimportclass_instfrommy_packageimportmy_modulefrommy_package.my_moduleimportMyClassmy_classes_instances=class_inst(search_in=my_module,class_type=MyClass)Find all instances of a class within nested packages.fromdynamic_importsimportclass_instfrommy_package.my_moduleimportMyClassimportmy_packagemy_classes_instances=class_inst(class_type=MyClass,search_in=my_package,search_subpackages=True,)
Package: dynamic-json
dynamic-jsonDynamic-json allows self-referential entries in a json file. It requires no dependencies, but lacks all the nice features of the yaml specification. If you prefer yaml then see [dynamic-yaml][dynamic-yaml].UsageThe key feature that was introduced is the ability for a string scalar to reference other parts of the configuration tree. This is done using the Python string formatting syntax. The characters '{' and '}' enclose a reference to another entry in the configuration structure. The reference takes the form key1.key2 where key1 maps to another mapping object and can be found in the root mapping, and key2 can be found in key1's mapping object. Multiple levels of nesting can be used (eg. key1.key2.key3 etc...).An example yaml configuration:{"project_name":"hello-world","dirs":{"home":"/home/user","venv":"{dirs.home}/venvs/{project_name}","data":"{dirs.venv}/data","output":"{dirs.data}/output-{parameters.parameter1}-{parameters.parameter2}"},"parameters":{"parameter1":"a","parameter2":"b"}}Reading in a json file:importdynamic_jsonwithopen('/path/to/file.json')asfileobj:cfg=dynamic_json.load(fileobj)assertcfg.dirs.venv=='/home/user/venvs/hello-world'assertcfg.dirs.output=='/home/user/venvs/hello-world/data/output-a-b'As the variables are dynamically resolved, it is also possible to combine this withargparse:importdynamic_jsonfromargparseimportArgumentParserwithopen('/path/to/file.yaml')asfileobj:cfg=dynamic_json.load(fileobj)parser=ArgumentParser()parser.add_argument('--parameter1')parser.add_argument('--parameter2')parser.parse_args('--parameter1 c --parameter2 d'.split(),namespace=cfg.parameters)assertcfg.dirs.output=='/home/user/venvs/hello-world/data/output-c-d'InstallationTo install, simply run:pipinstalldynamic-jsonRestrictionsDue to the short amount of time I was willing to spend on working upon this, there are a few restrictions that I could not overcome.Certain keys can only be used via__getitem__and not__getattr__.Becausedictcomes with it's own set of attributes that are always resolved first, the values for the following keys must be gotten using the item getter rather than the attribute getter (eg. config['items'] vs. config.items):appendextendinsertremovepopclearindexcountsortreversecopy
Package: dynamic-kobo
dynamic-koboReplace / update and redeploy KoBo forms.Developed by Karla Peña Ramírez, packaged byJacopo Margutti.RequirementsPython >= 3.7FirefoxGeckodriverSet upDownload and installFirefoxDownload the geckodriver binary for your platform (here)Install dynamic-kobo fromPyPIpip install dynamic-koboUsageUsage: replace-redeploy [OPTIONS]

  replace KoBo form with a new one and redeploy

Options:
  --config            path to configuration file (.env)
  --headless          run headless (no GUI)
  --koboserver TEXT   URL of KoBo server
  --username TEXT     username
  --password TEXT     password
  --formid TEXT       form (asset) ID
  --newform TEXT      absolute path to new form (.xlsx)
  --geckodriver TEXT  absolute path to geckodriver binary
  --help              show this message and exitN.B. all options can be stored in a.envfile, the script will load them automatically as environment variables. Example:GECKODRIVER=C:\geckodriver\geckodriver.exe
KOBO_SERVER=https://kobo.humanitarianresponse.info/
USERNAME=...
PASSWORD=...
FORM_ID=ai3sdfC1GnERTW72rwwSFq
NEW_FORM='C:\forms\new-form.xlsx'
Package: dynamic-listing
Dynamic ListingDescriptionThe Django Dynamic List Package provides a robust way to create and manage listing views in Django applications, utilizing filters, bulk actions, and dynamic table, dynamic list, and dynamic grid components. It seamlessly integrates withdjango-filterto enhance your app's list views.InstallationYou can install this package via pip:pipinstalldynamic-listingDocumentationFor detailed documentation and usage instructions, please visit ourReadTheDocs page.
Package: dynamic-load
Load python module, or member of module from string.Example UsageLoad module, or member of module from string.from dynamic_load import dynamic_load
dattime_module =  dynamic_load("datetime") # Load datetime module
dattime_module.datetime.now()
time_function = dynamic_load("time.time")
time_function()Execute functionn of module from string.from dynamic_load import dynamic_execute
answer =  dynamic_execute("datetime.datetime.now")
answer = dynamic_execute("time.sleep", 10) # execute(time.sleep(10))Convert function as string.from dynamic_load immport dynamic_string
string = dynamic_string(datetime.datetime.now)
Package: dynamic-logger
DynamicLoggerDynamicLogger is an extension of logging.Logger to provide additional functionality to log "extra" values quickly and dynamically.InstallationOne Linerpython-mpipinstalldynamic_loggerOr if you prefer Manual Installationgitclonehttps://github.com/ajatkj/dynamic_logger.gitcddynamic_logger
pipinstall.Usageimportdynamic_loggerimportlogginglogging.setLoggerClass(dynamic_logger.Logger)# Set-up log formatter with user-definied attributesfmt='[%(asctime)s] <%(app)s> [%(levelname)s] <%(id)s> <%(customer_id)s> ---%(message)s'# Note: format attributes in <> are user-definited# Load configlogging.basicConfig(format=fmt,datefmt='%d-%b-%y %H:%M:%S',level='INFO')applogger=logging.getLogger(__name__)@applogger.log_extras('id',int=0,customer_id='obj.customer_id')# Log value of 'id' and 'obj.customer_id'defexample_1(id=0,id2=0,obj=None):applogger.info('This example shows how to log values from function arguments')if__name__="__main__":example_1(id=123456,obj={"customer_id":777})Above will produce log output as below for all logging calls from the function:[2022-04-19 12:53:51,658] [INFO] <123456> <customer_id:777> --- This example shows how to log values from function argumentsdynamic_loggerexposes 2 main API'slog_extras decoratorlog_extras()will log values dynamically from the decorated functionset_extras functionset_extras()will log static values for all subsequentloggercalls till you call theclear()function.See more examples inexample.pySome NotesTo use with FastAPI, make surelog_extras()decorator is added after the path decorator of FastAPI.ContributionAlways open to PRs :)
Package: dynamicmethod
This simple module creates a class method that will also work as an instance method.importdynamicmethodclassExample(object):x=1# Default classmethod valuedef__init__(self,x=0):self.x=x@dynamicmethoddefget_x(self):returnself.xprint(Example.get_x())ex=Example()print(ex.get_x())ex.x=5print(ex.get_x())I have grown to use this module quite a bit. Mostly I make a default class level dictionary where each instance
can be customized.fromdynamicmethodimportdynamicmethodclassLookup(object):lookup_type={'type1':1,'mytype2':2}def__init__(self):# Save an instance variable so the class variable does not change.self.lookup_type=self.__class__.lookup_type.copy()@dynamicmethoddefadd_type(self,name,value):self.lookup_type[name]=value@dynamicmethoddefget_type(self,name):returnself.lookup_type.get(name,None)Lookup.add_type('New Type',3)assert'New Type'inLookup.lookup_typeprint(Lookup.get_type('New Type'))specific_lookup=Lookup()assert'New Type'inspecific_lookup.lookup_typeprint(specific_lookup.get_type('New Type'))specific_lookup.add_type('hello','world!')assert'hello'inspecific_lookup.lookup_typeassert'hello'notinLookup.lookup_typeprint(specific_lookup.get_type('hello'))# print(Lookup.get_type('hello'))  # This would be None since the class lookup does not contain 'hello'# Check adding to general after an instance is createdLookup.add_type('Fresh Type',4)assert'Fresh Type'inLookup.lookup_typeassert'Fresh Type'notinspecific_lookup.lookup_typenew_lookup=Lookup()assert'Fresh Type'innew_lookup.lookup_type
Package: dynamic-overload
Dynamic OverloadDynamic Overload is a python package that allows you to overload functions and classes using dynamic dispatch depending on the type of the arguments. This allows you to write more readable code and avoid using isinstance and type checks.The package also detects collisions between the overloads and warns the user about them without breaking the code. In case of collision, the first overload is used. So, its recomended that you put the most specific overloads first before the more general ones.InstallationRequires python 3.10 or higherpipinstalldynamic-overloadUsageFor functions:fromdynamic_overloadimportoverloadfromtypingimportIterable@overloaddefflatten(x:Iterable[int])->Iterable[int]:return[yforlinxforyinflatten(l)]@overloaddefflatten(x:int)->Iterable[int]:yieldxassertlist(flatten([1,[2,3],4]))==[1,2,3,4]assertlist(flatten(1))==[1]For classes:fromdynamic_overloadimportOverloadMetaclassInteger(metaclass=OverloadMeta):x:intdef__init__(self,x:int):self.x=xdef__init__(self,x:str):self.x=int(x)def__init__(self,x:float):self.x=int(x)assertInteger(1).x==1assertInteger('1').x==1assertInteger(1.0).x==1The package also supports inheritance similar to pythonabcmodule. So the previous example can be rewritten as:fromdynamic_overloadimportOverloadclassInteger(Overload):x:intdef__init__(self,x:int):self.x=xdef__init__(self,x:str):self.x=int(x)def__init__(self,x:float):self.x=int(x)assertInteger(1).x==1assertInteger('1').x==1assertInteger(1.0).x==1LicenseMIT
Package: dynamic_password
Attention!Only for really paranoid people as me.The project code and bugtracker is hosted onBitbucketandGithub.Introductiondjango-dynamic-password is a django application which allow you to add
dynamic password authentication for your web service.How it works?Verifies provided password according to DYNAMIC_PASSWORD_PATTERN in yoursettings.py. You can also enable this feature only for STAFF users, see below.You can format the value of your DYNAMIC_PASSWORD_PATTERN according to:http://docs.python.org/library/datetime.html#strftime-and-strptime-behaviorSome examples.Let’s assume that today isSeptember 29th, 2022, 8:01 (09-29-2022 8:01). Say your username is “admin” and password “s3kr3t”, according to your DYNAMIC_PASSWORD_PATTERN in settings.py you will have:Case 1:DYNAMIC_PASSWORD_PATTERN = '<PASSWORD>%d'
only today valid password: s3kr3t29Case 2:DYNAMIC_PASSWORD_PATTERN = '%d<PASSWORD>%H'
only this hour valid password: 29s3kr3t08Case 3:DYNAMIC_PASSWORD_PATTERN = '%d<PASSWORD>%H-%M'
only this minute valid password: 29s3kr3t08-01InstallationThere are a few different ways to install dynamic_password:Using pipIf you have pip install available on your system, just type:pip install django-dynamic-passwordIf you’ve already got an old version of dynamic_password, and want to upgrade,
use:pip install -U django-dynamic-passwordInstalling from a directoryIf you’ve obtained a copy of dynamic_password using either Mercurial or a
downloadable archive, you’ll need to install the copy you have system-wide.
Try running:python setup.py developIf that fails, you don’t havesetuptoolsor an equivalent installed;
either install them, or run:python setup.py installHow to configure dynamic_password?If you have already installed dynamic_password app, you must proceed with the
configuration of your project.Add dynamic_password to the INSTALLED_APPSOnce the dynamic_password is in your Python path, you need to modify the INSTALLED_APPS setting to include the dynamic_password module:INSTALLED_APPS = (
    # ...,
    # Third-party
    'dynamic_password',
    # ...,
    )Enable the custom authentication backendTo activate this backend you need at least put dynamic_password.backends.
DynamicPasswordBackend line to the AUTHENTICATION_BACKENDS tuple:AUTHENTICATION_BACKENDS = (‘dynamic_password.backends.DynamicPasswordBackend’,
)Set the DYNAMIC_PASSWORD_PATTERN in your settings.pyAdd this line to your settings.py:DYNAMIC_PASSWORD_PATTERN = ‘<PASSWORD>%m’change it’s value according to your needs.
Some examples:DYNAMIC_PASSWORD_PATTERN = '<PASSWORD>%d'
DYNAMIC_PASSWORD_PATTERN = '<PASSWORD>%m'
DYNAMIC_PASSWORD_PATTERN = '%m<PASSWORD>%d'
DYNAMIC_PASSWORD_PATTERN = '%d<PASSWORD>%Y'You can format this value according to:http://docs.python.org/library/datetime.html#strftime-and-strptime-behaviorOptional: set DYNAMIC_PASSWORD_ONLY_STAFFIn order to enable dynamic_password only for staff users you can add this
line to your settings.py:DYNAMIC_PASSWORD_ONLY_STAFF = TrueFuture development plansEnable “per user” dynamic password, DYNAMIC_PASSWORD_USERS = (‘user1’, ‘user2’, )
Package: dynamicpdf-api
Python Client Library (python-client)The python Client library (python-client) uses the DynamicPDF Cloud API to create, merge, split, form fill, stamp, obtain metadata, convert, and secure/encrypt PDF documents. The website for this project is available atcloud.dynamicpdf.com.The DynamicPDF Cloud API consists of the following endpoints.dlex-layoutimage-infopdfpdf-infopdf-textpdf-xmpPyPI PackageObtain the PyPI package athttps://pypi.org/project/dynamicpdf-api/DocumentationObtain overview documentation for the DynamicPDF Cloud API Client libraries from theCloud API Users Guide.Access the documentation for each particular endpoint from the following Users Guide pages.EndpointREST EndpointREST Endpoint Client LibraryDescriptiondlex-layoutCloud API Users Guide -dlex-layoutdlex-layoutReturns a PDF after processing a DLEX file with it's associated JSON data.image-infoCloud API Users Guide -image-infoimage-infoReturns image metadata as a JSON document.pdfCloud API Users Guide -pdfpdfReturns a PDF after performing one of the pdf endpoint's tasks (page,dlex,image) or merging.pdf-infoCloud API Users Guide -pdf-Infopdf-infoReturns PDF metadata as a JSON document.pdf-textCloud API Users Guide -pdf-textpdf-textReturns the text from a PDF as a JSON document.pdf-xmpCloud API Users Guide -pdf-xmppdf-xmpReturns XMP metadata from a PDF.TutorialsThe following table lists the available tutorials.Tutorial TitleTutorial LocationMerging PDFshttps://cloud.dynamicpdf.com/docs/tutorials/cloud-api/merging-pdfsCompleting an AcroFormhttps://cloud.dynamicpdf.com/docs/tutorials/cloud-api/form-completionCreating a PDF Using a DLEX and thepdfEndpointhttps://cloud.dynamicpdf.com/docs/tutorials/cloud-api/dlex-pdf-endpointAdding Bookmarks to a PDFhttps://cloud.dynamicpdf.com/docs/tutorials/cloud-api/bookmarksCreating a PDF Using thedlex-layoutEndpointhttps://cloud.dynamicpdf.com/docs/tutorials/cloud-api/dlex-layoutExtracting Image Metadatahttps://cloud.dynamicpdf.com/docs/tutorials/cloud-api/image-infoExtract PDF Metadatahttps://cloud.dynamicpdf.com/docs/tutorials/cloud-api/pdf-infoExtracting PDF's Texthttps://cloud.dynamicpdf.com/docs/tutorials/cloud-api/pdf-textExtract XMP Metadatahttps://cloud.dynamicpdf.com/docs/tutorials/cloud-api/pdf-xmpSupportThe primary source for the DynamicPDF Cloud API support is throughStack Overflow. Please use the "dynamicpdf-api" tag to ask questions. Our support team actively monitors the tag and responds promptly to any questions. Also, let us know you asked the question by following up with an email tosupport@dynamicpdf.com.Pro Plan Subscribers#Ticket support is available to Pro Plan subscribers. But we still encourage you to help the community by posting on Stack Overflow when possible. You can also emailsupport@dynamicpdf.comif you need to ask something specific to your use case that may not help the DynamicPDF Cloud API community.LicenseThepython-clientlibrary is licensed under theMIT License.
Package: dynamic-pip
Dynamic PipPhoto by David Dibert:https://www.pexels.com/photo/green-and-gray-evergreen-cargo-ship-1117210/Help users to dynamically manage python package resources and bid farewell to the constraints of therequirements.txtfile.Build-inpipRefer:https://pip.pypa.io/en/stable/cli/pip_install/Dynamic-PipThroughDynamicPipclass object, dynamically manage (install, delete, etc.) python packages during the execution of the program. In addition, compared to build-inpip,dynamic-pipalso supports some extended functions.Example: Install thenumpypackage at runtimefromdynamicPipimportDynamicPipdynamic_pip=DynamicPip()# declare target packagetarget_package='numpy==1.21.6'# installprint(f'----- install{target_package}test -----')rtn=dynamic_pip.install_single_package(target_package)print(f'return result code{rtn}\n')# check package listprint(f'----- list{target_package}test -----')rtn=DynamicPip.list_package()print(f'return result{rtn}\n')# uninstall single packageprint(f'----- uninstall{target_package}test -----')rtn=DynamicPip.remove_single_package(target_package)print(f'return result code{rtn}\n')deldynamic_pipExample: Build a requirement mapfromdynamicPipimportDynamicPipdynamic_pip=DynamicPip()dynamic_pip.generate_requires_map()Example: List all installed packages. (pip list)# check package as dict. (key = package name, value = version )rtn=dynamic_pip.list_package()print(f'return result{rtn}\n')Example: Generate a requirement mapdynamic_pip.generate_requires_map(target_output_requirements__map_file_name)Featuressupport install / uninstall specific package(s) at runtimeinstall / uninstall from the given requirements filesupport python test unitsupport multiple index-url, auto-detect fastest PyPI mirrorsupport extra-index-urlexport requirements filebuild requires mapLimitationsofficialinspectfunction is still in the experimental stage.official--dry-runfunction is still in the experimental stage.official--reportfunction is still in the experimental stage.Future versiongenerate a report about all installed packagesfind package existauto-detect packages with custom version from githubverify hashinstall from local fileinstall from compressed fileinstall from FTPdynamicimport