# Stubs for galaxy.util (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.

from typing import Any, Optional
import collections
from .inflection import English as English, Inflector as Inflector

grp = ...  # type: Any
docutils_core = ...  # type: Any
docutils_html4css1 = ...  # type: Any
inflector = ...  # type: Any
log = ...  # type: Any
CHUNK_SIZE = ...  # type: int
DATABASE_MAX_STRING_SIZE = ...  # type: int
DATABASE_MAX_STRING_SIZE_PRETTY = ...  # type: str
gzip_magic = ...  # type: str
bz2_magic = ...  # type: str
DEFAULT_ENCODING = ...  # type: Any
NULL_CHAR = ...  # type: str
BINARY_CHARS = ...  # type: Any
FILENAME_VALID_CHARS = ...  # type: str

def remove_protocol_from_url(url): ...
def is_binary(value, binary_chars: Optional[Any] = ...): ...
def is_uuid(value): ...
def directory_hash_id(id): ...
def get_charset_from_http_headers(headers, default: Optional[Any] = ...): ...
def synchronized(func): ...
def file_iter(fname, sep: Optional[Any] = ...): ...
def file_reader(fp, chunk_size: Any = ...): ...
def unique_id(KEY_SIZE: int = ...): ...
def parse_xml(fname): ...
def parse_xml_string(xml_string): ...
def xml_to_string(elem, pretty: bool = ...): ...
def xml_element_compare(elem1, elem2): ...
def xml_element_list_compare(elem_list1, elem_list2): ...
def xml_element_to_dict(elem): ...
def pretty_print_xml(elem, level: int = ...): ...
def get_file_size(value, default: Optional[Any] = ...): ...
def shrink_stream_by_size(value, size, join_by: str = ..., left_larger: bool = ..., beginning_on_size_error: bool = ..., end_on_size_error: bool = ...): ...
def shrink_string_by_size(value, size, join_by: str = ..., left_larger: bool = ..., beginning_on_size_error: bool = ..., end_on_size_error: bool = ...): ...
def pretty_print_time_interval(time: bool = ..., precise: bool = ...): ...
def pretty_print_json(json_data, is_json_string: bool = ...): ...

valid_chars = ...  # type: Any
mapped_chars = ...  # type: Any

def restore_text(text, character_map: Any = ...): ...
def sanitize_text(text, valid_characters: Any = ..., character_map: Any = ..., invalid_character: str = ...): ...
def sanitize_lists_to_string(values, valid_characters: Any = ..., character_map: Any = ..., invalid_character: str = ...): ...
def sanitize_param(value, valid_characters: Any = ..., character_map: Any = ..., invalid_character: str = ...): ...

valid_filename_chars = ...  # type: Any
invalid_filenames = ...  # type: Any

def sanitize_for_filename(text, default: Optional[Any] = ...): ...
def mask_password_from_url(url): ...
def ready_name_for_url(raw_name): ...
def which(file): ...
def safe_makedirs(path): ...
def in_directory(file, directory, local_path_module: Any = ...): ...
def merge_sorted_iterables(operator, *iterables): ...

class Params:
    NEVER_SANITIZE = ...  # type: Any
    def __init__(self, params, sanitize: bool = ...) -> None: ...
    def flatten(self): ...
    def __getattr__(self, name): ...
    def get(self, key, default): ...
    def __len__(self): ...
    def __iter__(self): ...
    def update(self, values): ...

def rst_to_html(s): ...
def xml_text(root, name: Optional[Any] = ...): ...

truthy = ...  # type: Any
falsy = ...  # type: Any

def asbool(obj): ...
def string_as_bool(string): ...
def string_as_bool_or_none(string): ...
def listify(item, do_strip: bool = ...): ...
def commaify(amount): ...
def roundify(amount, sfs: int = ...): ...
def unicodify(value, encoding: Any = ..., error: str = ..., default: Optional[Any] = ...): ...
def smart_str(s, encoding: Any = ..., strings_only: bool = ..., errors: str = ...): ...
def object_to_string(obj): ...
def string_to_object(s): ...

class ParamsWithSpecs(collections.defaultdict):
    specs = ...  # type: Any
    params = ...  # type: Any
    def __init__(self, specs: Optional[Any] = ..., params: Optional[Any] = ...) -> None: ...
    def __missing__(self, name): ...
    def __getattr__(self, name): ...

def compare_urls(url1, url2, compare_scheme: bool = ..., compare_hostname: bool = ..., compare_path: bool = ...): ...
def read_dbnames(filename): ...
def read_build_sites(filename, check_builds: bool = ...): ...
def relativize_symlinks(path, start: Optional[Any] = ..., followlinks: bool = ...): ...
def stringify_dictionary_keys(in_dict): ...
def recursively_stringify_dictionary_keys(d): ...
def mkstemp_ln(src, prefix: str = ...): ...
def umask_fix_perms(path, umask, unmasked_perms, gid: Optional[Any] = ...): ...
def docstring_trim(docstring): ...
def nice_size(size): ...
def size_to_bytes(size): ...
def send_mail(frm, to, subject, body, config, html: Optional[Any] = ...): ...
def force_symlink(source, link_name): ...
def move_merge(source, target): ...
def safe_str_cmp(a, b): ...

galaxy_root_path = ...  # type: Any

def galaxy_directory(): ...
def config_directories_from_setting(directories_setting, galaxy_root: Any = ...): ...
def parse_int(value, min_val: Optional[Any] = ..., max_val: Optional[Any] = ..., default: Optional[Any] = ..., allow_none: bool = ...): ...
def parse_non_hex_float(s): ...
def build_url(base_url, port: int = ..., scheme: str = ..., pathspec: Optional[Any] = ..., params: Optional[Any] = ..., doseq: bool = ...): ...
def url_get(base_url, password_mgr: Optional[Any] = ..., pathspec: Optional[Any] = ..., params: Optional[Any] = ...): ...
def download_to_file(url, dest_file_path, timeout: int = ..., chunk_size: Any = ...): ...
def safe_relpath(path): ...

class ExecutionTimer:
    begin = ...  # type: Any
    def __init__(self) -> None: ...
    @property
    def elapsed(self): ...
