refactor: standardize packaging across all components (#266)

* refactor: standardize packaging across all components

- Standardize Python version to >=3.12,<3.13 for all components
- Migrate from [project.optional-dependencies] to modern [dependency-groups] (PEP 735)
- Standardize ruff line-length to 120 characters across all components
- Add consistent project metadata:
  - AGPL-3.0 license field
  - Repository and Issues URLs
  - Improved, descriptive description fields
  - Fix email addresses to include .com domain

This improves consistency, maintainability, and follows modern Python
packaging best practices with uv/pip standards.

* fix: address PR review comments

- Move requires-python field to standard position (after license) in seed-gen
- Update all components to use latest ruff version (>=0.12.8)
- Ensure consistent dependency ordering across all components

* refactor: standardize dependency pinning strategy

Apply consistent dependency versioning across all components:

- Use ~= (compatible release) for core dependencies:
  - Infrastructure: redis, pydantic, fastapi, uvicorn, sqlalchemy
  - AI/LLM: openai, langchain-community, langgraph-checkpoint
  - Parsing: tree-sitter, tree-sitter-language-pack
  - Web: requests, urllib3, pyyaml
  - Utils: python-dotenv, unidiff, argon2-cffi, pymongo, six

- Keep >= for stable dev tools:
  - pytest, mypy, ruff, flake8 (want latest versions)
  - types-* packages (want latest type definitions)
  - rich, beautifulsoup4 (stable, backwards compatible)

- Keep exact pins for known issues:
  - protobuf (narrow range for compatibility)
  - openlit==1.32.12 (documented issue with 1.33)
  - clusterfuzz==2.6.0 (complex, version-sensitive)

This provides predictable builds with automatic patch updates while
preventing unexpected breaking changes from major/minor version bumps.

* feat: add project metadata for discoverability

Add comprehensive metadata to all components:

Keywords:
- common: cybersecurity, crs, utilities, protobuf, redis, telemetry
- fuzzer: fuzzing, oss-fuzz, libfuzzer, vulnerability-discovery, coverage
- orchestrator: orchestration, task-management, scheduler, api, fastapi
- patcher: patching, vulnerability-repair, llm, ai, code-generation
- program-model: static-analysis, codequery, tree-sitter, semantic-analysis
- seed-gen: test-generation, input-generation, fuzzing, seed-corpus, llm

Classifiers:
- Development Status :: 4 - Beta (all components)
- License :: OSI Approved :: GNU Affero General Public License v3
- Programming Language :: Python :: 3.12
- Topic :: Security (all components)
- Component-specific topics (Testing, AI, Distributed Computing, etc.)
- Operating System :: POSIX :: Linux

URLs:
- Added Documentation URL pointing to README for all components

This improves package discoverability, provides clear metadata for tools,
and gives the project a more professional appearance.

* Standardize tool configurations across all components

- Add pytest.ini_options configuration to all components
- Add coverage configuration with consistent exclude patterns
- Standardize ruff configuration with target-version and lint rules
- Fix missing readme field in fuzzer/pyproject.toml
- Fix python-dotenv spacing inconsistency in seed-gen
- Standardize all dev dependencies to use ~= operator for consistency

* Fix trailing whitespace and line length issues

- Remove trailing whitespace from tree-sitter query strings
- Remove trailing whitespace from test output strings
- Fix line length issues in logger.info() calls by splitting format strings
- Fix line length in datetime formatting by extracting variables
- Split long Pydantic Field descriptions and docstrings
- Leave test data strings unchanged to avoid breaking tests

* Fix dependency resolution issues

- Update argon2-cffi from ~=21.0.0 to ~=21.3.0 (21.0.x doesn't exist on PyPI)
- Update langgraph-checkpoint from ~=2.0.25 to ~=2.1.0 to match langgraph requirements
- Standardize spacing around ~= operators in all dependency specifications
- All components now successfully resolve dependencies with uv

* Apply ruff auto-fixes across project

- Fix import sorting (I001) in fuzzer, orchestrator, and patcher
- Update to PEP 585 type annotations (List->list, Dict->dict, etc.)
- Update to PEP 604 union syntax (Optional[X] -> X | None)
- Remove unnecessary UTF-8 encoding declarations
- Remove redundant file open modes
- Modernize type annotations throughout the codebase

Remaining issues are primarily line length (E501) which require manual review

* Fix line length issues in program-model component

- Break up long Java code strings in test assertions using implicit concatenation
- Split long constructor and method definitions across multiple lines
- Add noqa: E501 comment for 10,977 character struct definition test data
- All program-model line length issues resolved

* fix: revert protobuf enum type annotations to Optional

Protobuf enums (EnumTypeWrapper) don't support the | operator for type unions.
The ruff UP035 rule converted Optional[ProtobufEnum] to ProtobufEnum | None,
but this causes TypeError at runtime. Reverted these specific changes while
keeping the modern type union syntax for regular Python types.

* chore: add ruff protection for protobuf enum type annotations

- Configure ruff to ignore UP045 rule in test_submissions.py
- Add inline noqa comments to document why Optional is needed
- Protobuf enums (EnumTypeWrapper) don't support the | operator
- This prevents future automated fixes from breaking the code

* fix: modernize Python syntax and fix formatting issues

- Convert printf-style formatting to f-strings (UP031)
- Remove trailing whitespace from blank lines (W293)
- Use PEP 695 generic class syntax for Python 3.12+ (UP046)
- Use PEP 695 type alias syntax with 'type' keyword (UP040)

These changes modernize the codebase to use Python 3.12+ features
and fix formatting inconsistencies detected by ruff.

* fix: resolve undefined MsgType reference after PEP 695 conversion

When converting to PEP 695 generic class syntax, the MsgType TypeVar
was removed but was still referenced in overloaded method signatures.
Changed the generic fallback overload to use Message directly.

* fix: resolve line length violations across entire codebase

Applied Black formatter and manual fixes to resolve E501 line length violations:
- Fixed 178 line length issues across common, fuzzer, orchestrator, patcher, and program-model components
- Used Black formatter for automatic reformatting where possible
- Manually split long strings, function calls, and complex expressions
- All files now comply with 120-character line limit

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: revert PEP 695 type alias syntax in node_local.py

The PEP 695 syntax (type X = Y) creates TypeAliasType objects that cannot
be used as constructors at runtime. Since node_local.py uses NodeLocalPath
and RemotePath as constructors (e.g., NodeLocalPath(path)), we must use
the old TypeAlias syntax to maintain runtime functionality.

Added noqa comments to prevent ruff from attempting to modernize these
aliases in the future.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* chore: configure ruff to ignore UP040 for node_local.py

Added per-file configuration to prevent ruff from attempting to convert
TypeAlias annotations to PEP 695 syntax in node_local.py. This protects
the runtime functionality that relies on these type aliases being usable
as constructors.

Also removed redundant inline noqa comments since the ignore is now
configured at the project level.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: correct MsgType reference in static method decorator

The _ensure_group_name static method decorator was incorrectly
referencing MsgType in the wrapper function signature. Since MsgType
is a class-level type parameter and not accessible in static method
scope, changed it to Message which is the appropriate bound type.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* docs: add explanatory comment for Message type in decorator

Added a comment explaining why we must use Message instead of MsgType
in the _ensure_group_name decorator's wrapper function. This prevents
future confusion and protects against accidental "fixes" that would
break the code.

The MsgType parameter is a class-level type variable that's not in
scope within the static method decorator context.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Dan Guido
2025-08-08 19:59:56 -07:00
committed by GitHub
parent f24e5fa971
commit cc938e105f
232 changed files with 4420 additions and 6824 deletions
+65 -11
View File
@@ -1,24 +1,41 @@
[project]
name = "common"
version = "0.1.0"
description = ""
authors = [{ name = "Trail of Bits", email = "opensource@trailofbits" }]
requires-python = ">=3.10,<3.13"
description = "Shared utilities and components for Buttercup CRS"
authors = [{ name = "Trail of Bits", email = "opensource@trailofbits.com" }]
license = "AGPL-3.0"
requires-python = ">=3.12,<3.13"
keywords = ["cybersecurity", "crs", "utilities", "protobuf", "redis", "telemetry"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU Affero General Public License v3",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.12",
"Topic :: Security",
"Topic :: Software Development :: Libraries :: Python Modules",
"Operating System :: POSIX :: Linux",
]
dependencies = [
"protobuf (>=3.20, <=3.20.3)",
"pydantic-settings>=2.7.1",
"pymongo>=4.10.1",
"redis (>=5.2.1,<6.0.0)",
"pydantic-settings~=2.7.1",
"pymongo~=4.10.1",
"redis~=5.2.1",
"langchain-core~=0.3.32",
"langchain-openai~=0.3.2",
"langfuse ~= 2.59.2",
"langchain ~= 0.3.18",
"six>=1.17.0",
"six~=1.17.0",
"openlit == 1.32.12", # 1.33 currently fails to import opentelemetry.sdk._events
"langchain-community ~= 0.3.20", # implicit dep of openlit if you instrument langchain
"langchain-text-splitters ~= 0.3.7", # implicit dep of openlit if you instrument langchain
]
[project.urls]
Repository = "https://github.com/trailofbits/buttercup"
Issues = "https://github.com/trailofbits/buttercup/issues"
Documentation = "https://github.com/trailofbits/buttercup#readme"
[project.scripts]
buttercup-util = "buttercup.common.util_cli:main"
buttercup-challenge-task = "buttercup.common.challenge_task_cli:main"
@@ -34,17 +51,42 @@ build-backend = "hatchling.build"
[dependency-groups]
dev = [
"pytest>=8.3.4",
"ruff>=0.9.2",
"mypy>=1.15.0",
"pytest ~= 8.3.4",
"ruff ~= 0.12.8",
"mypy ~= 1.15.0",
"types-requests",
"types-PyYAML",
"types-redis",
"dirty-equals>=0.9.0",
"dirty-equals ~= 0.9.0",
]
[tool.coverage.run]
source = ["src/buttercup"]
omit = ["*/tests/*", "*/__cli__.py", "*/_cli.py", "*/util_cli.py", "*/challenge_task_cli.py", "*/task_registry.py"]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if __name__ == .__main__.:",
"raise NotImplementedError",
"if TYPE_CHECKING:",
]
[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
addopts = "-v --tb=short --strict-markers"
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"integration: marks tests as integration tests",
]
[tool.ruff]
line-length = 120
target-version = "py312"
exclude = [
"./src/buttercup/common/datastructures",
"./src/buttercup/common/clusterfuzz_env",
@@ -52,6 +94,18 @@ exclude = [
"src/buttercup/common/clusterfuzz_utils.py",
]
[tool.ruff.lint]
select = ["E", "F", "I", "W", "UP"]
ignore = ["COM812", "ISC001"] # Formatter conflicts
[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = ["S101", "D"] # Allow asserts, no docstrings in tests
"*/__cli__.py" = ["T201"] # Allow print in CLI modules
"*/util_cli.py" = ["T201"]
"*/challenge_task_cli.py" = ["T201"]
"*/task_registry.py" = ["T201"]
"src/buttercup/common/node_local.py" = ["UP040"] # PEP 695 type aliases break runtime usage as constructors
[tool.mypy]
plugins = ["pydantic.mypy"]
mypy_path = "src"
+34 -29
View File
@@ -1,26 +1,29 @@
from __future__ import annotations
from dataclasses import dataclass, field
from pathlib import Path
from typing import Dict, Any, Callable, TypeVar, cast
from os import PathLike
from functools import wraps, cached_property
import contextlib
import logging
import shlex
import os
from contextlib import contextmanager
import tempfile
import shutil
import uuid
import subprocess
import re
from buttercup.common.task_meta import TaskMeta
from buttercup.common.utils import copyanything, get_diffs
from buttercup.common.stack_parsing import get_crash_token
from typing import Iterator
import shlex
import shutil
import subprocess
import tempfile
import uuid
from collections.abc import Callable, Iterator
from contextlib import contextmanager
from dataclasses import dataclass, field
from functools import cached_property, wraps
from os import PathLike
from pathlib import Path
from typing import Any, TypeVar, cast
from packaging.version import Version
import buttercup.common.node_local as node_local
from buttercup.common.constants import ARCHITECTURE
from packaging.version import Version
from buttercup.common.stack_parsing import get_crash_token
from buttercup.common.task_meta import TaskMeta
from buttercup.common.utils import copyanything, get_diffs
logger = logging.getLogger(__name__)
@@ -364,7 +367,7 @@ class ChallengeTask:
return current_line
def _run_cmd(
self, cmd: list[str], cwd: Path | None = None, log: bool = True, env_helper: Dict[str, str] | None = None
self, cmd: list[str], cwd: Path | None = None, log: bool = True, env_helper: dict[str, str] | None = None
) -> CommandResult:
try:
if env_helper:
@@ -419,7 +422,7 @@ class ChallengeTask:
logger.exception(f"Command failed (cwd={cwd}): {' '.join(cmd)}")
return CommandResult(success=False, returncode=None, error=str(e).encode(), output=None)
def _run_helper_cmd(self, cmd: list[str], env_helper: Dict[str, str] | None = None) -> CommandResult:
def _run_helper_cmd(self, cmd: list[str], env_helper: dict[str, str] | None = None) -> CommandResult:
oss_fuzz_subpath = self.get_oss_fuzz_subpath()
if oss_fuzz_subpath is None:
raise ChallengeTaskError("OSS-Fuzz path not found")
@@ -564,8 +567,8 @@ class ChallengeTask:
architecture: str | None = ARCHITECTURE,
engine: str | None = None,
sanitizer: str | None = None,
env: Dict[str, str] | None = None,
env_helper: Dict[str, str] | None = None,
env: dict[str, str] | None = None,
env_helper: dict[str, str] | None = None,
) -> CommandResult:
logger.info(
"Building fuzzers for project %s | architecture=%s | engine=%s | sanitizer=%s | env=%s | use_source_dir=%s",
@@ -610,8 +613,8 @@ class ChallengeTask:
engine: str | None = None,
sanitizer: str | None = None,
pull_latest_base_image: bool = True,
env: Dict[str, str] | None = None,
env_helper: Dict[str, str] | None = None,
env: dict[str, str] | None = None,
env_helper: dict[str, str] | None = None,
) -> CommandResult:
check_build_res = self.check_build(architecture=architecture, engine=engine, sanitizer=sanitizer, env=env)
if check_build_res.success:
@@ -639,7 +642,7 @@ class ChallengeTask:
engine: str | None = None,
sanitizer: str | None = None,
pull_latest_base_image: bool = True,
env: Dict[str, str] | None = None,
env: dict[str, str] | None = None,
) -> CommandResult:
env_helper = {
"OSS_FUZZ_SAVE_CONTAINERS_NAME": container_name,
@@ -662,7 +665,7 @@ class ChallengeTask:
architecture: str | None = ARCHITECTURE,
engine: str | None = None,
sanitizer: str | None = None,
env: Dict[str, str] | None = None,
env: dict[str, str] | None = None,
) -> CommandResult:
logger.info(
"Checking build for project %s | architecture=%s | engine=%s | sanitizer=%s | env=%s",
@@ -691,10 +694,11 @@ class ChallengeTask:
fuzzer_args: list[str] | None = None,
*,
architecture: str | None = ARCHITECTURE,
env: Dict[str, str] | None = None,
env: dict[str, str] | None = None,
) -> ReproduceResult:
logger.info(
"Reproducing POV for project %s | fuzzer_name=%s | crash_path=%s | fuzzer_args=%s | architecture=%s | env=%s",
"Reproducing POV for project %s | fuzzer_name=%s | crash_path=%s | "
"fuzzer_args=%s | architecture=%s | env=%s",
self.project_name,
fuzzer_name,
crash_path,
@@ -739,10 +743,11 @@ class ChallengeTask:
architecture: str | None = ARCHITECTURE,
engine: str | None = None,
sanitizer: str | None = None,
env: Dict[str, str] | None = None,
env: dict[str, str] | None = None,
) -> CommandResult:
logger.info(
"Running fuzzer for project %s | harness_name=%s | fuzzer_args=%s | corpus_dir=%s | architecture=%s | engine=%s | sanitizer=%s | env=%s",
"Running fuzzer for project %s | harness_name=%s | fuzzer_args=%s | corpus_dir=%s | "
"architecture=%s | engine=%s | sanitizer=%s | env=%s",
self.project_name,
harness_name,
fuzzer_args,
@@ -774,7 +779,7 @@ class ChallengeTask:
harness_name: str,
corpus_dir: str,
architecture: str | None = ARCHITECTURE,
env: Dict[str, str] | None = None,
env: dict[str, str] | None = None,
) -> CommandResult:
logger.info(
"Running coverage for project %s | harness_name=%s | corpus_dir=%s | architecture=%s | env=%s",
@@ -1,11 +1,12 @@
from pydantic_settings import BaseSettings, CliSubCommand, get_subcommand, CliImplicitFlag
from collections.abc import Iterator
from contextlib import contextmanager
from pathlib import Path
from pydantic import BaseModel
from pydantic_settings import BaseSettings, CliImplicitFlag, CliSubCommand, get_subcommand
from buttercup.common.challenge_task import ChallengeTask, CommandResult, ReproduceResult
from buttercup.common.logger import setup_package_logger
from pathlib import Path
from typing import Dict
from contextlib import contextmanager
from typing import Iterator
class BuildImageCommand(BaseModel):
@@ -22,7 +23,7 @@ class BuildFuzzersCommand(BaseModel):
architecture: str | None = None
engine: str | None = None
sanitizer: str | None = None
env: Dict[str, str] | None = None
env: dict[str, str] | None = None
use_cache: bool = True
@@ -30,7 +31,7 @@ class CheckBuildCommand(BaseModel):
architecture: str | None = None
engine: str | None = None
sanitizer: str | None = None
env: Dict[str, str] | None = None
env: dict[str, str] | None = None
class ReproducePovCommand(BaseModel):
@@ -38,7 +39,7 @@ class ReproducePovCommand(BaseModel):
crash_path: Path
fuzzer_args: list[str] | None = None
architecture: str | None = None
env: Dict[str, str] | None = None
env: dict[str, str] | None = None
class Settings(BaseSettings):
+11 -9
View File
@@ -1,15 +1,17 @@
import logging
from typing import BinaryIO, List
import buttercup.common.node_local as node_local
from buttercup.common.constants import CORPUS_DIR_NAME, CRASH_DIR_NAME
import os
import hashlib
import logging
import os
import shutil
import subprocess
from pathlib import Path
from redis import Redis
from buttercup.common.sets import MergedCorpusSet
import tempfile
from pathlib import Path
from typing import BinaryIO
from redis import Redis
import buttercup.common.node_local as node_local
from buttercup.common.constants import CORPUS_DIR_NAME, CRASH_DIR_NAME
from buttercup.common.sets import MergedCorpusSet
logger = logging.getLogger(__name__)
@@ -97,7 +99,7 @@ class InputDir:
return len(name) == 64 and all(c in "0123456789abcdef" for c in name)
@classmethod
def hash_corpus(cls, path: str) -> List[str]:
def hash_corpus(cls, path: str) -> list[str]:
hashed_files = []
for file in os.listdir(path):
# If the file is already a hash, skip it
@@ -8,12 +8,13 @@ from pathlib import Path
from typing import Any
from redis import Redis
from buttercup.common.maps import CoverageMap, FunctionCoverage, HarnessWeights
# Add matplotlib import for visualization
try:
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.pyplot as plt
MATPLOTLIB_AVAILABLE = True
except ImportError:
@@ -368,7 +369,7 @@ class CoverageMonitor:
list_only: If True, only list the available harnesses without analyzing.
"""
try:
with open(file_path, "r") as f:
with open(file_path) as f:
coverage_snapshots = json.load(f)
if not coverage_snapshots:
@@ -382,10 +383,9 @@ class CoverageMonitor:
# List all available harnesses
print(f"Coverage file: {file_path}")
print(
f"Time range: {datetime.fromtimestamp(coverage_snapshots[0]['timestamp']).strftime('%Y-%m-%d %H:%M:%S')} - "
f"{datetime.fromtimestamp(coverage_snapshots[-1]['timestamp']).strftime('%Y-%m-%d %H:%M:%S')}"
)
start_time = datetime.fromtimestamp(coverage_snapshots[0]['timestamp']).strftime('%Y-%m-%d %H:%M:%S')
end_time = datetime.fromtimestamp(coverage_snapshots[-1]['timestamp']).strftime('%Y-%m-%d %H:%M:%S')
print(f"Time range: {start_time} - {end_time}")
print(f"Total snapshots: {len(coverage_snapshots)}")
print("\nAvailable harnesses:")
@@ -1,11 +1,12 @@
from abc import ABC, abstractmethod
from redis import Redis
from buttercup.common.utils import serve_loop
from buttercup.common.datastructures.msg_pb2 import WeightedHarness, BuildOutput, BuildType
from buttercup.common.maps import HarnessWeights, BuildMap
import random
import logging
import random
from abc import ABC, abstractmethod
from redis import Redis
from buttercup.common.datastructures.msg_pb2 import BuildOutput, BuildType, WeightedHarness
from buttercup.common.maps import BuildMap, HarnessWeights
from buttercup.common.utils import serve_loop
logger = logging.getLogger(__name__)
+5 -5
View File
@@ -1,15 +1,15 @@
import functools
import logging
import os
from enum import Enum
from typing import Any
import requests
import functools
from langchain.callbacks.base import BaseCallbackHandler
from langchain_core.language_models import BaseChatModel
from langchain_core.runnables import ConfigurableField
from langchain_openai.chat_models import ChatOpenAI
from langfuse.callback import CallbackHandler
from langchain.callbacks.base import BaseCallbackHandler
from langchain_core.runnables import ConfigurableField
import logging
logger = logging.getLogger(__name__)
+6 -3
View File
@@ -1,17 +1,20 @@
from opentelemetry._logs import set_logger_provider
import os
from opentelemetry._logs import set_logger_provider
if os.environ.get("OTEL_EXPORTER_OTLP_PROTOCOL") == "grpc":
from opentelemetry.exporter.otlp.proto.grpc._log_exporter import OTLPLogExporter
else:
from opentelemetry.exporter.otlp.proto.http._log_exporter import OTLPLogExporter # type: ignore
import logging
import tempfile
from opentelemetry.sdk._logs import LoggerProvider, LoggingHandler
from opentelemetry.sdk._logs.export import BatchLogRecordProcessor
from opentelemetry.sdk.resources import Resource
from buttercup.common.telemetry import crs_instance_id, service_instance_id
import logging
import tempfile
_is_initialized = False
PACKAGE_LOGGER_NAME = "buttercup"
+8 -7
View File
@@ -1,16 +1,17 @@
from typing import Generic, TypeVar, Type, Iterator
from buttercup.common.datastructures.msg_pb2 import WeightedHarness, BuildOutput, FunctionCoverage, BuildType
from redis import Redis
from bson.json_util import dumps, CANONICAL_JSON_OPTIONS
from collections.abc import Iterator
from bson.json_util import CANONICAL_JSON_OPTIONS, dumps
from google.protobuf.message import Message
from redis import Redis
from buttercup.common.datastructures.msg_pb2 import BuildOutput, BuildType, FunctionCoverage, WeightedHarness
from buttercup.common.sets import RedisSet
MsgType = TypeVar("MsgType", bound=Message)
MSG_FIELD_NAME = b"msg"
class RedisMap(Generic[MsgType]):
def __init__(self, redis: Redis, hash_name: str, msg_builder: Type[MsgType]):
class RedisMap[MsgType: Message]:
def __init__(self, redis: Redis, hash_name: str, msg_builder: type[MsgType]):
self.redis = redis
self.msg_builder = msg_builder
self.hash_name = hash_name
+5 -5
View File
@@ -1,14 +1,14 @@
# Store the node local path for subsequent use
from contextlib import contextmanager
import logging
import os
from pathlib import Path
import shutil
import tarfile
from tempfile import NamedTemporaryFile
import tempfile
from typing import Any, Iterator, TypeAlias
from contextlib import AbstractContextManager
from collections.abc import Iterator
from contextlib import AbstractContextManager, contextmanager
from pathlib import Path
from tempfile import NamedTemporaryFile
from typing import Any, TypeAlias
logger = logging.getLogger(__name__)
+4 -2
View File
@@ -1,8 +1,10 @@
from dataclasses import dataclass, field
import yaml
from buttercup.common.challenge_task import ChallengeTask
from enum import Enum
import yaml
from buttercup.common.challenge_task import ChallengeTask
class Language(str, Enum):
C = "c"
+27 -29
View File
@@ -1,31 +1,32 @@
from __future__ import annotations
import logging
import os
import uuid
from collections.abc import Callable
from dataclasses import dataclass, field
from redis import Redis, RedisError
from google.protobuf.message import Message
from enum import Enum
from functools import wraps
from typing import Any, Literal, TypeVar, cast, overload
from google.protobuf.message import Message
from redis import Redis, RedisError
from buttercup.common.datastructures.msg_pb2 import (
BuildRequest,
BuildOutput,
Crash,
TaskDownload,
TaskReady,
TaskDelete,
Patch,
BuildRequest,
ConfirmedVulnerability,
IndexRequest,
Crash,
IndexOutput,
TracedCrash,
IndexRequest,
Patch,
POVReproduceRequest,
POVReproduceResponse,
TaskDelete,
TaskDownload,
TaskReady,
TracedCrash,
)
import logging
from typing import Type, Generic, TypeVar, Literal, overload, Callable, cast
import uuid
import os
from enum import Enum
from typing import Any
TIMES_DELIVERED_FIELD = "times_delivered"
@@ -79,13 +80,8 @@ POV_REPRODUCER_RESPONSES_TASK_TIMEOUT_MS = int(os.getenv("POV_REPRODUCER_RESPONS
logger = logging.getLogger(__name__)
# Type variable for protobuf Message subclasses
# Used for type-hinting of reliable queue items
MsgType = TypeVar("MsgType", bound=Message)
@dataclass
class RQItem(Generic[MsgType]):
class RQItem[MsgType: Message]:
"""
A single item in a reliable queue.
"""
@@ -95,14 +91,14 @@ class RQItem(Generic[MsgType]):
@dataclass
class ReliableQueue(Generic[MsgType]):
class ReliableQueue[MsgType: Message]:
"""
A queue that is reliable and can be used to process tasks in a distributed environment.
"""
redis: Redis
queue_name: str
msg_builder: Type[MsgType]
msg_builder: type[MsgType]
group_name: str | None = None
task_timeout_ms: int = 180000
reader_name: str | None = None
@@ -139,7 +135,9 @@ class ReliableQueue(Generic[MsgType]):
@staticmethod
def _ensure_group_name(func: F) -> F:
@wraps(func)
def wrapper(self: ReliableQueue[MsgType], *args: Any, **kwargs: Any) -> Any:
# Note: Must use Message instead of MsgType here since MsgType is a class-level
# type parameter that's not in scope within this static method decorator
def wrapper(self: ReliableQueue[Message], *args: Any, **kwargs: Any) -> Any:
if self.group_name is None:
raise ValueError("group_name must be set for this operation")
@@ -215,7 +213,7 @@ class ReliableQueue(Generic[MsgType]):
@dataclass
class QueueConfig:
queue_name: QueueNames
msg_builder: Type
msg_builder: type
task_timeout_ms: int
group_names: list[GroupNames] = field(default_factory=list)
@@ -376,11 +374,11 @@ class QueueFactory:
@overload
def create(
self, queue_name: QueueNames, group_name: GroupNames | None = None, **kwargs: Any
) -> ReliableQueue[MsgType]: ...
) -> ReliableQueue[Message]: ...
def create(
self, queue_name: QueueNames, group_name: GroupNames | None = None, **kwargs: Any
) -> ReliableQueue[MsgType]:
) -> ReliableQueue[Message]:
if queue_name not in self._config:
raise ValueError(f"Invalid queue name: {queue_name}")
@@ -1,10 +1,11 @@
from buttercup.common.datastructures.msg_pb2 import BuildOutput
from buttercup.common.challenge_task import ReproduceResult, ChallengeTask
from pathlib import Path
from typing import Generator
from contextlib import contextmanager
import contextlib
import logging
from collections.abc import Generator
from contextlib import contextmanager
from pathlib import Path
from buttercup.common.challenge_task import ChallengeTask, ReproduceResult
from buttercup.common.datastructures.msg_pb2 import BuildOutput
logger = logging.getLogger(__name__)
+8 -6
View File
@@ -1,6 +1,7 @@
from __future__ import annotations
from typing import Dict, Any, List
from typing import Any
from pydantic import BaseModel, Field
from redis import Redis
@@ -8,11 +9,12 @@ from redis import Redis
class SARIFBroadcastDetail(BaseModel):
"""Model for SARIF broadcast details, matches the model in types.py"""
metadata: Dict[str, Any] = Field(
metadata: dict[str, Any] = Field(
...,
description="String to string map containing data that should be attached to outputs like log messages and OpenTelemetry trace attributes for traceability",
description="String to string map containing data that should be attached to outputs like log messages "
"and OpenTelemetry trace attributes for traceability",
)
sarif: Dict[str, Any] = Field(..., description="SARIF Report compliant with provided schema")
sarif: dict[str, Any] = Field(..., description="SARIF Report compliant with provided schema")
sarif_id: str
task_id: str
@@ -73,7 +75,7 @@ class SARIFStore:
# Add to the list for this task
self.redis.rpush(key, sarif_json)
def get_all(self) -> List[SARIFBroadcastDetail]:
def get_all(self) -> list[SARIFBroadcastDetail]:
"""
Retrieve all SARIF objects from Redis.
@@ -97,7 +99,7 @@ class SARIFStore:
return result
def get_by_task_id(self, task_id: str) -> List[SARIFBroadcastDetail]:
def get_by_task_id(self, task_id: str) -> list[SARIFBroadcastDetail]:
"""
Retrieve all SARIF objects for a specific task.
@@ -4,6 +4,7 @@ Utility script for SARIF storage and retrieval operations.
import argparse
import json
from redis import Redis
from buttercup.common.sarif_store import SARIFStore
+7 -7
View File
@@ -1,12 +1,12 @@
from typing import Iterator
import json
import random
from collections.abc import Generator, Iterator
from contextlib import contextmanager
from functools import lru_cache
from bson.json_util import CANONICAL_JSON_OPTIONS, dumps
from redis import Redis
from redis.exceptions import ResponseError
from bson.json_util import dumps, CANONICAL_JSON_OPTIONS
from contextlib import contextmanager
import random
import json
from functools import lru_cache
from typing import Generator
# Import POVReproduceRequest for the refactored PoVReproduceStatus
from buttercup.common.datastructures.msg_pb2 import POVReproduceRequest, POVReproduceResponse
+6 -4
View File
@@ -1,9 +1,11 @@
import re
from buttercup.common.clusterfuzz_parser import StackParser, CrashInfo
import logging
from buttercup.common.sets import RedisSet
import re
from bson.json_util import CANONICAL_JSON_OPTIONS, dumps
from redis import Redis
from bson.json_util import dumps, CANONICAL_JSON_OPTIONS
from buttercup.common.clusterfuzz_parser import CrashInfo, StackParser
from buttercup.common.sets import RedisSet
logger = logging.getLogger(__name__)
+2 -2
View File
@@ -1,7 +1,7 @@
from dataclasses import dataclass, asdict
import json
from pathlib import Path
from dataclasses import asdict, dataclass
from os import PathLike
from pathlib import Path
@dataclass
+13 -9
View File
@@ -1,11 +1,14 @@
from functools import lru_cache
from buttercup.common.datastructures.msg_pb2 import Task
from redis import Redis
from buttercup.common.queues import HashNames
from dataclasses import dataclass
from google.protobuf import text_format
import builtins
import time
from typing import Set, Iterator
from collections.abc import Iterator
from dataclasses import dataclass
from functools import lru_cache
from google.protobuf import text_format
from redis import Redis
from buttercup.common.datastructures.msg_pb2 import Task
from buttercup.common.queues import HashNames
# Redis set keys for tracking task states
CANCELLED_TASKS_SET = "cancelled_tasks"
@@ -182,7 +185,7 @@ class TaskRegistry:
# Decode bytes to strings if needed
return [task_id.decode("utf-8") if isinstance(task_id, bytes) else task_id for task_id in cancelled_ids]
def should_stop_processing(self, task_or_id: str | Task, cancelled_ids: Set[str] | None = None) -> bool:
def should_stop_processing(self, task_or_id: str | Task, cancelled_ids: builtins.set[str] | None = None) -> bool:
"""Check if a task should no longer be processed due to cancellation or expiration.
Args:
@@ -282,9 +285,10 @@ class TaskRegistry:
def task_registry_cli() -> None:
"""CLI for the task registry"""
from pydantic_settings import BaseSettings
from typing import Annotated
from pydantic import Field
from pydantic_settings import BaseSettings
class TaskRegistrySettings(BaseSettings):
redis_url: Annotated[str, Field(default="redis://localhost:6379", description="Redis URL")]
+4 -4
View File
@@ -1,14 +1,14 @@
import os
import logging
from enum import Enum
import os
import uuid
from enum import Enum
from typing import Any
import openlit
import opentelemetry.attributes
from opentelemetry import trace
from opentelemetry.trace import Span, Tracer, Status, StatusCode
from langchain_core.prompt_values import ChatPromptValue
from opentelemetry import trace
from opentelemetry.trace import Span, Status, StatusCode, Tracer
# Monkey patch the _clean_attribute function to handle ChatPromptValue
_clean_attribute_orig = opentelemetry.attributes._clean_attribute
+17 -16
View File
@@ -1,26 +1,27 @@
import logging
from pathlib import Path
from typing import Annotated
from uuid import uuid4
from google.protobuf.text_format import Parse
from pydantic import BaseModel, Field
from pydantic_settings import BaseSettings, CliPositionalArg, CliSubCommand, get_subcommand
from redis import Redis
from buttercup.common.datastructures.msg_pb2 import (
BuildOutput,
BuildType,
SubmissionEntry,
SubmissionResult,
WeightedHarness,
)
from buttercup.common.logger import setup_package_logger
from buttercup.common.maps import (
BuildMap,
HarnessWeights,
)
from buttercup.common.datastructures.msg_pb2 import (
BuildOutput,
BuildType,
WeightedHarness,
SubmissionEntry,
SubmissionResult,
)
from buttercup.common.queues import QueueFactory, QueueNames, ReliableQueue
from buttercup.common.task_registry import TaskRegistry
from uuid import uuid4
from redis import Redis
from pydantic_settings import BaseSettings, CliSubCommand, CliPositionalArg, get_subcommand
from pydantic import BaseModel
from typing import Annotated
from pydantic import Field
from pathlib import Path
from google.protobuf.text_format import Parse
import logging
logger = logging.getLogger(__name__)
+6 -5
View File
@@ -1,12 +1,13 @@
import shutil
import errno
import logging
import os
from typing import Any, Callable
from pathlib import Path
from os import PathLike
import time
import shutil
import threading
import time
from collections.abc import Callable
from os import PathLike
from pathlib import Path
from typing import Any
logger = logging.getLogger(__name__)
+66 -45
View File
@@ -1,18 +1,20 @@
from pathlib import Path
import pytest
from unittest.mock import MagicMock, patch
from dirty_equals import IsStr
import subprocess
import os
import base64
import os
import subprocess
import tempfile
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
from dirty_equals import IsStr
from buttercup.common.challenge_task import (
ChallengeTask,
ChallengeTaskError,
ReproduceResult,
CommandResult,
ReproduceResult,
)
from buttercup.common.task_meta import TaskMeta
import tempfile
@pytest.fixture
@@ -1040,7 +1042,10 @@ def test_reproduce_result_methods():
command_result=CommandResult(
success=False,
returncode=124, # TIMEOUT_ERR_RESULT
output=b"INFO: Seed: 12345\nRunning normally\n==ERROR: AddressSanitizer: heap-buffer-overflow\nTimeout occurred",
output=(
b"INFO: Seed: 12345\nRunning normally\n"
b"==ERROR: AddressSanitizer: heap-buffer-overflow\nTimeout occurred"
),
error=None,
)
)
@@ -1060,42 +1065,58 @@ def test_reproduce_result_methods():
assert result7.did_crash() is False # Should not detect crash due to no crash token
# Test case 8: Timeout with crash token in error output
output = b"""/out/fuzzer-postauth_nomaths -rss_limit_mb=2560 -timeout=25 -runs=100 /testcase -max_len=50000 -timeout_exitcode=0 -dict=fuzzer-postauth_nomaths.dict < /dev/null
INFO: found LLVMFuzzerCustomMutator (0x5595fa311560). Disabling -len_control by default.
Dictionary: 58 entries
INFO: Running with entropic power schedule (0xFF, 100).
INFO: Seed: 3932698478
INFO: Loaded 1 modules (7459 inline 8-bit counters): 7459 [0x5595fa3cec00, 0x5595fa3d0923),
INFO: Loaded 1 PC tables (7459 PCs): 7459 [0x5595fa3d0928,0x5595fa3edb58),
/out/fuzzer-postauth_nomaths: Running 1 inputs 100 time(s) each.
Running: /testcase
Dropbear fuzzer: Disabling stderr output
fuzzer-postauth_nomaths: src/../fuzz/fuzz-wrapfd.c:216: int wrapfd_select(int, fd_set *, fd_set *, fd_set *, struct timeval *): Assertion `wrap_fds[i].mode != UNUSED' failed.
AddressSanitizer:DEADLYSIGNAL
=================================================================
==18==ERROR: AddressSanitizer: ABRT on unknown address 0x000000000012 (pc 0x7f99ebd7600b bp 0x7f99ebeeb588 sp 0x7ffe363d6470 T0)
SCARINESS: 10 (signal)
#0 0x7f99ebd7600b in raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b) (BuildId: 5792732f783158c66fb4f3756458ca24e46e827d)
#1 0x7f99ebd55858 in abort (/lib/x86_64-linux-gnu/libc.so.6+0x22858) (BuildId: 5792732f783158c66fb4f3756458ca24e46e827d)
#2 0x7f99ebd55728 (/lib/x86_64-linux-gnu/libc.so.6+0x22728) (BuildId: 5792732f783158c66fb4f3756458ca24e46e827d)
#3 0x7f99ebd66fd5 in __assert_fail (/lib/x86_64-linux-gnu/libc.so.6+0x33fd5) (BuildId: 5792732f783158c66fb4f3756458ca24e46e827d)
#4 0x5595fa2befa5 in wrapfd_select /src/dropbear/src/../fuzz/fuzz-wrapfd.c:216:5
#5 0x5595fa2c004d in session_loop /src/dropbear/src/common-session.c:210:9
#6 0x5595fa3064a0 in svr_session /src/dropbear/src/svr-session.c:208:2
#7 0x5595fa2bcff1 in fuzz_run_server /src/dropbear/src/../fuzz/fuzz-common.c:287:9
#8 0x5595fa156620 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:614:13
#9 0x5595fa141895 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:327:6
#10 0x5595fa14732f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:862:9
#11 0x5595fa1725d2 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
#12 0x7f99ebd57082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 5792732f783158c66fb4f3756458ca24e46e827d)
#13 0x5595fa139a7d in _start (/out/fuzzer-postauth_nomaths+0x7ea7d)
DEDUP_TOKEN: raise--abort--
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: ABRT (/lib/x86_64-linux-gnu/libc.so.6+0x4300b) (BuildId: 5792732f783158c66fb4f3756458ca24e46e827d) in raise
==18==ABORTING
MS: 0 ; base unit: 0000000000000000000000000000000000000000
subprocess command returned a non-zero exit status: 1"""
output = (
b"/out/fuzzer-postauth_nomaths -rss_limit_mb=2560 -timeout=25 -runs=100 /testcase "
b"-max_len=50000 -timeout_exitcode=0 -dict=fuzzer-postauth_nomaths.dict < /dev/null\n"
b"INFO: found LLVMFuzzerCustomMutator (0x5595fa311560). Disabling -len_control by default.\n"
b"Dictionary: 58 entries\n"
b"INFO: Running with entropic power schedule (0xFF, 100).\n"
b"INFO: Seed: 3932698478\n"
b"INFO: Loaded 1 modules (7459 inline 8-bit counters): 7459 [0x5595fa3cec00, 0x5595fa3d0923),\n"
b"INFO: Loaded 1 PC tables (7459 PCs): 7459 [0x5595fa3d0928,0x5595fa3edb58),\n"
b"/out/fuzzer-postauth_nomaths: Running 1 inputs 100 time(s) each.\n"
b"Running: /testcase\n"
b"Dropbear fuzzer: Disabling stderr output\n"
b"fuzzer-postauth_nomaths: src/../fuzz/fuzz-wrapfd.c:216: "
b"int wrapfd_select(int, fd_set *, fd_set *, fd_set *, struct timeval *): "
b"Assertion `wrap_fds[i].mode != UNUSED' failed.\n"
b"AddressSanitizer:DEADLYSIGNAL\n"
b"=================================================================\n"
b"==18==ERROR: AddressSanitizer: ABRT on unknown address 0x000000000012 "
b"(pc 0x7f99ebd7600b bp 0x7f99ebeeb588 sp 0x7ffe363d6470 T0)\n"
b"SCARINESS: 10 (signal)\n"
b" #0 0x7f99ebd7600b in raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b) "
b"(BuildId: 5792732f783158c66fb4f3756458ca24e46e827d)\n"
b" #1 0x7f99ebd55858 in abort (/lib/x86_64-linux-gnu/libc.so.6+0x22858) "
b"(BuildId: 5792732f783158c66fb4f3756458ca24e46e827d)\n"
b" #2 0x7f99ebd55728 (/lib/x86_64-linux-gnu/libc.so.6+0x22728) "
b"(BuildId: 5792732f783158c66fb4f3756458ca24e46e827d)\n"
b" #3 0x7f99ebd66fd5 in __assert_fail (/lib/x86_64-linux-gnu/libc.so.6+0x33fd5) "
b"(BuildId: 5792732f783158c66fb4f3756458ca24e46e827d)\n"
b" #4 0x5595fa2befa5 in wrapfd_select /src/dropbear/src/../fuzz/fuzz-wrapfd.c:216:5\n"
b" #5 0x5595fa2c004d in session_loop /src/dropbear/src/common-session.c:210:9\n"
b" #6 0x5595fa3064a0 in svr_session /src/dropbear/src/svr-session.c:208:2\n"
b" #7 0x5595fa2bcff1 in fuzz_run_server /src/dropbear/src/../fuzz/fuzz-common.c:287:9\n"
b" #8 0x5595fa156620 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) "
b"/src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:614:13\n"
b" #9 0x5595fa141895 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) "
b"/src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:327:6\n"
b" #10 0x5595fa14732f in fuzzer::FuzzerDriver(int*, char***, "
b"int (*)(unsigned char const*, unsigned long)) "
b"/src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:862:9\n"
b" #11 0x5595fa1725d2 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10\n"
b" #12 0x7f99ebd57082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) "
b"(BuildId: 5792732f783158c66fb4f3756458ca24e46e827d)\n"
b" #13 0x5595fa139a7d in _start (/out/fuzzer-postauth_nomaths+0x7ea7d)\n"
b"\n"
b"DEDUP_TOKEN: raise--abort--\n"
b"AddressSanitizer can not provide additional info.\n"
b"SUMMARY: AddressSanitizer: ABRT (/lib/x86_64-linux-gnu/libc.so.6+0x4300b) "
b"(BuildId: 5792732f783158c66fb4f3756458ca24e46e827d) in raise\n"
b"==18==ABORTING\n"
b"MS: 0 ; base unit: 0000000000000000000000000000000000000000\n"
b"subprocess command returned a non-zero exit status: 1"
)
result8 = ReproduceResult(
command_result=CommandResult(
success=False,
+4 -2
View File
@@ -1,10 +1,12 @@
import pytest
import os
import shutil
import tempfile
from pathlib import Path
from unittest.mock import patch
from buttercup.common.corpus import InputDir, Corpus
import pytest
from buttercup.common.corpus import Corpus, InputDir
@pytest.fixture
+2 -1
View File
@@ -1,7 +1,8 @@
import pytest
from redis import Redis
from buttercup.common.maps import CoverageMap
from buttercup.common.datastructures.msg_pb2 import FunctionCoverage
from buttercup.common.maps import CoverageMap
@pytest.fixture
+1 -1
View File
@@ -3,7 +3,7 @@ import tempfile
import unittest
from unittest.mock import patch
from buttercup.common.clusterfuzz_utils import get_fuzz_targets, EXTRA_BUILD_DIR
from buttercup.common.clusterfuzz_utils import EXTRA_BUILD_DIR, get_fuzz_targets
class TestGetFuzzTargets(unittest.TestCase):
+2 -1
View File
@@ -1,7 +1,8 @@
import pytest
from redis import Redis
from buttercup.common.maps import RedisMap
from buttercup.common.datastructures.msg_pb2 import WeightedHarness
from buttercup.common.maps import RedisMap
@pytest.fixture
+17 -13
View File
@@ -1,9 +1,11 @@
from unittest.mock import MagicMock, patch
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
from buttercup.common.reproduce_multiple import ReproduceMultiple
from buttercup.common.challenge_task import CommandResult, ReproduceResult
from buttercup.common.datastructures.msg_pb2 import BuildOutput
from buttercup.common.challenge_task import ReproduceResult, CommandResult
from buttercup.common.reproduce_multiple import ReproduceMultiple
@pytest.fixture
@@ -17,20 +19,22 @@ def build_outputs():
VALID_STDOUT = b"""
INFO: Running with entropic power schedule (0xFF, 100).
INFO: Seed: 954068278
INFO: Loaded 1 modules (6849 inline 8-bit counters): 6849 [0x561a974abfe8, 0x561a974adaa9),
INFO: Loaded 1 PC tables (6849 PCs): 6849 [0x561a974adab0,0x561a974c86c0),
INFO: Loaded 1 modules (6849 inline 8-bit counters): 6849 [0x561a974abfe8, 0x561a974adaa9),
INFO: Loaded 1 PC tables (6849 PCs): 6849 [0x561a974adab0,0x561a974c86c0),
/out/libpng_read_fuzzer: Running 1 inputs 100 time(s) each.
Running: /testcase
DEBUG - pngrutil.c:1447:10: runtime error:
DEBUG - pngrutil.c:1447:10: runtime error:
"""
INVALID_STDOUT = b"""
Unable to find image \'ghcr.io/aixcc-finals/base-runner:v1.0.0\' locally
docker: Error response from daemon: Get "https://ghcr.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
Run \'docker run --help\' for more information
ERROR:__main__:libpng_read_fuzzer does not seem to exist. Please run build_fuzzers first.
"""
INVALID_STDOUT = (
b"Unable to find image 'ghcr.io/aixcc-finals/base-runner:v1.0.0' locally\n"
b'docker: Error response from daemon: Get "https://ghcr.io/v2/": net/http: '
b"request canceled while waiting for connection "
b"(Client.Timeout exceeded while awaiting headers)\n"
b"\n"
b"Run 'docker run --help' for more information\n"
b"ERROR:__main__:libpng_read_fuzzer does not seem to exist. Please run build_fuzzers first.\n"
)
@pytest.fixture
+17 -13
View File
@@ -1,24 +1,28 @@
from pathlib import Path
import pytest
import os
from unittest.mock import patch, mock_open, MagicMock
from contextlib import contextmanager
from pathlib import Path
from unittest.mock import MagicMock, mock_open, patch
import pytest
from buttercup.common.node_local import (
_get_root_path,
TmpDir,
temp_dir,
rename_atomically,
remote_path as remote_path_func,
remote_archive_path as remote_archive_path_func,
scratch_path,
scratch_dir,
local_scratch_file,
remote_scratch_file,
_get_root_path,
dir_to_remote_archive,
local_scratch_file,
lopen,
remote_scratch_file,
rename_atomically,
scratch_dir,
scratch_path,
temp_dir,
)
from buttercup.common.node_local import (
remote_archive_path as remote_archive_path_func,
)
from buttercup.common.node_local import (
remote_path as remote_path_func,
)
# Use this root path for all tests
TEST_ROOT_PATH = Path("/test/node/data/dir")
+10 -8
View File
@@ -1,17 +1,19 @@
import pytest
import time
from redis import Redis
import pytest
from google.protobuf.struct_pb2 import Struct
from redis import Redis
from buttercup.common.datastructures.msg_pb2 import BuildOutput, BuildRequest
from buttercup.common.queues import (
ReliableQueue,
RQItem,
BUILD_OUTPUT_TASK_TIMEOUT_MS,
BUILD_TASK_TIMEOUT_MS,
GroupNames,
QueueFactory,
QueueNames,
GroupNames,
BUILD_TASK_TIMEOUT_MS,
BUILD_OUTPUT_TASK_TIMEOUT_MS,
ReliableQueue,
RQItem,
)
from buttercup.common.datastructures.msg_pb2 import BuildRequest, BuildOutput
GROUP_NAME = "test_group"
QUEUE_NAME = "test_queue"
+4 -2
View File
@@ -1,7 +1,9 @@
import pytest
import json
import pytest
from redis import Redis
from buttercup.common.sarif_store import SARIFStore, SARIFBroadcastDetail
from buttercup.common.sarif_store import SARIFBroadcastDetail, SARIFStore
@pytest.fixture
+4 -2
View File
@@ -1,8 +1,10 @@
from unittest.mock import MagicMock
import pytest
from redis import Redis
from buttercup.common.sets import RedisSet, PoVReproduceStatus
from buttercup.common.datastructures.msg_pb2 import POVReproduceRequest, POVReproduceResponse
from unittest.mock import MagicMock
from buttercup.common.sets import PoVReproduceStatus, RedisSet
@pytest.fixture
File diff suppressed because one or more lines are too long
+7 -7
View File
@@ -1,11 +1,11 @@
import pytest
from unittest.mock import Mock
from buttercup.common.task_registry import TaskRegistry, CANCELLED_TASKS_SET, SUCCEEDED_TASKS_SET, ERRORED_TASKS_SET
from buttercup.common.datastructures.msg_pb2 import Task, SourceDetail
import time
from typing import Set
from unittest.mock import Mock, patch
import pytest
from redis import Redis
from unittest.mock import patch
from buttercup.common.datastructures.msg_pb2 import SourceDetail, Task
from buttercup.common.task_registry import CANCELLED_TASKS_SET, ERRORED_TASKS_SET, SUCCEEDED_TASKS_SET, TaskRegistry
@pytest.fixture
@@ -432,7 +432,7 @@ def test_get_cancelled_task_ids(task_registry, redis_client):
def test_should_stop_processing_with_cancelled_ids(task_registry, redis_client):
"""Test that should_stop_processing handles cancelled_ids correctly."""
# Create a set of cancelled IDs
cancelled_ids: Set[str] = {"cancelled-task-1", "cancelled-task-2"}
cancelled_ids: set[str] = {"cancelled-task-1", "cancelled-task-2"}
# Create tasks to test with
current_time = int(time.time())
+58 -755
View File
File diff suppressed because it is too large Load Diff
+141
View File
@@ -0,0 +1,141 @@
#!/usr/bin/env python3
"""Fix line length issues in Python files."""
import re
import sys
from pathlib import Path
def split_long_string(line: str, max_length: int = 120) -> list[str]:
"""Split a long string literal or f-string across multiple lines."""
if len(line) <= max_length:
return [line]
# Find the indentation
indent_match = re.match(r'^(\s*)', line)
indent = indent_match.group(1) if indent_match else ''
# Check if it's a logging statement
if 'logger.' in line or 'logging.' in line:
# Handle f-strings in logging
if 'f"' in line or "f'" in line:
# Find the f-string boundaries
string_match = re.search(r'(f["\'])(.*?)(["\'])', line)
if string_match:
prefix = line[:string_match.start()]
quote = string_match.group(1)
content = string_match.group(2)
suffix = line[string_match.end():]
# Split at logical points (| or space near middle)
split_points = []
for match in re.finditer(r' \| | - | ', content):
pos = match.start()
if 40 < pos < len(content) - 40:
split_points.append(pos)
if split_points:
split_at = split_points[len(split_points)//2]
part1 = content[:split_at]
part2 = content[split_at:]
return [
f'{prefix}{quote}{part1}" ',
f'{indent}{quote}{part2}{quote[-1]}{suffix}'
]
# Check if it's a long comment
if line.strip().startswith('#'):
# Split comment at word boundaries
stripped = line.strip()
if len(stripped) > max_length:
words = stripped.split()
lines = []
current = words[0] # Start with '#'
for word in words[1:]:
if len(current + ' ' + word) <= max_length:
current += ' ' + word
else:
lines.append(indent + current)
current = '#' + (' ' * (len(words[0]) - 1)) + word
if current:
lines.append(indent + current)
return lines
# Check if it's a function call with many parameters
if '(' in line and ')' in line:
# Find commas outside of strings
in_string = False
quote_char = None
commas = []
for i, char in enumerate(line):
if char in ('"', "'") and (i == 0 or line[i-1] != '\\'):
if not in_string:
in_string = True
quote_char = char
elif char == quote_char:
in_string = False
quote_char = None
elif char == ',' and not in_string:
commas.append(i)
# Split at a comma near the middle
if commas:
for comma_pos in commas:
if comma_pos > 60:
return [
line[:comma_pos + 1],
indent + ' ' + line[comma_pos + 1:].lstrip()
]
return [line]
def fix_file(file_path: Path) -> int:
"""Fix line length issues in a Python file."""
with open(file_path, 'r') as f:
lines = f.readlines()
new_lines = []
changes = 0
for line in lines:
if len(line.rstrip()) > 120:
split = split_long_string(line.rstrip())
if len(split) > 1:
new_lines.extend([l + '\n' for l in split])
changes += 1
else:
new_lines.append(line)
else:
new_lines.append(line)
if changes > 0:
with open(file_path, 'w') as f:
f.writelines(new_lines)
return changes
def main():
if len(sys.argv) < 2:
print("Usage: python fix_line_lengths.py <file_path> [file_path ...]")
sys.exit(1)
total_changes = 0
for file_arg in sys.argv[1:]:
file_path = Path(file_arg)
if file_path.exists() and file_path.suffix == '.py':
changes = fix_file(file_path)
if changes > 0:
print(f"Fixed {changes} long lines in {file_path}")
total_changes += changes
print(f"Total: Fixed {total_changes} long lines")
if __name__ == "__main__":
main()
+68 -9
View File
@@ -1,19 +1,38 @@
[project]
name = "fuzzing-infra"
version = "0.1.0"
description = ""
authors = [{ name = "Trail of Bits", email = "opensource@trailofbits" }]
requires-python = ">=3.10,<3.13"
description = "Automated vulnerability discovery through intelligent fuzzing"
readme = "README.md"
authors = [{ name = "Trail of Bits", email = "opensource@trailofbits.com" }]
license = "AGPL-3.0"
requires-python = ">=3.12,<3.13"
keywords = ["fuzzing", "oss-fuzz", "libfuzzer", "vulnerability-discovery", "coverage", "cybersecurity"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU Affero General Public License v3",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.12",
"Topic :: Security",
"Topic :: Software Development :: Testing",
"Topic :: Software Development :: Quality Assurance",
"Operating System :: POSIX :: Linux",
]
dependencies = [
"protobuf (>=3.20, <=3.20.3)",
"redis (>=5.2.1,<6.0.0)",
"clusterfuzz==2.6.0",
"redis ~= 5.2.1",
"clusterfuzz == 2.6.0",
"common",
"pydantic-settings>=2.7.1",
"beautifulsoup4>=4.13.3",
"lxml>=5.3.1",
"pydantic-settings ~= 2.7.1",
"beautifulsoup4 >= 4.13.3",
"lxml >= 5.3.1",
]
[project.urls]
Repository = "https://github.com/trailofbits/buttercup"
Issues = "https://github.com/trailofbits/buttercup/issues"
Documentation = "https://github.com/trailofbits/buttercup#readme"
[project.scripts]
buttercup-fuzzer-builder = "buttercup.fuzzing_infra.builder_bot:main"
buttercup-fuzzer = "buttercup.fuzzing_infra.fuzzer_bot:main"
@@ -34,10 +53,50 @@ requires = ["hatchling"]
build-backend = "hatchling.build"
[dependency-groups]
dev = ["pytest>=8.3.4", "ruff>=0.9.2", "mypy>=1.15.0"]
dev = ["pytest ~= 8.3.4", "ruff ~= 0.12.8", "mypy ~= 1.15.0"]
[tool.coverage.run]
source = ["src/buttercup"]
omit = ["*/tests/*", "*/__cli__.py", "*/_cli.py", "*/builder_bot.py", "*/fuzzer_bot.py", "*/coverage_bot.py", "*/tracer_bot.py", "*/corpus_sync.py", "*/corpus_merger.py", "*/utils_cli.py"]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if __name__ == .__main__.:",
"raise NotImplementedError",
"if TYPE_CHECKING:",
]
[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
addopts = "-v --tb=short --strict-markers"
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"integration: marks tests as integration tests",
]
[tool.ruff]
line-length = 120
target-version = "py312"
[tool.ruff.lint]
select = ["E", "F", "I", "W", "UP"]
ignore = ["COM812", "ISC001"] # Formatter conflicts
[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = ["S101", "D"] # Allow asserts, no docstrings in tests
"*/__cli__.py" = ["T201"] # Allow print in CLI modules
"*/builder_bot.py" = ["T201"]
"*/fuzzer_bot.py" = ["T201"]
"*/coverage_bot.py" = ["T201"]
"*/tracer_bot.py" = ["T201"]
"*/corpus_sync.py" = ["T201"]
"*/corpus_merger.py" = ["T201"]
"*/utils_cli.py" = ["T201"]
[tool.mypy]
plugins = ["pydantic.mypy"]
@@ -1,22 +1,21 @@
from buttercup.common.queues import QueueNames, GroupNames
from redis import Redis
from buttercup.common.queues import QueueFactory
from buttercup.common.datastructures.msg_pb2 import BuildType, BuildOutput, BuildRequest
from buttercup.common.logger import setup_package_logger
from dataclasses import dataclass, field
from buttercup.common.queues import ReliableQueue
import logging
import tempfile
from buttercup.common.utils import serve_loop
from buttercup.common.challenge_task import ChallengeTask, ChallengeTaskError
from dataclasses import dataclass, field
from pathlib import Path
from buttercup.fuzzing_infra.settings import BuilderBotSettings
import buttercup.common.node_local as node_local
from buttercup.common.telemetry import init_telemetry
from opentelemetry import trace
from opentelemetry.trace import Status, StatusCode
from buttercup.common.telemetry import set_crs_attributes, CRSActionCategory
from redis import Redis
import buttercup.common.node_local as node_local
from buttercup.common.challenge_task import ChallengeTask, ChallengeTaskError
from buttercup.common.datastructures.msg_pb2 import BuildOutput, BuildRequest, BuildType
from buttercup.common.logger import setup_package_logger
from buttercup.common.queues import GroupNames, QueueFactory, QueueNames, ReliableQueue
from buttercup.common.task_registry import TaskRegistry
from buttercup.common.telemetry import CRSActionCategory, init_telemetry, set_crs_attributes
from buttercup.common.utils import serve_loop
from buttercup.fuzzing_infra.settings import BuilderBotSettings
logger = logging.getLogger(__name__)
@@ -44,13 +43,15 @@ class BuilderBot:
def _apply_challenge_diff(self, task: ChallengeTask, msg: BuildRequest) -> bool:
if msg.apply_diff and task.is_delta_mode():
logger.info(
f"Applying diff for {msg.task_id} | {msg.engine} | {msg.sanitizer} | {BuildType.Name(msg.build_type)} | diff {msg.apply_diff}"
f"Applying diff for {msg.task_id} | {msg.engine} | {msg.sanitizer} | "
f"{BuildType.Name(msg.build_type)} | diff {msg.apply_diff}"
)
try:
res = task.apply_patch_diff()
if not res:
logger.warning(
f"No diffs for {msg.task_id} | {msg.engine} | {msg.sanitizer} | {BuildType.Name(msg.build_type)} | diff {msg.apply_diff}"
f"No diffs for {msg.task_id} | {msg.engine} | {msg.sanitizer} | "
f"{BuildType.Name(msg.build_type)} | diff {msg.apply_diff}"
)
return False
except ChallengeTaskError:
@@ -74,13 +75,15 @@ class BuilderBot:
logger.debug("Patch written to %s", patch_file.name)
logger.info(
f"Applying patch for {msg.task_id} | {msg.engine} | {msg.sanitizer} | {BuildType.Name(msg.build_type)} | diff {msg.apply_diff}"
f"Applying patch for {msg.task_id} | {msg.engine} | {msg.sanitizer} | "
f"{BuildType.Name(msg.build_type)} | diff {msg.apply_diff}"
)
try:
res = task.apply_patch_diff(Path(patch_file.name))
if not res:
logger.info(
f"Failed to apply patch for {msg.task_id} | {msg.engine} | {msg.sanitizer} | {BuildType.Name(msg.build_type)} | diff {msg.apply_diff}"
f"Failed to apply patch for {msg.task_id} | {msg.engine} | {msg.sanitizer} | "
f"{BuildType.Name(msg.build_type)} | diff {msg.apply_diff}"
)
return False
except ChallengeTaskError:
@@ -103,7 +106,8 @@ class BuilderBot:
msg = rqit.deserialized
logger.info(
f"Received build request for {msg.task_id} | {msg.engine} | {msg.sanitizer} | {BuildType.Name(msg.build_type)} | diff {msg.apply_diff}"
f"Received build request for {msg.task_id} | {msg.engine} | {msg.sanitizer} | "
f"{BuildType.Name(msg.build_type)} | diff {msg.apply_diff}"
)
# Check if task should not be processed (expired or cancelled)
@@ -129,7 +133,8 @@ class BuilderBot:
if not self._apply_challenge_diff(task, msg):
if self._build_requests_queue.times_delivered(rqit.item_id) > self.max_tries:
logger.error(
f"Max tries reached for {msg.task_id} | {msg.engine} | {msg.sanitizer} | {BuildType.Name(msg.build_type)} | diff {msg.apply_diff}"
f"Max tries reached for {msg.task_id} | {msg.engine} | {msg.sanitizer} | "
f"{BuildType.Name(msg.build_type)} | diff {msg.apply_diff}"
)
self._build_requests_queue.ack_item(rqit.item_id)
@@ -138,7 +143,9 @@ class BuilderBot:
if not self._apply_patch(task, msg):
if self._build_requests_queue.times_delivered(rqit.item_id) > self.max_tries:
logger.error(
f"Max tries reached for {msg.task_id} | {msg.engine} | {msg.sanitizer} | {BuildType.Name(msg.build_type)} | diff {msg.apply_diff} | patch {msg.internal_patch_id}"
f"Max tries reached for {msg.task_id} | {msg.engine} | {msg.sanitizer} | "
f"{BuildType.Name(msg.build_type)} | diff {msg.apply_diff} | "
f"patch {msg.internal_patch_id}"
)
self._build_requests_queue.ack_item(rqit.item_id)
@@ -159,7 +166,8 @@ class BuilderBot:
if not res.success:
logger.error(
f"Could not build fuzzer {msg.task_id} | {msg.engine} | {msg.sanitizer} | {BuildType.Name(msg.build_type)} | diff {msg.apply_diff}"
f"Could not build fuzzer {msg.task_id} | {msg.engine} | {msg.sanitizer} | "
f"{BuildType.Name(msg.build_type)} | diff {msg.apply_diff}"
)
span.set_status(Status(StatusCode.ERROR))
return True
@@ -168,7 +176,8 @@ class BuilderBot:
task.commit()
logger.info(
f"Pushing build output for {msg.task_id} | {msg.engine} | {msg.sanitizer} | {BuildType.Name(msg.build_type)} | diff {msg.apply_diff}"
f"Pushing build output for {msg.task_id} | {msg.engine} | {msg.sanitizer} | "
f"{BuildType.Name(msg.build_type)} | diff {msg.apply_diff}"
)
node_local.dir_to_remote_archive(task.task_dir)
self._build_outputs_queue.push(
@@ -183,7 +192,8 @@ class BuilderBot:
)
)
logger.info(
f"Acked build request for {msg.task_id} | {msg.engine} | {msg.sanitizer} | {BuildType.Name(msg.build_type)} | diff {msg.apply_diff}"
f"Acked build request for {msg.task_id} | {msg.engine} | {msg.sanitizer} | "
f"{BuildType.Name(msg.build_type)} | diff {msg.apply_diff}"
)
self._build_requests_queue.ack_item(rqit.item_id)
return True
@@ -1,37 +1,35 @@
from buttercup.common import node_local
from buttercup.fuzzing_infra.runner import Runner, Conf, FuzzConfiguration
from dataclasses import dataclass
import os
from buttercup.common.datastructures.msg_pb2 import BuildType, WeightedHarness
from buttercup.common.datastructures.aliases import BuildType as BuildTypeHint
from buttercup.common.corpus import Corpus
from buttercup.common.maps import HarnessWeights, BuildMap
from buttercup.common.utils import serve_loop, setup_periodic_zombie_reaper
from buttercup.common.logger import setup_package_logger
from redis import Redis
from typing import List
from os import PathLike
import random
from buttercup.common.datastructures.msg_pb2 import BuildOutput
import datetime
import logging
from buttercup.common.challenge_task import ChallengeTask
from buttercup.fuzzing_infra.settings import FuzzerBotSettings
from buttercup.common.sets import MergedCorpusSetLock
from buttercup.common.constants import ADDRESS_SANITIZER
from buttercup.common.sets import FailedToAcquireLock
from buttercup.common.sets import MERGING_LOCK_TIMEOUT_SECONDS
from buttercup.common.telemetry import init_telemetry
import os
import random
import shutil
from dataclasses import dataclass
from os import PathLike
from opentelemetry import trace
from opentelemetry.trace import Status, StatusCode
from buttercup.common.telemetry import set_crs_attributes, CRSActionCategory
import datetime
import shutil
from redis import Redis
from buttercup.common import node_local
from buttercup.common.challenge_task import ChallengeTask
from buttercup.common.constants import ADDRESS_SANITIZER
from buttercup.common.corpus import Corpus
from buttercup.common.datastructures.aliases import BuildType as BuildTypeHint
from buttercup.common.datastructures.msg_pb2 import BuildOutput, BuildType, WeightedHarness
from buttercup.common.logger import setup_package_logger
from buttercup.common.maps import BuildMap, HarnessWeights
from buttercup.common.sets import MERGING_LOCK_TIMEOUT_SECONDS, FailedToAcquireLock, MergedCorpusSetLock
from buttercup.common.telemetry import CRSActionCategory, init_telemetry, set_crs_attributes
from buttercup.common.utils import serve_loop, setup_periodic_zombie_reaper
from buttercup.fuzzing_infra.runner import Conf, FuzzConfiguration, Runner
from buttercup.fuzzing_infra.settings import FuzzerBotSettings
logger = logging.getLogger(__name__)
# NOTE: The idea of using three distinct classes to represent the local, remote, and merged corpuses
# is to make the code more readable and easier to understand.
# The BaseCorpus class is used to represent the initial corpus state, before any merge operations have been performed.
# The BaseCorpus class is used to represent the initial corpus state,
# before any merge operations have been performed.
# The PartitionedCorpus class is used to partition the corpus into local and remote parts.
# The FinalCorpus class is used to represent the corpus after the merge operation has been performed.
@@ -202,7 +200,7 @@ class MergerBot:
self.builds = BuildMap(redis)
self.max_local_files = max_local_files
def required_builds(self) -> List[BuildTypeHint]:
def required_builds(self) -> list[BuildTypeHint]:
return [BuildType.FUZZER]
def _run_merge_operation(
@@ -263,7 +261,8 @@ class MergerBot:
},
)
# We specify the remote_dir as the target dir as that will cause any `local_dir` files that adds coverage to be moved to remote_dir.
# We specify the remote_dir as the target dir as that will cause any `local_dir`
# files that adds coverage to be moved to remote_dir.
self.runner.merge_corpus(fuzz_conf, os.fspath(remote_dir))
span.set_status(Status(StatusCode.OK))
@@ -273,7 +272,8 @@ class MergerBot:
Given a task/WeightedHarness, we want to merge the local corpus into the remote corpus if it adds coverage
- acquire a lock on the merged corpus set, if not possible, return and move on to next task
- ensure all of the remotely stored corpus files are available locally
- partition the the local corpus into R and L, where R is the remote corpus and L is the local corpus excluding remote files (L = local_files - remote_files)
- partition the the local corpus into R and L, where R is the remote corpus and L is
the local corpus excluding remote files (L = local_files - remote_files)
- if L is empty the node is up to date, release the lock and move on to next task.
- copy the local corpus into R and L directories respectively
- run merger on R and L, moving files from L to R if they add coverage
@@ -309,12 +309,14 @@ class MergerBot:
# If L is empty, the node is up to date
if not partitioned_corpus.local_only_files:
logger.debug(
f"Skipping merge for {task.harness_name} | {task.package_name} | {task.task_id} because local corpus is up to date"
f"Skipping merge for {task.harness_name} | {task.package_name} | "
f"{task.task_id} because local corpus is up to date"
)
return False # We did not do any work
logger.info(
f"Found {len(partitioned_corpus.local_only_files)} files only in local corpus for {task.harness_name}. Will run merge operation."
f"Found {len(partitioned_corpus.local_only_files)} files only in local corpus "
f"for {task.harness_name}. Will run merge operation."
)
try:
@@ -351,7 +353,8 @@ class MergerBot:
except FailedToAcquireLock:
logger.debug(
f"Skipping merge for {task.harness_name} | {task.package_name} | {task.task_id} because another worker is already merging"
f"Skipping merge for {task.harness_name} | {task.package_name} | {task.task_id} "
f"because another worker is already merging"
)
except Exception as e:
logger.error(f"Error merging corpus: {e}")
@@ -1,27 +1,27 @@
from functools import lru_cache
import logging
import os
import random
from buttercup.common.logger import setup_package_logger
from buttercup.common.default_task_loop import TaskLoop
from buttercup.common.datastructures.msg_pb2 import BuildType, WeightedHarness, FunctionCoverage
from buttercup.common.datastructures.aliases import BuildType as BuildTypeHint
from buttercup.common.maps import CoverageMap
from typing import List, Generator
from redis import Redis
from buttercup.common.datastructures.msg_pb2 import BuildOutput
from buttercup.common.corpus import Corpus
from buttercup.fuzzing_infra.coverage_runner import CoverageRunner, CoveredFunction
from buttercup.fuzzing_infra.settings import CoverageBotSettings
from buttercup.common.challenge_task import ChallengeTask
from buttercup.common.utils import setup_periodic_zombie_reaper
import shutil
import buttercup.common.node_local as node_local
from collections.abc import Generator
from contextlib import contextmanager
from buttercup.common.telemetry import init_telemetry
from functools import lru_cache
from opentelemetry import trace
from opentelemetry.trace import Status, StatusCode
from buttercup.common.telemetry import set_crs_attributes, CRSActionCategory
from redis import Redis
import buttercup.common.node_local as node_local
from buttercup.common.challenge_task import ChallengeTask
from buttercup.common.corpus import Corpus
from buttercup.common.datastructures.aliases import BuildType as BuildTypeHint
from buttercup.common.datastructures.msg_pb2 import BuildOutput, BuildType, FunctionCoverage, WeightedHarness
from buttercup.common.default_task_loop import TaskLoop
from buttercup.common.logger import setup_package_logger
from buttercup.common.maps import CoverageMap
from buttercup.common.telemetry import CRSActionCategory, init_telemetry, set_crs_attributes
from buttercup.common.utils import setup_periodic_zombie_reaper
from buttercup.fuzzing_infra.coverage_runner import CoverageRunner, CoveredFunction
from buttercup.fuzzing_infra.settings import CoverageBotSettings
logger = logging.getLogger(__name__)
@@ -53,7 +53,7 @@ class CoverageBot(TaskLoop):
logger.info(f"Coverage bot initialized with sample_size: {sample_size}")
super().__init__(redis, timer_seconds)
def required_builds(self) -> List[BuildTypeHint]:
def required_builds(self) -> list[BuildTypeHint]:
return [BuildType.COVERAGE]
@contextmanager
@@ -154,7 +154,8 @@ class CoverageBot(TaskLoop):
if func_coverage is None:
logger.error(
f"No function coverage found for {task.harness_name} | {corpus.path} | {local_tsk.project_name}"
f"No function coverage found for {task.harness_name} | {corpus.path} | "
f"{local_tsk.project_name}"
)
span.set_status(Status(StatusCode.ERROR))
return
@@ -162,7 +163,8 @@ class CoverageBot(TaskLoop):
get_processed_coverage(corpus.path).update(remaining_files)
logger.info(
f"Coverage for {task.harness_name} | {corpus.path} | {local_tsk.project_name} | processed {len(func_coverage)} functions"
f"Coverage for {task.harness_name} | {corpus.path} | {local_tsk.project_name} | "
f"processed {len(func_coverage)} functions"
)
self._submit_function_coverage(func_coverage, task.harness_name, task.package_name, task.task_id)
@@ -1,13 +1,15 @@
from buttercup.common.challenge_task import ChallengeTask
import argparse
import subprocess
import json
import logging
import subprocess
from dataclasses import dataclass
from buttercup.common.project_yaml import ProjectYaml, Language
from bs4 import BeautifulSoup, Tag
from typing import Any, cast
from bs4 import BeautifulSoup, Tag
from buttercup.common.challenge_task import ChallengeTask
from buttercup.common.project_yaml import Language, ProjectYaml
logger = logging.getLogger(__name__)
@@ -105,12 +107,13 @@ class CoverageRunner:
jacoco_path = build_dir / "dumps" / f"{harness_name}.xml"
if not jacoco_path.exists():
logger.error(
f"Failed to find jacoco file for {harness_name} | {corpus_dir} | {self.tool.project_name} | in {jacoco_path}"
f"Failed to find jacoco file for {harness_name} | {corpus_dir} | "
f"{self.tool.project_name} | in {jacoco_path}"
)
return None
# parse the jacoco file
with open(jacoco_path, "r") as f:
with open(jacoco_path) as f:
soup = BeautifulSoup(f, "xml")
covered_functions = []
for target_class in soup.find_all("class"):
@@ -155,7 +158,8 @@ class CoverageRunner:
profdata_path = package_path / "dumps" / "merged.profdata"
if not profdata_path.exists():
logger.error(
f"Failed to find profdata for {harness_name} | {corpus_dir} | {self.tool.project_name} | in {profdata_path}"
f"Failed to find profdata for {harness_name} | {corpus_dir} | "
f"{self.tool.project_name} | in {profdata_path}"
)
return None
@@ -1,26 +1,26 @@
from buttercup.fuzzing_infra.runner import Runner, Conf, FuzzConfiguration
from buttercup.common.datastructures.msg_pb2 import BuildType, WeightedHarness, Crash
from buttercup.common.datastructures.aliases import BuildType as BuildTypeHint
from buttercup.common.queues import QueueFactory, QueueNames
from buttercup.common.corpus import Corpus, CrashDir
from buttercup.common import stack_parsing
from buttercup.common.stack_parsing import CrashSet
from buttercup.common.logger import setup_package_logger
from buttercup.common.utils import setup_periodic_zombie_reaper
from redis import Redis
from clusterfuzz.fuzz import engine
from buttercup.common.default_task_loop import TaskLoop
from typing import List
import random
from buttercup.common.datastructures.msg_pb2 import BuildOutput
import logging
from buttercup.common.challenge_task import ChallengeTask
from buttercup.fuzzing_infra.settings import FuzzerBotSettings
from buttercup.common.telemetry import init_telemetry, CRSActionCategory, set_crs_attributes
import random
from pathlib import Path
from clusterfuzz.fuzz import engine
from opentelemetry import trace
from opentelemetry.trace.status import Status, StatusCode
from redis import Redis
from buttercup.common import stack_parsing
from buttercup.common.challenge_task import ChallengeTask
from buttercup.common.corpus import Corpus, CrashDir
from buttercup.common.datastructures.aliases import BuildType as BuildTypeHint
from buttercup.common.datastructures.msg_pb2 import BuildOutput, BuildType, Crash, WeightedHarness
from buttercup.common.default_task_loop import TaskLoop
from buttercup.common.logger import setup_package_logger
from buttercup.common.node_local import scratch_dir
from pathlib import Path
from buttercup.common.queues import QueueFactory, QueueNames
from buttercup.common.stack_parsing import CrashSet
from buttercup.common.telemetry import CRSActionCategory, init_telemetry, set_crs_attributes
from buttercup.common.utils import setup_periodic_zombie_reaper
from buttercup.fuzzing_infra.runner import Conf, FuzzConfiguration, Runner
from buttercup.fuzzing_infra.settings import FuzzerBotSettings
logger = logging.getLogger(__name__)
@@ -44,7 +44,7 @@ class FuzzerBot(TaskLoop):
self.max_pov_size = max_pov_size
super().__init__(redis, timer_seconds)
def required_builds(self) -> List[BuildTypeHint]:
def required_builds(self) -> list[BuildTypeHint]:
return [BuildType.FUZZER]
def run_task(self, task: WeightedHarness, builds: dict[BuildTypeHint, BuildOutput]) -> None:
@@ -1,19 +1,20 @@
import argparse
import os
import time
from redis import Redis
from buttercup.common.clusterfuzz_utils import get_fuzz_targets
from buttercup.common.datastructures.msg_pb2 import BuildOutput, BuildType, WeightedHarness
from buttercup.common.logger import setup_package_logger
from buttercup.common.maps import BuildMap, HarnessWeights
from buttercup.common.queues import (
ReliableQueue,
RQItem,
GroupNames,
QueueFactory,
QueueNames,
GroupNames,
ReliableQueue,
RQItem,
)
from buttercup.common.maps import HarnessWeights, BuildMap
import argparse
from redis import Redis
from buttercup.common.datastructures.msg_pb2 import BuildType, BuildOutput, WeightedHarness
import time
from buttercup.common.clusterfuzz_utils import get_fuzz_targets
import os
from buttercup.common.logger import setup_package_logger
logger = setup_package_logger("fuzzer-orchestrator", __name__)
DEFAULT_WEIGHT = 1.0
+10 -8
View File
@@ -1,15 +1,17 @@
import argparse
import logging
import os
import typing
import uuid
from dataclasses import dataclass
from clusterfuzz.fuzz import get_engine
from clusterfuzz.fuzz.engine import Engine, FuzzResult, FuzzOptions
from buttercup.common.queues import FuzzConfiguration
from clusterfuzz.fuzz.engine import Engine, FuzzOptions, FuzzResult
from buttercup.common.logger import setup_package_logger
from buttercup.common.node_local import scratch_dir
from buttercup.common.queues import FuzzConfiguration
from buttercup.fuzzing_infra.temp_dir import patched_temp_dir, scratch_cwd
import typing
import os
from dataclasses import dataclass
import argparse
import uuid
import logging
logger = logging.getLogger(__name__)
@@ -1,7 +1,8 @@
from pydantic_settings import BaseSettings
from pydantic import Field
from typing import Annotated
from pydantic import Field
from pydantic_settings import BaseSettings
class Config:
cli_parse_args = True
@@ -1,7 +1,9 @@
import argparse
from redis import Redis
from buttercup.common.queues import QueueFactory, QueueNames
from buttercup.common.datastructures.msg_pb2 import BuildRequest, BuildType
from buttercup.common.queues import QueueFactory, QueueNames
def main() -> None:
@@ -1,12 +1,14 @@
import os
import tempfile
import contextvars
import logging
import os
import tempfile
from collections.abc import Iterator
from contextlib import contextmanager
from typing import Iterator
from unittest.mock import patch
from clusterfuzz._internal.system import environment, shell
from buttercup.common.node_local import scratch_dir, TmpDir
from buttercup.common.node_local import TmpDir, scratch_dir
logger = logging.getLogger(__name__)
@@ -1,17 +1,19 @@
import logging
import os
from pathlib import Path
from redis import Redis
import buttercup.common.node_local as node_local
from buttercup.common import stack_parsing
from buttercup.common.datastructures.msg_pb2 import TracedCrash
from buttercup.common.logger import setup_package_logger
from buttercup.common.queues import GroupNames, QueueFactory, QueueNames
from buttercup.common.task_registry import TaskRegistry
from buttercup.common.telemetry import init_telemetry
from buttercup.common.utils import serve_loop, setup_periodic_zombie_reaper
from buttercup.fuzzing_infra.settings import TracerSettings
from buttercup.fuzzing_infra.tracer_runner import TracerRunner
from buttercup.common.logger import setup_package_logger
import os
import logging
from redis import Redis
from buttercup.common.queues import QueueFactory, QueueNames, GroupNames
from buttercup.common.datastructures.msg_pb2 import TracedCrash
from buttercup.common.task_registry import TaskRegistry
from pathlib import Path
from buttercup.common import stack_parsing
from buttercup.common.utils import serve_loop, setup_periodic_zombie_reaper
import buttercup.common.node_local as node_local
from buttercup.common.telemetry import init_telemetry
logger = logging.getLogger(__name__)
@@ -1,13 +1,15 @@
from buttercup.common.maps import BuildMap
from buttercup.common.challenge_task import ChallengeTask, ReproduceResult
from buttercup.common.datastructures.msg_pb2 import BuildType
from pathlib import Path
from dataclasses import dataclass
import logging
from redis import Redis
from dataclasses import dataclass
from pathlib import Path
from opentelemetry import trace
from opentelemetry.trace import Status, StatusCode
from buttercup.common.telemetry import set_crs_attributes, CRSActionCategory
from redis import Redis
from buttercup.common.challenge_task import ChallengeTask, ReproduceResult
from buttercup.common.datastructures.msg_pb2 import BuildType
from buttercup.common.maps import BuildMap
from buttercup.common.telemetry import CRSActionCategory, set_crs_attributes
logger = logging.getLogger(__name__)
@@ -3,7 +3,6 @@
import argparse
import sys
from pathlib import Path
from typing import Optional
from buttercup.common.stack_parsing import get_crash_data
@@ -32,7 +31,7 @@ def parse_args() -> argparse.Namespace:
return parser.parse_args()
def read_stacktrace(file_path: Optional[Path] = None) -> str:
def read_stacktrace(file_path: Path | None = None) -> str:
"""Read stacktrace from file or stdin."""
if file_path:
return file_path.read_text()
+5 -4
View File
@@ -1,11 +1,12 @@
import unittest
from unittest.mock import Mock, patch, MagicMock
from redis import Redis
from pathlib import Path
from unittest.mock import MagicMock, Mock, patch
from buttercup.fuzzing_infra.builder_bot import BuilderBot
from buttercup.common.datastructures.msg_pb2 import BuildRequest, BuildOutput, BuildType
from redis import Redis
from buttercup.common.datastructures.msg_pb2 import BuildOutput, BuildRequest, BuildType
from buttercup.common.task_registry import TaskRegistry
from buttercup.fuzzing_infra.builder_bot import BuilderBot
class TestBuilderBot(unittest.TestCase):
+6 -4
View File
@@ -1,12 +1,14 @@
import pytest
import os
import tempfile
from unittest.mock import patch, MagicMock
from unittest.mock import MagicMock, patch
import pytest
from redis import Redis
from buttercup.common.datastructures.msg_pb2 import FunctionCoverage
from buttercup.common.maps import CoverageMap
from buttercup.fuzzing_infra.coverage_bot import CoverageBot
from buttercup.fuzzing_infra.coverage_runner import CoveredFunction
from buttercup.common.maps import CoverageMap
from buttercup.common.datastructures.msg_pb2 import FunctionCoverage
@pytest.fixture
+10 -7
View File
@@ -1,12 +1,13 @@
import unittest
from unittest.mock import Mock, patch, MagicMock
from redis import Redis
from pathlib import Path
from unittest.mock import MagicMock, Mock, patch
from redis import Redis
from buttercup.fuzzing_infra.corpus_merger import MergerBot, BaseCorpus, PartitionedCorpus
from buttercup.common.datastructures.msg_pb2 import WeightedHarness, BuildOutput
from buttercup.common.sets import FailedToAcquireLock
from buttercup.common.constants import ADDRESS_SANITIZER
from buttercup.common.datastructures.msg_pb2 import BuildOutput, WeightedHarness
from buttercup.common.sets import FailedToAcquireLock
from buttercup.fuzzing_infra.corpus_merger import BaseCorpus, MergerBot, PartitionedCorpus
class TestMergerBot(unittest.TestCase):
@@ -486,7 +487,8 @@ class TestPartitionedCorpus(unittest.TestCase):
def test_initialization_remote_file_missing(
self, path_exists_mock, path_join_mock, shutil_copy_mock, scratch_dir_mock, corpus_mock
):
"""Test that when a file is missing from corpus.path but available in corpus.remote_path, it's copied from remote."""
"""Test that when a file is missing from corpus.path but available in corpus.remote_path,
it's copied from remote."""
# Setup mocks
corpus_instance = corpus_mock.return_value
corpus_instance.path = "/corpus/path"
@@ -515,7 +517,8 @@ class TestPartitionedCorpus(unittest.TestCase):
# Mock shutil.copy to fail for the first call to a specific file, then succeed for the second call
def mock_copy(src, dst):
# For a specific file in remote_files, fail on first attempt (corpus.path) but succeed on second (corpus.remote_path)
# For a specific file in remote_files, fail on first attempt (corpus.path)
# but succeed on second (corpus.remote_path)
if "missing_remote" in src:
if "/corpus/path/" in src:
raise FileNotFoundError(f"File not found in local corpus: {src}")
+2 -2
View File
@@ -3,9 +3,9 @@ import tempfile
import threading
import time
import unittest
from unittest.mock import patch, MagicMock
from unittest.mock import MagicMock, patch
from buttercup.fuzzing_infra.temp_dir import get_temp_dir, patched_temp_dir, _scratch_path_var
from buttercup.fuzzing_infra.temp_dir import _scratch_path_var, get_temp_dir, patched_temp_dir
class TestGetTempDir(unittest.TestCase):
+8 -6
View File
@@ -1,10 +1,12 @@
import pytest
from unittest.mock import patch, MagicMock
from redis import Redis
from buttercup.fuzzing_infra.tracer_bot import TracerBot
from buttercup.common.datastructures.msg_pb2 import Crash, Task, BuildOutput
from buttercup.common.task_registry import TaskRegistry
import time
from unittest.mock import MagicMock, patch
import pytest
from redis import Redis
from buttercup.common.datastructures.msg_pb2 import BuildOutput, Crash, Task
from buttercup.common.task_registry import TaskRegistry
from buttercup.fuzzing_infra.tracer_bot import TracerBot
@pytest.fixture
+63 -782
View File
File diff suppressed because it is too large Load Diff
+84 -31
View File
@@ -1,26 +1,44 @@
[project]
name = "orchestrator"
version = "0.5.0"
description = "Buttercup orchestrator"
description = "Central coordination and task management for Buttercup CRS"
readme = "README.md"
authors = [{ name = "Trail of Bits", email = "opensource@trailofbits.com" }]
license = "AGPL-3.0"
requires-python = ">=3.12,<3.13"
dependencies = [
"argon2-cffi>=21.0.0",
"common",
"fastapi>=0.115.6",
"pydantic>=2.10.5",
"pydantic-settings>=2.7.1",
"python-dateutil>=2.9.0.post0",
"pyyaml>=6.0.1",
"requests>=2.32.3",
"requests-file>=2.1.0",
"rich>=13.9.4",
"sqlalchemy>=2.0.0",
"typing-extensions>=4.12.2",
"urllib3>=2.3.0",
"uvicorn>=0.34.0",
keywords = ["orchestration", "task-management", "scheduler", "api", "fastapi", "cybersecurity"]
classifiers = [
"Development Status :: 4 - Beta",
"Framework :: FastAPI",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU Affero General Public License v3",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.12",
"Topic :: Security",
"Topic :: System :: Distributed Computing",
"Operating System :: POSIX :: Linux",
]
dependencies = [
"argon2-cffi ~= 21.3.0",
"common",
"fastapi ~= 0.115.6",
"pydantic ~= 2.10.5",
"pydantic-settings ~= 2.7.1",
"python-dateutil ~= 2.9.0",
"pyyaml ~= 6.0.1",
"requests ~= 2.32.3",
"requests-file ~= 2.1.0",
"rich >= 13.9.4",
"sqlalchemy ~= 2.0.0",
"typing-extensions >= 4.12.2",
"urllib3 ~= 2.3.0",
"uvicorn ~= 0.34.0",
]
[project.urls]
Repository = "https://github.com/trailofbits/buttercup"
Issues = "https://github.com/trailofbits/buttercup/issues"
Documentation = "https://github.com/trailofbits/buttercup#readme"
[project.scripts]
buttercup-task-server = "buttercup.orchestrator.task_server.__cli__:main"
@@ -32,21 +50,21 @@ buttercup-scratch-cleaner = "buttercup.orchestrator.scratch_cleaner.__cli__:main
buttercup-ui = "buttercup.orchestrator.ui.__cli__:main"
[project.optional-dependencies]
tests = [
"flake8>=7.1.1",
"mypy>=1.15.0",
"pytest>=8.3.4",
"pytest-asyncio>=0.25.2",
"pytest-cov>=6.0.0",
"pytest-xdist>=3.6.1",
"ruff>=0.9.2",
"types-python-dateutil>=2.9.0.20241206",
"types-requests>=2.32.0",
"types-redis>=4.6.0",
"fastapi[standard]>=0.115.6",
"responses>=0.25.6",
"httpx>=0.28.1",
[dependency-groups]
dev = [
"flake8 ~= 7.1.1",
"mypy ~= 1.15.0",
"pytest ~= 8.3.4",
"pytest-asyncio ~= 0.25.2",
"pytest-cov ~= 6.0.0",
"pytest-xdist ~= 3.6.1",
"ruff ~= 0.12.8",
"types-python-dateutil ~= 2.9.0.20241206",
"types-requests ~= 2.32.0",
"types-redis ~= 4.6.0",
"fastapi[standard] ~= 0.115.6",
"responses ~= 0.25.6",
"httpx ~= 0.28.1",
]
[build-system]
@@ -59,8 +77,33 @@ packages = ["src/buttercup"]
[tool.uv.sources]
common = { path = "../common", editable = true }
[tool.coverage.run]
source = ["src/buttercup"]
omit = ["*/tests/*", "*/__cli__.py", "*/_cli.py", "*/auth_tool.py"]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if __name__ == .__main__.:",
"raise NotImplementedError",
"if TYPE_CHECKING:",
]
[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
addopts = "-v --tb=short --strict-markers"
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"integration: marks tests as integration tests",
]
[tool.ruff]
line-length = 120
target-version = "py312"
exclude = [
"src/buttercup/orchestrator/competition_api_client",
"test/test_types_*.py",
@@ -70,6 +113,16 @@ exclude = [
"src/buttercup/orchestrator/task_server/models/",
]
[tool.ruff.lint]
select = ["E", "F", "I", "W", "UP"]
ignore = ["COM812", "ISC001"] # Formatter conflicts
[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = ["S101", "D"] # Allow asserts, no docstrings in tests
"test/test_submissions.py" = ["S101", "D", "UP045"] # UP045: Protobuf enums don't support | operator
"*/__cli__.py" = ["T201"] # Allow print in CLI modules
"*/auth_tool.py" = ["T201"]
[tool.mypy]
plugins = ["pydantic.mypy"]
mypy_path = "src"
+1 -1
View File
@@ -2,9 +2,9 @@
import argparse
import json
import sys
import time
import urllib.request
import sys
from typing import Any
SECONDS = 1
@@ -1,6 +1,7 @@
import logging
from buttercup.orchestrator.competition_api_client.configuration import Configuration
from buttercup.orchestrator.competition_api_client.api_client import ApiClient
from buttercup.orchestrator.competition_api_client.configuration import Configuration
logger = logging.getLogger(__name__)
@@ -3,14 +3,14 @@
# flake8: noqa
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
@@ -60,7 +60,9 @@ __all__ = [
]
# import apis into sdk package
from buttercup.orchestrator.competition_api_client.api.broadcast_sarif_assessment_api import BroadcastSarifAssessmentApi as BroadcastSarifAssessmentApi
from buttercup.orchestrator.competition_api_client.api.broadcast_sarif_assessment_api import (
BroadcastSarifAssessmentApi as BroadcastSarifAssessmentApi,
)
from buttercup.orchestrator.competition_api_client.api.bundle_api import BundleApi as BundleApi
from buttercup.orchestrator.competition_api_client.api.freeform_api import FreeformApi as FreeformApi
from buttercup.orchestrator.competition_api_client.api.patch_api import PatchApi as PatchApi
@@ -81,25 +83,63 @@ from buttercup.orchestrator.competition_api_client.exceptions import ApiAttribut
from buttercup.orchestrator.competition_api_client.exceptions import ApiException as ApiException
# import models into sdk package
from buttercup.orchestrator.competition_api_client.models.types_architecture import TypesArchitecture as TypesArchitecture
from buttercup.orchestrator.competition_api_client.models.types_architecture import (
TypesArchitecture as TypesArchitecture,
)
from buttercup.orchestrator.competition_api_client.models.types_assessment import TypesAssessment as TypesAssessment
from buttercup.orchestrator.competition_api_client.models.types_bundle_submission import TypesBundleSubmission as TypesBundleSubmission
from buttercup.orchestrator.competition_api_client.models.types_bundle_submission_response import TypesBundleSubmissionResponse as TypesBundleSubmissionResponse
from buttercup.orchestrator.competition_api_client.models.types_bundle_submission_response_verbose import TypesBundleSubmissionResponseVerbose as TypesBundleSubmissionResponseVerbose
from buttercup.orchestrator.competition_api_client.models.types_bundle_submission import (
TypesBundleSubmission as TypesBundleSubmission,
)
from buttercup.orchestrator.competition_api_client.models.types_bundle_submission_response import (
TypesBundleSubmissionResponse as TypesBundleSubmissionResponse,
)
from buttercup.orchestrator.competition_api_client.models.types_bundle_submission_response_verbose import (
TypesBundleSubmissionResponseVerbose as TypesBundleSubmissionResponseVerbose,
)
from buttercup.orchestrator.competition_api_client.models.types_error import TypesError as TypesError
from buttercup.orchestrator.competition_api_client.models.types_freeform_response import TypesFreeformResponse as TypesFreeformResponse
from buttercup.orchestrator.competition_api_client.models.types_freeform_submission import TypesFreeformSubmission as TypesFreeformSubmission
from buttercup.orchestrator.competition_api_client.models.types_fuzzing_engine import TypesFuzzingEngine as TypesFuzzingEngine
from buttercup.orchestrator.competition_api_client.models.types_freeform_response import (
TypesFreeformResponse as TypesFreeformResponse,
)
from buttercup.orchestrator.competition_api_client.models.types_freeform_submission import (
TypesFreeformSubmission as TypesFreeformSubmission,
)
from buttercup.orchestrator.competition_api_client.models.types_fuzzing_engine import (
TypesFuzzingEngine as TypesFuzzingEngine,
)
from buttercup.orchestrator.competition_api_client.models.types_message import TypesMessage as TypesMessage
from buttercup.orchestrator.competition_api_client.models.types_pov_submission import TypesPOVSubmission as TypesPOVSubmission
from buttercup.orchestrator.competition_api_client.models.types_pov_submission_response import TypesPOVSubmissionResponse as TypesPOVSubmissionResponse
from buttercup.orchestrator.competition_api_client.models.types_patch_submission import TypesPatchSubmission as TypesPatchSubmission
from buttercup.orchestrator.competition_api_client.models.types_patch_submission_response import TypesPatchSubmissionResponse as TypesPatchSubmissionResponse
from buttercup.orchestrator.competition_api_client.models.types_ping_response import TypesPingResponse as TypesPingResponse
from buttercup.orchestrator.competition_api_client.models.types_request_list_response import TypesRequestListResponse as TypesRequestListResponse
from buttercup.orchestrator.competition_api_client.models.types_request_submission import TypesRequestSubmission as TypesRequestSubmission
from buttercup.orchestrator.competition_api_client.models.types_sarif_submission import TypesSARIFSubmission as TypesSARIFSubmission
from buttercup.orchestrator.competition_api_client.models.types_sarif_submission_response import TypesSARIFSubmissionResponse as TypesSARIFSubmissionResponse
from buttercup.orchestrator.competition_api_client.models.types_sarif_assessment_response import TypesSarifAssessmentResponse as TypesSarifAssessmentResponse
from buttercup.orchestrator.competition_api_client.models.types_sarif_assessment_submission import TypesSarifAssessmentSubmission as TypesSarifAssessmentSubmission
from buttercup.orchestrator.competition_api_client.models.types_submission_status import TypesSubmissionStatus as TypesSubmissionStatus
from buttercup.orchestrator.competition_api_client.models.types_pov_submission import (
TypesPOVSubmission as TypesPOVSubmission,
)
from buttercup.orchestrator.competition_api_client.models.types_pov_submission_response import (
TypesPOVSubmissionResponse as TypesPOVSubmissionResponse,
)
from buttercup.orchestrator.competition_api_client.models.types_patch_submission import (
TypesPatchSubmission as TypesPatchSubmission,
)
from buttercup.orchestrator.competition_api_client.models.types_patch_submission_response import (
TypesPatchSubmissionResponse as TypesPatchSubmissionResponse,
)
from buttercup.orchestrator.competition_api_client.models.types_ping_response import (
TypesPingResponse as TypesPingResponse,
)
from buttercup.orchestrator.competition_api_client.models.types_request_list_response import (
TypesRequestListResponse as TypesRequestListResponse,
)
from buttercup.orchestrator.competition_api_client.models.types_request_submission import (
TypesRequestSubmission as TypesRequestSubmission,
)
from buttercup.orchestrator.competition_api_client.models.types_sarif_submission import (
TypesSARIFSubmission as TypesSARIFSubmission,
)
from buttercup.orchestrator.competition_api_client.models.types_sarif_submission_response import (
TypesSARIFSubmissionResponse as TypesSARIFSubmissionResponse,
)
from buttercup.orchestrator.competition_api_client.models.types_sarif_assessment_response import (
TypesSarifAssessmentResponse as TypesSarifAssessmentResponse,
)
from buttercup.orchestrator.competition_api_client.models.types_sarif_assessment_submission import (
TypesSarifAssessmentSubmission as TypesSarifAssessmentSubmission,
)
from buttercup.orchestrator.competition_api_client.models.types_submission_status import (
TypesSubmissionStatus as TypesSubmissionStatus,
)
@@ -9,4 +9,3 @@ from buttercup.orchestrator.competition_api_client.api.ping_api import PingApi
from buttercup.orchestrator.competition_api_client.api.pov_api import PovApi
from buttercup.orchestrator.competition_api_client.api.request_api import RequestApi
from buttercup.orchestrator.competition_api_client.api.submitted_sarif_api import SubmittedSarifApi
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
import warnings
@@ -18,8 +18,12 @@ from typing_extensions import Annotated
from pydantic import Field, StrictStr
from typing_extensions import Annotated
from buttercup.orchestrator.competition_api_client.models.types_sarif_assessment_response import TypesSarifAssessmentResponse
from buttercup.orchestrator.competition_api_client.models.types_sarif_assessment_submission import TypesSarifAssessmentSubmission
from buttercup.orchestrator.competition_api_client.models.types_sarif_assessment_response import (
TypesSarifAssessmentResponse,
)
from buttercup.orchestrator.competition_api_client.models.types_sarif_assessment_submission import (
TypesSarifAssessmentSubmission,
)
from buttercup.orchestrator.competition_api_client.api_client import ApiClient, RequestSerialized
from buttercup.orchestrator.competition_api_client.api_response import ApiResponse
@@ -38,7 +42,6 @@ class BroadcastSarifAssessmentApi:
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_call
def v1_task_task_id_broadcast_sarif_assessment_broadcast_sarif_id_post(
self,
@@ -48,10 +51,7 @@ class BroadcastSarifAssessmentApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -88,7 +88,7 @@ class BroadcastSarifAssessmentApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_broadcast_sarif_assessment_broadcast_sarif_id_post_serialize(
task_id=task_id,
@@ -97,27 +97,23 @@ class BroadcastSarifAssessmentApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesSarifAssessmentResponse",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesSarifAssessmentResponse",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def v1_task_task_id_broadcast_sarif_assessment_broadcast_sarif_id_post_with_http_info(
self,
@@ -127,10 +123,7 @@ class BroadcastSarifAssessmentApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -167,7 +160,7 @@ class BroadcastSarifAssessmentApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_broadcast_sarif_assessment_broadcast_sarif_id_post_serialize(
task_id=task_id,
@@ -176,27 +169,23 @@ class BroadcastSarifAssessmentApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesSarifAssessmentResponse",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesSarifAssessmentResponse",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def v1_task_task_id_broadcast_sarif_assessment_broadcast_sarif_id_post_without_preload_content(
self,
@@ -206,10 +195,7 @@ class BroadcastSarifAssessmentApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -246,7 +232,7 @@ class BroadcastSarifAssessmentApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_broadcast_sarif_assessment_broadcast_sarif_id_post_serialize(
task_id=task_id,
@@ -255,23 +241,19 @@ class BroadcastSarifAssessmentApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesSarifAssessmentResponse",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesSarifAssessmentResponse",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
return response_data.response
def _v1_task_task_id_broadcast_sarif_assessment_broadcast_sarif_id_post_serialize(
self,
task_id,
@@ -285,23 +267,20 @@ class BroadcastSarifAssessmentApi:
_host = None
_collection_formats: Dict[str, str] = {
}
_collection_formats: Dict[str, str] = {}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if task_id is not None:
_path_params['task_id'] = task_id
_path_params["task_id"] = task_id
if broadcast_sarif_id is not None:
_path_params['broadcast_sarif_id'] = broadcast_sarif_id
_path_params["broadcast_sarif_id"] = broadcast_sarif_id
# process the query parameters
# process the header parameters
# process the form parameters
@@ -309,37 +288,24 @@ class BroadcastSarifAssessmentApi:
if payload is not None:
_body_params = payload
# set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if "Accept" not in _header_params:
_header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
# set the HTTP header `Content-Type`
if _content_type:
_header_params['Content-Type'] = _content_type
_header_params["Content-Type"] = _content_type
else:
_default_content_type = (
self.api_client.select_header_content_type(
[
'application/json'
]
)
)
_default_content_type = self.api_client.select_header_content_type(["application/json"])
if _default_content_type is not None:
_header_params['Content-Type'] = _default_content_type
_header_params["Content-Type"] = _default_content_type
# authentication setting
_auth_settings: List[str] = [
'BasicAuth'
]
_auth_settings: List[str] = ["BasicAuth"]
return self.api_client.param_serialize(
method='POST',
resource_path='/v1/task/{task_id}/broadcast-sarif-assessment/{broadcast_sarif_id}/',
method="POST",
resource_path="/v1/task/{task_id}/broadcast-sarif-assessment/{broadcast_sarif_id}/",
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -349,7 +315,5 @@ class BroadcastSarifAssessmentApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
_request_auth=_request_auth,
)
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
import warnings
@@ -19,8 +19,12 @@ from typing_extensions import Annotated
from pydantic import Field, StrictStr
from typing_extensions import Annotated
from buttercup.orchestrator.competition_api_client.models.types_bundle_submission import TypesBundleSubmission
from buttercup.orchestrator.competition_api_client.models.types_bundle_submission_response import TypesBundleSubmissionResponse
from buttercup.orchestrator.competition_api_client.models.types_bundle_submission_response_verbose import TypesBundleSubmissionResponseVerbose
from buttercup.orchestrator.competition_api_client.models.types_bundle_submission_response import (
TypesBundleSubmissionResponse,
)
from buttercup.orchestrator.competition_api_client.models.types_bundle_submission_response_verbose import (
TypesBundleSubmissionResponseVerbose,
)
from buttercup.orchestrator.competition_api_client.api_client import ApiClient, RequestSerialized
from buttercup.orchestrator.competition_api_client.api_response import ApiResponse
@@ -39,7 +43,6 @@ class BundleApi:
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_call
def v1_task_task_id_bundle_bundle_id_delete(
self,
@@ -48,10 +51,7 @@ class BundleApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -86,7 +86,7 @@ class BundleApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_bundle_bundle_id_delete_serialize(
task_id=task_id,
@@ -94,27 +94,23 @@ class BundleApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'204': "str",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"204": "str",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def v1_task_task_id_bundle_bundle_id_delete_with_http_info(
self,
@@ -123,10 +119,7 @@ class BundleApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -161,7 +154,7 @@ class BundleApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_bundle_bundle_id_delete_serialize(
task_id=task_id,
@@ -169,27 +162,23 @@ class BundleApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'204': "str",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"204": "str",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def v1_task_task_id_bundle_bundle_id_delete_without_preload_content(
self,
@@ -198,10 +187,7 @@ class BundleApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -236,7 +222,7 @@ class BundleApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_bundle_bundle_id_delete_serialize(
task_id=task_id,
@@ -244,23 +230,19 @@ class BundleApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'204': "str",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"204": "str",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
return response_data.response
def _v1_task_task_id_bundle_bundle_id_delete_serialize(
self,
task_id,
@@ -273,46 +255,35 @@ class BundleApi:
_host = None
_collection_formats: Dict[str, str] = {
}
_collection_formats: Dict[str, str] = {}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if task_id is not None:
_path_params['task_id'] = task_id
_path_params["task_id"] = task_id
if bundle_id is not None:
_path_params['bundle_id'] = bundle_id
_path_params["bundle_id"] = bundle_id
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if "Accept" not in _header_params:
_header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
# authentication setting
_auth_settings: List[str] = [
'BasicAuth'
]
_auth_settings: List[str] = ["BasicAuth"]
return self.api_client.param_serialize(
method='DELETE',
resource_path='/v1/task/{task_id}/bundle/{bundle_id}/',
method="DELETE",
resource_path="/v1/task/{task_id}/bundle/{bundle_id}/",
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -322,12 +293,9 @@ class BundleApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
_request_auth=_request_auth,
)
@validate_call
def v1_task_task_id_bundle_bundle_id_get(
self,
@@ -336,10 +304,7 @@ class BundleApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -374,7 +339,7 @@ class BundleApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_bundle_bundle_id_get_serialize(
task_id=task_id,
@@ -382,27 +347,23 @@ class BundleApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesBundleSubmissionResponseVerbose",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesBundleSubmissionResponseVerbose",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def v1_task_task_id_bundle_bundle_id_get_with_http_info(
self,
@@ -411,10 +372,7 @@ class BundleApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -449,7 +407,7 @@ class BundleApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_bundle_bundle_id_get_serialize(
task_id=task_id,
@@ -457,27 +415,23 @@ class BundleApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesBundleSubmissionResponseVerbose",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesBundleSubmissionResponseVerbose",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def v1_task_task_id_bundle_bundle_id_get_without_preload_content(
self,
@@ -486,10 +440,7 @@ class BundleApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -524,7 +475,7 @@ class BundleApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_bundle_bundle_id_get_serialize(
task_id=task_id,
@@ -532,23 +483,19 @@ class BundleApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesBundleSubmissionResponseVerbose",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesBundleSubmissionResponseVerbose",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
return response_data.response
def _v1_task_task_id_bundle_bundle_id_get_serialize(
self,
task_id,
@@ -561,46 +508,35 @@ class BundleApi:
_host = None
_collection_formats: Dict[str, str] = {
}
_collection_formats: Dict[str, str] = {}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if task_id is not None:
_path_params['task_id'] = task_id
_path_params["task_id"] = task_id
if bundle_id is not None:
_path_params['bundle_id'] = bundle_id
_path_params["bundle_id"] = bundle_id
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if "Accept" not in _header_params:
_header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
# authentication setting
_auth_settings: List[str] = [
'BasicAuth'
]
_auth_settings: List[str] = ["BasicAuth"]
return self.api_client.param_serialize(
method='GET',
resource_path='/v1/task/{task_id}/bundle/{bundle_id}/',
method="GET",
resource_path="/v1/task/{task_id}/bundle/{bundle_id}/",
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -610,12 +546,9 @@ class BundleApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
_request_auth=_request_auth,
)
@validate_call
def v1_task_task_id_bundle_bundle_id_patch(
self,
@@ -625,10 +558,7 @@ class BundleApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -665,7 +595,7 @@ class BundleApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_bundle_bundle_id_patch_serialize(
task_id=task_id,
@@ -674,27 +604,23 @@ class BundleApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesBundleSubmissionResponseVerbose",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesBundleSubmissionResponseVerbose",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def v1_task_task_id_bundle_bundle_id_patch_with_http_info(
self,
@@ -704,10 +630,7 @@ class BundleApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -744,7 +667,7 @@ class BundleApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_bundle_bundle_id_patch_serialize(
task_id=task_id,
@@ -753,27 +676,23 @@ class BundleApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesBundleSubmissionResponseVerbose",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesBundleSubmissionResponseVerbose",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def v1_task_task_id_bundle_bundle_id_patch_without_preload_content(
self,
@@ -783,10 +702,7 @@ class BundleApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -823,7 +739,7 @@ class BundleApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_bundle_bundle_id_patch_serialize(
task_id=task_id,
@@ -832,23 +748,19 @@ class BundleApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesBundleSubmissionResponseVerbose",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesBundleSubmissionResponseVerbose",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
return response_data.response
def _v1_task_task_id_bundle_bundle_id_patch_serialize(
self,
task_id,
@@ -862,23 +774,20 @@ class BundleApi:
_host = None
_collection_formats: Dict[str, str] = {
}
_collection_formats: Dict[str, str] = {}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if task_id is not None:
_path_params['task_id'] = task_id
_path_params["task_id"] = task_id
if bundle_id is not None:
_path_params['bundle_id'] = bundle_id
_path_params["bundle_id"] = bundle_id
# process the query parameters
# process the header parameters
# process the form parameters
@@ -886,37 +795,24 @@ class BundleApi:
if payload is not None:
_body_params = payload
# set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if "Accept" not in _header_params:
_header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
# set the HTTP header `Content-Type`
if _content_type:
_header_params['Content-Type'] = _content_type
_header_params["Content-Type"] = _content_type
else:
_default_content_type = (
self.api_client.select_header_content_type(
[
'application/json'
]
)
)
_default_content_type = self.api_client.select_header_content_type(["application/json"])
if _default_content_type is not None:
_header_params['Content-Type'] = _default_content_type
_header_params["Content-Type"] = _default_content_type
# authentication setting
_auth_settings: List[str] = [
'BasicAuth'
]
_auth_settings: List[str] = ["BasicAuth"]
return self.api_client.param_serialize(
method='PATCH',
resource_path='/v1/task/{task_id}/bundle/{bundle_id}/',
method="PATCH",
resource_path="/v1/task/{task_id}/bundle/{bundle_id}/",
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -926,12 +822,9 @@ class BundleApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
_request_auth=_request_auth,
)
@validate_call
def v1_task_task_id_bundle_post(
self,
@@ -940,10 +833,7 @@ class BundleApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -978,7 +868,7 @@ class BundleApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_bundle_post_serialize(
task_id=task_id,
@@ -986,27 +876,23 @@ class BundleApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesBundleSubmissionResponse",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesBundleSubmissionResponse",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def v1_task_task_id_bundle_post_with_http_info(
self,
@@ -1015,10 +901,7 @@ class BundleApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -1053,7 +936,7 @@ class BundleApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_bundle_post_serialize(
task_id=task_id,
@@ -1061,27 +944,23 @@ class BundleApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesBundleSubmissionResponse",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesBundleSubmissionResponse",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def v1_task_task_id_bundle_post_without_preload_content(
self,
@@ -1090,10 +969,7 @@ class BundleApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -1128,7 +1004,7 @@ class BundleApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_bundle_post_serialize(
task_id=task_id,
@@ -1136,23 +1012,19 @@ class BundleApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesBundleSubmissionResponse",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesBundleSubmissionResponse",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
return response_data.response
def _v1_task_task_id_bundle_post_serialize(
self,
task_id,
@@ -1165,21 +1037,18 @@ class BundleApi:
_host = None
_collection_formats: Dict[str, str] = {
}
_collection_formats: Dict[str, str] = {}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if task_id is not None:
_path_params['task_id'] = task_id
_path_params["task_id"] = task_id
# process the query parameters
# process the header parameters
# process the form parameters
@@ -1187,37 +1056,24 @@ class BundleApi:
if payload is not None:
_body_params = payload
# set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if "Accept" not in _header_params:
_header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
# set the HTTP header `Content-Type`
if _content_type:
_header_params['Content-Type'] = _content_type
_header_params["Content-Type"] = _content_type
else:
_default_content_type = (
self.api_client.select_header_content_type(
[
'application/json'
]
)
)
_default_content_type = self.api_client.select_header_content_type(["application/json"])
if _default_content_type is not None:
_header_params['Content-Type'] = _default_content_type
_header_params["Content-Type"] = _default_content_type
# authentication setting
_auth_settings: List[str] = [
'BasicAuth'
]
_auth_settings: List[str] = ["BasicAuth"]
return self.api_client.param_serialize(
method='POST',
resource_path='/v1/task/{task_id}/bundle/',
method="POST",
resource_path="/v1/task/{task_id}/bundle/",
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -1227,7 +1083,5 @@ class BundleApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
_request_auth=_request_auth,
)
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.1
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.1
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
import warnings
@@ -38,7 +38,6 @@ class FeeformApi:
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_call
def v1_task_task_id_freeform_post(
self,
@@ -47,10 +46,7 @@ class FeeformApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -85,7 +81,7 @@ class FeeformApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_freeform_post_serialize(
task_id=task_id,
@@ -93,27 +89,23 @@ class FeeformApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesFreeformResponse",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesFreeformResponse",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def v1_task_task_id_freeform_post_with_http_info(
self,
@@ -122,10 +114,7 @@ class FeeformApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -160,7 +149,7 @@ class FeeformApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_freeform_post_serialize(
task_id=task_id,
@@ -168,27 +157,23 @@ class FeeformApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesFreeformResponse",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesFreeformResponse",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def v1_task_task_id_freeform_post_without_preload_content(
self,
@@ -197,10 +182,7 @@ class FeeformApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -235,7 +217,7 @@ class FeeformApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_freeform_post_serialize(
task_id=task_id,
@@ -243,23 +225,19 @@ class FeeformApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesFreeformResponse",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesFreeformResponse",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
return response_data.response
def _v1_task_task_id_freeform_post_serialize(
self,
task_id,
@@ -272,21 +250,18 @@ class FeeformApi:
_host = None
_collection_formats: Dict[str, str] = {
}
_collection_formats: Dict[str, str] = {}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if task_id is not None:
_path_params['task_id'] = task_id
_path_params["task_id"] = task_id
# process the query parameters
# process the header parameters
# process the form parameters
@@ -294,37 +269,24 @@ class FeeformApi:
if payload is not None:
_body_params = payload
# set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if "Accept" not in _header_params:
_header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
# set the HTTP header `Content-Type`
if _content_type:
_header_params['Content-Type'] = _content_type
_header_params["Content-Type"] = _content_type
else:
_default_content_type = (
self.api_client.select_header_content_type(
[
'application/json'
]
)
)
_default_content_type = self.api_client.select_header_content_type(["application/json"])
if _default_content_type is not None:
_header_params['Content-Type'] = _default_content_type
_header_params["Content-Type"] = _default_content_type
# authentication setting
_auth_settings: List[str] = [
'BasicAuth'
]
_auth_settings: List[str] = ["BasicAuth"]
return self.api_client.param_serialize(
method='POST',
resource_path='/v1/task/{task_id}/freeform/',
method="POST",
resource_path="/v1/task/{task_id}/freeform/",
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -334,7 +296,5 @@ class FeeformApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
_request_auth=_request_auth,
)
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
import warnings
@@ -38,7 +38,6 @@ class FreeformApi:
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_call
def v1_task_task_id_freeform_post(
self,
@@ -47,10 +46,7 @@ class FreeformApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -85,7 +81,7 @@ class FreeformApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_freeform_post_serialize(
task_id=task_id,
@@ -93,27 +89,23 @@ class FreeformApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesFreeformResponse",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesFreeformResponse",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def v1_task_task_id_freeform_post_with_http_info(
self,
@@ -122,10 +114,7 @@ class FreeformApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -160,7 +149,7 @@ class FreeformApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_freeform_post_serialize(
task_id=task_id,
@@ -168,27 +157,23 @@ class FreeformApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesFreeformResponse",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesFreeformResponse",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def v1_task_task_id_freeform_post_without_preload_content(
self,
@@ -197,10 +182,7 @@ class FreeformApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -235,7 +217,7 @@ class FreeformApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_freeform_post_serialize(
task_id=task_id,
@@ -243,23 +225,19 @@ class FreeformApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesFreeformResponse",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesFreeformResponse",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
return response_data.response
def _v1_task_task_id_freeform_post_serialize(
self,
task_id,
@@ -272,21 +250,18 @@ class FreeformApi:
_host = None
_collection_formats: Dict[str, str] = {
}
_collection_formats: Dict[str, str] = {}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if task_id is not None:
_path_params['task_id'] = task_id
_path_params["task_id"] = task_id
# process the query parameters
# process the header parameters
# process the form parameters
@@ -294,37 +269,24 @@ class FreeformApi:
if payload is not None:
_body_params = payload
# set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if "Accept" not in _header_params:
_header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
# set the HTTP header `Content-Type`
if _content_type:
_header_params['Content-Type'] = _content_type
_header_params["Content-Type"] = _content_type
else:
_default_content_type = (
self.api_client.select_header_content_type(
[
'application/json'
]
)
)
_default_content_type = self.api_client.select_header_content_type(["application/json"])
if _default_content_type is not None:
_header_params['Content-Type'] = _default_content_type
_header_params["Content-Type"] = _default_content_type
# authentication setting
_auth_settings: List[str] = [
'BasicAuth'
]
_auth_settings: List[str] = ["BasicAuth"]
return self.api_client.param_serialize(
method='POST',
resource_path='/v1/task/{task_id}/freeform/',
method="POST",
resource_path="/v1/task/{task_id}/freeform/",
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -334,7 +296,5 @@ class FreeformApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
_request_auth=_request_auth,
)
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
import warnings
@@ -19,7 +19,9 @@ from typing_extensions import Annotated
from pydantic import Field, StrictStr
from typing_extensions import Annotated
from buttercup.orchestrator.competition_api_client.models.types_patch_submission import TypesPatchSubmission
from buttercup.orchestrator.competition_api_client.models.types_patch_submission_response import TypesPatchSubmissionResponse
from buttercup.orchestrator.competition_api_client.models.types_patch_submission_response import (
TypesPatchSubmissionResponse,
)
from buttercup.orchestrator.competition_api_client.api_client import ApiClient, RequestSerialized
from buttercup.orchestrator.competition_api_client.api_response import ApiResponse
@@ -38,7 +40,6 @@ class PatchApi:
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_call
def v1_task_task_id_patch_patch_id_get(
self,
@@ -47,10 +48,7 @@ class PatchApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -85,7 +83,7 @@ class PatchApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_patch_patch_id_get_serialize(
task_id=task_id,
@@ -93,27 +91,23 @@ class PatchApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesPatchSubmissionResponse",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesPatchSubmissionResponse",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def v1_task_task_id_patch_patch_id_get_with_http_info(
self,
@@ -122,10 +116,7 @@ class PatchApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -160,7 +151,7 @@ class PatchApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_patch_patch_id_get_serialize(
task_id=task_id,
@@ -168,27 +159,23 @@ class PatchApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesPatchSubmissionResponse",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesPatchSubmissionResponse",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def v1_task_task_id_patch_patch_id_get_without_preload_content(
self,
@@ -197,10 +184,7 @@ class PatchApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -235,7 +219,7 @@ class PatchApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_patch_patch_id_get_serialize(
task_id=task_id,
@@ -243,23 +227,19 @@ class PatchApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesPatchSubmissionResponse",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesPatchSubmissionResponse",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
return response_data.response
def _v1_task_task_id_patch_patch_id_get_serialize(
self,
task_id,
@@ -272,46 +252,35 @@ class PatchApi:
_host = None
_collection_formats: Dict[str, str] = {
}
_collection_formats: Dict[str, str] = {}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if task_id is not None:
_path_params['task_id'] = task_id
_path_params["task_id"] = task_id
if patch_id is not None:
_path_params['patch_id'] = patch_id
_path_params["patch_id"] = patch_id
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if "Accept" not in _header_params:
_header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
# authentication setting
_auth_settings: List[str] = [
'BasicAuth'
]
_auth_settings: List[str] = ["BasicAuth"]
return self.api_client.param_serialize(
method='GET',
resource_path='/v1/task/{task_id}/patch/{patch_id}/',
method="GET",
resource_path="/v1/task/{task_id}/patch/{patch_id}/",
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -321,12 +290,9 @@ class PatchApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
_request_auth=_request_auth,
)
@validate_call
def v1_task_task_id_patch_post(
self,
@@ -335,10 +301,7 @@ class PatchApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -373,7 +336,7 @@ class PatchApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_patch_post_serialize(
task_id=task_id,
@@ -381,27 +344,23 @@ class PatchApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesPatchSubmissionResponse",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesPatchSubmissionResponse",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def v1_task_task_id_patch_post_with_http_info(
self,
@@ -410,10 +369,7 @@ class PatchApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -448,7 +404,7 @@ class PatchApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_patch_post_serialize(
task_id=task_id,
@@ -456,27 +412,23 @@ class PatchApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesPatchSubmissionResponse",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesPatchSubmissionResponse",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def v1_task_task_id_patch_post_without_preload_content(
self,
@@ -485,10 +437,7 @@ class PatchApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -523,7 +472,7 @@ class PatchApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_patch_post_serialize(
task_id=task_id,
@@ -531,23 +480,19 @@ class PatchApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesPatchSubmissionResponse",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesPatchSubmissionResponse",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
return response_data.response
def _v1_task_task_id_patch_post_serialize(
self,
task_id,
@@ -560,21 +505,18 @@ class PatchApi:
_host = None
_collection_formats: Dict[str, str] = {
}
_collection_formats: Dict[str, str] = {}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if task_id is not None:
_path_params['task_id'] = task_id
_path_params["task_id"] = task_id
# process the query parameters
# process the header parameters
# process the form parameters
@@ -582,37 +524,24 @@ class PatchApi:
if payload is not None:
_body_params = payload
# set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if "Accept" not in _header_params:
_header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
# set the HTTP header `Content-Type`
if _content_type:
_header_params['Content-Type'] = _content_type
_header_params["Content-Type"] = _content_type
else:
_default_content_type = (
self.api_client.select_header_content_type(
[
'application/json'
]
)
)
_default_content_type = self.api_client.select_header_content_type(["application/json"])
if _default_content_type is not None:
_header_params['Content-Type'] = _default_content_type
_header_params["Content-Type"] = _default_content_type
# authentication setting
_auth_settings: List[str] = [
'BasicAuth'
]
_auth_settings: List[str] = ["BasicAuth"]
return self.api_client.param_serialize(
method='POST',
resource_path='/v1/task/{task_id}/patch/',
method="POST",
resource_path="/v1/task/{task_id}/patch/",
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -622,7 +551,5 @@ class PatchApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
_request_auth=_request_auth,
)
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
import warnings
@@ -35,17 +35,13 @@ class PingApi:
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_call
def v1_ping_get(
self,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -76,39 +72,29 @@ class PingApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_ping_get_serialize(
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesPingResponse",
"200": "TypesPingResponse",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def v1_ping_get_with_http_info(
self,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -139,39 +125,29 @@ class PingApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_ping_get_serialize(
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesPingResponse",
"200": "TypesPingResponse",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def v1_ping_get_without_preload_content(
self,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -202,25 +178,18 @@ class PingApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_ping_get_serialize(
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesPingResponse",
"200": "TypesPingResponse",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
return response_data.response
def _v1_ping_get_serialize(
self,
_request_auth,
@@ -231,16 +200,13 @@ class PingApi:
_host = None
_collection_formats: Dict[str, str] = {
}
_collection_formats: Dict[str, str] = {}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
_body_params: Optional[bytes] = None
# process the path parameters
@@ -249,24 +215,16 @@ class PingApi:
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'*/*'
]
)
if "Accept" not in _header_params:
_header_params["Accept"] = self.api_client.select_header_accept(["*/*"])
# authentication setting
_auth_settings: List[str] = [
'BasicAuth'
]
_auth_settings: List[str] = ["BasicAuth"]
return self.api_client.param_serialize(
method='GET',
resource_path='/v1/ping/',
method="GET",
resource_path="/v1/ping/",
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -276,7 +234,5 @@ class PingApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
_request_auth=_request_auth,
)
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
import warnings
@@ -19,7 +19,9 @@ from typing_extensions import Annotated
from pydantic import Field, StrictStr
from typing_extensions import Annotated
from buttercup.orchestrator.competition_api_client.models.types_pov_submission import TypesPOVSubmission
from buttercup.orchestrator.competition_api_client.models.types_pov_submission_response import TypesPOVSubmissionResponse
from buttercup.orchestrator.competition_api_client.models.types_pov_submission_response import (
TypesPOVSubmissionResponse,
)
from buttercup.orchestrator.competition_api_client.api_client import ApiClient, RequestSerialized
from buttercup.orchestrator.competition_api_client.api_response import ApiResponse
@@ -38,7 +40,6 @@ class PovApi:
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_call
def v1_task_task_id_pov_post(
self,
@@ -47,10 +48,7 @@ class PovApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -85,7 +83,7 @@ class PovApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_pov_post_serialize(
task_id=task_id,
@@ -93,27 +91,23 @@ class PovApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesPOVSubmissionResponse",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesPOVSubmissionResponse",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def v1_task_task_id_pov_post_with_http_info(
self,
@@ -122,10 +116,7 @@ class PovApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -160,7 +151,7 @@ class PovApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_pov_post_serialize(
task_id=task_id,
@@ -168,27 +159,23 @@ class PovApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesPOVSubmissionResponse",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesPOVSubmissionResponse",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def v1_task_task_id_pov_post_without_preload_content(
self,
@@ -197,10 +184,7 @@ class PovApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -235,7 +219,7 @@ class PovApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_pov_post_serialize(
task_id=task_id,
@@ -243,23 +227,19 @@ class PovApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesPOVSubmissionResponse",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesPOVSubmissionResponse",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
return response_data.response
def _v1_task_task_id_pov_post_serialize(
self,
task_id,
@@ -272,21 +252,18 @@ class PovApi:
_host = None
_collection_formats: Dict[str, str] = {
}
_collection_formats: Dict[str, str] = {}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if task_id is not None:
_path_params['task_id'] = task_id
_path_params["task_id"] = task_id
# process the query parameters
# process the header parameters
# process the form parameters
@@ -294,37 +271,24 @@ class PovApi:
if payload is not None:
_body_params = payload
# set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if "Accept" not in _header_params:
_header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
# set the HTTP header `Content-Type`
if _content_type:
_header_params['Content-Type'] = _content_type
_header_params["Content-Type"] = _content_type
else:
_default_content_type = (
self.api_client.select_header_content_type(
[
'application/json'
]
)
)
_default_content_type = self.api_client.select_header_content_type(["application/json"])
if _default_content_type is not None:
_header_params['Content-Type'] = _default_content_type
_header_params["Content-Type"] = _default_content_type
# authentication setting
_auth_settings: List[str] = [
'BasicAuth'
]
_auth_settings: List[str] = ["BasicAuth"]
return self.api_client.param_serialize(
method='POST',
resource_path='/v1/task/{task_id}/pov/',
method="POST",
resource_path="/v1/task/{task_id}/pov/",
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -334,12 +298,9 @@ class PovApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
_request_auth=_request_auth,
)
@validate_call
def v1_task_task_id_pov_pov_id_get(
self,
@@ -348,10 +309,7 @@ class PovApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -386,7 +344,7 @@ class PovApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_pov_pov_id_get_serialize(
task_id=task_id,
@@ -394,27 +352,23 @@ class PovApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesPOVSubmissionResponse",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesPOVSubmissionResponse",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def v1_task_task_id_pov_pov_id_get_with_http_info(
self,
@@ -423,10 +377,7 @@ class PovApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -461,7 +412,7 @@ class PovApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_pov_pov_id_get_serialize(
task_id=task_id,
@@ -469,27 +420,23 @@ class PovApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesPOVSubmissionResponse",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesPOVSubmissionResponse",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def v1_task_task_id_pov_pov_id_get_without_preload_content(
self,
@@ -498,10 +445,7 @@ class PovApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -536,7 +480,7 @@ class PovApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_pov_pov_id_get_serialize(
task_id=task_id,
@@ -544,23 +488,19 @@ class PovApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesPOVSubmissionResponse",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesPOVSubmissionResponse",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
return response_data.response
def _v1_task_task_id_pov_pov_id_get_serialize(
self,
task_id,
@@ -573,46 +513,35 @@ class PovApi:
_host = None
_collection_formats: Dict[str, str] = {
}
_collection_formats: Dict[str, str] = {}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if task_id is not None:
_path_params['task_id'] = task_id
_path_params["task_id"] = task_id
if pov_id is not None:
_path_params['pov_id'] = pov_id
_path_params["pov_id"] = pov_id
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if "Accept" not in _header_params:
_header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
# authentication setting
_auth_settings: List[str] = [
'BasicAuth'
]
_auth_settings: List[str] = ["BasicAuth"]
return self.api_client.param_serialize(
method='GET',
resource_path='/v1/task/{task_id}/pov/{pov_id}/',
method="GET",
resource_path="/v1/task/{task_id}/pov/{pov_id}/",
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -622,7 +551,5 @@ class PovApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
_request_auth=_request_auth,
)
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
import warnings
@@ -39,7 +39,6 @@ class RequestApi:
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_call
def v1_request_challenge_name_post(
self,
@@ -48,10 +47,7 @@ class RequestApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -86,7 +82,7 @@ class RequestApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_request_challenge_name_post_serialize(
challenge_name=challenge_name,
@@ -94,27 +90,23 @@ class RequestApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesMessage",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesMessage",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def v1_request_challenge_name_post_with_http_info(
self,
@@ -123,10 +115,7 @@ class RequestApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -161,7 +150,7 @@ class RequestApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_request_challenge_name_post_serialize(
challenge_name=challenge_name,
@@ -169,27 +158,23 @@ class RequestApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesMessage",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesMessage",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def v1_request_challenge_name_post_without_preload_content(
self,
@@ -198,10 +183,7 @@ class RequestApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -236,7 +218,7 @@ class RequestApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_request_challenge_name_post_serialize(
challenge_name=challenge_name,
@@ -244,23 +226,19 @@ class RequestApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesMessage",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesMessage",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
return response_data.response
def _v1_request_challenge_name_post_serialize(
self,
challenge_name,
@@ -273,21 +251,18 @@ class RequestApi:
_host = None
_collection_formats: Dict[str, str] = {
}
_collection_formats: Dict[str, str] = {}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if challenge_name is not None:
_path_params['challenge_name'] = challenge_name
_path_params["challenge_name"] = challenge_name
# process the query parameters
# process the header parameters
# process the form parameters
@@ -295,37 +270,24 @@ class RequestApi:
if payload is not None:
_body_params = payload
# set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if "Accept" not in _header_params:
_header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
# set the HTTP header `Content-Type`
if _content_type:
_header_params['Content-Type'] = _content_type
_header_params["Content-Type"] = _content_type
else:
_default_content_type = (
self.api_client.select_header_content_type(
[
'application/json'
]
)
)
_default_content_type = self.api_client.select_header_content_type(["application/json"])
if _default_content_type is not None:
_header_params['Content-Type'] = _default_content_type
_header_params["Content-Type"] = _default_content_type
# authentication setting
_auth_settings: List[str] = [
'BasicAuth'
]
_auth_settings: List[str] = ["BasicAuth"]
return self.api_client.param_serialize(
method='POST',
resource_path='/v1/request/{challenge_name}',
method="POST",
resource_path="/v1/request/{challenge_name}",
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -335,22 +297,16 @@ class RequestApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
_request_auth=_request_auth,
)
@validate_call
def v1_request_list_get(
self,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -381,43 +337,33 @@ class RequestApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_request_list_get_serialize(
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesRequestListResponse",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesRequestListResponse",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def v1_request_list_get_with_http_info(
self,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -448,43 +394,33 @@ class RequestApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_request_list_get_serialize(
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesRequestListResponse",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesRequestListResponse",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def v1_request_list_get_without_preload_content(
self,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -515,29 +451,22 @@ class RequestApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_request_list_get_serialize(
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesRequestListResponse",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesRequestListResponse",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
return response_data.response
def _v1_request_list_get_serialize(
self,
_request_auth,
@@ -548,16 +477,13 @@ class RequestApi:
_host = None
_collection_formats: Dict[str, str] = {
}
_collection_formats: Dict[str, str] = {}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
_body_params: Optional[bytes] = None
# process the path parameters
@@ -566,24 +492,16 @@ class RequestApi:
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if "Accept" not in _header_params:
_header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
# authentication setting
_auth_settings: List[str] = [
'BasicAuth'
]
_auth_settings: List[str] = ["BasicAuth"]
return self.api_client.param_serialize(
method='GET',
resource_path='/v1/request/list/',
method="GET",
resource_path="/v1/request/list/",
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -593,7 +511,5 @@ class RequestApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
_request_auth=_request_auth,
)
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
import warnings
@@ -19,7 +19,9 @@ from typing_extensions import Annotated
from pydantic import Field, StrictStr
from typing_extensions import Annotated
from buttercup.orchestrator.competition_api_client.models.types_sarif_submission import TypesSARIFSubmission
from buttercup.orchestrator.competition_api_client.models.types_sarif_submission_response import TypesSARIFSubmissionResponse
from buttercup.orchestrator.competition_api_client.models.types_sarif_submission_response import (
TypesSARIFSubmissionResponse,
)
from buttercup.orchestrator.competition_api_client.api_client import ApiClient, RequestSerialized
from buttercup.orchestrator.competition_api_client.api_response import ApiResponse
@@ -38,7 +40,6 @@ class SubmittedSarifApi:
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_call
def v1_task_task_id_submitted_sarif_post(
self,
@@ -47,10 +48,7 @@ class SubmittedSarifApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -85,7 +83,7 @@ class SubmittedSarifApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_submitted_sarif_post_serialize(
task_id=task_id,
@@ -93,27 +91,23 @@ class SubmittedSarifApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesSARIFSubmissionResponse",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesSARIFSubmissionResponse",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def v1_task_task_id_submitted_sarif_post_with_http_info(
self,
@@ -122,10 +116,7 @@ class SubmittedSarifApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -160,7 +151,7 @@ class SubmittedSarifApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_submitted_sarif_post_serialize(
task_id=task_id,
@@ -168,27 +159,23 @@ class SubmittedSarifApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesSARIFSubmissionResponse",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesSARIFSubmissionResponse",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def v1_task_task_id_submitted_sarif_post_without_preload_content(
self,
@@ -197,10 +184,7 @@ class SubmittedSarifApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -235,7 +219,7 @@ class SubmittedSarifApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._v1_task_task_id_submitted_sarif_post_serialize(
task_id=task_id,
@@ -243,23 +227,19 @@ class SubmittedSarifApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "TypesSARIFSubmissionResponse",
'400': "TypesError",
'401': "TypesError",
'404': "TypesError",
'500': "TypesError",
"200": "TypesSARIFSubmissionResponse",
"400": "TypesError",
"401": "TypesError",
"404": "TypesError",
"500": "TypesError",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
return response_data.response
def _v1_task_task_id_submitted_sarif_post_serialize(
self,
task_id,
@@ -272,21 +252,18 @@ class SubmittedSarifApi:
_host = None
_collection_formats: Dict[str, str] = {
}
_collection_formats: Dict[str, str] = {}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if task_id is not None:
_path_params['task_id'] = task_id
_path_params["task_id"] = task_id
# process the query parameters
# process the header parameters
# process the form parameters
@@ -294,37 +271,24 @@ class SubmittedSarifApi:
if payload is not None:
_body_params = payload
# set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if "Accept" not in _header_params:
_header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
# set the HTTP header `Content-Type`
if _content_type:
_header_params['Content-Type'] = _content_type
_header_params["Content-Type"] = _content_type
else:
_default_content_type = (
self.api_client.select_header_content_type(
[
'application/json'
]
)
)
_default_content_type = self.api_client.select_header_content_type(["application/json"])
if _default_content_type is not None:
_header_params['Content-Type'] = _default_content_type
_header_params["Content-Type"] = _default_content_type
# authentication setting
_auth_settings: List[str] = [
'BasicAuth'
]
_auth_settings: List[str] = ["BasicAuth"]
return self.api_client.param_serialize(
method='POST',
resource_path='/v1/task/{task_id}/submitted-sarif/',
method="POST",
resource_path="/v1/task/{task_id}/submitted-sarif/",
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -334,7 +298,5 @@ class SubmittedSarifApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
_request_auth=_request_auth,
)
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
@@ -37,11 +37,12 @@ from buttercup.orchestrator.competition_api_client.exceptions import (
UnauthorizedException,
ForbiddenException,
NotFoundException,
ServiceException
ServiceException,
)
RequestSerialized = Tuple[str, str, Dict[str, str], Optional[str], List[str]]
class ApiClient:
"""Generic API client for OpenAPI client library builds.
@@ -60,25 +61,19 @@ class ApiClient:
PRIMITIVE_TYPES = (float, bool, bytes, str, int)
NATIVE_TYPES_MAPPING = {
'int': int,
'long': int, # TODO remove as only py3 is supported?
'float': float,
'str': str,
'bool': bool,
'date': datetime.date,
'datetime': datetime.datetime,
'decimal': decimal.Decimal,
'object': object,
"int": int,
"long": int, # TODO remove as only py3 is supported?
"float": float,
"str": str,
"bool": bool,
"date": datetime.date,
"datetime": datetime.datetime,
"decimal": decimal.Decimal,
"object": object,
}
_pool = None
def __init__(
self,
configuration=None,
header_name=None,
header_value=None,
cookie=None
) -> None:
def __init__(self, configuration=None, header_name=None, header_value=None, cookie=None) -> None:
# use default configuration if none is provided
if configuration is None:
configuration = Configuration.get_default()
@@ -90,7 +85,7 @@ class ApiClient:
self.default_headers[header_name] = header_value
self.cookie = cookie
# Set default User-Agent.
self.user_agent = 'OpenAPI-Generator/1.0.0/python'
self.user_agent = "OpenAPI-Generator/1.0.0/python"
self.client_side_validation = configuration.client_side_validation
def __enter__(self):
@@ -102,16 +97,15 @@ class ApiClient:
@property
def user_agent(self):
"""User agent for this API client"""
return self.default_headers['User-Agent']
return self.default_headers["User-Agent"]
@user_agent.setter
def user_agent(self, value):
self.default_headers['User-Agent'] = value
self.default_headers["User-Agent"] = value
def set_default_header(self, header_name, header_value):
self.default_headers[header_name] = header_value
_default = None
@classmethod
@@ -147,12 +141,12 @@ class ApiClient:
header_params=None,
body=None,
post_params=None,
files=None, auth_settings=None,
files=None,
auth_settings=None,
collection_formats=None,
_host=None,
_request_auth=None
_request_auth=None,
) -> RequestSerialized:
"""Builds the HTTP request params needed by the request.
:param method: Method to call.
:param resource_path: Path to method endpoint.
@@ -181,47 +175,30 @@ class ApiClient:
header_params = header_params or {}
header_params.update(self.default_headers)
if self.cookie:
header_params['Cookie'] = self.cookie
header_params["Cookie"] = self.cookie
if header_params:
header_params = self.sanitize_for_serialization(header_params)
header_params = dict(
self.parameters_to_tuples(header_params,collection_formats)
)
header_params = dict(self.parameters_to_tuples(header_params, collection_formats))
# path parameters
if path_params:
path_params = self.sanitize_for_serialization(path_params)
path_params = self.parameters_to_tuples(
path_params,
collection_formats
)
path_params = self.parameters_to_tuples(path_params, collection_formats)
for k, v in path_params:
# specified safe chars, encode everything
resource_path = resource_path.replace(
'{%s}' % k,
quote(str(v), safe=config.safe_chars_for_path_param)
)
resource_path = resource_path.replace("{%s}" % k, quote(str(v), safe=config.safe_chars_for_path_param))
# post parameters
if post_params or files:
post_params = post_params if post_params else []
post_params = self.sanitize_for_serialization(post_params)
post_params = self.parameters_to_tuples(
post_params,
collection_formats
)
post_params = self.parameters_to_tuples(post_params, collection_formats)
if files:
post_params.extend(self.files_parameters(files))
# auth setting
self.update_params_for_auth(
header_params,
query_params,
auth_settings,
resource_path,
method,
body,
request_auth=_request_auth
header_params, query_params, auth_settings, resource_path, method, body, request_auth=_request_auth
)
# body
@@ -238,23 +215,13 @@ class ApiClient:
# query parameters
if query_params:
query_params = self.sanitize_for_serialization(query_params)
url_query = self.parameters_to_url_query(
query_params,
collection_formats
)
url_query = self.parameters_to_url_query(query_params, collection_formats)
url += "?" + url_query
return method, url, header_params, body, post_params
def call_api(
self,
method,
url,
header_params=None,
body=None,
post_params=None,
_request_timeout=None
self, method, url, header_params=None, body=None, post_params=None, _request_timeout=None
) -> rest.RESTResponse:
"""Makes the HTTP request (synchronous)
:param method: Method to call.
@@ -271,10 +238,12 @@ class ApiClient:
try:
# perform request and return response
response_data = self.rest_client.request(
method, url,
method,
url,
headers=header_params,
body=body, post_params=post_params,
_request_timeout=_request_timeout
body=body,
post_params=post_params,
_request_timeout=_request_timeout,
)
except ApiException as e:
@@ -283,9 +252,7 @@ class ApiClient:
return response_data
def response_deserialize(
self,
response_data: rest.RESTResponse,
response_types_map: Optional[Dict[str, ApiResponseT]]=None
self, response_data: rest.RESTResponse, response_types_map: Optional[Dict[str, ApiResponseT]] = None
) -> ApiResponse[ApiResponseT]:
"""Deserializes response into an object.
:param response_data: RESTResponse object to be deserialized.
@@ -311,7 +278,7 @@ class ApiClient:
return_data = self.__deserialize_file(response_data)
elif response_type is not None:
match = None
content_type = response_data.getheader('content-type')
content_type = response_data.getheader("content-type")
if content_type is not None:
match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type)
encoding = match.group(1) if match else "utf-8"
@@ -326,10 +293,10 @@ class ApiClient:
)
return ApiResponse(
status_code = response_data.status,
data = return_data,
headers = response_data.getheaders(),
raw_data = response_data.data
status_code=response_data.status,
data=return_data,
headers=response_data.getheaders(),
raw_data=response_data.data,
)
def sanitize_for_serialization(self, obj):
@@ -357,13 +324,9 @@ class ApiClient:
elif isinstance(obj, self.PRIMITIVE_TYPES):
return obj
elif isinstance(obj, list):
return [
self.sanitize_for_serialization(sub_obj) for sub_obj in obj
]
return [self.sanitize_for_serialization(sub_obj) for sub_obj in obj]
elif isinstance(obj, tuple):
return tuple(
self.sanitize_for_serialization(sub_obj) for sub_obj in obj
)
return tuple(self.sanitize_for_serialization(sub_obj) for sub_obj in obj)
elif isinstance(obj, (datetime.datetime, datetime.date)):
return obj.isoformat()
elif isinstance(obj, decimal.Decimal):
@@ -377,7 +340,7 @@ class ApiClient:
# and attributes which value is not None.
# Convert attribute name to json key in
# model definition for request.
if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')):
if hasattr(obj, "to_dict") and callable(getattr(obj, "to_dict")):
obj_dict = obj.to_dict()
else:
obj_dict = obj.__dict__
@@ -386,10 +349,7 @@ class ApiClient:
# here we handle instances that can either be a list or something else, and only became a real list by calling to_dict()
return self.sanitize_for_serialization(obj_dict)
return {
key: self.sanitize_for_serialization(val)
for key, val in obj_dict.items()
}
return {key: self.sanitize_for_serialization(val) for key, val in obj_dict.items()}
def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]):
"""Deserializes response into an object.
@@ -408,18 +368,15 @@ class ApiClient:
data = json.loads(response_text)
except ValueError:
data = response_text
elif re.match(r'^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE):
elif re.match(r"^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)", content_type, re.IGNORECASE):
if response_text == "":
data = ""
else:
data = json.loads(response_text)
elif re.match(r'^text\/[a-z.+-]+\s*(;|$)', content_type, re.IGNORECASE):
elif re.match(r"^text\/[a-z.+-]+\s*(;|$)", content_type, re.IGNORECASE):
data = response_text
else:
raise ApiException(
status=0,
reason="Unsupported content type: {0}".format(content_type)
)
raise ApiException(status=0, reason="Unsupported content type: {0}".format(content_type))
return self.__deserialize(data, response_type)
@@ -435,19 +392,17 @@ class ApiClient:
return None
if isinstance(klass, str):
if klass.startswith('List['):
m = re.match(r'List\[(.*)]', klass)
if klass.startswith("List["):
m = re.match(r"List\[(.*)]", klass)
assert m is not None, "Malformed List type definition"
sub_kls = m.group(1)
return [self.__deserialize(sub_data, sub_kls)
for sub_data in data]
return [self.__deserialize(sub_data, sub_kls) for sub_data in data]
if klass.startswith('Dict['):
m = re.match(r'Dict\[([^,]*), (.*)]', klass)
if klass.startswith("Dict["):
m = re.match(r"Dict\[([^,]*), (.*)]", klass)
assert m is not None, "Malformed Dict type definition"
sub_kls = m.group(2)
return {k: self.__deserialize(v, sub_kls)
for k, v in data.items()}
return {k: self.__deserialize(v, sub_kls) for k, v in data.items()}
# convert str to class
if klass in self.NATIVE_TYPES_MAPPING:
@@ -483,19 +438,18 @@ class ApiClient:
for k, v in params.items() if isinstance(params, dict) else params:
if k in collection_formats:
collection_format = collection_formats[k]
if collection_format == 'multi':
if collection_format == "multi":
new_params.extend((k, value) for value in v)
else:
if collection_format == 'ssv':
delimiter = ' '
elif collection_format == 'tsv':
delimiter = '\t'
elif collection_format == 'pipes':
delimiter = '|'
if collection_format == "ssv":
delimiter = " "
elif collection_format == "tsv":
delimiter = "\t"
elif collection_format == "pipes":
delimiter = "|"
else: # csv is the default
delimiter = ','
new_params.append(
(k, delimiter.join(str(value) for value in v)))
delimiter = ","
new_params.append((k, delimiter.join(str(value) for value in v)))
else:
new_params.append((k, v))
return new_params
@@ -520,20 +474,18 @@ class ApiClient:
if k in collection_formats:
collection_format = collection_formats[k]
if collection_format == 'multi':
if collection_format == "multi":
new_params.extend((k, quote(str(value))) for value in v)
else:
if collection_format == 'ssv':
delimiter = ' '
elif collection_format == 'tsv':
delimiter = '\t'
elif collection_format == 'pipes':
delimiter = '|'
if collection_format == "ssv":
delimiter = " "
elif collection_format == "tsv":
delimiter = "\t"
elif collection_format == "pipes":
delimiter = "|"
else: # csv is the default
delimiter = ','
new_params.append(
(k, delimiter.join(quote(str(value)) for value in v))
)
delimiter = ","
new_params.append((k, delimiter.join(quote(str(value)) for value in v)))
else:
new_params.append((k, quote(str(v))))
@@ -551,7 +503,7 @@ class ApiClient:
params = []
for k, v in files.items():
if isinstance(v, str):
with open(v, 'rb') as f:
with open(v, "rb") as f:
filename = os.path.basename(f.name)
filedata = f.read()
elif isinstance(v, bytes):
@@ -565,13 +517,8 @@ class ApiClient:
continue
else:
raise ValueError("Unsupported file value")
mimetype = (
mimetypes.guess_type(filename)[0]
or 'application/octet-stream'
)
params.append(
tuple([k, tuple([filename, filedata, mimetype])])
)
mimetype = mimetypes.guess_type(filename)[0] or "application/octet-stream"
params.append(tuple([k, tuple([filename, filedata, mimetype])]))
return params
def select_header_accept(self, accepts: List[str]) -> Optional[str]:
@@ -584,7 +531,7 @@ class ApiClient:
return None
for accept in accepts:
if re.search('json', accept, re.IGNORECASE):
if re.search("json", accept, re.IGNORECASE):
return accept
return accepts[0]
@@ -599,20 +546,13 @@ class ApiClient:
return None
for content_type in content_types:
if re.search('json', content_type, re.IGNORECASE):
if re.search("json", content_type, re.IGNORECASE):
return content_type
return content_types[0]
def update_params_for_auth(
self,
headers,
queries,
auth_settings,
resource_path,
method,
body,
request_auth=None
self, headers, queries, auth_settings, resource_path, method, body, request_auth=None
) -> None:
"""Updates header and query params based on authentication setting.
@@ -630,36 +570,14 @@ class ApiClient:
return
if request_auth:
self._apply_auth_params(
headers,
queries,
resource_path,
method,
body,
request_auth
)
self._apply_auth_params(headers, queries, resource_path, method, body, request_auth)
else:
for auth in auth_settings:
auth_setting = self.configuration.auth_settings().get(auth)
if auth_setting:
self._apply_auth_params(
headers,
queries,
resource_path,
method,
body,
auth_setting
)
self._apply_auth_params(headers, queries, resource_path, method, body, auth_setting)
def _apply_auth_params(
self,
headers,
queries,
resource_path,
method,
body,
auth_setting
) -> None:
def _apply_auth_params(self, headers, queries, resource_path, method, body, auth_setting) -> None:
"""Updates the request parameters based on a single auth_setting
:param headers: Header parameters dict to be updated.
@@ -670,17 +588,15 @@ class ApiClient:
The object type is the return value of sanitize_for_serialization().
:param auth_setting: auth settings for the endpoint
"""
if auth_setting['in'] == 'cookie':
headers['Cookie'] = auth_setting['value']
elif auth_setting['in'] == 'header':
if auth_setting['type'] != 'http-signature':
headers[auth_setting['key']] = auth_setting['value']
elif auth_setting['in'] == 'query':
queries.append((auth_setting['key'], auth_setting['value']))
if auth_setting["in"] == "cookie":
headers["Cookie"] = auth_setting["value"]
elif auth_setting["in"] == "header":
if auth_setting["type"] != "http-signature":
headers[auth_setting["key"]] = auth_setting["value"]
elif auth_setting["in"] == "query":
queries.append((auth_setting["key"], auth_setting["value"]))
else:
raise ApiValueError(
'Authentication token must be in `query` or `header`'
)
raise ApiValueError("Authentication token must be in `query` or `header`")
def __deserialize_file(self, response):
"""Deserializes body to file
@@ -700,10 +616,7 @@ class ApiClient:
content_disposition = response.getheader("Content-Disposition")
if content_disposition:
m = re.search(
r'filename=[\'"]?([^\'"\s]+)[\'"]?',
content_disposition
)
m = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition)
assert m is not None, "Unexpected 'content-disposition' header value"
filename = m.group(1)
path = os.path.join(os.path.dirname(path), filename)
@@ -746,10 +659,7 @@ class ApiClient:
except ImportError:
return string
except ValueError:
raise rest.ApiException(
status=0,
reason="Failed to parse `{0}` as date object".format(string)
)
raise rest.ApiException(status=0, reason="Failed to parse `{0}` as date object".format(string))
def __deserialize_datetime(self, string):
"""Deserializes string to datetime.
@@ -764,13 +674,7 @@ class ApiClient:
except ImportError:
return string
except ValueError:
raise rest.ApiException(
status=0,
reason=(
"Failed to parse `{0}` as datetime object"
.format(string)
)
)
raise rest.ApiException(status=0, reason=("Failed to parse `{0}` as datetime object".format(string)))
def __deserialize_enum(self, data, klass):
"""Deserializes primitive type to enum.
@@ -782,13 +686,7 @@ class ApiClient:
try:
return klass(data)
except ValueError:
raise rest.ApiException(
status=0,
reason=(
"Failed to parse `{0}` as `{1}`"
.format(data, klass)
)
)
raise rest.ApiException(status=0, reason=("Failed to parse `{0}` as `{1}`".format(data, klass)))
def __deserialize_model(self, data, klass):
"""Deserializes list or dict to model.
@@ -6,6 +6,7 @@ from pydantic import Field, StrictInt, StrictBytes, BaseModel
T = TypeVar("T")
class ApiResponse(BaseModel, Generic[T]):
"""
API response object
@@ -16,6 +17,4 @@ class ApiResponse(BaseModel, Generic[T]):
data: T = Field(description="Deserialized data given the data type")
raw_data: StrictBytes = Field(description="Raw data (HTTP response body)")
model_config = {
"arbitrary_types_allowed": True
}
model_config = {"arbitrary_types_allowed": True}
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
@@ -25,9 +25,16 @@ import urllib3
JSON_SCHEMA_VALIDATION_KEYWORDS = {
'multipleOf', 'maximum', 'exclusiveMaximum',
'minimum', 'exclusiveMinimum', 'maxLength',
'minLength', 'pattern', 'maxItems', 'minItems'
"multipleOf",
"maximum",
"exclusiveMaximum",
"minimum",
"exclusiveMinimum",
"maxLength",
"minLength",
"pattern",
"maxItems",
"minItems",
}
ServerVariablesT = Dict[str, str]
@@ -134,52 +141,52 @@ class HostSetting(TypedDict):
class Configuration:
"""This class contains various settings of the API client.
:param host: Base url.
:param ignore_operation_servers
Boolean to ignore operation servers for the API client.
Config will use `host` as the base url regardless of the operation servers.
:param api_key: Dict to store API key(s).
Each entry in the dict specifies an API key.
The dict key is the name of the security scheme in the OAS specification.
The dict value is the API key secret.
:param api_key_prefix: Dict to store API prefix (e.g. Bearer).
The dict key is the name of the security scheme in the OAS specification.
The dict value is an API key prefix when generating the auth data.
:param username: Username for HTTP basic authentication.
:param password: Password for HTTP basic authentication.
:param access_token: Access token.
:param server_index: Index to servers configuration.
:param server_variables: Mapping with string values to replace variables in
templated server configuration. The validation of enums is performed for
variables with defined enum values before.
:param server_operation_index: Mapping from operation ID to an index to server
configuration.
:param server_operation_variables: Mapping from operation ID to a mapping with
string values to replace variables in templated server configuration.
The validation of enums is performed for variables with defined enum
values before.
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
in PEM format.
:param retries: Number of retries for API requests.
:param ca_cert_data: verify the peer using concatenated CA certificate data
in PEM (str) or DER (bytes) format.
:param host: Base url.
:param ignore_operation_servers
Boolean to ignore operation servers for the API client.
Config will use `host` as the base url regardless of the operation servers.
:param api_key: Dict to store API key(s).
Each entry in the dict specifies an API key.
The dict key is the name of the security scheme in the OAS specification.
The dict value is the API key secret.
:param api_key_prefix: Dict to store API prefix (e.g. Bearer).
The dict key is the name of the security scheme in the OAS specification.
The dict value is an API key prefix when generating the auth data.
:param username: Username for HTTP basic authentication.
:param password: Password for HTTP basic authentication.
:param access_token: Access token.
:param server_index: Index to servers configuration.
:param server_variables: Mapping with string values to replace variables in
templated server configuration. The validation of enums is performed for
variables with defined enum values before.
:param server_operation_index: Mapping from operation ID to an index to server
configuration.
:param server_operation_variables: Mapping from operation ID to a mapping with
string values to replace variables in templated server configuration.
The validation of enums is performed for variables with defined enum
values before.
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
in PEM format.
:param retries: Number of retries for API requests.
:param ca_cert_data: verify the peer using concatenated CA certificate data
in PEM (str) or DER (bytes) format.
:Example:
:Example:
HTTP Basic Authentication Example.
Given the following security scheme in the OpenAPI specification:
components:
securitySchemes:
http_basic_auth:
type: http
scheme: basic
HTTP Basic Authentication Example.
Given the following security scheme in the OpenAPI specification:
components:
securitySchemes:
http_basic_auth:
type: http
scheme: basic
Configure API client with HTTP basic authentication:
Configure API client with HTTP basic authentication:
conf = competition_api_client.Configuration(
username='the-user',
password='the-password',
)
conf = competition_api_client.Configuration(
username='the-user',
password='the-password',
)
"""
@@ -187,25 +194,24 @@ conf = competition_api_client.Configuration(
def __init__(
self,
host: Optional[str]=None,
api_key: Optional[Dict[str, str]]=None,
api_key_prefix: Optional[Dict[str, str]]=None,
username: Optional[str]=None,
password: Optional[str]=None,
access_token: Optional[str]=None,
server_index: Optional[int]=None,
server_variables: Optional[ServerVariablesT]=None,
server_operation_index: Optional[Dict[int, int]]=None,
server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None,
ignore_operation_servers: bool=False,
ssl_ca_cert: Optional[str]=None,
host: Optional[str] = None,
api_key: Optional[Dict[str, str]] = None,
api_key_prefix: Optional[Dict[str, str]] = None,
username: Optional[str] = None,
password: Optional[str] = None,
access_token: Optional[str] = None,
server_index: Optional[int] = None,
server_variables: Optional[ServerVariablesT] = None,
server_operation_index: Optional[Dict[int, int]] = None,
server_operation_variables: Optional[Dict[int, ServerVariablesT]] = None,
ignore_operation_servers: bool = False,
ssl_ca_cert: Optional[str] = None,
retries: Optional[int] = None,
ca_cert_data: Optional[Union[str, bytes]] = None,
*,
debug: Optional[bool] = None,
) -> None:
"""Constructor
"""
"""Constructor"""
self._base_path = "http://localhost" if host is None else host
"""Default Base url
"""
@@ -251,7 +257,7 @@ conf = competition_api_client.Configuration(
"""
self.logger["package_logger"] = logging.getLogger("competition_api_client")
self.logger["urllib3_logger"] = logging.getLogger("urllib3")
self.logger_format = '%(asctime)s %(levelname)s %(message)s'
self.logger_format = "%(asctime)s %(levelname)s %(message)s"
"""Log format
"""
self.logger_stream_handler = None
@@ -310,7 +316,7 @@ conf = competition_api_client.Configuration(
self.proxy_headers = None
"""Proxy headers
"""
self.safe_chars_for_path_param = ''
self.safe_chars_for_path_param = ""
"""Safe chars for path_param
"""
self.retries = retries
@@ -331,12 +337,12 @@ conf = competition_api_client.Configuration(
"""date format
"""
def __deepcopy__(self, memo: Dict[int, Any]) -> Self:
def __deepcopy__(self, memo: Dict[int, Any]) -> Self:
cls = self.__class__
result = cls.__new__(cls)
memo[id(self)] = result
for k, v in self.__dict__.items():
if k not in ('logger', 'logger_file_handler'):
if k not in ("logger", "logger_file_handler"):
setattr(result, k, copy.deepcopy(v, memo))
# shallow copy of loggers
result.logger = copy.copy(self.logger)
@@ -468,7 +474,7 @@ conf = competition_api_client.Configuration(
self.__logger_format = value
self.logger_formatter = logging.Formatter(self.__logger_format)
def get_api_key_with_prefix(self, identifier: str, alias: Optional[str]=None) -> Optional[str]:
def get_api_key_with_prefix(self, identifier: str, alias: Optional[str] = None) -> Optional[str]:
"""Gets API key (with prefix if set).
:param identifier: The identifier of apiKey.
@@ -498,22 +504,20 @@ conf = competition_api_client.Configuration(
password = ""
if self.password is not None:
password = self.password
return urllib3.util.make_headers(
basic_auth=username + ':' + password
).get('authorization')
return urllib3.util.make_headers(basic_auth=username + ":" + password).get("authorization")
def auth_settings(self)-> AuthSettings:
def auth_settings(self) -> AuthSettings:
"""Gets Auth Settings dict for api client.
:return: The Auth Settings information dict.
"""
auth: AuthSettings = {}
if self.username is not None and self.password is not None:
auth['BasicAuth'] = {
'type': 'basic',
'in': 'header',
'key': 'Authorization',
'value': self.get_basic_auth_token()
auth["BasicAuth"] = {
"type": "basic",
"in": "header",
"key": "Authorization",
"value": self.get_basic_auth_token(),
}
return auth
@@ -522,12 +526,13 @@ conf = competition_api_client.Configuration(
:return: The report for debugging.
"""
return "Python SDK Debug Report:\n"\
"OS: {env}\n"\
"Python Version: {pyversion}\n"\
"Version of the API: 1.4.0\n"\
"SDK Package Version: 1.0.0".\
format(env=sys.platform, pyversion=sys.version)
return (
"Python SDK Debug Report:\n"
"OS: {env}\n"
"Python Version: {pyversion}\n"
"Version of the API: 1.4.0\n"
"SDK Package Version: 1.0.0".format(env=sys.platform, pyversion=sys.version)
)
def get_host_settings(self) -> List[HostSetting]:
"""Gets an array of host settings
@@ -536,16 +541,16 @@ conf = competition_api_client.Configuration(
"""
return [
{
'url': "",
'description': "No description provided",
"url": "",
"description": "No description provided",
}
]
def get_host_from_settings(
self,
index: Optional[int],
variables: Optional[ServerVariablesT]=None,
servers: Optional[List[HostSetting]]=None,
variables: Optional[ServerVariablesT] = None,
servers: Optional[List[HostSetting]] = None,
) -> str:
"""Gets host URL based on the index and variables
:param index: array index of the host settings
@@ -564,22 +569,20 @@ conf = competition_api_client.Configuration(
except IndexError:
raise ValueError(
"Invalid index {0} when selecting the host settings. "
"Must be less than {1}".format(index, len(servers)))
"Must be less than {1}".format(index, len(servers))
)
url = server['url']
url = server["url"]
# go through variables and replace placeholders
for variable_name, variable in server.get('variables', {}).items():
used_value = variables.get(
variable_name, variable['default_value'])
for variable_name, variable in server.get("variables", {}).items():
used_value = variables.get(variable_name, variable["default_value"])
if 'enum_values' in variable \
and used_value not in variable['enum_values']:
if "enum_values" in variable and used_value not in variable["enum_values"]:
raise ValueError(
"The variable `{0}` in the host URL has invalid value "
"{1}. Must be {2}.".format(
variable_name, variables[variable_name],
variable['enum_values']))
"{1}. Must be {2}.".format(variable_name, variables[variable_name], variable["enum_values"])
)
url = url.replace("{" + variable_name + "}", used_value)
@@ -1,27 +1,27 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
from typing import Any, Optional
from typing_extensions import Self
class OpenApiException(Exception):
"""The base exception class for all OpenAPIExceptions"""
class ApiTypeError(OpenApiException, TypeError):
def __init__(self, msg, path_to_item=None, valid_classes=None,
key_type=None) -> None:
""" Raises an exception for TypeErrors
def __init__(self, msg, path_to_item=None, valid_classes=None, key_type=None) -> None:
"""Raises an exception for TypeErrors
Args:
msg (str): the exception message
@@ -104,9 +104,9 @@ class ApiKeyError(OpenApiException, KeyError):
class ApiException(OpenApiException):
def __init__(
self,
status=None,
reason=None,
self,
status=None,
reason=None,
http_resp=None,
*,
body: Optional[str] = None,
@@ -125,17 +125,17 @@ class ApiException(OpenApiException):
self.reason = http_resp.reason
if self.body is None:
try:
self.body = http_resp.data.decode('utf-8')
self.body = http_resp.data.decode("utf-8")
except Exception:
pass
self.headers = http_resp.getheaders()
@classmethod
def from_response(
cls,
*,
http_resp,
body: Optional[str],
cls,
*,
http_resp,
body: Optional[str],
data: Optional[Any],
) -> Self:
if http_resp.status == 400:
@@ -163,11 +163,9 @@ class ApiException(OpenApiException):
def __str__(self):
"""Custom error messages for exception"""
error_message = "({0})\n"\
"Reason: {1}\n".format(self.status, self.reason)
error_message = "({0})\n" "Reason: {1}\n".format(self.status, self.reason)
if self.headers:
error_message += "HTTP response headers: {0}\n".format(
self.headers)
error_message += "HTTP response headers: {0}\n".format(self.headers)
if self.data or self.body:
error_message += "HTTP response body: {0}\n".format(self.data or self.body)
@@ -197,11 +195,13 @@ class ServiceException(ApiException):
class ConflictException(ApiException):
"""Exception for HTTP 409 Conflict."""
pass
class UnprocessableEntityException(ApiException):
"""Exception for HTTP 422 Unprocessable Entity."""
pass
@@ -2,14 +2,14 @@
# flake8: noqa
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
@@ -17,22 +17,36 @@
from buttercup.orchestrator.competition_api_client.models.types_architecture import TypesArchitecture
from buttercup.orchestrator.competition_api_client.models.types_assessment import TypesAssessment
from buttercup.orchestrator.competition_api_client.models.types_bundle_submission import TypesBundleSubmission
from buttercup.orchestrator.competition_api_client.models.types_bundle_submission_response import TypesBundleSubmissionResponse
from buttercup.orchestrator.competition_api_client.models.types_bundle_submission_response_verbose import TypesBundleSubmissionResponseVerbose
from buttercup.orchestrator.competition_api_client.models.types_bundle_submission_response import (
TypesBundleSubmissionResponse,
)
from buttercup.orchestrator.competition_api_client.models.types_bundle_submission_response_verbose import (
TypesBundleSubmissionResponseVerbose,
)
from buttercup.orchestrator.competition_api_client.models.types_error import TypesError
from buttercup.orchestrator.competition_api_client.models.types_freeform_response import TypesFreeformResponse
from buttercup.orchestrator.competition_api_client.models.types_freeform_submission import TypesFreeformSubmission
from buttercup.orchestrator.competition_api_client.models.types_fuzzing_engine import TypesFuzzingEngine
from buttercup.orchestrator.competition_api_client.models.types_message import TypesMessage
from buttercup.orchestrator.competition_api_client.models.types_pov_submission import TypesPOVSubmission
from buttercup.orchestrator.competition_api_client.models.types_pov_submission_response import TypesPOVSubmissionResponse
from buttercup.orchestrator.competition_api_client.models.types_pov_submission_response import (
TypesPOVSubmissionResponse,
)
from buttercup.orchestrator.competition_api_client.models.types_patch_submission import TypesPatchSubmission
from buttercup.orchestrator.competition_api_client.models.types_patch_submission_response import TypesPatchSubmissionResponse
from buttercup.orchestrator.competition_api_client.models.types_patch_submission_response import (
TypesPatchSubmissionResponse,
)
from buttercup.orchestrator.competition_api_client.models.types_ping_response import TypesPingResponse
from buttercup.orchestrator.competition_api_client.models.types_request_list_response import TypesRequestListResponse
from buttercup.orchestrator.competition_api_client.models.types_request_submission import TypesRequestSubmission
from buttercup.orchestrator.competition_api_client.models.types_sarif_submission import TypesSARIFSubmission
from buttercup.orchestrator.competition_api_client.models.types_sarif_submission_response import TypesSARIFSubmissionResponse
from buttercup.orchestrator.competition_api_client.models.types_sarif_assessment_response import TypesSarifAssessmentResponse
from buttercup.orchestrator.competition_api_client.models.types_sarif_assessment_submission import TypesSarifAssessmentSubmission
from buttercup.orchestrator.competition_api_client.models.types_sarif_submission_response import (
TypesSARIFSubmissionResponse,
)
from buttercup.orchestrator.competition_api_client.models.types_sarif_assessment_response import (
TypesSarifAssessmentResponse,
)
from buttercup.orchestrator.competition_api_client.models.types_sarif_assessment_submission import (
TypesSarifAssessmentSubmission,
)
from buttercup.orchestrator.competition_api_client.models.types_submission_status import TypesSubmissionStatus
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
@@ -26,12 +26,10 @@ class TypesArchitecture(str, Enum):
"""
allowed enum values
"""
ArchitectureX8664 = 'x86_64'
ArchitectureAArch64 = 'aarch64'
ArchitectureX8664 = "x86_64"
ArchitectureAArch64 = "aarch64"
@classmethod
def from_json(cls, json_str: str) -> Self:
"""Create an instance of TypesArchitecture from a JSON string"""
return cls(json.loads(json_str))
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
@@ -26,12 +26,10 @@ class TypesAssessment(str, Enum):
"""
allowed enum values
"""
AssessmentCorrect = 'correct'
AssessmentIncorrect = 'incorrect'
AssessmentCorrect = "correct"
AssessmentIncorrect = "incorrect"
@classmethod
def from_json(cls, json_str: str) -> Self:
"""Create an instance of TypesAssessment from a JSON string"""
return cls(json.loads(json_str))
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
@@ -22,17 +22,29 @@ from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class TypesBundleSubmission(BaseModel):
"""
TypesBundleSubmission
""" # noqa: E501
""" # noqa: E501
broadcast_sarif_id: Optional[StrictStr] = None
description: Optional[StrictStr] = Field(default=None, description="optional plaintext description of the components of the bundle, such as would be found in a pull request description or bug report")
description: Optional[StrictStr] = Field(
default=None,
description="optional plaintext description of the components of the bundle, such as would be found in a pull request description or bug report",
)
freeform_id: Optional[StrictStr] = None
patch_id: Optional[StrictStr] = None
pov_id: Optional[StrictStr] = None
submitted_sarif_id: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["broadcast_sarif_id", "description", "freeform_id", "patch_id", "pov_id", "submitted_sarif_id"]
__properties: ClassVar[List[str]] = [
"broadcast_sarif_id",
"description",
"freeform_id",
"patch_id",
"pov_id",
"submitted_sarif_id",
]
model_config = ConfigDict(
populate_by_name=True,
@@ -40,7 +52,6 @@ class TypesBundleSubmission(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -65,8 +76,7 @@ class TypesBundleSubmission(BaseModel):
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])
excluded_fields: Set[str] = set([])
_dict = self.model_dump(
by_alias=True,
@@ -84,14 +94,14 @@ class TypesBundleSubmission(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"broadcast_sarif_id": obj.get("broadcast_sarif_id"),
"description": obj.get("description"),
"freeform_id": obj.get("freeform_id"),
"patch_id": obj.get("patch_id"),
"pov_id": obj.get("pov_id"),
"submitted_sarif_id": obj.get("submitted_sarif_id")
})
_obj = cls.model_validate(
{
"broadcast_sarif_id": obj.get("broadcast_sarif_id"),
"description": obj.get("description"),
"freeform_id": obj.get("freeform_id"),
"patch_id": obj.get("patch_id"),
"pov_id": obj.get("pov_id"),
"submitted_sarif_id": obj.get("submitted_sarif_id"),
}
)
return _obj
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
@@ -23,12 +23,16 @@ from buttercup.orchestrator.competition_api_client.models.types_submission_statu
from typing import Optional, Set
from typing_extensions import Self
class TypesBundleSubmissionResponse(BaseModel):
"""
TypesBundleSubmissionResponse
""" # noqa: E501
""" # noqa: E501
bundle_id: StrictStr
status: TypesSubmissionStatus = Field(description="Schema-compliant submissions will only ever receive the statuses accepted or deadline_exceeded")
status: TypesSubmissionStatus = Field(
description="Schema-compliant submissions will only ever receive the statuses accepted or deadline_exceeded"
)
__properties: ClassVar[List[str]] = ["bundle_id", "status"]
model_config = ConfigDict(
@@ -37,7 +41,6 @@ class TypesBundleSubmissionResponse(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -62,8 +65,7 @@ class TypesBundleSubmissionResponse(BaseModel):
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])
excluded_fields: Set[str] = set([])
_dict = self.model_dump(
by_alias=True,
@@ -81,10 +83,5 @@ class TypesBundleSubmissionResponse(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"bundle_id": obj.get("bundle_id"),
"status": obj.get("status")
})
_obj = cls.model_validate({"bundle_id": obj.get("bundle_id"), "status": obj.get("status")})
return _obj
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
@@ -23,19 +23,32 @@ from buttercup.orchestrator.competition_api_client.models.types_submission_statu
from typing import Optional, Set
from typing_extensions import Self
class TypesBundleSubmissionResponseVerbose(BaseModel):
"""
TypesBundleSubmissionResponseVerbose
""" # noqa: E501
""" # noqa: E501
broadcast_sarif_id: Optional[StrictStr] = None
bundle_id: StrictStr
description: Optional[StrictStr] = None
freeform_id: Optional[StrictStr] = None
patch_id: Optional[StrictStr] = None
pov_id: Optional[StrictStr] = None
status: TypesSubmissionStatus = Field(description="Schema-compliant submissions will only ever receive the statuses accepted or deadline_exceeded")
status: TypesSubmissionStatus = Field(
description="Schema-compliant submissions will only ever receive the statuses accepted or deadline_exceeded"
)
submitted_sarif_id: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["broadcast_sarif_id", "bundle_id", "description", "freeform_id", "patch_id", "pov_id", "status", "submitted_sarif_id"]
__properties: ClassVar[List[str]] = [
"broadcast_sarif_id",
"bundle_id",
"description",
"freeform_id",
"patch_id",
"pov_id",
"status",
"submitted_sarif_id",
]
model_config = ConfigDict(
populate_by_name=True,
@@ -43,7 +56,6 @@ class TypesBundleSubmissionResponseVerbose(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -68,8 +80,7 @@ class TypesBundleSubmissionResponseVerbose(BaseModel):
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])
excluded_fields: Set[str] = set([])
_dict = self.model_dump(
by_alias=True,
@@ -87,16 +98,16 @@ class TypesBundleSubmissionResponseVerbose(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"broadcast_sarif_id": obj.get("broadcast_sarif_id"),
"bundle_id": obj.get("bundle_id"),
"description": obj.get("description"),
"freeform_id": obj.get("freeform_id"),
"patch_id": obj.get("patch_id"),
"pov_id": obj.get("pov_id"),
"status": obj.get("status"),
"submitted_sarif_id": obj.get("submitted_sarif_id")
})
_obj = cls.model_validate(
{
"broadcast_sarif_id": obj.get("broadcast_sarif_id"),
"bundle_id": obj.get("bundle_id"),
"description": obj.get("description"),
"freeform_id": obj.get("freeform_id"),
"patch_id": obj.get("patch_id"),
"pov_id": obj.get("pov_id"),
"status": obj.get("status"),
"submitted_sarif_id": obj.get("submitted_sarif_id"),
}
)
return _obj
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
@@ -22,10 +22,12 @@ from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class TypesError(BaseModel):
"""
TypesError
""" # noqa: E501
""" # noqa: E501
fields: Optional[Dict[str, StrictStr]] = None
message: StrictStr
__properties: ClassVar[List[str]] = ["fields", "message"]
@@ -36,7 +38,6 @@ class TypesError(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -61,8 +62,7 @@ class TypesError(BaseModel):
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])
excluded_fields: Set[str] = set([])
_dict = self.model_dump(
by_alias=True,
@@ -80,10 +80,5 @@ class TypesError(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"fields": obj.get("fields"),
"message": obj.get("message")
})
_obj = cls.model_validate({"fields": obj.get("fields"), "message": obj.get("message")})
return _obj
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
@@ -23,12 +23,16 @@ from buttercup.orchestrator.competition_api_client.models.types_submission_statu
from typing import Optional, Set
from typing_extensions import Self
class TypesFreeformResponse(BaseModel):
"""
TypesFreeformResponse
""" # noqa: E501
""" # noqa: E501
freeform_id: StrictStr
status: TypesSubmissionStatus = Field(description="Schema-compliant submissions will only ever receive the statuses accepted or deadline_exceeded")
status: TypesSubmissionStatus = Field(
description="Schema-compliant submissions will only ever receive the statuses accepted or deadline_exceeded"
)
__properties: ClassVar[List[str]] = ["freeform_id", "status"]
model_config = ConfigDict(
@@ -37,7 +41,6 @@ class TypesFreeformResponse(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -62,8 +65,7 @@ class TypesFreeformResponse(BaseModel):
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])
excluded_fields: Set[str] = set([])
_dict = self.model_dump(
by_alias=True,
@@ -81,10 +83,5 @@ class TypesFreeformResponse(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"freeform_id": obj.get("freeform_id"),
"status": obj.get("status")
})
_obj = cls.model_validate({"freeform_id": obj.get("freeform_id"), "status": obj.get("status")})
return _obj
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
@@ -22,10 +22,12 @@ from typing import Any, ClassVar, Dict, List
from typing import Optional, Set
from typing_extensions import Self
class TypesFreeformSubmission(BaseModel):
"""
TypesFreeformSubmission
""" # noqa: E501
""" # noqa: E501
submission: StrictStr = Field(description="Base64 encoded arbitrary data 2MiB max size before Base64 encoding")
__properties: ClassVar[List[str]] = ["submission"]
@@ -35,7 +37,6 @@ class TypesFreeformSubmission(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -60,8 +61,7 @@ class TypesFreeformSubmission(BaseModel):
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])
excluded_fields: Set[str] = set([])
_dict = self.model_dump(
by_alias=True,
@@ -79,9 +79,5 @@ class TypesFreeformSubmission(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"submission": obj.get("submission")
})
_obj = cls.model_validate({"submission": obj.get("submission")})
return _obj
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
@@ -26,11 +26,9 @@ class TypesFuzzingEngine(str, Enum):
"""
allowed enum values
"""
FuzzingEngineLibFuzzer = 'libfuzzer'
FuzzingEngineLibFuzzer = "libfuzzer"
@classmethod
def from_json(cls, json_str: str) -> Self:
"""Create an instance of TypesFuzzingEngine from a JSON string"""
return cls(json.loads(json_str))
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
@@ -22,10 +22,12 @@ from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class TypesMessage(BaseModel):
"""
TypesMessage
""" # noqa: E501
""" # noqa: E501
message: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["message"]
@@ -35,7 +37,6 @@ class TypesMessage(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -60,8 +61,7 @@ class TypesMessage(BaseModel):
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])
excluded_fields: Set[str] = set([])
_dict = self.model_dump(
by_alias=True,
@@ -79,9 +79,5 @@ class TypesMessage(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"message": obj.get("message")
})
_obj = cls.model_validate({"message": obj.get("message")})
return _obj
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
@@ -22,11 +22,15 @@ from typing import Any, ClassVar, Dict, List
from typing import Optional, Set
from typing_extensions import Self
class TypesPatchSubmission(BaseModel):
"""
TypesPatchSubmission
""" # noqa: E501
patch: StrictStr = Field(description="Base64 encoded patch in unified diff format 100KiB max size before Base64 encoding")
""" # noqa: E501
patch: StrictStr = Field(
description="Base64 encoded patch in unified diff format 100KiB max size before Base64 encoding"
)
__properties: ClassVar[List[str]] = ["patch"]
model_config = ConfigDict(
@@ -35,7 +39,6 @@ class TypesPatchSubmission(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -60,8 +63,7 @@ class TypesPatchSubmission(BaseModel):
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])
excluded_fields: Set[str] = set([])
_dict = self.model_dump(
by_alias=True,
@@ -79,9 +81,5 @@ class TypesPatchSubmission(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"patch": obj.get("patch")
})
_obj = cls.model_validate({"patch": obj.get("patch")})
return _obj
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
@@ -23,11 +23,15 @@ from buttercup.orchestrator.competition_api_client.models.types_submission_statu
from typing import Optional, Set
from typing_extensions import Self
class TypesPatchSubmissionResponse(BaseModel):
"""
TypesPatchSubmissionResponse
""" # noqa: E501
functionality_tests_passing: Optional[StrictBool] = Field(default=None, description="null indicates the tests have not been run")
""" # noqa: E501
functionality_tests_passing: Optional[StrictBool] = Field(
default=None, description="null indicates the tests have not been run"
)
patch_id: StrictStr
status: TypesSubmissionStatus
__properties: ClassVar[List[str]] = ["functionality_tests_passing", "patch_id", "status"]
@@ -38,7 +42,6 @@ class TypesPatchSubmissionResponse(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -63,8 +66,7 @@ class TypesPatchSubmissionResponse(BaseModel):
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])
excluded_fields: Set[str] = set([])
_dict = self.model_dump(
by_alias=True,
@@ -82,11 +84,11 @@ class TypesPatchSubmissionResponse(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"functionality_tests_passing": obj.get("functionality_tests_passing"),
"patch_id": obj.get("patch_id"),
"status": obj.get("status")
})
_obj = cls.model_validate(
{
"functionality_tests_passing": obj.get("functionality_tests_passing"),
"patch_id": obj.get("patch_id"),
"status": obj.get("status"),
}
)
return _obj
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
@@ -22,10 +22,12 @@ from typing import Any, ClassVar, Dict, List
from typing import Optional, Set
from typing_extensions import Self
class TypesPingResponse(BaseModel):
"""
TypesPingResponse
""" # noqa: E501
""" # noqa: E501
status: StrictStr
__properties: ClassVar[List[str]] = ["status"]
@@ -35,7 +37,6 @@ class TypesPingResponse(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -60,8 +61,7 @@ class TypesPingResponse(BaseModel):
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])
excluded_fields: Set[str] = set([])
_dict = self.model_dump(
by_alias=True,
@@ -79,9 +79,5 @@ class TypesPingResponse(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"status": obj.get("status")
})
_obj = cls.model_validate({"status": obj.get("status")})
return _obj
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
@@ -25,14 +25,20 @@ from buttercup.orchestrator.competition_api_client.models.types_fuzzing_engine i
from typing import Optional, Set
from typing_extensions import Self
class TypesPOVSubmission(BaseModel):
"""
TypesPOVSubmission
""" # noqa: E501
""" # noqa: E501
architecture: TypesArchitecture
engine: TypesFuzzingEngine
fuzzer_name: Annotated[str, Field(strict=True, max_length=4096)] = Field(description="Fuzz Tooling fuzzer that exercises this vuln 4KiB max size")
sanitizer: Annotated[str, Field(strict=True, max_length=4096)] = Field(description="Fuzz Tooling Sanitizer that exercises this vuln 4KiB max size")
fuzzer_name: Annotated[str, Field(strict=True, max_length=4096)] = Field(
description="Fuzz Tooling fuzzer that exercises this vuln 4KiB max size"
)
sanitizer: Annotated[str, Field(strict=True, max_length=4096)] = Field(
description="Fuzz Tooling Sanitizer that exercises this vuln 4KiB max size"
)
testcase: StrictStr = Field(description="Base64 encoded vuln trigger 2MiB max size before Base64 encoding")
__properties: ClassVar[List[str]] = ["architecture", "engine", "fuzzer_name", "sanitizer", "testcase"]
@@ -42,7 +48,6 @@ class TypesPOVSubmission(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -67,8 +72,7 @@ class TypesPOVSubmission(BaseModel):
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])
excluded_fields: Set[str] = set([])
_dict = self.model_dump(
by_alias=True,
@@ -86,13 +90,13 @@ class TypesPOVSubmission(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"architecture": obj.get("architecture"),
"engine": obj.get("engine"),
"fuzzer_name": obj.get("fuzzer_name"),
"sanitizer": obj.get("sanitizer"),
"testcase": obj.get("testcase")
})
_obj = cls.model_validate(
{
"architecture": obj.get("architecture"),
"engine": obj.get("engine"),
"fuzzer_name": obj.get("fuzzer_name"),
"sanitizer": obj.get("sanitizer"),
"testcase": obj.get("testcase"),
}
)
return _obj
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
@@ -23,10 +23,12 @@ from buttercup.orchestrator.competition_api_client.models.types_submission_statu
from typing import Optional, Set
from typing_extensions import Self
class TypesPOVSubmissionResponse(BaseModel):
"""
TypesPOVSubmissionResponse
""" # noqa: E501
""" # noqa: E501
pov_id: StrictStr
status: TypesSubmissionStatus
__properties: ClassVar[List[str]] = ["pov_id", "status"]
@@ -37,7 +39,6 @@ class TypesPOVSubmissionResponse(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -62,8 +63,7 @@ class TypesPOVSubmissionResponse(BaseModel):
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])
excluded_fields: Set[str] = set([])
_dict = self.model_dump(
by_alias=True,
@@ -81,10 +81,5 @@ class TypesPOVSubmissionResponse(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"pov_id": obj.get("pov_id"),
"status": obj.get("status")
})
_obj = cls.model_validate({"pov_id": obj.get("pov_id"), "status": obj.get("status")})
return _obj
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
@@ -22,10 +22,12 @@ from typing import Any, ClassVar, Dict, List
from typing import Optional, Set
from typing_extensions import Self
class TypesRequestListResponse(BaseModel):
"""
TypesRequestListResponse
""" # noqa: E501
""" # noqa: E501
challenges: List[StrictStr] = Field(description="List of challenges that competitors may task themselves with")
__properties: ClassVar[List[str]] = ["challenges"]
@@ -35,7 +37,6 @@ class TypesRequestListResponse(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -60,8 +61,7 @@ class TypesRequestListResponse(BaseModel):
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])
excluded_fields: Set[str] = set([])
_dict = self.model_dump(
by_alias=True,
@@ -79,9 +79,5 @@ class TypesRequestListResponse(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"challenges": obj.get("challenges")
})
_obj = cls.model_validate({"challenges": obj.get("challenges")})
return _obj
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
@@ -22,11 +22,15 @@ from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class TypesRequestSubmission(BaseModel):
"""
TypesRequestSubmission
""" # noqa: E501
duration_secs: Optional[StrictInt] = Field(default=None, description="Time in seconds until a task should expire. If not provided, defaults to 3600.")
""" # noqa: E501
duration_secs: Optional[StrictInt] = Field(
default=None, description="Time in seconds until a task should expire. If not provided, defaults to 3600."
)
__properties: ClassVar[List[str]] = ["duration_secs"]
model_config = ConfigDict(
@@ -35,7 +39,6 @@ class TypesRequestSubmission(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -60,8 +63,7 @@ class TypesRequestSubmission(BaseModel):
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])
excluded_fields: Set[str] = set([])
_dict = self.model_dump(
by_alias=True,
@@ -79,9 +81,5 @@ class TypesRequestSubmission(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"duration_secs": obj.get("duration_secs")
})
_obj = cls.model_validate({"duration_secs": obj.get("duration_secs")})
return _obj
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
@@ -23,10 +23,12 @@ from buttercup.orchestrator.competition_api_client.models.types_submission_statu
from typing import Optional, Set
from typing_extensions import Self
class TypesSarifAssessmentResponse(BaseModel):
"""
TypesSarifAssessmentResponse
""" # noqa: E501
""" # noqa: E501
status: TypesSubmissionStatus
__properties: ClassVar[List[str]] = ["status"]
@@ -36,7 +38,6 @@ class TypesSarifAssessmentResponse(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -61,8 +62,7 @@ class TypesSarifAssessmentResponse(BaseModel):
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])
excluded_fields: Set[str] = set([])
_dict = self.model_dump(
by_alias=True,
@@ -80,9 +80,5 @@ class TypesSarifAssessmentResponse(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"status": obj.get("status")
})
_obj = cls.model_validate({"status": obj.get("status")})
return _obj
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
@@ -24,12 +24,16 @@ from buttercup.orchestrator.competition_api_client.models.types_assessment impor
from typing import Optional, Set
from typing_extensions import Self
class TypesSarifAssessmentSubmission(BaseModel):
"""
TypesSarifAssessmentSubmission
""" # noqa: E501
""" # noqa: E501
assessment: TypesAssessment
description: Annotated[str, Field(strict=True, max_length=131072)] = Field(description="Plain text reasoning for the assessment. Must be nonempty. 128KiB max size")
description: Annotated[str, Field(strict=True, max_length=131072)] = Field(
description="Plain text reasoning for the assessment. Must be nonempty. 128KiB max size"
)
__properties: ClassVar[List[str]] = ["assessment", "description"]
model_config = ConfigDict(
@@ -38,7 +42,6 @@ class TypesSarifAssessmentSubmission(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -63,8 +66,7 @@ class TypesSarifAssessmentSubmission(BaseModel):
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])
excluded_fields: Set[str] = set([])
_dict = self.model_dump(
by_alias=True,
@@ -82,10 +84,5 @@ class TypesSarifAssessmentSubmission(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"assessment": obj.get("assessment"),
"description": obj.get("description")
})
_obj = cls.model_validate({"assessment": obj.get("assessment"), "description": obj.get("description")})
return _obj
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
@@ -22,10 +22,12 @@ from typing import Any, ClassVar, Dict, List
from typing import Optional, Set
from typing_extensions import Self
class TypesSARIFSubmission(BaseModel):
"""
TypesSARIFSubmission
""" # noqa: E501
""" # noqa: E501
sarif: Dict[str, Any] = Field(description="SARIF object compliant with the provided schema")
__properties: ClassVar[List[str]] = ["sarif"]
@@ -35,7 +37,6 @@ class TypesSARIFSubmission(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -60,8 +61,7 @@ class TypesSARIFSubmission(BaseModel):
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])
excluded_fields: Set[str] = set([])
_dict = self.model_dump(
by_alias=True,
@@ -79,9 +79,5 @@ class TypesSARIFSubmission(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"sarif": obj.get("sarif")
})
_obj = cls.model_validate({"sarif": obj.get("sarif")})
return _obj
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
@@ -23,11 +23,15 @@ from buttercup.orchestrator.competition_api_client.models.types_submission_statu
from typing import Optional, Set
from typing_extensions import Self
class TypesSARIFSubmissionResponse(BaseModel):
"""
TypesSARIFSubmissionResponse
""" # noqa: E501
status: TypesSubmissionStatus = Field(description="Schema-compliant submissions will only ever receive the statuses accepted or deadline_exceeded")
""" # noqa: E501
status: TypesSubmissionStatus = Field(
description="Schema-compliant submissions will only ever receive the statuses accepted or deadline_exceeded"
)
submitted_sarif_id: StrictStr
__properties: ClassVar[List[str]] = ["status", "submitted_sarif_id"]
@@ -37,7 +41,6 @@ class TypesSARIFSubmissionResponse(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -62,8 +65,7 @@ class TypesSARIFSubmissionResponse(BaseModel):
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])
excluded_fields: Set[str] = set([])
_dict = self.model_dump(
by_alias=True,
@@ -81,10 +83,5 @@ class TypesSARIFSubmissionResponse(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"status": obj.get("status"),
"submitted_sarif_id": obj.get("submitted_sarif_id")
})
_obj = cls.model_validate({"status": obj.get("status"), "submitted_sarif_id": obj.get("submitted_sarif_id")})
return _obj
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
@@ -26,16 +26,14 @@ class TypesSubmissionStatus(str, Enum):
"""
allowed enum values
"""
SubmissionStatusAccepted = 'accepted'
SubmissionStatusPassed = 'passed'
SubmissionStatusFailed = 'failed'
SubmissionStatusDeadlineExceeded = 'deadline_exceeded'
SubmissionStatusErrored = 'errored'
SubmissionStatusInconclusive = 'inconclusive'
SubmissionStatusAccepted = "accepted"
SubmissionStatusPassed = "passed"
SubmissionStatusFailed = "failed"
SubmissionStatusDeadlineExceeded = "deadline_exceeded"
SubmissionStatusErrored = "errored"
SubmissionStatusInconclusive = "inconclusive"
@classmethod
def from_json(cls, json_str: str) -> Self:
"""Create an instance of TypesSubmissionStatus from a JSON string"""
return cls(json.loads(json_str))
@@ -1,14 +1,14 @@
# coding: utf-8
"""
Example Competition API
Example Competition API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 1.4.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501
@@ -79,22 +79,19 @@ class RESTClientObject:
"ca_cert_data": configuration.ca_cert_data,
}
if configuration.assert_hostname is not None:
pool_args['assert_hostname'] = (
configuration.assert_hostname
)
pool_args["assert_hostname"] = configuration.assert_hostname
if configuration.retries is not None:
pool_args['retries'] = configuration.retries
pool_args["retries"] = configuration.retries
if configuration.tls_server_name:
pool_args['server_hostname'] = configuration.tls_server_name
pool_args["server_hostname"] = configuration.tls_server_name
if configuration.socket_options is not None:
pool_args['socket_options'] = configuration.socket_options
pool_args["socket_options"] = configuration.socket_options
if configuration.connection_pool_maxsize is not None:
pool_args['maxsize'] = configuration.connection_pool_maxsize
pool_args["maxsize"] = configuration.connection_pool_maxsize
# https pool manager
self.pool_manager: urllib3.PoolManager
@@ -102,6 +99,7 @@ class RESTClientObject:
if configuration.proxy:
if is_socks_proxy_url(configuration.proxy):
from urllib3.contrib.socks import SOCKSProxyManager
pool_args["proxy_url"] = configuration.proxy
pool_args["headers"] = configuration.proxy_headers
self.pool_manager = SOCKSProxyManager(**pool_args)
@@ -112,15 +110,7 @@ class RESTClientObject:
else:
self.pool_manager = urllib3.PoolManager(**pool_args)
def request(
self,
method,
url,
headers=None,
body=None,
post_params=None,
_request_timeout=None
):
def request(self, method, url, headers=None, body=None, post_params=None, _request_timeout=None):
"""Perform requests.
:param method: http request method
@@ -136,20 +126,10 @@ class RESTClientObject:
(connection, read) timeouts.
"""
method = method.upper()
assert method in [
'GET',
'HEAD',
'DELETE',
'POST',
'PUT',
'PATCH',
'OPTIONS'
]
assert method in ["GET", "HEAD", "DELETE", "POST", "PUT", "PATCH", "OPTIONS"]
if post_params and body:
raise ApiValueError(
"body parameter cannot be used with post_params parameter."
)
raise ApiValueError("body parameter cannot be used with post_params parameter.")
post_params = post_params or {}
headers = headers or {}
@@ -158,37 +138,23 @@ class RESTClientObject:
if _request_timeout:
if isinstance(_request_timeout, (int, float)):
timeout = urllib3.Timeout(total=_request_timeout)
elif (
isinstance(_request_timeout, tuple)
and len(_request_timeout) == 2
):
timeout = urllib3.Timeout(
connect=_request_timeout[0],
read=_request_timeout[1]
)
elif isinstance(_request_timeout, tuple) and len(_request_timeout) == 2:
timeout = urllib3.Timeout(connect=_request_timeout[0], read=_request_timeout[1])
try:
# For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
if method in ["POST", "PUT", "PATCH", "OPTIONS", "DELETE"]:
# no content type provided or payload is json
content_type = headers.get('Content-Type')
if (
not content_type
or re.search('json', content_type, re.IGNORECASE)
):
content_type = headers.get("Content-Type")
if not content_type or re.search("json", content_type, re.IGNORECASE):
request_body = None
if body is not None:
request_body = json.dumps(body)
r = self.pool_manager.request(
method,
url,
body=request_body,
timeout=timeout,
headers=headers,
preload_content=False
method, url, body=request_body, timeout=timeout, headers=headers, preload_content=False
)
elif content_type == 'application/x-www-form-urlencoded':
elif content_type == "application/x-www-form-urlencoded":
r = self.pool_manager.request(
method,
url,
@@ -196,15 +162,15 @@ class RESTClientObject:
encode_multipart=False,
timeout=timeout,
headers=headers,
preload_content=False
preload_content=False,
)
elif content_type == 'multipart/form-data':
elif content_type == "multipart/form-data":
# must del headers['Content-Type'], or the correct
# Content-Type which generated by urllib3 will be
# overwritten.
del headers['Content-Type']
del headers["Content-Type"]
# Ensures that dict objects are serialized
post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a,b) for a, b in post_params]
post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a, b) for a, b in post_params]
r = self.pool_manager.request(
method,
url,
@@ -212,29 +178,20 @@ class RESTClientObject:
encode_multipart=True,
timeout=timeout,
headers=headers,
preload_content=False
preload_content=False,
)
# Pass a `string` parameter directly in the body to support
# other content types than JSON when `body` argument is
# provided in serialized form.
elif isinstance(body, str) or isinstance(body, bytes):
r = self.pool_manager.request(
method,
url,
body=body,
timeout=timeout,
headers=headers,
preload_content=False
method, url, body=body, timeout=timeout, headers=headers, preload_content=False
)
elif headers['Content-Type'].startswith('text/') and isinstance(body, bool):
elif headers["Content-Type"].startswith("text/") and isinstance(body, bool):
request_body = "true" if body else "false"
r = self.pool_manager.request(
method,
url,
body=request_body,
preload_content=False,
timeout=timeout,
headers=headers)
method, url, body=request_body, preload_content=False, timeout=timeout, headers=headers
)
else:
# Cannot generate the request from given parameters
msg = """Cannot prepare a request message for provided
@@ -244,12 +201,7 @@ class RESTClientObject:
# For `GET`, `HEAD`
else:
r = self.pool_manager.request(
method,
url,
fields={},
timeout=timeout,
headers=headers,
preload_content=False
method, url, fields={}, timeout=timeout, headers=headers, preload_content=False
)
except urllib3.exceptions.SSLError as e:
msg = "\n".join([type(e).__name__, str(e)])
@@ -1,18 +1,19 @@
from buttercup.orchestrator.downloader.downloader import Downloader
import requests
import requests.adapters
from pydantic_settings import get_subcommand
from redis import Redis
from requests_file import FileAdapter
from buttercup.common.datastructures.msg_pb2 import SourceDetail, Task
from buttercup.common.logger import setup_package_logger
from buttercup.orchestrator.downloader.config import (
DownloaderSettings,
DownloaderServeCommand,
DownloaderProcessCommand,
DownloaderServeCommand,
DownloaderSettings,
TaskType,
)
from buttercup.common.logger import setup_package_logger
from pydantic_settings import get_subcommand
from buttercup.common.datastructures.msg_pb2 import Task, SourceDetail
from buttercup.orchestrator.downloader.downloader import Downloader
from buttercup.orchestrator.utils import response_stream_to_file
from redis import Redis
import requests.adapters
from requests_file import FileAdapter
import requests
def prepare_task(command: DownloaderProcessCommand, session: requests.Session) -> Task:
@@ -1,11 +1,11 @@
from pydantic_settings import BaseSettings, CliPositionalArg, CliSubCommand
from pydantic import BaseModel
from typing import Annotated
from pydantic import Field
from pathlib import Path
from enum import Enum
import time
import uuid
from enum import Enum
from pathlib import Path
from typing import Annotated
from pydantic import BaseModel, Field
from pydantic_settings import BaseSettings, CliPositionalArg, CliSubCommand
class DownloaderServeCommand(BaseModel):

Some files were not shown because too many files have changed in this diff Show More