# Utilities for simple needs
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
``` python
# Time it
from torch_snippets import *
```
CPU times: user 1.57 s, sys: 1.59 s, total: 3.16 s
Wall time: 731 ms
Below we are trying to extract the `__all__` list from all Python files
of the torch_snippets directory.
Through the code, you can already see some of the elements of
torch-snippets in action.
``` python
import ast
os.environ[
"AD_MAX_ITEMS"
] = ( # os is already imported by torch_snippets, along with many other useful libraries
"1000" # Set the maximum number of items to display in the AD object
)
@tryy # This is a decorator that catches exceptions
def extract_all_list(file_path):
file = readfile(file_path, silent=True) # Read the file
tree = ast.parse(file, filename=file_path)
for node in tree.body:
if isinstance(node, ast.Assign):
for target in node.targets:
if isinstance(target, ast.Name) and target.id == "__all__":
if isinstance(node.value, ast.List):
all_list = [
elt.value
for elt in node.value.elts
if isinstance(elt, ast.Constant)
]
return all_list
return None
def print_all_lists_in_directory(directory):
dir = P(directory) # Create a pathlib.Path object
for f in dir.ls(): # Iterate over all files in the directory
if f.extn == "py" and f.stem not in [
"__init__",
"_nbdev",
]: # If it's a Python file and not __init__.py
all_list = extract_all_list(f)
if all_list is not None and len(all_list) > 0:
h2(f.stem) # Print the name of the file as a heading in jupyter
print(
AD({"items": all_list})
) # AD is an intelligent dictionary that can display itself nicely
```
``` python
print(P().resolve())
```
/Users/yeshwanth/Code/Personal/torch_snippets/nbs
``` python
# Specify the directory containing the Python files
directory_path = "../torch_snippets"
print_all_lists_in_directory(directory_path)
```
## misc
```↯ AttrDict ↯
items[]
0 - Timer (🏷️ str)
1 - track2 (🏷️ str)
2 - summarize_input (🏷️ str)
3 - timeit (🏷️ str)
4 - io (🏷️ str)
5 - tryy (🏷️ str)
```
## load_defaults
```↯ AttrDict ↯
items[]
0 - ifnone (🏷️ str)
1 - exists (🏷️ str)
2 - loadifexists (🏷️ str)
```
## text_utils
```↯ AttrDict ↯
items[]
0 - textify (🏷️ str)
1 - find_lines (🏷️ str)
2 - find_blocks (🏷️ str)
3 - find_substring (🏷️ str)
4 - get_line_data_from_word_data (🏷️ str)
5 - edit_distance_path (🏷️ str)
6 - group_blocks (🏷️ str)
```
## paths
```↯ AttrDict ↯
items[]
0 - valid_methods (🏷️ str)
1 - P (🏷️ str)
2 - ls (🏷️ str)
3 - print_folder_summary (🏷️ str)
4 - dill (🏷️ str)
5 - input_to_str (🏷️ str)
6 - output_to_path (🏷️ str)
7 - process_f (🏷️ str)
8 - get_fs (🏷️ str)
9 - P0 (🏷️ str)
10 - stem (🏷️ str)
11 - stems (🏷️ str)
12 - extn (🏷️ str)
13 - remove_file (🏷️ str)
14 - isdir (🏷️ str)
15 - makedir (🏷️ str)
16 - fname (🏷️ str)
17 - fname2 (🏷️ str)
18 - parent (🏷️ str)
19 - Glob (🏷️ str)
20 - find (🏷️ str)
21 - zip_files (🏷️ str)
22 - unzip_file (🏷️ str)
23 - list_zip (🏷️ str)
24 - md5 (🏷️ str)
25 - remove_duplicates (🏷️ str)
26 - common_items (🏷️ str)
27 - folder_summary (🏷️ str)
28 - readlines (🏷️ str)
29 - readfile (🏷️ str)
30 - writelines (🏷️ str)
31 - tree (🏷️ str)
32 - folder_structure_to_dict (🏷️ str)
33 - folder_structure_to_json (🏷️ str)
34 - rename_batch (🏷️ str)
35 - dumpdill (🏷️ str)
36 - loaddill (🏷️ str)
```
## charts
```↯ AttrDict ↯
items[]
0 - alt (🏷️ str)
1 - Chart (🏷️ str)
2 - CM (🏷️ str)
3 - radar (🏷️ str)
4 - confusion_matrix (🏷️ str)
5 - spider (🏷️ str)
6 - upsetaltair_top_level_configuration (🏷️ str)
7 - UpSetAltair (🏷️ str)
```
## pdf_loader
```↯ AttrDict ↯
items[]
0 - PDF (🏷️ str)
1 - dump_pdf_images (🏷️ str)
2 - preview_pdf (🏷️ str)
```
## interactive_show
```↯ AttrDict ↯
items[]
0 - COLORS (🏷️ str)
1 - to_networkx (🏷️ str)
2 - plot_image (🏷️ str)
3 - plot_graph (🏷️ str)
4 - tonp (🏷️ str)
5 - tolist (🏷️ str)
6 - convert_to_nx (🏷️ str)
7 - viz2 (🏷️ str)
8 - df2graph_nodes (🏷️ str)
9 - ishow (🏷️ str)
```
## registry
```↯ AttrDict ↯
items[]
0 - Config (🏷️ str)
1 - AttrDict (🏷️ str)
2 - registry (🏷️ str)
3 - tryeval (🏷️ str)
4 - parse_base (🏷️ str)
5 - parse (🏷️ str)
6 - parse_and_resolve (🏷️ str)
7 - parse_string (🏷️ str)
```
## markup2
```↯ AttrDict ↯
items[]
0 - AD (🏷️ str)
1 - Config (🏷️ str)
2 - isnamedtupleinstance (🏷️ str)
3 - unpack (🏷️ str)
4 - AttrDict (🏷️ str)
5 - pretty_json (🏷️ str)
6 - read_json (🏷️ str)
7 - write_json (🏷️ str)
8 - write_jsonl (🏷️ str)
9 - read_jsonl (🏷️ str)
10 - read_yaml (🏷️ str)
11 - write_yaml (🏷️ str)
12 - read_xml (🏷️ str)
13 - write_xml (🏷️ str)
```
## inspector
```↯ AttrDict ↯
items[]
0 - inspect (🏷️ str)
```
## torch_loader
```↯ AttrDict ↯
items[]
0 - torch (🏷️ str)
1 - th (🏷️ str)
2 - torchvision (🏷️ str)
3 - T (🏷️ str)
4 - transforms (🏷️ str)
5 - nn (🏷️ str)
6 - np (🏷️ str)
7 - F (🏷️ str)
8 - Dataset (🏷️ str)
9 - DataLoader (🏷️ str)
10 - optim (🏷️ str)
11 - Report (🏷️ str)
12 - Reshape (🏷️ str)
13 - Permute (🏷️ str)
14 - device (🏷️ str)
15 - save_torch_model_weights_from (🏷️ str)
16 - load_torch_model_weights_to (🏷️ str)
17 - detach (🏷️ str)
18 - cat_with_padding (🏷️ str)
```
## logger
```↯ AttrDict ↯
items[]
0 - console (🏷️ str)
1 - reset_logger_width (🏷️ str)
2 - logger (🏷️ str)
3 - Trace (🏷️ str)
4 - Debug (🏷️ str)
5 - Info (🏷️ str)
6 - Warn (🏷️ str)
7 - Excep (🏷️ str)
8 - warn_mode (🏷️ str)
9 - info_mode (🏷️ str)
10 - debug_mode (🏷️ str)
11 - trace_mode (🏷️ str)
12 - excep_mode (🏷️ str)
13 - in_warn_mode (🏷️ str)
14 - in_info_mode (🏷️ str)
15 - in_debug_mode (🏷️ str)
16 - in_trace_mode (🏷️ str)
17 - in_excep_mode (🏷️ str)
18 - frames (🏷️ str)
19 - get_console (🏷️ str)
20 - reset_logger (🏷️ str)
21 - get_logger_level (🏷️ str)
22 - logger_mode (🏷️ str)
23 - in_logger_mode (🏷️ str)
24 - notify_waiting (🏷️ str)
```
## markup
```↯ AttrDict ↯
items[]
0 - AttrDict (🏷️ str)
1 - json (🏷️ str)
2 - Config (🏷️ str)
3 - isnamedtupleinstance (🏷️ str)
4 - unpack (🏷️ str)
5 - hash_tensor (🏷️ str)
6 - hash_pandas_dataframe (🏷️ str)
7 - AttrDictDeprecated (🏷️ str)
8 - decompose (🏷️ str)
9 - pretty_json (🏷️ str)
10 - read_json (🏷️ str)
11 - write_json (🏷️ str)
12 - write_jsonl (🏷️ str)
13 - read_jsonl (🏷️ str)
14 - read_yaml (🏷️ str)
15 - write_yaml (🏷️ str)
16 - read_xml (🏷️ str)
17 - write_xml (🏷️ str)
```
## sklegos
```↯ AttrDict ↯
items[]
0 - ColumnSelector (🏷️ str)
1 - GroupedPredictor (🏷️ str)
2 - EstimatorTransformer (🏷️ str)
3 - train_test_split (🏷️ str)
4 - MakeFrame (🏷️ str)
5 - ImputeMissingValues (🏷️ str)
6 - LambdaTransformer (🏷️ str)
7 - Cat2Num (🏷️ str)
8 - SplitDateColumn (🏷️ str)
```
## ipython
```↯ AttrDict ↯
items[]
0 - save_notebook (🏷️ str)
1 - backup_this_notebook (🏷️ str)
2 - backup_all_notebooks (🏷️ str)
3 - backup_folders_of_nbs (🏷️ str)
4 - display_dfs_side_by_side (🏷️ str)
5 - show_big_dataframe (🏷️ str)
6 - h1 (🏷️ str)
7 - h2 (🏷️ str)
8 - h3 (🏷️ str)
9 - h4 (🏷️ str)
10 - h5 (🏷️ str)
11 - h6 (🏷️ str)
12 - store_scrap (🏷️ str)
13 - shutdown_current_notebook (🏷️ str)
```
../torch_snippets/loader.py:532: SyntaxWarning: invalid escape sequence '\$'
puttext(ax, text.replace("$", "\$"), tuple(bbs[ix][:2]), size=text_sz)
## loader
```↯ AttrDict ↯
items[]
0 - B (🏷️ str)
1 - Blank (🏷️ str)
2 - batchify (🏷️ str)
3 - C (🏷️ str)
4 - choose (🏷️ str)
5 - common (🏷️ str)
6 - crop_from_bb (🏷️ str)
7 - diff (🏷️ str)
8 - E (🏷️ str)
9 - flatten (🏷️ str)
10 - Image (🏷️ str)
11 - jitter (🏷️ str)
12 - L (🏷️ str)
13 - lzip (🏷️ str)
14 - line (🏷️ str)
15 - lines (🏷️ str)
16 - to_absolute (🏷️ str)
17 - to_relative (🏷️ str)
18 - enlarge_bbs (🏷️ str)
19 - shrink_bbs (🏷️ str)
20 - logger (🏷️ str)
21 - np (🏷️ str)
22 - now (🏷️ str)
23 - nunique (🏷️ str)
24 - os (🏷️ str)
25 - pad (🏷️ str)
26 - pd (🏷️ str)
27 - pdfilter (🏷️ str)
28 - pdb (🏷️ str)
29 - PIL (🏷️ str)
30 - print (🏷️ str)
31 - puttext (🏷️ str)
32 - randint (🏷️ str)
33 - rand (🏷️ str)
34 - re (🏷️ str)
35 - read (🏷️ str)
36 - readPIL (🏷️ str)
37 - rect (🏷️ str)
38 - resize (🏷️ str)
39 - rotate (🏷️ str)
40 - see (🏷️ str)
41 - show (🏷️ str)
42 - store_attr (🏷️ str)
43 - subplots (🏷️ str)
44 - sys (🏷️ str)
45 - toss (🏷️ str)
46 - track (🏷️ str)
47 - tqdm (🏷️ str)
48 - Tqdm (🏷️ str)
49 - trange (🏷️ str)
50 - unique (🏷️ str)
51 - uint (🏷️ str)
52 - write (🏷️ str)
53 - BB (🏷️ str)
54 - bbfy (🏷️ str)
55 - xywh2xyXY (🏷️ str)
56 - df2bbs (🏷️ str)
57 - bbs2df (🏷️ str)
58 - Info (🏷️ str)
59 - Warn (🏷️ str)
60 - Debug (🏷️ str)
61 - Excep (🏷️ str)
62 - reset_logger (🏷️ str)
63 - get_logger_level (🏷️ str)
64 - in_debug_mode (🏷️ str)
65 - debug_mode (🏷️ str)
66 - typedispatch (🏷️ str)
67 - defaultdict (🏷️ str)
68 - Counter (🏷️ str)
69 - dcopy (🏷️ str)
70 - patch_to (🏷️ str)
71 - split (🏷️ str)
72 - train_test_split (🏷️ str)
73 - init_plt (🏷️ str)
74 - init_cv2 (🏷️ str)
```
## imgaug_loader
```↯ AttrDict ↯
items[]
0 - do (🏷️ str)
1 - bw (🏷️ str)
2 - rotate (🏷️ str)
3 - pad (🏷️ str)
4 - get_size (🏷️ str)
5 - rescale (🏷️ str)
6 - crop (🏷️ str)
7 - imgaugbbs2bbs (🏷️ str)
8 - bbs2imgaugbbs (🏷️ str)
```
## dates
```↯ AttrDict ↯
items[]
0 - make_uniform_date_format (🏷️ str)
1 - ALL_DATE_FORMATS (🏷️ str)
2 - are_dates_equal (🏷️ str)
3 - today (🏷️ str)
```
## profiler
```↯ AttrDict ↯
items[]
0 - time_profiler (🏷️ str)
```
## bokeh_loader
```↯ AttrDict ↯
items[]
0 - parse_sz (🏷️ str)
1 - get_bplot (🏷️ str)
```
## bb_utils
```↯ AttrDict ↯
items[]
0 - randint (🏷️ str)
1 - BB (🏷️ str)
2 - df2bbs (🏷️ str)
3 - bbs2df (🏷️ str)
4 - bbfy (🏷️ str)
5 - jitter (🏷️ str)
6 - compute_eps (🏷️ str)
7 - enlarge_bbs (🏷️ str)
8 - shrink_bbs (🏷️ str)
9 - iou (🏷️ str)
10 - compute_distance_matrix (🏷️ str)
11 - compute_distances (🏷️ str)
12 - split_bb_to_xyXY (🏷️ str)
13 - combine_xyXY_to_bb (🏷️ str)
14 - is_absolute (🏷️ str)
15 - is_relative (🏷️ str)
16 - to_relative (🏷️ str)
17 - to_absolute (🏷️ str)
18 - merge_by_bb (🏷️ str)
19 - isin (🏷️ str)
```
## adapters
```↯ AttrDict ↯
items[]
0 - np_2_b64 (🏷️ str)
1 - b64_2_np (🏷️ str)
2 - b64_2_file (🏷️ str)
3 - bytes_2_file (🏷️ str)
4 - file_2_bytes (🏷️ str)
5 - csvs_2_cvat (🏷️ str)
6 - cvat_2_csvs (🏷️ str)
7 - df_2_yolo (🏷️ str)
8 - yolo_2_df (🏷️ str)
```
## decorators
```↯ AttrDict ↯
items[]
0 - format (🏷️ str)
1 - warn_on_fail (🏷️ str)
2 - timeit (🏷️ str)
3 - io (🏷️ str)
4 - check_kwargs_not_none (🏷️ str)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/sizhky/torch_snippets/tree/master/",
"name": "torch-snippets",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "snippets, torch",
"author": "Yeshwanth Reddy",
"author_email": "1992chinna@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/4a/ea/5d131a6523fb358382ea618ed9de4aebace56b03676bc6e7302be7a34edb/torch_snippets-0.550.tar.gz",
"platform": null,
"description": "# Utilities for simple needs\n\n\n<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->\n\n``` python\n# Time it\nfrom torch_snippets import *\n```\n\n CPU times: user 1.57 s, sys: 1.59 s, total: 3.16 s\n Wall time: 731 ms\n\nBelow we are trying to extract the `__all__` list from all Python files\nof the torch_snippets directory. \nThrough the code, you can already see some of the elements of\ntorch-snippets in action.\n\n``` python\nimport ast\n\nos.environ[\n \"AD_MAX_ITEMS\"\n] = ( # os is already imported by torch_snippets, along with many other useful libraries\n \"1000\" # Set the maximum number of items to display in the AD object\n)\n\n\n@tryy # This is a decorator that catches exceptions\ndef extract_all_list(file_path):\n file = readfile(file_path, silent=True) # Read the file\n tree = ast.parse(file, filename=file_path)\n\n for node in tree.body:\n if isinstance(node, ast.Assign):\n for target in node.targets:\n if isinstance(target, ast.Name) and target.id == \"__all__\":\n if isinstance(node.value, ast.List):\n all_list = [\n elt.value\n for elt in node.value.elts\n if isinstance(elt, ast.Constant)\n ]\n return all_list\n return None\n\n\ndef print_all_lists_in_directory(directory):\n dir = P(directory) # Create a pathlib.Path object\n for f in dir.ls(): # Iterate over all files in the directory\n if f.extn == \"py\" and f.stem not in [\n \"__init__\",\n \"_nbdev\",\n ]: # If it's a Python file and not __init__.py\n all_list = extract_all_list(f)\n if all_list is not None and len(all_list) > 0:\n h2(f.stem) # Print the name of the file as a heading in jupyter\n print(\n AD({\"items\": all_list})\n ) # AD is an intelligent dictionary that can display itself nicely\n```\n\n``` python\nprint(P().resolve())\n```\n\n /Users/yeshwanth/Code/Personal/torch_snippets/nbs\n\n``` python\n# Specify the directory containing the Python files\ndirectory_path = \"../torch_snippets\"\nprint_all_lists_in_directory(directory_path)\n```\n\n## misc\n\n\n ```\u21af AttrDict \u21af\n items[]\n 0 - Timer (\ud83c\udff7\ufe0f str)\n 1 - track2 (\ud83c\udff7\ufe0f str)\n 2 - summarize_input (\ud83c\udff7\ufe0f str)\n 3 - timeit (\ud83c\udff7\ufe0f str)\n 4 - io (\ud83c\udff7\ufe0f str)\n 5 - tryy (\ud83c\udff7\ufe0f str)\n\n ```\n\n## load_defaults\n\n\n ```\u21af AttrDict \u21af\n items[]\n 0 - ifnone (\ud83c\udff7\ufe0f str)\n 1 - exists (\ud83c\udff7\ufe0f str)\n 2 - loadifexists (\ud83c\udff7\ufe0f str)\n\n ```\n\n## text_utils\n\n\n ```\u21af AttrDict \u21af\n items[]\n 0 - textify (\ud83c\udff7\ufe0f str)\n 1 - find_lines (\ud83c\udff7\ufe0f str)\n 2 - find_blocks (\ud83c\udff7\ufe0f str)\n 3 - find_substring (\ud83c\udff7\ufe0f str)\n 4 - get_line_data_from_word_data (\ud83c\udff7\ufe0f str)\n 5 - edit_distance_path (\ud83c\udff7\ufe0f str)\n 6 - group_blocks (\ud83c\udff7\ufe0f str)\n\n ```\n\n## paths\n\n\n ```\u21af AttrDict \u21af\n items[]\n 0 - valid_methods (\ud83c\udff7\ufe0f str)\n 1 - P (\ud83c\udff7\ufe0f str)\n 2 - ls (\ud83c\udff7\ufe0f str)\n 3 - print_folder_summary (\ud83c\udff7\ufe0f str)\n 4 - dill (\ud83c\udff7\ufe0f str)\n 5 - input_to_str (\ud83c\udff7\ufe0f str)\n 6 - output_to_path (\ud83c\udff7\ufe0f str)\n 7 - process_f (\ud83c\udff7\ufe0f str)\n 8 - get_fs (\ud83c\udff7\ufe0f str)\n 9 - P0 (\ud83c\udff7\ufe0f str)\n 10 - stem (\ud83c\udff7\ufe0f str)\n 11 - stems (\ud83c\udff7\ufe0f str)\n 12 - extn (\ud83c\udff7\ufe0f str)\n 13 - remove_file (\ud83c\udff7\ufe0f str)\n 14 - isdir (\ud83c\udff7\ufe0f str)\n 15 - makedir (\ud83c\udff7\ufe0f str)\n 16 - fname (\ud83c\udff7\ufe0f str)\n 17 - fname2 (\ud83c\udff7\ufe0f str)\n 18 - parent (\ud83c\udff7\ufe0f str)\n 19 - Glob (\ud83c\udff7\ufe0f str)\n 20 - find (\ud83c\udff7\ufe0f str)\n 21 - zip_files (\ud83c\udff7\ufe0f str)\n 22 - unzip_file (\ud83c\udff7\ufe0f str)\n 23 - list_zip (\ud83c\udff7\ufe0f str)\n 24 - md5 (\ud83c\udff7\ufe0f str)\n 25 - remove_duplicates (\ud83c\udff7\ufe0f str)\n 26 - common_items (\ud83c\udff7\ufe0f str)\n 27 - folder_summary (\ud83c\udff7\ufe0f str)\n 28 - readlines (\ud83c\udff7\ufe0f str)\n 29 - readfile (\ud83c\udff7\ufe0f str)\n 30 - writelines (\ud83c\udff7\ufe0f str)\n 31 - tree (\ud83c\udff7\ufe0f str)\n 32 - folder_structure_to_dict (\ud83c\udff7\ufe0f str)\n 33 - folder_structure_to_json (\ud83c\udff7\ufe0f str)\n 34 - rename_batch (\ud83c\udff7\ufe0f str)\n 35 - dumpdill (\ud83c\udff7\ufe0f str)\n 36 - loaddill (\ud83c\udff7\ufe0f str)\n\n ```\n\n## charts\n\n\n ```\u21af AttrDict \u21af\n items[]\n 0 - alt (\ud83c\udff7\ufe0f str)\n 1 - Chart (\ud83c\udff7\ufe0f str)\n 2 - CM (\ud83c\udff7\ufe0f str)\n 3 - radar (\ud83c\udff7\ufe0f str)\n 4 - confusion_matrix (\ud83c\udff7\ufe0f str)\n 5 - spider (\ud83c\udff7\ufe0f str)\n 6 - upsetaltair_top_level_configuration (\ud83c\udff7\ufe0f str)\n 7 - UpSetAltair (\ud83c\udff7\ufe0f str)\n\n ```\n\n## pdf_loader\n\n\n ```\u21af AttrDict \u21af\n items[]\n 0 - PDF (\ud83c\udff7\ufe0f str)\n 1 - dump_pdf_images (\ud83c\udff7\ufe0f str)\n 2 - preview_pdf (\ud83c\udff7\ufe0f str)\n\n ```\n\n## interactive_show\n\n\n ```\u21af AttrDict \u21af\n items[]\n 0 - COLORS (\ud83c\udff7\ufe0f str)\n 1 - to_networkx (\ud83c\udff7\ufe0f str)\n 2 - plot_image (\ud83c\udff7\ufe0f str)\n 3 - plot_graph (\ud83c\udff7\ufe0f str)\n 4 - tonp (\ud83c\udff7\ufe0f str)\n 5 - tolist (\ud83c\udff7\ufe0f str)\n 6 - convert_to_nx (\ud83c\udff7\ufe0f str)\n 7 - viz2 (\ud83c\udff7\ufe0f str)\n 8 - df2graph_nodes (\ud83c\udff7\ufe0f str)\n 9 - ishow (\ud83c\udff7\ufe0f str)\n\n ```\n\n## registry\n\n\n ```\u21af AttrDict \u21af\n items[]\n 0 - Config (\ud83c\udff7\ufe0f str)\n 1 - AttrDict (\ud83c\udff7\ufe0f str)\n 2 - registry (\ud83c\udff7\ufe0f str)\n 3 - tryeval (\ud83c\udff7\ufe0f str)\n 4 - parse_base (\ud83c\udff7\ufe0f str)\n 5 - parse (\ud83c\udff7\ufe0f str)\n 6 - parse_and_resolve (\ud83c\udff7\ufe0f str)\n 7 - parse_string (\ud83c\udff7\ufe0f str)\n\n ```\n\n## markup2\n\n\n ```\u21af AttrDict \u21af\n items[]\n 0 - AD (\ud83c\udff7\ufe0f str)\n 1 - Config (\ud83c\udff7\ufe0f str)\n 2 - isnamedtupleinstance (\ud83c\udff7\ufe0f str)\n 3 - unpack (\ud83c\udff7\ufe0f str)\n 4 - AttrDict (\ud83c\udff7\ufe0f str)\n 5 - pretty_json (\ud83c\udff7\ufe0f str)\n 6 - read_json (\ud83c\udff7\ufe0f str)\n 7 - write_json (\ud83c\udff7\ufe0f str)\n 8 - write_jsonl (\ud83c\udff7\ufe0f str)\n 9 - read_jsonl (\ud83c\udff7\ufe0f str)\n 10 - read_yaml (\ud83c\udff7\ufe0f str)\n 11 - write_yaml (\ud83c\udff7\ufe0f str)\n 12 - read_xml (\ud83c\udff7\ufe0f str)\n 13 - write_xml (\ud83c\udff7\ufe0f str)\n\n ```\n\n## inspector\n\n\n ```\u21af AttrDict \u21af\n items[]\n 0 - inspect (\ud83c\udff7\ufe0f str)\n\n ```\n\n## torch_loader\n\n\n ```\u21af AttrDict \u21af\n items[]\n 0 - torch (\ud83c\udff7\ufe0f str)\n 1 - th (\ud83c\udff7\ufe0f str)\n 2 - torchvision (\ud83c\udff7\ufe0f str)\n 3 - T (\ud83c\udff7\ufe0f str)\n 4 - transforms (\ud83c\udff7\ufe0f str)\n 5 - nn (\ud83c\udff7\ufe0f str)\n 6 - np (\ud83c\udff7\ufe0f str)\n 7 - F (\ud83c\udff7\ufe0f str)\n 8 - Dataset (\ud83c\udff7\ufe0f str)\n 9 - DataLoader (\ud83c\udff7\ufe0f str)\n 10 - optim (\ud83c\udff7\ufe0f str)\n 11 - Report (\ud83c\udff7\ufe0f str)\n 12 - Reshape (\ud83c\udff7\ufe0f str)\n 13 - Permute (\ud83c\udff7\ufe0f str)\n 14 - device (\ud83c\udff7\ufe0f str)\n 15 - save_torch_model_weights_from (\ud83c\udff7\ufe0f str)\n 16 - load_torch_model_weights_to (\ud83c\udff7\ufe0f str)\n 17 - detach (\ud83c\udff7\ufe0f str)\n 18 - cat_with_padding (\ud83c\udff7\ufe0f str)\n\n ```\n\n## logger\n\n\n ```\u21af AttrDict \u21af\n items[]\n 0 - console (\ud83c\udff7\ufe0f str)\n 1 - reset_logger_width (\ud83c\udff7\ufe0f str)\n 2 - logger (\ud83c\udff7\ufe0f str)\n 3 - Trace (\ud83c\udff7\ufe0f str)\n 4 - Debug (\ud83c\udff7\ufe0f str)\n 5 - Info (\ud83c\udff7\ufe0f str)\n 6 - Warn (\ud83c\udff7\ufe0f str)\n 7 - Excep (\ud83c\udff7\ufe0f str)\n 8 - warn_mode (\ud83c\udff7\ufe0f str)\n 9 - info_mode (\ud83c\udff7\ufe0f str)\n 10 - debug_mode (\ud83c\udff7\ufe0f str)\n 11 - trace_mode (\ud83c\udff7\ufe0f str)\n 12 - excep_mode (\ud83c\udff7\ufe0f str)\n 13 - in_warn_mode (\ud83c\udff7\ufe0f str)\n 14 - in_info_mode (\ud83c\udff7\ufe0f str)\n 15 - in_debug_mode (\ud83c\udff7\ufe0f str)\n 16 - in_trace_mode (\ud83c\udff7\ufe0f str)\n 17 - in_excep_mode (\ud83c\udff7\ufe0f str)\n 18 - frames (\ud83c\udff7\ufe0f str)\n 19 - get_console (\ud83c\udff7\ufe0f str)\n 20 - reset_logger (\ud83c\udff7\ufe0f str)\n 21 - get_logger_level (\ud83c\udff7\ufe0f str)\n 22 - logger_mode (\ud83c\udff7\ufe0f str)\n 23 - in_logger_mode (\ud83c\udff7\ufe0f str)\n 24 - notify_waiting (\ud83c\udff7\ufe0f str)\n\n ```\n\n## markup\n\n\n ```\u21af AttrDict \u21af\n items[]\n 0 - AttrDict (\ud83c\udff7\ufe0f str)\n 1 - json (\ud83c\udff7\ufe0f str)\n 2 - Config (\ud83c\udff7\ufe0f str)\n 3 - isnamedtupleinstance (\ud83c\udff7\ufe0f str)\n 4 - unpack (\ud83c\udff7\ufe0f str)\n 5 - hash_tensor (\ud83c\udff7\ufe0f str)\n 6 - hash_pandas_dataframe (\ud83c\udff7\ufe0f str)\n 7 - AttrDictDeprecated (\ud83c\udff7\ufe0f str)\n 8 - decompose (\ud83c\udff7\ufe0f str)\n 9 - pretty_json (\ud83c\udff7\ufe0f str)\n 10 - read_json (\ud83c\udff7\ufe0f str)\n 11 - write_json (\ud83c\udff7\ufe0f str)\n 12 - write_jsonl (\ud83c\udff7\ufe0f str)\n 13 - read_jsonl (\ud83c\udff7\ufe0f str)\n 14 - read_yaml (\ud83c\udff7\ufe0f str)\n 15 - write_yaml (\ud83c\udff7\ufe0f str)\n 16 - read_xml (\ud83c\udff7\ufe0f str)\n 17 - write_xml (\ud83c\udff7\ufe0f str)\n\n ```\n\n## sklegos\n\n\n ```\u21af AttrDict \u21af\n items[]\n 0 - ColumnSelector (\ud83c\udff7\ufe0f str)\n 1 - GroupedPredictor (\ud83c\udff7\ufe0f str)\n 2 - EstimatorTransformer (\ud83c\udff7\ufe0f str)\n 3 - train_test_split (\ud83c\udff7\ufe0f str)\n 4 - MakeFrame (\ud83c\udff7\ufe0f str)\n 5 - ImputeMissingValues (\ud83c\udff7\ufe0f str)\n 6 - LambdaTransformer (\ud83c\udff7\ufe0f str)\n 7 - Cat2Num (\ud83c\udff7\ufe0f str)\n 8 - SplitDateColumn (\ud83c\udff7\ufe0f str)\n\n ```\n\n## ipython\n\n\n ```\u21af AttrDict \u21af\n items[]\n 0 - save_notebook (\ud83c\udff7\ufe0f str)\n 1 - backup_this_notebook (\ud83c\udff7\ufe0f str)\n 2 - backup_all_notebooks (\ud83c\udff7\ufe0f str)\n 3 - backup_folders_of_nbs (\ud83c\udff7\ufe0f str)\n 4 - display_dfs_side_by_side (\ud83c\udff7\ufe0f str)\n 5 - show_big_dataframe (\ud83c\udff7\ufe0f str)\n 6 - h1 (\ud83c\udff7\ufe0f str)\n 7 - h2 (\ud83c\udff7\ufe0f str)\n 8 - h3 (\ud83c\udff7\ufe0f str)\n 9 - h4 (\ud83c\udff7\ufe0f str)\n 10 - h5 (\ud83c\udff7\ufe0f str)\n 11 - h6 (\ud83c\udff7\ufe0f str)\n 12 - store_scrap (\ud83c\udff7\ufe0f str)\n 13 - shutdown_current_notebook (\ud83c\udff7\ufe0f str)\n\n ```\n\n ../torch_snippets/loader.py:532: SyntaxWarning: invalid escape sequence '\\$'\n puttext(ax, text.replace(\"$\", \"\\$\"), tuple(bbs[ix][:2]), size=text_sz)\n\n## loader\n\n\n ```\u21af AttrDict \u21af\n items[]\n 0 - B (\ud83c\udff7\ufe0f str)\n 1 - Blank (\ud83c\udff7\ufe0f str)\n 2 - batchify (\ud83c\udff7\ufe0f str)\n 3 - C (\ud83c\udff7\ufe0f str)\n 4 - choose (\ud83c\udff7\ufe0f str)\n 5 - common (\ud83c\udff7\ufe0f str)\n 6 - crop_from_bb (\ud83c\udff7\ufe0f str)\n 7 - diff (\ud83c\udff7\ufe0f str)\n 8 - E (\ud83c\udff7\ufe0f str)\n 9 - flatten (\ud83c\udff7\ufe0f str)\n 10 - Image (\ud83c\udff7\ufe0f str)\n 11 - jitter (\ud83c\udff7\ufe0f str)\n 12 - L (\ud83c\udff7\ufe0f str)\n 13 - lzip (\ud83c\udff7\ufe0f str)\n 14 - line (\ud83c\udff7\ufe0f str)\n 15 - lines (\ud83c\udff7\ufe0f str)\n 16 - to_absolute (\ud83c\udff7\ufe0f str)\n 17 - to_relative (\ud83c\udff7\ufe0f str)\n 18 - enlarge_bbs (\ud83c\udff7\ufe0f str)\n 19 - shrink_bbs (\ud83c\udff7\ufe0f str)\n 20 - logger (\ud83c\udff7\ufe0f str)\n 21 - np (\ud83c\udff7\ufe0f str)\n 22 - now (\ud83c\udff7\ufe0f str)\n 23 - nunique (\ud83c\udff7\ufe0f str)\n 24 - os (\ud83c\udff7\ufe0f str)\n 25 - pad (\ud83c\udff7\ufe0f str)\n 26 - pd (\ud83c\udff7\ufe0f str)\n 27 - pdfilter (\ud83c\udff7\ufe0f str)\n 28 - pdb (\ud83c\udff7\ufe0f str)\n 29 - PIL (\ud83c\udff7\ufe0f str)\n 30 - print (\ud83c\udff7\ufe0f str)\n 31 - puttext (\ud83c\udff7\ufe0f str)\n 32 - randint (\ud83c\udff7\ufe0f str)\n 33 - rand (\ud83c\udff7\ufe0f str)\n 34 - re (\ud83c\udff7\ufe0f str)\n 35 - read (\ud83c\udff7\ufe0f str)\n 36 - readPIL (\ud83c\udff7\ufe0f str)\n 37 - rect (\ud83c\udff7\ufe0f str)\n 38 - resize (\ud83c\udff7\ufe0f str)\n 39 - rotate (\ud83c\udff7\ufe0f str)\n 40 - see (\ud83c\udff7\ufe0f str)\n 41 - show (\ud83c\udff7\ufe0f str)\n 42 - store_attr (\ud83c\udff7\ufe0f str)\n 43 - subplots (\ud83c\udff7\ufe0f str)\n 44 - sys (\ud83c\udff7\ufe0f str)\n 45 - toss (\ud83c\udff7\ufe0f str)\n 46 - track (\ud83c\udff7\ufe0f str)\n 47 - tqdm (\ud83c\udff7\ufe0f str)\n 48 - Tqdm (\ud83c\udff7\ufe0f str)\n 49 - trange (\ud83c\udff7\ufe0f str)\n 50 - unique (\ud83c\udff7\ufe0f str)\n 51 - uint (\ud83c\udff7\ufe0f str)\n 52 - write (\ud83c\udff7\ufe0f str)\n 53 - BB (\ud83c\udff7\ufe0f str)\n 54 - bbfy (\ud83c\udff7\ufe0f str)\n 55 - xywh2xyXY (\ud83c\udff7\ufe0f str)\n 56 - df2bbs (\ud83c\udff7\ufe0f str)\n 57 - bbs2df (\ud83c\udff7\ufe0f str)\n 58 - Info (\ud83c\udff7\ufe0f str)\n 59 - Warn (\ud83c\udff7\ufe0f str)\n 60 - Debug (\ud83c\udff7\ufe0f str)\n 61 - Excep (\ud83c\udff7\ufe0f str)\n 62 - reset_logger (\ud83c\udff7\ufe0f str)\n 63 - get_logger_level (\ud83c\udff7\ufe0f str)\n 64 - in_debug_mode (\ud83c\udff7\ufe0f str)\n 65 - debug_mode (\ud83c\udff7\ufe0f str)\n 66 - typedispatch (\ud83c\udff7\ufe0f str)\n 67 - defaultdict (\ud83c\udff7\ufe0f str)\n 68 - Counter (\ud83c\udff7\ufe0f str)\n 69 - dcopy (\ud83c\udff7\ufe0f str)\n 70 - patch_to (\ud83c\udff7\ufe0f str)\n 71 - split (\ud83c\udff7\ufe0f str)\n 72 - train_test_split (\ud83c\udff7\ufe0f str)\n 73 - init_plt (\ud83c\udff7\ufe0f str)\n 74 - init_cv2 (\ud83c\udff7\ufe0f str)\n\n ```\n\n## imgaug_loader\n\n\n ```\u21af AttrDict \u21af\n items[]\n 0 - do (\ud83c\udff7\ufe0f str)\n 1 - bw (\ud83c\udff7\ufe0f str)\n 2 - rotate (\ud83c\udff7\ufe0f str)\n 3 - pad (\ud83c\udff7\ufe0f str)\n 4 - get_size (\ud83c\udff7\ufe0f str)\n 5 - rescale (\ud83c\udff7\ufe0f str)\n 6 - crop (\ud83c\udff7\ufe0f str)\n 7 - imgaugbbs2bbs (\ud83c\udff7\ufe0f str)\n 8 - bbs2imgaugbbs (\ud83c\udff7\ufe0f str)\n\n ```\n\n## dates\n\n\n ```\u21af AttrDict \u21af\n items[]\n 0 - make_uniform_date_format (\ud83c\udff7\ufe0f str)\n 1 - ALL_DATE_FORMATS (\ud83c\udff7\ufe0f str)\n 2 - are_dates_equal (\ud83c\udff7\ufe0f str)\n 3 - today (\ud83c\udff7\ufe0f str)\n\n ```\n\n## profiler\n\n\n ```\u21af AttrDict \u21af\n items[]\n 0 - time_profiler (\ud83c\udff7\ufe0f str)\n\n ```\n\n## bokeh_loader\n\n\n ```\u21af AttrDict \u21af\n items[]\n 0 - parse_sz (\ud83c\udff7\ufe0f str)\n 1 - get_bplot (\ud83c\udff7\ufe0f str)\n\n ```\n\n## bb_utils\n\n\n ```\u21af AttrDict \u21af\n items[]\n 0 - randint (\ud83c\udff7\ufe0f str)\n 1 - BB (\ud83c\udff7\ufe0f str)\n 2 - df2bbs (\ud83c\udff7\ufe0f str)\n 3 - bbs2df (\ud83c\udff7\ufe0f str)\n 4 - bbfy (\ud83c\udff7\ufe0f str)\n 5 - jitter (\ud83c\udff7\ufe0f str)\n 6 - compute_eps (\ud83c\udff7\ufe0f str)\n 7 - enlarge_bbs (\ud83c\udff7\ufe0f str)\n 8 - shrink_bbs (\ud83c\udff7\ufe0f str)\n 9 - iou (\ud83c\udff7\ufe0f str)\n 10 - compute_distance_matrix (\ud83c\udff7\ufe0f str)\n 11 - compute_distances (\ud83c\udff7\ufe0f str)\n 12 - split_bb_to_xyXY (\ud83c\udff7\ufe0f str)\n 13 - combine_xyXY_to_bb (\ud83c\udff7\ufe0f str)\n 14 - is_absolute (\ud83c\udff7\ufe0f str)\n 15 - is_relative (\ud83c\udff7\ufe0f str)\n 16 - to_relative (\ud83c\udff7\ufe0f str)\n 17 - to_absolute (\ud83c\udff7\ufe0f str)\n 18 - merge_by_bb (\ud83c\udff7\ufe0f str)\n 19 - isin (\ud83c\udff7\ufe0f str)\n\n ```\n\n## adapters\n\n\n ```\u21af AttrDict \u21af\n items[]\n 0 - np_2_b64 (\ud83c\udff7\ufe0f str)\n 1 - b64_2_np (\ud83c\udff7\ufe0f str)\n 2 - b64_2_file (\ud83c\udff7\ufe0f str)\n 3 - bytes_2_file (\ud83c\udff7\ufe0f str)\n 4 - file_2_bytes (\ud83c\udff7\ufe0f str)\n 5 - csvs_2_cvat (\ud83c\udff7\ufe0f str)\n 6 - cvat_2_csvs (\ud83c\udff7\ufe0f str)\n 7 - df_2_yolo (\ud83c\udff7\ufe0f str)\n 8 - yolo_2_df (\ud83c\udff7\ufe0f str)\n\n ```\n\n## decorators\n\n\n ```\u21af AttrDict \u21af\n items[]\n 0 - format (\ud83c\udff7\ufe0f str)\n 1 - warn_on_fail (\ud83c\udff7\ufe0f str)\n 2 - timeit (\ud83c\udff7\ufe0f str)\n 3 - io (\ud83c\udff7\ufe0f str)\n 4 - check_kwargs_not_none (\ud83c\udff7\ufe0f str)\n\n ```\n",
"bugtrack_url": null,
"license": "Apache Software License 2.0",
"summary": "One line functions for common tasks",
"version": "0.550",
"project_urls": {
"Homepage": "https://github.com/sizhky/torch_snippets/tree/master/"
},
"split_keywords": [
"snippets",
" torch"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d68174aa88d9fa95414378c655bda2bd30749fa5341dbfa59b30eea0cd1154ae",
"md5": "b135ad717f32f8c26e5a7b378962ebc2",
"sha256": "f510c491bc6d96c4efc55211a95cf0724846f20a8730725e8697c59dc6ff541a"
},
"downloads": -1,
"filename": "torch_snippets-0.550-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b135ad717f32f8c26e5a7b378962ebc2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 106619,
"upload_time": "2025-01-01T21:45:15",
"upload_time_iso_8601": "2025-01-01T21:45:15.108514Z",
"url": "https://files.pythonhosted.org/packages/d6/81/74aa88d9fa95414378c655bda2bd30749fa5341dbfa59b30eea0cd1154ae/torch_snippets-0.550-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4aea5d131a6523fb358382ea618ed9de4aebace56b03676bc6e7302be7a34edb",
"md5": "32e0998b6945e4c431fba7d9a928d58c",
"sha256": "91f13454e83e663d9ab03034627c24160f1c7dd8d7b8387dc6f248cb8b5829a4"
},
"downloads": -1,
"filename": "torch_snippets-0.550.tar.gz",
"has_sig": false,
"md5_digest": "32e0998b6945e4c431fba7d9a928d58c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 94260,
"upload_time": "2025-01-01T21:45:17",
"upload_time_iso_8601": "2025-01-01T21:45:17.493615Z",
"url": "https://files.pythonhosted.org/packages/4a/ea/5d131a6523fb358382ea618ed9de4aebace56b03676bc6e7302be7a34edb/torch_snippets-0.550.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-01 21:45:17",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sizhky",
"github_project": "torch_snippets",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "Pillow",
"specs": []
},
{
"name": "altair",
"specs": []
},
{
"name": "dill",
"specs": []
},
{
"name": "fastcore",
"specs": []
},
{
"name": "ipython",
"specs": []
},
{
"name": "loguru",
"specs": []
},
{
"name": "matplotlib",
"specs": []
},
{
"name": "numpy",
"specs": []
},
{
"name": "pandas",
"specs": []
},
{
"name": "setuptools",
"specs": []
},
{
"name": "tqdm",
"specs": []
},
{
"name": "CProfileV",
"specs": []
}
],
"lcname": "torch-snippets"
}