
Security News
Bun 1.2.19 Adds Isolated Installs for Better Monorepo Support
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
A library for manipulating well-formed Roman numerals.
Integers between 1 and 3,999 (inclusive) are supported.
Numbers beyond this range will return an OutOfRangeError
.
The classical system of roman numerals requires that the same character may not appear more than thrice consecutively, meaning that 'MMMCMXCIX' (3,999) is the largest well-formed Roman numeral. The smallest is 'I' (1), as there is no symbol for zero in Roman numerals.
Both upper- and lower-case formatting of roman numerals are supported,
and likewise for parsing strings,
although the entire string must be of the same case.
Numerals that do not adhere to the classical form are rejected
with an InvalidRomanNumeralError
.
.. code-block:: python
from roman_numerals import RomanNumeral
num = RomanNumeral(16) assert str(num) == 'XVI'
num = RomanNumeral.from_string("XVI") assert int(num) == 16
.. code-block:: python
from roman_numerals import RomanNumeral
num = RomanNumeral(16) assert str(num) == 'XVI' assert num.to_uppercase() == 'XVI' assert num.to_lowercase() == 'xvi' assert repr(num) == 'RomanNumeral(16)'
.. code-block:: python
from roman_numerals import RomanNumeral
num = RomanNumeral(42) assert int(num) == 42
.. code-block:: python
from roman_numerals import RomanNumeral, InvalidRomanNumeralError
num = RomanNumeral.from_string("Spam!") # raises InvalidRomanNumeralError num = RomanNumeral.from_string("CLL") # raises InvalidRomanNumeralError num = RomanNumeral(0) # raises OutOfRangeError num = RomanNumeral(4_000) # raises OutOfRangeError
This project is licenced under the terms of either the Zero-Clause BSD licence
or the CC0 1.0 Universal licence.
See LICENCE.rst
__ for the full text of both licences.
__ ./LICENCE.rst
FAQs
Manipulate well-formed Roman numerals
We found that roman-numerals-py demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
Security News
Popular npm packages like eslint-config-prettier were compromised after a phishing attack stole a maintainer’s token, spreading malicious updates.
Security News
/Research
A phishing attack targeted developers using a typosquatted npm domain (npnjs.com) to steal credentials via fake login pages - watch out for similar scams.