Skip to content

Commit

Permalink
run pyfmt on cinderx/cinderx/*.py
Browse files Browse the repository at this point in the history
Summary:
This diff just runs `pyfmt` on the `.py` files in `cinderx/cinderx/`, which have been accidentally exempt from linting for a while. The next diff re-enables linting on them.

The only manual change is to remove a couple grouping comments in `cinderx/cinderx/__init__.py` which are no longer accurate once the imports are auto-sorted alphabetically.

Reviewed By: swtaarrs

Differential Revision: D52862474

fbshipit-source-id: fb48d154ccfaecb130730d1aab4d3ee1990fe6ee
  • Loading branch information
Carl Meyer authored and facebook-github-bot committed Jan 23, 2024
1 parent f4330d5 commit 876864c
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 147 deletions.
21 changes: 9 additions & 12 deletions cinderx/cinderx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,32 @@
sys.setdlopenflags(old_dlopen_flags | os.RTLD_GLOBAL)
try:
from _cinderx import (
# Methods
_compile_perf_trampoline_pre_fork,
_get_entire_call_stack_as_qualnames_with_lineno_and_frame,
_get_entire_call_stack_as_qualnames_with_lineno,
_get_entire_call_stack_as_qualnames_with_lineno_and_frame,
_is_compile_perf_trampoline_pre_fork_enabled,
async_cached_classproperty,
async_cached_property,
cached_classproperty,
cached_property,
clear_all_shadow_caches,
clear_caches,
clear_classloader_caches,
clear_type_profiles,
disable_parallel_gc,
enable_parallel_gc,
get_and_clear_type_profiles_with_metadata,
get_and_clear_type_profiles,
get_and_clear_type_profiles_with_metadata,
get_parallel_gc_settings,
init,
set_profile_interp,
set_profile_interp_all,
set_profile_interp_period,
set_profile_interp,
strict_module_patch,
strict_module_patch_delete,
strict_module_patch_enabled,
strict_module_patch,
watch_sys_modules,

# Other attributes
async_cached_classproperty,
async_cached_property,
cached_classproperty,
cached_property,
StrictModule,
watch_sys_modules,
)
finally:
sys.setdlopenflags(old_dlopen_flags)
Expand Down
73 changes: 36 additions & 37 deletions cinderx/cinderx/opcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


def init(opname, opmap, hasname, hasjrel, hasjabs, hasconst):

def def_op(name, op):
opname[op] = name
opmap[name] = op
Expand Down Expand Up @@ -107,39 +106,39 @@ def shadow_op(name, op):
shadow_op("LOAD_OBJ_FIELD", 222)
shadow_op("STORE_OBJ_FIELD", 223)

shadow_op('INVOKE_METHOD_CACHED', 224)
shadow_op('BINARY_SUBSCR_TUPLE_CONST_INT', 225)
shadow_op('BINARY_SUBSCR_DICT_STR', 226)
shadow_op('BINARY_SUBSCR_LIST', 227)
shadow_op('BINARY_SUBSCR_TUPLE', 228)
shadow_op('BINARY_SUBSCR_DICT', 229)

shadow_op('LOAD_METHOD_UNCACHABLE', 230)
shadow_op('LOAD_METHOD_MODULE', 231)
shadow_op('LOAD_METHOD_TYPE', 232)
shadow_op('LOAD_METHOD_SPLIT_DICT_DESCR', 233)
shadow_op('LOAD_METHOD_SPLIT_DICT_METHOD', 234)
shadow_op('LOAD_METHOD_DICT_DESCR', 235)
shadow_op('LOAD_METHOD_DICT_METHOD', 236)
shadow_op('LOAD_METHOD_NO_DICT_METHOD', 237)
shadow_op('LOAD_METHOD_NO_DICT_DESCR', 238)

shadow_op('STORE_ATTR_SLOT', 239)
shadow_op('STORE_ATTR_SPLIT_DICT', 240)
shadow_op('STORE_ATTR_DESCR', 241)
shadow_op('STORE_ATTR_UNCACHABLE', 242)
shadow_op('STORE_ATTR_DICT', 243)

shadow_op('LOAD_ATTR_POLYMORPHIC', 244)
shadow_op('LOAD_ATTR_SLOT', 245)
shadow_op('LOAD_ATTR_MODULE', 246)
shadow_op('LOAD_ATTR_TYPE', 247)
shadow_op('LOAD_ATTR_SPLIT_DICT_DESCR', 248)
shadow_op('LOAD_ATTR_SPLIT_DICT', 249)
shadow_op('LOAD_ATTR_DICT_NO_DESCR', 250)
shadow_op('LOAD_ATTR_NO_DICT_DESCR', 251)
shadow_op('LOAD_ATTR_DICT_DESCR', 252)
shadow_op('LOAD_ATTR_UNCACHABLE', 253)

shadow_op('LOAD_GLOBAL_CACHED', 254)
shadow_op('SHADOW_NOP', 255)
shadow_op("INVOKE_METHOD_CACHED", 224)
shadow_op("BINARY_SUBSCR_TUPLE_CONST_INT", 225)
shadow_op("BINARY_SUBSCR_DICT_STR", 226)
shadow_op("BINARY_SUBSCR_LIST", 227)
shadow_op("BINARY_SUBSCR_TUPLE", 228)
shadow_op("BINARY_SUBSCR_DICT", 229)

shadow_op("LOAD_METHOD_UNCACHABLE", 230)
shadow_op("LOAD_METHOD_MODULE", 231)
shadow_op("LOAD_METHOD_TYPE", 232)
shadow_op("LOAD_METHOD_SPLIT_DICT_DESCR", 233)
shadow_op("LOAD_METHOD_SPLIT_DICT_METHOD", 234)
shadow_op("LOAD_METHOD_DICT_DESCR", 235)
shadow_op("LOAD_METHOD_DICT_METHOD", 236)
shadow_op("LOAD_METHOD_NO_DICT_METHOD", 237)
shadow_op("LOAD_METHOD_NO_DICT_DESCR", 238)

shadow_op("STORE_ATTR_SLOT", 239)
shadow_op("STORE_ATTR_SPLIT_DICT", 240)
shadow_op("STORE_ATTR_DESCR", 241)
shadow_op("STORE_ATTR_UNCACHABLE", 242)
shadow_op("STORE_ATTR_DICT", 243)

shadow_op("LOAD_ATTR_POLYMORPHIC", 244)
shadow_op("LOAD_ATTR_SLOT", 245)
shadow_op("LOAD_ATTR_MODULE", 246)
shadow_op("LOAD_ATTR_TYPE", 247)
shadow_op("LOAD_ATTR_SPLIT_DICT_DESCR", 248)
shadow_op("LOAD_ATTR_SPLIT_DICT", 249)
shadow_op("LOAD_ATTR_DICT_NO_DESCR", 250)
shadow_op("LOAD_ATTR_NO_DICT_DESCR", 251)
shadow_op("LOAD_ATTR_DICT_DESCR", 252)
shadow_op("LOAD_ATTR_UNCACHABLE", 253)

shadow_op("LOAD_GLOBAL_CACHED", 254)
shadow_op("SHADOW_NOP", 255)
177 changes: 81 additions & 96 deletions cinderx/cinderx/static.py
Original file line number Diff line number Diff line change
@@ -1,119 +1,104 @@
from _static import (
__build_cinder_class__,
_clear_dlopen_cache,
_clear_dlsym_cache,
_property_missing_fget,
_property_missing_fset,
_sizeof_dlopen_cache,
_sizeof_dlsym_cache,
# Checked Containers
chkdict,
chklist,

# Type Codes
TYPED_INT_SIGNED,
TYPED_INT_8BIT,
TYPED_INT_16BIT,
TYPED_INT_32BIT,
TYPED_INT_64BIT,
TYPED_OBJECT,
TYPED_INT8,
TYPED_INT16,
TYPED_INT32,
TYPED_INT64,
TYPED_UINT8,
TYPED_UINT16,
TYPED_UINT32,
TYPED_UINT64,
TYPED_SINGLE,
TYPED_DOUBLE,
TYPED_BOOL,
TYPED_CHAR,
TYPED_ARRAY,

SEQ_LIST,
SEQ_TUPLE,
SEQ_LIST_INEXACT,
SEQ_ARRAY_INT64,
SEQ_SUBSCR_UNCHECKED,

SEQ_REPEAT_INEXACT_SEQ,
SEQ_REPEAT_INEXACT_NUM,
SEQ_REPEAT_REVERSED,
SEQ_REPEAT_PRIMITIVE_NUM,

SEQ_CHECKED_LIST,

FAST_LEN_ARRAY,
FAST_LEN_DICT,
FAST_LEN_INEXACT,
FAST_LEN_LIST,
FAST_LEN_SET,
FAST_LEN_STR,
FAST_LEN_TUPLE,
init_subclass,
install_sp_audit_hook,
is_type_static,
lookup_native_symbol,
make_context_decorator_wrapper,
make_recreate_cm,
posix_clock_gettime_ns,
PRIM_OP_ADD_DBL,
PRIM_OP_ADD_INT,
PRIM_OP_AND_INT,
PRIM_OP_DIV_DBL,
PRIM_OP_DIV_INT,
PRIM_OP_DIV_UN_INT,
PRIM_OP_EQ_DBL,
PRIM_OP_EQ_INT,
PRIM_OP_NE_INT,
PRIM_OP_LT_INT,
PRIM_OP_LE_INT,
PRIM_OP_GT_INT,
PRIM_OP_GE_DBL,
PRIM_OP_GE_INT,
PRIM_OP_LT_UN_INT,
PRIM_OP_LE_UN_INT,
PRIM_OP_GT_UN_INT,
PRIM_OP_GE_UN_INT,
PRIM_OP_EQ_DBL,
PRIM_OP_NE_DBL,
PRIM_OP_LT_DBL,
PRIM_OP_LE_DBL,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INEXACT_SEQ,
SEQ_REPEAT_PRIMITIVE_NUM,
SEQ_REPEAT_REVERSED,
SEQ_SUBSCR_UNCHECKED,
SEQ_TUPLE,
# Static Methods,
set_type_code,
rand,
is_type_static,
set_type_final,
set_type_static,
set_type_static_final,
set_type_final,
make_recreate_cm,
make_context_decorator_wrapper,
posix_clock_gettime_ns,
_property_missing_fget,
_property_missing_fset,
resolve_primitive_descr,
__build_cinder_class__,
init_subclass,
lookup_native_symbol,
_sizeof_dlopen_cache,
_sizeof_dlsym_cache,
_clear_dlopen_cache,
_clear_dlsym_cache,
install_sp_audit_hook,

# Static Classes
staticarray,
TYPED_ARRAY,
TYPED_BOOL,
TYPED_CHAR,
TYPED_DOUBLE,
TYPED_INT16,
TYPED_INT32,
TYPED_INT64,
TYPED_INT8,
TYPED_INT_16BIT,
TYPED_INT_32BIT,
TYPED_INT_64BIT,
TYPED_OBJECT,
TYPED_SINGLE,
TYPED_UINT16,
TYPED_UINT32,
TYPED_UINT64,
TYPED_UINT8,
)
4 changes: 2 additions & 2 deletions cinderx/cinderx/strictmodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
NONSTRICT_MODULE_KIND,
STATIC_MODULE_KIND,
STRICT_MODULE_KIND,
StrictAnalysisResult,
StrictModuleLoader,
STUB_KIND_MASK_ALLOWLIST,
STUB_KIND_MASK_NONE,
STUB_KIND_MASK_STRICT,
STUB_KIND_MASK_TYPING,
StrictAnalysisResult,
StrictModuleLoader,
)

0 comments on commit 876864c

Please sign in to comment.