diff options
author | Tor Norbye <tnorbye@google.com> | 2014-08-20 17:01:23 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2014-08-20 17:01:23 -0700 |
commit | 1aa2e09bdbd413eacb677e9fa4b50630530d0656 (patch) | |
tree | 2f4cc6d69645bd460aa253fdecb606d764fbd25d /python/psi-api/src/com/jetbrains/python/PyNames.java | |
parent | 02cf98d65c798d368fcec43ed64a001d513bdd4f (diff) | |
download | idea-1aa2e09bdbd413eacb677e9fa4b50630530d0656.tar.gz |
Snapshot idea/138.1696 from git://git.jetbrains.org/idea/community.git
Change-Id: I50c97b83a815ce635e49a38380ba5b8765e4b16a
Diffstat (limited to 'python/psi-api/src/com/jetbrains/python/PyNames.java')
-rw-r--r-- | python/psi-api/src/com/jetbrains/python/PyNames.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/python/psi-api/src/com/jetbrains/python/PyNames.java b/python/psi-api/src/com/jetbrains/python/PyNames.java index 94e35f711c29..bd927c5d49bf 100644 --- a/python/psi-api/src/com/jetbrains/python/PyNames.java +++ b/python/psi-api/src/com/jetbrains/python/PyNames.java @@ -60,6 +60,7 @@ public class PyNames { public static final String FAKE_OLD_BASE = "___Classobj"; public static final String FAKE_GENERATOR = "__generator"; public static final String FAKE_FUNCTION = "__function"; + public static final String FAKE_METHOD = "__method"; public static final String FAKE_NAMEDTUPLE = "__namedtuple"; public static final String FUTURE_MODULE = "__future__"; @@ -471,4 +472,33 @@ public class PyNames { public static boolean isRightOperatorName(@Nullable String name) { return name != null && name.matches("__r[a-z]+__"); } + + /** + * Available in Python 3 and Python 2 starting from 2.6. + * <p/> + * Attributes {@code __doc__}, {@code __dict__} and {@code __module__} should be inherited from object. + */ + public static final ImmutableSet<String> FUNCTION_SPECIAL_ATTRIBUTES = ImmutableSet.of( + "__defaults__", + "__globals__", + "__closure__", + "__code__", + "__name__" + ); + + public static final ImmutableSet<String> LEGACY_FUNCTION_SPECIAL_ATTRIBUTES = ImmutableSet.of( + "func_defaults", + "func_globals", + "func_closure", + "func_code", + "func_name", + "func_doc", + "func_dict" + ); + + public static final ImmutableSet<String> PY3_ONLY_FUNCTION_SPECIAL_ATTRIBUTES = ImmutableSet.of("__annotations__", "__kwdefaults__"); + + public static final ImmutableSet<String> METHOD_SPECIAL_ATTRIBUTES = ImmutableSet.of("__func__", "__self__"); + + public static final ImmutableSet<String> LEGACY_METHOD_SPECIAL_ATTRIBUTES = ImmutableSet.of("im_func", "im_self", "im_class"); } |