Saravanan666/pypi-org huggingface dataset:
Package: named-array
named_arrayThis is a python module that extends numpy array to be able to have column names to index with.Installationpip install named_arrayNote that you need to have numpy installed already to use this module.Usageimportnumpyasnpfromnamed_arrayimportnamed_array# the keyword arguments for named_array are exactly the same with numpy array,# but with an extra keyword `colnames`, which is a list of the column names for each columnA=named_array([[1,2,3],[4,5,6]],colnames=['a','b','c'])>>>Anamed_array([[1,2,3],[4,5,6]])# you can index a column by name>>>A['a']named_array([1,4])# you can extract several columns as a new array# by a tuple or a list of column names>>>A['a','b']array([[1,2],[4,5]])>>>A[['a','b']]array([[1,2],[4,5]])# set the column names of the named_arrayA.set_colnames(['a1','b1','c1'])# you can also put a numpy array into the name_array constructor# and turn it into a named_arrayB=np.array([[1,2,3],[4,5,6]])C=named_array(B,colnames=['a','b','c'])# the column name could also be a tuple, where the first element is the column name,# the second element is the number of columns the column name spansA=named_array([[1,2,3],[4,5,6]],colnames=['a',('b',2)])>>>A['b']named_array([[2,3],[5,6]])
Package: named-arrays
named-arraysnamed-arraysis an implementation of anamed tensor, which assigns names to each axis of an n-dimensional array such as a numpy array.When using a Numpy n-dimensional array, the programmer must manually keep track of the physical meaning of each axis in the array.
Furthermore, it is often necessary to insert singleton dimensions at the end of the array to allow it to broadcastable against other arrays.
Named tensors solve this problem by giving each axis a name, which allows for automatic axis alignment without the need for inserting extra dimensions.named-arraysprovides a very unapologetic implementation of a named tensor, since axes canonlybe accessed using their names,
unlikexarraywhich allows for both name and index.FeaturesScalarArray, a named tensor implementation with Astropy Quantity support. Analogue ofxarray.VariableUncertainScalarArray, a named tensor implementation with automatic uncertainty propagation.Cartesian2dVectorArray, representation of a 2D vector.Cartesian3dVectorArray, representation of a 3D vector.FunctionArray, representation of a discrete function. Analogue of anxarray.DataArrayInstallationnamed-arraysis available on PyPi and can be installed using pippipinstallnamed-arraysExamplesScalarArrayThe fundamental type ofnamed-arraysis theScalarArray, which is a composition of a numpy ndarray-like object and a tuple of axis names which must have the same length as the number of dimensions in the array.importnumpyasnpimportnamed_arraysasnaa=na.ScalarArray(np.array([1,2,3]),axes=('x',))If we create another array with a different axis name, it will be broadcasted automatically against the first array if we add them togetherb=na.ScalarArray(np.array([4,5]),axes=('y',))c=a+bcScalarArray(
    ndarray=[[5, 6],
             [6, 7],
             [7, 8]],
    axes=('x', 'y'),
)All the usual numpy reduction operations use the axis name instead of the axis indexc.mean('x')ScalarArray(
    ndarray=[6., 7.],
    axes=('y',),
)To index the array we can use a dictionary with the axis names as the keysc[dict(x=0)]ScalarArray(
    ndarray=[5, 6],
    axes=('y',),
)ScalarLinearSpaceWe recommend that you rarely directly create instances ofScalarArraydirectly. Instead, you can use the implicit array classes:ScalarLinearSpace,ScalarLogarithmicSpace, andScalarGeometricSpaceto create arrays in a similar fashion tonumpy.linspace(),numpy.logspace(), andnumpy.geomspace()with the advantage of being able to access the inputs to these functions at a later point.d=na.ScalarLinearSpace(0,1,axis='z',num=4)dScalarLinearSpace(start=0, stop=1, axis='z', num=4, endpoint=True)Thses implicit array classes work just likeScalarArrayand can be used with any of the usual array operations.a+dScalarArray(
    ndarray=[[1.        , 1.33333333, 1.66666667, 2.        ],
             [2.        , 2.33333333, 2.66666667, 3.        ],
             [3.        , 3.33333333, 3.66666667, 4.        ]],
    axes=('x', 'z'),
)
Package: named-bitfield
named_bitfield lets you define fixed width bit fields within an integer, and
address those fields as class attributes, while still providing access to the
backing integer representation.  The original use case for this is
“intellignet IDs”.  Essentially, this is a unique numeric id, sutiable for use
as a database primary key, which encodes some information about the object it
identifies.  Obviously, this should be immutable information so your IDs don’t
change or (worse) get out of sync with reality.  Some suggestions are the
object type, the create time, or the data source.  Saving a few bits for a
serial counter is also advisable, as timestamps aren’t reliable as unique ids.
Package: named_constants
This module offers an easy way to define named constants in Python,
supporting some simple enum-like use case, as well as arbitrary value
types like strings or floats.  It is rather simple to use and does not
have a big footprint, but supports the following features:Ease of use (a simple class for scoping, plain definitions inside)Enumeration of defined constantsValues know theirname, i.e. you don’t have to guess which meaning
the constant value 3 has (e.g. it’s name() will be ‘blue’ and its
__repr__ will format as ‘Colors.blue’)Arbitrary value types (not just integers)Constant-ness (no change after time of definition)
Package: named-env
named-envClass-based environment variables typed specification.Installationpipinstallnamed-envUsage examplefromnamed_envimportEnvironmentNamespace,RequiredIntegerimportosclassWebApplicationEnvironmentNamespace(EnvironmentNamespace):WEB_SERVER_PORT=RequiredInteger()env=WebApplicationEnvironmentNamespace()if__name__=="__main__":os.environ["WEB_SERVER_PORT"]="80"print(env.WEB_SERVER_PORT)# 80print(type(env.WEB_SERVER_PORT))# int
Package: namedex
NamedexSoundex implemented in Python.Free software: GNU General Public License v3Documentation:https://namedex.readthedocs.io.FeaturesConvert names into a soundex.CreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.History0.1.0 (2019-05-23)First release on PyPI.
Package: namedframes
namedframesBasic type annotation support for Pandas and Spark data frames.
The goal is to provide a convenient way to specify a name-to-type mapping.
The assurance that the columns conform to the types is left to the user,
i.e. this providesnameddata frames, nottypeddata frames.InstallationpipinstallnamedframesUsagePandasimportpandasaspdfromnamedframesimportPandasNamedFrameclassInputDF(PandasNamedFrame):x:floatclassOutputDF(InputDF):blah:booldeftransform(input_data:InputDF)->OutputDF:returnOutputDF(input_data.assign(blah=True))input_df=InputDF(pd.DataFrame({"x":[1.1,2.2]}))output=transform(input_df)isinstance(input_df,InputDF)Trueisinstance(output,OutputDF)TrueIf a column is missing, a validation error occurs,OutputDF(input_df)ValueError:missingcolumns:[('blah',<class'bool'>)]Sparknamedframesincludes an option for pyspark dataframes.
Using it requires installation ofpyspark. You can install this
separately or with the[pyspark]flag tonamedframes, i.e.,pipinstallnamedframes[pyspark]Example usage:import pandas as pd 
from pyspark.sql import SparkSession
from namedframes import SparkNamedFrame 

class InputDF(SparkNamedFrame): 
    x: float 

spark = SparkSession.builder.getOrCreate()
spark_df = spark.createDataFrame(pd.DataFrame({"x": [1.1, 2.2]}))                                                      
input_df = InputDF(spark_df)
Package: namedivider-python
namedivider-pythonNameDivideris a tool for dividing the Japanese full name into a family name and a given name.input: 菅義偉 -> output: 菅 義偉NameDivider divides the name using statistical information of the kanji used in the names.Measuring the accuracy using a privately held data set, the accuracy is 99.91%.You can see how it works withthis demo.DocumentsNameDivider(日本語)Installationpip install namedivider-pythonUsageIt's simple to use.fromnamedividerimportBasicNameDivider,GBDTNameDividerfrompprintimportpprintbasic_divider=BasicNameDivider()# BasicNameDivider is fast but accuracy is 99.2%divided_name=basic_divider.divide_name("菅義偉")gbdt_divider=GBDTNameDivider()# GBDTNameDivider is slow but accuracy is 99.9%divided_name=gbdt_divider.divide_name("菅義偉")print(divided_name)# 菅 義偉pprint(divided_name.to_dict())# {'algorithm': 'kanji_feature',# 'family': '菅',# 'given': '義偉',# 'score': 0.7300634880343344,# 'separator': ' '}NameDivider APINameDivider API is a Docker container that provides a RESTful API for dividing the Japanese full name into a family name and a given name.I am developing NameDivider API to provide NameDivider functionality to non-Python language users.Installationdocker pull rskmoi/namedivider-apiUsageRun Docker Imagedocker run -d --rm -p 8000:8000 rskmoi/namedivider-apiSend HTTP requestcurl -X POST -H "Content-Type: application/json" -d '{"names":["竈門炭治郎", "竈門禰豆子"]}' localhost:8000/divideResponse{
    "divided_names":
        [
            {"family":"竈門","given":"炭治郎","separator":" ","score":0.3004587452426102,"algorithm":"kanji_feature"},
            {"family":"竈門","given":"禰豆子","separator":" ","score":0.30480429696983175,"algorithm":"kanji_feature"}
        ]
}Noticenamesis a list of undivided name. The maximum length of the list is 1000.If you require speed or want to use GBDTNameDivider, please tryv0.2.0-beta.CLIRead namedivider/cli.py for more information.$ nmdiv name 菅義偉
菅 義偉
$ nmdiv file undivided_names.txt
100%|███████████████████████████████████████████| 4/4 [00:00<00:00, 4194.30it/s]
原 敬
菅 義偉
阿部 晋三
中曽根 康弘
$ nmdiv accuracy divided_names.txt
100%|███████████████████████████████████████████| 5/5 [00:00<00:00, 3673.41it/s]
0.8
True: 滝 登喜男, Pred: 滝登 喜男LicenseSource code and gbdt_model_v1.txtMIT Licensefamily_name_repository.pickleEnglish(1) Purpose of usefamily_name_repository.pickle is available for commercial/non-commercial use if you use this software to divide name, and to develop algorithms for dividing name.Any other use of family_name_repository.pickle is prohibited.(2) LiabilityThe author or copyright holder assumes no responsibility for the software.Japanese(1) 利用目的このソフトウェアを用いて姓名分割、および姓名分割アルゴリズムの開発をする場合、family_name_repository.pickleは商用/非商用問わず利用可能です。それ以外の目的でのfamily_name_repository.pickleの利用を禁じます。(2) 責任作者または著作権者は、family_name_repository.pickleに関して一切の責任を負いません。The family name data used in family_name_repository.pickle is provided by Myoji-Yurai.net(名字由来net).Ongoing ProjectsPorting Python to Rusthttps://github.com/rskmoi/namedivider-rs
Package: namedlocks
NamedLocksNamedLocks is a simple library for locking on a name.Installationpip install namedlocksUsageimportasynciofromrandomimportrandint,uniformfromnamed_locksimportAsyncNamedLockNAMED_LOCKS=AsyncNamedLock()# Create a global instance of the lockasyncdeftask(uid:int):asyncwithNAMED_LOCKS.lock(uid):# Lock on some nameprint(f"Task{uid}started")# do somethingawaitasyncio.sleep(uniform(1,5))print(f"Task{uid}finished")asyncdefmain():tasks=[asyncio.create_task(task(uid))foruidin[randint(1,10)for_inrange(50)]]awaitasyncio.gather(*tasks)asyncio.run(main())
Package: namedout
Debug output named valueswarning:not work in python consolenot work in IDLEonly one entry point ofdbgfunction for one source linescript:from namedout import dbg
dbg(dict(a=9))out:dict(a=9) == {'a': 9}script:dbg(list(xrange(9)))out:list(xrange(9)) == [0, 1, 2, 3, 4, 5, 6, 7, 8]script:import os
import sys
a = 1
dbg(a, os.__name__, dir(os.path)[0], sys.modules.keys()[0])out:a == 1
os.__name__ == os
dir(os.path)[0] == __all__
sys.modules.keys()[0] == tokenize
Package: namedparser
[![Build Status](https://travis-ci.org/hachibeeDI/namedparser.svg?branch=master)](https://travis-ci.org/hachibeeDI/namedparser) [![Coverage Status](https://coveralls.io/repos/hachibeeDI/namedparser/badge.svg?branch=master&service=github)](https://coveralls.io/github/hachibeeDI/namedparser?branch=master)# namedparserRead name-daemon configuration files like the bind# Installation```bash$ pip install https://github.com/hachibeeDI/namedparser/archive/master.zip```# Example```pythonfrom namedparser import Parsertxt = '''options {directory "/var/na/named";check-names master ignore;check-names slave ignore;check-names response ignore;allow-recursion {any;};allow-query {any;};allow-query-cache {any;};allow-transfer { 127.0.0.1; };max-cache-ttl  3600000;min-retry-time  50;max-acache-size 4M;max-cache-size 4M;max-journal-size 100k;version "";};'''result = Parser.parse_string(txt)options = result.search('options')check_names = options[0].search('check-names')assert check_names[0].target == 'master'assert check_names[1].target == 'slave'assert check_names[2].target == 'response'directory = options[0].search('directory')[0]assert directory.value == '/var/na/named'assert str(directory) == 'directory "/var/na/named";'```You may get more information how to acceess some nodes in `named.conf`, if you read test code in `namedparser/testsuite/test_parser.py`.# SupportYou may run on- 2.6- 2.7- 3.*
Package: namedpath
NamedPathThis is a module which can help you to configure folder structure with named patterns.
No more absolute paths in scripts, no more hard coding.
Withnamedpathyou can generate paths via names with variables context!importnamedpath# create list of patterns with inheritancepath_list=dict(PROJECT='{PROJECT_NAME}',SHOTS='[PROJECT]/shots',SHOT='[SHOTS]/{SHOT_NAME}',LAYOUT='[SHOT]/layout',LAYOUT_PUBLISH='[LAYOUT]/publish/{SHOT_NAME|lower()}_v{VERSION:04d}/{SHOT_NAME|lower()}.exr',RENDER='[SHOT]/render',RENDER_PUBLISH='[RENDER]/{VERSION:04d}/{FILE_NAME}_{FRAME}.{EXT}',)# create tree instancetree=namedpath.NamedPathTree('~/my_projects',path_list)# define contextcontext={'project_name':'project1','shot_name':'sh01','file_name':'test_render','version':15,'ext':'exr','frame':'%04d'}# now you can generate pathprint(tree.get_path('RENDER_PUBLISH',context))# C:\Users\username\my_projects\project1\shots\sh01\render\0015\test_render_%04d.exr# you can change any patterns and no need change the code after thatpath_list['RENDER_PUBLISH']='[RENDER]/publish/v{VERSION:05d}/{SHOT_NAME}_rnd_{FRAME}.{EXT}'tree=namedpath.NamedPathTree('~/my_projects',path_list)printtree.get_path('RENDER_PUBLISH',context)# C:\Users\username\my_projects\project1\shots\sh01\render\publish\v00015\sh01_rnd_%04d.exrAny  pattern can be inherited from other patternEach structure can have a different pattern set, but it will work with the same codeSupport generic string formatting and string methods callCreating folder structure with context and partial context# formattingpat1='[PARENT]/{VARIABLE:04d}'# string methodspat2='[PARENT]/{VARIABLE|strip()|upper()}'# string methods with argumentspat3='[PARENT]/{VARIABLE|center(10, "_")}'Project still underdevelopedAlternativeshttps://gitlab.com/4degrees/lucidity
Package: namedpipe
namedpipeCross-platform named pipe manager for PythonPython only natively supports named pipes in Posix systems viaos.mkfifo. This package extends the support to Windows and defines aNPopenclass as a cross-platform solution to manage named pipes.InstallationpipinstallnamedpipeUsageimportsubprocesasspfromnamedpipeimportNPopen# 1. Use the context-managing `NPopen` class to open an (auto-)named pipe#    - specify the mode argument with the standard notation (see built-in open())withNPopen('r+')aspipe:# bidirectional (duplex) binary pipe# - for an inbound pipe, specify the read access mode 'rb' or 'rt'# - for an outbound pipe, specify the write access mode 'wb or 'wt'# 2. Get the pipe path via pipe.path or str(pipe) to start the client programsp.run(['my_client',pipe.path])# auto-generated pipe paths (incremental integer pipe #):# - Posix: $TMPDIR/pipe[a-z0-9_]{8}/[0-9]+ (random pipe directory name)# - Windows: \\.\pipe\[0-9]+# 3. Wait for the client to connect and create a stream#    - accepts other open() arguments: buffering, encoding, error, newline#    - blocks until connection is established#    - returns an io-compatible streamstream=pipe.wait()# 4. Perform read/write operation with stream (or pipe.stream) as a file-like objectb=stream.read(64)b=pipe.stream.read(64)# alternatein_bytes=bytearray(128)nread=stream.readinto(in_bytes)b_rest=stream.readall()stream.write(out_bytes)# 5. automatically closes the stream and destroys the pipe object#    when out of the contenxtAPI ReferenceTBD
Package: namedropper
name-dropper scriptsPython scripts and utilities for looking up names and linking them to
authoritative identifiers.  See the top-levelnamedropperrepository
for more information.Currently usesDBpedia Spotlightfor recognition of named entities in text,
with support for matching identified DBpedia resources (currently only for
Persons) with the equivalent resource inVIAF(Virtual International
Authority File).InstallationWe recommend the use ofpipto install the latest released version of this package and its dependencies:pip install namedropperThis will also make thelookup-namesandcount-nametagsscripts available.More detailed documentation, including script usage information, is available
athttp://namedropper.readthedocs.org/LicenseNameDropper Python module and scripts are distributed under theApache 2.0 License.Developer notesTo install dependencies for your local check out of the code, runpip installin thenamedropper-pydirectory (the use ofvirtualenvis recommended):pip install -e .If you want to run unit tests or build sphinx documentation, you will also
need to install development dependencies:pip install namedropper[dev]To run all unit tests:nosetests   # for normal development
nosetests --with-coverage --cover-package=namedropper --cover-xml --with-xunit   # for continuous integrationTo run unit tests for a specific module, use syntax like this:nosetests test/test_spotlight.pyTo generate sphinx documentation:cd doc
make html
Package: named-sequence
named_sequence - list like object allowing selection by name and indexThis package contains the class NamedSequence.This class reproduces the behaviour of a list (from which it inherits) but most list special functions such as _getitem_ allow name and index as argument.Methods formerly returning list (such as slicing with _getitem_ or copy) now return a NamedSequence instance.NamedSequence instances requires an additional argument : the name of the method of the items to get their name.Basic usageInstanciationfromnamed_sequenceimportNamedSequenceclassNamedItem(object):# Used only to illusrate the behaviourdef__init__(self,name):self.__name=namedefget_name(self):returnself.__namethe_instance=NamedSequence((NamedItem("a"),NamedItem("b")),"get_name")getting or setting itemsa1=the_instance["a"]a2=the_instance[0]a1isa2>>>Truethe_instance["b"]=NamedItem("a")the_instance["b"]=NamedItem("d")# the name "b" no more exists>>>KeyError:"No item named 'b' !the_instance["a"]=NamedItem("a2")# When name are present several time, the fist occurence is consideredforeleminthe_instance:print(elem.get_name())>>>a2>>>a
Package: namedspace
The namedspace factory generates a simple class that encapsulates
a namespace and provides various means to access it.It is inspired by namedtuple (and shamelessly copies some of the
namedtuple code), and was motivated by my realization that I was
often abusing namedtuple, using a namedtuple as a base class for
numerous simple custom classes that I was writing.In these cases, it was the named attribute access and immutability of
the namedtuple that was desirable, and the sequence behavior was not
needed. In fact, when properties were used to override the returned
value of a named attribute, the values available from the underlying
tuple would not match. Fixing this behavior in a sub-class proved much
more difficult than expected, which was especially frustrating since
this was behavior that wasn’t needed anyway.So, namedspace was born. Orginally, I called it “namespace” (without
the ‘d’), but there was already a namespace project on PyPi, and
calling it “namedspace” gives a nod to its namedtuple ancestry.Enjoy!–Warren A. SmithRead the docs:http://namedspace.readthedocs.org/
Package: namedstruct
Module namedstructnamedstruct encapsulates struct.unpack() and struct.pack() with results accessed by name.Classesclass namedstruct.namedstruct__init__( description, struct_definition )Thedescriptionis used to title a dump of unpacked data.struct_definitionis a single string that defines the type and name of each field
as a space seperated list.
Each field’s type and name are seperated by a “:”. If the name is left blank that
field cannot be accessed by name, useful
for padding fields. If a field’s type has a repeat count the value returned with
be a tuple of all the fields parts.len()Returns the size of the struct.unpack( bytes )Unpack thebytesinto a namestruct.namestructresults object used to access the decoded fields.packer( from_unpacked=None )Return a namedstructpacker object that can be used to pack the fields into a buffer.
The optional from_unpacked will initialise the fields from a previously unpacked
buffer.class namedstruct.namedstructresults.*name*Returns the value of the field called name.dump( writer )Using the writer function to output a formatted dump of the whole struct.class namedstruct.namedstructpacker.*name* = valueAssign a value to the named fieldinit_from( from_unpacked )Assign each field from a previous unpacked buffer’s namedstructresults.pack()Pack the fields and return the bytes buffer.Exampleimport namedstruct

# Windows EXE files start with a DOS header
struct_windows_exe_header = namedstruct.namedstruct( 'DOS header', '<'
  '2s:dos_magic '
  'h:lastsize '
  'h:nblocks '
  'h:nreloc '
  'h:hdrsize '
  'h:minalloc '
  'h:maxalloc '
  'H:ss '
  'H:sp '
  'h:checksum '
  'H:ip '
  'H:cs '
  'h:relocpos '
  'h:noverlay '
  '4H:reserved1 '
  'h:oem_id '
  'h:oem_info '
  '10H:reserved2 '
  'L:pe_offset'
  )

dos_image = open( 'c:\\windows\\system32\\cmd.exe', 'rb' ).read()
header = struct_windows_exe_header.unpack( dos_image[0:len(struct_windows_exe_header)] )

if debug:
  header.dump( print )

print( 'dos_magic %r' % (header.dos_magic,) )
print( 'PE header offer: 0x%8.8x' % (header.pe_offset,) )
Package: namedthreads
namedthreadsThis is a hack to propagate thread names set in Python to the system.WARNING: This is only meant for testing/debugging purposes. DoNOTrun in production.The problemYou can name threads in Python like so:import threading

my_thread = threading.Thread(target=my_func, name="my-thread")But when runningps,topand similar, you'll notice that the thread name isn't visible in these tools,
making threading bugs somewhat harder to debug.The solutionA comment inbpo-15500lines out a monkeypatch that usesctypesto set the name usinglibpthread.pthread_setname_np.
While this works beautifully, it hasn't been included in core python due to compatibility reasons. This module packages the monkeypatch in an easy to install package.BeforeAfterUsageInstallpip install namedthreadsManual patchingRun this as early as possible in your code:import namedthreads
namedthreads.patch()Automatic patchingInspired by Graham Dumpleton'sautowrapt, this module can
be activated automatically. Due to thehacky natureof this approach, it is guarded by checking the presence of an environment variable,NAMEDTHREADS.
Automatic patching is only activated if this environment variable is setNAMEDTHREADS=1 python myscript.py
Package: namedtreemap
NamedTreemapjax.tree_map, but for all datatypes and with input namesGetting StartedInstallationpython3-mpipinstallnamedtreemapExamplesimportnamedtreemapasntmfromtypingimportTuple,Anydeffn(prefix:Tuple[Any,...],*items):print(prefix,items)returnitems[0]+1obj={"3":{"2":[1,2]},"1":(0,)}print("Original:",obj)# Original: {'3': {'2': [1, 2]}, '1': (0,)}obj=ntm.named_treemap(fn,obj,obj)# ('3', '2', 0) (1, 1)   -   0 (int) is a list index# ('3', '2', 1) (2, 2)   -   1 (int) is a list index# ('1', 0.0) (0, 0)      -   0.0 (float) is a tuple indexprint("Modified:",obj)# Modified: {'3': {'2': [2, 3]}, '1': (1,)}