Used in https://www.kaggle.com/models/shadiakiki1/birdnet-analyzer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
From https://stackoverflow.com/a/63784887/4126114 | |
Usage: | |
In jupyter cell: | |
some_variable = "text" | |
%%writetemplate filename.txt | |
test: {some_variable} | |
""" | |
from IPython.core.magic import register_line_cell_magic | |
@register_line_cell_magic |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
s3 object as a fileobj for reading tar without full download
Copied from SO question How to list files inside tar in AWS S3 without downloading it?
Check my answer there for more details: link
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Recursively get size of objects | |
# https://stackoverflow.com/a/59228005/4126114 | |
# https://stackoverflow.com/a/38515297/4126114 | |
# Published at https://gist.github.com/shadiakiki1986/6d2b641264b054bc63b224a726a1ead8 | |
def nested_apply(x, func, max_depth, depth_current=0): | |
s1 = func(x) | |
if depth_current >= max_depth: return s1 | |
wrap_napply = lambda v: nested_apply(v, func, max_depth, depth_current+1) |
NewerOlder