This repository has been archived by the owner on Jan 5, 2019. It is now read-only.
-
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
Showing
9 changed files
with
79 additions
and
73 deletions.
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
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
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
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,14 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from app.fake_data.pilots import data | ||
|
||
|
||
def get_pilots(name=None): | ||
if name: | ||
return [x for x in data if x['name'] == name] | ||
|
||
return data | ||
|
||
|
||
def get_pilot(pilot_id): | ||
return next((x for x in data if x['id'] == int(pilot_id)), {}) |
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
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,37 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from app.fake_data.planes import data | ||
|
||
|
||
def get_planes(min_wings=None): | ||
return [x for x in data if x['wings'] >= min_wings] | ||
|
||
|
||
def get_plane(plane_id): | ||
return next((x for x in data if x['id'] == int(plane_id)), {}) | ||
|
||
|
||
def create_plane(plane): | ||
data.append(plane) | ||
return plane | ||
|
||
|
||
def update_plane(plane_id, plane): | ||
if not get_plane(plane_id): | ||
return {} | ||
else: | ||
for i, item in enumerate(data): | ||
if item['id'] == int(plane_id): | ||
data[i] = plane | ||
|
||
return plane | ||
|
||
|
||
def delete_plane(plane_id): | ||
deleted = False | ||
for i, item in enumerate(data): | ||
if item['id'] == int(plane_id): | ||
deleted = True | ||
del data[i] | ||
|
||
return {'success': deleted} |
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
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
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