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 |
|---|---|---|---|---|---|---|
# RPA+FH model for single charge sequence
# Short-range interaction contributes to only the k=0 FH term
# The FH term ehs parameters follow the definition in the PRL paper
#
# Code for LCST. Of course, one needs negative ehs[0] and positive ehs[1]
#
# ver Git.1 Apr 14, 2020
# Upload to github
# ver2: Aug 27, 2019:
# ... | laphysique/Protein_RPA | f_min_solve_1p_1salt_LCST.py | .py | 94cae127020a927a | 7.45 | 7 |
"""
Async generator crawl manager: schedules each cycle's jobs concurrently.
Mix AsyncSchedulerCrawlManagerMixin IN FRONT OF GeneratorCrawlManager. set_parameters_gen() stays an
ordinary (synchronous) generator — only the scheduling becomes concurrent. Because run() is now a
coroutine, launch it with asyncio.run(...).... | scrapinghub/shub-workflow | plugins/shub-workflow-toolkit/skills/shub-workflow-crawl-managers/examples/async_generator_crawl_manager.py | .py | 477e269682a9ac17 | 7.59 | 14 |
"""
The most common crawl manager: a GeneratorCrawlManager.
You implement set_parameters_gen() — a generator yielding one dict per spider job to schedule. The
manager schedules them respecting max_running_jobs, and finishes when the generator is exhausted and
all jobs are done.
"""
import logging
from shub_workflow.c... | scrapinghub/shub-workflow | plugins/shub-workflow-toolkit/skills/shub-workflow-crawl-managers/examples/generator_crawl_manager.py | .py | 5bf2eab035a89fde | 7.59 | 14 |
"""
PeriodicCrawlManager: reschedules the SAME spider job (same args) after each one finishes, forever.
Use when you want a single spider kept continuously running. Requires loop_mode. A failed outcome
does NOT stop it (its bad_outcome_hook is a no-op); override the hooks for custom reactions.
"""
import logging
from... | scrapinghub/shub-workflow | plugins/shub-workflow-toolkit/skills/shub-workflow-crawl-managers/examples/periodic_crawl_manager.py | .py | 24281809e49f6e1f | 7.59 | 14 |
"""
A graph manager: declare a DAG of tasks in configure_workflow(), return the root task(s).
Tasks are scripts (Task) or spiders (SpiderTask); link them with add_next_task / add_wait_for.
The manager schedules each task once its dependencies are satisfied, until nothing is pending or
running. Invoke with a name and a... | scrapinghub/shub-workflow | plugins/shub-workflow-toolkit/skills/shub-workflow-graph-managers/examples/graph_manager.py | .py | 5cff1ca82881057f | 7.59 | 14 |
"""
Advanced graph features: parallel tasks, resources, outcome-based routing, and bad_outcome_hook.
- Parallelization: a Task whose command template renders N lines splits into N parallel subtasks
(task_id.0 ... task_id.N-1); successors wait for all of them.
- Resources: named semaphores that gate how many tasks of... | scrapinghub/shub-workflow | plugins/shub-workflow-toolkit/skills/shub-workflow-graph-managers/examples/parallel_and_resources.py | .py | 1e39957637d37970 | 7.59 | 14 |
"""
Delivery built as an issuer (the modern replacement for the deprecated BaseDeliverScript).
There is NO dedicated delivery class — a delivery is just an IssuerScriptWithSCJobInput configured for
the terminal stage. Which knobs you set is USE-CASE DEPENDENT (see references/migrating-from-
basedeliverscript.md); this... | scrapinghub/shub-workflow | plugins/shub-workflow-toolkit/skills/shub-workflow-issuers/examples/delivery_issuer.py | .py | c0227439ba6fa635 | 7.59 | 14 |
"""
A file-input issuer (the common mid-pipeline stage: consumer / filter / deduplicator / balancer).
Reads gzipped JSON-lines batch files from an input folder, processes/dedups items, and writes batch
files to an output folder. You usually only implement build_item_id() and set a few attributes;
IssuerScriptWithFileS... | scrapinghub/shub-workflow | plugins/shub-workflow-toolkit/skills/shub-workflow-issuers/examples/file_input_issuer.py | .py | 17d1831d0cbd93c5 | 7.59 | 14 |
"""
The accumulate-then-merge pattern for an IssuerScriptWithSCJobInput (GENERIC — not delivery-specific).
Some issuers must combine several related records read from a single input into fewer output records
(join, roll-up, reconcile, ...). Instead of issuing each raw record inline, process_item() ACCUMULATES
them; on... | scrapinghub/shub-workflow | plugins/shub-workflow-toolkit/skills/shub-workflow-issuers/examples/merge_issuer.py | .py | dd28364c9e8a2165 | 7.59 | 14 |
"""
A Scrapy-Cloud-job-input issuer (the typical first stage: a "consumer" that reads raw crawl output).
Reads items from finished SC spider jobs (selected by the `target` CLI arg: spider:/canonical:/class:),
processes them, and writes batch files. Consumed jobs are tagged CONSUMED=True so they aren't re-read.
The bas... | scrapinghub/shub-workflow | plugins/shub-workflow-toolkit/skills/shub-workflow-issuers/examples/sc_job_input_issuer.py | .py | d59aa51a6dfd102c | 7.59 | 14 |
"""
Custom check method, stats_postprocessing, and a report table.
- Any method named check_<x>(self, start_limit, end_limit) is auto-discovered and run during run() —
use it for things outside spider/script stats (filesystem counts, API quotas, queue depth, ...).
- stats_postprocessing(start, end) derives stats and... | scrapinghub/shub-workflow | plugins/shub-workflow-toolkit/skills/shub-workflow-monitors/examples/custom_check_and_report.py | .py | 00981843559cc017 | 7.59 | 14 |
"""
A typical monitor: declarative cross-job aggregation + ratios + threshold alerts.
BaseMonitor scans the spider/script jobs in a time window, aggregates stats (and log-derived stats),
computes ratios, and raises alerts via a stat hook. Mix an alert backend (SlackMixin / SentryMixin)
IN FRONT of BaseMonitor so queue... | scrapinghub/shub-workflow | plugins/shub-workflow-toolkit/skills/shub-workflow-monitors/examples/monitor.py | .py | 8f7fed97f27f0d97 | 7.59 | 14 |
"""
An asyncio-based loop script: mix BaseLoopScriptAsyncMixin IN FRONT OF BaseLoopScript and make
workflow_loop a coroutine. Use when a cycle schedules/awaits many things concurrently.
Note the entry point: run() is now a coroutine, so launch it with asyncio.run(...).
"""
import asyncio
import logging
from shub_work... | scrapinghub/shub-workflow | plugins/shub-workflow-toolkit/skills/shub-workflow-scripts/examples/async_loop_script.py | .py | 199eead305e4318c | 7.59 | 14 |
"""
A BaseLoopScript: repeats work on an interval / runs continuously until told to stop.
You implement workflow_loop() (one cycle); run() is provided and drives the loop. Use for
schedulers, consumers, long-running managers.
"""
import logging
from shub_workflow.script import BaseLoopScript
LOG = logging.getLogger(... | scrapinghub/shub-workflow | plugins/shub-workflow-toolkit/skills/shub-workflow-scripts/examples/loop_script.py | .py | 61181d994129d757 | 7.59 | 14 |
"""
A one-shot BaseScript: parse args, do the work in run(), exit.
The default choice for a Scrapy Cloud script — including scripts that only *operate on* SC
(scan/query jobs, schedule spiders) and may run locally against a project.
"""
import logging
from shub_workflow.script import BaseScript
LOG = logging.getLogg... | scrapinghub/shub-workflow | plugins/shub-workflow-toolkit/skills/shub-workflow-scripts/examples/plain_script.py | .py | 17d36db51fae8f96 | 7.59 | 14 |
"""
The project-base-mixin pattern.
Projects usually centralize shared CLI options and helpers in ONE mixin, then every concrete script
inherits `class X(ProjectMixin, BaseScript)`. The mixin inherits the typing-only Protocol
(BaseScriptProtocol) — NOT BaseScript — so it can call/typecheck base methods without re-inhe... | scrapinghub/shub-workflow | plugins/shub-workflow-toolkit/skills/shub-workflow-scripts/examples/project_base_mixin.py | .py | e8656a4e1b13d619 | 7.59 | 14 |
import logging
from pprint import pformat
from scrapy.signals import item_scraped
from shub_workflow.script import BaseScriptProtocol
LOGGER = logging.getLogger(__name__)
class ItemHSIssuerMixin(BaseScriptProtocol):
"""
A class for allowing to issue items on hubstorage, so a script running on SC can retur... | scrapinghub/shub-workflow | shub_workflow/contrib/hubstorage.py | .py | 1764890096105760 | 7.59 | 14 |
import abc
import time
import asyncio
import logging
import warnings
from collections import defaultdict
from typing import Generator, List, Tuple, Protocol, Union, Type, Dict
from scrapinghub.client.jobs import Job
from scrapy import Item
from shub_workflow.script import BaseLoopScript, BaseScriptProtocol
from shub_... | scrapinghub/shub-workflow | shub_workflow/deliver/base.py | .py | 3d4cab7bcc90e223 | 7.59 | 14 |
import logging
import shlex
import abc
from fractions import Fraction
from typing import NewType, List, Dict, Optional, Union, Literal, Callable, Protocol
from typing_extensions import TypedDict, NotRequired
from jinja2 import Template
from shub_workflow.script import JobKey
from shub_workflow.base import WorkFlowMan... | scrapinghub/shub-workflow | shub_workflow/graph/task.py | .py | d6c0c7ff61861ff0 | 7.59 | 14 |
import re
from typing import List, Tuple, Optional, cast, Literal
from shub_workflow.base import WorkFlowManager
from shub_workflow.script import JobKey
_SCHEDULED_RE = re.compile(r"Scheduled (?:(task|spider) \"(.+?)\" \()?.*?(\d+/\d+/\d+)\)?", re.I)
def _search_scheduled_line(txt: str) -> Optional[Tuple[str, str, ... | scrapinghub/shub-workflow | shub_workflow/graph/utils.py | .py | ce39d8da05908d16 | 7.59 | 14 |
import logging
import json
import os
import hashlib
from typing import Optional
from scrapy.settings import BaseSettings
from tenacity import retry, retry_if_exception_type, before_sleep_log, stop_after_attempt, wait_fixed
from scrapinghub.client.exceptions import ServerError
from requests.exceptions import ReadTimeou... | scrapinghub/shub-workflow | shub_workflow/utils/__init__.py | .py | 44a78f0282b761d0 | 7.59 | 14 |
import logging
from typing import List, Callable
from shub_workflow.script import BaseScript
LOG = logging.getLogger(__name__)
class AlertSenderMixin(BaseScript):
"""
A class for adding slack alert capabilities to a shub_workflow class.
"""
default_subject = "No Subject"
def __init__(self):
... | scrapinghub/shub-workflow | shub_workflow/utils/alert_sender.py | .py | 705ae4d1cc4d6019 | 7.59 | 14 |
#!/usr/bin/env python
import os
import abc
import tempfile
from typing import Union
from typing import Container
from typing_extensions import Protocol
from sqlitedict import SqliteDict
class DupesFilterProtocol(Protocol, Container[str]):
@abc.abstractmethod
def add(self, elem: str):
...
@abc.ab... | scrapinghub/shub-workflow | shub_workflow/utils/dupefilter.py | .py | 99792e3f9e9aab91 | 7.59 | 14 |
from random import randint
from sys import stderr
from typing import TextIO, cast
from .node import Node
class Graph:
"""
The Graph class. Can have multiple root nodes; and it suffices
for objects of this class to only keep track of the root nodes.
The actual graph is defined by recursively followin... | chaturv3di/absynthe | absynthe/cfg/graph.py | .py | 8b686dacc4ce41aa | 7.48 | 8 |
# Imports for LoggerNode
from abc import abstractmethod
from importlib import import_module
from random import randint
from sys import stderr
from .node import Node
class LoggerNode(Node):
"""
An abstract wrapper class that provides the additional functionality of
generating actual log messages. This cl... | chaturv3di/absynthe | absynthe/cfg/logger_node.py | .py | d69801de36109786 | 7.48 | 8 |
from abc import ABC
from importlib import import_module
from random import randint
from absynthe.cfg import BinomialNode, LoggerNode
class Utils(ABC):
"""
Utility methods for Nodes
"""
# Node module
LOGGER_NODE_MODULE = import_module("absynthe.cfg.logger_node")
@staticmethod
def generat... | chaturv3di/absynthe | absynthe/cfg/utils.py | .py | 68c770762e6b1ac6 | 7.48 | 8 |
# -*- coding: utf-8 -*-
# (C) Copyright IBM Corp. 2022.
"""
Integration test code to execute Webhooks
"""
import os
import unittest
from dotenv import load_dotenv, find_dotenv
from ibm_cloud_networking_services import AlertsV1
from ibm_cloud_networking_services import WebhooksV1
configFile = "cis.env"
# load the .e... | IBM/networking-python-sdk | test/integration/test_alerts_v1.py | .py | c5f32515c7d3be9d | 7.92 | 6 |
# -*- coding: utf-8 -*-
# (C) Copyright IBM Corp. 2020.
"""
Integration test code to execute cis ip api functions
"""
import os
import unittest
from dotenv import load_dotenv, find_dotenv
from ibm_cloud_networking_services.cis_ip_api_v1 import CisIpApiV1
configFile = "cis.env"
# load the .env file containing your en... | IBM/networking-python-sdk | test/integration/test_cis_ip_api_v1.py | .py | dfe66ddef66837ae | 7.92 | 6 |
# -*- coding: utf-8 -*-
# (C) Copyright IBM Corp. 2020.
"""
Advanced Custom Pages integration test
"""
import os
import unittest
from dotenv import load_dotenv, find_dotenv
from ibm_cloud_networking_services.custom_pages_v1 import CustomPagesV1
configFile = "cis.env"
# load the .env file containing your environment... | IBM/networking-python-sdk | test/integration/test_custom_pages_v1.py | .py | 9860e3e745fefa28 | 7.92 | 6 |
"""Ablation: does the cost-filter + cluster-before-outlier fix matter on real data?
Compares the current identifiability_analysis pipeline (cost filter -> cluster -> outlier, scoped
to the dominant cluster) against a faithful reconstruction of the pre-fix order (outlier removal on
the raw multistart estimates, THEN cl... | drojasd/GSUA-CSB | python/paper_experiments/ablation_pipeline_ordering.py | .py | 69605d61144cc9fc | 7.45 | 7 |
"""Correlation-penalized, margin-normalized cost functions.
Python port of ``gsua_costf``/``gsua_rcostf``/``gsua_costfMulti``/``gsua_likecost``/
``gsua_covmetric``. All share the same shape: a shape-normalized MSE penalized by how well the
*shape* (correlation) of the candidate matches the reference, so a flat/rescale... | drojasd/GSUA-CSB | python/src/gsua_csb/_costs.py | .py | e27c4f293043ee8c | 7.45 | 7 |
"""Parameter estimation: the Python replacement for ``gsua_pe``.
MATLAB's ``gsua_pe`` dispatches across seven MATLAB optimizers (``lsqcurvefit``, ``lsqnonlin``,
``ga``, ``particleswarm``, ``patternsearch``, ``surrogateopt``, ``simulannealbnd``, ``fmincon``)
behind one ``'solver'`` string, repeats the estimation ``N`` ... | drojasd/GSUA-CSB | python/src/gsua_csb/_estimation.py | .py | 378ff4030f782e97 | 7.45 | 7 |
"""Shared batch-evaluation helpers for the Monte-Carlo-based analyses (SA, UA, MCF, ...).
Every one of these analyses runs a model over many parameter sets and needs the result collapsed
to a consistent (N, Nd) shape regardless of whether the underlying ``Model`` is scalar-output,
single time-series, or multi-state --... | drojasd/GSUA-CSB | python/src/gsua_csb/_evalutils.py | .py | b7fd5b7c03ef70d0 | 7.45 | 7 |
"""Model abstraction: the Python replacement for the MATLAB toolbox's table+CustomProperties hack.
The MATLAB toolbox stores a model's callable ("Solver"), its domain, its output selection, and
whether each factor is fixed as ``CustomProperties`` bolted onto a plain ``table`` via ``addprop``,
then dispatches on an int... | drojasd/GSUA-CSB | python/src/gsua_csb/_model.py | .py | ec9ff6f3d1faad0f | 7.45 | 7 |
"""Noise-calibrated fit-acceptance threshold: the Python replacement for
``res < 1.5*res(1)``/``lims = sum(res < 1.5*res(1))``.
MATLAB equivalent: ``gsua_noisefloor`` (no prior MATLAB toolbox equivalent existed either -- this
is new capability, ported from Python back to MATLAB and Python together in the same pass).
... | drojasd/GSUA-CSB | python/src/gsua_csb/_noisefloor.py | .py | fac35324bc42f810 | 7.45 | 7 |
"""Plotting: the Python replacement for ``gsua_plot``.
MATLAB's ``gsua_plot`` is a single function dispatched on a ``plot_type`` string with a variable,
positional argument list whose meaning changes per case (``gsua_plot('Bar', T, S)`` vs.
``gsua_plot('Bar', T, S, t, tref)`` are different plots entirely). This module... | drojasd/GSUA-CSB | python/src/gsua_csb/_plotting.py | .py | 5edf50118e6790cd | 7.45 | 7 |
"""Distribution-free statistics used by identifiability analysis.
Python port of ``gsua_medianCI`` and ``gsua_depth``.
"""
from __future__ import annotations
import numpy as np
from numpy.typing import ArrayLike, NDArray
from scipy.stats import binom, rankdata
def median_ci(x: ArrayLike, alpha: float = 0.05) -> tu... | drojasd/GSUA-CSB | python/src/gsua_csb/_stats.py | .py | eb9cd7a82b8f57c9 | 7.45 | 7 |
"""Symbolic-ODE models: SymPy for the system, ``scipy.integrate.solve_ivp`` for numeric solving.
Python port of ``gsua_dpmat`` + ``gsua_odefun``. Replaces MATLAB's mass-matrix extraction and the
bundled fixed-step ``ode4`` Runge-Kutta integrator: ``solve_ivp`` already provides both adaptive
(``"RK45"``, the ``ode45`` ... | drojasd/GSUA-CSB | python/src/gsua_csb/_symbolic.py | .py | 417801958ed130d3 | 7.45 | 7 |
"""Uncertainty analysis and Monte Carlo filtering: the Python replacement for ``gsua_ua``/``gsua_MCF``.
MATLAB's ``gsua_ua`` is a thin wrapper: it runs the model over every row of a design matrix (via
``gsua_pardeval``) and immediately hands the result to ``gsua_plot``/``gsua_MCF`` for plotting --
there is no separate... | drojasd/GSUA-CSB | python/src/gsua_csb/_uncertainty.py | .py | 04989fe9ffd7aff7 | 7.45 | 7 |
"""Tests for parse_sbml/load_petab against real PEtab benchmark problems.
Test data in tests/data/petab/ is vendored (not fetched at test time) from
https://github.com/Benchmarking-Initiative/Benchmark-Models-PEtab (BSD-3-Clause): systems-biology
problems Perelson_Science1996 and Boehm_JProteomeRes2014, and epidemiolo... | drojasd/GSUA-CSB | python/tests/test_petab.py | .py | 24b007ea44a598e0 | 7.95 | 7 |
import threading
from collections import defaultdict
from typing import Callable, Dict, Iterable, List, Optional, Tuple
from . import n
from .n import FileId
from .page import Page
from .util import CancelledException
class FileIdStack:
"""A stack which tracks file inclusion history, allowing a postprocessor
... | mongodb/snooty-parser | snooty/eventparser.py | .py | 6b0b4c318b429e64 | 7.66 | 20 |
import dataclasses
import errno
import logging
import os
import re
from dataclasses import dataclass, field
from pathlib import Path
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
Generic,
Iterable,
Iterator,
List,
Match,
MutableSequence,
Optional,
Sequence,
... | mongodb/snooty-parser | snooty/gizaparser/nodes.py | .py | 94c1a1ae4e5681cf | 7.66 | 20 |
from pathlib import Path
from ..diagnostics import ErrorParsingYAMLFile, GitMergeConflictArtifactFound
from ..n import FileId
from ..util_test import make_test
def test_yaml_with_read_error() -> None:
"""Ensure that read errors get properly propagated from YAML files."""
with make_test(
{
... | mongodb/snooty-parser | snooty/gizaparser/test_domain.py | .py | 8d40042d67e28a1f | 7.16 | 20 |
from dataclasses import dataclass
from pathlib import Path
from typing import Dict, List, Optional
from ..diagnostics import Diagnostic
from ..n import FileId
from ..types import ProjectConfig
from . import nodes
from .release import GizaReleaseSpecificationCategory
@dataclass
class Child:
foo: str
@dataclass
... | mongodb/snooty-parser | snooty/gizaparser/test_nodes.py | .py | 0615e264d1f59a51 | 8.16 | 20 |
"""Intersphinx inventories allow different Sphinx projects to refer to targets
defined in other projects, and export their targets to other projects.
This module is responsible for loading and parsing these inventories."""
import datetime
import logging
import re
import zlib
from dataclasses import dataclass, f... | mongodb/snooty-parser | snooty/intersphinx.py | .py | 3cfac0cef1b85455 | 7.66 | 20 |
import hashlib
from dataclasses import dataclass, field
from typing import List, Optional, Set
from . import n
from .diagnostics import Diagnostic
from .n import FileId
from .target_database import EmptyProjectInterface, ProjectInterface
from .types import Facet, StaticAsset
from .util import FileCacheMapping
class ... | mongodb/snooty-parser | snooty/page.py | .py | 9cef53ad710f4e00 | 7.66 | 20 |
"""Parser for a TOML spec file containing definitions of all supported reStructuredText
directives and roles, and what types of data each should expect."""
from __future__ import annotations
import dataclasses
import logging
from dataclasses import dataclass, field
from datetime import datetime
from enum import Enum
... | mongodb/snooty-parser | snooty/specparser.py | .py | c4e93d16ae37b578 | 8.16 | 20 |
import copy
import enum
import itertools
import logging
import re
import threading
import urllib
from collections import defaultdict
from dataclasses import dataclass, field
from typing import (
DefaultDict,
Dict,
Iterable,
List,
NamedTuple,
Optional,
Sequence,
Tuple,
Union,
)
impor... | mongodb/snooty-parser | snooty/target_database.py | .py | ee3dd8abc186c6c7 | 7.66 | 20 |
import pytest
from .diagnostics import Diagnostic, UnexpectedIndentation
from .language_server import DiagnosticSeverity
from .tinydocutils.frontend import OptionParser
def test_diagnostics() -> None:
diagnostic = UnexpectedIndentation((0, 0), 10)
assert isinstance(diagnostic, UnexpectedIndentation)
asse... | mongodb/snooty-parser | snooty/test_diagnostic.py | .py | fa6e4488a46258e9 | 7.16 | 20 |
import os
import shutil
from pathlib import Path
import requests
from pytest import raises
from . import n
from .diagnostics import FetchError
from .intersphinx import Inventory, TargetDefinition, fetch_inventory
from .n import FileId
from .parser import Project
from .target_database import TargetDatabase
from .test_... | mongodb/snooty-parser | snooty/test_intersphinx.py | .py | 5940d9d8b245abc8 | 7.16 | 20 |
import os
import sys
import time
from dataclasses import dataclass
from pathlib import Path
from typing import Dict, List
import pytest
from . import language_server
from .diagnostics import DocUtilsParseError, InvalidTableStructure
from .flutter import check_type, checked
from .n import FileId, SerializableType
from... | mongodb/snooty-parser | snooty/test_language_server.py | .py | 7c5259eddf08a525 | 8.16 | 20 |
from pathlib import Path
import pytest
from . import n
from .n import FileId
from .parser import Project
from .test_project import Backend
from .types import BuildIdentifierSet
from .util_test import check_ast_testing_string
@pytest.fixture
def backend() -> Backend:
backend = Backend()
build_identifiers: Bu... | mongodb/snooty-parser | snooty/test_mongodb_domain.py | .py | da9391b7a7dab66a | 7.16 | 20 |
import shutil
import tempfile
from collections import defaultdict
from dataclasses import dataclass, field
from pathlib import Path, PurePath
from typing import DefaultDict, Dict, List
import pytest
from .diagnostics import (
ConstantNotDeclared,
Diagnostic,
DocUtilsParseError,
GitMergeConflictArtifac... | mongodb/snooty-parser | snooty/test_project.py | .py | bfeddd4e59d22c37 | 7.16 | 20 |
class CILookup:
"""
Wrapper around a dictionary that allows case-insensitve lookups
"""
def __init__(self, wrapped):
self.__wrapped = wrapped
self.__keymap = {}
for key in wrapped.keys():
self.__keymap[key.casefold()] = key
def __getitem__(self, key):
rea... | TanninOne/keypirinha-allmygames | src/lib/util/CILookup.py | .py | f3fe87742881c10a | 7.6 | 15 |
from winreg import EnumKey
class RegKeyIter:
"""
convenience tool to iterate through registry keys
"""
def __init__(self, base_key):
self.__base_key = base_key
def __iter__(self):
self.__idx = 0
return self
def __next__(self):
try:
next_name = Enu... | TanninOne/keypirinha-allmygames | src/lib/util/RegKeyIter.py | .py | 4b03d33eb613666b | 7.1 | 15 |
import keypirinha as kp
class RepoContext:
def __init__(self, plugin: kp.Plugin, id: str):
""" Proxy for the kp.Plugin object passed to the individal repository implementations
Arguments:
plugin {[kp.Plugin]} -- The plugin to wrap
id {[string]} -- ID of the repository this ... | TanninOne/keypirinha-allmygames | src/lib/util/RepoContext.py | .py | dc74c5611855a304 | 7.6 | 15 |
# See the NOTICE file distributed with this work for additional information
# regarding copyright ownership.
#
# 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/L... | Ensembl/ensembl-py | src/python/ensembl/ncbi_taxonomy/models.py | .py | cfbfa205aaa911a8 | 7.42 | 6 |
# See the NOTICE file distributed with this work for additional information
# regarding copyright ownership.
#
# 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/L... | Ensembl/ensembl-py | src/python/ensembl/xrefs/xref_source_db_model.py | .py | fa6c89b818803f3c | 7.42 | 6 |
# See the NOTICE file distributed with this work for additional information
# regarding copyright ownership.
#
# 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/L... | Ensembl/ensembl-py | src/python/tests/core/compare_core_model.py | .py | fc4d488d8631f039 | 7.92 | 6 |
#!/usr/bin/python3
from __future__ import print_function
import argparse
from datetime import date
import json
import logging
import re
import sys
import requests
from requests_kerberos import HTTPKerberosAuth
from tabulate import tabulate
from freshmaker import conf
from lightblue.service import LightBlueService
fro... | redhat-exd-rebuilds/freshmaker | contrib/get_freshmaker_stats.py | .py | 78cb965b42fef5c4 | 7.5 | 9 |
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Red Hat, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modi... | redhat-exd-rebuilds/freshmaker | freshmaker/api_utils.py | .py | 2d76b4189e028034 | 7.5 | 9 |
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Red Hat, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modi... | redhat-exd-rebuilds/freshmaker | freshmaker/auth.py | .py | 7cf8667d38f3fa07 | 7.5 | 9 |
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Red Hat, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modi... | redhat-exd-rebuilds/freshmaker | freshmaker/consumer.py | .py | deb2a92341181921 | 7.5 | 9 |
# -*- coding: utf-8 -*-
# Copyright (c) 2022 Red Hat, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modi... | redhat-exd-rebuilds/freshmaker | freshmaker/container.py | .py | 89fd03d551a54b65 | 7.5 | 9 |
# Copyright (c) 2017 Red Hat, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distr... | redhat-exd-rebuilds/freshmaker | freshmaker/errors.py | .py | 49e3a99bf4aef17f | 7.5 | 9 |
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Red Hat, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modi... | redhat-exd-rebuilds/freshmaker | freshmaker/handlers/internal/cancel_event_on_freshmaker_manage_request.py | .py | a4fdf1666e1b075b | 7.5 | 9 |
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Red Hat, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modi... | redhat-exd-rebuilds/freshmaker | freshmaker/handlers/internal/update_db_on_odcs_compose_fail.py | .py | 4d32011dca565dfa | 7.5 | 9 |
# -*- coding: utf-8 -*-
# Copyright (c) 2021 Red Hat, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modi... | redhat-exd-rebuilds/freshmaker | freshmaker/handlers/koji/rebuild_flatpak_application_on_module_ready.py | .py | d78ad0e9e1afd407 | 7.5 | 9 |
# -*- coding: utf-8 -*-
# Copyright (c) 2020 Red Hat, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modi... | redhat-exd-rebuilds/freshmaker | freshmaker/handlers/koji/rebuild_images_on_async_manual_build.py | .py | 29311fdeeeb4530f | 7.5 | 9 |
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Red Hat, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modi... | redhat-exd-rebuilds/freshmaker | freshmaker/handlers/koji/rebuild_images_on_odcs_compose_done.py | .py | bbf69205feb18959 | 7.5 | 9 |
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Red Hat, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modi... | redhat-exd-rebuilds/freshmaker | freshmaker/handlers/koji/rebuild_images_on_parent_image_build.py | .py | 2e4a649c24859626 | 7.5 | 9 |
# -*- coding: utf-8 -*-
# Copyright (c) 2019 Red Hat, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modi... | redhat-exd-rebuilds/freshmaker | freshmaker/image_verifier.py | .py | 34eef593ac8188a4 | 7.5 | 9 |
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Red Hat, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modi... | redhat-exd-rebuilds/freshmaker | freshmaker/kojiservice.py | .py | b030a2ebfdc61b78 | 7.5 | 9 |
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Red Hat, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, mod... | redhat-exd-rebuilds/freshmaker | freshmaker/logger.py | .py | a5af22d6a8ac8170 | 7.5 | 9 |
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Red Hat, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modi... | redhat-exd-rebuilds/freshmaker | freshmaker/manage.py | .py | e5fb2894bf8d0297 | 7.5 | 9 |
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Red Hat, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modi... | redhat-exd-rebuilds/freshmaker | freshmaker/messaging.py | .py | f57c5c2fe85e9b2d | 7.5 | 9 |
"""Add time done for Freshmaker events
Revision ID: 2358b6f55f24
Revises: fbc2eac9bfa5
Create Date: 2019-06-20 10:00:31.190304
"""
revision = '2358b6f55f24'
down_revision = 'fbc2eac9bfa5'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('events', sa.Column('time_done', sa.DateTime()... | redhat-exd-rebuilds/freshmaker | freshmaker/migrations/versions/2358b6f55f24_.py | .py | 75260390180e6b8a | 7 | 9 |
"""Add User model
Revision ID: 2acc88805404
Revises: d6de0409fc74
Create Date: 2017-10-16 12:01:26.692076
"""
# revision identifiers, used by Alembic.
revision = '2acc88805404'
down_revision = 'd6de0409fc74'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic -... | redhat-exd-rebuilds/freshmaker | freshmaker/migrations/versions/2acc88805404_add_user_model.py | .py | fd9a19854b4458f3 | 7.5 | 9 |
"""Add manual_triggered to Event model
Revision ID: 2f5a2f4385a0
Revises: 2acc88805404
Create Date: 2017-11-01 14:03:02.555397
"""
# revision identifiers, used by Alembic.
revision = '2f5a2f4385a0'
down_revision = '2acc88805404'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto g... | redhat-exd-rebuilds/freshmaker | freshmaker/migrations/versions/2f5a2f4385a0_add_manual_triggered_to_event_model.py | .py | d5887ed7e5b99835 | 7.5 | 9 |
"""empty message
Revision ID: 300b86758bb1
Revises: bfc0e0d2eea6
Create Date: 2017-09-14 07:41:45.501531
"""
# revision identifiers, used by Alembic.
revision = '300b86758bb1'
down_revision = 'bfc0e0d2eea6'
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### commands auto generated by Alembic ... | redhat-exd-rebuilds/freshmaker | freshmaker/migrations/versions/300b86758bb1_.py | .py | 0dd3ed8561d224c8 | 7.5 | 9 |
"""Add state_reason to artifact_builds table.
Revision ID: 3f56425964cf
Revises: 300b86758bb1
Create Date: 2017-09-20 11:38:18.176512
"""
# revision identifiers, used by Alembic.
revision = '3f56425964cf'
down_revision = '300b86758bb1'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_colum... | redhat-exd-rebuilds/freshmaker | freshmaker/migrations/versions/3f56425964cf_.py | .py | 6df2de36766277f2 | 7 | 9 |
"""empty message
Revision ID: 43b3c6580af7
Revises: 8d2e9cd99c54
Create Date: 2017-08-15 10:29:33.224878
"""
# revision identifiers, used by Alembic.
revision = '43b3c6580af7'
down_revision = '8d2e9cd99c54'
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### commands auto generated by Alembic ... | redhat-exd-rebuilds/freshmaker | freshmaker/migrations/versions/43b3c6580af7_.py | .py | 5d0345300f9920b6 | 7.5 | 9 |
"""Add requested_rebuilds column to events table.
Revision ID: 5a555923da42
Revises: 8eeddff9a4f3
Create Date: 2019-02-07 08:22:29.216868
"""
# revision identifiers, used by Alembic.
revision = '5a555923da42'
down_revision = '8eeddff9a4f3'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_c... | redhat-exd-rebuilds/freshmaker | freshmaker/migrations/versions/5a555923da42_.py | .py | a964fef8b208093f | 7 | 9 |
"""Add requester_metadata to Events table.
Revision ID: 5bdd5566615a
Revises: 5a555923da42
Create Date: 2019-02-25 15:02:13.847086
"""
# revision identifiers, used by Alembic.
revision = '5bdd5566615a'
down_revision = '5a555923da42'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('... | redhat-exd-rebuilds/freshmaker | freshmaker/migrations/versions/5bdd5566615a_.py | .py | 25826ba3b106ddf1 | 7 | 9 |
"""Add Compose model and build m2m relationship with ArtifactBuild
Revision ID: 6004dadc9ac4
Revises: 90f8444d5ab7
Create Date: 2017-12-21 10:18:32.008115
"""
# revision identifiers, used by Alembic.
revision = '6004dadc9ac4'
down_revision = '90f8444d5ab7'
from alembic import op
import sqlalchemy as sa
def upgrad... | redhat-exd-rebuilds/freshmaker | freshmaker/migrations/versions/6004dadc9ac4_add_compose_model_and_build_m2m_.py | .py | 7789173c09ef8907 | 7.5 | 9 |
"""Add unique index to Event.message_id
Revision ID: 807ea37dcf0e
Revises: e06434b3ef5e
Create Date: 2018-01-05 11:17:48.343156
"""
# revision identifiers, used by Alembic.
revision = '807ea37dcf0e'
down_revision = 'f3223db11e48'
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### commands aut... | redhat-exd-rebuilds/freshmaker | freshmaker/migrations/versions/807ea37dcf0e_add_unique_index_to_event_message_id.py | .py | d519124eab52cad8 | 7.5 | 9 |
"""initial db
Revision ID: 8d2e9cd99c54
Revises:
Create Date: 2017-06-14 23:07:18.679502
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '8d2e9cd99c54'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generat... | redhat-exd-rebuilds/freshmaker | freshmaker/migrations/versions/8d2e9cd99c54_initial_db.py | .py | 76e7a9fb849e6f5a | 7.5 | 9 |
"""Add dry_run and requester to events table.
Revision ID: 8eeddff9a4f3
Revises: 807ea37dcf0e
Create Date: 2018-11-02 09:07:26.898276
"""
# revision identifiers, used by Alembic.
revision = '8eeddff9a4f3'
down_revision = '807ea37dcf0e'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_colum... | redhat-exd-rebuilds/freshmaker | freshmaker/migrations/versions/8eeddff9a4f3_add_dry_run_and_requester.py | .py | a9e311b8955d5b2a | 7.5 | 9 |
"""Add event state and timestamp
Revision ID: 90f8444d5ab7
Revises: 2f5a2f4385a0
Create Date: 2017-11-20 23:16:44.079911
"""
# revision identifiers, used by Alembic.
revision = '90f8444d5ab7'
down_revision = '2f5a2f4385a0'
from alembic import op
import sqlalchemy as sa
from freshmaker.models import Event
from fres... | redhat-exd-rebuilds/freshmaker | freshmaker/migrations/versions/90f8444d5ab7_add_event_state_and_timestamp.py | .py | 1863f26ef14eb477 | 7.5 | 9 |
import abc
import threading
from contextlib import contextmanager
from typing import Optional
import datetime
from dbhydra.src.migrator import Migrator
from dbhydra.src.tables import AbstractTable
def read_connection_details(config_file):
def read_file(file):
"""Reads txt file -> list"""
with open... | DovaX/dbhydra | dbhydra/src/abstract_db.py | .py | cdb867c5d332e467 | 7.5 | 9 |
import contextlib
import os
import pathlib
import threading
from typing import Optional
from dbhydra.src.abstract_db import AbstractDb
from dbhydra.src.tables import XlsxTable
class XlsxDb(AbstractDb):
"""Folder-structure with .xlsx files representing database tables
It does not need any server and runs loca... | DovaX/dbhydra | dbhydra/src/xlsx_db.py | .py | 927f7db4d8b6b8f9 | 7.5 | 9 |
##### DDL (data definition language) tests for MySQL #####
import os
import pytest
import random
import string
import dbhydra.dbhydra_core as dh
def random_table_name(prefix="test_table_"):
return prefix + ''.join(random.choices(string.ascii_lowercase + string.digits, k=8))
# Rename mysqldb fixture and all refer... | DovaX/dbhydra | dbhydra/tests/test_mysql_ddl.py | .py | b70251a562504a36 | 7 | 9 |
from pyv.module import Module
from pyv.port import Input, Output
from pyv.util import MASK_32, PyVObj
from pyv.log import logger
from pyv.clocked import Clocked, MemList
class ReadPort(PyVObj):
"""Read port"""
def __init__(
self,
re_i: Input[bool],
width_i: Input[int],
addr_i: ... | kyaso/py-v | pyv/mem.py | .py | 05815f95c6a50cb3 | 7.65 | 19 |
from pyv.module import Module
from pyv.simulator import Simulator
import traceback
class Model:
"""Base class for all core models.
"""
def __init__(self):
print("Initializing model...")
self.sim = Simulator()
"""Simulator instance"""
# Initialize modules
try:
... | kyaso/py-v | pyv/models/model.py | .py | 7d79c1f3f785259f | 7.65 | 19 |
from pyv.csr import CSRUnit
from pyv.exception_unit import ExceptionUnit
from pyv.stages import EXMEM_t, IFID_t, IFStage, IDStage, EXStage, MEMStage, \
WBStage, BranchUnit
from pyv.mem import Memory
from pyv.reg import Regfile
from pyv.module import Module
from pyv.models.model import Model
from pyv.port import Wir... | kyaso/py-v | pyv/models/singlecycle.py | .py | fdee0dca641aed0d | 7.65 | 19 |
from typing import Callable
from pyv.simulator import Simulator
from pyv.util import PyVObj
# TODO: Maybe make this abstract
class Module(PyVObj):
"""Base class for Modules.
All modules inherit from this class.
"""
def __init__(self, name='UnnamedModule'):
super().__init__(name)
self... | kyaso/py-v | pyv/module.py | .py | b967b94514baf1ef | 7.65 | 19 |
from abc import ABC, abstractmethod
import copy
import inspect
from typing import Any, TypeVar, Generic, Type
from pyv.log import logger
from pyv.util import PyVObj
T = TypeVar('T')
class Port(PyVObj, ABC):
"""Abstract base class for ports."""
def __init__(self, type, val) -> None:
super().__init__(... | kyaso/py-v | pyv/port.py | .py | 52ca6d7813089918 | 7.65 | 19 |
import copy
from pyv.util import PyVObj
from pyv.port import Input, Wire
from pyv.clocked import Clocked, RegList
from pyv.log import logger
from typing import TypeVar, Generic, Type
T = TypeVar('T')
class Reg(PyVObj, Clocked, Generic[T]):
"""Represents a register."""
def __init__(self, type: Type[T], reset... | kyaso/py-v | pyv/reg.py | .py | 54df43060d9ba0bf | 7.65 | 19 |
from pyv.port import PortList
from collections import deque
from pyv.log import logger
from pyv.clocked import Clock
from pyv.util import PyVObj
from queue import PriorityQueue
from typing import TypeAlias, Callable
import uuid
from datetime import datetime
Event: TypeAlias = tuple[int, uuid.UUID, Callable]
class _E... | kyaso/py-v | pyv/simulator.py | .py | 9494dd7771f4ceb0 | 7.65 | 19 |
#!/usr/bin/env python
'''
Created on 16/04/2018
miRmachine walk on tree, parse out node miRNAs
@author: suu13
'''
from __future__ import print_function
import re
from docopt import docopt
import newick
__author__ = 'sium'
__version__="0.99"
__licence__="""
MIT License
Copyright (c) 2018 Sinan Ugur Umu (SUU) sin... | sinanugur/MirMachine | scripts/mirmachine-tree-parser.py | .py | f3c7c9e66b244fd5 | 7.6 | 15 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.