Created
June 14, 2017 09:45
-
-
Save taoy/49be252ffd021d359076917d8ca81588 to your computer and use it in GitHub Desktop.
Python class script for import with instant interactive shell
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
from __future__ import print_function | |
from __future__ import unicode_literals | |
import logging | |
logger = logging.getLogger(__name__) | |
__author__ = 'TAO Yuichi' | |
class SampleObject(object): | |
"""SampleObject's main class. | |
""" | |
def __init__(self, params): | |
logger.debug('SampleObject: Initialized') | |
self.params = params | |
def some_func(self, user, query): | |
"""Some Function example. | |
:param user: user's id | |
:type user: string | |
:param query: query for user. | |
:type query: string | |
""" | |
return (user, query) | |
def run(self): | |
from fire import Fire | |
self.context = Fire() | |
import bpython | |
bpython.embed(locals_=self.context) | |
def main(): | |
SomeClass = SampleObject() | |
SomeClass.run() | |
# If run as a script | |
if __name__ == '__main__': | |
main() | |
# vim:set sw=4 ts=4 sts=4 expandtab foldmethod=indent foldlevel=1: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment