Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
jantic
GitHub Repository: jantic/deoldify
Path: blob/master/fastai/imports/core.py
781 views
1
import csv, gc, gzip, os, pickle, shutil, sys, warnings, yaml, io, subprocess
2
import math, matplotlib.pyplot as plt, numpy as np, pandas as pd, random
3
import scipy.stats, scipy.special
4
import abc, collections, hashlib, itertools, json, operator, pathlib
5
import mimetypes, inspect, typing, functools, importlib, weakref
6
import html, re, requests, tarfile, numbers, tempfile, bz2
7
8
from abc import abstractmethod, abstractproperty
9
from collections import abc, Counter, defaultdict, namedtuple, OrderedDict
10
from collections.abc import Iterable
11
import concurrent
12
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
13
from copy import copy, deepcopy
14
from dataclasses import dataclass, field, InitVar
15
from enum import Enum, IntEnum
16
from functools import partial, reduce
17
from pdb import set_trace
18
from matplotlib import patches, patheffects
19
from numpy import array, cos, exp, log, sin, tan, tanh
20
from operator import attrgetter, itemgetter
21
from pathlib import Path
22
from warnings import warn
23
from contextlib import contextmanager
24
from fastprogress.fastprogress import MasterBar, ProgressBar
25
from matplotlib.patches import Patch
26
from pandas import Series, DataFrame
27
from io import BufferedWriter, BytesIO
28
29
import pkg_resources
30
pkg_resources.require("fastprogress>=0.1.19")
31
from fastprogress.fastprogress import master_bar, progress_bar
32
33
#for type annotations
34
from numbers import Number
35
from typing import Any, AnyStr, Callable, Collection, Dict, Hashable, Iterator, List, Mapping, NewType, Optional
36
from typing import Sequence, Tuple, TypeVar, Union
37
from types import SimpleNamespace
38
39
def try_import(module):
40
"Try to import `module`. Returns module's object on success, None on failure"
41
try: return importlib.import_module(module)
42
except: return None
43
44
def have_min_pkg_version(package, version):
45
"Check whether we have at least `version` of `package`. Returns True on success, False otherwise."
46
try:
47
pkg_resources.require(f"{package}>={version}")
48
return True
49
except:
50
return False
51
52