Saravanan666/pypi-org huggingface dataset:
Package: picklecache
Cache the results of a function.Simple useDecorate the function with@cache(cachedir, **kwargs).
For example,@cache()
def is_prime(number):
    for n in range(2, number):
        if number % n == 0:
            return False
    return TrueFancier usesNon-default directoryIf you pass no arguments to cache, as in the example above,
the cache will be stored in a directory named after the function.
To set a different directory, pass it as an argument.@cache('~/.primes')
def is_prime(number):
    for n in range(2, number):
        if number % n == 0:
            return False
    return TrueI recommend storing your caches in dotted directories under your
home directory, as you see above.ConfigurationThe kwargs get passed to thepickle_warehouse.Warehouse, so you
can do fun things like changing the serialization function.@cache('~/.http', serializer = pickle_warehouse.serializers.identity)
def get(url):
    return requests.get(url).textRead more about the keyword arguments on thepickle-warehouse page.Non-identifying argumentsIf you want to pass an argument but not use it as an identifier,
pass a non-keyword argument; those get passed along to the function
but don’t form the identifier. For example,@cache('~/.http')
def get(url, auth = None):
    return requests.get(url, auth = auth)

get('http://this.website.com', auth = ('username', 'password')Refreshing the cacheI find that I sometimes want to refresh the cache for a particular
file, only. This is usually because an error occurred and I have fixed
the error or because I am downloading files from a website that doesn’t
work very well.It would be nice to have a convenient way of refreshing these files.
Until then, I suggest that you log the arguments to the function call
that yields the cached error and then delete the corresponding file.
Package: picklecacher-myfatemi04
picklecacheThis program allows you to stop programs in the middle and pick up where you left off withpicklemodule.DocumentationClasspicklecache.Picache:directory: The directory to store the cache files in.Usage:Creation:mycache = picklecache.Picache("./path/to/my/files")Cache a function:@mycache(subgroup='', picache_key_gen=lambda args, kwargs: (tuple(args), tuple(kwargs.items())))This will decorate any function. By default, it uses theargsandkwargsas keys.When the function is decorated, you can passpicache_key=...to add your own caching keyThis is useful if you have something like epochs in a Machine Learning model, and can't pass in a network as a key to the outputWhat are subgroups?Subgroups are added as a prefix to the key. They're just so you can use the same caching folder
for multiple functions without key collisions.Keys are stored as a tuple, (subgroup, picache_key), so keys only have to be distinct for a certain function.mycache = picklecache.Picache("./path/to/my/files")
@mycache("MyFunction1")
def costly_function():
    time.sleep(1000)
    return 100


costly_function() # takes a long timeReload the program.costly_function() # instantThis time, the run is instant. Key is stored as ("MyFunction1", ((), ()))You could also specify a custom picache_key if you wanted to.Author:Michael Fatemi
Package: picklecast
# picklecast - Simple Screen Cast ReceiverScreen share to a RaspberryPi or display computer connected to a projector or TV.![](screenshot.png)## QuickstartInstall and start the server on the display computer or RPi:$ pip install picklecast
$ picklecast
Server address: 192.168.1.100
Display URL:http://localhost:8443/displayhttp://192.168.1.100:8443/displayClient URL:http://192.168.1.100:8443/Then open the display URL in a web-browser on the display computer.  You can now share your screen from a personal device by visiting the client URL.Optionally install as a user service on Linux to keep it running the background:picklecast install_service
systemctl –user daemon-reload
systemctl –user start picklecast## How it WorksPicklecast is just a Python program that serves HTML and relays handshake messages between two browsers.  The streaming and displaying is handled in Javascript in the display/client browsers using the WebRTC api.<img src=”architecture.svg” width=”500px”/>## CaveatsAudio sharing only supported when sharing from Chrome on Windows ([bugzilla](https://bugzilla.mozilla.org/show_bug.cgi?id=1541425)).Currently there can be only one browser open to the display URL at a timeOnly desktop browsers are supported, as mobile browsers don’t support [getDisplayMedia](https://caniuse.com/?search=getDisplayMedia)I’ve had issues getting the WebRTC APIs working correctly with Chrome on Windows.  Help on this issue would be appreciated.
Package: pickle_converter
pickle-converter is an interface for Python pickle files. It can dump a pickle file’s content in JSON format and accepts base64 encoded JSON to write it out into a pickle file. Base64 encoded input is required so we don’t have to escape the control characters in the JSON data for the shell.Installation### Package ###easy_install pickle_converter### Source ###
Get if from [github](https://github.com/ScOut3R/pickle-converter.git).### Usage ###
pickle_converter.py [-h] [-f FILE] [-i INPUT] commandPickle - JSON converterpositional arguments:command               what operation to perform (choices: decode, encode)optional arguments:-h,--helpshow this help message and exit-fFILE,--fileFILEinput/output pickle file depending on the command-iINPUT,--inputINPUTinput base64 encoded JSON
Package: picklecryptor
PickleCryptorA simple library for serializing / compressing / encrypting Python objects all in two functions on one object.Installationpip install picklecryptorSimple Usage Example>>> from picklecryptor import *
>>> p = PickleCryptor(password='hello world')
>>> d = {'a' : 'hi'}
>>> s = p.serialize(d)
>>> print(s)
b'{\xa9\xbc\x8e]N\xf1\xa1\xefk\xeb5\x99\\\xd1\xca\x01\x8d6\x81\x12 \x80\xeew=\xeeq\xa3\xc9B\x08'
>>> print(p.deserialize(s))
{'a': 'hi'}In this example we create a PickleCryptor object that will use the given password for encryption/decryption. Using the default params for the encryption/compression parameters leads to AES ECB encryption along with zlib compression.Some other types of compression and encryption are natively supported. Just pass in the enum values corresponding with what you'd like toPickleCryptor. Check the docs for more information.Seehttps://csm10495.github.io/picklecryptor/for full API documentation.LicenseMIT License
Package: pickle-database
READMEA database that saves its state in a file every time it is modified.
Seeexample.pyfor usage.Features:Allows0tontests to be run on setting a variable.  If these tests don't pass, an exception is raised.Records the time that a database key is last set.SetupOption 1: Clone the repositoryBest if you want to modify or view the code - note that you can do the following inside of a virtual environmentgit clone https://github.com/robotpt/pickle-databaseAn easy way to setup the repository with its dependencies and with your Python path
is to usepip.pip install -e pickle-databaseTests can be run with the following commands.cd pickle-database
python3 -m unittestOption 2: Use PipBest if you just want to use itpython3 -m pip install pickle_database
Package: pickleDB
pickleDB is lightweight, fast, and simple database based on Python’s own
json module. And it’s BSD licensed!pickleDB is Fun>>> import pickledb

>>> db = pickledb.load('test.db', False)

>>> db.set('key', 'value')

>>> db.get('key')
'value'

>>> db.dump()
TrueAnd Easy to Install$ pip install pickledbLinkswebsitedocumentationpypigithub repoLatest Release Notes (version: 0.9)Now load() uses‘rt’mode instead of ‘rb’ (0.9.2)Change lrem(name) tolremlist(name)(0.9)Addlremvalue(name, value)(0.9)Add load() option to use sigterm handler or not (0.9)Allkeysmust now be strings (0.8)Allnamesfor lists must now be strings (0.8)Allnamesfor dicts must now be strings (0.8)The get(key) function now returnsFalseinstead of None if there is no key (0.8)Switched to Python’s built in json module from simplejson (0.8.1)
Package: pickledb-ujson
pickleDBpickleDB is lightweight, fast, and simple database based on theujsonmodule.
And it's BSD licensed!pickleDB is Fun>>>importpickledb_ujsonaspickledb>>>db=pickledb.load('test.db',False)>>>db.set('key','value')>>>db.get('key')'value'>>>db.dump()TrueEasy to Install$pipinstallpickledb-ujsonLinkswebsitedocumentationpypigithub repo
Package: pickledict
pickledictpickledict/jsondictandpicklelist/jsonlistare auto-saving wrappers around their contained types. Their API is the same as the underlying type,dictorlist, but writes are recorded to a file and are transparently re-loaded on subsequent runs.frompickledictimportjsondictmy_dict=jsondict(some_key="a value")# Writes and modifications are automatically recorded and savedmy_dict["dog"]=1my_dict["dog"]+=1print(my_dict)# The first invocation creates a save file for the dict$pythonexample.py{'some_key':'a value','another_key':1}# The data is saved to a file named: <filename>-<lineno>-<variable name>.json$cat.pickledict/example-3-my_dict.json{"some_key":"a value","dog":2}# A second invocation reads the saved file on construction$pythonexample.py{'some_key':'a value','another_key':2}# As does a third, etc.$pythonexample.py{'some_key':'a value','another_key':3}Installation# requires Python 3.6+pipinstallpickledictUsagedicts can be saved with either JSON or Python's pickle format (Pickle supports the preservation of certain things JSON does not, such as non-string keys).All ofpickledict,jsondist,picklelist, andjsonlistsupport the same constructor arguments:file_name(str) - explicitly specify the file name to save this object in (if not provided one will be generated from the assigned variable name if possible)save_on_every_write(bool) - save on every modification of the structure. Turning this off saves only on program exit (which may increase performance)serializer_args(Dict[str, Any]) - keyword arguments to pass to the relevant serializationdumpfunctionThey all each add one method:detach()which disconnects the in-memory object from the file on disk so it can be manipulated without worrying about affecting the underlying file.Use CasesFetch data from a remote source and store it locally automatically without dealing directly with serialization:Withoutpickledict:importjsonimportosifos.path.exists("db.json"):withopen("db.json","r")asf:local_db=json.load(f)else:local_db={}foriinrange(100):key,data=fetch_some_data(i)local_db[key]=datawithopen("db.json","w")asf:json.dump(local_db,f,indent=2)Withpickledict:frompickledictimportjsondictlocal_db=jsondict(file_name="db.json",serializer_args={"indent":2})foriinrange(100):key,data=fetch_some_data(i)# This will automatically persist the data out to disklocal_db[key]=data
Package: pickle-function-cache
Pickle function cacheAllows for caching of the results of function calls in a
file usingpickle(builtinshelvedid not
work for some reason andmarshalwas not considered;jsonwas not able to serialize all the things I needed).the file read happens only once per process per filename
(all the function caches in the same cache file are loaded once)if the result is not found in the cache, the result is
computed using the original function and is written into
the cache file and to the runtime cache.if the result for the same set of arguments is requested
and found the original function is not called but the cached
result is returned.Usagefrompickle_function_cacheimportcache_responses@cache_responses("cache.dat")deff1(param1,param2):...# take a lot of time@cache_responses("cache.dat")deff2(param1,param2,param3):...# take a lot of time# use function normally ...when first called,f1(1,2)computes the result using the original, f1afterwardsf1(1,2)returns the cached result, omitting the function callif you callf2(1,2,3), it will be no trouble because function caches are
stored separately per function name in the same file (note: cached function names should be unique)ConfigurationYou can set the env varOMIT_PICKLE_FUNCTION_CACHEto either1ortrueto disable the cache at compile time without changing the code.PerformanceThe cache was tested on a small set of quick functions and a small test list of examples
and did not introduce a significant overhead. Probably, if the chosen functions for cache
were more computationally intensive, we would see a speed-up because of the cache.
Package: picklefy
PickliFyFacilitar o uso de arquivos pickle no python sem se preocupar onde estão sendo salvos e nem de qual local eles estão sendo chamados.Como funciona ?A lib picklify cria um diretório chamado pickle_files dentro da venv do projeto e salva todos os arquivos pickle nesse diretório;Para serializar basta chamar o método serialize e passar o nome como deseja salvar e a variavel/valor que deseja serializar;Ja para deserializar basta chamar o método serialize e passar apenas o nome ja salvo anteriormente.Qual é a utilidade e porque não usar a biblioteca pickle diretamente ?A utilidade é que a lib picklify facilita o uso de arquivos pickle no python, sem ficar se preocupando onde eles estão sendo salvos e nem de qual local eles estão sendo chamados.Exemplos de uso:Conseguir executar partes pequenas de código sem precisar executar o código inteiro.Salvar variáveis que demoram para serem processadas e depois deserializar elas.Instalaçãopip install picklifyComo utilizar?Serializando uma variavelfrom picklefy import PickleFy

# Serializando uma variavel
variavel = 'Ola Mundo'
ok = PickleFy().serialize(file_name='var', variavel=variavel)Deserializando uma variavelfrom picklefy import PickleFy

# Deserializando uma variavel
new_var = PickleFy().serialize(file_name='var')DependênciaspickleDúvidas ou Sugestõeshenriquespencer11@gmail.com
Package: picklejar
Overviewpicklejaris a python module that allows you to work with multiple pickles while reading/writing them to a single
file/jar.Licensepicklejaris released under theGNU Lesser General Public License v3.0, see the file LICENSE and LICENSE.lesser
for the license text.CompatibilityAs of version 3.0.0, picklejar is compatible with the latest versions of Python3, and PyPy3!Installation/Getting StartedThe most straightforward way to get the picklejar module working for you is:pip install picklejarDocumentationAll documentation for using picklejar can be found atReadTheDocsContributingComments and enhancements are very welcome. To installpicklejarfor development purposes, first
installPoetryand then run:poetry install --with devCode contributions are encouraged: please feel free tofork the
projectand submit pull requests to thedevelopbranch.Report any issues or feature requests on theBitBucket bug
tracker. Please include a minimal (not-)
working example which reproduces the bug and, if appropriate, the traceback information.  Please do not request features
already being worked towards.Building Documentation LocallyTo install the packages required and build the Sphinx Documentation simply:make docsThis will install all the requirements to work on picklejar and then build the HTML documentation.
To open the docs in your default browser, simply run:open docs/build/html/index.htmlTestingTo run the tests forpicklejarlocally with your installed version of python, simply run:make testTo run tests across different versions of Python viaDocker, install and start Docker,
then run:make docker-test-all
Package: picklejar3
PickleJar3Do not use, under developmentSomething I wrote a while ago for storing data. I want to flush it out into
something better.#!/usr/bin/env python3importsysfrompicklejar3.picklejarimportPickleJarpj=PickleJar()pj.init("bob.pickle",3)foriinrange(9):pj.push("a",i)pj.push("b",3.33)pj.push("d",-1200)pj.close()pj.read("bob.pickle")print(pj.buffer)MIT LicenseCopyright (c) 2020 Kevin J. WalchkoPermission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Package: pickle-mixin
Makes un-pickle-able objects pick-able.InstallYou can install it via pippip install pickle-mixinRunning the testsAfter installation, you can test itpython -c "import pickle_mixin; pickle_mixin.test()"as long as you havepytest.UsagePickle by initialisationSuppose that you have a class whose objects are un-pickle-able or that
would demand a large amount of disk space or memory to be pickle-able.PickleByInitclass lets you pickle object attributes via object
initialization. Consider the following classes:classFoo(PickleByInit):def__init__(self,obj):super(Foo,self).__init__()self.obj=objclassBar(object):def__init__(self,filename):self.filename=filenamedef__getstate__(self):raisePicklingErrordefinit_dict(self):returndict(filename=self.filename)Trying to pickle as followsf=Foo(Bar('file.txt'))pickle.dumps(f)would raise aPicklingError. The following on the other hand would
work:f=Foo(Bar('file.txt'))f.set_signature_only_attr('obj')pickle.dumps(f)The un-pickling process off.objattribute happens via object
initialisation, passing the returned dictionary frominit_dictas
keyword arguments toBar.__init__.Mixing classes with and without slotsPickling does not save attributes defined via__slots__in the
following case:classFoo(object):__slots__=['a']def__init__(self):self.a=4classBar(Foo):def__init__(self):passSlotPickleMixinfixes it:classFooMixin(object):__slots__=['a']def__init__(self):self.a=4classBarMixin(FooMixin,SlotPickleMixin):def__init__(self):FooMixin.__init__(self)SlotPickleMixin.__init__(self)f=BarMixin()o=pickle.dumps(f)f=pickle.loads(o)asserthasattr(f,'a')AuthorsDanilo Horta-https://github.com/HortaLicenseThis project is licensed under the MIT License - see theLICENSEfile for details
Package: pickle_process
This package is capable ofSending a data to a pickled stateUnpickling the pickled dataThere are two seperate functionspickle_data(val1,val2) - Used to pickle the data–>val1 - Data to be pickled (required)
–>Val2 - name of the file to be written to (Optional)unpickle_data(val1,val2,val3) - used to unpickle the pickled data–>val1 - name of the pickled file (Required)
–>val2 - Set it to ‘True’ if the output has to be written to a file (optional). Default is ‘False’(shell output)
–>Val3 - name of the file to be written to (optional)
Package: picklerpc
Pickle RPC in PythonVery simple RPCs built with sockets & pickle in python. Support numpy as input and output arguments.InstallpipinstallpicklerpcExampleServerimportpicklerpcimportnumpyasnp# functiondefnumpy_create(shape,dtype):returnnp.arange(np.prod(shape),dtype=dtype).reshape(shape)defhello():return"Hello, world!"defhello2():returnNonedefadd(a,b):returna+bclassHelloRPC(object):defhello3(self,name):return"Hello,%s"%name# registerserver=picklerpc.PickleRPCServer(('localhost',9102))server.register_function(numpy_create)server.register_function(hello)server.register_function(hello2)server.register_function(lambdax,y:x-y,'minus')server.register_function(add)server.register_instance(HelloRPC())#from instanceserver.serve_forever()Clientimportpicklerpcimportnumpyasnpclient=picklerpc.PickleRPCClient(('localhost',9102))print(client.numpy_create((3,4),dtype=np.float32))print(client.hello())print(client.hello3('From Instance'))print(client.add(np.range(10),3))print(client.minus(np.range(10),3))Speed compareThe picklerpc is most 10x faster thanzerorpcandxmlrpc.zerorpcxmlrpcpicklerpc (mine)ProtocaltcphttptcpData Stream-xmlpickleMultiple ClientYesYesYesData TypesNativesNativesNatives +NumpySpeed (local loop)683 µs462 µs59 µsSpeed (remote)2.76 ms4.64 ms0.54 msReferenceThankshttps://github.com/TarasZhere/RPC
Package: pickleshare
PickleShare - a small ‘shelve’ like datastore with concurrency supportLike shelve, a PickleShareDB object acts like a normal dictionary. Unlike shelve,
many processes can access the database simultaneously. Changing a value in
database is immediately visible to other processes accessing the same database.Concurrency is possible because the values are stored in separate files. Hence
the “database” is a directory whereallfiles are governed by PickleShare.Example usage:from pickleshare import *
db = PickleShareDB('~/testpickleshare')
db.clear()
print("Should be empty:",db.items())
db['hello'] = 15
db['aku ankka'] = [1,2,313]
db['paths/are/ok/key'] = [1,(5,46)]
print(db.keys())This module is certainly not ZODB, but can be used for low-load
(non-mission-critical) situations where tiny code size trumps the
advanced features of a “real” object database.Installation guide: pip install pickleshare
Package: picklesize
Sometimes it is handy to know how much space an object will need when it
will be serialized withpicklewithout actually pickling it. Especially
when the object is large, pickling can be slow and memory consuming.This library can calculate the exact space requirement without actually
pickling it. It still has to make a pass through the object tree, which
takes time, especially with many small objects. The major advantage is that
it won’t take significant memory.picklesizehas special support fornumpyarrays to calculate the
size without thearray->`str`->`file` procedure of regular pickling that
requires at least two copy operations.UsageThe API is kept similar to the one ofpickle:import picklesize
nbytes = picklesize.picklesize(obj, protocol=pickle.HIGHEST_PROTOCOL)Currently only protocol2(better known aspickle.HIGHEST_PROTOCOL)
is supported.Bug Reports and other contributionsThis project is hosted herepicklesize github page.
Package: pickleslicer
pickleslicer: Automatic slicer and unslicer of pickle filesThepickleslicerpackage provides a convenient way to create and load pickle files
in scenarios where storing many small files is preferable to storing a single large file.Thepickleslicerpackage wraps Python's built-inpicklepackage and has a very similar usage pattern.InstallationThe package distribution is hosted on PyPI and can be installed viapip:pip install pickleslicerCreating sliced pickle filesTo create sliced pickle files, callpickleslicer.dump():importpickleslicerobj={}# obj can be any Python objectpickleslicer.dump(obj,"myfilename.pickle")This will create sliced pickle files namedmyfilename.pickle.1,myfilename.pickle.2, etc., with each file having a maximum size of 10 MB.To customize the maximum file size, specify themax_sizeparameter:pickleslicer.dump(obj,"myfilename.pickle",max_size=50*1024*1024)# 50 MBLoading sliced pickle filesTo load sliced pickle files that have previously been created, callpickleslicer.load():importpickleslicerobj=pickleslicer.load("myfilename.pickle")This will load sliced pickle files namedmyfilename.pickle.1,myfilename.pickle.2, etc. The unpickled Python object is returned.
Package: pickle-utils
NOTE:You should usepandas.read_pickleandpandas.to_pickleinstead forloadanddump.Available functions:Usehelp(pickle_utils)in an interactive session for slightly more detailed
docs.load(filename_or_object)Load a Pickle file, from a file name or a file-like object. If the argument is a
file name, it must end in ".pkl" or ".pkl.gz". In the second case the file will
be compressed.Usepandas.read_pickleinstead.dump(data, filename_or_object)Same as before but dump data to disk.Usepandas.to_pickleinstead.@memoize(filename, log_level=info)Decorator to memoize the output of a function tofilenamewith pickle. The
function will be executed only iffilenamedoes not exist.