Fix/lint errors#2
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR primarily applies ruff/isort-driven formatting and lint fixes across tests, examples, detectors, datasets, and core utilities. It also changes package import-time behavior (DetectZoo package init and Hugging Face quieting), which has user-visible API/packaging implications.
Changes:
- Reformat many modules (argument parsing, long calls, slicing/spacing, docstrings) to satisfy linting/line-length rules.
- Adjust import/layout of several example scripts and smoke tests.
- Modify
detectzoopackage initialization and Hugging Face logging quieting behavior (import-time side effects and eager imports).
Reviewed changes
Copilot reviewed 94 out of 95 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_utils.py | Reformat expected-metric key list for lint/line-length. |
| tests/test_core.py | Reformat expected detector-name set for lint/line-length. |
| examples/text/text_fluoroscopy_replicate.py | Reformat argparse and evaluator call for lint/line-length. |
| examples/text/ood_replicate.py | Reformat argparse, logging print, and evaluator call for lint/line-length. |
| examples/text/imbd_replicate.py | Reformat dataset item construction, argparse, and evaluator call. |
| examples/text/gecscore_replicate.py | Reformat URL/constants, request helpers, argparse, and evaluator call. |
| examples/image/image_replicate.py | Move imports to module scope; remove sys.path manipulation. |
| examples/custom_detector.py | String quoting/formatting tweak in sample output. |
| examples/audio/audio_replicate.py | Remove sys.path manipulation; reformat warnings/prints. |
| examples/audio/_smoke_test_audio_replicate.py | Formatting changes; adjust output formatting and patch context. |
| detectzoo/utils/hf_quiet.py | Add import-time execution of HF quiet configuration. |
| detectzoo/detectors/text/tocsin.py | Formatting of super().__init__ and tokenizer calls. |
| detectzoo/detectors/text/text_fluoroscopy.py | Formatting of helpers and model-loading calls. |
| detectzoo/detectors/text/revise_detect.py | Formatting of model loading and tokenization/generation calls. |
| detectzoo/detectors/text/remodetect.py | Formatting of model load chain. |
| detectzoo/detectors/text/raidar.py | Formatting + minor whitespace normalization (e.g., slicing). |
| detectzoo/detectors/text/radar.py | Formatting of model from_pretrained kwargs. |
| detectzoo/detectors/text/ood_detectors.py | Formatting of math/logging, torch.save blocks, and slicing. |
| detectzoo/detectors/text/log_likelihood.py | Trailing whitespace cleanup in docstring. |
| detectzoo/detectors/text/lastde.py | Remove redundant parentheses in return expression. |
| detectzoo/detectors/text/irm.py | Formatting of model loading and gather expressions. |
| detectzoo/detectors/text/ipad.py | Formatting of templates, init args, PEFT loading, and slicing. |
| detectzoo/detectors/text/imbd.py | Formatting of from_pretrained call. |
| detectzoo/detectors/text/ide.py | Add blank line for style; format super().__init__. |
| detectzoo/detectors/text/glimpse.py | Formatting of tensor ops and slicing. |
| detectzoo/detectors/text/ghostbuster.py | Formatting and slicing style normalization. |
| detectzoo/detectors/text/gecscore.py | Formatting of model load call. |
| detectzoo/detectors/text/fast_detect_gpt.py | Formatting of model load chain and discrepancy expression. |
| detectzoo/detectors/text/dna_gpt.py | Formatting of model load and logger call arguments. |
| detectzoo/detectors/text/dna_detectllm.py | Formatting of model load chains. |
| detectzoo/detectors/text/detective.py | Formatting + slicing normalization for state dict keys. |
| detectzoo/detectors/text/detect_gpt.py | Formatting of perturbation model load chain. |
| detectzoo/detectors/text/biscope.py | Formatting of init args, tokenization, and feature extraction. |
| detectzoo/detectors/text/binoculars.py | Formatting of model load chain and comment spacing. |
| detectzoo/detectors/text/ada_detect_gpt.py | Reformat function signatures and constants for lint/line-length. |
| detectzoo/detectors/image/univfd.py | Docstring whitespace + formatting of CLIP model creation args. |
| detectzoo/detectors/image/srm_filter_kernel.py | Reformat kernel arrays for readability/lint. |
| detectzoo/detectors/image/safe.py | Reformat long signatures and transforms list construction. |
| detectzoo/detectors/image/resnet50_binary.py | Reformat long __init__ signature. |
| detectzoo/detectors/image/patchcraft.py | Whitespace cleanup and reformat preprocessing/inference blocks. |
| detectzoo/detectors/image/npr_deepfake.py | Reformat TypeError message into f-string. |
| detectzoo/detectors/image/manifold_bias.py | Whitespace cleanup and reformat long expressions and calls. |
| detectzoo/detectors/image/lgrad.py | Docstring whitespace + helper formatting + error message f-string. |
| detectzoo/detectors/image/ladeda.py | Reformat constants, net construction, and section separators. |
| detectzoo/detectors/image/freqnet.py | URL/string formatting + FFT masking formatting + docstring cleanup. |
| detectzoo/detectors/image/fatformer.py | Remove unused typing imports + reformat long blocks and transforms. |
| detectzoo/detectors/image/drct.py | Reformat long constant string and transforms list. |
| detectzoo/detectors/image/d3.py | Docstring whitespace cleanup + reformat transforms and patch shuffling. |
| detectzoo/detectors/image/cospy.py | Reformat loads and transforms list; slicing whitespace normalization. |
| detectzoo/detectors/image/cnnspot.py | Reformat TypeError message into f-string. |
| detectzoo/detectors/image/c2p_clip.py | Reformat long signature and transforms list. |
| detectzoo/detectors/image/aide.py | Reformat DCT/filter helpers and long blocks for lint/line-length. |
| detectzoo/detectors/image/aeroblade.py | Reformat repo_ids default assignment block. |
| detectzoo/detectors/image/_lgrad_stylegan_discriminator.py | Large formatting-only pass (quotes, spacing, multiline calls). |
| detectzoo/detectors/image/init.py | Reorder imports (detector exports list unchanged in meaning). |
| detectzoo/detectors/audio/xlsr_sls/detector.py | Formatting and minor whitespace adjustments. |
| detectzoo/detectors/audio/samo.py | Formatting of matmul blocks, error raising, slicing, and helpers. |
| detectzoo/detectors/audio/restssdnet.py | Collapse constant string; reformat helpers and torch.load. |
| detectzoo/detectors/audio/rawnet2.py | Formatting, constant alignment, and helper reformatting. |
| detectzoo/detectors/audio/rawgat_st.py | Formatting and comment alignment; helper spacing. |
| detectzoo/detectors/audio/ast_asvspoof/detector.py | Formatting and minor whitespace adjustments. |
| detectzoo/detectors/audio/anti_deepfake_xlsr2b/detector.py | Reformat run_inference call. |
| detectzoo/detectors/audio/anti_deepfake_wav2vec/detector.py | Reformat run_inference call. |
| detectzoo/detectors/audio/anti_deepfake_hubert/detector.py | Reformat run_inference call. |
| detectzoo/detectors/audio/aasist.py | Formatting of attention blocks, helpers, and constants. |
| detectzoo/detectors/audio/_anti_deepfake_common.py | Formatting of translation logic, logging, and inference helpers. |
| detectzoo/datasets/text/xsum.py | Reformat DatasetItem construction blocks. |
| detectzoo/datasets/text/writing_prompts.py | Reformat DatasetItem construction blocks. |
| detectzoo/datasets/text/turingbench.py | URL constant formatting + error message formatting + item construction. |
| detectzoo/datasets/text/raid.py | Reformat constant tuples for readability. |
| detectzoo/datasets/text/open_llm_text.py | Reformat DatasetItem construction. |
| detectzoo/datasets/text/mage.py | Reformat DatasetItem construction blocks. |
| detectzoo/datasets/text/m4.py | Reformat DatasetItem construction blocks. |
| detectzoo/datasets/text/l2r.py | Reformat ValueError messages. |
| detectzoo/datasets/text/hc3.py | Reformat dataset loading call + DatasetItem construction blocks. |
| detectzoo/datasets/text/hc3_plus.py | URL and list comprehension formatting + DatasetItem construction. |
| detectzoo/datasets/text/cheat.py | Reformat DatasetItem construction. |
| detectzoo/datasets/image/univfd.py | Import ordering + meta dict formatting + long return formatting. |
| detectzoo/datasets/image/self_synthesis.py | Import ordering + gdown import formatting and call formatting. |
| detectzoo/datasets/image/genimage.py | Add section spacing + reformat long expressions + DatasetItem append. |
| detectzoo/datasets/image/drct2m.py | Typing import cleanup + docstring wrap + whitespace cleanup. |
| detectzoo/datasets/image/cnn_detection.py | Import ordering + long tuple formatting + DatasetItem append formatting. |
| detectzoo/datasets/image/chameleon.py | Constant/attribute alignment and DatasetItem construction formatting. |
| detectzoo/datasets/image/aigcdetect.py | Docstring wrap + minor formatting + DatasetItem append formatting. |
| detectzoo/datasets/image/init.py | Reorder imports for linting. |
| detectzoo/datasets/base.py | Reformat staticmethod signature to single line. |
| detectzoo/datasets/audio/in_the_wild.py | Reformat long assignment and error raise formatting. |
| detectzoo/datasets/audio/for_dataset.py | Reformat dict comprehension and error message formatting. |
| detectzoo/datasets/audio/deepfake_eval_2024.py | Reformat error messages for line length. |
| detectzoo/datasets/audio/asvspoof2019.py | Reformat comprehensions and error raises. |
| detectzoo/datasets/_download.py | Docstring rewrap and whitespace cleanup. |
| detectzoo/datasets/init.py | Remove trailing whitespace line. |
| detectzoo/core/registry.py | Reformat error raises and comprehensions. |
| detectzoo/benchmarks/evaluator.py | Reformat default columns, sample payload, and print row generation. |
| detectzoo/init.py | Replace lazy/optional imports with eager imports; bump version. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+3
to
+13
| # isort: off | ||
| import detectzoo.utils.hf_quiet # noqa: F401 | ||
| # isort: on | ||
|
|
||
| # Eager-load modality subpackages so @register_detector / @register_dataset run. | ||
| import detectzoo.datasets.audio # noqa: F401 | ||
| import detectzoo.datasets.image # noqa: F401 | ||
| import detectzoo.datasets.text # noqa: F401 | ||
| import detectzoo.detectors.audio # noqa: F401 | ||
| import detectzoo.detectors.image # noqa: F401 | ||
| import detectzoo.detectors.text # noqa: F401 |
| ) | ||
|
|
||
| __version__ = "0.1.0" | ||
| __version__ = "0.1.4" |
| _sync_huggingface_hub_verbosity() | ||
|
|
||
|
|
||
| configure_hf_quiet() |
Comment on lines
15
to
+19
| from detectzoo import load_dataset | ||
| from detectzoo.core.base import BaseDetector, DetectionResult | ||
|
|
||
| REPO = Path(__file__).resolve().parents[2] | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.