Saravanan666/pypi-org huggingface dataset:
Package: asteroidsenv
Atari AsteroidsAn implementation of the Atari Classic Asteroids as agymnasiumenvironment.InstallationClone the repositoryUse pip to install as python package (pip install <Path of setup.py>)Copy the Resource folder into the working directoryDependenciesThe environment needs the following packages to rungymnasiumnumpypygameEnvironment ArgumentsThe environment can be customized using the following kwargs:render_mode: possible values are ["human", "agent", "rgb_array", "debug"], these are all explained in the Rendering Modes sectionobs_type: either "pixels" or "features", specifies the observation type given to the agentnum_rays: a positive integer, specifying the number of rays the agent will use to see in "features" mode.Feature SpaceThe agent get the following values as features:"agent_pos": Center position of the hitbox of the agent"forward_normal": Normalized vector in the direction the agent is facing"direction": Normalized vector in the direction the agent is traveling"velocity": Scalar velocity of the agent"angular_velocity": Scalar angular velocity of the agent"hit_distance": Distance to the asteroid hit"ray_direction": Normalized direction vector of the Asteroid the ray intersected (not implemented yet)
The Shape of the vector depends on the number of rays the agent uses to see, but can be calculated via (8 + 5 * <num_rays>)Pixel SpaceA 64 by 64 pixel image, the Observation Space has the Shape (64, 64, 3).Reward FunctionThe agent gets a positiv reward of 1.0 if he destroys an asteroid.
The agent gets a negativ reward of -10.0 if he gets hit by an asteroid.Rendering ModesThe Environment supports 4 different rendering mode:1. "human"The normal rendering mode, rendering the environment like a human would see the game.2. "debug"Same as human, but with the following debug info visualized:the hitbox of the player as orange boxthe hitbox of the asteroids as orange circlethe rays used by the agent to "see" as blue linesthe intersection points of the rays with the asteroids as red dotsthe players velocity, angular velocity and position as text in the topleft corner3. "agent"Visualizes the environment in a way the agent would "see" by rendering......the rays (in blue) it uses to "see"...the forward facing direction of the agent (in red), this is the same as one of the eight rays...the moving velocity and direction of the player (as green ray)...the turning velocity and direction of the player (as orange ray)...the intersection points of the rays with asteroids (in red)...the direction vector of the asteroids (in red)...the velocity, angular velocity and position of the player (as text)4. "rgb_array"
Package: asterpy
aster.pyAster.py is a python implementation of theAsterprotocol, designed for use in bots or custom clients. The syntax is heavily inspired bydiscord.py.Currently a work in progress, does not support all of the features of Aster.PyPI release can be foundhereDocumentationSeehttp://cospox.com/docs/asterpy/ExamplePing example (listens for "ping" and responds "pong")importasterpyclient=asterpy.Client(ip,port,username,password,uuid)@client.eventasyncdefon_message(message):ifmessage.content=="ping":awaitmessage.channel.send("pong")@client.eventasyncdefon_ready():print("Ready!")client.run()
Package: astest
astest:assertbased testingThe quick, easy way to write tests in Python.UsageGet the tool by installing it frompip:pipinstallastestThe tool doesn't have to be installed in your project's environment, you can
also install it in your global Python (since it has no dependencies).Then give it a file containing "tests" (explained below):astesttest_file.pyYou can also easily run it viapipx:pipxrunastesttest_file.pyTest filesastestexpects a file that doesassert's at runtime.So to write a test for your code, simply doasserts in your file:frommy_libraryimportaddassertadd(12,13)==25assertadd(33,77)==100# This one is falseassertadd(123,123)==246Running this will look like this:$astestexamples/simple.pyTest 1..................................................................PASSEDTest 2..................................................................FAILEDFailing test: assert add(33, 77) == 100Test 3..................................................................PASSED===================== 1 failed, 2 passed in 0.00 seconds =====================DebuggingIf a test fails and you wish to debug it, you can runastestwith--debug:$astestexamples/simple.pyTest 1..................................................................PASSEDTest 2..................................................................FAILEDFailing test: assert add(33, 77) == 100Starting debug session:>>> add(33, 77)110>>> # Oh okay.>>> ^DTest 3..................................................................PASSED===================== 1 failed, 2 passed in 0.00 seconds =====================Local Development / TestingCreate and activate a virtual environmentRunpip install -r requirements-dev.txtto do an editable installRunpytestto run testsType CheckingRunmypy .Create and upload a package to PyPIMake sure to bump the version insetup.cfg.Then run the following commands:rm-rfbuilddist
pythonsetup.pysdistbdist_wheelThen upload it to PyPI usingtwine:twineuploaddist/*
Package: asteval
ASTEVAL provides a numpy-aware, safe(ish) ‘eval’ function
Emphasis is on mathematical expressions, and so numpy ufuncs
are used if available.  Symbols are held in the Interpreter
symbol table ‘symtable’:  a simple dictionary supporting a
simple, flat namespace.
Expressions can be compiled into ast node for later evaluation,
using the values in the symbol table current at evaluation time.
Package: astexport
Python command line application to export Python 3 AST as JSON.Python 2.7 AST was used up to version 0.2.1 of this library.Installation$pipinstallastexportUsage$astexport<example.py>ast.json$astexport--helpLicenseCopyright (c) 2015, Federico Poli <federpoli@gmail.com>Released under the MIT license.
Package: ast-grep-cli
ast-grep(sg)ast-grep(sg) is a CLI tool for code structural search, lint, and rewriting.Introductionast-grep is an AST-based tool to search code by pattern code. Think it as your old-friendgrepbut it matches AST nodes instead of text.
You can write patterns as if you are writing ordinary code. It will match all code that has the same syntactical structure.
You can use$sign + upper case letters as wildcard, e.g.$MATCH, to match any single AST node. Think it as REGEX dot., except it is not textual.Try theonline playgroundfor a taste!DemoSee more screenshots on thewebsite.InstallationYou can install it fromnpm,pip,cargo,homebrew,scooporMacPorts!npminstall--global@ast-grep/cli
pipinstallast-grep-cli
cargoinstallast-grep# install via homebrew, thank @henryhchchcbrewinstallast-grep# install via scoop, thank @brian6932scoopinstallmain/ast-grep# install via MacPortssudoportinstallast-grepOr you can build ast-grep from source. You need install rustup, clone the repository and thencargoinstall--path./crates/cliPackagesare available on other platforms too.Command line usage exampleast-grep has following form.sg --pattern 'var code = $PATTERN' --rewrite 'let code = new $PATTERN' --lang tsExampleRewrite code in null coalescing operatorsg-p'$A && $A()'-lts-r'$A?.()'RewriteZodiossg-p'new Zodios($URL,  $CONF as const,)'-lts-r'new Zodios($URL, $CONF)'-iImplement eslint rule using YAML.SponsorIf you find ast-grep interesting and useful for your work, pleasebuy me a coffeeso I can spend more time on the project!Feature Highlightast-grep's core is an algorithm to search and replace code based on abstract syntax tree produced by tree-sitter.
It can help you to do lightweight static analysis and massive scale code manipulation in an intuitive way.Key highlights:An intuitive pattern to find and replace AST.
ast-grep's pattern looks like ordinary code you would write every day (you could say the pattern is isomorphic to code).jQuery like API for AST traversal and manipulation.YAML configuration to write new linting rules or code modification.Written in compiled language, with tree-sitter based parsing and utilizing multiple cores.Beautiful command line interface :)ast-grep's vision is to democratize abstract syntax tree magic and to liberate one from cumbersome AST programming!If you are an open source library author, ast-grep can help your library users adopt breaking changes more easily.if you are a tech lead in your team, ast-grep can help you enforce code best practice tailored to your business need.If you are a security researcher, ast-grep can help you write rules much faster.
Package: ast-grep-py
ast-grep python bindingast-grepast-grepis a tool for code structural search, lint, and rewriting.This crate intends to build a native python binding of ast-grep and provide a python API for programmatic usage.Installationpipinstallast-grep-pyUsageYou can take our tests as examples. For example,test_simple.pyshows how to use ast-grep to search for a pattern in a file.Please see theAPI usage guideandAPI referencefor more details.Other resources includeast-grep's official siteandrepository.DevelopmentSetup virtualenvpython-mvenvvenvActivate venvsourcevenv/bin/activateInstallmaturinpipinstallmaturin[patchelf]Build bindingsmaturindevelopRun testspytestAll tests files are undertestsdirectory.LicenseThis project is licensed under the MIT license.
Package: asthook
READMEGENERAL INFOProject: AsthookContributors: MadSquirrelsLicense: GNU General Public License v3.0Version: v1.0Date: 02-16-20GOALMany plugins allowing to analyze the application are already available such as :searching for literals in the source codeListing set of read and write functions on the file system.searching for exploitable vulnerable Intent and generation of an apk poclisting of all user entry pointssearching function called in the apksearching function in the apkgenerating an automatic hook on a functionautomatic installing of the #certificateautomatic bypassing of #SLL #pinningRecovering deleted filesEtc.READ THE DOCSTo see how to install and how to use follow this link:documentationIf you want to know how to install it and use it in local follow this instructions:cd docspip3.7 install -r requirement.txtmake renderopen your browser and go to 127.0.0.1:8000DonationIf you want to support me <3
Package: astir
astiris a modelling framework for the assignment of cell type across a range of single-cell technologies such as Imaging Mass Cytometry (IMC).astiris built usingpytorchand uses recognition networks for fast minibatch stochastic variational inference.Key applications:Automated assignment of cell type and state from highly multiplexed imaging and proteomic dataDiagnostic measures to check quality of resulting type and state inferencesAbility to map new data to cell types and states trained on existing data using recognition neural networksA range of plotting and data loading utilitiesGetting startedSee the fulldocumentationand check out thetutorials.An interactive vignette can be found as a Google colab notebook as part of the following repository.https://github.com/camlab-bioml/Astir-VignetteAuthorsJinyu Hou, Sunyun Lee, Michael Geuenich, Kieran CampbellLunenfeld-Tanenbaum Research Institute & University of Toronto
Package: astk
What is ASTK?ASTKis a command-line software for comprehensive alternative splicing analysis including:characterizing distribution and expression patterns of alternative splicing eventssystematically analyzing functional effects of AS events at the gene- and exon-level respectivelydissecting out splicing-associated sequence features and epigenetic marksinferring the splicing regulatory code for each type of AS.DocumentationThe documentation forASTKis available onastk-docContactIf you have any problem, contact me athsh-me@outlook.com
Package: astLib
astLibprovides some tools for research astronomers who use Python.Documentation:https://astlib.readthedocs.ioLicense:LGPLAuthors:Matt Hilton & Steven BoadaInstallation:pip install astLibSupport:Please use theGitHub issues page,
and/or contactMatt Hilton.astLibis divided into several modules:astCalc   (general calculations, e.g. luminosity distance etc.)astCoords (coordinate conversions etc.)astImages (clip sections from .fits etc.)astPlots  (provides a flexible image plot class, e.g. plot image with catalogue objects overlaid)astSED    (calculate colours, magnitudes from stellar population models or spectral templates, fit photometric observations using stellar population models etc.)astStats  (statistics, e.g. biweight location/scale estimators etc.)astWCS    (routines for using FITS World Coordinate System information)The astWCS module is a higher level interface to PyWCSTools, a simple SWIG (http://www.swig.org) wrapping
of some of the routines from WCSTools by Jessica Mink (http://tdc-www.harvard.edu/software/wcstools/). It is
used by some routines in astCoords, astImages and astPlots.The goal ofastLibwas to provide features useful to astronomers that are not included in the scipy
(http://scipy.org), numpy (http://numpy.scipy.org) or matplotlib (http://matplotlib.sourceforge.net) modules
on which astLib depends. For a far more extensive set of Python astronomy modules, see astropy
(http://www.astropy.org/).Some scripts usingastLibcan be found in the examples/ folder provided with the source code distribution.
Package: astload
astloadCreate ASTs fromast.dump()output.It's possible to serialize an AST node from Python'sastmodule to a string,
usingast.dump. However, it's not possible to convert the said string back to
an AST node. This simple module adds that functionality.ExamplesWe will take a simple Python AST, serialize it and then deserialize it:>>>importast>>>importastload>>>tree1=ast.parse('1 == 2')>>>ast_string=ast.dump(tree1,indent=2)>>>print(ast_string)Module(body=[Expr(value=Compare(left=Constant(value=1),ops=[Eq()],comparators=[Constant(value=2)]))],type_ignores=[])>>>tree2=astload.load(ast_string)>>>print(ast.dump(tree2,indent=2))Module(body=[Expr(value=Compare(left=Constant(value=1),ops=[Eq()],comparators=[Constant(value=2)]))],type_ignores=[])>>>ast.dump(tree1)==ast.dump(tree2)True>>>ast.unparse(tree2)'1 == 2'Addingload()to theastmoduleIf you preferast.load()instead ofastload.load(), you can do the following
to add aloadfunction to theastmodule directly:>>>importastload>>>astload.install()>>>importast>>>tree=ast.parse('print(2 + 2)')>>>copy_tree=ast.load(ast.dump(tree))>>>ast.unparse(copy_tree)'print(2 + 2)'astprettysupportastloadsupportsastprettyoutput also:>>>ast_string=astpretty.pformat(ast.parse('1 == 2'))>>>print(ast_string)Module(body=[Expr(lineno=1,col_offset=0,end_lineno=1,end_col_offset=6,value=Compare(lineno=1,col_offset=0,end_lineno=1,end_col_offset=6,left=Constant(lineno=1, col_offset=0, end_lineno=1, end_col_offset=1, value=1, kind=None),ops=[Eq()],comparators=[Constant(lineno=1, col_offset=5, end_lineno=1, end_col_offset=6, value=2, kind=None)],),),],type_ignores=[],)>>>tree=astload.load(ast_string)>>>astpretty.pprint(tree)Module(body=[Expr(lineno=1,col_offset=0,end_lineno=1,end_col_offset=6,value=Compare(lineno=1,col_offset=0,end_lineno=1,end_col_offset=6,left=Constant(lineno=1, col_offset=0, end_lineno=1, end_col_offset=1, value=1, kind=None),ops=[Eq()],comparators=[Constant(lineno=1, col_offset=5, end_lineno=1, end_col_offset=6, value=2, kind=None)],),),],type_ignores=[],)
Package: astm
Python implementation of ASTM E1381/1394 data protocol.This project aims to solve three tasks:Provide decoder ASTM data to Python objects and encode them back to valid
ASTM messages.Provide ability to create your own ASTM client and server applications
followed by common specification routines.Provide ready-to-use “drivers” for various ASTM-driven analysers,
middlewares and other software or hardware solutions.Depending on your needs you may use this project in one of these ways.
Currently, all communication routines are implemented for TCP/IP protocol driven
by a bit improved standard asynclib.Read the docs for more info:http://python-astm.readthedocs.org
Package: ast-magic
This allows you to visualize the AST of a cell in IPython upon running it.Installationpip3 install ast-magicTo manually load, run the following in your IPython prompt:%load_ext ast_magicTo automatically load, add the following to yourIPython configuration file:c = get_config()
c.InteractiveShellApp.extensions.append('ast_magic')UsageVerifying Python follows PEMDAS:In [1]: %ast (1 + 1) ** 2 * 5 - 4
Module(
    body=[
        Expr(
            value=BinOp(
                left=BinOp(
                    left=BinOp(
                        left=BinOp(
                            left=Constant(value=1),
                            op=Add(),
                            right=Constant(value=1)),
                        op=Pow(),
                        right=Constant(value=2)),
                    op=Mult(),
                    right=Constant(value=5)),
                op=Sub(),
                right=Constant(value=4)))],
    type_ignores=[])You can use it in a cell too:In [1]: %%ast
   ...:
   ...: def fibonacci(n: int) -> int:
   ...:     if n <= 1: return 1
   ...:     return fibonacci(n - 2) + fibonacci(n - 1)
   ...:
Module(
    body=[
        FunctionDef(
            name='fibonacci',
            args=arguments(
                posonlyargs=[],
                args=[
                    arg(
                        arg='n',
                        annotation=Name(id='int', ctx=Load()))],
                kwonlyargs=[],
                kw_defaults=[],
                defaults=[]),
            body=[
                If(
                    test=Compare(
                        left=Name(id='n', ctx=Load()),
                        ops=[
                            LtE()],
                        comparators=[
                            Constant(value=1)]),
                    body=[
                        Return(
                            value=Constant(value=1))],
                    orelse=[]),
                Return(
                    value=BinOp(
                        left=Call(
                            func=Name(id='fibonacci', ctx=Load()),
                            args=[
                                BinOp(
                                    left=Name(id='n', ctx=Load()),
                                    op=Sub(),
                                    right=Constant(value=2))],
                            keywords=[]),
                        op=Add(),
                        right=Call(
                            func=Name(id='fibonacci', ctx=Load()),
                            args=[
                                BinOp(
                                    left=Name(id='n', ctx=Load()),
                                    op=Sub(),
                                    right=Constant(value=1))],
                            keywords=[])))],
            decorator_list=[],
            returns=Name(id='int', ctx=Load()))],
    type_ignores=[])
Package: astmath
astmathEvaluate Python arithemetic expressions safely.This package can help evaluate Python expressions, without any risk of
code execution.Installationpip install astmathUsageUse it in the CLI:$astmath'40 + 2'42$astmath'"foobar" * 2'foobarfoobarOr via the API:>>>importastmath>>>astmath.eval("2 + 3 * 4")14>>>astmath.eval("foo"*3)'foofoofoo'Local Development / TestingCreate and activate a virtual environmentRunpip install -r requirements-dev.txtto do an editable installRunpytestto run testsType CheckingRunmypy .Create and upload a package to PyPIMake sure to bump the version insetup.cfg.Then run the following commands:rm-rfbuilddist
pythonsetup.pysdistbdist_wheelThen upload it to PyPI usingtwine:twineuploaddist/*
Package: astmonkey
astmonkeyis a set of tools to play with Python AST.InstallationYou can installastmonkeyfrom PyPI:$ pip install astmonkeyIf you want to have latest changes you should clone this repository and usesetup.py:$ git clone https://github.com/mutpy/astmonkey.git
$ cd astmonkey
$ python setup.py installvisitors.SourceGeneratorNodeVisitorThis visitor allow AST to Python code generation. It was originally written by
Armin Ronacher (2008, license BSD) ascodegen.pymodule.astmonkeyversion
fixes few bugs and it has good code coverage.Example usage:import ast
from astmonkey import visitors

code = 'x = (y + 1)'
node = ast.parse(code)
generated_code = visitors.to_source(node)

assert(code == generated_code)transformers.ParentChildNodeTransformerThis transformer adds few fields to every node in AST:parent- link to parent node,parents- list of all parents (onlyast.expr_contextnodes have more than one parent node, in other causes this is one-element list),parent_field- name of field in parent node including child node,parent_field_index- parent node field index, if it is a list.children- link to children nodes.Example usage:import ast
from astmonkey import transformers

node = ast.parse('x = 1')
node = transformers.ParentChildNodeTransformer().visit(node)

assert(node == node.body[0].parent)
assert(node.body[0].parent_field == 'body')
assert(node.body[0].parent_field_index == 0)
assert(node.body[0] in node.children)visitors.GraphNodeVisitorThis visitor creates Graphviz graph from Python AST (viapydot). Before you useGraphNodeVisitoryou need to add parents links to tree nodes (withParentChildNodeTransformer).Example usage:import ast
from astmonkey import visitors, transformers

node = ast.parse('def foo(x):\n\treturn x + 1')
node = transformers.ParentChildNodeTransformer().visit(node)
visitor = visitors.GraphNodeVisitor()
visitor.visit(node)

visitor.graph.write_png('graph.png')Producedgraph.png(you need to have installedgraphvizbinaries if you want generate
images):utils.is_docstringThis routine checks if target node is a docstring. Before you useis_docstringyou need to add parents links to tree nodes (withParentChildNodeTransformer).Example usage:import ast
from astmonkey import utils, transformers

node = ast.parse('def foo(x):\n\t"""doc"""')
node = transformers.ParentChildNodeTransformer().visit(node)

docstring_node = node.body[0].body[0].value
assert(not utils.is_docstring(node))
assert(utils.is_docstring(docstring_node))LicenseCopyright [2013] [Konrad Hałas]Licensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Package: ast-names
ast_namesCollect top level variable names using the ast.Installationpip install ast_namesUsage>>>fromast_namesimportast_names>>>ast_names("""...import sys, os...import sys as foo......from foo import (...bar as baz,...alpha...)......MYCONSTANT = 1......def my_func():............class MyClass:........."""){'os', 'MYCONSTANT', 'alpha', 'baz', 'foo', 'sys', 'MyClass', 'my_func'}
Package: astng
The aim of this module is to provide a common base representation of
python source code for projects such as pychecker, pyreverse,
pylint… Well, actually the development of this library is essentialy
governed by pylint’s needs.It extends class defined in the compiler.ast [1] module with some
additional methods and attributes. Instance attributes are added by a
builder object, which can either generate extended ast (let’s call
them astng ;) by visiting an existant ast tree or by inspecting living
object. Methods are added by monkey patching ast classes.