Category : conventions

If you have an application with 50k lines of python, written by 20 developers, with 500 classes and 50000 intended users, is there any practical means to NOT set this as a requirement without putting the associated exceptions (such as attribute errors) on your users and other developers at runtime? Source: Python..

Read more

The Google docstring styleguide for python writes You should not document exceptions that get raised if the API specified in the docstring is violated (because this would paradoxically make behavior under violation of the API part of the API). I want to confirm my understanding by asking the following question. If I indicate in the ..

Read more

I have a image processing problem, e.g.: rgb_clean, rgb_noisy, raw_clean, raw_noisy, pattern = dataset[i] rgb_clean = imread(rgb_clean) rgb_noisy = imread(rgb_noisy) raw_clean = loadmat(raw_clean)["x"] raw_noisy = loadmat(raw_noisy)["x"] pattern = np.array([c for c in pattern]).reshape((2, 2)) # normalize rgb_clean = rgb_clean.astype(np.float32) / 255 rgb_noisy = rgb_noisy.astype(np.float32) / 255 raw_clean = raw_clean.astype(np.float32) / 255 raw_noisy = raw_noisy.astype(np.float32) / ..

Read more

Say I have code like this: def on_test_end(self, test_dict: Dict[str, Union[Tensor, List[str]]])): """ optionally override for postprocessing of test outputs expect test dict to contain ‘outputs’ and maybe ‘id’ """ return test_dict That fits nicely the recommended width of approx 80 characters. But when I add the return type: def on_test_end(self, test_dict: Dict[str, Union[Tensor, List[str]]]) ..

Read more