Code Monkey home page Code Monkey logo

collect's Introduction

collect + export functions via command line

extracts all functions + import statements from a specific file / collection of files from a directory and exports to another file 1 .

Parameters

from_file : str
      The path to file or directory that the all functions will be extracted from

to_file : str
        The path to file* (ext .py) to insert extracted functions.
        (if file does not exist, the file is created)

overwrite : bool, OPTIONAL (default = False)
        Overwrites the file (which extracted functions are being inserted into)
        (default is False --> appends to end of the file)

regex : str, OPTIONAL
        specific regex pattern that a file must match if the from_path parameter is a directory
        (default is NONE & only collects from files with extention .py)

Command line syntax

python3 collect.py --from_path "file path or directory path" --to_path "file path"

Example 2

python3 collect.py --from_path "116/" --to_path "116/math116.py" --regex "HW_[0-9]*.*" --overwrite True

↘️ extracts functions & import statements from files in directory "116/" with name thats matches regex pattern, HW_[0-9]*.*

↘️ inserts into file "116/math116.py" (via overwriting)

↘️ now able to acces all functions by adding import statement from math116 import *

Footnotes

  1. compatible with only python syntax (next language to be suppported: elixir)

  2. see '116/math116.py' for result and '116/HW_0.py', '116/HW_1.py', '116/HW_2.py' for original files in this repo

collect's People

Contributors

amandaratio 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.