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
# pylint: disable=R0914 # too-many-locals """Command line interface of PyFlexPlot.""" # Standard library import warnings from typing import Any # Third-party import click from click import Context from shapely.errors import ShapelyDeprecationWarning # Local from .. import __version__ from .. import presets_data_pat...
MeteoSwiss-APN/pyflexplot
src/pyflexplot/cli/cli.py
.py
04e8d2cfc7e3910a
7.6
15
"""CLI utils.""" # Standard library import sys import traceback from typing import Type # Third-party import click from click import Context # Local from ..setups.setup_file import SetupFile from ..utils.logging import set_log_level def click_error( ctx: Context, msg: str, exception: Type[Exception] = ...
MeteoSwiss-APN/pyflexplot
src/pyflexplot/cli/click.py
.py
e953d69ebaf118cb
7.6
15
"""Preset setup files.""" # Standard library import re from pathlib import Path from typing import Collection from typing import Dict from typing import Iterator from typing import List from typing import Optional from typing import Pattern from typing import Union # Local from .. import _check_dir_exists from ..util...
MeteoSwiss-APN/pyflexplot
src/pyflexplot/cli/preset.py
.py
ff939a3c46f6c3e5
7.6
15
"""CLI for preset setup files.""" # Standard library import sys from pathlib import Path from typing import Any from typing import Mapping from typing import Sequence # Third-party import click from click import Context # Local from ..utils.exceptions import NoPresetFileFoundError from ..utils.logging import log fro...
MeteoSwiss-APN/pyflexplot
src/pyflexplot/cli/preset_click.py
.py
3c48170e7e46fd3c
7.6
15
""" This module (taken from MeteoSwiss Python Commons library) introduces a custom class that leverages Pydantic's capabilities: a custom BaseSettings class BaseServiceSettings. This custom classes inherit Pydantic's core functionalities. This includes data validation, parsing, serialization, error handling, and behav...
MeteoSwiss-APN/pyflexplot
src/pyflexplot/config/base_settings.py
.py
831430dcf9d9cc06
7.6
15
"""Data structures.""" # Standard library from typing import Callable from typing import Sequence from typing import Union # Third-party import numpy as np def ensemble_probability(arr: np.ndarray, thr: float = 0.0, thr_type: str = "lower") -> np.ndarray: """Ensemble-based probability of threshold exceedence at...
MeteoSwiss-APN/pyflexplot
src/pyflexplot/input/data.py
.py
f1c44188808a4a15
7.6
15
"""Data structures.""" # Standard library import dataclasses as dc import warnings from typing import Any from typing import Dict from typing import Iterator from typing import Optional from typing import Sequence from typing import Tuple from typing import Union # Third-party import numpy as np from cartopy.crs impo...
MeteoSwiss-APN/pyflexplot
src/pyflexplot/input/field.py
.py
eaa0de7b1f228b2f
7.6
15
"""Fix issues with NetCDF input.""" # Standard library from typing import Any from typing import Mapping from typing import Sequence from typing import Union # Third-party import numpy as np # Local from ..utils.logging import log from .meta_data import MetaData class FlexPartDataFixer: """Fix issues with Flex...
MeteoSwiss-APN/pyflexplot
src/pyflexplot/input/fix_nc_input.py
.py
0967d630fced3513
7.6
15
"""Chemical species and their attributes.""" from __future__ import annotations # Standard library import dataclasses as dc from dataclasses import dataclass # pylint doesn't understand dc.dataclass from typing import Any from typing import cast from typing import List from typing import Optional from typing import ...
MeteoSwiss-APN/pyflexplot
src/pyflexplot/input/species.py
.py
27605ec5bc772699
8.1
15
"""Output.""" # Standard library import os import re from datetime import datetime from typing import Any from typing import cast from typing import List from typing import Mapping from typing import Optional from typing import Sequence from typing import Union # First-party from srutils.datetime import init_datetime...
MeteoSwiss-APN/pyflexplot
src/pyflexplot/output.py
.py
39fa0308941ffc19
7.6
15
"""Plot layouts.""" # Standard library import dataclasses as dc from typing import Dict from typing import Mapping from typing import Tuple # Local from .setups.layout_setup import LayoutSetup from .utils.summarize import summarizable from .utils.typing import RectType @summarizable @dc.dataclass class BoxedPlotLayo...
MeteoSwiss-APN/pyflexplot
src/pyflexplot/plot_layouts.py
.py
516ee1b8e01ac9ed
7.6
15
"""Domains.""" # Standard library import dataclasses as dc from typing import Any from typing import Dict from typing import List from typing import Optional from typing import Sequence from typing import Tuple from typing import Union # Third-party import numpy as np from cartopy.crs import PlateCarree from cartopy....
MeteoSwiss-APN/pyflexplot
src/pyflexplot/plotting/domain.py
.py
c345bffcc1c13e88
7.6
15
"""Bounding box.""" from __future__ import annotations # Standard library import dataclasses as dc from copy import copy from typing import Iterator from typing import Optional from typing import Tuple # Third-party import numpy as np from cartopy.crs import PlateCarree from cartopy.crs import Projection from cartop...
MeteoSwiss-APN/pyflexplot
src/pyflexplot/plotting/proj_bbox.py
.py
cd812a8eeb97570b
7.6
15
"""Reference distance indicator for map plot.""" # Standard library import dataclasses as dc from typing import Any from typing import Dict from typing import Optional # Third-party import geopy.distance import matplotlib as mpl from matplotlib.axes import Axes # Local from ..utils.exceptions import MaxIterationErro...
MeteoSwiss-APN/pyflexplot
src/pyflexplot/plotting/ref_dist_indicator.py
.py
863af3f811020c5b
7.6
15
""" Module for interacting with AWS S3 for downloading and uploading files. This module provides utility functions to handle S3 URIs, download files from an S3 bucket, and upload files to an S3 bucket. It also includes functions for expanding S3 keys with ensemble member identifiers and retrying operations with expone...
MeteoSwiss-APN/pyflexplot
src/pyflexplot/s3.py
.py
d87afee798c68cc4
7.6
15
"""Contains the implementation for data saving strategies.""" # Standard library import os import zipfile from pathlib import Path # Third-party import numpy as np import shapefile # type: ignore # First-party from pyflexplot.plot_layouts import BoxedPlotLayout from pyflexplot.plotting.boxed_plot import BoxedPlot f...
MeteoSwiss-APN/pyflexplot
src/pyflexplot/save_data.py
.py
dcf29439afe16bdf
7.6
15
"""Base class for setup classes. Note that this is design is not clean in the sense that the interfaces of the subclasses of BaseSetup differ in their attributes, which requires the occasional isinstance assert for the subclass type to satisfy mypy. """ # Standard library import dataclasses as dc from typing import ...
MeteoSwiss-APN/pyflexplot
src/pyflexplot/setups/base_setup.py
.py
57b1af94692cce6b
7.6
15
# pylint: disable=C0302 # too-many-lines """Plot setup and setup files.""" # Standard library import dataclasses as dc from pprint import pformat from typing import Any from typing import Collection from typing import Dict from typing import Iterator from typing import List from typing import Mapping from typing impo...
MeteoSwiss-APN/pyflexplot
src/pyflexplot/setups/dimensions.py
.py
f87682c81f74f6c2
7.6
15
"""Files setup.""" # Standard library import dataclasses as dc from typing import Tuple from typing import Union # Local from .base_setup import BaseSetup # SR_TMP <<< TODO cleaner solution def is_files_setup_param(param: str, recursive: bool = False) -> bool: if recursive: raise NotImplementedError("re...
MeteoSwiss-APN/pyflexplot
src/pyflexplot/setups/files_setup.py
.py
82dea8ebc67b5d09
7.6
15
"""Layout setup.""" # Standard library import dataclasses as dc from typing import Any from typing import Mapping from typing import Optional # Local from .base_setup import BaseSetup # SR_TMP <<< TODO cleaner solution def is_layout_setup_param(param: str, recursive: bool = False) -> bool: if recursive: ...
MeteoSwiss-APN/pyflexplot
src/pyflexplot/setups/layout_setup.py
.py
552e9f01b510e347
7.6
15
"""Model setup.""" # Standard library import dataclasses as dc from typing import Any from typing import Dict from typing import Mapping from typing import Optional from typing import Tuple # Local from .base_setup import BaseSetup # SR_TMP <<< TODO cleaner solution def is_model_setup_param(param: str, recursive: b...
MeteoSwiss-APN/pyflexplot
src/pyflexplot/setups/model_setup.py
.py
bfc46553db501ab6
7.6
15
# pylint: disable=E1101 # no-member (logging.verbose, logging.VERBOSE) """Preset setup files.""" # Standard library import logging from typing import Optional def get_log_level() -> int: return logging.getLogger().level def set_log_level(verbosity: int) -> None: if verbosity <= 0: logging.getLogge...
MeteoSwiss-APN/pyflexplot
src/pyflexplot/utils/logging.py
.py
0315a1b517118954
7.6
15
"""Summarize objects as a dict for testing etc.""" # Standard library import dataclasses as dc from functools import partial from typing import Any from typing import Callable from typing import Collection from typing import Dict from typing import Optional from typing import Sequence # Third-party import numpy as np...
MeteoSwiss-APN/pyflexplot
src/pyflexplot/utils/summarize.py
.py
c576bf6ba167d2fc
7.6
15
"""Crop fields in a NetCDF file.""" from __future__ import annotations # Standard library import dataclasses as dc import sys from typing import Any from typing import Optional from typing import Tuple from typing import Union # Third-party import click import netCDF4 as nc4 __version__ = "0.1.0" @dc.dataclass cl...
MeteoSwiss-APN/pyflexplot
src/srtools/crop_netcdf.py
.py
3b9ae9c8a7df8bef
7.6
15
"""Custom sphinx extension to include manpage.""" def setup(app): """Set up connect events to the man builder.""" app.connect("builder-inited", include_manpage) def include_manpage(app): """Update the excluded patterns to include the manpage.""" if app.builder.name != "man": return for ...
dralshehri/epiweeks
docs/_ext/custom_manpage.py
.py
6ae9e3add3878817
7.16
20
"""Custom sphinx extension to generate text file sitemap.""" import warnings from pathlib import Path def setup(app): """Set up connect events to the sitemap builder.""" app.add_config_value("sitemap_excluded_pages", default=[], rebuild="") app.connect("html-page-context", add_links) app.connect("bu...
dralshehri/epiweeks
docs/_ext/custom_sitemap.py
.py
7221ce24842ab31e
7.66
20
"""Epidemiological weeks calculation. Based on the US CDC (MMWR) and ISO week numbering systems. https://github.com/dralshehri/epiweeks """ from collections.abc import Iterator from datetime import date, timedelta __all__ = ["Week", "Year"] class Week: """A Week object represents a week in epidemiological wee...
dralshehri/epiweeks
src/epiweeks/__init__.py
.py
ffb8d24f9d698b7e
7.66
20
from __future__ import annotations import json import os import re import sys from collections.abc import Mapping from datetime import date, datetime, time from typing import Any, BinaryIO, Callable, Dict, List, Match, Optional, Union if sys.version_info >= (3, 11): import tomllib else: # pragma: no cover - fall...
mrshu/envtoml
envtoml/__init__.py
.py
7461177b2870c1b2
7.64
18
# Importing required libraries, obviously import streamlit as st import cv2 from PIL import Image import numpy as np import os # Loading pre-trained parameters for the cascade classifier try: face_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_frontalface_default.xml') eye_cascade = cv2....
Blues1998/Face-Detection
app.py
.py
aa87212820c31716
7.42
6
#!/usr/bin/env python # -*- coding: utf-8 -*- from enum import Enum from typing import List import os import numpy as np import pandas as pd from .data_objects.dimension_data import DimensionData class V1_SPATIAL_BUFFER_STRUCT: VIZ_TYPE_INDEX: int = 0 UID_INDEX: int = 1 # unique ID TID_INDEX: int = 2 ...
simularium/simulariumio
simulariumio/constants.py
.py
e0949909d200a8c1
7.45
7
from typing import Dict, List, Tuple import numpy as np from .frame_data import FrameData from .input_file_data import InputFileData from .trajectory_data import TrajectoryData from .simularium_file_data import SimulariumFileData from ..constants import BINARY_BLOCK_TYPE, BINARY_SETTINGS from ..readers import BinaryBl...
simularium/simulariumio
simulariumio/data_objects/binary_data.py
.py
75f57d22f03adab1
7.45
7
from typing import Dict, Union class FrameData: def __init__( self, frame_number: int, n_agents: int, time: float, data: Union[bytes, Dict] ): """ This object holds frame data for a single frame of simularium data Parameters ---------- frame_number : int ...
simularium/simulariumio
simulariumio/data_objects/frame_data.py
.py
9fcbb1ce732d15b3
7.45
7
from typing import Dict, List import json import numpy as np from .frame_data import FrameData from .simularium_file_data import SimulariumFileData from .trajectory_data import TrajectoryData from ..constants import V1_SPATIAL_BUFFER_STRUCT class JsonData(SimulariumFileData): def __init__(self, file_contents: st...
simularium/simulariumio
simulariumio/data_objects/json_data.py
.py
eebefb6e6538a68b
7.45
7
from http import HTTPStatus from sanic.exceptions import NotFound from sanic.response import json from webargs_sanic.sanicparser import HandleValidationError from extentions.helpers import format_error from extentions.helpers import return_an_error def handle_404(request, exception): '''Handle 404 Not Found ...
EndurantDevs/webargs-sanic
examples/user_simple_storage/extentions/exceptions.py
.py
a2f6a86f3d11fc3a
7.57
13
def format_error(status=None, title=None, detail=None, code=None): '''Formatting JSON API Error Object Constructing an error object based on JSON API standard ref: http://jsonapi.org/format/#error-objects Args: status: Can be a http status codes title: A summary of error detail: ...
EndurantDevs/webargs-sanic
examples/user_simple_storage/extentions/helpers.py
.py
09dc06c5f3940a5f
7.57
13
# -*- coding: utf-8 -*- """Sanic request argument parsing module. Example: :: from sanic import Sanic from webargs import fields from webargs_sanic.sanicparser import use_args app = Sanic(__name__) hello_args = { 'name': fields.Str(required=True) } @app.route('/') @use_args...
EndurantDevs/webargs-sanic
webargs_sanic/sanicparser.py
.py
5ba9890d8b9d6d74
7.57
13
#!/usr/bin/env python # -*- coding: utf-8 -*- """Use SQLAlchemy to fetch a result set from a query """ import os import re from pathlib import Path from urllib.parse import parse_qs, urlencode from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import serialization from jinja2....
nerium-data/sqla-raw
raw/db.py
.py
2222525c97b2899e
7.45
7
import os from pathlib import Path from unittest import mock import pytest import sqlalchemy.exc from cryptography.hazmat.primitives import serialization from cryptography.hazmat.primitives.asymmetric import rsa from sqlalchemy.engine.result import Result from raw.db import ( engine, prepare_key, read_key...
nerium-data/sqla-raw
tests/test_db.py
.py
892dbf2f68c111cf
7.95
7
bl_info = { "name": "Export SMF", "description": "Export to SMF 12 (SnidrsModelFormat)", "author": "Bart Teunis", "version": (0, 9, 7), "blender": (4, 5, 12), "location": "File > Export", "warning": "", # used for warning icon and text in addons panel "doc_url": "https://github.com/blen...
blender-to-gmstudio/blender-to-smf
__init__.py
.py
08edfcb101937c6e
7.57
13
# SMF import scripts for Blender # # # # import time from math import * from mathutils import * from pathlib import Path from struct import ( Struct, calcsize, unpack, unpack_from, ) # Used for much faster image loading import numpy as np # Make sure to reload changes to code that we maintain ourselv...
blender-to-gmstudio/blender-to-smf
import_smf.py
.py
33e8fa1c5ec76f6b
7.57
13
# SMF script equivalents for Blender # # DQs are stored as a named tuple of 2 Quaternions # and can be converted to a tuple for export to SMF using dq_to_tuple_xyzw # from collections import namedtuple from mathutils import Quaternion # TODO Derive from typing.NamedTuple? Use dataclasses.dataclass? DQ = namedtuple( ...
blender-to-gmstudio/blender-to-smf
pydq.py
.py
a25a89daa246196b
7.57
13
# Work with categories from typing import NamedTuple, List, Dict import db class Category(NamedTuple): """Structure of category""" codename: str name: str is_base_expanse: bool aliases: List[str] class Categories: def __init__(self): self._categories = self._load_categories() d...
ythosa/minuki
categories.py
.py
21b875d9e6fe85d8
7.57
13
import datetime import re from typing import NamedTuple, Optional, List import pytz import db from categories import Categories import exceptions class Message(NamedTuple): """Structure of a unpaired message about a new expense""" amount: int category_text: str class Expense(NamedTuple): """Structu...
ythosa/minuki
expenses.py
.py
18d48e18084e0520
7.57
13
#!/usr/bin/env python3 """Turn ``summary/*.samples.1s5g.tsv`` into ``figure3reproduction.tsv`` output. The output file ``figure3reproduction.tsv`` (THAPBI PICT output) has the same format as ``figure3.tsv`` (Batovska et al. 2021 data underlying Figure 3, exported using our ``figure3.R`` script). Either TSV file can be...
peterjc/thapbi-pict
examples/pest_insects/figure3reproduction.py
.py
82e0a94889db217d
7.5
9
#!/usr/bin/env python3 """Script to reproduce Batovska *et al.* (2021) Figure 3. See ``figure3.R`` and its output ``figure3.tsv`` which exports the ratios underlying Batovska *et al.* (2021) Figure 3 from their R-based analysis: https://github.com/alexpiper/HemipteraMetabarcodingMS/blob/master/hemiptera_metabarcoding....
peterjc/thapbi-pict
examples/pest_insects/recreate_figure3.py
.py
0378d5e2b0b4a0f9
7.5
9
#!/usr/bin/env python3 """Convert GreenGenes style FASTA+TSV into SINTAX style annotated FASTA file. As of v0.2.0 of the script, the input files can optionally be provided inside Qiime QZA files (ZIP files with a single in a .../data/... subdirectory). """ import argparse import gzip import io import sys import zipfi...
peterjc/thapbi-pict
scripts/gg_to_sintax.py
.py
9c7fcc90430a8495
7.5
9
#!/usr/bin/env python3 """Extract NCBI references matching unknown FASTA entries.""" import argparse import sys from collections import defaultdict from Bio.SeqIO.FastaIO import SimpleFastaParser from thapbi_pict.db_import import parse_ncbi_fasta_entry if "-v" in sys.argv or "--version" in sys.argv: print("v0.0...
peterjc/thapbi-pict
scripts/missed_refs.py
.py
714b7ad8dd9c774b
7.5
9
#!/usr/bin/env python """Python 3 script plotting a stacked line chart of the reads in each sample. This Python script was used to generate Figure 4 in the Cock *et al.* (2023) paper in PeerJ, using matplotlib. This figure replaced the equivalent figure in the preprint https://doi.org/10.1101/2023.03.24.534090 created...
peterjc/thapbi-pict
scripts/plot_reduction.py
.py
12b58add69a0f716
7.5
9
#!/usr/bin/env python3 # Copyright 2021-2023 by Peter Cock, The James Hutton Institute. # All rights reserved. # This file is part of the THAPBI Phytophthora ITS1 Classifier Tool (PICT), # and is released under the "MIT License Agreement". Please see the LICENSE # file that should have been included as part of this pac...
peterjc/thapbi-pict
scripts/pooling.py
.py
fbec87986065a7fe
7.5
9
#!/usr/bin/env python3 # Copyright 2023 by Peter Cock, The James Hutton Institute. # All rights reserved. # This file is part of the THAPBI Phytophthora ITS1 Classifier Tool (PICT), # and is released under the "MIT License Agreement". Please see the LICENSE # file that should have been included as part of this package....
peterjc/thapbi-pict
scripts/sample_filter.py
.py
607e564e14939160
7.5
9
# Copyright 2018-2023 by Peter Cock, The James Hutton Institute. # Revisions copyright 2024 by Peter Cock, University of Strathclyde. # All rights reserved. # This file is part of the THAPBI Phytophthora ITS1 Classifier Tool (PICT), # and is released under the "MIT License Agreement". Please see the LICENSE # file that...
peterjc/thapbi-pict
thapbi_pict/db_orm.py
.py
aed9fb635d329146
7.5
9
# Copyright 2018-2024 by Peter Cock, The James Hutton Institute. # Revisions copyright 2024 by Peter Cock, University of Strathclyde. # All rights reserved. # This file is part of the THAPBI Phytophthora ITS1 Classifier Tool (PICT), # and is released under the "MIT License Agreement". Please see the LICENSE # file that...
peterjc/thapbi-pict
thapbi_pict/dump.py
.py
5087db026d114fce
7.5
9
# Copyright 2019-2024 by Peter Cock, The James Hutton Institute. # All rights reserved. # This file is part of the THAPBI Phytophthora ITS1 Classifier Tool (PICT), # and is released under the "MIT License Agreement". Please see the LICENSE # file that should have been included as part of this package. """Code for sampl...
peterjc/thapbi-pict
thapbi_pict/ena_submit.py
.py
e5778d75d579d93f
7.5
9
# Copyright 2018-2024 by Peter Cock, The James Hutton Institute. # Revisions copyright 2024 by Peter Cock, University of Strathclyde. # All rights reserved. # This file is part of the THAPBI Phytophthora ITS1 Classifier Tool (PICT), # and is released under the "MIT License Agreement". Please see the LICENSE # file that...
peterjc/thapbi-pict
thapbi_pict/taxdump.py
.py
ed25b5e3b3f6ca30
7.5
9
# Copyright 2019-2024 by Peter Cock, The James Hutton Institute. # All rights reserved. # This file is part of the THAPBI Phytophthora ITS1 Classifier Tool (PICT), # and is released under the "MIT License Agreement". Please see the LICENSE # file that should have been included as part of this package. """Helper code to...
peterjc/thapbi-pict
thapbi_pict/versions.py
.py
8e00cc8919734964
7.5
9
"""Base schema and field definitions for GeoJSON objects.""" from __future__ import annotations import json from typing import Any import marshmallow as ma from marshmallow import ValidationError from marshmallow.fields import Float from marshmallow.validate import Range lon = Float( required=True, validate=Ran...
folt/marshmallow-geojson
marshmallow_geojson/_base.py
.py
9890bfa0960f8991
7.62
16
"""FeatureCollection schema for GeoJSON.""" from __future__ import annotations from marshmallow import pre_load from marshmallow.fields import Float, List, Nested, Str from marshmallow.validate import OneOf from ._base import BaseSchema from .feature import FeatureSchema from .object_type import FEATURE_COLLECTION f...
folt/marshmallow-geojson
marshmallow_geojson/feature_collection.py
.py
49a8c72a3e978cdc
7.62
16
from __future__ import annotations import typing from typing import Literal import marshmallow as ma from marshmallow import types from ._base import BaseSchema from .feature import FeatureSchema from .feature_collection import FeatureCollectionSchema from .geometry_collection import GeometryCollectionSchema from .l...
folt/marshmallow-geojson
marshmallow_geojson/geojson.py
.py
7632101a0c89547e
7.62
16
from __future__ import annotations import typing from typing import Literal import marshmallow as ma from marshmallow import types from ._base import BaseSchema from .line_string import LineStringSchema from .multi_line_string import MultiLineStringSchema from .multi_point import MultiPointSchema from .multi_polygon...
folt/marshmallow-geojson
marshmallow_geojson/geometry.py
.py
10f693b20032bf5c
7.62
16
"""GeometryCollection schema for GeoJSON.""" from __future__ import annotations from marshmallow import pre_load from marshmallow.fields import Float, List, Nested, Str from marshmallow.validate import OneOf from ._base import BaseSchema from .object_type import GEOMETRY_COLLECTION from .validate import Bbox, NoFeat...
folt/marshmallow-geojson
marshmallow_geojson/geometry_collection.py
.py
e131619d269f8c85
7.62
16
"""LineString geometry schema for GeoJSON.""" from __future__ import annotations from marshmallow import pre_load from marshmallow.fields import Float, List, Str from marshmallow.validate import OneOf from ._base import BaseSchema from .object_type import LINE_STRING from .validate import Bbox, LineStringCoordinates...
folt/marshmallow-geojson
marshmallow_geojson/line_string.py
.py
31989051e1619855
7.62
16
"""MultiLineString geometry schema for GeoJSON.""" from __future__ import annotations from marshmallow import pre_load from marshmallow.fields import Float, List, Str from marshmallow.validate import OneOf from ._base import BaseSchema from .object_type import MULTI_LINE_STRING from .validate import Bbox, LineString...
folt/marshmallow-geojson
marshmallow_geojson/multi_line_string.py
.py
18125f604d5bfc71
7.62
16
"""MultiPoint geometry schema for GeoJSON.""" from __future__ import annotations from marshmallow import pre_load from marshmallow.fields import Float, List, Str from marshmallow.validate import Length, OneOf from ._base import BaseSchema from .object_type import MULTI_POINT from .validate import Bbox, NoFeatureMemb...
folt/marshmallow-geojson
marshmallow_geojson/multi_point.py
.py
12ef61d31e00dac5
7.62
16
"""MultiPolygon geometry schema for GeoJSON.""" from __future__ import annotations from marshmallow import pre_load from marshmallow.fields import Float, List, Str from marshmallow.validate import OneOf from ._base import BaseSchema from .object_type import MULTI_POLYGON from .validate import Bbox, LinearRing, NoFea...
folt/marshmallow-geojson
marshmallow_geojson/multi_polygon.py
.py
880e314ff30ce881
7.62
16
"""GeoJSON object type definitions. This module defines the valid GeoJSON object types as specified in RFC 7946 Section 1.4. References: https://www.rfc-editor.org/rfc/rfc7946.html#section-1.4 """ from __future__ import annotations from enum import Enum POINT = "Point" MULTI_POINT = "MultiPoint" LINE_STRING = ...
folt/marshmallow-geojson
marshmallow_geojson/object_type.py
.py
505b5481f5405124
7.62
16
"""Point geometry schema for GeoJSON.""" from __future__ import annotations from marshmallow import pre_load from marshmallow.fields import Float, List, Str from marshmallow.validate import Length, OneOf from ._base import BaseSchema from .object_type import POINT from .validate import Bbox, NoFeatureMembers class...
folt/marshmallow-geojson
marshmallow_geojson/point.py
.py
dd146cfbad40b07f
7.62
16
"""Polygon geometry schema for GeoJSON.""" from __future__ import annotations from marshmallow import pre_load from marshmallow.fields import Float, List, Str from marshmallow.validate import OneOf from ._base import BaseSchema from .object_type import POLYGON from .validate import Bbox, LinearRing, NoFeatureMembers...
folt/marshmallow-geojson
marshmallow_geojson/polygon.py
.py
4eaa3fc4063f3a62
7.62
16
"""Properties schema for GeoJSON Feature objects.""" from __future__ import annotations from ._base import BaseSchema class PropertiesSchema(BaseSchema): """Base schema for Feature properties. This schema serves as a base class for custom property schemas. Users should subclass this schema to define th...
folt/marshmallow-geojson
marshmallow_geojson/property.py
.py
6b7fb407a178c686
7.62
16
"""Tests for bounding box validation according to RFC 7946.""" import pytest from marshmallow.exceptions import ValidationError from marshmallow_geojson import FeatureCollectionSchema, FeatureSchema, PointSchema class TestBoundingBoxValidation: """Test suite for bounding box validation.""" def test_valid_2...
folt/marshmallow-geojson
tests/test_bbox.py
.py
f4db0e065d1e628a
7.12
16
"""Tests for FeatureSchema.""" import json import pytest from marshmallow.exceptions import ValidationError from marshmallow_geojson import FeatureSchema from marshmallow_geojson.object_type import FEATURE class TestFeatureSchema: """Test suite for FeatureSchema validation and serialization.""" def test_v...
folt/marshmallow-geojson
tests/test_feature.py
.py
3d08075571901bfc
7.12
16
"""Tests for FeatureCollectionSchema.""" import copy import json import pytest from marshmallow.exceptions import ValidationError from marshmallow_geojson import FeatureCollectionSchema from marshmallow_geojson.object_type import FEATURE_COLLECTION class TestFeatureCollectionSchema: """Test suite for FeatureCo...
folt/marshmallow-geojson
tests/test_feature_collection.py
.py
9a2ae9385fe8f7cb
8.12
16
"""Tests for GeoJSONSchema.""" import json import pytest from marshmallow.exceptions import ValidationError from marshmallow_geojson import GeoJSONSchema from marshmallow_geojson.object_type import GeoJSONType class TestGeoJSONSchema: """Test suite for GeoJSONSchema validation and serialization.""" def te...
folt/marshmallow-geojson
tests/test_geojson.py
.py
01d46983e4c75f0f
7.12
16
"""Tests for unique GeoJSONSchema functionality not present in pydantic-geojson. This module tests features that are unique to marshmallow-geojson: - Universal GeoJSONSchema for all GeoJSON object types - GeometriesSchema for all geometry types - Marshmallow-specific parameters (only, exclude, partial, unknown) - get_...
folt/marshmallow-geojson
tests/test_geojson_schema_unique.py
.py
7d2bc978e498f429
7.12
16
"""Tests for GeometryCollectionSchema.""" import copy import json import pytest from marshmallow.exceptions import ValidationError from marshmallow_geojson import GeometryCollectionSchema from marshmallow_geojson.object_type import GEOMETRY_COLLECTION class TestGeometryCollectionSchema: """Test suite for Geome...
folt/marshmallow-geojson
tests/test_geometry_collection.py
.py
380770a43c4bbb27
8.12
16
"""Tests for LineStringSchema.""" import json import pytest from marshmallow.exceptions import ValidationError from marshmallow_geojson import LineStringSchema from marshmallow_geojson.object_type import LINE_STRING from tests.test_utils import assert_coordinates_equal class TestLineStringSchema: """Test suite...
folt/marshmallow-geojson
tests/test_line_string.py
.py
b87e5d85cb3cf5ee
7.12
16
"""Tests for MultiLineStringSchema.""" import json import pytest from marshmallow.exceptions import ValidationError from marshmallow_geojson import MultiLineStringSchema from marshmallow_geojson.object_type import MULTI_LINE_STRING from tests.test_utils import assert_coordinates_equal class TestMultiLineStringSche...
folt/marshmallow-geojson
tests/test_multi_line_string.py
.py
97c970c8b59e7abf
7.12
16
"""Tests for MultiPointSchema.""" import json import pytest from marshmallow.exceptions import ValidationError from marshmallow_geojson import MultiPointSchema from marshmallow_geojson.object_type import MULTI_POINT from tests.test_utils import assert_coordinates_equal class TestMultiPointSchema: """Test suite...
folt/marshmallow-geojson
tests/test_multi_point.py
.py
5499478509d40dbb
8.12
16
"""Tests for MultiPolygonSchema.""" import json import pytest from marshmallow.exceptions import ValidationError from marshmallow_geojson import MultiPolygonSchema from marshmallow_geojson.object_type import MULTI_POLYGON from tests.test_utils import assert_coordinates_equal class TestMultiPolygonSchema: """Te...
folt/marshmallow-geojson
tests/test_multi_polygon.py
.py
96d7ff1d03b05783
7.12
16
"""Tests for object_type module.""" import pytest from marshmallow_geojson import object_type class TestFormatStringType: """Test suite for object type string constants.""" @pytest.mark.parametrize( "constant,expected_value", [ (object_type.POINT, "Point"), (object_t...
folt/marshmallow-geojson
tests/test_object_type.py
.py
ceb97ada758def54
8.12
16
"""Tests for PointSchema.""" import json import pytest from marshmallow.exceptions import ValidationError from marshmallow_geojson import PointSchema from marshmallow_geojson.object_type import POINT from tests.test_utils import assert_coordinates_equal class TestPointSchema: """Test suite for PointSchema vali...
folt/marshmallow-geojson
tests/test_point.py
.py
ef8e95fdd083482e
8.12
16
"""Tests for PolygonSchema.""" import json import pytest from marshmallow.exceptions import ValidationError from marshmallow_geojson import PolygonSchema from marshmallow_geojson.object_type import POLYGON from tests.test_utils import assert_coordinates_equal class TestPolygonSchema: """Test suite for PolygonS...
folt/marshmallow-geojson
tests/test_polygon.py
.py
8662dfc1c14eff5f
7.12
16
"""Tests for type mixing validation according to RFC 7946 Section 7.1.""" from typing import Any import pytest from marshmallow.exceptions import ValidationError from marshmallow_geojson import ( FeatureCollectionSchema, FeatureSchema, GeometryCollectionSchema, LineStringSchema, MultiLineStringSc...
folt/marshmallow-geojson
tests/test_type_mixing_validation.py
.py
e4bc756a6d58faa6
7.12
16
"""Utility functions for tests.""" def assert_coordinates_equal(coord, expected): """Assert that coordinates match expected [lon, lat] or [lon, lat, alt]. Args: coord: Coordinate value (can be tuple, list, or dict). expected: Expected coordinate list [lon, lat] or [lon, lat, alt]. """ ...
folt/marshmallow-geojson
tests/test_utils.py
.py
d441cad27a6f89cb
7.12
16
#!/usr/bin/python3 -u # -*- mode: python; indent-tabs-mode: nil; python-indent-offset: 4 -*- # vim: autoindent tabstop=4 shiftwidth=4 expandtab softtabstop=4 filetype=python """ Query a TRex server running in ASTF mode for port information. STLClient cannot connect to an ASTF-mode TRex server, so this script uses AST...
perftool-incubator/bench-trafficgen
trafficgen/trex-astf-query.py
.py
3143fd4889b873ce
7.52
10
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2020 Edward Higgins <ed.higgins@york.ac.uk> # # Distributed under terms of the MIT license. """ IMAGES - Image access and manipulation module Description: images.py contains the ImageData class for storing datasets of multiple fr...
PoL-biophysics/pystachio-smt
pystachio_smt/images.py
.py
ebf12ac7188cf7e6
7.56
12
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # # Distributed under terms of the MIT license. """ SIMULATION - Dataset simulation module Description: simulation.py contains the code for the simulation task, which simulates pseudo-experimental datasets as characterised by the relevant para...
PoL-biophysics/pystachio-smt
pystachio_smt/simulation.py
.py
22824bdd47ffaad4
7.56
12
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Distributed under terms of the MIT license. """ SPOTS - Spot characterisation and manipulation module Description: spots.py contains the Spots class for characterising and manipulating data associated with bright spots in the image datasets ...
PoL-biophysics/pystachio-smt
pystachio_smt/spots.py
.py
8236de886a5b3b56
7.56
12
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2020 Edward Higgins <ed.higgins@york.ac.uk> # # Distributed under terms of the MIT license. """ TRACKING - Spot tracking module Description: tracking.py contains the code for the tracking task, which identifies spots within a set...
PoL-biophysics/pystachio-smt
pystachio_smt/tracking.py
.py
71bfe033cbe8ebe8
7.56
12
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2021 Edward Higgins <ed.higgins@york.ac.uk> # # Distributed under terms of the MIT license. """ TRAJECTORIES - Trajectory construction and manipulation module Description: trajectories.py contains the Trajectory class containing info...
PoL-biophysics/pystachio-smt
pystachio_smt/trajectories.py
.py
0bca30c6e60c6427
7.56
12
# -*- coding: utf-8 -*- """ PySTACHIO param testing script v0.2 JWS 2022 """ import glob import os import numpy as np import matplotlib.pyplot as plt import tifffile import sys import easygui def write_params(pfile, params, values): f = open(pfile, "w") for i in range(len(params)): f.write(f'{params[i...
PoL-biophysics/pystachio-smt
test_pystachio.py
.py
fae0c95b476cb56e
8.06
12
import dtlpy as dl import logging logger = logging.getLogger(name='dtlpy') class ServiceRunner(dl.BaseServiceRunner): """ Package runner class """ def __init__(self): """ Init package attributes here :return: """ def run(self, annotation, progress=None): ...
dataloop-ai/dtlpy
dtlpy/assets/service_runners/single_method_annotation.py
.py
f031a6946a23fb1b
7.66
20
import dtlpy as dl import logging logger = logging.getLogger(name='dtlpy') class ServiceRunner(dl.BaseServiceRunner): """ Package runner class """ def __init__(self): """ Init package attributes here :return: """ def run(self, item, progress=None): """ ...
dataloop-ai/dtlpy
dtlpy/assets/service_runners/single_method_item.py
.py
bd7fe753deb28476
7.66
20
import dtlpy as dl import logging logger = logging.getLogger(name='dtlpy') class ServiceRunner(dl.BaseServiceRunner): """ Package runner class """ def __init__(self): """ Init package attributes here :return: """ def run(self, item, dataset, config, annotation,...
dataloop-ai/dtlpy
dtlpy/assets/service_runners/single_method_multi_input.py
.py
80c333ca01a8a334
7.66
20
import os import json import glob import shutil from .base_cache import BaseCache class FileSystemCache(BaseCache): def __init__(self, options=None, size=1000, ttl=1000): """ docs """ if options is None: options = {} root_dir = options.get('rootDir', os.environ...
dataloop-ai/dtlpy
dtlpy/caches/filesystem_cache.py
.py
3ab06ac84b9c495a
7.66
20
import redis import json import datetime from .base_cache import BaseCache class RedisCache(BaseCache): def __init__(self, options=None, ttl=1000): if options is None: options = {} self.cache = redis.Redis( host=options.get('host', '127.0.0.1'), port=options.get...
dataloop-ai/dtlpy
dtlpy/caches/redis_cache.py
.py
6e0260c60017151f
7.66
20
from . import BaseAnnotationDefinition class Classification(BaseAnnotationDefinition): """ Classification annotation object """ type = "class" def __init__(self, label, attributes=None, description=None): super().__init__(description=description, attributes=attributes) self.la...
dataloop-ai/dtlpy
dtlpy/entities/annotation_definitions/classification.py
.py
baa2c001aa8dc30d
7.66
20
from . import BaseAnnotationDefinition class Comparison(BaseAnnotationDefinition): """ Comparison annotation object """ type = "comparison" def __init__(self, coordinates, label, attributes=None, description=None): super().__init__(description=description, attributes=attributes) s...
dataloop-ai/dtlpy
dtlpy/entities/annotation_definitions/comparison.py
.py
729f47677db09bb1
7.66
20
from . import BaseAnnotationDefinition class Description(BaseAnnotationDefinition): """ Subtitle annotation object """ def __init__(self, text, description=None): super().__init__(description=description) self.type = "item_description" self.text = text self.label =...
dataloop-ai/dtlpy
dtlpy/entities/annotation_definitions/description.py
.py
d8687dcc5f9ad84b
7.66
20
from . import BaseAnnotationDefinition class FreeText(BaseAnnotationDefinition): """ Free text annotation type (e.g. response for a prompt) """ type = "text" def __init__(self, text, label='free-text', attributes=None, description=None): """ Create a free text annotation :...
dataloop-ai/dtlpy
dtlpy/entities/annotation_definitions/free_text.py
.py
2951122c0117a077
7.66
20
from . import BaseAnnotationDefinition class GisType: """ State enum """ BOX = 'box' POLYGON = 'polygon' POLYLINE = 'polyline' POINT = 'point' class Gis(BaseAnnotationDefinition): """ Box annotation object Can create a box using 2 point using: "top", "left", "bottom",...
dataloop-ai/dtlpy
dtlpy/entities/annotation_definitions/gis.py
.py
0fa79be47af9caf2
7.66
20