Skip to main content

A python lib for degree calculations and conversions

Reason this release was yanked:

error on python 3.7

Project description

degrees V0.1.0

Contents

  • Introduction
  • 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(degre: float)

    class degrees.Degree(degre: Degree)

    class degrees.Degree(degre: int = 0, minute: int = 0, second: int = 0)

    • Creating a Degree object

      >>> 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 + b a - b a * b a / b
      abs(a) math.ceil(a) math.floor(a) a % b
      a // b +a -a hash(a)1
    • conversions:

      int(a) float(a) str(a) repr(a) bool(a)
    • comparisons:

      a >= b a > b a = b
      a <= b a < b a != b

Note

  1. hash(Degree_object) is equal to hash(id(Degree_object)).
  2. 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.

Changelog

  1. Fixed a lot of problems
  2. Deleted degree 0.0.1, 0.0.2, 0.0.3 and 0.0.4 because there are too much bugs.

Write in the end

If you found the bug in the code, you can email me at snake830@vip.163.com. I'm happy to receive the advice!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

degrees-0.1.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

degrees-0.1.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file degrees-0.1.0.tar.gz.

File metadata

  • Download URL: degrees-0.1.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for degrees-0.1.0.tar.gz
Algorithm Hash digest
SHA256 03d75fa290a76df33b274cfb4b64713b8f36f6d47e9b28507b6f57714228d7e7
MD5 facc3b4aba5e85ee2897340bb768c9f1
BLAKE2b-256 f41e24f043ee916ab4891dc6df0248e9c06ad8dd548accee55eb3db9f3b5f750

See more details on using hashes here.

File details

Details for the file degrees-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: degrees-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for degrees-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5b791d6d8a8150ebd34acb91d0f3efffc06170d5245703cbd61150e2cb44df77
MD5 b18be755a8ba44e3ba5871d843e022fd
BLAKE2b-256 a85faeb7f4b34594576e5f2a9f35b16f6b36a295d63bf973740a6054aa573512

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page