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
"""LinkedIn page access — everything that knows the site's DOM lives here. Phase A harvests cards from URL-driven search pages (keywords, f_TPR time filter, and start= pagination are all query params — no typing or clicking). Phase B extracts raw section text from /jobs/view/{job_id}/. Both anchor on LinkedIn's stable...
ryq99/linkedin-jobs-scraper
job_scraper/src/crawler.py
.py
0ba72aefbb88a636
7.39
5
"""Export sinks: S3 CSV snapshot (full schema, private) + HF split (public fields). Contracts: S3 {S3_PREFIX}/linkedin-scrape_{ts}.csv; HF one split per run (dashes → underscores), dataset card synced from hf_dataset_readme.md. """ import logging import boto3 import pandas as pd import config from schemas import PR...
ryq99/linkedin-jobs-scraper
job_scraper/src/export.py
.py
8f8e18458b8b7015
7.39
5
"""Entrypoint: python src/main.py {login|scrape|export|stats}""" import argparse import logging import random import subprocess import sys import time from datetime import datetime, timezone import browser import config import crawler import export import parsers import store import watchdog from schemas import Job ...
ryq99/linkedin-jobs-scraper
job_scraper/src/main.py
.py
072ec24a1a59e06f
7.39
5
"""SQLite persistence — the scraper's cross-run memory: incremental scraping (skip seen jobs), first/last-seen tracking, crash resumability.""" import sqlite3 import typing from dataclasses import asdict, fields from pathlib import Path import pandas as pd from schemas import JOB_FIELDS, Job _DATA_COLS = [f for f i...
ryq99/linkedin-jobs-scraper
job_scraper/src/store.py
.py
30f75ad0c207a4f3
7.39
5
"""Wall-clock guards so a wedged browser can never hang the whole run. Playwright's own timeouts are enforced *by the node driver*; if that driver's pipe wedges (browser crash / OOM), a sync call like `page.evaluate` — which has no timeout at all — blocks forever at 0% CPU. That is the failure that froze a run at 100/...
ryq99/linkedin-jobs-scraper
job_scraper/src/watchdog.py
.py
0ee7738eea9258e4
7.39
5
"""The watchdog is the guarantee that a wedged browser can't hang the run, so its two failure modes are worth pinning down: a per-op cap that fires even inside a blocked syscall, and a whole-run deadline.""" import socket import time import pytest from watchdog import Deadline, OperationTimeout, RunAborted, time_lim...
ryq99/linkedin-jobs-scraper
job_scraper/tests/test_watchdog.py
.py
ce5c728b38b18421
7.89
5
import click from aiida.engine import run, submit from aiida.manage.configuration import load_profile from aiida.orm import Bool, Float, Int, QueryBuilder, Str, load_node from aiida.plugins import DataFactory, WorkflowFactory from aiida_phonoxpy.common.utils import ( phonopy_atoms_from_structure, phonopy_atoms_...
atztogo/aiida-phonoxpy
examples/launch_iterHA_SrTiO3.py
.py
aa24884792ac7da5
7.39
5
"""CalcJob to run phonopy at a remote host.""" import lzma from aiida.orm import BandsData, Dict, SinglefileData, Str, XyData from aiida_phonoxpy.calculations.base import BasePhonopyCalculation from aiida_phonoxpy.utils.utils import get_phonopy_instance class PhonopyCalculation(BasePhonopyCalculation): """Phon...
atztogo/aiida-phonoxpy
src/aiida_phonoxpy/calculations/phonopy.py
.py
c24d5e9d94304ace
7.39
5
"""Collection of functions to generate phonopy/phono3py files.""" from phonopy.file_IO import ( get_BORN_lines, get_FORCE_CONSTANTS_lines, get_FORCE_SETS_lines, ) from phonopy.structure.dataset import forces_in_dataset from aiida_phonoxpy.utils.utils import phonopy_atoms_from_structure def get_BORN_txt(...
atztogo/aiida-phonoxpy
src/aiida_phonoxpy/common/file_generators.py
.py
7cc33051b60497dd
7.39
5
"""File parsers.""" import h5py import yaml try: from yaml import CLoader as Loader except ImportError: from yaml import Loader import numpy as np from aiida.plugins import DataFactory from aiida_phonoxpy.utils.utils import ( get_bands, get_projected_dos, get_thermal_properties, get_total_dos...
atztogo/aiida-phonoxpy
src/aiida_phonoxpy/common/raw_parsers.py
.py
e09f8d0a8abaf11d
7.39
5
"""Parsers of phonopy output files.""" from aiida.common.exceptions import NotExistent from aiida.engine import ExitCode from aiida.orm import SinglefileData, Str from aiida.parsers.parser import Parser from aiida.plugins import CalculationFactory from aiida_phonoxpy.common.raw_parsers import ( parse_band_structu...
atztogo/aiida-phonoxpy
src/aiida_phonoxpy/parsers/phonopy.py
.py
24b348433f0fffd8
7.39
5
"""BasePhonopyWorkChain.""" from aiida.engine import WorkChain from aiida.orm import AbstractCode, ArrayData, Bool, Dict, Float, Str, StructureData from aiida_phonoxpy.utils.utils import collect_forces_and_energies, get_force_sets from aiida_phonoxpy.workflows.forces import ForcesWorkChain from aiida_phonoxpy.workflo...
atztogo/aiida-phonoxpy
src/aiida_phonoxpy/workflows/base.py
.py
09fc426a26d45f74
7.39
5
"""Workflow to calculate supercell forces.""" import numpy as np from aiida.engine import WorkChain, calcfunction, if_ from aiida.orm import ArrayData, Float, StructureData from aiida.plugins import WorkflowFactory from aiida_phonoxpy.common.builders import ( get_calculator_process, get_import_workchain_input...
atztogo/aiida-phonoxpy
src/aiida_phonoxpy/workflows/forces.py
.py
0548fa911a18a5ea
7.39
5
"""WorkChain mix-in's.""" from aiida.orm import Int, load_code from aiida_phonoxpy.calculations.phono3py import Phono3pyCalculation class RunPhono3pyMixIn: """Mix-in to run Phono3pyCalculation.""" def _run_phono3py(self, calc_type="fc"): """Run phonopy at remote computer.""" self.report("re...
atztogo/aiida-phonoxpy
src/aiida_phonoxpy/workflows/mixin.py
.py
2d2a4e0e0d9ca5a8
7.39
5
"""Workflow to calculate NAC params.""" from aiida.engine import WorkChain, append_, calcfunction, if_, while_ from aiida.orm import ArrayData, Float, StructureData from aiida.plugins import WorkflowFactory from phonopy.structure.symmetry import symmetrize_borns_and_epsilon from aiida_phonoxpy.common.builders import ...
atztogo/aiida-phonoxpy
src/aiida_phonoxpy/workflows/nac_params.py
.py
3af7f02b1c242ee0
7.39
5
"""WorkChan to run ph-ph calculation by phono3py and force calculators.""" from aiida.engine import if_, while_ from aiida.orm import ArrayData, Bool, Dict, Float, SinglefileData, StructureData from aiida_phonoxpy.utils.utils import setup_phono3py_calculation from aiida_phonoxpy.workflows.base import BasePhonopyWorkC...
atztogo/aiida-phonoxpy
src/aiida_phonoxpy/workflows/phono3py.py
.py
dcdb29e348d7b957
7.39
5
"""WorkChan to calculate force constants by phono3py.""" from aiida.engine import WorkChain from aiida.orm import AbstractCode, ArrayData, Dict, Float, StructureData from aiida.orm.nodes.data.singlefile import SinglefileData from aiida_phonoxpy.utils.utils import setup_phono3py_fc_calculation from aiida_phonoxpy.work...
atztogo/aiida-phonoxpy
src/aiida_phonoxpy/workflows/phono3py_fc.py
.py
390eef6b7a9b9a2a
7.39
5
"""WorkChan to calculate lattice thermal conductivity by phono3py.""" from aiida.engine import WorkChain from aiida.orm import AbstractCode, ArrayData, Dict, Float, StructureData from aiida.orm.nodes.data.singlefile import SinglefileData from aiida_phonoxpy.utils.utils import setup_phono3py_ltc_calculation from aiida...
atztogo/aiida-phonoxpy
src/aiida_phonoxpy/workflows/phono3py_ltc.py
.py
dc5b00e804305472
7.39
5
"""PhonopyWorkChain.""" from aiida.engine import if_, while_ from aiida.orm import ArrayData, BandsData, Bool, SinglefileData, XyData, load_code from aiida_phonoxpy.utils.utils import ( get_force_constants, get_phonon_properties, setup_phonopy_calculation, ) from aiida_phonoxpy.workflows.base import BaseP...
atztogo/aiida-phonoxpy
src/aiida_phonoxpy/workflows/phonopy.py
.py
cfe9fa7b2059f5f2
7.39
5
"""Test phonopy parser.""" from phonopy.structure.cells import isclose from aiida_phonoxpy.utils.utils import ( compare_structures, phonopy_atoms_from_structure, phonopy_atoms_to_structure, ) def test_phonopy_atoms_from_to_structure(ph_nacl): """Test phonopy_atoms_to/from_structure.""" cell = ph...
atztogo/aiida-phonoxpy
tests/utils/test_utils.py
.py
bce6b1be9a97ea38
7.89
5
"""Pytest fixtures for workflows.""" import numpy as np import pytest @pytest.fixture def generate_workchain( mock_forces_run_calculation, mock_nac_params_run_calculation, mock_run_phono3py_fc, mock_run_phono3py_ltc, mock_run_phono3py_fc_ltc, ): """Generate an instance of a `WorkChain`. ...
atztogo/aiida-phonoxpy
tests/workflows/conftest.py
.py
c7ca44b01d560cdb
7.89
5
import logging import os from fastapi import FastAPI, Form from starlette.responses import RedirectResponse, Response from starlette_exporter import PrometheusMiddleware, handle_metrics from . import __version__ from .database import DataBase def define_logger(): """Define logger to output to the file and to ST...
canonical/api_demo_server
src/api_demo_server/app.py
.py
a8e3e785b0b801c5
7.3
3
import logging import os import psycopg2 from psycopg2 import sql from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT from psycopg2.extensions import connection as PGConnection # set logger to be configurable from external logger = logging.getLogger("api-demo-server") DB_HOST = os.environ.get("DEMO_SERVER_DB_...
canonical/api_demo_server
src/api_demo_server/database.py
.py
b4af405d199588ec
7.3
3
import re import subprocess from functools import lru_cache from pathlib import Path import rich @lru_cache def download_regmem(): """ Download all regme.xml files of format regmem2022-05-03.xml of 2021 or later to data/raw. """ rich.print("[blue]Downloading regmem files[/blue]") cmd = "rsync -az...
mysociety/parl_register_interests
src/parl_register_interests/download.py
.py
0a344cc3aa1ac230
7.24
2
from datetime import date as date from datetime import datetime from pathlib import Path from typing import TypedDict import pandas as pd from mysoc_validator import Popolo from mysoc_validator.models.popolo import Chamber, IdentifierScheme import os import zipfile import httpx RAW_DATA = Path("data", "raw", "externa...
mysociety/parl_register_interests
src/parl_register_interests/official_data.py
.py
dac51b0046e93a97
7.24
2
import re import string import xml.etree.ElementTree as ET from pathlib import Path import pandas as pd import rich from data_common.db import duck_query from tqdm import tqdm def is_mp_name_line(line: str) -> bool: return ( len(line) > 0 and line.strip().endswith(")") and len([x for x in...
mysociety/parl_register_interests
src/parl_register_interests/validate.py
.py
af5cfbda21d71b11
7.24
2
import logging import re import zipfile from os.path import commonpath from pathlib import Path from sagemaker_shim.exceptions import UserSafeError from sagemaker_shim.vendor.werkzeug.security import safe_join logger = logging.getLogger(__name__) def _filter_members(members: list[zipfile.ZipInfo]) -> list[dict[str,...
DIAGNijmegen/rse-sagemaker-shim
sagemaker_shim/extract.py
.py
db3a475fc2b587f8
7.15
1
import json import logging import os from typing import Any logger = logging.getLogger(__name__) STDOUT_LEVEL = logging.INFO class JSONFormatter(logging.Formatter): def format(self, record: logging.LogRecord) -> str: """ Create a structured log message CloudWatch does not separate log s...
DIAGNijmegen/rse-sagemaker-shim
sagemaker_shim/logging.py
.py
d868676125b7e039
7.15
1
import os import json import logging import oracledb import pandas as pd from time import time from google.cloud import secretmanager def set_db_secrets(secret_name: str): """Setter secrets fra GSM som miljøvariabler, for å kunne kjøre connect_to_oracle(). Hvis DB_USER og DB_PASSWORD er satt allerede for loka...
navikt/pensjon-data-analyse
libs/utils/pesys_utils.py
.py
5594ce8bc6744a37
7.15
1
import os from ayon_core.addon import AYONAddon, IHostAddon from .version import __version__ PHOTOSHOP_ADDON_ROOT = os.path.dirname(os.path.abspath(__file__)) class PhotoshopAddon(AYONAddon, IHostAddon): name = "photoshop" version = __version__ host_name = "photoshop" def add_implementation_envs(se...
ynput/ayon-photoshop
client/ayon_photoshop/addon.py
.py
71f2e0bed084750b
7.35
4
import asyncio import collections import os from pathlib import Path import platform import subprocess from wsrpc_aiohttp import ( WebSocketRoute, WebSocketAsync ) import ayon_api from qtpy import QtCore from ayon_core.lib import Logger from ayon_core.lib.events import emit_event, register_event_callback fro...
ynput/ayon-photoshop
client/ayon_photoshop/api/launch_logic.py
.py
463557ec6054f747
7.35
4
"""Script wraps launch mechanism of Photoshop implementations. Arguments passed to the script are passed to launch function in host implementation. In all cases requires host app executable and may contain workfile or others. """ import os import sys from ayon_photoshop.api.lib import main as host_main # Get curren...
ynput/ayon-photoshop
client/ayon_photoshop/api/launch_script.py
.py
b56e5300110293b8
7.35
4
import os import sys import contextlib import traceback import functools import pyblish from ayon_core.lib import env_value_to_bool, Logger, is_in_tests from ayon_core.addon import AddonsManager from ayon_core.pipeline import install_host from ayon_core.tools.utils import host_tools from ayon_core.tools.utils import g...
ynput/ayon-photoshop
client/ayon_photoshop/api/lib.py
.py
0382d84fa39fe66b
7.35
4
import re from ayon_core.pipeline import LoaderPlugin from .launch_logic import stub def get_unique_layer_name(layers, container_name, product_name): """Prepare unique layer name. Gets all layer names and if '<container_name>_<product_name>' is present, it adds suffix '1', or increases the suffix by 1. ...
ynput/ayon-photoshop
client/ayon_photoshop/api/plugin.py
.py
dcba6b03955cb282
7.35
4
"""Webserver for communication with photoshop. Aiohttp (Asyncio) based websocket server used for communication with host application. This webserver is started in spawned Python process that opens DCC during its launch, waits for connection from DCC and handles communication going forward. Server is closed before Pyt...
ynput/ayon-photoshop
client/ayon_photoshop/api/webserver.py
.py
ee6c1a8ca3dc2a81
7.35
4
import os import platform import subprocess from ayon_core.lib import ( get_ayon_launcher_args, is_using_ayon_console, ) from ayon_applications import PreLaunchHook, LaunchTypes from ayon_photoshop import get_launch_script_path def get_launch_kwargs(kwargs): """Explicit setting of kwargs for Popen for Ph...
ynput/ayon-photoshop
client/ayon_photoshop/hooks/pre_launch_args.py
.py
9ef1c14b1b51bb14
7.35
4
from pathlib import Path from zipfile import ZipFile import xml.etree.ElementTree as ET from shutil import rmtree import platformdirs from ayon_photoshop import PHOTOSHOP_ADDON_ROOT from ayon_applications import PreLaunchHook, LaunchTypes class InstallAyonExtensionToPhotoshop(PreLaunchHook): """ Automatical...
ynput/ayon-photoshop
client/ayon_photoshop/hooks/pre_launch_install_ayon_extension.py
.py
3cf4b51c7ee9cc29
7.35
4
from ayon_photoshop.lib import PSAutoCreator class ReviewCreator(PSAutoCreator): """Creates review instance which might be disabled from publishing.""" identifier = "review" product_base_type = "review" product_type = product_base_type default_variant = "Main" def get_detail_description(self)...
ynput/ayon-photoshop
client/ayon_photoshop/plugins/create/create_review.py
.py
a32728aeda23f206
7.35
4
import os from ayon_core.lib import EnumDef from ayon_photoshop import api as photoshop from ayon_photoshop.api import get_unique_layer_name class ImageFromSequenceLoader(photoshop.PhotoshopLoader): """ Load specific image from sequence Used only as quick load of reference file from a sequence. ...
ynput/ayon-photoshop
client/ayon_photoshop/plugins/load/load_image_from_sequence.py
.py
2905b67e6d56f32f
7.35
4
# -*- coding: utf-8 -*- """Close PS after publish. For Webpublishing only.""" import pyblish.api from ayon_photoshop import api as photoshop class ClosePS(pyblish.api.ContextPlugin): """Close PS after publish. For Webpublishing only. """ order = pyblish.api.IntegratorOrder + 14 label = "Close PS" ...
ynput/ayon-photoshop
client/ayon_photoshop/plugins/publish/closePS.py
.py
da82be6abe463474
7.35
4
import pyblish.api from ayon_photoshop import api as photoshop from ayon_core.pipeline.create import get_product_name class CollectAutoImage(pyblish.api.ContextPlugin): """Creates auto image in non artist based publishes (Webpublisher). """ label = "Collect Auto Image" hosts = ["photoshop"] ord...
ynput/ayon-photoshop
client/ayon_photoshop/plugins/publish/collect_auto_image.py
.py
37a4defcd5e58101
7.35
4
import pyblish.api from ayon_photoshop import api as photoshop class CollectAutoImageRefresh(pyblish.api.ContextPlugin): """Refreshes auto_image instance with currently visible layers.. """ label = "Collect Auto Image Refresh" hosts = ["photoshop"] order = pyblish.api.CollectorOrder - 0.4 d...
ynput/ayon-photoshop
client/ayon_photoshop/plugins/publish/collect_auto_image_refresh.py
.py
0f58e1f570f8febd
7.35
4
""" Requires: None Provides: instance -> productBaseType ("review") """ import pyblish.api from ayon_photoshop import api as photoshop from ayon_core.pipeline.create import get_product_name class CollectAutoReview(pyblish.api.ContextPlugin): """Create review instance in non artist based workflow. ...
ynput/ayon-photoshop
client/ayon_photoshop/plugins/publish/collect_auto_review.py
.py
ac859ef6e77b8bc1
7.35
4
"""Parses batch context from json and continues in publish process. Provides: context -> Loaded batch file. - folderPath - task (task name) - taskType - project_name - variant Code is practically copy of `openype/hosts/webpublish/collect_batch_data` as webpublisher should ...
ynput/ayon-photoshop
client/ayon_photoshop/plugins/publish/collect_batch_data.py
.py
4fff0a1bc572fb91
7.35
4
import os import re import pyblish.api from ayon_core.lib import prepare_template_data, is_in_tests from ayon_photoshop import api as photoshop class CollectColorCodedInstances(pyblish.api.ContextPlugin): """Creates instances for layers marked by configurable color. Used in remote publishing when artists m...
ynput/ayon-photoshop
client/ayon_photoshop/plugins/publish/collect_color_coded_instances.py
.py
636df75eb7abc6d2
7.35
4
import pyblish.api from ayon_core.pipeline import registered_host class CollectCurrentFile(pyblish.api.ContextPlugin): """Inject the current working file into context""" order = pyblish.api.CollectorOrder - 0.5 label = "Current File" hosts = ["photoshop"] def process(self, context): hos...
ynput/ayon-photoshop
client/ayon_photoshop/plugins/publish/collect_current_file.py
.py
1dffb69fa2fd8747
7.35
4
import os import re import pyblish.api from ayon_photoshop import api, PHOTOSHOP_ADDON_ROOT from ayon_core.pipeline import PublishError class CollectExtensionVersion(pyblish.api.ContextPlugin): """ Pulls and compares version of installed extension. It is recommended to use same extension as in provided...
ynput/ayon-photoshop
client/ayon_photoshop/plugins/publish/collect_extension_version.py
.py
687cfa33503ae872
7.35
4
"""Collects published version of workfile and increments it. For synchronization of published image and workfile version it is required to store workfile version from workfile file name in context.data["version"]. In remote publishing this name is unreliable (artist might not follow naming convention etc.), last publi...
ynput/ayon-photoshop
client/ayon_photoshop/plugins/publish/collect_published_version.py
.py
f4ed4357732ecb77
7.35
4
""" Provides: instance -> families ("review") """ import pyblish.api class CollectReview(pyblish.api.ContextPlugin): """Adds review to families for instances marked to be reviewable. """ label = "Collect Review" hosts = ["photoshop"] order = pyblish.api.CollectorOrder - 0.45 setting...
ynput/ayon-photoshop
client/ayon_photoshop/plugins/publish/collect_review.py
.py
3a02407ce02fe850
7.35
4
""" Requires: - (ayon-core) CollectContextEntities context -> frameStart context -> frameEnd context -> fps Provides: instance -> family ("review") """ import pyblish.api class CollectReviewData(pyblish.api.InstancePlugin): """Adds data needed for review.""" label = "Collect Review ...
ynput/ayon-photoshop
client/ayon_photoshop/plugins/publish/collect_review_data.py
.py
2a29a9d995d02e7d
7.35
4
""" Requires: context -> version Provides: instance -> version - incremented latest published workfile version """ import pyblish.api class CollectVersion(pyblish.api.InstancePlugin): """Collect version for publishable instances. Used to synchronize version from workfile to all publishable instance...
ynput/ayon-photoshop
client/ayon_photoshop/plugins/publish/collect_version.py
.py
6af19fd63451cc98
7.35
4
import os import pyblish.api class CollectWorkfile(pyblish.api.InstancePlugin): """Collect current script for publish.""" order = pyblish.api.CollectorOrder - 0.4 label = "Collect Workfile" hosts = ["photoshop"] families = ["workfile"] targets = ["local"] default_variant = "Main" d...
ynput/ayon-photoshop
client/ayon_photoshop/plugins/publish/collect_workfile.py
.py
37b0563a7344774e
7.35
4
import os from typing import TYPE_CHECKING import pyblish.api from ayon_core.pipeline import publish from ayon_core.pipeline.colorspace import get_remapped_colorspace_from_native from ayon_photoshop import api as photoshop if TYPE_CHECKING: from ayon_core.pipeline import CreateContext, CreatedInstance class Extr...
ynput/ayon-photoshop
client/ayon_photoshop/plugins/publish/extract_image.py
.py
48d5f1ae92760f13
7.35
4
import os from pathlib import Path from typing import TYPE_CHECKING from ayon_core.pipeline import publish from ayon_core.pipeline.colorspace import get_remapped_colorspace_from_native from ayon_core.pipeline.publish import get_instance_staging_dir from ayon_photoshop import api as photoshop if TYPE_CHECKING: fro...
ynput/ayon-photoshop
client/ayon_photoshop/plugins/publish/extract_layers.py
.py
f36a844052b14d00
7.35
4
import os from ayon_core.pipeline import publish from ayon_core.pipeline.colorspace import get_remapped_colorspace_from_native from ayon_photoshop import api as photoshop class ExtractSourcesReview( publish.Extractor, publish.ColormanagedPyblishPluginMixin ): """ Produce a flattened or sequence i...
ynput/ayon-photoshop
client/ayon_photoshop/plugins/publish/extract_sources_review.py
.py
91d5ba853b565be6
7.35
4
import os import pyblish.api from ayon_core.host import IWorkfileHost from ayon_core.host.interfaces import SaveWorkfileOptionalData from ayon_core.pipeline import registered_host, OptionalPyblishPluginMixin from ayon_core.pipeline.publish import get_errored_plugins_from_context from ayon_core.pipeline.workfile impor...
ynput/ayon-photoshop
client/ayon_photoshop/plugins/publish/increment_workfile.py
.py
d337e5fef7185866
7.35
4
import pyblish.api from ayon_core.pipeline import get_current_folder_path from ayon_core.pipeline.publish import ( ValidateContentsOrder, PublishXmlValidationError, OptionalPyblishPluginMixin ) from ayon_photoshop import api as photoshop class ValidateInstanceFolderRepair(pyblish.api.Action): """Repa...
ynput/ayon-photoshop
client/ayon_photoshop/plugins/publish/validate_instance_context.py
.py
fbd082ae9d74da9c
7.35
4
#!/usr/bin/env python3 """ Test GitHub repository enumeration fallback functionality. Run with: pytest test_github_enumeration.py -v Requires: GITHUB_TOKEN environment variable to be set """ import os from unittest.mock import Mock, patch import pytest from src.find_datalad_repos.github import GitHubSearcher class ...
datalad/datalad-usage-dashboard
adhoc_tests/test_github_enumeration.py
.py
82476a161b017a79
7.85
4
#!/usr/bin/env python3 """ Test GitHub repository enumeration fallback functionality. Run with: pytest test_github_fallback.py -v Requires: GITHUB_TOKEN environment variable for integration tests """ import os from unittest.mock import Mock, patch import pytest from src.find_datalad_repos.github import GitHubSearcher...
datalad/datalad-usage-dashboard
adhoc_tests/test_github_fallback.py
.py
39f0031e4f185a5a
7.85
4
#!/usr/bin/env python3 """ Test script to demonstrate the OpenNeuroDatasets/ds005357 discovery issue. This script tests: 1. GitHub search API fails to find the repository 2. Direct API access confirms the repository exists 3. The proposed solution would find it via traversal """ import json import subprocess def ru...
datalad/datalad-usage-dashboard
adhoc_tests/test_openneuro_ds005357.py
.py
0f0f8429cb12d2c5
7.85
4
"""GitHub organization configuration management.""" from __future__ import annotations from enum import Enum import json from pathlib import Path from typing import Optional from pydantic import BaseModel, Field, validator from .config import EXCLUSION_THRESHOLD, GITHUB_ORGS_FILE from .util import log class Discovery...
datalad/datalad-usage-dashboard
src/find_datalad_repos/github_orgs.py
.py
95e2479516940c26
7.35
4
from __future__ import annotations from collections import Counter from datetime import datetime, timezone from enum import Enum import json import logging from pathlib import Path import platform import re import shlex import subprocess import sys from typing import Any, Sequence, Union import requests USER_AGENT = "...
datalad/datalad-usage-dashboard
src/find_datalad_repos/util.py
.py
d40aff844e2a0886
7.35
4
import re from datetime import datetime import pytz import requests from bs4 import BeautifulSoup from geojson import Feature, FeatureCollection, Point IMAGE_REGEX = re.compile("aurora_[N|S]_(.*).jpg") def _parse_image_date(s): s = re.findall(IMAGE_REGEX, s)[0] d = datetime.strptime(s, "%Y-%m-%d_%H%M").repl...
palewire/nws-aurora
nws_aurora/__init__.py
.py
781fea5ddba48774
7.24
2
import json import click from nws_aurora import get_forecast, get_grid, get_images, get_latest_image @click.group() def cmd(): """ A command-line interface for downloading forecast data for Aurora Borealis and Aurora Australis from the National Weather Service """ pass @cmd.command(help="Ovatio...
palewire/nws-aurora
nws_aurora/cli.py
.py
216c157f4b627c40
7.24
2
# SPDX-License-Identifier: Apache-2.0 import argparse import os import time from cliff.command import Command from loguru import logger from tabulate import tabulate from osism import utils from osism.data import enums from osism.data.enums import Role def _collect_result(result): """Wait for a background task...
osism/python-osism
osism/commands/apply.py
.py
4442195e9cf50ca4
7.35
4
# SPDX-License-Identifier: Apache-2.0 import argparse from cliff.command import Command from loguru import logger from osism import utils class _PassthroughParser(argparse.ArgumentParser): """Argument parser that forwards unrecognized arguments to Ansible. ``argparse.REMAINDER`` only starts capturing at t...
osism/python-osism
osism/commands/configuration.py
.py
742b1cefc9dc4d15
7.35
4
# SPDX-License-Identifier: Apache-2.0 import json import shlex import socket import subprocess from typing import Optional from cliff.command import Command from loguru import logger from prompt_toolkit import prompt from osism import settings, utils from osism.utils.inventory import get_hosts_from_inventory, get_in...
osism/python-osism
osism/commands/console.py
.py
18bca10bc00e2fc9
7.35
4
# SPDX-License-Identifier: Apache-2.0 from cliff.command import Command from loguru import logger from osism import settings, utils class Lock(Command): """Lock task execution to prevent new tasks from starting""" def get_parser(self, prog_name): parser = super(Lock, self).get_parser(prog_name) ...
osism/python-osism
osism/commands/lock.py
.py
a33715f3af936292
7.35
4
# SPDX-License-Identifier: Apache-2.0 import argparse import subprocess from cliff.command import Command from loguru import logger class _PassthroughParser(argparse.ArgumentParser): """Argument parser for a transparent OpenStack CLI passthrough. ``argparse.REMAINDER`` only starts capturing at the first *p...
osism/python-osism
osism/commands/openstack.py
.py
f1e3015e2ac45999
7.35
4
# SPDX-License-Identifier: Apache-2.0 import json from cliff.command import Command from loguru import logger from tabulate import tabulate from osism import utils class List(Command): def _normalize_column_name(self, column_name): """Normalize column name to lowercase with underscores instead of spaces...
osism/python-osism
osism/commands/redfish.py
.py
e07d61ed84780e47
7.35
4
import requests from bs4 import BeautifulSoup import os from datetime import datetime import schedule import time import logging # Set up logging to track script execution and errors logging.basicConfig( level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s", handlers=[logging.StreamHandler...
francojeferson/top-tools
xkcd_scraper/xkcd_scraper.py
.py
399755e90ce31bf2
7.39
5
""" Drivers for Commander's own dialogs, built on gui_harness. Production builds and execs these dialogs itself, so a test cannot hold one before it opens. Each driver wraps the builder, arms the dialog that comes out, and lets the real code call the real exec() — so the interaction lands inside the real modal loop an...
yellowdog/yellowdog-cli
tests/commander_dialogs.py
.py
92b7864b02d81e50
7.5
0
""" A harness for testing Commander's dialogs as dialogs. Four bugs reached the user in the work this exists to guard: dialog buttons that did nothing, a default button silently stolen by another button, a list collapsed to a scrollbar on Windows, and a lost prefix hierarchy. Every one of them lived in a seam the test...
yellowdog/yellowdog-cli
tests/gui_harness.py
.py
865e931dbce77825
7.5
0
""" Loading the resource specification corpus in-process, without a platform. The CLI's loader reads its file list from ARGS_PARSER, so load_corpus_file sets that rather than passing a path: going through the real entry point is the point, since it brings Jsonnet expansion, variable substitution and dependency re-sequ...
yellowdog/yellowdog-cli
tests/resource_corpus.py
.py
fea19bbf76f8429e
7.5
0
""" CLIParser detects the command from sys.argv[0]. Detection must use the basename only: a command name appearing in the *install path* (e.g. ~/Downloads/tools/) must not register that command's arguments. """ import sys from unittest.mock import patch import pytest from yellowdog_cli.utils.args import CLIParser ...
yellowdog/yellowdog-cli
tests/test_args_command_detection.py
.py
b30d434c7eee834a
7.5
0
""" Unit tests for load_config._build_dc_substitutions """ from yellowdog_cli.utils.load_config import _build_dc_substitutions class TestBuildDcSubstitutions: def test_empty_base(self): assert _build_dc_substitutions({}) == {} def test_base_scalars_only(self): base = {"remote": "r", "bucket"...
yellowdog/yellowdog-cli
tests/test_build_dc_substitutions.py
.py
161e26277cab0c39
7.5
0
""" Tests for optional-import guards in check_imports. """ import builtins import sys import types import pytest from yellowdog_cli.utils.check_imports import ( check_commander_imports, check_jsonnet_import, ) def test_check_commander_imports_raises_when_pyqt6_absent(monkeypatch): # Setting the module ...
yellowdog/yellowdog-cli
tests/test_check_imports.py
.py
b2a336c66837fa25
7.5
0
""" Every main-window button must be connected to the action it claims to perform. Nothing checked this before: test_commander_ui_loads proves the widgets named in commander.ui exist, and the contract tests call the action methods directly. So a button added to the .ui but never connected, or connected to the wrong ac...
yellowdog/yellowdog-cli
tests/test_commander_button_wiring.py
.py
df36e0b64a0ebb2a
7.5
0
""" Enumeration tests for Commander's '-D --json' entity listings: the parse must retain YDIDs so a user's selection can be targeted exactly, and must refuse a listing that lacks them rather than falling back to name-based targeting. """ import pytest import qt_guard qt_guard.require_qt() from yellowdog_cli.commande...
yellowdog/yellowdog-cli
tests/test_commander_entity_summaries.py
.py
e9abb5262f0bd63e
7.5
0
""" Verify the yd-commander console script is registered, and that it exposes a commander-specific command-line interface rather than the shared CLI parser. """ from importlib.metadata import entry_points from cli_test_helpers import shell def test_commander_entrypoint_registered(): scripts = entry_points(group...
yellowdog/yellowdog-cli
tests/test_commander_entrypoint.py
.py
e333dccfd6d45227
7.5
0
""" Tests for how Commander echoes a command into its output window. A run that targets many entities by YDID would otherwise print a wall of identifiers. """ import pytest import qt_guard qt_guard.require_qt() from yellowdog_cli.commander.commander import ( EntitySummary, YellowDogApp, command_line_text...
yellowdog/yellowdog-cli
tests/test_commander_logging.py
.py
d6c82f378266992f
7.5
0
""" Tests for the Commander's namespace / tag / object-path placeholder text. Also guards the repaint strategy: the viewports are updated (scheduled) rather than repainted (forced synchronously), because forcing a text widget to paint from the context these callers run in — straight after _parse_yd_config's nested eve...
yellowdog/yellowdog-cli
tests/test_commander_placeholders.py
.py
2a8e747aa2a5d646
7.5
0
""" Tests for the re-entrancy guard on Commander's enumerating actions. Every one of these actions enumerates in a nested Qt event loop before it acts, and a nested loop keeps the main window interactive — so without a guard a second action could be started while the first was still listing what it would affect. The d...
yellowdog/yellowdog-cli
tests/test_commander_reentrancy.py
.py
a14896f4135df527
7.5
0
""" Smoke tests that the Commander package data (UI file + images) is present and resolvable via the installed package. Guards against a broken package-data declaration. """ from importlib.resources import files def test_commander_ui_resource_exists(): ui = files("yellowdog_cli.commander").joinpath("commander.ui...
yellowdog/yellowdog-cli
tests/test_commander_resources.py
.py
f96686f1d0d6e97a
7.5
0
""" Tests for indicating the selected Work Requirement / Worker Pool definition files on their own 'Select' buttons. The point of showing the selection there is that it costs no extra space in the left-hand column, so these tests also guard against a long filename widening that column. """ import pytest import qt_guar...
yellowdog/yellowdog-cli
tests/test_commander_selection_labels.py
.py
1e4f7f1035d44c68
7.5
0
""" Smoke test that the Commander UI actually loads. Constructing YellowDogApp runs loadUi() against commander.ui and wires every action signal to a named widget, so a successful construction proves the .ui file is compatible with the installed PyQt6 and that no code-referenced widget is missing. Guards against Qt-vers...
yellowdog/yellowdog-cli
tests/test_commander_ui_loads.py
.py
b339e784db202775
7.5
0
""" Unit tests for yellowdog_cli.utils.compact_json """ import json import pytest from yellowdog_cli.utils.compact_json import CompactJSONEncoder def _enc(data, **kwargs) -> str: return json.dumps(data, cls=CompactJSONEncoder, **kwargs) class TestSmallContainers: """ Small containers (few items, shor...
yellowdog/yellowdog-cli
tests/test_compact_json.py
.py
a23710723aa5b498
7.5
0
""" Unit tests for yellowdog_cli.utils.dataclient_utils """ import pytest from yellowdog_cli.utils.config_types import ConfigDataClient from yellowdog_cli.utils.dataclient_utils import resolve_remote_path from yellowdog_cli.utils.variables import VARIABLE_SUBSTITUTIONS class TestResolveRemotePath: def _config( ...
yellowdog/yellowdog-cli
tests/test_dataclient_utils.py
.py
5fbf5b8d71dae8ee
7.5
0
""" Tests that run the standard demos. Use 'pytest --run-demos', otherwise these will be skipped. """ import pytest from cli_test_helpers import shell DEMO_DIR = "../python-examples-demos" # Provision, then submit and follow with '-E' (--exit-on-failure), which exits # non-zero if the WR ends FAILED/CANCELLED, so a ...
yellowdog/yellowdog-cli
tests/test_demos.py
.py
b0e0158898fabc81
7.5
0
""" Flag/guard tests for the dry-run mode on yd-cancel / yd-shutdown / yd-terminate. These exercise argument parsing only (the by-name guard errors at parse time, before any platform contact), so they need no credentials. """ import pytest from cli_test_helpers import shell @pytest.mark.parametrize("cmd", ["yd-cance...
yellowdog/yellowdog-cli
tests/test_dryrun_flags.py
.py
24deb025028a8c3f
7.5
0
import copy import functools import logging from collections.abc import Callable from audit_logger.data import AuditMessage from audit_logger.enums import Status class MissingType: """Sentinel object.""" MISSING = MissingType() def _value_or_missing(val, default=None): """Return the give...
City-of-Helsinki/parking-permits
audit_logger/adapter.py
.py
325bda5c1886b768
7
0
import datetime import enum import json from dataclasses import Field, asdict, dataclass, field, fields, replace from typing import Any from django.db import models from django.utils import timezone from audit_logger import enums from audit_logger.utils import ( generate_model_id_string_from_class, ...
City-of-Helsinki/parking-permits
audit_logger/data.py
.py
550fea69287c873b
7
0
import datetime from django.core.management.base import BaseCommand, CommandError from django.db.models import Q from django.utils import timezone from parking_permits.models.parking_permit import ParkingPermit, ParkingPermitStatus def _range_bounds(start_date, end_date): current_timezone = timezone.get_current...
City-of-Helsinki/parking-permits
parking_permits/management/commands/count_valid_permits_on_date.py
.py
9b67d2a99aff3d26
7
0
# coding: utf-8 import sys import os import json import datetime import fnmatch import time import re def extract_date_from_name(name, date_pattern): """从文件或目录名称中提取日期 :param name: 文件或目录名称 :param date_pattern: 日期匹配模式,如:r'.*_(\d{8}).*' :return: datetime.date对象或None """ if not date_pattern: ...
jianghujs/jh-panel
class/plugin/clean_tool.py
.py
f3a0ae0ace10e7c2
7.35
4
# coding:utf-8 import json import os import time import re import sys import time import struct import fcgi_client FCGI_Header = '!BBHHBx' if sys.version_info[0] == 2: try: from cStringIO import StringIO except: from StringIO import StringIO else: from io import BytesIO as StringIO def...
jianghujs/jh-panel
class/plugin/fpm.py
.py
bc21bf379bd088a7
7.35
4
import time from functools import wraps def retry(max_retry=3, delay=1): """装饰器,用于在函数失败时重试""" def decorator(func): @wraps(func) def wrapper(*args, **kwargs): for i in range(max_retry): try: return func(*args, **kwargs) except Excep...
jianghujs/jh-panel
class/plugin/retry_tool.py
.py
840dd36048e89ec5
7.35
4
import logging from typing import List, Optional import time import re from concurrent.futures import ThreadPoolExecutor, as_completed from publication_utils import Publication, PublicationNormalizer logger = logging.getLogger(__name__) # Try to import scholarly, fall back gracefully if not available try: from sc...
marcoavesani/marcoavesani.github.io
scripts/scholar_wos_fetcher.py
.py
ea695bd36b5d7b00
7
0
#!/usr/bin/env python3 """ Setup script for the academic publication fetcher """ import os import sys import subprocess import yaml from pathlib import Path def check_python_version(): """Check if Python version is compatible""" if sys.version_info < (3, 8): print("❌ Python 3.8 or higher is required")...
marcoavesani/marcoavesani.github.io
scripts/setup.py
.py
b4862e7d87d0a944
7
0
#!/usr/bin/env python3 """ Test script to validate the publication fetcher setup """ import os import sys import json import tempfile from pathlib import Path # Add the scripts directory to the Python path sys.path.append(os.path.dirname(os.path.abspath(__file__))) def test_imports(): """Test that all required m...
marcoavesani/marcoavesani.github.io
scripts/test_fetcher.py
.py
9bfe2780b447b791
7.5
0
"""Parse references and resolve them to URLs (local-sibling preferred).""" from __future__ import annotations import json import logging import re import urllib.parse import urllib.request from dataclasses import dataclass, field from pathlib import Path # Pattern for individual \bibitem blocks (greedy until next \b...
will-rice/tts-papers
scripts/_convert/citations.py
.py
ca8120561d6904d8
7.24
2