codeflash/code_to_optimize/bubble_sort_method.py
Kevin Turcios 506017970d fix: remove leftover codeflash_capture instrumentation from test fixture
bubble_sort_method.py was accidentally committed with a @codeflash_capture
decorator and hardcoded temp path from a local test run, breaking tests
in other environments.
2026-02-19 21:43:17 -05:00

41 lines
1.3 KiB
Python

import sys
class BubbleSorter:
def __init__(self, x=0):
self.x = x
def sorter(self, arr):
print("codeflash stdout : BubbleSorter.sorter() called")
for i in range(len(arr)):
for j in range(len(arr) - 1):
if arr[j] > arr[j + 1]:
temp = arr[j]
arr[j] = arr[j + 1]
arr[j + 1] = temp
print("stderr test", file=sys.stderr)
return arr
@classmethod
def sorter_classmethod(cls, arr):
print("codeflash stdout : BubbleSorter.sorter_classmethod() called")
for i in range(len(arr)):
for j in range(len(arr) - 1):
if arr[j] > arr[j + 1]:
temp = arr[j]
arr[j] = arr[j + 1]
arr[j + 1] = temp
print("stderr test classmethod", file=sys.stderr)
return arr
@staticmethod
def sorter_staticmethod(arr):
print("codeflash stdout : BubbleSorter.sorter_staticmethod() called")
for i in range(len(arr)):
for j in range(len(arr) - 1):
if arr[j] > arr[j + 1]:
temp = arr[j]
arr[j] = arr[j + 1]
arr[j + 1] = temp
print("stderr test staticmethod", file=sys.stderr)
return arr