Skip to main content

pyalltools

PyPI version Python License: MIT

A collection of everyday Python utilities — integer math, string analysis, data-structure helpers, and more — packaged for easy reuse.


Installation

pip install pyalltools

Quick Start

from pyalltools import Int, Str, List, MyTuple, Stack, Queue, binary_search

Classes & Usage

Int(number)

Integer utilities.

from pyalltools import Int

n = Int(17)
print(n.is_prime())       # True
print(n.factorial())      # 355687428096000  (17!)
print(Int(121).is_palindrome())  # True

print(Int.find_primes(1, 50))   # [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]
print(Int.reverse(1234))        # 4321
print(Int.sum_digits(1234))     # 10
Method Description
is_prime() Returns True if the number is prime (O(√n))
factorial() Returns n! (None for negatives)
is_palindrome() Returns True if digits read the same forwards and backwards
find_primes(start, stop) Returns list of primes in [start, stop]
reverse(number) Returns the digit-reversed integer
sum_digits(number) Returns the sum of all digits

Str(string)

String analysis and manipulation.

from pyalltools import Str

s = Str("Hello World 123")
print(s.analyze())
# {'Total': 15, 'UpperCase': 2, 'LowerCase': 8, 'Digits': 3, 'Alphabets': 10, 'Others': 2}

print(Str("racecar").is_palindrome())   # True
print(s.occurrence("l"))               # 3
print(Str.longest_word("the quick brown fox"))  # 'quick'
Method Description
is_palindrome() Returns True if the string is a palindrome
analyze() Returns character breakdown (totals, upper/lower/digit/other)
occurrence(word) Counts non-overlapping occurrences of word
longest_word(string) Returns the longest whitespace-separated word

List(lst)

List utilities.

from pyalltools import List

l = List([3, 1, 4, 1, 5, 9, 2, 6, 5])
print(l.frequency())        # {3: '1 time', 1: '2 times', 4: '1 time', ...}
print(l.maxminrange(0, 4))  # {'Max': 5, 'Min': 1}
print(l.removedups())       # [3, 1, 4, 5, 9, 2, 6]  (order preserved)
Method Description
frequency() Returns element → frequency string dict
maxminrange(start, stop) Max/min of slice [start, stop] (both inclusive)
removedups() New list with duplicates removed (insertion order preserved)

MyTuple(my_tuple)

Tuple utilities — mirrors List for immutable sequences.

from pyalltools import MyTuple

t = MyTuple((1, 2, 2, 3, 3, 3))
print(t.frequency())   # {1: '1 time', 2: '2 times', 3: '3 times'}
print(t.removedups())  # (1, 2, 3)

Stack()

A LIFO stack.

from pyalltools import Stack

s = Stack()
s.push(10)
s.push(20)
print(s.peek())    # 20
print(s.pop())     # 20
print(s.size())    # 1
print(s.display()) # [10]

Queue()

A FIFO queue.

from pyalltools import Queue

q = Queue()
q.enqueue("a")
q.enqueue("b")
print(q.peek())     # 'a'
print(q.dequeue())  # 'a'
print(q.size())     # 1
print(q.display())  # ['b']

binary_search(item, array)

Binary search on any list (array is sorted in-place before searching).

from pyalltools import binary_search

idx = binary_search(7, [3, 1, 4, 1, 5, 9, 2, 6, 7])
print(idx)  # index of 7 in the sorted array, or None if not found

Kali.GetTools()

Clone a curated collection of security / penetration-testing tools from GitHub. Requires git and an active internet connection.

from pyalltools import Kali

Kali.GetTools()  # runs git clone for each tool in the current directory

Links

License

MIT © Anupam Kanoongo

Download files

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

Source Distribution

pyalltools-3.3.0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

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

pyalltools-3.3.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file pyalltools-3.3.0.tar.gz.

File metadata

  • Download URL: pyalltools-3.3.0.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.0

File hashes

Hashes for pyalltools-3.3.0.tar.gz
Algorithm Hash digest
SHA256 d897dcf7e196db02f8618410542e542407b9a8024cf00e481af19006c110697b
MD5 d331bd20a554d8c6fe691460162ab8f0
BLAKE2b-256 3c5cc3682db80d915ff6d646ae598c1571eb7228367f0b8ccd27adb40ba48a86

See more details on using hashes here.

File details

Details for the file pyalltools-3.3.0-py3-none-any.whl.

File metadata

  • Download URL: pyalltools-3.3.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.0

File hashes

Hashes for pyalltools-3.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3233b9e18bc1e3e711c82e1ea8e50f98185f5de1bf5f359f19cee01e676b922f
MD5 a26f1d4330e2b9ee2957e94fe77553cd
BLAKE2b-256 50bd493ce833c22136cb56983b47c5d93a45f652ab7c9b637b6cdc4ff8caf99e

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

3.3.0 This release

2 files

3.2.2

2 files

3.2.1

2 files

3.2.0

2 files

3.1.0

2 files

3.0.0

2 files

2.1.1

1 file

2.1.0

2 files

2.0.0

2 files

1.1.1

2 files

1.1.0

2 files

1.0.0

2 files

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