s-num lines-num-old"> 32
+    def increment_odometer(self, miles):
33
+        """Add the given amount to the odometer reading."""
34
+        self.odometer_reading += miles

+ 27 - 0
chapter_09/dog.py

@@ -0,0 +1,27 @@
1
+class Dog():
2
+    """A simple attempt to model a dog."""
3
+    
4
+    def __init__(self, name, age):
5
+        """Initialize name and age attributes."""
6
+        self.name = name
7
+        self.age = age
8
+        
9
+    def sit(self):
10
+        """Simulate a dog sitting in response to a command."""
11
+        print(self.name.title() + " is now sitting.")
12
+
13
+    def roll_over(self):
14
+        """Simulate rolling over in response to a command."""
15
+        print(self.name.title() + " rolled over!")
16
+        
17
+
18
+my_dog = Dog('willie', 6)
19
+your_dog = Dog('lucy', 3)
20
+
21
+print("My dog's name is " + my_dog.name.title() + ".")
22
+print("My dog is " + str(my_dog.age) + " years old.")
23
+my_dog.sit()
24
+
25
+print("\nMy dog's name is " + your_dog.name.title() + ".")
26
+print("My dog is " + str(your_dog.age) + " years old.")
27
+your_dog.sit()

+ 37 - 0
chapter_09/electric_car.py

@@ -0,0 +1,37 @@
1
+"""A set of classes that can be used to represent electric cars."""
2
+
3
+from car import Car
4
+
5
+class Battery():
6
+    """A simple attempt to model a battery for an electric car."""
7
+
8
+    def __init__(self, battery_size=60):
9
+        """Initialize the batteery's attributes."""
10
+        self.battery_size = battery_size
11
+
12
+    def describe_battery(self):
13
+        """Print a statement describing the battery size."""
14
+        print("This car has a " + str(self.battery_size) + "-kWh battery.")  
15
+        
16
+    def get_range(self):
17
+        """Print a statement about the range this battery provides."""
18
+        if self.battery_size == 60:
19
+            range = 140
20
+        elif self.battery_size == 85:
21
+            range = 185
22
+            
23
+        message = "This car can go approximately " + str(range)
24
+        message += " miles on a full charge."
25
+        print(message)
26
+    
27
+        
28
+class ElectricCar(Car):
29
+    """Models aspects of a car, specific to electric vehicles."""
30
+
31
+    def __init__(self, manufacturer, model, year):
32
+        """
33
+        Initialize attributes of the parent class.
34
+        Then initialize attributes specific to an electric car.
35
+        """
36
+        super().__init__(manufacturer, model, year)
37
+        self.battery = Battery()

+ 12 - 0
chapter_09/favorite_languages.py

@@ -0,0 +1,12 @@
1
+from collections import OrderedDict
2
+
3
+favorite_languages = OrderedDict()
4
+
5
+favorite_languages['jen'] = 'python'
6
+favorite_languages['sarah'] = 'c'
7
+favorite_languages['edward'] = 'ruby'
8
+favorite_languages['phil'] = 'python'
9
+
10
+for name, language in favorite_languages.items():
11
+    print(name.title() + "'s favorite language is " +
12
+        language.title() + ".")

+ 7 - 0
chapter_09/my_car.py

@@ -0,0 +1,7 @@
1
+from car import Car
2
+
3
+my_new_car = Car('audi', 'a4', 2015)
4
+print(my_new_car.get_descriptive_name())
5
+
6
+my_new_car.odometer_reading = 23
7
+my_new_car.read_odometer()

+ 8 - 0
chapter_09/my_cars.py

@@ -0,0 +1,8 @@
1
+from car import Car
2
+from electric_car import ElectricCar
3
+
4
+my_beetle = Car('volkswagen', 'beetle', 2015)
5
+print(my_beetle.get_descriptive_name())
6
+
7
+my_tesla = ElectricCar('tesla', 'roadster', 2015)
8
+print(my_tesla.get_descriptive_name())

+ 13 - 0
chapter_10/alice.py

@@ -0,0 +1,13 @@
1
+filename = 'alice.txt'
2
+
3
+try:
4
+    with open(filename, encoding='utf-8') as f_obj:
5
+        contents = f_obj.read()
6
+except FileNotFoundError as e:
7
+    msg = "Sorry, the file " + filename + " does not exist."
8
+    print(msg)
9
+else:
10
+    # Count the approximate number of words in the file.
11
+    words = contents.split()
12
+    num_words = len(words)
13
+    print("The file " + filename + " has about " + str(num_words) + " words.")

Файловите разлики са ограничени, защото са твърде много
+ 3735 - 0
chapter_10/alice.txt


+ 14 - 0
chapter_10/division.py

@@ -0,0 +1,14 @@
1
+print("Give me two numbers, and I'll divide them.")
2
+print("Enter 'q' to quit.")
3
+
4
+while True:
5
+    first_number = input("\nFirst number: ")
6
+    if first_number == 'q':
7
+        break
8
+    second_number = input("Second number: ")
9
+    try:
10
+        answer = int(first_number) / int(second_number)
11
+    except ZeroDivisionError:
12
+        print("You can't divide by 0!")
13
+    else:
14
+        print(answer)

+ 7 - 0
chapter_10/file_reader.py

@@ -0,0 +1,7 @@
1
+filename = 'pi_digits.txt'
2
+
3
+with open(filename) as file_object:
4
+    lines = file_object.readlines()
5
+
6
+for line in lines:
7
+    print(line.rstrip())

+ 7 - 0
chapter_10/greet_user.py

@@ -0,0 +1,7 @@
1
+import json
2
+
3
+filename = 'username.json'
4
+
5
+with open(filename) as f_obj:
6
+    username = json.load(f_obj)
7
+    print("Welcome back, " + username + "!")

Файловите разлики са ограничени, защото са твърде много
+ 21022 - 0
chapter_10/little_women.txt


Файловите разлики са ограничени, защото са твърде много
+ 22108 - 0
chapter_10/moby_dick.txt


+ 7 - 0
chapter_10/number_reader.py

@@ -0,0 +1,7 @@
1
+import json
2
+
3
+filename = 'numbers.json'
4
+with open(filename) as file_object:
5
+    numbers = json.load(file_object)
6
+    
7
+print(numbers)

+ 7 - 0
chapter_10/number_writer.py

@@ -0,0 +1,7 @@
1
+import json
2
+
3
+numbers = [2, 3, 5, 7, 11, 13]
4
+
5
+filename = 'numbers.json'
6
+with open(filename, 'w') as file_object:
7
+    json.dump(numbers, file_object)

+ 1 - 0
chapter_10/numbers.json

@@ -0,0 +1 @@
1
+[2, 3, 5, 7, 11, 13]

+ 3 - 0
chapter_10/pi_30_digits.txt

@@ -0,0 +1,3 @@
1
+3.1415926535
2
+  8979323846
3
+  2643383279

+ 3 - 0
chapter_10/pi_digits.txt

@@ -0,0 +1,3 @@
1
+3.1415926535
2
+  8979323846
3
+  2643383279

Файловите разлики са ограничени, защото са твърде много
+ 10000 - 0
chapter_10/pi_million_digits.txt


+ 14 - 0
chapter_10/pi_string.py

@@ -0,0 +1,14 @@
1
+filename = 'pi_million_digits.txt'
2
+
3
+with open(filename) as file_object:
4
+    lines = file_object.readlines()
5
+
6
+pi_string = ''
7
+for line in lines:
8
+    pi_string += line.rstrip()
9
+
10
+birthday = input("Enter your birthday, in the form mmddyy: ")
11
+if birthday in pi_string:
12
+    print("Your birthday appears in the first million digits of pi!")
13
+else:
14
+    print("Your birthday does not appear in the first million digits of pi.")

+ 4 - 0
chapter_10/programming.txt

@@ -0,0 +1,4 @@
1
+I love programming.
2
+I love creating new games.
3
+I also love finding meaning in large datasets.
4
+I love creating apps that can run in a browser.

+ 31 - 0
chapter_10/remember_me.py

@@ -0,0 +1,31 @@
1
+import json
2
+
3
+def get_stored_username():
4
+    """Get stored username if available."""
5
+    filename = 'username.json'
6
+    try:
7
+        with open(filename) as f_obj:
8
+            username = json.load(f_obj)
9
+    except FileNotFoundError:
10
+        return None
11
+    else:
12
+        return username
13
+
14
+def get_new_username():
15
+    """Prompt for a new username."""
16
+    username = input("What is your name? ")
17
+    filename = 'username.json'
18
+    with open(filename, 'w') as f_obj:
19
+        json.dump(username, f_obj)
20
+    return username
21
+
22
+def greet_user():
23
+    """Greet the user by name."""
24
+    username = get_stored_username()
25
+    if username:
26
+        print("Welcome back, " + username + "!")
27
+    else:
28
+        username = get_new_username()
29
+        print("We'll remember you when you come back, " + username + "!")
30
+
31
+greet_user()

Файловите разлики са ограничени, защото са твърде много
+ 4319 - 0
chapter_10/siddhartha.txt


+ 16 - 0
chapter_10/word_count.py

@@ -0,0 +1,16 @@
1
+def count_words(filename):
2
+    """Count the approximate number of words in a file."""
3
+    try:
4
+        with open(filename, encoding='utf-8') as f_obj:
5
+            contents = f_obj.read() 
6
+    except FileNotFoundError:
7
+        pass
8
+    else:
9
+        # Count approximate number of words in the file.
10
+        words = contents.split()
11
+        num_words = len(words)
12
+        print("The file " + filename + " has about " + str(num_words) + " words.")
13
+
14
+filenames = ['alice.txt', 'siddhartha.txt', 'moby_dick.txt', 'little_women.txt']
15
+for filename in filenames:
16
+    count_words(filename)

+ 5 - 0
chapter_10/write_message.py

@@ -0,0 +1,5 @@
1
+filename = 'programming.txt'
2
+
3
+with open(filename, 'a') as file_object:
4
+    file_object.write("I also love finding meaning in large datasets.\n")
5
+    file_object.write("I love creating apps that can run in a browser.\n")

+ 18 - 0
chapter_11/language_survey.py

@@ -0,0 +1,18 @@
1
+from survey import AnonymousSurvey
2
+
3
+# Define a question, and make a survey object.
4
+question = "What language did you first learn to speak?"
5
+my_survey = AnonymousSurvey(question)
6
+
7
+# Show the question, and store responses to the question.
8
+my_survey.show_question()
9
+print("Enter 'q' at any time to quit.\n")
10
+while True:
11
+    response = input("Language: ")
12
+    if response == 'q':
13
+        break
14
+    my_survey.store_response(response)
15
+
16
+# Show the survey results.
17
+print("\nThank you to everyone who participated in the survey!")
18
+my_survey.show_results()

+ 7 - 0
chapter_11/name_function.py

@@ -0,0 +1,7 @@
1
+def get_formatted_name(first, last, middle=''):
2
+    """Generate a neatly-formatted full name."""
3
+    if middle:
4
+        full_name = first + ' ' + middle + ' ' + last
5
+    else:
6
+        full_name = first + ' ' + last
7
+    return full_name.title()

+ 14 - 0
chapter_11/names.py

@@ -0,0 +1,14 @@
1
+from name_function import get_formatted_name
2
+
3
+print("Enter 'q' at any time to quit.")
4
+while True:
5
+    first = input("\nPlease give me a first name: ")
6
+    if first == 'q':
7
+        break
8
+        
9
+    last = input("Please give me a last name: ")
10
+    if last == 'q':
11
+        break
12
+        
13
+    formatted_name = get_formatted_name(first, last)
14
+    print("\tNeatly formatted name: " + formatted_name + '.')

+ 21 - 0
chapter_11/survey.py

@@ -0,0 +1,21 @@
1
+class AnonymousSurvey():
2
+    """Collect anonymous answers to a survey question."""
3
+    
4
+    def __init__(self, question):
5
+        """Store a question, and prepare to store responses."""
6
+        self.question = question
7
+        self.responses = []
8
+        
9
+    def show_question(self):
10
+        """Show the survey question."""
11
+        print(self.question)
12
+        
13
+    def store_response(self, new_response):
14
+        """Store a single response to the survey."""
15
+        self.responses.append(new_response)
16
+        
17
+    def show_results(self):
18
+        """Show all the responses that have been given."""
19
+        print("Survey results:")
20
+        for response in self.responses:
21
+            print('- ' + response)

+ 17 - 0
chapter_11/test_name_function.py

@@ -0,0 +1,17 @@
1
+import unittest
2
+from name_function import get_formatted_name
3
+
4
+class NamesTestCase(unittest.TestCase):
5
+    """Tests for 'name_function.py'."""
6
+    
7
+    def test_first_last_name(self):
8
+        formatted_name = get_formatted_name('janis', 'joplin')
9
+        self.assertEqual(formatted_name, 'Janis Joplin')
10
+        
11
+    def test_first_last_middle_name(self):
12
+        formatted_name = get_formatted_name(
13
+            'wolfgang', 'mozart', 'amadeus')
14
+        self.assertEqual(formatted_name, 'Wolfgang Amadeus Mozart')
15
+            
16
+
17
+unittest.main()

+ 30 - 0
chapter_11/test_survey.py

@@ -0,0 +1,30 @@
1
+import unittest
2
+from survey import AnonymousSurvey
3
+
4
+class TestAnonymousSurvey(unittest.TestCase):
5
+    """Tests for the class AnonymousSurvey."""
6
+    
7
+    def setUp(self):
8
+        """
9
+        Create a survey and a set of responses for use in all test methods.
10
+        """
11
+        question = "What language did you first learn to speak?"
12
+        self.my_survey = AnonymousSurvey(question)
13
+        self.responses = ['English', 'Spanish', 'Mandarin']
14
+        
15
+    
16
+    def test_store_single_response(self):
17
+        """Test that a single response is stored properly."""
18
+        self.my_survey.store_response(self.responses[0])
19
+        self.assertIn(self.responses[0], self.my_survey.responses)
20
+        
21
+        
22
+    def test_store_three_responses(self):
23
+        """Test that three individual responses are stored properly."""
24
+        for response in self.responses:
25
+            self.my_survey.store_response(response)
26
+        for response in self.responses:
27
+            self.assertIn(response, self.my_survey.responses)
28
+            
29
+
30
+unittest.main()

Файловите разлики са ограничени, защото са твърде много
+ 114 - 0
chapter_12/README.md


+ 31 - 0
chapter_12/alien_invasion.py

@@ -0,0 +1,31 @@
1
+import pygame
2
+from pygame.sprite import Group
3
+
4
+from settings import Settings
5
+from ship import Ship
6
+import game_functions as gf
7
+
8
+def run_game():
9
+    # Initialize pygame, settings, and screen object.
10
+    pygame.init()
11
+    ai_settings = Settings()
12
+    screen = pygame.display.set_mode(
13
+        (ai_settings.screen_width, ai_settings.screen_height))
14
+    pygame.display.set_caption("Alien Invasion")
15
+    
16
+    # Set the background color.
17
+    bg_color = (230, 230, 230)
18
+    
19
+    # Make a ship.
20
+    ship = Ship(ai_settings, screen)
21
+    # Make a group to store bullets in.
22
+    bullets = Group()
23
+
24
+    # Start the main loop for the game.
25
+    while True:
26
+        gf.check_events(ai_settings, screen, ship, bullets)
27
+        ship.update()
28
+        gf.update_bullets(bullets)
29
+        gf.update_screen(ai_settings, screen, ship, bullets)
30
+
31
+run_game()

+ 0 - 0
chapter_12/bullet.py


Някои файлове не бяха показани, защото твърде много файлове са промени

golf/tge - Gogs: Simplico Git Service

Brak opisu

golf d8e79ace03 index commit 2 lat temu
..
AD.js d8e79ace03 index commit 2 lat temu
AE.js d8e79ace03 index commit 2 lat temu
AF.js d8e79ace03 index commit 2 lat temu
AG.js d8e79ace03 index commit 2 lat temu
AI.js d8e79ace03 index commit 2 lat temu
AL.js d8e79ace03 index commit 2 lat temu
AM.js d8e79ace03 index commit 2 lat temu
AO.js d8e79ace03 index commit 2 lat temu
AR.js d8e79ace03 index commit 2 lat temu
AS.js d8e79ace03 index commit 2 lat temu
AT.js d8e79ace03 index commit 2 lat temu
AU.js d8e79ace03 index commit 2 lat temu
AW.js d8e79ace03 index commit 2 lat temu
AX.js d8e79ace03 index commit 2 lat temu
AZ.js d8e79ace03 index commit 2 lat temu
BA.js d8e79ace03 index commit 2 lat temu
BB.js d8e79ace03 index commit 2 lat temu
BD.js d8e79ace03 index commit 2 lat temu
BE.js d8e79ace03 index commit 2 lat temu
BF.js d8e79ace03 index commit 2 lat temu
BG.js d8e79ace03 index commit 2 lat temu
BH.js d8e79ace03 index commit 2 lat temu
BI.js d8e79ace03 index commit 2 lat temu
BJ.js d8e79ace03 index commit 2 lat temu
BM.js d8e79ace03 index commit 2 lat temu
BN.js d8e79ace03 index commit 2 lat temu
BO.js d8e79ace03 index commit 2 lat temu
BR.js d8e79ace03 index commit 2 lat temu
BS.js d8e79ace03 index commit 2 lat temu
BT.js d8e79ace03 index commit 2 lat temu
BW.js d8e79ace03 index commit 2 lat temu
BY.js d8e79ace03 index commit 2 lat temu
BZ.js d8e79ace03 index commit 2 lat temu
CA.js d8e79ace03 index commit 2 lat temu
CD.js d8e79ace03 index commit 2 lat temu
CF.js d8e79ace03 index commit 2 lat temu
CG.js d8e79ace03 index commit 2 lat temu
CH.js d8e79ace03 index commit 2 lat temu
CI.js d8e79ace03 index commit 2 lat temu
CK.js d8e79ace03 index commit 2 lat temu
CL.js d8e79ace03 index commit 2 lat temu
CM.js d8e79ace03 index commit 2 lat temu
CN.js d8e79ace03 index commit 2 lat temu
CO.js d8e79ace03 index commit 2 lat temu
CR.js d8e79ace03 index commit 2 lat temu
CU.js d8e79ace03 index commit 2 lat temu
CV.js d8e79ace03 index commit 2 lat temu
CX.js d8e79ace03 index commit 2 lat temu
CY.js d8e79ace03 index commit 2 lat temu
CZ.js d8e79ace03 index commit 2 lat temu
DE.js d8e79ace03 index commit 2 lat temu
DJ.js d8e79ace03 index commit 2 lat temu
DK.js d8e79ace03 index commit 2 lat temu
DM.js d8e79ace03 index commit 2 lat temu
DO.js d8e79ace03 index commit 2 lat temu
DZ.js d8e79ace03 index commit 2 lat temu
EC.js d8e79ace03 index commit 2 lat temu
EE.js d8e79ace03 index commit 2 lat temu
EG.js d8e79ace03 index commit 2 lat temu
ER.js d8e79ace03 index commit 2 lat temu
ES.js d8e79ace03 index commit 2 lat temu
ET.js d8e79ace03 index commit 2 lat temu
FI.js d8e79ace03 index commit 2 lat temu
FJ.js d8e79ace03 index commit 2 lat temu
FK.js d8e79ace03 index commit 2 lat temu
FM.js d8e79ace03 index commit 2 lat temu
FO.js d8e79ace03 index commit 2 lat temu
FR.js d8e79ace03 index commit 2 lat temu
GA.js d8e79ace03 index commit 2 lat temu
GB.js d8e79ace03 index commit 2 lat temu
GD.js d8e79ace03 index commit 2 lat temu
GE.js d8e79ace03 index commit 2 lat temu
GF.js d8e79ace03 index commit 2 lat temu
GG.js d8e79ace03 index commit 2 lat temu
GH.js d8e79ace03 index commit 2 lat temu
GI.js d8e79ace03 index commit 2 lat temu
GL.js d8e79ace03 index commit 2 lat temu
GM.js d8e79ace03 index commit 2 lat temu
GN.js d8e79ace03 index commit 2 lat temu
GP.js d8e79ace03 index commit 2 lat temu
GQ.js d8e79ace03 index commit 2 lat temu
GR.js d8e79ace03 index commit 2 lat temu
GT.js d8e79ace03 index commit 2 lat temu
GU.js d8e79ace03 index commit 2 lat temu
GW.js d8e79ace03 index commit 2 lat temu
GY.js d8e79ace03 index commit 2 lat temu
HK.js d8e79ace03 index commit 2 lat temu
HN.js d8e79ace03 index commit 2 lat temu
HR.js d8e79ace03 index commit 2 lat temu
HT.js d8e79ace03 index commit 2 lat temu
HU.js d8e79ace03 index commit 2 lat temu
ID.js d8e79ace03 index commit 2 lat temu
IE.js d8e79ace03 index commit 2 lat temu
IL.js d8e79ace03 index commit 2 lat temu
IM.js d8e79ace03 index commit 2 lat temu
IN.js d8e79ace03 index commit 2 lat temu
IQ.js d8e79ace03 index commit 2 lat temu
IR.js d8e79ace03 index commit 2 lat temu
IS.js d8e79ace03 index commit 2 lat temu
IT.js d8e79ace03 index commit 2 lat temu
JE.js d8e79ace03 index commit 2 lat temu
JM.js d8e79ace03 index commit 2 lat temu
JO.js d8e79ace03 index commit 2 lat temu
JP.js d8e79ace03 index commit 2 lat temu
KE.js d8e79ace03 index commit 2 lat temu
KG.js d8e79ace03 index commit 2 lat temu
KH.js d8e79ace03 index commit 2 lat temu
KI.js d8e79ace03 index commit 2 lat temu
KM.js d8e79ace03 index commit 2 lat temu
KN.js d8e79ace03 index commit 2 lat temu
KP.js d8e79ace03 index commit 2 lat temu
KR.js d8e79ace03 index commit 2 lat temu
KW.js d8e79ace03 index commit 2 lat temu
KY.js d8e79ace03 index commit 2 lat temu
KZ.js d8e79ace03 index commit 2 lat temu
LA.js d8e79ace03 index commit 2 lat temu
LB.js d8e79ace03 index commit 2 lat temu
LC.js d8e79ace03 index commit 2 lat temu
LI.js d8e79ace03 index commit 2 lat temu
LK.js d8e79ace03 index commit 2 lat temu
LR.js d8e79ace03 index commit 2 lat temu
LS.js d8e79ace03 index commit 2 lat temu
LT.js d8e79ace03 index commit 2 lat temu
LU.js d8e79ace03 index commit 2 lat temu
LV.js d8e79ace03 index commit 2 lat temu
LY.js d8e79ace03 index commit 2 lat temu
MA.js d8e79ace03 index commit 2 lat temu
MC.js d8e79ace03 index commit 2 lat temu
MD.js d8e79ace03 index commit 2 lat temu
ME.js d8e79ace03 index commit 2 lat temu
MG.js d8e79ace03 index commit 2 lat temu
MH.js d8e79ace03 index commit 2 lat temu
MK.js d8e79ace03 index commit 2 lat temu
ML.js d8e79ace03 index commit 2 lat temu
MM.js d8e79ace03 index commit 2 lat temu
MN.js d8e79ace03 index commit 2 lat temu
MO.js d8e79ace03 index commit 2 lat temu
MP.js d8e79ace03 index commit 2 lat temu
MQ.js d8e79ace03 index commit 2 lat temu
MR.js d8e79ace03 index commit 2 lat temu
MS.js d8e79ace03 index commit 2 lat temu
MT.js d8e79ace03 index commit 2 lat temu
MU.js d8e79ace03 index commit 2 lat temu
MV.js d8e79ace03 index commit 2 lat temu
MW.js d8e79ace03 index commit 2 lat temu
MX.js d8e79ace03 index commit 2 lat temu
MY.js d8e79ace03 index commit 2 lat temu
MZ.js d8e79ace03 index commit 2 lat temu
NA.js d8e79ace03 index commit 2 lat temu
NC.js d8e79ace03 index commit 2 lat temu
NE.js d8e79ace03 index commit 2 lat temu
NF.js d8e79ace03 index commit 2 lat temu
NG.js d8e79ace03 index commit 2 lat temu
NI.js d8e79ace03 index commit 2 lat temu
NL.js d8e79ace03 index commit 2 lat temu
NO.js d8e79ace03 index commit 2 lat temu
NP.js d8e79ace03 index commit 2 lat temu
NR.js d8e79ace03 index commit 2 lat temu
NU.js d8e79ace03 index commit 2 lat temu
NZ.js d8e79ace03 index commit 2 lat temu
OM.js d8e79ace03 index commit 2 lat temu
PA.js d8e79ace03 index commit 2 lat temu
PE.js d8e79ace03 index commit 2 lat temu
PF.js d8e79ace03 index commit 2 lat temu
PG.js d8e79ace03 index commit 2 lat temu
PH.js d8e79ace03 index commit 2 lat temu
PK.js d8e79ace03 index commit 2 lat temu
PL.js d8e79ace03 index commit 2 lat temu
PM.js d8e79ace03 index commit 2 lat temu
PN.js d8e79ace03 index commit 2 lat temu
PR.js d8e79ace03 index commit 2 lat temu
PS.js d8e79ace03 index commit 2 lat temu
PT.js d8e79ace03 index commit 2 lat temu
PW.js d8e79ace03 index commit 2 lat temu
PY.js d8e79ace03 index commit 2 lat temu
QA.js d8e79ace03 index commit 2 lat temu
RE.js d8e79ace03 index commit 2 lat temu
RO.js d8e79ace03 index commit 2 lat temu
RS.js d8e79ace03 index commit 2 lat temu
RU.js d8e79ace03 index commit 2 lat temu
RW.js d8e79ace03 index commit 2 lat temu
SA.js d8e79ace03 index commit 2 lat temu
SB.js d8e79ace03 index commit 2 lat temu
SC.js d8e79ace03 index commit 2 lat temu
SD.js d8e79ace03 index commit 2 lat temu
SE.js d8e79ace03 index commit 2 lat temu
SG.js d8e79ace03 index commit 2 lat temu
SH.js d8e79ace03 index commit 2 lat temu
SI.js d8e79ace03 index commit 2 lat temu
SK.js d8e79ace03 index commit 2 lat temu
SL.js d8e79ace03 index commit 2 lat temu
SM.js d8e79ace03 index commit 2 lat temu
SN.js d8e79ace03 index commit 2 lat temu
SO.js d8e79ace03 index commit 2 lat temu
SR.js d8e79ace03 index commit 2 lat temu
ST.js d8e79ace03 index commit 2 lat temu
SV.js d8e79ace03 index commit 2 lat temu
SY.js d8e79ace03 index commit 2 lat temu
SZ.js d8e79ace03 index commit 2 lat temu
TC.js d8e79ace03 index commit 2 lat temu
TD.js d8e79ace03 index commit 2 lat temu
TG.js d8e79ace03 index commit 2 lat temu
TH.js d8e79ace03 index commit 2 lat temu
TJ.js d8e79ace03 index commit 2 lat temu
TK.js d8e79ace03 index commit 2 lat temu
TL.js d8e79ace03 index commit 2 lat temu
TM.js d8e79ace03 index commit 2 lat temu
TN.js d8e79ace03 index commit 2 lat temu
TO.js d8e79ace03 index commit 2 lat temu
TR.js d8e79ace03 index commit 2 lat temu
TT.js d8e79ace03 index commit 2 lat temu
TV.js d8e79ace03 index commit 2 lat temu
TW.js d8e79ace03 index commit 2 lat temu
TZ.js d8e79ace03 index commit 2 lat temu
UA.js d8e79ace03 index commit 2 lat temu
UG.js d8e79ace03 index commit 2 lat temu
US.js d8e79ace03 index commit 2 lat temu
UY.js d8e79ace03 index commit 2 lat temu
UZ.js d8e79ace03 index commit 2 lat temu
VA.js d8e79ace03 index commit 2 lat temu
VC.js d8e79ace03 index commit 2 lat temu
VE.js d8e79ace03 index commit 2 lat temu
VG.js d8e79ace03 index commit 2 lat temu
VI.js d8e79ace03 index commit 2 lat temu
VN.js d8e79ace03 index commit 2 lat temu
VU.js d8e79ace03 index commit 2 lat temu
WF.js d8e79ace03 index commit 2 lat temu
WS.js d8e79ace03 index commit 2 lat temu
YE.js d8e79ace03 index commit 2 lat temu
YT.js d8e79ace03 index commit 2 lat temu
ZA.js d8e79ace03 index commit 2 lat temu
ZM.js d8e79ace03 index commit 2 lat temu
ZW.js d8e79ace03 index commit 2 lat temu
alt-af.js d8e79ace03 index commit 2 lat temu
alt-an.js d8e79ace03 index commit 2 lat temu
alt-as.js d8e79ace03 index commit 2 lat temu
alt-eu.js d8e79ace03 index commit 2 lat temu
alt-na.js d8e79ace03 index commit 2 lat temu
alt-oc.js d8e79ace03 index commit 2 lat temu
alt-sa.js d8e79ace03 index commit 2 lat temu
alt-ww.js d8e79ace03 index commit 2 lat temu
tum/soc - Gogs: Simplico Git Service

Нет описания

conversions.py 1002B

123456789101112131415161718192021222324252627
  1. # IRIS Source Code
  2. # Copyright (C) 2024 - DFIR-IRIS
  3. # contact@dfir-iris.org
  4. #
  5. # This program is free software; you can redistribute it and/or
  6. # modify it under the terms of the GNU Lesser General Public
  7. # License as published by the Free Software Foundation; either
  8. # version 3 of the License, or (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. # Lesser General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU Lesser General Public License
  16. # along with this program; if not, write to the Free Software Foundation,
  17. # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  18. from sqlalchemy import asc
  19. from sqlalchemy import desc
  20. def convert_sort_direction(sort_direction):
  21. if sort_direction == 'desc':
  22. return desc
  23. else:
  24. return asc