• Stars
    star
    255
  • Rank 159,729 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created about 5 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Turn your python code into a hideous mess. Ever heard of Black? This is the opposite.

Lancer

Ever heard of Black? This is the opposite. A tool to turn your clean python code into a hideous (working) mess.

Features

  1. Turn all comments into Pitbull lyrics 💃 (or optionally, something safe for work)
  2. Turn all your variable names into a mixture of animal sounds and horribly similar looking characters like "bark_bark_0OO0O". 🐶
  3. Add irritating white spaces.
  4. Add new, totally redundant comments.
  5. Code still runs after all these improvements! 👷

Example

Before:

# Function that finds the sum of a list of numbers
def get_sum(nums: List[int]) -> int:

    sum = 0

    # Find the sum
    for num in nums:
        sum += num

    # Return the sum
    return sum

if __name__ == '__main__':
    sum = get_sum([1, 3])
    print(f"Sum of 1 and 3 is {sum}")

After:

# Hey baby, givin' it your all when you're dancin' on me
def oink_oink_oink_IlΙlll (ribbit_ααaαα :List [int ])->int :

    # Setting value of sum
    sum =0

    # Bada bing, bada boom
    for num in ribbit_ααaαα :
        sum +=num

        # there's nothing like Miami's heat
    return sum

if __name__ =='__main__':
    # Setting value of sum
    sum =oink_oink_oink_IlΙlll ([1 ,3 ])
    print (f"Sum of 1 and 3 is {sum}")

Installation and Usage

Simply run pip install py-lancer and then use the lance command line tool.

usage: lance [-h] [--version] -f ./FILE_PATH.py [-s][-y]

Ever heard of Black? This is the opposite.

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  -f ./FILE_PATH.py, --file ./FILE_PATH.py
                        Python file to be lance'd.
  -s, --sfw             Generate comments that are safe for work.
  -y, --yolo            Overwrite original file, lol.

So if you have a python file at ./test.py, you simply run lance -f ./test.py

How does it work

The key tool we use it the tokenizer standard module in python. It allows us to tokenize any python script which then in turn makes substituting comments and variable names fairly simple. Check out the source code for more details.

Contribute

Bug reports, fixes and additional features are always welcome! Make sure to run the tests with python setup.py test and write your own for new features. Thanks.

More Repositories

1

primify

Embed any image into a prime number.
Python
464
star
2

spectrographic

Turn an image into sound whose spectrogram looks like the image.
Python
260
star
3

Logation

Analyse your NGINX access logs and create beautiful maps of the locations from which people access your service.
Python
115
star
4

motionblur

Generate authentic motion blur kernels (point spread functions) and apply them to images. Fast and Simple.
Python
105
star
5

non-api-fb-scraper

Scrape public FaceBook posts from any group or user into a .csv file without needing to register for any API access
Python
47
star
6

garnn

TensorFlow implementation of Graphical Attention Recurrent Neural Networks based on work by Cirstea et al., 2019.
Python
27
star
7

dgcnn

Clean & Documented TF2 implementation of "An end-to-end deep learning architecture for graph classification" (M. Zhang et al., 2018).
Python
24
star
8

img2rag

Convert any image into a Region Adjacency Graph (RAG)
Python
12
star
9

StackData

Data set containing the key techologies used by ~1000 top tech companies.
8
star
10

rateyourcircle

Draw a circle and see how close you got to drawing a perfect circle.
JavaScript
7
star
11

gtraceroute

gtraceroute is a sophisticated network diagnostic tool, combining the utility of traditional traceroute with a user-friendly UI similar to PingPlotter.
Python
3
star
12

dortmund2array

Tool to convert datasets from "Benchmark Data Sets for Graph Kernels" (K. Kersting et al., 2016) into a format suitable for deep learning research.
Python
2
star
13

RedditLiveChart

The Back- and Frontend behind my popular /r/dataisbeautiful post.
JavaScript
1
star
14

adadelta_py

Clean & dependency-free implementation of the ADADELTA algorithm in python.
Python
1
star
15

hybrid-face

See one face up close and another from far away!
Python
1
star
16

LinAlg-NumberTheory

Just some maths modules for linear algebra and number theory.
Python
1
star