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 |
|---|---|---|---|---|---|---|
import logging
from allauth.account.adapter import DefaultAccountAdapter
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
logger = logging.getLogger(__name__)
class SocialAccountAdapter(DefaultSocialAccountAdapter):
"""Socialaccount adapter that logs otherwise-swallowed OAuth errors.
a... | aiddata/geoquery | backend/accounts/adapter.py | .py | 5bbb4728df6ee2a4 | 7.35 | 4 |
"""Attach historical requests to user accounts by verified email.
Requests predating the account system (and anonymous submissions) are keyed
only by the ``Request.contact`` email string. When a user proves ownership of
an email address (allauth verification, or a provider-verified email at social
signup), every uncla... | aiddata/geoquery | backend/accounts/claims.py | .py | 78785b53711d9f27 | 7.35 | 4 |
"""Convert a pre-accounts database so `migrate` can run against it.
Databases first migrated under the default AUTH_USER_MODEL carry an applied
admin.0001_initial whose *swappable* dependency now resolves to
accounts.0001_initial, which was never applied. Every `migrate` then dies in
MigrationLoader.check_consistent_h... | aiddata/geoquery | backend/accounts/management/commands/adopt_auth_user.py | .py | 26e2968ec7fb6db9 | 7.35 | 4 |
"""Give adopted legacy accounts the allauth EmailAddress rows they lack.
Users carried over by ``accounts/sql/adopt_auth_user.sql`` predate allauth, so
they have a ``User.email`` but no ``account_emailaddress`` row. That gap is not
cosmetic:
- ACCOUNT_LOGIN_METHODS is {"email"}, and allauth authenticates by looking u... | aiddata/geoquery | backend/accounts/management/commands/adopt_legacy_users.py | .py | 3c04485284e692e7 | 7.35 | 4 |
"""`migrate`, preceded by the legacy user-table adoption.
Django resolves management commands from INSTALLED_APPS before django.core, so
this shadows the built-in `migrate` and every existing caller -- deploy jobs,
entrypoints, the test runner -- picks it up with no change.
The adoption cannot live in a migration, or... | aiddata/geoquery | backend/accounts/management/commands/migrate.py | .py | db9039212129e438 | 7.35 | 4 |
from django.contrib.auth.models import AbstractUser
from django.db import models
class User(AbstractUser):
"""Custom user model with a required, unique email address.
Email is the login identifier (see ACCOUNT_LOGIN_METHODS in settings), but
``username`` is kept as the technical USERNAME_FIELD so that
... | aiddata/geoquery | backend/accounts/models.py | .py | 58d7839cc14f6751 | 7.35 | 4 |
"""Signal handlers that auto-claim historical requests.
Three triggers cover the ways an email becomes verifiably owned:
- ``email_confirmed``: a (possibly secondary) address verified via the emailed
key — the explicit "claim my old requests" path.
- ``user_signed_up``: GitHub-verified emails arrive as
``EmailAdd... | aiddata/geoquery | backend/accounts/signals.py | .py | 9580e21c6ecc9d87 | 7.35 | 4 |
from django.core.management.base import BaseCommand
class BaseIngestCommand(BaseCommand):
"""Base class for ingest management commands.
After a successful run of handle(), dispatches trigger_coverage_and_extract
so coverage records are created/checked and extract tasks are built without
manual interv... | aiddata/geoquery | backend/analytics/management/commands/base.py | .py | 7a2ba062f0af33c6 | 7.35 | 4 |
import time
import logging
from django.core.management.base import BaseCommand
from django.db import connection
logger = logging.getLogger(__name__)
class Command(BaseCommand):
help = "Reset tasks stuck in 'locked' (status=2) state back to pending."
def add_arguments(self, parser):
parser.add_argum... | aiddata/geoquery | backend/analytics/management/commands/free_stale_processing_tasks.py | .py | 3db06132b03bc8c2 | 7.35 | 4 |
import time
from datetime import datetime, timedelta
from typing import Union
from django.core.management.base import BaseCommand
from django.db import connection
from loguru import logger
"""
Module for handling edge-cases and errors.
"""
class Command(BaseCommand):
help = "Generate missing coverage records... | aiddata/geoquery | backend/analytics/management/commands/manage_processing_task_errors.py | .py | 7b35302dc275fd62 | 7.35 | 4 |
from logging import getLogger
from django.core.management.base import BaseCommand
from django.db import connection
from analytics.tasks.processing import run_extract_task
logger = getLogger(__name__)
class Command(BaseCommand):
help = "Trigger dispatching of pending processing tasks (e.g. extract tasks) to Cel... | aiddata/geoquery | backend/analytics/management/commands/run_processing_tasks.py | .py | bb4facf21bdf9ee8 | 7.35 | 4 |
import hashlib
import secrets
import uuid
from datetime import timedelta
from django.conf import settings
from django.db import models
from django.db.models.functions import Lower
from django.utils import timezone
from datasets.models import Dataset, DatasetResource
from features.models import FeatMap, Feature
clas... | aiddata/geoquery | backend/analytics/models.py | .py | 9d6b5589d4c4ae8a | 7.35 | 4 |
from __future__ import annotations
import re
import shutil
import subprocess
from pathlib import Path
INCLUDE_PATTERN = re.compile(r"\{!>\s*(?P<path>[^!]+?)\s*!}")
FENCED_INCLUDE_PATTERN = re.compile(
r"```(?P<lang>[^\n`]*)\n[ \t]*\{!>\s*(?P<path>[^!]+?)\s*!}[ \t]*\n```",
re.MULTILINE,
)
LANGUAGE_BY_SUFFIX =... | tarsil/cookiecutter-pypackages | {{ cookiecutter.package_name }}/scripts/docs_pipeline.py | .py | 1a7e2ae392fcf173 | 7.15 | 1 |
import ipaddress as ip
from .abstract import Processor
from .channel import InputChannel, OutputChannel
from .driver import Driver
from .matrix import Matrix
class ELTProcessor(Processor):
def __init__(
self,
ip_addr: ip.IPv4Address | str,
port: int,
inputs: int,
outputs: ... | saktush/Exelltech_remote_control | src/exelltech_remote_control/processor.py | .py | 7d1a4da102ac0632 | 7 | 0 |
from numba import njit
import numpy as np
from scipy.constants import c as c0
from scipy.linalg import block_diag
from interpolator import interp_hermite
import y2024BBN.prior_lcdm_schoneberg as bbn
from y2026union3_1.data import get_data as get_sn_data
from y2025BAO.data import get_data as get_bao_data
from y2024DESBA... | franciscotln/cosmology-model-fit | bao/desi_union3_bbn.py | .py | ddaec61390b9cdd2 | 7.15 | 1 |
"""
ACT baseline LCDM constraints arXiv:2503.14452v2
https://lambda.gsfc.nasa.gov/product/act/act_dr6.02/act_dr6.02_chains_lcdm_get.html
https://lambda.gsfc.nasa.gov/product/act/act_dr6.02/act_dr6.02_chains_info.html
https://lambda.gsfc.nasa.gov/product/act/act_dr6.02/act_dr6.02_chains_prod_table.html
"""
import numpy... | franciscotln/cosmology-model-fit | cmb/data_act_compression.py | .py | 60a48b0b821db7f6 | 7.15 | 1 |
"""
CMB Constraints on the Early Universe Independent of Late-Time Cosmology
arXiv:2302.12911
"""
from numba import njit
import numpy as np
from scipy.constants import c as c0
import nu_evolution as neutrino
c = c0 / 1000 # km/s
DISTANCE_PRIORS = np.array([0.010410274, 0.02223, 0.14208])
"""Compressed early-LCDM pr... | franciscotln/cosmology-model-fit | cmb/data_early_lcdm_compression.py | .py | 82c82b5b957f7683 | 7.15 | 1 |
"""
Planck+ACT baseline LCDM constraints arXiv:2503.14452v2
https://lambda.gsfc.nasa.gov/product/act/act_dr6.02/act_dr6.02_chains_lcdm_get.html
https://lambda.gsfc.nasa.gov/product/act/act_dr6.02/act_dr6.02_chains_info.html
https://lambda.gsfc.nasa.gov/product/act/act_dr6.02/act_dr6.02_chains_prod_table.html
"""
from ... | franciscotln/cosmology-model-fit | cmb/data_planck_act_compression.py | .py | 3e2a6e52b3be2d23 | 7.15 | 1 |
"""
Planck PR3, 2019 plikHM TT, TE, EE + lowl + lowE
"""
from numba import njit
import numpy as np
from scipy.constants import c as c0
import nu_evolution as neutrino
c = c0 / 1000 # km/s
DISTANCE_PRIORS = np.array([1.75063846, 301.760701, 0.0223597502])
"""Compressed Planck priors: (R, lA = π / θ*, ωb)"""
covaria... | franciscotln/cosmology-model-fit | cmb/data_planck_compression.py | .py | 16db9cd7726194ba | 7.15 | 1 |
"""
Planck PR3, 2019 plikHM TT, TE, EE + lowl + lowE + lensing
"""
from numba import njit
import numpy as np
from scipy.constants import c as c0
import nu_evolution as neutrino
c = c0 / 1000 # km/s
DISTANCE_PRIORS = np.array([1.74996427, 301.757385, 0.0223731992])
"""Compressed Planck + Lensing priors: (R, lA = π /... | franciscotln/cosmology-model-fit | cmb/data_planck_lens_compression.py | .py | bb57c7eb610ebae1 | 7.15 | 1 |
import numpy as np
import numdifftools as nd
from scipy.optimize import minimize
# Laplace approximation for Bayesian evidence (ln Z) using Hessian
def log_evidence(mc_samples, log_probs, log_probability, bounds):
"""
Laplace approximation for Bayesian evidence (ln Z) using Hessian at MAP.
- -inf < ln(Z) ... | franciscotln/cosmology-model-fit | log_evidence.py | .py | 90b71d05356837f4 | 7.15 | 1 |
from wand.color import Color
from wand.image import Image
from jellyfin_flag_setter.flags.mapping import flag_path
FLAG_PADDING = 8
FLAG_WIDTH_RATIO = 5
_EDITED_MARKER = "flagsetter:edited"
def is_edited(image_bytes: bytes) -> bool:
with Image(blob=image_bytes) as img:
return img.metadata.get("comment")... | Pabsilon/jellyfin-flag-setter | jellyfin_flag_setter/flags/composer.py | .py | 95b730767e8273ef | 7.35 | 4 |
from pathlib import Path
# ISO 639-2 language code to ISO 3166-1 alpha-2 flag code
LANGUAGE_TO_FLAG: dict[str, str] = {
"spa": "es",
"eng": "gb",
"fra": "fr",
"deu": "de",
"jpn": "jp",
}
# Flags that should always appear first, in this order
PRIORITY_FLAGS = ["es"]
FLAGS_DIR = Path(__file__).pare... | Pabsilon/jellyfin-flag-setter | jellyfin_flag_setter/flags/mapping.py | .py | 7fa6ddcac1bcdd80 | 7.35 | 4 |
import os
import re
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from statsmodels.formula.api import ols
from patsy.builtins import Q # para nombres de ROIs con '-' u otros caracteres raros
# =======================
# CONFIG
# =======================
alpha = 0.05
base_dir = "/media/sol/Exp... | suflorcita/UNSAMPETQuantificationTools | DataAnalysis/AnalysisPETinCEUNIM/statistical_analysis/statistical_analysis_ceunim.py | .py | 72027bea9ce50252 | 7.24 | 2 |
import os
import SimpleITK as sitk
import matplotlib.pyplot as plt
import ImageRegistration as reg
def copy_information_4d_3d(image4d, image3d):
spacing_4d = image4d.GetSpacing()
origin_4d = image4d.GetOrigin()
direction_4d = image4d.GetDirection()
direction_3d = [direction_4d[i] for i in (0, 1, 2, ... | suflorcita/UNSAMPETQuantificationTools | processPET4D.py | .py | 9eda1cf15d2472b9 | 7.24 | 2 |
"""Repo-wide pytest hooks shared by every sub-package test suite.
Live API tests carry the ``network`` marker. When one of them fails because the
network or the upstream service was unavailable -- rather than because the code
under test is wrong -- :func:`pytest_runtest_makereport` rewrites the failure as
a skip and l... | choderalab/missense-kinase-toolkit | conftest.py | .py | 2883b2706c68a7f4 | 7.8 | 3 |
import logging
from dataclasses import dataclass
from itertools import chain
from typing import Any
import numpy as np
import py3Dmol
from bokeh.models import (
ColumnDataSource,
CustomJSTickFormatter,
FixedTicker,
Label,
)
from bokeh.models.glyphs import Rect, Text
from bokeh.plotting import figure
fr... | choderalab/missense-kinase-toolkit | missense_kinase_toolkit/app/visualizers.py | .py | 9b1f23b8d0ab97ad | 7.3 | 3 |
"""Pairwise and multiple-sequence aligner wrappers for mapping kinase sequences onto UniProt.
Wraps Clustal Omega (:class:`ClustalOmegaAligner`) and Biopython (:class:`BioAligner`)
behind a common :class:`CustomAligner` interface, with specializations for aligning
BLOSUM-based and KinCore sequences to UniProt.
"""
fr... | choderalab/missense-kinase-toolkit | missense_kinase_toolkit/databases/mkt/databases/aligners.py | .py | f52ae47b78586532 | 7.3 | 3 |
"""Client for retrieving AlphaFold structure predictions.
Provides :class:`AlphaFoldPrediction` and :class:`AlphaFoldStructure`, REST clients
that fetch AlphaFold model metadata and downloadable structure files for a given
UniProt accession.
"""
import ast
import io
import logging
from Bio.Data.PDBData import protei... | choderalab/missense-kinase-toolkit | missense_kinase_toolkit/databases/mkt/databases/alphafold.py | .py | c594cdc20ea2b1a1 | 7.3 | 3 |
"""Base API client hierarchy (Swagger, REST, GraphQL) with query and cache provenance stamping.
Defines :class:`APIClient` and its abstract subclasses (:class:`SwaggerAPIClient`,
:class:`RESTAPIClient`, :class:`GraphQLClient`, and their API-key variants), which
centralize request execution, query-datetime recording, a... | choderalab/missense-kinase-toolkit | missense_kinase_toolkit/databases/mkt/databases/api_schema.py | .py | b49586510846d898 | 7.3 | 3 |
"""Kinase-level property tables backing the Streamlit app.
Provides :class:`PropertyTables`, which assembles the property summary tables rendered
in the Streamlit app.
"""
import logging
from dataclasses import dataclass
import pandas as pd
from mkt.schema.kinase_schema import KinaseInfo
from mkt.schema.utils import... | choderalab/missense-kinase-toolkit | missense_kinase_toolkit/databases/mkt/databases/app/properties.py | .py | 1650c0291d97ae51 | 7.3 | 3 |
"""Sequence-alignment logic backing the Streamlit app.
Provides :class:`SequenceAlignment`, which computes and formats kinase sequence
alignments for display in the Streamlit app.
"""
import logging
from typing import Any
from mkt.databases.klifs import DICT_POCKET_KLIFS_REGIONS
from mkt.databases.utils import load_... | choderalab/missense-kinase-toolkit | missense_kinase_toolkit/databases/mkt/databases/app/sequences.py | .py | dcf4cce7421761d8 | 7.3 | 3 |
"""Structure visualization backing the Streamlit app.
Provides :class:`StructureVisualizer`, which builds the interactive structure views
rendered in the Streamlit app.
"""
import logging
from typing import TYPE_CHECKING, Any
from Bio.PDB.Structure import Structure
from mkt.databases.colors import map_aa_to_single_l... | choderalab/missense-kinase-toolkit | missense_kinase_toolkit/databases/mkt/databases/app/structures.py | .py | 197ae7f5362f10ee | 7.3 | 3 |
"""Helper functions for wiring structure visualization in the Streamlit app.
Includes :func:`create_structure_visualizer`, UniProt-index validation, and
color-to-hex conversion helpers used by the app.
"""
import logging
from typing import TYPE_CHECKING
import webcolors
from mkt.databases.app.sequences import Sequen... | choderalab/missense-kinase-toolkit | missense_kinase_toolkit/databases/mkt/databases/app/utils.py | .py | 1181a3a277e8b4a2 | 7.3 | 3 |
"""Client and parser for the Cancer Hotspots database.
Provides :class:`CancerHotspotsQuery` to fetch hotspot records and
:class:`CancerHotspots` to parse them, with :class:`HotspotVersion` and
:class:`HotspotTier` enumerations for versioning and tier classification.
"""
import json
import logging
from enum import En... | choderalab/missense-kinase-toolkit | missense_kinase_toolkit/databases/mkt/databases/cancer_hotspots.py | .py | 9d06cdc743e07f8e | 7.3 | 3 |
"""ChEMBL molecule-search client for resolving drug names to ChEMBL IDs and metadata.
Provides :class:`ChEMBLMoleculeSearch` and related clients plus :func:`return_chembl_id`
to map drug names/synonyms to ChEMBL identifiers and molecule records.
"""
import logging
from dataclasses import dataclass, field
from mkt.da... | choderalab/missense-kinase-toolkit | missense_kinase_toolkit/databases/mkt/databases/chembl.py | .py | 97f7c2f436eacaca | 7.3 | 3 |
#!/usr/bin/env python3
"""CLI to plot the DICT_KINASE figures from YAML-configured aesthetics.
Renders the study-independent KinaseInfo figures built from the shipped
``DICT_KINASE`` archive: the source-coverage upset plot, the combined
UniProt->KLIFS residue map with inter-/intra-region gap violins, and the KLIFS
hie... | choderalab/missense-kinase-toolkit | missense_kinase_toolkit/databases/mkt/databases/cli/plot_dict_kinase.py | .py | 485618e6230cd793 | 7.3 | 3 |
"""Processing of the Davis kinase profiling dataset.
Provides :class:`DavisDataset` and its :class:`DavisConfig`, which load and harmonize
the Davis Kd profiling data into the common dataset format.
"""
import logging
import numpy as np
import pandas as pd
from mkt.databases.chembl import ChEMBLMolecule, return_chem... | choderalab/missense-kinase-toolkit | missense_kinase_toolkit/databases/mkt/databases/datasets/davis.py | .py | c2b0b1ea1cfa9331 | 7.3 | 3 |
"""Processing of the PKIS2 kinase profiling dataset.
Provides :class:`PKIS2Dataset` and its :class:`PKIS2Config`, plus :func:`read_xlsx_file`,
to load and harmonize the PKIS2 percent-inhibition data.
"""
import pandas as pd
from mkt.databases.datasets.process import (
DatasetConfig,
ProcessDataset,
)
class ... | choderalab/missense-kinase-toolkit | missense_kinase_toolkit/databases/mkt/databases/datasets/pkis2.py | .py | 590032520d2fd2ab | 7.3 | 3 |
"""Base dataset configuration and processing pipeline for kinase profiling datasets.
Defines :class:`DatasetConfig` and the abstract :class:`ProcessDataset` pipeline shared
by the Davis, PKIS2, and DiscoverX datasets, plus helpers for building ridgeline and
stacked-barchart dataframes.
"""
import logging
from abc imp... | choderalab/missense-kinase-toolkit | missense_kinase_toolkit/databases/mkt/databases/datasets/process.py | .py | dacc53f30873a937 | 7.3 | 3 |
"""Ensembl REST client for reference-sequence and trinucleotide context.
Provides :class:`EnsemblSequence` (a single cached region fetch) plus batch and
helper functions for deriving the trinucleotide (SBS) context of genomic variants
from the Ensembl reference. The genome build selects the REST host
(:data:`DICT_ENSE... | choderalab/missense-kinase-toolkit | missense_kinase_toolkit/databases/mkt/databases/ensembl.py | .py | 2ac4338114d8d7fe | 7.3 | 3 |
"""Orchestration for the compositional KinaseInfo build pipeline.
The :class:`Pipeline` class runs ``generate_kinaseinfo_objects`` in one of three modes: a
full kinome regeneration; a partial per-source rebuild (``--only <source>``) that re-fetches
one base-build source and re-runs the dependent validators on the exis... | choderalab/missense-kinase-toolkit | missense_kinase_toolkit/databases/mkt/databases/generator/pipeline.py | .py | c015e7f58cedeed0 | 7.3 | 3 |
"""Enrichment- and report-step registries for the KinaseInfo build pipeline.
Defines the ordered registry of enrichment steps (each mutating additive optional
fields on the assembled :class:`KinaseInfo` objects in place), the terminal report
steps, and the selection/validation helpers that back the ``--only``/``--skip... | choderalab/missense-kinase-toolkit | missense_kinase_toolkit/databases/mkt/databases/generator/steps.py | .py | f781ebfcacbabfae | 7.3 | 3 |
"""Genome Nexus REST client for variant annotation and canonical transcripts.
Genome Nexus (``genomenexus.org``) is the VEP-based annotation engine behind
cBioPortal. This wraps its build-specific REST hosts
(:data:`DICT_GENOME_NEXUS_HOST`) for two uses:
- :func:`get_canonical_transcripts` -- the canonical Ensembl tr... | choderalab/missense-kinase-toolkit | missense_kinase_toolkit/databases/mkt/databases/genomenexus.py | .py | 4197aade1c144345 | 7.3 | 3 |
"""Client for the HGNC (HUGO Gene Nomenclature Committee) REST API.
Provides :class:`HGNC`, a REST client that resolves gene symbols and cross-references
via the HGNC service.
"""
import logging
from dataclasses import dataclass
import requests
from mkt.databases import requests_wrapper, utils_requests
from mkt.data... | choderalab/missense-kinase-toolkit | missense_kinase_toolkit/databases/mkt/databases/hgnc.py | .py | 1c08f4d32a659023 | 7.3 | 3 |
"""File I/O helpers for CSV/dataframe round-tripping, tar creation, and kinase-dict loading.
Includes helpers to load and save dataframes, concatenate CSVs by glob, parse iterables
into dataframes, create metadata-free tar archives, and load the packaged kinase
dictionary.
"""
import logging
import os
import tarfile
... | choderalab/missense-kinase-toolkit | missense_kinase_toolkit/databases/mkt/databases/io_utils.py | .py | 0af85901c1bd8689 | 7.3 | 3 |
"""Parsing and harmonization of KinCore FASTA and CIF structure files, aligned to UniProt.
Reads KinCore FASTA and CIF files, extracts kinase-domain metadata, aligns KinCore
sequences to UniProt, and harmonizes the FASTA- and CIF-derived records.
"""
import io
import logging
import os
import re
import zipfile
from co... | choderalab/missense-kinase-toolkit | missense_kinase_toolkit/databases/mkt/databases/kincore.py | .py | 06b73863545a66c6 | 7.3 | 3 |
"""Client for NCBI Entrez protein records.
Provides :class:`ProteinNCBI` (and the :class:`ProteinEntrez` helper) to retrieve
protein sequence and metadata from NCBI Entrez.
"""
import ast
import logging
import os.path
from dataclasses import field
from io import BytesIO, StringIO
from zipfile import ZipFile
from Bio... | choderalab/missense-kinase-toolkit | missense_kinase_toolkit/databases/mkt/databases/ncbi.py | .py | 62b6034e8eb632bb | 7.3 | 3 |
import contextlib
import typing
import builtins
import struct
import warnings
import zlib
import gzip
import lzma
@contextlib.contextmanager
def open(file: str | typing.BinaryIO):
"""
Open a Heroes III LOD file. Avoid using LodFile class directly
Args:
file (str | BinaryIO): The file as filepath o... | Laserlicht/homm3data | homm3data/lodfile.py | .py | bedc1ab643c889dd | 7.35 | 4 |
import contextlib
import typing
import builtins
import io
import zlib
import warnings
from PIL import Image
@contextlib.contextmanager
def open(file: str | typing.BinaryIO):
"""
Open a Heroes III HD PAK file. Avoid using PakFile class directly
Args:
file (str | BinaryIO): The file as filepath or f... | Laserlicht/homm3data | homm3data/pakfile.py | .py | 8c63b20712bb8469 | 7.35 | 4 |
import os
from typing import List, Optional, Union
import msal
from azure.identity import (
InteractiveBrowserCredential,
TokenCachePersistenceOptions,
AuthenticationRecord,
)
from msal_extensions import (
build_encrypted_persistence,
FilePersistence,
PersistedTokenCache,
)
_token_location = "t... | asmfstatoil/msal-bearer | src/msal_bearer/bearerauth.py | .py | d3c0745da3efcd66 | 7.15 | 1 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Get觀察名單.py
Version: 2.0
Description: Downloads Taiwan stock market observation and focus lists from GitHub repository.
1. 觀察名單.csv -> StockID_TWSE_TPEX.csv (Observation list)
2. 專注名單.csv -> StockID_TWSE_TPEX_focus.csv (Focus list)
"""
import ... | wenchiehlee/GoogleSearch.Factset | Get觀察名單.py | .py | 0de56ff0799fd003 | 7 | 0 |
#!/usr/bin/env python3
"""
Migrate files from old quarantine structure to new organized structure
From: data/quarantine/old_files/{year-month}/
To: data/quarantine/{reason}/{year-month}/
"""
import os
import sys
import re
import shutil
from pathlib import Path
from datetime import datetime
# Set UTF-8 encoding for ... | wenchiehlee/GoogleSearch.Factset | scripts/archive/migrate_quarantine.py | .py | c71a2a2f4b10bf2d | 7 | 0 |
#!/usr/bin/env python3
"""
Recalculate Quality Scores for All MD Files
Uses the new simplified formula (v3.7.0) with 0% date weight
"""
import sys
import re
from pathlib import Path
from datetime import datetime
# Add paths
sys.path.insert(0, str(Path(__file__).parent))
from process_group.quality_analyzer_simplified... | wenchiehlee/GoogleSearch.Factset | scripts/archive/recalculate_quality_scores.py | .py | 5bf8ce23c921b358 | 7 | 0 |
#!/usr/bin/env python3
"""
Restore Good Quality Files from Quarantine
Moves back files with quality_score > 6.5 from quarantine to data/md
Keeps only low-quality files (quality_score <= 6.5) in quarantine
"""
import os
import sys
import re
import shutil
from pathlib import Path
# Set UTF-8 encoding for Windows consol... | wenchiehlee/GoogleSearch.Factset | scripts/archive/restore_good_quality_files.py | .py | 3b534aa27aaef617 | 7 | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Scan all MD files for potential false positives (company code mismatches)"""
import re
import sys
from pathlib import Path
# Fix Windows console encoding
if sys.platform == 'win32':
sys.stdout.reconfigure(encoding='utf-8')
def extract_company_from_title(title_tex... | wenchiehlee/GoogleSearch.Factset | scripts/archive/scan_false_positives.py | .py | 3c9bcd56a12fc48c | 7 | 0 |
#!/usr/bin/env python3
"""
Quick Stock Verification Tool
Process and verify specific stocks only (for testing)
Usage:
python verify_stocks.py 2330 2357 # Verify specific stocks
python verify_stocks.py 2330 2357 --upload # Verify and upload to sheets
"""
import os
import sys
import argparse
fr... | wenchiehlee/GoogleSearch.Factset | scripts/archive/verify_stocks.py | .py | 312a283d18b068ce | 7 | 0 |
import re
import os
import json
from html import unescape
FILE_PATH = r"C:\Users\WJLEE\SynologyDrive\NAS\github.com\GoogleSearch.Factset\data\quarantine\inflated_quality\2025-08\2357_華碩_factset_677cedb1.md"
def clean_content(raw_content):
"""徹底清理 HTML 和 JSON 雜訊"""
# 1. 移除 YAML header
content = raw_content... | wenchiehlee/GoogleSearch.Factset | scripts/test_extraction_v2.py | .py | 7bf133cda96d45e1 | 7.5 | 0 |
#!/usr/bin/env python3
"""
Improved Search Patterns for Taiwan Stocks
Enhanced patterns that reduce false positives and improve content quality
Usage:
Use these patterns in search_cli.py for better search results
Specifically optimized for major Taiwan stocks like TSMC (2330)
"""
# ENHANCED SEARCH PATTERNS - ... | wenchiehlee/GoogleSearch.Factset | search_group/improved_search_patterns.py | .py | 8062351cf9df77d2 | 7 | 0 |
"""/ecosystem -- overview of the Ciphex product stack. identity.connect_program,
links.connect_portal, links.alpha_ams, and links.atlas_page are contract
keys that may not exist in facts.yaml yet -- every read below goes through
the standard stores.facts.get(...) + is_unknown graceful fallback.
"""
import re
from cent... | Cipherion-Market-Research/Century-Support | century_core/commands/ecosystem.py | .py | b2b94377f024ff1d | 7.3 | 3 |
"""/updates -- lists recent Ciphex Internal Updates (announcements &
official press releases) from pubs_rag's Postgres store. Reads the
`documents` table directly (schema: sha256, kind, slug, title, date,
source_url, listed_on, ingested_at -- see pubs_rag/db.py's DDL) rather than
importing pubs_rag code, since this is ... | Cipherion-Market-Research/Century-Support | century_core/commands/updates.py | .py | bfd3660965003cff | 7.3 | 3 |
"""Guardrails: pure, deterministic checks over composed response text.
Enforced structurally on every outgoing response (not just via an LLM
system prompt) so this behavior is unit-testable without a live LLM and
can't be talked around by a misbehaving or jailbroken model. Per the WP-5
brief: no purchase solicitation;... | Cipherion-Market-Research/Century-Support | century_core/guardrails.py | .py | 988ca6e556b1a459 | 7.3 | 3 |
"""Deterministic non-English input gate (live tester feedback, 2026-08-19):
a Mandarin message got a confused English reply -- the facts+RAG+LLM path
has no way to detect or handle a non-English question, so it should never
be reached at all for one. Checked FIRST in qa/router.py's answer_question,
before even the offt... | Cipherion-Market-Research/Century-Support | century_core/qa/language.py | .py | 488fb0ee106b7cf6 | 7.3 | 3 |
"""Deterministic short-circuit for greetings/smalltalk/off-topic requests
(go-live incident 2026-08-17): "write me a poem" fell through to the
facts+RAG+LLM path, which had nothing relevant to say and produced an
"I don't know" answer padded with irrelevant publication citations (see
qa/router.py's unknown-answer handl... | Cipherion-Market-Research/Century-Support | century_core/qa/offtopic.py | .py | 72fb3c58688fb7e9 | 7.3 | 3 |
"""Team-member roster: deterministic person-question routing over the
harvested leadership-team page (Sprint 3, owner-flagged regression: direct
name queries like "Who is Kevin?" were falling through to the graceful
refusal even though the answer sits verbatim on ciphex.io/leadership-team).
The leadership page's marku... | Cipherion-Market-Research/Century-Support | century_core/qa/pages_roster.py | .py | 105da23582332d23 | 7.3 | 3 |
"""Deterministic handling for total-supply questions (WP-5 brief item 4):
answers must distinguish on-chain totalSupply (1.5B, unchanged since Burn
Cycle 1 was a transfer to a dead address, not a supply-reducing call) from
effective/circulating supply (1,018,545,702 = totalSupply - burn-address
balance). Prefers live k... | Cipherion-Market-Research/Century-Support | century_core/qa/supply.py | .py | 56ce1af7c962429e | 7.3 | 3 |
"""Final guardrail gate applied to every ResponseIR right before it leaves
/v1/messages -- the single choke point, so a violation is caught
regardless of whether it originated in a command template or LLM output.
Structural checks only (solicitation/APY/price-ban) -- numeric-provenance
checking needs the actual LLM-co... | Cipherion-Market-Research/Century-Support | century_core/response_guard.py | .py | f222bd8f84a94b35 | 7.3 | 3 |
"""Shared test doubles: an in-memory fake Redis (C3 envelope shape) and a
stub-store-backed Stores fixture, so the whole suite runs without real
Redis/Postgres/OpenAI -- WP-5 acceptance: "test suite green with stubbed
stores."
"""
import json
from datetime import datetime, timezone
from typing import Dict, Optional
im... | Cipherion-Market-Research/Century-Support | century_core/tests/conftest.py | .py | 9f22c1f6c744614f | 7.8 | 3 |
"""adapter <-> core seam test (golive-p2, gap #1).
Today nothing tests the real seam between telegram_adapter and
century_core: the adapter's own suite mocks core (test_core_client.py,
test_webhook.py), and century_core's suite hand-synthesizes C1 envelopes
(test_routes.py's BASE_MESSAGE). The C1 contract is therefore... | Cipherion-Market-Research/Century-Support | century_core/tests/test_adapter_seam.py | .py | ac15f786f3234051 | 7.8 | 3 |
"""WP-5 acceptance: "all §2 critical topics answer correctly against
seeded stores." Spot-checks the audit's drift-matrix topics directly
against the real, committed facts.yaml (not a fixture) -- this is the
actual seed store the service ships with.
"""
from facts_store import default_store
from century_core import gu... | Cipherion-Market-Research/Century-Support | century_core/tests/test_critical_topics.py | .py | 734d8f5b03e15354 | 7.8 | 3 |
"""qa/facts_search.py: keyword-overlap search over facts.yaml, and the
2026-08-17 servable-facts exclusion (Config.BLOCKED_FACT_KEYS) -- these
keys exist for historical/scam-verification/audit purposes only and must
never be servable to a user, even when they'd otherwise score highest for
a query.
"""
import pytest
fr... | Cipherion-Market-Research/Century-Support | century_core/tests/test_facts_search.py | .py | 487878a7fd7f6027 | 7.8 | 3 |
# imports
import numpy as np
import pandas as pd
from collections import defaultdict
# function to treat Persons Names
def treat_names(name, pos='first'):
'''
Treat names keeping NaN as such.
Arguments:
- name (str): name to be treated.
- pos (str): name position. One of ['first', ... | aslamedeiros/Vis_Zoo | src/MNViz.py | .py | e7fa9768c8363837 | 7.15 | 1 |
import unidecode
import numpy as np
import pandas as pd
from src.MNViz import *
def get_depth(d):
'''
Treats known errors in Depth columns
'''
d = str(d)
if d.lower() == 'nan' or d.lower() == 'none':
return np.NAN
else:
return d.replace(',','.').replace('m','').strip(... | aslamedeiros/Vis_Zoo | treatment_utils.py | .py | 71a3d8dbb6c1f7c2 | 7.15 | 1 |
# -*- coding: utf-8 -*-
"""(De)serializers for the native, non-sklearn-estimator objects exposed by the
gradient-boosting libraries: xgboost.Booster, lightgbm.Booster,
lightgbm.Dataset and catboost.Pool.
None of these are fitted sklearn estimators with a plain __dict__ - each is
its own library's C++/Cython-backed ob... | OlivierBeq/ml2json | src/ml2json/boosting.py | .py | aa14ffd57bf19450 | 7.35 | 4 |
from rich import print
from rich import inspect
class ContaBancaria:
"""
Cria uma conta bancária e permite fazer saques e depósitos.
"""
def __init__(self, id, nome, saldo = 0, nacionalidade = 'BR'):
self.id = id
self.titular = nome
self.saldo = saldo
print(f"Conta {sel... | GuilhermeNCouto/Codigos-Exercicios | Exercicios/Python/Curso em video/POO/Aulas/Aula Extra - Biblioteca Rich/rich004.py | .py | 2112e6c77813209d | 7 | 0 |
# Declaração de classe
class Gafanhoto:
"""
Essa classe cria um gafanhoto, que é uma pessoa que tem nome e idade.
Para criar uma nova pessoa, use
variavel = Gafanhoto(nome, idade)
"""
def __init__(self, nome = "Desconhecido", idade = 0): # Método construtor
# Atributos de instância
... | GuilhermeNCouto/Codigos-Exercicios | Exercicios/Python/Curso em video/POO/Aulas/Fase 04 - Objetos Variáveis Evoluídas/gafanhoto.py | .py | b30a6522a71fb266 | 7 | 0 |
'''
Crie a classe Funcionario, onde podemos cadastrar nome, setor e cargo.
Crie também um método que permita ao funcionário se apresentar.
'''
from rich import print
class Funcionario:
#atributos de classe
empresa = 'Guigas.bet'
def __init__(self, nome, setor, cargo, empresa='Guigas.bet'):
... | GuilhermeNCouto/Codigos-Exercicios | Exercicios/Python/Curso em video/POO/Aulas/Fase 06 - Desafios Python POO/desafio016 - Funcionário.py | .py | 20b48ae1b5e1d7fe | 7 | 0 |
'''
Crie a classe Produto, onde podemos cadastrar nome e preço.
Crie também um método que mostre a etiqueta do produto com o nome centralizado e o preço formatado.
'''
from rich import print
from rich.panel import Panel
class Produto:
def __init__(self, nome, preco):
self.nome = nome
self.preco = p... | GuilhermeNCouto/Codigos-Exercicios | Exercicios/Python/Curso em video/POO/Aulas/Fase 06 - Desafios Python POO/desafio017 - Etiqueta.py | .py | 29ac138abaed7f8b | 7 | 0 |
'''
Crie a classe Churrasco, onde seja possível informar quantas pessoas
vão particilar e mostre quanto de carne deve ser comprado, o custo
total do churrasco e o preço por pessoa.
Consumo padrão: 400g de carne por pessoa
Preço: R$ 82,40/kg
'''
from rich import print
from rich.panel import Panel
class Churrasco:
... | GuilhermeNCouto/Codigos-Exercicios | Exercicios/Python/Curso em video/POO/Aulas/Fase 06 - Desafios Python POO/desafio018 - Análise Churrasco.py | .py | a7c3df5f2bf573cd | 7 | 0 |
'''
Crie a classe Livro, que vai simular a passagem de páginas de um livro,
considerando também se o usuário chegou ao fim da leitura.
'''
from rich import print
from time import sleep
class Livro:
def __init__(self, titulo, total_paginas):
self.titulo = titulo
self.total_paginas = total_paginas
... | GuilhermeNCouto/Codigos-Exercicios | Exercicios/Python/Curso em video/POO/Aulas/Fase 06 - Desafios Python POO/desafio019 - Livro.py | .py | b135cf8582c8f371 | 7 | 0 |
'''
Crie a classe Gamer, onde podemos cadastrar nome, nick e os jogos favoritos
de uma pessoa. Crie Também um método que permita mostrar a ficha desse gamer.
'''
from rich import print
from rich.panel import Panel
class Gamer:
def __init__(self, nome, nick):
self.nome = nome
self.nick = nick
... | GuilhermeNCouto/Codigos-Exercicios | Exercicios/Python/Curso em video/POO/Aulas/Fase 06 - Desafios Python POO/desafio020 - Gamer Ficha.py | .py | 41487022897b4f91 | 7 | 0 |
# SPDX-License-Identifier: MIT
# Copyright © 2026 Dylan Baker
from __future__ import annotations
import sys
import typing
import warnings
from pydantic import ValidationError
from flatpaker.description import load_description
if typing.TYPE_CHECKING:
from flatpaker.entry import ValidateConfig
def _emit_warning... | dcbaker/flatpaker | flatpaker/actions/validate.py | .py | cdaefb039eb0e7b0 | 7.35 | 4 |
# SPDX-License-Identifier: MIT
# Copyright © 2024-2026 Dylan Baker
from __future__ import annotations
import os
import typing
import tomlkit
from pydantic import BaseModel, Field, model_validator
if typing.TYPE_CHECKING:
from typing_extensions import Self
ExportMode = typing.Literal['none', 'repo', 'install', ... | dcbaker/flatpaker | flatpaker/config.py | .py | 7606d52283ceba6a | 7.35 | 4 |
# SPDX-License-Identifier: MIT
# Copyright © 2022-2026 Dylan Baker
"""Loader for toml descriptions."""
from __future__ import annotations
import datetime
import pathlib
import typing
import warnings
import tomlkit
from pydantic import BaseModel, Field, field_validator, model_validator
if typing.TYPE_CHECKING:
... | dcbaker/flatpaker | flatpaker/description.py | .py | 27fb9b9b0d5b0ad2 | 7.35 | 4 |
# SPDX-License-Identifier: MIT
# Copyright © 2022-2026 Dylan Baker
from __future__ import annotations
import contextlib
import hashlib
import pathlib
import shutil
import subprocess
import tempfile
import textwrap
import typing
from xml.etree import ElementTree as ET
if typing.TYPE_CHECKING:
from .description im... | dcbaker/flatpaker | flatpaker/util.py | .py | 204d0a1a8546ca78 | 7.35 | 4 |
"""
Client attribution via the shared ``X-Wherobots-Client`` header.
``X-Wherobots-Client`` is an ordered, append-only, comma-separated list of
hops modelled on ``X-Forwarded-For``: the leftmost hop is the ORIGIN client
and every component appends its own hop on the right. It lets Wherobots
services attribute a reques... | wherobots/airflow-providers-wherobots | airflow_providers_wherobots/client_attribution.py | .py | 136de68bf7551f9c | 7.3 | 3 |
"""
Hook for Wherobots' HTTP API
"""
import platform
from functools import cached_property
from typing import Any, Optional, Dict, Union
import requests
from airflow.version import version as airflow_version
from airflow.hooks.base import BaseHook
from airflow.models import Connection
from requests import PreparedReq... | wherobots/airflow-providers-wherobots | airflow_providers_wherobots/hooks/rest_api.py | .py | 73082956a1034768 | 7.3 | 3 |
"""
Hook for Wherobots' Spatial SQL API interface.
"""
from typing import Optional, Union
from airflow.providers.common.sql.hooks.sql import DbApiHook
from wherobots.db import Connection as WDBConnection, connect
from wherobots.db.constants import (
DEFAULT_SESSION_WAIT_TIMEOUT_SECONDS,
DEFAULT_READ_TIMEOUT_S... | wherobots/airflow-providers-wherobots | airflow_providers_wherobots/hooks/sql.py | .py | cb930302f2ef72f9 | 7.3 | 3 |
"""
Define the Operators for triggering and monitoring the execution of Wherobots Run
"""
import time
from enum import auto
from time import sleep
from typing import Optional, Sequence, Any, Dict, Union
from airflow.models import BaseOperator
from strenum import StrEnum
from airflow_providers_wherobots.hooks.base im... | wherobots/airflow-providers-wherobots | airflow_providers_wherobots/operators/run.py | .py | 8d7bf99940ee42da | 7.3 | 3 |
"""
Operator for firing sql queries and collect results to s3
"""
from __future__ import annotations
from typing import Sequence, Optional, Union
from airflow.providers.common.sql.hooks.sql import DbApiHook
from airflow.providers.common.sql.operators.sql import SQLExecuteQueryOperator
from wherobots.db.constants imp... | wherobots/airflow-providers-wherobots | airflow_providers_wherobots/operators/sql.py | .py | 1fe7fcfe7a445897 | 7.3 | 3 |
"""
The data models for the Wherobots API
"""
import logging
import string
from datetime import datetime
from enum import auto
from typing import Optional, List
from pydantic import BaseModel, Field, ConfigDict
from strenum import StrEnum
RUN_NAME_ALPHABET = string.ascii_letters + string.digits + "-_."
class RunSta... | wherobots/airflow-providers-wherobots | airflow_providers_wherobots/wherobots/models.py | .py | 70e6c2b24061b9ad | 7.3 | 3 |
"""
shared helper functions for tests
"""
import os
import pytest
from airflow import DAG
from airflow.models import Connection
from pytest_mock import MockerFixture
from tests.unit_tests.operators.test_run import TEST_DAG_ID, DEFAULT_START
@pytest.fixture(scope="function", autouse=True)
def test_default_conn(mock... | wherobots/airflow-providers-wherobots | tests/conftest.py | .py | 10e28805f2956ad5 | 7.8 | 3 |
"""
Test the operators in run module
"""
import datetime
import pendulum
import pytest
from airflow import DAG
from airflow.models import Connection
from airflow.utils.state import TaskInstanceState
from wherobots.db import Region, Runtime
from airflow_providers_wherobots.operators.run import WherobotsRunOperator
fr... | wherobots/airflow-providers-wherobots | tests/integration_tests/operators/test_run.py | .py | 2cee81de107ec6b9 | 7.8 | 3 |
import email.utils
import datetime
from http import HTTPStatus
import pytest
import requests
import responses
from requests.adapters import HTTPAdapter
from requests.exceptions import RetryError
from airflow_providers_wherobots.hooks.base import WherobotsRetry
@responses.activate
def test_retry_after() -> None:
... | wherobots/airflow-providers-wherobots | tests/unit_tests/hooks/test_base.py | .py | f4b546f10bd03db1 | 7.8 | 3 |
"""
Test hooks
"""
from unittest import mock
from unittest.mock import MagicMock
from airflow.models import Connection
from wherobots.db.region import Region
from wherobots.db.runtime import Runtime
from wherobots.db.session_type import SessionType
from airflow_providers_wherobots.client_attribution import (
CLI... | wherobots/airflow-providers-wherobots | tests/unit_tests/hooks/test_sql.py | .py | 1e8ca49683d70739 | 7.8 | 3 |
"""
Test operators
"""
from unittest import mock
from unittest.mock import MagicMock
from wherobots.db import Runtime
from airflow_providers_wherobots.operators.sql import WherobotsSqlOperator
def mock_wherobots_db_connection():
mock_connection = MagicMock()
mock_cursor = MagicMock(rowcount=1)
mock_con... | wherobots/airflow-providers-wherobots | tests/unit_tests/operators/test_sql.py | .py | 92b228808ec6e8d2 | 7.8 | 3 |
"""
Test the shared ``X-Wherobots-Client`` client-attribution hop.
"""
import importlib
import re
from importlib import metadata
from pytest_mock import MockerFixture
from airflow_providers_wherobots import client_attribution
from airflow_providers_wherobots.client_attribution import (
CLIENT_HOP,
UNKNOWN_VE... | wherobots/airflow-providers-wherobots | tests/unit_tests/test_client_attribution.py | .py | 72c4e649a0fd5e2a | 7.8 | 3 |
"""MAAS Site Manager operator library.
Allows MAAS clusters to enroll with Site Manager
"""
import dataclasses
import json
import logging
from collections.abc import MutableMapping
from typing import Any
import ops
# The unique Charmhub library identifier, never change it
LIBID = "f20c42b02ae6418bb92ce56f8159aea8"
... | canonical/maas-site-manager-k8s-operator | lib/charms/maas_site_manager_k8s/v0/enroll.py | .py | 3da91a8773ff45ad | 7.24 | 2 |
"""MAAS Site Manager operator library.
Allows MAAS clusters to enrol with Site Manager
"""
import dataclasses
import json
import logging
from collections.abc import MutableMapping
from typing import Any
import ops
# The unique Charmhub library identifier, never change it
LIBID = "c232507f53c34b929e1e7c2bb030d2ce"
... | canonical/maas-site-manager-k8s-operator | lib/charms/maas_site_manager_k8s/v1/enrol.py | .py | 75395df52ab5e93b | 7.24 | 2 |
# Copyright 2026 Canonical Ltd.
# See LICENSE file for licensing details.
"""Charm library for the temporal-host-info relation interface.
This library provides the TemporalHostInfoProvider and TemporalHostInfoRequirer
classes for charms that need to share Temporal server connection details
(host and port) over a Juju... | canonical/maas-site-manager-k8s-operator | lib/charms/temporal_k8s/v0/temporal_host_info.py | .py | 8c1ff99bf373b638 | 7.24 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.