rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
("type", "__new__"): "(cls, what, bases=None, dict=None)", | ("type", "__init__"): "(cls, what, bases=None, dict=None)", | def outDocAttr(self, p_object, indent, p_class=None): the_doc = p_object.__doc__ if the_doc: if p_class and the_doc == object.__init__.__doc__ and p_object is not object.__init__ and p_class.__doc__: the_doc = str(p_class.__doc__) # replace stock init's doc with class's; make it a certain string. the_doc += "\n# (copie... |
def foo(self): print("a") | def foo(self): print("a") | |
if item_name in ("__dict__", "__doc__", "__module__"): if p_modname == BUILTIN_MOD_NAME and p_name in ("object", FAKE_CLASSOBJ_NAME): if item_name == "__dict__": item = {} else: item = "" | if item_name in ("__doc__", "__module__"): if we_are_the_base_class: item = "" | self.out("class " + p_name + base_def + ":", indent) |
opts, fnames = getopt(sys.argv[1:], "d:hbqu") | opts, fnames = getopt(sys.argv[1:], "d:hbqux") | def redo(self, p_name): """ Restores module declarations. Intended for built-in modules and thus does not handle import statements. """ self.out("# encoding: utf-8", 0) # NOTE: maybe encoding should be selectable if hasattr(self.module, "__name__"): mod_name = " calls itself " + self.module.__name__ else: mod_name = " ... |
continue | if debug_mode: raise else: continue | def redo(self, p_name): """ Restores module declarations. Intended for built-in modules and thus does not handle import statements. """ self.out("# encoding: utf-8", 0) # NOTE: maybe encoding should be selectable if hasattr(self.module, "__name__"): mod_name = " calls itself " + self.module.__name__ else: mod_name = " ... |
def doStuff(self): <selection>pass</selection> | def otherMethod(self, foo, bar): print foo, bar | |
return test._testMethodName | if hasattr(test, '_testMethodName'): return test._testMethodName else: return str(test) | def getTestName(self, test): return test._testMethodName |
class B(A): | def meth_a2(self): pass | |
def meth_a1(self, name = {}): pass def meth_a2(self): pass | def meth_a1(self, name = {}): pass | |
exec compile(example.source, filename, "single", compileflags, 1) in test.globs self.debugger.set_continue() | exec(compile(example.source, filename, "single", compileflags, 1), test.globs) self.debugger.set_continue() | def __run(self, test, compileflags, out): SUCCESS, FAILURE, BOOM = range(3) # `outcome` state check = self._checker.check_output |
exc_info = sys.exc_info() exc_msg = traceback.format_exception_only(*exc_info[:2])[-1] got += doctest._exception_traceback(exc_info) | exc_msg = traceback.format_exception_only(*exception[:2])[-1] if not quiet: got += doctest._exception_traceback(exception) | def __run(self, test, compileflags, out): SUCCESS, FAILURE, BOOM = range(3) # `outcome` state check = self._checker.check_output |
err = self._failure_header(test, example) + \ 'Exception raised:\n' + doctest._indent(doctest._exception_traceback(exc_info)) | err=self._failure_header(test, example) + \ 'Exception raised:\n' + doctest._indent(doctest._exception_traceback(exception)) | def __run(self, test, compileflags, out): SUCCESS, FAILURE, BOOM = range(3) # `outcome` state check = self._checker.check_output |
print("| [%(issue_id)s|http://youtrack.jetbrains.net/issue/%(issue_id)s] (%(issue_type)s)|%(summary)s|" % (issue_id, issue_type, summary)) | print("| [%(issue_id)s|http://youtrack.jetbrains.net/issue/%(issue_id)s] (%(issue_type)s)|%(summary)s|" % (issue_id, issue_type, summary)) my_list = list() for i in range(0,3): my_list.append( ("hey", "you") ) for item in my_list: print '%s %s' % item | def foo(a): if a == 1: return "a", "b" else: return "c", "d" |
result = [] prog = re.compile(pattern) | prog_list = [re.compile(pat.strip()) for pat in pattern.split(',')] result = [] | def loadModulesFromFolderUsingPattern(folder, pattern): ''' loads modules from folder , check if module name matches given pattern''' modules = loadModulesFromFolderRec(folder) result = [] prog = re.compile(pattern) for module in modules: if prog.match(module.__name__): result.append(module) return result |
if prog.match(module.__name__): result.append(module) | for prog in prog_list: if prog.match(module.__name__): result.append(module) | def loadModulesFromFolderUsingPattern(folder, pattern): ''' loads modules from folder , check if module name matches given pattern''' modules = loadModulesFromFolderRec(folder) result = [] prog = re.compile(pattern) for module in modules: if prog.match(module.__name__): result.append(module) return result |
print(self.PREDEFINED_BUILTIN_SIGS[(class_name, func_name)], class_name, func_name) | def restorePredefinedBuiltin(self, class_name, func_name): print(self.PREDEFINED_BUILTIN_SIGS[(class_name, func_name)], class_name, func_name) # XXX spec = func_name + self.PREDEFINED_BUILTIN_SIGS[(class_name, func_name)] note = "known special case of " + (class_name and class_name+"." or "") + func_name return (spec, ... | |
def sanitizeIdent(x): | def sanitizeIdent(x, is_clr=False): | def sanitizeIdent(x): "Takes an identifier and returns it sanitized" if x in ("class", "object", "def", "list", "tuple", "int", "float", "str", "unicode" "None"): return "p_" + x else: return x.replace("-", "_").replace(" ", "_").replace(".", "_") # for things like "list-or-tuple" or "list or tuple" |
ret.append(sanitizeIdent(token_name) + "=" + sanitizeValue(token[2])) | ret.append(sanitizeIdent(token_name, is_clr) + "=" + sanitizeValue(token[2])) | def transformSeq(results, toplevel=True): "Transforms a tree of ParseResults into a param spec string." ret = [] # add here token to join for token in results: token_type = token[0] if token_type is T_SIMPLE: token_name = token[1] if len(token) == 3: # name with value if toplevel: ret.append(sanitizeIdent(token_name) +... |
ret.append(sanitizeIdent(token_name)) | ret.append(sanitizeIdent(token_name, is_clr)) | def transformSeq(results, toplevel=True): "Transforms a tree of ParseResults into a param spec string." ret = [] # add here token to join for token in results: token_type = token[0] if token_type is T_SIMPLE: token_name = token[1] if len(token) == 3: # name with value if toplevel: ret.append(sanitizeIdent(token_name) +... |
ret.append(sanitizeIdent(token_name) + "=" + sanitizeValue(token[2])) | ret.append(sanitizeIdent(token_name, is_clr) + "=" + sanitizeValue(token[2])) | def transformOptionalSeq(results): """ Produces a string that describes the optional part of parameters. @param results must start from T_OPTIONAL. """ assert results[0] is T_OPTIONAL, "transformOptionalSeq expects a T_OPTIONAL node, sees " + repr(results[0]) ret = [] for token in results[1:]: token_type = token[0] if ... |
ret.append(sanitizeIdent(token_name) + "=None") | ret.append(sanitizeIdent(token_name, is_clr) + "=None") | def transformOptionalSeq(results): """ Produces a string that describes the optional part of parameters. @param results must start from T_OPTIONAL. """ assert results[0] is T_OPTIONAL, "transformOptionalSeq expects a T_OPTIONAL node, sees " + repr(results[0]) ret = [] for token in results[1:]: token_type = token[0] if ... |
"object": "object()" | "object": "object()", | def hasItemStartingWith(p_seq, p_start): for item in p_seq: if isinstance(item, STR_TYPES) and item.startswith(p_start): return True return False |
if version[1] < 3: | if version[0] < 3: | def hasItemStartingWith(p_seq, p_start): for item in p_seq: if isinstance(item, STR_TYPES) and item.startswith(p_start): return True return False |
print 'restoreByDocString ' + func_name | def restoreByDocString(self, signature_string, func_name, class_name, deco=None): """ @param signature_string: parameter list extracted from the doc string. @param func_name: name of the function. @param class_name: name of the containing class, or None @param deco: decorator to use @return (reconstructed_spec, note) o... | |
print tokens | def restoreByDocString(self, signature_string, func_name, class_name, deco=None): """ @param signature_string: parameter list extracted from the doc string. @param func_name: name of the function. @param class_name: name of the containing class, or None @param deco: decorator to use @return (reconstructed_spec, note) o... | |
os.path.walk(folder, walkModules, modules) | if PYTHON_VERSION_MAJOR == 3: for root, dirs, files in os.walk(folder, walkModules, modules): for name in files: if name.endswith(".py"): modules.append(loadSource(os.path.join(root, name))) else: os.path.walk(folder, walkModules, modules) | def loadModulesFromFolderRec(folder): modules = [] os.path.walk(folder, walkModules, modules) return modules |
if a[0].endswith("/"): debug("/ from folder " + a[0]) modules = loadModulesFromFolderRec(a[0]) | a_splitted = a[0].split(";") if len(a_splitted) != 1: if a_splitted[0].endswith("/"): debug("/ from folder " + a_splitted[0] + ". Use pattern: " + a_splitted[1]) modules = loadModulesFromFolderUsingPattern(a_splitted[0], a_splitted[1]) | def loadModulesFromFolderRec(folder): modules = [] os.path.walk(folder, walkModules, modules) return modules |
debug("/ from module " + a[0]) modules = [loadSource(a[0])] | if a[0].endswith("/"): debug("/ from folder " + a[0]) modules = loadModulesFromFolderRec(a[0]) else: debug("/ from module " + a[0]) modules = [loadSource(a[0])] | def loadModulesFromFolderRec(folder): modules = [] os.path.walk(folder, walkModules, modules) return modules |
return int(x_num - y_num) | if x_num - y_num<0: return -1 else: return 1 | def compare_object_attrs(x, y): try: x_num = to_number(x) y_num = to_number(y) if (x_num is not None and y_num is not None): return int(x_num - y_num) if ('__len__' == x): return -1 if ('__len__' == y): return 1 return x.__cmp__(y) except: return cmp(str(x), str(y)) |
print path | def processNetCommand(self, cmd_id, seq, text): '''Processes a command received from the Java side @param cmd_id: the id of the command @param seq: the sequence of the command @param text: the text received in the command @note: this method is run as a big switch... after doing some tests, it's not clear whether chan... | |
print source | def processNetCommand(self, cmd_id, seq, text): '''Processes a command received from the Java side @param cmd_id: the id of the command @param seq: the sequence of the command @param text: the text received in the command @note: this method is run as a big switch... after doing some tests, it's not clear whether chan... | |
self.doWaitSuspend(thread, frame, event, arg) | thread.additionalInfo.message = exception_breakpoint.name | def trace_dispatch(self, frame, event, arg): if event not in ('line', 'call', 'return', 'exception'): return None |
("str", "__init__"): "(self, x)", | def outDocAttr(self, p_object, indent, p_class=None): the_doc = p_object.__doc__ if the_doc: if p_class and the_doc == object.__init__.__doc__ and p_object is not object.__init__ and p_class.__doc__: the_doc = str(p_class.__doc__) # replace stock init's doc with class's; make it a certain string. the_doc += "\n# (copie... | |
PREDEFINED_BUILTIN_SIGS[(None, "min")] = "(*args, key)" PREDEFINED_BUILTIN_SIGS[(None, "max")] = "(*args, key)" | PREDEFINED_BUILTIN_SIGS[(None, "min")] = "(*args, key=None)" PREDEFINED_BUILTIN_SIGS[(None, "max")] = "(*args, key=None)" | def outDocAttr(self, p_object, indent, p_class=None): the_doc = p_object.__doc__ if the_doc: if p_class and the_doc == object.__init__.__doc__ and p_object is not object.__init__ and p_class.__doc__: the_doc = str(p_class.__doc__) # replace stock init's doc with class's; make it a certain string. the_doc += "\n# (copie... |
self.out("def " + p_name + sig + (": | if classname: ofwhat = "%s.%s.%s" % mod_class_method_tuple else: ofwhat = "%s.%s" % (p_modname, p_name) self.out("def " + p_name + sig + (": | self.out("def " + p_name + sig + (": # known case of %s.%s.%s" % mod_class_method_tuple), indent) |
if (isinstance(x, basestring)): | if (is_string(x)): | def to_number(x): if isinstance(x, Number): return x if (isinstance(x, basestring)): try: n = float(x) return n except ValueError: pass l = x.find('(') if (l != -1): y = x[0:l-1] #print y try: n = float(y) return n except ValueError: pass return None |
re_size_fun = re.compile(r'\[SIZE\s*(!?)(\d+)\s+([^\]]+)\]', re.IGNORECASE) | re_size_fun = re.compile(r'\[SIZE\s*(!?)(\d+)\s+(\S.*?\.es[mp]\b)\s*\]', re.IGNORECASE) | def __setattr__(self, item, value): self.__setitem__(item, value) |
print options.disable_isa_extns | def enabled_or_disabled_isa(isa): if isa in options.enable_isa_extns: return True if isa in options.disable_isa_extns: return True return False | |
version_suffix = '-dev' | version_suffix = '' | def flatten(l): return sum(l, []) |
for isa_extn_name in ['SSE2', 'SSSE3', 'AltiVec', 'AES-NI']: | for isa_extn_name in ['SSE2', 'SSSE3', 'AltiVec', 'AES-NI', 'movbe']: | def process_command_line(args): parser = OptionParser( formatter = IndentedHelpFormatter(max_help_position = 50), version = BuildConfigurationInformation.version_string) parser.add_option('--verbose', action='store_true', default=False, help='Show debug messages') parser.add_option('--quiet', action='store_true', def... |
for dep in isa_deps.get(isa, '').split(','): if not enabled_or_disabled_isa(dep): options.enable_isa_extns.append(dep) | if isa in isa_deps: for dep in isa_deps.get(isa, '').split(','): if not enabled_or_disabled_isa(dep): options.enable_isa_extns.append(dep) | def enabled_or_disabled_isa(isa): if isa in options.enable_isa_extns: return True if isa in options.disable_isa_extns: return True return False |
enabled_isas = set(flatten( [self.isa_extensions_in(options.cpu), options.enable_isa_extns])) | enabled_isas = set(self.isa_extensions_in(options.cpu) + options.enable_isa_extns) | def form_macro(cpu_name): return cpu_name.upper().replace('.', '').replace('-', '_') |
options.compiler = 'msvc' | if which('cl.exe') is not None: options.compiler = 'msvc' elif which('g++.exe') is not None: options.compiler = 'gcc' else: options.compiler = 'msvc' | def log_level(): if options.verbose: return logging.DEBUG if options.quiet: return logging.WARNING return logging.INFO |
for isa_extn in ['sse2', 'ssse3', 'altivec', 'aes-ni']: | for isa_extn_name in ['SSE2', 'SSSE3', 'AltiVec', 'AES-NI']: isa_extn = isa_extn_name.lower() | def optparse_append_const(option, opt, value, parser, dest, arg): parser.values.__dict__[dest].append(arg) |
help='Enable use of %s' % (isa_extn), | help='enable use of %s' % (isa_extn_name), | def optparse_append_const(option, opt, value, parser, dest, arg): parser.values.__dict__[dest].append(arg) |
help='enable TR1 (options: none, system, boost)') | help='enable TR1 (choices: none, system, boost)') | def optparse_append_const(option, opt, value, parser, dest, arg): parser.values.__dict__[dest].append(arg) |
help='choose a makefile style (unix, nmake)') | help='choose a makefile style (unix or nmake)') | def optparse_append_const(option, opt, value, parser, dest, arg): parser.values.__dict__[dest].append(arg) |
for mod in ['openssl', 'gnump', 'bzip2', 'zlib']: | for lib in ['OpenSSL', 'GNU MP', 'Bzip2', 'Zlib']: mod = lib.lower().replace(' ', '') | def optparse_append_const(option, opt, value, parser, dest, arg): parser.values.__dict__[dest].append(arg) |
isa_dependencies = { | isa_deps = { | def enabled_or_disabled_isa(isa): if isa in options.enable_isa_extns: return True if isa in options.disable_isa_extns: return True return False |
sse2_deps = ['ssse3', 'aes-ni'] for isa in sse2_deps: | for isa in [k for (k,v) in isa_deps.items() if v == 'sse2']: | def enabled_or_disabled_isa(isa): if isa in options.enable_isa_extns: return True if isa in options.disable_isa_extns: return True return False |
macros.append('TARGET_CPU_HAS_%s' % form_macro(isa)) | macros.append('TARGET_CPU_HAS_%s' % (form_macro(isa))) | def form_macro(cpu_name): return cpu_name.upper().replace('.', '').replace('-', '_') |
cannot_use_because(modname, 'of dependency failure') | cannot_use_because(modname, 'dependency failure') | def cannot_use_because(mod, reason): not_using_because.setdefault(reason, []).append(mod) |
version_suffix = '-ssl-dev' | version_suffix = '-dev' | def flatten(l): return sum(l, []) |
if len([f for f in self.source if f.endswith('h')]) > 0: print self.lives_in | def add_dir_name(filename): if filename.count(':') == 0: return os.path.join(self.lives_in, filename) | |
if 'darwin' in sys.platform: | if 'darwin' in sys.platform and sys.maxint == 2147483647: | def main(): import glob from aksetup_helper import (hack_distutils, get_config, setup, \ NumpyExtension, Extension, set_up_shipped_boost_if_requested) hack_distutils() conf = get_config(get_config_schema()) EXTRA_SOURCES, EXTRA_DEFINES = set_up_shipped_boost_if_requested(conf) LIBRARY_DIRS = conf["BOOST_LIB_DIR"] LIB... |
drv.Out(dest), numpy.intp(a_gpu)+1, b_gpu, | drv.Out(dest), numpy.intp(a_gpu)+a.itemsize, b_gpu, | def test_simple_kernel_2(self): mod = SourceModule(""" __global__ void multiply_them(float *dest, float *a, float *b) { const int i = threadIdx.x; dest[i] = a[i] * b[i]; } """) |
assert la.norm(dest-a*b) == 0 | assert la.norm((dest[:-1]-a[1:]*b[:-1])) == 0 | def test_simple_kernel_2(self): mod = SourceModule(""" __global__ void multiply_them(float *dest, float *a, float *b) { const int i = threadIdx.x; dest[i] = a[i] * b[i]; } """) |
@property def include_dirs(self): | def get_include_dirs(self): | def get_numpy_incpath(self): from imp import find_module # avoid actually importing numpy, it screws up distutils file, pathname, descr = find_module("numpy") from os.path import join return join(pathname, "core", "include") |
if sys.platform == "linux2": | if sys.platform in ("linux2", "darwin"): | def _find_pycuda_include_path(): from imp import find_module file, pathname, descr = find_module("pycuda") # Who knew Python installation is so uniform and predictable? from os.path import join, exists possible_include_paths = [ join(pathname, "..", "include", "pycuda"), join(pathname, "..", "src", "cuda"), join(pathn... |
raise RuntimeError("could not find path to PyCUDA's C header files") | raise RuntimeError("could not find path to PyCUDA's C" " header files, searched in : %s" % '\n'.join(possible_include_paths)) | def _find_pycuda_include_path(): from imp import find_module file, pathname, descr = find_module("pycuda") # Who knew Python installation is so uniform and predictable? from os.path import join, exists possible_include_paths = [ join(pathname, "..", "include", "pycuda"), join(pathname, "..", "src", "cuda"), join(pathn... |
drv.Out(dest), drv.In(a), drv.In(b), | drv.Out(dest), a_gpu, b_gpu, | def test_streamed_kernel(self): # this differs from the "simple_kernel" case in that *all* computation # and data copying is asynchronous. Observe how this necessitates the # use of page-locked memory. |
la.norm(dest-a*b) == 0 | drv.memcpy_dtoh_async(a, a_gpu, strm) drv.memcpy_dtoh_async(b, b_gpu, strm) strm.synchronize() assert la.norm(dest-a*b) == 0 | def test_streamed_kernel(self): # this differs from the "simple_kernel" case in that *all* computation # and data copying is asynchronous. Observe how this necessitates the # use of page-locked memory. |
assert op_a_gpu == op_a, (op_a_gpu, op_gpu, dtype, what) | assert op_a_gpu == op_a, (op_a_gpu, op_a, dtype, what) | def test_minmax(self): from pycuda.curandom import rand as curand |
assert la.norm(a - a2) == 0 | assert la.norm(a - a2) == 0, (a, a2) | def test_astype(self): from pycuda.curandom import rand as curand |
if (BLOCK_SIZE >= 64) sdata[tid] = REDUCE(sdata[tid], sdata[tid + 32]); if (BLOCK_SIZE >= 32) sdata[tid] = REDUCE(sdata[tid], sdata[tid + 16]); if (BLOCK_SIZE >= 16) sdata[tid] = REDUCE(sdata[tid], sdata[tid + 8]); if (BLOCK_SIZE >= 8) sdata[tid] = REDUCE(sdata[tid], sdata[tid + 4]); if (BLOCK_SIZE >= 4) sdata[tid] =... | // 'volatile' required according to Fermi compatibility guide 1.2.2 volatile out_type * smem = sdata; if (BLOCK_SIZE >= 64) smem[tid] = REDUCE(smem[tid], smem[tid + 32]); if (BLOCK_SIZE >= 32) smem[tid] = REDUCE(smem[tid], smem[tid + 16]); if (BLOCK_SIZE >= 16) smem[tid] = REDUCE(smem[tid], smem[tid + 8]); if (BLOCK_SI... | typedef %(out_type)s out_type; |
def main(): import sys | import sys | def main(): import sys from optparse import OptionParser parser = OptionParser( usage="usage: %prog [options] SCRIPT-TO-RUN [SCRIPT-ARGUMENTS]") parser.disable_interspersed_args() options, args = parser.parse_args() if len(args) < 1: parser.print_help() sys.exit(2) mainpyfile = args[0] from os.path import exists i... |
execfile(mainpyfile) if __name__=='__main__': main() | execfile(mainpyfile) | def main(): import sys from optparse import OptionParser parser = OptionParser( usage="usage: %prog [options] SCRIPT-TO-RUN [SCRIPT-ARGUMENTS]") parser.disable_interspersed_args() options, args = parser.parse_args() if len(args) < 1: parser.print_help() sys.exit(2) mainpyfile = args[0] from os.path import exists i... |
for dtype in [numpy.float32, numpy.float64]: | if has_double_support(): dtypes = [numpy.float32, numpy.float64] else: dtypes = [numpy.float32] for dtype in dtypes: | def test_random(self): from pycuda.curandom import rand as curand for dtype in [numpy.float32, numpy.float64]: a = curand((10, 100), dtype=dtype).get() |
for dtype in [numpy.float64, numpy.float32, numpy.int32]: | for dtype in dtypes: | def test_minmax(self): from pycuda.curandom import rand as curand |
for dtype in [numpy.float64, numpy.float32, numpy.int32]: | if has_double_support(): dtypes = [numpy.float64, numpy.float32, numpy.int32] else: dtypes = [numpy.float32, numpy.int32] for dtype in dtypes: | def test_subset_minmax(self): from pycuda.curandom import rand as curand |
for tp in [numpy.complex64, numpy.complex128]: | for tp in dtypes: | def test_complex_bits(self): from pycuda.curandom import rand as curand |
for gyroReading in self._gyroList: if (gyroReading is not None): oneGyroReading = gyroReading.tuple() gyroArrays.append(oneGyroReading) gyroArrays = np.reshape(gyroArrays, (-1,3)) allData = np.append(accArrays, gyroArrays, axis=1) | if (self.motionPlusPresent()): for gyroReading in self._gyroList: if (gyroReading is not None): oneGyroReading = gyroReading.tuple() gyroArrays.append(oneGyroReading) if (self.motionPlusPresent()): gyroArrays = np.reshape(gyroArrays, (-1,3)) allData = np.append(accArrays, gyroArrays, axis=1) th... | def zeroDevice(self): """Find the at-rest values of the accelerometer and the gyro. |
isBadCalibration = (stdev > THRESHOLDS_ARRAY).any() | isBadCalibration = (stdev > thresholdsArray).any() | def zeroDevice(self): """Find the at-rest values of the accelerometer and the gyro. |
if (CALIBRATE_WITH_FAILED_CALIBRATION_DATA): | if (CALIBRATE_WITH_FAILED_CALIBRATION_DATA and self.motionPlusPresent()): | def zeroDevice(self): """Find the at-rest values of the accelerometer and the gyro. |
wiistate.WIIState.setGyroCalibration(gyroCalibrationOrig) | if (self.motionPlusPresent()): wiistate.WIIState.setGyroCalibration(gyroCalibrationOrig) | def zeroDevice(self): """Find the at-rest values of the accelerometer and the gyro. |
self.tf_sleep_time = 1 | self.tf_sleep_time = 1.0 self.lockobj = thread.allocate_lock() | def __init__(self): self.cur_tf = dict() self.tf_sleep_time = 1 rospy.Service('/set_dynamic_tf', SetDynamicTF, self.set_tf) |
print "Latch [%s]"%(req.cur_tf.child_frame_id) | print "Latch [%s]/[%shz]"%(req.cur_tf.child_frame_id,req.freq) | def set_tf(self,req): print "Latch [%s]"%(req.cur_tf.child_frame_id) tf_sleep_time = 1.0/req.freq self.cur_tf[req.cur_tf.child_frame_id] = req.cur_tf self.publish_tf(req.cur_tf.child_frame_id) return SetDynamicTFResponse() |
if not self.cur_tf.has_key(req.child_frame): | if (not self.cur_tf.has_key(req.child_frame)) or self.cur_tf.has_key[req.child_frame] == req.parent_frame: | def assoc(self,req): if not self.cur_tf.has_key(req.child_frame): return AssocTFResponse() print "assoc %s -> %s"%(req.parent_frame, req.child_frame) self.listener.waitForTransform(req.parent_frame, req.child_frame, req.header.stamp, rospy.Duration(1.0)) ts = TransformStamped() (trans,rot) = self.listener.lookupTransfo... |
rospy.loginfo("delete TF %s"%(req.header.child_frame)) | rospy.loginfo("delete TF %s"%(req.header.frame_id)) | def delete(self,req): rospy.loginfo("delete TF %s"%(req.header.child_frame)) self.lockobj.acquire() del self.original_parent[req.header.frame_id] del self.cur_tf[req.header.frame_id] self.lockobj.release() |
del self.original_parent[req.header.frame_id] del self.cur_tf[req.header.frame_id] | if self.original_parent.has_key(req.header.frame_id): del self.original_parent[req.header.frame_id] if self.cur_tf.has_key(req.header.frame_id): del self.cur_tf[req.header.frame_id] | def delete(self,req): rospy.loginfo("delete TF %s"%(req.header.child_frame)) self.lockobj.acquire() del self.original_parent[req.header.frame_id] del self.cur_tf[req.header.frame_id] self.lockobj.release() |
tf_sleep_time = 1.0/req.freq | self.tf_sleep_time = 1.0/req.freq | def set_tf(self,req): print "Latch [%s]/[%shz]"%(req.cur_tf.child_frame_id,req.freq) tf_sleep_time = 1.0/req.freq self.lockobj.acquire() self.cur_tf[req.cur_tf.child_frame_id] = req.cur_tf self.lockobj.release() self.publish_tf(req.cur_tf.child_frame_id) return SetDynamicTFResponse() |
if (not self.cur_tf.has_key(req.child_frame)) or self.cur_tf.has_key[req.child_frame] == req.parent_frame: | if (not self.cur_tf.has_key(req.child_frame)) or self.cur_tf[req.child_frame] == req.parent_frame: | def assoc(self,req): if (not self.cur_tf.has_key(req.child_frame)) or self.cur_tf.has_key[req.child_frame] == req.parent_frame: return AssocTFResponse() print "assoc %s -> %s"%(req.parent_frame, req.child_frame) self.listener.waitForTransform(req.parent_frame, req.child_frame, req.header.stamp, rospy.Duration(1.0)) ts ... |
print "assoc %s -> %s"%(req.parent_frame, req.child_frame) self.listener.waitForTransform(req.parent_frame, req.child_frame, req.header.stamp, rospy.Duration(1.0)) | rospy.loginfo("assoc %s -> %s"%(req.parent_frame, req.child_frame)) self.listener.waitForTransform(req.parent_frame, req.child_frame, req.header.stamp, rospy.Duration(1.0)) | def assoc(self,req): if (not self.cur_tf.has_key(req.child_frame)) or self.cur_tf.has_key[req.child_frame] == req.parent_frame: return AssocTFResponse() print "assoc %s -> %s"%(req.parent_frame, req.child_frame) self.listener.waitForTransform(req.parent_frame, req.child_frame, req.header.stamp, rospy.Duration(1.0)) ts ... |
1. macro object. This object has attributes ``macro_name``, ``body``, | 1. macro object. This dictionary-like object has attributes ``macro_name``, ``body``, | def create_dialect(dialect_base, **kw_args): """Factory function for dialect objects (for parameter defaults, see :func:`~creoleparser.dialects.creole10_base` and/or :func:`~creoleparser.dialects.creole11_base`) :parameters: argument_parser Parser used for automatic parsing of macro arg strings. Must take a single str... |
genshi.Fragment. ``parsed_body`` takes an optional ``context`` | genshi.Fragment. ``parsed_body()`` takes an optional ``context`` | def create_dialect(dialect_base, **kw_args): """Factory function for dialect objects (for parameter defaults, see :func:`~creoleparser.dialects.creole10_base` and/or :func:`~creoleparser.dialects.creole11_base`) :parameters: argument_parser Parser used for automatic parsing of macro arg strings. Must take a single str... |
for other possible values. Attributes can also be accessed like dictionary values. | for other possible values. | def create_dialect(dialect_base, **kw_args): """Factory function for dialect objects (for parameter defaults, see :func:`~creoleparser.dialects.creole10_base` and/or :func:`~creoleparser.dialects.creole11_base`) :parameters: argument_parser Parser used for automatic parsing of macro arg strings. Must take a single str... |
1. String to match, or compiled regular expresion. | 1. Compiled regular expression or string (*not* an re pattern) to match. | macros (e.g.,def mymacro(macro, env, \\*pos, \\**kw)). |
As a shortcut for simple cases, the second tuple element may alternatively be a string. The string will be wrapped in a Markup | As a shortcut for simple cases, the second tuple element may be a string rather than a function. The string will be wrapped in a Markup | macros (e.g.,def mymacro(macro, env, \\*pos, \\**kw)). |
link). | links). | macros (e.g.,def mymacro(macro, env, \\*pos, \\**kw)). |
5. the `environ` object (see :meth:`creoleparser.core.Parser.generate`) | 5. the `environ` object (see :meth:`creoleparser.core.Parser.parse`) | macros (e.g.,def mymacro(macro, env, \\*pos, \\**kw)). |
processing), a Genshi object (Stream, Markup, builder.Fragment, or builder.Element), or a dictionary (bodied macros only). If None is | processing) or a Genshi object (Stream, Markup, builder.Fragment, or builder.Element). If None is | macros (e.g.,def mymacro(macro, env, \\*pos, \\**kw)). |
name = models.CharField(max_length=255) | name = models.CharField(max_length=255, unique=True) | def __unicode__(self): return self.title |
class ParticipantManager(models.Manager): def get_all_game_instances(self, participant_id): participant_groups = ParticipantGroup.objects.filter(participant__id=participant_id) return GameInstance.objects.filter(pk__in=[]) | def __unicode__(self): return "Data value: parameter {0}, value {1}, time recorded {2}, game {3}".format(self.parameter, self.parameter_value, self.time_recorded, self.game_instance) | |
objects = ParticipantManager() | def get_all_game_instances(self, participant_id): # generate appropriate query using Groups? # link from groups to game instances participant_groups = ParticipantGroup.objects.filter(participant__id=participant_id) | |
return "Experiment Type: %s (namespace: %s, created on %s)" % (self.title, self.namespace, self.date_created) | return u"Experiment Type: %s (namespace: %s, created on %s)" % (self.title, self.namespace, self.date_created) | def __unicode__(self): return "Experiment Type: %s (namespace: %s, created on %s)" % (self.title, self.namespace, self.date_created) |
return "%s (%s)" % (self.name, self.url) | return u"%s (%s)" % (self.name, self.url) | def __unicode__(self): return "%s (%s)" % (self.name, self.url) |
return "%s (%s)" % (self.user.get_full_name(), self.user.email) | return u"%s (%s)" % (self.user.get_full_name(), self.user.email) | def __unicode__(self): return "%s (%s)" % (self.user.get_full_name(), self.user.email) |
return "ExperimentConfiguration %s for %s" % (self.name, self.experiment_metadata) | return u"ExperimentConfiguration %s for %s" % (self.name, self.experiment_metadata) | def __unicode__(self): return "ExperimentConfiguration %s for %s" % (self.name, self.experiment_metadata) |
return "%s (status: %s, last updated on %s)" % (self.experiment_metadata.name, self.status, self.last_modified) | return u"%s (status: %s, last updated on %s)" % (self.experiment_metadata.name, self.status, self.last_modified) | def __unicode__(self): return "%s (status: %s, last updated on %s)" % (self.experiment_metadata.name, self.status, self.last_modified) |
return "Round %d for %s" % (self.sequence_number, self.experiment_configuration) | return u"Round %d for %s" % (self.sequence_number, self.experiment_configuration) | def __unicode__(self): return "Round %d for %s" % (self.sequence_number, self.experiment_configuration) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.