mirror of
https://github.com/wting/autojump
synced 2026-03-02 03:49:26 +00:00
Run pre-commit on repo.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# Author: Steven J. Bethard <steven.bethard@gmail.com>.
|
||||
# -*- coding: utf-8 -*-
|
||||
# Author: Steven J. Bethard <steven.bethard@gmail.com>.
|
||||
# flake8: noqa
|
||||
"""Command-line parsing library
|
||||
|
||||
|
||||
@@ -2,26 +2,27 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import print_function
|
||||
|
||||
from codecs import open
|
||||
from collections import namedtuple
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
from codecs import open
|
||||
from collections import namedtuple
|
||||
from tempfile import NamedTemporaryFile
|
||||
from time import time
|
||||
|
||||
from autojump_utils import create_dir
|
||||
from autojump_utils import is_osx
|
||||
from autojump_utils import is_python3
|
||||
from autojump_utils import move_file
|
||||
from autojump_utils import unico
|
||||
|
||||
|
||||
if sys.version_info[0] == 3:
|
||||
ifilter = filter
|
||||
imap = map
|
||||
else:
|
||||
from itertools import ifilter
|
||||
from itertools import imap
|
||||
|
||||
from autojump_utils import create_dir
|
||||
from autojump_utils import unico
|
||||
from autojump_utils import is_osx
|
||||
from autojump_utils import is_python3
|
||||
from autojump_utils import move_file
|
||||
from itertools import ifilter # noqa
|
||||
from itertools import imap # noqa
|
||||
|
||||
|
||||
BACKUP_THRESHOLD = 24 * 60 * 60
|
||||
@@ -95,7 +96,7 @@ def migrate_osx_xdg_data(config):
|
||||
Older versions incorrectly used Linux XDG_DATA_HOME paths on OS X. This
|
||||
migrates autojump files from ~/.local/share/autojump to ~/Library/autojump
|
||||
"""
|
||||
assert is_osx(), "This function should only be run on OS X."
|
||||
assert is_osx(), 'This function should only be run on OS X.'
|
||||
|
||||
xdg_data_home = os.path.join(os.path.expanduser('~'), '.local', 'share')
|
||||
xdg_aj_home = os.path.join(xdg_data_home, 'autojump')
|
||||
@@ -125,12 +126,12 @@ def save(config, data):
|
||||
|
||||
with open(temp.name, 'w', encoding='utf-8', errors='replace') as f:
|
||||
for path, weight in data.items():
|
||||
f.write(unico("%s\t%s\n" % (weight, path)))
|
||||
f.write(unico('%s\t%s\n' % (weight, path)))
|
||||
|
||||
f.flush()
|
||||
os.fsync(f)
|
||||
except IOError as ex:
|
||||
print("Error saving autojump data (disk full?)" % ex, file=sys.stderr)
|
||||
print('Error saving autojump data (disk full?)' % ex, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
# move temp_file -> autojump.txt
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import errno
|
||||
from itertools import islice
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
import shutil
|
||||
import sys
|
||||
import unicodedata
|
||||
from itertools import islice
|
||||
|
||||
if sys.version_info[0] == 3:
|
||||
imap = map
|
||||
@@ -75,7 +74,7 @@ def get_pwd():
|
||||
try:
|
||||
return os.getcwdu()
|
||||
except OSError:
|
||||
print("Current directory no longer exists.", file=sys.stderr)
|
||||
print('Current directory no longer exists.', file=sys.stderr)
|
||||
raise
|
||||
|
||||
|
||||
@@ -141,7 +140,7 @@ def move_file(src, dst):
|
||||
|
||||
|
||||
def print_entry(entry):
|
||||
print_local("%.1f:\t%s" % (entry.weight, entry.path))
|
||||
print_local('%.1f:\t%s' % (entry.weight, entry.path))
|
||||
|
||||
|
||||
def print_local(string):
|
||||
|
||||
Reference in New Issue
Block a user