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
"""Dual data and motif clustering (DDMC). Contains the `DDMC` model itself — a `sklearn.mixture.GaussianMixture` subclass that jointly clusters peptides on their phosphorylation signal and their sequence motif — and `get_pspl_pssm_distances`, the helper it uses to compare cluster motifs against kinase specificity prof...
meyer-lab/DDMC
ddmc/clustering.py
.py
d9765f3d5339574f
7.15
1
"""Loaders for the mass-spec datasets bundled with the package. Contains: - `CPTAC`: the CPTAC lung cancer clinical phosphoproteomics cohort, plus accompanying clinical metadata (mutation calls, tumor/NAT status, hot/cold immune infiltration labels) used in the DDMC paper. - `EBDT`: the MCF7 kinase...
meyer-lab/DDMC
ddmc/datasets.py
.py
f55b095ce8e2434f
7.15
1
"""Shared plotting and figure-assembly helpers used across `ddmc/figures/figureM*.py`. Contains: - `getSetup` / `subplotLabel` / `overlayCartoon`: build a labeled multi-panel matplotlib figure and overlay static SVG cartoons onto it. - `genFigure`: the `fbuild` console-script entry point (see `pypr...
meyer-lab/DDMC
ddmc/figures/common.py
.py
ac999c4c524bebe7
7.15
1
""" This creates Figure 2: Validations """ import numpy as np import pandas as pd import seaborn as sns from ddmc.binomial import AAlist from ddmc.clustering import DDMC, compute_control_pssm, get_pspl_pssm_distances from ddmc.datasets import CPTAC, EBDT from ddmc.figures.common import ( getSetup, plot_cluste...
meyer-lab/DDMC
ddmc/figures/figureM3.py
.py
c7cb2c90183a3a63
7.15
1
import numpy as np import pandas as pd from bioinfokit import visuz from scipy.stats import mannwhitneyu from sklearn.linear_model import LogisticRegressionCV from statsmodels.stats.multitest import multipletests from ddmc.clustering import DDMC from ddmc.datasets import CPTAC from ddmc.figures.common import ( get...
meyer-lab/DDMC
ddmc/figures/figureM6.py
.py
c38a3a82bad946eb
7.15
1
"""Logistic Regression Model functions to predict clinical features of CPTAC patients given their clustered phosphoproteomes. Contains: - `normalize_cluster_centers`: mean-centers `DDMC` cluster centers along the patient dimension, for use as classifier features. - `get_highest_weighted_clusters`: picks ...
meyer-lab/DDMC
ddmc/logistic_regression.py
.py
5974b2536fba5f93
7.15
1
"""Mapping to Uniprot's Proteome To Generate +/-5AA p-site Motifs. Contains: - `get_proteome_name_to_seq`: parses a UniProt FASTA proteome into a `{protein name: sequence}` dictionary; used by `ddmc.datasets.EBDT`. - `get_pspls`: loads kinase specificity profiles (position-specific peptide librarie...
meyer-lab/DDMC
ddmc/motifs.py
.py
c7aaa7b6e7f3c2e2
7.15
1
"""PAM250 sequence-distance model used by `ddmc.clustering.DDMC`. Contains the `PAM250` class, which scores peptide sequences against each cluster by their average PAM250 substitution-matrix similarity to the other sequences currently assigned to that cluster, and `get_pam250_scores`, which precomputes the full pairwi...
meyer-lab/DDMC
ddmc/pam250.py
.py
125033d427b080f2
7.15
1
""" Testing file for the clustering methods by data and sequence. """ import numpy as np import pandas as pd import pytest from scipy.spatial.distance import cdist from sklearn.metrics.pairwise import cosine_similarity from sklearn.mixture import GaussianMixture from ddmc.clustering import DDMC, get_pspl_pssm_distanc...
meyer-lab/DDMC
ddmc/tests/test_cluster.py
.py
86777cd0e7a5c11e
7.65
1
# -*- coding: utf-8 -*- """ Container and membership like objects (eg, sets) https://docs.python.org/3/library/collections.abc.html#collections.abc.Container """ from ..compat import * class MembershipSet(set): """A set with all the AND, OR, and UNION operations disabled, making it really only handy for tes...
Jaymon/datatypes
datatypes/collections/container.py
.py
397c483285ddf375
7.39
5
# -*- coding: utf-8 -*- import os import subprocess from subprocess import ( #CalledProcessError, SubprocessError, TimeoutExpired, ) import sys import re import signal import time import logging from collections import deque import threading from .compat import * from .collections import Dict from .utils i...
Jaymon/datatypes
datatypes/command.py
.py
483d5a485f68882d
7.39
5
# -*- coding: utf-8 -*- import os from pathlib import Path from ...compat import * class Environ(Mapping): """Create an Environ namespace instance you would usually create this like this: environ = Environ("PREFIX_") Then you can access any environment variables with that prefix from the `...
Jaymon/datatypes
datatypes/config/environ/base.py
.py
f8a657d7b244acb8
7.39
5
# -*- coding: utf-8 -*- import string from ...token.base import Tokenizer, Token, Scanner class EnvironToken(Token): """A parsed environ variable name and value Fields each instance should have: * `.name` - the variable name * `.value` - the variable value * `.start` - the offset th...
Jaymon/datatypes
datatypes/config/environ/token.py
.py
468ea7fdbdd68c05
7.39
5
from collections import ChainMap from collections.abc import Generator from ..collections.mapping import Namespace from .environ import Environ from .parser import Config class Settings(Namespace): """A settings object that can source values locally, from the environment, or from a config file. The orde...
Jaymon/datatypes
datatypes/config/settings.py
.py
a20475d9fa8451e4
7.39
5
# -*- coding: utf-8 -*- from __future__ import unicode_literals, division, print_function, absolute_import import copy from io import IOBase from .compat import * class Deepcopy(object): """deep copy an object trying to anticipate and handle any errors The original version of this class comes from endpoints...
Jaymon/datatypes
datatypes/copy.py
.py
4ebde6cbc226329b
7.39
5
# -*- coding: utf-8 -*- import functools import inspect import re from ..compat import * from .. import logging logger = logging.getLogger(__name__) class Decorator(object): """A decorator class that you can be extended that allows you to do normal decorators with no arguments, or a decorator with argumen...
Jaymon/datatypes
datatypes/decorators/base.py
.py
a7d3628fcaca73bb
7.39
5
# -*- coding: utf-8 -*- """ https://docs.python.org/3/howto/descriptor.html """ import logging import types from ..compat import * from .base import FuncDecorator logger = logging.getLogger(__name__) class method(object): """method that can be both a classmethod and a regular method so they can have diffe...
Jaymon/datatypes
datatypes/decorators/descriptor.py
.py
6347ccb2a9784edd
7.39
5
# -*- coding: utf-8 -*- import warnings import inspect from ..compat import * from .base import FuncDecorator, Decorator class cache(FuncDecorator): """run the decorated function only once for the given arguments in python 3+ it's better to use functools.cache or functools.lru_cache if those will work f...
Jaymon/datatypes
datatypes/decorators/misc.py
.py
0ab7cc2d7bc6219a
7.39
5
import re import os import mimetypes import time from collections.abc import Generator from email.parser import Parser, BytesParser from email import message, policy, utils, parser, header from typing import Self from functools import cached_property import io from .compat import * from .string import String from .dat...
Jaymon/datatypes
datatypes/email.py
.py
cd11f8f32667cc63
7.39
5
# -*- coding: utf-8 -*- import logging from collections import defaultdict from contextlib import contextmanager from .compat import * logger = logging.getLogger(__name__) class Event(object): """An instance of this class is passed as the first argument to any callback when an event is broadcast""" def...
Jaymon/datatypes
datatypes/event.py
.py
caed551dec326a37
7.39
5
# -*- coding: utf-8 -*- from collections import OrderedDict import functools from ..compat import * from ..path import Filepath, UrlFilepath, Cachepath from ..token.abnf import ABNFParser from ..collections.mapping import Namespace from ..decorators import classproperty class TOML(object): """This is more or les...
Jaymon/datatypes
datatypes/filetypes/toml.py
.py
8f7619d4180c9ad6
7.39
5
from logging import * # allow this module as a passthrough for builtin logging from logging import ( config, root, _acquireLock, _releaseLock, ) import logging # access to stdlib if needed import sys from collections.abc import ( Mapping, Sequence, Generator, Callable, ) from typing impo...
Jaymon/datatypes
datatypes/logging.py
.py
8420fe88540ea0b8
7.39
5
# -*- coding: utf-8 -*- import re from configparser import RawConfigParser import math from .compat import * from .string import String class Shorten(object): """Converts an integer to a base58-like string and vice versa This code was used in Undrip for its link shortener and was originally written by C...
Jaymon/datatypes
datatypes/number.py
.py
e68855c6f278afde
7.39
5
# -*- coding: utf-8 -*- import time from collections import defaultdict from .compat import * from .collections import Namespace class Profile(Namespace): """This is the context object that is returned from the Profiler, it's main purpose is to allow printing of one atomic profiling session""" @property ...
Jaymon/datatypes
datatypes/profile.py
.py
04467467a34f3f59
7.39
5
# -*- coding: utf-8 -*- from __future__ import unicode_literals, division, print_function, absolute_import import subprocess import os import inspect import sys from .path import Dirpath # 9-20-2017 -- I'm still testing these with some projects trying to get # the api right and so they aren't fully integrated yet ...
Jaymon/datatypes
datatypes/service.py
.py
7b085c2c55cc051d
7.39
5
# -*- coding: utf-8 -*- from ..compat import * from ..string import String from .base import Token, Tokenizer class WordToken(Token): """This is what is returned from the Tokenizer and contains pointers to the left deliminator and the right deliminator, and also the actual token .ldelim - the delimi...
Jaymon/datatypes
datatypes/token/word.py
.py
661d90b152442ad3
7.39
5
# -*- coding: utf-8 -*- import re import itertools from .compat import * def cbany(callback, iterable): """Return True if any callback(row) of the iterable is true. If the iterable is empty, return False :param callback: callable :param iterable: Sequence :returns: bool """ for v in iter...
Jaymon/datatypes
datatypes/utils.py
.py
1f412981d288c52e
7.39
5
# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # ...
NeCTAR-RC/manuka
manuka/app.py
.py
1d8117157a309603
7.24
2
# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # ...
NeCTAR-RC/manuka
manuka/cmd/manage.py
.py
5e69a47f71412372
7.24
2
# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # ...
NeCTAR-RC/manuka
manuka/common/keystone.py
.py
fa7bc2f6d787a7e1
7.24
2
# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # ...
NeCTAR-RC/manuka
manuka/config.py
.py
221d39571f6184b7
7.24
2
# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # ...
NeCTAR-RC/manuka
manuka/migrations/env.py
.py
ebcd98716a8ca65b
7.24
2
# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # ...
NeCTAR-RC/manuka
manuka/migrations/versions/3840b8c7f97d_rename_organisation.py
.py
fe460920a6850dc4
7.24
2
# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # ...
NeCTAR-RC/manuka
manuka/migrations/versions/52e8555a0886_initial_migration.py
.py
a670213d37c3c049
7.24
2
# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # ...
NeCTAR-RC/manuka
manuka/migrations/versions/53c5ca8ba141_create_external_id_table.py
.py
82c3a53462fa8795
7.24
2
# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # ...
NeCTAR-RC/manuka
manuka/migrations/versions/b21c9807518a_add_orcid_token.py
.py
10cf5f69542ff2be
7.24
2
# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # ...
NeCTAR-RC/manuka
manuka/migrations/versions/b3a24f35f907_add_domain_idp_mapping_model.py
.py
83af43682e087cb8
7.24
2
# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # ...
NeCTAR-RC/manuka
manuka/migrations/versions/e9e502fdd76f_change_user_id_to_keystone_user_id.py
.py
b7bbf7441467bfa4
7.24
2
# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # ...
NeCTAR-RC/manuka
manuka/models.py
.py
7aef8e665c20578a
7.24
2
# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # ...
NeCTAR-RC/manuka
manuka/shib_faker.py
.py
6e0bf3cc65333085
7.24
2
# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # ...
NeCTAR-RC/manuka
manuka/tests/functional/test_login.py
.py
c0cb92368f38899a
7.74
2
#!/usr/bin/env python3 # MIT License # # Copyright (c) 2020 FABRIC Testbed # # 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 ...
fabric-testbed/CredentialManager
fabric_cm/credmgr/config/config.py
.py
6da0dd615d1be043
7
0
#!/usr/bin/env python3 # MIT License # # Copyright (c) 2020 FABRIC Testbed # # 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 ...
fabric-testbed/CredentialManager
fabric_cm/credmgr/logging/log_helper.py
.py
90a021443bae542d
7
0
import pprint import typing from fabric_cm.credmgr.swagger_server import util T = typing.TypeVar('T') class Model(object): # swaggerTypes: The key is attribute name and the # value is attribute type. swagger_types = {} # attributeMap: The key is attribute name and the # value is json key in def...
fabric-testbed/CredentialManager
fabric_cm/credmgr/swagger_server/models/base_model_.py
.py
50575329ddb881fa
7
0
#!/usr/bin/env python3 """ 5' end junction rescue figure for the RECTIFY README — v3. Design intent (per dev/figures/STYLE_GUIDE.md): - 760px wide, single panel - 3 rows: genome / read aligned (before) / read after rescue - No per-base nucleotide grids — use exon/aligned blocks at this scale - No "Problem / So...
k-roy/RECTIFY
docs/figures/generate_5prime_junction_v3.py
.py
ca863af5ceee5b44
7
0
#!/usr/bin/env python3 """ DRS poly(A) pre-trim figure for the RECTIFY README — v3. Design intent (per dev/figures/STYLE_GUIDE.md): - 760px wide, single panel, two rows (raw vs trimmed) - No three-pass detection internals; that's an implementation detail - Show: raw read = body + poly(A) + adapter stub; trimmed ...
k-roy/RECTIFY
docs/figures/generate_polya_pretrim_v3.py
.py
16f14eb131839434
7
0
""" 5' End Aggregation Module for RECTIFY. This module clusters reads by their 5' end positions (TSS) and computes gene attribution based on the 3' ends of reads. The output is a dataset suitable for: - Transcription start site (TSS) analysis - Promoter usage studies - 5' capping / transcription initiation mapping F...
k-roy/RECTIFY
rectify/core/aggregate/five_prime.py
.py
0d40ddd20b50b4b2
7
0
""" 3' End Aggregation Module for RECTIFY. This module clusters reads by their 3' end positions (CPA sites) and computes gene attribution based on the 5' ends of reads (read bodies). The output is a dataset suitable for: - Cleavage and polyadenylation site (CPA) analysis - Alternative polyadenylation (APA) studies - ...
k-roy/RECTIFY
rectify/core/aggregate/three_prime.py
.py
65ec42837c984314
7
0
#!/usr/bin/env python3 """ Preprocessing module for RECTIFY. Handles input data preparation including: - Detecting input file format (FASTQ, BAM) - Running minimap2 alignment for FASTQ files - Decompressing gzipped reference files - Index creation Author: Kevin R. Roy Date: 2026-03-18 """ import gzip import os impor...
k-roy/RECTIFY
rectify/core/align/preprocess.py
.py
a674352f8959b70c
7
0
#!/usr/bin/env python3 """ A-Tract Refiner Module This module provides the user-facing API for refining nanopore 3' end positions within A-tracts using the bundled NET-seq reference data. Usage: from rectify.core.analyze.atract_refiner import ATractRefiner # Initialize (automatically loads bundled reference)...
k-roy/RECTIFY
rectify/core/analyze/atract_refiner.py
.py
d0332af69615b04b
7
0
#!/usr/bin/env python3 """ A-Tract Deconvolution Module Deconvolves oligo-adenylation spreading artifacts to recover true CPA positions within A-tracts using the 0A point-spread-function (PSF). Key Insight: At 0A sites (no A-tract), ~54% of signal stays at the true CPA position while ~46% spreads downstream due to po...
k-roy/RECTIFY
rectify/core/analyze/deconvolution.py
.py
5c1bd8ee13b3e1ee
7
0
#!/usr/bin/env python3 """ DESeq2 Differential Expression Analysis Module Performs differential expression analysis at both gene and cluster level using pyDESeq2. Author: Kevin R. Roy Date: 2026-03-17 """ import logging from typing import Dict, List, Optional, Tuple, Union from pathlib import Path import re import n...
k-roy/RECTIFY
rectify/core/analyze/deseq2.py
.py
3f843eafe7521279
7
0
#!/usr/bin/env python3 """ Heatmap and Sample Clustering Module Creates clustered heatmaps for sample QC and visualization. Author: Kevin R. Roy Date: 2026-03-17 """ from typing import Dict, List, Optional, Tuple, Union from pathlib import Path import numpy as np import pandas as pd # Try to import visualization li...
k-roy/RECTIFY
rectify/core/analyze/heatmap.py
.py
0ab4789667fef442
7
0
import os import secrets import threading from contextlib import contextmanager from sqlalchemy import create_engine, inspect as sa_inspect, text from sqlalchemy.pool import StaticPool _engine = None _engine_lock = threading.Lock() def _build_engine(): url = os.getenv("DATABASE_URL", "sqlite:///./db/surikatajs.d...
nkalexiou/suricatajs
db/database.py
.py
f0d5775859db8bdf
7.3
3
""" Main suricatajs file. Scanner logic lives in scanner/engine.py. """ import logging import os from logging.handlers import TimedRotatingFileHandler from db.database import init_db from scanner.engine import check_target # noqa: F401 — re-exported for scheduler logger = logging.getLogger("suricatajs") def config...
nkalexiou/suricatajs
run.py
.py
fff5132997282791
7.3
3
import os # Set env vars before any app imports so SQLAlchemy and auth pick them up os.environ["DATABASE_URL"] = "sqlite://" os.environ["API_KEYS"] = "test-key" os.environ["JWT_SECRET"] = "test-jwt-secret-32-chars-minimum!!" import pytest from fastapi.testclient import TestClient from sqlalchemy import text @pytest...
nkalexiou/suricatajs
tests/conftest.py
.py
36783e8637354477
7.8
3
#!/usr/bin/env python3 """ Check that all HTTP/HTTPS links in resume.md are reachable. Connection errors are treated as failures. HTTP 4xx responses are warnings (not failures) because some sites like LinkedIn block automated requests. HTTP 5xx responses are treated as failures. """ import os import re import sys imp...
tomirish/tom.irish
scripts/build/check_links.py
.py
8f04d64bfe2015b8
7
0
#!/usr/bin/env python3 """ Convert resume.md to HTML using Jinja2 templates. Reads resume.md (single source of truth) and renders two Jinja2 templates: - index.template.html → index.html (web site) - resume.template.html → resume.html (PDF input for generate_pdf_browser.py) Usage: python3 scripts/convert_re...
tomirish/tom.irish
scripts/build/convert_resume.py
.py
26f794642ef4dbd8
7
0
#!/usr/bin/env python3 """ Validate resume.md format before the build pipeline runs. Checks for: - Required sections (Professional Summary, Work Experience, Skills, Education) - Job entries with properly formatted date ranges - Common markdown issues (tabs, unusual trailing whitespace, consecutive blank lines) Exits ...
tomirish/tom.irish
scripts/build/validate_resume.py
.py
e82a5752df10740b
7
0
#!/usr/bin/env python3 """ Generates all site icons: - assets/images/favicon.png — 256×256, crimson bg - assets/images/favicon-dark.png — 256×256, dark bg - assets/images/apple-touch-icon.png — 1024×1024, crimson bg with atomic number Deletes any existing files and rebuilds all three on every run. Twe...
tomirish/tom.irish
scripts/tools/generate_icons.py
.py
816146a16a289705
7
0
""" Unit tests for scripts/check_links.py """ import os import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'scripts', 'build')) from check_links import extract_urls def test_extracts_https_urls(): content = "See [my site](https://example.com) for details." assert extract_urls(conte...
tomirish/tom.irish
tests/test_check_links.py
.py
449968dd4e60a05b
7.5
0
import socks class SocksManager: """Socks manager class.""" def __init__(self, socks_host: str | None, socks_port: int | None) -> None: """Constructor. :Parameters: - `socks_host`: str, SOCKS5 proxy host. - `socks_port`: str, SOCKS5 proxy port. """ sel...
tropicoo/ssh-key-transmitter
src/ssh_key_transmitter/core/socks_manager.py
.py
7c1466330c5669f0
7.15
1
import logging import posixpath from collections.abc import Iterable from pathlib import Path from typing import cast import socks from paramiko import AuthenticationException from paramiko.sftp_client import SFTPClient from ssh_key_transmitter.constants import ( DEFAULT_SSH_AUTH_KEYS, DEFAULT_SSH_DIR, DE...
tropicoo/ssh-key-transmitter
src/ssh_key_transmitter/core/transmitter.py
.py
1072c6502082004a
7.15
1
#!/usr/bin/env python3 """ shasrv - Content-addressed file storage using SHA-256 deduplication. This utility creates a deduplicated storage structure where: 1. Each file is stored under its SHA256 hash in <target>/data/<sha[:2]>/<sha> 2. Symlinks are created in <target>/files/<path> pointing to the actual file 3. Mult...
jovlinger/utils
dedup/dedup.py
.py
ccba5d62f17bb78a
7.15
1
#!/usr/bin/env python3 """ Run the target script under this interpreter (the venv Python). Invoked only by ``venv-run.py`` as ``python venv-run-launch.py SCRIPT [ARGS...]``. Catches ``ModuleNotFoundError`` so we can point at ``setup-venv.sh`` instead of only a traceback (same remedy as when no venv exists: sync the en...
jovlinger/utils
extdeps/venv-run-launch.py
.py
85f279fa4e780e74
7.15
1
#!/usr/bin/env python3 """ Exec a Python script under the nearest ancestor virtualenv. Designed to be used as a shebang interpreter: #!/usr/bin/env venv-run When the kernel runs a script with that shebang, it invokes ``venv-run SCRIPT [ARGS...]``. ``venv-run`` then: 1. Resolves SCRIPT through any symlinks (so P...
jovlinger/utils
extdeps/venv-run.py
.py
c68ab10c67cb813d
7.15
1
"""Compositor ABC.""" from __future__ import annotations from abc import ABC, abstractmethod from dataclasses import dataclass from pathlib import Path from typing import Literal, Optional from imgcomp.object import Object from imgcomp.scene import Scene, as_z_list from imgcomp.surface import Surface EventKind = Li...
jovlinger/utils
imgcomp/imgcomp/compositor.py
.py
928e8ed4a5117c6e
7.15
1
"""Backward-compatible re-exports; prefer Compositor.render_png and Surface.write_png.""" from __future__ import annotations from pathlib import Path from imgcomp.compositor import Compositor from imgcomp.scene import Scene from imgcomp.surface import Surface def surface_to_png(surface: Surface, path: Path | str) ...
jovlinger/utils
imgcomp/imgcomp/export.py
.py
b01ea5efc1af877b
7.15
1
"""Pure-Python per-pixel compositor.""" from __future__ import annotations from typing import Optional from imgcomp.compositor import Compositor, PickResult from imgcomp.probe import hit_color, pick_target from imgcomp.rgba import RGBA, TRANSPARENT, src_over from imgcomp.scene import Scene, as_z_list from imgcomp.su...
jovlinger/utils
imgcomp/imgcomp/naive.py
.py
37cb9c1df2c8c9f4
7.15
1
"""Scene object ABC.""" from __future__ import annotations from abc import ABC, abstractmethod from imgcomp.rgba import RGBA class Object(ABC): """Maps center-based local pixel coordinates to color and hit tests.""" @abstractmethod def sample(self, x: float, y: float) -> RGBA: """Return straig...
jovlinger/utils
imgcomp/imgcomp/object.py
.py
a2956dc7aa5ef83c
7.15
1
"""Loaded leaf objects (non-SDF).""" from __future__ import annotations import math from pathlib import Path from typing import Sequence from imgcomp.object import Object from imgcomp.rgba import RGBA, TRANSPARENT from imgcomp.surface import ArraySurface class ImageObject(Object): """Bitmap sampled in center-b...
jovlinger/utils
imgcomp/imgcomp/primitives.py
.py
4717ae72adf0a653
7.15
1
"""Hit and color probing for naive per-pixel compositing.""" from __future__ import annotations from typing import Optional from imgcomp.object import Object from imgcomp.rgba import RGBA, modulate from imgcomp.wrappers import Color, ColorMod, Rotate, Stretch, Translate def hit_at(obj: Object, x: float, y: float) ...
jovlinger/utils
imgcomp/imgcomp/probe.py
.py
d86660b391142527
7.15
1
"""Straight RGBA helpers (non-premultiplied).""" from __future__ import annotations from typing import Tuple RGBA = Tuple[int, int, int, int] TRANSPARENT: RGBA = (0, 0, 0, 0) WHITE: RGBA = (255, 255, 255, 255) def clamp_channel(value: float) -> int: """Clamp a color channel to [0, 255].""" if value <= 0.0...
jovlinger/utils
imgcomp/imgcomp/rgba.py
.py
a629f4d000d03976
7.15
1
"""Normalize a scene root to a z-ordered object list (back to front).""" from __future__ import annotations from collections.abc import Sequence from imgcomp.object import Object Scene = Object | Sequence[Object] def as_z_list(root: Scene) -> tuple[Object, ...]: """Return scene layers ordered furthest (index ...
jovlinger/utils
imgcomp/imgcomp/scene.py
.py
72a846dd2d76e996
7.15
1
"""SDF-backed geometry objects (white fill until wrapped in Color).""" from __future__ import annotations from imgcomp.object import Object from imgcomp.rgba import TRANSPARENT, WHITE from imgcomp.sdf import ( CircleSDF, OvalSDF, RectangleSDF, SDF, ) class SDFShape(Object): """White-filled geome...
jovlinger/utils
imgcomp/imgcomp/shapes.py
.py
a3cc573f2078b309
7.15
1
"""Surface ABC and a CPU byte-buffer implementation (no numpy).""" from __future__ import annotations from abc import ABC, abstractmethod from array import array from pathlib import Path from typing import Iterable, Iterator, List, Sequence from imgcomp.rgba import RGBA, TRANSPARENT class Surface(ABC): """Muta...
jovlinger/utils
imgcomp/imgcomp/surface.py
.py
69e3e56479b0cf82
7.15
1
"""Tests for straight-alpha helpers.""" from __future__ import annotations from imgcomp.rgba import src_over def test_src_over_opaque_source_replaces_destination() -> None: assert src_over((10, 20, 30, 255), (200, 100, 50, 255)) == (200, 100, 50, 255) def test_src_over_transparent_source_keeps_destination() -...
jovlinger/utils
imgcomp/tests/test_rgba.py
.py
f2a5cbcf2fed9f1c
7.15
1
"""Tests for ArraySurface.""" from __future__ import annotations from imgcomp.rgba import TRANSPARENT from imgcomp.surface import ArraySurface def test_array_surface_round_trip_pixel() -> None: surface = ArraySurface(2, 2) surface.set_pixel(1, 0, (1, 2, 3, 4)) assert surface.get_pixel(1, 0) == (1, 2, 3,...
jovlinger/utils
imgcomp/tests/test_surface.py
.py
1bc0f131684c175d
7.65
1
#!/usr/bin/env python3 """Build utils/README.md from nested .www/blurb.md files.""" from __future__ import annotations import sys from pathlib import Path from typing import Iterator, List, Optional, Sequence UTILS_ROOT: Path = Path(__file__).resolve().parent.parent README_PATH: Path = UTILS_ROOT / "README.md" BLURB...
jovlinger/utils
lib/build-index.py
.py
56d80e7cd63a6d5d
7.15
1
#!/usr/bin/env python3 """ Command-line interface for Merkle FUSE filesystem. """ import argparse import logging import os import sys from pathlib import Path from mfusepy import FUSE from .config import load_config from .filesystem import MerkleFuseFS def setup_logging(log_level: str = "INFO") -> None: """Set...
jovlinger/utils
merklefuse/merklefuse/cli.py
.py
53ff8667ab9e2ef5
7.15
1
""" Configuration management for Merkle FUSE filesystem. """ import json import os from pathlib import Path from typing import Dict, Any DEFAULT_CONFIG = { "debug": False, "log_level": "INFO", "critical_debug_duration": 300, "data_directory": "./data", "root_file_prefix": "root_", "max_file_s...
jovlinger/utils
merklefuse/merklefuse/config.py
.py
040832aa9e16cf06
7.15
1
""" Merkle FUSE filesystem implementation. This module contains the main filesystem class that implements the FUSE interface using a merkle tree for storage. """ import os import errno import hashlib import json import time from pathlib import Path from typing import Dict, Any, Optional, List from mfusepy import Ope...
jovlinger/utils
merklefuse/merklefuse/filesystem.py
.py
67a78289d80ea508
7.15
1
""" Integration tests for filesystem operations. These tests run sequences of operations and verify the state in the test area. """ import os import tempfile import pytest from pathlib import Path from merklefuse.filesystem import MerkleFuseFS from merklefuse.config import DEFAULT_CONFIG class TestFilesystemIntegr...
jovlinger/utils
merklefuse/tests/integration/test_filesystem_operations.py
.py
83806b9c42371b91
7.65
1
""" The task is to write a Java program which reads the file, calculates the min, mean, and max temperature value per weather station, and emits the results on stdout like this (i.e. sorted alphabetically by station name, and the result values per station in the format <min>/<mean>/<max>, rounded to one fractional digi...
jovlinger/utils
misc/1brc/jovlinger.py
.py
152e412a0d2e6927
7.15
1
# This file contains legacy functions for compatibility with older downstream # tools. Internally the functions use the newer GrouperClient. import json import logging import requests from .utils import ( read_json_data, read_grouper_credentials, read_credentials, ) from .client import ( GrouperClient,...
ryanlovett/grouper-cli
grouper/grouper.py
.py
5898c73041f25b91
7
0
# vim: set et sw=4 ts=4: import os import json from dotenv import load_dotenv def has_all_keys(d, keys): return all(k in d for k in keys) def read_json_data(filename, required_keys): """Read and validate data from a json file.""" if not os.path.exists(filename): raise Exception(f"No such file: {...
ryanlovett/grouper-cli
grouper/utils.py
.py
4e80b525992570e9
7
0
#!/usr/bin/env python3 """ Tests for the subject functionality in grouper-cli. Uses pytest for testing framework. """ import pytest from unittest.mock import Mock, patch import sys import os # Add the grouper module to the path sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) from grouper import gro...
ryanlovett/grouper-cli
tests/test_subject.py
.py
f62fb4343d14cc69
7.5
0
import math from decimal import Decimal from typing import Final def _validate_numeric(op, other): # TODO: alternatively `return NotImplemented` if not isinstance(other, (int, float, Decimal)): raise TypeError(f"'{op}' not supported between instances of 'int' and '{type(other)}'") class IntInf(int):...
anentropic/python-faker-jsonschema
faker_jsonschema/utils.py
.py
ab5793e335d72fcf
7
0
"""The implementation of the js-regex library.""" import re try: import re._compiler as sre_compile import re._constants as sre_constants import re._parser as sre_parse except ImportError: import sre_compile # type: ignore[no-redef] import sre_constants # type: ignore[no-redef] import sre_pa...
anentropic/python-faker-jsonschema
js_regex/_impl.py
.py
07d5d74f86e27581
7
0
import os import random import pytest from faker import Faker from faker_jsonschema.provider import JSONSchemaProvider _DEFAULT_REPEATS_SLOW = 10 _DEFAULT_REPEATS_FAST = 50 @pytest.fixture(scope="session") def faker(record_testsuite_property): seed = int(os.getenv("SEED", random.randint(0, 9999999))) # TOD...
anentropic/python-faker-jsonschema
tests/conftest.py
.py
a30586f2f03c2629
7.5
0
from jsonschema import validate def test_jsonschema_boolean_direct(faker, repeats_for_fast): """Direct call returns a bool.""" for _ in range(repeats_for_fast): result = faker.jsonschema_boolean() assert isinstance(result, bool) def test_jsonschema_boolean_from_schema(faker, repeats_for_fast...
anentropic/python-faker-jsonschema
tests/unit/test_boolean.py
.py
a476972623bf2c3d
7.5
0
# # Copyright (c) 2016-2026 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # import json import os import requests from nfv_client.auth_types import AUTH_TYPES from nfv_client import sw_update CAFILE = os.environ.get("REQUESTS_CA_BUNDLE") STRATEGY_EXISTS = "strategy already exists." UNKNOWN_FAILURE ...
starlingx/nfv
nfv/nfv-client/nfv_client/openstack/rest_api.py
.py
7637da18706c7f26
7.3
3
# # Copyright (c) 2015-2016, 2026 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # import stevedore from nfv_common import debug from nfv_common.helpers import Singleton DLOG = debug.debug_get_logger("nfv_common.alarm.alarm_handlers") class AlarmHandlers(stevedore.enabled.EnabledExtensionManager, ...
starlingx/nfv
nfv/nfv-common/nfv_common/alarm/_alarm_handlers.py
.py
c606ea15dc7b6021
7.3
3
# # Copyright (c) 2015-2016, 2026 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # import datetime from nfv_common.alarm._alarm_handlers import AlarmHandlers from nfv_common import debug from nfv_common.helpers import coroutine from nfv_common.helpers import Singleton from nfv_common import thread fr...
starlingx/nfv
nfv/nfv-common/nfv_common/alarm/_alarm_thread.py
.py
3b2f7a525dcadab9
7.3
3
# # Copyright (c) 2015-2016, 2026 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # from datetime import datetime class AlarmStateData: """Alarm State Data.""" def __init__(self, state): self.state = state def as_dict(self): return dict.copy(self.__dict__) class AlarmT...
starlingx/nfv
nfv/nfv-common/nfv_common/alarm/objects/v1/_alarm_data.py
.py
ac0d529b080a683c
7.3
3
# # Copyright (c) 2015-2023, 2026 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # from nfv_common.helpers import Constant from nfv_common.helpers import Constants from nfv_common.helpers import Singleton class _AlarmType(Constants, metaclass=Singleton): """Alarm Type Constants.""" UNKNOWN...
starlingx/nfv
nfv/nfv-common/nfv_common/alarm/objects/v1/_alarm_defs.py
.py
f4d96d00c3b61990
7.3
3
# # Copyright (c) 2015-2016, 2026 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # import stevedore from nfv_common import debug from nfv_common.helpers import Singleton DLOG = debug.debug_get_logger("nfv_common.catalog.catalog_backend") class CatalogBackend(stevedore.named.NamedExtensionManager, ...
starlingx/nfv
nfv/nfv-common/nfv_common/catalog/_catalog_backend.py
.py
62ffc561123f566a
7.3
3
# # Copyright (c) 2015-2016, 2026 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # from nfv_common.helpers import Constant from nfv_common.helpers import Singleton class ConnectionType(metaclass=Singleton): """Connection Type Constants.""" UNKNOWN = Constant("unknown") VIRTUAL_PORT = C...
starlingx/nfv
nfv/nfv-common/nfv_common/catalog/model/_defs.py
.py
cde0ad0905fca171
7.3
3
# # Copyright (c) 2015-2016, 2026 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # import configparser from nfv_common import debug DLOG = debug.debug_get_logger("nfv_common.config") # Configuration Global used by other modules to get access to the configuration # specified in the ini file. CONF = ...
starlingx/nfv
nfv/nfv-common/nfv_common/config.py
.py
35a5065e94dba46c
7.3
3
import re import unicodedata import xml.etree.ElementTree as etree from xml.sax.saxutils import escape as _xml_escape from xml.sax.saxutils import unescape as _xml_unescape from spans_and_trees import spans_to_passages, spans_to_tree, tree_to_spans # Remove empty brackets (that could happen if the contents have been...
jakelever/bioconverters
bioconverters/utils.py
.py
e2f43229170e79c3
7
0