From 180b110816cef4281d2e6e1e3f2ecac42e6e3214 Mon Sep 17 00:00:00 2001 From: ronmorgen Date: Thu, 27 May 2021 14:26:06 +0300 Subject: [PATCH 1/2] added a system information script --- .idea/.gitignore | 0 .idea/Awesome-Python-Scripts.iml | 8 ++ .../inspectionProfiles/profiles_settings.xml | 6 ++ .idea/misc.xml | 4 + .idea/modules.xml | 8 ++ .idea/vcs.xml | 6 ++ Basic-Scripts/balanced_paranthesis.py | 78 +++++++++---------- System-Automation-Scripts/sys_info.py | 26 +++++++ 8 files changed, 96 insertions(+), 40 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/Awesome-Python-Scripts.iml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100755 System-Automation-Scripts/sys_info.py diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/.idea/Awesome-Python-Scripts.iml b/.idea/Awesome-Python-Scripts.iml new file mode 100644 index 00000000..d0876a78 --- /dev/null +++ b/.idea/Awesome-Python-Scripts.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 00000000..105ce2da --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 00000000..d1e22ecb --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..dc1aff6b --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..94a25f7f --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Basic-Scripts/balanced_paranthesis.py b/Basic-Scripts/balanced_paranthesis.py index 7709f1b8..3d9d89f8 100644 --- a/Basic-Scripts/balanced_paranthesis.py +++ b/Basic-Scripts/balanced_paranthesis.py @@ -1,40 +1,38 @@ -openBracketList = ["[", "{", "("] -closeBracketList = ["]", "}", ")"] - - -def check_parentheses(data: str) -> str: - """ - check_parentheses() : Will take a string as an arguement and each time when an open parentheses is encountered - will push it in the stack, and when closed parenthesis is encountered, - will match it with the top of stack and pop it. - - Parameters: - data (str): takes a string. - - Returns: - str: Returns a string value whether string passed is balanced or Unbalanced. - """ - stack = [] - for index in data: - if index in openBracketList: - stack.append(index) - elif index in closeBracketList: - position = closeBracketList.index(index) - if (len(stack) > 0) and ( - openBracketList[position] == stack[len(stack) - 1] - ): - stack.pop() - else: - return "Unbalanced" - if len(stack) == 0: - return "Balanced" - else: - return "Unbalanced" - - -if __name__ == "__main__": - - data = input("Enter the string to check:\t") - result = check_parentheses(data) - print(result) - +openBracketList = ["[", "{", "("] +closeBracketList = ["]", "}", ")"] + + +def check_parentheses(data: str) -> str: + """ + check_parentheses() : Will take a string as an arguement and each time when an open parentheses is encountered + will push it in the stack, and when closed parenthesis is encountered, + will match it with the top of stack and pop it. + + Parameters: + data (str): takes a string. + + Returns: + str: Returns a string value whether string passed is balanced or Unbalanced. + """ + stack = [] + for index in data: + if index in openBracketList: + stack.append(index) + elif index in closeBracketList: + position = closeBracketList.index(index) + if (len(stack) > 0) and ( + openBracketList[position] == stack[len(stack) - 1] + ): + stack.pop() + else: + return "Unbalanced" + if len(stack) == 0: + return "Balanced" + else: + return "Unbalanced" + + +if __name__ == "__main__": + data = input("Enter the string to check:\t") + result = check_parentheses(data) + print(result) diff --git a/System-Automation-Scripts/sys_info.py b/System-Automation-Scripts/sys_info.py new file mode 100755 index 00000000..b872d44c --- /dev/null +++ b/System-Automation-Scripts/sys_info.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 + +import platform + +info = { + # System/OS + 'System Type': platform.system(), + 'Host Name': platform.uname()[1], + 'Release': platform.release(), + 'Version': platform.version(), + 'Python Version': platform.python_version(), + +} + + +def main(): + print( + "\n" + "============System Information============\n" + ) + for sys_key, sys_val in info.items(): + print(sys_key, ":", sys_val) + + +if __name__ == '__main__': + main() From ae5ab2547d5a19cf91792d4a51efbfc8ee2afd20 Mon Sep 17 00:00:00 2001 From: ronmorgen Date: Thu, 27 May 2021 14:29:22 +0300 Subject: [PATCH 2/2] "" --- .idea/workspace.xml | 97 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 .idea/workspace.xml diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 00000000..f0856507 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1622104567583 + + + + + + + \ No newline at end of file