Saravanan666/pypi-org huggingface dataset:
Package: python-color-transfer
Color Transfer in PythonThree methods of color transfer implemented in Python.Output ExamplesInput imageReference imageMean std transferLab mean transferPdf transfer + RegrainMethodsLet input image be $I$, reference image be $R$ and output image be $O$.
Let $f{I}(r, g, b)$, $f{R}(r, g, b)$ be probability density functions of $I$ and $R$'s rgb values.Mean std transfer$$O = (I - mean(I)) / std(I) * std(R) + mean(R).$$Lab mean transfer[^1]$$I' = rgb2lab(I)$$
$$R' = rgb2lab(R)$$
$$O' = (I' - mean(I')) / std(I') * std(R') + mean(R')$$
$$O = lab2rgb(O')$$Pdf transfer[^2]$O = t(I)$, where $t: R^3-> R^3$ is a continous mapping so that $f{t(I)}(r, g, b) = f{R}(r, g, b)$.Requirements🐍python>=3.6InstallationFrom PyPipipinstallpython-color-transferFrom sourcegitclonehttps://github.com/pengbo-learn/python-color-transfer.gitcdpython-color-transfer

pipinstall-rrequirements.txtDemoTo replicate the results inOutput Examples, run:pythondemo.pyOutputdemo_images/house.jpeg: 512x768x3
demo_images/hats.png: 512x768x3
Pdf transfer time: 1.47s
Regrain time: 1.16s
Mean std transfer time: 0.09s
Lab Mean std transfer time: 0.09s
Saved to demo_images/house_display.png

demo_images/fallingwater.png: 727x483x3
demo_images/autumn.jpg: 727x1000x3
Pdf transfer time: 1.87s
Regrain time: 0.87s
Mean std transfer time: 0.12s
Lab Mean std transfer time: 0.11s
Saved to demo_images/fallingwater_display.png

demo_images/tower.jpeg: 743x1280x3
demo_images/sunset.jpg: 743x1114x3
Pdf transfer time: 2.95s
Regrain time: 2.83s
Mean std transfer time: 0.23s
Lab Mean std transfer time: 0.21s
Saved to demo_images/tower_display.png
  
demo_images/scotland_house.png: 361x481x3
demo_images/scotland_plain.png: 361x481x3
Pdf transfer time: 0.67s
Regrain time: 0.49s
Mean std transfer time: 0.04s
Lab Mean std transfer time: 0.22s
Saved to demo_images/scotland_display.pngUsagefrompathlibimportPathimportcv2frompython_color_transfer.color_transferimportColorTransfer# Using demo imagesinput_image='demo_images/house.jpeg'ref_image='demo_images/hats.png'# input image and reference imageimg_arr_in=cv2.imread(input_image)img_arr_ref=cv2.imread(ref_image)# Initialize the classPT=ColorTransfer()# Pdf transferimg_arr_pdf_reg=PT.pdf_tranfer(img_arr_in=img_arr_in,img_arr_ref=img_arr_ref,regrain=True)# Mean std transferimg_arr_mt=PT.mean_std_transfer(img_arr_in=img_arr_in,img_arr_ref=img_arr_ref)# Lab mean transferimg_arr_lt=PT.lab_transfer(img_arr_in=img_arr_in,img_arr_ref=img_arr_ref)# Save the example resultsimg_name=Path(input_image).stemformethod,imgin[('pdf-reg',img_arr_pdf_reg),('mt',img_arr_mt),('lt',img_arr_lt)]:cv2.imwrite(f'{img_name}_{method}.jpg',img)[^1]: Lab mean transfer:Color Transfer between Imagesby Erik Reinhard, Michael Ashikhmin, Bruce Gooch and Peter Shirley.Open source's python implementation[^2]: Pdf transfer:Automated colour grading using colour distribution transferby F. Pitie , A. Kokaram and R. Dahyot.Author's matlab implementation
Package: python-comcigan
Comcigan api for PythonHello school!Installation$pipinstallpython-comciganFeaturesGet timetableGet subjectsGet homeroom teachersGet teachersGet classCountWithout any dependencies!Usage/Examplessetup for신흥중학교in경기:fromcomciganimportComcigancomcigan:Comcigan=Comcigan(schoolName='신흥중학교',schoolRegion='경기')synchronizing data with comcigan site:comcigan.synchronize()printingfirst periodof class3-1onmonday:print(comcigan.getPeriods()[2][0][0][0])printing homeroom teacher of2-1:print(comcigan.getHomeroomTeachers()[1][0])printing period starting time ofsixth period:print(comcigan.getPeriodStartingTimes()[5])
Package: python-commandmaker
A Python package for creating discord bot like commandsThis package aims to create discord bot
like commands for the python console.
This packages syntax for creating commands is very similar to
discord.py. Also inspired by TheGenocide/PyCommands.
You can read the examples to see how to create a bot with it
This package is solely written in python 3.10
and thus requires it.You can install it by doingpip install python-commandmakerYou can submit pull requests to improve any code as the project
is completely open sourceA quick example-importCommandsbot=Commands.CommandMaker("An example bot",".",case_insensitive=False)@bot.command()defsome_command(command_args):print(command_args)bot.run()
Package: python-commentator
CommentatorbyEmery BergerCommentator leverages large language models to add high-level
explanatory comments, docstrings,and typesto Python code.UsageCommentator needs to be connected to anOpenAI accountor an Amazon Web Services account.OpenAIYour account will need to have a positive balance for this to work(check your OpenAI balance).Get an OpenAI key here.Commentator currently defaults to GPT-4, and falls back to GPT-3.5-turbo if a request error occurs. For the newest and best
model (GPT-4) to work, you need to have purchased  at least $1 in credits (if your API account was created before
August 13, 2023) or $0.50 (if you have a newer API account).Once you have an API key, set it as an environment variable calledOPENAI_API_KEY.# On Linux/MacOS:exportOPENAI_API_KEY=<your-api-key># On Windows:$env:OPENAI_API_KEY=<your-api-key>Amazon BedrockCommentator now supports Amazon Bedrock, using the Claude model.
To use Bedrock, you need to set three environment variables.# On Linux/MacOS:exportAWS_ACCESS_KEY_ID=<your-access-key>exportAWS_SECRET_ACCESS_KEY=<your-secret-key>exportAWS_REGION_NAME=<your-region>If you do not already have access keys, you should be able create them by
modifying this link with your own username and region:https://us-east-1.console.aws.amazon.com/iam/home?region=us-east-1#/users/details/YOUR_USER_NAME?section=security_credentialsYou also need to request access to Claude (change region as needed):https://us-east-1.console.aws.amazon.com/bedrock/home?region=us-east-1#/modelaccessCommentator will automatically select which AI service to use (OpenAI or AWS Bedrock) when it detects that the appropriate
environment variables have been set.Commentator takes a path to a Python file and an optional language
parameter. If language is specified, Commentator translates each
docstring and comment in the code to the specified language. The
default language is English.InstallationTo install Commentator, you can use pip:$ pip install python-commentatorExampleSuppose you have a file calledexample.pywith the following code:def absolutely(n):
    if n < 0:
        return -n
    else:
        return nRun Commentator on this file to add comments and type annotations:$ commentator example.pyThe resulting code might be:def absolutely(n: int) -> int:
    """
    Return the absolute value of a number.
    
    Args:
    - n (int): the number whose absolute value we want to find
    
    Returns:
    - int: the absolute value of n
    """
    if n < 0:
        # If n is negative
        # Return the negative version of n (i.e. its absolute value)
        return -n
    else:
        # Otherwise (if n is non-negative)
        # Return n as-is (it already is its absolute value)
        return nNote that Commentator has added a docstring and type annotations.
Package: python-commonkit
Common KitA collection of common utilities for use in Python projects.Config: A wrapper for convenient, object-oriented use of configuration files.Context Managers: A collection of managers that are especially useful for command line scripting, testing, and deployment activities.CSV: Work with CSV files in an object-oriented manner.Database: A database wrapper with convenient methods using natural language.Dispatcher: Implements a simple signal-receiver pattern in object-oriented code.Files: Various utilities for working with files.Lists: Some simple functions for working with lists.Logging: A helper for making Python logging easier to use.Math: Some help. With math.Platform: A light-weight detection tool for discovery information about the current operating system.Pluggable: Implements a simple plugin pattern.Shell: Various classes and utilities for creating and interacting with the command line, including command execution, consistent exit codes, colorized feedback, input prompts, and tables.Strings: Various utilities for working with strings.Types: Run-time data type detection and casting.Utils: A collection of functions implementing common and some not-so-common operations in Python.Watchers: A library for setting up a response to changes in files or directories.Full documentation is available at:https://develmaycare.com/docs/InstallTo install without database support:pip install commonkitTo install all dependencies, use:pip install commonkit[all]Note: All dependencies includes SQLAlchemy butnotspecific database drivers below.Database SupportFor database support:pip install commonkit[database](supports SQLite by default)Or for specific database engines:MS SQL:pip install commonkit[mssql]Oracle:pip install commonkit[oracle]Postgres:pip install commonkit[pgsql]Tablib is required for database export features:pip install tablibFiles and StringsFiles and strings make optional use of BeautifulSoup, Jinja2, Pygments, and unidecode:pipinstallbeautifulsoup4;# for strip_html_tags()pipinstalljinja2;# for parse_jinja_string() and parse_jinja_template() and config when parsing files as templatespipinstallpygments;# for highlight_code()pipinstallunidecode;# for replace_non_ascii() and slug()Or usepip install commonkit[strings]to install all of these dependencies.ShellFull shell support requires colorama and tabulate:pipinstallcolorama;forshell.feedback
pipinstalltabulate;forshell.tablesOr usepip install commonkit[shell].
Package: python-common-lib
python-commonsRun ./setup.sh to set up git pre/post push hook scripts.
Then, a similar script loaded to the environment will execute the pre/post push hook scripts:https://stackoverflow.com/a/3812238/1106893For example loading this script and defining an alias like this will do the trick:alias gpwh="git-push-with-hooks.sh"Setup of precommitConfigure precommit as described in this blogpost:https://ljvmiranda921.github.io/notebook/2018/06/21/precommits-using-black-and-flake8/Commands:Install precommit:pip install pre-commitMake sure to add pre-commit to your path. For example, on a Mac system, pre-commit is installed here:$HOME/Library/Python/3.8/bin/pre-commit.Executepre-commit installto install git hooks in your.git/directory.TroubleshootingInstallation issuesIn case you're facing a similar issue:An error has occurred: InvalidManifestError: 
=====> /<userhome>/.cache/pre-commit/repoBP08UH/.pre-commit-hooks.yaml does not exist
Check the log at /<userhome>/.cache/pre-commit/pre-commit.log, please run:pre-commit autoupdateMore info here:https://github.com/pre-commit/pre-commit/issues/577
Package: python-common-tools
一些常用的python工具箱安装pip3installpython_common_tools使用importtime# 使得函数使用缓存frompython_common_tools.cacheimportcache_function,cache_daily_function@cache_function('.')deff(self,a,b,c):time.sleep(3)returna+b+c@cache_daily_function('.')deff2(self,a,b,c):time.sleep(3)returna+b+c# 快速设置日志frompython_common_tools.logimportsetup_loggerlogger=setup_logger("test.log")# 搞定异常处理的网络请求frompython_common_tools.networkimportsecure_requests,secure_requests_jsonresp=secure_requests("https://www.gethtml.com/test",retry_times=3,log_err=True)j=secure_requests_json("https://www.getjson.com/test",timeout=10)# linux系统相关的获取命令执行结果  获取最新版本号 打开远程服务器上的文件frompython_common_tools.linuximportget_bash_output,get_latest_commit_id,open_remote_filedirfiles=get_bash_output(["ls","-l"])commit_id=get_latest_commit_id()
Package: python-compare-ast
Compares ASTs of Python files that have been changed in git.Useful for checking if formatting changes do not modify the behaviour of the source code.RequirementsPython 3.6 or newer.Installation$ pip install python-compare-astUsage$ python-compare-ast [--git-dir <path_to_git_working_dir>]git-dirdefaults to the current directory.Example output:$ git clone https://github.com/pallets/click.git
$ python-compare-ast --git-dir click
Analysing /absolute/path/to/click/.git
Repo is clean, comparing changes in latest commit (dfb842d95a7c146d8fe8140c8100065410d95c4d).
warning: AST does not match for src/click/core.py
warning: AST does not match for tests/test_options.py
Found 2 AST differences.If the git working directory is clean, the files changed in latest commit will be analysed.
If the git working directory is dirty, the dirty files will will analysed.
If no changed files has a different AST then before,python-compare-astwill exit with status code 0.
However, if there are changes to the AST the exit code will be 1.
Package: python-compile
python-compileCompile python apps to linux executables using docker.This project will use docker to compile your one file python app into a binary that's runnable on many
linux systems. This is the easiest way to build an app and may work directly out of the box for many setups.Work in progress remains for building Windows/MacOS apps via the docker system.Examplepython-compile--osdebian--inputdemo_http_server.py--requirementsrequirements.txtdemo_http_serverNotesRight now we use the nuitka build. If you want custom build options then feel free to create a PR.WindowsThis environment requires you to usegit-bash.LintingRun./lint.shto find linting errors usingpylint,flake8andmypy.LinksCross compiler toolchain images in linux:https://github.com/dockcross/dockcrossMacOS imageshttps://hub.docker.com/r/sickcodes/docker-osxReleases1.0.4: Fix1.0.3: Native windows compile is available if the host is also windows.
Package: python-composite
LicenseDependenciesTestsDocumentationExampleDeclarative XML files parse, unparse with help of lxml libraryLicenseMITDependenciespython-2.7python-3.3+ (including 3.5)appssixlxml (further release would be optional)Teststoxpython setup.py testDocumentationYou can find docs hereread the docsExamplehttp://python-composite.readthedocs.org/en/latest/examples.html
Package: python-composition
CompositionDescriptionThe project is a Python library that allows for composition with currying. It provides a set of operators and functions that enable functional programming techniques such as partial function application and composition. With this library, you can easily compose functions, apply them to data, and manipulate collections in a functional style.FeaturesAllows for composition with curryingSupports partial function applicationSupports function assignmentProvides various operators for composition and applicationUsagefromcompositionimportCC/list/map%(lambdax:x*2)@range(1,5)# Output: [2, 4, 6, 8]# Instead of list(map(lambda x:x*2, range(1,5)))So,/is composition ,%is partial and@is applying.(f / g)(x)isf(g(x))f% (lambda x:x*2)sets the first variable to x*2. But it can also get a dictionary.C/list/zip&C/list@range(5)^[4,8,9,10,11]# Output: [(0, 4), (1, 8), (2, 9), (3, 10), (4, 11)]& is partial but in lower precedence .
^ is applying with lower precedenceC/set/reduce%(lambdax,y:x+y)@(C/self._hist_by_date.values()<<(lambdas:list(s.keys())))#The same as set(reduce(lambda x,y:x+y, [list(s.keys()) for s in self._hist_by_date.values()]) )Partial supports function assigment, which means you can do:deff(a,b,c):return(a,b,c)f%{'b':"->b*a*2"}@(1,3)orf(lambdab:b*2}It also supports currying.The term is used freely here. It means that the original arguments can be passed to function along the chain, if it serves the purpose.defload_user(user_id:int,db:sqlite3.Connection)->User:...deffind_computer(computer:str,db:sqlite3.Connection):...consider the above chain.  db is  common parameters to both.Now you can call specify arugment to take from ret of previous function (X,Y,Z by the order) , or just use Orig to take the same parameter from original call.C/find_computer%A(db=Orig,computer=X)/load_userInstallationTo install the project, simply run the following command:pip install compositionIt has only one dependency (multimethod).NoticeThe implementation can be unsafe because it converts string to functions.
So on undistilled input, please useCSinstead ofC.
(otherwise an attacker might be able to inject a function in a string starting with ->).ContributingContributions are welcome! Please fork the repository and submit a pull request.
Package: python-comrak
Markdown HTML converters for Python made in RustExposes two Rust crates which parse markdown to Python usingPyO3.Using ComrakThe first crate exposed iscomrakfrom which we
inherited the name:Example:>>>frompython_comrakimportmarkdown_to_html>>>markdown_to_html("\tfoo\tbaz\t\tbim\n")"<pre><code>foo\tbaz\t\tbim\n</code></pre>\n"markdown_to_htmlactivates the extensions:strikethroughtagfilterautolinkUsing pulldown-cmarkThe second crate ispulldown-cmark.  Example:>>>frompython_comrakimportcommonmark_to_html>>>commonmark_to_html("\tfoo\tbaz\t\tbim\n")"<pre><code>foo\tbaz\t\tbim\n</code></pre>\n"commonmark_to_htmlactivates the extensions:STRIKETHROUGHNoticethatpulldown-cmarkdoesn't implement 100% of CommonMark yet.  Also
it doesn't have the same set of extensions we use withcomrak.BenchmarksThis implementation is quite simple and doesn't allow much of the underlying
crates.  The extensions and options are fixed.  The following is just a
micro-benchmark parsing the text of this README file:>>>withopen('README.md','r')asf:...contents=f.read()>>>frompython_comrakimportmarkdown_to_html,commonmark_to_html>>>%timeitmarkdown_to_html(contents)54.4µs±1.24µsperloop(mean±std.dev.of7runs,10000loopseach)>>>%timeitcommonmark_to_html(contents)12.5µs±97.3nsperloop(mean±std.dev.of7runs,100000loopseach)
Package: python-comwechatrobot-http
from wechatrobot import WeChatRobot


bot = WeChatRobot()

@bot.on("friend_msg")
def on_friend_msg(msg):
    bot.SendText(wxid = msg['sender'], msg = msg['message'])

@bot.on("group_msg")
def on_group_msg(msg):
    print(f"on_group_msg: {msg}")

@bot.on("self_msg")
def on_self_msg(msg):
    print(f"on_self_msg: {msg}")

bot.run()
Package: python-configuration-wrapper
Python Configuration WrapperThis lib is basically a wrapper of thepython-configuration.It aims at making configuration easy !FeaturesRead multi-level configuration values from multiple sources (precedency ordered):Command line arguments given by--additional-configor-Cparameter.Example:python app.py -C "database.dialect=postgresql" --additional-config "database.host=postgres.mydomain.org" -C "database.user=admin"Environment variables starting with prefix set in theCONFIG_PREFIXenvironment variable. Level separator is__(double underscore).Example:CONFIG_PREFIX=TEST TEST__database__user=root python app.pyConfig directories given by--config-pathor-Pparameter. The value of this parameter must be a directory path in which the sub-directories are multi-level keys, and plain-text files content are values. It's very practical when using secrets in containers.Example:mkdir /var/run/secrets/database -p
echo -n 123456 > /var/run/secrets/database/password
python app.py --config-path /var/run/secretsConfig files given by--config-fileor-Fparameter. File formats must be among those handled bypython-configuration:jsoniniyamltomlpythonExample:python app.py -F config.json --config-file config.yamlIf no config file is given, the lib will look for config.{yaml|json|ini|toml|python} in the working directory.Installationpip install python-configuration-wrapperUsage# import the config object from the module
# you can do this in every python file you want
from python_configuration_wrapper import config

# get some value from a multi-level key
myvalue = config.myfirstlevel.mysecondlevel.mykeyExampleSeetest
Package: python-configurator
Usage#!/usr/bin/env python3key='default'folder='/home/pm/projects/foo/sqlite/'connector='sqlite'target='/home/pm/projects/foo/foo.db'if__name__=='__main__':fromconfigurator.convertorimportconvertorconvertor(__file__,debug=True)convertor(__file__,'python','pickle',debug=True)convertor(__file__,'python','python',debug=True)Changelog0.3 (2016 Nov 22)modify the source code by pep8sort json.dump fileadd extension parameter0.2 (2015 Jan 16)create ‘configurator’ packagefix: json.dumpadd testing files0.1 (2014 Jan 21)initial release with support for: json, pickle and python
Package: python-confluent-cli-wrapper
Confluent CLI Wraper for PythonSimple wrapper library to Confluent CLIGet startedpoetryaddpython-confluent-cli-wrapperfromconfluent.cli.wrapper.environmentimportEnvironmentfromconfluent.cli.wrapper.kafka_clusterimportKafkaClusterfromconfluent.cli.wrapper.kafka_topicimportKafkaTopicfromconfluent.cli.wrapper.sessionimportloginfromconfluent.cli.wrapper.utils.parsersimportOutputEnumenvironment=Environment()kafka_cluster=KafkaCluster()kafka_topic=KafkaTopic()login()environment.list()kafka_cluster.list()# eq '--all' argument
Package: python-congress
A Python client for the ProPublicaCongress
APIInstallFrom PyPI:pip install python-congressDownload and run the install script:git clone https://github.com/eyeseast/propublica-congress && cd propublica-congress
python setup.py installUsage>>> from congress import Congress
>>> congress = Congress(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-congressclient
Client for CongressFree software: Apache licenseDocumentation:https://docs.openstack.org/python-congressclient/latest/Source:https://opendev.org/openstack/python-congressclientBugs:https://bugs.launchpad.net/python-congressclientClient for Standalone CongressInstall the Congress CLI by cloning the repository and running the setup file.
The master repository always contains the latest source code, so if you are
installing and testing a specific branch of Congress, clone the matching branch
of the python-congressclient.To execute CLI commands to standalone Congress installed with noauth:Install python-openstackclient:$ pip install python-openstackclientClone master repository & install python-congressclient:$ git clone https://github.com/openstack/python-congressclient.git
$ cd python-congressclient
$ python setup.py install(Optional) Clone a branch; for example, if you are using the Ocata version of OpenStack and Congress:$ git clone -b stable/ocata https://github.com/openstack/python-congressclient.git
$ cd python-congressclient
$ python setup.py installRead the HTML documentation. Install python-sphinx and the oslosphinx extension if missing:$ sudo pip install sphinx
$ sudo pip install oslosphinxBuild the docs
$ make docsOpen doc/html/index.html in a browserTo execute CLI commands:$ cd python-congressclient

For example:
$ export CONGRESS_URL="http://127.0.0.1:1789"
$ openstack --os-token foo --os-url $CONGRESS_URL
(openstack) congress policy create test_policy
+--------------+--------------------------------------+
| Field        | Value                                |
+--------------+--------------------------------------+
| abbreviation | test_                                |
| description  |                                      |
| id           | 8595f24a-7d74-45ee-8168-0b3e937b8419 |
| kind         | nonrecursive                         |
| name         | test_policy                          |
| owner_id     | user                                 |
+--------------+--------------------------------------+

(openstack) congress policy rule create test_policy "p(5)"
+---------+--------------------------------------+
| Field   | Value                                |
+---------+--------------------------------------+
| comment | None                                 |
| id      | 5ce7fb18-a227-447e-bec8-93e99c0052a5 |
| name    | None                                 |
| rule    | p(5)                                 |
+---------+--------------------------------------+

(openstack) congress policy rule list test_policy
// ID: 5ce7fb18-a227-447e-bec8-93e99c0052a5
// Name: None
p(5)

(openstack) exit
$FeaturesTODO