示例#1
0
def bubble(array):
    list1 = array.tolist()
    n = len(list1)
    for f in range(n):
        for k in range(n - f - 1):
            if array[k] > array[k + 1]:
                array[k], array[k + 1] = array[k + 1], array[k]
    return array
示例#2
0
def merge_sort(array):
    list1 = array.tolist()
    if len(list1) < 2:
        return list1

    midpoint = len(list1) // 2
    return merge(left=merge_sort(array[:midpoint]),
                 right=merge_sort(array[midpoint:]))
示例#3
0
def insert(array):
    list1 = array.tolist()
    for f in range(1, len(list1)):
        item = list1[f]
        k = f - 1
        while k >= 0 and list1[k] > item:
            list1[k + 1] = list1[k]
            k -= 1
        list1[k + 1] = item
    return list1
示例#4
0
 def trim(self, snd_data):  #removes empty audio at the end of the sample
     soundsList = array.tolist(
         snd_data)  #creates a list from the recorded audio array
     trimmedSound = array('h')
     for i in range(
             len(soundsList) - 70000
     ):  #for the length of the recorded audio minus the last second
         trimmedSound.append(
             soundsList[i])  #add from the list to the new trimmed array
     return trimmedSound  # return the trimmed audio
    def getSelectedScanIssues(self):

        issues = self.ctxMenuInvocation.getSelectedIssues()

        # parses currently selected finding to a string
        if len(issues) >= 1 : # one or more issues can be sent (cmd select for example within target...)

                for self.m in issues:

                        #print self.m
                        # burp.sfg@3b784b06 # type <type 'burp.sfg'>

                        # add requestResponseWithMarkers to be global so can be included in scanIssue
                        requestResponse = self.m.getHttpMessages()

                        #print "RequestResponse: ", requestResponse

                        # returns 
                        l = array.tolist(requestResponse)
                        #print l
                        #print l[0]

                        # if there is more than one request response to a finding...
                        if len(l) > 1:
                            k = len(l)
                            q = 1
                            for r in l:

                                #call functionality to handle issues
                                self.processRequest(r, q, k)
                                q = q + 1
                                        
                        elif len(l) == 1:
                            k = ""
                            q = ""
                            #call functionality to handle issues
                            self.processRequest(l[0], q, k)

                        else: # bug: some issues do not have request responses.
                            k = ""
                            q = ""
                            #call functionality to handle issues
                            self.processRequestWithoutRR(q, k)
示例#6
0
def get_torch_image(img, rows, cols, size, idx):
    img  = np.array(array.tolist(img), dtype=np.uint8)
    img = img.reshape(10000, rows, cols)
    timg = img[idx,:,:]
    return timg
 def trim(self,snd_data): #removes empty audio at the end of the sample
     soundsList = array.tolist(snd_data) #creates a list from the recorded audio array
     trimmedSound = array('h')
     for i in range (len(soundsList)-70000): #for the length of the recorded audio minus the last second
         trimmedSound.append(soundsList[i]) #add from the list to the new trimmed array
     return trimmedSound # return the trimmed audio