Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
Assingment-1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Someshwaran R
Assingment-1
Commits
1409ab66
Commit
1409ab66
authored
10 months ago
by
Someshwaran R
Browse files
Options
Downloads
Patches
Plain Diff
class Argument
parent
8ef648c8
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
arg..txt
+41
-0
41 additions, 0 deletions
arg..txt
with
41 additions
and
0 deletions
arg..txt
0 → 100644
+
41
−
0
View file @
1409ab66
class Argument:
def __int__(self, args):
self.commands = []
self.options = []
self.optionsvalue = {} #dict/set here... unique Index/No Repeating Value
self.args = args
print(self.args)
for arg in self.args:
if "_" in arg:
#this is option with value
pair = arg.split('=')
self.optionvalues[pair[0]] = pair[1] #appending the key value pair
self.options.append[pair[0]]
else:
# this is just an option
self.option.append[arg]
else:
self.commands.append[arg]
def hasOptions(self, options: list):
useroptions = set(self.options)
reqoptions = set(options)
return list(reqoptions & useroptions)
def hasOptions(self, options):
return options in self.hasOptions([options])
def hasCommands(self, commands):
usercommands =self(self.commands)
reqcommands = set(commands)
return list(usercommands & reqcommands)
def hasCommand(self, command):
return command in self.hasCommands([command])
def getOptionsValue(self, option, default):
if option in self.optionValues:
return self.optionValues[option]
else:
return default
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment