table.append_column(schema.Column(colname, coltype, nullable=nullable, *colargs))
- if not len(table.columns):
+ if not table.columns:
raise exceptions.AssertionError("Couldn't find any column information for table %s" % actual_name)
c = connection.execute("""SELECT
This is equivalent to calling ``compile()`` on any individual mapper.
"""
- if not len(mapper_registry):
+ if not mapper_registry:
return
mapper_registry.values()[0].compile()
# may be a join or other construct
self.tables = sqlutil.TableFinder(self.mapped_table)
- if not len(self.tables):
+ if not self.tables:
raise exceptions.InvalidRequestError("Could not find any Table objects in mapped table '%s'" % str(self.mapped_table))
# determine primary key columns
vis.traverse(mapper.inherit_condition)
for col in (self.primary_key_argument or self.pks_by_table[self.mapped_table]):
- if not len(col.foreign_keys):
+ if not col.foreign_keys:
result.setdefault(col, util.Set()).add(col)
else:
for fk in col.foreign_keys:
"argument." % (str(self)))
def _determine_remote_side(self):
- if not len(self.remote_side):
+ if not self.remote_side:
if self.direction is sync.MANYTOONE:
self.remote_side = util.Set(self._opposite_side)
elif self.direction is sync.ONETOMANY or self.direction is sync.MANYTOMANY:
"""
- if not len(props):
+ if not props:
return
column_props = [p for p in props if isinstance(p, ColumnProperty)]
callable_ = column_props[0]._get_strategy(strategies.DeferredColumnLoader).setup_loader(instance, props=column_props)
if children is not None:
for child in children:
self.child_to_parents[child].remove(node)
- if not len(self.child_to_parents[child]):
+ if not self.child_to_parents[child]:
yield child
def __len__(self):
set as siblings to each other as possible.
"""
- if not len(nodes):
+ if not nodes:
return None
# a list of all currently independent subtrees as a tuple of
# (root_node, set_of_all_tree_nodes, set_of_all_cycle_nodes_in_tree)