Skip to content

'branch' is a module to show vertical / horizontal relationship of things, and is inspired by directory branches

Notifications You must be signed in to change notification settings

KIM-HANJOO/branch

Repository files navigation

<<<<<<< HEAD

BRANCH

BRANCH is a user module for expressing vertical / horizontal relationship between objects
inspired by directory branches, no additional libraries needed (acts only with lists)



different themes and theme customization are also available !


< How to use >
  1. you only need to download 'branch.py'. import this as an module in anywhere you want, and use with single lined code.

  2. branch making is only based on the bracketed sign and the sequence you write.

  3. [m] is for the top level titles, in this example, are 'clothes', 'coffee', 'Python'.

  4. [s] is sub-level of [m], [ss] is sub-level of [s], continously, [sss] is sub-level of [ss]..

  5. the shape of the branch will be automatically determined



                                                       < Input >  
                                                       
    string = '[m] clothes [s] shirts [s] pants [ss] denim [sss] tapered [s] accessories [m] coffee [s] espresso [s] latte [m] Python [s] branch [ss] init_theme'   
              
                                  < Result >  
                                  
                                  - Default -                      
                                                                                       
                                 .                                    
                                 ├─clothes                            
                                 │  ├─shirts                              
                                 │  ├─pants                       
                                 │  │  └─denim                            
                                 │  │     └─tapered                          
                                 │  └─accessories                     
                                 │                                     
                                 ├─coffee                              
                                 │  ├─espresso                        
                                 │  └─latte                           
                                 │                                    
                                 └─Python                                
                                    └─branch                             
                                       └─init_theme         

                                  < Themes >  
                       
                       
                       
         - Larva race theme -                        - Korean -                      
                                                                            
            Larva race! 
                                                       .                               
            ...෴                                    ㅏㅡclothes                      
               ...෴                                 ㅣ  ㅏㅡshirts                   
               ...෴                                 ㅣ  ㅏㅡpants                    
                  ...෴                              ㅣ  ㅣ  ㄴㅡdenim                
                     ...෴                           ㅣ  ㅣ     ㄴㅡtapered           
               ...෴                                 ㅣ  ㄴㅡaccessories              
                                                      ㅣ                               
            ...෴                                    ㅏㅡcoffee                       
               ...෴                                 ㅣ  ㅏㅡespresso                 
               ...෴                                 ㅣ  ㄴㅡlatte                    
                                                      ㅣ                               
            ...෴                                    ㄴㅡPython                       
               ...෴                                    ㄴㅡbranch                    
                  ...෴                                    ㄴㅡinit_theme             

< How to import >
    import sys
    sys.path.append(*location(dir) of branch.py*)
    import branch as brn
< How to re-import >
    from imp import reload 
    reload(brn) 
< Code >
  import sys
  sys.path.append(%%your branch location%%)
  import branch as brn

  string = '[m] clothes [s] shirts [s] pants [ss] denim [sss] tapered [s] accessories \
            [m] coffee [s] espresso [s] latte \
            [m] Python [s] branch [ss] init_theme'

  default = brn.branch(string)
  theme_larva = brn.branch_theme('larva', string)
  theme_korean = brn.branch_theme('theme_korean', string)     

*you can also make your own theme ! define a new theme as a funtion, declare new 'top, bar, empty, middle, end, tip' variables with utf-8 characters, and try ur own theme by using 'branch_theme('your_theme', string)' !

=======

BRANCH

< branch used to show the list of functions in library>

BRANCH is a user module for expressing vertical / horizontal relationship between objects
inspired by directory branches, no additional libraries needed (acts only with lists)



different themes and theme customization are also available !


< How to use >
  1. you only need to download 'branch.py'. import this as an module in anywhere you want, and use with single lined code.

  2. branch making is only based on the bracketed sign and the sequence you write.

  3. [m] is for the top level titles, in this example, are 'clothes', 'coffee', 'Python'.

  4. [s] is sub-level of [m], [ss] is sub-level of [s], continously, [sss] is sub-level of [ss]..

  5. the shape of the branch will be automatically determined



                                                       < Input >  
                                                       
    string = '[m] clothes [s] shirts [s] pants [ss] denim [sss] tapered [s] accessories [m] coffee [s] espresso [s] latte [m] Python [s] branch [ss] init_theme'   
              
                                  < Result >  
                                  
                                  - Default -                      
                                                                                       
                                 .                                    
                                 ├─clothes                            
                                 │  ├─shirts                              
                                 │  ├─pants                       
                                 │  │  └─denim                            
                                 │  │     └─tapered                          
                                 │  └─accessories                     
                                 │                                     
                                 ├─coffee                              
                                 │  ├─espresso                        
                                 │  └─latte                           
                                 │                                    
                                 └─Python                                
                                    └─branch                             
                                       └─init_theme         

                                  < Themes >  
                       
                       
                       
         - Larva race theme -                        - Korean -                      
                                                                            
            Larva race! 
                                                       .                               
            ...෴                                    ㅏㅡclothes                      
               ...෴                                 ㅣ  ㅏㅡshirts                   
               ...෴                                 ㅣ  ㅏㅡpants                    
                  ...෴                              ㅣ  ㅣ  ㄴㅡdenim                
                     ...෴                           ㅣ  ㅣ     ㄴㅡtapered           
               ...෴                                 ㅣ  ㄴㅡaccessories              
                                                      ㅣ                               
            ...෴                                    ㅏㅡcoffee                       
               ...෴                                 ㅣ  ㅏㅡespresso                 
               ...෴                                 ㅣ  ㄴㅡlatte                    
                                                      ㅣ                               
            ...෴                                    ㄴㅡPython                       
               ...෴                                    ㄴㅡbranch                    
                  ...෴                                    ㄴㅡinit_theme             

< How to import >
import sys
sys.path.append(%%location(dir) of branch.py%%)
import branch as brn
< How to re-import >
from imp import reload 
reload(brn) 
< Code >
import sys
sys.path.append(%%location(dir) of branch.py%%)
import branch as brn

string = '[m] clothes [s] shirts [s] pants [ss] denim [sss] tapered [s] accessories \
          [m] coffee [s] espresso [s] latte \
          [m] Python [s] branch [ss] init_theme'

default = brn.branch(string)
theme_larva = brn.branch_theme('larva', string)
theme_korean = brn.branch_theme('theme_korean', string)     

*you can also make your own theme by defining a new 'theme function'. In the function, declare new 'top, bar, empty, middle, end, tip' variables with utf-8 characters, and try the custom theme by using 'themed_str = brn.branch_theme('your_theme', string)'

05d49652df26e27f1087868f4c40d6a02af1ba04

About

'branch' is a module to show vertical / horizontal relationship of things, and is inspired by directory branches

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published