GithubHelp home page GithubHelp logo

kokitis / infotools Goto Github PK

View Code? Open in Web Editor NEW

This project forked from strangerthoughts/pytools

0.0 2.0 0.0 6.15 MB

A library of tools to make common tasks easier.

License: MIT License

Python 100.00%

infotools's Introduction

Infotools

A collection of tools to make common tasks simpler and more convienient. It is organized into several subpackages:

  • filetools
  • numbertools
  • timetools

Filetools

This package has a few functions useful unctions when operating with system files.

Available Functions:

  • memoryUsage

    Retrieves the current RAM usage.

  • generateFileMd5

    Generates a file's MD5sum

  • checkDir

    Ensures that the given folder exists.

Numbertools

Common number operations

Useful functions:

  • human_readable

    Converts a number or numerical string to a more easily-readable format.

    >>> from infotools import numbertools
    >>> numbertools.human_readable(12345.678, base = 'K')
    '12.35K'
    
    >>> numbertools.human_readable(10.456E-5, base = 'u')
    '104.56u'
    
    >>> numbertools.human_readable(10.4561940387432E-5, precision = 4)
    '104.5619u'
  • to_number

    Attempts to convert the input into a number

    >>> from infotools import numbertools
    >>> numbertools.to_number('187')    
    187
    
    >>> numbertools.to_number('abcdef')
    nan
    
    >> numbertools.to_number('asdas', default = 0)
    0
  • is_number

    Tests if the input string is a number. Works with floats.

    >>> from infotools import numbertools
    >>> numbertools.is_number('123.456')
    True
    
    >>> numbertools.is_number('abc')
    False

timetools

Contains time and date methods with simple importing and exporting methods.

Available Classes:

  • Timestamp

    Represents a single time and date.

    >>> from infotools import timetools
    >>> timestamp = timetools.Timestamp.now()
    >>> str(timestamp)
    '2018-09-03T20:22:05.405436-04:00'
  • Duration

    Represents differences in time

    >>> from infotools import timetools
    >>> duration = timetools.Duration('P11DT4H3S')
    'Duration("P1W4DT4H3.0S")'
  • Timer

    A simple time with convienient methods for benchmarking functions

infotools's People

Contributors

kokitis avatar cdeitrick avatar pepepdodiu avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.