diff options
author | jwansek <eddie.atten.ea29@gmail.com> | 2022-01-20 18:51:27 +0000 |
---|---|---|
committer | jwansek <eddie.atten.ea29@gmail.com> | 2022-01-20 18:51:27 +0000 |
commit | 7e055c6eaf4291539c77932b29b8db0cc42c5d8c (patch) | |
tree | e59febf7e5ae32578e9455ff86942057013f4270 /ExampleSubmission | |
parent | e39f4203ca1c08827bfe9b9a35c2034d71703624 (diff) | |
download | Smarker-7e055c6eaf4291539c77932b29b8db0cc42c5d8c.tar.gz Smarker-7e055c6eaf4291539c77932b29b8db0cc42c5d8c.zip |
started work on templating
Diffstat (limited to 'ExampleSubmission')
-rw-r--r-- | ExampleSubmission/animals.py | 44 | ||||
-rw-r--r-- | ExampleSubmission/example.py | 146 | ||||
-rw-r--r-- | ExampleSubmission/test_dont_test_me.py | 12 |
3 files changed, 101 insertions, 101 deletions
diff --git a/ExampleSubmission/animals.py b/ExampleSubmission/animals.py index 10c1cb4..a8c76d8 100644 --- a/ExampleSubmission/animals.py +++ b/ExampleSubmission/animals.py @@ -1,22 +1,22 @@ -import datetime - -class Animal: - def __init__(self): - self.birthday = datetime.datetime.now() - - def move(self): - return "*moves*" - -class Dog(Animal): - def speak(self): - return "woof" - -class Cat(Animal): - def speak(self): - return "meow" - -class Kitten(Cat): - """nyaa~~~ - """ - def speak(self): - return "meow (but cuter)" +import datetime
+
+class Animal:
+ def __init__(self):
+ self.birthday = datetime.datetime.now()
+
+ def move(self):
+ return "*moves*"
+
+class Dog(Animal):
+ def speak(self):
+ return "woof"
+
+class Cat(Animal):
+ def speak(self):
+ return "meow"
+
+class Kitten(Cat):
+ """nyaa~~~
+ """
+ def speak(self):
+ return "meow (but cuter)"
diff --git a/ExampleSubmission/example.py b/ExampleSubmission/example.py index cc61122..af0331c 100644 --- a/ExampleSubmission/example.py +++ b/ExampleSubmission/example.py @@ -1,74 +1,74 @@ -# Eden Attenborough -# 12-01-21 - -import tkinter as tk -from dataclasses import dataclass - -class Application(tk.Tk): - """An example class, which implements a GUI by inheriting from tkinter.Tk - """ - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - - self.title("Hello World!") - - def a_method_with_defaults(self, n:str, arg_1 = "hello", arg_2 = "world", count:int = 3): - """Adds two strings together with a space between them. - - Args: - arg_1 (str, optional): The first string to add. Defaults to "hello". - arg_2 (str, optional): The second string to add. Defaults to "world". - - Returns: - str: A concatinated string. - """ - return "%s %s" % (arg_1, arg_2) - - def add(self, num1:int, num2:int) -> int: - """Adds two numbers together and returns the output - - Args: - num1 (int): The first number to add - num2 (int): The second number to add - - Returns: - int: The two numbers added together - """ - return num1 + num2 - -@dataclass -class MyDate: - year:int - month:int - day:int - - def __eq__(self, otherDate): - return self.year == otherDate.year and self.month == otherDate.month and self.day == otherDate.day - - def __str__(self): - "%d-%d-%4d" % (self.day, self.month, self.year) - - -# hello world! -def hello_world(times): - """Prints 'hello world!' to stdout. Prints it out `times` times. - - Args: - times (int): The number of times to print out hello world. - - Returns: - str: Hello world, repeated as many times as nessicary - """ - return "hello world! " * 3 - -def an_undocumented_function(): - return 3.14156 - -# kwonlyargs demo -def greet(*names, greeting="Hello"): - for name in names: - print(greeting, name) - -if __name__ == "__main__": - app = Application() +# Eden Attenborough
+# 12-01-21
+
+import tkinter as tk
+from dataclasses import dataclass
+
+class Application(tk.Tk):
+ """An example class, which implements a GUI by inheriting from tkinter.Tk
+ """
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+
+ self.title("Hello World!")
+
+ def a_method_with_defaults(self, n:str, arg_1 = "hello", arg_2 = "world", count:int = 3):
+ """Adds two strings together with a space between them.
+
+ Args:
+ arg_1 (str, optional): The first string to add. Defaults to "hello".
+ arg_2 (str, optional): The second string to add. Defaults to "world".
+
+ Returns:
+ str: A concatinated string.
+ """
+ return "%s %s" % (arg_1, arg_2)
+
+ def add(self, num1:int, num2:int) -> int:
+ """Adds two numbers together and returns the output
+
+ Args:
+ num1 (int): The first number to add
+ num2 (int): The second number to add
+
+ Returns:
+ int: The two numbers added together
+ """
+ return num1 + num2
+
+@dataclass
+class MyDate:
+ year:int
+ month:int
+ day:int
+
+ def __eq__(self, otherDate):
+ return self.year == otherDate.year and self.month == otherDate.month and self.day == otherDate.day
+
+ def __str__(self):
+ "%d-%d-%4d" % (self.day, self.month, self.year)
+
+
+# hello world!
+def hello_world(times):
+ """Prints 'hello world!' to stdout. Prints it out `times` times.
+
+ Args:
+ times (int): The number of times to print out hello world.
+
+ Returns:
+ str: Hello world, repeated as many times as nessicary
+ """
+ return "hello world! " * 3
+
+def an_undocumented_function():
+ return 3.14156
+
+# kwonlyargs demo
+def greet(*names, greeting="Hello"):
+ for name in names:
+ print(greeting, name)
+
+if __name__ == "__main__":
+ app = Application()
app.mainloop()
\ No newline at end of file diff --git a/ExampleSubmission/test_dont_test_me.py b/ExampleSubmission/test_dont_test_me.py index 511c713..808879c 100644 --- a/ExampleSubmission/test_dont_test_me.py +++ b/ExampleSubmission/test_dont_test_me.py @@ -1,7 +1,7 @@ -"""My default pytest will assume that all files prefixed with -'test' are test files. This file is here to make sure that -pytest only runs on the files it should run on. -""" - -def test_1(): +"""My default pytest will assume that all files prefixed with
+'test' are test files. This file is here to make sure that
+pytest only runs on the files it should run on.
+"""
+
+def test_1():
assert 1 == 2
\ No newline at end of file |