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
# -*- coding: utf-8 -*- """Typer-based CLI for phabfive.""" import os import re import sys from importlib.metadata import version from typing import Optional # Disable Typer's Rich formatting for help text to remove fancy boxes os.environ.setdefault("TYPER_USE_RICH", "0") import typer from phabfive.cli.diffusion im...
dynamist/phabfive
phabfive/cli/__init__.py
.py
abdd8796be96e3a5
7.42
6
# -*- coding: utf-8 -*- """Diffusion commands for phabfive CLI.""" import sys from typing import Optional import typer from phabfive.constants import REPO_STATUS_CHOICES from phabfive.exceptions import PhabfiveConfigException diffusion_app = typer.Typer(help="The diffusion app") repo_app = typer.Typer(help="Reposit...
dynamist/phabfive
phabfive/cli/diffusion.py
.py
76cc0433e7199140
7.42
6
# -*- coding: utf-8 -*- """Passphrase commands for phabfive CLI.""" import sys from typing import List, Optional import typer from phabfive.exceptions import ( PhabfiveConfigException, PhabfiveDataException, PhabfiveRemoteException, ) passphrase_app = typer.Typer(help="The passphrase app") def _get_pa...
dynamist/phabfive
phabfive/cli/passphrase.py
.py
cb4a91b03d92edd6
7.42
6
# -*- coding: utf-8 -*- """User commands for phabfive CLI.""" import sys import typer from phabfive.core import Phabfive from phabfive.exceptions import PhabfiveConfigException user_app = typer.Typer(help="Information on users, setup wizard") def _get_output_format(ctx: typer.Context) -> str: """Get the outpu...
dynamist/phabfive
phabfive/cli/user.py
.py
af904b25b6acf6d5
7.42
6
# -*- coding: utf-8 -*- from enum import Enum class OutputFormat(str, Enum): """Output format options for CLI commands.""" rich = "rich" # Human-readable with Rich formatting tree = "tree" # Tree view with Rich Tree yaml = "yaml" # Machine-readable YAML json = "json" # Machine-readable JSON ...
dynamist/phabfive
phabfive/constants.py
.py
4a183e30720761a6
7.42
6
# -*- coding: utf-8 -*- """Main Diffusion class that orchestrates all submodules.""" import logging from phabricator import APIError from phabfive import passphrase from phabfive.constants import IO_NEW_URI_CHOICES, DISPLAY_CHOICES from phabfive.core import Phabfive from phabfive.diffusion.fetchers import fetch_bra...
dynamist/phabfive
phabfive/diffusion/core.py
.py
c2fda57f3c81e4de
7.42
6
# -*- coding: utf-8 -*- """API data fetching functions for Diffusion module.""" from phabricator import APIError from phabfive.diffusion.resolvers import resolve_shortname_to_id from phabfive.exceptions import PhabfiveDataException def fetch_repositories(phab, query_key=None, attachments=None, constraints=None): ...
dynamist/phabfive
phabfive/diffusion/fetchers.py
.py
6e79409da9eae1d1
7.42
6
# -*- coding: utf-8 -*- """PHID and identifier resolution functions for Diffusion module.""" from phabfive.exceptions import PhabfiveDataException def resolve_shortname_to_id(phab, shortname): """ Resolve repository shortname to its numeric ID. Parameters ---------- phab : Phabricator P...
dynamist/phabfive
phabfive/diffusion/resolvers.py
.py
a0866c411d432a1a
7.42
6
# -*- coding: utf-8 -*- """Input validation functions for Diffusion module.""" import re from phabfive.constants import MONOGRAMS from phabfive.exceptions import PhabfiveDataException def validate_repo_identifier(repo_id): """ Validate repository identifier format (e.g., R123). Parameters --------...
dynamist/phabfive
phabfive/diffusion/validators.py
.py
70aa4c001bc6e888
7.42
6
# -*- coding: utf-8 -*- """Formatters for edit operations.""" def display_changes(task_monogram, result): """Display the changes made to a task. Args: task_monogram (str): Task monogram (e.g., "T123") result (dict): Result from edit_task_by_id with 'changes' list """ if not result: ...
dynamist/phabfive
phabfive/edit/formatters.py
.py
22620119005725ef
7.42
6
# -*- coding: utf-8 -*- """Validators for edit operations.""" def get_task_boards(task_data): """Extract board PHIDs from task data. Args: task_data (dict): Task data from maniphest.search with attachments Returns: list: List of board PHIDs the task is on """ try: boards ...
dynamist/phabfive
phabfive/edit/validators.py
.py
c5f3b5d0db8a243f
7.42
6
# -*- coding: utf-8 -*- """External editor support for phabfive.""" import difflib import os import subprocess import sys import tempfile def get_editor(): """Get the user's preferred editor.""" return os.environ.get("EDITOR") or os.environ.get("VISUAL") or "vi" def edit_text(initial_text="", prefix="", su...
dynamist/phabfive
phabfive/editor.py
.py
440f6489a227a13f
7.42
6
# -*- coding: utf-8 -*- """Task filtering functions for Maniphest operations.""" import logging from phabfive.maniphest.fetchers import ( fetch_all_transactions, fetch_priority_transactions, fetch_task_transactions, get_column_info, get_current_column, ) log = logging.getLogger(__name__) def t...
dynamist/phabfive
phabfive/maniphest/filters.py
.py
1dec5a3418761911
7.42
6
# -*- coding: utf-8 -*- """PHID resolution functions for Maniphest operations.""" import difflib import fnmatch import logging from phabfive.exceptions import ( PhabfiveConfigException, PhabfiveRemoteException, ) log = logging.getLogger(__name__) def parse_plus_separated(values): """ Parse plus-se...
dynamist/phabfive
phabfive/maniphest/resolvers.py
.py
e16109ca92fb99ff
7.42
6
# -*- coding: utf-8 -*- """Utility functions for Maniphest operations.""" import datetime import json import logging import re import time from collections.abc import Mapping from typing import Optional from jinja2 import Environment, Template, meta from phabfive.exceptions import PhabfiveDataException log = loggi...
dynamist/phabfive
phabfive/maniphest/utils.py
.py
8905d5267c1c308d
7.42
6
# -*- coding: utf-8 -*- """Validation functions for Maniphest operations.""" import logging from phabfive.exceptions import PhabfiveConfigException log = logging.getLogger(__name__) def validate_priority(priority): """ Validate and normalize priority value. Parameters ---------- priority : st...
dynamist/phabfive
phabfive/maniphest/validators.py
.py
4d42bf4c94730201
7.42
6
# -*- coding: utf-8 -*- """Core Passphrase class for credential management.""" import json import logging import re from phabricator import APIError from phabfive.constants import MONOGRAMS from phabfive.core import Phabfive from phabfive.exceptions import PhabfiveDataException, PhabfiveRemoteException log = loggin...
dynamist/phabfive
phabfive/passphrase/core.py
.py
9cb8c0a785495225
7.42
6
# -*- coding: utf-8 -*- """Core paste functionality for phabfive.""" # python std lib import re # phabfive imports from phabfive.constants import MONOGRAMS from phabfive.core import Phabfive from phabfive.exceptions import PhabfiveDataException # 3rd party imports from phabricator import APIError class Paste(Phabf...
dynamist/phabfive
phabfive/paste/core.py
.py
9afeabfadc125b4c
7.42
6
# -*- coding: utf-8 -*- # python std lib import fnmatch import logging # phabfive imports from phabfive.exceptions import PhabfiveException log = logging.getLogger(__name__) class ProjectPattern: """ Represents a single project pattern with AND conditions. A pattern can have multiple conditions that m...
dynamist/phabfive
phabfive/project_filters.py
.py
81fb27e5e7b76690
7.42
6
# -*- coding: utf-8 -*- """Interactive first-run configuration setup for phabfive.""" import json import logging import os import re import sys from phabricator import Phabricator, APIError from rich.console import Console from rich.prompt import Prompt, Confirm from phabfive.constants import VALIDATORS log = logg...
dynamist/phabfive
phabfive/setup.py
.py
9d35448a742e93ed
7.42
6
# -*- coding: utf-8 -*- """ Priority transition pattern matching for task priorities. This module provides pattern matching for task priority changes, supporting conditions like 'from:High', 'to:Normal', 'in:Low', 'raised', 'lowered'. """ import logging from phabfive.transitions.base import ( parse_condition_pa...
dynamist/phabfive
phabfive/transitions/priority.py
.py
5d2e635b77452e97
7.42
6
# -*- coding: utf-8 -*- """ Status transition pattern matching for task statuses. This module provides pattern matching for task status changes, supporting conditions like 'from:Open', 'to:Resolved', 'in:Blocked', 'raised', 'lowered'. """ import logging from phabfive.transitions.base import ( parse_condition_pa...
dynamist/phabfive
phabfive/transitions/status.py
.py
8f733f6def22a63f
7.42
6
# -*- coding: utf-8 -*- # python std lib import json import logging import os import stat from urllib.parse import urlparse # 3rd party imports from phabricator import APIError, Phabricator # phabfive imports from phabfive.core import Phabfive from phabfive.exceptions import PhabfiveConfigException, PhabfiveRemoteEx...
dynamist/phabfive
phabfive/user.py
.py
474660c88fa1c8a2
7.42
6
# -*- coding: utf-8 -*- """YAML utilities for phabfive.""" import sys from collections import defaultdict from ruamel.yaml import YAML def parse_yaml_from_stdin(parse_monogram_func): """Parse YAML documents from stdin. Args: parse_monogram_func: Function to parse monograms (e.g., Phabfive.parse_mon...
dynamist/phabfive
phabfive/yaml_utils.py
.py
2ff0c94a936ce1c0
7.42
6
''' Module : Main Description : The main entry point for the program. Copyright : (c) Bernie Pope, 16 Oct 2019 License : MIT Maintainer : bjpope@unimelb.edu.au Portability : POSIX Outlier detection for varlap ''' from argparse import ArgumentParser import sys import logging import pkg_resources import ...
bjpop/varlap
varlap/varlap_outliers.py
.py
3322881a11c46b2a
7.45
7
# -*- coding: utf-8 -*- import json import os from elasticsearch import NotFoundError, Elasticsearch import elasticsearch_dsl from pybana.elastic.elastic_client import ElasticsearchExtClient from .models import Config, Dashboard, DataView, IndexPattern, Visualization, Search __all__ = ("Kibana",) DEFAULT_CONFIG =...
optimdata/pybana
pybana/client.py
.py
2c9b9ae13b9965b5
7.42
6
# -*- coding: utf-8 -*- import json import os import subprocess import vl_convert as vlc from typing import Any, Dict, Optional, Union from sentry_sdk import capture_exception __all__ = ("InvalidVegaSpecException", "VegaRenderer") class InvalidVegaSpecException(Exception): def __init__(self, message, vega_cli_...
optimdata/pybana
pybana/helpers/vega.py
.py
7361d014262cf439
7.42
6
# -*- coding: utf-8 -*- """ Resolve Kibana 8+ saved-object references to index-pattern / data-view documents. Legacy visualizations embed the data source id in ``searchSourceJSON.index``. Kibana 7.8+ often uses ``indexRefName`` plus a root-level ``references`` array instead. """ import json from elasticsearch_dsl.ut...
optimdata/pybana
pybana/kibana_refs.py
.py
59dc2c3f26401d0f
7.42
6
# -*- coding: utf-8 -*- import json from elasticsearch import NotFoundError from elasticsearch_dsl import Document, Keyword, Search as EsSearch from pybana.kibana_refs import ( first_input_control_index_pattern_ref, resolve_index_pattern_document_id, ) __all__ = ( "BaseDocument", "Config", "Data...
optimdata/pybana
pybana/models.py
.py
0871fec171f9fc82
7.42
6
# -*- coding: utf-8 -*- from datetime import timedelta import json from .metrics import MetricTranslator from .utils import get_field_arg """ Provide translators which translate bucket aggregations defined using kibana syntax to elasticsearch syntax. Not supported: - IPv4 range. Never used. - Significant terms. Rar...
optimdata/pybana
pybana/translators/elastic/buckets.py
.py
6c3646501b55e2be
7.42
6
# -*- coding: utf-8 -*- __all__ = ("Scope",) class Scope: """ Scope associated to the visualization. :param beg datetime: Begin date of the period on which data should be fetched. :param end datetime: End date of the period on which data should be fetched. :param tzinfo (str, pytz.Timezone): Tim...
optimdata/pybana
pybana/translators/scope.py
.py
990c573781bac9a2
7.42
6
# -*- coding: utf-8 -*- import json __all__ = ("ContextVisualization",) class ContextVisualization: """ Represent a visualization with a context. :param Visualization visualization: Visualization deserialized. :param pybana.Config config: Config of the kibana instance. """ def __init__(sel...
optimdata/pybana
pybana/translators/vega/visualization.py
.py
0127a1c2399c29dc
7.42
6
from fractions import Fraction from math import acos, sqrt, degrees from typing import Union, List, TYPE_CHECKING, Iterator, Dict import numpy as np if TYPE_CHECKING: from shelxfile import Shelxfile from shelxfile.atoms.atom import Atom from shelxfile.atoms.pairs import Bond, SymBond from shelxfile.misc.dsrmath i...
dkratzert/ShelXFile
shelxfile/atoms/atoms.py
.py
3d51bc74091258aa
7.6
15
class AtomPair(): def __init__(self, atom1, atom2): self.atom1 = atom1 self.atom2 = atom2 def __repr__(self): if self.atom1 and self.atom2: return f'{self.atom1} {self.atom2}' else: return '' def __len__(self): if self.atom1 and self.atom2: ...
dkratzert/ShelXFile
shelxfile/atoms/pairs.py
.py
c7e30db49f6cdadc
7.6
15
import unittest from unittest import TestCase from shelxfile.misc.misc import frac_to_cart from shelxfile.shelx.shelx import Shelxfile class TestAtoms(TestCase): def setUp(self) -> None: self.shx = Shelxfile() self.shx.read_file('tests/resources/p21c.res') def test_u_eq_of_hydrogen_atom_in_...
dkratzert/ShelXFile
tests/test_atoms.py
.py
6d01ca53bc7791c0
8.1
15
from niveristand import nivs_rt_sequence, NivsParam, realtimesequencetools from niveristand.clientapi import ( BooleanValue, ChannelReference, DoubleValue, DoubleValueArray, ErrorAction, I32Value, I64Value, ) from niveristand.errors import RunError from niveristand.library import ( array...
ni/niveristand-python
examples/basic_rt_sequence_examples.py
.py
7dd76a753785b063
7.66
20
from niveristand import nivs_rt_sequence, NivsParam, run_py_as_rtseq from niveristand.clientapi import BooleanValue, ChannelReference, DoubleValue from niveristand.library import multitask, nivs_yield, stop_task, task, wait_until_settled """ This module adds multitasking, return values, and cleanup tasks to engine_dem...
ni/niveristand-python
examples/engine_demo/engine_demo_advanced.py
.py
7705b6bc1f9e365b
7.66
20
from niveristand import nivs_rt_sequence, NivsParam, realtimesequencetools from niveristand.clientapi import BooleanValue, ChannelReference, DoubleValue from niveristand.library import wait """ This module contains a basic example of how to create an RT sequence in Python. This example mirrors the 'Engine Demo Basic'...
ni/niveristand-python
examples/engine_demo/engine_demo_basic.py
.py
6b6772ba3fe83023
7.66
20
from niveristand import nivs_rt_sequence, NivsParam, run_py_as_rtseq from niveristand.clientapi import BooleanValue, ChannelReference, DoubleValue, DoubleValueArray from niveristand.library import localhost_wait, seqtime, wait_until_settled """ This module contains a complex example for running multiple tests in sequ...
ni/niveristand-python
examples/engine_demo/test_engine_set_points.py
.py
922a19b5e61afc7f
8.16
20
"""Create an empty system definition.""" from __future__ import annotations import os import sys sys.path.append(r"C:\Program Files\National Instruments\VeriStand 2024") from niveristand import VeriStandSdfError # noqa: E402 from niveristand.systemdefinitionapi import ( # noqa: E402 AcquisitionMode, AlarmMo...
ni/niveristand-python
examples/sysdef_example.py
.py
b6c96c2cc15cf797
7.66
20
from functools import wraps import inspect from niveristand import _errormessages, errors from niveristand.clientapi._datatypes import DataType from niveristand.clientapi._datatypes import rtprimitives rt_seq_mode_id = "__rtseq_mode__" def nivs_rt_sequence(func): from niveristand.library._tasks import get_schedu...
ni/niveristand-python
src/niveristand/_decorators.py
.py
8b19b657bfa3c79b
7.66
20
""" Generic helper functions """ import logging from contextlib import contextmanager # @see https://docs.python.org/3/library/tempfile.html#tempfile.TemporaryDirectory from tempfile import TemporaryDirectory from typing import Iterator, ContextManager from xml_sitemap_writer import XMLSitemap logging.basicConfig(l...
pigs-will-fly/py-xml-sitemap-writer
test/__init__.py
.py
573cb6adef37f46f
8
9
""" Tests a sitemap's add_url method Mocks away all I/O related functions, lets the test assert the XML tag content """ from typing import Optional from xml_sitemap_writer import XMLSitemap from . import DEFAULT_HOST class MockedXMLSitemap(XMLSitemap): """ Mocked version of the XMLSitemap class that does n...
pigs-will-fly/py-xml-sitemap-writer
test/test_add_url.py
.py
d463bef13637990b
7
9
""" Tests a basic sitemap's API """ from . import urls_iterator, test_sitemap def test_simple_single_sitemap(): """ Tests a single sitemap """ with test_sitemap() as sitemap: sitemap.add_section("articles") for url in urls_iterator(): sitemap.add_url(url) print(s...
pigs-will-fly/py-xml-sitemap-writer
test/test_basic.py
.py
ed7de15429132180
7
9
""" Tests big sitemaps """ from . import urls_iterator, test_sitemap def test_a_big_sitemap(): """ Tests a big sitemap """ with test_sitemap() as sitemap: sitemap.add_urls(urls_iterator(count=100000, prefix="article")) print(sitemap) assert len(sitemap) == 100000 ass...
pigs-will-fly/py-xml-sitemap-writer
test/test_big_sitemaps.py
.py
af36f546c085ee2b
7
9
""" Tests a sitemap's XML output """ import gzip from tempfile import TemporaryDirectory from xml_sitemap_writer import XMLSitemap from . import urls_iterator, DEFAULT_HOST def test_simple_single_sitemap_output(): """ Tests a single sitemap XML output """ with TemporaryDirectory(prefix="sitemap_test...
pigs-will-fly/py-xml-sitemap-writer
test/test_check_xml.py
.py
43351f0ab53d6663
7
9
""" Tests sitemap's custom sections """ from . import urls_iterator, test_sitemap def test_custom_sitemap_section(): """ Test how empty sections are handled """ with test_sitemap() as sitemap: sitemap.add_section(section_name="articles") sitemap.add_urls(urls_iterator(prefix="article"...
pigs-will-fly/py-xml-sitemap-writer
test/test_sections.py
.py
451d599ef9abc5b0
7
9
""" Provides XMLSitemap class used to generate large XML sitemap from iterators """ import gzip # https://docs.python.org/3/library/gzip.html import logging import re from datetime import datetime from typing import List, Iterator, IO, Optional from xml.sax.saxutils import escape as escape_xml POWERED_BY_URL = "ht...
pigs-will-fly/py-xml-sitemap-writer
xml_sitemap_writer.py
.py
2a32232b3cf69f7c
7.5
9
# Copyright 2020-2024 Curtin University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
The-Academic-Observatory/observatory-platform
observatory_platform/airflow/airflow.py
.py
9c0c7d61d141ffe0
7.66
20
# Copyright 2020, 2021 Curtin University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
The-Academic-Observatory/observatory-platform
observatory_platform/airflow/sensors.py
.py
40ebdd7961b10dac
7.66
20
# Copyright 2020-2024 Curtin University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
The-Academic-Observatory/observatory-platform
observatory_platform/airflow/tasks.py
.py
040d8fcba3f53a5d
7.66
20
# Copyright 2021 Curtin University. All Rights Reserved. # # 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...
The-Academic-Observatory/observatory-platform
observatory_platform/airflow/tests/test_airflow.py
.py
d5da697b16fd7c01
8.16
20
# Copyright 2019-2024 Curtin University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
The-Academic-Observatory/observatory-platform
observatory_platform/airflow/tests/test_release.py
.py
11cf9f25a34d6ab9
8.16
20
# Copyright 2019-2024 Curtin University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
The-Academic-Observatory/observatory-platform
observatory_platform/airflow/tests/test_workflow.py
.py
2b6fb0055641aca2
8.16
20
# Copyright 2019-2024 Curtin University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
The-Academic-Observatory/observatory-platform
observatory_platform/airflow/workflow.py
.py
3097e00dde888a5f
7.66
20
# Copyright 2019, 2020 Curtin University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
The-Academic-Observatory/observatory-platform
observatory_platform/config.py
.py
5919e2e811624c22
7.66
20
# Copyright 2020-2024 Curtin University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
The-Academic-Observatory/observatory-platform
observatory_platform/dataset_api.py
.py
143cc0b5d19732b3
7.66
20
# Copyright 2022 Google LLC # # 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 writ...
The-Academic-Observatory/observatory-platform
observatory_platform/google/gcp.py
.py
0ae60ef023de731b
7.66
20
# Copyright 2023-2024 Curtin University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
The-Academic-Observatory/observatory-platform
observatory_platform/google/gke.py
.py
f0351620c57ad14f
7.66
20
# Copyright 2025 Curtin University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
The-Academic-Observatory/observatory-platform
observatory_platform/google/gmail.py
.py
d50e327de61de01d
7.66
20
# Copyright 2020 Curtin University. All Rights Reserved. # # 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...
The-Academic-Observatory/observatory-platform
observatory_platform/google/tests/test_gcs.py
.py
4ab8849aca03e1b8
7.16
20
# Copyright 2025 Curtin University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
The-Academic-Observatory/observatory-platform
observatory_platform/google/tests/test_gmail.py
.py
ef177fa9687fd1de
7.16
20
# Copyright 2019 Curtin University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
The-Academic-Observatory/observatory-platform
observatory_platform/http_download.py
.py
acb0529e5899b51a
7.66
20
# Copyright 2020 Artificial Dimensions Ltd # Copyright 2020 Curtin University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
The-Academic-Observatory/observatory-platform
observatory_platform/jinja2_utils.py
.py
1b1e10994164bc15
7.66
20
# Copyright 2021-2024 Curtin University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
The-Academic-Observatory/observatory-platform
observatory_platform/sandbox/ftp_server.py
.py
2dde536442d701ac
7.66
20
# Copyright 2021-2024 Curtin University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
The-Academic-Observatory/observatory-platform
observatory_platform/sandbox/http_server.py
.py
948779d8b48a6749
7.66
20
# distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you 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/l...
The-Academic-Observatory/observatory-platform
observatory_platform/sandbox/sandbox_environment.py
.py
fd25aa59de5a9c7e
7.66
20
# Copyright (c) 2011-2017 Ruslan Spivak # # 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, publish, ...
The-Academic-Observatory/observatory-platform
observatory_platform/sandbox/sftp_server.py
.py
e93f720ed5d64477
7.66
20
# Copyright 2021-2024 Curtin University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
The-Academic-Observatory/observatory-platform
observatory_platform/sandbox/tests/test_ftp_server.py
.py
23a79638ed97e2e4
8.16
20
# Copyright 2019-2024 Curtin University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
The-Academic-Observatory/observatory-platform
observatory_platform/sandbox/tests/test_http_server.py
.py
8ca2dc50b6f5bb90
8.16
20
# Copyright 2021-2024 Curtin University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
The-Academic-Observatory/observatory-platform
observatory_platform/sandbox/tests/test_sandbox_environment.py
.py
53164ff56abac041
8.16
20
# Copyright 2019-2024 Curtin University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
The-Academic-Observatory/observatory-platform
observatory_platform/sandbox/tests/test_sftp_server.py
.py
5a3de6f68dc37742
8.16
20
# Copyright 2019-2024 Curtin University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
The-Academic-Observatory/observatory-platform
observatory_platform/sandbox/tests/test_test_utils.py
.py
eb9dace507f983cb
8.16
20
import typing if typing.TYPE_CHECKING: # sigh. apparently reveal_type is making mypy fail # reveal_type(__file__) pass def test_module_name() -> None: assert __package__ == 'karlicoss_pymplate' # just in case because pytest might have some shenanigans with test module names depending on args.. ...
karlicoss/pymplate
src/karlicoss_pymplate/module.py
.py
d43bcb5182a6431e
7.48
8
# SPDX-FileCopyrightText: Copyright The Linux Foundation # SPDX-FileType: SOURCE # SPDX-License-Identifier: Apache-2.0 import os import copy from pathlib import Path from datatypes import Status, ProjectRepoType from datefuncs import parseYM, priorMonth, getYMStr def getUploadFolder(fossologyServer, uploadFolderName...
lfscanning/scaffold
runagents.py
.py
947fa21b013df51b
7.42
6
# SPDX-FileCopyrightText: Copyright The Linux Foundation # SPDX-FileType: SOURCE # SPDX-License-Identifier: Apache-2.0 ''' Created on Nov 2, 2021 @author: Gary O'Neall Utility class to support common function in Scaffold ''' import shutil import time import os import stat def _rmtree_error_handler(fun, path, excin...
lfscanning/scaffold
util.py
.py
bc9fab0fd62f448c
7.42
6
from http.cookies import SimpleCookie class CookieSet(SimpleCookie): """ CookieSet class just extends the :class:`http.cookies.SimpleCookie` class to create a list of HTTP headers, because the class:`http.cookies.SimpleCookie` class just outputs a concatenated strings. .. versionadded:: 7.16 ...
yhttp/yhttp
yhttp/core/cookieset.py
.py
831502427f1d316a
7.57
13
#!pyvenv/bin/python from setuptools import find_packages, setup import os import distutils.cmd class CleanCommand(distutils.cmd.Command): """ Our custom command to clean out junk files. """ description = "Cleans out junk files we don't want in the repo" user_options = [] def initialize_option...
vche/pycliarr
setup.py
.py
789cc40c732e1cf1
7.64
18
import json import logging import platform from pathlib import Path from pprint import pformat from typing import Any, Dict, List, Optional, Type, TypeVar, Union import requests # type: ignore from pycliarr.api.exceptions import CliArrError, CliDecodeError, CliServerError log = logging.getLogger(__name__) json_dict...
vche/pycliarr
src/pycliarr/api/base_api.py
.py
fc559043cd484160
7.64
18
from pathlib import Path from typing import Any, Dict, List, Optional, Union, cast from pycliarr.api.base_api import BaseCliApiItem, json_data, json_list from pycliarr.api.base_media import BaseCliMediaApi from pycliarr.api.exceptions import RadarrCliError class RadarrMovieItem(BaseCliApiItem): """Class for hand...
vche/pycliarr
src/pycliarr/api/radarr.py
.py
18e159c6e30a5520
7.64
18
from pathlib import Path from typing import Any, Dict, List, Optional, Union, cast from pycliarr.api.base_api import BaseCliApiItem, json_data from pycliarr.api.base_media import BaseCliMediaApi from pycliarr.api.exceptions import SonarrCliError class SonarrSerieItem(BaseCliApiItem): """Class for handling serie ...
vche/pycliarr
src/pycliarr/api/sonarr.py
.py
70caca8ab6021396
7.64
18
import logging import sys import traceback from argparse import ArgumentParser, Namespace from typing import Dict, List import pycliarr from pycliarr.api import exceptions from pycliarr.cli import utils from pycliarr.cli.cli_cmd import CLI_LIST, ArgDefaults, CliApiCommand log = logging.getLogger(__name__) def _pars...
vche/pycliarr
src/pycliarr/cli/cli.py
.py
0106919dff65d299
7.64
18
import logging from typing import Optional def setup_logging(level: int = logging.INFO, filename: Optional[str] = None) -> None: """Configure standard logging.""" logging.basicConfig( format="%(asctime)s %(filename)s:%(lineno)s %(levelname)s: %(message)s", level=level, filename=filename ) def si...
vche/pycliarr
src/pycliarr/cli/utils.py
.py
8be0b3d9bb3bb874
7.64
18
#!/usr/bin/env python3 """ Plot all subdirectories one level below the specified directory. This is useful if making a change in PyGemini or Gemini3D, to plot many simulations to visually check for something unexpected. """ from pathlib import Path import argparse import concurrent.futures import itertools import os ...
gemini3d/pygemini
scripts/plot_all_subdir.py
.py
c2e5acc71ebff928
7.59
14
from pathlib import Path import subprocess import shutil import sys def cmake_exe() -> str: cmake = shutil.which("cmake") if not cmake: # try to help if Homebrew or Ports is not on PATH if sys.platform == "darwin": paths = ["/opt/homebrew/bin", "/usr/local/bin", "/opt/local/bin"] ...
gemini3d/pygemini
src/gemini3d/archive.py
.py
37292a457251dc1c
7.59
14
import json import importlib.resources as ir import xarray def err_pct(a, b) -> float: """compute maximum error percent Parameters ---------- a: numpy.ndarray new data b: numpy.ndarray reference data Returns ------- float maximum error percent Compare r...
gemini3d/pygemini
src/gemini3d/compare/utils.py
.py
b4c21008e4eaec4d
7.59
14
import math import numpy as np pi = math.pi tau = math.tau def geomag2geog(thetat, phit) -> tuple: """geomagnetic to geographic""" # FIXME: this is for year 1985, see Schmidt spherical harmonic in MatGemini thetan = math.radians(11) phin = math.radians(289) # enforce phit = [0,2pi] phit = ...
gemini3d/pygemini
src/gemini3d/coord.py
.py
4970b8081eb646c7
7.59
14
""" generate, read, write Electric Field """ import typing as T import logging from datetime import datetime import xarray import numpy as np from .. import write from ..config import datetime_range from ..utils import str2func def get_times(cfg: dict[str, T.Any]) -> list[datetime]: """ vector of times to ...
gemini3d/pygemini
src/gemini3d/efield/__init__.py
.py
41e96e8846046526
7.59
14
""" functions for finding files """ from datetime import datetime, timedelta from pathlib import Path import shutil import os import subprocess import logging import numpy from .utils import filename2datetime EXE_PATHS = [".", "bin"] def config(path: Path) -> Path: """given a path or config filename, return ...
gemini3d/pygemini
src/gemini3d/find.py
.py
b675d771690fcf15
7.59
14
""" these are approximately duplicates of coord.py. Need to compare vs. gemini3d/coord.py and merge/remove. --- transformations from dipole to spherical """ import math import numpy as np from numpy import sin, cos # define module-scope constants Re = 6370e3 thetan = math.radians(11) phin = math.radians(289) pi = ...
gemini3d/pygemini
src/gemini3d/grid/convert.py
.py
c36956c3bf3ed18d
7.59
14
""" Module containing root finding functions based on Newtons' method. These adaptations meant for dipole to spherical coordinate transformation """ from .convert import calc_theta, Re from .convert import objfunr as f, objfunr_derivative as fprime def qp2rtheta(q: float, p: float, verbose: bool = False) -> tuple[fl...
gemini3d/pygemini
src/gemini3d/grid/newton_method.py
.py
7cce7a237f45eb35
7.59
14
import math import numpy as np def grid1d(dist: float, L: int, parms: list[float] | None = None): """ generate 1D grid Parameters ---------- dist: float one-way distance from origin (meters) L: int number of cells Returns ------- x: np.ndarray 1D vector...
gemini3d/pygemini
src/gemini3d/grid/uniform.py
.py
f24df1485e454cee
7.59
14
import os import subprocess import binascii from pathlib import Path import shutil import importlib.resources as ir def hpc_submit_job(batcher: str, job_file: Path): """ submits batch job """ if batcher == "qsub": subprocess.run(["qsub", str(job_file)]) else: raise LookupError( ...
gemini3d/pygemini
src/gemini3d/hpc.py
.py
ed87d3bd192ab8c1
7.59
14
""" functions related to running Gemini3D. Either locally (laptop or interactive HPC) or creating an HPC batch script based on template. """ import typing import os import logging import subprocess import shutil from math import prod from pathlib import Path import numpy from . import find from . import model from . ...
gemini3d/pygemini
src/gemini3d/job.py
.py
1d3a03b498d2c9b5
7.59
14
""" get Linux system info """ from configparser import ConfigParser from pathlib import Path import sys def os_release() -> list[str]: """ reads /etc/os-release with fallback to legacy methods Returns ------- linux_names: list of str name(s) of operating system detect """ if sy...
gemini3d/pygemini
src/gemini3d/linux_info.py
.py
5d30508183c5b746
7.59
14
from unified_range import api def test_semver_full_way(): """ 1. Test conversion from semver -> unified -> semver. 2. Validate the results against manually validated expected file. """ results = [] with open("tests/test_data/semver-ranges.txt", "r") as semver_rngs: semver_ranges = sem...
snyk/unified-range
tests/test_api.py
.py
42289602f022bf14
7.06
12
from unified_range import utils test_npm_semver_ranges = [ "*", "1.2.3", "2.0.0 || 2.1.0", "<0.1.2", "<=0.12.7", "<5.6.5 || >=6 <6.0.1", "<2.0.20180219", "<1.3.0-rc.4", "<0.0.0", "<0.10.0 >=0.9.0", "<2.11.2 || >=3.0.0 <3.6.4 || >=4.0.0 <4.5.7 || >=5.0.0 <5.2.1", ] expected_version_range = [ '(,)'...
snyk/unified-range
tests/test_utils.py
.py
216e7f9815d77686
7.06
12
from typing import List from unified_range import utils from unified_range.models import UnifiedVersionRange from unified_range.utils import is_semver_range, is_unified_range def from_semver(semver_spec: str) -> str: """ Convert semver string to unified range string. :param semver_spec: str :return:...
snyk/unified-range
unified_range/api.py
.py
d9aec014e9ab7df2
7.56
12
""" Task model """ from django.db import models from django.urls import reverse class Task(models.Model): """ Stores a single Task entry """ task_title = models.CharField(max_length=50, verbose_name='Task Title') task_description = models.TextField(max_length=200, verbose_name='Task Descriptio...
gabicavalcante/django-test-ci
tasks/models.py
.py
a9667a9013f61e0f
7.45
7
from lightdp.lexer import build_lexer from lightdp.parser import build_parser import jsonpickle def test_forall_keyword(): docstring = \ """ precondition : forall i (^q[i] >= -1 and ^q[i] <= 1); A : num(0) """ lexer = build_lexer() parser = build_parser() forall_var, pr...
yuxincs/lightdp
tests/test_parser.py
.py
bd06876ef1fd3f4e
7
9