Saravanan666/pypi-org huggingface dataset:
Package: weakget
weakget - Chaininggetattrand.getWithweakget, you can write code like:x=weakget(obj)[5]['key'].attr.method()%'default'andxwill be set to'default'if:objhas just 3 items, orobj[5]is missing'key', orobj[5]['key']doesn't haveattr, orobj[5]['key'].attrdidn't definemethod()Otherwise,xgets set toobj[5]['key'].attr.method(). Similar code in pure Python would look like:try:x=obj[5]['key'].attr.method()except(LookupError,AttributeError):x='default'weakgetis better because:it doesn't hideAttributeErrorraised fromobj[5]orobj[5]['key']it doesn't hideLookupErrorraised fromobj[5]['key'].attrorobj[5]['key'].attr.methodit doesn't hideanyexception raised from callingobj[5]['key'].attr.method()it fits on one line!UsageInstall fromPyPIusingpip:pip install weakgetThen import into your scripts:>>>fromweakgetimportweakget>>>obj=[]>>>weakget(obj)[5]['key'].attr.method()%'default''default'pep505 - None-aware operations à la PEP 505But wait, there's more!PEP 505describes addingNone-aware operators to Python, but you can get that behaviour today frompep505:fromweakgetimportpep505x=pep505(a.attr,b.attr)%3# i.e. a.attr ?? b.attr ?? 3y=pep505(c)['key'].attr%None# i.e. c?.['key']?.attrBehind-the-scenes,pep505works in much the same way asweakget, but whereweakgetlooks forLookupErrororAttributeErrorto be raised,pep505only looks forNone. Similar code in pure Python would look like:x=a.attrifa.attrisnotNoneelseb.attrifb.attrisnotNoneelse3y=c['key'].attrif(cisnotNoneandc['key']isnotNone)elseNonepep505is better because:a.attr,b.attr, andc['key']are each evaluated at mostonceless typing, which also means...less chance for logic errorsFAQsQ:Why not usegetattr's default instead of catching, and possibly hiding,AttributeErrors?A:Turns outgetattralso catchesAttributeError:>>>classA:...@property...defb(self):...returnNone.badattr>>>getattr(A(),'b')AttributeError:'NoneType'objecthasnoattribute'badattr'>>>getattr(A(),'b','default')'default'Q:Why not use.get's default argument instead of catchingLookupError?A:.getis implemented on mapping objects likedict, but is not available on sequence objects likelist. Catching theLookupErrorfromobj[key]is the only way to support both.Q:Why%instead ofor,|, or a method?A:orisn't an option as itcannot be directly overloaded.|is enticing asa | breads like "aorb", but "or" in Python usually refers to truthiness, whichdoes not distinguish "lack of value" from "false". Adding a method would hide any method of the same name in the underlying object.%isalready overloaded in Python, making it the best option among the remaining operators.Q:Can't you come up with a better name thanpep505?A:Well,PPis currently in the lead as it looks like??, but I'm open to suggestions!
Package: weaklisp
WeaklispThis is a tool to analyze and format very simple lisp code. It is
mostly directed to lisp extension languages found in CAD programs. It
can document the code in reStructuredText format.SetupTo install, update or uninstall you can usepip:pip install weaklisp

pip install --upgrade weaklisp

pip uninstall weaklispUsage$ python -m weaklisp -h
usage: weaklisp [-h] [-q] [-o OUTPUT] [-f [FORMAT]] path [path ...]

Analyze simple lisp code.

positional arguments:
  path                  Path to lisp file to be parsed.

optional arguments:
  -h, --help            show this help message and exit
  -q, --quiet           Do not print the output.
  -o OUTPUT, --output OUTPUT
                        Save a reStructuredText file.
  -f [FORMAT], --format [FORMAT]
                        Format of files, either 'lisp' or 'config'.It can also be imported and used as a library.ForkThe repository can be foundhere.
Package: weaklru
weaklruSimple combination of a weakref cache and a lru cache.class Obj:
  pass


l = WeakLRU(max_size=2)

l.set("a", Obj())
l.set("b", Obj())
l.set("c", Obj())
l.get(a)        # none
l.get(b)        # obj
l.get(c)        # objYou can add objects to the cache, and they will never expire as long as they are being used.Also, a maximum number of objects will be stored in the LRU portion of the cache.
Package: weaklysupervised
Weakly Supervised LearningDescriptionThis is a Python framework for weakly supervised learning. This package
can be used for weak supervised learning classification tasks.InstallationYou can install it bypipmethod.pipinstallweaklysupervisedAPIWe have implemented following weakly-supervised learning algorithm.bootstrappingExamplesfromexamples_utilsimportget_data,DNNfromsklearnimportmetricsfromweaklysupervisedimportBootstrappingNeuralNetworkClassifierif__name__=="__main__":X_train,X_test,y_train,y_test=get_data()DNN=DNN()clf=DNN.build_model(input_dim=30,output_dim=2)model=BootstrappingNeuralNetworkClassifier(clf,batch_size=128,epochs=40,bootstrapping_type="soft",beta=0.95,patience=5,best_model_name="model_check_point_best_model")model.fit(X_train,y_train,validation_data=(X_test,y_test),)predict=model.predict(X_test)acc=metrics.accuracy_score(y_test,predict)print("bootstrapping accuracy",acc)Please seeexamplesfolder for more examples.
Package: weakrefable
If you use theweakrefmodule, you may be aware that some object do not
support being weakly referenced to. For example, built-ins dict and list.Trying to create a weak reference willraiseaTypeError.There does not seam to be any way from Python itself to check whether an object
can beweakref’d, though the CPython C-layer make that pretty easy.This just exposes this functionality at the python level
Package: weakreflist
A WeakList class for storing objects using weak references in a list.Table of ContentsInstallationUsageDevelopmentContributorsInstallationInstall it from pypi:pip install weakreflistor from sources:git clone git@github.com:apieum/weakreflist.git
cd weakreflist
python setup.py installUsageSame as alistexcept that when a weakref-able variable is deleted, it is removed from the list.Example for CPython:fromweakreflistimportWeakListclassA(object):"""weakrefs don't function directly on object()"""objectA=A()my_list=WeakList([objectA])assertlen(my_list)==1delobjectAassertlen(my_list)==0# objectA removed from listNote:Pypy (probably jython, cython…) have a different implementation of garbage collector and it is known that weakrefs doesn’t function the same way.You need to explicitly call gc.collect() which has an impact on performance.Example for other python implementationsfromweakreflistimportWeakListimportgcclassA(object):"""weakrefs don't function directly on object()"""objectA=A()my_list=WeakList([objectA])assertlen(my_list)==1delobjectAassertlen(my_list)==1# gc not donegc.collect()# must be calledassertlen(my_list)==0DevelopmentYour feedback, code review, improvements or bugs, and help to document is appreciated.
You can contact me by mail: apieum [at] gmail [dot] comTest recommended requirements:pip install -r dev-requirements.txtSometimes –spec-color doesn’t function. Uninstall nosespec and nosecolor then reinstall nosecolor and nosespec separatly in this order (nosecolor first).Launch tests:git clone git@github.com:apieum/weakreflist.git
cd weakreflist
nosetests --with-spec --spec-color ./weakreflist
# or with watch
# nosetests --with-spec --spec-color --with-watch ./weakreflistContributorsThanks toBoonsNaibotto have contributed to:extended slicing support__reversed__, count, extend, insert methods.
Package: weakref_property
Add a property that acts like a normal attribute,
but keeps a weak reference to anything that is assigned
to it.Example:First let’s define WeakValue using WeakProperty
and SomeClass that will be weakly referenced:>>> import weakref_property
>>> import gc

>>> class WeakValue(object):
...     value = weakref_property.WeakProperty('value')

>>> class SomeClass(object):
...     passYou can assign and retrieve a value:>>> a = SomeClass()
>>> obj = WeakValue()
>>> obj.value = a
>>> obj.value  # doctest: +ELLIPSIS
<__main__.SomeClass object at ...>But it is kept as a weakref, so it can get collected.
If it is collected, the property returns None:>>> del a
>>> gc.collect()  # force gc to collect `a` object
0
>>> obj.valueYou can also delete the value completelly:>>> del obj.value
>>> obj.value
Traceback (most recent call last):
    ...
AttributeError: 'WeakValue' object has no attribute 'value'Sadly, weakrefs do not work on tuples, ints
and not-subclassed lists and dicts:>>> obj.value = []
Traceback (most recent call last):
    ...
TypeError: cannot create weak reference to 'list' object
Package: weakrefset
Python 2.7 & 3.1 include aWeakSetclass, a collection for storing objects
using weak references
(see thePython weakref module).This project is a backport of the weakrefset module, and tests, for Python 2.5
and 2.6. The tests
require theunittest2 package.Mercurial repository & issue tracker:http://code.google.com/p/weakrefset/You can install it with:pip install weakrefsetUsage is straightforward. You don’t need to deal with weak references
themselves, the WeakSet manages
the references and you can add / remove / iterate over your objects directly:>>> from weakrefset import WeakSet
>>> class Foo(object): pass
...
>>> f1 = Foo()
>>> f2 = Foo()
>>> refs = WeakSet([f1, f2])
>>> f3 = Foo()
>>> refs.add(f3)
>>> refs.remove(f1)
>>> del f2
>>> f3 in refs
True
>>> for f in refs:
...  print f
...
<__main__.Foo object at 0x40e410>To be compatible with Python 2.5, 2.6 and future versions of Python you can
import it like this:try:
    # location in Python 2.7 and 3.1
    from weakref import WeakSet
except ImportError:
    # separately installed
    from weakrefset import WeakSet
Package: weakscraper
# weakscraper
HTML scraper with templates## DescriptionMost HTML pages are generated using templates. Why not use templates too for scraping HTML pages? As for a template language, let’s use HTML plus a few keywords. That way, the workflow withweakscraperis the following :
* Get the source of a HTML page you want to scrap.
* Using a few keywords, edit the HTML to select which information is of interest and which parts to discard.
* If complicated processing is required, write additional callbacks.
* Runweakscraperon the template and on the HTML.## Pros
* Observes the [rule of least power](https://en.wikipedia.org/wiki/Rule_of_least_power). A declarative language helps to focus onwhatto keep.Howthe information is scrapped is the job of the library.## Cons## Examples## How it works ?## LicenseMIT (http://www.opensource.org/licenses/mit-license.php)
Package: weallcode-robot
Micro:bit TinyBit BLE Python LibraryA Python package to control a custom Robot V2 via Bluetooth Low Energy (BLE) communication. The package provides an API for controlling the robot's movements and LED colors.InstallationThis project usesPoetryfor package management. Install Poetry if you haven't already.To install the package and its dependencies, run:poetryinstallUsageTheexample.pyscript demonstrates how to use the package to control the robot.fromweallcode_robotimportRobotrobot=Robot("WAC")robot.led(255,0,0)# Set the LED color to redrobot.move(100,100)# Move forwardrobot.wait(2)# Wait for 2 secondsrobot.move(0,0)# Stop the robotrobot.move(-100,100)# Turn the robotrobot.wait(0.25)# Wait for 0.25 secondsrobot.move(100,100)# Move forwardrobot.wait(1)# Wait for 1 secondrobot.move(0,0)# Stop the robotrobot.move(-100,-100)# Move backwardrobot.wait(1)# Wait for 1 secondrobot.move(0,0)# Stop the robotrobot.led(0,0,0)# Turn off the LEDrobot.run()# Execute the commandsAPIRobotTheRobotclass is the main class to control the robot. Instantiate the class with the name of the robot.robot=Robot("WAC")Methodsled(r: int, g: int, b: int): Sets the LED color. Values should be integers between 0 and 255.move(right: int, left: int): Sets the motor speeds. Values should be integers between -100 and 100.wait(duration: float): Adds a wait command with a given duration in seconds.run(): Executes the commands in the order they were added.DevelopmentThe package includes development dependencies:black: Code formatterpre-commit: Pre-commit hooks for code formatting and lintingisort: Import sorterruff: LinterTo install the development dependencies, run:poetryinstall--extrasdevTo run the pre-commit hooks, first install them:pre-commitinstallThen run:pre-commitrun--all-filesAuthorsBlaine RothrockAli Karbassi
Package: wealthsimple-trade-python
A convenient Python wrapper for the Wealthsimple Trade API. Note that this wrapper is Unofficial and is not in any way affiliated with Wealthsimple. Please use at your own risk.docstestspackageInstallationpip install wealthsimple-trade-pythonYou can also install the in-development version with:pip install https://github.com/seansullivan44/Wealthsimple-Trade-Python/archive/master.zipNote:nodeis a dependency of this project. See [here](https://github.com/VeNoMouS/cloudscraper#dependencies) for more information.Getting StartedDownload the Wealthsimple Trade app for iOS or Android and create an account. This API wrapper will use your Wealthsimple Trade login credentials to make successful API calls. After creating an account, use your login credentials to create a WSTrade object:import wealthsimple
WS = wealthsimple.WSTrade('email', 'password')If your Wealthsimple Trade account uses two-factor authentication then you must provide theWSTradeobject with a callback function as shown in the following example:import wealthsimple

def my_two_factor_function():
    MFACode = ""
    while not MFACode:
        # Obtain user input and ensure it is not empty
        MFACode = input("Enter 2FA code: ")
    return MFACode

ws = wealthsimple.WSTrade(
    "email",
    "password",
    two_factor_callback=my_two_factor_function,
)Documentationhttps://Wealthsimple-Trade-Python.readthedocs.io/
Package: weao
WEAOPython API wrapper for thehttps://whatexploitsare.onlineAPIInstallationPython 3.11 or higher is requiredInstall The PyPi Version:py-3-mpipinstall-UweaoYou may also install the development version:pipinstallgit+https://github.com/xFGhoul/WEAO.gitUsageQuick Example:importasynciofromweaoimportClientclient=Client()asyncdefget_exploit():exploit=awaitclient.get_exploit("Synapse")print(exploit.status)loop=asyncio.new_event_loop()loop.run_until_complete(get_exploit())You can find more examples in theexamplesdirectory.Files and Explanations├──.github— GitHub configuration including CI/CD workflows├──docs— Developer Documentation├──tests— Tests├──examples— Examples Showing How To Use The Wrapper├──weao— Source Code Of WEAOMade With ❤️ Byghoul#9497
Package: wearablehrv
wearablehrvis an open-source Python package tailored for data preparation, pre-processing, feature extraction, comparison, visualization, and both individual and group statistical analyses of heart rate and heart rate variability metrics from wearable devices that transmit raw inter-beat intervals and timestamps. The inclusion of graphical user interfaces in most functions grants researchers the flexibility to easily switch between experimental conditions and devices. This offers versatility in validating an unlimited number of wearables within a single experimental setting and under various conditions. The only required inputs for the pipeline are the inter-beat intervals and timestamps for each device; the rest is fully handled by thewearablehrvpackage. The main functionalities of this Python package are:Individual Pipeline:Define experimental events by importing raw data from an unlimited number of devices and experimental conditions.Visualize the inter-beat-interval against the criterion device using an intuitive graphical user interface.Correct for lag between devices with millisecond precision and crop the signals when necessary.Pre-process and calculate both time-domain and frequency-domain measures in one go for all devices and conditions.Provide various plotting options to compare the criterion devices with a specific device and establish its validity.Group Pipeline:Import all individual cases, perform an extensive signal quality check and analysis, and exclude outliers if necessary based on modifiable cutoffs.Offer many descriptive plots to visualize the entirety of data for all cases, conditions, and devices.Conduct the most important statistical analyses in one go and with one click for all devices and conditions against the criterion device, including regression analysis, intraclass correlation coefficient, and Bland-Altman analysis.DocumentationFor an in-depth explanation of the package and sample data, please refer to:QuestionsFor any questions regarding the package, please contact:aminsinichi@gmail.comm.sinichi@vu.nlDependenciesStandard LibrariesdatetimeosjsonpickleData Analysis & ManipulationpandasnumpyVisualizationplotlygraph_objectsexpressmatplotlibpyplotdatestransformsseabornUser InterfacetkinteripywidgetsIntText, Dropdown, Output, HBoxIPythondisplay, clear_output, MarkdownStatistical AnalysispingouinscipystatslinregressstatsmodelsapicopydeepcopyHeart Rate Variability Analysishrvanalysisremove_outliers, remove_ectopic_beats, interpolate_nan_valuesget_time_domain_featuresget_frequency_domain_featuresData Serializationavrodatafile.DataFileReaderio.DatumReaderUser InstallationThe package can be easily installed usingpip:pip install wearablehrvThe repository can be cloned:git clone https://github.com/Aminsinichi/wearable-hrv.gitGitHubhttps://github.com/Aminsinichi/wearable-hrvDevelopmentwearablehrvwas developed by Amin Sinichihttps://orcid.org/0009-0008-2491-1542, during his PhD at Vrije Universiteit Amsterdam in Psychophysiology and Neuropsychology.ContributorsDr. Martin GevondenProf dr. Lydia Krabbendam
Package: wearesports
WeAreSports Command-line interfaceThis is a command-line script (wearesports) for managing activity booking onwearesports.fr, a sports complex in Lyon, France.ActivitiesBadminton (badminton)Squash (squash)Padel (padel)Foot XL (foot)Foot 5 (foot_5)Command-line scriptInstalling this package gets you a shell command,wearesports, that you can use to interact withwearesports.fr.You’ll need to provide your WeAreSports credentials. You can do this with the--usernameand--passwordparams, but it’s easier to just set them as environment variables:export WAS_USERNAME=<username>
export WAS_PASSWORD=<password>UsageList available courts for badminton:wearesports badminton schedule $(date +%Y-%m-%d)
Package: we-are-venom
VenomChecks which modules developer contributed using git history.Installationpip install we-are-venomUsageFirst, provide module structure configuration insetup.cfg,venomsection:[venom]
history_depth_years=2
min_lines_in_file=20
extensions_to_check=py,html,css,md,cfg,js,ts
min_new_lines_for_accumulated_module=50
modules=
    apps/foo
    apps/bar
    scripts
    coremodulesvariable is required, others are optional.Check total accumulation level:$ venom check melevir@gmail.com .
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┓
┃ Module                         ┃ Total lines ┃ Touched lines ┃ Accumulated ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━┩
│ opensource_watchman/pipelines/ │ 557         │ 120           │ ✅          │
│ opensource_watchman/utils/     │ 30          │ 30            │ ❌          │
│ opensource_watchman/templates/ │ 105         │ 127           │ ✅          │
│ opensource_watchman/api/       │ 218         │ 12            │ ❌          │
│ tests/                         │ 8           │ 16            │ -           │
│ opensource_watchman/api/       │ 218         │ 0             │ ❌          │
│ opensource_watchman/pipelines/ │ 557         │ 0             │ ❌          │
│ opensource_watchman/templates/ │ 105         │ 0             │ ❌          │
│ opensource_watchman/utils/     │ 30          │ 0             │ ❌          │
│ tests/                         │ 8           │ 0             │ -           │
└────────────────────────────────┴─────────────┴───────────────┴─────────────┘
Total accumulation rate: 25%Generate report for Grand Code Review:$ venom grand-code-review . 2020-05-01 2020-06-01 https://github.com/best-doctor/import_me/ --min_lines=100 --module=finance --module=chat --generate_pretty_changesets
# TODO
Ticket num
    Info:
        Touched lines: 23
        Touched modules: finance
        Authors: melevir
    Commits:
        commit1 (link)
        commit2 (link)
...
Summary: total tickets, total commits, total loc in report and filtered.This one groups commits by ticket number, filters out commits groups, that
touched more thatmin_lineslines or touched files inmodule(can be
multiple). Ifgenerate_pretty_changesets, than every group is cherry
picked to separate branch to generate pretty diff view.ContributingWe would love you to contribute to our project. It's simple:Create an issue with bug you found or proposal you have.
Wait for approve from maintainer.Create a pull request. Make sure all checks are green.Fix review comments if any.Be awesome.Here are useful tips:You can run all checks and tests withmake check. Please do it
before TravisCI does.We useBestDoctor python styleguide.We respectDjango CoC.
Make soft, not bullshit.
Package: wearipedia
wearipediaA one-stop shop for wearable device data extraction and simulationWearipedia provides a one-stop shop for accessing and extracting data from wearable devices.Data from these devices may be used for:Clinical researchPersonal health monitoringHealth coachingHealth product developmentWearable device developmentWearipedia is developed and maintained by theSnyder Labat the Stanford University.Accessing data from wearable devicesThe data from these devices is accessed using an easy-to-use API. In order to use this API, you will need to import thewearipediamodule:importwearipediaOnce you have imported thewearipediamodule, accessing data from any wearable device is as easy as:device=wearipedia.get_device("whoop/whoop_4")device.authenticate({"email":"joesmith@gmail.com","password":"foobar"})# data is a DataFramedata=device.get_data("metrics")If you don't have access to your device, or need to demo data from a device without revealing your sensitive data or getting a device yourself, you can generate synthetic data, as shown below:device=wearipedia.get_device("whoop/whoop_4")# data is an automatically generated DataFramedata=device.get_data("metrics")and you're done!InstallingThe easiest way to install wearipedia is to use pip:pip install wearipediaWe currently support Python 3.7, 3.8, and 3.9.Supported DevicesWearipedia supports the following devices:CompanyModel NameDescriptionExample NotebookKinds of Data AvailableUnique nameWhoopWhoopThe WHOOP 4.0 strap tracks sleep and activity data.Notebookcycles, hr.whoop/whoop_4GarminFenix 7SThe Garmin Fenix 7S is a watch that activity data.Notebookdates, steps, hrs, brpms.garmin/fenix_7sDexcomPro CGMThe Dexcom Pro CGM wearable device tracks blood sugar levels.Notebookdataframe.dexcom/pro_cgmWithingsBody+The Withings Body+ is a smart scale that tracks weight and other metrics (body fat %).Notebookmeasurements.withings/bodyplusWithingsScanWatchThe Withings ScanWatch wearable device tracks sleep and activity data.Notebookheart_rates, sleeps.withings/scanwatchDocumentationFor more information on how to use wearipedia, please refer to ourdocumentation.CitingA paper is in progress!DisclaimerThis project is currently inalpha. This means that test coverage is limited, and the codebase is still really a prototype. Moreover, the API is unstable, as we are still rapidly iterating on it. Expect for most things to work, but also small bugs, rough edges, and sparse documentation.ContributingAs Wearipedia is still at an early stage, we are not yet accepting contributions from the broader community. Once Wearipedia reaches its first stable release, we will begin accepting contributions.LicenseWearipedia is released under the MIT license.CreditsThis project was generated withpython-package-template