inputs stringlengths 312 52k | targets stringlengths 1 3.1k ⌀ | block_type stringclasses 11
values | scenario stringclasses 7
values |
|---|---|---|---|
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# ollama-python/ollama/_types.py
def __init__(self, error: str, status_code: int = -1):
try:
# try to parse content as JSON and extract 'error'
# f... | for message in messages or []:
if not isinstance(message, dict):
raise TypeError('messages must be a list of Message or dict-like objects')
if not (role := message.get('role')) or role not in ['system', 'user', 'assistant']:
raise RequestError('messages must contain a role and it must be one... | FOR | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# ollama-python/ollama/_types.py
def __init__(self, error: str, status_code: int = -1):
try:
# try to parse content as JSON and extract 'error'
# f... | async for line in r.aiter_lines():
partial = json.loads(line)
if e := partial.get('error'):
raise ResponseError(e)
yield partial | FOR | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# ollama-python/ollama/_types.py
def __init__(self, error: str, status_code: int = -1):
try:
# try to parse content as JSON and extract 'error'
# f... | async for line in r.aiter_lines():
partial = json.loads(line)
if e := partial.get('error'):
raise ResponseError(e)
yield partial | FOR | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# ollama-python/ollama/_types.py
def __init__(self, error: str, status_code: int = -1):
try:
# try to parse content as JSON and extract 'error'
# f... | async def inner():
async with self._client.stream(method, url, **kwargs) as r:
try:
r.raise_for_status()
except httpx.HTTPStatusError as e:
e.response.read()
raise ResponseError(e.response.text, e.response.status_code) from None
async for line in r.aiter_line... | METHOD | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# ollama-python/examples/async-chat-stream/main.py
async def speak(speaker, content):
if speaker:
p = await asyncio.create_subprocess_exec(speaker, content)
... | async def upload_bytes():
with open(path, 'rb') as r:
while True:
chunk = r.read(32 * 1024)
if not chunk:
break
yield chunk | METHOD | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# ollama-python/examples/async-chat-stream/main.py
async def speak(speaker, content):
if speaker:
p = await asyncio.create_subprocess_exec(speaker, content)
... | while True:
chunk = r.read(32 * 1024)
if not chunk:
break
yield chunk | WHILE | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# ollama-python/examples/async-chat-stream/main.py
async def speak(speaker, content):
if speaker:
p = await asyncio.create_subprocess_exec(speaker, content)
... | while True:
chunk = r.read(32 * 1024)
if not chunk:
break
sha256sum.update(chunk) | WHILE | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# ollama-python/ollama/_types.py
def __init__(self, error: str, status_code: int = -1):
try:
# try to parse content as JSON and extract 'error'
# f... | while True:
chunk = r.read(32 * 1024)
if not chunk:
break
sha256sum.update(chunk) | WHILE | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/iris_response/conv_filter_bank.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/utils/math.py
def cartesian2polar(xs: np.ndarray, ys: np.ndarray, center_x: float, center_y: float) -> Tuple[np.ndarr... | """Apply convolution to a given normalized iris image with the filter and probe schema.
Args:
img_filter (ImageFilter): filter used for convolution.
probe_schema (ProbeSchema): probe schema used for convolution.
normalization_output (NormalizedIris): Output of the normalizat... | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/geometry_refinement/contour_points_filter.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/geometry_refinement/contour_interpolation.py
def run(self, polygons: GeometryPolygons) -> Geomet... | """Perform polygon refinement by filtering out those iris/pupil polygons points which are to close to eyeball or noise.
Args:
polygons (GeometryPolygons): Polygons to refine.
geometry_mask (NoiseMask): Geometry noise mask.
Returns:
GeometryPolygons: Refined geometry... | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/eye_properties_estimation/iris_bbox_calculator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/validators/object_validators.py
def __init__(self, min_maskcodes_size: int = 0) -> None:
... | """Assign parameters.
WARNING: Depending on wether `buffer` is a float or an int, behaviour differs.
`buffer=2.0` => the iris size will be multiplied by 2., `buffer=2` => 2 pixels padding will be added.
Args:
buffer (Union[int, float, Tuple[Number, Number]], optional): Iris buffer ... | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/normalization/common.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/normalization/nonlinear_normalization.py
def get_pixel_binary(image: np.ndarray, pixel_x: float, pixel_y: float) -> b... | """Extract interpolation points coordinates.
Args:
image (np.ndarray): Original, not normalized image.
pixel_x (float): Pixel x coordinate.
pixel_y (float): Pixel y coordinate.
Returns:
Tuple[float, float, float, float]: Tuple with interpolation points c... | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/callbacks/pipeline_trace.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/io/dataclasses.py
def pupil_diameter(self) -> float:
"""Return pupil diameter.
Returns:
float: p... | """Return stored error.
Returns:
Optional[Exception]: error.
""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/validators/cross_object_validators.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/geometry_refinement/contour_points_filter.py
def __init__(self, min_distance_to_noise_and_eyeball: floa... | """Assign parameters.
Args:
min_distance_to_border (float, optional): Minimum allowed distance to image boundary.
Defaults to 0.0 (Eye centers can be at the image border).
""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/callbacks/pipeline_trace.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/io/dataclasses.py
def index_of(self, class_name: str) -> int:
"""Get class index based on its name.
Args:
... | """Get result_name result.
Args:
result_name (str): Result name.
Raises:
PipelineCallTraceStorageError: Raised if result_name is not found.
Returns:
Any: Result object.
""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/geometry_refinement/smoothing.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/geometry_estimation/linear_extrapolation.py
def _estimate(self, vertices: np.ndarray, center_xy: Tuple[float... | """Cut contour into arcs.
Args:
polygon (np.ndarray): Contour polygon.
center_xy (Tuple[float, float]): Polygon's center.
Returns:
Tuple[List[np.ndarray], int]: Tuple with: (list of list of vertices, number of gaps detected in a contour).
""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/eye_properties_estimation/pupil_iris_property_calculator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/eye_properties_estimation/eccentricity_offgaze_estimation.py
def __init__(
... | """Assign parameters.
Args:
min_pupil_diameter (float): minimum pupil diameter. Defaults to 1.0.
min_iris_diameter (float): minimum iris diameter. Defaults to 150.0.
callbacks (List[Callback]): callbacks list. Defaults to [].
""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/vectorization/contouring.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/geometry_refinement/contour_points_filter.py
def __init__(self, min_distance_to_noise_and_eyeball: float = 0.005)... | """Assign parameters.
Args:
contour_filters (List[Callable[[List[np.ndarray]], List[np.ndarray]]], optional): List of filter functions used to filter out noise in polygons.
Defaults to [ContouringAlgorithm.filter_polygon_areas].
""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/iris_response/probe_schemas/regular_probe_schema.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/io/validators.py
def are_all_positive(cls: type, v: Any, field: fields.ModelField) -> Any:
"""C... | phis = phis.flatten() | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/eye_properties_estimation/occlusion_calculator.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/validators/cross_object_validators.py
def run(self, ir_image: IRImage, extrapolated_polygon... | pupil_mask = common.contour_to_mask(extrapolated_polygons.pupil_array, mask_shape=(img_w, img_h)) | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/normalization/nonlinear_normalization.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/normalization/perspective_normalization.py
def _normalize_roi(
self,
original_image:... | src_shape = src_points.shape[0:2] | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/utils/common.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/io/dataclasses.py
def filled_iris_mask(self) -> np.ndarray:
"""Fill iris mask.
Returns:
np.ndarray: Iris mas... | width, height = mask_shape | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/eye_properties_estimation/bisectors_method.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/geometry_refinement/smoothing.py
def _smooth_circular_shape(self, vertices: np.ndarray, center_... | mask = norms > min_distance_between_sector_points_in_px | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/iris_response/probe_schemas/regular_probe_schema.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/io/validators.py
def are_all_positive(cls: type, v: Any, field: fields.ModelField) -> Any:
"""C... | phi = np.linspace(0, 1, self.params.n_cols, endpoint=False) | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/normalization/common.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/normalization/nonlinear_normalization.py
def get_pixel_binary(image: np.ndarray, pixel_x: float, pixel_y: float) -> b... | return xmin, ymin, xmax, ymax | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/iris_response/image_filters/gabor_filters.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/iris_response/image_filters/image_filter_interface.py
def compute_kernel_values(self) -> np.ndar... | correction_term_mean = np.mean(envelope, axis=-1) | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/io/validators.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/io/dataclasses.py
def _check_segmap_shape_and_consistency(cls, values: Dict[str, Any]) -> Dict[str, Any]:
"""Check that the numb... | return values | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/vectorization/contouring.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/validators/object_validators.py
def _check_pupil_point_is_inside_iris(self, point: np.ndarray, polygon_pts: np.nd... | return filtered_polygons | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/iris_response_refinement/fragile_bits_refinement.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/encoder/iris_encoder.py
def run(self, response: IrisFilterResponse) -> IrisTemplate:
... | for iris_response, iris_mask in zip(iris_filter_response.iris_responses, iris_filter_response.mask_responses):
if self.params.fragile_type == "cartesian":
mask_value_real = np.abs(np.real(iris_response)) >= self.params.value_threshold[0]
mask_value_imaginary = np.abs(np.imag(... | FOR | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/geometry_refinement/smoothing.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/io/dataclasses.py
def index_of(self, class_name: str) -> int:
"""Get class index based on its name.
... | for i in range(-kernel_offset, kernel_offset + 1):
stacked_signals.append(np.roll(signal, i)) | FOR | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/eye_properties_estimation/bisectors_method.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/geometry_refinement/smoothing.py
def _smooth_circular_shape(self, vertices: np.ndarray, center_... | for _ in range(self.params.max_iterations):
random_indices = np.random.choice(len(polygon), size=(self.params.num_bisectors, 2))
first_drawn_points = polygon[random_indices[:, 0]]
second_drawn_points = polygon[random_indices[:, 1]]
norms = np.linalg.norm(first_drawn_poi... | FOR | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/io/dataclasses.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/callbacks/pipeline_trace.py
def get(self, result_name: str) -> Any:
"""Get result_name result.
Args:
resul... | for index, name in self.index2class.items():
if name == class_name:
return index | FOR | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/iris_response/conv_filter_bank.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/encoder/iris_encoder.py
def run(self, response: IrisFilterResponse) -> IrisTemplate:
"""Encode iris... | for i_filter, i_schema in zip(self.params.filters, self.params.probe_schemas):
iris_response, mask_response = self._convolve(i_filter, i_schema, normalization_output)
iris_responses.append(iris_response)
mask_responses.append(mask_response) | FOR | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/callbacks/pipeline_trace.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/pipelines/iris_pipeline.py
def _init_pipeline_tracing(self) -> PipelineCallTraceStorage:
"""Instantiate mechanisms fo... | for result_name in self._storage.keys():
self._storage[result_name] = None | FOR | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/geometry_refinement/contour_interpolation.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/utils/math.py
def estimate_diameter(polygon: np.ndarray) -> float:
"""Estimates the diameter of an arb... | for (x1, y1), (x2, y2), num_point in zip(previous_boundary, polygon, num_points):
x.append(np.linspace(x1, x2, num=num_point, endpoint=False))
y.append(np.linspace(y1, y2, num=num_point, endpoint=False)) | FOR | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/normalization/perspective_normalization.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/normalization/nonlinear_normalization.py
def _generate_correspondences(self, pupil_points: np.ndar... | for radius in self.params.intermediate_radiuses:
ring = pupil_points + radius * (iris_points - pupil_points)
ring = np.vstack([ring, ring[0]])
src_points.append(ring) | FOR | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/normalization/perspective_normalization.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/normalization/nonlinear_normalization.py
def run(
self,
image: IRImage,
no... | for angle_point_idx in range(src_points.shape[1] - 1):
for ring_idx in range(src_points.shape[0] - 1):
current_src, current_dst = self._correspondence_rois_coords(
angle_idx=angle_point_idx,
ring_idx=ring_idx,
src_points=src_points,... | FOR | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/encoder/iris_encoder.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/iris_response/conv_filter_bank.py
def run(self, normalization_output: NormalizedIris) -> IrisFilterResponse:
... | for iris_response, mask_response in zip(response.iris_responses, response.mask_responses):
mask_code = mask_response >= self.params.mask_threshold
iris_code = np.stack([iris_response.real > 0, iris_response.imag > 0], axis=-1)
mask_code = np.stack([mask_code, mask_code], axis=-1)
... | FOR | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/iris_response/image_filters/gabor_filters.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/iris_response/image_filters/image_filter_interface.py
def compute_kernel_values(self) -> np.ndar... | if self.params.dc_correction:
# Step 1: calculate mean value of Gabor Wavelet
g_mean = np.mean(np.real(kernel_values), axis=-1)
# Step 2: define gaussian offset
correction_term_mean = np.mean(envelope, axis=-1)
# Step 3: substract gaussian
kernel_v... | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/normalization/common.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/normalization/nonlinear_normalization.py
def get_pixel_binary(image: np.ndarray, pixel_x: float, pixel_y: float) -> b... | if xmin == xmax and not xmax == img_w - 1:
xmax += 1 | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/iris_response/probe_schemas/regular_probe_schema.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/io/validators.py
def are_all_positive(cls: type, v: Any, field: fields.ModelField) -> Any:
"""C... | if isinstance(self.params.boundary_phi, List):
phi = np.linspace(
0 + self.params.boundary_phi[0], 1 - self.params.boundary_phi[1], self.params.n_cols, endpoint=True
) | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/geometry_refinement/smoothing.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/geometry_estimation/linear_extrapolation.py
def _estimate(self, vertices: np.ndarray, center_xy: Tuple[float... | if gap_indices.size < 2:
return [polygon], gap_indices.size | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/io/dataclasses.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/callbacks/pipeline_trace.py
def get(self, result_name: str) -> Any:
"""Get result_name result.
Args:
resul... | if name == class_name:
return index | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/normalization/common.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/eye_properties_estimation/bisectors_method.py
def _find_center_coords(self, polygon: np.ndarray, diameter: float) -> ... | if xmin == xmax and not xmax == img_w - 1:
xmax += 1 | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/iris_response/probe_schemas/regular_probe_schema.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/io/validators.py
def are_all_positive(cls: type, v: Any, field: fields.ModelField) -> Any:
"""C... | if self.params.boundary_phi == "periodic-left":
phi = np.linspace(0, 1, self.params.n_cols, endpoint=False) | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/io/validators.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/io/dataclasses.py
def _check_segmap_shape_and_consistency(cls, values: Dict[str, Any]) -> Dict[str, Any]:
"""Check that the numb... | if len(values[field1]) != len(values[field2]):
raise ValueError(
f"{cls.__name__}: {field1} and {field2} length mismatch, "
f"resp. {len(values[field1])} and {len(values[field2])}"
) | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/normalization/common.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/eye_properties_estimation/bisectors_method.py
def _find_center_coords(self, polygon: np.ndarray, diameter: float) -> ... | if ymin == ymax and not ymax == img_h - 1:
ymax += 1 | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/iris_response/image_filters/gabor_filters.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/segmentation/onnx_multilabel_segmentation.py
def _preprocess(self, image: np.ndarray) -> Dict[st... | if norm_real > 0:
kernel_values.real /= norm_real | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/iris_response/image_filters/gabor_filters.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/iris_response/image_filters/image_filter_interface.py
def compute_kernel_values(self) -> np.ndar... | # normalize kernel values | LINE_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/utils/math.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/tests/unit_tests/utils.py
def area_of_circular_segment(circle_radius: float, delta_height: float) -> float:
"""Compute the area of a circular segmen... | # fmt: on | LINE_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/iris_response/image_filters/gabor_filters.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/iris_response/image_filters/image_filter_interface.py
def compute_kernel_values(self) -> np.ndar... | # calculate kernel values | LINE_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/eye_properties_estimation/bisectors_method.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/geometry_refinement/smoothing.py
def _smooth_circular_shape(self, vertices: np.ndarray, center_... | # Add perpendicular vector to center and normalize | LINE_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/geometry_estimation/lsq_ellipse_fit_with_refinement.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/geometry_refinement/contour_points_filter.py
def _filter_polygon_points(self, forbidde... | # Rotate such that 0 degree is parallel with x-axis and array is clockwise | LINE_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/iris_response/image_filters/gabor_filters.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/iris_response/image_filters/image_filter_interface.py
def compute_kernel_values(self) -> np.ndar... | # convert to polar coordinates | LINE_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/iris_response/probe_schemas/regular_probe_schema.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/io/validators.py
def are_all_positive(cls: type, v: Any, field: fields.ModelField) -> Any:
"""C... | # if image_shape provided: verify that values lie on pixel values | LINE_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/eye_properties_estimation/bisectors_method.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/geometry_refinement/smoothing.py
def _smooth_circular_shape(self, vertices: np.ndarray, center_... | # Flip xs with ys and flip sign of on of them to create a 90deg rotation | LINE_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/iris_response/image_filters/gabor_filters.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/iris_response/image_filters/image_filter_interface.py
def compute_kernel_values(self) -> np.ndar... | # Step 1: calculate mean value of Gabor Wavelet | LINE_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/iris_response/image_filters/gabor_filters.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/iris_response/image_filters/image_filter_interface.py
def compute_kernel_values(self) -> np.ndar... | # calculate carrier and envelope | LINE_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/normalization/perspective_normalization.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/normalization/nonlinear_normalization.py
def _normalize_all(
self,
original_image:... | try:
img_x, img_y = map(int, image_xy)
normalized_mask_roi[shifted_y, shifted_x] = iris_mask[img_y, img_x] | TRY | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/normalization/common.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/normalization/nonlinear_normalization.py
def get_pixel_binary(image: np.ndarray, pixel_x: float, pixel_y: float) -> b... | try:
return image[int(pixel_y), int(pixel_x)] | TRY | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/normalization/common.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/normalization/nonlinear_normalization.py
def get_pixel_binary(image: np.ndarray, pixel_x: float, pixel_y: float) -> b... | try:
return image[int(pixel_y), int(pixel_x)] | TRY | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/normalization/common.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/normalization/nonlinear_normalization.py
def get_pixel_binary(image: np.ndarray, pixel_x: float, pixel_y: float) -> b... | except IndexError:
return 0.0 | CATCH | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/normalization/perspective_normalization.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/normalization/nonlinear_normalization.py
def _normalize_all(
self,
original_image:... | except IndexError:
normalized_mask_roi[shifted_y, shifted_x] = False | CATCH | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/normalization/common.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/normalization/nonlinear_normalization.py
def get_pixel_binary(image: np.ndarray, pixel_x: float, pixel_y: float) -> b... | except IndexError:
return 0.0 | CATCH | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/normalization/common.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/normalization/nonlinear_normalization.py
def get_pixel_binary(image: np.ndarray, pixel_x: float, pixel_y: float) -> b... | def get_pixel_intensity(image: np.ndarray, pixel_x: float, pixel_y: float) -> float:
"""Get the intensity value of a pixel from an intensity image.
Args:
image (np.ndarray): Intensity image.
pixel_x (float): Pixel x coordinate.
pixel_y (float): Pixel y coordinate.
... | METHOD | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>open-iris/src/iris/nodes/normalization/common.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# open-iris/src/iris/nodes/normalization/nonlinear_normalization.py
def get_pixel_binary(image: np.ndarray, pixel_x: float, pixel_y: float) -> b... | def get_interpolation_points_coords(
image: np.ndarray, pixel_x: float, pixel_y: float
) -> Tuple[float, float, float, float]:
"""Extract interpolation points coordinates.
Args:
image (np.ndarray): Original, not normalized image.
pixel_x (float): Pixel x coordinate.
... | METHOD | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/postings.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/utils/row_viewable_matrix.py
def rowwise_eq(mat: SparseMatSet, other: SparseMatSet) -> Union[bool, np.ndarray]:
"""Check equals on ... | """Return a mask on the postings array indicating which elements contain all terms.""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/utils/roaringish.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/utils/mat_set.py
def __str__(self):
as_str = [""]
for idx, (row, row_next) in enumerate(zip(self.rows, self... | """Decode an encoded bit array into keys / payloads.""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/utils/roaringish.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/postings.py
def _check_token_arg(self, token):
if isinstance(token, str):
return token
elif isi... | """Convert keys to range or np.ndarray of uint64.""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/phrase/middle_out.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/utils/bitcount.py
def bit_count64(arr):
"""Count the number of bits set in each element in the array."""
arr = arr - (... | """Count bigram matches between two encoded arrays.
Returns:
--------
count: number of matches per doc
rhs_next: the next rhs array to continue matching
""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/postings.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/solr.py
def listify(x):
return x if isinstance(x, list) else [x]
# searcharray/searcharray/phrase/middle_out.py
def te... | """Return a boolean numpy array indicating which elements contain the given term.""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/utils/roaringish.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/utils/mat_set.py
def __eq__(self, other):
return np.all(self.rows == other.rows) and np.all(self.cols == other.cols... | """Return payload MSBs from encoded.""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/solr.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/similarity.py
def bm25_legacy_similarity(k1: float = 1.2, b: float = 0.75) -> Similarity:
"""BM25 similarity prior to LUCENE-8563 with ... | """Run edismax search over dataframe with searcharray fields.
Parameters
----------
q : str
The query string
mm : str
The minimum should match spec
qf : list
The fields to search
pf : list
The fields to search for phrase matches
pf2 : list
The fields ... | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/utils/row_viewable_matrix.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/postings.py
def or_query(self, tokens: Union[List[str], List[List[str]]], min_should_match: int = 1) -> np.ndarray... | """Check equals on a row-by-row basis.""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/solr.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/postings.py
def ws_tokenizer(string):
if pd.isna(string):
return []
if not isinstance(string, str):
raise ValueErro... | """Parse Solr's qf, pf, pf2, pf3 field boosts.""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/postings.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/similarity.py
def __call__(self, term_freqs: np.ndarray, doc_freqs: np.ndarray, doc_lens: np.ndarray,
avg_doc_lens... | """Score each doc using a similarity function.
Parameters
----------
token : str or list of str of what to search (already tokenized)
similarity : How to score the documents. Default is BM25.
""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/phrase/middle_out.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/utils/roaringish.py
def encode(self, payload: np.ndarray,
keys: Optional[np.ndarray] = None,
... | # Find adjacent matches | LINE_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/postings.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/utils/roaringish.py
def convert_keys(keys) -> np.ndarray:
"""Convert keys to range or np.ndarray of uint64."""
if isinstance(ke... | # When other is a scalar value | LINE_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/postings.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/similarity.py
def __call__(self, term_freqs: np.ndarray, doc_freqs: np.ndarray, doc_lens: np.ndarray,
avg_doc_lens... | # For expensive toknes, we compute doc freq first, so we | LINE_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/solr.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/phrase/posn_diffs.py
def compute_phrase_freqs(term_posns, phrase_freqs, slop=1, width=10):
"""Compute phrase freq using matrix-diff met... | # otherwise, simple expression | LINE_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/phrase/middle_out.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/utils/roaringish.py
def encode(self, payload: np.ndarray,
keys: Optional[np.ndarray] = None,
... | # ceiling divide | LINE_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/postings.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/utils/roaringish.py
def convert_keys(keys) -> np.ndarray:
"""Convert keys to range or np.ndarray of uint64."""
if isinstance(ke... | # (not looking at positions, maybe we should?) | LINE_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/similarity.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/postings.py
def or_query(self, tokens: Union[List[str], List[List[str]]], min_should_match: int = 1) -> np.ndarray:
"""Re... | # Sum doc freqs | LINE_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/postings.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/term_dict.py
def get_term_id(self, term):
try:
return self.term_to_ids[term]
except KeyError:
... | # Count number of rows where the term appears | LINE_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/phrase/middle_out.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/utils/bitcount.py
def bit_count64(arr):
"""Count the number of bits set in each element in the array."""
arr = arr - (... | # Combine lhs and rhs matches from two strategies | LINE_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/utils/roaringish.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/postings.py
def _check_token_arg(self, token):
if isinstance(token, str):
return token
elif isi... | # UNFORTUNATE COPY | LINE_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/postings.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/phrase/middle_out.py
def _termfreqs_with_cache(self, term_id: int) -> Tuple[np.ndarray, np.ndarray]:
try:
retur... | if slop == 1 and len(tokens) == len(set(tokens)):
phrase_freqs = np.zeros(len(self))
try:
doc_ids = self.term_mat.rows
term_ids = [self.term_dict.get_term_id(token) for token in tokens]
return self.posns.phrase_freqs(term_ids, doc_ids=doc_ids,
... | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/postings.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/solr.py
def listify(x):
return x if isinstance(x, list) else [x]
# searcharray/searcharray/phrase/middle_out.py
def te... | if isinstance(token, list):
term_freq = self.phrase_freq(token)
else:
term_freq = self.termfreqs(token) | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/utils/roaringish.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/postings.py
def _check_token_arg(self, token):
if isinstance(token, str):
return token
elif isi... | if isinstance(keys, numbers.Number):
return np.asarray([keys], dtype=np.uint64)
elif isinstance(keys, list):
return np.asarray(keys, dtype=np.uint64)
elif isinstance(keys, np.ndarray):
return keys.astype(np.uint64)
elif isinstance(keys, range) and len(keys) > 0:
# UNFORTUNATE... | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/postings.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/utils/roaringish.py
def convert_keys(keys) -> np.ndarray:
"""Convert keys to range or np.ndarray of uint64."""
if isinstance(ke... | if isinstance(token, str):
return token
elif isinstance(token, list) and len(token) == 1:
return token[0]
elif isinstance(token, list):
return token
else:
raise TypeError("Expected a string or list of strings for phrases") | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/solr.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/phrase/posn_diffs.py
def compute_phrase_freqs(term_posns, phrase_freqs, slop=1, width=10):
"""Compute phrase freq using matrix-diff met... | if num_clauses <= upper_bound:
return result
else:
result = parse_min_should_match(num_clauses, parts[1]) | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/solr.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/similarity.py
def bm25_legacy_similarity(k1: float = 1.2, b: float = 0.75) -> Similarity:
"""BM25 similarity prior to LUCENE-8563 with ... | if mm is None:
mm = "1" | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/postings.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/term_dict.py
def get_term_id(self, term):
try:
return self.term_to_ids[term]
except KeyError:
... | if self.term_mat.subset:
slice_of_rows = self.term_mat.rows
doc_ids, termfreqs = self.posns.termfreqs(term_id,
doc_ids=slice_of_rows)
mask = np.isin(self.term_mat.rows, doc_ids)
matches[mask] = term... | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/solr.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/similarity.py
def bm25_legacy_similarity(k1: float = 1.2, b: float = 0.75) -> Similarity:
"""BM25 similarity prior to LUCENE-8563 with ... | if len(phrase_scores) > 0:
phrase_scores = np.sum(phrase_scores, axis=0)
# Add where term_scores > 0
term_match_idx = np.where(qf_scores)[0]
qf_scores[term_match_idx] += phrase_scores[term_match_idx] | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/solr.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/phrase/posn_diffs.py
def compute_phrase_freqs(term_posns, phrase_freqs, slop=1, width=10):
"""Compute phrase freq using matrix-diff met... | if '<' in spec:
# we have conditional spec(s)
space_around_less_than_pattern = re.compile(r'\s*<\s*')
spec = space_around_less_than_pattern.sub('<', spec)
for s in spec.split():
parts = s.split('<', 1)
if len(parts) < 2:
raise ValueError("Invalid '... | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/phrase/middle_out.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/utils/roaringish.py
def slice(self, encoded: np.ndarray, keys: np.ndarray) -> np.ndarray:
"""Get list of encoded t... | if phrase_freqs.shape[0] == self.max_doc_id + 1:
enc_term_posns = [self.encoded_term_posns[term_id] for term_id in term_ids]
else:
enc_term_posns = [encoder.slice(self.encoded_term_posns[term_id],
keys=doc_ids.view(np.uint64)) for term_id in te... | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/postings.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/utils/roaringish.py
def convert_keys(keys) -> np.ndarray:
"""Convert keys to range or np.ndarray of uint64."""
if isinstance(ke... | return np.array([], dtype=bool) | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/solr.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/postings.py
def positions(self, term=None):
if self.posns is None:
return {}
if term is None:
p... | max_scores = np.zeros(len(frame)) | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/postings.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/phrase/posn_diffs.py
def stack_term_posns(term_posns: List[List[np.ndarray]], phrase_freqs: np.ndarray, width: int = 10):
# Pad for... | mask = mask & curr_mask | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>searcharray/searcharray/postings.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# searcharray/searcharray/term_dict.py
def get_term_id(self, term):
try:
return self.term_to_ids[term]
except KeyError:
... | return matches | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.