repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
cytoscape/py2cytoscape | py2cytoscape/cyrest/layout.py | layout.attribute_circle | def attribute_circle(self, EdgeAttribute=None, network=None, \
NodeAttribute=None, nodeList=None, singlePartition=None,\
spacing=None, verbose=False):
"""
Execute the Attribute Circle Layout on a network.
:param EdgeAttribute (string, optional): The name of the edge column
containing numeric values that wil... | python | def attribute_circle(self, EdgeAttribute=None, network=None, \
NodeAttribute=None, nodeList=None, singlePartition=None,\
spacing=None, verbose=False):
"""
Execute the Attribute Circle Layout on a network.
:param EdgeAttribute (string, optional): The name of the edge column
containing numeric values that wil... | [
"def",
"attribute_circle",
"(",
"self",
",",
"EdgeAttribute",
"=",
"None",
",",
"network",
"=",
"None",
",",
"NodeAttribute",
"=",
"None",
",",
"nodeList",
"=",
"None",
",",
"singlePartition",
"=",
"None",
",",
"spacing",
"=",
"None",
",",
"verbose",
"=",
... | Execute the Attribute Circle Layout on a network.
:param EdgeAttribute (string, optional): The name of the edge column
containing numeric values that will be used as weights in the layout
algorithm. Only columns containing numeric values are shown
:param network (string, optional): Specifies a network by nam... | [
"Execute",
"the",
"Attribute",
"Circle",
"Layout",
"on",
"a",
"network",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/layout.py#L29-L61 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/layout.py | layout.attributes_layout | def attributes_layout(self, EdgeAttribute=None, maxwidth=None, minrad=None, \
network=None, NodeAttribute=None,nodeList=None, radmult=None, \
spacingx=None, spacingy=None, verbose=False):
"""
Execute the Group Attributes Layout on a network
:param EdgeAttribute (string, optional): The name of the edge column
... | python | def attributes_layout(self, EdgeAttribute=None, maxwidth=None, minrad=None, \
network=None, NodeAttribute=None,nodeList=None, radmult=None, \
spacingx=None, spacingy=None, verbose=False):
"""
Execute the Group Attributes Layout on a network
:param EdgeAttribute (string, optional): The name of the edge column
... | [
"def",
"attributes_layout",
"(",
"self",
",",
"EdgeAttribute",
"=",
"None",
",",
"maxwidth",
"=",
"None",
",",
"minrad",
"=",
"None",
",",
"network",
"=",
"None",
",",
"NodeAttribute",
"=",
"None",
",",
"nodeList",
"=",
"None",
",",
"radmult",
"=",
"None... | Execute the Group Attributes Layout on a network
:param EdgeAttribute (string, optional): The name of the edge column
containing numeric values that will be used as weights in the layout
algorithm. Only columns containing numeric values are shown
:param maxwidth (string, optional): Maximum width of a row, i... | [
"Execute",
"the",
"Group",
"Attributes",
"Layout",
"on",
"a",
"network"
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/layout.py#L64-L104 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/layout.py | layout.circular | def circular(self,EdgeAttribute=None,leftEdge=None,network=None,\
NodeAttribute=None,nodeHorizontalSpacing=None,nodeList=None,\
nodeVerticalSpacing=None,rightMargin=None,singlePartition=None,topEdge=None,\
verbose=None):
"""
Execute the Circular Layout on a network
:param EdgeAttribute (string, optional): The... | python | def circular(self,EdgeAttribute=None,leftEdge=None,network=None,\
NodeAttribute=None,nodeHorizontalSpacing=None,nodeList=None,\
nodeVerticalSpacing=None,rightMargin=None,singlePartition=None,topEdge=None,\
verbose=None):
"""
Execute the Circular Layout on a network
:param EdgeAttribute (string, optional): The... | [
"def",
"circular",
"(",
"self",
",",
"EdgeAttribute",
"=",
"None",
",",
"leftEdge",
"=",
"None",
",",
"network",
"=",
"None",
",",
"NodeAttribute",
"=",
"None",
",",
"nodeHorizontalSpacing",
"=",
"None",
",",
"nodeList",
"=",
"None",
",",
"nodeVerticalSpacin... | Execute the Circular Layout on a network
:param EdgeAttribute (string, optional): The name of the edge column contai
ning numeric values that will be used as weights in the layout algor
ithm. Only columns containing numeric values are shown
:param leftEdge (string, optional): Left edge margin, in numeric val... | [
"Execute",
"the",
"Circular",
"Layout",
"on",
"a",
"network"
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/layout.py#L106-L146 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/layout.py | layout.copycat | def copycat(self,gridUnmapped=None,selectUnmapped=None,sourceColumn=None,\
sourceNetwork=None,targetColumn=None,targetNetwork=None,verbose=None):
"""
Sets the coordinates for each node in the target network to the coordinates
of a matching node in the source network.
Optional parameters such as gridUnmapped an... | python | def copycat(self,gridUnmapped=None,selectUnmapped=None,sourceColumn=None,\
sourceNetwork=None,targetColumn=None,targetNetwork=None,verbose=None):
"""
Sets the coordinates for each node in the target network to the coordinates
of a matching node in the source network.
Optional parameters such as gridUnmapped an... | [
"def",
"copycat",
"(",
"self",
",",
"gridUnmapped",
"=",
"None",
",",
"selectUnmapped",
"=",
"None",
",",
"sourceColumn",
"=",
"None",
",",
"sourceNetwork",
"=",
"None",
",",
"targetColumn",
"=",
"None",
",",
"targetNetwork",
"=",
"None",
",",
"verbose",
"... | Sets the coordinates for each node in the target network to the coordinates
of a matching node in the source network.
Optional parameters such as gridUnmapped and selectUnmapped determine
the behavior of target network nodes that could not be matched.
:param gridUnmapped (string, optional): If this is set to t... | [
"Sets",
"the",
"coordinates",
"for",
"each",
"node",
"in",
"the",
"target",
"network",
"to",
"the",
"coordinates",
"of",
"a",
"matching",
"node",
"in",
"the",
"source",
"network",
".",
"Optional",
"parameters",
"such",
"as",
"gridUnmapped",
"and",
"selectUnmap... | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/layout.py#L148-L175 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/layout.py | layout.degree_circle | def degree_circle(self,EdgeAttribute=None,network=None,NodeAttribute=None,\
nodeList=None,singlePartition=None,verbose=None):
"""
Execute the Degree Sorted Circle Layout on a network.
:param EdgeAttribute (string, optional): The name of the edge column contai
ning numeric values that will be used as weights... | python | def degree_circle(self,EdgeAttribute=None,network=None,NodeAttribute=None,\
nodeList=None,singlePartition=None,verbose=None):
"""
Execute the Degree Sorted Circle Layout on a network.
:param EdgeAttribute (string, optional): The name of the edge column contai
ning numeric values that will be used as weights... | [
"def",
"degree_circle",
"(",
"self",
",",
"EdgeAttribute",
"=",
"None",
",",
"network",
"=",
"None",
",",
"NodeAttribute",
"=",
"None",
",",
"nodeList",
"=",
"None",
",",
"singlePartition",
"=",
"None",
",",
"verbose",
"=",
"None",
")",
":",
"network",
"... | Execute the Degree Sorted Circle Layout on a network.
:param EdgeAttribute (string, optional): The name of the edge column contai
ning numeric values that will be used as weights in the layout algor
ithm. Only columns containing numeric values are shown
:param network (string, optional): Specifies a network ... | [
"Execute",
"the",
"Degree",
"Sorted",
"Circle",
"Layout",
"on",
"a",
"network",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/layout.py#L233-L262 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/layout.py | layout.force_directed | def force_directed(self,defaultEdgeWeight=None,defaultNodeMass=None,\
defaultSpringCoefficient=None,defaultSpringLength=None,EdgeAttribute=None,\
isDeterministic=None,maxWeightCutoff=None,minWeightCutoff=None,network=None,\
NodeAttribute=None,nodeList=None,numIterations=None,singlePartition=None,\
Type=None,ver... | python | def force_directed(self,defaultEdgeWeight=None,defaultNodeMass=None,\
defaultSpringCoefficient=None,defaultSpringLength=None,EdgeAttribute=None,\
isDeterministic=None,maxWeightCutoff=None,minWeightCutoff=None,network=None,\
NodeAttribute=None,nodeList=None,numIterations=None,singlePartition=None,\
Type=None,ver... | [
"def",
"force_directed",
"(",
"self",
",",
"defaultEdgeWeight",
"=",
"None",
",",
"defaultNodeMass",
"=",
"None",
",",
"defaultSpringCoefficient",
"=",
"None",
",",
"defaultSpringLength",
"=",
"None",
",",
"EdgeAttribute",
"=",
"None",
",",
"isDeterministic",
"=",... | Execute the Prefuse Force Directed Layout on a network
:param defaultEdgeWeight (string, optional): The default edge weight to con
sider, default is 0.5
:param defaultNodeMass (string, optional): Default Node Mass, in numeric va
lue
:param defaultSpringCoefficient (string, optional): Default Spring Coeffic... | [
"Execute",
"the",
"Prefuse",
"Force",
"Directed",
"Layout",
"on",
"a",
"network"
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/layout.py#L265-L321 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/layout.py | layout.genemania_force_directed | def genemania_force_directed(self,curveSteepness=None,defaultEdgeWeight=None,\
defaultSpringCoefficient=None,defaultSpringLength=None,EdgeAttribute=None,\
ignoreHiddenElements=None,isDeterministic=None,maxNodeMass=None,\
maxWeightCutoff=None,midpointEdges=None,minNodeMass=None,minWeightCutoff=None,\
network=Non... | python | def genemania_force_directed(self,curveSteepness=None,defaultEdgeWeight=None,\
defaultSpringCoefficient=None,defaultSpringLength=None,EdgeAttribute=None,\
ignoreHiddenElements=None,isDeterministic=None,maxNodeMass=None,\
maxWeightCutoff=None,midpointEdges=None,minNodeMass=None,minWeightCutoff=None,\
network=Non... | [
"def",
"genemania_force_directed",
"(",
"self",
",",
"curveSteepness",
"=",
"None",
",",
"defaultEdgeWeight",
"=",
"None",
",",
"defaultSpringCoefficient",
"=",
"None",
",",
"defaultSpringLength",
"=",
"None",
",",
"EdgeAttribute",
"=",
"None",
",",
"ignoreHiddenEle... | Execute the GeneMANIA Force Directed Layout on a network.
:param curveSteepness (string, optional):
:param defaultEdgeWeight (string, optional): The default edge weight to con
sider, default is 0.5
:param defaultSpringCoefficient (string, optional):
:param defaultSpringLength (string, optional):
:param Ed... | [
"Execute",
"the",
"GeneMANIA",
"Force",
"Directed",
"Layout",
"on",
"a",
"network",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/layout.py#L455-L512 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/layout.py | layout.get_preferred | def get_preferred(self,network=None,verbose=None):
"""
Returns the name of the current preferred layout or empty string if not
set. Default is grid.
:param network (string, optional): Gets the name of the current preferred l
ayout
"""
network=check_network(self,network,verbose=verbose)
PARAMS=set_para... | python | def get_preferred(self,network=None,verbose=None):
"""
Returns the name of the current preferred layout or empty string if not
set. Default is grid.
:param network (string, optional): Gets the name of the current preferred l
ayout
"""
network=check_network(self,network,verbose=verbose)
PARAMS=set_para... | [
"def",
"get_preferred",
"(",
"self",
",",
"network",
"=",
"None",
",",
"verbose",
"=",
"None",
")",
":",
"network",
"=",
"check_network",
"(",
"self",
",",
"network",
",",
"verbose",
"=",
"verbose",
")",
"PARAMS",
"=",
"set_param",
"(",
"[",
"'network'",... | Returns the name of the current preferred layout or empty string if not
set. Default is grid.
:param network (string, optional): Gets the name of the current preferred l
ayout | [
"Returns",
"the",
"name",
"of",
"the",
"current",
"preferred",
"layout",
"or",
"empty",
"string",
"if",
"not",
"set",
".",
"Default",
"is",
"grid",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/layout.py#L515-L526 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/layout.py | layout.grid | def grid(self,EdgeAttribute=None,network=None,NodeAttribute=None,\
nodeHorizontalSpacing=None,nodeList=None,nodeVerticalSpacing=None,verbose=None):
"""
Execute the Grid Layout on a network.
:param EdgeAttribute (string, optional): The name of the edge column contai
ning numeric values that will be used as w... | python | def grid(self,EdgeAttribute=None,network=None,NodeAttribute=None,\
nodeHorizontalSpacing=None,nodeList=None,nodeVerticalSpacing=None,verbose=None):
"""
Execute the Grid Layout on a network.
:param EdgeAttribute (string, optional): The name of the edge column contai
ning numeric values that will be used as w... | [
"def",
"grid",
"(",
"self",
",",
"EdgeAttribute",
"=",
"None",
",",
"network",
"=",
"None",
",",
"NodeAttribute",
"=",
"None",
",",
"nodeHorizontalSpacing",
"=",
"None",
",",
"nodeList",
"=",
"None",
",",
"nodeVerticalSpacing",
"=",
"None",
",",
"verbose",
... | Execute the Grid Layout on a network.
:param EdgeAttribute (string, optional): The name of the edge column contai
ning numeric values that will be used as weights in the layout algor
ithm. Only columns containing numeric values are shown
:param network (string, optional): Specifies a network by name, or by S... | [
"Execute",
"the",
"Grid",
"Layout",
"on",
"a",
"network",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/layout.py#L528-L560 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/layout.py | layout.hierarchical | def hierarchical(self,bandGap=None,componentSpacing=None,EdgeAttribute=None,\
leftEdge=None,network=None,NodeAttribute=None,nodeHorizontalSpacing=None,\
nodeList=None,nodeVerticalSpacing=None,rightMargin=None,topEdge=None,\
verbose=None):
"""
Execute the Hierarchical Layout on a network.
:param bandGap (st... | python | def hierarchical(self,bandGap=None,componentSpacing=None,EdgeAttribute=None,\
leftEdge=None,network=None,NodeAttribute=None,nodeHorizontalSpacing=None,\
nodeList=None,nodeVerticalSpacing=None,rightMargin=None,topEdge=None,\
verbose=None):
"""
Execute the Hierarchical Layout on a network.
:param bandGap (st... | [
"def",
"hierarchical",
"(",
"self",
",",
"bandGap",
"=",
"None",
",",
"componentSpacing",
"=",
"None",
",",
"EdgeAttribute",
"=",
"None",
",",
"leftEdge",
"=",
"None",
",",
"network",
"=",
"None",
",",
"NodeAttribute",
"=",
"None",
",",
"nodeHorizontalSpacin... | Execute the Hierarchical Layout on a network.
:param bandGap (string, optional): Band gap, in numeric value
:param componentSpacing (string, optional): Component spacing, in numeric v
alue
:param EdgeAttribute (string, optional): The name of the edge column contai
ning numeric values that will be used as w... | [
"Execute",
"the",
"Hierarchical",
"Layout",
"on",
"a",
"network",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/layout.py#L563-L604 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/layout.py | layout.isom | def isom(self,coolingFactor=None,EdgeAttribute=None,initialAdaptation=None,\
maxEpoch=None,minAdaptation=None,minRadius=None,network=None,NodeAttribute=None,\
nodeList=None,radius=None,radiusConstantTime=None,singlePartition=None,\
sizeFactor=None,verbose=None):
"""
Execute the Inverted Self-Organizing Map La... | python | def isom(self,coolingFactor=None,EdgeAttribute=None,initialAdaptation=None,\
maxEpoch=None,minAdaptation=None,minRadius=None,network=None,NodeAttribute=None,\
nodeList=None,radius=None,radiusConstantTime=None,singlePartition=None,\
sizeFactor=None,verbose=None):
"""
Execute the Inverted Self-Organizing Map La... | [
"def",
"isom",
"(",
"self",
",",
"coolingFactor",
"=",
"None",
",",
"EdgeAttribute",
"=",
"None",
",",
"initialAdaptation",
"=",
"None",
",",
"maxEpoch",
"=",
"None",
",",
"minAdaptation",
"=",
"None",
",",
"minRadius",
"=",
"None",
",",
"network",
"=",
... | Execute the Inverted Self-Organizing Map Layout on a network.
:param coolingFactor (string, optional): Cooling factor, in numeric value
:param EdgeAttribute (string, optional): The name of the edge column contai
ning numeric values that will be used as weights in the layout algor
ithm. Only columns containin... | [
"Execute",
"the",
"Inverted",
"Self",
"-",
"Organizing",
"Map",
"Layout",
"on",
"a",
"network",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/layout.py#L607-L651 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/layout.py | layout.kamada_kawai | def kamada_kawai(self,defaultEdgeWeight=None,EdgeAttribute=None,\
m_anticollisionSpringStrength=None,m_averageIterationsPerNode=None,\
m_disconnectedNodeDistanceSpringRestLength=None,\
m_disconnectedNodeDistanceSpringStrength=None,m_layoutPass=None,\
m_nodeDistanceRestLengthConstant=None,m_nodeDistanceStrengthC... | python | def kamada_kawai(self,defaultEdgeWeight=None,EdgeAttribute=None,\
m_anticollisionSpringStrength=None,m_averageIterationsPerNode=None,\
m_disconnectedNodeDistanceSpringRestLength=None,\
m_disconnectedNodeDistanceSpringStrength=None,m_layoutPass=None,\
m_nodeDistanceRestLengthConstant=None,m_nodeDistanceStrengthC... | [
"def",
"kamada_kawai",
"(",
"self",
",",
"defaultEdgeWeight",
"=",
"None",
",",
"EdgeAttribute",
"=",
"None",
",",
"m_anticollisionSpringStrength",
"=",
"None",
",",
"m_averageIterationsPerNode",
"=",
"None",
",",
"m_disconnectedNodeDistanceSpringRestLength",
"=",
"None... | Execute the Edge-weighted Spring Embedded Layout on a network.
:param defaultEdgeWeight (string, optional): The default edge weight to con
sider, default is 0.5
:param EdgeAttribute (string, optional): The name of the edge column contai
ning numeric values that will be used as weights in the layout algor
... | [
"Execute",
"the",
"Edge",
"-",
"weighted",
"Spring",
"Embedded",
"Layout",
"on",
"a",
"network",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/layout.py#L653-L726 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/layout.py | layout.set_preferred | def set_preferred(self,preferredLayout=None,verbose=None):
"""
Sets the preferred layout. Takes a specific name as defined in the API
Default is grid.
:param preferredLayout (string, optional): Layout to use as preferred, for
allowed names see Layout API
"""
PARAMS=set_param(['preferredLayout'],[preferr... | python | def set_preferred(self,preferredLayout=None,verbose=None):
"""
Sets the preferred layout. Takes a specific name as defined in the API
Default is grid.
:param preferredLayout (string, optional): Layout to use as preferred, for
allowed names see Layout API
"""
PARAMS=set_param(['preferredLayout'],[preferr... | [
"def",
"set_preferred",
"(",
"self",
",",
"preferredLayout",
"=",
"None",
",",
"verbose",
"=",
"None",
")",
":",
"PARAMS",
"=",
"set_param",
"(",
"[",
"'preferredLayout'",
"]",
",",
"[",
"preferredLayout",
"]",
")",
"response",
"=",
"api",
"(",
"url",
"=... | Sets the preferred layout. Takes a specific name as defined in the API
Default is grid.
:param preferredLayout (string, optional): Layout to use as preferred, for
allowed names see Layout API | [
"Sets",
"the",
"preferred",
"layout",
".",
"Takes",
"a",
"specific",
"name",
"as",
"defined",
"in",
"the",
"API",
"Default",
"is",
"grid",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/layout.py#L729-L739 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/layout.py | layout.stacked_node_layout | def stacked_node_layout(self,EdgeAttribute=None,network=None,NodeAttribute=None,\
nodeList=None,x_position=None,y_start_position=None,verbose=None):
"""
Execute the Stacked Node Layout on a network.
:param EdgeAttribute (string, optional): The name of the edge column contai
ning numeric values that will be ... | python | def stacked_node_layout(self,EdgeAttribute=None,network=None,NodeAttribute=None,\
nodeList=None,x_position=None,y_start_position=None,verbose=None):
"""
Execute the Stacked Node Layout on a network.
:param EdgeAttribute (string, optional): The name of the edge column contai
ning numeric values that will be ... | [
"def",
"stacked_node_layout",
"(",
"self",
",",
"EdgeAttribute",
"=",
"None",
",",
"network",
"=",
"None",
",",
"NodeAttribute",
"=",
"None",
",",
"nodeList",
"=",
"None",
",",
"x_position",
"=",
"None",
",",
"y_start_position",
"=",
"None",
",",
"verbose",
... | Execute the Stacked Node Layout on a network.
:param EdgeAttribute (string, optional): The name of the edge column contai
ning numeric values that will be used as weights in the layout algor
ithm. Only columns containing numeric values are shown
:param network (string, optional): Specifies a network by name,... | [
"Execute",
"the",
"Stacked",
"Node",
"Layout",
"on",
"a",
"network",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/layout.py#L742-L772 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/table.py | table.create_column | def create_column(self,columnName=None,listType=None,table=None,ntype=None,verbose=None):
"""
Appends an additional column of attribute values to the current table.
:param columnName (string, optional): The new column name
:param listType (string, optional): Can be one of integer, long,... | python | def create_column(self,columnName=None,listType=None,table=None,ntype=None,verbose=None):
"""
Appends an additional column of attribute values to the current table.
:param columnName (string, optional): The new column name
:param listType (string, optional): Can be one of integer, long,... | [
"def",
"create_column",
"(",
"self",
",",
"columnName",
"=",
"None",
",",
"listType",
"=",
"None",
",",
"table",
"=",
"None",
",",
"ntype",
"=",
"None",
",",
"verbose",
"=",
"None",
")",
":",
"PARAMS",
"=",
"set_param",
"(",
"[",
"'columnName'",
",",
... | Appends an additional column of attribute values to the current table.
:param columnName (string, optional): The new column name
:param listType (string, optional): Can be one of integer, long, double, or
string.
:param table (string, optional): Specifies a table by table name. ... | [
"Appends",
"an",
"additional",
"column",
"of",
"attribute",
"values",
"to",
"the",
"current",
"table",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L30-L46 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/table.py | table.create_table | def create_table(self,keyColumn=None,keyColumnType=None,title=None,verbose=None):
"""
Adds a new table to the network.
:param keyColumn (string, optional): Specifies the name of a column in the
table
:param keyColumnType (string, optional): The syntactical type of the value
... | python | def create_table(self,keyColumn=None,keyColumnType=None,title=None,verbose=None):
"""
Adds a new table to the network.
:param keyColumn (string, optional): Specifies the name of a column in the
table
:param keyColumnType (string, optional): The syntactical type of the value
... | [
"def",
"create_table",
"(",
"self",
",",
"keyColumn",
"=",
"None",
",",
"keyColumnType",
"=",
"None",
",",
"title",
"=",
"None",
",",
"verbose",
"=",
"None",
")",
":",
"PARAMS",
"=",
"set_param",
"(",
"[",
"'keyColumn'",
",",
"'keyColumnType'",
",",
"'ti... | Adds a new table to the network.
:param keyColumn (string, optional): Specifies the name of a column in the
table
:param keyColumnType (string, optional): The syntactical type of the value
used in the key
:param title (string, optional): The name of the table used in the... | [
"Adds",
"a",
"new",
"table",
"to",
"the",
"network",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L49-L65 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/table.py | table.delete_column | def delete_column(self,column=None,table=None,verbose=None):
"""
Remove a column from a table, specified by its name. Returns the name of
the column removed.
:param column (string, optional): Specifies the name of a column in the tab
le
:param table (string, optional... | python | def delete_column(self,column=None,table=None,verbose=None):
"""
Remove a column from a table, specified by its name. Returns the name of
the column removed.
:param column (string, optional): Specifies the name of a column in the tab
le
:param table (string, optional... | [
"def",
"delete_column",
"(",
"self",
",",
"column",
"=",
"None",
",",
"table",
"=",
"None",
",",
"verbose",
"=",
"None",
")",
":",
"PARAMS",
"=",
"set_param",
"(",
"[",
"'column'",
",",
"'table'",
"]",
",",
"[",
"column",
",",
"table",
"]",
")",
"r... | Remove a column from a table, specified by its name. Returns the name of
the column removed.
:param column (string, optional): Specifies the name of a column in the tab
le
:param table (string, optional): Specifies a table by table name. If the pr
efix SUID: is used, the... | [
"Remove",
"a",
"column",
"from",
"a",
"table",
"specified",
"by",
"its",
"name",
".",
"Returns",
"the",
"name",
"of",
"the",
"column",
"removed",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L67-L80 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/table.py | table.delete_row | def delete_row(self,keyValue=None,table=None,verbose=None):
"""
Deletes a row from a table.Requires the table name or SUID and the row key.
:param keyValue (string): Specifies the primary key of a value in the row o
f a table
:param table (string, optional): Specifies a tabl... | python | def delete_row(self,keyValue=None,table=None,verbose=None):
"""
Deletes a row from a table.Requires the table name or SUID and the row key.
:param keyValue (string): Specifies the primary key of a value in the row o
f a table
:param table (string, optional): Specifies a tabl... | [
"def",
"delete_row",
"(",
"self",
",",
"keyValue",
"=",
"None",
",",
"table",
"=",
"None",
",",
"verbose",
"=",
"None",
")",
":",
"PARAMS",
"=",
"set_param",
"(",
"[",
"'keyValue'",
",",
"'table'",
"]",
",",
"[",
"keyValue",
",",
"table",
"]",
")",
... | Deletes a row from a table.Requires the table name or SUID and the row key.
:param keyValue (string): Specifies the primary key of a value in the row o
f a table
:param table (string, optional): Specifies a table by table name. If the pr
efix SUID: is used, the table correspondi... | [
"Deletes",
"a",
"row",
"from",
"a",
"table",
".",
"Requires",
"the",
"table",
"name",
"or",
"SUID",
"and",
"the",
"row",
"key",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L83-L95 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/table.py | table.get_value | def get_value(self,column=None,keyValue=None,table=None,verbose=None):
"""
Returns the value from a cell as specified by row and column ids.
:param column (string, optional): Specifies the name of a column in the tab
le
:param keyValue (string, optional): Specifies a row of ... | python | def get_value(self,column=None,keyValue=None,table=None,verbose=None):
"""
Returns the value from a cell as specified by row and column ids.
:param column (string, optional): Specifies the name of a column in the tab
le
:param keyValue (string, optional): Specifies a row of ... | [
"def",
"get_value",
"(",
"self",
",",
"column",
"=",
"None",
",",
"keyValue",
"=",
"None",
",",
"table",
"=",
"None",
",",
"verbose",
"=",
"None",
")",
":",
"PARAMS",
"=",
"set_param",
"(",
"[",
"'column'",
",",
"'keyValue'",
",",
"'table'",
"]",
","... | Returns the value from a cell as specified by row and column ids.
:param column (string, optional): Specifies the name of a column in the tab
le
:param keyValue (string, optional): Specifies a row of a table using the pr
imary key as the indentifier
:param table (string,... | [
"Returns",
"the",
"value",
"from",
"a",
"cell",
"as",
"specified",
"by",
"row",
"and",
"column",
"ids",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L160-L176 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/table.py | table.import_url | def import_url(self,caseSensitiveNetworkCollectionKeys=None,\
caseSensitiveNetworkKeys=None,dataTypeList=None,\
DataTypeTargetForNetworkCollection=None,DataTypeTargetForNetworkList=None,\
delimiters=None,delimitersForDataList=None,firstRowAsColumnNames=None,\
KeyColumnForMapping=None,Key... | python | def import_url(self,caseSensitiveNetworkCollectionKeys=None,\
caseSensitiveNetworkKeys=None,dataTypeList=None,\
DataTypeTargetForNetworkCollection=None,DataTypeTargetForNetworkList=None,\
delimiters=None,delimitersForDataList=None,firstRowAsColumnNames=None,\
KeyColumnForMapping=None,Key... | [
"def",
"import_url",
"(",
"self",
",",
"caseSensitiveNetworkCollectionKeys",
"=",
"None",
",",
"caseSensitiveNetworkKeys",
"=",
"None",
",",
"dataTypeList",
"=",
"None",
",",
"DataTypeTargetForNetworkCollection",
"=",
"None",
",",
"DataTypeTargetForNetworkList",
"=",
"N... | Similar to Import Table this uses a long list of input parameters to
specify the attributes of the table, the mapping keys, and the destination
table for the input.
:param caseSensitiveNetworkCollectionKeys (string, optional): Determines wh
ether capitalization is considered in matc... | [
"Similar",
"to",
"Import",
"Table",
"this",
"uses",
"a",
"long",
"list",
"of",
"input",
"parameters",
"to",
"specify",
"the",
"attributes",
"of",
"the",
"table",
"the",
"mapping",
"keys",
"and",
"the",
"destination",
"table",
"for",
"the",
"input",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L246-L311 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/table.py | table.list_tables | def list_tables(self,includePrivate=None,namespace=None,atype=None,verbose=None):
"""
Returns a list of the table SUIDs associated with the passed network parameter.
:param includePrivate (string, optional): A boolean value determining wheth
er to return private as well as public ta... | python | def list_tables(self,includePrivate=None,namespace=None,atype=None,verbose=None):
"""
Returns a list of the table SUIDs associated with the passed network parameter.
:param includePrivate (string, optional): A boolean value determining wheth
er to return private as well as public ta... | [
"def",
"list_tables",
"(",
"self",
",",
"includePrivate",
"=",
"None",
",",
"namespace",
"=",
"None",
",",
"atype",
"=",
"None",
",",
"verbose",
"=",
"None",
")",
":",
"PARAMS",
"=",
"set_param",
"(",
"[",
"'includePrivate'",
",",
"'namespace'",
",",
"'t... | Returns a list of the table SUIDs associated with the passed network parameter.
:param includePrivate (string, optional): A boolean value determining wheth
er to return private as well as public tables
:param namespace (string, optional): An optional argument to contrain outpu
t... | [
"Returns",
"a",
"list",
"of",
"the",
"table",
"SUIDs",
"associated",
"with",
"the",
"passed",
"network",
"parameter",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L314-L329 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/table.py | table.list_columns | def list_columns(self,table=None,verbose=None):
"""
Returns the list of columns in the table.
:param table (string, optional): Specifies a table by table name. If the pr
efix SUID: is used, the table corresponding the SUID will be returne
d.
:returns: list of col... | python | def list_columns(self,table=None,verbose=None):
"""
Returns the list of columns in the table.
:param table (string, optional): Specifies a table by table name. If the pr
efix SUID: is used, the table corresponding the SUID will be returne
d.
:returns: list of col... | [
"def",
"list_columns",
"(",
"self",
",",
"table",
"=",
"None",
",",
"verbose",
"=",
"None",
")",
":",
"PARAMS",
"=",
"set_param",
"(",
"[",
"'table'",
"]",
",",
"[",
"table",
"]",
")",
"response",
"=",
"api",
"(",
"url",
"=",
"self",
".",
"__url",
... | Returns the list of columns in the table.
:param table (string, optional): Specifies a table by table name. If the pr
efix SUID: is used, the table corresponding the SUID will be returne
d.
:returns: list of columns in the table. | [
"Returns",
"the",
"list",
"of",
"columns",
"in",
"the",
"table",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L332-L343 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/table.py | table.list_rows | def list_rows(self,rowList=None,table=None,verbose=None):
"""
Returns the list of primary keys for each of the rows in the specified table.
:param rowList (string, optional): Specifies a list of rows. The pattern CO
LUMN:VALUE sets this parameter to any rows that contain the specifi... | python | def list_rows(self,rowList=None,table=None,verbose=None):
"""
Returns the list of primary keys for each of the rows in the specified table.
:param rowList (string, optional): Specifies a list of rows. The pattern CO
LUMN:VALUE sets this parameter to any rows that contain the specifi... | [
"def",
"list_rows",
"(",
"self",
",",
"rowList",
"=",
"None",
",",
"table",
"=",
"None",
",",
"verbose",
"=",
"None",
")",
":",
"PARAMS",
"=",
"set_param",
"(",
"[",
"'rowList'",
",",
"'table'",
"]",
",",
"[",
"rowList",
",",
"table",
"]",
")",
"re... | Returns the list of primary keys for each of the rows in the specified table.
:param rowList (string, optional): Specifies a list of rows. The pattern CO
LUMN:VALUE sets this parameter to any rows that contain the specifie
d column value; if the COLUMN prefix is not used, the NAME colum... | [
"Returns",
"the",
"list",
"of",
"primary",
"keys",
"for",
"each",
"of",
"the",
"rows",
"in",
"the",
"specified",
"table",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L346-L362 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/table.py | table.merge | def merge(self,DataTypeTargetForNetworkCollection=None,\
dataTypeTargetForNetworkList=None,mergeType=None,SourceMergeColumns=None,\
SourceMergeKey=None,SourceTable=None,TargetKeyNetworkCollection=None,\
TargetMergeKey=None,TargetNetworkCollection=None,TargetNetworkList=None,\
UnassignedT... | python | def merge(self,DataTypeTargetForNetworkCollection=None,\
dataTypeTargetForNetworkList=None,mergeType=None,SourceMergeColumns=None,\
SourceMergeKey=None,SourceTable=None,TargetKeyNetworkCollection=None,\
TargetMergeKey=None,TargetNetworkCollection=None,TargetNetworkList=None,\
UnassignedT... | [
"def",
"merge",
"(",
"self",
",",
"DataTypeTargetForNetworkCollection",
"=",
"None",
",",
"dataTypeTargetForNetworkList",
"=",
"None",
",",
"mergeType",
"=",
"None",
",",
"SourceMergeColumns",
"=",
"None",
",",
"SourceMergeKey",
"=",
"None",
",",
"SourceTable",
"=... | Merge tables together joining around a designated key column. Depending
on the arguments, might merge into multiple local tables.
:param DataTypeTargetForNetworkCollection (string, optional): The collectio
n of networks where the merged table will reside
:param dataTypeTargetForNetw... | [
"Merge",
"tables",
"together",
"joining",
"around",
"a",
"designated",
"key",
"column",
".",
"Depending",
"on",
"the",
"arguments",
"might",
"merge",
"into",
"multiple",
"local",
"tables",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L365-L400 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/table.py | table.rename_column | def rename_column(self,columnName=None,newColumnName=None,table=None,verbose=None):
"""
Changes the name of a specified column in the table.
:param columnName (string): The name of the column that will be renamed.
:param newColumnName (string): The new name of the column.
:param... | python | def rename_column(self,columnName=None,newColumnName=None,table=None,verbose=None):
"""
Changes the name of a specified column in the table.
:param columnName (string): The name of the column that will be renamed.
:param newColumnName (string): The new name of the column.
:param... | [
"def",
"rename_column",
"(",
"self",
",",
"columnName",
"=",
"None",
",",
"newColumnName",
"=",
"None",
",",
"table",
"=",
"None",
",",
"verbose",
"=",
"None",
")",
":",
"PARAMS",
"=",
"set_param",
"(",
"[",
"'columnName'",
",",
"'newColumnName'",
",",
"... | Changes the name of a specified column in the table.
:param columnName (string): The name of the column that will be renamed.
:param newColumnName (string): The new name of the column.
:param table (string, optional): Specifies a table by table name. If the pr
efix SUID: is used, th... | [
"Changes",
"the",
"name",
"of",
"a",
"specified",
"column",
"in",
"the",
"table",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L404-L416 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/table.py | table.set_title | def set_title(self,table=None,title=None,verbose=None):
"""
Changes the visible identifier of a single table.
:param table (string, optional): Specifies a table by table name. If the pr
efix SUID: is used, the table corresponding the SUID will be returne
d.
:para... | python | def set_title(self,table=None,title=None,verbose=None):
"""
Changes the visible identifier of a single table.
:param table (string, optional): Specifies a table by table name. If the pr
efix SUID: is used, the table corresponding the SUID will be returne
d.
:para... | [
"def",
"set_title",
"(",
"self",
",",
"table",
"=",
"None",
",",
"title",
"=",
"None",
",",
"verbose",
"=",
"None",
")",
":",
"PARAMS",
"=",
"set_param",
"(",
"[",
"'table'",
",",
"'title'",
"]",
",",
"[",
"table",
",",
"title",
"]",
")",
"response... | Changes the visible identifier of a single table.
:param table (string, optional): Specifies a table by table name. If the pr
efix SUID: is used, the table corresponding the SUID will be returne
d.
:param title (string, optional): The name of the table used in the current
... | [
"Changes",
"the",
"visible",
"identifier",
"of",
"a",
"single",
"table",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L420-L432 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/table.py | table.set_values | def set_values(self,columnName=None,rowList=None,table=None,value=None,verbose=None):
"""
Set all the values in the specified list of rows with a single value.
:param columnName (string, optional): Specifies the name of a column in the
table
:param rowList (string, optio... | python | def set_values(self,columnName=None,rowList=None,table=None,value=None,verbose=None):
"""
Set all the values in the specified list of rows with a single value.
:param columnName (string, optional): Specifies the name of a column in the
table
:param rowList (string, optio... | [
"def",
"set_values",
"(",
"self",
",",
"columnName",
"=",
"None",
",",
"rowList",
"=",
"None",
",",
"table",
"=",
"None",
",",
"value",
"=",
"None",
",",
"verbose",
"=",
"None",
")",
":",
"PARAMS",
"=",
"set_param",
"(",
"[",
"'columnName'",
",",
"'r... | Set all the values in the specified list of rows with a single value.
:param columnName (string, optional): Specifies the name of a column in the
table
:param rowList (string, optional): Specifies a list of rows. The pattern CO
LUMN:VALUE sets this parameter to any rows that... | [
"Set",
"all",
"the",
"values",
"in",
"the",
"specified",
"list",
"of",
"rows",
"with",
"a",
"single",
"value",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L436-L457 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/table.py | table.getTable | def getTable(self, columns=None, table=None, network = "current", namespace='default', verbose=VERBOSE):
"""
Gets tables from cytoscape.
:param table: table to retrieve eg. node
:param columns: columns to retrieve in list format
:param network (string, optional): Specifies a net... | python | def getTable(self, columns=None, table=None, network = "current", namespace='default', verbose=VERBOSE):
"""
Gets tables from cytoscape.
:param table: table to retrieve eg. node
:param columns: columns to retrieve in list format
:param network (string, optional): Specifies a net... | [
"def",
"getTable",
"(",
"self",
",",
"columns",
"=",
"None",
",",
"table",
"=",
"None",
",",
"network",
"=",
"\"current\"",
",",
"namespace",
"=",
"'default'",
",",
"verbose",
"=",
"VERBOSE",
")",
":",
"u",
"=",
"self",
".",
"__url",
"host",
"=",
"u"... | Gets tables from cytoscape.
:param table: table to retrieve eg. node
:param columns: columns to retrieve in list format
:param network (string, optional): Specifies a network by name, or by
SUID if the prefix SUID: is used. The keyword CURRENT, or a blank
value can also ... | [
"Gets",
"tables",
"from",
"cytoscape",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L459-L515 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/table.py | table.loadTableData | def loadTableData(self, df, df_key='index',table="node", table_key_column = "name", \
network="current",namespace="default",verbose=False):
"""
Loads tables into cytoscape.
:param df: a pandas dataframe to load
:param df_key: key column in df, default="index"
:param tabl... | python | def loadTableData(self, df, df_key='index',table="node", table_key_column = "name", \
network="current",namespace="default",verbose=False):
"""
Loads tables into cytoscape.
:param df: a pandas dataframe to load
:param df_key: key column in df, default="index"
:param tabl... | [
"def",
"loadTableData",
"(",
"self",
",",
"df",
",",
"df_key",
"=",
"'index'",
",",
"table",
"=",
"\"node\"",
",",
"table_key_column",
"=",
"\"name\"",
",",
"network",
"=",
"\"current\"",
",",
"namespace",
"=",
"\"default\"",
",",
"verbose",
"=",
"False",
... | Loads tables into cytoscape.
:param df: a pandas dataframe to load
:param df_key: key column in df, default="index"
:param table: target table, default="node"
:param table_key_column: table key column, default="name"
:param network (string, optional): Specifies a network by name... | [
"Loads",
"tables",
"into",
"cytoscape",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L517-L588 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/table.py | table.getTableCount | def getTableCount(verbose=None):
"""
Returns the number of global tables.
:param verbose: print more
:returns: 200: successful operation
"""
response=api(url=self.url+'tables/count', method="GET", verbose=verbose, parse_params=False)
return response | python | def getTableCount(verbose=None):
"""
Returns the number of global tables.
:param verbose: print more
:returns: 200: successful operation
"""
response=api(url=self.url+'tables/count', method="GET", verbose=verbose, parse_params=False)
return response | [
"def",
"getTableCount",
"(",
"verbose",
"=",
"None",
")",
":",
"response",
"=",
"api",
"(",
"url",
"=",
"self",
".",
"url",
"+",
"'tables/count'",
",",
"method",
"=",
"\"GET\"",
",",
"verbose",
"=",
"verbose",
",",
"parse_params",
"=",
"False",
")",
"r... | Returns the number of global tables.
:param verbose: print more
:returns: 200: successful operation | [
"Returns",
"the",
"number",
"of",
"global",
"tables",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/table.py#L590-L600 | train |
cytoscape/py2cytoscape | py2cytoscape/data/base_view.py | BaseView.set_value | def set_value(self, visual_property, value):
"""Set a single Visual Property Value
:param visual_property: Visual Property ID
:param value: New value for the VP
:return: None
"""
if visual_property is None or value is None:
raise ValueError('Both VP and value... | python | def set_value(self, visual_property, value):
"""Set a single Visual Property Value
:param visual_property: Visual Property ID
:param value: New value for the VP
:return: None
"""
if visual_property is None or value is None:
raise ValueError('Both VP and value... | [
"def",
"set_value",
"(",
"self",
",",
"visual_property",
",",
"value",
")",
":",
"if",
"visual_property",
"is",
"None",
"or",
"value",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'Both VP and value are required.'",
")",
"new_value",
"=",
"[",
"{",
"'visual... | Set a single Visual Property Value
:param visual_property: Visual Property ID
:param value: New value for the VP
:return: None | [
"Set",
"a",
"single",
"Visual",
"Property",
"Value"
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/data/base_view.py#L41-L57 | train |
cytoscape/py2cytoscape | py2cytoscape/data/base_view.py | BaseView.set_values | def set_values(self, values):
"""
Set multiple Visual properties at once.
:param values:
:return:
"""
if values is None:
raise ValueError('Values are required.')
new_values = []
for vp in values.keys():
new_val = {
... | python | def set_values(self, values):
"""
Set multiple Visual properties at once.
:param values:
:return:
"""
if values is None:
raise ValueError('Values are required.')
new_values = []
for vp in values.keys():
new_val = {
... | [
"def",
"set_values",
"(",
"self",
",",
"values",
")",
":",
"if",
"values",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'Values are required.'",
")",
"new_values",
"=",
"[",
"]",
"for",
"vp",
"in",
"values",
".",
"keys",
"(",
")",
":",
"new_val",
"=... | Set multiple Visual properties at once.
:param values:
:return: | [
"Set",
"multiple",
"Visual",
"properties",
"at",
"once",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/data/base_view.py#L59-L77 | train |
cytoscape/py2cytoscape | py2cytoscape/data/base_view.py | BaseView.get_value | def get_value(self, visual_property):
"""Get a value for the Visual Property
:param visual_property:
:return:
"""
res = requests.get(self.url + '/' + visual_property)
return res.json()['value'] | python | def get_value(self, visual_property):
"""Get a value for the Visual Property
:param visual_property:
:return:
"""
res = requests.get(self.url + '/' + visual_property)
return res.json()['value'] | [
"def",
"get_value",
"(",
"self",
",",
"visual_property",
")",
":",
"res",
"=",
"requests",
".",
"get",
"(",
"self",
".",
"url",
"+",
"'/'",
"+",
"visual_property",
")",
"return",
"res",
".",
"json",
"(",
")",
"[",
"'value'",
"]"
] | Get a value for the Visual Property
:param visual_property:
:return: | [
"Get",
"a",
"value",
"for",
"the",
"Visual",
"Property"
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/data/base_view.py#L79-L86 | train |
cytoscape/py2cytoscape | py2cytoscape/data/base_view.py | BaseView.get_values | def get_values(self):
"""Get all visual property values for the object
:return: dictionary of values (VP ID - value)
"""
results = requests.get(self.url).json()
values = {}
for entry in results:
values[entry['visualProperty']] = entry['value']
return... | python | def get_values(self):
"""Get all visual property values for the object
:return: dictionary of values (VP ID - value)
"""
results = requests.get(self.url).json()
values = {}
for entry in results:
values[entry['visualProperty']] = entry['value']
return... | [
"def",
"get_values",
"(",
"self",
")",
":",
"results",
"=",
"requests",
".",
"get",
"(",
"self",
".",
"url",
")",
".",
"json",
"(",
")",
"values",
"=",
"{",
"}",
"for",
"entry",
"in",
"results",
":",
"values",
"[",
"entry",
"[",
"'visualProperty'",
... | Get all visual property values for the object
:return: dictionary of values (VP ID - value) | [
"Get",
"all",
"visual",
"property",
"values",
"for",
"the",
"object"
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/data/base_view.py#L88-L98 | train |
cytoscape/py2cytoscape | py2cytoscape/data/network_view.py | CyNetworkView.update_network_view | def update_network_view(self, visual_property=None, value=None):
"""
Updates single value for Network-related VP.
:param visual_property:
:param value:
:return:
"""
new_value = [
{
"visualProperty": visual_property,
"v... | python | def update_network_view(self, visual_property=None, value=None):
"""
Updates single value for Network-related VP.
:param visual_property:
:param value:
:return:
"""
new_value = [
{
"visualProperty": visual_property,
"v... | [
"def",
"update_network_view",
"(",
"self",
",",
"visual_property",
"=",
"None",
",",
"value",
"=",
"None",
")",
":",
"new_value",
"=",
"[",
"{",
"\"visualProperty\"",
":",
"visual_property",
",",
"\"value\"",
":",
"value",
"}",
"]",
"res",
"=",
"requests",
... | Updates single value for Network-related VP.
:param visual_property:
:param value:
:return: | [
"Updates",
"single",
"value",
"for",
"Network",
"-",
"related",
"VP",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/data/network_view.py#L153-L171 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/view.py | view.export | def export(self, Height=None, options=None, outputFile=None, Resolution=None,\
Units=None, Width=None, Zoom=None, view="current", verbose=False):
"""
Exports the current view to a graphics file and returns the path to the
saved file. PNG and JPEG formats have options for scaling, whi... | python | def export(self, Height=None, options=None, outputFile=None, Resolution=None,\
Units=None, Width=None, Zoom=None, view="current", verbose=False):
"""
Exports the current view to a graphics file and returns the path to the
saved file. PNG and JPEG formats have options for scaling, whi... | [
"def",
"export",
"(",
"self",
",",
"Height",
"=",
"None",
",",
"options",
"=",
"None",
",",
"outputFile",
"=",
"None",
",",
"Resolution",
"=",
"None",
",",
"Units",
"=",
"None",
",",
"Width",
"=",
"None",
",",
"Zoom",
"=",
"None",
",",
"view",
"=",... | Exports the current view to a graphics file and returns the path to the
saved file. PNG and JPEG formats have options for scaling, while other
formats only have the option 'exportTextAsFont'. For the PDF format,
exporting text as font does not work for two-byte characters such as
... | [
"Exports",
"the",
"current",
"view",
"to",
"a",
"graphics",
"file",
"and",
"returns",
"the",
"path",
"to",
"the",
"saved",
"file",
".",
"PNG",
"and",
"JPEG",
"formats",
"have",
"options",
"for",
"scaling",
"while",
"other",
"formats",
"only",
"have",
"the"... | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/view.py#L46-L85 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/view.py | view.fit_content | def fit_content(self, verbose=False):
"""
Zooms out the current view in order to display all of its elements.
:param verbose: print more
"""
PARAMS={}
response=api(url=self.__url+"/fit content", PARAMS=PARAMS, method="POST", verbose=verbose)
return response | python | def fit_content(self, verbose=False):
"""
Zooms out the current view in order to display all of its elements.
:param verbose: print more
"""
PARAMS={}
response=api(url=self.__url+"/fit content", PARAMS=PARAMS, method="POST", verbose=verbose)
return response | [
"def",
"fit_content",
"(",
"self",
",",
"verbose",
"=",
"False",
")",
":",
"PARAMS",
"=",
"{",
"}",
"response",
"=",
"api",
"(",
"url",
"=",
"self",
".",
"__url",
"+",
"\"/fit content\"",
",",
"PARAMS",
"=",
"PARAMS",
",",
"method",
"=",
"\"POST\"",
... | Zooms out the current view in order to display all of its elements.
:param verbose: print more | [
"Zooms",
"out",
"the",
"current",
"view",
"in",
"order",
"to",
"display",
"all",
"of",
"its",
"elements",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/view.py#L87-L96 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/view.py | view.get_current | def get_current(self, layout=None, network=None, verbose=False):
"""
Returns the current view or null if there is none.
:param verbose: print more
:returns: current view or null if there is none
"""
PARAMS={}
response=api(url=self.__url+"/get_current", PARAMS=PA... | python | def get_current(self, layout=None, network=None, verbose=False):
"""
Returns the current view or null if there is none.
:param verbose: print more
:returns: current view or null if there is none
"""
PARAMS={}
response=api(url=self.__url+"/get_current", PARAMS=PA... | [
"def",
"get_current",
"(",
"self",
",",
"layout",
"=",
"None",
",",
"network",
"=",
"None",
",",
"verbose",
"=",
"False",
")",
":",
"PARAMS",
"=",
"{",
"}",
"response",
"=",
"api",
"(",
"url",
"=",
"self",
".",
"__url",
"+",
"\"/get_current\"",
",",
... | Returns the current view or null if there is none.
:param verbose: print more
:returns: current view or null if there is none | [
"Returns",
"the",
"current",
"view",
"or",
"null",
"if",
"there",
"is",
"none",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/view.py#L110-L120 | train |
cytoscape/py2cytoscape | py2cytoscape/data/style.py | Style.update_defaults | def update_defaults(self, prop_value_dict):
"""
Updates the value of one or more visual properties.
:param prop_value_dict: Dictionary containing, for each visual property,
the new value to use.
"""
body = []
for key in prop_value_dict:
entry = {... | python | def update_defaults(self, prop_value_dict):
"""
Updates the value of one or more visual properties.
:param prop_value_dict: Dictionary containing, for each visual property,
the new value to use.
"""
body = []
for key in prop_value_dict:
entry = {... | [
"def",
"update_defaults",
"(",
"self",
",",
"prop_value_dict",
")",
":",
"body",
"=",
"[",
"]",
"for",
"key",
"in",
"prop_value_dict",
":",
"entry",
"=",
"{",
"'visualProperty'",
":",
"key",
",",
"'value'",
":",
"prop_value_dict",
"[",
"key",
"]",
"}",
"... | Updates the value of one or more visual properties.
:param prop_value_dict: Dictionary containing, for each visual property,
the new value to use. | [
"Updates",
"the",
"value",
"of",
"one",
"or",
"more",
"visual",
"properties",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/data/style.py#L112-L129 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/cyrest.py | cyclient.status | def status(self, verbose=False):
"""
Checks the status of your CyREST server.
"""
try:
response=api(url=self.__url, method="GET", verbose=verbose)
except Exception as e:
print('Could not get status from CyREST:\n\n' + str(e))
else:
prin... | python | def status(self, verbose=False):
"""
Checks the status of your CyREST server.
"""
try:
response=api(url=self.__url, method="GET", verbose=verbose)
except Exception as e:
print('Could not get status from CyREST:\n\n' + str(e))
else:
prin... | [
"def",
"status",
"(",
"self",
",",
"verbose",
"=",
"False",
")",
":",
"try",
":",
"response",
"=",
"api",
"(",
"url",
"=",
"self",
".",
"__url",
",",
"method",
"=",
"\"GET\"",
",",
"verbose",
"=",
"verbose",
")",
"except",
"Exception",
"as",
"e",
"... | Checks the status of your CyREST server. | [
"Checks",
"the",
"status",
"of",
"your",
"CyREST",
"server",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/cyrest.py#L67-L76 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/cyrest.py | cyclient.version | def version(self, verbose=False):
"""
Checks Cytoscape version
"""
response=api(url=self.__url+"version",method="H", verbose=verbose)
response=json.loads(response)
for k in response.keys():
print(k, response[k]) | python | def version(self, verbose=False):
"""
Checks Cytoscape version
"""
response=api(url=self.__url+"version",method="H", verbose=verbose)
response=json.loads(response)
for k in response.keys():
print(k, response[k]) | [
"def",
"version",
"(",
"self",
",",
"verbose",
"=",
"False",
")",
":",
"response",
"=",
"api",
"(",
"url",
"=",
"self",
".",
"__url",
"+",
"\"version\"",
",",
"method",
"=",
"\"H\"",
",",
"verbose",
"=",
"verbose",
")",
"response",
"=",
"json",
".",
... | Checks Cytoscape version | [
"Checks",
"Cytoscape",
"version"
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/cyrest.py#L84-L91 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/idmapper.py | idmapper.map_column | def map_column(self, only_use_one=None, source_column=None, species=None, target_selection= None, verbose=False):
"""
Uses the BridgeDB service to look up analogous identifiers from a wide
selection of other databases
:param only_use_one (string, optional): When multiple identifiers can... | python | def map_column(self, only_use_one=None, source_column=None, species=None, target_selection= None, verbose=False):
"""
Uses the BridgeDB service to look up analogous identifiers from a wide
selection of other databases
:param only_use_one (string, optional): When multiple identifiers can... | [
"def",
"map_column",
"(",
"self",
",",
"only_use_one",
"=",
"None",
",",
"source_column",
"=",
"None",
",",
"species",
"=",
"None",
",",
"target_selection",
"=",
"None",
",",
"verbose",
"=",
"False",
")",
":",
"PARAMS",
"=",
"set_param",
"(",
"[",
"\"onl... | Uses the BridgeDB service to look up analogous identifiers from a wide
selection of other databases
:param only_use_one (string, optional): When multiple identifiers can be
mapped from a single term, this forces a singular result
:param source_column (string): Specifies the column n... | [
"Uses",
"the",
"BridgeDB",
"service",
"to",
"look",
"up",
"analogous",
"identifiers",
"from",
"a",
"wide",
"selection",
"of",
"other",
"databases"
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/idmapper.py#L13-L38 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/command.py | command.echo | def echo(self, variableName, verbose=False):
"""
The echo command will display the value of the variable specified by the
variableName argument, or all variables if variableName is not provided.
:param variableName: The name of the variable or '*' to display the value of all variables.
... | python | def echo(self, variableName, verbose=False):
"""
The echo command will display the value of the variable specified by the
variableName argument, or all variables if variableName is not provided.
:param variableName: The name of the variable or '*' to display the value of all variables.
... | [
"def",
"echo",
"(",
"self",
",",
"variableName",
",",
"verbose",
"=",
"False",
")",
":",
"PARAMS",
"=",
"{",
"\"variableName\"",
":",
"variableName",
"}",
"response",
"=",
"api",
"(",
"url",
"=",
"self",
".",
"__url",
"+",
"\"/echo\"",
",",
"PARAMS",
"... | The echo command will display the value of the variable specified by the
variableName argument, or all variables if variableName is not provided.
:param variableName: The name of the variable or '*' to display the value of all variables.
:param verbose: print more | [
"The",
"echo",
"command",
"will",
"display",
"the",
"value",
"of",
"the",
"variable",
"specified",
"by",
"the",
"variableName",
"argument",
"or",
"all",
"variables",
"if",
"variableName",
"is",
"not",
"provided",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/command.py#L13-L23 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/command.py | command.open_dialog | def open_dialog(self, verbose=False):
"""
The command line dialog provides a field to enter commands and view
results. It also provides the help command to display namespaces,
commands, and arguments.
:param verbose: print more
"""
response=api(url=self.__url+"/o... | python | def open_dialog(self, verbose=False):
"""
The command line dialog provides a field to enter commands and view
results. It also provides the help command to display namespaces,
commands, and arguments.
:param verbose: print more
"""
response=api(url=self.__url+"/o... | [
"def",
"open_dialog",
"(",
"self",
",",
"verbose",
"=",
"False",
")",
":",
"response",
"=",
"api",
"(",
"url",
"=",
"self",
".",
"__url",
"+",
"\"/open dialog\"",
",",
"verbose",
"=",
"verbose",
")",
"return",
"response"
] | The command line dialog provides a field to enter commands and view
results. It also provides the help command to display namespaces,
commands, and arguments.
:param verbose: print more | [
"The",
"command",
"line",
"dialog",
"provides",
"a",
"field",
"to",
"enter",
"commands",
"and",
"view",
"results",
".",
"It",
"also",
"provides",
"the",
"help",
"command",
"to",
"display",
"namespaces",
"commands",
"and",
"arguments",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/command.py#L25-L34 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/command.py | command.pause | def pause(self, message=None, verbose=False):
"""
The pause command displays a dialog with the text provided in the
message argument and waits for the user to click OK
:param message: a message to display. default=None
:param verbose: print more
"""
PARAMS=set_p... | python | def pause(self, message=None, verbose=False):
"""
The pause command displays a dialog with the text provided in the
message argument and waits for the user to click OK
:param message: a message to display. default=None
:param verbose: print more
"""
PARAMS=set_p... | [
"def",
"pause",
"(",
"self",
",",
"message",
"=",
"None",
",",
"verbose",
"=",
"False",
")",
":",
"PARAMS",
"=",
"set_param",
"(",
"[",
"\"message\"",
"]",
",",
"[",
"message",
"]",
")",
"response",
"=",
"api",
"(",
"url",
"=",
"self",
".",
"__url"... | The pause command displays a dialog with the text provided in the
message argument and waits for the user to click OK
:param message: a message to display. default=None
:param verbose: print more | [
"The",
"pause",
"command",
"displays",
"a",
"dialog",
"with",
"the",
"text",
"provided",
"in",
"the",
"message",
"argument",
"and",
"waits",
"for",
"the",
"user",
"to",
"click",
"OK"
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/command.py#L37-L48 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/command.py | command.quit | def quit(self,verbose=False):
"""
This command causes Cytoscape to exit. It is typically used at the end
of a script file.
:param verbose: print more
"""
response=api(url=self.__url+"/quit", verbose=verbose)
return response | python | def quit(self,verbose=False):
"""
This command causes Cytoscape to exit. It is typically used at the end
of a script file.
:param verbose: print more
"""
response=api(url=self.__url+"/quit", verbose=verbose)
return response | [
"def",
"quit",
"(",
"self",
",",
"verbose",
"=",
"False",
")",
":",
"response",
"=",
"api",
"(",
"url",
"=",
"self",
".",
"__url",
"+",
"\"/quit\"",
",",
"verbose",
"=",
"verbose",
")",
"return",
"response"
] | This command causes Cytoscape to exit. It is typically used at the end
of a script file.
:param verbose: print more | [
"This",
"command",
"causes",
"Cytoscape",
"to",
"exit",
".",
"It",
"is",
"typically",
"used",
"at",
"the",
"end",
"of",
"a",
"script",
"file",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/command.py#L51-L59 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/command.py | command.run | def run(self,script_file,args=None,verbose=False):
"""
The run command will execute a command script from the file pointed to
by the file argument, which should contain Cytoscape commands, one per
line. Arguments to the script are provided by the args argument.
:param script_fil... | python | def run(self,script_file,args=None,verbose=False):
"""
The run command will execute a command script from the file pointed to
by the file argument, which should contain Cytoscape commands, one per
line. Arguments to the script are provided by the args argument.
:param script_fil... | [
"def",
"run",
"(",
"self",
",",
"script_file",
",",
"args",
"=",
"None",
",",
"verbose",
"=",
"False",
")",
":",
"PARAMS",
"=",
"set_param",
"(",
"[",
"\"file\"",
",",
"\"args\"",
"]",
",",
"[",
"script_file",
",",
"args",
"]",
")",
"response",
"=",
... | The run command will execute a command script from the file pointed to
by the file argument, which should contain Cytoscape commands, one per
line. Arguments to the script are provided by the args argument.
:param script_file: file to run
:param args: enter the script arguments as key:v... | [
"The",
"run",
"command",
"will",
"execute",
"a",
"command",
"script",
"from",
"the",
"file",
"pointed",
"to",
"by",
"the",
"file",
"argument",
"which",
"should",
"contain",
"Cytoscape",
"commands",
"one",
"per",
"line",
".",
"Arguments",
"to",
"the",
"script... | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/command.py#L61-L75 | train |
cytoscape/py2cytoscape | py2cytoscape/cyrest/command.py | command.sleep | def sleep(self,duration,verbose=False):
"""
The sleep command will pause processing for a period of time as specified
by duration seconds. It is typically used as part of a command script.
:param duration: enter the time in seconds to sleep
:param verbose: print more
"""... | python | def sleep(self,duration,verbose=False):
"""
The sleep command will pause processing for a period of time as specified
by duration seconds. It is typically used as part of a command script.
:param duration: enter the time in seconds to sleep
:param verbose: print more
"""... | [
"def",
"sleep",
"(",
"self",
",",
"duration",
",",
"verbose",
"=",
"False",
")",
":",
"PARAMS",
"=",
"{",
"\"duration\"",
":",
"str",
"(",
"duration",
")",
"}",
"response",
"=",
"api",
"(",
"url",
"=",
"self",
".",
"__url",
"+",
"\"/sleep\"",
",",
... | The sleep command will pause processing for a period of time as specified
by duration seconds. It is typically used as part of a command script.
:param duration: enter the time in seconds to sleep
:param verbose: print more | [
"The",
"sleep",
"command",
"will",
"pause",
"processing",
"for",
"a",
"period",
"of",
"time",
"as",
"specified",
"by",
"duration",
"seconds",
".",
"It",
"is",
"typically",
"used",
"as",
"part",
"of",
"a",
"command",
"script",
"."
] | dd34de8d028f512314d0057168df7fef7c5d5195 | https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/command.py#L77-L87 | train |
ofw/curlify | curlify.py | to_curl | def to_curl(request, compressed=False, verify=True):
"""
Returns string with curl command by provided request object
Parameters
----------
compressed : bool
If `True` then `--compressed` argument will be added to result
"""
parts = [
('curl', None),
('-X', request.me... | python | def to_curl(request, compressed=False, verify=True):
"""
Returns string with curl command by provided request object
Parameters
----------
compressed : bool
If `True` then `--compressed` argument will be added to result
"""
parts = [
('curl', None),
('-X', request.me... | [
"def",
"to_curl",
"(",
"request",
",",
"compressed",
"=",
"False",
",",
"verify",
"=",
"True",
")",
":",
"parts",
"=",
"[",
"(",
"'curl'",
",",
"None",
")",
",",
"(",
"'-X'",
",",
"request",
".",
"method",
")",
",",
"]",
"for",
"k",
",",
"v",
"... | Returns string with curl command by provided request object
Parameters
----------
compressed : bool
If `True` then `--compressed` argument will be added to result | [
"Returns",
"string",
"with",
"curl",
"command",
"by",
"provided",
"request",
"object"
] | 5a464218431f979ac78d089682d36860b57420ce | https://github.com/ofw/curlify/blob/5a464218431f979ac78d089682d36860b57420ce/curlify.py#L4-L42 | train |
rq/Flask-RQ2 | src/flask_rq2/cli.py | shared_options | def shared_options(rq):
"Default class options to pass to the CLI commands."
return {
'url': rq.redis_url,
'config': None,
'worker_class': rq.worker_class,
'job_class': rq.job_class,
'queue_class': rq.queue_class,
'connection_class': rq.connection_class,
} | python | def shared_options(rq):
"Default class options to pass to the CLI commands."
return {
'url': rq.redis_url,
'config': None,
'worker_class': rq.worker_class,
'job_class': rq.job_class,
'queue_class': rq.queue_class,
'connection_class': rq.connection_class,
} | [
"def",
"shared_options",
"(",
"rq",
")",
":",
"return",
"{",
"'url'",
":",
"rq",
".",
"redis_url",
",",
"'config'",
":",
"None",
",",
"'worker_class'",
":",
"rq",
".",
"worker_class",
",",
"'job_class'",
":",
"rq",
".",
"job_class",
",",
"'queue_class'",
... | Default class options to pass to the CLI commands. | [
"Default",
"class",
"options",
"to",
"pass",
"to",
"the",
"CLI",
"commands",
"."
] | 58eedf6f0cd7bcde4ccd787074762ea08f531337 | https://github.com/rq/Flask-RQ2/blob/58eedf6f0cd7bcde4ccd787074762ea08f531337/src/flask_rq2/cli.py#L35-L44 | train |
rq/Flask-RQ2 | src/flask_rq2/cli.py | empty | def empty(rq, ctx, all, queues):
"Empty given queues."
return ctx.invoke(
rq_cli.empty,
all=all,
queues=queues or rq.queues,
**shared_options(rq)
) | python | def empty(rq, ctx, all, queues):
"Empty given queues."
return ctx.invoke(
rq_cli.empty,
all=all,
queues=queues or rq.queues,
**shared_options(rq)
) | [
"def",
"empty",
"(",
"rq",
",",
"ctx",
",",
"all",
",",
"queues",
")",
":",
"return",
"ctx",
".",
"invoke",
"(",
"rq_cli",
".",
"empty",
",",
"all",
"=",
"all",
",",
"queues",
"=",
"queues",
"or",
"rq",
".",
"queues",
",",
"*",
"*",
"shared_optio... | Empty given queues. | [
"Empty",
"given",
"queues",
"."
] | 58eedf6f0cd7bcde4ccd787074762ea08f531337 | https://github.com/rq/Flask-RQ2/blob/58eedf6f0cd7bcde4ccd787074762ea08f531337/src/flask_rq2/cli.py#L66-L73 | train |
rq/Flask-RQ2 | src/flask_rq2/cli.py | requeue | def requeue(rq, ctx, all, job_ids):
"Requeue failed jobs."
return ctx.invoke(
rq_cli.requeue,
all=all,
job_ids=job_ids,
**shared_options(rq)
) | python | def requeue(rq, ctx, all, job_ids):
"Requeue failed jobs."
return ctx.invoke(
rq_cli.requeue,
all=all,
job_ids=job_ids,
**shared_options(rq)
) | [
"def",
"requeue",
"(",
"rq",
",",
"ctx",
",",
"all",
",",
"job_ids",
")",
":",
"return",
"ctx",
".",
"invoke",
"(",
"rq_cli",
".",
"requeue",
",",
"all",
"=",
"all",
",",
"job_ids",
"=",
"job_ids",
",",
"*",
"*",
"shared_options",
"(",
"rq",
")",
... | Requeue failed jobs. | [
"Requeue",
"failed",
"jobs",
"."
] | 58eedf6f0cd7bcde4ccd787074762ea08f531337 | https://github.com/rq/Flask-RQ2/blob/58eedf6f0cd7bcde4ccd787074762ea08f531337/src/flask_rq2/cli.py#L79-L86 | train |
rq/Flask-RQ2 | src/flask_rq2/cli.py | info | def info(rq, ctx, path, interval, raw, only_queues, only_workers, by_queue,
queues):
"RQ command-line monitor."
return ctx.invoke(
rq_cli.info,
path=path,
interval=interval,
raw=raw,
only_queues=only_queues,
only_workers=only_workers,
by_queue=by_... | python | def info(rq, ctx, path, interval, raw, only_queues, only_workers, by_queue,
queues):
"RQ command-line monitor."
return ctx.invoke(
rq_cli.info,
path=path,
interval=interval,
raw=raw,
only_queues=only_queues,
only_workers=only_workers,
by_queue=by_... | [
"def",
"info",
"(",
"rq",
",",
"ctx",
",",
"path",
",",
"interval",
",",
"raw",
",",
"only_queues",
",",
"only_workers",
",",
"by_queue",
",",
"queues",
")",
":",
"return",
"ctx",
".",
"invoke",
"(",
"rq_cli",
".",
"info",
",",
"path",
"=",
"path",
... | RQ command-line monitor. | [
"RQ",
"command",
"-",
"line",
"monitor",
"."
] | 58eedf6f0cd7bcde4ccd787074762ea08f531337 | https://github.com/rq/Flask-RQ2/blob/58eedf6f0cd7bcde4ccd787074762ea08f531337/src/flask_rq2/cli.py#L100-L113 | train |
rq/Flask-RQ2 | src/flask_rq2/cli.py | worker | def worker(rq, ctx, burst, logging_level, name, path, results_ttl,
worker_ttl, verbose, quiet, sentry_dsn, exception_handler, pid,
queues):
"Starts an RQ worker."
ctx.invoke(
rq_cli.worker,
burst=burst,
logging_level=logging_level,
name=name,
path=pa... | python | def worker(rq, ctx, burst, logging_level, name, path, results_ttl,
worker_ttl, verbose, quiet, sentry_dsn, exception_handler, pid,
queues):
"Starts an RQ worker."
ctx.invoke(
rq_cli.worker,
burst=burst,
logging_level=logging_level,
name=name,
path=pa... | [
"def",
"worker",
"(",
"rq",
",",
"ctx",
",",
"burst",
",",
"logging_level",
",",
"name",
",",
"path",
",",
"results_ttl",
",",
"worker_ttl",
",",
"verbose",
",",
"quiet",
",",
"sentry_dsn",
",",
"exception_handler",
",",
"pid",
",",
"queues",
")",
":",
... | Starts an RQ worker. | [
"Starts",
"an",
"RQ",
"worker",
"."
] | 58eedf6f0cd7bcde4ccd787074762ea08f531337 | https://github.com/rq/Flask-RQ2/blob/58eedf6f0cd7bcde4ccd787074762ea08f531337/src/flask_rq2/cli.py#L136-L155 | train |
rq/Flask-RQ2 | src/flask_rq2/cli.py | suspend | def suspend(rq, ctx, duration):
"Suspends all workers."
ctx.invoke(
rq_cli.suspend,
duration=duration,
**shared_options(rq)
) | python | def suspend(rq, ctx, duration):
"Suspends all workers."
ctx.invoke(
rq_cli.suspend,
duration=duration,
**shared_options(rq)
) | [
"def",
"suspend",
"(",
"rq",
",",
"ctx",
",",
"duration",
")",
":",
"ctx",
".",
"invoke",
"(",
"rq_cli",
".",
"suspend",
",",
"duration",
"=",
"duration",
",",
"*",
"*",
"shared_options",
"(",
"rq",
")",
")"
] | Suspends all workers. | [
"Suspends",
"all",
"workers",
"."
] | 58eedf6f0cd7bcde4ccd787074762ea08f531337 | https://github.com/rq/Flask-RQ2/blob/58eedf6f0cd7bcde4ccd787074762ea08f531337/src/flask_rq2/cli.py#L162-L168 | train |
rq/Flask-RQ2 | src/flask_rq2/cli.py | scheduler | def scheduler(rq, ctx, verbose, burst, queue, interval, pid):
"Periodically checks for scheduled jobs."
scheduler = rq.get_scheduler(interval=interval, queue=queue)
if pid:
with open(os.path.expanduser(pid), 'w') as fp:
fp.write(str(os.getpid()))
if verbose:
level = 'DEBUG'
... | python | def scheduler(rq, ctx, verbose, burst, queue, interval, pid):
"Periodically checks for scheduled jobs."
scheduler = rq.get_scheduler(interval=interval, queue=queue)
if pid:
with open(os.path.expanduser(pid), 'w') as fp:
fp.write(str(os.getpid()))
if verbose:
level = 'DEBUG'
... | [
"def",
"scheduler",
"(",
"rq",
",",
"ctx",
",",
"verbose",
",",
"burst",
",",
"queue",
",",
"interval",
",",
"pid",
")",
":",
"scheduler",
"=",
"rq",
".",
"get_scheduler",
"(",
"interval",
"=",
"interval",
",",
"queue",
"=",
"queue",
")",
"if",
"pid"... | Periodically checks for scheduled jobs. | [
"Periodically",
"checks",
"for",
"scheduled",
"jobs",
"."
] | 58eedf6f0cd7bcde4ccd787074762ea08f531337 | https://github.com/rq/Flask-RQ2/blob/58eedf6f0cd7bcde4ccd787074762ea08f531337/src/flask_rq2/cli.py#L193-L204 | train |
rq/Flask-RQ2 | src/flask_rq2/app.py | RQ.init_cli | def init_cli(self, app):
"""
Initialize the Flask CLI support in case it was enabled for the
app.
Works with both Flask>=1.0's CLI support as well as the backport
in the Flask-CLI package for Flask<1.0.
"""
# in case click isn't installed after all
if cli... | python | def init_cli(self, app):
"""
Initialize the Flask CLI support in case it was enabled for the
app.
Works with both Flask>=1.0's CLI support as well as the backport
in the Flask-CLI package for Flask<1.0.
"""
# in case click isn't installed after all
if cli... | [
"def",
"init_cli",
"(",
"self",
",",
"app",
")",
":",
"# in case click isn't installed after all",
"if",
"click",
"is",
"None",
":",
"raise",
"RuntimeError",
"(",
"'Cannot import click. Is it installed?'",
")",
"# only add commands if we have a click context available",
"from... | Initialize the Flask CLI support in case it was enabled for the
app.
Works with both Flask>=1.0's CLI support as well as the backport
in the Flask-CLI package for Flask<1.0. | [
"Initialize",
"the",
"Flask",
"CLI",
"support",
"in",
"case",
"it",
"was",
"enabled",
"for",
"the",
"app",
"."
] | 58eedf6f0cd7bcde4ccd787074762ea08f531337 | https://github.com/rq/Flask-RQ2/blob/58eedf6f0cd7bcde4ccd787074762ea08f531337/src/flask_rq2/app.py#L195-L208 | train |
ionelmc/python-remote-pdb | src/remote_pdb.py | set_trace | def set_trace(host=None, port=None, patch_stdstreams=False):
"""
Opens a remote PDB on first available port.
"""
if host is None:
host = os.environ.get('REMOTE_PDB_HOST', '127.0.0.1')
if port is None:
port = int(os.environ.get('REMOTE_PDB_PORT', '0'))
rdb = RemotePdb(host=host, p... | python | def set_trace(host=None, port=None, patch_stdstreams=False):
"""
Opens a remote PDB on first available port.
"""
if host is None:
host = os.environ.get('REMOTE_PDB_HOST', '127.0.0.1')
if port is None:
port = int(os.environ.get('REMOTE_PDB_PORT', '0'))
rdb = RemotePdb(host=host, p... | [
"def",
"set_trace",
"(",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"patch_stdstreams",
"=",
"False",
")",
":",
"if",
"host",
"is",
"None",
":",
"host",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'REMOTE_PDB_HOST'",
",",
"'127.0.0.1'",
")",
... | Opens a remote PDB on first available port. | [
"Opens",
"a",
"remote",
"PDB",
"on",
"first",
"available",
"port",
"."
] | 152b4af3b8da282bbba1fc6b62f85d5cdf70be6e | https://github.com/ionelmc/python-remote-pdb/blob/152b4af3b8da282bbba1fc6b62f85d5cdf70be6e/src/remote_pdb.py#L121-L130 | train |
nschloe/optimesh | optimesh/cvt/lloyd.py | quasi_newton_uniform_lloyd | def quasi_newton_uniform_lloyd(points, cells, *args, omega=1.0, **kwargs):
"""Relaxed Lloyd's algorithm. omega=1 leads to Lloyd's algorithm, overrelaxation
omega=2 gives good results. Check out
Xiao Xiao,
Over-Relaxation Lloyd Method For Computing Centroidal Voronoi Tessellations,
Master's thesis,
... | python | def quasi_newton_uniform_lloyd(points, cells, *args, omega=1.0, **kwargs):
"""Relaxed Lloyd's algorithm. omega=1 leads to Lloyd's algorithm, overrelaxation
omega=2 gives good results. Check out
Xiao Xiao,
Over-Relaxation Lloyd Method For Computing Centroidal Voronoi Tessellations,
Master's thesis,
... | [
"def",
"quasi_newton_uniform_lloyd",
"(",
"points",
",",
"cells",
",",
"*",
"args",
",",
"omega",
"=",
"1.0",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"get_new_points",
"(",
"mesh",
")",
":",
"x",
"=",
"(",
"mesh",
".",
"node_coords",
"-",
"omega",
... | Relaxed Lloyd's algorithm. omega=1 leads to Lloyd's algorithm, overrelaxation
omega=2 gives good results. Check out
Xiao Xiao,
Over-Relaxation Lloyd Method For Computing Centroidal Voronoi Tessellations,
Master's thesis,
<https://scholarcommons.sc.edu/etd/295/>.
Everything above omega=2 can le... | [
"Relaxed",
"Lloyd",
"s",
"algorithm",
".",
"omega",
"=",
"1",
"leads",
"to",
"Lloyd",
"s",
"algorithm",
"overrelaxation",
"omega",
"=",
"2",
"gives",
"good",
"results",
".",
"Check",
"out"
] | b85f48d1559a51a01cc3df6214c61ca8ad5ed786 | https://github.com/nschloe/optimesh/blob/b85f48d1559a51a01cc3df6214c61ca8ad5ed786/optimesh/cvt/lloyd.py#L8-L46 | train |
nschloe/optimesh | optimesh/cpt.py | _energy_uniform_per_node | def _energy_uniform_per_node(X, cells):
"""The CPT mesh energy is defined as
sum_i E_i,
E_i = 1/(d+1) * sum int_{omega_i} ||x - x_i||^2 rho(x) dx,
see Chen-Holst. This method gives the E_i and assumes uniform density, rho(x) = 1.
"""
dim = 2
mesh = MeshTri(X, cells)
star_inte... | python | def _energy_uniform_per_node(X, cells):
"""The CPT mesh energy is defined as
sum_i E_i,
E_i = 1/(d+1) * sum int_{omega_i} ||x - x_i||^2 rho(x) dx,
see Chen-Holst. This method gives the E_i and assumes uniform density, rho(x) = 1.
"""
dim = 2
mesh = MeshTri(X, cells)
star_inte... | [
"def",
"_energy_uniform_per_node",
"(",
"X",
",",
"cells",
")",
":",
"dim",
"=",
"2",
"mesh",
"=",
"MeshTri",
"(",
"X",
",",
"cells",
")",
"star_integrals",
"=",
"numpy",
".",
"zeros",
"(",
"mesh",
".",
"node_coords",
".",
"shape",
"[",
"0",
"]",
")"... | The CPT mesh energy is defined as
sum_i E_i,
E_i = 1/(d+1) * sum int_{omega_i} ||x - x_i||^2 rho(x) dx,
see Chen-Holst. This method gives the E_i and assumes uniform density, rho(x) = 1. | [
"The",
"CPT",
"mesh",
"energy",
"is",
"defined",
"as"
] | b85f48d1559a51a01cc3df6214c61ca8ad5ed786 | https://github.com/nschloe/optimesh/blob/b85f48d1559a51a01cc3df6214c61ca8ad5ed786/optimesh/cpt.py#L91-L116 | train |
nschloe/optimesh | optimesh/cpt.py | jac_uniform | def jac_uniform(X, cells):
"""The approximated Jacobian is
partial_i E = 2/(d+1) (x_i int_{omega_i} rho(x) dx - int_{omega_i} x rho(x) dx)
= 2/(d+1) sum_{tau_j in omega_i} (x_i - b_{j, rho}) int_{tau_j} rho,
see Chen-Holst. This method here assumes uniform density, rho(x) = 1, such tha... | python | def jac_uniform(X, cells):
"""The approximated Jacobian is
partial_i E = 2/(d+1) (x_i int_{omega_i} rho(x) dx - int_{omega_i} x rho(x) dx)
= 2/(d+1) sum_{tau_j in omega_i} (x_i - b_{j, rho}) int_{tau_j} rho,
see Chen-Holst. This method here assumes uniform density, rho(x) = 1, such tha... | [
"def",
"jac_uniform",
"(",
"X",
",",
"cells",
")",
":",
"dim",
"=",
"2",
"mesh",
"=",
"MeshTri",
"(",
"X",
",",
"cells",
")",
"jac",
"=",
"numpy",
".",
"zeros",
"(",
"X",
".",
"shape",
")",
"for",
"k",
"in",
"range",
"(",
"mesh",
".",
"cells",
... | The approximated Jacobian is
partial_i E = 2/(d+1) (x_i int_{omega_i} rho(x) dx - int_{omega_i} x rho(x) dx)
= 2/(d+1) sum_{tau_j in omega_i} (x_i - b_{j, rho}) int_{tau_j} rho,
see Chen-Holst. This method here assumes uniform density, rho(x) = 1, such that
partial_i E = 2/(d+1) sum... | [
"The",
"approximated",
"Jacobian",
"is"
] | b85f48d1559a51a01cc3df6214c61ca8ad5ed786 | https://github.com/nschloe/optimesh/blob/b85f48d1559a51a01cc3df6214c61ca8ad5ed786/optimesh/cpt.py#L123-L147 | train |
nschloe/optimesh | optimesh/cpt.py | solve_hessian_approx_uniform | def solve_hessian_approx_uniform(X, cells, rhs):
"""As discussed above, the approximated Jacobian is
partial_i E = 2/(d+1) sum_{tau_j in omega_i} (x_i - b_j) |tau_j|.
To get the Hessian, we have to form its derivative. As a simplifications,
let us assume again that |tau_j| is independent of the node... | python | def solve_hessian_approx_uniform(X, cells, rhs):
"""As discussed above, the approximated Jacobian is
partial_i E = 2/(d+1) sum_{tau_j in omega_i} (x_i - b_j) |tau_j|.
To get the Hessian, we have to form its derivative. As a simplifications,
let us assume again that |tau_j| is independent of the node... | [
"def",
"solve_hessian_approx_uniform",
"(",
"X",
",",
"cells",
",",
"rhs",
")",
":",
"dim",
"=",
"2",
"mesh",
"=",
"MeshTri",
"(",
"X",
",",
"cells",
")",
"# Create matrix in IJV format",
"row_idx",
"=",
"[",
"]",
"col_idx",
"=",
"[",
"]",
"val",
"=",
... | As discussed above, the approximated Jacobian is
partial_i E = 2/(d+1) sum_{tau_j in omega_i} (x_i - b_j) |tau_j|.
To get the Hessian, we have to form its derivative. As a simplifications,
let us assume again that |tau_j| is independent of the node positions. Then we get
partial_ii E = 2/(d+1) |... | [
"As",
"discussed",
"above",
"the",
"approximated",
"Jacobian",
"is"
] | b85f48d1559a51a01cc3df6214c61ca8ad5ed786 | https://github.com/nschloe/optimesh/blob/b85f48d1559a51a01cc3df6214c61ca8ad5ed786/optimesh/cpt.py#L150-L227 | train |
nschloe/optimesh | optimesh/cpt.py | quasi_newton_uniform | def quasi_newton_uniform(points, cells, *args, **kwargs):
"""Like linear_solve above, but assuming rho==1. Note that the energy gradient
\\partial E_i = 2/(d+1) sum_{tau_j in omega_i} (x_i - b_j) \\int_{tau_j} rho
becomes
\\partial E_i = 2/(d+1) sum_{tau_j in omega_i} (x_i - b_j) |tau_j|.
... | python | def quasi_newton_uniform(points, cells, *args, **kwargs):
"""Like linear_solve above, but assuming rho==1. Note that the energy gradient
\\partial E_i = 2/(d+1) sum_{tau_j in omega_i} (x_i - b_j) \\int_{tau_j} rho
becomes
\\partial E_i = 2/(d+1) sum_{tau_j in omega_i} (x_i - b_j) |tau_j|.
... | [
"def",
"quasi_newton_uniform",
"(",
"points",
",",
"cells",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"get_new_points",
"(",
"mesh",
")",
":",
"# do one Newton step",
"# TODO need copy?",
"x",
"=",
"mesh",
".",
"node_coords",
".",
"copy",
... | Like linear_solve above, but assuming rho==1. Note that the energy gradient
\\partial E_i = 2/(d+1) sum_{tau_j in omega_i} (x_i - b_j) \\int_{tau_j} rho
becomes
\\partial E_i = 2/(d+1) sum_{tau_j in omega_i} (x_i - b_j) |tau_j|.
Because of the dependence of |tau_j| on the point coordinates, ... | [
"Like",
"linear_solve",
"above",
"but",
"assuming",
"rho",
"==",
"1",
".",
"Note",
"that",
"the",
"energy",
"gradient"
] | b85f48d1559a51a01cc3df6214c61ca8ad5ed786 | https://github.com/nschloe/optimesh/blob/b85f48d1559a51a01cc3df6214c61ca8ad5ed786/optimesh/cpt.py#L230-L257 | train |
nschloe/optimesh | optimesh/laplace.py | fixed_point | def fixed_point(points, cells, *args, **kwargs):
"""Perform k steps of Laplacian smoothing to the mesh, i.e., moving each
interior vertex to the arithmetic average of its neighboring points.
"""
def get_new_points(mesh):
# move interior points into average of their neighbors
num_neighbo... | python | def fixed_point(points, cells, *args, **kwargs):
"""Perform k steps of Laplacian smoothing to the mesh, i.e., moving each
interior vertex to the arithmetic average of its neighboring points.
"""
def get_new_points(mesh):
# move interior points into average of their neighbors
num_neighbo... | [
"def",
"fixed_point",
"(",
"points",
",",
"cells",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"get_new_points",
"(",
"mesh",
")",
":",
"# move interior points into average of their neighbors",
"num_neighbors",
"=",
"numpy",
".",
"zeros",
"(",
... | Perform k steps of Laplacian smoothing to the mesh, i.e., moving each
interior vertex to the arithmetic average of its neighboring points. | [
"Perform",
"k",
"steps",
"of",
"Laplacian",
"smoothing",
"to",
"the",
"mesh",
"i",
".",
"e",
".",
"moving",
"each",
"interior",
"vertex",
"to",
"the",
"arithmetic",
"average",
"of",
"its",
"neighboring",
"points",
"."
] | b85f48d1559a51a01cc3df6214c61ca8ad5ed786 | https://github.com/nschloe/optimesh/blob/b85f48d1559a51a01cc3df6214c61ca8ad5ed786/optimesh/laplace.py#L12-L34 | train |
nschloe/optimesh | optimesh/odt.py | energy | def energy(mesh, uniform_density=False):
"""The mesh energy is defined as
E = int_Omega |u_l(x) - u(x)| rho(x) dx
where u(x) = ||x||^2 and u_l is its piecewise linearization on the mesh.
"""
# E = 1/(d+1) sum_i ||x_i||^2 |omega_i| - int_Omega_i ||x||^2
dim = mesh.cells["nodes"].shape[1] - 1
... | python | def energy(mesh, uniform_density=False):
"""The mesh energy is defined as
E = int_Omega |u_l(x) - u(x)| rho(x) dx
where u(x) = ||x||^2 and u_l is its piecewise linearization on the mesh.
"""
# E = 1/(d+1) sum_i ||x_i||^2 |omega_i| - int_Omega_i ||x||^2
dim = mesh.cells["nodes"].shape[1] - 1
... | [
"def",
"energy",
"(",
"mesh",
",",
"uniform_density",
"=",
"False",
")",
":",
"# E = 1/(d+1) sum_i ||x_i||^2 |omega_i| - int_Omega_i ||x||^2",
"dim",
"=",
"mesh",
".",
"cells",
"[",
"\"nodes\"",
"]",
".",
"shape",
"[",
"1",
"]",
"-",
"1",
"star_volume",
"=",
"... | The mesh energy is defined as
E = int_Omega |u_l(x) - u(x)| rho(x) dx
where u(x) = ||x||^2 and u_l is its piecewise linearization on the mesh. | [
"The",
"mesh",
"energy",
"is",
"defined",
"as"
] | b85f48d1559a51a01cc3df6214c61ca8ad5ed786 | https://github.com/nschloe/optimesh/blob/b85f48d1559a51a01cc3df6214c61ca8ad5ed786/optimesh/odt.py#L28-L70 | train |
nschloe/optimesh | optimesh/cvt/block_diagonal.py | quasi_newton_uniform_blocks | def quasi_newton_uniform_blocks(points, cells, *args, **kwargs):
"""Lloyd's algorithm can be though of a diagonal-only Hessian; this method
incorporates the diagonal blocks, too.
"""
def get_new_points(mesh):
# TODO need copy?
x = mesh.node_coords.copy()
x += update(mesh)
... | python | def quasi_newton_uniform_blocks(points, cells, *args, **kwargs):
"""Lloyd's algorithm can be though of a diagonal-only Hessian; this method
incorporates the diagonal blocks, too.
"""
def get_new_points(mesh):
# TODO need copy?
x = mesh.node_coords.copy()
x += update(mesh)
... | [
"def",
"quasi_newton_uniform_blocks",
"(",
"points",
",",
"cells",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"get_new_points",
"(",
"mesh",
")",
":",
"# TODO need copy?",
"x",
"=",
"mesh",
".",
"node_coords",
".",
"copy",
"(",
")",
"x",... | Lloyd's algorithm can be though of a diagonal-only Hessian; this method
incorporates the diagonal blocks, too. | [
"Lloyd",
"s",
"algorithm",
"can",
"be",
"though",
"of",
"a",
"diagonal",
"-",
"only",
"Hessian",
";",
"this",
"method",
"incorporates",
"the",
"diagonal",
"blocks",
"too",
"."
] | b85f48d1559a51a01cc3df6214c61ca8ad5ed786 | https://github.com/nschloe/optimesh/blob/b85f48d1559a51a01cc3df6214c61ca8ad5ed786/optimesh/cvt/block_diagonal.py#L12-L39 | train |
linnarsson-lab/loompy | loompy/loompy.py | new | def new(filename: str, *, file_attrs: Optional[Dict[str, str]] = None) -> LoomConnection:
"""
Create an empty Loom file, and return it as a context manager.
"""
if filename.startswith("~/"):
filename = os.path.expanduser(filename)
if file_attrs is None:
file_attrs = {}
# Create the file (empty).
# Yes, this... | python | def new(filename: str, *, file_attrs: Optional[Dict[str, str]] = None) -> LoomConnection:
"""
Create an empty Loom file, and return it as a context manager.
"""
if filename.startswith("~/"):
filename = os.path.expanduser(filename)
if file_attrs is None:
file_attrs = {}
# Create the file (empty).
# Yes, this... | [
"def",
"new",
"(",
"filename",
":",
"str",
",",
"*",
",",
"file_attrs",
":",
"Optional",
"[",
"Dict",
"[",
"str",
",",
"str",
"]",
"]",
"=",
"None",
")",
"->",
"LoomConnection",
":",
"if",
"filename",
".",
"startswith",
"(",
"\"~/\"",
")",
":",
"fi... | Create an empty Loom file, and return it as a context manager. | [
"Create",
"an",
"empty",
"Loom",
"file",
"and",
"return",
"it",
"as",
"a",
"context",
"manager",
"."
] | 62c8373a92b058753baa3a95331fb541f560f599 | https://github.com/linnarsson-lab/loompy/blob/62c8373a92b058753baa3a95331fb541f560f599/loompy/loompy.py#L993-L1020 | train |
linnarsson-lab/loompy | loompy/loompy.py | create | def create(filename: str, layers: Union[np.ndarray, Dict[str, np.ndarray], loompy.LayerManager], row_attrs: Union[loompy.AttributeManager, Dict[str, np.ndarray]], col_attrs: Union[loompy.AttributeManager, Dict[str, np.ndarray]], *, file_attrs: Dict[str, str] = None) -> None:
"""
Create a new Loom file from the given ... | python | def create(filename: str, layers: Union[np.ndarray, Dict[str, np.ndarray], loompy.LayerManager], row_attrs: Union[loompy.AttributeManager, Dict[str, np.ndarray]], col_attrs: Union[loompy.AttributeManager, Dict[str, np.ndarray]], *, file_attrs: Dict[str, str] = None) -> None:
"""
Create a new Loom file from the given ... | [
"def",
"create",
"(",
"filename",
":",
"str",
",",
"layers",
":",
"Union",
"[",
"np",
".",
"ndarray",
",",
"Dict",
"[",
"str",
",",
"np",
".",
"ndarray",
"]",
",",
"loompy",
".",
"LayerManager",
"]",
",",
"row_attrs",
":",
"Union",
"[",
"loompy",
"... | Create a new Loom file from the given data.
Args:
filename (str): The filename (typically using a ``.loom`` file extension)
layers: One of the following:
* Two-dimensional (N-by-M) numpy ndarray of float values
* Sparse matrix (e.g. :class:`scipy.sparse.csr_matrix`)
* Dictiona... | [
"Create",
"a",
"new",
"Loom",
"file",
"from",
"the",
"given",
"data",
"."
] | 62c8373a92b058753baa3a95331fb541f560f599 | https://github.com/linnarsson-lab/loompy/blob/62c8373a92b058753baa3a95331fb541f560f599/loompy/loompy.py#L1023-L1089 | train |
linnarsson-lab/loompy | loompy/loompy.py | connect | def connect(filename: str, mode: str = 'r+', *, validate: bool = True, spec_version: str = "2.0.1") -> LoomConnection:
"""
Establish a connection to a .loom file.
Args:
filename: Path to the Loom file to open
mode: Read/write mode, 'r+' (read/write) or 'r' (read-only), defaults to 'r+'
validate: Validate ... | python | def connect(filename: str, mode: str = 'r+', *, validate: bool = True, spec_version: str = "2.0.1") -> LoomConnection:
"""
Establish a connection to a .loom file.
Args:
filename: Path to the Loom file to open
mode: Read/write mode, 'r+' (read/write) or 'r' (read-only), defaults to 'r+'
validate: Validate ... | [
"def",
"connect",
"(",
"filename",
":",
"str",
",",
"mode",
":",
"str",
"=",
"'r+'",
",",
"*",
",",
"validate",
":",
"bool",
"=",
"True",
",",
"spec_version",
":",
"str",
"=",
"\"2.0.1\"",
")",
"->",
"LoomConnection",
":",
"return",
"LoomConnection",
"... | Establish a connection to a .loom file.
Args:
filename: Path to the Loom file to open
mode: Read/write mode, 'r+' (read/write) or 'r' (read-only), defaults to 'r+'
validate: Validate the file structure against the Loom file format specification
spec_version: The loom file spec version to validate against ... | [
"Establish",
"a",
"connection",
"to",
"a",
".",
"loom",
"file",
"."
] | 62c8373a92b058753baa3a95331fb541f560f599 | https://github.com/linnarsson-lab/loompy/blob/62c8373a92b058753baa3a95331fb541f560f599/loompy/loompy.py#L1290-L1316 | train |
linnarsson-lab/loompy | loompy/loompy.py | LoomConnection.last_modified | def last_modified(self) -> str:
"""
Return an ISO8601 timestamp indicating when the file was last modified
Returns:
An ISO8601 timestamp indicating when the file was last modified
Remarks:
If the file has no timestamp, and mode is 'r+', a new timestamp is created and returned.
Otherwise, the current ... | python | def last_modified(self) -> str:
"""
Return an ISO8601 timestamp indicating when the file was last modified
Returns:
An ISO8601 timestamp indicating when the file was last modified
Remarks:
If the file has no timestamp, and mode is 'r+', a new timestamp is created and returned.
Otherwise, the current ... | [
"def",
"last_modified",
"(",
"self",
")",
"->",
"str",
":",
"if",
"\"last_modified\"",
"in",
"self",
".",
"attrs",
":",
"return",
"self",
".",
"attrs",
"[",
"\"last_modified\"",
"]",
"elif",
"self",
".",
"mode",
"==",
"\"r+\"",
":",
"# Make sure the file has... | Return an ISO8601 timestamp indicating when the file was last modified
Returns:
An ISO8601 timestamp indicating when the file was last modified
Remarks:
If the file has no timestamp, and mode is 'r+', a new timestamp is created and returned.
Otherwise, the current time in UTC is returned | [
"Return",
"an",
"ISO8601",
"timestamp",
"indicating",
"when",
"the",
"file",
"was",
"last",
"modified"
] | 62c8373a92b058753baa3a95331fb541f560f599 | https://github.com/linnarsson-lab/loompy/blob/62c8373a92b058753baa3a95331fb541f560f599/loompy/loompy.py#L115-L132 | train |
linnarsson-lab/loompy | loompy/loompy.py | LoomConnection.get_changes_since | def get_changes_since(self, timestamp: str) -> Dict[str, List]:
"""
Get a summary of the parts of the file that changed since the given time
Args:
timestamp: ISO8601 timestamp
Return:
dict: Dictionary like ``{"row_graphs": rg, "col_graphs": cg, "row_attrs": ra, "col_attrs": ca, "layers": layers}`` listi... | python | def get_changes_since(self, timestamp: str) -> Dict[str, List]:
"""
Get a summary of the parts of the file that changed since the given time
Args:
timestamp: ISO8601 timestamp
Return:
dict: Dictionary like ``{"row_graphs": rg, "col_graphs": cg, "row_attrs": ra, "col_attrs": ca, "layers": layers}`` listi... | [
"def",
"get_changes_since",
"(",
"self",
",",
"timestamp",
":",
"str",
")",
"->",
"Dict",
"[",
"str",
",",
"List",
"]",
":",
"rg",
"=",
"[",
"]",
"cg",
"=",
"[",
"]",
"ra",
"=",
"[",
"]",
"ca",
"=",
"[",
"]",
"layers",
"=",
"[",
"]",
"if",
... | Get a summary of the parts of the file that changed since the given time
Args:
timestamp: ISO8601 timestamp
Return:
dict: Dictionary like ``{"row_graphs": rg, "col_graphs": cg, "row_attrs": ra, "col_attrs": ca, "layers": layers}`` listing the names of objects that were modified since the given time | [
"Get",
"a",
"summary",
"of",
"the",
"parts",
"of",
"the",
"file",
"that",
"changed",
"since",
"the",
"given",
"time"
] | 62c8373a92b058753baa3a95331fb541f560f599 | https://github.com/linnarsson-lab/loompy/blob/62c8373a92b058753baa3a95331fb541f560f599/loompy/loompy.py#L134-L171 | train |
linnarsson-lab/loompy | loompy/loompy.py | LoomConnection.sparse | def sparse(self, rows: np.ndarray = None, cols: np.ndarray = None, layer: str = None) -> scipy.sparse.coo_matrix:
"""
Return the main matrix or specified layer as a scipy.sparse.coo_matrix, without loading dense matrix in RAM
Args:
rows: Rows to include, or None to include all
cols: Columns to include, o... | python | def sparse(self, rows: np.ndarray = None, cols: np.ndarray = None, layer: str = None) -> scipy.sparse.coo_matrix:
"""
Return the main matrix or specified layer as a scipy.sparse.coo_matrix, without loading dense matrix in RAM
Args:
rows: Rows to include, or None to include all
cols: Columns to include, o... | [
"def",
"sparse",
"(",
"self",
",",
"rows",
":",
"np",
".",
"ndarray",
"=",
"None",
",",
"cols",
":",
"np",
".",
"ndarray",
"=",
"None",
",",
"layer",
":",
"str",
"=",
"None",
")",
"->",
"scipy",
".",
"sparse",
".",
"coo_matrix",
":",
"if",
"layer... | Return the main matrix or specified layer as a scipy.sparse.coo_matrix, without loading dense matrix in RAM
Args:
rows: Rows to include, or None to include all
cols: Columns to include, or None to include all
layer: Layer to return, or None to return the default layer
Returns:
Sparse matrix (:class... | [
"Return",
"the",
"main",
"matrix",
"or",
"specified",
"layer",
"as",
"a",
"scipy",
".",
"sparse",
".",
"coo_matrix",
"without",
"loading",
"dense",
"matrix",
"in",
"RAM"
] | 62c8373a92b058753baa3a95331fb541f560f599 | https://github.com/linnarsson-lab/loompy/blob/62c8373a92b058753baa3a95331fb541f560f599/loompy/loompy.py#L229-L244 | train |
linnarsson-lab/loompy | loompy/loompy.py | LoomConnection.close | def close(self, suppress_warning: bool = False) -> None:
"""
Close the connection. After this, the connection object becomes invalid. Warns user if called after closing.
Args:
suppress_warning: Suppresses warning message if True (defaults to false)
"""
if self._file is None:
if not suppress_warning:
... | python | def close(self, suppress_warning: bool = False) -> None:
"""
Close the connection. After this, the connection object becomes invalid. Warns user if called after closing.
Args:
suppress_warning: Suppresses warning message if True (defaults to false)
"""
if self._file is None:
if not suppress_warning:
... | [
"def",
"close",
"(",
"self",
",",
"suppress_warning",
":",
"bool",
"=",
"False",
")",
"->",
"None",
":",
"if",
"self",
".",
"_file",
"is",
"None",
":",
"if",
"not",
"suppress_warning",
":",
"# Warn user that they're being paranoid",
"# and should clean up their co... | Close the connection. After this, the connection object becomes invalid. Warns user if called after closing.
Args:
suppress_warning: Suppresses warning message if True (defaults to false) | [
"Close",
"the",
"connection",
".",
"After",
"this",
"the",
"connection",
"object",
"becomes",
"invalid",
".",
"Warns",
"user",
"if",
"called",
"after",
"closing",
"."
] | 62c8373a92b058753baa3a95331fb541f560f599 | https://github.com/linnarsson-lab/loompy/blob/62c8373a92b058753baa3a95331fb541f560f599/loompy/loompy.py#L246-L269 | train |
linnarsson-lab/loompy | loompy/loompy.py | LoomConnection.permute | def permute(self, ordering: np.ndarray, axis: int) -> None:
"""
Permute the dataset along the indicated axis.
Args:
ordering (list of int): The desired order along the axis
axis (int): The axis along which to permute
Returns:
Nothing.
"""
if self._file.__contains__("tiles"):
del self._fi... | python | def permute(self, ordering: np.ndarray, axis: int) -> None:
"""
Permute the dataset along the indicated axis.
Args:
ordering (list of int): The desired order along the axis
axis (int): The axis along which to permute
Returns:
Nothing.
"""
if self._file.__contains__("tiles"):
del self._fi... | [
"def",
"permute",
"(",
"self",
",",
"ordering",
":",
"np",
".",
"ndarray",
",",
"axis",
":",
"int",
")",
"->",
"None",
":",
"if",
"self",
".",
"_file",
".",
"__contains__",
"(",
"\"tiles\"",
")",
":",
"del",
"self",
".",
"_file",
"[",
"'tiles'",
"]... | Permute the dataset along the indicated axis.
Args:
ordering (list of int): The desired order along the axis
axis (int): The axis along which to permute
Returns:
Nothing. | [
"Permute",
"the",
"dataset",
"along",
"the",
"indicated",
"axis",
"."
] | 62c8373a92b058753baa3a95331fb541f560f599 | https://github.com/linnarsson-lab/loompy/blob/62c8373a92b058753baa3a95331fb541f560f599/loompy/loompy.py#L784-L806 | train |
linnarsson-lab/loompy | loompy/loompy.py | LoomConnection.aggregate | def aggregate(self, out_file: str = None, select: np.ndarray = None, group_by: Union[str, np.ndarray] = "Clusters", aggr_by: str = "mean", aggr_ca_by: Dict[str, str] = None) -> np.ndarray:
"""
Aggregate the Loom file by applying aggregation functions to the main matrix as well as to the column attributes
Args:
... | python | def aggregate(self, out_file: str = None, select: np.ndarray = None, group_by: Union[str, np.ndarray] = "Clusters", aggr_by: str = "mean", aggr_ca_by: Dict[str, str] = None) -> np.ndarray:
"""
Aggregate the Loom file by applying aggregation functions to the main matrix as well as to the column attributes
Args:
... | [
"def",
"aggregate",
"(",
"self",
",",
"out_file",
":",
"str",
"=",
"None",
",",
"select",
":",
"np",
".",
"ndarray",
"=",
"None",
",",
"group_by",
":",
"Union",
"[",
"str",
",",
"np",
".",
"ndarray",
"]",
"=",
"\"Clusters\"",
",",
"aggr_by",
":",
"... | Aggregate the Loom file by applying aggregation functions to the main matrix as well as to the column attributes
Args:
out_file The name of the output Loom file (will be appended to if it exists)
select Bool array giving the columns to include (or None, to include all)
group_by The column attribute to grou... | [
"Aggregate",
"the",
"Loom",
"file",
"by",
"applying",
"aggregation",
"functions",
"to",
"the",
"main",
"matrix",
"as",
"well",
"as",
"to",
"the",
"column",
"attributes"
] | 62c8373a92b058753baa3a95331fb541f560f599 | https://github.com/linnarsson-lab/loompy/blob/62c8373a92b058753baa3a95331fb541f560f599/loompy/loompy.py#L873-L934 | train |
linnarsson-lab/loompy | loompy/file_attribute_manager.py | FileAttributeManager.get | def get(self, name: str, default: Any = None) -> np.ndarray:
"""
Return the value for a named attribute if it exists, else default.
If default is not given, it defaults to None, so that this method never raises a KeyError.
"""
if name in self:
return self[name]
else:
return default | python | def get(self, name: str, default: Any = None) -> np.ndarray:
"""
Return the value for a named attribute if it exists, else default.
If default is not given, it defaults to None, so that this method never raises a KeyError.
"""
if name in self:
return self[name]
else:
return default | [
"def",
"get",
"(",
"self",
",",
"name",
":",
"str",
",",
"default",
":",
"Any",
"=",
"None",
")",
"->",
"np",
".",
"ndarray",
":",
"if",
"name",
"in",
"self",
":",
"return",
"self",
"[",
"name",
"]",
"else",
":",
"return",
"default"
] | Return the value for a named attribute if it exists, else default.
If default is not given, it defaults to None, so that this method never raises a KeyError. | [
"Return",
"the",
"value",
"for",
"a",
"named",
"attribute",
"if",
"it",
"exists",
"else",
"default",
".",
"If",
"default",
"is",
"not",
"given",
"it",
"defaults",
"to",
"None",
"so",
"that",
"this",
"method",
"never",
"raises",
"a",
"KeyError",
"."
] | 62c8373a92b058753baa3a95331fb541f560f599 | https://github.com/linnarsson-lab/loompy/blob/62c8373a92b058753baa3a95331fb541f560f599/loompy/file_attribute_manager.py#L78-L86 | train |
linnarsson-lab/loompy | loompy/color.py | cat_colors | def cat_colors(N: int = 1, *, hue: str = None, luminosity: str = None, bgvalue: int = None, loop: bool = False, seed: str = "cat") -> Union[List[Any], colors.LinearSegmentedColormap]:
"""
Return a colormap suitable for N categorical values, optimized to be both aesthetically pleasing and perceptually distinct.
Args... | python | def cat_colors(N: int = 1, *, hue: str = None, luminosity: str = None, bgvalue: int = None, loop: bool = False, seed: str = "cat") -> Union[List[Any], colors.LinearSegmentedColormap]:
"""
Return a colormap suitable for N categorical values, optimized to be both aesthetically pleasing and perceptually distinct.
Args... | [
"def",
"cat_colors",
"(",
"N",
":",
"int",
"=",
"1",
",",
"*",
",",
"hue",
":",
"str",
"=",
"None",
",",
"luminosity",
":",
"str",
"=",
"None",
",",
"bgvalue",
":",
"int",
"=",
"None",
",",
"loop",
":",
"bool",
"=",
"False",
",",
"seed",
":",
... | Return a colormap suitable for N categorical values, optimized to be both aesthetically pleasing and perceptually distinct.
Args:
N The number of colors requested.
hue Controls the hue of the generated color. You can pass a string representing a color name: "red", "orange", "yellow", "green", "blue", "purple"... | [
"Return",
"a",
"colormap",
"suitable",
"for",
"N",
"categorical",
"values",
"optimized",
"to",
"be",
"both",
"aesthetically",
"pleasing",
"and",
"perceptually",
"distinct",
"."
] | 62c8373a92b058753baa3a95331fb541f560f599 | https://github.com/linnarsson-lab/loompy/blob/62c8373a92b058753baa3a95331fb541f560f599/loompy/color.py#L336-L367 | train |
linnarsson-lab/loompy | loompy/graph_manager.py | _renumber | def _renumber(a: np.ndarray, keys: np.ndarray, values: np.ndarray) -> np.ndarray:
"""
Renumber 'a' by replacing any occurrence of 'keys' by the corresponding 'values'
"""
ordering = np.argsort(keys)
keys = keys[ordering]
values = keys[ordering]
index = np.digitize(a.ravel(), keys, right=True)
return(values[inde... | python | def _renumber(a: np.ndarray, keys: np.ndarray, values: np.ndarray) -> np.ndarray:
"""
Renumber 'a' by replacing any occurrence of 'keys' by the corresponding 'values'
"""
ordering = np.argsort(keys)
keys = keys[ordering]
values = keys[ordering]
index = np.digitize(a.ravel(), keys, right=True)
return(values[inde... | [
"def",
"_renumber",
"(",
"a",
":",
"np",
".",
"ndarray",
",",
"keys",
":",
"np",
".",
"ndarray",
",",
"values",
":",
"np",
".",
"ndarray",
")",
"->",
"np",
".",
"ndarray",
":",
"ordering",
"=",
"np",
".",
"argsort",
"(",
"keys",
")",
"keys",
"=",... | Renumber 'a' by replacing any occurrence of 'keys' by the corresponding 'values' | [
"Renumber",
"a",
"by",
"replacing",
"any",
"occurrence",
"of",
"keys",
"by",
"the",
"corresponding",
"values"
] | 62c8373a92b058753baa3a95331fb541f560f599 | https://github.com/linnarsson-lab/loompy/blob/62c8373a92b058753baa3a95331fb541f560f599/loompy/graph_manager.py#L7-L15 | train |
linnarsson-lab/loompy | loompy/loom_validator.py | LoomValidator.validate | def validate(self, path: str, strictness: str = "speconly") -> bool:
"""
Validate a file for conformance to the Loom specification
Args:
path: Full path to the file to be validated
strictness: "speconly" or "conventions"
Remarks:
In "speconly" mode, conformance is assessed relative to the file fo... | python | def validate(self, path: str, strictness: str = "speconly") -> bool:
"""
Validate a file for conformance to the Loom specification
Args:
path: Full path to the file to be validated
strictness: "speconly" or "conventions"
Remarks:
In "speconly" mode, conformance is assessed relative to the file fo... | [
"def",
"validate",
"(",
"self",
",",
"path",
":",
"str",
",",
"strictness",
":",
"str",
"=",
"\"speconly\"",
")",
"->",
"bool",
":",
"valid1",
"=",
"True",
"with",
"h5py",
".",
"File",
"(",
"path",
",",
"mode",
"=",
"\"r\"",
")",
"as",
"f",
":",
... | Validate a file for conformance to the Loom specification
Args:
path: Full path to the file to be validated
strictness: "speconly" or "conventions"
Remarks:
In "speconly" mode, conformance is assessed relative to the file format specification
at http://linnarssonlab.org/loompy/format/. In "convent... | [
"Validate",
"a",
"file",
"for",
"conformance",
"to",
"the",
"Loom",
"specification"
] | 62c8373a92b058753baa3a95331fb541f560f599 | https://github.com/linnarsson-lab/loompy/blob/62c8373a92b058753baa3a95331fb541f560f599/loompy/loom_validator.py#L34-L60 | train |
linnarsson-lab/loompy | loompy/attribute_manager.py | AttributeManager._permute | def _permute(self, ordering: np.ndarray) -> None:
"""
Permute all the attributes in the collection
Remarks:
This permutes the order of the values for each attribute in the file
"""
for key in self.keys():
self[key] = self[key][ordering] | python | def _permute(self, ordering: np.ndarray) -> None:
"""
Permute all the attributes in the collection
Remarks:
This permutes the order of the values for each attribute in the file
"""
for key in self.keys():
self[key] = self[key][ordering] | [
"def",
"_permute",
"(",
"self",
",",
"ordering",
":",
"np",
".",
"ndarray",
")",
"->",
"None",
":",
"for",
"key",
"in",
"self",
".",
"keys",
"(",
")",
":",
"self",
"[",
"key",
"]",
"=",
"self",
"[",
"key",
"]",
"[",
"ordering",
"]"
] | Permute all the attributes in the collection
Remarks:
This permutes the order of the values for each attribute in the file | [
"Permute",
"all",
"the",
"attributes",
"in",
"the",
"collection"
] | 62c8373a92b058753baa3a95331fb541f560f599 | https://github.com/linnarsson-lab/loompy/blob/62c8373a92b058753baa3a95331fb541f560f599/loompy/attribute_manager.py#L180-L188 | train |
linnarsson-lab/loompy | loompy/attribute_manager.py | AttributeManager.get | def get(self, name: str, default: np.ndarray) -> np.ndarray:
"""
Return the value for a named attribute if it exists, else default.
Default has to be a numpy array of correct size.
"""
if name in self:
return self[name]
else:
if not isinstance(default, np.ndarray):
raise ValueError(f"Default must... | python | def get(self, name: str, default: np.ndarray) -> np.ndarray:
"""
Return the value for a named attribute if it exists, else default.
Default has to be a numpy array of correct size.
"""
if name in self:
return self[name]
else:
if not isinstance(default, np.ndarray):
raise ValueError(f"Default must... | [
"def",
"get",
"(",
"self",
",",
"name",
":",
"str",
",",
"default",
":",
"np",
".",
"ndarray",
")",
"->",
"np",
".",
"ndarray",
":",
"if",
"name",
"in",
"self",
":",
"return",
"self",
"[",
"name",
"]",
"else",
":",
"if",
"not",
"isinstance",
"(",... | Return the value for a named attribute if it exists, else default.
Default has to be a numpy array of correct size. | [
"Return",
"the",
"value",
"for",
"a",
"named",
"attribute",
"if",
"it",
"exists",
"else",
"default",
".",
"Default",
"has",
"to",
"be",
"a",
"numpy",
"array",
"of",
"correct",
"size",
"."
] | 62c8373a92b058753baa3a95331fb541f560f599 | https://github.com/linnarsson-lab/loompy/blob/62c8373a92b058753baa3a95331fb541f560f599/loompy/attribute_manager.py#L190-L205 | train |
linnarsson-lab/loompy | loompy/normalize.py | normalize_attr_array | def normalize_attr_array(a: Any) -> np.ndarray:
"""
Take all kinds of array-like inputs and normalize to a one-dimensional np.ndarray
"""
if type(a) is np.ndarray:
return a
elif type(a) is np.matrix:
if a.shape[0] == 1:
return np.array(a)[0, :]
elif a.shape[1] == 1:
return np.array(a)[:, 0]
else:
... | python | def normalize_attr_array(a: Any) -> np.ndarray:
"""
Take all kinds of array-like inputs and normalize to a one-dimensional np.ndarray
"""
if type(a) is np.ndarray:
return a
elif type(a) is np.matrix:
if a.shape[0] == 1:
return np.array(a)[0, :]
elif a.shape[1] == 1:
return np.array(a)[:, 0]
else:
... | [
"def",
"normalize_attr_array",
"(",
"a",
":",
"Any",
")",
"->",
"np",
".",
"ndarray",
":",
"if",
"type",
"(",
"a",
")",
"is",
"np",
".",
"ndarray",
":",
"return",
"a",
"elif",
"type",
"(",
"a",
")",
"is",
"np",
".",
"matrix",
":",
"if",
"a",
".... | Take all kinds of array-like inputs and normalize to a one-dimensional np.ndarray | [
"Take",
"all",
"kinds",
"of",
"array",
"-",
"like",
"inputs",
"and",
"normalize",
"to",
"a",
"one",
"-",
"dimensional",
"np",
".",
"ndarray"
] | 62c8373a92b058753baa3a95331fb541f560f599 | https://github.com/linnarsson-lab/loompy/blob/62c8373a92b058753baa3a95331fb541f560f599/loompy/normalize.py#L29-L47 | train |
linnarsson-lab/loompy | loompy/to_html.py | to_html | def to_html(ds: Any) -> str:
"""
Return an HTML representation of the loom file or view, showing the upper-left 10x10 corner.
"""
rm = min(10, ds.shape[0])
cm = min(10, ds.shape[1])
html = "<p>"
if ds.attrs.__contains__("title"):
html += "<strong>" + ds.attrs["title"] + "</strong> "
html += f"{ds.shape[0]} ro... | python | def to_html(ds: Any) -> str:
"""
Return an HTML representation of the loom file or view, showing the upper-left 10x10 corner.
"""
rm = min(10, ds.shape[0])
cm = min(10, ds.shape[1])
html = "<p>"
if ds.attrs.__contains__("title"):
html += "<strong>" + ds.attrs["title"] + "</strong> "
html += f"{ds.shape[0]} ro... | [
"def",
"to_html",
"(",
"ds",
":",
"Any",
")",
"->",
"str",
":",
"rm",
"=",
"min",
"(",
"10",
",",
"ds",
".",
"shape",
"[",
"0",
"]",
")",
"cm",
"=",
"min",
"(",
"10",
",",
"ds",
".",
"shape",
"[",
"1",
"]",
")",
"html",
"=",
"\"<p>\"",
"i... | Return an HTML representation of the loom file or view, showing the upper-left 10x10 corner. | [
"Return",
"an",
"HTML",
"representation",
"of",
"the",
"loom",
"file",
"or",
"view",
"showing",
"the",
"upper",
"-",
"left",
"10x10",
"corner",
"."
] | 62c8373a92b058753baa3a95331fb541f560f599 | https://github.com/linnarsson-lab/loompy/blob/62c8373a92b058753baa3a95331fb541f560f599/loompy/to_html.py#L4-L62 | train |
linnarsson-lab/loompy | loompy/loom_view.py | LoomView.permute | def permute(self, ordering: np.ndarray, *, axis: int) -> None:
"""
Permute the view, by permuting its layers, attributes and graphs
Args:
ordering (np.ndarray): The desired ordering along the axis
axis (int): 0, permute rows; 1, permute columns
"""
if axis not in (0, 1):
raise ValueError("Axis mu... | python | def permute(self, ordering: np.ndarray, *, axis: int) -> None:
"""
Permute the view, by permuting its layers, attributes and graphs
Args:
ordering (np.ndarray): The desired ordering along the axis
axis (int): 0, permute rows; 1, permute columns
"""
if axis not in (0, 1):
raise ValueError("Axis mu... | [
"def",
"permute",
"(",
"self",
",",
"ordering",
":",
"np",
".",
"ndarray",
",",
"*",
",",
"axis",
":",
"int",
")",
"->",
"None",
":",
"if",
"axis",
"not",
"in",
"(",
"0",
",",
"1",
")",
":",
"raise",
"ValueError",
"(",
"\"Axis must be 0 (rows) or 1 (... | Permute the view, by permuting its layers, attributes and graphs
Args:
ordering (np.ndarray): The desired ordering along the axis
axis (int): 0, permute rows; 1, permute columns | [
"Permute",
"the",
"view",
"by",
"permuting",
"its",
"layers",
"attributes",
"and",
"graphs"
] | 62c8373a92b058753baa3a95331fb541f560f599 | https://github.com/linnarsson-lab/loompy/blob/62c8373a92b058753baa3a95331fb541f560f599/loompy/loom_view.py#L45-L68 | train |
linnarsson-lab/loompy | loompy/loom_layer.py | MemoryLoomLayer.permute | def permute(self, ordering: np.ndarray, *, axis: int) -> None:
"""
Permute the layer along an axis
Args:
axis: The axis to permute (0, permute the rows; 1, permute the columns)
ordering: The permutation vector
"""
if axis == 0:
self.values = self.values[ordering, :]
elif axis == 1:
self.values ... | python | def permute(self, ordering: np.ndarray, *, axis: int) -> None:
"""
Permute the layer along an axis
Args:
axis: The axis to permute (0, permute the rows; 1, permute the columns)
ordering: The permutation vector
"""
if axis == 0:
self.values = self.values[ordering, :]
elif axis == 1:
self.values ... | [
"def",
"permute",
"(",
"self",
",",
"ordering",
":",
"np",
".",
"ndarray",
",",
"*",
",",
"axis",
":",
"int",
")",
"->",
"None",
":",
"if",
"axis",
"==",
"0",
":",
"self",
".",
"values",
"=",
"self",
".",
"values",
"[",
"ordering",
",",
":",
"]... | Permute the layer along an axis
Args:
axis: The axis to permute (0, permute the rows; 1, permute the columns)
ordering: The permutation vector | [
"Permute",
"the",
"layer",
"along",
"an",
"axis"
] | 62c8373a92b058753baa3a95331fb541f560f599 | https://github.com/linnarsson-lab/loompy/blob/62c8373a92b058753baa3a95331fb541f560f599/loompy/loom_layer.py#L30-L43 | train |
linnarsson-lab/loompy | loompy/loom_layer.py | LoomLayer._resize | def _resize(self, size: Tuple[int, int], axis: int = None) -> None:
"""Resize the dataset, or the specified axis.
The dataset must be stored in chunked format; it can be resized up to the "maximum shape" (keyword maxshape) specified at creation time.
The rank of the dataset cannot be changed.
"Size" should be ... | python | def _resize(self, size: Tuple[int, int], axis: int = None) -> None:
"""Resize the dataset, or the specified axis.
The dataset must be stored in chunked format; it can be resized up to the "maximum shape" (keyword maxshape) specified at creation time.
The rank of the dataset cannot be changed.
"Size" should be ... | [
"def",
"_resize",
"(",
"self",
",",
"size",
":",
"Tuple",
"[",
"int",
",",
"int",
"]",
",",
"axis",
":",
"int",
"=",
"None",
")",
"->",
"None",
":",
"if",
"self",
".",
"name",
"==",
"\"\"",
":",
"self",
".",
"ds",
".",
"_file",
"[",
"'/matrix'"... | Resize the dataset, or the specified axis.
The dataset must be stored in chunked format; it can be resized up to the "maximum shape" (keyword maxshape) specified at creation time.
The rank of the dataset cannot be changed.
"Size" should be a shape tuple, or if an axis is specified, an integer.
BEWARE: This fu... | [
"Resize",
"the",
"dataset",
"or",
"the",
"specified",
"axis",
"."
] | 62c8373a92b058753baa3a95331fb541f560f599 | https://github.com/linnarsson-lab/loompy/blob/62c8373a92b058753baa3a95331fb541f560f599/loompy/loom_layer.py#L130-L144 | train |
optimizely/python-sdk | optimizely/helpers/validator.py | is_datafile_valid | def is_datafile_valid(datafile):
""" Given a datafile determine if it is valid or not.
Args:
datafile: JSON string representing the project.
Returns:
Boolean depending upon whether datafile is valid or not.
"""
try:
datafile_json = json.loads(datafile)
except:
return False
try:
jso... | python | def is_datafile_valid(datafile):
""" Given a datafile determine if it is valid or not.
Args:
datafile: JSON string representing the project.
Returns:
Boolean depending upon whether datafile is valid or not.
"""
try:
datafile_json = json.loads(datafile)
except:
return False
try:
jso... | [
"def",
"is_datafile_valid",
"(",
"datafile",
")",
":",
"try",
":",
"datafile_json",
"=",
"json",
".",
"loads",
"(",
"datafile",
")",
"except",
":",
"return",
"False",
"try",
":",
"jsonschema",
".",
"Draft4Validator",
"(",
"constants",
".",
"JSON_SCHEMA",
")"... | Given a datafile determine if it is valid or not.
Args:
datafile: JSON string representing the project.
Returns:
Boolean depending upon whether datafile is valid or not. | [
"Given",
"a",
"datafile",
"determine",
"if",
"it",
"is",
"valid",
"or",
"not",
"."
] | ec028d9efcf22498c3820f2650fa10f5c30bec90 | https://github.com/optimizely/python-sdk/blob/ec028d9efcf22498c3820f2650fa10f5c30bec90/optimizely/helpers/validator.py#L24-L44 | train |
optimizely/python-sdk | optimizely/helpers/validator.py | is_user_profile_valid | def is_user_profile_valid(user_profile):
""" Determine if provided user profile is valid or not.
Args:
user_profile: User's profile which needs to be validated.
Returns:
Boolean depending upon whether profile is valid or not.
"""
if not user_profile:
return False
if not type(user_profile) is... | python | def is_user_profile_valid(user_profile):
""" Determine if provided user profile is valid or not.
Args:
user_profile: User's profile which needs to be validated.
Returns:
Boolean depending upon whether profile is valid or not.
"""
if not user_profile:
return False
if not type(user_profile) is... | [
"def",
"is_user_profile_valid",
"(",
"user_profile",
")",
":",
"if",
"not",
"user_profile",
":",
"return",
"False",
"if",
"not",
"type",
"(",
"user_profile",
")",
"is",
"dict",
":",
"return",
"False",
"if",
"UserProfile",
".",
"USER_ID_KEY",
"not",
"in",
"us... | Determine if provided user profile is valid or not.
Args:
user_profile: User's profile which needs to be validated.
Returns:
Boolean depending upon whether profile is valid or not. | [
"Determine",
"if",
"provided",
"user",
"profile",
"is",
"valid",
"or",
"not",
"."
] | ec028d9efcf22498c3820f2650fa10f5c30bec90 | https://github.com/optimizely/python-sdk/blob/ec028d9efcf22498c3820f2650fa10f5c30bec90/optimizely/helpers/validator.py#L126-L156 | train |
optimizely/python-sdk | optimizely/helpers/validator.py | is_attribute_valid | def is_attribute_valid(attribute_key, attribute_value):
""" Determine if given attribute is valid.
Args:
attribute_key: Variable which needs to be validated
attribute_value: Variable which needs to be validated
Returns:
False if attribute_key is not a string
False if attribute_value is not one o... | python | def is_attribute_valid(attribute_key, attribute_value):
""" Determine if given attribute is valid.
Args:
attribute_key: Variable which needs to be validated
attribute_value: Variable which needs to be validated
Returns:
False if attribute_key is not a string
False if attribute_value is not one o... | [
"def",
"is_attribute_valid",
"(",
"attribute_key",
",",
"attribute_value",
")",
":",
"if",
"not",
"isinstance",
"(",
"attribute_key",
",",
"string_types",
")",
":",
"return",
"False",
"if",
"isinstance",
"(",
"attribute_value",
",",
"(",
"string_types",
",",
"bo... | Determine if given attribute is valid.
Args:
attribute_key: Variable which needs to be validated
attribute_value: Variable which needs to be validated
Returns:
False if attribute_key is not a string
False if attribute_value is not one of the supported attribute types
True otherwise | [
"Determine",
"if",
"given",
"attribute",
"is",
"valid",
"."
] | ec028d9efcf22498c3820f2650fa10f5c30bec90 | https://github.com/optimizely/python-sdk/blob/ec028d9efcf22498c3820f2650fa10f5c30bec90/optimizely/helpers/validator.py#L174-L196 | train |
optimizely/python-sdk | optimizely/helpers/validator.py | is_finite_number | def is_finite_number(value):
""" Validates if the given value is a number, enforces
absolute limit of 2^53 and restricts NAN, INF, -INF.
Args:
value: Value to be validated.
Returns:
Boolean: True if value is a number and not NAN, INF, -INF or
greater than absolute limit of 2^53 else Fals... | python | def is_finite_number(value):
""" Validates if the given value is a number, enforces
absolute limit of 2^53 and restricts NAN, INF, -INF.
Args:
value: Value to be validated.
Returns:
Boolean: True if value is a number and not NAN, INF, -INF or
greater than absolute limit of 2^53 else Fals... | [
"def",
"is_finite_number",
"(",
"value",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"(",
"numbers",
".",
"Integral",
",",
"float",
")",
")",
":",
"# numbers.Integral instead of int to accomodate long integer in python 2",
"return",
"False",
"if",
"isins... | Validates if the given value is a number, enforces
absolute limit of 2^53 and restricts NAN, INF, -INF.
Args:
value: Value to be validated.
Returns:
Boolean: True if value is a number and not NAN, INF, -INF or
greater than absolute limit of 2^53 else False. | [
"Validates",
"if",
"the",
"given",
"value",
"is",
"a",
"number",
"enforces",
"absolute",
"limit",
"of",
"2^53",
"and",
"restricts",
"NAN",
"INF",
"-",
"INF",
"."
] | ec028d9efcf22498c3820f2650fa10f5c30bec90 | https://github.com/optimizely/python-sdk/blob/ec028d9efcf22498c3820f2650fa10f5c30bec90/optimizely/helpers/validator.py#L199-L225 | train |
optimizely/python-sdk | optimizely/helpers/validator.py | are_values_same_type | def are_values_same_type(first_val, second_val):
""" Method to verify that both values belong to same type. Float and integer are
considered as same type.
Args:
first_val: Value to validate.
second_Val: Value to validate.
Returns:
Boolean: True if both values belong to same type. Otherwise False.
... | python | def are_values_same_type(first_val, second_val):
""" Method to verify that both values belong to same type. Float and integer are
considered as same type.
Args:
first_val: Value to validate.
second_Val: Value to validate.
Returns:
Boolean: True if both values belong to same type. Otherwise False.
... | [
"def",
"are_values_same_type",
"(",
"first_val",
",",
"second_val",
")",
":",
"first_val_type",
"=",
"type",
"(",
"first_val",
")",
"second_val_type",
"=",
"type",
"(",
"second_val",
")",
"# use isinstance to accomodate Python 2 unicode and str types.",
"if",
"isinstance"... | Method to verify that both values belong to same type. Float and integer are
considered as same type.
Args:
first_val: Value to validate.
second_Val: Value to validate.
Returns:
Boolean: True if both values belong to same type. Otherwise False. | [
"Method",
"to",
"verify",
"that",
"both",
"values",
"belong",
"to",
"same",
"type",
".",
"Float",
"and",
"integer",
"are",
"considered",
"as",
"same",
"type",
"."
] | ec028d9efcf22498c3820f2650fa10f5c30bec90 | https://github.com/optimizely/python-sdk/blob/ec028d9efcf22498c3820f2650fa10f5c30bec90/optimizely/helpers/validator.py#L228-L255 | train |
optimizely/python-sdk | optimizely/logger.py | reset_logger | def reset_logger(name, level=None, handler=None):
"""
Make a standard python logger object with default formatter, handler, etc.
Defaults are:
- level == logging.INFO
- handler == logging.StreamHandler()
Args:
name: a logger name.
level: an optional initial log level for this logger.
handl... | python | def reset_logger(name, level=None, handler=None):
"""
Make a standard python logger object with default formatter, handler, etc.
Defaults are:
- level == logging.INFO
- handler == logging.StreamHandler()
Args:
name: a logger name.
level: an optional initial log level for this logger.
handl... | [
"def",
"reset_logger",
"(",
"name",
",",
"level",
"=",
"None",
",",
"handler",
"=",
"None",
")",
":",
"# Make the logger and set its level.",
"if",
"level",
"is",
"None",
":",
"level",
"=",
"logging",
".",
"INFO",
"logger",
"=",
"logging",
".",
"getLogger",
... | Make a standard python logger object with default formatter, handler, etc.
Defaults are:
- level == logging.INFO
- handler == logging.StreamHandler()
Args:
name: a logger name.
level: an optional initial log level for this logger.
handler: an optional initial handler for this logger.
Return... | [
"Make",
"a",
"standard",
"python",
"logger",
"object",
"with",
"default",
"formatter",
"handler",
"etc",
"."
] | ec028d9efcf22498c3820f2650fa10f5c30bec90 | https://github.com/optimizely/python-sdk/blob/ec028d9efcf22498c3820f2650fa10f5c30bec90/optimizely/logger.py#L22-L52 | train |
optimizely/python-sdk | optimizely/logger.py | adapt_logger | def adapt_logger(logger):
"""
Adapt our custom logger.BaseLogger object into a standard logging.Logger object.
Adaptations are:
- NoOpLogger turns into a logger with a single NullHandler.
- SimpleLogger turns into a logger with a StreamHandler and level.
Args:
logger: Possibly a logger.BaseLogger,... | python | def adapt_logger(logger):
"""
Adapt our custom logger.BaseLogger object into a standard logging.Logger object.
Adaptations are:
- NoOpLogger turns into a logger with a single NullHandler.
- SimpleLogger turns into a logger with a StreamHandler and level.
Args:
logger: Possibly a logger.BaseLogger,... | [
"def",
"adapt_logger",
"(",
"logger",
")",
":",
"if",
"isinstance",
"(",
"logger",
",",
"logging",
".",
"Logger",
")",
":",
"return",
"logger",
"# Use the standard python logger created by these classes.",
"if",
"isinstance",
"(",
"logger",
",",
"(",
"SimpleLogger",... | Adapt our custom logger.BaseLogger object into a standard logging.Logger object.
Adaptations are:
- NoOpLogger turns into a logger with a single NullHandler.
- SimpleLogger turns into a logger with a StreamHandler and level.
Args:
logger: Possibly a logger.BaseLogger, or a standard python logging.Logg... | [
"Adapt",
"our",
"custom",
"logger",
".",
"BaseLogger",
"object",
"into",
"a",
"standard",
"logging",
".",
"Logger",
"object",
"."
] | ec028d9efcf22498c3820f2650fa10f5c30bec90 | https://github.com/optimizely/python-sdk/blob/ec028d9efcf22498c3820f2650fa10f5c30bec90/optimizely/logger.py#L95-L117 | train |
optimizely/python-sdk | optimizely/user_profile.py | UserProfile.get_variation_for_experiment | def get_variation_for_experiment(self, experiment_id):
""" Helper method to retrieve variation ID for given experiment.
Args:
experiment_id: ID for experiment for which variation needs to be looked up for.
Returns:
Variation ID corresponding to the experiment. None if no decision available.
... | python | def get_variation_for_experiment(self, experiment_id):
""" Helper method to retrieve variation ID for given experiment.
Args:
experiment_id: ID for experiment for which variation needs to be looked up for.
Returns:
Variation ID corresponding to the experiment. None if no decision available.
... | [
"def",
"get_variation_for_experiment",
"(",
"self",
",",
"experiment_id",
")",
":",
"return",
"self",
".",
"experiment_bucket_map",
".",
"get",
"(",
"experiment_id",
",",
"{",
"self",
".",
"VARIATION_ID_KEY",
":",
"None",
"}",
")",
".",
"get",
"(",
"self",
"... | Helper method to retrieve variation ID for given experiment.
Args:
experiment_id: ID for experiment for which variation needs to be looked up for.
Returns:
Variation ID corresponding to the experiment. None if no decision available. | [
"Helper",
"method",
"to",
"retrieve",
"variation",
"ID",
"for",
"given",
"experiment",
"."
] | ec028d9efcf22498c3820f2650fa10f5c30bec90 | https://github.com/optimizely/python-sdk/blob/ec028d9efcf22498c3820f2650fa10f5c30bec90/optimizely/user_profile.py#L34-L44 | train |
optimizely/python-sdk | optimizely/helpers/event_tag_utils.py | get_numeric_value | def get_numeric_value(event_tags, logger=None):
"""
A smart getter of the numeric value from the event tags.
Args:
event_tags: A dictionary of event tags.
logger: Optional logger.
Returns:
A float numeric metric value is returned when the provided numeric
metric value is in the followi... | python | def get_numeric_value(event_tags, logger=None):
"""
A smart getter of the numeric value from the event tags.
Args:
event_tags: A dictionary of event tags.
logger: Optional logger.
Returns:
A float numeric metric value is returned when the provided numeric
metric value is in the followi... | [
"def",
"get_numeric_value",
"(",
"event_tags",
",",
"logger",
"=",
"None",
")",
":",
"logger_message_debug",
"=",
"None",
"numeric_metric_value",
"=",
"None",
"if",
"event_tags",
"is",
"None",
":",
"logger_message_debug",
"=",
"'Event tags is undefined.'",
"elif",
"... | A smart getter of the numeric value from the event tags.
Args:
event_tags: A dictionary of event tags.
logger: Optional logger.
Returns:
A float numeric metric value is returned when the provided numeric
metric value is in the following format:
- A string (properly formatted, e.g... | [
"A",
"smart",
"getter",
"of",
"the",
"numeric",
"value",
"from",
"the",
"event",
"tags",
"."
] | ec028d9efcf22498c3820f2650fa10f5c30bec90 | https://github.com/optimizely/python-sdk/blob/ec028d9efcf22498c3820f2650fa10f5c30bec90/optimizely/helpers/event_tag_utils.py#L43-L123 | train |
optimizely/python-sdk | optimizely/lib/pymmh3.py | hash | def hash( key, seed = 0x0 ):
''' Implements 32bit murmur3 hash. '''
key = bytearray( xencode(key) )
def fmix( h ):
h ^= h >> 16
h = ( h * 0x85ebca6b ) & 0xFFFFFFFF
h ^= h >> 13
h = ( h * 0xc2b2ae35 ) & 0xFFFFFFFF
h ^= h >> 16
return h
length = len( ke... | python | def hash( key, seed = 0x0 ):
''' Implements 32bit murmur3 hash. '''
key = bytearray( xencode(key) )
def fmix( h ):
h ^= h >> 16
h = ( h * 0x85ebca6b ) & 0xFFFFFFFF
h ^= h >> 13
h = ( h * 0xc2b2ae35 ) & 0xFFFFFFFF
h ^= h >> 16
return h
length = len( ke... | [
"def",
"hash",
"(",
"key",
",",
"seed",
"=",
"0x0",
")",
":",
"key",
"=",
"bytearray",
"(",
"xencode",
"(",
"key",
")",
")",
"def",
"fmix",
"(",
"h",
")",
":",
"h",
"^=",
"h",
">>",
"16",
"h",
"=",
"(",
"h",
"*",
"0x85ebca6b",
")",
"&",
"0x... | Implements 32bit murmur3 hash. | [
"Implements",
"32bit",
"murmur3",
"hash",
"."
] | ec028d9efcf22498c3820f2650fa10f5c30bec90 | https://github.com/optimizely/python-sdk/blob/ec028d9efcf22498c3820f2650fa10f5c30bec90/optimizely/lib/pymmh3.py#L34-L94 | train |
optimizely/python-sdk | optimizely/lib/pymmh3.py | hash64 | def hash64( key, seed = 0x0, x64arch = True ):
''' Implements 64bit murmur3 hash. Returns a tuple. '''
hash_128 = hash128( key, seed, x64arch )
unsigned_val1 = hash_128 & 0xFFFFFFFFFFFFFFFF
if unsigned_val1 & 0x8000000000000000 == 0:
signed_val1 = unsigned_val1
else:
signed_val1 = ... | python | def hash64( key, seed = 0x0, x64arch = True ):
''' Implements 64bit murmur3 hash. Returns a tuple. '''
hash_128 = hash128( key, seed, x64arch )
unsigned_val1 = hash_128 & 0xFFFFFFFFFFFFFFFF
if unsigned_val1 & 0x8000000000000000 == 0:
signed_val1 = unsigned_val1
else:
signed_val1 = ... | [
"def",
"hash64",
"(",
"key",
",",
"seed",
"=",
"0x0",
",",
"x64arch",
"=",
"True",
")",
":",
"hash_128",
"=",
"hash128",
"(",
"key",
",",
"seed",
",",
"x64arch",
")",
"unsigned_val1",
"=",
"hash_128",
"&",
"0xFFFFFFFFFFFFFFFF",
"if",
"unsigned_val1",
"&"... | Implements 64bit murmur3 hash. Returns a tuple. | [
"Implements",
"64bit",
"murmur3",
"hash",
".",
"Returns",
"a",
"tuple",
"."
] | ec028d9efcf22498c3820f2650fa10f5c30bec90 | https://github.com/optimizely/python-sdk/blob/ec028d9efcf22498c3820f2650fa10f5c30bec90/optimizely/lib/pymmh3.py#L406-L423 | train |
optimizely/python-sdk | optimizely/lib/pymmh3.py | hash_bytes | def hash_bytes( key, seed = 0x0, x64arch = True ):
''' Implements 128bit murmur3 hash. Returns a byte string. '''
hash_128 = hash128( key, seed, x64arch )
bytestring = ''
for i in xrange(0, 16, 1):
lsbyte = hash_128 & 0xFF
bytestring = bytestring + str( chr( lsbyte ) )
hash_12... | python | def hash_bytes( key, seed = 0x0, x64arch = True ):
''' Implements 128bit murmur3 hash. Returns a byte string. '''
hash_128 = hash128( key, seed, x64arch )
bytestring = ''
for i in xrange(0, 16, 1):
lsbyte = hash_128 & 0xFF
bytestring = bytestring + str( chr( lsbyte ) )
hash_12... | [
"def",
"hash_bytes",
"(",
"key",
",",
"seed",
"=",
"0x0",
",",
"x64arch",
"=",
"True",
")",
":",
"hash_128",
"=",
"hash128",
"(",
"key",
",",
"seed",
",",
"x64arch",
")",
"bytestring",
"=",
"''",
"for",
"i",
"in",
"xrange",
"(",
"0",
",",
"16",
"... | Implements 128bit murmur3 hash. Returns a byte string. | [
"Implements",
"128bit",
"murmur3",
"hash",
".",
"Returns",
"a",
"byte",
"string",
"."
] | ec028d9efcf22498c3820f2650fa10f5c30bec90 | https://github.com/optimizely/python-sdk/blob/ec028d9efcf22498c3820f2650fa10f5c30bec90/optimizely/lib/pymmh3.py#L426-L438 | train |
optimizely/python-sdk | optimizely/bucketer.py | Bucketer._generate_bucket_value | def _generate_bucket_value(self, bucketing_id):
""" Helper function to generate bucket value in half-closed interval [0, MAX_TRAFFIC_VALUE).
Args:
bucketing_id: ID for bucketing.
Returns:
Bucket value corresponding to the provided bucketing ID.
"""
ratio = float(self._generate_unsigne... | python | def _generate_bucket_value(self, bucketing_id):
""" Helper function to generate bucket value in half-closed interval [0, MAX_TRAFFIC_VALUE).
Args:
bucketing_id: ID for bucketing.
Returns:
Bucket value corresponding to the provided bucketing ID.
"""
ratio = float(self._generate_unsigne... | [
"def",
"_generate_bucket_value",
"(",
"self",
",",
"bucketing_id",
")",
":",
"ratio",
"=",
"float",
"(",
"self",
".",
"_generate_unsigned_hash_code_32_bit",
"(",
"bucketing_id",
")",
")",
"/",
"MAX_HASH_VALUE",
"return",
"math",
".",
"floor",
"(",
"ratio",
"*",
... | Helper function to generate bucket value in half-closed interval [0, MAX_TRAFFIC_VALUE).
Args:
bucketing_id: ID for bucketing.
Returns:
Bucket value corresponding to the provided bucketing ID. | [
"Helper",
"function",
"to",
"generate",
"bucket",
"value",
"in",
"half",
"-",
"closed",
"interval",
"[",
"0",
"MAX_TRAFFIC_VALUE",
")",
"."
] | ec028d9efcf22498c3820f2650fa10f5c30bec90 | https://github.com/optimizely/python-sdk/blob/ec028d9efcf22498c3820f2650fa10f5c30bec90/optimizely/bucketer.py#L55-L66 | train |
optimizely/python-sdk | optimizely/bucketer.py | Bucketer.find_bucket | def find_bucket(self, bucketing_id, parent_id, traffic_allocations):
""" Determine entity based on bucket value and traffic allocations.
Args:
bucketing_id: ID to be used for bucketing the user.
parent_id: ID representing group or experiment.
traffic_allocations: Traffic allocations represent... | python | def find_bucket(self, bucketing_id, parent_id, traffic_allocations):
""" Determine entity based on bucket value and traffic allocations.
Args:
bucketing_id: ID to be used for bucketing the user.
parent_id: ID representing group or experiment.
traffic_allocations: Traffic allocations represent... | [
"def",
"find_bucket",
"(",
"self",
",",
"bucketing_id",
",",
"parent_id",
",",
"traffic_allocations",
")",
":",
"bucketing_key",
"=",
"BUCKETING_ID_TEMPLATE",
".",
"format",
"(",
"bucketing_id",
"=",
"bucketing_id",
",",
"parent_id",
"=",
"parent_id",
")",
"bucket... | Determine entity based on bucket value and traffic allocations.
Args:
bucketing_id: ID to be used for bucketing the user.
parent_id: ID representing group or experiment.
traffic_allocations: Traffic allocations representing traffic allotted to experiments or variations.
Returns:
Entity... | [
"Determine",
"entity",
"based",
"on",
"bucket",
"value",
"and",
"traffic",
"allocations",
"."
] | ec028d9efcf22498c3820f2650fa10f5c30bec90 | https://github.com/optimizely/python-sdk/blob/ec028d9efcf22498c3820f2650fa10f5c30bec90/optimizely/bucketer.py#L68-L92 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.