mirror of
https://github.com/nvbn/thefuck.git
synced 2025-01-18 20:11:17 +00:00
Merge pull request #506 from asergi/pathlib2
Switch from pathlib to pathlib2
This commit is contained in:
commit
a4b690369c
2
setup.py
2
setup.py
@ -29,7 +29,7 @@ elif (3, 0) < version < (3, 3):
|
||||
VERSION = '3.9'
|
||||
|
||||
install_requires = ['psutil', 'colorama', 'six', 'decorator']
|
||||
extras_require = {':python_version<"3.4"': ['pathlib'],
|
||||
extras_require = {':python_version<"3.4"': ['pathlib2'],
|
||||
":sys_platform=='win32'": ['win_unicode_console']}
|
||||
|
||||
setup(name='thefuck',
|
||||
|
@ -1,4 +1,7 @@
|
||||
from pathlib import Path
|
||||
try:
|
||||
from pathlib import Path
|
||||
except ImportError:
|
||||
from pathlib2 import Path
|
||||
import pytest
|
||||
from thefuck import shells
|
||||
from thefuck import conf, const
|
||||
|
@ -1,7 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import pytest
|
||||
from pathlib import Path
|
||||
try:
|
||||
from pathlib import Path
|
||||
pathlib_name = 'pathlib'
|
||||
except ImportError:
|
||||
from pathlib2 import Path
|
||||
pathlib_name = 'pathlib2'
|
||||
from thefuck import corrector, const
|
||||
from tests.utils import Rule, Command, CorrectedCommand
|
||||
from thefuck.corrector import get_corrected_commands, organize_commands
|
||||
@ -11,7 +16,7 @@ class TestGetRules(object):
|
||||
@pytest.fixture
|
||||
def glob(self, mocker):
|
||||
results = {}
|
||||
mocker.patch('pathlib.Path.glob',
|
||||
mocker.patch(pathlib_name + '.Path.glob',
|
||||
new_callable=lambda: lambda *_: results.pop('value', []))
|
||||
return lambda value: results.update({'value': value})
|
||||
|
||||
|
@ -3,7 +3,10 @@
|
||||
import os
|
||||
from subprocess import PIPE
|
||||
from mock import Mock
|
||||
from pathlib import Path
|
||||
try:
|
||||
from pathlib import Path
|
||||
except ImportError:
|
||||
from pathlib2 import Path
|
||||
import pytest
|
||||
from tests.utils import CorrectedCommand, Rule, Command
|
||||
from thefuck import const
|
||||
|
@ -1,7 +1,10 @@
|
||||
from imp import load_source
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
try:
|
||||
from pathlib import Path
|
||||
except ImportError:
|
||||
from pathlib2 import Path
|
||||
from six import text_type
|
||||
from . import const
|
||||
|
||||
|
@ -1,4 +1,7 @@
|
||||
from pathlib import Path
|
||||
try:
|
||||
from pathlib import Path
|
||||
except ImportError:
|
||||
from pathlib2 import Path
|
||||
from .conf import settings
|
||||
from .types import Rule
|
||||
from . import logs
|
||||
|
@ -10,7 +10,10 @@ from decorator import decorator
|
||||
from difflib import get_close_matches
|
||||
from functools import wraps
|
||||
from inspect import getargspec
|
||||
from pathlib import Path
|
||||
try:
|
||||
from pathlib import Path
|
||||
except ImportError:
|
||||
from pathlib2 import Path
|
||||
from warnings import warn
|
||||
|
||||
DEVNULL = open(os.devnull, 'w')
|
||||
|
Loading…
x
Reference in New Issue
Block a user