def _onRun(self):
     merge( self.getVal("--new_config")
            , self.getVal("--old_config")
            , self.getVal("--destination_config")
            , self.getVal("--rules_python_script")
            , self.getVal("--write_logs")
            , self.getVal("--log_dir")
            , self.getVal("--error_reporting")
            , self.getVal("--write_backup")
            )
     pass
def merge_sort(list, beginIndex=None, endIndex=None):

    if beginIndex == None:
        beginIndex = 0

    if endIndex == None:
        endIndex = len(list)

    size = endIndex - beginIndex

    # Base case (n < 2)

    if size <= 1:

        return list[beginIndex:endIndex]

    # Recursive case (n >= 2)

    else:

        #   B     M     E
        # [ 1, 2, 5, 7]   =>   [1, 2] [5, 7]

        midIndex = beginIndex + math.floor(size / 2)

        leftSorted = merge_sort(list, beginIndex, midIndex)

        rightSorted = merge_sort(list, midIndex, endIndex)

        return merge(leftSorted, rightSorted)
def mergeSort(list):
     if len(list) < 2:
         return list
     middle = len(list) / 2
     left = mergeSort(list[:middle])
     right = mergeSort(list[middle:])
     return merge(left, right)
def mergeSort(list):
    if len(list) < 2:
        return list
    middle = len(list) / 2
    left = mergeSort(list[:middle])
    right = mergeSort(list[middle:])
    return merge(left, right)
def mergesort(x):

    ll = 0
    uu = len(x)
    mm = math.ceil((uu + ll) / 2)
    numinv = 0

    if uu > 1:
        x[ll:mm], numinv1 = mergesort(x[ll:mm])
        x[mm:uu], numinv2 = mergesort(x[mm:uu])
        x[:], numinv3 = merge(x, ll, mm, uu)
        numinv = numinv + numinv1 + numinv2 + numinv3

    return x, numinv
def mergesort(x):

    ll = 0
    uu = len(x)
    mm = math.ceil((uu+ll)/2)
    numinv = 0

    if uu >1:
        x[ll:mm], numinv1 = mergesort(x[ll:mm])
        x[mm:uu], numinv2 = mergesort(x[mm:uu])
        x[:], numinv3 = merge(x, ll, mm, uu)
        numinv = numinv + numinv1 + numinv2 + numinv3

    return x, numinv
Exemple #7
0
def mergeSort(seq):
    if (len(seq) > 2):
        if (len(seq) % 2 == 0):
            mid = int(len(seq) / 2)
        else:
            mid = int((len(seq) + 1) / 2)

        topcp = seq[:mid]
        botcp = seq[mid:]

        lSeq = mergeSort(topcp)
        rSeq = mergeSort(botcp)

        return merge(lSeq, rSeq)
    else:
        if (len(seq) == 1):
            return seq
        if (len(seq) == 2):
            if (seq[0] <= seq[1]):
                return [seq[0], seq[1]]
            else:
                return [seq[1], seq[0]]
def MSort(list, L, rightEnd, tempList):
    if L<rightEnd:
        center = (L+rightEnd)/2
        MSort(list, L, center, tempList)
        MSort(list, center+1, rightEnd, tempList)
        merge(list, L, center+1, rightEnd, tempList)
Exemple #9
0
from CR import cr
from Heap import heap
from MP import mp
from Merge import merge
from Quick import quick
from Shell import shell
from XZ import xz

a = [45, 35, 87, 1, 99, 20]
MP = mp()
XZ = xz()
CR = cr()
Shell = shell()
Merge = merge()
Quick = quick()
Heap = heap()
#b=MP.mpsort(a)
#b=XZ.xzsort(a)
#b=CR.crsort(a)
#b=Shell.shellsort(a)
#b=Merge.mergesort(a)
#b=Quick.quicksort(a)
b = Heap.heapsort(a)
print(b)
Exemple #10
0
    'z',
)
calculate_judge(file, 5, 6, 'judge', 'node')

file_name = 'node_z.xlsx'
file = ''.join([dir_path, file_name])
calculate_sort(file, 'z', False, 'sort', 'Sheet1')

# Merge()
file_position_name = 'node'
file_bool_name = 'pl'
file_merge_name = 'merge'
file_position = ''.join([dir_path, file_position_name])
file_bool = ''.join([dir_path, file_bool_name])
file_merge = ''.join([dir_path, file_merge_name])
merge(file_position, file_bool, file_merge)

# Plot()
file_merge_name = 'merge'
file_merge = ''.join([dir_path, file_merge_name])
plot(file=file_merge,
     sheet='Sheet1',
     num_x=51,
     num_y=101,
     interpolation_str='None',
     cmap_str='Reds')

# 3 Dimension Point in Cylinder
file_name = 'node.xlsx'
file = ''.join([dir_path, file_name])
Exemple #11
0
from Merge import merge

from MergeSort import merge_sort

# Tests for merge routine

assert(merge([], []) == [])

assert(merge([1], []) == [1])

assert(merge([], [1]) == [1])

assert(merge([1], [1]) == [1,1])

assert(merge([1,2], [3]) == [1,2,3])

assert(merge([3], [1,2]) == [1,2,3])

assert(merge([1,2,3,4,4,5,6,7,7,8,9], [1,1,5,5,5,5,5,6,6,9]) == [1,1,1,2,3,4,4,5,5,5,5,5,5,6,6,6,7,7,8,9,9])

# Tests for merge_sort routine

assert(merge_sort([]) == [])

assert(merge_sort([5]) == [5])

assert(merge_sort([5,1]) == [1,5])

assert(merge_sort([5,8,1,2,7,9,4,2,1,5,1]) == [1,1,1,2,2,4,5,5,7,8,9])
Exemple #12
0
                              infile)
    except IOError:
        pass

# process each image individually
for im in images:
    print(f'Accessing {im}...')
    # prompt user for destination platform
    pSelect = PlatformSelect(platform_list, im)

    for platform, isSelected in pSelect.selectedPlatforms.items():
        if isSelected.get():
            if len(templates[platform]):
                print(f'Processing templates for {platform}...')
                # create editor and write output to disk for every template
                for t in templates[platform]:
                    a = Editor(t, im)
                    merge(t, im, a.mergeData, a.fName.get())
            else:
                tempDisplay = tk.Tk()
                warnings.warn(f'No templates found for {platform}')
                if not tkinter.messagebox.askokcancel(
                        'No templates found',
                        f'No templates were found in templates/ for {platform}. Press OK to continue processing other images, or press CANCEL to stop the program now.'
                ):
                    raise SystemExit('User requested termination')
                tempDisplay.destroy()

tkinter.messagebox.showinfo('Templating finished',
                            'All images have been processed.')
print("--- All images processed. ---")