Skip to content

Commit a20df13

Browse files
committed
Updates
1 parent ad4899b commit a20df13

13 files changed

Lines changed: 142 additions & 43 deletions

File tree

‎.dockerignore‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
**/__pycache__
2+
**/.venv
3+
**/.classpath
4+
**/.dockerignore
5+
**/.env
6+
**/.git
7+
**/.gitignore
8+
**/.project
9+
**/.settings
10+
**/.toolstarget
11+
**/.vs
12+
**/.vscode
13+
**/*.*proj.user
14+
**/*.dbmdl
15+
**/*.jfm
16+
**/bin
17+
**/charts
18+
**/docker-compose*
19+
**/compose*
20+
**/Dockerfile*
21+
**/node_modules
22+
**/npm-debug.log
23+
**/obj
24+
**/secrets.dev.yaml
25+
**/values.dev.yaml
26+
LICENSE
27+
README.md

‎Day-004/01-lists.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@
1313
print("\nlist_2 : {}".format(list_2))
1414
list_3 = list_2.sort()
1515
print("list_2 sorted : {0}".format(list_3))
16+
17+
print("Hello, world!")
18+
list_4 = [i for i in range(10)]
19+
print(list_4)

‎Day-012/02-csv-module-1.py‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@
22

33
import csv
44

5-
65
def csv_reader(file_obj):
7-
86
reader = csv.reader(file_obj)
97
for row in reader:
108
print(" ".join(row))
119

12-
1310
if __name__ == "__main__":
1411
csv_path = "csv_file.txt"
1512
with open(csv_path, "r") as f_obj:

‎Day-012/test.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env python3
2+
3+
from math import sinh
4+
from os import path
5+
6+
class Test:
7+
def __init__(self) -> None:
8+
return 2

‎Day-021/01-logging.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import module
55

66

7-
def main():
7+
def main() -> None:
88
logging.basicConfig(filename="test.log", level=logging.INFO)
99
logging.info("Starting the program.")
1010
result = module.add(10, 100)

‎Day-110/list_comprehension.py‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66

77

88
def double_index(lst, index):
9-
if index > len(lst):
10-
return lst
11-
else:
12-
return([n for n in lst[:index]] + [2 * lst[index]] + [n for n in lst[index + 1:]])
9+
if index > len(lst):
10+
return lst
11+
else:
12+
return (
13+
[n for n in lst[:index]] + [2 * lst[index]] + [n for n in lst[index + 1 :]]
14+
)
1315

1416

1517
print(double_index([3, 8, -10, 12], 2))
16-

‎Day-111/list_index.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ def middle_element(lst):
1616
return lst[int(len(lst)/2)]
1717

1818

19-
print(middle_element([5, 2, -10, -4, 4, 5]))
19+
print(middle_element([5, 2, -10, -4, 4, 5]))

‎Day-113/argparse-2.py‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,25 @@
66
parser = argparse.ArgumentParser(description="Refreshing argparse module")
77

88
# Arguments the parser object can expect
9-
parser.add_argument('--git-tag', help="Clone the repo and build from a Git tag")
10-
parser.add_argument('--git-commit', help="Clone the repo and build from a Git commit")
9+
parser.add_argument("--git-tag", help="Clone the repo and build from a Git tag")
10+
parser.add_argument("--git-commit", help="Clone the repo and build from a Git commit")
1111

1212
# The arguments and the corresponding values are stored in the namespace `parser.parse_args()`
1313
print("-- 1. This will print the arguments defined and expected by the parser object")
14-
print("NOTE: Calling the `parse_args()` method on the parser object to access the argument namespace")
14+
print(
15+
"NOTE: Calling the `parse_args()` method on the parser object to access the argument namespace"
16+
)
1517
print(parser.parse_args())
1618
print()
1719

1820
# The argument switches and the values are expected as a list
19-
print("-- 2. This will print the arguments in the order they're defined via `add_argument`")
20-
print(parser.parse_args(['--git-tag', 'dfsfds', '--git-commit', '123']))
21-
print(parser.parse_args(['--git-commit', '34324324324', '--git-tag', 'dfsdsfd']))
21+
print(
22+
"-- 2. This will print the arguments in the order they're defined via `add_argument`"
23+
)
24+
print(parser.parse_args(["--git-tag", "dfsfds", "--git-commit", "123"]))
25+
print(parser.parse_args(["--git-commit", "34324324324", "--git-tag", "dfsdsfd"]))
2226
print("")
2327

2428
# This will error out since the argument `--git-fds` is not defined with `add_argument()`
2529
print("-- 3. This will error out and show a usage help")
26-
print(parser.parse_args(['--git-fds', 'dfsfds', '--git-commit', '123']))
30+
print(parser.parse_args(["--git-fds", "dfsfds", "--git-commit", "123"]))

‎Day-113/argparse-4.py‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,29 @@
33
import argparse
44

55
arg_parser = argparse.ArgumentParser(
6-
description="Checkout Git repos based on branch, tag, or commit id")
6+
description="Checkout Git repos based on branch, tag, or commit id"
7+
)
78

8-
arg_parser.add_argument('--git-repo', help="Checkout the Git repo",
9-
default="https://github.com/arvimal/Daisho")
9+
arg_parser.add_argument(
10+
"--git-repo",
11+
help="Checkout the Git repo",
12+
default="https://github.com/arvimal/Daisho",
13+
)
1014

1115
git_group = arg_parser.add_mutually_exclusive_group(required=True)
1216
git_group.add_argument(
13-
'--git-tag', help='Fetch a git repo based on tag or branch', dest="da_tag")
17+
"--git-tag", help="Fetch a git repo based on tag or branch", dest="da_tag"
18+
)
1419
git_group.add_argument(
15-
'--git-commit', help="Checkout a git repo based on commit id", dest="da_commit")
20+
"--git-commit", help="Checkout a git repo based on commit id", dest="da_commit"
21+
)
1622

1723
# First test
18-
argument_namespace = arg_parser.parse_args(['--git-tag', '2bd5s8r'])
24+
argument_namespace = arg_parser.parse_args(["--git-tag", "2bd5s8r"])
1925
print("First namespace: {}\n".format(argument_namespace))
2026

2127
# Second test
22-
argument_namespace = arg_parser.parse_args(['--git-commit', 'RHEL82_v0.1'])
28+
argument_namespace = arg_parser.parse_args(["--git-commit", "RHEL82_v0.1"])
2329
print("Second namespace: {}\n".format(argument_namespace))
2430

2531

‎Day-113/argparse-5.py‎

Lines changed: 44 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,72 @@
33
import argparse
44

55
arg_parser = argparse.ArgumentParser(
6-
description="Checkout Git repos based on branch, tag, or commit id")
6+
description="Checkout Git repos based on branch, tag, or commit id"
7+
)
78

8-
arg_parser.add_argument('--git-repo', help="Checkout the Git repo",
9-
default="https://github.com/arvimal/Daisho")
9+
arg_parser.add_argument(
10+
"--git-repo",
11+
help="Checkout the Git repo",
12+
default="https://github.com/arvimal/Daisho",
13+
)
1014

1115
# First mutually exclusive group (Required)
1216
group_one = arg_parser.add_mutually_exclusive_group(required=True)
1317
group_one.add_argument(
14-
'--git-tag', help='Fetch a git repo based on tag or branch', dest="da_tag")
18+
"--git-tag", help="Fetch a git repo based on tag or branch", dest="da_tag"
19+
)
1520
group_one.add_argument(
16-
'--git-commit', help="Checkout a git repo based on commit id", dest="da_commit")
21+
"--git-commit", help="Checkout a git repo based on commit id", dest="da_commit"
22+
)
1723

1824
# Second mutually exclusive group ()
1925
group_two = arg_parser.add_mutually_exclusive_group()
2026
group_two.add_argument(
21-
'--deploy-vm', help='Build a virtual machine, from a filesystem tarball available locally', nargs='?')
27+
"--deploy-vm",
28+
help="Build a virtual machine, from a filesystem tarball available locally",
29+
nargs="?",
30+
)
2231
group_two.add_argument(
23-
'--deploy-vm-remote', help='Build a virtual machine, from a tarball hosted on Artifactory', nargs='?')
24-
group_two.add_argument('--delete-vm', help='Delete a deployed VM', nargs='?')
32+
"--deploy-vm-remote",
33+
help="Build a virtual machine, from a tarball hosted on Artifactory",
34+
nargs="?",
35+
)
36+
group_two.add_argument("--delete-vm", help="Delete a deployed VM", nargs="?")
37+
group_two.add_argument("--delete-vm-host", help="Delete a deployed VM", nargs="?")
2538
group_two.add_argument(
26-
'--delete-vm-host', help='Delete a deployed VM', nargs='?')
39+
"--upload", help="Upload the archive file to Artifactory", action="store_true"
40+
)
2741
group_two.add_argument(
28-
'--upload', help='Upload the archive file to Artifactory', action='store_true')
29-
group_two.add_argument('--generate-test-rpm',
30-
help='Build and upload the test rpm', action='store_true')
42+
"--generate-test-rpm", help="Build and upload the test rpm", action="store_true"
43+
)
3144

3245
# Optional arguments
3346
arg_parser.add_argument(
34-
'--verbose', help='Add verbosity to the ansible playbook execution', action='store_true')
47+
"--verbose",
48+
help="Add verbosity to the ansible playbook execution",
49+
action="store_true",
50+
)
3551
arg_parser.add_argument(
36-
'--debug', help='Do not skip tasks tagged with "debug"', action='store_true')
52+
"--debug", help='Do not skip tasks tagged with "debug"', action="store_true"
53+
)
3754
arg_parser.add_argument(
38-
'--pause', help='Do not skip tasks tagged with "pause"', action='store_true')
55+
"--pause", help='Do not skip tasks tagged with "pause"', action="store_true"
56+
)
3957
arg_parser.add_argument(
40-
'--cleanup', help='Only run tasks tagged with "cleanup"', action='store_true')
58+
"--cleanup", help='Only run tasks tagged with "cleanup"', action="store_true"
59+
)
4160
arg_parser.add_argument(
42-
'--tags', help='Space separated list of tags to run', nargs='+', default=[])
61+
"--tags", help="Space separated list of tags to run", nargs="+", default=[]
62+
)
4363
arg_parser.add_argument(
44-
'--skip-tags', help='Space separated list of tags to skip', nargs='+', default=[])
64+
"--skip-tags", help="Space separated list of tags to skip", nargs="+", default=[]
65+
)
4566
arg_parser.add_argument(
46-
'--build-id', help='Add a build ID to the archive when triggered by a build system', required=True, nargs='?')
67+
"--build-id",
68+
help="Add a build ID to the archive when triggered by a build system",
69+
required=True,
70+
nargs="?",
71+
)
4772

4873

4974
arguments = arg_parser.parse_args()

0 commit comments

Comments
 (0)