Skip to main content

jblib

Author: Justin Bard

This module was written to minimize the need to write the functions I use often.

INSTALL: python3 -m pip install jblib


The source code can be viewed here: https://github.com/ANamelessDrake/jblib

More of my projects can be found here: http://justbard.com


from jblib import cd

    class cd()

        Example: 
            with cd(directory):
                print (os.getcwd()) 

            print (os.getcwd()) ## Back at the originating directory on exit

from jblib import hilight

    class hilight(string).color(highlight=True, bold=True)

        Example:
            print (hilight("Hello World").red(bold=True))

            Or you could make an object:
                text = hilight("Bar")

                print ("Foo "+text.blue())

            To return the original string:
                print (text.string)

        Available Colors:
            red
            green
            yellow
            blue
            purple
            teal
            white

from jblib import convert_module

    Module to convert various data

            def convert_time_from_seconds(seconds_given)
                Converts a seconds into minutes, hours and days. 

            def IP2Int(ip)
                Converts a IPv4 address to a interger - This is useful to store IP addresses in databases

            def Int2IP(ipnum)
                Converts a interger back to an IPv4 address

            def urlcode(url, encode=False)
                Wrapper for urllib.parse.quote and urllib.parse.unquote.
                From urllib docs - Replace special characters in string using the %xx escape. Letters, digits, and the characters '_.-' are never quoted. By default, this function is intended for quoting the path section of URL. 
                - https://docs.python.org/3.1/library/urllib.parse.html?highlight=urllib#urllib.parse.quote

from jblib import HTMLgen

        Basic HTML generator
        02/09/2019

        class HTMLgen(head=False, tail=False, lang="en", docType="html")

        FUNCTIONS:
            title(self, title, scripts=None, css=None)
            body.add(content)
            tag(tag, content=False, close=True, cssclass=None)
            image(src, alt=None, srcset=None, height=None, width=None, style=None, cssclass=None)
            div(cssclass)

        EXAMPLE:
            page = HTMLgen(True, True)
            page.title("This is the page Title", scripts="foo.js bar.js", css="styles.css nav.css")
            page.body.add(HTMLgen.image("images/frontpage.jpg", width="100%"))
            page.body.add(HTMLgen.tag("h1", "This is a header line"))
            page.body.add("This is another line")


            page.return_html()

            ```
                <!DOCTYPE html>
                <html lang="en>
                    <head>
                        <title>This is the page Title</title>
                        <link rel="stylesheet" href="styles.css">
                        <link rel="stylesheet" href="nav.css">
                        <script src="foo.js"></script>
                        <script src="bar.js"></script>
                    </head>
                <body>
                    <img src="images/frontpage.jpg" width="100%">
                    <h1>This is a header line</h1>
                    This is another line
                </body>
                </html>
            ```

Metadata

Release files for jblib 1.6.31

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

Source distribution (sdist)

Source distribution for jblib 1.6.31
File Size Uploaded
jblib-1.6.31.tar.gz 4.6 kB Details

Built distribution (wheel)

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

Total release size: 12.3 kB

Release files / jblib-1.6.31.tar.gz

Download URL jblib-1.6.31.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6747f593f41e20cbee09738e946bf2cc1e6e79197848edf3de6fca854d809063
BLAKE2b-256 checksum
How to use checksums
2390f56dda8ed41c7edeed5b44d915d5821d59bb58e93c248b8ad5ef8724b7c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1

Release files / jblib-1.6.31-py3-none-any.whl

Download URL jblib-1.6.31-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f374adc125296b3f360f1560ff9fe4e8a0cfca38bf0bee2a5df4f8976c5f588
BLAKE2b-256 checksum
How to use checksums
763bb338ad9c7c0fe378415650701222c52aefe7eda244756c2877bd0c27c3c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1
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