text
stringlengths
185
73.3k
repo
stringlengths
7
100
path
stringlengths
4
146
language
stringclasses
7 values
hash
stringlengths
16
16
score
float64
7
8.5
stars
int64
0
237k
""" Tool to import Dead Cells ModHelperSkin animation tracks into Blender. """ import argparse import json import os import sys import bpy import mathutils def clear_animation_data(): """Clear existing animation data to prevent conflicts""" for obj in bpy.data.objects: if obj.animation_data: ...
N3rdL0rd/alivecells
tracks/tracks2blender.py
.py
6f78cf4aa491d9ba
7.66
20
""" Enumeration of alternative assembly pathways. This module finds the complete set of shortest paths through an assembly graph, which is used to identify degenerate pathways that reach the same target with an equal number of joining steps. """ import numpy as np from rdkit.Chem import AllChem as Chem from rdkit.Che...
ELIFE-ASU/assemblytheorytools
assemblytheorytools/find_other_paths.py
.py
8d8f37b8bed13aa4
7.48
8
""" Processing of mass spectrometry data in JSON form. This module reads the JSON representation produced from mzML files and extracts the spectra and peak lists used for downstream assembly analysis. """ import json import pandas as pd from typing import Any, Callable, Dict, Optional, Union # Characters that can l...
ELIFE-ASU/assemblytheorytools
assemblytheorytools/tools_ms_json.py
.py
9797fd7d88930550
7.48
8
""" String assembly helpers. This module supports assembly index calculations on sequences rather than molecules. It loads FASTA files, concatenates strings with unique delimiters for joint assembly calculations, generates random test strings, and builds the directed and undirected graph representations of a string. "...
ELIFE-ASU/assemblytheorytools
assemblytheorytools/tools_string.py
.py
26e8e43378c26c59
7.48
8
""" Shared test molecules and graph fixtures. This module exposes the reference molecule set loaded from ``tests/data/test_molecule_data.csv`` as the ``test_mols`` mapping, together with small hand-built NetworkX graphs (water, phosphine, PH2+ and carbon dioxide) and helpers for inspecting graph contents in tests. """...
ELIFE-ASU/assemblytheorytools
assemblytheorytools/tools_test.py
.py
75c6d79ac4bc75df
7.98
8
import matplotlib.pyplot as plt import networkx as nx import assemblytheorytools as att def draw_edges_from_metabolites(graph, color_to_index, metabolites): """ Draws edges between nodes in a graph based on metabolite connections. Args: graph (networkx.Graph): The graph to which edges will be ad...
ELIFE-ASU/assemblytheorytools
examples/advanced/other/metabolic_pathway.py
.py
6e840054e2fb8fa7
7.48
8
import matplotlib.pyplot as plt import random from functools import partial import assemblytheorytools as att def random_string(length, pool): """ Generate a random string of a specified length using characters from the given pool. Args: length (int): The length of the random string to generate....
ELIFE-ASU/assemblytheorytools
examples/advanced/other/rna_string.py
.py
637c46d2dc88fb8d
7.48
8
"""Keep the test run headless. The tests exercise the plotting helpers the same way the examples do, so they call the display entry points too: ``plt.show()``, PIL's ``Image.show()`` and ASE's ``view()``. None of those affect an assertion, but on a desktop they open matplotlib windows, spawn external image viewers and...
ELIFE-ASU/assemblytheorytools
tests/conftest.py
.py
ba86629b09116f2c
7.98
8
# Copyright (c) 2025, Signaloid. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publis...
signaloid/Signaloid-Compute-Module-Utilities
src/circuitpython/c0microsd/interface.py
.py
05b015a2b967b2ec
7.5
9
# Copyright (c) 2026, Signaloid. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distrib...
signaloid/Signaloid-Compute-Module-Utilities
src/python/signaloid_utilities/common/bitstream_prefix.py
.py
c7dab3e625356bdb
7.5
9
# Copyright (c) 2026, Signaloid. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distrib...
signaloid/Signaloid-Compute-Module-Utilities
src/python/signaloid_utilities/common/raw_block_device.py
.py
d04782d7e14fb504
7.5
9
"""Persistent recoverable fork pool for inference-speed Step 3 (pre-CUDA refine + simplify). A single ``ProcessPoolExecutor`` over the ``fork`` start method, created ONCE *before* any CUDA init. This is the structural mitigation for the fork-after-CUDA / nested-fork deadlock family the project hit for ~9h: forking aft...
psaegert/flash-ansr
src/flash_ansr/_refine_pool.py
.py
2951765f7963d2dc
7.45
7
"""Constant serialization for training sequences (the v24 ``constant_representation`` gate). ``'v23'`` (the default) keeps today's behavior byte-identical: ``<constant>`` placeholder tokens stay in the sequence and the fitted values ride out-of-band on the parallel numeric channel (``input_num``), injected downstream ...
psaegert/flash-ansr
src/flash_ansr/data/serialization.py
.py
05951d488904acb0
7.45
7
"""Compaction of closed ``<ieee754>`` spans on the DYNAMIC KV decode path (contract T8). At inference the model emits expanded constants (``<ieee754>`` + 8 hex nibbles + ``</ieee754>``, 10 tokens); the pipeline compacts each closed span into ONE ``<float>`` token carrying the decoded float32 value on the numeric chann...
psaegert/flash-ansr
src/flash_ansr/decoding/compaction.py
.py
7c56f0cf18cb25c7
7.45
7
"""Constrained decoding for the v24 ``ieee754_mixed`` constants representation. A small state machine over the vocabulary mask (contract tests T6/T7): * ``<float>`` is forbidden OUTRIGHT at every generation position -- the compact-constant token only ever enters a sequence by pipeline compaction, never by model emi...
psaegert/flash-ansr
src/flash_ansr/decoding/constrained.py
.py
ebeaa876d22ff71b
7.45
7
"""Beam-style generation helpers.""" from typing import Any, Iterable from flash_ansr.model import FlashANSRModel from flash_ansr.preprocessing import PromptPrefix def _nan_rewards(count: int) -> list[float]: return [float("nan")] * count def run_beam_search( transformer: FlashANSRModel, *, data: A...
psaegert/flash-ansr
src/flash_ansr/generation/beam.py
.py
9bd9f3fd229944f1
7.45
7
"""Public inference result types for :meth:`FlashANSR.infer`. A single inference over one problem yields an :class:`InferenceResult`: the score-sorted refined :class:`Candidate`s (the ones that fitted), PLUS a :class:`CandidateLedger` -- the FULL generation pool joined with the refined survivors and classified FIT_OK ...
psaegert/flash-ansr
src/flash_ansr/inference.py
.py
1d6db3ad0b276eda
7.45
7
"""Common neural network components shared by encoders and decoders.""" from abc import abstractmethod from typing import Any import torch from torch import nn import torch.nn.functional as F class RMSNorm(nn.Module): """Root mean square layer normalisation.""" def __init__(self, dim: int, eps: float = 1e-6...
psaegert/flash-ansr
src/flash_ansr/model/common/components.py
.py
711e190e9487c68a
7.45
7
"""Decoder-specific building blocks, including attention and positional encodings.""" from typing import Optional, Tuple, cast import torch from torch import nn import torch.nn.functional as F from torch.utils.checkpoint import checkpoint from flash_ansr.model.common import FeedForward, get_norm_layer class RotaryE...
psaegert/flash-ansr
src/flash_ansr/model/decoders/components.py
.py
10446b5cd4dcc32b
7.45
7
"""Static-shape, position-indexed KV cache for graph-capturable decode. The default incremental decode (`use_cache=True`) GROWS the self-attention cache by `torch.cat` every step and SHRINKS the batch to active rows by `index` gather -- both are dynamic shapes that (a) cost ~22% of the 1B decode wall (gather 1.54s + c...
psaegert/flash-ansr
src/flash_ansr/model/decoders/static_kv.py
.py
8b159ab7afc98cef
7.45
7
"""Transformer decoder stack built from reusable decoder components.""" from typing import Optional, Tuple, cast import torch from torch import nn from flash_ansr.model.common import get_norm_layer from flash_ansr.model.decoders.components import RotaryEmbedding, TransformerDecoderBlock from flash_ansr.model.decoders...
psaegert/flash-ansr
src/flash_ansr/model/decoders/transformer.py
.py
8e6b04aedd5e01b1
7.45
7
"""Base classes and serialization helpers for set encoders.""" import os import warnings from abc import abstractmethod from typing import Any, Literal import torch from torch import nn from flash_ansr.utils.config_io import load_config, save_config from flash_ansr.utils.paths import substitute_root_path class SetE...
psaegert/flash-ansr
src/flash_ansr/model/encoders/base.py
.py
b343df72a8502c62
7.45
7
"""Factory for constructing ``torch.nn`` (or ``flash_ansr.models``) modules by name.""" import importlib from typing import Any from torch import nn class ModelFactory(): ''' Factory class to create models from a string name. Supports models from torch.nn and nsr.models ''' @staticmethod def ...
psaegert/flash-ansr
src/flash_ansr/model/factory.py
.py
c0011e63e5907f80
7.45
7
"""Install and remove pretrained model snapshots from the Hugging Face Hub.""" import shutil import os from huggingface_hub import snapshot_download from flash_ansr.utils.paths import get_path def install_model(model: str, local_dir: str | None = None, verbose: bool = True) -> None: """Download a model snapshot...
psaegert/flash-ansr
src/flash_ansr/model/manage.py
.py
04244e16237a3e65
7.45
7
"""The :class:`Tokenizer` mapping expression tokens to model vocabulary indices and back.""" import re import warnings from typing import Iterator, Any, Literal import torch from flash_ansr.utils.config_io import load_config class Tokenizer: ''' Tokenizer class for converting tokens to indices and vice vers...
psaegert/flash-ansr
src/flash_ansr/model/tokenizer.py
.py
f1753a144dd60fff
7.45
7
"""Shared dataclasses for preprocessing components.""" from dataclasses import dataclass @dataclass(frozen=True) class PromptPrefix: """Tokens and metadata that form the prompt prefix.""" tokens: list[int] numeric: list[float] mask: list[bool] metadata: dict[str, list[list[str]]] @dataclass(fro...
psaegert/flash-ansr
src/flash_ansr/preprocessing/schemas.py
.py
343d2cd9e74a6db7
7.45
7
"""Canonical candidate-scoring primitives (single source of truth). These are owned by flash-ansr because the product needs them at *inference* time to score and rank decode candidates (``flash_ansr.py`` / ``generation/mcts.py`` / ``results.py``). They are also consumed by the comparison baselines and, after the repo ...
psaegert/flash-ansr
src/flash_ansr/scoring.py
.py
dd92f946c13e9697
7.45
7
"""Generation configuration helpers with method-specific signatures.""" from typing import Any, Callable, Iterator, Literal, Mapping, overload def validate_simplify(value: Any) -> bool: """Return ``value`` if it is a valid ``simplify`` selector, else raise ``ValueError``. ``simplify`` is a two-state switch: ...
psaegert/flash-ansr
src/flash_ansr/utils/generation.py
.py
2cc29a74c3a6f9b5
7.45
7
"""Archive command handlers. Pure logic: these return plain data or raise a typed :class:`~bhoonidhi_downloader.exceptions.BhoonidhiError`. Rendering lives in the CLI layer (``cli/archive.py``). """ import json from pathlib import Path from typing import Any from .client import ArchiveManager def run_archive_list(...
geovicco-dev/bhoonidhi-downloader
src/bhoonidhi_downloader/core/archive/command.py
.py
82389e4b7b12c5a3
7.64
18
"""Rich rendering for archive commands.""" from datetime import datetime from rich.console import Console from bhoonidhi_downloader.schemas.selection import product_token, sat_value from bhoonidhi_downloader.viewer import Column, show_table def _full_columns() -> list[Column]: def _availability(record: dict, _...
geovicco-dev/bhoonidhi-downloader
src/bhoonidhi_downloader/core/archive/render.py
.py
41b448824dd3bc07
7.64
18
"""Bhoonidhi authentication client.""" from __future__ import annotations import json import re from collections.abc import Callable from typing import ClassVar from urllib.parse import quote import requests from bhoonidhi_downloader.exceptions import BhoonidhiAuthError, BhoonidhiValidationError from bhoonidhi_down...
geovicco-dev/bhoonidhi-downloader
src/bhoonidhi_downloader/core/auth/client.py
.py
a62096df343ec3b7
7.64
18
"""Auth command handlers. These functions carry the auth logic only: they return plain data or raise a typed :class:`~bhoonidhi_downloader.exceptions.BhoonidhiError`. All terminal rendering lives in the CLI layer (``cli/auth.py``), so the same functions can be called directly from a Python script without a console. ""...
geovicco-dev/bhoonidhi-downloader
src/bhoonidhi_downloader/core/auth/command.py
.py
f21eb962a3fc91d9
7.64
18
"""Session file utilities.""" import json import os from pathlib import Path SESSION_DIR = Path(os.path.expanduser("~")) / ".bhoonidhi" SESSION_FILE = SESSION_DIR / "session" _DEFAULT_SESSION = { "jwt": None, "userId": None, "user_email": None, "username": None, "sid": None, "scenes": [], } ...
geovicco-dev/bhoonidhi-downloader
src/bhoonidhi_downloader/core/auth/utils.py
.py
2f2f26c23cb8ab88
7.64
18
"""Cart command handlers. Pure logic: these build structured results (added/failed/removed lists) or raise a typed :class:`~bhoonidhi_downloader.exceptions.BhoonidhiError`. The caller supplies a ready :class:`CartClient`; rendering, progress bars, and interactive session prompts live in the CLI layer (``cli/cart.py``)...
geovicco-dev/bhoonidhi-downloader
src/bhoonidhi_downloader/core/cart/command.py
.py
a0c433ca656211be
7.64
18
"""Rich rendering for cart commands.""" from collections import Counter from rich.console import Console, Group from rich.panel import Panel from rich.progress import ( BarColumn, MofNCompleteColumn, Progress, SpinnerColumn, TextColumn, ) from rich.text import Text from bhoonidhi_downloader.core....
geovicco-dev/bhoonidhi-downloader
src/bhoonidhi_downloader/core/cart/render.py
.py
595d9ab3fdbd22f8
7.64
18
"""Client-side scene enrichment, mirroring what the portal computes before adding a scene to a cart. A ``ProductSearch`` result is *not* what the portal puts in a cart. Before calling any add-to-cart endpoint the portal derives a handful of identifier fields — ``SAT_SPEC``, ``SCENE_SPEC``, ``SUBSCENE_ID`` and their sc...
geovicco-dev/bhoonidhi-downloader
src/bhoonidhi_downloader/core/cart/scene_spec.py
.py
2227277c538fc11d
8.14
18
"""Pure request-shaping rules for the portal's three carts. Everything here mirrors logic in the portal's own front-end and is side-effect free so it can be unit tested without touching the network. """ import json import re import urllib.parse from datetime import datetime, timedelta from enum import Enum from zonei...
geovicco-dev/bhoonidhi-downloader
src/bhoonidhi_downloader/core/cart/utils.py
.py
897eaf142abe0c4f
7.64
18
"""Concurrent scene downloads with rate-limit-aware pacing. Note: Bhoonidhi's data endpoint does not honor HTTP Range requests (verified live — it always returns 200 + the full Content-Length regardless of a Range header), so an interrupted download cannot be resumed. A leftover partial file is discarded and the scene...
geovicco-dev/bhoonidhi-downloader
src/bhoonidhi_downloader/core/download/client.py
.py
4832c885ae026c75
7.64
18
"""Predict what 'query download' would do, without touching the network. Mirrors the real classification rules used by ``_download_one`` and ``run_query_download`` (availability, on-disk duplicates, recorded duplicates elsewhere) so a dry run is an honest preview of the real command, not a separate approximation that ...
geovicco-dev/bhoonidhi-downloader
src/bhoonidhi_downloader/core/download/preview.py
.py
1e518af1a6350137
7.64
18
"""URL building and download-eligibility helpers for Bhoonidhi scenes.""" from __future__ import annotations from pathlib import PurePosixPath BASE_URL = "https://bhoonidhi.nrsc.gov.in" # (satellite, sensor) -> short code the portal's data path expects. # Sensors not listed here are used as-is (dynamic path). A few...
geovicco-dev/bhoonidhi-downloader
src/bhoonidhi_downloader/core/download/utils.py
.py
a98d00192e787f56
7.64
18
"""Query command handlers: create, list, show, rename, fork, refresh, rm, download. Command logic is pure: it returns plain data or raises a typed :class:`~bhoonidhi_downloader.exceptions.BhoonidhiError`. Rendering, progress bars, and interactive prompts live in the CLI layer (``cli/query.py``). """ import logging fr...
geovicco-dev/bhoonidhi-downloader
src/bhoonidhi_downloader/core/query/command.py
.py
c55448329866d2c4
7.64
18
"""Rich rendering for query commands.""" from rich.console import Console from bhoonidhi_downloader.schemas import QuerySchema from bhoonidhi_downloader.viewer import Column, show_table def render_query_saved(console: Console, query: QuerySchema) -> None: """Render confirmation that a query was saved.""" co...
geovicco-dev/bhoonidhi-downloader
src/bhoonidhi_downloader/core/query/render.py
.py
8af93cc6caecafe5
7.64
18
"""Classify how a scene can actually be obtained. Search results conflate two different questions: *is it open access* (pricing) and *is it staged for download right now* (availability). A scene can be open access direct download and still 404, because the portal moves older products out of hot storage until they are...
geovicco-dev/bhoonidhi-downloader
src/bhoonidhi_downloader/core/search/availability.py
.py
e2c2633b77130287
7.64
18
class BhoonidhiError(Exception): """Base class for every error this package raises. Catch this to handle any Bhoonidhi failure in one place. The subclasses below also keep their matching built-in base (``ValueError``, ``LookupError``, ...) so existing ``except ValueError`` style handlers keep worki...
geovicco-dev/bhoonidhi-downloader
src/bhoonidhi_downloader/exceptions.py
.py
d74f26627865aaf8
7.64
18
"""A single satellite/sensor/product selection for a search. The portal searches on a flat list of ``dispName`` tokens (``EOS-06_OCM(GAC)_L2C-Chlorophyll``, ``ResourceSat-2A_LISS3`` ...). Each token is one product. A :class:`Selection` names how far down that hierarchy the user wants to narrow: satellite only ...
geovicco-dev/bhoonidhi-downloader
src/bhoonidhi_downloader/schemas/selection.py
.py
cd4ed5ded34df656
7.64
18
"""Shared helpers: normalize typed SDK inputs into core-ready forms.""" from __future__ import annotations from bhoonidhi_downloader.exceptions import BhoonidhiValidationError def normalize_select(select: list[int | str] | None) -> list[str] | None: """Convert a typed ``select`` list into the string tokens the ...
geovicco-dev/bhoonidhi-downloader
src/bhoonidhi_downloader/sdk/_select.py
.py
030b99d6715f04cd
7.64
18
import globalInfos import math from shapez2 import gameObjects, ingameData, shapeCodes STRUCT_EMPTY_CHAR = "0" STRUCT_SHAPE_CHAR = "1" STRUCT_COLORS = ["r","g","b","w","c","m","y"] STRUCT_SHAPE = { ingameData.QUAD_SHAPES_CONFIG : "C", ingameData.HEX_SHAPES_CONFIG : "H" } PARAM_PREFIX = "+" INGNORE_CHARS_IN_S...
tobspr-games/shapez-2-discord-bot
shapeCodeGenerator.py
.py
12bcbf7585de0500
7.42
6
""" Taken from iRacing Web API Documentation: https://forums.iracing.com/discussion/15068/general-availability-of-data-api/p1 iRacing Web API Authentication ------------------------------ In order to access the API, you will need to authenticate. This can be accomplished by making a single POST request to https://m...
tegataiprime/iracing-client
src/iracing_client/auth.py
.py
a2927ba8e92242d9
7.42
6
"""Base classes for iRacing data objects.""" from abc import ABC, abstractmethod import requests BASE_URL = "https://members-ng.iracing.com/data/" REQUEST_TIMEOUT = 10.0 class IRacingRequestException(Exception): """Raised when an iRacing request fails.""" class IRacingDataObject(ABC): """An abstract base ...
tegataiprime/iracing-client
src/iracing_client/data/common.py
.py
c272eda41bde7ee7
7.42
6
""" A wrapper around the iRacing Constants Entity. Refer to https://members-ng.iracing.com/data/doc for more information. """ from enum import Enum import requests from iracing_client.data import common from iracing_client.data.common import IRacingDataObject # URLs for iRacing Constants. CATEGORIES_URL = common.BASE...
tegataiprime/iracing-client
src/iracing_client/data/constants.py
.py
06be1552e15033b0
7.42
6
""" A wrapper around the iRacing League Entity. Refer to https://members-ng.iracing.com/data/doc for more information. """ from enum import Enum import requests from iracing_client.data import common from iracing_client.data.common import IRacingDataObject CUST_LEAGUE_SESSIONS_URL = common.BASE_URL + "league/cust_lea...
tegataiprime/iracing-client
src/iracing_client/data/league.py
.py
4e0b26a7b3b1d51e
7.42
6
"""Trace & Debugging Functions""" import logging import http.client logging.basicConfig(level=logging.DEBUG) httpclient_logger = logging.getLogger("http.client") def httpclient_logging_patch(level=logging.DEBUG): """Enable HTTPConnection debug logging to the logging framework""" def httpclient_log(*args): ...
tegataiprime/iracing-client
src/iracing_client/trace.py
.py
f5d5f513800b8293
7.42
6
"""Pytest configuration for integration tests.""" import pytest import os import iracing_client.auth as auth @pytest.fixture(scope="session") def iracing_username(): """Return a username from an environment variable.""" return os.environ.get('IRACING_USERNAME') @pytest.fixture(scope="session") def iracing_pa...
tegataiprime/iracing-client
tests/integration/conftest.py
.py
b579da19c4f5400b
7.92
6
"""Test constants module.""" from iracing_client.data.constants import Constants def test_get_categories(http_session): """Test get_categories function.""" constants = Constants(http_session) categories = constants.categories assert categories assert isinstance(categories, list) assert (len(cat...
tegataiprime/iracing-client
tests/integration/data/test_constants.py
.py
b3818ab36c73a098
7.92
6
"""Test League Module.""" import pytest from iracing_client.data.league import League @pytest.fixture(scope="module") def league_instance(http_session): """Return a League object.""" return League(http_session) def test_get_cust_league_sessions(league_instance): """Test get_cust_league_sessions function."...
tegataiprime/iracing-client
tests/integration/data/test_league.py
.py
18d28a8287b341c4
7.92
6
"""Test Member Module.""" import pytest from iracing_client.data.member import Member from iracing_client.data.constants import Category, ChartType @pytest.fixture(scope="module") def member_instance(http_session): """Return a Member object.""" return Member(http_session) def test_get_member(member_instance...
tegataiprime/iracing-client
tests/integration/data/test_member.py
.py
860119e7c05e279a
7.92
6
"""Test auth module.""" import iracing_client.auth as auth from requests import Session def test_login(iracing_username, iracing_password): """Test login function.""" http_session = auth.login(iracing_username, iracing_password) assert http_session assert isinstance(http_session, Session) assert ht...
tegataiprime/iracing-client
tests/integration/test_auth.py
.py
f56945871f6366a0
7.92
6
"""Configuración de Pytest específica para ejecutar pruebas asíncronas.""" from __future__ import annotations from importlib import import_module from pathlib import Path import sys SRC_PATH = Path(__file__).resolve().parent / 'src' if str(SRC_PATH) not in sys.path: sys.path.insert(0, str(SRC_PATH)) try: # pra...
Alphonsus411/pCobra
conftest.py
.py
d828434678634ba0
8.04
11
from datetime import datetime, timezone from cobra.cli.plugin import PluginCommand class HoraCommand(PluginCommand): """Muestra la hora actual por pantalla.""" name = "hora" version = "1.0" author = "Equipo Cobra" description = "Imprime la hora actual" def register_subparser(self, subparsers...
Alphonsus411/pCobra
examples/plugins/hora_plugin.py
.py
f2a24da5b59855b8
7.54
11
from argparse import ArgumentParser from typing import Any from cobra.cli.plugin import PluginCommand class SaludoCommand(PluginCommand): """Comando de ejemplo que imprime un saludo.""" name = "saludo" version = "1.0" author = "Equipo Cobra" description = "Comando de saludo de ejemplo" def...
Alphonsus411/pCobra
examples/plugins/saludo_plugin.py
.py
a3506db211f851b1
7.54
11
"""Transpilador de ejemplo para Cobra.""" from cobra.transpilers import BaseTranspiler class TranspiladorDemo(BaseTranspiler): """Transpilador muy simple que genera un mensaje fijo.""" def __init__(self): """Inicializa el transpilador.""" super().__init__() def generate_code(self...
Alphonsus411/pCobra
examples/plugins/transpiler_demo.py
.py
1def23ea08044430
7.54
11
"""Ejemplo práctico del context manager ``rel`` de pcobra.""" from __future__ import annotations import sys from pathlib import Path PROYECTO = Path(__file__).resolve().parents[1] sys.path.insert(0, str(PROYECTO / "src")) sys.path.insert(0, str(PROYECTO / "src" / "pcobra")) from standard_library.util import rel c...
Alphonsus411/pCobra
examples/rel_example.py
.py
74ef383415d95ee5
7.54
11
"""Generación sencilla de IR para LLVM (experimental/no oficial). Este módulo se conserva únicamente como referencia histórica de prototipado interno y **no** forma parte del contrato público de targets soportados. No debe registrarse en CLI, documentación pública ni matrices oficiales. """ from __future__ import ann...
Alphonsus411/pCobra
experiments/llvm_backend.py
.py
ce558d9aad04872a
7.54
11
#!/usr/bin/env python3.10 import re import sys try: import tomllib # Python >= 3.11 except ModuleNotFoundError: # pragma: no cover import tomli as tomllib from datetime import date from pathlib import Path PYPROJECT_PATH = Path("pyproject.toml") CHANGELOG_PATH = Path("CHANGELOG.md") # Archivos en los que se...
Alphonsus411/pCobra
scripts/bump_version.py
.py
81b134a22bf551e7
7.54
11
#!/usr/bin/env python3 """Verifica que CHANGELOG.md contenga la entrada de version actual.""" from __future__ import annotations import re import sys from pathlib import Path try: import tomllib except ModuleNotFoundError: # pragma: no cover import tomli as tomllib CHANGELOG = Path("CHANGELOG.md") PYPROJECT...
Alphonsus411/pCobra
scripts/check_changelog.py
.py
ed1136aacc2a1262
7.54
11
import os import sys import argparse from src import config from src.train import train from src.evaluate import evaluate from src.logger import ExperimentLogger from src.inference import run_inference # Supress info and warning logs os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' def set_global_seeds(seed): """ S...
kashtennyson/RailSense
main.py
.py
3a839976ec1e680a
7.42
6
import pathlib import numpy as np import tensorflow as tf import albumentations as A from tensorflow.keras.applications.resnet50 import preprocess_input from . import config def get_train_augmentation(): """ Defines the Albumentations pipeline for simulated railway conditions. Focuses on environmental no...
kashtennyson/RailSense
src/data_loader.py
.py
552b20952894adfb
7.42
6
import os import time import json import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from sklearn.metrics import precision_score, recall_score from sklearn.metrics import roc_auc_score, average_precision_score from sklearn.metrics import precision_recall_curve from . import config from .logger ...
kashtennyson/RailSense
src/evaluate.py
.py
2c4679271d88f4ef
7.42
6
import os import json import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from . import config from .scoring import compute_error_maps, score_from_error_maps class AnomalyPredictor: def __init__(self, model_path=None): if model_path is None: model_path = os.path.join(co...
kashtennyson/RailSense
src/inference.py
.py
2d574e27b24888ca
7.42
6
import os import subprocess import matplotlib import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from . import config # Use aggregation backend matplotlib.use("Agg") try: import wandb from wandb.integration.keras import WandbMetricsLogger _WANDB_INSTALLED = True except ImportErro...
kashtennyson/RailSense
src/logger.py
.py
fa13d6be61b13d1b
7.42
6
from tensorflow.keras import layers, models from tensorflow.keras.applications import ResNet50 from . import config class RailwayAutoencoder: def __init__(self): self.input_shape = config.IMAGE_SHAPE + (3,) self.latent_dim = config.LATENT_DIM def build_encoder(self): """ Crea...
kashtennyson/RailSense
src/model.py
.py
707dcf576512f112
7.42
6
import numpy as np from scipy.ndimage import gaussian_filter from . import config # Gaussian window matching tf.image.ssim (filter_size=11, sigma=1.5) _SSIM_SIGMA = 1.5 _SSIM_TRUNCATE = 3.5 _SSIM_MAX_VAL = 1.0 _SSIM_C1 = (0.01 * _SSIM_MAX_VAL) ** 2 _SSIM_C2 = (0.03 * _SSIM_MAX_VAL) ** 2 def _l2_error_maps(targets,...
kashtennyson/RailSense
src/scoring.py
.py
c6e4e1ded51d8a3c
7.42
6
import os import numpy as np import tensorflow as tf from .model import get_model from .logger import ExperimentLogger from .data_loader import load_datasets from . import config def structural_loss(y_true, y_pred): """ Hybrid loss: Alpha * (1 - SSIM) + (1 - Alpha) * L1 Focuses on structural integrity ov...
kashtennyson/RailSense
src/train.py
.py
9c74c32088b904c9
7.42
6
def rgb_to_hex(r: float, g: float, b: float) -> str: """ Convert an RGB color into a Hex color code. Args: r (float): The red channel component. g (float): The green channel component. b (float): The blue channel component. Returns: str: Resulting hex color code. "...
Ali10-star/A-Star-Photo-Editor
color_tools/hex_tools.py
.py
7a5b8b80e1265425
7.5
9
""" Module responsible for providing image manipulation functionalities. """ from settings import * from PIL import Image, ImageOps, ImageEnhance, ImageFilter import numpy as np def sepia_palette() -> list[int]: """ Generate a sepia palette to apply to images. Returns: list[int]: the resulting pa...
Ali10-star/A-Star-Photo-Editor
image_tools/manipulator.py
.py
e51761e778c87642
7.5
9
""" Widgets responsible for opening, displaying the image, in addition to closing the editor menus. """ import tkinter from typing import Callable import customtkinter as ctk from tkinter import Event, filedialog from settings import * class ImageImport(ctk.CTkFrame): """ First frame to display when opening ...
Ali10-star/A-Star-Photo-Editor
image_widgets.py
.py
355c539dd4db79c9
7.5
9
import customtkinter as ctk from tkinter import messagebox, Event from PIL import Image, ImageTk, ImageOps # App-specific imports from image_widgets import ImageImport, ImageOutput, CloseOutputButton from image_tools.manipulator import ImageManipulator from menu import Menu from settings import * class App(ctk.CTk): ...
Ali10-star/A-Star-Photo-Editor
main.py
.py
62204f660f0c8ca8
7.5
9
"""SQLite persistence for idempotent uploads.""" import sqlite3 from pathlib import Path class VideoRepository: def __init__(self, database_file: str | Path): self.database_file = Path(database_file) def initialize(self) -> None: self.database_file.parent.mkdir(parents=True, exist_ok=True) ...
roperi/Reddit2Tube
reddit2tube/database.py
.py
8acc7f1fda233cc2
7.42
6
# # Copyright IBM Corp. 2024 - 2026 # SPDX-License-Identifier: Apache-2.0 # """ Example Liberty SystemOut Plugin for javacore-analyser. This plugin demonstrates how to create a custom data source plugin that processes WebSphere Liberty systemout.log files and integrates them into the javacore-analyser report. This s...
IBM/javacore-analyser
docs/example_plugin/plugin.py
.py
f7a9a6e56992b45c
7.45
7
#!/usr/bin/env python3 # # Copyright IBM Corp. 2026 - 2026 # SPDX-License-Identifier: Apache-2.0 # """ Performance testing script to compare execution times of javacore_analyser_batch.py """ import subprocess import time import os def run_command_with_timing(command, description): """Run a command and measure it...
IBM/javacore-analyser
docs/performance_test.py
.py
06c0a40d1d53dab2
7.95
7
# # Copyright IBM Corp. 2024 - 2024 # SPDX-License-Identifier: Apache-2.0 # import abc class AbstractSnapshotCollection(abc.ABC): def __init__(self): self.name = None self.id = None self.total_cpu = 0 self.total_time = 0 self.avg_mem = 0 self.avg_memory = 0 ...
IBM/javacore-analyser
src/javacore_analyser/abstract_snapshot_collection.py
.py
91fc06b8f189f7a3
7.45
7
# # Copyright IBM Corp. 2025 - 2026 # SPDX-License-Identifier: Apache-2.0 # import logging import torch from transformers import AutoModelForCausalLM, AutoTokenizer from javacore_analyser.ai.llm import LLM from javacore_analyser.constants import ASSISTANT_ROLE, END_OF_TEXT from javacore_analyser.properties import Pr...
IBM/javacore-analyser
src/javacore_analyser/ai/huggingface_llm.py
.py
9b79f05032bdce1a
7.45
7
# # Copyright IBM Corp. 2025 - 2026 # SPDX-License-Identifier: Apache-2.0 # from abc import ABC, abstractmethod import logging import markdown from javacore_analyser.properties import Properties from javacore_analyser.tips import linkify_ai_response class LLM(ABC): """ Abstract Base Class for Language Lear...
IBM/javacore-analyser
src/javacore_analyser/ai/llm.py
.py
97aaa6b5d82f5b69
7.45
7
# # Copyright IBM Corp. 2025 - 2026 # SPDX-License-Identifier: Apache-2.0 # import logging import ollama from ollama import ChatResponse from ollama import chat from javacore_analyser.ai.llm import LLM from javacore_analyser.properties import Properties # prerequisites: # install Ollama from https://ollama.com/dow...
IBM/javacore-analyser
src/javacore_analyser/ai/ollama_llm.py
.py
f9d2bca9b7c4ece6
7.45
7
# # Copyright IBM Corp. 2026 - 2026 # SPDX-License-Identifier: Apache-2.0 # from javacore_analyser.ai.prompter import Prompter from javacore_analyser.constants import GC_PAUSE_DETAIL_THRESHOLD class PerformanceRecommendationsPrompter(Prompter): """ PerformanceRecommendationsPrompter generates a comprehensive...
IBM/javacore-analyser
src/javacore_analyser/ai/performance_recommendations_prompter.py
.py
680dfe425f5a2d33
7.45
7
# # Copyright IBM Corp. 2026 # SPDX-License-Identifier: Apache-2.0 # import os from pathlib import Path class Prompter: def __init__(self, javacore_set): self.javacore_set = javacore_set def _load_prompt_template(self, template_name: str) -> str: """ Load a prompt template from the d...
IBM/javacore-analyser
src/javacore_analyser/ai/prompter.py
.py
34713ba20999fb8b
7.45
7
# # Copyright IBM Corp. 2026 - 2026 # SPDX-License-Identifier: Apache-2.0 # import logging from ibm_watsonx_ai import APIClient, Credentials from ibm_watsonx_ai.foundation_models import ModelInference from ibm_watsonx_ai.metanames import GenTextParamsMetaNames as GenParams from javacore_analyser.ai.llm import LLM fr...
IBM/javacore-analyser
src/javacore_analyser/ai/watsonx_llm.py
.py
d977439af4d48813
7.45
7
# # Copyright IBM Corp. 2024 - 2025 # SPDX-License-Identifier: Apache-2.0 # from javacore_analyser.abstract_snapshot_collection import AbstractSnapshotCollection from javacore_analyser.stack_trace import StackTrace from javacore_analyser.thread_snapshot import ThreadSnapshot class CodeSnapshotCollection(AbstractSnap...
IBM/javacore-analyser
src/javacore_analyser/code_snapshot_collection.py
.py
be4d53969aedea20
7.45
7
# # Copyright IBM Corp. 2024 - 2026 # SPDX-License-Identifier: Apache-2.0 # import logging import os import sys from pathlib import Path LOGGING_FORMAT = '%(asctime)s [thread: %(thread)d][%(levelname)s][%(filename)s:%(lineno)s] %(message)s' def create_file_logging(logging_file_dir): """ Create a file logger...
IBM/javacore-analyser
src/javacore_analyser/common_utils.py
.py
a918367b63d2df9d
7.45
7
# # Copyright IBM Corp. 2026 - 2026 # SPDX-License-Identifier: Apache-2.0 # class InvalidLLMMethodError(ValueError): """ Exception raised when an invalid LLM method is specified. This exception is raised when the LLM method provided is not one of the supported methods (e.g., 'ollama' or 'huggingf...
IBM/javacore-analyser
src/javacore_analyser/exceptions.py
.py
06e0b189c1fb462a
7.45
7
# # Copyright IBM Corp. 2024 - 2025 # SPDX-License-Identifier: Apache-2.0 # import codecs import datetime import logging import os.path import re from typing import Any, Optional from javacore_analyser.constants import ( ARCHITECTURE, CMD_LINE, COMPRESSED_REFS, CPU_NUMBER_TAG, DATETIME, ENCODI...
IBM/javacore-analyser
src/javacore_analyser/javacore.py
.py
2882347b9f16ec61
7.45
7
# # Copyright IBM Corp. 2024 - 2025 # SPDX-License-Identifier: Apache-2.0 # import argparse import locale import logging import os import re import shutil import sys import tempfile import threading import time from pathlib import Path from flask import Flask, render_template, request, send_from_directory, redirect fr...
IBM/javacore-analyser
src/javacore_analyser/javacore_analyser_web.py
.py
5d22840c3f82a1ef
7.45
7
# # Copyright IBM Corp. 2024 - 2026 # SPDX-License-Identifier: Apache-2.0 # """ Javacore Thread Function Classifier This module provides a class-based interface for classifying the function of threads in Java core dumps using a pre-trained XGBoost machine learning model. Usage: from classify_javacore_inference i...
IBM/javacore-analyser
src/javacore_analyser/ml/classify_javacore_inference.py
.py
f04febd51e0b57d5
7.45
7
# # Copyright IBM Corp. 2024 - 2026 # SPDX-License-Identifier: Apache-2.0 # import configparser import logging import os.path import importlib_resources # Assisted by watsonx Code Assistant class Properties: """ A singleton class to manage properties that should not be changed after initialization. """ ...
IBM/javacore-analyser
src/javacore_analyser/properties.py
.py
f7050ccde3f59e92
7.45
7
# MIT License # # Copyright (C) 2023 vanous # # This file is part of pygdtf. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # t...
open-stage/python-gdtf
pygdtf/utils/__init__.py
.py
83c52820a3760e67
7.6
15
# MIT License # # Copyright (C) 2025 vanous # # This file is part of pygdtf. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # t...
open-stage/python-gdtf
pygdtf/utils/attr_loader.py
.py
fb9efa89b3603125
7.6
15
# MIT License # # Copyright (C) 2025 vanous # # This file is part of pygdtf. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # t...
open-stage/python-gdtf
pygdtf/utils/attribute_regenerator.py
.py
4005ea40ffbdff7f
7.6
15
# MIT License # # Copyright (C) 2026 vanous # # This file is part of pygdtf. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # t...
open-stage/python-gdtf
tests/test_dmx_value.py
.py
303ba7f9e9c61ba1
7.1
15
# MIT License # # Copyright (C) 2026 vanous # # This file is part of pygdtf. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # t...
open-stage/python-gdtf
tests/test_geometries.py
.py
0ff2d0881dd9980b
7.1
15
# MIT License # # Copyright (C) 2023 vanous # # This file is part of pygdtf. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # t...
open-stage/python-gdtf
tests/test_library.py
.py
1c66d5454bb69f73
8.1
15