"Fossies" - the Fresh Open Source Software Archive 
Member "radialnet/core/ArgvHandle.py" (17 Feb 2008, 1509 Bytes) of package /linux/privat/old/radialnet-0.44.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
1 # vim: set fileencoding=utf-8 :
2
3 # Copyright (C) 2008 Insecure.Com LLC.
4 #
5 # Author: João Paulo de Souza Medeiros <ignotus21@gmail.com>
6 #
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
21 import sys
22
23
24 class ArgvHandle:
25 """
26 """
27 def __init__(self, argv):
28 """
29 """
30 self.__argv = argv
31
32
33 def get_option(self, option):
34 """
35 """
36 if option in self.__argv:
37
38 index = self.__argv.index(option)
39
40 if index + 1 < len(self.__argv):
41 return self.__argv[index + 1]
42
43 return None
44
45
46 def has_option(self, option):
47 """
48 """
49 return option in self.__argv
50
51
52 def get_last_value(self):
53 """
54 """
55 return self.__argv[-1]
56
57
58
59 if __name__ == '__main__':
60
61 import sys
62
63 h = ArgvHandle(sys.argv)
64
65 print h.get_last_value()