@@ -45,6 +45,80 @@ <h1 class="title">Module <code>src.jsonid.jsonid</code></h1>
4545< section >
4646< h2 class ="section-title " id ="header-functions "> Functions</ h2 >
4747< dl >
48+ < dt id ="src.jsonid.jsonid.analysis "> < code class ="name flex ">
49+ < span > def < span class ="ident "> analysis</ span > </ span > (< span > ) ‑> None</ span >
50+ </ code > </ dt >
51+ < dd >
52+ < details class ="source ">
53+ < summary >
54+ < span > Expand source code</ span >
55+ </ summary >
56+ < pre > < code class ="python "> def analysis() -> None:
57+ """Secondary entry point for analysis functionality.
58+
59+ Enables us to call analysis from the command line once installed
60+ via PyPi.
61+ """
62+ parser = argparse.ArgumentParser(
63+ prog="jsonida",
64+ description="JSONID(A)nalysis",
65+ epilog="for more information visit https://github.com/ffdev-info/jsonid",
66+ )
67+ parser.add_argument(
68+ "--debug",
69+ help="use debug loggng",
70+ required=False,
71+ action="store_true",
72+ )
73+ parser.add_argument(
74+ "--path",
75+ "-p",
76+ help="analyse a file in support of ruleset development and data preservation",
77+ required=False,
78+ type=str,
79+ metavar="PATH",
80+ )
81+ args = parser.parse_args()
82+
83+ if not args.path:
84+ parser.print_help(sys.stderr)
85+ sys.exit()
86+
87+ # Initialize logging.
88+ init_logging(args.debug)
89+
90+ # Attempt lookup in the registry. This should come first as it
91+ # doesn't involve reading files.
92+ _attempt_lookup(args)
93+
94+ # Determine which decode strategy to adopt.
95+ strategy = _get_strategy(args)
96+ if not strategy:
97+ logger.error(
98+ "please ensure there is one remaining decode strategy, e.g. %s",
99+ ",".join(decode_strategies),
100+ )
101+ sys.exit(1)
102+
103+ # Enable graceful exit via signal handler...
104+ def signal_handler(*args): # pylint: disable=W0613
105+ logger.info("exiting...")
106+ sys.exit(0)
107+
108+ signal.signal(signal.SIGINT, signal_handler)
109+
110+ if args.path:
111+ asyncio.run(
112+ file_processing.analyse_data(
113+ path=args.path,
114+ strategy=strategy,
115+ )
116+ )</ code > </ pre >
117+ </ details >
118+ < div class ="desc "> < p > Secondary entry point for analysis functionality.</ p >
119+ < p > Enables us to call analysis from the command line once installed
120+ via PyPi.</ p > </ div >
121+ </ dd >
48122< dt id ="src.jsonid.jsonid.init_logging "> < code class ="name flex ">
49123< span > def < span class ="ident "> init_logging</ span > </ span > (< span > debug: bool)</ span >
50124</ code > </ dt >
@@ -85,8 +159,8 @@ <h2 class="section-title" id="header-functions">Functions</h2>
85159
86160 parser = argparse.ArgumentParser(
87161 prog="jsonid",
88- description="proof-of-concept identifier for JSON objects on disk based on identifying valid objects and their key-values",
89- epilog="for more information visit https://github.com/ffdev-info/json-id ",
162+ description="JSON(ID)entification of objects on disk based on identifying valid objects and their key-values",
163+ epilog="for more information visit https://github.com/ffdev-info/jsonid ",
90164 )
91165 parser.add_argument(
92166 "--debug",
@@ -175,6 +249,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
175249 parser.add_argument(
176250 "--analyse",
177251 "--analyze",
252+ "--analysis",
178253 "-a",
179254 help="analyse a file in support of ruleset development and data preservation",
180255 required=False,
@@ -282,6 +357,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
282357</ li >
283358< li > < h3 > < a href ="#header-functions "> Functions</ a > </ h3 >
284359< ul class ="">
360+ < li > < code > < a title ="src.jsonid.jsonid.analysis " href ="#src.jsonid.jsonid.analysis "> analysis</ a > </ code > </ li >
285361< li > < code > < a title ="src.jsonid.jsonid.init_logging " href ="#src.jsonid.jsonid.init_logging "> init_logging</ a > </ code > </ li >
286362< li > < code > < a title ="src.jsonid.jsonid.main " href ="#src.jsonid.jsonid.main "> main</ a > </ code > </ li >
287363</ ul >
0 commit comments