Skip to content

Commit

Permalink
Removed .pydocstylerc, added .pylintrc to MANIFEST.in, and ran black …
Browse files Browse the repository at this point in the history
…on remaining files
  • Loading branch information
ColinKennedy committed Jun 3, 2019
1 parent faba2a7 commit 0c17c91
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 60 deletions.
3 changes: 0 additions & 3 deletions .pydocstylerc

This file was deleted.

2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ graft src
graft ci
graft tests

exclude .pydocstylerc
exclude .pylintrc
exclude docs/spelling_wordlist.txt

include .bumpversion.cfg
Expand Down
68 changes: 35 additions & 33 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- encoding: utf-8 -*-

'''Install qwebtip to the user's computer.'''
"""Install qwebtip to the user's computer."""

from __future__ import absolute_import
from __future__ import print_function
Expand All @@ -19,53 +19,55 @@


def read(*names, **kwargs):
'''Get the contents of all of the file `names`.'''
"""Get the contents of all of the file `names`."""
with io.open(
join(dirname(__file__), *names),
encoding=kwargs.get('encoding', 'utf8')
join(dirname(__file__), *names), encoding=kwargs.get("encoding", "utf8")
) as file_:
return file_.read()


setup(
name='qwebtip',
version='0.1.0',
license='BSD 2-Clause License',
description='A Qt package that lets you use web URLs as tooltips in Qt widgets',
long_description='%s\n%s' % (
re.compile('^.. start-badges.*^.. end-badges', re.M | re.S).sub('', read('README.rst')),
re.sub(':[a-z]+:`~?(.*?)`', r'``\1``', read('CHANGELOG.rst'))
name="qwebtip",
version="0.1.0",
license="BSD 2-Clause License",
description="A Qt package that lets you use web URLs as tooltips in Qt widgets",
long_description="%s\n%s"
% (
re.compile("^.. start-badges.*^.. end-badges", re.M | re.S).sub(
"", read("README.rst")
),
re.sub(":[a-z]+:`~?(.*?)`", r"``\1``", read("CHANGELOG.rst")),
),
author='Colin Kennedy',
author_email='colinvfx@gmail.com',
url='https://github.com/ColinKennedy/qwebtip',
packages=find_packages('src'),
package_dir={'': 'src'},
py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')],
author="Colin Kennedy",
author_email="colinvfx@gmail.com",
url="https://github.com/ColinKennedy/qwebtip",
packages=find_packages("src"),
package_dir={"": "src"},
py_modules=[splitext(basename(path))[0] for path in glob("src/*.py")],
include_package_data=True,
zip_safe=False,
classifiers=[
# complete classifier list: http://pypi.python.org/pypi?%3Aaction=list_classifiers
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: Unix',
'Operating System :: POSIX',
'Operating System :: Microsoft :: Windows',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: Unix",
"Operating System :: POSIX",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
# uncomment if you test on these interpreters:
# 'Programming Language :: Python :: Implementation :: IronPython',
# 'Programming Language :: Python :: Implementation :: Jython',
# 'Programming Language :: Python :: Implementation :: Stackless',
'Topic :: Utilities',
"Topic :: Utilities",
],
keywords=[
# eg: 'keyword1', 'keyword2', 'keyword3',
Expand Down
4 changes: 0 additions & 4 deletions src/qwebtip/element_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@


class _BaseSelector(object):

"""Select some part of a URL and move the browser to that location."""

def __init__(self, url):
Expand Down Expand Up @@ -63,7 +62,6 @@ def get_url(self):


class Link(_BaseSelector):

"""A class that scrolls a browser to some clickable location."""

def setup(self, browser):
Expand Down Expand Up @@ -98,7 +96,6 @@ def load_top_of_page(browser, *args): # pylint: disable=unused-argument


class UnknownSelector(_BaseSelector):

"""A class that helps scrolls a browser for an undefined CSS selector.
This class is useful if you expect your documentation to change.
Expand Down Expand Up @@ -140,7 +137,6 @@ def setup(self, browser):


class UnknownHeaderSelector(UnknownSelector):

"""A class that helps scrolls a browser for an undefined CSS selector.
This class is useful if you expect your documentation to change.
Expand Down
1 change: 0 additions & 1 deletion src/qwebtip/qweburltip.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@


class SelfClosingBrowser(QtWebKit.QWebView): # pylint: disable=too-few-public-methods

"""Create a QWebView that closes itself when the cursor moves away from it."""

def __init__(self, parent=None):
Expand Down
2 changes: 1 addition & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
'''All tests for `qwebtip`.'''
"""All tests for `qwebtip`."""
36 changes: 19 additions & 17 deletions tests/test_basic.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

'''A series of tests to make sure our classes and functions work correctly.'''
"""A series of tests to make sure our classes and functions work correctly."""

# IMPORT STANDARD LIBRARIES
import unittest
Expand All @@ -19,31 +19,32 @@

class Behavior(unittest.TestCase):

'''All tests for creating a general browser widget.'''
"""All tests for creating a general browser widget."""

def setUp(self):
'''Since we make edits to certain classes, store their unbound methods.'''
self.backups = {'QLabel.eventFilter': QtWidgets.QLabel.eventFilter}
"""Since we make edits to certain classes, store their unbound methods."""
self.backups = {"QLabel.eventFilter": QtWidgets.QLabel.eventFilter}

def tearDown(self):
'''Restore any modified classes to their default state.'''
QtWidgets.QLabel.eventFilter = self.backups['QLabel.eventFilter']
"""Restore any modified classes to their default state."""
QtWidgets.QLabel.eventFilter = self.backups["QLabel.eventFilter"]

@staticmethod
def _make_fake_tooltip_event():
'''`QtGui.QHelpEvent`: Make a fake object to use for a tooltip.'''
"""`QtGui.QHelpEvent`: Make a fake object to use for a tooltip."""
fake_relative_position = QtCore.QPoint(40, 10)
fake_global_position = QtCore.QPoint(400, 100)

event = QtGui.QHelpEvent(
QtCore.QEvent.ToolTip, fake_relative_position, fake_global_position)
QtCore.QEvent.ToolTip, fake_relative_position, fake_global_position
)

return event

def test_apply_to_widget(self):
'''Check that adding our tooltip onto a widget works.'''
widget = QtWidgets.QLabel('some widget')
url = 'http://google.com'
"""Check that adding our tooltip onto a widget works."""
widget = QtWidgets.QLabel("some widget")
url = "http://google.com"
qweburltip.override_tool_tip(widget, url)
widget.installEventFilter(widget)
result = widget.eventFilter(widget, self._make_fake_tooltip_event())
Expand All @@ -52,21 +53,22 @@ def test_apply_to_widget(self):
self.assertTrue(result)

def test_parent_event_filter(self):
'''Check that the original widget's parent class still calls `eventFilter`.'''
"""Check that the original widget's parent class still calls `eventFilter`."""

def acknowledgement(self, obj, event, data): # pylint: disable=unused-argument
'''Check if this function has been run, using `data`.'''
data['ran'] = True
"""Check if this function has been run, using `data`."""
data["ran"] = True
return False

data = dict()
widget = QtWidgets.QLabel('some widget')
widget = QtWidgets.QLabel("some widget")

widget.__class__.eventFilter = functools.partial(acknowledgement, data=data)

url = 'http://google.com'
url = "http://google.com"
qweburltip.override_tool_tip(widget, url)
widget.installEventFilter(widget)
widget.eventFilter(widget, self._make_fake_tooltip_event())

# This is true if a tooltip was requested
self.assertTrue(data.get('ran', False))
self.assertTrue(data.get("ran", False))

0 comments on commit 0c17c91

Please sign in to comment.