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 |
727af61b048f8f002ef434b0 | astroduff/commah | commah/commah.py | _checkinput | https://github.com/astroduff/commah/blob/3ec70338c5123a053c79ddcf2cb3beac26bc9137/commah/commah.py#L27-L67 | train | python | Check and convert any input scalar or array to numpy array | def _checkinput(zi, Mi, z=False, verbose=None):
""" Check and convert any input scalar or array to numpy array """
# How many halo redshifts provided?
zi = np.array(zi, ndmin=1, dtype=float)
# How many halo masses provided?
Mi = np.array(Mi, ndmin=1, dtype=float)
# Check the input sizes for zi... | Check and convert any input scalar or array to numpy array
def _checkinput(zi, Mi, z=False, verbose=None):
""" Check and convert any input scalar or array to numpy array """
# How many halo redshifts provided?
zi = np.array(zi, ndmin=1, dtype=float)
# How many halo masses provided?
Mi = np.array(M... | 442 | 58 | 1,606 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | b3b91193de5b6584ac2be86bbf334ae8e832974a954131e53bc44b39675a57ee | BSD-3-Clause | permissive | https://github.com/astroduff/commah/blob/master/LICENSE |
8510627b7acab497aab2c9d6 | astroduff/commah | commah/commah.py | getcosmo | https://github.com/astroduff/commah/blob/3ec70338c5123a053c79ddcf2cb3beac26bc9137/commah/commah.py#L70-L108 | train | python | Find cosmological parameters for named cosmo in cosmology.py list | def getcosmo(cosmology):
""" Find cosmological parameters for named cosmo in cosmology.py list """
defaultcosmologies = {'dragons': cg.DRAGONS(), 'wmap1': cg.WMAP1_Mill(),
'wmap3': cg.WMAP3_ML(), 'wmap5': cg.WMAP5_mean(),
'wmap7': cg.WMAP7_ML(), 'wmap9': cg.W... | Find cosmological parameters for named cosmo in cosmology.py list
def getcosmo(cosmology):
""" Find cosmological parameters for named cosmo in cosmology.py list """
defaultcosmologies = {'dragons': cg.DRAGONS(), 'wmap1': cg.WMAP1_Mill(),
'wmap3': cg.WMAP3_ML(), 'wmap5': cg.WMAP5_mean... | 501 | 65 | 1,860 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | ebdaab9bd5137bd2e4975205d286fd5279b7afab40b45a3186fc12ec80e77fc5 | BSD-3-Clause | permissive | https://github.com/astroduff/commah/blob/master/LICENSE |
7d0b0cfb43eda440e02cd77c | astroduff/commah | commah/commah.py | _getcosmoheader | https://github.com/astroduff/commah/blob/3ec70338c5123a053c79ddcf2cb3beac26bc9137/commah/commah.py#L111-L119 | train | python | Output the cosmology to a string for writing to file | def _getcosmoheader(cosmo):
""" Output the cosmology to a string for writing to file """
cosmoheader = ("# Cosmology (flat) Om:{0:.3f}, Ol:{1:.3f}, h:{2:.2f}, "
"sigma8:{3:.3f}, ns:{4:.2f}".format(
cosmo['omega_M_0'], cosmo['omega_lambda_0'], cosmo['h'],
... | Output the cosmology to a string for writing to file
def _getcosmoheader(cosmo):
""" Output the cosmology to a string for writing to file """
cosmoheader = ("# Cosmology (flat) Om:{0:.3f}, Ol:{1:.3f}, h:{2:.2f}, "
"sigma8:{3:.3f}, ns:{4:.2f}".format(
cosmo['omega_M_0'... | 130 | 52 | 384 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | dc432de6157732a7ae9d6b350471d2fe2e07dc575f73149afe61408d88cf584d | BSD-3-Clause | permissive | https://github.com/astroduff/commah/blob/master/LICENSE |
c84e1c77579c29acd8b5a5bd | astroduff/commah | commah/commah.py | cduffy | https://github.com/astroduff/commah/blob/3ec70338c5123a053c79ddcf2cb3beac26bc9137/commah/commah.py#L122-L144 | train | python | NFW conc from Duffy 08 Table 1 for halo mass and redshift | def cduffy(z, M, vir='200crit', relaxed=True):
""" NFW conc from Duffy 08 Table 1 for halo mass and redshift"""
if(vir == '200crit'):
if relaxed:
params = [6.71, -0.091, -0.44]
else:
params = [5.71, -0.084, -0.47]
elif(vir == 'tophat'):
if relaxed:
... | NFW conc from Duffy 08 Table 1 for halo mass and redshift
def cduffy(z, M, vir='200crit', relaxed=True):
""" NFW conc from Duffy 08 Table 1 for halo mass and redshift"""
if(vir == '200crit'):
if relaxed:
params = [6.71, -0.091, -0.44]
else:
params = [5.71, -0.084, -0.47... | 263 | 57 | 741 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 9e8b3b4096141de9cb3da9b152768466483df624ede3280bb2a32e37a04c31a4 | BSD-3-Clause | permissive | https://github.com/astroduff/commah/blob/master/LICENSE |
8f684bfc75070a5ec6515858 | astroduff/commah | commah/commah.py | _delta_sigma | https://github.com/astroduff/commah/blob/3ec70338c5123a053c79ddcf2cb3beac26bc9137/commah/commah.py#L147-L172 | train | python | Perturb best-fit constant of proportionality Ascaling for
rho_crit - rho_2 relation for unknown cosmology (Correa et al 2015c)
Parameters
----------
cosmo : dict
Dictionary of cosmological parameters, similar in format to:
{'N_nu': 0,'Y_He': 0.24, 'h': 0.702, 'n': 0.963,'omega_M_0':... | def _delta_sigma(**cosmo):
""" Perturb best-fit constant of proportionality Ascaling for
rho_crit - rho_2 relation for unknown cosmology (Correa et al 2015c)
Parameters
----------
cosmo : dict
Dictionary of cosmological parameters, similar in format to:
{'N_nu': 0,'Y_He': 0.24, ... | Perturb best-fit constant of proportionality Ascaling for
rho_crit - rho_2 relation for unknown cosmology (Correa et al 2015c)
Parameters
----------
cosmo : dict
Dictionary of cosmological parameters, similar in format to:
{'N_nu': 0,'Y_He': 0.24, 'h': 0.702, 'n': 0.963,'omega_M_0':... | 497 | 607 | 841 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 8163863d1a9a4cacc01ab2daecc74369ca83dbc6cb2fc139962babf159ce5530 | BSD-3-Clause | permissive | https://github.com/astroduff/commah/blob/master/LICENSE |
4168c9d3c08e368edd088477 | astroduff/commah | commah/commah.py | getAscaling | https://github.com/astroduff/commah/blob/3ec70338c5123a053c79ddcf2cb3beac26bc9137/commah/commah.py#L175-L216 | train | python | Returns the normalisation constant between
Rho_-2 and Rho_mean(z_formation) for a given cosmology
Parameters
----------
cosmology : str or dict
Can be named cosmology, default WMAP7 (aka DRAGONS), or
DRAGONS, WMAP1, WMAP3, WMAP5, WMAP7, WMAP9, Planck13, Planck15
or dictionar... | def getAscaling(cosmology, newcosmo=None):
""" Returns the normalisation constant between
Rho_-2 and Rho_mean(z_formation) for a given cosmology
Parameters
----------
cosmology : str or dict
Can be named cosmology, default WMAP7 (aka DRAGONS), or
DRAGONS, WMAP1, WMAP3, WMAP5, WM... | Returns the normalisation constant between
Rho_-2 and Rho_mean(z_formation) for a given cosmology
Parameters
----------
cosmology : str or dict
Can be named cosmology, default WMAP7 (aka DRAGONS), or
DRAGONS, WMAP1, WMAP3, WMAP5, WMAP7, WMAP9, Planck13, Planck15
or dictionar... | 813 | 818 | 1,735 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 5145c56f093d8eddef54771ebcc17f71e9c9330fa3cf08652bd59c2ab2ec1adf | BSD-3-Clause | permissive | https://github.com/astroduff/commah/blob/master/LICENSE |
5db326aa20e6022c4a88d016 | astroduff/commah | commah/commah.py | _int_growth | https://github.com/astroduff/commah/blob/3ec70338c5123a053c79ddcf2cb3beac26bc9137/commah/commah.py#L219-L235 | train | python | Returns integral of the linear growth factor from z=200 to z=z | def _int_growth(z, **cosmo):
""" Returns integral of the linear growth factor from z=200 to z=z """
zmax = 200
if hasattr(z, "__len__"):
for zval in z:
assert(zval < zmax)
else:
assert(z < zmax)
y, yerr = scipy.integrate.quad(
lambda z: (1 + z)/(cosmo['omega_M_... | Returns integral of the linear growth factor from z=200 to z=z
def _int_growth(z, **cosmo):
""" Returns integral of the linear growth factor from z=200 to z=z """
zmax = 200
if hasattr(z, "__len__"):
for zval in z:
assert(zval < zmax)
else:
assert(z < zmax)
y, yerr = ... | 143 | 62 | 428 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | bee87c54bd7265e3fb33822fc9fda64a7572428fe77edb586de62ca2eddf0937 | BSD-3-Clause | permissive | https://github.com/astroduff/commah/blob/master/LICENSE |
065c04b997a03d17eb034421 | astroduff/commah | commah/commah.py | _deriv_growth | https://github.com/astroduff/commah/blob/3ec70338c5123a053c79ddcf2cb3beac26bc9137/commah/commah.py#L238-L249 | train | python | Returns derivative of the linear growth factor at z
for a given cosmology **cosmo | def _deriv_growth(z, **cosmo):
""" Returns derivative of the linear growth factor at z
for a given cosmology **cosmo """
inv_h = (cosmo['omega_M_0']*(1 + z)**3 + cosmo['omega_lambda_0'])**(-0.5)
fz = (1 + z) * inv_h**3
deriv_g = growthfactor(z, norm=True, **cosmo)*(inv_h**2) *\
1.5 * c... | Returns derivative of the linear growth factor at z
for a given cosmology **cosmo
def _deriv_growth(z, **cosmo):
""" Returns derivative of the linear growth factor at z
for a given cosmology **cosmo """
inv_h = (cosmo['omega_M_0']*(1 + z)**3 + cosmo['omega_lambda_0'])**(-0.5)
fz = (1 + z) ... | 174 | 89 | 447 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | a5f3192c60bd8a6f5bb27f47714c42c85f9905eba7c989c3b4b08bc765cd9c41 | BSD-3-Clause | permissive | https://github.com/astroduff/commah/blob/master/LICENSE |
6ee8a5b4d30ccdf52bb7125e | astroduff/commah | commah/commah.py | growthfactor | https://github.com/astroduff/commah/blob/3ec70338c5123a053c79ddcf2cb3beac26bc9137/commah/commah.py#L252-L284 | train | python | Returns linear growth factor at a given redshift, normalised to z=0
by default, for a given cosmology
Parameters
----------
z : float or numpy array
The redshift at which the growth factor should be calculated
norm : boolean, optional
If true then normalise the growth factor to... | def growthfactor(z, norm=True, **cosmo):
""" Returns linear growth factor at a given redshift, normalised to z=0
by default, for a given cosmology
Parameters
----------
z : float or numpy array
The redshift at which the growth factor should be calculated
norm : boolean, optional
... | Returns linear growth factor at a given redshift, normalised to z=0
by default, for a given cosmology
Parameters
----------
z : float or numpy array
The redshift at which the growth factor should be calculated
norm : boolean, optional
If true then normalise the growth factor to... | 569 | 774 | 1,048 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 84ef2e2852221787009257a1fccec506a96c8704a73c0ca8a1a7a4554917d146 | BSD-3-Clause | permissive | https://github.com/astroduff/commah/blob/master/LICENSE |
6c01b45ee786347628d029be | astroduff/commah | commah/commah.py | _minimize_c | https://github.com/astroduff/commah/blob/3ec70338c5123a053c79ddcf2cb3beac26bc9137/commah/commah.py#L287-L312 | train | python | Trial function to solve 2 eqns (17 and 18) from Correa et al. (2015c)
for 1 unknown, i.e. concentration, returned by a minimisation call | def _minimize_c(c, z=0, a_tilde=1, b_tilde=-1,
Ascaling=900, omega_M_0=0.25, omega_lambda_0=0.75):
""" Trial function to solve 2 eqns (17 and 18) from Correa et al. (2015c)
for 1 unknown, i.e. concentration, returned by a minimisation call """
# Fn 1 (LHS of Eqn 18)
Y1 = np.log(2) ... | Trial function to solve 2 eqns (17 and 18) from Correa et al. (2015c)
for 1 unknown, i.e. concentration, returned by a minimisation call
def _minimize_c(c, z=0, a_tilde=1, b_tilde=-1,
Ascaling=900, omega_M_0=0.25, omega_lambda_0=0.75):
""" Trial function to solve 2 eqns (17 and 18) from Cor... | 368 | 144 | 866 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 1bd11fd51dfb2d84db755d32d7a5c57ef5eab8f378eee21b91db7c2aec71c2e7 | BSD-3-Clause | permissive | https://github.com/astroduff/commah/blob/master/LICENSE |
f8e8577a9fc8ea00fbd2863c | astroduff/commah | commah/commah.py | formationz | https://github.com/astroduff/commah/blob/3ec70338c5123a053c79ddcf2cb3beac26bc9137/commah/commah.py#L315-L346 | train | python | Rearrange eqn 18 from Correa et al (2015c) to return
formation redshift for a concentration at a given redshift
Parameters
----------
c : float / numpy array
Concentration of halo
z : float / numpy array
Redshift of halo with concentration c
Ascaling : float
Cosmolog... | def formationz(c, z, Ascaling=900, omega_M_0=0.25, omega_lambda_0=0.75):
""" Rearrange eqn 18 from Correa et al (2015c) to return
formation redshift for a concentration at a given redshift
Parameters
----------
c : float / numpy array
Concentration of halo
z : float / numpy array
... | Rearrange eqn 18 from Correa et al (2015c) to return
formation redshift for a concentration at a given redshift
Parameters
----------
c : float / numpy array
Concentration of halo
z : float / numpy array
Redshift of halo with concentration c
Ascaling : float
Cosmolog... | 493 | 721 | 1,029 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | b7ae0dab71b21c065a477add930aeb360b14473276a0f9244e21df7ba2d59210 | BSD-3-Clause | permissive | https://github.com/astroduff/commah/blob/master/LICENSE |
59e3dbaa19db5f764aa8be38 | astroduff/commah | commah/commah.py | calc_ab | https://github.com/astroduff/commah/blob/3ec70338c5123a053c79ddcf2cb3beac26bc9137/commah/commah.py#L349-L397 | train | python | Calculate growth rate indices a_tilde and b_tilde
Parameters
----------
zi : float
Redshift
Mi : float
Halo mass at redshift 'zi'
cosmo : dict
Dictionary of cosmological parameters, similar in format to:
{'N_nu': 0,'Y_He': 0.24, 'h': 0.702, 'n': 0.963,'omega_M_0': 0.... | def calc_ab(zi, Mi, **cosmo):
""" Calculate growth rate indices a_tilde and b_tilde
Parameters
----------
zi : float
Redshift
Mi : float
Halo mass at redshift 'zi'
cosmo : dict
Dictionary of cosmological parameters, similar in format to:
{'N_nu': 0,'Y_He': 0.24, ... | Calculate growth rate indices a_tilde and b_tilde
Parameters
----------
zi : float
Redshift
Mi : float
Halo mass at redshift 'zi'
cosmo : dict
Dictionary of cosmological parameters, similar in format to:
{'N_nu': 0,'Y_He': 0.24, 'h': 0.702, 'n': 0.963,'omega_M_0': 0.... | 834 | 522 | 1,744 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | fabd347ee432c6e5d8fcd8fa009320d4b9b6470bdaf4c9102da05b1c0346759b | BSD-3-Clause | permissive | https://github.com/astroduff/commah/blob/master/LICENSE |
495dbd7d007012029fd1dcb0 | astroduff/commah | commah/commah.py | acc_rate | https://github.com/astroduff/commah/blob/3ec70338c5123a053c79ddcf2cb3beac26bc9137/commah/commah.py#L400-L438 | train | python | Calculate accretion rate and mass history of a halo at any
redshift 'z' with mass 'Mi' at a lower redshift 'z'
Parameters
----------
z : float
Redshift to solve acc_rate / mass history. Note zi<z
zi : float
Redshift
Mi : float
Halo mass at redshift 'zi'
cosmo : d... | def acc_rate(z, zi, Mi, **cosmo):
""" Calculate accretion rate and mass history of a halo at any
redshift 'z' with mass 'Mi' at a lower redshift 'z'
Parameters
----------
z : float
Redshift to solve acc_rate / mass history. Note zi<z
zi : float
Redshift
Mi : float
... | Calculate accretion rate and mass history of a halo at any
redshift 'z' with mass 'Mi' at a lower redshift 'z'
Parameters
----------
z : float
Redshift to solve acc_rate / mass history. Note zi<z
zi : float
Redshift
Mi : float
Halo mass at redshift 'zi'
cosmo : d... | 768 | 725 | 1,359 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | d2bcc7dec5fdae6ccc5ecf8996d54ceda583a84591d470ef4ad9adbec39354ab | BSD-3-Clause | permissive | https://github.com/astroduff/commah/blob/master/LICENSE |
ee773eedd71a3db81d398308 | astroduff/commah | commah/commah.py | MAH | https://github.com/astroduff/commah/blob/3ec70338c5123a053c79ddcf2cb3beac26bc9137/commah/commah.py#L441-L480 | train | python | Calculate mass accretion history by looping function acc_rate
over redshift steps 'z' for halo of mass 'Mi' at redshift 'zi'
Parameters
----------
z : float / numpy array
Redshift to output MAH over. Note zi<z always
zi : float
Redshift
Mi : float
Halo mass at redshi... | def MAH(z, zi, Mi, **cosmo):
""" Calculate mass accretion history by looping function acc_rate
over redshift steps 'z' for halo of mass 'Mi' at redshift 'zi'
Parameters
----------
z : float / numpy array
Redshift to output MAH over. Note zi<z always
zi : float
Redshift
M... | Calculate mass accretion history by looping function acc_rate
over redshift steps 'z' for halo of mass 'Mi' at redshift 'zi'
Parameters
----------
z : float / numpy array
Redshift to output MAH over. Note zi<z always
zi : float
Redshift
Mi : float
Halo mass at redshi... | 690 | 787 | 1,266 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 537184776353b0fa6a22f4d27234e69815804702653b673eb66e9a78638cfc4a | BSD-3-Clause | permissive | https://github.com/astroduff/commah/blob/master/LICENSE |
cc342259f4473430d50461c0 | astroduff/commah | commah/commah.py | COM | https://github.com/astroduff/commah/blob/3ec70338c5123a053c79ddcf2cb3beac26bc9137/commah/commah.py#L483-L552 | train | python | Calculate concentration for halo of mass 'M' at redshift 'z'
Parameters
----------
z : float / numpy array
Redshift to find concentration of halo
M : float / numpy array
Halo mass at redshift 'z'. Must be same size as 'z'
cosmo : dict
Dictionary of cosmological parameters, s... | def COM(z, M, **cosmo):
""" Calculate concentration for halo of mass 'M' at redshift 'z'
Parameters
----------
z : float / numpy array
Redshift to find concentration of halo
M : float / numpy array
Halo mass at redshift 'z'. Must be same size as 'z'
cosmo : dict
Dictiona... | Calculate concentration for halo of mass 'M' at redshift 'z'
Parameters
----------
z : float / numpy array
Redshift to find concentration of halo
M : float / numpy array
Halo mass at redshift 'z'. Must be same size as 'z'
cosmo : dict
Dictionary of cosmological parameters, s... | 1,032 | 852 | 2,759 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | f05ee84419b60a84e98de6c7a731d0dd28a362099c7719d16cecc9f0ee79c654 | BSD-3-Clause | permissive | https://github.com/astroduff/commah/blob/master/LICENSE |
413b360b9bf5c7a9ba9457be | astroduff/commah | commah/commah.py | run | https://github.com/astroduff/commah/blob/3ec70338c5123a053c79ddcf2cb3beac26bc9137/commah/commah.py#L555-L799 | train | python | Run commah code on halo of mass 'Mi' at redshift 'zi' with
accretion and profile history at higher redshifts 'z'
This is based on Correa et al. (2015a,b,c)
Parameters
----------
cosmology : str or dict
Can be named cosmology, default WMAP7 (aka DRAGONS), or
DRAGONS, WMAP1, W... | def run(cosmology, zi=0, Mi=1e12, z=False, com=True, mah=True,
filename=None, verbose=None, retcosmo=None):
""" Run commah code on halo of mass 'Mi' at redshift 'zi' with
accretion and profile history at higher redshifts 'z'
This is based on Correa et al. (2015a,b,c)
Parameters
----... | Run commah code on halo of mass 'Mi' at redshift 'zi' with
accretion and profile history at higher redshifts 'z'
This is based on Correa et al. (2015a,b,c)
Parameters
----------
cosmology : str or dict
Can be named cosmology, default WMAP7 (aka DRAGONS), or
DRAGONS, WMAP1, W... | 4,017 | 4,096 | 11,706 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 320a1aaf8ac3cdb56a067e95280ba8fcf641b221e2a9164503f9435a7e57a2d8 | BSD-3-Clause | permissive | https://github.com/astroduff/commah/blob/master/LICENSE |
3ab6eee09e391fe298928585 | MatterMiners/cobald | cobald/daemon/core/config.py | load | https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/core/config.py#L10-L23 | train | python | Load a configuration and keep it alive for the given context
:param config_path: path to a configuration file | def load(config_path: str):
"""
Load a configuration and keep it alive for the given context
:param config_path: path to a configuration file
"""
# we bind the config to _ to keep it alive
if os.path.splitext(config_path)[1] in ('.yaml', '.yml'):
_ = load_yaml_configuration(config_path,... | Load a configuration and keep it alive for the given context
:param config_path: path to a configuration file
def load(config_path: str):
"""
Load a configuration and keep it alive for the given context
:param config_path: path to a configuration file
"""
# we bind the config to _ to keep it ... | 154 | 114 | 575 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | c33caefff2f5b653eb00306ae7dcc003cddbab375ff1024414328a3784275e7f | MIT | permissive | https://github.com/MatterMiners/cobald/blob/master/LICENSE |
68f7c6ac6ea71f4183f51e57 | quantmind/agile-toolkit | agiletoolkit/api/releases.py | Releases.tag | https://github.com/quantmind/agile-toolkit/blob/96028e36a842c57b171907c20583a60d1045fec1/agiletoolkit/api/releases.py#L37-L43 | train | python | Get a release by tag | def tag(self, tag):
"""Get a release by tag
"""
url = '%s/tags/%s' % (self, tag)
response = self.http.get(url, auth=self.auth)
response.raise_for_status()
return response.json() | Get a release by tag
def tag(self, tag):
"""Get a release by tag
"""
url = '%s/tags/%s' % (self, tag)
response = self.http.get(url, auth=self.auth)
response.raise_for_status()
return response.json() | 60 | 20 | 225 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 66d4da976a0f7ae8fd928921d6d1142ef8531b5d75de4e5858bfd44c855b1d1a | BSD-3-Clause | permissive | https://github.com/quantmind/agile-toolkit/blob/master/LICENSE |
3d2a026fe59b5aba55420350 | quantmind/agile-toolkit | agiletoolkit/api/releases.py | Releases.release_assets | https://github.com/quantmind/agile-toolkit/blob/96028e36a842c57b171907c20583a60d1045fec1/agiletoolkit/api/releases.py#L53-L57 | train | python | Assets for a given release | def release_assets(self, release):
"""Assets for a given release
"""
release = self.as_id(release)
return self.get_list(url='%s/%s/assets' % (self, release)) | Assets for a given release
def release_assets(self, release):
"""Assets for a given release
"""
release = self.as_id(release)
return self.get_list(url='%s/%s/assets' % (self, release)) | 50 | 26 | 189 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 5cb8f1e7211e43dbe69b8f7885d791b96ce74d4eadd1af32b90b653aebab30b7 | BSD-3-Clause | permissive | https://github.com/quantmind/agile-toolkit/blob/master/LICENSE |
a2cf86789967a356134585d6 | quantmind/agile-toolkit | agiletoolkit/api/releases.py | Releases.upload | https://github.com/quantmind/agile-toolkit/blob/96028e36a842c57b171907c20583a60d1045fec1/agiletoolkit/api/releases.py#L59-L84 | train | python | Upload a file to a release
:param filename: filename to upload
:param content_type: optional content type
:return: json object from github | def upload(self, release, filename, content_type=None):
"""Upload a file to a release
:param filename: filename to upload
:param content_type: optional content type
:return: json object from github
"""
release = self.as_id(release)
name = os.path.basename(filenam... | Upload a file to a release
:param filename: filename to upload
:param content_type: optional content type
:return: json object from github
def upload(self, release, filename, content_type=None):
"""Upload a file to a release
:param filename: filename to upload
:param c... | 243 | 163 | 1,043 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | a9e0aad63bc8ddc34516bb5d9044f59825c7efeab3bd84ac82032fd9f8a8fe0e | BSD-3-Clause | permissive | https://github.com/quantmind/agile-toolkit/blob/master/LICENSE |
83fdfba49dcea32c344392cc | quantmind/agile-toolkit | agiletoolkit/api/releases.py | Releases.validate_tag | https://github.com/quantmind/agile-toolkit/blob/96028e36a842c57b171907c20583a60d1045fec1/agiletoolkit/api/releases.py#L86-L111 | train | python | Validate ``tag_name`` with the latest tag from github
If ``tag_name`` is a valid candidate, return the latest tag from github | def validate_tag(self, tag_name, prefix=None):
"""Validate ``tag_name`` with the latest tag from github
If ``tag_name`` is a valid candidate, return the latest tag from github
"""
new_version = semantic_version(tag_name)
current = self.latest()
if current:
ta... | Validate ``tag_name`` with the latest tag from github
If ``tag_name`` is a valid candidate, return the latest tag from github
def validate_tag(self, tag_name, prefix=None):
"""Validate ``tag_name`` with the latest tag from github
If ``tag_name`` is a valid candidate, return the latest tag fro... | 217 | 134 | 1,017 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | bca66bafddeb6861d5af8b8176c440d23fd367ed97e30145384d8552b2febd86 | BSD-3-Clause | permissive | https://github.com/quantmind/agile-toolkit/blob/master/LICENSE |
171eb2c2d2c755083c3418ad | quantmind/agile-toolkit | agiletoolkit/api/repo.py | GitRepo.label | https://github.com/quantmind/agile-toolkit/blob/96028e36a842c57b171907c20583a60d1045fec1/agiletoolkit/api/repo.py#L25-L41 | train | python | Create or update a label | def label(self, name, color, update=True):
"""Create or update a label
"""
url = '%s/labels' % self
data = dict(name=name, color=color)
response = self.http.post(
url, json=data, auth=self.auth, headers=self.headers
)
if response.status_code == 201:
... | Create or update a label
def label(self, name, color, update=True):
"""Create or update a label
"""
url = '%s/labels' % self
data = dict(name=name, color=color)
response = self.http.post(
url, json=data, auth=self.auth, headers=self.headers
)
if respo... | 141 | 24 | 614 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 0450e895e5f32e72a9061f70464c4b38f51a6245654905df4fc38ecac024929b | BSD-3-Clause | permissive | https://github.com/quantmind/agile-toolkit/blob/master/LICENSE |
ad931a00c58a8a1e46463a73 | MatterMiners/cobald | cobald/daemon/runners/asyncio_runner.py | AsyncioRunner._run_payloads | https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/runners/asyncio_runner.py#L29-L40 | train | python | Async component of _run | async def _run_payloads(self):
"""Async component of _run"""
delay = 0.0
try:
while self.running.is_set():
await self._start_payloads()
await self._reap_payloads()
await asyncio.sleep(delay)
delay = min(delay + 0.1, 1.0)... | Async component of _run
async def _run_payloads(self):
"""Async component of _run"""
delay = 0.0
try:
while self.running.is_set():
await self._start_payloads()
await self._reap_payloads()
await asyncio.sleep(delay)
dela... | 93 | 23 | 406 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 2a9ff70dcf68cd851e7d0d4f311d1c70ab8996be98e33bfd7e4a046c3f927729 | MIT | permissive | https://github.com/MatterMiners/cobald/blob/master/LICENSE |
4e583280a617ca606323b70e | MatterMiners/cobald | cobald/daemon/runners/asyncio_runner.py | AsyncioRunner._start_payloads | https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/runners/asyncio_runner.py#L42-L49 | train | python | Start all queued payloads | async def _start_payloads(self):
"""Start all queued payloads"""
with self._lock:
for coroutine in self._payloads:
task = self.event_loop.create_task(coroutine())
self._tasks.add(task)
self._payloads.clear()
await asyncio.sleep(0) | Start all queued payloads
async def _start_payloads(self):
"""Start all queued payloads"""
with self._lock:
for coroutine in self._payloads:
task = self.event_loop.create_task(coroutine())
self._tasks.add(task)
self._payloads.clear()
await... | 67 | 25 | 310 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 76d5d30adf9416e800fa1b603334a4a8a45f4a4d56f7f041484b2de8711532f3 | MIT | permissive | https://github.com/MatterMiners/cobald/blob/master/LICENSE |
ff64cdd60dd69b219e47c4bd | MatterMiners/cobald | cobald/daemon/runners/asyncio_runner.py | AsyncioRunner._reap_payloads | https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/runners/asyncio_runner.py#L51-L58 | train | python | Clean up all finished payloads | async def _reap_payloads(self):
"""Clean up all finished payloads"""
for task in self._tasks.copy():
if task.done():
self._tasks.remove(task)
if task.exception() is not None:
raise task.exception()
await asyncio.sleep(0) | Clean up all finished payloads
async def _reap_payloads(self):
"""Clean up all finished payloads"""
for task in self._tasks.copy():
if task.done():
self._tasks.remove(task)
if task.exception() is not None:
raise task.exception()
aw... | 65 | 30 | 308 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | f8de2e9a7aa19a8183af46f1967613fe01dd5963beea9248a009a70ebd2329ca | MIT | permissive | https://github.com/MatterMiners/cobald/blob/master/LICENSE |
def351f532ee333e132a31d4 | MatterMiners/cobald | cobald/daemon/runners/asyncio_runner.py | AsyncioRunner._cancel_payloads | https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/runners/asyncio_runner.py#L60-L68 | train | python | Cancel all remaining payloads | async def _cancel_payloads(self):
"""Cancel all remaining payloads"""
for task in self._tasks:
task.cancel()
await asyncio.sleep(0)
for task in self._tasks:
while not task.done():
await asyncio.sleep(0.1)
task.cancel() | Cancel all remaining payloads
async def _cancel_payloads(self):
"""Cancel all remaining payloads"""
for task in self._tasks:
task.cancel()
await asyncio.sleep(0)
for task in self._tasks:
while not task.done():
await asyncio.sleep(0.1)
... | 66 | 29 | 310 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 376ed253afbaa8628418beeb62679a2a1c6748cb4fb134249be207dfe44c36c7 | MIT | permissive | https://github.com/MatterMiners/cobald/blob/master/LICENSE |
3496f60962c1cbaeb8c2651e | quantmind/agile-toolkit | agiletoolkit/github/validate.py | validate | https://github.com/quantmind/agile-toolkit/blob/96028e36a842c57b171907c20583a60d1045fec1/agiletoolkit/github/validate.py#L11-L16 | train | python | Check if version of repository is semantic | def validate(ctx, sandbox):
"""Check if version of repository is semantic
"""
m = RepoManager(ctx.obj['agile'])
if not sandbox or m.can_release('sandbox'):
click.echo(m.validate_version()) | Check if version of repository is semantic
def validate(ctx, sandbox):
"""Check if version of repository is semantic
"""
m = RepoManager(ctx.obj['agile'])
if not sandbox or m.can_release('sandbox'):
click.echo(m.validate_version()) | 55 | 42 | 212 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 32b173df9cc512bdd1c31cf2c2dec6ef90abaa01ccc4fc872c08abcff3da3f05 | BSD-3-Clause | permissive | https://github.com/quantmind/agile-toolkit/blob/master/LICENSE |
efefbb32f278834f7b62d08b | developersociety/django-glitter | glitter/reminders/models.py | Reminder.get_interval_timedelta | https://github.com/developersociety/django-glitter/blob/2c0280ec83afee80deee94ee3934fc54239c2e87/glitter/reminders/models.py#L34-L63 | train | python | Spits out the timedelta in days. | def get_interval_timedelta(self):
""" Spits out the timedelta in days. """
now_datetime = timezone.now()
current_month_days = monthrange(now_datetime.year, now_datetime.month)[1]
# Two weeks
if self.interval == reminders_choices.INTERVAL_2_WEEKS:
interval_timedelta ... | Spits out the timedelta in days.
def get_interval_timedelta(self):
""" Spits out the timedelta in days. """
now_datetime = timezone.now()
current_month_days = monthrange(now_datetime.year, now_datetime.month)[1]
# Two weeks
if self.interval == reminders_choices.INTERVAL_2_WEEK... | 250 | 32 | 1,194 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 83dc5fec40b35a43f34e4f90a7d414eaa0f186f87d1797af2d1ccf5ddc26f44a | BSD-3-Clause | permissive | https://github.com/developersociety/django-glitter/blob/master/LICENSE |
ae1439666675d89e070330fa | MatterMiners/cobald | cobald/daemon/runners/asyncio_watcher.py | awaitable_runner | https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/runners/asyncio_watcher.py#L9-L16 | train | python | Execute a runner without blocking the event loop | async def awaitable_runner(runner: BaseRunner):
"""Execute a runner without blocking the event loop"""
runner_thread = CapturingThread(target=runner.run)
runner_thread.start()
delay = 0.0
while not runner_thread.join(timeout=0):
await asyncio.sleep(delay)
delay = min(delay + 0.1, 1.0... | Execute a runner without blocking the event loop
async def awaitable_runner(runner: BaseRunner):
"""Execute a runner without blocking the event loop"""
runner_thread = CapturingThread(target=runner.run)
runner_thread.start()
delay = 0.0
while not runner_thread.join(timeout=0):
await asyncio... | 88 | 48 | 321 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | d663cbba1e5d3b0d6ee20bb841f70bf9db7b0988fd980109d04dea8b89a2ce0a | MIT | permissive | https://github.com/MatterMiners/cobald/blob/master/LICENSE |
fc432babf24bda91375cb871 | MatterMiners/cobald | cobald/daemon/runners/asyncio_watcher.py | asyncio_main_run | https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/runners/asyncio_watcher.py#L19-L36 | train | python | Create an ``asyncio`` event loop running in the main thread and watching runners
Using ``asyncio`` to handle suprocesses requires a specific loop type to run in the main thread.
This function sets up and runs the correct loop in a portable way.
In addition, it runs a single :py:class:`~.BaseRunner` until c... | def asyncio_main_run(root_runner: BaseRunner):
"""
Create an ``asyncio`` event loop running in the main thread and watching runners
Using ``asyncio`` to handle suprocesses requires a specific loop type to run in the main thread.
This function sets up and runs the correct loop in a portable way.
In ... | Create an ``asyncio`` event loop running in the main thread and watching runners
Using ``asyncio`` to handle suprocesses requires a specific loop type to run in the main thread.
This function sets up and runs the correct loop in a portable way.
In addition, it runs a single :py:class:`~.BaseRunner` until c... | 311 | 438 | 927 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 74b5a6ea5618b437751087898ee4e342b6b8c1d9ab9cd5c683a8fe90ac10dedd | MIT | permissive | https://github.com/MatterMiners/cobald/blob/master/LICENSE |
f08d9c74b596bf63b0541c75 | MatterMiners/cobald | cobald/daemon/runners/thread_runner.py | CapturingThread.run | https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/runners/thread_runner.py#L24-L36 | train | python | Modified ``run`` that captures return value and exceptions from ``target`` | def run(self):
"""Modified ``run`` that captures return value and exceptions from ``target``"""
try:
if self._target:
return_value = self._target(*self._args, **self._kwargs)
if return_value is not None:
self._exception = OrphanedReturn(sel... | Modified ``run`` that captures return value and exceptions from ``target``
def run(self):
"""Modified ``run`` that captures return value and exceptions from ``target``"""
try:
if self._target:
return_value = self._target(*self._args, **self._kwargs)
if return... | 143 | 74 | 622 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | d16c1000824fc4baeb247cb731847f4550caac4f5159edb8ab9b627289c29ede | MIT | permissive | https://github.com/MatterMiners/cobald/blob/master/LICENSE |
d4f1bd78a198fec1b3a07b5c | MatterMiners/cobald | cobald/daemon/runners/thread_runner.py | ThreadRunner._start_payloads | https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/runners/thread_runner.py#L61-L71 | train | python | Start all queued payloads | def _start_payloads(self):
"""Start all queued payloads"""
with self._lock:
payloads = self._payloads.copy()
self._payloads.clear()
for subroutine in payloads:
thread = CapturingThread(target=subroutine)
thread.start()
self._threads.add... | Start all queued payloads
def _start_payloads(self):
"""Start all queued payloads"""
with self._lock:
payloads = self._payloads.copy()
self._payloads.clear()
for subroutine in payloads:
thread = CapturingThread(target=subroutine)
thread.start()
... | 88 | 25 | 409 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 1b05b5b90d5688b7a54b4395a3cc617d5053432fca6e1c59b883fde6f489ebdc | MIT | permissive | https://github.com/MatterMiners/cobald/blob/master/LICENSE |
ea1b4f1d23a5e5cfe78ea34d | MatterMiners/cobald | cobald/daemon/runners/thread_runner.py | ThreadRunner._reap_payloads | https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/runners/thread_runner.py#L73-L79 | train | python | Clean up all finished payloads | def _reap_payloads(self):
"""Clean up all finished payloads"""
for thread in self._threads.copy():
# CapturingThread.join will throw
if thread.join(timeout=0):
self._threads.remove(thread)
self._logger.debug('reaped thread %s', thread) | Clean up all finished payloads
def _reap_payloads(self):
"""Clean up all finished payloads"""
for thread in self._threads.copy():
# CapturingThread.join will throw
if thread.join(timeout=0):
self._threads.remove(thread)
self._logger.debug('reaped ... | 69 | 30 | 307 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | bf595b3447865f00701ab2cc86d8d90ded15068b2179d1dd3c31fa8be5c2cb0e | MIT | permissive | https://github.com/MatterMiners/cobald/blob/master/LICENSE |
52bdd409eb080ca31aeb3ef0 | MatterMiners/cobald | cobald/interfaces/_controller.py | Controller.s | https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/interfaces/_controller.py#L21-L31 | train | python | Create an unbound prototype of this class, partially applying arguments
.. code:: python
controller = Controller.s(interval=20)
pipeline = controller(rate=10) >> pool | def s(cls: Type[C], *args, **kwargs) -> Partial[C]:
"""
Create an unbound prototype of this class, partially applying arguments
.. code:: python
controller = Controller.s(interval=20)
pipeline = controller(rate=10) >> pool
"""
return Partial(cls, *args,... | Create an unbound prototype of this class, partially applying arguments
.. code:: python
controller = Controller.s(interval=20)
pipeline = controller(rate=10) >> pool
def s(cls: Type[C], *args, **kwargs) -> Partial[C]:
"""
Create an unbound prototype of this class, pa... | 111 | 201 | 330 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | e0e715912e683ab4d1982a241dd5cd6971406a6b2ae1c95d21e4fae794c2b781 | MIT | permissive | https://github.com/MatterMiners/cobald/blob/master/LICENSE |
77a873b637a9a718d9fe9db8 | josiah-wolf-oberholtzer/uqbar | uqbar/apis/InheritanceGraph.py | InheritanceGraph._build_mappings | https://github.com/josiah-wolf-oberholtzer/uqbar/blob/eca7fefebbbee1e2ae13bf5d6baa838be66b1db6/uqbar/apis/InheritanceGraph.py#L347-L385 | train | python | Collect all bases and organize into parent/child mappings. | def _build_mappings(
self, classes: Sequence[type]
) -> Tuple[Mapping[type, Sequence[type]], Mapping[type, Sequence[type]]]:
"""
Collect all bases and organize into parent/child mappings.
"""
parents_to_children: MutableMapping[type, Set[type]] = {}
children_to_parent... | Collect all bases and organize into parent/child mappings.
def _build_mappings(
self, classes: Sequence[type]
) -> Tuple[Mapping[type, Sequence[type]], Mapping[type, Sequence[type]]]:
"""
Collect all bases and organize into parent/child mappings.
"""
parents_to_children: Mut... | 364 | 58 | 1,748 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | a9023cf2f16a92f6b6cfdbb0ede04e529b800a5c555d26747c3f5ddb54d2b0f7 | MIT | permissive | https://github.com/supriya-project/uqbar/blob/main/LICENSE |
528082155b1da8ffc9ba8953 | josiah-wolf-oberholtzer/uqbar | uqbar/apis/InheritanceGraph.py | InheritanceGraph._collect_classes | https://github.com/josiah-wolf-oberholtzer/uqbar/blob/eca7fefebbbee1e2ae13bf5d6baa838be66b1db6/uqbar/apis/InheritanceGraph.py#L387-L422 | train | python | Collect all classes defined in/under ``package_paths``. | def _collect_classes(
self, package_paths: Sequence[str], recurse_subpackages: bool = True
) -> Sequence[type]:
"""
Collect all classes defined in/under ``package_paths``.
"""
import uqbar.apis
classes = []
initial_source_paths: Set[str] = set()
# Gra... | Collect all classes defined in/under ``package_paths``.
def _collect_classes(
self, package_paths: Sequence[str], recurse_subpackages: bool = True
) -> Sequence[type]:
"""
Collect all classes defined in/under ``package_paths``.
"""
import uqbar.apis
classes = []
... | 314 | 55 | 1,590 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | e6ec3eb775617e36d371294f88bfae7020f43e7af5876171640a6343d8cdf0f9 | MIT | permissive | https://github.com/supriya-project/uqbar/blob/main/LICENSE |
20661a14ff47a08999275b4f | quantmind/agile-toolkit | agiletoolkit/api/__init__.py | get_auth | https://github.com/quantmind/agile-toolkit/blob/96028e36a842c57b171907c20583a60d1045fec1/agiletoolkit/api/__init__.py#L40-L66 | train | python | Return a tuple for authenticating a user
If not successful raise ``AgileError``. | def get_auth():
"""Return a tuple for authenticating a user
If not successful raise ``AgileError``.
"""
auth = get_auth_from_env()
if auth[0] and auth[1]:
return auth
home = os.path.expanduser("~")
config = os.path.join(home, '.gitconfig')
if not os.path.isfile(config):
... | Return a tuple for authenticating a user
If not successful raise ``AgileError``.
def get_auth():
"""Return a tuple for authenticating a user
If not successful raise ``AgileError``.
"""
auth = get_auth_from_env()
if auth[0] and auth[1]:
return auth
home = os.path.expanduser("~")
... | 220 | 85 | 910 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 9d6de7fe383d256aa92104353a98b2983643a12afc06a1d05bda345e94df835e | BSD-3-Clause | permissive | https://github.com/quantmind/agile-toolkit/blob/master/LICENSE |
19d5edf93765393b5eb9e0de | josiah-wolf-oberholtzer/uqbar | uqbar/io/__init__.py | find_common_prefix | https://github.com/josiah-wolf-oberholtzer/uqbar/blob/eca7fefebbbee1e2ae13bf5d6baa838be66b1db6/uqbar/io/__init__.py#L16-L48 | train | python | Find the common prefix of two or more paths.
::
>>> import pathlib
>>> one = pathlib.Path('foo/bar/baz')
>>> two = pathlib.Path('foo/quux/biz')
>>> three = pathlib.Path('foo/quux/wuux')
::
>>> import uqbar.io
>>> str(uqbar.io.find_common_prefix([one, two, thre... | def find_common_prefix(
paths: Sequence[Union[str, pathlib.Path]]
) -> Optional[pathlib.Path]:
"""
Find the common prefix of two or more paths.
::
>>> import pathlib
>>> one = pathlib.Path('foo/bar/baz')
>>> two = pathlib.Path('foo/quux/biz')
>>> three = pathlib.Path('f... | Find the common prefix of two or more paths.
::
>>> import pathlib
>>> one = pathlib.Path('foo/bar/baz')
>>> two = pathlib.Path('foo/quux/biz')
>>> three = pathlib.Path('foo/quux/wuux')
::
>>> import uqbar.io
>>> str(uqbar.io.find_common_prefix([one, two, thre... | 307 | 374 | 884 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | eedb4b23e277b0c867f7afea4365f07bd38992d485ee14e3b46392806bbe872e | MIT | permissive | https://github.com/supriya-project/uqbar/blob/main/LICENSE |
442a69436244a2c2e5105330 | josiah-wolf-oberholtzer/uqbar | uqbar/io/__init__.py | find_executable | https://github.com/josiah-wolf-oberholtzer/uqbar/blob/eca7fefebbbee1e2ae13bf5d6baa838be66b1db6/uqbar/io/__init__.py#L51-L71 | train | python | r"""Finds executable `name`.
Similar to Unix ``which`` command.
Returns list of zero or more full paths to `name`. | def find_executable(name: str, flags=os.X_OK) -> List[str]:
r"""Finds executable `name`.
Similar to Unix ``which`` command.
Returns list of zero or more full paths to `name`.
"""
result = []
extensions = [x for x in os.environ.get("PATHEXT", "").split(os.pathsep) if x]
path = os.environ.ge... | r"""Finds executable `name`.
Similar to Unix ``which`` command.
Returns list of zero or more full paths to `name`.
def find_executable(name: str, flags=os.X_OK) -> List[str]:
r"""Finds executable `name`.
Similar to Unix ``which`` command.
Returns list of zero or more full paths to `name`.
"... | 200 | 124 | 739 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 3997b63bd263a1704f6b03269dc48a0c6454d53ad04f1bb3bc3b6448a1cc6030 | MIT | permissive | https://github.com/supriya-project/uqbar/blob/main/LICENSE |
5ed8907fa08088af8c6e4fe5 | josiah-wolf-oberholtzer/uqbar | uqbar/io/__init__.py | relative_to | https://github.com/josiah-wolf-oberholtzer/uqbar/blob/eca7fefebbbee1e2ae13bf5d6baa838be66b1db6/uqbar/io/__init__.py#L74-L114 | train | python | Generates relative path from ``source_path`` to ``target_path``.
Handles the case of paths without a common prefix.
::
>>> import pathlib
>>> source = pathlib.Path('foo/bar/baz')
>>> target = pathlib.Path('foo/quux/biz')
::
>>> target.relative_to(source)
Tracebac... | def relative_to(
source_path: Union[str, pathlib.Path], target_path: Union[str, pathlib.Path]
) -> pathlib.Path:
"""
Generates relative path from ``source_path`` to ``target_path``.
Handles the case of paths without a common prefix.
::
>>> import pathlib
>>> source = pathlib.Path(... | Generates relative path from ``source_path`` to ``target_path``.
Handles the case of paths without a common prefix.
::
>>> import pathlib
>>> source = pathlib.Path('foo/bar/baz')
>>> target = pathlib.Path('foo/quux/biz')
::
>>> target.relative_to(source)
Tracebac... | 442 | 626 | 1,288 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 7e168b66e2fc77668b1036c035c43c128f49d29be6ba6da79e74f7c016dfc333 | MIT | permissive | https://github.com/supriya-project/uqbar/blob/main/LICENSE |
8389d27ae9cceba07629ca3f | josiah-wolf-oberholtzer/uqbar | uqbar/io/__init__.py | walk | https://github.com/josiah-wolf-oberholtzer/uqbar/blob/eca7fefebbbee1e2ae13bf5d6baa838be66b1db6/uqbar/io/__init__.py#L117-L143 | train | python | Walks a directory tree.
Like :py:func:`os.walk` but yielding instances of :py:class:`pathlib.Path`
instead of strings.
:param root_path: foo
:param top_down: bar | def walk(
root_path: Union[str, pathlib.Path], top_down: bool = True
) -> Generator[
Tuple[pathlib.Path, Sequence[pathlib.Path], Sequence[pathlib.Path]], None, None
]:
"""
Walks a directory tree.
Like :py:func:`os.walk` but yielding instances of :py:class:`pathlib.Path`
instead of strings.
... | Walks a directory tree.
Like :py:func:`os.walk` but yielding instances of :py:class:`pathlib.Path`
instead of strings.
:param root_path: foo
:param top_down: bar
def walk(
root_path: Union[str, pathlib.Path], top_down: bool = True
) -> Generator[
Tuple[pathlib.Path, Sequence[pathlib.Path], Se... | 249 | 179 | 864 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 9ba9014d6aa2dea6f3a3eb46b068ec926200b76dab69e40fdb6d6f393d170224 | MIT | permissive | https://github.com/supriya-project/uqbar/blob/main/LICENSE |
19732ec6d58a952c0bf566c1 | josiah-wolf-oberholtzer/uqbar | uqbar/io/__init__.py | write | https://github.com/josiah-wolf-oberholtzer/uqbar/blob/eca7fefebbbee1e2ae13bf5d6baa838be66b1db6/uqbar/io/__init__.py#L146-L186 | train | python | Writes ``contents`` to ``path``.
Checks if ``path`` already exists and only write out new contents if the
old contents do not match.
Creates any intermediate missing directories.
:param contents: the file contents to write
:param path: the path to write to
:param verbose: whether to print out... | def write(
contents: str,
path: Union[str, pathlib.Path],
verbose: bool = False,
logger_func=None,
) -> bool:
"""
Writes ``contents`` to ``path``.
Checks if ``path`` already exists and only write out new contents if the
old contents do not match.
Creates any intermediate missing di... | Writes ``contents`` to ``path``.
Checks if ``path`` already exists and only write out new contents if the
old contents do not match.
Creates any intermediate missing directories.
:param contents: the file contents to write
:param path: the path to write to
:param verbose: whether to print out... | 340 | 323 | 1,282 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 102858bc48d04dd16961e767827b5cc7b4dcfd8e577c8074326814f762528c67 | MIT | permissive | https://github.com/supriya-project/uqbar/blob/main/LICENSE |
61295b246099b7bdf97842a6 | MatterMiners/cobald | cobald/daemon/debug.py | pretty_ref | https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/debug.py#L8-L13 | train | python | Pretty object reference using ``module.path:qual.name`` format | def pretty_ref(obj: Any) -> str:
"""Pretty object reference using ``module.path:qual.name`` format"""
try:
return obj.__module__ + ':' + obj.__qualname__
except AttributeError:
return pretty_ref(type(obj)) + '(...)' | Pretty object reference using ``module.path:qual.name`` format
def pretty_ref(obj: Any) -> str:
"""Pretty object reference using ``module.path:qual.name`` format"""
try:
return obj.__module__ + ':' + obj.__qualname__
except AttributeError:
return pretty_ref(type(obj)) + '(...)' | 70 | 62 | 243 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 095748f3911b73e9cf7f0b9dfce29ca71cd9a5eedb7140463ace886b4fa1209e | MIT | permissive | https://github.com/MatterMiners/cobald/blob/master/LICENSE |
49a7ce9e218743819eeda427 | quantmind/agile-toolkit | agiletoolkit/github/remote.py | remote | https://github.com/quantmind/agile-toolkit/blob/96028e36a842c57b171907c20583a60d1045fec1/agiletoolkit/github/remote.py#L9-L14 | train | python | Display repo github path | def remote(ctx):
"""Display repo github path
"""
with command():
m = RepoManager(ctx.obj['agile'])
click.echo(m.github_repo().repo_path) | Display repo github path
def remote(ctx):
"""Display repo github path
"""
with command():
m = RepoManager(ctx.obj['agile'])
click.echo(m.github_repo().repo_path) | 43 | 24 | 164 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | c8064ec3533806e61c8aa41300d658ebf571b9857dc7a08f6cdc776bc4deb6ba | BSD-3-Clause | permissive | https://github.com/quantmind/agile-toolkit/blob/master/LICENSE |
766ad2e46cc0334698f120c7 | josiah-wolf-oberholtzer/uqbar | uqbar/containers/UniqueTreeNode.py | UniqueTreeNode.graph_order | https://github.com/josiah-wolf-oberholtzer/uqbar/blob/eca7fefebbbee1e2ae13bf5d6baa838be66b1db6/uqbar/containers/UniqueTreeNode.py#L118-L154 | train | python | Get graph-order tuple for node.
::
>>> from uqbar.containers import UniqueTreeContainer, UniqueTreeNode
>>> root_container = UniqueTreeContainer(name="root")
>>> outer_container = UniqueTreeContainer(name="outer")
>>> inner_container = UniqueTreeContainer(name="... | def graph_order(self):
"""
Get graph-order tuple for node.
::
>>> from uqbar.containers import UniqueTreeContainer, UniqueTreeNode
>>> root_container = UniqueTreeContainer(name="root")
>>> outer_container = UniqueTreeContainer(name="outer")
>>> i... | Get graph-order tuple for node.
::
>>> from uqbar.containers import UniqueTreeContainer, UniqueTreeNode
>>> root_container = UniqueTreeContainer(name="root")
>>> outer_container = UniqueTreeContainer(name="outer")
>>> inner_container = UniqueTreeContainer(name="... | 499 | 993 | 1,305 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | b49abe24a812341b115ccbe4b496da3354008246b44cd9ff06a97f1da9f9706d | MIT | permissive | https://github.com/supriya-project/uqbar/blob/main/LICENSE |
c2b827143d2801e2e07bbc53 | quantmind/agile-toolkit | agiletoolkit/commands.py | start | https://github.com/quantmind/agile-toolkit/blob/96028e36a842c57b171907c20583a60d1045fec1/agiletoolkit/commands.py#L36-L50 | train | python | Commands for devops operations | def start(ctx, debug, version, config):
"""Commands for devops operations"""
ctx.obj = {}
ctx.DEBUG = debug
if os.path.isfile(config):
with open(config) as fp:
agile = json.load(fp)
else:
agile = {}
ctx.obj['agile'] = agile
if version:
click.echo(__version... | Commands for devops operations
def start(ctx, debug, version, config):
"""Commands for devops operations"""
ctx.obj = {}
ctx.DEBUG = debug
if os.path.isfile(config):
with open(config) as fp:
agile = json.load(fp)
else:
agile = {}
ctx.obj['agile'] = agile
if versi... | 106 | 30 | 413 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | f3f9b3d3af7b8ccf7581baa6e48145f3c7deb7f1b6a4c6fff981a3226a7c53b7 | BSD-3-Clause | permissive | https://github.com/quantmind/agile-toolkit/blob/master/LICENSE |
82024a44544e29b2868ae08f | developersociety/django-glitter | glitter/utils.py | duplicate | https://github.com/developersociety/django-glitter/blob/2c0280ec83afee80deee94ee3934fc54239c2e87/glitter/utils.py#L42-L98 | train | python | Duplicate all related objects of obj setting
field to value. If one of the duplicate
objects has an FK to another duplicate object
update that as well. Return the duplicate copy
of obj.
duplicate_order is a list of models which specify how
the duplicate objects are saved. For complex objects
... | def duplicate(obj, value=None, field=None, duplicate_order=None):
"""
Duplicate all related objects of obj setting
field to value. If one of the duplicate
objects has an FK to another duplicate object
update that as well. Return the duplicate copy
of obj.
duplicate_order is a list of models... | Duplicate all related objects of obj setting
field to value. If one of the duplicate
objects has an FK to another duplicate object
update that as well. Return the duplicate copy
of obj.
duplicate_order is a list of models which specify how
the duplicate objects are saved. For complex objects
... | 574 | 476 | 2,225 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 95705f99feeb08fae347e0c3e7e589424ad1e6c4eacf398b052df74b285a23a4 | BSD-3-Clause | permissive | https://github.com/developersociety/django-glitter/blob/master/LICENSE |
2020f46ecc5e54d4410042b4 | developersociety/django-glitter | glitter/blocks/video/validators.py | validate_url | https://github.com/developersociety/django-glitter/blob/2c0280ec83afee80deee94ee3934fc54239c2e87/glitter/blocks/video/validators.py#L45-L48 | train | python | Validate url. | def validate_url(value):
""" Validate url. """
if not re.match(VIMEO_URL_RE, value) and not re.match(YOUTUBE_URL_RE, value):
raise ValidationError('Invalid URL - only Youtube, Vimeo can be used.') | Validate url.
def validate_url(value):
""" Validate url. """
if not re.match(VIMEO_URL_RE, value) and not re.match(YOUTUBE_URL_RE, value):
raise ValidationError('Invalid URL - only Youtube, Vimeo can be used.') | 54 | 13 | 212 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 2eaff43965c6fab2e8a0413b6a210c984f0c999935ed0a12edf1dec83c03a0fd | BSD-3-Clause | permissive | https://github.com/developersociety/django-glitter/blob/master/LICENSE |
eb166ae91c0c38b2829b5341 | jamescooke/flake8-aaa | src/flake8_aaa/checker.py | Checker.run | https://github.com/jamescooke/flake8-aaa/blob/29938b96845fe32ced4358ba66af3b3be2a37794/src/flake8_aaa/checker.py#L42-L54 | train | python | Yields:
tuple (line_number: int, offset: int, text: str, check: type) | def run(self) -> Generator[Tuple[int, int, str, type], None, None]:
"""
Yields:
tuple (line_number: int, offset: int, text: str, check: type)
"""
if is_test_file(self.filename):
self.load()
for func in self.all_funcs():
try:
... | Yields:
tuple (line_number: int, offset: int, text: str, check: type)
def run(self) -> Generator[Tuple[int, int, str, type], None, None]:
"""
Yields:
tuple (line_number: int, offset: int, text: str, check: type)
"""
if is_test_file(self.filename):
sel... | 134 | 81 | 544 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 0e06f861830c603af66c7413141f1b631ad59bf23b8ac278ba1595ff51788987 | MIT | permissive | https://github.com/jamescooke/flake8-aaa/blob/master/LICENSE |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.