repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
clearml | clearml/utilities/pigar/unpack.py | .py | # -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
import io
import re
import string
import tarfile
import zipfile
from types import TracebackType
from typing import List, Optional, Type, Any
class Archive(object):
"""Archive provides a consistent interface for unpacking
... | 127 | 3,870 |
clearml | clearml/utilities/pigar/log.py | .py | # -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
import logging.handlers
logger = logging.getLogger("pigar")
logger.setLevel(logging.WARNING)
| 9 | 185 |
clearml | clearml/utilities/pigar/reqs.py | .py | # -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
import ast
import collections
import doctest
import fnmatch
import functools
import importlib
import json
import os
import sys
from typing import Tuple, Set, Optional, Callable, Union, Dict, Any
import six
from pathlib2 import P... | 512 | 19,663 |
clearml | clearml/utilities/plotlympl/mpltools.py | .py | """
Tools
A module for converting from mpl language to plotly language.
"""
import math
import warnings
from typing import Tuple, Optional, Union, List, Any
import matplotlib.dates
from matplotlib import __version__ as matplotlib_version
try:
from matplotlib.patches import FancyBboxPatch
except ImportError:
... | 666 | 23,952 |
clearml | clearml/utilities/plotlympl/renderer.py | .py | """
Renderer Module
This module defines the PlotlyRenderer class and a single function,
fig_to_plotly, which is intended to be the main way that user's will interact
with the matplotlylib package.
"""
from __future__ import absolute_import
import warnings
from typing import Optional, TextIO, List, Union, Dict, Any
... | 747 | 32,427 |
clearml | clearml/utilities/plotlympl/__init__.py | .py | """
matplotlylib
============
This module converts matplotlib figure objects into JSON structures which can
be understood and visualized by Plotly.
Most of the functionality should be accessed through the parent directory's
'tools' module or 'plotly' package.
"""
from __future__ import absolute_import
from .mplexpo... | 18 | 420 |
clearml | clearml/utilities/plotlympl/mplexporter/utils.py | .py | """
Utility Routines for Working with Matplotlib Objects
====================================================
"""
import base64
import io
import itertools
import warnings
from typing import Dict, Tuple, Union, List, Iterator, Any
import matplotlib
import numpy
import numpy as np
from matplotlib import ticker
from matp... | 372 | 12,180 |
clearml | clearml/utilities/plotlympl/mplexporter/_py3k_compat.py | .py | """
Simple fixes for Python 2/3 compatibility
"""
import sys
PY3K = sys.version_info[0] >= 3
if PY3K:
import builtins
import functools
reduce = functools.reduce
zip = builtins.zip
xrange = builtins.range
map = builtins.map
else:
import __builtin__
import itertools
builtins = __bu... | 25 | 442 |
clearml | clearml/utilities/plotlympl/mplexporter/__init__.py | .py | from .exporter import Exporter
from .renderers import Renderer
__all__ = ["Renderer", "Exporter"]
| 5 | 99 |
clearml | clearml/utilities/plotlympl/mplexporter/tools.py | .py | """
Tools for matplotlib plot exporting
"""
def ipynb_vega_init() -> None:
"""Initialize the IPython notebook display elements
This function borrows heavily from the excellent vincent package:
http://github.com/wrobstory/vincent
"""
try:
from IPython.core.display import display, HTML
... | 56 | 1,734 |
clearml | clearml/utilities/plotlympl/mplexporter/exporter.py | .py | """
Matplotlib Exporter
===================
This submodule contains tools for crawling a matplotlib figure and exporting
relevant pieces to a renderer.
"""
import io
import warnings
from typing import Tuple, Union, Any
import matplotlib
import numpy
from matplotlib import transforms, collections # noqa: F401
from mat... | 333 | 12,934 |
clearml | clearml/utilities/plotlympl/mplexporter/renderers/fake_renderer.py | .py | from typing import Optional, Any
import numpy
from .base import Renderer
class FakeRenderer(Renderer):
"""
Fake Renderer
This is a fake renderer which simply outputs a text tree representing the
elements found in the plot(s). This is used in the unit tests for the
package.
Below are the m... | 118 | 3,343 |
clearml | clearml/utilities/plotlympl/mplexporter/renderers/vincent_renderer.py | .py | import warnings
from typing import Dict, Union, Optional, TYPE_CHECKING, Any
import numpy
from .base import Renderer
from ..exporter import Exporter
if TYPE_CHECKING:
import vincent
class VincentRenderer(Renderer):
def open_figure(self, fig: Any, props: Dict[str, Union[int, float]]) -> None:
self.c... | 72 | 2,227 |
clearml | clearml/utilities/plotlympl/mplexporter/renderers/__init__.py | .py | """
Matplotlib Renderers
====================
This submodule contains renderer objects which define renderer behavior used
within the Exporter class. The base renderer class is :class:`Renderer`, an
abstract base class
"""
from .base import Renderer
from .fake_renderer import FakeRenderer, FullFakeRenderer
from .vega... | 23 | 584 |
clearml | clearml/utilities/plotlympl/mplexporter/renderers/base.py | .py | import itertools
import warnings
from contextlib import contextmanager
from typing import Generator, Optional, Sequence, List, Tuple, Dict, Any
import matplotlib
import matplotlib as mpl
import numpy as np
from matplotlib import transforms
from clearml.utilities.distutils_version import LooseVersion
from .. import _p... | 470 | 16,182 |
clearml | clearml/utilities/plotlympl/mplexporter/renderers/vega_renderer.py | .py | import json
import random
import warnings
from typing import Dict, Union, List, Tuple, Optional, Any
from .base import Renderer
from ..exporter import Exporter
class VegaRenderer(Renderer):
def open_figure(self, fig: Any, props: Dict[str, Union[int, float]]) -> None:
self.props = props
self.figwi... | 174 | 5,480 |
clearml | clearml/utilities/process/mp.py | .py | import os
import pickle
import struct
import sys
from functools import partial
from multiprocessing import Process, Semaphore, Event as ProcessEvent
from threading import Thread, Event as TrEvent, RLock as ThreadRLock
from time import sleep, time
from types import TracebackType
from typing import List, Dict, Optional, ... | 912 | 31,897 |
clearml | clearml/utilities/process/exit_hooks.py | .py | import atexit
import os
import signal
import sys
import types
from typing import Callable, Union, Any
from ...logger import Logger
class ExitHooks:
_orig_exit = None
_orig_exc_handler = None
remote_user_aborted = False
def __init__(self, callback: Callable) -> None:
self.exit_code = None
... | 192 | 6,565 |
clearml | clearml/utilities/lowlevel/distributed.py | .py | import os
from logging import getLogger
from time import sleep, time
from typing import Optional
from pathlib2 import Path
def get_torch_local_rank() -> Optional[int]:
"""
return the local rank of the process, notice local rank 0 does not mean global rank 0
return None if no torch distributed is running
... | 98 | 3,060 |
clearml | clearml/utilities/lowlevel/astor_unparse.py | .py | from __future__ import print_function, unicode_literals
import ast
import sys
from typing import Callable, Iterable, TextIO, Tuple, Optional, Any
import six
from six import StringIO
# Large float and imaginary literals get turned into infinities in the AST.
# We unparse those infinities to INFSTR.
INFSTR = "1e" + re... | 927 | 28,907 |
clearml | clearml/utilities/lowlevel/threads.py | .py | import ctypes
import sys
import threading
import time
from typing import Any
import six
def get_current_thread_id() -> int:
return threading._get_ident() if six.PY2 else threading.get_ident() # noqa
# Nasty hack to raise exception for other threads
def _lowlevel_async_raise(thread_obj: threading.Thread, excep... | 129 | 3,575 |
clearml | clearml/utilities/lowlevel/file_access.py | .py | import os
import sys
from functools import partial
from typing import Optional, Callable, Any
def __buffer_writer_close_patch(self) -> None:
self._trains_org_close()
# noinspection PyBroadException
try:
self._trains_close_cb(self)
except Exception:
pass
def buffer_writer_close_cb(buf... | 90 | 3,365 |
clearml | clearml/utilities/wizard/user_input.py | .py | from typing import Optional, List, Tuple
def get_input(
key: str,
description: str = "",
question: str = "Enter",
required: bool = False,
default: Optional[str] = None,
new_line: bool = False,
) -> Optional[str]:
if new_line:
print()
while True:
value = input("{} {} {}:... | 104 | 2,971 |
clearml | clearml/utilities/pyhocon/exceptions.py | .py | class ConfigException(Exception):
def __init__(self, message, ex=None):
super(ConfigException, self).__init__(message)
self._exception = ex
class ConfigMissingException(ConfigException, KeyError):
pass
class ConfigSubstitutionException(ConfigException):
pass
class ConfigWrongTypeExcep... | 18 | 352 |
clearml | clearml/utilities/pyhocon/config_tree.py | .py | from collections import OrderedDict
from pyparsing import lineno
from pyparsing import col
try:
basestring
except NameError: # pragma: no cover
basestring = str
unicode = str
import re
import copy
from .exceptions import ConfigException, ConfigWrongTypeException, ConfigMissingException
class UndefinedKe... | 609 | 22,533 |
clearml | clearml/utilities/pyhocon/config_parser.py | .py | import itertools
import re
import os
import socket
import contextlib
import codecs
from datetime import timedelta
from pyparsing import Forward, Keyword, QuotedString, Word, Literal, Suppress, Regex, Optional, SkipTo, ZeroOrMore, \
Group, lineno, col, TokenConverter, replaceWith, alphanums, alphas8bit, ParseSyntax... | 763 | 32,918 |
clearml | clearml/utilities/pyhocon/converter.py | .py | import json
import re
import sys
from . import ConfigFactory
from .config_tree import ConfigQuotedString
from .config_tree import ConfigSubstitution
from .config_tree import ConfigTree
from .config_tree import ConfigValues
from .config_tree import NoneValue
try:
basestring
except NameError:
basestring = str
... | 330 | 13,100 |
clearml | clearml/utilities/locks/utils.py | .py | import atexit
import contextlib
import os
import tempfile
import time
from multiprocessing import RLock as ProcessRLock
from types import TracebackType
from typing import Generator, TextIO, Optional, Type, Any
from . import constants
from . import exceptions
from . import portalocker
current_time = getattr(time, "mon... | 375 | 11,381 |
clearml | clearml/utilities/locks/exceptions.py | .py | from typing import Any
class BaseLockException(Exception):
# Error codes:
LOCK_FAILED = 1
def __init__(self, *args: Any, **kwargs: Any) -> None:
self.fh = kwargs.pop("fh", None)
Exception.__init__(self, *args, **kwargs)
class LockException(BaseLockException):
pass
class AlreadyLoc... | 23 | 402 |
clearml | clearml/utilities/locks/__init__.py | .py | from .utils import RLock, Lock
__all__ = ["RLock", "Lock"]
| 4 | 60 |
clearml | clearml/utilities/locks/constants.py | .py | """
Locking constants
Lock types:
- `LOCK_EX` exclusive lock
- `LOCK_SH` shared lock
Lock flags:
- `LOCK_NB` non-blocking
Manually unlock, only needed internally
- `LOCK_UN` unlock
"""
import os
# The actual tests will execute the code anyhow so the following code can
# safely be ignored from the coverage tests
... | 42 | 937 |
clearml | clearml/utilities/locks/portalocker.py | .py | import os
from typing import Any
from . import constants
from . import exceptions
if os.name == "nt": # pragma: no cover
import msvcrt
lock_length = int(2**31 - 1)
def lock(file_: Any, flags: int) -> None:
if flags & constants.LOCK_SH:
import win32file
import pywintypes
... | 141 | 5,494 |
clearml | clearml/debugging/trace.py | .py | import inspect
import os
import sys
import threading
import time
import types
import zipfile
from typing import Callable, Union, Optional, List, TextIO, Any
__stream_write = None
__stream_flush = None
__patched_trace = False
__trace_level = 1
__trace_start = 0
__thread_id = None
__thread_so = None
def _thread_linux_... | 425 | 14,176 |
clearml | clearml/debugging/__init__.py | .py | """ Debugging module """
from .log import (
get_logger,
get_null_logger,
TqdmLog,
add_options as add_log_options,
apply_logging_args as parse_log_args,
add_rotating_file_handler,
add_time_rotating_file_handler,
)
from .timer import Timer
__all__ = [
"Timer",
"get_logger",
"get_n... | 23 | 466 |
clearml | clearml/debugging/timer.py | .py | """ Timing support """
import time
from typing import Callable, Optional, Dict, List, Any
class Timer:
"""A class implementing a simple timer, with a reset option"""
def __init__(self) -> None:
self._start_time = 0.0
self._diff = 0.0
self._total_time = 0.0
self._average_time =... | 116 | 3,568 |
clearml | clearml/debugging/log.py | .py | """ Logging convenience functions and wrappers """
import argparse
import inspect
import logging
import logging.handlers
import os
import sys
from os import getenv
from platform import system
from typing import Optional, Union, TextIO, Any
from pathlib2 import Path
from six import BytesIO
default_level = logging.INFO... | 374 | 12,539 |
clearml | clearml/backend_api/utils.py | .py | import logging
import ssl
import sys
from typing import Optional, List, Any
import requests
from requests.adapters import HTTPAdapter
from urllib3.util import Retry
from urllib3 import PoolManager
import urllib3
from .session.defs import ENV_HOST_VERIFY_CERT
from ..backend_config.converters import strtobool
from fun... | 208 | 7,719 |
clearml | clearml/backend_api/__init__.py | .py | from .session import (
Session,
CallResult,
TimeoutExpiredError,
ResultNotReadyError,
browser_login,
)
from .config import load as load_config
__all__ = [
"Session",
"CallResult",
"TimeoutExpiredError",
"ResultNotReadyError",
"load_config",
"browser_login",
]
| 18 | 305 |
clearml | clearml/backend_api/api_proxy.py | .py | import importlib
import pkgutil
import re
from typing import Optional, Any, Generator
from .session import Session
from ..utilities.check_updates import Version
class ApiServiceProxy:
_main_services_module = "clearml.backend_api.services"
_available_versions = None
def __init__(self, module: str) -> Non... | 79 | 3,166 |
clearml | clearml/backend_api/services/__init__.py | .py | from ..api_proxy import ApiServiceProxy
# allow us to replace the api version after we have completed the authentication process,
# and we know the backend server api version.
# ApiServiceProxy will dynamically load the correct api object based on the session api_version
auth = ApiServiceProxy("auth")
events = ApiSer... | 30 | 794 |
clearml | clearml/backend_api/services/v2_9/models.py | .py | """
models service
This service provides a management interface for models (results of training tasks) stored in the system.
"""
from typing import List, Optional, Any
from datetime import datetime
import six
from dateutil.parser import parse as parse_datetime
from ....backend_api.session import (
NonStrictDataMod... | 3,018 | 103,062 |
clearml | clearml/backend_api/services/v2_9/organization.py | .py | """
organization service
This service provides organization level operations
"""
from typing import List, Optional, Any
import six
from ....backend_api.session import Request, Response, schema_property
class GetTagsRequest(Request):
"""
Get all the user and system tags used for the company tasks and models
... | 149 | 5,219 |
clearml | clearml/backend_api/services/v2_9/auth.py | .py | """
auth service
This service provides authentication management and authorization
validation for the entire system.
"""
from typing import List, Optional, Any
from datetime import datetime
import six
from dateutil.parser import parse as parse_datetime
from ....backend_api.session import (
NonStrictDataModel,
... | 577 | 17,597 |
clearml | clearml/backend_api/services/v2_9/projects.py | .py | """
projects service
Provides support for defining Projects containing Tasks, Models and Dataset Versions.
"""
from typing import List, Optional, Any
from datetime import datetime
import six
from dateutil.parser import parse as parse_datetime
from ....backend_api.session import (
NonStrictDataModel,
Request,
... | 2,610 | 90,634 |
clearml | clearml/backend_api/services/v2_9/queues.py | .py | """
queues service
Provides a management API for queues of tasks waiting to be executed by workers deployed anywhere (see Workers Service).
"""
from typing import List, Optional, Any
from datetime import datetime
import six
from dateutil.parser import parse as parse_datetime
from ....backend_api.session import (
N... | 2,152 | 70,184 |
clearml | clearml/backend_api/services/v2_9/tasks.py | .py | """
tasks service
Provides a management API for tasks in the system.
"""
from typing import List, Optional, Any
import enum
from datetime import datetime
import six
from dateutil.parser import parse as parse_datetime
from ....backend_api.session import (
BatchRequest,
NonStrictDataModel,
Request,
Respo... | 9,210 | 324,298 |
clearml | clearml/backend_api/services/v2_9/events.py | .py | """
events service
Provides an API for running tasks to report events collected by the system.
"""
from typing import List, Optional, Any
import enum
import six
from ....backend_api.session import (
BatchRequest,
CompoundRequest,
NonStrictDataModel,
Request,
Response,
schema_property,
Strin... | 3,195 | 103,110 |
clearml | clearml/backend_api/services/v2_9/workers.py | .py | """
workers service
Provides an API for worker machines, allowing workers to report status and get tasks for execution
"""
from typing import List, Optional, Any
import enum
from datetime import datetime
import six
from dateutil.parser import parse as parse_datetime
from ....backend_api.session import (
NonStrictD... | 2,444 | 85,361 |
clearml | clearml/backend_api/services/v2_23/models.py | .py | """
models service
This service provides a management interface for models (results of training tasks) stored in the system.
"""
from typing import List, Optional, Union, Any
import six
from datetime import datetime
from dateutil.parser import parse as parse_datetime
from clearml.backend_api.session import (
Reque... | 4,558 | 156,390 |
clearml | clearml/backend_api/services/v2_23/datasets.py | .py | """
datasets service
This service provides a management interface for the datasets managed by the system.
"""
import six
from datetime import datetime
import enum
from dateutil.parser import parse as parse_datetime
from clearml.backend_api.session import (
Request,
Response,
NonStrictDataModel,
schem... | 8,345 | 273,994 |
clearml | clearml/backend_api/services/v2_23/organization.py | .py | """
organization service
This service provides organization level operations
"""
from typing import List, Optional, Any
import six
from clearml.backend_api.session import Request, Response, schema_property
class GetTagsRequest(Request):
"""
Get all the user and system tags used for the company tasks and mode... | 149 | 5,225 |
clearml | clearml/backend_api/services/v2_23/auth.py | .py | """
auth service
This service provides authentication management and authorization
validation for the entire system.
"""
from typing import List, Optional, Any
import six
from datetime import datetime
from dateutil.parser import parse as parse_datetime
from clearml.backend_api.session import (
Request,
Respons... | 748 | 22,785 |
clearml | clearml/backend_api/services/v2_23/projects.py | .py | """
projects service
Provides support for defining Projects containing Tasks, Models and Dataset Versions.
"""
from typing import List, Optional, Any
import six
from datetime import datetime
from dateutil.parser import parse as parse_datetime
from clearml.backend_api.session import (
Request,
Response,
Non... | 4,548 | 161,018 |
clearml | clearml/backend_api/services/v2_23/dataviews.py | .py | """
dataviews service
Dataview service
"""
import six
from datetime import datetime
import enum
from dateutil.parser import parse as parse_datetime
from clearml.backend_api.session import (
Request,
Response,
NonStrictDataModel,
schema_property,
StringEnum,
)
class FilterByRoiEnum(StringEnum):
... | 5,043 | 175,239 |
clearml | clearml/backend_api/services/v2_23/frames.py | .py | """
frames service
This service provides access to frames metadata stored in the
system's datasets (see Datasets Service). This includes reading metadata, adding new
frames/metadata and updating existing metadata.
"""
import six
import enum
from clearml.backend_api.session import (
Request,
Response,
Non... | 12,807 | 493,837 |
clearml | clearml/backend_api/services/v2_23/pipelines.py | .py | """
pipelines service
Provides a management API for pipelines in the system.
"""
from typing import List, Optional, Any
import six
from clearml.backend_api.session import Request, Response, schema_property
class StartPipelineRequest(Request):
"""
Start a pipeline
:param task: ID of the task on which the... | 159 | 4,837 |
clearml | clearml/backend_api/services/v2_23/queues.py | .py | """
queues service
Provides a management API for queues of tasks waiting to be executed by workers deployed anywhere (see Workers Service).
"""
from typing import List, Optional, Any
import six
from datetime import datetime
from dateutil.parser import parse as parse_datetime
from clearml.backend_api.session import (
... | 2,943 | 96,615 |
clearml | clearml/backend_api/services/v2_23/events.py | .py | """
events service
Provides an API for running tasks to report events collected by the system.
"""
from typing import List, Optional, Any
import six
import enum
from clearml.backend_api.session import (
Request,
BatchRequest,
Response,
NonStrictDataModel,
CompoundRequest,
schema_property,
S... | 5,809 | 194,568 |
clearml | clearml/backend_api/services/v2_23/workers.py | .py | """
workers service
Provides an API for worker machines, allowing workers to report status and get tasks for execution
"""
from typing import List, Optional, Any
import six
from datetime import datetime
import enum
from dateutil.parser import parse as parse_datetime
from clearml.backend_api.session import (
Reques... | 2,586 | 90,963 |
clearml | clearml/backend_api/services/v2_13/models.py | .py | """
models service
This service provides a management interface for models (results of training tasks) stored in the system.
"""
from typing import List, Optional, Any
from datetime import datetime
import six
from clearml.backend_api.session import (
Request,
Response,
NonStrictDataModel,
schema_proper... | 4,048 | 137,000 |
clearml | clearml/backend_api/services/v2_13/organization.py | .py | """
organization service
This service provides organization level operations
"""
from typing import List, Optional, Any
import six
from clearml.backend_api.session import Request, Response, schema_property
class GetTagsRequest(Request):
"""
Get all the user and system tags used for the company tasks and mode... | 149 | 5,225 |
clearml | clearml/backend_api/services/v2_13/auth.py | .py | """
auth service
This service provides authentication management and authorization
validation for the entire system.
"""
from typing import List, Optional, Any
from datetime import datetime
import six
from clearml.backend_api.session import (
Request,
Response,
NonStrictDataModel,
schema_property,
)
fr... | 601 | 18,714 |
clearml | clearml/backend_api/services/v2_13/projects.py | .py | """
projects service
Provides support for defining Projects containing Tasks, Models and Dataset Versions.
"""
from typing import List, Optional, Any
from datetime import datetime
import six
from clearml.backend_api.session import (
Request,
Response,
NonStrictDataModel,
schema_property,
)
from dateuti... | 3,475 | 121,977 |
clearml | clearml/backend_api/services/v2_13/queues.py | .py | """
queues service
Provides a management API for queues of tasks waiting to be executed by workers deployed anywhere (see Workers Service).
"""
from typing import List, Optional, Any
from datetime import datetime
import six
from clearml.backend_api.session import (
Request,
Response,
NonStrictDataModel,
... | 2,525 | 82,567 |
clearml | clearml/backend_api/services/v2_13/tasks.py | .py | """
tasks service
Provides a management API for tasks in the system.
"""
from typing import List, Optional, Any
import enum
from datetime import datetime
import six
from clearml.backend_api.session import (
Request,
BatchRequest,
Response,
NonStrictDataModel,
schema_property,
StringEnum,
)
from... | 12,079 | 422,228 |
clearml | clearml/backend_api/services/v2_13/events.py | .py | """
events service
Provides an API for running tasks to report events collected by the system.
"""
from typing import List, Optional, Any
import enum
import six
from clearml.backend_api.session import (
Request,
BatchRequest,
Response,
NonStrictDataModel,
CompoundRequest,
schema_property,
S... | 3,521 | 114,714 |
clearml | clearml/backend_api/services/v2_13/workers.py | .py | """
workers service
Provides an API for worker machines, allowing workers to report status and get tasks for execution
"""
from typing import List, Optional, Any
import enum
from datetime import datetime
import six
from clearml.backend_api.session import (
Request,
Response,
NonStrictDataModel,
schema_... | 2,444 | 85,380 |
clearml | clearml/backend_api/services/v2_20/models.py | .py | """
models service
This service provides a management interface for models (results of training tasks) stored in the system.
"""
from typing import List, Optional, Any
import six
from datetime import datetime
from dateutil.parser import parse as parse_datetime
from clearml.backend_api.session import (
Request,
... | 4,549 | 155,511 |
clearml | clearml/backend_api/services/v2_20/organization.py | .py | """
organization service
This service provides organization level operations
"""
from typing import List, Optional, Any
import six
from clearml.backend_api.session import Request, Response, schema_property
class GetTagsRequest(Request):
"""
Get all the user and system tags used for the company tasks and mode... | 149 | 5,225 |
clearml | clearml/backend_api/services/v2_20/auth.py | .py | """
auth service
This service provides authentication management and authorization
validation for the entire system.
"""
from typing import List, Optional, Any
import six
from datetime import datetime
from dateutil.parser import parse as parse_datetime
from clearml.backend_api.session import (
Request,
Respons... | 777 | 23,965 |
clearml | clearml/backend_api/services/v2_20/projects.py | .py | """
projects service
Provides support for defining Projects containing Tasks, Models and Dataset Versions.
"""
from typing import List, Optional, Any
import six
from datetime import datetime
from dateutil.parser import parse as parse_datetime
from clearml.backend_api.session import (
Request,
Response,
Non... | 4,524 | 160,413 |
clearml | clearml/backend_api/services/v2_20/pipelines.py | .py | """
pipelines service
Provides a management API for pipelines in the system.
"""
from typing import List, Optional, Any
import six
from clearml.backend_api.session import Request, Response, schema_property
class StartPipelineRequest(Request):
"""
Start a pipeline
:param task: ID of the task on which the... | 159 | 4,837 |
clearml | clearml/backend_api/services/v2_20/queues.py | .py | """
queues service
Provides a management API for queues of tasks waiting to be executed by workers deployed anywhere (see Workers Service).
"""
from typing import List, Optional, Any
import six
from datetime import datetime
from dateutil.parser import parse as parse_datetime
from clearml.backend_api.session import (
... | 2,832 | 92,952 |
clearml | clearml/backend_api/services/v2_20/tasks.py | .py | """
tasks service
Provides a management API for tasks in the system.
"""
from typing import List, Optional, Any
import six
from datetime import datetime
import enum
from dateutil.parser import parse as parse_datetime
from clearml.backend_api.session import (
Request,
BatchRequest,
Response,
NonStrictDa... | 12,747 | 446,657 |
clearml | clearml/backend_api/services/v2_20/events.py | .py | """
events service
Provides an API for running tasks to report events collected by the system.
"""
from typing import List, Optional, Any
import six
import enum
from clearml.backend_api.session import (
Request,
BatchRequest,
Response,
NonStrictDataModel,
CompoundRequest,
schema_property,
S... | 5,127 | 169,733 |
clearml | clearml/backend_api/services/v2_20/workers.py | .py | """
workers service
Provides an API for worker machines, allowing workers to report status and get tasks for execution
"""
from typing import List, Optional, Any
import six
from datetime import datetime
import enum
from dateutil.parser import parse as parse_datetime
from clearml.backend_api.session import (
Reques... | 2,478 | 86,857 |
clearml | clearml/backend_api/config/__init__.py | .py | from ...backend_config import Config
from pathlib2 import Path
def load(*additional_module_paths: str) -> Config:
"""
Load configuration with the API defaults, using the additional module path provided
:param additional_module_paths: Additional config paths for modules who'se default
configurations sh... | 16 | 535 |
clearml | clearml/backend_api/session/errors.py | .py | from typing import Any
class SessionError(Exception):
pass
class AsyncError(SessionError):
def __init__(self, msg: str, *args: Any, **kwargs: Any) -> None:
super(AsyncError, self).__init__(msg, *args)
for k, v in kwargs.items():
setattr(self, k, v)
class TimeoutExpiredError(Ses... | 21 | 393 |
clearml | clearml/backend_api/session/token_manager.py | .py | import sys
from abc import ABC, abstractmethod
from time import time
from typing import Optional, Any
import jwt
from jwt.algorithms import get_default_algorithms
class TokenManager(ABC):
@property
def token_expiration_threshold_sec(self) -> int:
return self.__token_expiration_threshold_sec
@tok... | 111 | 3,672 |
clearml | clearml/backend_api/session/datamodel.py | .py | import keyword
import enum
import json
from datetime import datetime
from typing import Callable, Dict, Optional, Collection, Any
import jsonschema
from enum import Enum
def format_date(obj: datetime) -> str:
if isinstance(obj, datetime):
return str(obj)
class SchemaProperty(property):
def __init_... | 179 | 5,618 |
clearml | clearml/backend_api/session/request.py | .py | from abc import ABC, abstractmethod
from typing import Union, List, Tuple, Dict, Any
from jsonschema.exceptions import FormatError, SchemaError, ValidationError
try:
# Since `referencing`` only supports Python >= 3.8, this try-except blocks maintain support
# for earlier python versions.
from referencing.... | 126 | 4,263 |
clearml | clearml/backend_api/session/__init__.py | .py | from .session import Session, browser_login
from .datamodel import DataModel, NonStrictDataModel, schema_property, StringEnum
from .request import Request, BatchRequest, CompoundRequest
from .response import Response
from .token_manager import TokenManager
from .errors import TimeoutExpiredError, ResultNotReadyError
fr... | 25 | 654 |
clearml | clearml/backend_api/session/apimodel.py | .py | from .datamodel import DataModel
class ApiModel(DataModel):
"""API-related data model"""
_service = None
_action = None
_version = None
| 10 | 155 |
clearml | clearml/backend_api/session/callresult.py | .py | import logging
import sys
import time
from typing import Optional, Dict, Type, Any
import requests
from ...backend_api.utils import get_response_cls
from .response import ResponseMeta, Response
from .errors import ResultNotReadyError, TimeoutExpiredError
class CallResult:
@property
def meta(self) -> Respon... | 197 | 6,641 |
clearml | clearml/backend_api/session/session.py | .py | from __future__ import print_function
import json as json_lib
import logging
import os
import sys
import types
import weakref
from io import IOBase
from socket import gethostname
from time import sleep
import jwt
import requests
from requests.auth import HTTPBasicAuth
from requests.exceptions import (
ChunkedEncod... | 1,174 | 46,766 |
clearml | clearml/backend_api/session/response.py | .py | from typing import Any
import requests
from . import jsonmodels
from .apimodel import ApiModel
from .datamodel import NonStrictDataModelMixin
class FloatOrStringField(jsonmodels.fields.BaseField):
"""String field."""
types = (
float,
str,
)
class Response(ApiModel, NonStrictDataModelM... | 76 | 2,188 |
clearml | clearml/backend_api/session/defs.py | .py | from typing import Optional
from ...backend_config import EnvEntry
from ...backend_config.converters import safe_text_to_bool
ENV_HOST = EnvEntry("CLEARML_API_HOST", "TRAINS_API_HOST")
ENV_WEB_HOST = EnvEntry("CLEARML_WEB_HOST", "TRAINS_WEB_HOST")
ENV_FILES_HOST = EnvEntry("CLEARML_FILES_HOST", "TRAINS_FILES_HOST")
E... | 69 | 2,807 |
clearml | clearml/backend_api/session/client/__init__.py | .py | from .client import APIClient, StrictSession, APIError
__all__ = ["APIClient", "StrictSession", "APIError"]
| 4 | 109 |
clearml | clearml/backend_api/session/client/client.py | .py | from __future__ import unicode_literals
from abc import ABC, abstractmethod
import types
from argparse import Namespace
from collections import OrderedDict
from enum import Enum
from functools import reduce, wraps, WRAPPER_ASSIGNMENTS
from importlib import import_module
from itertools import chain
from operator import... | 560 | 16,990 |
clearml | clearml/backend_api/session/jsonmodels/errors.py | .py | class ValidationError(RuntimeError):
pass
class FieldNotFound(RuntimeError):
pass
class FieldNotSupported(ValueError):
pass
| 11 | 140 |
clearml | clearml/backend_api/session/jsonmodels/fields.py | .py | import datetime
import re
from typing import Union, List, Optional, Type, Iterable, Tuple, Any
from weakref import WeakKeyDictionary
from dateutil.parser import parse
from .errors import ValidationError
from .collections import ModelCollection
# unique marker for "no default value specified". None is not good enough ... | 469 | 14,259 |
clearml | clearml/backend_api/session/jsonmodels/models.py | .py | from typing import Tuple, Dict, Iterator, Any, Generator
from . import parsers, errors
from .fields import BaseField
from .errors import ValidationError
class JsonmodelMeta(type):
def __new__(cls, name: str, bases: Tuple[Any], attributes: Dict[str, Any]) -> "JsonmodelMeta":
cls.validate_fields(attributes... | 143 | 4,863 |
clearml | clearml/backend_api/session/jsonmodels/__init__.py | .py | # coding: utf-8
__author__ = "Szczepan Cieślik"
__email__ = "szczepan.cieslik@gmail.com"
__version__ = "2.4"
from . import models
from . import fields
from . import errors
__all__ = ["models", "fields", "errors"]
| 12 | 217 |
clearml | clearml/backend_api/session/jsonmodels/utilities.py | .py | from __future__ import absolute_import
from typing import Any
import re
from collections import namedtuple
SCALAR_TYPES = (str, int, float, bool)
ECMA_TO_PYTHON_FLAGS = {
"i": re.I,
"m": re.M,
}
PYTHON_TO_ECMA_FLAGS = dict((value, key) for key, value in ECMA_TO_PYTHON_FLAGS.items())
PythonRegex = namedtup... | 144 | 3,774 |
clearml | clearml/backend_api/session/jsonmodels/builders.py | .py | """Builders to generate in memory representation of model and fields tree."""
from __future__ import absolute_import
from collections import defaultdict
from typing import Any
from . import errors
from .fields import NotSet
class Builder:
def __init__(
self,
parent: "Builder" = None,
nu... | 221 | 6,642 |
clearml | clearml/backend_api/session/jsonmodels/parsers.py | .py | """Parsers to change model structure into different ones."""
import inspect
from typing import Optional, Union, Any
from . import fields, builders, errors
def to_struct(model: Any) -> dict:
"""Cast instance of model to python structure.
:param model: Model to be casted.
:rtype: ``dict``
"""
mod... | 108 | 3,430 |
clearml | clearml/backend_api/session/jsonmodels/collections.py | .py | from typing import Any
class ModelCollection(list):
"""`ModelCollection` is list which validates stored values.
Validation is made with use of field passed to `__init__` at each point,
when new value is assigned.
"""
def __init__(self, field: Any) -> None:
self.field = field
def ap... | 22 | 618 |
clearml | clearml/backend_api/session/jsonmodels/validators.py | .py | """Predefined validators."""
import re
from typing import Any
from six.moves import reduce
from .errors import ValidationError
from . import utilities
class Min:
"""Validator for minimum value."""
def __init__(self, minimum_value: Any, exclusive: bool = False) -> None:
"""Init.
:param mini... | 180 | 6,023 |
clearml | clearml/backend_api/schema/action.py | .py | import attr
from attr.validators import and_, instance_of, optional
from typing import Any
# noinspection PyTypeChecker
sequence = instance_of((list, tuple))
def sequence_of(types: type) -> attr.validators._AndValidator:
def validator(_: Any, attrib: attr.Attribute, value: Any) -> None:
assert all(isinst... | 35 | 1,236 |
clearml | clearml/backend_api/schema/service.py | .py | import itertools
import re
from typing import Dict, Set, Any
import attr
from ...utilities.pyhocon import ConfigTree
from .action import Action
class Service:
"""Service schema handler"""
__jsonschema_ref_ex = re.compile("^#/definitions/(.*)$")
@property
def default(self) -> ConfigTree:
re... | 177 | 6,671 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.