text
stringlengths
185
73.3k
repo
stringlengths
7
100
path
stringlengths
4
146
language
stringclasses
7 values
hash
stringlengths
16
16
score
float64
7
8.5
stars
int64
0
237k
''' Copyright 2024 Capgemini 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 dist...
os-climate/sostrades-core
sostrades_core/datasets/dataset.py
.py
3b3e6ccd7c9f1102
7.56
12
''' Copyright 2024 Capgemini 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 dist...
os-climate/sostrades-core
sostrades_core/datasets/dataset_info/dataset_info_factory.py
.py
b2c053bf41f9ded8
7.56
12
''' Copyright 2024 Capgemini 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 dist...
os-climate/sostrades-core
sostrades_core/datasets/dataset_info/dataset_info_v0.py
.py
9b06978333bf951b
7.56
12
''' Copyright 2024 Capgemini 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 dist...
os-climate/sostrades-core
sostrades_core/datasets/dataset_info/dataset_info_v1.py
.py
2b81e5f60f322f5b
7.56
12
''' Copyright 2024 Capgemini 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 dist...
os-climate/sostrades-core
sostrades_core/datasets/datasets_connectors/datasets_connector_factory.py
.py
00a9736291ae5eae
7.56
12
''' Copyright 2024 Capgemini 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 dist...
os-climate/sostrades-core
sostrades_core/datasets/datasets_connectors/json_datasets_connector/json_dataset_connector_tools.py
.py
9c717d75577a43a8
7.56
12
''' Copyright 2025 Capgemini 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 dist...
os-climate/sostrades-core
sostrades_core/datasets/datasets_connectors/local_filesystem_datasets_connector/local_filesystem_datasets_connector_base.py
.py
f1221c9e2f2f65ce
7.56
12
''' Copyright 2022 Airbus SAS Modifications on 2023/10/10-2025/02/14 Copyright 2025 Capgemini 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 ...
os-climate/sostrades-core
sostrades_core/execution_engine/builder_tools/sos_tool.py
.py
f9ba0678f2aaf1dc
7.56
12
''' Copyright 2022 Airbus SAS Modifications on 2024/05/16 Copyright 2024 Capgemini 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...
os-climate/sostrades-core
sostrades_core/execution_engine/builder_tools/tool_builder.py
.py
1c3a59368c7fb6d9
7.56
12
''' Copyright 2022 Airbus SAS Modifications on 2023/05/12-2025/02/26 Copyright 2025 Capgemini 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 ...
os-climate/sostrades-core
sostrades_core/execution_engine/builder_tools/tool_factory.py
.py
78628101e1c202de
7.56
12
''' Copyright 2024 Capgemini 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, soft...
os-climate/sostrades-core
sostrades_core/execution_engine/discipline_driver_wrapp.py
.py
093274deb56a4c03
7.56
12
''' Copyright 2024 Capgemini 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, soft...
os-climate/sostrades-core
sostrades_core/execution_engine/discipline_wrapp.py
.py
a000418497214005
7.56
12
''' Copyright 2022 Airbus SAS Modifications on 2024/05/16-2025/02/14 Copyright 2025 Capgemini 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 ...
os-climate/sostrades-core
sostrades_core/execution_engine/disciplines_wrappers/discipline_gather_wrapper.py
.py
a4f7f0fd822eeafd
7.56
12
''' Copyright 2025 Capgemini 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 dist...
os-climate/sostrades-core
sostrades_core/execution_engine/disciplines_wrappers/monte_carlo_driver_wrapper.py
.py
c2f91caf80c6c2e2
7.56
12
''' Copyright 2022 Airbus SAS Modifications on 2023/04/13-2025/02/14 Copyright 2025 Capgemini 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 ...
os-climate/sostrades-core
sostrades_core/execution_engine/disciplines_wrappers/sample_generator_wrapper.py
.py
c687aeef079d3bb4
7.56
12
from __future__ import annotations from typing import Literal, TypedDict __all__ = ( "STOP_SIGNAL", "BracketTypeT", "ConfigT", "VolumeNumberT", ) BracketTypeT = Literal["square", "round", "curly"] # A volume number, or an omnibus range like `1-2` VolumeNumberT = int | float | tuple[int | float, int ...
noaione/nao-manga-rls
nmanga/_ntypes.py
.py
cc2e5adf15c3ab4c
7.42
6
""" MIT License Copyright (c) 2022-present noaione, anon Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, ...
noaione/nao-manga-rls
nmanga/autolevel.py
.py
1915ecb99deefc22
7.42
6
""" MIT License Copyright (c) 2022-present noaione Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publis...
noaione/nao-manga-rls
nmanga/cli/image_tagging.py
.py
23d909d42e34b6d6
7.42
6
import dataclasses import types from typing import Mapping from typing import Optional from h2o_discovery._internal.compat import tomllib def _empty_tokens_factory() -> Mapping[str, str]: return types.MappingProxyType({}) @dataclasses.dataclass(frozen=True) class Config: """Internal representation of the H...
h2oai/cloud-discovery-py
src/h2o_discovery/_internal/config.py
.py
629a37334836867d
7.45
7
import os from typing import Optional from typing import Union import urllib.parse _WELL_KNOWN_PATH = ".ai.h2o.cloud.discovery" _DEFAULT_LOCAL_CONFIG_PATH = "~/.h2oai/h2o-cli-config.toml" class DetermineURIError(LookupError): """Raised when the discovery endpoint cannot be determined.""" def determine_uri( ...
h2oai/cloud-discovery-py
src/h2o_discovery/_internal/lookup.py
.py
0c277ec2526736d7
7.45
7
import dataclasses import types from typing import Mapping from typing import Optional @dataclasses.dataclass(frozen=True) class Service: """Representation of a registered service record.""" #: Name of the Service. For example: "services/my-service-name". name: str #: Name of the Service that can be...
h2oai/cloud-discovery-py
src/h2o_discovery/model.py
.py
2068ab050acc71f3
7.45
7
import datetime import pytz from emergency_alerts_utils.timezones import ( local_timezone, utc_string_to_aware_gmt_datetime, ) class AlertDate(object): """Makes a datetime available in different formats""" def __init__(self, _datetime): self._datetime = _datetime # a timezone-aware UTC date...
alphagov/emergency-alerts-govuk
app/models/alert_date.py
.py
12aa7b9e6ca78711
7.48
8
import colorgram import colour import numpy as np import webcolors from ammico.utils import AnalysisMethod, get_color_table COLOR_SCHEMES = [ "CIE 1976", "CIE 1994", "CIE 2000", "CMC", "ITP", "CAM02-LCD", "CAM02-SCD", "CAM02-UCS", "CAM16-LCD", "CAM16-SCD", "CAM16-UCS", ...
ssciwr/AMMICO
ammico/colors.py
.py
bfe2d905745d3f8a
7.6
15
from __future__ import annotations import os import warnings from collections.abc import Sequence as _Sequence from concurrent.futures import ThreadPoolExecutor from typing import Any, ClassVar from PIL import Image from ammico.inference import InferenceModel from ammico.utils import AnalysisMethod, AnalysisType c...
ssciwr/AMMICO
ammico/image_summary.py
.py
1e140716aeefc178
7.6
15
from __future__ import annotations from enum import Enum from typing import Any class ProcessingLevel(Enum): """Define the three processing levels in a pipeline. FRAME: individual frame analysis CLIP: video segment (multiple frames) VIDEO: full video (multiple clips)""" FRAME = "frame" CLIP ...
ssciwr/AMMICO
ammico/prompt_builder.py
.py
5b465c5cb9b2d286
7.6
15
import os import pytest from PIL import Image from ammico.image_summary import ImageSummaryDetector from ammico.test.conftest import MockInferenceModel @pytest.mark.long def test_image_summary_detector_summary_and_questions(model, get_testdict): """One Qwen load for summary + VQA (avoids loading the VL model tw...
ssciwr/AMMICO
ammico/test/test_image_summary.py
.py
a27bc1564a262fc7
8.1
15
from __future__ import annotations import os import re import grpc import pandas as pd import spacy from google.auth.exceptions import DefaultCredentialsError from google.cloud import vision from googletrans import Translator from ammico.utils import AnalysisMethod PRIVACY_STATEMENT = """The Text Detector uses Goog...
ssciwr/AMMICO
ammico/text.py
.py
a42e53a9bc45e1a5
7.6
15
from __future__ import annotations import collections import glob import os import random import re import warnings from collections.abc import Iterable from enum import Enum from pathlib import Path from typing import ClassVar import importlib_resources import pooch import torch from pandas import Da...
ssciwr/AMMICO
ammico/utils.py
.py
bf47376be0cd2a02
7.6
15
#!/usr/bin/env python3 # This script tests the get_init() and get_wrf() functions in the models of unsatfit. # https://sekika.github.io/unsatfit/model.html # Laboratory drying SWRCs in the UNSODA database with 7 or more data points # are used for testing. If the R^2 value falls below the predetermined threshold, # the ...
sekika/unsatfit
dev/test_model.py
.py
fbeff8c159c61d99
7
9
def contour(self, x_name, y_name): """Contour of RMSE""" import numpy as np import matplotlib.pyplot as plt from .unsatfit import Fit # Set data and residual function param = self.model[self.model_name.replace('Modified ', '')]['param'] if self.ht_only: data = self.swrc par ...
sekika/unsatfit
unsatfit/_contour.py
.py
b7674c583546194a
7.5
9
""" Reads the real entity placements out of a scenario's Relic Chunky files. The `.info` file next to every scenario also lists the resource points, but it is a summary the editor writes on save and it goes stale: on `twin_beach_2p_mkii` it calls all five fuel points `territory_fuel_point_medium` while the map actuall...
cohstats/coh3-data
scripts/mp-maps/layer_parser.py
.py
b1e4ee1c75909ab1
7.48
8
""" Parser for Company of Heroes 3 scenario `.info` files. A `.info` file sits next to every scenario inside `ScenariosMP.sga` and is a plain text Lua table literal: HeaderInfo = { ScenarioDescription = "$11266018", mapsize = { 416, 416, }, point_positions = { { ebp...
cohstats/coh3-data
scripts/mp-maps/lua_info_parser.py
.py
503edc23fb67b705
7.48
8
""" Turns the territory cell grid into polygon outlines that a client can draw directly. The grid is a per cell sector id, so the exact outline of a sector is a staircase along cell edges. Tracing it verbatim costs about 205 vertices per sector (1.9 MB of JSON over all maps), and almost all of that is quantisation noi...
cohstats/coh3-data
scripts/mp-maps/sector_geometry.py
.py
a989239ffe9b0ee7
7.48
8
""" Reads the authored territory sectors out of a scenario's `*_territory.override`. Sectors are the regions *between* the resource points - the areas the game shades in the tactical map and that decide which points are cut off. They are painted by hand in the editor and stored per scenario, so unlike the point list t...
cohstats/coh3-data
scripts/mp-maps/territory_parser.py
.py
4a10f2081b8b3097
7.48
8
import json import os import argparse import re def create_locstring_dictionary(ucs_file_path): """ Reads a UCS file and creates a dictionary with locstring IDs as keys and text as values. The UCS file is tab-separated and UTF-16 encoded, with format: ID<tab>Text """ locstring_dict = {} ...
cohstats/coh3-data
scripts/ucs-to-json.py
.py
97142c57de6075ca
7.48
8
"""Extract the Final Stand (HOFF) perk trees into data/fs-perks.json. The game stores the perk trees in two places under xml/attrib/instances/perks: persistent_perk_tree/hoff/<tree>.xml one file per faction, the tier layout persistent_perk/hoff/<faction>/*.xml one file per perk, name / cost / modifiers This ...
cohstats/coh3-data
scripts/xml-to-json/fs_perks.py
.py
391be93ed779d00c
7.48
8
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Usage: vocab.py --train-src=<file> --train-tgt=<file> [options] VOCAB_FILE Options: -h --help Show this screen. --train-src=<file> File of training source sentences --train-tgt=<file> File of training target sentences ...
CAMeL-Lab/camel_morph
camel_morph/sandbox/vocab.py
.py
c116fc0458d20483
7.64
18
import logging import random from paho.mqtt import client as mqtt from paho.mqtt.enums import CallbackAPIVersion log = logging.getLogger(__name__) HANDLER_PREFIX = "on_action_" class Comms: def __init__( self, frontend, host="localhost", port=1883, topic="mopidy", ...
fmarzocca/Mopiqtt
mopiqtt/mqtt.py
.py
9e1c7f05e757a5ec
7.59
14
import logging log = logging.getLogger(__name__) UNKNOWN = "" def describe_track(track): """ Prepare a short human-readable Track description. track (mopidy.models.Track): Track to source song data from. """ title = track.name or UNKNOWN # Simple/regular case: normal song (e.g. from Spot...
fmarzocca/Mopiqtt
mopiqtt/utils.py
.py
23854330a1ff75d9
7.59
14
"""The `mustrd` command-line tool. Runs a MustrdTest configuration (the same TTL config the pytest plugin uses) and produces the same reports — coverage / competency questions / Markdown / RDF — WITHOUT pytest. Spec execution goes through mustrd.runner and reporting goes through mustrd.reporting, the shared libraries ...
Semantic-partners/mustrd
mustrd/cli.py
.py
f0a5bcfb43f0a860
7.42
6
"""The MustrdTest configuration file: parse it, SHACL-validate it, resolve paths. A plain library with no pytest dependency, so the `mustrd` CLI (via runner.py) and the pytest plugin read the same configuration the same way. It was extracted from mustrdTestPlugin.py, which re-exports `TestConfig`/`parse_config` for ca...
Semantic-partners/mustrd
mustrd/config.py
.py
0d5414755d20c52f
7.42
6
"""Render a coverage result as RDF (W3C DQV + PROV), for a knowledge graph. Turns the dict `compute_coverage` produces into a graph that can be merged into a triplestore and queried: DQV quality measurements (term coverage, as a decimal ratio) `dqv:computedOn` the ontology IRI(s) and their `owl:versionIRI`, plus a `co...
Semantic-partners/mustrd
mustrd/coverage_rdf.py
.py
486425848d245b01
7.42
6
"""The one place mustrd configures logging — and only when mustrd is the application. The rule, applied throughout the package: - Library modules do `log = logging.getLogger(__name__)` and nothing else. Importing mustrd must never add, remove or re-level a handler: whoever imported it owns that decision, an...
Semantic-partners/mustrd
mustrd/logger_setup.py
.py
e11808efdf9a5c02
7.42
6
"""Stardog execution backend for mustrd. Talks to a Stardog server over its HTTP SPARQL protocol (https://docs.stardog.com/query-stardog/#http-and-sparql-protocols). Two things set this backend apart from the GraphDb/Anzo ones: * Authentication prefers a bearer token (``Authorization: Bearer <token>``) and falls b...
Semantic-partners/mustrd
mustrd/mustrdStardog.py
.py
66965f0904862f75
7.42
6
"""Embed the sources a run read — spec Turtle and executed SPARQL — as RDF. The rest of the run graph records *paths* (`must:specSourceFile`, `cov:sourceFile`), which only resolve from the working directory the run happened in. A report that travels — an emailed file, a CI artifact, a page on a static site — needs the...
Semantic-partners/mustrd
mustrd/sources_rdf.py
.py
d0220240217a7391
7.42
6
import json import warnings from contextlib import contextmanager from pathlib import Path from requests import HTTPError, RequestException, Response # Keep this function in a file directly under project root / src def get_mustrd_root() -> Path: return Path(__file__).parent def manage_http_response(response: R...
Semantic-partners/mustrd
mustrd/utils.py
.py
ed15d6095df62153
7.42
6
"""Build the self-contained run viewer: one HTML file, driven by the run's RDF. The page is assembled with Jinja from `mustrd/templates/viewer/`: viewer.html.jinja the shell, which includes everything below viewer.css the stylesheet van.js vendored VanJS 1.6.1 (MIT) turtle.js ...
Semantic-partners/mustrd
mustrd/viewer.py
.py
95391deed7483f6c
7.42
6
"""Configurable TLS ciphers for anzo_utils. These need no server. Every test in test_mustrd_anzo.py skips unless one is configured, which is exactly why the cipher behaviour needs pinning here instead: the old global urllib3 DEFAULT_CIPHERS mutation disappeared with urllib3 2.x and nothing in CI would have noticed. ""...
Semantic-partners/mustrd
test/test_anzo_tls.py
.py
ae7338e0e7c9d46d
7.92
6
"""Tests for the standalone `mustrd` CLI (mustrd.cli). Drives the same runnable example the pytest plugin test uses (docs/examples/geography-example) and asserts the CLI produces the same report content WITHOUT pytest, plus the JSON-LD serialization the viewer consumes. """ import os import subprocess import sys impor...
Semantic-partners/mustrd
test/test_cli.py
.py
045482a080bf7c61
7.92
6
"""End-to-end tests for the --term-coverage / --cq plugin wiring. Runs the mustrd pytest plugin over the runnable example in docs/examples/geography-example (the same fixtures the worked-example report is generated from) and asserts the report it produces. Nested pytest.main invocation mirrors test/test_pytest_mustrd....
Semantic-partners/mustrd
test/test_coverage_plugin.py
.py
0f5b11358ad1d4dd
7.92
6
"""Data-level tests: compute_coverage -> coverage_graph emits the right triples. The RDF graph is the canonical output of a coverage run; here we assert the *data* it contains, independently of how it's later rendered. """ from rdflib import Graph, URIRef, Namespace, RDF, XSD, Literal from mustrd.coverage import comp...
Semantic-partners/mustrd
test/test_coverage_rdf.py
.py
d42fc29fb7770d26
7.92
6
"""Rendering-level tests: the Coverage Report Markdown is a pure function of the coverage RDF graph (+ the ontology, for the subClassOf tree). Fixture in: the committed example graph and its ontologies. Out: the Markdown Coverage Report. This exercises the renderer without recomputing coverage. """ from pathlib import...
Semantic-partners/mustrd
test/test_coverage_render.py
.py
7578dcca167fc418
7.92
6
import time from threading import Thread from tf2utilities.schema import Schema class TF2: def __init__( self, api_key: str = "", auto_update: bool = False, update_time: int = 24 * 60 * 60, lite: bool = False ) -> None: """ ...
dixon2004/python-tf2-utilities
tf2utilities/main.py
.py
798fe151d45e3a7e
7.42
6
""" Compute the Wachspress Barycentric ccoordinate for a convex polygon. These can be directly used for barycentric interpolation. """ import numba as nb import numpy as np from numba_celltree.constants import ( PARALLEL, FloatArray, FloatDType, IntArray, ) from numba_celltree.geometry_utils import ( ...
Deltares/numba_celltree
numba_celltree/algorithms/barycentric_wachspress.py
.py
3b310c2314cd4ebe
7.57
13
""" Slightly adapted from: https://github.com/scivision/lineclipping-python-fortran (MIT License) """ from typing import Tuple import numba as nb import numpy as np from numba_celltree.constants import Box, Point INSIDE, LEFT, RIGHT, LOWER, UPPER = 0, 1, 2, 4, 8 @nb.njit(inline="always") def get_clip(a: Point, b...
Deltares/numba_celltree
numba_celltree/algorithms/cohen_sutherland.py
.py
87709dadccd1a7e6
7.57
13
""" Implementation based off the description in: Skala, V. (1993). An efficient algorithm for line clipping by convex polygon. Computers & Graphics, 17(4), 417-421. Available at: https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.302.5729&rep=rep1&type=pdf Also available in: Duc Huy Bui, 1999. Algorithms for L...
Deltares/numba_celltree
numba_celltree/algorithms/cyrus_beck.py
.py
2b1d05035cfe5c05
7.57
13
""" Sutherland-Hodgman clipping --------------------------- Vertices (always lower case, single letter): Clipping polygon with vertices r, s, ... Subject polgyon with vertices a, b, ... Vectors (always upper case, single letter): * U: r -> s * N: norm, orthogonal to u * V: a -> b * W: a -> r s ----- ... | | ...
Deltares/numba_celltree
numba_celltree/algorithms/sutherland_hodgman.py
.py
2f0c5b635fccda34
7.57
13
from typing import Optional, Tuple import numba as nb from numba_celltree.algorithms import ( area_of_intersection, barycentric_triangle_weights, barycentric_wachspress_weights, box_area_of_intersection, polygons_intersect, ) from numba_celltree.cast import cast_bboxes, cast_edges, cast_faces, cas...
Deltares/numba_celltree
numba_celltree/celltree.py
.py
a70df39052200fb4
7.57
13
import abc from typing import Optional import numpy as np from numba_celltree.constants import ( MIN_TOLERANCE, TOLERANCE_FACTOR, BoolArray, FloatArray, FloatDType, IntArray, ) from numba_celltree.query import ( collect_node_bounds, validate_node_bounds, ) def bbox_tree(bb_coords: Fl...
Deltares/numba_celltree
numba_celltree/celltree_base.py
.py
4fc693dda976d16c
7.57
13
""" Types and constants. Note: it is not advisable to change either the IntDType or the FloatDType. In case of the floats, 64-bit has much higher precision, which may be quite relevant for geometry: more precision for edge cases, etc. In case of the integers, Python has surprisingly (ambiguous) behavior. Since numba...
Deltares/numba_celltree
numba_celltree/constants.py
.py
ea21747f30e2d106
7.57
13
from typing import List, Tuple import numba as nb import numpy as np from numba_celltree.constants import ( FLOAT_MAX, FLOAT_MIN, INT_MAX, Bucket, BucketArray, BucketDType, FloatArray, IntArray, IntDType, Node, NodeArray, NodeDType, ) from numba_celltree.utils import ( ...
Deltares/numba_celltree
numba_celltree/creation.py
.py
197798f21a8954b9
7.57
13
from typing import Tuple import matplotlib.tri import numpy as np from matplotlib import patches from matplotlib.collections import LineCollection from numba_celltree.constants import IntArray, IntDType def close_polygons(face_node_connectivity: IntArray, fill_value: int) -> IntArray: # Wrap around and create c...
Deltares/numba_celltree
numba_celltree/demo.py
.py
bd07761f36dcf39e
7.57
13
from typing import Optional, Tuple import numba as nb import numpy as np from numba_celltree.cast import cast_edges, cast_vertices from numba_celltree.celltree_base import ( CellTree2dBase, bbox_distances, bbox_tree, default_tolerance, ) from numba_celltree.constants import ( MIN_TOLERANCE, TO...
Deltares/numba_celltree
numba_celltree/edge_celltree.py
.py
c2128c852e9b74b6
7.57
13
from typing import Sequence, Tuple import numba as nb import numpy as np from numba_celltree.constants import ( FILL_VALUE, MIN_TOLERANCE, NDIM, PARALLEL, TOLERANCE_FACTOR, Box, FloatArray, FloatDType, IntArray, Point, Triangle, Vector, ) from numba_celltree.utils impor...
Deltares/numba_celltree
numba_celltree/geometry_utils.py
.py
3245e95f17d5e2da
7.57
13
import numpy as np import pytest from numba_celltree.algorithms import ( cohen_sutherland_line_box_clip, cyrus_beck_line_polygon_clip, liang_barsky_line_box_clip, ) from numba_celltree.constants import Box, Point def ab(a, b, c): """Flip the result around to compare (a, b) with (b, a)""" return (...
Deltares/numba_celltree
tests/test_algorithms/test_line_box_clip.py
.py
e2551607cf8fa727
7.07
13
"""Utilizes same boxes as test_line_box_clip""" import numpy as np from numba_celltree.algorithms.cyrus_beck import cyrus_beck_line_polygon_clip from numba_celltree.constants import Point def ab(a, b, c): """Flip the result around to compare (a, b) with (b, a)""" return (a, c, b) TOLERANCE = 1e-9 def li...
Deltares/numba_celltree
tests/test_algorithms/test_line_polygon_clip.py
.py
bfce4bc8203ca511
7.07
13
# Copyright Rouven Bauer # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, soft...
robsdedude/flake8-picky-parentheses
tests/_common.py
.py
0442770eb11b2949
7
9
# -*- coding: utf-8 -*- import logging.config import os import re from typing import Any import yaml from yaml.parser import ParserError class YAMLConfig(object): """YAMLConfig class for loading YAML configurations with custom tagging and transformation rules. This class adds a custom envvar tag to native Y...
zobayer1/logging-extras
logging_/config/yaml_config.py
.py
b7b4b3067450a7d9
7.48
8
# -*- coding: utf-8 -*- import atexit import copy import logging.config from logging import Handler, LogRecord from logging.handlers import QueueListener from typing import Any class QueueListenerHandler(Handler): """QueueListenerHandler class for managing a queue listener with configured handlers. This clas...
zobayer1/logging-extras
logging_/handlers/queue_listener_handler.py
.py
86a74b83f6378251
7.48
8
# -*- coding: utf-8 -*- import logging.config import pytest import yaml config_yaml = """ version: 1 objects: queue: class: queue.Queue maxsize: 1000 formatters: simple: format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s' handlers: console: class: logging.StreamHandler formatter: ...
zobayer1/logging-extras
tests/test_handlers/test_queue_listener_handler.py
.py
b4f26163f3a40cdf
7.98
8
# Copyright (C) 2022 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, includi...
ansys/pyacp
examples/modeling_features/020-solid_model.py
.py
fb028da5aecae047
7.45
7
# Copyright (C) 2022 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, includi...
ansys/pyacp
src/ansys/acp/core/_dependency_graph.py
.py
b5453f9679401c95
7.45
7
# Copyright (C) 2022 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, includi...
ansys/pyacp
src/ansys/acp/core/_model_printer.py
.py
aa3cd07ab1dac163
7.45
7
# Copyright (C) 2022 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, includi...
ansys/pyacp
src/ansys/acp/core/_recursive_copy.py
.py
182bc83b29be03eb
7.45
7
# Copyright (C) 2022 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, includi...
ansys/pyacp
src/ansys/acp/core/_server/acp_instance.py
.py
d60023fa9df3dc96
7.45
7
# Copyright (C) 2022 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, includi...
ansys/pyacp
src/ansys/acp/core/_server/common.py
.py
88503638a3888e95
7.45
7
# Copyright (C) 2022 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, includi...
ansys/pyacp
src/ansys/acp/core/_server/direct.py
.py
7be2103bc293678c
7.45
7
# Copyright (C) 2022 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, includi...
ansys/pyacp
src/ansys/acp/core/_server/docker_compose.py
.py
b9e4acdd1f08cf73
7.45
7
# Copyright (C) 2022 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, includi...
ansys/pyacp
src/ansys/acp/core/_tree_objects/_elemental_or_nodal_data.py
.py
9b5bc5794bed5598
7.45
7
# Copyright (C) 2022 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, includi...
ansys/pyacp
src/ansys/acp/core/_tree_objects/_grpc_helpers/edge_property_list.py
.py
7650dc08b483d447
7.45
7
# Copyright (C) 2022 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, includi...
ansys/pyacp
src/ansys/acp/core/_tree_objects/_grpc_helpers/enum_wrapper.py
.py
34c84e8b81c01b39
7.45
7
# Copyright (C) 2022 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, includi...
ansys/pyacp
src/ansys/acp/core/_tree_objects/_grpc_helpers/linked_object_helpers.py
.py
76f84220e971fb2e
7.45
7
# Copyright (C) 2022 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, includi...
ansys/pyacp
src/ansys/acp/core/_tree_objects/_grpc_helpers/linked_object_list.py
.py
f06d7eaab94434fe
7.45
7
# Copyright (C) 2022 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, includi...
ansys/pyacp
src/ansys/acp/core/_tree_objects/_grpc_helpers/polymorphic_from_pb.py
.py
0af74e1814bc9909
7.45
7
# Copyright (C) 2022 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, includi...
ansys/pyacp
src/ansys/acp/core/_tree_objects/_grpc_helpers/property_helper.py
.py
db99d0477b2cc38a
7.45
7
from tqdm import tqdm import numpy as np import lmdb import os.path as op import cv2 as cv import pyarrow as pa from glob import glob def dumps_pyarrow(obj): """ Serialize an object. Returns: Implementation-dependent bytes-like object """ return pa.serialize(obj).to_buffer() def fetch_lm...
zc-alexfan/render_mano_ih
package_segm_lmdb.py
.py
6588de0981fbdd14
7.57
13
import numpy as np import torch import neural_renderer as nr import os N_PARTS = 16 * 2 N_VERTEX = 778 + 1 def add_seal_vertex(vertex): circle_v_id = np.array( [108, 79, 78, 121, 214, 215, 279, 239, 234, 92, 38, 122, 118, 117, 119, 120], dtype=np.int32, ) center = (vertex[circle_v_id, :])...
zc-alexfan/render_mano_ih
render_utils.py
.py
9676af35c8de08ef
7.57
13
from oauthlib.oauth2 import BackendApplicationClient, TokenExpiredError from requests_oauthlib import OAuth2Session import os import threading import time TOKEN_URL = ( "https://identity.dataspace.copernicus.eu/auth/realms/CDSE" "/protocol/openid-connect/token" ) # Re-authenticate this many seconds before the...
digitalearthafrica/deafrica-scripts
deafrica/data/cdse_pipelines/auth.py
.py
6df8c8cc7b03f896
7.5
9
import copy import os from .utils import load_evalscript def _build_data_block(sat_config: dict, time_from: str, time_to: str) -> dict: """ Build the processRequest block. Optional dataFilter keys (acquisitionMode, polarization, resolution) and the processing block are only included when set in sat_...
digitalearthafrica/deafrica-scripts
deafrica/data/cdse_pipelines/payloads.py
.py
4e632bb542599bd3
7.5
9
#!/usr/bin/env python3 """ Sentinel-1 RTC CARD4L metadata XML generator. Scans the CloudFerro (CF) bucket for completed CDSE batch jobs and generates a CARD4L-compliant metadata XML file for each tile. A metadata XML file is generated if: - a metadata XML does not already exist for that key AND - userdata.json ex...
digitalearthafrica/deafrica-scripts
deafrica/data/cdse_pipelines/s1_generate_xml_metadata.py
.py
d33912311524cb36
7.5
9
import json import time from importlib.resources import files from deafrica.logs import setup_logging SH_BATCH_URL = "https://sh.dataspace.copernicus.eu/api/v2/batch/process" log = setup_logging() def load_evalscript(path): return files("deafrica.data.cdse_pipelines").joinpath(path).read_text() def poll_stat...
digitalearthafrica/deafrica-scripts
deafrica/data/cdse_pipelines/utils.py
.py
c3bfd7375c6619f3
7.5
9
""" Prepare eo3 metadata for a Copernicus Global Land Service - Lake Water Quality dataset. """ import logging import warnings from datetime import datetime import rioxarray from eodatasets3.images import ValidDataMethod from odc.apps.dc_tools._docs import odc_uuid from deafrica.data.cgls_lwq.filename_parser import ...
digitalearthafrica/deafrica-scripts
deafrica/data/cgls_lwq/prepare_metadata.py
.py
a2e2fb0443763f36
7.5
9
""" This module contains functions to handle tile management for the CGLS Lake Water Quality products. """ import geopandas as gpd from odc.dscache._utils import to_tile_shape from odc.geo import CRS, XY, Resolution from odc.geo.geom import Geometry from odc.geo.gridspec import GridSpec from deafrica.utils import AFR...
digitalearthafrica/deafrica-scripts
deafrica/data/cgls_lwq/tiles.py
.py
d4cc254e76ba8e2b
7.5
9
import calendar import json import sys from datetime import datetime from typing import Optional, Tuple import click import pystac import requests from odc.apps.dc_tools._docs import odc_uuid from odc.aws import s3_dump, s3_head_object from pystac.utils import datetime_to_str from rasterio.io import MemoryFile from ri...
digitalearthafrica/deafrica-scripts
deafrica/data/chirps.py
.py
11ce6de3b87f7ff9
7.5
9
import json import zipfile from os import environ from pathlib import Path from tempfile import mkdtemp import cdsapi import click import pystac import xarray as xr from datacube.utils.cog import write_cog from datacube.utils.geometry import assign_crs from odc.apps.dc_tools._docs import odc_uuid from odc.aws import s...
digitalearthafrica/deafrica-scripts
deafrica/data/copernicus_cci.py
.py
a634decee729f4c1
7.5
9
""" Download the ESA WorldCereal 10 m 2021 v100 products from Zenodo, convert to Cloud Optimized Geotiff, and push to an S3 bucket. Datasource: https://zenodo.org/records/7875105 """ import os import posixpath from subprocess import STDOUT, check_output from zipfile import ZipFile import click import geopandas as gp...
digitalearthafrica/deafrica-scripts
deafrica/data/esa_worldcereal/download_cogs.py
.py
753218dedcdc5d2f
7.5
9
import os import posixpath from deafrica.io import is_local_path def parse_geotiff_url(geotiff_url: str) -> tuple[str]: """ Get the filename components of an ESA WorldCereal AEZ-based GeoTIFF url. Parameters ---------- geotiff_url : str ESA WorldCereal AEZ-based GeoTIFF file path. ...
digitalearthafrica/deafrica-scripts
deafrica/data/esa_worldcereal/geotiff.py
.py
635fe314949437b4
7.5
9
""" Create per dataset metadata (stac files) for the ESA WorldCereal 10 m 2021 v100 products. """ import json import os import posixpath import sys from pathlib import Path import click import numpy as np from eodatasets3.serialise import to_path from eodatasets3.stac import to_stac_item from deafrica.data.esa_world...
digitalearthafrica/deafrica-scripts
deafrica/data/esa_worldcereal/metadata_generator.py
.py
c7e4fbf03ae3bbc5
7.5
9
""" Prepare eo3 metadata for ESA WorldCereal 10 m 2021 v100 products. """ from datetime import datetime import rioxarray from eodatasets3.images import ValidDataMethod from eodatasets3.model import DatasetDoc from odc.apps.dc_tools._docs import odc_uuid from deafrica.data.easi_assemble import EasiPrepare def get_c...
digitalearthafrica/deafrica-scripts
deafrica/data/esa_worldcereal/prepare_metadata.py
.py
9d22ad19525199c1
7.5
9
""" Download the Global Mangrove Watch (1996 - 2020) Version 3.0 Dataset for a year from Zenodo, convert to CLoud Optimized Geotiff, and push to an S3 bucket Datasource: https://zenodo.org/records/6894273 """ import json import os import shutil from datetime import datetime from pathlib import Path from typing import...
digitalearthafrica/deafrica-scripts
deafrica/data/gmw.py
.py
4a9dab418c9d3f75
7.5
9