A python lib for degree calculations and conversions
Project description
degrees V0.1.4rc1
Contents
- Introduction
- Importing
- Class
- Degree
- Functions
- degree2radius
- radius2degree
- convert_to_360
- Changelog
Introduction
A python lib for degree calculations and conversions
Importing
Just type import degrees.
Class
-
class degrees.Degree(number)
class degrees.Degree(degree_obj)
class degrees.Degree(degree=0, minute=0, second=0)
-
Creating a Degree object
>>> import degrees >>> degrees.Degree(1) 1° >>> degrees.Degree(2, 3, 4) 2°3'4" >>> degrees.Degree(1, second=2) 1°0'2" >>> degrees.Degree(1, 3) 1°3' >>> degrees.Degree(0, -1) -1' >>> degrees.Degree(2, -4) Traceback (most recent call last): File "<stdin>", line 1, in <module> degrees.Degree(2, -4) ~~~~~~^^^^^^ File "/degrees.py", line 32, in __init__ raise ValueError("if degree is not 0, minute and second must be positive integer") ValueError: if degree is not 0, minute and second must be positive integer
-
calculating:
a + ba - ba * ba / babs(a)math.ceil(a)math.floor(a)a % ba // b+a-ahash(a) -
conversions:
int(a)float(a)str(a)repr(a)bool(a) -
comparisons:
a >= ba > ba = ba <= ba < ba != b -
staticmethod from_str(string)
Return a degree object from a string.
-
staticmethod from_iter(iterable)
Return a degree object from an iterable.
-
functools.cached_property total_seconds
The total seconds of a degree object.
-
deg
The degree of a degree object(without sign).
-
min
The minute of a degree object(without sign).
-
sec
The second of a degree object(without sign).
-
sign
The sign of a degree object.
-
property dms
A tuple of
(degree, minute, second).
-
Note
The attributes of Degree are read-only.
Functions
def degree2radius(x: Degree, /)
- Convert angle x from a degree object to radians.
def radius2degree(x: Union[int, float], /)
- Convert angle x from radians to a degree object.
def convert_to_360(x: Degree, /)
- Be using for angle normalization.
Version
version_info
- The version of this package, like
sys.version_info.
Changelog
- Yanked degrees
0.1.2because the bug inDegree.__init__.
Write in the end
If you found the bug in the code, you can email me at
snake830@vip.163.com. I am happy to receive the advice!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file degrees-0.1.4rc1.tar.gz.
File metadata
- Download URL: degrees-0.1.4rc1.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2348ec3a3ab9cdb82ff66f83a4f274c0eb8d77f4285b83d5640a9a795af7deb2
|
|
| MD5 |
12e515d09a1f685b6b9be83050c29773
|
|
| BLAKE2b-256 |
55bf5d6d47bb8fedb6df55bc8f948bb3cec0dea5e6b6a1899915ad3d72cc12d8
|
File details
Details for the file degrees-0.1.4rc1-py3-none-any.whl.
File metadata
- Download URL: degrees-0.1.4rc1-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0fd2ec4a33e22835e8beeb97cb7eba1bf97dc753cd9c6c91b765aef56f0ffefe
|
|
| MD5 |
876d3e59b1d0e73b9bfdf34f972332d5
|
|
| BLAKE2b-256 |
9e9d1184e6b6203b24c7a507ac6ef5d35d51c25b20207a410c6b74844abb10cd
|