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

Commit72a126b

Browse files
committed
Merge branch 'mypy_types' of github.com:Frostmaine/bpython into mypy_types
2 parentsf884a60 +7ac9c13 commit72a126b

File tree

17 files changed

+109
-170
lines changed

17 files changed

+109
-170
lines changed

‎.github/workflows/build.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
continue-on-error:${{ matrix.python-version == 'pypy3' }}
1414
strategy:
1515
matrix:
16-
python-version:[3.6, 3.7, 3.8, 3.9, "3.10", pypy3]
16+
python-version:[3.7, 3.8, 3.9, "3.10", pypy3]
1717
steps:
1818
-uses:actions/checkout@v2
1919
with:

‎CHANGELOG.rst‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
11
Changelog
22
=========
33

4+
0.23
5+
----
6+
7+
General information:
8+
9+
New features:
10+
11+
Fixes:
12+
13+
* Support for Python 3.6 has been dropped.
14+
15+
0.22.1
16+
------
17+
18+
Fixes:
19+
20+
* #938: Fix missing dependency on typing_extensions.
21+
Thanks to Dustin Rodrigues
22+
423
0.22
524
----
625

‎README.rst‎

Lines changed: 52 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
:target:https://github.com/ambv/black
99

1010

11-
***********************************************************************
12-
bpython: A fancycursesinterface to the Python interactive interpreter
13-
***********************************************************************
11+
****************************************************************
12+
bpython: A fancy interface to the Python interactive interpreter
13+
****************************************************************
1414

1515
`bpython`_ is a lightweight Python interpreter that adds several features common
1616
to IDEs. These features include **syntax highlighting**, **expected parameter
@@ -34,11 +34,6 @@ etc.
3434
You can find more about bpython - including `full documentation`_ - at our
3535
`homepage`_.
3636

37-
..contents::
38-
:local:
39-
:depth: 1
40-
:backlinks: none
41-
4237
==========================
4338
Installation & Basic Usage
4439
==========================
@@ -56,71 +51,6 @@ Start bpython by typing ``bpython`` in your terminal. You can exit bpython by
5651
using the ``exit()`` command or by pressing control-D like regular interactive
5752
Python.
5853

59-
Installation via OS Package Manager
60-
-----------------------------------
61-
62-
The majority of desktop computer operating systems come with package management
63-
systems. If you use one of these OSes, you can install ``bpython`` using the
64-
package manager.
65-
66-
Ubuntu/Debian
67-
~~~~~~~~~~~~~
68-
Ubuntu/Debian family Linux users can install ``bpython`` using the ``apt``
69-
package manager, using the command with ``sudo`` privileges:
70-
71-
..code-block::bash
72-
73-
$ apt install bpython
74-
75-
In case you are using an older version, run
76-
77-
..code-block::bash
78-
79-
$ apt-get install bpython
80-
81-
Arch Linux
82-
~~~~~~~~~~
83-
Arch Linux uses ``pacman`` as the default package manager; you can use it to install ``bpython``:
84-
85-
..code-block::bash
86-
87-
$ pacman -S bpython
88-
89-
Fedora
90-
~~~~~~~~~~
91-
Fedora users can install ``bpython`` directly from the command line using ``dnf``.
92-
93-
..code-block::bash
94-
95-
$ dnf install bpython
96-
97-
Windows
98-
~~~~~~~
99-
**Caveats:** As ``bpython`` makes use of the ncurses library of\*nix-family operating systems,
100-
bpython on Windows is not officially supported and tested.
101-
102-
However, you may still use bpython on Windows using a workaround. In brief, you should install
103-
these two packages using ``pip``:
104-
105-
..code-block::bash
106-
107-
$ pip install bpython windows-curses
108-
109-
Then you should invoke a program called ``bpython-curses.exe`` instead of ``bpython.exe`` to use bpython:
110-
111-
..code-block::bash
112-
113-
$ bpython-curses
114-
115-
Mac OS
116-
~~~~~~
117-
Like Windows, Mac OS does not include a package manager by default. If you have installed any
118-
third-party package manager like MacPorts, you can install it via
119-
120-
..code-block::bash
121-
122-
$ sudo port install py-bpython
123-
12454
===================
12555
Features & Examples
12656
===================
@@ -177,69 +107,73 @@ bpython-urwid
177107

178108
* urwid
179109

180-
==========
181-
Known Bugs
182-
==========
183-
For known bugs please see bpython's `known issues and FAQ`_ page.
184110

185-
======================
186-
Contact & Contributing
187-
======================
188-
I hope you find it useful and please feel free to submit any bugs/patches
189-
suggestions to `Robert`_ or place them on the GitHub
190-
`issues tracker`_.
111+
===================================
112+
Installation via OS Package Manager
113+
===================================
191114

192-
For any other ways of communicating with bpython users and devs you can find us
193-
at the community page on the `project homepage`_, or in the `community`_.
115+
The majority of desktop computer operating systems come with package management
116+
systems. If you use one of these OSes, you can install ``bpython`` using the
117+
package manager.
194118

195-
Hope to see you there!
119+
Ubuntu/Debian
120+
-------------
121+
Ubuntu/Debian family Linux users can install ``bpython`` using the ``apt``
122+
package manager, using the command with ``sudo`` privileges:
196123

197-
===================
198-
CLI Windows Support
199-
===================
124+
..code-block::bash
200125
201-
Dependencies
202-
------------
203-
`Curses`_ Use the appropriate version compiled by Christoph Gohlke.
126+
$ apt install bpython
204127
205-
`pyreadline`_ Use the version in the cheeseshop.
128+
In case you are using an older version, run
206129

207-
Recommended
208-
-----------
209-
Obtain the less program from GnuUtils. This makes the pager work as intended.
210-
It can be obtained from cygwin or GnuWin32 or msys
130+
..code-block::bash
211131
212-
Current version is tested with
213-
------------------------------
214-
* Curses 2.2
215-
* pyreadline 1.7
132+
$ apt-get install bpython
216133
217-
Curses Notes
218-
------------
219-
The curses used has a bug where the colours are displayed incorrectly:
134+
Arch Linux
135+
----------
136+
Arch Linux uses ``pacman`` as the default package manager; you can use it to install ``bpython``:
220137

221-
* red is swapped with blue
222-
* cyan is swapped with yellow
138+
..code-block::bash
223139
224-
To correct this I have provided a windows.theme file.
140+
$ pacman -S bpython
225141
226-
This curses implementation has 16 colors (dark and light versions of the
227-
colours)
142+
Fedora
143+
------
144+
Fedora users can install ``bpython`` directly from the command line using ``dnf``.
228145

146+
..code-block::bash
229147
230-
============
231-
Alternatives
232-
============
148+
$ dnf install bpython
149+
150+
macOS
151+
-----
152+
macOS does not include a package manager by default. If you have installed any
153+
third-party package manager like MacPorts, you can install it via
154+
155+
..code-block::bash
233156
234-
`ptpython`_
157+
$ sudo port install py-bpython
235158
236-
`IPython`_
237159
238-
Feel free to get in touch if you know of any other alternatives that people
239-
may be interested to try.
160+
==========
161+
Known Bugs
162+
==========
163+
For known bugs please see bpython's `known issues and FAQ`_ page.
164+
165+
======================
166+
Contact & Contributing
167+
======================
168+
I hope you find it useful and please feel free to submit any bugs/patches
169+
suggestions to `Robert`_ or place them on the GitHub
170+
`issues tracker`_.
171+
172+
For any other ways of communicating with bpython users and devs you can find us
173+
at the community page on the `project homepage`_, or in the `community`_.
174+
175+
Hope to see you there!
240176

241-
.. _ptpython:https://github.com/jonathanslenders/ptpython
242-
.. _ipython:https://ipython.org/
243177
.. _homepage:http://www.bpython-interpreter.org
244178
.. _full documentation:http://docs.bpython-interpreter.org/
245179
.. _issues tracker:http://github.com/bpython/bpython/issues/

‎bpython/autocomplete.py‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -343,13 +343,14 @@ def format(self, word: str) -> str:
343343
returnafter_last_dot(word)
344344

345345

346+
def_safe_glob(pathname:str)->Iterator[str]:
347+
returnglob.iglob(glob.escape(pathname)+"*")
348+
349+
346350
classFilenameCompletion(BaseCompletionType):
347351
def__init__(self,mode:AutocompleteModes=AutocompleteModes.SIMPLE):
348352
super().__init__(False,mode)
349353

350-
defsafe_glob(self,pathname:str)->Iterator[str]:
351-
returnglob.iglob(glob.escape(pathname)+"*")
352-
353354
defmatches(
354355
self,cursor_offset:int,line:str,**kwargs:Any
355356
)->Optional[Set]:
@@ -359,7 +360,7 @@ def matches(
359360
matches=set()
360361
username=cs.word.split(os.path.sep,1)[0]
361362
user_dir=os.path.expanduser(username)
362-
forfilenameinself.safe_glob(os.path.expanduser(cs.word)):
363+
forfilenamein_safe_glob(os.path.expanduser(cs.word)):
363364
ifos.path.isdir(filename):
364365
filename+=os.path.sep
365366
ifcs.word.startswith("~"):
@@ -371,7 +372,6 @@ def locate(self, cursor_offset: int, line: str) -> Optional[LinePart]:
371372
returnlineparts.current_string(cursor_offset,line)
372373

373374
defformat(self,filename:str)->str:
374-
filename.rstrip(os.sep).rsplit(os.sep)[-1]
375375
ifos.sepinfilename[:-1]:
376376
returnfilename[filename.rindex(os.sep,0,-1)+1 :]
377377
else:
@@ -570,15 +570,15 @@ def matches(
570570
r=self.locate(cursor_offset,line)
571571
ifrisNone:
572572
returnNone
573-
ifargspec:
574-
matches= {
575-
f"{name}="
576-
fornameinargspec[1][0]
577-
ifisinstance(name,str)andname.startswith(r.word)
578-
}
579-
matches.update(
580-
name+"="fornameinargspec[1][4]ifname.startswith(r.word)
581-
)
573+
574+
matches= {
575+
f"{name}="
576+
fornameinargspec[1][0]
577+
ifisinstance(name,str)andname.startswith(r.word)
578+
}
579+
matches.update(
580+
name+"="fornameinargspec[1][4]ifname.startswith(r.word)
581+
)
582582
returnmatchesifmatcheselseNone
583583

584584
deflocate(self,cursor_offset:int,line:str)->Optional[LinePart]:

‎bpython/curtsies.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@
2424

2525
fromtypingimport (
2626
Any,
27+
Callable,
2728
Dict,
29+
Generator,
2830
List,
29-
Callable,
30-
Union,
31+
Optional,
3132
Sequence,
3233
Tuple,
33-
Optional,
34-
Generator,
34+
Union,
3535
)
36-
fromtyping_extensionsimportLiteral,Protocol
36+
fromtyping_extensionsimportProtocol
3737

3838
logger=logging.getLogger(__name__)
3939

‎bpython/curtsiesfrontend/interpreter.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def format(self, tokensource, outfile):
5555
fortoken,textintokensource:
5656
whiletokennotinself.f_strings:
5757
token=token.parent
58-
o+="{}\x03{}\x04".format(self.f_strings[token],text)
58+
o+=f"{self.f_strings[token]}\x03{text}\x04"
5959
outfile.write(parse(o.rstrip()))
6060

6161

‎bpython/curtsiesfrontend/repl.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2067,7 +2067,7 @@ def key_help_text(self):
20672067

20682068
max_func=max(len(func)forfunc,keyinpairs)
20692069
return"\n".join(
2070-
"{} : {}".format(func.rjust(max_func),key)forfunc,keyinpairs
2070+
f"{func.rjust(max_func)} :{key}"forfunc,keyinpairs
20712071
)
20722072

20732073
defget_session_formatted_for_file(self)->str:

‎bpython/formatter.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class BPythonFormatter(Formatter):
9999
def__init__(self,color_scheme,**options):
100100
self.f_strings= {}
101101
fork,vintheme_map.items():
102-
self.f_strings[k]="\x01{}".format(color_scheme[v])
102+
self.f_strings[k]=f"\x01{color_scheme[v]}"
103103
ifkisParenthesis:
104104
# FIXME: Find a way to make this the inverse of the current
105105
# background colour
@@ -114,7 +114,7 @@ def format(self, tokensource, outfile):
114114

115115
whiletokennotinself.f_strings:
116116
token=token.parent
117-
o+="{}\x03{}\x04".format(self.f_strings[token],text)
117+
o+=f"{self.f_strings[token]}\x03{text}\x04"
118118
outfile.write(o.rstrip())
119119

120120

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp