Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Pymetro is a python library that allows you to incorporate scientific notations using symbols into your program. It provides functions that force a specific notation on a variable as specified by the user and includes a function that automatically formats any given numbers to a standard index form. Note that all of the returns given by any functions in this module are Strings.
To use Pymetro, it is first imported to the Python workspace like any other library as:
>> import pymetro
You can then call one of the many functions provided in order to format the desired number. For manual formatting functions, the function is called from the library and provided with either an integer or a float. The following is an example of raising the number 2314.124 to a notation of kilo:
>> pymetro.kilo(2314.124)
2.314124k
You can also specify the number of digits after the decimal point by providing another integer to the function representing the number of places required after the decimal point:
>> pymetro.kilo(2314.124, 3)
2.314k
If no integer is provided to specify the rounding place, the function would simply default to not rounding the number at all.
The auto function on the other hand automatically formats the number based on the standard index form, to illustrate, these are the results of passing two different numbers into the auto function:
>> pymetro.auto(2145.235)
2.145235k
>> pymetro.auto(0.032523)
32.523m
As you can see, both numbers were automatically formatted to the recommended notation. This is helpful when the user cannot predict what numbers are going to be generated or inputted in their program. Similarly, the auto function is also capable of accepting a specific number of integers following the decimal point to round, the result is as follows:
>> pymetro.auto(2145.235, 3)
2.145k
>> pymetro.auto(0.032523, 2)
32.52m
Notation | Symbol | Function |
---|---|---|
Atto | a | atto() |
Femto | f | femto() |
Pico | p | pico() |
Nano | n | nano() |
Micro | µ | micro() |
Milli | m | milli() |
Kilo | k | kilo() |
Mega | M | Mega() |
Giga | G | giga() |
Tera | T | tera() |
Peta | peta | peta() |
Exa | E | exa() |
Zetta | Z | zetta() |
Yotta | Y | yotta() |
FAQs
A library for formatting numbers according to the metric system
We found that pymetro demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.