Debian Codegraph @

testsuite/systemtap.examples/general/pyexample.py

raw
1 #!/usr/bin/python
2 # Copyright (C) 2014 Red Hat, Inc.
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 2 as
6 # published by the Free Software Foundation.
7
8 import sys
9
10 aglobal9 = 9
11
12 def celsius_to_farenheit(celsius):
13 atuple = "a", "b", "c"
14 alist = [1, 2, 3]
15 aset = set([1, 2, 3])
16 adict = { 1 : "a", 2 : "b", 3 : "c" }
17
18 nine = aglobal9
19 five = 5
20 thirty_two = 32
21 i = 1
22 return str((nine * celsius) / five + thirty_two)
23
24 def main():
25 if (len(sys.argv) < 2):
26 print ("Usage: " + sys.argv[0] + " Temp")
27 return 1
28
29 celsius = int(sys.argv[1])
30 print (str(celsius) + " Celsius " + " is " + celsius_to_farenheit(celsius) + " Farenheit")
31 return 0
32
33 if __name__ == "__main__":
34 sys.exit(main())