Skip to main content

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))

Release files for slytherin 2019.12.28

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for slytherin 2019.12.28
File Size Uploaded
slytherin-2019.12.28.tar.gz 12.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for slytherin 2019.12.28
File Interpreter ABI Platform
slytherin-2019.12.28-py3-none-any.whl Python 3 none any Details

Total release size: 32.9 kB

Release files / slytherin-2019.12.28.tar.gz

Download URL slytherin-2019.12.28.tar.gz
Size 12.6 kB
Tags Source
SHA-256 checksum
How to use checksums
28e6407bdf23bf6c13ff00726663adc08ed901c37cea9d471cf3a58d3f6032fb
BLAKE2b-256 checksum
How to use checksums
5f8c1003e01154d7ac2f0a3fb8882790b08fd2fb39dc04aafbed5def1882761b
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / slytherin-2019.12.28-py3-none-any.whl

Download URL slytherin-2019.12.28-py3-none-any.whl
Size 20.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2841613ebddd1d08f1173894bd48fc39b4d98af8b5d0dc613480cb92e1b9b8c1
BLAKE2b-256 checksum
How to use checksums
3657c3205713d23f3910a126cfb099490e40bef415fac125f2f383666d375f66
Upload date
Uploaded using Trusted Publishing?
What is 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
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page