-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Patch stash to run with Pythonista 3.4 beta #463
Changes from 11 commits
2615d90
11a25af
ad86d45
9aff137
b722d71
cb96166
73ed7f3
b3b17e5
e160367
ff0b99a
b002219
f882779
8d9e5a3
9c5fac1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Check code and run tests | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["2.7", "3.6", "3.8"] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip wheel setuptools | ||
pip install ".[testing]" | ||
- name: Analysing the code with flake8 | ||
run: | | ||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics | ||
- name: Running tests | ||
run: | | ||
py.test --version | ||
# make install test work... | ||
export PYTHONPATH=$(python -m site --user-site) | ||
pytest tests/ --ignore=tests/system/data/ --showlocals --verbose --show-capture=all --log-level=debug |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -261,9 +261,16 @@ def status(self): | |||||||||||||||||||
# False | not None | stopped | ||||||||||||||||||||
# True | None | impossible | ||||||||||||||||||||
# True | not None | running | ||||||||||||||||||||
if self.isAlive(): | ||||||||||||||||||||
|
||||||||||||||||||||
# `Thread.isAlive()` was removed in Python 3.9 | ||||||||||||||||||||
if hasattr(self, 'is_alive'): | ||||||||||||||||||||
is_alive = self.is_alive() | ||||||||||||||||||||
else: | ||||||||||||||||||||
is_alive = self.isAlive() | ||||||||||||||||||||
|
||||||||||||||||||||
if is_alive: | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||
return self.STARTED | ||||||||||||||||||||
elif (not self.is_alive()) and (self.ident is not None): | ||||||||||||||||||||
elif (not is_alive) and (self.ident is not None): | ||||||||||||||||||||
bennr01 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||
return self.STOPPED | ||||||||||||||||||||
else: | ||||||||||||||||||||
return self.CREATED | ||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -385,14 +385,14 @@ def _vk_tapped(self, sender): | |||||||||||||||||||||
# noinspection PyAttributeOutsideInit,PyUnusedLocal,PyPep8Naming | ||||||||||||||||||||||
class ShTerminal(ShBaseTerminal): | ||||||||||||||||||||||
""" | ||||||||||||||||||||||
This is a wrapper class of the actual TextView that subclass the SUITextView. | ||||||||||||||||||||||
This is a wrapper class of the actual TextView that subclass the SUITextView/SUITextView_PY3. | ||||||||||||||||||||||
The wrapper is used to encapsulate the objc calls so that it behaves more like | ||||||||||||||||||||||
a regular ui.TextView. | ||||||||||||||||||||||
""" | ||||||||||||||||||||||
|
||||||||||||||||||||||
def __init__(self, stash, parent, superview, width, height): | ||||||||||||||||||||||
|
||||||||||||||||||||||
# Create the actual TextView by subclass SUITextView | ||||||||||||||||||||||
# Create the actual TextView by subclass SUITextView/SUITextView_PY3 | ||||||||||||||||||||||
UIKeyCommand = ObjCClass('UIKeyCommand') | ||||||||||||||||||||||
|
||||||||||||||||||||||
def kcDispatcher_(_self, _cmd, _sender): | ||||||||||||||||||||||
|
@@ -490,7 +490,10 @@ def keyCommands(_self, _cmd): | |||||||||||||||||||||
('UIKeyInputRightArrow', 0): parent.arrowRightAction, | ||||||||||||||||||||||
} | ||||||||||||||||||||||
|
||||||||||||||||||||||
_ShTerminal = create_objc_class('_ShTerminal', ObjCClass('SUITextView'), [keyCommands, kcDispatcher_]) | ||||||||||||||||||||||
try: | ||||||||||||||||||||||
_ShTerminal = create_objc_class('_ShTerminal', ObjCClass('SUITextView'), [keyCommands, kcDispatcher_]) | ||||||||||||||||||||||
except ValueError: | ||||||||||||||||||||||
_ShTerminal = create_objc_class('_ShTerminal', ObjCClass('SUITextView_PY3'), [keyCommands, kcDispatcher_]) | ||||||||||||||||||||||
|
||||||||||||||||||||||
self.is_editing = False | ||||||||||||||||||||||
|
||||||||||||||||||||||
|
@@ -883,7 +886,7 @@ def _build_attributed_string(self, chars): | |||||||||||||||||||||
|
||||||||||||||||||||||
def render(self, no_wait=False): | ||||||||||||||||||||||
""" | ||||||||||||||||||||||
Render the screen buffer to the UITextView. Normally the rendering process | ||||||||||||||||||||||
Render the screen buffer to the SUITextView/SUITextView_PY3. Normally the rendering process | ||||||||||||||||||||||
is delayed to throttle the total attempts of rendering. | ||||||||||||||||||||||
:param bool no_wait: Immediately render the screen without delay. | ||||||||||||||||||||||
""" | ||||||||||||||||||||||
|
@@ -894,7 +897,15 @@ def render(self, no_wait=False): | |||||||||||||||||||||
self.render_thread.cancel() | ||||||||||||||||||||||
self._render() | ||||||||||||||||||||||
else: # delayed rendering | ||||||||||||||||||||||
if self.render_thread is None or not self.render_thread.isAlive(): | ||||||||||||||||||||||
# `Thread.isAlive()` was removed in Python 3.9 | ||||||||||||||||||||||
is_render_thread_alive = None | ||||||||||||||||||||||
if self.render_thread is not None: | ||||||||||||||||||||||
if hasattr(self.render_thread, 'is_alive'): | ||||||||||||||||||||||
is_render_thread_alive = self.render_thread.is_alive() | ||||||||||||||||||||||
else: | ||||||||||||||||||||||
is_render_thread_alive = self.render_thread.isAlive() | ||||||||||||||||||||||
|
||||||||||||||||||||||
if self.render_thread is None or not is_render_thread_alive: | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
self.render_thread = sh_delay(self._render, self.RENDER_INTERVAL) | ||||||||||||||||||||||
# Do nothing if there is already a delayed rendering thread waiting | ||||||||||||||||||||||
|
||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is deprecated to run pytest with the dot.