diff --git a/check_blender_release/scripts/requests_basic_access.py b/check_blender_release/scripts/requests_basic_access.py index c7c466dd2c292d1a2ebbd798c9c728238e038d88..53644b2ee8bc64f108852566d7a86fca552406ba 100644 --- a/check_blender_release/scripts/requests_basic_access.py +++ b/check_blender_release/scripts/requests_basic_access.py @@ -3,7 +3,7 @@ import requests r = requests.get("https://blender.org/", verify=True) -assert(r.status_code == 200) -assert(r.reason == "OK") -assert(True if r.ok else False) -assert(len(r.content) > 256) +assert r.status_code == 200 +assert r.reason == "OK" +assert True if r.ok else False +assert len(r.content) > 256 diff --git a/check_source/check_spelling.py b/check_source/check_spelling.py index dcfe03571fa34e7e114c0226b697a18e17ff40ec..642a57ef0199f085b0a8e6ed39aec0b25b273258 100755 --- a/check_source/check_spelling.py +++ b/check_source/check_spelling.py @@ -660,7 +660,7 @@ def main() -> None: clear_stale_cache = False if cache_filepath: - assert(cache_data is not None) + assert cache_data is not None if VERBOSE_CACHE: print("Writing cache:", len(cache_data)) diff --git a/modules/blendfile.py b/modules/blendfile.py index b436cf8e705d389f5837d29f9d8e476842e4a288..a83b0b58696a1c39c7aff07c3bb8542abc567ff3 100644 --- a/modules/blendfile.py +++ b/modules/blendfile.py @@ -152,7 +152,7 @@ class BlendFile: self.close() def find_blocks_from_code(self, code): - assert(type(code) == bytes) + assert type(code) == bytes if code not in self.code_index: return [] return self.code_index[code] @@ -160,7 +160,7 @@ class BlendFile: def find_block_from_offset(self, offset): # same as looking looping over all blocks, # then checking `block.addr_old == offset`. - assert(type(offset) is int) + assert type(offset) is int return self.block_from_offset.get(offset) def close(self): @@ -361,13 +361,13 @@ class BlendFileBlock: return self.dna_type.dna_type_id.decode('ascii') def refine_type_from_index(self, sdna_index_next): - assert(type(sdna_index_next) is int) + assert type(sdna_index_next) is int sdna_index_curr = self.sdna_index self.file.ensure_subtype_smaller(sdna_index_curr, sdna_index_next) self.sdna_index = sdna_index_next def refine_type(self, dna_type_id): - assert(type(dna_type_id) is bytes) + assert type(dna_type_id) is bytes self.refine_type_from_index(self.file.sdna_index_from_id[dna_type_id]) def get_file_offset( @@ -379,11 +379,11 @@ class BlendFileBlock: """ Return (offset, length) """ - assert(type(path) is bytes) + assert type(path) is bytes ofs = self.file_offset if base_index != 0: - assert(base_index < self.count) + assert base_index < self.count ofs += (self.size // self.count) * base_index self.file.handle.seek(ofs, os.SEEK_SET) @@ -407,7 +407,7 @@ class BlendFileBlock: ofs = self.file_offset if base_index != 0: - assert(base_index < self.count) + assert base_index < self.count ofs += (self.size // self.count) * base_index self.file.handle.seek(ofs, os.SEEK_SET) @@ -441,7 +441,7 @@ class BlendFileBlock: ofs = self.file_offset if base_index != 0: - assert(base_index < array_size) + assert base_index < array_size ofs += dna_size * base_index self.file.handle.seek(ofs, os.SEEK_SET) @@ -542,8 +542,8 @@ class BlendFileBlock: if type(result) is not int: return result - assert(self.file.structs[sdna_index_refine].field_from_path( - self.file.header, self.file.handle, path).dna_name.is_pointer) + assert self.file.structs[sdna_index_refine].field_from_path( + self.file.header, self.file.handle, path).dna_name.is_pointer if result != 0: # possible (but unlikely) # that this fails and returns None @@ -623,7 +623,7 @@ class BlendFileHeader: elif pointer_size_id == b'_': self.pointer_size = 4 else: - assert(0) + assert 0 endian_id = values[2] if endian_id == b'v': self.is_little_endian = True @@ -634,7 +634,7 @@ class BlendFileHeader: self.endian_index = 1 self.endian_str = b'>' else: - assert(0) + assert 0 version_id = values[3] self.version = int(version_id) @@ -763,7 +763,7 @@ class DNAStruct: if len(path) >= 2 and type(path[1]) is not bytes: name_tail = path[2:] index = path[1] - assert(type(index) is int) + assert type(index) is int else: name_tail = path[1:] index = 0 @@ -772,7 +772,7 @@ class DNAStruct: name_tail = None index = 0 - assert(type(name) is bytes) + assert type(name) is bytes field = self.field_from_name.get(name) @@ -783,7 +783,7 @@ class DNAStruct: index_offset = header.pointer_size * index else: index_offset = field.dna_type.size * index - assert(index_offset < field.dna_size) + assert index_offset < field.dna_size handle.seek(index_offset, os.SEEK_CUR) if not name_tail: # None or () return field @@ -814,10 +814,10 @@ class DNAStruct: dna_name.array_size) except NotImplementedError as e: raise NotImplementedError("%r exists, but can't resolve field %r" % - (path, dna_name.name_only), dna_name, dna_type) + (path, dna_name.name_only), dna_name, dna_type) def field_set(self, header, handle, path, value): - assert(type(path) == bytes) + assert type(path) == bytes field = self.field_from_path(header, handle, path) if field is None: @@ -899,7 +899,7 @@ class DNA_IO: @staticmethod def write_string(handle, astring, fieldlen): - assert(isinstance(astring, str)) + assert isinstance(astring, str) if len(astring) >= fieldlen: stringw = astring[0:fieldlen] else: @@ -908,7 +908,7 @@ class DNA_IO: @staticmethod def write_bytes(handle, astring, fieldlen): - assert(isinstance(astring, (bytes, bytearray))) + assert isinstance(astring, (bytes, bytearray)) if len(astring) >= fieldlen: stringw = astring[0:fieldlen] else: diff --git a/utils/cycles_commits_sync.py b/utils/cycles_commits_sync.py index f6c483aa96e7eb0a6954a8d01a0ad48fc366b58c..091bfe6badcff0c12bed379dfc8f206f8fa162da 100755 --- a/utils/cycles_commits_sync.py +++ b/utils/cycles_commits_sync.py @@ -61,8 +61,8 @@ def replace_file_prefix(path, prefix, replace_prefix): def cleanup_patch(patch, accept_prefix, replace_prefix): - assert(accept_prefix[0] != b'/') - assert(replace_prefix[0] != b'/') + assert accept_prefix[0] != b'/' + assert replace_prefix[0] != b'/' full_accept_prefix = GIT_FILE_SECTION_MARKER + b" a/" + accept_prefix @@ -131,12 +131,12 @@ def commit_map_get(repository, path, start_commit): def commits_get_difference(cycles_map, blender_map): cycles_to_blender = [] for stamped_subject, commit_hash in cycles_map.items(): - if not stamped_subject in blender_map: + if stamped_subject not in blender_map: cycles_to_blender.append(commit_hash) blender_to_cycles = [] for stamped_subject, commit_hash in blender_map.items(): - if not stamped_subject in cycles_map: + if stamped_subject not in cycles_map: blender_to_cycles.append(commit_hash) return cycles_to_blender, blender_to_cycles diff --git a/utils/git_log_review_commits.py b/utils/git_log_review_commits.py index e5d124df5b5031d584247670b0ae4ceced0c5d84..16b714264a62a2e3d2c5074940594623d57c88a4 100755 --- a/utils/git_log_review_commits.py +++ b/utils/git_log_review_commits.py @@ -165,14 +165,14 @@ def main(): pass elif args.filter_type == 'BUGFIX': first_line = c.body.strip().split("\n")[0] - assert(len(first_line)) + assert len(first_line) if any(w for w in first_line.split() if w.lower().startswith(("fix", "bugfix", "bug-fix"))): pass else: return False elif args.filter_type == 'NOISE': first_line = c.body.strip().split("\n")[0] - assert(len(first_line)) + assert len(first_line) if any(w for w in first_line.split() if w.lower().startswith("cleanup")): pass else: diff --git a/utils/git_log_review_commits_advanced.py b/utils/git_log_review_commits_advanced.py index aa3f51d101fef9d45a633cbd4919db9bb4d809e4..31eff2e8930eff1cc7cd9f9c0683e5c1f24714d2 100755 --- a/utils/git_log_review_commits_advanced.py +++ b/utils/git_log_review_commits_advanced.py @@ -584,14 +584,14 @@ def main(): pass elif args.filter_type == 'BUGFIX': first_line = c.body.split("\n\n")[0].strip(" :.;-\n").replace("\n", " ") - assert(len(first_line)) + assert len(first_line) if any(w for w in first_line.split() if w.lower().startswith(("fix", "bugfix", "bug-fix"))): pass else: return False elif args.filter_type == 'NOISE': first_line = c.body.strip().split("\n")[0] - assert(len(first_line)) + assert len(first_line) if any(w for w in first_line.split() if w.lower().startswith("cleanup")): pass else: diff --git a/utils/make_cursor_gui.py b/utils/make_cursor_gui.py index 77082308e5a05205bd7d125109af2f73c5e7de13..f206ae5f3e54c3acf68f552f94a5a8ce34571e7f 100755 --- a/utils/make_cursor_gui.py +++ b/utils/make_cursor_gui.py @@ -105,7 +105,7 @@ class App: oldstate = self.state self.state = [] for n in range(1024): - if not((n % 2) or ((n // 32) % 2)): + if not ((n % 2) or ((n // 32) % 2)): self.state.append(oldstate[n]) for n in range(256, 1024): self.state.append(2) @@ -271,7 +271,7 @@ class App: print("\n\nstatic char bitmap[] = {", end=' ') for i in range(numbytes): b1 = bitmap[i] - if not(i % 8): + if not (i % 8): print("\n\t", end=' ') print("0x%(b1)02x, " % vars(), end=' ') print("\n};") @@ -279,7 +279,7 @@ class App: print("\nstatic char mask[] = {", end=' ') for i in range(numbytes): b1 = mask[i] - if not(i % 8): + if not (i % 8): print("\n\t", end=' ') print("0x%(b1)02x, " % vars(), end=' ') print("\n};") diff --git a/utils_maintenance/blender_menu_search_coverage.py b/utils_maintenance/blender_menu_search_coverage.py index 9df4618d85d058d8c3a0cfe56dd3334577798c97..2f826df62212b5db6385579655181fbc4c21a489 100644 --- a/utils_maintenance/blender_menu_search_coverage.py +++ b/utils_maintenance/blender_menu_search_coverage.py @@ -231,17 +231,17 @@ def setup_contants(): def setup_menu_wrap_draw_call_all(): def operators_from_layout_introspect(layout_introspect): - assert(isinstance(layout_introspect, list)) + assert isinstance(layout_introspect, list) for item in layout_introspect: value = item.get("items") if value is not None: - assert(isinstance(value, list)) + assert isinstance(value, list) yield from operators_from_layout_introspect(value) value = item.get("operator") if value is not None: - assert(isinstance(value, str)) + assert isinstance(value, str) # We don't need the arguments at the moment. - assert(value.startswith("bpy.ops.")) + assert value.startswith("bpy.ops.") yield value[8:].split("(")[0] def menu_draw_introspect(self, _context): @@ -337,7 +337,7 @@ def ctx_text_default(): if area.type == 'TEXT_EDITOR': area.spaces.active.text = text found = True - assert(found) + assert found # ----- @@ -352,7 +352,7 @@ def ctx_image_view_default(): space_data = area.spaces.active space_data.image = image found = True - assert(found) + assert found def ctx_image_view_render(): @@ -364,7 +364,7 @@ def ctx_image_view_render(): space_data = area.spaces.active space_data.image = image found = True - assert(found) + assert found def ctx_image_mask_default(): @@ -377,7 +377,7 @@ def ctx_image_mask_default(): space_data.mode = 'MASK' space_data.mask = mask found = True - assert(found) + assert found def ctx_image_paint_default(): @@ -390,7 +390,7 @@ def ctx_image_paint_default(): space_data.mode = 'PAINT' space_data.image = image found = True - assert(found) + assert found # ---- @@ -405,7 +405,7 @@ def ctx_clip_default(): if area.type == 'CLIP_EDITOR': area.spaces.active.clip = clip found = True - assert(found) + assert found # ---------- @@ -551,7 +551,7 @@ def perform_coverage_test(): MENU_CALLED_RUNTIME.clear() yield dict(type='F3', value='TAP') yield dict(type='ESC', value='TAP') - assert(len(MENU_CALLED_RUNTIME) != 0) + assert len(MENU_CALLED_RUNTIME) != 0 operators_pairs_all = operator_list() diff --git a/utils_maintenance/code_clean.py b/utils_maintenance/code_clean.py index 5e325dfb4428e56e056ac3586a404c5ce50076e2..a7b0b53072b11b43ba426bc9370482611475b9fd 100755 --- a/utils_maintenance/code_clean.py +++ b/utils_maintenance/code_clean.py @@ -153,7 +153,7 @@ def find_build_args_ninja(build_dir: str) -> Optional[ProcessedCommands]: ) while process.poll(): time.sleep(1) - assert(process.stdout is not None) + assert process.stdout is not None out = process.stdout.read() process.stdout.close() @@ -172,7 +172,7 @@ def find_build_args_make(build_dir: str) -> Optional[ProcessedCommands]: ) while process.poll(): time.sleep(1) - assert(process.stdout is not None) + assert process.stdout is not None out = process.stdout.read() process.stdout.close() @@ -782,7 +782,7 @@ def edit_function_get_all() -> List[str]: def edit_class_from_id(name: str) -> Type[EditGenerator]: result = getattr(edit_generators, name) - assert(issubclass(result, EditGenerator)) + assert issubclass(result, EditGenerator) # MYPY 0.812 doesn't recognize the assert above. return result # type: ignore