PK2vaJ`p00$jupyter_conf_search/.__init__.py.swpb0VIM 8.0OX)4cocosci40.210.128.198.in-addr.dhcp.lbnl.us~cocosci/jupyter/jupyter_conf_search/jupyter_conf_search/__init__.pyutf-8 3210#"! Utpad:|{wvba;:;>>>>>>> 2d5931f... >>>>>>>>>>>>>> 2d59>>>>>>> 2d5931f... add setup.from .jupyter_conf_search import main__version__="0.4.1"""""""Utility for searching through jupyter configuration files, using jupyter's path definitions to find their locations dynamically.PK vaJ" }!}!$jupyter_conf_search/.__init__.py.un~VimUnDoV/)v|AET"mӺ 8A__version__="0.3" XO _ XN=======5_ XN <<<<<<< HEAD5_ XN__version__="0.4.0"5_  XN>>>>>>> 2d5931f... add setup.py5_ XN"""Utility for searching through jupyter configuration files, using jupyter's path definitions to find their locations dynamically."""__version__="0.1"%from .jupyter_conf_search import main5_XN"""Utility for searching through jupyter configuration files, using jupyter's path definitions to find their locations dynamically."""__version__="0.2"%from .jupyter_conf_search import main5_XO2"""Utility for searching through jupyter configuration files, using jupyter's path definitions to find their locations dynamically."""__version__="0.3"%from .jupyter_conf_search import main5_XOW__version__="0.4.0"5_XOX=======5_XOY <<<<<<< HEAD5_XOZ>>>>>>> 2d5931f... add setup.py5_XO"""Utility for searching through jupyter configuration files, using jupyter's path definitions to find their locations dynamically."""__version__="0.1"%from .jupyter_conf_search import main5_XO"""Utility for searching through jupyter configuration files, using jupyter's path definitions to find their locations dynamically."""__version__="0.2"%from .jupyter_conf_search import main5_XO__version__="0.3"5_XO__version__="0.4"5_XO __version__="0.4"5_XON 5PK vaJɺjupyter_conf_search/__init__.py"""Utility for searching through jupyter configuration files, using jupyter's path definitions to find their locations dynamically. """ __version__="0.4.1" from .jupyter_conf_search import main PKG2J{//jupyter_conf_search/__main__.pyfrom .jupyter_conf_search import main main() PKe2J4??*jupyter_conf_search/jupyter_conf_search.pyimport jupyter_core.paths as jpaths import glob import os import sys import re def valid_conf_file(file_name): # replace with canonical config validation checker if not os.path.isfile(file_name): return False if os.path.splitext(file_name)[1]=='.py': return True if os.path.splitext(file_name)[1]=='.json': return True canonical_names_regex = re.compile(r"jupyter_(\w*_|)config") def valid_local_conf_file(file_path): file_name = os.path.splitext(os.path.split(file_path)[1])[0] return valid_conf_file(file_path) and canonical_names_regex.match(file_name) def search_jupyter_paths(search_term=''): conf_path_list = [] for dir in jpaths.jupyter_config_path(): conf_path_list.extend(glob.glob(dir+"/**", recursive=True)) conf_file_list = [f for f in conf_path_list if valid_conf_file(f)] local_path_list = glob.glob(os.getcwd()+"/**", recursive=True) conf_file_list.extend([f for f in local_path_list if valid_local_conf_file(f)]) # go through files, # if search term found in file # print name, line_no, content conf_file_list.reverse() for file_name in conf_file_list: if len(search_term)>0: print_indexed_content(file_name=file_name, search_term=search_term) else: print(file_name) def print_indexed_content(file_name='', search_term=''): with open(file_name,"r") as f: if search_term in f.read(): f.seek(0) line_numbers_match = [] for line_no, text in enumerate(f,1): if search_term in text: line_numbers_match.append((line_no,text.strip())) output = ["{}: {}".format(x,y) for x,y in line_numbers_match] print(file_name + "\n" + "\n".join(output),"\n") def main(): if len(sys.argv)==1: search_jupyter_paths() elif len(sys.argv)==2: search_jupyter_paths(sys.argv[1]) else: raise RuntimeError("You can only pass in a single string at this time.") if __name__ == "__main__": main() PK!HX2B4jupyter_conf_search-0.4.1.dist-info/entry_points.txtN+I/N.,()*-,I-J&%g(*`MPK!H|&Ub)jupyter_conf_search-0.4.1.dist-info/WHEEL HM K-*ϳR03rOK-J,/RH,Q034 /, (-JLR()*M ILR(4KM̫#DPK!Hh,jupyter_conf_search-0.4.1.dist-info/METADATAMN@EhCVD4 Ne4ށ}iH{AsG=fl(&NºZY”)w9Fv>kq,b$2 >e7BїQ_M0x,su-4 r `g,Au}G0^%'3b-59$ZN#b/ȥJމMG %l"ZR_ēx` RḃMS??PK!Hm<'*jupyter_conf_search-0.4.1.dist-info/RECORDI@{)T\XDRA)>% x鸵!35~FXBi4,$%4YbL&-CF] NQ:a}1R6yDRN̷?*;wR3,.["VGlxdjkU߉SZѦᢥ(M~Mjb{Rh+YSPK2vaJ`p00$jupyter_conf_search/.__init__.py.swpPK vaJ" }!}!$B0jupyter_conf_search/.__init__.py.un~PK vaJɺRjupyter_conf_search/__init__.pyPKG2J{//Sjupyter_conf_search/__main__.pyPKe2J4??*pSjupyter_conf_search/jupyter_conf_search.pyPK!HX2B4[jupyter_conf_search-0.4.1.dist-info/entry_points.txtPK!H|&Ub){\jupyter_conf_search-0.4.1.dist-info/WHEELPK!Hh,]jupyter_conf_search-0.4.1.dist-info/METADATAPK!Hm<'*R^jupyter_conf_search-0.4.1.dist-info/RECORDPK ^`