From 27e4ac217a08f01aca92ebbfa3b919334f850bec Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Fri, 5 Mar 2021 16:20:33 -0500 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=96=B0=E6=A0=BC=E5=BC=8F=E5=8C=96?= =?UTF-8?q?=E6=89=80=E6=9C=89=E7=9A=84=E4=BB=A3=E7=A0=81=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E4=B8=94=E5=AF=BC=E5=85=A5=E9=9C=80=E8=A6=81=E7=9A=84=E5=86=85?= =?UTF-8?q?=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sample/LoopClauses.py | 23 +++++++++++++++++++++++ sample/__init__.py | 1 + sample/core.py | 12 ++++++++++++ sample/helpers.py | 7 +++++++ setup.py | 25 +++++++++++++++++++++++++ tests/__init__.py | 0 tests/context.py | 7 +++++++ 7 files changed, 75 insertions(+) create mode 100644 sample/LoopClauses.py create mode 100644 sample/__init__.py create mode 100644 sample/core.py create mode 100644 sample/helpers.py create mode 100644 setup.py create mode 100644 tests/__init__.py create mode 100644 tests/context.py diff --git a/sample/LoopClauses.py b/sample/LoopClauses.py new file mode 100644 index 0000000..d436ec7 --- /dev/null +++ b/sample/LoopClauses.py @@ -0,0 +1,23 @@ +# for n in range(2, 10): +# for x in range(2, n): +# if n % x == 0: +# print(n, 'equals', x, '*', n // x) +# break +# else: +# # loop fell through without finding a factor +# print(n, 'is a prime number') +# +# # +# for num in range(2, 10): +# if num % 2 == 0: +# print("Found an even number", num) +# continue +# print("Found a number", num) + +# alphabet = ["A", "B", "C"] +# for x in alphabet: +# print(x) + +strOssez = "ossez.com" +for x in strOssez: + print(x) diff --git a/sample/__init__.py b/sample/__init__.py new file mode 100644 index 0000000..f4633fa --- /dev/null +++ b/sample/__init__.py @@ -0,0 +1 @@ +from .core import hmm \ No newline at end of file diff --git a/sample/core.py b/sample/core.py new file mode 100644 index 0000000..19bf06c --- /dev/null +++ b/sample/core.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +from . import helpers + +def get_hmm(): + """Get a thought.""" + return 'hmmm...' + + +def hmm(): + """Contemplation...""" + if helpers.get_answer(): + print(get_hmm()) diff --git a/sample/helpers.py b/sample/helpers.py new file mode 100644 index 0000000..dee6655 --- /dev/null +++ b/sample/helpers.py @@ -0,0 +1,7 @@ +def get_answer(): + """Get an answer.""" + + return True + + +print("Hello Python") diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..fa4722d --- /dev/null +++ b/setup.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +# Learn more: https://github.com/kennethreitz/setup.py + +from setuptools import setup, find_packages + + +with open('README.rst') as f: + readme = f.read() + +with open('LICENSE') as f: + license = f.read() + +setup( + name='sample', + version='0.1.0', + description='Sample Package Python Tutorials', + long_description=readme, + author='Kenneth Reitz', + author_email='me@kennethreitz.com', + url='https://github.com/kennethreitz/samplemod', + license=license, + packages=find_packages(exclude=('tests', 'docs')) +) + diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/context.py b/tests/context.py new file mode 100644 index 0000000..91de701 --- /dev/null +++ b/tests/context.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- + +import sys +import os +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + +import sample