Skip to content
This repository has been archived by the owner on Jan 23, 2021. It is now read-only.

Commit

Permalink
Sheriff created by Factory & docs updated (#111)
Browse files Browse the repository at this point in the history
* Sheriff created by Factory & docs updated

* Rebase on top of master
  • Loading branch information
rmuhamed committed Dec 28, 2019
1 parent 15facb5 commit 40afcfc
Show file tree
Hide file tree
Showing 26 changed files with 938 additions and 37 deletions.
Binary file modified doc/build/doctrees/application.doctree
Binary file not shown.
Binary file modified doc/build/doctrees/domain.doctree
Binary file not shown.
Binary file modified doc/build/doctrees/environment.pickle
Binary file not shown.
Binary file modified doc/build/doctrees/index.doctree
Binary file not shown.
Binary file modified doc/build/doctrees/infrastructure.doctree
Binary file not shown.
Binary file modified doc/build/doctrees/introduction.doctree
Binary file not shown.
Binary file modified doc/build/doctrees/tools.doctree
Binary file not shown.
Binary file modified doc/build/doctrees/usage.doctree
Binary file not shown.
4 changes: 0 additions & 4 deletions doc/build/html/_static/basic.css
Original file line number Diff line number Diff line change
Expand Up @@ -672,10 +672,6 @@ div.code-block-caption + div > div.highlight > pre {
margin-top: 0;
}

div.doctest > div.highlight span.gp { /* gp: Generic.Prompt */
user-select: none;
}

div.code-block-caption span.caption-number {
padding: 0.1em 0.3em;
font-style: italic;
Expand Down
1 change: 0 additions & 1 deletion doc/build/html/_static/documentation_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ var DOCUMENTATION_OPTIONS = {
VERSION: '1.0.0',
LANGUAGE: 'None',
COLLAPSE_INDEX: false,
BUILDER: 'html',
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt',
Expand Down
6 changes: 3 additions & 3 deletions doc/build/html/_static/searchtools.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ var Search = {
if (results.length) {
var item = results.pop();
var listItem = $('<li style="display:none"></li>');
if (DOCUMENTATION_OPTIONS.BUILDER === 'dirhtml') {
if (DOCUMENTATION_OPTIONS.FILE_SUFFIX === '') {
// dirhtml builder
var dirname = item[0] + '/';
if (dirname.match(/\/index\/$/)) {
Expand Down Expand Up @@ -424,15 +424,15 @@ var Search = {
for (j = 0; j < _files.length; j++) {
file = _files[j];
if (!(file in scoreMap))
scoreMap[file] = {};
scoreMap[file] = {}
scoreMap[file][word] = o.score;
}
});

// create the mapping
for (j = 0; j < files.length; j++) {
file = files[j];
if (file in fileMap && fileMap[file].indexOf(word) === -1)
if (file in fileMap)
fileMap[file].push(word);
else
fileMap[file] = [word];
Expand Down
271 changes: 267 additions & 4 deletions doc/build/html/application.html

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions doc/build/html/domain.html
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ <h2>Outlaw<a class="headerlink" href="#outlaw" title="Permalink to this headline
<dd class="field-odd"><ul class="simple">
<li><p><strong>name</strong> (<em>String</em>) – Outlaw’s given name.</p></li>
<li><p><strong>email</strong> (<em>String</em>) – Outlaw’s email.</p></li>
<li><p><strong>id</strong> (<em>Optional</em><em>[</em><em>int</em><em>]</em>) – Outlaw’s id (optional)</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
Expand Down Expand Up @@ -504,12 +505,14 @@ <h1 class="logo"><a href="index.html">The Sheriff</a></h1>

<h3>Navigation</h3>
<ul>
<li class="toctree-l1"><a class="reference internal" href="introduction.html">The Sheriff</a></li>
<li class="toctree-l1"><a class="reference internal" href="introduction.html#introduction">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="introduction.html">Introduction</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="usage.html">The Sheriff Usage</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="tools.html">Tools</a></li>
</ul>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="application.html">The Sheriff Application</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">The Sheriff Domain</a><ul>
Expand Down
120 changes: 110 additions & 10 deletions doc/build/html/genindex.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/build/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ <h3 id="searchlabel">Quick search</h3>
&copy;2019, The Sheriff Team.

|
Powered by <a href="http://sphinx-doc.org/">Sphinx 2.3.1</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 2.2.0</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>

|
Expand Down
510 changes: 507 additions & 3 deletions doc/build/html/infrastructure.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/build/html/introduction.html
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ <h3 id="searchlabel">Quick search</h3>
&copy;2019, The Sheriff Team.

|
Powered by <a href="http://sphinx-doc.org/">Sphinx 2.3.1</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 2.2.0</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>

|
Expand Down
Binary file modified doc/build/html/objects.inv
Binary file not shown.
17 changes: 16 additions & 1 deletion doc/build/html/py-modindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,21 @@ <h1>Python Module Index</h1>
<td>&#160;&#160;&#160;
<a href="infrastructure.html#module-thesheriff.infrastructure"><code class="xref">thesheriff.infrastructure</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="infrastructure.html#module-thesheriff.infrastructure.controllers.gang_controller"><code class="xref">thesheriff.infrastructure.controllers.gang_controller</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="infrastructure.html#module-thesheriff.infrastructure.controllers.outlaw_controller"><code class="xref">thesheriff.infrastructure.controllers.outlaw_controller</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="infrastructure.html#module-thesheriff.infrastructure.controllers.raid_controller"><code class="xref">thesheriff.infrastructure.controllers.raid_controller</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
Expand Down Expand Up @@ -302,7 +317,7 @@ <h3 id="searchlabel">Quick search</h3>
&copy;2019, The Sheriff Team.

|
Powered by <a href="http://sphinx-doc.org/">Sphinx 2.3.1</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 2.2.0</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>

</div>
Expand Down
2 changes: 1 addition & 1 deletion doc/build/html/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ <h3>Related Topics</h3>
&copy;2019, The Sheriff Team.

|
Powered by <a href="http://sphinx-doc.org/">Sphinx 2.3.1</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 2.2.0</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>

</div>
Expand Down
2 changes: 1 addition & 1 deletion doc/build/html/searchindex.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/build/html/tools.html
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ <h3 id="searchlabel">Quick search</h3>
&copy;2019, The Sheriff Team.

|
Powered by <a href="http://sphinx-doc.org/">Sphinx 2.3.1</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 2.2.0</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>

|
Expand Down
2 changes: 1 addition & 1 deletion doc/build/html/usage.html
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ <h3 id="searchlabel">Quick search</h3>
&copy;2019, The Sheriff Team.

|
Powered by <a href="http://sphinx-doc.org/">Sphinx 2.3.1</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 2.2.0</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>

|
Expand Down
9 changes: 6 additions & 3 deletions thesheriff/application/raid/create_raid.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import inject
from datetime import datetime
from typing import List

import inject

from thesheriff.application.raid.request.create_raid_request import \
CreateRaidRequest
from thesheriff.domain.gang.gang import Gang
Expand All @@ -8,9 +11,9 @@
from thesheriff.domain.outlaw.repository.outlaw_repository \
import OutlawRepository
from thesheriff.domain.outlaw.sheriff import Sheriff
from thesheriff.domain.outlaw.sheriff_factory import SheriffFactory
from thesheriff.domain.raid.raid import Raid, DEFAULT_DATETIME_FORMAT
from thesheriff.domain.raid.repository.raid_repository import RaidRepository
from typing import List


class CreateRaid:
Expand Down Expand Up @@ -66,7 +69,7 @@ def __get_sheriff_or_fail(self, request: CreateRaidRequest) -> Sheriff:
if not outlaw:
raise Exception('Sheriff with id: {0} does not exist.'
.format(request.sheriff_id))
sheriff = Sheriff(outlaw.name, outlaw.email, outlaw.id)
sheriff = SheriffFactory.create(outlaw)
return sheriff

def __get_gang_or_fail(self, request: CreateRaidRequest) -> Gang:
Expand Down
2 changes: 2 additions & 0 deletions thesheriff/domain/outlaw/outlaw_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ def create(name: str, email: str, id: Optional[int] = None) -> Outlaw:
:type name: String
:param email: Outlaw's email.
:type email: String
:param id: Outlaw's id (optional)
:type id: Optional[int]
:return: The produced Outlaw.
:rtype: Outlaw
"""
Expand Down
16 changes: 16 additions & 0 deletions thesheriff/domain/outlaw/sheriff_factory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from thesheriff.domain.outlaw.outlaw import Outlaw
from thesheriff.domain.outlaw.sheriff import Sheriff


class SheriffFactory(Sheriff):
"""Class SheriffFactory produces Sheriffs.
"""

@staticmethod
def create(outlaw: Outlaw) -> Sheriff:
"""Method create, produces an Sheriff instance.
:param outlaw: Outlaw instance
:type outlaw: Outlaw
"""
return Sheriff(outlaw.name, outlaw.email, outlaw.id)

0 comments on commit 40afcfc

Please sign in to comment.