Saravanan666/pypi-org huggingface dataset:
Package: python-send-logs-to
python-send-logs-toA Python logging handler that sends logs to Redis; later to be a collection
of logging handlers.QuickstartInstall the package:pip install python-send-logs-toA code snippet showing an example logging config:importloggingfromdatetimeimporttimedeltafromlog_to.redisimportRedisLogHandlerdefconfigure_logging():logger=logging.getLogger('mylogger')logger.setLevel(logging.INFO)formatter=logging.Formatter(fmt='[{asctime}]{name}|{levelname}|{message}',style='{',)# All arguments shown here are default; except for `key`handler=RedisLogHandler(key='logging:mylogger',host='localhost',port=6379,password='',db=0,cap=100_000,attach_date_to_key=True,expire_after=timedelta(days=61),# Only supported for Redis 7 or higher)handler.setFormatter(formatter)logger.addHandler(handler)returnloggerDjango logging example# In your project's settings.py file# Logging# https://docs.djangoproject.com/en/4.2/topics/logging/default_handlers=[]ifDEBUG:default_handlers+=['console','redis']log_level='DEBUG'else:default_handlers+=['redis']log_level='WARNING'default_logger_config={'handlers':default_handlers,'level':log_level,}LOGGING={'version':1,'disable_existing_loggers':False,'handlers':{'console':{'class':'logging.StreamHandler',},'redis':{'class':'log_to.redis.RedisLogHandler','key':'logging:myapp','host':REDIS_HOST,'port':REDIS_PORT,'password':REDIS_PASSWORD,},},'loggers':{'myapp':default_logger_config,'specific_logger':default_logger_config,},}And then in some module where you want to use the logging:importlogginglogger=logging.getLogger('myapp')# OR# logger = logging.getLogger('specific_logger')logger.info('Testing 123')CompatiblityCompatible with Python 3.8 and above.VersioningThis project followssemantic versioning(SemVer).License and requirementsCheck the root of the repo for these files.
Package: python-sendmail
python-sendmailSendmail client. send mail via stmp server.Installpip install python-sendmailInstalled Command LinespysendmailHelptest@test ~ % pysendmail --help
Usage: pysendmail [OPTIONS] [CONTENT]

  Send mail.

Options:
  -f, --from-address TEXT  Mail sender, e.g. Name <name@example.com> or
                           name@example.com.  [required]
  -t, --to-address TEXT    Mail recipients, e.g. Name <name@example.com> or
                           name@example.com.  [required]
  -s, --subject TEXT       Mail subject
  -a, --attach TEXT        Mail attachments, allow multiple use.
  --html                   Mail content is HTML format.
  -e, --encoding TEXT      Encoding of the mail content input.
  -c, --charset TEXT       Encoding of the mail content output.
  -h, --host TEXT          Mail server address, default to 127.0.0.1.
  -p, --port INTEGER       Mail server port, default to 25. If you are using
                           an ssl server, mostly the port should be 465.
  --ssl                    Mail server using ssl encryption.
  -u, --user TEXT          Mail server login account. Empty user means don't
                           use login.
  -P, --password TEXT      Mail server login password. Empty password means
                           don't use login.
  --verify                 Verify ssl certificate.
  --help                   Show this message and exit.使用案例Send mail with auth, without attachment.Mail sender：sender@example.comMail recipient:recipient@exmaple.comSubject：just a test mailContent：just a test mailMail Server Address：stmp.example.comMail Server Port：465Use ssl: yesAccount:sender@example.comPassword: senderPasswordAttachment: Nonepysendmail -h stmp.example.com -p 465 --ssl -u sender@example.com -P senderPassword -f 'SENDER <sender@exmaple.com>' -t recipient@exmaple.com -s 'just a test mail' 'just a test mail'Send mail with attachment, without authMail sender：sender@example.comMail recipient:recipient@exmaple.comSubject：just a test mailContent：just a test mailMail Server Address：127.0.0.1Mail Server Port：25Use ssl: NoAccount: NonePassword: NoneAttachment: /path/to/attachment.pdfpysendmail -f sender@exmaple.com -t recipient@exmaple.com -s 'just a test mail' -a /path/to/attachment.pdf 'just a test mail'Releasesv0.3.4Doc update.v0.3.3Fix ssl context problem.Add attach filename support.v0.3.2Add verify option. By default python-sendmail will ignore the ssl verify.v0.3.1Change help information to english.Use new style to release.v0.3.0Old style release.
Package: python-sentiment
InstallationThis module is used for sentiment analysis of a text. The module prints 'pos' for text having positive sentiments while 'neg' for text having negative sentiments. It is built on top of nltk and basic python modules.Usages: python-sentiment "InputText"$pipinstallpython-sentiment
$python-sentiment"The movie was awesome"LicenseMITAuthorSahil Ahuja
Package: python_sentinel
sentinelThis program is a security monitoring program that uses video to detect
motion, that records motion video, can express speech alerts, can
express alarms and attempts to communicate alerts as configured.setup (Ubuntu 16.04 LTS)Python 2 and OpenCV 2 are required. Specifically, this program has been
tested with OpenCV 2.4.9.1 and 2.4.13.5.Install dependencies.sudoaptupdatesudoaptinstall\libasound-dev\python-dev\python-pyaudio\portaudio19-dev\python-tkInstall OpenCV 2 using the following procedure, which was definedhere.sudoaptinstall\build-essential\cmake\libgtk2.0-dev\pkg-config\python-dev\checkinstall\libavcodec-dev\libavcodec-dev\libavformat-dev\libavformat-dev\libdc1394-22-dev\libgstreamer0.10-dev\libgstreamer-plugins-base0.10-dev\libgtk2.0-dev\libjasper-dev\libjasper-dev\libjpeg-dev\libjpeg-dev\libmp3lame-dev\libopencore-amrnb-dev\libopencore-amrwb-dev\libopencv-dev\libpng12-dev\libqt4-dev\libswscale-dev\libswscale-dev\libtbb-dev\libtheora-dev\libtiff5-dev\libv4l-dev\libvorbis-dev\libxine2\libxvidcore-dev\python-dev\python-numpy\v4l-utils\x264\yasmwgethttps://github.com/opencv/opencv/archive/2.4.13.5.zip-Oopencv-2.4.13.5.zipunzipopencv-2.4.13.5.zipcdopencv-2.4.13.5mkdirreleasecdreleasecmake\-G"Unix Makefiles"\-DCMAKE_CXX_COMPILER=/usr/bin/g++\CMAKE_C_COMPILER=/usr/bin/gcc\-DCMAKE_BUILD_TYPE=RELEASE\-DCMAKE_INSTALL_PREFIX=/usr/local\-DWITH_TBB=ON\-DBUILD_NEW_PYTHON_SUPPORT=ON\-DWITH_V4L=ON\-DINSTALL_C_EXAMPLES=ON\-DINSTALL_PYTHON_EXAMPLES=ON\-DBUILD_EXAMPLES=ON\-DWITH_QT=ON\-DWITH_OPENGL=ON\-DBUILD_FAT_JAVA_LIB=ON\-DINSTALL_TO_MANGLED_PATHS=ON\-DINSTALL_CREATE_DISTRIB=ON\-DINSTALL_TESTS=ON\-DENABLE_FAST_MATH=ON\-DWITH_IMAGEIO=ON\-DBUILD_SHARED_LIBS=OFF\-DWITH_GSTREAMER=ON..makeall-j"$(nproc)"sudomakeinstallcd../../rm-rf./opencv-2.4.13.5sudoaptinstallpython-opencvecho-e"OpenCV version:"pkg-config--modversionopencvInstall sentinel.sudopipinstallpython_sentinelManually create an account on a Matrix homeserver. Add the credentials
to the scalar configuration file, as describedhere.usagesentinel--helpsentinel--display_windows=false--launch_delay=120--record_duration=15--message=trueIn case of connections problems or other problems that might cause a
crash, It may be sensible to havesentinelrestart in the case of a
crash. This could be done in a way like the following, perhaps with the
function described added to.bashrc, and perhaps saving to Nextcloud
for remote recording (in additional to the remote recording via
messaging):run_sentinel(){#cd ~/Nextcloud#mkdir sentinel#cd sentinelwhiletrue;dosentinel--display_windows=false--launch_delay=120--record_duration=15--message=truesleep5done}run_sentinelfutureMigration from OpenCV 2 to OpenCV 3 or 4 is under consideration.
Package: python-serializer
Introducing Python Data ContractsWith this package you can define your own data contracts strictly and definedata validationsandpre-processingsteps which will insure data integrity and capable of serializing to-and-from JSON format.Example Usagefrom serializer import Interface
class IP(Interface):

    # Declaring data type validations
    ip_address = str
    host_name = str

class Record(Interface):
    user_name = str
    age = int
    ip = IP

    # Pre-processors to standardize data
    def __user_name__(value):
        return value.capitalize()

args = {
    'user_name': 'ximi', 
    'age': 21, 
    'ip': IP(ip_address='192.168.2.1', host_name='localhost')
    }
request = Record(**args)
print ("Serializing from Object to JSON: \n", request.serialize())
# Serializing from Object to JSON:  
# {'user_name': 'Ximi', 'age': 21, 'ip': {'ip_address':'192.168.2.1', 'host_name': 'localhost'}}
args = {
    'user_name': 'ximi', 
    'age': 21, 
    'ip': {
        'ip_address': '192.168.2.1',
        'host_name': 'localhost'
        }
    }
request = Record(**args)
print ("Serialise with Reverse type conversion: \n", request.serialize())
# Serialise with Reverse type conversion: 
# {'user_name': 'Ximi', 'age': 21, 'ip': {'ip_address': '192.168.2.1', 'host_name': 'localhost'}}
Package: python-server-metrics
A very simple set of methods to collect metrics about your serversInstallationTo get the latest stable release from PyPipipinstallpython-server-metricsTo get the latest commit from GitHubpipinstall-egit+git://github.com/bitmazk/python-server-metrics.git#egg=server_metricsUsageSimply import the package and use it anywhere in your python code:from server_metrics.memory import get_memory
from server_metrics.hard_disk import get_disk_usage
from server_metrics.postgresql import get_database_size
from server_metrics.cpu import get_cpu_usage
from server_metrics.memcached import get_memcached_usage

print get_memory()
print get_disk_usage('$HOME')
print get_database_size('my_role', 'my_db')
print get_cpu_usage('user')
print get_memcached_usage('~/memcached.sock')ContributeIf you want to contribute to this project, please perform the following steps# Fork this repository
# Clone your forkmkvirtualenv-ppython2.7python-server-metricsmakedevelopgitco-bfeature_branchmaster# Implement your feature and testsgitadd.&&gitcommitgitpush-uoriginfeature_branch# Send us a pull request for your feature branch
Package: python-server-MPZinke
PythonServerA Flask server class for simple routing by HTTP method.Build CommandsFROM:https://packaging.python.org/en/latest/tutorials/packaging-projects/python3 -m pip install --upgrade buildpython3 -m pip install --upgrade twinepython3 -m buildpython3 -m twine upload --repository testpypi dist/*username:__token__password:<API KEY>python3 -m pip install --index-url https://test.pypi.org/simple/ --no-deps python_server_MPZinke
Package: python-service-builder
Python Library for helping to create Python services from Google APIsSomething I have to do a lot is create connections to Google Service
endpoints. This generally requires a fair amount of boiler-plate code that io
just copied and pasted from other locations. Also any time a new service is
needed, I need to find that specific implementation of the service builder and
add the new endpoint.Obviously this can lead to potential errors and if a bug is found, I have to
remember where I created these services and fix it in many projects.This has led me to create a small helper library to make the process easier.
Included in the library is a complete and updated (at time of publishing) list
of all the Google APIs along with their versions and endpoints asEnums
ready for use.Usageservice_builder.build_service()needs two mandatory pieces of information:ParameterDescriptionkeyThe credentials to use to authenticate the user to the service it has to createserviceThe Google API endpoint it is trying to connect to.keyThese can be supplied in one of 4 ways.A validgoogle.oauth2.Credentialsobject, created and passed to the
service builder.Anstrwhich is the name of a local file containing thejsonrepresentation of an OAuth credentials object.AMappingobject which is ajsonkeyfiledictAnOAuthKeyobject from this package, which is adataclassobject
comprising of the minimum fields necessary to perform the OAuth connection.serviceThis is an Enum in theservice_framework.servicemodule, which defines
the Google service you're planning to connect to. All of these services are
dynamically built, but their names match the Google-defined name.Examplefrom service_framework.services import Service
from service_framework import service_builder

key = service_builder.OAuthKey(
   access_token="<YOUR ACCESS TOKEN>",
   refresh_token="<YOUR REFRESH TOKEN>",
   token_uri="https://oauth2.googleapis.com/token",
   client_id="<YOUR CLIENT ID>",
   client_secret="<YOUR CLIENT SECRET>"
)

service = service_builder.build_service(service=Service.GMAIL, key=key)Here, we are creating the key as anOAuthKeyobject as we have clearly got the
tokens and client_[id|secret] from elsewhere. Creating the service is then as
simple as invoking theservice_builder.build_servicemethod which will return
you a service you can use.Other parametersservice_builder.build_service()can also take 2 other optional parameters.ParameterDescriptionapi_keySome APIs require an API key as well as the OAuth credentialsextra_scopesAny extra OAUth scopes required for the operation
Package: python-servicecontainer
Python Service Container========================This is a pretty trivial service container with the ability to register Services in it. Onretrieval of an registered service the class got instantiated and behaves as a singleton.```from servicecontainer import Service, Container, ServiceInterface# This is a sample serviceclass ExampleService(object):val = Nonedef __init__(self, param1):self.val = param1class ExampleService2(ServiceInterface):val = Nonedef __init__(self, param1):self.val = param1@classmethoddef asService(cls, parameters):return Service("testservice2", cls, parameters)# Create the containerc = Container()# build an services = Service("testservice", ExampleService, {"param1": "param1_value"})# add the service to the containerc.add(s)c.add(ExampleService2.asService({"param1": "param1_value"}))# retrive the service from the container (gots instantiated at this point)instance = c.get('testservice')self.assertEqual('param1_value', instance.val)# list all serviceslist = c.list()self.assertEqual(2, len(list))self.assertEqual(list[0], 'testservice')# be sure its the same instanceinstance2 = c.get('testservice')assert instance is instance2```
Package: python-seth
python-seth is a pretty simple object named Daemon used to daemonize a process.To do so subclass the Daemon object and override its run method with the code
you want to turn into a unix daemon.You can override the shutdown method which is called on Daemon stop (either via
the stop method or on SIGTERM).Cf. examples for code snippet.FEATURES:redirects stderr|stdout to filewrites a pid filetransparently deletes the pid file at stopcatch SIGTERM and handles a clean stop via shutdown methodUPSTREAM:Code maintained athttp://git.kaliko.me/?p=python-seth.gitPlease send feedback at <kaliko@azylum.org>
Package: python-set-ings
DEPRECATEDThis package is deprecated.pydanticprovides thesame featuresetand much more.Python set-ingsLoad configuration from the environment for your python app. Supports typecasting and default values. Settings are made available in a way which plays nicely with IDEs and is easy to read.Installationpipenv install python-set-ingsorpip install python-set-ingsUsage# my_app/settings.pyfromset_ingsimportPropertyfromset_ingsimportSettingsasSettingsBaseSettings(SettingsBase):_PREFIX='YOUR_PREFIX'FOO=Property(10,cast=int)BAR=Property()settings=Settings()Then make sure you set the environment variables defined in your settings.
For the example above you would have to setYOUR_PREFIX_BARand optionallyYOUR_PREFIX_FOO.To use the settings anywhere in your app:frommy_app.settingsimportsettingsprint(settings.FOO+2)ContributingInstallationgit clone git@github.com:evocount/python-set-ings.gitcd python-set-ingspipenv install --devRunning testspipenv run pytest --covLicenseThis project is licensed under theMIT License.
Package: python-settings
python-settingsThis module provides you easy access to yourconfig/settingsproperties from all your python modules, it supports normal and lazy initialization for each property. It is based ondjango.conf.settings.InstallationFrom pippipinstallpython-settingsOrClone this repo and typepythonsetup.pyinstallHow to configureCreate a python file likesettings.pyin your project, the variable names must be in Capital Letters (A-Z), example:# settings.py# Variables definitionDATABASE_HOST='10.0.0.1'DATABASE_NAME='DATABASENAME'Two optional patterns to initialize this libraryOption 1. Using anenvironment variable.
You must have an environment variable calledSETTINGS_MODULEand as a value your just created python settings file in the format {module}.
{name}. With no .py extension.Example in bash:exportSETTINGS_MODULE=settingsExample in Pythonimportosos.environ["SETTINGS_MODULE"]='settings'Option 2. Calling the configure function from our settings module and passing it your python filefrompython_settingsimportsettingsfrom.importsettingsasmy_local_settingssettings.configure(my_local_settings)# configure() receives a python moduleassertsettings.configured# now you are setHow to useImport the settings module and access directly to your properties:frompython_settingsimportsettingsprint(settings.DATABASE_HOST)# Will print '10.0.0.1'print(settings.DATABASE_NAME)# Will print 'DATABASENAME'Lazy InitializationEvery time you start/restart your python project,
all your defined variables are evaluated many times,
if you are dealing with heavy to instantiate objects like
database connections or similar network calls you will expect some delay.Using Lazy Initialization increases the performance of this process,
changing the behavior of evaluating the variables only when is needed.Use the Lazy InitializerIn your python settings file, you have to import our LazySetting class located in python_settings.frompython_settingsimportLazySettingfrommy_awesome_libraryimportHeavyInitializationClass# Heavy to initialize objectLAZY_INITIALIZATION=LazySetting(HeavyInitializationClass,"127.0.0.1:4222")# LazySetting(Class, *args, **kwargs)Only the first time you call this property, the HeavyInitializationClass will be instantiated and the
*args and **kwargs parameters will be passed. Every time you call this property the same instance will be returned.And now from any place in your code, you have to call the propertyfrompython_settingsimportsettingsobject_initialized=settings.LAZY_INITIALIZATION# Will return an instance of your objectExample for different environmentsYou can use as many settings files as you need for different environments.
Example for development environment settings:# development_settings.pyimportosfrom.base_settingsimport*TOKEN_API=os.environ.get("TOKEN_API")Example for testing environment# testing_settings.pyimportosfrom.settingsimport*DATABASE_HOST='10.0.0.1'TOKEN_API=os.environ.get("TOKEN_API")And update yourSETTINGS_MODULEvariableexportSETTINGS_MODULE='myproject.settings.testing_settings'or use the config functionTODO LIST:Add function to update default environment variable name
Package: python-setup
python-setup.py用于Python打包的示例仓库打包和分发Python程序内容列表python-setup.py内容列表主要维护人员致谢参与贡献方式许可证主要维护人员zhujian -Initial work-zjykzj致谢facebookresearch/detectron2navdeep-G/setup.py参与贡献方式欢迎任何人的参与！打开issue或提交合并请求。注意:GIT提交，请遵守Conventional Commits规范语义版本化，请遵守Semantic Versioning 2.0.0规范README编写，请遵守standard-readme规范许可证Apache License 2.0© 2020 zjykzj
Package: python-sfor
Sfor====Simple failover resolver for Pythonthis is experimental version.yet, you should not use in large-scale service.Install===pip install sforExample===from sfor.sfor_simple import SforSimple, SforNodeInfoimport timeimport loggingnode_list = [SforNodeInfo("hoge1", 80, "/status.html"),SforNodeInfo("hoge2", 80, "/status.html"),]logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p')sfor = SforSimple(node_list)for n in range(60):logging.info(sfor.resolv())time.sleep(1)
Package: python_sftp_client
Contributions are strongly appreciated. Seriously, give github a try, fork and get started :)Demo & AboutPython SFTP Client enables operate SFTP remote server.
copy files from remote to local path. get remote file information. manage remote filesUpdates and tutorials can be found onFeaturesGet file from remote server to local machine.Put files from local to remote serverOpen files.Get file infoCreate directory to remote machine.Remove directory to remote machine.file listings & permission.DocumentationBasicsInstallation
Package: python-shell
Python Shell Wrapper LibraryA flexible, easy-to-use library to integrate your Python script with Unix ecosystems.Why yet another one?This library comes with a few major points to use it:It is easy and intuitive (see examples)It's compatible with Python 2 (can be useful in old large systems)Continuous support of the libraryGetting startedThis library is pretty easy to use:frompython_shellimportShellfrompython_shell.util.streamingimportdecode_streamShell.ls('-l','$HOME')# Equals "ls -l $HOME"command=Shell.whoami()# Equals "whoami"print(command)# Prints representation of command in shellprint(command.command)# prints "whoami"print(repr(command))# Does the same as aboveprint(command.return_code)# prints "0"print(command.arguments)# prints ""print(decode_stream(command.output))# Prints out command's stdoutprint(decode_stream(command.errors))# Prints out command's stderrTo run any Bash command, you need to do it like this:Shell.<bash_command_name>(<bash command parameters>)For example, you want to create a new folder:Shell.mkdir('-p','/tmp/new_folder')It's also possible to run a command which name is not a valid Python identifier.
To do this, use Shell class as a callable instance:command=Shell('2to3')When the command fails (returncode is non-zero), Shell throws a ShellException error.
However, even if you didn't save a reference to your command, you still can access it.
To do this, trylast_cmd=Shell.last_commandInstallingSimply runpip install python-shellIntegration with development toolsShellclass now allows to list all available commands simply bydir(Shell)This feature enables autocomplete of commands in a few popular interfaces:BPythonIPythonExtending the basic functionalityIt's possible to extend the existing functionality without forking the project.
The library provides an interface to add a custom Command class.Running the testsThis library contains tests written usingunittestmodule, so just run in the project directorypython -m unittestAlso it's possible to run tests using Tox:tox-e<env>Supported environments:py27py35py36py37py38coverage (using Python 3)coverage (using Python 2.7)pep8 (style checking)Other old versions of Python (e.g. 2.6, 3.4, etc) will never be supported. However, you always can implement such support in your forks.Test coverage is one of the top priority for this library:Coverage using Python 2.7: 98%Coverage using Python 3.x: 96%DocumentationOfficial documentation is availablehere.AuthorsAlex Sokolov-Author-AlbartashContactsTelegram channel with updates:@bart_toolsLicenseThis project is licensed under the MIT License - see theLICENSE.mdfile for details.