id stringlengths 24 24 | repo stringlengths 7 52 | path stringlengths 5 138 | func_name stringlengths 1 134 | url stringlengths 89 242 | split stringclasses 3
values | language stringclasses 1
value | docstring stringlengths 1 46.9k | code stringlengths 87 104k | text stringlengths 100 112k | token_count int32 25 38.1k | doc_chars int32 1 46.9k | code_chars int32 87 104k | license_basis stringclasses 1
value | source stringclasses 1
value | added stringdate 2026-12-05 00:00:00 2026-12-05 00:00:00 | record_sha256 stringlengths 64 64 | license stringclasses 9
values | license_class stringclasses 1
value | license_source stringlengths 46 99 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bd946b1ce76dfd233efa1c83 | mjirik/imcut | imcut/pycut.py | ImageGraphCut.__msgc_step3_discontinuity_localization | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L323-L372 | train | python | Estimate discontinuity in basis of low resolution image segmentation.
:return: discontinuity in low resolution | def __msgc_step3_discontinuity_localization(self):
"""
Estimate discontinuity in basis of low resolution image segmentation.
:return: discontinuity in low resolution
"""
import scipy
start = self._start_time
seg = 1 - self.segmentation.astype(np.int8)
sel... | Estimate discontinuity in basis of low resolution image segmentation.
:return: discontinuity in low resolution
def __msgc_step3_discontinuity_localization(self):
"""
Estimate discontinuity in basis of low resolution image segmentation.
:return: discontinuity in low resolution
""... | 497 | 118 | 2,091 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | f248b9219b38e61fad281bee7539b63628757190389b75264f2b0de7f259ebfa | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
aa897edc00d4c6b68390bd55 | mjirik/imcut | imcut/pycut.py | ImageGraphCut.__multiscale_gc_lo2hi_run | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L526-L606 | train | python | Run Graph-Cut segmentation with refinement of low resolution multiscale graph.
In first step is performed normal GC on low resolution data
Second step construct finer grid on edges of segmentation from first
step.
There is no option for use without `use_boundary_penalties` | def __multiscale_gc_lo2hi_run(self): # , pyed):
"""
Run Graph-Cut segmentation with refinement of low resolution multiscale graph.
In first step is performed normal GC on low resolution data
Second step construct finer grid on edges of segmentation from first
step.
There... | Run Graph-Cut segmentation with refinement of low resolution multiscale graph.
In first step is performed normal GC on low resolution data
Second step construct finer grid on edges of segmentation from first
step.
There is no option for use without `use_boundary_penalties`
def __multisc... | 853 | 305 | 3,165 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 9942f7d7ca8714d5a9038226de5f3aca6b5bdb3788240adfa674762340d7c134 | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
ef76ea0e9601ac8eed3f445f | mjirik/imcut | imcut/pycut.py | ImageGraphCut.__multiscale_gc_hi2lo_run | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L608-L626 | train | python | Run Graph-Cut segmentation with simplifiyng of high resolution multiscale graph.
In first step is performed normal GC on low resolution data
Second step construct finer grid on edges of segmentation from first
step.
There is no option for use without `use_boundary_penalties` | def __multiscale_gc_hi2lo_run(self): # , pyed):
"""
Run Graph-Cut segmentation with simplifiyng of high resolution multiscale graph.
In first step is performed normal GC on low resolution data
Second step construct finer grid on edges of segmentation from first
step.
The... | Run Graph-Cut segmentation with simplifiyng of high resolution multiscale graph.
In first step is performed normal GC on low resolution data
Second step construct finer grid on edges of segmentation from first
step.
There is no option for use without `use_boundary_penalties`
def __multi... | 270 | 307 | 906 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | cd51348dd3d742acfa1caa83c5ea31ad23c064b9e84865443816a94d1d605ec1 | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
48228fb179ddc3aa1bf841c2 | mjirik/imcut | imcut/pycut.py | ImageGraphCut.__ordered_values_by_indexes | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L628-L678 | train | python | Return values (intensities) by indexes.
Used for multiscale graph cut.
data = [[0 1 1],
[0 2 2],
[0 2 2]]
inds = [[0 1 2],
[3 4 4],
[5 4 4]]
return: [0, 1, 1, 0, 2, 0]
If the data are not consistent, it will take... | def __ordered_values_by_indexes(self, data, inds):
"""
Return values (intensities) by indexes.
Used for multiscale graph cut.
data = [[0 1 1],
[0 2 2],
[0 2 2]]
inds = [[0 1 2],
[3 4 4],
[5 4 4]]
return: [... | Return values (intensities) by indexes.
Used for multiscale graph cut.
data = [[0 1 1],
[0 2 2],
[0 2 2]]
inds = [[0 1 2],
[3 4 4],
[5 4 4]]
return: [0, 1, 1, 0, 2, 0]
If the data are not consistent, it will take... | 488 | 338 | 1,571 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 8054ce8126dad016d72999c8138caae54e867b6eea1c8516728bad03f675cbad | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
5d8d66cf376388a773959e49 | mjirik/imcut | imcut/pycut.py | ImageGraphCut.__hi2lo_multiscale_indexes | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L680-L721 | train | python | Function computes multiscale indexes of ndarray.
mask: Says where is original resolution (0) and where is small
resolution (1). Mask is in small resolution.
orig_shape: Original shape of input data.
zoom: Usually number greater then 1
result = [[0 1 2],
[3 4 ... | def __hi2lo_multiscale_indexes(self, mask, orig_shape): # , zoom):
"""
Function computes multiscale indexes of ndarray.
mask: Says where is original resolution (0) and where is small
resolution (1). Mask is in small resolution.
orig_shape: Original shape of input data.
... | Function computes multiscale indexes of ndarray.
mask: Says where is original resolution (0) and where is small
resolution (1). Mask is in small resolution.
orig_shape: Original shape of input data.
zoom: Usually number greater then 1
result = [[0 1 2],
[3 4 ... | 490 | 350 | 1,616 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 9361de5da72704edf8dcba31e7f5e63818b72b0409f8ce057a1b09f282a50395 | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
9cacfcd70adf5fabfe10aac0 | mjirik/imcut | imcut/pycut.py | ImageGraphCut.interactivity | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L723-L753 | train | python | Interactive seed setting with 3d seed editor | def interactivity(self, min_val=None, max_val=None, qt_app=None):
"""
Interactive seed setting with 3d seed editor
"""
from .seed_editor_qt import QTSeedEditor
from PyQt4.QtGui import QApplication
if min_val is None:
min_val = np.min(self.img)
if max... | Interactive seed setting with 3d seed editor
def interactivity(self, min_val=None, max_val=None, qt_app=None):
"""
Interactive seed setting with 3d seed editor
"""
from .seed_editor_qt import QTSeedEditor
from PyQt4.QtGui import QApplication
if min_val is None:
... | 215 | 44 | 871 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 2c527b8ae6b8fac6b4bcb24f72ac44b588cd2f95fb00d567b4f673e10964a6ab | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
7b4653d869aa6a67b6e4d9b1 | mjirik/imcut | imcut/pycut.py | ImageGraphCut.set_seeds | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L755-L768 | train | python | Function for manual seed setting. Sets variable seeds and prepares
voxels for density model.
:param seeds: ndarray (0 - nothing, 1 - object, 2 - background,
3 - object just hard constraints, no model training, 4 - background
just hard constraints, no model training) | def set_seeds(self, seeds):
"""
Function for manual seed setting. Sets variable seeds and prepares
voxels for density model.
:param seeds: ndarray (0 - nothing, 1 - object, 2 - background,
3 - object just hard constraints, no model training, 4 - background
just hard cons... | Function for manual seed setting. Sets variable seeds and prepares
voxels for density model.
:param seeds: ndarray (0 - nothing, 1 - object, 2 - background,
3 - object just hard constraints, no model training, 4 - background
just hard constraints, no model training)
def set_seeds(self,... | 213 | 299 | 612 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 6fcab15742455092ccd848db6403e133bda4e10f8955e984993d8ff68ca2fa17 | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
d7076055581e5c08ff03a0d4 | mjirik/imcut | imcut/pycut.py | ImageGraphCut.run | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L770-L802 | train | python | Run the Graph Cut segmentation according to preset parameters.
:param run_fit_model: Allow to skip model fit when the model is prepared before
:return: | def run(self, run_fit_model=True):
"""
Run the Graph Cut segmentation according to preset parameters.
:param run_fit_model: Allow to skip model fit when the model is prepared before
:return:
"""
if run_fit_model:
self.fit_model(self.img, self.voxelsize, self... | Run the Graph Cut segmentation according to preset parameters.
:param run_fit_model: Allow to skip model fit when the model is prepared before
:return:
def run(self, run_fit_model=True):
"""
Run the Graph Cut segmentation according to preset parameters.
:param run_fit_model: A... | 313 | 168 | 1,180 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 7d73fc6de4a0fb94c944aed854adf65cf12b34999b8edb0141c85212a9c50116 | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
203572e91fc51b639acce817 | mjirik/imcut | imcut/pycut.py | ImageGraphCut.__set_hard_hard_constraints | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L834-L851 | train | python | it works with seed labels:
0: nothing
1: object 1 - full seeds
2: object 2 - full seeds
3: object 1 - not a training seeds
4: object 2 - not a training seeds | def __set_hard_hard_constraints(self, tdata1, tdata2, seeds):
"""
it works with seed labels:
0: nothing
1: object 1 - full seeds
2: object 2 - full seeds
3: object 1 - not a training seeds
4: object 2 - not a training seeds
"""
seeds_mask = (seeds ... | it works with seed labels:
0: nothing
1: object 1 - full seeds
2: object 2 - full seeds
3: object 1 - not a training seeds
4: object 2 - not a training seeds
def __set_hard_hard_constraints(self, tdata1, tdata2, seeds):
"""
it works with seed labels:
0: n... | 256 | 197 | 579 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | cb109ca6b4725ded43f5dd7e28189ad10d6f4aee6e7a8b1a246da6992c815940 | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
a3627f42b1ca3395c238971f | mjirik/imcut | imcut/pycut.py | ImageGraphCut.__similarity_for_tlinks_obj_bgr | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L1023-L1080 | train | python | Compute edge values for graph cut tlinks based on image intensity
and texture. | def __similarity_for_tlinks_obj_bgr(
self,
data,
voxelsize,
# voxels1, voxels2,
# seeds, otherfeatures=None
):
"""
Compute edge values for graph cut tlinks based on image intensity
and texture.
"""
# self.fit_model(data, voxelsize, seed... | Compute edge values for graph cut tlinks based on image intensity
and texture.
def __similarity_for_tlinks_obj_bgr(
self,
data,
voxelsize,
# voxels1, voxels2,
# seeds, otherfeatures=None
):
"""
Compute edge values for graph cut tlinks based on image i... | 738 | 86 | 2,436 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 309c1eb5f3f7096d0ca823bc2561436be5b72b5ead303859541994e2d95f72a4 | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
4dc142dbc18def7264c919e4 | mjirik/imcut | imcut/pycut.py | ImageGraphCut.__create_nlinks | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L1152-L1220 | train | python | Compute nlinks grid from data shape information. For boundary penalties
are data (intensities) values are used.
ins: Default is None. Used for multiscale GC. This are indexes of
multiscale pixels. Next example shows one superpixel witn index 2.
inds = [
[1 2 2],
... | def __create_nlinks(self, data, inds=None, boundary_penalties_fcn=None):
"""
Compute nlinks grid from data shape information. For boundary penalties
are data (intensities) values are used.
ins: Default is None. Used for multiscale GC. This are indexes of
multiscale pixels. Next ... | Compute nlinks grid from data shape information. For boundary penalties
are data (intensities) values are used.
ins: Default is None. Used for multiscale GC. This are indexes of
multiscale pixels. Next example shows one superpixel witn index 2.
inds = [
[1 2 2],
... | 798 | 523 | 2,613 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 1d4f9865f7a1a6cbc13f56da36c8ae0e1dda28e59cdc85f7f1a8cbf42203e021 | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
5e11b01c07d021697183cf79 | mjirik/imcut | imcut/pycut.py | ImageGraphCut.debug_get_reconstructed_similarity | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L1222-L1259 | train | python | Use actual model to calculate similarity. If no input is given the last image is used.
:param data3d:
:param voxelsize:
:param seeds:
:param area_weight:
:param hard_constraints:
:param return_unariesalt:
:return: | def debug_get_reconstructed_similarity(
self,
data3d=None,
voxelsize=None,
seeds=None,
area_weight=1,
hard_constraints=True,
return_unariesalt=False,
):
"""
Use actual model to calculate similarity. If no input is given the last image is used.
... | Use actual model to calculate similarity. If no input is given the last image is used.
:param data3d:
:param voxelsize:
:param seeds:
:param area_weight:
:param hard_constraints:
:param return_unariesalt:
:return:
def debug_get_reconstructed_similarity(
s... | 300 | 269 | 1,058 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 7fb40e56c1ac6153d2a6700c36c1db1d652d9421921ebafe528346643cf84788 | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
832b3974d371711426eebd20 | mjirik/imcut | imcut/pycut.py | ImageGraphCut.debug_show_reconstructed_similarity | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L1261-L1296 | train | python | Show tlinks.
:param data3d: ndarray with input data
:param voxelsize:
:param seeds:
:param area_weight:
:param hard_constraints:
:param show:
:param bins: histogram bins number
:param slice_number:
:return: | def debug_show_reconstructed_similarity(
self,
data3d=None,
voxelsize=None,
seeds=None,
area_weight=1,
hard_constraints=True,
show=True,
bins=20,
slice_number=None,
):
"""
Show tlinks.
:param data3d: ndarray with input d... | Show tlinks.
:param data3d: ndarray with input data
:param voxelsize:
:param seeds:
:param area_weight:
:param hard_constraints:
:param show:
:param bins: histogram bins number
:param slice_number:
:return:
def debug_show_reconstructed_similarity(... | 271 | 278 | 945 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 0e577104c3df386fb2ac4d2523345fe687e1baab43376d92ece228edbd987029 | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
a21459d66e3a88afafa42353 | mjirik/imcut | imcut/pycut.py | ImageGraphCut.debug_inspect_node | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L1298-L1306 | train | python | Get info about the node. See pycut.inspect_node() for details.
Processing is done in temporary shape.
:param node_seed:
:return: node_unariesalt, node_neighboor_edges_and_weights, node_neighboor_seeds | def debug_inspect_node(self, node_msindex):
"""
Get info about the node. See pycut.inspect_node() for details.
Processing is done in temporary shape.
:param node_seed:
:return: node_unariesalt, node_neighboor_edges_and_weights, node_neighboor_seeds
"""
return ins... | Get info about the node. See pycut.inspect_node() for details.
Processing is done in temporary shape.
:param node_seed:
:return: node_unariesalt, node_neighboor_edges_and_weights, node_neighboor_seeds
def debug_inspect_node(self, node_msindex):
"""
Get info about the node. See ... | 150 | 225 | 387 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | c2afb617e8f107a48b101d909de99b66aacf3a80e408cfd282e54c45a0d2d80d | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
e06504a96a9e7a07ecbe8c8d | mjirik/imcut | imcut/pycut.py | ImageGraphCut.debug_interactive_inspect_node | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L1318-L1359 | train | python | Call after segmentation to see selected node neighborhood.
User have to select one node by click.
:return: | def debug_interactive_inspect_node(self):
"""
Call after segmentation to see selected node neighborhood.
User have to select one node by click.
:return:
"""
if (
np.sum(
np.abs(
np.asarray(self.msinds.shape) - np.asarray(sel... | Call after segmentation to see selected node neighborhood.
User have to select one node by click.
:return:
def debug_interactive_inspect_node(self):
"""
Call after segmentation to see selected node neighborhood.
User have to select one node by click.
:return:
"""... | 300 | 122 | 1,234 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 2915b4600a95d9ec933f9101375112f6fc580953b24362dff86e83f4fb3beb88 | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
81c11027656914c33d732eec | mjirik/imcut | imcut/pycut.py | ImageGraphCut._ssgc_prepare_data_and_run_computation | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L1370-L1430 | train | python | Setting of data.
You need set seeds if you want use hard_constraints. | def _ssgc_prepare_data_and_run_computation(
self,
# voxels1, voxels2,
hard_constraints=True,
area_weight=1,
):
"""
Setting of data.
You need set seeds if you want use hard_constraints.
"""
# from PyQt4.QtCore import pyqtRemoveInputHook
... | Setting of data.
You need set seeds if you want use hard_constraints.
def _ssgc_prepare_data_and_run_computation(
self,
# voxels1, voxels2,
hard_constraints=True,
area_weight=1,
):
"""
Setting of data.
You need set seeds if you want use hard_constrain... | 577 | 77 | 2,290 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 97a4c65e025d8529f47de74fc4b55dfebf260de1106c0d4533ce474ec3137266 | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
7b672b63f2251b6e6264041d | mjirik/imcut | imcut/image_manipulation.py | resize_to_shape | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/image_manipulation.py#L14-L49 | train | python | Function resize input data to specific shape.
:param data: input 3d array-like data
:param shape: shape of output data
:param zoom: zoom is used for back compatibility
:mode: default is 'nearest' | def resize_to_shape(data, shape, zoom=None, mode="nearest", order=0):
"""
Function resize input data to specific shape.
:param data: input 3d array-like data
:param shape: shape of output data
:param zoom: zoom is used for back compatibility
:mode: default is 'nearest'
"""
# @TODO remove... | Function resize input data to specific shape.
:param data: input 3d array-like data
:param shape: shape of output data
:param zoom: zoom is used for back compatibility
:mode: default is 'nearest'
def resize_to_shape(data, shape, zoom=None, mode="nearest", order=0):
"""
Function resize input dat... | 335 | 211 | 1,234 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 1e3d4a3911d0b9f4702c2760dd238f9bf51b2c591a65ce798021a4d9f4926fa8 | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
5eb21afb3adb878a168156ed | mjirik/imcut | imcut/image_manipulation.py | seed_zoom | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/image_manipulation.py#L85-L121 | train | python | Smart zoom for sparse matrix. If there is resize to bigger resolution
thin line of label could be lost. This function prefers labels larger
then zero. If there is only one small voxel in larger volume with zeros
it is selected. | def seed_zoom(seeds, zoom):
"""
Smart zoom for sparse matrix. If there is resize to bigger resolution
thin line of label could be lost. This function prefers labels larger
then zero. If there is only one small voxel in larger volume with zeros
it is selected.
"""
# import scipy
# loseeds... | Smart zoom for sparse matrix. If there is resize to bigger resolution
thin line of label could be lost. This function prefers labels larger
then zero. If there is only one small voxel in larger volume with zeros
it is selected.
def seed_zoom(seeds, zoom):
"""
Smart zoom for sparse matrix. If there ... | 390 | 239 | 1,235 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 5cd87e0698096561d50cca9bf13ab0d7dd0cd7d6765928481016092a1be78d77 | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
01cbcfbbf0ea423e45809445 | mjirik/imcut | imcut/image_manipulation.py | zoom_to_shape | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/image_manipulation.py#L124-L144 | train | python | Zoom data to specific shape. | def zoom_to_shape(data, shape, dtype=None):
"""
Zoom data to specific shape.
"""
import scipy
import scipy.ndimage
zoomd = np.array(shape) / np.array(data.shape, dtype=np.double)
import warnings
datares = scipy.ndimage.interpolation.zoom(data, zoomd, order=0, mode="reflect")
if da... | Zoom data to specific shape.
def zoom_to_shape(data, shape, dtype=None):
"""
Zoom data to specific shape.
"""
import scipy
import scipy.ndimage
zoomd = np.array(shape) / np.array(data.shape, dtype=np.double)
import warnings
datares = scipy.ndimage.interpolation.zoom(data, zoomd, order... | 182 | 28 | 623 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 98946a8e26e94666dd3b45f4da6663e048523d8ac13f755fa37245894afe2757 | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
bf0e533bd3db785005ce4064 | mjirik/imcut | imcut/image_manipulation.py | crop | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/image_manipulation.py#L361-L375 | train | python | Crop the data.
crop(data, crinfo)
:param crinfo: min and max for each axis - [[minX, maxX], [minY, maxY], [minZ, maxZ]] | def crop(data, crinfo):
"""
Crop the data.
crop(data, crinfo)
:param crinfo: min and max for each axis - [[minX, maxX], [minY, maxY], [minZ, maxZ]]
"""
crinfo = fix_crinfo(crinfo)
return data[
__int_or_none(crinfo[0][0]) : __int_or_none(crinfo[0][1]),
__int_or_none(crinfo[... | Crop the data.
crop(data, crinfo)
:param crinfo: min and max for each axis - [[minX, maxX], [minY, maxY], [minZ, maxZ]]
def crop(data, crinfo):
"""
Crop the data.
crop(data, crinfo)
:param crinfo: min and max for each axis - [[minX, maxX], [minY, maxY], [minZ, maxZ]]
"""
crinfo = f... | 186 | 129 | 430 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | d8bb283b8d50eeb7c58dd23c3008c0c3fe387f1615565cce5b002a8fde033ba9 | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
32755b82072333d90f001fcf | mjirik/imcut | imcut/image_manipulation.py | combinecrinfo | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/image_manipulation.py#L384-L397 | train | python | Combine two crinfos. First used is crinfo1, second used is crinfo2. | def combinecrinfo(crinfo1, crinfo2):
"""
Combine two crinfos. First used is crinfo1, second used is crinfo2.
"""
crinfo1 = fix_crinfo(crinfo1)
crinfo2 = fix_crinfo(crinfo2)
crinfo = [
[crinfo1[0][0] + crinfo2[0][0], crinfo1[0][0] + crinfo2[0][1]],
[crinfo1[1][0] + crinfo2[1][0],... | Combine two crinfos. First used is crinfo1, second used is crinfo2.
def combinecrinfo(crinfo1, crinfo2):
"""
Combine two crinfos. First used is crinfo1, second used is crinfo2.
"""
crinfo1 = fix_crinfo(crinfo1)
crinfo2 = fix_crinfo(crinfo2)
crinfo = [
[crinfo1[0][0] + crinfo2[0][0], cr... | 198 | 67 | 449 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | c22b25fb7b606c21cdc3b60b24e22a93e0a1ab3e47934bfdc08eacbd89704387 | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
e96c44172678ebbbf584a22b | mjirik/imcut | imcut/image_manipulation.py | crinfo_from_specific_data | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/image_manipulation.py#L400-L441 | train | python | Create crinfo of minimum orthogonal nonzero block in input data.
:param data: input data
:param margin: add margin to minimum block
:return: | def crinfo_from_specific_data(data, margin=0):
"""
Create crinfo of minimum orthogonal nonzero block in input data.
:param data: input data
:param margin: add margin to minimum block
:return:
"""
# hledáme automatický ořez, nonzero dá indexy
logger.debug("crinfo")
logger.debug(str(m... | Create crinfo of minimum orthogonal nonzero block in input data.
:param data: input data
:param margin: add margin to minimum block
:return:
def crinfo_from_specific_data(data, margin=0):
"""
Create crinfo of minimum orthogonal nonzero block in input data.
:param data: input data
:param m... | 424 | 153 | 1,034 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 0bc0da1177fd660882062d46d0fbc4e7a365ead369dadac5533b337506c9b252 | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
cbab77edeef51ba64b9f396a | mjirik/imcut | imcut/image_manipulation.py | uncrop | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/image_manipulation.py#L444-L522 | train | python | Put some boundary to input image.
:param data: input data
:param crinfo: array with minimum and maximum index along each axis
[[minX, maxX],[minY, maxY],[minZ, maxZ]]. If crinfo is None, the whole input image is placed into [0, 0, 0].
If crinfo is just series of three numbers, it is used as an... | def uncrop(data, crinfo, orig_shape, resize=False, outside_mode="constant", cval=0):
"""
Put some boundary to input image.
:param data: input data
:param crinfo: array with minimum and maximum index along each axis
[[minX, maxX],[minY, maxY],[minZ, maxZ]]. If crinfo is None, the whole input im... | Put some boundary to input image.
:param data: input data
:param crinfo: array with minimum and maximum index along each axis
[[minX, maxX],[minY, maxY],[minZ, maxZ]]. If crinfo is None, the whole input image is placed into [0, 0, 0].
If crinfo is just series of three numbers, it is used as an... | 1,018 | 569 | 3,343 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 7be236e2f991ff5db3217a5fffa0e951dd6ced394c099a1ad5b132f7ed7ab94b | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
29ad59bf5c0ea5ec8a063c68 | mjirik/imcut | imcut/image_manipulation.py | fix_crinfo | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/image_manipulation.py#L525-L534 | train | python | Function recognize order of crinfo and convert it to proper format. | def fix_crinfo(crinfo, to="axis"):
"""
Function recognize order of crinfo and convert it to proper format.
"""
crinfo = np.asarray(crinfo)
if crinfo.shape[0] == 2:
crinfo = crinfo.T
return crinfo | Function recognize order of crinfo and convert it to proper format.
def fix_crinfo(crinfo, to="axis"):
"""
Function recognize order of crinfo and convert it to proper format.
"""
crinfo = np.asarray(crinfo)
if crinfo.shape[0] == 2:
crinfo = crinfo.T
return crinfo | 75 | 67 | 229 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 431dcf544f7258c6996e327dddfb917d0b6e674ae9cfe223cc759f4642cd9e08 | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
4472c289d77b283bac81e904 | mjirik/imcut | imcut/graph.py | grid_edges | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/graph.py#L524-L568 | train | python | Get list of grid edges
:param shape:
:param inds:
:param return_directions:
:return: | def grid_edges(shape, inds=None, return_directions=True):
"""
Get list of grid edges
:param shape:
:param inds:
:param return_directions:
:return:
"""
if inds is None:
inds = np.arange(np.prod(shape)).reshape(shape)
# if not self.segparams['use_boundary_penalties'] and \
... | Get list of grid edges
:param shape:
:param inds:
:param return_directions:
:return:
def grid_edges(shape, inds=None, return_directions=True):
"""
Get list of grid edges
:param shape:
:param inds:
:param return_directions:
:return:
"""
if inds is None:
inds = np.... | 463 | 100 | 1,565 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 7358ef4ab94e3af2326bb5f2e5d18416381ef7656ab9b0edfdaae5b5fad2ae93 | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
9ede59ab70bf08d09cc2799a | mjirik/imcut | imcut/graph.py | gen_grid_2d | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/graph.py#L586-L636 | train | python | Generate list of edges for a base grid. | def gen_grid_2d(shape, voxelsize):
"""
Generate list of edges for a base grid.
"""
nr, nc = shape
nrm1, ncm1 = nr - 1, nc - 1
# sh = nm.asarray(shape)
# calculate number of edges, in 2D: (nrows * (ncols - 1)) + ((nrows - 1) * ncols)
nedges = 0
for direction in range(len(shape)):
... | Generate list of edges for a base grid.
def gen_grid_2d(shape, voxelsize):
"""
Generate list of edges for a base grid.
"""
nr, nc = shape
nrm1, ncm1 = nr - 1, nc - 1
# sh = nm.asarray(shape)
# calculate number of edges, in 2D: (nrows * (ncols - 1)) + ((nrows - 1) * ncols)
nedges = 0
... | 559 | 39 | 1,522 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | b45f119971b3f8b4f7dc701aeaa8f389cef536482cfa0ce8bf0f23f72e062a32 | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
72f9d52f24d6d49a4df94fd3 | mjirik/imcut | imcut/graph.py | write_grid_to_vtk | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/graph.py#L646-L683 | train | python | Write nodes and edges to VTK file
:param fname: VTK filename
:param nodes:
:param edges:
:param node_flag: set if this node is really used in output
:param edge_flag: set if this flag is used in output
:return: | def write_grid_to_vtk(fname, nodes, edges, node_flag=None, edge_flag=None):
"""
Write nodes and edges to VTK file
:param fname: VTK filename
:param nodes:
:param edges:
:param node_flag: set if this node is really used in output
:param edge_flag: set if this flag is used in output
:retur... | Write nodes and edges to VTK file
:param fname: VTK filename
:param nodes:
:param edges:
:param node_flag: set if this node is really used in output
:param edge_flag: set if this flag is used in output
:return:
def write_grid_to_vtk(fname, nodes, edges, node_flag=None, edge_flag=None):
"""
... | 448 | 234 | 1,219 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 3ffc5ce5747470e6a2375b3973ceaa7256c9a4e6cd50fb4b4436d67f051d4f82 | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
c9471ed4b02b5b4a99d1d7ab | mjirik/imcut | imcut/graph.py | Graph.add_nodes | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/graph.py#L153-L171 | train | python | Add new nodes at the end of the list. | def add_nodes(self, coors, node_low_or_high=None):
"""
Add new nodes at the end of the list.
"""
last = self.lastnode
if type(coors) is nm.ndarray:
if len(coors.shape) == 1:
coors = coors.reshape((1, coors.size))
nadd = coors.shape[0]
... | Add new nodes at the end of the list.
def add_nodes(self, coors, node_low_or_high=None):
"""
Add new nodes at the end of the list.
"""
last = self.lastnode
if type(coors) is nm.ndarray:
if len(coors.shape) == 1:
coors = coors.reshape((1, coors.size))
... | 166 | 37 | 609 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 73ae075fc213a611f688fbf741f5915765efbcc2d4c3ff3f3045c4323792df8e | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
0beecd9b5eb21c0dec32ab05 | mjirik/imcut | imcut/graph.py | Graph.add_edges | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/graph.py#L173-L207 | train | python | Add new edges at the end of the list.
:param edge_direction: direction flag
:param edge_group: describes group of edges from same low super node and same direction
:param edge_low_or_high: zero for low to low resolution, one for high to high or high to low resolution.
It is used to set w... | def add_edges(self, conn, edge_direction, edge_group=None, edge_low_or_high=None):
"""
Add new edges at the end of the list.
:param edge_direction: direction flag
:param edge_group: describes group of edges from same low super node and same direction
:param edge_low_or_high: zero... | Add new edges at the end of the list.
:param edge_direction: direction flag
:param edge_group: describes group of edges from same low super node and same direction
:param edge_low_or_high: zero for low to low resolution, one for high to high or high to low resolution.
It is used to set w... | 428 | 344 | 1,529 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | f33a1f01fabce3a609c8cea48835e7439e2674bc2b31c4a05db5d1d431d23b28 | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
bcdd030af047b2bf675cafae | mjirik/imcut | imcut/graph.py | Graph._edge_group_substitution | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/graph.py#L264-L321 | train | python | Reconnect edges.
:param ndid: id of low resolution edges
:param nsplit: number of split
:param idxs: indexes of low resolution
:param sr_tab:
:param ndoffset:
:param ed_remove:
:param into_or_from: if zero, connection of input edges is done. If one, connection of ... | def _edge_group_substitution(
self, ndid, nsplit, idxs, sr_tab, ndoffset, ed_remove, into_or_from
):
"""
Reconnect edges.
:param ndid: id of low resolution edges
:param nsplit: number of split
:param idxs: indexes of low resolution
:param sr_tab:
:para... | Reconnect edges.
:param ndid: id of low resolution edges
:param nsplit: number of split
:param idxs: indexes of low resolution
:param sr_tab:
:param ndoffset:
:param ed_remove:
:param into_or_from: if zero, connection of input edges is done. If one, connection of ... | 792 | 371 | 2,855 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 1323668c2804799fcdb59aab9303be8d8533d70e7a1479d530363e8889757dec | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
b92ecdd91b58b016b2096355 | mjirik/imcut | imcut/graph.py | Graph.generate_base_grid | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/graph.py#L404-L415 | train | python | Run first step of algorithm. Next step is split_voxels
:param vtk_filename:
:return: | def generate_base_grid(self, vtk_filename=None):
"""
Run first step of algorithm. Next step is split_voxels
:param vtk_filename:
:return:
"""
nd, ed, ed_dir = self.gen_grid_fcn(self.data.shape, self.voxelsize)
self.add_nodes(nd)
self.add_edges(ed, ed_dir, ... | Run first step of algorithm. Next step is split_voxels
:param vtk_filename:
:return:
def generate_base_grid(self, vtk_filename=None):
"""
Run first step of algorithm. Next step is split_voxels
:param vtk_filename:
:return:
"""
nd, ed, ed_dir = self.gen_gr... | 125 | 100 | 418 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 9f93034d1a0322f2e7aa7d203c26df32a3c601c53c041a80ab2ebc992c810ff2 | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
1a832500fdd1e6bb4532ece7 | mjirik/imcut | imcut/graph.py | Graph.split_voxels | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/graph.py#L417-L453 | train | python | Second step of algorithm
:return:() | def split_voxels(self, vtk_filename=None):
"""
Second step of algorithm
:return:()
"""
self.cache = {}
self.stats["t graph 10"] = time.time() - self.start_time
self.msi = MultiscaleArray(self.data.shape, block_size=self.nsplit)
# old implementation
... | Second step of algorithm
:return:()
def split_voxels(self, vtk_filename=None):
"""
Second step of algorithm
:return:()
"""
self.cache = {}
self.stats["t graph 10"] = time.time() - self.start_time
self.msi = MultiscaleArray(self.data.shape, block_size=self... | 352 | 43 | 1,406 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 56a1c235aab5b39f37f651e6eca8c700e83a36f9abde0ea9d7bb7aa6f67569f6 | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
3dd66e8a972d2b1b50627638 | mjirik/imcut | imcut/graph.py | MultiscaleArray.mul_block | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/graph.py#L714-L717 | train | python | Multiply values in block | def mul_block(self, index, val):
"""Multiply values in block"""
self._prepare_cache_slice(index)
self.msinds[self.cache_slice] *= val | Multiply values in block
def mul_block(self, index, val):
"""Multiply values in block"""
self._prepare_cache_slice(index)
self.msinds[self.cache_slice] *= val | 39 | 24 | 157 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | a15536f646f31a9377624fc2f5a47306172e0afdd4fdb167dfd52da83c15111d | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
d93aff1a952fc886d97eaab7 | mjirik/imcut | imcut/features.py | select_from_fv_by_seeds | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/features.py#L39-L58 | train | python | Tool to make simple feature functions take features from feature array by seeds.
:param fv: ndarray with lineariezed feature. It's shape is MxN, where M is number of image pixels and N is number
of features
:param seeds: ndarray with seeds. Does not to be linear.
:param unique_cls: number of used seeds ... | def select_from_fv_by_seeds(fv, seeds, unique_cls):
"""
Tool to make simple feature functions take features from feature array by seeds.
:param fv: ndarray with lineariezed feature. It's shape is MxN, where M is number of image pixels and N is number
of features
:param seeds: ndarray with seeds. Doe... | Tool to make simple feature functions take features from feature array by seeds.
:param fv: ndarray with lineariezed feature. It's shape is MxN, where M is number of image pixels and N is number
of features
:param seeds: ndarray with seeds. Does not to be linear.
:param unique_cls: number of used seeds ... | 367 | 439 | 1,031 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 45d2cbc9dc9df9446726eb9664a78222492ac65d012fe9ae2f9b734955b3d744 | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
a21b1ee52c57a218a53c7503 | mjirik/imcut | imcut/features.py | return_fv_by_seeds | https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/features.py#L60-L76 | train | python | Return features selected by seeds and unique_cls or selection from features and corresponding seed classes.
:param fv: ndarray with lineariezed feature. It's shape is MxN, where M is number of image pixels and N is number
of features
:param seeds: ndarray with seeds. Does not to be linear.
:param uniqu... | def return_fv_by_seeds(fv, seeds=None, unique_cls=None):
"""
Return features selected by seeds and unique_cls or selection from features and corresponding seed classes.
:param fv: ndarray with lineariezed feature. It's shape is MxN, where M is number of image pixels and N is number
of features
:par... | Return features selected by seeds and unique_cls or selection from features and corresponding seed classes.
:param fv: ndarray with lineariezed feature. It's shape is MxN, where M is number of image pixels and N is number
of features
:param seeds: ndarray with seeds. Does not to be linear.
:param uniqu... | 301 | 471 | 811 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 94b19801ab6008795652a772831bd3f4d1a2e4a82b17524cf3ec09132104c2e5 | BSD-3-Clause | permissive | https://github.com/mjirik/imcut/blob/master/LICENSE |
16316b25c66da19cd6f317d2 | developersociety/django-glitter | glitter/templates.py | get_templates | https://github.com/developersociety/django-glitter/blob/2c0280ec83afee80deee94ee3934fc54239c2e87/glitter/templates.py#L26-L30 | train | python | Return a list of templates usable by a model. | def get_templates(model):
""" Return a list of templates usable by a model. """
for template_name, template in templates.items():
if issubclass(template.model, model):
yield (template_name, template.layout._meta.verbose_name) | Return a list of templates usable by a model.
def get_templates(model):
""" Return a list of templates usable by a model. """
for template_name, template in templates.items():
if issubclass(template.model, model):
yield (template_name, template.layout._meta.verbose_name) | 60 | 45 | 253 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | c4b7aa25bcec8e1fa35dd4937a64f5e99b809a218c7d2a906e1099c474ba221a | BSD-3-Clause | permissive | https://github.com/developersociety/django-glitter/blob/master/LICENSE |
7347cc529c0d16a57369da0a | developersociety/django-glitter | glitter/templates.py | attach | https://github.com/developersociety/django-glitter/blob/2c0280ec83afee80deee94ee3934fc54239c2e87/glitter/templates.py#L38-L51 | train | python | Registers the given layout(s) classes
admin site:
@pages.register(Page)
class Default(PageLayout):
pass | def attach(*layouts, **kwargs):
"""
Registers the given layout(s) classes
admin site:
@pages.register(Page)
class Default(PageLayout):
pass
"""
def _model_admin_wrapper(layout_class):
register(layout_class, layouts[0])
return layout_class
return _model_admin_wra... | Registers the given layout(s) classes
admin site:
@pages.register(Page)
class Default(PageLayout):
pass
def attach(*layouts, **kwargs):
"""
Registers the given layout(s) classes
admin site:
@pages.register(Page)
class Default(PageLayout):
pass
"""
def _model_a... | 96 | 124 | 324 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 61758a8bd7a86f454026e8d94ba3a5080128d570caafcafa318aa97daa18d0a0 | BSD-3-Clause | permissive | https://github.com/developersociety/django-glitter/blob/master/LICENSE |
aef1a583f9337c2d58fd7c62 | MatterMiners/cobald | cobald/daemon/runners/guard.py | exclusive | https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/runners/guard.py#L5-L29 | train | python | Mark a callable as exclusive
:param via: factory for a Lock to guard the callable
Guards the callable against being entered again before completion.
Explicitly raises a :py:exc:`RuntimeError` on violation.
:note: If applied to a method, it is exclusive across all instances. | def exclusive(via=threading.Lock):
"""
Mark a callable as exclusive
:param via: factory for a Lock to guard the callable
Guards the callable against being entered again before completion.
Explicitly raises a :py:exc:`RuntimeError` on violation.
:note: If applied to a method, it is exclusive a... | Mark a callable as exclusive
:param via: factory for a Lock to guard the callable
Guards the callable against being entered again before completion.
Explicitly raises a :py:exc:`RuntimeError` on violation.
:note: If applied to a method, it is exclusive across all instances.
def exclusive(via=threadi... | 233 | 293 | 805 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 6ea1e4c1fe2c6d3b16fef0589fd0f8ce81e00c64345bf619069e81c6d6b03b79 | MIT | permissive | https://github.com/MatterMiners/cobald/blob/master/LICENSE |
72ad2807bf516f3d68fcb8ad | MatterMiners/cobald | cobald/daemon/runners/service.py | service | https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/runners/service.py#L54-L82 | train | python | r"""
Mark a class as implementing a Service
Each Service class must have a ``run`` method, which does not take any arguments.
This method is :py:meth:`~.ServiceRunner.adopt`\ ed after the daemon starts, unless
* the Service has been garbage collected, or
* the ServiceUnit has been :py:meth:`~.Serv... | def service(flavour):
r"""
Mark a class as implementing a Service
Each Service class must have a ``run`` method, which does not take any arguments.
This method is :py:meth:`~.ServiceRunner.adopt`\ ed after the daemon starts, unless
* the Service has been garbage collected, or
* the ServiceUnit... | r"""
Mark a class as implementing a Service
Each Service class must have a ``run`` method, which does not take any arguments.
This method is :py:meth:`~.ServiceRunner.adopt`\ ed after the daemon starts, unless
* the Service has been garbage collected, or
* the ServiceUnit has been :py:meth:`~.Serv... | 365 | 457 | 1,090 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 3f7e1c19987deaf0b2e33f963a240502afd4bea78a2e709f3570831cd039c27f | MIT | permissive | https://github.com/MatterMiners/cobald/blob/master/LICENSE |
0c575ec1b3dde3ad1f00df9b | MatterMiners/cobald | cobald/daemon/runners/service.py | ServiceRunner.execute | https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/runners/service.py#L97-L105 | train | python | Synchronously run ``payload`` and provide its output
If ``*args*`` and/or ``**kwargs`` are provided, pass them to ``payload`` upon execution. | def execute(self, payload, *args, flavour: ModuleType, **kwargs):
"""
Synchronously run ``payload`` and provide its output
If ``*args*`` and/or ``**kwargs`` are provided, pass them to ``payload`` upon execution.
"""
if args or kwargs:
payload = functools.partial(payl... | Synchronously run ``payload`` and provide its output
If ``*args*`` and/or ``**kwargs`` are provided, pass them to ``payload`` upon execution.
def execute(self, payload, *args, flavour: ModuleType, **kwargs):
"""
Synchronously run ``payload`` and provide its output
If ``*args*`` and/or... | 128 | 150 | 412 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 00bcde623ff3aa91ade6bc804e29fbadd2a7b78aec2f95bce7f1ef477292062c | MIT | permissive | https://github.com/MatterMiners/cobald/blob/master/LICENSE |
18b6b34e646daffe2625cd20 | MatterMiners/cobald | cobald/daemon/runners/service.py | ServiceRunner.adopt | https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/runners/service.py#L107-L115 | train | python | Concurrently run ``payload`` in the background
If ``*args*`` and/or ``**kwargs`` are provided, pass them to ``payload`` upon execution. | def adopt(self, payload, *args, flavour: ModuleType, **kwargs):
"""
Concurrently run ``payload`` in the background
If ``*args*`` and/or ``**kwargs`` are provided, pass them to ``payload`` upon execution.
"""
if args or kwargs:
payload = functools.partial(payload, *ar... | Concurrently run ``payload`` in the background
If ``*args*`` and/or ``**kwargs`` are provided, pass them to ``payload`` upon execution.
def adopt(self, payload, *args, flavour: ModuleType, **kwargs):
"""
Concurrently run ``payload`` in the background
If ``*args*`` and/or ``**kwargs`` ... | 125 | 144 | 402 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 519f650e8da4f30067a08014563f8e475e27cbdfe62f4d67c7c97ca9e5c2d6dc | MIT | permissive | https://github.com/MatterMiners/cobald/blob/master/LICENSE |
1573daab910596ad8a8be72f | MatterMiners/cobald | cobald/daemon/runners/service.py | ServiceRunner.accept | https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/runners/service.py#L118-L133 | train | python | Start accepting synchronous, asynchronous and service payloads
Since services are globally defined, only one :py:class:`ServiceRunner`
may :py:meth:`accept` payloads at any time. | def accept(self):
"""
Start accepting synchronous, asynchronous and service payloads
Since services are globally defined, only one :py:class:`ServiceRunner`
may :py:meth:`accept` payloads at any time.
"""
if self._meta_runner:
raise RuntimeError('payloads sch... | Start accepting synchronous, asynchronous and service payloads
Since services are globally defined, only one :py:class:`ServiceRunner`
may :py:meth:`accept` payloads at any time.
def accept(self):
"""
Start accepting synchronous, asynchronous and service payloads
Since service... | 183 | 195 | 709 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 8b604906fff110d59d8637f538dee03611fd6280e8c6f8343b479573f993655a | MIT | permissive | https://github.com/MatterMiners/cobald/blob/master/LICENSE |
363ef23c51721c5270653eb9 | MatterMiners/cobald | cobald/daemon/runners/service.py | ServiceRunner.shutdown | https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/runners/service.py#L135-L139 | train | python | Shutdown the accept loop and stop running payloads | def shutdown(self):
"""Shutdown the accept loop and stop running payloads"""
self._must_shutdown = True
self._is_shutdown.wait()
self._meta_runner.stop() | Shutdown the accept loop and stop running payloads
def shutdown(self):
"""Shutdown the accept loop and stop running payloads"""
self._must_shutdown = True
self._is_shutdown.wait()
self._meta_runner.stop() | 46 | 50 | 185 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 0bf933c91e0b938c0373d1ce1267ddcfc007e75495becb37c2d8d6a75164ec06 | MIT | permissive | https://github.com/MatterMiners/cobald/blob/master/LICENSE |
0d36006c7943070eb89523fc | quantmind/agile-toolkit | agiletoolkit/github/milestones.py | milestones | https://github.com/quantmind/agile-toolkit/blob/96028e36a842c57b171907c20583a60d1045fec1/agiletoolkit/github/milestones.py#L13-L23 | train | python | View/edit/close milestones on github | def milestones(ctx, list, close):
"""View/edit/close milestones on github
"""
repos = get_repos(ctx.parent.agile.get('labels'))
if list:
_list_milestones(repos)
elif close:
click.echo('Closing milestones "%s"' % close)
_close_milestone(repos, close)
else:
click.ec... | View/edit/close milestones on github
def milestones(ctx, list, close):
"""View/edit/close milestones on github
"""
repos = get_repos(ctx.parent.agile.get('labels'))
if list:
_list_milestones(repos)
elif close:
click.echo('Closing milestones "%s"' % close)
_close_milestone(re... | 89 | 36 | 338 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 727648de723a931c2b3a1f2e9f590208e69f1577bbd143b44af653f65d10de87 | BSD-3-Clause | permissive | https://github.com/quantmind/agile-toolkit/blob/master/LICENSE |
76ac18ca01f1d92ca571e3af | astroduff/commah | examples.py | runcommand | https://github.com/astroduff/commah/blob/3ec70338c5123a053c79ddcf2cb3beac26bc9137/examples.py#L9-L90 | train | python | Example interface commands | def runcommand(cosmology='WMAP5'):
""" Example interface commands """
# Return the WMAP5 cosmology concentration predicted for
# z=0 range of masses
Mi = [1e8, 1e9, 1e10]
zi = 0
print("Concentrations for haloes of mass %s at z=%s" % (Mi, zi))
output = commah.run(cosmology=cosmology, zi=zi, ... | Example interface commands
def runcommand(cosmology='WMAP5'):
""" Example interface commands """
# Return the WMAP5 cosmology concentration predicted for
# z=0 range of masses
Mi = [1e8, 1e9, 1e10]
zi = 0
print("Concentrations for haloes of mass %s at z=%s" % (Mi, zi))
output = commah.run(... | 1,084 | 26 | 3,076 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | e626b98dee68b70828e23a0d139d21a439c3e5f1b2ffd23a70001c910e65e3f2 | BSD-3-Clause | permissive | https://github.com/astroduff/commah/blob/master/LICENSE |
8ed6ffe0410bdfd78ff3e5c5 | astroduff/commah | examples.py | plotcommand | https://github.com/astroduff/commah/blob/3ec70338c5123a053c79ddcf2cb3beac26bc9137/examples.py#L93-L466 | train | python | Example ways to interrogate the dataset and plot the commah output | def plotcommand(cosmology='WMAP5', plotname=None):
""" Example ways to interrogate the dataset and plot the commah output """
# Plot the c-M relation as a functon of redshift
xarray = 10**(np.arange(1, 15, 0.2))
yval = 'c'
# Specify the redshift range
zarray = np.arange(0, 5, 0.5)
xtitle ... | Example ways to interrogate the dataset and plot the commah output
def plotcommand(cosmology='WMAP5', plotname=None):
""" Example ways to interrogate the dataset and plot the commah output """
# Plot the c-M relation as a functon of redshift
xarray = 10**(np.arange(1, 15, 0.2))
yval = 'c'
# Speci... | 3,558 | 66 | 11,820 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 8b30180a0a29def6444fd5ef70c69d928c86e2651b69c8a5ac76cb08398fffcb | BSD-3-Clause | permissive | https://github.com/astroduff/commah/blob/master/LICENSE |
0e78412f62055c16300abdf3 | developersociety/django-glitter | glitter/reminders/admin.py | ReminderInline.get_formset | https://github.com/developersociety/django-glitter/blob/2c0280ec83afee80deee94ee3934fc54239c2e87/glitter/reminders/admin.py#L15-L20 | train | python | Default user to the current version owner. | def get_formset(self, request, obj=None, **kwargs):
""" Default user to the current version owner. """
data = super().get_formset(request, obj, **kwargs)
if obj:
data.form.base_fields['user'].initial = request.user.id
return data | Default user to the current version owner.
def get_formset(self, request, obj=None, **kwargs):
""" Default user to the current version owner. """
data = super().get_formset(request, obj, **kwargs)
if obj:
data.form.base_fields['user'].initial = request.user.id
return data | 69 | 42 | 273 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 04f78e90136521c868a17e1a8824a76a87b996fed1d3a82a40b4d9ebdbcbb187 | BSD-3-Clause | permissive | https://github.com/developersociety/django-glitter/blob/master/LICENSE |
423294fe1ceb467d81e66513 | developersociety/django-glitter | glitter/publisher/utils.py | process_actions | https://github.com/developersociety/django-glitter/blob/2c0280ec83afee80deee94ee3934fc54239c2e87/glitter/publisher/utils.py#L7-L28 | train | python | Process actions in the publishing schedule.
Returns the number of actions processed. | def process_actions(action_ids=None):
"""
Process actions in the publishing schedule.
Returns the number of actions processed.
"""
actions_taken = 0
action_list = PublishAction.objects.prefetch_related(
'content_object',
).filter(
scheduled_time__lte=timezone.now(),
)
... | Process actions in the publishing schedule.
Returns the number of actions processed.
def process_actions(action_ids=None):
"""
Process actions in the publishing schedule.
Returns the number of actions processed.
"""
actions_taken = 0
action_list = PublishAction.objects.prefetch_related(
... | 129 | 89 | 550 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | a42dff7a5549c26f9445b5f02b62e28bf5ee57ae729aa397f59f6d0085e01d00 | BSD-3-Clause | permissive | https://github.com/developersociety/django-glitter/blob/master/LICENSE |
c75ac74102a050c63ff6b85a | developersociety/django-glitter | glitter/publisher/utils.py | celery_enabled | https://github.com/developersociety/django-glitter/blob/2c0280ec83afee80deee94ee3934fc54239c2e87/glitter/publisher/utils.py#L31-L48 | train | python | Return a boolean if Celery tasks are enabled for this app.
If the ``GLITTER_PUBLISHER_CELERY`` setting is ``True`` or ``False`` - then that value will be
used. However if the setting isn't defined, then this will be enabled automatically if Celery
is installed. | def celery_enabled():
"""
Return a boolean if Celery tasks are enabled for this app.
If the ``GLITTER_PUBLISHER_CELERY`` setting is ``True`` or ``False`` - then that value will be
used. However if the setting isn't defined, then this will be enabled automatically if Celery
is installed.
"""
... | Return a boolean if Celery tasks are enabled for this app.
If the ``GLITTER_PUBLISHER_CELERY`` setting is ``True`` or ``False`` - then that value will be
used. However if the setting isn't defined, then this will be enabled automatically if Celery
is installed.
def celery_enabled():
"""
Return a b... | 197 | 274 | 557 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 92a8122cf41728baa958a90dfbb516222d34e614b5b51032a9d4c5d4b1ed7c82 | BSD-3-Clause | permissive | https://github.com/developersociety/django-glitter/blob/master/LICENSE |
dae558eae298fc09f9adee1d | jamescooke/flake8-aaa | src/flake8_aaa/command_line.py | do_command_line | https://github.com/jamescooke/flake8-aaa/blob/29938b96845fe32ced4358ba66af3b3be2a37794/src/flake8_aaa/command_line.py#L8-L30 | train | python | Currently a small stub to create an instance of Checker for the passed
``infile`` and run its test functions through linting.
Args:
infile
Returns:
int: Number of flake8 errors raised. | def do_command_line(infile: typing.IO[str]) -> int:
"""
Currently a small stub to create an instance of Checker for the passed
``infile`` and run its test functions through linting.
Args:
infile
Returns:
int: Number of flake8 errors raised.
"""
lines = infile.readlines()
... | Currently a small stub to create an instance of Checker for the passed
``infile`` and run its test functions through linting.
Args:
infile
Returns:
int: Number of flake8 errors raised.
def do_command_line(infile: typing.IO[str]) -> int:
"""
Currently a small stub to create an inst... | 210 | 214 | 722 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 8accdde77fc065992926d452ca3f804383bc3d1a457f298a40406153c98f424e | MIT | permissive | https://github.com/jamescooke/flake8-aaa/blob/master/LICENSE |
11cbecb9b0c0193392f042b6 | astroduff/commah | commah/commah.py | _izip | https://github.com/astroduff/commah/blob/3ec70338c5123a053c79ddcf2cb3beac26bc9137/commah/commah.py#L17-L24 | train | python | Iterate through multiple lists or arrays of equal size | def _izip(*iterables):
""" Iterate through multiple lists or arrays of equal size """
# This izip routine is from itertools
# izip('ABCD', 'xy') --> Ax By
iterators = map(iter, iterables)
while iterators:
yield tuple(map(next, iterators)) | Iterate through multiple lists or arrays of equal size
def _izip(*iterables):
""" Iterate through multiple lists or arrays of equal size """
# This izip routine is from itertools
# izip('ABCD', 'xy') --> Ax By
iterators = map(iter, iterables)
while iterators:
yield tuple(map(next, iterator... | 77 | 54 | 267 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 645febdec290e371cdceb00820920af5af8c06d6da859c6a250901fedd4b7aa1 | BSD-3-Clause | permissive | https://github.com/astroduff/commah/blob/master/LICENSE |
End of preview. Expand in Data Studio
CodeSearchNet Python — permissive licences only
Working copy (2026-12-05). Derived from the official
code-search-net/code_search_net
python configuration, keeping only repositories whose audited SPDX licence is
permissive.
- 289,457 rows, 3,408 repositories
- 408,109,489 characters, 91,672,340 tokens
(tiktoken
cl100k_base) - parquet
213,678,070bytes (zstd), 20 columns - splits: train 262,453 · validation 14,202 · test 12,802
- removed 81,347 non-permissive rows and 86,655 rows without a detected licence.
- audit cap: 4,517 repos audited (87.1% of rows); 483 selected repos (8,566 rows) not audited and dropped.
Full datasheet: datasheet.md.
Licences (rows)
| SPDX | rows | % |
|---|---|---|
MIT |
130,531 | 45.1% |
Apache-2.0 |
100,626 | 34.8% |
BSD-3-Clause |
43,179 | 14.9% |
BSD-2-Clause |
11,810 | 4.1% |
ISC |
2,223 | 0.8% |
WTFPL |
525 | 0.2% |
BSL-1.0 |
247 | 0.1% |
CC0-1.0 |
239 | 0.1% |
Zlib |
77 | 0.0% |
Schema
id, repo, path, func_name, url, split, language, docstring, code, text,
token_count, doc_chars, code_chars, license_basis, source, added,
record_sha256, license, license_class, license_source
text = docstring + \n\n + code. id is unique. record_sha256 is the
canonical per-row SHA-256.
Rights
- Every retained row has an audited permissive SPDX licence in
license(license_class == "permissive",license_source= GitHub licence URL). - No copyleft and no
NOASSERTION/unknown. - Permissive is not obligation-free: Apache-2.0 requires NOTICE/attribution; MIT/BSD require the copyright notice. This is not legal advice.
Not checked
- Whether GitHub's LICENSE-file detection matches the repo's actual terms.
- Notice/attribution preservation for Apache-2.0/BSD rows.
- Cross-corpus dedup against other code corpora.
- PII in code/docstrings; no scrubber was run.
- Downloads last month
- -