Skip to main content

Python library of useful but lonely functions and classes

Project description

Slytherin

Slytherin is a collection of useful but lonely functions and classes that don't belong to other libraries.

Installation

pip install slytherin

Usage

get_size(obj)

The get_size() method calculates the memory footprint of a Python object recursively.

The exclude_objects argument is a list of objects and is optional with the default value of None. Any object in the exclude_objects list will be excluded from the recursive search. It can be used to avoid double counting the size when objects point to each other.

from slytherin import get_size
get_size(obj=[1,2,3], exclude_objects=None)

import pandas as pd
get_size(obj=pd.DataFrame({'id': range(1000), 'name':['Godric', 'Helga', 'Rowena', 'Salazar']*250}))

colour(text, text_colour, style, background_colour)

The colour() method can be used to add colour to printing text.

The colour are integers from 0 to 7:

  • black: 0
  • red: 1
  • green: 2
  • yellow: 3
  • blue: 4
  • purple: 5
  • cyan: 6
  • white: 7

The style argument is an integer between 0 and 5:

  • normal: 0
  • bold: 1
  • underline: 2
  • negative1: 3
  • negative2: 5
from slytherin import colour
print(colour(text='Hello world!', text_colour=4))

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

slytherin-2020.1.5.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

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

slytherin-2020.1.5-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

Details for the file slytherin-2020.1.5.tar.gz.

File metadata

  • Download URL: slytherin-2020.1.5.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.2

File hashes

Hashes for slytherin-2020.1.5.tar.gz
Algorithm Hash digest
SHA256 eeb250b0580616f902ad3d0410e6b380c0f28d35d352bb8a9bdbe45cb8ce8c3b
MD5 8848c383bd775cf0b9a130b24a47a07a
BLAKE2b-256 8b4a9c3e9f756ef96d3c4bf9fc885a67f26d32dd998e465e3dfc62e1b4fd1352

See more details on using hashes here.

File details

Details for the file slytherin-2020.1.5-py3-none-any.whl.

File metadata

  • Download URL: slytherin-2020.1.5-py3-none-any.whl
  • Upload date:
  • Size: 20.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.2

File hashes

Hashes for slytherin-2020.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a227936d2314e5ce294db4ae5809904b87c106fdbae8d7fd6a616d30eff060a3
MD5 948002f2831e237ca9b05a1a9c4897a9
BLAKE2b-256 15502849a896bb61fa55e8e2255a488e9236ea1cb5b7b59714b70b91169abe88

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