repo stringlengths 7 90 | file_url stringlengths 81 315 | file_path stringlengths 4 228 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:38:15 2026-01-05 02:33:18 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/scaffold/templates/config_flow_discovery/integration/config_flow.py | script/scaffold/templates/config_flow_discovery/integration/config_flow.py | """Config flow for the NEW_NAME integration."""
import my_pypi_dependency
from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_entry_flow
from .const import DOMAIN
async def _async_has_devices(hass: HomeAssistant) -> bool:
"""Return if there are devices that can be discovered."... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/scaffold/templates/backup/integration/backup.py | script/scaffold/templates/backup/integration/backup.py | """Backup platform for the NEW_NAME integration."""
from homeassistant.core import HomeAssistant
async def async_pre_backup(hass: HomeAssistant) -> None:
"""Perform operations before a backup starts."""
async def async_post_backup(hass: HomeAssistant) -> None:
"""Perform operations after a backup finishes.... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/scaffold/templates/backup/tests/test_backup.py | script/scaffold/templates/backup/tests/test_backup.py | """Test the NEW_NAME backup platform."""
from homeassistant.components.NEW_DOMAIN.backup import (
async_post_backup,
async_pre_backup,
)
from homeassistant.core import HomeAssistant
async def test_async_post_backup(hass: HomeAssistant) -> None:
"""Verify async_post_backup."""
# TODO: verify that the ... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/scaffold/templates/device_action/integration/device_action.py | script/scaffold/templates/device_action/integration/device_action.py | """Provides device actions for NEW_NAME."""
from __future__ import annotations
import voluptuous as vol
from homeassistant.const import (
ATTR_ENTITY_ID,
CONF_DEVICE_ID,
CONF_DOMAIN,
CONF_ENTITY_ID,
CONF_TYPE,
SERVICE_TURN_OFF,
SERVICE_TURN_ON,
)
from homeassistant.core import Context, Ho... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/scaffold/templates/device_action/tests/test_device_action.py | script/scaffold/templates/device_action/tests/test_device_action.py | """The tests for NEW_NAME device actions."""
import pytest
from pytest_unordered import unordered
from homeassistant.components import automation
from homeassistant.components.device_automation import DeviceAutomationType
from homeassistant.components.NEW_DOMAIN import DOMAIN
from homeassistant.const import EntityCat... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/scaffold/templates/config_flow_oauth2/integration/api.py | script/scaffold/templates/config_flow_oauth2/integration/api.py | """API for NEW_NAME bound to Home Assistant OAuth."""
from asyncio import run_coroutine_threadsafe
from aiohttp import ClientSession
import my_pypi_package
from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_entry_oauth2_flow
# TODO the following two API examples are based on our s... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/scaffold/templates/config_flow_oauth2/integration/application_credentials.py | script/scaffold/templates/config_flow_oauth2/integration/application_credentials.py | """Application credentials platform for the NEW_NAME integration."""
from homeassistant.components.application_credentials import AuthorizationServer
from homeassistant.core import HomeAssistant
from .const import OAUTH2_AUTHORIZE, OAUTH2_TOKEN
async def async_get_authorization_server(hass: HomeAssistant) -> Author... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/scaffold/templates/config_flow_oauth2/integration/const.py | script/scaffold/templates/config_flow_oauth2/integration/const.py | """Constants for the NEW_NAME integration."""
DOMAIN = "NEW_DOMAIN"
# TODO Update with your own urls
OAUTH2_AUTHORIZE = "https://www.example.com/auth/authorize"
OAUTH2_TOKEN = "https://www.example.com/auth/token"
| python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/scaffold/templates/config_flow_oauth2/integration/__init__.py | script/scaffold/templates/config_flow_oauth2/integration/__init__.py | """The NEW_NAME integration."""
from __future__ import annotations
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers import aiohttp_client
from h... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/scaffold/templates/config_flow_oauth2/integration/config_flow.py | script/scaffold/templates/config_flow_oauth2/integration/config_flow.py | """Config flow for NEW_NAME."""
import logging
from homeassistant.helpers import config_entry_oauth2_flow
from .const import DOMAIN
class OAuth2FlowHandler(
config_entry_oauth2_flow.AbstractOAuth2FlowHandler, domain=DOMAIN
):
"""Config flow to handle NEW_NAME OAuth2 authentication."""
DOMAIN = DOMAIN
... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/scaffold/templates/config_flow_oauth2/tests/test_config_flow.py | script/scaffold/templates/config_flow_oauth2/tests/test_config_flow.py | """Test the NEW_NAME config flow."""
from unittest.mock import patch
import pytest
from homeassistant import config_entries
from homeassistant.components.application_credentials import (
ClientCredential,
async_import_client_credential,
)
from homeassistant.components.NEW_DOMAIN.const import (
DOMAIN,
... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/scaffold/templates/reproduce_state/integration/reproduce_state.py | script/scaffold/templates/reproduce_state/integration/reproduce_state.py | """Reproduce an NEW_NAME state."""
from __future__ import annotations
import asyncio
from collections.abc import Iterable
import logging
from typing import Any
from homeassistant.const import (
ATTR_ENTITY_ID,
SERVICE_TURN_OFF,
SERVICE_TURN_ON,
STATE_OFF,
STATE_ON,
)
from homeassistant.core impor... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/scaffold/templates/reproduce_state/tests/test_reproduce_state.py | script/scaffold/templates/reproduce_state/tests/test_reproduce_state.py | """Test reproduce state for NEW_NAME."""
import pytest
from homeassistant.core import HomeAssistant, State
from homeassistant.helpers.state import async_reproduce_state
from tests.common import async_mock_service
async def test_reproducing_states(
hass: HomeAssistant, caplog: pytest.LogCaptureFixture
) -> None... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/scaffold/templates/device_condition/integration/device_condition.py | script/scaffold/templates/device_condition/integration/device_condition.py | """Provide the device conditions for NEW_NAME."""
from __future__ import annotations
import voluptuous as vol
from homeassistant.const import (
ATTR_ENTITY_ID,
CONF_CONDITION,
CONF_DEVICE_ID,
CONF_DOMAIN,
CONF_ENTITY_ID,
CONF_TYPE,
STATE_OFF,
STATE_ON,
)
from homeassistant.core import... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/scaffold/templates/device_condition/tests/test_device_condition.py | script/scaffold/templates/device_condition/tests/test_device_condition.py | """The tests for NEW_NAME device conditions."""
from __future__ import annotations
from pytest_unordered import unordered
from homeassistant.components import automation
from homeassistant.components.device_automation import DeviceAutomationType
from homeassistant.components.NEW_DOMAIN import DOMAIN
from homeassista... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/dependencies.py | script/hassfest/dependencies.py | """Validate dependencies."""
from __future__ import annotations
import ast
from collections import deque
import multiprocessing
from pathlib import Path
from homeassistant.const import Platform
from homeassistant.requirements import DISCOVERY_INTEGRATIONS
from . import ast_parse_module
from .model import Config, In... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/icons.py | script/hassfest/icons.py | """Validate integration icon translation files."""
from __future__ import annotations
from typing import Any
import orjson
import voluptuous as vol
from voluptuous.humanize import humanize_error
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.icon import convert_shorthand_service_ico... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/config_schema.py | script/hassfest/config_schema.py | """Validate integrations which can be setup from YAML have config schemas."""
from __future__ import annotations
import ast
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN
from . import ast_parse_module
from .model import Config, Integration
CONFIG_SCHEMA_IGNORE = {
# Configuration under the home... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/quality_scale.py | script/hassfest/quality_scale.py | """Validate integration quality scale files."""
from __future__ import annotations
from dataclasses import dataclass
import voluptuous as vol
from voluptuous.humanize import humanize_error
from homeassistant.const import Platform
from homeassistant.exceptions import HomeAssistantError
from homeassistant.util.yaml i... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | true |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/dhcp.py | script/hassfest/dhcp.py | """Generate dhcp file."""
from __future__ import annotations
from .model import Config, Integration
from .serializer import format_python_namespace
def generate_and_validate(integrations: dict[str, Integration]) -> str:
"""Validate and generate dhcp data."""
match_list = []
for domain in sorted(integra... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/serializer.py | script/hassfest/serializer.py | """Hassfest utils."""
from __future__ import annotations
from collections.abc import Collection, Iterable, Mapping
import shutil
import subprocess
from typing import Any
DEFAULT_GENERATOR = "script.hassfest"
def _wrap_items(
items: Iterable[str],
opener: str,
closer: str,
sort: bool = False,
) -> s... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/application_credentials.py | script/hassfest/application_credentials.py | """Generate application_credentials data."""
from __future__ import annotations
from .model import Config, Integration
from .serializer import format_python_namespace
def generate_and_validate(integrations: dict[str, Integration], config: Config) -> str:
"""Validate and generate application_credentials data."""... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/translations.py | script/hassfest/translations.py | """Validate integration translation files."""
from __future__ import annotations
from functools import partial
import json
import re
import string
from typing import Any
import voluptuous as vol
from voluptuous.humanize import humanize_error
import homeassistant.helpers.config_validation as cv
from script.translati... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/services.py | script/hassfest/services.py | """Validate dependencies."""
from __future__ import annotations
import contextlib
import json
import pathlib
import re
from typing import Any
import voluptuous as vol
from voluptuous.humanize import humanize_error
from homeassistant.const import CONF_SELECTOR
from homeassistant.exceptions import HomeAssistantError
... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/model.py | script/hassfest/model.py | """Models for manifest validator."""
from __future__ import annotations
from dataclasses import dataclass, field
from enum import IntEnum
import json
import pathlib
from typing import Any, Literal
@dataclass
class Error:
"""Error validating an integration."""
plugin: str
error: str
fixable: bool = ... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/labs.py | script/hassfest/labs.py | """Generate lab preview features file."""
from __future__ import annotations
from .model import Config, Integration
from .serializer import format_python_namespace
def generate_and_validate(integrations: dict[str, Integration]) -> str:
"""Validate and generate lab preview features data."""
labs_dict: dict[s... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/codeowners.py | script/hassfest/codeowners.py | """Generate CODEOWNERS."""
from __future__ import annotations
from .model import Config, Integration
BASE = """
# This file is generated by script/hassfest/codeowners.py
# People marked here will be automatically requested for a review
# when the code that they own is touched.
# https://github.com/blog/2392-introduc... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/conditions.py | script/hassfest/conditions.py | """Validate conditions."""
from __future__ import annotations
import contextlib
import json
import pathlib
import re
from typing import Any
import voluptuous as vol
from voluptuous.humanize import humanize_error
from homeassistant.const import CONF_SELECTOR
from homeassistant.exceptions import HomeAssistantError
fr... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/integration_info.py | script/hassfest/integration_info.py | """Write integration constants."""
from __future__ import annotations
from .model import Config, Integration
from .serializer import format_python
def validate(integrations: dict[str, Integration], config: Config) -> None:
"""Validate integrations file."""
if config.specific_integrations:
return
... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/__main__.py | script/hassfest/__main__.py | """Validate manifests."""
from __future__ import annotations
import argparse
from operator import attrgetter
from pathlib import Path
import sys
from time import monotonic
from . import (
application_credentials,
bluetooth,
codeowners,
conditions,
config_flow,
config_schema,
dependencies,... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/metadata.py | script/hassfest/metadata.py | """Package metadata validation."""
import tomllib
from homeassistant.const import REQUIRED_PYTHON_VER, __version__
from .model import Config, Integration
def validate(integrations: dict[str, Integration], config: Config) -> None:
"""Validate project metadata keys."""
metadata_path = config.root / "pyprojec... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/brand.py | script/hassfest/brand.py | """Brand validation."""
from __future__ import annotations
import voluptuous as vol
from voluptuous.humanize import humanize_error
from .model import Brand, Config, Integration
BRAND_SCHEMA = vol.Schema(
{
vol.Required("domain"): str,
vol.Required("name"): str,
vol.Optional("integrations... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/requirements.py | script/hassfest/requirements.py | """Validate requirements."""
from __future__ import annotations
from collections import deque
from collections.abc import Collection
from functools import cache
from importlib.metadata import files, metadata
import json
import os
import re
import subprocess
import sys
from typing import Any, TypedDict
from awesomeve... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/zeroconf.py | script/hassfest/zeroconf.py | """Generate zeroconf file."""
from __future__ import annotations
from collections import defaultdict
from homeassistant.loader import (
async_process_zeroconf_match_dict,
homekit_always_discover,
)
from .model import Config, Integration
from .serializer import format_python_namespace
def generate_and_vali... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/docker.py | script/hassfest/docker.py | """Generate and validate the dockerfile."""
from dataclasses import dataclass
from pathlib import Path
from homeassistant import core
from homeassistant.util import executor, thread
from .model import Config, Integration
from .requirements import PACKAGE_REGEX, PIP_VERSION_RANGE_SEPARATOR
_GO2RTC_SHA = (
"f394f... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/mypy_config.py | script/hassfest/mypy_config.py | """Generate mypy config."""
from __future__ import annotations
from collections.abc import Iterable
import configparser
import io
import os
from pathlib import Path
from typing import Final
from homeassistant.const import REQUIRED_PYTHON_VER
from .model import Config, Integration
# Component modules which should s... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/__init__.py | script/hassfest/__init__.py | """Manifest validator."""
import ast
from functools import lru_cache
from pathlib import Path
@lru_cache
def ast_parse_module(file_path: Path) -> ast.Module:
"""Parse a module.
Cached to avoid parsing the same file for each plugin.
"""
return ast.parse(file_path.read_text())
| python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/ssdp.py | script/hassfest/ssdp.py | """Generate ssdp file."""
from __future__ import annotations
from collections import defaultdict
from .model import Config, Integration
from .serializer import format_python_namespace
def generate_and_validate(integrations: dict[str, Integration]) -> str:
"""Validate and generate ssdp data."""
data = defa... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/usb.py | script/hassfest/usb.py | """Generate usb file."""
from __future__ import annotations
from .model import Config, Integration
from .serializer import format_python_namespace
def generate_and_validate(integrations: dict[str, Integration]) -> str:
"""Validate and generate usb data."""
match_list = []
for domain in sorted(integrati... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/json.py | script/hassfest/json.py | """Validate integration JSON files."""
from __future__ import annotations
import json
from .model import Config, Integration
def validate_json_files(integration: Integration) -> None:
"""Validate JSON files for integration."""
for json_file in integration.path.glob("**/*.json"):
if not json_file.is... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/bluetooth.py | script/hassfest/bluetooth.py | """Generate bluetooth file."""
from __future__ import annotations
from .model import Config, Integration
from .serializer import format_python_namespace
def generate_and_validate(integrations: dict[str, Integration]) -> str:
"""Validate and generate bluetooth data."""
match_list = []
for domain in sort... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/mqtt.py | script/hassfest/mqtt.py | """Generate MQTT file."""
from __future__ import annotations
from collections import defaultdict
from .model import Config, Integration
from .serializer import format_python_namespace
def generate_and_validate(integrations: dict[str, Integration]) -> str:
"""Validate and generate MQTT data."""
data = defa... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/manifest.py | script/hassfest/manifest.py | """Manifest validation."""
from __future__ import annotations
from enum import StrEnum, auto
import json
from pathlib import Path
import subprocess
from typing import Any
from urllib.parse import urlparse
from awesomeversion import (
AwesomeVersion,
AwesomeVersionException,
AwesomeVersionStrategy,
)
impo... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/triggers.py | script/hassfest/triggers.py | """Validate triggers."""
from __future__ import annotations
import contextlib
import json
import pathlib
import re
from typing import Any
import voluptuous as vol
from voluptuous.humanize import humanize_error
from homeassistant.const import CONF_SELECTOR
from homeassistant.exceptions import HomeAssistantError
from... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/config_flow.py | script/hassfest/config_flow.py | """Generate config flow file."""
from __future__ import annotations
import json
from typing import Any
from .brand import validate as validate_brands
from .model import Brand, Config, Integration
from .serializer import format_python_namespace
UNIQUE_ID_IGNORE = {"huawei_lte", "mqtt", "adguard"}
def _validate_int... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/quality_scale_validation/strict_typing.py | script/hassfest/quality_scale_validation/strict_typing.py | """Enforce that the integration has strict typing enabled.
https://developers.home-assistant.io/docs/core/integration-quality-scale/rules/strict-typing/
"""
from functools import lru_cache
from importlib import metadata
from pathlib import Path
import re
from script.hassfest.model import Config, Integration
_STRICT... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/quality_scale_validation/unique_config_entry.py | script/hassfest/quality_scale_validation/unique_config_entry.py | """Enforce that the integration prevents duplicates from being configured.
https://developers.home-assistant.io/docs/core/integration-quality-scale/rules/unique-config-entry/
"""
import ast
from script.hassfest import ast_parse_module
from script.hassfest.model import Config, Integration
def _has_method_call(modul... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/quality_scale_validation/diagnostics.py | script/hassfest/quality_scale_validation/diagnostics.py | """Enforce that the integration implements diagnostics.
https://developers.home-assistant.io/docs/core/integration-quality-scale/rules/diagnostics/
"""
import ast
from script.hassfest import ast_parse_module
from script.hassfest.model import Config, Integration
DIAGNOSTICS_FUNCTIONS = {
"async_get_config_entry_... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/quality_scale_validation/discovery.py | script/hassfest/quality_scale_validation/discovery.py | """Enforce that the integration supports discovery.
https://developers.home-assistant.io/docs/core/integration-quality-scale/rules/discovery/
"""
import ast
from script.hassfest import ast_parse_module
from script.hassfest.model import Config, Integration
MANIFEST_KEYS = [
"bluetooth",
"dhcp",
"homekit"... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/quality_scale_validation/parallel_updates.py | script/hassfest/quality_scale_validation/parallel_updates.py | """Enforce that the integration sets PARALLEL_UPDATES constant.
https://developers.home-assistant.io/docs/core/integration-quality-scale/rules/parallel-updates
"""
import ast
from homeassistant.const import Platform
from script.hassfest import ast_parse_module
from script.hassfest.model import Config, Integration
... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/quality_scale_validation/reauthentication_flow.py | script/hassfest/quality_scale_validation/reauthentication_flow.py | """Enforce that the integration implements reauthentication flow.
https://developers.home-assistant.io/docs/core/integration-quality-scale/rules/reauthentication-flow/
"""
import ast
from script.hassfest import ast_parse_module
from script.hassfest.model import Config, Integration
def _has_step_reauth_function(mod... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/quality_scale_validation/reconfiguration_flow.py | script/hassfest/quality_scale_validation/reconfiguration_flow.py | """Enforce that the integration implements reconfiguration flow.
https://developers.home-assistant.io/docs/core/integration-quality-scale/rules/reconfiguration-flow/
"""
import ast
from script.hassfest import ast_parse_module
from script.hassfest.model import Config, Integration
def _has_step_reconfigure_function(... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/quality_scale_validation/config_entry_unloading.py | script/hassfest/quality_scale_validation/config_entry_unloading.py | """Enforce that the integration implements entry unloading.
https://developers.home-assistant.io/docs/core/integration-quality-scale/rules/config-entry-unloading/
"""
import ast
from script.hassfest import ast_parse_module
from script.hassfest.model import Config, Integration
def _has_unload_entry_function(module:... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/quality_scale_validation/runtime_data.py | script/hassfest/quality_scale_validation/runtime_data.py | """Enforce that the integration uses ConfigEntry.runtime_data to store runtime data.
https://developers.home-assistant.io/docs/core/integration-quality-scale/rules/runtime-data
"""
import ast
import re
from homeassistant.const import Platform
from script.hassfest import ast_parse_module
from script.hassfest.model im... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/quality_scale_validation/__init__.py | script/hassfest/quality_scale_validation/__init__.py | """Integration quality scale rules."""
from typing import Protocol
from script.hassfest.model import Config, Integration
class RuleValidationProtocol(Protocol):
"""Protocol for rule validation."""
def validate(
self, config: Config, integration: Integration, *, rules_done: set[str]
) -> list[st... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/quality_scale_validation/config_flow.py | script/hassfest/quality_scale_validation/config_flow.py | """Enforce that the integration implements config flow.
https://developers.home-assistant.io/docs/core/integration-quality-scale/rules/config-flow/
"""
from script.hassfest.model import Config, Integration
def validate(
config: Config, integration: Integration, *, rules_done: set[str]
) -> list[str] | None:
... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/hassfest/quality_scale_validation/test_before_setup.py | script/hassfest/quality_scale_validation/test_before_setup.py | """Enforce that the integration raises correctly during initialisation.
https://developers.home-assistant.io/docs/core/integration-quality-scale/rules/test-before-setup/
"""
import ast
from script.hassfest import ast_parse_module
from script.hassfest.model import Config, Integration
_VALID_EXCEPTIONS = {
"Confi... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/translations/migrate.py | script/translations/migrate.py | """Migrate things."""
import json
import pathlib
from pprint import pprint
import re
from .const import CORE_PROJECT_ID, FRONTEND_PROJECT_ID, INTEGRATIONS_DIR
from .lokalise import get_api
from .util import load_json_from_path
FRONTEND_REPO = pathlib.Path("../frontend/")
def create_lookup(results):
"""Create a... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/translations/deduplicate.py | script/translations/deduplicate.py | """Deduplicate translations in strings.json."""
import argparse
import json
from pathlib import Path
from homeassistant.const import Platform
from . import upload
from .util import flatten_translations, get_base_arg_parser, load_json_from_path
def get_arguments() -> argparse.Namespace:
"""Get parsed passed in ... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/translations/develop.py | script/translations/develop.py | """Compile the current translation strings files for testing."""
import argparse
import json
from pathlib import Path
import sys
from . import download, upload
from .const import INTEGRATIONS_DIR
from .util import flatten_translations, get_base_arg_parser, substitute_references
def valid_integration(integration):
... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/translations/error.py | script/translations/error.py | """Errors for translations."""
import json
class ExitApp(Exception):
"""Exception to indicate app should exit."""
def __init__(self, reason, exit_code=1):
"""Initialize the exit app exception."""
self.reason = reason
self.exit_code = exit_code
class MissingReference(Exception):
... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/translations/util.py | script/translations/util.py | """Translation utils."""
import argparse
import json
import os
import pathlib
import re
import subprocess
from typing import Any
from .error import ExitApp, JSONDecodeErrorWithPath, MissingReference
def get_base_arg_parser() -> argparse.ArgumentParser:
"""Get a base argument parser."""
parser = argparse.Arg... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/translations/upload.py | script/translations/upload.py | #!/usr/bin/env python3
"""Merge all translation sources into a single JSON file."""
import json
import os
import pathlib
import subprocess
from .const import CLI_2_DOCKER_IMAGE, CORE_PROJECT_ID, INTEGRATIONS_DIR
from .error import ExitApp
from .util import get_current_branch, get_lokalise_token, load_json_from_path
... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/translations/clean.py | script/translations/clean.py | """Find translation keys that are in Lokalise but no longer defined in source."""
import argparse
from .const import CORE_PROJECT_ID, FRONTEND_DIR, FRONTEND_PROJECT_ID, INTEGRATIONS_DIR
from .error import ExitApp
from .lokalise import get_api
from .util import get_base_arg_parser, load_json_from_path
def get_argume... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/translations/__main__.py | script/translations/__main__.py | """Validate manifests."""
import argparse
import importlib
from pathlib import Path
import sys
from . import error, util
def get_arguments() -> argparse.Namespace:
"""Get parsed passed in arguments."""
return util.get_base_arg_parser().parse_known_args()[0]
def main():
"""Run a translation script."""
... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/translations/const.py | script/translations/const.py | """Translation constants."""
import pathlib
CORE_PROJECT_ID = "130246255a974bd3b5e8a1.51616605"
FRONTEND_PROJECT_ID = "3420425759f6d6d241f598.13594006"
CLI_2_DOCKER_IMAGE = "v2.6.14"
INTEGRATIONS_DIR = pathlib.Path("homeassistant/components")
FRONTEND_DIR = pathlib.Path("../frontend")
| python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/translations/download.py | script/translations/download.py | #!/usr/bin/env python3
"""Merge all translation sources into a single JSON file."""
from __future__ import annotations
import json
from pathlib import Path
import subprocess
from typing import Any
from .const import CLI_2_DOCKER_IMAGE, CORE_PROJECT_ID, INTEGRATIONS_DIR
from .error import ExitApp
from .util import (
... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/translations/__init__.py | script/translations/__init__.py | """Translation helper scripts."""
| python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/translations/lokalise.py | script/translations/lokalise.py | """API for Lokalise."""
from __future__ import annotations
from pprint import pprint
import requests
from .util import get_lokalise_token
def get_api(project_id, debug=False) -> Lokalise:
"""Get Lokalise API."""
return Lokalise(project_id, get_lokalise_token(), debug)
class Lokalise:
"""Lokalise API... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
home-assistant/core | https://github.com/home-assistant/core/blob/6cae1821fb77e785a8aebb48dfc72ea5081b8975/script/translations/frontend.py | script/translations/frontend.py | """Write updated translations to the frontend."""
import argparse
import json
from .const import FRONTEND_DIR
from .download import DOWNLOAD_DIR, run_download_docker
from .util import get_base_arg_parser, load_json_from_path
FRONTEND_BACKEND_TRANSLATIONS = FRONTEND_DIR / "translations/backend"
def get_arguments() ... | python | Apache-2.0 | 6cae1821fb77e785a8aebb48dfc72ea5081b8975 | 2026-01-04T14:38:15.504802Z | false |
testerSunshine/12306 | https://github.com/testerSunshine/12306/blob/a495af88346a0d794493c6030f6a6207debb5824/run.py | run.py | # -*- coding=utf-8 -*-
import argparse
import sys
def parser_arguments(argv):
"""
不应该在这里定义,先放在这里
:param argv:
:return:
"""
parser = argparse.ArgumentParser()
parser.add_argument("operate", type=str, help="r: 运行抢票程序, c: 过滤cdn, t: 测试邮箱和server酱,server酱需要打开开关")
return parser.parse_args(ar... | python | MIT | a495af88346a0d794493c6030f6a6207debb5824 | 2026-01-04T14:42:34.772408Z | false |
testerSunshine/12306 | https://github.com/testerSunshine/12306/blob/a495af88346a0d794493c6030f6a6207debb5824/__init__.py | __init__.py | python | MIT | a495af88346a0d794493c6030f6a6207debb5824 | 2026-01-04T14:42:34.772408Z | false | |
testerSunshine/12306 | https://github.com/testerSunshine/12306/blob/a495af88346a0d794493c6030f6a6207debb5824/TickerConfig.py | TickerConfig.py | # -*- coding=utf-8 -*-
# 关于软件使用配置说明,一定要看!!!
# ps: 如果是候补车票,需要通过人证一致性核验的用户及激活的“铁路畅行”会员可以提交候补需求,请您按照操作说明在铁路12306app.上完成人证核验
# 关于候补了之后是否还能继续捡漏的问题在此说明: 软件为全自动候补加捡漏,如果软件候补成功则会停止抢票,发出邮件通知,但是不会影响你继续捡漏,
# 如果这个时候捡漏捡到的话,也是可以付款成功的,也就是说,捡漏+候补,可以最大程度提升抢票成功率
# 刷票模式:1=刷票 2=候补+刷票
TICKET_TYPE = 1
# 出发日期(list) "2018-01-06", "2018-01-07... | python | MIT | a495af88346a0d794493c6030f6a6207debb5824 | 2026-01-04T14:42:34.772408Z | false |
testerSunshine/12306 | https://github.com/testerSunshine/12306/blob/a495af88346a0d794493c6030f6a6207debb5824/verify/localVerifyCode.py | verify/localVerifyCode.py | # coding: utf-8
import TickerConfig
if TickerConfig.AUTO_CODE_TYPE == 2:
import base64
import os
import cv2
import numpy as np
from keras import models, backend
import tensorflow as tf
from verify import pretreatment
from verify.mlearn_for_image import preprocess_input
graph = tf.g... | python | MIT | a495af88346a0d794493c6030f6a6207debb5824 | 2026-01-04T14:42:34.772408Z | false |
testerSunshine/12306 | https://github.com/testerSunshine/12306/blob/a495af88346a0d794493c6030f6a6207debb5824/verify/__init__.py | verify/__init__.py | python | MIT | a495af88346a0d794493c6030f6a6207debb5824 | 2026-01-04T14:42:34.772408Z | false | |
testerSunshine/12306 | https://github.com/testerSunshine/12306/blob/a495af88346a0d794493c6030f6a6207debb5824/verify/pretreatment.py | verify/pretreatment.py | #! env python
# coding: utf-8
# 功能:对图像进行预处理,将文字部分单独提取出来
# 并存放到ocr目录下
# 文件名为原验证码文件的文件名
import TickerConfig
if TickerConfig.AUTO_CODE_TYPE == 2:
import hashlib
import os
import pathlib
import cv2
import numpy as np
import requests
import scipy.fftpack
PATH = 'imgs'
def download_image():
... | python | MIT | a495af88346a0d794493c6030f6a6207debb5824 | 2026-01-04T14:42:34.772408Z | false |
testerSunshine/12306 | https://github.com/testerSunshine/12306/blob/a495af88346a0d794493c6030f6a6207debb5824/verify/mlearn_for_image.py | verify/mlearn_for_image.py | # coding: utf-8
import TickerConfig
if TickerConfig.AUTO_CODE_TYPE == 2:
import sys
import cv2
import numpy as np
from keras import models
from keras import layers
from keras import optimizers
from keras.applications import VGG16
from keras.callbacks import ReduceLROnPlateau
from ke... | python | MIT | a495af88346a0d794493c6030f6a6207debb5824 | 2026-01-04T14:42:34.772408Z | false |
testerSunshine/12306 | https://github.com/testerSunshine/12306/blob/a495af88346a0d794493c6030f6a6207debb5824/myException/PassengerUserException.py | myException/PassengerUserException.py | class PassengerUserException(Exception):
pass | python | MIT | a495af88346a0d794493c6030f6a6207debb5824 | 2026-01-04T14:42:34.772408Z | false |
testerSunshine/12306 | https://github.com/testerSunshine/12306/blob/a495af88346a0d794493c6030f6a6207debb5824/myException/ticketIsExitsException.py | myException/ticketIsExitsException.py | class ticketIsExitsException(Exception):
pass | python | MIT | a495af88346a0d794493c6030f6a6207debb5824 | 2026-01-04T14:42:34.772408Z | false |
testerSunshine/12306 | https://github.com/testerSunshine/12306/blob/a495af88346a0d794493c6030f6a6207debb5824/myException/UserPasswordException.py | myException/UserPasswordException.py | class UserPasswordException(Exception):
pass | python | MIT | a495af88346a0d794493c6030f6a6207debb5824 | 2026-01-04T14:42:34.772408Z | false |
testerSunshine/12306 | https://github.com/testerSunshine/12306/blob/a495af88346a0d794493c6030f6a6207debb5824/myException/balanceException.py | myException/balanceException.py | class balanceException(Exception):
pass | python | MIT | a495af88346a0d794493c6030f6a6207debb5824 | 2026-01-04T14:42:34.772408Z | false |
testerSunshine/12306 | https://github.com/testerSunshine/12306/blob/a495af88346a0d794493c6030f6a6207debb5824/myException/ticketConfigException.py | myException/ticketConfigException.py | class ticketConfigException(Exception):
pass | python | MIT | a495af88346a0d794493c6030f6a6207debb5824 | 2026-01-04T14:42:34.772408Z | false |
testerSunshine/12306 | https://github.com/testerSunshine/12306/blob/a495af88346a0d794493c6030f6a6207debb5824/myException/__init__.py | myException/__init__.py | python | MIT | a495af88346a0d794493c6030f6a6207debb5824 | 2026-01-04T14:42:34.772408Z | false | |
testerSunshine/12306 | https://github.com/testerSunshine/12306/blob/a495af88346a0d794493c6030f6a6207debb5824/myException/ticketNumOutException.py | myException/ticketNumOutException.py | class ticketNumOutException(Exception):
pass | python | MIT | a495af88346a0d794493c6030f6a6207debb5824 | 2026-01-04T14:42:34.772408Z | false |
testerSunshine/12306 | https://github.com/testerSunshine/12306/blob/a495af88346a0d794493c6030f6a6207debb5824/myUrllib/httpUtils.py | myUrllib/httpUtils.py | # -*- coding: utf8 -*-
import json
import random
import socket
from collections import OrderedDict
from time import sleep
import requests
from fake_useragent import UserAgent
import TickerConfig
from agency.agency_tools import proxy
from config import logger
def _set_header_default():
header_dict = OrderedDict()
... | python | MIT | a495af88346a0d794493c6030f6a6207debb5824 | 2026-01-04T14:42:34.772408Z | false |
testerSunshine/12306 | https://github.com/testerSunshine/12306/blob/a495af88346a0d794493c6030f6a6207debb5824/myUrllib/__init__.py | myUrllib/__init__.py | python | MIT | a495af88346a0d794493c6030f6a6207debb5824 | 2026-01-04T14:42:34.772408Z | false | |
testerSunshine/12306 | https://github.com/testerSunshine/12306/blob/a495af88346a0d794493c6030f6a6207debb5824/myUrllib/MySocketUtils.py | myUrllib/MySocketUtils.py | # coding=utf-8
import json
import socket
import re
# s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# s.connect(('183.232.189.31', 80))
# get_str = 'GET {0} HTTP/1.1\r\nConnection: close\r\n' \
# 'Host: %s\r\n' \
# 'User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, li... | python | MIT | a495af88346a0d794493c6030f6a6207debb5824 | 2026-01-04T14:42:34.772408Z | false |
testerSunshine/12306 | https://github.com/testerSunshine/12306/blob/a495af88346a0d794493c6030f6a6207debb5824/tmp/__init__.py | tmp/__init__.py | python | MIT | a495af88346a0d794493c6030f6a6207debb5824 | 2026-01-04T14:42:34.772408Z | false | |
testerSunshine/12306 | https://github.com/testerSunshine/12306/blob/a495af88346a0d794493c6030f6a6207debb5824/tmp/log/__init__.py | tmp/log/__init__.py | python | MIT | a495af88346a0d794493c6030f6a6207debb5824 | 2026-01-04T14:42:34.772408Z | false | |
testerSunshine/12306 | https://github.com/testerSunshine/12306/blob/a495af88346a0d794493c6030f6a6207debb5824/inter/GetQueueCount.py | inter/GetQueueCount.py | # coding=utf-8
import datetime
import sys
import time
from collections import OrderedDict
import wrapcache
import TickerConfig
from config.TicketEnmu import ticket
from config.emailConf import sendEmail
from config.serverchanConf import sendServerChan
from config.urlConf import urls
from inter.ConfirmSingleForQueue im... | python | MIT | a495af88346a0d794493c6030f6a6207debb5824 | 2026-01-04T14:42:34.772408Z | false |
testerSunshine/12306 | https://github.com/testerSunshine/12306/blob/a495af88346a0d794493c6030f6a6207debb5824/inter/ChechFace.py | inter/ChechFace.py | import datetime
import urllib
from collections import OrderedDict
from config.urlConf import urls
import TickerConfig
from inter.GetSuccessRate import getSuccessRate
from myException.ticketConfigException import ticketConfigException
import wrapcache
class chechFace:
def __init__(self, selectObj, secretList, trai... | python | MIT | a495af88346a0d794493c6030f6a6207debb5824 | 2026-01-04T14:42:34.772408Z | false |
testerSunshine/12306 | https://github.com/testerSunshine/12306/blob/a495af88346a0d794493c6030f6a6207debb5824/inter/CheckRandCodeAnsyn.py | inter/CheckRandCodeAnsyn.py | # coding=utf-8
class checkRandCodeAnsyn:
def __init__(self, session, randCode, token):
self.session = session
self.randCode = randCode
self.token = token
def data_par(self):
"""
:return:
"""
data = {
"randCode": self.randCode,
"ran... | python | MIT | a495af88346a0d794493c6030f6a6207debb5824 | 2026-01-04T14:42:34.772408Z | false |
testerSunshine/12306 | https://github.com/testerSunshine/12306/blob/a495af88346a0d794493c6030f6a6207debb5824/inter/QueryOrderWaitTime.py | inter/QueryOrderWaitTime.py | # coding=utf-8
import copy
import time
from config.TicketEnmu import ticket
from config.emailConf import sendEmail
from config.serverchanConf import sendServerChan
from myException.ticketIsExitsException import ticketIsExitsException
from myException.ticketNumOutException import ticketNumOutException
class queryOrde... | python | MIT | a495af88346a0d794493c6030f6a6207debb5824 | 2026-01-04T14:42:34.772408Z | false |
testerSunshine/12306 | https://github.com/testerSunshine/12306/blob/a495af88346a0d794493c6030f6a6207debb5824/inter/ConfirmSingleForQueueAsys.py | inter/ConfirmSingleForQueueAsys.py | # coding=utf-8
import json
import urllib
from collections import OrderedDict
from inter.QueryOrderWaitTime import queryOrderWaitTime
class confirmSingleForQueueAsys:
"""
订单快读排队
"""
def __init__(self,
session,
passengerTicketStr,
oldPassengerStr,
... | python | MIT | a495af88346a0d794493c6030f6a6207debb5824 | 2026-01-04T14:42:34.772408Z | false |
testerSunshine/12306 | https://github.com/testerSunshine/12306/blob/a495af88346a0d794493c6030f6a6207debb5824/inter/PassengerInitApi.py | inter/PassengerInitApi.py | import datetime
import wrapcache
import TickerConfig
from config.urlConf import urls
from inter.ConfirmHB import confirmHB
class passengerInitApi:
def __init__(self, session, secretList, tickerNo):
"""
获取候补信息
"""
self.secretList = secretList
self.tickerNo = tickerNo
... | python | MIT | a495af88346a0d794493c6030f6a6207debb5824 | 2026-01-04T14:42:34.772408Z | false |
testerSunshine/12306 | https://github.com/testerSunshine/12306/blob/a495af88346a0d794493c6030f6a6207debb5824/inter/LiftTicketInit.py | inter/LiftTicketInit.py | # coding=utf-8
import re
class liftTicketInit:
def __init__(self, session):
self.session = session
def reqLiftTicketInit(self):
"""
请求抢票页面
:return:
"""
urls = self.session.urls["left_ticket_init"]
# 获取初始化的结果
result = self.session.httpClint.send(... | python | MIT | a495af88346a0d794493c6030f6a6207debb5824 | 2026-01-04T14:42:34.772408Z | false |
testerSunshine/12306 | https://github.com/testerSunshine/12306/blob/a495af88346a0d794493c6030f6a6207debb5824/inter/ConfirmHB.py | inter/ConfirmHB.py | from collections import OrderedDict
from config.urlConf import urls
import TickerConfig
from inter.GetQueueCount import queryQueueByAfterNate
class confirmHB:
def __init__(self, secretList, session, tickerNo, jzdhDate):
"""
人脸识别
"""
self.secretList = secretList
self.session... | python | MIT | a495af88346a0d794493c6030f6a6207debb5824 | 2026-01-04T14:42:34.772408Z | false |
testerSunshine/12306 | https://github.com/testerSunshine/12306/blob/a495af88346a0d794493c6030f6a6207debb5824/inter/CheckUser.py | inter/CheckUser.py | # coding=utf-8
import datetime
import random
import time
import wrapcache
from config import configCommon
from config.TicketEnmu import ticket
class checkUser:
def __init__(self, session):
self.session = session
def sendCheckUser(self):
"""
检查用户登录, 检查间隔为2分钟
:return:
""... | python | MIT | a495af88346a0d794493c6030f6a6207debb5824 | 2026-01-04T14:42:34.772408Z | false |
testerSunshine/12306 | https://github.com/testerSunshine/12306/blob/a495af88346a0d794493c6030f6a6207debb5824/inter/LoginAysnSuggest.py | inter/LoginAysnSuggest.py | # coding=utf-8
from config.urlConf import urls
def loginAysnSuggest(session, username, password):
"""
登录接口
ps: 不需要验证码
:return:
"""
loginAysnSuggestUrls = urls.get("loginAysnSuggest")
data = {
"loginUserDTO.user_name": username,
"userDTO.password": password
}
loginAy... | python | MIT | a495af88346a0d794493c6030f6a6207debb5824 | 2026-01-04T14:42:34.772408Z | false |
testerSunshine/12306 | https://github.com/testerSunshine/12306/blob/a495af88346a0d794493c6030f6a6207debb5824/inter/GetPassengerDTOs.py | inter/GetPassengerDTOs.py | # coding=utf-8
import json
from config.TicketEnmu import ticket
from myException.PassengerUserException import PassengerUserException
import wrapcache
import TickerConfig
class getPassengerDTOs:
"""
获取乘客信息
:return:
"""
def __init__(self, selectObj, ticket_peoples=None, set_type=None, is_more_tick... | python | MIT | a495af88346a0d794493c6030f6a6207debb5824 | 2026-01-04T14:42:34.772408Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.