Skip to content

Commit

Permalink
remove more -u modifier for dropbox-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
Austin Kim authored and raveit65 committed Jan 31, 2019
1 parent 686bae0 commit 4eab52b
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions caja-dropbox.in
Expand Up @@ -630,7 +630,7 @@ class DropboxCommand(object):
self.s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) self.s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
self.s.settimeout(timeout) self.s.settimeout(timeout)
try: try:
self.s.connect(os.path.expanduser(u'~/.dropbox/command_socket')) self.s.connect(os.path.expanduser('~/.dropbox/command_socket'))
except socket.error: except socket.error:
raise DropboxCommand.CouldntConnectError() raise DropboxCommand.CouldntConnectError()
self.f = self.s.makefile("rw", 4096) self.f = self.s.makefile("rw", 4096)
Expand Down Expand Up @@ -899,7 +899,7 @@ options:
path = "%s (File doesn't exist!)" % os.path.basename(file_path) path = "%s (File doesn't exist!)" % os.path.basename(file_path)
return (path, path) return (path, path)
try: try:
status = dc.icon_overlay_file_status(path=file_path).get(u'status', [None])[0] status = dc.icon_overlay_file_status(path=file_path).get('status', [None])[0]
except DropboxCommand.CommandError as e: except DropboxCommand.CommandError as e:
path = "%s (%s)" % (os.path.basename(file_path), e) path = "%s (%s)" % (os.path.basename(file_path), e)
return (path, path) return (path, path)
Expand Down Expand Up @@ -940,7 +940,7 @@ options:
if type(subname) != str: if type(subname) != str:
continue continue


if not options.all and subname[0] == u'.': if not options.all and subname[0] == '.':
continue continue


try: try:
Expand Down Expand Up @@ -1005,7 +1005,7 @@ options:
continue continue


try: try:
status = dc.icon_overlay_file_status(path=fp).get(u'status', [u'unknown'])[0] status = dc.icon_overlay_file_status(path=fp).get('status', ['unknown'])[0]
console_print("%-*s %s" % (indent, file+':', status)) console_print("%-*s %s" % (indent, file+':', status))
except DropboxCommand.CommandError as e: except DropboxCommand.CommandError as e:
console_print("%-*s %s" % (indent, file+':', e)) console_print("%-*s %s" % (indent, file+':', e))
Expand Down Expand Up @@ -1037,7 +1037,7 @@ Prints out a public url for FILE (which must be in your public folder).
try: try:
with closing(DropboxCommand()) as dc: with closing(DropboxCommand()) as dc:
try: try:
console_print(dc.get_public_link(path=os.path.abspath(args[0])).get(u'link', [u'No Link'])[0]) console_print(dc.get_public_link(path=os.path.abspath(args[0])).get('link', ['No Link'])[0])
except DropboxCommand.CommandError as e: except DropboxCommand.CommandError as e:
console_print("Couldn't get public url: " + str(e)) console_print("Couldn't get public url: " + str(e))
except DropboxCommand.BadConnectionError: except DropboxCommand.BadConnectionError:
Expand All @@ -1063,7 +1063,7 @@ Prints out a shared link for FILE.
with closing(DropboxCommand()) as dc: with closing(DropboxCommand()) as dc:
try: try:
path = os.path.abspath(args[0]) path = os.path.abspath(args[0])
link = dc.get_shared_link(path=path).get('link', [u'No link'])[0] link = dc.get_shared_link(path=path).get('link', ['No link'])[0]
console_print(link) console_print(link)
except DropboxCommand.CommandError as e: except DropboxCommand.CommandError as e:
console_print("Couldn't get shared link: " + str(e)) console_print("Couldn't get shared link: " + str(e))
Expand Down Expand Up @@ -1097,10 +1097,10 @@ PASSWORD - (optional) proxy password (only valid with "manual" mode)
type_ = args[1].lower() type_ = args[1].lower()


if (len(args) == 0 or if (len(args) == 0 or
mode not in [u'none', u'auto', u'manual'] or mode not in ['none', 'auto', 'manual'] or
(mode == 'manual' and len(args) not in (4, 6)) or (mode == 'manual' and len(args) not in (4, 6)) or
(mode != 'manual' and len(args) != 1) or (mode != 'manual' and len(args) != 1) or
(mode == 'manual' and type_ not in [u'http', u'socks4', u'socks5'])): (mode == 'manual' and type_ not in ['http', 'socks4', 'socks5'])):
# Print help # Print help
console_print(proxy.__doc__, linebreak=False) console_print(proxy.__doc__, linebreak=False)
return return
Expand All @@ -1119,7 +1119,7 @@ PASSWORD - (optional) proxy password (only valid with "manual" mode)
with closing(DropboxCommand()) as dc: with closing(DropboxCommand()) as dc:
try: try:
dc.set_proxy_settings(**kwargs) dc.set_proxy_settings(**kwargs)
console_print(u'set') console_print('set')
except DropboxCommand.CommandError as e: except DropboxCommand.CommandError as e:
console_print("Couldn't set proxy: " + str(e)) console_print("Couldn't set proxy: " + str(e))
except DropboxCommand.BadConnectionError: except DropboxCommand.BadConnectionError:
Expand Down Expand Up @@ -1149,42 +1149,42 @@ UPLOAD - one of "unlimited", "auto", or a manual limit in KB/s


download_limit = None download_limit = None
download_mode = None download_mode = None
if downlimit == u'unlimited': if downlimit == 'unlimited':
download_mode = downlimit download_mode = downlimit
else: else:
try: try:
download_limit = int(downlimit) download_limit = int(downlimit)
download_mode = u'manual' download_mode = 'manual'
except ValueError: except ValueError:
console_print(throttle.__doc__, linebreak=False) console_print(throttle.__doc__, linebreak=False)
return return


upload_limit = None upload_limit = None
upload_mode = None upload_mode = None
if uplimit in [u'unlimited', u'auto']: if uplimit in ['unlimited', 'auto']:
upload_mode = uplimit upload_mode = uplimit
else: else:
try: try:
upload_limit = int(uplimit) upload_limit = int(uplimit)
upload_mode = u'manual' upload_mode = 'manual'
except ValueError: except ValueError:
console_print(throttle.__doc__, linebreak=False) console_print(throttle.__doc__, linebreak=False)
return return


kwargs = { kwargs = {
u'download_mode': download_mode, 'download_mode': download_mode,
u'upload_mode': upload_mode, 'upload_mode': upload_mode,
} }
if download_limit: if download_limit:
kwargs[u'download_limit'] = str(download_limit) kwargs['download_limit'] = str(download_limit)
if upload_limit: if upload_limit:
kwargs[u'upload_limit'] = str(upload_limit) kwargs['upload_limit'] = str(upload_limit)


try: try:
with closing(DropboxCommand()) as dc: with closing(DropboxCommand()) as dc:
try: try:
dc.set_bandwidth_limits(**kwargs) dc.set_bandwidth_limits(**kwargs)
console_print(u'set') console_print('set')
except DropboxCommand.CommandError as e: except DropboxCommand.CommandError as e:
console_print("Couldn't set bandwidth limits: " + str(e)) console_print("Couldn't set bandwidth limits: " + str(e))
except DropboxCommand.BadConnectionError: except DropboxCommand.BadConnectionError:
Expand All @@ -1209,9 +1209,9 @@ Prints out the current status of the Dropbox daemon.
try: try:
with closing(DropboxCommand()) as dc: with closing(DropboxCommand()) as dc:
try: try:
lines = dc.get_dropbox_status()[u'status'] lines = dc.get_dropbox_status()['status']
if len(lines) == 0: if len(lines) == 0:
console_print(u'Idle') console_print('Idle')
else: else:
for line in lines: for line in lines:
console_print(line) console_print(line)
Expand Down Expand Up @@ -1322,12 +1322,12 @@ Any specified path must be within Dropbox.
try: try:
with closing(DropboxCommand()) as dc: with closing(DropboxCommand()) as dc:
try: try:
lines = [relpath(path) for path in dc.get_ignore_set()[u'ignore_set']] lines = [relpath(path) for path in dc.get_ignore_set()['ignore_set']]
lines.sort() lines.sort()
if len(lines) == 0: if len(lines) == 0:
console_print(u'No directories are being ignored.') console_print('No directories are being ignored.')
else: else:
console_print(u'Excluded: ') console_print('Excluded: ')
for line in lines: for line in lines:
console_print(str(line)) console_print(str(line))
except KeyError: except KeyError:
Expand Down Expand Up @@ -1452,10 +1452,10 @@ options:




def can_reroll_autostart(): def can_reroll_autostart():
return ".config" in os.listdir(os.path.expanduser(u'~')) return ".config" in os.listdir(os.path.expanduser('~'))


def reroll_autostart(should_autostart): def reroll_autostart(should_autostart):
home_dir = os.path.expanduser(u'~') home_dir = os.path.expanduser('~')
contents = os.listdir(home_dir) contents = os.listdir(home_dir)


# UBUNTU # UBUNTU
Expand Down

0 comments on commit 4eab52b

Please sign in to comment.