Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9ce9970

Browse files
committed
Avoid a potential import of fcntl
1 parent92c3d1f commit9ce9970

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

‎bpython/config.py‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# The MIT License
22
#
33
# Copyright (c) 2009-2015 the bpython authors.
4-
# Copyright (c) 2015-2020 Sebastian Ramacher
4+
# Copyright (c) 2015-2022 Sebastian Ramacher
55
#
66
# Permission is hereby granted, free of charge, to any person obtaining a copy
77
# of this software and associated documentation files (the "Software"), to deal
@@ -35,9 +35,13 @@
3535
fromxdgimportBaseDirectory
3636

3737
from .autocompleteimportAutocompleteModes
38-
from .curtsiesfrontend.parseimportCNAMES
3938

4039
default_completion=AutocompleteModes.SIMPLE
40+
# All supported letters for colors for themes
41+
#
42+
# Instead of importing it from .curtsiesfrontend.parse, we define them here to
43+
# avoid a potential import of fcntl on Windows.
44+
COLOR_LETTERS=tuple("krgybmcwd")
4145

4246

4347
classUnknownColorCode(Exception):
@@ -381,7 +385,7 @@ def load_theme(
381385
colors[k]=theme.get("syntax",k)
382386
else:
383387
colors[k]=theme.get("interface",k)
384-
ifcolors[k].lower()notinCNAMES:
388+
ifcolors[k].lower()notinCOLOR_LETTERS:
385389
raiseUnknownColorCode(k,colors[k])
386390

387391
# Check against default theme to see if all values are defined

‎bpython/curtsiesfrontend/parse.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
)
99
fromfunctoolsimportpartial
1010

11+
from ..configimportCOLOR_LETTERS
1112
from ..lazyreimportLazyReCompile
1213

1314

1415
COLORS=CURTSIES_COLORS+ ("default",)
15-
CNAMES=dict(zip("krgybmcwd",COLORS))
16+
CNAMES=dict(zip(COLOR_LETTERS,COLORS))
1617
# hack for finding the "inverse"
1718
INVERSE_COLORS= {
1819
CURTSIES_COLORS[idx]:CURTSIES_COLORS[

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp