Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sonar.projectKey=pythonGitv1
sonar.projectName=Python git test v1
sonar.python.version=3.7
sonar.sources=sonar-scanner/src/python

7 changes: 3 additions & 4 deletions sonar-scanner/src/python/fortune.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# fortune.py -- chooses a random fortune, as the fortune(8) program in
# the BSD-games package does
#
Expand All @@ -21,14 +20,14 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

#actualizar
import struct, random, string

# C long variables are different sizes on 32-bit and 64-bit machines,
# so we have to measure how big they are on the machine where this is running.
LONG_SIZE = struct.calcsize('L')
is_64_bit = (LONG_SIZE == 8)

#hola nuevo codigo
def get(filename):
"Select a random quotation, using a pregenerated .dat file"

Expand Down Expand Up @@ -89,4 +88,4 @@ def get(filename):
if len(sys.argv) == 1:
print 'Usage: fortune.py <filename>'
sys.exit()
print get(sys.argv[1])
print get(sys.argv[1])
91 changes: 91 additions & 0 deletions sonar-scanner/src/python/letters.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,20 @@
# THE SOFTWARE.

import random, string
import random, string

import random, string

import random, string

v
import random, string

vimport random, string

v
import random, string


# Logic game
# From a program by Judith Haris, John Swets, and Wallace Feurzeig
Expand All @@ -36,6 +50,7 @@
# There's a bug lurking in this data! Can you catch it?
# (See the bottom of the program for the answer.)


letter_stats={'a': (0, 2, 2, 1, 0), 'b':(2, 0, 0, 3, 1),
'c': (1, 2, 0, 0, 0), 'd':(1, 0, 0, 0, 1),
'e': (0, 3, 0, 3, 1), 'f':(0, 3, 0, 2, 1),
Expand All @@ -50,11 +65,87 @@
'w': (0, 2, 4, 0, 0), 'x':(0, 4, 2, 0, 0),
'y': (0, 3, 2, 0, 1), 'z':(0, 2, 1, 2, 0)}


letter_stats={'a': (0, 2, 2, 1, 0), 'b':(2, 0, 0, 3, 1),
'c': (1, 2, 0, 0, 0), 'd':(1, 0, 0, 0, 1),
'e': (0, 3, 0, 3, 1), 'f':(0, 3, 0, 2, 1),
'g': (1, 2, 0, 1, 1), 'h':(0, 4, 0, 1, 2),
'i': (0, 2, 0, 0, 1), 'j':(1, 2, 0, 0, 1),
'k': (0, 4, 2, 0, 1), 'l':(0, 2, 0, 1, 1),
'm': (0, 2, 2, 0, 2), 'n':(0, 2, 1, 0, 2),
'o': (1, 0, 0, 0, 0), 'p':(1, 1, 0, 2, 1),
'q': (1, 2, 1, 0, 0), 'r':(1, 2, 1, 0, 1),
's': (1, 2, 0, 0, 0), 't':(0, 3, 0, 1, 1),
'u': (1, 2, 0, 0, 2), 'v':(0, 2, 2, 0, 0),
'w': (0, 2, 4, 0, 0), 'x':(0, 4, 2, 0, 0),
'y': (0, 3, 2, 0, 1), 'z':(0, 2, 1, 2, 0)}
letter_stats={'a': (0, 2, 2, 1, 0), 'b':(2, 0, 0, 3, 1),
'c': (1, 2, 0, 0, 0), 'd':(1, 0, 0, 0, 1),
'e': (0, 3, 0, 3, 1), 'f':(0, 3, 0, 2, 1),
'g': (1, 2, 0, 1, 1), 'h':(0, 4, 0, 1, 2),
'i': (0, 2, 0, 0, 1), 'j':(1, 2, 0, 0, 1),
'k': (0, 4, 2, 0, 1), 'l':(0, 2, 0, 1, 1),
'm': (0, 2, 2, 0, 2), 'n':(0, 2, 1, 0, 2),
'o': (1, 0, 0, 0, 0), 'p':(1, 1, 0, 2, 1),
'q': (1, 2, 1, 0, 0), 'r':(1, 2, 1, 0, 1),
's': (1, 2, 0, 0, 0), 't':(0, 3, 0, 1, 1),
'u': (1, 2, 0, 0, 2), 'v':(0, 2, 2, 0, 0),
'w': (0, 2, 4, 0, 0), 'x':(0, 4, 2, 0, 0),
'y': (0, 3, 2, 0, 1), 'z':(0, 2, 1, 2, 0)}
letter_stats={'a': (0, 2, 2, 1, 0), 'b':(2, 0, 0, 3, 1),
'c': (1, 2, 0, 0, 0), 'd':(1, 0, 0, 0, 1),
'e': (0, 3, 0, 3, 1), 'f':(0, 3, 0, 2, 1),
'g': (1, 2, 0, 1, 1), 'h':(0, 4, 0, 1, 2),
'i': (0, 2, 0, 0, 1), 'j':(1, 2, 0, 0, 1),
'k': (0, 4, 2, 0, 1), 'l':(0, 2, 0, 1, 1),
'm': (0, 2, 2, 0, 2), 'n':(0, 2, 1, 0, 2),
'o': (1, 0, 0, 0, 0), 'p':(1, 1, 0, 2, 1),
'q': (1, 2, 1, 0, 0), 'r':(1, 2, 1, 0, 1),
's': (1, 2, 0, 0, 0), 't':(0, 3, 0, 1, 1),
'u': (1, 2, 0, 0, 2), 'v':(0, 2, 2, 0, 0),
'w': (0, 2, 4, 0, 0), 'x':(0, 4, 2, 0, 0),
'y': (0, 3, 2, 0, 1), 'z':(0, 2, 1, 2, 0)}
letter_stats={'a': (0, 2, 2, 1, 0), 'b':(2, 0, 0, 3, 1),
'c': (1, 2, 0, 0, 0), 'd':(1, 0, 0, 0, 1),
'e': (0, 3, 0, 3, 1), 'f':(0, 3, 0, 2, 1),
'g': (1, 2, 0, 1, 1), 'h':(0, 4, 0, 1, 2),
'i': (0, 2, 0, 0, 1), 'j':(1, 2, 0, 0, 1),
'k': (0, 4, 2, 0, 1), 'l':(0, 2, 0, 1, 1),
'm': (0, 2, 2, 0, 2), 'n':(0, 2, 1, 0, 2),
'o': (1, 0, 0, 0, 0), 'p':(1, 1, 0, 2, 1),
'q': (1, 2, 1, 0, 0), 'r':(1, 2, 1, 0, 1),
's': (1, 2, 0, 0, 0), 't':(0, 3, 0, 1, 1),
'u': (1, 2, 0, 0, 2), 'v':(0, 2, 2, 0, 0),
'w': (0, 2, 4, 0, 0), 'x':(0, 4, 2, 0, 0),
'y': (0, 3, 2, 0, 1), 'z':(0, 2, 1, 2, 0)}
letter_stats={'a': (0, 2, 2, 1, 0), 'b':(2, 0, 0, 3, 1),
'c': (1, 2, 0, 0, 0), 'd':(1, 0, 0, 0, 1),
'e': (0, 3, 0, 3, 1), 'f':(0, 3, 0, 2, 1),
'g': (1, 2, 0, 1, 1), 'h':(0, 4, 0, 1, 2),
'i': (0, 2, 0, 0, 1), 'j':(1, 2, 0, 0, 1),
'k': (0, 4, 2, 0, 1), 'l':(0, 2, 0, 1, 1),
'm': (0, 2, 2, 0, 2), 'n':(0, 2, 1, 0, 2),
'o': (1, 0, 0, 0, 0), 'p':(1, 1, 0, 2, 1),
'q': (1, 2, 1, 0, 0), 'r':(1, 2, 1, 0, 1),
's': (1, 2, 0, 0, 0), 't':(0, 3, 0, 1, 1),
'u': (1, 2, 0, 0, 2), 'v':(0, 2, 2, 0, 0),
'w': (0, 2, 4, 0, 0), 'x':(0, 4, 2, 0, 0),
'y': (0, 3, 2, 0, 1), 'z':(0, 2, 1, 2, 0)}


# We'll define constants for the various statistics; each constant is
# equal to the position of the statistic in the tuples in
#letter_stats.
CURVES=0 ; LOOSE_ENDS=1 ; OBLIQUES=2 ; HORIZONTALS=3 ; VERTICALS=4
CURVES=0 ; LOOSE_ENDS=1 ; OBLIQUES=2 ; HORIZONTALS=3 ; VERTICALS=4

CURVES=0 ; LOOSE_ENDS=1 ; OBLIQUES=2 ; HORIZONTALS=3 ; VERTICALS=4

CURVES=0 ; LOOSE_ENDS=1 ; OBLIQUES=2 ; HORIZONTALS=3 ; VERTICALS=4

CURVES=0 ; LOOSE_ENDS=1 ; OBLIQUES=2 ; HORIZONTALS=3 ; VERTICALS=4

varsv
# This dictionary is used to map questions to corresponding
# statistics. Note that different keys can map to the same value;
# for example, 'obliques' and 'diagonals' both map to the OBLIQUES constant.
Expand Down
11 changes: 9 additions & 2 deletions sonar-scanner/src/python/strfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,22 @@
print "Usage: strfile.py <filename>"
sys.exit()

if len(sys.argv)==1:
print "Usage: strfile.py <filename>"
sys.exit()

if len(sys.argv)==1:
print "Usage: strfile.py <filename>"
sys.exit()
# C long variables are different sizes on 32-bit and 64-bit machines,
# so we have to measure how big they are on the machine where this is running.
LONG_SIZE = struct.calcsize('L')
is_64_bit = (LONG_SIZE == 8)

delimiter = '%' # The standard delimiter

filename = sys.argv[1]
input = open(filename, 'r')
ilename = sys.argv[1]
inp ut = open(filename, 'r')
output = open(filename + '.dat', 'w')
output.seek(LONG_SIZE * 6) # Skip over the header for now

Expand Down