body stringlengths 26 98.2k | body_hash int64 -9,222,864,604,528,158,000 9,221,803,474B | docstring stringlengths 1 16.8k | path stringlengths 5 230 | name stringlengths 1 96 | repository_name stringlengths 7 89 | lang stringclasses 1
value | body_without_docstring stringlengths 20 98.2k |
|---|---|---|---|---|---|---|---|
def _specialized_reduce_window(reducer, identity, operand, *, window_dimensions, window_strides, padding, base_dilation, window_dilation, _in_avals, _out_aval, name=None):
'Wraps the TensorFlow reduce window operation based on a reducer and an\n\n identity function defining the initial value of the reduction depen... | -2,846,017,248,677,970,000 | Wraps the TensorFlow reduce window operation based on a reducer and an
identity function defining the initial value of the reduction depending on
the dtype of the operand.
Args:
reducer: reduction function of type TfVal -> TfVal -> TfVal
identity: function that takes a TensorFlow dtype as a parameter and returns
... | jax/experimental/jax2tf/jax2tf.py | _specialized_reduce_window | ho-oto/jax | python | def _specialized_reduce_window(reducer, identity, operand, *, window_dimensions, window_strides, padding, base_dilation, window_dilation, _in_avals, _out_aval, name=None):
'Wraps the TensorFlow reduce window operation based on a reducer and an\n\n identity function defining the initial value of the reduction depen... |
@functools.partial(bool_to_int8, argnums=0)
def _gather(operand, start_indices, *, dimension_numbers, slice_sizes, _in_avals, _out_aval):
'Tensorflow implementation of gather.'
del _in_avals
if (not _enable_xla):
raise _xla_disabled_error('gather')
proto = _gather_dimensions_proto(start_indices.... | -6,924,293,510,355,507,000 | Tensorflow implementation of gather. | jax/experimental/jax2tf/jax2tf.py | _gather | ho-oto/jax | python | @functools.partial(bool_to_int8, argnums=0)
def _gather(operand, start_indices, *, dimension_numbers, slice_sizes, _in_avals, _out_aval):
del _in_avals
if (not _enable_xla):
raise _xla_disabled_error('gather')
proto = _gather_dimensions_proto(start_indices.shape, dimension_numbers)
slice_si... |
def _batched_cond_while(*args: TfVal, cond_nconsts: int, cond_jaxpr: core.ClosedJaxpr, body_nconsts: int, body_jaxpr: core.ClosedJaxpr) -> Sequence[TfVal]:
'Interprets a while_loop with a batched condition.\n\n A batched while has a conditional that returns a tensor of booleans, and\n a body that returns a list o... | 7,896,480,710,783,111,000 | Interprets a while_loop with a batched condition.
A batched while has a conditional that returns a tensor of booleans, and
a body that returns a list of tensors whose leading dimensions match those
of the conditional tensor.
We need to turn it into a while with scalar boolean conditional. We will
expand the loop carr... | jax/experimental/jax2tf/jax2tf.py | _batched_cond_while | ho-oto/jax | python | def _batched_cond_while(*args: TfVal, cond_nconsts: int, cond_jaxpr: core.ClosedJaxpr, body_nconsts: int, body_jaxpr: core.ClosedJaxpr) -> Sequence[TfVal]:
'Interprets a while_loop with a batched condition.\n\n A batched while has a conditional that returns a tensor of booleans, and\n a body that returns a list o... |
def split_to_logical_devices(tensor: TfVal, partition_dimensions: pxla.PartitionsOrReplicated):
'Like TPUMPStrategy.experimental_split_to_logical_devices.\n\n For jax2tf purposes we want to avoid needing to thread the `strategy` object\n through the generated computation. It seems that the original function needs... | 743,899,538,745,615,900 | Like TPUMPStrategy.experimental_split_to_logical_devices.
For jax2tf purposes we want to avoid needing to thread the `strategy` object
through the generated computation. It seems that the original function needs
the strategy object only for error checking, which we assume is done upstream
by JAX.
Args:
tensor: Inpu... | jax/experimental/jax2tf/jax2tf.py | split_to_logical_devices | ho-oto/jax | python | def split_to_logical_devices(tensor: TfVal, partition_dimensions: pxla.PartitionsOrReplicated):
'Like TPUMPStrategy.experimental_split_to_logical_devices.\n\n For jax2tf purposes we want to avoid needing to thread the `strategy` object\n through the generated computation. It seems that the original function needs... |
def _register_checkpoint_pytrees():
'Registers TF custom container types as pytrees.'
m = tf.Module()
m.a = (tf.Module(), tf.Module())
m.b = [tf.Module(), tf.Module()]
m.c = {'a': tf.Module()}
tuple_wrapper = type(m.a)
list_wrapper = type(m.b)
dict_wrapper = type(m.c)
assert (tuple_w... | 1,120,869,914,977,872,300 | Registers TF custom container types as pytrees. | jax/experimental/jax2tf/jax2tf.py | _register_checkpoint_pytrees | ho-oto/jax | python | def _register_checkpoint_pytrees():
m = tf.Module()
m.a = (tf.Module(), tf.Module())
m.b = [tf.Module(), tf.Module()]
m.c = {'a': tf.Module()}
tuple_wrapper = type(m.a)
list_wrapper = type(m.b)
dict_wrapper = type(m.c)
assert (tuple_wrapper is not tuple)
assert (list_wrapper is ... |
def input_aval(arg: TfVal, polymorphic_shape: Optional[str]) -> core.AbstractValue:
'The abstract value for an input.'
(raw_shape, dtype) = _tfval_shape_dtype(arg)
aval_shape = shape_poly.parse_spec(polymorphic_shape, raw_shape)
for (i, d) in enumerate(aval_shape):
if (type(d) is int):
... | 7,555,518,512,864,666,000 | The abstract value for an input. | jax/experimental/jax2tf/jax2tf.py | input_aval | ho-oto/jax | python | def input_aval(arg: TfVal, polymorphic_shape: Optional[str]) -> core.AbstractValue:
(raw_shape, dtype) = _tfval_shape_dtype(arg)
aval_shape = shape_poly.parse_spec(polymorphic_shape, raw_shape)
for (i, d) in enumerate(aval_shape):
if (type(d) is int):
assert (d == np.shape(arg)[i])
... |
def pure(self, val: Union[(TfVal, core.Unit)]) -> TensorFlowTracer:
'Lifts a non-Tracer into the TensorFlowTracer.\n\n This function may be called by way of trace.full_raise.\n\n The value may be a core.unit. During JAX transformations we sometimes\n produce a Jaxpr that has arguments of abstract value cor... | 7,683,155,972,124,569,000 | Lifts a non-Tracer into the TensorFlowTracer.
This function may be called by way of trace.full_raise.
The value may be a core.unit. During JAX transformations we sometimes
produce a Jaxpr that has arguments of abstract value core.abstract_unit
and results equal to core.unit. These are arguments and results that are
n... | jax/experimental/jax2tf/jax2tf.py | pure | ho-oto/jax | python | def pure(self, val: Union[(TfVal, core.Unit)]) -> TensorFlowTracer:
'Lifts a non-Tracer into the TensorFlowTracer.\n\n This function may be called by way of trace.full_raise.\n\n The value may be a core.unit. During JAX transformations we sometimes\n produce a Jaxpr that has arguments of abstract value cor... |
def _sanitize_vmr(df):
"Filters entries with '511' error, impossibly high speed, abnormally\n high vessel width, as well as singletons (only one entry) from vessel\n movement DataFrame.\n\n Args:\n df: Vessel movement DataFrame.\n\n Returns:\n Sanitized vessel movement report DataFrame.\n ... | -3,351,735,100,606,929,000 | Filters entries with '511' error, impossibly high speed, abnormally
high vessel width, as well as singletons (only one entry) from vessel
movement DataFrame.
Args:
df: Vessel movement DataFrame.
Returns:
Sanitized vessel movement report DataFrame. | src/process_maritime_data.py | _sanitize_vmr | maritime-whale/maritime-whale | python | def _sanitize_vmr(df):
"Filters entries with '511' error, impossibly high speed, abnormally\n high vessel width, as well as singletons (only one entry) from vessel\n movement DataFrame.\n\n Args:\n df: Vessel movement DataFrame.\n\n Returns:\n Sanitized vessel movement report DataFrame.\n ... |
def _wrangle_vmr(df, rename):
'Rounds, renames, and sanitizes vessel movment DataFrame. Creates new\n columns.\n\n Args:\n df: Vessel movement DataFrame.\n\n Returns:\n Cleaned vessel movement report DataFrame.\n '
df.rename(rename, axis=1, inplace=True)
df.loc[:, 'LOA ft'] = ((df.... | -989,017,253,561,720,400 | Rounds, renames, and sanitizes vessel movment DataFrame. Creates new
columns.
Args:
df: Vessel movement DataFrame.
Returns:
Cleaned vessel movement report DataFrame. | src/process_maritime_data.py | _wrangle_vmr | maritime-whale/maritime-whale | python | def _wrangle_vmr(df, rename):
'Rounds, renames, and sanitizes vessel movment DataFrame. Creates new\n columns.\n\n Args:\n df: Vessel movement DataFrame.\n\n Returns:\n Cleaned vessel movement report DataFrame.\n '
df.rename(rename, axis=1, inplace=True)
df.loc[:, 'LOA ft'] = ((df.... |
def _filter_blacklisters(df, blacklist):
"Checks vessel AIS types and ommits blacklisted vessel types from the\n filtered data. Appends ommitted vessels' MMSI's to blacklist.txt.\n\n Args:\n df: Vessel movement DataFrame.\n\n Returns:\n Filtered vessel movement DataFrame.\n "
df = df.l... | -8,168,049,235,057,531,000 | Checks vessel AIS types and ommits blacklisted vessel types from the
filtered data. Appends ommitted vessels' MMSI's to blacklist.txt.
Args:
df: Vessel movement DataFrame.
Returns:
Filtered vessel movement DataFrame. | src/process_maritime_data.py | _filter_blacklisters | maritime-whale/maritime-whale | python | def _filter_blacklisters(df, blacklist):
"Checks vessel AIS types and ommits blacklisted vessel types from the\n filtered data. Appends ommitted vessels' MMSI's to blacklist.txt.\n\n Args:\n df: Vessel movement DataFrame.\n\n Returns:\n Filtered vessel movement DataFrame.\n "
df = df.l... |
def _fold_vmr(ports, i):
"Reduces movement report to a DataFrame with a single entry for each\n vessel at the point of it's maximum speed in the channel. Includes a column\n with the vessel's mean speed.\n "
mean = pd.DataFrame(ports[i].groupby(['Name', 'MMSI'])['VSPD kn'].mean()).rename({'VSPD kn': 'M... | -9,088,070,299,274,554,000 | Reduces movement report to a DataFrame with a single entry for each
vessel at the point of it's maximum speed in the channel. Includes a column
with the vessel's mean speed. | src/process_maritime_data.py | _fold_vmr | maritime-whale/maritime-whale | python | def _fold_vmr(ports, i):
"Reduces movement report to a DataFrame with a single entry for each\n vessel at the point of it's maximum speed in the channel. Includes a column\n with the vessel's mean speed.\n "
mean = pd.DataFrame(ports[i].groupby(['Name', 'MMSI'])['VSPD kn'].mean()).rename({'VSPD kn': 'M... |
def _add_channel_occ(ports, i):
'Creates the channel occupancy column.'
channel_width = [[800, 400, 1000, 500], [600, 300, 600, 300]]
for row in range(len(ports[i])):
vessel_class = ports[i].loc[(row, 'Class')]
transit_type = ports[i].loc[(row, 'Transit')]
eff_beam = ports[i].loc[(ro... | -5,192,526,610,262,582,000 | Creates the channel occupancy column. | src/process_maritime_data.py | _add_channel_occ | maritime-whale/maritime-whale | python | def _add_channel_occ(ports, i):
channel_width = [[800, 400, 1000, 500], [600, 300, 600, 300]]
for row in range(len(ports[i])):
vessel_class = ports[i].loc[(row, 'Class')]
transit_type = ports[i].loc[(row, 'Transit')]
eff_beam = ports[i].loc[(row, 'Effective Beam ft')]
if ((v... |
def _add_vessel_class(df):
"Creates 'Class' column based on vessel LOA ft."
df.loc[:, 'Class'] = 'Panamax'
post_row = (df.loc[:, 'LOA ft'] > 965)
post_loc = df.loc[post_row, :].index
post_pan = df.index.isin(post_loc)
df.loc[(post_pan, 'Class')] = 'Post-Panamax'
return df | -4,006,407,265,137,668,000 | Creates 'Class' column based on vessel LOA ft. | src/process_maritime_data.py | _add_vessel_class | maritime-whale/maritime-whale | python | def _add_vessel_class(df):
df.loc[:, 'Class'] = 'Panamax'
post_row = (df.loc[:, 'LOA ft'] > 965)
post_loc = df.loc[post_row, :].index
post_pan = df.index.isin(post_loc)
df.loc[(post_pan, 'Class')] = 'Post-Panamax'
return df |
def _course_behavior(df, ranges):
"Creates 'Course Behavior' column based on channel specific course ranges.\n "
course_behavior = ('Outbound', 'Inbound')
df = df[(((df.loc[:, 'Course'] >= ranges[0][0]) & (df.loc[:, 'Course'] <= ranges[0][1])) | ((df.loc[:, 'Course'] >= ranges[1][0]) & (df.loc[:, 'Course... | 2,992,146,113,907,691,000 | Creates 'Course Behavior' column based on channel specific course ranges. | src/process_maritime_data.py | _course_behavior | maritime-whale/maritime-whale | python | def _course_behavior(df, ranges):
"\n "
course_behavior = ('Outbound', 'Inbound')
df = df[(((df.loc[:, 'Course'] >= ranges[0][0]) & (df.loc[:, 'Course'] <= ranges[0][1])) | ((df.loc[:, 'Course'] >= ranges[1][0]) & (df.loc[:, 'Course'] <= ranges[1][1])))]
df.loc[:, 'Course'] = round(df.loc[:, 'Course'... |
def process_report(path):
'Processes data from vessel movement report. Adds data from wind buoys,\n performs meeting and passing analysis. Creates other relevant columns.\n\n Args:\n path: Relative path to raw vessel movement report (CSV).\n\n Returns:\n Two pairs of two DataFrames coorespond... | 8,551,263,354,269,532,000 | Processes data from vessel movement report. Adds data from wind buoys,
performs meeting and passing analysis. Creates other relevant columns.
Args:
path: Relative path to raw vessel movement report (CSV).
Returns:
Two pairs of two DataFrames cooresponding to the movement report.
The first pair of DataFram... | src/process_maritime_data.py | process_report | maritime-whale/maritime-whale | python | def process_report(path):
'Processes data from vessel movement report. Adds data from wind buoys,\n performs meeting and passing analysis. Creates other relevant columns.\n\n Args:\n path: Relative path to raw vessel movement report (CSV).\n\n Returns:\n Two pairs of two DataFrames coorespond... |
def toggleCons(state):
"\n\tToggle the display state of all joint buffers ('Con') in the scene\n\t@param state: The display state to set the joint buffers to\n\t@type state: bool\n\t"
conList = mc.ls('*Con*_jnt', type='joint')
for conJnt in conList:
if state:
glTools.utils.base.displayOv... | -961,874,778,851,118,700 | Toggle the display state of all joint buffers ('Con') in the scene
@param state: The display state to set the joint buffers to
@type state: bool | utils/cleanup.py | toggleCons | Lynn5160/glTools | python | def toggleCons(state):
"\n\tToggle the display state of all joint buffers ('Con') in the scene\n\t@param state: The display state to set the joint buffers to\n\t@type state: bool\n\t"
conList = mc.ls('*Con*_jnt', type='joint')
for conJnt in conList:
if state:
glTools.utils.base.displayOv... |
def toggleEnds(state):
"\n\tToggle the display state of all joint buffers ('Con') in the scene\n\t@param state: The display state to set the joint buffers to\n\t@type state: bool\n\t"
endList = mc.ls('*End_jnt', type='joint')
for endJnt in endList:
if state:
glTools.utils.base.displayOve... | -2,402,898,115,426,025,000 | Toggle the display state of all joint buffers ('Con') in the scene
@param state: The display state to set the joint buffers to
@type state: bool | utils/cleanup.py | toggleEnds | Lynn5160/glTools | python | def toggleEnds(state):
"\n\tToggle the display state of all joint buffers ('Con') in the scene\n\t@param state: The display state to set the joint buffers to\n\t@type state: bool\n\t"
endList = mc.ls('*End_jnt', type='joint')
for endJnt in endList:
if state:
glTools.utils.base.displayOve... |
def disableDrawingOverrides(grp):
'\n\tDisable drawing overrides for all DAG descendents of the specified transform node.\n\t@param state: The transform under which all descendent node drawing overrides will be disabled.\n\t@type state: bool\n\t'
if (not mc.objExists(grp)):
raise Exception((('Transform ... | 3,805,511,487,215,523,300 | Disable drawing overrides for all DAG descendents of the specified transform node.
@param state: The transform under which all descendent node drawing overrides will be disabled.
@type state: bool | utils/cleanup.py | disableDrawingOverrides | Lynn5160/glTools | python | def disableDrawingOverrides(grp):
'\n\tDisable drawing overrides for all DAG descendents of the specified transform node.\n\t@param state: The transform under which all descendent node drawing overrides will be disabled.\n\t@type state: bool\n\t'
if (not mc.objExists(grp)):
raise Exception((('Transform ... |
def uniqueNameCheck(objList=[], transformsOnly=False):
'\n\tReturn a list of nodes with non unique names\n\t@param objList: List of scene objects to check. If empty, use all existing scene nodes.\n\t@type objList: list\n\t@param transformsOnly: Check transform names only\n\t@type transformsOnly: bool\n\t'
if (n... | 4,268,287,513,546,254,300 | Return a list of nodes with non unique names
@param objList: List of scene objects to check. If empty, use all existing scene nodes.
@type objList: list
@param transformsOnly: Check transform names only
@type transformsOnly: bool | utils/cleanup.py | uniqueNameCheck | Lynn5160/glTools | python | def uniqueNameCheck(objList=[], transformsOnly=False):
'\n\tReturn a list of nodes with non unique names\n\t@param objList: List of scene objects to check. If empty, use all existing scene nodes.\n\t@type objList: list\n\t@param transformsOnly: Check transform names only\n\t@type transformsOnly: bool\n\t'
if (n... |
def validNameCheck(objList=[]):
'\n\tCheck for valid names in the specified list of nodes\n\t@param objList: List of objects to check valid names for. If empty use all scene transforms\n\t@type objList: list\n\t'
if (not objList):
objList = mc.ls()
if (not objList):
return []
defNodes = ... | 452,050,471,396,400,640 | Check for valid names in the specified list of nodes
@param objList: List of objects to check valid names for. If empty use all scene transforms
@type objList: list | utils/cleanup.py | validNameCheck | Lynn5160/glTools | python | def validNameCheck(objList=[]):
'\n\tCheck for valid names in the specified list of nodes\n\t@param objList: List of objects to check valid names for. If empty use all scene transforms\n\t@type objList: list\n\t'
if (not objList):
objList = mc.ls()
if (not objList):
return []
defNodes = ... |
def shapeNameCheck(objList=[], typeList=['mesh', 'nurbsCurve', 'nurbsSurface'], skipIntermediates=True, skipMultipleShapes=False, strict=True):
'\n\tReturn a list of incorrectly named geometry shape nodes.\n\t@param objList: List of objects to check for valid shape names. If empty, get all nodes of the specified ty... | 1,147,560,374,976,238,800 | Return a list of incorrectly named geometry shape nodes.
@param objList: List of objects to check for valid shape names. If empty, get all nodes of the specified type.
@type objList: list
@param typeList: List of shape types to check for valid names.
@type typeList: list
@param skipIntermediates: Skip intermediate shap... | utils/cleanup.py | shapeNameCheck | Lynn5160/glTools | python | def shapeNameCheck(objList=[], typeList=['mesh', 'nurbsCurve', 'nurbsSurface'], skipIntermediates=True, skipMultipleShapes=False, strict=True):
'\n\tReturn a list of incorrectly named geometry shape nodes.\n\t@param objList: List of objects to check for valid shape names. If empty, get all nodes of the specified ty... |
def intermediateShapesCheck(objList=[]):
'\n\tReturn a list of intermediate shapes.\n\t@param objList: List of objects to check for intermediate shapes.\n\t@type objList: list\n\t'
if (not objList):
objList = mc.ls(transforms=True)
else:
objList = mc.ls(objList, transforms=True)
result =... | 2,082,085,046,468,773,400 | Return a list of intermediate shapes.
@param objList: List of objects to check for intermediate shapes.
@type objList: list | utils/cleanup.py | intermediateShapesCheck | Lynn5160/glTools | python | def intermediateShapesCheck(objList=[]):
'\n\tReturn a list of intermediate shapes.\n\t@param objList: List of objects to check for intermediate shapes.\n\t@type objList: list\n\t'
if (not objList):
objList = mc.ls(transforms=True)
else:
objList = mc.ls(objList, transforms=True)
result =... |
def multipleShapeCheck(objList=[]):
'\n\tReturn a list of transforms with multiple shape nodes\n\t@param objList: List of objects to check for multiple shapes.\n\t@type objList: list\n\t'
if (not objList):
objList = mc.ls(transforms=True)
else:
objList = mc.ls(objList, dag=True)
result =... | -4,158,443,164,518,131,000 | Return a list of transforms with multiple shape nodes
@param objList: List of objects to check for multiple shapes.
@type objList: list | utils/cleanup.py | multipleShapeCheck | Lynn5160/glTools | python | def multipleShapeCheck(objList=[]):
'\n\tReturn a list of transforms with multiple shape nodes\n\t@param objList: List of objects to check for multiple shapes.\n\t@type objList: list\n\t'
if (not objList):
objList = mc.ls(transforms=True)
else:
objList = mc.ls(objList, dag=True)
result =... |
def constructionHistoryCheck(geoList=[]):
'\n\tReturn a list of nodes that contain construction history\n\t@param objList: List of objects to check for construction history.\n\t@type objList: list\n\t'
if (not geoList):
geoList = mc.ls(geometry=True)
else:
geoList = mc.listRelatives(geoList,... | -5,603,059,709,136,841,000 | Return a list of nodes that contain construction history
@param objList: List of objects to check for construction history.
@type objList: list | utils/cleanup.py | constructionHistoryCheck | Lynn5160/glTools | python | def constructionHistoryCheck(geoList=[]):
'\n\tReturn a list of nodes that contain construction history\n\t@param objList: List of objects to check for construction history.\n\t@type objList: list\n\t'
if (not geoList):
geoList = mc.ls(geometry=True)
else:
geoList = mc.listRelatives(geoList,... |
def userAttrCheck(objList=[], includeShapes=False):
'\n\tReturn a list of user defined attributes for a specified list of nodes (and shapes).\n\t@param objList: List of objects to check for user defined attributes.\n\t@type objList: list\n\t@param includeShapes: Also check shapes for user defined attributes.\n\t@ty... | 5,971,153,598,812,576,000 | Return a list of user defined attributes for a specified list of nodes (and shapes).
@param objList: List of objects to check for user defined attributes.
@type objList: list
@param includeShapes: Also check shapes for user defined attributes.
@type includeShapes: bool | utils/cleanup.py | userAttrCheck | Lynn5160/glTools | python | def userAttrCheck(objList=[], includeShapes=False):
'\n\tReturn a list of user defined attributes for a specified list of nodes (and shapes).\n\t@param objList: List of objects to check for user defined attributes.\n\t@type objList: list\n\t@param includeShapes: Also check shapes for user defined attributes.\n\t@ty... |
def emptyGroupCheck(objList=[]):
'\n\tList empty groups.\n\t@param objList: List of transforms to check.\n\t@type objList: list\n\t'
if (not objList):
objList = mc.ls(transforms=True)
else:
objList = mc.ls(objList, transforms=True)
result = []
for grp in objList:
if (not mc.l... | -2,007,782,837,976,040,000 | List empty groups.
@param objList: List of transforms to check.
@type objList: list | utils/cleanup.py | emptyGroupCheck | Lynn5160/glTools | python | def emptyGroupCheck(objList=[]):
'\n\tList empty groups.\n\t@param objList: List of transforms to check.\n\t@type objList: list\n\t'
if (not objList):
objList = mc.ls(transforms=True)
else:
objList = mc.ls(objList, transforms=True)
result = []
for grp in objList:
if (not mc.l... |
def emptySetCheck(setList=[]):
'\n\tReturn a list of empty sets\n\t@param setList: List of sets to check.\n\t@type setList: list\n\t'
if (not setList):
setList = mc.ls(sets=True)
result = []
for setName in setList:
if (not mc.ls(setName, sets=True)):
continue
if setNa... | -3,456,770,229,150,419,500 | Return a list of empty sets
@param setList: List of sets to check.
@type setList: list | utils/cleanup.py | emptySetCheck | Lynn5160/glTools | python | def emptySetCheck(setList=[]):
'\n\tReturn a list of empty sets\n\t@param setList: List of sets to check.\n\t@type setList: list\n\t'
if (not setList):
setList = mc.ls(sets=True)
result = []
for setName in setList:
if (not mc.ls(setName, sets=True)):
continue
if setNa... |
def emptyLayerCheck(layerList=[]):
'\n\tReturn a list if empty layers\n\t@param layerList: List of layers to check. If empty, use all existing layers in current scene.\n\t@type layerList: list\n\t'
if (not layerList):
layerList = mc.ls(type=['displayLayer', 'renderLayer', 'animLayer'])
else:
... | 3,768,880,266,767,983,600 | Return a list if empty layers
@param layerList: List of layers to check. If empty, use all existing layers in current scene.
@type layerList: list | utils/cleanup.py | emptyLayerCheck | Lynn5160/glTools | python | def emptyLayerCheck(layerList=[]):
'\n\tReturn a list if empty layers\n\t@param layerList: List of layers to check. If empty, use all existing layers in current scene.\n\t@type layerList: list\n\t'
if (not layerList):
layerList = mc.ls(type=['displayLayer', 'renderLayer', 'animLayer'])
else:
... |
def animCurveCheck(curveTypeList=['animCurveTL', 'animCurveTA', 'animCurveTT', 'animCurveTU', 'animCurveUL', 'animCurveUA', 'animCurveUT', 'animCurveUU']):
'\n\tReturn a list of all existing animCurves of a specified type.\n\t@param curveList: List of animCurve types to consider.\n\t@type curveList: list\n\t@param ... | 9,166,902,759,146,648,000 | Return a list of all existing animCurves of a specified type.
@param curveList: List of animCurve types to consider.
@type curveList: list
@param curveTypeList: List of animCurve types to consider.
@type curveTypeList: list | utils/cleanup.py | animCurveCheck | Lynn5160/glTools | python | def animCurveCheck(curveTypeList=['animCurveTL', 'animCurveTA', 'animCurveTT', 'animCurveTU', 'animCurveUL', 'animCurveUA', 'animCurveUT', 'animCurveUU']):
'\n\tReturn a list of all existing animCurves of a specified type.\n\t@param curveList: List of animCurve types to consider.\n\t@type curveList: list\n\t@param ... |
def unusedShadingNodeCheck():
'\n\tReturn a list of unused shading nodes.\n\t'
return glTools.utils.shader.listUnusedShadingNodes() | 4,373,095,908,657,191,000 | Return a list of unused shading nodes. | utils/cleanup.py | unusedShadingNodeCheck | Lynn5160/glTools | python | def unusedShadingNodeCheck():
'\n\t\n\t'
return glTools.utils.shader.listUnusedShadingNodes() |
def noGeometryShaderCheck(geoList=[]):
'\n\tReturn a list of non intermediate geometry shapes with no shader assignment.\n\t@param geoList: List of geometry to check for shader assignments.\n\t@type geoList: list\n\t'
if (not geoList):
geoList = mc.ls(type=['mesh', 'nurbsSurface'], ni=True)
else:
... | 122,524,147,550,964,450 | Return a list of non intermediate geometry shapes with no shader assignment.
@param geoList: List of geometry to check for shader assignments.
@type geoList: list | utils/cleanup.py | noGeometryShaderCheck | Lynn5160/glTools | python | def noGeometryShaderCheck(geoList=[]):
'\n\tReturn a list of non intermediate geometry shapes with no shader assignment.\n\t@param geoList: List of geometry to check for shader assignments.\n\t@type geoList: list\n\t'
if (not geoList):
geoList = mc.ls(type=['mesh', 'nurbsSurface'], ni=True)
else:
... |
def unusedReferenceCheck():
'\n\tReturn a list of unused reference nodes.\n\t'
result = []
refList = glTools.utils.reference.listReferences()
for ref in refList:
try:
refFile = glTools.utils.reference.getReferenceFile(ref)
except:
result.append(ref)
return res... | 4,255,924,351,814,690,000 | Return a list of unused reference nodes. | utils/cleanup.py | unusedReferenceCheck | Lynn5160/glTools | python | def unusedReferenceCheck():
'\n\t\n\t'
result = []
refList = glTools.utils.reference.listReferences()
for ref in refList:
try:
refFile = glTools.utils.reference.getReferenceFile(ref)
except:
result.append(ref)
return result |
def unknownNodeCheck():
'\n\tReturn a list of unknown nodes.\n\t'
result = mc.ls(type='unknown')
if (not result):
result = []
return result | 5,835,212,241,212,312,000 | Return a list of unknown nodes. | utils/cleanup.py | unknownNodeCheck | Lynn5160/glTools | python | def unknownNodeCheck():
'\n\t\n\t'
result = mc.ls(type='unknown')
if (not result):
result = []
return result |
def checkTransforms(objList=[], tol=1e-10):
'\n\tCheck for non-zero transforms\n\t@param objList: List of transforms to check.\n\t@type objList: list\n\t@param tol: Value tolerance.\n\t@type tol: float\n\t'
if (not objList):
objList = mc.ls(transforms=True)
if (not objList):
return []
tr... | -8,042,067,614,690,949,000 | Check for non-zero transforms
@param objList: List of transforms to check.
@type objList: list
@param tol: Value tolerance.
@type tol: float | utils/cleanup.py | checkTransforms | Lynn5160/glTools | python | def checkTransforms(objList=[], tol=1e-10):
'\n\tCheck for non-zero transforms\n\t@param objList: List of transforms to check.\n\t@type objList: list\n\t@param tol: Value tolerance.\n\t@type tol: float\n\t'
if (not objList):
objList = mc.ls(transforms=True)
if (not objList):
return []
tr... |
def displayOverridesCheck(objList=[]):
'\n\tCheck all/specified objects for display overrides\n\t@param objList: List of DAG nodes to check. If empty, use all DAG nodes in scene\n\t@type objList: list\n\t'
if (not objList):
objList = mc.ls(dag=True)
else:
objList = mc.ls(objList, dag=True)
... | 6,985,345,146,070,258,000 | Check all/specified objects for display overrides
@param objList: List of DAG nodes to check. If empty, use all DAG nodes in scene
@type objList: list | utils/cleanup.py | displayOverridesCheck | Lynn5160/glTools | python | def displayOverridesCheck(objList=[]):
'\n\tCheck all/specified objects for display overrides\n\t@param objList: List of DAG nodes to check. If empty, use all DAG nodes in scene\n\t@type objList: list\n\t'
if (not objList):
objList = mc.ls(dag=True)
else:
objList = mc.ls(objList, dag=True)
... |
def shapeNameFix(shape):
'\n\tFix incorrectly named geometry shape node\n\t@param objList: List of objects to check for valid shape names.\n\t@type objList: list\n\t@param typeList: List of shape types to check for valid names.\n\t@type typeList: list\n\t@param skipIntermediates: Skip intermediate shapes\n\t@type s... | 8,285,677,100,888,544,000 | Fix incorrectly named geometry shape node
@param objList: List of objects to check for valid shape names.
@type objList: list
@param typeList: List of shape types to check for valid names.
@type typeList: list
@param skipIntermediates: Skip intermediate shapes
@type skipIntermediates: bool | utils/cleanup.py | shapeNameFix | Lynn5160/glTools | python | def shapeNameFix(shape):
'\n\tFix incorrectly named geometry shape node\n\t@param objList: List of objects to check for valid shape names.\n\t@type objList: list\n\t@param typeList: List of shape types to check for valid names.\n\t@type typeList: list\n\t@param skipIntermediates: Skip intermediate shapes\n\t@type s... |
def deleteIntermediateShapes(objList=[]):
'\n\tDelete all intermediate shapes in the scene\n\t'
intermediateShapeList = intermediateShapesCheck(objList)
if intermediateShapeList:
mc.delete(intermediateShapeList)
return intermediateShapeList | 2,769,470,549,769,540,000 | Delete all intermediate shapes in the scene | utils/cleanup.py | deleteIntermediateShapes | Lynn5160/glTools | python | def deleteIntermediateShapes(objList=[]):
'\n\t\n\t'
intermediateShapeList = intermediateShapesCheck(objList)
if intermediateShapeList:
mc.delete(intermediateShapeList)
return intermediateShapeList |
def deleteConstructionHistory(geoList=[]):
'\n\tDelete construction history for specified geometry\n\t@param geoList: List of objects to delete for construction history from.\n\t@type geoList: list\n\t'
if (not geoList):
geoList = mc.ls(geometry=True)
for geo in geoList:
mc.delete(geo, ch=Tr... | 1,295,568,664,482,571,300 | Delete construction history for specified geometry
@param geoList: List of objects to delete for construction history from.
@type geoList: list | utils/cleanup.py | deleteConstructionHistory | Lynn5160/glTools | python | def deleteConstructionHistory(geoList=[]):
'\n\tDelete construction history for specified geometry\n\t@param geoList: List of objects to delete for construction history from.\n\t@type geoList: list\n\t'
if (not geoList):
geoList = mc.ls(geometry=True)
for geo in geoList:
mc.delete(geo, ch=Tr... |
def deleteUserAttrs(nodeList=[], includeShapes=False):
'\n\tDelete user defined attributes from the specified list of nodes\n\t@param nodeList: List of nodes to delete user defined attrs from. If empty, assume all nodes.\n\t@type nodeList: list\n\t@param includeShapes: Delete user attributes \n\t@type includeShapes... | 2,575,054,338,181,821,400 | Delete user defined attributes from the specified list of nodes
@param nodeList: List of nodes to delete user defined attrs from. If empty, assume all nodes.
@type nodeList: list
@param includeShapes: Delete user attributes
@type includeShapes: bool | utils/cleanup.py | deleteUserAttrs | Lynn5160/glTools | python | def deleteUserAttrs(nodeList=[], includeShapes=False):
'\n\tDelete user defined attributes from the specified list of nodes\n\t@param nodeList: List of nodes to delete user defined attrs from. If empty, assume all nodes.\n\t@type nodeList: list\n\t@param includeShapes: Delete user attributes \n\t@type includeShapes... |
def deleteEmptyGroups(objList=[]):
'\n\tDelete empty groups\n\t'
emptyGrpList = emptyGroupCheck(objList=objList)
if emptyGrpList:
mc.delete(emptyGrpList)
return emptyGrpList | 1,703,937,593,853,136,400 | Delete empty groups | utils/cleanup.py | deleteEmptyGroups | Lynn5160/glTools | python | def deleteEmptyGroups(objList=[]):
'\n\t\n\t'
emptyGrpList = emptyGroupCheck(objList=objList)
if emptyGrpList:
mc.delete(emptyGrpList)
return emptyGrpList |
def deleteEmptySets(setList=[]):
'\n\tDelete empty groups\n\t'
emptySetList = emptySetCheck(setList=setList)
if emptySetList:
mc.delete(emptySetList)
return emptySetList | -2,143,277,007,654,361,600 | Delete empty groups | utils/cleanup.py | deleteEmptySets | Lynn5160/glTools | python | def deleteEmptySets(setList=[]):
'\n\t\n\t'
emptySetList = emptySetCheck(setList=setList)
if emptySetList:
mc.delete(emptySetList)
return emptySetList |
def deleteEmptyLayers(layerList=[]):
'\n\tDelete empty groups\n\t'
emptyLayerList = emptyLayerCheck(layerList=layerList)
if emptyLayerList:
mc.delete(emptyLayerList)
return emptyLayerList | -8,304,039,507,788,755,000 | Delete empty groups | utils/cleanup.py | deleteEmptyLayers | Lynn5160/glTools | python | def deleteEmptyLayers(layerList=[]):
'\n\t\n\t'
emptyLayerList = emptyLayerCheck(layerList=layerList)
if emptyLayerList:
mc.delete(emptyLayerList)
return emptyLayerList |
def deleteUnknownNodes():
'\n\tDelete all node of type "unknown" in the scene\n\t'
unknownNodes = (unknownNodeCheck() or [])
for node in unknownNodes:
try:
mc.lockNode(node, l=False)
mc.delete(node)
except:
print((('Problem deleting unknown node "' + node)... | 5,508,941,397,906,166,000 | Delete all node of type "unknown" in the scene | utils/cleanup.py | deleteUnknownNodes | Lynn5160/glTools | python | def deleteUnknownNodes():
'\n\t\n\t'
unknownNodes = (unknownNodeCheck() or [])
for node in unknownNodes:
try:
mc.lockNode(node, l=False)
mc.delete(node)
except:
print((('Problem deleting unknown node "' + node) + '"!'))
return unknownNodes |
def deleteNodesByType(nodeTypeList=[]):
'\n\tDelete nodes of the specified type(s).\n\t@param nodeTypeList: List of node types to delete.\n\t@type nodeTypeList: list\n\t'
if (not nodeTypeList):
return []
nodeList = mc.ls(type=nodeTypeList)
if nodeList:
mc.delete(nodeList)
else:
... | 275,726,427,221,433,860 | Delete nodes of the specified type(s).
@param nodeTypeList: List of node types to delete.
@type nodeTypeList: list | utils/cleanup.py | deleteNodesByType | Lynn5160/glTools | python | def deleteNodesByType(nodeTypeList=[]):
'\n\tDelete nodes of the specified type(s).\n\t@param nodeTypeList: List of node types to delete.\n\t@type nodeTypeList: list\n\t'
if (not nodeTypeList):
return []
nodeList = mc.ls(type=nodeTypeList)
if nodeList:
mc.delete(nodeList)
else:
... |
def deleteUnusedReferenceNodes():
'\n\tDelete all unused reference nodes in the scene\n\t'
mm.eval('RNdeleteUnused') | 1,429,711,747,913,798,000 | Delete all unused reference nodes in the scene | utils/cleanup.py | deleteUnusedReferenceNodes | Lynn5160/glTools | python | def deleteUnusedReferenceNodes():
'\n\t\n\t'
mm.eval('RNdeleteUnused') |
def deleteEmptySets(setList=[]):
'\n\tDelete empty object sets\n\t@param setList: A list of sets to check. If empty, chack all sets in current scene.\n\t@type setList: list\n\t'
if (not setList):
setList = mc.ls(sets=True)
emptySetList = []
for set in setList:
if (not mc.sets(set, q=True... | 1,971,482,680,095,184,000 | Delete empty object sets
@param setList: A list of sets to check. If empty, chack all sets in current scene.
@type setList: list | utils/cleanup.py | deleteEmptySets | Lynn5160/glTools | python | def deleteEmptySets(setList=[]):
'\n\tDelete empty object sets\n\t@param setList: A list of sets to check. If empty, chack all sets in current scene.\n\t@type setList: list\n\t'
if (not setList):
setList = mc.ls(sets=True)
emptySetList = []
for set in setList:
if (not mc.sets(set, q=True... |
def deleteAllSets(excludeList=[]):
'\n\tDelete unused object sets\n\t@param excludeList: A list of sets to exclude from the list of unused sets.\n\t@type excludeList: list\n\t'
setList = mc.ls(sets=True)
if excludeList:
excludeSetList = mc.ls(excludeList, sets=True)
setList = list((set(setLi... | -5,507,416,627,643,570,000 | Delete unused object sets
@param excludeList: A list of sets to exclude from the list of unused sets.
@type excludeList: list | utils/cleanup.py | deleteAllSets | Lynn5160/glTools | python | def deleteAllSets(excludeList=[]):
'\n\tDelete unused object sets\n\t@param excludeList: A list of sets to exclude from the list of unused sets.\n\t@type excludeList: list\n\t'
setList = mc.ls(sets=True)
if excludeList:
excludeSetList = mc.ls(excludeList, sets=True)
setList = list((set(setLi... |
def deleteUnusedShadingNodes():
'\n\tDelete all unused shading nodes in the scene\n\t'
mm.eval('MLdeleteUnused') | 2,175,521,215,862,827,300 | Delete all unused shading nodes in the scene | utils/cleanup.py | deleteUnusedShadingNodes | Lynn5160/glTools | python | def deleteUnusedShadingNodes():
'\n\t\n\t'
mm.eval('MLdeleteUnused') |
def deleteDisplayLayers():
'\n\tDelete all display layers\n\t'
displayLayers = mc.ls(type='displayLayer')
displayLayers.remove('defaultLayer')
if displayLayers:
mc.delete(displayLayers)
return displayLayers | 4,235,346,424,302,717,000 | Delete all display layers | utils/cleanup.py | deleteDisplayLayers | Lynn5160/glTools | python | def deleteDisplayLayers():
'\n\t\n\t'
displayLayers = mc.ls(type='displayLayer')
displayLayers.remove('defaultLayer')
if displayLayers:
mc.delete(displayLayers)
return displayLayers |
def deleteRenderLayers():
'\n\tDelete all render layers\n\t'
renderLayers = mc.ls(type='renderLayer')
renderLayers.remove('defaultRenderLayer')
if renderLayers:
mc.delete(renderLayers)
return renderLayers | 907,741,467,256,312,300 | Delete all render layers | utils/cleanup.py | deleteRenderLayers | Lynn5160/glTools | python | def deleteRenderLayers():
'\n\t\n\t'
renderLayers = mc.ls(type='renderLayer')
renderLayers.remove('defaultRenderLayer')
if renderLayers:
mc.delete(renderLayers)
return renderLayers |
def assignInitialShadingGroup(geoList=[]):
'\n\tAssign initialShadingGroup (lambert1) to specified geometry.\n\t@param geoList: List of geometry to apply default shader to. If empty, use all scene geometry\n\t@type geoList: list\n\t'
if (not geoList):
geoList = mc.ls(geometry=True)
if (not geoList):... | -4,432,954,743,299,561,500 | Assign initialShadingGroup (lambert1) to specified geometry.
@param geoList: List of geometry to apply default shader to. If empty, use all scene geometry
@type geoList: list | utils/cleanup.py | assignInitialShadingGroup | Lynn5160/glTools | python | def assignInitialShadingGroup(geoList=[]):
'\n\tAssign initialShadingGroup (lambert1) to specified geometry.\n\t@param geoList: List of geometry to apply default shader to. If empty, use all scene geometry\n\t@type geoList: list\n\t'
if (not geoList):
geoList = mc.ls(geometry=True)
if (not geoList):... |
def zeroTransforms(objList=[]):
'\n\tReset transform values\n\t@param objList: List of transforms to zero out.\n\t@type objList: list\n\t'
if (not objList):
objList = mc.ls(transforms=True)
if (not objList):
return []
for obj in objList:
if mc.getAttr((obj + '.tx'), se=True):
... | 4,021,415,312,165,912,600 | Reset transform values
@param objList: List of transforms to zero out.
@type objList: list | utils/cleanup.py | zeroTransforms | Lynn5160/glTools | python | def zeroTransforms(objList=[]):
'\n\tReset transform values\n\t@param objList: List of transforms to zero out.\n\t@type objList: list\n\t'
if (not objList):
objList = mc.ls(transforms=True)
if (not objList):
return []
for obj in objList:
if mc.getAttr((obj + '.tx'), se=True):
... |
def copyInputShapeAttrs(geoList=[]):
'\n\tCopy user defined attributes from an input shape to the output deforming shape.\n\t@param geoList: List of geometry to copy atributes for.\n\t@type geoList: list\n\t'
if (not geoList):
geoList = (mc.listRelatives((mc.ls(geometry=True) or []), p=True, pa=True) or... | 4,709,085,801,992,864,000 | Copy user defined attributes from an input shape to the output deforming shape.
@param geoList: List of geometry to copy atributes for.
@type geoList: list | utils/cleanup.py | copyInputShapeAttrs | Lynn5160/glTools | python | def copyInputShapeAttrs(geoList=[]):
'\n\tCopy user defined attributes from an input shape to the output deforming shape.\n\t@param geoList: List of geometry to copy atributes for.\n\t@type geoList: list\n\t'
if (not geoList):
geoList = (mc.listRelatives((mc.ls(geometry=True) or []), p=True, pa=True) or... |
def removeTurtle():
'\n\tDelete nodes and unload plgin related to the Turtle Renderer.\n\t'
turtleNode = 'TurtleDefaultBakeLayer'
if mc.objExists(turtleNode):
print('Removing Turtle nodes...')
mc.lockNode(turtleNode, l=False)
mc.delete(turtleNode)
if mc.pluginInfo('Turtle', q=Tru... | -309,964,089,159,626,600 | Delete nodes and unload plgin related to the Turtle Renderer. | utils/cleanup.py | removeTurtle | Lynn5160/glTools | python | def removeTurtle():
'\n\t\n\t'
turtleNode = 'TurtleDefaultBakeLayer'
if mc.objExists(turtleNode):
print('Removing Turtle nodes...')
mc.lockNode(turtleNode, l=False)
mc.delete(turtleNode)
if mc.pluginInfo('Turtle', q=True, loaded=True):
print('Unloading Turtle plugin...')
... |
def test_instantiate(core_config, patch_mongo, ampel_logger):
'\n AbsT3Loader understands all the aliases in the ampel-core config\n '
ctx = AmpelContext.load(core_config)
aliases = ctx.config.get('alias.t3', dict)
assert (len((directives := T3SimpleDataLoader(context=ctx, logger=ampel_logger, dir... | 840,419,088,730,266,900 | AbsT3Loader understands all the aliases in the ampel-core config | ampel/test/test_T3SimpleDataLoader.py | test_instantiate | mafn/Ampel-core | python | def test_instantiate(core_config, patch_mongo, ampel_logger):
'\n \n '
ctx = AmpelContext.load(core_config)
aliases = ctx.config.get('alias.t3', dict)
assert (len((directives := T3SimpleDataLoader(context=ctx, logger=ampel_logger, directives=[k[1:] for k in aliases.keys()]).directives)) == len(ali... |
@bp_rack.route('/lists.html', methods=['GET', 'POST'])
@login_required
@permission_rack_section_search.require(http_exception=403)
def lists():
'\n 货架列表\n :return:\n '
template_name = 'rack/lists.html'
document_info = DOCUMENT_INFO.copy()
document_info['TITLE'] = _('rack lists')
form = Rack... | 5,864,496,859,774,998,000 | 货架列表
:return: | app_backend/views/rack.py | lists | zhanghe06/bearing_project | python | @bp_rack.route('/lists.html', methods=['GET', 'POST'])
@login_required
@permission_rack_section_search.require(http_exception=403)
def lists():
'\n 货架列表\n :return:\n '
template_name = 'rack/lists.html'
document_info = DOCUMENT_INFO.copy()
document_info['TITLE'] = _('rack lists')
form = Rack... |
@bp_rack.route('/<int:rack_id>/info.html')
@login_required
@permission_rack_section_get.require(http_exception=403)
def info(rack_id):
'\n 货架详情\n :param rack_id:\n :return:\n '
rack_info = get_rack_row_by_id(rack_id)
if (not rack_info):
abort(404)
if (rack_info.status_delete == STATU... | -8,079,144,495,823,498,000 | 货架详情
:param rack_id:
:return: | app_backend/views/rack.py | info | zhanghe06/bearing_project | python | @bp_rack.route('/<int:rack_id>/info.html')
@login_required
@permission_rack_section_get.require(http_exception=403)
def info(rack_id):
'\n 货架详情\n :param rack_id:\n :return:\n '
rack_info = get_rack_row_by_id(rack_id)
if (not rack_info):
abort(404)
if (rack_info.status_delete == STATU... |
@bp_rack.route('/add.html', methods=['GET', 'POST'])
@login_required
@permission_rack_section_add.require(http_exception=403)
def add():
'\n 创建货架\n :return:\n '
template_name = 'rack/add.html'
document_info = DOCUMENT_INFO.copy()
document_info['TITLE'] = _('rack add')
form = RackAddForm(req... | -1,110,958,220,311,944,700 | 创建货架
:return: | app_backend/views/rack.py | add | zhanghe06/bearing_project | python | @bp_rack.route('/add.html', methods=['GET', 'POST'])
@login_required
@permission_rack_section_add.require(http_exception=403)
def add():
'\n 创建货架\n :return:\n '
template_name = 'rack/add.html'
document_info = DOCUMENT_INFO.copy()
document_info['TITLE'] = _('rack add')
form = RackAddForm(req... |
@bp_rack.route('/<int:rack_id>/edit.html', methods=['GET', 'POST'])
@login_required
@permission_rack_section_edit.require(http_exception=403)
def edit(rack_id):
'\n 货架编辑\n '
rack_info = get_rack_row_by_id(rack_id)
if (not rack_info):
abort(404)
if (rack_info.status_delete == STATUS_DEL_OK)... | -5,308,319,042,190,759,000 | 货架编辑 | app_backend/views/rack.py | edit | zhanghe06/bearing_project | python | @bp_rack.route('/<int:rack_id>/edit.html', methods=['GET', 'POST'])
@login_required
@permission_rack_section_edit.require(http_exception=403)
def edit(rack_id):
'\n \n '
rack_info = get_rack_row_by_id(rack_id)
if (not rack_info):
abort(404)
if (rack_info.status_delete == STATUS_DEL_OK):
... |
@bp_rack.route('/ajax/del', methods=['GET', 'POST'])
@login_required
def ajax_delete():
'\n 货架删除\n :return:\n '
ajax_success_msg = AJAX_SUCCESS_MSG.copy()
ajax_failure_msg = AJAX_FAILURE_MSG.copy()
if (not permission_rack_section_del.can()):
ext_msg = _('Permission Denied')
ajax... | -4,760,058,191,510,217,000 | 货架删除
:return: | app_backend/views/rack.py | ajax_delete | zhanghe06/bearing_project | python | @bp_rack.route('/ajax/del', methods=['GET', 'POST'])
@login_required
def ajax_delete():
'\n 货架删除\n :return:\n '
ajax_success_msg = AJAX_SUCCESS_MSG.copy()
ajax_failure_msg = AJAX_FAILURE_MSG.copy()
if (not permission_rack_section_del.can()):
ext_msg = _('Permission Denied')
ajax... |
@bp_rack.route('/ajax/get_rack_choices', methods=['GET', 'POST'])
@login_required
def ajax_get_rack_choices():
'\n 货架选项\n :return:\n '
warehouse_id = request.args.get('warehouse_id', 0, type=int)
rack_choices = get_rack_choices(warehouse_id)
return jsonify(rack_choices) | -7,212,981,095,690,917,000 | 货架选项
:return: | app_backend/views/rack.py | ajax_get_rack_choices | zhanghe06/bearing_project | python | @bp_rack.route('/ajax/get_rack_choices', methods=['GET', 'POST'])
@login_required
def ajax_get_rack_choices():
'\n 货架选项\n :return:\n '
warehouse_id = request.args.get('warehouse_id', 0, type=int)
rack_choices = get_rack_choices(warehouse_id)
return jsonify(rack_choices) |
def test_margin_asset_without_asset():
'Tests the API endpoint to margin asset without asset'
client = Client(key, secret)
client.margin_asset.when.called_with('').should.throw(ParameterRequiredError) | 7,273,823,675,300,908,000 | Tests the API endpoint to margin asset without asset | tests/spot/margin/test_margin_asset.py | test_margin_asset_without_asset | 0x000050/binance-connector-python | python | def test_margin_asset_without_asset():
client = Client(key, secret)
client.margin_asset.when.called_with().should.throw(ParameterRequiredError) |
@mock_http_response(responses.GET, ('/sapi/v1/margin/asset\\?' + urlencode(params)), mock_item, 200)
def test_margin_asset():
'Tests the API endpoint to margin asset'
client = Client(key, secret)
response = client.margin_asset(**params)
response.should.equal(mock_item) | -732,374,126,652,178,800 | Tests the API endpoint to margin asset | tests/spot/margin/test_margin_asset.py | test_margin_asset | 0x000050/binance-connector-python | python | @mock_http_response(responses.GET, ('/sapi/v1/margin/asset\\?' + urlencode(params)), mock_item, 200)
def test_margin_asset():
client = Client(key, secret)
response = client.margin_asset(**params)
response.should.equal(mock_item) |
def record(self, name: str, value: float, ignore_nan=True):
'\n Args:\n name: name of value.\n value: value to record.\n ignore_nan: ignore nan values and do not record them (they will mess up the averages).\n '
if (ignore_nan and ((value != value) or (value is Non... | 7,226,268,007,534,564,000 | Args:
name: name of value.
value: value to record.
ignore_nan: ignore nan values and do not record them (they will mess up the averages). | wrangl/metrics/running_avg.py | record | vzhong/wrangl | python | def record(self, name: str, value: float, ignore_nan=True):
'\n Args:\n name: name of value.\n value: value to record.\n ignore_nan: ignore nan values and do not record them (they will mess up the averages).\n '
if (ignore_nan and ((value != value) or (value is Non... |
def create_loss(self):
' create loss function '
return 'categorical_crossentropy' | 2,219,248,142,900,374,300 | create loss function | source/engine/steps/config_model.py | create_loss | Borrk/DeepLearning-Engine | python | def create_loss(self):
' '
return 'categorical_crossentropy' |
def __init__(self, quotas=None):
'ShowDomainQuotaResponse - a model defined in huaweicloud sdk'
super(ShowDomainQuotaResponse, self).__init__()
self._quotas = None
self.discriminator = None
if (quotas is not None):
self.quotas = quotas | 7,046,108,231,739,304,000 | ShowDomainQuotaResponse - a model defined in huaweicloud sdk | huaweicloud-sdk-iam/huaweicloudsdkiam/v3/model/show_domain_quota_response.py | __init__ | huaweicloud/huaweicloud-sdk-python-v3 | python | def __init__(self, quotas=None):
super(ShowDomainQuotaResponse, self).__init__()
self._quotas = None
self.discriminator = None
if (quotas is not None):
self.quotas = quotas |
@property
def quotas(self):
'Gets the quotas of this ShowDomainQuotaResponse.\n\n\n :return: The quotas of this ShowDomainQuotaResponse.\n :rtype: QuotaResult\n '
return self._quotas | -3,598,046,173,939,050,500 | Gets the quotas of this ShowDomainQuotaResponse.
:return: The quotas of this ShowDomainQuotaResponse.
:rtype: QuotaResult | huaweicloud-sdk-iam/huaweicloudsdkiam/v3/model/show_domain_quota_response.py | quotas | huaweicloud/huaweicloud-sdk-python-v3 | python | @property
def quotas(self):
'Gets the quotas of this ShowDomainQuotaResponse.\n\n\n :return: The quotas of this ShowDomainQuotaResponse.\n :rtype: QuotaResult\n '
return self._quotas |
@quotas.setter
def quotas(self, quotas):
'Sets the quotas of this ShowDomainQuotaResponse.\n\n\n :param quotas: The quotas of this ShowDomainQuotaResponse.\n :type: QuotaResult\n '
self._quotas = quotas | 8,606,408,353,636,620,000 | Sets the quotas of this ShowDomainQuotaResponse.
:param quotas: The quotas of this ShowDomainQuotaResponse.
:type: QuotaResult | huaweicloud-sdk-iam/huaweicloudsdkiam/v3/model/show_domain_quota_response.py | quotas | huaweicloud/huaweicloud-sdk-python-v3 | python | @quotas.setter
def quotas(self, quotas):
'Sets the quotas of this ShowDomainQuotaResponse.\n\n\n :param quotas: The quotas of this ShowDomainQuotaResponse.\n :type: QuotaResult\n '
self._quotas = quotas |
def to_dict(self):
'Returns the model properties as a dict'
result = {}
for (attr, _) in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
e... | 2,594,216,033,120,720,000 | Returns the model properties as a dict | huaweicloud-sdk-iam/huaweicloudsdkiam/v3/model/show_domain_quota_response.py | to_dict | huaweicloud/huaweicloud-sdk-python-v3 | python | def to_dict(self):
result = {}
for (attr, _) in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
elif hasattr(value, 'to_dict'):
... |
def to_str(self):
'Returns the string representation of the model'
import simplejson as json
if six.PY2:
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
return json.dumps(sanitize_for_serialization(self), ensure_ascii=False) | -6,095,553,759,700,562,000 | Returns the string representation of the model | huaweicloud-sdk-iam/huaweicloudsdkiam/v3/model/show_domain_quota_response.py | to_str | huaweicloud/huaweicloud-sdk-python-v3 | python | def to_str(self):
import simplejson as json
if six.PY2:
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
return json.dumps(sanitize_for_serialization(self), ensure_ascii=False) |
def __repr__(self):
'For `print`'
return self.to_str() | -1,581,176,371,750,213,000 | For `print` | huaweicloud-sdk-iam/huaweicloudsdkiam/v3/model/show_domain_quota_response.py | __repr__ | huaweicloud/huaweicloud-sdk-python-v3 | python | def __repr__(self):
return self.to_str() |
def __eq__(self, other):
'Returns true if both objects are equal'
if (not isinstance(other, ShowDomainQuotaResponse)):
return False
return (self.__dict__ == other.__dict__) | 4,360,679,028,406,671,400 | Returns true if both objects are equal | huaweicloud-sdk-iam/huaweicloudsdkiam/v3/model/show_domain_quota_response.py | __eq__ | huaweicloud/huaweicloud-sdk-python-v3 | python | def __eq__(self, other):
if (not isinstance(other, ShowDomainQuotaResponse)):
return False
return (self.__dict__ == other.__dict__) |
def __ne__(self, other):
'Returns true if both objects are not equal'
return (not (self == other)) | 7,764,124,047,908,058,000 | Returns true if both objects are not equal | huaweicloud-sdk-iam/huaweicloudsdkiam/v3/model/show_domain_quota_response.py | __ne__ | huaweicloud/huaweicloud-sdk-python-v3 | python | def __ne__(self, other):
return (not (self == other)) |
def get_sql_resource_sql_stored_procedure(account_name: Optional[str]=None, container_name: Optional[str]=None, database_name: Optional[str]=None, resource_group_name: Optional[str]=None, stored_procedure_name: Optional[str]=None, opts: Optional[pulumi.InvokeOptions]=None) -> AwaitableGetSqlResourceSqlStoredProcedureRe... | -9,073,698,145,446,339,000 | An Azure Cosmos DB storedProcedure.
:param str account_name: Cosmos DB database account name.
:param str container_name: Cosmos DB container name.
:param str database_name: Cosmos DB database name.
:param str resource_group_name: The name of the resource group. The name is case insensitive.
:param str stored_procedur... | sdk/python/pulumi_azure_native/documentdb/v20200401/get_sql_resource_sql_stored_procedure.py | get_sql_resource_sql_stored_procedure | polivbr/pulumi-azure-native | python | def get_sql_resource_sql_stored_procedure(account_name: Optional[str]=None, container_name: Optional[str]=None, database_name: Optional[str]=None, resource_group_name: Optional[str]=None, stored_procedure_name: Optional[str]=None, opts: Optional[pulumi.InvokeOptions]=None) -> AwaitableGetSqlResourceSqlStoredProcedureRe... |
@property
@pulumi.getter
def id(self) -> str:
'\n The unique resource identifier of the ARM resource.\n '
return pulumi.get(self, 'id') | -3,549,939,143,766,340,000 | The unique resource identifier of the ARM resource. | sdk/python/pulumi_azure_native/documentdb/v20200401/get_sql_resource_sql_stored_procedure.py | id | polivbr/pulumi-azure-native | python | @property
@pulumi.getter
def id(self) -> str:
'\n \n '
return pulumi.get(self, 'id') |
@property
@pulumi.getter
def location(self) -> Optional[str]:
'\n The location of the resource group to which the resource belongs.\n '
return pulumi.get(self, 'location') | 3,271,524,381,365,131,300 | The location of the resource group to which the resource belongs. | sdk/python/pulumi_azure_native/documentdb/v20200401/get_sql_resource_sql_stored_procedure.py | location | polivbr/pulumi-azure-native | python | @property
@pulumi.getter
def location(self) -> Optional[str]:
'\n \n '
return pulumi.get(self, 'location') |
@property
@pulumi.getter
def name(self) -> str:
'\n The name of the ARM resource.\n '
return pulumi.get(self, 'name') | 5,284,165,818,500,662,000 | The name of the ARM resource. | sdk/python/pulumi_azure_native/documentdb/v20200401/get_sql_resource_sql_stored_procedure.py | name | polivbr/pulumi-azure-native | python | @property
@pulumi.getter
def name(self) -> str:
'\n \n '
return pulumi.get(self, 'name') |
@property
@pulumi.getter
def tags(self) -> Optional[Mapping[(str, str)]]:
'\n Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no ... | 3,512,089,887,617,268,700 | Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the de... | sdk/python/pulumi_azure_native/documentdb/v20200401/get_sql_resource_sql_stored_procedure.py | tags | polivbr/pulumi-azure-native | python | @property
@pulumi.getter
def tags(self) -> Optional[Mapping[(str, str)]]:
'\n \n '
return pulumi.get(self, 'tags') |
@property
@pulumi.getter
def type(self) -> str:
'\n The type of Azure resource.\n '
return pulumi.get(self, 'type') | 7,933,918,790,997,796,000 | The type of Azure resource. | sdk/python/pulumi_azure_native/documentdb/v20200401/get_sql_resource_sql_stored_procedure.py | type | polivbr/pulumi-azure-native | python | @property
@pulumi.getter
def type(self) -> str:
'\n \n '
return pulumi.get(self, 'type') |
def addscriptpath(script):
'\n Add the path part of the scriptfile to the system path to\n allow modules to be loaded from the same place.\n\n Each path is added only once.\n '
pathfound = 0
scriptpath = os.path.dirname(script)
for pathitem in sys.path:
if (pathitem == scriptpath):
... | -95,659,354,973,389,170 | Add the path part of the scriptfile to the system path to
allow modules to be loaded from the same place.
Each path is added only once. | python/init.py | addscriptpath | exported/ollypython | python | def addscriptpath(script):
'\n Add the path part of the scriptfile to the system path to\n allow modules to be loaded from the same place.\n\n Each path is added only once.\n '
pathfound = 0
scriptpath = os.path.dirname(script)
for pathitem in sys.path:
if (pathitem == scriptpath):
... |
def runscript(script):
'\n Run the specified script after adding its directory path to\n system path.\n\n This function is used by the low-level plugin code.\n '
addscriptpath(script)
watchdog.reset()
argv = sys.argv
sys.argv = [script]
execfile(script, globals())
sys.argv = argv | 4,093,790,362,929,177,000 | Run the specified script after adding its directory path to
system path.
This function is used by the low-level plugin code. | python/init.py | runscript | exported/ollypython | python | def runscript(script):
'\n Run the specified script after adding its directory path to\n system path.\n\n This function is used by the low-level plugin code.\n '
addscriptpath(script)
watchdog.reset()
argv = sys.argv
sys.argv = [script]
execfile(script, globals())
sys.argv = argv |
def install(self):
' Install the tracer function, required for the watchdog '
if (not self.installed):
sys.settrace(self.tracer)
self.installed = True | -443,802,513,454,424,260 | Install the tracer function, required for the watchdog | python/init.py | install | exported/ollypython | python | def install(self):
' '
if (not self.installed):
sys.settrace(self.tracer)
self.installed = True |
def activate(self, timeout=None):
' Activate the watchdog, with optional timeout change '
assert self.installed, 'WatchDog must be installed before activating'
if timeout:
self.timeout = timeout
self.reset()
self.active = True | -7,555,068,057,636,498,000 | Activate the watchdog, with optional timeout change | python/init.py | activate | exported/ollypython | python | def activate(self, timeout=None):
' '
assert self.installed, 'WatchDog must be installed before activating'
if timeout:
self.timeout = timeout
self.reset()
self.active = True |
def deactivate(self):
' Deactivate the watchdog '
self.active = True | 4,592,113,951,165,954,600 | Deactivate the watchdog | python/init.py | deactivate | exported/ollypython | python | def deactivate(self):
' '
self.active = True |
def reset(self):
' Reset the timer, useful for long-running scripts '
self.timestamp = time.clock() | 6,988,983,387,992,105,000 | Reset the timer, useful for long-running scripts | python/init.py | reset | exported/ollypython | python | def reset(self):
' '
self.timestamp = time.clock() |
def tracer(self, frame, event, arg):
' Tracer function that receives the tracing events '
if (not self.active):
return None
return self.tracer | -1,960,268,148,174,367,200 | Tracer function that receives the tracing events | python/init.py | tracer | exported/ollypython | python | def tracer(self, frame, event, arg):
' '
if (not self.active):
return None
return self.tracer |
@bind_hass
def turn_on(hass, entity_id, variables=None, context=None):
'Turn script on.\n\n This is a legacy helper method. Do not use it for new tests.\n '
(_, object_id) = split_entity_id(entity_id)
hass.services.call(DOMAIN, object_id, variables, context=context) | 881,353,817,027,971,100 | Turn script on.
This is a legacy helper method. Do not use it for new tests. | tests/components/test_script.py | turn_on | 27tech/home-assistant | python | @bind_hass
def turn_on(hass, entity_id, variables=None, context=None):
'Turn script on.\n\n This is a legacy helper method. Do not use it for new tests.\n '
(_, object_id) = split_entity_id(entity_id)
hass.services.call(DOMAIN, object_id, variables, context=context) |
@bind_hass
def turn_off(hass, entity_id):
'Turn script on.\n\n This is a legacy helper method. Do not use it for new tests.\n '
hass.services.call(DOMAIN, SERVICE_TURN_OFF, {ATTR_ENTITY_ID: entity_id}) | -4,524,185,376,768,060,000 | Turn script on.
This is a legacy helper method. Do not use it for new tests. | tests/components/test_script.py | turn_off | 27tech/home-assistant | python | @bind_hass
def turn_off(hass, entity_id):
'Turn script on.\n\n This is a legacy helper method. Do not use it for new tests.\n '
hass.services.call(DOMAIN, SERVICE_TURN_OFF, {ATTR_ENTITY_ID: entity_id}) |
@bind_hass
def toggle(hass, entity_id):
'Toggle the script.\n\n This is a legacy helper method. Do not use it for new tests.\n '
hass.services.call(DOMAIN, SERVICE_TOGGLE, {ATTR_ENTITY_ID: entity_id}) | -5,155,807,265,171,595,000 | Toggle the script.
This is a legacy helper method. Do not use it for new tests. | tests/components/test_script.py | toggle | 27tech/home-assistant | python | @bind_hass
def toggle(hass, entity_id):
'Toggle the script.\n\n This is a legacy helper method. Do not use it for new tests.\n '
hass.services.call(DOMAIN, SERVICE_TOGGLE, {ATTR_ENTITY_ID: entity_id}) |
@bind_hass
def reload(hass):
'Reload script component.\n\n This is a legacy helper method. Do not use it for new tests.\n '
hass.services.call(DOMAIN, SERVICE_RELOAD) | 4,122,823,776,589,158,400 | Reload script component.
This is a legacy helper method. Do not use it for new tests. | tests/components/test_script.py | reload | 27tech/home-assistant | python | @bind_hass
def reload(hass):
'Reload script component.\n\n This is a legacy helper method. Do not use it for new tests.\n '
hass.services.call(DOMAIN, SERVICE_RELOAD) |
async def test_shared_context(hass):
'Test that the shared context is passed down the chain.'
event = 'test_event'
context = Context()
event_mock = Mock()
run_mock = Mock()
hass.bus.async_listen(event, event_mock)
hass.bus.async_listen(EVENT_SCRIPT_STARTED, run_mock)
assert (await async_... | 4,054,526,703,985,677,000 | Test that the shared context is passed down the chain. | tests/components/test_script.py | test_shared_context | 27tech/home-assistant | python | async def test_shared_context(hass):
event = 'test_event'
context = Context()
event_mock = Mock()
run_mock = Mock()
hass.bus.async_listen(event, event_mock)
hass.bus.async_listen(EVENT_SCRIPT_STARTED, run_mock)
assert (await async_setup_component(hass, 'script', {'script': {'test': {'se... |
def setUp(self):
'Set up things to be run when tests are started.'
self.hass = get_test_home_assistant() | 8,009,785,092,768,199,000 | Set up things to be run when tests are started. | tests/components/test_script.py | setUp | 27tech/home-assistant | python | def setUp(self):
self.hass = get_test_home_assistant() |
def tearDown(self):
'Stop down everything that was started.'
self.hass.stop() | -7,983,443,536,413,136,000 | Stop down everything that was started. | tests/components/test_script.py | tearDown | 27tech/home-assistant | python | def tearDown(self):
self.hass.stop() |
def test_setup_with_invalid_configs(self):
'Test setup with invalid configs.'
for value in ({'test': {}}, {'test hello world': {'sequence': [{'event': 'bla'}]}}, {'test': {'sequence': {'event': 'test_event', 'service': 'homeassistant.turn_on'}}}):
assert (not setup_component(self.hass, 'script', {'scrip... | -9,022,565,211,143,436,000 | Test setup with invalid configs. | tests/components/test_script.py | test_setup_with_invalid_configs | 27tech/home-assistant | python | def test_setup_with_invalid_configs(self):
for value in ({'test': {}}, {'test hello world': {'sequence': [{'event': 'bla'}]}}, {'test': {'sequence': {'event': 'test_event', 'service': 'homeassistant.turn_on'}}}):
assert (not setup_component(self.hass, 'script', {'script': value})), 'Script loaded with ... |
def test_turn_on_service(self):
'Verify that the turn_on service.'
event = 'test_event'
events = []
@callback
def record_event(event):
'Add recorded event to set.'
events.append(event)
self.hass.bus.listen(event, record_event)
assert setup_component(self.hass, 'script', {'sc... | 49,833,895,516,182,200 | Verify that the turn_on service. | tests/components/test_script.py | test_turn_on_service | 27tech/home-assistant | python | def test_turn_on_service(self):
event = 'test_event'
events = []
@callback
def record_event(event):
'Add recorded event to set.'
events.append(event)
self.hass.bus.listen(event, record_event)
assert setup_component(self.hass, 'script', {'script': {'test': {'sequence': [{'de... |
def test_toggle_service(self):
'Test the toggling of a service.'
event = 'test_event'
events = []
@callback
def record_event(event):
'Add recorded event to set.'
events.append(event)
self.hass.bus.listen(event, record_event)
assert setup_component(self.hass, 'script', {'scri... | -2,021,375,834,811,586,800 | Test the toggling of a service. | tests/components/test_script.py | test_toggle_service | 27tech/home-assistant | python | def test_toggle_service(self):
event = 'test_event'
events = []
@callback
def record_event(event):
'Add recorded event to set.'
events.append(event)
self.hass.bus.listen(event, record_event)
assert setup_component(self.hass, 'script', {'script': {'test': {'sequence': [{'del... |
def test_passing_variables(self):
'Test different ways of passing in variables.'
calls = []
context = Context()
@callback
def record_call(service):
'Add recorded event to set.'
calls.append(service)
self.hass.services.register('test', 'script', record_call)
assert setup_comp... | -6,479,770,249,143,740,000 | Test different ways of passing in variables. | tests/components/test_script.py | test_passing_variables | 27tech/home-assistant | python | def test_passing_variables(self):
calls = []
context = Context()
@callback
def record_call(service):
'Add recorded event to set.'
calls.append(service)
self.hass.services.register('test', 'script', record_call)
assert setup_component(self.hass, 'script', {'script': {'test':... |
def test_reload_service(self):
'Verify that the turn_on service.'
assert setup_component(self.hass, 'script', {'script': {'test': {'sequence': [{'delay': {'seconds': 5}}]}}})
assert (self.hass.states.get(ENTITY_ID) is not None)
assert self.hass.services.has_service(script.DOMAIN, 'test')
with patch(... | 2,295,490,650,558,444,500 | Verify that the turn_on service. | tests/components/test_script.py | test_reload_service | 27tech/home-assistant | python | def test_reload_service(self):
assert setup_component(self.hass, 'script', {'script': {'test': {'sequence': [{'delay': {'seconds': 5}}]}}})
assert (self.hass.states.get(ENTITY_ID) is not None)
assert self.hass.services.has_service(script.DOMAIN, 'test')
with patch('homeassistant.config.load_yaml_co... |
@callback
def record_event(event):
'Add recorded event to set.'
events.append(event) | 81,542,234,316,640,880 | Add recorded event to set. | tests/components/test_script.py | record_event | 27tech/home-assistant | python | @callback
def record_event(event):
events.append(event) |
@callback
def record_event(event):
'Add recorded event to set.'
events.append(event) | 81,542,234,316,640,880 | Add recorded event to set. | tests/components/test_script.py | record_event | 27tech/home-assistant | python | @callback
def record_event(event):
events.append(event) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.