Snapshot 9e6329d622cc9649c9c035f28faddc29564a5b7a from idea/133.696 of git://git.jetbrains.org/idea/community.git
9e6329d: IDEA-119035 Select All shortcut for any table on mac with Darcula
7642139: [log] IDEA-116322 Fix structure filter for multiple roots
5fe2227: [log] refactor: group filters before passing them to providers
a9bda1e: Problem with several users in log filter fixed.
bb353f3: [log] IDEA-119316 Fix "go to commit" if there are log filters
2825dd1: IDEA-119467 Gradle: auto discovery of buildSrc project (cherry picked from commit 3cb5420)
ca05350: Gradle: respect the order of dependencies (cherry picked from commit dca7107)
8a1d099: IDEA-115351 Idea UI hangs after performing Move Module to group (cherry picked from commit 673ed61) [r=Maxim.Mossienko]
9f006a4: NPE fix (cherry picked from commit 1eb3644)
2089b40: Gradle: test data fix (cherry picked from commit c864c4b)
6208324: IDEA-119336 Gradle build files: build.gradle scripts are checkout from Perforce even if the file is not changed (cherry picked from commit 3234c0b)
d1d776c: IDEA-119467 Gradle: auto discovery of buildSrc project IDEA-98930 IDEA does not resolve dependencies in Gradle buildSrc/ project (cherry picked from commit 0982afc)
6f6c403: Gradle: dependencies scope merge and sourceSets type handling updated related issues: IDEA-119365 Gradle import does not respect model customisations IDEA-118280 Gradle import: IDEA detect java folder as a resource folder IDEA-117668 IDEA v13 spontaneously changes additional test source root to source root (cherry picked from commit 68bfa5e)
a7f9d6f: Gradle: respect module build classpath for build scripts resolving review: http://crucible.labs.intellij.net/cru/CR-IC-4038
742c670: isEAP = false, time to release 13.0.2
3a5cfc7: add profiling parameters to the right part of the classpath (has been broken after Launcher was introduced)
ca42a66: fixed empty headers and import (dependant in language level) for qt, gtk... skeletons.
ba68876: update copyright in artworks
7c12cb3: IDEA-119619 Settings / Language Injections: project level XML tag injection loses Sub-Tags value on IDE restart
f7bd727: don't call robot on alt on Windows and when window is inactive (cherry picked from commit 0fe2cac)
8b62b1e: add WinXP definition (cherry picked from commit dde1494)
62c528a: consume Alt events on WinXP in default handler to avoid WindowsRootPaneUI.AltProcessor (cherry picked from commit f14aab9)
20c7faa: support table decoration on IntelliJ laf (cherry picked from commit 04425c9)
7dc2f34: IDEA-118211 (cherry picked from commit 55ee980) [r=Peter.Gromov]
b15f65d: fixed PY-11823 Test Runner detection in settings doesn't pick up just installed test runner
7a2bec9: Fixed dedent in case of tabs ( PY-10120).
56b5f81: Python keywords extracted. Cleanup.
f195253: Fixed test data to satisfy PEP8.
6b6bbc1: Make right par indent=none in import statement (PY-9075).
6a39911: Make continuation indent after continuation in indenting statement (PY-9573).
cf19307: Test for PY-9573
fb5186fa: Handle 'mode' as a keyword argument to open() as well
27a4d26: Detect text or binary I/O in pathlib.Path.open()
a5600e3: Return instance types for instance types of superclasses
f56e9b1: fixed PY-11837 nose test runner errors while formatting a test error
7420dd6: Nullity annotations
97ffd71: fixed test data
d0eb725: fixed test data
326185d: generator: do not drop the whole module in case there are broken __repr__ defined
982687a: performance for generator: Split big generated modules (like _Gtk, PyQt) into smaller ones
af679a5: Simplified always true condition
3174b9c: Extracted PyClassTypeImpl.findProperty()
777280e: Added 'inherited' parameter to PyClass.findProperty()
d5d8b23: Python skeletons class members provider now can provide new overridden members
6775ed3: Fixed code insight for returning 'self' in base class methods (PY-10977, PY-11413)
d4c641f: Fix formatter to add two blank lines between declarations with comment (PY-9923).
9c8134a: add field after super call
37813c6: Revert "Detect SQL fragments only in the beginning of string literals" (PY-11828)
9d5973f: Use default charset as python console encoding.
7fed382: Added Python 3.4 modules to the stdlib modules list
c772246: Don't ignore unused attributes of empty constructors (PY-7527)
91ae6bf: Fixed NPE in PyUnusedLocalInspectionVisitor.visitPyCallExpression()
464ae1c: fixed PY-11800 Parameter unfilled false positive for decorators with '*' arguments.
e3ec532: fixed test data
31bb1dd: fixed add field declaration to the beginning of __init__
2910f7d: fixed EA-52897 - CCE: ImportToggleAliasIntention$.execute
cca9133: fixed EA-53046 - NPE: PyExtractMethodUtil.a
2fcf769: fixed quickdoc test
fcf329f: fixed editing test
859c599: fixed testdata
ab7782a: fixed PY-11765 @ivar and @type in class documentation cause PyUnresolvedReferences inspection to file
8303e4f: IDEA-112303 Tool Windows Quick Access button: impossible to select item in list by mouse (cherry picked from commit 8e2ce03)
b206d2d: fix NPE
d923a83: Trying to fix EA-51665 - assert: FTManager.createAndStoreBundledTemplate (cherry picked from commit 47dee08) +review CR-IC
72fa58b: Add additional diagnostic to investigate EA-51665 (assert: FTManager.createAndStoreBundledTemplate). (cherry picked from commit a5e4cf4) +review CR-IC
6548f1a: java: incorrect parsing of bounds in class files fixed
8f5b22c: EA-42899 - CCE: XmlLanguageInjectionSupport.doEditInjection & cleanup
2a882e0: EA-53406 - IAE: ServiceManager.getService
ed41c77: WI-13685 PhpStorm doesn't save project name CR-PS-181
2c3ccec: IDEA-119445 Remove first slash in "copy reference" (cherry picked from commit 298bb04)
50bf901: IDEA-119153 file search too wide for users folder (cherry picked from commit 37521f0)
8ab790b: IDEA-119470 File and code templates: changes gone when switching tabs (cherry picked from commit 21cdea3)
7402508: EA-53393 - IOOBE: DomAnchorImpl.createAnchor (missing cherry pick)
f6ab2da: Bug fix: IDEA incorrect handle escaping.
c78400d: IDEA-105253 Missing icon for Thread dumps view
21b6f91: IDEA-104735 Dracula: INVALID string have not dracula style red color (cherry picked from commit 4a5e793)
53885c2: Don't show active editor in recent files
6cf74eb: IDEA-104706 Remove currently active file from "Recent Files" popup (cherry pick from master)
ffef358: IDEA-119406 IDEA make corrupts files when performing Maven resource filtering (default value of escapeString is null)
b8e9ab1: IDEA-119406 IDEA make corrupts files when performing Maven resource filtering (cherry picked from commit 5b6b3f6) +review CR-IC
d3dd646: EA-53308 - CCE: DfaVariableValue.<init> (cherry picked from commit 32a579d)
10f83e0: external build for artifacts: added API to filter contents of directory extracted from jar file [rev by Michael Golubev]
b7f4af0: make nonDefaultProject="true" really work
0bebc13: cosmetics
94e0a24: Merge remote-tracking branch 'origin/133' into 133
85cae29: IDEA-119347 ../jre64 JDK not being picked up by idea64.exe
2dd77af: IDEA-117127 Editor: Throwable on Select word at caret inside plain text (cherry picked from commit 2e3a0d8)
0a5e3ad: IDEA-117555 Search everywhere dialog is being closed immediately (cherry picked from commit ba8037d)
520da57: fix getDisplayName nullability assertion
0663734: IDEA-111122 remove attached jar artifact coming from "apklib" dependency from the dependencies of app module: users add it to deploy jar to Maven repository in addition to "apklib" file, but we don't need to add it to the classpath, because it leads to class duplication [rev=sergey.evdokimov]
c1fb468: IDEA-79522 need ability to set display names for xml attribute and xml tag language injections
3ae70b9: IDEA-119163 "Language Injections" settings should use toolbar decorator in the same way as other
50c78e9: IDEA-117327 Add a setting to switch off autopopup completion item selection by Enter (cherry picked from commit 84ddafc)
ae5ce9b: groovy debugging agent that produces less garbage (cherry picked from commit c7af9fe)
f6682f7: Roll-back FileChooserDescriptor API change.
1c64249: Merge remote-tracking branch 'origin/133' into 133
b293f8c: SearchEverywhere doesn't work on Linux
07b98c1: IDEA-74428 Ability to turn on log debug categories from the GUI
4257f6f: CR-IU-511 make abstract class abstract & leave getPresentableText mandatory
7cac7b7: allow to turn off suggestion to create a file when creating a directory with file-like name (IDEA-118250) (cherry picked from commit 5d81e8d)
acb9db2: don't show parameter info for invisible editors (EA-53161 - NPE: ParameterInfoComponent.<init>) (cherry picked from commit fb24d98)
e6bfbbf: the users don't care if we're preparing editors to open (IDEA-115130) (cherry picked from commit 9a116de)
3f1ebf3: rethrow PCE from KeyedExtensionFactory reflection (cherry picked from commit df8967b)
Change-Id: I8083d21f3faff4f899c53a5dea2710713dc1a2a9
diff --git a/python/helpers/generator3.py b/python/helpers/generator3.py
index fe24620..ca61efe 100644
--- a/python/helpers/generator3.py
+++ b/python/helpers/generator3.py
@@ -1,43 +1,15 @@
# encoding: utf-8
-from pycharm_generator_utils.module_redeclarator import *
-from pycharm_generator_utils.util_methods import *
-from pycharm_generator_utils.constants import *
-import os
import atexit
import zipfile
+from pycharm_generator_utils.module_redeclarator import *
+from pycharm_generator_utils.util_methods import *
+from pycharm_generator_utils.constants import *
+
+
debug_mode = False
-def build_output_name(dirname, qualified_name):
- qualifiers = qualified_name.split(".")
- if dirname and not dirname.endswith("/") and not dirname.endswith("\\"):
- dirname += os.path.sep # "a -> a/"
- for pathindex in range(len(qualifiers) - 1): # create dirs for all qualifiers but last
- subdirname = dirname + os.path.sep.join(qualifiers[0: pathindex + 1])
- if not os.path.isdir(subdirname):
- action("creating subdir %r", subdirname)
- os.makedirs(subdirname)
- init_py = os.path.join(subdirname, "__init__.py")
- if os.path.isfile(subdirname + ".py"):
- os.rename(subdirname + ".py", init_py)
- elif not os.path.isfile(init_py):
- init = fopen(init_py, "w")
- init.close()
- target_name = dirname + os.path.sep.join(qualifiers)
- if os.path.isdir(target_name):
- fname = os.path.join(target_name, "__init__.py")
- else:
- fname = target_name + ".py"
-
- dirname = os.path.dirname(fname)
-
- if not os.path.isdir(dirname):
- os.makedirs(dirname)
-
- return fname
-
-
def redo_module(module_name, outfile, module_file_name, doing_builtins):
# gobject does 'del _gobject' in its __init__.py, so the chained attribute lookup code
# fails to find 'gobject._gobject'. thus we need to pull the module directly out of
@@ -263,80 +235,67 @@
say(name)
sys.stdout.flush()
action("doing nothing")
- outfile = None
+
try:
- try:
- fname = build_output_name(subdir, name)
- action("opening %r", fname)
- outfile = fopen(fname, "w")
- old_modules = list(sys.modules.keys())
- imported_module_names = []
+ fname = build_output_name(subdir, name)
+ action("opening %r", fname)
+ old_modules = list(sys.modules.keys())
+ imported_module_names = []
- class MyFinder:
- #noinspection PyMethodMayBeStatic
- def find_module(self, fullname, path=None):
- if fullname != name:
- imported_module_names.append(fullname)
- return None
+ class MyFinder:
+ #noinspection PyMethodMayBeStatic
+ def find_module(self, fullname, path=None):
+ if fullname != name:
+ imported_module_names.append(fullname)
+ return None
- my_finder = None
- if hasattr(sys, 'meta_path'):
- my_finder = MyFinder()
- sys.meta_path.append(my_finder)
- else:
- imported_module_names = None
+ my_finder = None
+ if hasattr(sys, 'meta_path'):
+ my_finder = MyFinder()
+ sys.meta_path.append(my_finder)
+ else:
+ imported_module_names = None
- action("importing")
- __import__(name) # sys.modules will fill up with what we want
+ action("importing")
+ __import__(name) # sys.modules will fill up with what we want
- if my_finder:
- sys.meta_path.remove(my_finder)
- if imported_module_names is None:
- imported_module_names = [m for m in sys.modules.keys() if m not in old_modules]
+ if my_finder:
+ sys.meta_path.remove(my_finder)
+ if imported_module_names is None:
+ imported_module_names = [m for m in sys.modules.keys() if m not in old_modules]
- redo_module(name, outfile, mod_file_name, doing_builtins)
- # The C library may have called Py_InitModule() multiple times to define several modules (gtk._gtk and gtk.gdk);
- # restore all of them
- path = name.split(".")
- redo_imports = not ".".join(path[:-1]) in MODULES_INSPECT_DIR
- if imported_module_names and redo_imports:
- for m in sys.modules.keys():
- action("looking at possible submodule %r", m)
- # if module has __file__ defined, it has Python source code and doesn't need a skeleton
- if m not in old_modules and m not in imported_module_names and m != name and not hasattr(
- sys.modules[m], '__file__'):
- if not quiet:
- say(m)
- sys.stdout.flush()
- fname = build_output_name(subdir, m)
- action("opening %r", fname)
- subfile = fopen(fname, "w")
- try:
- redo_module(m, subfile, mod_file_name, doing_builtins)
- finally:
- action("closing %r", fname)
- subfile.close()
- except:
- exctype, value = sys.exc_info()[:2]
- msg = "Failed to process %r while %s: %s"
- args = name, CURRENT_ACTION, str(value)
- report(msg, *args)
- if outfile is not None and not outfile.closed:
- outfile.write("# encoding: %s\n" % OUT_ENCODING)
- outfile.write("# module %s\n" % name)
- outfile.write("# from %s\n" % mod_file_name)
- outfile.write("# by generator %s\n" % VERSION)
- outfile.write("\n\n")
- outfile.write("# Skeleton generation error:\n#\n# " + (msg % args) + "\n")
- if debug_mode:
- if sys.platform == 'cli':
- import traceback
- traceback.print_exc(file=sys.stderr)
- raise
- return False
- finally:
- if outfile is not None and not outfile.closed:
- outfile.close()
+ redo_module(name, fname, mod_file_name, doing_builtins)
+ # The C library may have called Py_InitModule() multiple times to define several modules (gtk._gtk and gtk.gdk);
+ # restore all of them
+ path = name.split(".")
+ redo_imports = not ".".join(path[:-1]) in MODULES_INSPECT_DIR
+ if imported_module_names and redo_imports:
+ for m in sys.modules.keys():
+ if m.startswith("pycharm_generator_utils"): continue
+ action("looking at possible submodule %r", m)
+ # if module has __file__ defined, it has Python source code and doesn't need a skeleton
+ if m not in old_modules and m not in imported_module_names and m != name and not hasattr(
+ sys.modules[m], '__file__'):
+ if not quiet:
+ say(m)
+ sys.stdout.flush()
+ fname = build_output_name(subdir, m)
+ action("opening %r", fname)
+ try:
+ redo_module(m, fname, mod_file_name, doing_builtins)
+ finally:
+ action("closing %r", fname)
+ except:
+ exctype, value = sys.exc_info()[:2]
+ msg = "Failed to process %r while %s: %s"
+ args = name, CURRENT_ACTION, str(value)
+ report(msg, *args)
+ if debug_mode:
+ if sys.platform == 'cli':
+ import traceback
+ traceback.print_exc(file=sys.stderr)
+ raise
+ return False
return True
diff --git a/python/helpers/pycharm/nose_utils.py b/python/helpers/pycharm/nose_utils.py
index bed318a..9a6d682 100644
--- a/python/helpers/pycharm/nose_utils.py
+++ b/python/helpers/pycharm/nose_utils.py
@@ -1,9 +1,13 @@
-from tcmessages import TeamcityServiceMessages
-import sys, traceback, datetime
+import sys
+import traceback
+import datetime
import unittest
+
+from tcmessages import TeamcityServiceMessages
from tcunittest import strclass
from tcunittest import TeamcityTestResult
+
try:
from nose.util import isclass # backwards compat
from nose.config import Config
@@ -59,7 +63,10 @@
def formatErr(self, err):
exctype, value, tb = err
if isinstance(value, str):
- value = exctype(value)
+ try:
+ value = exctype(value)
+ except TypeError:
+ pass
return ''.join(traceback.format_exception(exctype, value, tb))
def is_gen(self, test):
diff --git a/python/helpers/pycharm_generator_utils/constants.py b/python/helpers/pycharm_generator_utils/constants.py
index 6b77e73..4ea8cf1 100644
--- a/python/helpers/pycharm_generator_utils/constants.py
+++ b/python/helpers/pycharm_generator_utils/constants.py
@@ -6,7 +6,7 @@
import time
-VERSION = "1.131"
+VERSION = "1.133"
OUT_ENCODING = 'utf-8'
diff --git a/python/helpers/pycharm_generator_utils/module_redeclarator.py b/python/helpers/pycharm_generator_utils/module_redeclarator.py
index f56fb43..8377879 100644
--- a/python/helpers/pycharm_generator_utils/module_redeclarator.py
+++ b/python/helpers/pycharm_generator_utils/module_redeclarator.py
@@ -1,6 +1,7 @@
+import keyword
+
from pycharm_generator_utils.util_methods import *
from pycharm_generator_utils.constants import *
-import keyword, re
class emptylistdict(dict):
@@ -49,6 +50,11 @@
return len(self.data) == 0
+class ClassBuf(Buf):
+ def __init__(self, name, indenter):
+ super(ClassBuf, self).__init__(indenter)
+ self.name = name
+
#noinspection PyUnresolvedReferences,PyBroadException
class ModuleRedeclarator(object):
def __init__(self, module, outfile, mod_filename, indent_size=4, doing_builtins=False):
@@ -67,6 +73,7 @@
self.imports_buf = Buf(self)
self.functions_buf = Buf(self)
self.classes_buf = Buf(self)
+ self.classes_buffs = list()
self.footer_buf = Buf(self)
self.indent_size = indent_size
self._indent_step = " " * self.indent_size
@@ -106,8 +113,43 @@
return self._indent_step * level
def flush(self):
- for buf in (self.header_buf, self.imports_buf, self.functions_buf, self.classes_buf, self.footer_buf):
- buf.flush(self.outfile)
+ init = None
+ try:
+ if self.mod_filename and len(self.classes_buffs) >= 30:
+ mod_path = self.outfile.strip(".py")
+
+ fname = build_output_name(mod_path, "__init__")
+ init = fopen(fname, "w")
+ for buf in (self.header_buf, self.imports_buf, self.functions_buf, self.classes_buf):
+ buf.flush(init)
+
+ data = ""
+ for buf in self.classes_buffs:
+ fname = build_output_name(mod_path, buf.name)
+ dummy = fopen(fname, "w")
+ self.header_buf.flush(dummy)
+ buf.flush(dummy)
+ data += "from "
+ if version[0] >= 3:
+ data += "."
+ data += buf.name + " import " + buf.name + "\n"
+ dummy.close()
+
+ init.write(data)
+ self.footer_buf.flush(init)
+ else:
+ init = fopen(self.outfile, "w")
+ for buf in (self.header_buf, self.imports_buf, self.functions_buf, self.classes_buf):
+ buf.flush(init)
+
+ for buf in self.classes_buffs:
+ buf.flush(init)
+
+ self.footer_buf.flush(init)
+
+ finally:
+ if init is not None and not init.closed:
+ init.close()
# Some builtin classes effectively change __init__ signature without overriding it.
# This callable serves as a placeholder to be replaced via REDEFINED_BUILTIN_SIGS
@@ -150,7 +192,7 @@
for initializer_type, r in self._initializers:
if initializer_type == a_type:
return r
- # NOTE: here we could handle things like defaultdict, sets, etc if we wanted
+ # NOTE: here we could handle things like defaultdict, sets, etc if we wanted
return "None"
@@ -224,7 +266,7 @@
seen_values.append(value)
if isinstance(k, SIMPLEST_TYPES):
self.fmt_value(out, value, indent + 1, prefix=repr(k) + ": ", postfix=",",
- seen_values=seen_values)
+ seen_values=seen_values)
else:
# both key and value need fancy formatting
self.fmt_value(out, k, indent + 1, postfix=": ", seen_values=seen_values)
@@ -244,9 +286,15 @@
if self._defined.get(found_name, False):
out(indent, prefix, found_name, postfix)
else:
- # a forward / circular declaration happens
+ # a forward / circular declaration happens
notice = ""
- real_value = cleanup(repr(p_value))
+ try:
+ representation = repr(p_value)
+ except Exception:
+ import traceback
+ traceback.print_exc(file=sys.stderr)
+ return
+ real_value = cleanup(representation)
if found_name:
if found_name == as_name:
notice = " # (!) real value is %r" % real_value
@@ -409,7 +457,7 @@
def is_predefined_builtin(self, module_name, class_name, func_name):
return self.doing_builtins and module_name == BUILTIN_MOD_NAME and (
- class_name, func_name) in PREDEFINED_BUILTIN_SIGS
+ class_name, func_name) in PREDEFINED_BUILTIN_SIGS
def redo_function(self, out, p_func, p_name, indent, p_class=None, p_modname=None, classname=None, seen=None):
@@ -434,7 +482,7 @@
return
else:
seen[id(p_func)] = p_name
- # real work
+ # real work
if classname is None:
classname = p_class and p_class.__name__ or None
if p_class and hasattr(p_class, '__mro__'):
@@ -492,7 +540,7 @@
out(indent, "def ", p_name, sig, ": # known case of ", ofwhat)
out_doc_attr(out, p_func, indent + 1, p_class)
else:
- # __doc__ is our best source of arglist
+ # __doc__ is our best source of arglist
sig_note = "real signature unknown"
spec = ""
is_init = (p_name == "__init__" and p_class is not None)
@@ -508,17 +556,17 @@
action("parsing doc of func %r of class %r", p_name, p_class)
if isinstance(funcdoc, STR_TYPES):
(spec, ret_literal, more_notes) = self.parse_func_doc(funcdoc, p_name, p_name, classname, deco,
- sip_generated)
+ sip_generated)
if spec is None and p_name == '__init__' and classname:
(spec, ret_literal, more_notes) = self.parse_func_doc(funcdoc, classname, p_name, classname, deco,
- sip_generated)
+ sip_generated)
sig_restored = spec is not None
if more_notes:
if sig_note:
sig_note += "; "
sig_note += more_notes
if not sig_restored:
- # use an allow-all declaration
+ # use an allow-all declaration
decl = []
if p_class:
first_param = propose_first_param(deco)
@@ -531,7 +579,7 @@
# to reduce size of stubs, don't output same docstring twice for class and its __init__ method
if not is_init or funcdoc != p_class.__doc__:
out_docstring(out, funcdoc, indent + 1)
- # body
+ # body
if ret_literal and not is_init:
out(indent + 1, "return ", ret_literal)
else:
@@ -646,7 +694,7 @@
self.redo_function(out, item, item_name, indent + 1, p_class, p_modname, classname=p_name, seen=seen_funcs)
except:
handle_error_func(item_name, out)
- #
+ #
known_props = KNOWN_PROPS.get(p_modname, {})
a_setter = "lambda self, v: None"
a_deleter = "lambda self: None"
@@ -782,7 +830,7 @@
for item_name in module_dict:
note("looking at %s", item_name)
if item_name in (
- "__dict__", "__doc__", "__module__", "__file__", "__name__", "__builtins__", "__package__"):
+ "__dict__", "__doc__", "__module__", "__file__", "__name__", "__builtins__", "__package__"):
continue # handled otherwise
try:
item = getattr(self.module, item_name) # let getters do the magic
@@ -806,7 +854,7 @@
mod_name = getattr(item, '__module__', None)
except:
pass
- # we assume that module foo.bar never imports foo; foo may import foo.bar. (see pygame and pygame.rect)
+ # we assume that module foo.bar never imports foo; foo may import foo.bar. (see pygame and pygame.rect)
maybe_import_mod_name = mod_name or ""
import_is_from_top = len(p_name) > len(maybe_import_mod_name) and p_name.startswith(maybe_import_mod_name)
note("mod_name = %s, prospective = %s, from top = %s", mod_name, maybe_import_mod_name, import_is_from_top)
@@ -906,9 +954,8 @@
self.functions_buf.out(0, "# no functions")
#
if classes:
- out = self.functions_buf.out
- out(0, "# classes")
- out(0, "")
+ self.classes_buf.out(0, "# classes")
+ self.classes_buf.out(0, "")
seen_classes = {}
# sort classes so that inheritance order is preserved
cls_list = [] # items are (class_name, mro_tuple)
@@ -922,6 +969,9 @@
break # ...and need not go fartehr than first known child
cls_list.insert(ins_index, (cls_name, get_mro(cls)))
for item_name in [cls_item[0] for cls_item in cls_list]:
+ buf = ClassBuf(item_name, self)
+ self.classes_buffs.append(buf)
+ out = buf.out
if item_name in omitted_names:
out(0, "# definition of ", item_name, " omitted")
continue
@@ -974,7 +1024,7 @@
self.footer_buf.out(0, "# intermittent names")
for value in values_to_add:
self.footer_buf.out(0, value)
- # imports: last, because previous parts could alter used_imports or hidden_imports
+ # imports: last, because previous parts could alter used_imports or hidden_imports
self.output_import_froms()
if self.imports_buf.isEmpty():
self.imports_buf.out(0, "# no imports")
@@ -1009,7 +1059,7 @@
names_pack.append(n)
names_pack.append(", ")
right_pos += (len_n + 2)
- # last line is...
+ # last line is...
if indent_level == 0: # one line
names_pack[0] = names_pack[0][:-1] # cut off lpar
names_pack[-1] = "" # cut last comma
diff --git a/python/helpers/pycharm_generator_utils/util_methods.py b/python/helpers/pycharm_generator_utils/util_methods.py
index 8d6d356..2ddbc94 100644
--- a/python/helpers/pycharm_generator_utils/util_methods.py
+++ b/python/helpers/pycharm_generator_utils/util_methods.py
@@ -6,7 +6,7 @@
inspect = None
def create_named_tuple(): #TODO: user-skeleton
- return """
+ return """
class __namedtuple(tuple):
'''A mock base class for named tuples.'''
@@ -38,12 +38,12 @@
"""
def create_generator():
- # Fake <type 'generator'>
- if version[0] < 3:
- next_name = "next"
- else:
- next_name = "__next__"
- txt = """
+ # Fake <type 'generator'>
+ if version[0] < 3:
+ next_name = "next"
+ else:
+ next_name = "__next__"
+ txt = """
class __generator(object):
'''A mock class representing the generator function type.'''
def __init__(self):
@@ -59,8 +59,8 @@
'''Return the next item from the container.'''
pass
""" % (next_name,)
- if version[0] >= 3 or (version[0] == 2 and version[1] >= 5):
- txt += """
+ if version[0] >= 3 or (version[0] == 2 and version[1] >= 5):
+ txt += """
def close(self):
'''Raises new GeneratorExit exception inside the generator to terminate the iteration.'''
pass
@@ -73,10 +73,10 @@
'''Used to raise an exception inside the generator.'''
pass
"""
- return txt
+ return txt
def _searchbases(cls, accum):
-# logic copied from inspect.py
+ # logic copied from inspect.py
if cls not in accum:
accum.append(cls)
for x in cls.__bases__:
@@ -84,7 +84,7 @@
def get_mro(a_class):
-# logic copied from inspect.py
+ # logic copied from inspect.py
"""Returns a tuple of MRO classes."""
if hasattr(a_class, "__mro__"):
return a_class.__mro__
@@ -236,7 +236,7 @@
if toplevel and not has_item_starting_with(ret, "*"):
ret.append("*more")
else:
- # we're in a "foo, (bar1, bar2, ...)"; make it "foo, bar_tuple"
+ # we're in a "foo, (bar1, bar2, ...)"; make it "foo, bar_tuple"
return extract_alpha_prefix(results[0][1]) + "_tuple"
else: # just name
ret.append(sanitize_ident(token_name, is_clr))
@@ -271,7 +271,7 @@
if len(token) == 3: # name with value; little sense, but can happen in a deeply nested optional
ret.append(sanitize_ident(token_name, is_clr) + "=" + sanitize_value(token[2]))
elif token_name == '...':
- # we're in a "foo, [bar, ...]"; make it "foo, *bar"
+ # we're in a "foo, [bar, ...]"; make it "foo, *bar"
return ["*" + extract_alpha_prefix(
results[1][1])] # we must return a seq; [1] is first simple, [1][1] is its name
else: # just name
@@ -531,7 +531,7 @@
if not methods:
bases = p_class.__bases__
if len(bases) == 1 and p_name in dir(bases[0]):
- # skip inherited methods
+ # skip inherited methods
return None, None
return p_name + '(*args)', 'cannot find CLR method'
@@ -542,3 +542,31 @@
if not methods[0].IsStatic:
params = ['self'] + params
return build_signature(p_name, params), None
+
+def build_output_name(dirname, qualified_name):
+ qualifiers = qualified_name.split(".")
+ if dirname and not dirname.endswith("/") and not dirname.endswith("\\"):
+ dirname += os.path.sep # "a -> a/"
+ for pathindex in range(len(qualifiers) - 1): # create dirs for all qualifiers but last
+ subdirname = dirname + os.path.sep.join(qualifiers[0: pathindex + 1])
+ if not os.path.isdir(subdirname):
+ action("creating subdir %r", subdirname)
+ os.makedirs(subdirname)
+ init_py = os.path.join(subdirname, "__init__.py")
+ if os.path.isfile(subdirname + ".py"):
+ os.rename(subdirname + ".py", init_py)
+ elif not os.path.isfile(init_py):
+ init = fopen(init_py, "w")
+ init.close()
+ target_name = dirname + os.path.sep.join(qualifiers)
+ if os.path.isdir(target_name):
+ fname = os.path.join(target_name, "__init__.py")
+ else:
+ fname = target_name + ".py"
+
+ dirname = os.path.dirname(fname)
+
+ if not os.path.isdir(dirname):
+ os.makedirs(dirname)
+
+ return fname
diff --git a/python/helpers/tools/stdlib_packages.txt b/python/helpers/tools/stdlib_packages.txt
index 619651e..2ee4b5d 100644
--- a/python/helpers/tools/stdlib_packages.txt
+++ b/python/helpers/tools/stdlib_packages.txt
@@ -6,6 +6,7 @@
array
ast
asynchat
+asyncio
asyncore
atexit
audiodev
@@ -68,6 +69,8 @@
dummy_threading
email
encodings
+ensurepip
+enum
errno
exceptions
fcntl
@@ -150,6 +153,7 @@
os2emxpath
ossaudiodev
parser
+pathlib
pdb
pickle
pickletools
@@ -194,6 +198,7 @@
runpy
sched
select
+selectors
sets
sgmllib
sha
@@ -219,6 +224,7 @@
ssl
stat
statcache
+statistics
statvfs
string
StringIO
@@ -254,6 +260,7 @@
tokenize
trace
traceback
+tracemalloc
tty
turtle
turtledemo