text
stringlengths
0
828
""""""
raw_sccs = self._component_graph()
# Construct a dictionary mapping each vertex to the root of its scc.
vertex_to_root = self.vertex_dict()
# And keep track of which SCCs have incoming edges.
non_sources = self.vertex_set()
# Build maps from vertices to roots, and identify the sccs that *are*
# reachable from other components.
for scc in raw_sccs:
root = scc[0][1]
for item_type, w in scc:
if item_type == 'VERTEX':
vertex_to_root[w] = root
elif item_type == 'EDGE':
non_sources.add(vertex_to_root[w])
sccs = []
for raw_scc in raw_sccs:
root = raw_scc[0][1]
if root not in non_sources:
sccs.append([v for vtype, v in raw_scc if vtype == 'VERTEX'])
return [self.full_subgraph(scc) for scc in sccs]"
626,"def strongly_connected_components(self):
""""""
Return list of strongly connected components of this graph.
Returns a list of subgraphs.
Algorithm is based on that described in ""Path-based depth-first search
for strong and biconnected components"" by Harold N. Gabow,
Inf.Process.Lett. 74 (2000) 107--114.
""""""
raw_sccs = self._component_graph()
sccs = []
for raw_scc in raw_sccs:
sccs.append([v for vtype, v in raw_scc if vtype == 'VERTEX'])
return [self.full_subgraph(scc) for scc in sccs]"
627,"def save(self, *args, **kwargs):
""""""
**uid**: :code:`person:{slug}`
""""""
if not self.full_name:
self.full_name = '{0}{1}{2}'.format(
self.first_name,
'{}'.format(
' ' + self.middle_name + ' ' if self.middle_name else ' ',
),
self.last_name,
'{}'.format(' ' + self.suffix if self.suffix else '')
)
self.slug = uuslug(
self.full_name,
instance=self,
max_length=100,
separator='-',
start_no=2
)
if not self.uid:
self.uid = 'person:{}'.format(self.slug)
super(Person, self).save(*args, **kwargs)"
628,"def signature(self):
""""""
Compute the ORDER_HASH of the request.
The hashable string is composed by getting the values from:
MERCHANT
ORDER_REF
ORDER_DATE
ORDER_PNAME[]
ORDER_PCODE[]
ORDER_PINFO[]
ORDER_PRICE[]
ORDER_QTY[]
ORDER_VAT[]
ORDER_SHIPPING
PRICES_CURRENCY
DISCOUNT
DESTINATION_CITY
DESTINATION_STATE
DESTINATION_COUNTRY
PAY_METHOD
ORDER_PRICE_TYPE[]
SELECTED_INSTALLMENTS_NO
TESTORDER
in this exact order. Next, we need to concatenate their lenghts with
thier values, resulting in a string like:
8PAYUDEMO9789456123192016-10-05 11:12:279CD Player12MobilePhone6Laptop
10PROD_0489110PROD_0740910PROD_0496527Extended Warranty - 5 Years8
Dual SIM1117""Display482.371945.7545230171311220220220103RON2559