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 |
|---|---|---|---|---|---|---|
# Copyright (C) 2022 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
#
#
# 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, includi... | ansys/pydpf-composites | src/ansys/dpf/composites/failure_criteria/_hashin.py | .py | 0059c3a5f5eba6c3 | 7.56 | 12 |
# Copyright (C) 2022 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
#
#
# 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, includi... | ansys/pydpf-composites | src/ansys/dpf/composites/failure_criteria/_larc.py | .py | 6cf03eb28fd3e1dd | 7.56 | 12 |
# Copyright (C) 2022 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
#
#
# 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, includi... | ansys/pydpf-composites | src/ansys/dpf/composites/failure_criteria/_max_strain.py | .py | 9aa6f899e8d9b59a | 7.56 | 12 |
# Copyright (C) 2022 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
#
#
# 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, includi... | ansys/pydpf-composites | src/ansys/dpf/composites/failure_criteria/_max_stress.py | .py | 0ac0a13b789204a3 | 7.56 | 12 |
# Copyright (C) 2022 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
#
#
# 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, includi... | ansys/pydpf-composites | src/ansys/dpf/composites/failure_criteria/_puck.py | .py | 55449bbb75128f50 | 7.56 | 12 |
# Copyright (C) 2022 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
#
#
# 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, includi... | ansys/pydpf-composites | src/ansys/dpf/composites/failure_criteria/_shear_crimping.py | .py | 36ed26213ad0196d | 7.56 | 12 |
from typing import Collection, Any, Optional, Callable
from functools import partial
import inspect
from deprecated.sphinx import versionadded
def existing(*params: str):
"""
A python decorator to mark the given parameter(s) as one(s) already defined
in FLITSR's arguments. These parameters for the decorat... | DCallaz/flitsr | flitsr/advanced/attributes.py | .py | 898e0ad2c9a9cbf5 | 7.48 | 8 |
from abc import ABC, abstractmethod
from typing import List
from flitsr.spectrum import Spectrum
from flitsr import advanced
class Cluster(ABC):
""" A `Cluster` technique takes a `Spectrum <flitsr.spectrum.Spectrum>` and
returns a collection of spectra that are decompositions of the original"""
@abstract... | DCallaz/flitsr | flitsr/advanced/cluster.py | .py | 15edae0448eb1721 | 7.48 | 8 |
from __future__ import annotations
from abc import ABC, abstractmethod
from flitsr.spectrum import Spectrum
from flitsr.ranking import Ranking
from flitsr import advanced
class Ranker(ABC):
"""
A `Ranker` technique takes a `Spectrum <flitsr.spectrum.Spectrum>` and
forms a `Ranking <flitsr.ranking.Ranking>... | DCallaz/flitsr | flitsr/advanced/ranker.py | .py | 0c6e9c5fca8f7e87 | 7.48 | 8 |
from abc import ABC, abstractmethod
from flitsr.spectrum import Spectrum
from flitsr import advanced
class Refiner(ABC):
""" A `Refiner` technique takes a `Spectrum <flitsr.spectrum.Spectrum>` and
manipulates and extends it, returning a modified spectrum."""
@abstractmethod
def refine(self, spectrum:... | DCallaz/flitsr | flitsr/advanced/refiner.py | .py | d89af615d2f41bcc | 7.48 | 8 |
import inspect
import time
from typing import Union, Callable, Any, Collection, Optional, Dict, TypeVar, \
Tuple
from collections import defaultdict
from functools import wraps
from flitsr import calculations
T = TypeVar('T', bound=Callable)
def calculation(print_name: Union[str, Callable[..., str]],
... | DCallaz/flitsr | flitsr/calculations/calc_decorator.py | .py | eb520bc0f6e9b107 | 7.48 | 8 |
import sys
import re
import os
from os import path as osp
from typing import TextIO, List
from shutil import rmtree
from flitsr.spectrum import Spectrum, Outcome
from flitsr.input.spectrumBuilder import TestKeyError, ElemKeyError
from flitsr.errors import error
from flitsr.input.input_reader import DirInput
class Gzo... | DCallaz/flitsr | flitsr/input/gzoltar_input.py | .py | 36d50b1341ba53b6 | 7.48 | 8 |
from __future__ import annotations
from ast import AsyncFunctionDef, ClassDef, FunctionDef, Module, parse, stmt
from .utils.ast import find_first_line, get_class_nodes, get_method_nodes, is_blank
def normalize_blank_lines(lines: list[str]) -> str:
"""Normalize blank lines per PEP 8:
- 2 blank lines before t... | eirikurt/sdsort | sdsort/format.py | .py | 0004911c06df3332 | 7.56 | 12 |
from __future__ import annotations
import tomllib
from dataclasses import dataclass
from functools import lru_cache
from itertools import takewhile
from typing import TYPE_CHECKING, Any
from .config import Config
if TYPE_CHECKING:
from pathlib import Path
TomlTable = dict[str, Any]
@dataclass(frozen=True)
cla... | eirikurt/sdsort | sdsort/pyproject.py | .py | 3eb628b5fb2841aa | 7.56 | 12 |
from __future__ import annotations
from ast import Attribute, Call, ClassDef, Module, Name, parse
from collections import defaultdict
from io import BytesIO
from itertools import takewhile
from pathlib import Path
from tokenize import COMMENT, tokenize
from typing import TYPE_CHECKING, Literal, TypeAlias, TypeVar
fro... | eirikurt/sdsort | sdsort/sort.py | .py | 5270d54cbb2dacee | 7.56 | 12 |
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from pathlib import Path
def read_file(file_path: str | Path) -> str:
with open(file_path, encoding="utf-8", newline=None) as f:
return f.read()
def split_lines(source: str) -> list[str]:
"""Split source into... | eirikurt/sdsort | sdsort/utils/file.py | .py | d7bdfd30fdeaa62e | 7.56 | 12 |
# Here is a comment
from typing import Optional
print("\n═══ Analyse par categories (1ère catégorie) ═══\n")
class Comment:
SOME_CONSTANT = 1234
ANOTHER_CONSTANT = "asdf"
async def send_below(
self,
parameter1,
parameter2,
parameter3: str,
parameter4: int,
... | eirikurt/sdsort | test/cases/default/comments.in.py | .py | d11828094cff8845 | 7.06 | 12 |
# Here is a comment
from typing import Optional
print("\n═══ Analyse par categories (1ère catégorie) ═══\n")
class Comment:
SOME_CONSTANT = 1234
ANOTHER_CONSTANT = "asdf"
async def splu(
self,
lots,
and_lots,
of_arguments,
in_this_method,
so_multiple,
... | eirikurt/sdsort | test/cases/default/comments.out.py | .py | 40725256fcbba4a0 | 7.06 | 12 |
from __future__ import annotations
import typing as t
class JSONTag:
"""Base class for defining type tags for :class:`TaggedJSONSerializer`."""
__slots__ = ("serializer",)
#: The tag to mark the serialized object with. If empty, this tag is
#: only used as an intermediate step during tagging.
ke... | eirikurt/sdsort | test/cases/default/flask_tag.in.py | .py | 799079514d277bef | 8.06 | 12 |
from __future__ import annotations
import typing as t
class JSONTag:
"""Base class for defining type tags for :class:`TaggedJSONSerializer`."""
__slots__ = ("serializer",)
#: The tag to mark the serialized object with. If empty, this tag is
#: only used as an intermediate step during tagging.
ke... | eirikurt/sdsort | test/cases/default/flask_tag.out.py | .py | 7f39e76e11e99766 | 8.06 | 12 |
# SPDX-License-Identifier: Apache-2.0
#
# This file is part of the M2-ISA-R project: https://github.com/tum-ei-eda/M2-ISA-R
#
# Copyright (C) 2022
# Chair of Electrical Design Automation
# Technical University of Munich
"""This is the top-level M2-ISA-R package. The project is divided into three major parts:
* :mod:`... | tum-ei-eda/M2-ISA-R | m2isar/__init__.py | .py | f0a1c5fd49343a5d | 7.52 | 10 |
# SPDX-License-Identifier: Apache-2.0
#
# This file is part of the M2-ISA-R project: https://github.com/tum-ei-eda/M2-ISA-R
#
# Copyright (C) 2022
# Chair of Electrical Design Automation
# Technical University of Munich
"""Visitor-pattern based printer for instruction/function behavior."""
import logging
from functo... | tum-ei-eda/M2-ISA-R | m2isar/backends/coredsl2/visitor.py | .py | a63e3637890f02ff | 7.52 | 10 |
# SPDX-License-Identifier: Apache-2.0
#
# This file is part of the M2-ISA-R project: https://github.com/tum-ei-eda/M2-ISA-R
#
# Copyright (C) 2022
# Chair of Electrical Design Automation
# Technical University of Munich
"""Clean M2-ISA-R/Seal5 metamodel to .core_desc file."""
import copy
import argparse
import loggin... | tum-ei-eda/M2-ISA-R | m2isar/backends/coredsl2/writer.py | .py | 60764b5df142df1c | 7.52 | 10 |
# SPDX-License-Identifier: Apache-2.0
#
# This file is part of the M2-ISA-R project: https://github.com/tum-ei-eda/M2-ISA-R
#
# Copyright (C) 2022
# Chair of Electrical Design Automation
# Technical University of Munich
"""Fortmatter implementation for CoreDSL assembly strings."""
# Inspired by: https://stackoverflow... | tum-ei-eda/M2-ISA-R | m2isar/backends/disass/asm_formatter.py | .py | a5c33310a23bbccc | 7.52 | 10 |
# SPDX-License-Identifier: Apache-2.0
#
# This file is part of the M2-ISA-R project: https://github.com/tum-ei-eda/M2-ISA-R
#
# Copyright (C) 2022
# Chair of Electrical Design Automation
# Technical University of Munich
"""Simple disassembler backend for M2-ISA-R ISA metamodels. Not very
actively maintained, might bre... | tum-ei-eda/M2-ISA-R | m2isar/backends/disass/disass.py | .py | 123909ea77c278c5 | 7.52 | 10 |
# SPDX-License-Identifier: Apache-2.0
#
# This file is part of the M2-ISA-R project: https://github.com/tum-ei-eda/M2-ISA-R
#
# Copyright (C) 2022
# Chair of Electrical Design Automation
# Technical University of Munich
"""This is the ETISS architecture generation backend of M2-ISA-R. It is used
for automatic generati... | tum-ei-eda/M2-ISA-R | m2isar/backends/etiss/__init__.py | .py | 19bacc3f3639169e | 7.52 | 10 |
# SPDX-License-Identifier: Apache-2.0
#
# This file is part of the M2-ISA-R project: https://github.com/tum-ei-eda/M2-ISA-R
#
# Copyright (C) 2022
# Chair of Electrical Design Automation
# Technical University of Munich
"""Functions for generating function and instruction behavior."""
import logging
from mako.templa... | tum-ei-eda/M2-ISA-R | m2isar/backends/etiss/instruction_generator.py | .py | 8972c09c27a7834b | 7.52 | 10 |
# SPDX-License-Identifier: Apache-2.0
#
# This file is part of the M2-ISA-R project: https://github.com/tum-ei-eda/M2-ISA-R
#
# Copyright (C) 2022
# Chair of Electrical Design Automation
# Technical University of Munich
"""Utility classes and functions for instruction generation."""
from dataclasses import asdict, da... | tum-ei-eda/M2-ISA-R | m2isar/backends/etiss/instruction_utils.py | .py | 06509d00bb0a2899 | 7.52 | 10 |
# SPDX-License-Identifier: Apache-2.0
#
# This file is part of the M2-ISA-R project: https://github.com/tum-ei-eda/M2-ISA-R
#
# Copyright (C) 2022
# Chair of Electrical Design Automation
# Technical University of Munich
"""Actual text output functions for functions and instructions."""
import logging
import pathlib
f... | tum-ei-eda/M2-ISA-R | m2isar/backends/etiss/instruction_writer.py | .py | f17b2629988835cb | 7.52 | 10 |
# SPDX-License-Identifier: Apache-2.0
#
# This file is part of the M2-ISA-R project: https://github.com/tum-ei-eda/M2-ISA-R
#
# Copyright (C) 2025
# Chair of Electrical Design Automation
# Technical University of Munich
"""Helper functions for dealing with ETISS VirtualStruct and GDBCore."""
import re
import pathlib
... | tum-ei-eda/M2-ISA-R | m2isar/backends/etiss/virtualstruct_utils.py | .py | dd2f2a43e368a5f7 | 7.52 | 10 |
#
# Copyright 2025 Chair of EDA, Technical University of Munich
#
# 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... | tum-ei-eda/M2-ISA-R | m2isar/backends/trace_gen/backend/CodeBuilder.py | .py | 6192bc63eab08c86 | 7.52 | 10 |
# SPDX-License-Identifier: Apache-2.0
#
# This file is part of the M2-ISA-R project: https://github.com/tum-ei-eda/M2-ISA-R
#
# Copyright (C) 2022
# Chair of Electrical Design Automation
# Technical University of Munich
"""Utility stuff for M2-ISA-R viewer"""
from typing import TYPE_CHECKING
if TYPE_CHEC... | tum-ei-eda/M2-ISA-R | m2isar/backends/viewer/utils.py | .py | 1e5dbc760d54f1ff | 7.52 | 10 |
# SPDX-License-Identifier: Apache-2.0
#
# This file is part of the M2-ISA-R project: https://github.com/tum-ei-eda/M2-ISA-R
#
# Copyright (C) 2022
# Chair of Electrical Design Automation
# Technical University of Munich
"""Very crude expression evaluation functions for use during model generation."""
from ... import ... | tum-ei-eda/M2-ISA-R | m2isar/frontends/coredsl2/expr_interpreter.py | .py | c211c736a040188b | 7.52 | 10 |
# SPDX-License-Identifier: Apache-2.0
#
# This file is part of the M2-ISA-R project: https://github.com/tum-ei-eda/M2-ISA-R
#
# Copyright (C) 2022
# Chair of Electrical Design Automation
# Technical University of Munich
"""Classes to recursively import files of a CoreDSL model."""
import logging
import pathlib
from t... | tum-ei-eda/M2-ISA-R | m2isar/frontends/coredsl2/importer.py | .py | fb64489cec6639c0 | 7.52 | 10 |
from __future__ import annotations
import json
import typing
from typing import Optional, Iterable, Generator, Any, Literal
from ayon_api.utils import (
SortOrder,
prepare_list_filters,
)
from ayon_api.graphql_queries import activities_graphql_query
from .base import BaseServerAPI
if typing.TYPE_CHECKING:
... | ynput/ayon-python-api | ayon_api/_api_helpers/activities.py | .py | dd4fb4240fc5f7e1 | 7.62 | 16 |
from __future__ import annotations
import copy
import time
import typing
from typing import Optional
from .base import BaseServerAPI
if typing.TYPE_CHECKING:
from ayon_api.typing import (
AttributeSchemaDict,
AttributeSchemaDataDict,
AttributesSchemaDict,
AttributeScope,
)
cl... | ynput/ayon-python-api | ayon_api/_api_helpers/attributes.py | .py | babf45b0c5966352 | 7.62 | 16 |
from __future__ import annotations
import os
import warnings
import platform
import typing
from typing import Optional, Any
from ayon_api.utils import TransferProgress
from .base import BaseServerAPI
if typing.TYPE_CHECKING:
from ayon_api.typing import DependencyPackagesDict
class DependencyPackagesAPI(BaseSe... | ynput/ayon-python-api | ayon_api/_api_helpers/dependency_packages.py | .py | 9e0867751a31c0b0 | 7.62 | 16 |
from __future__ import annotations
import typing
from typing import Optional, Any
import requests
from ayon_api.utils import prepare_query_string, TransferProgress
from .base import BaseServerAPI
if typing.TYPE_CHECKING:
from ayon_api.typing import InstallersInfoDict
class InstallersAPI(BaseServerAPI):
d... | ynput/ayon-python-api | ayon_api/_api_helpers/installers.py | .py | 438e6c83aadf2948 | 7.62 | 16 |
from __future__ import annotations
import copy
try:
# This should be used if 'requests' have it available
from requests.exceptions import JSONDecodeError
except ImportError:
# Older versions of 'requests' don't have custom exception for json
# decode error
try:
from simplejson import JSO... | ynput/ayon-python-api | ayon_api/exceptions.py | .py | f629c8f9390018c2 | 7.62 | 16 |
#!/usr/bin/env python
"""Prepares server package from addon repo to upload to server.
Requires Python 3.9. (Or at least 3.8+).
This script should be called from cloned addon repo.
It will produce 'package' subdirectory which could be pasted into server
addon directory directly (eg. into `ayon-backend/addons`).
For... | ynput/ayon-python-api | tests/resources/addon/create_package.py | .py | f7239ec12409c8c9 | 8.12 | 16 |
"""Tests of folder hierarchy - creating, deleting and moving
folders, products, versions, etc.
To run use: pytest --envfile {environment path}.
Make sure you have set AYON_TOKEN in your environment.
"""
import pytest
from ayon_api.operations import (
OperationsSession,
new_folder_entity,
new_product_enti... | ynput/ayon-python-api | tests/test_folder_hierarchy.py | .py | ec0c39a16e975138 | 7.12 | 16 |
"""Tests of server API.
To run use: pytest --envfile {environment path}.
Make sure you have set AYON_TOKEN in your environment.
"""
from datetime import datetime, timedelta, timezone
import os
import sys
import subprocess
import time
import pytest
from ayon_api import (
close_connection,
create_folder,
... | ynput/ayon-python-api | tests/test_server.py | .py | 7022ed51899f2278 | 7.12 | 16 |
from __future__ import annotations
import typing
from typing import cast
import httpx
import tenacity
from rossum_api.domain_logic.annotations import (
build_export_query_params,
get_http_method_for_annotation_export,
)
from rossum_api.domain_logic.pagination import build_pagination_params
from rossum_api.do... | rossumai/rossum-api | rossum_api/clients/internal_sync_client.py | .py | 48f74d9dc58adf74 | 7.52 | 10 |
from __future__ import annotations
from enum import Enum
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from collections.abc import Sequence
from typing import Any
from rossum_api.types import HttpMethod, Sideload
from rossum_api.utils import ObjectWithStatus
class ExportFileFormats(Enum): # n... | rossumai/rossum-api | rossum_api/domain_logic/annotations.py | .py | 4a8ceea6db5b2b25 | 7.52 | 10 |
from __future__ import annotations
import itertools
from typing import TYPE_CHECKING
from rossum_api.domain_logic.urls import (
parse_annotation_id_from_datapoint_url,
parse_resource_id_from_url,
)
from rossum_api.utils import to_singular
if TYPE_CHECKING:
from collections.abc import Sequence
from ty... | rossumai/rossum-api | rossum_api/domain_logic/sideloads.py | .py | b6b408ff947ac36d | 7.52 | 10 |
from __future__ import annotations
from dataclasses import dataclass, field
from typing import Literal
AutomationTargetType = Literal["legacy_thresholds", "automation_assistant_v1"]
AutomationSetupExcludeBlocker = Literal["error_message", "extension"]
DocumentBlockerGranularity = Literal["annotation", "datapoint"]
... | rossumai/rossum-api | rossum_api/models/automation.py | .py | 19214efbdd6ddaf0 | 7.52 | 10 |
from __future__ import annotations
from dataclasses import dataclass, field
from typing import Any, Literal
AutomationBlockerTypes = Literal[
"automation_disabled",
"is_duplicate",
"suggested_edit_present",
"low_score",
"failed_checks",
"no_validation_sources",
"error_message",
"delete... | rossumai/rossum-api | rossum_api/models/automation_blocker.py | .py | de1c54fd19ac3c14 | 7.52 | 10 |
from __future__ import annotations
from dataclasses import dataclass
from typing import Literal
EngineFieldType = Literal["string", "number", "date", "enum"]
MultilineType = Literal["true", "false", ""] # Preparation for "auto" option
@dataclass
class Engine:
"""Engine represents an AI extraction engine in Ros... | rossumai/rossum-api | rossum_api/models/engine.py | .py | 16c824b0bfde9dc8 | 7.52 | 10 |
from __future__ import annotations
from dataclasses import dataclass
@dataclass
class EmailLimits:
"""Email-related limits for an organization.
Attributes
----------
count_today
Emails sent by user today count.
count_today_notification
Notification emails sent today count.
co... | rossumai/rossum-api | rossum_api/models/organization_limit.py | .py | 8413ecd75306d6f0 | 7.52 | 10 |
from __future__ import annotations
from dataclasses import dataclass
from enum import Enum
class RelationType(str, Enum):
"""Type of relationship between annotations.
Attributes
----------
EDIT
Created after editing annotation in user interface (rotation or split of the document).
Th... | rossumai/rossum-api | rossum_api/models/relation.py | .py | 03d4345847cdb0b8 | 7.52 | 10 |
from __future__ import annotations
from abc import ABC, abstractmethod
from dataclasses import dataclass, field
from enum import Enum
from typing import TYPE_CHECKING, Any, Generic, Literal, TypeAlias, TypeVar
import dacite
if TYPE_CHECKING:
from collections.abc import Iterator
ParentType = TypeVar("ParentType"... | rossumai/rossum-api | rossum_api/models/schema.py | .py | 3eddc534de75e0f5 | 7.52 | 10 |
from __future__ import annotations
from urllib.parse import parse_qsl, urlencode
import httpx
from deezer_oauth.constants import HOST_NAME, OAUTH_RETURN_PATH, SERVER_PORT
class OAuthDancer:
"""A class to help with completing the OAuth dance."""
base_url: str = "https://connect.deezer.com"
app_id: str
... | browniebroke/deezer-oauth-cli | src/deezer_oauth/client.py | .py | d65cf8a0c2ab9114 | 7.5 | 9 |
from __future__ import annotations
from http.server import BaseHTTPRequestHandler, HTTPServer
from typing import TYPE_CHECKING, Any
from urllib.parse import parse_qsl
from deezer_oauth.constants import HOST_NAME, OAUTH_RETURN_PATH, SERVER_PORT
from deezer_oauth.files import write_env_file
if TYPE_CHECKING:
from ... | browniebroke/deezer-oauth-cli | src/deezer_oauth/server.py | .py | 36980f53256e8a99 | 7.5 | 9 |
import re
import yaml
import logging
import os
def read(helm_chart_path: str) -> dict:
"""
Reads all present chart metadata into a data structure.
Parameters:
helm_chart_path (str): Path to the chart.
Returns:
doc (dict): Generated data structure.
"""
# define desired data st... | very-doge-wow/stella | reader/chart_reader.py | .py | a945df0e9f3a1239 | 7.5 | 9 |
import re
import unicodedata
from django.shortcuts import render
from functools import wraps
_disallowed_characters = re.compile(r"[^a-zA-Z0-9-]")
_duplicate_hyphens = re.compile(r"-+")
def suggest_username(name):
"""
Returns name with éîü -> eiu and with non-alphanumeric
characters converted to "-" and ... | natbat/pillarpointstewards | pillarpointstewards/auth0_login/utils.py | .py | 16ddee100e4f53ba | 7.45 | 7 |
# Copyright (C) 2016 Bartosz Inglot (@BartInglot) <inglotbartosz@gmail_com>
# Donated under Volatility Foundation, Inc. Individual Contributor Licensing Agreement
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free So... | MiBaLToALeX/ShellOrd | plugins/rdpkeys.py | .py | 49a77a627cbb306e | 7.62 | 16 |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_project.settings")
try:
from django.core.management import execute_from_command_line
excep... | dennybiasiolli/django-reversion-rest-framework | tests/manage.py | .py | fa5b587acf13fe31 | 7.07 | 13 |
from django.test.testcases import TestCase
from rest_framework.viewsets import GenericViewSet
from reversion_rest_framework import mixins
from reversion_rest_framework.serializers import VersionSerializer
class MixinsTests(TestCase):
def test_base_history_model_mixin(self):
"""
Ensure we don't ha... | dennybiasiolli/django-reversion-rest-framework | tests/test_app/tests/test_mixins.py | .py | 289e54a0a0652037 | 7.07 | 13 |
from rest_framework import permissions
from reversion_rest_framework.viewsets import HistoryModelViewSet
from .models import TestLimitedModel, TestModel, TestParentModel
from .pagination import MyPageNumberPagination
from .serializers import (
CustomVersionSerializer,
ParentTestModelSerializer,
TestLimite... | dennybiasiolli/django-reversion-rest-framework | tests/test_app/views.py | .py | 2c191ee9220fee74 | 7.07 | 13 |
#!/usr/bin/env python3
"""Validate that pkimm markdown content stays in sync with the YAML model.
Returns a non-zero exit code if any error-severity issue is found.
Warning-severity issues are printed but do not fail the run."""
from __future__ import annotations
import argparse
import dataclasses
import re
import sys... | pkic/pkimm | scripts/check_model_docs_consistency.py | .py | a0211abfc9bad517 | 7.57 | 13 |
"""Shared pytest fixtures for pkimm scripts."""
from __future__ import annotations
from pathlib import Path
import pytest
@pytest.fixture
def repo_root() -> Path:
"""Return the pkimm repo root (parent of scripts/)."""
return Path(__file__).resolve().parent.parent
@pytest.fixture
def data_dir(repo_root: Pat... | pkic/pkimm | scripts/conftest.py | .py | 9de00e4acec5adf9 | 7.57 | 13 |
#!/usr/bin/env python3
"""Generate per-category Hugo markdown files from data/pkimm-model-<version>.yaml.
References are loaded from a separate catalog file (data/pkimm-references.yaml).
Idempotent. Preserves existing front-matter `date` per file. Manual-run; the
validator (check_model_docs_consistency.py) is the CI g... | pkic/pkimm | scripts/generate_category_docs.py | .py | c1110ca84afd7e91 | 7.57 | 13 |
"""Tests for the YAML <-> docs consistency validator."""
from __future__ import annotations
import json
import textwrap
from pathlib import Path
from scripts.check_model_docs_consistency import (
ConsistencyIssue,
check_all,
)
SAMPLE_MODEL_YAML = """\
schemaVersion: "2.0.0"
version: "2.0.0"
modules:
- id: ... | pkic/pkimm | scripts/test_check_model_docs_consistency.py | .py | 6fbf116f0f0d901b | 8.07 | 13 |
"""Tests for the YAML → category markdown generator."""
from __future__ import annotations
import textwrap
from pathlib import Path
import yaml
from scripts.generate_category_docs import generate, render_category_markdown
SAMPLE_MODEL_YAML = """
schemaVersion: "2.0.0"
version: "2.0.0"
modules:
- id: "G"
name:... | pkic/pkimm | scripts/test_generate_category_docs.py | .py | 22e4c02ea211bc57 | 8.07 | 13 |
"""Prusalink API."""
from __future__ import annotations
from typing import cast
from httpx import AsyncClient
from pyprusalink.client import ApiClient
from pyprusalink.file_metadata import parse_file_metadata
from pyprusalink.types import (
FileTooLarge,
JobInfo,
PrinterInfo,
PrinterStatus,
Print... | home-assistant-libs/pyprusalink | pyprusalink/__init__.py | .py | 92ce8d9d3dee53a3 | 7.52 | 10 |
from __future__ import annotations
from collections.abc import AsyncGenerator
from contextlib import asynccontextmanager
import hashlib
from typing import Any
from httpx import AsyncClient, DigestAuth, Request, Response
from httpx._auth import _DigestAuthChallenge
from pyprusalink.types import Conflict, InvalidAuth, ... | home-assistant-libs/pyprusalink | pyprusalink/client.py | .py | 968223e5022bac00 | 7.52 | 10 |
from enum import Enum
from typing import Any, NotRequired, TypedDict
"""Types of the v1 API. Source: https://github.com/prusa3d/Prusa-Link-Web/blob/master/spec/openapi.yaml"""
class PrusaLinkError(Exception):
"""Base class for PrusaLink errors."""
class InvalidAuth(PrusaLinkError):
"""Error to indicate the... | home-assistant-libs/pyprusalink | pyprusalink/types.py | .py | 3fe9ecc817d5358c | 7.52 | 10 |
"""Tests for ApiClient error handling and DigestAuthWorkaround."""
from unittest.mock import MagicMock, patch
import httpx
from httpx import DigestAuth
from pyprusalink.client import DigestAuthWorkaround
from pyprusalink.types import Conflict, InvalidAuth, NotFound
import pytest
HOST = "http://printer.local"
async... | home-assistant-libs/pyprusalink | tests/test_client.py | .py | ca4d0279c8b1dbbc | 8.02 | 10 |
import datetime
import json
import os
import re
import urllib.parse
import urllib.request
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
OUTPUT_DIR = os.path.dirname(SCRIPT_DIR)
VERSION_TXT = os.path.join(OUTPUT_DIR, "version.txt")
VERSION_SOURCE = os.path.join(SCRIPT_DIR, "01-header", "02-Version.sou... | KassahiPD2/Kassahi | builderfilter/build.py | .py | f2ef14b3b54427e9 | 7.45 | 7 |
from __future__ import annotations
from collections.abc import Mapping
import pulumi
from .taggable import is_taggable
# Taggable resources that do not support auto-tagging.
_UNSUPPORTED_RESOURCE_TYPES = {"aws:autoscaling/group:Group"}
def register_auto_tags(
auto_tags: Mapping[str, str], *, override: bool = ... | tlinhart/pulumi-aws-tags | python/pulumi_aws_tags/autotag.py | .py | c16952a9acb8f39f | 7.5 | 9 |
from __future__ import annotations
import importlib
import inspect
from collections.abc import Iterator
import pulumi_aws # noqa: F401
from pulumi.runtime.rpc import _RESOURCE_MODULES
# Known exceptions to the rules for identifying taggable resources.
_NOT_TAGGABLE_RESOURCE_TYPES = {
"aws:devopsguru/resourceCol... | tlinhart/pulumi-aws-tags | python/pulumi_aws_tags/taggable.py | .py | d8e2b345986d223e | 7.5 | 9 |
import coralme
import coralme
import collections
def _return_compartments_of_complexes(model, cplx):
try:
data = model.process_data.get_by_id(cplx.id)
except KeyError:
data = coralme.builder.helper_functions.get_base_complex_data(model, cplx.id)
mem_dict = collections.defaultdict(int)
for s in data.stoichiome... | jdtibochab/coralme | coralme/builder/compartments.py | .py | 1b0fe1d8851edbe2 | 7.52 | 10 |
import numpy
import scipy
import coralme
# Experimental Data
#gr_data_doublings_per_hour = [0, 0.6, 1.0, 1.5, 2.0, 2.5]
# First point is mass 1 genome in 0.4 um^3 at density
#percent_dna_data = [0.0592, 0.0512, 0.0330, 0.0252, 0.0222, 0.0208]
def percent_dna_template_function(params, gr):
[g_p_gdw_0, g_per_gdw_inf... | jdtibochab/coralme | coralme/builder/dna_replication.py | .py | 392d51136bc2814b | 7.52 | 10 |
import tqdm
import json
import cobra
import pandas
import collections
import logging
log = logging.getLogger(__name__)
import coralme
def fix_id(id_str):
return id_str.replace('_DASH_', '__')
def read(filename) -> pandas.DataFrame:
return pandas.read_csv(filename, sep = '\t', index_col = None, comment = '#', skip... | jdtibochab/coralme | coralme/builder/flat_files.py | .py | 3f20535c75958232 | 7.52 | 10 |
import re
import copy
import pandas
import tqdm
import cobra
import coralme
from warnings import warn
import collections
import sympy
# from cobrame without changes
def get_base_complex_data(model, complex_id):
"""
If a complex is modified in a metabolic reaction it will not
have a formation reaction associated wit... | jdtibochab/coralme | coralme/builder/helper_functions.py | .py | c281ce67b0de6403 | 7.52 | 10 |
import collections
import json
import os
def dict_to_defaultdict(dct):
"""Cast a dict to a defaultdict"""
return collections.defaultdict(lambda: [], dct)
def save_curation_notes(curation_notes,filepath):
"""Save curation notes as JSON"""
file = open(filepath,'w')
file.write(json.dumps(curation_notes, indent=4))
... | jdtibochab/coralme | coralme/builder/notes.py | .py | d39ce2edf925b14a | 7.52 | 10 |
import Bio
import logging
log = logging.getLogger(__name__)
import coralme
#from functools import reduce
#def reducer(accumulator, element):
#for key, value in element.items():
#accumulator[key] = accumulator.get(key, 0) + value
#return accumulator
import collections
def add_subreactions_to_model(me_model, subr... | jdtibochab/coralme | coralme/builder/translation.py | .py | d1f4bf5f2cd7f328 | 7.52 | 10 |
# ME model troubleshooting
# Originally developed by JDTB@UCSD, 2022
# Modified by RSP@UCSD, 2022
import coralme
import cobra
import sympy
import pandas
import logging
log = logging.getLogger(__name__)
def process_model(model, growth_key = sympy.Symbol('mu', positive = True), parameters = dict()):
"""
Get a dictio... | jdtibochab/coralme | coralme/builder/troubleshooting.py | .py | 26d0fd053878473e | 7.52 | 10 |
import coralme
import collections
import functools
import logging
import pint
import pandas
import sympy
import re
# configuration
log_format = '%(asctime)s %(funcName)s %(filename)s:%(lineno)d %(message)s' #%(clientip)-15s %(user)-8s
bar_format = '{desc:<75}: {percentage:.1f}%|{bar:10}| {n_fmt:>5}/{total_fmt:>5} [{el... | jdtibochab/coralme | coralme/core/extended_classes.py | .py | 1411384eac9e522d | 7.52 | 10 |
import cobra
import glob
import pandas
import re
import tqdm
from Bio import SeqIO
# Written originally by Rodrigo Santibanez
def get_orthofinder_results(path, save = False):
# index: Orthogroups; columns: organisms; data: single string, comma separated
data = pandas.read_csv(path, sep = '\t', index_col = 0, low_mem... | jdtibochab/coralme | coralme/util/change_model_genes.py | .py | 99fbe668d0dbbfad | 7.52 | 10 |
import difflib
import glob
import pathlib
import re
def main(path1, path2):
files = [ '/'.join(x.split('/')[1:]) for x in sorted(glob.glob('{:s}/**/*'.format(path1), recursive=True)) ]
files = [ x for x in files if not x.endswith(('.log', '.pkl', '.json', '.yaml', '.xlsx')) ]
files = [ x for x in files if not x.sta... | jdtibochab/coralme | coralme/util/compare.py | .py | 42c738c41096f906 | 7.52 | 10 |
import cobra
import coralme
import pandas
import sympy
import tqdm
import re
import pint
def exchange_single_model(me, flux_dict = 0, solution=0):
"""
Returns a summary of exchange reactions and fluxes
"""
complete_dict = {'id':[],'name':[],'reaction':[],'lower_bound':[],'upper_bound':[],'flux':[]}
if solution:
... | jdtibochab/coralme | coralme/util/flux_analysis.py | .py | 46f08d82fa05d925 | 7.52 | 10 |
import copy
import sympy
import coralme
import collections
def stringify(element, number):
number = int(number)
return element if number == 1 else (element + str(number).rstrip('.'))
def elements_to_formula(obj, elements):
#obj.formula = ''.join(stringify(e, n) for e, n in sorted(iteritems(elements)))
obj.formula... | jdtibochab/coralme | coralme/util/massbalance.py | .py | 9f5f0d1a562aad6f | 7.52 | 10 |
"""Detect timed-out matrix runs from a GitHub Actions workflow run.
Queries the GitHub API to find all jobs in the current workflow run
that correspond to the archive-run matrix job and have timed out.
Outputs a list of datasets that timed out.
"""
import os
import requests
def get_timed_out_datasets() -> list[str... | catalyst-cooperative/pudl-archiver | scripts/detect_timeouts.py | .py | d88af950bd45433a | 7.64 | 18 |
#! /usr/bin/env python
"""Format archiver summary and error files as Markdown.
This script reads run summary JSON files and optional failure logs, then emits
Markdown suitable for either:
- GitHub issue template sections describing errors, failures, changes, or
unchanged datasets.
- Zulip notifications containing... | catalyst-cooperative/pudl-archiver | scripts/make_markdown_notification.py | .py | 3a21a585b895c26c | 7.64 | 18 |
"""Tool to download data resources and create archives on Zenodo for use in PUDL."""
import asyncio
import json
import logging
from pathlib import Path
import aiohttp
from pudl_archiver.archivers.classes import AbstractDatasetArchiver
from pudl_archiver.frictionless import Partitions
from pudl_archiver.orchestrator ... | catalyst-cooperative/pudl-archiver | src/pudl_archiver/__init__.py | .py | 9260367fd023849a | 7.64 | 18 |
"""Download US Census DP1 GeoDatabase."""
from pathlib import Path
from pudl_archiver.archivers.classes import (
AbstractDatasetArchiver,
ArchiveAwaitable,
ResourceInfo,
)
class CensusDp1TractArchiver(AbstractDatasetArchiver):
"""Census DP1 GeoDatabase archiver."""
name = "censusdp1tract"
... | catalyst-cooperative/pudl-archiver | src/pudl_archiver/archivers/census/censusdp1tract.py | .py | 29aeb4d9b747c08a | 7.64 | 18 |
"""Download US Census Federal Information Processing Standards (FIPS) codes from Population Estimates Program (PEP)."""
import re
from pathlib import Path
from pudl_archiver.archivers.classes import (
AbstractDatasetArchiver,
ArchiveAwaitable,
ResourceInfo,
)
from pudl_archiver.frictionless import ZipLayo... | catalyst-cooperative/pudl-archiver | src/pudl_archiver/archivers/census/censuspep.py | .py | 2c91f260316586b0 | 7.64 | 18 |
"""Download DOE IRA Energy Community data.
Note that because there are only four links, a registration wall and a tangle of
information on the webpage, we directly connect links to partitions in the metadata. We
don't expect this data to get updated, so this shouldn't pose a problem.
"""
from pudl_archiver.archivers.... | catalyst-cooperative/pudl-archiver | src/pudl_archiver/archivers/doeiraec.py | .py | 1f669f53aca8bb6b | 7.64 | 18 |
"""Download DOE LEAD data.
Each partition includes:
- Data Dictionary
- Census Tracts List
- Cities List
- Counties List
- States List
- Tribal Areas List
- Cities Census Track Overlaps
- Tribal Areas Tract Overlaps
- One .zip file per state, each of which includes:
- AMI Census Tracts
- SMI Census Tracts
- LLSI... | catalyst-cooperative/pudl-archiver | src/pudl_archiver/archivers/doelead.py | .py | 7d55f57fb299ac90 | 7.64 | 18 |
"""Download EIA 176 data.
EIA 176 data is contained in three formats:
1. A bulk zipfile download (which also contains some EIA 191 data). As of 11/2025, this
should contain all data but has some missing data relative to the reports that is
not well explained.
2. Pre-defined reports which contain different slic... | catalyst-cooperative/pudl-archiver | src/pudl_archiver/archivers/eia/eia176.py | .py | 671eacf2f8200b10 | 7.64 | 18 |
"""Download EIA 191 data."""
import logging
import zipfile
from collections import defaultdict
import pandas as pd
from pudl_archiver.archivers.classes import (
ArchiveAwaitable,
ResourceInfo,
)
from pudl_archiver.archivers.eia.naturalgas import EIANaturalGasData, EiaNGQVArchiver
from pudl_archiver.frictionl... | catalyst-cooperative/pudl-archiver | src/pudl_archiver/archivers/eia/eia191.py | .py | 41aa6c5c3f765523 | 7.64 | 18 |
"""Download EIA-860 data."""
import re
from pudl_archiver.archivers.classes import (
AbstractDatasetArchiver,
ArchiveAwaitable,
ResourceInfo,
)
BASE_URL = "https://www.eia.gov/electricity/data/eia860"
class Eia860Archiver(AbstractDatasetArchiver):
"""EIA 860 archiver."""
name = "eia860"
a... | catalyst-cooperative/pudl-archiver | src/pudl_archiver/archivers/eia/eia860.py | .py | 0a2652e09e8414a0 | 7.64 | 18 |
"""Download EIA-860M data."""
import calendar
import re
from collections import defaultdict
from typing import ClassVar
from pudl_archiver.archivers.classes import (
AbstractDatasetArchiver,
ArchiveAwaitable,
ResourceInfo,
)
from pudl_archiver.frictionless import ZipLayout
BASE_URL = "https://www.eia.gov... | catalyst-cooperative/pudl-archiver | src/pudl_archiver/archivers/eia/eia860m.py | .py | 3698596bbfc0b1d9 | 7.64 | 18 |
"""Download EIA-861 data."""
import re
from pathlib import Path
from pudl_archiver.archivers.classes import (
AbstractDatasetArchiver,
ArchiveAwaitable,
ResourceInfo,
)
BASE_URL = "https://www.eia.gov/electricity/data/eia861"
class Eia861Archiver(AbstractDatasetArchiver):
"""EIA 861 archiver."""
... | catalyst-cooperative/pudl-archiver | src/pudl_archiver/archivers/eia/eia861.py | .py | 144f6f5b32a3d22a | 7.64 | 18 |
"""Download EIA-923 data."""
import re
from pathlib import Path
from pudl_archiver.archivers.classes import (
AbstractDatasetArchiver,
ArchiveAwaitable,
ResourceInfo,
)
BASE_URL = "https://www.eia.gov/electricity/data/eia923"
class Eia923Archiver(AbstractDatasetArchiver):
"""EIA 923 archiver."""
... | catalyst-cooperative/pudl-archiver | src/pudl_archiver/archivers/eia/eia923.py | .py | b1821d251f623157 | 7.64 | 18 |
"""Download EIA-930 data."""
import re
from pathlib import Path
from urllib.parse import urljoin
import pandas as pd
from playwright.async_api import async_playwright, expect
from pudl_archiver.archivers.classes import (
AbstractDatasetArchiver,
ArchiveAwaitable,
ResourceInfo,
)
from pudl_archiver.fricti... | catalyst-cooperative/pudl-archiver | src/pudl_archiver/archivers/eia/eia930.py | .py | 5541da0ccfc10a4d | 7.64 | 18 |
"""Download EIA Annual Energy Outlook data."""
import re
from pathlib import Path
from pudl_archiver.archivers.classes import (
AbstractDatasetArchiver,
ArchiveAwaitable,
ResourceInfo,
)
BASE_URL = "https://www.eia.gov/opendata/bulk"
class EiaAeoArchiver(AbstractDatasetArchiver):
"""EIA AEO archive... | catalyst-cooperative/pudl-archiver | src/pudl_archiver/archivers/eia/eiaaeo.py | .py | c6200300375a58f0 | 7.64 | 18 |
"""Download all bulk data files from EIA API."""
import re
from pathlib import Path
from pudl_archiver.archivers.classes import (
AbstractDatasetArchiver,
ArchiveAwaitable,
ResourceInfo,
)
class EiaApiFileArchiver(AbstractDatasetArchiver):
"""EIA bulk file archiver."""
name = "eiaapi"
asyn... | catalyst-cooperative/pudl-archiver | src/pudl_archiver/archivers/eia/eiaapi.py | .py | 6e41eabe03d37616 | 7.64 | 18 |
"""Download EIA Project BlueSky Github respository."""
import asyncio
import os
import subprocess
from pathlib import Path
from pudl_archiver.archivers.classes import (
AbstractDatasetArchiver,
ArchiveAwaitable,
ResourceInfo,
)
from pudl_archiver.frictionless import ZipLayout
BASE_URL = "https://github.c... | catalyst-cooperative/pudl-archiver | src/pudl_archiver/archivers/eia/eiabluesky.py | .py | c428c9326c6590ed | 7.64 | 18 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.