This file contains hidden or 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
| import pathlib | |
| import argparse | |
| def find_all_files(path: pathlib.Path, extension: str): | |
| found_files = [] | |
| for f in path.glob(f"**/*{extension}"): | |
| found_files.append(f) | |
| return found_files |
This file contains hidden or 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 random import randint | |
| def create_and_verify_var(length): | |
| """Creates a variable with variable length of length, sets it to a | |
| random integer and checks that that variable was indeed created and | |
| correctly stores the integer""" | |
| var_name = 'a' * length | |
| expected_val = randint(0, 1000) | |
| exec(f'{var_name} = {expected_val}') |
This file contains hidden or 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
| # Note that the following is found in bltinmodule.c and is NOT the complete file. | |
| static PyObject * | |
| min_max(PyObject *args, PyObject *kwds, int op) | |
| { | |
| PyObject *v, *it, *item, *val, *maxitem, *maxval, *keyfunc=NULL; | |
| PyObject *emptytuple, *defaultval = NULL; | |
| static char *kwlist[] = {"key", "default", NULL}; | |
| const char *name = op == Py_LT ? "min" : "max"; | |
| const int positional = PyTuple_Size(args) > 1; |