Skip to content
This repository was archived by the owner on Apr 24, 2024. It is now read-only.

Commit f084fce

Browse files
committed
add empty docstrings
1 parent 9cc82e5 commit f084fce

22 files changed

Lines changed: 742 additions & 4 deletions

‎ec2stack/__init__.py‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212

1313

1414
def create_app(settings=None):
15+
"""
16+
17+
@param settings:
18+
@return:
19+
"""
1520
app = Flask(__name__)
1621

1722
if settings:
@@ -35,6 +40,11 @@ def create_app(settings=None):
3540

3641

3742
def _load_config_file():
43+
"""
44+
45+
46+
@return:
47+
"""
3848
config_file = os.path.join(
3949
os.path.expanduser('~'),
4050
'.ec2stack/ec2stack.conf'
@@ -47,6 +57,10 @@ def _load_config_file():
4757

4858

4959
def _valid_config_file(app):
60+
"""
61+
62+
@param app:
63+
"""
5064
for config_item in ['EC2STACK_BIND_ADDRESS', 'EC2STACK_PORT',
5165
'CLOUDSTACK_HOST', 'CLOUDSTACK_PORT',
5266
'CLOUDSTACK_PROTOCOL', 'CLOUDSTACK_PATH',
@@ -57,6 +71,11 @@ def _valid_config_file(app):
5771

5872

5973
def _load_database():
74+
"""
75+
76+
77+
@return:
78+
"""
6079
database_file = os.path.join(
6180
os.path.expanduser('~'),
6281
'.ec2stack/ec2stack.sqlite'

‎ec2stack/__main__.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99

1010
def main():
11+
"""
12+
13+
14+
"""
1115
app = ec2stack.create_app()
1216

1317
run_simple(

‎ec2stack/configure.py‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,33 @@
88

99

1010
def main():
11+
"""
12+
13+
14+
"""
1115
config_folder = _create_config_folder()
1216
_create_config_file(config_folder)
1317
_create_database()
1418

1519

1620
def _create_config_folder():
21+
"""
22+
23+
24+
@return:
25+
"""
1726
config_folder = os.path.join(os.path.expanduser('~'), '.ec2stack')
1827
if not os.path.exists(config_folder):
1928
os.makedirs(config_folder)
20-
os.chmod(config_folder, 0o700)
29+
os.chmod(config_folder, 0700)
2130
return config_folder
2231

2332

2433
def _create_config_file(config_folder):
34+
"""
35+
36+
@param config_folder:
37+
"""
2538
config_file = open(config_folder + '/ec2stack.conf', 'w+')
2639

2740
ec2stack_address = raw_input('EC2Stack bind address [0.0.0.0]: ')
@@ -102,6 +115,10 @@ def _create_config_file(config_folder):
102115

103116

104117
def _create_database():
118+
"""
119+
120+
121+
"""
105122
directory = os.path.join(os.path.dirname(__file__), '../migrations')
106123
config = AlembicConfig(os.path.join(
107124
directory,

‎ec2stack/controllers/default.py‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616

1717
@DEFAULT.route('/', methods=['POST'])
1818
def index():
19+
"""
20+
21+
22+
@return:
23+
"""
1924
try:
2025
response_data = _get_action(get('Action'))()
2126
return successful_response(**response_data)
@@ -24,6 +29,11 @@ def index():
2429

2530

2631
def _get_action(action):
32+
"""
33+
34+
@param action:
35+
@return: @raise Ec2stackError:
36+
"""
2737
actions = {
2838
'AttachVolume': volumes.attach_volume,
2939
'AuthorizeSecurityGroupEgress':
@@ -71,6 +81,11 @@ def _get_action(action):
7181

7282

7383
def register_secret_key():
84+
"""
85+
86+
87+
@return: @raise Ec2stackError:
88+
"""
7489
require_parameters({'AWSAccessKeyId', 'AWSSecretKey'})
7590
found_user = USERS.get(get('AWSAccessKeyId'))
7691
if found_user is None:
@@ -94,6 +109,11 @@ def register_secret_key():
94109

95110

96111
def remove_secret_key():
112+
"""
113+
114+
115+
@return: @raise Ec2stackError:
116+
"""
97117
require_parameters({'AWSAccessKeyId', 'AWSSecretKey'})
98118
accesskey = get('AWSAccessKeyId')
99119
secretkey = get('AWSSecretKey')
@@ -118,9 +138,19 @@ def remove_secret_key():
118138

119139
@DEFAULT.app_errorhandler(404)
120140
def not_found(err):
141+
"""
142+
143+
@param err:
144+
@return:
145+
"""
121146
return error_response('404', 'NotFound', 'Page not found')
122147

123148

124149
@DEFAULT.app_errorhandler(400)
125150
def bad_request(err):
151+
"""
152+
153+
@param err:
154+
@return:
155+
"""
126156
return error_response('400', 'BadRequest', 'Bad Request')

‎ec2stack/core.py‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,49 @@ class Service(object):
1818
__model__ = None
1919

2020
def _isinstance(self, model, raise_error=True):
21+
"""
22+
23+
@param model:
24+
@param raise_error:
25+
@return: @raise ValueError:
26+
"""
2127
valid_type = isinstance(model, self.__model__)
2228
if not valid_type and raise_error:
2329
raise ValueError('%s is not of type %s' % (model, self.__model__))
2430
return valid_type
2531

2632
def save(self, model):
33+
"""
34+
35+
@param model:
36+
@return:
37+
"""
2738
self._isinstance(model)
2839
DB.session.add(model)
2940
DB.session.commit()
3041
return model
3142

3243
def get(self, primarykey):
44+
"""
45+
46+
@param primarykey:
47+
@return:
48+
"""
3349
return self.__model__.query.get(primarykey)
3450

3551
def create(self, **kwargs):
52+
"""
53+
54+
@param kwargs:
55+
@return:
56+
"""
3657
return self.save(self.__model__(**kwargs))
3758

3859
def delete(self, model):
60+
"""
61+
62+
@param model:
63+
"""
3964
self._isinstance(model)
4065
DB.session.delete(model)
4166
DB.session.commit()

0 commit comments

Comments
 (0)