rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
('Best fit', 0, 0), | ('Best fit', None, None), | def pt_to_dots_with_dpi(pt, dpi): return float(pt * dpi) / RenderingSession.PT_PER_INCH |
valid_sizes.append(('Best fit', paper_width_mm, paper_height_mm, True, False)) | valid_sizes.append(('Best fit', min(paper_width_mm, paper_height_mm), max(paper_width_mm, paper_height_mm), paper_width_mm < paper_height_mm, paper_width_mm > paper_height_mm)) | def get_compatible_paper_sizes(bounding_box, zoom_level, resolution_km_in_mm=Renderer.DEFAULT_KM_IN_MM): """Returns a list of paper sizes that can accomodate the provided bounding box at the given zoom level and print resolution. |
street_index = StreetIndex(self._db, config.polygon_wkt, config.i18n) | try: street_index = StreetIndex(self._db, config.polygon_wkt, config.i18n) except IndexEmptyError: LOG.warning("Designated area leads to an empty index") street_index = None | def render(self, config, renderer_name, output_formats, file_prefix): """Renders a job with the given rendering configuration, using the provided renderer, to the given output formats. |
if renderer.grid: | if renderer.grid and street_index: | def render(self, config, renderer_name, output_formats, file_prefix): """Renders a job with the given rendering configuration, using the provided renderer, to the given output formats. |
street_index.write_to_csv(config.title, '%s.csv' % file_prefix) | if street_index: street_index.write_to_csv(config.title, '%s.csv' % file_prefix) | def render(self, config, renderer_name, output_formats, file_prefix): """Renders a job with the given rendering configuration, using the provided renderer, to the given output formats. |
u"Jardins", u"Liaison", u"Mail", u"Montée", u"Môle", | u"Jardins", u"Liaison", u"Lotissement", u"Mail", u"Montée", u"Môle", | def isrtl(self): return False |
def __init__(self, config_file=None, city_name=None, boundingbox=None, osmid=None, language=None): | def __init__(self, config_file=None, map_areas_prefix=None, city_name=None, boundingbox=None, osmid=None, language=None): | def __init__(self, config_file=None, city_name=None, boundingbox=None, osmid=None, language=None): """Creates a new OCitySMap renderer instance for the given city. |
config_file: location of the config file | config_file (string): location of the config file map_areas_prefix (string): map_areas table name prefix | def __init__(self, config_file=None, city_name=None, boundingbox=None, osmid=None, language=None): """Creates a new OCitySMap renderer instance for the given city. |
self._map_areas_table_name = "map_areas" if self.parser.has_option('ocitysmap', 'map_areas_table_name'): self._map_areas_table_name = self.parser.get('ocitysmap', 'map_areas_table_name') | map_areas_prefix = map_areas_prefix or '' self._map_areas_table_name = '%smap_areas' % map_areas_prefix | def __init__(self, config_file=None, city_name=None, boundingbox=None, osmid=None, language=None): """Creates a new OCitySMap renderer instance for the given city. |
self._gen_map_areas(db) if self.osmid: self.streets = self.get_streets_by_osmid(db, self.osmid) self.amenities = self.get_amenities_by_osmid(db, self.osmid) elif self.city_name: self.streets = self.get_streets_by_name(db, self.city_name) self.amenities = self.get_amenities_by_name(db, self.city_name) else: self.street... | try: self._gen_map_areas(db) if self.osmid: self.streets = self.get_streets_by_osmid(db, self.osmid) self.amenities = self.get_amenities_by_osmid(db, self.osmid) elif self.city_name: self.streets = self.get_streets_by_name(db, self.city_name) self.amenities = self.get_amenities_by_name(db, self.city_name) else: self.s... | def __init__(self, config_file=None, city_name=None, boundingbox=None, osmid=None, language=None): """Creates a new OCitySMap renderer instance for the given city. |
LOG.debug('drop...') | LOG.debug('drop %s...' % self._map_areas_table_name) | def _gen_map_areas(self, db): cursor = db.cursor() LOG.debug('Call gen_map_areas table: %s...' % self._map_areas_table_name) |
LOG.debug('create table...') | LOG.debug('create table %s...' % self._map_areas_table_name) | def _gen_map_areas(self, db): cursor = db.cursor() LOG.debug('Call gen_map_areas table: %s...' % self._map_areas_table_name) |
'de_BE.UTF-8': i18n_generic, | def first_letter_equal(self, a, b): return a == b | |
'de_AT.UTF-8': i18n_generic, 'de_DE.UTF-8': i18n_generic, 'de_LU.UTF-8': i18n_generic, 'de_CH.UTF-8': i18n_generic, | 'de_AT.UTF-8': i18n_de_generic, 'de_BE.UTF-8': i18n_de_generic, 'de_DE.UTF-8': i18n_de_generic, 'de_LU.UTF-8': i18n_de_generic, 'de_CH.UTF-8': i18n_de_generic, | def first_letter_equal(self, a, b): return a == b |
APPELLATIONS = [ u"Allée", u"Allées", u"Avenue", u"Boulevard", u"Carrefour", u"Chaussée", u"Chemin", u"Cheminement", u"Cale", u"Cales", u"Cité", u"Clos", u"Côte", u"Cour", u"Cours", u"Degré", u"Esplanade", u"Giratoire", u"Hameau", u"Impasse", u"Liaison", u"Mail", u"Montée", | APPELLATIONS = [ u"Accès", u"Allée", u"Allées", u"Autoroute", u"Avenue", u"Barrage", u"Boulevard", u"Carrefour", u"Chaussée", u"Chemin", u"Cheminement", u"Cale", u"Cales", u"Cavée", u"Cité", u"Clos", u"Coin", u"Côte", u"Cour", u"Cours", u"Descente", u"Degré", u"Escalier", u"Escaliers", u"Esplanade", u"Funiculaire", u"G... | def isrtl(self): return False |
u"Place", u"Placette", u"Pont", u"Promenade", u"Petite Avenue", u"Petite Rue", u"Quai", u"Résidence", u"Rond-Point", u"Rang", u"Route forestière", u"Route", u"Rue", u"Ruelle", u"Square", u"Sentier", u"Sentiers", u"Traboule", u"Traverse", u"Venelle", u"Villa", u"Voie", u"Rond-point" ] | u"Place", u"Placette", u"Pont", u"Promenade", u"Petite Avenue", u"Petite Rue", u"Quai", u"Rampe", u"Rang", u"Résidence", u"Rond-Point", u"Route forestière", u"Route", u"Rue", u"Ruelle", u"Square", u"Sente", u"Sentier", u"Sentiers", u"Terre-Plein", u"Télécabine", u"Traboule", u"Traverse", u"Tunnel", u"Venelle", u"Villa"... | def isrtl(self): return False |
u" de", u" d'", u"" ] | u" de", u" d'", u" aux", u"" ] | def isrtl(self): return False |
u"Allée", u"Allées", u"Avenue", u"Boulevard", u"Carrefour", u"Chaussée", u"Chemin", u"Cheminement", u"Cale", u"Cales", u"Cité", u"Clos", u"Côte", u"Cour", u"Cours", u"Degré", u"Esplanade", u"Giratoire", u"Hameau", u"Impasse", u"Liaison", u"Mail", u"Montée", u"Passage", u"Passerelle", u"Passerelles", u"Place", u"Placett... | u"Accès", u"Allée", u"Allées", u"Autoroute", u"Avenue", u"Barrage", u"Boulevard", u"Carrefour", u"Chaussée", u"Chemin", u"Cheminement", u"Cale", u"Cales", u"Cavée", u"Cité", u"Clos", u"Coin", u"Côte", u"Cour", u"Cours", u"Descente", u"Degré", u"Escalier", u"Escaliers", u"Esplanade", u"Funiculaire", u"Giratoire", u"Hame... | def first_letter_equal(self, a, b): return self._upper_unaccent_string(a) == self._upper_unaccent_string(b) |
u"Passage", u"Passerelle", u"Passerelles", | u"Parc", u"Passage", u"Passerelle", u"Passerelles", | def first_letter_equal(self, a, b): """returns True if the letters a and b are equal in the map index, e.g. É and E are equals in French map index""" return a == b |
APPELLATIONS = [ u"Avenida", u"Avinguda", u"Calle", u"Camino", u"Camí", u"Carrer", u"Carretera", u"Plaza", u"Plaça", u"Ronda" ] | APPELLATIONS = [ u"Avenida", u"Avinguda", u"Calle", u"Callejón", u"Calzada", u"Camino", u"Camí", u"Carrer", u"Carretera", u"Glorieta", u"Parque", u"Pasaje", u"Pasarela", u"Paseo", u"Plaza", u"Plaça", u"Privada", u"Puente", u"Ronda", u"Salida", u"Travesia" ] | def first_letter_equal(self, a, b): return self._upper_unaccent_string(a) == self._upper_unaccent_string(b) |
return self.filter_common(js, 'js', settings.COMPRESS_YUI_CSS_ARGUMENTS) | return self.filter_common(js, 'js', settings.COMPRESS_YUI_JS_ARGUMENTS) | def filter_js(self, js): return self.filter_common(js, 'js', settings.COMPRESS_YUI_CSS_ARGUMENTS) |
elif not css.get('extra_context', {}).get('prefix', None): | else: | def render(self, context): css_name = template.Variable(self.name).resolve(context) |
elif not js.get('extra_context', {}).get('prefix', None): | else: | def render(self, context): js_name = template.Variable(self.name).resolve(context) |
self._assert_request_state(current_request, JOB_CREATED) | def recv_status_res(self, job_handle, known, running, numerator, denominator): # If we received a STATUS_RES update about this request, update our known status current_request = self.handle_to_request_map[job_handle] self._assert_request_state(current_request, JOB_CREATED) | |
"userduration": "${userduration}", "systemduration": "${systemduration}", | "userduration": "{$userduration}", "systemduration": "{$systemduration}", | def SliceBlockDurationChain(runid, logname, authinfo, dbname, durtable, console): """ return the Chain of conditions and tasks required to calculation the duration of the a traced block in the Slice harness code. @param runid the run identifier for the run to process @param logname the name of log that contai... |
"userduration": "${userduration}", "systemduration": "${systemduration}", | "userduration": "{$userduration}", "systemduration": "{$systemduration}", | def PipelineBlockDurationChain(runid, logname, authinfo, dbname, durtable, console): """ calculate the durations for a particular block executed within Pipeline (master) process. @param runid the run identifier for the run to process @param logname the name of log that contains the start and stop messages @p... |
"userduration": "${userduration}", "systemduration": "${systemduration}", | "userduration": "{$userduration}", "systemduration": "{$systemduration}", | def AppBlockDurationChain(runid, stageid, logname, startComm, endComm, authinfo, dbname, durtable, console, blockName=None): """ calculate the duration of application level block. This requires knowing the comments for the starting message and the ending message. @param runid the run identifier for the run to pr... |
"userduration": "${userduration}", "systemduration": "${systemduration}", | "userduration": "{$userduration}", "systemduration": "{$systemduration}", | def LoopDurationChain(runid, authinfo, dbname, durtable, console): """ calculate the time required to complete each visit loop within the master Pipeline process. harness code. @param runid the run identifier for the run to process @param authinfo the database authorization data returned from db.readAuthInfo()... |
job = fromdb.PreprocessDuration(runid, authinfo, dbname, logtable, durtable, console) | job = fromdb.PostprocessDuration(runid, authinfo, dbname, logtable, durtable, console) | def main(): host = "lsst10.ncsa.uiuc.edu" # this version of jython doesn't have optparse or argparse parser = ArgParser.ArgParser('basic duration calculations') parser.addArg("--runid", "store", None) parser.addArg("--dbname", "store", None) parser.addArg("--logtable", "store", None) parser.addArg("--durtable", "store... |
while x < total: | while x <= total: | def parseArgs(self, args): total = len(args)-1 |
if x < total: | if x <= total: | def parseArgs(self, args): total = len(args)-1 |
def operation_execute(key): | def operation_execute(key, action): | def operation_execute(key): operation = datastore.get(key) if not operation.completed and not operation.error: connection = MTurkConnection(operation.action) try: operation.execute(connection) self.completed = datetime.now() except (BotoClientError, BotoServerError), response: self.error = response_error(response) ... |
connection = MTurkConnection(operation.action) | connection = MTurkConnection(action) | def operation_execute(key): operation = datastore.get(key) if not operation.completed and not operation.error: connection = MTurkConnection(operation.action) try: operation.execute(connection) self.completed = datetime.now() except (BotoClientError, BotoServerError), response: self.error = response_error(response) ... |
self.completed = datetime.now() | operation.completed = datetime.now() | def operation_execute(key): operation = datastore.get(key) if not operation.completed and not operation.error: connection = MTurkConnection(operation.action) try: operation.execute(connection) self.completed = datetime.now() except (BotoClientError, BotoServerError), response: self.error = response_error(response) ... |
self.error = response_error(response) self.put() | operation.error = response_error(response) operation.put() | def operation_execute(key): operation = datastore.get(key) if not operation.completed and not operation.error: connection = MTurkConnection(operation.action) try: operation.execute(connection) self.completed = datetime.now() except (BotoClientError, BotoServerError), response: self.error = response_error(response) ... |
datastore.run_in_transaction(operation_execute, self.operation.key()) | datastore.run_in_transaction(operation_execute, self.operation.key(), self.operation.action) | def post(self): datastore.run_in_transaction(operation_execute, self.operation.key()) |
invalid_ids = assignment_ids.difference(set(hit_assignment_ids)) | invalid_ids = self.assignment_ids.difference(set(hit_assignment_ids)) | def _fn(self, *args, **kwargs): self.assignment_ids = set([row[0] for row in self.csv_reader('assignment_ids')]) |
return AbstractOperation.all().filter('action = ', self.action) | return AbstractOperation.all().filter('action = ', action) def operation_status(operation): if operation.completed: return 'Completed: %s' % operation.completed.strftime('%Y-%m-%d %H:%M') elif operation.error: return 'Error: %s' % operation.error else: return 'Pending' | def action_operations(action): return AbstractOperation.all().filter('action = ', self.action) |
, 'operations': action_operations(self.action) | , 'operations': items | def get(self): if self.action.confirmed: self.render('priv/action_results.html', { 'action': self.action , 'operations': action_operations(self.action) }) else: self.render('priv/action_preview.html', { 'action': self.action , 'operations': action_operations(self.action) , 'url': self.request.url }) |
taskqueue.add(self.operation_task_url(operation)) | taskqueue.add(url='/operation/task', params={'key': operation.key()}) | def post(self): if self.action.confirmed: self.method_not_allowed() else: self.action.confirmed = datetime.now() self.action.put() |
self.redirect(self.action_url(action)) | self.redirect(self.action_url(self.action)) | def post(self): self.action.put() |
self.redirect(self.action_url(action)) | self.redirect(self.action_url(self.action)) | def post(self): hit_id = self.request.get('hit_id') amount = self.request.get('amount') reason = self.request.get('reason') |
self.redirect(self.action_url(action)) | self.redirect(self.action_url(self.action)) | def post(self): message_subject = self.request.get('message_subject') |
setup(name = 'pysnmp-mibs', version = '0.0.9a', description = 'A collection of pre-compiled PySNMP MIBs', author = 'Ilya Etingof', author_email = 'ilya@glas.net', url = 'http://sourceforge.net/projects/pysnmp/', license = 'BSD', requires = [ 'pysnmp' ], packages = [ 'pysnmp_mibs' ], scripts = [ 'tools/rebuild-pysnmp-mi... | params.update( { 'name': 'pysnmp-mibs', 'version': '0.0.10a', 'description': 'A collection of pre-compiled PySNMP MIBs', 'author': 'Ilya Etingof', 'author_email': 'ilya@glas.net', 'url': 'http://sourceforge.net/projects/pysnmp/', 'license': 'BSD', 'packages': [ 'pysnmp_mibs' ], 'scripts': [ 'tools/rebuild-pysnmp-mibs' ... | def howto_install_setuptools(): print """Error: You need setuptools Python package! |
self._build_pack_node(subpack, packs_list[:pos + 1]) | self._build_pack_node(subpack, current_packs_slice) | def wrap_pack(self, dest_pack, wrap_pack): ''' Вставляет экшенпак wrap_pack внутрь иерархии перед dest_pack. Таким образом можно перехватывать запросы и ответы пака dest_pack. Допустим есть цепочка паков: A1 - X - A2 - A3 | A1 - Y - X - A2 - A3 B1 - B2 - X | B1 - B2 - Y - X X - C1 - C2 | Y - X... |
self._build_pack_node(action, packs_list[:pos + 1]) | self._build_pack_node(action, current_packs_slice) | def wrap_pack(self, dest_pack, wrap_pack): ''' Вставляет экшенпак wrap_pack внутрь иерархии перед dest_pack. Таким образом можно перехватывать запросы и ответы пака dest_pack. Допустим есть цепочка паков: A1 - X - A2 - A3 | A1 - Y - X - A2 - A3 B1 - B2 - X | B1 - B2 - Y - X X - C1 - C2 | Y - X... |
old_prev_rec = self.__class__.query_dimentions(self).filter(info_date = self.info_date_prev) old_next_rec = self.__class__.query_dimentions(self).filter(info_date = self.info_date_next) | q = self.__class__.query_dimentions(self).filter(info_date = self.info_date_prev) old_prev_rec = q.get() if len(q) == 1 else None q = self.__class__.query_dimentions(self).filter(info_date = self.info_date_next) old_next_rec = q.get() if len(q) == 1 else None | def save(self, *args, **kwargs): # если не указана дата записи, то if self.period != PERIOD_INFTY and not self.info_date: raise Exception('Attribute info_date is not set!') # нормализуем переданные дату и время self.info_date = normdate(self.period,self.info_date) # проверим на уникальность записи if self.period != PE... |
new_prev_rec = self.__class__.query_dimentions(self).filter(info_date__lt = self.info_date, info_date_next__gte = self.info_date) | q = self.__class__.query_dimentions(self).filter(info_date__lt = self.info_date, info_date_next__gte = self.info_date) new_prev_rec = q.get() if len(q) == 1 else None | def save(self, *args, **kwargs): # если не указана дата записи, то if self.period != PERIOD_INFTY and not self.info_date: raise Exception('Attribute info_date is not set!') # нормализуем переданные дату и время self.info_date = normdate(self.period,self.info_date) # проверим на уникальность записи if self.period != PE... |
new_next_rec = self.__class__.query_dimentions(self).filter(info_date__gt = self.info_date, info_date_prev__lte = self.info_date) | q = self.__class__.query_dimentions(self).filter(info_date__gt = self.info_date, info_date_prev__lte = self.info_date) new_next_rec = q.get() if len(q) == 1 else None | def save(self, *args, **kwargs): # если не указана дата записи, то if self.period != PERIOD_INFTY and not self.info_date: raise Exception('Attribute info_date is not set!') # нормализуем переданные дату и время self.info_date = normdate(self.period,self.info_date) # проверим на уникальность записи if self.period != PE... |
old_prev_rec.save(*args, **kwargs) | old_prev_rec.save() | def save(self, *args, **kwargs): # если не указана дата записи, то if self.period != PERIOD_INFTY and not self.info_date: raise Exception('Attribute info_date is not set!') # нормализуем переданные дату и время self.info_date = normdate(self.period,self.info_date) # проверим на уникальность записи if self.period != PE... |
old_next_rec.save(*args, **kwargs) | old_next_rec.save() | def save(self, *args, **kwargs): # если не указана дата записи, то if self.period != PERIOD_INFTY and not self.info_date: raise Exception('Attribute info_date is not set!') # нормализуем переданные дату и время self.info_date = normdate(self.period,self.info_date) # проверим на уникальность записи if self.period != PE... |
new_prev_rec._save(*args, **kwargs) | new_prev_rec._save() | def save(self, *args, **kwargs): # если не указана дата записи, то if self.period != PERIOD_INFTY and not self.info_date: raise Exception('Attribute info_date is not set!') # нормализуем переданные дату и время self.info_date = normdate(self.period,self.info_date) # проверим на уникальность записи if self.period != PE... |
new_next_rec._save(*args, **kwargs) | new_next_rec._save() | def save(self, *args, **kwargs): # если не указана дата записи, то if self.period != PERIOD_INFTY and not self.info_date: raise Exception('Attribute info_date is not set!') # нормализуем переданные дату и время self.info_date = normdate(self.period,self.info_date) # проверим на уникальность записи if self.period != PE... |
date_begin = normdate(cls.period, datetime.min, True) date_end = normdate(cls.period, datetime.max, False) | date_begin = normdate(cls.period, date_begin, True) date_end = normdate(cls.period, date_end, False) | def query_interval(cls, data, date_begin = datetime.min, date_end = datetime.max, include_begin = True, include_end = True): ''' Выборка записей, попадающий в указанный интервал дат. @data - объект или словарь с ключевыми данными @date_begin - начало интервала @date_end - конец интервала @include_begin = True - запись ... |
old_prev_rec = self.__class__.query_dimentions(self).filter(info_date_end = self.info_date_prev) old_next_rec = self.__class__.query_dimentions(self).filter(info_date_begin = self.info_date_next) | q = self.__class__.query_dimentions(self).filter(info_date_end = self.info_date_prev) old_prev_rec = q.get() if len(q) == 1 else None q = self.__class__.query_dimentions(self).filter(info_date_begin = self.info_date_next) old_next_rec = q.get() if len(q) == 1 else None | def save(self, *args, **kwargs): # если не указана дата записи, то if self.period != PERIOD_INFTY and (not self.info_date_begin or not self.info_date_end): raise Exception('Attribute info_date is not set!') # нормализуем переданные дату и время self.info_date_begin = normdate(self.period,self.info_date_begin, True) sel... |
new_prev_rec = self.__class__.query_dimentions(self).filter(info_date_end__lte = self.info_date_begin, info_date_next__gte = self.info_date_begin) | q = self.__class__.query_dimentions(self).filter(info_date_end__lte = self.info_date_begin, info_date_next__gte = self.info_date_begin) new_prev_rec = q.get() if len(q) == 1 else None | def save(self, *args, **kwargs): # если не указана дата записи, то if self.period != PERIOD_INFTY and (not self.info_date_begin or not self.info_date_end): raise Exception('Attribute info_date is not set!') # нормализуем переданные дату и время self.info_date_begin = normdate(self.period,self.info_date_begin, True) sel... |
new_next_rec = self.__class__.query_dimentions(self).filter(info_date_begin__gte = self.info_date_end, info_date_prev__lte = self.info_date_end) | q = self.__class__.query_dimentions(self).filter(info_date_begin__gte = self.info_date_end, info_date_prev__lte = self.info_date_end) new_next_rec = q.get() if len(q) == 1 else None | def save(self, *args, **kwargs): # если не указана дата записи, то if self.period != PERIOD_INFTY and (not self.info_date_begin or not self.info_date_end): raise Exception('Attribute info_date is not set!') # нормализуем переданные дату и время self.info_date_begin = normdate(self.period,self.info_date_begin, True) sel... |
old_prev_rec.save(*args, **kwargs) | old_prev_rec.save() | def save(self, *args, **kwargs): # если не указана дата записи, то if self.period != PERIOD_INFTY and (not self.info_date_begin or not self.info_date_end): raise Exception('Attribute info_date is not set!') # нормализуем переданные дату и время self.info_date_begin = normdate(self.period,self.info_date_begin, True) sel... |
old_next_rec.save(*args, **kwargs) | old_next_rec.save() | def save(self, *args, **kwargs): # если не указана дата записи, то if self.period != PERIOD_INFTY and (not self.info_date_begin or not self.info_date_end): raise Exception('Attribute info_date is not set!') # нормализуем переданные дату и время self.info_date_begin = normdate(self.period,self.info_date_begin, True) sel... |
new_prev_rec._save(*args, **kwargs) | new_prev_rec._save() | def save(self, *args, **kwargs): # если не указана дата записи, то if self.period != PERIOD_INFTY and (not self.info_date_begin or not self.info_date_end): raise Exception('Attribute info_date is not set!') # нормализуем переданные дату и время self.info_date_begin = normdate(self.period,self.info_date_begin, True) sel... |
new_next_rec._save(*args, **kwargs) | new_next_rec._save() | def save(self, *args, **kwargs): # если не указана дата записи, то if self.period != PERIOD_INFTY and (not self.info_date_begin or not self.info_date_end): raise Exception('Attribute info_date is not set!') # нормализуем переданные дату и время self.info_date_begin = normdate(self.period,self.info_date_begin, True) sel... |
win.url_new_grid = base.add_window_action.get_absolute_url() | win.url_new_grid = base.edit_window_action.get_absolute_url() | def configure_list(self, win): base = self.parent # Устанавливаем источники данных grid_store = ExtJsonStore(url = base.rows_action.get_absolute_url(), auto_load=True, remote_sort=True) grid_store.total_property = 'total' grid_store.root = 'rows' win.grid.set_store(grid_store) if not base.list_readonly: # Доступны 3 с... |
win = utils.bind_object_from_request_to_form(request, base.get_row, base.edit_window) win.title = base.title win.form.url = base.save_action.get_absolute_url() return ExtUIScriptResult(base.get_edit_window(win)) class DictAddWindowAction(Action): ''' Добавление элемента справочника ''' url = '/add-window$' def run(se... | id = utils.extract_int(request, 'id') obj = base.get_row(id) create_new = True if isinstance(obj, dict) and obj.get('id') != None: create_new = False elif hasattr(obj, 'id') and getattr(obj, 'id') != None: create_new = False if create_new and base.add_window: | def run(self, request, context): base = self.parent win = utils.bind_object_from_request_to_form(request, base.get_row, base.edit_window) win.title = base.title win.form.url = base.save_action.get_absolute_url() return ExtUIScriptResult(base.get_edit_window(win)) |
self.add_window_action = DictAddWindowAction() | def __init__(self): # В отличие от обычных паков в этом экшены создаются самостоятельно, а не контроллером # Чтобы было удобно обращаться к ним по имени self.list_window_action = DictListWindowAction() self.select_window_action = DictSelectWindowAction() self.edit_window_action = DictEditWindowAction() self.add_win... | |
self.delete_action, self.add_window_action] | self.delete_action] | def __init__(self): # В отличие от обычных паков в этом экшены создаются самостоятельно, а не контроллером # Чтобы было удобно обращаться к ним по имени self.list_window_action = DictListWindowAction() self.select_window_action = DictSelectWindowAction() self.edit_window_action = DictEditWindowAction() self.add_win... |
self._put_config_value('autoExpandColumn', self.auto_expand_column) | self._put_config_value('editor', self.editor) | def render_base_config(self): super(ExtGrid, self).render_base_config() self._put_config_value('stripeRows', True) self._put_config_value('stateful', True) self._put_config_value('loadMask', self.load_mask) self._put_config_value('autoExpandColumn', self.auto_expand_column) self._put_config_value('enableDragDrop', self... |
val = int(val) | try: val = int(val) except ValueError: try: val = float(val) except ValueError: val = None | def convert_value(item): '''Берет значение item.value, и конвертирует его в соответствии с типом item'a''' val = item.value if isinstance(item, ExtNumberField): if val: val = int(val) else: val = None elif isinstance(item, ExtStringField): val = unicode(val) elif isinstance(item, ExtDateField): #TODO уточнить формат да... |
step_y = self.height / self.width_divisions * i | step_y = self.height / self.height_divisions * i | def _subcommands(self): ul_x = self.xabsolute - self.reference_point[0] * self.width bl_x = ul_x ur_x = ul_x + self.width |
step_x = self.width / self.height_divisions * i | step_x = self.width / self.width_divisions * i | def _subcommands(self): ul_x = self.xabsolute - self.reference_point[0] * self.width bl_x = ul_x ur_x = ul_x + self.width |
rec = self._plotter._hpgl.ER(self.top_right) | rec = self._plotter._hpgl.EA(self.top_right) | def draw_outline(self, pen=1): pen = self._plotter._hpgl.SP(pen) pa = self._plotter._hpgl.PA(self.bottom_left) rec = self._plotter._hpgl.ER(self.top_right) self._plotter.write([pen, pa, rec]) |
x1 = self.actual_position[0] y1 = self.actual_position[1] | x1 = self.actual_position[0].x y1 = self.actual_position[0].y | def interactive_set_plot_window(self): print "Setting plot window." print "" print "Move pen to lower left and press enter." raw_input() x1 = self.actual_position[0] y1 = self.actual_position[1] print "left: %d bottom: %d" % (x1, y1) |
x2 = self.actual_position[0] y2 = self.actual_position[1] | x2 = self.actual_position[0].x y2 = self.actual_position[0].y | def interactive_set_plot_window(self): print "Setting plot window." print "" print "Move pen to lower left and press enter." raw_input() x1 = self.actual_position[0] y1 = self.actual_position[1] print "left: %d bottom: %d" % (x1, y1) |
from chiplotle.shapes.ellipse import Ellipse | from chiplotle.shapes.donut import Donut | def points(self): e1 = Ellipse(self.width, self.height, self.segments, self.offset, self.rotation, self.pivot) e1_points = e1.points[0] e2 = Ellipse(self.width - (self.inset * 2), self.height - (self.inset * 2), self.segments, self.offset, self.rotation, self.pivot) e2_points = e2.points[0] return [CoordinateArray(e1... |
lr = polar2xy(r, a) | lr = polar2xy(r, a) + self.xyabsolute | def _get_hpgl_fan(self): ## get corners of shape... ## lower_right (viewing from pole outward) r = self.radius - self.height / 2 ## assumes the fan is centered on (r, a) a = self.angle - self.width_angle / 2 lr = polar2xy(r, a) |
ll = polar2xy(r, a) | ll = polar2xy(r, a) + self.xyabsolute | def _get_hpgl_fan(self): ## get corners of shape... ## lower_right (viewing from pole outward) r = self.radius - self.height / 2 ## assumes the fan is centered on (r, a) a = self.angle - self.width_angle / 2 lr = polar2xy(r, a) |
ur = polar2xy(r, a) | ur = polar2xy(r, a) + self.xyabsolute | def _get_hpgl_fan(self): ## get corners of shape... ## lower_right (viewing from pole outward) r = self.radius - self.height / 2 ## assumes the fan is centered on (r, a) a = self.angle - self.width_angle / 2 lr = polar2xy(r, a) |
ul = polar2xy(r, a) | ul = polar2xy(r, a) + self.xyabsolute | def _get_hpgl_fan(self): ## get corners of shape... ## lower_right (viewing from pole outward) r = self.radius - self.height / 2 ## assumes the fan is centered on (r, a) a = self.angle - self.width_angle / 2 lr = polar2xy(r, a) |
if hasattr(data, 'format'): | if isinstance(data, _HPGL): | def write(self, data): '''Public access for writing to serial port. data can be an iterator, a string or an _HPGLCommand. ''' if hasattr(data, 'format'): self._writeStringToPort(data.format) elif isinstance(data, str): self._writeStringToPort(data) elif type(data) in (list, tuple, types.GeneratorType): result = [ ] for... |
if hasattr(c, 'format'): result.append(c.format()) | if isinstance(c, _HPGL): result.append(c.format) | def write(self, data): '''Public access for writing to serial port. data can be an iterator, a string or an _HPGLCommand. ''' if hasattr(data, 'format'): self._writeStringToPort(data.format) elif isinstance(data, str): self._writeStringToPort(data) elif type(data) in (list, tuple, types.GeneratorType): result = [ ] for... |
plotter.shade_rect_relative(random.randint(10,2000), random.randint(10,2000)) | plotter.shade_rectangle_relative(random.randint(10,2000), random.randint(10,2000)) | def main(): plotter = instantiate_plotters( )[0] width = plotter.margins.soft.width height = plotter.margins.soft.height left = plotter.margins.soft.left right = plotter.margins.soft.right bottom = plotter.margins.soft.bottom top = plotter.margins.soft.top print "width: %d height: %d" % (plotter.margins.soft.width, ... |
def setOriginLowerLeft(self): | def setOriginBottomLeft(self): | def setOriginLowerLeft(self): """ Set origin to lower, left """ self.write(PI([self.margins.soft.left, self.margins.soft.bottom, self.margins.soft.right, self.margins.soft.top])) self.write(SC([0, self.margins.soft.width, 0, self.margins.soft.height]) |
self.write(PI([self.margins.soft.left, | self.write(self._hpgl.SC()) self.write(self._hpgl.IP([self.margins.soft.left, | def setOriginLowerLeft(self): """ Set origin to lower, left """ self.write(PI([self.margins.soft.left, self.margins.soft.bottom, self.margins.soft.right, self.margins.soft.top])) self.write(SC([0, self.margins.soft.width, 0, self.margins.soft.height]) |
self.write(SC([0, self.margins.soft.width, 0, self.margins.soft.height]) | self.write(self._hpgl.SC([0, self.margins.soft.width, 0, self.margins.soft.height])) def setOriginCenter(self): """ Set origin to center, center """ self.write(self._hpgl.SC()) self.write(self._hpgl.IP([self.margins.soft.left, self.margins.soft.bottom, self.margins.soft.right, self.margins.soft.top])) | def setOriginLowerLeft(self): """ Set origin to lower, left """ self.write(PI([self.margins.soft.left, self.margins.soft.bottom, self.margins.soft.right, self.margins.soft.top])) self.write(SC([0, self.margins.soft.width, 0, self.margins.soft.height]) |
return (-self.width / 2.0, self.height / 2.0) | return CoordinatePair(-self.width / 2.0, self.height / 2.0) | def upper_left(self): return (-self.width / 2.0, self.height / 2.0) |
return (self.width / 2.0, self.height / 2.0) | return CoordinatePair(self.width / 2.0, self.height / 2.0) | def upper_right(self): return (self.width / 2.0, self.height / 2.0) |
return (-self.width / 2.0, -self.height / 2.0) | return CoordinatePair(-self.width / 2.0, -self.height / 2.0) | def lower_left(self): return (-self.width / 2.0, -self.height / 2.0) |
return (self.width / 2.0, -self.height / 2.0) | return CoordinatePair(self.width / 2.0, -self.height / 2.0) | def lower_right(self): return (self.width / 2.0, -self.height / 2.0) |
result.append(PA(self.upper_left)) | result.append(PA(self.xyabsolute + self.upper_left)) | def _subcommands_corner_dots(self): result = [PU( )] result.append(PA(self.upper_left)) result += [PD( ), PU( )] result.append(PA(self.upper_right)) result += [PD( ), PU( )] result.append(PA(self.lower_left)) result += [PD( ), PU( )] result.append(PA(self.lower_right)) result += [PD( ), PU( )] return result |
result.append(PA(self.upper_right)) | result.append(PA(self.xyabsolute + self.upper_right)) | def _subcommands_corner_dots(self): result = [PU( )] result.append(PA(self.upper_left)) result += [PD( ), PU( )] result.append(PA(self.upper_right)) result += [PD( ), PU( )] result.append(PA(self.lower_left)) result += [PD( ), PU( )] result.append(PA(self.lower_right)) result += [PD( ), PU( )] return result |
result.append(PA(self.lower_left)) | result.append(PA(self.xyabsolute + self.lower_left)) | def _subcommands_corner_dots(self): result = [PU( )] result.append(PA(self.upper_left)) result += [PD( ), PU( )] result.append(PA(self.upper_right)) result += [PD( ), PU( )] result.append(PA(self.lower_left)) result += [PD( ), PU( )] result.append(PA(self.lower_right)) result += [PD( ), PU( )] return result |
result.append(PA(self.lower_right)) | result.append(PA(self.xyabsolute + self.lower_right)) | def _subcommands_corner_dots(self): result = [PU( )] result.append(PA(self.upper_left)) result += [PD( ), PU( )] result.append(PA(self.upper_right)) result += [PD( ), PU( )] result.append(PA(self.lower_left)) result += [PD( ), PU( )] result.append(PA(self.lower_right)) result += [PD( ), PU( )] return result |
plotter.write(ER(random.randint(10,5000), random.randint(10,5000))) | plotter.write(ER((random.randint(10,5000), random.randint(10,5000)))) | def main(): plotter = instantiate_plotters( )[0] width = plotter.margins.soft.width height = plotter.margins.soft.height left = plotter.margins.soft.left right = plotter.margins.soft.right bottom = plotter.margins.soft.bottom top = plotter.margins.soft.top print "width: %d height: %d" % (plotter.margins.soft.width, ... |
plotter.shade_rectangle_relative(random.randint(10,2000), random.randint(10,2000)) | plotter.filled_rectangle_relative(random.randint(10,2000), random.randint(10,2000)) | def main(): plotter = instantiate_plotters( )[0] width = plotter.margins.soft.width height = plotter.margins.soft.height left = plotter.margins.soft.left right = plotter.margins.soft.right bottom = plotter.margins.soft.bottom top = plotter.margins.soft.top print "width: %d height: %d" % (plotter.margins.soft.width, ... |
plotter.edgeRectRelative(random.randint(10,5000), random.randint(10,5000)) | plotter.edge_rect_relative(random.randint(10,5000), random.randint(10,5000)) | def main(): plotter = instantiate_plotters( )[0] width = plotter.margins.soft.width height = plotter.margins.soft.height left = plotter.margins.soft.left right = plotter.margins.soft.right bottom = plotter.margins.soft.bottom top = plotter.margins.soft.top print "width: %d height: %d" % (plotter.margins.soft.width, ... |
plotter.shadeRectRelative(random.randint(10,2000), random.randint(10,2000)) | plotter.shade_rect_relative(random.randint(10,2000), random.randint(10,2000)) | def main(): plotter = instantiate_plotters( )[0] width = plotter.margins.soft.width height = plotter.margins.soft.height left = plotter.margins.soft.left right = plotter.margins.soft.right bottom = plotter.margins.soft.bottom top = plotter.margins.soft.top print "width: %d height: %d" % (plotter.margins.soft.width, ... |
glob.glob('/dev/tty.USA*') + glob.glob('/dev/tty.KeySerial*') | glob.glob('/dev/tty.*') | def scan_serial_ports_linux( ): from chiplotle.tools.serialtools import scan_serial_ports_from_list ports = glob.glob('/dev/ttyS*') + glob.glob('/dev/ttyUSB*') +\ glob.glob('/dev/tty.USA*') + glob.glob('/dev/tty.KeySerial*') return scan_serial_ports_from_list(ports) |
plotter.edge_rect_relative(random.randint(10,5000), random.randint(10,5000)) | plotter.write(ER(random.randint(10,5000), random.randint(10,5000))) | def main(): plotter = instantiate_plotters( )[0] width = plotter.margins.soft.width height = plotter.margins.soft.height left = plotter.margins.soft.left right = plotter.margins.soft.right bottom = plotter.margins.soft.bottom top = plotter.margins.soft.top print "width: %d height: %d" % (plotter.margins.soft.width, ... |
a = rad_to_deg(self.width_angle) | a = math.degrees(self.width_angle) | def _get_hpgl_fan(self): ## get corners of shape... ## lower_right (viewing from pole outward) r = self.radius - self.height / 2 ## assumes the fan is centered on (r, a) a = self.angle - self.width_angle / 2 lr = polar2xy(r, a) |
d1 = Donut(100, 50, inset = 5) print '\Donut(100, 50)' | d1 = Donut(1000, 500, inset = 20) print '\Donut(1000, 500, inset = 20)' | def points(self): e1 = Ellipse(self.width, self.height, self.segments, self.offset, self.rotation, self.pivot) e1_points = e1.points[0] e2 = Ellipse(self.width - (self.inset * 2), self.height - (self.inset * 2), self.segments, self.offset, self.rotation, self.pivot) e2_points = e2.points[0] return [CoordinateArray(e1... |
d2 = Donut(100, 50, inset = 5, offset = (100, 100)) print '\Donut(100, 50, (100, 100))' | d2 = Donut(1000, 500, inset = 20, offset = (100, 100)) print '\Donut(1000, 500, inset = 20, offset = (100, 100)) ' | def points(self): e1 = Ellipse(self.width, self.height, self.segments, self.offset, self.rotation, self.pivot) e1_points = e1.points[0] e2 = Ellipse(self.width - (self.inset * 2), self.height - (self.inset * 2), self.segments, self.offset, self.rotation, self.pivot) e2_points = e2.points[0] return [CoordinateArray(e1... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.