# All Documents

- gtoolz
  index.html
  Module
  Module
  PUBLIC
  No module docstring; 0/5 variable, 0/3 constant, 149/151 functions, 4/4 classes documented
- gtoolz.__version__
  index.html#__version__
  Attribute
  Variable
  PUBLIC
  Undocumented
- gtoolz.dtime
  index.html#dtime
  Attribute
  Variable
  PUBLIC
  Undocumented
- gtoolz.SCRIPT
  index.html#SCRIPT
  Attribute
  Constant
  PUBLIC
  Undocumented
- gtoolz.styles_d
  index.html#styles_d
  Attribute
  Variable
  PUBLIC
  Undocumented
- gtoolz.fg_colors_d
  index.html#fg_colors_d
  Attribute
  Variable
  PUBLIC
  Undocumented
- gtoolz.bg_colors_d
  index.html#bg_colors_d
  Attribute
  Variable
  PUBLIC
  Undocumented
- gtoolz.Spinner
  gtoolz.Spinner.html
  Class
  Class
  PUBLIC
  purpose: prints a spinner in place input: msg="": str style='bar': ellipsis, pipe, box, vbar, growing_bar, missing_box, solid_box, arrow, clock, bar, balloons, moon, dot, braille, pulse prog|progressive|progress: bool color: str txt_color: str elspsed: bool requires: import sys import threading import itertools return: none use: with Spinner("Working...
- gtoolz.Spinner.__init__
  gtoolz.Spinner.html#__init__
  Function
  Method
  PUBLIC
  --== debugging ==--
- gtoolz.Spinner.color
  gtoolz.Spinner.html#color
  Attribute
  Instance Variable
  PUBLIC
  Undocumented
- gtoolz.Spinner.colors
  gtoolz.Spinner.html#colors
  Attribute
  Instance Variable
  PUBLIC
  --== SEP_LINE ==--
- gtoolz.Spinner.COLOR
  gtoolz.Spinner.html#COLOR
  Attribute
  Instance Variable
  PUBLIC
  Undocumented
- gtoolz.Spinner.TXT_COLOR
  gtoolz.Spinner.html#TXT_COLOR
  Attribute
  Instance Variable
  PUBLIC
  Undocumented
- gtoolz.Spinner.elapsed
  gtoolz.Spinner.html#elapsed
  Attribute
  Instance Variable
  PUBLIC
  Undocumented
- gtoolz.Spinner.time_color
  gtoolz.Spinner.html#time_color
  Attribute
  Instance Variable
  PUBLIC
  Undocumented
- gtoolz.Spinner.TIME_COLOR
  gtoolz.Spinner.html#TIME_COLOR
  Attribute
  Instance Variable
  PUBLIC
  Undocumented
- gtoolz.Spinner.etime
  gtoolz.Spinner.html#etime
  Attribute
  Instance Variable
  PUBLIC
  Undocumented
- gtoolz.Spinner.centered
  gtoolz.Spinner.html#centered
  Attribute
  Instance Variable
  PUBLIC
  Undocumented
- gtoolz.Spinner.RESET
  gtoolz.Spinner.html#RESET
  Attribute
  Instance Variable
  PUBLIC
  Undocumented
- gtoolz.Spinner.start_time
  gtoolz.Spinner.html#start_time
  Attribute
  Instance Variable
  PUBLIC
  Undocumented
- gtoolz.Spinner.style
  gtoolz.Spinner.html#style
  Attribute
  Instance Variable
  PUBLIC
  Undocumented
- gtoolz.Spinner.prog
  gtoolz.Spinner.html#prog
  Attribute
  Instance Variable
  PUBLIC
  Undocumented
- gtoolz.Spinner.style_len
  gtoolz.Spinner.html#style_len
  Attribute
  Instance Variable
  PUBLIC
  --== set default ==--
- gtoolz.Spinner.chr_cnt
  gtoolz.Spinner.html#chr_cnt
  Attribute
  Instance Variable
  PUBLIC
  Undocumented
- gtoolz.Spinner.clr_cnt
  gtoolz.Spinner.html#clr_cnt
  Attribute
  Instance Variable
  PUBLIC
  Undocumented
- gtoolz.Spinner.spinner
  gtoolz.Spinner.html#spinner
  Attribute
  Instance Variable
  PUBLIC
  Undocumented
- gtoolz.Spinner.delay
  gtoolz.Spinner.html#delay
  Attribute
  Instance Variable
  PUBLIC
  Undocumented
- gtoolz.Spinner.busy
  gtoolz.Spinner.html#busy
  Attribute
  Instance Variable
  PUBLIC
  Undocumented
- gtoolz.Spinner.spinner_visible
  gtoolz.Spinner.html#spinner_visible
  Attribute
  Instance Variable
  PUBLIC
  --== SEP_LINE ==--
- gtoolz.Spinner.write_next
  gtoolz.Spinner.html#write_next
  Function
  Method
  PUBLIC
  Undocumented
- gtoolz.Spinner.spin_backover
  gtoolz.Spinner.html#spin_backover
  Function
  Method
  PUBLIC
  Undocumented
- gtoolz.Spinner.spin_proc
  gtoolz.Spinner.html#spin_proc
  Function
  Method
  PUBLIC
  Undocumented
- gtoolz.Spinner.__enter__
  gtoolz.Spinner.html#__enter__
  Function
  Method
  PUBLIC
  Undocumented
- gtoolz.Spinner._screen_lock
  gtoolz.Spinner.html#_screen_lock
  Attribute
  Instance Variable
  PRIVATE
  Undocumented
- gtoolz.Spinner.thread
  gtoolz.Spinner.html#thread
  Attribute
  Instance Variable
  PUBLIC
  --== SEP_LINE ==--
- gtoolz.Spinner.__exit__
  gtoolz.Spinner.html#__exit__
  Function
  Method
  PUBLIC
  Undocumented
- gtoolz.Spinner_demo
  index.html#Spinner_demo
  Function
  Function
  PUBLIC
  purpose: demo of Spinner
- gtoolz.Transcript
  gtoolz.Transcript.html
  Class
  Class
  PUBLIC
  Transcript - direct print output to a file, in addition to terminal. It appends the file target Usage: import transcript transcript.start('logfile.log') print("inside file") transcript.
- gtoolz.Transcript.__init__
  gtoolz.Transcript.html#__init__
  Function
  Method
  PUBLIC
  Undocumented
- gtoolz.Transcript.terminal
  gtoolz.Transcript.html#terminal
  Attribute
  Instance Variable
  PUBLIC
  Undocumented
- gtoolz.Transcript.logfile
  gtoolz.Transcript.html#logfile
  Attribute
  Instance Variable
  PUBLIC
  --== SEP_LINE ==--
- gtoolz.Transcript.write
  gtoolz.Transcript.html#write
  Function
  Method
  PUBLIC
  Undocumented
- gtoolz.Transcript.flush
  gtoolz.Transcript.html#flush
  Function
  Method
  PUBLIC
  Undocumented
- gtoolz.write_file
  index.html#write_file
  Function
  Function
  PUBLIC
  purpose: writes data to a file typically as a csv file (or a .dat file) - creates a new file or appends an existing file options: - colnames: list (adds hdr line if not currently there) - comment_lines: str | list - bak: bool # make a backup file - indx: bool # not used yet - future flag for adding an index col (first column) or not - prnt: bool # turns on print - ask: bool # ask before actually writing data to file (before overwriting the file) - append: bool # whether to append data - the default=False whereby submitted data will overwrite the file - dat: bool # this is a special flag to declare that the first line (hdr) is made a comment starting it with "#" returns: bool # true if successful write Notes: - only use this to write a data file = either csv (or a dat file which is a csv file with the header commented) - data should be a list of lists (rows of cols) - assumes first line is comma delimited colnames or use colnames option (in a dat file the first line will be commented) - all comments will go to/near the top - if the file ends with the "...
- gtoolz.transcript_start
  index.html#transcript_start
  Function
  Function
  PUBLIC
  Start class Transcript(object=filename), appending print output to given filename
- gtoolz.transcript_stop
  index.html#transcript_stop
  Function
  Function
  PUBLIC
  Stop class Transcript() and return print functionality to normal
- gtoolz.transcript_demo
  index.html#transcript_demo
  Function
  Function
  PUBLIC
  Undocumented
- gtoolz.ThreadWithReturn
  gtoolz.ThreadWithReturn.html
  Class
  Class
  PUBLIC
  requires: import threading usage: run_cmd_threaded(cmd) which does this ... dbug("Just getting started...") cmd = "/home/geoffm/ofrd.sh" t1 = ThreadWithReturn(target=run_cmd, args=(cmd,)) t1...
- gtoolz.ThreadWithReturn.__init__
  gtoolz.ThreadWithReturn.html#__init__
  Function
  Method
  PUBLIC
  Undocumented
- gtoolz.ThreadWithReturn._return
  gtoolz.ThreadWithReturn.html#_return
  Attribute
  Instance Variable
  PRIVATE
  --== SEP_LINE ==--
- gtoolz.ThreadWithReturn.run
  gtoolz.ThreadWithReturn.html#run
  Function
  Method
  PUBLIC
  Undocumented
- gtoolz.ThreadWithReturn.join
  gtoolz.ThreadWithReturn.html#join
  Function
  Method
  PUBLIC
  Undocumented
- gtoolz.funcname
  index.html#funcname
  Function
  Function
  PUBLIC
  purpose: returns current function name - primarily used for debugging
- gtoolz.lineno
  index.html#lineno
  Function
  Function
  PUBLIC
  purpose: returns current line number - primarily used for debugging
- gtoolz.ddbug
  index.html#ddbug
  Function
  Function
  PUBLIC
  purpose: this is for use by dbug only... as dbug can't call itself
- gtoolz.dbug
  index.html#dbug
  Function
  Function
  PUBLIC
  purpose: display DEBUG file, function, linenumber and your msg of local variable content required: xvar: str ... can be a local variable, a python statement, a string, a list options: -ask: bool # forces a breakpoint, stops execution ans asks the user before continuing -here: bool # will only return the DEBUG info (file, function...
- gtoolz.dbug_demo
  index.html#dbug_demo
  Function
  Function
  PUBLIC
  purpose: A quick-n-dirty demo of using dbug()
- gtoolz.gselect
  index.html#gselect
  Function
  Function
  PUBLIC
  purpose: menu type box for selecting by index, key, or value required: - selections: list or dictionary options: - prompt: str # no need to include ": " - rtrn='' # can be 'k|key' or 'v|val|value' or "i" | "int" <-- tells gselect whether you want it to return a key or a value from a supplied list or dictionary or just user input (default) # if "i"|"int" is invoked then the value of the key will return as an integer (as opposed to a string) This is an important option and allows control over what gets returned...
- gtoolz.gselect_demo
  index.html#gselect_demo
  Function
  Function
  PUBLIC
  demo of using gselect
- gtoolz.kvarg_val
  index.html#kvarg_val
  Function
  Function
  PUBLIC
  purpose: returns a value when the key in a key=value pair matches any key given NOTE: key can be a string or a list of strings option: dflt="Whatever default value you want" use: used in function to get a value from a kwargs ky=value pair - eg: def my_function(*args, **kwargs): txt_center = kvarg_val(["text_center", "txt_cntr", "txtcntr"], kwargs, dflt=1) - so if you call my_function(txt_center=99) then txt_center will be set to 99 --- If any key in the list is set = to a value, that value is returned see: bool_val which process both args and kvargs and returns bool_val input key(string), kvargs_d(dictionary of key,vals), default(string; optional) purpose: return a value given by a key=value pair using a matching key (in key list if desired) options: - key provided can be a string or a list of strings - dflt="Whatever default value you want - can be a string, list, int, float...
- gtoolz.kvarg_val_demo
  index.html#kvarg_val_demo
  Function
  Function
  PUBLIC
  WIP
- gtoolz.bool_val
  index.html#bool_val
  Function
  Function
  PUBLIC
  purpose: look at args and kwargs with a list of possible option strings and return the default True or False requires: - key_l: str | list # this is the string or list of strings to check args and kwargs against options: - default | dflt: bool # the default value to return - opposite | opposites: str | list # a list of opposites eg: prnt = bool_val(["print", "prnt"], args, kwargs, dflt=True, opposites=['noprnt', 'no_prnt', 'no_print']) return True or False Notes: key_l can be a str or list args_l must be provided kvargs is optional used to see if a string or a list of stings might be declared true by being in args or seeing it has a bool value set in kvargs use: DBUG = bool_val('dbug', args, kvargs) or DBUG = bool_val(['dbug', 'DBUG'], args, kvargs)...
- gtoolz.bool_val_demo
  index.html#bool_val_demo
  Function
  Function
  PUBLIC
  Undocumented
- gtoolz.cfg_val
  index.html#cfg_val
  Function
  Function
  PUBLIC
  purpose: to retrieve cfg val while allowing different key name request to get a specific key options: returns: value use: cfg_d = handleCFG("/path/to/api.cfg") api_key = cfg_val(["api", "key", "api_key"], 'testpypi', cfg_d, dflt="1234") # above will find the api_key if it is defined in the file with any of the names in the list for section='testpypi'...
- gtoolz.docvars
  index.html#docvars
  Function
  Function
  PUBLIC
  purpose: wrapper for function to allow variable substitution within its doc I use this in front on a function I call handleOPTS(args) which works with the module docopts Thank you to stackoverflow.com: answered Apr 25 '12 at 1:54 senderle this is a very useful way to allow variables in your __doc__ strings wrap a function with this and use if this way eg: @docvars(os...
- gtoolz.handleCFG
  index.html#handleCFG
  Function
  Function
  PUBLIC
  purpose: if no cfg_file given it will find the default and return cfg_d (dictionary of dictioanries: cfg.sections; cfg.elem:vals) input: cfg_file: str defaults: cfg_file if it exists is: {myappname.basename}...
- gtoolz.browseit
  index.html#browseit
  Function
  Function
  PUBLIC
  purpose: opens the url in your browser requires: url: str returns: none
- gtoolz.handleOPTS
  index.html#handleOPTS
  Function
  Function
  PUBLIC
  Usage: {0} [-hEP] [--dir] [<filename>] {0} -s <func> {0} -S <func> {0} -t [<func>] {0} -T <func> [<fargs>] {0} --version
- gtoolz.centered
  index.html#centered
  Function
  Function
  PUBLIC
  purpose: calculates screen placement for msgs: list|str options: length=columns: int shift=0: int 'str'|'string'=False: bool 'lst'|'list'=True: bool returns: line|lines note: replaces deprecated centerit()...
- gtoolz.centered_demo
  index.html#centered_demo
  Function
  Function
  PUBLIC
  purpose: demo of using centered() returns: None
- gtoolz.ruleit
  index.html#ruleit
  Function
  Function
  PUBLIC
  purpose: This is for development purposes It draws a rule across the screen and that is all it does It fails to prepare your meals or schedule your week's agenda, sorry. options: - width: int # default=0 - truncates at this len otherwise it is screen length - cntr: bool # default=False - provide center info - prnt: bool # default=True - whether to print returns: printed ruler line with tick marks and marker numbers below...
- gtoolz.ruleit_demo
  index.html#ruleit_demo
  Function
  Function
  PUBLIC
  purpose: demo of using ruleit() returns: None
- gtoolz.do_close
  index.html#do_close
  Function
  Function
  PUBLIC
  purpose: to provide a boxed closing message default msg is below options: - quote: str # should a random quote from filename provided be included - quoote_box_color: str # box color for quote default="White...
- gtoolz.convert_temp
  index.html#convert_temp
  Function
  Function
  PUBLIC
  expects a string with either an ending.lower() of "f" or "c" to declare what to return returns rounded(converted_temp) always returns a string with 2 places (inlcuding 0s)
- gtoolz.do_logo
  index.html#do_logo
  Function
  Function
  PUBLIC
  purpose: presents a boxed logo for the begining of a program requires: nothing but you should provide some default content: str|list options: - content: str|list, - prnt: bool, - figlet: bool, - center: bool, - shadow: bool, - box_color: str, - color: str, - fotune: bool <-- requires the fortune app...
- gtoolz.do_logo_demo
  index.html#do_logo_demo
  Function
  Function
  PUBLIC
  purpose: demo of using do_logo() returns: None
- gtoolz.cls
  index.html#cls
  Function
  Function
  PUBLIC
  purpose: Clears the terminal screen. returns: None
- gtoolz.askYN
  index.html#askYN
  Function
  Function
  PUBLIC
  purpose: using msg as a prompt, this will ask for a simple Yes or No response and return a bool Typically used with an "if " statement but can simply be used as: askYN() options: - centered: bool - boxed: bool # puts only the prompt in a box with a reply prompt centered under it - timeout: int=0: int # how long to wait in seconds - auto: bool - exit: bool - quit: bool # if response is in ("q"...
- gtoolz.askYN_demo
  index.html#askYN_demo
  Function
  Function
  PUBLIC
  purpose: demo of using askYN() function returns: None
- gtoolz.get_dtime_format
  index.html#get_dtime_format
  Function
  Function
  PUBLIC
  purpose: returns the format of a date-time stamp string useful for date series in dataframes options: none returns date patters in strftime format
- gtoolz.cat_file
  index.html#cat_file
  Function
  Function
  PUBLIC
  purpose: reads a file and return lines or rows_lol (list of list) or as a df (dataframe) options: - prnt: bool, # prints out the file contents - lst: bool, # returns a list of lines or you could use: txt...
- gtoolz.file_exists
  index.html#file_exists
  Function
  Function
  PUBLIC
  purpose: returns bool if the file (or directory - see options) exists or is it executable options: type: str # Note: type can be "file" or "dir" (if it isn't file the assumption is dir) if type == "x" or "X" then the return bool will depend on if the file is executable returns: bool usage: file_exists('/etc/hosts') True...
- gtoolz.purify
  index.html#purify
  Function
  Function
  PUBLIC
  purpose: de-comments a file, aka removes all comments denoted by "#" ... input: file: str return lines: list (decommented lines)
- gtoolz.ireplace
  index.html#ireplace
  Function
  Function
  PUBLIC
  purpose: index replace To get indices use eg: iter = re.finditer(rf"{c}", s) indices = [m.start(0) for m in iter] # next line removes first two and last two indices - just an example indices = indices[2:-2] then use this func with: s: is the string to do the replacements indices: list of indexed positions char: is the char to replace with...
- gtoolz.first_matched_line
  index.html#first_matched_line
  Function
  Function
  PUBLIC
  purpose: return: just the first matched line(s) from a filename using pattern required: - filename: str - pattern: str options: - upto: int default=1 # How many matching lines to return returns: matching lines...
- gtoolz.pp_d
  index.html#pp_d
  Function
  Function
  PUBLIC
  purpose: pretty print a dictionary deprecated as gtable does this with between (str) placed between elems and kv_s (str) between k and v >>> d = {"one": 1, "two": 2, "three": 3} >>> print(pp_d(d)) one: 1 two: 2 three: 3...
- gtoolz.kv_cols
  index.html#kv_cols
  Function
  Function
  PUBLIC
  input: my_d: dict cols:default=3 <-- both args ie: dict and cols are required! options: - title, header, pad, box_style, box_color: str, color: str, neg: bool, - prnt: bool, footer,title: str, rjust_cols: list, sep,pad: str, max_col_width: int, - centered: bool, box_style: str, human: bool, rnd: bool, box_title: bool (requires title), sep: str - hdr: bool default=True - no_hdr: bool # removes hdr/colnames from tables returns: lines tabalized key-value pairs...
- gtoolz.kv_cols_demo
  index.html#kv_cols_demo
  Function
  Function
  PUBLIC
  purpose: demo of using kv_cols() returns: None
- gtoolz.rowscols_cols
  index.html#rowscols_cols
  Function
  Function
  PUBLIC
  purpose: this takes a longish lol - namely, rows of columns and allows you to split those rows into X columns. This is most likely used to split up rows of columns for gtables so an option include colnames to add to the top of each new column of rows cols: This is an experiment but I think it could be useful Here is a simple visual row_of_cols +------+-----+----+ | | | | +------+-----+----+ | | | | +------+-----+----+ | | | | +------+-----+----+ | | | | +------+-----+----+ | | | | +------+-----+----+ | | | | +------+-----+----+ | | | | +------+-----+----+ split_tables = rowscols_cols(row_of_cols, 2) +------+-----+----+ +------+-----+----+ | | | | | | | | +------+-----+----+ +------+-----+----+ | | | | | | | | +------+-----+----+ +------+-----+----+ | | | | | | | | +------+-----+----+ +------+-----+----+ | | | | +------+-----+----+ TODO...
- gtoolz.key_swap
  index.html#key_swap
  Function
  Function
  PUBLIC
  purpose: switch or change the keyname (a single key) on an element in a dictionary args: orig_key # original key name new_keyA # new key name d # dictionay to change returns: the altered dictionary...
- gtoolz.gcolumnize
  index.html#gcolumnize
  Function
  Function
  PUBLIC
  purpose: This will columnize (vertically) a list or a list of blocks or strings input: msg_l: list|lol options: - width|length=0: int # max width or use cols below - cols: int # number of desired columns - sep|sep_chrs|sepchrs=' | ': str # string or character to use between columns - prnt|print|show = False: bool - boxed: bool # box the output - box_color: str # color to use for box border - centered = False: bool # only invoked if prnt == True - title = "": str # only invoked if prnt == True - color: str - footer = "": str # only invoked if prnt == True - positions: list # list of either triplets or lists with 3 values, (row, col, position) --- position can easily be declared as 1-9 -> see gblock()...
- gtoolz.gcolumnize_demo
  index.html#gcolumnize_demo
  Function
  Function
  PUBLIC
  purpose: A demo of using gcolumnize Great for build quick dashboards
- gtoolz.matrix
  index.html#matrix
  Function
  Function
  PUBLIC
  purpose: initialize a matirx (ie array) required: rows/dim1: int, cols/dim2: int options: - dflt_val=None: anything # default "value" to initialize each "cell" to returns: 2 dim initialized array/matrix aka: init_arr | initarray | init_arr...
- gtoolz.sayit
  index.html#sayit
  Function
  Function
  PUBLIC
  purpose: This will use computer voice (espeak) to "say" the msg options - prnt: will print as well # this is very limited - gender: str # m | f - volume: float # 0 - 1 - rate: int # default = 150 - tone: int # 1 - 5 <-- this does not seem to do anything...
- gtoolz.sayit_demo
  index.html#sayit_demo
  Function
  Function
  PUBLIC
  purpose: demo of using sayit() returns: None
- gtoolz.printit
  index.html#printit
  Function
  Function
  PUBLIC
  purpose: prepares and prints (option) msg: str|list and can put in unicode color box, centered in terminal and with color required: msg: str|list (can contain color codes (see below) options: "boxed" | boxed=False # prepares a box around msg "centered" | centered=False # centers horizontally msg on a termial screen "shadowed" | shadowed=True # adds a shadow typically around a box "prnt" | prnt=True # print line(s) or just return them as a str (useful for input(printit("What do you want...
- gtoolz.printit_demo
  index.html#printit_demo
  Function
  Function
  PUBLIC
  purpose: demo of using printit() returns: None
- gtoolz.clr_coded
  index.html#clr_coded
  Function
  Function
  PUBLIC
  purpose: takes any msg string containing tags for colors and decodes them into a colorized string requires: msg_s: str returnd: colorized string decode a string - replace \[color\].*[\/] with code and reset requires a space before the first bracket...
- gtoolz.clr_coded_demo
  index.html#clr_coded_demo
  Function
  Function
  PUBLIC
  purpose: demo of using clr_coded() returns: None
- gtoolz.gclr
  index.html#gclr
  Function
  Function
  PUBLIC
  Purpose: to return color code + text (if any) NOTE: sub_color() uses this! input: text: str = "" # if "" then the color code alone is returned color: str = 'normal' # examples: 'red on black', 'bold green on normal', 'bold yellow on red', 'blink red on black' etc reset: bool # adds a color reset after the text Notes: color is the first argument because you may just want to return the color code only run gcolors...
- gtoolz.clr_tst
  index.html#clr_tst
  Function
  Function
  PUBLIC
  purpose: This is strictly for developer testing strickly for developer use - given an ansi color CODE will display it in a way to see if it works as expected displays COLOR_TEST: This should be displayed using CODE returns: None...
- gtoolz.shades
  index.html#shades
  Function
  Function
  PUBLIC
  purpose: returns a list of increasing intensity color shades requires = color: str options: - num=16 <-- number to divide into 255 ~ the number of color intensities - rtrn??? TODO return codes or text...
- gtoolz.rgb
  index.html#rgb
  Function
  Function
  PUBLIC
  purpose: translated rgb(r,g,b) text into ansi color CODE input: r, g, b, text prfx: bool = False bg: bool = False # if set to true the color is applied to bg returns: rgb color coded text
- gtoolz.xlate_clr
  index.html#xlate_clr
  Function
  Function
  PUBLIC
  purpose: translates special color names to rgb(r,g,b) for processing requires: special color eg: - greyXX | grayXX # where XX is a precent gradient of gray from 0,0,0 for black! to 255,255,255 white - white...
- gtoolz.sub_color
  index.html#sub_color
  Function
  Function
  PUBLIC
  purpose: substiture ansi color CODE for given color returns ansi-CODE
- gtoolz.RESET
  index.html#RESET
  Attribute
  Constant
  PUBLIC
  Undocumented
- gtoolz.BLACK
  index.html#BLACK
  Attribute
  Constant
  PUBLIC
  Undocumented
- gtoolz.wrapit
  index.html#wrapit
  Function
  Function
  PUBLIC
  purpose: turns line(s) into a list of strings with full words less than or equal to length input is sentence which can be a string or list returns lines list wrapped using length and color if provided NOTE: all color codes will get stripped out before processing requires import of wrapper...
- gtoolz.wrapit_demo
  index.html#wrapit_demo
  Function
  Function
  PUBLIC
  purpose: demo of using wrapit returns: None
- gtoolz.get_columns
  index.html#get_columns
  Function
  Function
  PUBLIC
  gets screen/terminal cols OR rows returns int(columns)| int(rows: bool) | int(cols), int(rows) both: bool
- gtoolz.replace_all
  index.html#replace_all
  Function
  Function
  PUBLIC
  purpose: replaces every dict key with dict value in a string with_d eg: {' ', ' ', 'foo', 'bar'} returns: str TODO need more doc info here
- gtoolz.boxed
  index.html#boxed
  Function
  Function
  PUBLIC
  purpose: draw a unicode box around msgs args: msgs options: centered | center: bool # centers box on the screen prnt: bool txt_center: int # num of lines from top to center in the box color: str # text color box_color: str # color of border title, footer: str # goes in topline or bottom line centered of box width forces the width size defaults to # screen columns shadowed | shadow: bool # adds a shadow right and bottom...
- gtoolz.gline
  index.html#gline
  Function
  Function
  PUBLIC
  purpose: prints a line with msg and options: - width: int, - msg|title: str # default="" msg has to be a key=val pair! eg: gline(60, msg="My Message", just='center') - fc: str # default=" " fill string/character (char(s) used to fill all surrounding space default: lc=rc=fc) - lc: str # default=fc left/edge/corner (char(s) for left corner ie first charater(s)) - rc: str # default=lc right/edge/corner (char(s) for right corner ie last charcter(s)) - pad: str # default="" string/character(s) on each side of msg - lpad: str # default=pad - rpad: str # default=lpad - box_color: str - color: str - lfill_color: str - rfill_color: str - just: str # default = "left"|"l" but can be declared "center"|"c" or 'right'|"r" - prnt: bool # prints the output returns: line: str...
- gtoolz.gtitle
  index.html#gtitle
  Function
  Function
  PUBLIC
  purpose: quick-n-dirty Title/Separation Line - I use this just to separate sections returns: prints a line with "=" fill character and msg in the middle (centered) with width=width see: gline_demo
- gtoolz.gline_demo
  index.html#gline_demo
  Function
  Function
  PUBLIC
  purpose: demo of using gline() returns: None
- gtoolz.MenuBox
  gtoolz.MenuBox.html
  Class
  Class
  PUBLIC
  purpose: sets up a menu selection box executes selected function and arguments quits (returns) on "Enter" "Q" or "q" arguments: bclr: box color eg "reb" "blue" "green" clines: number of lines to center in the box center: center menu default is True methods: add_selection(["selection_name", func, arg1, arg2,...
- gtoolz.MenuBox.__init__
  gtoolz.MenuBox.html#__init__
  Function
  Method
  PUBLIC
  Undocumented
- gtoolz.MenuBox.name
  gtoolz.MenuBox.html#name
  Attribute
  Instance Variable
  PUBLIC
  Undocumented
- gtoolz.MenuBox.title
  gtoolz.MenuBox.html#title
  Attribute
  Instance Variable
  PUBLIC
  Undocumented
- gtoolz.MenuBox.selections
  gtoolz.MenuBox.html#selections
  Attribute
  Instance Variable
  PUBLIC
  Undocumented
- gtoolz.MenuBox.msgs
  gtoolz.MenuBox.html#msgs
  Attribute
  Instance Variable
  PUBLIC
  Undocumented
- gtoolz.MenuBox.cnt
  gtoolz.MenuBox.html#cnt
  Attribute
  Instance Variable
  PUBLIC
  Undocumented
- gtoolz.MenuBox.clines
  gtoolz.MenuBox.html#clines
  Attribute
  Instance Variable
  PUBLIC
  Undocumented
- gtoolz.MenuBox.bclr
  gtoolz.MenuBox.html#bclr
  Attribute
  Instance Variable
  PUBLIC
  Undocumented
- gtoolz.MenuBox.center
  gtoolz.MenuBox.html#center
  Attribute
  Instance Variable
  PUBLIC
  Undocumented
- gtoolz.MenuBox.add_selection
  gtoolz.MenuBox.html#add_selection
  Function
  Method
  PUBLIC
  Undocumented
- gtoolz.MenuBox.show
  gtoolz.MenuBox.html#show
  Function
  Method
  PUBLIC
  Undocumented
- gtoolz.isnumber
  index.html#isnumber
  Function
  Function
  PUBLIC
  purpose: determines if x is a number even if it is a percent, or negative, or is 2k or 4b or 10M etc or test for stricktly float options: - float: bool # is this a float - human: test the submission after stripping off "human" symbols like "M" or "G" or "%" etc input: x: str|float|int returns: True|False notes: tests...
- gtoolz.isnumber_demo
  index.html#isnumber_demo
  Function
  Function
  PUBLIC
  purpose: test/demo of using isnamber() returns: None
- gtoolz.get_boxchrs
  index.html#get_boxchrs
  Function
  Function
  PUBLIC
  purpose: given a box_style (ansi, single, solid, double) will return a set of chars for creating a box input: box_style: str return: [tl, hc, ts, tr, vc, ls, rs, ms, bl, bs, br] as a list in the order shown Note: boxed() uses this tl = top_left, hc=horizontal_char, ts=top_separator, tr=top_right, vc=vertical_char, ls=left_separator, rs=right_separator, ms=middle_separator bl=bottom_left, bs=bottom_sep, br=bottom_right...
- gtoolz.flattenit
  index.html#flattenit
  Function
  Function
  PUBLIC
  purpose: "flattens nested lists options: none returns: list
- gtoolz.fixlol
  index.html#fixlol
  Function
  Function
  PUBLIC
  purpose: makes the length or every "row" in a list of lists the same number of elements (length) options: - length: int # defaults to the length of the first row ie len(my_lol[0]) - blank: str|None # defaults to None but can be any string eg blank="...
- gtoolz.cnvrt2lol
  index.html#cnvrt2lol
  Function
  Function
  PUBLIC
  purpose: accepts any type of "data" (ie str|list|pandas|list of dictionaries|csv_file_name etc) and converts to a list of lists (ie lol) options: - colnames: list|str # list of colnames or string eg: "firstline"|"firstrow" declares that the firstrow is already the colnames - delimeter: char # if a filename is supplied (assumes a csv type file) this delimiter will be used to separate column values - index: bool # TODO - fix: bool # will "fix" all the rows of an lol to the length of the first row (be careful with this) - blanks: str|None # default=None blanks sets the string for elements added in row when fix option is used returns: a list of lists (rows of columns) with the first row having colnames...
- gtoolz.cnvrt2lol_demo
  index.html#cnvrt2lol_demo
  Function
  Function
  PUBLIC
  purpose: demo cnvrt2lol returns: None
- gtoolz.gtable
  index.html#gtable
  Function
  Function
  PUBLIC
  purpose: returns lines or displays a colorized table from a list_of_lists, df, or dictionary input: rows: str|list|dict|list_of_lists|list_of_dicts|dataframe options: - color: str, - box_style: 'single', 'double', 'solid', - box_color: str, - header|hdr: bool, # header | hdr # highlights the colnames - end_hdr: bool # adds highlighted hdr/colnames to the bottom of the table - colnames: list | str, 'firstrow' | 'firstline' | 'keys' - col_colors: list, # gtable will use this list of colors to set each column, repeats if more cols than colors - neg: bool | list, - nan: str, - alt: bool_val, - alt_color: str, - title: str, - footer: str, - indexes: bool, - box_style: str, - max_col_len|col_limit|col_len...
- gtoolz.gtable_demo
  index.html#gtable_demo
  Function
  Function
  PUBLIC
  purpose: test/demo using gtable() returns: None
- gtoolz.chunkit
  index.html#chunkit
  Function
  Function
  PUBLIC
  purpose: break a list into a list of chunks - each chunk having size=size requires: my_l: list (eg boxes), size: int options: - full: bool # puts empty "cells" to make all "list chunks" the same number of elems - cols: bool # turn size into number of chunks or cols note: you can do this yourself eg size = len(my_l) // cols # where cols = number of columns <-- this method would probably less confusing returns: a list of lists(chunks) note: this is used: in a dashboard columns of boxes - see gcolumnize and in gtables...
- gtoolz.splitit
  index.html#splitit
  Function
  Function
  PUBLIC
  purpose: given a string (s), split it using delimiter which can be a string or regex requires: import re input: - s: str # string to split - delimiiter=" ": str options: none returns: phrases: list # string split into elements notes: eg: delimiter = r"["|'] +[-–—―] +" # amazingly all those dashes are different symbols...
- gtoolz.split_codes
  index.html#split_codes
  Function
  Function
  PUBLIC
  purpose: to split out ansi codes and return them input: elem: str (that contains ansi codes for color) options: TODO include elem dflt=False returns: codes: list (unless elem=True [or 'with_elem' or 'asdict'], then it is a dictionary with preffix, elem, and suffix as key/value pairs) notes: - used in cond_num() aka: color_neg() - NOTE: this function expects both a prefix code and a suffix code...
- gtoolz.split_codes_demo
  index.html#split_codes_demo
  Function
  Function
  PUBLIC
  purpose: test/demo of splitting ansii code away from a string returns: None
- gtoolz.cond_num
  index.html#cond_num
  Function
  Function
  PUBLIC
  purpose: this conditions (colorizes, rounds, and adds commas and unit indicators) elems if they are numbers input: elem options: "neg_color=red on black!": str, pos_color="green! on black!": str, rnd=0: int - color: bool # will color the number...
- gtoolz.get_random_line
  index.html#get_random_line
  Function
  Function
  PUBLIC
  purpose: grabs one random line from a file requires: from this_file purify_file, centered, boxed, printit, cat_file import random file: str | list # can be a filename or it can be a list of lines returns: line Note: file has all comments removed first (purified)...
- gtoolz.run_cmd_threaded
  index.html#run_cmd_threaded
  Function
  Function
  PUBLIC
  purpose: runs a cmd as a thread options: - lst: bool # returned output lines will be put into a list rather than a str return: output from cmd Note: Please, be aware that a result will be returned only after this finishes so put it "later" rather than "sooner" in your app - does not currently return error msgs...
- gtoolz.run_cmd
  index.html#run_cmd
  Function
  Function
  PUBLIC
  purpose: runs cmd and returns output eg: out = run_cmd("uname -o",False) # now you can print the output from the cmd: print(f"out:{out}") options: - lst: bool # ouput will return as a list of line rather than a str - rc: bool # returns the cmd return code instead of output - both: bool # returns (output, rc) - runas: str # you can declare who to run the cmd as - prnt: bool # print output - returns None returns: output from command Note: if runas == sudo then the command will be sun with sudo...
- gtoolz.run_cmd_demo
  index.html#run_cmd_demo
  Function
  Function
  PUBLIC
  purpose: demo of run_cmd(cmd) returns: None
- gtoolz.grep_lines
  index.html#grep_lines
  Function
  Function
  PUBLIC
  purpose: searches lines (or file if lines is a filename) for pattern options: - ic: bool (insensitive case) - rtrn_bool=False: bool # (whether to rtrn lines [default] or bool result) - csv: bool # will convert a list of lists to a list of csv style lines before searching - # and but returns the line as a list, just the way we got it returns: matched line(s) (or True False if rtrn_bool is True) Note: if only one line is matched then it will return that one line otherwise it will return a list of matched_lines...
- gtoolz.list_files
  index.html#list_files
  Function
  Function
  PUBLIC
  purpose: prints a list of enumerated basename filenames (sorted by name) input: dirs=list|str options: pattern: str|list = "*" # glob pattern return_msgs<bolean> = False prnt<bolean> = False dirs: bool # include dirs dir_only: bool # only dirs links: bool # include links returns: a sorted list of those names or return_msgs and sorted names use: list_files("/tmp")...
- gtoolz.select_file
  index.html#select_file
  Function
  Function
  PUBLIC
  purpose: select a file (or dir) from using pattern(s) required: options: - path: str|list (defaults to "./") - pattern: str|list - prompt: str - mtime: bool # include mtime in listing - centered - dirs: bool # include dirs - dirs_only: bool # only directories - prnt: bool - shadow - footer - width=0 use: f = select_file("/home/user","*...
- gtoolz.reduce_line
  index.html#reduce_line
  Function
  Function
  PUBLIC
  purpose: reduce a line to no more than max_len with and no broken words then return the reduced_line, and remaining_line returns: tuple - this_line(reduced) and the remaining part of the line Note - used in wrapit()...
- gtoolz.escape_ansi
  index.html#escape_ansi
  Function
  Function
  PUBLIC
  purpose: Removes ansii codes from a string (line) returns: "cleaned no_code" line TODO: allow option to return clr_codes[1], nocode(elem), clr_codes[2] see: split_codes() aka: name should be escape_ansii...
- gtoolz.gclr_demo
  index.html#gclr_demo
  Function
  Function
  PUBLIC
  purpose: demo of using gclr() returns: None
- gtoolz.nclen
  index.html#nclen
  Function
  Function
  PUBLIC
  purpose: finds the length of a string minus any ansi-codes and returns that lenght returns: length aka: no_color len of line (length w/o ansii codes)
- gtoolz.do_edit
  index.html#do_edit
  Function
  Function
  PUBLIC
  purpose: launches vim editor with file a quick-n-dirty utility to edit a file options: - lnum: line number Initiate edit on a file - with lineno if provided
- gtoolz.cinput
  index.html#cinput
  Function
  Function
  PUBLIC
  aka: centered input purpose: gets input from user using provided promt - centers the prompt on the screen options: - shift: int # allows you to shift the position of the prompt (from the center) eg shift=-5 - quit|exit|close: bool # will quit with do_close() if availaable or just sys...
- gtoolz.do_prcnt_bar
  index.html#do_prcnt_bar
  Function
  Function
  PUBLIC
  purpose: displays a percentge bar args: amnt (prcnt) options: full_range=100 if you submit this prcnt will be based on it - bar_width=40: int # declares width of bar - color: str # text color - done_color: # color of done portion - undone_color: # color of undone portion - done_chr: str # done character - undone_chr: str # undone character - prompt: str # prompt (before the bar) - suffix: str # suffix (afterr the bar) - brackets=["[", "]"]: list - show_prcnt=True: bool # include the percentage at the end - prnt=False: bool # False to allow use in dashboards # you can tell this to not print so you can include in in a box etc returns: percent bar line as a str #>>> rh = 56 #>>> rl = 50 #>>> cp = 51 #>>> amnt = cp - rl #>>> full_range = rh - rl #>>> print(f"rl {do_prcnt_bar(amnt,full_range)} rh") # rl [██████----------------------------------]16% rh...
- gtoolz.progress
  index.html#progress
  Function
  Function
  PUBLIC
  purpose: displays a progress bar typically used within a loop options: - width - prompt - color - done_color - undone_color - prnt - COLOR - DONE_COLOR - UNDONE_COLOR - RESET - done_chr - undone_chr - status - center_b - shift: returns: none # prcnt = 0...
- gtoolz.from_to
  index.html#from_to
  Function
  Function
  PUBLIC
  purpose: returns lines from a *file* from BEGIN pattern to END pattern" (between BEGIN and END) options: - include: can be equal to "none", top|begin|start, bottom|end, or 'both' -- include='top' will include the begin pattern line, -- include='bottom' will include the end pattern line -- include='both' will include top and end pattern matching lines returns: lines between (or including) begin pattern and end pattern from filename (or a list of lines)...
- gtoolz.add_content
  index.html#add_content
  Function
  Function
  PUBLIC
  I wrote this because I am constantly building csv files with a header line consider add_or_replace() function Required: file content=str|list Options: after=pattern before=pattern replace=pattern position=## if none of those content is appended to the file if header is also included it will be added to the begining of the file if it does not already exitst used_to_be: add_line()...
- gtoolz.sorted_add
  index.html#sorted_add
  Function
  Function
  PUBLIC
  purpose: to insert a line between two patterns in a sorted way insert line into filename between after and before patterns the patterns need to be regex ie: r"pattern" assumes the block from after to before is sorted returns: new_lines eg: line = 'Insert this line (alphabetically) after "^-alt" but before "^-[a-zA-Z0-9] within block' filename = "/home/geoffm/t...
- gtoolz.try_it
  index.html#try_it
  Function
  Function
  PUBLIC
  BROKEN BROKEN BROKEN This is a wrapper function for running any function that might fail - this will report the error and move on use: @try_it def my_func(): print("if this failed an error would be reported ") my_func()...
- gtoolz.max_width_lol
  index.html#max_width_lol
  Function
  Function
  PUBLIC
  purpose: to determin max_width for each "column" in a list of lists this is a way of truncating "columns" returns: column sizes
- gtoolz.comma_split
  index.html#comma_split
  Function
  Function
  PUBLIC
  purpose: split a line/str (or list of lines) using commas unless the comma is embedded in quotes returns: list (or list od lists) of comma separated elements notes: this is a kludge but it works for me...
- gtoolz.comma_split_demo
  index.html#comma_split_demo
  Function
  Function
  PUBLIC
  purpose: demo of using comma_split() return: None
- gtoolz.comma_join
  index.html#comma_join
  Function
  Function
  PUBLIC
  purpose: given a list of elems or list or lists (of elems this function will turn each row into a proper comma delimited string or line The reason for this function is to take a list and make *sure* it is a proper csv list - with quoted elems as needed options: - newlines = bool - False # to be used if you want to add a newline to the end of the line(s) returns: a list of comma delimited strings (lines) typically used for csv notes: this has not been fully tested yet...
- gtoolz.comma_join_demo
  index.html#comma_join_demo
  Function
  Function
  PUBLIC
  purpose: demo of using comma_join() returns: None
- gtoolz.get_elems
  index.html#get_elems
  Function
  Function
  PUBLIC
  purpose: designed to split a list of lines on delimiter - respects quoted elements that may contain "," even if that is the delimiter - wip - this does the same thing as comma_split but adds a few options TODO Input: lines (as a list) options: - delimiter: str # (default is a comma) - col_limit: bool # max column size default=0 - if 0 no truncation occurs otherwise all elems are limited to col_limit - index: bool # will insert an index (line numbers starting with 0) # not used yet TODO - lst: bool # assumes a single line (ie: lines = str) so it returns a list of elemes from that line instead of a list_of_elems for multiple lines (ie an lol) Returns: an array: list of list (lol - lines of elements aka rows and columns) aka rows_lol...
- gtoolz.get_elems_demo
  index.html#get_elems_demo
  Function
  Function
  PUBLIC
  purpose: demo of get_elems() returns: None
- gtoolz.pyscraper
  index.html#pyscraper
  Function
  Function
  PUBLIC
  I may deprecate this as I rarely use it example: pat # pat = '<span class="Trsdu\(0.3s\) Fw\(b\) Fz\(36px\) Mb\(-4px\) D\(ib\)" data-reactid=".*?".*?>.*?</span.*?>' # noqa: Be careful... pay attention to the html page when using a script...
- gtoolz.try_to_get
  index.html#try_to_get
  Function
  Function
  PUBLIC
  may deprecate this as I rarely use it This is for use with selenium requires: from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from selenium...
- gtoolz.has_alnum
  index.html#has_alnum
  Function
  Function
  PUBLIC
  purpose: test whether a string is all alpha numeric Is a string blank or all white space... isspace() does the samething
- gtoolz.retry
  index.html#retry
  Function
  Function
  PUBLIC
  purpose: a wrapper to retry a function x (howmany) times notes: there is a module called retrying that deserves more research and it provides a wrapper function called @retry() useage: eg: @retry(5, MySQLdb...
- gtoolz.get_html_tables
  index.html#get_html_tables
  Function
  Function
  PUBLIC
  purpose: to pull/scrape all tables off an url required: url requires: import pandas as pd from selenium import webdriver options: - show|prnt: bool # default=False ... whether to print the tables - spinner: bool # default=False...
- gtoolz.get_html_tst
  index.html#get_html_tst
  Function
  Function
  PUBLIC
  purpose: to test get_html() options: start-maximized: Opens Chrome in maximize mode incognito: Opens Chrome in incognito mode headless: Opens Chrome in headless mode disable-extensions: Disables existing extensions on Chrome browser disable-popup-blocking: Disables pop-ups displayed on Chrome browser make-default-browser: Makes Chrome default browser version: Prints chrome browser version disable-infobars: Prevents Chrome from displaying the notification ‘Chrome is being controlled by automated software...
- gtoolz.display_in_cols
  index.html#display_in_cols
  Function
  Function
  PUBLIC
  deprecated as gtable may take it's place input: takes a list or a dict and prints in order across cols options: order default for list is is as-is if it is a dict you can sort "on" default "value" or on "key" , or reverse=True or reverse=False returns: lines (sorted if dict) example: # >>> lst = [*range(1,20)] # >>> display_in_cols(lst) then print lines eg printit(lines)...
- gtoolz.shadowed
  index.html#shadowed
  Function
  Function
  PUBLIC
  purpose: adds shadowing typically to a box requires: input: lines as a list output: lines as a list Use this to see all the styles: msg = "this is my message" for n in range(0,5): printit(centered(shadowed(boxed(msg + f" style: {n}"),style=n))) ...
- gtoolz.add_or_replace
  index.html#add_or_replace
  Function
  Function
  PUBLIC
  purpose: Adds or replaces a line in a file where pattern occurs required: filename, action: str [before|after|replace|either] ,pattern, new_line action: before|after|replace|either (either will replace if it is found or add if it is not) options: - backup: bool=True, - ask: bool=False, - prnt: bool=False - centered: bool=False, - shadowed: bool=False pattern: needs to be unique regex...
- gtoolz.regex_col
  index.html#regex_col
  Function
  Function
  PUBLIC
  regex for a patern in a word|column file_lines can be a filename or lines (list) col starts at 0 to be consistent with coding standards returns lines where pat matches col number word ie words[col]
- gtoolz.rootname
  index.html#rootname
  Function
  Function
  PUBLIC
  purpose: returns the root name of a full filename (not path, no extension) input: filename: str returns: ROOT_NAME: str
- gtoolz.islol
  index.html#islol
  Function
  Function
  PUBLIC
  purpose: determine is my_lol is actually a list of lists required: list - my_lol options: none return: bool True | False
- gtoolz.islod
  index.html#islod
  Function
  Function
  PUBLIC
  purpose: is this a list of dictionaries options: None returns: bool
- gtoolz.islos
  index.html#islos
  Function
  Function
  PUBLIC
  purpose: determines if my_los is a list of strings returns: bool
- gtoolz.islols_demo
  index.html#islols_demo
  Function
  Function
  PUBLIC
  purpose: to demonstatrate islol and islos functions required: none optons: none return: none
- gtoolz.maxof
  index.html#maxof
  Function
  Function
  PUBLIC
  purpose: returns length of longest member of a list (after escape_ansii codes are removed) required: list or list_of_lists (lol) options: - length|len|max_len|elem_len: bool # default=True longest length is returned - height|rows|max_height|row_len: bool # default=False largest number of elements in list (typically the number of lines in a list of strings) - elems: bool # default=False in a list of lists this will rerturn the greatest number of elements in each member of a list (see note below) - lst: bool # default=False returns a list which will be the max length(s) or height(s) of each elem in a list returns: int max length of eleemes note: saves me from having to look up how to do this all the time and works with lists or lists of list - sometimes I need to know the number of rows in cols (lol of rows in cols ie: cols_lol = [row1, row2], [row1, row2, row3], [row1, row2]]...
- gtoolz.maxof_demo
  index.html#maxof_demo
  Function
  Function
  PUBLIC
  purpose: Demos of using ruleit() function returns: None
- gtoolz.gblock
  index.html#gblock
  Function
  Function
  PUBLIC
  purpose: justifies using nclen all strngs in msgs_l and maximizes each string length to the longest string - all lines will be the same length (nclen - no-color len) required: msgs_l: list # list of strings options: - height: int - length | width: int - pad: str # char to use for fill - position=1: str | list | int # eg: 'right center' or 'left top' (default) or [top, left] or 'middle bottom' or 1 (default) or 5 or 9...
- gtoolz.gblock_demo
  index.html#gblock_demo
  Function
  Function
  PUBLIC
  purpose: demo of gblock() returns: None
- gtoolz.find_file_in_dirs
  index.html#find_file_in_dirs
  Function
  Function
  PUBLIC
  purpose: this is for future use as something like find_file_in_dirs(filename, dirs_l) notes: if dirs_l is empty it defaults to ["./"]
- gtoolz.long_proc
  index.html#long_proc
  Function
  Function
  PUBLIC
  purpose: this is only for test or demos - it nothing but a sleep
- gtoolz.usr_input
  index.html#usr_input
  Function
  Function
  PUBLIC
  purpose: allow user input with editing options:: - prompt: str = "Your input: " - edit: bool - dft: str - centered: bool - shift: int - update: dict - length: int = 0 # all lines will display with the same length returns: edit or input data as str or dict if update option Notes: - this function is typically called by usr_update() - see usr_update()...
- gtoolz.usr_input_demo
  index.html#usr_input_demo
  Function
  Function
  PUBLIC
  purpose: demo of usr_input() returns: None
- gtoolz.usr_update
  index.html#usr_update
  Function
  Function
  PUBLIC
  purpose: given a dict, and a list of keys to change - allow user update(s) to values in my_d dictionary go through the list of keys to fix and prompt user for new value, present the current value as default args: my_d: dict # dict to have updated options: - fix: list # default=[] - list of keys to prompt user for change; if empty, use all the my_d keys - centered: bool # default=False - whether to center everything on the screen - edit: bool # defualt=False - whether to allow text edit in place or the default of input replacement input - no_edits: list # default=[] - list of keys that are presented but not editable - quit: bool # default=False - whether to immediately quit on an entry of "q" or "Q", or "quit" returns: my_d (with user updates) Notes: - what is in the passed dict values is what will be presented as the default...
- gtoolz.usr_update_demo
  index.html#usr_update_demo
  Function
  Function
  PUBLIC
  purpose: demo for usr_update() return: None
- gtoolz.remap_keys
  index.html#remap_keys
  Function
  Function
  PUBLIC
  purpose: remaps keys names AND can select only the k.v pairs you want (in the order specified) (ie option: 'mapped_only') options: - mapped_only: bool, - rnd: int # rounds out numbers to rnd scale returns: my_d (remapped and optionally selected pairs) notes: remap_d should be dict {orig_key: new_key,...
- gtoolz.quick_plot
  index.html#quick_plot
  Function
  Function
  PUBLIC
  purpose: quick display of data in a file or in dataframe displays a plot on a web browser if requested required: data: df | str | list (filename: csv or dat filename) options: - show | prnt: bool - centered: bool - title: str - footer: str - tail: int # for the last n rows of the df default=35 - choose: bool # invokes gselect multi mode to allo"w selections of columns to display in the plot (graph) - selections: list # you can declare what columns to plot - web: bool # displays to your browser instead of a plot figure - dat: bool | str # I sometimes use a commented firstline for headers - # using 'dat' declares this to be true, if character is used ie dat=":" # then that will be used as the delimiter - type: str # default=line, bar, barh, hist, box, kde, density, area, pie, scatter, hexbin - colnames: list | str # default = [] if it is a str="firstrow" then the firstrow obviously will be treated as colnames - mavgs: bool # 50 day and 200 day moving averages added to plot - box_text: str | list # string or lines to add to a box in fuger default="" - subplot: str # sub plot with area under filled using column name = subplot - save_file: str # name of file to save the plot figure to...
- gtoolz.quick_plot_demo
  index.html#quick_plot_demo
  Function
  Function
  PUBLIC
  purpose: to provide examples of displaying data in plots returns: None
- gtoolz.boxed_demo
  index.html#boxed_demo
  Function
  Function
  PUBLIC
  purpose: demo of using boxed()
- gtoolz.clr_demo
  index.html#clr_demo
  Function
  Function
  PUBLIC
  purpose: color Demo - used for testing only
- gtoolz.tst
  index.html#tst
  Function
  Function
  PUBLIC
  purpose: for development one testing only - subject to change at anytime returns: None notes: This is for testing only This is just an example testing function. This example shows how you can quickly test whatever you want (any function) while you are still editing a file...
- gtoolz.do_func_docs
  index.html#do_func_docs
  Function
  Function
  PUBLIC
  purpose: to get function docs
- gtoolz.has_substr
  index.html#has_substr
  Function
  Function
  PUBLIC
  purpose: determin if any sub-string in chk_l is in text_s column_name = "dtime" eg is "time" or "date" in column_name... then use has_substr(column_name, ["time", "date"]) required: - text_s: str - chk_l: list options: - ci: bool # case_insensitive returns True | False used in quick_plot()...
- gtoolz.chk_substr
  index.html#chk_substr
  Function
  Function
  PUBLIC
  purpose: given a list of strings to check (chk_l) and a list of substrings to compare (strgs_l) if any "compare" substring is in any string in check list of strings then do action either 'exclude' or 'include' required: - chk_l: list | str - strgs_l: list options: - action: str # default is 'exclude' return: new_list usage: # given a list of functions, exclude the ones that have contain any of the substrings in the exclude_l list funcs_l = chk_substr(funcs_l, exclude_l, action='exclude')...
- gtoolz.do_func_demos
  index.html#do_func_demos
  Function
  Function
  PUBLIC
  purpose: allows selection of demos within this module - runs the demo function selected options: None return: None
- gtoolz.gcontains
  index.html#gcontains
  Function
  Function
  PUBLIC
  purpose: to determine if any pattern (str|list) is a substring of string (string_s) options: none returns: bool
- gtoolz.get_mod_docs
  index.html#get_mod_docs
  Function
  Function
  PUBLIC
  purpose: lists all functions and the docs from a module Note: except some functions eg _demo returns cnt
- gtoolz.isempty
  index.html#isempty
  Function
  Function
  PUBLIC
  purpose: tests if a variable is empty ie len(my_var) == 0 or my_var is None etc options: None returns: bool
- gtoolz.columned
  index.html#columned
  Function
  Function
  PUBLIC
  purpose: set a list in X columns required: my_l: list options: - cols=0: int # number of columns - order='v': str # 'vertical', 'vert', 'v'| 'horizontal', 'hor', 'h' # order directs the order of the choices - proceed vertically through columns or horizontally through columns - justify='left: str # 'left', 'right', 'center' - prnt=False: bool # 'print', 'prnt'...
- gtoolz.columned_demo
  index.html#columned_demo
  Function
  Function
  PUBLIC
  purpose: to run a demo of using columned() options: None returns: None
- gtoolz.dtree
  index.html#dtree
  Function
  Function
  PUBLIC
  purpose: print a simple directory tree options: - files: bool # default=False - prnt: bool # default=False should we print out the lines - excludes: list | str # default=[] this is a pattern or list of patterns to skip - boxed: bool # boxes all the lines - length: int # default=3 # size of the "fill" returns: list (lines for printing)...
- gtoolz.dtree_demo
  index.html#dtree_demo
  Function
  Function
  PUBLIC
  purpose: demo of using dtree()" return: None
- gtoolz.chklst
  index.html#chklst
  Function
  Function
  PUBLIC
  purpose: display a list of empty checkboxes|ballot boxes with chkd_l boxes checked and xed_l boxes with and X required: - my_l: list # list of check box names - chkd_l: list # list of boxes to be checked options: - dflt: str # default='empty' - alternatives: default= or dflt= 'chk', 'chkd', 'checked', 'all_chkd', 'chk_all , 'xed' 'x_all', 'all_x'...
- gtoolz.chkbox_demo
  index.html#chkbox_demo
  Function
  Function
  PUBLIC
  purpose: chkbox() demo returns: None
- gtoolz.main
  index.html#main
  Function
  Function
  PUBLIC
  purpose: allows user to see some of the fuctionality of this tool set