Saravanan666/pypi-org huggingface dataset:
Package: binarycalculation
Binary Number CalculationsBinary number calculations is python module for binary number calculations. This library could calculate binary addition, binary subtraction, binary multiplication, binary division. For bonus part, this library could help to convert decimal number into binary number, and vice-versa.InstallationUse the package managerpipto install Binary Number Calculations.
To install, run this command:pip install binarycalculationUsage# import BinaryNumber module
from binarycalculation import binarycalculation

binaryOne = "11110001"
binaryTwo = "11101110"

# binary addition
# result: 111011111
binaryAddition = binarycalculation.processBinaryAddition(binaryOne, binaryTwo)
print(binaryAddition)

# binary subtraction
# result: 11
binarySubtraction = binarycalculation.processBinarySubtraction(binaryOne, binaryTwo)
print(binarySubtraction)

# binary multiplication
# result: 1110000000001110
binaryMultiplication = binarycalculation.processBinaryMultiplication(binaryOne, binaryTwo)
print(binaryMultiplication)

# binary subtraction
# result: 1 
# Remainder : 11
# the processBinaryDivision function return two value, result and remainder.
binaryDivision = binarycalculation.processBinaryDivision(binaryOne, binaryTwo)
print(binaryDivision)

# convert binary number to decimal
# result: 241
binaryToDecimal = binarycalculation.convertBinaryToDecimal(binaryOne)
print(binaryToDecimal)

# convert decimal number to binary
# result: 11110001
decimalToBinary = binarycalculation.convertDecimalToBinary(241)
print(decimalToBinary)ContributingPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.Bug and IssuesIf you discover bug, please create issue onGithub. You are also welcome to contribute if you want.LicenseMIT LicenseCopyright (c) 2023 Josi Kie N.Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Package: binary_clock
OverviewThere are manybinary clocksand watches advertised on the Internet, it is even possible to actually buy wrist binary watches,
for instance inLedwatchstop.
However, as far as I know they are only binary on the surface, measuring the time of the day
conventionally, in hours + minutes. It’s just that those two numbers are somehow represented in binary.Modulebinary_clockprovides an implementation of what I consider a truly binary clock.
The first bit stands for the half of the day, 12 hours. The second, for the a quarter of a day, 6 hours, and so on.
Each bit stands for an interval that is the half of the previous.For instance, 11010000 represents 12 + 6 + 1.5 = 19.5, which means 7:30 PM.Another way to see it is that 0.11010000 is the fraction of the day passed, in binary. So, 0.11010000 = 13/16 of a day.ModesTwo modes are provided. The simplest option is to use flat colors, each bit is shown with a square of that color. The binary clock then
looks like this:Bits should be read left-to-right, top-to-bottom. With this 4x4 format, it is suitable to stand as one icon more on the desktop.If you want to get fancy, the second mode allows you to choose any two equal-size images, one for on-bit and another for off-bit, getting something like:UsageAll the code is in filebinclockWrapper.py, launched by command line scriptbinclock.py. The arguments supported aregeometrymandatory argument of the form axb, where a and b are integer numbers. It provides the size of the grid of bits.offsetstring that provides the initial offset from the bottom-right corner of the screen. For instance, ‘-1-43’ is 1 pixel to the left
and 43 upwards. Clocks are draggable, you can move them once created.sideandcolorFor theflatmode.
In the latter case,sideis the number of pixels per side, andcolora string in format ‘#rrggbb’ in hexadecimal.
For instance, yellow is ‘#00ffff’.imageonandimageoffStrings for filenames, for theimagemode. If provided, optionssideandcolorare ignored.borderwidthis the width of each bit inside its frame, in number of pixels.bgcoloris the color of the frame, in ‘#rrggbb’ format.persistentis a flag that, if present, forces the clock to always stay on top of other windows.ExamplesFlat mode:binclock--color=#30a0ff --side=10 --borderwidth=2 --bgcolor=#808080 --geometry=4x4 --persistentImage mode:binclock--imageon=light_green_button.jpg--imageoff=dark_green_button.jpg--borderwidth=3--bgcolor=#808080 --geometry=1x12ObservationsThe blinking frequence of each bit is twice that of the previous bit. With 16 bits, the last one stands for 2^-16 days, more or less 1.318 seconds.
So, 16 bits is the closest you can get to the typical hours + minutes + seconds watch. If the value provided forgeometrycontains too many bits:The consumption of CPU time will be noticeableThe computer/screen might not be fast enough to refresh bits with the speed that would be required.In tests I performed, that limit of reasonable behaviour seems to be around 22 bits, but there seems to be little
point in using that many.CollaborationYou may wish to improve or add features, in that case you are more than welcome, feel free to contact me atzeycus@gmail.com.
Package: binaryconv
binaryconv.pyThe goddamn best binary converter for Python 3*.>>> import binaryconv.convertbin
>>> binaryconv.convertbin.text_to_bits('Hello')
'0100100001100101011011000110110001101111'
>>> binaryconv.convertbin.text_from_bits('0100100001100101011011000110110001101111')
'Hello'
>>>Works well, not even replys a binary string.Multiple encoding also is supported.*only because we have no competion
Package: binaryconv-dev01111
binaryconv.pyThe goddamn best binary converter for Python 3*.>>> import binaryconv.convertbin
>>> binaryconv.convertbin.text_to_bits('Hello')
'0100100001100101011011000110110001101111'
>>> binaryconv.convertbin.text_from_bits('0100100001100101011011000110110001101111')
'Hello'
>>>Works well, not even replys a binary string.Multiple encoding also is supported.*only because we have no competion
Package: binaryconverter
binaryconverterTable of ContentsDescriptionBuilt WithGetting StartedPrerequisitesInstallationUsageLicenseAcknowledgementsContactsDescriptionConvert your String or Integer to Binary. Or convert your binary to stringScreenshots## Built WithGetting StartedGet started by the installing the product itself. Then you can simply convert your String to Binary, or vice versa. Got an integer? No Problem.PrerequisitesNo external software/imports have been used. All is pure python.InstallationYou can import it simply by the following statementpip -m install binaryconverterimport binaryconverterUsageThere are three commands possiblestringToBinary(str)example usage :print(stringToBinary('Hello World'))expected output:0100000101011101101111011100100110110001100100001000011001010110110001101100011011110010Usage :utf-8binaryToString(str)example usage:print(binaryToString('0100000101011101101111011100100110110001100100001000011001010110110001101100011011110010)expected output:'Hello World'Usage:utf-8intToBinary(int)example usage:print(intToBinary(69420))expected output:001101000011001000110000Usage;utf-8LicenseMIT LicenseAcknowledgementsId like to thank @skybird2333 for helping meContacts#\x00 \x00b\x00i\x00n\x00a\x00r\x00y\x00c\x00o\x00n\x00v\x00e\x00r\x00t\x00
\x00
\x00
Package: binaryen.py
Binaryen.pyBinaryen.py is a python wrapper forBinaryen. Use this to create, optimise and interpret WebAssembly binaries in python.InstallationFirst make sureBinaryenis installed and accessible from your path. For Linux/MacOS it's recommended to install it from your package manager orhomebrew(on MacOS). Alternatively, downloadprecompiled binariesof Binaryen.Install through PyPI.pipinstallbinaryen.pyTestpytest--doctest-modules--doctest-continue-on-failureFormatblack--extend-excludebinaryen/_binaryen_cffi.py.DocsmkdocsserveUpdating the Python header fileGet the latest binaryen header file and binaries.Comment out#include <stdbool.h>,#include <stddef.h>and#include <stdint.h>cpp-nostdinc-E-Pbinaryen-c.h|sed'/^\/\//d; s/##//g; s/;;/;/g;'|tr'\n'' '|sed'1s/^[[:space:]]*//; s/  */ /g;s/; /;\n/g;'|sed'/^__attribute__((deprecated))/d'|clang-format-style"{ColumnLimit: 0}">binaryen-py.hThis cleans up the header file and removes deprecated codeReplace Union types with the largest type of that Union. E.g.structBinaryenLiteral{uintptr_ttype;union{int32_ti32;int64_ti64;floatf32;doublef64;uint8_tv128[16];constchar*func;};};BecomesstructBinaryenLiteral{uintptr_ttype;uint8_tv128[16];};Build the cffi interface by runningpython binaryen_build.py
Package: binary-file-parser
BinaryFileParserBinaryFileParser allows the user to create a binary file format specification in the form of a struct and then use it to
read/write files.InstallationOn Linux:$python3-mvenvvenv
$sourcevenv/bin/activate
$pipinstallbinary-file-parserOn Windows:>py-mvenvvenv
>venv/Scripts/activate
>pipinstallbinary-file-parserGetting StartedThis is a very basic script to give you an idea of how to use this library. Check out the API Reference (coming soon™) for documentation containing more details on how to use this library.frombinary_file_parserimportBaseStruct,Retrieverfrombinary_file_parser.typesimportuint32,uint64,str32,FixedLenStrclassSpam(BaseStruct):file_version:str=Retriever(FixedLenStr[4],default=0)creator_name:str=Retriever(str32,default=0)saved_timestamp:int=Retriever(uint64,default=0)eggs:int=Retriever(int32,default=0)# read a binary file that has the above formatfile=Spam.from_file("path/to/file")# modify the creator namefile.creator_name="Alian713"file.eggs=20# write the modified data to a new filefile.to_file("path/to/write/to")A Slightly More Complex ExampleThe main magic of this library is that:You can use your own structs within another structEvent hooks help you keep any interdependencies in the file structure synchronised:from__future__importannotationsfrombinary_file_parserimportBaseStruct,Retrieverfrombinary_file_parser.typesimportFixedLenArray,uint8classPixel(BaseStruct):red:int=Retriever(uint8,default=0)green:int=Retriever(uint8,default=0)blue:int=Retriever(uint8,default=0)alpha:int=Retriever(uint8,default=0)def__init__(self,red:int,green:int,blue:int,alpha:int=0,):super().__init__(initialise_defaults=False)self.red=redself.green=greenself.blue=blueself.alpha=alphaclassImg(BaseStruct):@staticmethoddef_set_width(retriever:Retriever,obj:Img):# here Img.pixels.dtype refers to FixedLenArrayImg.pixels.dtype.length=obj._width@staticmethoddef_set_height(retriever:Retriever,obj:Img):# The repeat value defines how many times a single retriever should read dataRetriever.set_repeat(Img.pixels,obj,obj._height)@staticmethoddef_update_dims(retriever:Retriever,obj:Img):# this ensures that when the file is written back, the height and width being written back to file are# up to dateobj._height=obj.heightImg.pixels.dtype.length=obj._width=obj.width_width:int=Retriever(uint32,default=100,on_read=[_set_width],on_write=[_update_dims])_height:int=Retriever(uint32,default=200,on_set=[_set_height])pixels:list[list[Pixel]]=Retriever(FixedLenArray[Pixel,100],default=[Pixel(0,0,0)for_inrange(100)],repeat=200)@propertydefwidth(self)->int:returnlen(self.pixels[0])@propertydefheight(self)->int:returnlen(self.pixels)# Make a new image from all defaultsa=Img()# Note: Mutable defaults will be shallow copied, (this means all rows of pixels in the above example are the same!)# If you have larger structs or nested structs, use default_factory (coming soon:tm:) insteadAbout the AuthorIf you have any questions, suggestions or feedback regarding the library, feel free to send me a message on discord!AuthorDiscordAlian713Alian713#0069
Package: binary-magic-squares
Binary Magic Squares generationtl;dr: Efficient algorithm for generating Binary Magic Squares (boolean matrices whose sum of all rows and columns are equal).Two implementations are provided.
The first one has minimal requirements and enables to easily generate a Binary Magic Square.
The second one has a more advanced implementation and can take advantage of parallel GPU computing to generate many Binary Magic Squares efficiently.Installationpipinstallbinary-magic-squaresThe default implementation relies onNumPy.
If not installed, it will be automatically installed while installing this package.The batched implementation relies onPyTorch.
Please install it beforehand if you want to use this implementation.
You do not need to install it if you want to use only the default implementation.UsageDefault implementationimportnumpyasnpfrombinary_magic_squaresimportgenerate_bms,is_bms# Generate a 5x5 array whose sum of each row and each column equals 2bms1=generate_bms(2,5)# Generate a 4x8 array whose sum of each row (resp. column) equals 3 (resp. 6)bms2=generate_bms(3,4,8)not_bms=np.array(np.array([[1,0,1],[0,1,0],[0,0,1]],dtype=bool))# Check whether input arrays are BMS or notprint(is_bms(bms1))# Trueprint(is_bms(bms2))# Trueprint(is_bms(not_bms))# Falseprint(is_bms(np.eye(3)))# TruePyTorch implementationimporttorchfrombinary_magic_squares.pytorchimportgenerate_bms,is_bms# Generate a 5x5 tensor whose sum of each row and each column equals 2bms1=generate_bms(2,5)# Generate a 5x5 tensor whose sum of each row and each column equals 4bms2=generate_bms(4,5)# Generate a 4x8 tensor on GPU 0 whose sum of each row (resp. column) equals 3 (resp. 6)bms3=generate_bms(3,4,8,device=torch.device("cuda:0"))# Generate in parallel a batch of 128 15x15 boolean tensors on GPU 1 whose sum of each row and column equals 11bms_batch=generate_bms(11,15,num_masks=128,device=torch.device("cuda:1"))not_bms=torch.tensor([[1,0,1,1,0],[0,1,1,0,1],[1,1,1,0,0],[0,0,1,1,1],[1,1,0,0,1]],dtype=torch.bool)# Check whether input arrays are BMS or notprint(is_bms(bms1))# Trueprint(is_bms(bms2))# Trueprint(is_bms(bms3))# Trueprint(is_bms(not_bms))# Falseprint(is_bms(bms_batch))# True, performs test in parallelprint(is_bms(torch.stack([bms1,bms2])))# True even if the sum of the rows of bms1 and bms2 is differentprint(is_bms(torch.stack([bms1,not_bms])))# False since one of the tensors is not a BMS
Package: binarymeshformat
Binary Mesh FormatThis is a small python library implementation for reading and writing triangulated meshes.Usageimport binarymeshformat as bmf

meshTracks = bmf.loadMeshes(filename)That will return a list of mesh tracks.Track structureA track has a name and a map. The name is just a string and the map maps integers to meshes.Mesh structureThe mesh contains points in 3D space and their connections. It uses 3 aspects:positions which is an array of x,y,z coordinates.connections which is an array of indexes indicating two points are connected. Two indexes per connection.triangles an array of indexes, three indexes per triangle.File FormatA .bmf file contains mesh tracks, where a track is a collection of meshes over time, a mesh
is a set positions, connections, and triangles.HeaderThe first four bytes are a version string. The current version string should be -1.The next four bytes are an integer that says how many tracks are in the file.TrackThe first data in a track is a name, which can be a variable size. The first two bytes indicate the length of the name. The string encoding is a subset of UTF8.Then each mesh is written.MeshFirst a 4 byte int to represent the timepoint the mesh exists at.Then a 4 byte integer representing the number of positions values, 8 byte float.
Then a 4 byte integer is use to represent the number of connections indexes, each connection index is a 4 byte integers.
Finally a 4 byte integer is used to represent the number of triangle indexes, each index is a 4 byte integer
Package: binary-packer
BINARY PACKERLight and fast packer python dataclasses to bytesInstallHow it worksIt's a wrap! A wrap over stdlibstructSo it converts values into bytes usingstruct.pack().But it does not save keys and values' types in bytes, so be sure about how you configure packer for packing and unpacking.Why and when should it be used?We all like to use json/xml/pickle and other popular libraries for dumping data, but sometimes they are too slow or result's size ot too large.This library works much faster than other packers like json and makes result a lot more compact.Example of UsageimportuuidfromtypingimportOptionalfromdataclassesimportdataclassfrombinary_packerimportPackerFactory,FieldStruct@dataclassclassPerson:id:uuid.UUIDname:Optional[str]=None# max length is 20 bytesage:Optional[int]=Noneperson=Person(id=uuid.uuid4(),name='vaschevsky',age=33)factory=PackerFactory(Person,id=FieldStruct[uuid.UUID,bytes]('16s',# '16s' is for bytearray length of 16, uuid as bytearray also 16 bytesencoder=lambdauid:uid.bytes,decoder=lambdauid_as_bytes:uuid.UUID(bytes=uid_as_bytes),),name=FieldStruct[str,bytes]('20s',# '20s' is for bytearray length of 20, each byte is ascii charencoder=lambdaname:name.encode(),decoder=lambdaname_as_bytes:name_as_bytes.decode().strip('\x00'),),age=FieldStruct[int,int]('B',#  'B' is for unsigned tiny int (1 byte) => age can be any value from 0 to 255,# no need for custom encoder/decoder))packer_1=factory.make_packer('id','name','age')packer_2=factory.make_packer('id','name')packer_3=factory.make_packer('id')forpackerin(packer_1,packer_2,packer_3):data_as_bytes=packer.pack(person)print(f'{len(data_as_bytes)=}')unpacked_person=packer.unpack(data_as_bytes)print(f'{unpacked_person=}')# will be printed:# len(data_as_bytes)=37# unpacked_person=Person(id=UUID('a72decb7-7f9e-497b-ac91-692e316a7580'), name='vaschevsky', age=33)# len(data_as_bytes)=36# unpacked_person=Person(id=UUID('a72decb7-7f9e-497b-ac91-692e316a7580'), name='vaschevsky', age=None)# len(data_as_bytes)=16# unpacked_person=Person(id=UUID('a72decb7-7f9e-497b-ac91-692e316a7580'), name=None, age=None)
Package: binary-parser
A python module where a number can be converted to its binary string and binary string to number.Note: binary string which will be recieved and provided will be in string format for early releases.binary_parseris a simple python library where users can convert an integer to its binary string and vice versa.Installationpip install binary-parsernumber-parser requires Python 3.6+.UsageThe library provides the following common use cases.Converting a binary string to an integer>>> import binary_parser
>>> binary_parser.parse_to_num('1011')
'11'
>>> binary_parser.parse_to_num('000')
'0'
>>> binary_parser.parse_to_num('01')
'1'Converting an integer to its binary formatArguments passed can be a string or an integer type.>>> import binary_parser
>>> binary_parser.parse_to_binary('7')
'111'
>>> binary_parser.parse_to_binary(1)
'1'
>>> binary_parser.parse_to_binary('0')
'0'Checking if given string is binary or integer>>> import binary_parser
>>> binary_parser.which_parser('1010')
'Input 1010 could be either binary or a number'
"binary string: 1010 number: 10"
>>> binary_parser.which_parser(12)
'Input 12 is a number'
"number: 12"
>>> binary_parser.which_parser('00101')
'Input 00101 could be either binary or a number'
"binary string: 00101 number: 101"
>>> binary_parser.which_parser(b'10011')
'Input b'10011' is a binary string'
"binary string: b'10011'"Change Log0.0.1 (07/02/2022)First Release0.0.2 (08/02/2022)0.0.3 (08/02/2022)0.0.4 (26/02/2022)bytes usage and readme changes
Package: binarypipe
BinaryPipebinarypipe provides easy pipeline to use different binary format files in different Machine Larning models.InstallationpipinstallbinarypipeImagePipeimagepipe provides utilities to use image datasets in ML modelsimport imagepipefrombinarypipeimportimagepipeasipLoad single image file# Load imageimg=ip.load("path/image.jpg")# Load in certain sizeimg=ip.load("path/image.jpg",size=(400,600))Load all images of folder as datasetX,y=ip.load_dataset("folder_path/",0)# X= (?, width, height, channel)# y is labelLoad multiple class imagesX,y=ip.load_datasets("folder_path/",)
Package: binaryPy
binaryPy工具介绍将python代码加密为so或pyd（支持项目文件/单个文件加密）Git仓库地址:https://github.com/xqlip/binaryPy.gitpython: 3.6 +安装pip install binaryPy使用方法binaryPy -i "project dir/ file " [-o output dir] [-I ignore files]
Package: binary-quiz
Binary QuizDescriptionA command line application and Python library for generating binary numbers for a human to decode, as well as generating the integers they represent, to check the human's work.CompatibilityCurrently only supported on MacOS and LinuxInstallation on MacOS or Linuxbrew install ghostscript(install homebrewif needed)brew install enscriptpip install binary-quizUsagebinary [OPTIONS] BITS NUM_PROBLEMS

Options:
  --pdf
  --silent
  --include-answers
  --output-filepath TEXT
  --num-columns INTEGER
  --font-size INTEGER
  --help                  Show this message and exit.Examples of OutputPDF$binary8100--pdf👆👆 this command produces two PDFs like this 👇👇stdout00011110001110001110100011110000010111010110011001010010011100101010100110001010100100101111110110001110011111110000111011101011000100110010100001011010010010010101110111000011100000001101100110000110000001011111010011000010001100001101011010100101010001000001100011111111001111000001001001101111101010011000101100011011110100110100100001011111010101011011101111100010100110101001111011000010100011101110010111000101010010010110001010010001011101101100010011101101100001111001011110111100010011111000100100111001100010111011011010001001101001000111000001110001011111001000110100010000110011100101101001110000100001010111000110100110010100010010010011011011000110001101011001000001001111011101001001001110011000011010010010110100010000000010001001101010100000011111110010010011110010111100101001011100*BEGINANSWERS*00011110|3000111000|5611101000|23211110000|24001011101|9301100110|10201010010|8201110010|11410101001|16910001010|13810010010|14611111101|25310001110|14201111111|12700001110|1411101011|23500010011|1900101000|4001011010|9001001001|7301011101|9311000011|19510000000|12811011001|21710000110|13400000101|511110100|24411000010|19400110000|4811010110|21410100101|16501000100|6800011000|2411111111|25500111100|6000010010|1801101111|11110101001|16910001011|13900011011|2711010011|21101001000|7201011111|9501010101|8510111011|18711100010|22610011010|15410011110|15811000010|19410001110|14211100101|22911000101|19701001001|7301100010|9810010001|14501110110|11811000100|19611101101|23710000111|13510010111|15110111100|18801001111|7910001001|13700111001|5710001011|13910110110|18210001001|13710100100|16401110000|11201110001|11301111100|12410001101|14100010000|1611001110|20601011010|9001110000|11210000101|13301110001|11310100110|16601010001|8100100100|3611011011|21900011000|2411010110|21401000001|6500111101|6111010010|21001001110|7801100001|9710100100|16410110100|18001000000|6400100010|3401101010|10610000001|12911111100|25210010011|14711001011|20311001010|20201011100|92Other Projects That Could Be Built Using This Packagedo the problems online/on computera website to serve these up and let people use them for freea web API that serves it, so people can do that programmaticallya snail mail service?https://developers.lulu.com/price-calculatorif there's going to be exercises in the browser,parseInt('0101', 2)maybe re-implement in Javascript so all computation and rendering is done on the clientPDF rendering in the browser