rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
history_clause = (' AND (CAST(EXTRACT(EPOCH FROM ' 'COALESCE(write_date, create_date)) AS ' + \ FIELDS['numeric'].sql_type(self.create_date)[1] + \ ') <= %s)') | history_clause = ' AND (COALESCE(write_date, create_date) <= %s)' | def read(self, cursor, user, ids, fields_names=None, context=None): rule_obj = self.pool.get('ir.rule') translation_obj = self.pool.get('ir.translation') super(ModelSQL, self).read(cursor, user, ids, fields_names=fields_names, context=context) |
if isinstance(domain[i][2], basestring): res_ids = target_obj.search(cursor, user, [ ('rec_name', domain[i][1], domain[i][2]), ], context=context) else: res_ids = domain[i][2] if res_ids == True or res_ids == False: | if isinstance(domain[i][2], bool): | def _rec_get(ids, table, parent): if not ids: return [] ids2 = table.search(cursor, user, [(parent, 'in', ids), (parent, '!=', False)], context=context) return ids + _rec_get(ids2, table, parent) |
if res_ids == False: | if domain[i][2] == False: | def _rec_get(ids, table, parent): if not ids: return [] ids2 = table.search(cursor, user, [(parent, 'in', ids), (parent, '!=', False)], context=context) return ids + _rec_get(ids2, table, parent) |
elif not res_ids: domain[i] = ('id', '=', '0') | def _rec_get(ids, table, parent): if not ids: return [] ids2 = table.search(cursor, user, [(parent, 'in', ids), (parent, '!=', False)], context=context) return ids + _rec_get(ids2, table, parent) | |
query1 = 'SELECT "' + field.origin + '" ' \ 'FROM "' + relation_obj._table + '" ' \ 'WHERE "' + field.target + '" IN (' + \ ','.join(['%s' for x in res_ids]) + ')' query2 = [str(x) for x in res_ids] | query1, query2 = target_obj.search([ (target_field, domain[i][1], domain[i][2]), ], order=[], query_string=True) query1 = ('SELECT "%s" FROM "%s" WHERE "%s" IN (%s)' % (field.origin, relation_obj._table, field.target, query1)) | def _rec_get(ids, table, parent): if not ids: return [] ids2 = table.search(cursor, user, [(parent, 'in', ids), (parent, '!=', False)], context=context) return ids + _rec_get(ids2, table, parent) |
datepart, timepart = date.split(" ") year, month, day = map(int, datepart.split("-")) timepart_full = timepart.split(".") hours, minutes, seconds = map(int, timepart_full[0].split(":")) if len(timepart_full) == 2: microseconds = int(timepart_full[1]) date = datetime.datetime(year, month, day, hours, minutes, seconds, m... | if len(date) == 10: year, month, day = map(int, date.split('-')) date = datetime.date(year, month, day) else: datepart, timepart = date.split(" ") year, month, day = map(int, datepart.split("-")) timepart_full = timepart.split(".") hours, minutes, seconds = map(int, timepart_full[0].split(":")) if len(timepart_full) ==... | def extract(lookup_type, date): if date is None: return None try: datepart, timepart = date.split(" ") year, month, day = map(int, datepart.split("-")) timepart_full = timepart.split(".") hours, minutes, seconds = map(int, timepart_full[0].split(":")) if len(timepart_full) == 2: microseconds = int(timepart_full[1]) dat... |
return getattr(date, lookup_type) | return getattr(date, lookup_type.lower()) | def extract(lookup_type, date): if date is None: return None try: datepart, timepart = date.split(" ") year, month, day = map(int, datepart.split("-")) timepart_full = timepart.split(".") hours, minutes, seconds = map(int, timepart_full[0].split(":")) if len(timepart_full) == 2: microseconds = int(timepart_full[1]) dat... |
self.assertEqual(Float('1.5').hex(), '0x1.8000000000000p+0') | if hasattr(float, 'hex'): self.assertEqual(Float('1.5').hex(), '0x1.8000000000000p+0') | def test_float_only_Method(self): ''' Test float only method ''' self.assertEqual(Float('1.5').hex(), '0x1.8000000000000p+0') |
logging.basicConfig(level=logging.DEBUG, format='[%(asctime)s] %(levelname)s:%(name)s:%(message)s', datefmt='%a %b %d %H:%M:%S %Y') | format = '[%(asctime)s] %(levelname)s:%(name)s:%(message)s' datefmt = '%a %b %d %H:%M:%S %Y' logging.basicConfig(level=logging.DEBUG, format=format, datefmt=datefmt) | def __init__(self): logging.basicConfig(level=logging.DEBUG, format='[%(asctime)s] %(levelname)s:%(name)s:%(message)s', datefmt='%a %b %d %H:%M:%S %Y') |
formatter = logging.Formatter(FORMAT, DATEFMT) | formatter = logging.Formatter(format, datefmt) | def __init__(self): logging.basicConfig(level=logging.DEBUG, format='[%(asctime)s] %(levelname)s:%(name)s:%(message)s', datefmt='%a %b %d %H:%M:%S %Y') |
database_name = self.path[1:].strip('sao/') | database_name = self.path[1:] if database_name.startswith('sao/'): database_name = database_name[4:] | def _dispatch(self, method, params): host, port = self.client_address[:2] database_name = self.path[1:].strip('sao/') method_list = method.split('.') object_type = method_list[0] object_name = '.'.join(method_list[1:-1]) method = method_list[-1] args = (host, port, 'JSON-RPC', database_name, params[0], params[1], objec... |
res_ids = [x[0] for x in target_obj.search(cursor, user, [ ('rec_name', domain[i][1], domain[i][2]), ], order=[], context=context)] | res_ids = target_obj.search(cursor, user, [ ('rec_name', domain[i][1], domain[i][2]), ], order=[], context=context) | def _rec_get(ids, table, parent): if not ids: return [] ids2 = table.search(cursor, user, [(parent, 'in', ids), (parent, '!=', False)], order=[], context=context) return ids + _rec_get(ids2, table, parent) |
def get_data(self, uri): | def get_data(self, uri, range=None): | def get_data(self, uri): dbname, dburi = self._get_dburi(uri) if not dbname or (self.exists(uri) and self.is_collection(uri)): res = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 '\ 'Transitional//EN">' res += '<html>' res += '<head>' res += '<meta http-equiv="Content-Type" content="text/html; '\ 'charset=utf-8">' res +... |
return res | if range is None: return res size = len(res) if range[1] == '': range[1] = size else: range[1] = int(range[1]) if range[1] > size: range[1] = size if range[0] == '': range[0] = size - range[1] else: range[0] = int(range[0]) if range[0] > size: raise DAV_Requested_Range_Not_Satisfiable return res[range[0]:range[1]] | def get_data(self, uri): dbname, dburi = self._get_dburi(uri) if not dbname or (self.exists(uri) and self.is_collection(uri)): res = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 '\ 'Transitional//EN">' res += '<html>' res += '<head>' res += '<meta http-equiv="Content-Type" content="text/html; '\ 'charset=utf-8">' res +... |
"'ir_module_module_dependency, '" "'ir_translation, '" | "'ir_module_module_dependency', " "'ir_translation', " | def test(self): self.cursor.execute("SELECT relname " \ "FROM pg_class " \ "WHERE relkind = 'r' AND relname in (" \ "'ir_model', " "'ir_model_field', " "'ir_ui_view', " "'ir_ui_menu', " "'res_user', " "'res_group', " "'wkf', " "'wkf_activity', " "'wkf_transition', " "'wkf_instance', " "'wkf_workitem', " "'wkf_witm_tran... |
datepart, timepart = date.split(" ") year, month, day = map(int, datepart.split("-")) timepart_full = timepart.split(".") hours, minutes, seconds = map(int, timepart_full[0].split(":")) if len(timepart_full) == 2: microseconds = int(timepart_full[1]) date = datetime.datetime(year, month, day, hours, minutes, seconds, m... | if len(date) == 10: year, month, day = map(int, date.split('-')) date = datetime.date(year, month, day) else: datepart, timepart = date.split(" ") year, month, day = map(int, datepart.split("-")) timepart_full = timepart.split(".") hours, minutes, seconds = map(int, timepart_full[0].split(":")) if len(timepart_full) ==... | def extract(lookup_type, date): if date is None: return None try: datepart, timepart = date.split(" ") year, month, day = map(int, datepart.split("-")) timepart_full = timepart.split(".") hours, minutes, seconds = map(int, timepart_full[0].split(":")) if len(timepart_full) == 2: microseconds = int(timepart_full[1]) dat... |
return getattr(date, lookup_type) | return getattr(date, lookup_type.lower()) | def extract(lookup_type, date): if date is None: return None try: datepart, timepart = date.split(" ") year, month, day = map(int, datepart.split("-")) timepart_full = timepart.split(".") hours, minutes, seconds = map(int, timepart_full[0].split(":")) if len(timepart_full) == 2: microseconds = int(timepart_full[1]) dat... |
self.assertEqual(timestamp, hex(sequence['last_timestamp'])[2:].upper()) | self.assertEqual(timestamp, hex(int(sequence['last_timestamp']))[2:].upper()) | def test0030hexadecimal_timestamp(self): ''' Test Hexadecimal Timestamp ''' with Transaction().start(DB_NAME, USER, CONTEXT) as transaction: sequence_id = self.sequence.create({ 'name': 'Test hexadecimal timestamp', 'code': 'test', 'prefix': '', 'suffix': '', 'type': 'hexadecimal timestamp', }) timestamp = self.sequenc... |
return a.microsecond / 1000 | return date.microsecond / 1000 | def extract(lookup_type, date): if date is None: return None try: datepart, timepart = date.split(" ") year, month, day = map(int, datepart.split("-")) timepart_full = timepart.split(".") hours, minutes, seconds = map(int, timepart_full[0].split(":")) if len(timepart_full) == 2: microseconds = int(timepart_full[1]) dat... |
time.strptime(date, '%Y-%m-%d %H:%M:%S') | tm_tuple = time.strptime(date, '%Y-%m-%d %H:%M:%S') | def date_trunc(_type, date): if _type == 'second': return date try: time.strptime(date, '%Y-%m-%d %H:%M:%S') except: return None if _type == 'year': return "%i-01-01 00:00:00" % dt.year elif _type == 'month': return "%i-%02i-01 00:00:00" % (dt.year, dt.month) elif _type == 'day': return "%i-%02i-%02i 00:00:00" % (dt.ye... |
return "%i-01-01 00:00:00" % dt.year | return "%i-01-01 00:00:00" % tm_tuple.tm_year | def date_trunc(_type, date): if _type == 'second': return date try: time.strptime(date, '%Y-%m-%d %H:%M:%S') except: return None if _type == 'year': return "%i-01-01 00:00:00" % dt.year elif _type == 'month': return "%i-%02i-01 00:00:00" % (dt.year, dt.month) elif _type == 'day': return "%i-%02i-%02i 00:00:00" % (dt.ye... |
return "%i-%02i-01 00:00:00" % (dt.year, dt.month) | return "%i-%02i-01 00:00:00" % (tm_tuple.tm_year, tm_tuple.tm_mon) | def date_trunc(_type, date): if _type == 'second': return date try: time.strptime(date, '%Y-%m-%d %H:%M:%S') except: return None if _type == 'year': return "%i-01-01 00:00:00" % dt.year elif _type == 'month': return "%i-%02i-01 00:00:00" % (dt.year, dt.month) elif _type == 'day': return "%i-%02i-%02i 00:00:00" % (dt.ye... |
return "%i-%02i-%02i 00:00:00" % (dt.year, dt.month, dt.day) | return "%i-%02i-%02i 00:00:00" % (tm_tuple.tm_year, tm_tuple.tm_mon, tm_tuple.tm_mday) | def date_trunc(_type, date): if _type == 'second': return date try: time.strptime(date, '%Y-%m-%d %H:%M:%S') except: return None if _type == 'year': return "%i-01-01 00:00:00" % dt.year elif _type == 'month': return "%i-%02i-01 00:00:00" % (dt.year, dt.month) elif _type == 'day': return "%i-%02i-%02i 00:00:00" % (dt.ye... |
translator = Translator(translate) | translator = Translator(lambda text: translate(text)) | def parse(self, cursor, user, report, objects, datas, context): localcontext = {} localcontext['datas'] = datas localcontext['user'] = self.pool.get('res.user').\ browse(cursor, user, user, context=context) localcontext['formatLang'] = lambda *args, **kargs: \ self.format_lang(*((cursor, user) + args), **kargs) localco... |
query1, query2 = target_obj.search([ | query1, query2 = target_obj.search(cursor, user, [ | def _rec_get(ids, table, parent): if not ids: return [] ids2 = table.search(cursor, user, [(parent, 'in', ids), (parent, '!=', False)], context=context) return ids + _rec_get(ids2, table, parent) |
], order=[], query_string=True) | ], order=[], query_string=True, context=context) | def _rec_get(ids, table, parent): if not ids: return [] ids2 = table.search(cursor, user, [(parent, 'in', ids), (parent, '!=', False)], context=context) return ids + _rec_get(ids2, table, parent) |
val.update(getattr(self, 'on_change_' + field)(cursor, user, [], args, context=context)) | val.update(getattr(self, 'on_change_' + field)(cursor, user, args, context=context)) | def _default_on_change(self, cursor, user, value, context=None): """ Call on_change function for the default value and return new default value |
res_ids = [x[0] for x in target_obj.search([ | res_ids = target_obj.search([ | def _rec_get(ids, table, parent): if not ids: return [] ids2 = table.search([ (parent, 'in', ids), (parent, '!=', False), ], order=[]) return ids + _rec_get(ids2, table, parent) |
], order=[])] | ], order=[]) | def _rec_get(ids, table, parent): if not ids: return [] ids2 = table.search([ (parent, 'in', ids), (parent, '!=', False), ], order=[]) return ids + _rec_get(ids2, table, parent) |
'minimum_delay': sys.maxint, | 'minimum_delay': MAXINT, | def test0030on_write(self): ''' Test on_write ''' with Transaction().start(DB_NAME, USER, CONTEXT) as transaction: model_id = self.model.search([ ('model', '=', 'test.triggered'), ])[0] |
'minimum_delay': sys.maxint, | 'minimum_delay': MAXINT, | def test0050on_time(self): ''' Test on_time ''' with Transaction().start(DB_NAME, USER, CONTEXT) as transaction: model_id = self.model.search([ ('model', '=', 'test.triggered'), ])[0] |
value[field] = self._defaults[field](cursor, user, context) | value[field] = self._defaults[field](cursor, user, context=context) | def default_get(self, cursor, user, fields_names, context=None, with_rec_name=True): ''' Return a dict with the default values for each field in fields_names. |
if isinstance(args[i], list): | arg = args[i] if isinstance(arg, tuple) or \ (isinstance(arg, list) and len(arg) > 2 and \ arg[1] in OPERATORS): if arg[0] == 'active': active_found = True elif isinstance(arg, list): | def process_args(args): i = 0 active_found = False while i < len(args): if isinstance(args[i], list): args[i] = process_args(args[i]) if isinstance(args[i], tuple): if args[i][0] == 'active': active_found = True i += 1 if not active_found: if args and ((isinstance(args[0], basestring) \ and args[0] == 'AND') \ or (not ... |
if isinstance(args[i], tuple): if args[i][0] == 'active': active_found = True | def process_args(args): i = 0 active_found = False while i < len(args): if isinstance(args[i], list): args[i] = process_args(args[i]) if isinstance(args[i], tuple): if args[i][0] == 'active': active_found = True i += 1 if not active_found: if args and ((isinstance(args[0], basestring) \ and args[0] == 'AND') \ or (not ... | |
with Transaction().set_context(language='es_US'): | with Transaction().set_context(language='en_US'): | def _operand_get(self, obj_name='', level=3, recur=None, root_tech='', root=''): res = {} if not obj_name: obj_name = 'res.user' res.update({"False": "False", "True": "True", "User": "user.id"}) if not recur: recur = [] with Transaction().set_context(language='es_US'): obj_fields = self.pool.get(obj_name).fields_get() ... |
self.assertRaises(Exception, self.CheckTree()) | self.CheckTree() | def reorder(parent_id=False): record_ids = self.mptt.search([ ('parent', '=', parent_id), ], CONTEXT) if not record_ids: return i = len(record_ids) for record_id in record_ids: self.mptt.write(record_id, { 'sequence': i, }, CONTEXT) i -= 1 self.assertRaises(Exception, self.CheckTree()) i = 0 for record_id in record_ids... |
self.assertRaises(Exception, self.CheckTree()) | self.CheckTree() | def reparent(parent_id=False): record_ids = self.mptt.search([ ('parent', '=', parent_id), ], CONTEXT) if not record_ids: return for record_id in record_ids: for record2_id in record_ids: if record_id != record2_id: self.mptt.write(record_id, { 'parent': record2_id, }, CONTEXT) self.assertRaises(Exception, self.CheckTr... |
self.assertRaises(Exception, self.CheckTree()) | self.CheckTree() | def test0040delete(self): ''' Delete. ''' record_ids = self.mptt.search([], CONTEXT) for record_id in record_ids: if record_id % 2: self.mptt.delete(record_id, CONTEXT) self.assertRaises(Exception, self.CheckTree()) record_ids = self.mptt.search([], CONTEXT) self.mptt.delete(record_ids[:len(record_ids)/2], CONTEXT) sel... |
return super(EvalEnvironment, self).get(item, default=default) | return super(EvalEnvironment, self).get(item, default) | def get(self, item, default=None): try: return self.__getitem__(item) except: pass return super(EvalEnvironment, self).get(item, default=default) |
(obj_id, user, datetime.datetime.now())) | (obj_id, Transaction().user, datetime.datetime.now())) | def delete(self, ids): cursor = Transaction().cursor if not ids: return True |
return int(a.second * 1000) | return int(date.second * 1000) | def extract(lookup_type, date): if date is None: return None try: datepart, timepart = date.split(" ") year, month, day = map(int, datepart.split("-")) timepart_full = timepart.split(".") hours, minutes, seconds = map(int, timepart_full[0].split(":")) if len(timepart_full) == 2: microseconds = int(timepart_full[1]) sec... |
return "%i-01-01 00:00:00" % dt.year | return "%i-01-01 00:00:00" % date.year | def date_trunc(_type, date): if _type == 'second': return date try: date = mx.DateTime.strptime(date, '%Y-%m-%d %H:%M:%S') except: return None if _type == 'year': return "%i-01-01 00:00:00" % dt.year elif _type == 'month': return "%i-%02i-01 00:00:00" % (dt.year, dt.month) elif _type == 'day': return "%i-%02i-%02i 00:0... |
return "%i-%02i-01 00:00:00" % (dt.year, dt.month) | return "%i-%02i-01 00:00:00" % (date.year, date.month) | def date_trunc(_type, date): if _type == 'second': return date try: date = mx.DateTime.strptime(date, '%Y-%m-%d %H:%M:%S') except: return None if _type == 'year': return "%i-01-01 00:00:00" % dt.year elif _type == 'month': return "%i-%02i-01 00:00:00" % (dt.year, dt.month) elif _type == 'day': return "%i-%02i-%02i 00:0... |
return "%i-%02i-%02i 00:00:00" % (dt.year, dt.month, dt.day) | return "%i-%02i-%02i 00:00:00" % (date.year, date.month, date.day) | def date_trunc(_type, date): if _type == 'second': return date try: date = mx.DateTime.strptime(date, '%Y-%m-%d %H:%M:%S') except: return None if _type == 'year': return "%i-01-01 00:00:00" % dt.year elif _type == 'month': return "%i-%02i-01 00:00:00" % (dt.year, dt.month) elif _type == 'day': return "%i-%02i-%02i 00:0... |
not isinstance(field, (fields.Interger, | not isinstance(field, (fields.Integer, | def create(self, cursor, user, values, context=None): super(ModelSQL, self).create(cursor, user, values, context=context) |
not isinstance(field, (fields.Interger, | not isinstance(field, (fields.Integer, | def write(self, cursor, user, ids, values, context=None): super(ModelSQL, self).write(cursor, user, ids, values, context=context) |
self.host = self.relay.configure(self.relay.hostname) | self.host = self.relay.configure_relay(self.relay.hostname) | def __enter__(self): |
recipients=[], | recipients=None, | def __init__(self, subject, recipients=[], body=None, html=None, sender=None): if sender is None: sender = current_app.config.get("DEFAULT_MAIL_SENDER") |
self.recipients = recipients | self.recipients = list(recipients) | def __init__(self, subject, recipients=None, body=None, html=None, sender=None): if sender is None: sender = current_app.config.get("DEFAULT_MAIL_SENDER") |
if checklines and (len(text1) < 100 or len(text2) < 100): checklines = False if checklines: (text1, text2, linearray) = self.diff_linesToChars(text1, text2) diffs = self.diff_map(text1, text2) if not diffs: diffs = [(self.DIFF_DELETE, text1), (self.DIFF_INSERT, text2)] if checklines: self.diff_charsToLines(diffs, li... | self.dmp.Diff_Timeout = 0 self.dmp.Diff_DualThreshold = 32 self.assertEquals([(self.dmp.DIFF_DELETE, "a"), (self.dmp.DIFF_INSERT, "b")], self.dmp.diff_main("a", "b", False)) self.assertEquals([(self.dmp.DIFF_DELETE, "Apple"), (self.dmp.DIFF_INSERT, "Banana"), (self.dmp.DIFF_EQUAL, "s are a"), (self.dmp.DIFF_INSERT, "... | def diff_compute(self, text1, text2, checklines): """Find the differences between two texts. Assumes that the texts do not have any common prefix or suffix. |
template_values['page_title'] = site.title + u' › ' + l10n.backstage + u' › ' + l10n.topic_settings | template_values['page_title'] = site.title + u' › ' + l10n.backstage.decode('utf-8') + u' › ' + l10n.topic_settings.decode('utf-8') | def get(self): template_values = {} site = GetSite() member = CheckAuth(self) l10n = GetMessages(self, member, site) template_values['l10n'] = l10n if member: if member.num == 1: template_values['page_title'] = site.title + u' › ' + l10n.backstage + u' › ' + l10n.topic_settings template_values['site'] = site template_v... |
default = "http://v2ex.com/static/img/avatar_" + str(arg) + ".png" | def avatar(value,arg): if arg == 'large': number_size = 73 member_avatar_url = value.avatar_large_url elif arg == 'normal': number_size = 48 member_avatar_url = value.avatar_normal_url elif arg == 'mini': number_size = 24 member_avatar_url = value.avatar_mini_url if member_avatar_url: return '<img src="'+ member_avata... | |
template_values['page_title'] = site.title + u' › ' + l10n.create_new_topic | template_values['page_title'] = site.title + u' › ' + l10n.create_new_topic.decode('utf-8') | def get(self, node_name): site = GetSite() browser = detect(self.request) template_values = {} template_values['site'] = site template_values['system_version'] = SYSTEM_VERSION member = CheckAuth(self) l10n = GetMessages(self, member, site) template_values['l10n'] = l10n template_values['page_title'] = site.title + u' ... |
template_values['page_title'] = site.title + u' › ' + l10n.create_new_topic | template_values['page_title'] = site.title + u' › ' + l10n.create_new_topic.decode('utf-8') | def post(self, node_name): site = GetSite() browser = detect(self.request) template_values = {} template_values['site'] = site template_values['system_version'] = SYSTEM_VERSION member = CheckAuth(self) l10n = GetMessages(self, member, site) template_values['l10n'] = l10n template_values['page_title'] = site.title + u'... |
value = value.replace('http://cl.ly/' + img_id[0], '<a href="http://cl.ly/' + img_id[0] + '" target="_blank"><img src="http://cl.ly/' + img_id[0] + '/content" class="imgly" border="0" /></a>') | value = value.replace('http://cl.ly/' + img_id[0], '<a href="http://cl.ly/' + img_id[0] + '" target="_blank"><img src="http://zdxproxy.appspot.com/cl.ly/' + img_id[0] + '/content" class="imgly" border="0" /></a>') | def clly(value): imgs = re.findall('(http://cl.ly/[a-zA-Z0-9]+)\s?', value) if (len(imgs) > 0): for img in imgs: img_id = re.findall('http://cl.ly/([a-zA-Z0-9]+)', img) if (img_id[0] != 'demo' and img_id[0] != 'whatever'): value = value.replace('http://cl.ly/' + img_id[0], '<a href="http://cl.ly/' + img_id[0] + '" targ... |
template_values['page_title'] = site.title + u' › ' + l10n.backstage + u' › ' + l10n.topic_settings | template_values['page_title'] = site.title + u' › ' + l10n.backstage.decode('utf-8') + u' › ' + l10n.topic_settings.decode('utf-8') | def post(self): template_values = {} site = GetSite() member = CheckAuth(self) l10n = GetMessages(self, member, site) template_values['l10n'] = l10n if member: if member.num == 1: template_values['page_title'] = site.title + u' › ' + l10n.backstage + u' › ' + l10n.topic_settings template_values['site'] = site template_... |
template_values = {} | def get(self, reply_num): site = GetSite() member = CheckAuth(self) l10n = GetMessages(self, member, site) template_values['l10n'] = l10n if member: if member.num == 1: template_values = {} template_values['page_title'] = site.title + u' › 编辑回复' template_values['member'] = member q = db.GqlQuery("SELECT * FROM Reply WH... | |
template_values = {} | def post(self, reply_num): site = GetSite() member = CheckAuth(self) l10n = GetMessages(self, member, site) template_values['l10n'] = l10n if member: if member.num == 1: template_values = {} template_values['page_title'] = site.title + u' › 编辑回复' template_values['member'] = member q = db.GqlQuery("SELECT * FROM Reply W... | |
if not self.get_scaler_done(): Chatter.write('Excluding outlier reflections Z > %.2f' % Flags.get_z_min()) return | def _scale(self): '''Actually scale all of the data together.''' | |
for j, _x in enumerate(x): | for j in range(c): | def poly_residual(xp, y, params): '''Compute the residual between the observations y[i] and sum_j params[j] x[i]^j. For efficiency, x[i]^j are pre-calculated in xp.''' r = 0.0 n = len(params) e = flex.double() for j, _x in enumerate(x): e.append(flex.sum(xp[j] * params)) return flex.sum(flex.pow2(y - e)) |
datestring = datestring.split('.')[0] struct_time = time.strptime(datestring, format) | _datestring = datestring.split('.')[0] struct_time = time.strptime(_datestring, format) | def _get_time(self, datestring): '''Unpack a date string to a structure.''' |
Dwbug.write('Assigning user input spacegroup: %s' % \ | Debug.write('Assigning user input spacegroup: %s' % \ | def _scale_prepare(self): '''Perform all of the preparation required to deliver the scaled data. This should sort together the reflection files, ensure that they are correctly indexed (via pointless) and generally tidy things up.''' |
self._mask = None | def _read_mask(self): try: index = sys.argv.index('-mask') except ValueError, e: self._mask = None return | |
def _help_free_fraction(self): return '-free_fraction N' | def _help_mask(self): return '-mask mask.dat' | def _help_free_fraction(self): return '-free_fraction N' |
('rigaku', 1042, 90):'rigaku saturn 944 2x2 binned'} | ('rigaku', 1042, 90):'rigaku saturn 944 2x2 binned', ('rigaku', 1042, 89):'rigaku saturn 944 2x2 binned'} | def check(self, image): return self._headers.has_key(image) |
cell = self._inedxr_cell | cell = self._indxr_cell | def _index_finish(self): '''Perform the indexer post-processing as required.''' |
pattern_keys = [r'([^\.]*)\.([0-9]+)', | pattern_keys = [r'([^\.]*)\.([0-9]+)\Z', | def image2template(filename): '''Return a template to match this filename.''' # check that the file name doesn't contain anything mysterious if filename.count('#'): raise RuntimeError, '# characters in filename' # the patterns in the order I want to test them pattern_keys = [r'([^\.]*)\.([0-9]+)', r'(.*)_([0-9]*)\.(... |
patterns = {r'([^\.]*)\.([0-9]+)':'%s.%s%s', | patterns = {r'([^\.]*)\.([0-9]+)\Z':'%s.%s%s', | def image2template(filename): '''Return a template to match this filename.''' # check that the file name doesn't contain anything mysterious if filename.count('#'): raise RuntimeError, '# characters in filename' # the patterns in the order I want to test them pattern_keys = [r'([^\.]*)\.([0-9]+)', r'(.*)_([0-9]*)\.(... |
pattern_keys = [r'([^\.]*)\.([0-9]+)', | pattern_keys = [r'([^\.]*)\.([0-9]+)\Z', | def image2image(filename): '''Return an integer for the template to match this filename.''' # check that the file name doesn't contain anything mysterious if filename.count('#'): raise RuntimeError, '# characters in filename' # the patterns in the order I want to test them pattern_keys = [r'([^\.]*)\.([0-9]+)', r'(.... |
self.input('mosaic estimate') self.input('go') | for i in _images: self.input('mosaic estimate %d' % i) self.input('go') | def _index(self): '''Implement the indexer interface.''' |
self._indxr_mosaic = float(o.split('>')[1].split()[0]) | ms = float(o.split('>')[1].split()[0]) mosaic_spreads.append(ms) | def _index(self): '''Implement the indexer interface.''' |
self._indxr_mosaic = phi_width | if not mosaic_spreads: mosaic_spreads.append(phi_width) | def _index(self): '''Implement the indexer interface.''' |
if out_name in ['nTotalObservations']: | if out_name in ['nTotalObservations', 'nTotalUniqueObservations']: | def write_scaling_statistics(self, fout, scaling_stats_type, stats_dict): '''Write out the SCALING STATISTICS block...''' |
if self._header['detector'] == 'dectris': format = '%Y/%b/%d %H:%M:%S' | format = '%Y/%b/%d %H:%M:%S' ms = 0.001 * int(datestring.split('.')[1]) _datestring = datestring.split('.')[0] struct_time = time.strptime(_datestring, format) except: struct_time = None if not struct_time: try: format = '%d/%m/%Y %H:%M:%S' | def _get_time(self, datestring): '''Unpack a date string to a structure.''' |
else: | except: struct_time = None if not struct_time: try: | def _get_time(self, datestring): '''Unpack a date string to a structure.''' |
except: | except: struct_time = None if not struct_time: | def _get_time(self, datestring): '''Unpack a date string to a structure.''' |
print 'Size: %d %d' % header['size'] print 'Beam centre: %f %f' % header['beam'] | print 'Size: %d %d' % tuple(header['size']) print 'Beam centre: %f %f' % tuple(header['beam']) | def gain(self): '''Estimate gain for this image.''' |
print 'Epochs: %.3f' % header['epoch'] | print 'Epoch: %.3f' % header['epoch'] | def gain(self): '''Estimate gain for this image.''' |
cif = CifFile.ReadCif(fname) | cif = CifFile.ReadCif('file:/%s' % fname) | def _read_cbf_header(self, image): '''Read the contents of the header of this image.''' |
rummage(path) | if CommandLine.get_template() and CommandLine.get_directory(): visit(None, CommandLine.get_directory(), os.listdir(CommandLine.get_directory())) else: rummage(path) | def write_xinfo(filename, path, template = None): global target_template target_template = template crystal = CommandLine.get_crystal_name() if not crystal: crystal = 'DEFAULT' if not os.path.isabs(filename): filename = os.path.abspath(filename) directory = os.path.join(os.getcwd(), crystal, 'setup') try: os.mak... |
sg = mtz.get_space_group() | def mtz_dump(hklin): '''An implementation of mtzdump using the above classes.''' mtz = mtz_file(hklin) print 'Reading file: %s' % hklin print 'Spacegroup: %s' % mtz.get_space_group().type( ).universal_hermann_mauguin_symbol() sg = mtz.get_space_group() print 'Centring operations:' for cenop in mtz.get_centring_opera... | |
supported_versions = ['December 28, 2009'] | supported_versions = ['December 28, 2009', 'February 3, 2010'] | def xds_check_version_supported(xds_output_list): '''Check that the XDS version is supported.''' xds_version = _xds_version(xds_output_list) # supported_versions = ['January 30, 2009'] supported_versions = ['December 28, 2009'] if not xds_version in supported_versions: raise RuntimeError, 'XDS version "%s" not suppo... |
(detector_to_detector[detector], 1, | (detector_to_detector[detector], detector_to_minimum_trusted[detector], | def header_to_xds(header, synchrotron = None, reversephi = False): '''A function to take an input header dictionary from Diffdump and generate a list of records to start XDS - see Doc/INP.txt.''' # decide if we are at a synchrotron if we don't know already... # that is, the wavelength is around either the Copper or Ch... |
if self.get_integrater_low_resolution() > 0.0: Debug.write('Using low resolution limit: %.2f' % \ self.get_integrater_low_resolution()) correct.set_resolution_high(0.0) correct.set_resolution_low( self.get_integrater_low_resolution()) | def _integrate_finish(self): '''Finish off the integration by running correct.''' | |
if 'bad batch' in e or 'negative scles run' in e or \ | if 'bad batch' in e or 'negative scales run' in e or \ | def _scale(self): '''Perform all of the operations required to deliver the scaled data.''' |
l = file_contents[j].split() resolution_info.append((float(l[1]),float(l[2]))) | try: l = file_contents[j].split() resolution_info.append((float(l[1]),float(l[2]))) except ValueError, e: l = file_contents[j].split() m = re.match(r'(\d+\.\d{2})(\d+\.\d+)', l[2]) resolution_info.append((float(l[1]),float(m.group(1)))) | def _parse_correct_lp(filename): '''Parse the contents of the CORRECT.LP file pointed to by filename.''' if not os.path.split(filename)[-1] == 'CORRECT.LP': raise RuntimeError, 'input filename not CORRECT.LP' file_contents = open(filename, 'r').readlines() postrefinement_stats = { } # default values - this may not ... |
if indexer: | if indexer and not self._scalr_input_pointgroup: | def _scale_prepare(self): '''Perform all of the preparation required to deliver the scaled data. This should sort together the reflection files, ensure that they are correctly indexed (via pointless) and generally tidy things up.''' |
self.set_integrater_prepare_done(False) | self._integrater_reset() | def integrate(self): '''Actually perform integration until we think we are done...''' |
self.set_integrater_prepare_done(False) self.set_integrater_done(False) | self._integrater_reset() | def integrate(self): '''Actually perform integration until we think we are done...''' |
self.set_integrater_prepare_done(False) self.set_integrater_done(False) self.set_integrater_finish_done(False) | self._integrater_reset() | def integrate(self): '''Actually perform integration until we think we are done...''' |
'scaling', self.get_scaler_xcrystal().get_name(), 'CCP4', | 'scaling', self.get_scaler_xcrystal().get_name(), 'XSCALE', | def _scale(self): '''Actually scale all of the data together.''' |
if 'resolution' in sweep_info: | if 'RESOLUTION' in sweep_info: | def setup_from_xinfo_file(self, xinfo_file): '''Set up this object & all subobjects based on the .xinfo file contents.''' |
values = map(float, sweep_info['resolution']) | values = map(float, sweep_info['RESOLUTION'].split()) | def setup_from_xinfo_file(self, xinfo_file): '''Set up this object & all subobjects based on the .xinfo file contents.''' |
if __name__ == '__main__X': | if __name__ == '__main__': | def digest(bins, isigma_limit = 1.0): '''Digest a list of bins to calculate a sensible resolution limit.''' # print 'Debugging! isigma_limit = %f' % isigma_limit ss = bins.keys() ss.sort() for j in range(_number_bins): s = ss[j] mean, sdm, sd = bins[s] if False: print s, 1.0 / math.sqrt(s), mean, sd # ok, really ... |
ss = bot.keys() ss.sort() for j in range(len(bot)): s = ss[j] mean, sd = bot[s] if sd > 0: print s, 1.0 / math.sqrt(s), mean, sd, mean / sd | for b in sorted(bot): mean, spread, sigma = bot[b] if mean: print 1.0 / math.sqrt(b), mean, spread, sigma, mean / sigma | def digest(bins, isigma_limit = 1.0): '''Digest a list of bins to calculate a sensible resolution limit.''' # print 'Debugging! isigma_limit = %f' % isigma_limit ss = bins.keys() ss.sort() for j in range(_number_bins): s = ss[j] mean, sdm, sd = bins[s] if False: print s, 1.0 / math.sqrt(s), mean, sd # ok, really ... |
if __name__ == '__moon__': rc = ResolutionCell(90.24, 90.24, 45.24, 90.0, 90.0, 120.0) for l in range(1, 35): s, r = rc.resolution(0, 0, l) print '%d %.4f %.2f' % (l, s, r) for k in range(1, 65): s, r, = rc.resolution(0, k, 0) print '%d %.4f %.2f' % (k, s, r) rg = ResolutionGeometry(200.0, 0.97975, 109.0, 105.0) fo... | def digest(bins, isigma_limit = 1.0): '''Digest a list of bins to calculate a sensible resolution limit.''' # print 'Debugging! isigma_limit = %f' % isigma_limit ss = bins.keys() ss.sort() for j in range(_number_bins): s = ss[j] mean, sdm, sd = bins[s] if False: print s, 1.0 / math.sqrt(s), mean, sd # ok, really ... | |
p_list = [(totals[j], hklin_list[j]) for k in range(len(hklin_list))] | p_list = [(totals[j], hklin_list[j]) for j in range(len(hklin_list))] | def assign_resolution_unmerged_isigma(self, limit = 1.0): '''Assign a resolution limit based on unmerged I/sigma to all mergers.''' |
self.setCurrentIndex(select[0]) self.scrollTo(select[0]) [self.expand(z) for z in expand] | if select: self.setCurrentIndex(select[0]) self.scrollTo(select[0]) if expand: [self.expand(z) for z in expand] | def finished(val): qmutex.lock() select = val[0] expand = val[1] [selectindex(z, QItemSelectionModel.Select) for z in select] self.setCurrentIndex(select[0]) self.scrollTo(select[0]) [self.expand(z) for z in expand] self.blockSignals(False) self.setEnabled(True) self._load = load self._threadRunning = False qmutex.unlo... |
f = QFont() | def data(self, index, role=Qt.DisplayRole): row = index.row() if not index.isValid() or not (0 <= row < len(self.taginfo)): return QVariant() if (role == Qt.DisplayRole) or (role == Qt.ToolTipRole) or (role == Qt.EditRole): try: audio = self.taginfo[row] tag = self.headerdata[index.column()][1] if tag in audio.testData... | |
print 'set:', size print 'old:', self.viewOptions().font.pointSize() self.viewOptions().font.setPointSize(size) print 'new:', self.viewOptions().font.pointSize() | self.model().fontSize = size | def _setFontSize(self, size): print 'set:', size print 'old:', self.viewOptions().font.pointSize() self.viewOptions().font.setPointSize(size) print 'new:', self.viewOptions().font.pointSize() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.