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
""" Tool to print disk quota information. Inspired by dusage (written by Lorand Szentannai). """ import sys import getpass import os import colorful as cf from tabulate import tabulate import click from dusage_backend import quota_using_project, quota_using_account, quota_using_path __version__ = "0.3.9" def _st...
NordicHPC/dusage
_dusage/dusage_frontend.py
.py
62cedbae9ea8eac1
7.24
2
import requests from ocm_python_client.api.default_api import DefaultApi from ocm_python_client.api_client import ApiClient from ocm_python_client.configuration import Configuration from ocm_python_client.exceptions import UnauthorizedException from simple_logger.logger import get_logger from ocm_python_wrapper.except...
RedHatQE/openshift-cluster-management-python-wrapper
ocm_python_wrapper/ocm_client.py
.py
dc1145ce0cfc8275
7.15
1
from collections import defaultdict class Versions: def __init__(self, client): self.client = client def get(self, version_prefix=None, channel_group=None, size=10000): """ Retrieves a dictionary of available versions grouped by channel group. Args: version_prefix...
RedHatQE/openshift-cluster-management-python-wrapper
ocm_python_wrapper/versions.py
.py
01f90f3aa58095ce
7.15
1
# pylint: disable=pointless-string-statement import time import logging import tempfile import traceback from lockfile import FileLock, AlreadyLocked, LockTimeout from django.conf import settings from django.utils import timezone from django.utils.text import slugify """ A decorator for management commands (or any ...
audacious-software/Simple-Backup-Django
decorators.py
.py
a578a7620c775b47
7
0
# 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/pyhps
examples/cfx_static_mixer/exec_cfx.py
.py
ba61795d141a85d9
7.39
5
# 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/pyhps
examples/lsdyna_cylinder_plate/lsdyna_job.py
.py
e2d7ed9d87c2d688
7.39
5
# 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/pyhps
examples/mapdl_motorbike_frame/project_query.py
.py
234071b2502281a0
7.39
5
# 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/pyhps
examples/monitor/list_topics.py
.py
37aae493d3351882
7.39
5
# 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/pyhps
examples/monitor/stream_scheduler_job_status.py
.py
2088f041613fa822
7.39
5
# 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/pyhps
examples/monitor/stream_service_logs.py
.py
9c5a93fb84cdc096
7.39
5
# 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/pyhps
examples/monitor/stream_task_host_resources.py
.py
24b18aac25d35cea
7.39
5
# 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/pyhps
examples/monitor/stream_task_logs.py
.py
2d06526e32dbbf93
7.39
5
# 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/pyhps
examples/monitor/stream_task_process_tree.py
.py
417f38849b2fc38e
7.39
5
# 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/pyhps
examples/oidc/load_saved_tokens.py
.py
5d35d782c34d903d
7.39
5
# 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/pyhps
examples/python_multi_process_step/eval.py
.py
36ee7aef2dd8f451
7.39
5
# 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/pyhps
examples/python_multi_process_step/task_files.py
.py
42a62f7b7c172c95
7.39
5
# 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/pyhps
examples/python_pyansys_cantilever/exec_script.py
.py
2f629d0c3d088cef
7.39
5
# 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/pyhps
examples/python_two_bar_truss_params_in_exec_script/exec_python.py
.py
1302a4c96a926617
7.39
5
# 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/pyhps
examples/python_uv/exec_script.py
.py
db402d4afcee58fc
7.39
5
# 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/pyhps
generate_resources.py
.py
5a17f03f9f4175cd
7.39
5
"""Shared loader for the hyphenated CLI script `evaluate-qanary-system.py`, which can't be imported with a normal `import` statement. """ import importlib.util import os import pytest _HERE = os.path.dirname(os.path.abspath(__file__)) _SCRIPT = os.path.join(_HERE, "evaluate-qanary-system.py") def _load_evaluator():...
WSE-research/Qanary-quality-assurance
conftest.py
.py
ea1060475c3b06c2
7.65
1
import json import os.path import pandas as pd from io import StringIO from datetime import datetime from dotenv import load_dotenv from fastapi.responses import StreamingResponse class FileHelper: """ Provides functions handling files that are needed at multiple stages. """ load_dotenv() results...
WSE-research/Qanary-NER-automl-component
AutomationService/AutomationServiceBackend/app/helper/filehelper.py
.py
b3132e7db3c8b433
7
0
import logging import os import spacy from spacy.cli import download from enum import Enum import re class ResultBuilder: # Tags to use for building the compound lists # tag_list suitable for English and German models tag_list = ["compound", "nmod", "nummod", "pnc", "nk", "nmc"] nlp = None def _...
WSE-research/Qanary-NER-automl-component
AutomationService/AutomationServiceBackend/app/spacy_model/result_builder.py
.py
f10466ff27d1d9de
7
0
""" Correct (COR) : both are the same; Incorrect (INC) : the output of a system and the golden annotation don’t match; Partial (PAR) : system and the golden annotation are somewhat “similar” but not the same; - not included as we use the exact match policy (partial matches are counted as false) Missing ...
WSE-research/Qanary-NER-automl-component
TestSetup/Tests/QualityMetricScripts/calculate_first_stage.py
.py
fad5c5a76319aa3f
7.5
0
import sys import json import os import re """ param 1: Directory storing the json result files param 2: Output file """ no_of_files = 0 result_text = ",Total Result Objects Checked,Average Similarities" similarities_perc_total = 0 objects_counted_total = 0 similarities_perc_current = 0 objects_counted_current = 0 d...
WSE-research/Qanary-NER-automl-component
TestSetup/Tests/QualityMetricScripts/calculate_second_stage_from_resulted_entity_perspective.py
.py
1ab6851d82d2515f
7.5
0
import sys import json import os import re """ param 1: Directory storing the json result files param 2: Output file param 3: Debug file """ no_of_files = 0 result_text = ",Total Resulted Objects Checked,Absolute Matches,Average Matches" objects_matched_total = 0 objects_counted_total = 0 objects_matched_current = 0 ...
WSE-research/Qanary-NER-automl-component
TestSetup/Tests/QualityMetricScripts/calculate_third_stage_from_resulted_entity_perspective.py
.py
6ea8c9c2754270ef
7.5
0
import sys import json import os """ param 1: Directory storing the json result files param 2: Output file """ no_of_files = 0 result_text = ",Total Expected Objects Checked,Average Similarities" similarities_perc_total = 0 objects_counted_total = 0 similarities_perc_current = 0 objects_counted_current = 0 def hand...
WSE-research/Qanary-NER-automl-component
TestSetup/Tests/QualityMetricScripts/from_golden_perspective_DEPR/calculate_second_stage_from_golden_entity_perspective.py
.py
89b3af56a0c6f16a
7.5
0
import sys import json import os """ param 1: Directory storing the json result files param 2: Output file """ no_of_files = 0 result_text = ",Total Expected Objects Checked,Absolute Matches,Average Matches" objects_matched_total = 0 objects_counted_total = 0 objects_matched_current = 0 objects_counted_current = 0 ...
WSE-research/Qanary-NER-automl-component
TestSetup/Tests/QualityMetricScripts/from_golden_perspective_DEPR/calculate_third_stage_from_golden_entity_perspective.py
.py
a9649978f5c9d1b9
7.5
0
"""The custom exceptions carry default and custom messages.""" from helper.my_exceptions import ( FailedDocBinException, FailedTrainingException, NoTrainingdataException, ) def test_default_messages(): assert "missing" in NoTrainingdataException().message assert "training" in FailedTrainingExcepti...
WSE-research/Qanary-NER-automl-component
tests/unit/test_exceptions.py
.py
f7ab8fa49184249d
7
0
# # 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 # ...
NeCTAR-RC/warre
warre/app.py
.py
6e4049200a852fa7
7.3
3
# # 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 # ...
NeCTAR-RC/warre
warre/common/config.py
.py
d32ed663b6f0c9a1
7.3
3
# # 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 # ...
NeCTAR-RC/warre
warre/common/sentry.py
.py
a0dc959ce84fab4a
7.3
3
# # 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 # distributed under...
NeCTAR-RC/warre
warre/migrations/env.py
.py
514c46bfe690f40f
7.3
3
# # 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 # distributed under ...
NeCTAR-RC/warre
warre/migrations/versions/43d884ebc331_add_zone_and_category_to_flavor.py
.py
9342ed65ab4e4004
7.3
3
# # 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 # distributed under ...
NeCTAR-RC/warre
warre/migrations/versions/56280d4f9db9_flavorproject_id_to_uuid.py
.py
30e9489968710faa
7.3
3
# # 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 # distributed under ...
NeCTAR-RC/warre
warre/migrations/versions/6821e37ce4e2_initial_add.py
.py
265bb08216b4745b
7.3
3
# 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 # distributed under th...
NeCTAR-RC/warre
warre/migrations/versions/a1b2c3d4e5f6_add_maintenance_window.py
.py
c518c5affa4b2454
7.3
3
# # 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 # distributed under ...
NeCTAR-RC/warre
warre/migrations/versions/befa896143d5_add_created_at_to_reservation.py
.py
f9c51a4781c3fc06
7.3
3
# SPDX-FileCopyrightText: 2023-2006 Hidayat Trimarsanto <trimarsanto@gmail.com> # SPDX-License-Identifier: MIT from __future__ import annotations __copyright__ = "(c) 2023-2006 Hidayat (Anto) Trimarsanto <trimarsanto@gmail.com>" __author__ = "trimarsanto@gmail.com" __license__ = "MIT" # __init__.py - ngs-pipeline pa...
vivaxgen/ngs-pipeline
ngs_pipeline/__init__.py
.py
b69baeb3b7c38828
7.24
2
# SPDX-FileCopyrightText: 2026 Hidayat Trimarsanto <trimarsanto@gmail.com> # SPDX-License-Identifier: MIT from __future__ import annotations __copyright__ = "(C) 2026 Hidayat Trimarsanto <trimarsanto@gmail.com>" __author__ = "trimarsanto@gmail.com" __license__ = "MIT" # to improve the responsiveness during bash auto...
vivaxgen/ngs-pipeline
ngs_pipeline/cmds/calculate_cpes_stats.py
.py
d21a68462ac3b260
7.24
2
# version.py - ngs-pipeline command line # [https://github.com/vivaxgen/ngs-pipeline] __copyright__ = "(c) 2025, Hidayat Trimarsanto <trimarsanto@gmail.com>" __license__ = "MIT" # to improve the responsiveness during bash autocomplete, do not import heavy # modules (such as numpy, pandas, etc) here, but instead impor...
vivaxgen/ngs-pipeline
ngs_pipeline/cmds/version.py
.py
53f0ebe8b635bfa2
7.24
2
# file utility library # [https://github.com/vivaxgen/ngs-pipeline] __copyright__ = "(C) 2023-2025, Hidayat Trimarsanto <trimarsanto@gmail.com>" __authors__ = "Hidayat Trimarsanto <trimarsanto@gmail.com>" __license__ = "MIT" from enum import Enum import pathlib from ngs_pipeline import cerr, cexit ReadMode = Enum("R...
vivaxgen/ngs-pipeline
ngs_pipeline/fileutils.py
.py
e2cc2d2e5033a451
7.24
2
# gff3utils.py - ngs-pipeline library # [https://github.com/vivaxgen/ngs-pipeline] __copyright__ = "(C) 2024, Hidayat Trimarsanto <trimarsanto@gmail.com>" __license__ = "MIT" def gff3_to_df(infile): """ return a pandas Dataframe for the 8-column GFF3 """ import pandas as pd regions = {} # see http...
vivaxgen/ngs-pipeline
ngs_pipeline/gff3utils.py
.py
2ee5c23188359bf2
7.24
2
# SPDX-FileCopyrightText: 2024-2006 Hidayat Trimarsanto <trimarsanto@gmail.com> # SPDX-License-Identifier: MIT from __future__ import annotations __copyright__ = "(c) 2024-2006 Hidayat (Anto) Trimarsanto <trimarsanto@gmail.com>" __author__ = "trimarsanto@gmail.com" __license__ = "MIT" # subcommands.py # [https://git...
vivaxgen/ngs-pipeline
ngs_pipeline/subcommands.py
.py
84a03bd875450550
7.24
2
# Copyright 2021 Andrew Chen Wang # # 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...
Hear-Ye/find-your-district-and-representatives
bin/current_legislators.py
.py
41f140871765eced
7.15
1
"""Pure Python tools for NECST.""" # Perform time-consuming downloads class _TimeConsumingTasks: @staticmethod def download_astropy_parameter_files(): """Will download finals2000A.all (3.4MB) and Leap_Second.dat (1.3KB).""" from astropy.time import Time Time.now().ut1 import concurr...
necst-telescope/neclib
neclib/__init__.py
.py
e014aa94ef28bc76
7.3
3
"""Angle unwrap helpers for absolute modulo encoders. This module is intentionally independent from ROS and device drivers. It converts an absolute modulo azimuth reading (for example 0..360 deg) into a continuous azimuth angle within a configured mechanical drive range. """ from __future__ import annotations from ...
necst-telescope/neclib
neclib/coordinates/angle_unwrap.py
.py
2a5e15fa6c092a53
7.3
3
__all__ = ["describe_frame", "parse_frame"] import re from dataclasses import dataclass from functools import lru_cache from typing import Callable, ClassVar, Dict, Type, Union from astropy.coordinates import ( Angle, BaseCoordinateFrame, SkyOffsetFrame, frame_transform_graph, ) @dataclass class Fra...
necst-telescope/neclib
neclib/coordinates/frame.py
.py
1be4ecc1469c0895
7.3
3
import numpy as np from typing import Generator import astropy.units as u from .observation_spec_base import ( ObservationMode, ObservationSpec, TimeKeeper, Waypoint, ) # NOTE: # - convert.cartesian_offset_by() is currently a simple lon/lat addition. # - Therefore, equal-spacing mapping in spherical ...
necst-telescope/neclib
neclib/coordinates/observations/grid.py
.py
923a7aab744cc025
7.3
3
import os import re import time from abc import ABC, abstractmethod from dataclasses import dataclass from enum import Enum from typing import Any, Generator, Iterator, Optional, Tuple, Union import astropy.units as u import matplotlib.pyplot as plt import pandas as pd from astropy.coordinates import Angle, SkyCoord ...
necst-telescope/neclib
neclib/coordinates/observations/observation_spec_base.py
.py
57761efc82660593
7.8
3
from typing import Generator import astropy.units as u import numpy as np from .observation_spec_base import ( ObservationMode, ObservationSpec, TimeKeeper, Waypoint, ) class OTFSpec(ObservationSpec): __slots__ = ("_hot_time_keeper", "_off_time_keeper") def __init__(self, **kwargs) -> None:...
necst-telescope/neclib
neclib/coordinates/observations/otf.py
.py
c1ac67567af423cd
7.3
3
__all__ = ["DriveLimitChecker"] from typing import Optional, Union import astropy.units as u import numpy as np from .. import utils from ..core import ValueRange, get_logger, math from ..core.types import DimensionLess, UnitType class DriveLimitChecker: """Find optimum and safe angle to drive to. The opt...
necst-telescope/neclib
neclib/coordinates/optimize.py
.py
fdccac0219288fe2
7.3
3
class Ordinal(int): """Integer, with corresponding suffix as ordinal number in string representation. Examples -------- >>> Ordinal(1) 1 >>> f"{Ordinal(1)}" '1st' >>> f"{Ordinal(2)} parameter" '2nd parameter' """ def __format__(self, format_spec: str) -> str: numbe...
necst-telescope/neclib
neclib/core/data_type/ordinal.py
.py
802e3081e77f6662
7.3
3
"""Interface to access NECLIB parameters. This module defines the NECLIB standard parameter interface. The values can be any Python built-in type, or physical quantity which need units specified. The parameters would be stored in TOML files, in the following format: .. code-block:: toml [parameter_kind] param...
necst-telescope/neclib
neclib/core/data_type/parameters.py
.py
3acca6f1f1d04ef8
7.3
3
import os import re import warnings from dataclasses import dataclass from itertools import chain from typing import ( IO, Any, Callable, Dict, Generic, Optional, Tuple, Type, TypeVar, Union, ) from tomlkit.container import Container from tomlkit.items import Item from ..except...
necst-telescope/neclib
neclib/core/data_type/rich_parameters.py
.py
033638939c72b2b4
7.3
3
import time from typing import Any, Callable, Generic, Optional, Type, TypeVar from ..formatting import html_repr_of_status T = TypeVar("T", bound=Type) class StatusManager(Generic[T]): """Manage multiple contexts. Parameters ---------- ctx_type A dataclass type which keeps single status/co...
necst-telescope/neclib
neclib/core/data_type/status_manager.py
.py
4894c8abc5b9b22d
7.3
3
from typing import Any, Callable, Generic, Iterable, Iterator, Optional, TypeVar import numpy as np from ..types import SupportsComparison T = TypeVar("T", bound=SupportsComparison) class ValueRange(Generic[T]): """Value range bound by 2 values. Parameters ---------- lower Lower bound of t...
necst-telescope/neclib
neclib/core/data_type/value_range.py
.py
f5a26fb98d8b4534
7.3
3
"""Definition of environment variable names recognized by NECST.""" __all__ = [ "necst_root", "ros2_ws", "domain_id", "record_root", "debug_mode", "log_level", ] import os from dataclasses import dataclass from typing import Optional @dataclass class EnvironmentVariable: name: str ""...
necst-telescope/neclib
neclib/core/environ.py
.py
5edd24004b151be0
7.3
3
import logging import time from typing import Dict, Optional, Union from .. import environ class ColorizeLevelNameFormatter(logging.Formatter): """Colorize severity level name. See `logging docs <https://docs.python.org/3/library/logging.html#handler-objects>`_ for the usage. """ ColorPrefix: ...
necst-telescope/neclib
neclib/core/inform/console_logger.py
.py
4b5f54eac49cb2c0
7.3
3
#!/usr/bin/env python3 import warnings warnings.filterwarnings("ignore", message="Core Pydantic V1 functionality") """ Content Builder Agent A content writer agent configured entirely through files on disk: - AGENTS.md defines brand voice and style guide - skills/ provides specialized workflows (blog posts, social me...
GamerBoiyzz/deepagents
examples/content-builder-agent/content_writer.py
.py
81f6cad8a73d03e6
7.15
1
"""Research Tools. This module provides search and content processing utilities for the research agent, using Tavily for URL discovery and fetching full webpage content. """ import httpx from langchain_core.tools import InjectedToolArg, tool from markdownify import markdownify from tavily import TavilyClient from typ...
GamerBoiyzz/deepagents
examples/deep_research/research_agent/tools.py
.py
04f0e873ac841bca
7.15
1
"""Utility functions for displaying messages and prompts in Jupyter notebooks.""" import json from rich.console import Console from rich.panel import Panel from rich.text import Text console = Console() def format_message_content(message): """Convert message content to displayable string.""" parts = [] ...
GamerBoiyzz/deepagents
examples/deep_research/utils.py
.py
f2364da48eb6e15a
7.15
1
"""Backend configuration: Modal sandbox with skills/memory uploaded on creation.""" from pathlib import Path import modal from langchain_modal import ModalSandbox # --- Sandbox --- # Modal sandbox with NVIDIA RAPIDS image. # Authenticate first: `modal setup` # # Sandbox type (gpu/cpu) is controlled at runtime via co...
GamerBoiyzz/deepagents
examples/nvidia_deep_agent/src/backend.py
.py
44fefa33ec3d6a5a
7.15
1
"""Research Tools. This module provides search and content processing utilities for the research agent, using Tavily for URL discovery and fetching full webpage content. """ import httpx from langchain_core.tools import InjectedToolArg, tool from markdownify import markdownify from tavily import TavilyClient from typ...
GamerBoiyzz/deepagents
examples/nvidia_deep_agent/src/tools.py
.py
d64aa0eae634570f
7.15
1
import argparse import os import sys from deepagents import create_deep_agent from deepagents.backends import FilesystemBackend from dotenv import load_dotenv from langchain_anthropic import ChatAnthropic from langchain_community.agent_toolkits import SQLDatabaseToolkit from langchain_community.utilities import SQLDat...
GamerBoiyzz/deepagents
examples/text-to-sql-agent/agent.py
.py
15fc8ea41ef151bf
7.15
1
"""Utility functions for converting ACP content blocks to LangChain formats.""" from __future__ import annotations import shlex from typing import TYPE_CHECKING if TYPE_CHECKING: from acp.schema import ( AudioContentBlock, EmbeddedResourceContentBlock, ImageContentBlock, ResourceC...
GamerBoiyzz/deepagents
libs/acp/deepagents_acp/utils.py
.py
67520e208fcfe602
7.15
1
"""Demo coding agent using ACP.""" import asyncio import os from acp import ( run_agent as run_acp_agent, ) from acp.schema import ( SessionMode, SessionModeState, ) from deepagents import create_deep_agent from deepagents.backends import CompositeBackend, LocalShellBackend, StateBackend from dotenv impor...
GamerBoiyzz/deepagents
libs/acp/examples/demo_agent.py
.py
731e70e76fddd049
7.15
1
"""Test command type allowlist functionality for execute tool.""" from deepagents import create_deep_agent from langchain_core.messages import AIMessage from langgraph.checkpoint.memory import MemorySaver from deepagents_acp.server import AgentServerACP from deepagents_acp.utils import extract_command_types from test...
GamerBoiyzz/deepagents
libs/acp/tests/test_command_allowlist.py
.py
69de5d2df675d2fa
7.65
1
"""Lightweight types for the ask-user interrupt protocol. Extracted from `ask_user` so `textual_adapter` can import `AskUserRequest` at module level — and `app` can reference the types at type-check time — without pulling in the langchain middleware stack. """ from __future__ import annotations from typing import An...
GamerBoiyzz/deepagents
libs/cli/deepagents_cli/_ask_user_types.py
.py
9b54fa2ac576cb76
7.15
1
"""Lightweight session statistics and token formatting utilities. This module is intentionally kept free of heavy dependencies (no pydantic, no config, no widget imports) so that `app.py` can import `SessionStats` and `format_token_count` at module level without pulling in the full `textual_adapter` dependency tree. "...
GamerBoiyzz/deepagents
libs/cli/deepagents_cli/_session_stats.py
.py
c9f1c39c051456eb
7.15
1
"""Internal chat models used by local integration tests.""" from __future__ import annotations from typing import TYPE_CHECKING, Any from langchain_core.language_models.fake_chat_models import GenericFakeChatModel from langchain_core.messages import AIMessage, BaseMessage from langchain_core.outputs import ChatGener...
GamerBoiyzz/deepagents
libs/cli/deepagents_cli/_testing_models.py
.py
fee169bdd0a0b112
7.65
1
"""Ask user middleware for interactive question-answering during agent execution.""" from __future__ import annotations import logging from typing import TYPE_CHECKING, Annotated, Any, cast if TYPE_CHECKING: from collections.abc import Awaitable, Callable from langchain.agents.middleware.types import ( Age...
GamerBoiyzz/deepagents
libs/cli/deepagents_cli/ask_user.py
.py
1319ead013ac5f4e
7.15
1
#!/usr/bin/env python3 """Skill Initializer - Creates a new skill from template. Usage: init_skill.py <skill-name> --path <path> Examples: init_skill.py my-new-skill --path skills/public init_skill.py my-api-helper --path skills/private init_skill.py custom-skill --path /custom/location For deepagents CLI: init...
GamerBoiyzz/deepagents
libs/cli/deepagents_cli/built_in_skills/skill-creator/scripts/init_skill.py
.py
ed359e9a665db766
7.15
1
"""Clipboard utilities for deepagents-cli.""" from __future__ import annotations import base64 import logging import os import pathlib from typing import TYPE_CHECKING from deepagents_cli.config import get_glyphs logger = logging.getLogger(__name__) if TYPE_CHECKING: from textual.app import App _PREVIEW_MAX_L...
GamerBoiyzz/deepagents
libs/cli/deepagents_cli/clipboard.py
.py
65b23bfb1a12cd9c
7.15
1
"""CLI middleware for runtime model selection via LangGraph runtime context. Allows switching the model per invocation by passing a `CLIContext` via `context=` on `agent.astream()` / `agent.invoke()` without recompiling the graph. """ from __future__ import annotations import logging from typing import TYPE_CHECKING...
GamerBoiyzz/deepagents
libs/cli/deepagents_cli/configurable_model.py
.py
35970839d6266eed
7.15
1
"""External editor support for composing prompts.""" from __future__ import annotations import contextlib import logging import os import shlex import subprocess # noqa: S404 import sys import tempfile from pathlib import Path logger = logging.getLogger(__name__) GUI_WAIT_FLAG: dict[str, str] = { "code": "--wa...
GamerBoiyzz/deepagents
libs/cli/deepagents_cli/editor.py
.py
d1883368957b3297
7.15
1
"""Helpers for tracking file operations and computing diffs for CLI display.""" from __future__ import annotations import difflib import logging from dataclasses import dataclass, field from pathlib import Path from typing import TYPE_CHECKING, Any, Literal logger = logging.getLogger(__name__) if TYPE_CHECKING: ...
GamerBoiyzz/deepagents
libs/cli/deepagents_cli/file_ops.py
.py
d4a3ea238f5c2fe5
7.15
1
__all__ = ["Authorizer"] from typing import Optional import uuid import rclpy from necst_msgs.srv import AuthoritySrv from rclpy.callback_groups import MutuallyExclusiveCallbackGroup, ReentrantCallbackGroup from rclpy.executors import SingleThreadedExecutor from rclpy.exceptions import InvalidHandle from rclpy.node i...
necst-telescope/necst
necst/core/auth/authorizer.py
.py
97d05badb16c407d
7.35
4
__all__ = ["PrivilegedNode", "require_privilege"] import functools import uuid from typing import Any, Callable, List, Optional import rclpy from neclib import NECSTTimeoutError from necst_msgs.srv import AuthoritySrv from rclpy.callback_groups import ReentrantCallbackGroup from rclpy.client import Client from rclpy....
necst-telescope/necst
necst/core/auth/privileged_node.py
.py
192920542f864825
7.35
4
from rclpy.node import Node class DeviceNode(Node): """Device handling node, which knows procedures required to control devices.""" def create_safe_timer(self, period, callback): def safe_callback(): try: callback() except Exception as e: self.g...
necst-telescope/necst
necst/core/device_node.py
.py
00457555cc3cee23
7.35
4
"""Agents API for Executive Order 10-agent configuration.""" import json import logging from pathlib import Path from fastapi import APIRouter, HTTPException log = logging.getLogger("directive.api.agents") router = APIRouter() ROOT = Path(__file__).resolve().parents[4] AGENT_CONFIG_PATH = ROOT / "data" / "agent_con...
rejaulkarim0212/directive
directive/backend/app/api/agents.py
.py
2ded1cc65593ee36
7
0
"""Tasks API — 任务的 CRUD 和状态流转。""" import uuid import logging from datetime import datetime from fastapi import APIRouter, Depends, HTTPException, Query from pydantic import BaseModel, Field from sqlalchemy.ext.asyncio import AsyncSession from ..db import get_db from ..models.task import TaskState from ..services.eve...
rejaulkarim0212/directive
directive/backend/app/api/tasks.py
.py
d97ba9c55ec1bd84
7
0
"""Directive 配置管理 — 从环境变量加载所有配置。""" from pydantic_settings import BaseSettings from functools import lru_cache class Settings(BaseSettings): # ── Postgres ── postgres_host: str = "localhost" postgres_port: int = 5432 postgres_db: str = "directive" postgres_user: str = "directive" postgres_pas...
rejaulkarim0212/directive
directive/backend/app/config.py
.py
60be489b6bd941ad
7
0
"""SQLAlchemy async 引擎与 session 管理。""" from sqlalchemy.ext.asyncio import ( AsyncSession, async_sessionmaker, create_async_engine, ) from sqlalchemy.orm import DeclarativeBase from .config import get_settings settings = get_settings() engine = create_async_engine( settings.database_url, echo=set...
rejaulkarim0212/directive
directive/backend/app/db.py
.py
d2fb7d77925c841c
7
0
"""Event 模型 — 事件持久化表,支持回放和审计。 每个事件对应一次系统行为:任务创建、状态变更、Agent 思考、Todo 更新等。 遵循 Directive Architecture §3 事件结构规范。 """ import uuid from datetime import datetime, timezone from sqlalchemy import Column, DateTime, Index, String, Text from sqlalchemy.dialects.postgresql import JSONB, UUID from ..db import Base class Event...
rejaulkarim0212/directive
directive/backend/app/models/event.py
.py
d79d801c52096344
7
0
"""Thought 模型 — Agent 思考流持久化。 遵循 Directive Architecture §4 Thought JSON Schema。 支持 streaming partial thoughts 和 dashboard 实时展示。 """ import uuid from datetime import datetime, timezone from sqlalchemy import Column, DateTime, Float, Index, Integer, String, Text, Boolean from sqlalchemy.dialects.postgresql import UUID...
rejaulkarim0212/directive
directive/backend/app/models/thought.py
.py
4df05421cd81b8b5
7
0
"""Redis Streams 事件总线 — 可靠的事件发布/消费。 核心能力: - publish: XADD 发布事件到 stream - subscribe: XREADGROUP 消费者组消费,带 ACK 保证 - 未 ACK 的事件在消费者崩溃后会被自动重新投递 - 解决旧架构 daemon 线程丢失导致派发永久中断的根因 """ import json import logging import uuid from datetime import datetime, timezone from typing import Any import redis.asyncio as aioredis from ..c...
rejaulkarim0212/directive
directive/backend/app/services/event_bus.py
.py
35a809c1bdada47c
7
0
"""Dispatch Worker — 消费 task.dispatch 事件,执行 OpenClaw agent 调用。 核心解决旧架构痛点: - 旧: daemon 线程 + subprocess.run → kill -9 丢失一切 - 新: Redis Streams ACK 保证 → 崩溃后自动重新投递 流程: 1. 从 task.dispatch stream 消费事件 2. 调用 OpenClaw CLI: `openclaw agent --agent xxx -m "..."` 3. 解析 agent 输出(kanban_update.py 调用结果) 4. ACK 事件 """ import asynci...
rejaulkarim0212/directive
directive/backend/app/workers/dispatch_worker.py
.py
7e26c06a019d689f
7
0
"""Orchestrator Worker — 消费事件总线,驱动任务状态机。 监听 topic: - task.created → 自动派发给 Chief of Staff / NSC - task.status → 根据新状态自动派发到下一个 agent - task.status → 处理各种状态变更 - task.stalled → 处理停滞任务 这是系统的核心编排器,取代旧架构中 daemon 线程 + 定时扫描的角色。 得益于 Redis Streams ACK 机制:即使 worker 崩溃,未 ACK 的事件 会被其他消费者自动认领,永不丢失。 """ import asyncio import loggin...
rejaulkarim0212/directive
directive/backend/app/workers/orchestrator_worker.py
.py
7330ef0366a9684d
7
0
#!/usr/bin/env python3 """ Directive US backend launcher. This backend reuses the project-level dashboard API server so the new `directive/frontend` can run immediately with the same endpoints. """ from __future__ import annotations import runpy import shutil from pathlib import Path def _bootstrap_data(root: Path...
rejaulkarim0212/directive
directive/backend/server.py
.py
ef2748a797013394
7
0
"""Alembic env.py — 支持 async Postgres。""" import asyncio from logging.config import fileConfig from sqlalchemy import pool from sqlalchemy.engine import Connection from sqlalchemy.ext.asyncio import async_engine_from_config from alembic import context # Alembic Config config = context.config if config.config_file_...
rejaulkarim0212/directive
directive/migration/env.py
.py
374cc68de6104ad9
7
0
#!/usr/bin/env python3 """JSON → Postgres 数据迁移脚本。 读取旧版 data/tasks_source.json,导入到 Edict Postgres 数据库。 用法: # 确保 Postgres 已运行且 schema 已创建(alembic upgrade head) python3 migrate_json_to_pg.py # 指定数据文件 python3 migrate_json_to_pg.py --file /path/to/tasks_source.json # Dry run(只分析不写入) python3 migrate_json_to_p...
rejaulkarim0212/directive
directive/migration/migrate_json_to_pg.py
.py
d67b4a06aff96950
7
0
"""Agentic security demo — full 3-gate AgentGuard pattern. Shows how to protect an agent loop with three security gates: Gate 1 (Input): Scan user messages before the agent processes them Gate 2 (Data): Scan tool results for indirect injection before feeding to LLM Gate 3 (Output): Inject canary token + ch...
ShaggyT0701/prompt-shield
examples/agentic_demo/app.py
.py
ef3361f15751e420
7.15
1
"""Mock MCP server wrapped with PromptShieldMCPFilter. Shows how to protect an MCP tool server so that tool arguments and results are automatically scanned for prompt injection before reaching the agent. """ import asyncio from typing import Any from prompt_shield import PromptShieldEngine from prompt_shield.integra...
ShaggyT0701/prompt-shield
examples/agentic_demo/mcp_server.py
.py
1f5fd896600eec50
7.15
1
"""Example custom detector: detects 'please hack' patterns. Shows how to implement the BaseDetector interface and register the detector with the engine at runtime. """ import regex from prompt_shield.detectors.base import BaseDetector from prompt_shield.models import DetectionResult, MatchDetail, Severity class Pl...
ShaggyT0701/prompt-shield
examples/custom_detector/my_detector.py
.py
27ba0a43f8f53654
7.15
1
"""FastAPI demo with PromptShieldMiddleware scanning incoming requests.""" from fastapi import FastAPI from pydantic import BaseModel from prompt_shield.integrations.fastapi_middleware import PromptShieldMiddleware app = FastAPI(title="prompt-shield FastAPI Demo") # Add middleware — every POST/PUT/PATCH body is sca...
ShaggyT0701/prompt-shield
examples/fastapi_demo/app.py
.py
f3f1d0d10f9e18fe
7.15
1
"""Dataset loading for prompt-shield benchmarks.""" from __future__ import annotations import csv import json from pathlib import Path from typing import NamedTuple from prompt_shield.exceptions import BenchmarkError class BenchmarkSample(NamedTuple): """A single benchmark sample.""" text: str is_inje...
ShaggyT0701/prompt-shield
src/prompt_shield/benchmarks/datasets.py
.py
29719788f26a8a8d
7.15
1
"""ML metrics computation for prompt injection benchmarks.""" from __future__ import annotations from pydantic import BaseModel, Field class BenchmarkMetrics(BaseModel): """Classification metrics for a benchmark run.""" true_positives: int = 0 true_negatives: int = 0 false_positives: int = 0 fa...
ShaggyT0701/prompt-shield
src/prompt_shield/benchmarks/metrics.py
.py
9eed5b2df220bc81
7.15
1
"""OWASP LLM Top 10 compliance mapping for prompt-shield detectors.""" from __future__ import annotations from pydantic import BaseModel class OwaspCategory(BaseModel): """An OWASP LLM Top 10 category.""" id: str name: str description: str url: str class CategoryCoverage(BaseModel): """Co...
ShaggyT0701/prompt-shield
src/prompt_shield/compliance/owasp_mapping.py
.py
d8e66f67e8421002
7.15
1
"""Configuration loader for prompt-shield (YAML + env vars + defaults).""" from __future__ import annotations import os from pathlib import Path from typing import TYPE_CHECKING, Any import yaml from prompt_shield.exceptions import ConfigError if TYPE_CHECKING: from prompt_shield.models import Severity _DEFAU...
ShaggyT0701/prompt-shield
src/prompt_shield/config/__init__.py
.py
f7d24bbd607a4807
7.15
1