CORTEXA
← Browse
openalexFigshare2026-07-23Cited by 0

LoggingSmellsMLCode

Foalem Patrick loic

AntiPatternLoggingMLA toolkit to collect, extract, and analyze logging usage and logging-related code snippets from GitHub repositories — focused on finding logging anti-patterns in machine learning code.The repository provides a CLI (implemented in <code>main.py</code>) with commands to:collect repository metadata (archived/accessibility) from CSV lists of reposmerge collected metadata filesclone repositoriesconvert Jupyter notebooks to Pythonextract Python files that contain logging/library callsclean leading comments before import statementsbuild a JSON dataset of logging snippetsanalyze and summarize logging datasetssample unique functions and snippets by library and log levelrun an LLM-based logging smell analysisThis README explains setup, usage examples for each CLI command, and tips for working with the pipeline.RequirementsPython 3.10 or newerRecommended: create and activate a virtual environmentInstall core dependencies (approximate list used by the project):<pre>python -m venv .venv; .\.venv\Scripts\Activate.ps1<br>pip install --upgrade pip<br>pip install pandas gitpython nbconvert nbformat openpyxl</pre>If you prefer, create a <code>requirements.txt</code> with these packages and install using <code>pip install -r requirements.txt</code>.Note: the project uses <code>pandas</code> to read/write CSV/Excel files and <code>GitPython</code> (<code>git</code>) to clone repositories.Project layout<code>main.py</code> - CLI entrypoint. Implements multiple subcommands (see Usage).<code>data/</code> - default data folder (configured in <code>config/constant.py</code>).<code>data_collection/</code> - modules to collect repos, extract logging files, analyze datasets, and sample snippets.<code>util/</code> - logging and utility helpers.<code>logs/</code> - default log file location (<code>logs/app.log</code>).Open <code>config/constant.py</code> if you want to change the default paths.Quick usageRun a CLI command like this (PowerShell examples):<pre># show help for the CLI<br>python main.py -h<br><br># show help for a specific command<br>python main.py collect -h</pre>All commands accept options; each command has sensible defaults defined in <code>main.py</code> (many default to paths inside <code>data/</code> and <code>logs/app.log</code>).Common commands and examplesCollect GitHub repository metadata<pre>python main.py collect --data_folder data --log_file logs/app.log</pre>This will find <code>*.csv</code> files inside <code>data/</code>, read repository names, query GitHub (via <code>data_collection.get_repo_infos</code>) to collect <code>accessible</code> and <code>archived</code> info, and write per-file outputs suffixed with <code>_with_archived.csv</code>.Merge archived results<pre>python main.py merge_archived --data_folder data --output_file merged_archived_dataset.csv</pre>Concatenates all <code>*_with_archived.csv</code> files, removes duplicates, and writes a merged CSV.Clone repositories from merged CSV<pre>python main.py clone_repos --input_file data\merged_archived_dataset.csv --output_dir data\cloned_repos</pre>Only clones repositories listed in the CSV. If the CSV contains <code>accessible</code> or <code>archived</code> columns, the CLI filters to <code>accessible == True</code> and <code>archived == False</code>.Convert notebooks to Python files<pre>python main.py convert_notebooks --root_dir data\cloned_repos</pre>Searches <code>root_dir</code> for <code>.ipynb</code> files and produces <code>.py</code> exports alongside them.Extract Python files with logging/library calls<pre>python main.py extract_logging_files --root_dir data\cloned_repos --output_dir data\logging_files</pre>Uses AST helpers to identify files with library/logging calls and copies them (preserving repo-relative structure) into <code>data/logging_files</code>.Remove header comments before imports<pre>python main.py clean_comments --root_dir data\logging_files</pre>Removes comment lines that occur before the first import statement in each <code>.py</code> file — useful to reduce noise before parsing.Create a JSON dataset of logging snippets<pre>python main.py create_logging_json_dataset --root_dir data\logging_files --output_file data\logging_dataset.json</pre>Walks <code>root_dir</code>, extracts logging-related functions/snippets via <code>data_collection.ast_helpers.extract_all_logging_files</code> and writes a structured JSON dataset.Analyze the logging dataset (write metrics to CSV)<pre>python main.py analyze_logging_dataset --json_path data\logging_dataset.json --csv_path data\logging_dataset_metrics.csv</pre>Filter the logging dataset (keep only relevant fields/functions)<pre>python main.py filter_logging_dataset --input_json data\logging_dataset.json --output_json data\logging_dataset_filtered_function.json</pre>Summarize the filtered dataset<pre>python main.py summarize_logging_dataset --json_path data\logging_dataset_filtered_function.json --csv_path data\logging_dataset_summary.csv</pre>Summarize unique functions per logging library and log level<pre>python main.py summarize_unique_functions --json_path data\logging_dataset_filtered_function.json --csv_path data\logging_dataset_unique_functions.csv</pre>Sample snippets by library and level<pre>python main.py sample_snippets --input_csv data\logging_dataset_unique_functions.csv --output_csv data\logging_dataset_sampled_snippets.csv</pre>Run LLM logging smell analysis (uses module <code>data_collection.llm_logging_smell_analysis</code>)<pre>python main.py llm_logging_smell_analysis</pre>This command currently delegates to the <code>cli_llm_logging_smell_analysis</code> function; check <code>data_collection/llm_logging_smell_analysis.py</code> for configuration and model usage details.Configuration &amp; pathsDefaults for data and other paths are defined in <code>config/constant.py</code>. If you want to change where data or logs are stored, update that file or pass explicit CLI arguments to the commands.Logging output (both console and file) is managed with <code>util.log.setup_logging</code>; logs are written to <code>logs/app.log</code> by default.TroubleshootingCloning failures: public repositories should clone via HTTPS. If some repos require credentials, configure Git authentication (SSH keys or a credential helper / PAT) and/or modify the <code>clone_repos</code> implementation to include credentials.GitHub API rate limits: the <code>collect</code> command may query GitHub and could hit rate limits. Consider using authentication or run the collection in batches.Missing packages: install the packages listed in the Requirements section.Large datasets: some operations iterate over many repos/files — run them on a subset first to validate the pipeline.Development &amp; ContributionCode is organized under <code>data_collection/</code> (domain logic) and <code>util/</code> (helpers).Add small unit tests for core helpers (AST helpers, dataset filters) and run them before submitting PRs.If you'd like, I can also:add a <code>requirements.txt</code> or <code>pyproject.toml</code> for reproducible installsadd example small datasets and a quick smoke-test scriptadd more detailed docs for <code>data_collection/llm_logging_smell_analysis</code>License &amp; contactThis repository does not include a license file; add an appropriate <code>LICENSE</code> file if you plan to share the project.For questions or help, open an issue or contact the maintainer.

View free PDFSource page

Related papers

openalexFigshare2026-07-23

<i>Integration: BDS - Artwork and</i><i> </i>Associated interpretive image with artist's annotations

Eleanor Gates-Stuart

<b>CRUCIAL INTELLECTUAL PROPERTY NOTICE</b>This visual asset is provided solely as a low-resolution public reference for scholarly citation, academic indexing and online viewing.<b> </b><b>ALL RIGHTS RESERVED © Eleanor Gates-Stuart 2016–2026.</b> No reproduction, distribution, ad…

View free PDFSource page
openalexFigshare2026-07-24

High-fidelity demodulation of vortex beams through dynamic scattering media using a physically constrained deep neural network

Wenwen Cai, Xuanxuan Wang, Mingqian Zhu, Dengfeng Kuang

Vortex beams carrying orbital angular momentum enable high-capacity optical communication and imaging, yet multiple scattering in dynamic medias such as biological tissues disrupts their wavefront. Brownian motion decorrelates the scattered field and invalidates conventional meth…

View free PDFSource page
openalexFigshare2026-07-24

Preset calibration of a reconstructive spectrometer by post–assembly training with calibration samples

Daichang Dong, Yulong Zhao, Zhijun Sun

Miniature reconstructive spectrometers have attracted significant attention for their broad potential applications. However, performance of the spectrometers is heavily dependent on their preset calibration procedure and spectral reconstruction algorithms, and conventional calibr…

View free PDFSource page
openalexFigshare2026-07-24

benchmark_DL_CNN

Guoji Guo

<i>Deep learning (DL) methods show promising potential for single-cell data analysis, yet required tremendous efforts in building the models. </i><i>To streamline the application of sequence-based DL methods in single-cell genomics, we established a two-layer CNN model as a basel…

View free PDFSource page
openalexFigshare2026-07-23

Distillation-guided Optical Neural Networks with Reinforcement Learning-assisted Calibration

Kangjian Di, Fuhao Yu, Silin Chen, Jiashu Li, Andy Liu, Sen Shao, et al.

Optical neural networks (ONNs) promise ultra-fast and energy-efficient computing but are hampered by the critical challenge of on-chip training. Here, we propose an on-chip training distillation-guided optical neural network (DGONN) and introduce a forward distilled algorithm to…

View free PDFSource page