Saravanan666/pypi-org huggingface dataset:
Package: unitrevpy
unitrevpySummaryunitrevpy is a package that contains common unit conversions such aslength,temperature,area,volume,time, andweight.What units does it contain?Specifically contains:LenghtMeter, Yard, Mile, Foot, Inch, and Light Year.TemperatureCelsius, Kelvin, and FahrenheitAreaSquare meter, Hectare, Square Mile, Square Yard, Square Foot, Square Inch, and Acre.VolumeCubic Meter, Cubic Kilometer, Cubic Centimeter, Cubic Millimeter, Liter, Milliliter, US Gallon, US Quart, US Pint, US Cup, US Fluid Ounce, US Table Spoon, US Tea Spoon, Imperial Gallon, Imperial Quart, Imperial Pint, Imperial Fluid Ounce, Imperial Table Spoon, Imperial Tea Spoon, Cubic Mile, Cubic Yard, cubic Foot, and Cubic Inch.TimeSecond, Minute, Hour, Day, Week, Month, and Year.WeightKilogram, Gram, Millimeter, Metric Ton, Long Ton, Short Ton, Pound, Ounce, Carat, and Atomic Mass Unit (Dalton).installationpip install unitrevpyorpython -m pip install unitrevpyTo import it into a script:fromunitrevpyimportconvertorfromunitrevpy.convertimportCelsiusExampleUsing an integer or float argument:fromunitrevpyimportconvertascy=c.Meter(23).to_yard()m=c.Meter(4500).to_mile()Using list, tuple, or set:fromunitrevpy.convertimportKelvinkelvin=[23,20,16]celsius=Kelvin(kelvin).to_celsius()
Package: unit-run
unit-runDescriptionThis package is used to simply run a unit(only supports theCallableobject currently)in Pythonwithout any extra running code. And it can also save/load all your input parameters as/from a simple json file, so it is easy to run a target unit with auto-input parameters group by give it just a group name.DocumentationSeedocumentTo doSupport for any code segment and the classes from popular package likenumpy.ndarray.Support for complete storage forUnit(including the target unit object).Maybe create a new buldled file extension named.unitto pack all the data files into a single file and provide graphic user interface to get access to it.Support for multiple languages.
Package: units-calculator
units-calculatorA simple units python calculator optimized for convenience over performance.Basic usageParsing unitsUsage example 1 - solving a basic kinematic problemA ball is thrown upwards (from the ground) at a vertical speed of 40.5 feet
per second and a horizontal speed of 20 km/h. How far away
will it land, it meters?fromunits_calculator.allimportparsevertical_velocity=parse("40.5ft/s")gravitational_acceleration=parse("-9.8m/s^2")horizontal_velocity=parse("20km/h")time_to_peak=-vertical_velocity/gravitational_accelerationtime_to_land=2*time_to_peakhorizontal_displacement=horizontal_velocity*time_to_landprint(horizontal_displacement.as_units('m'))# 13.995918367346937mUsage example 2 - solutions dilutionLets say you are in a lab, and you need to perform some solution
concentration comparison. In this curernt example
you have 5 micrograms of some material, and you need to dilute
it to 20 millimolar (mM) concentration, given a molecular
mass of 544.43 grams per mol. What volume of solvent do you need
to use?fromunits_calculator.allimportparsedissolved_mass=parse("5mg")target_concentration=parse("20mM")molar_mass=parse("544.43g/mol")dissolved_mols=dissolved_mass/molar_masssolvent_volume=dissolved_mols/target_concentrationprint(solvent_volume.as_units("ul"))Creating dimensional quantities explicitlyfromunits_calculator.allimportMeters,Seconds_5m=Meters(5)_3s=Seconds(3.0)Defining custom unitsTBDList of supported unitsTBD
Package: unit-simple
Simple Unit (implémentation Python)Mettre à jour l'environnementconda env update --file environment.yml
# ou bien simplement sans faire mention du fichier de conf Conda environment.yml implicite :
conda env update
# ou bien encore, pour supprimer les dépendances absentes du fichier d'environnement :
conda env update --prune --file environement.yml
# ou bien plus implement :
conda env update --prune
# ou bien pour forcer la suppression des dépendances :
conda env create --forcePour mettre à jour l'environnement de dev (test, linter…):conda env create --force environment.dev.ymlUtilisationUtilisation des unités transformées :importunit_simpleassum=su.FundamentalUnit()km=m.scale_multiply(1000)cm=m.scale_divide(100)cmToKm=cm.get_converter_to(km)cmToKm.convert(3)# 0.00003cmToKm.inverse().convert(0.00003)# 3Utilisation des unités dérivées :importunit_simpleassum=su.FundamentalUnit()km=m.scale_multiply(1000)km2=su.DerivedUnit(km.factor(2))cm=m.scale_divide(100)cm2=su.DerivedUnit(cm.factor(2))km2Tocm2=km2.get_converter_to(cm2)km2Tocm2.convert(3)# 30000000000km2Tocm2.inverse().convert(30000000000)# 3Utilisation des unités dérivées en combinant les dimensions :importunit_simpleassum=su.FundamentalUnit()kg=su.FundamentalUnit()g=kg.scale_divide(1000)ton=kg.scale_multiply(1000)gPerM2=su.DerivedUnit(g,m.factor(-2))km=m.scale_multiply(1000)tonPerKm2=su.DerivedUnit(ton,km.factor(-2))cm=m.scale_divide(100)tonPerCm2=su.DerivedUnit(ton,cm.factor(-2))gPerM2ToTonPerKm2=gPerM2.get_converter_to(tonPerKm2)gPerM2ToTonPerCm2=gPerM2.get_converter_to(tonPerCm2)gPerM2ToTonPerKm2.convert(1)# 1gPerM2ToTonPerKm2.inverse().convert(3)# 3gPerM2ToTonPerCm2.convert(1)# 1e-4gPerM2ToTonPerCm2.convert(3)# 3e-10gPerM2ToTonPerCm2.offset()# 0.0gPerM2ToTonPerCm2.scale()# 1e-10gPerM2ToTonPerCm2.inverse().offset()# -0.0gPerM2ToTonPerCm2.inverse().convert(3e-10)# 3Utilisation des températures (conversions affines et linéaires) :importunit_simpleassuk=su.FundamentalUnit()c=k.shift(273.15)kToC=k.get_converter_to(c)kToC.convert(0)# -273.15kToC.inverse().convert(0)# 273.15# en combinaison avec d'autres unités, les conversions d'unités de températures doivent devenir linéairesm=su.FundamentalUnit()cPerM=su.DerivedUnit(c,m.factor(-1))kPerM=su.DerivedUnit(k,m.factor(-1))kPerMToCPerM=kPerM.get_converter_to(cPerM)kPerMToCPerM.convert(3)# 3kPerMToCPerM.inverse().convert(3)# 3Utilisation des conversions non décimales :importunit_simpleassum=su.FundamentalUnit()km=m.scale_multiply(1000.)s=su.FundamentalUnit()h=s.scale_multiply(3600.)ms=su.DerivedUnit(m,s.factor(-1))kmh=su.DerivedUnit(km,h.factor(-1))msToKmh=ms.get_converter_to(kmh)msToKmh.convert(100.)# 360msToKmh.inverse().convert(18.)# 5
Package: units-of-measure
Units of Measureas defined inUnit of Measurement.Python library:units-of-measurePython package:unitsofmeasureObjectivesRelate units of measure to theInternational System of Units (SI)to define their dimension and magnitude.Relate objects to units without changing the objects.Get the unit that an object is mapped to.Give units human-readable symbols and names, and computable attributes.Being mapped to a unit shall not keep an object from being garbage-collected.Provide SI units and prefixes.MotivationFirst, I used the libraryforallpeople,
but that ran intoissues with large scaleslike megatonnes and gigatonnes.Based on myobjectivesI decided to create a new library that does exactly that and does not deal with quantities (yet).LimitsSome types of objects likeintandfloatcannot be mapped to units, because that would create error-prone states.Not all accepted SI units are implemented.Get StartedTo start from the beginning, open theJupyter notebookstart_here.ipynb.
This link is relative, so it might not work in all contexts.There is no dependency to the packagejupyter, neither at buildtime nor at runtime.
Consequently this library does not declarejupyteras dependency.
You can view the notebook onGitHubor inVisual Studio Code.
Beyond that there are several alternatives to view notebooks.
If you want to run or edit it, then you need something likepackagejupyterorMiniconda.Download and install the library withpython -m pip install units-of-measure.DevelopClone withgit clone https://github.com/gerald-scharitzer/units-of-measure.gitTest withpytestDocument withpydoc -w unitsofmeasureBuild withpython -m buildCheck withpython -m twine check dist/*Publish withpython -m twine upload dist/*Release NotesThe latest release 1.1 includestotally ordered prefixestype and value checks in constructorsdimension symbols and namespyproject.tomlandhatchlinginstead ofsetuptools
Package: units-python
UnitsPythonPackagePython package built with focus on simplicity, ease of use & readability.Check out SPECIAL_UNITS in python_units/constants.py if you are missing some constants.If your unit is missing, open a PR with your constant, the appropriate prefix and SI-unit added.InstallationInstall with:pip install units_pythonIf you have already installed this package, but want the latest version use:pip install units_python --upgradeHow to use:In these examples, we have a physics problem to solve.We will solve it using python_units to keep track of our units:Physics Example 1:How many soccer balls (diameter of 22 cm) can fit inside a 5 x 5 x 2.7 meter room?See the example code herePhysics Example 2:A runner has been running 96 km in 8 hours.What are their average page?If the runner continues at this pace, how far will they go in 46.2 minutes?See the example code hereValue Object parameters:The v object parameters are:value: string of value and desired unit split by a spaceten_exponent (optional): float of the ten_exponent i.e: 1.8 * 10 ** 8 m would be v("1.8 m", 8).Relevant methods:.copy() -> Value Object: returns copy of value.round(digits) -> None: round value to number of digits (returns nothing).sqrt(n=1) -> Value Object: takes n-squareroot of value (returns changed value).raw_value() -> Float: returns the value of the object.unit.get() -> String: returns the unit.to(str) -> String: input string with desired unit: "km/h", "tons", "hours". Returns string with value and unit.change_unit(str) -> None: change unit of value to str e.g. if it was not done corectly.raw() -> Value Object: the string representation has ten exponents. This gives the value without any ten exponents..abs() -> Value Object: returns new value object with the objects value being the absolute value[See this for an example of how to use some of the functions]Custom functions:We supply certain relevant functions:sqrt(value, n=1): take n-squareroot of valueimport units_python as up
from units_python import v

my_value = v("9 m^2")
my_value_sqrt = up.sqrt(my_value)
print(my_value_sqrt) # outputs "3 m"nsqrt(value, n): take n-squareroot of valueother_value = v("21 m^3")
my_value_3sqrt = up.nsqrt(my_value, 3)
print(my_value_sqrt) # outputs "3 m"round(value, digits): round value numberthird_value = v("3.1415926535 m")
third_value_rounded = up.round(third_value, 4)
print(third_value_rounded) # outputs "3.1416 m"What units can I use?You can find all avaliable units inpython_units.constant.UNITS&python_units.constant.SPECIAL_UNITS.You can find all avaliable prefixes inpython_units.constant.PREFIXES.You can combine prefixes and units in whatever way you like. You can also combine multiple units: 'ton/liter', 'kg*liter/hour' etc.What you, at this time, cannot do:expvalue ** value (value ** constant works!)
Package: unitstorm
IntroductionStormis a fast, small and powerful object-relational mapper.
Try it to use in db-aware applications.Effective unit-testing DB-models needed:easy access to testing-DB inside testcasessetting up testing-DB before each test (and tear down after)To help this unitstorm provides classModelTestCase,
that can be used both inunittestandnosetesttesting frameworks.Simple examplefrom unitstorm import ModelTestCase
from os import path

import models as model # models define somewhere else

class TestMyModel(ModelTestCase):
    dburi = 'postgres://test:test@localhost/test'

    fixtures = path.join(path.dirname(__file__), 'fixtures')

    fixture_setup = 'create.sql', 'filldata.sql'
    fixture_teardown = 'drop.sql'

    sql_setup = 'INSERT INTO my_model (id, name) VALUES (1, "foo");',\
        'INSERT INTO my_model (id, name) VALUES (2, "bar");'
    sql_teardown = 'DELETE FROM my_model WHERE id = 1;'

    def test_stub(self):
        assert self.store.get(model.MyModel, 1).name == "foo"TODO more description (look sources)dburidbstorefixturesfixture_setupfixture_teardownsql_setupsql_teardownExecution order: fixture_setup, sql_setup, test, sql_teardown, fixture_teardownLegalunitstorm distributed under terms ofGNU LGPL v.2.1.
Copyright 2007 - presentVsevolod Balashov.LinksSource code ofunitstorm.
Package: unitstyle
unitstyleis a python module that adds several output format options
for Python’s standardunittestlibrary (unittest2). Specifically, it
adds many of the output options offered bymocha, a javascript unit testing
framework. This package was created to port those outputs to Python.Installationunitstyleis available on PyPI. You should be able to install it
withpip install unitstyle.UsageTheunitstylepackage provides itself as aunittestTestRunner,
and should be used as such.simple example:importunittestimportunitstylesuite=unittest.TestLoader().discover()unitstyle.TestRunner().run(suite)Supported arguments tounitstyle’s TestRunner are:Output Formatslistdotsjsstream- a JSON streamJSONprogress(bar)mintap- theTest Anything
ProtocolspecFeel free to open an issue to request more, or pull requests!LicenseThis project and code is licensed under the MIT License. See theLICENSEfile for more.Copyright (c) 2015 Dan Panzarella
Package: unit-system
unit_systemThe unit_system package provides a way to do physical quantity math
in Python that replicates Mathcad's unit system. The implementation
conforms to theSI standard.Installation$ pip install unit_systemUsage>>>fromunit_systemimportQuantity>>>V=Quantity(1,"V")>>>A=Quantity(1,"A")>>>1*V/(1*A)1.0ΩYou can load predefined units like the ones in Mathcad.>>>fromunit_systemimport*>>>1*mΩ*1*A0.001VDocumentationhttps://l-johnston.github.io/unit_system/
Package: unittest2canopsis
UnitTest to Canopsis connector=========================.. image:: https://travis-ci.org/linkdd/unittest2canopsis.svg?branch=masterThis package provides a connector which will executes Python unittest to generateevents for Canopsis.Usage-----In this example, we will use the following test (as ``mytest.py``):.. code-block:: python# -*- coding: utf-8 -*-import unittestclass MyTestCase(unittest.TestCase):def test_success(self):self.assertTrue(True)def test_fail(self):self.assertFalse(True)if __name__ == '__main__':unittest.main()Run the unittest on :.. code-block::$ unittest2canopsis -t mytest.py -n mytest0 -a "amqp://guest:guest@localhost:5672/"unittest.mytest0.check.resource.MyTestCase.test_fail... FAILunittest.mytest0.check.resource.MyTestCase.test_success... OKYou can also use a JSON configuration file :.. code-block:: javascript{"tcp2canopsis": {"test": "mytest.py","testname": "mytest0","amqp": "amqp://guest:guest@localhost:5672/"}}And load the file using :.. code-block::$ unittest2canopsis -c path/to/config.jsonExample of generated events :.. code-block:: javascript{"timestamp": 1418206046,"connector": "unittest","connector_name": "mytest0","event_type": "check","source_type": "resource","component": "MyTestCase","resource": "test_fail","state": 2,"state_type": 1,"output": "Traceback (most recent call last):\n  File \"mytest.py\", line 11, in test_fail\n    self.assertFalse(True)\nAssertionError: True is not false\n"}{"timestamp": 1418206046,"connector": "unittest","connector_name": "mytest0","event_type": "check","source_type": "resource","component": "MyTestCase","resource": "test_success","state": 0,"state_type": 1,"output": "OK"}Installation------------Just type :.. code-block::$ pip install unittest2canopsisOr, to install it in a locally :.. code-block::$ ./makefileThis will create a virtual Python environment in the current folder, and install the dependencies listed by ``requirements.txt``.Finally, it will perform a ``python setup.py install``.After executing this script, the connector will be available in the current folder (which is now a virtual Python environment).
Package: unittest2py3k
unittest2 is a backport of the new features added to the unittest testing
framework in Python 2.7 and 3.2.This is a Python 3 compatible version of unittest2. Tested with Python 3.0,
3.1 and 3.2.Although the PyPI project name is “unittest2py3k”, the Python package is called
unittest2. Version numbers are the same as the Python 2 unittest2 package.For full details, including changelog, see:unittest2 on PyPIunittest2py3k is maintained in the unittest-ext repository:unittest2py3k svn repository
Package: unittest2pytest
Author:Hartmut Goebel <h.goebel@crazy-compilers.com>Version:0.4Copyright:2015-2019 by Hartmut GoebelLicence:GNU Public Licence v3 or later (GPLv3+)Homepage:https://github.com/pytest-dev/unittest2pytestunittest2pytestis a tool that helps rewriting Pythonunittesttest-cases intopytesttest-cases.In contrast to other similar tools, thisunittest2pytesthandles keyword arguments,handles single-line test-cases and several tests on one line,uses context-handlers where appropriate.This is done by usinglib2to3and Python’s mightyinspectmodule.InstallationTo install unittest2pytest, simply run:pip install unittest2pytestUsageTo print a diff of changes that unittest2pytest will make against a
particular source file or directory:unittest2pytest source_folderTo have those changes written to the files:unittest2pytest -w source_folderTo have those changes written to another directory:unittest2pytest -w source_folder --output-dir /some/where/elseBy default, this will create backup files for each file that will be
changed. You can add the-noption to not create the backups. Please
do not do this if you are not using a version control system.For more options about running particular fixers, rununittest2pytest--helpor read thelib2to3 documentation. This
tool is built on top of that one.FixesA list of the available fixers can be found with the following:$ unittest2pytest -l
Available transformations for the -f/--fix option:
remove_class
self_assertNote: if your tests use the context managerswith self.assertRaisesorwith self.assertWarns, they will be transformed topytest.raisesorpytest.warnsappropriately, but because the semantics are different, any
use of the output value from the context managers (e.g. thexinwith pytest.raises(ValueError) as x:) will be wrong and will require
manual adjustment after the fact.Changelog0.4 (2019-06-30)Add support forassertDictContainsSubset.Put parenthesis around expressions if required.Fixed assertRaisesRegex, assertRaisesRegexp and assertWarnsRegex.
The regex was getting replaced with an undefined variablepattern.Fix assertRaisesRegex and assertRaisesRegexp with**kwargsandatomparameters.Made assertRaisesRegex, assertRaisesRegexp and assertWarnsRegex use
thematchkwarg inpytest.raisesinstead of creating a variable
with the context manager and doing an assert onre.search.Add a short developer guide.Remove testing on Python 3.0, 3.1, 3.2, add 3.6 and 3.7.Distribute package as a universal wheel.v0.3 (2016-07-26)Add support for assertRaises / assertWarns context managers.Add support for converting lambda arguments in assertRaises into
context managers.Fix some incorrect transformations.Internal cleanup and fixes.v0.2 (2015-10-20)Add support for assertRegex/assertRegexpMatches, assertNotRegex,
assertRaisesRegex/assertRaisesRegexp, assertWarnsRegex.unittest2pytestis now apytestsubproject.Minor fixes.v0.1 (2015-10-16)Initial release
Package: unittest2six
Simple meta package to easily getunittest2functionality in both Python 2 and
Python 3.This provides stuff that was added to unittest in the Python 2.7 stdlib and
backported to Python 2.6 withunittest2. e.g.:assertIn/assertNotInassertIsInstance/assertNotIsInstanceassertRaisesas a context manageretc…This module has no code. It’s just a meta package thatinstall_requiresthe
proper dependency:On Python 2, thisinstall_requiresunittest2.On Python 3, thisinstall_requiresunittest2py3k.This is handy to have one dependency that you can use on both Python 2 and
Python 3 and not have to have separate pip requirements files and tox targets.CompatibilityResults fromTox:$ make test
...
[TOX] py25: commands succeeded
[TOX] py26: commands succeeded
[TOX] py27: commands succeeded
[TOX] py30: commands succeeded
[TOX] py31: commands succeeded
[TOX] py32: commands succeeded
[TOX] congratulations :)
...
  py26: commands succeeded
  py27: commands succeeded
  py32: commands succeeded
  py33: commands succeeded
  py34: commands succeeded
  pypy: commands succeeded
  congratulations :)See alsohttps://github.com/msabramo/unittest2/pull/1– This is a GitHub pull request
for changes that I proposed to make to unittest2 to make it work in Python 3.
Package: unittest-additions
unittest_additionsHelpful extras built to make python unittesting easier.pip install unittest-additionsFeaturesAdditional AssertsTemporary FilesRuntime Timermock_openLine IterationExample UsesBelow are some example uses for some of the features.Temporary Filesdeftest_using_temp_file(self):withTestFile(TEST_FILE,TEST_DATA)astf:# File TEST_FILE now exists with TEST_DATA inside.tf.append(MORE_TEST_DATA)# File TEST_FILE now has TEST_DATA with MORE_TEST_DATA appended.# File TEST_FILE no longer exists.RunTimerA RunTimer is provied to help compare run times of code.withRunTimer()ast:t0=t.split()t1=t.split()t2=t.overall()mock_open Line IterationWhen mocking a file usingmock_open, "code-under-test" using line iteration (as in the example below) will not work as expected. (do_somethingwill not be called.)defmy_function(fn):withopen(fn,'r')asf:forlinf:do_something(l)To enable line iteration you can useadd_line_iter_to_mock_open.@patch('builtins.open',new_callable=mock_open,read_data='line 0\nline 1\n')deftest_function(self,open_mock):add_line_iter_to_mock_open(open_mock)# Line iteration over the mock_open read_data will now work.Additional AssertsTo use the additional asserts, add the mixin to yourTestCaseclass.classMixedTestCase(TestCase,AdditionalAssertsMixin):deftest_a_test:self.assertIsEmpty([])self.assertIsNotEmpty(('hello',))The new asserts are:MethodChecks that ...assertIsEmpty(c)len(c) == 0assertIsNotEmpty(c)len(c) > 0
Package: unittest-assertions
unittest_assertionsThin wrapper around the python builtinunittestallowing developers to use the builtin assertions for non-unittest use cases.Key Features:Easy: Designed to make it be simple allowing developers to use the builtin unittest assertions for their own use cases.Great Developer Experience: Being fully typed, documented, and tested makes it great for editor support and extension.There is More!!!:assertify: Simple, Flexible, and Extendable python3.6+ library to evaluate an expression and returnTrue/Falseor raise anAssertionErrororException.Installationpipinstallunittest-assertionsExamplesfromunittest_assertions.identityimportAssertIsInstanceassert_is_instance=AssertIsInstance(msg="Raised an AssertionError")assert_is_instance("example str",int)# raise AssertionError("'example str' is not an instance of <class 'int'> : Raised an AssertionError")fromunittest_assertionsimportAssertEqualassert_equal=AssertEqual()assert_equal(1,1)assert_equal(first="hello",second="hello")fromunittest_assertionsimportAssertNotInassert_in=AssertNotIn()assert_in(member=1,container=[5,2,3])AssertersContainerAsserterExpressionAssertInassert member in containerAssertNotInassert member not in containerControlAsserterExpressionAssertRaisesassert function raises expected_exceptionAssertWarnsassert function warns expected_warningAssertLogsassert logger(level)EqualityAsserterExpressionAssertEqualassert first == secondAssertNotEqualassert first != secondAssertAlmostEqualassert first ~= secondAssertNotAlmostEqualassert first !~= secondAssertCountEqualassert Counter(list(first) == Counter(list(second))AssertMultilineEqualassert first.splitlines() == second.splitlines()AssertSequenceEqualassert seq1 == seq2AssertListEqualassert list1 == list2AssertTupleEqualassert tuple1 == tuple2AssertSetEqualassert set1 == set2AssertDictEqualassert dict1 == dict2AssertLessassert a < bAssertLessEqualassert a <= bAssertGreaterassert a > bAssertGreaterassert a >= bIdentityAsserterExpressionAssertTrueassert expr is TrueAssertFalseassert expr is FalseAssertIsassert exp1 is exp2AssertIsNotassert exp1 is not exp2AssertIsNoneassert obj is NoneAssertIsNotNoneassert obj is not NoneAssertIsInstanceassert isinstance(obj,class)AssertIsNotInstanceassert not isinstance(obj,class)RegexAsserterExpressionAssertRaisesRegexassert expected_regex in expected_exception_messageAssertWarnsRegexassert expected_regex in expected_warning_messageAssertRegexassert text in expected_regexAssertNotRegexassert text not in expected_regex