Skip to content

Find all the divisions in Python source code in order to facilitate updating Python 2 code to Python 3.

License

Notifications You must be signed in to change notification settings

NablaZeroLabs/shldn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shldn

Sheldon Cooper ALWAYS points out what (he thinks) is wrong with people and their work

What is it?

shldn is a console-application that finds all the division operations in Python source code to facilitate transitioning Python 2 code to Python 3. It uses Python's AST module to process and parse the code. It, then traverses the abstract syntax tree to find all the division operations, and prints them in a normal or more readable format to the console.

Motivation

  • Python 2 won't be supported past 2020

tic tac tic tac...

  • Division in Python 3 always returns a float; whereas division in Python 2 can return an int

  • Critical for large Python 2 code bases that perform division operations

Requirements

  • Python 3

Install

Method 1: Install from Pypi Method

pip3 install shldn

Or, if you use pipenv,

pipenv install shldn

Method 2: Clone repository

Move to the desired directory to install shldn

git clone https://github.com/NablaZeroLabs/shldn.git

Usage

Method 1 (Installed from Pypi):

In environment installed:

  1. Check if installed
pip list
  1. Execute
shldn [-h] [-hr] [-r] path

Method 2 (Cloned repo):

  1. Execute
python3 leonard.py [-h] [-hr] [-r] path

Arguments

positional arguments:
  path                  path to python source file(s)

optional arguments:
  -h, --help            show this help message and exit
  -hr, --human_readable
                        set for friendlier output
  -r, --recursive       recursively check python files in path

License

This project is licensed under the MIT License - see the LICENSE.txt file for details.

More Resources

About

Find all the divisions in Python source code in order to facilitate updating Python 2 code to Python 3.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages