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
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under th...
AI4SIM/model-collection
weather-forecast/ecrad-3d-correction/unets/tests/test_dataproc.py
.py
349b095661643d2f
8.12
16
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under th...
AI4SIM/model-collection
weather-forecast/ecrad-3d-correction/unets/tests/test_models.py
.py
2cbfb54e12d8bec1
8.12
16
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under th...
AI4SIM/model-collection
weather-forecast/ecrad-3d-correction/unets/tests/test_unet.py
.py
201a3b40876ac49c
8.12
16
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under th...
AI4SIM/model-collection
weather-forecast/ecrad-3d-correction/unets/unet.py
.py
a2d89afb8834f9ef
7.62
16
"""This module proposes Pytorch style Dataset classes for the gwd use-case.""" # 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 req...
AI4SIM/model-collection
weather-forecast/gravity-wave-drag/cnns/data.py
.py
55a695d4c8b22758
7.62
16
import asyncio import logging import socket from datetime import datetime, timedelta from typing import Optional class Mutex: """A simple mutex mechanism to prevent concurrent synchronization to the same target host.""" DEFAULT_FILEPATH = '~/.livesync_mutex' def __init__(self, host: str, port: int) -> No...
zauberzeug/livesync
livesync/mutex.py
.py
08a670df9ee685d1
7.66
20
"""Translate ``.syncignore`` patterns into rsync filter rules, supporting negation (!) prefixes.""" from typing import List def get_rsync_filter_rules(patterns: List[str]) -> List[str]: """Convert .syncignore patterns to rsync filter rules. Rules are emitted in reverse .syncignore order so rsync's first-matc...
zauberzeug/livesync
livesync/syncignore.py
.py
131c06940ca45cb2
7.66
20
from datetime import datetime from typing import Any, Optional import pendulum from sqlalchemy import DateTime, TypeDecorator utc = pendulum.tz.timezone("UTC") class UtcDateTime(TypeDecorator): # type: ignore[type-arg] """ Almost equivalent to :class:`~sqlalchemy.types.DateTime` with ``timezone=True`` ...
Jorricks/DutyBoard
duty_board/alchemy/sqlalchemy_types.py
.py
90eb8fe6a81328c4
7.52
10
import os from logging.config import fileConfig from alembic import context from sqlalchemy import create_engine from duty_board.alchemy.settings import Base from duty_board.models.calendar import Calendar from duty_board.models.on_call_event import OnCallEvent from duty_board.models.person import Person from duty_bo...
Jorricks/DutyBoard
duty_board/alembic/env.py
.py
ea7f03618869807f
7.52
10
"""initial version Revision ID: 9af1232f6bc0 Revises: Create Date: 2023-11-28 11:13:26.408554 """ from typing import Sequence, Union import sqlalchemy as sa from alembic import op from duty_board.alchemy.sqlalchemy_types import UtcDateTime # revision identifiers, used by Alembic. revision: str = "9af1232f6bc0" dow...
Jorricks/DutyBoard
duty_board/alembic/versions/2023_11_28_1113-9af1232f6bc0_initial_version.py
.py
3e53b8af458771ca
7.52
10
"""Add field to contain extra information of a Calendar Revision ID: 2e1f3badfabe Revises: 9af1232f6bc0 Create Date: 2024-08-31 12:20:01.752969 """ from typing import Sequence, Union import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision: str = "2e1f3badfabe" down_revision:...
Jorricks/DutyBoard
duty_board/alembic/versions/2024_08_31_1220-2e1f3badfabe_add_field_to_contain_extra_information_.py
.py
8f5986d015019812
7.52
10
from typing import TYPE_CHECKING from pendulum.datetime import DateTime from sqlalchemy import ForeignKey, Integer, String from sqlalchemy.orm import Mapped, mapped_column, relationship from duty_board.alchemy.settings import Base from duty_board.alchemy.sqlalchemy_types import UtcDateTime from duty_board.models.cale...
Jorricks/DutyBoard
duty_board/models/on_call_event.py
.py
9f267042fd319d25
7.52
10
import datetime import logging from abc import ABC, abstractmethod from pathlib import Path from typing import Any, ClassVar, List, Optional, Set from sqlalchemy.orm import Session as SASession from duty_board.models.calendar import Calendar from duty_board.models.person import Person from duty_board.plugin.helpers.d...
Jorricks/DutyBoard
duty_board/plugin/abstract_plugin.py
.py
d384d563f8e13e5d
7.52
10
import logging from typing import List, Optional, Tuple import pytz import requests from ical_library import client from ical_library.help_modules import dt_utils from ical_library.ical_components.v_calendar import VCalendar from ical_library.ical_components.v_event import VEvent from ical_library.timeline import Time...
Jorricks/DutyBoard
duty_board/plugin/ical_plugin_mixin.py
.py
bffdc14a7433ad72
7.52
10
import asyncio import io import json import logging import os from typing import ( Any, ClassVar, Dict, List, Mapping, Optional, Tuple, Union, ) from ldap3.core.exceptions import LDAPExceptionError from PIL import Image from sqlalchemy.orm import Session as SASession from duty_board.mo...
Jorricks/DutyBoard
duty_board/plugin/ldap_plugin_mixin.py
.py
ac773a83717d665a
7.52
10
#!/usr/bin/env python import time from mininet.net import Mininet from mininet.log import setLogLevel from future import standard_library standard_library.install_aliases() from subprocess import call as subprocess_call # noqa: E402 def call(args): subprocess_call(args, shell=True) def wait_for_cmd_output(hos...
bobuhiro11/mininetlab
mininetlab/ovs_srv6.py
.py
a41dc29b1adc45fa
7.65
19
import re import m2r2 def read(fname): """Read a file.""" return open(fname).read() def absolute_links(txt): """Replace relative petab github links by absolute links.""" repo = "petab-dev/libpetab-python" raw_base = f"(https://raw.githubusercontent.com/{repo}/master/" embedded_base = f"(htt...
PEtab-dev/libpetab-python
doc/md2rst.py
.py
799c8519070726fd
7.63
17
#!/usr/bin/env python3 """Command line tool to check for correct format""" import argparse import logging import sys import typing import pydantic from colorama import Fore from colorama import init as init_colorama from jsonschema.exceptions import ValidationError as SchemaValidationError import petab.v1 as petab ...
PEtab-dev/libpetab-python
petab/petablint.py
.py
2d882e7c957a056d
7.63
17
"""Functions performing various calculations.""" import numbers import operator from functools import reduce import numpy as np import pandas as pd import sympy as sp import petab.v1 as petab from .C import * from .math import sympify_petab __all__ = [ "calculate_chi2", "calculate_chi2_for_table_from_resid...
PEtab-dev/libpetab-python
petab/v1/calculate.py
.py
1b3da582249d1329
7.63
17
"""PEtab problems consisting of multiple models""" import os import pandas as pd from . import parameters, problem, yaml from .C import * __all__ = ["CompositeProblem"] class CompositeProblem: """Representation of a PEtab problem consisting of multiple models Attributes: problems: Lis...
PEtab-dev/libpetab-python
petab/v1/composite_problem.py
.py
8eff0d0bc5d9b3fe
7.63
17
"""Functions operating on the PEtab condition table""" from collections.abc import Iterable from pathlib import Path import numpy as np import pandas as pd from . import core, lint from .C import * __all__ = [ "create_condition_df", "get_condition_df", "get_parametric_overrides", "write_condition_df...
PEtab-dev/libpetab-python
petab/v1/conditions.py
.py
faab5eb4b8ff2bb6
7.63
17
"""PEtab core functions (or functions that don't fit anywhere else)""" import logging import os import re from collections.abc import Callable, Iterable, Sequence from pathlib import Path from typing import ( Any, ) from warnings import warn import numpy as np import pandas as pd from pandas.api.types import is_s...
PEtab-dev/libpetab-python
petab/v1/core.py
.py
512a1d10814b4e2b
7.63
17
"""Functionality related to the PEtab entity mapping table""" # TODO: Move to petab.v2.mapping from pathlib import Path import pandas as pd from . import lint from .C import * from .models import Model __all__ = [ "check_mapping_df", "get_mapping_df", "resolve_mapping", "write_mapping_df", ] def g...
PEtab-dev/libpetab-python
petab/v1/mapping.py
.py
da1a64105c9183e2
7.63
17
"""PEtab-math to sympy conversion.""" import sympy as sp from sympy.logic.boolalg import Boolean, BooleanFalse, BooleanTrue from ._generated.PetabMathExprParser import PetabMathExprParser from ._generated.PetabMathExprParserVisitor import PetabMathExprParserVisitor __all__ = ["MathVisitorSympy"] # Mappings of PEtab...
PEtab-dev/libpetab-python
petab/v1/math/SympyVisitor.py
.py
b1e34c362070a34f
7.63
17
"""A PEtab-compatible sympy string-printer.""" import typing from itertools import chain, islice import sympy as sp from sympy.printing.str import StrPrinter __all__ = ["PetabStrPrinter", "petab_math_str"] class PetabStrPrinter(StrPrinter): """A PEtab-compatible sympy string-printer.""" #: Mapping of symp...
PEtab-dev/libpetab-python
petab/v1/math/printer.py
.py
4e23fd5f90e0244d
7.63
17
"""PEtab math to sympy conversion.""" import numpy as np import sympy as sp from antlr4 import CommonTokenStream, InputStream from antlr4.error.ErrorListener import ErrorListener from . import petab_math_str from ._generated.PetabMathExprLexer import PetabMathExprLexer from ._generated.PetabMathExprParser import Peta...
PEtab-dev/libpetab-python
petab/v1/math/sympify.py
.py
6f0ab482452aa1dd
7.63
17
"""Functions operating on the PEtab measurement table""" import itertools import math import numbers from pathlib import Path import numpy as np import pandas as pd from . import core, lint, observables from .C import * __all__ = [ "assert_overrides_match_parameter_count", "create_measurement_df", "get_...
PEtab-dev/libpetab-python
petab/v1/measurements.py
.py
9233e20d2cf0878e
7.63
17
"""BNGL (BioNetGen Language) model support for PEtab. Adds a ``bngl`` model type, so a PEtab problem declaring ``language: bngl`` can be loaded and validated. :class:`BnglModel` is backed by :func:`parse_bngl`, a small, dependency-free BNGL reader. It only reads a model's declared entities -- parameters, observables,...
PEtab-dev/libpetab-python
petab/v1/models/bngl_model.py
.py
bb5fe162b9496ed3
7.63
17
"""Functions for handling PySB models""" from __future__ import annotations import itertools import re import sys from collections.abc import Iterable from pathlib import Path from typing import Any import pysb from ..._utils import _generate_path from .. import is_valid_identifier from . import MODEL_TYPE_PYSB fro...
PEtab-dev/libpetab-python
petab/v1/models/pysb_model.py
.py
2be5cdeb979f104a
7.63
17
"""Functions for handling SBML models""" from __future__ import annotations import itertools from collections.abc import Iterable from pathlib import Path import libsbml import sympy as sp from sbmlmath import sbml_math_to_sympy from ..._utils import _generate_path from ..sbml import ( get_sbml_model, is_sb...
PEtab-dev/libpetab-python
petab/v1/models/sbml_model.py
.py
2eade80bcba1fe38
7.63
17
"""Functions for working with the PEtab observables table""" import re from collections import OrderedDict from pathlib import Path from typing import Literal import pandas as pd from . import core, lint from .C import * from .math import sympify_petab from .models import Model __all__ = [ "create_observable_df...
PEtab-dev/libpetab-python
petab/v1/observables.py
.py
ea6dd0a8d5603ce3
7.63
17
"""Functions related to prior handling.""" from __future__ import annotations import copy from typing import Literal import numpy as np import pandas as pd from ..v1.C import PREEQUILIBRATION_CONDITION_ID from . import ( ESTIMATE, LAPLACE, LIN, LOG, LOG10, LOG_LAPLACE, LOG_NORMAL, ME...
PEtab-dev/libpetab-python
petab/v1/priors.py
.py
96c52d607c48bbde
7.63
17
"""Functions related to parameter sampling""" from collections.abc import Sequence import numpy as np import pandas as pd from .C import * __all__ = ["sample_from_prior", "sample_parameter_startpoints"] def sample_from_prior( prior: tuple[str, list, str, list], n_starts: int ) -> np.array: """Creates samp...
PEtab-dev/libpetab-python
petab/v1/sampling.py
.py
eaf8e759a36aaa5a
7.63
17
"""Functions for interacting with SBML models""" import contextlib import logging from numbers import Number from pathlib import Path from warnings import warn import libsbml from pandas.io.common import get_handle, is_file_like, is_url import petab.v1 as petab logger = logging.getLogger(__name__) __all__ = [ "...
PEtab-dev/libpetab-python
petab/v1/sbml.py
.py
44769698ce32b95c
7.63
17
"""Functionality for simplifying PEtab problems""" from math import nan import pandas as pd import petab.v1 as petab from . import Problem from .C import * from .lint import lint_problem __all__ = [ "condition_parameters_to_parameter_table", "remove_nan_measurements", "remove_unused_conditions", "r...
PEtab-dev/libpetab-python
petab/v1/simplify.py
.py
8d9c65e1b29e3123
7.63
17
"""PEtab simulator base class and related functions.""" from __future__ import annotations import abc import pathlib import shutil import tempfile from warnings import warn import numpy as np import pandas as pd import sympy as sp import petab.v1 as petab __all__ = ["Simulator", "sample_noise"] class Simulator(a...
PEtab-dev/libpetab-python
petab/v1/simulate.py
.py
fd1e2f875bb64b0c
7.63
17
""" Functions for creating an overview report of a PEtab problem """ from pathlib import Path from shutil import copyfile import pandas as pd import petab.v1 as petab from petab.v1.C import ( MEASUREMENT, OBSERVABLE_ID, PREEQUILIBRATION_CONDITION_ID, SIMULATION_CONDITION_ID, ) __all__ = ["create_rep...
PEtab-dev/libpetab-python
petab/v1/visualize/data_overview.py
.py
144e77208de50129
7.63
17
""" This file should contain the functions, which PEtab internally needs for plotting, but which are not meant to be used by non-developers and should hence not be directly visible/usable when using `import petab.visualize`. """ import pandas as pd from ..C import * # for typehints IdsList = list[str] NumList = list...
PEtab-dev/libpetab-python
petab/v1/visualize/helper_functions.py
.py
4601abab9ff07a8b
7.63
17
"""Validation of PEtab visualization files""" from __future__ import annotations import logging import pandas as pd from .. import C, Problem from ..C import VISUALIZATION_DF_REQUIRED_COLS logger = logging.getLogger(__name__) __all__ = ["validate_visualization_df"] def validate_visualization_df(problem: Problem...
PEtab-dev/libpetab-python
petab/v1/visualize/lint.py
.py
8759e66403280ef9
7.63
17
"""Code regarding the PEtab YAML config files""" from __future__ import annotations import os from pathlib import Path, PurePosixPath from typing import Any from urllib.parse import unquote, urlparse, urlunparse import jsonschema import numpy as np import pandas as pd import yaml from pandas.io.common import get_han...
PEtab-dev/libpetab-python
petab/v1/yaml.py
.py
0398534da6db5d25
7.63
17
# SPDX-FileCopyrightText: 2025 European Centre for Medium-Range Weather Forecasts (ECMWF) # SPDX-License-Identifier: Apache-2.0 """Utilities to work with climatologies. .. seealso:: :py:mod:`earthkit.transforms.climatology` """ from dataclasses import dataclass from typing import Literal, Optional import numpy as n...
ecmwf/earthkit-climate
src/earthkit/climate/utils/climatology.py
.py
e3b9c4664785592d
7.42
6
# SPDX-FileCopyrightText: 2025 European Centre for Medium-Range Weather Forecasts (ECMWF) # SPDX-License-Identifier: Apache-2.0 """Shared Pytest fixtures for integration tests.""" from contextlib import nullcontext from typing import Any, Callable, Optional import earthkit.data as ekd import pytest import xarray as ...
ecmwf/earthkit-climate
tests/integration/conftest.py
.py
4ce7f2488dbaee6a
7.92
6
# SPDX-FileCopyrightText: 2025 European Centre for Medium-Range Weather Forecasts (ECMWF) # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import xarray as xr import earthkit.climate as ekc @pytest.mark.parametrize("frequency", ["season", "month", "dayofyear"]) def test_upsample_scalar_fails_w...
ecmwf/earthkit-climate
tests/unit/utils/test_climatology.py
.py
23b1a1f4cf0cefaa
7.92
6
# pylint: disable=import-error """ Show information about a specific user based on the user's query Functions: user_info(query: str) -> str calculate_lucky_no(birthday: str) -> str Author: @dilshan-h (https://github.com/dilshan-h) """ from functools import lru_cache import os import csv from cryptography.fe...
Dilshan-H/bla-bot
about_user.py
.py
3935b877d667dbfc
7.5
9
# pylint: disable=line-too-long import-error """ Get GPA values from results.csv for all users and filter according to the request Functions: get_gpa(user_id: str, step: int) -> List[str] calculate_gpa(user_nic: str) -> str academic_status(cgpa: float) -> str Author: @dilshan-h (https://github.com/dilsh...
Dilshan-H/bla-bot
gpa_values.py
.py
78cfe80f3022b241
7.5
9
# pylint: disable=import-error """ Get birthdays for a specific date from a CSV file and return wishes for each user with a random text Functions: get_birthdays() -> List[str] Author: @dilshan-h (https://github.com/dilshan-h) """ import os from typing import List import csv from datetime import datetime from ra...
Dilshan-H/bla-bot
manage_bdays.py
.py
30f8ca0f23ae8a0e
7.5
9
import asyncio import pytest from arclet.letoderea.effect import EffectManager from arclet.letoderea.utils import DisposableList def test_disposable_list(): objects = [lambda: None for _ in range(5)] dl = DisposableList(objects[:3]) assert len(dl) == 3 dispose1 = dl.append(objects[3]) assert le...
ArcletProject/Letoderea
tests/test_effect.py
.py
aed58a44508e57ad
7.02
10
# abcp.py """ Модуль работы с ABCP API. Поиск товаров через операцию search/batch. """ import time import hashlib import requests from utils import ( chunked, safe_float, safe_int ) class ABCPClient: """ Клиент для работы с ABCP API. """ def __init__(self, host: str, login: str...
maxexplorer/ParserProject
autoparts_api_prices/abcp.py
.py
85996e4460755911
7.45
7
# autotrade.py """ Модуль работы с Autotrade API. Получение цен и остатков товаров через метод getStocksAndPrices. """ import time import json import hashlib import requests from utils import ( chunked, safe_float, safe_int ) class AutotradeClient: """ Клиент для работы с Autotrade API. "...
maxexplorer/ParserProject
autoparts_api_prices/autotrade.py
.py
6e63f573023e5aa0
7.45
7
# froza_client.py """ Модуль работы с Froza XML API. Поиск товаров через search_xml4.php (price_list). """ import time import xml.etree.ElementTree as ET import requests from utils import ( safe_float, safe_int ) class FrozaClient: """ Клиент для работы с Froza API. """ def __init__(self...
maxexplorer/ParserProject
autoparts_api_prices/froza_client.py
.py
bb642fb036f0731a
7.45
7
import os import glob import pandas as pd def process_excel_file(path: str) -> dict: """ Parses the invoice into two blocks: 1) summary: totals from item rows 2) serials: article + serial rows, with blanks for items without serial details """ df: pd.DataFrame = pd.read_excel(path, header=None)...
maxexplorer/ParserProject
autoparts_info_excel/main.py
.py
0ed644d4df5ecbc4
7.45
7
import os from datetime import datetime from openpyxl import load_workbook, Workbook def read_old_articles_data(old_articles_file): """Чтение данных из файла 'старые артикулы.xlsx'""" wb = load_workbook(old_articles_file) ws = wb.active articles_dict = {} for row in ws.iter_rows(min_row=2, max_c...
maxexplorer/ParserProject
autoparts_prices_update/main.py
.py
b1c1b698e9da2607
7.45
7
# parser.py import re from aiogram import Bot from telethon import events from telegram_client import get_client class TelegramKeywordParser: def __init__(self, keywords, stopwords, chats, bot: Bot, chat_id, exceptions, print_dialogs=False): self.keywords = [kw.lower() for kw in keywords] self....
maxexplorer/ParserProject
chat_parser_app/parser.py
.py
3969df7269c20f4e
7.45
7
import os import re import glob import warnings import requests import pandas as pd from datetime import datetime from bs4 import BeautifulSoup, XMLParsedAsHTMLWarning from concurrent.futures import ThreadPoolExecutor, as_completed from requests.exceptions import RequestException, SSLError warnings.filterwarnings("ig...
maxexplorer/ParserProject
check_website/main.py
.py
64f4d4cb1915b09e
7.45
7
import time from datetime import datetime import os import random import requests from bs4 import BeautifulSoup from pandas import DataFrame, ExcelWriter start_time = datetime.now() headers = { 'Accept': '*/*', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36' ' ...
maxexplorer/ParserProject
chyi_site/main.py
.py
d0d1ebd944bfba80
7.45
7
# command_processor.py from macros import macros, command_map class CommandProcessor: """ Класс для обработки команд CSV и генерации блоков G-кода. Атрибуты: blocks (List[str]): Список строк G-кода для текущей строки CSV. commands_in_row (List[str]): Список обработанных команд в строке. ...
maxexplorer/ParserProject
csv_gcode/command_processor.py
.py
f76cab135255e06c
7.45
7
# processor.py import os import csv import glob from typing import List, Tuple from data import gcode_header from macros import command_map from command_processor import CommandProcessor def process_all_csv(folder: str, output_folder: str) -> None: """ Обрабатывает все CSV-файлы в указанной папке и сохраняе...
maxexplorer/ParserProject
csv_gcode/processor.py
.py
628a9bb38be9ef09
7.45
7
import json from typing import Any, ClassVar, Optional class ApiException(Exception): """The API Exception that is thrown by the Caplena REST API. :param type: The type of the error returned. :param code: A short string that uniquely identifies the reason for this error. Useful for programmatic e...
caplena/caplena-python
caplena/api/api_exception.py
.py
54753bee696b235e
7.48
8
from typing import Type, Union from caplena.api import ApiBaseUri, ApiVersion from caplena.configuration import Configuration from caplena.controllers import ProjectsController from caplena.http.http_client import HttpClient, HttpRetry from caplena.http.requests_http_client import RequestsHttpClient from caplena.loggi...
caplena/caplena-python
caplena/client.py
.py
649d61beead6f9de
7.48
8
from typing import Any, Dict class DuplicatedTopicsError(Exception): """Exception that is thrown when there are two or more topics with identical names provided for TTACell. :param message: A brief human-readable message providing more details about the error that has occurred. Please note that e...
caplena/caplena-python
caplena/errors.py
.py
c24e68a70a070cf6
7.48
8
import os import shutil from libtiff import TIFF # pip install libtiff from scipy import misc import random def tif2png(_src_path, _dst_path): """ Usage: formatting `tif/tiff` files to `jpg/png` files :param _src_path: :param _dst_path: :return: """ tif = TIFF.ope...
xiaolanshu/CSCA-U-Net
utils/format_conversion.py
.py
10803cc891953d99
7.62
16
import torch import numpy as np from thop import profile from thop import clever_format def clip_gradient(optimizer, grad_clip): """ For calibrating misalignment gradient via cliping gradient technique :param optimizer: :param grad_clip: :return: """ for group in optimizer.par...
xiaolanshu/CSCA-U-Net
utils/utils.py
.py
b626f51ccef7a044
7.62
16
#!/usr/bin/env python3 # MIT License # # Copyright (c) 2020 FABRIC Testbed # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to ...
fabric-testbed/fabrictestbed-extensions
fabrictestbed_extensions/editors/abc_topology_editor.py
.py
481ce49b5b09ce41
8
9
#!/usr/bin/env python3 # MIT License # # Copyright (c) 2020 FABRIC Testbed # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to ...
fabric-testbed/fabrictestbed-extensions
fabrictestbed_extensions/editors/cytoscape_topology_editor.py
.py
fdf001ebc158d48d
8
9
#!/usr/bin/env python3 # MIT License # # Copyright (c) 2020 FABRIC Testbed # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to ...
fabric-testbed/fabrictestbed-extensions
fabrictestbed_extensions/fablib/artifact.py
.py
1b786741c2961fef
8
9
"""Custom exception types for FABlib. All exceptions inherit from :class:`FablibException` so callers can catch the base class. They also inherit from appropriate builtins (``ValueError``, ``TimeoutError``, ``RuntimeError``) for compatibility with existing ``except Exception:`` handlers. """ class FablibException(E...
fabric-testbed/fabrictestbed-extensions
fabrictestbed_extensions/fablib/exceptions.py
.py
65a6bf6f70faa16d
7
9
#!/usr/bin/env python3 # MIT License # # Copyright (c) 2020 FABRIC Testbed # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to ...
fabric-testbed/fabrictestbed-extensions
fabrictestbed_extensions/fablib/facility_port.py
.py
a65a8be9bd928eb3
8
9
#!/usr/bin/env python3 # MIT License # # Copyright (c) 2020 FABRIC Testbed # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to ...
fabric-testbed/fabrictestbed-extensions
fabrictestbed_extensions/fablib/interface.py
.py
7a4aecbe13ea7b09
7
9
#!/usr/bin/env python3 # MIT License # # Copyright (c) 2020 FABRIC Testbed # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to ...
fabric-testbed/fabrictestbed-extensions
fabrictestbed_extensions/fablib/switch.py
.py
f2db90701907380f
8
9
from __future__ import annotations import json from abc import abstractmethod import jinja2 from fabrictestbed.slice_editor import UserData from fabrictestbed_extensions.utils.utils import Utils class TemplateMixin: """Mixin providing Jinja2 template rendering for FABRIC resource classes. Subclasses may o...
fabric-testbed/fabrictestbed-extensions
fabrictestbed_extensions/fablib/template_mixin.py
.py
117f432db3bc9763
8
9
#!/usr/bin/env python3 # MIT License # # Copyright (c) 2020 FABRIC Testbed # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to ...
fabric-testbed/fabrictestbed-extensions
fabrictestbed_extensions/fablib/validator.py
.py
15f83f159bb55624
8
9
#!/usr/bin/env python3 # MIT License # # Copyright (c) 2020 FABRIC Testbed # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to ...
fabric-testbed/fabrictestbed-extensions
fabrictestbed_extensions/ui/artifact_manager_ui.py
.py
3da98baa8d2574f3
8
9
#!/usr/bin/env python3 # MIT License # # Copyright (c) 2020 FABRIC Testbed # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to ...
fabric-testbed/fabrictestbed-extensions
fabrictestbed_extensions/utils/abc_utils.py
.py
1f4df3ca4f53f961
8
9
# CephFsUtils.py from __future__ import annotations import json import os import re from pathlib import Path from typing import Any, Dict, List, Optional, Tuple try: from fabric_ceph_client import CephManagerClient except Exception: from fabric_ceph_client.fabric_ceph_client import CephManagerClient class C...
fabric-testbed/fabrictestbed-extensions
fabrictestbed_extensions/utils/ceph_fs_utils.py
.py
cf30e285733192c9
7
9
#!/usr/bin/env python3 # MIT License # # Copyright (c) 2025 FABRIC Testbed # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to ...
fabric-testbed/fabrictestbed-extensions
fabrictestbed_extensions/utils/ceph_s3_utils.py
.py
c52d4d70f3a8deb2
8
9
#!/usr/bin/env python3 # MIT License # # Copyright (c) 2020 FABRIC Testbed # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to ...
fabric-testbed/fabrictestbed-extensions
fabrictestbed_extensions/utils/node.py
.py
07428f268e425b2c
8
9
#!/usr/bin/env python3 # MIT License # # Copyright (c) 2020 FABRIC Testbed # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to ...
fabric-testbed/fabrictestbed-extensions
fabrictestbed_extensions/utils/slice.py
.py
35701febd70777bf
7
9
import datetime as dt import ftplib import time from functools import lru_cache from quantilica.core.exceptions import FetchError from quantilica.core.ftp import FTP_TRANSIENT_ERRORS, MonitoredFTP from quantilica.core.retry import exponential_delay try: _RICH_AVAILABLE = True except (ModuleNotFoundError, ImportEr...
Quantilica/datasus-fetcher
src/datasus_fetcher/fetcher.py
.py
bec5c6e955a1c359
7.45
7
from .storage import RemoteFile class Slicer: """Filters remote files based on time and regions.""" def __init__( self, start_time: str = "", end_time: str = "", regions: list[str] | None = None, ) -> None: """Initializes the Slicer. Args: star...
Quantilica/datasus-fetcher
src/datasus_fetcher/slicer.py
.py
158573a812f6a54e
7.45
7
import datetime as dt from collections.abc import Generator from dataclasses import dataclass, field from pathlib import Path from quantilica.core.dates import year_month_partition from quantilica.core.exceptions import ParseError from quantilica.core.storage import LocalStorage, build_stamped_filename from . import ...
Quantilica/datasus-fetcher
src/datasus_fetcher/storage.py
.py
861234bed45afab4
7.45
7
from seleniumbase import BaseCase class BaseTestCase(BaseCase): def setUp(self): super().setUp() # <<< Run custom code AFTER the super() line >>> def tearDown(self): self.save_teardown_screenshot() if self.has_exception(): # <<< Run custom code if the ...
mdmintz/seleniumbase-examples
examples/boilerplates/base_test_case.py
.py
1204faf39ad3e745
7.09
14
"""Testing https://developsense.com/calendar/calendar.html""" from seleniumbase import BaseCase BaseCase.main(__name__, __file__) class MyTestClass(BaseCase): def test_developsense_calendar(self): self.open("https://developsense.com/calendar/calendar.html") self.type("#username", "Seleni...
mdmintz/seleniumbase-examples
examples/calendar_test_1.py
.py
346e9bc23b77aecc
8.09
14
import pytest from seleniumbase import BaseCase @pytest.mark.ready class MyTestClass(BaseCase): def test_demo_site(self): self.open("https://seleniumbase.io/demo_page") # Assert the title of the current web page self.assert_title("Web Testing Page") # Assert that th...
mdmintz/seleniumbase-examples
examples/test_demo_site.py
.py
d3ab79db805944e3
7.09
14
""" Testing Drag & Drop on different pages. """ from seleniumbase import BaseCase class DragAndDropTests(BaseCase): def test_drag_and_drop(self): self.open("seleniumbase.io") self.js_click('a[href*="seleniumbase.io/other/drag_and_drop"]') self.assert_element_not_visible("#div1 img#drag1") ...
mdmintz/seleniumbase-examples
examples/test_drag_and_drop.py
.py
e42277f7c66d8012
8.09
14
""" This script installs the chromedriver version that matches your Chrome. On newer versions of Python, you may replace "testdir" with "pytester". (Run with "pytest") """ import subprocess class TestUpgradeChromedriver: def basic_run(self, testdir): testdir.makepyfile( """ from se...
mdmintz/seleniumbase-examples
examples/upgrade_chromedriver.py
.py
628eb0f39b81d9f6
7.59
14
#!/usr/bin/env python3 """Publish every Markdown file under gists/ to gist.github.com. Each file becomes one public gist. The mapping from repository path to gist ID is recorded in gists/published.json and committed back, so a second run updates the gists it created the first time instead of creating duplicates. Stan...
rahul-rocket/rahul-rocket
.github/scripts/publish_gists.py
.py
d9e62b7cde856241
7.42
6
#!/usr/bin/env python3 """Rewrite the Latest Gists section of README.md from the public gists API. Called by .github/workflows/gists.yml. Writes only between the <!--START_SECTION:gists--> and <!--END_SECTION:gists--> markers, and leaves the file untouched when the rendered list is identical to what is already there, ...
rahul-rocket/rahul-rocket
archive/2026-08-07-v4.3.0/scripts/update_gists.py
.py
13976f7f2f7c73ed
7.42
6
# Copyright 2020-2024 Curtin University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
The-Academic-Observatory/academic-observatory-workflows
academic-observatory-workflows/academic_observatory_workflows/config.py
.py
e145736f3263eb9b
7.64
18
# Copyright 2020-2024 Curtin University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
The-Academic-Observatory/academic-observatory-workflows
academic-observatory-workflows/academic_observatory_workflows/crossref_fundref_telescope/telescope.py
.py
a3b9e10ae968521b
7.64
18
import os from unittest.mock import patch from typing import List import shutil from pathlib import Path import pendulum import vcr from academic_observatory_workflows.config import project_path, TestConfig from academic_observatory_workflows.crossref_fundref_telescope.release import CrossrefFundrefRelease from acade...
The-Academic-Observatory/academic-observatory-workflows
academic-observatory-workflows/academic_observatory_workflows/crossref_fundref_telescope/tests/test_tasks.py
.py
72f1f58be6ed0356
8.14
18
# Copyright 2020-2024 Curtin University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
The-Academic-Observatory/academic-observatory-workflows
academic-observatory-workflows/academic_observatory_workflows/crossref_fundref_telescope/tests/test_telescope.py
.py
3ebdffd19930bc73
8.14
18
# Copyright 2020-2024 Curtin University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
The-Academic-Observatory/academic-observatory-workflows
academic-observatory-workflows/academic_observatory_workflows/crossref_metadata_telescope/tasks.py
.py
8eb649fa0919bcc0
7.64
18
# Copyright 2020-2024 Curtin University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
The-Academic-Observatory/academic-observatory-workflows
academic-observatory-workflows/academic_observatory_workflows/crossref_metadata_telescope/telescope.py
.py
7d76c3560cccec70
7.64
18
# Copyright 2020-2024 Curtin University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
The-Academic-Observatory/academic-observatory-workflows
academic-observatory-workflows/academic_observatory_workflows/crossref_metadata_telescope/tests/test_tasks.py
.py
5a727c864fbf2336
7.14
18
# Copyright 2020-2024 Curtin University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
The-Academic-Observatory/academic-observatory-workflows
academic-observatory-workflows/academic_observatory_workflows/crossref_metadata_telescope/tests/test_telescope.py
.py
2550d9a2b1f8414b
8.14
18
# Copyright 2020-2025 Curtin University # Copyright 2024-2025 UC Curation Center (California Digital Library) # # 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/licen...
The-Academic-Observatory/academic-observatory-workflows
academic-observatory-workflows/academic_observatory_workflows/datacite_telescope/datacite_transform.py
.py
fa4cb0b283bea8db
7.64
18
# Copyright 2020-2024 Curtin University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
The-Academic-Observatory/academic-observatory-workflows
academic-observatory-workflows/academic_observatory_workflows/doi_workflow/queries.py
.py
eb17e0bdf9bf4360
7.64
18
# Copyright 2020-2024 Curtin University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
The-Academic-Observatory/academic-observatory-workflows
academic-observatory-workflows/academic_observatory_workflows/doi_workflow/release.py
.py
7510830f0d8f89a2
7.64
18
# Copyright 2020-2024 Curtin University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
The-Academic-Observatory/academic-observatory-workflows
academic-observatory-workflows/academic_observatory_workflows/doi_workflow/tasks.py
.py
07f96944b1b22f1f
7.64
18
import os import unittest from academic_observatory_workflows.config import project_path from academic_observatory_workflows.doi_workflow.queries import get_ancestors, ror_to_ror_hierarchy_index from observatory_platform.files import load_jsonl FIXTURES_FOLDER = project_path("doi_workflow", "tests", "fixtures") cla...
The-Academic-Observatory/academic-observatory-workflows
academic-observatory-workflows/academic_observatory_workflows/doi_workflow/tests/test_queries.py
.py
cedc83c114002de1
8.14
18