-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b4b8047
commit 110e005
Showing
2 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
{{cookiecutter.package_name}}/{{cookiecutter.package_name}}/placeholder.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from abc import ABCMeta, abstractmethod | ||
|
||
""" | ||
Placeholder classes. | ||
Replace this module for the actual code. | ||
""" | ||
|
||
__author__ = '{{ cookiecutter.developer_name }}' | ||
__license__ = 'MIT' | ||
|
||
|
||
class AbstractPlaceholder(object): | ||
""" | ||
Placeholde for an abstract class. | ||
""" | ||
__metaclass__ = ABCMeta | ||
|
||
def __init__(self): | ||
pass | ||
|
||
@abstractmethod | ||
def method(self): | ||
""" | ||
An abstract method. | ||
""" | ||
raise NotImplementedError('The roll method must be implemented') | ||
|
||
|
||
class Placeholder(AbstractPlaceholder): | ||
""" | ||
An extension of the abstract placeholder. | ||
""" | ||
|
||
def __init__(self, data): | ||
super(Placeholder, self).__init__() | ||
self._field = data | ||
|
||
def __str__(self): | ||
return '%s' % self.field | ||
|
||
def __repr__(self): | ||
return '<class %s>(field=%r)' % \ | ||
(self.__class__.__name__, self.field) | ||
|
||
@property | ||
def field(self): | ||
""" | ||
A field in the placeholder class. | ||
:return: the field content | ||
""" | ||
return self._field | ||
|
||
@field.setter | ||
def field(self, field): | ||
self._field = field | ||
|
||
def method(self): | ||
pass |