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 -*- # pylint: disable=missing-module-docstring import logging import os from salt.exceptions import SaltInvocationError from salt.utils.files import backup_minion def __virtual__(): """ Depend on corresponding execution module """ if "pki.create_private_key" not in __salt__: ...
jgraichen/salt-pki
_states/pki.py
.py
9692e7462a7fd171
7.15
1
# Copyright (c) 2011 Adi Roiban. # See LICENSE for details. import os import sys import platform import subprocess script_helper = './get_binaries_deps.sh' platform_system = platform.system().lower() try: CHEVAH_OS = os.environ.get('OS', '') CHEVAH_ARCH = os.environ.get('ARCH', '') except: print('Could no...
chevah/pythia
src/chevah-python-tests/test_python_binary_dist.py
.py
c424d37c3bec36c8
7.89
5
"""Build per-column summaries of a pandas DataFrame and render them to a file.""" from __future__ import annotations import shutil import subprocess from operator import itemgetter from pathlib import Path from typing import TYPE_CHECKING, Any import pandas as pd import pytablewriter from tabulate import tabulate i...
finite-sample/pysum
src/pysum/summary_tool.py
.py
9e88a0dd8a381490
7.15
1
from django.contrib import admin from django.contrib.admin import site from django.utils.safestring import mark_safe # This removed the delete function from the Admin action dropdown. # You can 're-add' it, if necessary, by explicitly adding it to the # actions parameter for a given ModelAdmin instance. site.disable_a...
WGBH/django-pbsmmapi
pbsmmapi/abstract/admin.py
.py
17c820131fc267dd
7
0
from datetime import ( UTC, datetime, ) def parse_changelog_timestamp(timestamp: str) -> datetime: """Parse a changelog ISO timestamp string into an aware UTC datetime. Any offset in the string is normalized to UTC; a timestamp with no timezone is assumed to be UTC (not the local zone). """ ...
WGBH/django-pbsmmapi
pbsmmapi/abstract/helpers.py
.py
e5b6be69145c34a2
7
0
from datetime import ( UTC, datetime, ) from nltk import PunktSentenceTokenizer from pycaption.base import ( BaseWriter, CaptionNode, ) from pbsmmapi.abstract.helpers import parse_changelog_timestamp def check_asset_availability(start=None, end=None): """ Am I within the Asset's availablity ...
WGBH/django-pbsmmapi
pbsmmapi/asset/helpers.py
.py
deff46c569dc2ec8
7
0
# Generated by Django 4.0.6 on 2022-07-21 07:54 from functools import lru_cache from django.db import ( connections, migrations, ) old_asset_tables = ( "pbsmm_episode_asset", "pbsmm_season_asset", "pbsmm_show_asset", "pbsmm_special_asset", ) def forwards(apps, schema): Asset = apps.get_m...
WGBH/django-pbsmmapi
pbsmmapi/asset/migrations/0002_move_assets_data.py
.py
c05380ae34711dce
7
0
from datetime import ( UTC, datetime, ) import django.db.models.deletion from django.db import ( migrations, models, ) ASSET_PARENT_TYPES = {"franchise", "show", "season", "episode", "special"} def parse_changelog_timestamp(timestamp: str) -> datetime: # frozen copy of abstract.helpers.parse_cha...
WGBH/django-pbsmmapi
pbsmmapi/changelog/migrations/0003_backfill_deleted.py
.py
ac8567167b1bb86e
7
0
from collections import defaultdict from collections.abc import Iterable from datetime import ( UTC, datetime, timedelta, ) from itertools import chain from urllib.parse import ( parse_qs, urlparse, ) from django.db.models import ( Exists, F, OuterRef, ) from django.db.models.lookups im...
WGBH/django-pbsmmapi
pbsmmapi/changelog/tasks.py
.py
0658bc5af0f27f05
7
0
# Copyright 2020 GRNET SA # # 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, softwa...
openstack/charm-watcher
src/lib/charm/openstack/watcher.py
.py
ce9bd61e4a311331
7.35
4
# Copyright 2020 GRNET SA # # 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, softwa...
openstack/charm-watcher
src/reactive/watcher_handlers.py
.py
022902b5f758858f
7.35
4
from typing import Dict, Tuple import numpy as np def generate_icososphere( num_subdivisions: int = 0, ) -> Tuple[np.ndarray, np.ndarray]: # vertices (N, 3), faces (M, 3) """ Stolen from: http://blog.andreaskahler.com/2009/06/creating-icosphere-mesh-in-code.html Returns: vertices: (N, 3) ...
cu-sense-lab/gnss-tools
gnss_tools/coords/icososphere.py
.py
fb083cfdb8d2311e
7.35
4
import numpy as np from typing import Tuple # Quaternion utilitites # Note: these functions assume normalized quaternion vectors with shape (..., 4) def q_mult(q1: np.ndarray, q2: np.ndarray) -> np.ndarray: """ Multiply two quaternions. Assumes q1 and q2 have shape (..., 4) """ w1, x1, y1, z1 = q1[...
cu-sense-lab/gnss-tools
gnss_tools/coords/quaternions.py
.py
b5cbc82229241aa0
7.35
4
""" Author: Brian Breitsch Date: 2025-01-02 """ from datetime import datetime from typing import Iterable import numpy as np from gnss_tools.time.julian import datetime_to_julian_day_array, datetime_to_julian_day, days_since_j2000 def compute_sun_eci_coordinates(times: Iterable[datetime]) -> np.ndarray: '''Return...
cu-sense-lab/gnss-tools
gnss_tools/coords/sun_coordinates.py
.py
02f51851e00ea54e
7.35
4
""" Author: Brian Breitsch Date: 2025-01-02 """ import os from gnss_tools.time.gpst import GPSTime from gnss_tools.misc.data_utils import cddis_download, decompress, format_filepath, http_download from gnss_tools.rinex_io.sinex_bias import SINEX_Dataset, SINEX_BiasSolutionEntry from datetime import datetime, timedelta...
cu-sense-lab/gnss-tools
gnss_tools/misc/gnss_bias.py
.py
424520a668248692
7.35
4
""" Author: Brian Breitsch Date: 2025-01-02 """ import os, tarfile, gzip, shutil, re, numpy as np from typing import Tuple import netCDF4 from datetime import datetime, timedelta from gnss_tools.misc.data_utils import format_filepath, ftp_download from gnss_tools.time.gpst import GPSTime def download_ISDC_NAVBIT_fil...
cu-sense-lab/gnss-tools
gnss_tools/misc/isdc.py
.py
1167a2c1e3910673
7.35
4
import numpy as np from typing import Optional import scipy.interpolate NDARRAY_FLOAT64 = np.ndarray[tuple[int], np.dtype[np.float64]] def create_knotted_spline( epochs: NDARRAY_FLOAT64, values: NDARRAY_FLOAT64, # knot_epochs_arg: Optional[NDARRAY_FLOAT64] = None, knot_spacing: float, spline_k: i...
cu-sense-lab/gnss-tools
gnss_tools/misc/knotted_spline.py
.py
03dfbcc9a31219d7
7.35
4
import re from typing import List, Dict, Any from datetime import datetime, timedelta def parse_pattern_info( str_list: List[str], pattern: re.Pattern, parse_datetime: bool = True, keep_original_str: bool = False, original_str_key: str = "original_str" ) -> List[Dict[str, Any]...
cu-sense-lab/gnss-tools
gnss_tools/misc/parse_utils.py
.py
03f3b75827144b08
7.35
4
import numpy as np import matplotlib.pyplot as plt import mpl_toolkits.mplot3d as mplot3d from scipy.spatial import ConvexHull # Stolen from: # https://stackoverflow.com/questions/53816211/plot-3d-connected-prism-matplotlib-based-on-vertices class Faces(): def __init__(self,tri, sig_dig=12, method="convexhul...
cu-sense-lab/gnss-tools
gnss_tools/misc/plot_3d.py
.py
79d332a4d55e3bcb
7.35
4
""" Author: Brian Breitsch Date: 2025-01-02 """ from typing import List def print_columns( string_list: List[str], ncol: int = 2, colsep: str = " ", ) -> None: """ Print the strings from `string_list` in `ncol` columns, with entries going down rows in each column first. ""...
cu-sense-lab/gnss-tools
gnss_tools/misc/print_utils.py
.py
3b94e41be853ecde
7.35
4
import numpy as np from typing import Tuple # Utility for drawing circles around locations on a geodetic map def shoot( lon: float, lat: float, azimuth: float, maxdist: float ) -> Tuple[float, float, float]: """Shooter Function Original javascript on http://williams.best.vwh.net/gccalc.htm Translated...
cu-sense-lab/gnss-tools
gnss_tools/misc/shoot_equi_circle.py
.py
1ba10ef29bfc136d
7.35
4
from typing import Callable, Tuple, Optional from matplotlib.cm import ScalarMappable import numpy as np import numba as nb import gnss_tools.coords.icososphere as icososphere import matplotlib.pyplot as plt from matplotlib.figure import Figure from matplotlib.axes import Axes from matplotlib.colorbar import Colorbar i...
cu-sense-lab/gnss-tools
gnss_tools/misc/spherical_histogram.py
.py
a9e5c14f1864856e
7.35
4
""" Author Brian Breitsch Date: 2025-01-02 """ import numba import numpy as np @numba.njit def numba_array_lagrange_interpolation_float64( N: int, ydim: int, x: numba.float64[:], # type: ignore y: numba.float64[:, :], # type: ignore N_p: int, x_new: numba.float64[:], # type: ignore y_n...
cu-sense-lab/gnss-tools
gnss_tools/orbits/array_lagrange_interpolation.py
.py
6d9ac81cc78bb574
7.35
4
from functools import lru_cache from datetime import datetime, timezone, timedelta import io from typing import Callable, Dict, Iterable, List, Optional, Tuple import numpy as np from dataclasses import dataclass GPS_EPOCH = datetime( year=1980, month=1, day=6, hour=0, minute=0, second=0 ) ONE_HOUR = timedelta(hou...
cu-sense-lab/gnss-tools
gnss_tools/orbits/parse_sp3.py
.py
64027a3097f03668
7.35
4
""" sp3.py Utilities for SP3 data file download and parsing @author Brian Breitsch @email brian.breitsch@colorado.edu """ import os import logging from datetime import datetime, timedelta from typing import Optional, List, Dict from gnss_tools.time.gtime import GTIME_DTYPE import numpy as np import scipy.interpolate...
cu-sense-lab/gnss-tools
gnss_tools/orbits/sp3_utils.py
.py
ba3e9034a4e878d3
7.35
4
#!/usr/bin/python3 """ Test EnvironmentSensor BME280 at I2C bus Run with pytest """ from context import EnvironmentSensor import logging logger = logging.getLogger() sensor = None def test_init(): global sensor sensor = EnvironmentSensor.BME280_I2C() assert sensor != None def test_tem...
signag/snraspi-lib
tests/sensors/check_BME280_I2C.py
.py
913ef3d05a74dcee
7.5
0
#!/usr/bin/python3 """ Test EnvironmentSensor BME280 at SPI bus Run with pytest """ from context import EnvironmentSensor import logging logger = logging.getLogger() sensor = None def test_init(): global sensor sensor = EnvironmentSensor.BME280_SPI(EnvironmentSensor.PIN29) assert sensor ...
signag/snraspi-lib
tests/sensors/check_BME280_SPI.py
.py
23510f178432bc88
7.5
0
#!/usr/bin/python3 """ Test EnvironmentSensor DHT11 Run with pytest """ from context import EnvironmentSensor sensor = None def test_init(): global sensor sensor = EnvironmentSensor.DHT11(EnvironmentSensor.PIN11) assert sensor != None def test_temperature(): global sensor temp =...
signag/snraspi-lib
tests/sensors/check_DHT11.py
.py
4c90b6b45b5ba15c
7.5
0
#!/usr/bin/python3 """ Test EnvironmentSensor DHT22 Run with pytest """ from context import EnvironmentSensor sensor = None def test_init(): global sensor sensor = EnvironmentSensor.DHT22(EnvironmentSensor.PIN13) assert sensor != None def test_temperature(): global sensor temp =...
signag/snraspi-lib
tests/sensors/check_DHT22.py
.py
56afebd9dc6c14a0
7.5
0
#!/usr/bin/python3 """ Test EnvironmentSensor BME280 at I2C bus Run with pytest """ from context import EnvironmentSensor import logging logger = logging.getLogger() sensor = None def test_init(): global sensor sensor = EnvironmentSensor.BME280_I2C() assert sensor != None def test_tem...
signag/snraspi-lib
tests/sensors/test_BME280_I2C.py
.py
ce95718b9589c8bc
7.5
0
#!/usr/bin/python3 """ Test EnvironmentSensor BME280 at SPI bus Run with pytest """ from context import EnvironmentSensor import logging logger = logging.getLogger() sensor = None def test_init(): global sensor sensor = EnvironmentSensor.BME280_SPI(EnvironmentSensor.PIN29) assert sensor ...
signag/snraspi-lib
tests/sensors/test_BME280_SPI.py
.py
b04063f46214466b
7.5
0
#!/usr/bin/python3 """ Test EnvironmentSensor DHT11 Run with pytest """ from context import EnvironmentSensor sensor = None def test_init(): global sensor sensor = EnvironmentSensor.DHT11(EnvironmentSensor.PIN11) assert sensor != None def test_temperature(): global sensor temp =...
signag/snraspi-lib
tests/sensors/test_DHT11.py
.py
8a2003f47f256784
7.5
0
#!/usr/bin/python3 """ Test EnvironmentSensor DHT22 Run with pytest """ from context import EnvironmentSensor sensor = None def test_init(): global sensor sensor = EnvironmentSensor.DHT22(EnvironmentSensor.PIN13) assert sensor != None def test_temperature(): global sensor temp =...
signag/snraspi-lib
tests/sensors/test_DHT22.py
.py
0513ea0067502a5a
7.5
0
# -*- coding: utf-8 -*- import logging import os import pwd import tempfile logger = logging.getLogger(__name__) logging.basicConfig(level=logging.INFO, format='Plugin: Geocoder | %(levelname)s - %(message)s') class CustomTmpFile(object): def __init__(self, sub_directory=None): self.cache_relative_dir ...
dataiku/dss-plugin-geocoder
python-lib/cache_utils.py
.py
fce13706d6382e75
7.15
1
#!/usr/bin/env python3 """ Skill Packager - Creates a distributable .skill file of a skill folder Usage: python utils/package_skill.py <path/to/skill-folder> [output-directory] Example: python utils/package_skill.py skills/public/my-skill python utils/package_skill.py skills/public/my-skill ./dist """ im...
nitishkmr005/nitishkmr005.github.io
.claude/skills/skill-creator/scripts/package_skill.py
.py
b31fbcb3e362d5c5
7
0
"""Test parsing Slack payloads.""" from __future__ import annotations from pathlib import Path import pytest from rubin.squarebot.models.slack import ( SlackBlockActionsPayload, SlackViewSubmissionPayload, ) @pytest.fixture def samples_dir() -> Path: """Get the path to the samples directory for intera...
lsst-sqre/squarebot
client/tests/models/slack_test.py
.py
a69b7caf5e7e2a4e
7.8
3
from __future__ import annotations import json import logging import os import re import subprocess import nox from nox_uv import session # Default sessions nox.options.sessions = ["lint", "typing", "test", "client_test"] # Other nox defaults nox.options.default_venv_backend = "uv" nox.options.reuse_existing_virtua...
lsst-sqre/squarebot
noxfile.py
.py
6f132d51573a2063
7.3
3
"""Administrative command-line interface.""" from __future__ import annotations import click import uvicorn from safir.click import display_help @click.group(context_settings={"help_option_names": ["-h", "--help"]}) @click.version_option(message="%(version)s") def main() -> None: """SQuaRE Bot. Administrat...
lsst-sqre/squarebot
src/squarebot/cli.py
.py
b1c9710d4f95f645
7.3
3
"""Configuration definition.""" from __future__ import annotations import ssl from enum import Enum from pathlib import Path from pydantic import DirectoryPath, Field, FilePath, SecretStr from pydantic_settings import BaseSettings, SettingsConfigDict from safir.logging import LogLevel, Profile __all__ = [ "Conf...
lsst-sqre/squarebot
src/squarebot/config.py
.py
a7b92e80c6732dfb
7.3
3
"""A FastAPI dependency that wraps multiple common dependencies.""" from dataclasses import dataclass from typing import Annotated from fastapi import Depends, Request from safir.dependencies.logger import logger_dependency from structlog.stdlib import BoundLogger from ..factory import Factory, ProcessContext __all...
lsst-sqre/squarebot
src/squarebot/dependencies/requestcontext.py
.py
21e846f31633557e
7.3
3
"""Factory for Squarebot services and other components.""" from __future__ import annotations from dataclasses import dataclass from typing import Self from faststream.kafka import KafkaBroker from faststream.kafka.publisher import DefaultPublisher from structlog.stdlib import BoundLogger from .config import config...
lsst-sqre/squarebot
src/squarebot/factory.py
.py
9bf9a6fdcb0211a7
7.3
3
"""Models for the app's external API endpoints.""" from __future__ import annotations from pydantic import AnyHttpUrl, BaseModel, Field from safir.metadata import Metadata as SafirMetadata from rubin.squarebot.models.slack import SlackUrlVerificationEvent __all__ = ["IndexResponse", "UrlVerificationResponse"] cla...
lsst-sqre/squarebot
src/squarebot/handlers/external/models.py
.py
f9327565a942c3d1
7.3
3
"""Application factory for SQuaRE Bot. Notes ----- Be aware that, following the normal pattern for FastAPI services, the app is constructed when this module is loaded and is not deferred until a function is called. """ from __future__ import annotations import json from collections.abc import AsyncIterator from cont...
lsst-sqre/squarebot
src/squarebot/main.py
.py
114c12ae6446255a
7.3
3
"""Slack service layer.""" from __future__ import annotations import hashlib import hmac import math import time import urllib.parse from typing import Any from fastapi import HTTPException, Request, status from faststream.kafka.publisher import DefaultPublisher from structlog.stdlib import BoundLogger from rubin.s...
lsst-sqre/squarebot
src/squarebot/services/slack.py
.py
62454820035c53ac
7.3
3
"""Test fixtures for squarebot tests.""" from __future__ import annotations from collections.abc import AsyncIterator from pathlib import Path import pytest import pytest_asyncio from asgi_lifespan import LifespanManager from faststream_fastapi import FastStreamAPI from httpx import ASGITransport, AsyncClient from ...
lsst-sqre/squarebot
tests/conftest.py
.py
d5e990bbf9115da1
7.8
3
"""An HTTP client that acts like a Slack API server sending signed events and interactions. """ from __future__ import annotations import json from time import time from typing import Any from httpx import AsyncClient, Response from squarebot.config import config from squarebot.services.slack import SlackService ...
lsst-sqre/squarebot
tests/support/slackrequester.py
.py
6c02656529c9cfca
7.8
3
import dataiku import logging from abc import ABC, abstractmethod import smtplib from email.mime.text import MIMEText from email.mime.application import MIMEApplication from email.mime.multipart import MIMEMultipart class SmtpConfig: """ SMTP config for sending to an SMTP connection configured by the users ...
dataiku/dss-plugin-sendmail
python-lib/dku_email_client.py
.py
2f3bf206b5d7cc9f
7
0
from datetime import datetime, date from time import sleep from selenium.webdriver.common.by import By from selenium.webdriver.firefox.webdriver import WebDriver from selenium.webdriver.support.ui import WebDriverWait import otl import outlook from oracle import go_to_oracle_page def list_missing(date_set : set[dat...
benshep/work-scripts
check_leave_dates.py
.py
2b071132fda36944
7
0
import sys import os import outlook import subprocess import datetime from platform import node sys.path.append(os.path.join(os.environ['UserProfile'], 'Misc', 'Scripts')) import google_api sheet_id = {'me': '1qjcicqh02LMCdQUJwkvnOYli8TJb9qRdZyvyOwKMFHA', # 🗺️ Where is Ben? 'Hywel': '1usvoxxjpPZT0C4rZHK...
benshep/work-scripts
events_to_spreadsheet.py
.py
de0494e49dda6931
7
0
import os import pandas import selenium.common from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as condition import polling2 from datetime import datetime from time import sleep from oracle import go_to_oracl...
benshep/work-scripts
get_budget_data.py
.py
136562573f729f14
7
0
import time import re from collections import Counter from datetime import datetime, timedelta, date from calendar import monthrange from pathlib import Path from shutil import move from zipfile import ZipFile from selenium.webdriver.common.by import By from pypdf import PdfReader from govuk_bank_holidays.bank_holiday...
benshep/work-scripts
get_payslips.py
.py
9e97e0e1bf73af0c
7
0
import os # for working with files and folders import sys from time import sleep # for waiting in the script from datetime import datetime, date # for working with dates # selenium imports: for controlling a web browser instance from selenium.webdriver.common.by import By from selenium.webdriver.firefox.webdriver i...
benshep/work-scripts
get_payslips_simple.py
.py
65ff00adf062454f
7
0
import os import tempfile from datetime import date, timedelta, datetime from itertools import accumulate from pathlib import Path from time import sleep from urllib.parse import urlencode from selenium.webdriver.common.by import By from dateutil.relativedelta import relativedelta from pushbullet import Pushbullet im...
benshep/work-scripts
group.py
.py
2fd6108b4cd51c85
7
0
from datetime import date, datetime from enum import IntEnum from math import isclose hours_per_day = 7.4 days_per_fte = 215 hours_per_fte = hours_per_day * days_per_fte today = datetime.now() fy = today.year - (today.month < 4) # last calendar year if before April fy_start = date(fy, 4, 1) fy_end = date(fy + 1, 3, ...
benshep/work-scripts
otl.py
.py
4521a9d373b87b3a
7
0
import datetime import operator import os import re import sys from collections import defaultdict from enum import IntEnum from typing import Protocol import dateutil.parser import win32com.client from work_folders import docs_folder class ADSNameType(IntEnum): """Specifies the format of the name used to ident...
benshep/work-scripts
parse-license-log.py
.py
031c06560e6ac7da
7
0
# Copyright 2021 UXEON SP. Z O.O. # Version: v1.0.0 import aiohttp from datetime import datetime class APIException(Exception): pass class EasyAPI: """Application Programming Interface for applications displaying and processing data. https://docs.rayleighconnect.net/api/easy/""" base_url: str = 'ht...
benshep/work-scripts
rayleigh_connect.py
.py
e2000d6ef3331828
7
0
import contextlib import os from datetime import timedelta, datetime from pathlib import Path from shutil import copy2 from tempfile import mkstemp from typing import Callable import pandas def read_excel(excel_filename: Path, func: Callable = pandas.read_excel, **kwargs): """Read an Excel file using pandas. Fir...
benshep/work-scripts
work_tools.py
.py
8babd15e66a4e123
7
0
import json import logging import os import re import subprocess import nox from nox_uv import session # Default sessions nox.options.sessions = ["lint", "typing", "test"] # Other nox defaults nox.options.default_venv_backend = "uv" nox.options.reuse_existing_virtualenvs = True def _setup_testcontainers_logging() ...
lsst-sqre/templatebot
noxfile.py
.py
a91e87f448b4aac9
7
0
"""A dependency for providing context to consumers.""" from __future__ import annotations from collections.abc import Sequence from dataclasses import dataclass from typing import Annotated, Any from aiokafka import ConsumerRecord from faststream.kafka import KafkaMessage as _KafkaMessage from faststream_fastapi imp...
lsst-sqre/templatebot
src/templatebot/dependencies/consumercontext.py
.py
b7a9464deb11cd40
7
0
"""Factory for templatebot services and other components.""" from dataclasses import dataclass from typing import Self import structlog from httpx import AsyncClient, Timeout from safir.slack.webhook import SlackWebhookClient from structlog.stdlib import BoundLogger from templatebot.services.slackblockactions import...
lsst-sqre/templatebot
src/templatebot/factory.py
.py
e590662296e532e4
7
0
"""Service for processing Slack messages.""" from __future__ import annotations import re from rubin.squarebot.models.kafka import ( SquarebotSlackAppMentionValue, SquarebotSlackMessageValue, ) from structlog.stdlib import BoundLogger from templatebot.storage.slack import ( SlackChatPostMessageRequest, ...
lsst-sqre/templatebot
src/templatebot/services/slackmessage.py
.py
a5f3566dc6021ee3
7
0
"""A service for handling Slack view interactions.""" from __future__ import annotations from httpx import HTTPError from rubin.squarebot.models.kafka import SquarebotSlackViewSubmissionValue from safir.slack.blockkit import SlackCodeBlock, SlackMessage, SlackTextField from safir.slack.webhook import SlackWebhookClie...
lsst-sqre/templatebot
src/templatebot/services/slackview.py
.py
d0a35a6c3a8cdca6
7
0
"""Service for operations with template repositories.""" from __future__ import annotations from collections.abc import Callable, Iterator from typing import TypeVar from structlog.stdlib import BoundLogger from templatekit.repo import BaseTemplate from templatebot.constants import ( SELECT_FILE_TEMPLATE_ACTION...
lsst-sqre/templatebot
src/templatebot/services/templaterepo.py
.py
bf705a8b8dbe9ae5
7
0
"""Storage interface to a local Git clone of a project repository.""" from __future__ import annotations import urllib.parse from pathlib import Path from typing import Self import git from gidgethub.httpx import GitHubAPI from templatebot.config import config __all__ = ["GitClone"] class GitClone: """Storag...
lsst-sqre/templatebot
src/templatebot/storage/gitclone.py
.py
db1af6644c273810
7
0
"""GitHub App client factory.""" from __future__ import annotations from gidgethub.httpx import GitHubAPI from safir.github import GitHubAppClientFactory as SafirGitHubAppClientFactory __all__ = ["GitHubAppClientFactory"] # TODO(jonathansick): Upstream this to Safir class GitHubAppClientFactory(SafirGitHubAppClie...
lsst-sqre/templatebot
src/templatebot/storage/githubappclientfactory.py
.py
33246a48912045f3
7
0
"""Storage interface to a GitHub repository.""" from __future__ import annotations from typing import Any from gidgethub.httpx import GitHubAPI from structlog.stdlib import BoundLogger __all__ = ["GitHubRepo"] class GitHubRepo: """Storage interface to a GitHub repository.""" def __init__( self, ...
lsst-sqre/templatebot
src/templatebot/storage/githubrepo.py
.py
fcead504a8e01898
7
0
"""LSST the Docs admin API client.""" from __future__ import annotations from typing import Any from httpx import AsyncClient, BasicAuth from pydantic import SecretStr from structlog.stdlib import BoundLogger __all = ["LtdClient"] class LtdClient: """A client for interacting with the LSST the Docs admin API."...
lsst-sqre/templatebot
src/templatebot/storage/ltdclient.py
.py
448222110f934e39
7
0
"""Management of the template repository.""" from __future__ import annotations import shutil import uuid from pathlib import Path import git from structlog.stdlib import BoundLogger from templatekit.repo import Repo class RepoManager: """A class that manages the cloned tempate repositories for different g...
lsst-sqre/templatebot
src/templatebot/storage/repo.py
.py
010eb22a823c0c7a
7
0
"""Retry helper for outbound HTTP calls. httpx's own transport-level retries only cover connection errors, so they never re-issue a request that got as far as the server and then timed out waiting for the response. `retry_async` sits *above* the transport, wrapping a call that has already been through ``raise_for_stat...
lsst-sqre/templatebot
src/templatebot/storage/retry.py
.py
195b341aabfe9fa0
7
0
"""Exceptions raised by the Slack Web API client.""" from __future__ import annotations from typing import Any __all__ = ["SlackApiError"] class SlackApiError(Exception): """Slack accepted the HTTP request but rejected the call itself. The Slack Web API reports application-level failures with an HTTP 200 ...
lsst-sqre/templatebot
src/templatebot/storage/slack/_exceptions.py
.py
d9f1a6d73b353b91
7
0
"""Test fixtures for unfurlbot tests.""" from __future__ import annotations from collections.abc import AsyncIterator import httpx import pytest import pytest_asyncio from asgi_lifespan import LifespanManager from faststream_fastapi import FastStreamAPI from httpx import AsyncClient from templatebot import main @...
lsst-sqre/templatebot
tests/conftest.py
.py
808d7d110d9a6112
7.5
0
"""Tests for the LSST the Docs API client.""" from __future__ import annotations import httpx import pytest import structlog from pydantic import SecretStr from templatebot.storage.ltdclient import LtdClient @pytest.mark.asyncio async def test_get_token_uses_shared_client_timeout() -> None: """``get_token`` in...
lsst-sqre/templatebot
tests/storage/ltdclient_test.py
.py
10fe492c6f1b23fa
7.5
0
"""Tests for Block Kit models.""" from __future__ import annotations import pytest from pydantic import BaseModel, Field, ValidationError from templatebot.storage.slack import blockkit def test_plain_text_object_length() -> None: """Test that the length of a plain text object is correct.""" class Model(Ba...
lsst-sqre/templatebot
tests/storage/slack/blockkit_test.py
.py
3c2e0f8a7ca8960b
7.5
0
import os, errno, sys ''' This class will have methods for file IO operations. ''' class BasicIO: ''' method: open file. purpose: open the file and return file descriptor. parameters: @file path. ''' def open_file(self, fpath): fd = None try: fd = open(fpath, "w+") ...
niova/holon
basicio.py
.py
9e54718deda4a69b
7.3
3
import os, subprocess, json, time, logging, socket, errno, pkg_resources from datetime import datetime ''' This class will have wrapper functions for generic system cmds. ''' class GenericCmds: ''' Method: install_python_modules Purpose: Install required modules for holon Parameters: ''' def in...
niova/holon
genericcmd.py
.py
7efb3f617afdfb2c
7.3
3
import os, logging, time import subprocess from genericcmd import GenericCmds from enum import Enum class inotify_input_base: SHARED_INIT = 1 PRIVATE_INIT = 2 REGULAR = 3 class InotifyPath: base_dir_path = '' inotify_path = '' inotify_init_path = '' inotify_is_base_path = '' ''' Co...
niova/holon
inotifypath.py
.py
9b29d51f03a19e1f
7.3
3
from ansible.plugins.lookup import LookupBase import json, re import os, time import dpath.util import subprocess from genericcmd import * from basicio import * from raftconfig import * from inotifypath import * from ctlrequest import * ''' Send the ctlrequest cmd to the peer. This will create the ctlrequest python ob...
niova/holon
lookup_plugin/niova_ctlrequest.py
.py
db2a271bad090a25
7.3
3
import logging import os import re import shutil import zipfile from io import BytesIO from pathlib import Path from subprocess import PIPE, Popen, call from types import TracebackType from xml.etree import ElementTree import html2text import mammoth from PIL import Image from autopublisher.config import IMAGEMAGICK_...
alexyvassili/autopublisher
autopublisher/documents/document.py
.py
73da566650d5ae6a
7
0
# noqa """Файл сохраняем ради функции dialog бота""" import logging # import json import traceback # import apiai from telegram.ext import Updater from telegram.ext import CommandHandler, MessageHandler from telegram.ext import Filters from telegram.ext.callbackcontext import CallbackContext import telegram.update ...
alexyvassili/autopublisher
autopublisher/telegrambot.py
.py
9d2bc0f55a06c29d
7
0
# -*- coding: utf-8 -*- # # This file is part of REANA. # Copyright (C) 2020, 2022 CERN. # # REANA is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """REANA DB alembic's environment context.""" from logging.config import fileConfig fr...
reanahub/reana-db
reana_db/alembic/env.py
.py
e22cc6026457ddbc
7
0
"""Interactive sessions. Revision ID: ad93dae04483 Revises: c912d4f1e1cc Create Date: 2020-10-09 16:12:00.090837 """ from alembic import op import sqlalchemy as sa import sqlalchemy_utils # revision identifiers, used by Alembic. revision = "ad93dae04483" down_revision = "c912d4f1e1cc" branch_labels = None depends_o...
reanahub/reana-db
reana_db/alembic/versions/20201009_1612_ad93dae04483_interactive_sessions.py
.py
e4e9448a9c92b895
7
0
"""Job started and finished times. Revision ID: 4801b98f6408 Revises: ad93dae04483 Create Date: 2021-05-07 12:40:54.207470 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = "4801b98f6408" down_revision = "ad93dae04483" branch_labels = None depends_on = None def...
reanahub/reana-db
reana_db/alembic/versions/20210507_1240_4801b98f6408_job_started_and_finished_times.py
.py
05aa61f6a4555f92
7
0
"""Workflow complexity. Revision ID: f84e17bd6b18 Revises: 4801b98f6408 Create Date: 2021-06-07 12:17:47.218408 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = "f84e17bd6b18" down_revision = "4801b98f6408" branch_label...
reanahub/reana-db
reana_db/alembic/versions/20210607_1217_f84e17bd6b18_workflow_complexity.py
.py
b1dd813d13129039
7
0
"""storing full workflow workspace. Revision ID: 6568d7cb6710 Revises: f84e17bd6b18 Create Date: 2021-08-16 07:52:03.968797 """ from sqlalchemy.sql import table, column from sqlalchemy import String from alembic import op from reana_commons.config import SHARED_VOLUME_PATH import sqlalchemy as sa import os # revisi...
reanahub/reana-db
reana_db/alembic/versions/20210816_0752_6568d7cb6710_storing_full_workflow_workspace.py
.py
9a7d00d75cfc51b8
7
0
"""Workflow launcher url. Revision ID: d34f3905043c Revises: 6568d7cb6710 Create Date: 2022-03-07 12:47:11.867026 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = "d34f3905043c" down_revision = "6568d7cb6710" branch_labels = None depends_on = None def upgrade(...
reanahub/reana-db
reana_db/alembic/versions/20220307_1247_d34f3905043c_workflow_launcher_url.py
.py
29e2b088a6806f78
7
0
"""Retention rules. Revision ID: b92fe567be5b Revises: d34f3905043c Create Date: 2022-07-11 13:01:19.179610 """ from alembic import op import sqlalchemy as sa import sqlalchemy_utils # revision identifiers, used by Alembic. revision = "b92fe567be5b" down_revision = "d34f3905043c" branch_labels = None depends_on = N...
reanahub/reana-db
reana_db/alembic/versions/20220711_1301_b92fe567be5b_retention_rules.py
.py
84115376efd7e2ef
7
0
"""Separate run number into major and minor run numbers. Revision ID: b85c3e601de4 Revises: 377cfbfccf75 Create Date: 2023-10-02 12:08:18.292490 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = "b85c3e601de4" down_revision = "377cfbfccf75" branch_labels = None d...
reanahub/reana-db
reana_db/alembic/versions/20231002_1208_b85c3e601de4_separate_run_and_restart_number.py
.py
3e513c3bae65d22e
7
0
"""Improve indexes usage. Revision ID: eb5309f3d8ee Revises: 2461610e9698 Create Date: 2023-11-29 13:56:23.588587 """ from alembic import op # revision identifiers, used by Alembic. revision = "eb5309f3d8ee" down_revision = "2461610e9698" branch_labels = None depends_on = None def upgrade(): """Upgrade to eb5...
reanahub/reana-db
reana_db/alembic/versions/20231129_1356_eb5309f3d8ee_improve_indexes_usage.py
.py
553e75ba83365c6b
7
0
"""Foreign key for workflow_uuid of Job. Revision ID: 86435bb00714 Revises: eb5309f3d8ee Create Date: 2024-05-31 09:59:18.951074 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = "86435bb00714" down_revision = "eb5309f3d...
reanahub/reana-db
reana_db/alembic/versions/20240531_0959_86435bb00714_foreign_key_for_workflow_uuid_of_job.py
.py
4d9255eacd78530c
7
0
"""Workflow sharing. Revision ID: 2e82f33ee37d Revises: eb5309f3d8ee Create Date: 2024-03-14 13:12:01.029714 Rebase Date: 2024-08-28T14:12:12 """ import sqlalchemy_utils import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "2e82f33ee37d" down_revision = "86435bb00714" br...
reanahub/reana-db
reana_db/alembic/versions/20240828_1412_2e82f33ee37d_workflow_sharing.py
.py
6af29f14fca9d086
7
0
"""Add service tables. Revision ID: 3d0994430da7 Revises: 2e82f33ee37d Create Date: 2025-01-17 10:05:48.699316 """ import sqlalchemy_utils import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "3d0994430da7" down_revision = "2e82f33ee37d" branch_labels = None depends_on ...
reanahub/reana-db
reana_db/alembic/versions/20250117_1005_3d0994430da7_add_service_tables.py
.py
ec73136c37bc2654
7
0
"""Add service_logs table. Revision ID: 3da4dd5d0b75 Revises: 3d0994430da7 Create Date: 2025-06-13 14:22:24.633881 """ import sqlalchemy_utils import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = "3da4dd5d0b75" down_revision = ...
reanahub/reana-db
reana_db/alembic/versions/20250613_1422_3da4dd5d0b75_add_service_logs_table.py
.py
ceb0fbf9ed5d4ad5
7
0
"""Add user_resource quota period fields. Revision ID: 06dbbeef6d9b Revises: 3da4dd5d0b75 Create Date: 2026-03-20 09:47:20.025386 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "06dbbeef6d9b" down_revision = "3da4dd5d0b75" branch_labels = None depends_on = None...
reanahub/reana-db
reana_db/alembic/versions/20260320_0947_06dbbeef6d9b_add_user_resource_quota_period_fields.py
.py
628448927ef96203
7
0
# -*- coding: utf-8 -*- # # This file is part of REANA. # Copyright (C) 2020, 2021, 2022, 2023, 2024, 2026 CERN. # # REANA is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """REANA DB command line.""" import logging import os import sy...
reanahub/reana-db
reana_db/cli.py
.py
b5e2d9329f5be5ee
7
0
# -*- coding: utf-8 -*- # # This file is part of REANA. # Copyright (C) 2020, 2021, 2022, 2026 CERN. # # REANA is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Pytest configuration for REANA-DB.""" from datetime import datetime, tim...
reanahub/reana-db
tests/conftest.py
.py
5b1232440ab13ac9
7.5
0
# -*- coding: utf-8 -*- # # This file is part of REANA. # Copyright (C) 2026 CERN. # # REANA is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """REANA-DB config tests.""" import importlib import pytest import reana_db.config as confi...
reanahub/reana-db
tests/test_config.py
.py
440fc5e560e957d2
7.5
0
# -*- coding: utf-8 -*- # # This file is part of REANA. # Copyright (C) 2018, 2019, 2020, 2021, 2022, 2024, 2025, 2026 CERN. # # REANA is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """REANA REST API base client.""" import json import...
reanahub/reana-commons
reana_commons/api_client.py
.py
d9af5f4ae130ff3a
7.3
3
# -*- coding: utf-8 -*- # # This file is part of REANA. # Copyright (C) 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026 CERN. # # REANA is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """REANA Commons configuration.""" import jso...
reanahub/reana-commons
reana_commons/config.py
.py
0d7b36e674ca63a7
7.3
3
# -*- coding: utf-8 -*- # # This file is part of REANA. # Copyright (C) 2018, 2020, 2021, 2023 CERN. # # REANA is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """REANA-Commons module to manage AMQP consuming on REANA.""" from kombu imp...
reanahub/reana-commons
reana_commons/consumer.py
.py
25fc7de6176b6b57
7.3
3
# This file is part of REANA. # Copyright (C) 2024 CERN. # # REANA is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Gherkin test runner.""" import logging import enum from datetime import datetime, timezone from typing import Dict, L...
reanahub/reana-commons
reana_commons/gherkin_parser/parser.py
.py
7fc78049474af739
7.3
3