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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | core_test.py | git-cola_git-cola/test/core_test.py | """Tests the cola.core module's unicode handling"""
from cola import core
from . import helper
def test_core_decode():
"""Test the core.decode function"""
filename = helper.fixture('unicode.txt')
expect = core.decode(core.encode('unicøde'))
actual = core.read(filename).strip()
assert expect == a... | 1,528 | Python | .py | 42 | 31.714286 | 53 | 0.689891 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
1 | startup_test.py | git-cola_git-cola/test/startup_test.py | """Test Startup Dialog (git cola --prompt) Context Menu and related classes"""
from cola.widgets import startup
from .helper import app_context
# Prevent unused imports lint errors.
assert app_context is not None
def test_get_with_default_repo(app_context):
"""Test BuildItem::get for default repo"""
path = ... | 2,555 | Python | .py | 67 | 33.343284 | 78 | 0.703163 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
2 | spellcheck_test.py | git-cola_git-cola/test/spellcheck_test.py | from cola import compat
from cola import spellcheck
from . import helper
def test_spellcheck_generator():
check = spellcheck.NorvigSpellCheck()
assert_spellcheck(check)
def test_spellcheck_unicode():
path = helper.fixture('unicode.txt')
check = spellcheck.NorvigSpellCheck(words=path)
assert_spe... | 474 | Python | .py | 14 | 29.5 | 51 | 0.752759 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
3 | compat_test.py | git-cola_git-cola/test/compat_test.py | """Tests the compat module"""
import os
from cola import compat
def test_setenv():
"""Test the core.decode function"""
key = 'COLA_UNICODE_TEST'
value = '字龍'
compat.setenv(key, value)
assert key in os.environ
assert os.getenv(key)
compat.unsetenv(key)
assert key not in os.environ
... | 351 | Python | .py | 13 | 22.615385 | 39 | 0.690909 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
4 | gitcfg_test.py | git-cola_git-cola/test/gitcfg_test.py | """Test the cola.gitcfg module."""
import pathlib
from . import helper
from .helper import app_context
# Prevent unused imports lint errors.
assert app_context is not None
def assert_color(context, expect, git_value, key='test', default=None):
"""Helper function for testing color values"""
helper.run_git('... | 4,587 | Python | .py | 103 | 40.126214 | 80 | 0.680189 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
5 | main_model_test.py | git-cola_git-cola/test/main_model_test.py | import os
import pytest
from cola import core
from cola import git
from cola.models import main
from cola.models.main import FETCH, FETCH_HEAD, PULL, PUSH
from . import helper
from .helper import app_context
from .helper import Mock
# prevent unused imports lint errors.
assert app_context is not None
REMOTE = 'se... | 7,183 | Python | .py | 222 | 26.689189 | 82 | 0.655522 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
6 | app_test.py | git-cola_git-cola/test/app_test.py | import argparse
from cola import app
def test_setup_environment():
# If the function doesn't throw an exception we are happy.
assert hasattr(app, 'setup_environment')
app.setup_environment()
def test_add_common_arguments():
# If the function doesn't throw an exception we are happy.
parser = arg... | 428 | Python | .py | 11 | 34.909091 | 62 | 0.75 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
7 | cmds_test.py | git-cola_git-cola/test/cmds_test.py | """Test the cmds module"""
from cola import cmds
from cola.compat import uchr
from .helper import Mock, patch
def test_Commit_strip_comments():
"""Ensure that commit messages are stripped of comments"""
msg = 'subject\n\n#comment\nbody'
expect = 'subject\n\nbody\n'
actual = cmds.Commit.strip_comment... | 7,046 | Python | .py | 170 | 36.582353 | 78 | 0.692105 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
8 | display_test.py | git-cola_git-cola/test/display_test.py | from cola import display
def test_shorten_paths():
paths = (
'/usr/src/git-cola/src',
'/usr/src/example/src',
'/usr/src/super/lib/src',
'/usr/src/super/tools/src',
'/usr/src/super/example/src',
'/lib/src',
)
actual = display.shorten_paths(paths)
assert a... | 744 | Python | .py | 22 | 28.090909 | 50 | 0.615599 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
9 | gitcmds_test.py | git-cola_git-cola/test/gitcmds_test.py | """Test the cola.gitcmds module"""
import os
from cola import core
from cola import gitcmds
from cola.widgets.remote import get_default_remote
from . import helper
from .helper import app_context
# Prevent unused imports lint errors.
assert app_context is not None
def test_currentbranch(app_context):
"""Test ... | 7,264 | Python | .py | 171 | 37.391813 | 88 | 0.66856 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
10 | gitops_test.py | git-cola_git-cola/test/gitops_test.py | """Tests basic git operations: commit, log, config"""
from . import helper
from .helper import app_context
# Prevent unused imports lint errors.
assert app_context is not None
def test_git_commit(app_context):
"""Test running 'git commit' via cola.git"""
helper.write_file('A', 'A')
helper.write_file('B'... | 816 | Python | .py | 21 | 34.809524 | 84 | 0.664549 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
11 | branch_test.py | git-cola_git-cola/test/branch_test.py | """Tests related to the branches widget"""
from cola.widgets import branch
from .helper import Mock
def test_create_tree_entries():
names = [
'abc',
'cat/abc',
'cat/def',
'xyz/xyz',
]
root = branch.create_tree_entries(names)
expect = 3
actual = len(root.children)
... | 6,703 | Python | .py | 213 | 24.107981 | 84 | 0.569921 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
12 | resources_test.py | git-cola_git-cola/test/resources_test.py | from cola import resources
from . import helper
from .helper import patch
@patch('cola.resources.compat')
@patch('cola.resources.get_prefix')
def test_command_unix(mock_prefix, mock_compat):
"""Test the behavior of resources.command() on unix platforms"""
mock_compat.WIN32 = False
mock_prefix.return_valu... | 1,146 | Python | .py | 28 | 36.892857 | 68 | 0.713255 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
13 | icons_test.py | git-cola_git-cola/test/icons_test.py | from cola import compat
from cola import core
from cola import icons
def test_from_filename_unicode():
filename = compat.uchr(0x400) + '.py'
expect = 'file-code.svg'
actual = icons.basename_from_filename(filename)
assert expect == actual
actual = icons.basename_from_filename(core.encode(filename)... | 350 | Python | .py | 10 | 31.3 | 64 | 0.738872 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
14 | gravatar_test.py | git-cola_git-cola/test/gravatar_test.py | from cola import gravatar
from cola.compat import ustr
def test_url_for_email_():
email = 'email@example.com'
expect = (
'https://gravatar.com/avatar/5658ffccee7f0ebfda2b226238b1eb6e?s=64'
+ r'&d=https%3A%2F%2Fgit-cola.github.io%2Fimages%2Fgit-64x64.jpg'
)
actual = gravatar.Gravatar.ur... | 407 | Python | .py | 11 | 32.181818 | 75 | 0.71066 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
15 | git_test.py | git-cola_git-cola/test/git_test.py | """Test the cola.git module"""
import os
import pathlib
from cola import git
from cola.git import STDOUT
from .helper import patch
# 16k+1 bytes to exhaust any output buffers.
BUFFER_SIZE = (16 * 1024) + 1
@patch('cola.git.is_git_dir')
def test_find_git_dir_None(is_git_dir):
paths = git.find_git_directory(Non... | 12,019 | Python | .py | 318 | 32.283019 | 84 | 0.640024 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
16 | settings_test.py | git-cola_git-cola/test/settings_test.py | """Test the cola.settings module"""
import os
import pytest
from cola.settings import Settings
from . import helper
@pytest.fixture(autouse=True)
def settings_fixture():
"""Provide Settings that save into a temporary location to all tests"""
filename = helper.tmp_path('settings')
Settings.config_path =... | 2,527 | Python | .py | 65 | 34.061538 | 75 | 0.691961 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
17 | utils_test.py | git-cola_git-cola/test/utils_test.py | """Tests the cola.utils module."""
import os
from cola import core
from cola import utils
def test_basename():
"""Test the utils.basename function."""
assert utils.basename('bar') == 'bar'
assert utils.basename('/bar') == 'bar'
assert utils.basename('/bar ') == 'bar '
assert utils.basename('foo/b... | 3,010 | Python | .py | 85 | 30.023529 | 67 | 0.630345 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
18 | browse_model_test.py | git-cola_git-cola/test/browse_model_test.py | """Test interfaces used by the browser (git cola browse)"""
from cola import core
from cola import gitcmds
from . import helper
from .helper import app_context
# Prevent unused imports lint errors.
assert app_context is not None
def test_stage_paths_untracked(app_context):
"""Test stage_paths() with an untrack... | 1,709 | Python | .py | 45 | 33.577778 | 59 | 0.697632 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
19 | dag_test.py | git-cola_git-cola/test/dag_test.py | """Tests DAG functionality"""
import pytest
from cola.models import dag
from .helper import app_context
from .helper import patch
# Prevent unused imports lint errors.
assert app_context is not None
LOG_TEXT = """
23e7eab4ba2c94e3155f5d261c693ccac1342eb9^Af4fb8fd5baaa55d9b41faca79be289bb4407281e^A^ADavid Aguilar^... | 3,882 | Python | .py | 75 | 46.88 | 184 | 0.759778 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
20 | switcher_test.py | git-cola_git-cola/test/switcher_test.py | """Test Quick Switcher"""
from cola import icons
from cola.widgets import switcher
def test_switcher_item_with_only_key():
"""item text would be key by building item without name"""
key = 'item-key'
actual = switcher.switcher_item(key)
assert actual.key == key
assert actual.text() == key
def te... | 615 | Python | .py | 17 | 31.941176 | 68 | 0.688663 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
21 | helper.py | git-cola_git-cola/test/helper.py | import os
import shutil
import stat
import tempfile
from unittest.mock import Mock, patch
import pytest
from cola import core
from cola import git
from cola import gitcfg
from cola import gitcmds
from cola.models import main
# prevent unused imports lint errors.
assert patch is not None
def tmp_path(*paths):
... | 2,850 | Python | .py | 76 | 33.236842 | 88 | 0.691551 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
22 | i18n_test.py | git-cola_git-cola/test/i18n_test.py | """Tests for the i18n translation module"""
import os
import pytest
from cola import i18n
from cola.i18n import N_
from cola.compat import uchr
@pytest.fixture(autouse=True)
def i18n_context():
"""Perform cleanup/teardown of the i18n module"""
yield
i18n.uninstall()
def test_translates_noun():
"""... | 1,985 | Python | .py | 57 | 30.508772 | 70 | 0.678553 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
23 | stash_model_test.py | git-cola_git-cola/test/stash_model_test.py | from cola.models.stash import StashModel
from . import helper
from .helper import app_context
# Prevent unused imports lint errors.
assert app_context is not None
def test_stash_info_for_message_without_slash(app_context):
helper.commit_files()
helper.write_file('A', 'change')
helper.run_git('stash', '... | 1,525 | Python | .py | 39 | 33.974359 | 75 | 0.667346 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
24 | models_selection_test.py | git-cola_git-cola/test/models_selection_test.py | from cola.models import selection
from .helper import Mock
def test_union():
t = Mock()
t.staged = ['a']
t.unmerged = ['a', 'b']
t.modified = ['b', 'a', 'c']
t.untracked = ['d']
expect = ['a', 'b', 'c', 'd']
actual = selection.union(t)
assert expect == actual
| 296 | Python | .py | 11 | 22.636364 | 33 | 0.558719 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
25 | diffparse_test.py | git-cola_git-cola/test/diffparse_test.py | """Tests for the diffparse module"""
import pytest
from cola import core
from cola import diffparse
from . import helper
class DiffLinesTestData:
"""Test data used by DiffLines tests"""
def __init__(self):
self.parser = diffparse.DiffLines()
fixture_path = helper.fixture('diff.txt')
... | 10,053 | Python | .py | 297 | 28.592593 | 88 | 0.598367 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
26 | textwrap_test.py | git-cola_git-cola/test/textwrap_test.py | """Test the textwrap module"""
import pytest
from cola import textwrap
class WordWrapDefaults:
def __init__(self):
self.tabwidth = 8
self.limit = None
def wrap(self, text, break_on_hyphens=True):
return textwrap.word_wrap(
text, self.tabwidth, self.limit, break_on_hyphens... | 4,877 | Python | .py | 158 | 26.772152 | 78 | 0.669455 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
27 | _activate_cola.py | git-cola_git-cola/bin/_activate_cola.py | # Developer wrapper script helper functions
import configparser
import datetime
import os
import sys
def activate():
"""Activate the cola development environment"""
initialize_python()
initialize_version()
def get_prefix():
"""Return the path to the source tree"""
realpath = os.path.abspath(os.p... | 3,910 | Python | .py | 104 | 31.288462 | 85 | 0.651772 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
28 | sphinxtogithub.py | git-cola_git-cola/extras/sphinxtogithub/sphinxtogithub.py | #! /usr/bin/env python
from optparse import OptionParser
import os
import sys
import shutil
import codecs
def stdout(msg):
sys.stdout.write(msg + '\n')
class DirHelper:
def __init__(self, is_dir, list_dir, walk, rmtree):
self.is_dir = is_dir
self.list_dir = list_dir
self.walk = wa... | 10,273 | Python | .py | 286 | 26.307692 | 87 | 0.588824 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
29 | __init__.py | git-cola_git-cola/extras/sphinxtogithub/__init__.py | """Script for preparing the html output of the Sphinx documentation system for
github pages. """
VERSION = (1, 1, 0, 'dev')
__version__ = '.'.join(map(str, VERSION[:-1]))
__release__ = '.'.join(map(str, VERSION))
__author__ = 'Michael Jones'
__contact__ = 'http://github.com/michaeljones'
__homepage__ = 'http://github... | 670 | Python | .py | 25 | 23.44 | 78 | 0.691589 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
30 | conf.py | git-cola_git-cola/docs/conf.py | import os
import sys
try:
import furo
except ImportError:
furo = None
try:
import sphinx_rtd_theme
except ImportError:
sphinx_rtd_theme = None
try:
import rst.linker as rst_linker
except ImportError:
rst_linker = None
# Add the source tree and extras/ to sys.path.
srcdir = os.path.dirname(os.p... | 3,186 | Python | .py | 93 | 29.451613 | 87 | 0.658862 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
31 | pynsist-preamble.py | git-cola_git-cola/contrib/win32/pynsist-preamble.py | import os
pythondir = os.path.join(installdir, 'Python') # noqa
path = os.environ.get('PATH', '')
os.environ['PATH'] = os.pathsep.join([pythondir, pkgdir, path]) # noqa
| 172 | Python | .py | 4 | 41.75 | 71 | 0.694611 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
32 | run-pynsist.sh | git-cola_git-cola/contrib/win32/run-pynsist.sh | #!/bin/sh
rm -rf build/nsis &&
make all &&
make doc &&
make htmldir="$PWD/share/doc/git-cola/html" install-doc &&
pynsist pynsist.cfg &&
rm -r share/doc/git-cola/html
| 167 | Python | .py | 7 | 22.857143 | 58 | 0.7125 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
33 | difftool.py | git-cola_git-cola/cola/difftool.py | import os
from qtpy import QtWidgets
from qtpy.QtCore import Qt
from . import cmds
from . import core
from . import gitcmds
from . import hotkeys
from . import icons
from . import qtutils
from . import utils
from .git import EMPTY_TREE_OID
from .i18n import N_
from .interaction import Interaction
from .widgets import... | 9,801 | Python | .py | 265 | 28.120755 | 86 | 0.612073 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
34 | resources.py | git-cola_git-cola/cola/resources.py | """Functions for finding cola resources"""
import os
import sys
import webbrowser
from . import core
from . import compat
# Default git-cola icon theme
_default_icon_theme = 'light'
_resources = core.abspath(core.realpath(__file__))
_package = os.path.dirname(_resources)
if _package.endswith(os.path.join('site-pac... | 6,746 | Python | .py | 166 | 34.692771 | 91 | 0.657786 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
35 | sequenceeditor.py | git-cola_git-cola/cola/sequenceeditor.py | import sys
import re
from argparse import ArgumentParser
from functools import partial
from cola import app # prints a message if Qt cannot be found
from qtpy import QtGui
from qtpy import QtWidgets
from qtpy.QtCore import Qt
from qtpy.QtCore import Signal
from cola import core
from cola import difftool
from cola im... | 30,613 | Python | .py | 828 | 27.822464 | 88 | 0.592962 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
36 | __main__.py | git-cola_git-cola/cola/__main__.py | """Run cola as a Python module.
Usage: python -m cola
"""
from cola import main
def run():
"""Start the command-line interface."""
main.main()
if __name__ == '__main__':
run()
| 194 | Python | .py | 9 | 18.555556 | 43 | 0.620112 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
37 | interaction.py | git-cola_git-cola/cola/interaction.py | import os
import sys
from . import core
from .i18n import N_
class Interaction:
"""Prompts the user and answers questions"""
VERBOSE = bool(os.getenv('GIT_COLA_VERBOSE'))
@classmethod
def command(cls, title, cmd, status, out, err):
"""Log a command and display error messages on failure"""
... | 4,367 | Python | .py | 129 | 25.503876 | 87 | 0.572783 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
38 | settings.py | git-cola_git-cola/cola/settings.py | """Save settings, bookmarks, etc."""
import json
import os
import sys
from . import core
from . import display
from . import git
from . import resources
def mkdict(obj):
"""Transform None and non-dicts into dicts"""
if isinstance(obj, dict):
value = obj
else:
value = {}
return value
... | 13,449 | Python | .py | 338 | 30.488166 | 89 | 0.602361 | git-cola/git-cola | 2,239 | 455 | 69 | GPL-2.0 | 9/5/2024, 5:06:50 PM (Europe/Amsterdam) |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 79