body_hash stringlengths 64 64 | body stringlengths 23 109k | docstring stringlengths 1 57k | path stringlengths 4 198 | name stringlengths 1 115 | repository_name stringlengths 7 111 | repository_stars float64 0 191k | lang stringclasses 1
value | body_without_docstring stringlengths 14 108k | unified stringlengths 45 133k |
|---|---|---|---|---|---|---|---|---|---|
3f47ac5db56a3f1396beff8f6872ce46c8ad0bec3400730e7a3bff11b5a8cf89 | def toFloat(s):
'Safely convert a string to float number.'
try:
return float(s)
except ValueError:
return 0.0 | Safely convert a string to float number. | CJK Metrics.glyphsReporter/Contents/Resources/plugin.py | toFloat | schriftgestalt/CJK-Metrics | 2 | python | def toFloat(s):
try:
return float(s)
except ValueError:
return 0.0 | def toFloat(s):
try:
return float(s)
except ValueError:
return 0.0<|docstring|>Safely convert a string to float number.<|endoftext|> |
8ce2cf76bd7319946c82dfa29aa4ea829369d4906fb64fca9741e0b71b18b8c8 | @objc.python_method
def drawMedialAxes(self, layer):
'Draw the medial axes (水平垂直轴线).'
vertical = 0.5
horizontal = 0.5
scale = self.getScale()
view = Glyphs.font.currentTab.graphicView()
visibleRect = view.visibleRect()
activePosition = view.activePosition()
viewOriginX = ((visibleRect.or... | Draw the medial axes (水平垂直轴线). | CJK Metrics.glyphsReporter/Contents/Resources/plugin.py | drawMedialAxes | schriftgestalt/CJK-Metrics | 2 | python | @objc.python_method
def drawMedialAxes(self, layer):
vertical = 0.5
horizontal = 0.5
scale = self.getScale()
view = Glyphs.font.currentTab.graphicView()
visibleRect = view.visibleRect()
activePosition = view.activePosition()
viewOriginX = ((visibleRect.origin.x - activePosition.x) / sca... | @objc.python_method
def drawMedialAxes(self, layer):
vertical = 0.5
horizontal = 0.5
scale = self.getScale()
view = Glyphs.font.currentTab.graphicView()
visibleRect = view.visibleRect()
activePosition = view.activePosition()
viewOriginX = ((visibleRect.origin.x - activePosition.x) / sca... |
5938cecafa6e98afd980e8d0c754e97698f690ca7456bc738eb51ab6ed16f9e5 | @objc.python_method
def drawCentralArea(self, layer):
'Draw the central area (第二中心区域).'
spacing = self.centralAreaSpacing
descender = layer.descender
ascender = layer.ascender
if (not self.centralAreaRotateState):
width = self.centralAreaWidth
height = (ascender - descender)
... | Draw the central area (第二中心区域). | CJK Metrics.glyphsReporter/Contents/Resources/plugin.py | drawCentralArea | schriftgestalt/CJK-Metrics | 2 | python | @objc.python_method
def drawCentralArea(self, layer):
spacing = self.centralAreaSpacing
descender = layer.descender
ascender = layer.ascender
if (not self.centralAreaRotateState):
width = self.centralAreaWidth
height = (ascender - descender)
x_mid = ((layer.width * self.cent... | @objc.python_method
def drawCentralArea(self, layer):
spacing = self.centralAreaSpacing
descender = layer.descender
ascender = layer.ascender
if (not self.centralAreaRotateState):
width = self.centralAreaWidth
height = (ascender - descender)
x_mid = ((layer.width * self.cent... |
4bd34a1effd180ed02847897175b4d6ba7ba8be3adb2e71f039a57e27ddd38ee | @objc.python_method
def drawCjkGuide(self, layer):
'Draw the CJK guide (汉字参考线).'
self.initCjkGuideGlyph()
color = NSColor.systemOrangeColor().colorWithAlphaComponent_(0.1)
color.set()
cjkGuideLayer = Glyphs.font.glyphs[CJK_GUIDE_GLYPH].layers[0]
trans = NSAffineTransform.transform()
if self.... | Draw the CJK guide (汉字参考线). | CJK Metrics.glyphsReporter/Contents/Resources/plugin.py | drawCjkGuide | schriftgestalt/CJK-Metrics | 2 | python | @objc.python_method
def drawCjkGuide(self, layer):
self.initCjkGuideGlyph()
color = NSColor.systemOrangeColor().colorWithAlphaComponent_(0.1)
color.set()
cjkGuideLayer = Glyphs.font.glyphs[CJK_GUIDE_GLYPH].layers[0]
trans = NSAffineTransform.transform()
if self.cjkGuideScalingState:
... | @objc.python_method
def drawCjkGuide(self, layer):
self.initCjkGuideGlyph()
color = NSColor.systemOrangeColor().colorWithAlphaComponent_(0.1)
color.set()
cjkGuideLayer = Glyphs.font.glyphs[CJK_GUIDE_GLYPH].layers[0]
trans = NSAffineTransform.transform()
if self.cjkGuideScalingState:
... |
88775dc2a318c9c26b56dc1ed81092dd4ddbe5a49468f76d583fce675b27c7d3 | @objc.python_method
def __file__(self):
'Please leave this method unchanged'
return __file__ | Please leave this method unchanged | CJK Metrics.glyphsReporter/Contents/Resources/plugin.py | __file__ | schriftgestalt/CJK-Metrics | 2 | python | @objc.python_method
def __file__(self):
return __file__ | @objc.python_method
def __file__(self):
return __file__<|docstring|>Please leave this method unchanged<|endoftext|> |
e035dce185f649087e2b92fd3f27f63d35d0d7ed6602f6e2e22bd41a747ef2f0 | def get_classes(path):
'获取分类列表'
classes = []
with open(os.path.join(path, 'classes.csv'), 'r', encoding='utf-8') as f:
for line in f.readlines():
classes.append(line.strip())
return classes | 获取分类列表 | preprocess.py | get_classes | MeanZhang/TextClassification | 3 | python | def get_classes(path):
classes = []
with open(os.path.join(path, 'classes.csv'), 'r', encoding='utf-8') as f:
for line in f.readlines():
classes.append(line.strip())
return classes | def get_classes(path):
classes = []
with open(os.path.join(path, 'classes.csv'), 'r', encoding='utf-8') as f:
for line in f.readlines():
classes.append(line.strip())
return classes<|docstring|>获取分类列表<|endoftext|> |
ba47a1069018c5ccb789a2f66dd1562cddcaa36bfa5eaa9a7fbc88f7665059c6 | def get_field(path):
'创建Field'
with open(os.path.join(path, 'stop_words.txt'), 'r', encoding='utf-8') as f:
stop_words = [word.strip('\n') for word in f.readlines()]
TEXT = data.Field(tokenize=jieba.lcut, lower=True, stop_words=stop_words)
LABEL = data.Field(sequential=False, use_vocab=False)
... | 创建Field | preprocess.py | get_field | MeanZhang/TextClassification | 3 | python | def get_field(path):
with open(os.path.join(path, 'stop_words.txt'), 'r', encoding='utf-8') as f:
stop_words = [word.strip('\n') for word in f.readlines()]
TEXT = data.Field(tokenize=jieba.lcut, lower=True, stop_words=stop_words)
LABEL = data.Field(sequential=False, use_vocab=False)
return ... | def get_field(path):
with open(os.path.join(path, 'stop_words.txt'), 'r', encoding='utf-8') as f:
stop_words = [word.strip('\n') for word in f.readlines()]
TEXT = data.Field(tokenize=jieba.lcut, lower=True, stop_words=stop_words)
LABEL = data.Field(sequential=False, use_vocab=False)
return ... |
48bca8407e3d51121f7d45dbdacc9e18ea3f7d843587ed679e80419b5e62c164 | def preprocess(path, text, label, args):
'预处理'
(train, val, test) = data.TabularDataset.splits(path=path, train='train.tsv', validation='val.tsv', test='test.tsv', format='tsv', fields=[('label', label), ('text', text)])
text.build_vocab(train, val)
with open(os.path.join(path, 'vocab.pkl'), 'wb') as f:... | 预处理 | preprocess.py | preprocess | MeanZhang/TextClassification | 3 | python | def preprocess(path, text, label, args):
(train, val, test) = data.TabularDataset.splits(path=path, train='train.tsv', validation='val.tsv', test='test.tsv', format='tsv', fields=[('label', label), ('text', text)])
text.build_vocab(train, val)
with open(os.path.join(path, 'vocab.pkl'), 'wb') as f:
... | def preprocess(path, text, label, args):
(train, val, test) = data.TabularDataset.splits(path=path, train='train.tsv', validation='val.tsv', test='test.tsv', format='tsv', fields=[('label', label), ('text', text)])
text.build_vocab(train, val)
with open(os.path.join(path, 'vocab.pkl'), 'wb') as f:
... |
daf2cd6bc7169da82a66afc7497f904f33207e1666c07e238b75b3dc2a6eba4f | @defNode('Remove Dictionary Key', returnNames=['key'], isExecutable=True, identifier=COLLECTION_IDENTIFIER)
def removeDictKey(dictionary, key):
'\n Returns the removed key. If the key does not exist None is returned.\n '
return dictionary.pop(key, None) | Returns the removed key. If the key does not exist None is returned. | node_exec/collection_nodes.py | removeDictKey | compix/NodeGraphQt | 0 | python | @defNode('Remove Dictionary Key', returnNames=['key'], isExecutable=True, identifier=COLLECTION_IDENTIFIER)
def removeDictKey(dictionary, key):
'\n \n '
return dictionary.pop(key, None) | @defNode('Remove Dictionary Key', returnNames=['key'], isExecutable=True, identifier=COLLECTION_IDENTIFIER)
def removeDictKey(dictionary, key):
'\n \n '
return dictionary.pop(key, None)<|docstring|>Returns the removed key. If the key does not exist None is returned.<|endoftext|> |
05df4bafa159ce5c4ffc60d3c9688bc4cd9d60734f568bbeda225426d5f139ee | def _validate_not_subset(of, allow_none=False):
'\n Create validator to check if an attribute is not a subset of ``of``.\n\n Parameters\n ----------\n of: str\n Attribute name that the subject under validation should not be a subset of.\n\n Returns\n -------\n validator: Callable\n ... | Create validator to check if an attribute is not a subset of ``of``.
Parameters
----------
of: str
Attribute name that the subject under validation should not be a subset of.
Returns
-------
validator: Callable
Validator that can be used for ``attr.ib``. | kartothek/core/cube/cube.py | _validate_not_subset | martin-haffner-by/kartothek | 171 | python | def _validate_not_subset(of, allow_none=False):
'\n Create validator to check if an attribute is not a subset of ``of``.\n\n Parameters\n ----------\n of: str\n Attribute name that the subject under validation should not be a subset of.\n\n Returns\n -------\n validator: Callable\n ... | def _validate_not_subset(of, allow_none=False):
'\n Create validator to check if an attribute is not a subset of ``of``.\n\n Parameters\n ----------\n of: str\n Attribute name that the subject under validation should not be a subset of.\n\n Returns\n -------\n validator: Callable\n ... |
9d24401015158962dfefb0a5b3698f396b544ce0e364230ab4237340a801e93e | def _validate_subset(of, allow_none=False):
'\n Create validator to check that an attribute is a subset of ``of``.\n\n Parameters\n ----------\n of: str\n Attribute name that the subject under validation should be a subset of.\n\n Returns\n -------\n validator: Callable\n Validato... | Create validator to check that an attribute is a subset of ``of``.
Parameters
----------
of: str
Attribute name that the subject under validation should be a subset of.
Returns
-------
validator: Callable
Validator that can be used for ``attr.ib``. | kartothek/core/cube/cube.py | _validate_subset | martin-haffner-by/kartothek | 171 | python | def _validate_subset(of, allow_none=False):
'\n Create validator to check that an attribute is a subset of ``of``.\n\n Parameters\n ----------\n of: str\n Attribute name that the subject under validation should be a subset of.\n\n Returns\n -------\n validator: Callable\n Validato... | def _validate_subset(of, allow_none=False):
'\n Create validator to check that an attribute is a subset of ``of``.\n\n Parameters\n ----------\n of: str\n Attribute name that the subject under validation should be a subset of.\n\n Returns\n -------\n validator: Callable\n Validato... |
650a9923ea6e8b02321f7faece3a3c6e0db8633a8633d9052305e1c1090a30ba | def _validator_uuid(instance, attribute, value):
'\n Attr validator to validate if UUIDs are valid.\n '
_validator_uuid_freestanding(attribute.name, value) | Attr validator to validate if UUIDs are valid. | kartothek/core/cube/cube.py | _validator_uuid | martin-haffner-by/kartothek | 171 | python | def _validator_uuid(instance, attribute, value):
'\n \n '
_validator_uuid_freestanding(attribute.name, value) | def _validator_uuid(instance, attribute, value):
'\n \n '
_validator_uuid_freestanding(attribute.name, value)<|docstring|>Attr validator to validate if UUIDs are valid.<|endoftext|> |
acfbcd642e077a4c48cef0212f36331a25ac0283077266fbf082296e2ff23e3a | def _validator_uuid_freestanding(name, value):
'\n Freestanding version of :meth:`_validate_not_subset`.\n '
if (not _validate_uuid(value)):
raise ValueError('{name} ("{value}") is not compatible with kartothek'.format(name=name, value=value))
if (value.find(KTK_CUBE_UUID_SEPERATOR) != (- 1)):... | Freestanding version of :meth:`_validate_not_subset`. | kartothek/core/cube/cube.py | _validator_uuid_freestanding | martin-haffner-by/kartothek | 171 | python | def _validator_uuid_freestanding(name, value):
'\n \n '
if (not _validate_uuid(value)):
raise ValueError('{name} ("{value}") is not compatible with kartothek'.format(name=name, value=value))
if (value.find(KTK_CUBE_UUID_SEPERATOR) != (- 1)):
raise ValueError('{name} ("{value}") must no... | def _validator_uuid_freestanding(name, value):
'\n \n '
if (not _validate_uuid(value)):
raise ValueError('{name} ("{value}") is not compatible with kartothek'.format(name=name, value=value))
if (value.find(KTK_CUBE_UUID_SEPERATOR) != (- 1)):
raise ValueError('{name} ("{value}") must no... |
1a28891015f8284440b418f733b9cd1db2333f1ae94845a5e1066ab80d03cf87 | def _validator_not_empty(instance, attribute, value):
'\n Attr validator to validate that a list is not empty:\n '
if (len(value) == 0):
raise ValueError('{name} must not be empty'.format(name=attribute.name)) | Attr validator to validate that a list is not empty: | kartothek/core/cube/cube.py | _validator_not_empty | martin-haffner-by/kartothek | 171 | python | def _validator_not_empty(instance, attribute, value):
'\n \n '
if (len(value) == 0):
raise ValueError('{name} must not be empty'.format(name=attribute.name)) | def _validator_not_empty(instance, attribute, value):
'\n \n '
if (len(value) == 0):
raise ValueError('{name} must not be empty'.format(name=attribute.name))<|docstring|>Attr validator to validate that a list is not empty:<|endoftext|> |
12f44525249924e280f3f82c8c69581ea541b47cd5c257f01393deb7285aa01b | def ktk_dataset_uuid(self, ktk_cube_dataset_id):
'\n Get Kartothek dataset UUID for given dataset UUID, so the prefix is included.\n\n Parameters\n ----------\n ktk_cube_dataset_id: str\n Dataset ID w/o prefix\n\n Returns\n -------\n ktk_dataset_uuid: str\... | Get Kartothek dataset UUID for given dataset UUID, so the prefix is included.
Parameters
----------
ktk_cube_dataset_id: str
Dataset ID w/o prefix
Returns
-------
ktk_dataset_uuid: str
Prefixed dataset UUID for Kartothek.
Raises
------
ValueError
If ``ktk_cube_dataset_id`` is not a string or if it is not... | kartothek/core/cube/cube.py | ktk_dataset_uuid | martin-haffner-by/kartothek | 171 | python | def ktk_dataset_uuid(self, ktk_cube_dataset_id):
'\n Get Kartothek dataset UUID for given dataset UUID, so the prefix is included.\n\n Parameters\n ----------\n ktk_cube_dataset_id: str\n Dataset ID w/o prefix\n\n Returns\n -------\n ktk_dataset_uuid: str\... | def ktk_dataset_uuid(self, ktk_cube_dataset_id):
'\n Get Kartothek dataset UUID for given dataset UUID, so the prefix is included.\n\n Parameters\n ----------\n ktk_cube_dataset_id: str\n Dataset ID w/o prefix\n\n Returns\n -------\n ktk_dataset_uuid: str\... |
3ef57cd97f7e61d0f7d3dc9aa134c1ae699bcc21bcac2a7572f89b9e99776ab7 | @property
def ktk_index_columns(self):
'\n Set of all available index columns through Kartothek, primary and secondary.\n '
return ((set(self.partition_columns) | set(self.index_columns)) | (set(self.dimension_columns) - set(self.suppress_index_on))) | Set of all available index columns through Kartothek, primary and secondary. | kartothek/core/cube/cube.py | ktk_index_columns | martin-haffner-by/kartothek | 171 | python | @property
def ktk_index_columns(self):
'\n \n '
return ((set(self.partition_columns) | set(self.index_columns)) | (set(self.dimension_columns) - set(self.suppress_index_on))) | @property
def ktk_index_columns(self):
'\n \n '
return ((set(self.partition_columns) | set(self.index_columns)) | (set(self.dimension_columns) - set(self.suppress_index_on)))<|docstring|>Set of all available index columns through Kartothek, primary and secondary.<|endoftext|> |
daf3d730b81731dea6e2699319d1ca6ee5d96f085909398ad4a883a3629ba495 | def copy(self, **kwargs):
'\n Create a new cube specification w/ changed attributes.\n\n This will not trigger any IO operation, but only affects the cube specification.\n\n Parameters\n ----------\n kwargs: Dict[str, Any]\n Attributes that should be changed.\n\n ... | Create a new cube specification w/ changed attributes.
This will not trigger any IO operation, but only affects the cube specification.
Parameters
----------
kwargs: Dict[str, Any]
Attributes that should be changed.
Returns
-------
cube: Cube
New abstract cube. | kartothek/core/cube/cube.py | copy | martin-haffner-by/kartothek | 171 | python | def copy(self, **kwargs):
'\n Create a new cube specification w/ changed attributes.\n\n This will not trigger any IO operation, but only affects the cube specification.\n\n Parameters\n ----------\n kwargs: Dict[str, Any]\n Attributes that should be changed.\n\n ... | def copy(self, **kwargs):
'\n Create a new cube specification w/ changed attributes.\n\n This will not trigger any IO operation, but only affects the cube specification.\n\n Parameters\n ----------\n kwargs: Dict[str, Any]\n Attributes that should be changed.\n\n ... |
92e1a3d5fa9a8cc46787e8898b983047fe43960c324715ccc2e7ceb3eaccbaa4 | @staticmethod
def initialize():
' Installs GITNB\n - installs git pre-commit hook\n - creates .gitnb dir\n '
if os.path.isfile(GIT_PC):
nb_match = utils.nb_matching_lines('gitnb', GIT_PC)
else:
nb_match = 0
if (nb_match > 0):
print('\ngitnb[WARNING]:'... | Installs GITNB
- installs git pre-commit hook
- creates .gitnb dir | gitnb/project.py | initialize | brookisme/nb_git | 14 | python | @staticmethod
def initialize():
' Installs GITNB\n - installs git pre-commit hook\n - creates .gitnb dir\n '
if os.path.isfile(GIT_PC):
nb_match = utils.nb_matching_lines('gitnb', GIT_PC)
else:
nb_match = 0
if (nb_match > 0):
print('\ngitnb[WARNING]:'... | @staticmethod
def initialize():
' Installs GITNB\n - installs git pre-commit hook\n - creates .gitnb dir\n '
if os.path.isfile(GIT_PC):
nb_match = utils.nb_matching_lines('gitnb', GIT_PC)
else:
nb_match = 0
if (nb_match > 0):
print('\ngitnb[WARNING]:'... |
43573e984cb358638e8e500831ee8d0c052ba47a18f187d7b4c0aeca8e34b936 | @staticmethod
def configure():
' Install config file\n allows user to change config\n '
utils.copy_append(DEFAULT_CONFIG, USER_CONFIG, 'w')
print('gitnb: USER CONFIG FILE ADDED ({}) '.format(USER_CONFIG)) | Install config file
allows user to change config | gitnb/project.py | configure | brookisme/nb_git | 14 | python | @staticmethod
def configure():
' Install config file\n allows user to change config\n '
utils.copy_append(DEFAULT_CONFIG, USER_CONFIG, 'w')
print('gitnb: USER CONFIG FILE ADDED ({}) '.format(USER_CONFIG)) | @staticmethod
def configure():
' Install config file\n allows user to change config\n '
utils.copy_append(DEFAULT_CONFIG, USER_CONFIG, 'w')
print('gitnb: USER CONFIG FILE ADDED ({}) '.format(USER_CONFIG))<|docstring|>Install config file
allows user to change config<|endoftext|> |
2b28532c6709525b5a93deb63a09db94b4807ef704f9582d26dc8cbe3b4699e2 | @pytest.mark.parametrize('test_input,expected', [('dataset/table/_SUCCESS', {'dataset': 'dataset', 'table': 'table', 'partition': None, 'yyyy': None, 'mm': None, 'dd': None, 'hh': None, 'batch': None}), ('dataset/table/$20201030/_SUCCESS', {'dataset': 'dataset', 'table': 'table', 'partition': '$20201030', 'yyyy': None,... | ensure our default regex handles each scenarios we document.
this test is to support improving this regex in the future w/o regressing
for existing use cases. | tools/cloud_functions/gcs_event_based_ingest/tests/gcs_ocn_bq_ingest/test_gcs_ocn_bq_ingest.py | test_default_destination_regex | saher4bc/bigquery-utils | 1 | python | @pytest.mark.parametrize('test_input,expected', [('dataset/table/_SUCCESS', {'dataset': 'dataset', 'table': 'table', 'partition': None, 'yyyy': None, 'mm': None, 'dd': None, 'hh': None, 'batch': None}), ('dataset/table/$20201030/_SUCCESS', {'dataset': 'dataset', 'table': 'table', 'partition': '$20201030', 'yyyy': None,... | @pytest.mark.parametrize('test_input,expected', [('dataset/table/_SUCCESS', {'dataset': 'dataset', 'table': 'table', 'partition': None, 'yyyy': None, 'mm': None, 'dd': None, 'hh': None, 'batch': None}), ('dataset/table/$20201030/_SUCCESS', {'dataset': 'dataset', 'table': 'table', 'partition': '$20201030', 'yyyy': None,... |
f5a2fe0e21e3efc89bbeabe248be9243c3dd84adff4fbf474f1c752e2e6af77d | def distance_picking(Loc1, Loc2, y_low, y_high):
'Calculate Picker Route Distance between two locations'
(x1, y1) = (Loc1[0], Loc1[1])
(x2, y2) = (Loc2[0], Loc2[1])
distance_x = abs((x2 - x1))
if (x1 == x2):
distance_y1 = abs((y2 - y1))
distance_y2 = distance_y1
else:
dis... | Calculate Picker Route Distance between two locations | utils/routing/distances.py | distance_picking | corentin-glanum/pickingRoute | 15 | python | def distance_picking(Loc1, Loc2, y_low, y_high):
(x1, y1) = (Loc1[0], Loc1[1])
(x2, y2) = (Loc2[0], Loc2[1])
distance_x = abs((x2 - x1))
if (x1 == x2):
distance_y1 = abs((y2 - y1))
distance_y2 = distance_y1
else:
distance_y1 = ((y_high - y1) + (y_high - y2))
dist... | def distance_picking(Loc1, Loc2, y_low, y_high):
(x1, y1) = (Loc1[0], Loc1[1])
(x2, y2) = (Loc2[0], Loc2[1])
distance_x = abs((x2 - x1))
if (x1 == x2):
distance_y1 = abs((y2 - y1))
distance_y2 = distance_y1
else:
distance_y1 = ((y_high - y1) + (y_high - y2))
dist... |
5753d5c4c91f41a4df68aa5c22dce9511aeb76a3f75e434d512d85daed4c031a | def next_location(start_loc, list_locs, y_low, y_high):
'Find closest next location'
list_dist = [distance_picking(start_loc, i, y_low, y_high) for i in list_locs]
distance_next = min(list_dist)
index_min = list_dist.index(min(list_dist))
next_loc = list_locs[index_min]
list_locs.remove(next_loc... | Find closest next location | utils/routing/distances.py | next_location | corentin-glanum/pickingRoute | 15 | python | def next_location(start_loc, list_locs, y_low, y_high):
list_dist = [distance_picking(start_loc, i, y_low, y_high) for i in list_locs]
distance_next = min(list_dist)
index_min = list_dist.index(min(list_dist))
next_loc = list_locs[index_min]
list_locs.remove(next_loc)
return (list_locs, sta... | def next_location(start_loc, list_locs, y_low, y_high):
list_dist = [distance_picking(start_loc, i, y_low, y_high) for i in list_locs]
distance_next = min(list_dist)
index_min = list_dist.index(min(list_dist))
next_loc = list_locs[index_min]
list_locs.remove(next_loc)
return (list_locs, sta... |
dead9e94bea7d4f7b442bd4c66d2ca42c92d1a71f171a0aeea6f6ebcf5f3c072 | def centroid(list_in):
'Centroid function'
(x, y) = ([p[0] for p in list_in], [p[1] for p in list_in])
centroid = [round((sum(x) / len(list_in)), 2), round((sum(y) / len(list_in)), 2)]
return centroid | Centroid function | utils/routing/distances.py | centroid | corentin-glanum/pickingRoute | 15 | python | def centroid(list_in):
(x, y) = ([p[0] for p in list_in], [p[1] for p in list_in])
centroid = [round((sum(x) / len(list_in)), 2), round((sum(y) / len(list_in)), 2)]
return centroid | def centroid(list_in):
(x, y) = ([p[0] for p in list_in], [p[1] for p in list_in])
centroid = [round((sum(x) / len(list_in)), 2), round((sum(y) / len(list_in)), 2)]
return centroid<|docstring|>Centroid function<|endoftext|> |
6849f85937aac2a60201e81f8d7c720b62f4d66d87d7887d0d7d15e8f81c82d6 | def centroid_mapping(df_multi):
'Mapping Centroids'
df_multi['Coord'] = df_multi['Coord'].apply(literal_eval)
df_group = pd.DataFrame(df_multi.groupby(['OrderNumber'])['Coord'].apply(list)).reset_index()
df_group['Coord_Centroid'] = df_group['Coord'].apply(centroid)
(list_order, list_coord) = (list(... | Mapping Centroids | utils/routing/distances.py | centroid_mapping | corentin-glanum/pickingRoute | 15 | python | def centroid_mapping(df_multi):
df_multi['Coord'] = df_multi['Coord'].apply(literal_eval)
df_group = pd.DataFrame(df_multi.groupby(['OrderNumber'])['Coord'].apply(list)).reset_index()
df_group['Coord_Centroid'] = df_group['Coord'].apply(centroid)
(list_order, list_coord) = (list(df_group.OrderNumbe... | def centroid_mapping(df_multi):
df_multi['Coord'] = df_multi['Coord'].apply(literal_eval)
df_group = pd.DataFrame(df_multi.groupby(['OrderNumber'])['Coord'].apply(list)).reset_index()
df_group['Coord_Centroid'] = df_group['Coord'].apply(centroid)
(list_order, list_coord) = (list(df_group.OrderNumbe... |
0a6dac903117f8049a7def9f31402c937ac8785032caa333d2a8a2b271e00e15 | def initialize_with_zeros(dim):
'\n This function creates a vector of zeros of shape (dim, 1) for w and initializes b to 0.\n \n Argument:\n dim -- size of the w vector we want (or number of parameters in this case)\n \n Returns:\n w -- initialized vector of shape (dim, 1)\n b -- initialized... | This function creates a vector of zeros of shape (dim, 1) for w and initializes b to 0.
Argument:
dim -- size of the w vector we want (or number of parameters in this case)
Returns:
w -- initialized vector of shape (dim, 1)
b -- initialized scalar (corresponds to the bias) | common.py | initialize_with_zeros | navyverma/deep_implementation | 0 | python | def initialize_with_zeros(dim):
'\n This function creates a vector of zeros of shape (dim, 1) for w and initializes b to 0.\n \n Argument:\n dim -- size of the w vector we want (or number of parameters in this case)\n \n Returns:\n w -- initialized vector of shape (dim, 1)\n b -- initialized... | def initialize_with_zeros(dim):
'\n This function creates a vector of zeros of shape (dim, 1) for w and initializes b to 0.\n \n Argument:\n dim -- size of the w vector we want (or number of parameters in this case)\n \n Returns:\n w -- initialized vector of shape (dim, 1)\n b -- initialized... |
2a5d028cf87b3daa73a9a709aec89d0910c570fb26ccafbedd5b9d62f7000e6a | def sigmoid(z):
'\n Compute the sigmoid of z\n\n Arguments:\n z -- A scalar or numpy array of any size.\n\n Return:\n s -- sigmoid(z)\n '
s = (1 / (1 + np.exp((- z))))
return s | Compute the sigmoid of z
Arguments:
z -- A scalar or numpy array of any size.
Return:
s -- sigmoid(z) | common.py | sigmoid | navyverma/deep_implementation | 0 | python | def sigmoid(z):
'\n Compute the sigmoid of z\n\n Arguments:\n z -- A scalar or numpy array of any size.\n\n Return:\n s -- sigmoid(z)\n '
s = (1 / (1 + np.exp((- z))))
return s | def sigmoid(z):
'\n Compute the sigmoid of z\n\n Arguments:\n z -- A scalar or numpy array of any size.\n\n Return:\n s -- sigmoid(z)\n '
s = (1 / (1 + np.exp((- z))))
return s<|docstring|>Compute the sigmoid of z
Arguments:
z -- A scalar or numpy array of any size.
Return:
s -- sigmoid(... |
ebc212131c9c94f6748895c2b6e9b30f7c810f13c9d0f5b1c4e6304bd7e48f92 | def sigmoid_cache(Z):
'\n Implements the sigmoid activation in numpy\n \n Arguments:\n Z -- numpy array of any shape\n \n Returns:\n A -- output of sigmoid(z), same shape as Z\n cache -- returns Z as well, useful during backpropagation\n '
A = (1 / (1 + np.exp((- Z))))
cache = Z
... | Implements the sigmoid activation in numpy
Arguments:
Z -- numpy array of any shape
Returns:
A -- output of sigmoid(z), same shape as Z
cache -- returns Z as well, useful during backpropagation | common.py | sigmoid_cache | navyverma/deep_implementation | 0 | python | def sigmoid_cache(Z):
'\n Implements the sigmoid activation in numpy\n \n Arguments:\n Z -- numpy array of any shape\n \n Returns:\n A -- output of sigmoid(z), same shape as Z\n cache -- returns Z as well, useful during backpropagation\n '
A = (1 / (1 + np.exp((- Z))))
cache = Z
... | def sigmoid_cache(Z):
'\n Implements the sigmoid activation in numpy\n \n Arguments:\n Z -- numpy array of any shape\n \n Returns:\n A -- output of sigmoid(z), same shape as Z\n cache -- returns Z as well, useful during backpropagation\n '
A = (1 / (1 + np.exp((- Z))))
cache = Z
... |
428f82996ab844bf7ed81b5d5ebc9a42086a8add4a81f294697b3012be174d9e | def relu(Z):
'\n Implement the RELU function.\n Arguments:\n Z -- Output of the linear layer, of any shape\n Returns:\n A -- Post-activation parameter, of the same shape as Z\n cache -- a python dictionary containing "A" ; stored for computing the backward pass efficiently\n '
A = np.maximu... | Implement the RELU function.
Arguments:
Z -- Output of the linear layer, of any shape
Returns:
A -- Post-activation parameter, of the same shape as Z
cache -- a python dictionary containing "A" ; stored for computing the backward pass efficiently | common.py | relu | navyverma/deep_implementation | 0 | python | def relu(Z):
'\n Implement the RELU function.\n Arguments:\n Z -- Output of the linear layer, of any shape\n Returns:\n A -- Post-activation parameter, of the same shape as Z\n cache -- a python dictionary containing "A" ; stored for computing the backward pass efficiently\n '
A = np.maximu... | def relu(Z):
'\n Implement the RELU function.\n Arguments:\n Z -- Output of the linear layer, of any shape\n Returns:\n A -- Post-activation parameter, of the same shape as Z\n cache -- a python dictionary containing "A" ; stored for computing the backward pass efficiently\n '
A = np.maximu... |
6ebb40c758c22c6c0489e5f02bda5367d1aa97608ee379a31a7ef3181be58b4c | def relu_cache(Z):
'\n Implement the RELU function.\n Arguments:\n Z -- Output of the linear layer, of any shape\n Returns:\n A -- Post-activation parameter, of the same shape as Z\n cache -- a python dictionary containing "A" ; stored for computing the backward pass efficiently\n '
A = np.... | Implement the RELU function.
Arguments:
Z -- Output of the linear layer, of any shape
Returns:
A -- Post-activation parameter, of the same shape as Z
cache -- a python dictionary containing "A" ; stored for computing the backward pass efficiently | common.py | relu_cache | navyverma/deep_implementation | 0 | python | def relu_cache(Z):
'\n Implement the RELU function.\n Arguments:\n Z -- Output of the linear layer, of any shape\n Returns:\n A -- Post-activation parameter, of the same shape as Z\n cache -- a python dictionary containing "A" ; stored for computing the backward pass efficiently\n '
A = np.... | def relu_cache(Z):
'\n Implement the RELU function.\n Arguments:\n Z -- Output of the linear layer, of any shape\n Returns:\n A -- Post-activation parameter, of the same shape as Z\n cache -- a python dictionary containing "A" ; stored for computing the backward pass efficiently\n '
A = np.... |
749acf9a62a1d565e41c1050253a6f89f1b74ed4dbbb4ec65e9eb17ecf1008a0 | def relu_backward(dA, cache):
"\n Implement the backward propagation for a single RELU unit.\n Arguments:\n dA -- post-activation gradient, of any shape\n cache -- 'Z' where we store for computing backward propagation efficiently\n Returns:\n dZ -- Gradient of the cost with respect to Z\n "
... | Implement the backward propagation for a single RELU unit.
Arguments:
dA -- post-activation gradient, of any shape
cache -- 'Z' where we store for computing backward propagation efficiently
Returns:
dZ -- Gradient of the cost with respect to Z | common.py | relu_backward | navyverma/deep_implementation | 0 | python | def relu_backward(dA, cache):
"\n Implement the backward propagation for a single RELU unit.\n Arguments:\n dA -- post-activation gradient, of any shape\n cache -- 'Z' where we store for computing backward propagation efficiently\n Returns:\n dZ -- Gradient of the cost with respect to Z\n "
... | def relu_backward(dA, cache):
"\n Implement the backward propagation for a single RELU unit.\n Arguments:\n dA -- post-activation gradient, of any shape\n cache -- 'Z' where we store for computing backward propagation efficiently\n Returns:\n dZ -- Gradient of the cost with respect to Z\n "
... |
8c6ddcf2d4fe7a2084e94c024dc2c04a53afb8b963fb7160c5344b3d41e14619 | def sigmoid_backward(dA, cache):
"\n Implement the backward propagation for a single SIGMOID unit.\n Arguments:\n dA -- post-activation gradient, of any shape\n cache -- 'Z' where we store for computing backward propagation efficiently\n Returns:\n dZ -- Gradient of the cost with respect to Z\n ... | Implement the backward propagation for a single SIGMOID unit.
Arguments:
dA -- post-activation gradient, of any shape
cache -- 'Z' where we store for computing backward propagation efficiently
Returns:
dZ -- Gradient of the cost with respect to Z | common.py | sigmoid_backward | navyverma/deep_implementation | 0 | python | def sigmoid_backward(dA, cache):
"\n Implement the backward propagation for a single SIGMOID unit.\n Arguments:\n dA -- post-activation gradient, of any shape\n cache -- 'Z' where we store for computing backward propagation efficiently\n Returns:\n dZ -- Gradient of the cost with respect to Z\n ... | def sigmoid_backward(dA, cache):
"\n Implement the backward propagation for a single SIGMOID unit.\n Arguments:\n dA -- post-activation gradient, of any shape\n cache -- 'Z' where we store for computing backward propagation efficiently\n Returns:\n dZ -- Gradient of the cost with respect to Z\n ... |
ce697f6e26ee6645758298f641643fcd71a10999bf63d7f70c6d8be2fcf78da0 | def print_mislabeled_images(classes, X, y, p):
'\n Plots images where predictions and truth were different.\n X -- dataset\n y -- true labels\n p -- predictions\n '
a = (p + y)
mislabeled_indices = np.asarray(np.where((a == 1)))
plt.rcParams['figure.figsize'] = (40.0, 40.0)
num_images... | Plots images where predictions and truth were different.
X -- dataset
y -- true labels
p -- predictions | common.py | print_mislabeled_images | navyverma/deep_implementation | 0 | python | def print_mislabeled_images(classes, X, y, p):
'\n Plots images where predictions and truth were different.\n X -- dataset\n y -- true labels\n p -- predictions\n '
a = (p + y)
mislabeled_indices = np.asarray(np.where((a == 1)))
plt.rcParams['figure.figsize'] = (40.0, 40.0)
num_images... | def print_mislabeled_images(classes, X, y, p):
'\n Plots images where predictions and truth were different.\n X -- dataset\n y -- true labels\n p -- predictions\n '
a = (p + y)
mislabeled_indices = np.asarray(np.where((a == 1)))
plt.rcParams['figure.figsize'] = (40.0, 40.0)
num_images... |
c9781ba427f9fafb77ff0ab8a3e07c990d281499c67e9a1eeb32ec041e3235ef | @property
def lens(self):
'\n A :py:class:`~MulensModel.mulensobjects.lens.Lens` object.\n Physical properties of the lens. Note: lens mass must be in\n solMasses.\n '
return self._lens | A :py:class:`~MulensModel.mulensobjects.lens.Lens` object.
Physical properties of the lens. Note: lens mass must be in
solMasses. | source/MulensModel/mulensobjects/mulenssystem.py | lens | KKruszynska/MulensModel | 30 | python | @property
def lens(self):
'\n A :py:class:`~MulensModel.mulensobjects.lens.Lens` object.\n Physical properties of the lens. Note: lens mass must be in\n solMasses.\n '
return self._lens | @property
def lens(self):
'\n A :py:class:`~MulensModel.mulensobjects.lens.Lens` object.\n Physical properties of the lens. Note: lens mass must be in\n solMasses.\n '
return self._lens<|docstring|>A :py:class:`~MulensModel.mulensobjects.lens.Lens` object.
Physical properties of the ... |
12daf8cfcd84d8df77e9c12eb1eefbd180e2594ede35ad2efead304b7338e419 | @property
def source(self):
'\n :py:class:`~MulensModel.mulensobjects.source.Source` object.\n Physical properties of the source.\n '
return self._source | :py:class:`~MulensModel.mulensobjects.source.Source` object.
Physical properties of the source. | source/MulensModel/mulensobjects/mulenssystem.py | source | KKruszynska/MulensModel | 30 | python | @property
def source(self):
'\n :py:class:`~MulensModel.mulensobjects.source.Source` object.\n Physical properties of the source.\n '
return self._source | @property
def source(self):
'\n :py:class:`~MulensModel.mulensobjects.source.Source` object.\n Physical properties of the source.\n '
return self._source<|docstring|>:py:class:`~MulensModel.mulensobjects.source.Source` object.
Physical properties of the source.<|endoftext|> |
24c5000528d729233f2cb5b03bc02e5edbb15ccac951bd6523bc428c358687e4 | @property
def mu_rel(self):
'\n *astropy.Quantity*\n\n Relative proper motion between the source and lens\n stars. If set as a *float*, units are assumed to be mas/yr.\n '
return self._mu_rel | *astropy.Quantity*
Relative proper motion between the source and lens
stars. If set as a *float*, units are assumed to be mas/yr. | source/MulensModel/mulensobjects/mulenssystem.py | mu_rel | KKruszynska/MulensModel | 30 | python | @property
def mu_rel(self):
'\n *astropy.Quantity*\n\n Relative proper motion between the source and lens\n stars. If set as a *float*, units are assumed to be mas/yr.\n '
return self._mu_rel | @property
def mu_rel(self):
'\n *astropy.Quantity*\n\n Relative proper motion between the source and lens\n stars. If set as a *float*, units are assumed to be mas/yr.\n '
return self._mu_rel<|docstring|>*astropy.Quantity*
Relative proper motion between the source and lens
stars. If... |
9b2bf40931a1f46810e6eead7718cafe1a08913d2e53f823b51f98471bbd6729 | @property
def t_E(self):
'\n *astropy.Quantity*\n\n The Einstein crossing time (in days). If set as a *float*,\n assumes units are in days.\n '
try:
t_E = (self.theta_E / self.mu_rel)
return t_E.to(u.day)
except Exception:
return None | *astropy.Quantity*
The Einstein crossing time (in days). If set as a *float*,
assumes units are in days. | source/MulensModel/mulensobjects/mulenssystem.py | t_E | KKruszynska/MulensModel | 30 | python | @property
def t_E(self):
'\n *astropy.Quantity*\n\n The Einstein crossing time (in days). If set as a *float*,\n assumes units are in days.\n '
try:
t_E = (self.theta_E / self.mu_rel)
return t_E.to(u.day)
except Exception:
return None | @property
def t_E(self):
'\n *astropy.Quantity*\n\n The Einstein crossing time (in days). If set as a *float*,\n assumes units are in days.\n '
try:
t_E = (self.theta_E / self.mu_rel)
return t_E.to(u.day)
except Exception:
return None<|docstring|>*astropy.... |
9137471b2b683193b617868f6ab0fbb896e972ae42450b7524dc817fa7e1ffec | @property
def pi_rel(self):
'\n *astropy.Quantity*, read-only\n\n The source-lens relative parallax in milliarcseconds.\n '
return (self.lens.pi_L.to(u.mas) - self.source.pi_S.to(u.mas)) | *astropy.Quantity*, read-only
The source-lens relative parallax in milliarcseconds. | source/MulensModel/mulensobjects/mulenssystem.py | pi_rel | KKruszynska/MulensModel | 30 | python | @property
def pi_rel(self):
'\n *astropy.Quantity*, read-only\n\n The source-lens relative parallax in milliarcseconds.\n '
return (self.lens.pi_L.to(u.mas) - self.source.pi_S.to(u.mas)) | @property
def pi_rel(self):
'\n *astropy.Quantity*, read-only\n\n The source-lens relative parallax in milliarcseconds.\n '
return (self.lens.pi_L.to(u.mas) - self.source.pi_S.to(u.mas))<|docstring|>*astropy.Quantity*, read-only
The source-lens relative parallax in milliarcseconds.<|endoft... |
a927bcad898ce0ae5ff1b242b2c4998b0b7f15ea0c9a1791ad4d7fa29fbf5cb0 | @property
def pi_E(self):
"\n *float*, read-only\n\n The Einstein ring radius. It's equal to pi_rel / theta_E.\n Dimensionless.\n "
return (self.pi_rel / self.theta_E).decompose().value | *float*, read-only
The Einstein ring radius. It's equal to pi_rel / theta_E.
Dimensionless. | source/MulensModel/mulensobjects/mulenssystem.py | pi_E | KKruszynska/MulensModel | 30 | python | @property
def pi_E(self):
"\n *float*, read-only\n\n The Einstein ring radius. It's equal to pi_rel / theta_E.\n Dimensionless.\n "
return (self.pi_rel / self.theta_E).decompose().value | @property
def pi_E(self):
"\n *float*, read-only\n\n The Einstein ring radius. It's equal to pi_rel / theta_E.\n Dimensionless.\n "
return (self.pi_rel / self.theta_E).decompose().value<|docstring|>*float*, read-only
The Einstein ring radius. It's equal to pi_rel / theta_E.
Dimensio... |
49f57c1bcba8098965eaacfd74f43f2cf367330438fe6e512142ab51b0371ceb | @property
def theta_E(self):
'\n *astropy.Quantity*, read-only\n\n The angular Einstein Radius in milliarcseconds.\n '
kappa = ((4.0 * G) / ((c ** 2) * au)).to((u.mas / u.Msun), equivalencies=u.dimensionless_angles())
return np.sqrt(((kappa * self.lens.total_mass.to(u.solMass)) * self.p... | *astropy.Quantity*, read-only
The angular Einstein Radius in milliarcseconds. | source/MulensModel/mulensobjects/mulenssystem.py | theta_E | KKruszynska/MulensModel | 30 | python | @property
def theta_E(self):
'\n *astropy.Quantity*, read-only\n\n The angular Einstein Radius in milliarcseconds.\n '
kappa = ((4.0 * G) / ((c ** 2) * au)).to((u.mas / u.Msun), equivalencies=u.dimensionless_angles())
return np.sqrt(((kappa * self.lens.total_mass.to(u.solMass)) * self.p... | @property
def theta_E(self):
'\n *astropy.Quantity*, read-only\n\n The angular Einstein Radius in milliarcseconds.\n '
kappa = ((4.0 * G) / ((c ** 2) * au)).to((u.mas / u.Msun), equivalencies=u.dimensionless_angles())
return np.sqrt(((kappa * self.lens.total_mass.to(u.solMass)) * self.p... |
38dacf678a4450dc3e6dcbdd1aaee2f13fae265605472e2c7154cbb5203cdfe1 | @property
def r_E(self):
'\n *astropy.Quantity*, read-only\n\n The physical size of the Einstein Radius in the Lens plane (in AU).\n '
return (self.lens.distance * self.theta_E.to('', equivalencies=u.dimensionless_angles())).to(u.au) | *astropy.Quantity*, read-only
The physical size of the Einstein Radius in the Lens plane (in AU). | source/MulensModel/mulensobjects/mulenssystem.py | r_E | KKruszynska/MulensModel | 30 | python | @property
def r_E(self):
'\n *astropy.Quantity*, read-only\n\n The physical size of the Einstein Radius in the Lens plane (in AU).\n '
return (self.lens.distance * self.theta_E.to(, equivalencies=u.dimensionless_angles())).to(u.au) | @property
def r_E(self):
'\n *astropy.Quantity*, read-only\n\n The physical size of the Einstein Radius in the Lens plane (in AU).\n '
return (self.lens.distance * self.theta_E.to(, equivalencies=u.dimensionless_angles())).to(u.au)<|docstring|>*astropy.Quantity*, read-only
The physical siz... |
d2efe5a83439b7da946175aea169926a9cf7b4cb3ec3647696d388412b496580 | @property
def r_E_tilde(self):
'\n *astropy.Quantity*, read-only\n\n The physical size of the Einstein Radius projected onto the\n Observer plane (in AU).\n '
return ((self.r_E * self.source.distance) / (self.source.distance - self.lens.distance)) | *astropy.Quantity*, read-only
The physical size of the Einstein Radius projected onto the
Observer plane (in AU). | source/MulensModel/mulensobjects/mulenssystem.py | r_E_tilde | KKruszynska/MulensModel | 30 | python | @property
def r_E_tilde(self):
'\n *astropy.Quantity*, read-only\n\n The physical size of the Einstein Radius projected onto the\n Observer plane (in AU).\n '
return ((self.r_E * self.source.distance) / (self.source.distance - self.lens.distance)) | @property
def r_E_tilde(self):
'\n *astropy.Quantity*, read-only\n\n The physical size of the Einstein Radius projected onto the\n Observer plane (in AU).\n '
return ((self.r_E * self.source.distance) / (self.source.distance - self.lens.distance))<|docstring|>*astropy.Quantity*, read... |
e76ffb0c6eafb552a68238243f910bb03e3601f3bf01b0c7b1ca33247a0acc22 | def plot_magnification(self, u_0=None, alpha=None, **kwargs):
'\n Plot the magnification curve for the lens. u_0 must always be\n specified. If the lens has more than one body, alpha must also\n be specified.\n\n Parameters :\n u_0: *float*\n Impact parameter be... | Plot the magnification curve for the lens. u_0 must always be
specified. If the lens has more than one body, alpha must also
be specified.
Parameters :
u_0: *float*
Impact parameter between the source and the lens (as a
fraction of the Einstein ring)
alpha: *astropy.Quantity*, *float*
... | source/MulensModel/mulensobjects/mulenssystem.py | plot_magnification | KKruszynska/MulensModel | 30 | python | def plot_magnification(self, u_0=None, alpha=None, **kwargs):
'\n Plot the magnification curve for the lens. u_0 must always be\n specified. If the lens has more than one body, alpha must also\n be specified.\n\n Parameters :\n u_0: *float*\n Impact parameter be... | def plot_magnification(self, u_0=None, alpha=None, **kwargs):
'\n Plot the magnification curve for the lens. u_0 must always be\n specified. If the lens has more than one body, alpha must also\n be specified.\n\n Parameters :\n u_0: *float*\n Impact parameter be... |
9df4ae4d24148795d4fa65b2bce343d58415aced7ce0ccdfeef8897d2241dc4c | def plot_caustics(self, n_points=5000, **kwargs):
'\n Plot the caustics structure using `Pyplot scatter`_. See\n :py:func:`MulensModel.caustics.Caustics.plot()`\n\n Parameters :\n n_points: *int*\n Number of points be plotted.\n\n ``**kwargs``:\n ... | Plot the caustics structure using `Pyplot scatter`_. See
:py:func:`MulensModel.caustics.Caustics.plot()`
Parameters :
n_points: *int*
Number of points be plotted.
``**kwargs``:
Keyword arguments passed to `Pyplot scatter`
.. _Pyplot scatter:
https://matplotlib.org/api/pyplot_api.html#matpl... | source/MulensModel/mulensobjects/mulenssystem.py | plot_caustics | KKruszynska/MulensModel | 30 | python | def plot_caustics(self, n_points=5000, **kwargs):
'\n Plot the caustics structure using `Pyplot scatter`_. See\n :py:func:`MulensModel.caustics.Caustics.plot()`\n\n Parameters :\n n_points: *int*\n Number of points be plotted.\n\n ``**kwargs``:\n ... | def plot_caustics(self, n_points=5000, **kwargs):
'\n Plot the caustics structure using `Pyplot scatter`_. See\n :py:func:`MulensModel.caustics.Caustics.plot()`\n\n Parameters :\n n_points: *int*\n Number of points be plotted.\n\n ``**kwargs``:\n ... |
66b0f2b52140a442172884fbb71bd1c51194aa4ab6f7a7d565bd51eed68ad1d2 | @property
def html_content(self):
'\n Generate HTML representation of the markdown-formatted blog entry,\n and also convert any media URLs into rich media objects such as video\n players or images.\n '
hilite = CodeHiliteExtension(linenums=False, css_class='highlight')
extras = E... | Generate HTML representation of the markdown-formatted blog entry,
and also convert any media URLs into rich media objects such as video
players or images. | presenter/models.py | html_content | dkkline/CanSat14-15 | 0 | python | @property
def html_content(self):
'\n Generate HTML representation of the markdown-formatted blog entry,\n and also convert any media URLs into rich media objects such as video\n players or images.\n '
hilite = CodeHiliteExtension(linenums=False, css_class='highlight')
extras = E... | @property
def html_content(self):
'\n Generate HTML representation of the markdown-formatted blog entry,\n and also convert any media URLs into rich media objects such as video\n players or images.\n '
hilite = CodeHiliteExtension(linenums=False, css_class='highlight')
extras = E... |
4ae27ecabe6ae908f3b76fbad0b38fca1301d0f4d3e2563305f84f0c022cdb10 | def save(self, *args, **kwargs):
'\n Saves the entry to the database.\n '
if (not self.slug):
self.slug = re.sub('[^\\w)]+', '-', self.title.lower())
ret = super(Entry, self).save(*args, **kwargs)
return ret | Saves the entry to the database. | presenter/models.py | save | dkkline/CanSat14-15 | 0 | python | def save(self, *args, **kwargs):
'\n \n '
if (not self.slug):
self.slug = re.sub('[^\\w)]+', '-', self.title.lower())
ret = super(Entry, self).save(*args, **kwargs)
return ret | def save(self, *args, **kwargs):
'\n \n '
if (not self.slug):
self.slug = re.sub('[^\\w)]+', '-', self.title.lower())
ret = super(Entry, self).save(*args, **kwargs)
return ret<|docstring|>Saves the entry to the database.<|endoftext|> |
53c63668524a227f4b2ace17c2d6b430c533a8ff000dfa8974438ad1422a2520 | @classmethod
def public(cls):
'\n Returns the published entries.\n '
return Entry.select().where((Entry.published == True)) | Returns the published entries. | presenter/models.py | public | dkkline/CanSat14-15 | 0 | python | @classmethod
def public(cls):
'\n \n '
return Entry.select().where((Entry.published == True)) | @classmethod
def public(cls):
'\n \n '
return Entry.select().where((Entry.published == True))<|docstring|>Returns the published entries.<|endoftext|> |
aad54caa502e7ae20ed5198316f3182fdbfc8eabf91e347a9b25dd4ec1aed00e | @classmethod
def draft(cls):
'\n Returns the drafts among the entries.\n '
return Entry.select().where((Entry.published == False)) | Returns the drafts among the entries. | presenter/models.py | draft | dkkline/CanSat14-15 | 0 | python | @classmethod
def draft(cls):
'\n \n '
return Entry.select().where((Entry.published == False)) | @classmethod
def draft(cls):
'\n \n '
return Entry.select().where((Entry.published == False))<|docstring|>Returns the drafts among the entries.<|endoftext|> |
62c1eb75a50a967f632c01b8b6d6fe305d830b45ec86e6252e1f1531d232efe1 | def test_cyclic_core_recursion():
'Two cyclic cores, in orthogonal subspaces.'
fol = _fol.Context()
fol.declare(x=(0, 1), y=(0, 1), z=(0, 1), u=(0, 1), v=(0, 1), w=(0, 1))
s = '\n (\n \\/ (z = 1 /\\ y = 0)\n \\/ (x = 0 /\\ z = 1)\n \\/ (y = 1 /\\ x = 0)\n ... | Two cyclic cores, in orthogonal subspaces. | tests/cover_test.py | test_cyclic_core_recursion | tulip-control/omega | 24 | python | def test_cyclic_core_recursion():
fol = _fol.Context()
fol.declare(x=(0, 1), y=(0, 1), z=(0, 1), u=(0, 1), v=(0, 1), w=(0, 1))
s = '\n (\n \\/ (z = 1 /\\ y = 0)\n \\/ (x = 0 /\\ z = 1)\n \\/ (y = 1 /\\ x = 0)\n \\/ (y = 1 /\\ z = 0)\n ... | def test_cyclic_core_recursion():
fol = _fol.Context()
fol.declare(x=(0, 1), y=(0, 1), z=(0, 1), u=(0, 1), v=(0, 1), w=(0, 1))
s = '\n (\n \\/ (z = 1 /\\ y = 0)\n \\/ (x = 0 /\\ z = 1)\n \\/ (y = 1 /\\ x = 0)\n \\/ (y = 1 /\\ z = 0)\n ... |
53590c36379a0340ce8406dc83273e852fc3a923d6b8a0c0e86698e941583463 | def test_needs_unfloors():
'Floors shrinks both primes to one smaller implicant.\n\n The returned cover is a minimal cover, so the\n assertion `_covers` in the function `cover.minimize` passes.\n However, the returned cover is not made of primes from\n the set `y` computed by calling `prime_implicants`.... | Floors shrinks both primes to one smaller implicant.
The returned cover is a minimal cover, so the
assertion `_covers` in the function `cover.minimize` passes.
However, the returned cover is not made of primes from
the set `y` computed by calling `prime_implicants`.
Finding the primes takes into account the care set.... | tests/cover_test.py | test_needs_unfloors | tulip-control/omega | 24 | python | def test_needs_unfloors():
'Floors shrinks both primes to one smaller implicant.\n\n The returned cover is a minimal cover, so the\n assertion `_covers` in the function `cover.minimize` passes.\n However, the returned cover is not made of primes from\n the set `y` computed by calling `prime_implicants`.... | def test_needs_unfloors():
'Floors shrinks both primes to one smaller implicant.\n\n The returned cover is a minimal cover, so the\n assertion `_covers` in the function `cover.minimize` passes.\n However, the returned cover is not made of primes from\n the set `y` computed by calling `prime_implicants`.... |
a6c20084e8a90f83da1fdbfacf8e266e5291e42cd0a0f175c5f879128af0c011 | def robots_example(fol):
"Return cooperative winning set from ACC'16 example."
c = ['(x = 0) /\\ (y = 4)', '(x = 0) /\\ (y = 5)', '(x = 0) /\\ (y = 2)', '(x = 0) /\\ (y = 3)', '(x = 0) /\\ (y = 6)', '(x = 0) /\\ (y = 7)', '(x = 1) /\\ (y = 0)', '(x = 1) /\\ (y = 2)', '(x = 1) /\\ (y = 4)', '(x = 1) /\\ (y = 6)'... | Return cooperative winning set from ACC'16 example. | tests/cover_test.py | robots_example | tulip-control/omega | 24 | python | def robots_example(fol):
c = ['(x = 0) /\\ (y = 4)', '(x = 0) /\\ (y = 5)', '(x = 0) /\\ (y = 2)', '(x = 0) /\\ (y = 3)', '(x = 0) /\\ (y = 6)', '(x = 0) /\\ (y = 7)', '(x = 1) /\\ (y = 0)', '(x = 1) /\\ (y = 2)', '(x = 1) /\\ (y = 4)', '(x = 1) /\\ (y = 6)', '(x = 1) /\\ (y = 5)', '(x = 1) /\\ (y = 3)', '(x =... | def robots_example(fol):
c = ['(x = 0) /\\ (y = 4)', '(x = 0) /\\ (y = 5)', '(x = 0) /\\ (y = 2)', '(x = 0) /\\ (y = 3)', '(x = 0) /\\ (y = 6)', '(x = 0) /\\ (y = 7)', '(x = 1) /\\ (y = 0)', '(x = 1) /\\ (y = 2)', '(x = 1) /\\ (y = 4)', '(x = 1) /\\ (y = 6)', '(x = 1) /\\ (y = 5)', '(x = 1) /\\ (y = 3)', '(x =... |
6fa1cf7dfc26c6bf7b968b9bf1872e6ff29b9e2007a033626d329ce14493f1b6 | def register(pluginFn):
'\n Register commands for plugin\n @param pluginFn (MFnPlugin): plugin object passed to initializePlugin\n '
pluginFn.registerCommand(importCmd.kCmdName, importCmd.creator, importCmd.syntaxCreator)
pluginFn.registerCommand(exportCmd.kCmdName, exportCmd.creator, exportCmd.syn... | Register commands for plugin
@param pluginFn (MFnPlugin): plugin object passed to initializePlugin | CA/Assets/FbxExporters/Integrations/Autodesk/maya/scripts/UnityFbxForMaya/commands.py | register | Bartlett-RC3/skilling-module-1-peljevic | 0 | python | def register(pluginFn):
'\n Register commands for plugin\n @param pluginFn (MFnPlugin): plugin object passed to initializePlugin\n '
pluginFn.registerCommand(importCmd.kCmdName, importCmd.creator, importCmd.syntaxCreator)
pluginFn.registerCommand(exportCmd.kCmdName, exportCmd.creator, exportCmd.syn... | def register(pluginFn):
'\n Register commands for plugin\n @param pluginFn (MFnPlugin): plugin object passed to initializePlugin\n '
pluginFn.registerCommand(importCmd.kCmdName, importCmd.creator, importCmd.syntaxCreator)
pluginFn.registerCommand(exportCmd.kCmdName, exportCmd.creator, exportCmd.syn... |
7e1b0268f175684daab0860e99a385682d580de117989b2f25f85c9d187803d5 | def unregister(pluginFn):
'\n Unregister commands for plugin\n @param pluginFn (MFnPlugin): plugin object passed to uninitializePlugin\n '
pluginFn.deregisterCommand(importCmd.kCmdName)
pluginFn.deregisterCommand(exportCmd.kCmdName)
return | Unregister commands for plugin
@param pluginFn (MFnPlugin): plugin object passed to uninitializePlugin | CA/Assets/FbxExporters/Integrations/Autodesk/maya/scripts/UnityFbxForMaya/commands.py | unregister | Bartlett-RC3/skilling-module-1-peljevic | 0 | python | def unregister(pluginFn):
'\n Unregister commands for plugin\n @param pluginFn (MFnPlugin): plugin object passed to uninitializePlugin\n '
pluginFn.deregisterCommand(importCmd.kCmdName)
pluginFn.deregisterCommand(exportCmd.kCmdName)
return | def unregister(pluginFn):
'\n Unregister commands for plugin\n @param pluginFn (MFnPlugin): plugin object passed to uninitializePlugin\n '
pluginFn.deregisterCommand(importCmd.kCmdName)
pluginFn.deregisterCommand(exportCmd.kCmdName)
return<|docstring|>Unregister commands for plugin
@param plugi... |
18bb7452e18d659fa8a332fec03370b6ff1e398eecd38735863dcdbd641df169 | def loadUnityFbxExportSettings(self):
'\n Load the Export Settings from file\n '
projectPath = maya.cmds.optionVar(q='UnityProject')
fileName = os.path.join(projectPath, 'Assets', maya.cmds.optionVar(q='UnityFbxExportSettings'))
if (not os.path.isfile(fileName)):
maya.cmds.error('F... | Load the Export Settings from file | CA/Assets/FbxExporters/Integrations/Autodesk/maya/scripts/UnityFbxForMaya/commands.py | loadUnityFbxExportSettings | Bartlett-RC3/skilling-module-1-peljevic | 0 | python | def loadUnityFbxExportSettings(self):
'\n \n '
projectPath = maya.cmds.optionVar(q='UnityProject')
fileName = os.path.join(projectPath, 'Assets', maya.cmds.optionVar(q='UnityFbxExportSettings'))
if (not os.path.isfile(fileName)):
maya.cmds.error('Failed to find Unity Fbx Export Set... | def loadUnityFbxExportSettings(self):
'\n \n '
projectPath = maya.cmds.optionVar(q='UnityProject')
fileName = os.path.join(projectPath, 'Assets', maya.cmds.optionVar(q='UnityFbxExportSettings'))
if (not os.path.isfile(fileName)):
maya.cmds.error('Failed to find Unity Fbx Export Set... |
54cf0c3c12beffd26e77f2806416bf7b91fd01900e98e8782329f6a6195be158 | @classmethod
def invoke(cls):
'\n Invoke command using mel so that it is executed and logged to script editor log\n @return: void\n '
strCmd = '{0};'.format(cls.kCmdName)
maya.mel.eval(strCmd) | Invoke command using mel so that it is executed and logged to script editor log
@return: void | CA/Assets/FbxExporters/Integrations/Autodesk/maya/scripts/UnityFbxForMaya/commands.py | invoke | Bartlett-RC3/skilling-module-1-peljevic | 0 | python | @classmethod
def invoke(cls):
'\n Invoke command using mel so that it is executed and logged to script editor log\n @return: void\n '
strCmd = '{0};'.format(cls.kCmdName)
maya.mel.eval(strCmd) | @classmethod
def invoke(cls):
'\n Invoke command using mel so that it is executed and logged to script editor log\n @return: void\n '
strCmd = '{0};'.format(cls.kCmdName)
maya.mel.eval(strCmd)<|docstring|>Invoke command using mel so that it is executed and logged to script editor log
@r... |
013018384eac7a2befec8537effd99336d12db26d99c78d9c0e8d1871615bcc9 | @classmethod
def invoke(cls):
'\n Invoke command using mel so that it is executed and logged to script editor log\n @return: void\n '
strCmd = '{0};'.format(cls.kCmdName)
maya.mel.eval(strCmd) | Invoke command using mel so that it is executed and logged to script editor log
@return: void | CA/Assets/FbxExporters/Integrations/Autodesk/maya/scripts/UnityFbxForMaya/commands.py | invoke | Bartlett-RC3/skilling-module-1-peljevic | 0 | python | @classmethod
def invoke(cls):
'\n Invoke command using mel so that it is executed and logged to script editor log\n @return: void\n '
strCmd = '{0};'.format(cls.kCmdName)
maya.mel.eval(strCmd) | @classmethod
def invoke(cls):
'\n Invoke command using mel so that it is executed and logged to script editor log\n @return: void\n '
strCmd = '{0};'.format(cls.kCmdName)
maya.mel.eval(strCmd)<|docstring|>Invoke command using mel so that it is executed and logged to script e... |
19a759e9bf4a80a0c02958b2c0c1e9802b9ec2da891767e380087c53cd0e468a | def __init__(self, logger, dp, stack, tunnel_acls, acl_manager, **kwargs):
'\n Initialize variables and set up peer distances\n\n Args:\n stack (Stack): Stack object of the DP on the Valve being managed\n '
self.logger = logger
self.dp = dp
self.stack = stack
self.tun... | Initialize variables and set up peer distances
Args:
stack (Stack): Stack object of the DP on the Valve being managed | faucet/valve_stack.py | __init__ | pbatta/faucet | 0 | python | def __init__(self, logger, dp, stack, tunnel_acls, acl_manager, **kwargs):
'\n Initialize variables and set up peer distances\n\n Args:\n stack (Stack): Stack object of the DP on the Valve being managed\n '
self.logger = logger
self.dp = dp
self.stack = stack
self.tun... | def __init__(self, logger, dp, stack, tunnel_acls, acl_manager, **kwargs):
'\n Initialize variables and set up peer distances\n\n Args:\n stack (Stack): Stack object of the DP on the Valve being managed\n '
self.logger = logger
self.dp = dp
self.stack = stack
self.tun... |
86363f8d62849e9f6cade3cf70ca962b8ca1758bba37078115c142ebe1ca32ae | @staticmethod
def stacked_valves(valves):
'Return set of valves that have stacking enabled'
return {valve for valve in valves if (valve.dp.stack and valve.dp.stack.root_name)} | Return set of valves that have stacking enabled | faucet/valve_stack.py | stacked_valves | pbatta/faucet | 0 | python | @staticmethod
def stacked_valves(valves):
return {valve for valve in valves if (valve.dp.stack and valve.dp.stack.root_name)} | @staticmethod
def stacked_valves(valves):
return {valve for valve in valves if (valve.dp.stack and valve.dp.stack.root_name)}<|docstring|>Return set of valves that have stacking enabled<|endoftext|> |
5a71704ae4ec528e9584cb1020b0b8b8356de5202172c0eda6d9fe514db422b5 | def reset_peer_distances(self):
'Recalculates the towards and away ports for this node'
self.towards_root_ports = set()
self.chosen_towards_ports = set()
self.chosen_towards_port = None
self.away_ports = set()
self.inactive_away_ports = set()
self.pruned_away_ports = set()
all_peer_ports... | Recalculates the towards and away ports for this node | faucet/valve_stack.py | reset_peer_distances | pbatta/faucet | 0 | python | def reset_peer_distances(self):
self.towards_root_ports = set()
self.chosen_towards_ports = set()
self.chosen_towards_port = None
self.away_ports = set()
self.inactive_away_ports = set()
self.pruned_away_ports = set()
all_peer_ports = set(self.stack.canonical_up_ports())
if self.sta... | def reset_peer_distances(self):
self.towards_root_ports = set()
self.chosen_towards_ports = set()
self.chosen_towards_port = None
self.away_ports = set()
self.inactive_away_ports = set()
self.pruned_away_ports = set()
all_peer_ports = set(self.stack.canonical_up_ports())
if self.sta... |
5feeaaee91e9d578d054584062b56aeccee65cb80a1cfa3d02dac0ac50b340cc | def update_stack_topo(self, event, dp, port):
'\n Update the stack topo according to the event.\n\n Args:\n event (bool): True if the port is UP\n dp (DP): DP object\n port (Port): The port being brought UP/DOWN\n '
self.stack.modify_link(dp, port, event)
... | Update the stack topo according to the event.
Args:
event (bool): True if the port is UP
dp (DP): DP object
port (Port): The port being brought UP/DOWN | faucet/valve_stack.py | update_stack_topo | pbatta/faucet | 0 | python | def update_stack_topo(self, event, dp, port):
'\n Update the stack topo according to the event.\n\n Args:\n event (bool): True if the port is UP\n dp (DP): DP object\n port (Port): The port being brought UP/DOWN\n '
self.stack.modify_link(dp, port, event)
... | def update_stack_topo(self, event, dp, port):
'\n Update the stack topo according to the event.\n\n Args:\n event (bool): True if the port is UP\n dp (DP): DP object\n port (Port): The port being brought UP/DOWN\n '
self.stack.modify_link(dp, port, event)
... |
da48ec68c6042eb472c1394edc2f14cbc423923bf8a7f68a34db698df7ff0db7 | def default_port_towards(self, dp_name):
'\n Default shortest path towards the provided destination, via direct shortest path\n\n Args:\n dp_name (str): Destination DP\n Returns:\n Port: port from current node that is shortest directly towards destination\n '
ret... | Default shortest path towards the provided destination, via direct shortest path
Args:
dp_name (str): Destination DP
Returns:
Port: port from current node that is shortest directly towards destination | faucet/valve_stack.py | default_port_towards | pbatta/faucet | 0 | python | def default_port_towards(self, dp_name):
'\n Default shortest path towards the provided destination, via direct shortest path\n\n Args:\n dp_name (str): Destination DP\n Returns:\n Port: port from current node that is shortest directly towards destination\n '
ret... | def default_port_towards(self, dp_name):
'\n Default shortest path towards the provided destination, via direct shortest path\n\n Args:\n dp_name (str): Destination DP\n Returns:\n Port: port from current node that is shortest directly towards destination\n '
ret... |
edad9200974f5daf9faa6ad6d35b7e25882633145cf76d044421fe87e4035094 | def relative_port_towards(self, dp_name):
'\n Returns the shortest path towards provided destination, via either the root or away paths\n\n Args:\n dp_name (str): Destination DP\n Returns:\n Port: port from current node that is towards/away the destination DP depending on\... | Returns the shortest path towards provided destination, via either the root or away paths
Args:
dp_name (str): Destination DP
Returns:
Port: port from current node that is towards/away the destination DP depending on
relative position of the current node | faucet/valve_stack.py | relative_port_towards | pbatta/faucet | 0 | python | def relative_port_towards(self, dp_name):
'\n Returns the shortest path towards provided destination, via either the root or away paths\n\n Args:\n dp_name (str): Destination DP\n Returns:\n Port: port from current node that is towards/away the destination DP depending on\... | def relative_port_towards(self, dp_name):
'\n Returns the shortest path towards provided destination, via either the root or away paths\n\n Args:\n dp_name (str): Destination DP\n Returns:\n Port: port from current node that is towards/away the destination DP depending on\... |
48f8d3f31acae2455d48cf808c86eea3338f359b8e2ca731ac0dc3eba50d70d2 | def edge_learn_port_towards(self, pkt_meta, edge_dp):
'\n Returns the port towards the edge DP\n\n Args:\n pkt_meta (PacketMeta): Packet on the edge DP\n edge_dp (DP): Edge DP that received the packet\n Returns:\n Port: Port towards the edge DP via some stack ch... | Returns the port towards the edge DP
Args:
pkt_meta (PacketMeta): Packet on the edge DP
edge_dp (DP): Edge DP that received the packet
Returns:
Port: Port towards the edge DP via some stack chosen metric | faucet/valve_stack.py | edge_learn_port_towards | pbatta/faucet | 0 | python | def edge_learn_port_towards(self, pkt_meta, edge_dp):
'\n Returns the port towards the edge DP\n\n Args:\n pkt_meta (PacketMeta): Packet on the edge DP\n edge_dp (DP): Edge DP that received the packet\n Returns:\n Port: Port towards the edge DP via some stack ch... | def edge_learn_port_towards(self, pkt_meta, edge_dp):
'\n Returns the port towards the edge DP\n\n Args:\n pkt_meta (PacketMeta): Packet on the edge DP\n edge_dp (DP): Edge DP that received the packet\n Returns:\n Port: Port towards the edge DP via some stack ch... |
405d69265e8394cbf3f33bb9c3c8841f72b6f82abcb00942dd9666d89e23b9aa | def tunnel_outport(self, src_dp, dst_dp, dst_port):
'\n Returns the output port for the current stack node for the tunnel path\n\n Args:\n src_dp (str): Source DP name of the tunnel\n dst_dp (str): Destination DP name of the tunnel\n dst_port (int): Destination port of... | Returns the output port for the current stack node for the tunnel path
Args:
src_dp (str): Source DP name of the tunnel
dst_dp (str): Destination DP name of the tunnel
dst_port (int): Destination port of the tunnel
Returns:
int: Output port number for the current node of the tunnel | faucet/valve_stack.py | tunnel_outport | pbatta/faucet | 0 | python | def tunnel_outport(self, src_dp, dst_dp, dst_port):
'\n Returns the output port for the current stack node for the tunnel path\n\n Args:\n src_dp (str): Source DP name of the tunnel\n dst_dp (str): Destination DP name of the tunnel\n dst_port (int): Destination port of... | def tunnel_outport(self, src_dp, dst_dp, dst_port):
'\n Returns the output port for the current stack node for the tunnel path\n\n Args:\n src_dp (str): Source DP name of the tunnel\n dst_dp (str): Destination DP name of the tunnel\n dst_port (int): Destination port of... |
bfe6bac19d6f7a2890079b85cf895202626a76cfe7cc6d0b825e92e5c0f88c3b | def update_health(self, now, last_live_times, update_time):
'\n Returns whether the current stack node is healthy, a healthy stack node\n is one that attempted connected recently, or was known to be running\n recently, has all LAGs UP and any stack port UP\n\n Args:\n ... | Returns whether the current stack node is healthy, a healthy stack node
is one that attempted connected recently, or was known to be running
recently, has all LAGs UP and any stack port UP
Args:
now (float): Current time
last_live_times (dict): Last live time value for each DP
update_time (int): St... | faucet/valve_stack.py | update_health | pbatta/faucet | 0 | python | def update_health(self, now, last_live_times, update_time):
'\n Returns whether the current stack node is healthy, a healthy stack node\n is one that attempted connected recently, or was known to be running\n recently, has all LAGs UP and any stack port UP\n\n Args:\n ... | def update_health(self, now, last_live_times, update_time):
'\n Returns whether the current stack node is healthy, a healthy stack node\n is one that attempted connected recently, or was known to be running\n recently, has all LAGs UP and any stack port UP\n\n Args:\n ... |
b0a91da82ce570c5b44ceeb6ee3dac9d3f51b7787c3c782d251582316a587217 | def consistent_roots(self, expected_root_name, valve, other_valves):
'Returns true if all the stack nodes have the root configured correctly'
stacked_valves = {valve}.union(self.stacked_valves(other_valves))
for stack_valve in stacked_valves:
if (stack_valve.dp.stack.root_name != expected_root_name)... | Returns true if all the stack nodes have the root configured correctly | faucet/valve_stack.py | consistent_roots | pbatta/faucet | 0 | python | def consistent_roots(self, expected_root_name, valve, other_valves):
stacked_valves = {valve}.union(self.stacked_valves(other_valves))
for stack_valve in stacked_valves:
if (stack_valve.dp.stack.root_name != expected_root_name):
return False
return True | def consistent_roots(self, expected_root_name, valve, other_valves):
stacked_valves = {valve}.union(self.stacked_valves(other_valves))
for stack_valve in stacked_valves:
if (stack_valve.dp.stack.root_name != expected_root_name):
return False
return True<|docstring|>Returns true if a... |
5cbcc56e6a90f19fbaa3c95950d861c00ff22e06478e4c802f94714c1ff09ed8 | def nominate_stack_root(self, root_valve, other_valves, now, last_live_times, update_time):
'\n Nominate a new stack root\n\n Args:\n root_valve (Valve): Previous/current root Valve object\n other_valves (list): List of other valves (not including previous root)\n now ... | Nominate a new stack root
Args:
root_valve (Valve): Previous/current root Valve object
other_valves (list): List of other valves (not including previous root)
now (float): Current time
last_live_times (dict): Last live time value for each DP
update_time (int): Stack root update interval time
Return... | faucet/valve_stack.py | nominate_stack_root | pbatta/faucet | 0 | python | def nominate_stack_root(self, root_valve, other_valves, now, last_live_times, update_time):
'\n Nominate a new stack root\n\n Args:\n root_valve (Valve): Previous/current root Valve object\n other_valves (list): List of other valves (not including previous root)\n now ... | def nominate_stack_root(self, root_valve, other_valves, now, last_live_times, update_time):
'\n Nominate a new stack root\n\n Args:\n root_valve (Valve): Previous/current root Valve object\n other_valves (list): List of other valves (not including previous root)\n now ... |
b6235c6c2e1f8dcf44e7a58cb43fc355cf2eabe78ef016d0bd8b88a130f923d6 | def stack_ports(self):
'Yield the stack ports of this stack node'
for port in self.stack.ports:
(yield port) | Yield the stack ports of this stack node | faucet/valve_stack.py | stack_ports | pbatta/faucet | 0 | python | def stack_ports(self):
for port in self.stack.ports:
(yield port) | def stack_ports(self):
for port in self.stack.ports:
(yield port)<|docstring|>Yield the stack ports of this stack node<|endoftext|> |
55394c949396a3380f24059b1d99539baf27fd42f5140f0ed799e0d0941bec66 | def is_stack_port(self, port):
'Return whether the port is a stack port'
return bool(port.stack) | Return whether the port is a stack port | faucet/valve_stack.py | is_stack_port | pbatta/faucet | 0 | python | def is_stack_port(self, port):
return bool(port.stack) | def is_stack_port(self, port):
return bool(port.stack)<|docstring|>Return whether the port is a stack port<|endoftext|> |
8a5b9a3058a4e11357f248e8291c20a92b8811439be824bfb48df2b3968d5ae9 | def is_away(self, port):
'Return whether the port is an away port for the node'
return (port in self.away_ports) | Return whether the port is an away port for the node | faucet/valve_stack.py | is_away | pbatta/faucet | 0 | python | def is_away(self, port):
return (port in self.away_ports) | def is_away(self, port):
return (port in self.away_ports)<|docstring|>Return whether the port is an away port for the node<|endoftext|> |
f737913c00d6e6616edf58957bb0232e9756739a2ab6c39b1fb209c66a42ca78 | def is_towards_root(self, port):
'Return whether the port is a port towards the root for the node'
return (port in self.towards_root_ports) | Return whether the port is a port towards the root for the node | faucet/valve_stack.py | is_towards_root | pbatta/faucet | 0 | python | def is_towards_root(self, port):
return (port in self.towards_root_ports) | def is_towards_root(self, port):
return (port in self.towards_root_ports)<|docstring|>Return whether the port is a port towards the root for the node<|endoftext|> |
70dfc60cda6adbe23aafb141d4cef42b348f810ac6c315d16a881ce1508999e5 | def is_selected_towards_root_port(self, port):
'Return true if the port is the chosen towards root port'
return (port == self.chosen_towards_port) | Return true if the port is the chosen towards root port | faucet/valve_stack.py | is_selected_towards_root_port | pbatta/faucet | 0 | python | def is_selected_towards_root_port(self, port):
return (port == self.chosen_towards_port) | def is_selected_towards_root_port(self, port):
return (port == self.chosen_towards_port)<|docstring|>Return true if the port is the chosen towards root port<|endoftext|> |
bf9a24f96f975e3f4dac61561511e6529ad95b2692d5d0e23118520f8b25b326 | def is_pruned_port(self, port):
'Return true if the port is to be pruned'
if self.is_towards_root(port):
return (not self.is_selected_towards_root_port(port))
if self.is_away(port):
if self.pruned_away_ports:
return (port in self.pruned_away_ports)
return False
return... | Return true if the port is to be pruned | faucet/valve_stack.py | is_pruned_port | pbatta/faucet | 0 | python | def is_pruned_port(self, port):
if self.is_towards_root(port):
return (not self.is_selected_towards_root_port(port))
if self.is_away(port):
if self.pruned_away_ports:
return (port in self.pruned_away_ports)
return False
return True | def is_pruned_port(self, port):
if self.is_towards_root(port):
return (not self.is_selected_towards_root_port(port))
if self.is_away(port):
if self.pruned_away_ports:
return (port in self.pruned_away_ports)
return False
return True<|docstring|>Return true if the port... |
b3ce9b029eeb261491f9062abc74cfa191759083dbbf69dd7a7aa2495f032be7 | def adjacent_stack_ports(self, peer_dp):
'Return list of ports that connect to an adjacent DP'
return [port for port in self.stack.ports if (port.stack['dp'] == peer_dp)] | Return list of ports that connect to an adjacent DP | faucet/valve_stack.py | adjacent_stack_ports | pbatta/faucet | 0 | python | def adjacent_stack_ports(self, peer_dp):
return [port for port in self.stack.ports if (port.stack['dp'] == peer_dp)] | def adjacent_stack_ports(self, peer_dp):
return [port for port in self.stack.ports if (port.stack['dp'] == peer_dp)]<|docstring|>Return list of ports that connect to an adjacent DP<|endoftext|> |
2ca7fdee2d2c1c1d689756a2126a949fdb2ae39e747b3f56972e8246f8378496 | def acl_update_tunnel(self, acl):
'Return ofmsgs for all tunnels in an ACL with a tunnel rule'
ofmsgs = []
source_vids = defaultdict(list)
for (_id, tunnel_dest) in acl.tunnel_dests.items():
(dst_dp, dst_port) = (tunnel_dest['dst_dp'], tunnel_dest['dst_port'])
updated_sources = []
... | Return ofmsgs for all tunnels in an ACL with a tunnel rule | faucet/valve_stack.py | acl_update_tunnel | pbatta/faucet | 0 | python | def acl_update_tunnel(self, acl):
ofmsgs = []
source_vids = defaultdict(list)
for (_id, tunnel_dest) in acl.tunnel_dests.items():
(dst_dp, dst_port) = (tunnel_dest['dst_dp'], tunnel_dest['dst_port'])
updated_sources = []
for (source_id, source) in acl.tunnel_sources.items():
... | def acl_update_tunnel(self, acl):
ofmsgs = []
source_vids = defaultdict(list)
for (_id, tunnel_dest) in acl.tunnel_dests.items():
(dst_dp, dst_port) = (tunnel_dest['dst_dp'], tunnel_dest['dst_port'])
updated_sources = []
for (source_id, source) in acl.tunnel_sources.items():
... |
8821ca592f967fd9602dc533b63ba8c3a3ebaffc485521565a85800b7aeafb4f | def add_tunnel_acls(self):
'Returns ofmsgs installing the tunnel path rules'
ofmsgs = []
if self.tunnel_acls:
for acl in self.tunnel_acls:
ofmsgs.extend(self.acl_update_tunnel(acl))
return ofmsgs | Returns ofmsgs installing the tunnel path rules | faucet/valve_stack.py | add_tunnel_acls | pbatta/faucet | 0 | python | def add_tunnel_acls(self):
ofmsgs = []
if self.tunnel_acls:
for acl in self.tunnel_acls:
ofmsgs.extend(self.acl_update_tunnel(acl))
return ofmsgs | def add_tunnel_acls(self):
ofmsgs = []
if self.tunnel_acls:
for acl in self.tunnel_acls:
ofmsgs.extend(self.acl_update_tunnel(acl))
return ofmsgs<|docstring|>Returns ofmsgs installing the tunnel path rules<|endoftext|> |
c978c7595a43b9ad686cd0b92c315c03e6a338869eb230ecaea6d1d715401aca | def categorical_error(pred, label):
'\n Compute categorical error given score vectors and labels as\n numpy.ndarray.\n '
pred_label = pred.argmax(1)
return (pred_label != label.flat).mean() | Compute categorical error given score vectors and labels as
numpy.ndarray. | mnist-collection/classification_bnn.py | categorical_error | saulocatharino/nnabla-examples | 228 | python | def categorical_error(pred, label):
'\n Compute categorical error given score vectors and labels as\n numpy.ndarray.\n '
pred_label = pred.argmax(1)
return (pred_label != label.flat).mean() | def categorical_error(pred, label):
'\n Compute categorical error given score vectors and labels as\n numpy.ndarray.\n '
pred_label = pred.argmax(1)
return (pred_label != label.flat).mean()<|docstring|>Compute categorical error given score vectors and labels as
numpy.ndarray.<|endoftext|> |
d5c90b569f2c84757cb12a1acb9d50b12328ddda344d00c9a3dff3541d6945d0 | def mnist_binary_connect_lenet_prediction(image, test=False):
'\n Construct LeNet for MNIST (BinaryNet version).\n '
with nn.parameter_scope('conv1'):
c1 = PF.binary_connect_convolution(image, 16, (5, 5))
c1 = PF.batch_normalization(c1, batch_stat=(not test))
c1 = F.elu(F.average_p... | Construct LeNet for MNIST (BinaryNet version). | mnist-collection/classification_bnn.py | mnist_binary_connect_lenet_prediction | saulocatharino/nnabla-examples | 228 | python | def mnist_binary_connect_lenet_prediction(image, test=False):
'\n \n '
with nn.parameter_scope('conv1'):
c1 = PF.binary_connect_convolution(image, 16, (5, 5))
c1 = PF.batch_normalization(c1, batch_stat=(not test))
c1 = F.elu(F.average_pooling(c1, (2, 2)))
with nn.parameter_scop... | def mnist_binary_connect_lenet_prediction(image, test=False):
'\n \n '
with nn.parameter_scope('conv1'):
c1 = PF.binary_connect_convolution(image, 16, (5, 5))
c1 = PF.batch_normalization(c1, batch_stat=(not test))
c1 = F.elu(F.average_pooling(c1, (2, 2)))
with nn.parameter_scop... |
903b8bd2e9fad51a954f38a2fcd5bd3d61eaa98fbba34f2225a4afeb79278a78 | def mnist_binary_connect_resnet_prediction(image, test=False):
'\n Construct ResNet for MNIST (BinaryNet version).\n '
def bn(x):
return PF.batch_normalization(x, batch_stat=(not test))
def res_unit(x, scope):
C = x.shape[1]
with nn.parameter_scope(scope):
with nn... | Construct ResNet for MNIST (BinaryNet version). | mnist-collection/classification_bnn.py | mnist_binary_connect_resnet_prediction | saulocatharino/nnabla-examples | 228 | python | def mnist_binary_connect_resnet_prediction(image, test=False):
'\n \n '
def bn(x):
return PF.batch_normalization(x, batch_stat=(not test))
def res_unit(x, scope):
C = x.shape[1]
with nn.parameter_scope(scope):
with nn.parameter_scope('conv1'):
h = ... | def mnist_binary_connect_resnet_prediction(image, test=False):
'\n \n '
def bn(x):
return PF.batch_normalization(x, batch_stat=(not test))
def res_unit(x, scope):
C = x.shape[1]
with nn.parameter_scope(scope):
with nn.parameter_scope('conv1'):
h = ... |
0cf7ad2acceb70c53a06627430e6b269f726a982bdf6387c17087483c2b03f93 | def mnist_binary_net_lenet_prediction(image, test=False):
'\n Construct LeNet for MNIST (BinaryNet version).\n '
with nn.parameter_scope('conv1'):
c1 = PF.binary_connect_convolution(image, 16, (5, 5))
c1 = PF.batch_normalization(c1, batch_stat=(not test))
c1 = F.binary_tanh(F.avera... | Construct LeNet for MNIST (BinaryNet version). | mnist-collection/classification_bnn.py | mnist_binary_net_lenet_prediction | saulocatharino/nnabla-examples | 228 | python | def mnist_binary_net_lenet_prediction(image, test=False):
'\n \n '
with nn.parameter_scope('conv1'):
c1 = PF.binary_connect_convolution(image, 16, (5, 5))
c1 = PF.batch_normalization(c1, batch_stat=(not test))
c1 = F.binary_tanh(F.average_pooling(c1, (2, 2)))
with nn.parameter_... | def mnist_binary_net_lenet_prediction(image, test=False):
'\n \n '
with nn.parameter_scope('conv1'):
c1 = PF.binary_connect_convolution(image, 16, (5, 5))
c1 = PF.batch_normalization(c1, batch_stat=(not test))
c1 = F.binary_tanh(F.average_pooling(c1, (2, 2)))
with nn.parameter_... |
5b705b00e30647bc8ae1964a57b01f3c5660e3e6e501741ba956dd700ac22f35 | def mnist_binary_net_resnet_prediction(image, test=False):
'\n Construct ResNet for MNIST (BinaryNet version).\n '
def bn(x):
return PF.batch_normalization(x, batch_stat=(not test))
def res_unit(x, scope):
C = x.shape[1]
with nn.parameter_scope(scope):
with nn.par... | Construct ResNet for MNIST (BinaryNet version). | mnist-collection/classification_bnn.py | mnist_binary_net_resnet_prediction | saulocatharino/nnabla-examples | 228 | python | def mnist_binary_net_resnet_prediction(image, test=False):
'\n \n '
def bn(x):
return PF.batch_normalization(x, batch_stat=(not test))
def res_unit(x, scope):
C = x.shape[1]
with nn.parameter_scope(scope):
with nn.parameter_scope('conv1'):
h = F.bi... | def mnist_binary_net_resnet_prediction(image, test=False):
'\n \n '
def bn(x):
return PF.batch_normalization(x, batch_stat=(not test))
def res_unit(x, scope):
C = x.shape[1]
with nn.parameter_scope(scope):
with nn.parameter_scope('conv1'):
h = F.bi... |
3d6b1c13f621c03aef3b0d94e99491bcd9a8a785cbb1190d1052348dae111d98 | def mnist_binary_weight_lenet_prediction(image, test=False):
'\n Construct LeNet for MNIST (Binary Weight Network version).\n '
with nn.parameter_scope('conv1'):
c1 = PF.binary_weight_convolution(image, 16, (5, 5))
c1 = F.elu(F.average_pooling(c1, (2, 2)))
with nn.parameter_scope('conv... | Construct LeNet for MNIST (Binary Weight Network version). | mnist-collection/classification_bnn.py | mnist_binary_weight_lenet_prediction | saulocatharino/nnabla-examples | 228 | python | def mnist_binary_weight_lenet_prediction(image, test=False):
'\n \n '
with nn.parameter_scope('conv1'):
c1 = PF.binary_weight_convolution(image, 16, (5, 5))
c1 = F.elu(F.average_pooling(c1, (2, 2)))
with nn.parameter_scope('conv2'):
c2 = PF.binary_weight_convolution(c1, 16, (5,... | def mnist_binary_weight_lenet_prediction(image, test=False):
'\n \n '
with nn.parameter_scope('conv1'):
c1 = PF.binary_weight_convolution(image, 16, (5, 5))
c1 = F.elu(F.average_pooling(c1, (2, 2)))
with nn.parameter_scope('conv2'):
c2 = PF.binary_weight_convolution(c1, 16, (5,... |
2d48cc3aaf126030a312021917264dcc98f7903c5d1458420d4ed30f141b2d5e | def mnist_binary_weight_resnet_prediction(image, test=False):
'\n Construct ResNet for MNIST (Binary Weight Network version).\n '
def bn(x):
return PF.batch_normalization(x, batch_stat=(not test))
def res_unit(x, scope):
C = x.shape[1]
with nn.parameter_scope(scope):
... | Construct ResNet for MNIST (Binary Weight Network version). | mnist-collection/classification_bnn.py | mnist_binary_weight_resnet_prediction | saulocatharino/nnabla-examples | 228 | python | def mnist_binary_weight_resnet_prediction(image, test=False):
'\n \n '
def bn(x):
return PF.batch_normalization(x, batch_stat=(not test))
def res_unit(x, scope):
C = x.shape[1]
with nn.parameter_scope(scope):
with nn.parameter_scope('conv1'):
h = F... | def mnist_binary_weight_resnet_prediction(image, test=False):
'\n \n '
def bn(x):
return PF.batch_normalization(x, batch_stat=(not test))
def res_unit(x, scope):
C = x.shape[1]
with nn.parameter_scope(scope):
with nn.parameter_scope('conv1'):
h = F... |
39548ab799c6a52f1ea3993c0788ddf472c35f8560558e21e9c3c34396ab5296 | def train():
'\n Main script.\n\n Steps:\n\n * Parse command line arguments.\n * Specify a context for computation.\n * Initialize DataIterator for MNIST.\n * Construct a computation graph for training and validation.\n * Initialize a solver and set parameter variables to it.\n * Create moni... | Main script.
Steps:
* Parse command line arguments.
* Specify a context for computation.
* Initialize DataIterator for MNIST.
* Construct a computation graph for training and validation.
* Initialize a solver and set parameter variables to it.
* Create monitor instances for saving and displaying training stats.
* Tra... | mnist-collection/classification_bnn.py | train | saulocatharino/nnabla-examples | 228 | python | def train():
'\n Main script.\n\n Steps:\n\n * Parse command line arguments.\n * Specify a context for computation.\n * Initialize DataIterator for MNIST.\n * Construct a computation graph for training and validation.\n * Initialize a solver and set parameter variables to it.\n * Create moni... | def train():
'\n Main script.\n\n Steps:\n\n * Parse command line arguments.\n * Specify a context for computation.\n * Initialize DataIterator for MNIST.\n * Construct a computation graph for training and validation.\n * Initialize a solver and set parameter variables to it.\n * Create moni... |
23abf706f815274a233a0442813bcec8b32eb151779ca6993733e7f7d3153303 | def sort_by_seq_lens(args, batch, sequences_lengths, descending=True):
"\n Sort a batch of padded variable length sequences by their length.\n\n Args:\n batch: A batch of padded variable length sequences. The batch should\n have the dimensions (batch_size x max_sequence_length x *).\n ... | Sort a batch of padded variable length sequences by their length.
Args:
batch: A batch of padded variable length sequences. The batch should
have the dimensions (batch_size x max_sequence_length x *).
sequences_lengths: A tensor containing the lengths of the sequences in the
input batch. The te... | net/bert_lstm.py | sort_by_seq_lens | Wchoward/CskER | 0 | python | def sort_by_seq_lens(args, batch, sequences_lengths, descending=True):
"\n Sort a batch of padded variable length sequences by their length.\n\n Args:\n batch: A batch of padded variable length sequences. The batch should\n have the dimensions (batch_size x max_sequence_length x *).\n ... | def sort_by_seq_lens(args, batch, sequences_lengths, descending=True):
"\n Sort a batch of padded variable length sequences by their length.\n\n Args:\n batch: A batch of padded variable length sequences. The batch should\n have the dimensions (batch_size x max_sequence_length x *).\n ... |
afbedcde32341c1168df7233a690382f6b51577e877a03f7acdc7870f6851f43 | def challenge_get(self, environ, start_response):
'\n Respond to a GET request by sending a form.\n '
redirect = environ['tiddlyweb.query'].get('tiddlyweb_redirect', ['/'])[0]
return self._send_cookie_form(environ, start_response, redirect) | Respond to a GET request by sending a form. | tiddlyweb/web/challengers/cookie_form.py | challenge_get | angeluseve/tiddlyweb | 1 | python | def challenge_get(self, environ, start_response):
'\n \n '
redirect = environ['tiddlyweb.query'].get('tiddlyweb_redirect', ['/'])[0]
return self._send_cookie_form(environ, start_response, redirect) | def challenge_get(self, environ, start_response):
'\n \n '
redirect = environ['tiddlyweb.query'].get('tiddlyweb_redirect', ['/'])[0]
return self._send_cookie_form(environ, start_response, redirect)<|docstring|>Respond to a GET request by sending a form.<|endoftext|> |
87d23ef54187c576c80c86764d0de9540e90293372bd463a7daa2cdc3cd7dede | def challenge_post(self, environ, start_response):
'\n Respond to a POST by processing data sent from a form.\n The form should include a username and password. If it\n does not, send the form aagain. If it does, validate\n the data.\n '
query = environ['tiddlyweb.query']
... | Respond to a POST by processing data sent from a form.
The form should include a username and password. If it
does not, send the form aagain. If it does, validate
the data. | tiddlyweb/web/challengers/cookie_form.py | challenge_post | angeluseve/tiddlyweb | 1 | python | def challenge_post(self, environ, start_response):
'\n Respond to a POST by processing data sent from a form.\n The form should include a username and password. If it\n does not, send the form aagain. If it does, validate\n the data.\n '
query = environ['tiddlyweb.query']
... | def challenge_post(self, environ, start_response):
'\n Respond to a POST by processing data sent from a form.\n The form should include a username and password. If it\n does not, send the form aagain. If it does, validate\n the data.\n '
query = environ['tiddlyweb.query']
... |
ae6e6fbd2328994994a4407421e633153547742a6b45e1b671d1fccca311d46c | def _send_cookie_form(self, environ, start_response, redirect, status='200 OK', message=''):
'\n Send a simple form to the client asking for a username\n and password.\n '
start_response(status, [('Content-Type', 'text/html')])
environ['tiddlyweb.title'] = 'Cookie Based Login'
retur... | Send a simple form to the client asking for a username
and password. | tiddlyweb/web/challengers/cookie_form.py | _send_cookie_form | angeluseve/tiddlyweb | 1 | python | def _send_cookie_form(self, environ, start_response, redirect, status='200 OK', message=):
'\n Send a simple form to the client asking for a username\n and password.\n '
start_response(status, [('Content-Type', 'text/html')])
environ['tiddlyweb.title'] = 'Cookie Based Login'
return ... | def _send_cookie_form(self, environ, start_response, redirect, status='200 OK', message=):
'\n Send a simple form to the client asking for a username\n and password.\n '
start_response(status, [('Content-Type', 'text/html')])
environ['tiddlyweb.title'] = 'Cookie Based Login'
return ... |
16d747957b8749eabdf31fefad450c09d2ac1de4bceb8c174cbc42e40b31d489 | def _validate_and_redirect(self, environ, start_response, username, password, redirect):
'\n Check a username and password. If valid, send a cookie\n to the client. If it is not, send the form again.\n '
status = '401 Unauthorized'
try:
store = environ['tiddlyweb.store']
... | Check a username and password. If valid, send a cookie
to the client. If it is not, send the form again. | tiddlyweb/web/challengers/cookie_form.py | _validate_and_redirect | angeluseve/tiddlyweb | 1 | python | def _validate_and_redirect(self, environ, start_response, username, password, redirect):
'\n Check a username and password. If valid, send a cookie\n to the client. If it is not, send the form again.\n '
status = '401 Unauthorized'
try:
store = environ['tiddlyweb.store']
... | def _validate_and_redirect(self, environ, start_response, username, password, redirect):
'\n Check a username and password. If valid, send a cookie\n to the client. If it is not, send the form again.\n '
status = '401 Unauthorized'
try:
store = environ['tiddlyweb.store']
... |
3e4196c6bdb3a15538a027861080e81f7e870323ee03f964d0ba9b8225d12d5c | def test_download_mimic_demo(mimic_demo_path, mimic_demo_url, mimic_tables):
'\n Download the MIMIC demo to a local folder.\n '
r = urllib.request.urlopen(f'{mimic_demo_url}SHA256SUMS.txt')
sha_values = r.read().decode('utf-8').rstrip('\n')
sha_values = [x.split(' ') for x in sha_values.split('\n'... | Download the MIMIC demo to a local folder. | mimic-iii/tests/test_postgres_build.py | test_download_mimic_demo | kingpfogel/mimic-code | 1,626 | python | def test_download_mimic_demo(mimic_demo_path, mimic_demo_url, mimic_tables):
'\n \n '
r = urllib.request.urlopen(f'{mimic_demo_url}SHA256SUMS.txt')
sha_values = r.read().decode('utf-8').rstrip('\n')
sha_values = [x.split(' ') for x in sha_values.split('\n')]
sha_fn = [x[1] for x in sha_values]... | def test_download_mimic_demo(mimic_demo_path, mimic_demo_url, mimic_tables):
'\n \n '
r = urllib.request.urlopen(f'{mimic_demo_url}SHA256SUMS.txt')
sha_values = r.read().decode('utf-8').rstrip('\n')
sha_values = [x.split(' ') for x in sha_values.split('\n')]
sha_fn = [x[1] for x in sha_values]... |
2c0fb444ee274bbb1fcc28d4bd5b4bf2bc15a6029a064a6927d78f7d54f50f2e | def test_build_mimic_demo(mimic_demo_path, mimic_db_params, create_mimic_db):
'\n Try to build MIMIC-III demo using the make file and the downloaded data.\n '
build_path = os.path.join(os.getcwd(), 'mimic-iii', 'buildmimic', 'postgres/')
dbname = mimic_db_params['name']
dbpass = mimic_db_params['p... | Try to build MIMIC-III demo using the make file and the downloaded data. | mimic-iii/tests/test_postgres_build.py | test_build_mimic_demo | kingpfogel/mimic-code | 1,626 | python | def test_build_mimic_demo(mimic_demo_path, mimic_db_params, create_mimic_db):
'\n \n '
build_path = os.path.join(os.getcwd(), 'mimic-iii', 'buildmimic', 'postgres/')
dbname = mimic_db_params['name']
dbpass = mimic_db_params['password']
dbuser = mimic_db_params['user']
dbschema = mimic_db_p... | def test_build_mimic_demo(mimic_demo_path, mimic_db_params, create_mimic_db):
'\n \n '
build_path = os.path.join(os.getcwd(), 'mimic-iii', 'buildmimic', 'postgres/')
dbname = mimic_db_params['name']
dbpass = mimic_db_params['password']
dbuser = mimic_db_params['user']
dbschema = mimic_db_p... |
d8a09e76ecded49d3632d1506fc194184c231e07d0146a2998bda1378d271710 | def test_db_con(mimic_con):
'\n Check we can select from the database.\n '
test_query = "SELECT 'another hello world';"
hello_world = pd.read_sql_query(test_query, mimic_con)
assert (hello_world.values[0][0] == 'another hello world') | Check we can select from the database. | mimic-iii/tests/test_postgres_build.py | test_db_con | kingpfogel/mimic-code | 1,626 | python | def test_db_con(mimic_con):
'\n \n '
test_query = "SELECT 'another hello world';"
hello_world = pd.read_sql_query(test_query, mimic_con)
assert (hello_world.values[0][0] == 'another hello world') | def test_db_con(mimic_con):
'\n \n '
test_query = "SELECT 'another hello world';"
hello_world = pd.read_sql_query(test_query, mimic_con)
assert (hello_world.values[0][0] == 'another hello world')<|docstring|>Check we can select from the database.<|endoftext|> |
4e0e7ed4879536a0c45985b0476713c3e56fa450088703e591dadeef1b02accc | def test_select_min_subject_id(mimic_con, mimic_schema):
'\n Minimum subject_id in the demo is 10006\n '
test_query = f'''
SELECT min(subject_id)
FROM {mimic_schema}.patients;
'''
min_id = pd.read_sql_query(test_query, mimic_con)
assert (min_id.values[0][0] == 10006) | Minimum subject_id in the demo is 10006 | mimic-iii/tests/test_postgres_build.py | test_select_min_subject_id | kingpfogel/mimic-code | 1,626 | python | def test_select_min_subject_id(mimic_con, mimic_schema):
'\n \n '
test_query = f'
SELECT min(subject_id)
FROM {mimic_schema}.patients;
'
min_id = pd.read_sql_query(test_query, mimic_con)
assert (min_id.values[0][0] == 10006) | def test_select_min_subject_id(mimic_con, mimic_schema):
'\n \n '
test_query = f'
SELECT min(subject_id)
FROM {mimic_schema}.patients;
'
min_id = pd.read_sql_query(test_query, mimic_con)
assert (min_id.values[0][0] == 10006)<|docstring|>Minimum subject_id in the demo is 10006<|endoftex... |
cf21ca543ac00d7a5492e9bf094e84ccb08e95218b335c7c6931f87fb0e88aa3 | def test_itemids_in_inputevents_cv_are_shifted(mimic_con, mimic_schema):
'\n Number of ITEMIDs which were erroneously left as original value\n '
query = f'''
SELECT COUNT(*) FROM {mimic_schema}.inputevents_cv
WHERE itemid < 30000;
'''
queryresult = pd.read_sql_query(query, mimic_con)
a... | Number of ITEMIDs which were erroneously left as original value | mimic-iii/tests/test_postgres_build.py | test_itemids_in_inputevents_cv_are_shifted | kingpfogel/mimic-code | 1,626 | python | def test_itemids_in_inputevents_cv_are_shifted(mimic_con, mimic_schema):
'\n \n '
query = f'
SELECT COUNT(*) FROM {mimic_schema}.inputevents_cv
WHERE itemid < 30000;
'
queryresult = pd.read_sql_query(query, mimic_con)
assert (queryresult.values[0][0] == 0) | def test_itemids_in_inputevents_cv_are_shifted(mimic_con, mimic_schema):
'\n \n '
query = f'
SELECT COUNT(*) FROM {mimic_schema}.inputevents_cv
WHERE itemid < 30000;
'
queryresult = pd.read_sql_query(query, mimic_con)
assert (queryresult.values[0][0] == 0)<|docstring|>Number of ITEMIDs... |
72b18f4a5b238e67af4ecf9b0364695a78650b8e927cfda5bf0aed03ca84b248 | def test_itemids_in_inputevents_mv_are_shifted(mimic_con, mimic_schema):
'\n Number of ITEMIDs which were erroneously left as original value\n '
query = f'''
SELECT COUNT(*) FROM {mimic_schema}.inputevents_mv
WHERE itemid < 220000;
'''
queryresult = pd.read_sql_query(query, mimic_con)
... | Number of ITEMIDs which were erroneously left as original value | mimic-iii/tests/test_postgres_build.py | test_itemids_in_inputevents_mv_are_shifted | kingpfogel/mimic-code | 1,626 | python | def test_itemids_in_inputevents_mv_are_shifted(mimic_con, mimic_schema):
'\n \n '
query = f'
SELECT COUNT(*) FROM {mimic_schema}.inputevents_mv
WHERE itemid < 220000;
'
queryresult = pd.read_sql_query(query, mimic_con)
assert (queryresult.values[0][0] == 0) | def test_itemids_in_inputevents_mv_are_shifted(mimic_con, mimic_schema):
'\n \n '
query = f'
SELECT COUNT(*) FROM {mimic_schema}.inputevents_mv
WHERE itemid < 220000;
'
queryresult = pd.read_sql_query(query, mimic_con)
assert (queryresult.values[0][0] == 0)<|docstring|>Number of ITEMID... |
ec0812d63a80d9bfaece38ddb8fde608c5e6685d93dadbe3867fd4d21be87d99 | def test_itemids_in_outputevents_are_shifted(mimic_con, mimic_schema):
'\n Number of ITEMIDs which were erroneously left as original value\n '
query = f'''
SELECT COUNT(*) FROM {mimic_schema}.outputevents
WHERE itemid < 30000;
'''
queryresult = pd.read_sql_query(query, mimic_con)
asser... | Number of ITEMIDs which were erroneously left as original value | mimic-iii/tests/test_postgres_build.py | test_itemids_in_outputevents_are_shifted | kingpfogel/mimic-code | 1,626 | python | def test_itemids_in_outputevents_are_shifted(mimic_con, mimic_schema):
'\n \n '
query = f'
SELECT COUNT(*) FROM {mimic_schema}.outputevents
WHERE itemid < 30000;
'
queryresult = pd.read_sql_query(query, mimic_con)
assert (queryresult.values[0][0] == 0) | def test_itemids_in_outputevents_are_shifted(mimic_con, mimic_schema):
'\n \n '
query = f'
SELECT COUNT(*) FROM {mimic_schema}.outputevents
WHERE itemid < 30000;
'
queryresult = pd.read_sql_query(query, mimic_con)
assert (queryresult.values[0][0] == 0)<|docstring|>Number of ITEMIDs whi... |
80deeea6074aceec3ffee22c25b21f756740b0dc882daa59a2d17184e9eff2d2 | def test_itemids_in_inputevents_cv_are_in_range(mimic_con, mimic_schema):
'\n Number of ITEMIDs which are above the allowable range\n '
query = f'''
SELECT COUNT(*) FROM {mimic_schema}.inputevents_cv
WHERE itemid > 50000;
'''
queryresult = pd.read_sql_query(query, mimic_con)
assert (qu... | Number of ITEMIDs which are above the allowable range | mimic-iii/tests/test_postgres_build.py | test_itemids_in_inputevents_cv_are_in_range | kingpfogel/mimic-code | 1,626 | python | def test_itemids_in_inputevents_cv_are_in_range(mimic_con, mimic_schema):
'\n \n '
query = f'
SELECT COUNT(*) FROM {mimic_schema}.inputevents_cv
WHERE itemid > 50000;
'
queryresult = pd.read_sql_query(query, mimic_con)
assert (queryresult.values[0][0] == 0) | def test_itemids_in_inputevents_cv_are_in_range(mimic_con, mimic_schema):
'\n \n '
query = f'
SELECT COUNT(*) FROM {mimic_schema}.inputevents_cv
WHERE itemid > 50000;
'
queryresult = pd.read_sql_query(query, mimic_con)
assert (queryresult.values[0][0] == 0)<|docstring|>Number of ITEMID... |
d08f6abc7ae71ed11e55f4b86055119c6b0acf30054fad3703e3d130961563fd | def test_itemids_in_outputevents_are_in_range(mimic_con, mimic_schema):
'\n Number of ITEMIDs which are not in the allowable range\n '
query = f'''
SELECT COUNT(*) FROM {mimic_schema}.outputevents
WHERE itemid > 50000 AND itemid < 220000;
'''
queryresult = pd.read_sql_query(query, mimic_co... | Number of ITEMIDs which are not in the allowable range | mimic-iii/tests/test_postgres_build.py | test_itemids_in_outputevents_are_in_range | kingpfogel/mimic-code | 1,626 | python | def test_itemids_in_outputevents_are_in_range(mimic_con, mimic_schema):
'\n \n '
query = f'
SELECT COUNT(*) FROM {mimic_schema}.outputevents
WHERE itemid > 50000 AND itemid < 220000;
'
queryresult = pd.read_sql_query(query, mimic_con)
assert (queryresult.values[0][0] == 0) | def test_itemids_in_outputevents_are_in_range(mimic_con, mimic_schema):
'\n \n '
query = f'
SELECT COUNT(*) FROM {mimic_schema}.outputevents
WHERE itemid > 50000 AND itemid < 220000;
'
queryresult = pd.read_sql_query(query, mimic_con)
assert (queryresult.values[0][0] == 0)<|docstring|>... |
cfe551b6428a1e98950c90c16f05eed4c0743f0a96f98ecc7b4fe35ea068d77a | def test_itemids_in_chartevents_are_in_range(mimic_con, mimic_schema):
'\n Number of ITEMIDs which are not in the allowable range\n '
query = f'''
SELECT COUNT(*) FROM {mimic_schema}.chartevents
WHERE itemid > 20000 AND itemid < 220000;
'''
queryresult = pd.read_sql_query(query, mimic_con)... | Number of ITEMIDs which are not in the allowable range | mimic-iii/tests/test_postgres_build.py | test_itemids_in_chartevents_are_in_range | kingpfogel/mimic-code | 1,626 | python | def test_itemids_in_chartevents_are_in_range(mimic_con, mimic_schema):
'\n \n '
query = f'
SELECT COUNT(*) FROM {mimic_schema}.chartevents
WHERE itemid > 20000 AND itemid < 220000;
'
queryresult = pd.read_sql_query(query, mimic_con)
assert (queryresult.values[0][0] == 0) | def test_itemids_in_chartevents_are_in_range(mimic_con, mimic_schema):
'\n \n '
query = f'
SELECT COUNT(*) FROM {mimic_schema}.chartevents
WHERE itemid > 20000 AND itemid < 220000;
'
queryresult = pd.read_sql_query(query, mimic_con)
assert (queryresult.values[0][0] == 0)<|docstring|>Nu... |
091d3d38319d8098e9d2cd567bbd30ad4e4d01258bf62209637e9d67e49f5e95 | def test_itemids_in_procedureevents_mv_are_in_range(mimic_con, mimic_schema):
'\n Number of ITEMIDs which are not in the allowable range\n '
query = f'''
SELECT COUNT(*) FROM {mimic_schema}.procedureevents_mv
WHERE itemid < 220000;
'''
queryresult = pd.read_sql_query(query, mimic_con)
... | Number of ITEMIDs which are not in the allowable range | mimic-iii/tests/test_postgres_build.py | test_itemids_in_procedureevents_mv_are_in_range | kingpfogel/mimic-code | 1,626 | python | def test_itemids_in_procedureevents_mv_are_in_range(mimic_con, mimic_schema):
'\n \n '
query = f'
SELECT COUNT(*) FROM {mimic_schema}.procedureevents_mv
WHERE itemid < 220000;
'
queryresult = pd.read_sql_query(query, mimic_con)
assert (queryresult.values[0][0] == 0) | def test_itemids_in_procedureevents_mv_are_in_range(mimic_con, mimic_schema):
'\n \n '
query = f'
SELECT COUNT(*) FROM {mimic_schema}.procedureevents_mv
WHERE itemid < 220000;
'
queryresult = pd.read_sql_query(query, mimic_con)
assert (queryresult.values[0][0] == 0)<|docstring|>Number ... |
ef9f6211af3a2167f925cce07ee906010641ef506e87e0a6cb91432691f9f8c5 | def test_itemids_in_labevents_are_in_range(mimic_con, mimic_schema):
'\n Number of ITEMIDs which are not in the allowable range\n '
query = f'''
SELECT COUNT(*) FROM {mimic_schema}.labevents
WHERE itemid < 50000 OR itemid > 60000;
'''
queryresult = pd.read_sql_query(query, mimic_con)
a... | Number of ITEMIDs which are not in the allowable range | mimic-iii/tests/test_postgres_build.py | test_itemids_in_labevents_are_in_range | kingpfogel/mimic-code | 1,626 | python | def test_itemids_in_labevents_are_in_range(mimic_con, mimic_schema):
'\n \n '
query = f'
SELECT COUNT(*) FROM {mimic_schema}.labevents
WHERE itemid < 50000 OR itemid > 60000;
'
queryresult = pd.read_sql_query(query, mimic_con)
assert (queryresult.values[0][0] == 0) | def test_itemids_in_labevents_are_in_range(mimic_con, mimic_schema):
'\n \n '
query = f'
SELECT COUNT(*) FROM {mimic_schema}.labevents
WHERE itemid < 50000 OR itemid > 60000;
'
queryresult = pd.read_sql_query(query, mimic_con)
assert (queryresult.values[0][0] == 0)<|docstring|>Number o... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.