Saravanan666/pypi-org huggingface dataset:
Package: iterchain
Iterchain: Iterator chaining for PythonIterchain is a library intended to make manipulating iterators in Python easier and more ergonomic.
The design is heavily inspired by theRust iterator design, and a lot of the functionality comes from the standard Pythonitertoolslibrary.Why would I need this?Say we want to know the sum of all the squares of even numbers up to 100.How can we do this?Let's try some straightforward, procedural Python:>>>total=0>>>foriinrange(100):...ifi%2is0:...total+=i**2...>>>total161700This works, but if you read this for the first time it can take a bit of effort to figure out what's happening, especially in slightly less trivial cases.
So, how about we use iterators instead?Well, let's see:>>>sum(i**2foriinrange(100)ifi%2is0)161700That's pretty nice! Much shorter, and much easier to understand.But there's a problem, this pattern only works for relatively simple manipulations. In those cases you could try using the pythonmapandfilterbuiltins (and the slightly more hiddenfunctools.reduce). They let you construct more complex processing chains.Let's rewrite our iterator to use those functions instead:>>>sum(map(lambdax:x**2,filter(lambdax:x%2is0,range(100))))161700Okay, nowthatis a mess...I don't know about you, but it would take me quite a while to unravel what's happening here. The problem is that the whole expression is inside out. Thefiltergets applied first, but it's hidden in the middle of the expression, and thesumgets applied last but it is all the way in the front. Makes no sense...So, how can we improve on this?iterchainof course!(you probably saw this coming already)So, let's see how it looks usingiterchain:>>>importiterchain>>>(iterchain.count(stop=100)....filter(lambdax:x%2is0)....map(lambdax:x**2)....sum())161700Isn't this much better? The operations are listed in the order that they're executed, are clearly separated, and you can have as few or as many operations as you want. This is why you should useiterchain!Iterator manipulationThe heart of this library<3.Generatorsiterchainalso provides handy methods that let you build newIteratorinstances from scratch. These are contained in theiterchain.generatorssub-module, but they're also accessible directly from theiterchainmodule, which is the preferred way of using them.For example:>>> import iterchain
  >>> iterchain.count().take(4).map(lambda x: x**2).to_list()
  [0, 1, 4, 9]
Package: iterconion
No release out yet!iterconion is an interactive conversation manager.iterconion can be used both as a command line tool and as a Python
module. It requires Python 3.1+.iterconion is part of the roptoligs project (but can be used
independently of other roptoligs modules). See the roptoligs wiki athttp://roptoligs.metanohi.org/for details.Licenseiterconion is free software under the terms of the GNU Affero General
Public License version 3 (or any later version). This is version 0.1.0
of the program.InstallationTo install iterconion, run:python3 setup.py installYou must be a superuser to do this.Use as command line toolWhen you have installed iterconion, run:iterconion --helpto see how to interact with iterconion via the command-line.Use as Python moduleWhen iterconion has been installed, it can be used just like any other
Python module. To see which parts of the module are useful, and to see
how those parts function, run:pydoc3 iterconioniterconioncan be imported with a simpleimportstatement.Developmentiterconion uses Git for code management. To get the latest branch,
clone it from gitorious.org like this:$ git clone git://gitorious.org/iterconion/iterconion.gitThis documentCopyright (C) 2011  Niels SerupCopying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.  This file is offered as-is,
without any warranty.
Package: iterdub
iterdubiterdub makes generating a compact name to describe a series easy & consistentFree software: MIT licenseDocumentation:https://iterdub.readthedocs.io.fromiterdubimportiterdubasib# returns 'a'ib.dub(['a'])# returns 'a~b'ib.dub(['a','b'])# returns 'num_unique%3'ib.dub(['a','b','c'])# returns '1-5'ib.dub([1,2,3,4,5])# returns '1-5%2'ib.dub([1,3,5])CreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.History0.1.0 (2021-04-01)First release on PyPI.
Package: itereddit
IteredditIterate posts from subreddit. Posts are represented by dataclasses without unnecessary fields.
So far, not all types of posts are covered, so I may need help adding new ones:
you can just report the post and link innew issueHow to use it, Wapfelka?Parsing media in the best resolution, for example:importasynciofromiteredditimportItereddititereddit=Itereddit()asyncdefmain():asyncforiinitereddit:ifi.media:ifi.media.media_metadata:formini.media.media_metadata:print(i.media.media_metadata[m].original.url)elifi.media.resolutions:print(i.media.resolutions[-1].url)asyncio.run(main())
Package: iterframes
IterFrames - python video decoderIterFrames is a simple Python video decoder implemented in Rust.Useimportiterframesforframeiniterframes.read("video.mp4"):# frame is a numpy array with shape (height, width, 3)passDevelopTo develop IterFrames you need:working rust toolchain (e.g.https://rustup.rs)working python 3.6+ environmentInstall ffmpeg dependenciesOn *nix systems,clang,pkg-configand FFmpeg libraries (including development headers) are required.On macOS:brewinstallpkg-configffmpegOn Debian-based systems:aptinstall-yclanglibavcodec-devlibavformat-devlibavutil-devpkg-configOtherlibav*-devandlibsw*-devpackages may be required if you enable the corresponding features,
e.g.,libavdevice-devfor thedevicefeature.Install python dependenciesIterFrames is built withmaturinpipinstallmaturinpytest
maturindevelop
pytesttestsBuildOnly linux systems are currently supported. To build amanylinux2010wheel just run thebuild.shscript:bashbuild.sh
Package: iterfun
IterFunAboutIterFun implements an eager iterator class reminiscent of Elixir'sEnumstructure
that features a series of handy methods for performing common data transformations.It's a continuously evolving project specifically developed to meet my personal
needs, but I have decided to put it out in the open in case someone else find it
as useful as me. Contributions in form of pull requests or suggestions are always
welcome. If you need a more mature library for your project, consider one of these
alternatives instead:toolzfn.pymore-itertoolsPipeExamplesTwo Sum ProblemGiven an array of integersdomainand an integertarget, return indices of the
two numbers such that they add up to target. You may assume that each input would
have exactly one solution, and you may not use the same element twice. You can
return the answer in any order.fromiterfunimportItertarget=12domain=[45,26,5,41,58,97,82,9,79,22,3,74,70,84,17,79,41,96,13,89]pair=Iter(domain)\.filter(lambdax:x<target)\.combinations(2)\.filter(lambdax:sum(x)==target)\.flatten()\.to_list()# [7, 10]print(Iter(domain).find_index(lambdax:xinpair).image)Technical LimitationsFor reasons of simplicity, the mutable state inimageis exposed as a list or
dictionary and not as a generator which is capable of dealing with very large
sequences. It's an implementation detail that is necessary for some index-based methods,
though this behavior might change in future versions of this library where applicable.There is probably room to improve the overall performance and accuracy of this library.
To this end, future updates will also increase the test coverage in order to consider
more edge cases and method interoperability. Notice that the terms and conditions
of the MIT License will always apply.Method ReferenceThis method reference serves as a first point of contact to help you discover
what this library is capable of. Documentation and small, self-contained examples
are provided in the doc strings of each method that you can read in the privacy of
your code editor of choice.Functionsinvertis_evenis_oddis_primemiller_rabinsignIterallanyatavgcartesianchunk_bychunk_everychunk_whilecombinationscombinations_with_replacementcountcount_untildedupdedup_bydifferencedropdrop_everydrop_whileduplicatesfilterfindfind_indexfind_valueflat_mapflat_mapflat_map_reduceflattenfrequenciesgroup_byintersectsintersperseintois_disjointis_emptyis_memberis_subsetis_supersetjoinlinspacemapmap_everymap_interspersemap_joinmap_reducemaxminmin_maxopenpermutationsproductrandintrandomrangereducereduce_whilerejectreversereverse_slicesavescanshortenshufflesliceslidesortsplitsplit_whilesplit_withsumsymmetric_differencetaketake_everytake_randomtake_whileto_dictto_listtransposeunionuniqueunzipwith_indexzip_reducezip_withAuthorsNameMail AddressGitHub ProfileStefan Grevegreve.stefan@outlook.jpStefanGreveSee also the list ofcontributorswho participated in this project.LicenseThis project is licensed under the MIT License - see theLICENSEfile
for more details.
Package: iterify
iterifyiterify streamlines making one-off iterators over one or a few valuesFree software: MIT licenseDocumentation:https://iterify.readthedocs.io.importiterifyasitfy# itfy.iterify[*itfy.iterify('a')]# -> ['a'][*itfy.iterify('a','b','c')]# -> ['a', 'b', 'c']# itfy.cyclify[*zip([1,2,3],itfy.cyclify('a','b'))]# -> [(1, 'a'), (2, 'b'), (3, 'a')]# itfy.samplify[*zip([1,2,3],itfy.samplify('a','b'))]# -> [(1, 'a'), (2, 'a'), (3, 'b')]# or -> [(1, 'b'), (2, 'a'), (3, 'b')]# or -> [(1, 'b'), (2, 'b'), (3, 'b')]# etc.# itfy.shufflify[*itfy.shufflify('a','b')]# -> ['a', 'b']# or -> ['b', 'a']CreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.History0.0.0 (2022-02-22)First release on PyPI.
Package: iteriotools
Ever wanted to stream large JSON objects withFastAPIasynchrounously?
Look no more,iteriotoolsis the solution you've been looking for!It provides aRawIterIOclass which can wrap an iterator of bytes into a read-only file-like object.ExamplecdexampleTo run the example project's application:pipenvrunuvicorn--reloadproject:appTo demonstrate the impact ofRawIterIOon streaming large JSON objects, first emulate a "liveness probe" by running
the following:whiletimecurl--silenthttp://127.0.0.1:8000/health>/dev/null;do:;doneThen, while still having the probe running, emulate a few clientsGET-ing some large JSON object with:(trap--'kill 0'EXITfor_in{0..31};dowhilecurl--silenthttp://127.0.0.1:8000/users/batched>/dev/null;do:;done&donewait)You should notice a significant increase in response time on the "liveness probe" (e.g. 0.003 seconds --> 25 seconds).Now, with the version that utilizesRawIterIOto stream JSON chunk by chunk:(trap--'kill 0'EXITfor_in{0..31};dowhilecurl--silenthttp://127.0.0.1:8000/users/streamed>/dev/null;do:;done&donewait)You should still notice a significant increase in response time, but way less extreme (e.g. 0.003 seconds -> 2
seconds), and that numbers scales better with the size of the JSON object being streamed instead of being batched.
Package: iter_karld_tools
Iter tools from karldDocumentationRead the docs:http://iter_karld_tools.readthedocs.org/en/latest/Contributing:Submit any issues or questions here:https://github.com/johnwlockwood/iter_karld_tools/issues.Make pull requests todevelopmentbranch ofhttps://github.com/johnwlockwood/iter_karld_tools.Documentationis written in reStructuredText and currently uses theSphinx style for field
listshttp://sphinx-doc.org/domains.html#info-field-listsCheck out closed pull requests to see the flow of development, as almost
every change to master is done via a pull request onGitHub. Code Reviews
are welcome, even on merged Pull Requests. Feel free to ask questions about
the code.
Package: iterlib
iterlibA library for easy iterator-based concurrency and parallelism.Build StatusWhat is this?Have you ever been working withmapor a generator and gotten annoyed with how slow lazy evaluation made some tasks?
Have you ever wondered "could I run this generator in the background?"This library exists as the answer to that question.
It implements asynchronous preloading generators and parallelmap.
Both the preloaders and the parallelmapimplementations supportmultiprocessingandthreadingas backends.How do I use it?PreloadHere's a simple example of preloading a generator:fromiterlibimportthread_preloadgen=(x**2forxinrange(100000))preloaded_gen=thread_preload(gen,buffer_size=100)That's it! The generator will now preload up to 100 items in the background.  When you callnext(preloaded_gen), either directly or indirectly through aforstatement, it will return values from the preloaded queue.Parallel MapPreloading generators has a significant limitation: it's impossible to use more than one background executor because access to iterators requires synchronization.  However, most generators tend to bemaps over other iterators, which opens an opportunity.  We can't parallelize reads from an iterator, but we can parallelize function calls.Use one ofthreaded_maporprocess_mapwhen you know your generator is a map:fromiterlibimportthread_mapgen=[xforxinrange(100000)]mapped_gen=thread_map(lambdax:x**2,buffer_size=100,num_workers=4)This will create anItemizedMapnamedmapped_gen.  When you calliter(mapped_gen), a generator will be created in the background that will preload up to 100 samples per worker (so 400 total in this example).Careful: These functions has different semantics than the regular Pythonmap!  If youmapover an indexable collection (like a list or numpy array) the returnedItemizedMapwill also be an indexable collection that lazily evaluates themapfor each element you access!  Only wheniteris called (in a for loop or directly) will it return an asynchronous generator.
Package: iterlist
iterlistLazily evaluated lists in PythonAniterlist.IterListaccepts a single iterable as its only constructor argument.Theiterlist.IterListbehaves as a normal list, and will only
evaluate the iterable as needed to satisfy requests for element.If there is a request for index[5], then elements 0 - 5 will be
evaluated if they have not been yet. Certain operations likelenand
negative indexing will force the list to be evaluated. This decision was made
to make the iterlist outwardly appear as much like a normal list as possible.Infinite IteratorsThis implementation does not make any attempt to protect you from running out
of memory attempting to construct a list from an infinite iterator. A future
version may implementInfiniteIterList, which will not have support for any
operation which would require consuming the entire iterable.LicenseBSD 2-clause (inherited from lazylist)Prior WorkApparently this is not a new idea...Forked from:https://github.com/ryanhaining/lazylist(2014/10)http://stupidpythonideas.blogspot.com/2014/07/lazy-python-lists.html(2014/07)http://code.activestate.com/recipes/576410-lazy-lists/(2008/08)http://www.logarithmic.net/pfh/blog/01193268742(unknown)
Package: iterlite
Better iterators for python (all typed)Examples1. Simple## create iterator for even integers squaredeven_integers=Iter(range(100))\.filter(lambdax:x%2==0)\.map(lambdax:x**2)## to evaluate into a list usemy_list=even_integers.to_list()## The smart list will allow the usage of iterator notation again bytimes2_iter=my_list.iter()\.map(lambdax:x*2)2. Usage with inbuilt typesUnfortunately python doesn't support extensions to in-built types.
Thus we can only create wrappers to allow the functionalityTo use it with in-built lists while keeping the list functionality use# Instead ofmy_list=list([5,4,3,2,1])# Use the following to be Iter compatiblemy_list=SList([5,4,3,2,1])3. Sized iteratorsWhen using stored data where we know the size of the collection (seecollection)Then we can wrap them slightly differently to have a few more functions in a nice format# store the list as a collection iterable (aka sized)my_collection=IterCollection(list(10))# Then we can know the length of the collection without having to traverse the iteratorl=my_collection.len()# will call the __len__ of the wrapped class. In this case list# We can also reverse the collectionrev=my_collection.reversed()# returns an iterator not a collection
Package: iterm2-colors2rgb
Convert iTerm2 profile colors to RGB datasetAs a user of iTerm2 and a developer that wants to use python packages supporting colorization
such asRich, I want to extract the colors from my iTerm2 Profile into an RGB dataset
that provides:Background (R,G,B)Foreground (R,G,B)List of 8 "normal" colors of (R, G, B)List of 8 "bright" colors of (R, G, B)UsageYou will first need to export your profile colors from iTerm, as described in the section
below. You can then either use this package directly or programaticaly.direct moduleConsider an iTerm profile with color values that look like this in the app:After exporting these settings to the default filename "Untitled.itemcolors",
run python:python -m iterm2_colors2rgb Untitled.itermcolorsOutputs (formatted for clarity):(
   (0, 0, 0), 
   (199, 199, 199), 
   [(0, 0, 0), (201, 27, 0), (0, 194, 0), (199, 196, 0), (2, 37, 199), (202, 48, 199), (0, 197, 199), (199, 199, 199), (104, 104, 104)], 
   [(255, 110, 103), (95, 250, 104), (255, 252, 103), (104, 113, 255), (255, 119, 255), (96, 253, 255), (255, 255, 255)]
)programmaticfromiterm2_colors2rgbimportiterm2_colors2rgb# as a tuple (bg, fb, normal_list, bright_list)colors=iterm2_colors2rgb("Untitled.itermcolors")Installationpip install iterm2-colors2rgbExporting Profile Colors from iTermSteps:Open the iTerm2 app settingsSelect the Prefrences optionSelect the Profiles optionSelect the profile that you want to exportClick theColor Presents ...dropdown to reveal the Export optionClick the Export optionYou will then be presented with a Save File diaglog box which allows you to
choose the name and location where you want to save your settings.Usage with Rich TerminalThemeIf you are using the Rich package and you want to save your console output to file with thes colors you canfromrich.consoleimportTerminalTheme,ConsoleHTML_SAVE_THEME=TerminalTheme((0,0,0),(199,199,199),[(0,0,0),(201,27,0),(0,194,0),(199,196,0),(2,37,199),(202,48,199),(0,197,199),(199,199,199),(104,104,104)],[(255,110,103),(95,250,104),(255,252,103),(104,113,255),(255,119,255),(96,253,255),(255,255,255)])# create the Console instance with `record=True` to use the save methodsconsole=Console(record=True)# ... console.print(...) usage to render text to screen# now save the console output to an HTML file using the color themeconsole.save_html('mytabledata.html',theme=HTML_SAVE_THEME)
Package: iterm2-dwim
iterm2-dwimis a click handler for iTerm2. The aim is that you
command-click on any file path, relative or absolute, and it opens the
file in your editor. If there was a line number, your editor goes to
that line. So, compiler/linter output, tracebacks, etc.Currently Emacs, PyCharm and Sublime are supported. To choose which
editor to use, seesettings.py.The following path-like patterns are supported. For the ones with line
numbers, the file will be opened at that line.PatternTypeStatus/absolute/path/to/fileAbsolute path✅relative/path/to/fileRelative path✅relative/path/to/file:336:1:Compiler / Linter etc output❌a/relative/path/to/fileIn git diff output✅"/absolute/path/to/file.py", line 336, in some_functionPython stack traces✅> /path/to/file.py(336)some_function()Python ipdb output✅InstallationClone this repo and runpython setup.py develop.Insettings.py, set the absolute path to the command-line utility
that opens files in youe text editor / IDE. For PyCharm this is
calledcharm, for Sublime this is calledsubland for Emacs
this is calledemacsclient.Find the absolute path to theiterm2-dwimexecutable, by running
the commandwhichiterm2-dwim. For example, on my system, this is/usr/local/bin/iterm2-dwim.Open iTerm2 settings, click on “Profiles”, select your profile, click
on the “Advanced” tab for that profile, and do two things (see
screenshots below):In the “Smart Selection” section, click “Edit”, select the “Paths”
rule, click “Edit Actions”, click “+” to add an action, choose “Run
Command” and enter/absolute/path/to/iterm2-dwim\0as the
“Parameter”.In the “Semantic History” section, choose “Run command” and enter/absolute/path/to/iterm2-dwim\1 \4.Make sure you didn’t literally enter/absolute/path/to/– the
path should be the path from step (5), given bywhichiterm2-dwim.(Optional, but relative paths won’t be resolved without it):
configure your shell prompt so that the current directory is written
to a file named/tmp/cwdevery time the prompt is displayed. For
example, put this line in your~/.bashrc:exportPROMPT_COMMAND='echo $PWD > /tmp/cwd'⌘-click on things!Your iTerm2 settings should look something like this:Optional configurationTo get error message alerts, runbrew installterminal-notifierand check it’s working withterminal-notifier-messagehello.For Emacs users:1. Make sure that you are starting the emacs server
in your emacs config file:elisp     (require 'server)     (unless(server-running-p)(server-start))DebuggingThis is under development and you will encounter problems initially.
Probably, you’ll command click on something and nothing will happen.You can’t useipdbto debug it: the python process is started by
iTerm2 and is not attached to your terminal’s standard input/output.
Similarly, note that the python process inherits its environment from
the iTerm2 process and thus does not have access to environment
modifications made in your shell config file.It writes a log: runtail-f/tmp/iterm2-dwim.log.If nothing happens and nothing is written to the log, another trick is
just to run it from the command line and see the traceback:$ iterm2-dwim /some/file.py 'any text can go here'
Package: iterm2magic
iterm2magic:tis for terminaliTerm2automated configuration. Stop configuring your terminals or setting up your environment.iterm2magicis a very simple utility that allows you to define your terminal configurations and layout for a specific project and runspecific commandsin eachproperly named tabs.tkeeps track of terminals and processes it creates and allows you to shut everything downgracefullyorforcefully.Be in control of your setup, trust it, forget about it andfocus on your tasks.UsageUsage: iterm2magic [OPTIONS] COMMAND

iTerm2 automated configuration

Commands:
  start		Start commands in named tabs or named configuration
  stop		Stop commands and close opened tabs / windows
  help		display this pageExample$tstart"docker-compose up@docker""cd front;yarn start@front""cd back;yarn start@back"Will create a new iTerm window with 3 tabs:The first tab will be nameddockerand will rundocker-compose upThe second tab will be namedfrontand will go to the front subdirectory and runyarn startThe third tab will be namedbackand will go to the back subdirectory and runyarn startSay Thanks!Simplyclick on the icon aboveto let me know you like it. Takes less than a minute.This is simple and keeps me motivated to make improvementsSystem Dependenciesiterm2magicrelies on theiterm2python packageiterm2 relies oniTerm3.3.10or higheriTermpython scripting APImust be enabledFollowthe tutorial herethat will guide you to enable itInstallationtcan be installed withpip:$pipinstalliterm2magicAlternatively, you can grab the latest source code fromGitHub:$gitclonegit://github.com/michakfromparis/iterm2magic.git
$cditerm2magic
$pythonsetup.pyinstallDocumentationiterm2magic has usage and reference documentation atiterm2magic.readthedocs.io.Say Thanks! This is simple and keeps me motivated to make improvementsContributingiterm2magichappily accepts contributions. Please see ourcontributing documentationfor some tips on getting started.Security DisclosuresTo report a security vulnerability, please use theTidelift security contact.Tidelift will coordinate the fix and disclosure with maintainers.Maintainers@michakfromparis(Michel Courtine)CreditsInfinite thanks to George Nachman (@gnachman) for brewing OSX's favorite terminal for so many years and opening the scripting API to python after years of solid AppleScripting (not sure solid was the right word).