Saravanan666/pypi-org huggingface dataset:
Package: iter2
# iter2This library provides implementation of[rich-iterator](http://code.activestate.com/recipes/498272-rich-iterator-wrapper/)concept, inspired by[Rust's std::iter::Iterator](https://doc.rust-lang.org/std/iter/trait.Iterator.html),[Java's Stream](https://docs.oracle.com/javase/8/docs/api/?java/util/stream/Stream.html)and [more-itertools library](https://more-itertools.readthedocs.io/en/latest/).##  UsageThe main object of library is `iter2`. It behaves like built-in`iter` except that it creates an instance of rich-iterator.```pythoniter2(['dzen', 'of', 'python']).map(str.capitalize).join(' ')  # 'Dzen Of Python'```> **Every** method of rich-iterator that returns new iterator makes original rich-iterator **invalid**, so it> **cannot be used** in any iteration process. This behaviour can be bypassed with `ref` method.Original iterator can be retrieved with `raw` method:```pythonorig = iter2.range(5).raw()tuple(orig)  # (0, 1, 2, 3, 4)````iter2` has some methods to build sequences of values:```pythoniter2.of('a', 'b', 'cde').join()  # 'abcde'iter2.range(5).map(str).join()  # '01234'iter2.count_from(100).take(5).map(str).join('->')  # '100->101->102->103->104'iter2.numeric_range(1.0, 3.5, 0.3).to_tuple()  # (1.0, 1.3, 1.6, 1.9, 2.2, 2.5, 2.8, 3.1, 3.4)# and some other ...```and some algorithm-methods on multiple iterables:```pythoniter2.cartesian_product(range(2), repeat=2).to_tuple()  # ((0, 0), (0, 1), (1, 0), (1, 1))iter2.zip_longest(range(3), range(1, 5), fillvalue=-1).to_tuple()  # ((0, 1), (1, 2), (2, 3), (-1, 4))iter2.chain(['Somewhere', 'over'], ['the', 'Rainbow']).join(' ')  # 'Somewhere over the Rainbow# and some other ...```### ComparisonHere are some examples of usage compared with builtins-and-itertools-basedimplementations:```pythonfrom itertools import islicefrom functools import reduceimport operatorfrom iter2 import iter2square = lambda x: x ** 2odd = lambda x: x % 2 == 1def fibonacci():a = b = 1while True:yield aa, b = b, a + b# Example 1:cool_song = 'Somewhere over the Rainbow'# "from `cool_song` take capital characters and join them with '+'"iter2(cool_song).filter(str.isupper).join('+')# vs# "with '+' join capital characters from `cool_song`"'+'.join(filter(str.isupper, cool_song))# Example 2:# "for values in 0..99 take squares of them that are odd and sum them" (sounds like algo)iter2.range(100).map(square).filter(odd).sum()# vs# "sum values that are odd that are squares of values in 0..99" (sounds like shit)sum(filter(odd, map(square, range(100))))# "sum squares of values in 0..99 that are odd"sum(x ** 2 for x in range(100) if x % 2 == 1) # luckily, oddity doesn't change on squaring# Example 3: "Playing with infinite sequences"(iter2(fibonacci()).drop(10).filter(odd).map(square).take(5).product())  # shortcut for `.fold(operator.mul)`# vsreduce(operator.mul,islice(map(square, filter(odd, islice(fibonacci(), 10, None))), 5))  # (counting braces balance and commas positions)# (to make clearer):reduce(operator.mul,islice(map(square,filter(odd,islice(fibonacci(), 10, None))),5)) # or not?```##Changelog####v1.1- Tuple-wise methods#### v1.0- Initial
Package: iterable-api
Iterable APIThis is a mostly complete wrapper of the Iterable API built with Python.The interface is still in a state of flux, some methods will be renamed but the signatures should stay the same.User DocsThis is a pure python development kit for interacting with the Iterable API. If you find anything to be out of date or are looking for support, you can file an issue on Github.InstallationYou can download and install the package from the Python Package Index with:pip install iterable-apiQuickstartfromiterableimportIterableapi=Iterable('YOUR_API_KEY')api.events.track(event_name='hello_iterable',user_id=42,created_at=datetime.now().to_timestamp())If you're familiar with environment variables, you can setITERABLE_API_KEY. In that case you can set up the api client like so:fromosimportgetenvfromiterableimportIterableapi=Iterable(getenv('ITERABLE_API_KEY'))Data exportsIf you're interested in getting data out of your Iterable account, you can use theexport_data_apimethod on the API client.Dropping downThe API client is a requests.Session under the hood with HTTP method names as top level functions in the wrapper.If you want to drop down to the client, you only need to provide the resource path, e.g.:api.get('/events/track')This might be useful for exploring the API or debugging an issue.Development DocsIf you're interested in extending this library, please follow these guidelines:Please file an issue first describing what you want to add or change.Fork the repository and submit a pull request.Installation for developmentThis project uses poetry for now, so follow your preferred procedure for that.poetry installTestingThe library uses pytest - you can run the tests by invoking the following:poetryrunpytest
Package: iterable-etl
iterable_etlDEPRECATEDReplicate data from iterable in databricksUsageCLIpython-miterable_etl--table<table-name>where  is one of the following:campaign_history,campaign_metrics,campaign_list_history,list, orALL.APIfromiterable_etl.tables.campaign_historyimportcampaign_history_dffromiterable_etl.tables.campaign_metricsimportcampaign_metrics_dffromiterable_etl.tables.listimportlist_dffromiterable_etl.tables.campaign_list_historyimportcampaign_list_history_dfcampaign_history_df()campaign_metrics_df()list_df()campaign_list_history_df()Further configs are set via environment variables:ITERABLE_KEY: API accessAPP_ENV: <development/production> - debug modeSAMPLE_OUTPUT: <True/False> - Save dataframes to csvDEVCreate venvpython-mvenvenvActivate venvunixsourceenv/bin/activatewindowsenv\Scripts\activate.batInstall Packagespipinstall-rrequirements.txtTestmaketestFormatmakeformatmakelintVersion & Releasebump2version<major/minor/patch>makereleasenoteDon't forget togit pushwith--tagspre-commitSetuppre-commitinstallRun allmakepre-commit
Package: iterable-io
iterable-ioiterable-iois a small Python library that provides an adapter so that it's possible to read fromiterableobjects in the same way asfile-likeobjects.It is primarily useful as "glue" between two incompatible interfaces. As an example, in the case
where one interface expects a file-like object to call.read()on, and the other only provides a
generator of bytes.One way to solve this issue would be to write all the bytes in the generator to a temporary file,
then provide that file instead, but if the generator produces a large amount of data then this is
both slow to start, and resource-intensive.This library allows streaming data between these two incompatible interfaces so as data is requested
by.read(), it's pulled from the iterable. This keeps resource usage low and removes the startup
delay.Installationpip install iterable-ioDocumentationThe functionality of this library is accessed via a single function:open_iterable().open_iterable()is designed to work the same was as the builtinopen(), except that it takes an
iterable to "open" instead of a file. For example, it can open the iterable in binary or text mode,
has options for buffering, encoding, etc. See the docstring ofopen_iterablefor more detailed
documentation.Simple examplesThe following examples should be enough to understand in which casesopen_iterable()would be
useful and get a high-level understanding of how to use it:Read bytes from a generator of bytes:gen=generate_bytes()# adapt the generator to a file-like object in binary mode# (fp.read() will return bytes)fp=open_iterable(gen,"rb")whilechunk:=fp.read(4096):process_chunk(chunk)Read lines of text from a generator of bytes:gen=generate_bytes()# adapt the generator to a file-like object in text mode# (fp.read() will return a string, fp.readline is also available)fp=open_iterable(gen,"rt",encoding="utf-8")forlineinfp:process_line_of_text(line)TestsThis package contains extensive tests. To run them, installpytest(pip install pytest) and runpy.testin the project directory.LicenseLicensed under theGNU LGPLv3.
Package: iterables-decorator
Iterable decoratorCreate iterable classes using a class decorator.Values added to an iterable class are sored in the class'sself.argsattribute as atupleof whatever type you have provided.Examplesfromiterablesimportiterable@iterableclassItems:# You can type annotate your iterable like so:item:str# Note that this has no real effect on the generation of the iterable.items=Items("Hello","iterables!")foriteminitems:print(item)>>>"Hello">>>"iterables!"You can attach additional methods to an iterable as you would with a dataclass.fromiterablesimportiterable@iterableclassItems:item:str@classmethoddeffrom_list(data:list[str]):returncls(*data)
Package: iterable-serialization
iterable-serializationSerialization/deserialization of iterables of typestr.This package aims to be a better version of:serialized="|".join(("a","b","c"))print(serialized)# a|b|cdeserialized=serialized.split("|")print(deserialized)# ['a', 'b', 'c']It makes it possible to serialize/deserialize an iterable with occurring symbols as separator:serialized=serialize_iterable(("a","b","c"),"a")print(serialized)# aabacdeserialized=deserialize_iterable(serialized,"a")print(list(deserialized))# ['a', 'b', 'c']With the version above, it would result in a wrong deserialization result:serialized="a".join(("a","b","c"))print(serialized)# aabacdeserialized=serialized.split("a")print(list(deserialized))# ['', '', 'b', 'c']Installationpipenvinstall-egit+https://github.com/stefantaubert/iterable-serialization.git@master#egg=iterable_serializationUsagefromiterable_serializationimportdeserialize_iterable,serialize_iterableserialized=serialize_iterable(("a","b","c"),"a")print(serialized)# aabacdeserialized=deserialize_iterable(serialized,"a")print(list(deserialized))# ['a', 'b', 'c']
Package: iterable-subprocess
iterable-subprocessPython context manager to communicate with a subprocess using iterables. This offers a higher level interface to subprocesses than Python's built-in subprocess module, and is particularly helpful when data won't fit in memory and has to be streamed.This also allows an external subprocess to be naturally placed in a chain of iterables as part of a data processing pipeline.Installationpipinstalliterable-subprocessUsageA single context manageriterable_subprocessis exposed. The first parameter is theargsargument passed to thePopen Constructor, and the second is an iterable whose items must bebytesinstances and are sent to the subprocess's standard input.Returned from the function is an iterable whose items arebytesinstances of the process's standard output.fromiterable_subprocessimportiterable_subprocess# In a real case could be a generator function that reads from the filesystem or the networkiterable_of_bytes=(b'first\n',b'second\n',b'third\n',)withiterable_subprocess(['cat'],iterable_of_bytes)asoutput:forchunkinoutput:print(chunk)ExceptionsPython'ssubprocess.Popenis used to start the process, and any exceptions it raises are propagated without transformation. For example, if the subprocess can't be found, then aFileNotFoundErroris raised.If the process starts, but exits with a non-zero return code, then aniterable_subprocess.IterableSubprocessErrorexception will be raised with two members:returncode- the return code of the processstderr- the final 65536 bytes of the standard error of the processHowever, if the process starts, but an exception is raised from inside the context or from the source iterable, then this exception is propagated, even if the process subsequently exits with a non-zero return code.Example: unzip the first file of a ZIP archive while downloadingIt's possible to download the bytes of a ZIP file in Python, and unzip by passing the bytes tofunzip, as in the following example.importhttpxfromiterable_subprocessimportiterable_subprocesswith\httpx.stream('GET','https://www.example.com/my.zip')asr,\iterable_subprocess(['funzip'],r.iter_bytes())asunzipped_chunks:forchunkinunzipped_chunks:print(chunk)Note that it's also possible to stream unzip files without resorting to another process usingstream-unzip.Example: download file using curl and process in PythonYou would usually download directly from Python, but as an example, you can download using the curl executable and process its output in Python.fromiterable_subprocessimportiterable_subprocessurl='https://data.api.trade.gov.uk/v1/datasets/uk-tariff-2021-01-01/versions/v3.0.212/tables/measures-on-declarable-commodities/data?format=csv'withiterable_subprocess(['curl','--no-progress-meter','--fail-with-body',url],())asoutput:forchunkinoutput:print(chunk)
Package: iterage
# iteragetoolset for python iterators and generators## iterator operationsDocumentation ofiteragefunctions and python standard library functions
for do things with iterators and generators.### reduce#### any / iterage.reduce.ianyTo check if at least one element is true, use theanybuilt-in function:any([True,  False, False]) # -> True
any([False, False, False]) # -> Falsel = [0, 1, 14]
any(x > 10 for x in l) # -> True
any(x < 0 for x in l)  # -> False# iterage
iterage.reduce.iany(l, lambda x: x > 10) # -> True#### all / iterage.reduce.iallTo check if all elements are true:all([True, True, True])  # -> True
all([True, False, True]) # -> Falsel = [0, 1, 14]
any(x >= 0 for x in l) # -> True
any(x < 0 for x in l)  # -> False# iterage
iterage.reduce.iall(l, lambda x: x >= 0) # -> True#### not any / iterage.reduce.inoneTo check if no element is true:not any([False, False, False]) # -> True
not any([True,  False, True])  # -> Falsel = [0, 1, 14]
not any(x >= 0 for x in l) # -> False
not any(x < 0 for x in l)  # -> True# iterage
iterage.reduce.inone(x < 0 for x in l) # -> True#### iterage.reduce.iemptyCheck if iterable is empty:iterage.reduce.iempty(x < 0 for x in [0,1,2,3]) # -> True
iterage.reduce.iempty(x > 1 for x in [0,1,2,3]) # -> False#### iterage.reduce.icountCount elements:iterage.reduce.icount(range(4)) # -> 4#### iterage.reduce.icount_ifCount true elements:iterage.reduce.count_if([True, False, False]) # -> 1iterage.reduce.count_if(x > 1 for x in [0,1,2,3]) # -> 2# alternative
sum(1 for x in [0,1,2,3] if x > 1) # -> 2
iterage.reduce.icount(x for x in [0,1,2,3] if x > 1) # -> 2## similar toolshttps://github.com/pytoolz/toolz/blob/master/toolz/itertoolz.pyhttps://pypi.python.org/pypi/more-itertools/
Package: iterapi
iterapiPython API to Student's Campus portal of ITERInstallationpip install iterapiorpip3 install iterapiUsageExamplefromiterapiimportStudentst=Student('regdno','password')# Login to the portalst.getInfo()# returns a dictionary containing student detailsst.getPhoto()# writes photo as registration_no.jpgst.getAttendance()# returns a dictionary containing attendancest.getResult()# returns a dictionary containing resultsst.getDetailedResult(sem_no)# returns a dictionary containing details of a semester resultst.downloadSemResult(sem_no)# writes result document as registrationno_sem_no.pdf
Package: iteratedc
iteratedc - A small python iterator for python 3 dataclassesiteratedcis a small library used to iterate over python 3 dataclasses. It will not only traverse the low level, but will create the a tree-search diving down collections of dataclasses as well. If on each level, a dataclass is present it will follow these child nodes one level down.You can choose between four operation modes:BFS (Breadth first search)DFS (Depth first search)Pre-OrderIn-OrderPost-OrderReverse Pre-OrderReverse Post-OrderThe result will not be the current node but a NodeElement carrying the current node.TheseNodeElements accept visitors according to the visitor pattern.LicensingThis library is published under BSD-3-Clause license.VersioningThis library follows semantic versioning 2.0. Any breaking change will produce a new major release. Versions below 1.0 are considered to have a unstable interface.
Package: iteration-utilities
Utilities based on Pythons iterators and generators.The full list of functions and classes included in this package:accumulateall_distinctall_equalall_isinstanceall_monotonealways_iterableany_isinstanceapplyfuncargmaxargminargsortedchainedclampcombinations_from_relationscomplementconstantconsumecount_itemsdeepflattendotproductdoubleduplicatesemptyfirstflattenflipgetitemgroupedbygrouperInfiniteIterableinsertintersperseipartitionis_evenis_iterableis_Noneis_not_Noneis_oddItemIdxKeyiter_exceptIterableitersubclasseslastManyIterablesmergeminmaxncyclesnthnth_combinationonepackedpadpartialpartitionPlaceholderpowersetraddrandom_combinationrandom_permutationrandom_productrdivreciprocalremoverepeatfuncreplacereplicatereturn_calledreturn_Falsereturn_first_argreturn_identityreturn_Nonereturn_TruerfdivrmodrmulroundrobinrpowrsubsecondSeensideeffectssplitsquarestarfiltersuccessivetabulatetailtee_lookaheadthirdunique_everseenunique_justseenBut also some convenience classes providing a lazy and chainable interface for
function evaluation:IterableInfiniteIterableManyIterablesDocumentationDownloadsTest status
Package: iterative-ensemble-smoother
Iterative Ensemble SmootherAboutiterative_ensemble_smootheris a Python package that implements the subspace iterative ensemble smoother as described inevensen2019.
This algorithm is particularly effective for problems with a large number of parameters (e.g., millions) and a few realizations or samples (e.g., hundreds).Installationiterative_ensemble_smootheris on PyPi and can be installed using pip:pip install iterative_ensemble_smootherIf you want to do development, then run:git clone https://github.com/equinor/iterative_ensemble_smoother.git
cd iterative_ensemble_smoother
<create environment>
pip install --editable '.[doc,dev]'Usageiterative_ensemble_smoothermainly implements the two classesSIESandESMDA.
Check out the examples section to see how to use them.Building the documentationaptinstallpandoc# Pandoc is required to build the documentation.pipinstall.[doc]sphinx-build-cdocs/source/-bhtmldocs/source/docs/build/html/Releasing a new versionCreate a tag, e.g.git tag -a v1.0.0 -m "A short note" cf2c87270d3locally on the commit.Push the tag, e.g.git push upstream v1.0.0.Create a release on the GitHub GUI.
Package: iterativerecursion
iterativerecursionPython3 module to simulate recursion with iteration.This is a module I've done because I need something like this and
in part as a little experiment.InstallationInstall with pippip3 install -U iterativerecursionUsagefrom iterativerecursion import FunctionReturn
from iterativerecursion import IterativeRecursionEngine


def func_1_to_test(a: int) -> FunctionReturn:
    """
    Print a number.
    :param a: int: Number to print.

    """
    print(f"a: {a}")
    return dict(
        call_arg_n_func=dict(b="global_a"),
        next_function_to_call="func_2_to_test",
        returned_values=dict(global_a=a + 1)
        )


def func_2_to_test(b: int) -> FunctionReturn:
    """
    Print a number.
    :param b: int: Number to print.

    """
    print("b", b)
    return dict(
        call_arg_n_func=dict(),
        next_function_to_call=None,
        returned_values=dict()
        )


executor = IterativeRecursionEngine()
executor.add_function(func_1_to_test)
executor.add_function(func_2_to_test)
executor.start_function_caller(
    next_function_to_call="func_1_to_test",
    enviroment_variables=dict(test_var=2),
    call_arg_n_func=dict(a="test_var")
    )Output:a: 2
b 3Be careful with infinite loops:from iterativerecursion import FunctionReturn
from iterativerecursion import IterativeRecursionEngine


def func_1_to_test(a: int) -> FunctionReturn:
    """
    Print a number.
    :param a: int: Number to print.

    """
    print(f"a: {a}")
    return dict(
        call_arg_n_func=dict(a="global_a"),
        next_function_to_call="func_1_to_test",
        returned_values=dict(global_a=a + 1)
        )


executor = IterativeRecursionEngine()
executor.add_function(func_1_to_test)
executor.start_function_caller(
    next_function_to_call="func_1_to_test",
    enviroment_variables=dict(test_var=0),
    call_arg_n_func=dict(a="test_var")
    )Output:a: 0
a: 1
a: 2
...Import types used on this module:from iterativerecursion import FunctionReturn, VarsDict
Package: iterative-stratification
This iterative-stratification project offers implementations of MultilabelStratifiedKFold, MultilabelRepeatedStratifiedKFold, and MultilabelStratifiedShuffleSplit with a base algorithm for stratifying multilabel data described in the following paper: Sechidis K., Tsoumakas G., Vlahavas I. (2011) On the Stratification of Multi-Label Data. In: Gunopulos D., Hofmann T., Malerba D., Vazirgiannis M. (eds) Machine Learning and Knowledge Discovery in Databases. ECML PKDD 2011. Lecture Notes in Computer Science, vol 6913. Springer, Berlin, Heidelberg.
Package: iterative-telemetry
Featurescan be disabled in all tools by settingITERATIVE_DO_NOT_TRACK=1env varsingle anonymiseduser_idacross alliterativeprojectscollects minimal amount of anonymised data. For example:{"tool_name":"dvc","tool_version":"2.14.0","user_id":"e798d2e2-8941-4f24-a868-3adcbf6467df","os_name":"mac","os_version":"12.3",}RequirementsTODOInstallationYou can installIterative TelemetryviapipfromPyPI:$pipinstalliterative-telemetryUsageContributingContributions are very welcome.
To learn more, see theContributor Guide.LicenseDistributed under the terms of theApache 2.0 license,Iterative Telemetryis free and open source software.IssuesIf you encounter any problems,
pleasefile an issuealong with a detailed description.
Package: iterators
Available atPyPiProvides a wrapper class TimeoutIterator to add timeout feature to normal iteratorsInstallation:pip install iteratorsSee help of TimeoutIterator for all the features. Check tests for examples on how to use TimeoutIterator.
See example tests below for basic  usageExample:TimeoutIterator works like normal iterator:from iterators import TimeoutIterator

def iter_simple():
    yield 1
    yield 2

def test_normal_iteration(self):
    i = iter_simple()
    it = TimeoutIterator(i)

    self.assertEqual(next(it), 1)
    self.assertEqual(next(it), 2)

    self.assertRaises(StopIteration, next, it)
    self.assertRaises(StopIteration, next, it)When timeout is needed, use like thisdef iter_with_sleep():
    yield 1
    time.sleep(0.6)
    yield 2
    time.sleep(0.4)
    yield 3

def test_fixed_timeout(self):
    i = iter_with_sleep()
    it = TimeoutIterator(i, timeout=0.5)
    self.assertEqual(next(it), 1)
    self.assertEqual(next(it), it.get_sentinel())
    
    self.assertEqual(next(it), 2)
    self.assertEqual(next(it), 3)
    self.assertRaises(StopIteration, next, it)Dynamic timeout adjustmentdef iter_with_sleep():
    yield 1
    time.sleep(0.6)
    yield 2
    time.sleep(0.4)
    yield 3

def test_timeout_update(self):
    i = iter_with_sleep()
    it = TimeoutIterator(i, timeout=0.5)
    self.assertEqual(next(it), 1)
    self.assertEqual(next(it), it.get_sentinel())
    
    it.set_timeout(0.3)
    self.assertEqual(next(it), 2)
    self.assertEqual(next(it), it.get_sentinel())

    self.assertEqual(next(it), 3)
    self.assertRaises(StopIteration, next, it)Run unit tests locally:python -m unittest discover tests