Dataset Viewer
Auto-converted to Parquet Duplicate
name
stringlengths
1
152
class_name
stringlengths
1
51
class_bases
stringlengths
0
159
is_member
bool
2 classes
args
stringlengths
0
804
class_docstr
stringlengths
4
8.19k
class_docstr_tok
stringlengths
2
11.6k
docstr
stringlengths
0
11.4k
docstr_tok
stringlengths
2
13.4k
returns
stringlengths
0
260
code
stringlengths
21
52.4k
code_tok
stringlengths
33
92.8k
lstart
int64
1
1.75k
lend
int64
5
1.75k
raises
stringclasses
16 values
filename
stringlengths
5
66
file_path
stringlengths
12
161
imports
stringlengths
0
1.77k
total_objects
int64
15
15
num_classes
float64
1
7
num_imports
int64
0
14
num_functions
int64
0
15
num_all_bases
float64
0
9
num_methods
float64
1
14
num_bases
float64
1
7
label_desc
stringlengths
69
1.05k
label_desc_len
int64
69
1.05k
label_id
stringclasses
15 values
__index_level_0__
int64
468
2.35M
_fit_sklearn_model_with_active_run
global
null
false
pandas_df
null
null
null
null
mlflow
def _fit_sklearn_model_with_active_run(pandas_df): run_id = mlflow.active_run().info.run_id _fit_sklearn(pandas_df) return mlflow.get_run(run_id)
["def","_fit_sklearn_model_with_active_run","(","pandas_df",")",":","run_id","=","mlflow.active_run","(",")",".info.run_id","_fit_sklearn","(","pandas_df",")","return","mlflow.get_run","(","run_id",")"]
32
35
null
test_spark_datasource_autologging_crossframework.py
mlflow/tests/spark/autologging/datasource/test_spark_datasource_autologging_crossframework.py
import time import numpy import pytest from sklearn.linear_model import LinearRegression import mlflow import mlflow.spark from tests.spark.autologging.utils import _assert_spark_data_logged
15
null
7
8
null
null
null
Use image node_id 3 for calling a global function with example usage: _fit_sklearn_model_with_active_run(pandas_df) and returns: mlflow
135
node_id 3
1,357,874
test_super
TestGaussianNoise
unittest
true
self
A unittest class for testing the GaussianNoise postprocessor.
["A","unittest","class","for","testing","the","GaussianNoise","postprocessor","."]
null
null
null
def test_super(self): gan = GaussianNoise(scale=0.1) self.assertTrue(gan.is_fitted) self.assertFalse(gan._apply_fit) self.assertTrue(gan._apply_predict) gan.fit(preds=np.array([0.1, 0.2, 0.3]))
["def","test_super","(","self",")",":","gan","=","GaussianNoise","(","scale=0.1",")","self.assertTrue","(","gan.is_fitted",")","self.assertFalse","(","gan._apply_fit",")","self.assertTrue","(","gan._apply_predict",")","gan.fit","(","preds=np.array","(","[","0.1",",","0.2",",","0.3","]",")",")"]
104
109
null
test_gaussian_noise.py
adversarial-robustness-toolbox/tests/defences/test_gaussian_noise.py
import logging import unittest import numpy from art.defences.postprocessor import GaussianNoise from art.utils import load_dataset from tests.utils import master_seed, get_image_classifier_kr_tf, get_image_classifier_kr_tf_binary
15
1
6
0
1
7
1
Use image node_id 7 for calling the TestGaussianNoise obj's underlying member method code with example usage: obj.test_super() without return types
147
node_id 7
235,295
setUpClass
TestHighConfidence
unittest
true
cls
A unittest class for testing the HighConfidence postprocessor.
["A","unittest","class","for","testing","the","HighConfidence","postprocessor","."]
null
null
null
def setUpClass(cls): (x_train, y_train), (x_test, y_test), _, _ = load_dataset("mnist") cls.mnist = (x_train, y_train), (x_test, y_test)
["def","setUpClass","(","cls",")",":","(","x_train",",","y_train",")",",","(","x_test",",","y_test",")",",","_",",","_","=","load_dataset","(","``","mnist","''",")","cls.mnist","=","(","x_train",",","y_train",")",",","(","x_test",",","y_test",")"]
37
39
null
test_high_confidence.py
adversarial-robustness-toolbox/tests/defences/test_high_confidence.py
import logging import unittest import numpy from art.defences.postprocessor import HighConfidence from art.utils import load_dataset from tests.utils import master_seed, get_image_classifier_kr_tf, get_image_classifier_kr_tf_binary
15
1
6
0
1
7
1
Use image node_id 1 for calling the TestHighConfidence obj's underlying member method code with example usage: obj.setUpClass(cls) without return types
151
node_id 1
235,296
test_ThompsonSamplerInfeasible
ThompsonSamplerTest
TestCase
true
self
null
null
null
null
null
def test_ThompsonSamplerInfeasible(self) -> None: generator = ThompsonSampler(min_weight=0.9) generator.fit( # pyre-fixme[6]: For 1st param expected `List[List[List[Union[None, # bool, float, int, str]]]]` but got `List[List[List[int]]]`. Xs=self.Xs, # pyre-fixme[6]: For 2nd par...
["def","test_ThompsonSamplerInfeasible","(","self",")","-",">","None",":","generator","=","ThompsonSampler","(","min_weight=0.9",")","generator.fit","(","#","pyre-fixme","[","6","]",":","For","1st","param","expected","`","List","[","List","[","List","[","Union","[","None",",","#","bool",",","float",",","int",",","str",...
174
198
null
test_thompson.py
Ax/ax/models/tests/test_thompson.py
import numpy from ax.exceptions.model import ModelError from ax.models.discrete.thompson import ThompsonSampler from ax.utils.common.testutils import TestCase
15
1
4
0
1
9
1
Use image node_id 6 for calling the ThompsonSamplerTest obj's underlying member method code with example usage: obj.test_ThompsonSamplerInfeasible() without return types
169
node_id 6
9,540
_maybe_clause
global
null
false
clause
null
null
null
null
unknown
def _maybe_clause(clause: Optional[str]) -> Sequence[str]: return [clause] if clause is not None else []
["def","_maybe_clause","(","clause",":","Optional","[","str","]",")","-",">","Sequence","[","str","]",":","return","[","clause","]","if","clause","is","not","None","else","[","]"]
40
41
null
store_ext.py
tfx/tfx/orchestration/portable/mlmd/store_ext.py
import collections import itertools from typing import Callable, Mapping, Optional, Sequence, Union from tfx.dsl.compiler import compiler_utils from tfx.dsl.compiler import constants from tfx.orchestration.experimental.core import constants from tfx.orchestration.portable.mlmd import event_lib from tfx.orchestration.po...
15
null
9
6
null
null
null
Use image node_id 2 for calling a global function with example usage: _maybe_clause(clause) and returns: unknown
112
node_id 2
2,198,856
__init__
EventSievesConfiguration
SievesConfiguration
true
self
null
null
null
null
EventSievesConfiguration
def __init__(self): super(EventSievesConfiguration, self).__init__() self.run_evaluation = True self.sieves_order = [ (RelationType.SAME_HEAD_LEMMA, 1.0), (RelationType.EXACT_STRING, 1.0), (RelationType.WIKIPEDIA_DISAMBIGUATION, 0.1), (RelationType.WORD_EMBEDDING_MATCH, 0.7...
["def","__init__","(","self",")",":","super","(","EventSievesConfiguration",",","self",")",".__init__","(",")","self.run_evaluation","=","True","self.sieves_order","=","[","(","RelationType.SAME_HEAD_LEMMA",",","1.0",")",",","(","RelationType.EXACT_STRING",",","1.0",")",",","(","RelationType.WIKIPEDIA_DISAMBIGUATION","...
59
78
null
sieves_config.py
nlp-architect/nlp_architect/models/cross_doc_coref/sieves_config.py
from typing import List, Tuple from nlp_architect.data.cdc_resources.relations.relation_types_enums import RelationType
15
3
2
0
3
1
1
Use image node_id 1 to create a new EventSievesConfiguration object from inherited base classes: SievesConfiguration with example: obj = EventSievesConfiguration()
163
node_id 1
1,443,098
simple_segmentation_example
global
null
false
null
null
null
null
null
def simple_segmentation_example(): "Perfect results!" parameters = legion_parameters() parameters.eps = 0.02 parameters.alpha = 0.005 parameters.betta = 0.1 parameters.gamma = 7.0 parameters.teta = 0.9 parameters.lamda = 0.1 parameters.teta_x = -0.5 parameters.teta_p = 7.0 pa...
["def","simple_segmentation_example","(",")",":","``","Perfect","results","!","''","parameters","=","legion_parameters","(",")","parameters.eps","=","0.02","parameters.alpha","=","0.005","parameters.betta","=","0.1","parameters.gamma","=","7.0","parameters.teta","=","0.9","parameters.lamda","=","0.1","parameters.teta_x...
94
126
null
legion_examples.py
pyclustering/pyclustering/nnet/examples/legion_examples.py
from pyclustering.utils import draw_dynamics from pyclustering.nnet.legion import legion_network, legion_parameters from pyclustering.nnet import *
15
null
3
12
null
null
null
Use image node_id 12 for calling a global function with example usage: simple_segmentation_example() without return types
121
node_id 12
1,634,375
forward
ConstantGate
torch.nn
true
self,inp
null
null
null
null
idx, score
def forward(self, inp): idx = torch.zeros( (inp.shape[0], self.top_k), dtype=torch.int64, device=inp.device, ) score = ( torch.ones((inp.shape[0], 1, self.top_k), device=inp.device) / 2 ) return idx, score
["def","forward","(","self",",","inp",")",":","idx","=","torch.zeros","(","(","inp.shape","[","0","]",",","self.top_k",")",",","dtype=torch.int64",",","device=inp.device",",",")","score","=","(","torch.ones","(","(","inp.shape","[","0","]",",","1",",","self.top_k",")",",","device=inp.device",")","\/","2",")","return","...
16
20
null
test_zero.py
thu-pacman-faster-moe/tests/test_zero.py
import os import sys import json import torch from fmoe.layers import _fmoe_general_global_forward from fmoe import FMoETransformerMLP from test_ddp import _run_distributed
15
1
7
4
1
2
1
Use image node_id 2 for calling the ConstantGate obj's underlying member method code with example usage: obj.forward(inp) and returns: idx, score
146
node_id 2
2,201,994
__init__
ConstantGate
torch.nn
true
self,d_model,num_expert,world_size,top_k
null
null
null
null
ConstantGate
def __init__(self, d_model, num_expert, world_size, top_k=1): super().__init__() self.top_k = top_k
["def","__init__","(","self",",","d_model",",","num_expert",",","world_size",",","top_k=1",")",":","super","(",")",".__init__","(",")","self.top_k","=","top_k"]
12
14
null
test_zero.py
thu-pacman-faster-moe/tests/test_zero.py
import os import sys import json import torch from fmoe.layers import _fmoe_general_global_forward from fmoe import FMoETransformerMLP from test_ddp import _run_distributed
15
1
7
4
1
2
1
Use image node_id 1 to create a new ConstantGate object from inherited base classes: torch.nn with example: obj = ConstantGate(d_model, num_expert, world_size, top_k)
166
node_id 1
2,201,993
test_GetLastPoint
RandomModelTest
TestCase
true
self
null
null
null
null
null
def test_GetLastPoint(self) -> None: generated_points = np.array([[1, 2, 3], [4, 5, 6]]) RandomModelWithPoints = RandomModel( generated_points=generated_points ) result = RandomModelWithPoints._get_last_point() expected = torch.tensor([[4], [5], [6]]) comparison = result == expected ...
["def","test_GetLastPoint","(","self",")","-",">","None",":","generated_points","=","np.array","(","[","[","1",",","2",",","3","]",",","[","4",",","5",",","6","]","]",")","RandomModelWithPoints","=","RandomModel","(","generated_points=generated_points",")","result","=","RandomModelWithPoints._get_last_point","(",")","e...
74
81
null
test_random.py
Ax/ax/models/tests/test_random.py
import numpy import torch from ax.models.random.base import RandomModel from ax.utils.common.testutils import TestCase from ax.utils.common.typeutils import not_none
15
1
5
0
1
8
1
Use image node_id 8 for calling the RandomModelTest obj's underlying member method code with example usage: obj.test_GetLastPoint() without return types
152
node_id 8
9,517
get_config
global
null
false
null
null
null
null
config, args
def get_config(): parser = argparse.ArgumentParser( "Global Config Argument Parser", allow_abbrev=False ) parser.add_argument( "--config_yaml", required=True, type=str, help="the configuration file for this experiment.", ) parser.add_argument( "--resum...
["def","get_config","(",")",":","parser","=","argparse.ArgumentParser","(","``","Global","Config","Argument","Parser","''",",","allow_abbrev=False",")","parser.add_argument","(","``","--","config_yaml","''",",","required=True",",","type=str",",","help=","''","the","configuration","file","for","this","experiment",".","`...
123
138
null
config.py
OpenPrompt/openprompt/config.py
import argparse from yacs.config import CfgNode import sys from openprompt.utils.utils import check_config_conflicts from .default_config import get_default_config from openprompt.utils.logging import logger import os
15
null
7
8
null
null
null
Use image node_id 8 for calling a global function with example usage: get_config() and returns: config, args
109
node_id 8
152,524
save_config_to_yaml
global
null
false
config
null
null
null
null
null
def save_config_to_yaml(config): from contextlib import redirect_stdout saved_yaml_path = os.path.join(config.logging.path, "config.yaml") with open(saved_yaml_path, "w") as f: with redirect_stdout(f): print(config.dump()) logger.info("Config saved as {}".format(saved_yaml_path))
["def","save_config_to_yaml","(","config",")",":","from","contextlib","import","redirect_stdout","saved_yaml_path","=","os.path.join","(","config.logging.path",",","``","config.yaml","''",")","with","open","(","saved_yaml_path",",","``","w","''",")","as","f",":","with","redirect_stdout","(","f",")",":","print","(","con...
116
121
null
config.py
OpenPrompt/openprompt/config.py
import argparse from yacs.config import CfgNode import sys from openprompt.utils.utils import check_config_conflicts from .default_config import get_default_config from openprompt.utils.logging import logger import os
15
null
7
8
null
null
null
Use image node_id 7 for calling a global function with example usage: save_config_to_yaml(config) without return types
118
node_id 7
152,523
update_cfg_with_argparser
global
null
false
cfg,args,prefix
null
null
null
null
null
def update_cfg_with_argparser(cfg, args, prefix=None): r"""To support update cfg with command line""" for key in cfg: value = cfg[key] full_key_name = ( prefix + "." + key if prefix is not None else key ) if isinstance(value, CfgNode): update_cfg_with_argp...
["def","update_cfg_with_argparser","(","cfg",",","args",",","prefix=None",")",":","r","''","''","''","To","support","update","cfg","with","command","line","''","''","''","for","key","in","cfg",":","value","=","cfg","[","key","]","full_key_name","=","(","prefix","+","``",".","''","+","key","if","prefix","is","not","None...
99
113
null
config.py
OpenPrompt/openprompt/config.py
import argparse from yacs.config import CfgNode import sys from openprompt.utils.utils import check_config_conflicts from .default_config import get_default_config from openprompt.utils.logging import logger import os
15
null
7
8
null
null
null
Use image node_id 6 for calling a global function with example usage: update_cfg_with_argparser(cfg, args, prefix) without return types
135
node_id 6
152,522
test_ConvertBounds
RandomModelTest
TestCase
true
self
null
null
null
null
null
def test_ConvertBounds(self) -> None: bounds = [(1.0, 2.0), (3.0, 4.0), (5.0, 6.0)] bounds_result = self.random_model._convert_bounds(bounds) bounds_expected = torch.tensor( [[1, 3, 5], [2, 4, 6]], dtype=torch.double ) bounds_comparison = bounds_result == bounds_expected # pyre-fixme[16]...
["def","test_ConvertBounds","(","self",")","-",">","None",":","bounds","=","[","(","1.0",",","2.0",")",",","(","3.0",",","4.0",")",",","(","5.0",",","6.0",")","]","bounds_result","=","self.random_model._convert_bounds","(","bounds",")","bounds_expected","=","torch.tensor","(","[","[","1",",","3",",","5","]",",","[","2"...
63
72
null
test_random.py
Ax/ax/models/tests/test_random.py
import numpy import torch from ax.models.random.base import RandomModel from ax.utils.common.testutils import TestCase from ax.utils.common.typeutils import not_none
15
1
5
0
1
8
1
Use image node_id 7 for calling the RandomModelTest obj's underlying member method code with example usage: obj.test_ConvertBounds() without return types
153
node_id 7
9,516
test_ConvertInequalityConstraints
RandomModelTest
TestCase
true
self
null
null
null
null
null
def test_ConvertInequalityConstraints(self) -> None: A = np.array([[1, 2], [3, 4]]) b = np.array([[5], [6]]) A_result, b_result = not_none( self.random_model._convert_inequality_constraints((A, b)) ) A_expected = torch.tensor([[1, 2], [3, 4]], dtype=torch.double) b_expected = torch.tenso...
["def","test_ConvertInequalityConstraints","(","self",")","-",">","None",":","A","=","np.array","(","[","[","1",",","2","]",",","[","3",",","4","]","]",")","b","=","np.array","(","[","[","5","]",",","[","6","]","]",")","A_result",",","b_result","=","not_none","(","self.random_model._convert_inequality_constraints","(",...
49
61
null
test_random.py
Ax/ax/models/tests/test_random.py
import numpy import torch from ax.models.random.base import RandomModel from ax.utils.common.testutils import TestCase from ax.utils.common.typeutils import not_none
15
1
5
0
1
8
1
Use image node_id 6 for calling the RandomModelTest obj's underlying member method code with example usage: obj.test_ConvertInequalityConstraints() without return types
168
node_id 6
9,515
test_ConvertEqualityConstraints
RandomModelTest
TestCase
true
self
null
null
null
null
null
def test_ConvertEqualityConstraints(self) -> None: fixed_features = {3: 0.7, 1: 0.5} d = 4 C, c = not_none( self.random_model._convert_equality_constraints( d, fixed_features ) ) c_expected = torch.tensor([[0.5], [0.7]], dtype=torch.double) C_expected = torch.tensor( ...
["def","test_ConvertEqualityConstraints","(","self",")","-",">","None",":","fixed_features","=","{","3",":","0.7",",","1",":","0.5","}","d","=","4","C",",","c","=","not_none","(","self.random_model._convert_equality_constraints","(","d",",","fixed_features",")",")","c_expected","=","torch.tensor","(","[","[","0.5","]",...
35
47
null
test_random.py
Ax/ax/models/tests/test_random.py
import numpy import torch from ax.models.random.base import RandomModel from ax.utils.common.testutils import TestCase from ax.utils.common.typeutils import not_none
15
1
5
0
1
8
1
Use image node_id 5 for calling the RandomModelTest obj's underlying member method code with example usage: obj.test_ConvertEqualityConstraints() without return types
166
node_id 5
9,514
add_cfg_to_argparser
global
null
false
cfg,parser,prefix
null
null
null
null
null
def add_cfg_to_argparser(cfg, parser, prefix=None): r"""To support argument parser style in addition to yaml style""" for key in cfg: value = cfg[key] full_key_name = ( prefix + "." + key if prefix is not None else key ) if isinstance(value, CfgNode): add_...
["def","add_cfg_to_argparser","(","cfg",",","parser",",","prefix=None",")",":","r","''","''","''","To","support","argument","parser","style","in","addition","to","yaml","style","''","''","''","for","key","in","cfg",":","value","=","cfg","[","key","]","full_key_name","=","(","prefix","+","``",".","''","+","key","if","pr...
78
96
null
config.py
OpenPrompt/openprompt/config.py
import argparse from yacs.config import CfgNode import sys from openprompt.utils.utils import check_config_conflicts from .default_config import get_default_config from openprompt.utils.logging import logger import os
15
null
7
8
null
null
null
Use image node_id 5 for calling a global function with example usage: add_cfg_to_argparser(cfg, parser, prefix) without return types
132
node_id 5
152,521
_get_node_live_artifacts
global
null
false
store
null
null
null
null
store
def _get_node_live_artifacts( store: mlmd.MetadataStore, *, pipeline_id: str, node_id: str, pipeline_run_id: Optional[str] = None, ) -> Sequence[mlmd.proto.Artifact]: """Gets all LIVE node artifacts. Args: store: A MetadataStore object. pipeline_id: The pipeline ID. node_i...
["def","_get_node_live_artifacts","(","store",":","mlmd.MetadataStore",",","*",",","pipeline_id",":","str",",","node_id",":","str",",","pipeline_run_id",":","Optional","[","str","]","=","None",",",")","-",">","Sequence","[","mlmd.proto.Artifact","]",":","``","''","''","Gets","all","LIVE","node","artifacts",".","Args","...
44
87
null
store_ext.py
tfx/tfx/orchestration/portable/mlmd/store_ext.py
import collections import itertools from typing import Callable, Mapping, Optional, Sequence, Union from tfx.dsl.compiler import compiler_utils from tfx.dsl.compiler import constants from tfx.orchestration.experimental.core import constants from tfx.orchestration.portable.mlmd import event_lib from tfx.orchestration.po...
15
null
9
6
null
null
null
Use image node_id 3 for calling a global function with example usage: _get_node_live_artifacts(store) and returns: store
120
node_id 3
2,198,857
get_node_executions
global
null
false
store
null
null
null
null
store
def get_node_executions( store: mlmd.MetadataStore, *, pipeline_id: str, node_id: str, pipeline_run_id: Optional[str] = None, order_by: mlmd.OrderByField = mlmd.OrderByField.ID, is_asc: bool = True, execution_states: Optional[ Sequence["mlmd.proto.Execution.State"] ] = None, ...
["def","get_node_executions","(","store",":","mlmd.MetadataStore",",","*",",","pipeline_id",":","str",",","node_id",":","str",",","pipeline_run_id",":","Optional","[","str","]","=","None",",","order_by",":","mlmd.OrderByField","=","mlmd.OrderByField.ID",",","is_asc",":","bool","=","True",",","execution_states",":","Opt...
90
154
null
store_ext.py
tfx/tfx/orchestration/portable/mlmd/store_ext.py
import collections import itertools from typing import Callable, Mapping, Optional, Sequence, Union from tfx.dsl.compiler import compiler_utils from tfx.dsl.compiler import constants from tfx.orchestration.experimental.core import constants from tfx.orchestration.portable.mlmd import event_lib from tfx.orchestration.po...
15
null
9
6
null
null
null
Use image node_id 4 for calling a global function with example usage: get_node_executions(store) and returns: store
115
node_id 4
2,198,858
__init__
Distribution
object
true
self,generator
Sampling distribution for mystic optimizers
["Sampling","distribution","for","mystic","optimizers"]
generate a sampling distribution with interface dist(size=None) input:: - generator: a 'distribution' method from scipy.stats or numpy.random - rng: a mystic.random_state object [default: random_state('numpy.random')] - args: positional arguments for the distribtution object - kwds: keyword arguments f...
["generate","a","sampling","distribution","with","interface","dist","(","size=None",")","input",":",":","-","generator",":","a","'distribution","'","method","from","scipy.stats","or","numpy.random","-","rng",":","a","mystic.random_state","object","[","default",":","random_state","(","'numpy.random","'",")","]","-","arg...
Distribution
def __init__(self, generator=None, *args, **kwds): """ generate a sampling distribution with interface dist(size=None) input:: - generator: a 'distribution' method from scipy.stats or numpy.random - rng: a mystic.random_state object [default: random_state('numpy.random')] - args: po...
["def","__init__","(","self",",","generator=None",",","*","args",",","*","*","kwds",")",":","``","''","''","generate","a","sampling","distribution","with","interface","dist","(","size=None",")","input",":",":","-","generator",":","a","'distribution","'","method","from","scipy.stats","or","numpy.random","-","rng",":","a...
55
144
null
__init__.py
mystic/mystic/math/__init__.py
from .poly import polyeval, poly1d from .grid import gridpts, samplepts, fillpts from .approx import almostEqual, tolerance from .approx import approx_equal from .None import discrete from .None import distance
15
1
6
0
1
7
1
Use image node_id 1 to create a new Distribution object from inherited base classes: object with example: obj = Distribution(generator)
135
node_id 1
1,406,721
__call__
Distribution
object
true
self,size
Sampling distribution for mystic optimizers
["Sampling","distribution","for","mystic","optimizers"]
generate a sample of given size (tuple) from the distribution
["generate","a","sample","of","given","size","(","tuple",")","from","the","distribution"]
unknown
def __call__(self, size=None): """generate a sample of given size (tuple) from the distribution""" return self.norm * self.rvs(size)
["def","__call__","(","self",",","size=None",")",":","``","''","''","generate","a","sample","of","given","size","(","tuple",")","from","the","distribution","''","''","''","return","self.norm","*","self.rvs","(","size",")"]
145
147
null
__init__.py
mystic/mystic/math/__init__.py
from .poly import polyeval, poly1d from .grid import gridpts, samplepts, fillpts from .approx import almostEqual, tolerance from .approx import approx_equal from .None import discrete from .None import distance
15
1
6
0
1
7
1
Use image node_id 2 for calling the Distribution obj's underlying member method code with example usage: obj.__call__(size) and returns: unknown
144
node_id 2
1,406,722
__repr__
Distribution
object
true
self
Sampling distribution for mystic optimizers
["Sampling","distribution","for","mystic","optimizers"]
null
null
self
def __repr__(self): return self.repr(self.__class__.__name__, self.norm)
["def","__repr__","(","self",")",":","return","self.repr","(","self.__class__.__name__",",","self.norm",")"]
148
149
null
__init__.py
mystic/mystic/math/__init__.py
from .poly import polyeval, poly1d from .grid import gridpts, samplepts, fillpts from .approx import almostEqual, tolerance from .approx import approx_equal from .None import discrete from .None import distance
15
1
6
0
1
7
1
Use image node_id 3 for calling the Distribution obj's underlying member method code with example usage: obj.__repr__() and returns: self
137
node_id 3
1,406,723
__add__
Distribution
object
true
self,dist
Sampling distribution for mystic optimizers
["Sampling","distribution","for","mystic","optimizers"]
null
null
new
def __add__(self, dist): if not isinstance(dist, Distribution): msg = "unsupported operand type(s) for +: '{0}' and '{1}'".format( self.__class__.__name__, type(dist) ) raise TypeError(msg) # add data from multiple distributions new = Distribution() first = "{0}".form...
["def","__add__","(","self",",","dist",")",":","if","not","isinstance","(","dist",",","Distribution",")",":","msg","=","``","unsupported","operand","type","(","s",")","for","+",":","'","{","0","}","'","and","'","{","1","}","'","''",".format","(","self.__class__.__name__",",","type","(","dist",")",")","raise","TypeError...
150
164
null
__init__.py
mystic/mystic/math/__init__.py
from .poly import polyeval, poly1d from .grid import gridpts, samplepts, fillpts from .approx import almostEqual, tolerance from .approx import approx_equal from .None import discrete from .None import distance
15
1
6
0
1
7
1
Use image node_id 4 for calling the Distribution obj's underlying member method code with example usage: obj.__add__(dist) and returns: new
139
node_id 4
1,406,724
convert_cfg_to_dict
global
null
false
cfg_node,key_list
null
null
null
null
cfg_node,cfg_dict
def convert_cfg_to_dict(cfg_node, key_list=[]): """Convert a config node to dictionary""" if not isinstance(cfg_node, CfgNode): if type(cfg_node) not in _VALID_TYPES: print( "Key {} with value {} is not a valid type; valid types: {}".format( ".".join(key_l...
["def","convert_cfg_to_dict","(","cfg_node",",","key_list=","[","]",")",":","``","''","''","Convert","a","config","node","to","dictionary","''","''","''","if","not","isinstance","(","cfg_node",",","CfgNode",")",":","if","type","(","cfg_node",")","not","in","_VALID_TYPES",":","print","(","``","Key","{","}","with","value...
65
76
null
config.py
OpenPrompt/openprompt/config.py
import argparse from yacs.config import CfgNode import sys from openprompt.utils.utils import check_config_conflicts from .default_config import get_default_config from openprompt.utils.logging import logger import os
15
null
7
8
null
null
null
Use image node_id 4 for calling a global function with example usage: convert_cfg_to_dict(cfg_node, key_list) and returns: cfg_node, cfg_dict
141
node_id 4
152,520
get_live_output_artifacts_of_node_by_output_key
global
null
false
store
null
null
null
null
output_artifacts_by_output_key,dict,dict
def get_live_output_artifacts_of_node_by_output_key( store: mlmd.MetadataStore, *, pipeline_id: str, node_id: str, pipeline_run_id: Optional[str] = None, execution_states: Optional[ Sequence["mlmd.proto.Execution.State"] ] = None, ) -> Mapping[str, Sequence[Sequence[mlmd.proto.Artifa...
["def","get_live_output_artifacts_of_node_by_output_key","(","store",":","mlmd.MetadataStore",",","*",",","pipeline_id",":","str",",","node_id",":","str",",","pipeline_run_id",":","Optional","[","str","]","=","None",",","execution_states",":","Optional","[","Sequence","[","``","mlmd.proto.Execution.State","''","]","]",...
157
273
null
store_ext.py
tfx/tfx/orchestration/portable/mlmd/store_ext.py
import collections import itertools from typing import Callable, Mapping, Optional, Sequence, Union from tfx.dsl.compiler import compiler_utils from tfx.dsl.compiler import constants from tfx.orchestration.experimental.core import constants from tfx.orchestration.portable.mlmd import event_lib from tfx.orchestration.po...
15
null
9
6
null
null
null
Use image node_id 5 for calling a global function with example usage: get_live_output_artifacts_of_node_by_output_key(store) and returns: output_artifacts_by_output_key, dict, dict
180
node_id 5
2,198,859
test_zero_fwd
global
null
false
num_expert,batch_size,d_hidden,world_size
null
null
null
null
null
def test_zero_fwd( num_expert=2, batch_size=4, d_hidden=8, world_size=1 ): _run_distributed( "_test_zero_fwd", 1, { "num_expert": num_expert, "batch_size": batch_size, "d_hidden": d_hidden, }, script=__file__, )
["def","test_zero_fwd","(","num_expert=2",",","batch_size=4",",","d_hidden=8",",","world_size=1",")",":","_run_distributed","(","``","_test_zero_fwd","''",",","1",",","{","``","num_expert","''",":","num_expert",",","``","batch_size","''",":","batch_size",",","``","d_hidden","''",":","d_hidden",",","}",",","script=__fil...
23
32
null
test_zero.py
thu-pacman-faster-moe/tests/test_zero.py
import os import sys import json import torch from fmoe.layers import _fmoe_general_global_forward from fmoe import FMoETransformerMLP from test_ddp import _run_distributed
15
null
7
4
null
null
null
Use image node_id 1 for calling a global function with example usage: test_zero_fwd(num_expert, batch_size, d_hidden, world_size) without return types
150
node_id 1
2,201,995
_test_zero_fwd
global
null
false
num_expert,batch_size,d_hidden,world_size
null
null
null
null
null
def _test_zero_fwd( num_expert=2, batch_size=4, d_hidden=8, world_size=1 ): inp = torch.rand(batch_size, d_hidden).cuda() gate = torch.zeros(batch_size, dtype=torch.int64).cuda() x = _fmoe_general_global_forward( inp, gate, lambda x, y: x, num_expert, world_size )
["def","_test_zero_fwd","(","num_expert=2",",","batch_size=4",",","d_hidden=8",",","world_size=1",")",":","inp","=","torch.rand","(","batch_size",",","d_hidden",")",".cuda","(",")","gate","=","torch.zeros","(","batch_size",",","dtype=torch.int64",")",".cuda","(",")","x","=","_fmoe_general_global_forward","(","inp",",",...
34
38
null
test_zero.py
thu-pacman-faster-moe/tests/test_zero.py
import os import sys import json import torch from fmoe.layers import _fmoe_general_global_forward from fmoe import FMoETransformerMLP from test_ddp import _run_distributed
15
null
7
4
null
null
null
Use image node_id 2 for calling a global function with example usage: _test_zero_fwd(num_expert, batch_size, d_hidden, world_size) without return types
151
node_id 2
2,201,996
test_zero_transformer
global
null
false
num_expert,batch_size,d_hidden,world_size
null
null
null
null
null
def test_zero_transformer( num_expert=2, batch_size=4, d_hidden=8, world_size=1 ): _run_distributed( "_test_zero_transformer", 1, { "num_expert": num_expert, "batch_size": batch_size, "d_hidden": d_hidden, }, script=__file__, )
["def","test_zero_transformer","(","num_expert=2",",","batch_size=4",",","d_hidden=8",",","world_size=1",")",":","_run_distributed","(","``","_test_zero_transformer","''",",","1",",","{","``","num_expert","''",":","num_expert",",","``","batch_size","''",":","batch_size",",","``","d_hidden","''",":","d_hidden",",","}","...
41
50
null
test_zero.py
thu-pacman-faster-moe/tests/test_zero.py
import os import sys import json import torch from fmoe.layers import _fmoe_general_global_forward from fmoe import FMoETransformerMLP from test_ddp import _run_distributed
15
null
7
4
null
null
null
Use image node_id 3 for calling a global function with example usage: test_zero_transformer(num_expert, batch_size, d_hidden, world_size) without return types
158
node_id 3
2,201,997
_test_zero_transformer
global
null
false
num_expert,batch_size,d_hidden,world_size
null
null
null
null
null
def _test_zero_transformer( num_expert=2, batch_size=4, d_hidden=8, world_size=1 ): inp = torch.rand(batch_size, d_hidden).cuda() mask = torch.zeros(inp.shape[0], dtype=torch.long) mask[1] = 1 mask_dict = {1: torch.zeros(d_hidden).cuda()} model = FMoETransformerMLP( num_expert, d...
["def","_test_zero_transformer","(","num_expert=2",",","batch_size=4",",","d_hidden=8",",","world_size=1",")",":","inp","=","torch.rand","(","batch_size",",","d_hidden",")",".cuda","(",")","mask","=","torch.zeros","(","inp.shape","[","0","]",",","dtype=torch.long",")","mask","[","1","]","=","1","mask_dict","=","{","1",...
52
61
null
test_zero.py
thu-pacman-faster-moe/tests/test_zero.py
import os import sys import json import torch from fmoe.layers import _fmoe_general_global_forward from fmoe import FMoETransformerMLP from test_ddp import _run_distributed
15
null
7
4
null
null
null
Use image node_id 4 for calling a global function with example usage: _test_zero_transformer(num_expert, batch_size, d_hidden, world_size) without return types
159
node_id 4
2,201,998
setUp
TestHighConfidence
unittest
true
self
A unittest class for testing the HighConfidence postprocessor.
["A","unittest","class","for","testing","the","HighConfidence","postprocessor","."]
null
null
null
def setUp(self): master_seed(seed=1234)
["def","setUp","(","self",")",":","master_seed","(","seed=1234",")"]
41
42
null
test_high_confidence.py
adversarial-robustness-toolbox/tests/defences/test_high_confidence.py
import logging import unittest import numpy from art.defences.postprocessor import HighConfidence from art.utils import load_dataset from tests.utils import master_seed, get_image_classifier_kr_tf, get_image_classifier_kr_tf_binary
15
1
6
0
1
7
1
Use image node_id 2 for calling the TestHighConfidence obj's underlying member method code with example usage: obj.setUp() without return types
143
node_id 2
235,297
test_difference
TestIntervalIndex
null
true
self,closed,sort
null
null
null
null
null
def test_difference(self, closed, sort): index = IntervalIndex.from_arrays( [1, 0, 3, 2], [1, 2, 3, 4], closed=closed ) result = index.difference(index[:1], sort=sort) expected = index[1:] if sort is None: expected = expected.sort_values() tm.assert_index_equal(result, expected) ...
["def","test_difference","(","self",",","closed",",","sort",")",":","index","=","IntervalIndex.from_arrays","(","[","1",",","0",",","3",",","2","]",",","[","1",",","2",",","3",",","4","]",",","closed=closed",")","result","=","index.difference","(","index","[",":1","]",",","sort=sort",")","expected","=","index","[","1",...
131
149
null
test_setops.py
pandas/pandas/tests/indexes/interval/test_setops.py
import numpy import pytest from pandas import Index, IntervalIndex, Timestamp, interval_range import pandas._testing
15
1
4
2
0
8
null
Use image node_id 6 for calling the TestIntervalIndex obj's underlying member method code with example usage: obj.test_difference(closed, sort) without return types
164
node_id 6
1,514,638
test_ThompsonSamplerUniformWeights
ThompsonSamplerTest
TestCase
true
self
null
null
null
null
null
def test_ThompsonSamplerUniformWeights(self) -> None: generator = ThompsonSampler(min_weight=0.0, uniform_weights=True) generator.fit( # pyre-fixme[6]: For 1st param expected `List[List[List[Union[None, # bool, float, int, str]]]]` but got `List[List[List[int]]]`. Xs=self.Xs, # ...
["def","test_ThompsonSamplerUniformWeights","(","self",")","-",">","None",":","generator","=","ThompsonSampler","(","min_weight=0.0",",","uniform_weights=True",")","generator.fit","(","#","pyre-fixme","[","6","]",":","For","1st","param","expected","`","List","[","List","[","List","[","Union","[","None",",","#","bool","...
146
172
null
test_thompson.py
Ax/ax/models/tests/test_thompson.py
import numpy from ax.exceptions.model import ModelError from ax.models.discrete.thompson import ThompsonSampler from ax.utils.common.testutils import TestCase
15
1
4
0
1
9
1
Use image node_id 5 for calling the ThompsonSamplerTest obj's underlying member method code with example usage: obj.test_ThompsonSamplerUniformWeights() without return types
173
node_id 5
9,539
test_ThompsonSamplerMinWeight
ThompsonSamplerTest
TestCase
true
self
null
null
null
null
null
def test_ThompsonSamplerMinWeight(self) -> None: generator = ThompsonSampler(min_weight=0.01) generator.fit( # pyre-fixme[6]: For 1st param expected `List[List[List[Union[None, # bool, float, int, str]]]]` but got `List[List[List[int]]]`. Xs=self.Xs, # pyre-fixme[6]: For 2nd par...
["def","test_ThompsonSamplerMinWeight","(","self",")","-",">","None",":","generator","=","ThompsonSampler","(","min_weight=0.01",")","generator.fit","(","#","pyre-fixme","[","6","]",":","For","1st","param","expected","`","List","[","List","[","List","[","Union","[","None",",","#","bool",",","float",",","int",",","str",...
116
144
null
test_thompson.py
Ax/ax/models/tests/test_thompson.py
import numpy from ax.exceptions.model import ModelError from ax.models.discrete.thompson import ThompsonSampler from ax.utils.common.testutils import TestCase
15
1
4
0
1
9
1
Use image node_id 4 for calling the ThompsonSamplerTest obj's underlying member method code with example usage: obj.test_ThompsonSamplerMinWeight() without return types
168
node_id 4
9,538
test_ThompsonSamplerValidation
ThompsonSamplerTest
TestCase
true
self
null
null
null
null
null
def test_ThompsonSamplerValidation(self) -> None: generator = ThompsonSampler(min_weight=0.01) # all Xs are not the same with self.assertRaises(ValueError): generator.fit( Xs=[ [[1, 1], [2, 2], [3, 3], [4, 4]], [[1, 1], [2, 2], [4, 4]], ], ...
["def","test_ThompsonSamplerValidation","(","self",")","-",">","None",":","generator","=","ThompsonSampler","(","min_weight=0.01",")","#","all","Xs","are","not","the","same","with","self.assertRaises","(","ValueError",")",":","generator.fit","(","Xs=","[","[","[","1",",","1","]",",","[","2",",","2","]",",","[","3",",",...
60
114
null
test_thompson.py
Ax/ax/models/tests/test_thompson.py
import numpy from ax.exceptions.model import ModelError from ax.models.discrete.thompson import ThompsonSampler from ax.utils.common.testutils import TestCase
15
1
4
0
1
9
1
Use image node_id 3 for calling the ThompsonSamplerTest obj's underlying member method code with example usage: obj.test_ThompsonSamplerValidation() without return types
169
node_id 3
9,537
test_ThompsonSampler
ThompsonSamplerTest
TestCase
true
self
null
null
null
null
null
def test_ThompsonSampler(self) -> None: generator = ThompsonSampler(min_weight=0.0) generator.fit( # pyre-fixme[6]: For 1st param expected `List[List[List[Union[None, # bool, float, int, str]]]]` but got `List[List[List[int]]]`. Xs=self.Xs, # pyre-fixme[6]: For 2nd param expecte...
["def","test_ThompsonSampler","(","self",")","-",">","None",":","generator","=","ThompsonSampler","(","min_weight=0.0",")","generator.fit","(","#","pyre-fixme","[","6","]",":","For","1st","param","expected","`","List","[","List","[","List","[","Union","[","None",",","#","bool",",","float",",","int",",","str","]","]","]...
29
58
null
test_thompson.py
Ax/ax/models/tests/test_thompson.py
import numpy from ax.exceptions.model import ModelError from ax.models.discrete.thompson import ThompsonSampler from ax.utils.common.testutils import TestCase
15
1
4
0
1
9
1
Use image node_id 2 for calling the ThompsonSamplerTest obj's underlying member method code with example usage: obj.test_ThompsonSampler() without return types
159
node_id 2
9,536
setUp
ThompsonSamplerTest
TestCase
true
self
null
null
null
null
null
def setUp(self) -> None: self.Xs = [ [[1, 1], [2, 2], [3, 3], [4, 4]] ] # 4 arms, each of dimensionality 2 self.Ys = [[1, 2, 3, 4]] self.Yvars = [[1, 1, 1, 1]] self.parameter_values = [[1, 2, 3, 4], [1, 2, 3, 4]] self.outcome_names = ["x", "y"] # not used for regular TS self.multi...
["def","setUp","(","self",")","-",">","None",":","self.Xs","=","[","[","[","1",",","1","]",",","[","2",",","2","]",",","[","3",",","3","]",",","[","4",",","4","]","]","]","#","4","arms",",","each","of","dimensionality","2","self.Ys","=","[","[","1",",","2",",","3",",","4","]","]","self.Yvars","=","[","[","1",",","1",",...
15
27
null
test_thompson.py
Ax/ax/models/tests/test_thompson.py
import numpy from ax.exceptions.model import ModelError from ax.models.discrete.thompson import ThompsonSampler from ax.utils.common.testutils import TestCase
15
1
4
0
1
9
1
Use image node_id 1 for calling the ThompsonSamplerTest obj's underlying member method code with example usage: obj.setUp() without return types
144
node_id 1
9,535
test_decimals_0_1
TestHighConfidence
unittest
true
self
A unittest class for testing the HighConfidence postprocessor.
["A","unittest","class","for","testing","the","HighConfidence","postprocessor","."]
Test with cutoff of 0.1.
["Test","with","cutoff","of","0.1","."]
null
def test_decimals_0_1(self): """ Test with cutoff of 0.1. """ (_, _), (x_test, _) = self.mnist classifier = get_image_classifier_kr_tf() preds = classifier.predict(x_test[0:1]) postprocessor = HighConfidence(cutoff=0.1) post_preds = postprocessor(preds=preds) classifier_prediction_e...
["def","test_decimals_0_1","(","self",")",":","``","''","''","Test","with","cutoff","of","0.1.","``","''","''","(","_",",","_",")",",","(","x_test",",","_",")","=","self.mnist","classifier","=","get_image_classifier_kr_tf","(",")","preds","=","classifier.predict","(","x_test","[","0:1","]",")","postprocessor","=","High...
44
76
null
test_high_confidence.py
adversarial-robustness-toolbox/tests/defences/test_high_confidence.py
import logging import unittest import numpy from art.defences.postprocessor import HighConfidence from art.utils import load_dataset from tests.utils import master_seed, get_image_classifier_kr_tf, get_image_classifier_kr_tf_binary
15
1
6
0
1
7
1
Use image node_id 3 for calling the TestHighConfidence obj's underlying member method code with example usage: obj.test_decimals_0_1() without return types
155
node_id 3
235,298
test_decimals_0_2
TestHighConfidence
unittest
true
self
A unittest class for testing the HighConfidence postprocessor.
["A","unittest","class","for","testing","the","HighConfidence","postprocessor","."]
Test with cutoff of 0.2.
["Test","with","cutoff","of","0.2","."]
null
def test_decimals_0_2(self): """ Test with cutoff of 0.2. """ (_, _), (x_test, _) = self.mnist classifier = get_image_classifier_kr_tf() preds = classifier.predict(x_test[0:1]) postprocessor = HighConfidence(cutoff=0.2) post_preds = postprocessor(preds=preds) classifier_prediction_e...
["def","test_decimals_0_2","(","self",")",":","``","''","''","Test","with","cutoff","of","0.2.","``","''","''","(","_",",","_",")",",","(","x_test",",","_",")","=","self.mnist","classifier","=","get_image_classifier_kr_tf","(",")","preds","=","classifier.predict","(","x_test","[","0:1","]",")","postprocessor","=","High...
78
110
null
test_high_confidence.py
adversarial-robustness-toolbox/tests/defences/test_high_confidence.py
import logging import unittest import numpy from art.defences.postprocessor import HighConfidence from art.utils import load_dataset from tests.utils import master_seed, get_image_classifier_kr_tf, get_image_classifier_kr_tf_binary
15
1
6
0
1
7
1
Use image node_id 4 for calling the TestHighConfidence obj's underlying member method code with example usage: obj.test_decimals_0_2() without return types
155
node_id 4
235,299
test_binary_decimals_0_5
TestHighConfidence
unittest
true
self
A unittest class for testing the HighConfidence postprocessor.
["A","unittest","class","for","testing","the","HighConfidence","postprocessor","."]
Test with cutoff of 0.5 for binary classifier.
["Test","with","cutoff","of","0.5","for","binary","classifier","."]
null
def test_binary_decimals_0_5(self): """ Test with cutoff of 0.5 for binary classifier. """ (_, _), (x_test, _) = self.mnist classifier = get_image_classifier_kr_tf_binary() preds = classifier.predict(x_test[0:1]) postprocessor = HighConfidence(cutoff=0.5) post_preds = postprocessor(preds...
["def","test_binary_decimals_0_5","(","self",")",":","``","''","''","Test","with","cutoff","of","0.5","for","binary","classifier.","``","''","''","(","_",",","_",")",",","(","x_test",",","_",")","=","self.mnist","classifier","=","get_image_classifier_kr_tf_binary","(",")","preds","=","classifier.predict","(","x_test","...
112
126
null
test_high_confidence.py
adversarial-robustness-toolbox/tests/defences/test_high_confidence.py
import logging import unittest import numpy from art.defences.postprocessor import HighConfidence from art.utils import load_dataset from tests.utils import master_seed, get_image_classifier_kr_tf, get_image_classifier_kr_tf_binary
15
1
6
0
1
7
1
Use image node_id 5 for calling the TestHighConfidence obj's underlying member method code with example usage: obj.test_binary_decimals_0_5() without return types
162
node_id 5
235,300
test_RandomModelGenSamples
RandomModelTest
TestCase
true
self
null
null
null
null
null
def test_RandomModelGenSamples(self) -> None: with self.assertRaises(NotImplementedError): self.random_model._gen_samples(n=1, tunable_d=1)
["def","test_RandomModelGenSamples","(","self",")","-",">","None",":","with","self.assertRaises","(","NotImplementedError",")",":","self.random_model._gen_samples","(","n=1",",","tunable_d=1",")"]
25
27
null
test_random.py
Ax/ax/models/tests/test_random.py
import numpy import torch from ax.models.random.base import RandomModel from ax.utils.common.testutils import TestCase from ax.utils.common.typeutils import not_none
15
1
5
0
1
8
1
Use image node_id 3 for calling the RandomModelTest obj's underlying member method code with example usage: obj.test_RandomModelGenSamples() without return types
161
node_id 3
9,512
test_binary_decimals_0_6
TestHighConfidence
unittest
true
self
A unittest class for testing the HighConfidence postprocessor.
["A","unittest","class","for","testing","the","HighConfidence","postprocessor","."]
Test with cutoff of 0.6 for binary classifier.
["Test","with","cutoff","of","0.6","for","binary","classifier","."]
null
def test_binary_decimals_0_6(self): """ Test with cutoff of 0.6 for binary classifier. """ (_, _), (x_test, _) = self.mnist classifier = get_image_classifier_kr_tf_binary() preds = classifier.predict(x_test[0:1]) postprocessor = HighConfidence(cutoff=0.6) post_preds = postprocessor(preds...
["def","test_binary_decimals_0_6","(","self",")",":","``","''","''","Test","with","cutoff","of","0.6","for","binary","classifier.","``","''","''","(","_",",","_",")",",","(","x_test",",","_",")","=","self.mnist","classifier","=","get_image_classifier_kr_tf_binary","(",")","preds","=","classifier.predict","(","x_test","...
128
142
null
test_high_confidence.py
adversarial-robustness-toolbox/tests/defences/test_high_confidence.py
import logging import unittest import numpy from art.defences.postprocessor import HighConfidence from art.utils import load_dataset from tests.utils import master_seed, get_image_classifier_kr_tf, get_image_classifier_kr_tf_binary
15
1
6
0
1
7
1
Use image node_id 6 for calling the TestHighConfidence obj's underlying member method code with example usage: obj.test_binary_decimals_0_6() without return types
162
node_id 6
235,301
convert
Converter
ImageConverter
true
self,_from,_to
null
null
Converts the image from SVG to PDF using chrome.
["Converts","the","image","from","SVG","to","PDF","using","chrome","."]
True
def convert(self, _from: str, _to: str) -> bool: """Converts the image from SVG to PDF using chrome.""" with open(_from, "r") as f: svg = f.read() HTML = ( "<html><head><style>body {margin: 0; }</style><script>function init() {const element = document.querySelector('svg');const positionInfo...
["def","convert","(","self",",","_from",":","str",",","_to",":","str",")","-",">","bool",":","``","''","''","Converts","the","image","from","SVG","to","PDF","using","chrome",".","''","''","''","with","open","(","_from",",","``","r","''",")","as","f",":","svg","=","f.read","(",")","HTML","=","(","``","<","html",">","<",...
71
89
null
convert-svg-to-pdf.py
sympy/doc/ext/convert-svg-to-pdf.py
from __future__ import annotations from sphinx.transforms.post_transforms.images import ImageConverter from sphinx.util import logging import os import platform from typing import Any from sphinx.application import Sphinx
15
1
7
1
1
5
1
Use image node_id 5 for calling the Converter obj's underlying member method code with example usage: obj.convert(_from, _to) and returns: True
143
node_id 5
2,029,278
_setup
RunnerTrafficMetricsMiddleware
null
true
self,metrics_client
null
null
null
null
null
def _setup( self, metrics_client: "PrometheusClient" = Provide[ BentoMLContainer.metrics_client ], ): self.metrics_client = metrics_client self.metrics_request_duration = metrics_client.Histogram( namespace=self.namespace, name="request_duration_seconds", documentati...
["def","_setup","(","self",",","metrics_client",":","``","PrometheusClient","''","=","Provide","[","BentoMLContainer.metrics_client","]",",",")",":","self.metrics_client","=","metrics_client","self.metrics_request_duration","=","metrics_client.Histogram","(","namespace=self.namespace",",","name=","''","request_duration...
150
187
null
instruments.py
BentoML/src/bentoml/_internal/server/http/instruments.py
from __future__ import annotations import contextvars import logging from timeit import default_timer from typing import TYPE_CHECKING from simple_di import Provide from simple_di import inject from ...configuration.containers import BentoMLContainer from ...context import component_context
15
2
9
0
0
2
null
Use image node_id 2 for calling the RunnerTrafficMetricsMiddleware obj's underlying member method code with example usage: obj._setup(metrics_client) without return types
170
node_id 2
14,515
command_runner
Converter
ImageConverter
true
self,chrome,_to,temp_name
null
null
null
null
os,int
def command_runner( self, chrome: str | None, _to: str, temp_name: str ) -> int: if not chrome: return 1 command = f"{chrome} --headless --disable-gpu --disable-software-rasterizer --print-to-pdf={_to} {temp_name}" logger.error(command) return os.system(command)
["def","command_runner","(","self",",","chrome",":","str","|","None",",","_to",":","str",",","temp_name",":","str",")","-",">","int",":","if","not","chrome",":","return","1","command","=","f","''","{","chrome","}","--","headless","--","disable-gpu","--","disable-software-rasterizer","--","print-to-pdf=","{","_to","}","...
64
69
null
convert-svg-to-pdf.py
sympy/doc/ext/convert-svg-to-pdf.py
from __future__ import annotations from sphinx.transforms.post_transforms.images import ImageConverter from sphinx.util import logging import os import platform from typing import Any from sphinx.application import Sphinx
15
1
7
1
1
5
1
Use image node_id 4 for calling the Converter obj's underlying member method code with example usage: obj.command_runner(chrome, _to, temp_name) and returns: os, int
165
node_id 4
2,029,277
chromium_command
Converter
ImageConverter
true
self
null
null
null
null
None,None,str,str,str+path+str,path,str
def chromium_command(self) -> str | None: if platform.win32_ver()[0]: if os.system("where chromium") == 0: return "chromium" path = os.path.join( os.environ["PROGRAMW6432"], "Chromium\\Application\\chrome.exe", ) if os.path.exists(path): ...
["def","chromium_command","(","self",")","-",">","str","|","None",":","if","platform.win32_ver","(",")","[","0","]",":","if","os.system","(","``","where","chromium","''",")","==","0",":","return","``","chromium","''","path","=","os.path.join","(","os.environ","[","``","PROGRAMW6432","''","]",",","``","Chromium\\\\Appli...
44
61
null
convert-svg-to-pdf.py
sympy/doc/ext/convert-svg-to-pdf.py
from __future__ import annotations from sphinx.transforms.post_transforms.images import ImageConverter from sphinx.util import logging import os import platform from typing import Any from sphinx.application import Sphinx
15
1
7
1
1
5
1
Use image node_id 3 for calling the Converter obj's underlying member method code with example usage: obj.chromium_command() and returns: None, None, str, str, str, path, str, path, str
185
node_id 3
2,029,276
_test_texture_as_input
TestShapeShifter
TestBase
true
self,sign_gradients,use_spectral,soft_clip
null
null
null
null
background, image_frame, y_,current_image
def _test_texture_as_input( self, sign_gradients, use_spectral, soft_clip ): # We must start a new graph tf.reset_default_graph() # Only import if object detection module is available from art.estimators.object_detection.tensorflow_faster_rcnn import ( TensorFlowFasterRCNN, ) from a...
["def","_test_texture_as_input","(","self",",","sign_gradients",",","use_spectral",",","soft_clip",")",":","#","We","must","start","a","new","graph","tf.reset_default_graph","(",")","#","Only","import","if","object","detection","module","is","available","from","art.estimators.object_detection.tensorflow_faster_rcnn","i...
139
235
null
test_shapeshifter.py
adversarial-robustness-toolbox/tests/attacks/test_shapeshifter.py
from __future__ import absolute_import, division, print_function, unicode_literals import logging import unittest import importlib import tensorflow import numpy from tests.utils import TestBase, master_seed
15
1
7
0
1
6
1
Use image node_id 5 for calling the TestShapeShifter obj's underlying member method code with example usage: obj._test_texture_as_input(sign_gradients, use_spectral, soft_clip) and returns: background, image_frame, y_, current_image
234
node_id 5
234,965
test_check_params
TestShapeShifter
TestBase
true
self
null
null
null
null
null
def test_check_params(self): from art.estimators.object_detection import TensorFlowFasterRCNN from art.attacks.evasion import ShapeShifter images = tf.Variable( initial_value=np.zeros([1, 28, 28, 1]), dtype=tf.float32 ) obj_dec = TensorFlowFasterRCNN(images=images) with self.assertRais...
["def","test_check_params","(","self",")",":","from","art.estimators.object_detection","import","TensorFlowFasterRCNN","from","art.attacks.evasion","import","ShapeShifter","images","=","tf.Variable","(","initial_value=np.zeros","(","[","1",",","28",",","28",",","1","]",")",",","dtype=tf.float32",")","obj_dec","=","Tens...
237
380
null
test_shapeshifter.py
adversarial-robustness-toolbox/tests/attacks/test_shapeshifter.py
from __future__ import absolute_import, division, print_function, unicode_literals import logging import unittest import importlib import tensorflow import numpy from tests.utils import TestBase, master_seed
15
1
7
0
1
6
1
Use image node_id 6 for calling the TestShapeShifter obj's underlying member method code with example usage: obj.test_check_params() without return types
153
node_id 6
234,966
End of preview. Expand in Data Studio

Python Copilot Large Coding Dataset

This dataset is a subset of the matlok python copilot datasets. Please refer to the Multimodal Python Copilot Training Overview for more details on how to use this dataset.

Details

Each row contains python code, either a class method or a global function, imported modules, base classes (if any), exceptions (ordered based off the code), returns (ordered based off the code), arguments (ordered based off the code), and more.

  • Rows: 2350782
  • Size: 3.1 GB
  • Data type: text
  • Format: Extracted code using python AST

Schema

{
    "args": "string",
    "class_bases": "string",
    "class_docstr": "string",
    "class_docstr_tok": "string",
    "class_name": "string",
    "code": "string",
    "code_tok": "string",
    "docstr": "string",
    "docstr_tok": "string",
    "file_path": "string",
    "filename": "string",
    "imports": "string",
    "is_member": "bool",
    "label_desc": "string",
    "label_desc_len": "int64",
    "label_id": "string",
    "lend": "int64",
    "lstart": "int64",
    "name": "string",
    "num_all_bases": "float64",
    "num_bases": "float64",
    "num_classes": "float64",
    "num_functions": "int64",
    "num_imports": "int64",
    "num_methods": "float64",
    "raises": "string",
    "returns": "string",
    "total_objects": "int64"
}

How to use the dataset

from datasets import load_dataset

ds = load_dataset("matlok/python-copilot-training-from-many-repos-large", data_dir="files")
Downloads last month
43

Collection including matlok/python-copilot-training-from-many-repos-large