Saravanan666/pypi-org huggingface dataset:
Package: lockable
lockableResource locking module for python.Originally designed for following projects:pytest-lockablerobot-lockableModule provides python API and simple CLI interface.Resource is released in following cases:process endswhen context ends whenlockable.auto_lock(..)is usedallocation.unlock() is calledlockable.unlock() is calledResources data provider support following mechanisms:resources.jsonfile in file systempython list of dictionarieshttp uri which points to API and is used with HTTP GET method. API should provideresources.jsondata as json object.CLI interface% lockable --help
usage: lockable [-h] [--validate-only] [--lock-folder LOCK_FOLDER] [--resources RESOURCES]
                [--timeout TIMEOUT] [--hostname HOSTNAME]
                [--requirements REQUIREMENTS]
                [command [command ...]]

run given command while suitable resource is allocated.
Usage example: lockable --requirements {"online":true} echo using resource: $ID

positional arguments:
  command               Command to be execute during device allocation

optional arguments:
  -h, --help            show this help message and exit
  --validate-only       Only validate resources.json
  --lock-folder LOCK_FOLDER
                        lock folder
  --resources RESOURCES
                        Resources file (utf-8) or http uri
  --timeout TIMEOUT     Timeout for trying allocate suitable resource
  --hostname HOSTNAME   Hostname
  --requirements REQUIREMENTS
                        requirements as json stringAPI'sConstructorlockable=Lockable([hostname],[resource_list_file],[resource_list],[lock_folder])Allocationallocation_context=lockable.lock(requirements,[timeout_s])print(allocation_context.resource_info)print(allocation_context.resource_id)allocation_context.unlock()# or using resource infolockable.unlock(allocation_context)Allocation context contains following API:requirements: dictOriginal requirements for allocationresource_info: dictAllocated resource informationunlock(): funcrelease resource lock functionallocation_queue_time: timedeltaHow long waited before allocationallocation_start_time: datetimewhen allocation was startedrelease_time: datetimewhen allocation was endedalloc_id: strallocation idallocation_durations: timedeltahow long time allocation takesor using context manager which unlock automaticallywithlockable.auto_lock(requirements,[timeout_s])asallocation:print(allocation.resource_info)Tips:You can allocate also offline devices by set requirements"online": None.
You can ignore alsohostnamesame same way by  setting it to  None`
Package: lockable.dev
Lockable-devOfficial Python client forhttps://lockable.devLockable is an easy-to-use, language-independent locking mechanism for multi-process workloads. Think of it asflock, but for distributed systems which may not be sharing a filesystem.Learn moreLockable website:https://lockable.devLockable Python client on GitHub:https://github.com/lockable-dev/lockable-pyDocs:https://docs.lockable.devDocs on GitHub:https://github.com/lockable-dev/lockable-docsInstallationpip install lockable-devUsagefrom lockable import Lock
with Lock('my-lock-name'):
    #do stuffDevelopmentTestingmake testBuilding and pushing changesIf you want to push to PiPy, credentials go in.env.local. See.env.examplefor a template.# Just build
make build

#Build and upload latest version to TestPyPi
make test-publish

#Build and upload latest version to TestPyPi
make publish
Package: lockatme
lockatme is a screen locker that works with modules. It allows the user
to use the same locker for different types of authentication.This locker is in development stage, there is nothing secure about it.
Don’t use it for real application just yet.Contents1Main features2Installation3Usage4Configuration4.1Config file location4.2Module configuration1Main featuresModulableThemable (TODO)2InstallationUsingpip:$pipinstalllockatme3UsageFrom the command line:$lockatme4Configurationlockatme uses a ini-like config file.4.1Config file locationThe default location of the configuration file is$XDG_CONFIG_HOME/lockatme/configor~/.config/lockatme/configif$XDG_CONFIG_HOMEis not set.4.2Module configurationYou can choose which modules you want to use so for example, if you want to use only
password authentication:[unlockers]passwordIf you want to use both password and facial recognition at the same time:[unlockers]passwordfacial_recogntion
Package: lockbox
lockbox: User-friendly CLI over cryptography.io's Fernet symmetric cipher=====================================================.. image:: https://img.shields.io/badge/python-2.6%202.7%203.3%203.4%203.5%203.6-blue.svg:target: https://pypi.python.org/pypi/lockbox.. image:: https://img.shields.io/badge/license-MIT-blue.svg:target: https://pypi.python.org/pypi/lockbox---------------.. image:: https://s3.amazonaws.com/johnwheeler/lockbox.gif**lockbox** provides a command line interface over cryptography.io's `Fernet symmetric cipher <https://cryptography.io/en/latest/fernet/>`_.Fernet guarantees that a message encrypted using it cannot be manipulated or read without the key. lockbox was inspired by the Ruby-based`sekrets <https://github.com/ahoward/sekrets>`_ project, but they use different ciphers.Installation------------``pip install lockbox``Command line interface----------------------The ``lock`` command/////////////////////.. code::Usage: lockbox lock [OPTIONS] INPUT OUTPUTSymmetric encryption of plaintext input file to ciphertext output fileOptions:--key TEXT  An encryption key--help      Show this message and exit.The ``unlock`` command////////////////////.. code::Usage: lockbox unlock [OPTIONS] INPUT OUTPUTSymmetric decryption of ciphertext input file to plaintext output fileOptions:--key TEXT  An encryption key--help      Show this message and exit.The ``edit`` command////////////////////.. code::Usage: lockbox edit [OPTIONS] PATHDecrypts the given file and opens its contents in a temporary file forediting. Once saved, the updated contents are reencrypted back to theorignal file.Options:--key TEXT  An encryption key--help      Show this message and exit.The ``genkey`` command//////////////////////.. code::Usage: lockbox genkey [OPTIONS] OUTPUTGenerates a cryptographically strong key and writes it to the given outputpathOptions:--help  Show this message and exit.Key resolution--------------With **lockbox**, you can pass an encryption key as a command line option ``--key`` or store the key in a ``.lockbox.key`` file.The key should be `cryptographically strong <https://en.wikipedia.org/wiki/Password_strength#Guidelines_for_strong_passwords>`_. The commandline interface also has a command to generate such a key.For all operations, lockbox uses the following algorithm to search for a key:- A key passed via the ``--key`` option is always preferred.- Otherwise the code looks for a companion key file named ``.lockbox.key`` in the the current working directory.- If that is not found lockbox looks for the key in the environment under the environment variable ``LOCKBOX_KEY``- Next the global key file is searched for. The path of this file is ``~/.lockbox.key``- Finally, if no keys have been specified or found, the user is prompted to input the key. Prompt only occurs if the user is attached to a tty.- You should **never** commit keyfiles. Add them to to your ``.gitignore`` or similar.
Package: lockboxcli
# lockboxcli
command line for lockbox# example usage
from lockboxcli import LockboxClient
client = LockboxClient(‘staging’)pip_test = client.get_secret(‘PIP_TEST’)
print(pip_test)client.update_secret(‘PIP_TEST’, ‘bazquux’)pip_test = client.get_secret(‘PIP_TEST’)
print(pip_test)
Package: lockchain
What islockchain?ALockChainallows you to create a chain of critical regions, executed
sequentially. The underlying Lock from asyncio would actually enforce this
with a dequeue, so this library is mostly unnecessary. Had I read the code
first, I would have either not needed this or found a different solution.
Until I actually think about it though, it’s still here.It’s still useful for limiting access to some set of resources in
a namespace. If no coroutine is blocking for some resource, it’s you may
get to close that resource (or reset a rate limit.)
Package: lock-defaults
lock-defaultsThis decorator is small and only relies on the standard library, so can just be copied into a project.Python has a weird behaviour around default values for functions. If you use an empty list as a default argument, things added to the list during the function can hang around for next time the function is called. A common pattern of dealing with this is the following:deffunc(foo=None):iffooisNone:foo=[]But this looks rubbish! And gets worse when you add typing:deffunc(foo:list|None=None):iffooisNone:foo=[]You don't need that workaround for any other of default value. Why does the list parameter have to pretend it can be None, when that's not the intention at all?Thelockmutabledefaultsdecorator fixes this by introducing whatshouldbe the default approach, and default values that are lists, dictionaries or sets are isolated in each re-run.@lockmutabledefaultsdeffunc(foo:list=[]):passInstallYou can install from pip:python -m pip install lock-defaultsOr you can copy the function directly into your projects.For python 3.10+:with_paramspec/lock_defaults.pyFor python 3.8, 3.9:without_paramspec/lock_defaults.py
Package: lockdir
This is a class that tries to limit the number of multiple simultaneous executions of a python script, on a local computer. It works by creating folders (using a pattern) under a folder. If the folder is successfully created, the execution gains the lock. Otherwise the script waits up to a configurable time to try to create the folder.Example:from lockdir import LockDirlock = lockdir.LockDir(parallelruns=5, secondswait=300, lockdir="/tmp/lockdir.lock")if not lock.acquire_lock():print "Error acquiring lock"sys.exit(1)# do the joblock.clean_lock()
Package: lockdown
Tool to encrypt local Python source code with AES-256, and dynamically
load and run it, and bring it into the Lockdown namespace.
Uses HMAC for integrity check, AES-256 in counter mode for encryption.THIS HAS NOT BEEN AUDITED FOR SECURITY HOLES.
USE AT OWN RISK. I’M NOT RESPONSIBLE FOR YOUR FAILURE TO HEED THAT WARNING.Example usage:#!/bin/bash
lockdown lockedfiles.vault secret/creds.py secret/my_funcs.py
# Enter and repeat password.
# Now would be a good time to delete the files you locked,
# but make sure not to lose that vault file.In Python:#!/usr/bin/env python
from lockdown import Lockdown
locker = Lockdown('lockedfiles.vault')
# Enter password.
locker.unlock()

# Login with encrypted credentials. Python files aren't there!
# Note: It collapsed the path.
# (so it's locker.creds, not locker.secret.creds)
some_login(locker.creds.USERNAME, locker.creds.PASSWORD)

# Call a function.
# NOTE: These can't import vaulted files within functions.
# Files are lost after unlocking!
locker.my_funcs.scoobydoo()

# To leave files out, do this instead:
locker.unlock(delete=False)You can see the potential uses, for example locking up a file with secret keys
and credentials with a master password, or disabling functionality of a script
and not exposing the source unless the password is available.
Package: locked-dict
Locked-dictImplementation of dict supporting context managed thread safe and mutable iterations through a lock.License: MIT|Country of origin: Switzerland|Export control classification number(ECCN): EAR99Third party dependencies are documented in the folderthird-party.DocumentationUser and developerdocumentation of locked-dict.Bug TrackerAny feature requests or bug reports shall go to thetodos of locked-dict.Primary Source repositoryThe main source oflocked-dictis on a mountain in central Switzerland.
We use distributed version control (git).
There is no central hub.
Every clone can become a new source for the benefit of all.
The preferred public clones oflocked-dictare:on codeberg- a democratic community-driven, non-profit software development platform operated by Codeberg e.V.at sourcehut- a collection of tools useful for software development.ContributionsPlease do not submit "pull requests" (I found no way to disable that "feature" on GitHub).
If you like to share small changes under the repositories license please kindly do so by sending a patchset.
You can either send such a patchset per email usinggit send-emailor
if you are a sourcehut user by selecting "Prepare a patchset" on the summary page of your fork atsourcehut.StatusProduction/stable.NoteThe default branch isdefault.
Package: locket
Locket implements a file-based lock that can be used by multiple processes provided they use the same path.importlocket# Wait for lockwithlocket.lock_file("path/to/lock/file"):perform_action()# Raise LockError if lock cannot be acquired immediatelywithlocket.lock_file("path/to/lock/file",timeout=0):perform_action()# Raise LockError if lock cannot be acquired after thirty secondswithlocket.lock_file("path/to/lock/file",timeout=30):perform_action()# Without context managers:lock=locket.lock_file("path/to/lock/file")try:lock.acquire()perform_action()finally:lock.release()Locks largely behave as (non-reentrant)Lockinstances from thethreadingmodule in the standard library. Specifically, their behaviour is:Locks are uniquely identified by the file being locked,
both in the same process and across different processes.Locks are either in a locked or unlocked state.When the lock is unlocked, callingacquire()returns immediately and changes
the lock state to locked.When the lock is locked, callingacquire()will block until the lock state
changes to unlocked, or until the timeout expires.If a process holds a lock, any thread in that process can callrelease()to
change the state to unlocked.Callingrelease()on an unlocked lock raisesLockError.Behaviour of locks afterforkis undefined.Installationpipinstalllocket
Package: lockex
lockex======lockex is a tool that attempts to acquire a lock from zookeeper priorto executing a user supplied command.If lockex cannot aquire a lock, it will block, wait and retry to acquirethe lock. Alernatively instead of blocking, lockex can exit after a giventimeout or immediately. The lock id is generated automatically based onuser supplied command. We also assume that the user command that is tobe run, is executed in the foreground.By default if the concurrency is set it 1, lockex will try and get lock,if the concurrency is greater than 1 then lockex will try to acquire alock via a semaphore.lockex will die if the connection to zookeeper is lost, it will continueto run if the connection is suspended. lockex will do it's best tocleanup the child process when this happens.License-------Please see COPYINGUse cases:----------* You have a producer/consumer based daemons, you can only run oneproducer at a time. *lockex* will let you startup many producers butonly one will run if it has acquired a lock.* A long running cronjob and you want to guarantee that it runs on onlyon one host assuming the jobs all start within a small time window.Installation:-------------pip install https://github.com/rapid7/lockexUsage:------Running *lockex --help* will give you information about how to usethe application. In general,lockex OPTIONS -- your_command your_args*lockex* will treat anything after the '--' as the command that you wantto run. *lockex* will also look for the ZKHOSTS environment variableto connect to your zookeeper cluster, the format is a comma seperatedlist of 'hostname:port'.Example:--------Assuming redis did not have a master/slave capability and you are usingsupervisord to run your processes.On host1, you have a single redis instance running (assuming the datais stored in a shared location)lockex -- /usr/local/bin/redis-server /etc/redis.confOn host2, you have an identical configuration (with access to the datain the shared location), run the same command as on host1lockex -- /usr/local/bin/redis-server /etc/redis.confIf and when host1's instance redis dies, host2 will acquire the lockfrom zookeeper and startup redis. In a controlled example send host1'slockex instance with a SIGTERM and it will kill it's child processes.Requirements:-------------* A working installation of zookeeper and python2.7 or higher.* A durable instance of zookeeper (at least three nodes).* The hosts are all synchronised with ntp.Vendored packages:------------------* lockex/glog.py - https://github.com/benley/python-glog - Copyright (c) 2015 Benjamin Staffin - under 2 clause BSD license.
Package: lockexclusive
Limits the number of running instances of a Python scriptpip install lockexclusiveHow to use itimportsysfromtimeimportsleepfromlockexclusiveimportconfigure_lock# it can be used like this:# configure_lock(maxinstances=1, message="More than one instance running",file=sys.argv[0])# or without the file argument:configure_lock(maxinstances=1,message="More than one instance running")sleep(100)
Package: lockfile
Note: This package isdeprecated. It is highly preferred that instead of
using this code base that insteadfastenersoroslo.concurrencyis
used instead. For any questions or comments or further help needed
please emailopenstack-devand prefix your email subject
with[oslo][pylockfile](for a faster response).The lockfile package exports a LockFile class which provides a simple API for
locking files.  Unlike the Windows msvcrt.locking function, the fcntl.lockf
and flock functions, and the deprecated posixfile module, the API is
identical across both Unix (including Linux and Mac) and Windows platforms.
The lock mechanism relies on the atomic nature of the link (on Unix) and
mkdir (on Windows) system calls.  An implementation based on SQLite is also
provided, more as a demonstration of the possibilities it provides than as
production-quality code.Note: In version 0.9 the API changed in two significant ways:It changed from a module defining several classes to a package containing
several modules, each defining a single class.Where classes had been named SomethingFileLock before the last two words
have been reversed, so that class is now SomethingLockFile.The previous module-level definitions of LinkFileLock, MkdirFileLock and
SQLiteFileLock will be retained until the 1.0 release.To install:python setup.py installDocumentation:http://docs.openstack.org/developer/pylockfileSource:http://git.openstack.org/cgit/openstack/pylockfileBugs:http://bugs.launchpad.net/pylockfile
Package: lock-file-smith
lock-file-smithSimple wrapper for Git LFS (Large File Storage) commands.QuickstartAs there is no API for interacting with Git LFS, this wrapper provides function that
you can use in your Python application for querying, lock/unlock Git LFS files etc.TheLockFiledataclass stores the name, author and ID of a locked file.Take note that the speed of this library depends on Git. This has not been tested on
a Git repository with a large number of locked files.Usagefromlockfilesmith.cmdsimportlock,query# Use this to verify if Git/Git LFS is presencequery.is_git_installed()query.verify_git_lfs()# Query for locked files.locked_files=query.locked_files()# Will return empty list if no locked files# Lock a file (ensure the file format is tracked as LFS)lock.lock_file("foo/bar.uasset")# True# Unlock file (you can retrieve the locked object ID using query.locked_files)bar=query.locked_files()[0]# assume bar.uasset is the only locked filelock.unlock_file(bar.id)Further readinghttps://git-lfs.com/https://www.atlassian.com/git/tutorials/git-lfs
Package: locking
lockingOverviewExamplesInstallationOverviewThese locks provide a similar interface to those in thethreadingandmultiprocessingmodules with a different set of tradeoffs.
These locks are useable by multiple different processes when those processes agree on a naming scheme.
This can be used in order to allow multiple processes running on the same machine to semi-coordinate or in the case of the redis or dynamo backed locks multiple processes running on different machines to coordinate work.
This provides a different type of coordination than multiple workers consuming from a single queue and can allow quickly prototyping a solution where workers attempt to grab a job and take a lock on it, grabbing another job if they fail at getting the lock.
One benefit of this type of solution is that it allows running on spot hardware in the cloud since if a single job is dropped before it is completed the lock will soon expire and another worker will be able to grab that same piece of work.Much like the locks provided by the threading/multiprocessing modules, these can (and probably should) be used as context managers.ExamplesSocketLockSocketLockrequires no additional third party libs, and should work well on *nix OS's.Advantages:if a process dies the lock is released ~instantlyno lockfiles polluting the filesystemDisadvantages:requires all processes to be on the same host OSonly works on nix-based os's (and maybe not even mac)fromlockingimportSocketLockimporttimewithSocketLock(lockname="uniquename")asmylock:# at this point we're holding the lock and can# safely perform operations without worrying about# other threads/process holding a lock with this name# interferingtime.sleep(1)FileLockFileLockrequires no additional third party libs andshouldwork on most OS's, with the disclaimer that I only have access to *nix OS's.fromlockingimportFileLockimporttimewithFileLock(lockname="foolock")asmylock:time.sleep(1)RedisLockRedisLockrequiresredisand obviously a redis server.
The advantage ofRedisLockoverSocketLockorFileLockis that you don't need to be on the same host as other processes.
This can be useful if you want one of N hosts to perform some action.fromlockingimportRedisLockimporttimewithRedisLock(lockname="some_process_identifier",hosts=["myredis.com"]):time.sleep(1)DynamoLockDynamoLockdoesn't require an always on redis likeRedisLock, however it does require dynamodb access on AWS.
In theory this should be pretty cheap.fromlockingimportDynamoLockimporttimewithDynamoLock(lockname="some_process_identifier",table="locks",checkpoint_frequency=2,ttl=5):time.sleep(1)InstallationFrom PyPIpython-mpipinstall--upgradelockingFrom GitHubpython-mpipinstall--upgradegit+https://git@github.com/jbylund/locking.git
Package: lockit
# lockitEncrypt files and folders from the command line without breaking a sweat 🔒📁📄Lockit is a very simple program for a very simple purpose. Encrypt files / folders with any password. Let me show you.`bash $ touch hello.txt $ echo "Hello World" > hello.txt $ lock hello.txt Password: MyPassword Confirm Password: MyPassword $ ls hello.txt.lck $ cat hello.txt.lck夒▒V▒▒6▒▒▒.▒▒$ lock hello.txt.lck Password: MyPassword $ ls hello.txt $ cat hello.txt Hello World `Keep in mind, I used a file. You can do the same with a folder with all the same commands.`bash $ mkdir hello $ cd hello $ touch test.txt $ echo "Works with directories!" > test.txt $ cd .. $ lock hello Password: Secure Folder Confirm Password: Secure Folder $ ls hello.lck $ lock hello.lck Password: Secure Folder $ cd hello $ cat test.txt Works with directories! `## InstallingHow do you think?`bash $ pip install lockit  # Do this on windows if you only have 1 python installed $ pip3 install lockit  # Do this on linux $ py-version_here-mpip install lockit  # Python version specific installation for windows `## TODO:Hide passwords (Multi-platform)Better cliDecaprecate cache systemCheck if password worked### All suggestions and pulls are welcome!