Skip to content
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

Add Black Formatter #162

Merged
merged 3 commits into from
Jan 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length = 88
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More details on why i did this here https://github.com/psf/black#line-length

extend-ignore = E203
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
repos:
- repo: https://github.com/psf/black
rev: 19.10b0
hooks:
- id: black
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
hooks:
Expand Down
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ model-mommy = "*"
tblib = "*"
mock = "*"
pre-commit = "*"
black = "==19.10b0"

[packages]
e1839a8 = {editable = true,path = "."}
76 changes: 69 additions & 7 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

from django.core import management

os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'
os.environ["DJANGO_SETTINGS_MODULE"] = "tests.settings"
if __name__ == "__main__":
management.execute_from_command_line()
39 changes: 19 additions & 20 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,27 @@
from setuptools import setup, find_packages

setup(
name='ona-tasking',
version=__import__('tasking').__version__,
description='A Django app that provides adds tasking to your Django '
'project.',
license='Apache 2.0',
author='Ona Kenya',
author_email='tech@ona.io',
url='https://github.com/onaio/tasking',
packages=find_packages(exclude=['docs', 'tests']),
name="ona-tasking",
version=__import__("tasking").__version__,
description="A Django app that provides adds tasking to your Django " "project.",
license="Apache 2.0",
author="Ona Kenya",
author_email="tech@ona.io",
url="https://github.com/onaio/tasking",
packages=find_packages(exclude=["docs", "tests"]),
install_requires=[
'Django >= 1.11.19, < 2.1',
'python-dateutil',
'markdown', # adds markdown support for browsable REST API
'django-filter', # for filtering in the API
'djangorestframework-gis', # for location model
'django_countries', # for location model
'django-mptt', # For MPTT
"Django >= 1.11.19, < 2.1",
"python-dateutil",
"markdown", # adds markdown support for browsable REST API
"django-filter", # for filtering in the API
"djangorestframework-gis", # for location model
"django_countries", # for location model
"django-mptt", # For MPTT
],
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 3.6',
'Framework :: Django',
'Framework :: Django :: 1.11',
"Programming Language :: Python",
"Programming Language :: Python :: 3.6",
"Framework :: Django",
"Framework :: Django :: 1.11",
],
)
4 changes: 2 additions & 2 deletions tasking/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"""

VERSION = (0, 3, 0)
__version__ = '.'.join(str(v) for v in VERSION)
__version__ = ".".join(str(v) for v in VERSION)
# pylint: disable=invalid-name
default_app_config = 'tasking.apps.TaskingConfig' # noqa
default_app_config = "tasking.apps.TaskingConfig" # noqa
4 changes: 3 additions & 1 deletion tasking/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ class TaskingConfig(AppConfig):
"""
Tasking App Config Class
"""
name = 'tasking'

name = "tasking"
app_label = "tasking"
verbose_name = _("Tasking")

Expand All @@ -21,6 +22,7 @@ def ready(self):
# pylint: disable=import-outside-toplevel
from django.conf import settings
import tasking.settings as defaults

for name in dir(defaults):
if name.isupper() and not hasattr(settings, name):
setattr(settings, name, getattr(defaults, name))
32 changes: 17 additions & 15 deletions tasking/common_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@
"""
from django.utils.translation import ugettext as _

TARGET_DOES_NOT_EXIST = _('The target content type does not exist.')
INVALID_TIMING_RULE = _('Invalid Timing Rule.')
RADIUS_MISSING = _('The Radius for Geopoint is missing.')
GEODETAILS_ONLY = _('Cannot Import Geopoint and Radius with Shapefile.')
SHAPEFILE_RADIUS = _('Cannot import Shapefile with radius.')
GEOPOINT_MISSING = _('The Geopoint for Radius is missing.')
CANT_EDIT_TASK = _('Cannot Change Task.')
NO_SHAPEFILE = _('Could not find the .shp in imported zip.')
MISSING_FILE = _('Either the .dbf , .shx or .shp file is missing.')
TARGET_DOES_NOT_EXIST = _("The target content type does not exist.")
INVALID_TIMING_RULE = _("Invalid Timing Rule.")
RADIUS_MISSING = _("The Radius for Geopoint is missing.")
GEODETAILS_ONLY = _("Cannot Import Geopoint and Radius with Shapefile.")
SHAPEFILE_RADIUS = _("Cannot import Shapefile with radius.")
GEOPOINT_MISSING = _("The Geopoint for Radius is missing.")
CANT_EDIT_TASK = _("Cannot Change Task.")
NO_SHAPEFILE = _("Could not find the .shp in imported zip.")
MISSING_FILE = _("Either the .dbf , .shx or .shp file is missing.")
UNNECESSARY_FILE = _(
'Uploaded an unnecessary file. Please make sure only a .shx , .shp and '
'.dbf file is being uploaded.'
"Uploaded an unnecessary file. Please make sure only a .shx , .shp and "
".dbf file is being uploaded."
)
INVALID_START_DATE = _("The start date cannnot be greater than the end date")
INVALID_END_DATE = _("The end date cannnot be lesser than the start date.")
MISSING_START_DATE = _(
"Cannot determine the start date. Please provide "
"either the start date or timing rule(s)"
)
INVALID_START_DATE = _('The start date cannnot be greater than the end date')
INVALID_END_DATE = _('The end date cannnot be lesser than the start date.')
MISSING_START_DATE = _('Cannot determine the start date. Please provide '
'either the start date or timing rule(s)')
INVALID_SHAPEFILE = _("Invalid shapefile")
NO_VALID_POLYGONS = _("No valid polygons in shapefile")
9 changes: 7 additions & 2 deletions tasking/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
"""
Custom exceptions for tasking
"""
from tasking.common_tags import (INVALID_SHAPEFILE, MISSING_FILE, NO_SHAPEFILE,
TARGET_DOES_NOT_EXIST, UNNECESSARY_FILE)
from tasking.common_tags import (
INVALID_SHAPEFILE,
MISSING_FILE,
NO_SHAPEFILE,
TARGET_DOES_NOT_EXIST,
UNNECESSARY_FILE,
)


class TargetDoesNotExist(Exception):
Expand Down