Saravanan666/pypi-org huggingface dataset:
Package: pathaliases
pathaliasesA python package for handling path aliases.Path aliases can be loaded directly from YAML files:dir/:subdir/:alias:SUBDIRsome/other/dir/:alias:SUBDIR_2file.txt:{alias:[FILE,ALTERNATE_ALIAS]}dir2/:extra_keys:are ignoredalias:2ndDirsome/very/long/path/:into/a/deep/file/hierarchy/:can/be/addressed/with:{alias:A_PATH_INDEPENDANT_ALIAS}Resolving this withpathaliases.resolve_yaml_to_path_strings("aliases.yml")returns a
dictionary:{"SUBDIR":"dir/subdir/","SUBDIR_2":"dir/subdir/some/other/dir/""FILE":"file.txt","ALTERNATE_ALIAS":"file.txt","2ndDir":"dir2/","A_PATH_INDEPENDENT_ALIAS":"some/very/long/path/into/a/deep/file/hierarchy/can/be/addressed/with"}Which can be used to make codebases independent from paths:# Beforesubdir="dir/subdir/"subdir_2=os.path.join(subdir,subdir_2)# After: *where* the dirs are is configurablealiases=pathaliases.resolve_yaml_to_path_strings("aliases.yml")subdir=aliases["SUBDIR"]subdir_2=aliases["SUBDIR_2"]pathaliasesis designed to be:Simple- It just concatenates all the keys that lead up to an alias.Readable- Developers and admins should be able to edit paths easily.Standard- It uses standard file formats and conventions, making it
easy to port to other languages.InstallationClone the repo:$ git clone https://github.com/adamkewley/pathaliases.git
$ python setup.py installUsageResolve aliases directly from a YAML file:importpathaliasesaliases=pathaliases.resolve_yaml_to_path_strings("aliases.yml")print(aliases["SUBDIR"])# echoes: "dir/subdir/"Resolve aliases from a dict:importpathaliasesaliases_dict={"dir/":{"subdir/":{"alias":"SUBDIR"}}}aliases=pathaliases.resolve_path_strings(aliases_dict)print(aliases["SUBDIR"])# echoes: "dir/subdir/"Substituting VariablesAlias files can also contain variables, templated with${VARNAME}:foo/:${var}/:alias:${key}pathaliasesallows you to pass in an environment when evaluating
paths:env={"var":"bar","key":"some_alias"}aliases=pathaliases.resolve_yaml_to_path_strings("aliases.yml",env=env)aliases=={"some_alias":"foo/bar/",}
Package: path-analysis-toolbox
Get directory, filename or extension from path:frompath_analysis_toolboximportPathAnalyserPathAnalyser.directory_filename_extension("C:\\Example\\directory\\filename.mp3")# ("C:\\Example\\directory", "filename", "mp3")PathAnalyser.directory("C:\\Example\\directory\\filename.mp3")# "C:\\Example\\directory"PathAnalyser.filename("C:\\Example\\directory\\filename.mp3")# "filename"PathAnalyser.extension("C:\\Example\\directory\\filename.mp3")# "mp3"PathAnalyser.directory_filename_extension("C:\\Example\\directory\\filename")# ("C:\\Example\\directory", "filename", "")PathAnalyser.directory_filename_extension("C:")# ("", "C:", "")
Package: path-and-address
Path-and-Address================Functions for command-line server tools used by humans.Description-----------Path-and-address resolves ambiguities for command-line interface applicationswith the following pattern:```bash$ your_app [<path>] [<address>]```The library applies [the principal of least surprise][pols] to command-lineinterfaces.Some examples:```bash$ your_app .* Serving . on http://localhost:5000/$ your_app 80* Serving . on http://localhost:80/$ your_app ./80* Serving ./80 on http://localhost:5000/$ your_app path/to/file* Serving path/to/file on http://localhost:5000/$ your_app 0.0.0.0* Serving 0.0.0.0 on http://localhost:5000/$ your_app . 0.0.0.0* Serving . on http://0.0.0.0:5000/$ your_app 0.0.0.0:8080* Serving . on http://0.0.0.0:8080/```Usage-----Implement a CLI front-end in Python that exposes the above `[path] [address]`pattern. Then call `resolve(path, address)`.Example, using `sys.argv` directly:```pythonimport sysfrom path_and_pattern import resolvepath, address = resolve(*argv[1:])```More examples can be found in the "examples" directory.Installation------------To install, simply:```bash$ pip install path-and-address```Or put it in your project's `requirements.txt`.Contributing------------1. Check the open issues or open a new issue to start a discussion aroundyour feature idea or the bug you found2. Fork the repository, make your changes, and add yourself to [Authors.md][]3. Send a pull request[pols]: http://en.wikipedia.org/wiki/Principle_of_least_astonishment[authors.md]: ./AUTHORS.md
Package: pathcache
When using remote files, using the remote path will be slow, but you do not want to manually download to the local. You can use this library to automatically download management cache files, but still use the original remote path.For example:from pathcache import pathcachestr as pcopen(pc(r"/mnt/smb_01/xxx/yy/z.txt"))This will create ./_pathcache/mnt/smb_01/xxx/yy/z.txt copy from /mnt/smb_01/xxx/yy/z.txtActully, the argument to the open() is str absolute path of "./_pathcache/mnt/smb_01/xxx/yy/z.txt"
Package: pathconfig
# pathconfigpathconfig is a small library that aims to make it easy to make your
application configurable and find its data easily.it features the following central functions/classes:pathconfig.load_configurationcreates an AppContext object that allows
to retrieve configuration variables (get_config_var)pathconfig.Factoryis a class for objects that have parts that can be
loaded on-demand. Ifobjis your object, and it has aload_bananamethod, thenobj.get(‘banana’)will either returned the cached banana
or invoke itsload_bananamethod to retrieve one.pathconfig.load_pluginprovides a friendly wrapper around setuptools’entry_pointsmechanism.# Install
The most convenient way is to install pathconfig via pip or easy_install:pip install pathconfig# Getting started
see examples/simple_example.py
Package: pathcrawler
pathcrawlerJust a file globber that also give you directory size.Install using:pip install pathcrawlerpathcrawler contains just three functions: crawl, get_directory_size, and format_size.crawl takes a starting directory and returns a recursive list of pathlib.Path objects for all files in the starting directory and its sub folders.get_directory_size takes a directory and returns the total size in bytes of the contents of the directory.format_size takes a number (presumed to be bytes) and returns it as a string rounded to two decimal places with the appropriate unit suffix.i.e.>>>import pathcrawler
>>> pathcrawler.format_size(132458)
'132.46 kb'
Package: path-diag
Path-diagA utility for validating paths in environment variables and modifying them safely.PrerequisitesPython 3InstallationYou can installpath-diagviapip:pip3 install path-diagUsageDiagnose environment variable problemsCheck if$PATHcontains any invalid paths:$ pathdiag$PATHis the default variable to check.You can specify another variable. For example:$ pathdiag --var PYTHONPATHYou can also specify an increased verbosity which will also print the paths that are successfully checked:$ pathdiag -v
✓ /usr/local/bin
✓ /usr/bin
✓ /bin
✓ /usr/sbin
✓ /sbinSafely append/prepend paths to environment variablesYou can use the bash functions in order to take advantage of this features by adding the following line on top of your.bashrc/.zshrcfile:source /usr/local/bin/path-diag-functions.shThen you can use thesafe_append/safe_prependfunctions. For example:safe_append "/usr/local/Cellar/node/7.4.0/bin"
safe_prepend "/usr/local/opt/python/libexec/bin"This will add/usr/local/Cellar/node/7.4.0/binat the end of$PATHif this path passes the validation checks, and will also add/usr/local/opt/python/libexec/binat the beginning of$PATH, again if no errors are identified.ContributingAll contributions are welcomed. Make sure your code passesflake8checks and that is auto-formatted usingblack
Package: pathdict
Extended dict with the capability of accessing and manipulating nested
itens using a path notation.Installationpip install pathdictExamplesYou can change your chained multiple access operator with a dotted path
notation:frompathdictimportPathDictpath_dict=PathDict({'dogs':{'male':'Xablau','female':'Xena'},'enterprises':['B2W','Sieve'],'author':'@diogommartins'})# Same as path_dict['dogs']['female']print(path_dict['dogs.female'])>>>'Xena'Lists are also accessible by the path notation:frompathdictimportPathDictpath_dict=PathDict({'mammalia':{'ferae':{'carnivora':['carnidae','felidae','mustelidae','ursidae','viverridae']},'something':{'wiki':'pedia'}}})# Same as path_dict['mammalia']['ferae']['carnivora'][3]print(path_dict['mammalia.ferae.carnivora.3'])>>>'ursidae'Everything you do with a normal pythondictwill work.CustomizationThe defaultseparatoris.but you can change it using theseparatorkwarg.frompathdictimportPathDictpath_dict=PathDict({'mammalia':{'ferae':{'carnivora':['carnidae','felidae','mustelidae','ursidae','viverridae']},'something':{'wiki':'pedia'}}},separator='/')print(path_dict['mammalia/ferae/carnivora/3'])>>>'ursidae'It is possible to letPathDictgenerate the steps to a given path:frompathdictimportPathDictpath_dict=PathDict(create_if_not_exists=True)path_dict['the.answer.to.all.problems']=42print(path_dict)>>>{'the':{'answer':{'to':{'all':{'problems':42}}}}}Which also works for nested list fields:frompathdictimportPathDictpath_dict=PathDict(create_if_not_exists=True)path_dict['some.letters']=['a','b']path_dict['some.letters.2']='c'print(path_dict)>>>{'some':{'letters':['a','b','c']}}By default, list values inside aPathDictare type casted to apathdict.collection.StringIndexableList. You can change that
behavior with thelist_classkeyword argument. Beware that if thelist_classclass doesn’t implement the StringIndexableList Protocol,
pathdict’s lists path will fail.frompathdictimportPathDictpath_dict=PathDict()path_dict["list"]=[1,2,3]type(path_dict["list"])>>>pathdict.collection.StringIndexableListpath_dict["list.1"]>>>2custom_path_dict=PathDict(list_class=list)type(custom_path_dict["list"])>>>listcustom_path_dict["list.1"]>>>TypeError:listindicesmustbeintegersorslices,notstr
Package: pather
PatherParameters:string- string ("1", "author")Returned OS path:string- directories (e.g.,a/1/e/4/)InstallationpipinstallpatherUsagePather by query:>>>importpather>>>path=pather("string")>>>path'c/3/f/e/'ContributingPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.Make sure to add or update tests as appropriate.UseBlackfor code formatting andConventional Commitsfor commit messages.ChangelogLicenseMIT
Package: pathfind
PathFindImplementation of path finding algorithms including:Depth-First Search (DFS)Breadth-First Search (BFS)Dijkstra SearchGreedy Best-First SearchA*D*-LiteJump Point Search (JPS)InstallpipinstallpathfindBasic UsageDefine a graph to transform graph from a matrix, then find a path from start point to end point. The value inmindicates a cost at that node. Note that the -1 inmrepresents the cost in that node is infinity, which means this
node is not connected to others.importpathfindm=[[1,1,1,1,1],[1,2,-1,1,1],[1,1,1,1,1],[8,3,1,1,1],[1,1,1,1,1],]graph=pathfind.transform.matrix2graph(m)path=pathfind.find(graph,start="4,0",end="0,0")# ['4,0', '4,1', '3,1', '2,1', '2,0', '1,0', '0,0']graph.show(trace=path)Finder can be changed by passing a string method ("a*", "bfs", "greedy", "dijkstra", "dfs", "d*lite", "jps").path=pathfind.find(graph,start="2,2",end="0,2",method="bfs")# ['2,2', '2,1', '1,1', '0,1', '0,2']graph.show(trace=path)Graph setupAnother way to define a graph is to config the edge by give [node1's name, node2's name, cost] pairs.importpathfindconf=[# [node1's name, node2's name, weight, *back_weight]["n1","n2",0.1],["n1","n3",0.2],["n2","n3",0.3]]graph=pathfind.Graph(conf)graph.show()Or you can set edge's and node's details by following way：importpathfindmy_n0=pathfind.Node(name="my_n0")# node name set to "my_n0"auto_name=pathfind.Node()# node name automatically set to "n0"n2="n2"# pass a string to represent node namee0=pathfind.Edge(node1=my_n0,node2=auto_name,weight=0.2)e1=pathfind.Edge(node1=my_n0,node2=n2,weight=0.1)e2=pathfind.Edge(auto_name,n2,weight=0)g=pathfind.Graph()g.add_edges([e0,e1,e2])g.show()g.edges"""{'my_n0:n0': my_n0:n0, 'my_n0:n2': my_n0:n2, 'n0:n2': n0:n2}"""A diagonal grid graph can be generated by following way:importpathfindm=[[1,1,1,1],[1,1,1,1],[1,1,1,1],]graph=pathfind.transform.matrix2graph(m,diagonal=True)path=pathfind.find(graph,start="0,0",end="2,3")# ['0,0', '1,1', '2,2', '2,3']graph.show(trace=path)More examplesMore examples and usages can be found intest
Package: pathfinder
A utility to find file paths.Examplesfrompathfinderimportfind_paths# get all directories and sub-directories in current directorypaths=find_paths(".",just_dirs=True)# get all files in the current directory and all sub-directoriespaths=find_paths(".",just_files=True)# get all jpg files using a regexpaths=find_paths(".",regex=".*\.jpg$")# get all jpg files using posix wildcardspaths=find_paths(".",fnmatch="*.jpg")# get all jpg files and png filesfrompathfinderimportFnmatchFilterfrompathfinderimportOrFilterjpg_filter=FnmatchFilter("*.jpg")png_filter=FnmatchFilter("*.png")gif_filter=FnmatchFilter("*.gif")image_filter=OrFilter(jpg_filter,png_filter,gif_filter)paths=find_paths(".",filter=image_filter)# shortcut using bitwise orpaths=find_paths(".",filter=jpg_filter|png_filter|gif_filter)# even shorter using ImageFilter to find all imagesfrompathfinderimportImageFilterpaths=find_paths(".",filter=ImageFilter())# and an even shorter waypaths=ImageFilter().find(".")InstallationTo install pathfinder, simply:$pipinstallpathfinderDevelopmentTo install development dependencies run:$pipinstall-rdev-requirements.txt
Package: pathfindwithinspace
#Developer : Avik Das, ISB, HYD, Data Scientist##Steps to run the package :'''
Note : This function will work for exclusively packages \n
where you need to shift from one location        \n
to another location frequently for Logic needs.  \n
Function is not case-sensistive                  \nsequence_no : Pass the number of steps you want to go back                                           \n
Start with : 0 which is just the home directory from where you are running the file    \n
source_path : Pass the source path where you want to perform the action                              \n
Optional : If you have nothing to pass it will get default current working directory ) \n
target_path : Pass the absolute path / list of folders as a sequence you want to traverse as a list  \n
Example : For multiple folders --> ['folder1','folder2','folder3',....]                \n
For Single absolute path --> folder1/folder2/folder3/.....                   \n
( Optional : If you are finding something within just earlier directory )              \n
file_name   : Pass the exact file name or it will return all files as a list                         \n
with extensions that you will pass as next parameter                                   \n
( Optional : If you need to access exact file only )                                   \n
extension   : Pass the extension of the file you want to use                                         \n
( Optional : If you only need to go to path )                                          \n
Example : txt, py, png etc...
'''Ex :
from pathfindwithinspace import pathfinderIf you need to know package working directory and need to do something within it :
print(str(pathfinder.find_file(0,'','','','py')[0]))If you need to do something within your own designated directory from where the .py file is running :
print(str(pathfinder.find_file(0,os.path.abspath(file),'','','py')))*Return the exception details as well *
Package: pathfix.py
Using Linux? Tired of receiving emails with links to files of the formX:\some%20path\on\remote%20share\spreadsheet.xls? Then we can help!pathfix.pytakes an unusable path as input and prints a useful one as output. That’s it.It can handle Windows drive prefixes (if configured), and will also sort outfile://andsmb://prefixes.Should work with Python 2.4 - 3.3 and pypy (probably more, but that’s as far as it’s been tested).InstallationInstall system-wide withsudo pip install pathfix.pyorsudo easy_install pathfix.py.
This will put an executable namedpathfix.pyinto your$PATH.ConfigurationYou need to create aconfig.inifile that contains the root of your network mounts and any drive mappings (seeconfig.example.inior the example below to get started).By default,pathfix.pywill check for$HOME/.config/pathfix/config.ini, so it’s best to keep your config there.
If you are installing from source, you can also just keep aconfig.iniin the source tree next topathfix.py.We assume all your network shares are mounted under a common root, with the form:/<network mount root>/<host name>/<share name>If you installed from source, you may find it helpful to symlinkpathfix.pyto/usr/local/binor somewhere else on yourPATH, or you can justpython setup.py installand you’ll get thepathfix.pyexecutable on your path.UsageFor example, if you have this in yourconfig.ini:[main]network_root=/media/network[drive_maps]x=host1:share1y=host2:share2Then you can do, for example:%pathfix.py"X:\some%20path\on\remote%20share\spreadsheet.xls"/media/network/host1/share1/some path/on/remote share/spreadsheet.xlsWhich you can use in subshells to fix arguments to other applications, for example:%libreoffice"$(pathfix.py"X:\some%20path\on\remote%20share\spreadsheet.xls")"DevelopmentPull requests are welcome, but please do include test cases that cover any updates.There are no requirements unless you’re using Python 2.4-2.6, or 3.0-3.1, in which case (if you’re installing from source) you need to installargparse:pip install -r requirements.txtTo make sure it all still works, run the tests:python setup.py test
Package: pathflowai
Welcome to PathFlowAI 👋A Convenient High-Throughput Workflow for Preprocessing, Deep Learning Analytics and Interpretation in Digital Pathology🏠HomepageNOTE: MedRxiv manuscript and set-up wiki will be posted on this repository shortly! Stay tuned!InstallFirst, installopenslide.pipinstallpathflowaiUsagepathflowai-preprocess-h
pathflowai-train_model-h
pathflowai-monitor-h
pathflowai-visualize-hSeeWikifor more information on setting up and running the workflow.Author👤Joshua LevyGithub:@jlevy44🤝 ContributingContributions, issues and feature requests are welcome!Feel free to checkissues page.
Package: pathflow-mixmatch
PathFlow-MixMatchImproved giga-pixel WSI registration through automated segment-based registration. Proof-of-concept pipeline, would love your contributions!Currently under review and additional validation, Biorxiv:https://www.biorxiv.org/content/10.1101/2020.03.22.002402v1UPDATE: We are in the process of updating this repository with the necessary level of documentation and adding a Wiki page, stay tuned!
Package: path_helpers
path_helpersProvides helper class for working with file paths.Thepath_helpers.pathclass provides an object-oriented approach to file-path
operations, as opposed to using the procedural [os.pathAPI][1].CreditsThis package is forked from Jason Orendorff’s [path.py2.2 package][2].__Note__ There are several other forks of [path.py][2] that have likely added
more functionality.[1]:http://docs.python.org/2/library/os.path.html[2]:https://pypi.python.org/pypi/path.py/2.2
Package: pathimp
pathimpImport Python modules from any file system path.Installationpip3installpathimpUsageimportpathimppathimp.import_module(name='my_module',# Name of the module directory or file.path='../path/to/parent/dir',# Path or list of paths to search.notfound='error')# Raise 'error' or 'ignore' when not found.importmy_moduleBackgroundWhen usingimport, Python tries to find the module insys.path. Additional
search directories can be added tosys.pathor specified via thePYTHONPATHenvironment variable. This solution works well in many cases. However, adding
directories tosys.pathmakes all modules inside the added directories
available to import. This pollution of the import path can lead to accidentally
importing undesired packages. Thepathimppackage allows importing packages
from a file system path without polluting the Python import path.DetailsAfter callingpathimp.import_module(), the module is available insys.modulesand can be imported normally by later code. The function also
returns the module, allowing to use it directly without further import:importpathimpmy_module=pathimp.import_module('my_module','../path/to/parent/dir')If the module is not found as a directory or file under the provided path, aModuleNotFoundErroris raied. The exception can be disable by passing thenotfound='ignore'argument:pathimp.import_module('my_module','../path/to/parent/dir',notfound='ignore')Whether the import succeeded can still be found out by looking at the return
value, which is either the module instance orFalseif the module was not
found.
Package: pathimport
pathimportThis simple python module allows to elegantly handle project imports on python without headaches.Why pathimport?Using import statements inside python projects can lead to numerous headaches and subtle problems. Importing in python requires a deep understanding of how the interpreter loads other modules and scripts on runtime. A misuse of imports can lead to problems when your project is deployed outside your development environment; and even before that, imports can hide many pitfalls. This package wants to simplify the life of python users, allowing them to perform imports from other scripts of the same project effortlessly.InstallationThe pathimport module can be installed through pip.pip install pathimportUsageLet's suppose to have a python project with the following structure.module
├── submodule_a                            
│   └── script_a.py                    
├── submodule_b
│   └── script_b.py
└── common.pyInsidecommon.pywe have defined the following function,deffun_common():# do things...while inscript_a.pywe have defined the following.deffun_a():# do things...To avoid the usage of relative imports, pathimport can be used to load these functions insidescript_b.py.frompathimportimportset_module_rootset_module_root("..")# from now on all the imports can be# perfomed from the module rootfromcommonimportfun_commonfromsubmodule_aimportfun_aif__name__=="__main__":fun_common()fun_a()Optionally, the module/project name can be used as a prefix.frompathimportimportset_module_rootset_module_root("..",prefix=True)frommodule.commonimportfun_commonfrommodule.submodule_aimportfun_aUnder The HoodTo resolve the interpreter import ambiguities,set_module_rootof pathimport modifies thePATHenvironment variable to point to the module root (or to the preceding directory ifprefixis set toTrue). For this reason, the interpreter will be able to correctly localize and import your scripts from the filesystem, without additional problems that can arise depending on the current working directory, or if the source code is launched as a script or as a module.Additional ResourcesStack Overflow question on relative imports
Package: pathinby
PathinBy is a tiny tool (used as a command line app or a Python module),
that converts your directory structure into a nice formatted tree to use in your blog posts or other illustrations.You need Python 2.7+ or Python 3.x to run this moduleHow to useImagine you have a directory structure like this:As a Python module>>> import pathinby
>>> tree = pathinby.create_path('Cats')
>>> print ('\n'.join(tree))Here we’ve passed the directory name as an argument, there are also other arguments you can use to customize the behavior of the module, you can change those “|” and “-|” and specify an output file. Check function documentation in the source code for more details of the usage.create_path()returns an array to give more freedom of use in different situations.This gives the output:|-Big
| |-Simba.bcat
|-Sylvester.cat
|-Tom.catAs a commend line tool$ pathinby -s CatsThis will traverse the “Cats” directory and print the contents tree to the terminal window, so running this command prints out the same directory tree like above.the directory name can be a full or a relative path, like we did here.By default, pathinby will do its work on the current directory if no directory is specified, in this case we specified “Cats”.Thesoption means “show”, prints the output to the terminal.Other option is-o {path to file} -> writes the output to the specified fileUsepathinby -hanytime for help on using the command.