// offending code· 3 files flaggedpatterns: 16
--- sealights_python_agent-2.10.10/setup.py (excerpt) ---
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# To use a consistent encoding
from codecs import open
from os import path
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
import python_agent
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, "README.rst"), encoding="utf-8") as f:
readme = f.read()
with open(path.join(here, "CHANGES.rst"), encoding="utf-8") as f:
changes = f.read()
with open(path.join(here, "requirements.txt")) as f:
requirements = f.read().splitlines()
# python 3.3 use case where dependencies are read as bytes of the form b'APScheduler==3.0.6'
requirements = [
requirement.decode() if isinstance(requirement, bytes) else requirement
for requirement in requirements
]
setup(
name=python_agent.__package_name__,
# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# https://packaging.python.org/en/latest/single_source_version.html
version=python_agent.__version__,
description="Tricentis Sealights Python Agent - Quality Intelligence and Code Coverage",
long_description="\n\n".join([readme, changes]),
long_description_content_type="text/x-rst",
url="https://www.tricentis.com/products/sealights",
project_urls={
--- sealights_python_agent-2.10.10/python_agent/__init__.py (excerpt) ---
import os
import sys
from logging.config import dictConfig
# Python 3.13 compatibility: handle potential import issues gracefully
try:
import urllib3
from urllib3.exceptions import InsecureRequestWarning
urllib3.disable_warnings(InsecureRequestWarning)
except ImportError:
# Fallback for potential import issues on Python 3.13
try:
import urllib3
from urllib3.exceptions import InsecureRequestWarning
urllib3.disable_warnings(InsecureRequestWarning)
except ImportError:
# If urllib3 is not available, continue without warnings suppression
pass
__legacy_mode__ = os.environ.get("SL_LEGACY_MODE", "false").lower() == "true"
__version__ = "2.10.10"
__package_name__ = "sealights_python_agent"
# Python 3.13 support notification
if sys.version_info >= (3, 13):
import logging
logger = logging.getLogger(__name__)
logger.debug(
f"Sealights Python Agent v{__version__} running on Python {sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}"
)
#################### PyNext Mode ####################
if not __legacy_mode__:
log_level = os.environ.get("SL_LOG_LEVEL", "ERROR").upper()
is_debug = os.environ.get("SL_DEBUG", "false").lower() == "true"
current_level = "DEBUG" if is_debug else log_level
save_log_file = os.environ.get("SL_SAVE_LOG_FILE", "false").lower() == "true"
LOG_CONF = {
"version": 1,
"disable_existing_loggers": False,
"fo
--- sealights_python_agent-2.10.10/python_agent/admin.py (excerpt) ---
import datetime
import functools
import logging
import os
import sys
import requests
from python_agent import __legacy_mode__ as is_legacy_mode
from python_agent import __version__ as AGENT_VERSION
from python_agent.build_scanner.executors.build import Build
from python_agent.build_scanner.executors.config import Config
from python_agent.build_scanner.executors.pr_config import PrConfig
from python_agent.common import constants
from python_agent.common.config_data import ScmConfigArgs
from python_agent.common.configuration_manager import ConfigurationManager
from python_agent.common.constants import DEFAULT_WORKSPACEPATH
from python_agent.common.constants import (
TOKEN_FILE,
BUILD_SESSION_ID_FILE,
TEST_RECOMMENDATION,
DEFAULT_BRANCH_NAME,
)
from python_agent.common.log.console_message_renderer import ConsoleMessageTemplates
from python_agent.packages import click
from python_agent.packages.click.core import F
from python_agent.packages.coverage.cmdline import Opts, unshell_list
from python_agent.serverless.serverless import Serverless
from python_agent.test_listener.executors.end_execution import EndAnonymousExecution
from python_agent import __version__
if is_legacy_mode:
from python_agent.test_listener.executors.run_legacy import Run
from python_agent.test_listener.executors.send_footprints_legacy import (
SendFootprintsAnonymousExecution,
)
CONTEXT_SETTINGS = dict(
token_normalize_func=lambda x: x.lower(),
ignor