<jupyter_start><jupyter_text>Development work for the folder sensor<jupyter_code>import datetime
from datetime import timedelta
import glob
import os

DEFAULT_FILTER = '*'
def get_timestamp(file_path):
    """Return the timestamp of file."""
    mtime = os.stat(file_path).st_mtime
    return datetime.datetime.fromtimestamp(mtime).isoformat()
def get_files_list(folder_path, filter_term):
    """Return the list of file paths, applying filter."""
    query = folder_path + filter_term
    files_list = glob.glob(query)
    files_list = [f for f in files_list if os.path.isfile(f)]
    return files_list
def get_size(files_list):
    """Return the return sum of the size in bytes of files in the list."""
    size_list = [os.stat(f).st_size for f in files_list]
    return sum(size_list)
path = "/Users/robincole/Pictures/Leak"
path = os.path.join(path, '') 
print(path)
name = os.path.split(os.path.split(path)[0])[1]
print(name)
png_list = get_files_list(path, '*png')
png_list
size = get_size(png_list)
size
decimals = 2
state_mb = round(size/1e6, decimals)
state_mb
len(png_list)
png_dict = get_files_dict(png_list)
png_dict
for i in set([1,2,3,4]) - set([1,2]):
    print(i)<jupyter_output>3
4
{'fraction_non_alphanumeric': 0.12270450751252086, 'fraction_numerical': 0.010851419031719533, 'mean_word_length': 4.935643564356436, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '363187', 'license': 'MIT', 'n_tokens_mistral': 440, 'n_tokens_neox': 427, 'n_words': 109, 'path': '.ipynb_checkpoints/Development-checkpoint.ipynb', 'repo_name': 'robmarkcole/HASS-folder-sensor', 'size': '1198'}