code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
[
8,
0,
0.3191,
0.0213,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.3617,
0.0213,
0,
0.66,
0.25,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.4255,
0.0213,
0,
0.66,
... | [
"\"\"\"Utility for Sending notifications.\"\"\"",
"__author__ = 'Abhinav Khandelwal (abhinavk@google.com)'",
"from google.appengine.api import mail",
"from google.appengine.api import users",
"class EmailManager(object):\n \"\"\"Notification Manager. Sends emails out.\"\"\"\n\n def __init__(self, cour... |
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
[
8,
0,
0.027,
0.0018,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0306,
0.0018,
0,
0.66,
0.027,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0342,
0.0018,
0,
0.66,
... | [
"\"\"\"Set of converters between db models, Python and JSON dictionaries, etc.\"\"\"",
"__author__ = 'Pavel Simakov (psimakov@google.com)'",
"import datetime",
"import itertools",
"import json",
"import types",
"from xml.etree import ElementTree",
"import transforms_constants",
"import yaml",
"fro... |
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
[
8,
0,
0.0711,
0.0047,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0806,
0.0047,
0,
0.66,
0.0769,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.09,
0.0047,
0,
0.66,
... | [
"\"\"\"Manages mapping of users to roles and roles to privileges.\"\"\"",
"__author__ = 'Pavel Simakov (psimakov@google.com)'",
"import collections",
"import config",
"from common import utils",
"from models import MemcacheManager",
"from models import RoleDAO",
"from google.appengine.api import users... |
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
[
8,
0,
0.0212,
0.0014,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.024,
0.0014,
0,
0.66,
0.0263,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0283,
0.0014,
0,
0.66,
... | [
"\"\"\"Common classes and methods for processing text content.\"\"\"",
"__author__ = 'Pavel Simakov (psimakov@google.com)'",
"from pyparsing import alphas",
"from pyparsing import Combine",
"from pyparsing import Each",
"from pyparsing import Group",
"from pyparsing import Literal",
"from pyparsing im... |
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
[
8,
0,
0.1172,
0.0078,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.1562,
0.0391,
0,
0.66,
0.2,
451,
0,
1,
0,
0,
186,
0,
1
],
[
8,
1,
0.1484,
0.0078,
1,
0.04,
... | [
"\"\"\"Core service interface definitions.\"\"\"",
"class Service(object):\n \"\"\"Abstract base service interface.\"\"\"\n\n def enabled(self):\n raise NotImplementedError()",
" \"\"\"Abstract base service interface.\"\"\"",
" def enabled(self):\n raise NotImplementedError()",
"class Notification... |
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
[
8,
0,
0.0542,
0.0036,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0668,
0.0144,
0,
0.66,
0.1,
777,
0,
0,
0,
0,
0,
5,
0
],
[
1,
0,
0.0794,
0.0036,
0,
0.66,
... | [
"\"\"\"Models and helper utilities for the review workflow.\"\"\"",
"__author__ = [\n 'johncox@google.com (John Cox)',\n 'sll@google.com (Sean Lip)',\n]",
"import entities",
"import transforms",
"import models",
"from google.appengine.ext import db",
"class KeyProperty(db.StringProperty):\n \"\... |
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
[
8,
0,
0.75,
0.05,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.85,
0.05,
0,
0.66,
0.5,
777,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
1,
0.05,
0,
0.66,
1,
615,
... | [
"\"\"\"Messages used in the models.\"\"\"",
"__author__ = 'Boris Roussev (borislavr@google.com)'",
"PEER_MATCHER_NAME = 'Peer'"
] |
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
[
8,
0,
0.7895,
0.0526,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.8947,
0.0526,
0,
0.66,
0.5,
777,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
1,
0.0526,
0,
0.66,
1,... | [
"\"\"\"Constants shared between transforms.py and entity_transforms.py.\"\"\"",
"__author__ = 'Mike Gainer (mgainer@google.com)'",
"SIMPLE_TYPES = (int, long, float, bool, dict, basestring, list)"
] |
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
[
8,
0,
0.0605,
0.004,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0685,
0.004,
0,
0.66,
0.0667,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0766,
0.004,
0,
0.66,
... | [
"\"\"\"Common classes and methods for managing persistent entities.\"\"\"",
"__author__ = 'Pavel Simakov (psimakov@google.com)'",
"from counters import PerfCounter",
"import transforms",
"from google.appengine.ext import db",
"DB_QUERY = PerfCounter(\n 'gcb-models-db-query',\n 'A number of times a q... |
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
[
8,
0,
0.1786,
0.0119,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.2024,
0.0119,
0,
0.66,
0.2,
777,
1,
0,
0,
0,
0,
3,
0
],
[
2,
0,
0.25,
0.0357,
0,
0.66,
... | [
"\"\"\"Manages performance counters of an application and/or its modules.\"\"\"",
"__author__ = 'Pavel Simakov (psimakov@google.com)'",
"def incr_counter_global_value(unused_name, unused_delta):\n \"\"\"Hook method for global aggregation.\"\"\"\n pass",
" \"\"\"Hook method for global aggregation.\"\"... |
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
[
8,
0,
0.1974,
0.0132,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.2237,
0.0132,
0,
0.66,
0.1429,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.25,
0.0132,
0,
0.66,
... | [
"\"\"\"Utility functions common to analytics module.\"\"\"",
"__author__ = 'Mike Gainer (mgainer@google.com)'",
"import os",
"import sys",
"import appengine_config",
"def _generators_for_visualizations(visualizations):\n ret = set()\n for visualization in visualizations:\n ret.update(visualiz... |
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
[
8,
0,
0.0638,
0.0043,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0723,
0.0043,
0,
0.66,
0.0769,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0809,
0.0043,
0,
0.66,... | [
"\"\"\"Module providing visualizations display as HTML/JS.\"\"\"",
"__author__ = 'Mike Gainer (mgainer@google.com)'",
"from common import safe_dom",
"from controllers import utils",
"from models import data_sources",
"from models import jobs",
"from models import transforms",
"from models.analytics im... |
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
[
8,
0,
0.0636,
0.0042,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.072,
0.0042,
0,
0.66,
0.0556,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0805,
0.0042,
0,
0.66,
... | [
"\"\"\"Module providing public analytics interfaces.\"\"\"",
"__author__ = 'Mike Gainer (mgainer@google.com)'",
"import os",
"import re",
"import sys",
"import jinja2",
"import appengine_config",
"from controllers import sites",
"from controllers import utils as controllers_utils",
"from models.an... |
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
[
8,
0,
0.0538,
0.0233,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0698,
0.0029,
0,
0.66,
0.0417,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0756,
0.0029,
0,
0.66,... | [
"\"\"\"Manages dynamic properties of an application and/or its modules.\n\nAn application must explicitly declare properties and provide a type, doc string\nand default value for each. The default property values are overridden by\nthe new values found in the environment variable with the same name. Those are\nfurt... |
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
[
8,
0,
0.0142,
0.0009,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0161,
0.0009,
0,
0.66,
0.0164,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0179,
0.0009,
0,
0.66,... | [
"\"\"\"Handlers that are not directly related to course content.\"\"\"",
"__author__ = 'Saifu Angto (saifu@google.com)'",
"import datetime",
"import gettext",
"import HTMLParser",
"import os",
"import re",
"import urlparse",
"import jinja2",
"import sites",
"import webapp2",
"import appengine_... |
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
[
8,
0,
0.0117,
0.0008,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0132,
0.0008,
0,
0.66,
0.0189,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0148,
0.0008,
0,
0.66,... | [
"\"\"\"Handlers for generating various frontend pages.\"\"\"",
"__author__ = 'Saifu Angto (saifu@google.com)'",
"import copy",
"import datetime",
"import urllib",
"import urlparse",
"from utils import BaseHandler",
"from utils import BaseRESTHandler",
"from utils import CAN_PERSIST_ACTIVITY_EVENTS",... |
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
[
8,
0,
0.0655,
0.0044,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0742,
0.0044,
0,
0.66,
0.0556,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.083,
0.0044,
0,
0.66,
... | [
"\"\"\"Classes and methods to manage all aspects of student assessments.\"\"\"",
"__author__ = 'pgbovine@google.com (Philip Guo)'",
"import datetime",
"import logging",
"from utils import BaseHandler",
"from utils import HUMAN_READABLE_DATETIME_FORMAT",
"from controllers import lessons",
"from models ... |
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
[
8,
0,
0.0711,
0.0047,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0806,
0.0047,
0,
0.66,
0.0476,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.09,
0.0047,
0,
0.66,
... | [
"\"\"\"General utility functions common to all of CourseBuilder.\"\"\"",
"__author__ = 'Mike Gainer (mgainer@google.com)'",
"import cStringIO",
"import random",
"import re",
"import string",
"import sys",
"import zipfile",
"import appengine_config",
"from google.appengine.api import namespace_mana... |
#!/usr/bin/python
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | [
[
8,
0,
0.0733,
0.0043,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0819,
0.0043,
0,
0.66,
0.125,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0905,
0.0043,
0,
0.66,
... | [
"\"\"\"Classes for processing various .yaml files in CourseBuilder installations.\"\"\"",
"__author__ = 'Mike Gainer (mgainer@google.com)'",
"import copy",
"import re",
"import yaml",
"NEWLINE_BEFORE_YAML_SECTIONS = set([\n 'env_variables',\n 'includes',\n 'inbound_services',\n 'builtins',\n ... |
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
[
8,
0,
0.0542,
0.0036,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0614,
0.0036,
0,
0.66,
0.0476,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0686,
0.0036,
0,
0.66,... | [
"\"\"\"Encryption and digest functionality.\"\"\"",
"__author__ = 'Mike Gainer (mgainer@google.com)'",
"import base64",
"import hashlib",
"import hmac",
"import os",
"import random",
"import time",
"from Crypto.Cipher import AES",
"import appengine_config",
"from common import utils",
"from mo... |
# -*- coding: utf-8; -*-
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | [
[
8,
0,
0.1127,
0.007,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.1268,
0.007,
0,
0.66,
0.125,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.1408,
0.007,
0,
0.66,
... | [
"\"\"\"Functions used for Course Builder locale support.\"\"\"",
"__author__ = 'John Orr (jorr@google.com)'",
"import logging",
"import os",
"import appengine_config",
"LOCALES_DISPLAY_NAMES = {\n 'af': u'Afrikaans (af)',\n 'am': u'አማርኛ (am)',\n 'ar': u'العربية (ar)',\n 'bg': u'български (bg)'... |
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
[
8,
0,
0.0806,
0.0054,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0914,
0.0054,
0,
0.66,
0.0385,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.1022,
0.0054,
0,
0.66,... | [
"\"\"\"Custom Jinja2 filters used in Course Builder.\"\"\"",
"__author__ = 'John Orr (jorr@google.com)'",
"import sys",
"import traceback",
"import jinja2",
"import safe_dom",
"import tags",
"from webapp2_extras import i18n",
"import appengine_config",
"from common import caching",
"from models ... |
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
[
8,
0,
0.0229,
0.0015,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.026,
0.0015,
0,
0.66,
0.0769,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.029,
0.0015,
0,
0.66,
... | [
"\"\"\"Mapping from schema to backend properties.\"\"\"",
"__author__ = 'Abhinav Khandelwal (abhinavk@google.com)'",
"import collections",
"import copy",
"import json",
"class Property(object):\n \"\"\"Property.\"\"\"\n\n def __init__(\n self, name, label, property_type, select_data=None, des... |
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
[
8,
0,
0.12,
0.008,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.136,
0.008,
0,
0.66,
0.1111,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.152,
0.008,
0,
0.66,
0.... | [
"\"\"\"Module providing simplistic logger.\"\"\"",
"__author__ = 'Mike Gainer (mgainer@google.com)'",
"import datetime",
"import traceback",
"import appengine_config",
"_LOG_DATE_FORMAT = '%Y-%m-%dT%H:%M:%S.%f'",
"_CRITICAL = 'critical'",
"_WARNING = 'warning'",
"_INFO = 'info'",
"class CatchAndLo... |
"""Classes to build sanitized HTML."""
__author__ = 'John Orr (jorr@google.com)'
import cgi
import re
def escape(strg):
return cgi.escape(strg, quote=1).replace("'", ''').replace('`', '`')
class Node(object):
"""Base class for the sanitizing module."""
def __init__(self):
self._parent... | [
[
8,
0,
0.0033,
0.0033,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0099,
0.0033,
0,
0.66,
0.0833,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0165,
0.0033,
0,
0.66,... | [
"\"\"\"Classes to build sanitized HTML.\"\"\"",
"__author__ = 'John Orr (jorr@google.com)'",
"import cgi",
"import re",
"def escape(strg):\n return cgi.escape(strg, quote=1).replace(\"'\", ''').replace('`', '`')",
" return cgi.escape(strg, quote=1).replace(\"'\", ''').replace('`', '`... |
# -*- coding: utf-8 -*-
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | [
[
8,
0,
0.024,
0.0368,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0429,
0.0004,
0,
0.66,
0.0244,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.044,
0.0004,
0,
0.66,
... | [
"\"\"\"HTML content transformation and manipulation functions.\n\nAbout\n\n This module performs complex HTML document transformations, which enable\n machine-assisted internationalization (I18N) of content.",
"__author__ = 'Pavel Simakov (psimakov@google.com)'",
"import difflib",
"import htmlentitydefs... |
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
[
8,
0,
0.0275,
0.0018,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0311,
0.0018,
0,
0.66,
0.0435,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0366,
0.0018,
0,
0.66,... | [
"\"\"\"Helper classes to implement caching.\"\"\"",
"__author__ = 'Pavel Simakov (psimakov@google.com)'",
"import collections",
"import datetime",
"import logging",
"import sys",
"import threading",
"import unittest",
"import appengine_config",
"from models.counters import PerfCounter",
"def ite... |
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
[
8,
0,
0.034,
0.0023,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0385,
0.0023,
0,
0.66,
0.0417,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0454,
0.0023,
0,
0.66,
... | [
"\"\"\"Handlers for custom HTML tags.\"\"\"",
"__author__ = 'John Orr (jorr@google.com)'",
"import logging",
"import mimetypes",
"import os",
"from xml.etree import cElementTree",
"import html5lib",
"import safe_dom",
"import webapp2",
"import appengine_config",
"from common import schema_fields... |
# -*- coding: utf-8 -*-
#
# Copyright © 2009-2010 Pierre Raybaut
# Licensed under the terms of the MIT License
# (see spyderlib/__init__.py for details)
from guidata.gettext_helpers import do_compile
if __name__ == "__main__":
do_compile("spyderlib")
do_compile("p_pylint", "spyderplugins")
do_c... | [
[
1,
0,
0.5833,
0.0833,
0,
0.66,
0,
814,
0,
1,
0,
0,
814,
0,
0
],
[
4,
0,
0.875,
0.3333,
0,
0.66,
1,
0,
0,
0,
0,
0,
0,
0,
3
],
[
8,
1,
0.8333,
0.0833,
1,
0.25,
... | [
"from guidata.gettext_helpers import do_compile",
"if __name__ == \"__main__\":\n do_compile(\"spyderlib\")\n do_compile(\"p_pylint\", \"spyderplugins\")\n do_compile(\"p_profiler\", \"spyderplugins\")",
" do_compile(\"spyderlib\")",
" do_compile(\"p_pylint\", \"spyderplugins\")",
" do_com... |
import rope.base.evaluate
from rope.base import change, pyobjects, exceptions, pynames, worder, codeanalyze
from rope.refactor import sourceutils, importutils, functionutils, suites
def create_generate(kind, project, resource, offset):
"""A factory for creating `Generate` objects
`kind` can be 'variable', 'f... | [
[
1,
0,
0.0028,
0.0028,
0,
0.66,
0,
790,
0,
1,
0,
0,
790,
0,
0
],
[
1,
0,
0.0056,
0.0028,
0,
0.66,
0.0714,
632,
0,
6,
0,
0,
632,
0,
0
],
[
1,
0,
0.0085,
0.0028,
0,
... | [
"import rope.base.evaluate",
"from rope.base import change, pyobjects, exceptions, pynames, worder, codeanalyze",
"from rope.refactor import sourceutils, importutils, functionutils, suites",
"def create_generate(kind, project, resource, offset):\n \"\"\"A factory for creating `Generate` objects\n\n `kin... |
"""Fix the name of modules
This module is useful when you want to rename many of the modules in
your project. That can happen specially when you want to change their
naming style.
For instance::
fixer = FixModuleNames(project)
changes = fixer.get_changes(fixer=str.lower)
project.do(changes)
Here it renames a... | [
[
8,
0,
0.1304,
0.2464,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2609,
0.0145,
0,
0.66,
0.25,
632,
0,
2,
0,
0,
632,
0,
0
],
[
1,
0,
0.2754,
0.0145,
0,
0.66,
... | [
"\"\"\"Fix the name of modules\n\nThis module is useful when you want to rename many of the modules in\nyour project. That can happen specially when you want to change their\nnaming style.\n\nFor instance::",
"from rope.base import change, taskhandle",
"from rope.contrib import changestack",
"from rope.refac... |
import rope.base.codeanalyze
import rope.base.evaluate
import rope.base.pyobjects
from rope.base import taskhandle, exceptions, worder
from rope.contrib import fixsyntax
from rope.refactor import occurrences
def find_occurrences(project, resource, offset, unsure=False, resources=None,
in_hierarch... | [
[
1,
0,
0.0091,
0.0091,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
1,
0,
0.0182,
0.0091,
0,
0.66,
0.1,
790,
0,
1,
0,
0,
790,
0,
0
],
[
1,
0,
0.0273,
0.0091,
0,
0.6... | [
"import rope.base.codeanalyze",
"import rope.base.evaluate",
"import rope.base.pyobjects",
"from rope.base import taskhandle, exceptions, worder",
"from rope.contrib import fixsyntax",
"from rope.refactor import occurrences",
"def find_occurrences(project, resource, offset, unsure=False, resources=None,... |
"""For performing many refactorings as a single command
`changestack` module can be used to perform many refactorings on top
of each other as one bigger command. It can be used like::
stack = ChangeStack(project, 'my big command')
#..
stack.push(refactoring1.get_changes())
#..
stack.push(refactoring2.get_... | [
[
8,
0,
0.1923,
0.3654,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.4038,
0.0192,
0,
0.66,
0.5,
632,
0,
1,
0,
0,
632,
0,
0
],
[
3,
0,
0.7308,
0.5577,
0,
0.66,
... | [
"\"\"\"For performing many refactorings as a single command\n\n`changestack` module can be used to perform many refactorings on top\nof each other as one bigger command. It can be used like::\n\n stack = ChangeStack(project, 'my big command')\n\n #..",
"from rope.base import change",
"class ChangeStack(objec... |
import re
from rope.base import (exceptions, pynames, resourceobserver,
taskhandle, pyobjects, builtins, resources)
from rope.refactor import importutils
class AutoImport(object):
"""A class for finding the module that provides a name
This class maintains a cache of global names in py... | [
[
1,
0,
0.0046,
0.0046,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0161,
0.0092,
0,
0.66,
0.25,
632,
0,
7,
0,
0,
632,
0,
0
],
[
1,
0,
0.023,
0.0046,
0,
0.6... | [
"import re",
"from rope.base import (exceptions, pynames, resourceobserver,\n taskhandle, pyobjects, builtins, resources)",
"from rope.refactor import importutils",
"class AutoImport(object):\n \"\"\"A class for finding the module that provides a name\n\n This class maintains a cac... |
"""Finding bad name and attribute accesses
`find_errors` function can be used to find possible bad name and
attribute accesses. As an example::
errors = find_errors(project, project.get_resource('mod.py'))
for error in errors:
print '%s: %s' % (error.lineno, error.error)
prints possible errors for ``mod.p... | [
[
8,
0,
0.1429,
0.2747,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2857,
0.011,
0,
0.66,
0.25,
632,
0,
3,
0,
0,
632,
0,
0
],
[
2,
0,
0.3626,
0.0989,
0,
0.66,
... | [
"\"\"\"Finding bad name and attribute accesses\n\n`find_errors` function can be used to find possible bad name and\nattribute accesses. As an example::\n\n errors = find_errors(project, project.get_resource('mod.py'))\n for error in errors:\n print '%s: %s' % (error.lineno, error.error)",
"from rope.base ... |
"""rope IDE tools package
This package contains modules that can be used in IDEs
but do not depend on the UI. So these modules will be used
by `rope.ui` modules.
"""
| [
[
8,
0,
0.5714,
1,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
]
] | [
"\"\"\"rope IDE tools package\n\nThis package contains modules that can be used in IDEs\nbut do not depend on the UI. So these modules will be used\nby `rope.ui` modules.\n\n\"\"\""
] |
"""Provides classes for persisting `PyObject`\s"""
import os
import re
import rope.base.builtins
from rope.base import exceptions
class PyObjectToTextual(object):
"""For transforming `PyObject` to textual form
This can be used for storing `PyObjects` in files. Use
`TextualToPyObject` for converting bac... | [
[
8,
0,
0.0035,
0.0035,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.007,
0.0035,
0,
0.66,
0.1429,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0105,
0.0035,
0,
0.66,... | [
"\"\"\"Provides classes for persisting `PyObject`\\s\"\"\"",
"import os",
"import re",
"import rope.base.builtins",
"from rope.base import exceptions",
"class PyObjectToTextual(object):\n \"\"\"For transforming `PyObject` to textual form\n\n This can be used for storing `PyObjects` in files. Use\n ... |
import UserDict
class ObjectDB(object):
def __init__(self, db, validation):
self.db = db
self.validation = validation
self.observers = []
self.files = db.files
def validate_files(self):
for file in list(self.files):
if not self.validation.is_file_valid(fil... | [
[
1,
0,
0.0057,
0.0057,
0,
0.66,
0,
351,
0,
1,
0,
0,
351,
0,
0
],
[
3,
0,
0.2886,
0.5371,
0,
0.66,
0.1429,
130,
0,
16,
0,
0,
186,
0,
39
],
[
2,
1,
0.0457,
0.0286,
1,
... | [
"import UserDict",
"class ObjectDB(object):\n\n def __init__(self, db, validation):\n self.db = db\n self.validation = validation\n self.observers = []\n self.files = db.files",
" def __init__(self, db, validation):\n self.db = db\n self.validation = validation\n ... |
import warnings
from rope.base import exceptions, resourceobserver
from rope.base.oi import objectdb, memorydb, transform
class ObjectInfoManager(object):
"""Stores object information
It uses an instance of `objectdb.ObjectDB` for storing
information.
"""
def __init__(self, project):
s... | [
[
1,
0,
0.0043,
0.0043,
0,
0.66,
0,
358,
0,
1,
0,
0,
358,
0,
0
],
[
1,
0,
0.0129,
0.0043,
0,
0.66,
0.2,
632,
0,
2,
0,
0,
632,
0,
0
],
[
1,
0,
0.0172,
0.0043,
0,
0.6... | [
"import warnings",
"from rope.base import exceptions, resourceobserver",
"from rope.base.oi import objectdb, memorydb, transform",
"class ObjectInfoManager(object):\n \"\"\"Stores object information\n\n It uses an instance of `objectdb.ObjectDB` for storing\n information.\n\n \"\"\"",
" \"\"\... |
"""A module for inferring objects
For more information see the documentation in `rope.base.oi`
package.
"""
import rope.base.builtins
import rope.base.pynames
import rope.base.pyobjects
from rope.base import evaluate, utils, arguments
_ignore_inferred = utils.ignore_exception(
rope.base.pyobjects.IsBeingInferre... | [
[
8,
0,
0.0188,
0.0323,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0376,
0.0054,
0,
0.66,
0.0556,
74,
0,
1,
0,
0,
74,
0,
0
],
[
1,
0,
0.043,
0.0054,
0,
0.66,
... | [
"\"\"\"A module for inferring objects\n\nFor more information see the documentation in `rope.base.oi`\npackage.\n\n\"\"\"",
"import rope.base.builtins",
"import rope.base.pynames",
"import rope.base.pyobjects",
"from rope.base import evaluate, utils, arguments",
"_ignore_inferred = utils.ignore_exception(... |
import rope.base.ast
import rope.base.oi.soi
import rope.base.pynames
from rope.base import pyobjects, evaluate, astutils, arguments
def analyze_module(pycore, pymodule, should_analyze,
search_subscopes, followed_calls):
"""Analyze `pymodule` for static object inference
Analyzes scopes for... | [
[
1,
0,
0.0074,
0.0074,
0,
0.66,
0,
442,
0,
1,
0,
0,
442,
0,
0
],
[
1,
0,
0.0147,
0.0074,
0,
0.66,
0.1429,
666,
0,
1,
0,
0,
666,
0,
0
],
[
1,
0,
0.0221,
0.0074,
0,
... | [
"import rope.base.ast",
"import rope.base.oi.soi",
"import rope.base.pynames",
"from rope.base import pyobjects, evaluate, astutils, arguments",
"def analyze_module(pycore, pymodule, should_analyze,\n search_subscopes, followed_calls):\n \"\"\"Analyze `pymodule` for static object infere... |
"""Rope object analysis and inference package
Rope makes some simplifying assumptions about a python program. It
assumes that a program only performs assignments and function calls.
Tracking assignments is simple and `PyName` objects handle that. The
main problem is function calls. Rope uses these two approaches fo... | [
[
8,
0,
0.5132,
1,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
]
] | [
"\"\"\"Rope object analysis and inference package\n\nRope makes some simplifying assumptions about a python program. It\nassumes that a program only performs assignments and function calls.\nTracking assignments is simple and `PyName` objects handle that. The\nmain problem is function calls. Rope uses these two ... |
from rope.base.oi import objectdb
class MemoryDB(objectdb.FileDict):
def __init__(self, project, persist=None):
self.project = project
self._persist = persist
self.files = self
self._load_files()
self.project.data_files.add_write_hook(self.write)
def _load_files(self)... | [
[
1,
0,
0.0094,
0.0094,
0,
0.66,
0,
897,
0,
1,
0,
0,
897,
0,
0
],
[
3,
0,
0.283,
0.5,
0,
0.66,
0.3333,
835,
0,
11,
0,
0,
28,
0,
8
],
[
2,
1,
0.0802,
0.0566,
1,
0.32... | [
"from rope.base.oi import objectdb",
"class MemoryDB(objectdb.FileDict):\n\n def __init__(self, project, persist=None):\n self.project = project\n self._persist = persist\n self.files = self\n self._load_files()\n self.project.data_files.add_write_hook(self.write)",
" de... |
def __rope_start_everything():
import os
import sys
import socket
import cPickle as pickle
import marshal
import inspect
import types
import threading
class _MessageSender(object):
def send_data(self, data):
pass
class _SocketSender(_MessageSender):
... | [
[
2,
0,
0.4952,
0.9762,
0,
0.66,
0,
940,
0,
0,
1,
0,
0,
0,
83
],
[
1,
1,
0.0143,
0.0048,
1,
0.75,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
1,
0.019,
0.0048,
1,
0.75,
... | [
"def __rope_start_everything():\n import os\n import sys\n import socket\n import cPickle as pickle\n import marshal\n import inspect\n import types",
" import os",
" import sys",
" import socket",
" import cPickle as pickle",
" import marshal",
" import inspect",
... |
import warnings
def saveit(func):
"""A decorator that caches the return value of a function"""
name = '_' + func.__name__
def _wrapper(self, *args, **kwds):
if not hasattr(self, name):
setattr(self, name, func(self, *args, **kwds))
return getattr(self, name)
return _wrappe... | [
[
1,
0,
0.0128,
0.0128,
0,
0.66,
0,
358,
0,
1,
0,
0,
358,
0,
0
],
[
2,
0,
0.1026,
0.1154,
0,
0.66,
0.1429,
877,
0,
1,
1,
0,
0,
0,
4
],
[
8,
1,
0.0641,
0.0128,
1,
0.... | [
"import warnings",
"def saveit(func):\n \"\"\"A decorator that caches the return value of a function\"\"\"\n\n name = '_' + func.__name__\n def _wrapper(self, *args, **kwds):\n if not hasattr(self, name):\n setattr(self, name, func(self, *args, **kwds))\n return getattr(self, nam... |
from rope.base import exceptions, change, taskhandle
class History(object):
"""A class that holds project history"""
def __init__(self, project, maxundos=None):
self.project = project
self._undo_list = []
self._redo_list = []
self._maxundos = maxundos
self._load_histor... | [
[
1,
0,
0.0043,
0.0043,
0,
0.66,
0,
632,
0,
3,
0,
0,
632,
0,
0
],
[
3,
0,
0.4468,
0.8638,
0,
0.66,
0.5,
941,
0,
22,
0,
0,
186,
0,
72
],
[
8,
1,
0.0213,
0.0043,
1,
0... | [
"from rope.base import exceptions, change, taskhandle",
"class History(object):\n \"\"\"A class that holds project history\"\"\"\n\n def __init__(self, project, maxundos=None):\n self.project = project\n self._undo_list = []\n self._redo_list = []\n self._maxundos = maxundos",
... |
"""A few useful functions for using rope as a library"""
import os.path
import rope.base.project
import rope.base.pycore
from rope.base import taskhandle
def path_to_resource(project, path, type=None):
"""Get the resource at path
You only need to specify `type` if `path` does not exist. It can
be eithe... | [
[
8,
0,
0.0154,
0.0154,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0308,
0.0154,
0,
0.66,
0.125,
79,
0,
1,
0,
0,
79,
0,
0
],
[
1,
0,
0.0615,
0.0154,
0,
0.66,
... | [
"\"\"\"A few useful functions for using rope as a library\"\"\"",
"import os.path",
"import rope.base.project",
"import rope.base.pycore",
"from rope.base import taskhandle",
"def path_to_resource(project, path, type=None):\n \"\"\"Get the resource at path\n\n You only need to specify `type` if `pat... |
import os
class ResourceObserver(object):
"""Provides the interface for observing resources
`ResourceObserver`\s can be registered using `Project.
add_observer()`. But most of the time `FilteredResourceObserver`
should be used. `ResourceObserver`\s report all changes passed
to them and they don... | [
[
1,
0,
0.0037,
0.0037,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
3,
0,
0.1107,
0.1956,
0,
0.66,
0.25,
384,
0,
6,
0,
0,
186,
0,
5
],
[
8,
1,
0.0406,
0.048,
1,
0.4... | [
"import os",
"class ResourceObserver(object):\n \"\"\"Provides the interface for observing resources\n\n `ResourceObserver`\\s can be registered using `Project.\n add_observer()`. But most of the time `FilteredResourceObserver`\n should be used. `ResourceObserver`\\s report all changes passed\n t... |
import rope.base.builtins
import rope.base.pynames
import rope.base.pyobjects
from rope.base import ast, astutils, exceptions, pyobjects, arguments, worder
BadIdentifierError = exceptions.BadIdentifierError
def eval_location(pymodule, offset):
"""Find the pyname at the offset"""
return eval_location2(pymodul... | [
[
1,
0,
0.0032,
0.0032,
0,
0.66,
0,
74,
0,
1,
0,
0,
74,
0,
0
],
[
1,
0,
0.0063,
0.0032,
0,
0.66,
0.0769,
903,
0,
1,
0,
0,
903,
0,
0
],
[
1,
0,
0.0095,
0.0032,
0,
0.... | [
"import rope.base.builtins",
"import rope.base.pynames",
"import rope.base.pyobjects",
"from rope.base import ast, astutils, exceptions, pyobjects, arguments, worder",
"BadIdentifierError = exceptions.BadIdentifierError",
"def eval_location(pymodule, offset):\n \"\"\"Find the pyname at the offset\"\"\"... |
import rope.base.pyobjects
from rope.base import exceptions, utils
class PyName(object):
"""References to `PyObject`\s inside python programs"""
def get_object(self):
"""Return the `PyObject` object referenced by this `PyName`"""
def get_definition_location(self):
"""Return a (module, li... | [
[
1,
0,
0.005,
0.005,
0,
0.66,
0,
626,
0,
1,
0,
0,
626,
0,
0
],
[
1,
0,
0.0101,
0.005,
0,
0.66,
0.0769,
632,
0,
2,
0,
0,
632,
0,
0
],
[
3,
0,
0.0427,
0.0402,
0,
0.6... | [
"import rope.base.pyobjects",
"from rope.base import exceptions, utils",
"class PyName(object):\n \"\"\"References to `PyObject`\\s inside python programs\"\"\"\n\n def get_object(self):\n \"\"\"Return the `PyObject` object referenced by this `PyName`\"\"\"\n\n def get_definition_location(self):... |
class RopeError(Exception):
"""Base exception for rope"""
class ResourceNotFoundError(RopeError):
"""Resource not found exception"""
class RefactoringError(RopeError):
"""Errors for performing a refactoring"""
class InterruptedTaskError(RopeError):
"""The task has been interrupted"""
class Histo... | [
[
3,
0,
0.0246,
0.0328,
0,
0.66,
0,
367,
0,
0,
0,
0,
645,
0,
0
],
[
8,
1,
0.0328,
0.0164,
1,
0.29,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.0902,
0.0328,
0,
0.66,
... | [
"class RopeError(Exception):\n \"\"\"Base exception for rope\"\"\"",
" \"\"\"Base exception for rope\"\"\"",
"class ResourceNotFoundError(RopeError):\n \"\"\"Resource not found exception\"\"\"",
" \"\"\"Resource not found exception\"\"\"",
"class RefactoringError(RopeError):\n \"\"\"Errors fo... |
import bisect
import rope.base.simplify
def get_name_at(resource, offset):
source_code = resource.read()
word_finder = Worder(source_code)
return word_finder.get_word_at(offset)
class Worder(object):
"""A class for finding boundaries of words and expressions
Note that in these methods, offset ... | [
[
1,
0,
0.002,
0.002,
0,
0.66,
0,
325,
0,
1,
0,
0,
325,
0,
0
],
[
1,
0,
0.0059,
0.002,
0,
0.66,
0.25,
910,
0,
1,
0,
0,
910,
0,
0
],
[
2,
0,
0.0147,
0.0079,
0,
0.66,... | [
"import bisect",
"import rope.base.simplify",
"def get_name_at(resource, offset):\n source_code = resource.read()\n word_finder = Worder(source_code)\n return word_finder.get_word_at(offset)",
" source_code = resource.read()",
" word_finder = Worder(source_code)",
" return word_finder.ge... |
"""A module to ease code analysis
This module is here to help source code analysis.
"""
import re
from rope.base import codeanalyze, utils
@utils.cached(7)
def real_code(source):
"""Simplify `source` for analysis
It replaces:
* comments with spaces
* strs with a new str filled with spaces
* im... | [
[
8,
0,
0.0455,
0.0727,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0909,
0.0182,
0,
0.66,
0.1667,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.1273,
0.0182,
0,
0.66... | [
"\"\"\"A module to ease code analysis\n\nThis module is here to help source code analysis.\n\"\"\"",
"import re",
"from rope.base import codeanalyze, utils",
"def real_code(source):\n \"\"\"Simplify `source` for analysis\n\n It replaces:\n\n * comments with spaces\n * strs with a new str filled wi... |
import warnings
from rope.base import exceptions
class TaskHandle(object):
def __init__(self, name='Task', interrupts=True):
"""Construct a TaskHandle
If `interrupts` is `False` the task won't be interrupted by
calling `TaskHandle.stop()`.
"""
self.name = name
s... | [
[
1,
0,
0.0075,
0.0075,
0,
0.66,
0,
358,
0,
1,
0,
0,
358,
0,
0
],
[
1,
0,
0.0226,
0.0075,
0,
0.66,
0.2,
632,
0,
1,
0,
0,
632,
0,
0
],
[
3,
0,
0.2293,
0.3759,
0,
0.6... | [
"import warnings",
"from rope.base import exceptions",
"class TaskHandle(object):\n\n def __init__(self, name='Task', interrupts=True):\n \"\"\"Construct a TaskHandle\n\n If `interrupts` is `False` the task won't be interrupted by\n calling `TaskHandle.stop()`.",
" def __init__(self... |
import rope.base.evaluate
from rope.base import ast
class Arguments(object):
"""A class for evaluating parameters passed to a function
You can use the `create_arguments` factory. It handles implicit
first arguments.
"""
def __init__(self, args, scope):
self.args = args
self.sco... | [
[
1,
0,
0.0092,
0.0092,
0,
0.66,
0,
790,
0,
1,
0,
0,
790,
0,
0
],
[
1,
0,
0.0183,
0.0092,
0,
0.66,
0.1667,
632,
0,
1,
0,
0,
632,
0,
0
],
[
3,
0,
0.211,
0.3394,
0,
0... | [
"import rope.base.evaluate",
"from rope.base import ast",
"class Arguments(object):\n \"\"\"A class for evaluating parameters passed to a function\n\n You can use the `create_arguments` factory. It handles implicit\n first arguments.\n\n \"\"\"",
" \"\"\"A class for evaluating parameters passe... |
import cPickle as pickle
import os
import shutil
import sys
import warnings
import rope.base.fscommands
from rope.base import exceptions, taskhandle, prefs, history, pycore, utils
from rope.base.resourceobserver import *
from rope.base.resources import File, Folder, _ResourceMatcher
class _Project(object):
def ... | [
[
1,
0,
0.0023,
0.0023,
0,
0.66,
0,
279,
0,
1,
0,
0,
279,
0,
0
],
[
1,
0,
0.0047,
0.0023,
0,
0.66,
0.0667,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.007,
0.0023,
0,
0... | [
"import cPickle as pickle",
"import os",
"import shutil",
"import sys",
"import warnings",
"import rope.base.fscommands",
"from rope.base import exceptions, taskhandle, prefs, history, pycore, utils",
"from rope.base.resourceobserver import *",
"from rope.base.resources import File, Folder, _Resourc... |
# The default ``config.py``
def set_prefs(prefs):
"""This function is called before opening the project"""
# Specify which files and folders to ignore in the project.
# Changes to ignored resources are not added to the history and
# VCSs. Also they are not returned in `Project.get_files()`.
# No... | [
[
2,
0,
0.4941,
0.9059,
0,
0.66,
0,
770,
0,
1,
0,
0,
0,
0,
0
],
[
8,
1,
0.0588,
0.0118,
1,
0.34,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
1,
0.1941,
0.0235,
1,
0.34,
... | [
"def set_prefs(prefs):\n \"\"\"This function is called before opening the project\"\"\"\n\n # Specify which files and folders to ignore in the project.\n # Changes to ignored resources are not added to the history and\n # VCSs. Also they are not returned in `Project.get_files()`.\n # Note that ``?``... |
"""This module trys to support builtin types and functions."""
import inspect
import rope.base.evaluate
from rope.base import pynames, pyobjects, arguments, utils
class BuiltinModule(pyobjects.AbstractModule):
def __init__(self, name, pycore=None, initial={}):
super(BuiltinModule, self).__init__()
... | [
[
8,
0,
0.0014,
0.0014,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0027,
0.0014,
0,
0.66,
0.0189,
878,
0,
1,
0,
0,
878,
0,
0
],
[
1,
0,
0.0055,
0.0014,
0,
0.66... | [
"\"\"\"This module trys to support builtin types and functions.\"\"\"",
"import inspect",
"import rope.base.evaluate",
"from rope.base import pynames, pyobjects, arguments, utils",
"class BuiltinModule(pyobjects.AbstractModule):\n\n def __init__(self, name, pycore=None, initial={}):\n super(Builti... |
"""Base rope package
This package contains rope core modules that are used by other modules
and packages.
"""
__all__ = ['project', 'libutils', 'exceptions']
| [
[
8,
0,
0.4375,
0.75,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
1,
0.125,
0,
0.66,
1,
272,
0,
0,
0,
0,
0,
5,
0
]
] | [
"\"\"\"Base rope package\n\nThis package contains rope core modules that are used by other modules\nand packages.\n\n\"\"\"",
"__all__ = ['project', 'libutils', 'exceptions']"
] |
from rope.base import ast
def get_name_levels(node):
"""Return a list of ``(name, level)`` tuples for assigned names
The `level` is `None` for simple assignments and is a list of
numbers for tuple assignments for example in::
a, (b, c) = x
The levels for for `a` is ``[0]``, for `b` is ``[1, 0... | [
[
1,
0,
0.0164,
0.0164,
0,
0.66,
0,
632,
0,
1,
0,
0,
632,
0,
0
],
[
2,
0,
0.1803,
0.2459,
0,
0.66,
0.5,
528,
0,
1,
1,
0,
0,
0,
2
],
[
8,
1,
0.1639,
0.1803,
1,
0.14,... | [
"from rope.base import ast",
"def get_name_levels(node):\n \"\"\"Return a list of ``(name, level)`` tuples for assigned names\n\n The `level` is `None` for simple assignments and is a list of\n numbers for tuple assignments for example in::\n\n a, (b, c) = x",
" \"\"\"Return a list of ``(name, ... |
"""Project file system commands.
This modules implements file system operations used by rope. Different
version control systems can be supported by implementing the interface
provided by `FileSystemCommands` class. See `SubversionCommands` and
`MercurialCommands` for example.
"""
import os
import shutil
import subp... | [
[
8,
0,
0.0169,
0.03,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0337,
0.0037,
0,
0.66,
0.0625,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0375,
0.0037,
0,
0.66,
... | [
"\"\"\"Project file system commands.\n\nThis modules implements file system operations used by rope. Different\nversion control systems can be supported by implementing the interface\nprovided by `FileSystemCommands` class. See `SubversionCommands` and\n`MercurialCommands` for example.\n\n\"\"\"",
"import os",
... |
from rope.base.fscommands import _decode_data
from rope.base import ast, exceptions, utils
class PyObject(object):
def __init__(self, type_):
if type_ is None:
type_ = self
self.type = type_
def get_attributes(self):
if self.type is self:
return {}
ret... | [
[
1,
0,
0.0032,
0.0032,
0,
0.66,
0,
851,
0,
1,
0,
0,
851,
0,
0
],
[
1,
0,
0.0064,
0.0032,
0,
0.66,
0.0667,
632,
0,
3,
0,
0,
632,
0,
0
],
[
3,
0,
0.135,
0.2412,
0,
0... | [
"from rope.base.fscommands import _decode_data",
"from rope.base import ast, exceptions, utils",
"class PyObject(object):\n\n def __init__(self, type_):\n if type_ is None:\n type_ = self\n self.type = type_\n\n def get_attributes(self):",
" def __init__(self, type_):\n ... |
import os
import sys
from rope.base import utils
def _stdlib_path():
import inspect
return os.path.dirname(inspect.getsourcefile(inspect))
@utils.cached(1)
def standard_modules():
return python_modules() | dynload_modules()
@utils.cached(1)
def python_modules():
result = set()
lib_path = _stdli... | [
[
1,
0,
0.025,
0.025,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.05,
0.025,
0,
0.66,
0.1667,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.1,
0.025,
0,
0.66,
... | [
"import os",
"import sys",
"from rope.base import utils",
"def _stdlib_path():\n import inspect\n return os.path.dirname(inspect.getsourcefile(inspect))",
" import inspect",
" return os.path.dirname(inspect.getsourcefile(inspect))",
"def standard_modules():\n return python_modules() | dyn... |
import bisect
import difflib
import sys
import warnings
import rope.base.oi.doa
import rope.base.oi.objectinfo
import rope.base.oi.soa
from rope.base import ast, exceptions, taskhandle, utils, stdmods
from rope.base.exceptions import ModuleNotFoundError
from rope.base.pyobjectsdef import PyModule, PyPackage, PyClass
i... | [
[
1,
0,
0.0025,
0.0025,
0,
0.66,
0,
325,
0,
1,
0,
0,
325,
0,
0
],
[
1,
0,
0.0049,
0.0025,
0,
0.66,
0.0588,
866,
0,
1,
0,
0,
866,
0,
0
],
[
1,
0,
0.0074,
0.0025,
0,
... | [
"import bisect",
"import difflib",
"import sys",
"import warnings",
"import rope.base.oi.doa",
"import rope.base.oi.objectinfo",
"import rope.base.oi.soa",
"from rope.base import ast, exceptions, taskhandle, utils, stdmods",
"from rope.base.exceptions import ModuleNotFoundError",
"from rope.base.p... |
import rope.base.builtins
import rope.base.codeanalyze
import rope.base.pynames
from rope.base import ast, exceptions, utils
class Scope(object):
def __init__(self, pycore, pyobject, parent_scope):
self.pycore = pycore
self.pyobject = pyobject
self.parent = parent_scope
def get_names... | [
[
1,
0,
0.0032,
0.0032,
0,
0.66,
0,
74,
0,
1,
0,
0,
74,
0,
0
],
[
1,
0,
0.0064,
0.0032,
0,
0.66,
0.1111,
341,
0,
1,
0,
0,
341,
0,
0
],
[
1,
0,
0.0096,
0.0032,
0,
0.... | [
"import rope.base.builtins",
"import rope.base.codeanalyze",
"import rope.base.pynames",
"from rope.base import ast, exceptions, utils",
"class Scope(object):\n\n def __init__(self, pycore, pyobject, parent_scope):\n self.pycore = pycore\n self.pyobject = pyobject\n self.parent = par... |
import rope.base.oi.soi
from rope.base import pynames
from rope.base.pynames import *
class AssignedName(pynames.AssignedName):
def __init__(self, lineno=None, module=None, pyobject=None):
self.lineno = lineno
self.module = module
self.assignments = []
self.pyobject = _Inferred(se... | [
[
1,
0,
0.0182,
0.0182,
0,
0.66,
0,
666,
0,
1,
0,
0,
666,
0,
0
],
[
1,
0,
0.0364,
0.0182,
0,
0.66,
0.2,
632,
0,
1,
0,
0,
632,
0,
0
],
[
1,
0,
0.0545,
0.0182,
0,
0.6... | [
"import rope.base.oi.soi",
"from rope.base import pynames",
"from rope.base.pynames import *",
"class AssignedName(pynames.AssignedName):\n\n def __init__(self, lineno=None, module=None, pyobject=None):\n self.lineno = lineno\n self.module = module\n self.assignments = []\n self... |
class Prefs(object):
def __init__(self):
self.prefs = {}
self.callbacks = {}
def set(self, key, value):
"""Set the value of `key` preference to `value`."""
if key in self.callbacks:
self.callbacks[key](value)
else:
self.prefs[key] = value
de... | [
[
3,
0,
0.5122,
1,
0,
0.66,
0,
772,
0,
7,
0,
0,
186,
0,
5
],
[
2,
1,
0.0976,
0.0732,
1,
0.81,
0,
555,
0,
1,
0,
0,
0,
0,
0
],
[
14,
2,
0.0976,
0.0244,
2,
0.4,
0,... | [
"class Prefs(object):\n\n def __init__(self):\n self.prefs = {}\n self.callbacks = {}\n\n def set(self, key, value):\n \"\"\"Set the value of `key` preference to `value`.\"\"\"",
" def __init__(self):\n self.prefs = {}\n self.callbacks = {}",
" self.prefs = {}"... |
"""rope, a python refactoring library"""
INFO = __doc__
VERSION = '0.9.3'
COPYRIGHT = """\
Copyright (C) 2006-2010 Ali Gholami Rudi
Copyright (C) 2009-2010 Anton Gritsay
This program is free software; you can redistribute it and/or modify it
under the terms of GNU General Public License as published by the
Free Softw... | [
[
8,
0,
0.0588,
0.0588,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.1765,
0.0588,
0,
0.66,
0.3333,
948,
2,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.2353,
0.0588,
0,
0.66... | [
"\"\"\"rope, a python refactoring library\"\"\"",
"INFO = __doc__",
"VERSION = '0.9.3'",
"COPYRIGHT = \"\"\"\\\nCopyright (C) 2006-2010 Ali Gholami Rudi\nCopyright (C) 2009-2010 Anton Gritsay\n\nThis program is free software; you can redistribute it and/or modify it\nunder the terms of GNU General Public Lice... |
from rope.base import pynames, evaluate, exceptions, worder
from rope.refactor.rename import Rename
class LocalToField(object):
def __init__(self, project, resource, offset):
self.project = project
self.pycore = project.pycore
self.resource = resource
self.offset = offset
def... | [
[
1,
0,
0.02,
0.02,
0,
0.66,
0,
632,
0,
4,
0,
0,
632,
0,
0
],
[
1,
0,
0.04,
0.02,
0,
0.66,
0.5,
151,
0,
1,
0,
0,
151,
0,
0
],
[
3,
0,
0.55,
0.92,
0,
0.66,
1,
... | [
"from rope.base import pynames, evaluate, exceptions, worder",
"from rope.refactor.rename import Rename",
"class LocalToField(object):\n\n def __init__(self, project, resource, offset):\n self.project = project\n self.pycore = project.pycore\n self.resource = resource\n self.offse... |
import re
import rope.base.exceptions
import rope.refactor.functionutils
from rope.base import (pynames, pyobjects, codeanalyze,
taskhandle, evaluate, worder, utils)
from rope.base.change import ChangeSet, ChangeContents
from rope.refactor import (occurrences, rename, sourceutils,
... | [
[
1,
0,
0.0018,
0.0018,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0054,
0.0018,
0,
0.66,
0.0526,
296,
0,
1,
0,
0,
296,
0,
0
],
[
1,
0,
0.0072,
0.0018,
0,
... | [
"import re",
"import rope.base.exceptions",
"import rope.refactor.functionutils",
"from rope.base import (pynames, pyobjects, codeanalyze,\n taskhandle, evaluate, worder, utils)",
"from rope.base.change import ChangeSet, ChangeContents",
"from rope.refactor import (occurrences, renam... |
import rope.refactor.importutils
from rope.base.change import ChangeSet, ChangeContents, MoveResource, CreateFolder
class ModuleToPackage(object):
def __init__(self, project, resource):
self.project = project
self.pycore = project.pycore
self.resource = resource
def get_changes(self)... | [
[
1,
0,
0.0312,
0.0312,
0,
0.66,
0,
488,
0,
1,
0,
0,
488,
0,
0
],
[
1,
0,
0.0625,
0.0312,
0,
0.66,
0.5,
682,
0,
4,
0,
0,
682,
0,
0
],
[
3,
0,
0.5781,
0.875,
0,
0.66... | [
"import rope.refactor.importutils",
"from rope.base.change import ChangeSet, ChangeContents, MoveResource, CreateFolder",
"class ModuleToPackage(object):\n\n def __init__(self, project, resource):\n self.project = project\n self.pycore = project.pycore\n self.resource = resource\n\n d... |
import warnings
from rope.base import exceptions, pyobjects, pynames, taskhandle, evaluate, worder, codeanalyze
from rope.base.change import ChangeSet, ChangeContents, MoveResource
from rope.refactor import occurrences, sourceutils
class Rename(object):
"""A class for performing rename refactoring
It can re... | [
[
1,
0,
0.0046,
0.0046,
0,
0.66,
0,
358,
0,
1,
0,
0,
358,
0,
0
],
[
1,
0,
0.0139,
0.0046,
0,
0.66,
0.1429,
632,
0,
7,
0,
0,
632,
0,
0
],
[
1,
0,
0.0185,
0.0046,
0,
... | [
"import warnings",
"from rope.base import exceptions, pyobjects, pynames, taskhandle, evaluate, worder, codeanalyze",
"from rope.base.change import ChangeSet, ChangeContents, MoveResource",
"from rope.refactor import occurrences, sourceutils",
"class Rename(object):\n \"\"\"A class for performing rename ... |
import rope.base.exceptions
import rope.base.pyobjects
from rope.base import taskhandle, evaluate
from rope.base.change import (ChangeSet, ChangeContents)
from rope.refactor import rename, occurrences, sourceutils, importutils
class IntroduceFactory(object):
def __init__(self, project, resource, offset):
... | [
[
1,
0,
0.0075,
0.0075,
0,
0.66,
0,
296,
0,
1,
0,
0,
296,
0,
0
],
[
1,
0,
0.015,
0.0075,
0,
0.66,
0.1667,
626,
0,
1,
0,
0,
626,
0,
0
],
[
1,
0,
0.0226,
0.0075,
0,
0... | [
"import rope.base.exceptions",
"import rope.base.pyobjects",
"from rope.base import taskhandle, evaluate",
"from rope.base.change import (ChangeSet, ChangeContents)",
"from rope.refactor import rename, occurrences, sourceutils, importutils",
"class IntroduceFactory(object):\n\n def __init__(self, proje... |
import rope.base.change
from rope.base import exceptions, evaluate, worder, codeanalyze
from rope.refactor import functionutils, sourceutils, occurrences
class IntroduceParameter(object):
"""Introduce parameter refactoring
This refactoring adds a new parameter to a function and replaces
references to an ... | [
[
1,
0,
0.0105,
0.0105,
0,
0.66,
0,
682,
0,
1,
0,
0,
682,
0,
0
],
[
1,
0,
0.0211,
0.0105,
0,
0.66,
0.3333,
632,
0,
4,
0,
0,
632,
0,
0
],
[
1,
0,
0.0316,
0.0105,
0,
... | [
"import rope.base.change",
"from rope.base import exceptions, evaluate, worder, codeanalyze",
"from rope.refactor import functionutils, sourceutils, occurrences",
"class IntroduceParameter(object):\n \"\"\"Introduce parameter refactoring\n\n This refactoring adds a new parameter to a function and replac... |
import collections
import re
import warnings
from rope.base import ast, codeanalyze, exceptions
def get_patched_ast(source, sorted_children=False):
"""Adds ``region`` and ``sorted_children`` fields to nodes
Adds ``sorted_children`` field only if `sorted_children` is True.
"""
return patch_ast(ast.p... | [
[
1,
0,
0.0014,
0.0014,
0,
0.66,
0,
193,
0,
1,
0,
0,
193,
0,
0
],
[
1,
0,
0.0027,
0.0014,
0,
0.66,
0.1,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0041,
0.0014,
0,
0.6... | [
"import collections",
"import re",
"import warnings",
"from rope.base import ast, codeanalyze, exceptions",
"def get_patched_ast(source, sorted_children=False):\n \"\"\"Adds ``region`` and ``sorted_children`` fields to nodes\n\n Adds ``sorted_children`` field only if `sorted_children` is True.\n\n ... |
from rope.base import pynames, taskhandle, evaluate, exceptions, worder, utils
from rope.base.change import ChangeSet, ChangeContents
from rope.refactor import sourceutils, occurrences
class EncapsulateField(object):
def __init__(self, project, resource, offset):
self.pycore = project.pycore
self... | [
[
1,
0,
0.005,
0.005,
0,
0.66,
0,
632,
0,
6,
0,
0,
632,
0,
0
],
[
1,
0,
0.0099,
0.005,
0,
0.66,
0.2,
682,
0,
2,
0,
0,
682,
0,
0
],
[
1,
0,
0.0149,
0.005,
0,
0.66,
... | [
"from rope.base import pynames, taskhandle, evaluate, exceptions, worder, utils",
"from rope.base.change import ChangeSet, ChangeContents",
"from rope.refactor import sourceutils, occurrences",
"class EncapsulateField(object):\n\n def __init__(self, project, resource, offset):\n self.pycore = projec... |
import warnings
from rope.base import pyobjects, exceptions, change, evaluate, codeanalyze
from rope.refactor import sourceutils, occurrences, rename
class MethodObject(object):
def __init__(self, project, resource, offset):
self.pycore = project.pycore
this_pymodule = self.pycore.resource_to_py... | [
[
1,
0,
0.0115,
0.0115,
0,
0.66,
0,
358,
0,
1,
0,
0,
358,
0,
0
],
[
1,
0,
0.0345,
0.0115,
0,
0.66,
0.3333,
632,
0,
5,
0,
0,
632,
0,
0
],
[
1,
0,
0.046,
0.0115,
0,
0... | [
"import warnings",
"from rope.base import pyobjects, exceptions, change, evaluate, codeanalyze",
"from rope.refactor import sourceutils, occurrences, rename",
"class MethodObject(object):\n\n def __init__(self, project, resource, offset):\n self.pycore = project.pycore\n this_pymodule = self.... |
import rope.base.exceptions
import rope.base.pyobjects
from rope.base import worder
class DefinitionInfo(object):
def __init__(self, function_name, is_method, args_with_defaults,
args_arg, keywords_arg):
self.function_name = function_name
self.is_method = is_method
self.a... | [
[
1,
0,
0.0047,
0.0047,
0,
0.66,
0,
296,
0,
1,
0,
0,
296,
0,
0
],
[
1,
0,
0.0094,
0.0047,
0,
0.66,
0.1667,
626,
0,
1,
0,
0,
626,
0,
0
],
[
1,
0,
0.0141,
0.0047,
0,
... | [
"import rope.base.exceptions",
"import rope.base.pyobjects",
"from rope.base import worder",
"class DefinitionInfo(object):\n\n def __init__(self, function_name, is_method, args_with_defaults,\n args_arg, keywords_arg):\n self.function_name = function_name\n self.is_method = i... |
from rope.base import ast, evaluate, builtins, pyobjects
from rope.refactor import patchedast, occurrences
class Wildcard(object):
def get_name(self):
"""Return the name of this wildcard"""
def matches(self, suspect, arg):
"""Return `True` if `suspect` matches this wildcard"""
class Suspec... | [
[
1,
0,
0.0057,
0.0057,
0,
0.66,
0,
632,
0,
4,
0,
0,
632,
0,
0
],
[
1,
0,
0.0114,
0.0057,
0,
0.66,
0.1667,
545,
0,
2,
0,
0,
545,
0,
0
],
[
3,
0,
0.0455,
0.0398,
0,
... | [
"from rope.base import ast, evaluate, builtins, pyobjects",
"from rope.refactor import patchedast, occurrences",
"class Wildcard(object):\n\n def get_name(self):\n \"\"\"Return the name of this wildcard\"\"\"\n\n def matches(self, suspect, arg):\n \"\"\"Return `True` if `suspect` matches thi... |
import copy
import rope.base.exceptions
from rope.base import pyobjects, taskhandle, evaluate, worder, codeanalyze, utils
from rope.base.change import ChangeContents, ChangeSet
from rope.refactor import occurrences, functionutils
class ChangeSignature(object):
def __init__(self, project, resource, offset):
... | [
[
1,
0,
0.0029,
0.0029,
0,
0.66,
0,
739,
0,
1,
0,
0,
739,
0,
0
],
[
1,
0,
0.0088,
0.0029,
0,
0.66,
0.0714,
296,
0,
1,
0,
0,
296,
0,
0
],
[
1,
0,
0.0117,
0.0029,
0,
... | [
"import copy",
"import rope.base.exceptions",
"from rope.base import pyobjects, taskhandle, evaluate, worder, codeanalyze, utils",
"from rope.base.change import ChangeContents, ChangeSet",
"from rope.refactor import occurrences, functionutils",
"class ChangeSignature(object):\n\n def __init__(self, pro... |
import warnings
from rope.base import change, taskhandle, builtins, ast, codeanalyze
from rope.refactor import patchedast, similarfinder, sourceutils
from rope.refactor.importutils import module_imports
class Restructure(object):
"""A class to perform python restructurings
A restructuring transforms pieces ... | [
[
1,
0,
0.0033,
0.0033,
0,
0.66,
0,
358,
0,
1,
0,
0,
358,
0,
0
],
[
1,
0,
0.0098,
0.0033,
0,
0.66,
0.1667,
632,
0,
5,
0,
0,
632,
0,
0
],
[
1,
0,
0.013,
0.0033,
0,
0... | [
"import warnings",
"from rope.base import change, taskhandle, builtins, ast, codeanalyze",
"from rope.refactor import patchedast, similarfinder, sourceutils",
"from rope.refactor.importutils import module_imports",
"class Restructure(object):\n \"\"\"A class to perform python restructurings\n\n A rest... |
"""A module containing classes for move refactoring
`create_move()` is a factory for creating move refactoring objects
based on inputs.
"""
from rope.base import pyobjects, codeanalyze, exceptions, pynames, taskhandle, evaluate, worder
from rope.base.change import ChangeSet, ChangeContents, MoveResource
from rope.ref... | [
[
8,
0,
0.0056,
0.0096,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0112,
0.0016,
0,
0.66,
0.0769,
632,
0,
7,
0,
0,
632,
0,
0
],
[
1,
0,
0.0128,
0.0016,
0,
0.66... | [
"\"\"\"A module containing classes for move refactoring\n\n`create_move()` is a factory for creating move refactoring objects\nbased on inputs.\n\n\"\"\"",
"from rope.base import pyobjects, codeanalyze, exceptions, pynames, taskhandle, evaluate, worder",
"from rope.base.change import ChangeSet, ChangeContents, ... |
import re
import rope.base.pynames
from rope.base import pynames, pyobjects, codeanalyze, evaluate, exceptions, utils, worder
class Finder(object):
"""For finding occurrences of a name
The constructor takes a `filters` argument. It should be a list
of functions that take a single argument. For each po... | [
[
1,
0,
0.003,
0.003,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.009,
0.003,
0,
0.66,
0.0714,
903,
0,
1,
0,
0,
903,
0,
0
],
[
1,
0,
0.012,
0.003,
0,
0.66,
... | [
"import re",
"import rope.base.pynames",
"from rope.base import pynames, pyobjects, codeanalyze, evaluate, exceptions, utils, worder",
"class Finder(object):\n \"\"\"For finding occurrences of a name\n\n The constructor takes a `filters` argument. It should be a list\n of functions that take a singl... |
from rope.base import ast
def find_visible(node, lines):
"""Return the line which is visible from all `lines`"""
root = ast_suite_tree(node)
return find_visible_for_suite(root, lines)
def find_visible_for_suite(root, lines):
if len(lines) == 1:
return lines[0]
line1 = lines[0]
line2 ... | [
[
1,
0,
0.007,
0.007,
0,
0.66,
0,
632,
0,
1,
0,
0,
632,
0,
0
],
[
2,
0,
0.0387,
0.0282,
0,
0.66,
0.2,
75,
0,
2,
1,
0,
0,
0,
2
],
[
8,
1,
0.0352,
0.007,
1,
0.6,
... | [
"from rope.base import ast",
"def find_visible(node, lines):\n \"\"\"Return the line which is visible from all `lines`\"\"\"\n root = ast_suite_tree(node)\n return find_visible_for_suite(root, lines)",
" \"\"\"Return the line which is visible from all `lines`\"\"\"",
" root = ast_suite_tree(nod... |
import rope.base.pynames
from rope.base import ast, utils
from rope.refactor.importutils import importinfo
from rope.refactor.importutils import actions
class ModuleImports(object):
def __init__(self, pycore, pymodule, import_filter=None):
self.pycore = pycore
self.pymodule = pymodule
sel... | [
[
1,
0,
0.0022,
0.0022,
0,
0.66,
0,
903,
0,
1,
0,
0,
903,
0,
0
],
[
1,
0,
0.0044,
0.0022,
0,
0.66,
0.1111,
632,
0,
2,
0,
0,
632,
0,
0
],
[
1,
0,
0.0066,
0.0022,
0,
... | [
"import rope.base.pynames",
"from rope.base import ast, utils",
"from rope.refactor.importutils import importinfo",
"from rope.refactor.importutils import actions",
"class ModuleImports(object):\n\n def __init__(self, pycore, pymodule, import_filter=None):\n self.pycore = pycore\n self.pymo... |
import os
import sys
from rope.base import pyobjects, exceptions, stdmods
from rope.refactor import occurrences
from rope.refactor.importutils import importinfo
class ImportInfoVisitor(object):
def dispatch(self, import_):
try:
method_name = 'visit' + import_.import_info.__class__.__name__
... | [
[
1,
0,
0.0028,
0.0028,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0056,
0.0028,
0,
0.66,
0.0667,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0111,
0.0028,
0,
... | [
"import os",
"import sys",
"from rope.base import pyobjects, exceptions, stdmods",
"from rope.refactor import occurrences",
"from rope.refactor.importutils import importinfo",
"class ImportInfoVisitor(object):\n\n def dispatch(self, import_):\n try:\n method_name = 'visit' + import_.i... |
"""A package for handling imports
This package provides tools for modifying module imports after
refactorings or as a separate task.
"""
import rope.base.evaluate
from rope.base.change import ChangeSet, ChangeContents
from rope.refactor import occurrences, rename
from rope.refactor.importutils import module_imports, ... | [
[
8,
0,
0.0117,
0.0201,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0234,
0.0033,
0,
0.66,
0.0909,
790,
0,
1,
0,
0,
790,
0,
0
],
[
1,
0,
0.0268,
0.0033,
0,
0.66... | [
"\"\"\"A package for handling imports\n\nThis package provides tools for modifying module imports after\nrefactorings or as a separate task.\n\n\"\"\"",
"import rope.base.evaluate",
"from rope.base.change import ChangeSet, ChangeContents",
"from rope.refactor import occurrences, rename",
"from rope.refactor... |
class ImportStatement(object):
"""Represent an import in a module
`readonly` attribute controls whether this import can be changed
by import actions or not.
"""
def __init__(self, import_info, start_line, end_line,
main_statement=None, blank_lines=0):
self.start_line = st... | [
[
3,
0,
0.1418,
0.2786,
0,
0.66,
0,
919,
0,
10,
0,
0,
186,
0,
4
],
[
8,
1,
0.0224,
0.0299,
1,
0.38,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
1,
0.0697,
0.0547,
1,
0.38,
... | [
"class ImportStatement(object):\n \"\"\"Represent an import in a module\n\n `readonly` attribute controls whether this import can be changed\n by import actions or not.\n\n \"\"\"",
" \"\"\"Represent an import in a module\n\n `readonly` attribute controls whether this import can be changed\n ... |
"""rope refactor package
This package contains modules that perform python refactorings.
Refactoring classes perform refactorings in 4 steps:
1. Collect some data for performing the refactoring and use them
to construct a refactoring class. Like::
renamer = Rename(project, resource, offset)
2. Some refacto... | [
[
8,
0,
0.4364,
0.8545,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.8727,
0.0182,
0,
0.66,
0.3333,
488,
0,
1,
0,
0,
488,
0,
0
],
[
1,
0,
0.8909,
0.0182,
0,
0.66... | [
"\"\"\"rope refactor package\n\nThis package contains modules that perform python refactorings.\nRefactoring classes perform refactorings in 4 steps:\n\n1. Collect some data for performing the refactoring and use them\n to construct a refactoring class. Like::",
"from rope.refactor.importutils import ImportOrg... |
from rope.base import ast, codeanalyze
def get_indents(lines, lineno):
return codeanalyze.count_line_indents(lines.get_line(lineno))
def find_minimum_indents(source_code):
result = 80
lines = source_code.split('\n')
for line in lines:
if line.strip() == '':
continue
resul... | [
[
1,
0,
0.0109,
0.0109,
0,
0.66,
0,
632,
0,
2,
0,
0,
632,
0,
0
],
[
2,
0,
0.0489,
0.0217,
0,
0.66,
0.125,
895,
0,
2,
1,
0,
0,
0,
2
],
[
13,
1,
0.0543,
0.0109,
1,
0.... | [
"from rope.base import ast, codeanalyze",
"def get_indents(lines, lineno):\n return codeanalyze.count_line_indents(lines.get_line(lineno))",
" return codeanalyze.count_line_indents(lines.get_line(lineno))",
"def find_minimum_indents(source_code):\n result = 80\n lines = source_code.split('\\n')\n ... |
"""This module can be used for finding similar code"""
import re
import rope.refactor.wildcards
from rope.base import codeanalyze, evaluate, exceptions, ast, builtins
from rope.refactor import (patchedast, sourceutils, occurrences,
wildcards, importutils)
class BadNameInCheckError(exceptio... | [
[
8,
0,
0.0028,
0.0028,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0055,
0.0028,
0,
0.66,
0.0667,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.011,
0.0028,
0,
0.66,... | [
"\"\"\"This module can be used for finding similar code\"\"\"",
"import re",
"import rope.refactor.wildcards",
"from rope.base import codeanalyze, evaluate, exceptions, ast, builtins",
"from rope.refactor import (patchedast, sourceutils, occurrences,\n wildcards, importutils)",
"... |
from rope.base import (change, taskhandle, evaluate,
exceptions, pyobjects, pynames, ast)
from rope.refactor import restructure, sourceutils, similarfinder, importutils
class UseFunction(object):
"""Try to use a function wherever possible"""
def __init__(self, project, resource, offset... | [
[
1,
0,
0.0088,
0.0117,
0,
0.66,
0,
632,
0,
7,
0,
0,
632,
0,
0
],
[
1,
0,
0.0175,
0.0058,
0,
0.66,
0.1429,
545,
0,
4,
0,
0,
545,
0,
0
],
[
3,
0,
0.3713,
0.6784,
0,
... | [
"from rope.base import (change, taskhandle, evaluate,\n exceptions, pyobjects, pynames, ast)",
"from rope.refactor import restructure, sourceutils, similarfinder, importutils",
"class UseFunction(object):\n \"\"\"Try to use a function wherever possible\"\"\"\n\n def __init__(self, pr... |
import re
from rope.base import ast, codeanalyze
from rope.base.change import ChangeSet, ChangeContents
from rope.base.exceptions import RefactoringError
from rope.refactor import (sourceutils, similarfinder,
patchedast, suites, usefunction)
# Extract refactoring has lots of special cases.... | [
[
1,
0,
0.0013,
0.0013,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0038,
0.0013,
0,
0.66,
0.0476,
632,
0,
2,
0,
0,
632,
0,
0
],
[
1,
0,
0.0051,
0.0013,
0,
... | [
"import re",
"from rope.base import ast, codeanalyze",
"from rope.base.change import ChangeSet, ChangeContents",
"from rope.base.exceptions import RefactoringError",
"from rope.refactor import (sourceutils, similarfinder,\n patchedast, suites, usefunction)",
"class _ExtractRefact... |
"""This module can be used for performing cross-project refactorings
See the "cross-project refactorings" section of ``docs/library.txt``
file.
"""
from rope.base import resources, project, libutils
class MultiProjectRefactoring(object):
def __init__(self, refactoring, projects, addpath=True):
"""Crea... | [
[
8,
0,
0.0449,
0.0769,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1026,
0.0128,
0,
0.66,
0.25,
632,
0,
3,
0,
0,
632,
0,
0
],
[
3,
0,
0.2372,
0.2051,
0,
0.66,
... | [
"\"\"\"This module can be used for performing cross-project refactorings\n\nSee the \"cross-project refactorings\" section of ``docs/library.txt``\nfile.\n\n\"\"\"",
"from rope.base import resources, project, libutils",
"class MultiProjectRefactoring(object):\n\n def __init__(self, refactoring, projects, add... |
# -*- coding: utf-8 -*-
#
# Copyright © 2009-2010 Pierre Raybaut
# Licensed under the terms of the MIT License
# (see spyderlib/__init__.py for details)
"""Namespace Browser Plugin"""
import sys
from spyderlib.qt.QtGui import QStackedWidget, QGroupBox, QVBoxLayout
from spyderlib.qt.QtCore import Signal
... | [
[
8,
0,
0.0345,
0.0049,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0443,
0.0049,
0,
0.66,
0.0833,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0542,
0.0049,
0,
0.66... | [
"\"\"\"Namespace Browser Plugin\"\"\"",
"import sys",
"from spyderlib.qt.QtGui import QStackedWidget, QGroupBox, QVBoxLayout",
"from spyderlib.qt.QtCore import Signal",
"STDOUT = sys.stdout",
"from spyderlib.baseconfig import _",
"from spyderlib.config import CONF, get_icon",
"from spyderlib.utils imp... |
# -*- coding: utf-8 -*-
#
# Copyright © 2009-2010 Pierre Raybaut
# Licensed under the terms of the MIT License
# (see spyderlib/__init__.py for details)
"""Console History Plugin"""
from spyderlib.qt.QtGui import (QVBoxLayout, QFontDialog, QInputDialog,
QToolButton, QMenu, QFo... | [
[
8,
0,
0.0253,
0.0036,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0343,
0.0072,
0,
0.66,
0.0667,
314,
0,
7,
0,
0,
314,
0,
0
],
[
1,
0,
0.0397,
0.0036,
0,
0.66... | [
"\"\"\"Console History Plugin\"\"\"",
"from spyderlib.qt.QtGui import (QVBoxLayout, QFontDialog, QInputDialog,\n QToolButton, QMenu, QFontComboBox, QGroupBox)",
"from spyderlib.qt.QtCore import SIGNAL",
"import os.path as osp",
"import sys",
"STDOUT = sys.stdout",
"from sp... |
# -*- coding: utf-8 -*-
#
# Copyright © 2009-2010 Pierre Raybaut
# Licensed under the terms of the MIT License
# (see spyderlib/__init__.py for details)
"""Files and Directories Explorer Plugin"""
# pylint: disable=C0103
# pylint: disable=R0903
# pylint: disable=R0911
# pylint: disable=R0201
from spyder... | [
[
8,
0,
0.0519,
0.0074,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1037,
0.0074,
0,
0.66,
0.0909,
314,
0,
1,
0,
0,
314,
0,
0
],
[
1,
0,
0.1111,
0.0074,
0,
0.66... | [
"\"\"\"Files and Directories Explorer Plugin\"\"\"",
"from spyderlib.qt.QtGui import QFontDialog",
"from spyderlib.qt.QtCore import SIGNAL",
"import sys",
"import os.path as osp",
"STDOUT = sys.stdout",
"from spyderlib.baseconfig import _",
"from spyderlib.config import VALID_EXT",
"from spyderlib.u... |
# -*- coding: utf-8 -*-
#
# Copyright © 2009-2010 Pierre Raybaut
# Licensed under the terms of the MIT License
# (see spyderlib/__init__.py for details)
"""Configuration dialog / Preferences"""
import os, os.path as osp
from spyderlib.baseconfig import _
from spyderlib.config import (get_icon, CONF, CUSTO... | [
[
8,
0,
0.0097,
0.0014,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0124,
0.0014,
0,
0.66,
0.0667,
688,
0,
2,
0,
0,
688,
0,
0
],
[
1,
0,
0.0152,
0.0014,
0,
0.66... | [
"\"\"\"Configuration dialog / Preferences\"\"\"",
"import os, os.path as osp",
"from spyderlib.baseconfig import _",
"from spyderlib.config import (get_icon, CONF, CUSTOM_COLOR_SCHEME_NAME,\n set_default_color_scheme, COLOR_SCHEME_NAMES)",
"from spyderlib.utils.qthelpers import ... |
# -*- coding: utf-8 -*-
#
# Copyright © 2011 Pierre Raybaut
# Licensed under the terms of the MIT License
# (see spyderlib/__init__.py for details)
"""Outline Explorer Plugin"""
from spyderlib.qt.QtCore import SIGNAL, Signal
import sys
# For debugging purpose:
STDOUT = sys.stdout
# Local imports
fr... | [
[
8,
0,
0.0642,
0.0092,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0826,
0.0092,
0,
0.66,
0.125,
529,
0,
2,
0,
0,
529,
0,
0
],
[
1,
0,
0.1009,
0.0092,
0,
0.66,... | [
"\"\"\"Outline Explorer Plugin\"\"\"",
"from spyderlib.qt.QtCore import SIGNAL, Signal",
"import sys",
"STDOUT = sys.stdout",
"from spyderlib.baseconfig import _",
"from spyderlib.config import get_icon",
"from spyderlib.widgets.editortools import OutlineExplorerWidget",
"from spyderlib.plugins import... |
# -*- coding: utf-8 -*-
#
# Copyright © 2009-2010 Pierre Raybaut
# Licensed under the terms of the MIT License
# (see spyderlib/__init__.py for details)
"""Online Help Plugin"""
from spyderlib.qt.QtCore import Signal
import sys, os.path as osp
# For debugging purpose:
STDOUT = sys.stdout
# Local imp... | [
[
8,
0,
0.0729,
0.0104,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0938,
0.0104,
0,
0.66,
0.1429,
529,
0,
1,
0,
0,
529,
0,
0
],
[
1,
0,
0.1146,
0.0104,
0,
0.66... | [
"\"\"\"Online Help Plugin\"\"\"",
"from spyderlib.qt.QtCore import Signal",
"import sys, os.path as osp",
"STDOUT = sys.stdout",
"from spyderlib.baseconfig import get_conf_path, _",
"from spyderlib.widgets.pydocgui import PydocBrowser",
"from spyderlib.plugins import SpyderPluginMixin",
"class OnlineH... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.