Skip to main content

Python Small Toolkit, containing convenient tools.

Project description

pystk

Small tools in toolkit to deal with piece of cakes in daily life, such as small tool to check normal url format. 'pystk' represents for Python Small Toolkit.

Motivation?

In daily work, there are always bunch of need for small tools to deal with tiny problems. You can search using Google and write scripts for them. However, it's also time-consuming after multiple times for one small task, for the reason you should create tools again and again. Then the toolkit is designed to alleviate this problem.

What's the content?

Keras2tensorflow


Motivation.

In some situation, you would use Keras to train the model, but in engineer environment, what would be used is Java Based Tensorflow. Therefore, the Keras model should be converted into Tensorflow model. This project aims to convert Keras model file into Tensorflow model file.

Usage.

Import and use function in Python script as followings:

from pystk.keras2tensorflow import convert_model
convert_model(input_file_path, target_fold, target_file_name)
  • Parameters
    • input_file_path: The input file path of Keras model file, in .h5.
    • target_fold: The target fold where the Tensorflow model file is saved in.
    • target_file_name: The output file name of Tensorflow model file, in .pb.
  • Output The output Tensorflow model file will be saved in target_fold/tensorflow_model/.

Convert pb2ckpt.


Motivation.

In some situation, you have trained the Tensorflow model and save model file in .pb format. However, in other situations, the necessary model file format is .ckpt. Thus, this project is designed to help you convert .pb model file into .ckpt model file.

Usage.

Import and use function in Python script as followings:

from pystk.convert_pb2ckpt import convert_model
convert_model(pb_file_path, ckpt_file_path)
  • Parameters
    • pb_file_path: The file path of .pb model.
    • ckpt_file_path: The file path of .ckpt model.
  • Output The output Tensorflow model file will be saved in ckpt_file_path.

Check url format


Normal Url's Format Inspector. This Tool is designed to inspect the format of url whether it's normal or not using Regular Expression.

Motivation.

In some situation, you need to filter out or crawl URLs which are in normal format. In other word, you don't want any abnormal urls to disturb your tasks. Then it's the tool for you to filter out what you really need.

Usage.

Import and use function in Python script as followings:

from pystk.check_url_format import check_url_format
check_url_format(url)
  • Parameters
    • url: The url which is tended to be checked.
  • Output The string result.
    • 'Normal' for normal url format.
    • 'Error' for abnormal url format.

Convert ip to number.

Aims of this project.

Convert ip address into 32-bit integer.

Usage.

Import and use function in Python script as followings:

from pystk.convert_ip2num import convert_to_num
convert_to_num(ip_address)
  • Parameters
    • ip_address: The ip address, eg. 127.125.5.1.
  • Output The 32-bit number converted from ip address.

Python code performance.

Target/Motivation?

In Python scripts, ususally some lines of code cost most of running time, and what you want to do with code performance is to find the most time-consuming part of code and to optimize the performance. The target of this tool is to help you find the 'evil'.

How to use.

Firstly, install the necessary packages.

pip install line_profiler

Secondly, add decorator @profile before the target function.

Thirdly, run the following command to get performance results.

kernprof -l -v timing_functions.py

The result looks like as following:

result

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

pystk-0.1.0a1.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

pystk-0.1.0a1-py2-none-any.whl (15.2 kB view details)

Uploaded Python 2

File details

Details for the file pystk-0.1.0a1.tar.gz.

File metadata

  • Download URL: pystk-0.1.0a1.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pystk-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 695e095a1fb5219ff65a8a07e6cdfbf4cf8b773a8786a83b34f36bba789e7aad
MD5 515c9f5bb93f8c9dde6bf2f2e0117325
BLAKE2b-256 f58396bf0ccc2e6e73dfd12717ea739ec24bdfef8245d109bea9480f719b43b7

See more details on using hashes here.

File details

Details for the file pystk-0.1.0a1-py2-none-any.whl.

File metadata

File hashes

Hashes for pystk-0.1.0a1-py2-none-any.whl
Algorithm Hash digest
SHA256 89523fa7fbcd3f6e3a9ab6b1e31593ddb4e4a5cf435cd4d308102da70ecffb8a
MD5 bebccf93c20b8542a91a5b6e9ab227f4
BLAKE2b-256 694f04c73fcd915286b241eb9fcbf912b80222dd1478b704b45457f0542a3067

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page