From e0097e22efa905e241b9fbd9c1a180a90b59d5be Mon Sep 17 00:00:00 2001 From: Roberto Espana Date: Tue, 20 Jan 2026 22:17:06 -0300 Subject: [PATCH] actualizacion --- sonar-project.properties | 5 ++ sonar-scanner/src/python/fortune.py | 7 +-- sonar-scanner/src/python/letters.py | 91 +++++++++++++++++++++++++++++ sonar-scanner/src/python/strfile.py | 11 +++- 4 files changed, 108 insertions(+), 6 deletions(-) create mode 100644 sonar-project.properties diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 00000000..042449ca --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,5 @@ +sonar.projectKey=pythonGitv1 +sonar.projectName=Python git test v1 +sonar.python.version=3.7 +sonar.sources=sonar-scanner/src/python + diff --git a/sonar-scanner/src/python/fortune.py b/sonar-scanner/src/python/fortune.py index b0900dc1..9ad38efa 100644 --- a/sonar-scanner/src/python/fortune.py +++ b/sonar-scanner/src/python/fortune.py @@ -1,4 +1,3 @@ - # fortune.py -- chooses a random fortune, as the fortune(8) program in # the BSD-games package does # @@ -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" @@ -89,4 +88,4 @@ def get(filename): if len(sys.argv) == 1: print 'Usage: fortune.py ' sys.exit() - print get(sys.argv[1]) + print get(sys.argv[1]) \ No newline at end of file diff --git a/sonar-scanner/src/python/letters.py b/sonar-scanner/src/python/letters.py index 0f54b31c..a9483e81 100644 --- a/sonar-scanner/src/python/letters.py +++ b/sonar-scanner/src/python/letters.py @@ -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 @@ -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), @@ -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. diff --git a/sonar-scanner/src/python/strfile.py b/sonar-scanner/src/python/strfile.py index ca15a607..4b39a033 100644 --- a/sonar-scanner/src/python/strfile.py +++ b/sonar-scanner/src/python/strfile.py @@ -28,6 +28,13 @@ print "Usage: strfile.py " sys.exit() + if len(sys.argv)==1: + print "Usage: strfile.py " + sys.exit() + +if len(sys.argv)==1: + print "Usage: strfile.py " + 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') @@ -35,8 +42,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