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 |
|---|---|---|---|---|---|---|---|---|---|
b5e7e07122593b6fa96664307ade09dd691618950e5515ba8f16de1dccfffa83 | def _crop(inname, outname, color):
'\n Crop the image and colour it in a flat colour. The alpha channel is left unchanged.\n :param inname: base name of input file. Input image is {inname}1.png. The 1 is added by latex.\n :param outname: base name of output file. Output image is {outname}.png\n :param c... | Crop the image and colour it in a flat colour. The alpha channel is left unchanged.
:param inname: base name of input file. Input image is {inname}1.png. The 1 is added by latex.
:param outname: base name of output file. Output image is {outname}.png
:param color:
:return: | generativepy/formulas.py | _crop | sthagen/martinmcbride-generativepy | 0 | python | def _crop(inname, outname, color):
'\n Crop the image and colour it in a flat colour. The alpha channel is left unchanged.\n :param inname: base name of input file. Input image is {inname}1.png. The 1 is added by latex.\n :param outname: base name of output file. Output image is {outname}.png\n :param c... | def _crop(inname, outname, color):
'\n Crop the image and colour it in a flat colour. The alpha channel is left unchanged.\n :param inname: base name of input file. Input image is {inname}1.png. The 1 is added by latex.\n :param outname: base name of output file. Output image is {outname}.png\n :param c... |
ac41ec54f3d8116288088ea4ea8e288e6b0cf2ce6880a35424b64ce27afa1402 | def _remove_ignore_errors(filename):
"\n Remove a file but ignore errors. We shouldn;t fail just because a temp file didn't get deleted.\n :param filename:\n :return: None\n "
try:
os.remove(filename)
except Exception:
pass | Remove a file but ignore errors. We shouldn;t fail just because a temp file didn't get deleted.
:param filename:
:return: None | generativepy/formulas.py | _remove_ignore_errors | sthagen/martinmcbride-generativepy | 0 | python | def _remove_ignore_errors(filename):
"\n Remove a file but ignore errors. We shouldn;t fail just because a temp file didn't get deleted.\n :param filename:\n :return: None\n "
try:
os.remove(filename)
except Exception:
pass | def _remove_ignore_errors(filename):
"\n Remove a file but ignore errors. We shouldn;t fail just because a temp file didn't get deleted.\n :param filename:\n :return: None\n "
try:
os.remove(filename)
except Exception:
pass<|docstring|>Remove a file but ignore errors. We shouldn;... |
4855c1cc2ed6f44e0e81920fafe16843af3ff5ca85d165e16aa2f038d7661c1d | def rasterise_formula(name, formula, color, dpi=600):
'\n Convert a latex formula into a PNG image. The PNG image will be tightly cropped, with a transparent background and\n text in the selected colour.\n :param name: Name of the output images. String with no extension, eg "myformula". The final output wi... | Convert a latex formula into a PNG image. The PNG image will be tightly cropped, with a transparent background and
text in the selected colour.
:param name: Name of the output images. String with no extension, eg "myformula". The final output will be stored
using this name, in the current working folder, so if you are ... | generativepy/formulas.py | rasterise_formula | sthagen/martinmcbride-generativepy | 0 | python | def rasterise_formula(name, formula, color, dpi=600):
'\n Convert a latex formula into a PNG image. The PNG image will be tightly cropped, with a transparent background and\n text in the selected colour.\n :param name: Name of the output images. String with no extension, eg "myformula". The final output wi... | def rasterise_formula(name, formula, color, dpi=600):
'\n Convert a latex formula into a PNG image. The PNG image will be tightly cropped, with a transparent background and\n text in the selected colour.\n :param name: Name of the output images. String with no extension, eg "myformula". The final output wi... |
80e8e516ac9d2e6922f9d15498998e0745a761c501e7448d3f1830ec89c42859 | def export_model():
'Exports the model'
trained_checkpoint_prefix = 'linear_regression'
loaded_graph = tf.Graph()
with tf.Session(graph=loaded_graph) as sess:
sess.run(tf.global_variables_initializer())
loader = tf.train.import_meta_graph((trained_checkpoint_prefix + '.meta'))
lo... | Exports the model | Chapter12/01-chapter-content/tensorflow/linear_regression_tensorflow/tensorflow_save_and_load_using_model_builder.py | export_model | ProgrammerWaterworth/Mastering-OpenCV-4-with-Python | 2 | python | def export_model():
trained_checkpoint_prefix = 'linear_regression'
loaded_graph = tf.Graph()
with tf.Session(graph=loaded_graph) as sess:
sess.run(tf.global_variables_initializer())
loader = tf.train.import_meta_graph((trained_checkpoint_prefix + '.meta'))
loader.restore(sess, ... | def export_model():
trained_checkpoint_prefix = 'linear_regression'
loaded_graph = tf.Graph()
with tf.Session(graph=loaded_graph) as sess:
sess.run(tf.global_variables_initializer())
loader = tf.train.import_meta_graph((trained_checkpoint_prefix + '.meta'))
loader.restore(sess, ... |
167afe5d948d22c647ae9c15bd36c521cc41c237b3098f94481870407a4fdaa0 | def Default(value: _TDefaultType) -> _TDefaultType:
"\n You shouldn't use this function directly.\n\n It's used internally to recognize when a default value has been overwritten, even\n if the overriden default value was truthy.\n "
return _DefaultPlaceholder(value) | You shouldn't use this function directly.
It's used internally to recognize when a default value has been overwritten, even
if the overriden default value was truthy. | sqlmodel/default.py | Default | strickvl/sqlmodel | 5,490 | python | def Default(value: _TDefaultType) -> _TDefaultType:
"\n You shouldn't use this function directly.\n\n It's used internally to recognize when a default value has been overwritten, even\n if the overriden default value was truthy.\n "
return _DefaultPlaceholder(value) | def Default(value: _TDefaultType) -> _TDefaultType:
"\n You shouldn't use this function directly.\n\n It's used internally to recognize when a default value has been overwritten, even\n if the overriden default value was truthy.\n "
return _DefaultPlaceholder(value)<|docstring|>You shouldn't use thi... |
78e92c7265fb801c2a051d5e7003ccfbd93129a4c744d42d8a80e95dbe628dd4 | def __init__(self, *, host: str='compute.googleapis.com', credentials: ga_credentials.Credentials=None, credentials_file: str=None, scopes: Sequence[str]=None, client_cert_source_for_mtls: Callable[([], Tuple[(bytes, bytes)])]=None, quota_project_id: Optional[str]=None, client_info: gapic_v1.client_info.ClientInfo=DEFA... | Instantiate the transport.
Args:
host (Optional[str]):
The hostname to connect to.
credentials (Optional[google.auth.credentials.Credentials]): The
authorization credentials to attach to requests. These
credentials identify the application to the service; if none
are specified,... | google/cloud/compute_v1/services/region_commitments/transports/rest.py | __init__ | LaudateCorpus1/python-compute | 0 | python | def __init__(self, *, host: str='compute.googleapis.com', credentials: ga_credentials.Credentials=None, credentials_file: str=None, scopes: Sequence[str]=None, client_cert_source_for_mtls: Callable[([], Tuple[(bytes, bytes)])]=None, quota_project_id: Optional[str]=None, client_info: gapic_v1.client_info.ClientInfo=DEFA... | def __init__(self, *, host: str='compute.googleapis.com', credentials: ga_credentials.Credentials=None, credentials_file: str=None, scopes: Sequence[str]=None, client_cert_source_for_mtls: Callable[([], Tuple[(bytes, bytes)])]=None, quota_project_id: Optional[str]=None, client_info: gapic_v1.client_info.ClientInfo=DEFA... |
cb32e08094e510b8f83280cfddbf61066c6f954004cf64d1bc84e6ca6a5ed169 | def __call__(self, request: compute.AggregatedListRegionCommitmentsRequest, *, retry: OptionalRetry=gapic_v1.method.DEFAULT, timeout: float=None, metadata: Sequence[Tuple[(str, str)]]=()) -> compute.CommitmentAggregatedList:
'Call the aggregated list method over HTTP.\n\n Args:\n request (... | Call the aggregated list method over HTTP.
Args:
request (~.compute.AggregatedListRegionCommitmentsRequest):
The request object. A request message for
RegionCommitments.AggregatedList. See
the method description for details.
retry (google.api_core.retry.Retry): Designation of what errors, if a... | google/cloud/compute_v1/services/region_commitments/transports/rest.py | __call__ | LaudateCorpus1/python-compute | 0 | python | def __call__(self, request: compute.AggregatedListRegionCommitmentsRequest, *, retry: OptionalRetry=gapic_v1.method.DEFAULT, timeout: float=None, metadata: Sequence[Tuple[(str, str)]]=()) -> compute.CommitmentAggregatedList:
'Call the aggregated list method over HTTP.\n\n Args:\n request (... | def __call__(self, request: compute.AggregatedListRegionCommitmentsRequest, *, retry: OptionalRetry=gapic_v1.method.DEFAULT, timeout: float=None, metadata: Sequence[Tuple[(str, str)]]=()) -> compute.CommitmentAggregatedList:
'Call the aggregated list method over HTTP.\n\n Args:\n request (... |
08913fe9f5edfa6a8db11e72ce4bfc9ecca3f248d8e29920cfaf389a544908bd | def __call__(self, request: compute.GetRegionCommitmentRequest, *, retry: OptionalRetry=gapic_v1.method.DEFAULT, timeout: float=None, metadata: Sequence[Tuple[(str, str)]]=()) -> compute.Commitment:
'Call the get method over HTTP.\n\n Args:\n request (~.compute.GetRegionCommitmentRequest):... | Call the get method over HTTP.
Args:
request (~.compute.GetRegionCommitmentRequest):
The request object. A request message for
RegionCommitments.Get. See the method
description for details.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
... | google/cloud/compute_v1/services/region_commitments/transports/rest.py | __call__ | LaudateCorpus1/python-compute | 0 | python | def __call__(self, request: compute.GetRegionCommitmentRequest, *, retry: OptionalRetry=gapic_v1.method.DEFAULT, timeout: float=None, metadata: Sequence[Tuple[(str, str)]]=()) -> compute.Commitment:
'Call the get method over HTTP.\n\n Args:\n request (~.compute.GetRegionCommitmentRequest):... | def __call__(self, request: compute.GetRegionCommitmentRequest, *, retry: OptionalRetry=gapic_v1.method.DEFAULT, timeout: float=None, metadata: Sequence[Tuple[(str, str)]]=()) -> compute.Commitment:
'Call the get method over HTTP.\n\n Args:\n request (~.compute.GetRegionCommitmentRequest):... |
6b928ae2d07010fb58ac355413d872bd9eddad1e9e8f9827a99c68762b5bc551 | def __call__(self, request: compute.InsertRegionCommitmentRequest, *, retry: OptionalRetry=gapic_v1.method.DEFAULT, timeout: float=None, metadata: Sequence[Tuple[(str, str)]]=()) -> compute.Operation:
'Call the insert method over HTTP.\n\n Args:\n request (~.compute.InsertRegionCommitmentR... | Call the insert method over HTTP.
Args:
request (~.compute.InsertRegionCommitmentRequest):
The request object. A request message for
RegionCommitments.Insert. See the method
description for details.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retr... | google/cloud/compute_v1/services/region_commitments/transports/rest.py | __call__ | LaudateCorpus1/python-compute | 0 | python | def __call__(self, request: compute.InsertRegionCommitmentRequest, *, retry: OptionalRetry=gapic_v1.method.DEFAULT, timeout: float=None, metadata: Sequence[Tuple[(str, str)]]=()) -> compute.Operation:
'Call the insert method over HTTP.\n\n Args:\n request (~.compute.InsertRegionCommitmentR... | def __call__(self, request: compute.InsertRegionCommitmentRequest, *, retry: OptionalRetry=gapic_v1.method.DEFAULT, timeout: float=None, metadata: Sequence[Tuple[(str, str)]]=()) -> compute.Operation:
'Call the insert method over HTTP.\n\n Args:\n request (~.compute.InsertRegionCommitmentR... |
384b70f0890d75055cff8255a5bffe134aacf97d35443df4784d073961905956 | def __call__(self, request: compute.ListRegionCommitmentsRequest, *, retry: OptionalRetry=gapic_v1.method.DEFAULT, timeout: float=None, metadata: Sequence[Tuple[(str, str)]]=()) -> compute.CommitmentList:
'Call the list method over HTTP.\n\n Args:\n request (~.compute.ListRegionCommitments... | Call the list method over HTTP.
Args:
request (~.compute.ListRegionCommitmentsRequest):
The request object. A request message for
RegionCommitments.List. See the method
description for details.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
... | google/cloud/compute_v1/services/region_commitments/transports/rest.py | __call__ | LaudateCorpus1/python-compute | 0 | python | def __call__(self, request: compute.ListRegionCommitmentsRequest, *, retry: OptionalRetry=gapic_v1.method.DEFAULT, timeout: float=None, metadata: Sequence[Tuple[(str, str)]]=()) -> compute.CommitmentList:
'Call the list method over HTTP.\n\n Args:\n request (~.compute.ListRegionCommitments... | def __call__(self, request: compute.ListRegionCommitmentsRequest, *, retry: OptionalRetry=gapic_v1.method.DEFAULT, timeout: float=None, metadata: Sequence[Tuple[(str, str)]]=()) -> compute.CommitmentList:
'Call the list method over HTTP.\n\n Args:\n request (~.compute.ListRegionCommitments... |
4f5857e111db227bac06443a57ac15211bee235a59be6030a1237993ad22dc6a | def __init__(self, W3=0.003, H2=0.003, Zs=36, init_dict=None):
'Constructor of the class. Can be use in two ways :\n - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values\n for Matrix, None will initialise the property with an empty Matrix\n for pyleecan type, No... | Constructor of the class. Can be use in two ways :
- __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values
for Matrix, None will initialise the property with an empty Matrix
for pyleecan type, None will call the default constructor
- __init__ (init_dict = d) d must be a dictionnary wiht ev... | Classes/SlotW24.py | __init__ | Superomeg4/pyleecan | 0 | python | def __init__(self, W3=0.003, H2=0.003, Zs=36, init_dict=None):
'Constructor of the class. Can be use in two ways :\n - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values\n for Matrix, None will initialise the property with an empty Matrix\n for pyleecan type, No... | def __init__(self, W3=0.003, H2=0.003, Zs=36, init_dict=None):
'Constructor of the class. Can be use in two ways :\n - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values\n for Matrix, None will initialise the property with an empty Matrix\n for pyleecan type, No... |
a3b0a7082993d47c043d10502823a761823c8d990c5f1c34a52ec6fa06156248 | def __str__(self):
'Convert this objet in a readeable string (for print)'
SlotW24_str = ''
SlotW24_str += (super(SlotW24, self).__str__() + linesep)
SlotW24_str += (('W3 = ' + str(self.W3)) + linesep)
SlotW24_str += ('H2 = ' + str(self.H2))
return SlotW24_str | Convert this objet in a readeable string (for print) | Classes/SlotW24.py | __str__ | Superomeg4/pyleecan | 0 | python | def __str__(self):
SlotW24_str =
SlotW24_str += (super(SlotW24, self).__str__() + linesep)
SlotW24_str += (('W3 = ' + str(self.W3)) + linesep)
SlotW24_str += ('H2 = ' + str(self.H2))
return SlotW24_str | def __str__(self):
SlotW24_str =
SlotW24_str += (super(SlotW24, self).__str__() + linesep)
SlotW24_str += (('W3 = ' + str(self.W3)) + linesep)
SlotW24_str += ('H2 = ' + str(self.H2))
return SlotW24_str<|docstring|>Convert this objet in a readeable string (for print)<|endoftext|> |
5d6049173519bd4f579b8d222eefe4e83aab6131bffebff2577d821c76838d76 | def __eq__(self, other):
'Compare two objects (skip parent)'
if (type(other) != type(self)):
return False
if (not super(SlotW24, self).__eq__(other)):
return False
if (other.W3 != self.W3):
return False
if (other.H2 != self.H2):
return False
return True | Compare two objects (skip parent) | Classes/SlotW24.py | __eq__ | Superomeg4/pyleecan | 0 | python | def __eq__(self, other):
if (type(other) != type(self)):
return False
if (not super(SlotW24, self).__eq__(other)):
return False
if (other.W3 != self.W3):
return False
if (other.H2 != self.H2):
return False
return True | def __eq__(self, other):
if (type(other) != type(self)):
return False
if (not super(SlotW24, self).__eq__(other)):
return False
if (other.W3 != self.W3):
return False
if (other.H2 != self.H2):
return False
return True<|docstring|>Compare two objects (skip parent)... |
a3a84312826d203ccb175ae53e3ac047657c6ca093bdc4a4c3df2e47cd8d3e76 | def as_dict(self):
'Convert this objet in a json seriable dict (can be use in __init__)\n '
SlotW24_dict = super(SlotW24, self).as_dict()
SlotW24_dict['W3'] = self.W3
SlotW24_dict['H2'] = self.H2
SlotW24_dict['__class__'] = 'SlotW24'
return SlotW24_dict | Convert this objet in a json seriable dict (can be use in __init__) | Classes/SlotW24.py | as_dict | Superomeg4/pyleecan | 0 | python | def as_dict(self):
'\n '
SlotW24_dict = super(SlotW24, self).as_dict()
SlotW24_dict['W3'] = self.W3
SlotW24_dict['H2'] = self.H2
SlotW24_dict['__class__'] = 'SlotW24'
return SlotW24_dict | def as_dict(self):
'\n '
SlotW24_dict = super(SlotW24, self).as_dict()
SlotW24_dict['W3'] = self.W3
SlotW24_dict['H2'] = self.H2
SlotW24_dict['__class__'] = 'SlotW24'
return SlotW24_dict<|docstring|>Convert this objet in a json seriable dict (can be use in __init__)<|endoftext|> |
63ca1f80e8c3fae78e12a57e74bbb47d462678abddd28e823e40c77079d040d5 | def _set_None(self):
'Set all the properties to None (except pyleecan object)'
self.W3 = None
self.H2 = None
super(SlotW24, self)._set_None() | Set all the properties to None (except pyleecan object) | Classes/SlotW24.py | _set_None | Superomeg4/pyleecan | 0 | python | def _set_None(self):
self.W3 = None
self.H2 = None
super(SlotW24, self)._set_None() | def _set_None(self):
self.W3 = None
self.H2 = None
super(SlotW24, self)._set_None()<|docstring|>Set all the properties to None (except pyleecan object)<|endoftext|> |
db0c5c7ddabe7b22defd211bd4745c62c7d9d73ea2de24847b390acf80ec10c8 | def _get_W3(self):
'getter of W3'
return self._W3 | getter of W3 | Classes/SlotW24.py | _get_W3 | Superomeg4/pyleecan | 0 | python | def _get_W3(self):
return self._W3 | def _get_W3(self):
return self._W3<|docstring|>getter of W3<|endoftext|> |
79d5927136e0d2b72442510bb9b888d900483e8fd43dcb357ea75fdf9776efdd | def _set_W3(self, value):
'setter of W3'
check_var('W3', value, 'float', Vmin=0)
self._W3 = value | setter of W3 | Classes/SlotW24.py | _set_W3 | Superomeg4/pyleecan | 0 | python | def _set_W3(self, value):
check_var('W3', value, 'float', Vmin=0)
self._W3 = value | def _set_W3(self, value):
check_var('W3', value, 'float', Vmin=0)
self._W3 = value<|docstring|>setter of W3<|endoftext|> |
4456531bfd45b3d2d5de2ff45ac780cdc30fa16f31b405d7791a922380a33bda | def _get_H2(self):
'getter of H2'
return self._H2 | getter of H2 | Classes/SlotW24.py | _get_H2 | Superomeg4/pyleecan | 0 | python | def _get_H2(self):
return self._H2 | def _get_H2(self):
return self._H2<|docstring|>getter of H2<|endoftext|> |
76bcd51e088a21cae6a9cb34a9240aceed84295946f028b70abace9304ee6fa1 | def _set_H2(self, value):
'setter of H2'
check_var('H2', value, 'float', Vmin=0)
self._H2 = value | setter of H2 | Classes/SlotW24.py | _set_H2 | Superomeg4/pyleecan | 0 | python | def _set_H2(self, value):
check_var('H2', value, 'float', Vmin=0)
self._H2 = value | def _set_H2(self, value):
check_var('H2', value, 'float', Vmin=0)
self._H2 = value<|docstring|>setter of H2<|endoftext|> |
d4bb2bfbc03277fba32a700c3582b96dbe2d91e41ccfc8f09657764d652e9dfa | def get_coordinates(gnd_id):
' takes a GeoNames-ID and returns a dict with lat, lng '
g = Graph()
WSG84 = Namespace('http://www.w3.org/2003/01/geo/wgs84_pos#')
try:
parsed = g.parse('https://www.geonames.org/{}/about.rdf'.format(gnd_id))
except Exception as e:
print(e)
return... | takes a GeoNames-ID and returns a dict with lat, lng | entities/utils.py | get_coordinates | reading-in-the-alps/vfbr | 0 | python | def get_coordinates(gnd_id):
' '
g = Graph()
WSG84 = Namespace('http://www.w3.org/2003/01/geo/wgs84_pos#')
try:
parsed = g.parse('https://www.geonames.org/{}/about.rdf'.format(gnd_id))
except Exception as e:
print(e)
return None
if parsed:
lat = [x for x in parse... | def get_coordinates(gnd_id):
' '
g = Graph()
WSG84 = Namespace('http://www.w3.org/2003/01/geo/wgs84_pos#')
try:
parsed = g.parse('https://www.geonames.org/{}/about.rdf'.format(gnd_id))
except Exception as e:
print(e)
return None
if parsed:
lat = [x for x in parse... |
be49493c67d047790713dcb22dd0bdca11e7e4a0127c1c5604a71c24ffb484fe | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
'Set up the Bravia TV platform.'
host = config[CONF_HOST]
bravia_config_file_path = hass.config.path(BRAVIA_CONFIG_FILE)
bravia_config = (await hass.async_add_executor_job(load_json, bravia_config_file_path))
if (... | Set up the Bravia TV platform. | homeassistant/components/braviatv/media_player.py | async_setup_platform | maurerle/core | 5 | python | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
host = config[CONF_HOST]
bravia_config_file_path = hass.config.path(BRAVIA_CONFIG_FILE)
bravia_config = (await hass.async_add_executor_job(load_json, bravia_config_file_path))
if (not bravia_config):
_LOG... | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
host = config[CONF_HOST]
bravia_config_file_path = hass.config.path(BRAVIA_CONFIG_FILE)
bravia_config = (await hass.async_add_executor_job(load_json, bravia_config_file_path))
if (not bravia_config):
_LOG... |
157515fdaf1e3a98f01d1167599d1133d3395308911797a4ea577ee41ed912a3 | async def async_setup_entry(hass, config_entry, async_add_entities):
'Set up Bravia TV Media Player from a config_entry.'
coordinator = hass.data[DOMAIN][config_entry.entry_id][BRAVIA_COORDINATOR]
unique_id = config_entry.unique_id
device_info = {'identifiers': {(DOMAIN, unique_id)}, 'name': DEFAULT_NAM... | Set up Bravia TV Media Player from a config_entry. | homeassistant/components/braviatv/media_player.py | async_setup_entry | maurerle/core | 5 | python | async def async_setup_entry(hass, config_entry, async_add_entities):
coordinator = hass.data[DOMAIN][config_entry.entry_id][BRAVIA_COORDINATOR]
unique_id = config_entry.unique_id
device_info = {'identifiers': {(DOMAIN, unique_id)}, 'name': DEFAULT_NAME, 'manufacturer': ATTR_MANUFACTURER, 'model': confi... | async def async_setup_entry(hass, config_entry, async_add_entities):
coordinator = hass.data[DOMAIN][config_entry.entry_id][BRAVIA_COORDINATOR]
unique_id = config_entry.unique_id
device_info = {'identifiers': {(DOMAIN, unique_id)}, 'name': DEFAULT_NAME, 'manufacturer': ATTR_MANUFACTURER, 'model': confi... |
81bd22d92d779836399da9b0aa58b30fd6918354ec63dee00598526a395b5220 | def __init__(self, coordinator, name, unique_id, device_info):
'Initialize the entity.'
self._name = name
self._unique_id = unique_id
self._device_info = device_info
super().__init__(coordinator) | Initialize the entity. | homeassistant/components/braviatv/media_player.py | __init__ | maurerle/core | 5 | python | def __init__(self, coordinator, name, unique_id, device_info):
self._name = name
self._unique_id = unique_id
self._device_info = device_info
super().__init__(coordinator) | def __init__(self, coordinator, name, unique_id, device_info):
self._name = name
self._unique_id = unique_id
self._device_info = device_info
super().__init__(coordinator)<|docstring|>Initialize the entity.<|endoftext|> |
959514ff3ad36bfa3d9e493ec80719a74614a7e62c186c5799451855e3d3f810 | @property
def name(self):
'Return the name of the device.'
return self._name | Return the name of the device. | homeassistant/components/braviatv/media_player.py | name | maurerle/core | 5 | python | @property
def name(self):
return self._name | @property
def name(self):
return self._name<|docstring|>Return the name of the device.<|endoftext|> |
bbc24990453d9ce2e5567ef31f40b20a343650e2fe4e97cfc322928b08150336 | @property
def unique_id(self):
'Return a unique_id for this entity.'
return self._unique_id | Return a unique_id for this entity. | homeassistant/components/braviatv/media_player.py | unique_id | maurerle/core | 5 | python | @property
def unique_id(self):
return self._unique_id | @property
def unique_id(self):
return self._unique_id<|docstring|>Return a unique_id for this entity.<|endoftext|> |
5ed6caad8ee1bdd3d6694fbffe8bbec4befb02e267da8cf31285b977b31c8f2b | @property
def device_info(self):
'Return the device info.'
return self._device_info | Return the device info. | homeassistant/components/braviatv/media_player.py | device_info | maurerle/core | 5 | python | @property
def device_info(self):
return self._device_info | @property
def device_info(self):
return self._device_info<|docstring|>Return the device info.<|endoftext|> |
cf65832884c6cbdd856af47c748a86a6d95084629097db8e799b80d25fe461da | @property
def state(self):
'Return the state of the device.'
if self.coordinator.is_on:
return (STATE_PLAYING if self.coordinator.playing else STATE_PAUSED)
return STATE_OFF | Return the state of the device. | homeassistant/components/braviatv/media_player.py | state | maurerle/core | 5 | python | @property
def state(self):
if self.coordinator.is_on:
return (STATE_PLAYING if self.coordinator.playing else STATE_PAUSED)
return STATE_OFF | @property
def state(self):
if self.coordinator.is_on:
return (STATE_PLAYING if self.coordinator.playing else STATE_PAUSED)
return STATE_OFF<|docstring|>Return the state of the device.<|endoftext|> |
e83d969892985171cf3d5a379d5618fc5f6f15198b6ceedf8d7490209e1bacf8 | @property
def source(self):
'Return the current input source.'
return self.coordinator.source | Return the current input source. | homeassistant/components/braviatv/media_player.py | source | maurerle/core | 5 | python | @property
def source(self):
return self.coordinator.source | @property
def source(self):
return self.coordinator.source<|docstring|>Return the current input source.<|endoftext|> |
f9fc13a045390847e0aab4e6a18dceb8a9994ee5fcfdd4133a70879e6c45a4a0 | @property
def source_list(self):
'List of available input sources.'
return self.coordinator.source_list | List of available input sources. | homeassistant/components/braviatv/media_player.py | source_list | maurerle/core | 5 | python | @property
def source_list(self):
return self.coordinator.source_list | @property
def source_list(self):
return self.coordinator.source_list<|docstring|>List of available input sources.<|endoftext|> |
2880e5abd50aa4a57d98bcd2433f2ac830985827a8908186313941604523ef71 | @property
def volume_level(self):
'Volume level of the media player (0..1).'
if (self.coordinator.volume is not None):
return (self.coordinator.volume / 100)
return None | Volume level of the media player (0..1). | homeassistant/components/braviatv/media_player.py | volume_level | maurerle/core | 5 | python | @property
def volume_level(self):
if (self.coordinator.volume is not None):
return (self.coordinator.volume / 100)
return None | @property
def volume_level(self):
if (self.coordinator.volume is not None):
return (self.coordinator.volume / 100)
return None<|docstring|>Volume level of the media player (0..1).<|endoftext|> |
2f81d6a2bf069b560ac9a96e7897109fa5e6ed57c76f4df1f1d135028d527936 | @property
def is_volume_muted(self):
'Boolean if volume is currently muted.'
return self.coordinator.muted | Boolean if volume is currently muted. | homeassistant/components/braviatv/media_player.py | is_volume_muted | maurerle/core | 5 | python | @property
def is_volume_muted(self):
return self.coordinator.muted | @property
def is_volume_muted(self):
return self.coordinator.muted<|docstring|>Boolean if volume is currently muted.<|endoftext|> |
776d9e3fd3bf351a39ad4b072775a03f19fe1ecbd4db909d7a7bff57dd8697a1 | @property
def media_title(self):
'Title of current playing media.'
return_value = None
if (self.coordinator.channel_name is not None):
return_value = self.coordinator.channel_name
if (self.coordinator.program_name is not None):
return_value = f'{return_value}: {self.coordinator.p... | Title of current playing media. | homeassistant/components/braviatv/media_player.py | media_title | maurerle/core | 5 | python | @property
def media_title(self):
return_value = None
if (self.coordinator.channel_name is not None):
return_value = self.coordinator.channel_name
if (self.coordinator.program_name is not None):
return_value = f'{return_value}: {self.coordinator.program_name}'
return return_v... | @property
def media_title(self):
return_value = None
if (self.coordinator.channel_name is not None):
return_value = self.coordinator.channel_name
if (self.coordinator.program_name is not None):
return_value = f'{return_value}: {self.coordinator.program_name}'
return return_v... |
a56a86b5fdebeff1653c602fa58c14d7c60bccf6f789aeeeb81a07b63ea214cb | @property
def media_content_id(self):
'Content ID of current playing media.'
return self.coordinator.channel_name | Content ID of current playing media. | homeassistant/components/braviatv/media_player.py | media_content_id | maurerle/core | 5 | python | @property
def media_content_id(self):
return self.coordinator.channel_name | @property
def media_content_id(self):
return self.coordinator.channel_name<|docstring|>Content ID of current playing media.<|endoftext|> |
402c48c8e7cca4069207a32e23c24054da6f2dc85e08e29f1e04b78a8c760823 | @property
def media_duration(self):
'Duration of current playing media in seconds.'
return self.coordinator.duration | Duration of current playing media in seconds. | homeassistant/components/braviatv/media_player.py | media_duration | maurerle/core | 5 | python | @property
def media_duration(self):
return self.coordinator.duration | @property
def media_duration(self):
return self.coordinator.duration<|docstring|>Duration of current playing media in seconds.<|endoftext|> |
301150404221e179cd2edc5b67708c1d89c133a6f4964f703fa492e13f643c8d | async def async_turn_on(self):
'Turn the device on.'
(await self.coordinator.async_turn_on()) | Turn the device on. | homeassistant/components/braviatv/media_player.py | async_turn_on | maurerle/core | 5 | python | async def async_turn_on(self):
(await self.coordinator.async_turn_on()) | async def async_turn_on(self):
(await self.coordinator.async_turn_on())<|docstring|>Turn the device on.<|endoftext|> |
4fc4317e914e5d234923a341ba06a291693bf9f7d46e616e01cc19a018d8763a | async def async_turn_off(self):
'Turn the device off.'
(await self.coordinator.async_turn_off()) | Turn the device off. | homeassistant/components/braviatv/media_player.py | async_turn_off | maurerle/core | 5 | python | async def async_turn_off(self):
(await self.coordinator.async_turn_off()) | async def async_turn_off(self):
(await self.coordinator.async_turn_off())<|docstring|>Turn the device off.<|endoftext|> |
ce1c3ac24c3379e1f5faa0f27038eafd1946f9420f0990ac62eebc0f444c49c8 | async def async_set_volume_level(self, volume):
'Set volume level, range 0..1.'
(await self.coordinator.async_set_volume_level(volume)) | Set volume level, range 0..1. | homeassistant/components/braviatv/media_player.py | async_set_volume_level | maurerle/core | 5 | python | async def async_set_volume_level(self, volume):
(await self.coordinator.async_set_volume_level(volume)) | async def async_set_volume_level(self, volume):
(await self.coordinator.async_set_volume_level(volume))<|docstring|>Set volume level, range 0..1.<|endoftext|> |
c65deebb8fa426880a0026df4eb8b413ee97a72b3f58bd419832ee3b99fede36 | async def async_volume_up(self):
'Send volume up command.'
(await self.coordinator.async_volume_up()) | Send volume up command. | homeassistant/components/braviatv/media_player.py | async_volume_up | maurerle/core | 5 | python | async def async_volume_up(self):
(await self.coordinator.async_volume_up()) | async def async_volume_up(self):
(await self.coordinator.async_volume_up())<|docstring|>Send volume up command.<|endoftext|> |
ccf8981de54cd3ad92771d226f33a74e4f12910ea87efd967c1bb18664ab44a8 | async def async_volume_down(self):
'Send volume down command.'
(await self.coordinator.async_volume_down()) | Send volume down command. | homeassistant/components/braviatv/media_player.py | async_volume_down | maurerle/core | 5 | python | async def async_volume_down(self):
(await self.coordinator.async_volume_down()) | async def async_volume_down(self):
(await self.coordinator.async_volume_down())<|docstring|>Send volume down command.<|endoftext|> |
d74a05663c9c5d996b246e2bfd323b7e8b055e20408976f2fd89e44f51cee922 | async def async_mute_volume(self, mute):
'Send mute command.'
(await self.coordinator.async_volume_mute(mute)) | Send mute command. | homeassistant/components/braviatv/media_player.py | async_mute_volume | maurerle/core | 5 | python | async def async_mute_volume(self, mute):
(await self.coordinator.async_volume_mute(mute)) | async def async_mute_volume(self, mute):
(await self.coordinator.async_volume_mute(mute))<|docstring|>Send mute command.<|endoftext|> |
1825d7c7aa309ffb7efa78cc7aa1da89a2abcb80fc98f7bc4fb9cea7e7f88c5b | async def async_select_source(self, source):
'Set the input source.'
(await self.coordinator.async_select_source(source)) | Set the input source. | homeassistant/components/braviatv/media_player.py | async_select_source | maurerle/core | 5 | python | async def async_select_source(self, source):
(await self.coordinator.async_select_source(source)) | async def async_select_source(self, source):
(await self.coordinator.async_select_source(source))<|docstring|>Set the input source.<|endoftext|> |
a866d75b87a267cc1cf1d507d273cf8f2811f1de0462b40863a055285a755374 | async def async_media_play(self):
'Send play command.'
(await self.coordinator.async_media_play()) | Send play command. | homeassistant/components/braviatv/media_player.py | async_media_play | maurerle/core | 5 | python | async def async_media_play(self):
(await self.coordinator.async_media_play()) | async def async_media_play(self):
(await self.coordinator.async_media_play())<|docstring|>Send play command.<|endoftext|> |
8625d2b8486fc7604ac1ddb5c668323b4fa96c6d708f64be7654edcf8c4059cc | async def async_media_pause(self):
'Send pause command.'
(await self.coordinator.async_media_pause()) | Send pause command. | homeassistant/components/braviatv/media_player.py | async_media_pause | maurerle/core | 5 | python | async def async_media_pause(self):
(await self.coordinator.async_media_pause()) | async def async_media_pause(self):
(await self.coordinator.async_media_pause())<|docstring|>Send pause command.<|endoftext|> |
808fdaf28431bb72c987e99607e02d7491a6c9ce2e314236cb344898b6fe93b4 | async def async_media_stop(self):
'Send media stop command to media player.'
(await self.coordinator.async_media_stop()) | Send media stop command to media player. | homeassistant/components/braviatv/media_player.py | async_media_stop | maurerle/core | 5 | python | async def async_media_stop(self):
(await self.coordinator.async_media_stop()) | async def async_media_stop(self):
(await self.coordinator.async_media_stop())<|docstring|>Send media stop command to media player.<|endoftext|> |
c2542d36e1fff3e1bc88042f2f1ce895ad529905fb57a763c48e5c0d40c46036 | async def async_media_next_track(self):
'Send next track command.'
(await self.coordinator.async_media_next_track()) | Send next track command. | homeassistant/components/braviatv/media_player.py | async_media_next_track | maurerle/core | 5 | python | async def async_media_next_track(self):
(await self.coordinator.async_media_next_track()) | async def async_media_next_track(self):
(await self.coordinator.async_media_next_track())<|docstring|>Send next track command.<|endoftext|> |
c9357745e2b61f2fd6d2ff2f97521f891faa07bc45611248dc019d330606f3d1 | async def async_media_previous_track(self):
'Send previous track command.'
(await self.coordinator.async_media_previous_track()) | Send previous track command. | homeassistant/components/braviatv/media_player.py | async_media_previous_track | maurerle/core | 5 | python | async def async_media_previous_track(self):
(await self.coordinator.async_media_previous_track()) | async def async_media_previous_track(self):
(await self.coordinator.async_media_previous_track())<|docstring|>Send previous track command.<|endoftext|> |
efe051ff99120a9965df08edfd39456a3d704ced1dd127d6820017a223cfee1c | def __call__(self, targets, logits, seq_length=None):
'\n\t\tCompute the loss\n\n\t\tCreates the operation to compute the crossentropy multi loss\n\n\t\tArgs:\n\t\t\ttargets: a dictionary of [batch_size x ... x ...] tensor containing\n\t\t\t\tthe targets\n\t\t\tlogits: a dictionary of [batch_size x ... x ...] tenso... | Compute the loss
Creates the operation to compute the crossentropy multi loss
Args:
targets: a dictionary of [batch_size x ... x ...] tensor containing
the targets
logits: a dictionary of [batch_size x ... x ...] tensors containing the logits
Returns:
loss: a scalar value cont... | nabu/neuralnetworks/loss_computers/crossentropy_multi_loss.py | __call__ | Darleen2019/Nabu-MSSS | 18 | python | def __call__(self, targets, logits, seq_length=None):
'\n\t\tCompute the loss\n\n\t\tCreates the operation to compute the crossentropy multi loss\n\n\t\tArgs:\n\t\t\ttargets: a dictionary of [batch_size x ... x ...] tensor containing\n\t\t\t\tthe targets\n\t\t\tlogits: a dictionary of [batch_size x ... x ...] tenso... | def __call__(self, targets, logits, seq_length=None):
'\n\t\tCompute the loss\n\n\t\tCreates the operation to compute the crossentropy multi loss\n\n\t\tArgs:\n\t\t\ttargets: a dictionary of [batch_size x ... x ...] tensor containing\n\t\t\t\tthe targets\n\t\t\tlogits: a dictionary of [batch_size x ... x ...] tenso... |
91fcbd304bb1d28ff6db07a5e82beaad22c5e6557724fc0efacefcfe1d4c2a37 | def _get_file(genome_dir: str, fname: str, warn_missing: Optional[bool]=True):
'\n Returns the filepath to a single (gzipped) file in the genome_dir with matching ext.\n '
fpath = os.path.join(genome_dir, fname)
if os.path.exists(fpath):
return fpath
if os.path.exists(f'{fpath}.gz'):
... | Returns the filepath to a single (gzipped) file in the genome_dir with matching ext. | genomepy/annotation/__init__.py | _get_file | vanheeringen-lab/genomepy | 146 | python | def _get_file(genome_dir: str, fname: str, warn_missing: Optional[bool]=True):
'\n \n '
fpath = os.path.join(genome_dir, fname)
if os.path.exists(fpath):
return fpath
if os.path.exists(f'{fpath}.gz'):
return f'{fpath}.gz'
if warn_missing:
logger.warning(f"Could not find... | def _get_file(genome_dir: str, fname: str, warn_missing: Optional[bool]=True):
'\n \n '
fpath = os.path.join(genome_dir, fname)
if os.path.exists(fpath):
return fpath
if os.path.exists(f'{fpath}.gz'):
return f'{fpath}.gz'
if warn_missing:
logger.warning(f"Could not find... |
ab592063a5436ead4f504a8c9ef410efa9b8fb3e251c8e6ae42367b23a00a96d | def filter_regex(df: pd.DataFrame, regex: str, invert_match: Optional[bool]=False, column: Union[(str, int)]=0) -> pd.DataFrame:
'\n Filter a pandas dataframe by a column (default: 1st, contig name).\n\n Parameters\n ----------\n df: pd.Dataframe\n annotation to filter (a pandas dataframe)\n r... | Filter a pandas dataframe by a column (default: 1st, contig name).
Parameters
----------
df: pd.Dataframe
annotation to filter (a pandas dataframe)
regex : str
regex string to match
invert_match : bool, optional
keep contigs NOT matching the regex string
column: str or int, optional
column name or numb... | genomepy/annotation/__init__.py | filter_regex | vanheeringen-lab/genomepy | 146 | python | def filter_regex(df: pd.DataFrame, regex: str, invert_match: Optional[bool]=False, column: Union[(str, int)]=0) -> pd.DataFrame:
'\n Filter a pandas dataframe by a column (default: 1st, contig name).\n\n Parameters\n ----------\n df: pd.Dataframe\n annotation to filter (a pandas dataframe)\n r... | def filter_regex(df: pd.DataFrame, regex: str, invert_match: Optional[bool]=False, column: Union[(str, int)]=0) -> pd.DataFrame:
'\n Filter a pandas dataframe by a column (default: 1st, contig name).\n\n Parameters\n ----------\n df: pd.Dataframe\n annotation to filter (a pandas dataframe)\n r... |
a952ce81102168fa95d229cc615702b2ac4dd08b62952ffce016c8383326202a | def genes(self, annot: str='bed') -> list:
'\n Retrieve gene names from an annotation.\n\n For BED files, names are taken from the \'name\' columns.\n\n For GTF files, names are taken from the \'gene_name\' field\n in the attribute column, if available.\n\n Parameters\n ---... | Retrieve gene names from an annotation.
For BED files, names are taken from the 'name' columns.
For GTF files, names are taken from the 'gene_name' field
in the attribute column, if available.
Parameters
----------
annot : str, optional
Annotation file type: 'bed' or 'gtf' (default: "bed")
Returns
-------
list
... | genomepy/annotation/__init__.py | genes | vanheeringen-lab/genomepy | 146 | python | def genes(self, annot: str='bed') -> list:
'\n Retrieve gene names from an annotation.\n\n For BED files, names are taken from the \'name\' columns.\n\n For GTF files, names are taken from the \'gene_name\' field\n in the attribute column, if available.\n\n Parameters\n ---... | def genes(self, annot: str='bed') -> list:
'\n Retrieve gene names from an annotation.\n\n For BED files, names are taken from the \'name\' columns.\n\n For GTF files, names are taken from the \'gene_name\' field\n in the attribute column, if available.\n\n Parameters\n ---... |
81f2fc048cf633ac056e21640e320167248a10bb2170d3593997c9aeb916ec38 | def gene_coords(self, genes: Iterable[str], annot: str='bed') -> pd.DataFrame:
'\n Retrieve gene locations.\n\n Parameters\n ----------\n genes : Iterable\n List of gene names as found in the given annotation file type\n annot : str, optional\n Annotation fil... | Retrieve gene locations.
Parameters
----------
genes : Iterable
List of gene names as found in the given annotation file type
annot : str, optional
Annotation file type: 'bed' or 'gtf' (default: "bed")
Returns
-------
pandas.DataFrame
gene annotation | genomepy/annotation/__init__.py | gene_coords | vanheeringen-lab/genomepy | 146 | python | def gene_coords(self, genes: Iterable[str], annot: str='bed') -> pd.DataFrame:
'\n Retrieve gene locations.\n\n Parameters\n ----------\n genes : Iterable\n List of gene names as found in the given annotation file type\n annot : str, optional\n Annotation fil... | def gene_coords(self, genes: Iterable[str], annot: str='bed') -> pd.DataFrame:
'\n Retrieve gene locations.\n\n Parameters\n ----------\n genes : Iterable\n List of gene names as found in the given annotation file type\n annot : str, optional\n Annotation fil... |
0df2594904702dcf0b86237c6be22580f93a80950a218ea7aae5750ab848a617 | def map_locations(self, annot: Union[(str, pd.DataFrame)], to: str, drop=True) -> Union[(None, pd.DataFrame)]:
'\n Map chromosome mapping from one assembly to another.\n\n Uses the NCBI assembly reports to find contigs.\n Drops missing contigs.\n\n Parameters\n ----------\n ... | Map chromosome mapping from one assembly to another.
Uses the NCBI assembly reports to find contigs.
Drops missing contigs.
Parameters
----------
annot : str or pd.Dataframe
annotation to map: "bed", "gtf" or a pandas dataframe.
to: str
target provider (UCSC, Ensembl or NCBI)
drop: bool, optional
if True,... | genomepy/annotation/__init__.py | map_locations | vanheeringen-lab/genomepy | 146 | python | def map_locations(self, annot: Union[(str, pd.DataFrame)], to: str, drop=True) -> Union[(None, pd.DataFrame)]:
'\n Map chromosome mapping from one assembly to another.\n\n Uses the NCBI assembly reports to find contigs.\n Drops missing contigs.\n\n Parameters\n ----------\n ... | def map_locations(self, annot: Union[(str, pd.DataFrame)], to: str, drop=True) -> Union[(None, pd.DataFrame)]:
'\n Map chromosome mapping from one assembly to another.\n\n Uses the NCBI assembly reports to find contigs.\n Drops missing contigs.\n\n Parameters\n ----------\n ... |
2dc52e74de8b214a6a899c8b52118e9e26d8705e5fd698a8fe110adc1234464a | def filter_regex(self, annot: Union[(str, pd.DataFrame)], regex: Optional[str]='.*', invert_match: Optional[bool]=False, column: Union[(str, int)]=0) -> pd.DataFrame:
'\n Filter a dataframe by any column using regex.\n\n Parameters\n ----------\n annot : str or pd.Dataframe\n ... | Filter a dataframe by any column using regex.
Parameters
----------
annot : str or pd.Dataframe
annotation to filter: "bed", "gtf" or a pandas dataframe
regex : str
regex string to match
invert_match : bool, optional
keep contigs NOT matching the regex string
column: str or int, optional
column name or... | genomepy/annotation/__init__.py | filter_regex | vanheeringen-lab/genomepy | 146 | python | def filter_regex(self, annot: Union[(str, pd.DataFrame)], regex: Optional[str]='.*', invert_match: Optional[bool]=False, column: Union[(str, int)]=0) -> pd.DataFrame:
'\n Filter a dataframe by any column using regex.\n\n Parameters\n ----------\n annot : str or pd.Dataframe\n ... | def filter_regex(self, annot: Union[(str, pd.DataFrame)], regex: Optional[str]='.*', invert_match: Optional[bool]=False, column: Union[(str, int)]=0) -> pd.DataFrame:
'\n Filter a dataframe by any column using regex.\n\n Parameters\n ----------\n annot : str or pd.Dataframe\n ... |
7e42c26584652ab6ada74d9670203cc31cc7db498aa7bca2820f68937fdefd91 | def query_blastn(infile: str, query: str) -> list:
'\n Checks a BLASTn file for matching the provided query string\n :param infile: Path to BLASTn file\n :param query: String containing query keywords\n :return: List of hits\n '
query = query.lower()
query = query.split(' ')
hits = []
... | Checks a BLASTn file for matching the provided query string
:param infile: Path to BLASTn file
:param query: String containing query keywords
:return: List of hits | BLASTn_Extract/blastn_extract.py | query_blastn | bfssi-forest-dussault/BLASTn_Extract | 1 | python | def query_blastn(infile: str, query: str) -> list:
'\n Checks a BLASTn file for matching the provided query string\n :param infile: Path to BLASTn file\n :param query: String containing query keywords\n :return: List of hits\n '
query = query.lower()
query = query.split(' ')
hits = []
... | def query_blastn(infile: str, query: str) -> list:
'\n Checks a BLASTn file for matching the provided query string\n :param infile: Path to BLASTn file\n :param query: String containing query keywords\n :return: List of hits\n '
query = query.lower()
query = query.split(' ')
hits = []
... |
895a27a5a67f57574732309aeb65709a2402874fd93687d0ad53b2a67f45f977 | def extract_contigs(contigs: str, node_dict: dict, outfile: str, delimiter: str) -> str:
'\n Searches through a FASTA file and extracts only contigs that are in the provided node list\n :param contigs: FASTA file\n :param node_dict: Dictionary generated with extract_nodes()\n :param outfile: String path... | Searches through a FASTA file and extracts only contigs that are in the provided node list
:param contigs: FASTA file
:param node_dict: Dictionary generated with extract_nodes()
:param outfile: String path to output file
:param delimiter: String delimiter to split BLASTn file on (defaults to tab)
:return: String path t... | BLASTn_Extract/blastn_extract.py | extract_contigs | bfssi-forest-dussault/BLASTn_Extract | 1 | python | def extract_contigs(contigs: str, node_dict: dict, outfile: str, delimiter: str) -> str:
'\n Searches through a FASTA file and extracts only contigs that are in the provided node list\n :param contigs: FASTA file\n :param node_dict: Dictionary generated with extract_nodes()\n :param outfile: String path... | def extract_contigs(contigs: str, node_dict: dict, outfile: str, delimiter: str) -> str:
'\n Searches through a FASTA file and extracts only contigs that are in the provided node list\n :param contigs: FASTA file\n :param node_dict: Dictionary generated with extract_nodes()\n :param outfile: String path... |
26d29c710004f5d9e045f6346608666c1d0aa463474b7dd22a8bc3f17f1eef55 | def setup():
'Setups logging.'
FORMAT = u'%(levelname)-8s [%(asctime)s] %(message)s ### %(filename)s[LINE:%(lineno)d]'
logger = logging.getLogger()
logger.addHandler(logging.StreamHandler())
logger.addHandler(logging.FileHandler(f'logs/{ctime()}.log'))
coloredlogs.install(level='INFO', fmt=FORM... | Setups logging. | core/logs.py | setup | A-Zalt/flasher-rewrite | 0 | python | def setup():
FORMAT = u'%(levelname)-8s [%(asctime)s] %(message)s ### %(filename)s[LINE:%(lineno)d]'
logger = logging.getLogger()
logger.addHandler(logging.StreamHandler())
logger.addHandler(logging.FileHandler(f'logs/{ctime()}.log'))
coloredlogs.install(level='INFO', fmt=FORMAT, logger=logger... | def setup():
FORMAT = u'%(levelname)-8s [%(asctime)s] %(message)s ### %(filename)s[LINE:%(lineno)d]'
logger = logging.getLogger()
logger.addHandler(logging.StreamHandler())
logger.addHandler(logging.FileHandler(f'logs/{ctime()}.log'))
coloredlogs.install(level='INFO', fmt=FORMAT, logger=logger... |
dd661e8daf26472b15e39006a1ca4339d93e14ae762efc8b7248827f8a37efd4 | def max_index(X):
'Return the index of the maximum in a numpy array.\n\n Parameters\n ----------\n X : ndarray of shape (n_samples, n_features)\n The input array.\n\n Returns\n -------\n i : int\n The row index of the maximum.\n j : int\n The column index of the maximum.\n\... | Return the index of the maximum in a numpy array.
Parameters
----------
X : ndarray of shape (n_samples, n_features)
The input array.
Returns
-------
i : int
The row index of the maximum.
j : int
The column index of the maximum.
Raises
------
ValueError
If the input is not a numpy error or
if the... | numpy_questions.py | max_index | OlivierBn/datacamp-assignment1 | 0 | python | def max_index(X):
'Return the index of the maximum in a numpy array.\n\n Parameters\n ----------\n X : ndarray of shape (n_samples, n_features)\n The input array.\n\n Returns\n -------\n i : int\n The row index of the maximum.\n j : int\n The column index of the maximum.\n\... | def max_index(X):
'Return the index of the maximum in a numpy array.\n\n Parameters\n ----------\n X : ndarray of shape (n_samples, n_features)\n The input array.\n\n Returns\n -------\n i : int\n The row index of the maximum.\n j : int\n The column index of the maximum.\n\... |
3c89573b067da9ccff22291dca03066ed9a44c07c4b24ff51169613409adaa1c | def wallis_product(n_terms):
'Implement the Wallis product to compute an approximation of pi.\n\n See:\n https://en.wikipedia.org/wiki/Wallis_product\n\n '
x = 2
for n in range(1, (n_terms + 1)):
x *= ((4 * (n ** 2)) / ((4 * (n ** 2)) - 1))
return x | Implement the Wallis product to compute an approximation of pi.
See:
https://en.wikipedia.org/wiki/Wallis_product | numpy_questions.py | wallis_product | OlivierBn/datacamp-assignment1 | 0 | python | def wallis_product(n_terms):
'Implement the Wallis product to compute an approximation of pi.\n\n See:\n https://en.wikipedia.org/wiki/Wallis_product\n\n '
x = 2
for n in range(1, (n_terms + 1)):
x *= ((4 * (n ** 2)) / ((4 * (n ** 2)) - 1))
return x | def wallis_product(n_terms):
'Implement the Wallis product to compute an approximation of pi.\n\n See:\n https://en.wikipedia.org/wiki/Wallis_product\n\n '
x = 2
for n in range(1, (n_terms + 1)):
x *= ((4 * (n ** 2)) / ((4 * (n ** 2)) - 1))
return x<|docstring|>Implement the Wallis prod... |
571e3f5108e89a4f49a33de2f67867489524b7fdb06c0e3739aa940b2ea78924 | def __init__(self, **kwargs):
"\n :param data: input DataFrame include ['user_id', 'item_id', 'timestamp']\n "
pass | :param data: input DataFrame include ['user_id', 'item_id', 'timestamp'] | build/lib/DMRecall/baseclass/recall.py | __init__ | busesese/DMRecall | 9 | python | def __init__(self, **kwargs):
"\n \n "
pass | def __init__(self, **kwargs):
"\n \n "
pass<|docstring|>:param data: input DataFrame include ['user_id', 'item_id', 'timestamp']<|endoftext|> |
7ef5ac1ea4ed36331310ad878407979f060ee20c8c54b3a2ea708fda48a2f6b2 | def processData(self):
'\n process data before train to get the right data format\n :return:\n '
pass | process data before train to get the right data format
:return: | build/lib/DMRecall/baseclass/recall.py | processData | busesese/DMRecall | 9 | python | def processData(self):
'\n process data before train to get the right data format\n :return:\n '
pass | def processData(self):
'\n process data before train to get the right data format\n :return:\n '
pass<|docstring|>process data before train to get the right data format
:return:<|endoftext|> |
d4f2e2a2a19bb7f82e44e78146b6c12829e8cb96ec2fc3057b1612f69c456bd1 | def train(self):
'\n train the data\n :return:\n '
pass | train the data
:return: | build/lib/DMRecall/baseclass/recall.py | train | busesese/DMRecall | 9 | python | def train(self):
'\n train the data\n :return:\n '
pass | def train(self):
'\n train the data\n :return:\n '
pass<|docstring|>train the data
:return:<|endoftext|> |
0ddac82ec73767cb03c6e6bb592eff8ff2da8207840da18e6abcd30eb24bdf5d | def predict(self, items, k=10):
'\n predict result for a given user\n :param user: str, user id\n :param items: list, user recent behavior item list\n :param k: predict top k result\n :return: dict\n '
result = dict()
if isinstance(items, list):
for item in ... | predict result for a given user
:param user: str, user id
:param items: list, user recent behavior item list
:param k: predict top k result
:return: dict | build/lib/DMRecall/baseclass/recall.py | predict | busesese/DMRecall | 9 | python | def predict(self, items, k=10):
'\n predict result for a given user\n :param user: str, user id\n :param items: list, user recent behavior item list\n :param k: predict top k result\n :return: dict\n '
result = dict()
if isinstance(items, list):
for item in ... | def predict(self, items, k=10):
'\n predict result for a given user\n :param user: str, user id\n :param items: list, user recent behavior item list\n :param k: predict top k result\n :return: dict\n '
result = dict()
if isinstance(items, list):
for item in ... |
f0c0bc2266e0a4e4e9696b5104f20b7e1e8462c68fd94d18b25ab12f5920e7fc | def recommend(self, data_pre, k=10):
'\n recommend result for given users\n :param data_pre: dict, include user id and user recent behavior item\n :param k: int predict top k result\n :return: dict, key = user and value = user result\n '
result = dict()
for (uid, item_list... | recommend result for given users
:param data_pre: dict, include user id and user recent behavior item
:param k: int predict top k result
:return: dict, key = user and value = user result | build/lib/DMRecall/baseclass/recall.py | recommend | busesese/DMRecall | 9 | python | def recommend(self, data_pre, k=10):
'\n recommend result for given users\n :param data_pre: dict, include user id and user recent behavior item\n :param k: int predict top k result\n :return: dict, key = user and value = user result\n '
result = dict()
for (uid, item_list... | def recommend(self, data_pre, k=10):
'\n recommend result for given users\n :param data_pre: dict, include user id and user recent behavior item\n :param k: int predict top k result\n :return: dict, key = user and value = user result\n '
result = dict()
for (uid, item_list... |
659b8033daefb899d9076573225049ee9465d07bb0309b8a01d915eb0f519f41 | def AddPageWithDefaultRunNavigate(self, page_url):
' Add a simple page with url equals to page_url that contains only default\n RunNavigateSteps.\n '
self.AddUserStory(page_module.Page(page_url, self, self.base_dir)) | Add a simple page with url equals to page_url that contains only default
RunNavigateSteps. | tools/telemetry/telemetry/page/page_set.py | AddPageWithDefaultRunNavigate | sunjc53yy/chromium | 0 | python | def AddPageWithDefaultRunNavigate(self, page_url):
' Add a simple page with url equals to page_url that contains only default\n RunNavigateSteps.\n '
self.AddUserStory(page_module.Page(page_url, self, self.base_dir)) | def AddPageWithDefaultRunNavigate(self, page_url):
' Add a simple page with url equals to page_url that contains only default\n RunNavigateSteps.\n '
self.AddUserStory(page_module.Page(page_url, self, self.base_dir))<|docstring|>Add a simple page with url equals to page_url that contains only default
RunN... |
be25ce8a4f59095f42de122d1d8a3a894a9c4fd906313ea126990e0ae5372d1c | @property
def wpr_archive_info(self):
"Lazily constructs wpr_archive_info if it's not set and returns it."
if (self.archive_data_file and (not self._wpr_archive_info)):
self._wpr_archive_info = page_set_archive_info.PageSetArchiveInfo.FromFile(os.path.join(self.base_dir, self.archive_data_file))
ret... | Lazily constructs wpr_archive_info if it's not set and returns it. | tools/telemetry/telemetry/page/page_set.py | wpr_archive_info | sunjc53yy/chromium | 0 | python | @property
def wpr_archive_info(self):
if (self.archive_data_file and (not self._wpr_archive_info)):
self._wpr_archive_info = page_set_archive_info.PageSetArchiveInfo.FromFile(os.path.join(self.base_dir, self.archive_data_file))
return self._wpr_archive_info | @property
def wpr_archive_info(self):
if (self.archive_data_file and (not self._wpr_archive_info)):
self._wpr_archive_info = page_set_archive_info.PageSetArchiveInfo.FromFile(os.path.join(self.base_dir, self.archive_data_file))
return self._wpr_archive_info<|docstring|>Lazily constructs wpr_archive... |
457944cd6b4f3ecc07207fe7dc64aa93d7e1a2a08ff0faa77142d92be8cf2cb4 | def ReorderPageSet(self, results_file):
'Reorders this page set based on the results of a past run.'
page_set_dict = {}
for page in self.user_stories:
page_set_dict[page.url] = page
user_stories = []
with open(results_file, 'rb') as csv_file:
csv_reader = csv.reader(csv_file)
... | Reorders this page set based on the results of a past run. | tools/telemetry/telemetry/page/page_set.py | ReorderPageSet | sunjc53yy/chromium | 0 | python | def ReorderPageSet(self, results_file):
page_set_dict = {}
for page in self.user_stories:
page_set_dict[page.url] = page
user_stories = []
with open(results_file, 'rb') as csv_file:
csv_reader = csv.reader(csv_file)
csv_header = csv_reader.next()
if ('url' not in csv... | def ReorderPageSet(self, results_file):
page_set_dict = {}
for page in self.user_stories:
page_set_dict[page.url] = page
user_stories = []
with open(results_file, 'rb') as csv_file:
csv_reader = csv.reader(csv_file)
csv_header = csv_reader.next()
if ('url' not in csv... |
2549015a0af542a8c7381c950b13af3ab634148415deb675f1f77f1969001ccb | @conan_command(group='Consumer', formatters={'cli': output_search_cli, 'json': output_search_json})
def search(conan_api, parser, *args, **kwargs):
'\n Searches for package recipes whose name contain <query> in a remote or in the local cache\n '
parser.add_argument('query', help="Search query to find pack... | Searches for package recipes whose name contain <query> in a remote or in the local cache | conans/cli/commands/search.py | search | photex/conan | 6,205 | python | @conan_command(group='Consumer', formatters={'cli': output_search_cli, 'json': output_search_json})
def search(conan_api, parser, *args, **kwargs):
'\n \n '
parser.add_argument('query', help="Search query to find package recipe reference, e.g., 'boost', 'lib*'")
exclusive_args = parser.add_mutually_ex... | @conan_command(group='Consumer', formatters={'cli': output_search_cli, 'json': output_search_json})
def search(conan_api, parser, *args, **kwargs):
'\n \n '
parser.add_argument('query', help="Search query to find package recipe reference, e.g., 'boost', 'lib*'")
exclusive_args = parser.add_mutually_ex... |
261ab643d4c25cd6cc0c08ae766d6711b8f3bc59d6ee6a8dbddbab2abe414aef | def create_sun(self):
' \n create a yellow sun, with coordinates (0,0,0) \n '
sun_source = vtkSphereSource()
sun_source.SetRadius(0.2)
sun_source.SetThetaResolution(20)
sun_source.SetPhiResolution(20)
sun_mapper = vtkPolyDataMapper()
self.planets['sun'] = Planet('sun', sun_sour... | create a yellow sun, with coordinates (0,0,0) | sandbox/src1/TCSE3-3rd-examples/src/py/examples/canvas/vtkplanet.py | create_sun | sniemi/SamPy | 5 | python | def create_sun(self):
' \n \n '
sun_source = vtkSphereSource()
sun_source.SetRadius(0.2)
sun_source.SetThetaResolution(20)
sun_source.SetPhiResolution(20)
sun_mapper = vtkPolyDataMapper()
self.planets['sun'] = Planet('sun', sun_source, sun_mapper)
self.planets['sun'].actor... | def create_sun(self):
' \n \n '
sun_source = vtkSphereSource()
sun_source.SetRadius(0.2)
sun_source.SetThetaResolution(20)
sun_source.SetPhiResolution(20)
sun_mapper = vtkPolyDataMapper()
self.planets['sun'] = Planet('sun', sun_source, sun_mapper)
self.planets['sun'].actor... |
ae6c3a2d7abad33b741a193a1815e84bbd823c5314887f01e66b580f70756056 | def create_planet(self, name, x, y, z):
' \n create a planet (with disk) at specified coordinates \n '
if ((self.__planet_source == None) and (self.__planet_mapper == None)):
self.__planet_source = vtkSphereSource()
self.__planet_source.SetRadius(0.1)
self.__planet_source.S... | create a planet (with disk) at specified coordinates | sandbox/src1/TCSE3-3rd-examples/src/py/examples/canvas/vtkplanet.py | create_planet | sniemi/SamPy | 5 | python | def create_planet(self, name, x, y, z):
' \n \n '
if ((self.__planet_source == None) and (self.__planet_mapper == None)):
self.__planet_source = vtkSphereSource()
self.__planet_source.SetRadius(0.1)
self.__planet_source.SetThetaResolution(20)
self.__planet_source.S... | def create_planet(self, name, x, y, z):
' \n \n '
if ((self.__planet_source == None) and (self.__planet_mapper == None)):
self.__planet_source = vtkSphereSource()
self.__planet_source.SetRadius(0.1)
self.__planet_source.SetThetaResolution(20)
self.__planet_source.S... |
1e8d9c9c16c7d696167fcec3e73c443cec3b84330983d707180b3e0a2ef48659 | def generate_random_password(length=9, letters=True, digits=True, punctuation=True, ignored_chars=''):
'\n Generates a cryptographically secure random password\n :param length: Length of password\n :param letters: True to use letters in password\n :param digits: True to use digits in password\n :para... | Generates a cryptographically secure random password
:param length: Length of password
:param letters: True to use letters in password
:param digits: True to use digits in password
:param punctuation: True to use punctuation in password
:param ignored_chars: str containing all the characters that should be ignored duri... | generators.py | generate_random_password | Tauag/SPass | 2 | python | def generate_random_password(length=9, letters=True, digits=True, punctuation=True, ignored_chars=):
'\n Generates a cryptographically secure random password\n :param length: Length of password\n :param letters: True to use letters in password\n :param digits: True to use digits in password\n :param ... | def generate_random_password(length=9, letters=True, digits=True, punctuation=True, ignored_chars=):
'\n Generates a cryptographically secure random password\n :param length: Length of password\n :param letters: True to use letters in password\n :param digits: True to use digits in password\n :param ... |
5a4a6c66790c5ca96b9c0e1c7ba5edf2120d41d699c19ff63af2d9febea62d09 | def generate_passphrase(word_count=5, pad_length=0, digits=True, punctuation=True, ignored_symbols=''):
'\n Generates a passphrase with the specified amount of padding\n :param word_count: Number of words in passphrase\n :param pad_length: The number of padding characters\n :param digits: True to use di... | Generates a passphrase with the specified amount of padding
:param word_count: Number of words in passphrase
:param pad_length: The number of padding characters
:param digits: True to use digits in padding
:param punctuation: True to use punctuation in padding
:param ignored_symbols: str containing all the symbols to i... | generators.py | generate_passphrase | Tauag/SPass | 2 | python | def generate_passphrase(word_count=5, pad_length=0, digits=True, punctuation=True, ignored_symbols=):
'\n Generates a passphrase with the specified amount of padding\n :param word_count: Number of words in passphrase\n :param pad_length: The number of padding characters\n :param digits: True to use digi... | def generate_passphrase(word_count=5, pad_length=0, digits=True, punctuation=True, ignored_symbols=):
'\n Generates a passphrase with the specified amount of padding\n :param word_count: Number of words in passphrase\n :param pad_length: The number of padding characters\n :param digits: True to use digi... |
b5cc2412841b586fad0e2db9a40d2593a2cf131cdd4564299f347c095f86c0d9 | def __scatter_padding(word_count, pad_length, digits, punctuation, ignored_symbols):
'\n Randomly decides where to add padding and which characters to use\n :param word_count: Number of words in passphrase\n :param pad_length: Number of characters to use for padding\n :param digits: True to use digits i... | Randomly decides where to add padding and which characters to use
:param word_count: Number of words in passphrase
:param pad_length: Number of characters to use for padding
:param digits: True to use digits in padding
:param punctuation: True to use punctuation in padding
:param ignored_symbols: str containing all cha... | generators.py | __scatter_padding | Tauag/SPass | 2 | python | def __scatter_padding(word_count, pad_length, digits, punctuation, ignored_symbols):
'\n Randomly decides where to add padding and which characters to use\n :param word_count: Number of words in passphrase\n :param pad_length: Number of characters to use for padding\n :param digits: True to use digits i... | def __scatter_padding(word_count, pad_length, digits, punctuation, ignored_symbols):
'\n Randomly decides where to add padding and which characters to use\n :param word_count: Number of words in passphrase\n :param pad_length: Number of characters to use for padding\n :param digits: True to use digits i... |
63282f342ceb9115663092c246dd8d46658d2c6adbfb3f55905d9f41a16950d6 | def __calc_entropy_password(password, pool_size):
'\n Calculates the entropy of a random password\n :param password: The password\n :param pool_size: The size of the character pool used to generate password\n :return: Entropy\n '
if ((not password) or (not pool_size)):
return 0
inner ... | Calculates the entropy of a random password
:param password: The password
:param pool_size: The size of the character pool used to generate password
:return: Entropy | generators.py | __calc_entropy_password | Tauag/SPass | 2 | python | def __calc_entropy_password(password, pool_size):
'\n Calculates the entropy of a random password\n :param password: The password\n :param pool_size: The size of the character pool used to generate password\n :return: Entropy\n '
if ((not password) or (not pool_size)):
return 0
inner ... | def __calc_entropy_password(password, pool_size):
'\n Calculates the entropy of a random password\n :param password: The password\n :param pool_size: The size of the character pool used to generate password\n :return: Entropy\n '
if ((not password) or (not pool_size)):
return 0
inner ... |
a86f9ced928be27f3221768c2003f9c34a30976e12009eea0eb71ebfc90765ed | def __calc_entropy_passphrase(word_count, word_bank_size, pad_length, pad_bank_size):
'\n Approximates the minimum entropy of the passphrase with its possible deviation\n :param word_count: Number of words in passphrase\n :param word_bank_size: Total number of words in the word bank\n :param pad_length:... | Approximates the minimum entropy of the passphrase with its possible deviation
:param word_count: Number of words in passphrase
:param word_bank_size: Total number of words in the word bank
:param pad_length: Number of characters used in padding
:param pad_bank_size: The size of the character pool used to generate padd... | generators.py | __calc_entropy_passphrase | Tauag/SPass | 2 | python | def __calc_entropy_passphrase(word_count, word_bank_size, pad_length, pad_bank_size):
'\n Approximates the minimum entropy of the passphrase with its possible deviation\n :param word_count: Number of words in passphrase\n :param word_bank_size: Total number of words in the word bank\n :param pad_length:... | def __calc_entropy_passphrase(word_count, word_bank_size, pad_length, pad_bank_size):
'\n Approximates the minimum entropy of the passphrase with its possible deviation\n :param word_count: Number of words in passphrase\n :param word_bank_size: Total number of words in the word bank\n :param pad_length:... |
f4b36ac5573e0af23bc86d4f97f4a29dc98cc8c1f2ed98a49db7a21d0bbfd33e | def __call__(self, fun, mean, var, *args, **kwargs):
"\n Compute the Gaussian Expectation of a function f:\n\n X ~ N(mean, var)\n E[f(X)] = ∫f(x, *args, **kwargs)p(x)dx\n\n Using the formula:\n E[f(X)] = sum_{i=1}^{N_quad_points} f(x_i) * w_i\n\n where x_i, w_i ... | Compute the Gaussian Expectation of a function f:
X ~ N(mean, var)
E[f(X)] = ∫f(x, *args, **kwargs)p(x)dx
Using the formula:
E[f(X)] = sum_{i=1}^{N_quad_points} f(x_i) * w_i
where x_i, w_i must be provided by the inheriting class through self._build_X_W.
The computations broadcast along batch-dimensions,... | gpflow/quadrature/base.py | __call__ | HarrySpearing/GPflow | 1,724 | python | def __call__(self, fun, mean, var, *args, **kwargs):
"\n Compute the Gaussian Expectation of a function f:\n\n X ~ N(mean, var)\n E[f(X)] = ∫f(x, *args, **kwargs)p(x)dx\n\n Using the formula:\n E[f(X)] = sum_{i=1}^{N_quad_points} f(x_i) * w_i\n\n where x_i, w_i ... | def __call__(self, fun, mean, var, *args, **kwargs):
"\n Compute the Gaussian Expectation of a function f:\n\n X ~ N(mean, var)\n E[f(X)] = ∫f(x, *args, **kwargs)p(x)dx\n\n Using the formula:\n E[f(X)] = sum_{i=1}^{N_quad_points} f(x_i) * w_i\n\n where x_i, w_i ... |
8a48fa580430b7c8f4573df8e42afa506db2853fa8d5ad05db332f784ee62f5f | def logspace(self, fun: Union[(Callable, Iterable[Callable])], mean, var, *args, **kwargs):
"\n Compute the Gaussian log-Expectation of a the exponential of a function f:\n\n X ~ N(mean, var)\n log E[exp[f(X)]] = log ∫exp[f(x, *args, **kwargs)]p(x)dx\n\n Using the formula:\n ... | Compute the Gaussian log-Expectation of a the exponential of a function f:
X ~ N(mean, var)
log E[exp[f(X)]] = log ∫exp[f(x, *args, **kwargs)]p(x)dx
Using the formula:
log E[exp[f(X)]] = log sum_{i=1}^{N_quad_points} exp[f(x_i) + log w_i]
where x_i, w_i must be provided by the inheriting class through se... | gpflow/quadrature/base.py | logspace | HarrySpearing/GPflow | 1,724 | python | def logspace(self, fun: Union[(Callable, Iterable[Callable])], mean, var, *args, **kwargs):
"\n Compute the Gaussian log-Expectation of a the exponential of a function f:\n\n X ~ N(mean, var)\n log E[exp[f(X)]] = log ∫exp[f(x, *args, **kwargs)]p(x)dx\n\n Using the formula:\n ... | def logspace(self, fun: Union[(Callable, Iterable[Callable])], mean, var, *args, **kwargs):
"\n Compute the Gaussian log-Expectation of a the exponential of a function f:\n\n X ~ N(mean, var)\n log E[exp[f(X)]] = log ∫exp[f(x, *args, **kwargs)]p(x)dx\n\n Using the formula:\n ... |
e84ea1f81a084b99126a46c9a39cdc67820d7fd3df9a629073e9cb2e6c1977e7 | @pytest.mark.skipif((not product_details.last_update), reason="We don't want to download product_details on travis")
def test_spotcheck():
"Check a couple product-details files to make sure they're available."
languages = product_details.languages
assert (languages['el']['English'] == 'Greek')
assert (l... | Check a couple product-details files to make sure they're available. | src/olympia/amo/tests/test_amo_utils.py | test_spotcheck | fdintino/nginxconf-2018-mozilla-addons-server | 10 | python | @pytest.mark.skipif((not product_details.last_update), reason="We don't want to download product_details on travis")
def test_spotcheck():
languages = product_details.languages
assert (languages['el']['English'] == 'Greek')
assert (languages['el']['native'] == u'Ελληνικά')
assert (product_details.f... | @pytest.mark.skipif((not product_details.last_update), reason="We don't want to download product_details on travis")
def test_spotcheck():
languages = product_details.languages
assert (languages['el']['English'] == 'Greek')
assert (languages['el']['native'] == u'Ελληνικά')
assert (product_details.f... |
88a508e67775ac38c93433301f11b04426aaeb3739e6488802c787d06efb1489 | def __args_default__(self) -> dict:
'Defines a Dictionary of Default Values for Keyword Arguments (or Attributes)'
return {'unitGroup': 'metric', 'contentType': 'csv', 'aggregateHours': 24} | Defines a Dictionary of Default Values for Keyword Arguments (or Attributes) | VisualCrossing/_api.py | __args_default__ | ayushsingh-07/VisualCrossing | 3 | python | def __args_default__(self) -> dict:
return {'unitGroup': 'metric', 'contentType': 'csv', 'aggregateHours': 24} | def __args_default__(self) -> dict:
return {'unitGroup': 'metric', 'contentType': 'csv', 'aggregateHours': 24}<|docstring|>Defines a Dictionary of Default Values for Keyword Arguments (or Attributes)<|endoftext|> |
d9d5c39656ddd95ba4b52b3f6aea33fed1928c9a33f56aa8b0d016652f77e26d | def __get_args_default__(self, args: str):
'Get the Default Value associated with a Keyword Argument'
return self.__args_default__().get(args, None) | Get the Default Value associated with a Keyword Argument | VisualCrossing/_api.py | __get_args_default__ | ayushsingh-07/VisualCrossing | 3 | python | def __get_args_default__(self, args: str):
return self.__args_default__().get(args, None) | def __get_args_default__(self, args: str):
return self.__args_default__().get(args, None)<|docstring|>Get the Default Value associated with a Keyword Argument<|endoftext|> |
2e1505d691970fd02e80255a0822d13213ddca98d93c8326037255f2592bbbab | @property
def __optional_args__(self):
'Get List of all the Optional Keyword Arguments Accepted by the API'
return self.__args_default__().keys() | Get List of all the Optional Keyword Arguments Accepted by the API | VisualCrossing/_api.py | __optional_args__ | ayushsingh-07/VisualCrossing | 3 | python | @property
def __optional_args__(self):
return self.__args_default__().keys() | @property
def __optional_args__(self):
return self.__args_default__().keys()<|docstring|>Get List of all the Optional Keyword Arguments Accepted by the API<|endoftext|> |
cf85fa0e70b2168eed2dc283f13198e4affc5b1a8dc9033f91f225365012a07e | def generate_config(self, defaultSettings: bool=True, fileName: str='config.json', overwrite: bool=False, keepBackup: bool=True, **kwargs) -> bool:
'Generate configuration file at `__homepath__` when executed\n\n The configuration file can be generated with default settings as defined at\n :func:`__ar... | Generate configuration file at `__homepath__` when executed
The configuration file can be generated with default settings as defined at
:func:`__args_default__` else, user is requested to pass all necessary settings
in a correct format (as required by API) to the function, setting `key` as the
attribute name, and `val... | VisualCrossing/_api.py | generate_config | ayushsingh-07/VisualCrossing | 3 | python | def generate_config(self, defaultSettings: bool=True, fileName: str='config.json', overwrite: bool=False, keepBackup: bool=True, **kwargs) -> bool:
'Generate configuration file at `__homepath__` when executed\n\n The configuration file can be generated with default settings as defined at\n :func:`__ar... | def generate_config(self, defaultSettings: bool=True, fileName: str='config.json', overwrite: bool=False, keepBackup: bool=True, **kwargs) -> bool:
'Generate configuration file at `__homepath__` when executed\n\n The configuration file can be generated with default settings as defined at\n :func:`__ar... |
34f23798ae001ffb7e170a119322d6ecd9f4762b1b3a80b818b65d45b275c6f5 | def CreatePrivateKey() -> List[int]:
'Create private key.'
lib.CreatePrivateKey.restype = BuffBytes
return toBytes(lib.CreatePrivateKey()) | Create private key. | wrappers/python/lirisi/library.py | CreatePrivateKey | noot/lirisi | 0 | python | def CreatePrivateKey() -> List[int]:
lib.CreatePrivateKey.restype = BuffBytes
return toBytes(lib.CreatePrivateKey()) | def CreatePrivateKey() -> List[int]:
lib.CreatePrivateKey.restype = BuffBytes
return toBytes(lib.CreatePrivateKey())<|docstring|>Create private key.<|endoftext|> |
9d5c5cd4b3909f22975e3397679bfde1bd42fdcb5c1f483db7627df5f59199f9 | def ExtractPublicKey(privateKey: List[int]) -> List[int]:
'Extract public key form private key.'
lib.ExtractPublicKey.argtypes = [GoSlice]
lib.ExtractPublicKey.restype = BuffBytes
return toBytes(lib.ExtractPublicKey(goSlice(privateKey))) | Extract public key form private key. | wrappers/python/lirisi/library.py | ExtractPublicKey | noot/lirisi | 0 | python | def ExtractPublicKey(privateKey: List[int]) -> List[int]:
lib.ExtractPublicKey.argtypes = [GoSlice]
lib.ExtractPublicKey.restype = BuffBytes
return toBytes(lib.ExtractPublicKey(goSlice(privateKey))) | def ExtractPublicKey(privateKey: List[int]) -> List[int]:
lib.ExtractPublicKey.argtypes = [GoSlice]
lib.ExtractPublicKey.restype = BuffBytes
return toBytes(lib.ExtractPublicKey(goSlice(privateKey)))<|docstring|>Extract public key form private key.<|endoftext|> |
9482cf931b7a72b8396c10ad59fdca59720bc2c6bdbca23f637b204e06dd184a | def CreateRingOfPublicKeys(size: int) -> bytes:
'Create ring of public keys.'
lib.CreateRingOfPublicKeys.argtypes = [ctypes.c_longlong]
lib.CreateRingOfPublicKeys.restype = BuffBytes
return toBytes(lib.CreateRingOfPublicKeys(size)) | Create ring of public keys. | wrappers/python/lirisi/library.py | CreateRingOfPublicKeys | noot/lirisi | 0 | python | def CreateRingOfPublicKeys(size: int) -> bytes:
lib.CreateRingOfPublicKeys.argtypes = [ctypes.c_longlong]
lib.CreateRingOfPublicKeys.restype = BuffBytes
return toBytes(lib.CreateRingOfPublicKeys(size)) | def CreateRingOfPublicKeys(size: int) -> bytes:
lib.CreateRingOfPublicKeys.argtypes = [ctypes.c_longlong]
lib.CreateRingOfPublicKeys.restype = BuffBytes
return toBytes(lib.CreateRingOfPublicKeys(size))<|docstring|>Create ring of public keys.<|endoftext|> |
bc56fd96b07a37ee58f1e92169d2eb38b47fad110f14e748bc99ee8500e850bb | def CreateSignature(message: List[int], pubKeysRing: List[int], privateKey: List[int]) -> List[int]:
'Extract public key form private key.'
lib.CreateSignature.argtypes = [GoSlice, GoSlice, GoSlice]
lib.CreateSignature.restype = BuffBytes
return toBytes(lib.CreateSignature(goSlice(message), goSlice(pubK... | Extract public key form private key. | wrappers/python/lirisi/library.py | CreateSignature | noot/lirisi | 0 | python | def CreateSignature(message: List[int], pubKeysRing: List[int], privateKey: List[int]) -> List[int]:
lib.CreateSignature.argtypes = [GoSlice, GoSlice, GoSlice]
lib.CreateSignature.restype = BuffBytes
return toBytes(lib.CreateSignature(goSlice(message), goSlice(pubKeysRing), goSlice(privateKey))) | def CreateSignature(message: List[int], pubKeysRing: List[int], privateKey: List[int]) -> List[int]:
lib.CreateSignature.argtypes = [GoSlice, GoSlice, GoSlice]
lib.CreateSignature.restype = BuffBytes
return toBytes(lib.CreateSignature(goSlice(message), goSlice(pubKeysRing), goSlice(privateKey)))<|docst... |
04cab579ac82bc3df7183d759209698bad3950eb4c4b8c7a1a79f9256b3983fd | def VerifySignature(message: List[int], pubKeysRing: List[int], signature: List[int]) -> bool:
'Verify signature.'
lib.VerifySignature.argtypes = [GoSlice, GoSlice, GoSlice]
return bool(lib.VerifySignature(goSlice(message), goSlice(pubKeysRing), goSlice(signature))) | Verify signature. | wrappers/python/lirisi/library.py | VerifySignature | noot/lirisi | 0 | python | def VerifySignature(message: List[int], pubKeysRing: List[int], signature: List[int]) -> bool:
lib.VerifySignature.argtypes = [GoSlice, GoSlice, GoSlice]
return bool(lib.VerifySignature(goSlice(message), goSlice(pubKeysRing), goSlice(signature))) | def VerifySignature(message: List[int], pubKeysRing: List[int], signature: List[int]) -> bool:
lib.VerifySignature.argtypes = [GoSlice, GoSlice, GoSlice]
return bool(lib.VerifySignature(goSlice(message), goSlice(pubKeysRing), goSlice(signature)))<|docstring|>Verify signature.<|endoftext|> |
61b773f575c157076bd4d906e15f75b1cfcabab221bd0bc3da7ffa9f58e12cf3 | def SignToPEM(sign: List[int]) -> List[int]:
'Signature to PEM.'
lib.SignToPEM.argtypes = [GoSlice]
lib.SignToPEM.restype = BuffBytes
return toBytes(lib.SignToPEM(goSlice(sign))) | Signature to PEM. | wrappers/python/lirisi/library.py | SignToPEM | noot/lirisi | 0 | python | def SignToPEM(sign: List[int]) -> List[int]:
lib.SignToPEM.argtypes = [GoSlice]
lib.SignToPEM.restype = BuffBytes
return toBytes(lib.SignToPEM(goSlice(sign))) | def SignToPEM(sign: List[int]) -> List[int]:
lib.SignToPEM.argtypes = [GoSlice]
lib.SignToPEM.restype = BuffBytes
return toBytes(lib.SignToPEM(goSlice(sign)))<|docstring|>Signature to PEM.<|endoftext|> |
766d6f5b73275a7344af3dcf12e74ebb5dd6f28ce7f57f365f64fd5d7b22b19e | def PEMtoSign(sign: List[int]) -> List[int]:
'PEM to signature.'
lib.PEMtoSign.argtypes = [GoSlice]
lib.PEMtoSign.restype = BuffBytes
return toBytes(lib.PEMtoSign(goSlice(sign))) | PEM to signature. | wrappers/python/lirisi/library.py | PEMtoSign | noot/lirisi | 0 | python | def PEMtoSign(sign: List[int]) -> List[int]:
lib.PEMtoSign.argtypes = [GoSlice]
lib.PEMtoSign.restype = BuffBytes
return toBytes(lib.PEMtoSign(goSlice(sign))) | def PEMtoSign(sign: List[int]) -> List[int]:
lib.PEMtoSign.argtypes = [GoSlice]
lib.PEMtoSign.restype = BuffBytes
return toBytes(lib.PEMtoSign(goSlice(sign)))<|docstring|>PEM to signature.<|endoftext|> |
ff857af3e0e3470dac4574472ec33d70a61b1648d538a86f706c030a5db62871 | def GetPubKeyBytesSize() -> int:
'Get size of bytes serializted public key.'
return lib.GetPubKeyBytesSize() | Get size of bytes serializted public key. | wrappers/python/lirisi/library.py | GetPubKeyBytesSize | noot/lirisi | 0 | python | def GetPubKeyBytesSize() -> int:
return lib.GetPubKeyBytesSize() | def GetPubKeyBytesSize() -> int:
return lib.GetPubKeyBytesSize()<|docstring|>Get size of bytes serializted public key.<|endoftext|> |
334139f55cc49861d5d0d883b2c49d7f10a012797524705649ba937c0264c00a | def GetKeyImage(sign: List[int]) -> List[int]:
'Get KeyImage from signature.'
lib.GetKeyImage.argtypes = [GoSlice]
lib.GetKeyImage.restype = BuffBytes
return toBytes(lib.GetKeyImage(goSlice(sign))) | Get KeyImage from signature. | wrappers/python/lirisi/library.py | GetKeyImage | noot/lirisi | 0 | python | def GetKeyImage(sign: List[int]) -> List[int]:
lib.GetKeyImage.argtypes = [GoSlice]
lib.GetKeyImage.restype = BuffBytes
return toBytes(lib.GetKeyImage(goSlice(sign))) | def GetKeyImage(sign: List[int]) -> List[int]:
lib.GetKeyImage.argtypes = [GoSlice]
lib.GetKeyImage.restype = BuffBytes
return toBytes(lib.GetKeyImage(goSlice(sign)))<|docstring|>Get KeyImage from signature.<|endoftext|> |
f4c3942d4b90cb91930a3837e43291688207b76fa132e4e7716131fef370e44d | def goSlice(values: List[int]) -> GoSlice:
'Make GoClice instance with aaray of bytes.'
length = len(values)
return GoSlice((ctypes.c_ubyte * length)(*values), length, length) | Make GoClice instance with aaray of bytes. | wrappers/python/lirisi/library.py | goSlice | noot/lirisi | 0 | python | def goSlice(values: List[int]) -> GoSlice:
length = len(values)
return GoSlice((ctypes.c_ubyte * length)(*values), length, length) | def goSlice(values: List[int]) -> GoSlice:
length = len(values)
return GoSlice((ctypes.c_ubyte * length)(*values), length, length)<|docstring|>Make GoClice instance with aaray of bytes.<|endoftext|> |
3fe6e0e0541faa78c7f5e0f2b32dca4976a3495256da940eeadfbd3d873ab1ed | def toBytes(buff: BuffBytes) -> List[int]:
'Create array of bytes from buffer.'
size = int.from_bytes(buff.data[:8], byteorder='little')
return buff.data[:(size + 8)][8:] | Create array of bytes from buffer. | wrappers/python/lirisi/library.py | toBytes | noot/lirisi | 0 | python | def toBytes(buff: BuffBytes) -> List[int]:
size = int.from_bytes(buff.data[:8], byteorder='little')
return buff.data[:(size + 8)][8:] | def toBytes(buff: BuffBytes) -> List[int]:
size = int.from_bytes(buff.data[:8], byteorder='little')
return buff.data[:(size + 8)][8:]<|docstring|>Create array of bytes from buffer.<|endoftext|> |
3ccea5a23e4a55d0287902ac4cb9e6816934c6fc61a5e05d2cdb224e72f5fd9b | def ToHex(array: List[int]) -> bytes:
'Convert array of bytes to hex string.'
return ''.join(['{:>02x}'.format(n) for n in array]).encode() | Convert array of bytes to hex string. | wrappers/python/lirisi/library.py | ToHex | noot/lirisi | 0 | python | def ToHex(array: List[int]) -> bytes:
return .join(['{:>02x}'.format(n) for n in array]).encode() | def ToHex(array: List[int]) -> bytes:
return .join(['{:>02x}'.format(n) for n in array]).encode()<|docstring|>Convert array of bytes to hex string.<|endoftext|> |
b5c489c5f18280694658e16d34f47a6ba3072bfac22c500779654ba94e85fcfa | def ToBase64(array: List[int]) -> bytes:
'Convert array of bytes to base64 string.'
return base64.standard_b64encode(bytes(array)) | Convert array of bytes to base64 string. | wrappers/python/lirisi/library.py | ToBase64 | noot/lirisi | 0 | python | def ToBase64(array: List[int]) -> bytes:
return base64.standard_b64encode(bytes(array)) | def ToBase64(array: List[int]) -> bytes:
return base64.standard_b64encode(bytes(array))<|docstring|>Convert array of bytes to base64 string.<|endoftext|> |
bbe5a6e42128459842608f88e94270182dca0b8a773f87f65b788251bd547468 | def create_glove_embedding_init(idx2word, glove_file):
'\n Bilinear Attention Networks\n Jin-Hwa Kim, Jaehyun Jun, Byoung-Tak Zhang\n https://github.com/jnhwkim/ban-vqa\n '
word2emb = {}
with open(glove_file, 'r', encoding='utf-8') as f:
entries = f.readlines()
emb_dim = (len(entries... | Bilinear Attention Networks
Jin-Hwa Kim, Jaehyun Jun, Byoung-Tak Zhang
https://github.com/jnhwkim/ban-vqa | utils/utils.py | create_glove_embedding_init | gicheonkang/DAN-VisDial | 35 | python | def create_glove_embedding_init(idx2word, glove_file):
'\n Bilinear Attention Networks\n Jin-Hwa Kim, Jaehyun Jun, Byoung-Tak Zhang\n https://github.com/jnhwkim/ban-vqa\n '
word2emb = {}
with open(glove_file, 'r', encoding='utf-8') as f:
entries = f.readlines()
emb_dim = (len(entries... | def create_glove_embedding_init(idx2word, glove_file):
'\n Bilinear Attention Networks\n Jin-Hwa Kim, Jaehyun Jun, Byoung-Tak Zhang\n https://github.com/jnhwkim/ban-vqa\n '
word2emb = {}
with open(glove_file, 'r', encoding='utf-8') as f:
entries = f.readlines()
emb_dim = (len(entries... |
7cb6268a95ffeb1411c888bc1f548925a928be4eb9416299e7b7816d9e89a111 | @mock.patch('datapackage_pipelines.lib.dump.dumper_base.ingest')
@mock.patch('datapackage_pipelines.lib.dump.dumper_base.spew')
def mock_dump_test(processor, ingest_tuple, mock_spew, mock_ingest):
'Helper function returns the `spew` for a given processor with a given\n `ingest` tuple.'
mock_ingest.return_val... | Helper function returns the `spew` for a given processor with a given
`ingest` tuple. | tests/test_dump_to_ckan.py | mock_dump_test | OriHoch/datapackage-pipelines-ckan | 0 | python | @mock.patch('datapackage_pipelines.lib.dump.dumper_base.ingest')
@mock.patch('datapackage_pipelines.lib.dump.dumper_base.spew')
def mock_dump_test(processor, ingest_tuple, mock_spew, mock_ingest):
'Helper function returns the `spew` for a given processor with a given\n `ingest` tuple.'
mock_ingest.return_val... | @mock.patch('datapackage_pipelines.lib.dump.dumper_base.ingest')
@mock.patch('datapackage_pipelines.lib.dump.dumper_base.spew')
def mock_dump_test(processor, ingest_tuple, mock_spew, mock_ingest):
'Helper function returns the `spew` for a given processor with a given\n `ingest` tuple.'
mock_ingest.return_val... |
b20cd1370460e073819867bd1aa7260f51d4d69c14256fa93cc6de63a21a7ab6 | @requests_mock.mock()
def test_dump_to_ckan_package_create_error(self, mock_request):
'Create failed due to existing package, no overwrite so raise\n exception'
base_url = 'https://demo.ckan.org/api/3/action/'
package_create_url = '{}package_create'.format(base_url)
mock_request.post(package_crea... | Create failed due to existing package, no overwrite so raise
exception | tests/test_dump_to_ckan.py | test_dump_to_ckan_package_create_error | OriHoch/datapackage-pipelines-ckan | 0 | python | @requests_mock.mock()
def test_dump_to_ckan_package_create_error(self, mock_request):
'Create failed due to existing package, no overwrite so raise\n exception'
base_url = 'https://demo.ckan.org/api/3/action/'
package_create_url = '{}package_create'.format(base_url)
mock_request.post(package_crea... | @requests_mock.mock()
def test_dump_to_ckan_package_create_error(self, mock_request):
'Create failed due to existing package, no overwrite so raise\n exception'
base_url = 'https://demo.ckan.org/api/3/action/'
package_create_url = '{}package_create'.format(base_url)
mock_request.post(package_crea... |
573fd7663a38669d305c36011a5e7e77bf6e0b7fb490f79acbbfc636fd15b139 | @requests_mock.mock()
def test_dump_to_ckan_package_create_error_overwrite(self, mock_request):
'Create failed due to existing package, overwrite so update existing\n package.'
base_url = 'https://demo.ckan.org/api/3/action/'
package_create_url = '{}package_create'.format(base_url)
package_update... | Create failed due to existing package, overwrite so update existing
package. | tests/test_dump_to_ckan.py | test_dump_to_ckan_package_create_error_overwrite | OriHoch/datapackage-pipelines-ckan | 0 | python | @requests_mock.mock()
def test_dump_to_ckan_package_create_error_overwrite(self, mock_request):
'Create failed due to existing package, overwrite so update existing\n package.'
base_url = 'https://demo.ckan.org/api/3/action/'
package_create_url = '{}package_create'.format(base_url)
package_update... | @requests_mock.mock()
def test_dump_to_ckan_package_create_error_overwrite(self, mock_request):
'Create failed due to existing package, overwrite so update existing\n package.'
base_url = 'https://demo.ckan.org/api/3/action/'
package_create_url = '{}package_create'.format(base_url)
package_update... |
063eb53499df3284b2659b1aeca0b91dc748fd72b13e6b851a164e96c0978d1f | @requests_mock.mock()
def test_dump_to_ckan_package_create_resources(self, mock_request):
'Create package with non-streaming resources.'
base_url = 'https://demo.ckan.org/api/3/action/'
package_create_url = '{}package_create'.format(base_url)
resource_create_url = '{}resource_create'.format(base_url)
... | Create package with non-streaming resources. | tests/test_dump_to_ckan.py | test_dump_to_ckan_package_create_resources | OriHoch/datapackage-pipelines-ckan | 0 | python | @requests_mock.mock()
def test_dump_to_ckan_package_create_resources(self, mock_request):
base_url = 'https://demo.ckan.org/api/3/action/'
package_create_url = '{}package_create'.format(base_url)
resource_create_url = '{}resource_create'.format(base_url)
mock_request.post(package_create_url, json={... | @requests_mock.mock()
def test_dump_to_ckan_package_create_resources(self, mock_request):
base_url = 'https://demo.ckan.org/api/3/action/'
package_create_url = '{}package_create'.format(base_url)
resource_create_url = '{}resource_create'.format(base_url)
mock_request.post(package_create_url, json={... |
0fdbc62f4eb3fef30676e3c901e6cb9d4f1644c0de2aed8aaf4795574bd74f79 | @requests_mock.mock()
def test_dump_to_ckan_package_create_streaming_resource(self, mock_request):
'Create package with streaming resource.'
base_url = 'https://demo.ckan.org/api/3/action/'
package_create_url = '{}package_create'.format(base_url)
resource_create_url = '{}resource_create'.format(base_url... | Create package with streaming resource. | tests/test_dump_to_ckan.py | test_dump_to_ckan_package_create_streaming_resource | OriHoch/datapackage-pipelines-ckan | 0 | python | @requests_mock.mock()
def test_dump_to_ckan_package_create_streaming_resource(self, mock_request):
base_url = 'https://demo.ckan.org/api/3/action/'
package_create_url = '{}package_create'.format(base_url)
resource_create_url = '{}resource_create'.format(base_url)
mock_request.post(package_create_ur... | @requests_mock.mock()
def test_dump_to_ckan_package_create_streaming_resource(self, mock_request):
base_url = 'https://demo.ckan.org/api/3/action/'
package_create_url = '{}package_create'.format(base_url)
resource_create_url = '{}resource_create'.format(base_url)
mock_request.post(package_create_ur... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.