Saravanan666/pypi-org huggingface dataset:
Package: python-none-objects
python-none-objectsA collection of "None" objects compatible with various Python typesThe following code yields warning for "Default argument value is mutable".fromtypingimportList,Dictdeffoo(some:int,other:List=[],thing:Dict={}):foroinother:bar(some,o,thing)It is usually recommended to use None instead
(https://stackoverflow.com/questions/41686829/why-does-pycharm-warn-about-mutable-default-arguments-how-can-i-work-around-the):fromtypingimportList,Dict,Optionaldeffoo(some:int,other:Optional[List]=None,thing:Optional[Dict]=None):ifotherisNone:other=[]ifthingisNone:thing={}foroinother:bar(some,o,thing)But I prefer less boilerplate code like this:fromtypingimportIterable,MappingfromtypesimportMappingProxyTypedeffoo(some:int,other:Iterable=(),thing:Mapping=MappingProxyType({})):foroinother:bar(some,o,thing)This package introduces constants to make the code more readable:fromtypingimportIterable,Mappingfrompython_none_objectsimportNoneIterable,NoneMappingdeffoo(some:int,other:Iterable=NoneIterable,thing:Mapping=NoneMapping):foroinother:bar(some,o,thing)Be sure to look at the discussions on GitHub:https://github.com/LLyaudet/python-none-objects/discussions.There is a poll on the naming convention you would prefer:https://github.com/LLyaudet/python-none-objects/discussions/2.And there is a discussion on various ideas to optimize the code with these constants:https://github.com/LLyaudet/python-none-objects/discussions/3.I think it would be better to have this kind of constants in the standard library.
If you think after reading everything, that it is indeed a good idea, add a star to this repository to let the rest of the Python community know that you would like to see such constant objects in the language :).https://github.com/LLyaudet/python-none-objects/If the project gains popularity, I'll try to propose it officially.
Package: python-nosql-logger
python-nosql-loggerInstallation steps if using MongoDBpip install pymongo #"pymongo[srv]" or "pymongo[aws]"
  pip install python-nosql-loggerInitializeFor synchronous mongo loggerfrom pynosql_logger.loggers import MongoLogger

  connection_string = 'your_mongodb_connection_string'
  logger = MongoLogger(connection_string)For asynchronous mongo loggerfrom pynosql_logger.async_loggers import AsyncMongoLogger

  connection_string = 'your_mongodb_connection_string'
  logger = AsyncMongoLogger(connection_string)Installation steps if using ElasticSearchpip install requests
  pip install python-nosql-loggerInitializeFor synchronous elastic loggerfrom pynosql_logger.loggers import ElasticLogger

  elastic_url = 'http://127.0.0.1:9200'
  logger = ElasticLogger(elastic_url)For asynchronous elastic loggerfrom pynosql_logger.async_loggers import AsyncElasticLogger

  elastic_url = 'http://127.0.0.1:9200'
  logger = AsyncElasticLogger(elastic_url)Add Logreq_json = {
      'users': {
          'first_name': 'Hitesh',
          'last_name': 'Mishra',
          'email': 'hiteshmishra708@gmail.com'
      }
  }
  resp = logger.add_log(req_json)Add Bulk Logreq_json = {
      'users': [{
          'first_name': 'Test',
          'last_name': 'User 1',
          'email': 'testuser1@mailnesia.com'
      }, {
          'first_name': 'Test',
          'last_name': 'User 2',
          'email': 'testuser2@mailnesia.com'
      }]
  }
  resp = logger.add_log(req_json)Get LogYou can pass mongo query or elastic query to get the logsreq_json = {
      'users': {
        'first_name': 'Hitesh'
      }
  }
  resp = logger.get_log(req_json)Get All Logsreq_json = {
      'collection': 'users'
  }
  resp = logger.get_all_logs(req_json)
Package: pythonnote
Python NoteA simple Python study and running online toolJust need your computer to run the python environmentuse it, from pip：pip install pythonnotethen , only 2 line code , in any location:frompythonnoteimportrunrun()# or run(host="127.0.0.1", port=8080)or use it, from source code :clone sourcethen:1.pip install these package >>['uvicorn', 'fastapi', 'pydantic', 'aiofiles', 'jinja2']2.run python script :pythonnote/web/main.pyindexcode listall code list , you can add new code oredit code or note markdownor select contain keyword code use button 'Find'select codeonly see contain 'Sum' codecode showcode detail viewyou can run & debug & study & add code & note Markdownyou can edit you python code & run you code online !code markdown notecode's markdown noteyou can click Edit Button to Edit you notecode markdown editcode's markdown note can easy online edit, andyou can click Save Button to Save you Edited noteleft textarea to edit Markdown, right textarea show markdown's result view
Package: python-notify
python-notifypython-notify is an object-oriented implementation of the observer design pattern in python3
supporting signature checking at connection stage,
checking of passed arguments at call stage, notifiable collections asList,Dictand decorator@notifiable_propertySetupLibrary can be installed with pip:pip3 install python-notifySimple examplesSignalimport typing

from notify.signal import Signal


class Obj:
    event_happened = Signal(data=typing.Mapping)


def event_handler(data: typing.Mapping):
    print(f'{data=}')

obj = Obj()
obj.event_happened.connect(event_handler)
obj.event_happened.notify({'key': 'value'})  # Will print "data={'key': 'value'}"CollectionsThis package implements specialized container data types providing
alternatives to Python's general purpose built-in containers, dict,
list, with signals for state changes.List signalsitems_added = Signal(items=typing.Tuple[object], pos=Position)
    items_changed = Signal(past_items=typing.Tuple[object], new_items=typing.Tuple[object], pos=Position)
    items_removed = Signal(items=typing.Tuple[object], pos=Position)
    items_cleared = Signal()

    # Where Position = t.Union[int, slice]List exampleimport typing as t

from notify.collections import List


def on_items_added(items: t.Iterable[object], pos: int):
    print(items, pos)

obj = List((1, 2, 3))
obj.items_added.connect(on_items_added)

obj.extend((4, 5))
# will print: (4, 5), 3Dict signals:key_added = Signal(key=object, item=object)
    key_changed = Signal(key=object, past_item=object, new_item=object)
    key_removed = Signal(key=object)@notifiable_propertynotifiable_property decorator is alternative to Python's @property decorator
with signals for state changes.from notify.property import notifiable_property


class Obj:
    def __init__(self, value):
        self._value = None
        self.value = value

    @notifiable_property
    def value(self):
        return self._value

    @value.setter
    def value(self, value):
        self._value = value * 2

    @value.deleter
    def value(self):
        del self._value


obj = Obj(value=1)
assert obj.value == 2


def on_value_changed(past_value, new_value):
    print(f'{past_value=}, {new_value=}')

obj.value_changed.connect(on_value_changed)

obj.value = 2
# Will print 'past_value=2, new_value=4'
assert obj.value == 4


def on_value_removed(past_value):
    print(f'{past_value=}')
obj.value_removed.connect(on_value_removed)

del obj.value
# Will print 'past_value=4'
Package: python-notion
A Python package for notion API athttps://developers.notion.com/reference/intro.Free software: MIT licenseUsage` >>> from notion import Notion >>> client =Notion(api_token="XYZ")>>>client.get_users(notion_version="2021-12-12")`CreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.
Package: python-notion-exporter
NotionExporterDescriptionNotionExporteris a Python class designed to simplify the process of exporting content from Notion. It provides an interface to configure, trigger, and download content exports from Notion. The class supports exporting content in various formats (Markdown, HTML, PDF) and also allows users to choose the scope of the export (current view vs. all content).FeaturesExport content inMarkdown,HTML, orPDFformat.Configure the scope of your export:current vieworall content.Option to include or exclude files in the export.Flatten the file tree structure upon export.Export multiple pages concurrently for faster processing.Monitor export progress with a progress bar.Automatically unpack zipped export files.UsageDownload:pipinstallpython-notion-exporterInitialization:frompython_notion_exporterimportNotionExporterif__name__=="__main__":exporter=NotionExporter(token_v2="YOUR_NOTION_TOKEN",file_token="YOUR_FILE_TOKEN",pages={"Page Name":"Page ID"},export_directory="path/to/save",flatten_export_file_tree=True,export_type=ExportType.MARKDOWN,current_view_export_type=ViewExportType.CURRENT_VIEW,include_files=True,recursive=True)exporter.process()You will need to get thetoken_v2andfile_tokenvalues from your Notion cookies. Thepagesdictionary should contain pairs ofpage_name: page_idfor each page you want to export.Needed CookiesTo export anything from Notion, one needs to authenticate oneself with some
Cookies (like a browser would). These cookies are calledtoken_v2andfile_token. They are set on all requests of a logged in user when using the
Notion web-app.How to retrieve the Cookies?Go tonotion.so.Log in with your account.Open the developer tools of your browser, open Application > Storage > Cookies
(Chrome); Storage tab (Firefox).Copy the value of the Cookies calledtoken_v2andfile_tokenand paste
them somewhere safe.⚠️ If you don't findfile_token, you need to have at least had exported a file manually once.Those cookies have a1 year validity, so you don't need to do this often.Process Exports:exporter.process()This will initiate the export, download, and unpacking processes for the pages defined.RequirementsPython 3.6+For more details or any issues, please raise a ticket or contact the maintainers.
Package: python-novaclient
Team and repository tagsPython bindings to the OpenStack Compute APIThis is a client for the OpenStack Compute API. It provides a Python API (thenovaclientmodule) and a deprecated command-line script (nova). The
Python API implements 100% of the OpenStack Compute API.License: Apache License, Version 2.0PyPi- package installationOnline DocumentationLaunchpad project- release managementBlueprints- feature specificationsBugs- issue trackingSourceSpecsHow to ContributeRelease Notes
Package: python-nozomi
python-nozominozomi.la API in Python.FeaturesRetrieving media postsDownloading mediaInstallation$ pip install python-nozomiUpgrade$ pip install python-nozomi --upgradeExample UsageRetrieve and download a single post provided a URLfrompathlibimportPathfromnozomiimportapiurl='https://nozomi.la/post/26905532.html#veigar'# Retrieve post metadata using the URLpost=api.get_post(url)# Download the postapi.download_media(post,Path.cwd())Retrieve and download multiple posts provided a list of URLsfrompathlibimportPathfromnozomiimportapiurls=['https://nozomi.la/post/26905532.html#veigar',"https://nozomi.la/post/26932594.html#cho'gath",'https://nozomi.la/post/25802243.html#nautilus']# Retrieve all of the post metadata using the URLsposts=api.get_posts(urls)# Download the postsforpostinposts:api.download_media(post,Path.cwd())Retrieve and download all posts containing certain tags# The tags that the posts retrieved must containpositive_tags=['veigar','wallpaper']# Gets all posts with the tags 'veigar', 'wallpaper'forpostinapi.get_posts_with_tags(positive_tags):api.download_media(post,Path.cwd())Retrieve all posts containing certain tags, ignoring blacklisted tags# The blacklisted tagsnegative_tags=['chogath']# Gets all posts with the tags 'veigar' and 'wallpaper' without the 'chogath' tag.forpostinapi.get_posts_with_tags(positive_tags,negative_tags):api.download_media(post,Path.cwd())
Package: python-nrpc
Python NRPCA python code generator and lib for Nats RPC.Seehttps://github.com/nats-rpc/nrpcfor more information on NRPC itself.This package provides a protoc plugin to generate python code from
.proto files, respecting the nrpc specifications.Developer notesRunning testsGet a 'nats-server' binary in the PATH, you can get the latest release fromhttps://github.com/nats-io/nats-server/releases.Install the test requirements:pipinstall-rrequirements-test.txtRun the tests:pytestIf the template changed, you may need to run "gen.sh" in theexamples/alloptionsdirectory.Generating protobuf filesFor regenerating the nrpc protobuf files, make sure the protobuf is installed.Copy 'nrpc.proto' from thehttps://github.com/nats-rpc/nrpcproject into the nrpc/ directory.Then, run the following command:pythonsetup.pyprotoc
Package: python-nss
python-nss is a Python binding for NSS (Network Security Services) and
NSPR (Netscape Portable Runtime). NSS provides cryptography services
supporting SSL, TLS, PKI, PKIX, X509, PKCS*, etc. NSS is an
alternative to OpenSSL and used extensively by major software
projects. NSS is FIPS-140 certified.NSS is built upon NSPR because NSPR provides an abstraction of common
operating system services, particularly in the areas of networking and
process management. Python also provides an abstraction of common
operating system services but because NSS and NSPR are tightly bound
python-nss exposes elements of NSPR.More information on python-nss can be found on thepython-nss project pageFor information on NSS and NSPR, see the following:Network Security Services.NSS project page.Netscape Portable Runtime.NSPR project page.To build python-nss you the C language header files and libraries for
both NSPR and NSS will need to be installed. This is system and
distribution specific, as such we cannot give you explicit
instructions. On Linux typically these packages are called:nss-develnspr-develUse your system package manger to install them, for example on Fedora:% sudo yum install nss-devel nspr-develAfter all packages are installed, then:% python setup.py build
% sudo python setup.py installTo generate the API documentation:% python setup.py build_doc
Package: python-ntfy
ntfy.sh Python LibraryAn easy-to-use ntfy python library. Aiming for full feature support.QuickstartInstall using pip withpip3 install python-ntfyIf you are using a server that requires auth, set the env varsImport the libraryfrompython_ntfyimportNtfyClientCreate anNtfyClientinstance with a topicclient=NtfyClient(topic="Your topic")Send a messageclient.send("Your message here")Supported FeaturesUsername + password authCustom serversSending plaintext messagesSending Markdown formatted text messagesRetrieving cached messagesScheduled deliveryFuture FeaturesAccess token authEmail notificationsTagsAction buttonsSend to multiple topics at onceTest and DevelopmentThis project uses Poetry.TestsThis project is aiming for 95% code coverage. Any added features must include comprihensive tests.To run tests:poetry install --include testAdd username and password for ntfy.sh to.envpoetry run pytest --cov
Package: python-nytcongress
A Python client for the New York Times [Congress API](http://developer.nytimes.com/docs/congress_api)Install$ pip install python-nytcongressOr download and run$ python setup.py installUsage>>> from nytcongress import NytCongress
>>> congress = NytCongress(API_KEY)# get member by bioguide ID
>>> pelosi = congress.members.get(‘P000197’)
>>> pelosi[‘twitter_id’]
‘NancyPelosi’# get recent House bills
# recent bills come in two types: ‘introduced’ and ‘updated’
>>> introd = congress.bills.recent(chamber=’house’, congress=111, type=’introduced’)
>>> len(introd[‘bills’])
20
>>> introd[‘chamber’]
‘House’# or use a convenience function
>>> introd = congress.bills.introduced(‘house’)
>>> introd[‘chamber’]
‘House’
>>> len(introd[‘bills’])
20
Package: python-oauth-token-manager
Python Library for storing OAuth credentials in many locationsWhat's this for?By their very nature, OAuth credentials are valuable and dangerous, and have
to be stored securely. As a result, the same tasks to store these tokens in a
simple and secure fashion have to be written each time, or copied and pasted
around - leading to potential issues as problems are found and not fixed
in all places.This library will store OAuth tokens in any of the following places:Secret ManagerFirestoreGoogle Cloud Storage filesA localjsonfileOther storage locations can be added at will simply by forking this library and
extending the appropriate abstract classes.Initial Setup And InstallationExamplesFetching a token from storagefrom auth.credentials_helpers import encode_key
from auth.secret_manager import SecretManager

manager = SecretManager(project='<gcp project name>')
key = manager.get_document(encode_key('<token id>'))Note the use ofencode_key. This is because many of the storage systems
supported do not allow special characters, and the most convenient identifier
for most OAuth tokens is the email address of the user.encode_keyis a
base64 encoder - and no decoding is necessary.The example given uses Secret Manager (part of Google Cloud). To use (say) GCS,
the code would change like this:from auth.credentials_helpers import encode_key
from auth.gcs_datastore import GCSDatastore

manager = GCSDatastore(project='<gcp project name>', bucket='<gcs bucket>')
key = manager.get_document(encode_key('<token id>'))All that changes is where the datastore is!Storing a token in Secret Managerfrom auth.secret_manager import SecretManager
manager = SecretManager(project='<gcp project name>')

manager.update_document(id=encode_key('<token_id>'), new_data=<token string>)This will implicitly create asecretif there was not one already, or simply
update an existing secret with a new 'live' version of the secret.Listing all the available secretsfrom auth.secret_manager import SecretManager
manager = SecretManager(project='<gcp project name>')

manager.list_documents()Removing a secretfrom auth.secret_manager import SecretManager
manager = SecretManager(project='<gcp project name>')

manager.delete_document(id=encode_key('<token_id>'))
Package: python-obfuscator
Python-ObfuscatorOne night I got bored of writing good code, so I made good code to make bad code.Consider sponsoring mehereInstallingpip install python-obfuscatorQuickstartPrint out obfuscated codepyobfuscate -i your_file.pyApply changes to the input filepyobfuscate -i your_file.py -r TrueMore Detailed DocumentationYou can use this as a module if you wantimport python_obfuscator
obfuscator = python_obfuscator.obfuscator()

code_to_obfuscate = "print('hello world')"You can also exclude certain techniques applied for obfuscationimport python_obfuscator
from python_obfuscator.techniques import add_random_variables
obfuscator = python_obfuscator.obfuscator()

code_to_obfuscate = "print('hello world')"
obfuscated_code = obfuscator.obfuscate(code_to_obfuscate, remove_techniques[add_random_variables])Find a list of all techniqueshereExample Obfuscated CodeInputy = input("what's your favorite number")

user_value = int(y)
print("{} that's a great number!".format(user_value))Withpyobfuscate -i file.pyWith--one-liner TrueBuilt WithPython 3.7- The web framework usedAuthorsDavid Teather-Initial work-davidteatherSee also the list ofcontributorswho participated in this project.LicenseThis project is licensed under the MIT License - see theLICENSE.mdfile for details
Package: python-object-detector
python-object-detectorGeneric object detector interface for Pythonhttps://semver.org/spec/v2.0.0.htmlGiven a version number MAJOR.MINOR.PATCH, increment the:MAJOR version when you make incompatible API changes,
MINOR version when you add functionality in a backwards compatible manner, and
PATCH version when you make backwards compatible bug fixes.
Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.IntroductionInstallationpipinstallpython-object-detectorUsageHistoryDevelopmentblack./src/./tests/.mypy.pflake8.
Package: python-object-getter
PYTHON OBJECT GETTERImport something from a module, while mocking anything in its namespace.Source Code:https://github.com/boromir674/python-object-getterPypi Package:https://pypi.org/project/python_object_getter/Featurespython_object_getterpython packageGreat FeatureNice FeatureTest SuiteusingPytestParallel Executionof Unit Tests, on multiple cpu’sAutomation, usingtoxCode CoveragemeasuringBuild Command, using thebuildpython packagePypi Deploy Command, supporting upload to bothpypi.organdtest.pypi.orgserversType Check Command, usingmypyCI Pipeline, running onGithub ActionsJob Matrix, spanning differentplatform’s andpython version’sPlatforms:ubuntu-latest,macos-latestPython Iterpreters:3.6,3.7,3.8,3.9,3.10Parallel Jobexecution, generated from thematrix, that runs theTest SuitePrerequisitesYou need to havePythoninstalled.QuickstartUsingpipis the approved way for installingpython_object_getter.python3-mpipinstallpython_object_getterTODO demonstrate a use caseLicenseGNU Affero General Public License v3.0LicenseFree software: GNU Affero General Public License v3.0
Package: python-objectifier
objectifierInstallation:pip install python-objectifierfrom objectifier import convert_json_to_object

test_dict = {
        'name': 'Deckow-Crist',
        'catchPhrase': 'Proactive didactic contingency',
        'bs': 'synergize scalable supply-chains'
        }

dict_as_object = convert_json_to_object(test_dict)
dict_as_object.name
> 'Deckow-Crist'

'catchPhrase' in dict_as_object # Retains all original dictionary methods
> Truetest_list = [
    {
        'id': 1,
        'name': 'Leanne Graham',
        'username': 'Bret',
        'email': 'Sincere@april.biz',
        'address': {
            'street': 'Kulas Light',
            'suite': 'Apt. 556',
            'city': 'Gwenborough',
            'zipcode': '92998-3874',
            'geo': {
                'lat': '-37.3159',
                'lng': '81.1496'
            }
        },
        'phone': '1-770-736-8031 x56442',
        'website': 'hildegard.org',
        'company': {
            'name': 'Romaguera-Crona',
            'catchPhrase': 'Multi-layered client-server neural-net',
            'bs': 'harness real-time e-markets'
        }
    },
    {
        'id': 2,
        'name': 'Ervin Howell',
        'username': 'Antonette',
        'email': 'Shanna@melissa.tv',
        'address': {
            'street': 'Victor Plains',
            'suite': 'Suite 879',
            'city': 'Wisokyburgh',
            'zipcode': '90566-7771',
            'geo': {
                'lat': '-43.9509',
                'lng': '-34.4618'
            }
        },
        'phone': '010-692-6593 x09125',
        'website': 'anastasia.net',
        'company': {
            'name': 'Deckow-Crist',
            'catchPhrase': 'Proactive didactic contingency',
            'bs': 'synergize scalable supply-chains'
        }
    }
]

convert_json_to_object(test_list) # Converts list in place
test_list[0].address.suite
> 'Apt. 556'
Package: python-obscene-words-filter
Python obscene words filter.This is ultra simple words filter, based on regular expressions.
It is built on regular expressions, with Russian language support from the box.It may work with your language too (if you will write your own regular
expressions).Before using in production, you should test it, because there are
no swear words filter in the world that does well filtering,
so the quality is not 100%.But test coverage is :)QuickstartSample code:from obscene_word_filter.default import get_default_filter

f = get_default_filter()Or:from obscene_word_filter import conf
from obscene_word_filter.words_filter import ObsceneWordsFilter

f = ObsceneWordsFilter(conf.bad_words_re, conf.good_words_re)Then you can mask use input:f.mask_bad_words("Тут должны быть матерные слова.")
>>> Тут должны быть ******** *****.DocumentationJust read the tests :)