diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-09-07 19:17:42 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-09-07 19:17:42 +0400 |
commit | 115b25673832049b746835357d63d8d2dbee5229 (patch) | |
tree | ca36db0fe4063108ca5820e1d76ae0496fb88f15 /release/scripts/modules/bpy | |
parent | e53bbc7ab7568e315dc3cf06dd5e989300c98786 (diff) |
ran through pep8 checker
Diffstat (limited to 'release/scripts/modules/bpy')
-rw-r--r-- | release/scripts/modules/bpy/__init__.py | 1 | ||||
-rw-r--r-- | release/scripts/modules/bpy/ops.py | 6 | ||||
-rw-r--r-- | release/scripts/modules/bpy/path.py | 79 | ||||
-rw-r--r-- | release/scripts/modules/bpy/utils.py | 26 |
4 files changed, 56 insertions, 56 deletions
diff --git a/release/scripts/modules/bpy/__init__.py b/release/scripts/modules/bpy/__init__.py index 5b7d5a76336..cba85d935ae 100644 --- a/release/scripts/modules/bpy/__init__.py +++ b/release/scripts/modules/bpy/__init__.py @@ -50,7 +50,6 @@ def _main(): pydoc.Helper.getline = lambda self, prompt: None pydoc.TextDoc.use_bold = lambda self, text: text - # if "-d" in sys.argv: # Enable this to measure startup speed if 0: import cProfile diff --git a/release/scripts/modules/bpy/ops.py b/release/scripts/modules/bpy/ops.py index 223a5a89471..7a824ce2e68 100644 --- a/release/scripts/modules/bpy/ops.py +++ b/release/scripts/modules/bpy/ops.py @@ -164,7 +164,7 @@ class bpy_ops_submodule_op(object): if 'FINISHED' in ret: import bpy scene = bpy.context.scene - if scene: # None in backgroud mode + if scene: # None in backgroud mode scene.update() else: for scene in bpy.data.scenes: @@ -178,14 +178,14 @@ class bpy_ops_submodule_op(object): ''' return op_get_rna(self.idname()) - def __repr__(self): # useful display, repr(op) + def __repr__(self): # useful display, repr(op) import bpy idname = self.idname() as_string = op_as_string(idname) descr = getattr(bpy.types, idname).bl_rna.description return as_string + "\n" + descr - def __str__(self): # used for print(...) + def __str__(self): # used for print(...) return "<function bpy.ops.%s.%s at 0x%x'>" % \ (self.module, self.func, id(self)) diff --git a/release/scripts/modules/bpy/path.py b/release/scripts/modules/bpy/path.py index 63149f2fce8..423fdb7aaab 100644 --- a/release/scripts/modules/bpy/path.py +++ b/release/scripts/modules/bpy/path.py @@ -26,6 +26,7 @@ functions for dealing with paths in Blender. import bpy as _bpy import os as _os + def abspath(path): """ Returns the absolute path relative to the current blend file using the "//" prefix. @@ -99,58 +100,58 @@ def display_name(name): def resolve_ncase(path): - """ - Resolve a case insensitive path on a case sensitive system, - returning a string with the path if found else return the original path. - """ + """ + Resolve a case insensitive path on a case sensitive system, + returning a string with the path if found else return the original path. + """ - import os + import os - def _ncase_path_found(path): - if path=='' or os.path.exists(path): - return path, True + def _ncase_path_found(path): + if path == "" or os.path.exists(path): + return path, True - filename = os.path.basename(path) # filename may be a directory or a file - dirpath = os.path.dirname(path) + filename = os.path.basename(path) # filename may be a directory or a file + dirpath = os.path.dirname(path) - suffix = "" - if not filename: # dir ends with a slash? - if len(dirpath) < len(path): - suffix = path[:len(path)-len(dirpath)] + suffix = "" + if not filename: # dir ends with a slash? + if len(dirpath) < len(path): + suffix = path[:len(path) - len(dirpath)] - filename = os.path.basename(dirpath) - dirpath = os.path.dirname(dirpath) + filename = os.path.basename(dirpath) + dirpath = os.path.dirname(dirpath) - if not os.path.exists(dirpath): - dirpath, found = _ncase_path_found(dirpath) + if not os.path.exists(dirpath): + dirpath, found = _ncase_path_found(dirpath) - if not found: - return path, False + if not found: + return path, False - # at this point, the directory exists but not the file + # at this point, the directory exists but not the file - # we are expecting 'dirpath' to be a directory, but it could be a file - if os.path.isdir(dirpath): - files = os.listdir(dirpath) - else: - return path, False + # we are expecting 'dirpath' to be a directory, but it could be a file + if os.path.isdir(dirpath): + files = os.listdir(dirpath) + else: + return path, False - filename_low = filename.lower() - f_iter_nocase = None + filename_low = filename.lower() + f_iter_nocase = None - for f_iter in files: - if f_iter.lower() == filename_low: - f_iter_nocase = f_iter - break + for f_iter in files: + if f_iter.lower() == filename_low: + f_iter_nocase = f_iter + break - if f_iter_nocase: - return os.path.join(dirpath, f_iter_nocase) + suffix, True - else: - # cant find the right one, just return the path as is. - return path, False + if f_iter_nocase: + return os.path.join(dirpath, f_iter_nocase) + suffix, True + else: + # cant find the right one, just return the path as is. + return path, False - ncase_path, found = _ncase_path_found(path) - return ncase_path if found else path + ncase_path, found = _ncase_path_found(path) + return ncase_path if found else path def ensure_ext(filepath, ext, case_sensitive=False): diff --git a/release/scripts/modules/bpy/utils.py b/release/scripts/modules/bpy/utils.py index 7cfe476c2e7..21453f06648 100644 --- a/release/scripts/modules/bpy/utils.py +++ b/release/scripts/modules/bpy/utils.py @@ -30,6 +30,7 @@ import sys as _sys from _bpy import blend_paths from _bpy import script_paths as _bpy_script_paths + def _test_import(module_name, loaded_modules): import traceback import time @@ -49,7 +50,7 @@ def _test_import(module_name, loaded_modules): if _bpy.app.debug: print("time %s %.4f" % (module_name, time.time() - t)) - loaded_modules.add(mod.__name__) # should match mod.__name__ too + loaded_modules.add(mod.__name__) # should match mod.__name__ too return mod @@ -83,9 +84,10 @@ def modules_from_path(path, loaded_modules): modules.append(mod) return modules - -_global_loaded_modules = [] # store loaded module names for reloading. -import bpy_types as _bpy_types # keep for comparisons, never ever reload this. + + +_global_loaded_modules = [] # store loaded module names for reloading. +import bpy_types as _bpy_types # keep for comparisons, never ever reload this. def load_scripts(reload_scripts=False, refresh_scripts=False): @@ -109,7 +111,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False): if refresh_scripts: original_modules = _sys.modules.values() - + if reload_scripts: _bpy_types.TypeMap.clear() _bpy_types.PropertiesMap.clear() @@ -135,7 +137,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False): traceback.print_exc() def sys_path_ensure(path): - if path not in _sys.path: # reloading would add twice + if path not in _sys.path: # reloading would add twice _sys.path.insert(0, path) def test_reload(mod): @@ -191,7 +193,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False): continue if user_path != base_path and path_subdir == "": - continue # avoid loading 2.4x scripts + continue # avoid loading 2.4x scripts for mod in modules_from_path(path, loaded_modules): test_register(mod) @@ -212,10 +214,8 @@ def load_scripts(reload_scripts=False, refresh_scripts=False): if _bpy.app.debug: print("Python Script Load Time %.4f" % (time.time() - t_main)) - - _bpy_types._register_immediate = True - + _bpy_types._register_immediate = True # base scripts @@ -265,7 +265,7 @@ def script_paths(subdir=None, user=True): return script_paths -_presets = _os.path.join(_scripts[0], "presets") # FIXME - multiple paths +_presets = _os.path.join(_scripts[0], "presets") # FIXME - multiple paths def preset_paths(subdir): @@ -295,10 +295,10 @@ def smpte_from_seconds(time, fps=None): else: neg = "" - if time >= 3600.0: # hours + if time >= 3600.0: # hours hours = int(time / 3600.0) time = time % 3600.0 - if time >= 60.0: # mins + if time >= 60.0: # mins minutes = int(time / 60.0) time = time % 60.0 |