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 |
|---|---|---|---|---|---|
conda | conda/gateways/disk/read.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Disk utility functions for reading and processing file contents."""
from __future__ import annotations
import hashlib
import os
from base64 import b64encode
from collections import namedtuple
from errno import ENOENT
from functools import p... | 246 | 8,103 |
conda | conda/gateways/disk/__init__.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
import os
import sys
from errno import EACCES, EEXIST, ENOENT, ENOTEMPTY, EPERM, errorcode
from logging import getLogger
from os.path import basename, dirname, isdir
from subprocess import CalledProcessError
from time import sleep
from ...commo... | 116 | 3,575 |
conda | conda/gateways/disk/link.py | .py | # Copyright (C) 2012 Anaconda, Inc & Jason R. Coombs
# SPDX-License-Identifier: BSD-3-Clause, MIT
"""Disk utility functions for symlinking files and folders.
Portions of the code within this module are taken from https://github.com/jaraco/jaraco.windows
which is MIT licensed by Jason R. Coombs.
https://github.com/jar... | 417 | 13,614 |
conda | conda/gateways/disk/create.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Disk utility functions for creating new files or directories."""
import os
import sys
import tempfile
import warnings as _warnings
from errno import EACCES, EPERM, EROFS
from logging import getLogger
from os.path import dirname, isdir, isfil... | 524 | 16,949 |
conda | conda/gateways/disk/update.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Disk utility functions for modifying existing files or directories."""
from __future__ import annotations
import os
import re
import tempfile
from contextlib import contextmanager
from errno import EINVAL, EPERM, EXDEV
from logging import g... | 175 | 6,176 |
conda | conda/gateways/disk/permissions.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Disk utility functions for modifying file and directory permissions."""
from errno import EACCES, ENOENT, EPERM, EROFS
from itertools import chain
from logging import getLogger
from os import X_OK, access, chmod, lstat, walk
from os.path imp... | 89 | 3,057 |
conda | conda/gateways/disk/lock.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""
Record locking to manage potential repodata / repodata metadata file contention
between conda processes. Try to acquire a lock on a single byte in the metadat
file; modify both files; then release the lock.
"""
import time
import warnings
f... | 96 | 2,857 |
conda | conda/gateways/disk/test.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Disk utility functions testing path properties (e.g., writable, hardlinks, softlinks, etc.)."""
from functools import cache
from logging import getLogger
from os import W_OK, access
from os.path import basename, dirname, isdir, isfile, join
... | 90 | 3,174 |
conda | conda/gateways/repodata/__init__.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Repodata interface."""
from __future__ import annotations
import abc
import datetime
import errno
import hashlib
import logging
import os
import pathlib
import re
import time
import warnings
from collections import UserDict
from contextlib ... | 1,045 | 35,787 |
conda | conda/gateways/repodata/zstd.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Zstd interface for repodata."""
from __future__ import annotations
import logging
import os
import re
import shutil
import time
from contextlib import contextmanager
from typing import TYPE_CHECKING
from requests import HTTPError # noqa: ... | 316 | 9,732 |
conda | conda/gateways/repodata/lock.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""
Backwards compatibility import.
Moved to prevent circular imports.
"""
from ..disk.lock import lock # noqa: F401
| 10 | 195 |
conda | conda/gateways/shards/typing.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Minimal set of interfaces required to describe shards code to clients (solvers)"""
import typing
from collections.abc import Iterable, Iterator, KeysView
from typing import Literal
class Shards(typing.Protocol):
base_url: str
@pro... | 75 | 2,751 |
conda | conda/notices/types.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Implements all conda.notices types."""
from __future__ import annotations
import hashlib
from datetime import datetime
from typing import TYPE_CHECKING, NamedTuple
from ..base.constants import NoticeLevel
if TYPE_CHECKING:
from collec... | 116 | 3,631 |
conda | conda/notices/fetch.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Notices network fetch logic."""
from __future__ import annotations
import logging
from concurrent.futures import ThreadPoolExecutor
from typing import TYPE_CHECKING
import requests # noqa: TID253
from ..gateways.connection.session import... | 83 | 2,635 |
conda | conda/notices/views.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Handles all display/view logic."""
from collections.abc import Sequence
from ..base.context import context
from ..common.serialize import json
from .types import ChannelNotice
def print_notices(channel_notices: Sequence[ChannelNotice]):
... | 62 | 2,040 |
conda | conda/notices/cache.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""
Handles all caching logic including:
- Retrieving from cache
- Saving to cache
- Determining whether not certain items have expired and need to be refreshed
"""
from __future__ import annotations
import logging
import os
from datetim... | 213 | 6,591 |
conda | conda/notices/core.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Core conda notices logic."""
from __future__ import annotations
import logging
import time
from functools import wraps
from typing import TYPE_CHECKING
from ..base.constants import NOTICES_DECORATOR_DISPLAY_INTERVAL_NS, NOTICES_FN
from ..b... | 237 | 7,602 |
conda | conda/core/package_cache_data.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Tools for managing the package cache (previously downloaded packages)."""
from __future__ import annotations
import multiprocessing
import os
from collections import defaultdict
from concurrent.futures import (
CancelledError,
Proce... | 1,127 | 44,856 |
conda | conda/core/index.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Tools for fetching the current index."""
from __future__ import annotations
from collections import UserDict
from logging import getLogger
from typing import TYPE_CHECKING
from ..base.context import context
from ..common.iterators import u... | 645 | 24,617 |
conda | conda/core/subdir_data.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Tools for managing a subdir's repodata.json."""
from __future__ import annotations
import pickle
from collections import UserList, defaultdict
from functools import partial
from itertools import chain
from logging import getLogger
from os.p... | 889 | 33,212 |
conda | conda/core/initialize.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Backend logic for `conda init`.
Sections in this module are
1. top-level functions
2. plan creators
3. plan runners
4. individual operations
5. helper functions
The top-level functions compose and execute full plans.
A plan is c... | 2,374 | 80,336 |
conda | conda/core/__init__.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""
Code in ``conda.core`` is the core logic. It is strictly forbidden from having side effects.
No printing to stdout or stderr, no disk manipulation, no http requests.
All side effects should be implemented through ``conda.gateways``. Object... | 24 | 698 |
conda | conda/core/path_actions.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Atomic actions that make up a package installation or removal transaction."""
from __future__ import annotations
import os
import re
import sys
from abc import ABC, abstractmethod
from itertools import chain
from logging import getLogger
fr... | 1,565 | 54,600 |
conda | conda/core/link.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Package installation implemented as a series of link/unlink transactions."""
from __future__ import annotations # noqa: I001
from dataclasses import dataclass, fields
import itertools
import os
import sys
import warnings
from collections i... | 1,747 | 66,758 |
conda | conda/core/portability.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Tools for cross-OS portability."""
from __future__ import annotations
import os
import re
import struct
import subprocess
import threading
from contextlib import contextmanager
from logging import getLogger
from os.path import basename, rea... | 495 | 18,489 |
conda | conda/core/envs_manager.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Tools for managing conda environments."""
from __future__ import annotations
import os
from errno import EACCES, ENOENT, EROFS
from logging import getLogger
from os.path import dirname, isdir, isfile, join, normpath
from typing import TYPE_... | 225 | 7,371 |
conda | conda/core/prefix_data.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Tools for managing the packages installed within an environment."""
from __future__ import annotations
import os
import re
import warnings
from collections import UserDict
from datetime import datetime, timezone
from logging import getLogge... | 821 | 31,121 |
conda | conda/core/solve.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""The classic solver implementation."""
from __future__ import annotations
import copy
import sys
from itertools import chain
from logging import DEBUG, getLogger
from textwrap import dedent
from typing import TYPE_CHECKING
from .. import Co... | 1,489 | 64,000 |
conda | conda/_private/exception_guidance.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Structured error guidance for user-facing error messages.
``ErrorGuidance`` can be attached to ``conda.CondaError`` via the ``guidance`` keyword
so that terminal and `--json` output share the same logical cause / hint structure.
"""
from __... | 153 | 5,351 |
conda | conda/_private/extract.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Lean package extraction helpers for subprocess workers."""
from __future__ import annotations
import os
# This module is imported in each spawned extraction worker. Keep imports here
# limited to the standard library; importing conda runti... | 25 | 764 |
conda | conda/_private/__init__.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""
`conda._private`. Keep `__init__.py` empty to avoid side-effects.
If you are an API user, stop! This module has no stability guarantees. Symbols
under `_conda` can be renamed or removed at any time. Instead, look for
re-exported API under `... | 10 | 334 |
conda | conda/_private/zstd.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Internal zstd backend selector.
Import ``zstd`` for library API (``zstd.ZstdFile``, ``zstd.compress``, …).
Import ``ZstdError`` for exception handling.
Import ``capped_decompress`` for bounded one-shot decompression of untrusted data (mimics... | 47 | 1,570 |
conda | conda/_private/shards/shards.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""
Models for sharded repodata, and to make monolithic repodata look like sharded
repodata.
"""
from __future__ import annotations
import abc
import concurrent.futures
import json # noqa
import logging
from collections import defaultdict
fro... | 874 | 31,483 |
conda | conda/_private/shards/misc.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""
Miscellaneous utility functions for sharded repodata processing.
This module contains utility functions that don't fit cleanly into other modules:
- URL handling
- Package name parsing
- Data transformation helpers
- Threading utilities
"""... | 220 | 7,461 |
conda | conda/_private/shards/__init__.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from . import cache, subset
from .shards import (
ShardBase,
ShardLike,
Shards,
fetch_channels,
fetch_shards_index,
)
__all__ = [
"cache",
"subset",
"ShardBase",
"ShardLike",
"Shards",
"fetch_shards_i... | 21 | 351 |
conda | conda/_private/shards/subset.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""
Sharded repodata subsets.
Traverse dependencies of installed and to-be-installed packages to generate a
useful subset for the solver.
The algorithm developed here is a direct result of the following CEP:
- https://conda.org/learn/ceps/cep... | 789 | 29,042 |
conda | conda/_private/shards/typing.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""
TypedDict declarations for shards.
These are helpful for auto-complete, but do not validate at runtime and are not
normative. They are intentionally not shared with another project (conda) to
reduce coupling.
"""
from __future__ import ann... | 72 | 1,652 |
conda | conda/_private/shards/cache.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""
Cache suitable for shards, not allowed to change because they are named
after their own sha256 hash.
"""
from __future__ import annotations
import logging
import sqlite3
from dataclasses import dataclass
from typing import TYPE_CHECKING
i... | 206 | 6,693 |
conda | conda/cli/main_env_update.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""CLI implementation for `conda-env update`.
Updates the conda environments with the specified packages.
"""
import os
from argparse import (
ArgumentParser,
Namespace,
_SubParsersAction,
)
from ..notices import notices
def con... | 174 | 5,397 |
conda | conda/cli/main_run.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""CLI implementation for `conda run`.
Runs the provided command within the specified environment.
"""
import os
import sys
from argparse import REMAINDER, ArgumentParser, Namespace, _SubParsersAction
from logging import getLogger
def config... | 161 | 4,909 |
conda | conda/cli/main_info.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""CLI implementation for `conda info`.
Display information about current conda installation.
"""
from __future__ import annotations
import os
import re
import sys
from argparse import SUPPRESS
from functools import cached_property
from loggi... | 658 | 20,536 |
conda | conda/cli/main_mock_deactivate.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Mock CLI implementation for `conda deactivate`.
A mock implementation of the deactivate shell command for better UX.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from .. import CondaError
if TYPE_CHECKING:
... | 31 | 823 |
conda | conda/cli/formats.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Helpers for rendering CLI help text."""
from __future__ import annotations
from typing import TYPE_CHECKING
from ..common.io import dashlist
from ..plugins.types import EnvironmentFormat
if TYPE_CHECKING:
from collections.abc import M... | 62 | 1,877 |
conda | conda/cli/main.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Entry point for all conda subcommands."""
import sys
def init_loggers():
from ..base.context import context
from ..gateways.logging import initialize_logging, set_log_level
initialize_logging()
# set log_level
set_lo... | 113 | 3,364 |
conda | conda/cli/main_env_create.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""CLI implementation for `conda-env create`.
Creates new conda environments with the specified packages.
"""
from argparse import (
ArgumentParser,
_SubParsersAction,
)
def epilog() -> str:
"""Build ``conda env create`` epilog (... | 119 | 3,563 |
conda | conda/cli/main_commands.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Mock CLI implementation for `conda activate`.
A mock implementation of the activate shell command for better UX.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from argparse import ArgumentPa... | 39 | 981 |
conda | conda/cli/main_notices.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""CLI implementation for `conda notices`.
Manually retrieves channel notifications, caches them and displays them.
"""
from argparse import ArgumentParser, Namespace, _SubParsersAction
def configure_parser(sub_parsers: _SubParsersAction, **... | 65 | 1,665 |
conda | conda/cli/main_export.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""CLI implementation for `conda export`.
Dumps specified environment package specifications to the screen.
"""
import warnings
from argparse import (
ArgumentParser,
Namespace,
_SubParsersAction,
)
from conda.base.constants impor... | 299 | 10,091 |
conda | conda/cli/main_rename.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""CLI implementation for `conda rename`.
Renames an existing environment by cloning it and then removing the original environment.
"""
from __future__ import annotations
import os
from functools import partial
from typing import TYPE_CHECKIN... | 132 | 3,950 |
conda | conda/cli/main_env.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Entry point for all conda-env subcommands."""
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from argparse import ArgumentParser, Namespace, _SubParsersAction
def configure_parser(sub_parsers: _... | 48 | 1,233 |
conda | conda/cli/main_compare.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""CLI implementation for `conda compare`.
Compare the packages in an environment with the packages listed in an environment file.
"""
from __future__ import annotations
import logging
import os
from os.path import abspath, expanduser, expand... | 148 | 4,157 |
conda | conda/cli/condarc.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""
Configuration file manipulation utilities for conda.
This module provides classes and functions for working with conda configuration
files (.condarc), including reading, writing, and validating configuration keys.
"""
from __future__ impor... | 691 | 22,600 |
conda | conda/cli/main_mock_activate.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Mock CLI implementation for `conda activate`.
A mock implementation of the activate shell command for better UX.
"""
from __future__ import annotations
from argparse import SUPPRESS
from typing import TYPE_CHECKING
from .. import CondaErr... | 33 | 893 |
conda | conda/cli/main_init.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""CLI implementation for `conda init`.
Prepares the user's profile for running conda, and sets up the conda shell interface.
"""
from __future__ import annotations
from argparse import SUPPRESS
from logging import getLogger
from typing impor... | 191 | 6,192 |
conda | conda/cli/main_env_list.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""CLI implementation for `conda-env list`, now aliased to `conda info --envs`.
Lists available conda environments.
"""
from argparse import ArgumentParser, _SubParsersAction
def configure_parser(sub_parsers: _SubParsersAction, **kwargs) -> ... | 54 | 1,332 |
conda | conda/cli/main_env_config.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""CLI implementation for `conda-env config`.
Allows for programmatically interacting with conda-env's configuration files (e.g., `~/.condarc`).
"""
from argparse import ArgumentParser, Namespace, _SubParsersAction
def configure_parser(sub_p... | 45 | 1,166 |
conda | conda/cli/main_package.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""CLI implementation for `conda package`.
Provides some low-level tools for creating conda packages.
"""
import hashlib
import os
import re
import tarfile
import tempfile
from argparse import ArgumentParser, Namespace, _SubParsersAction
from ... | 304 | 8,743 |
conda | conda/cli/main_env_remove.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""CLI implementation for `conda-env remove`.
Removes the specified conda environment.
"""
from argparse import (
ArgumentParser,
_SubParsersAction,
)
def configure_parser(sub_parsers: _SubParsersAction, **kwargs) -> ArgumentParser:
... | 72 | 1,504 |
conda | conda/cli/conda_argparse.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Conda command line interface parsers."""
from __future__ import annotations
import argparse
import os
import sys
from argparse import (
SUPPRESS,
RawDescriptionHelpFormatter,
)
from argparse import ArgumentParser as ArgumentParserBa... | 390 | 14,118 |
conda | conda/cli/install.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Conda package installation logic.
Core logic for `conda [create|install|update|remove]` commands.
See conda.cli.main_create, conda.cli.main_install, conda.cli.main_update, and
conda.cli.main_remove for the entry points into this module.
"""... | 613 | 22,519 |
conda | conda/cli/main_list.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""CLI implementation for `conda list`.
Lists all packages installed into an environment.
"""
from __future__ import annotations
import logging
import re
from os.path import isdir, isfile
from typing import TYPE_CHECKING
from .. import __ver... | 440 | 12,851 |
conda | conda/cli/main_pip.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""PEP 621 compatible entry point used when `conda init` has not updated the user shell profile."""
import os
import sys
from logging import getLogger
log = getLogger(__name__)
def pip_installed_post_parse_hook(args, p):
from .. import C... | 34 | 872 |
conda | conda/cli/main_update.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""CLI implementation for `conda update`.
Updates the specified packages in an existing environment.
"""
from __future__ import annotations
import sys
from typing import TYPE_CHECKING
from ..notices import notices
if TYPE_CHECKING:
from... | 125 | 3,903 |
conda | conda/cli/common.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Common utilities for conda command line tools."""
from __future__ import annotations
import re
from logging import getLogger
from os.path import (
exists,
normcase,
)
from typing import TYPE_CHECKING
from ..auxlib.ish import dals
f... | 339 | 11,110 |
conda | conda/cli/main_install.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""CLI implementation for `conda install`.
Installs the specified packages into an existing environment.
"""
from __future__ import annotations
import sys
from typing import TYPE_CHECKING
from ..notices import notices
if TYPE_CHECKING:
... | 162 | 5,650 |
conda | conda/cli/main_env_vars.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""CLI implementation for `conda-env config vars`.
Allows for configuring conda-env's vars.
"""
from argparse import (
ArgumentParser,
Namespace,
_SubParsersAction,
)
from os.path import lexists
from ..base.context import context,... | 170 | 4,619 |
conda | conda/cli/helpers.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""
Collection of helper functions to standardize reused CLI arguments.
"""
from __future__ import annotations
from argparse import (
SUPPRESS,
Action,
BooleanOptionalAction,
_AppendAction,
_HelpAction,
_StoreAction,
)
... | 673 | 21,937 |
conda | conda/cli/main_search.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""CLI implementation for `conda search`.
Query channels for packages matching the provided package spec.
"""
from __future__ import annotations
from argparse import SUPPRESS
from collections import defaultdict
from datetime import datetime, ... | 364 | 11,037 |
conda | conda/cli/main_config.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""CLI implementation for `conda config`.
Allows for programmatically interacting with conda's configuration files (e.g., `~/.condarc`).
"""
from __future__ import annotations
import os
import sys
from argparse import SUPPRESS
from collection... | 859 | 27,663 |
conda | conda/cli/main_remove.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""CLI implementation for `conda remove`.
Removes the specified packages from an existing environment.
"""
import logging
from argparse import ArgumentParser, Namespace, _SubParsersAction
from ..reporters import confirm_yn
log = logging.getL... | 262 | 8,689 |
conda | conda/cli/main_create.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""CLI implementation for `conda create`.
Creates new conda environments with the specified packages.
"""
from __future__ import annotations
from logging import getLogger
from typing import TYPE_CHECKING
from ..notices import notices
if TYP... | 221 | 7,743 |
conda | conda/cli/actions.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""
Collection of custom argparse actions.
"""
from argparse import Action, _CountAction
from ..common.constants import NULL
from ..deprecations import deprecated
class NullCountAction(_CountAction):
@staticmethod
@deprecated("26.9",... | 63 | 1,673 |
conda | conda/cli/find_commands.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Utilities for finding executables and `conda-*` commands."""
import os
import re
import sys
import sysconfig
from functools import cache
from os.path import basename, expanduser, isfile, join
from ..common.compat import on_win
from ..deprec... | 89 | 2,725 |
conda | conda/cli/main_clean.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""CLI implementation for `conda clean`.
Removes cached package tarballs, index files, package metadata, temporary files, and log files.
"""
from __future__ import annotations
import os
import sys
from logging import getLogger
from os.path im... | 422 | 12,200 |
conda | conda/common/configuration.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""
A generalized application configuration utility.
Features include:
- lazy eval
- merges configuration files
- parameter type validation, with custom validation
- parameter aliases
Easily extensible to other source formats, e.g. jso... | 1,806 | 65,611 |
conda | conda/common/io.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Common I/O utilities."""
from __future__ import annotations
import logging
import os
import signal
import sys
from collections import defaultdict
from contextlib import contextmanager
from enum import Enum
from errno import EPIPE, ESHUTDOWN... | 705 | 22,780 |
conda | conda/common/__init__.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""
Code in ``conda.common`` is not conda-specific. Technically, it sits *aside* the application
stack and not *within* the stack. It is able to stand independently on its own.
The *only* allowed imports of conda code in ``conda.common`` modul... | 12 | 494 |
conda | conda/common/terminal.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""
Utility functions for terminal output.
"""
import os
import sys
def is_tty() -> bool:
"""Return True if stdout is connected to a TTY."""
return hasattr(sys.stdout, "isatty") and sys.stdout.isatty()
def term_dumb() -> bool:
"... | 67 | 1,819 |
conda | conda/common/signals.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Intercept signals and handle them gracefully."""
import signal
import threading
from contextlib import contextmanager
from logging import getLogger
log = getLogger(__name__)
INTERRUPT_SIGNALS = (
"SIGABRT",
"SIGINT",
"SIGTERM",... | 63 | 1,788 |
conda | conda/common/url.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Common URL utilities."""
from __future__ import annotations
import codecs
import re
import socket
import struct
from collections import namedtuple
from functools import cache
from getpass import getpass
from os.path import abspath, expandus... | 508 | 15,224 |
conda | conda/common/compat.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Common compatibility code."""
# Try to keep compat small because it's imported by everything
# What is compat, and what isn't?
# If a piece of code is "general" and used in multiple modules, it goes here.
# If it's only used in one module, ke... | 112 | 3,071 |
conda | conda/common/_logic.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
import sys
from array import array
from itertools import combinations
from logging import DEBUG, getLogger
from .constants import TRACE
log = getLogger(__name__)
TRUE = sys.maxsize
FALSE = -TRUE
class _ClauseList:
"""Storage for the CN... | 782 | 27,442 |
conda | conda/common/logic.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""
The basic idea to nest logical expressions is instead of trying to denest
things via distribution, we add new variables. So if we have some logical
expression expr, we replace it with x and add expr <-> x to the clauses,
where x is a new var... | 313 | 11,114 |
conda | conda/common/iterators.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Replacements for parts of the toolz library."""
from __future__ import annotations
from typing import TYPE_CHECKING
from ..deprecations import deprecated
if TYPE_CHECKING:
from collections.abc import Callable, Iterable
from typing... | 60 | 1,446 |
conda | conda/common/toposort.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Topological sorting implementation."""
from __future__ import annotations
from collections.abc import Hashable
from functools import reduce as _reduce
from logging import getLogger
from typing import TYPE_CHECKING, TypeVar
if TYPE_CHECKING... | 127 | 3,925 |
conda | conda/common/_os/unix.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
import os
from logging import getLogger
log = getLogger(__name__)
def get_free_space_on_unix(dir_name):
st = os.statvfs(dir_name)
return st.f_bavail * st.f_frsize
def is_admin_on_unix():
# http://stackoverflow.com/a/1026626/2127... | 17 | 353 |
conda | conda/common/_os/osx.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
import platform
from subprocess import check_output
def mac_ver() -> str:
"""
Returns macOS version, without compatibility modes for 11.x.
https://github.com/conda/conda/issues/13832
If Python was compiled against macOS <=10.15... | 22 | 742 |
conda | conda/common/_os/windows.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from enum import IntEnum
from logging import getLogger
from ..compat import ensure_binary, on_win
log = getLogger(__name__)
if on_win:
from ctypes import (
POINTER,
Structure,
WinError,
byref,
c_cha... | 192 | 5,496 |
conda | conda/common/_os/linux.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
import os
from functools import cache
from logging import getLogger
from os.path import exists
from ..compat import on_linux
log = getLogger(__name__)
@cache
def linux_get_libc_version() -> tuple[str, str]... | 64 | 2,053 |
conda | conda/common/serialize/json.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""JSON serialization utilities for conda."""
from __future__ import annotations
import json # noqa: TID251
from enum import Enum
from pathlib import Path
from typing import TYPE_CHECKING, overload
from frozendict import frozendict
if TYPE_... | 123 | 2,706 |
conda | conda/common/serialize/__init__.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""YAML and JSON serialization and deserialization functions."""
import functools
from io import StringIO
from logging import getLogger
from ...deprecations import deprecated
log = getLogger(__name__)
@deprecated(
"26.9",
"27.3",
... | 127 | 2,813 |
conda | conda/common/serialize/yaml.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""YAML serialization utilities for conda."""
from __future__ import annotations
from functools import cache
from io import StringIO
from pathlib import Path
from typing import TYPE_CHECKING, overload
from ...deprecations import deprecated
i... | 163 | 4,160 |
conda | conda/common/path/__init__.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Common path utilities."""
from __future__ import annotations
import os
import re
from functools import cache
from logging import getLogger
from os.path import (
abspath,
expanduser,
expandvars,
normcase,
split,
)
from ty... | 242 | 6,203 |
conda | conda/common/path/directories.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Common directory utilities."""
from __future__ import annotations
from functools import reduce
from itertools import accumulate, chain
from logging import getLogger
from os.path import join
from typing import TYPE_CHECKING
if TYPE_CHECKING... | 59 | 1,675 |
conda | conda/common/path/_cygpath.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
import ntpath
import os
import posixpath
import re
from functools import partial
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from . import PathType
def nt_to_posix(path: PathType, prefix: PathTyp... | 269 | 7,046 |
conda | conda/common/path/windows.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Common Windows path utilities."""
from __future__ import annotations
import ntpath
import os
import posixpath
import re
import subprocess
from logging import getLogger
from pathlib import Path
from shutil import which
from typing import TYP... | 170 | 5,444 |
conda | conda/common/path/python.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Common Python specific path utilities."""
from __future__ import annotations
import keyword
import re
from logging import getLogger
from os.path import join, split, splitext
from ..compat import on_win
log = getLogger(__name__)
def is_v... | 157 | 5,449 |
conda | conda/auxlib/logz.py | .py | import json
from itertools import islice
from logging import getLogger, INFO, Formatter, StreamHandler, DEBUG
from sys import stderr
from . import NullHandler
from ..deprecations import deprecated
log = getLogger(__name__)
root_log = getLogger()
NullHandler = NullHandler
DEBUG_FORMATTER = Formatter(
"[%(levelna... | 199 | 6,467 |
conda | conda/auxlib/exceptions.py | .py | from logging import getLogger
from ..deprecations import deprecated
log = getLogger(__name__)
def Raise(exception): # NOQA
raise exception
class AuxlibError:
"""Mixin to identify exceptions associated with the auxlib package."""
class ValidationError(AuxlibError, TypeError):
def __init__(self, key,... | 33 | 901 |
conda | conda/auxlib/__init__.py | .py | """Auxlib is an auxiliary library to the python standard library.
The aim is to provide core generic features for app development in python. Auxlib fills in some
python stdlib gaps much like `pytoolz <https://github.com/pytoolz/>`_ has for functional
programming, `pyrsistent <https://github.com/tobgu/pyrsistent/>`_ ha... | 91 | 3,042 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.