Skip to content

Commit 45ea5b8

Browse files
committed
Revert "reformatting using black"
This reverts commit 754e896.
1 parent 5502b66 commit 45ea5b8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+4037
-4622
lines changed

jupyter_server/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
"""The Jupyter Server"""
22

3-
from ._version import version_info, __version__
43
import os
54

65
DEFAULT_STATIC_FILES_PATH = os.path.join(os.path.dirname(__file__), "static")
76
DEFAULT_TEMPLATE_PATH_LIST = [
87
os.path.dirname(__file__),
9-
os.path.join(os.path.dirname(__file__), "templates"),
8+
os.path.join(os.path.dirname(__file__), 'templates'),
109
]
1110

1211
del os
12+
13+
from ._version import version_info, __version__

jupyter_server/__main__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import absolute_import
22

3-
if __name__ == "__main__":
3+
if __name__ == '__main__':
44
from jupyter_server import serverapp as app
5-
65
app.launch_new_instance()

jupyter_server/_sysinfo.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import jupyter_server
2020

21-
2221
def pkg_commit_hash(pkg_path):
2322
"""Get short form of commit hash given directory `pkg_path`
2423
@@ -46,25 +45,23 @@ def pkg_commit_hash(pkg_path):
4645
par_path = pkg_path
4746
while cur_path != par_path:
4847
cur_path = par_path
49-
if p.exists(p.join(cur_path, ".git")):
48+
if p.exists(p.join(cur_path, '.git')):
5049
try:
51-
proc = subprocess.Popen(
52-
["git", "rev-parse", "--short", "HEAD"],
53-
stdout=subprocess.PIPE,
54-
stderr=subprocess.PIPE,
55-
cwd=pkg_path,
56-
)
50+
proc = subprocess.Popen(['git', 'rev-parse', '--short', 'HEAD'],
51+
stdout=subprocess.PIPE,
52+
stderr=subprocess.PIPE,
53+
cwd=pkg_path)
5754
repo_commit, _ = proc.communicate()
5855
except OSError:
5956
repo_commit = None
6057

6158
if repo_commit:
62-
return "repository", repo_commit.strip().decode("ascii")
59+
return 'repository', repo_commit.strip().decode('ascii')
6360
else:
64-
return u"", u""
61+
return u'', u''
6562
par_path = p.dirname(par_path)
66-
67-
return u"", u""
63+
64+
return u'', u''
6865

6966

7067
def pkg_info(pkg_path):
@@ -92,11 +89,11 @@ def pkg_info(pkg_path):
9289
platform=platform.platform(),
9390
os_name=os.name,
9491
default_encoding=encoding.DEFAULT_ENCODING,
95-
)
96-
92+
)
9793

9894
def get_sys_info():
9995
"""Return useful information about the system as a dict."""
10096
p = os.path
10197
path = p.realpath(p.dirname(p.abspath(p.join(jupyter_server.__file__))))
10298
return pkg_info(path)
99+

jupyter_server/_tz.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# constant for zero offset
1414
ZERO = timedelta(0)
1515

16-
1716
class tzUTC(tzinfo):
1817
"""tzinfo object for UTC (zero offset)"""
1918

@@ -23,27 +22,21 @@ def utcoffset(self, d):
2322
def dst(self, d):
2423
return ZERO
2524

26-
2725
UTC = tzUTC()
2826

29-
3027
def utc_aware(unaware):
3128
"""decorator for adding UTC tzinfo to datetime's utcfoo methods"""
32-
3329
def utc_method(*args, **kwargs):
3430
dt = unaware(*args, **kwargs)
3531
return dt.replace(tzinfo=UTC)
36-
3732
return utc_method
3833

39-
4034
utcfromtimestamp = utc_aware(datetime.utcfromtimestamp)
4135
utcnow = utc_aware(datetime.utcnow)
4236

43-
4437
def isoformat(dt):
4538
"""Return iso-formatted timestamp
46-
39+
4740
Like .isoformat(), but uses Z for UTC instead of +00:00
4841
"""
49-
return dt.isoformat().replace("+00:00", "Z")
42+
return dt.isoformat().replace('+00:00', 'Z')

jupyter_server/_version.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99

1010
# Next beta/alpha/rc release: The version number for beta is X.Y.ZbN **without dots**.
1111

12-
version_info = (0, 2, 0, "")
13-
__version__ = ".".join(map(str, version_info[:3])) + "".join(version_info[3:])
12+
version_info = (0, 2, 0, '.dev0')
13+
__version__ = '.'.join(map(str, version_info[:3])) + ''.join(version_info[3:])

jupyter_server/auth/__main__.py

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,38 @@
55
import argparse
66
import sys
77

8-
98
def set_password(args):
10-
password = args.password
11-
while not password:
12-
password1 = getpass("" if args.quiet else "Provide password: ")
13-
password_repeat = getpass("" if args.quiet else "Repeat password: ")
14-
if password1 != password_repeat:
15-
print("Passwords do not match, try again")
16-
elif len(password1) < 4:
17-
print("Please provide at least 4 characters")
18-
else:
19-
password = password1
20-
21-
password_hash = passwd(password)
22-
cfg = BaseJSONConfigManager(config_dir=jupyter_config_dir())
23-
cfg.update("jupyter_server_config", {"ServerApp": {"password": password_hash,}})
24-
if not args.quiet:
25-
print("password stored in config dir: %s" % jupyter_config_dir())
9+
password = args.password
10+
while not password :
11+
password1 = getpass("" if args.quiet else "Provide password: ")
12+
password_repeat = getpass("" if args.quiet else "Repeat password: ")
13+
if password1 != password_repeat:
14+
print("Passwords do not match, try again")
15+
elif len(password1) < 4:
16+
print("Please provide at least 4 characters")
17+
else:
18+
password = password1
2619

20+
password_hash = passwd(password)
21+
cfg = BaseJSONConfigManager(config_dir=jupyter_config_dir())
22+
cfg.update('jupyter_server_config', {
23+
'ServerApp': {
24+
'password': password_hash,
25+
}
26+
})
27+
if not args.quiet:
28+
print("password stored in config dir: %s" % jupyter_config_dir())
2729

2830
def main(argv):
29-
parser = argparse.ArgumentParser(argv[0])
30-
subparsers = parser.add_subparsers()
31-
parser_password = subparsers.add_parser(
32-
"password", help="sets a password for your jupyter server"
33-
)
34-
parser_password.add_argument(
35-
"password",
36-
help="password to set, if not given, a password will be queried for (NOTE: this may not be safe)",
37-
nargs="?",
38-
)
39-
parser_password.add_argument(
40-
"--quiet", help="suppress messages", action="store_true"
41-
)
42-
parser_password.set_defaults(function=set_password)
43-
args = parser.parse_args(argv[1:])
44-
args.function(args)
45-
46-
31+
parser = argparse.ArgumentParser(argv[0])
32+
subparsers = parser.add_subparsers()
33+
parser_password = subparsers.add_parser('password', help='sets a password for your jupyter server')
34+
parser_password.add_argument("password", help="password to set, if not given, a password will be queried for (NOTE: this may not be safe)",
35+
nargs="?")
36+
parser_password.add_argument("--quiet", help="suppress messages", action="store_true")
37+
parser_password.set_defaults(function=set_password)
38+
args = parser.parse_args(argv[1:])
39+
args.function(args)
40+
4741
if __name__ == "__main__":
48-
main(sys.argv)
42+
main(sys.argv)

0 commit comments

Comments
 (0)