uid
stringlengths
24
24
split
stringclasses
1 value
category
stringclasses
2 values
content
stringlengths
5
482k
signature
stringlengths
1
14k
suffix
stringlengths
1
482k
prefix
stringlengths
9
14k
prefix_token_count
int64
3
5.01k
prefix_token_budget
int64
64
256
element_token_count
int64
1
292k
signature_token_count
int64
1
5.01k
prefix_context_token_count
int64
0
255
repo
stringlengths
7
112
path
stringlengths
4
208
language
stringclasses
1 value
name
stringlengths
1
218
qualname
stringlengths
1
218
start_line
int64
1
26.7k
end_line
int64
1
26.7k
signature_start_line
int64
1
26.7k
signature_end_line
int64
1
26.7k
source_hash
stringlengths
40
40
source_dataset
stringclasses
1 value
source_split
stringclasses
1 value
835190da2a7826088d1fdb37
train
function
def assignParameterWithDefault(destinationDictionary, key, sourceDictionary, \ defaultDictionary): if key in sourceDictionary: destinationDictionary[key] = deepcopy(sourceDictionary[key]) else: destinationDictionary[key] = deepcopy(defaultDictionary[key])
def assignParameterWithDefault(destinationDictionary, key, sourceDictionary, \ defaultDictionary):
if key in sourceDictionary: destinationDictionary[key] = deepcopy(sourceDictionary[key]) else: destinationDictionary[key] = deepcopy(defaultDictionary[key])
"--setfan", "50"]) atexit.register(restoreClocks) setupRestoreClocks() ################################################################################ # Assign Parameters # populate dst with src[key] else give it the default/backup value #############################################################################...
64
64
50
18
45
rkamd/Tensile
Tensile/Common.py
Python
assignParameterWithDefault
assignParameterWithDefault
2,030
2,035
2,030
2,031
edd8d29bbeef8658bab4b9b51ec146f4933d6c4c
bigcode/the-stack
train
26a2235bcb41009ce855e42e
train
function
def restoreDefaultGlobalParameters(): """ Restores `globalParameters` back to defaults. """ global globalParameters global defaultGlobalParameters # Can't just assign globalParameters = deepcopy(defaultGlobalParameters) because that would # result in dangling references, specifically in Tensile.Tensile()....
def restoreDefaultGlobalParameters():
""" Restores `globalParameters` back to defaults. """ global globalParameters global defaultGlobalParameters # Can't just assign globalParameters = deepcopy(defaultGlobalParameters) because that would # result in dangling references, specifically in Tensile.Tensile(). globalParameters.clear() for key,...
Name(arch)) globalParameters["CurrentISA"] = arch if (process.returncode): printWarning("%s exited with code %u" % (globalParameters["ROCmAgentEnumeratorPath"], process.returncode)) return process.returncode return 0 def restoreDefaultGlobalParameters():
64
64
90
6
57
rkamd/Tensile
Tensile/Common.py
Python
restoreDefaultGlobalParameters
restoreDefaultGlobalParameters
1,825
1,835
1,825
1,825
0d9e36cc2d9ee02fdd02d0ec83ce7ac6c5d9be9d
bigcode/the-stack
train
b3244ffd1f5a6779402d0409
train
function
def gfxArch(name): import re match = re.search(r'gfx([0-9a-fA-F]{3,})', name) if not match: return None ipart = match.group(1) step = int(ipart[-1], 16) ipart = ipart[:-1] minor = int(ipart[-1]) ipart = ipart[:-1] major = int(ipart) rv = (major, minor, step) return rv
def gfxArch(name):
import re match = re.search(r'gfx([0-9a-fA-F]{3,})', name) if not match: return None ipart = match.group(1) step = int(ipart[-1], 16) ipart = ipart[:-1] minor = int(ipart[-1]) ipart = ipart[:-1] major = int(ipart) rv = (major, minor, step) return rv
("asm_cmd:", ' '.join(args)) print("asmString: ", asmString) print("output: ", output) print("return code: ", result.returncode) if output != "" or result.returncode != 0: return False return True def gfxArch(name):
64
64
109
5
58
rkamd/Tensile
Tensile/Common.py
Python
gfxArch
gfxArch
1,770
1,787
1,770
1,770
794d1ceb9f8ac76e81675ffffe435f2124de84de
bigcode/the-stack
train
460b967d87235b4129fa4625
train
function
def printTable(rows): rows = list([[str(cell) for cell in row] for row in rows]) colWidths = list([max([len(cell) for cell in col]) for col in zip(*rows)]) for row in rows: for (width, cell) in zip(colWidths, row): pad = ' ' * (width - len(cell)) print(pad, cell, sep='', end=' ') print()
def printTable(rows):
rows = list([[str(cell) for cell in row] for row in rows]) colWidths = list([max([len(cell) for cell in col]) for col in zip(*rows)]) for row in rows: for (width, cell) in zip(colWidths, row): pad = ' ' * (width - len(cell)) print(pad, cell, sep='', end=' ') print()
# Can't just assign globalParameters = deepcopy(defaultGlobalParameters) because that would # result in dangling references, specifically in Tensile.Tensile(). globalParameters.clear() for key, value in deepcopy(defaultGlobalParameters).items(): globalParameters[key] = value def printTable(rows):
64
64
93
5
58
rkamd/Tensile
Tensile/Common.py
Python
printTable
printTable
1,837
1,845
1,837
1,837
f5356cb40f114ef0ac65bc35cb3883039c539b2c
bigcode/the-stack
train
6c7aead23bc58a58fdfdbb7a
train
function
def locateExe( defaultPath, exeName ): # /opt/rocm/bin, hip-clang # look in defaultPath first exePath = os.path.join(defaultPath, exeName) if isExe(exePath): return exePath # look in PATH second for path in os.environ["PATH"].split(os.pathsep): exePath = os.path.join(path, exeName) if isExe(exePat...
def locateExe( defaultPath, exeName ): # /opt/rocm/bin, hip-clang # look in defaultPath first
exePath = os.path.join(defaultPath, exeName) if isExe(exePath): return exePath # look in PATH second for path in os.environ["PATH"].split(os.pathsep): exePath = os.path.join(path, exeName) if isExe(exePath): return exePath return None
clang-offload-bundler ################################################################################ def isExe( filePath ): return os.path.isfile(filePath) and os.access(filePath, os.X_OK) def locateExe( defaultPath, exeName ): # /opt/rocm/bin, hip-clang # look in defaultPath first
64
64
106
30
34
rkamd/Tensile
Tensile/Common.py
Python
locateExe
locateExe
1,655
1,665
1,655
1,656
c9e2a9903083d5b074815eefdb1b2dcd44ae8831
bigcode/the-stack
train
7e72e9bbd1ccc99df2cc7e90
train
function
def getParamValues( name, structure ): if isinstance(structure, list): for l in structure: param = getParamValues(name, l) if param != None: return param return None elif isinstance(structure, dict): if name in structure: return structure[name] else: return None els...
def getParamValues( name, structure ):
if isinstance(structure, list): for l in structure: param = getParamValues(name, l) if param != None: return param return None elif isinstance(structure, dict): if name in structure: return structure[name] else: return None else: printExit("structure %s is not l...
if hasParam(name, l): return True return False elif isinstance(structure, dict): return name in structure else: return name == structure #printExit("structure %s is not list or dict" % structure) def getParamValues( name, structure ):
64
64
92
9
55
rkamd/Tensile
Tensile/Common.py
Python
getParamValues
getParamValues
1,614
1,627
1,614
1,614
d905a659d88f712cb3b9442dee52734d0bdb87cf
bigcode/the-stack
train
b457a41481a263e1ddc936a5
train
function
def detectGlobalCurrentISA(): """ Returns returncode if detection failure """ global globalParameters if globalParameters["CurrentISA"] == (0,0,0) and globalParameters["ROCmAgentEnumeratorPath"]: process = subprocess.run([globalParameters["ROCmAgentEnumeratorPath"]], stdout=subprocess.PIPE) if os.nam...
def detectGlobalCurrentISA():
""" Returns returncode if detection failure """ global globalParameters if globalParameters["CurrentISA"] == (0,0,0) and globalParameters["ROCmAgentEnumeratorPath"]: process = subprocess.run([globalParameters["ROCmAgentEnumeratorPath"]], stdout=subprocess.PIPE) if os.name == "nt": line = "" ...
= ipart[:-1] major = int(ipart) rv = (major, minor, step) return rv def gfxName(arch): # convert last digit to hex because reasons name = str(arch[0]) + str(arch[1]) + ('%x' % arch[2]) return 'gfx' + ''.join(map(str,name)) def detectGlobalCurrentISA():
87
87
292
6
81
rkamd/Tensile
Tensile/Common.py
Python
detectGlobalCurrentISA
detectGlobalCurrentISA
1,794
1,823
1,794
1,794
18c4de12047937303271e037f5c01b33f4c874cd
bigcode/the-stack
train
205dc0a6f900352279fd1830
train
function
def printWarning(message): print("Tensile::WARNING: %s" % message) sys.stdout.flush()
def printWarning(message):
print("Tensile::WARNING: %s" % message) sys.stdout.flush()
# Print Debug ################################################################################ def print1(message): if globalParameters["PrintLevel"] >= 1: print(message) sys.stdout.flush() def print2(message): if globalParameters["PrintLevel"] >= 2: print(message) sys.stdout.flush() def printWarni...
64
64
25
5
59
rkamd/Tensile
Tensile/Common.py
Python
printWarning
printWarning
1,641
1,643
1,641
1,641
d7e3196756a07133e510edf86a5c0e12859bbbb6
bigcode/the-stack
train
94224a8cf694ee0b70317452
train
function
def setWorkingPath( fullPathName ): # Warning: this is not thread-safe, modifies the global WorkingPath! workingDirectoryStack.append(globalParameters["WorkingPath"]) globalParameters["WorkingPath"] = ensurePath(fullPathName)
def setWorkingPath( fullPathName ): # Warning: this is not thread-safe, modifies the global WorkingPath!
workingDirectoryStack.append(globalParameters["WorkingPath"]) globalParameters["WorkingPath"] = ensurePath(fullPathName)
os.makedirs(path) except FileExistsError: pass except OSError: printExit("Failed to create directory \"%s\" " % (path) ) return path def setWorkingPath( fullPathName ): # Warning: this is not thread-safe, modifies the global WorkingPath!
64
64
50
25
38
rkamd/Tensile
Tensile/Common.py
Python
setWorkingPath
setWorkingPath
2,069
2,072
2,069
2,070
56669af42ef4653018f71d1075c0968067d127bf
bigcode/the-stack
train
74c02278ebdeb521c0014ce4
train
class
class Backup: """RAII class to restore backed up fields from object""" fields = {} object = None def __init__(self, object, **fields): self.object = object for k, v in fields.items(): self.fields[k] = copy(v) def __del__(self): for k, v in self.fields.items(): setattr(self.object, ...
class Backup:
"""RAII class to restore backed up fields from object""" fields = {} object = None def __init__(self, object, **fields): self.object = object for k, v in fields.items(): self.fields[k] = copy(v) def __del__(self): for k, v in self.fields.items(): setattr(self.object, k, v)
self.fraction*100) ) if self.numTicks == self.maxTicks: stopTime = time.time() sys.stdout.write(" (%-.1f secs elapsed)\n"%(stopTime-self.createTime)) sys.stdout.flush() def finish(self): pass from copy import copy class Backup:
64
64
87
3
60
rkamd/Tensile
Tensile/Common.py
Python
Backup
Backup
2,151
2,161
2,151
2,151
4a3b48e08a181897bd491a3d88b367f371a5d5b0
bigcode/the-stack
train
b5da56187fd3e4a1d9bce0df
train
function
def inListOfListOfDictionaries(param, dictionaries): for dictionaryList in dictionaries: if inListOfDictionaries(param, dictionaryList): return True return False
def inListOfListOfDictionaries(param, dictionaries):
for dictionaryList in dictionaries: if inListOfDictionaries(param, dictionaryList): return True return False
Dictionaries # to see if keys exist and what their values are ################################################################################ # param name in structures? def inListOfDictionaries(param, dictionaries): for dictionary in dictionaries: if param in dictionary: return True return False def in...
64
64
39
12
51
rkamd/Tensile
Tensile/Common.py
Python
inListOfListOfDictionaries
inListOfListOfDictionaries
1,590
1,594
1,590
1,590
bb9d23369f1851e61ac95cb8dd585c0c44530503
bigcode/the-stack
train
84ce5ac5ae5ec761c5738525
train
function
def getArchitectureName(gfxName): if gfxName in architectureMap: return architectureMap[gfxName] else: for archKey in architectureMap: if gfxName in archKey: return architectureMap[archKey] return None
def getArchitectureName(gfxName):
if gfxName in architectureMap: return architectureMap[gfxName] else: for archKey in architectureMap: if gfxName in archKey: return architectureMap[archKey] return None
':'aldebaran', 'gfx90a:xnack-':'aldebaran', 'gfx1010':'navi10', 'gfx1011':'navi12', 'gfx1012':'navi14', 'gfx1030':'navi21' } def getArchitectureName(gfxName):
64
64
55
8
56
rkamd/Tensile
Tensile/Common.py
Python
getArchitectureName
getArchitectureName
272
279
272
272
6c57850d94e40c9468cb29e2cf5a808b941f66a4
bigcode/the-stack
train
f73538c8da2a6aa5b497f419
train
function
def isExe( filePath ): return os.path.isfile(filePath) and os.access(filePath, os.X_OK)
def isExe( filePath ):
return os.path.isfile(filePath) and os.access(filePath, os.X_OK)
("Tensile::FATAL: %s" % message) sys.stdout.flush() sys.exit(-1) ################################################################################ # Locate Executables # rocm-smi, hip-clang, rocm_agent_enumerator, clang-offload-bundler ################################################################################...
64
64
25
7
56
rkamd/Tensile
Tensile/Common.py
Python
isExe
isExe
1,653
1,654
1,653
1,653
11a98b5928431329f743309a31b20379a67c0521
bigcode/the-stack
train
86a35ee7a30d185e692520e0
train
function
def roundUp(f): return (int)(math.ceil(f))
def roundUp(f):
return (int)(math.ceil(f))
% (path) ) return path def setWorkingPath( fullPathName ): # Warning: this is not thread-safe, modifies the global WorkingPath! workingDirectoryStack.append(globalParameters["WorkingPath"]) globalParameters["WorkingPath"] = ensurePath(fullPathName) def roundUp(f):
64
64
14
5
59
rkamd/Tensile
Tensile/Common.py
Python
roundUp
roundUp
2,075
2,076
2,075
2,075
5f12ee6facd76a518e6353e71f6212366e569909
bigcode/the-stack
train
3e23cac61e142f2d3d54b3a4
train
function
def pushWorkingPath( foldername ): # Warning: this is not thread-safe, modifies the global WorkingPath! globalParameters["WorkingPath"] = \ os.path.join(globalParameters["WorkingPath"], foldername ) return ensurePath( globalParameters["WorkingPath"] )
def pushWorkingPath( foldername ): # Warning: this is not thread-safe, modifies the global WorkingPath!
globalParameters["WorkingPath"] = \ os.path.join(globalParameters["WorkingPath"], foldername ) return ensurePath( globalParameters["WorkingPath"] )
be defined in dictionary %s" % (key, sourceDictionary) ) ################################################################################ # Push / Pop Working Path # store a WorkingPath where to write files (like benchmark files) ################################################################################ def pu...
64
64
58
24
39
rkamd/Tensile
Tensile/Common.py
Python
pushWorkingPath
pushWorkingPath
2,049
2,053
2,049
2,050
004f2ceb924aeec4915c33e632c64a48eedffa45
bigcode/the-stack
train
036eebbe1e9c707f548e5f44
train
function
def popWorkingPath(): # Warning: this is not thread-safe, modifies the global WorkingPath! if len(workingDirectoryStack) == 0: globalParameters["WorkingPath"] = \ os.path.split(globalParameters["WorkingPath"])[0] else: globalParameters["WorkingPath"] = workingDirectoryStack.pop()
def popWorkingPath(): # Warning: this is not thread-safe, modifies the global WorkingPath!
if len(workingDirectoryStack) == 0: globalParameters["WorkingPath"] = \ os.path.split(globalParameters["WorkingPath"])[0] else: globalParameters["WorkingPath"] = workingDirectoryStack.pop()
thread-safe, modifies the global WorkingPath! globalParameters["WorkingPath"] = \ os.path.join(globalParameters["WorkingPath"], foldername ) return ensurePath( globalParameters["WorkingPath"] ) def popWorkingPath(): # Warning: this is not thread-safe, modifies the global WorkingPath!
64
64
71
21
43
rkamd/Tensile
Tensile/Common.py
Python
popWorkingPath
popWorkingPath
2,054
2,060
2,054
2,055
696516cc736da8a93902fd30c280ba4c8cd9679e
bigcode/the-stack
train
ca3fcd1b92dc0a6c274925d7
train
function
def tryAssembler(isaVersion, asmString, debug=False, *options): """ Try to assemble the asmString for the specified target processor Success is defined as assembler returning no error code or stderr/stdout """ options = list(options) if globalParameters["PrintLevel"] >= 2: debug = True if isaVersion[...
def tryAssembler(isaVersion, asmString, debug=False, *options):
""" Try to assemble the asmString for the specified target processor Success is defined as assembler returning no error code or stderr/stdout """ options = list(options) if globalParameters["PrintLevel"] >= 2: debug = True if isaVersion[0] == 10: options += ['-mwavefrontsize64'] args = [global...
rv["HasWave32"] = isaVersion[0] == 10 rv["HasAccCD"] = (isaVersion==(9,0,10)) rv["ArchAccUnifiedRegs"] = (isaVersion==(9,0,10)) return rv def tryAssembler(isaVersion, asmString, debug=False, *options):
75
75
253
16
58
rkamd/Tensile
Tensile/Common.py
Python
tryAssembler
tryAssembler
1,737
1,768
1,737
1,737
75c4397603bcc46be573be2a77f90b3cca8f0f7e
bigcode/the-stack
train
4c8c20fae3f51cdb535abefd
train
function
def printCapTable(parameters): import itertools archs = [(0,0,0)] + parameters["SupportedISA"] gfxNames = list(map(gfxName, archs)) headerRow = ['cap'] + gfxNames def capRow(caps, cap): return [cap] + [('1' if cap in caps[arch] and caps[arch][cap] else '0') for arch in archs] allAsmCaps = set(itertoo...
def printCapTable(parameters):
import itertools archs = [(0,0,0)] + parameters["SupportedISA"] gfxNames = list(map(gfxName, archs)) headerRow = ['cap'] + gfxNames def capRow(caps, cap): return [cap] + [('1' if cap in caps[arch] and caps[arch][cap] else '0') for arch in archs] allAsmCaps = set(itertools.chain(*[caps.keys() for arch...
list([max([len(cell) for cell in col]) for col in zip(*rows)]) for row in rows: for (width, cell) in zip(colWidths, row): pad = ' ' * (width - len(cell)) print(pad, cell, sep='', end=' ') print() def printCapTable(parameters):
72
72
241
6
66
rkamd/Tensile
Tensile/Common.py
Python
printCapTable
printCapTable
1,847
1,865
1,847
1,847
ad346b3ccc17d7306089a5a5f6f450594a38778f
bigcode/the-stack
train
32135c81973df5c55e955234
train
function
def assignGlobalParameters( config ): """ Assign Global Parameters Each global parameter has a default parameter, and the user can override them, those overridings happen here """ global globalParameters # Minimum Required Version if "MinimumRequiredVersion" in config: if not versionIsCompatible(c...
def assignGlobalParameters( config ):
""" Assign Global Parameters Each global parameter has a default parameter, and the user can override them, those overridings happen here """ global globalParameters # Minimum Required Version if "MinimumRequiredVersion" in config: if not versionIsCompatible(config["MinimumRequiredVersion"]): ...
, key=lambda k: (k.split("_")[-1], k)) asmCapRows = [capRow(parameters["AsmCaps"], cap) for cap in allAsmCaps] allArchCaps = set(itertools.chain(*[caps.keys() for arch, caps in parameters["ArchCaps"].items()])) allArchCaps = sorted(allArchCaps) archCapRows = [capRow(parameters["ArchCaps"], cap) for cap in allA...
256
256
1,574
7
248
rkamd/Tensile
Tensile/Common.py
Python
assignGlobalParameters
assignGlobalParameters
1,881
2,014
1,881
1,881
bff09d0a7414ee547ed69c05a33892d1d11ecefa
bigcode/the-stack
train
3b0754240b83be096f17cead
train
function
def hasParam( name, structure ): if isinstance(structure, list): for l in structure: if hasParam(name, l): return True return False elif isinstance(structure, dict): return name in structure else: return name == structure
def hasParam( name, structure ):
if isinstance(structure, list): for l in structure: if hasParam(name, l): return True return False elif isinstance(structure, dict): return name in structure else: return name == structure
if inListOfDictionaries(param, dictionaryList): return True return False def inListOfLists(param, lists): for l in lists: if param in l: return True return False # get param values from structures. def hasParam( name, structure ):
64
64
61
8
56
rkamd/Tensile
Tensile/Common.py
Python
hasParam
hasParam
1,602
1,611
1,602
1,602
9acf5c6c001f502d65cd07524979f1a9262e3c70
bigcode/the-stack
train
4d7a9a7482e65c0ce10ee8c3
train
function
def inListOfDictionaries(param, dictionaries): for dictionary in dictionaries: if param in dictionary: return True return False
def inListOfDictionaries(param, dictionaries):
for dictionary in dictionaries: if param in dictionary: return True return False
0.01, # = 0.01=1% total time saved by keeping this solution } ################################################################################ # Searching Nested Lists / Dictionaries # to see if keys exist and what their values are ############################################################################...
64
64
30
10
54
rkamd/Tensile
Tensile/Common.py
Python
inListOfDictionaries
inListOfDictionaries
1,585
1,589
1,585
1,585
b9db0eea78ba1857c4879c86194f043bb4cf4602
bigcode/the-stack
train
655f1bdec9d14532f6ecd779
train
function
def ensurePath(path): try: os.makedirs(path) except FileExistsError: pass except OSError: printExit("Failed to create directory \"%s\" " % (path) ) return path
def ensurePath(path):
try: os.makedirs(path) except FileExistsError: pass except OSError: printExit("Failed to create directory \"%s\" " % (path) ) return path
thread-safe, modifies the global WorkingPath! if len(workingDirectoryStack) == 0: globalParameters["WorkingPath"] = \ os.path.split(globalParameters["WorkingPath"])[0] else: globalParameters["WorkingPath"] = workingDirectoryStack.pop() def ensurePath(path):
64
64
48
5
59
rkamd/Tensile
Tensile/Common.py
Python
ensurePath
ensurePath
2,061
2,068
2,061
2,061
c8b5634de4e1fcfb00d2d67cd4510794a3b14644
bigcode/the-stack
train
830b09cef124c449aae5b7f0
train
function
def listToInitializer(l): return "{" + ','.join(map(str, l)) + "}"
def listToInitializer(l):
return "{" + ','.join(map(str, l)) + "}"
return True def ClientExecutionLock(): if not globalParameters["ClientExecutionLockPath"]: return open(os.devnull) import filelock return filelock.FileLock(globalParameters["ClientExecutionLockPath"]) # convert python list to C++ initializer style syntax def listToInitializer(l):
64
64
22
6
57
rkamd/Tensile
Tensile/Common.py
Python
listToInitializer
listToInitializer
2,107
2,108
2,107
2,107
ceef290b270a1a63fd65ea93183f51d540983493
bigcode/the-stack
train
06fc920d6fe231d7d2323bb7
train
function
def GetArchCaps(isaVersion): rv = {} rv["HasEccHalf"] = (isaVersion==(9,0,6) or isaVersion==(9,0,8) or isaVersion==(9,0,10)) rv["Waitcnt0Disabled"] = (isaVersion == (9,0,8) or isaVersion==(9,0,10)) rv["SeparateVscnt"] = isaVersion[0] == 10 rv["CMPXWritesSGPR"] = isaVersion[0] != 10 rv["Ha...
def GetArchCaps(isaVersion):
rv = {} rv["HasEccHalf"] = (isaVersion==(9,0,6) or isaVersion==(9,0,8) or isaVersion==(9,0,10)) rv["Waitcnt0Disabled"] = (isaVersion == (9,0,8) or isaVersion==(9,0,10)) rv["SeparateVscnt"] = isaVersion[0] == 10 rv["CMPXWritesSGPR"] = isaVersion[0] != 10 rv["HasWave32"] = isaVersi...
: rv["MaxVmcnt"] = 0 # TODO- Need to query the max cap, just like vmcnt as well? rv["MaxLgkmcnt"] = 15 rv["SupportedSource"] = True return rv def GetArchCaps(isaVersion):
64
64
182
8
55
rkamd/Tensile
Tensile/Common.py
Python
GetArchCaps
GetArchCaps
1,725
1,735
1,725
1,725
6ae931b335dece99e3009da12a056b11a058d46e
bigcode/the-stack
train
c8beb1aa55a0be66be1cd22c
train
function
def assignParameterRequired(destinationDictionary, key, sourceDictionary): if key in sourceDictionary: destinationDictionary[key] = deepcopy(sourceDictionary[key]) else: printExit("Parameter \"%s\" must be defined in dictionary %s" % (key, sourceDictionary) )
def assignParameterRequired(destinationDictionary, key, sourceDictionary):
if key in sourceDictionary: destinationDictionary[key] = deepcopy(sourceDictionary[key]) else: printExit("Parameter \"%s\" must be defined in dictionary %s" % (key, sourceDictionary) )
Dictionary, \ defaultDictionary): if key in sourceDictionary: destinationDictionary[key] = deepcopy(sourceDictionary[key]) else: destinationDictionary[key] = deepcopy(defaultDictionary[key]) # populate dst with src[key] else abort since it's required def assignParameterRequired(destinationDictionary, k...
64
64
57
12
51
rkamd/Tensile
Tensile/Common.py
Python
assignParameterRequired
assignParameterRequired
2,038
2,042
2,038
2,038
d4b91635259f20a0971ddcc94042ab3041363d6b
bigcode/the-stack
train
c133f6b3158a8ba76e74832c
train
function
def print2(message): if globalParameters["PrintLevel"] >= 2: print(message) sys.stdout.flush()
def print2(message):
if globalParameters["PrintLevel"] >= 2: print(message) sys.stdout.flush()
else: return None else: printExit("structure %s is not list or dict" % structure) ################################################################################ # Print Debug ################################################################################ def print1(message): if globalParameters["Prin...
64
64
26
5
59
rkamd/Tensile
Tensile/Common.py
Python
print2
print2
1,636
1,639
1,636
1,636
de16778dadaa6f858067decd9be9de2d221d8db1
bigcode/the-stack
train
729462c69a5c532228203c7c
train
function
def inListOfLists(param, lists): for l in lists: if param in l: return True return False
def inListOfLists(param, lists):
for l in lists: if param in l: return True return False
dictionaries: if param in dictionary: return True return False def inListOfListOfDictionaries(param, dictionaries): for dictionaryList in dictionaries: if inListOfDictionaries(param, dictionaryList): return True return False def inListOfLists(param, lists):
64
64
29
9
54
rkamd/Tensile
Tensile/Common.py
Python
inListOfLists
inListOfLists
1,595
1,599
1,595
1,595
e62b778bdfee27db426e854cb7da209aaa7db833
bigcode/the-stack
train
37e62c9b7c2508f54050b0aa
train
function
def versionIsCompatible(queryVersionString): (qMajor, qMinor, qStep) = queryVersionString.split(".") (tMajor, tMinor, tStep) = __version__.split(".") # major version must match exactly if qMajor != tMajor: return False # minor.patch version must be >= if int(qMinor) > int(tMinor): return False i...
def versionIsCompatible(queryVersionString):
(qMajor, qMinor, qStep) = queryVersionString.split(".") (tMajor, tMinor, tStep) = __version__.split(".") # major version must match exactly if qMajor != tMajor: return False # minor.patch version must be >= if int(qMinor) > int(tMinor): return False if qMinor == tMinor: if int(qStep) > int(t...
Name) def roundUp(f): return (int)(math.ceil(f)) ################################################################################ # Is query version compatible with current version # a yaml file is compatible with tensile if # tensile.major == yaml.major and tensile.minor.step > yaml.minor.step ###################...
64
64
115
8
55
rkamd/Tensile
Tensile/Common.py
Python
versionIsCompatible
versionIsCompatible
2,083
2,097
2,083
2,083
4ec2dbb4a04ddf2e374b9c5e4196bb0a9e2c22bd
bigcode/the-stack
train
a7ca6959a7e72ab458def501
train
function
def setupRestoreClocks(): import atexit def restoreClocks(): if globalParameters["PinClocks"]: rsmi = globalParameters["ROCmSMIPath"] subprocess.call([rsmi, "-d", "0", "--resetclocks"]) subprocess.call([rsmi, "-d", "0", "--setfan", "50"]) atexit.register(restoreClocks)
def setupRestoreClocks():
import atexit def restoreClocks(): if globalParameters["PinClocks"]: rsmi = globalParameters["ROCmSMIPath"] subprocess.call([rsmi, "-d", "0", "--resetclocks"]) subprocess.call([rsmi, "-d", "0", "--setfan", "50"]) atexit.register(restoreClocks)
hipcc', '--version', e)) for key in config: value = config[key] if key not in globalParameters: printWarning("Global parameter %s = %s unrecognised." % ( key, value )) globalParameters[key] = value def setupRestoreClocks():
64
64
88
6
57
rkamd/Tensile
Tensile/Common.py
Python
setupRestoreClocks
setupRestoreClocks
2,016
2,023
2,016
2,016
d5d82436ccb9115e61dc0e51496c5de6b8393bb3
bigcode/the-stack
train
6d7d8436ab79133ba9b46f39
train
function
def GetAsmCaps(isaVersion): """ Determine assembler capabilities by testing short instructions sequences """ rv = {} rv["SupportedISA"] = tryAssembler(isaVersion, "") rv["HasExplicitCO"] = tryAssembler(isaVersion, "v_add_co_u32 v0,vcc,v0,1") rv["HasExplicitNC"] = tryAssembler(isaVersion, "v_add_nc_u32 ...
def GetAsmCaps(isaVersion):
""" Determine assembler capabilities by testing short instructions sequences """ rv = {} rv["SupportedISA"] = tryAssembler(isaVersion, "") rv["HasExplicitCO"] = tryAssembler(isaVersion, "v_add_co_u32 v0,vcc,v0,1") rv["HasExplicitNC"] = tryAssembler(isaVersion, "v_add_nc_u32 v0,v0,1") rv["HasDirectTo...
.flush() def print2(message): if globalParameters["PrintLevel"] >= 2: print(message) sys.stdout.flush() def printWarning(message): print("Tensile::WARNING: %s" % message) sys.stdout.flush() def printExit(message): print("Tensile::FATAL: %s" % message) sys.stdout.flush() sys.exit(-1) ##############...
256
256
1,238
8
247
rkamd/Tensile
Tensile/Common.py
Python
GetAsmCaps
GetAsmCaps
1,667
1,723
1,667
1,667
4debb6f769b34e34215059d0f692e8249d852733
bigcode/the-stack
train
d9892da3c2ac96782605818b
train
class
class ProgressBar: def __init__(self, maxValue, width=80): self.char = '|' self.maxValue = maxValue self.width = width self.maxTicks = self.width - 7 self.priorValue = 0 self.fraction = 0 self.numTicks = 0 self.createTime = time.time() def increment(self, value=1): self.update...
class ProgressBar:
def __init__(self, maxValue, width=80): self.char = '|' self.maxValue = maxValue self.width = width self.maxTicks = self.width - 7 self.priorValue = 0 self.fraction = 0 self.numTicks = 0 self.createTime = time.time() def increment(self, value=1): self.update(self.priorValue+va...
return open(os.devnull) import filelock return filelock.FileLock(globalParameters["ClientExecutionLockPath"]) # convert python list to C++ initializer style syntax def listToInitializer(l): return "{" + ','.join(map(str, l)) + "}" ############################################################################...
81
81
273
4
76
rkamd/Tensile
Tensile/Common.py
Python
ProgressBar
ProgressBar
2,114
2,148
2,114
2,114
27dc855f9f589198519bffcf21ab626e50ad7da1
bigcode/the-stack
train
e647cda7dcbe10cdebd05cff
train
function
def which(p): exes = [p+x for x in ['', '.exe', '.bat']] system_path = os.environ['PATH'].split(os.pathsep) if p == 'hipcc' and 'CMAKE_CXX_COMPILER' in os.environ and os.path.isfile(os.environ['CMAKE_CXX_COMPILER']): return os.environ['CMAKE_CXX_COMPILER'] for dirname in system_path+[globalParam...
def which(p):
exes = [p+x for x in ['', '.exe', '.bat']] system_path = os.environ['PATH'].split(os.pathsep) if p == 'hipcc' and 'CMAKE_CXX_COMPILER' in os.environ and os.path.isfile(os.environ['CMAKE_CXX_COMPILER']): return os.environ['CMAKE_CXX_COMPILER'] for dirname in system_path+[globalParameters["ROCmBin...
arch, caps in parameters["ArchCaps"].items()])) allArchCaps = sorted(allArchCaps) archCapRows = [capRow(parameters["ArchCaps"], cap) for cap in allArchCaps] printTable([headerRow] + asmCapRows + archCapRows) def which(p):
64
64
133
4
60
rkamd/Tensile
Tensile/Common.py
Python
which
which
1,867
1,877
1,867
1,867
f88bc885d51a1c18df4c9d91653a5e86d116538b
bigcode/the-stack
train
628a50d1013b95d009d83582
train
function
def print1(message): if globalParameters["PrintLevel"] >= 1: print(message) sys.stdout.flush()
def print1(message):
if globalParameters["PrintLevel"] >= 1: print(message) sys.stdout.flush()
param return None elif isinstance(structure, dict): if name in structure: return structure[name] else: return None else: printExit("structure %s is not list or dict" % structure) ################################################################################ # Print Debug ############...
64
64
26
5
58
rkamd/Tensile
Tensile/Common.py
Python
print1
print1
1,632
1,635
1,632
1,632
d1710b834d0312897c771ece311d596edba25e26
bigcode/the-stack
train
8490d93133a6a2ead0a8c906
train
function
def ClientExecutionLock(): if not globalParameters["ClientExecutionLockPath"]: return open(os.devnull) import filelock return filelock.FileLock(globalParameters["ClientExecutionLockPath"])
def ClientExecutionLock():
if not globalParameters["ClientExecutionLockPath"]: return open(os.devnull) import filelock return filelock.FileLock(globalParameters["ClientExecutionLockPath"])
!= tMajor: return False # minor.patch version must be >= if int(qMinor) > int(tMinor): return False if qMinor == tMinor: if int(qStep) > int(tStep): return False return True def ClientExecutionLock():
64
64
42
5
58
rkamd/Tensile
Tensile/Common.py
Python
ClientExecutionLock
ClientExecutionLock
2,099
2,104
2,099
2,099
669661e40ea0a94c2261e6641df9e1cea6ab219e
bigcode/the-stack
train
cc9e2482fc1419182365bdad
train
function
def printExit(message): print("Tensile::FATAL: %s" % message) sys.stdout.flush() sys.exit(-1)
def printExit(message):
print("Tensile::FATAL: %s" % message) sys.stdout.flush() sys.exit(-1)
print(message) sys.stdout.flush() def print2(message): if globalParameters["PrintLevel"] >= 2: print(message) sys.stdout.flush() def printWarning(message): print("Tensile::WARNING: %s" % message) sys.stdout.flush() def printExit(message):
64
64
32
5
59
rkamd/Tensile
Tensile/Common.py
Python
printExit
printExit
1,644
1,647
1,644
1,644
0475c5dd21d9d866ea16a0d867603da863176cf5
bigcode/the-stack
train
3105df940f660d109409a1eb
train
function
def gfxName(arch): # convert last digit to hex because reasons name = str(arch[0]) + str(arch[1]) + ('%x' % arch[2]) return 'gfx' + ''.join(map(str,name))
def gfxName(arch): # convert last digit to hex because reasons
name = str(arch[0]) + str(arch[1]) + ('%x' % arch[2]) return 'gfx' + ''.join(map(str,name))
ipart = ipart[:-1] minor = int(ipart[-1]) ipart = ipart[:-1] major = int(ipart) rv = (major, minor, step) return rv def gfxName(arch): # convert last digit to hex because reasons
64
64
54
16
47
rkamd/Tensile
Tensile/Common.py
Python
gfxName
gfxName
1,789
1,792
1,789
1,790
7f3824c0283efdc58d2ee0b5435daef52241f9f0
bigcode/the-stack
train
4cb2a3f87648b24052211f56
train
class
class SubstitutedDictTest( unittest.TestCase ) : def test( self ) : d = { "a" : "hello ${name}", "b" : IECore.CompoundObject( { "c" : IECore.StringData( "goodbye ${place}" ) } ) } ds = IECore.SubstitutedDict( d, { "name" : "john", "place" : "london" } ) self.assertEqual( ds["a"], "hel...
class SubstitutedDictTest( unittest.TestCase ) :
def test( self ) : d = { "a" : "hello ${name}", "b" : IECore.CompoundObject( { "c" : IECore.StringData( "goodbye ${place}" ) } ) } ds = IECore.SubstitutedDict( d, { "name" : "john", "place" : "london" } ) self.assertEqual( ds["a"], "hello john" ) self.assertEqual( ds["b"]["c"], IECor...
Image Engine Design nor the names of any # other contributors to this software may be used to endorse or # promote products derived from this software without specific prior # written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS # IS" AND ANY EXPRESS OR IM...
234
234
781
12
221
bradleyhenke/cortex
test/IECore/SubstitutedDictTest.py
Python
SubstitutedDictTest
SubstitutedDictTest
38
128
38
39
6747cf7648e2636547ab71b0c0c10eb0dcdd21f0
bigcode/the-stack
train
4552c0ac5a98ea3ac93866b6
train
class
class CreateWalletTest(BitcoinTestFramework): def set_test_params(self): self.setup_clean_chain = False self.num_nodes = 1 self.supports_cli = True def skip_test_if_missing_module(self): self.skip_if_no_wallet() def run_test(self): node = self.nodes[0] node....
class CreateWalletTest(BitcoinTestFramework):
def set_test_params(self): self.setup_clean_chain = False self.num_nodes = 1 self.supports_cli = True def skip_test_if_missing_module(self): self.skip_if_no_wallet() def run_test(self): node = self.nodes[0] node.generate(1) # Leave IBD for sethdseed ...
#!/usr/bin/env python3 # # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test createwallet arguments. """ from test_framework.test_framework import BitcoinTestFramework from test_framework.util import ( assert_equal, a...
80
256
1,854
9
71
bitcoinrtx/bitcoinrtx
test/functional/wallet_createwallet.py
Python
CreateWalletTest
CreateWalletTest
14
132
14
14
13b44dca344175df52930648b45a50f98d8a0f99
bigcode/the-stack
train
ffe943813b7396eecca03c31
train
class
class TexasPlanning(NonClassicAuctionPlanning): ready_to_plan_statuses = ["active.auction"]
class TexasPlanning(NonClassicAuctionPlanning):
ready_to_plan_statuses = ["active.auction"]
# -*- coding: utf-8 -*- import logging from openprocurement.auction.plannings import NonClassicAuctionPlanning LOGGER = logging.getLogger('Openprocurement Auction') class TexasPlanning(NonClassicAuctionPlanning):
46
64
21
9
37
OrysiaDrabych/openprocurement.auction.texas
openprocurement/auction/texas/planning.py
Python
TexasPlanning
TexasPlanning
10
11
10
10
e56474021c97563f45bf8e35f14e83d5bbadad6c
bigcode/the-stack
train
6bbc8c5758a335e2744fbdb9
train
function
def main(): #**************************************INPUT SECTION****************************************** filename = "demo_batch_of_spheres" # name of sphere file mean_radius = 0.5 # average radius of created sphere radius_std = 0.2 # standard deviation of radius for the created sphere spheres_numb...
def main(): #**************************************INPUT SECTION******************************************
filename = "demo_batch_of_spheres" # name of sphere file mean_radius = 0.5 # average radius of created sphere radius_std = 0.2 # standard deviation of radius for the created sphere spheres_number = 10 # total number of sphere created spheres_batches = 1 # change this variable if you want to create m...
from FE_mesh.configure_shots_mesh import mesh_interface from FE_mesh.LSDYNA_keyword_manager import apply_initial_velocity from sphere_generator.shot_stream_generator import shot_stream from sphere_generator.utilities import * def main(): #**************************************INPUT SECTION**************************...
53
201
671
11
42
aalamprou/sFEre
batch_of_spheres_3D.py
Python
main
main
7
61
7
8
516a9d729e8269b7e3fc0d70750f4a67bb4b0366
bigcode/the-stack
train
f8a881755586e40859276815
train
class
class TestAmazonBook(unittest.TestCase): amazon_book = None @classmethod def setUpClass(cls): url = 'https://www.amazon.com/Bayesian-Networks-Introduction-Timo-Koski/dp/0470743042/' cls.amazon_book = AmazonBook(url) def setUp(self): self.amazon_book = TestAmazonBook.amazon_book...
class TestAmazonBook(unittest.TestCase):
amazon_book = None @classmethod def setUpClass(cls): url = 'https://www.amazon.com/Bayesian-Networks-Introduction-Timo-Koski/dp/0470743042/' cls.amazon_book = AmazonBook(url) def setUp(self): self.amazon_book = TestAmazonBook.amazon_book def test_title(self): self....
unittest for AmazonBook """ import unittest import logging from webparser.amazon import AmazonBook __version__ = r'1.00' __author__ = r'Mikhail Ananyevskiy (aka soomrack)' logging.basicConfig(level=logging.INFO) class TestAmazonBook(unittest.TestCase):
64
64
174
8
56
soomrack/webparser
webparser/tests/test_amazon.py
Python
TestAmazonBook
TestAmazonBook
17
35
17
17
b9c39b10a575f43625fa6537da0d932e1670f04d
bigcode/the-stack
train
4bfbac3ae6b8c52ad2670ca5
train
class
class BlogsCorpus(CSVCorpus): """A collection of blog posts, labeled by author gender. See the paper "Improving Gender Classification of Blog Authors" by Mukherjee and Liu <http://www.cs.uic.edu/~liub/publications/EMNLP-2010-blog-gender.pdf> for details and some impressive results.""" def __init__(...
class BlogsCorpus(CSVCorpus):
"""A collection of blog posts, labeled by author gender. See the paper "Improving Gender Classification of Blog Authors" by Mukherjee and Liu <http://www.cs.uic.edu/~liub/publications/EMNLP-2010-blog-gender.pdf> for details and some impressive results.""" def __init__(self, datafiles="blog-gender-d...
, encoding) for cell in row] with open(datafile, "r") as file: for data, label in unicode_csv_reader(file): label = label.strip().upper() # canonicalize label self.documents.append(document_class(data, label, datafile)) class BlogsCorpus(CSVCorpus):
64
64
114
7
57
kahliloppenheimer/Naive-Bayes-Classifier
corpus.py
Python
BlogsCorpus
BlogsCorpus
82
90
82
82
2d6d259249d24b81f8b2531e03f7e254a8dd7a5d
bigcode/the-stack
train
ac35b87b9fc9143ae03389b4
train
class
class Corpus(object): """An abstract collection of documents.""" __metaclass__ = ABCMeta def __init__(self, datafiles, document_class=Document): self.documents = [] self.datafiles = glob(datafiles) for datafile in self.datafiles: self.load(datafile, document_class) ...
class Corpus(object):
"""An abstract collection of documents.""" __metaclass__ = ABCMeta def __init__(self, datafiles, document_class=Document): self.documents = [] self.datafiles = glob(datafiles) for datafile in self.datafiles: self.load(datafile, document_class) # Act as a mutable co...
documents might actually represent words, images, etc.; to the classifier they are merely instances with features.""" from abc import ABCMeta, abstractmethod from csv import reader as csv_reader from glob import glob from os.path import basename, dirname, split, splitext from document import Document class Corpus(obj...
64
64
182
4
59
kahliloppenheimer/Naive-Bayes-Classifier
corpus.py
Python
Corpus
Corpus
14
35
14
14
801ca29d0c3159cb88761039a32d7e9d5b3048fb
bigcode/the-stack
train
22a1c08c24424806eaaaf4c4
train
class
class CSVCorpus(Corpus): """A corpus encoded as a comma-separated-value (CSV) file.""" def load(self, datafile, document_class, encoding="utf-8"): """Make a document from each row of a CSV datafile. Assumes data, label ordering and UTF-8 encoding.""" def unicode_csv_reader(csvfile, *arg...
class CSVCorpus(Corpus):
"""A corpus encoded as a comma-separated-value (CSV) file.""" def load(self, datafile, document_class, encoding="utf-8"): """Make a document from each row of a CSV datafile. Assumes data, label ordering and UTF-8 encoding.""" def unicode_csv_reader(csvfile, *args, **kwargs): ...
): """A collection of names, labeled by gender. See names/README for copyright and license.""" def __init__(self, datafiles="names/*.txt", document_class=Document): super(NamesCorpus, self).__init__(datafiles, document_class) class CSVCorpus(Corpus):
64
64
156
6
58
kahliloppenheimer/Naive-Bayes-Classifier
corpus.py
Python
CSVCorpus
CSVCorpus
68
80
68
68
98fbe16729a37f3b1f2082ef6993d816287935d4
bigcode/the-stack
train
45e6d1ed3f9091cf8a568ef4
train
class
class NamesCorpus(PlainTextLines): """A collection of names, labeled by gender. See names/README for copyright and license.""" def __init__(self, datafiles="names/*.txt", document_class=Document): super(NamesCorpus, self).__init__(datafiles, document_class)
class NamesCorpus(PlainTextLines):
"""A collection of names, labeled by gender. See names/README for copyright and license.""" def __init__(self, datafiles="names/*.txt", document_class=Document): super(NamesCorpus, self).__init__(datafiles, document_class)
directory and extension.""" label = splitext(basename(datafile))[0] with open(datafile, "r") as file: for line in file: data = line.strip() self.documents.append(document_class(data, label, datafile)) class NamesCorpus(PlainTextLines):
64
64
65
8
56
kahliloppenheimer/Naive-Bayes-Classifier
corpus.py
Python
NamesCorpus
NamesCorpus
61
66
61
61
1f4e65f9d22e57f4a1d7e07aac747b9a1d8e7d0d
bigcode/the-stack
train
ff8a011758f0fbe5fe8b291b
train
class
class PlainTextLines(Corpus): """A corpus in which each document is a line in a datafile.""" def load(self, datafile, document_class): """Make a document from each line of a plain text datafile. The document is labeled using the datafile name, sans directory and extension.""" la...
class PlainTextLines(Corpus):
"""A corpus in which each document is a line in a datafile.""" def load(self, datafile, document_class): """Make a document from each line of a plain text datafile. The document is labeled using the datafile name, sans directory and extension.""" label = splitext(basename(datafi...
is labeled using the last component of the datafile's directory.""" label = split(dirname(datafile))[-1] with open(datafile, "r") as file: data = file.read() self.documents.append(document_class(data, label, datafile)) class PlainTextLines(Corpus):
64
64
117
7
57
kahliloppenheimer/Naive-Bayes-Classifier
corpus.py
Python
PlainTextLines
PlainTextLines
48
59
48
48
8b9e18b27bf7c1a45bd886c896f7f0ffe5a83be6
bigcode/the-stack
train
d88691ad935c2c0804804027
train
class
class PlainTextFiles(Corpus): """A corpus contained in a collection of plain-text files.""" def load(self, datafile, document_class): """Make a document from a plain-text datafile. The document is labeled using the last component of the datafile's directory.""" label = split(dirname(dat...
class PlainTextFiles(Corpus):
"""A corpus contained in a collection of plain-text files.""" def load(self, datafile, document_class): """Make a document from a plain-text datafile. The document is labeled using the last component of the datafile's directory.""" label = split(dirname(datafile))[-1] with open(...
, value): self.documents[key] = value def __delitem__(self, key): del self.documents[key] @abstractmethod def load(self, datafile, document_class): """Make labeled document instances for the data in a file.""" pass class PlainTextFiles(Corpus):
64
64
102
7
56
kahliloppenheimer/Naive-Bayes-Classifier
corpus.py
Python
PlainTextFiles
PlainTextFiles
37
46
37
37
49502e1ed668d3911087c27280a4e02187daa930
bigcode/the-stack
train
0c2a1daafc033bcacc27a084
train
function
def upgrade(): pass
def upgrade():
pass
a0614de9cee5 Revises: None Create Date: 2020-02-18 21:24:32.956352 """ # revision identifiers, used by Alembic. revision = 'a0614de9cee5' down_revision = None def upgrade():
64
64
6
3
60
jackrosenthal/algobowl
migration/versions/a0614de9cee5_initial_schema.py
Python
upgrade
upgrade
14
15
14
14
1d5a403ea9b06ac507d5747dcc49b264b8587cb1
bigcode/the-stack
train
e0efc4c32a5980d97bd5ed55
train
function
def downgrade(): pass
def downgrade():
pass
5 Revises: None Create Date: 2020-02-18 21:24:32.956352 """ # revision identifiers, used by Alembic. revision = 'a0614de9cee5' down_revision = None def upgrade(): pass def downgrade():
64
64
6
3
60
jackrosenthal/algobowl
migration/versions/a0614de9cee5_initial_schema.py
Python
downgrade
downgrade
18
19
18
18
159c894bca0d9c55968917c4b9f7c18e26716f4c
bigcode/the-stack
train
8f90ed028b1d9aaacc26f92f
train
function
def main(args): pass
def main(args):
pass
def main(args):
4
64
7
4
0
jarias/dotfiles
.config/kitty/zoom_toggle.py
Python
main
main
1
2
1
1
68ec4d6848271f8a71d79ee62a39a645c030efe6
bigcode/the-stack
train
6e82b35232ae7d5f07427d8b
train
function
@result_handler(no_ui=True) def handle_result(args, answer, target_window_id, boss): tab = boss.active_tab if tab is not None: if tab.current_layout.name == 'stack': tab.last_used_layout() else: tab.goto_layout('stack')
@result_handler(no_ui=True) def handle_result(args, answer, target_window_id, boss):
tab = boss.active_tab if tab is not None: if tab.current_layout.name == 'stack': tab.last_used_layout() else: tab.goto_layout('stack')
def main(args): pass from kittens.tui.handler import result_handler @result_handler(no_ui=True) def handle_result(args, answer, target_window_id, boss):
36
64
60
20
15
jarias/dotfiles
.config/kitty/zoom_toggle.py
Python
handle_result
handle_result
5
12
5
6
27a9efb2e0a876c2eeb5901b0a1579bd4d0022bd
bigcode/the-stack
train
eb80513ebc5681314589593a
train
class
class Migration(migrations.Migration): dependencies = [ ('feedback', '0029_auto_20220324_0944'), ] operations = [ migrations.AddField( model_name='report', name='uuid', field=models.UUIDField(default=uuid.uuid4, editable=False, null=True), ), ...
class Migration(migrations.Migration):
dependencies = [ ('feedback', '0029_auto_20220324_0944'), ] operations = [ migrations.AddField( model_name='report', name='uuid', field=models.UUIDField(default=uuid.uuid4, editable=False, null=True), ), migrations.AlterField( ...
# Generated by Django 3.1.14 on 2022-03-24 09:47 from django.db import migrations, models import uuid class Migration(migrations.Migration):
41
64
109
7
33
GeotrekCE/Geotrek
geotrek/feedback/migrations/0030_auto_20220324_0947.py
Python
Migration
Migration
7
24
7
8
470a7bca94bd0f63cff5c44f36b9dd229700bab4
bigcode/the-stack
train
1eedfc4f21425c0f66d28f62
train
class
class ExtendedProducerResponsibilityPolicy(object): """NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ """ Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. ...
class ExtendedProducerResponsibilityPolicy(object):
"""NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ """ Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name ...
# coding: utf-8 """ Metadata API The Metadata API has operations that retrieve configuration details pertaining to the different eBay marketplaces. In addition to marketplace information, the API also has operations that get information that helps sellers list items on eBay. # noqa: E501 OpenAPI spec ve...
112
256
1,191
8
103
matecsaj/ebay_rest
src/ebay_rest/api/sell_metadata/models/extended_producer_responsibility_policy.py
Python
ExtendedProducerResponsibilityPolicy
ExtendedProducerResponsibilityPolicy
18
168
18
18
a4a058bce35a86c53304e60d204b6acef8322487
bigcode/the-stack
train
98e730241efcabd5dc6f7701
train
class
class DesMessageType(IntEnum): """ Types of DES message types """ ERROR = 0 WARNING = 1 INFO = 2
class DesMessageType(IntEnum):
""" Types of DES message types """ ERROR = 0 WARNING = 1 INFO = 2
9 GET_USER_CONNECTION = 10 OTHER = 11 GET_ALL_TABLES = 12 COMPILATION_ERROR = 13 TLE_USER_CODE = 14 EXECUTE_DISCRIMINANT_SELECT = 15 class DesMessageType(IntEnum):
64
64
33
7
56
emartinm/lsql
lsql/judge/types.py
Python
DesMessageType
DesMessageType
91
95
91
91
70978fac560965a2080fca5fa1fd7255c04af189
bigcode/the-stack
train
9a158e7dadcf53abd6a015f6
train
class
class VerdictCode(models.TextChoices): """Codes representing different judge verdicts""" AC = 'AC', _('Aceptado') TLE = 'TLE', _('Tiempo limite excedido') RE = 'RE', _('Error en ejecución') WA = 'WA', _('Resultados incorrectos') IE = 'IE', _('Error interno') VE = 'VE', _('Error de validación...
class VerdictCode(models.TextChoices):
"""Codes representing different judge verdicts""" AC = 'AC', _('Aceptado') TLE = 'TLE', _('Tiempo limite excedido') RE = 'RE', _('Error en ejecución') WA = 'WA', _('Resultados incorrectos') IE = 'IE', _('Error interno') VE = 'VE', _('Error de validación') def html_short_name(self): ...
# -*- coding: utf-8 -*- """ Copyright Enrique Martín <emartinm@ucm.es> 2020 Types used in LearnSQL """ from enum import IntEnum, unique from django.db import models from django.utils.translation import gettext_lazy as _ class VerdictCode(models.TextChoices):
63
177
591
7
56
emartinm/lsql
lsql/judge/types.py
Python
VerdictCode
VerdictCode
13
56
13
13
d1107cba0ebee384c766ad425e0946a0d58abd0a
bigcode/the-stack
train
c2f2044c4c0ab8e818dd13ac
train
class
@unique class OracleStatusCode(IntEnum): """Status code returned by the DB executor""" OK = 0 GET_ADMIN_CONNECTION = 1 CREATE_USER = 2 EXECUTE_CREATE = 3 EXECUTE_INSERT = 4 EXECUTE_USER_CODE = 5 NUMBER_STATEMENTS = 6 DROP_USER = 7 RELEASE_ADMIN_CONNECTION = 8 CLOSE_USER_CONNE...
@unique class OracleStatusCode(IntEnum):
"""Status code returned by the DB executor""" OK = 0 GET_ADMIN_CONNECTION = 1 CREATE_USER = 2 EXECUTE_CREATE = 3 EXECUTE_INSERT = 4 EXECUTE_USER_CODE = 5 NUMBER_STATEMENTS = 6 DROP_USER = 7 RELEASE_ADMIN_CONNECTION = 8 CLOSE_USER_CONNECTION = 9 GET_USER_CONNECTION = 10 ...
@unique class ProblemType(IntEnum): """Types of problems""" SELECT = 0 DML = 1 FUNCTION = 2 PROC = 3 TRIGGER = 4 DISC = 5 @unique class OracleStatusCode(IntEnum):
64
64
151
10
53
emartinm/lsql
lsql/judge/types.py
Python
OracleStatusCode
OracleStatusCode
70
88
70
71
64bb9984db882d4949a902c850d89709d973f9a3
bigcode/the-stack
train
93c09298cc1ad7a62bf85123
train
class
@unique class ProblemType(IntEnum): """Types of problems""" SELECT = 0 DML = 1 FUNCTION = 2 PROC = 3 TRIGGER = 4 DISC = 5
@unique class ProblemType(IntEnum):
"""Types of problems""" SELECT = 0 DML = 1 FUNCTION = 2 PROC = 3 TRIGGER = 4 DISC = 5
else _("sentencia SQL") msg = _('Tu envío debe estar formado por entre {min_stmt} y {max_stmt} ' '{ending}.').format(min_stmt=problem.min_stmt, max_stmt=problem.max_stmt, ending=ending) return msg @unique class ProblemType(IntEnum):
64
64
53
9
54
emartinm/lsql
lsql/judge/types.py
Python
ProblemType
ProblemType
59
67
59
60
dd1c43215863667b35384f5351c391f8620f9fe5
bigcode/the-stack
train
3c7fe35bd8da562b0ade28bd
train
function
def AdjustOpacity( image, opacity_factor ): new_image = QG.QImage( image.width(), image.height(), QG.QImage.Format_RGBA8888 ) new_image.fill( QC.Qt.transparent ) painter = QG.QPainter( new_image ) painter.setOpacity( opacity_factor ) painter.drawImage( 0, 0, image ) ...
def AdjustOpacity( image, opacity_factor ):
new_image = QG.QImage( image.width(), image.height(), QG.QImage.Format_RGBA8888 ) new_image.fill( QC.Qt.transparent ) painter = QG.QPainter( new_image ) painter.setOpacity( opacity_factor ) painter.drawImage( 0, 0, image ) return new_image
rect.width() < scroll_area.viewport().width(): rect.setWidth( scroll_area.viewport().width() ) if rect.height() < scroll_area.viewport().height(): rect.setHeight( scroll_area.viewport().height() ) return rect def AdjustOpacity( image, opacity_factor ):
64
64
85
10
53
XVicarious/hydrus
include/QtPorting.py
Python
AdjustOpacity
AdjustOpacity
1,112
1,124
1,112
1,113
bbbca7ad50a16fe630c88feb8f7f3d1954891546
bigcode/the-stack
train
371d6154810f4343e5a749b2
train
class
class EllipsizedLabel( QW.QLabel ): def __init__( self, parent = None, ellipsize_end = False ): QW.QLabel.__init__( self, parent ) self._ellipsize_end = ellipsize_end def minimumSizeHint( self ): if self._ellipsize_end: ...
class EllipsizedLabel( QW.QLabel ):
def __init__( self, parent = None, ellipsize_end = False ): QW.QLabel.__init__( self, parent ) self._ellipsize_end = ellipsize_end def minimumSizeHint( self ): if self._ellipsize_end: return self.sizeHint() ...
def GetCurrentIndex( self ): for i in range( len( self._choices ) ): if self._choices[ i ].isChecked(): return i return -1 def SetStringSelection( self, str ): for i in range( len( self._choices ) ): ...
202
202
675
12
189
XVicarious/hydrus
include/QtPorting.py
Python
EllipsizedLabel
EllipsizedLabel
1,868
1,993
1,868
1,869
ebc63531feb827dabd70e622dd3d8db6cfd75794
bigcode/the-stack
train
5ec3154508ad74efa890e191
train
function
def SetForegroundColour( widget, colour ): widget.setAutoFillBackground( True ) object_name = widget.objectName() if not object_name: object_name = str( id( widget ) ) widget.setObjectName( object_name ) if isinstance( colour, QG.QColor ): ...
def SetForegroundColour( widget, colour ):
widget.setAutoFillBackground( True ) object_name = widget.objectName() if not object_name: object_name = str( id( widget ) ) widget.setObjectName( object_name ) if isinstance( colour, QG.QColor ): widget.setStyleSheet( '#{} {{ color: {} }}'.form...
'.format( object_name, TupleToQColor( colour ).name() ) ) else: widget.setStyleSheet( '#{} {{ background-color: {} }}'.format( object_name, QG.QColor( colour ).name() ) ) def SetForegroundColour( widget, colour ):
62
64
164
10
52
XVicarious/hydrus
include/QtPorting.py
Python
SetForegroundColour
SetForegroundColour
1,463
1,486
1,463
1,464
47a751e6c2019b80530e8b3d4cc834ee24b539c0
bigcode/the-stack
train
17263dd35718e8573591dd2d
train
function
def TupleToQPoint( tup ): if isinstance( tup, QC.QPoint ): raise ValueError( 'Unnecessary use of TupleToQPoint' ) else: return QC.QPoint( tup[ 0 ], tup[ 1 ] )
def TupleToQPoint( tup ):
if isinstance( tup, QC.QPoint ): raise ValueError( 'Unnecessary use of TupleToQPoint' ) else: return QC.QPoint( tup[ 0 ], tup[ 1 ] )
- window.rect().center() ) def WarningHandler( msg_type, context, str ): if msg_type == QC.QtWarningMsg: print( str ) def TupleToQColor( tup): return QG.QColor( *tup ) def TupleToQPoint( tup ):
64
64
56
9
55
XVicarious/hydrus
include/QtPorting.py
Python
TupleToQPoint
TupleToQPoint
1,323
1,331
1,323
1,324
f7df936ae538084346dce265186c4f9acf389f64
bigcode/the-stack
train
4be29285dca768c88868d476
train
class
class GridLayout( QW.QGridLayout ): def __init__( self, cols = 1, spacing = 2 ): QW.QGridLayout.__init__( self ) self._col_count = cols self.setMargin( 2 ) self.setSpacing( spacing ) def GetFixedColumnCount( self ): return self._co...
class GridLayout( QW.QGridLayout ):
def __init__( self, cols = 1, spacing = 2 ): QW.QGridLayout.__init__( self ) self._col_count = cols self.setMargin( 2 ) self.setSpacing( spacing ) def GetFixedColumnCount( self ): return self._col_count def setMargin( self, val ): ...
splitter.setSizes( [ vpos, total_sum - vpos ] ) def MakeQLabelWithAlignment( label, parent, align ): res = QW.QLabel( label, parent ) res.setAlignment( align ) return res class GridLayout( QW.QGridLayout ):
64
64
106
11
52
XVicarious/hydrus
include/QtPorting.py
Python
GridLayout
GridLayout
875
891
875
876
aafcb9006ebef52f0a809acecc4256e43afff47b
bigcode/the-stack
train
fd85de23ad509dc233d2a67a
train
function
def WarningHandler( msg_type, context, str ): if msg_type == QC.QtWarningMsg: print( str )
def WarningHandler( msg_type, context, str ):
if msg_type == QC.QtWarningMsg: print( str )
.move( parent_window.mapToGlobal( parent_window.rect().center() ) - window.rect().center() ) def CenterOnScreen( window ): window.move( QW.QApplication.desktop().availableGeometry().center() - window.rect().center() ) def WarningHandler( msg_type, context, str ):
64
64
28
12
52
XVicarious/hydrus
include/QtPorting.py
Python
WarningHandler
WarningHandler
1,311
1,315
1,311
1,312
f50ae7686e7e7c9cd396dda47e880eba90e9dced
bigcode/the-stack
train
3af600e83cf92ecb88fb4cd0
train
function
def ListWidgetGetStringSelection( widget ): for i in range( widget.count() ): if widget.item( i ).isSelected(): return widget.item( i ).text() return None
def ListWidgetGetStringSelection( widget ):
for i in range( widget.count() ): if widget.item( i ).isSelected(): return widget.item( i ).text() return None
().deleteLater() elif item.layout(): ClearLayout( item.layout(), delete_widgets = True ) item.layout().deleteLater() else: spacer = item.layout().spacerItem() del spacer layout.removeItem( item ) def ListWidgetGetStrin...
62
64
43
10
52
XVicarious/hydrus
include/QtPorting.py
Python
ListWidgetGetStringSelection
ListWidgetGetStringSelection
1,259
1,265
1,259
1,260
f8b109c25965265e8771ec6b4d8f93ef79932a41
bigcode/the-stack
train
3ed056542d692c122b22a113
train
function
def ClearLayout( layout, delete_widgets = False ): while layout.count() > 0: item = layout.itemAt( 0 ) if delete_widgets: if item.widget(): item.widget().deleteLater() elif item.layout(): ClearLayout( item.layout(), delete_widgets = ...
def ClearLayout( layout, delete_widgets = False ):
while layout.count() > 0: item = layout.itemAt( 0 ) if delete_widgets: if item.widget(): item.widget().deleteLater() elif item.layout(): ClearLayout( item.layout(), delete_widgets = True ) item.layout().deleteLater() ...
kwargs ): QW.QApplication.instance().postEvent( QW.QApplication.instance().call_after_catcher, CallAfterEvent( fn, *args, **kwargs ) ) QW.QApplication.instance().eventDispatcher().wakeUp() def ClearLayout( layout, delete_widgets = False ):
63
64
96
12
51
XVicarious/hydrus
include/QtPorting.py
Python
ClearLayout
ClearLayout
1,233
1,256
1,233
1,234
119affed7dab35536c7d3cea712353e8a2e2c22e
bigcode/the-stack
train
42865890ba67d95085195887
train
function
def EscapeMnemonics( str ): return str.replace( "&", "&&" )
def EscapeMnemonics( str ):
return str.replace( "&", "&&" )
stretch_factor ) if zero_border: margin = 0 if isinstance( item, QW.QFrame ): margin = item.frameWidth() item.setContentsMargins( margin, margin, margin, margin ) def EscapeMnemonic...
62
64
20
9
53
XVicarious/hydrus
include/QtPorting.py
Python
EscapeMnemonics
EscapeMnemonics
1,088
1,090
1,088
1,089
94e40a78d0e5afa970c830e9b87739cdde8597ed
bigcode/the-stack
train
5c0b2271c8c3f6ba0194aef8
train
function
def MonkeyPatchMissingMethods(): if qtpy.PYQT5: def QPointToTuple( self ): return ( self.x(), self.y() ) def QSizeToTuple( self ): return ( self.width(), self.height() ) def QColorToTuple( self ): ...
def MonkeyPatchMissingMethods():
if qtpy.PYQT5: def QPointToTuple( self ): return ( self.x(), self.y() ) def QSizeToTuple( self ): return ( self.width(), self.height() ) def QColorToTuple( self ): return ( self.red(), self....
sip.simplewrapper ): return not sip.isdeleted( obj ) return True elif qtpy.PYSIDE2: import shiboken2 isValid = shiboken2.isValid else: raise RuntimeError( 'You need either PySide2 or PyQt5' ) def MonkeyPatchMissingMethods():
75
75
250
7
68
XVicarious/hydrus
include/QtPorting.py
Python
MonkeyPatchMissingMethods
MonkeyPatchMissingMethods
59
97
59
60
cb1e6cb4b0fd9303a1fbbe5c200e1eaa63761e64
bigcode/the-stack
train
00512def4067d63dbb814f20
train
class
class DirPickerCtrl( QW.QWidget ): dirPickerChanged = QC.Signal() def __init__( self, parent ): QW.QWidget.__init__( self, parent ) layout = HBoxLayout( spacing = 2 ) self._path_edit = QW.QLineEdit( self ) self._button = QW.QPushButton( '...
class DirPickerCtrl( QW.QWidget ):
dirPickerChanged = QC.Signal() def __init__( self, parent ): QW.QWidget.__init__( self, parent ) layout = HBoxLayout( spacing = 2 ) self._path_edit = QW.QLineEdit( self ) self._button = QW.QPushButton( 'browse', self ) sel...
self._UpdateLabels() def SetValue( self, value ): self._slider.setValue( value ) self._UpdateLabels() def SplitterVisibleCount( splitter ): count = 0 for i in range( splitter.count() ): if splitter.widget( i ).isVisible(...
90
90
300
11
78
XVicarious/hydrus
include/QtPorting.py
Python
DirPickerCtrl
DirPickerCtrl
196
255
196
197
d2b89a8b7b38f8590ea152ec2109c730a8c72e3e
bigcode/the-stack
train
a9dc17c51c8d9d810c4b8dcf
train
function
def CenterOnWindow( parent, window ): parent_window = parent.window() window.move( parent_window.mapToGlobal( parent_window.rect().center() ) - window.rect().center() )
def CenterOnWindow( parent, window ):
parent_window = parent.window() window.move( parent_window.mapToGlobal( parent_window.rect().center() ) - window.rect().center() )
class in GetClientData' ) def Unsplit( splitter, widget ): if widget.parentWidget() == splitter: widget.setVisible( False ) def GetSystemColour( colour ): return QG.QPalette().color( colour ) def CenterOnWindow( parent, window ):
64
64
42
10
54
XVicarious/hydrus
include/QtPorting.py
Python
CenterOnWindow
CenterOnWindow
1,301
1,305
1,301
1,302
1f0e4ed8e60bd1c458176eee6cb0c3fae75c1d6e
bigcode/the-stack
train
1d9a25a1bb7e5c613e27b870
train
function
def ScrollAreaVisibleRect( scroll_area ): if not scroll_area.widget(): return QC.QRect( 0, 0, 0, 0 ) rect = scroll_area.widget().visibleRegion().boundingRect() # Do not allow it to be smaller than the scroll area's viewport size: if rect.width() < scroll_area.viewport().width(): ...
def ScrollAreaVisibleRect( scroll_area ):
if not scroll_area.widget(): return QC.QRect( 0, 0, 0, 0 ) rect = scroll_area.widget().visibleRegion().boundingRect() # Do not allow it to be smaller than the scroll area's viewport size: if rect.width() < scroll_area.viewport().width(): rect.setWidth( scroll_area.viewport()....
( item, QW.QFrame ): margin = item.frameWidth() item.setContentsMargins( margin, margin, margin, margin ) def EscapeMnemonics( str ): return str.replace( "&", "&&" ) def ScrollAreaVisibleRect( scroll_area ):
64
64
121
10
54
XVicarious/hydrus
include/QtPorting.py
Python
ScrollAreaVisibleRect
ScrollAreaVisibleRect
1,093
1,110
1,093
1,094
52f929d43d40bec4de68fd84f18282ea2dbf7422
bigcode/the-stack
train
8fa8049a69c1c461026ad87b
train
function
def ListWidgetIndexForString( widget, string ): for i in range( widget.count() ): if widget.item( i ).text() == string: return i return -1
def ListWidgetIndexForString( widget, string ):
for i in range( widget.count() ): if widget.item( i ).text() == string: return i return -1
Selected(): return i return -1 def ListWidgetGetStrings( widget ): strings = [] for i in range( widget.count() ): strings.append( widget.item( i ).text() ) return strings def ListWidgetIndexForString( widget, string ):
64
64
43
12
51
XVicarious/hydrus
include/QtPorting.py
Python
ListWidgetIndexForString
ListWidgetIndexForString
1,378
1,384
1,378
1,379
8e97ccb1b36a18d49b42110893736ce353fe3d03
bigcode/the-stack
train
0631d10ff95e0b311a5c7e8f
train
class
class AboutDialogInfo: def __init__( self ): self.name = '' self.version = '' self.description = '' self.license = '' self.developers = [] self.website = '' def SetName( self, name ): self.name = name def SetVersion( self, ver...
class AboutDialogInfo:
def __init__( self ): self.name = '' self.version = '' self.description = '' self.license = '' self.developers = [] self.website = '' def SetName( self, name ): self.name = name def SetVersion( self, version ): sel...
self.addWidget( label, -1 * w ) else: label.setFixedWidth( w ) self.addWidget( label ) def SetStatusText( self, text, index ): self._labels[index].setText( text ) class AboutDial...
64
64
150
6
58
XVicarious/hydrus
include/QtPorting.py
Python
AboutDialogInfo
AboutDialogInfo
1,551
1,589
1,551
1,552
cfeaf7cda6a0192466a58ab41509fc14cb994de5
bigcode/the-stack
train
4a1e7d64b79f3b0d4194f2cc
train
class
class TabWidgetWithDnD( QW.QTabWidget ): pageDragAndDropped = QC.Signal( QW.QWidget, QW.QWidget ) def __init__( self, parent = None ): QW.QTabWidget.__init__( self, parent ) self.setTabBar( TabBar( self ) ) self.setAcceptDrops( True ) ...
class TabWidgetWithDnD( QW.QTabWidget ):
pageDragAndDropped = QC.Signal( QW.QWidget, QW.QWidget ) def __init__( self, parent = None ): QW.QTabWidget.__init__( self, parent ) self.setTabBar( TabBar( self ) ) self.setAcceptDrops( True ) self._tab_bar = self.tabBar() ...
event.globalPos() QW.QTabBar.mousePressEvent( self, event ) def dragEnterEvent(self, event): if 'application/hydrus-tab' in event.mimeData().formats(): event.ignore() else: event.accept() ...
256
256
2,309
14
242
XVicarious/hydrus
include/QtPorting.py
Python
TabWidgetWithDnD
TabWidgetWithDnD
442
798
442
443
4b7bcbfb78c886af3ce353718939645c64a5b361
bigcode/the-stack
train
483e0106dc8d431c3ed78fba
train
function
def ListWidgetIsSelected( widget, idx ): if idx == -1: return False return widget.item( idx ).isSelected()
def ListWidgetIsSelected( widget, idx ):
if idx == -1: return False return widget.item( idx ).isSelected()
i ).text() ) return strings def ListWidgetIndexForString( widget, string ): for i in range( widget.count() ): if widget.item( i ).text() == string: return i return -1 def ListWidgetIsSelected( widget, idx ):
64
64
31
11
52
XVicarious/hydrus
include/QtPorting.py
Python
ListWidgetIsSelected
ListWidgetIsSelected
1,387
1,391
1,387
1,388
7f36858823ea7297d74216383bb0e776cfb6067d
bigcode/the-stack
train
6aa224c5e9eae4aa04a6ecab
train
class
class VBoxLayout( QW.QVBoxLayout ): def __init__( self, margin = 2, spacing = 2 ): QW.QVBoxLayout.__init__( self ) self.setMargin( margin ) self.setSpacing( spacing ) def setMargin( self, val ): self.setContentsMargins( val, val, val, val )
class VBoxLayout( QW.QVBoxLayout ):
def __init__( self, margin = 2, spacing = 2 ): QW.QVBoxLayout.__init__( self ) self.setMargin( margin ) self.setSpacing( spacing ) def setMargin( self, val ): self.setContentsMargins( val, val, val, val )
QW.QHBoxLayout.__init__( self ) self.setMargin( margin ) self.setSpacing( spacing ) def setMargin( self, val ): self.setContentsMargins( val, val, val, val ) class VBoxLayout( QW.QVBoxLayout ):
63
64
80
11
52
XVicarious/hydrus
include/QtPorting.py
Python
VBoxLayout
VBoxLayout
116
128
116
117
5ba85ecca958e6352cff311093073e463d77a3a7
bigcode/the-stack
train
af35494bd34dd477fe2dff96
train
function
def CallAfter( fn, *args, **kwargs ): QW.QApplication.instance().postEvent( QW.QApplication.instance().call_after_catcher, CallAfterEvent( fn, *args, **kwargs ) ) QW.QApplication.instance().eventDispatcher().wakeUp()
def CallAfter( fn, *args, **kwargs ):
QW.QApplication.instance().postEvent( QW.QApplication.instance().call_after_catcher, CallAfterEvent( fn, *args, **kwargs ) ) QW.QApplication.instance().eventDispatcher().wakeUp()
def eventFilter( self, watched, event ): if event.type() == CallAfterEventType and isinstance( event, CallAfterEvent ): event.Execute() event.accept() return True return False def CallAfter( fn, *a...
63
64
61
13
49
XVicarious/hydrus
include/QtPorting.py
Python
CallAfter
CallAfter
1,226
1,230
1,226
1,227
d1f76be2d9ba87d8b9d2ff6d117171490dd28f4b
bigcode/the-stack
train
d3255f5e09efd92a52dd0b58
train
function
def ListWidgetSetSelection( widget, idxs ): widget.clearSelection() if not isinstance( idxs, list ): idxs = [ idxs ] for idx in idxs: if idx != -1: widget.item( idx ).setSelected( True )
def ListWidgetSetSelection( widget, idxs ):
widget.clearSelection() if not isinstance( idxs, list ): idxs = [ idxs ] for idx in idxs: if idx != -1: widget.item( idx ).setSelected( True )
if widget.item( i ).text() == string: return i return -1 def ListWidgetIsSelected( widget, idx ): if idx == -1: return False return widget.item( idx ).isSelected() def ListWidgetSetSelection( widget, idxs ):
64
64
62
12
52
XVicarious/hydrus
include/QtPorting.py
Python
ListWidgetSetSelection
ListWidgetSetSelection
1,394
1,404
1,394
1,395
6b6815d0228e459e7c12b28b8072085f90c43187
bigcode/the-stack
train
d6683b518319e5fb21f650ce
train
function
def GetBackgroundColour( widget ): return widget.palette().color( QG.QPalette.Window )
def GetBackgroundColour( widget ):
return widget.palette().color( QG.QPalette.Window )
) class BusyCursor: def __enter__( self ): QW.QApplication.setOverrideCursor( QC.Qt.WaitCursor ) def __exit__( self, exc_type, exc_val, exc_tb ): QW.QApplication.restoreOverrideCursor() def GetBackgroundColour( widget ):
64
64
21
8
56
XVicarious/hydrus
include/QtPorting.py
Python
GetBackgroundColour
GetBackgroundColour
1,179
1,181
1,179
1,180
5a2396245d4dbdd9e6cda24bdeaab41095600496
bigcode/the-stack
train
8e302a2a6c5a8912a5858062
train
function
def SetBackgroundColour( widget, colour ): widget.setAutoFillBackground( True ) object_name = widget.objectName() if not object_name: object_name = str( id( widget ) ) widget.setObjectName( object_name ) if isinstance( colour, QG.QColor ): widget.setSty...
def SetBackgroundColour( widget, colour ):
widget.setAutoFillBackground( True ) object_name = widget.objectName() if not object_name: object_name = str( id( widget ) ) widget.setObjectName( object_name ) if isinstance( colour, QG.QColor ): widget.setStyleSheet( '#{} {{ background-color: {} }}'.fo...
size = QC.QSize( size[0], size[1] ) if size.width() >= 0: widget.setMinimumWidth( size.width() ) if size.height() >= 0: widget.setMinimumHeight( size.height() ) def SetBackgroundColour( widget, colour ):
64
64
167
10
54
XVicarious/hydrus
include/QtPorting.py
Python
SetBackgroundColour
SetBackgroundColour
1,438
1,460
1,438
1,439
e4d80844264499aa980865d9158aeb60a10a412f
bigcode/the-stack
train
6908338613b49cb365e48735
train
function
def DeleteAllNotebookPages( notebook ): while notebook.count() > 0: tab = notebook.widget( 0 ) notebook.removeTab( 0 ) tab.deleteLater()
def DeleteAllNotebookPages( notebook ):
while notebook.count() > 0: tab = notebook.widget( 0 ) notebook.removeTab( 0 ) tab.deleteLater()
neighbour_page.GetPageKey() else: page_key = source_notebook.GetPageKey() HG.client_controller.gui.ShowPage( page_key ) self.pageDragAndDrop...
62
64
43
9
53
XVicarious/hydrus
include/QtPorting.py
Python
DeleteAllNotebookPages
DeleteAllNotebookPages
801
809
801
802
be0482986e5d702ea8f09642a46c4736c1159407
bigcode/the-stack
train
25560c7be06c8f2c73a59d7f
train
class
class PasswordEntryDialog( Dialog ): def __init__( self, parent, message, caption ): Dialog.__init__( self, parent ) self.setWindowTitle( caption ) self._ok_button = QW.QPushButton( 'OK', self ) self._ok_button.clicked.connect( self.accept ) ...
class PasswordEntryDialog( Dialog ):
def __init__( self, parent, message, caption ): Dialog.__init__( self, parent ) self.setWindowTitle( caption ) self._ok_button = QW.QPushButton( 'OK', self ) self._ok_button.clicked.connect( self.accept ) self._cancel_button = QW.QPushButto...
_user def SetCancelled( self, closed ): self._closed_by_user = closed def __enter__( self ): return self def __exit__( self, exc_type, exc_val, exc_tb ): if isValid( self ): self.deleteLater...
74
77
258
8
66
XVicarious/hydrus
include/QtPorting.py
Python
PasswordEntryDialog
PasswordEntryDialog
2,056
2,092
2,056
2,057
1ac0986eaa7faa8ce6796dc4225854fc56990f9f
bigcode/the-stack
train
21154ed89c19f04d9ff7cf6d
train
function
def SetMinClientSize( widget, size ): if isinstance( size, tuple ): size = QC.QSize( size[0], size[1] ) if size.width() >= 0: widget.setMinimumWidth( size.width() ) if size.height() >= 0: widget.setMinimumHeight( size.height() )
def SetMinClientSize( widget, size ):
if isinstance( size, tuple ): size = QC.QSize( size[0], size[1] ) if size.width() >= 0: widget.setMinimumWidth( size.width() ) if size.height() >= 0: widget.setMinimumHeight( size.height() )
Size( size[ 0 ], size[ 1 ] ) if size.width() < 0: size.setWidth( widget.width() ) if size.height() < 0: size.setHeight( widget.height() ) widget.resize( size ) def SetMinClientSize( widget, size ):
64
64
74
11
53
XVicarious/hydrus
include/QtPorting.py
Python
SetMinClientSize
SetMinClientSize
1,510
1,518
1,510
1,511
586f6a4de891ed2abdf1cc28e465efd0e47c6ca6
bigcode/the-stack
train
ebff34848cc86b0577786877
train
class
class LabelledSlider( QW.QWidget ): def __init__( self, parent = None ): QW.QWidget.__init__( self, parent ) self.setLayout( VBoxLayout( spacing = 2 ) ) top_layout = HBoxLayout( spacing = 2 ) self._min_label = QW.QLabel() self._max_lab...
class LabelledSlider( QW.QWidget ):
def __init__( self, parent = None ): QW.QWidget.__init__( self, parent ) self.setLayout( VBoxLayout( spacing = 2 ) ) top_layout = HBoxLayout( spacing = 2 ) self._min_label = QW.QLabel() self._max_label = QW.QLabel() self._value_labe...
def setMargin( self, val ): self.setContentsMargins( val, val, val, val ) class VBoxLayout( QW.QVBoxLayout ): def __init__( self, margin = 2, spacing = 2 ): QW.QVBoxLayout.__init__( self ) self.setMargin( margin ) self.setSpacing( spacin...
117
119
397
11
106
XVicarious/hydrus
include/QtPorting.py
Python
LabelledSlider
LabelledSlider
131
182
131
132
c66fe75b3442cf372f2eb29b8b4add09b158fcff
bigcode/the-stack
train
65526aa3bf9e1eacf62d3f0f
train
function
def AdjustColour( colour, percent ): percent = percent / 100 return QG.QColor( colour.red() + colour.red() * percent, colour.green() + colour.green() * percent, colour.blue() + colour.blue() * percent, colour.alpha() )
def AdjustColour( colour, percent ):
percent = percent / 100 return QG.QColor( colour.red() + colour.red() * percent, colour.green() + colour.green() * percent, colour.blue() + colour.blue() * percent, colour.alpha() )
): shortcut = QW.QShortcut( widget ) shortcut.setKey( ToKeySequence( modifier, key ) ) shortcut.setContext( QC.Qt.WidgetWithChildrenShortcut ) shortcut.activated.connect( lambda: callable( *args ) ) def AdjustColour( colour, percent ):
64
64
58
9
55
XVicarious/hydrus
include/QtPorting.py
Python
AdjustColour
AdjustColour
1,162
1,166
1,162
1,163
7bf4a921fe2ea9263efe4720bb91c3fb671fc939
bigcode/the-stack
train
c85a20da0a42e58f76790d63
train
function
def SplitHorizontally( splitter, w1, w2, vpos ): splitter.setOrientation( QC.Qt.Vertical ) if w1.parentWidget() != splitter: splitter.addWiget( w1 ) w1.setVisible( True ) if w2.parentWidget() != splitter: splitter.addWiget( w2 ) w2.setVi...
def SplitHorizontally( splitter, w1, w2, vpos ):
splitter.setOrientation( QC.Qt.Vertical ) if w1.parentWidget() != splitter: splitter.addWiget( w1 ) w1.setVisible( True ) if w2.parentWidget() != splitter: splitter.addWiget( w2 ) w2.setVisible( True ) total_sum = sum( splitter.sizes...
< 0: splitter.setSizes( [ total_sum + hpos, -hpos ] ) elif hpos > 0: splitter.setSizes( [ hpos, total_sum - hpos ] ) def SplitHorizontally( splitter, w1, w2, vpos ):
64
64
151
18
46
XVicarious/hydrus
include/QtPorting.py
Python
SplitHorizontally
SplitHorizontally
839
863
839
840
ee404a620a4404e972bd25079e5dcae89d641b80
bigcode/the-stack
train
58af428913f4c203c745e3e5
train
function
def CenterOnScreen( window ): window.move( QW.QApplication.desktop().availableGeometry().center() - window.rect().center() )
def CenterOnScreen( window ):
window.move( QW.QApplication.desktop().availableGeometry().center() - window.rect().center() )
colour ): return QG.QPalette().color( colour ) def CenterOnWindow( parent, window ): parent_window = parent.window() window.move( parent_window.mapToGlobal( parent_window.rect().center() ) - window.rect().center() ) def CenterOnScreen( window ):
64
64
30
8
56
XVicarious/hydrus
include/QtPorting.py
Python
CenterOnScreen
CenterOnScreen
1,307
1,309
1,307
1,308
d8827dd8ee646cb4e7d3085e7b959116c117e214
bigcode/the-stack
train
d1ddd4ed80a90ae841c61ed5
train
class
class HBoxLayout( QW.QHBoxLayout ): def __init__( self, margin = 2, spacing = 2 ): QW.QHBoxLayout.__init__( self ) self.setMargin( margin ) self.setSpacing( spacing ) def setMargin( self, val ): self.setContentsMargins( val, val, val,...
class HBoxLayout( QW.QHBoxLayout ):
def __init__( self, margin = 2, spacing = 2 ): QW.QHBoxLayout.__init__( self ) self.setMargin( margin ) self.setSpacing( spacing ) def setMargin( self, val ): self.setContentsMargins( val, val, val, val )
] return original_function( *args, **kwargs ) return new_function QW.QFileDialog.getSaveFileName = MonkeyPatchGetSaveFileName( QW.QFileDialog.getSaveFileName ) class HBoxLayout( QW.QHBo...
62
64
82
12
50
XVicarious/hydrus
include/QtPorting.py
Python
HBoxLayout
HBoxLayout
101
113
101
102
5f672c63b8e8ae1e5b1581a35488d2e360333ebb
bigcode/the-stack
train
0529df7afa185e06588c77f8
train
function
def GetSystemColour( colour ): return QG.QPalette().color( colour )
def GetSystemColour( colour ):
return QG.QPalette().color( colour )
).data( QC.Qt.UserRole ) else: raise ValueError( 'Unknown widget class in GetClientData' ) def Unsplit( splitter, widget ): if widget.parentWidget() == splitter: widget.setVisible( False ) def GetSystemColour( colour ):
62
64
19
8
54
XVicarious/hydrus
include/QtPorting.py
Python
GetSystemColour
GetSystemColour
1,297
1,299
1,297
1,298
8fc47b0d0c777eaa1d6533bba3cb1b16f82fb30b
bigcode/the-stack
train
5d6dac280fde06d23b9fe235
train
function
def DrawText( painter, x, y, text ): boundingRect = painter.fontMetrics().size( QC.Qt.TextSingleLine, text ) painter.drawText( QC.QRectF( x, y, boundingRect.width(), boundingRect.height() ), text )
def DrawText( painter, x, y, text ):
boundingRect = painter.fontMetrics().size( QC.Qt.TextSingleLine, text ) painter.drawText( QC.QRectF( x, y, boundingRect.width(), boundingRect.height() ), text )
new_image.fill( QC.Qt.transparent ) painter = QG.QPainter( new_image ) painter.setOpacity( opacity_factor ) painter.drawImage( 0, 0, image ) return new_image def DrawText( painter, x, y, text ):
64
64
56
13
50
XVicarious/hydrus
include/QtPorting.py
Python
DrawText
DrawText
1,127
1,131
1,127
1,128
3cb09e0c6f48c63d5afa6e61ed4d38477c99c41f
bigcode/the-stack
train
93396b761bb7318674be395c
train
class
class AboutBox( QW.QDialog ): def __init__( self, parent, about_info ): QW.QDialog.__init__( self, parent ) self.setWindowFlag( QC.Qt.WindowContextHelpButtonHint, on = False ) self.setAttribute( QC.Qt.WA_DeleteOnClose ) self.setWindowIcon( QG....
class AboutBox( QW.QDialog ):
def __init__( self, parent, about_info ): QW.QDialog.__init__( self, parent ) self.setWindowFlag( QC.Qt.WindowContextHelpButtonHint, on = False ) self.setAttribute( QC.Qt.WA_DeleteOnClose ) self.setWindowIcon( QG.QIcon( HG.client_controller.frame_i...
= description def SetLicense( self, license ): self.license = license def SetDevelopers( self, developers_list ): self.developers = developers_list def SetWebSite( self, url ): self.website = url class UIActionSimulator: def __init__( self...
190
191
637
10
180
XVicarious/hydrus
include/QtPorting.py
Python
AboutBox
AboutBox
1,608
1,673
1,608
1,609
372578d7349010dcef3ab81febd8de6ae8d78abe
bigcode/the-stack
train
c798ac8668fb35cda302cdc1
train
function
def AddShortcut( widget, modifier, key, callable, *args ): shortcut = QW.QShortcut( widget ) shortcut.setKey( ToKeySequence( modifier, key ) ) shortcut.setContext( QC.Qt.WidgetWithChildrenShortcut ) shortcut.activated.connect( lambda: callable( *args ) )
def AddShortcut( widget, modifier, key, callable, *args ):
shortcut = QW.QShortcut( widget ) shortcut.setKey( ToKeySequence( modifier, key ) ) shortcut.setContext( QC.Qt.WidgetWithChildrenShortcut ) shortcut.activated.connect( lambda: callable( *args ) )
modifier ).toString() seq_str += QG.QKeySequence( key ).toString() return QG.QKeySequence( seq_str ) else: return QG.QKeySequence( key + modifiers ) def AddShortcut( widget, modifier, key, callable, *args ):
64
64
69
16
48
XVicarious/hydrus
include/QtPorting.py
Python
AddShortcut
AddShortcut
1,151
1,159
1,151
1,152
4ed570d00a9d159e36f2397586da301ac496f673
bigcode/the-stack
train
b75a4bc9b99803091f56a8e1
train
class
class CallAfterEvent( QC.QEvent ): def __init__( self, fn, *args, **kwargs ): QC.QEvent.__init__( self, CallAfterEventType ) self._fn = fn self._args = args self._kwargs = kwargs def Execute( self ): if self._fn is not None: ...
class CallAfterEvent( QC.QEvent ):
def __init__( self, fn, *args, **kwargs ): QC.QEvent.__init__( self, CallAfterEventType ) self._fn = fn self._args = args self._kwargs = kwargs def Execute( self ): if self._fn is not None: self._fn( *self....
_val, exc_tb ): QW.QApplication.restoreOverrideCursor() def GetBackgroundColour( widget ): return widget.palette().color( QG.QPalette.Window ) CallAfterEventType = QC.QEvent.Type( QC.QEvent.registerEventType() ) class CallAfterEvent( QC.QEvent ):
64
64
95
10
54
XVicarious/hydrus
include/QtPorting.py
Python
CallAfterEvent
CallAfterEvent
1,186
1,201
1,186
1,187
b324c3619268da31e9ab1e60fe0516ea293dec86
bigcode/the-stack
train
03c800228fd0e3f5472ec1ca
train
class
class TreeWidgetWithInheritedCheckState( QW.QTreeWidget ): def __init__( self, *args, **kwargs ): QW.QTreeWidget.__init__( self, *args, **kwargs ) self.itemClicked.connect( self._HandleItemClickedForCheckStateUpdate ) def _HandleItemClickedForCheckStateUpdate...
class TreeWidgetWithInheritedCheckState( QW.QTreeWidget ):
def __init__( self, *args, **kwargs ): QW.QTreeWidget.__init__( self, *args, **kwargs ) self.itemClicked.connect( self._HandleItemClickedForCheckStateUpdate ) def _HandleItemClickedForCheckStateUpdate( self, item, column ): self._UpdateCheckState(...
] return None def GetPaths( self ): return self._GetSelectedFiles() # A QTreeWidget where if an item is (un)checked, all its children are also (un)checked, recursively class TreeWidgetWithInheritedCheckState( QW.QTreeWidget ):
64
64
170
15
48
XVicarious/hydrus
include/QtPorting.py
Python
TreeWidgetWithInheritedCheckState
TreeWidgetWithInheritedCheckState
2,187
2,208
2,187
2,188
24222b8e816d187ca6e3d140623cac54492a2d1e
bigcode/the-stack
train
92bab8237db965a8a8b0355f
train
function
def MakeQLabelWithAlignment( label, parent, align ): res = QW.QLabel( label, parent ) res.setAlignment( align ) return res
def MakeQLabelWithAlignment( label, parent, align ):
res = QW.QLabel( label, parent ) res.setAlignment( align ) return res
vpos < 0: splitter.setSizes( [ total_sum + vpos, -vpos ] ) elif vpos > 0: splitter.setSizes( [ vpos, total_sum - vpos ] ) def MakeQLabelWithAlignment( label, parent, align ):
64
64
37
14
50
XVicarious/hydrus
include/QtPorting.py
Python
MakeQLabelWithAlignment
MakeQLabelWithAlignment
866
872
866
867
e4e526ff04f034e46557a64e7950eda4b56bfbf5
bigcode/the-stack
train
511ec6d460d6dadd731e0f58
train
class
class StatusBar( QW.QStatusBar ): def __init__( self, status_widths ): QW.QStatusBar.__init__( self ) self._labels = [] for w in status_widths: label = QW.QLabel() self._labels.append( label ) ...
class StatusBar( QW.QStatusBar ):
def __init__( self, status_widths ): QW.QStatusBar.__init__( self ) self._labels = [] for w in status_widths: label = QW.QLabel() self._labels.append( label ) if w < 0: ...
size = QC.QSize( size[0], size[1] ) if size.width() >= 0: widget.setMinimumWidth( size.width() ) if size.height() >= 0: widget.setMinimumHeight( size.height() ) class StatusBar( QW.QStatusBar ):
64
64
135
11
53
XVicarious/hydrus
include/QtPorting.py
Python
StatusBar
StatusBar
1,521
1,548
1,521
1,522
68a52065503cdce00bd8e2c4c7bd5d32d190cdf5
bigcode/the-stack
train
e2eaf8aa130a4ba4c26c950e
train
function
def MakeQSpinBox( parent = None, initial = None, min = None, max = None, width = None ): spinbox = QW.QSpinBox( parent ) if min is not None: spinbox.setMinimum( min ) if max is not None: spinbox.setMaximum( max ) if initial is not None: spinbox.setValue( initial ) if width i...
def MakeQSpinBox( parent = None, initial = None, min = None, max = None, width = None ):
spinbox = QW.QSpinBox( parent ) if min is not None: spinbox.setMinimum( min ) if max is not None: spinbox.setMaximum( max ) if initial is not None: spinbox.setValue( initial ) if width is not None: spinbox.setMinimumWidth( width ) return spinbox
list ): idxs = [ idxs ] for idx in idxs: if idx != -1: widget.item( idx ).setSelected( True ) def MakeQSpinBox( parent = None, initial = None, min = None, max = None, width = None ):
64
64
105
27
37
XVicarious/hydrus
include/QtPorting.py
Python
MakeQSpinBox
MakeQSpinBox
1,407
1,419
1,407
1,408
3f75c9c9001a3a78c78ae0ec85c3c2eab18aa5b5
bigcode/the-stack
train
dd1020d79e6e7ad4e8884d04
train
class
class BusyCursor: def __enter__( self ): QW.QApplication.setOverrideCursor( QC.Qt.WaitCursor ) def __exit__( self, exc_type, exc_val, exc_tb ): QW.QApplication.restoreOverrideCursor()
class BusyCursor:
def __enter__( self ): QW.QApplication.setOverrideCursor( QC.Qt.WaitCursor ) def __exit__( self, exc_type, exc_val, exc_tb ): QW.QApplication.restoreOverrideCursor()
def AdjustColour( colour, percent ): percent = percent / 100 return QG.QColor( colour.red() + colour.red() * percent, colour.green() + colour.green() * percent, colour.blue() + colour.blue() * percent, colour.alpha() ) class BusyCursor:
63
64
54
5
58
XVicarious/hydrus
include/QtPorting.py
Python
BusyCursor
BusyCursor
1,168
1,176
1,168
1,169
240faac7759debaa928726e7ecc63e26146fccf8
bigcode/the-stack
train
0869ccaf9b42c2bc33f02ea8
train
class
class RadioBox( QW.QFrame ): radioBoxChanged = QC.Signal() def __init__( self, parent = None, choices = [], vertical = False ): QW.QFrame.__init__( self, parent ) self.setFrameStyle( QW.QFrame.Box | QW.QFrame.Raised ) if vertical: ...
class RadioBox( QW.QFrame ):
radioBoxChanged = QC.Signal() def __init__( self, parent = None, choices = [], vertical = False ): QW.QFrame.__init__( self, parent ) self.setFrameStyle( QW.QFrame.Box | QW.QFrame.Raised ) if vertical: self.setLayout( VBoxLayout() ) ...
() ] return result def SetCheckedData( self, datas ): for index in range( self.count() ): data = GetClientData( self, index ) check_it = data in datas self.Check( index, check_it ) def mousePressEvent( self, event ): if event.butt...
112
112
375
10
102
XVicarious/hydrus
include/QtPorting.py
Python
RadioBox
RadioBox
1,793
1,864
1,793
1,794
b5dfe63fa8a6ff95399b7277adaa15cc2c821e70
bigcode/the-stack
train
d56900d8514882e8a038558e
train
class
class FileDialog( QW.QFileDialog ): def __init__( self, parent = None, message = None, acceptMode = QW.QFileDialog.AcceptOpen, fileMode = QW.QFileDialog.ExistingFile, defaultFile = None, wildcard = None ): QW.QFileDialog.__init__( self, parent ) if message is not None: self.setWindowTitle( messag...
class FileDialog( QW.QFileDialog ):
def __init__( self, parent = None, message = None, acceptMode = QW.QFileDialog.AcceptOpen, fileMode = QW.QFileDialog.ExistingFile, defaultFile = None, wildcard = None ): QW.QFileDialog.__init__( self, parent ) if message is not None: self.setWindowTitle( message ) self.setAcceptMode( acce...
( self ): return [ os.path.normpath( path ) for path in self.selectedFiles() ] def GetPath(self): sel = self._GetSelectedFiles() if len( sel ) > 0: return sel[0] return None class FileDialog( QW.Q...
75
75
251
11
63
XVicarious/hydrus
include/QtPorting.py
Python
FileDialog
FileDialog
2,137
2,183
2,137
2,138
79dea0a1874a466a093a7e706ac8c13854de9309
bigcode/the-stack
train
cd0bbe3145889a8da272e5f1
train
function
def ListWidgetGetStrings( widget ): strings = [] for i in range( widget.count() ): strings.append( widget.item( i ).text() ) return strings
def ListWidgetGetStrings( widget ):
strings = [] for i in range( widget.count() ): strings.append( widget.item( i ).text() ) return strings
1: item = widget.takeItem( idx ) del item def ListWidgetGetSelection( widget ): for i in range( widget.count() ): if widget.item( i ).isSelected(): return i return -1 def ListWidgetGetStrings( widget ):
64
64
42
9
54
XVicarious/hydrus
include/QtPorting.py
Python
ListWidgetGetStrings
ListWidgetGetStrings
1,367
1,375
1,367
1,368
ae69fc741ee07b0484bee6a8f3e50638e510e9f1
bigcode/the-stack
train