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 (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/grantami-bomanalytics-openapi
ansys-grantami-bomanalytics-openapi/src/ansys/grantami/bomanalytics_openapi/v1/models/get_compliance_for_bom1711_request.py
.py
278c496f665caf11
7.15
1
# 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/grantami-bomanalytics-openapi
ansys-grantami-bomanalytics-openapi/src/ansys/grantami/bomanalytics_openapi/v1/models/get_compliance_for_bom1711_response.py
.py
473205c141de3e5e
7.15
1
# 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/grantami-bomanalytics-openapi
ansys-grantami-bomanalytics-openapi/src/ansys/grantami/bomanalytics_openapi/v1/models/get_compliance_for_bom2301_request.py
.py
6edb6d3701988ee1
7.15
1
# 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/grantami-bomanalytics-openapi
ansys-grantami-bomanalytics-openapi/src/ansys/grantami/bomanalytics_openapi/v1/models/get_compliance_for_bom2301_response.py
.py
187b7ae844a213e3
7.15
1
# 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/grantami-bomanalytics-openapi
ansys-grantami-bomanalytics-openapi/src/ansys/grantami/bomanalytics_openapi/v1/models/get_compliance_for_materials_request.py
.py
b7a11a3309475718
7.15
1
# 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/grantami-bomanalytics-openapi
ansys-grantami-bomanalytics-openapi/src/ansys/grantami/bomanalytics_openapi/v1/models/get_compliance_for_materials_response.py
.py
983237a5cb9aa9cc
7.15
1
# 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/grantami-bomanalytics-openapi
ansys-grantami-bomanalytics-openapi/src/ansys/grantami/bomanalytics_openapi/v1/models/get_compliance_for_parts_request.py
.py
d0cb8bc46c80cfae
7.15
1
# 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/grantami-bomanalytics-openapi
ansys-grantami-bomanalytics-openapi/src/ansys/grantami/bomanalytics_openapi/v1/models/get_compliance_for_parts_response.py
.py
4df78a57a7bf8f72
7.15
1
import logging import typing import discord import TagScriptEngine as tse from redbot.core import Config, commands from redbot.core.bot import Red from redbot.core.utils.chat_formatting import box, humanize_list log = logging.getLogger("red.craycogs.joinping") guild_defaults = { "ping_channels": [], "delete_...
i-am-zaidali/cray-cogs
joinping/main.py
.py
10c411c4ab0dacef
7.3
3
import asyncio import logging from collections import deque from typing import Dict, List, Literal, TypedDict, Union import discord from discord.ext import tasks from redbot.core import Config, commands from redbot.core.bot import Red from redbot.core.utils import chat_formatting as cf from redbot.core.utils.menus imp...
i-am-zaidali/cray-cogs
keywordpoints/main.py
.py
3dfbd445f791b7b7
7.3
3
import asyncio import datetime import functools import itertools import logging import random import string import typing import discord from redbot.core import Config, commands from redbot.core.bot import Red from redbot.core.utils import chat_formatting as cf from redbot.vendored.discord.ext.menus import ListPageSou...
i-am-zaidali/cray-cogs
sharedcd/main.py
.py
3e01a2b68ec0fb43
7.3
3
from redbot.core import Config, commands from redbot.core.bot import Red from redbot.core.utils.chat_formatting import humanize_list from .util import EmojiConverter old_tick = commands.context.TICK class TickChanger(commands.Cog): """ Change the emoji that gets reacted with when `await ctx.tick()` is c...
i-am-zaidali/cray-cogs
tickchanger/main.py
.py
3ae02cc70e1649eb
7.3
3
import asyncio import itertools import logging import math from collections.abc import Callable, Iterable from typing import Any, TypeVar import discord from discord.ext import tasks from redbot.core import Config, commands from redbot.core.bot import Red from redbot.core.utils import chat_formatting as cf from .mode...
i-am-zaidali/cray-cogs
timer/timers.py
.py
f1e2cb0741ce1841
7.3
3
#!/usr/bin/python3 import os import shlex import subprocess from functools import lru_cache from funshell import run_shell from .util import ( NotAGitRepositoryError, aicommits_commit, has_staged_changes, logger, parse_version, run_checked, ) @lru_cache(maxsize=8) def git_repo_root(cwd: str...
farfarfun/funbuild
src/funbuild/core/base.py
.py
cd2d54cb1e21ff57
7.24
2
#!/usr/bin/python3 import typing import typer from .registry import get_build from .util import NotAGitRepositoryError def funbuild(): """主入口函数""" cli = typer.Typer(help='build tool for "fun"') # 延迟探测: get_build 要跑 git 并解析仓库里所有清单文件, 而 `--help`、 # 参数错误、`--install-completion` 等根本用不到 builder。在这些路径上提前...
farfarfun/funbuild
src/funbuild/core/cli.py
.py
812799e04cba491e
7.24
2
#!/usr/bin/python3 from .base import BaseBuild from .util import logger class EmptyBuild(BaseBuild): """兜底构建类: 所有命令均为空操作。 永远匹配, 因此必须排在注册表最后。 """ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def check_type(self) -> bool: """兜底匹配。走到这里说明没有任何构建策略认领本仓库。""" ...
farfarfun/funbuild
src/funbuild/core/empty_build.py
.py
1631dcc4dc7d8e80
7.24
2
#!/usr/bin/python3 import os from .base import BaseBuild from .util import deep_get, dump_toml, load_toml, logger from .version_sync import sync_all_manifest_versions class PoetryBuild(BaseBuild): """Poetry构建类""" def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.to...
farfarfun/funbuild
src/funbuild/core/poetry_build.py
.py
0c0978e44435c114
7.24
2
#!/usr/bin/python3 import os from .base import BaseBuild from .version_sync import sync_all_manifest_versions class PypiBuild(BaseBuild): """PyPI构建类""" def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.version_path = "./script/__version__.md" def check_type(se...
farfarfun/funbuild
src/funbuild/core/pypi_build.py
.py
dda211044a458295
7.24
2
#!/usr/bin/python3 import re import shutil import subprocess from functools import lru_cache from typing import Any, Optional import tomlkit from funshell import run_shell_list from farlog import getLogger logger = getLogger("funbuild") class ShellCommandError(RuntimeError): """shell 命令链执行失败。""" class NotAGi...
farfarfun/funbuild
src/funbuild/core/util.py
.py
0e977151cd99bbc9
7.24
2
#!/usr/bin/python3 import os import shlex from configparser import ConfigParser from .base import BaseBuild from .util import deep_create, deep_get, dump_toml, load_toml, logger from .version_sync import root_pyproject_project_version, sync_all_manifest_versions def _uv_bundle_out_dir(pkg_dir: str) -> str: """多...
farfarfun/funbuild
src/funbuild/core/uv_build.py
.py
9ea5de62d123afc9
7.24
2
#!/usr/bin/python3 import os from .base import BaseBuild from .util import logger, parse_version from .version_sync import sync_all_manifest_versions class VersionFileBuild(BaseBuild): """以根目录纯文本 `VERSION` 文件为版本源的项目 (如 shell 脚本仓库)。 这类仓库没有 pyproject.toml / package.json, 无从构建或发布, 但仍需要 upgrade / push / ta...
farfarfun/funbuild
src/funbuild/core/version_file_build.py
.py
8c636834cf8c5a04
7.24
2
"""覆盖「这个仓库是否属于本组织」的判定。 以前用 `name.startswith("fun")`,组织经历 note* -> fun* -> 部分 nlt* 改名后 这个前缀不再代表归属:farlog / nltcache / nltspec / nltdeploy 是自有仓库却被 判成外部,于是拿不到许可证元数据、authors、urls,也不走 ruff 格式化。 """ import subprocess import pytest from funbuild.core.base import is_org_repo def _git(path, *args): subprocess.run(["gi...
farfarfun/funbuild
tests/test_org_repo.py
.py
dd4f34e7704f9e4d
7.74
2
from collections.abc import Sequence from itertools import count from math import inf import matplotlib.pyplot as plt import pandas as pd from matplotlib.animation import FuncAnimation __all__ = ("RTFeatureDisplay",) plt.style.use("fivethirtyeight") # TODO: refactor using draw_artists? class FeatureDisplay: "...
mnalli/panson
src/panson/feature_displays.py
.py
a759f70cfe8dfa14
7.24
2
from abc import ABC, abstractmethod import pandas as pd __all__ = ("Preprocessor",) # TODO: with this mechanism, the user is forced to use a constructor without # arguments. We would want the constructor to support parameters. # This could be done using a builder pattern and passing this instead of the # Preprocesso...
mnalli/panson
src/panson/preprocessors.py
.py
d1589edebcc7923f
7.24
2
import re from abc import ABC, abstractmethod from functools import reduce, wraps from threading import RLock from typing import final import ipywidgets as widgets import sc3nb as scn from IPython.display import display from pandas import Series from sc3nb.osc.osc_communication import Bundler from sc3nb.sc_objects.ser...
mnalli/panson
src/panson/sonification.py
.py
e07ef2128f597eb3
7.24
2
import csv import logging import math import time from collections.abc import Callable, Generator from typing import Any, final import numpy as np import pandas as pd from .preprocessors import Preprocessor _LOGGER = logging.getLogger(__name__) __all__ = ("Stream",) class Stream: """This class is used to def...
mnalli/panson
src/panson/streams.py
.py
6f17e29a7375605e
7.24
2
import ipywidgets as widgets from IPython.display import display from ipywidgets import HBox, VBox class DataPlayerWidgetView: def __init__(self, player, max_idx): self._player = player self._slider = widgets.IntSlider( value=self._player.ptr, min=0, max=max_id...
mnalli/panson
src/panson/views.py
.py
da413cf3ced2b5e3
7.24
2
#!/usr/bin/env python3 """Run the eval + improve loop until all pass or max iterations reached. Combines run_eval.py and improve_description.py in a loop, tracking history and returning the best description found. Supports train/test split to prevent overfitting. """ import argparse import json import random import s...
Cratis/cratis.github.io
.ai/skills/skill-creator/scripts/run_loop.py
.py
bafdb8e25c740813
7
0
import law import luigi import os import json from framework import ( console, HTCondorWorkflow, Task, KingmakerSandbox, sandbox_pre_setup_cmds_factory, resolve_sample_data, ) from law.task.base import WrapperTask from rich.table import Table from helpers.helpers import convert_to_comma_seperate...
KIT-CMS/KingMaker
processor/tasks/CROWNBase.py
.py
99985112c4bbc91c
7.24
2
import luigi import os import tarfile import subprocess import time import law from framework import console from CROWNMain import CROWNRun from helpers.helpers import create_abspath from CROWNBase import CROWNExecuteBase from CROWNBase import CROWNBuildBase from CROWNMain import BuildCROWNLib from helpers.helpers impo...
KIT-CMS/KingMaker
processor/tasks/CROWNFriend.py
.py
42e42f297aa01963
7.24
2
from functools import cache import os import re import traceback import logging from law.logger import get_logger from XRootD.client import FileSystem from XRootD.client.flags import StatInfoFlags # Get law loggers for this module logger = get_logger("xrootd.stat") # Patch FileSystem.stat to trace all XRootD stat ca...
KIT-CMS/KingMaker
processor/tasks/helpers/helpers.py
.py
94d39960d831b1b1
7.24
2
import os from rich.table import Table from rich import print as rprint from rich.live import Live from rich.console import Console from datetime import datetime import time import sys import shlex def parse_args_from_law(): """ The function `parse_args_from_law` parses command line arguments for a script wit...
KIT-CMS/KingMaker
scripts/ProductionStatus.py
.py
14dd5c6a974512c8
7.24
2
"""Common test fixtures for the custom backend plugin.""" from unittest.mock import MagicMock import pytest from waldur_site_agent_mycustom.backend import MyCustomBackend @pytest.fixture def backend_settings(): """Standard backend settings for testing.""" return { "default_account": "root", ...
waldur/waldur-site-agent
docs/plugin-template/tests/conftest.py
.py
adbb38e9648d3dbc
7.85
4
"""Custom backend implementation. This module implements the BaseBackend interface for the custom backend. See docs/plugin-development-guide.md for full documentation. """ from typing import Optional from waldur_api_client.models.resource import Resource as WaldurResource from waldur_site_agent.backend.backends imp...
waldur/waldur-site-agent
docs/plugin-template/waldur_site_agent_mycustom/backend.py
.py
6534cd53f810c4fc
7.35
4
"""Optional Pydantic schemas for configuration validation. Register these via entry points in pyproject.toml to enable automatic validation of backend_settings and backend_components. """ from pydantic import BaseModel, Field class MyCustomComponentSchema(BaseModel): """Schema for validating a single component ...
waldur/waldur-site-agent
docs/plugin-template/waldur_site_agent_mycustom/schemas.py
.py
87824d47f6cbc2f3
7.35
4
"""Behaviour every S3 admin client must exhibit, whatever the flavour. The croit flavour runs these against a scripted gateway; the radosgw flavour runs the same promises against a live cluster under tests/e2e. Anything asserted here is something the backend relies on and neither client may quietly change. """ import...
waldur/waldur-site-agent
plugins/ceph-s3/tests/test_client_contract.py
.py
49ac31501396b208
7.85
4
"""The backend names operators put in their configuration.""" import sys if sys.version_info >= (3, 10): from importlib.metadata import entry_points else: from importlib_metadata import entry_points def _backends(): return {ep.name: ep for ep in entry_points(group="waldur_site_agent.backends")} def te...
waldur/waldur-site-agent
plugins/ceph-s3/tests/test_entry_points.py
.py
79c315b42c2c2794
7.85
4
"""Metering is croit-only, and neither backend may ever report a zero. The management backend serves both flavours and cannot meter, because RadosGW exposes no stored-bytes series. GB-day reporting therefore lives in its own backend, wired through ``reporting_backend``. """ import sys from unittest.mock import Mock, ...
waldur/waldur-site-agent
plugins/ceph-s3/tests/test_reporting_split.py
.py
09c7aa9df2ce8224
7.85
4
"""Custom exceptions for the Ceph S3 plugin. Named for Ceph rather than croit because both flavours raise them: the croit management API and RadosGW Admin Ops report the same conditions, only with different status codes and payloads. The one exception that stays croit-named is the graph error, which is a croit concept...
waldur/waldur-site-agent
plugins/ceph-s3/waldur_site_agent_ceph_s3/exceptions.py
.py
2c5e9dbc41b64169
7.35
4
"""GB-day storage metering from croit's statistics subsystem. Split from the management backend because the series this integrates has no equivalent in RadosGW Admin Ops: /admin/usage carries bandwidth and operation counts, and bucket stats are a point-in-time size. A radosgw-flavoured offering can create users, keys ...
waldur/waldur-site-agent
plugins/ceph-s3/waldur_site_agent_ceph_s3/reporting.py
.py
a4b1d1234b8a1567
7.35
4
"""Which Ceph management API this offering talks to, and what that needs. The two flavours reach the same RGW concepts by different routes: croit through its management application, radosgw through Admin Ops on the gateway itself. They share no credentials and almost no settings, so a configuration that mixes them is ...
waldur/waldur-site-agent
plugins/ceph-s3/waldur_site_agent_ceph_s3/settings.py
.py
3cb97c85cac3dc23
7.35
4
"""Tests for DigitalOcean backend.""" import uuid from unittest.mock import Mock, patch import pytest from waldur_api_client.models.resource import Resource as WaldurResource from waldur_site_agent.backend.exceptions import BackendError from waldur_site_agent_digitalocean.backend import DigitalOceanBackend @pytest...
waldur/waldur-site-agent
plugins/digitalocean/tests/test_digitalocean_backend.py
.py
db0f514500799bf0
7.85
4
"""Tests for DigitalOcean client wrapper.""" from unittest.mock import Mock, patch import pytest import digitalocean from waldur_site_agent_digitalocean.client import ( DigitalOceanClient, NotFoundError, UnauthorizedError, ) def _build_client(): """Create client with mocked manager.""" with pat...
waldur/waldur-site-agent
plugins/digitalocean/tests/test_digitalocean_client.py
.py
1e2261550c179a94
7.85
4
"""DigitalOcean client wrapper for Waldur Site Agent.""" from __future__ import annotations import functools import logging from typing import Callable, Optional, TypeVar import digitalocean from waldur_site_agent.backend.clients import BaseClient from waldur_site_agent.backend.exceptions import BackendError from w...
waldur/waldur-site-agent
plugins/digitalocean/waldur_site_agent_digitalocean/client.py
.py
c034ac41fe7dda43
7.35
4
"""DigitalOcean plugin-specific Pydantic schemas for configuration validation.""" from __future__ import annotations from typing import Optional from pydantic import ConfigDict, Field from waldur_site_agent.common.plugin_schemas import ( PluginBackendSettingsSchema, PluginComponentSchema, ) class DigitalO...
waldur/waldur-site-agent
plugins/digitalocean/waldur_site_agent_digitalocean/schemas.py
.py
bde381bc3e39433e
7.35
4
"""Tests for the usage warehouse HTTP client.""" from __future__ import annotations from unittest import mock import httpx import pytest from waldur_site_agent_envoy_ai_gateway.usage_client import EnvoyUsageBackendError, EnvoyUsageClient @mock.patch("waldur_site_agent_envoy_ai_gateway.usage_client.httpx.Client") d...
waldur/waldur-site-agent
plugins/envoy-ai-gateway/tests/test_envoy_usage_client.py
.py
5c7bec7c2d8d99d4
7.85
4
"""HTTP client for a usage warehouse.""" from __future__ import annotations import logging from typing import Optional import httpx from waldur_site_agent.backend.exceptions import BackendError logger = logging.getLogger(__name__) DEFAULT_TIMEOUT = 30.0 class EnvoyUsageBackendError(BackendError): """Error r...
waldur/waldur-site-agent
plugins/envoy-ai-gateway/waldur_site_agent_envoy_ai_gateway/usage_client.py
.py
5748e962abbb9839
7.35
4
"""Tests for Harbor backend.""" import pytest from unittest.mock import Mock, patch, MagicMock from waldur_api_client.models.resource import Resource as WaldurResource from waldur_site_agent.backend import structures from waldur_site_agent_harbor.backend import HarborBackend from waldur_site_agent_harbor.client impo...
waldur/waldur-site-agent
plugins/harbor/tests/test_harbor_backend.py
.py
6878485101429df0
7.85
4
"""Tests for Harbor client.""" import pytest from unittest.mock import Mock, patch, MagicMock import httpx from waldur_site_agent_harbor.client import HarborClient from waldur_site_agent_harbor.exceptions import ( HarborAPIError, HarborAuthenticationError, HarborProjectError, HarborQuotaError, Har...
waldur/waldur-site-agent
plugins/harbor/tests/test_harbor_client.py
.py
fa4c242f57e52818
7.85
4
"""Source store factory.""" from .book import BookSourceProcessor from .rss import RSSSourceProcessor class SourceStoreFactory: """Build concrete local source stores from source type.""" @staticmethod def create(path: str, source_type: str): if source_type == "booksource": return Boo...
farfarfun/funread
src/funread/legado/manage/download/sources/factory.py
.py
03b79c4f1ed55e69
7.15
1
"""RSS source processor.""" from typing import Any, Dict from funread.legado.manage.source.storage import iter_source_list_data from funread.legado.manage.utils import retain_zh_ch_dig from ..core.processor import SourceProcessor class RSSSourceFormat: """RSS 源格式化类,用于统一 RSS 源格式""" def __init__(self, sourc...
farfarfun/funread
src/funread/legado/manage/download/sources/rss.py
.py
ca168c0a5b3617a7
7.15
1
"""Source generation orchestration task.""" from typing import Any, Dict from funsecret import read_secret from farlog import getLogger from ..source.check.task import CheckSourceStatusTask from ..source.merge.task import SourceMergeRunner from ..source.sync.task import SyncLocalSourceRecordsTask from .context impor...
farfarfun/funread
src/funread/legado/manage/download/task.py
.py
b09d033903a4232e
7.15
1
"""工具函数模块""" import re from typing import Optional from urllib.parse import urlparse def url_to_hostname(url: str) -> Optional[str]: """ 从 URL 中提取主机名 Args: url: 完整的 URL 字符串 Returns: 主机名字符串,如果解析失败则返回 None """ try: parsed = urlparse(url) return parsed.hostname ...
farfarfun/funread
src/funread/legado/manage/utils/core.py
.py
6300070bbd7626b9
7.15
1
"""Shared funworker producer/consumer helpers for source batch tasks.""" from collections import Counter from typing import Any, Iterator, List from funworker import BaseConsumer, BaseProducer class ListProducer(BaseProducer): """Produce items from a pre-computed list, then stop.""" def __init__(self, outp...
farfarfun/funread
src/funread/legado/manage/utils/worker.py
.py
048c6995ce577d5c
7.15
1
"""Reusable global Invoke tasks that can be merged with local project tasks. Helpful docs: - http://www.pyinvoke.org/ - http://docs.pyinvoke.org/en/stable/api/runners.html#invoke.runners.Runner.run """ from __future__ import annotations import importlib import sys from collections import defaultdict from dataclasses...
andreoliwa/conjuring
src/conjuring/__init__.py
.py
92b7e73841c29eff
7.24
2
"""Module that contains the command line app. Why does this file exist, and why not put this in __main__? You might be tempted to import things from __main__ later, but that will cause problems: the code will get executed twice: - When you run `python -mconjuring` python will execute ``__main__.py`` as a s...
andreoliwa/conjuring
src/conjuring/cli.py
.py
abb1f2eb59991f9c
7.24
2
"""AWS: ECR login.""" from __future__ import annotations import os from urllib.parse import urlparse from invoke import Context, Result, task from conjuring.constants import AWS_CONFIG from conjuring.grimoire import run_command, run_lines, run_with_fzf LIST_AWS_PROFILES_COMMAND = rf"rg -o '^\[profile[^\]]+' {AWS_C...
andreoliwa/conjuring
src/conjuring/spells/aws.py
.py
62cde1cdde5ae48e
7.24
2
"""[Docker](https://www.docker.com/): remove containers and volumes.""" from invoke import Context, task from conjuring.grimoire import print_error, run_command SHOULD_PREFIX = True @task( help={ "container": "Container name to remove (regexp)", "all_": "All containers", "exited": "Exit...
andreoliwa/conjuring
src/conjuring/spells/docker.py
.py
605bc504b846403e
7.24
2
"""Backup and restore with [Duplicity](https://duplicity.us/).""" from pathlib import Path from string import Template from tempfile import NamedTemporaryFile from invoke import Context, task from conjuring.colors import Color from conjuring.grimoire import ( get_hostname, lazy_env_variable, print_color,...
andreoliwa/conjuring
src/conjuring/spells/duplicity.py
.py
3536d7b15dedfe26
7.24
2
"""Import macOS keyboard text replacements into https://github.com/espanso/espanso configuration.""" import plistlib import subprocess from pathlib import Path from invoke import Context, task from conjuring.grimoire import ask_yes_no, print_error, print_normal, print_success, print_warning, run_command SHOULD_PREF...
andreoliwa/conjuring
src/conjuring/spells/espanso.py
.py
7680e309f7397dfd
7.24
2
"""[GitHub](https://github.com/) forks: configure remote and sync.""" from invoke import Context, Exit, task from conjuring.spells import git SHOULD_PREFIX = True @task( help={ "username": "The owner of the original repository. Required", "remote": "The remote to sync with (default: upstream)",...
andreoliwa/conjuring
src/conjuring/spells/fork.py
.py
c065440b5a228938
7.24
2
"""Generic spells: list to-do items in files.""" from __future__ import annotations import re from collections import defaultdict from dataclasses import dataclass from shlex import quote from invoke import Context, task from more_itertools import always_iterable from conjuring.grimoire import ( print_error, ...
andreoliwa/conjuring
src/conjuring/spells/generic.py
.py
1d5f074b5959d6ed
7.24
2
"""Query tags and entries with the [jrnl](https://github.com/jrnl-org/jrnl) note-taking tool.""" from invoke import Context, task SHOULD_PREFIX = True @task def tags(c: Context, sort: bool = False, rg: str = "", journal: str = "") -> None: """Query jrnl tags.""" cmd = ["jrnl"] if journal: cmd.ap...
andreoliwa/conjuring
src/conjuring/spells/jrnl.py
.py
471dfe9049975eee
7.24
2
"""[Kubernetes](https://kubernetes.io/): get pods, show variables from config maps, validate score and more.""" from __future__ import annotations from dataclasses import dataclass from pathlib import Path from typing import cast from invoke import Context, Result, task from conjuring.grimoire import run_command, r...
andreoliwa/conjuring
src/conjuring/spells/k8s.py
.py
85a97d2594243aeb
7.24
2
"""[MkDocs](https://github.com/mkdocs/mkdocs/) spells: install, build, deploy to GitHub, serve locally.""" from invoke import Context, task from conjuring.grimoire import run_command from conjuring.visibility import has_pyproject_toml SHOULD_PREFIX = True EXTENSIONS: list[str] = [ # keep-sorted start "mkdo...
andreoliwa/conjuring
src/conjuring/spells/mkdocs.py
.py
aa649d1f9afcce76
7.24
2
"""[myrepos repository management tool](https://myrepos.branchable.com/): grep text in repos.""" from __future__ import annotations from dataclasses import dataclass from itertools import chain from pathlib import Path from invoke import Context, task from conjuring.grimoire import run_stdout, run_with_fzf MRCONFI...
andreoliwa/conjuring
src/conjuring/spells/mr.py
.py
a1a3c93c2bb14c34
7.24
2
"""[OneDrive](https://onedrive.com/): list files with conflicts.""" from __future__ import annotations from pathlib import Path from invoke import Context, task from conjuring.grimoire import get_hostname, run_lines, run_stdout SHOULD_PREFIX = True @task( help={"dir": "Directory; can be used multiple times. ...
andreoliwa/conjuring
src/conjuring/spells/onedrive.py
.py
7dae27c9b0c2f7dd
7.24
2
"""[Paperless](https://github.com/paperless-ngx/paperless-ngx): maintenance, renamer, sanity, delete duplicates.""" from __future__ import annotations import re import shutil from collections import Counter, defaultdict from dataclasses import dataclass, field from http import HTTPStatus from pathlib import Path from...
andreoliwa/conjuring
src/conjuring/spells/paperless.py
.py
82b8ee824761e7eb
7.24
2
"""[pre-commit](https://pre-commit.com/): install, uninstall, run/autoupdate selected hooks.""" from __future__ import annotations import itertools import re from pathlib import Path from invoke import Context, task from conjuring.constants import PRE_COMMIT_CONFIG_YAML from conjuring.grimoire import print_success,...
andreoliwa/conjuring
src/conjuring/spells/pre_commit.py
.py
315f187416ce8dbc
7.24
2
"""[Python](https://www.python.org/) and [Poetry](https://github.com/python-poetry/poetry). Install venvs, run tests and coverage, install debug tools. """ from __future__ import annotations from dataclasses import dataclass from pathlib import Path from invoke import Context, Result, task from packaging.version im...
andreoliwa/conjuring
src/conjuring/spells/py.py
.py
3132d46b445995bc
7.24
2
"""[Ruff](https://github.com/astral-sh/ruff) spells to generate config and remind you of ignored warnings.""" from __future__ import annotations import re from collections import defaultdict from pathlib import Path from textwrap import dedent import tomlkit from invoke import Context, task from tomlkit.exceptions i...
andreoliwa/conjuring
src/conjuring/spells/ruff.py
.py
59cf3dd0d32f803b
7.24
2
"""Shell: completions, hostname, and process management.""" from __future__ import annotations import os import platform import shlex import uuid from enum import Enum from pathlib import Path from invoke import Context, task from conjuring.grimoire import ( ask_yes_no, join_pieces, print_error, pri...
andreoliwa/conjuring
src/conjuring/spells/shell.py
.py
5e47743f45f6293a
7.24
2
"""MacOS Spotlight spells. There is not much we can do. There is NO programmatic way to exclude directories from Spotlight on modern macOS. You have to do it manually through System Settings > Spotlight Privacy. "It just works"! """ from __future__ import annotations from invoke import Context, task from conjurin...
andreoliwa/conjuring
src/conjuring/spells/spotlight.py
.py
8d472958e4f462b6
7.24
2
"""Visibility predicates and a custom Invoke task that can be hidden.""" from __future__ import annotations from pathlib import Path from typing import TYPE_CHECKING, Any, Callable from invoke import Task from conjuring.constants import PRE_COMMIT_CONFIG_YAML, PYPROJECT_TOML if TYPE_CHECKING: from collections....
andreoliwa/conjuring
src/conjuring/visibility.py
.py
c92eae87f10eee06
7.24
2
import hashlib def file_hash(file_path, algorithm): """ 计算文件的哈希值 :param file_path: 文件路径 :param algorithm: 哈希算法('md5', 'sha1', 'sha256', 'sha512') :return: 文件的哈希值 """ hash_func = hashlib.new(algorithm) with open(file_path, "rb") as f: for chunk in iter(lambda: f.read(1024 * 1024...
farfarfun/funfile
src/funfile/utils/hash.py
.py
8e6f3530db4be128
7
0
import os def bytes_to_human_readable(size_bytes): """ 将字节数转换为人类可读的字符串形式(如 KB、MB、GB 等) """ if size_bytes == 0: return "0B" units = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB") unit_index = 0 while size_bytes >= 1024 and unit_index < len(units) - 1: size_bytes /= ...
farfarfun/funfile
src/funfile/utils/size.py
.py
b634ebf3db2821b3
7
0
import json from rest_framework.authtoken.models import Token from scans.models import Scan def return_context(request): """context for initial search/list view""" def get_scans(): """return all scans""" return [x.to_dict() for x in Scan.objects.all().order_by("-time_scan")] def get_or...
dev-bddw/mothership_scans
frontend/helpers.py
.py
f923b473af953eb4
7.15
1
""" To understand why this file is here, please read: http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django """ from django.conf import settings from django.db import migrations def _update_or_create_site_with_sequence(site_model, connection...
dev-bddw/mothership_scans
mothership_scans/contrib/sites/migrations/0003_set_site_domain_and_name.py
.py
1e0948317bc05421
7.15
1
from django.contrib.auth.models import AbstractUser from django.db.models import CharField from django.urls import reverse from django.utils.translation import gettext_lazy as _ class User(AbstractUser): """ Default custom user model for mothership scans. If adding fields that need to be filled at user si...
dev-bddw/mothership_scans
mothership_scans/users/models.py
.py
6b91143989fc0e43
7.15
1
""" Copyright 2023 Inmanta 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 distri...
inmanta/pytest-inmanta-yang
docs/examples/nokia-srlinux-interface/tests/conftest.py
.py
f58fb6e607574f9e
7.5
0
""" Copyright 2022 Inmanta 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 distri...
inmanta/pytest-inmanta-yang
src/pytest_inmanta_yang/clab/config.py
.py
7fd5a41afdb4d63c
7.5
0
""" Copyright 2022 Inmanta 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 distri...
inmanta/pytest-inmanta-yang
src/pytest_inmanta_yang/fixtures.py
.py
3f48caba0d4750e9
7.5
0
""" Copyright 2022 Inmanta 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 distri...
inmanta/pytest-inmanta-yang
src/pytest_inmanta_yang/netconf_device_helper.py
.py
edfe89b54b741e38
7.5
0
""" Copyright 2022 Inmanta 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 distri...
inmanta/pytest-inmanta-yang
src/pytest_inmanta_yang/yang_test.py
.py
217372050872c02b
7.5
0
""" Copyright 2023 Inmanta 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 distri...
inmanta/examples
Training/inmanta-module-srlinux-helper/inmanta_plugins/srlinux_helper/__init__.py
.py
d54dc4166a8a1e1b
7.39
5
""" Copyright 2023 Inmanta 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 distri...
inmanta/examples
Training/inmanta-module-subscriber/inmanta_plugins/subscriber/topology_adapter.py
.py
97b96b32b99607e5
7.39
5
""" Copyright 2021 Inmanta 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 distri...
inmanta/examples
lsm-external-allocation/libs/test_module/tests/helpers.py
.py
39fb5569fbf8b286
7.89
5
""" Copyright 2021 Inmanta 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 distri...
inmanta/examples
lsm-from-inventory-a/libs/stacked_service/plugins/__init__.py
.py
e91bf1f91795a508
7.39
5
""" Copyright 2021 Inmanta 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 distri...
inmanta/examples
lsm-from-inventory-b/libs/stacked_service/plugins/__init__.py
.py
0d27dd5def0c40c3
7.39
5
""" :copyright: 2024 Inmanta :contact: code@inmanta.com :license: Inmanta EULA This module validates and parses the config file using pydantic. """ import pathlib import typing import inmanta_plugins.config.const import pydantic import yaml import inmanta.module import inmanta.plugins @inmanta.plugins.plugin() de...
inmanta/examples
lsm-testing/inmanta_plugins/integration_example/config.py
.py
88e668fcaf7c46d6
7.89
5
""" :copyright: 2024 Inmanta :contact: code@inmanta.com :license: Inmanta EULA """ import inmanta_plugins.lsm.allocation_helpers # type: ignore import inmanta.plugins # For more details about allocation v3, refer to the documentation # https://docs.inmanta.com/inmanta-service-orchestrator/latest/lsm/allocation/all...
inmanta/examples
lsm-testing/inmanta_plugins/integration_example/services/important_customer/lsm.py
.py
e851e5c2dc24c970
7.89
5
""" :copyright: 2024 Inmanta :contact: code@inmanta.com :license: Inmanta EULA """ import inmanta_lsm.model # type: ignore import pytest_inmanta.plugin import pytest_inmanta_lsm.lsm_project import pytest_inmanta_lsm.remote_orchestrator import pytest_inmanta_lsm.remote_service_instance_async import pytest_inmanta_lsm....
inmanta/examples
lsm-testing/tests/test_lsm/test_basic_service_lsm.py
.py
f91760b5f3a4a3ec
7.89
5
""" :copyright: 2024 Inmanta :contact: code@inmanta.com :license: Inmanta EULA """ from typing import cast import inmanta_lsm.model # type: ignore import pytest_inmanta.plugin import pytest_inmanta_lsm.lsm_project import pytest_inmanta_lsm.remote_orchestrator import pytest_inmanta_lsm.remote_service_instance_async i...
inmanta/examples
lsm-testing/tests/test_lsm/test_important_customer_service_lsm.py
.py
de617641e3a38a3a
7.89
5
""" :copyright: 2023 Inmanta :contact: code@inmanta.com :license: Inmanta EULA """ from inmanta.plugins import plugin, Context from itertools import chain import os from inmanta_lsm import const as lsm_const import inmanta_lsm.model import logging import json LOGGER = logging.getLogger(__file__) def _validating_ent...
inmanta/examples
lsm-updates/libs/lsm_update/plugins/__init__.py
.py
b34c6aace65bf76a
7.39
5
# Copyright 2024 Rapyuta Robotics # # 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...
rapyuta-robotics/rapyuta-io-cli
riocli/apply/explain.py
.py
2b795ed32848c039
7.15
1
# Copyright 2024 Rapyuta Robotics # # 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...
rapyuta-robotics/rapyuta-io-cli
riocli/apply/filters.py
.py
c76af50b55fb6eac
7.15
1
# Copyright 2025 Rapyuta Robotics # # 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...
rapyuta-robotics/rapyuta-io-cli
riocli/apply/parse.py
.py
8dd30c5dfa16dcef
7.15
1
# Copyright 2024 Rapyuta Robotics # # 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...
rapyuta-robotics/rapyuta-io-cli
riocli/auth/__init__.py
.py
1fb53df9459ccd33
7.15
1
# Copyright 2025 Rapyuta Robotics # # 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...
rapyuta-robotics/rapyuta-io-cli
riocli/auth/device_flow.py
.py
13d29396bde99363
7.15
1
# Copyright 2025 Rapyuta Robotics # # 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...
rapyuta-robotics/rapyuta-io-cli
riocli/auth/login.py
.py
3bd4bcf8e837a497
7.15
1