id int64 0 458k | file_name stringlengths 4 119 | file_path stringlengths 14 227 | content stringlengths 24 9.96M | size int64 24 9.96M | language stringclasses 1
value | extension stringclasses 14
values | total_lines int64 1 219k | avg_line_length float64 2.52 4.63M | max_line_length int64 5 9.91M | alphanum_fraction float64 0 1 | repo_name stringlengths 7 101 | repo_stars int64 100 139k | repo_forks int64 0 26.4k | repo_open_issues int64 0 2.27k | repo_license stringclasses 12
values | repo_extraction_date stringclasses 433
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
32,600 | __init__.py | python-rope_rope/ropetest/refactor/__init__.py | import unittest
from textwrap import dedent
import rope.base.taskhandle
import rope.refactor.introduce_parameter
import ropetest.refactor.extracttest
import ropetest.refactor.importutilstest
import ropetest.refactor.inlinetest
import ropetest.refactor.movetest
import ropetest.refactor.multiprojecttest
import ropetest.... | 38,589 | Python | .py | 1,002 | 27.750499 | 88 | 0.549469 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,601 | movetest.py | python-rope_rope/ropetest/refactor/movetest.py | from __future__ import annotations
import unittest
from textwrap import dedent
from typing import TYPE_CHECKING, Union
from rope.base import exceptions
from rope.refactor import move
from ropetest import testutils
if TYPE_CHECKING:
from rope.base import resources, project
class MoveRefactoringTest(unittest.Tes... | 50,615 | Python | .py | 1,251 | 29.034373 | 117 | 0.557066 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,602 | multiprojecttest.py | python-rope_rope/ropetest/refactor/multiprojecttest.py | import unittest
from textwrap import dedent
from rope.refactor import move, multiproject, rename
from ropetest import testutils
class MultiProjectRefactoringTest(unittest.TestCase):
def setUp(self):
super().setUp()
self.project1 = testutils.sample_project(foldername="testproject1")
self.p... | 3,434 | Python | .py | 95 | 25.8 | 88 | 0.566497 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,603 | renametest.py | python-rope_rope/ropetest/refactor/renametest.py | import sys
import unittest
from textwrap import dedent
from rope.base import exceptions
import rope.base.codeanalyze
import rope.refactor.occurrences
from rope.refactor import rename
from rope.refactor.rename import Rename
from ropetest import testutils
class RenameTestMixin:
def setUp(self):
super().set... | 54,417 | Python | .py | 1,587 | 22.269691 | 129 | 0.480926 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,604 | findittest.py | python-rope_rope/ropetest/contrib/findittest.py | import unittest
from textwrap import dedent
from rope.base import exceptions
from rope.contrib.findit import find_definition, find_implementations, find_occurrences
from ropetest import testutils
class FindItTest(unittest.TestCase):
def setUp(self):
super().setUp()
self.project = testutils.sample... | 5,475 | Python | .py | 132 | 31.212121 | 87 | 0.589902 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,605 | codeassisttest.py | python-rope_rope/ropetest/contrib/codeassisttest.py | import os.path
import unittest
from textwrap import dedent
from rope.base import exceptions
from rope.contrib.codeassist import (
code_assist,
get_calltip,
get_canonical_path,
get_definition_location,
get_doc,
sorted_proposals,
starting_expression,
starting_offset,
)
from ropetest impor... | 56,041 | Python | .py | 1,402 | 28.812411 | 88 | 0.54496 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,606 | changestacktest.py | python-rope_rope/ropetest/contrib/changestacktest.py | import unittest
import rope.base.change
import rope.base.history
import rope.contrib.changestack
from ropetest import testutils
class ChangeStackTest(unittest.TestCase):
def setUp(self):
super().setUp()
self.project = testutils.sample_project()
def tearDown(self):
testutils.remove_pr... | 955 | Python | .py | 25 | 31.4 | 66 | 0.676757 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,607 | generatetest.py | python-rope_rope/ropetest/contrib/generatetest.py | import unittest
from textwrap import dedent
from rope.base import exceptions
from rope.contrib import generate
from ropetest import testutils
class GenerateTest(unittest.TestCase):
def setUp(self):
super().setUp()
self.project = testutils.sample_project()
self.pycore = self.project.pycore... | 15,157 | Python | .py | 455 | 21.676923 | 85 | 0.496207 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,608 | finderrorstest.py | python-rope_rope/ropetest/contrib/finderrorstest.py | import unittest
from textwrap import dedent
from rope.contrib import finderrors
from ropetest import testutils
class FindErrorsTest(unittest.TestCase):
def setUp(self):
super().setUp()
self.project = testutils.sample_project()
self.mod = self.project.root.create_file("mod.py")
def te... | 1,629 | Python | .py | 44 | 28.727273 | 63 | 0.625635 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,609 | fixmodnamestest.py | python-rope_rope/ropetest/contrib/fixmodnamestest.py | import unittest
from rope.contrib.fixmodnames import FixModuleNames
from rope.contrib.generate import create_module, create_package
from ropetest import testutils
# HACK: for making this test work on case-insensitive file-systems, it
# uses a name.replace('x', '_') fixer.
class FixModuleNamesTest(unittest.TestCase):... | 2,066 | Python | .py | 42 | 42.142857 | 78 | 0.679742 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,610 | autoimporttest.py | python-rope_rope/ropetest/contrib/autoimporttest.py | import unittest
from rope.contrib.autoimport import sqlite as autoimport
from rope.contrib.autoimport.defs import Alias
from ropetest import testutils
class AutoImportTest(unittest.TestCase):
def setUp(self):
super().setUp()
self.project = testutils.sample_project(extension_modules=["sys"])
... | 9,332 | Python | .py | 175 | 45.062857 | 99 | 0.678109 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,611 | conftest.py | python-rope_rope/ropetest/contrib/autoimport/conftest.py | import pathlib
import pytest
from ropetest import testutils
@pytest.fixture
def mod1(project):
mod1 = testutils.create_module(project, "mod1")
return mod1
@pytest.fixture
def mod1_path(mod1):
return pathlib.Path(mod1.real_path)
@pytest.fixture
def typing_path():
import typing
return pathlib... | 858 | Python | .py | 32 | 23.4375 | 69 | 0.760494 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,612 | modeltest.py | python-rope_rope/ropetest/contrib/autoimport/modeltest.py | import sqlite3
from typing import Any
import pytest
from rope.contrib.autoimport import models
@pytest.fixture
def empty_db():
return sqlite3.connect(":memory:")
class TestQuery:
def test_select_non_existent_column(self):
expected_msg = """Unknown column names passed: {['"]doesnotexist['"]}"""
... | 2,128 | Python | .py | 56 | 30.053571 | 83 | 0.629449 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,613 | utilstest.py | python-rope_rope/ropetest/contrib/autoimport/utilstest.py | """Tests for autoimport utility functions, written in pytest"""
from pathlib import Path
from rope.contrib.autoimport import utils
from rope.contrib.autoimport.defs import Package, PackageType, Source
def test_get_package_source(mod1_path, project):
assert utils.get_package_source(mod1_path, project, "") == Sou... | 2,443 | Python | .py | 50 | 44 | 89 | 0.733108 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,614 | autoimporttest.py | python-rope_rope/ropetest/contrib/autoimport/autoimporttest.py | import sqlite3
from concurrent.futures import ThreadPoolExecutor
from contextlib import closing, contextmanager
from textwrap import dedent
from unittest.mock import ANY, patch
import pytest
from rope.base.project import Project
from rope.base.resources import File, Folder
from rope.contrib.autoimport import models
f... | 7,153 | Python | .py | 171 | 36.122807 | 99 | 0.700534 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,615 | parsetest.py | python-rope_rope/ropetest/contrib/autoimport/parsetest.py | from rope.contrib.autoimport import parse
from rope.contrib.autoimport.defs import Name, NameType, PartialName, Source
def test_typing_names(typing_path):
names = list(parse.get_names_from_file(typing_path))
assert PartialName("Text", NameType.Variable) in names
def test_find_sys():
names = list(parse.g... | 647 | Python | .py | 11 | 55.090909 | 86 | 0.746032 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,616 | tag-release.py | python-rope_rope/bin/tag-release.py | #!/usr/bin/env python
import re
import subprocess
from datetime import datetime
import toml
pyproject = toml.load("pyproject.toml")
version = pyproject["project"]["version"]
def get_changelog(version):
s = open("CHANGELOG.md").read()
search_heading = f"# Release {version}"
curdate = datetime.today().da... | 1,607 | Python | .py | 39 | 36.615385 | 85 | 0.697809 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,617 | default_config.py | python-rope_rope/docs/default_config.py | # The default ``config.py``
# flake8: noqa
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_fil... | 5,165 | Python | .py | 123 | 36.926829 | 78 | 0.639896 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,618 | conf.py | python-rope_rope/docs/conf.py | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | 2,273 | Python | .py | 51 | 42.764706 | 79 | 0.688435 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,619 | __init__.py | python-rope_rope/rope/__init__.py | """rope, a python refactoring library"""
import importlib.metadata
try:
VERSION = importlib.metadata.version("rope")
except importlib.metadata.PackageNotFoundError:
def get_fallback_version():
import pathlib
import re
pyproject = (
pathlib.Path(__file__).resolve().parent.... | 1,413 | Python | .py | 33 | 39.333333 | 77 | 0.747445 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,620 | encapsulate_field.py | python-rope_rope/rope/refactor/encapsulate_field.py | from rope.base import evaluate, exceptions, libutils, pynames, taskhandle, utils, worder
from rope.base.change import ChangeContents, ChangeSet
from rope.refactor import occurrences, sourceutils
class EncapsulateField:
def __init__(self, project, resource, offset):
self.project = project
self.name... | 8,459 | Python | .py | 188 | 33.957447 | 88 | 0.602207 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,621 | suites.py | python-rope_rope/rope/refactor/suites.py | from itertools import chain
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]
... | 5,152 | Python | .py | 135 | 29.192593 | 84 | 0.607422 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,622 | inline.py | python-rope_rope/rope/refactor/inline.py | # Known Bugs when inlining a function/method
# The values passed to function are inlined using _inlined_variable.
# This may cause two problems, illustrated in the examples below
#
# def foo(var1):
# var1 = var1*10
# return var1
#
# If a call to foo(20) is inlined, the result of inlined function is 20,
# but it... | 25,111 | Python | .py | 601 | 31.948419 | 88 | 0.61535 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,623 | functionutils.py | python-rope_rope/rope/refactor/functionutils.py | import ast
from typing import Tuple, List
from rope.base import pyobjects, worder
from rope.base.builtins import Lambda
from rope.base.codeanalyze import SourceLinesAdapter
class DefinitionInfo:
def __init__(
self, function_name, is_method, args_with_defaults, args_arg, keywords_arg
):
self.f... | 11,042 | Python | .py | 271 | 30.726937 | 88 | 0.589627 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,624 | method_object.py | python-rope_rope/rope/refactor/method_object.py | import warnings
from rope.base import change, codeanalyze, evaluate, exceptions, libutils, pyobjects
from rope.refactor import occurrences, rename, sourceutils
class MethodObject:
def __init__(self, project, resource, offset):
self.project = project
this_pymodule = self.project.get_pymodule(resou... | 3,829 | Python | .py | 86 | 34.302326 | 87 | 0.600964 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,625 | wildcards.py | python-rope_rope/rope/refactor/wildcards.py | from rope.base import ast, builtins, evaluate, pyobjects
from rope.refactor import occurrences, patchedast
class Wildcard:
def get_name(self):
"""Return the name of this wildcard"""
def matches(self, suspect, arg):
"""Return `True` if `suspect` matches this wildcard"""
class Suspect:
de... | 5,740 | Python | .py | 143 | 30.020979 | 86 | 0.592093 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,626 | move.py | python-rope_rope/rope/refactor/move.py | """A module containing classes for move refactoring
`create_move()` is a factory for creating move refactoring objects
based on inputs.
"""
from __future__ import annotations
import typing
from typing import List, Optional, Union
from rope.base import (
codeanalyze,
evaluate,
exceptions,
libutils,
... | 34,609 | Python | .py | 762 | 34.770341 | 92 | 0.620297 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,627 | __init__.py | python-rope_rope/rope/refactor/__init__.py | """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... | 2,127 | Python | .py | 53 | 36.660377 | 70 | 0.759592 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,628 | similarfinder.py | python-rope_rope/rope/refactor/similarfinder.py | """This module can be used for finding similar code"""
import re
import rope.base.builtins # Use full qualification for clarity.
import rope.refactor.wildcards # Use full qualification for clarity.
from rope.base import ast, codeanalyze, exceptions, libutils
from rope.refactor import patchedast
from rope.refactor.p... | 12,720 | Python | .py | 306 | 31.663399 | 88 | 0.596517 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,629 | topackage.py | python-rope_rope/rope/refactor/topackage.py | import rope.refactor.importutils
from rope.base.change import ChangeContents, ChangeSet, CreateFolder, MoveResource
class ModuleToPackage:
def __init__(self, project, resource):
self.project = project
self.resource = resource
def get_changes(self):
changes = ChangeSet("Transform <%s> ... | 1,226 | Python | .py | 25 | 40.84 | 84 | 0.680869 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,630 | localtofield.py | python-rope_rope/rope/refactor/localtofield.py | from rope.base import evaluate, exceptions, pynames, worder
from rope.refactor.rename import Rename
class LocalToField:
def __init__(self, project, resource, offset):
self.project = project
self.resource = resource
self.offset = offset
def get_changes(self):
name = worder.get_... | 2,076 | Python | .py | 44 | 37.818182 | 83 | 0.648221 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,631 | rename.py | python-rope_rope/rope/refactor/rename.py | import warnings
from keyword import iskeyword
from rope.base import (
codeanalyze,
evaluate,
exceptions,
libutils,
pynames,
pyobjects,
taskhandle,
worder,
)
from rope.base.change import ChangeContents, ChangeSet, MoveResource
from rope.refactor import occurrences
class Rename:
"""... | 9,687 | Python | .py | 243 | 30.18107 | 87 | 0.616104 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,632 | occurrences.py | python-rope_rope/rope/refactor/occurrences.py | """Find occurrences of a name in a project.
This module consists of a `Finder` that finds all occurrences of a name
in a project. The `Finder.find_occurrences()` method is a generator that
yields `Occurrence` instances for each occurrence of the name. To create
a `Finder` object, use the `create_finder()` function:
... | 13,328 | Python | .py | 346 | 30.283237 | 88 | 0.635659 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,633 | restructure.py | python-rope_rope/rope/refactor/restructure.py | import warnings
from rope.base import ast, builtins, change, codeanalyze, libutils, taskhandle
from rope.refactor import patchedast, similarfinder, sourceutils
from rope.refactor.importutils import module_imports
class Restructure:
"""A class to perform python restructurings
A restructuring transforms piece... | 11,441 | Python | .py | 268 | 32.511194 | 88 | 0.611166 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,634 | introduce_factory.py | python-rope_rope/rope/refactor/introduce_factory.py | from rope.base import evaluate, exceptions, libutils, pyobjects, taskhandle
from rope.base.change import ChangeContents, ChangeSet
from rope.refactor import importutils, occurrences, rename, sourceutils
class IntroduceFactory:
def __init__(self, project, resource, offset):
self.project = project
s... | 5,913 | Python | .py | 124 | 36.669355 | 87 | 0.615145 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,635 | change_signature.py | python-rope_rope/rope/refactor/change_signature.py | import copy
import rope.base.exceptions
from rope.base import codeanalyze, evaluate, pyobjects, taskhandle, utils, worder
from rope.base.change import ChangeContents, ChangeSet
from rope.refactor import functionutils, occurrences
class ChangeSignature:
def __init__(self, project, resource, offset):
self.... | 13,432 | Python | .py | 314 | 33.044586 | 88 | 0.630628 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,636 | extract.py | python-rope_rope/rope/refactor/extract.py | import re
from contextlib import contextmanager
from itertools import chain
from typing import Dict
from rope.base import ast, codeanalyze
from rope.base.change import ChangeContents, ChangeSet
from rope.base.exceptions import RefactoringError
from rope.base.utils.datastructures import OrderedSet
from rope.refactor im... | 41,840 | Python | .py | 1,004 | 31.984064 | 88 | 0.616942 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,637 | patchedast.py | python-rope_rope/rope/refactor/patchedast.py | import collections
import numbers
import re
import warnings
from itertools import chain
from rope.base import ast, codeanalyze, exceptions
COMMA_IN_WITH_PATTERN = re.compile(r"\(.*?\)|(,)")
def get_patched_ast(source, sorted_children=False):
"""Adds ``region`` and ``sorted_children`` fields to nodes
Adds `... | 31,264 | Python | .py | 805 | 28.479503 | 85 | 0.55641 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,638 | introduce_parameter.py | python-rope_rope/rope/refactor/introduce_parameter.py | import rope.base.change # Use fully qualified names for clarity.
from rope.base import codeanalyze, evaluate, exceptions, worder
from rope.refactor import functionutils, occurrences, sourceutils
class IntroduceParameter:
"""Introduce parameter refactoring
This refactoring adds a new parameter to a function ... | 3,717 | Python | .py | 79 | 38.392405 | 88 | 0.660039 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,639 | sourceutils.py | python-rope_rope/rope/refactor/sourceutils.py | from rope.base import 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
result = m... | 3,001 | Python | .py | 77 | 32.675325 | 75 | 0.656121 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,640 | usefunction.py | python-rope_rope/rope/refactor/usefunction.py | from rope.base import (
ast,
change,
evaluate,
exceptions,
libutils,
pynames,
pyobjects,
taskhandle,
)
from rope.refactor import restructure, similarfinder, sourceutils
class UseFunction:
"""Try to use a function wherever possible"""
def __init__(self, project, resource, offse... | 6,651 | Python | .py | 173 | 29.531792 | 86 | 0.61124 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,641 | multiproject.py | python-rope_rope/rope/refactor/multiproject.py | """This module can be used for performing cross-project refactorings
See the "cross-project refactorings" section of ``docs/library.rst``
file.
"""
from rope.base import libutils, resources
class MultiProjectRefactoring:
def __init__(self, refactoring, projects, addpath=True):
"""Create a multiproject ... | 2,544 | Python | .py | 58 | 35.724138 | 85 | 0.653971 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,642 | __init__.py | python-rope_rope/rope/refactor/importutils/__init__.py | """A package for handling imports
This package provides tools for modifying module imports after
refactorings or as a separate task.
"""
import rope.base.codeanalyze
import rope.base.evaluate
from rope.base import libutils
from rope.base.change import ChangeContents, ChangeSet
from rope.refactor import occurrences, ... | 13,355 | Python | .py | 298 | 34.88255 | 85 | 0.636112 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,643 | importinfo.py | python-rope_rope/rope/refactor/importutils/importinfo.py | from abc import abstractmethod, ABC
from typing import List, Tuple, Optional, Protocol
class ImportStatement:
"""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, en... | 6,345 | Python | .py | 175 | 27.36 | 87 | 0.593954 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,644 | module_imports.py | python-rope_rope/rope/refactor/importutils/module_imports.py | from typing import List, Union
from rope.base import ast, exceptions, pynames, pynamesdef, utils
from rope.refactor.importutils import actions, importinfo
class ModuleImports:
def __init__(self, project, pymodule, import_filter=None):
self.project = project
self.pymodule = pymodule
self.s... | 21,998 | Python | .py | 510 | 31.42549 | 88 | 0.583501 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,645 | actions.py | python-rope_rope/rope/refactor/importutils/actions.py | from rope.base import exceptions, libutils, pyobjects, stdmods
from rope.refactor import occurrences
from rope.refactor.importutils import importinfo
class ImportInfoVisitor:
def dispatch(self, import_):
try:
method_name = "visit" + import_.import_info.__class__.__name__
method = g... | 14,255 | Python | .py | 316 | 33.886076 | 87 | 0.610239 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,646 | generate.py | python-rope_rope/rope/contrib/generate.py | from __future__ import annotations
from typing import TYPE_CHECKING
from rope.base import (
change,
codeanalyze,
evaluate,
exceptions,
libutils,
pynames,
pyobjects,
worder,
)
from rope.refactor import functionutils, importutils, sourceutils, suites
if TYPE_CHECKING:
from typing im... | 14,881 | Python | .py | 354 | 33.081921 | 88 | 0.632755 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,647 | finderrors.py | python-rope_rope/rope/contrib/finderrors.py | """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.... | 2,936 | Python | .py | 72 | 33.347222 | 85 | 0.643585 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,648 | fixsyntax.py | python-rope_rope/rope/contrib/fixsyntax.py | from rope.base import codeanalyze, evaluate, exceptions, libutils, utils, worder
from rope.base.codeanalyze import ArrayLinesAdapter, LogicalLineFinder
class FixSyntax:
def __init__(self, project, code, resource, maxfixes=1):
self.project = project
self.code = code
self.resource = resource... | 6,777 | Python | .py | 158 | 31.132911 | 87 | 0.557998 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,649 | __init__.py | python-rope_rope/rope/contrib/__init__.py | """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.
"""
| 169 | Python | .py | 5 | 32.4 | 59 | 0.765432 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,650 | findit.py | python-rope_rope/rope/contrib/findit.py | from rope.base import evaluate, exceptions, pyobjects, taskhandle, worder
from rope.contrib import fixsyntax
from rope.refactor import occurrences
def find_occurrences(
project,
resource,
offset,
unsure=False,
resources=None,
in_hierarchy=False,
task_handle=taskhandle.DEFAULT_TASK_HANDLE,
... | 4,483 | Python | .py | 114 | 31.95614 | 88 | 0.661836 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,651 | changestack.py | python-rope_rope/rope/contrib/changestack.py | """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_... | 1,350 | Python | .py | 38 | 28.789474 | 68 | 0.663846 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,652 | fixmodnames.py | python-rope_rope/rope/contrib/fixmodnames.py | """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... | 2,195 | Python | .py | 55 | 30.690909 | 87 | 0.623706 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,653 | codeassist.py | python-rope_rope/rope/contrib/codeassist.py | import keyword
import sys
import warnings
from rope.base import (
builtins,
evaluate,
exceptions,
libutils,
pynames,
pynamesdef,
pyobjects,
pyobjectsdef,
pyscopes,
worder,
)
from rope.contrib import fixsyntax
from rope.refactor import functionutils
def code_assist(
project... | 26,473 | Python | .py | 629 | 32.556439 | 88 | 0.610854 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,654 | models.py | python-rope_rope/rope/contrib/autoimport/models.py | from abc import ABC, abstractmethod
from typing import Dict, List
class FinalQuery:
def __init__(self, query):
self._query = query
def __repr__(self):
return f'{self.__class__.__name__}("{self._query}")'
def explain(self):
return FinalQuery("EXPLAIN QUERY PLAN " + self._query)
... | 4,718 | Python | .py | 121 | 31.68595 | 124 | 0.618808 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,655 | sqlite.py | python-rope_rope/rope/contrib/autoimport/sqlite.py | """AutoImport module for rope."""
from __future__ import annotations
import contextlib
import json
import re
import secrets
import sqlite3
import sys
import warnings
from collections import OrderedDict
from concurrent.futures import Future, ProcessPoolExecutor, as_completed
from datetime import datetime
from hashlib ... | 24,433 | Python | .py | 589 | 31.232598 | 88 | 0.606818 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,656 | pickle.py | python-rope_rope/rope/contrib/autoimport/pickle.py | """
IMPORTANT: This is a deprecated implementation of autoimport using pickle-based
storage.
This pickle-based autoimport is provided only for backwards compatibility
purpose and will be removed and the sqlite backend will be the new default
implementation in the future.
If you are still using this module, you should... | 8,393 | Python | .py | 201 | 31.880597 | 82 | 0.620647 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,657 | utils.py | python-rope_rope/rope/contrib/autoimport/utils.py | """Utility functions for the autoimport code."""
import pathlib
import sys
from collections import OrderedDict
from typing import Generator, List, Optional, Tuple
from rope.base.project import Project
from .defs import ModuleCompiled, ModuleFile, ModuleInfo, Package, PackageType, Source
def get_package_tuple(
... | 4,851 | Python | .py | 115 | 34.626087 | 88 | 0.648368 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,658 | __init__.py | python-rope_rope/rope/contrib/autoimport/__init__.py | """AutoImport module for rope."""
from .pickle import AutoImport as _PickleAutoImport
from .sqlite import AutoImport as _SqliteAutoImport
AutoImport = _PickleAutoImport
__all__ = ["AutoImport"]
| 197 | Python | .py | 5 | 37.8 | 51 | 0.793651 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,659 | defs.py | python-rope_rope/rope/contrib/autoimport/defs.py | """Definitions of types for the Autoimport program."""
import pathlib
from enum import Enum
from typing import NamedTuple, Optional
class Source(Enum):
"""Describes the source of the package, for sorting purposes."""
PROJECT = 0 # Obviously any project packages come first
MANUAL = 1 # Placeholder sinc... | 2,559 | Python | .py | 91 | 23.395604 | 87 | 0.681463 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,660 | parse.py | python-rope_rope/rope/contrib/autoimport/parse.py | """
Functions to find importable names.
Can extract names from source code of a python file, .so object, or builtin module.
"""
import inspect
import logging
import pathlib
from importlib import import_module
from typing import Generator, List
from rope.base import ast
from .defs import (
ModuleCompiled,
Mo... | 5,276 | Python | .py | 142 | 27.352113 | 88 | 0.598124 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,661 | serializer.py | python-rope_rope/rope/base/serializer.py | """
This module serves to convert a data structure composed of Python primitives
(dict, list, tuple, int, str, None) to JSON-serializable primitives (object,
array, number, str, null).
A core feature of this serializer is that the produced will round-trip to
identical objects when deserialized by the standard library ... | 5,590 | Python | .py | 124 | 36.169355 | 80 | 0.60753 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,662 | project.py | python-rope_rope/rope/base/project.py | from __future__ import annotations
import contextlib
import json
import os
import sys
import warnings
from contextlib import ExitStack
from typing import Optional
import rope.base.fscommands # Use full qualification for clarity.
import rope.base.resourceobserver as resourceobserver
from rope.base import exceptions, ... | 15,178 | Python | .py | 370 | 32.043243 | 87 | 0.622147 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,663 | resources.py | python-rope_rope/rope/base/resources.py | """Files and folders in a project are represented as resource objects.
Files and folders are access through `Resource` objects. `Resource` has
two subclasses: `File` and `Folder`. What we care about is that
refactorings and `rope.base.change.Change`s use resources.
There are two options to create a `Resource` for a p... | 7,940 | Python | .py | 211 | 29.052133 | 86 | 0.6012 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,664 | arguments.py | python-rope_rope/rope/base/arguments.py | import rope.base.evaluate
from rope.base import ast
class Arguments:
"""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.scope = sco... | 3,283 | Python | .py | 88 | 28.954545 | 82 | 0.636822 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,665 | pycore.py | python-rope_rope/rope/base/pycore.py | import bisect
import contextlib
import difflib
import warnings
import rope.base.libutils
import rope.base.oi.doa
import rope.base.oi.objectinfo
import rope.base.oi.soa
import rope.base.resourceobserver
import rope.base.resources
from rope.base import builtins, exceptions, pyobjectsdef, stdmods, taskhandle, utils
cla... | 12,804 | Python | .py | 288 | 35.322917 | 85 | 0.646544 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,666 | pyobjectsdef.py | python-rope_rope/rope/base/pyobjectsdef.py | import rope.base.builtins
import rope.base.codeanalyze
import rope.base.evaluate
import rope.base.libutils
import rope.base.oi.soi
import rope.base.pyscopes
from rope.base import (
arguments,
ast,
exceptions,
fscommands,
nameanalyze,
pynamesdef,
pyobjects,
utils,
)
class PyFunction(pyo... | 22,557 | Python | .py | 547 | 30.974406 | 88 | 0.610042 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,667 | builtins.py | python-rope_rope/rope/base/builtins.py | """This module tries to support builtin types and functions."""
import inspect
import io
import rope.base.evaluate
from rope.base import arguments, ast, pynames, pyobjects, utils
class BuiltinModule(pyobjects.AbstractModule):
def __init__(self, name, pycore=None, initial={}):
super().__init__()
... | 26,264 | Python | .py | 684 | 29.422515 | 88 | 0.608187 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,668 | nameanalyze.py | python-rope_rope/rope/base/nameanalyze.py | 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,656 | Python | .py | 47 | 27.468085 | 68 | 0.59322 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,669 | pynamesdef.py | python-rope_rope/rope/base/pynamesdef.py | import contextlib
import rope.base.oi.soi
import rope.base.pyobjects
from rope.base import pynames, utils
class DefinedName(pynames.DefinedName):
pass
class AssignedName(pynames.AssignedName):
def __init__(self, lineno=None, module=None, pyobject=None):
self.lineno = lineno
self.module = mo... | 2,098 | Python | .py | 55 | 31.290909 | 79 | 0.691621 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,670 | fscommands.py | python-rope_rope/rope/base/fscommands.py | """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 re
import shutil
... | 8,482 | Python | .py | 233 | 28.480687 | 85 | 0.613636 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,671 | worder.py | python-rope_rope/rope/base/worder.py | import bisect
import keyword
import rope.base.simplify
MINIMAL_LEN_FOR_AS = 5
def get_name_at(resource, offset):
source_code = resource.read()
word_finder = Worder(source_code)
return word_finder.get_word_at(offset)
class Worder:
"""A class for finding boundaries of words and expressions
Note... | 22,416 | Python | .py | 494 | 35.275304 | 88 | 0.596015 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,672 | pyobjects.py | python-rope_rope/rope/base/pyobjects.py | from typing import Optional
from rope.base import ast, exceptions, utils
class PyObject:
def __init__(self, type_):
if type_ is None:
type_ = self
self.type = type_
def get_attributes(self):
if self.type is self:
return {}
return self.type.get_attribut... | 9,294 | Python | .py | 248 | 29.362903 | 84 | 0.622014 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,673 | pyscopes.py | python-rope_rope/rope/base/pyscopes.py | import rope.base.builtins # Use full qualification for clarity.
from rope.base import ast, codeanalyze, exceptions, pynames, utils
from rope.refactor import patchedast
class Scope:
def __init__(self, pycore, pyobject, parent_scope):
self.pycore = pycore
self.pyobject = pyobject
self.paren... | 11,468 | Python | .py | 291 | 30.233677 | 87 | 0.617138 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,674 | simplify.py | python-rope_rope/rope/base/simplify.py | """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
* i... | 1,906 | Python | .py | 56 | 27.464286 | 77 | 0.601741 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,675 | history.py | python-rope_rope/rope/base/history.py | from rope.base import change, exceptions, taskhandle, utils
class History:
"""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_history... | 8,342 | Python | .py | 193 | 32.772021 | 88 | 0.607667 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,676 | ast.py | python-rope_rope/rope/base/ast.py | import ast
import sys
from ast import * # noqa: F401,F403
from rope.base import fscommands
try:
# Suppress the mypy complaint: Module "ast" has no attribute "_const_node_type_names"
from ast import _const_node_type_names # type:ignore
except ImportError:
# backported from stdlib `ast`
assert sys.ver... | 2,521 | Python | .py | 68 | 30.911765 | 91 | 0.64192 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,677 | libutils.py | python-rope_rope/rope/base/libutils.py | """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 pyobjectsdef, taskhandle, utils
def path_to_resource(project, path, type=None):
"""Get the resource at path
You only need to specify `type` if `path` does not exist... | 3,842 | Python | .py | 90 | 37.011111 | 86 | 0.69965 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,678 | change.py | python-rope_rope/rope/base/change.py | import datetime
import difflib
import os
import time
from typing import Union
import rope.base.fscommands
from rope.base import exceptions, taskhandle, utils
from rope.base.fscommands import FileContent
class Change:
"""The base class for changes
Rope refactorings return `Change` objects. They can be previ... | 13,675 | Python | .py | 352 | 30.329545 | 88 | 0.629747 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,679 | prefs.py | python-rope_rope/rope/base/prefs.py | # mypy reports many problems.
# type: ignore
"""Rope preferences."""
from dataclasses import asdict, dataclass
from textwrap import dedent
from typing import Any, Callable, Dict, List, Optional, Tuple
from packaging.requirements import Requirement
from pytoolconfig import PyToolConfig, UniversalKey, field
from pytoolc... | 11,258 | Python | .py | 288 | 30.239583 | 92 | 0.599963 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,680 | resourceobserver.py | python-rope_rope/rope/base/resourceobserver.py | import os
class ResourceObserver:
"""Provides the interface for observing resources
`ResourceObserver` can be registered using `Project.
add_observer()`. But most of the time `FilteredResourceObserver`
should be used. `ResourceObserver` report all changes passed
to them and they don't report ch... | 10,291 | Python | .py | 232 | 34.219828 | 84 | 0.634648 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,681 | versioning.py | python-rope_rope/rope/base/versioning.py | import dataclasses
import hashlib
import importlib.util
import json
from typing import Dict
import rope.base.project
def get_version_hash_data(project: rope.base.project.Project) -> Dict[str, str]:
version_hash_data = dict(
version_data=f"{rope.VERSION}",
prefs_data=_get_prefs_data(project),
... | 1,468 | Python | .py | 36 | 35.833333 | 81 | 0.7173 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,682 | __init__.py | python-rope_rope/rope/base/__init__.py | """Base rope package
This package contains rope core modules that are used by other modules
and packages.
"""
__all__ = ["project", "libutils", "exceptions"]
| 161 | Python | .py | 5 | 30.6 | 70 | 0.738562 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,683 | stdmods.py | python-rope_rope/rope/base/stdmods.py | import inspect
import os
import sys
from rope.base import utils
def _stdlib_path():
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 = _stdlib_... | 1,606 | Python | .py | 47 | 26.382979 | 62 | 0.611111 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,684 | pynames.py | python-rope_rope/rope/base/pynames.py | from __future__ import annotations
import typing
import rope.base.pyobjects
from rope.base import exceptions, utils
if typing.TYPE_CHECKING:
from typing import Union
from rope.base import pyobjectsdef
class PyName:
"""References to `PyObject` inside python programs"""
def get_object(self):
... | 6,390 | Python | .py | 168 | 28.916667 | 85 | 0.617766 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,685 | taskhandle.py | python-rope_rope/rope/base/taskhandle.py | from abc import ABC, abstractmethod
from typing import Optional, Sequence
from rope.base import exceptions, utils
class BaseJobSet(ABC):
name: str = ""
job_name: str = ""
@abstractmethod
def started_job(self, name: str) -> None:
pass
@abstractmethod
def finished_job(self) -> None:
... | 4,907 | Python | .py | 155 | 24.270968 | 76 | 0.627823 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,686 | exceptions.py | python-rope_rope/rope/base/exceptions.py | 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... | 1,370 | Python | .py | 36 | 32.5 | 75 | 0.694656 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,687 | codeanalyze.py | python-rope_rope/rope/base/codeanalyze.py | import bisect
import re
import token
import tokenize
class ChangeCollector:
def __init__(self, text):
self.text = text
self.changes = []
def add_change(self, start, end, new_text=None):
if new_text is None:
new_text = self.text[start:end]
self.changes.append((start... | 11,774 | Python | .py | 325 | 25.418462 | 84 | 0.528864 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,688 | evaluate.py | python-rope_rope/rope/base/evaluate.py | from operator import itemgetter
from typing import Optional, Tuple
import rope.base.builtins
import rope.base.pynames
import rope.base.pyobjects
from rope.base import (
arguments,
ast,
exceptions,
nameanalyze,
pyobjects,
pyobjectsdef,
worder,
)
BadIdentifierError = exceptions.BadIdentifier... | 13,591 | Python | .py | 317 | 33.094637 | 88 | 0.620924 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,689 | datastructures.py | python-rope_rope/rope/base/utils/datastructures.py | # this snippet was taken from this link
# http://code.activestate.com/recipes/576694/
from collections.abc import MutableSet
class OrderedSet(MutableSet):
def __init__(self, iterable=None):
self.end = end = []
end += [None, end, end] # sentinel
# node for doubly linked list
self.... | 1,824 | Python | .py | 53 | 25.54717 | 72 | 0.536974 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,690 | __init__.py | python-rope_rope/rope/base/utils/__init__.py | import sys
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)
r... | 3,949 | Python | .py | 102 | 30.686275 | 82 | 0.602207 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,691 | objectdb.py | python-rope_rope/rope/base/oi/objectdb.py | class ObjectDB:
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(file):
del sel... | 4,547 | Python | .py | 127 | 27.055118 | 70 | 0.608904 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,692 | doa.py | python-rope_rope/rope/base/oi/doa.py | import base64
import contextlib
import hashlib
import hmac
try:
import cPickle as pickle # type:ignore
except ImportError:
import pickle # type:ignore
import marshal
import os
import socket
import subprocess
import sys
import tempfile
import threading
def _compat_compare_digest(a, b):
"""Implementation... | 7,397 | Python | .py | 200 | 27.025 | 88 | 0.58381 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,693 | transform.py | python-rope_rope/rope/base/oi/transform.py | """Provides classes for persisting `PyObject`"""
import os
import re
import rope.base.builtins # Use full qualification for clarity.
from rope.base import exceptions
class PyObjectToTextual:
"""For transforming `PyObject` to textual form
This can be used for storing `PyObjects` in files. Use
`Textual... | 9,830 | Python | .py | 231 | 33.103896 | 88 | 0.628892 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,694 | memorydb.py | python-rope_rope/rope/base/oi/memorydb.py | from rope.base import utils
from rope.base.oi import objectdb
from rope.base.serializer import json_to_python, python_to_json
class MemoryDB(objectdb.FileDict):
def __init__(self, project, persist=None):
self.project = project
self._persist = persist
self.files = self
self._load_fi... | 3,440 | Python | .py | 97 | 27.43299 | 71 | 0.608945 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,695 | soi.py | python-rope_rope/rope/base/oi/soi.py | """A module for inferring objects
For more information see the documentation in `rope.base.oi`
package.
"""
import rope.base.builtins # Use full qualification for clarity.
from rope.base import arguments, evaluate, pynames, pyobjects, utils
from rope.base.oi.type_hinting.factory import get_type_hinting_factory
_ig... | 7,720 | Python | .py | 192 | 32.307292 | 88 | 0.667245 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,696 | soa.py | python-rope_rope/rope/base/oi/soa.py | import rope.base.ast
import rope.base.oi.soi
import rope.base.pynames
from rope.base import arguments, evaluate, nameanalyze, pyobjects
def analyze_module(pycore, pymodule, should_analyze, search_subscopes, followed_calls):
"""Analyze `pymodule` for static object inference
Analyzes scopes for collecting obje... | 5,862 | Python | .py | 125 | 36.392 | 88 | 0.629442 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,697 | runmod.py | python-rope_rope/rope/base/oi/runmod.py | def __rope_start_everything():
import os
import socket
import sys
try:
import cPickle as pickle # type:ignore
except ImportError:
import pickle
import base64
import hashlib
import hmac
import inspect
import marshal
import threading
import types
clas... | 8,532 | Python | .py | 212 | 26.806604 | 88 | 0.510192 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,698 | __init__.py | python-rope_rope/rope/base/oi/__init__.py | """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... | 1,682 | Python | .py | 29 | 56 | 70 | 0.807786 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |
32,699 | objectinfo.py | python-rope_rope/rope/base/oi/objectinfo.py | import warnings
from rope.base import exceptions, resourceobserver
from rope.base.oi import memorydb, objectdb, transform
class ObjectInfoManager:
"""Stores object information
It uses an instance of `objectdb.ObjectDB` for storing
information.
"""
def __init__(self, project):
self.proj... | 8,624 | Python | .py | 196 | 33.622449 | 83 | 0.61401 | python-rope/rope | 1,917 | 161 | 105 | LGPL-3.0 | 9/5/2024, 5:14:38 PM (Europe/Amsterdam) |