A collection of design patterns/idioms in Python
This report presents the forensic synthetic code analysis of faif/python-patterns, a Python project with 42,903 GitHub stars. SynthScan v2.0 examined 5,499 lines of code across 82 source files, recording 95 pattern matches distributed across 7 syntactic categories. The overall adjusted score of 22.9 places this repository in the Moderate AI signal band.
The scanner applied 160+ deterministic lexical heuristics, multi-line block detectors, abstract syntax tree depth profilers, and a cross-file Jaccard similarity matrix to construct a statistically normalised synthetic code estimate. All matches are individually weighted by severity coefficient and contextual multiplier before summation, and the resulting headline score is temporally discounted to account for the repository's development history relative to the commercial emergence of large language model coding tooling (November 2022 onward).
Longitudinal tracking requires multiple scan runs. Once this repository is re-scanned after new commits land, this chart will visualise how the synthetic code signal evolves over time — enabling you to detect whether AI authorship is growing, stabilising, or being actively corrected by human engineers.
Classifies detected patterns by their diagnostic confidence and structural impact. CRITICAL patterns (coefficient 10) represent definitive synthetic signatures — hallucinated imports, explicit LLM attribution metadata — virtually never produced by human authors. HIGH (5) indicates strong structural tells such as cross-file repetition or cross-linguistic idioms. MEDIUM (2) covers recognisable conversational padding and AI-specific vocabulary. LOW (1) captures subtle indicators like tautological comments and generic boilerplate that require density to carry independent signal.
This horizontal bar chart decomposes the repository's raw synthetic code score by top-level directory, allowing you to pinpoint precisely which modules or components carry the highest AI authorship density. Directories with disproportionately high scores relative to their size warrant targeted manual review: concentrated AI signatures often trace back to mass-generated configuration layers, auto-ported test suites, LLM-scaffolded boilerplate classes, or entire subsystems authored under heavy copilot assistance. Use this view to prioritise your human code-review effort.
The scanner identified 95 distinct pattern matches across 7 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a statistically significant AI authorship indicator. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.
Reading the findings table: The Severity column indicates the diagnostic confidence level (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — comment-context matches receive a ×1.5 weight because LLMs systematically over-annotate. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier as dense clusters constitute far stronger evidence of synthetic authorship than isolated hits.
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | patterns/dependency_injection.py | 19 | def get_current_time_as_html_fragment(self): | STRING |
| LOW | patterns/dependency_injection.py | 34 | def get_current_time_as_html_fragment(self) -> str: | CODE |
| LOW | patterns/dependency_injection.py | 46 | def get_current_time_as_html_fragment(self, time_provider: Callable) -> str: | CODE |
| LOW | patterns/dependency_injection.py | 63 | def get_current_time_as_html_fragment(self): | CODE |
| LOW | patterns/dependency_injection.py | 71 | def production_code_time_provider() -> str: | CODE |
| LOW | patterns/other/hsm/hsm.py | 51 | def _send_diagnostics_request(self): | CODE |
| LOW⚡ | patterns/other/hsm/hsm.py | 63 | def _send_switchover_response(self): | CODE |
| LOW⚡ | patterns/other/hsm/hsm.py | 66 | def _send_operator_inservice_response(self): | CODE |
| LOW⚡ | patterns/other/hsm/hsm.py | 69 | def _send_diagnostics_failure_report(self): | CODE |
| LOW⚡ | patterns/other/hsm/hsm.py | 72 | def _send_diagnostics_pass_report(self): | CODE |
| LOW⚡ | tests/test_hsm.py | 21 | def test_initial_state_shall_be_standby(cls): | CODE |
| LOW⚡ | tests/test_hsm.py | 24 | def test_unsupported_state_shall_raise_exception(cls): | CODE |
| LOW⚡ | tests/test_hsm.py | 28 | def test_unsupported_message_type_shall_raise_exception(cls): | CODE |
| LOW⚡ | tests/test_hsm.py | 32 | def test_calling_next_state_shall_change_current_state(cls): | CODE |
| LOW⚡ | tests/test_hsm.py | 38 | def test_method_perform_switchover_shall_return_specifically(cls): | CODE |
| LOW | tests/test_hsm.py | 57 | def test_given_standby_on_message_switchover_shall_set_active(cls): | CODE |
| LOW | tests/test_hsm.py | 61 | def test_given_standby_on_message_switchover_shall_call_hsm_methods(cls): | CODE |
| LOW⚡ | tests/test_hsm.py | 76 | def test_given_standby_on_message_fault_trigger_shall_set_suspect(cls): | CODE |
| LOW⚡ | tests/test_hsm.py | 80 | def test_given_standby_on_message_diagnostics_failed_shall_raise_exception_and_keep_in_state( | CODE |
| LOW⚡ | tests/test_hsm.py | 87 | def test_given_standby_on_message_diagnostics_passed_shall_raise_exception_and_keep_in_state( | CODE |
| LOW⚡ | tests/test_hsm.py | 94 | def test_given_standby_on_message_operator_inservice_shall_raise_exception_and_keep_in_state( | CODE |
| LOW⚡ | tests/creational/test_factory.py | 13 | def test_get_localizer_english(self): | CODE |
| LOW⚡ | tests/creational/test_factory.py | 19 | def test_get_localizer_default(self): | CODE |
| LOW⚡ | tests/creational/test_factory.py | 24 | def test_get_localizer_unknown_language(self): | CODE |
| LOW⚡ | tests/creational/test_prototype.py | 10 | def test_cloning_propperty_innate_values(self): | CODE |
| LOW⚡ | tests/creational/test_prototype.py | 15 | def test_extended_property_values_cloning(self): | CODE |
| LOW⚡ | tests/creational/test_prototype.py | 21 | def test_cloning_propperty_assigned_values(self): | CODE |
| LOW | tests/creational/test_prototype.py | 41 | def test_particular_properties_retrieving(self): | CODE |
| LOW | tests/creational/test_prototype.py | 46 | def test_extended_properties_retrieving(self): | CODE |
| LOW | tests/creational/test_abstract_factory.py | 7 | def test_dog_pet_shop_shall_show_dog_instance(self): | CODE |
| LOW⚡ | tests/creational/test_borg.py | 15 | def test_initial_borg_state_shall_be_init(self): | CODE |
| LOW⚡ | tests/creational/test_borg.py | 19 | def test_changing_instance_attribute_shall_change_borg_state(self): | CODE |
| LOW⚡ | tests/creational/test_borg.py | 25 | def test_instances_shall_have_own_ids(self): | CODE |
| LOW | tests/creational/test_lazy.py | 15 | def test_relatives_not_in_properties(self): | CODE |
| LOW | tests/creational/test_lazy.py | 27 | def test_relatives_after_access(self): | CODE |
| LOW | tests/creational/test_pool.py | 35 | def test_pool_behavior_with_single_object_inside(self): | CODE |
| LOW⚡ | tests/behavioral/test_catalog.py | 9 | def test_catalog_multiple_methods(): | CODE |
| LOW⚡ | tests/behavioral/test_catalog.py | 15 | def test_catalog_multiple_instance_methods(): | CODE |
| LOW⚡ | tests/behavioral/test_catalog.py | 21 | def test_catalog_multiple_class_methods(): | CODE |
| LOW⚡ | tests/behavioral/test_catalog.py | 27 | def test_catalog_multiple_static_methods(): | CODE |
| LOW⚡ | tests/behavioral/test_strategy.py | 14 | def test_discount_function_return(func, order, discount): | CODE |
| LOW⚡ | tests/behavioral/test_strategy.py | 21 | def test_order_discount_strategy_validate_success(func, price): | CODE |
| LOW⚡ | tests/behavioral/test_strategy.py | 28 | def test_order_discount_strategy_validate_error(): | CODE |
| LOW⚡ | tests/behavioral/test_strategy.py | 38 | def test_discount_apply_success(func, price, discount): | CODE |
| LOW | tests/behavioral/test_memento.py | 11 | def test_rollback_on_transaction(): | CODE |
| LOW | tests/behavioral/test_memento.py | 28 | def test_rollback_with_transactional_annotation(): | CODE |
| LOW | tests/behavioral/test_observer.py | 24 | def test_one_data_change_notifies_each_observer_once(observable): | CODE |
| LOW⚡ | tests/behavioral/test_publish_subscribe.py | 11 | def test_subscriber_shall_be_attachable_to_subscriptions(cls): | CODE |
| LOW⚡ | tests/behavioral/test_publish_subscribe.py | 19 | def test_subscriber_shall_be_detachable_from_subscriptions(cls): | CODE |
| LOW⚡ | tests/behavioral/test_publish_subscribe.py | 28 | def test_publisher_shall_append_subscription_message_to_queue(cls): | CODE |
| LOW | tests/behavioral/test_publish_subscribe.py | 39 | def test_provider_shall_update_affected_subscribers_with_published_subscription( | CODE |
| LOW⚡ | tests/behavioral/test_visitor.py | 11 | def test_visiting_generic_node(visitor): | CODE |
| LOW⚡ | tests/behavioral/test_visitor.py | 17 | def test_visiting_specific_nodes(visitor): | CODE |
| LOW⚡ | tests/behavioral/test_visitor.py | 23 | def test_visiting_inherited_nodes(visitor): | CODE |
| LOW | tests/fundamental/test_delegation.py | 6 | def test_delegator_delegates_attribute_and_call(): | CODE |
| LOW | tests/fundamental/test_delegation.py | 13 | def test_delegator_missing_attribute_raises(): | CODE |
| LOW⚡ | tests/structural/test_adapter.py | 26 | def test_car_shall_make_loud_noise(self): | CODE |
| LOW⚡ | tests/structural/test_adapter.py | 31 | def test_car_shall_make_very_loud_noise(self): | CODE |
| LOW⚡ | tests/structural/test_adapter.py | 38 | def test_dog_adapter_shall_make_noise(self): | CODE |
| LOW⚡ | tests/structural/test_adapter.py | 45 | def test_cat_adapter_shall_make_noise(self): | CODE |
| 16 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | patterns/creational/prototype.py | 24 | CODE | |
| LOW | patterns/behavioral/observer.py | 14 | CODE | |
| LOW | patterns/behavioral/mediator.py | 11 | CODE | |
| LOW | patterns/behavioral/strategy.py | 10 | CODE | |
| LOW | patterns/behavioral/iterator_alt.py | 8 | CODE | |
| LOW | patterns/behavioral/publish_subscribe.py | 7 | CODE | |
| LOW | patterns/behavioral/state.py | 11 | CODE | |
| LOW | patterns/behavioral/chaining_method.py | 1 | CODE | |
| LOW | patterns/fundamental/delegation_pattern.py | 9 | CODE | |
| LOW | patterns/structural/front_controller.py | 8 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| HIGH | patterns/behavioral/servant.py | 59 | Calculate the area of a given shape. Args: shape: The geometric shape whose area is to be | STRING |
| HIGH | patterns/behavioral/servant.py | 80 | Calculate the perimeter of a given shape. Args: shape: The geometric shape whose perimeter | STRING |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | patterns/other/graph_search.py | 40 | CODE | |
| LOW | patterns/other/graph_search.py | 57 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | patterns/behavioral/memento.py | 66 | except Exception as e: | CODE |
| LOW | patterns/structural/mvc.py | 128 | except Exception: | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | patterns/behavioral/memento.py | 84 | def do_stuff(self) -> None: | CODE |
| LOW | patterns/fundamental/delegation_pattern.py | 53 | def do_something(self, something: str, kw=None) -> str: | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | patterns/structural/flyweight.py | 43 | # If the object exists in the pool - just return it | COMMENT |