Saravanan666/pypi-org huggingface dataset:
Package: asttokens
Theasttokensmodule annotates Python abstract syntax trees (ASTs) with the positions of tokens
and text in the source code that generated them.It makes it possible for tools that work with logical AST nodes to find the particular text that
resulted in those nodes, for example for automated refactoring or highlighting.Installationasttokens is available on PyPI:https://pypi.python.org/pypi/asttokens/:pip install asttokensThe code is on GitHub:https://github.com/gristlabs/asttokens.The API Reference is here:http://asttokens.readthedocs.io/en/latest/api-index.html.UsageASTTokens works with both Python2 and Python3.ASTTokens can annotate both trees built byast,
AND those built byastroid.Here’s an example:importasttokens,astsource="Robot('blue').walk(steps=10*n)"atok=asttokens.ASTTokens(source,parse=True)Once the tree has been marked, nodes get.first_token,.last_tokenattributes, and
theASTTokensobject offers helpful methods:attr_node=next(nforninast.walk(atok.tree)ifisinstance(n,ast.Attribute))print(atok.get_text(attr_node))start,end=attr_node.last_token.startpos,attr_node.last_token.endposprint(atok.text[:start]+'RUN'+atok.text[end:])Which produces this output:Robot('blue').walk
Robot('blue').RUN(steps=10*n)TheASTTokensobject also offers methods to walk and search the list of tokens that make up
the code (or a particular AST node), which is more useful and powerful than dealing with the text
directly.ContributeTo contribute:Fork this repository, and clone your fork.Install the package with test dependencies (ideally in a virtualenv) with:pip install -e '.[test]'Run tests in your current interpreter with the commandpytestorpython-mpytest.Run tests across all supported interpreters with thetoxcommand. You will need to have the interpreters installed separately. We recommendpyenvfor that. Usetox-pautoto run the tests in parallel.By default certain tests which take a very long time to run are skipped, but they are run on travis CI. To run them locally, set the environment variableASTTOKENS_SLOW_TESTS. For example runASTTOKENS_SLOW_TESTS=1 toxto run the full suite of tests.
Package: ast-toolbox
Adaptive Stress Testing Toolboxv2020.09.01.7.OverviewA toolbox for worst-case validation of autonomous policies.Adaptive Stress Testing is a worst-case validation method for autonomous policies. This toolbox is being actively developed by the Stanford Intelligent Systems Lab.Seehttps://ast-toolbox.readthedocs.io/en/latest/for documentation.Maintained by theStanford Intelligent Systems Lab (SISL)Free software: MIT licenseInstallationPip Installation MethodYou can install the latest stable release from pypi:pip install ast-toolboxYou can also install the latest version with:pip install git+https://github.com/sisl/AdaptiveStressTestingToolbox.git@masterUsing the Go-Explore work requires having a Berkely DB installation findable on your system. If you are on Linux:sudo apt-get update
sudo apt install libdb-dev python3-bsddb3If you are on OSX:brew install berkeley-db
export BERKELEYDB_DIR=$(brew --cellar)/berkeley-db/5.3
export YES_I_HAVE_THE_RIGHT_TO_USE_THIS_BERKELEY_DB_VERSION=1Once you have the Berkeley DB system dependency met, you can install the toolbox:pip install ast-toolbox[ge]Git Installation MethodIf you are interested in development, you should clone the repo. You can use https:git clone https://github.com/sisl/AdaptiveStressTestingToolbox.gitYou can also use ssh:git clone git@github.com:sisl/AdaptiveStressTestingToolbox.gitIf you are on Linux, use the following commands to setup the Toolbox:cd AdaptiveStressTestingToolbox
git submodule update --init --recursive
sudo chmod a+x scripts/install_all.sh
sudo scripts/install_all.sh
source scripts/setup.shDocumentationYou can find ourdocumentationon readthedocs.DevelopmentPlease see ourContributions Guide.AcknowledgementsBuilt using thecookiecutter-pylibraryby Ionel Cristian MărieșChangelog2020.06.01.dev1 (2020-05-17)First release on PyPI.2020.09.01.dev1 (2020-09-01)Update documentation.Added docstrings and full apidocs.Fix for Backward Algorithm.Separate the toy AV simulator from the AST wrapper.Change AST environments to save the cloned sim state from pre-action, not post-action.Add travis deployment to PyPI.Removal of unsupported files.Expanded codecov to 90+%.
Package: ast-torch
ASTImplementation of AST from the paper: "AST: Audio Spectrogram Transformer' in PyTorch and Zeta. In this implementation we basically take an 2d input tensor representing audio -> then patchify it -> linear proj -> then position embeddings -> then attention and feedforward in a loop for layers. Please Join Agora and tag me if this could be improved in any capacity.Installpip3 install ast-torchUsageimporttorchfromast_torch.modelimportASTransformer# Create dummy datax=torch.randn(2,16)# Initialize modelmodel=ASTransformer(dim=4,seqlen=16,dim_head=4,heads=4,depth=2,patch_size=4)# Run model and print output shapeprint(model(x).shape)Citation@misc{gong2021ast,title={AST: Audio Spectrogram Transformer},author={Yuan Gong and Yu-An Chung and James Glass},year={2021},eprint={2104.01778},archivePrefix={arXiv},primaryClass={cs.SD}}LicenseMIT
Package: asttrs
asttrsA attrs-style wrapper for python astFeatures1. Developer-friendly version ofast, 1) easier to access docstring and 2) easier to do codegen.fromastimportFunctionDefhelp(FunctionDef)# Help on class FunctionDef in module ast:# class FunctionDef(stmt)#  |  FunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list, expr? returns, string? type_comment)#  |#  |  (no docstring)#  |#  |  Method resolution order:#  |      FunctionDef#  |      stmt#  |      AST#  |      builtins.object#  |#  :vsfromasttrsimportFunctionDefhelp(FunctionDef)# Help on class FunctionDef in module asttrs._py3_11:# class FunctionDef(stmt)#  |  FunctionDef(*, name: 'identifier', args: 'arguments', body: List[ForwardRef('stmt')] = NOTHING, de# corator_list: List[ForwardRef('expr')] = NOTHING, returns: 'expr' = None, type_comment: 'string' = Non# e) -> None#  |#  |  A function definition.#  |  * ``name`` is a raw string of the function name.#  |  * ``args`` is an :class:`arguments` node.#  |  * ``body`` is the list of nodes inside the function.#  |  * ``decorator_list`` is the list of decorators to be applied, stored outermost#  |  first (i.e. the first in the list will be applied last).#  |  * ``returns`` is the return annotation.#  |  .. attribute:: type_comment#  |  ``type_comment`` is an optional string with the type annotation as a comment.#  :# Then we can easily know how to build a functionfromasttrsimportarguments,Return,Constantfunc=FunctionDef(name="foo",args=arguments(),body=[Return(value=Constant(value="Hello World"))])print(func.to_source())# def foo():#     return 'Hello World'#2. provideCommentto codegen commentsfromasttrsimportCommentcomment=Comment(body="This is a comment,\nsecond line,\nthird line.")print(comment.to_souce())# This is a comment,# second line,# third line.Development# switch python version and environment
$ (cd cpython; git checkout v3.11.7) 
$ ln -vsfT .venv311 .venv

# run codegen based on Python.asdl
$ poetry run inv build | poetry run black - >! src/asttrs/_py3_11.py

# run testing
$ poetry run pytest --doctest-modules --cov=src --cov-report=term-missing tests
Package: astunparse
An AST unparser for Python.This is a factored out version ofunparsefound in the Python
source distribution; under Demo/parser in Python 2 and under Tools/parser
in Python 3.Basic example:import inspect
import ast
import astunparse

# get back the source code
astunparse.unparse(ast.parse(inspect.getsource(ast)))

# get a pretty-printed dump of the AST
astunparse.dump(ast.parse(inspect.getsource(ast)))This library is single-source compatible with Python 2.6 through Python 3.5. It
is authored by the Python core developers; I have simply merged the Python 2.7
and the Python 3.5 source and test suites, and added a wrapper. This factoring
out is to provide a library implementation that supports both versions.Added to this is a pretty-printingdumputility function.The test suite both runs specific tests and also roundtrips much of the
standard library.Extensions and AlternativesSimilar projects include:codegenastorastmonkeyastprintNone of these roundtrip much of the standard library and fail several of the basic
tests in thetest_unparsetest suite.This library uses mature and core maintained code instead of trying to patch
existing libraries. Theunparseand thetest_unparsemodules
are under the PSF license.Extensions include:typed-astunparse: extends astunparse to support type annotations.Documentation:http://astunparse.rtfd.org.Featuresunparses Python AST.pretty-prints AST.ChangelogHere’s the recent changes to AST Unparser.1.6.3 - 2019-12-22Add full support for Python 3.81.6.2 - 2019-01-19Add support for the Constant node in Python 3.8Add tests to the sdist1.6.1 - 2018-10-03Fix the roundtripping of very complex f-strings.1.6.0 - 2018-09-30Python 3.7 compatibility1.5.0 - 2017-02-05Python 3.6 compatibilitybugfix: correct argparser option type1.4.0 - 2016-06-24Support for theasynckeywordSupport for unparsing “Interactive” and “Expression” nodes1.3.0 - 2016-01-17Python 3.5 compatibility1.2.0 - 2014-04-03Python 2.6 through 3.4 compatibilityA new functiondumpis added to return a pretty-printed version
of the AST. It’s also available when runningpython-mastunparseas the--dumpargument.1.1.0 - 2014-04-01unparsewill return the source code for an AST. It is pretty
feature-complete, and round-trips the stdlib, and is compatible with
Python 2.7 and Python 3.4.Runningpython-mastunparsewill print the round-tripped source
for any python files given as argument.
Package: astunparse-fixed
An AST unparser for Python.This is a factored out version ofunparsefound in the Python
source distribution; under Demo/parser in Python 2 and under Tools/parser
in Python 3.Basic example:import inspect
import ast
import astunparse

# get back the source code
astunparse.unparse(ast.parse(inspect.getsource(ast)))

# get a pretty-printed dump of the AST
astunparse.dump(ast.parse(inspect.getsource(ast)))This library is single-source compatible with Python 2.6 through Python 3.5. It
is authored by the Python core developers; I have simply merged the Python 2.7
and the Python 3.5 source and test suites, and added a wrapper. This factoring
out is to provide a library implementation that supports both versions.Added to this is a pretty-printingdumputility function.The test suite both runs specific tests and also roundtrips much of the
standard library.Extensions and AlternativesSimilar projects include:codegenastorastmonkeyastprintNone of these roundtrip much of the standard library and fail several of the basic
tests in thetest_unparsetest suite.This library uses mature and core maintained code instead of trying to patch
existing libraries. Theunparseand thetest_unparsemodules
are under the PSF license.Extensions include:typed-astunparse: extends astunparse to support type annotations.Documentation:http://astunparse.rtfd.org.Featuresunparses Python AST.pretty-prints AST.ChangelogHere’s the recent changes to AST Unparser.1.6.3 - 2019-12-22Add full support for Python 3.81.6.2 - 2019-01-19Add support for the Constant node in Python 3.8Add tests to the sdist1.6.1 - 2018-10-03Fix the roundtripping of very complex f-strings.1.6.0 - 2018-09-30Python 3.7 compatibility1.5.0 - 2017-02-05Python 3.6 compatibilitybugfix: correct argparser option type1.4.0 - 2016-06-24Support for theasynckeywordSupport for unparsing “Interactive” and “Expression” nodes1.3.0 - 2016-01-17Python 3.5 compatibility1.2.0 - 2014-04-03Python 2.6 through 3.4 compatibilityA new functiondumpis added to return a pretty-printed version
of the AST. It’s also available when runningpython-mastunparseas the--dumpargument.1.1.0 - 2014-04-01unparsewill return the source code for an AST. It is pretty
feature-complete, and round-trips the stdlib, and is compatible with
Python 2.7 and Python 3.4.Runningpython-mastunparsewill print the round-tripped source
for any python files given as argument.
Package: astunparse-noparen
An AST unparser for Python.This is a factored out version ofunparsefound in the Python
source distribution; under Demo/parser in Python 2 and under Tools/parser
in Python 3.Basic example:import inspect
import ast
import astunparse

# get back the source code
astunparse.unparse(ast.parse(inspect.getsource(ast)))

# get a pretty-printed dump of the AST
astunparse.dump(ast.parse(inspect.getsource(ast)))This library is single-source compatible with Python 2.6 through Python 3.5. It
is authored by the Python core developers; I have simply merged the Python 2.7
and the Python 3.5 source and test suites, and added a wrapper. This factoring
out is to provide a library implementation that supports both versions.Added to this is a pretty-printingdumputility function.The test suite both runs specific tests and also roundtrips much of the
standard library.Extensions and AlternativesSimilar projects include:codegenastorastmonkeyastprintNone of these roundtrip much of the standard library and fail several of the basic
tests in thetest_unparsetest suite.This library uses mature and core maintained code instead of trying to patch
existing libraries. Theunparseand thetest_unparsemodules
are under the PSF license.Extensions include:typed-astunparse: extends astunparse to support type annotations.Documentation:http://astunparse.rtfd.org.Featuresunparses Python AST.pretty-prints AST.ChangelogHere’s the recent changes to AST Unparser.1.5.0 - 2017-02-05Python 3.6 compatibilitybugfix: correct argparser option type1.4.0 - 2016-06-24Support for theasynckeywordSupport for unparsing “Interactive” and “Expression” nodes1.3.0 - 2016-01-17Python 3.5 compatibility1.2.0 - 2014-04-03Python 2.6 through 3.4 compatibilityA new functiondumpis added to return a pretty-printed version
of the AST. It’s also available when runningpython-mastunparseas the--dumpargument.1.1.0 - 2014-04-01unparsewill return the source code for an AST. It is pretty
feature-complete, and round-trips the stdlib, and is compatible with
Python 2.7 and Python 3.4.Runningpython-mastunparsewill print the round-tripped source
for any python files given as argument.
Package: astutils
AboutBare essentials for building abstract syntax trees (AST) and Pythonlex-yacc(PLY) parsers.
The package includes:two classes for tree nodes:Terminal,OperatoraLexerandParserclass, and a helper function to erase and
rewrite the table files.The examples underexamples/demonstrate how to use these classes to create
a richer AST, a parser, and different backends that use the same parser.These classes provide the boilerplate for parsing with PLY, and are based on
code that was developed intulipandpromela.LicenseBSD-3, see fileLICENSE.
Package: astutus
Astutus is a portofolio to demonstrate the range and depth of my
python development skills.  It also serves as a useful codebase
from which I can search and reuse code as needed. Next, it
serves as repository of things that I’ve learned and want to be
able to efficiently reuse.Finally, over the next few months it will develop into
a set of capabilities that you might find useful.InstallingInstall and update usingpip:pip install -U astutus --prePlease note the use of–preoption.  With the current build
automation, the packages published to PyPI are all marked as alpha.TechnologiesHere are some of the technologies I’ve used in the past and will
be incorporating into this code base.Full-stack web developer skills:FlaskFlask-SQLAlchemyJinja2HTML5CSSSQLJavascriptJQuerySphinxRestructured TextREST API’sPython Technologies:Integrated DocumentationSetuptoolsPytestProductivity Technologies:Test Driven DevelopmentContinuous ImprovementAutomationContinuous IntegrationContinuous DeploymentSemantic VersioningAgile PlanningBias for ActionOther Technologies:DockerRaspbery PiNot all of these are yet incorporated into this code base.
This is a work-in-progress.  As time passes more of these
capabilities will be published.
Package: astvalidate
astvalidateA series of AST validators for validating the integrity of the given abstract syntax tree.APIvalidate(tree: ast.Module, level: Optional[Literal[1, 2, 3]] = None) -> booltreeis the AST object that you want to verify.levelis an argument to pass the
level of strictness, and turn on/off some of the validators. For a detailed list of validators,
see the table below:ValidatorLevelDescriptionSyntatical1Emulates syntax warnings that are normally generated by compiler.Simple1Does simple verifications, similar toPyAST_ValidateinterfaceSymbolic2Emulates syntax error that are normally generated by symbol tableContextual3Ensures everything is in the right context.If there are any errors,validate()will raise aSyntaxErroror issueSyntaxWarningson the location of the target node.importastimportastvalidatetree=ast.parse("""def func():raise ValueError from something""")tree.body[0].body[0].exc=Noneassertastvalidate.validate(tree)File "<string>", line 3
SyntaxError: Raise's cause can't be used without setting an exception
Package: astwro
Astrophysical routines.Documentation:http://astwro.readthedocs.io/Source:https://github.com/majkelx/astwroDownload:https://pypi.python.org/pypi/astwroOverviewSet of modules developed in Astronomical Institute of Wroclaw University.
Contains wrappers fordaophotpackage, star lists manipulation aspandasDataFrames with
export/import todaophotandds9formats, genetic algorithm for searching for optimal PSF stars and other.Installation$pipinstallastwroYou should setup paths to executables (e.g. yourdaophot).See documentation.NoteYou must have modern DAOPHOT suite installed to usepydaophotsubmodule (not IRAF’s daophot).ModulesPackage contains following modules:pydaophot- wrapper for Peter Stetson’s DAOPHOT photometry  suite:d=astwro.pydaophot.Daophot(image='i.fits')res=d.PHotometry(IS=35,OS=50,apertures=[8])starlist- provides pandas objects for stars list, with import/export do daophot and ds9 formats.s=res.photometry_starlist.sort_values('mag')psf=astwro.starlist.read_dao_file('i.lst')astwro.starlist.write_ds9_regions('i.reg',color='blue',indexes=[psf.index],colors=['red'])# PSF stars redutils- some helpers for scripts.dir=astwro.utils.tempdir('i.lst')f=open(os.path.join(dir.path,'notimportant.txt'),'w')tools- command line (callable form python also) tools includinggapickfor finding optimal PSF-stars set using generic algorithm.$gapick.py-odresults-ci.cooi.fitsContactFor any comments or wishes please e-mail for the following alias:astwro.0.5@2007.gfdgfdg.comFor any issues please use github tracker:https://github.com/majkelx/astwro/issues
Package: astx
ASTx Library: A Versatile Toolkit for Language RepresentationASTx is a groundbreaking library designed to encapsulate language components in
an agnostic and pythonic way. It provides a comprehensive set of classes and
functionalities, allowing developers to articulate the core elements of any
programming language.License: BSD 3 ClauseDocumentation:https://arxlang.github.io/astxCore Features1.Expressive Language ComponentsASTx offers a rich suite of classes to describe essential language constructs
such as:IfstatementsForloopsFunctiondeclarations and usagesVariablesData TypesOperationsAnd moreThese classes enable a concise and clear representation, providing an intuitive
way to model various programming constructs.2.Symbol Table ClassAn integral part of ASTx, the Symbol Table class facilitates the translation of
ASTx expressions to other languages like LLVM-IR. This class acts as a mapping
layer, allowing a seamless connection between ASTx expressions and target
language representations.3.Language Agnostic DesignUniquely tailored to be independent of specific programming languages, ASTx
offers a flexible foundation. It strives to provide initial components that can
describe any programming language, giving users the freedom to work with
multiple languages effortlessly.4.Integration with Projects like ARX-IRASTx has proven to be a vital tool in projects like ARX-IR, where it's leveraged
to translate Abstract Syntax Trees (AST) into LLVM-IR. This showcases the
library's adaptability and potential to serve as a foundational layer in various
applications.Why Choose ASTx?ASTx is not just a library; it's a robust framework that fosters creativity and
efficiency in language processing. Its pythonic design, combined with the power
to handle different language constructs, positions ASTx as an invaluable
resource for developers and researchers alike.Whether you're building a compiler, working on language translation, or
exploring new frontiers in programming language design, ASTx offers a reliable
and extensible toolkit to support your endeavors.Getting StartedYou can explore the ASTx library and dive into its capabilities by accessing the
official documentation. For those interested in contributing or seeking further
insights, the ASTx community provides extensive support and collaboration
opportunities.Unlock the potential of language representation with ASTx, and join us in
shaping the future of programming languages.
Package: astyle
Astyle Python distributionThis project packages theastyleutility as
a Python package.InstallpipinstallastyleInstalling is not needed forpre-commit.Usageshellastyle--help# orpython-mastyle--helppythonfromastyleimportastyleastyle("--help")pre-commit.pre-commit-config.yaml:repos:-repo:https://github.com/Freed-Wu/mirrors-astylerev:3.4.11hooks:-id:astylepre-commitinstall
gitcommitPlease usehttps://github.com/Freed-Wu/mirrors-astyle, it uses binary wheel
and will be faster than this repository which uses source code.Similar Projectspre-commit hooksmirrors-clang-formatCLinters: it requires you install
linters and formatters in your machine and it calls them. So it cannot
ensure the versions of linters and formatters are same as others, which means
it cannot ensurereproducibility.astyle_precommit_hook:
it uses git hook, not pre-commit, which make it cannot use many hooks at the
same time. It cannot ensurereproducibility, too.pyastyle: stop maintaining.astyle_py: it uses wasm, not native
binary programs like this project.Python distributionsclang-format-wheelcmake-python-distributionsninja-python-distributions
Package: astypes
astypesPython library to statically detect types for AST nodes.A good use case is a linter that needs to run some rules only for particular types. For instance, to check arguments ofsomething.format(a=b)only ifsomethinghas typestr.python3-mpipinstallastypesUsageAstypes usesastroidto infer definitions of nodes. So, if your code works withastnodes, you'll need to convert them into astroid first:importastroidimportastypesmodule=astroid.parse(source_code)node=astypes.find_node(module,ast_node)And when you have an astroid node, you can get its type:node_type=astype.get_node(node)print(node_type.annotation)Example:importastroidimportastypesnode=astroid.extract_node('1 + 2.3')t=astypes.get_type(node)print(t.annotation)# 'float'For a real-world usage example, check outinfer-types. It is a CLI tool that automatically adds type annotations into Python code using astypes.How it worksYou can find most of the logic inastypes/_handlers.py. In short:The type of some nodes is easy to infer. For example,13is alwaysint.Some nodes are also can be inferred but only if we make some assumptions. Assumptions that we make are the ones that are true in 99% of cases. For example, we assume thatlist(x)returns typelist. It might be not true if you shadowlistwith something else.If the type cannot be assumed just by looking at the node, we try to useastroidto infer the type.If the returned value is a function call, we use astroid to find the definition of the function. The annotated return annotation of the function is what we need.If the resolved function doesn't have annotation, we usetypeshed_clientto get its annotation fromtypeshed. For example, for all built-in functions.