function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def __init__(self, params, lr=1e-3, betas=(0.9, 0.999), eps=1e-8,
weight_decay=0, amsgrad=False):
defaults = dict(lr=lr, betas=betas, eps=eps,
weight_decay=weight_decay, amsgrad=amsgrad)
super(Adam, self).__init__(params, defaults) | mlperf/training_results_v0.7 | [
11,
25,
11,
1,
1606268455
] |
def __init__(
self,
cfg,
confidence_threshold=0.7,
show_mask_heatmaps=False,
masks_per_dim=2,
min_image_size=224, | mlperf/training_results_v0.7 | [
11,
25,
11,
1,
1606268455
] |
def build_transform(self):
"""
Creates a basic transformation that was used to train the models
"""
cfg = self.cfg
# we are loading images with OpenCV, so we don't need to convert them
# to BGR, they are already! So all we need to do is to normalize
# by 255 if w... | mlperf/training_results_v0.7 | [
11,
25,
11,
1,
1606268455
] |
def compute_prediction(self, original_image):
"""
Arguments:
original_image (np.ndarray): an image as returned by OpenCV
Returns:
prediction (BoxList): the detected objects. Additional information
of the detection properties can be found in the fields of
... | mlperf/training_results_v0.7 | [
11,
25,
11,
1,
1606268455
] |
def compute_colors_for_labels(self, labels):
"""
Simple function that adds fixed colors depending on the class
"""
colors = labels[:, None] * self.palette
colors = (colors % 255).numpy().astype("uint8")
return colors | mlperf/training_results_v0.7 | [
11,
25,
11,
1,
1606268455
] |
def overlay_mask(self, image, predictions):
"""
Adds the instances contours for each predicted object.
Each label has a different color.
Arguments:
image (np.ndarray): an image as returned by OpenCV
predictions (BoxList): the result of the computation by the mode... | mlperf/training_results_v0.7 | [
11,
25,
11,
1,
1606268455
] |
def create_mask_montage(self, image, predictions):
"""
Create a montage showing the probability heatmaps for each one one of the
detected objects
Arguments:
image (np.ndarray): an image as returned by OpenCV
predictions (BoxList): the result of the computation by... | mlperf/training_results_v0.7 | [
11,
25,
11,
1,
1606268455
] |
def __init__(
self,
*,
application_name: str,
attach_log: bool = False,
namespace: Optional[str] = None,
kubernetes_conn_id: str = "kubernetes_default",
api_group: str = 'sparkoperator.k8s.io',
api_version: str = 'v1beta2',
**kwargs, | apache/incubator-airflow | [
29418,
12032,
29418,
869,
1428948298
] |
def _log_driver(self, application_state: str, response: dict) -> None:
if not self.attach_log:
return
status_info = response["status"]
if "driverInfo" not in status_info:
return
driver_info = status_info["driverInfo"]
if "podName" not in driver_info:
... | apache/incubator-airflow | [
29418,
12032,
29418,
869,
1428948298
] |
def create_string_buffer(init, size=None):
"""create_string_buffer(aBytes) -> character array
create_string_buffer(anInteger) -> character array
create_string_buffer(aString, anInteger) -> character array
"""
if isinstance(init, bytes):
if size is None:
size = len(init)+1
... | Microvellum/Fluid-Designer | [
69,
30,
69,
37,
1461884765
] |
def CFUNCTYPE(restype, *argtypes, **kw):
"""CFUNCTYPE(restype, *argtypes,
use_errno=False, use_last_error=False) -> function prototype.
restype: the result type
argtypes: a sequence specifying the argument types
The function prototype can be called in different ways to create a
ca... | Microvellum/Fluid-Designer | [
69,
30,
69,
37,
1461884765
] |
def WINFUNCTYPE(restype, *argtypes, **kw):
# docstring set later (very similar to CFUNCTYPE.__doc__)
flags = _FUNCFLAG_STDCALL
if kw.pop("use_errno", False):
flags |= _FUNCFLAG_USE_ERRNO
if kw.pop("use_last_error", False):
flags |= _FUNCFLAG_USE_LASTERROR
... | Microvellum/Fluid-Designer | [
69,
30,
69,
37,
1461884765
] |
def _check_size(typ, typecode=None):
# Check if sizeof(ctypes_type) against struct.calcsize. This
# should protect somewhat against a misconfigured libffi.
from struct import calcsize
if typecode is None:
# Most _type_ codes are the same as used in struct
typecode = typ._type_
actua... | Microvellum/Fluid-Designer | [
69,
30,
69,
37,
1461884765
] |
def __repr__(self):
try:
return super().__repr__()
except ValueError:
return "%s(<NULL>)" % type(self).__name__ | Microvellum/Fluid-Designer | [
69,
30,
69,
37,
1461884765
] |
def __repr__(self):
return "%s(%s)" % (self.__class__.__name__, c_void_p.from_buffer(self).value) | Microvellum/Fluid-Designer | [
69,
30,
69,
37,
1461884765
] |
def __repr__(self):
return "%s(%s)" % (self.__class__.__name__, c_void_p.from_buffer(self).value) | Microvellum/Fluid-Designer | [
69,
30,
69,
37,
1461884765
] |
def _reset_cache():
_pointer_type_cache.clear()
_c_functype_cache.clear()
if _os.name in ("nt", "ce"):
_win_functype_cache.clear()
# _SimpleCData.c_wchar_p_from_param
POINTER(c_wchar).from_param = c_wchar_p.from_param
# _SimpleCData.c_char_p_from_param
POINTER(c_char).from_param = c_... | Microvellum/Fluid-Designer | [
69,
30,
69,
37,
1461884765
] |
def SetPointerType(pointer, cls):
if _pointer_type_cache.get(cls, None) is not None:
raise RuntimeError("This type already exists in the cache")
if id(pointer) not in _pointer_type_cache:
raise RuntimeError("What's this???")
pointer.set_type(cls)
_pointer_type_cache[cls] = pointer
de... | Microvellum/Fluid-Designer | [
69,
30,
69,
37,
1461884765
] |
def ARRAY(typ, len):
return typ * len | Microvellum/Fluid-Designer | [
69,
30,
69,
37,
1461884765
] |
def __init__(self, name, mode=DEFAULT_MODE, handle=None,
use_errno=False,
use_last_error=False):
self._name = name
flags = self._func_flags_
if use_errno:
flags |= _FUNCFLAG_USE_ERRNO
if use_last_error:
flags |= _FUNCFLAG_USE_LAST... | Microvellum/Fluid-Designer | [
69,
30,
69,
37,
1461884765
] |
def __getattr__(self, name):
if name.startswith('__') and name.endswith('__'):
raise AttributeError(name)
func = self.__getitem__(name)
setattr(self, name, func)
return func | Microvellum/Fluid-Designer | [
69,
30,
69,
37,
1461884765
] |
def __init__(self, dlltype):
self._dlltype = dlltype | Microvellum/Fluid-Designer | [
69,
30,
69,
37,
1461884765
] |
def __getitem__(self, name):
return getattr(self, name) | Microvellum/Fluid-Designer | [
69,
30,
69,
37,
1461884765
] |
def WinError(code=None, descr=None):
if code is None:
code = GetLastError()
if descr is None:
descr = FormatError(code).strip()
return OSError(None, descr, None, code) | Microvellum/Fluid-Designer | [
69,
30,
69,
37,
1461884765
] |
def PYFUNCTYPE(restype, *argtypes):
class CFunctionType(_CFuncPtr):
_argtypes_ = argtypes
_restype_ = restype
_flags_ = _FUNCFLAG_CDECL | _FUNCFLAG_PYTHONAPI
return CFunctionType | Microvellum/Fluid-Designer | [
69,
30,
69,
37,
1461884765
] |
def cast(obj, typ):
return _cast(obj, obj, typ) | Microvellum/Fluid-Designer | [
69,
30,
69,
37,
1461884765
] |
def string_at(ptr, size=-1):
"""string_at(addr[, size]) -> string
Return the string at addr."""
return _string_at(ptr, size) | Microvellum/Fluid-Designer | [
69,
30,
69,
37,
1461884765
] |
def wstring_at(ptr, size=-1):
"""wstring_at(addr[, size]) -> string
Return the string at addr."""
return _wstring_at(ptr, size) | Microvellum/Fluid-Designer | [
69,
30,
69,
37,
1461884765
] |
def DllGetClassObject(rclsid, riid, ppv):
try:
ccom = __import__("comtypes.server.inprocserver", globals(), locals(), ['*'])
except ImportError:
return -2147221231 # CLASS_E_CLASSNOTAVAILABLE
else:
return ccom.DllGetClassObject(rclsid, riid, ppv) | Microvellum/Fluid-Designer | [
69,
30,
69,
37,
1461884765
] |
def test_seq_ex_in_sequence_categorical_column_with_identity(self):
self._test_parsed_sequence_example(
'int_list', sfc.sequence_categorical_column_with_identity,
10, [3, 6], [2, 4, 6]) | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def test_seq_ex_in_sequence_categorical_column_with_vocabulary_list(self):
self._test_parsed_sequence_example(
'bytes_list', sfc.sequence_categorical_column_with_vocabulary_list,
list(string.ascii_lowercase), [3, 4],
[compat.as_bytes(x) for x in 'acg']) | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def _test_parsed_sequence_example(
self, col_name, col_fn, col_arg, shape, values):
"""Helper function to check that each FeatureColumn parses correctly.
Args:
col_name: string, name to give to the feature column. Should match
the name that the column will parse out of the features dict.
... | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def _make_sequence_example():
example = example_pb2.SequenceExample()
return text_format.Parse(_SEQ_EX_PROTO, example) | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def processPyPath(ServerConfig):
"""Use ServerConfig to add to the python path."""
if ServerConfig.get('pypath_append'):
path_append = ServerConfig['pypath_append'].split(':')
#expand all ~'s in the list
path_append = [os.path.expanduser(path) for path in path_append]
sys.path.ex... | sparkslabs/kamaelia_ | [
13,
3,
13,
2,
1348148442
] |
def normalizeUrlList(url_list):
"""Add necessary default entries that the user did not enter."""
for dict in url_list:
if not dict.get('kp.app_object'):
dict['kp.app_object'] = 'application' | sparkslabs/kamaelia_ | [
13,
3,
13,
2,
1348148442
] |
def normalizeWsgiVars(WsgiConfig):
"""Put WSGI config data in a state that the server expects."""
WsgiConfig['wsgi_ver'] = tuple(WsgiConfig['wsgi_ver'].split('.')) | sparkslabs/kamaelia_ | [
13,
3,
13,
2,
1348148442
] |
def initializeLogger(consolename='kamaelia'):
"""This sets up the logging system."""
formatter = logging.Formatter('%(levelname)s/%(name)s: %(message)s') | sparkslabs/kamaelia_ | [
13,
3,
13,
2,
1348148442
] |
def __init__(self, name, rng=None):
"""
Args:
name: Name of the used fuzzer.
rng: Random number generator for generating experiments.
random_seed: Random-seed used for d8 throughout one fuzz session.
"""
self.name = name
self.rng = rng or random.Random() | endlessm/chromium-browser | [
21,
16,
21,
3,
1435959644
] |
def ceiling_fan(name: str):
"""Create a ceiling fan with given name."""
return {
"name": name,
"type": DeviceType.CEILING_FAN,
"actions": ["SetSpeed", "SetDirection"],
} | tchellomello/home-assistant | [
7,
1,
7,
6,
1467778429
] |
def get_input_function():
"""A function to get test inputs. Returns an image with one box."""
image = tf.random_uniform([32, 32, 3], dtype=tf.float32)
class_label = tf.random_uniform(
[1], minval=0, maxval=NUMBER_OF_CLASSES, dtype=tf.int32)
box_label = tf.random_uniform(
[1, 4], minval=0.4, maxval=0... | unnikrishnankgs/va | [
1,
5,
1,
10,
1496432585
] |
def __init__(self):
super(FakeDetectionModel, self).__init__(num_classes=NUMBER_OF_CLASSES)
self._classification_loss = losses.WeightedSigmoidClassificationLoss(
anchorwise_output=True)
self._localization_loss = losses.WeightedSmoothL1LocalizationLoss(
anchorwise_output=True) | unnikrishnankgs/va | [
1,
5,
1,
10,
1496432585
] |
def predict(self, preprocessed_inputs):
"""Prediction tensors from inputs tensor.
Args:
preprocessed_inputs: a [batch, 28, 28, channels] float32 tensor.
Returns:
prediction_dict: a dictionary holding prediction tensors to be
passed to the Loss or Postprocess functions.
"""
flat... | unnikrishnankgs/va | [
1,
5,
1,
10,
1496432585
] |
def loss(self, prediction_dict):
"""Compute scalar loss tensors with respect to provided groundtruth.
Calling this function requires that groundtruth tensors have been
provided via the provide_groundtruth function.
Args:
prediction_dict: a dictionary holding predicted tensors
Returns:
... | unnikrishnankgs/va | [
1,
5,
1,
10,
1496432585
] |
def restore(unused_sess):
return | unnikrishnankgs/va | [
1,
5,
1,
10,
1496432585
] |
def test_configure_trainer_and_train_two_steps(self):
train_config_text_proto = """
optimizer {
adam_optimizer {
learning_rate {
constant_learning_rate {
learning_rate: 0.01
}
}
}
}
data_augmentation_options {
random_adjust_brightness {
... | unnikrishnankgs/va | [
1,
5,
1,
10,
1496432585
] |
def read_golden_file(self, extension):
return file(
os.path.join(
os.path.dirname(__file__),
'unexpire_test.' + extension + '.expected')).read() | nwjs/chromium.src | [
136,
133,
136,
45,
1453904223
] |
def testHFile(self):
h = generate_unexpire_flags.gen_features_header('foobar', 123)
golden_h = self.read_golden_file('h')
self.assertEquals(golden_h, h) | nwjs/chromium.src | [
136,
133,
136,
45,
1453904223
] |
def test_silence(self, mock_warning):
date = "2016-07-04"
instructions = "This is how you update..."
@deprecation.deprecated(date, instructions)
def _fn():
pass
_fn()
self.assertEqual(1, mock_warning.call_count)
with deprecation.silence():
_fn()
self.assertEqual(1, mock_wa... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def test_deprecated_illegal_args(self):
instructions = "This is how you update..."
with self.assertRaisesRegexp(ValueError, "YYYY-MM-DD"):
deprecation.deprecated("", instructions)
with self.assertRaisesRegexp(ValueError, "YYYY-MM-DD"):
deprecation.deprecated("07-04-2016", instructions)
date ... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def test_no_date(self, mock_warning):
date = None
instructions = "This is how you update..."
@deprecation.deprecated(date, instructions)
def _fn(arg0, arg1):
"""fn doc.
Args:
arg0: Arg 0.
arg1: Arg 1.
Returns:
Sum of args.
"""
return arg0 + arg1
... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def test_static_fn_with_doc(self, mock_warning):
date = "2016-07-04"
instructions = "This is how you update..."
@deprecation.deprecated(date, instructions)
def _fn(arg0, arg1):
"""fn doc.
Args:
arg0: Arg 0.
arg1: Arg 1.
Returns:
Sum of args.
"""
r... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def test_static_fn_with_one_line_doc(self, mock_warning):
date = "2016-07-04"
instructions = "This is how you update..."
@deprecation.deprecated(date, instructions)
def _fn(arg0, arg1):
"""fn doc."""
return arg0 + arg1
# Assert function docs are properly updated.
self.assertEqual("... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def test_static_fn_no_doc(self, mock_warning):
date = "2016-07-04"
instructions = "This is how you update..."
@deprecation.deprecated(date, instructions)
def _fn(arg0, arg1):
return arg0 + arg1
# Assert function docs are properly updated.
self.assertEqual("_fn", _fn.__name__)
self.as... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def test_instance_fn_with_doc(self, mock_warning):
date = "2016-07-04"
instructions = "This is how you update..."
class _Object(object):
def __init(self):
pass
@deprecation.deprecated(date, instructions)
def _fn(self, arg0, arg1):
"""fn doc.
Args:
arg0... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def test_instance_fn_with_one_line_doc(self, mock_warning):
date = "2016-07-04"
instructions = "This is how you update..."
class _Object(object):
def __init(self):
pass
@deprecation.deprecated(date, instructions)
def _fn(self, arg0, arg1):
"""fn doc."""
return ar... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def test_instance_fn_no_doc(self, mock_warning):
date = "2016-07-04"
instructions = "This is how you update..."
class _Object(object):
def __init(self):
pass
@deprecation.deprecated(date, instructions)
def _fn(self, arg0, arg1):
return arg0 + arg1
# Assert function ... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def __init(self):
pass | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def _prop(self):
return "prop_wrong_order" | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def test_prop_with_doc(self, mock_warning):
date = "2016-07-04"
instructions = "This is how you update..."
class _Object(object):
def __init(self):
pass
@property
@deprecation.deprecated(date, instructions)
def _prop(self):
"""prop doc.
Returns:
... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def test_prop_no_doc(self, mock_warning):
date = "2016-07-04"
instructions = "This is how you update..."
class _Object(object):
def __init(self):
pass
@property
@deprecation.deprecated(date, instructions)
def _prop(self):
return "prop_no_doc"
# Assert function... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def _assert_subset(self, expected_subset, actual_set):
self.assertTrue(
actual_set.issuperset(expected_subset),
msg="%s is not a superset of %s." % (actual_set, expected_subset)) | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def test_deprecated_missing_args(self):
date = "2016-07-04"
instructions = "This is how you update..."
def _fn(arg0, arg1, deprecated=None):
return arg0 + arg1 if deprecated else arg1 + arg0
# Assert calls without the deprecated argument log nothing.
with self.assertRaisesRegexp(ValueError, ... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def test_static_fn_with_doc(self, mock_warning):
date = "2016-07-04"
instructions = "This is how you update..."
@deprecation.deprecated_args(date, instructions, "deprecated")
def _fn(arg0, arg1, deprecated=True):
"""fn doc.
Args:
arg0: Arg 0.
arg1: Arg 1.
deprecated... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def test_static_fn_with_one_line_doc(self, mock_warning):
date = "2016-07-04"
instructions = "This is how you update..."
@deprecation.deprecated_args(date, instructions, "deprecated")
def _fn(arg0, arg1, deprecated=True):
"""fn doc."""
return arg0 + arg1 if deprecated else arg1 + arg0
... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def test_static_fn_no_doc(self, mock_warning):
date = "2016-07-04"
instructions = "This is how you update..."
@deprecation.deprecated_args(date, instructions, "deprecated")
def _fn(arg0, arg1, deprecated=True):
return arg0 + arg1 if deprecated else arg1 + arg0
# Assert function docs are prop... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def test_varargs(self, mock_warning):
date = "2016-07-04"
instructions = "This is how you update..."
@deprecation.deprecated_args(date, instructions, "deprecated")
def _fn(arg0, arg1, *deprecated):
return arg0 + arg1 if deprecated else arg1 + arg0
# Assert calls without the deprecated argume... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def test_kwargs(self, mock_warning):
date = "2016-07-04"
instructions = "This is how you update..."
@deprecation.deprecated_args(date, instructions, "deprecated")
def _fn(arg0, arg1, **deprecated):
return arg0 + arg1 if deprecated else arg1 + arg0
# Assert calls without the deprecated argume... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def test_positional_and_named(self, mock_warning):
date = "2016-07-04"
instructions = "This is how you update..."
@deprecation.deprecated_args(date, instructions, "d1", "d2")
def _fn(arg0, d1=None, arg1=2, d2=None):
return arg0 + arg1 if d1 else arg1 + arg0 if d2 else arg0 * arg1
# Assert ca... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def test_positional_and_named_with_ok_vals(self, mock_warning):
date = "2016-07-04"
instructions = "This is how you update..."
@deprecation.deprecated_args(date, instructions, ("d1", None),
("d2", "my_ok_val"))
def _fn(arg0, d1=None, arg1=2, d2=None):
return arg0 ... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def _assert_subset(self, expected_subset, actual_set):
self.assertTrue(
actual_set.issuperset(expected_subset),
msg="%s is not a superset of %s." % (actual_set, expected_subset)) | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def test_static_fn_with_doc(self, mock_warning):
date = "2016-07-04"
instructions = "This is how you update..."
@deprecation.deprecated_arg_values(date, instructions, deprecated=True)
def _fn(arg0, arg1, deprecated=True):
"""fn doc.
Args:
arg0: Arg 0.
arg1: Arg 1.
d... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def test_static_fn_with_one_line_doc(self, mock_warning):
date = "2016-07-04"
instructions = "This is how you update..."
@deprecation.deprecated_arg_values(date, instructions, deprecated=True)
def _fn(arg0, arg1, deprecated=True):
"""fn doc."""
return arg0 + arg1 if deprecated else arg1 + a... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def test_static_fn_no_doc(self, mock_warning):
date = "2016-07-04"
instructions = "This is how you update..."
@deprecation.deprecated_arg_values(date, instructions, deprecated=True)
def _fn(arg0, arg1, deprecated=True):
return arg0 + arg1 if deprecated else arg1 + arg0
# Assert function docs... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def testDeprecatedArgumentLookup(self):
good_value = 3
self.assertEqual(
deprecation.deprecated_argument_lookup("val_new", good_value, "val_old",
None), good_value)
self.assertEqual(
deprecation.deprecated_argument_lookup("val_new", None, "val_o... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def touch(path):
with open(path, 'a'):
os.utime(path, None) | chrisspen/homebot | [
8,
5,
8,
23,
1471872070
] |
def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def prepare_request(next_link=None):
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
if not next_link:
# Construct URL
url = self.list.metadat... | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def list_all(
self,
**kwargs: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def prepare_request(next_link=None):
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
if not next_link:
# Construct URL
url = self.list_all.met... | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def get_long_running_output(pipeline_response):
if cls:
return cls(pipeline_response, None, {}) | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def instrument(graph, **kwargs):
track_subsections(graph, **kwargs)
# Construct a fresh Timer object
profiler = kwargs['profiler']
timer = Timer(profiler.name, list(profiler.all_sections))
instrument_sections(graph, timer=timer, **kwargs) | opesci/devito | [
428,
198,
428,
105,
1458759589
] |
def track_subsections(iet, **kwargs):
"""
Add custom Sections to the `profiler`. Custom Sections include:
* MPI Calls (e.g., HaloUpdateCall and HaloUpdateWait)
* Busy-waiting on While(lock) (e.g., from host-device orchestration)
"""
profiler = kwargs['profiler']
sregistry = kwargs['... | opesci/devito | [
428,
198,
428,
105,
1458759589
] |
def __init__(
self,
credential: "TokenCredential",
subscription_id: str,
base_url: str = "https://management.azure.com",
**kwargs: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def _send_request(
self,
request, # type: HttpRequest
**kwargs: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def close(self):
# type: () -> None
self._client.close() | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def __init__(self, plotly_name="colorbar", parent_name="bar.marker", **kwargs):
super(ColorbarValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
data_class_str=kwargs.pop("data_class_str", "ColorBar"),
data_docs=kwargs.pop(
... | plotly/plotly.py | [
13052,
2308,
13052,
1319,
1385013188
] |
def __init__(self, customerCount=0, pfixedPct=0.0, qfixedPct=0.0, qfixed=0.0, pfixed=0.0, LoadResponse=None, *args, **kw_args):
"""Initialises a new 'EnergyConsumer' instance.
@param customerCount: Number of individual customers represented by this Demand
@param pfixedPct: Fixed active power a... | rwl/PyCIM | [
68,
33,
68,
7,
1238978196
] |
def getLoadResponse(self):
"""The load response characteristic of this load.
"""
return self._LoadResponse | rwl/PyCIM | [
68,
33,
68,
7,
1238978196
] |
def __init__(self, base_url):
self.base_url = base_url | mattvonrocketstein/smash | [
12,
1,
12,
10,
1321798817
] |
def list(self):
return self._req('GET', 'api/kernelspecs') | mattvonrocketstein/smash | [
12,
1,
12,
10,
1321798817
] |
def kernel_resource(self, name, path):
return self._req('GET', url_path_join('kernelspecs', name, path)) | mattvonrocketstein/smash | [
12,
1,
12,
10,
1321798817
] |
def setUp(self):
ipydir = self.ipython_dir.name
sample_kernel_dir = pjoin(ipydir, 'kernels', 'sample')
try:
os.makedirs(sample_kernel_dir)
except OSError as e:
if e.errno != errno.EEXIST:
raise
with open(pjoin(sample_kernel_dir, 'kernel.js... | mattvonrocketstein/smash | [
12,
1,
12,
10,
1321798817
] |
def test_list_kernelspecs(self):
model = self.ks_api.list().json()
assert isinstance(model, dict)
self.assertEqual(model['default'], NATIVE_KERNEL_NAME)
specs = model['kernelspecs']
assert isinstance(specs, dict)
# 2: the sample kernelspec created in setUp, and the nativ... | mattvonrocketstein/smash | [
12,
1,
12,
10,
1321798817
] |
def test_get_nonexistant_kernelspec(self):
with assert_http_error(404):
self.ks_api.kernel_spec_info('nonexistant') | mattvonrocketstein/smash | [
12,
1,
12,
10,
1321798817
] |
def __init__(self):
"""
Default constructor
"""
self.targets = []
self.effects = EffectsCollection()
self.spirit = 0 | tuturto/pyherc | [
43,
2,
43,
69,
1327858418
] |
def add_effect_handle(self, handle):
"""
Add effect handle
:param handle: effect handle to add
:type handle: EffectHandle
"""
self.effects.add_effect_handle(handle) | tuturto/pyherc | [
43,
2,
43,
69,
1327858418
] |
def get_effect_handles(self, trigger=None):
"""
Get effect handles
:param trigger: optional trigger type
:type trigger: string
:returns: effect handles
:rtype: [EffectHandle]
"""
return self.effects.get_effect_handles(trigger) | tuturto/pyherc | [
43,
2,
43,
69,
1327858418
] |
def remove_effect_handle(self, handle):
"""
Remove given handle
:param handle: handle to remove
:type handle: EffectHandle
"""
self.effects.remove_effect_handle(handle) | tuturto/pyherc | [
43,
2,
43,
69,
1327858418
] |
def build_ranking(
cls,
year: Year,
rank: int,
team_key: TeamKey,
wins: int,
losses: int,
ties: int,
qual_average: Optional[float],
matches_played: int,
dq: int,
sort_orders: List[float], | the-blue-alliance/the-blue-alliance | [
334,
153,
334,
422,
1283632451
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.