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 |
|---|---|---|---|---|---|---|
#!/usr/bin/env python3
from absl import logging
from . import Sensor
import board
import adafruit_bmp3xx
import time
from adafruit_bmp3xx import _REGISTER_CONTROL, _REGISTER_STATUS, _REGISTER_PRESSUREDATA
from types import MethodType
def patch_bmp3xx_read(self):
"""Returns a tuple for temperature and pressure."""... | simpleairquality/SimpleAQ-Device | devices/bmp3xx.py | .py | 57292b6bb1d73157 | 7.42 | 6 |
#!/usr/bin/env python3
from absl import logging
from . import Sensor
import board
import adafruit_lps28
class Lps28(Sensor):
I2C_ADDRESS = 0x5C
def __init__(self, remotestorage, localstorage, timesource, i2c_transceiver, **kwargs):
super().__init__(remotestorage, localstorage, timesource)
self.sensor = ... | simpleairquality/SimpleAQ-Device | devices/lps28.py | .py | 9d33656f95c3a770 | 7.42 | 6 |
#!/usr/bin/env python3
from absl import logging
from . import Sensor
class PCBArtistsDecibel(Sensor):
"""
Driver for the PCBArtists I²C decibel meter.
"""
I2C_ADDRESS = 0x48
DB_REGISTER = 0x0A
def __init__(self, remotestorage, localstorage, timesource, i2c_transceiver, **kwargs):
s... | simpleairquality/SimpleAQ-Device | devices/pcbartists_decibel.py | .py | e62ef0a4304a089b | 7.42 | 6 |
#!/usr/bin/env python3
from absl import logging
from . import Sensor
import board
import adafruit_scd4x
class Scd4x(Sensor):
I2C_ADDRESS = 0x62
def __init__(self, remotestorage, localstorage, timesource, i2c_transceiver, **kwargs):
super().__init__(remotestorage, localstorage, timesource)
self.sensor = ... | simpleairquality/SimpleAQ-Device | devices/scd4x.py | .py | 4282b290f89bf02b | 7.42 | 6 |
"""
Copyright 2026 Adobe
All Rights Reserved.
NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
with the terms of the Adobe license agreement accompanying it.
"""
import atexit
import os
import signal
import sys
# Global registry of container IDs started by this buildrunner process.
# ... | adobe/buildrunner | buildrunner/cleanup.py | .py | 0a23ab9fed239f7b | 7.62 | 16 |
"""
Copyright 2024 Adobe
All Rights Reserved.
NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
with the terms of the Adobe license agreement accompanying it.
"""
import getpass
import logging
import os
import platform as system_platform
import tempfile
from typing import List, Optional... | adobe/buildrunner | buildrunner/config/__init__.py | .py | 8983e2934bed36dd | 7.62 | 16 |
"""
Copyright 2021 Adobe
All Rights Reserved.
NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
with the terms of the Adobe license agreement accompanying it.
"""
import base64
import requests
from ..models import GlobalConfig, GithubModel
from ...errors import (
BuildRunnerConfigu... | adobe/buildrunner | buildrunner/config/fetch/github.py | .py | 23e54ff5ed44624f | 7.62 | 16 |
"""
Copyright 2024 Adobe
All Rights Reserved.
NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
with the terms of the Adobe license agreement accompanying it.
"""
import codecs
import copy
import datetime
import re
from io import StringIO
from typing import Callable
import jinja2
from... | adobe/buildrunner | buildrunner/config/jinja_context.py | .py | 9374e377d48a440b | 7.62 | 16 |
"""
Copyright 2024 Adobe
All Rights Reserved.
NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
with the terms of the Adobe license agreement accompanying it.
"""
import base64
from collections import OrderedDict
import copy
import functools
import getpass
from graphlib import Topologic... | adobe/buildrunner | buildrunner/config/loader.py | .py | 16c4302da9ab14ee | 7.62 | 16 |
"""
Copyright 2024 Adobe
All Rights Reserved.
NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
with the terms of the Adobe license agreement accompanying it.
"""
import os
import tempfile
from copy import deepcopy
from typing import Any, Dict, List, Optional, Tuple, Union
from pydanti... | adobe/buildrunner | buildrunner/config/models.py | .py | 4e50e57954c6d2ae | 7.62 | 16 |
"""
Copyright 2024 Adobe
All Rights Reserved.
NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
with the terms of the Adobe license agreement accompanying it.
"""
from typing import Any, Dict, List, Optional, Union
from pydantic import (
BaseModel,
BeforeValidator,
Field,
... | adobe/buildrunner | buildrunner/config/models_step.py | .py | 6f55d94f4c738e3f | 7.62 | 16 |
"""
Copyright 2024 Adobe
All Rights Reserved.
NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
with the terms of the Adobe license agreement accompanying it.
"""
import os
from typing import Dict, List, Optional, Set, Union
from pydantic import ValidationError
from .models_step impor... | adobe/buildrunner | buildrunner/config/validation.py | .py | 2684edcf8a459d28 | 7.62 | 16 |
"""
Copyright 2021 Adobe
All Rights Reserved.
NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
with the terms of the Adobe license agreement accompanying it.
"""
import os
import ssl
import tempfile
from typing import Tuple
import urllib.parse
import docker
from buildrunner.errors imp... | adobe/buildrunner | buildrunner/docker/__init__.py | .py | a384bdd58ae622dd | 7.62 | 16 |
"""
Copyright 2021 Adobe
All Rights Reserved.
NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
with the terms of the Adobe license agreement accompanying it.
"""
import os
from buildrunner.cleanup import register_container, unregister_container
from buildrunner.docker import DOCKER_D... | adobe/buildrunner | buildrunner/docker/daemon.py | .py | 2930737b83e64ad1 | 7.62 | 16 |
"""
Copyright 2023 Adobe
All Rights Reserved.
NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
with the terms of the Adobe license agreement accompanying it.
"""
import logging
import platform as python_platform
from typing import Dict, List, Optional
from pydantic import BaseModel
... | adobe/buildrunner | buildrunner/docker/image_info.py | .py | 3c97eb06f7a67eaa | 7.62 | 16 |
"""
Copyright 2021 Adobe
All Rights Reserved.
NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
with the terms of the Adobe license agreement accompanying it.
"""
import yaml
import docker
import docker.errors
from buildrunner.docker import new_client
from buildrunner.errors import Bu... | adobe/buildrunner | buildrunner/docker/importer.py | .py | ed04dbac7b9b8461 | 7.62 | 16 |
"""
Copyright 2024 Adobe
All Rights Reserved.
NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
with the terms of the Adobe license agreement accompanying it.
"""
import logging
import os
import sys
import queue
from typing import Optional, Union
import colorlog
from rich import progre... | adobe/buildrunner | buildrunner/loggers.py | .py | b79ff86aed9b7803 | 7.62 | 16 |
"""
Copyright 2021 Adobe
All Rights Reserved.
NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
with the terms of the Adobe license agreement accompanying it.
"""
import json
import os
import requests
from buildrunner.errors import BuildRunnerProvisionerError
class SaltProvisioner:
... | adobe/buildrunner | buildrunner/provisioners/salt.py | .py | f0ad4af8faa2b312 | 7.62 | 16 |
"""
Copyright 2021 Adobe
All Rights Reserved.
NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
with the terms of the Adobe license agreement accompanying it.
"""
from buildrunner.errors import BuildRunnerProvisionerError
class ShellProvisioner:
"""
Provisioner used to run a s... | adobe/buildrunner | buildrunner/provisioners/shell.py | .py | ef8e7e07779651e2 | 7.62 | 16 |
"""
Copyright 2021 Adobe
All Rights Reserved.
NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
with the terms of the Adobe license agreement accompanying it.
"""
import os
import io
import struct
import threading
import time
import urllib.parse
from paramiko import (
DSSKey,
M... | adobe/buildrunner | buildrunner/sshagent/__init__.py | .py | 3d82c13f9ad05739 | 7.62 | 16 |
"""
Copyright 2021 Adobe
All Rights Reserved.
NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
with the terms of the Adobe license agreement accompanying it.
"""
import os
import traceback
import uuid
from buildrunner.docker.multiplatform_image_builder import MultiplatformImageBuilder... | adobe/buildrunner | buildrunner/steprunner/__init__.py | .py | 52d6d9047c3b2f3f | 7.62 | 16 |
"""
Copyright 2024 Adobe
All Rights Reserved.
NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
with the terms of the Adobe license agreement accompanying it.
"""
import glob
import os
import re
from buildrunner import loggers
import buildrunner.docker
from buildrunner.config import B... | adobe/buildrunner | buildrunner/steprunner/tasks/build.py | .py | 6d1a99b2697c273d | 7.62 | 16 |
"""
Copyright 2021 Adobe
All Rights Reserved.
NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
with the terms of the Adobe license agreement accompanying it.
"""
from typing import List, Optional
from buildrunner.config.models_step import StepPypiPush
from buildrunner.errors import (
... | adobe/buildrunner | buildrunner/steprunner/tasks/pypipush.py | .py | 3f03b42c0fc6b0ca | 7.62 | 16 |
"""
Copyright 2021 Adobe
All Rights Reserved.
NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
with the terms of the Adobe license agreement accompanying it.
"""
from collections import OrderedDict
from datetime import datetime
import io
import logging
import os
import re
import sys
im... | adobe/buildrunner | buildrunner/utils.py | .py | be25359f4aeb9917 | 7.62 | 16 |
import os
import random
import pytest
import platform
import subprocess
import tempfile
from pathlib import Path
from typing import List, Optional, Tuple
from tests import test_runner
# This should match what is in the dot-buildrunner.yaml file
TEST_SSH_KEY_FILE = "/tmp/buildrunner-test-id_rsa"
test_dir_path = os.pa... | adobe/buildrunner | tests/test_buildrunner_files.py | .py | 464cab1e03856d1b | 7.12 | 16 |
"""
Tests for the buildrunner.cleanup module — signal-handler-based container cleanup.
"""
from unittest import mock
import pytest
from buildrunner.cleanup import (
_force_cleanup_all,
_registered_containers,
install_signal_handlers,
register_container,
set_docker_client,
unregister_container... | adobe/buildrunner | tests/test_cleanup.py | .py | e1532d1b745c2aac | 7.12 | 16 |
import argparse
import os
import pytest
import yaml
from unittest import mock
from buildrunner import cli
class ExitError(BaseException):
pass
class MockedArgs(argparse.Namespace):
def __init__(self, args_dict: dict) -> None:
super().__init__(**args_dict)
self.args_dict = args_dict
de... | adobe/buildrunner | tests/test_cli.py | .py | 2c2fdad3993c5ad4 | 8.12 | 16 |
#!/usr/bin/env python3
"""Release helper: bump the version, stamp the changelog, and commit + tag it.
Usage:
scripts/bump.py [patch|minor|major]
With no argument, the patch version is bumped. The script will:
1. Increment the ``version`` in ``pyproject.toml``.
2. Rename the pending changelog section ("## Cur... | mik3y/django-simple-timeseries | scripts/bump.py | .py | 947282a8f6df2e1b | 7.48 | 8 |
#!/usr/bin/env python3
"""Render the public API reference from docstrings into docs/api.md.
The reference is generated from the library's public docstrings via pydoc-markdown
(see `pydoc-markdown.yml`). Docstrings are the single source of truth; the README
links to the generated file rather than duplicating it.
Usage... | mik3y/django-simple-timeseries | scripts/gen_api_docs.py | .py | 164dcc225b208e86 | 7.48 | 8 |
import json
from string import Template
from django.forms import Field, Widget
from django.utils.translation import gettext_lazy as _
from django_simple_timeseries.timeseries import Timeseries
__all__ = ("TimeseriesFormField", "TimeseriesWidget")
# A sparkline SVG that draws itself.
SPARKLINE_SVG_TEMPLATE = Templat... | mik3y/django-simple-timeseries | src/django_simple_timeseries/forms.py | .py | 4ea77aeb9f6bb9e9 | 7.48 | 8 |
import logging
from django.db.models import JSONField
from django_simple_timeseries.forms import TimeseriesFormField
from django_simple_timeseries.timeseries import Timeseries
logger = logging.getLogger(__name__)
__all__ = ["TimeseriesField"]
class TimeseriesField(JSONField):
"""A field storing a `Timeseries`... | mik3y/django-simple-timeseries | src/django_simple_timeseries/models.py | .py | 9b4b6f38e203c1b9 | 7.48 | 8 |
import datetime
import json
import math
from django.utils import timezone
def parse_isodate(s):
return datetime.datetime.fromisoformat(s)
class Timeseries:
"""A compact, fixed-resolution timeseries.
Samples are stored as a flat vector of values, bucketed to `resolution_seconds`.
The vector holds a... | mik3y/django-simple-timeseries | src/django_simple_timeseries/timeseries.py | .py | b14aad60b9abd8ed | 7.48 | 8 |
import unittest
from datetime import UTC, timedelta
from django.utils.timezone import datetime
from django_simple_timeseries.forms import TimeseriesWidget
from django_simple_timeseries.timeseries import Timeseries
class TimeseriesWidgetTests(unittest.TestCase):
def setUp(self):
self.widget = TimeseriesW... | mik3y/django-simple-timeseries | tests/test_forms.py | .py | 7da12a120a476bba | 7.98 | 8 |
import time
from rembg import remove
import cv2
import numpy as np
import os
from skimage import filters
import Mainfunction
import ACE
def find_max_p(z,xy,center):
distance = 0
temp = -1
# find square
for i in xy:
x = z[i][0] - center[0]
y = z[i][1] - center[1]
... | intel/smart-image-correction | DetectHard.py | .py | e85150d2e5a2f9ac | 7.54 | 11 |
import numpy as np
from RemoveHandwritten.cut_text.text_proposal_connector import TextProposalConnector
from RemoveHandwritten.cut_text.image import rotate_nms, nms, get_boxes
def normalize(data):
if data.shape[0]==0:
return data
max_=data.max()
min_=data.min()
return (data-min_)/(max_-min_) if... | intel/smart-image-correction | RemoveHandwritten/cut_text/detectors.py | .py | 04949276f7e40b38 | 7.54 | 11 |
import numpy as np
import cv2
from PIL import Image
def soft_max(x):
"""numpy softmax"""
expz = np.exp(x)
sumz = np.sum(expz,axis=1)
return expz[:,1]/sumz
def reshape(x):
b = x.shape
x = x.transpose(0, 2, 3, 1)
b = x.shape
x = np.reshape(x,[b[0],b[1]*b[2]*10,2])
return x
def resiz... | intel/smart-image-correction | RemoveHandwritten/cut_text/image.py | .py | 307f456ce0f672df | 7.54 | 11 |
import numpy as np
from RemoveHandwritten.cut_text.text_proposal_graph_builder import TextProposalGraphBuilder
class TextProposalConnector:
"""
Connect text proposals into text lines
"""
def __init__(self,MAX_HORIZONTAL_GAP=30,MIN_V_OVERLAPS=0.6,MIN_SIZE_SIM=0.6):
self.graph_builder=TextPro... | intel/smart-image-correction | RemoveHandwritten/cut_text/text_proposal_connector.py | .py | df877cabf11168e7 | 7.54 | 11 |
import numpy as np
class Graph:
def __init__(self, graph):
self.graph=graph
def sub_graphs_connected(self):
sub_graphs=[]
for index in range(self.graph.shape[0]):
if not self.graph[:, index].any() and self.graph[index, :].any():
v=index
sub_g... | intel/smart-image-correction | RemoveHandwritten/cut_text/text_proposal_graph_builder.py | .py | 0d2d167208178f23 | 7.54 | 11 |
from __future__ import annotations
import re
from dataclasses import dataclass
from enum import Enum, IntEnum
from typing import Optional, List
@dataclass
class RgbColor:
"""An RGB value, with each component having a value between 0 and 255."""
red: int
green: int
blue: int
@property
def rgb... | spookybear0/laserforce_ranking | db/types.py | .py | db59562c8a5f5d12 | 7.48 | 8 |
"""
Contents: Simple file caching routines that automatically cache remote files
locally for use.
Copyright (C) 2023
Sofar Ocean Technologies
Authors: Pieter Bart Smit
======================
Functions:
- `colocate_points`, function to colocate two point data sources.
"""
from pandas import DataFrame
from ... | sofarocean/roguewave | src/roguewave/colocate/pointdata.py | .py | 0aad416ea013a802 | 7.42 | 6 |
import numpy
from roguewave.tools.math import wrapped_difference
from roguewave.tools.grid import enclosing_points_1d
def interpolate_periodic(
xp: numpy.ndarray,
fp: numpy.ndarray,
x: numpy.ndarray,
x_period: float = None,
fp_period: float = None,
fp_discont: float = None,
left: float = n... | sofarocean/roguewave | src/roguewave/interpolate/general.py | .py | 57559281937c8a8b | 7.42 | 6 |
from typing import Tuple, Callable, List
import numpy
from roguewave.tools.math import wrapped_difference
from roguewave.tools.grid import enclosing_points_1d
from roguewave.interpolate.general import interpolation_weights_1d
class NdInterpolator:
def __init__(
self,
get_data: Callable[[List[numpy... | sofarocean/roguewave | src/roguewave/interpolate/nd_interp.py | .py | 83cd7c20af1870eb | 7.42 | 6 |
"""
Contents: Routines to generate a (monotone) cubic spline interpolation for 1D arrays.
Copyright (C) 2023
Sofar Ocean Technologies
Authors: Pieter Bart Smit
======================
Functions:
- `cubic_spline`, method to create a (monotone) cubic spline
"""
import numpy as np
from scipy.interpolate import CubicSp... | sofarocean/roguewave | src/roguewave/interpolate/spline.py | .py | bac528bdf61b8e09 | 7.42 | 6 |
import numpy as np
from numpy.fft import rfft, irfft
from roguewave.timeseries_analysis.filtering import sos_filter
from scipy.signal import butter
from scipy.signal.windows import tukey
from roguewave.wavephysics.fluidproperties import GRAVITATIONAL_ACCELERATION
import pandas as pd
def frequency_scale(depth, **kwar... | sofarocean/roguewave | src/roguewave/spotter/_pressure_analysis.py | .py | 0c16da64e1b1222d | 7.42 | 6 |
"""
See openff/toolkit/utils/utils.py
"""
import functools
from collections.abc import Iterable
from openff.units import Quantity, unit
def string_to_quantity(quantity_string) -> str | int | float | Quantity:
"""Attempt to parse a string into a unit.Quantity.
Note that dimensionless floats and ints are ret... | openforcefield/openff-units | downstream_dummy/dummy.py | .py | 990108bc070be3d8 | 7.52 | 10 |
import pytest
from dummy import object_to_quantity
from openff.units import Quantity, Unit
def test_function_can_be_defined():
"""
Just make sure a function can be defined using these classes.
Safeguard against i.e. https://github.com/openforcefield/openff-toolkit/issues/1632
Type checkers might no... | openforcefield/openff-units | downstream_dummy/tests/test_dummy.py | .py | 9942b762e6a8fe6b | 8.02 | 10 |
"""
Registry of units provided by OpenFF Units.
``unit`` may be used similarly to a module. It makes constants and units of
measure available as attributes. Available units can be found in the
:download:`constants <../../../openff/units/data/constants.txt>` and
:download:`defaults <../../../openff/units/data/defaults.... | openforcefield/openff-units | openff/units/__init__.py | .py | b1cf5bf002216717 | 7.52 | 10 |
import pytest
from openff.utilities.testing import skip_if_missing
from openff.utilities.utilities import has_package
from openff.units import Quantity, unit
from openff.units.exceptions import NoneQuantityError, NoneUnitError
from openff.units.openmm import ensure_quantity, from_openmm
if has_package("openmm.unit"):... | openforcefield/openff-units | openff/units/_tests/test_openmm.py | .py | 3fb00cfc8f203249 | 8.02 | 10 |
import pickle
import random
import pytest
from openff.utilities.testing import skip_if_missing
from openff.units import Quantity, unit
class TestQuantity:
@skip_if_missing("openmm.unit")
def test_to_openmm_method(self):
"""
Test the basic behavior of `Quantity.to_openmm` as an API call. Test... | openforcefield/openff-units | openff/units/_tests/test_units.py | .py | 509bd944fab3ba1c | 8.02 | 10 |
__all__ = [
"MissingOpenMMUnitError",
"NoneQuantityError",
"NoneUnitError",
]
class MissingOpenMMUnitError(Exception):
"""Raised when a unit cannot be converted to an equivalent OpenMM unit"""
class NoneQuantityError(Exception):
"""Raised when attempting to convert `None` between unit packages a... | openforcefield/openff-units | openff/units/exceptions.py | .py | 3e0b9c4a51d8456d | 7.02 | 10 |
"""
Functions for converting between OpenFF and OpenMM units
"""
import ast
import operator as op
from typing import Literal
from openff.utilities import has_package, requires_package
from openff.units.exceptions import (
MissingOpenMMUnitError,
NoneQuantityError,
NoneUnitError,
)
from openff.units.units... | openforcefield/openff-units | openff/units/openmm.py | .py | d6a2ef758b9da44c | 7.52 | 10 |
"""
Core classes for OpenFF Units
"""
from __future__ import annotations
import json
import uuid
import warnings
from typing import TYPE_CHECKING, Any
import numpy # possible to make this optional?
import pint
from openff.utilities import requires_package
from pint import Measurement as _Measurement
from pint impor... | openforcefield/openff-units | openff/units/units.py | .py | a131cda99321a93b | 7.52 | 10 |
"""Levenberg-Marquardt optimizer.
Notes:
This is a reimplementation of the Levenberg-Marquardt optimizer from the fantastic
ForceBalance [1] package. The original code is licensed under the BSD 3-clause
license which can be found in the LICENSE_3RD_PARTY file.
References:
[1]: https://github.com/leepi... | openforcefield/descent | descent/optim/_lm.py | .py | 5fd974c7ffca1230 | 7.56 | 12 |
"""Train against dimer energies."""
import pathlib
import typing
import datasets
import datasets.table
import pyarrow
import smee
import smee.utils
import torch
import tqdm
import descent.utils.dataset
import descent.utils.loss
import descent.utils.molecule
import descent.utils.reporting
if typing.TYPE_CHECKING:
... | openforcefield/descent | descent/targets/dimers.py | .py | 260f3358aa8d81bd | 7.56 | 12 |
"""Train against relative energies and forces."""
import typing
import datasets
import datasets.table
import pyarrow
import smee
import smee.utils
import torch
DATA_SCHEMA = pyarrow.schema(
[
("id", pyarrow.string()),
("smiles", pyarrow.string()),
("coords", pyarrow.list_(pyarrow.float64(... | openforcefield/descent | descent/targets/energy.py | .py | 9ee6dbcc55a4185d | 7.56 | 12 |
import copy
import openff.interchange
import openff.interchange.models
import openff.toolkit
import pydantic
import pytest
import smee
import smee.converters
import smee.utils
import torch
from descent.train import AttributeConfig, ParameterConfig, Trainable
@pytest.fixture()
def mock_ff() -> smee.TensorForceField... | openforcefield/descent | descent/tests/test_train.py | .py | e7fad5c5a54739a2 | 7.06 | 12 |
"""Helpers for training parameters."""
import typing
import openff.interchange.models
import pydantic
import smee
import smee.utils
import torch
PotentialKeyList = list[openff.interchange.models.PotentialKey]
def _unflatten_tensors(
flat_tensor: torch.Tensor, shapes: list[torch.Size]
) -> list[torch.Tensor]:
... | openforcefield/descent | descent/train.py | .py | c604562398b9affd | 7.56 | 12 |
"""Utilities for defining loss functions."""
import functools
import logging
import typing
import torch
ClosureFn = typing.Callable[
[torch.Tensor, bool, bool],
tuple[torch.Tensor, torch.Tensor | None, torch.Tensor | None],
]
P = typing.ParamSpec("P")
_LOGGER = logging.getLogger(__name__)
def to_closure(
... | openforcefield/descent | descent/utils/loss.py | .py | 91e2e7ecc735e0fb | 7.56 | 12 |
"""aiobafi6 discovery.
Provides functionality to discover BAF i6 API services.
"""
from __future__ import annotations
import asyncio
import inspect
import logging
from dataclasses import dataclass
from typing import Callable, Dict, Optional, Sequence, Set, Tuple
from zeroconf import ServiceStateChange, Zeroconf
from... | jfroy/aiobafi6 | aiobafi6/discovery.py | .py | a21acfc3ef9c3db0 | 7.42 | 6 |
"""aiobafi6 protobuf properties.
Descriptor for `Device` attributes backed by a `Properties` protobuf field.
"""
from __future__ import annotations
import typing as t
from enum import IntEnum
from google.protobuf.message import Message
from .const import MIN_API_VERSION
from .proto import aiobafi6_pb2
__all__ = (
... | jfroy/aiobafi6 | aiobafi6/protoprop.py | .py | f8ec351069611c6c | 7.42 | 6 |
"""Utilities for BAF message encoding and decoding.
BAF uses SLIP (Serial Line IP, https://datatracker.ietf.org/doc/html/rfc1055.html) to
frame protocol buffer messages on a TCP/IP stream connection.
"""
from __future__ import annotations
from google.protobuf.message import Message
def serialize(message: Message) -... | jfroy/aiobafi6 | aiobafi6/wireutils.py | .py | c3a36df471286a23 | 7.42 | 6 |
# pylint: disable=protected-access, missing-class-docstring, missing-function-docstring, invalid-name, line-too-long
"""Tests for wireutils."""
from . import wireutils
def test_add_emulation_prevention():
got = wireutils.add_emulation_prevention(b"\xc0")
assert got == b"\xdb\xdc"
got = wireutils.add_emu... | jfroy/aiobafi6 | aiobafi6/wireutils_test.py | .py | 169a9a219c8c9f28 | 7.92 | 6 |
import os
from typing import Union
import numpy as np
import pandas as pd
from ..utils.io import check_file
from ..utils.time import parse_time
def parse_evl(input_file: str):
"""Parse EVL Line File and place data in Pandas Dataframe.
Parameters
----------
input_file : str
Input EVL file to... | echostack-org/echoregions | echoregions/lines/lines_parser.py | .py | 4ce354a4266987af | 7.52 | 10 |
import numpy as np
import xarray as xr
def write_evr(
evr_path: str,
mask: xr.DataArray,
region_classification: str = "",
echoview_version: str = "EVRG 7 12.0.341.42620",
):
"""
Writes region data to an Echoview Region (*.evr) file.
Parameters
----------
evr_path : str
Pat... | echostack-org/echoregions | echoregions/regions2d/evr_writer.py | .py | 3e9e2d88c574d23c | 7.52 | 10 |
import os
from typing import Dict, List, Tuple, Union
import numpy as np
import pandas as pd
from numpy import ndarray
from ..utils.io import check_file
from ..utils.time import parse_time
COLUMNS = [
"file_name",
"file_type",
"evr_file_format_number",
"echoview_version",
"region_id",
"region... | echostack-org/echoregions | echoregions/regions2d/regions2d_parser.py | .py | c0a75f0d867b053f | 7.52 | 10 |
import os
from pathlib import Path
import numpy as np
import pandas as pd
import pytest
import xarray as xr
from xarray import DataArray
import echoregions as er
from echoregions.lines.lines import Lines
from echoregions.utils.api import merge
DATA_DIR = Path("./echoregions/test_data/")
EVL_DIR = DATA_DIR / "evl"
EV... | echostack-org/echoregions | echoregions/tests/test_lines.py | .py | 4499b5ff0f2756b5 | 7.02 | 10 |
from pathlib import Path
import numpy as np
import pandas as pd
import pytest
import echoregions as er
from echoregions.lines.lines import Lines
from echoregions.regions2d.regions2d import Regions2D
from echoregions.utils.api import merge
from echoregions.utils.io import check_file, validate_path
from echoregions.uti... | echostack-org/echoregions | echoregions/tests/test_utils.py | .py | da215b4f1c87d69c | 8.02 | 10 |
import warnings
from typing import List, Union
import numpy as np
import pandas as pd
import xarray as xr
from xarray import Dataset
def convert_mask_2d_to_3d(mask_2d_ds: Dataset) -> Union[Dataset, None]:
"""
Convert 2D multi-labeled mask data into its 3D one-hot encoded form.
Parameters
----------
... | echostack-org/echoregions | echoregions/utils/api.py | .py | e00b8378750b4e68 | 7.52 | 10 |
import os
from pathlib import Path
from typing import List, Union
def validate_path(save_path: str = None, input_file: str = None, ext: str = ".json") -> str:
"""
Checks if save_path is specified. If not try to create one with the input_file and ext.
Parameters
----------
save_path : str
... | echostack-org/echoregions | echoregions/utils/io.py | .py | 3e2a7e5e1fbdd7ce | 7.52 | 10 |
"""
File: AStarPathfinding.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
Description:
This module implements the A* (A-Star) Pathfinding algor... | Amey-Thakur/PYTHON-SHORTS | Source Code/A-Star Pathfinding/AStarPathfinding.py | .py | 85d8101f556bc99b | 7.48 | 8 |
"""
File: Anagram.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
Description:
An anagram is a word or phrase formed by rearranging the letters ... | Amey-Thakur/PYTHON-SHORTS | Source Code/Anagram/Anagram.py | .py | 50e7dac38702bf36 | 7.48 | 8 |
"""
File: ArmstrongNumber.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
Description:
An Armstrong number (or Narcissistic number) is a number ... | Amey-Thakur/PYTHON-SHORTS | Source Code/Armstrong Number/ArmstrongNumber.py | .py | c427ecba616b8905 | 7.48 | 8 |
"""
File: Array.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
Description:
This script implements a custom Static Array structure in Python.
... | Amey-Thakur/PYTHON-SHORTS | Source Code/Array/Array.py | .py | fe88c07573eb7953 | 7.48 | 8 |
"""
File: BellmanFord.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
Description:
This module implements the Bellman-Ford Algorithm for finding... | Amey-Thakur/PYTHON-SHORTS | Source Code/Bellman-Ford Algorithm/BellmanFord.py | .py | 33014c72c288f09a | 7.48 | 8 |
"""
File: BinarySearchTree.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
Description:
A Binary Search Tree (BST) is a node-based binary tree d... | Amey-Thakur/PYTHON-SHORTS | Source Code/Binary Search Tree/BinarySearchTree.py | .py | b42bd3fd492abac6 | 7.48 | 8 |
"""
File: BinarySearch.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
Description:
Binary search is an efficient algorithm for finding a target... | Amey-Thakur/PYTHON-SHORTS | Source Code/Binary Search/BinarySearch.py | .py | 157701be113ae855 | 7.48 | 8 |
"""
File: BinaryToDecimal.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
Description:
This utility converts binary strings (base-2) into decima... | Amey-Thakur/PYTHON-SHORTS | Source Code/Binary To Decimal/BinaryToDecimal.py | .py | d54a25f9cf659c98 | 7.48 | 8 |
"""
File: BinaryTree.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
Description:
A Binary Tree is a non-linear data structure where each node h... | Amey-Thakur/PYTHON-SHORTS | Source Code/Binary Tree/BinaryTree.py | .py | edcd3f30d1af119d | 7.48 | 8 |
"""
File: BlockchainBasic.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
Description:
This module implements a basic Blockchain structure. It d... | Amey-Thakur/PYTHON-SHORTS | Source Code/Blockchain Basic/BlockchainBasic.py | .py | 266389e4f21e651d | 7.48 | 8 |
"""
File: BloomFilter.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
Description:
This module implements a Bloom Filter, a space-efficient prob... | Amey-Thakur/PYTHON-SHORTS | Source Code/Bloom Filter/BloomFilter.py | .py | 22da6147c3162a1d | 7.48 | 8 |
"""
File: BreadthFirstTraversal.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
Description:
Breadth-First Traversal (or Level-Order Traversal) ... | Amey-Thakur/PYTHON-SHORTS | Source Code/Breadth First Traversal/BreadthFirstTraversal.py | .py | 0d564b16327c1a9e | 7.48 | 8 |
"""
File: Browser.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
Description:
A scholarly lightweight browser built with PyQt5. Includes modern... | Amey-Thakur/PYTHON-SHORTS | Source Code/Browser/Browser.py | .py | 07ffb5289be54e07 | 7.48 | 8 |
"""
File: BubbleSort.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
Description:
Bubble Sort is a simple comparison-based sorting algorithm. It... | Amey-Thakur/PYTHON-SHORTS | Source Code/Bubble Sort/BubbleSort.py | .py | cf9b4dbfec298bb7 | 7.48 | 8 |
"""
File: BucketSort.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
Description:
Bucket Sort is a distribution sort that works by partitioning ... | Amey-Thakur/PYTHON-SHORTS | Source Code/Bucket Sort/BucketSort.py | .py | 5cb78dc910ae9b56 | 7.48 | 8 |
"""
File: Calculator.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
Description:
A professional, high-fidelity modern calculator application bu... | Amey-Thakur/PYTHON-SHORTS | Source Code/Calculator/Calculator.py | .py | 51c59603d75f4f99 | 7.48 | 8 |
"""
File: Calendar.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
"""
import sys
import calendar
from datetime import datetime
from PyQt5.QtWidgets... | Amey-Thakur/PYTHON-SHORTS | Source Code/Calendar/Calendar.py | .py | 940d5ba62972a502 | 7.48 | 8 |
"""
File: CharacterCount.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
Description:
This script performs professional lexical analysis on a st... | Amey-Thakur/PYTHON-SHORTS | Source Code/Character Count/CharacterCount.py | .py | ea604a1f74f16c08 | 7.48 | 8 |
"""
File: Chatbot.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
Description:
A high-fidelity GUI Chatbot utility using PyQt5.
Features a ... | Amey-Thakur/PYTHON-SHORTS | Source Code/Chatbot/Chatbot.py | .py | 37e76536c57be023 | 7.48 | 8 |
"""
File: CheckGreater.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
Description:
This utility verifies if all elements in a numeric collectio... | Amey-Thakur/PYTHON-SHORTS | Source Code/Check Greater Than Collection/CheckGreater.py | .py | 3279aa2e39183489 | 7.48 | 8 |
"""
File: CipherText.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
Description:
A scholarly implementation of the Caesar Cipher, a classic sub... | Amey-Thakur/PYTHON-SHORTS | Source Code/Cipher Text/CipherText.py | .py | 3cb79e2007e05296 | 7.48 | 8 |
"""
File: CountVowels.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
Description:
A scholarly implementation of a vowel frequency analyzer. Thi... | Amey-Thakur/PYTHON-SHORTS | Source Code/Count Vowels/CountVowels.py | .py | 3ea52caba7dddf79 | 7.48 | 8 |
"""
File: Countdowntimer.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
Description:
A high-fidelity premium countdown timer implemented in PyQ... | Amey-Thakur/PYTHON-SHORTS | Source Code/Countdown Timer/Countdowntimer.py | .py | 82bb1473fde50de9 | 7.48 | 8 |
"""
File: CurrencyConverter.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
Description:
This module implements a Currency Conversion service us... | Amey-Thakur/PYTHON-SHORTS | Source Code/Currency Converter/CurrencyConverter.py | .py | d9d7b7ef524e81d1 | 7.48 | 8 |
"""
File: DecimalToBinary.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
Description:
A scholarly implementation of a positional notation conve... | Amey-Thakur/PYTHON-SHORTS | Source Code/Decimal To Binary/DecimalToBinary.py | .py | 6798d9a093cf8a00 | 7.48 | 8 |
"""
File: DepthFirstTraversal.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
Description:
A scholarly implementation of Depth-First Traversal (... | Amey-Thakur/PYTHON-SHORTS | Source Code/Depth First Traversal/DepthFirstTraversal.py | .py | 8cdd37c63aa15e9f | 7.48 | 8 |
"""
File: Dictionary.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
Description:
An advanced encapsulated WordDictionary service designed for l... | Amey-Thakur/PYTHON-SHORTS | Source Code/Dictionary/Dictionary.py | .py | 088b5a8ec420c350 | 7.48 | 8 |
"""
File: DijkstraAlgorithm.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
Description:
This module implements Dijkstra's Algorithm for finding... | Amey-Thakur/PYTHON-SHORTS | Source Code/Dijkstra Algorithm/DijkstraAlgorithm.py | .py | c5822d308f7ea69c | 7.48 | 8 |
"""
File: DoublyLinkedList.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
Description:
A high-fidelity implementation of a Doubly Linked List (... | Amey-Thakur/PYTHON-SHORTS | Source Code/Doubly Linked List/DoublyLinkedList.py | .py | 4e4983c23c60479d | 7.48 | 8 |
"""
File: EvenOdd.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
Description:
A high-fidelity implementation for partitioning collections of in... | Amey-Thakur/PYTHON-SHORTS | Source Code/Even Odd/EvenOdd.py | .py | a76573870f994df9 | 7.48 | 8 |
"""
File: FactorialSequence.py
Authors:
- Amey Thakur (https://github.com/Amey-Thakur)
- Mega Satish (https://github.com/msatmod)
Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS
Release Date: January 9, 2022
License: MIT License
Description:
A scholarly implementation of a Factorial sequence gene... | Amey-Thakur/PYTHON-SHORTS | Source Code/Factorial Sequence/FactorialSequence.py | .py | 567b62dbae912037 | 7.48 | 8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.