From 8e553811e44c1fd6fc3124524638812d9a5c36d7 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Sat, 16 Jan 2016 23:33:06 -0800 Subject: [PATCH] Start to add personality and reviewer modules Change-Id: I687e810cf5e4c4d6212caa32a2ff659da4d34d8f --- nerdreviewer/personality.py | 26 +++++++++++++++++++++++++ nerdreviewer/reviewer.py | 39 +++++++++++++++++++++++++++++++++++++ requirements.txt | 2 +- 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 nerdreviewer/personality.py create mode 100644 nerdreviewer/reviewer.py diff --git a/nerdreviewer/personality.py b/nerdreviewer/personality.py new file mode 100644 index 0000000..21f5c83 --- /dev/null +++ b/nerdreviewer/personality.py @@ -0,0 +1,26 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import enum + + +class Mood(enum.Enum): + """Mood component of a reviewer.""" + + MEAN = "MEAN" + CARING = "CARING" + HAPPY = "HAPPY" + SLOTH = "SLOTH" + COMPLACENT = "COMPLACENT" + CAFFEINATED = "CAFFEINATED" + BUSY = "BUSY" + ANXIOUS = "ANXIOUS" diff --git a/nerdreviewer/reviewer.py b/nerdreviewer/reviewer.py new file mode 100644 index 0000000..0950147 --- /dev/null +++ b/nerdreviewer/reviewer.py @@ -0,0 +1,39 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import abc + +import six + + +@six.add_metaclass(abc.ABCMeta) +class Reviewer(object): + + def __init__(self, name=u"John Doe"): + self._name = name + + @property + def name(self): + """Name of this reviewer (if any).""" + return self._name + + @abc.abstractmethod + def review(self, a_review): + """Review some incoming review and return its analysis.""" + + @abc.abstractproperty + def description(self): + """Useful description of this reviewer (personality, type...).""" + + @abc.abstractproperty + def personality(self): + """Current personality profile/dict of this reviewer""" diff --git a/requirements.txt b/requirements.txt index 8d95edd..e8b35b7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,9 +4,9 @@ pbr>=1.6 # Apache-2.0 paramiko>=1.13.0 # LGPL +enum34;python_version=='2.7' or python_version=='2.6' or python_version=='3.3' # BSD jsonschema>=2.0.0,<3.0.0,!=2.5.0 # MIT netaddr>=0.7.12,!=0.7.16 # BSD notifier>=1.0.3 # Apache-2.0 -PyYAML>=3.1.0 sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3 # BSD six>=1.9.0