body_hash
stringlengths
64
64
body
stringlengths
23
109k
docstring
stringlengths
1
57k
path
stringlengths
4
198
name
stringlengths
1
115
repository_name
stringlengths
7
111
repository_stars
float64
0
191k
lang
stringclasses
1 value
body_without_docstring
stringlengths
14
108k
unified
stringlengths
45
133k
9f93183edebcc54aa3fe74e3738a48c11bf7c3374c57327a68d4c943d0f4da1b
def _check_nd_numpy_array(name, array, num_dims): 'Raises an exception if `array` is not a `num_dims`-D numpy array.' if (len(array.shape) != num_dims): raise ValueError('The argument {!r} should be a {}D array, not of shape {}'.format(name, num_dims, array.shape))
Raises an exception if `array` is not a `num_dims`-D numpy array.
surface_distance/metrics.py
_check_nd_numpy_array
capitaltg/surface-distance
314
python
def _check_nd_numpy_array(name, array, num_dims): if (len(array.shape) != num_dims): raise ValueError('The argument {!r} should be a {}D array, not of shape {}'.format(name, num_dims, array.shape))
def _check_nd_numpy_array(name, array, num_dims): if (len(array.shape) != num_dims): raise ValueError('The argument {!r} should be a {}D array, not of shape {}'.format(name, num_dims, array.shape))<|docstring|>Raises an exception if `array` is not a `num_dims`-D numpy array.<|endoftext|>
2d0746efa743bf10b0c4d2a693318eb92617d9eb67c6eb407b7b9141649cf77a
def _compute_bounding_box(mask): "Computes the bounding box of the masks.\n\n This function generalizes to arbitrary number of dimensions great or equal\n to 1.\n\n Args:\n mask: The 2D or 3D numpy mask, where '0' means background and non-zero means\n foreground.\n\n Returns:\n A tuple:\n - The c...
Computes the bounding box of the masks. This function generalizes to arbitrary number of dimensions great or equal to 1. Args: mask: The 2D or 3D numpy mask, where '0' means background and non-zero means foreground. Returns: A tuple: - The coordinates of the first point of the bounding box (smallest on al...
surface_distance/metrics.py
_compute_bounding_box
capitaltg/surface-distance
314
python
def _compute_bounding_box(mask): "Computes the bounding box of the masks.\n\n This function generalizes to arbitrary number of dimensions great or equal\n to 1.\n\n Args:\n mask: The 2D or 3D numpy mask, where '0' means background and non-zero means\n foreground.\n\n Returns:\n A tuple:\n - The c...
def _compute_bounding_box(mask): "Computes the bounding box of the masks.\n\n This function generalizes to arbitrary number of dimensions great or equal\n to 1.\n\n Args:\n mask: The 2D or 3D numpy mask, where '0' means background and non-zero means\n foreground.\n\n Returns:\n A tuple:\n - The c...
f894cf25bcba26ba7ec3925429273af3215695cbc2b95b668be18005b2c2be7f
def _crop_to_bounding_box(mask, bbox_min, bbox_max): 'Crops a 2D or 3D mask to the bounding box specified by `bbox_{min,max}`.' cropmask = np.zeros(((bbox_max - bbox_min) + 2), np.uint8) num_dims = len(mask.shape) if (num_dims == 2): cropmask[(0:(- 1), 0:(- 1))] = mask[(bbox_min[0]:(bbox_max[0] ...
Crops a 2D or 3D mask to the bounding box specified by `bbox_{min,max}`.
surface_distance/metrics.py
_crop_to_bounding_box
capitaltg/surface-distance
314
python
def _crop_to_bounding_box(mask, bbox_min, bbox_max): cropmask = np.zeros(((bbox_max - bbox_min) + 2), np.uint8) num_dims = len(mask.shape) if (num_dims == 2): cropmask[(0:(- 1), 0:(- 1))] = mask[(bbox_min[0]:(bbox_max[0] + 1), bbox_min[1]:(bbox_max[1] + 1))] elif (num_dims == 3): cr...
def _crop_to_bounding_box(mask, bbox_min, bbox_max): cropmask = np.zeros(((bbox_max - bbox_min) + 2), np.uint8) num_dims = len(mask.shape) if (num_dims == 2): cropmask[(0:(- 1), 0:(- 1))] = mask[(bbox_min[0]:(bbox_max[0] + 1), bbox_min[1]:(bbox_max[1] + 1))] elif (num_dims == 3): cr...
76f42adfbbc478d7b8d67903275216e84d4f35148422ccd4e07e99a8cc9d1084
def _sort_distances_surfels(distances, surfel_areas): 'Sorts the two list with respect to the tuple of (distance, surfel_area).\n\n Args:\n distances: The distances from A to B (e.g. `distances_gt_to_pred`).\n surfel_areas: The surfel areas for A (e.g. `surfel_areas_gt`).\n\n Returns:\n A tuple of the so...
Sorts the two list with respect to the tuple of (distance, surfel_area). Args: distances: The distances from A to B (e.g. `distances_gt_to_pred`). surfel_areas: The surfel areas for A (e.g. `surfel_areas_gt`). Returns: A tuple of the sorted (distances, surfel_areas).
surface_distance/metrics.py
_sort_distances_surfels
capitaltg/surface-distance
314
python
def _sort_distances_surfels(distances, surfel_areas): 'Sorts the two list with respect to the tuple of (distance, surfel_area).\n\n Args:\n distances: The distances from A to B (e.g. `distances_gt_to_pred`).\n surfel_areas: The surfel areas for A (e.g. `surfel_areas_gt`).\n\n Returns:\n A tuple of the so...
def _sort_distances_surfels(distances, surfel_areas): 'Sorts the two list with respect to the tuple of (distance, surfel_area).\n\n Args:\n distances: The distances from A to B (e.g. `distances_gt_to_pred`).\n surfel_areas: The surfel areas for A (e.g. `surfel_areas_gt`).\n\n Returns:\n A tuple of the so...
5cc76c36e4e8cd5c5a79ef8b1a4515eb6f4ff6f031ff5164f7e229ed3c38aaa2
def compute_surface_distances(mask_gt, mask_pred, spacing_mm): 'Computes closest distances from all surface points to the other surface.\n\n This function can be applied to 2D or 3D tensors. For 2D, both masks must be\n 2D and `spacing_mm` must be a 2-element list. For 3D, both masks must be 3D\n and `spacing_mm...
Computes closest distances from all surface points to the other surface. This function can be applied to 2D or 3D tensors. For 2D, both masks must be 2D and `spacing_mm` must be a 2-element list. For 3D, both masks must be 3D and `spacing_mm` must be a 3-element list. The description is done for the 2D case, and the f...
surface_distance/metrics.py
compute_surface_distances
capitaltg/surface-distance
314
python
def compute_surface_distances(mask_gt, mask_pred, spacing_mm): 'Computes closest distances from all surface points to the other surface.\n\n This function can be applied to 2D or 3D tensors. For 2D, both masks must be\n 2D and `spacing_mm` must be a 2-element list. For 3D, both masks must be 3D\n and `spacing_mm...
def compute_surface_distances(mask_gt, mask_pred, spacing_mm): 'Computes closest distances from all surface points to the other surface.\n\n This function can be applied to 2D or 3D tensors. For 2D, both masks must be\n 2D and `spacing_mm` must be a 2-element list. For 3D, both masks must be 3D\n and `spacing_mm...
9468613337b6f098551703cf30b04ae134f700e571fa2fd8f141f3ff570a295a
def compute_average_surface_distance(surface_distances): 'Returns the average surface distance.\n\n Computes the average surface distances by correctly taking the area of each\n surface element into account. Call compute_surface_distances(...) before, to\n obtain the `surface_distances` dict.\n\n Args:\n sur...
Returns the average surface distance. Computes the average surface distances by correctly taking the area of each surface element into account. Call compute_surface_distances(...) before, to obtain the `surface_distances` dict. Args: surface_distances: dict with "distances_gt_to_pred", "distances_pred_to_gt" "sur...
surface_distance/metrics.py
compute_average_surface_distance
capitaltg/surface-distance
314
python
def compute_average_surface_distance(surface_distances): 'Returns the average surface distance.\n\n Computes the average surface distances by correctly taking the area of each\n surface element into account. Call compute_surface_distances(...) before, to\n obtain the `surface_distances` dict.\n\n Args:\n sur...
def compute_average_surface_distance(surface_distances): 'Returns the average surface distance.\n\n Computes the average surface distances by correctly taking the area of each\n surface element into account. Call compute_surface_distances(...) before, to\n obtain the `surface_distances` dict.\n\n Args:\n sur...
81e48d4bcad7af1d7b4dccd47fb5635d2a5b9ae63c406306313f2e8f7040c221
def compute_robust_hausdorff(surface_distances, percent): 'Computes the robust Hausdorff distance.\n\n Computes the robust Hausdorff distance. "Robust", because it uses the\n `percent` percentile of the distances instead of the maximum distance. The\n percentage is computed by correctly taking the area of each s...
Computes the robust Hausdorff distance. Computes the robust Hausdorff distance. "Robust", because it uses the `percent` percentile of the distances instead of the maximum distance. The percentage is computed by correctly taking the area of each surface element into account. Args: surface_distances: dict with "dista...
surface_distance/metrics.py
compute_robust_hausdorff
capitaltg/surface-distance
314
python
def compute_robust_hausdorff(surface_distances, percent): 'Computes the robust Hausdorff distance.\n\n Computes the robust Hausdorff distance. "Robust", because it uses the\n `percent` percentile of the distances instead of the maximum distance. The\n percentage is computed by correctly taking the area of each s...
def compute_robust_hausdorff(surface_distances, percent): 'Computes the robust Hausdorff distance.\n\n Computes the robust Hausdorff distance. "Robust", because it uses the\n `percent` percentile of the distances instead of the maximum distance. The\n percentage is computed by correctly taking the area of each s...
7c753fb5bf1d89af27e9b391e44449f238921f69bd34ec371fb644c6e37c470e
def compute_surface_overlap_at_tolerance(surface_distances, tolerance_mm): 'Computes the overlap of the surfaces at a specified tolerance.\n\n Computes the overlap of the ground truth surface with the predicted surface\n and vice versa allowing a specified tolerance (maximum surface-to-surface\n distance that is...
Computes the overlap of the surfaces at a specified tolerance. Computes the overlap of the ground truth surface with the predicted surface and vice versa allowing a specified tolerance (maximum surface-to-surface distance that is regarded as overlapping). The overlapping fraction is computed by correctly taking the ar...
surface_distance/metrics.py
compute_surface_overlap_at_tolerance
capitaltg/surface-distance
314
python
def compute_surface_overlap_at_tolerance(surface_distances, tolerance_mm): 'Computes the overlap of the surfaces at a specified tolerance.\n\n Computes the overlap of the ground truth surface with the predicted surface\n and vice versa allowing a specified tolerance (maximum surface-to-surface\n distance that is...
def compute_surface_overlap_at_tolerance(surface_distances, tolerance_mm): 'Computes the overlap of the surfaces at a specified tolerance.\n\n Computes the overlap of the ground truth surface with the predicted surface\n and vice versa allowing a specified tolerance (maximum surface-to-surface\n distance that is...
e00c6527a5ea73360f75ba08c6d5eca202d2480c034e6bbdd689f822eed2523a
def compute_surface_dice_at_tolerance(surface_distances, tolerance_mm): 'Computes the _surface_ DICE coefficient at a specified tolerance.\n\n Computes the _surface_ DICE coefficient at a specified tolerance. Not to be\n confused with the standard _volumetric_ DICE coefficient. The surface DICE\n measures the ov...
Computes the _surface_ DICE coefficient at a specified tolerance. Computes the _surface_ DICE coefficient at a specified tolerance. Not to be confused with the standard _volumetric_ DICE coefficient. The surface DICE measures the overlap of two surfaces instead of two volumes. A surface element is counted as overlappi...
surface_distance/metrics.py
compute_surface_dice_at_tolerance
capitaltg/surface-distance
314
python
def compute_surface_dice_at_tolerance(surface_distances, tolerance_mm): 'Computes the _surface_ DICE coefficient at a specified tolerance.\n\n Computes the _surface_ DICE coefficient at a specified tolerance. Not to be\n confused with the standard _volumetric_ DICE coefficient. The surface DICE\n measures the ov...
def compute_surface_dice_at_tolerance(surface_distances, tolerance_mm): 'Computes the _surface_ DICE coefficient at a specified tolerance.\n\n Computes the _surface_ DICE coefficient at a specified tolerance. Not to be\n confused with the standard _volumetric_ DICE coefficient. The surface DICE\n measures the ov...
2cd50922da64d10172e99ec023bfb230b220884606d4a99371bf60185138e8bc
def compute_dice_coefficient(mask_gt, mask_pred): 'Computes soerensen-dice coefficient.\n\n compute the soerensen-dice coefficient between the ground truth mask `mask_gt`\n and the predicted mask `mask_pred`.\n\n Args:\n mask_gt: 3-dim Numpy array of type bool. The ground truth mask.\n mask_pred: 3-dim Num...
Computes soerensen-dice coefficient. compute the soerensen-dice coefficient between the ground truth mask `mask_gt` and the predicted mask `mask_pred`. Args: mask_gt: 3-dim Numpy array of type bool. The ground truth mask. mask_pred: 3-dim Numpy array of type bool. The predicted mask. Returns: the dice coeffcie...
surface_distance/metrics.py
compute_dice_coefficient
capitaltg/surface-distance
314
python
def compute_dice_coefficient(mask_gt, mask_pred): 'Computes soerensen-dice coefficient.\n\n compute the soerensen-dice coefficient between the ground truth mask `mask_gt`\n and the predicted mask `mask_pred`.\n\n Args:\n mask_gt: 3-dim Numpy array of type bool. The ground truth mask.\n mask_pred: 3-dim Num...
def compute_dice_coefficient(mask_gt, mask_pred): 'Computes soerensen-dice coefficient.\n\n compute the soerensen-dice coefficient between the ground truth mask `mask_gt`\n and the predicted mask `mask_pred`.\n\n Args:\n mask_gt: 3-dim Numpy array of type bool. The ground truth mask.\n mask_pred: 3-dim Num...
edd0d652a34d55d4a34dd67da432c61e05d43cd72a73bb5267f004046cfbbf4b
def addUsers(rosterName, users): 'Adds a list of users to an existing roster.\n\n Users are always appended to the end of the roster.\n\n Args:\n rosterName: The name of the roster to modify.\n users: A list of User objects that will be added to the end of\n the roster. User objects c...
Adds a list of users to an existing roster. Users are always appended to the end of the roster. Args: rosterName: The name of the roster to modify. users: A list of User objects that will be added to the end of the roster. User objects can be created with the system.user.getUser and system.use...
src/system/roster.py
addUsers
thecesrom/8.1
1
python
def addUsers(rosterName, users): 'Adds a list of users to an existing roster.\n\n Users are always appended to the end of the roster.\n\n Args:\n rosterName: The name of the roster to modify.\n users: A list of User objects that will be added to the end of\n the roster. User objects c...
def addUsers(rosterName, users): 'Adds a list of users to an existing roster.\n\n Users are always appended to the end of the roster.\n\n Args:\n rosterName: The name of the roster to modify.\n users: A list of User objects that will be added to the end of\n the roster. User objects c...
260c7a121dbca8cfff88a30ad1fa2ad4642394cc80342d313ed0d8498150d584
def createRoster(name, description): 'Creates a roster with the given name and description, if it does\n not already exist.\n\n This function was designed to run in the Gateway and in Perspective\n sessions. If creating rosters from Vision clients, use\n system.alarm.createRoster instead.\n\n Args:\n...
Creates a roster with the given name and description, if it does not already exist. This function was designed to run in the Gateway and in Perspective sessions. If creating rosters from Vision clients, use system.alarm.createRoster instead. Args: name: The name of the roster to create. description: The descr...
src/system/roster.py
createRoster
thecesrom/8.1
1
python
def createRoster(name, description): 'Creates a roster with the given name and description, if it does\n not already exist.\n\n This function was designed to run in the Gateway and in Perspective\n sessions. If creating rosters from Vision clients, use\n system.alarm.createRoster instead.\n\n Args:\n...
def createRoster(name, description): 'Creates a roster with the given name and description, if it does\n not already exist.\n\n This function was designed to run in the Gateway and in Perspective\n sessions. If creating rosters from Vision clients, use\n system.alarm.createRoster instead.\n\n Args:\n...
0b33251c5cbca4e46257aedb64bcbf8e60786cd3d147bcb4872c61366f5584aa
def deleteRoster(rosterName): 'Deletes a roster with the given name.\n\n Args:\n rosterName: The name of the roster to delete.\n ' print(rosterName)
Deletes a roster with the given name. Args: rosterName: The name of the roster to delete.
src/system/roster.py
deleteRoster
thecesrom/8.1
1
python
def deleteRoster(rosterName): 'Deletes a roster with the given name.\n\n Args:\n rosterName: The name of the roster to delete.\n ' print(rosterName)
def deleteRoster(rosterName): 'Deletes a roster with the given name.\n\n Args:\n rosterName: The name of the roster to delete.\n ' print(rosterName)<|docstring|>Deletes a roster with the given name. Args: rosterName: The name of the roster to delete.<|endoftext|>
e2e1b7ab5d7207d6f117031f2a4b80fcac0eebda77dab6c4492c8f3ec354d525
def getRosters(): 'Returns a dictionary of rosters, where the key is the name of the\n roster, and the value is an array list of string user names.\n\n This function was designed to run in the Gateway and in Perspective\n sessions. If creating rosters from Vision clients, use\n system.alarm.getRosters i...
Returns a dictionary of rosters, where the key is the name of the roster, and the value is an array list of string user names. This function was designed to run in the Gateway and in Perspective sessions. If creating rosters from Vision clients, use system.alarm.getRosters instead. Returns: A dictionary that maps...
src/system/roster.py
getRosters
thecesrom/8.1
1
python
def getRosters(): 'Returns a dictionary of rosters, where the key is the name of the\n roster, and the value is an array list of string user names.\n\n This function was designed to run in the Gateway and in Perspective\n sessions. If creating rosters from Vision clients, use\n system.alarm.getRosters i...
def getRosters(): 'Returns a dictionary of rosters, where the key is the name of the\n roster, and the value is an array list of string user names.\n\n This function was designed to run in the Gateway and in Perspective\n sessions. If creating rosters from Vision clients, use\n system.alarm.getRosters i...
db39027696da9fa3fe84a9ea41db173b1a6ca3ced68f629602cbe4664ec6f053
def removeUsers(rosterName, users): 'Removes one or more users from an existing roster.\n\n Args:\n rosterName: The name of the roster to modify.\n users: A list of user objects that will be added to the end of\n the roster. User objects can be created with the\n system.user.g...
Removes one or more users from an existing roster. Args: rosterName: The name of the roster to modify. users: A list of user objects that will be added to the end of the roster. User objects can be created with the system.user.getUser and system.user.addUser functions.
src/system/roster.py
removeUsers
thecesrom/8.1
1
python
def removeUsers(rosterName, users): 'Removes one or more users from an existing roster.\n\n Args:\n rosterName: The name of the roster to modify.\n users: A list of user objects that will be added to the end of\n the roster. User objects can be created with the\n system.user.g...
def removeUsers(rosterName, users): 'Removes one or more users from an existing roster.\n\n Args:\n rosterName: The name of the roster to modify.\n users: A list of user objects that will be added to the end of\n the roster. User objects can be created with the\n system.user.g...
36001eb5586089ab272cdd2a5387f93910e6430bb9075181990fba6cb9fcf20d
def get_strategy(buffer_mem_size, block_size, block_row_size, block_slice_size): ' Get clustered writes best load strategy given the memory available for io optimization.\n\n Returns:\n ---------\n strategy\n ' if (buffer_mem_size < block_size): raise ValueError('Buffer size too small fo...
Get clustered writes best load strategy given the memory available for io optimization. Returns: --------- strategy
repartition_experiments/algorithms/clustered_writes.py
get_strategy
big-data-lab-team/repartition_experiments
0
python
def get_strategy(buffer_mem_size, block_size, block_row_size, block_slice_size): ' Get clustered writes best load strategy given the memory available for io optimization.\n\n Returns:\n ---------\n strategy\n ' if (buffer_mem_size < block_size): raise ValueError('Buffer size too small fo...
def get_strategy(buffer_mem_size, block_size, block_row_size, block_slice_size): ' Get clustered writes best load strategy given the memory available for io optimization.\n\n Returns:\n ---------\n strategy\n ' if (buffer_mem_size < block_size): raise ValueError('Buffer size too small fo...
f29d59b77a8911dfd765538bad57e0cce6adf6457c69e718b396eb44134692c9
def compute_buffers(buffer_mem_size, strategy, origarr_size, cs, block_size, block_row_size, block_slice_size, partition, R, bytes_per_voxel): '\n partition: partition tuple of R by O = nb chunks per dimension\n ' def get_last_slab(): return buffers = dict() index = 0 if (strategy...
partition: partition tuple of R by O = nb chunks per dimension
repartition_experiments/algorithms/clustered_writes.py
compute_buffers
big-data-lab-team/repartition_experiments
0
python
def compute_buffers(buffer_mem_size, strategy, origarr_size, cs, block_size, block_row_size, block_slice_size, partition, R, bytes_per_voxel): '\n \n ' def get_last_slab(): return buffers = dict() index = 0 if (strategy == 2): slices_per_buffer = math.floor((buffer_mem_siz...
def compute_buffers(buffer_mem_size, strategy, origarr_size, cs, block_size, block_row_size, block_slice_size, partition, R, bytes_per_voxel): '\n \n ' def get_last_slab(): return buffers = dict() index = 0 if (strategy == 2): slices_per_buffer = math.floor((buffer_mem_siz...
4314f999db689e454cfa129666e17401f101d47a3eaf56dae9a7449bc5ac4fac
def clustered_writes(origarr_filepath, R, cs, bpv, m, ff, outdir_path): ' Implementation of the clustered strategy for splitting a 3D array.\n Output file names are following the following regex: outdir_path/{i}_{j}_{k}.extension\n WARNING: this implementation loads the whole input array in RAM. We had 250GB ...
Implementation of the clustered strategy for splitting a 3D array. Output file names are following the following regex: outdir_path/{i}_{j}_{k}.extension WARNING: this implementation loads the whole input array in RAM. We had 250GB of RAM for our experiments so we decided to use it. Arguments: ---------- R: origi...
repartition_experiments/algorithms/clustered_writes.py
clustered_writes
big-data-lab-team/repartition_experiments
0
python
def clustered_writes(origarr_filepath, R, cs, bpv, m, ff, outdir_path): ' Implementation of the clustered strategy for splitting a 3D array.\n Output file names are following the following regex: outdir_path/{i}_{j}_{k}.extension\n WARNING: this implementation loads the whole input array in RAM. We had 250GB ...
def clustered_writes(origarr_filepath, R, cs, bpv, m, ff, outdir_path): ' Implementation of the clustered strategy for splitting a 3D array.\n Output file names are following the following regex: outdir_path/{i}_{j}_{k}.extension\n WARNING: this implementation loads the whole input array in RAM. We had 250GB ...
4c36d80c2a0c73bb112ac65c161a75393fd8f63bafc38f5ed56c27527810d053
def kill_proc_tree(pid, sig=signal.SIGTERM, include_parent=True, timeout=None, on_terminate=None): 'Kill a process tree (including grandchildren) with signal\n "sig" and return a (gone, still_alive) tuple.\n "on_terminate", if specified, is a callback function which is\n called as soon as a child terminate...
Kill a process tree (including grandchildren) with signal "sig" and return a (gone, still_alive) tuple. "on_terminate", if specified, is a callback function which is called as soon as a child terminates.
helpers.py
kill_proc_tree
JavaScriptDude/PayPalAuthIntent
1
python
def kill_proc_tree(pid, sig=signal.SIGTERM, include_parent=True, timeout=None, on_terminate=None): 'Kill a process tree (including grandchildren) with signal\n "sig" and return a (gone, still_alive) tuple.\n "on_terminate", if specified, is a callback function which is\n called as soon as a child terminate...
def kill_proc_tree(pid, sig=signal.SIGTERM, include_parent=True, timeout=None, on_terminate=None): 'Kill a process tree (including grandchildren) with signal\n "sig" and return a (gone, still_alive) tuple.\n "on_terminate", if specified, is a callback function which is\n called as soon as a child terminate...
0630056dc6e20e0e56411c5e34a0f74536548b5265e7e08bab921552826e9e99
def compound_statement(env, node): '\n Compound statement def for AST.\n interpret - runtime function for Evaluator (interpret first and second statement operators).\n ' node.first.interpret(env) node.second.interpret(env)
Compound statement def for AST. interpret - runtime function for Evaluator (interpret first and second statement operators).
src/Interpreter/Eval/common.py
compound_statement
PetukhovVictor/compiler2
3
python
def compound_statement(env, node): '\n Compound statement def for AST.\n interpret - runtime function for Evaluator (interpret first and second statement operators).\n ' node.first.interpret(env) node.second.interpret(env)
def compound_statement(env, node): '\n Compound statement def for AST.\n interpret - runtime function for Evaluator (interpret first and second statement operators).\n ' node.first.interpret(env) node.second.interpret(env)<|docstring|>Compound statement def for AST. interpret - runtime function for...
923c29daab264df1d416469b6ca278e208315ed253467f1172e0f124ba4d0614
def enumeration(env, node): "\n 'Enumeration' statement class for AST.\n interpret - runtime function for Evaluator (empty function).\n " return node.elements
'Enumeration' statement class for AST. interpret - runtime function for Evaluator (empty function).
src/Interpreter/Eval/common.py
enumeration
PetukhovVictor/compiler2
3
python
def enumeration(env, node): "\n 'Enumeration' statement class for AST.\n interpret - runtime function for Evaluator (empty function).\n " return node.elements
def enumeration(env, node): "\n 'Enumeration' statement class for AST.\n interpret - runtime function for Evaluator (empty function).\n " return node.elements<|docstring|>'Enumeration' statement class for AST. interpret - runtime function for Evaluator (empty function).<|endoftext|>
4ada6f0e3a97b011d53bfcf6deba879bf95e20ddd730b97345c360c5016e58cb
def update(self): ' Update stats and account information from Slushpool. ' self.stats.update() if (self.account is not None): self.account.update()
Update stats and account information from Slushpool.
slushpool/__init__.py
update
RyanMalaspina/slushpool-python
1
python
def update(self): ' ' self.stats.update() if (self.account is not None): self.account.update()
def update(self): ' ' self.stats.update() if (self.account is not None): self.account.update()<|docstring|>Update stats and account information from Slushpool.<|endoftext|>
f2e4ffae15f87e1c5f14f68ddcf32e7ac1c03391f70a6e0c50e2919d8b1dc565
def orbit_to_poincare_polar(orbit): '\n Convert an array of 6D Cartesian positions to Poincaré\n symplectic polar coordinates. These are similar to cylindrical\n coordinates.\n\n Parameters\n ----------\n\n ' if (orbit.norbits > 1): raise RuntimeError('Can only use with one orbit.') ...
Convert an array of 6D Cartesian positions to Poincaré symplectic polar coordinates. These are similar to cylindrical coordinates. Parameters ----------
barchaos/experiments/util.py
orbit_to_poincare_polar
adrn/BarChaos
0
python
def orbit_to_poincare_polar(orbit): '\n Convert an array of 6D Cartesian positions to Poincaré\n symplectic polar coordinates. These are similar to cylindrical\n coordinates.\n\n Parameters\n ----------\n\n ' if (orbit.norbits > 1): raise RuntimeError('Can only use with one orbit.') ...
def orbit_to_poincare_polar(orbit): '\n Convert an array of 6D Cartesian positions to Poincaré\n symplectic polar coordinates. These are similar to cylindrical\n coordinates.\n\n Parameters\n ----------\n\n ' if (orbit.norbits > 1): raise RuntimeError('Can only use with one orbit.') ...
dfa0b6f0903ac1d7538f4c521df1921ca465a7cde9f27545faf7ee38394ea302
def init_app(self, application: Flask): '\n Initialize Flask application\n\n :param application: Flask application to initialize with environment variables\n :return:\n ' variables = self._get_vars() for (key, value) in variables.items(): application.config[key] = value
Initialize Flask application :param application: Flask application to initialize with environment variables :return:
flask_py_config_env/Environment.py
init_app
aaronestrada/flask-py-config-env
0
python
def init_app(self, application: Flask): '\n Initialize Flask application\n\n :param application: Flask application to initialize with environment variables\n :return:\n ' variables = self._get_vars() for (key, value) in variables.items(): application.config[key] = value
def init_app(self, application: Flask): '\n Initialize Flask application\n\n :param application: Flask application to initialize with environment variables\n :return:\n ' variables = self._get_vars() for (key, value) in variables.items(): application.config[key] = value<|...
fbb0d0ca4d31a734c870a3ec505771eded76e52dda4448427aaad679979a3f7a
def get_argparse() -> ArgumentParser: '\n Get argument parser.\n\n :return: argument parser.\n :rtype: ArgumentParser\n ' parser = ArgumentParser(prog='text-clf') parser.add_argument('--config', type=str, required=False, default='config.yaml', help='Path to config') return parser
Get argument parser. :return: argument parser. :rtype: ArgumentParser
text_clf/utils.py
get_argparse
igvasilev/text-classification-baseline
0
python
def get_argparse() -> ArgumentParser: '\n Get argument parser.\n\n :return: argument parser.\n :rtype: ArgumentParser\n ' parser = ArgumentParser(prog='text-clf') parser.add_argument('--config', type=str, required=False, default='config.yaml', help='Path to config') return parser
def get_argparse() -> ArgumentParser: '\n Get argument parser.\n\n :return: argument parser.\n :rtype: ArgumentParser\n ' parser = ArgumentParser(prog='text-clf') parser.add_argument('--config', type=str, required=False, default='config.yaml', help='Path to config') return parser<|docstring|...
7e12492a12f725bd95a25838ec2ca90d0f797c86fe03bb3dd4dbf9c50bdab980
def get_config(path_to_config: str) -> Dict[(str, Any)]: '\n Get config.\n\n :param str path_to_config: path to config.\n :return: config.\n :rtype: Dict[str, Any]\n ' now = datetime.datetime.now() with open(path_to_config, mode='r') as fp: config = yaml.safe_load(fp) config['path...
Get config. :param str path_to_config: path to config. :return: config. :rtype: Dict[str, Any]
text_clf/utils.py
get_config
igvasilev/text-classification-baseline
0
python
def get_config(path_to_config: str) -> Dict[(str, Any)]: '\n Get config.\n\n :param str path_to_config: path to config.\n :return: config.\n :rtype: Dict[str, Any]\n ' now = datetime.datetime.now() with open(path_to_config, mode='r') as fp: config = yaml.safe_load(fp) config['path...
def get_config(path_to_config: str) -> Dict[(str, Any)]: '\n Get config.\n\n :param str path_to_config: path to config.\n :return: config.\n :rtype: Dict[str, Any]\n ' now = datetime.datetime.now() with open(path_to_config, mode='r') as fp: config = yaml.safe_load(fp) config['path...
050609940a60022e6da95f53e1938bd0d260a80271f6b10c9779ac993d047c10
def get_logger(path_to_logfile: str) -> logging.Logger: '\n Get logger.\n\n :param str path_to_logfile: path to logfile.\n :return: logger.\n :rtype: logging.Logger\n ' logger = logging.getLogger('text-clf') logger.setLevel(logging.INFO) stream_handler = logging.StreamHandler(sys.stdout) ...
Get logger. :param str path_to_logfile: path to logfile. :return: logger. :rtype: logging.Logger
text_clf/utils.py
get_logger
igvasilev/text-classification-baseline
0
python
def get_logger(path_to_logfile: str) -> logging.Logger: '\n Get logger.\n\n :param str path_to_logfile: path to logfile.\n :return: logger.\n :rtype: logging.Logger\n ' logger = logging.getLogger('text-clf') logger.setLevel(logging.INFO) stream_handler = logging.StreamHandler(sys.stdout) ...
def get_logger(path_to_logfile: str) -> logging.Logger: '\n Get logger.\n\n :param str path_to_logfile: path to logfile.\n :return: logger.\n :rtype: logging.Logger\n ' logger = logging.getLogger('text-clf') logger.setLevel(logging.INFO) stream_handler = logging.StreamHandler(sys.stdout) ...
3a76c3fb298c6e0e2e5708a1aa54b66cabe174d2ea66a71d409c6d7c9dadd1ca
def set_seed(seed: int) -> None: '\n Set seed for reproducibility.\n\n :param int seed: seed.\n ' random.seed(seed) np.random.seed(seed)
Set seed for reproducibility. :param int seed: seed.
text_clf/utils.py
set_seed
igvasilev/text-classification-baseline
0
python
def set_seed(seed: int) -> None: '\n Set seed for reproducibility.\n\n :param int seed: seed.\n ' random.seed(seed) np.random.seed(seed)
def set_seed(seed: int) -> None: '\n Set seed for reproducibility.\n\n :param int seed: seed.\n ' random.seed(seed) np.random.seed(seed)<|docstring|>Set seed for reproducibility. :param int seed: seed.<|endoftext|>
5531cb446c63e06766af88073ec4312a53ff63e59285c7847ab3a96759ee715e
def __call__(self, output): ' Return the first available format in the priority.\n\n Produces a UserWarning if no compatible mimetype is found.\n\n `output` is dict with structure {mimetype-of-element: value-of-element}\n\n ' metadata = self.metadata.get(self.notebook_path, {}) widgets_...
Return the first available format in the priority. Produces a UserWarning if no compatible mimetype is found. `output` is dict with structure {mimetype-of-element: value-of-element}
nbconvert/filters/widgetsdatatypefilter.py
__call__
TylerAnderson22/nbconvert
1,367
python
def __call__(self, output): ' Return the first available format in the priority.\n\n Produces a UserWarning if no compatible mimetype is found.\n\n `output` is dict with structure {mimetype-of-element: value-of-element}\n\n ' metadata = self.metadata.get(self.notebook_path, {}) widgets_...
def __call__(self, output): ' Return the first available format in the priority.\n\n Produces a UserWarning if no compatible mimetype is found.\n\n `output` is dict with structure {mimetype-of-element: value-of-element}\n\n ' metadata = self.metadata.get(self.notebook_path, {}) widgets_...
54f670c2df206bb498144ad33d9087ae09af2862adf102ce9560def86d747926
def discardConflictingDocument(couchDbInstance, data, result): '\n _discardConflictingDocument_\n\n This should be passed to the queue and commit calls of CMSCouch\n in order to tell it what to do with conflicting documents.\n In this case we trash the old one and replace with what we were\n trying t...
_discardConflictingDocument_ This should be passed to the queue and commit calls of CMSCouch in order to tell it what to do with conflicting documents. In this case we trash the old one and replace with what we were trying to commit, this is available in the data argument. And the result tells us the id of the conflic...
src/python/WMCore/JobStateMachine/ChangeState.py
discardConflictingDocument
hufnagel/WMCore
1
python
def discardConflictingDocument(couchDbInstance, data, result): '\n _discardConflictingDocument_\n\n This should be passed to the queue and commit calls of CMSCouch\n in order to tell it what to do with conflicting documents.\n In this case we trash the old one and replace with what we were\n trying t...
def discardConflictingDocument(couchDbInstance, data, result): '\n _discardConflictingDocument_\n\n This should be passed to the queue and commit calls of CMSCouch\n in order to tell it what to do with conflicting documents.\n In this case we trash the old one and replace with what we were\n trying t...
10858f2424b7dde6bc29a06426b69fc4021141e335df1fc6d8ba330665c207e9
def _connectDatabases(self): '\n Try connecting to the couchdbs\n ' if ((not hasattr(self, 'jobsdatabase')) or (self.jobsdatabase is None)): try: self.jobsdatabase = self.couchdb.connectDatabase(('%s/jobs' % self.dbname), size=250) except Exception as ex: lo...
Try connecting to the couchdbs
src/python/WMCore/JobStateMachine/ChangeState.py
_connectDatabases
hufnagel/WMCore
1
python
def _connectDatabases(self): '\n \n ' if ((not hasattr(self, 'jobsdatabase')) or (self.jobsdatabase is None)): try: self.jobsdatabase = self.couchdb.connectDatabase(('%s/jobs' % self.dbname), size=250) except Exception as ex: logging.error("Error connecting ...
def _connectDatabases(self): '\n \n ' if ((not hasattr(self, 'jobsdatabase')) or (self.jobsdatabase is None)): try: self.jobsdatabase = self.couchdb.connectDatabase(('%s/jobs' % self.dbname), size=250) except Exception as ex: logging.error("Error connecting ...
101b7a9bd45977bd6dcc14d3b34baec3df1c402e585f2201070f60f34f7cfec4
def propagate(self, jobs, newstate, oldstate, updatesummary=False): '\n Move the job from a state to another. Book keep the change to CouchDB.\n Report the information to the Dashboard.\n Take a list of job objects (dicts) and the desired state change.\n Return the jobs back, throw asser...
Move the job from a state to another. Book keep the change to CouchDB. Report the information to the Dashboard. Take a list of job objects (dicts) and the desired state change. Return the jobs back, throw assertion error if the state change is not allowed and other exceptions as appropriate
src/python/WMCore/JobStateMachine/ChangeState.py
propagate
hufnagel/WMCore
1
python
def propagate(self, jobs, newstate, oldstate, updatesummary=False): '\n Move the job from a state to another. Book keep the change to CouchDB.\n Report the information to the Dashboard.\n Take a list of job objects (dicts) and the desired state change.\n Return the jobs back, throw asser...
def propagate(self, jobs, newstate, oldstate, updatesummary=False): '\n Move the job from a state to another. Book keep the change to CouchDB.\n Report the information to the Dashboard.\n Take a list of job objects (dicts) and the desired state change.\n Return the jobs back, throw asser...
3028f28c9748ce4ed6b7fd1a2965b93358a4c4d1edaffbdd7b911b3a9d5d8e5c
def check(self, newstate, oldstate): '\n check that the transition is allowed. return a tuple of the transition\n if it is allowed, throw up an exception if not.\n ' newstate = newstate.lower() oldstate = oldstate.lower() transitions = Transitions() assert (newstate in transitio...
check that the transition is allowed. return a tuple of the transition if it is allowed, throw up an exception if not.
src/python/WMCore/JobStateMachine/ChangeState.py
check
hufnagel/WMCore
1
python
def check(self, newstate, oldstate): '\n check that the transition is allowed. return a tuple of the transition\n if it is allowed, throw up an exception if not.\n ' newstate = newstate.lower() oldstate = oldstate.lower() transitions = Transitions() assert (newstate in transitio...
def check(self, newstate, oldstate): '\n check that the transition is allowed. return a tuple of the transition\n if it is allowed, throw up an exception if not.\n ' newstate = newstate.lower() oldstate = oldstate.lower() transitions = Transitions() assert (newstate in transitio...
53189b6b85f233f6485cfa410447e2547cca886d21f06b75d81483fc35dd28bb
def recordInCouch(self, jobs, newstate, oldstate, updatesummary=False): '\n _recordInCouch_\n\n Record relevant job information in couch. If the job does not yet exist\n in couch it will be saved as a seperate document. If the job has a FWJR\n attached that will be saved as a seperate d...
_recordInCouch_ Record relevant job information in couch. If the job does not yet exist in couch it will be saved as a seperate document. If the job has a FWJR attached that will be saved as a seperate document.
src/python/WMCore/JobStateMachine/ChangeState.py
recordInCouch
hufnagel/WMCore
1
python
def recordInCouch(self, jobs, newstate, oldstate, updatesummary=False): '\n _recordInCouch_\n\n Record relevant job information in couch. If the job does not yet exist\n in couch it will be saved as a seperate document. If the job has a FWJR\n attached that will be saved as a seperate d...
def recordInCouch(self, jobs, newstate, oldstate, updatesummary=False): '\n _recordInCouch_\n\n Record relevant job information in couch. If the job does not yet exist\n in couch it will be saved as a seperate document. If the job has a FWJR\n attached that will be saved as a seperate d...
bc3f1125339e113d925a1652ea1d44f5382c8da861d6f92ec3d96e0e5e1a9aa1
def persist(self, jobs, newstate, oldstate): '\n _persist_\n\n Update the job state in the database.\n ' if (newstate == 'killed'): self.incrementRetryDAO.execute(jobs, increment=99999, conn=self.getDBConn(), transaction=self.existingTransaction()) elif ((oldstate == 'submitcool...
_persist_ Update the job state in the database.
src/python/WMCore/JobStateMachine/ChangeState.py
persist
hufnagel/WMCore
1
python
def persist(self, jobs, newstate, oldstate): '\n _persist_\n\n Update the job state in the database.\n ' if (newstate == 'killed'): self.incrementRetryDAO.execute(jobs, increment=99999, conn=self.getDBConn(), transaction=self.existingTransaction()) elif ((oldstate == 'submitcool...
def persist(self, jobs, newstate, oldstate): '\n _persist_\n\n Update the job state in the database.\n ' if (newstate == 'killed'): self.incrementRetryDAO.execute(jobs, increment=99999, conn=self.getDBConn(), transaction=self.existingTransaction()) elif ((oldstate == 'submitcool...
d536c0a06a707218c88e0f298093f936eb68a1dd3c9af91405498c756d921014
def reportToDashboard(self, jobs, newstate, oldstate): '\n _reportToDashboard_\n\n Report job information to the dashboard, completes the job dictionaries\n with any additional information needed\n ' if (newstate == 'created'): incrementRetry = (True if ('cooloff' in oldstate...
_reportToDashboard_ Report job information to the dashboard, completes the job dictionaries with any additional information needed
src/python/WMCore/JobStateMachine/ChangeState.py
reportToDashboard
hufnagel/WMCore
1
python
def reportToDashboard(self, jobs, newstate, oldstate): '\n _reportToDashboard_\n\n Report job information to the dashboard, completes the job dictionaries\n with any additional information needed\n ' if (newstate == 'created'): incrementRetry = (True if ('cooloff' in oldstate...
def reportToDashboard(self, jobs, newstate, oldstate): '\n _reportToDashboard_\n\n Report job information to the dashboard, completes the job dictionaries\n with any additional information needed\n ' if (newstate == 'created'): incrementRetry = (True if ('cooloff' in oldstate...
2e5f0fda478d2608bd1497f3d6864ddc04db44d99b9fe2a91f74722c399120fe
def recordLocationChange(self, jobs): '\n _recordLocationChange_\n\n Record a location change in couch and WMBS,\n this expects a list of dictionaries with\n jobid and location keys which represent\n the job id in WMBS and new location respectively.\n ' if (not self._co...
_recordLocationChange_ Record a location change in couch and WMBS, this expects a list of dictionaries with jobid and location keys which represent the job id in WMBS and new location respectively.
src/python/WMCore/JobStateMachine/ChangeState.py
recordLocationChange
hufnagel/WMCore
1
python
def recordLocationChange(self, jobs): '\n _recordLocationChange_\n\n Record a location change in couch and WMBS,\n this expects a list of dictionaries with\n jobid and location keys which represent\n the job id in WMBS and new location respectively.\n ' if (not self._co...
def recordLocationChange(self, jobs): '\n _recordLocationChange_\n\n Record a location change in couch and WMBS,\n this expects a list of dictionaries with\n jobid and location keys which represent\n the job id in WMBS and new location respectively.\n ' if (not self._co...
32d189fd617411eaa3e12622c2c36bb2e1901bdee96225eb562018037255be07
def getTicker(pair='btc_idr', session=None): '\n Retrieve the ticker for the given pair. Returns a Ticker instance.\n\n Arguments:\n pair : trading pair\n session : vipbtc.Session object\n ' response = get_data(pair, 'ticker', requests_session=session) ticker = {} for s in ('high', 'low'...
Retrieve the ticker for the given pair. Returns a Ticker instance. Arguments: pair : trading pair session : vipbtc.Session object
vipbtc/public.py
getTicker
AchmadGozali8/btcid
8
python
def getTicker(pair='btc_idr', session=None): '\n Retrieve the ticker for the given pair. Returns a Ticker instance.\n\n Arguments:\n pair : trading pair\n session : vipbtc.Session object\n ' response = get_data(pair, 'ticker', requests_session=session) ticker = {} for s in ('high', 'low'...
def getTicker(pair='btc_idr', session=None): '\n Retrieve the ticker for the given pair. Returns a Ticker instance.\n\n Arguments:\n pair : trading pair\n session : vipbtc.Session object\n ' response = get_data(pair, 'ticker', requests_session=session) ticker = {} for s in ('high', 'low'...
17604bda530d0e1f865ed6e66156e78eccea607e0249cabb1312227d3a2d43e1
def getDepth(pair='btc_idr', session=None): '\n Retrieve the depth for the given pair. Returns a dictionary of asks and bids dataframe.\n \n Arguments:\n pair : trading pair\n session : vipbtc.Session object\n ' depth = get_data(pair, 'depth', requests_session=session) asks = pd.DataFrame...
Retrieve the depth for the given pair. Returns a dictionary of asks and bids dataframe. Arguments: pair : trading pair session : vipbtc.Session object
vipbtc/public.py
getDepth
AchmadGozali8/btcid
8
python
def getDepth(pair='btc_idr', session=None): '\n Retrieve the depth for the given pair. Returns a dictionary of asks and bids dataframe.\n \n Arguments:\n pair : trading pair\n session : vipbtc.Session object\n ' depth = get_data(pair, 'depth', requests_session=session) asks = pd.DataFrame...
def getDepth(pair='btc_idr', session=None): '\n Retrieve the depth for the given pair. Returns a dictionary of asks and bids dataframe.\n \n Arguments:\n pair : trading pair\n session : vipbtc.Session object\n ' depth = get_data(pair, 'depth', requests_session=session) asks = pd.DataFrame...
5346cadb4da9f0763489b711de0badee7b372e855de42210c5b80e88d67d34ba
def getTradeHistory(pair='btc_idr', session=None): '\n Retrieve the trade history for the given pair. Returns a pandas dataframe.\n \n Arguments:\n pair : trading pair\n session : vipbtc.Session object\n ' history = get_data(pair, 'trades', requests_session=session) df = pd.DataFrame(hist...
Retrieve the trade history for the given pair. Returns a pandas dataframe. Arguments: pair : trading pair session : vipbtc.Session object
vipbtc/public.py
getTradeHistory
AchmadGozali8/btcid
8
python
def getTradeHistory(pair='btc_idr', session=None): '\n Retrieve the trade history for the given pair. Returns a pandas dataframe.\n \n Arguments:\n pair : trading pair\n session : vipbtc.Session object\n ' history = get_data(pair, 'trades', requests_session=session) df = pd.DataFrame(hist...
def getTradeHistory(pair='btc_idr', session=None): '\n Retrieve the trade history for the given pair. Returns a pandas dataframe.\n \n Arguments:\n pair : trading pair\n session : vipbtc.Session object\n ' history = get_data(pair, 'trades', requests_session=session) df = pd.DataFrame(hist...
d3a777414ed8a81ac3da6d9b1a6fbc8d9bd684c80ee88cf37eb63a20723e0b2e
def run(ceph_cluster, **kw): "\n Pre-requisites :\n 1. create fs volume create cephfs and cephfs-ec\n\n Subvolume Group Operations :\n 1. ceph fs subvolumegroup create <vol_name> <group_name> --pool_layout <data_pool_name>\n 2. ceph fs subvolume create <vol_name> <subvol_name> [--size <size_in_bytes>...
Pre-requisites : 1. create fs volume create cephfs and cephfs-ec Subvolume Group Operations : 1. ceph fs subvolumegroup create <vol_name> <group_name> --pool_layout <data_pool_name> 2. ceph fs subvolume create <vol_name> <subvol_name> [--size <size_in_bytes>] [--group_name <subvol_group_name>] 3. Mount subvolume on bo...
tests/cephfs/cephfs_volume_management/cephfs_vol_mgmt_subvolgroup_pool_layout.py
run
Gopi-Patta/cephci
21
python
def run(ceph_cluster, **kw): "\n Pre-requisites :\n 1. create fs volume create cephfs and cephfs-ec\n\n Subvolume Group Operations :\n 1. ceph fs subvolumegroup create <vol_name> <group_name> --pool_layout <data_pool_name>\n 2. ceph fs subvolume create <vol_name> <subvol_name> [--size <size_in_bytes>...
def run(ceph_cluster, **kw): "\n Pre-requisites :\n 1. create fs volume create cephfs and cephfs-ec\n\n Subvolume Group Operations :\n 1. ceph fs subvolumegroup create <vol_name> <group_name> --pool_layout <data_pool_name>\n 2. ceph fs subvolume create <vol_name> <subvol_name> [--size <size_in_bytes>...
cef6c797b7bf019514c6c3960bdc0751f0dd9c122f3f591e9ec676c09485a1db
def _reconstitute_job(self, job_state: dict) -> MySQLJob: '\n mysql返回的字典解析成 job对象\n :param job_state:\n :return:\n ' job_state['jobstore'] = self job_state['name'] = '{project_id}-{code_id}'.format(**job_state) if (job_state['trigger_type'] == 'cron'): job_state['trig...
mysql返回的字典解析成 job对象 :param job_state: :return:
bspider/bcron/jobstore.py
_reconstitute_job
littlebai3618/bspider
3
python
def _reconstitute_job(self, job_state: dict) -> MySQLJob: '\n mysql返回的字典解析成 job对象\n :param job_state:\n :return:\n ' job_state['jobstore'] = self job_state['name'] = '{project_id}-{code_id}'.format(**job_state) if (job_state['trigger_type'] == 'cron'): job_state['trig...
def _reconstitute_job(self, job_state: dict) -> MySQLJob: '\n mysql返回的字典解析成 job对象\n :param job_state:\n :return:\n ' job_state['jobstore'] = self job_state['name'] = '{project_id}-{code_id}'.format(**job_state) if (job_state['trigger_type'] == 'cron'): job_state['trig...
b3d12b18ce342796119f956c1f6d0a14fcc68b02ee62cd5fd734bb1c1a7b9b61
def add_job(self, job: MySQLJob): '因为拆分问题,增加job 的操作交给API模块完成' update = f"update {self.table_name} set `status`=%s where `id` = '{job.id}';" self.mysql_client.update(update, (0,)) self.log.info(f'sync job:{job.name} success')
因为拆分问题,增加job 的操作交给API模块完成
bspider/bcron/jobstore.py
add_job
littlebai3618/bspider
3
python
def add_job(self, job: MySQLJob): update = f"update {self.table_name} set `status`=%s where `id` = '{job.id}';" self.mysql_client.update(update, (0,)) self.log.info(f'sync job:{job.name} success')
def add_job(self, job: MySQLJob): update = f"update {self.table_name} set `status`=%s where `id` = '{job.id}';" self.mysql_client.update(update, (0,)) self.log.info(f'sync job:{job.name} success')<|docstring|>因为拆分问题,增加job 的操作交给API模块完成<|endoftext|>
ba585b11893a443e47736ce134849544940bd3b2524f3580c56efd97ebed0a20
@classmethod def _defParseDatetime(self, time): ' allow different ways to provide a time and pares it to datetime ' if time: if isinstance(time, int): return (datetime.now() + timedelta(minutes=time)) elif isinstance(time, datetime): return time elif isinstance(ti...
allow different ways to provide a time and pares it to datetime
lvbRequester/lvbRequester.py
_defParseDatetime
native2k/lvbRequester
2
python
@classmethod def _defParseDatetime(self, time): ' ' if time: if isinstance(time, int): return (datetime.now() + timedelta(minutes=time)) elif isinstance(time, datetime): return time elif isinstance(time, (timedelta,)): return (datetime.now() + time) ...
@classmethod def _defParseDatetime(self, time): ' ' if time: if isinstance(time, int): return (datetime.now() + timedelta(minutes=time)) elif isinstance(time, datetime): return time elif isinstance(time, (timedelta,)): return (datetime.now() + time) ...
6ada37a77c511b0937793c16a04a173c472d8bc3da2f2d85e8b7d48c6c68d3ea
@classmethod def _encodeRequest(self, request, data=None): ' encode the request parameters in the expected way ' if isinstance(request, (list, tuple)): request = ''.join(request) if data: resStr = (request % data) else: resStr = request res = urllib.parse.quote(resStr).replac...
encode the request parameters in the expected way
lvbRequester/lvbRequester.py
_encodeRequest
native2k/lvbRequester
2
python
@classmethod def _encodeRequest(self, request, data=None): ' ' if isinstance(request, (list, tuple)): request = .join(request) if data: resStr = (request % data) else: resStr = request res = urllib.parse.quote(resStr).replace('%26', '&').replace('%2B', '+').replace('%3D', '=...
@classmethod def _encodeRequest(self, request, data=None): ' ' if isinstance(request, (list, tuple)): request = .join(request) if data: resStr = (request % data) else: resStr = request res = urllib.parse.quote(resStr).replace('%26', '&').replace('%2B', '+').replace('%3D', '=...
933b80b2356129c1351c3a0babaf66e5773d8186b0085ff0ea96dca8f8c71890
@classmethod def getAutoCompletion(self, station, limit=10): ' retrieves autocomplete result for station.\n\n This should be used to get the correct station name which\n will be needed for getStation and getConnection.\n ' reqData = {'mode': 'autocomplete', 'limit': limit, 'poi': '', 'q': ...
retrieves autocomplete result for station. This should be used to get the correct station name which will be needed for getStation and getConnection.
lvbRequester/lvbRequester.py
getAutoCompletion
native2k/lvbRequester
2
python
@classmethod def getAutoCompletion(self, station, limit=10): ' retrieves autocomplete result for station.\n\n This should be used to get the correct station name which\n will be needed for getStation and getConnection.\n ' reqData = {'mode': 'autocomplete', 'limit': limit, 'poi': , 'q': (s...
@classmethod def getAutoCompletion(self, station, limit=10): ' retrieves autocomplete result for station.\n\n This should be used to get the correct station name which\n will be needed for getStation and getConnection.\n ' reqData = {'mode': 'autocomplete', 'limit': limit, 'poi': , 'q': (s...
66348791863a63fe445f34efdc7eb82f1aa2a13e9372316ba7bb164141007bcf
@classmethod def getConnection(self, stationFrom, stationTo, time=None): ' Retrieves connection information to travel from stationFrom to stationTo.\n\n The station name must be completely identical to the one in LVB System.\n You can use getAutoCompletion to retrieve the correct name.\n ' ...
Retrieves connection information to travel from stationFrom to stationTo. The station name must be completely identical to the one in LVB System. You can use getAutoCompletion to retrieve the correct name.
lvbRequester/lvbRequester.py
getConnection
native2k/lvbRequester
2
python
@classmethod def getConnection(self, stationFrom, stationTo, time=None): ' Retrieves connection information to travel from stationFrom to stationTo.\n\n The station name must be completely identical to the one in LVB System.\n You can use getAutoCompletion to retrieve the correct name.\n ' ...
@classmethod def getConnection(self, stationFrom, stationTo, time=None): ' Retrieves connection information to travel from stationFrom to stationTo.\n\n The station name must be completely identical to the one in LVB System.\n You can use getAutoCompletion to retrieve the correct name.\n ' ...
4e562f96642690398442786c1dd08e9db6219bf659b6c3bb5ab02ef5581dd924
@classmethod def _getConnectionParams(self, stationFrom, stationTo, conTime): ' builds parameter structur for connection call ' transport = list(self.TRANSPORTMAP.keys()) res = ['results[5][5][function]=ws_find_connections&results[5][5][data]=[', '{"name":"results[5][5][is_extended]","value":""},', '{"name"...
builds parameter structur for connection call
lvbRequester/lvbRequester.py
_getConnectionParams
native2k/lvbRequester
2
python
@classmethod def _getConnectionParams(self, stationFrom, stationTo, conTime): ' ' transport = list(self.TRANSPORTMAP.keys()) res = ['results[5][5][function]=ws_find_connections&results[5][5][data]=[', '{"name":"results[5][5][is_extended]","value":},', '{"name":"results[5][5][from_opt]","value":"3"},', '{"n...
@classmethod def _getConnectionParams(self, stationFrom, stationTo, conTime): ' ' transport = list(self.TRANSPORTMAP.keys()) res = ['results[5][5][function]=ws_find_connections&results[5][5][data]=[', '{"name":"results[5][5][is_extended]","value":},', '{"name":"results[5][5][from_opt]","value":"3"},', '{"n...
218fe26292dafde87b8de0e4c6d787206bd4848b401f3a009f355891cf031faa
@classmethod def _getConnectionParse(self, result): ' builds connection results ' return result.get('connections', {})
builds connection results
lvbRequester/lvbRequester.py
_getConnectionParse
native2k/lvbRequester
2
python
@classmethod def _getConnectionParse(self, result): ' ' return result.get('connections', {})
@classmethod def _getConnectionParse(self, result): ' ' return result.get('connections', {})<|docstring|>builds connection results<|endoftext|>
dbedb8c5e19f2fbd45888c0fa09d6231e10c588c327aa34dee137b371fa48c6d
@classmethod def getStation(self, station, time=None): ' get all exptected Trains at specified station\n\n The station names must be completely identical to the ones in LVB System.\n You can use getAutoCompletion to retrieve the correct names.\n ' params = self._getStationParams(station, se...
get all exptected Trains at specified station The station names must be completely identical to the ones in LVB System. You can use getAutoCompletion to retrieve the correct names.
lvbRequester/lvbRequester.py
getStation
native2k/lvbRequester
2
python
@classmethod def getStation(self, station, time=None): ' get all exptected Trains at specified station\n\n The station names must be completely identical to the ones in LVB System.\n You can use getAutoCompletion to retrieve the correct names.\n ' params = self._getStationParams(station, se...
@classmethod def getStation(self, station, time=None): ' get all exptected Trains at specified station\n\n The station names must be completely identical to the ones in LVB System.\n You can use getAutoCompletion to retrieve the correct names.\n ' params = self._getStationParams(station, se...
0a086f1837ced462e566037618b6a2d47881f8488038d91e412da9e56df3ca8c
@classmethod def _getStationParams(self, stop, time): ' build paramter structure for station request ' res = ['results[5][5][function]=ws_info_stop&results[5][5][data]=[', '{"name":"results[5][5][stop]","value":"%(stop)s"},', '{"name":"results[5][5][date]","value":"%(date)s"},', '{"name":"results[5][5][time]","...
build paramter structure for station request
lvbRequester/lvbRequester.py
_getStationParams
native2k/lvbRequester
2
python
@classmethod def _getStationParams(self, stop, time): ' ' res = ['results[5][5][function]=ws_info_stop&results[5][5][data]=[', '{"name":"results[5][5][stop]","value":"%(stop)s"},', '{"name":"results[5][5][date]","value":"%(date)s"},', '{"name":"results[5][5][time]","value":"%(time)s"},', '{"name":"results[5][5...
@classmethod def _getStationParams(self, stop, time): ' ' res = ['results[5][5][function]=ws_info_stop&results[5][5][data]=[', '{"name":"results[5][5][stop]","value":"%(stop)s"},', '{"name":"results[5][5][date]","value":"%(date)s"},', '{"name":"results[5][5][time]","value":"%(time)s"},', '{"name":"results[5][5...
cff2c90c1c9c6963d9659ba5d85989fd37431e0dc4a30c6db8e0597d47f93b65
@classmethod def _getStationParse(self, result): ' build station results ' return result['connections']
build station results
lvbRequester/lvbRequester.py
_getStationParse
native2k/lvbRequester
2
python
@classmethod def _getStationParse(self, result): ' ' return result['connections']
@classmethod def _getStationParse(self, result): ' ' return result['connections']<|docstring|>build station results<|endoftext|>
d9f9b0432371689d1e8e8a12b4f7a562cef33499e6e960e38be6ee47da4397cc
def _populate_rules(): "Populate RULES with mappings from rule type to rule subclass.\n\n RULES is a mapping (dict) from rule types to subclasses of Rule.\n A rule's type is the concat of two strings: <str1>-<str2>, where\n str1 denotes whether the rule is arbitrary or not and str2 equals\n the `_data_t...
Populate RULES with mappings from rule type to rule subclass. RULES is a mapping (dict) from rule types to subclasses of Rule. A rule's type is the concat of two strings: <str1>-<str2>, where str1 denotes whether the rule is arbitrary or not and str2 equals the `_data_type_str` class attribute of the rule, which is si...
src/mist/api/rules/models/main.py
_populate_rules
SpiralUp/mist.api
6
python
def _populate_rules(): "Populate RULES with mappings from rule type to rule subclass.\n\n RULES is a mapping (dict) from rule types to subclasses of Rule.\n A rule's type is the concat of two strings: <str1>-<str2>, where\n str1 denotes whether the rule is arbitrary or not and str2 equals\n the `_data_t...
def _populate_rules(): "Populate RULES with mappings from rule type to rule subclass.\n\n RULES is a mapping (dict) from rule types to subclasses of Rule.\n A rule's type is the concat of two strings: <str1>-<str2>, where\n str1 denotes whether the rule is arbitrary or not and str2 equals\n the `_data_t...
c12486fd813a4fe5991169c307c019a35dd2529d684558fe19749b6ea4a448da
@classmethod def add(cls, auth_context, title=None, **kwargs): 'Add a new Rule.\n\n New rules should be added by invoking this class method on a Rule\n subclass.\n\n Arguments:\n\n owner: instance of mist.api.users.models.Organization\n title: the name of the rule. This ...
Add a new Rule. New rules should be added by invoking this class method on a Rule subclass. Arguments: owner: instance of mist.api.users.models.Organization title: the name of the rule. This must be unique per Organization kwargs: additional keyword arguments that will be passed to the corr...
src/mist/api/rules/models/main.py
add
SpiralUp/mist.api
6
python
@classmethod def add(cls, auth_context, title=None, **kwargs): 'Add a new Rule.\n\n New rules should be added by invoking this class method on a Rule\n subclass.\n\n Arguments:\n\n owner: instance of mist.api.users.models.Organization\n title: the name of the rule. This ...
@classmethod def add(cls, auth_context, title=None, **kwargs): 'Add a new Rule.\n\n New rules should be added by invoking this class method on a Rule\n subclass.\n\n Arguments:\n\n owner: instance of mist.api.users.models.Organization\n title: the name of the rule. This ...
98919a0b6e26b4eaa852fad816413875e13a19ae2d3b778272893a63cf2d2a31
@property def owner(self): 'Return the Organization (instance) owning self.\n\n We refrain from storing the owner as a me.ReferenceField in order to\n avoid automatic/unwanted dereferencing.\n\n ' return Organization.objects.get(id=self.owner_id)
Return the Organization (instance) owning self. We refrain from storing the owner as a me.ReferenceField in order to avoid automatic/unwanted dereferencing.
src/mist/api/rules/models/main.py
owner
SpiralUp/mist.api
6
python
@property def owner(self): 'Return the Organization (instance) owning self.\n\n We refrain from storing the owner as a me.ReferenceField in order to\n avoid automatic/unwanted dereferencing.\n\n ' return Organization.objects.get(id=self.owner_id)
@property def owner(self): 'Return the Organization (instance) owning self.\n\n We refrain from storing the owner as a me.ReferenceField in order to\n avoid automatic/unwanted dereferencing.\n\n ' return Organization.objects.get(id=self.owner_id)<|docstring|>Return the Organization (instanc...
a152dc7b1f37ab41d5d026edba3ca92c4dff55fe131ed7fa2953fe3d293bf294
@property def org(self): 'Return the Organization (instance) owning self.\n\n ' return self.owner
Return the Organization (instance) owning self.
src/mist/api/rules/models/main.py
org
SpiralUp/mist.api
6
python
@property def org(self): '\n\n ' return self.owner
@property def org(self): '\n\n ' return self.owner<|docstring|>Return the Organization (instance) owning self.<|endoftext|>
2f00e11aa73c9cfe5581511175149a348ee61a5592daa6a393b16c348d57f693
@property def plugin(self): 'Return the instance of a backend plugin.\n\n Subclasses MUST define the plugin to be used, instantiated with `self`.\n\n ' return self._backend_plugin(self)
Return the instance of a backend plugin. Subclasses MUST define the plugin to be used, instantiated with `self`.
src/mist/api/rules/models/main.py
plugin
SpiralUp/mist.api
6
python
@property def plugin(self): 'Return the instance of a backend plugin.\n\n Subclasses MUST define the plugin to be used, instantiated with `self`.\n\n ' return self._backend_plugin(self)
@property def plugin(self): 'Return the instance of a backend plugin.\n\n Subclasses MUST define the plugin to be used, instantiated with `self`.\n\n ' return self._backend_plugin(self)<|docstring|>Return the instance of a backend plugin. Subclasses MUST define the plugin to be used, instantiated...
f17644aa26b634b65ab8707d0fba1d7c07b78333840809e0f83d0eeb6209937a
@property def name(self): 'Return the name of the task.\n\n ' return ('Org(%s):Rule(%s)' % (self.owner_id, self.id))
Return the name of the task.
src/mist/api/rules/models/main.py
name
SpiralUp/mist.api
6
python
@property def name(self): '\n\n ' return ('Org(%s):Rule(%s)' % (self.owner_id, self.id))
@property def name(self): '\n\n ' return ('Org(%s):Rule(%s)' % (self.owner_id, self.id))<|docstring|>Return the name of the task.<|endoftext|>
a97df2de28b9c3db17b521af0c5e5d69af1d3800212764b642c2eba17cd188fe
@property def task(self): 'Return the dramatiq task to run.\n\n This is the most basic dramatiq task that should be used for most rule\n evaluations. However, subclasses may provide their own property or\n class attribute based on their needs.\n\n ' return 'mist.api.rules.tasks.evalu...
Return the dramatiq task to run. This is the most basic dramatiq task that should be used for most rule evaluations. However, subclasses may provide their own property or class attribute based on their needs.
src/mist/api/rules/models/main.py
task
SpiralUp/mist.api
6
python
@property def task(self): 'Return the dramatiq task to run.\n\n This is the most basic dramatiq task that should be used for most rule\n evaluations. However, subclasses may provide their own property or\n class attribute based on their needs.\n\n ' return 'mist.api.rules.tasks.evalu...
@property def task(self): 'Return the dramatiq task to run.\n\n This is the most basic dramatiq task that should be used for most rule\n evaluations. However, subclasses may provide their own property or\n class attribute based on their needs.\n\n ' return 'mist.api.rules.tasks.evalu...
9d7771049e34c295a7f451b53f1bc45825d829d8c564e98cab1677c7f54f2b28
@property def args(self): 'Return the args of the dramatiq task.' return (self.id,)
Return the args of the dramatiq task.
src/mist/api/rules/models/main.py
args
SpiralUp/mist.api
6
python
@property def args(self): return (self.id,)
@property def args(self): return (self.id,)<|docstring|>Return the args of the dramatiq task.<|endoftext|>
9dacb201bf4dc210cdcad9886b7141a0f6b69bece472c253b670036d49e4c590
@property def kwargs(self): 'Return the kwargs of the dramatiq task.' return {}
Return the kwargs of the dramatiq task.
src/mist/api/rules/models/main.py
kwargs
SpiralUp/mist.api
6
python
@property def kwargs(self): return {}
@property def kwargs(self): return {}<|docstring|>Return the kwargs of the dramatiq task.<|endoftext|>
aaef8529e85139fd6844ae7e5f082dd7bc646345bfbacb0b25fc4b0672667bf8
@property def expires(self): 'Return None to denote that self is not meant to expire.' return None
Return None to denote that self is not meant to expire.
src/mist/api/rules/models/main.py
expires
SpiralUp/mist.api
6
python
@property def expires(self): return None
@property def expires(self): return None<|docstring|>Return None to denote that self is not meant to expire.<|endoftext|>
cb57b4463b679dbec604a49e34cbdd1b5acacdab91020479131e536b6def60c1
@property def enabled(self): 'Return True if the dramatiq task is currently enabled.\n\n Subclasses MAY override or extend this property.\n\n ' return (not self.disabled)
Return True if the dramatiq task is currently enabled. Subclasses MAY override or extend this property.
src/mist/api/rules/models/main.py
enabled
SpiralUp/mist.api
6
python
@property def enabled(self): 'Return True if the dramatiq task is currently enabled.\n\n Subclasses MAY override or extend this property.\n\n ' return (not self.disabled)
@property def enabled(self): 'Return True if the dramatiq task is currently enabled.\n\n Subclasses MAY override or extend this property.\n\n ' return (not self.disabled)<|docstring|>Return True if the dramatiq task is currently enabled. Subclasses MAY override or extend this property.<|endoftext...
458a52a1f54357b50698df823eaa12f31b7b8a3362f701a3d979987bf13e62dc
def is_arbitrary(self): 'Return True if self is arbitrary.\n\n Arbitrary rules lack a list of `selectors` that refer to resources\n either by their UUIDs or by tags. Such a list makes it easy to setup\n rules referencing specific resources without the need to provide the\n raw query expr...
Return True if self is arbitrary. Arbitrary rules lack a list of `selectors` that refer to resources either by their UUIDs or by tags. Such a list makes it easy to setup rules referencing specific resources without the need to provide the raw query expression.
src/mist/api/rules/models/main.py
is_arbitrary
SpiralUp/mist.api
6
python
def is_arbitrary(self): 'Return True if self is arbitrary.\n\n Arbitrary rules lack a list of `selectors` that refer to resources\n either by their UUIDs or by tags. Such a list makes it easy to setup\n rules referencing specific resources without the need to provide the\n raw query expr...
def is_arbitrary(self): 'Return True if self is arbitrary.\n\n Arbitrary rules lack a list of `selectors` that refer to resources\n either by their UUIDs or by tags. Such a list makes it easy to setup\n rules referencing specific resources without the need to provide the\n raw query expr...
2875a64475021f44de403bc1a7d701e2e97246b36af85805e30100a9831278c5
def plotImages(images_batch, img_n, classes): '\n Take as input a batch from the generator and plt a number of images equal to img_n\n Default columns equal to max_c. At least inputs of batch equal two.\n ' max_c = 5 if (img_n <= max_c): r = 1 c = img_n else: r = math.ce...
Take as input a batch from the generator and plt a number of images equal to img_n Default columns equal to max_c. At least inputs of batch equal two.
utils/visualize.py
plotImages
EscVM/RSC-Wrapper
2
python
def plotImages(images_batch, img_n, classes): '\n Take as input a batch from the generator and plt a number of images equal to img_n\n Default columns equal to max_c. At least inputs of batch equal two.\n ' max_c = 5 if (img_n <= max_c): r = 1 c = img_n else: r = math.ce...
def plotImages(images_batch, img_n, classes): '\n Take as input a batch from the generator and plt a number of images equal to img_n\n Default columns equal to max_c. At least inputs of batch equal two.\n ' max_c = 5 if (img_n <= max_c): r = 1 c = img_n else: r = math.ce...
f52f953bffcb9ccf0672d03444c4df1027258f5838b6642f7e963a16540f1306
def plot_misclassified_images(X_test, y_pred, y_test, labels): '\n Plot all misclassified images.\n ' y_pred_arg = (logistic.cdf(y_pred) > 0.5)[(..., 0)].astype(np.float32) errors_indices = np.where((y_pred_arg != y_test))[0] max_c = 5 r = np.ceil((errors_indices.size / max_c)).astype(np.int32...
Plot all misclassified images.
utils/visualize.py
plot_misclassified_images
EscVM/RSC-Wrapper
2
python
def plot_misclassified_images(X_test, y_pred, y_test, labels): '\n \n ' y_pred_arg = (logistic.cdf(y_pred) > 0.5)[(..., 0)].astype(np.float32) errors_indices = np.where((y_pred_arg != y_test))[0] max_c = 5 r = np.ceil((errors_indices.size / max_c)).astype(np.int32) c = max_c (fig, axes...
def plot_misclassified_images(X_test, y_pred, y_test, labels): '\n \n ' y_pred_arg = (logistic.cdf(y_pred) > 0.5)[(..., 0)].astype(np.float32) errors_indices = np.where((y_pred_arg != y_test))[0] max_c = 5 r = np.ceil((errors_indices.size / max_c)).astype(np.int32) c = max_c (fig, axes...
c3f26eabb871190e149766541527a7d405918768465183974a3759fd63ffbccd
def differing_ana_field(self, ana1, ana2): '\n Determine if two analyses with equal number of fields only differ\n in one field, with the possible exception of the gloss field.\n If they do, return the name of the field. If they do not differ\n at all, return empty string. If they have m...
Determine if two analyses with equal number of fields only differ in one field, with the possible exception of the gloss field. If they do, return the name of the field. If they do not differ at all, return empty string. If they have more than one differing fields, return None.
search/web_app/response_processors.py
differing_ana_field
gisly/evenki-corpus
0
python
def differing_ana_field(self, ana1, ana2): '\n Determine if two analyses with equal number of fields only differ\n in one field, with the possible exception of the gloss field.\n If they do, return the name of the field. If they do not differ\n at all, return empty string. If they have m...
def differing_ana_field(self, ana1, ana2): '\n Determine if two analyses with equal number of fields only differ\n in one field, with the possible exception of the gloss field.\n If they do, return the name of the field. If they do not differ\n at all, return empty string. If they have m...
6bbf8490a43e01d010b6e03a42a0b3286e0ce0c0154cc431219a7ba4ca4d29b1
def join_ana_gloss_variants(self, ana1, ana2): '\n Check if the gloss field values in the analyses differ only\n in one gloss. If so, return a string with joined glossing, e.g.\n (STEM-PL-GEN) + (STEM-SG-GEN) would give (STEM-PL/SG-GEN). If not,\n return None.\n ' if (('gloss'...
Check if the gloss field values in the analyses differ only in one gloss. If so, return a string with joined glossing, e.g. (STEM-PL-GEN) + (STEM-SG-GEN) would give (STEM-PL/SG-GEN). If not, return None.
search/web_app/response_processors.py
join_ana_gloss_variants
gisly/evenki-corpus
0
python
def join_ana_gloss_variants(self, ana1, ana2): '\n Check if the gloss field values in the analyses differ only\n in one gloss. If so, return a string with joined glossing, e.g.\n (STEM-PL-GEN) + (STEM-SG-GEN) would give (STEM-PL/SG-GEN). If not,\n return None.\n ' if (('gloss'...
def join_ana_gloss_variants(self, ana1, ana2): '\n Check if the gloss field values in the analyses differ only\n in one gloss. If so, return a string with joined glossing, e.g.\n (STEM-PL-GEN) + (STEM-SG-GEN) would give (STEM-PL/SG-GEN). If not,\n return None.\n ' if (('gloss'...
92568ac478a0bb07ab4473586079259284f9567106b663589c7b10fb8e83c84b
def simplify_ana(self, analyses, matchingAnalyses): '\n Collate JSON analyses that only have differences in one field,\n e.g. [(N,sg,gen), (N,pl,gen)] -> (N,sg/pl,gen). Analyses that\n match the query (their indices are stored in matchingAnalyses)\n cannot be collated with those that do ...
Collate JSON analyses that only have differences in one field, e.g. [(N,sg,gen), (N,pl,gen)] -> (N,sg/pl,gen). Analyses that match the query (their indices are stored in matchingAnalyses) cannot be collated with those that do not. Return a list with simplified analyses and the matching analyses indices in the new list....
search/web_app/response_processors.py
simplify_ana
gisly/evenki-corpus
0
python
def simplify_ana(self, analyses, matchingAnalyses): '\n Collate JSON analyses that only have differences in one field,\n e.g. [(N,sg,gen), (N,pl,gen)] -> (N,sg/pl,gen). Analyses that\n match the query (their indices are stored in matchingAnalyses)\n cannot be collated with those that do ...
def simplify_ana(self, analyses, matchingAnalyses): '\n Collate JSON analyses that only have differences in one field,\n e.g. [(N,sg,gen), (N,pl,gen)] -> (N,sg/pl,gen). Analyses that\n match the query (their indices are stored in matchingAnalyses)\n cannot be collated with those that do ...
429d99819f6bc22ca0293171f63f22db98ad8fa0e2683ae92715d53b0365232c
def build_gr_ana_part_text(self, grValues, lang): '\n Build a string with gramtags ordered according to the settings\n for the language specified by lang.\n ' def key_comp(p): if ('gr_fields_order' not in self.settings['lang_props'][lang]): return (- 1) if (p[0]...
Build a string with gramtags ordered according to the settings for the language specified by lang.
search/web_app/response_processors.py
build_gr_ana_part_text
gisly/evenki-corpus
0
python
def build_gr_ana_part_text(self, grValues, lang): '\n Build a string with gramtags ordered according to the settings\n for the language specified by lang.\n ' def key_comp(p): if ('gr_fields_order' not in self.settings['lang_props'][lang]): return (- 1) if (p[0]...
def build_gr_ana_part_text(self, grValues, lang): '\n Build a string with gramtags ordered according to the settings\n for the language specified by lang.\n ' def key_comp(p): if ('gr_fields_order' not in self.settings['lang_props'][lang]): return (- 1) if (p[0]...
6b9abdf7939ffb1711d4d05253fc10dabf39b5e102777a4acfad5a7bc1582a71
def build_gr_ana_part(self, grValues, lang, gramdic=False): '\n Build an HTML div with gramtags ordered according to the settings\n for the language specified by lang.\n gramdic == True iff dictionary values (such as gender) are processed. \n ' grAnaPart = self.build_gr_ana_part_text...
Build an HTML div with gramtags ordered according to the settings for the language specified by lang. gramdic == True iff dictionary values (such as gender) are processed.
search/web_app/response_processors.py
build_gr_ana_part
gisly/evenki-corpus
0
python
def build_gr_ana_part(self, grValues, lang, gramdic=False): '\n Build an HTML div with gramtags ordered according to the settings\n for the language specified by lang.\n gramdic == True iff dictionary values (such as gender) are processed. \n ' grAnaPart = self.build_gr_ana_part_text...
def build_gr_ana_part(self, grValues, lang, gramdic=False): '\n Build an HTML div with gramtags ordered according to the settings\n for the language specified by lang.\n gramdic == True iff dictionary values (such as gender) are processed. \n ' grAnaPart = self.build_gr_ana_part_text...
2882c8c818867b2eff73ceeb98066eb0bf7ea585dbb5e7891636fe8412981621
def build_ana_div(self, ana, lang, translit=None): '\n Build the contents of a div with one particular analysis.\n ' def field_sorting_key(x): if (x['key'] in self.settings['lang_props'][lang]['other_fields_order']): return (self.settings['lang_props'][lang]['other_fields_orde...
Build the contents of a div with one particular analysis.
search/web_app/response_processors.py
build_ana_div
gisly/evenki-corpus
0
python
def build_ana_div(self, ana, lang, translit=None): '\n \n ' def field_sorting_key(x): if (x['key'] in self.settings['lang_props'][lang]['other_fields_order']): return (self.settings['lang_props'][lang]['other_fields_order'].index(x['key']), x['key']) return (len(self.s...
def build_ana_div(self, ana, lang, translit=None): '\n \n ' def field_sorting_key(x): if (x['key'] in self.settings['lang_props'][lang]['other_fields_order']): return (self.settings['lang_props'][lang]['other_fields_order'].index(x['key']), x['key']) return (len(self.s...
332c3b46e1b1ead36ffdd589a3d5514b9363603ec7fda4204abedaca7c9892a3
def build_ana_popup(self, word, lang, matchingAnalyses=None, translit=None): '\n Build a string for a popup with the word and its analyses. \n ' if (matchingAnalyses is None): matchingAnalyses = [] data4template = {'wf': '', 'analyses': []} if ('wf_display' in word): data4t...
Build a string for a popup with the word and its analyses.
search/web_app/response_processors.py
build_ana_popup
gisly/evenki-corpus
0
python
def build_ana_popup(self, word, lang, matchingAnalyses=None, translit=None): '\n \n ' if (matchingAnalyses is None): matchingAnalyses = [] data4template = {'wf': , 'analyses': []} if ('wf_display' in word): data4template['wf_display'] = self.transliterate_baseline(word['wf...
def build_ana_popup(self, word, lang, matchingAnalyses=None, translit=None): '\n \n ' if (matchingAnalyses is None): matchingAnalyses = [] data4template = {'wf': , 'analyses': []} if ('wf_display' in word): data4template['wf_display'] = self.transliterate_baseline(word['wf...
97498929ff5bbf556c3384a6de0d105c8787ab7dda8e37a7510d63dc16074431
def prepare_analyses(self, words, indexes, lang, matchWordOffsets=None, translit=None): '\n Generate viewable analyses for the words with given indexes.\n ' result = '' for iStr in indexes: mWordNo = self.rxWordNo.search(iStr) if (mWordNo is None): continue ...
Generate viewable analyses for the words with given indexes.
search/web_app/response_processors.py
prepare_analyses
gisly/evenki-corpus
0
python
def prepare_analyses(self, words, indexes, lang, matchWordOffsets=None, translit=None): '\n \n ' result = for iStr in indexes: mWordNo = self.rxWordNo.search(iStr) if (mWordNo is None): continue i = int(mWordNo.group(1)) if ((i < 0) or (i >= len(wor...
def prepare_analyses(self, words, indexes, lang, matchWordOffsets=None, translit=None): '\n \n ' result = for iStr in indexes: mWordNo = self.rxWordNo.search(iStr) if (mWordNo is None): continue i = int(mWordNo.group(1)) if ((i < 0) or (i >= len(wor...
6216fcbca2e40f7472b46e41b67208ae852e51923c1c1e252f0bec8112f5a1bb
def build_span(self, sentSrc, curWords, curStyles, lang, matchWordOffsets, translit=None): '\n Build a string with a starting span for a word in the baseline.\n ' curClass = '' if any((wn.startswith('w') for wn in curWords)): curClass += ' word ' if any((wn.startswith('p') for wn i...
Build a string with a starting span for a word in the baseline.
search/web_app/response_processors.py
build_span
gisly/evenki-corpus
0
python
def build_span(self, sentSrc, curWords, curStyles, lang, matchWordOffsets, translit=None): '\n \n ' curClass = if any((wn.startswith('w') for wn in curWords)): curClass += ' word ' if any((wn.startswith('p') for wn in curWords)): curClass += ' para ' if any((wn.startsw...
def build_span(self, sentSrc, curWords, curStyles, lang, matchWordOffsets, translit=None): '\n \n ' curClass = if any((wn.startswith('w') for wn in curWords)): curClass += ' word ' if any((wn.startswith('p') for wn in curWords)): curClass += ' para ' if any((wn.startsw...
52b89ea72848f84132a33c54eee54d9176e1f79c60fe63f9ffebcf96f49874e1
def add_highlighted_offsets(self, offStarts, offEnds, text): '\n Find highlighted fragments in source text of the sentence\n and store their offsets in the respective lists.\n ' indexSubtr = 0 for i in range((len(text) - 4)): if (text[i] != '<'): continue if ...
Find highlighted fragments in source text of the sentence and store their offsets in the respective lists.
search/web_app/response_processors.py
add_highlighted_offsets
gisly/evenki-corpus
0
python
def add_highlighted_offsets(self, offStarts, offEnds, text): '\n Find highlighted fragments in source text of the sentence\n and store their offsets in the respective lists.\n ' indexSubtr = 0 for i in range((len(text) - 4)): if (text[i] != '<'): continue if ...
def add_highlighted_offsets(self, offStarts, offEnds, text): '\n Find highlighted fragments in source text of the sentence\n and store their offsets in the respective lists.\n ' indexSubtr = 0 for i in range((len(text) - 4)): if (text[i] != '<'): continue if ...
18234972ac48328a091c5bd9b148ba2efe05581b0c4d682b2afa342d077af4e6
def process_sentence_header(self, sentSource, format='html'): '\n Retrieve the metadata of the document the sentence\n belongs to. Return an HTML string with this data that\n can serve as a header for the context on the output page.\n ' if (format == 'csv'): result = '' e...
Retrieve the metadata of the document the sentence belongs to. Return an HTML string with this data that can serve as a header for the context on the output page.
search/web_app/response_processors.py
process_sentence_header
gisly/evenki-corpus
0
python
def process_sentence_header(self, sentSource, format='html'): '\n Retrieve the metadata of the document the sentence\n belongs to. Return an HTML string with this data that\n can serve as a header for the context on the output page.\n ' if (format == 'csv'): result = els...
def process_sentence_header(self, sentSource, format='html'): '\n Retrieve the metadata of the document the sentence\n belongs to. Return an HTML string with this data that\n can serve as a header for the context on the output page.\n ' if (format == 'csv'): result = els...
9f2baaacbceba3d1400b6265f4cd4e49795ba380d4e92b2e25eb6f6c61242b6d
def get_word_offsets(self, sSource, numSent, matchOffsets=None): '\n Find at which offsets which word start and end. If macthOffsets\n is not None, find only offsets of the matching words.\n Return two dicts, one with start offsets and the other with end offsets.\n The keys are offsets a...
Find at which offsets which word start and end. If macthOffsets is not None, find only offsets of the matching words. Return two dicts, one with start offsets and the other with end offsets. The keys are offsets and the values are the string IDs of the words.
search/web_app/response_processors.py
get_word_offsets
gisly/evenki-corpus
0
python
def get_word_offsets(self, sSource, numSent, matchOffsets=None): '\n Find at which offsets which word start and end. If macthOffsets\n is not None, find only offsets of the matching words.\n Return two dicts, one with start offsets and the other with end offsets.\n The keys are offsets a...
def get_word_offsets(self, sSource, numSent, matchOffsets=None): '\n Find at which offsets which word start and end. If macthOffsets\n is not None, find only offsets of the matching words.\n Return two dicts, one with start offsets and the other with end offsets.\n The keys are offsets a...
7dcdf1dd9f56bd9ef83cc62730652b78105f2691c2843b11048b928303a2c573
def get_para_offsets(self, sSource): '\n Find at which offsets which parallel fragments start and end.\n Return two dicts, one with start offsets and the other with end offsets.\n The keys are offsets and the values are the string IDs of the fragments.\n ' (offStarts, offEnds) = ({},...
Find at which offsets which parallel fragments start and end. Return two dicts, one with start offsets and the other with end offsets. The keys are offsets and the values are the string IDs of the fragments.
search/web_app/response_processors.py
get_para_offsets
gisly/evenki-corpus
0
python
def get_para_offsets(self, sSource): '\n Find at which offsets which parallel fragments start and end.\n Return two dicts, one with start offsets and the other with end offsets.\n The keys are offsets and the values are the string IDs of the fragments.\n ' (offStarts, offEnds) = ({},...
def get_para_offsets(self, sSource): '\n Find at which offsets which parallel fragments start and end.\n Return two dicts, one with start offsets and the other with end offsets.\n The keys are offsets and the values are the string IDs of the fragments.\n ' (offStarts, offEnds) = ({},...
b4d8d0242092d9e02090387c8b74ab328e949539477c6eeb74e02147edadeca5
def get_src_offsets(self, sSource): '\n Find at which offsets which sound/video-alignment fragments start and end.\n Return three dicts, one with start offsets, the other with end offsets,\n and the third with the descriptions of the fragments.\n The keys in the first two are offsets and...
Find at which offsets which sound/video-alignment fragments start and end. Return three dicts, one with start offsets, the other with end offsets, and the third with the descriptions of the fragments. The keys in the first two are offsets and the values are the string IDs of the fragments.
search/web_app/response_processors.py
get_src_offsets
gisly/evenki-corpus
0
python
def get_src_offsets(self, sSource): '\n Find at which offsets which sound/video-alignment fragments start and end.\n Return three dicts, one with start offsets, the other with end offsets,\n and the third with the descriptions of the fragments.\n The keys in the first two are offsets and...
def get_src_offsets(self, sSource): '\n Find at which offsets which sound/video-alignment fragments start and end.\n Return three dicts, one with start offsets, the other with end offsets,\n and the third with the descriptions of the fragments.\n The keys in the first two are offsets and...
925bea3a9173e5d167bf03ce2839c8f278be62ad32fd3a1e6c9d9f9ac029300d
def get_style_offsets(self, sSource): '\n Find spans of text that should be displayed in a non-default style,\n e.g. in italics or in superscript.\n Return two dicts, one with start offsets and the other with end offsets.\n The keys are offsets. The values are sets with HTML tags that co...
Find spans of text that should be displayed in a non-default style, e.g. in italics or in superscript. Return two dicts, one with start offsets and the other with end offsets. The keys are offsets. The values are sets with HTML tags that contain the class and other attributes, such as tooltip text.
search/web_app/response_processors.py
get_style_offsets
gisly/evenki-corpus
0
python
def get_style_offsets(self, sSource): '\n Find spans of text that should be displayed in a non-default style,\n e.g. in italics or in superscript.\n Return two dicts, one with start offsets and the other with end offsets.\n The keys are offsets. The values are sets with HTML tags that co...
def get_style_offsets(self, sSource): '\n Find spans of text that should be displayed in a non-default style,\n e.g. in italics or in superscript.\n Return two dicts, one with start offsets and the other with end offsets.\n The keys are offsets. The values are sets with HTML tags that co...
15d48520a9a428e76a724412ee60321cda13a36f796872ac5f0258127e3e51bb
def relativize_src_alignment(self, expandedContext, srcFiles): '\n If the sentences in the expanded context are aligned with the\n neighboring media file fragments rather than with the same fragment,\n re-align them with the same one and recalculate offsets.\n ' srcFiles = set(srcFil...
If the sentences in the expanded context are aligned with the neighboring media file fragments rather than with the same fragment, re-align them with the same one and recalculate offsets.
search/web_app/response_processors.py
relativize_src_alignment
gisly/evenki-corpus
0
python
def relativize_src_alignment(self, expandedContext, srcFiles): '\n If the sentences in the expanded context are aligned with the\n neighboring media file fragments rather than with the same fragment,\n re-align them with the same one and recalculate offsets.\n ' srcFiles = set(srcFil...
def relativize_src_alignment(self, expandedContext, srcFiles): '\n If the sentences in the expanded context are aligned with the\n neighboring media file fragments rather than with the same fragment,\n re-align them with the same one and recalculate offsets.\n ' srcFiles = set(srcFil...
fcb73eebab460ff06e23199212aba8c7f74937a847c0e763e46ba49cb73d7f91
def process_sentence_csv(self, sJSON, lang='', translit=None): "\n Process one sentence taken from response['hits']['hits'].\n Return a CSV string for this sentence.\n " sDict = self.process_sentence(sJSON, numSent=0, getHeader=False, format='csv', lang=lang, translit=translit) if (('la...
Process one sentence taken from response['hits']['hits']. Return a CSV string for this sentence.
search/web_app/response_processors.py
process_sentence_csv
gisly/evenki-corpus
0
python
def process_sentence_csv(self, sJSON, lang=, translit=None): "\n Process one sentence taken from response['hits']['hits'].\n Return a CSV string for this sentence.\n " sDict = self.process_sentence(sJSON, numSent=0, getHeader=False, format='csv', lang=lang, translit=translit) if (('lang...
def process_sentence_csv(self, sJSON, lang=, translit=None): "\n Process one sentence taken from response['hits']['hits'].\n Return a CSV string for this sentence.\n " sDict = self.process_sentence(sJSON, numSent=0, getHeader=False, format='csv', lang=lang, translit=translit) if (('lang...
ce17f466719fad7070d842189a40c41a07365bcdc053fce69be6bc7804c80273
def view_sentence_meta(self, sSource, format): '\n If there is a metadata dictionary in the sentence, transform it\n to an HTML span or a text for CSV.\n ' if ('meta' not in sSource): return '' meta2show = {k: sSource['meta'][k] for k in sSource['meta'] if (k not in ['sent_analy...
If there is a metadata dictionary in the sentence, transform it to an HTML span or a text for CSV.
search/web_app/response_processors.py
view_sentence_meta
gisly/evenki-corpus
0
python
def view_sentence_meta(self, sSource, format): '\n If there is a metadata dictionary in the sentence, transform it\n to an HTML span or a text for CSV.\n ' if ('meta' not in sSource): return meta2show = {k: sSource['meta'][k] for k in sSource['meta'] if (k not in ['sent_analyse...
def view_sentence_meta(self, sSource, format): '\n If there is a metadata dictionary in the sentence, transform it\n to an HTML span or a text for CSV.\n ' if ('meta' not in sSource): return meta2show = {k: sSource['meta'][k] for k in sSource['meta'] if (k not in ['sent_analyse...
0faf06d53823638cc4c1328ac717c63783c9d94eb38b3b09c0d6e192c2b7df20
def process_sentence(self, s, numSent=1, getHeader=False, lang='', langView='', translit=None, format='html'): "\n Process one sentence taken from response['hits']['hits'].\n If getHeader is True, retrieve the metadata from the database.\n Return dictionary {'header': document header HTML,\n ...
Process one sentence taken from response['hits']['hits']. If getHeader is True, retrieve the metadata from the database. Return dictionary {'header': document header HTML, {'languages': {'<language_name>': {'text': sentence HTML[, 'img': related image name, ...
search/web_app/response_processors.py
process_sentence
gisly/evenki-corpus
0
python
def process_sentence(self, s, numSent=1, getHeader=False, lang=, langView=, translit=None, format='html'): "\n Process one sentence taken from response['hits']['hits'].\n If getHeader is True, retrieve the metadata from the database.\n Return dictionary {'header': document header HTML,\n ...
def process_sentence(self, s, numSent=1, getHeader=False, lang=, langView=, translit=None, format='html'): "\n Process one sentence taken from response['hits']['hits'].\n If getHeader is True, retrieve the metadata from the database.\n Return dictionary {'header': document header HTML,\n ...
36d27e4f4a41ddd5b4a8a199ca46c04acec1ba6892a8bf16ccdf6f132dae8e92
def get_glossed_sentence(self, s, getHeader=True, lang='', translit=None, skipNonGlossed=False): "\n Process one sentence taken from response['hits']['hits'].\n If getHeader is True, retrieve the metadata from the database.\n Return tab-delimited text version of the sentence that could be inser...
Process one sentence taken from response['hits']['hits']. If getHeader is True, retrieve the metadata from the database. Return tab-delimited text version of the sentence that could be inserted either as a simple text example or as a glossed example in a linguistic paper.
search/web_app/response_processors.py
get_glossed_sentence
gisly/evenki-corpus
0
python
def get_glossed_sentence(self, s, getHeader=True, lang=, translit=None, skipNonGlossed=False): "\n Process one sentence taken from response['hits']['hits'].\n If getHeader is True, retrieve the metadata from the database.\n Return tab-delimited text version of the sentence that could be inserte...
def get_glossed_sentence(self, s, getHeader=True, lang=, translit=None, skipNonGlossed=False): "\n Process one sentence taken from response['hits']['hits'].\n If getHeader is True, retrieve the metadata from the database.\n Return tab-delimited text version of the sentence that could be inserte...
cebd26bec5c7eb398d46a27a1aabbdbd74138027ea920b184667eba1abc5099a
def count_word_subcorpus_stats(self, w, docIDs): '\n Return statistics about the given word in the subcorpus\n specified by the list of document IDs.\n This function is currently unused and will probably be deleted.\n ' query = {'bool': {'must': [{'term': {'w_id': w['_id']}}, {'terms...
Return statistics about the given word in the subcorpus specified by the list of document IDs. This function is currently unused and will probably be deleted.
search/web_app/response_processors.py
count_word_subcorpus_stats
gisly/evenki-corpus
0
python
def count_word_subcorpus_stats(self, w, docIDs): '\n Return statistics about the given word in the subcorpus\n specified by the list of document IDs.\n This function is currently unused and will probably be deleted.\n ' query = {'bool': {'must': [{'term': {'w_id': w['_id']}}, {'terms...
def count_word_subcorpus_stats(self, w, docIDs): '\n Return statistics about the given word in the subcorpus\n specified by the list of document IDs.\n This function is currently unused and will probably be deleted.\n ' query = {'bool': {'must': [{'term': {'w_id': w['_id']}}, {'terms...
35ca884d6392549a9580685910a161d2a249e49f3f0d3b31102d9584e2095312
def process_word(self, w, lang, searchType='word', translit=None): "\n Process one word taken from response['hits']['hits'].\n " if ('_source' not in w): return '' wSource = w['_source'] freq = str(wSource['freq']) rank = str(wSource['rank']) nDocs = str(wSource['n_docs']) ...
Process one word taken from response['hits']['hits'].
search/web_app/response_processors.py
process_word
gisly/evenki-corpus
0
python
def process_word(self, w, lang, searchType='word', translit=None): "\n \n " if ('_source' not in w): return wSource = w['_source'] freq = str(wSource['freq']) rank = str(wSource['rank']) nDocs = str(wSource['n_docs']) otherFields = [] if (searchType == 'word'): ...
def process_word(self, w, lang, searchType='word', translit=None): "\n \n " if ('_source' not in w): return wSource = w['_source'] freq = str(wSource['freq']) rank = str(wSource['rank']) nDocs = str(wSource['n_docs']) otherFields = [] if (searchType == 'word'): ...
a2b51948da1f797639e30a2cf5c23963f30c20b9b7766dcf81ac4533680c6267
def process_word_subcorpus(self, w, nDocuments, freq, lang, translit=None): "\n Process one word taken from response['hits']['hits'] for subcorpus\n queries (where frequency data comes separately from the aggregations).\n " if ('_source' not in w): return '' wSource = w['_source...
Process one word taken from response['hits']['hits'] for subcorpus queries (where frequency data comes separately from the aggregations).
search/web_app/response_processors.py
process_word_subcorpus
gisly/evenki-corpus
0
python
def process_word_subcorpus(self, w, nDocuments, freq, lang, translit=None): "\n Process one word taken from response['hits']['hits'] for subcorpus\n queries (where frequency data comes separately from the aggregations).\n " if ('_source' not in w): return wSource = w['_source']...
def process_word_subcorpus(self, w, nDocuments, freq, lang, translit=None): "\n Process one word taken from response['hits']['hits'] for subcorpus\n queries (where frequency data comes separately from the aggregations).\n " if ('_source' not in w): return wSource = w['_source']...
dd453f05ae11ccdf63b5bfffe956c38bd0536f057ca3fa22d5fa2ac5893bf12c
def filter_multi_word_highlight_iter(self, hit, nWords=1, negWords=None, keepOnlyFirst=False): '\n Remove those of the highlights that are empty or which do\n not constitute a full set of search terms. If keepOnlyFirst\n is True, remove highlights for all non-first query words.\n negWord...
Remove those of the highlights that are empty or which do not constitute a full set of search terms. If keepOnlyFirst is True, remove highlights for all non-first query words. negWords is a list of words whose query was negative: they will be absent from the highlighting. Iterate over filtered inner hits.
search/web_app/response_processors.py
filter_multi_word_highlight_iter
gisly/evenki-corpus
0
python
def filter_multi_word_highlight_iter(self, hit, nWords=1, negWords=None, keepOnlyFirst=False): '\n Remove those of the highlights that are empty or which do\n not constitute a full set of search terms. If keepOnlyFirst\n is True, remove highlights for all non-first query words.\n negWord...
def filter_multi_word_highlight_iter(self, hit, nWords=1, negWords=None, keepOnlyFirst=False): '\n Remove those of the highlights that are empty or which do\n not constitute a full set of search terms. If keepOnlyFirst\n is True, remove highlights for all non-first query words.\n negWord...
25f97ba3ad0a77e26c37c3ccfb2cac332e668f4b8e38ee001336328383410630
def filter_multi_word_highlight(self, hit, nWords=1, negWords=None, keepOnlyFirst=False): "\n Non-iterative version of filter_multi_word_highlight_iter whic\n replaces hits['inner_hits'] dictionary.\n " if (('inner_hits' not in hit) or (nWords <= 1)): return hit['inner_hits'] = ...
Non-iterative version of filter_multi_word_highlight_iter whic replaces hits['inner_hits'] dictionary.
search/web_app/response_processors.py
filter_multi_word_highlight
gisly/evenki-corpus
0
python
def filter_multi_word_highlight(self, hit, nWords=1, negWords=None, keepOnlyFirst=False): "\n Non-iterative version of filter_multi_word_highlight_iter whic\n replaces hits['inner_hits'] dictionary.\n " if (('inner_hits' not in hit) or (nWords <= 1)): return hit['inner_hits'] = ...
def filter_multi_word_highlight(self, hit, nWords=1, negWords=None, keepOnlyFirst=False): "\n Non-iterative version of filter_multi_word_highlight_iter whic\n replaces hits['inner_hits'] dictionary.\n " if (('inner_hits' not in hit) or (nWords <= 1)): return hit['inner_hits'] = ...
911324332a77ddf30749da317081ef9c3e53bc1d3e47c0e66ae54d2347ada457
def add_word_from_sentence(self, hitsProcessed, hit, nWords=1): '\n Extract word data from the highlighted w1 in the sentence and\n add it to the dictionary hitsProcessed.\n ' if (('_source' not in hit) or ('inner_hits' not in hit)): return (langID, lang) = self.get_lang_from_hi...
Extract word data from the highlighted w1 in the sentence and add it to the dictionary hitsProcessed.
search/web_app/response_processors.py
add_word_from_sentence
gisly/evenki-corpus
0
python
def add_word_from_sentence(self, hitsProcessed, hit, nWords=1): '\n Extract word data from the highlighted w1 in the sentence and\n add it to the dictionary hitsProcessed.\n ' if (('_source' not in hit) or ('inner_hits' not in hit)): return (langID, lang) = self.get_lang_from_hi...
def add_word_from_sentence(self, hitsProcessed, hit, nWords=1): '\n Extract word data from the highlighted w1 in the sentence and\n add it to the dictionary hitsProcessed.\n ' if (('_source' not in hit) or ('inner_hits' not in hit)): return (langID, lang) = self.get_lang_from_hi...
0c95b8037b508e80b888e39dbb4d3aebb45c39a19123e1f1b34c9e56a043986f
def get_lemma(self, word): '\n Join all lemmata in the JSON representation of a word with\n an analysis and return them as a string.\n ' if ('ana' not in word): return '' if (('keep_lemma_order' not in self.settings) or (not self.settings['keep_lemma_order'])): curLemmat...
Join all lemmata in the JSON representation of a word with an analysis and return them as a string.
search/web_app/response_processors.py
get_lemma
gisly/evenki-corpus
0
python
def get_lemma(self, word): '\n Join all lemmata in the JSON representation of a word with\n an analysis and return them as a string.\n ' if ('ana' not in word): return if (('keep_lemma_order' not in self.settings) or (not self.settings['keep_lemma_order'])): curLemmata ...
def get_lemma(self, word): '\n Join all lemmata in the JSON representation of a word with\n an analysis and return them as a string.\n ' if ('ana' not in word): return if (('keep_lemma_order' not in self.settings) or (not self.settings['keep_lemma_order'])): curLemmata ...
99ecf55529b46665c20ca36e4ec0b53bb0efb7d2c76834dc923a39db164f7969
def get_gramm(self, word, lang): '\n Join all grammar tags strings in the JSON representation of a word with\n an analysis and return them as a string.\n ' if ('ana' not in word): return '' if (('keep_lemma_order' not in self.settings) or (not self.settings['keep_lemma_order']))...
Join all grammar tags strings in the JSON representation of a word with an analysis and return them as a string.
search/web_app/response_processors.py
get_gramm
gisly/evenki-corpus
0
python
def get_gramm(self, word, lang): '\n Join all grammar tags strings in the JSON representation of a word with\n an analysis and return them as a string.\n ' if ('ana' not in word): return if (('keep_lemma_order' not in self.settings) or (not self.settings['keep_lemma_order'])): ...
def get_gramm(self, word, lang): '\n Join all grammar tags strings in the JSON representation of a word with\n an analysis and return them as a string.\n ' if ('ana' not in word): return if (('keep_lemma_order' not in self.settings) or (not self.settings['keep_lemma_order'])): ...
f22e32e7420eb09f62c95af130b7bd94276b8fd0ca8997f4691c7bb98cf278b8
def get_word_table_fields(self, word): '\n Return a list with values of fields that have to be displayed\n in a word search hits table, along with wordform and lemma.\n ' if ('word_table_fields' not in self.settings): return [] wordTableValues = [] for field in self.settings...
Return a list with values of fields that have to be displayed in a word search hits table, along with wordform and lemma.
search/web_app/response_processors.py
get_word_table_fields
gisly/evenki-corpus
0
python
def get_word_table_fields(self, word): '\n Return a list with values of fields that have to be displayed\n in a word search hits table, along with wordform and lemma.\n ' if ('word_table_fields' not in self.settings): return [] wordTableValues = [] for field in self.settings...
def get_word_table_fields(self, word): '\n Return a list with values of fields that have to be displayed\n in a word search hits table, along with wordform and lemma.\n ' if ('word_table_fields' not in self.settings): return [] wordTableValues = [] for field in self.settings...
f088a724c9371fdad8dd963577de7f2bd343949040a1ec51f1deda293c2d0fb7
def process_words_collected_from_sentences(self, hitsProcessed, sortOrder='freq', pageSize=10): '\n Process all words collected from the sentences with a multi-word query.\n ' for (wID, freqData) in hitsProcessed['word_ids'].items(): word = {'w_id': wID, '_source': {'wf': freqData['wf']}} ...
Process all words collected from the sentences with a multi-word query.
search/web_app/response_processors.py
process_words_collected_from_sentences
gisly/evenki-corpus
0
python
def process_words_collected_from_sentences(self, hitsProcessed, sortOrder='freq', pageSize=10): '\n \n ' for (wID, freqData) in hitsProcessed['word_ids'].items(): word = {'w_id': wID, '_source': {'wf': freqData['wf']}} word['_source']['freq'] = freqData['n_occurrences'] wor...
def process_words_collected_from_sentences(self, hitsProcessed, sortOrder='freq', pageSize=10): '\n \n ' for (wID, freqData) in hitsProcessed['word_ids'].items(): word = {'w_id': wID, '_source': {'wf': freqData['wf']}} word['_source']['freq'] = freqData['n_occurrences'] wor...
2b3fb857dd26759c7b02af7b763cdf0180445395d10b147543c5e3c40e325960
def calculate_ranks(self, hitsProcessed): "\n Calculate frequency ranks of the words collected from sentences based\n on their frequency in the hitsProcessed list.\n For each word, store results in word['_source']['rank']. Return nothing.\n " freqsSorted = [w['_source']['freq'] for w...
Calculate frequency ranks of the words collected from sentences based on their frequency in the hitsProcessed list. For each word, store results in word['_source']['rank']. Return nothing.
search/web_app/response_processors.py
calculate_ranks
gisly/evenki-corpus
0
python
def calculate_ranks(self, hitsProcessed): "\n Calculate frequency ranks of the words collected from sentences based\n on their frequency in the hitsProcessed list.\n For each word, store results in word['_source']['rank']. Return nothing.\n " freqsSorted = [w['_source']['freq'] for w...
def calculate_ranks(self, hitsProcessed): "\n Calculate frequency ranks of the words collected from sentences based\n on their frequency in the hitsProcessed list.\n For each word, store results in word['_source']['rank']. Return nothing.\n " freqsSorted = [w['_source']['freq'] for w...
1a14dcc5c97fafdb15ed1fe7bc342cf291de817f440938ee08e84507f80e6372
def process_doc(self, d, exclude=None): "\n Process one document taken from response['hits']['hits'].\n " if ('_source' not in d): return '' dSource = d['_source'] dID = d['_id'] doc = {'fields': [], 'excluded': ((exclude is not None) and (int(dID) in exclude)), 'id': dID} ...
Process one document taken from response['hits']['hits'].
search/web_app/response_processors.py
process_doc
gisly/evenki-corpus
0
python
def process_doc(self, d, exclude=None): "\n \n " if ('_source' not in d): return dSource = d['_source'] dID = d['_id'] doc = {'fields': [], 'excluded': ((exclude is not None) and (int(dID) in exclude)), 'id': dID} dateDisplayed = '-' if ('year_from' in dSource): ...
def process_doc(self, d, exclude=None): "\n \n " if ('_source' not in d): return dSource = d['_source'] dID = d['_id'] doc = {'fields': [], 'excluded': ((exclude is not None) and (int(dID) in exclude)), 'id': dID} dateDisplayed = '-' if ('year_from' in dSource): ...
ba30afb702ec7e4e0d2d1945bc46118d366dcaf57f47e03b9ed9f1cc358d93e7
def retrieve_highlighted_words(self, sentence, numSent, queryWordID=''): '\n Explore the inner_hits part of the response to find the\n offsets of the words that matched the word-level query\n and offsets of the respective analyses, if any.\n Search for word offsets recursively, so that t...
Explore the inner_hits part of the response to find the offsets of the words that matched the word-level query and offsets of the respective analyses, if any. Search for word offsets recursively, so that the procedure does not depend excatly on the response structure. Return a dictionary where keys are offsets of highl...
search/web_app/response_processors.py
retrieve_highlighted_words
gisly/evenki-corpus
0
python
def retrieve_highlighted_words(self, sentence, numSent, queryWordID=): '\n Explore the inner_hits part of the response to find the\n offsets of the words that matched the word-level query\n and offsets of the respective analyses, if any.\n Search for word offsets recursively, so that the...
def retrieve_highlighted_words(self, sentence, numSent, queryWordID=): '\n Explore the inner_hits part of the response to find the\n offsets of the words that matched the word-level query\n and offsets of the respective analyses, if any.\n Search for word offsets recursively, so that the...
cdddeecdb7b5e3d2a66ab6b84a40b40a784c8a8375f254b0b915fc6da4aed0be
def get_lang_from_hit(self, hit): '\n Return the ID and the name of the language of the current hit\n taken from ES response.\n ' if ('lang' in hit['_source']): langID = hit['_source']['lang'] else: langID = 0 lang = self.settings['languages'][langID] return (lan...
Return the ID and the name of the language of the current hit taken from ES response.
search/web_app/response_processors.py
get_lang_from_hit
gisly/evenki-corpus
0
python
def get_lang_from_hit(self, hit): '\n Return the ID and the name of the language of the current hit\n taken from ES response.\n ' if ('lang' in hit['_source']): langID = hit['_source']['lang'] else: langID = 0 lang = self.settings['languages'][langID] return (lan...
def get_lang_from_hit(self, hit): '\n Return the ID and the name of the language of the current hit\n taken from ES response.\n ' if ('lang' in hit['_source']): langID = hit['_source']['lang'] else: langID = 0 lang = self.settings['languages'][langID] return (lan...