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
"""Generates SLURM submission scripts for HTPolyNet runs. Author: Cameron F. Abrams <cfa22@drexel.edu> """ # #SBATCH directives emitted in this fixed order; any other key in the slurm # config dict is passed through verbatim with underscores mapped to hyphens. _KNOWN_DIRECTIVES = [ ('job_name', 'job-name')...
cameronabrams/htpolynet
src/htpolynet/external/slurm.py
.py
16f9cac8da855e00
7.77
33
"""Generate mol2 input files for constituents from SMILES strings. Two code paths are supported: * ``obabel`` — uses OpenBabel's ``--gen3d`` to embed coordinates, then renames atoms by 1-based mol2 index according to ``rename_atoms``. Always available (the container ships OpenBabel; ``htpolynet`` requires it on ...
cameronabrams/htpolynet
src/htpolynet/external/smiles_input.py
.py
bedf827441d2aa92
7.77
33
"""Handles identification of available software needed by HTPolyNet. Author: Cameron F. Abrams <cfa22@drexel.edu> """ import glob import json import logging import os import subprocess from ..utils.stringthings import my_logger logger = logging.getLogger(__name__) _ambertools = ['antechamber', 'tleap', 'parmchk2'] ...
cameronabrams/htpolynet
src/htpolynet/external/software.py
.py
533775be43672e6f
7.77
33
"""Manages bidirectional interatomic bondlists. Author: Cameron F. Abrams <cfa22@drexel.edu> """ import logging import networkx as nx import numpy as np import pandas as pd logger=logging.getLogger(__name__) class Bondlist: """ The member "B" is a dictionary keyed on atom index whose values of lists of ato...
cameronabrams/htpolynet
src/htpolynet/geometry/bondlist.py
.py
a6ce80ade2072f3f
7.77
33
"""Handles ring-piercing determinations. Author: Cameron F. Abrams <cfa22@drexel.edu> """ # Pierced rings # Cameron F. Abrams cfa22@drexel.edu # # How to use (suggested): # # 1. Create a list of rings from a coordinate snapshot: # Suppose X is an Nx3 numpy array ordered such # that each consecutive group of six ...
cameronabrams/htpolynet
src/htpolynet/geometry/ring.py
.py
76931a8e93d14584
7.77
33
"""GROMACS .gro and HTPolyNet .grx file reader/writer. Author: Cameron F. Abrams <cfa22@drexel.edu> """ import logging import os import numpy as np import pandas as pd logger = logging.getLogger(__name__) GRO_ATTRIBUTES = [ 'resNum', 'resName', 'atomName', 'globalIdx', 'posX', 'posY', 'posZ', 'velX', 'velY'...
cameronabrams/htpolynet
src/htpolynet/io/gro.py
.py
406b002254c82653
7.77
33
"""Implements a simple checkpointing scheme using a wrapper. Author: Cameron F. Abrams <cfa22@drexel.edu> """ import functools import logging import os import yaml logger=logging.getLogger(__name__) class Checkpoint: default_filename='checkpoint_state.yaml' def __init__(self,input_dict={}): self.my_...
cameronabrams/htpolynet
src/htpolynet/utils/checkpoint.py
.py
41364827c2bbefb4
7.77
33
"""Some convenient tools for handling pandas dataframes in the context of htpolynet coordinates. Author: Cameron F. Abrams <cfa22@drexel.edu> """ import logging import pandas as pd logger=logging.getLogger(__name__) def get_row_as_string(df:pd.DataFrame,attributes): """Returns the selected rows as a string, wi...
cameronabrams/htpolynet
src/htpolynet/utils/dataframetools.py
.py
f91b349dbc8fa47a
7.77
33
#!/usr/bin/env python3 """Validate and execute the published tutorial notebooks.""" from __future__ import annotations import argparse import copy import os from pathlib import Path import nbformat from nbclient import NotebookClient TUTORIAL_NOTEBOOKS = ( "01_working_with_tmol.ipynb", "02_gpu_batching.ipyn...
uw-ipd/tmol
.github/scripts/smoke_tutorial_notebooks.py
.py
6b92a9844c17bb7f
7.97
88
#!/usr/bin/env python3 import sqlite3 import argparse import json import subprocess import os import sys import copy def main(): parser = argparse.ArgumentParser( description="Convert nvprof output to Google Event Trace compatible JSON." ) parser.add_argument("filename") args = parser.parse_a...
uw-ipd/tmol
dev/bin/nvprof2json.py
.py
b24b1a6bc6073e28
7.97
88
"""Sphinx configuration for the tmol documentation.""" from __future__ import annotations import os import sys import tomllib from pathlib import Path import nbformat from docutils import nodes from sphinx.application import Sphinx DOCS_DIR = Path(__file__).resolve().parent REPO_ROOT = DOCS_DIR.parent sys.path.inse...
uw-ipd/tmol
docs/conf.py
.py
5a8f0eb3044274d4
7.97
88
""" Runtime loader for tmol's pre-compiled C++/CUDA extensions. Adapted from xformers/_cpp_lib.py. Loads the ``tmol._C`` shared library which registers all TORCH_LIBRARY ops into ``torch.ops.tmol_*`` namespaces. Usage:: from tmol._cpp_lib import _ensure_loaded _ensure_loaded() # Now torch.ops.tmol_ljlk....
uw-ipd/tmol
tmol/_cpp_lib.py
.py
f8420b73ac89b824
7.97
88
"""Helpers to choose between precompiled extensions and JIT dev mode.""" from __future__ import annotations import logging import os from tmol._cpp_lib import ( TmolExtensionIncompatibleError, TmolExtensionNotBuiltError, _ensure_loaded, ) logger = logging.getLogger(__name__) def _env_flag(name: str) -...
uw-ipd/tmol
tmol/_load_ext.py
.py
4df24b4f766c451e
7.97
88
import numpy def eye4(): """Create the identity homogeneous transform Only necessary because numpy.eye(4, dtype=numpy.float32) is strangely unsupported in numpy""" return numpy.eye(4, dtype=numpy.float32) # m = numpy.zeros((4, 4), dtype=numpy.float32) # m[0, 0] = 1 # m[1, 1] = 1 # m[...
uw-ipd/tmol
tmol/chemical/_ideal_coords.py
.py
bb6de7ecaca697f1
7.97
88
from typing import Dict, Tuple from tmol.database._yaml import safe_load import attr import cattr @attr.s(auto_attribs=True, slots=True, frozen=True) class NaTorsionGlobalParams: sdev_sugar: float sdev_chi: float sdev_backbone: Tuple[float, ...] # alpha beta gamma delta epsilon zeta weight_bb: float...
uw-ipd/tmol
tmol/database/scoring/_na_torsion.py
.py
938b5ec519f50cde
7.97
88
"""Posit Connect Cloud environment configuration and authentication. Connect Cloud is a distinct deployment target from Posit Connect and shinyapps.io. It authenticates with OAuth 2.0 against ``login.posit.cloud``, using either the device code flow (interactive) or the client credentials grant (non-interactive, for CI...
posit-dev/rsconnect-python
rsconnect/connect_cloud.py
.py
9bd5f57a21db1d8c
7.79
37
"""Detects the configuration of a Node.js environment. Given a directory containing a package.json file, this module inspects the local Node.js/npm installation and returns information needed to build the deployment manifest. """ from __future__ import annotations import json import locale import os import subproces...
posit-dev/rsconnect-python
rsconnect/environment_node.py
.py
f023259d6771694a
7.79
37
"""Detects R dependencies from a project's renv.lock file. Given a directory that contains an renv.lock lockfile, this module parses it into the R version and package metadata needed for the deployment manifest. The parse is pure: it reads only renv.lock and never invokes R or inspects locally installed R packages. Th...
posit-dev/rsconnect-python
rsconnect/environment_r.py
.py
6fbc6b33670bfbee
7.79
37
""" Git metadata detection utilities for bundle uploads """ from __future__ import annotations import subprocess from typing import Optional from urllib.parse import urlparse from .log import logger def _run_git_command(args: list[str], cwd: str) -> Optional[str]: """ Run a git command and return its outpu...
posit-dev/rsconnect-python
rsconnect/git_metadata.py
.py
b8bee9ae83cded17
7.79
37
""" Json Web Token (JWT) utilities """ from __future__ import annotations import base64 import binascii import os from datetime import datetime, timedelta, timezone from typing import Any, Optional import jwt from .exception import RSConnectException from .http_support import HTTPResponse, JsonData from .models imp...
posit-dev/rsconnect-python
rsconnect/json_web_token.py
.py
8faf7627f98a0c88
7.79
37
""" Logging wrapper and shared instance """ from __future__ import annotations import json import logging import sys from functools import partial, wraps from typing import TYPE_CHECKING, Any, Callable, Literal, Optional, Protocol, TypeVar if sys.version_info >= (3, 10): from typing import Concatenate, ParamSpec...
posit-dev/rsconnect-python
rsconnect/log.py
.py
92c3252b3766fedf
7.79
37
""" Support for detecting various information from python projects metadata. Metadata can only be loaded from static files (e.g. pyproject.toml, setup.cfg, etc.) but not from setup.py due to its dynamic nature. """ import configparser import dataclasses import pathlib import re import typing from collections.abc impo...
posit-dev/rsconnect-python
rsconnect/pyproject.py
.py
73d4f8a237aa02db
7.79
37
# The contents of this file are copied from: # https://github.com/posit-dev/py-shiny/blob/feb4cb7f872922717c39753514ae2d7fa32f10a1/shiny/express/_is_express.py from __future__ import annotations import ast import re import sys from pathlib import Path from typing import Literal, cast __all__ = ("is_express_app",) ...
posit-dev/rsconnect-python
rsconnect/shiny_express.py
.py
e3e2f5faffa53d99
7.79
37
#!/usr/bin/env python """ Environment data class abstraction that is usable as an executable module ```bash python -m rsconnect.subprocesses.inspect_environment ``` """ from __future__ import annotations import argparse import datetime import json import locale import os import tempfile import re import subprocess i...
posit-dev/rsconnect-python
rsconnect/subprocesses/inspect_environment.py
.py
f23e6f62ffb80ab3
8.29
37
""" Utility functions related to packages and versions. """ from __future__ import annotations import re from typing import NamedTuple, cast from typing import Literal import semver from .environment import Environment from .log import logger from .models import AppMode, AppModes ComparisonOperator = Literal[">="...
posit-dev/rsconnect-python
rsconnect/utils_package.py
.py
feeda72be1afd7c1
7.79
37
from __future__ import annotations import os from typing import Any, Optional import click from rsconnect.connect_cloud import is_connect_cloud_url from rsconnect.exception import RSConnectException def get_parameter_source_name_from_ctx( var_or_param_name: str, ctx: Optional[click.Context], ) -> str: ...
posit-dev/rsconnect-python
rsconnect/validation.py
.py
d5e2c11ba3f3d321
7.79
37
"""Background version update check against PyPI. Checked only on deploy commands. The latest known version is cached on disk and refreshed at most once per :data:`_CACHE_TTL_SECONDS` in a background thread, so a warm cache adds no network traffic and no latency and prints on every exit path (including fast failures). ...
posit-dev/rsconnect-python
rsconnect/version_check.py
.py
2ca52441c8385ad0
7.79
37
"""Run a scaffolded quickstart project locally and probe whether it boots. Test-internal helpers used by ``test_quickstart_per_mode_boot_smoke`` to verify that the local-run command documented for each mode (the one ``rsconnect quickstart`` prints under "To run locally:") actually starts the project. Owns: - free-por...
posit-dev/rsconnect-python
tests/_local_run.py
.py
2d32e39ac01ca282
8.29
37
import sys from typing import Iterator import pytest def _no_system_keyring() -> Iterator[None]: """Generator behind the fixture, importable so tests can drive its teardown.""" absent = object() previous = sys.modules.get("keyring", absent) sys.modules["keyring"] = None # type: ignore[assignment] ...
posit-dev/rsconnect-python
tests/conftest.py
.py
62a38185dbf50e80
8.29
37
from pathlib import Path from tempfile import NamedTemporaryFile from unittest import TestCase, mock from rsconnect.certificates import read_certificate_file from rsconnect.exception import RSConnectException class ParseCertificateFileTestCase(TestCase): def test_parse_certificate_file_ca_bundle(self): r...
posit-dev/rsconnect-python
tests/test_certificates.py
.py
f23d19b264233440
7.29
37
import contextlib import sys import types from typing import Generator, Iterator import pytest from tests.conftest import _no_system_keyring def _drain(gen: Iterator[None]) -> None: try: next(gen) except StopIteration: pass @pytest.fixture def reinstate_marker() -> Iterator[None]: # Re...
posit-dev/rsconnect-python
tests/test_conftest.py
.py
7940d40d0ee2da2f
7.29
37
""" Tests for git metadata detection and integration """ import subprocess import tempfile from pathlib import Path import pytest from rsconnect.git_metadata import ( detect_git_metadata, get_git_branch, get_git_commit, get_git_remote_url, has_uncommitted_changes, is_git_repo, normalize_g...
posit-dev/rsconnect-python
tests/test_git_metadata.py
.py
30472b67df23ad4c
8.29
37
import json import os from docutils import nodes from docutils.parsers.rst import directives from docutils.statemachine import StringList from sphinx.directives.code import CodeBlock from . import utils class HTTPExample(CodeBlock): required_arguments = 1 option_spec = { # Unused. Just to skip remov...
ProzorroUKR/openprocurement.api
docs/source/_exts/prozorro/httpexample/directives.py
.py
d49e8a1398d419af
7.7
24
import random from collections import deque from time import sleep from data import USERS, bid, tender from locust import HttpUser, constant, task TENDERS_URL = "/api/2.5/tenders" TENDER_URL = None DS_URL = "http://ds.k8s.prozorro.gov.ua/upload" # test process data BIDS = deque(maxlen=200) class User(HttpUser): ...
ProzorroUKR/openprocurement.api
loadtesting/bids.py
.py
89864c95bcd3f66e
7.2
24
import random from collections import deque from data import USERS from locust import HttpUser, constant, task PLANS_URL = "/api/2.5/plans" # test process data CREATED_PLANS = deque(maxlen=200) PLANS = deque(maxlen=10000) class User(HttpUser): wait_time = constant(0) def __init__(self, *args, **kwargs): ...
ProzorroUKR/openprocurement.api
loadtesting/consistency.py
.py
88b31b3c02d71092
7.2
24
import random from collections import deque from data import USERS from locust import HttpUser, constant, task PLANS_URL = "/api/2.5/plans" # test process data CREATED_PLANS = deque(maxlen=200) PLANS = deque(maxlen=10000) class User(HttpUser): wait_time = constant(0) def __init__(self, *args, **kwargs): ...
ProzorroUKR/openprocurement.api
loadtesting/plans.py
.py
e5efb1d5e88a56fe
7.2
24
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompany...
amazon-braket/amazon-braket-pennylane-plugin-python
src/braket/pennylane_plugin/ahs_translation.py
.py
28311997c3806a25
7.84
47
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompany...
amazon-braket/amazon-braket-pennylane-plugin-python
test/integ_tests/test_adjoint_gradient.py
.py
d1449d2005148ea5
8.34
47
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompany...
amazon-braket/amazon-braket-pennylane-plugin-python
test/integ_tests/test_batch.py
.py
d1612fee51c6b8eb
7.34
47
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompany...
amazon-braket/amazon-braket-pennylane-plugin-python
test/integ_tests/test_counts.py
.py
fea69ad2fb5c90e2
8.34
47
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompany...
amazon-braket/amazon-braket-pennylane-plugin-python
test/integ_tests/test_expval.py
.py
913c515427868d81
7.34
47
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompany...
amazon-braket/amazon-braket-pennylane-plugin-python
test/integ_tests/test_integration.py
.py
b7d725266050f7e0
8.34
47
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompany...
amazon-braket/amazon-braket-pennylane-plugin-python
test/integ_tests/test_sample.py
.py
ef3364f512ec5f8f
7.34
47
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompany...
amazon-braket/amazon-braket-pennylane-plugin-python
test/integ_tests/test_shadow_expval.py
.py
f15c3d0d1548d71e
8.34
47
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompany...
amazon-braket/amazon-braket-pennylane-plugin-python
test/integ_tests/test_state.py
.py
c81902e84895ba7d
8.34
47
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompany...
amazon-braket/amazon-braket-pennylane-plugin-python
test/integ_tests/test_tracking.py
.py
663672c6a0f8c898
8.34
47
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompany...
amazon-braket/amazon-braket-pennylane-plugin-python
test/integ_tests/test_var.py
.py
eb9ad81a7a2cc651
7.34
47
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompany...
amazon-braket/amazon-braket-pennylane-plugin-python
test/unit_tests/test_ahs_device.py
.py
5cfd939ff6a2ee64
7.34
47
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompany...
amazon-braket/amazon-braket-pennylane-plugin-python
test/unit_tests/test_ops.py
.py
78e51d4527b7e1f0
8.34
47
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompany...
amazon-braket/amazon-braket-pennylane-plugin-python
test/unit_tests/test_translation.py
.py
c269ab94b5f9a9e7
7.34
47
"""unittest tests that require a live Drupal at https://islandora.io. In most cases, the host URL, credentials, etc. are in a configuration file referenced in the test. This test file contains tests for paged content. Files islandora_tests.py, islandora_tests_paged_check.py, and islandora_tests_hooks.py also contain t...
mjordan/islandora_workbench
tests/islandora_tests_paged_content.py
.py
2ae148062c0d50d7
7.2
24
from abc import abstractmethod, ABC import os import pytest from ruamel.yaml import YAML import sys import tempfile sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from workbench_utils import get_nid_from_url_without_config, value_is_numeric """ The full hostname and scheme of the Drupal...
mjordan/islandora_workbench
tests/workbench_test_class.py
.py
4752472eeb38e92b
8.2
24
"""High-level API for alternative identifiers.""" import logging from collections.abc import Mapping from functools import lru_cache from pydantic import ValidationError from typing_extensions import Unpack from .utils import SimpleReferenceHint, _get_pi, get_version_from_kwargs from ..constants import GetOntologyKw...
biopragmatics/pyobo
src/pyobo/api/alts.py
.py
344a031644ae2257
7.94
76
"""High-level API for edges.""" import networkx as nx import pandas as pd from tqdm import tqdm from typing_extensions import Unpack from pyobo.api.names import get_ids from pyobo.api.utils import get_version_from_kwargs from pyobo.constants import ( GetOntologyKwargs, check_should_cache, check_should_for...
biopragmatics/pyobo
src/pyobo/api/edges.py
.py
5809571fa0f8ff0f
7.94
76
"""High-level API for hierarchies.""" from __future__ import annotations import logging import warnings from collections.abc import Iterable from functools import lru_cache from typing import Literal, NotRequired, cast import networkx as nx from typing_extensions import Unpack from .edges import get_edges from .nam...
biopragmatics/pyobo
src/pyobo/api/hierarchy.py
.py
52b53cfc2a8296b3
7.94
76
"""High-level API for metadata.""" import logging from functools import lru_cache from pystow.cache import CachedPydantic from typing_extensions import Unpack from ..constants import GetOntologyKwargs, check_should_force from ..getters import get_ontology from ..identifier_utils import wrap_norm_prefix from ..utils....
biopragmatics/pyobo
src/pyobo/api/metadata.py
.py
1c16701f88f3bc80
7.94
76
"""High-level API for nomenclature.""" from __future__ import annotations import logging import subprocess from collections.abc import Callable, Mapping from functools import lru_cache from typing import TypeVar import curies import pandas as pd import ssslm from pystow.cache import Cached from ssslm import LiteralM...
biopragmatics/pyobo
src/pyobo/api/names.py
.py
b9005c69cfff82d1
7.94
76
"""High-level API for properties.""" import logging from collections.abc import Mapping import pandas as pd from tqdm import tqdm from typing_extensions import Unpack from .utils import SimpleReferenceHint, _get_pi, get_version_from_kwargs from ..constants import ( GetOntologyKwargs, check_should_cache, ...
biopragmatics/pyobo
src/pyobo/api/properties.py
.py
f27678141c4f0127
7.94
76
"""High-level API for relations.""" import logging from collections.abc import Mapping from functools import lru_cache import pandas as pd from typing_extensions import Unpack from .utils import get_version_from_kwargs from ..constants import ( RELATION_COLUMNS, RELATION_ID, RELATION_PREFIX, SOURCE_I...
biopragmatics/pyobo
src/pyobo/api/relations.py
.py
f38d6c2d401ff5ac
7.94
76
"""High-level API for typedefs.""" import logging from functools import lru_cache import pandas as pd from typing_extensions import Unpack from .utils import get_version_from_kwargs from ..constants import GetOntologyKwargs, check_should_cache, check_should_force from ..getters import get_ontology from ..identifier_...
biopragmatics/pyobo
src/pyobo/api/typedefs.py
.py
1d3ba2d2497f5442
7.94
76
"""High-level API for synonyms.""" import logging import warnings from collections.abc import Callable, Mapping from functools import lru_cache import bioregistry import pandas as pd import sssom_pydantic from curies import ReferenceTuple from sssom_pydantic import SemanticMapping from sssom_pydantic.io import Cached...
biopragmatics/pyobo
src/pyobo/api/xrefs.py
.py
8719501bb59170d6
7.94
76
"""CLI for PyOBO.""" import logging import os from collections.abc import Iterable from functools import lru_cache from operator import itemgetter import click from .database import main as database_main from .lookup import lookup from .obo_lexical_review import obo_lexical_review from ..constants import GLOBAL_SKIP...
biopragmatics/pyobo
src/pyobo/cli/cli.py
.py
9ac4443b61267946
7.94
76
"""Pipeline for extracting all xrefs from OBO documents available.""" from __future__ import annotations import gzip import logging from collections.abc import Iterable from typing import cast from tqdm.auto import tqdm from typing_extensions import Unpack from ..api import ( get_edges_df, get_id_definition...
biopragmatics/pyobo
src/pyobo/cli/database_utils.py
.py
23aca0abd5530af6
7.94
76
# /// script # requires-python = ">=3.11" # dependencies = [ # "click>=8.3.1", # "obographs>=0.0.8", # "pyperclip>=1.11.0", # "robot-obo-tool>=0.0.1", # "ssslm[gilda-slim]>=0.1.3", # "tabulate>=0.9.0", # "tqdm>=4.67.3", # ] # /// """Implement lexical review for an ontology.""" from __futur...
biopragmatics/pyobo
src/pyobo/cli/obo_lexical_review.py
.py
806303a310ee0347
7.94
76
"""Constants for PyOBO.""" from __future__ import annotations import logging import re from collections.abc import Callable from pathlib import Path from typing import TYPE_CHECKING, Literal, NamedTuple, NotRequired, TypeAlias import pystow from typing_extensions import TypedDict if TYPE_CHECKING: import sssom_...
biopragmatics/pyobo
src/pyobo/constants.py
.py
a07120575aaaa04e
7.94
76
"""Utilities for handling prefixes.""" from __future__ import annotations import logging from collections.abc import Callable from functools import lru_cache, wraps from typing import Annotated, Any, ClassVar, Concatenate, ParamSpec, TypeVar import bioregistry import click from bioregistry.constants import FailureRe...
biopragmatics/pyobo
src/pyobo/identifier_utils/api.py
.py
d23d0e9f1bf9bf99
7.94
76
"""Mocks for PyOBO.""" from __future__ import annotations import unittest.mock from collections.abc import Mapping from typing import Any, TypeAlias, TypeVar from unittest import mock import pandas as pd from pyobo.constants import XREF_COLUMNS __all__ = [ "get_mock_get_xrefs_df", "get_mock_id_alts_mapping...
biopragmatics/pyobo
src/pyobo/mocks.py
.py
76ffb3c1735046b0
7.94
76
"""Use synonyms from OBO to normalize names.""" from __future__ import annotations from collections.abc import Iterable from typing import Literal, overload from typing_extensions import Unpack from .api import get_grounder from ..constants import GetOntologyKwargs from ..struct import Reference __all__ = [ "g...
biopragmatics/pyobo
src/pyobo/ner/normalizer.py
.py
39349b3f3cdae8b5
7.94
76
"""Tools for loading entry points.""" from __future__ import annotations from collections.abc import Callable, Iterable, Mapping from functools import lru_cache from typing import TYPE_CHECKING if TYPE_CHECKING: from .struct import Obo __all__ = [ "has_nomenclature_plugin", "iter_nomenclature_plugins", ...
biopragmatics/pyobo
src/pyobo/plugins.py
.py
0c9149dc4a206f4b
7.94
76
"""Resource utilities for PyOBO.""" from __future__ import annotations from collections.abc import Sequence from functools import lru_cache import click import pandas as pd from more_click import verbose_option from zenodo_client import Zenodo from .constants import ( ALTS_DATA_RECORD, ALTS_FILE, DEFINI...
biopragmatics/pyobo
src/pyobo/resource_utils.py
.py
d14797c6b85b42b4
7.94
76
"""Loading of the NCBI Taxonomy names.""" import csv import gzip from collections.abc import Mapping from functools import lru_cache from pathlib import Path import requests __all__ = [ "get_ncbitaxon_id", "get_ncbitaxon_name", "load_ncbitaxon", ] HERE = Path(__file__).parent.resolve() PATH = HERE.joinp...
biopragmatics/pyobo
src/pyobo/resources/ncbitaxon.py
.py
92484774b0f45247
7.94
76
"""Loading of the relations ontology names.""" import csv import os from collections.abc import Mapping from functools import lru_cache import requests from curies import ReferenceTuple __all__ = [ "load_ro", ] HERE = os.path.abspath(os.path.dirname(__file__)) PATH = os.path.join(HERE, "ro.tsv") URL = "http://p...
biopragmatics/pyobo
src/pyobo/resources/ro.py
.py
f8b1f5c2016b02e7
7.94
76
"""Loading of the relations ontology names.""" from __future__ import annotations import csv import os from functools import lru_cache import requests __all__ = [ "get_so_name", "load_so", ] HERE = os.path.abspath(os.path.dirname(__file__)) SO_PATH = os.path.join(HERE, "so.tsv") SO_JSON_URL = "https://gith...
biopragmatics/pyobo
src/pyobo/resources/so.py
.py
6ec012f622c2fdaf
7.94
76
"""Converter for the Antibody Registry. TODO use API https://www.antibodyregistry.org/api/antibodies?page=1&size=100 """ import logging from collections.abc import Iterable, Mapping import pandas as pd from bioregistry.utils import removeprefix from tqdm.auto import tqdm from pyobo import Obo, Reference, Term from ...
biopragmatics/pyobo
src/pyobo/sources/antibodyregistry.py
.py
19b996f6f2754d7b
7.94
76
"""Get compartments from BiGG.""" from collections.abc import Iterable from bioversions.utils import get_soup from pyobo import Obo, Reference, Term __all__ = [ "BiGGCompartmentGetter", "get_compartments", ] DATA_URL = "http://bigg.ucsd.edu/compartments/" PREFIX = "bigg.compartment" GO_MAPPING: dict[str, R...
biopragmatics/pyobo
src/pyobo/sources/bigg/bigg_compartment.py
.py
3d62e9697c1c9303
7.94
76
"""Converter for models in BiGG.""" import json import logging from collections.abc import Iterable from pyobo.resources.ncbitaxon import get_ncbitaxon_id from pyobo.struct import Obo, Term from pyobo.utils.path import ensure_path __all__ = [ "BiGGModelGetter", ] logger = logging.getLogger(__name__) URL = "http...
biopragmatics/pyobo
src/pyobo/sources/bigg/bigg_model.py
.py
9f8dd98076c2512e
7.94
76
"""Converter for BiGG.""" from collections.abc import Iterable import pandas as pd from pydantic import ValidationError from tqdm import tqdm from pyobo.sources.bigg.bigg_metabolite import _parse_dblinks, _parse_model_links, _split from pyobo.struct import Obo, Reference, Term from pyobo.struct.typedef import enable...
biopragmatics/pyobo
src/pyobo/sources/bigg/bigg_reaction.py
.py
e3948821a7b7d86b
7.94
76
""" Event aggregator for computing portfolio state from events. """ import copy from datetime import date from typing import Dict, List, Tuple from .schemas import ( CASH_EVENT_TYPES, DEFAULT_ACCOUNT, Event, EventType, ShareState, PurchaseState, EstateState, Timeline, InKindFlow, CashFlow, CashState, ) clas...
pbrissaud/suivi-bourse
app/src/events/aggregator.py
.py
d47bb3b227f71a3d
7.95
80
""" Event loader for CSV and XLSX files. """ import csv from datetime import datetime from pathlib import Path from typing import List, Optional from .schemas import Event, EventType class EventLoaderError(Exception): """Exception raised when loading events fails.""" pass class EventLoader: """Loads p...
pbrissaud/suivi-bourse
app/src/events/loader.py
.py
ad3022d68d5536db
7.95
80
""" Data schemas for the events module. """ import bisect from dataclasses import dataclass, field from datetime import date, datetime # noqa: F401 — used in dataclass field annotations (eager-evaluated on Python <3.14) from enum import Enum from typing import Dict, List, Optional, Set, Tuple, Union # Canonical acc...
pbrissaud/suivi-bourse
app/src/events/schemas.py
.py
1959ed38f60f3bf9
7.95
80
""" File watcher for hot-reload of event files. """ import threading from pathlib import Path from typing import Callable, Optional from watchdog.observers import Observer from watchdog.events import FileSystemEventHandler, FileSystemEvent class EventFileHandler(FileSystemEventHandler): """Handler for event fil...
pbrissaud/suivi-bourse
app/src/events/watcher.py
.py
48e2b52f927cdf5b
7.95
80
""" Money-weighted performance: XIRR (annualized) and TWR (time-weighted, base 100). Pure domain module: ``Timeline`` × an injected price callable → performance results. It knows nothing about InfluxDB or yfinance — the only dependency on the outside world is the ``price_at(symbol, date) -> Optional[float]`` callable....
pbrissaud/suivi-bourse
app/src/performance.py
.py
c4e3dd6482964a2e
7.95
80
""" Prometheus Exporter Module for SuiviBourse Exposes the legacy ``sb_*`` Prometheus gauges on an HTTP ``/metrics`` endpoint, kept for backward compatibility with pre-InfluxDB deployments. It runs in parallel with the InfluxDB writer and only reflects the current snapshot of each share (no historical backfill — Prome...
pbrissaud/suivi-bourse
app/src/prometheus_exporter.py
.py
e2ac56e18ea7de56
7.95
80
""" Market-aware per-symbol scheduling — pure cadence & context decisions. Mirror of ``performance.py``: no InfluxDB, no yfinance, ``now`` injected. The two functions here drive the self-rescheduling per-symbol scrape jobs in ``main.py`` without touching the outside world, so they are exhaustively testable against dic...
pbrissaud/suivi-bourse
app/src/scheduling.py
.py
e6339a8453728d8d
7.95
80
""" Shared pytest fixtures for the SuiviBourse test suite. `pytest.ini` sets ``pythonpath = src`` so tests (and this conftest) import the application modules exactly like ``app/src/main.py`` does:: import main import influxdb_writer from events import EventLoader, EventValidator, EventAggregator from ...
pbrissaud/suivi-bourse
app/tests/conftest.py
.py
66adfa27ee7ae4c8
8.45
80
""" Function in this file judge triplets, based on ground-truth embedding and possible noise patterns. """ from typing import Dict, Callable, Optional, Union from sklearn.utils import check_random_state, check_array from sklearn.metrics import pairwise import numpy as np from cblearn import utils from cblearn.dataset...
cblearn/cblearn
cblearn/datasets/_triplet_response.py
.py
7fcea087ba87f9eb
7.67
21
""" Functions in this file return sampled triplets with answers, based on an artificial embedding and noise. Usually they combine functions from _triplet_indices and _triplet_answers and are used as a high-level interface to create artificial datasets. """ import numpy as np from typing import Union from ._t...
cblearn/cblearn
cblearn/datasets/_triplet_simulation.py
.py
a55b09cedf7b220d
7.67
21
import zipfile import pytest from cblearn.datasets._material_similarity import _archive_root def _zip_with_names(path, names): with zipfile.ZipFile(path, 'w') as zf: for name in names: zf.writestr(name, 'x') return zipfile.ZipFile(path) def test_archive_root_reads_the_single_top_level_...
cblearn/cblearn
cblearn/datasets/tests/test_material_similarity.py
.py
8fee4deda8241697
8.17
21
import numpy as np import pytest from cblearn import datasets def test_make_triplets_raises(): with pytest.raises(ValueError): datasets.make_random_triplet_indices(n_objects=12, size=100000, repeat=False) def test_make_random_triplets_all(): triplets = datasets.make_random_triplet_indices(n_objects...
cblearn/cblearn
cblearn/datasets/tests/test_triplet_indices.py
.py
261a03666a3aa2d4
7.17
21
from typing import Optional import warnings import numpy as np from sklearn.base import TransformerMixin from sklearn.utils.validation import check_is_fitted from cblearn import datasets from cblearn import utils from cblearn import metrics class TripletEmbeddingMixin(TransformerMixin): def __sklearn_tags__(sel...
cblearn/cblearn
cblearn/embedding/_base.py
.py
a1928abc461ba4bf
7.67
21
import numpy as np import pytest from cblearn.datasets import make_random_triplets from cblearn.embedding import MLDS def test_mlds_rejects_multiple_components(): """ Test that MLDS rejects n_components != 1, which it cannot estimate. scikit-learn requires that __init__ stores the parameters unaltered and ...
cblearn/cblearn
cblearn/embedding/tests/test_mlds.py
.py
f4840525933609cb
7.17
21
import pytest from cblearn.embedding.wrapper._r_base import RWrapperMixin def _forget_r_state(): """ Drop the cached rpy2 handles, so the next call re-runs init_r. """ for attribute in ('robjects', 'rpackages'): if hasattr(RWrapperMixin, attribute): delattr(RWrapperMixin, attribute) @py...
cblearn/cblearn
cblearn/embedding/tests/test_r_base.py
.py
f3be10381e75e6d6
8.17
21
import pytest import numpy as np from scipy.optimize import check_grad, approx_fprime from cblearn.datasets import make_random_triplets from cblearn.embedding import STE, TSTE from cblearn.embedding._ste import _ste_x_grad @pytest.mark.parametrize('n,d', [(20, 1), (50, 2), (100, 3)]) @pytest.mark.parametrize('heavy_...
cblearn/cblearn
cblearn/embedding/tests/test_ste.py
.py
69fe9b96885db54c
8.17
21
import pytest from cblearn.embedding._torch_utils import torch_device, _torch_device_is_available def test_torch_device_auto(): """ "auto" selects cuda if and only if cuda is available. """ torch = pytest.importorskip('torch', reason='torch is not installed') expected = "cuda" if torch.cuda.is_available...
cblearn/cblearn
cblearn/embedding/tests/test_torch_utils.py
.py
bad35e7a56819b21
8.17
21
from __future__ import annotations import xml.etree.ElementTree as et from typing import Dict, List, Optional from model.jriver.formats import OutputFormat, OUTPUT_FORMATS def xpath_to_key_data_value(key_name, data_name): ''' an ET compatible xpath to get the value from a DSP config via the path /Preset/Key...
3ll3d00d/beqdesigner
src/main/python/model/jriver/codec.py
.py
8b45848459dd4e91
7.77
33
import typing import qtawesome as qta from qtpy.QtCore import QAbstractTableModel, QModelIndex, QVariant, Qt from qtpy.QtWidgets import QDialog, QPushButton, QHeaderView from sortedcontainers import SortedDict, SortedSet from mpl import NoCaretStyle from ui.delegates import CheckBoxDelegate from ui.link import Ui_lin...
3ll3d00d/beqdesigner
src/main/python/model/link.py
.py
ca03fc69e4e6d2fc
7.77
33
import logging from collections.abc import Sequence import numpy as np from qtpy.QtCore import QObject, Signal from qtpy.QtWidgets import QMainWindow from model.preferences import LOGGING_LEVEL from ui.logs import Ui_logsForm logger = logging.getLogger('log') class LogViewer(QMainWindow, Ui_logsForm): change_l...
3ll3d00d/beqdesigner
src/main/python/model/log.py
.py
46950652c2880f37
7.77
33
#!/usr/bin/env python3 """ This script creates an API key that clients can use to access contact information in Topology pages. """ import argparse import hashlib import os import pathlib import re import sys import urllib.request import uuid import xml.etree.ElementTree as ET if __name__ == "__main__" and __package...
opensciencegrid/topology
bin/make_api_key.py
.py
785345aa30e23c21
7.69
23
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Download resource and project XML data from Topology; use the data to create a JSON file (project_resource_allocation.json) for looking up resource allocations for projects. In a separate JSON file (resource_info_lookups.json), put dicts for easier lookups of common q...
opensciencegrid/topology
src/topology_cacher.py
.py
60ac2ce947358aff
7.69
23
import re import urllib import urllib.parse from collections import OrderedDict from typing import Optional, List, Dict, Tuple, Union, Set from .common import PELICAN_CACHE, PELICAN_ORIGIN, XROOTD_CACHE_SERVER, XROOTD_ORIGIN_SERVER, ParsedYaml, is_null try: from .x509 import generate_dn_hash except ImportError: #...
opensciencegrid/topology
src/webapp/data_federation.py
.py
25ab52d556e0e641
7.69
23