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 |
|---|---|---|---|---|---|---|---|---|---|
7a339fc6311f8b392412a46f8e57b0a854195c8db17de5048b039b86d3862c54 | def powerset(lst):
'returns the power set of the list - the set of all subsets of the list'
if (lst == []):
return [[]]
lose_it = powerset(lst[1:])
use_it = map((lambda subset: ([lst[0]] + subset)), lose_it)
return (lose_it + use_it) | returns the power set of the list - the set of all subsets of the list | use_it_or_lose_it.py | powerset | jschmidtnj/CS115 | 0 | python | def powerset(lst):
if (lst == []):
return [[]]
lose_it = powerset(lst[1:])
use_it = map((lambda subset: ([lst[0]] + subset)), lose_it)
return (lose_it + use_it) | def powerset(lst):
if (lst == []):
return [[]]
lose_it = powerset(lst[1:])
use_it = map((lambda subset: ([lst[0]] + subset)), lose_it)
return (lose_it + use_it)<|docstring|>returns the power set of the list - the set of all subsets of the list<|endoftext|> |
257b4f313c5f30370c50cf47a804da8fd504f7a0a4b473f22827338d1f938ca1 | def subset(target, lst):
'determines whether or not it is possible to create target sum using the\n values in the list. Values in teh list can be positive, negative, or zero.'
if (target == 0):
return True
if (lst == []):
return False
'and and or are short-cut operators in python. THe... | determines whether or not it is possible to create target sum using the
values in the list. Values in teh list can be positive, negative, or zero. | use_it_or_lose_it.py | subset | jschmidtnj/CS115 | 0 | python | def subset(target, lst):
'determines whether or not it is possible to create target sum using the\n values in the list. Values in teh list can be positive, negative, or zero.'
if (target == 0):
return True
if (lst == []):
return False
'and and or are short-cut operators in python. THe... | def subset(target, lst):
'determines whether or not it is possible to create target sum using the\n values in the list. Values in teh list can be positive, negative, or zero.'
if (target == 0):
return True
if (lst == []):
return False
'and and or are short-cut operators in python. THe... |
e5e49f26aec371324d72fd1089feb485b3addb2839d16eb174d981fbcf0e1500 | def subset_with_values(target, lst):
'Determines whether or not it is possible to create the target sum using\n values in the list. Values in the list can be positive, negative, or zero.\n The function returns a tuple of exactly two items. The first is a boolean,\n that indicates true if the sum is possibl... | Determines whether or not it is possible to create the target sum using
values in the list. Values in the list can be positive, negative, or zero.
The function returns a tuple of exactly two items. The first is a boolean,
that indicates true if the sum is possible and false if it is not. The second
element in the tuple... | use_it_or_lose_it.py | subset_with_values | jschmidtnj/CS115 | 0 | python | def subset_with_values(target, lst):
'Determines whether or not it is possible to create the target sum using\n values in the list. Values in the list can be positive, negative, or zero.\n The function returns a tuple of exactly two items. The first is a boolean,\n that indicates true if the sum is possibl... | def subset_with_values(target, lst):
'Determines whether or not it is possible to create the target sum using\n values in the list. Values in the list can be positive, negative, or zero.\n The function returns a tuple of exactly two items. The first is a boolean,\n that indicates true if the sum is possibl... |
1180aef177e00a7195b28a252cbc0d5dfcf793d862a5056a21f57cfa9db9dce4 | def LCSWithValues(S1, S2):
'returns the longest common string'
if ((S1 == '') or (S2 == '')):
return (0, '')
if (S1[0] == S2[0]):
result = LCSWithValues(S1[1:], S2[1:])
return ((1 + result[0]), (S1[0] + result[1]))
useS1 = LCSWithValues(S1, S2[1:])
useS2 = LCSWithValues(S1[1:... | returns the longest common string | use_it_or_lose_it.py | LCSWithValues | jschmidtnj/CS115 | 0 | python | def LCSWithValues(S1, S2):
if ((S1 == ) or (S2 == )):
return (0, )
if (S1[0] == S2[0]):
result = LCSWithValues(S1[1:], S2[1:])
return ((1 + result[0]), (S1[0] + result[1]))
useS1 = LCSWithValues(S1, S2[1:])
useS2 = LCSWithValues(S1[1:], S2)
if (useS1[0] > useS2[0]):
... | def LCSWithValues(S1, S2):
if ((S1 == ) or (S2 == )):
return (0, )
if (S1[0] == S2[0]):
result = LCSWithValues(S1[1:], S2[1:])
return ((1 + result[0]), (S1[0] + result[1]))
useS1 = LCSWithValues(S1, S2[1:])
useS2 = LCSWithValues(S1[1:], S2)
if (useS1[0] > useS2[0]):
... |
a8cc646fceff27f6807c527fcc5de9e4cc0225b42d31a8472307206b12926af3 | def _get_all_query_string(self, changelist):
"\n If there's a default value set the all parameter needs to be provided\n however, if a default is not set the all parameter is not required.\n "
if self.default_filter_value:
return changelist.get_query_string({self.parameter_name: sel... | If there's a default value set the all parameter needs to be provided
however, if a default is not set the all parameter is not required. | djangocms_content_expiry/filters.py | _get_all_query_string | Aiky30/djangocms-content-expiry | 0 | python | def _get_all_query_string(self, changelist):
"\n If there's a default value set the all parameter needs to be provided\n however, if a default is not set the all parameter is not required.\n "
if self.default_filter_value:
return changelist.get_query_string({self.parameter_name: sel... | def _get_all_query_string(self, changelist):
"\n If there's a default value set the all parameter needs to be provided\n however, if a default is not set the all parameter is not required.\n "
if self.default_filter_value:
return changelist.get_query_string({self.parameter_name: sel... |
c9a9b792051ccf98b58fe3e340309a60dddae0809d3298f406372c96fd4945d0 | def beta_create_ImageAnnotator_server(servicer, pool=None, pool_size=None, default_timeout=None, maximum_timeout=None):
'The Beta API is deprecated for 0.15.0 and later.\n\n It is recommended to use the GA API (classes and functions in this\n file not marked beta) for all further purposes. This function was\n... | The Beta API is deprecated for 0.15.0 and later.
It is recommended to use the GA API (classes and functions in this
file not marked beta) for all further purposes. This function was
generated only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0 | vision/google/cloud/vision_v1p1beta1/proto/image_annotator_pb2.py | beta_create_ImageAnnotator_server | maheshgurav/google-cloud-python | 2 | python | def beta_create_ImageAnnotator_server(servicer, pool=None, pool_size=None, default_timeout=None, maximum_timeout=None):
'The Beta API is deprecated for 0.15.0 and later.\n\n It is recommended to use the GA API (classes and functions in this\n file not marked beta) for all further purposes. This function was\n... | def beta_create_ImageAnnotator_server(servicer, pool=None, pool_size=None, default_timeout=None, maximum_timeout=None):
'The Beta API is deprecated for 0.15.0 and later.\n\n It is recommended to use the GA API (classes and functions in this\n file not marked beta) for all further purposes. This function was\n... |
370c1936ef489eb7ee1b51965491fe537a9911ba2a33d3a3330134554a24997c | def beta_create_ImageAnnotator_stub(channel, host=None, metadata_transformer=None, pool=None, pool_size=None):
'The Beta API is deprecated for 0.15.0 and later.\n\n It is recommended to use the GA API (classes and functions in this\n file not marked beta) for all further purposes. This function was\n gener... | The Beta API is deprecated for 0.15.0 and later.
It is recommended to use the GA API (classes and functions in this
file not marked beta) for all further purposes. This function was
generated only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0 | vision/google/cloud/vision_v1p1beta1/proto/image_annotator_pb2.py | beta_create_ImageAnnotator_stub | maheshgurav/google-cloud-python | 2 | python | def beta_create_ImageAnnotator_stub(channel, host=None, metadata_transformer=None, pool=None, pool_size=None):
'The Beta API is deprecated for 0.15.0 and later.\n\n It is recommended to use the GA API (classes and functions in this\n file not marked beta) for all further purposes. This function was\n gener... | def beta_create_ImageAnnotator_stub(channel, host=None, metadata_transformer=None, pool=None, pool_size=None):
'The Beta API is deprecated for 0.15.0 and later.\n\n It is recommended to use the GA API (classes and functions in this\n file not marked beta) for all further purposes. This function was\n gener... |
a2da290fda118c851c1d28cf948bc178738790ba0bc9027eda999f069bc99794 | def __init__(self, channel):
'Constructor.\n\n Args:\n channel: A grpc.Channel.\n '
self.BatchAnnotateImages = channel.unary_unary('/google.cloud.vision.v1p1beta1.ImageAnnotator/BatchAnnotateImages', request_serializer=BatchAnnotateImagesRequest.SerializeToString, response_deserializer=BatchAnn... | Constructor.
Args:
channel: A grpc.Channel. | vision/google/cloud/vision_v1p1beta1/proto/image_annotator_pb2.py | __init__ | maheshgurav/google-cloud-python | 2 | python | def __init__(self, channel):
'Constructor.\n\n Args:\n channel: A grpc.Channel.\n '
self.BatchAnnotateImages = channel.unary_unary('/google.cloud.vision.v1p1beta1.ImageAnnotator/BatchAnnotateImages', request_serializer=BatchAnnotateImagesRequest.SerializeToString, response_deserializer=BatchAnn... | def __init__(self, channel):
'Constructor.\n\n Args:\n channel: A grpc.Channel.\n '
self.BatchAnnotateImages = channel.unary_unary('/google.cloud.vision.v1p1beta1.ImageAnnotator/BatchAnnotateImages', request_serializer=BatchAnnotateImagesRequest.SerializeToString, response_deserializer=BatchAnn... |
687d56eb0494d3fc806bb634bc9463d25c10413281d39682fde3a365ef582b92 | def BatchAnnotateImages(self, request, context):
'Run image detection and annotation for a batch of images.\n '
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!') | Run image detection and annotation for a batch of images. | vision/google/cloud/vision_v1p1beta1/proto/image_annotator_pb2.py | BatchAnnotateImages | maheshgurav/google-cloud-python | 2 | python | def BatchAnnotateImages(self, request, context):
'\n '
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!') | def BatchAnnotateImages(self, request, context):
'\n '
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')<|docstring|>Run image detection and annotation for a batch of images.<|endoftext|> |
8e238283f42b7c6507b7c2685cd7fb595fe1bc5630818a592e0b3e85929974bb | def BatchAnnotateImages(self, request, context):
'Run image detection and annotation for a batch of images.\n '
context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) | Run image detection and annotation for a batch of images. | vision/google/cloud/vision_v1p1beta1/proto/image_annotator_pb2.py | BatchAnnotateImages | maheshgurav/google-cloud-python | 2 | python | def BatchAnnotateImages(self, request, context):
'\n '
context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) | def BatchAnnotateImages(self, request, context):
'\n '
context.code(beta_interfaces.StatusCode.UNIMPLEMENTED)<|docstring|>Run image detection and annotation for a batch of images.<|endoftext|> |
28c1177cafbf93b16b8fb11a735ddc9c2b716213068ec5907cc4a138da2dc75d | def BatchAnnotateImages(self, request, timeout, metadata=None, with_call=False, protocol_options=None):
'Run image detection and annotation for a batch of images.\n '
raise NotImplementedError() | Run image detection and annotation for a batch of images. | vision/google/cloud/vision_v1p1beta1/proto/image_annotator_pb2.py | BatchAnnotateImages | maheshgurav/google-cloud-python | 2 | python | def BatchAnnotateImages(self, request, timeout, metadata=None, with_call=False, protocol_options=None):
'\n '
raise NotImplementedError() | def BatchAnnotateImages(self, request, timeout, metadata=None, with_call=False, protocol_options=None):
'\n '
raise NotImplementedError()<|docstring|>Run image detection and annotation for a batch of images.<|endoftext|> |
0a6bd40143cf35e10584ddbc9dd4dfc514dd7cbb0320dac4de8b715ba26a52e1 | def group_policies_gen(flat_policies, config):
'Filter policies using the following steps:\n 1. Apply prioritization among the policies that are sharing the same policy type and resource type\n 2. Remove redundant policies that may applicable across different types of resource\n 3. Filter policies based on... | Filter policies using the following steps:
1. Apply prioritization among the policies that are sharing the same policy type and resource type
2. Remove redundant policies that may applicable across different types of resource
3. Filter policies based on type and return
:param flat_policies: list of flat policies
:retur... | osdf/adapters/policy/utils.py | group_policies_gen | onap/optf-osdf | 3 | python | def group_policies_gen(flat_policies, config):
'Filter policies using the following steps:\n 1. Apply prioritization among the policies that are sharing the same policy type and resource type\n 2. Remove redundant policies that may applicable across different types of resource\n 3. Filter policies based on... | def group_policies_gen(flat_policies, config):
'Filter policies using the following steps:\n 1. Apply prioritization among the policies that are sharing the same policy type and resource type\n 2. Remove redundant policies that may applicable across different types of resource\n 3. Filter policies based on... |
062d19282643ea28b229b8ee01f69b653f3f0df8a5fa9f5a87da2ab7e4b90f85 | def policy_name_as_regex(policy_name):
'Get the correct policy name as a regex\n (e.g. OOF_HAS_vCPE.cloudAttributePolicy ends up in policy as OOF_HAS_vCPE.Config_MS_cloudAttributePolicy.1.xml\n So, for now, we query it as OOF_HAS_vCPE..*aicAttributePolicy.*)\n :param policy_name: Example: OOF_HAS_vCPE.aicA... | Get the correct policy name as a regex
(e.g. OOF_HAS_vCPE.cloudAttributePolicy ends up in policy as OOF_HAS_vCPE.Config_MS_cloudAttributePolicy.1.xml
So, for now, we query it as OOF_HAS_vCPE..*aicAttributePolicy.*)
:param policy_name: Example: OOF_HAS_vCPE.aicAttributePolicy
:return: regexp for policy: Example: OOF_HAS... | osdf/adapters/policy/utils.py | policy_name_as_regex | onap/optf-osdf | 3 | python | def policy_name_as_regex(policy_name):
'Get the correct policy name as a regex\n (e.g. OOF_HAS_vCPE.cloudAttributePolicy ends up in policy as OOF_HAS_vCPE.Config_MS_cloudAttributePolicy.1.xml\n So, for now, we query it as OOF_HAS_vCPE..*aicAttributePolicy.*)\n :param policy_name: Example: OOF_HAS_vCPE.aicA... | def policy_name_as_regex(policy_name):
'Get the correct policy name as a regex\n (e.g. OOF_HAS_vCPE.cloudAttributePolicy ends up in policy as OOF_HAS_vCPE.Config_MS_cloudAttributePolicy.1.xml\n So, for now, we query it as OOF_HAS_vCPE..*aicAttributePolicy.*)\n :param policy_name: Example: OOF_HAS_vCPE.aicA... |
bdf5bed08bce51cf67b9e5afdadec72394e895e47f85cf2789da6ec905b351bd | def retrieve_node(req_json, reference):
'\n Get the child node(s) from the dot-notation [reference] and parent [req_json].\n For placement and other requests, there are encoded JSONs inside the request or policy,\n so we need to expand it and then do a search over the parent plus expanded JSON.\n '
... | Get the child node(s) from the dot-notation [reference] and parent [req_json].
For placement and other requests, there are encoded JSONs inside the request or policy,
so we need to expand it and then do a search over the parent plus expanded JSON. | osdf/adapters/policy/utils.py | retrieve_node | onap/optf-osdf | 3 | python | def retrieve_node(req_json, reference):
'\n Get the child node(s) from the dot-notation [reference] and parent [req_json].\n For placement and other requests, there are encoded JSONs inside the request or policy,\n so we need to expand it and then do a search over the parent plus expanded JSON.\n '
... | def retrieve_node(req_json, reference):
'\n Get the child node(s) from the dot-notation [reference] and parent [req_json].\n For placement and other requests, there are encoded JSONs inside the request or policy,\n so we need to expand it and then do a search over the parent plus expanded JSON.\n '
... |
452e00bf3fad0eed21edb9818f1d1abb74fd449c0b15ae7f4948e630fca94431 | def reroot(root: expression.Expression, source_path: path.Path) -> expression.Expression:
'Reroot to a new path, maintaining a input proto index.\n\n Similar to root.get_descendant_or_error(source_path): however, this\n method retains the ability to get a map to the original index.\n\n Args:\n root: the origi... | Reroot to a new path, maintaining a input proto index.
Similar to root.get_descendant_or_error(source_path): however, this
method retains the ability to get a map to the original index.
Args:
root: the original root.
source_path: the path to the new root.
Returns:
the new root. | struct2tensor/expression_impl/reroot.py | reroot | rtg0795/struct2tensor | 30 | python | def reroot(root: expression.Expression, source_path: path.Path) -> expression.Expression:
'Reroot to a new path, maintaining a input proto index.\n\n Similar to root.get_descendant_or_error(source_path): however, this\n method retains the ability to get a map to the original index.\n\n Args:\n root: the origi... | def reroot(root: expression.Expression, source_path: path.Path) -> expression.Expression:
'Reroot to a new path, maintaining a input proto index.\n\n Similar to root.get_descendant_or_error(source_path): however, this\n method retains the ability to get a map to the original index.\n\n Args:\n root: the origi... |
60cc06c617833833ea0b4eb9eb5ed3abfaf66e6fe3d72959027696478e3cc3fb | def __init__(self, root: expression.Expression):
'Constructor for proto index expression.\n\n Args:\n root: an expression that must return a RootNodeTensor.\n '
super().__init__(is_repeated=False, my_type=tf.int64)
self._root = root | Constructor for proto index expression.
Args:
root: an expression that must return a RootNodeTensor. | struct2tensor/expression_impl/reroot.py | __init__ | rtg0795/struct2tensor | 30 | python | def __init__(self, root: expression.Expression):
'Constructor for proto index expression.\n\n Args:\n root: an expression that must return a RootNodeTensor.\n '
super().__init__(is_repeated=False, my_type=tf.int64)
self._root = root | def __init__(self, root: expression.Expression):
'Constructor for proto index expression.\n\n Args:\n root: an expression that must return a RootNodeTensor.\n '
super().__init__(is_repeated=False, my_type=tf.int64)
self._root = root<|docstring|>Constructor for proto index expression.
Args:
roo... |
ffa937f5db47b155553aeaea89fc591426c962d98036f068aeac9dd960177503 | def _prediction_loop(self, dataloader: DataLoader, description: str, task_name: str, mode: str, prediction_loss_only: Optional[bool]=None) -> PredictionOutput:
'\n Prediction/evaluation loop, shared by `evaluate()` and `predict()`.\n Works both with or without labels.\n '
prediction_loss_on... | Prediction/evaluation loop, shared by `evaluate()` and `predict()`.
Works both with or without labels. | src/mtl_trainer.py | _prediction_loop | Daupler/CA-MTL | 0 | python | def _prediction_loop(self, dataloader: DataLoader, description: str, task_name: str, mode: str, prediction_loss_only: Optional[bool]=None) -> PredictionOutput:
'\n Prediction/evaluation loop, shared by `evaluate()` and `predict()`.\n Works both with or without labels.\n '
prediction_loss_on... | def _prediction_loop(self, dataloader: DataLoader, description: str, task_name: str, mode: str, prediction_loss_only: Optional[bool]=None) -> PredictionOutput:
'\n Prediction/evaluation loop, shared by `evaluate()` and `predict()`.\n Works both with or without labels.\n '
prediction_loss_on... |
8d6780803731c1dfc1d2514dceff663cab2c40b380de5fe317f37d08577f0374 | def fold_split(self, random_seed=None):
'\n Splitting the folds.\n\n Args:\n random_seed: Random seed for reproducibility\n\n Returns:\n tensor containing indices for folds, where dim=0 is the fold number\n\n '
if (random_seed is not None):
torch.manual_... | Splitting the folds.
Args:
random_seed: Random seed for reproducibility
Returns:
tensor containing indices for folds, where dim=0 is the fold number | pymatch/utils/KFold.py | fold_split | raharth/PyMatch | 10 | python | def fold_split(self, random_seed=None):
'\n Splitting the folds.\n\n Args:\n random_seed: Random seed for reproducibility\n\n Returns:\n tensor containing indices for folds, where dim=0 is the fold number\n\n '
if (random_seed is not None):
torch.manual_... | def fold_split(self, random_seed=None):
'\n Splitting the folds.\n\n Args:\n random_seed: Random seed for reproducibility\n\n Returns:\n tensor containing indices for folds, where dim=0 is the fold number\n\n '
if (random_seed is not None):
torch.manual_... |
7cd01ceaeeec303ca22d300b40f1d155861871c9b36368f9fb7c58bb4f4d5d86 | def fold_loaders(self, fold=(- 1)):
'\n Loading a specific fold as train and test data loader. If no fold number is provided it returns the next fold. It returns a randomly sampled subset of\n the original data set.\n\n Args:\n fold: fold number to return\n\n Returns:\n ... | Loading a specific fold as train and test data loader. If no fold number is provided it returns the next fold. It returns a randomly sampled subset of
the original data set.
Args:
fold: fold number to return
Returns:
(train data loader, test data loader) | pymatch/utils/KFold.py | fold_loaders | raharth/PyMatch | 10 | python | def fold_loaders(self, fold=(- 1)):
'\n Loading a specific fold as train and test data loader. If no fold number is provided it returns the next fold. It returns a randomly sampled subset of\n the original data set.\n\n Args:\n fold: fold number to return\n\n Returns:\n ... | def fold_loaders(self, fold=(- 1)):
'\n Loading a specific fold as train and test data loader. If no fold number is provided it returns the next fold. It returns a randomly sampled subset of\n the original data set.\n\n Args:\n fold: fold number to return\n\n Returns:\n ... |
2f860cad73f0910b2ad7d19c85cb15a4a0cfc03df20516a5404f1555108798fe | def __init__(self, mnemonic, numberOfChannels=4, numberOfRois=32, pv=None, dxpType='mca', responseTimeout=15, output='out'):
' Constructor\n responseTimeout : how much time to wait dxp answer\n '
super().__init__(mnemonic, NUMPOINTS, output, dxpType)
self.acquiring = False
self.rois = numb... | Constructor
responseTimeout : how much time to wait dxp answer | py4syn/epics/DxpFakeClass.py | __init__ | gabrielpreviato/py4syn | 12 | python | def __init__(self, mnemonic, numberOfChannels=4, numberOfRois=32, pv=None, dxpType='mca', responseTimeout=15, output='out'):
' Constructor\n responseTimeout : how much time to wait dxp answer\n '
super().__init__(mnemonic, NUMPOINTS, output, dxpType)
self.acquiring = False
self.rois = numb... | def __init__(self, mnemonic, numberOfChannels=4, numberOfRois=32, pv=None, dxpType='mca', responseTimeout=15, output='out'):
' Constructor\n responseTimeout : how much time to wait dxp answer\n '
super().__init__(mnemonic, NUMPOINTS, output, dxpType)
self.acquiring = False
self.rois = numb... |
36079239ded266b6ee2793a61ddf976dfa3c42a7d9c03f900c2168c48f14f188 | def statusChange(self, value, **kw):
'\n Helper callback used to wait for the end of the acquisition.\n '
pass | Helper callback used to wait for the end of the acquisition. | py4syn/epics/DxpFakeClass.py | statusChange | gabrielpreviato/py4syn | 12 | python | def statusChange(self, value, **kw):
'\n \n '
pass | def statusChange(self, value, **kw):
'\n \n '
pass<|docstring|>Helper callback used to wait for the end of the acquisition.<|endoftext|> |
33e6729f22113aa0c5351c0bb328a1d685eb81c3ac13305e250dbd84ef44cfe0 | def setCountTime(self, time):
'\n Method to set the count time of a scaler device.\n\n Parameters\n ----------\n time : `float`\n Count time to set to scaler device .\n\n Returns\n -------\n out : None\n '
pass | Method to set the count time of a scaler device.
Parameters
----------
time : `float`
Count time to set to scaler device .
Returns
-------
out : None | py4syn/epics/DxpFakeClass.py | setCountTime | gabrielpreviato/py4syn | 12 | python | def setCountTime(self, time):
'\n Method to set the count time of a scaler device.\n\n Parameters\n ----------\n time : `float`\n Count time to set to scaler device .\n\n Returns\n -------\n out : None\n '
pass | def setCountTime(self, time):
'\n Method to set the count time of a scaler device.\n\n Parameters\n ----------\n time : `float`\n Count time to set to scaler device .\n\n Returns\n -------\n out : None\n '
pass<|docstring|>Method to set the coun... |
213bfc08499a961ce84bf0fb42a6001aea6abbebbefa7052ac2d92e72a80fc7c | def getValueChannel(self, **kwargs):
'Return intensity\n channel is on format mcaC.Rr, where C is the channel and\n r is the ROI'
channel = kwargs['channel']
c = (int(channel[CHANNELPOSITION]) - 1)
if (len(channel) > ROIPOSITION):
return np.random.rand()
else:
self.sav... | Return intensity
channel is on format mcaC.Rr, where C is the channel and
r is the ROI | py4syn/epics/DxpFakeClass.py | getValueChannel | gabrielpreviato/py4syn | 12 | python | def getValueChannel(self, **kwargs):
'Return intensity\n channel is on format mcaC.Rr, where C is the channel and\n r is the ROI'
channel = kwargs['channel']
c = (int(channel[CHANNELPOSITION]) - 1)
if (len(channel) > ROIPOSITION):
return np.random.rand()
else:
self.sav... | def getValueChannel(self, **kwargs):
'Return intensity\n channel is on format mcaC.Rr, where C is the channel and\n r is the ROI'
channel = kwargs['channel']
c = (int(channel[CHANNELPOSITION]) - 1)
if (len(channel) > ROIPOSITION):
return np.random.rand()
else:
self.sav... |
ddf7b05da17d94bb255653ea9a9f215ef063a2d7fff292247340fd369b9052c2 | def wait(self):
'\n Blocks until the acquisition completes.\n '
pass | Blocks until the acquisition completes. | py4syn/epics/DxpFakeClass.py | wait | gabrielpreviato/py4syn | 12 | python | def wait(self):
'\n \n '
pass | def wait(self):
'\n \n '
pass<|docstring|>Blocks until the acquisition completes.<|endoftext|> |
8042b99321e5532535d4fc32314987b47c4b3a7d820da843c28475be105e5ea5 | def canMonitor(self):
' Returns false indcating Dxp cannot be use as a counter monitor'
return False | Returns false indcating Dxp cannot be use as a counter monitor | py4syn/epics/DxpFakeClass.py | canMonitor | gabrielpreviato/py4syn | 12 | python | def canMonitor(self):
' '
return False | def canMonitor(self):
' '
return False<|docstring|>Returns false indcating Dxp cannot be use as a counter monitor<|endoftext|> |
248387e3b85e17985a1f7493ff7fef9ae680edf64a694b2c0ee395e1b11c4046 | def canStopCount(self):
'\n Returns true indicating that Dxp has a stop command.\n '
return True | Returns true indicating that Dxp has a stop command. | py4syn/epics/DxpFakeClass.py | canStopCount | gabrielpreviato/py4syn | 12 | python | def canStopCount(self):
'\n \n '
return True | def canStopCount(self):
'\n \n '
return True<|docstring|>Returns true indicating that Dxp has a stop command.<|endoftext|> |
1ba1be472c1cc572f99d5733ce86ed30cb277172da5f0ac497592484c8b14596 | def getValue(self, **kwargs):
'\n This is a dummy method that always returns zero, which is part of the\n :class:`py4syn.epics.ICountable` interface. Dxp does not return\n a value while scanning. Instead, it stores a mca file with result .\n '
if kwargs:
return self.getValueC... | This is a dummy method that always returns zero, which is part of the
:class:`py4syn.epics.ICountable` interface. Dxp does not return
a value while scanning. Instead, it stores a mca file with result . | py4syn/epics/DxpFakeClass.py | getValue | gabrielpreviato/py4syn | 12 | python | def getValue(self, **kwargs):
'\n This is a dummy method that always returns zero, which is part of the\n :class:`py4syn.epics.ICountable` interface. Dxp does not return\n a value while scanning. Instead, it stores a mca file with result .\n '
if kwargs:
return self.getValueC... | def getValue(self, **kwargs):
'\n This is a dummy method that always returns zero, which is part of the\n :class:`py4syn.epics.ICountable` interface. Dxp does not return\n a value while scanning. Instead, it stores a mca file with result .\n '
if kwargs:
return self.getValueC... |
da3b1411332c1f386f993425f20da0f19dec6f29582fd6dffb7394ea9f5a2d10 | def setPresetValue(self, channel, val):
'Dummy method'
pass | Dummy method | py4syn/epics/DxpFakeClass.py | setPresetValue | gabrielpreviato/py4syn | 12 | python | def setPresetValue(self, channel, val):
pass | def setPresetValue(self, channel, val):
pass<|docstring|>Dummy method<|endoftext|> |
411bce91c93d90a2d37f544e8465bfad6911eb21ed67377ad521617d65c6d9aa | def startCollectImage(self, rows=0, cols=0):
'Start to collect an image\n When collect an image, the points will be saved on a hdf file'
super().startCollectImage('int32', rows, cols) | Start to collect an image
When collect an image, the points will be saved on a hdf file | py4syn/epics/DxpFakeClass.py | startCollectImage | gabrielpreviato/py4syn | 12 | python | def startCollectImage(self, rows=0, cols=0):
'Start to collect an image\n When collect an image, the points will be saved on a hdf file'
super().startCollectImage('int32', rows, cols) | def startCollectImage(self, rows=0, cols=0):
'Start to collect an image\n When collect an image, the points will be saved on a hdf file'
super().startCollectImage('int32', rows, cols)<|docstring|>Start to collect an image
When collect an image, the points will be saved on a hdf file<|endoftext|> |
85255cc15290a9c0a64016787afdf19a2db3d83664171abf0328b54548d30123 | def format_cfg(cfg):
'Format experiment config for friendly display'
def list2str(cfg):
for (key, value) in cfg.items():
if isinstance(value, dict):
cfg[key] = list2str(value)
elif isinstance(value, list):
if ((len(value) == 0) or isinstance(value... | Format experiment config for friendly display | up/utils/general/cfg_helper.py | format_cfg | ModelTC/EOD | 196 | python | def format_cfg(cfg):
def list2str(cfg):
for (key, value) in cfg.items():
if isinstance(value, dict):
cfg[key] = list2str(value)
elif isinstance(value, list):
if ((len(value) == 0) or isinstance(value[0], (int, float))):
cfg[ke... | def format_cfg(cfg):
def list2str(cfg):
for (key, value) in cfg.items():
if isinstance(value, dict):
cfg[key] = list2str(value)
elif isinstance(value, list):
if ((len(value) == 0) or isinstance(value[0], (int, float))):
cfg[ke... |
39261bfd99da9ab2c70cb93b4e0a55465e722a2e06ab70e610691e0bb0429610 | def try_decode(val):
'bool, int, float, or str'
if (val.upper() == 'FALSE'):
return False
elif (val.upper() == 'TRUE'):
return True
if val.isdigit():
return int(val)
if is_number(val):
return float(val)
return val | bool, int, float, or str | up/utils/general/cfg_helper.py | try_decode | ModelTC/EOD | 196 | python | def try_decode(val):
if (val.upper() == 'FALSE'):
return False
elif (val.upper() == 'TRUE'):
return True
if val.isdigit():
return int(val)
if is_number(val):
return float(val)
return val | def try_decode(val):
if (val.upper() == 'FALSE'):
return False
elif (val.upper() == 'TRUE'):
return True
if val.isdigit():
return int(val)
if is_number(val):
return float(val)
return val<|docstring|>bool, int, float, or str<|endoftext|> |
8bf722e453297e58b39ab6a2f0dc0fdc915a8115512a20eb1d93a126811c079d | def daml_compile(name, srcs, version=_default_project_version, target=None, **kwargs):
'Build a DAML project, with a generated daml.yaml.'
if (len(srcs) == 0):
fail("daml_compile: Expected `srcs' to be non-empty.")
daml_yaml = (name + '.yaml')
_daml_configure(name=(name + '.configure'), project_... | Build a DAML project, with a generated daml.yaml. | rules_daml/daml.bzl | daml_compile | FlashSheridan/daml | 0 | python | def daml_compile(name, srcs, version=_default_project_version, target=None, **kwargs):
if (len(srcs) == 0):
fail("daml_compile: Expected `srcs' to be non-empty.")
daml_yaml = (name + '.yaml')
_daml_configure(name=(name + '.configure'), project_name=name, project_version=version, daml_yaml=daml_... | def daml_compile(name, srcs, version=_default_project_version, target=None, **kwargs):
if (len(srcs) == 0):
fail("daml_compile: Expected `srcs' to be non-empty.")
daml_yaml = (name + '.yaml')
_daml_configure(name=(name + '.configure'), project_name=name, project_version=version, daml_yaml=daml_... |
2c750a17a9a5a68593e45116511157fed3fd4cd2cfd3b0f6c80c382fd8e24032 | def daml_compile_with_dalf(name, version=_default_project_version, **kwargs):
'Build a DAML project, with a generated daml.yaml, and extract the main DALF.'
daml_compile(name=name, version=version, **kwargs)
_extract_main_dalf(name=(name + '.extract'), project_name=name, project_version=version, dar=(name +... | Build a DAML project, with a generated daml.yaml, and extract the main DALF. | rules_daml/daml.bzl | daml_compile_with_dalf | FlashSheridan/daml | 0 | python | def daml_compile_with_dalf(name, version=_default_project_version, **kwargs):
daml_compile(name=name, version=version, **kwargs)
_extract_main_dalf(name=(name + '.extract'), project_name=name, project_version=version, dar=(name + '.dar'), dalf=(name + '.dalf')) | def daml_compile_with_dalf(name, version=_default_project_version, **kwargs):
daml_compile(name=name, version=version, **kwargs)
_extract_main_dalf(name=(name + '.extract'), project_name=name, project_version=version, dar=(name + '.dar'), dalf=(name + '.dalf'))<|docstring|>Build a DAML project, with a gene... |
4ac30c42e0b73a1a1db7daf59fba30b14fdedf314d8b232c39bbbfd5e60664f6 | def daml_build_test(name, project_dir, daml_config_basename='daml.yaml', daml_subdir_basename='daml', dar_dict={}, **kwargs):
'Build a DAML project and validate the resulting .dar file.'
daml_yaml = ((project_dir + '/') + daml_config_basename)
srcs = native.glob([(((project_dir + '/') + daml_subdir_basename... | Build a DAML project and validate the resulting .dar file. | rules_daml/daml.bzl | daml_build_test | FlashSheridan/daml | 0 | python | def daml_build_test(name, project_dir, daml_config_basename='daml.yaml', daml_subdir_basename='daml', dar_dict={}, **kwargs):
daml_yaml = ((project_dir + '/') + daml_config_basename)
srcs = native.glob([(((project_dir + '/') + daml_subdir_basename) + '/**/*.daml')])
_daml_build(name=name, daml_yaml=dam... | def daml_build_test(name, project_dir, daml_config_basename='daml.yaml', daml_subdir_basename='daml', dar_dict={}, **kwargs):
daml_yaml = ((project_dir + '/') + daml_config_basename)
srcs = native.glob([(((project_dir + '/') + daml_subdir_basename) + '/**/*.daml')])
_daml_build(name=name, daml_yaml=dam... |
8d4eba1abf56ff012c29b05113db4429cc4da91014b0add6e4df1f11c5529f5e | def convert(self):
'Perform the conversion from datapackage to destination format\n '
handle = self._header()
logger.debug(self.default_values)
for (name, df) in self.package.items():
logger.debug(name)
if df.empty:
columns = [x['name'] for x in df._metadata['schema'][... | Perform the conversion from datapackage to destination format | src/otoole/preprocess/narrow_to_datafile.py | convert | chrwm/otoole | 0 | python | def convert(self):
'\n '
handle = self._header()
logger.debug(self.default_values)
for (name, df) in self.package.items():
logger.debug(name)
if df.empty:
columns = [x['name'] for x in df._metadata['schema']['fields']]
df = pd.DataFrame(columns=columns)
... | def convert(self):
'\n '
handle = self._header()
logger.debug(self.default_values)
for (name, df) in self.package.items():
logger.debug(name)
if df.empty:
columns = [x['name'] for x in df._metadata['schema']['fields']]
df = pd.DataFrame(columns=columns)
... |
c3c29b3e0b0c30c409263fa9f7eb4e961d38eb5c1a971daa72ab759765c10b09 | @abstractmethod
def _write_parameter(self, df: pd.DataFrame, parameter_name: str, handle: TextIO, default: float) -> pd.DataFrame:
'Write parameter data'
raise NotImplementedError() | Write parameter data | src/otoole/preprocess/narrow_to_datafile.py | _write_parameter | chrwm/otoole | 0 | python | @abstractmethod
def _write_parameter(self, df: pd.DataFrame, parameter_name: str, handle: TextIO, default: float) -> pd.DataFrame:
raise NotImplementedError() | @abstractmethod
def _write_parameter(self, df: pd.DataFrame, parameter_name: str, handle: TextIO, default: float) -> pd.DataFrame:
raise NotImplementedError()<|docstring|>Write parameter data<|endoftext|> |
3061ea07aa5f3adbd772933102f916ed00101f2135a1ccf35080485944ee38aa | @abstractmethod
def _write_set(self, df: pd.DataFrame, set_name, handle: TextIO) -> pd.DataFrame:
'Write set data'
raise NotImplementedError() | Write set data | src/otoole/preprocess/narrow_to_datafile.py | _write_set | chrwm/otoole | 0 | python | @abstractmethod
def _write_set(self, df: pd.DataFrame, set_name, handle: TextIO) -> pd.DataFrame:
raise NotImplementedError() | @abstractmethod
def _write_set(self, df: pd.DataFrame, set_name, handle: TextIO) -> pd.DataFrame:
raise NotImplementedError()<|docstring|>Write set data<|endoftext|> |
b2c852ce075b62ca80b575bdaf71fdca7bea99b026e9a6062285a8667b9039e1 | def _write_parameter(self, df: pd.DataFrame, parameter_name: str, handle: TextIO, default: float):
'Write parameter data to a csv file, omitting data which matches the default value\n\n Arguments\n ---------\n filepath : StreamIO\n df : pandas.DataFrame\n parameter_name : str\n ... | Write parameter data to a csv file, omitting data which matches the default value
Arguments
---------
filepath : StreamIO
df : pandas.DataFrame
parameter_name : str
handle: TextIO
default : int | src/otoole/preprocess/narrow_to_datafile.py | _write_parameter | chrwm/otoole | 0 | python | def _write_parameter(self, df: pd.DataFrame, parameter_name: str, handle: TextIO, default: float):
'Write parameter data to a csv file, omitting data which matches the default value\n\n Arguments\n ---------\n filepath : StreamIO\n df : pandas.DataFrame\n parameter_name : str\n ... | def _write_parameter(self, df: pd.DataFrame, parameter_name: str, handle: TextIO, default: float):
'Write parameter data to a csv file, omitting data which matches the default value\n\n Arguments\n ---------\n filepath : StreamIO\n df : pandas.DataFrame\n parameter_name : str\n ... |
209e49f6336df00933fde9a1756200afb546feecbb8c0def2c66a9f7e5b6f438 | def _write_set(self, df: pd.DataFrame, set_name, handle: TextIO):
'\n\n Arguments\n ---------\n df : pandas.DataFrame\n set_name : str\n handle: TextIO\n '
handle.write('set {} :=\n'.format(set_name))
df.to_csv(path_or_buf=handle, sep=' ', header=False, index=False)... | Arguments
---------
df : pandas.DataFrame
set_name : str
handle: TextIO | src/otoole/preprocess/narrow_to_datafile.py | _write_set | chrwm/otoole | 0 | python | def _write_set(self, df: pd.DataFrame, set_name, handle: TextIO):
'\n\n Arguments\n ---------\n df : pandas.DataFrame\n set_name : str\n handle: TextIO\n '
handle.write('set {} :=\n'.format(set_name))
df.to_csv(path_or_buf=handle, sep=' ', header=False, index=False)... | def _write_set(self, df: pd.DataFrame, set_name, handle: TextIO):
'\n\n Arguments\n ---------\n df : pandas.DataFrame\n set_name : str\n handle: TextIO\n '
handle.write('set {} :=\n'.format(set_name))
df.to_csv(path_or_buf=handle, sep=' ', header=False, index=False)... |
bb3ed0469149fa92f7528787c3dd431cc3e882299a2057475ac9c83c81984a8c | def _form_parameter(self, df: pd.DataFrame, parameter_name: str, default: float) -> pd.DataFrame:
'Converts data into wide format\n\n Arguments\n ---------\n df: pd.DataFrame\n parameter_name: str\n default: float\n\n Returns\n -------\n pandas.DataFrame\n ... | Converts data into wide format
Arguments
---------
df: pd.DataFrame
parameter_name: str
default: float
Returns
-------
pandas.DataFrame | src/otoole/preprocess/narrow_to_datafile.py | _form_parameter | chrwm/otoole | 0 | python | def _form_parameter(self, df: pd.DataFrame, parameter_name: str, default: float) -> pd.DataFrame:
'Converts data into wide format\n\n Arguments\n ---------\n df: pd.DataFrame\n parameter_name: str\n default: float\n\n Returns\n -------\n pandas.DataFrame\n ... | def _form_parameter(self, df: pd.DataFrame, parameter_name: str, default: float) -> pd.DataFrame:
'Converts data into wide format\n\n Arguments\n ---------\n df: pd.DataFrame\n parameter_name: str\n default: float\n\n Returns\n -------\n pandas.DataFrame\n ... |
6b23e19f6a83498188e5ab1f64c5c4b5d450d30dddea586bbd8158e14d1d4c6f | def q_shift_variants(q_values_prediction, q_values_input, corrected_reflectivity, n_variants, scale=0.001):
'Create ``n_variants`` interpolated reflectivity curve variants with randomly distributed q shifts.'
shift = np.random.normal(loc=0, size=n_variants, scale=scale).reshape(n_variants, 1)
shifted_qs = (... | Create ``n_variants`` interpolated reflectivity curve variants with randomly distributed q shifts. | mlreflect/curve_fitter/minimizer.py | q_shift_variants | schreiber-lab/mlreflect | 0 | python | def q_shift_variants(q_values_prediction, q_values_input, corrected_reflectivity, n_variants, scale=0.001):
shift = np.random.normal(loc=0, size=n_variants, scale=scale).reshape(n_variants, 1)
shifted_qs = (np.tile(q_values_input, (n_variants, 1)) + shift)
interpolated_curves = np.zeros((n_variants, le... | def q_shift_variants(q_values_prediction, q_values_input, corrected_reflectivity, n_variants, scale=0.001):
shift = np.random.normal(loc=0, size=n_variants, scale=scale).reshape(n_variants, 1)
shifted_qs = (np.tile(q_values_input, (n_variants, 1)) + shift)
interpolated_curves = np.zeros((n_variants, le... |
df7f6d0fcb3a08cf6d0128dc26b5f286bae3edf65fdf201c0812370a301e86f1 | def curve_scaling_variants(corrected_reflectivity, n_variants, scale=0.1):
'Create ``n_variants`` reflectivity curve variants with randomly distributed scaling factors.'
scalings = np.random.normal(loc=1, size=n_variants, scale=scale).reshape(n_variants, 1)
scaled_curves = np.zeros((n_variants, len(correcte... | Create ``n_variants`` reflectivity curve variants with randomly distributed scaling factors. | mlreflect/curve_fitter/minimizer.py | curve_scaling_variants | schreiber-lab/mlreflect | 0 | python | def curve_scaling_variants(corrected_reflectivity, n_variants, scale=0.1):
scalings = np.random.normal(loc=1, size=n_variants, scale=scale).reshape(n_variants, 1)
scaled_curves = np.zeros((n_variants, len(corrected_reflectivity)))
for i in range(n_variants):
scaled_curves[i] = (corrected_reflec... | def curve_scaling_variants(corrected_reflectivity, n_variants, scale=0.1):
scalings = np.random.normal(loc=1, size=n_variants, scale=scale).reshape(n_variants, 1)
scaled_curves = np.zeros((n_variants, len(corrected_reflectivity)))
for i in range(n_variants):
scaled_curves[i] = (corrected_reflec... |
7807491f7361509fd05e6fb724a2b07d8ae604f44bb29924de39e09fe4f496f8 | def curve_variant_log_mse(curve, variant_curves):
'Calculate the log MSE of a curve and a :class:`ndarray` of curves'
errors = (np.log10(curve) - np.log10(variant_curves))
return np.mean((errors ** 2), axis=1) | Calculate the log MSE of a curve and a :class:`ndarray` of curves | mlreflect/curve_fitter/minimizer.py | curve_variant_log_mse | schreiber-lab/mlreflect | 0 | python | def curve_variant_log_mse(curve, variant_curves):
errors = (np.log10(curve) - np.log10(variant_curves))
return np.mean((errors ** 2), axis=1) | def curve_variant_log_mse(curve, variant_curves):
errors = (np.log10(curve) - np.log10(variant_curves))
return np.mean((errors ** 2), axis=1)<|docstring|>Calculate the log MSE of a curve and a :class:`ndarray` of curves<|endoftext|> |
53458e5131541f826420031210711069c9c8c9fc3eb047547a7c1aa983f71421 | def least_log_mean_squares_fit(q_values, data, predicted_labels, sample, output_preprocessor, fraction_bounds=(0.5, 0.5, 0.1)):
'Fits the data with a model curve with ``scipy.optimize.curve_fit`` using ``predicted_labels`` as start values.'
prep_labels = output_preprocessor.apply_preprocessing(predicted_labels)... | Fits the data with a model curve with ``scipy.optimize.curve_fit`` using ``predicted_labels`` as start values. | mlreflect/curve_fitter/minimizer.py | least_log_mean_squares_fit | schreiber-lab/mlreflect | 0 | python | def least_log_mean_squares_fit(q_values, data, predicted_labels, sample, output_preprocessor, fraction_bounds=(0.5, 0.5, 0.1)):
prep_labels = output_preprocessor.apply_preprocessing(predicted_labels)[0]
start_values = np.array(prep_labels)[0]
bounds = ([(val - (bound * abs(val))) for (val, bound) in zi... | def least_log_mean_squares_fit(q_values, data, predicted_labels, sample, output_preprocessor, fraction_bounds=(0.5, 0.5, 0.1)):
prep_labels = output_preprocessor.apply_preprocessing(predicted_labels)[0]
start_values = np.array(prep_labels)[0]
bounds = ([(val - (bound * abs(val))) for (val, bound) in zi... |
4514244894552e762c7520148fb4cb38b3750fbc5e02b65903f7e0e88aae8088 | def log_mse_loss(prep_labels, data, generator, output_preprocessor):
'MSE loss between a reflectivity curve and a model curve generated with the given normalized labels.'
restored_labels = output_preprocessor.restore_labels(np.atleast_2d(prep_labels))
model = generator.simulate_reflectivity(restored_labels,... | MSE loss between a reflectivity curve and a model curve generated with the given normalized labels. | mlreflect/curve_fitter/minimizer.py | log_mse_loss | schreiber-lab/mlreflect | 0 | python | def log_mse_loss(prep_labels, data, generator, output_preprocessor):
restored_labels = output_preprocessor.restore_labels(np.atleast_2d(prep_labels))
model = generator.simulate_reflectivity(restored_labels, progress_bar=False)[0]
loss = mean_squared_error(np.log10(data), np.log10(model))
return los... | def log_mse_loss(prep_labels, data, generator, output_preprocessor):
restored_labels = output_preprocessor.restore_labels(np.atleast_2d(prep_labels))
model = generator.simulate_reflectivity(restored_labels, progress_bar=False)[0]
loss = mean_squared_error(np.log10(data), np.log10(model))
return los... |
43000381cbc4350cc361004a69cd451365dce77e13f724550b8eb5a697dc2e45 | def mean_squared_error(array1, array2):
'Returns element-wise mean squared error between two arrays.'
if (len(array1) != len(array2)):
raise ValueError(f'array1 and array2 must be of same length ({len(array1)} != {len(array2)})')
else:
error = (np.asarray(array1) - np.asarray(array2))
... | Returns element-wise mean squared error between two arrays. | mlreflect/curve_fitter/minimizer.py | mean_squared_error | schreiber-lab/mlreflect | 0 | python | def mean_squared_error(array1, array2):
if (len(array1) != len(array2)):
raise ValueError(f'array1 and array2 must be of same length ({len(array1)} != {len(array2)})')
else:
error = (np.asarray(array1) - np.asarray(array2))
return np.mean(np.atleast_2d((error ** 2)), axis=1) | def mean_squared_error(array1, array2):
if (len(array1) != len(array2)):
raise ValueError(f'array1 and array2 must be of same length ({len(array1)} != {len(array2)})')
else:
error = (np.asarray(array1) - np.asarray(array2))
return np.mean(np.atleast_2d((error ** 2)), axis=1)<|docstr... |
2fa46e64284c96ff50f403feb94abfddf7ce7bf1d3e1f814273bce0bb9b75c24 | @bp_rack.route('/lists.html', methods=['GET', 'POST'])
@login_required
@permission_rack_section_search.require(http_exception=403)
def lists():
'\n 货架列表\n :return:\n '
template_name = 'rack/lists.html'
document_info = DOCUMENT_INFO.copy()
document_info['TITLE'] = _('rack lists')
form = Rack... | 货架列表
:return: | app_backend/views/rack.py | lists | zhanghe06/bearing_project | 1 | python | @bp_rack.route('/lists.html', methods=['GET', 'POST'])
@login_required
@permission_rack_section_search.require(http_exception=403)
def lists():
'\n 货架列表\n :return:\n '
template_name = 'rack/lists.html'
document_info = DOCUMENT_INFO.copy()
document_info['TITLE'] = _('rack lists')
form = Rack... | @bp_rack.route('/lists.html', methods=['GET', 'POST'])
@login_required
@permission_rack_section_search.require(http_exception=403)
def lists():
'\n 货架列表\n :return:\n '
template_name = 'rack/lists.html'
document_info = DOCUMENT_INFO.copy()
document_info['TITLE'] = _('rack lists')
form = Rack... |
28b26d883b49c2619e777b051610ddf248e9e2e11d22cc239363ea57e519b4b5 | @bp_rack.route('/<int:rack_id>/info.html')
@login_required
@permission_rack_section_get.require(http_exception=403)
def info(rack_id):
'\n 货架详情\n :param rack_id:\n :return:\n '
rack_info = get_rack_row_by_id(rack_id)
if (not rack_info):
abort(404)
if (rack_info.status_delete == STATU... | 货架详情
:param rack_id:
:return: | app_backend/views/rack.py | info | zhanghe06/bearing_project | 1 | python | @bp_rack.route('/<int:rack_id>/info.html')
@login_required
@permission_rack_section_get.require(http_exception=403)
def info(rack_id):
'\n 货架详情\n :param rack_id:\n :return:\n '
rack_info = get_rack_row_by_id(rack_id)
if (not rack_info):
abort(404)
if (rack_info.status_delete == STATU... | @bp_rack.route('/<int:rack_id>/info.html')
@login_required
@permission_rack_section_get.require(http_exception=403)
def info(rack_id):
'\n 货架详情\n :param rack_id:\n :return:\n '
rack_info = get_rack_row_by_id(rack_id)
if (not rack_info):
abort(404)
if (rack_info.status_delete == STATU... |
c2160a72c585d476d075353509b682c11624229baaca4a3f3c0cd4337fcbc075 | @bp_rack.route('/add.html', methods=['GET', 'POST'])
@login_required
@permission_rack_section_add.require(http_exception=403)
def add():
'\n 创建货架\n :return:\n '
template_name = 'rack/add.html'
document_info = DOCUMENT_INFO.copy()
document_info['TITLE'] = _('rack add')
form = RackAddForm(req... | 创建货架
:return: | app_backend/views/rack.py | add | zhanghe06/bearing_project | 1 | python | @bp_rack.route('/add.html', methods=['GET', 'POST'])
@login_required
@permission_rack_section_add.require(http_exception=403)
def add():
'\n 创建货架\n :return:\n '
template_name = 'rack/add.html'
document_info = DOCUMENT_INFO.copy()
document_info['TITLE'] = _('rack add')
form = RackAddForm(req... | @bp_rack.route('/add.html', methods=['GET', 'POST'])
@login_required
@permission_rack_section_add.require(http_exception=403)
def add():
'\n 创建货架\n :return:\n '
template_name = 'rack/add.html'
document_info = DOCUMENT_INFO.copy()
document_info['TITLE'] = _('rack add')
form = RackAddForm(req... |
3ba5cc860502d45d5c35222e90d257a6916de5604450aba1b3b55d95ce22ce86 | @bp_rack.route('/<int:rack_id>/edit.html', methods=['GET', 'POST'])
@login_required
@permission_rack_section_edit.require(http_exception=403)
def edit(rack_id):
'\n 货架编辑\n '
rack_info = get_rack_row_by_id(rack_id)
if (not rack_info):
abort(404)
if (rack_info.status_delete == STATUS_DEL_OK)... | 货架编辑 | app_backend/views/rack.py | edit | zhanghe06/bearing_project | 1 | python | @bp_rack.route('/<int:rack_id>/edit.html', methods=['GET', 'POST'])
@login_required
@permission_rack_section_edit.require(http_exception=403)
def edit(rack_id):
'\n \n '
rack_info = get_rack_row_by_id(rack_id)
if (not rack_info):
abort(404)
if (rack_info.status_delete == STATUS_DEL_OK):
... | @bp_rack.route('/<int:rack_id>/edit.html', methods=['GET', 'POST'])
@login_required
@permission_rack_section_edit.require(http_exception=403)
def edit(rack_id):
'\n \n '
rack_info = get_rack_row_by_id(rack_id)
if (not rack_info):
abort(404)
if (rack_info.status_delete == STATUS_DEL_OK):
... |
7bf8f0174c53cfc537a98e406ce4e40ca9a5159496160bc1195a3cba22c8877d | @bp_rack.route('/ajax/del', methods=['GET', 'POST'])
@login_required
def ajax_delete():
'\n 货架删除\n :return:\n '
ajax_success_msg = AJAX_SUCCESS_MSG.copy()
ajax_failure_msg = AJAX_FAILURE_MSG.copy()
if (not permission_rack_section_del.can()):
ext_msg = _('Permission Denied')
ajax... | 货架删除
:return: | app_backend/views/rack.py | ajax_delete | zhanghe06/bearing_project | 1 | python | @bp_rack.route('/ajax/del', methods=['GET', 'POST'])
@login_required
def ajax_delete():
'\n 货架删除\n :return:\n '
ajax_success_msg = AJAX_SUCCESS_MSG.copy()
ajax_failure_msg = AJAX_FAILURE_MSG.copy()
if (not permission_rack_section_del.can()):
ext_msg = _('Permission Denied')
ajax... | @bp_rack.route('/ajax/del', methods=['GET', 'POST'])
@login_required
def ajax_delete():
'\n 货架删除\n :return:\n '
ajax_success_msg = AJAX_SUCCESS_MSG.copy()
ajax_failure_msg = AJAX_FAILURE_MSG.copy()
if (not permission_rack_section_del.can()):
ext_msg = _('Permission Denied')
ajax... |
be5992e7395bec46163f712c933a24b33bf924a8db2c1d5a9abe33ee80467c58 | @bp_rack.route('/ajax/get_rack_choices', methods=['GET', 'POST'])
@login_required
def ajax_get_rack_choices():
'\n 货架选项\n :return:\n '
warehouse_id = request.args.get('warehouse_id', 0, type=int)
rack_choices = get_rack_choices(warehouse_id)
return jsonify(rack_choices) | 货架选项
:return: | app_backend/views/rack.py | ajax_get_rack_choices | zhanghe06/bearing_project | 1 | python | @bp_rack.route('/ajax/get_rack_choices', methods=['GET', 'POST'])
@login_required
def ajax_get_rack_choices():
'\n 货架选项\n :return:\n '
warehouse_id = request.args.get('warehouse_id', 0, type=int)
rack_choices = get_rack_choices(warehouse_id)
return jsonify(rack_choices) | @bp_rack.route('/ajax/get_rack_choices', methods=['GET', 'POST'])
@login_required
def ajax_get_rack_choices():
'\n 货架选项\n :return:\n '
warehouse_id = request.args.get('warehouse_id', 0, type=int)
rack_choices = get_rack_choices(warehouse_id)
return jsonify(rack_choices)<|docstring|>货架选项
:return... |
b7091bb3636ad3ac80800993c25a6133dc1247b4050d3ad5a75c7f00ecc93083 | def channel_split_naive(r, channel_ranges):
'Slower but simpler implementation of straxen.split_channel_ranges'
results = []
for (left, right) in channel_ranges:
results.append(r[np.in1d(r['channel'], np.arange(left, (right + 1)))])
return results | Slower but simpler implementation of straxen.split_channel_ranges | tests/test_channel_split.py | channel_split_naive | zhut19/straxen | 14 | python | def channel_split_naive(r, channel_ranges):
results = []
for (left, right) in channel_ranges:
results.append(r[np.in1d(r['channel'], np.arange(left, (right + 1)))])
return results | def channel_split_naive(r, channel_ranges):
results = []
for (left, right) in channel_ranges:
results.append(r[np.in1d(r['channel'], np.arange(left, (right + 1)))])
return results<|docstring|>Slower but simpler implementation of straxen.split_channel_ranges<|endoftext|> |
ff2dd90e5277c03c11843c2e0b3c64f7dd14952bd8369e669f154f1d40e2516a | def make_sqlx(conn, schema, tables):
'Make sqlx lookup function for given tables'
table_func_map = {}
for table in tables:
ntRec = namedtuple(table, tables[table].columns.keys())
table_func_map[table] = SqlX(conn, table, schema, ntRec)
def sqlx(expr) -> SqlX:
obj = jmespath.sear... | Make sqlx lookup function for given tables | xutil/database/base.py | make_sqlx | flarco/n1slutil | 1 | python | def make_sqlx(conn, schema, tables):
table_func_map = {}
for table in tables:
ntRec = namedtuple(table, tables[table].columns.keys())
table_func_map[table] = SqlX(conn, table, schema, ntRec)
def sqlx(expr) -> SqlX:
obj = jmespath.search(expr, table_func_map)
if (not obj... | def make_sqlx(conn, schema, tables):
table_func_map = {}
for table in tables:
ntRec = namedtuple(table, tables[table].columns.keys())
table_func_map[table] = SqlX(conn, table, schema, ntRec)
def sqlx(expr) -> SqlX:
obj = jmespath.search(expr, table_func_map)
if (not obj... |
64c5377787ab0499d3ad00c2d6abe0c0a02cfa1a71106d94f62a3b2145d1a28d | def get_sql_sources(sql_text, echo=False):
'Obtain the source tables of a query\n '
import sqlparse
sql_text = re.sub('as\\(', 'as (', sql_text, 0, (re.MULTILINE | re.IGNORECASE))
statements = sqlparse.parse(sql_text)
cte_aliases = set()
sql_sources = {}
def get_sources(statement):
... | Obtain the source tables of a query | xutil/database/base.py | get_sql_sources | flarco/n1slutil | 1 | python | def get_sql_sources(sql_text, echo=False):
'\n '
import sqlparse
sql_text = re.sub('as\\(', 'as (', sql_text, 0, (re.MULTILINE | re.IGNORECASE))
statements = sqlparse.parse(sql_text)
cte_aliases = set()
sql_sources = {}
def get_sources(statement):
sources_dict = {}
last_kw_... | def get_sql_sources(sql_text, echo=False):
'\n '
import sqlparse
sql_text = re.sub('as\\(', 'as (', sql_text, 0, (re.MULTILINE | re.IGNORECASE))
statements = sqlparse.parse(sql_text)
cte_aliases = set()
sql_sources = {}
def get_sources(statement):
sources_dict = {}
last_kw_... |
0ec58c5143beeaafd865bb0102e03a458921c49c87cc94e374e594a8551037e7 | def __init__(self, conn_dict, profile=None, echo=False):
'Inititate connection'
self._cred = struct(conn_dict)
self._cred.kwargs = conn_dict.get('kwargs', {})
self.name = self._cred.get('name', None)
self.username = self._cred.get('username', None)
self.type = self._cred.type
self.engine = N... | Inititate connection | xutil/database/base.py | __init__ | flarco/n1slutil | 1 | python | def __init__(self, conn_dict, profile=None, echo=False):
self._cred = struct(conn_dict)
self._cred.kwargs = conn_dict.get('kwargs', {})
self.name = self._cred.get('name', None)
self.username = self._cred.get('username', None)
self.type = self._cred.type
self.engine = None
self._cursor_d... | def __init__(self, conn_dict, profile=None, echo=False):
self._cred = struct(conn_dict)
self._cred.kwargs = conn_dict.get('kwargs', {})
self.name = self._cred.get('name', None)
self.username = self._cred.get('username', None)
self.type = self._cred.type
self.engine = None
self._cursor_d... |
1128817e75719e6942d23199debded4d09051357656ec0ed36989dcc06ef0970 | def connect(self):
'Connect to Database'
self.engine = self.get_engine()
self.connection = self.engine.connect() | Connect to Database | xutil/database/base.py | connect | flarco/n1slutil | 1 | python | def connect(self):
self.engine = self.get_engine()
self.connection = self.engine.connect() | def connect(self):
self.engine = self.get_engine()
self.connection = self.engine.connect()<|docstring|>Connect to Database<|endoftext|> |
a6642b8380d2022398ea26c102b764eb7e61938824d686263802da8a4fdeb599 | def close(self):
'Close database connection'
self.conn.connection.close() | Close database connection | xutil/database/base.py | close | flarco/n1slutil | 1 | python | def close(self):
self.conn.connection.close() | def close(self):
self.conn.connection.close()<|docstring|>Close database connection<|endoftext|> |
64fa3fd960a8a3a62275dd152299121d6cbb1c756a5b79f182ffe16f6b428ec5 | def reconnect(self, min_tresh=0):
'Re-Connect to Database if minute threshold reached'
if ((now() - self.last_connect).total_seconds() > (min_tresh * 60)):
log('Reconnecting to {}...'.format(self.name))
self.connect()
self.last_connect = now() | Re-Connect to Database if minute threshold reached | xutil/database/base.py | reconnect | flarco/n1slutil | 1 | python | def reconnect(self, min_tresh=0):
if ((now() - self.last_connect).total_seconds() > (min_tresh * 60)):
log('Reconnecting to {}...'.format(self.name))
self.connect()
self.last_connect = now() | def reconnect(self, min_tresh=0):
if ((now() - self.last_connect).total_seconds() > (min_tresh * 60)):
log('Reconnecting to {}...'.format(self.name))
self.connect()
self.last_connect = now()<|docstring|>Re-Connect to Database if minute threshold reached<|endoftext|> |
1ad79b6097319a4d6e7d2a45677b12ae18e9ab1e02ca7d3d239ec7d70b0bce23 | def set_variables(self):
'Set custom variables'
raise Exception("Method 'set_variables' is not implemented!") | Set custom variables | xutil/database/base.py | set_variables | flarco/n1slutil | 1 | python | def set_variables(self):
raise Exception("Method 'set_variables' is not implemented!") | def set_variables(self):
raise Exception("Method 'set_variables' is not implemented!")<|docstring|>Set custom variables<|endoftext|> |
b92600ce4820daadd26ce8d31fa79cb7faf57d3a58351cc5db9bcb4ff91167b1 | def get_dialect(self, echo=False):
'SQLAlchemy dialect'
raise Exception("Method 'get_dialect' is not implemented!") | SQLAlchemy dialect | xutil/database/base.py | get_dialect | flarco/n1slutil | 1 | python | def get_dialect(self, echo=False):
raise Exception("Method 'get_dialect' is not implemented!") | def get_dialect(self, echo=False):
raise Exception("Method 'get_dialect' is not implemented!")<|docstring|>SQLAlchemy dialect<|endoftext|> |
92528a6f62fb091d56979b41b2e2a375a4a870f19e1b3345af7f0a76cca64f97 | def check_pk(self, table, fields):
'Check Primary key to ensure there are not duplicates'
if ('where' in fields.lower()):
(fields, where_clause) = fields.lower().split('where')
where_clause = ('where ' + where_clause)
else:
where_clause = ''
sql = "\n select\n '{table}' a... | Check Primary key to ensure there are not duplicates | xutil/database/base.py | check_pk | flarco/n1slutil | 1 | python | def check_pk(self, table, fields):
if ('where' in fields.lower()):
(fields, where_clause) = fields.lower().split('where')
where_clause = ('where ' + where_clause)
else:
where_clause =
sql = "\n select\n '{table}' as table,\n case when count(1) = count({fields}) the... | def check_pk(self, table, fields):
if ('where' in fields.lower()):
(fields, where_clause) = fields.lower().split('where')
where_clause = ('where ' + where_clause)
else:
where_clause =
sql = "\n select\n '{table}' as table,\n case when count(1) = count({fields}) the... |
eea4807c757c78fc45421f3dc7f6921b0e4982a59fbea728639b2b6dfe4a4b5d | def execute_multi(self, sql, dtype='namedtuple', limit=None, echo=True, query_name='Record', log=log):
"\n Execute multiple SQL statements separtated by ';'. Returns a generator.\n Example:\n for fields, rows in conn.execute(sql):\n print(fields)\n print(len(rows))\n "
self.reconnect... | Execute multiple SQL statements separtated by ';'. Returns a generator.
Example:
for fields, rows in conn.execute(sql):
print(fields)
print(len(rows)) | xutil/database/base.py | execute_multi | flarco/n1slutil | 1 | python | def execute_multi(self, sql, dtype='namedtuple', limit=None, echo=True, query_name='Record', log=log):
"\n Execute multiple SQL statements separtated by ';'. Returns a generator.\n Example:\n for fields, rows in conn.execute(sql):\n print(fields)\n print(len(rows))\n "
self.reconnect... | def execute_multi(self, sql, dtype='namedtuple', limit=None, echo=True, query_name='Record', log=log):
"\n Execute multiple SQL statements separtated by ';'. Returns a generator.\n Example:\n for fields, rows in conn.execute(sql):\n print(fields)\n print(len(rows))\n "
self.reconnect... |
ded5534da2e201c609a0021a59707a6a690e54d07b117a26622d3cd569fa243e | def execute(self, sql, dtype='tuple', limit=None, echo=True, query_name='Record', log=log):
'Execute SQL, return last result'
self.reconnect(min_tresh=10)
data = None
fields = None
rows = []
message_mapping = {'drop ': 'Dropping {}.', 'truncate ': 'Truncating {}.', 'select ': 'Selecting {}.', 'c... | Execute SQL, return last result | xutil/database/base.py | execute | flarco/n1slutil | 1 | python | def execute(self, sql, dtype='tuple', limit=None, echo=True, query_name='Record', log=log):
self.reconnect(min_tresh=10)
data = None
fields = None
rows = []
message_mapping = {'drop ': 'Dropping {}.', 'truncate ': 'Truncating {}.', 'select ': 'Selecting {}.', 'create ': 'Creating {}.', 'insert ... | def execute(self, sql, dtype='tuple', limit=None, echo=True, query_name='Record', log=log):
self.reconnect(min_tresh=10)
data = None
fields = None
rows = []
message_mapping = {'drop ': 'Dropping {}.', 'truncate ': 'Truncating {}.', 'select ': 'Selecting {}.', 'create ': 'Creating {}.', 'insert ... |
991ccf259d42090a2fa899a6b949ca562fa3b6d8016742062d777f178eecdc53 | def insert(self, table, data, echo=False):
'Insert records of namedtuple or dicts'
raise Exception('insert not implemented') | Insert records of namedtuple or dicts | xutil/database/base.py | insert | flarco/n1slutil | 1 | python | def insert(self, table, data, echo=False):
raise Exception('insert not implemented') | def insert(self, table, data, echo=False):
raise Exception('insert not implemented')<|docstring|>Insert records of namedtuple or dicts<|endoftext|> |
74d5d7ae69215fb12faeae182262b906bbabb712c3f63ab5f245499e477d6e13 | def drop_table(self, table, log=log):
'Drop table'
try:
sql = self._template('core.drop_table').format(table)
self._do_execute(sql)
except Exception as E:
message = get_exception_message().lower()
if (self._template('error_filter.table_not_exist') in message):
if ... | Drop table | xutil/database/base.py | drop_table | flarco/n1slutil | 1 | python | def drop_table(self, table, log=log):
try:
sql = self._template('core.drop_table').format(table)
self._do_execute(sql)
except Exception as E:
message = get_exception_message().lower()
if (self._template('error_filter.table_not_exist') in message):
if self.echo:
... | def drop_table(self, table, log=log):
try:
sql = self._template('core.drop_table').format(table)
self._do_execute(sql)
except Exception as E:
message = get_exception_message().lower()
if (self._template('error_filter.table_not_exist') in message):
if self.echo:
... |
11592db5d01eb56d78c4a9c5ab75c4d1d1e893d65dd5cd5afe7e6189e9ab667d | def create_table(self, table, field_types, drop=False, log=log):
'Create table'
if drop:
self.drop_table(table, log=log)
new_ftypes = OrderedDict()
for f in field_types:
(ftype, max_len, dec_len) = field_types[f]
if dec_len:
suff = '({},{})'.format(max_len, dec_len)
... | Create table | xutil/database/base.py | create_table | flarco/n1slutil | 1 | python | def create_table(self, table, field_types, drop=False, log=log):
if drop:
self.drop_table(table, log=log)
new_ftypes = OrderedDict()
for f in field_types:
(ftype, max_len, dec_len) = field_types[f]
if dec_len:
suff = '({},{})'.format(max_len, dec_len)
elif ma... | def create_table(self, table, field_types, drop=False, log=log):
if drop:
self.drop_table(table, log=log)
new_ftypes = OrderedDict()
for f in field_types:
(ftype, max_len, dec_len) = field_types[f]
if dec_len:
suff = '({},{})'.format(max_len, dec_len)
elif ma... |
8552087d57da4d6950a288e8d18e8fce31d23a0c98b4df2a6b18c49675356ae9 | def _get_cursor_fields(self, as_dict=False, native_type=True, cursor_desc=None):
'Get fields of active Select cursor'
fields = OrderedDict()
cursor_desc = (cursor_desc if cursor_desc else self._cursor_description)
if (cursor_desc == None):
return []
for f in cursor_desc:
f_name = f[0... | Get fields of active Select cursor | xutil/database/base.py | _get_cursor_fields | flarco/n1slutil | 1 | python | def _get_cursor_fields(self, as_dict=False, native_type=True, cursor_desc=None):
fields = OrderedDict()
cursor_desc = (cursor_desc if cursor_desc else self._cursor_description)
if (cursor_desc == None):
return []
for f in cursor_desc:
f_name = f[0].lower()
if as_dict:
... | def _get_cursor_fields(self, as_dict=False, native_type=True, cursor_desc=None):
fields = OrderedDict()
cursor_desc = (cursor_desc if cursor_desc else self._cursor_description)
if (cursor_desc == None):
return []
for f in cursor_desc:
f_name = f[0].lower()
if as_dict:
... |
e784c53226e41a4b36798921ca6b8fa97368dd50f2884affd7604e929b17fd4a | def stream(self, sql, rec_name='Record', dtype='namedtuple', yield_chuncks=False, chunk_size=None, limit=None, echo=True):
'Stream Select from SQL, yield records as they come in'
self.reconnect(min_tresh=10)
if echo:
log("Streaming SQL for '{}'.".format(rec_name))
fetch_size = (limit if limit el... | Stream Select from SQL, yield records as they come in | xutil/database/base.py | stream | flarco/n1slutil | 1 | python | def stream(self, sql, rec_name='Record', dtype='namedtuple', yield_chuncks=False, chunk_size=None, limit=None, echo=True):
self.reconnect(min_tresh=10)
if echo:
log("Streaming SQL for '{}'.".format(rec_name))
fetch_size = (limit if limit else self.fetch_size)
fetch_size = (chunk_size if chu... | def stream(self, sql, rec_name='Record', dtype='namedtuple', yield_chuncks=False, chunk_size=None, limit=None, echo=True):
self.reconnect(min_tresh=10)
if echo:
log("Streaming SQL for '{}'.".format(rec_name))
fetch_size = (limit if limit else self.fetch_size)
fetch_size = (chunk_size if chu... |
c4dac5cb0402429b4f38e1b3f11763a51bd6b4c63d4e032776a9dcec6e5a374b | def query(self, sql, rec_name='Record', dtype='namedtuple', limit=None, echo=True, retrying=False, log=log):
'Select from SQL, return list of namedtuples'
self.reconnect(min_tresh=10)
s_t = datetime.datetime.now()
_data = list(self.stream(sql, dtype=dtype, echo=False, limit=limit))
if (not self.resu... | Select from SQL, return list of namedtuples | xutil/database/base.py | query | flarco/n1slutil | 1 | python | def query(self, sql, rec_name='Record', dtype='namedtuple', limit=None, echo=True, retrying=False, log=log):
self.reconnect(min_tresh=10)
s_t = datetime.datetime.now()
_data = list(self.stream(sql, dtype=dtype, echo=False, limit=limit))
if (not self.result.closed):
self.result.close()
f... | def query(self, sql, rec_name='Record', dtype='namedtuple', limit=None, echo=True, retrying=False, log=log):
self.reconnect(min_tresh=10)
s_t = datetime.datetime.now()
_data = list(self.stream(sql, dtype=dtype, echo=False, limit=limit))
if (not self.result.closed):
self.result.close()
f... |
98c610c71ed3352ebed2a9de5753d48e2ab6be08be1f9c58f034790b3453cabb | def get_schemas(self, echo=True):
'Get list of schemas.'
Rec = namedtuple('Schemas', 'schema')
self._fields = Rec._fields
sql_tmpl = self._template('metadata.schemas')
if sql_tmpl:
schemas = [r[0] for r in self.query(sql_tmpl)]
else:
self.get_engine(echo=echo)
schemas = s... | Get list of schemas. | xutil/database/base.py | get_schemas | flarco/n1slutil | 1 | python | def get_schemas(self, echo=True):
Rec = namedtuple('Schemas', 'schema')
self._fields = Rec._fields
sql_tmpl = self._template('metadata.schemas')
if sql_tmpl:
schemas = [r[0] for r in self.query(sql_tmpl)]
else:
self.get_engine(echo=echo)
schemas = self.engine_inspect.get... | def get_schemas(self, echo=True):
Rec = namedtuple('Schemas', 'schema')
self._fields = Rec._fields
sql_tmpl = self._template('metadata.schemas')
if sql_tmpl:
schemas = [r[0] for r in self.query(sql_tmpl)]
else:
self.get_engine(echo=echo)
schemas = self.engine_inspect.get... |
d4f2d411f364ed8b6bc70dba4314b92cacbbd69e20242a5a314522dbb48c8ad3 | def get_objects(self, schema, object_type='all', echo=True):
"Get metadata for objects. object_type in 'all', 'table', 'view'"
Rec = namedtuple('Table', 'schema object_name object_type')
self._fields = Rec._fields
def get_rec(object_name, object_type):
r_dict = dict(schema=schema, object_name=o... | Get metadata for objects. object_type in 'all', 'table', 'view' | xutil/database/base.py | get_objects | flarco/n1slutil | 1 | python | def get_objects(self, schema, object_type='all', echo=True):
Rec = namedtuple('Table', 'schema object_name object_type')
self._fields = Rec._fields
def get_rec(object_name, object_type):
r_dict = dict(schema=schema, object_name=object_name, object_type=object_type)
return Rec(**r_dict)... | def get_objects(self, schema, object_type='all', echo=True):
Rec = namedtuple('Table', 'schema object_name object_type')
self._fields = Rec._fields
def get_rec(object_name, object_type):
r_dict = dict(schema=schema, object_name=object_name, object_type=object_type)
return Rec(**r_dict)... |
baa2c1769bd5f16e7b518d6708472367f68cfcc2857cdfc7dd87d5a20e05171d | def get_tables(self, schema, echo=True):
'Get metadata for tables.'
schemas = (schema if isinstance(schema, list) else [schema])
def get_tables_for(schema):
def get_rec(table):
self._fields = ['schema', 'table']
return tuple([schema, table])
Rec = namedtuple('Ta... | Get metadata for tables. | xutil/database/base.py | get_tables | flarco/n1slutil | 1 | python | def get_tables(self, schema, echo=True):
schemas = (schema if isinstance(schema, list) else [schema])
def get_tables_for(schema):
def get_rec(table):
self._fields = ['schema', 'table']
return tuple([schema, table])
Rec = namedtuple('Table', 'schema table')
... | def get_tables(self, schema, echo=True):
schemas = (schema if isinstance(schema, list) else [schema])
def get_tables_for(schema):
def get_rec(table):
self._fields = ['schema', 'table']
return tuple([schema, table])
Rec = namedtuple('Table', 'schema table')
... |
5dc0405053af132ade21aa57d849581cf706426ae3f9397f73046b45a1737eb0 | def get_views(self, schema, echo=True):
'Get metadata for views.'
schemas = (schema if isinstance(schema, list) else [schema])
def get_views_for(schema):
def get_rec(view):
self._fields = ['schema', 'view']
return tuple([schema, view])
Rec = namedtuple('View', '... | Get metadata for views. | xutil/database/base.py | get_views | flarco/n1slutil | 1 | python | def get_views(self, schema, echo=True):
schemas = (schema if isinstance(schema, list) else [schema])
def get_views_for(schema):
def get_rec(view):
self._fields = ['schema', 'view']
return tuple([schema, view])
Rec = namedtuple('View', 'schema view')
... | def get_views(self, schema, echo=True):
schemas = (schema if isinstance(schema, list) else [schema])
def get_views_for(schema):
def get_rec(view):
self._fields = ['schema', 'view']
return tuple([schema, view])
Rec = namedtuple('View', 'schema view')
... |
3b807a9ecd936cfd89e933b388fbdc6dc286e05e4e401ddeaf25aad8f3827bcf | def get_columns(self, table_name, object_type=None, echo=False, include_schema_table=True, native_type=True):
'Get column metadata for table'
if include_schema_table:
headers = 'schema table id column_name type nullable default autoincrement'
else:
headers = 'id column_name type nullable de... | Get column metadata for table | xutil/database/base.py | get_columns | flarco/n1slutil | 1 | python | def get_columns(self, table_name, object_type=None, echo=False, include_schema_table=True, native_type=True):
if include_schema_table:
headers = 'schema table id column_name type nullable default autoincrement'
else:
headers = 'id column_name type nullable default autoincrement'
Rec = ... | def get_columns(self, table_name, object_type=None, echo=False, include_schema_table=True, native_type=True):
if include_schema_table:
headers = 'schema table id column_name type nullable default autoincrement'
else:
headers = 'id column_name type nullable default autoincrement'
Rec = ... |
17bce1b78848abad11517ba21ea99047937c33033fc7fcf8c49b6f602ff544e0 | def get_primary_keys(self, table_name, echo=False):
'Get PK metadata for table'
Rec = namedtuple('PKs', 'schema table pk_name column_name column_order')
self._fields = Rec._fields
(schema, table) = self._split_schema_table(table_name)
def get_rec(col, pk_name, column_order):
r_dict = {}
... | Get PK metadata for table | xutil/database/base.py | get_primary_keys | flarco/n1slutil | 1 | python | def get_primary_keys(self, table_name, echo=False):
Rec = namedtuple('PKs', 'schema table pk_name column_name column_order')
self._fields = Rec._fields
(schema, table) = self._split_schema_table(table_name)
def get_rec(col, pk_name, column_order):
r_dict = {}
r_dict['schema'] = sch... | def get_primary_keys(self, table_name, echo=False):
Rec = namedtuple('PKs', 'schema table pk_name column_name column_order')
self._fields = Rec._fields
(schema, table) = self._split_schema_table(table_name)
def get_rec(col, pk_name, column_order):
r_dict = {}
r_dict['schema'] = sch... |
0d95e8c477a7ded1541044aba5fc36beeb11bc2d1a239db15b50350628a1509b | def get_indexes(self, table_name, echo=False):
'Get indexes metadata for table'
Rec = namedtuple('Indexes', 'schema table index_name column_name column_order unique')
self._fields = Rec._fields
(schema, table) = self._split_schema_table(table_name)
def get_rec(r_dict):
r_dict['schema'] = sc... | Get indexes metadata for table | xutil/database/base.py | get_indexes | flarco/n1slutil | 1 | python | def get_indexes(self, table_name, echo=False):
Rec = namedtuple('Indexes', 'schema table index_name column_name column_order unique')
self._fields = Rec._fields
(schema, table) = self._split_schema_table(table_name)
def get_rec(r_dict):
r_dict['schema'] = schema
r_dict['table'] = t... | def get_indexes(self, table_name, echo=False):
Rec = namedtuple('Indexes', 'schema table index_name column_name column_order unique')
self._fields = Rec._fields
(schema, table) = self._split_schema_table(table_name)
def get_rec(r_dict):
r_dict['schema'] = schema
r_dict['table'] = t... |
9a0ed2162f0d01cf8331ddc4f0d94850bee8d082bcbaebb469838fa23f64b0a3 | def get_ddl(self, table_name, object_type=None, echo=True):
'Get ddl for table'
Rec = namedtuple('DDL', 'ddl')
self._fields = Rec._fields
(schema, table) = self._split_schema_table(table_name)
sql_tmpl = self._template('metadata.ddl')
if sql_tmpl:
rows = self.query(sql_tmpl.format(schema... | Get ddl for table | xutil/database/base.py | get_ddl | flarco/n1slutil | 1 | python | def get_ddl(self, table_name, object_type=None, echo=True):
Rec = namedtuple('DDL', 'ddl')
self._fields = Rec._fields
(schema, table) = self._split_schema_table(table_name)
sql_tmpl = self._template('metadata.ddl')
if sql_tmpl:
rows = self.query(sql_tmpl.format(schema=schema, table=tabl... | def get_ddl(self, table_name, object_type=None, echo=True):
Rec = namedtuple('DDL', 'ddl')
self._fields = Rec._fields
(schema, table) = self._split_schema_table(table_name)
sql_tmpl = self._template('metadata.ddl')
if sql_tmpl:
rows = self.query(sql_tmpl.format(schema=schema, table=tabl... |
e8c0beb21952202faabaa462699032b5930d50fd2c0b89a3a1921b582455fe6e | def get_all_columns(self):
'Get all columns for all tables / views'
sql_tmpl = self._template('metadata.all_columns')
if (not sql_tmpl):
raise Exception('get_all_columns not implemented for {}'.format(self.type))
rows = self.query(sql_tmpl)
return rows | Get all columns for all tables / views | xutil/database/base.py | get_all_columns | flarco/n1slutil | 1 | python | def get_all_columns(self):
sql_tmpl = self._template('metadata.all_columns')
if (not sql_tmpl):
raise Exception('get_all_columns not implemented for {}'.format(self.type))
rows = self.query(sql_tmpl)
return rows | def get_all_columns(self):
sql_tmpl = self._template('metadata.all_columns')
if (not sql_tmpl):
raise Exception('get_all_columns not implemented for {}'.format(self.type))
rows = self.query(sql_tmpl)
return rows<|docstring|>Get all columns for all tables / views<|endoftext|> |
3de54e1433e8d5a6df6d14e4f53646ee88882ad2085a6fe30e0c5bb2b5a8928f | def get_all_tables(self, filter, as_sql=False):
'Get all tables / views'
sql_tmpl = self._template('metadata.all_tables')
if (not sql_tmpl):
raise Exception('get_all_tables not implemented for {}'.format(self.type))
sql = sql_tmpl.format(filter=filter)
return (sql if as_sql else self.query(s... | Get all tables / views | xutil/database/base.py | get_all_tables | flarco/n1slutil | 1 | python | def get_all_tables(self, filter, as_sql=False):
sql_tmpl = self._template('metadata.all_tables')
if (not sql_tmpl):
raise Exception('get_all_tables not implemented for {}'.format(self.type))
sql = sql_tmpl.format(filter=filter)
return (sql if as_sql else self.query(sql, echo=False)) | def get_all_tables(self, filter, as_sql=False):
sql_tmpl = self._template('metadata.all_tables')
if (not sql_tmpl):
raise Exception('get_all_tables not implemented for {}'.format(self.type))
sql = sql_tmpl.format(filter=filter)
return (sql if as_sql else self.query(sql, echo=False))<|docstr... |
f09b6282662a437fbcb281a37e77a5765bf00a20add3201c6fbc2f33cedfcaf1 | def analyze_fields(self, analysis, table_name, fields=[], as_sql=False, union=True, expr_func_map={}, **kwargs):
'Base function for field level analysis\n expr_func_map: contains mapping for expression to SQL function to all fields\n '
if ('.' not in table_name):
raise Exception("table_name must... | Base function for field level analysis
expr_func_map: contains mapping for expression to SQL function to all fields | xutil/database/base.py | analyze_fields | flarco/n1slutil | 1 | python | def analyze_fields(self, analysis, table_name, fields=[], as_sql=False, union=True, expr_func_map={}, **kwargs):
'Base function for field level analysis\n expr_func_map: contains mapping for expression to SQL function to all fields\n '
if ('.' not in table_name):
raise Exception("table_name must... | def analyze_fields(self, analysis, table_name, fields=[], as_sql=False, union=True, expr_func_map={}, **kwargs):
'Base function for field level analysis\n expr_func_map: contains mapping for expression to SQL function to all fields\n '
if ('.' not in table_name):
raise Exception("table_name must... |
8317f34a3dbfb77308cd32ae8fde365408551b967d532b998dba93cf354577dc | def analyze_tables(self, analysis, tables=[], as_sql=False, **kwargs):
'Base function for table level analysis'
if (analysis not in self.template_dict['analysis']):
raise Exception("'{}' not found in template for '{}'.".format(analysis, self.type))
if ((not tables) and ('schema' in kwargs)):
... | Base function for table level analysis | xutil/database/base.py | analyze_tables | flarco/n1slutil | 1 | python | def analyze_tables(self, analysis, tables=[], as_sql=False, **kwargs):
if (analysis not in self.template_dict['analysis']):
raise Exception("'{}' not found in template for '{}'.".format(analysis, self.type))
if ((not tables) and ('schema' in kwargs)):
rows = self.get_schemas(kwargs['schema'... | def analyze_tables(self, analysis, tables=[], as_sql=False, **kwargs):
if (analysis not in self.template_dict['analysis']):
raise Exception("'{}' not found in template for '{}'.".format(analysis, self.type))
if ((not tables) and ('schema' in kwargs)):
rows = self.get_schemas(kwargs['schema'... |
a260aa7a8739bdb61974c40199ebb8772a0a7d2fc5f930a0e28dbd3b861f8a20 | def create_or_get_cache_dir(self, module=''):
'create (if not exists) or return cache dir path for module'
cache_dir = '{}/{}'.format(self.__cache_dir, module)
if (not os.path.exists(cache_dir)):
os.makedirs(cache_dir)
return cache_dir | create (if not exists) or return cache dir path for module | ods/ods.py | create_or_get_cache_dir | open-datastudio/ods | 6 | python | def create_or_get_cache_dir(self, module=):
cache_dir = '{}/{}'.format(self.__cache_dir, module)
if (not os.path.exists(cache_dir)):
os.makedirs(cache_dir)
return cache_dir | def create_or_get_cache_dir(self, module=):
cache_dir = '{}/{}'.format(self.__cache_dir, module)
if (not os.path.exists(cache_dir)):
os.makedirs(cache_dir)
return cache_dir<|docstring|>create (if not exists) or return cache dir path for module<|endoftext|> |
d859c845eb6f19e9d2955cf014752105af3425ddbe86cf9dd1eaab726106e560 | def __init__(self, backup_policy=None):
'SetBackupPolicyRequestBody - a model defined in huaweicloud sdk'
self._backup_policy = None
self.discriminator = None
self.backup_policy = backup_policy | SetBackupPolicyRequestBody - a model defined in huaweicloud sdk | huaweicloud-sdk-dds/huaweicloudsdkdds/v3/model/set_backup_policy_request_body.py | __init__ | githubmilesma/huaweicloud-sdk-python-v3 | 1 | python | def __init__(self, backup_policy=None):
self._backup_policy = None
self.discriminator = None
self.backup_policy = backup_policy | def __init__(self, backup_policy=None):
self._backup_policy = None
self.discriminator = None
self.backup_policy = backup_policy<|docstring|>SetBackupPolicyRequestBody - a model defined in huaweicloud sdk<|endoftext|> |
ffe91840b6c38b35603932e289c3a98ce26743f1bd0391f98e1df272b79afbcf | @property
def backup_policy(self):
'Gets the backup_policy of this SetBackupPolicyRequestBody.\n\n\n :return: The backup_policy of this SetBackupPolicyRequestBody.\n :rtype: BackupPolicy\n '
return self._backup_policy | Gets the backup_policy of this SetBackupPolicyRequestBody.
:return: The backup_policy of this SetBackupPolicyRequestBody.
:rtype: BackupPolicy | huaweicloud-sdk-dds/huaweicloudsdkdds/v3/model/set_backup_policy_request_body.py | backup_policy | githubmilesma/huaweicloud-sdk-python-v3 | 1 | python | @property
def backup_policy(self):
'Gets the backup_policy of this SetBackupPolicyRequestBody.\n\n\n :return: The backup_policy of this SetBackupPolicyRequestBody.\n :rtype: BackupPolicy\n '
return self._backup_policy | @property
def backup_policy(self):
'Gets the backup_policy of this SetBackupPolicyRequestBody.\n\n\n :return: The backup_policy of this SetBackupPolicyRequestBody.\n :rtype: BackupPolicy\n '
return self._backup_policy<|docstring|>Gets the backup_policy of this SetBackupPolicyRequestBody.
... |
aed68daf82e9fb5f79e8e9543446f7f966de92a0609b77c9db45687446557ebd | @backup_policy.setter
def backup_policy(self, backup_policy):
'Sets the backup_policy of this SetBackupPolicyRequestBody.\n\n\n :param backup_policy: The backup_policy of this SetBackupPolicyRequestBody.\n :type: BackupPolicy\n '
self._backup_policy = backup_policy | Sets the backup_policy of this SetBackupPolicyRequestBody.
:param backup_policy: The backup_policy of this SetBackupPolicyRequestBody.
:type: BackupPolicy | huaweicloud-sdk-dds/huaweicloudsdkdds/v3/model/set_backup_policy_request_body.py | backup_policy | githubmilesma/huaweicloud-sdk-python-v3 | 1 | python | @backup_policy.setter
def backup_policy(self, backup_policy):
'Sets the backup_policy of this SetBackupPolicyRequestBody.\n\n\n :param backup_policy: The backup_policy of this SetBackupPolicyRequestBody.\n :type: BackupPolicy\n '
self._backup_policy = backup_policy | @backup_policy.setter
def backup_policy(self, backup_policy):
'Sets the backup_policy of this SetBackupPolicyRequestBody.\n\n\n :param backup_policy: The backup_policy of this SetBackupPolicyRequestBody.\n :type: BackupPolicy\n '
self._backup_policy = backup_policy<|docstring|>Sets the back... |
23795442a46e2cd10dec98fded44ed9172a29971e98983a30ad89baa6c9c0a03 | def to_dict(self):
'Returns the model properties as a dict'
result = {}
for (attr, _) in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
e... | Returns the model properties as a dict | huaweicloud-sdk-dds/huaweicloudsdkdds/v3/model/set_backup_policy_request_body.py | to_dict | githubmilesma/huaweicloud-sdk-python-v3 | 1 | python | def to_dict(self):
result = {}
for (attr, _) in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
elif hasattr(value, 'to_dict'):
... | def to_dict(self):
result = {}
for (attr, _) in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
elif hasattr(value, 'to_dict'):
... |
cbb19eaa2fc8a113d9e32f924ef280a7e97563f8915f94f65dab438997af2e99 | def to_str(self):
'Returns the string representation of the model'
return pprint.pformat(self.to_dict()) | Returns the string representation of the model | huaweicloud-sdk-dds/huaweicloudsdkdds/v3/model/set_backup_policy_request_body.py | to_str | githubmilesma/huaweicloud-sdk-python-v3 | 1 | python | def to_str(self):
return pprint.pformat(self.to_dict()) | def to_str(self):
return pprint.pformat(self.to_dict())<|docstring|>Returns the string representation of the model<|endoftext|> |
772243a2c2b3261a9b954d07aaf295e3c1242a579a495e2d6a5679c677861703 | def __repr__(self):
'For `print` and `pprint`'
return self.to_str() | For `print` and `pprint` | huaweicloud-sdk-dds/huaweicloudsdkdds/v3/model/set_backup_policy_request_body.py | __repr__ | githubmilesma/huaweicloud-sdk-python-v3 | 1 | python | def __repr__(self):
return self.to_str() | def __repr__(self):
return self.to_str()<|docstring|>For `print` and `pprint`<|endoftext|> |
9c5bb75197376d0792d8d84beb70ed61c4b1366198ca62bd2dcf4d79c52078b2 | def __eq__(self, other):
'Returns true if both objects are equal'
if (not isinstance(other, SetBackupPolicyRequestBody)):
return False
return (self.__dict__ == other.__dict__) | Returns true if both objects are equal | huaweicloud-sdk-dds/huaweicloudsdkdds/v3/model/set_backup_policy_request_body.py | __eq__ | githubmilesma/huaweicloud-sdk-python-v3 | 1 | python | def __eq__(self, other):
if (not isinstance(other, SetBackupPolicyRequestBody)):
return False
return (self.__dict__ == other.__dict__) | def __eq__(self, other):
if (not isinstance(other, SetBackupPolicyRequestBody)):
return False
return (self.__dict__ == other.__dict__)<|docstring|>Returns true if both objects are equal<|endoftext|> |
43dc6740163eb9fc1161d09cb2208a64c7ad0cc8d9c8637ac3264522d3ec7e42 | def __ne__(self, other):
'Returns true if both objects are not equal'
return (not (self == other)) | Returns true if both objects are not equal | huaweicloud-sdk-dds/huaweicloudsdkdds/v3/model/set_backup_policy_request_body.py | __ne__ | githubmilesma/huaweicloud-sdk-python-v3 | 1 | python | def __ne__(self, other):
return (not (self == other)) | def __ne__(self, other):
return (not (self == other))<|docstring|>Returns true if both objects are not equal<|endoftext|> |
9e07857f3269477dccc6c433756f9f9588b8241d31741ca2732848f7fa1a9212 | def main() -> None:
'\n Entry point of this test project.\n '
ap.Stage(background_color='#333', stage_width=1000, stage_height=500)
sprite: ap.Sprite = ap.Sprite()
sprite.graphics.line_style(color='#0af', round_dot_setting=ap.LineRoundDotSetting(round_size=10, space_size=10))
sprite.graphics.m... | Entry point of this test project. | test_projects/line_round_dot_setting/main.py | main | ynsnf/apysc | 16 | python | def main() -> None:
'\n \n '
ap.Stage(background_color='#333', stage_width=1000, stage_height=500)
sprite: ap.Sprite = ap.Sprite()
sprite.graphics.line_style(color='#0af', round_dot_setting=ap.LineRoundDotSetting(round_size=10, space_size=10))
sprite.graphics.move_to(x=50, y=30)
sprite.gra... | def main() -> None:
'\n \n '
ap.Stage(background_color='#333', stage_width=1000, stage_height=500)
sprite: ap.Sprite = ap.Sprite()
sprite.graphics.line_style(color='#0af', round_dot_setting=ap.LineRoundDotSetting(round_size=10, space_size=10))
sprite.graphics.move_to(x=50, y=30)
sprite.gra... |
2c1b782605df9260aec00e1754eacee1e1948b56b27fd18d6d0b42eb26a22c3f | def on_polyline_click(e: ap.MouseEvent[ap.Polyline], options: dict) -> None:
'\n Handler that called when polyline is clicked.\n\n Parameters\n ----------\n e : MouseEvent\n Created MouseEvent instance.\n options : dict\n Optional parameters.\n '
polyline: ap.Polyline = e.this
... | Handler that called when polyline is clicked.
Parameters
----------
e : MouseEvent
Created MouseEvent instance.
options : dict
Optional parameters. | test_projects/line_round_dot_setting/main.py | on_polyline_click | ynsnf/apysc | 16 | python | def on_polyline_click(e: ap.MouseEvent[ap.Polyline], options: dict) -> None:
'\n Handler that called when polyline is clicked.\n\n Parameters\n ----------\n e : MouseEvent\n Created MouseEvent instance.\n options : dict\n Optional parameters.\n '
polyline: ap.Polyline = e.this
... | def on_polyline_click(e: ap.MouseEvent[ap.Polyline], options: dict) -> None:
'\n Handler that called when polyline is clicked.\n\n Parameters\n ----------\n e : MouseEvent\n Created MouseEvent instance.\n options : dict\n Optional parameters.\n '
polyline: ap.Polyline = e.this
... |
18e9fb5fe461d7abb0b2f9cf7cde507b46370644f7d1f078e422ef9435f136c3 | def log(self, message):
'\n Logs a message for analysis of model training.\n '
self._logger.log(message) | Logs a message for analysis of model training. | rafiki/model/log.py | log | Yirui-Wang/rafiki | 1 | python | def log(self, message):
'\n \n '
self._logger.log(message) | def log(self, message):
'\n \n '
self._logger.log(message)<|docstring|>Logs a message for analysis of model training.<|endoftext|> |
e55efd90c01ca289ac0b9eedccb73a2908d9937c43c6f44f1c4ee030c9aeb67f | def define_loss_plot(self):
'\n Convenience method of defining a plot of ``loss`` against ``epoch``.\n To be used with ``log_loss_metric()``.\n '
self.define_plot('Loss Over Epochs', ['loss'], x_axis='epoch') | Convenience method of defining a plot of ``loss`` against ``epoch``.
To be used with ``log_loss_metric()``. | rafiki/model/log.py | define_loss_plot | Yirui-Wang/rafiki | 1 | python | def define_loss_plot(self):
'\n Convenience method of defining a plot of ``loss`` against ``epoch``.\n To be used with ``log_loss_metric()``.\n '
self.define_plot('Loss Over Epochs', ['loss'], x_axis='epoch') | def define_loss_plot(self):
'\n Convenience method of defining a plot of ``loss`` against ``epoch``.\n To be used with ``log_loss_metric()``.\n '
self.define_plot('Loss Over Epochs', ['loss'], x_axis='epoch')<|docstring|>Convenience method of defining a plot of ``loss`` against ``epoch``.
T... |
624a76a79ff7b38efccea6f1bd42b258cab3b0daf7d1b642bba07cdc635e389e | def log_loss_metric(self, loss, epoch):
'\n Convenience method for logging `loss` against `epoch`.\n To be used with ``define_loss_plot()``.\n '
self.log_metrics(loss=loss, epoch=epoch) | Convenience method for logging `loss` against `epoch`.
To be used with ``define_loss_plot()``. | rafiki/model/log.py | log_loss_metric | Yirui-Wang/rafiki | 1 | python | def log_loss_metric(self, loss, epoch):
'\n Convenience method for logging `loss` against `epoch`.\n To be used with ``define_loss_plot()``.\n '
self.log_metrics(loss=loss, epoch=epoch) | def log_loss_metric(self, loss, epoch):
'\n Convenience method for logging `loss` against `epoch`.\n To be used with ``define_loss_plot()``.\n '
self.log_metrics(loss=loss, epoch=epoch)<|docstring|>Convenience method for logging `loss` against `epoch`.
To be used with ``define_loss_plot()``... |
34b06862e88a7ff2d9a93a95375c875508ad3219f6e61d1e597928c7fbff9c90 | def define_plot(self, title, metrics, x_axis=None):
'\n Defines a plot for a set of metrics for analysis of model training.\n By default, metrics will be plotted against time.\n '
self._logger.define_plot(title, metrics, x_axis) | Defines a plot for a set of metrics for analysis of model training.
By default, metrics will be plotted against time. | rafiki/model/log.py | define_plot | Yirui-Wang/rafiki | 1 | python | def define_plot(self, title, metrics, x_axis=None):
'\n Defines a plot for a set of metrics for analysis of model training.\n By default, metrics will be plotted against time.\n '
self._logger.define_plot(title, metrics, x_axis) | def define_plot(self, title, metrics, x_axis=None):
'\n Defines a plot for a set of metrics for analysis of model training.\n By default, metrics will be plotted against time.\n '
self._logger.define_plot(title, metrics, x_axis)<|docstring|>Defines a plot for a set of metrics for analysis o... |
365392fcb18608671432af15e629a5e0a6ec4b5a2553527d04403090b5bfa5f9 | def log_metrics(self, **kwargs):
'\n Logs metrics for a single point in time { <metric>: <value> }.\n <value> should be a number.\n '
self._logger.log_metrics(**kwargs) | Logs metrics for a single point in time { <metric>: <value> }.
<value> should be a number. | rafiki/model/log.py | log_metrics | Yirui-Wang/rafiki | 1 | python | def log_metrics(self, **kwargs):
'\n Logs metrics for a single point in time { <metric>: <value> }.\n <value> should be a number.\n '
self._logger.log_metrics(**kwargs) | def log_metrics(self, **kwargs):
'\n Logs metrics for a single point in time { <metric>: <value> }.\n <value> should be a number.\n '
self._logger.log_metrics(**kwargs)<|docstring|>Logs metrics for a single point in time { <metric>: <value> }.
<value> should be a number.<|endoftext|> |
aad6d434a880a23e02d1c825102d3b786f960dae1342bbd1686c303dd4391e95 | def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues):
'\n This function prints and plots the confusion matrix.\n Normalization can be applied by setting `normalize=True`.\n '
plt.imshow(cm, interpolation='nearest', cmap=cmap)
plt.title(title)
plt.... | This function prints and plots the confusion matrix.
Normalization can be applied by setting `normalize=True`. | TrainValue/multiclass_svm.py | plot_confusion_matrix | xuanthuong/DOU-SI | 0 | python | def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues):
'\n This function prints and plots the confusion matrix.\n Normalization can be applied by setting `normalize=True`.\n '
plt.imshow(cm, interpolation='nearest', cmap=cmap)
plt.title(title)
plt.... | def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues):
'\n This function prints and plots the confusion matrix.\n Normalization can be applied by setting `normalize=True`.\n '
plt.imshow(cm, interpolation='nearest', cmap=cmap)
plt.title(title)
plt.... |
f9c04a07ca203621acf60f2b6d7fd185ff62290499797d71389366c347178b63 | def GetHumanReadable(size, precision=2):
'Takes a byte sized input and computes the closest\n human readable format, e.g., in megabytes etc.'
suffixes = ['B', 'KB', 'MB', 'GB', 'TB']
suffixIndex = 0
while ((size > 1024) and (suffixIndex < 4)):
suffixIndex += 1
size = (size / 1024)
... | Takes a byte sized input and computes the closest
human readable format, e.g., in megabytes etc. | exercise_05/exercise_code/networks/compute_network_size.py | GetHumanReadable | Sihifu/i2dl | 0 | python | def GetHumanReadable(size, precision=2):
'Takes a byte sized input and computes the closest\n human readable format, e.g., in megabytes etc.'
suffixes = ['B', 'KB', 'MB', 'GB', 'TB']
suffixIndex = 0
while ((size > 1024) and (suffixIndex < 4)):
suffixIndex += 1
size = (size / 1024)
... | def GetHumanReadable(size, precision=2):
'Takes a byte sized input and computes the closest\n human readable format, e.g., in megabytes etc.'
suffixes = ['B', 'KB', 'MB', 'GB', 'TB']
suffixIndex = 0
while ((size > 1024) and (suffixIndex < 4)):
suffixIndex += 1
size = (size / 1024)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.