Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Segmented Python preprocessor.

Project description

Floem

Segmented Python Preprocessor

Precommands

Precommands starts with ! symbol and continues with directive.

Define Directive

Defines a static variable and when preprocessing fills all parts with that variable. It can take any value. Example;

!define flag as 1323
!define name as "floem"

Control Flow Directive

Compares 2 static at preprocessing time and if comperation successfully occurs it allows the code inside the !startif & !endif directives to run. If not the code just be deleted.

class Dummy:
    def __init__(self, y):
        self.x = y
        !startif <flag> gt 1000
        print('Flag is greater than 1k')
        for i in range(<flag>):
            print(i)
        !endif

Example

!define flag as 1323
!define name as "floem"

class Dummy:
    def __init__(self, y):
        self.x = y
        !startif <flag> gt 1000
        print('Flag is greater than 1k')
        for i in range(<flag>):
            print(i)
        !endif

if __name__ == '__main__':
    !startif <name> eq "floem"
    d = Dummy(15)
    !endif
    !startif "ksilem" eq <name> 
    print('i dont think so')
    !endif

and after the preprocessing

class Dummy:
    def __init__(self, y):
        self.x = y
        print('Flag is greater than 1k')
        for i in range(1323):
            print(i)

if __name__ == '__main__':
    d = Dummy(15)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for floem, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size floem-0.1.1.tar.gz (3.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page