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 |
|---|---|---|---|---|---|---|---|---|---|
824d26f49c186501d879d3395043cf0e091ac50813e242638197dd4e405dd8a3 | def test_join_on_eq_with_pos_dt_outside_window(self):
'\n Should get 0 answers because N matches but 0 within dt window\n '
dt = 8
(I, J) = ak.join_on_eq_with_dt(self.a2, self.a1, self.t1, self.t2, dt, 'pos_dt')
self.assertEqual(0, I.size)
self.assertEqual(0, J.size)
dt = np.int64(... | Should get 0 answers because N matches but 0 within dt window | tests/join_test.py | test_join_on_eq_with_pos_dt_outside_window | mcdobe100/arkouda | 0 | python | def test_join_on_eq_with_pos_dt_outside_window(self):
'\n \n '
dt = 8
(I, J) = ak.join_on_eq_with_dt(self.a2, self.a1, self.t1, self.t2, dt, 'pos_dt')
self.assertEqual(0, I.size)
self.assertEqual(0, J.size)
dt = np.int64(8)
(I, J) = ak.join_on_eq_with_dt(self.a2, self.a1, self.... | def test_join_on_eq_with_pos_dt_outside_window(self):
'\n \n '
dt = 8
(I, J) = ak.join_on_eq_with_dt(self.a2, self.a1, self.t1, self.t2, dt, 'pos_dt')
self.assertEqual(0, I.size)
self.assertEqual(0, J.size)
dt = np.int64(8)
(I, J) = ak.join_on_eq_with_dt(self.a2, self.a1, self.... |
672a15693f7febbcb8be0f7993750a267acc86e7d8dc944d8ec740a5b076acc1 | def test_error_handling(self):
'\n Tests error TypeError and ValueError handling\n '
with self.assertRaises(TypeError):
ak.join_on_eq_with_dt([list(range(0, 11))], self.a1, self.t1, self.t2, 8, 'pos_dt')
with self.assertRaises(TypeError):
ak.join_on_eq_with_dt([self.a1, list(ra... | Tests error TypeError and ValueError handling | tests/join_test.py | test_error_handling | mcdobe100/arkouda | 0 | python | def test_error_handling(self):
'\n \n '
with self.assertRaises(TypeError):
ak.join_on_eq_with_dt([list(range(0, 11))], self.a1, self.t1, self.t2, 8, 'pos_dt')
with self.assertRaises(TypeError):
ak.join_on_eq_with_dt([self.a1, list(range(0, 11))], self.t1, self.t2, 8, 'pos_dt')
... | def test_error_handling(self):
'\n \n '
with self.assertRaises(TypeError):
ak.join_on_eq_with_dt([list(range(0, 11))], self.a1, self.t1, self.t2, 8, 'pos_dt')
with self.assertRaises(TypeError):
ak.join_on_eq_with_dt([self.a1, list(range(0, 11))], self.t1, self.t2, 8, 'pos_dt')
... |
1199d277d3d6d89c30dec59411d5eede6d96d499cf37956440694d58182d224c | def train(self, inputs, targets):
'\n :param inputs: Tensor[batch, channels, timestep]\n :param targets: Tensor[batch, channels, timestep]\n '
outputs = self.net(inputs)
loss = self.loss(outputs.view(self.in_channels, (- 1)).transpose(0, 1), targets.long().view((- 1)))
self.optimize... | :param inputs: Tensor[batch, channels, timestep]
:param targets: Tensor[batch, channels, timestep] | wavenet/model.py | train | wusq121/wavenet | 2 | python | def train(self, inputs, targets):
'\n :param inputs: Tensor[batch, channels, timestep]\n :param targets: Tensor[batch, channels, timestep]\n '
outputs = self.net(inputs)
loss = self.loss(outputs.view(self.in_channels, (- 1)).transpose(0, 1), targets.long().view((- 1)))
self.optimize... | def train(self, inputs, targets):
'\n :param inputs: Tensor[batch, channels, timestep]\n :param targets: Tensor[batch, channels, timestep]\n '
outputs = self.net(inputs)
loss = self.loss(outputs.view(self.in_channels, (- 1)).transpose(0, 1), targets.long().view((- 1)))
self.optimize... |
1245eae19cfe365babd2e4919c0f1c51fbc87c9c97e218f254edd19d9993f328 | @home.route('/logout')
def logout():
'点击退出 进入登录页面'
return redirect(url_for('home.login')) | 点击退出 进入登录页面 | app/home/views.py | logout | summerliu1024/flask_movie | 1 | python | @home.route('/logout')
def logout():
return redirect(url_for('home.login')) | @home.route('/logout')
def logout():
return redirect(url_for('home.login'))<|docstring|>点击退出 进入登录页面<|endoftext|> |
ee72416e894d0c9209830f1b47a9d4f4477267ce70470c96a75fa6268198a48a | def basic_tag2version(*, tag: str, **kwargs: Any) -> str:
'Implements the ``"basic"`` ``tag2version`` method'
try:
rmprefix = str_guard(kwargs.pop('rmprefix'), 'tool.versioningit.tag2version.rmprefix')
except KeyError:
pass
else:
tag = strip_prefix(tag, rmprefix)
try:
... | Implements the ``"basic"`` ``tag2version`` method | src/versioningit/basics.py | basic_tag2version | jenshnielsen/versioningit | 17 | python | def basic_tag2version(*, tag: str, **kwargs: Any) -> str:
try:
rmprefix = str_guard(kwargs.pop('rmprefix'), 'tool.versioningit.tag2version.rmprefix')
except KeyError:
pass
else:
tag = strip_prefix(tag, rmprefix)
try:
rmsuffix = str_guard(kwargs.pop('rmsuffix'), 'tool... | def basic_tag2version(*, tag: str, **kwargs: Any) -> str:
try:
rmprefix = str_guard(kwargs.pop('rmprefix'), 'tool.versioningit.tag2version.rmprefix')
except KeyError:
pass
else:
tag = strip_prefix(tag, rmprefix)
try:
rmsuffix = str_guard(kwargs.pop('rmsuffix'), 'tool... |
c45cecc7853bda2c0a6dd0955d9bda2d978213647c8beae0d3c64adcfb1dd8c0 | def basic_format(*, description: VCSDescription, version: str, next_version: str, **kwargs: Any) -> str:
'Implements the ``"basic"`` ``format`` method'
branch: Optional[str]
if (description.branch is not None):
branch = re.sub('[^A-Za-z0-9.]', '.', description.branch)
else:
branch = None... | Implements the ``"basic"`` ``format`` method | src/versioningit/basics.py | basic_format | jenshnielsen/versioningit | 17 | python | def basic_format(*, description: VCSDescription, version: str, next_version: str, **kwargs: Any) -> str:
branch: Optional[str]
if (description.branch is not None):
branch = re.sub('[^A-Za-z0-9.]', '.', description.branch)
else:
branch = None
fields = {**description.fields, 'branch':... | def basic_format(*, description: VCSDescription, version: str, next_version: str, **kwargs: Any) -> str:
branch: Optional[str]
if (description.branch is not None):
branch = re.sub('[^A-Za-z0-9.]', '.', description.branch)
else:
branch = None
fields = {**description.fields, 'branch':... |
82bb5f371b8c337dbabe1a9f0dff1b6b5eaa1e60ab7196b33b85d814a5c3f0b8 | def basic_write(*, project_dir: Union[(str, Path)], version: str, **kwargs: Any) -> None:
'Implements the ``"basic"`` ``write`` method'
try:
filename = str_guard(kwargs.pop('file'), 'tool.versioningit.write.file')
except KeyError:
log.debug("No 'file' field in tool.versioningit.write; not wr... | Implements the ``"basic"`` ``write`` method | src/versioningit/basics.py | basic_write | jenshnielsen/versioningit | 17 | python | def basic_write(*, project_dir: Union[(str, Path)], version: str, **kwargs: Any) -> None:
try:
filename = str_guard(kwargs.pop('file'), 'tool.versioningit.write.file')
except KeyError:
log.debug("No 'file' field in tool.versioningit.write; not writing anything")
return
path = Pa... | def basic_write(*, project_dir: Union[(str, Path)], version: str, **kwargs: Any) -> None:
try:
filename = str_guard(kwargs.pop('file'), 'tool.versioningit.write.file')
except KeyError:
log.debug("No 'file' field in tool.versioningit.write; not writing anything")
return
path = Pa... |
f01d0ce7ea7861336c21c2f5aab0c180a42f65bea002af57191df8ef6defbc84 | @staticmethod
def generate_bonus_points(point_value, num_codes):
'Generates a set of random codes for the bonus points with the given\n point value.'
values = 'EXAMPLE_KEY'
header = 'BONUS'
header += '-'
header += str(point_value)
header += '-'
for _ in range(0, num_codes):
bo... | Generates a set of random codes for the bonus points with the given
point value. | makahiki/apps/widgets/bonus_points/models.py | generate_bonus_points | justinslee/Wai-Not-Makahiki | 1 | python | @staticmethod
def generate_bonus_points(point_value, num_codes):
'Generates a set of random codes for the bonus points with the given\n point value.'
values = 'EXAMPLE_KEY'
header = 'BONUS'
header += '-'
header += str(point_value)
header += '-'
for _ in range(0, num_codes):
bo... | @staticmethod
def generate_bonus_points(point_value, num_codes):
'Generates a set of random codes for the bonus points with the given\n point value.'
values = 'EXAMPLE_KEY'
header = 'BONUS'
header += '-'
header += str(point_value)
header += '-'
for _ in range(0, num_codes):
bo... |
be187069a0543c9c45905978fb8dbf029f118dbfaf82fd130251ca2d3e82b30b | @wise
def idris_python(main_file_or_project_entry: str, packages: str='cam', idris: 'idris executable path'='idris', o: 'output .cam file'='<nocam>'):
'\n You can specify multiple packages by\n idris-python --packages "cam base effect"\n '
packages = (e.strip() for e in packages.split(' '))
out... | You can specify multiple packages by
idris-python --packages "cam base effect" | idris_python/cli.py | idris_python | thautwarm/idris-python | 30 | python | @wise
def idris_python(main_file_or_project_entry: str, packages: str='cam', idris: 'idris executable path'='idris', o: 'output .cam file'='<nocam>'):
'\n You can specify multiple packages by\n idris-python --packages "cam base effect"\n '
packages = (e.strip() for e in packages.split(' '))
out... | @wise
def idris_python(main_file_or_project_entry: str, packages: str='cam', idris: 'idris executable path'='idris', o: 'output .cam file'='<nocam>'):
'\n You can specify multiple packages by\n idris-python --packages "cam base effect"\n '
packages = (e.strip() for e in packages.split(' '))
out... |
91b48d7f86a98a9d2314182e2d65455737805bb6c31e7ee6f0b6e2fda5beeb98 | @wise
def common_abstract_machine_python_loader(filename):
'\n The .cam file loader.\n '
return load_cam(filename, LinkSession()) | The .cam file loader. | idris_python/cli.py | common_abstract_machine_python_loader | thautwarm/idris-python | 30 | python | @wise
def common_abstract_machine_python_loader(filename):
'\n \n '
return load_cam(filename, LinkSession()) | @wise
def common_abstract_machine_python_loader(filename):
'\n \n '
return load_cam(filename, LinkSession())<|docstring|>The .cam file loader.<|endoftext|> |
0785b11e222aef42b93e471ef825337406f6f22d745e0ca95300ce42e67bafce | def get_signal_name(signum):
'Returns the signal name of the given signal number.'
return _signames[signum] | Returns the signal name of the given signal number. | venv/lib/python3.8/site-packages/telegram/utils/helpers.py | get_signal_name | anthonyricci123/python-telegram-bot-heroku | 2 | python | def get_signal_name(signum):
return _signames[signum] | def get_signal_name(signum):
return _signames[signum]<|docstring|>Returns the signal name of the given signal number.<|endoftext|> |
acaf122e5e0a8270bce09421659eca3e7a02fe4dafc19ea435d314e78ce524a5 | def escape_markdown(text, version=1, entity_type=None):
'\n Helper function to escape telegram markup symbols.\n\n Args:\n text (:obj:`str`): The text.\n version (:obj:`int` | :obj:`str`): Use to specify the version of telegrams Markdown.\n Either ``1`` or ``2``. Defaults to ``1``.\n ... | Helper function to escape telegram markup symbols.
Args:
text (:obj:`str`): The text.
version (:obj:`int` | :obj:`str`): Use to specify the version of telegrams Markdown.
Either ``1`` or ``2``. Defaults to ``1``.
entity_type (:obj:`str`, optional): For the entity types ``PRE``, ``CODE`` and the lin... | venv/lib/python3.8/site-packages/telegram/utils/helpers.py | escape_markdown | anthonyricci123/python-telegram-bot-heroku | 2 | python | def escape_markdown(text, version=1, entity_type=None):
'\n Helper function to escape telegram markup symbols.\n\n Args:\n text (:obj:`str`): The text.\n version (:obj:`int` | :obj:`str`): Use to specify the version of telegrams Markdown.\n Either ``1`` or ``2``. Defaults to ``1``.\n ... | def escape_markdown(text, version=1, entity_type=None):
'\n Helper function to escape telegram markup symbols.\n\n Args:\n text (:obj:`str`): The text.\n version (:obj:`int` | :obj:`str`): Use to specify the version of telegrams Markdown.\n Either ``1`` or ``2``. Defaults to ``1``.\n ... |
8e2278491923f04cb09c650efeff9fb6907fbac63afd7ea8f8564abe263e1fff | def _datetime_to_float_timestamp(dt_obj):
'Converts a datetime object to a float timestamp (with sub-second precision).\n If the datetime object is timezone-naive, it is assumed to be in UTC.'
if (dt_obj.tzinfo is None):
dt_obj = dt_obj.replace(tzinfo=dtm.timezone.utc)
return dt_obj.timestamp() | Converts a datetime object to a float timestamp (with sub-second precision).
If the datetime object is timezone-naive, it is assumed to be in UTC. | venv/lib/python3.8/site-packages/telegram/utils/helpers.py | _datetime_to_float_timestamp | anthonyricci123/python-telegram-bot-heroku | 2 | python | def _datetime_to_float_timestamp(dt_obj):
'Converts a datetime object to a float timestamp (with sub-second precision).\n If the datetime object is timezone-naive, it is assumed to be in UTC.'
if (dt_obj.tzinfo is None):
dt_obj = dt_obj.replace(tzinfo=dtm.timezone.utc)
return dt_obj.timestamp() | def _datetime_to_float_timestamp(dt_obj):
'Converts a datetime object to a float timestamp (with sub-second precision).\n If the datetime object is timezone-naive, it is assumed to be in UTC.'
if (dt_obj.tzinfo is None):
dt_obj = dt_obj.replace(tzinfo=dtm.timezone.utc)
return dt_obj.timestamp()<|... |
5c8a91f76ec70876d7b10b775570a974091335d296343843f1bae667a23a2197 | def to_float_timestamp(t, reference_timestamp=None):
'\n Converts a given time object to a float POSIX timestamp.\n Used to convert different time specifications to a common format. The time object\n can be relative (i.e. indicate a time increment, or a time of day) or absolute.\n Any objects from the :... | Converts a given time object to a float POSIX timestamp.
Used to convert different time specifications to a common format. The time object
can be relative (i.e. indicate a time increment, or a time of day) or absolute.
Any objects from the :class:`datetime` module that are timezone-naive will be assumed
to be in UTC.
... | venv/lib/python3.8/site-packages/telegram/utils/helpers.py | to_float_timestamp | anthonyricci123/python-telegram-bot-heroku | 2 | python | def to_float_timestamp(t, reference_timestamp=None):
'\n Converts a given time object to a float POSIX timestamp.\n Used to convert different time specifications to a common format. The time object\n can be relative (i.e. indicate a time increment, or a time of day) or absolute.\n Any objects from the :... | def to_float_timestamp(t, reference_timestamp=None):
'\n Converts a given time object to a float POSIX timestamp.\n Used to convert different time specifications to a common format. The time object\n can be relative (i.e. indicate a time increment, or a time of day) or absolute.\n Any objects from the :... |
b56288df6f21a02f3136ee6d773e9d3a011d2e1d7b2c2886122367681b53a427 | def to_timestamp(dt_obj, reference_timestamp=None):
'\n Wrapper over :func:`to_float_timestamp` which returns an integer (the float value truncated\n down to the nearest integer).\n\n See the documentation for :func:`to_float_timestamp` for more details.\n '
return (int(to_float_timestamp(dt_obj, re... | Wrapper over :func:`to_float_timestamp` which returns an integer (the float value truncated
down to the nearest integer).
See the documentation for :func:`to_float_timestamp` for more details. | venv/lib/python3.8/site-packages/telegram/utils/helpers.py | to_timestamp | anthonyricci123/python-telegram-bot-heroku | 2 | python | def to_timestamp(dt_obj, reference_timestamp=None):
'\n Wrapper over :func:`to_float_timestamp` which returns an integer (the float value truncated\n down to the nearest integer).\n\n See the documentation for :func:`to_float_timestamp` for more details.\n '
return (int(to_float_timestamp(dt_obj, re... | def to_timestamp(dt_obj, reference_timestamp=None):
'\n Wrapper over :func:`to_float_timestamp` which returns an integer (the float value truncated\n down to the nearest integer).\n\n See the documentation for :func:`to_float_timestamp` for more details.\n '
return (int(to_float_timestamp(dt_obj, re... |
f50f8112ffce0b36eb7efbc0a40f6718ef2261e162fc5b01c93a805b5da35f32 | def from_timestamp(unixtime, tzinfo=dtm.timezone.utc):
'\n Converts an (integer) unix timestamp to a timezone aware datetime object.\n ``None`` s are left alone (i.e. ``from_timestamp(None)`` is ``None``).\n\n Args:\n unixtime (int): integer POSIX timestamp\n tzinfo (:obj:`datetime.tzinfo`, o... | Converts an (integer) unix timestamp to a timezone aware datetime object.
``None`` s are left alone (i.e. ``from_timestamp(None)`` is ``None``).
Args:
unixtime (int): integer POSIX timestamp
tzinfo (:obj:`datetime.tzinfo`, optional): The timezone, the timestamp is to be converted
to. Defaults to UTC.
... | venv/lib/python3.8/site-packages/telegram/utils/helpers.py | from_timestamp | anthonyricci123/python-telegram-bot-heroku | 2 | python | def from_timestamp(unixtime, tzinfo=dtm.timezone.utc):
'\n Converts an (integer) unix timestamp to a timezone aware datetime object.\n ``None`` s are left alone (i.e. ``from_timestamp(None)`` is ``None``).\n\n Args:\n unixtime (int): integer POSIX timestamp\n tzinfo (:obj:`datetime.tzinfo`, o... | def from_timestamp(unixtime, tzinfo=dtm.timezone.utc):
'\n Converts an (integer) unix timestamp to a timezone aware datetime object.\n ``None`` s are left alone (i.e. ``from_timestamp(None)`` is ``None``).\n\n Args:\n unixtime (int): integer POSIX timestamp\n tzinfo (:obj:`datetime.tzinfo`, o... |
477af4322cbccb0e0f94f3fbeca4ba3a8774653ff04bf1e9ac9af784144f0e56 | def mention_html(user_id, name):
"\n Args:\n user_id (:obj:`int`) The user's id which you want to mention.\n name (:obj:`str`) The name the mention is showing.\n\n Returns:\n :obj:`str`: The inline mention for the user as html.\n "
if isinstance(user_id, int):
return u'<a h... | Args:
user_id (:obj:`int`) The user's id which you want to mention.
name (:obj:`str`) The name the mention is showing.
Returns:
:obj:`str`: The inline mention for the user as html. | venv/lib/python3.8/site-packages/telegram/utils/helpers.py | mention_html | anthonyricci123/python-telegram-bot-heroku | 2 | python | def mention_html(user_id, name):
"\n Args:\n user_id (:obj:`int`) The user's id which you want to mention.\n name (:obj:`str`) The name the mention is showing.\n\n Returns:\n :obj:`str`: The inline mention for the user as html.\n "
if isinstance(user_id, int):
return u'<a h... | def mention_html(user_id, name):
"\n Args:\n user_id (:obj:`int`) The user's id which you want to mention.\n name (:obj:`str`) The name the mention is showing.\n\n Returns:\n :obj:`str`: The inline mention for the user as html.\n "
if isinstance(user_id, int):
return u'<a h... |
83373e0138c841106b59834d113c020795a958d278a80b0f06a56bb4d547441f | def mention_markdown(user_id, name, version=1):
"\n Args:\n user_id (:obj:`int`) The user's id which you want to mention.\n name (:obj:`str`) The name the mention is showing.\n version (:obj:`int` | :obj:`str`): Use to specify the version of telegrams Markdown.\n Either ``1`` or `... | Args:
user_id (:obj:`int`) The user's id which you want to mention.
name (:obj:`str`) The name the mention is showing.
version (:obj:`int` | :obj:`str`): Use to specify the version of telegrams Markdown.
Either ``1`` or ``2``. Defaults to ``1``
Returns:
:obj:`str`: The inline mention for the us... | venv/lib/python3.8/site-packages/telegram/utils/helpers.py | mention_markdown | anthonyricci123/python-telegram-bot-heroku | 2 | python | def mention_markdown(user_id, name, version=1):
"\n Args:\n user_id (:obj:`int`) The user's id which you want to mention.\n name (:obj:`str`) The name the mention is showing.\n version (:obj:`int` | :obj:`str`): Use to specify the version of telegrams Markdown.\n Either ``1`` or `... | def mention_markdown(user_id, name, version=1):
"\n Args:\n user_id (:obj:`int`) The user's id which you want to mention.\n name (:obj:`str`) The name the mention is showing.\n version (:obj:`int` | :obj:`str`): Use to specify the version of telegrams Markdown.\n Either ``1`` or `... |
88e3f31fd9b7af812a0f9743516aa6a6e5422fb690c9975ccb06b12c4c175ead | def effective_message_type(entity):
'\n Extracts the type of message as a string identifier from a :class:`telegram.Message` or a\n :class:`telegram.Update`.\n\n Args:\n entity (:obj:`Update` | :obj:`Message`) The ``update`` or ``message`` to extract from\n\n Returns:\n str: One of ``Messa... | Extracts the type of message as a string identifier from a :class:`telegram.Message` or a
:class:`telegram.Update`.
Args:
entity (:obj:`Update` | :obj:`Message`) The ``update`` or ``message`` to extract from
Returns:
str: One of ``Message.MESSAGE_TYPES`` | venv/lib/python3.8/site-packages/telegram/utils/helpers.py | effective_message_type | anthonyricci123/python-telegram-bot-heroku | 2 | python | def effective_message_type(entity):
'\n Extracts the type of message as a string identifier from a :class:`telegram.Message` or a\n :class:`telegram.Update`.\n\n Args:\n entity (:obj:`Update` | :obj:`Message`) The ``update`` or ``message`` to extract from\n\n Returns:\n str: One of ``Messa... | def effective_message_type(entity):
'\n Extracts the type of message as a string identifier from a :class:`telegram.Message` or a\n :class:`telegram.Update`.\n\n Args:\n entity (:obj:`Update` | :obj:`Message`) The ``update`` or ``message`` to extract from\n\n Returns:\n str: One of ``Messa... |
c4cf00ce30313ccfdbc052de31f246760e1acb41363bdaf29c45dfccf156ba86 | def create_deep_linked_url(bot_username, payload=None, group=False):
'\n Creates a deep-linked URL for this ``bot_username`` with the specified ``payload``.\n See https://core.telegram.org/bots#deep-linking to learn more.\n\n The ``payload`` may consist of the following characters: ``A-Z, a-z, 0-9, _, -``... | Creates a deep-linked URL for this ``bot_username`` with the specified ``payload``.
See https://core.telegram.org/bots#deep-linking to learn more.
The ``payload`` may consist of the following characters: ``A-Z, a-z, 0-9, _, -``
Note:
Works well in conjunction with
``CommandHandler("start", callback, filters ... | venv/lib/python3.8/site-packages/telegram/utils/helpers.py | create_deep_linked_url | anthonyricci123/python-telegram-bot-heroku | 2 | python | def create_deep_linked_url(bot_username, payload=None, group=False):
'\n Creates a deep-linked URL for this ``bot_username`` with the specified ``payload``.\n See https://core.telegram.org/bots#deep-linking to learn more.\n\n The ``payload`` may consist of the following characters: ``A-Z, a-z, 0-9, _, -``... | def create_deep_linked_url(bot_username, payload=None, group=False):
'\n Creates a deep-linked URL for this ``bot_username`` with the specified ``payload``.\n See https://core.telegram.org/bots#deep-linking to learn more.\n\n The ``payload`` may consist of the following characters: ``A-Z, a-z, 0-9, _, -``... |
9c382ebfbc45ea6183f989659a2eb63918fe2e322dbb3b68dc0346e4e4c783ef | def encode_conversations_to_json(conversations):
'Helper method to encode a conversations dict (that uses tuples as keys) to a\n JSON-serializable way. Use :attr:`_decode_conversations_from_json` to decode.\n\n Args:\n conversations (:obj:`dict`): The conversations dict to transofrm to JSON.\n\n Ret... | Helper method to encode a conversations dict (that uses tuples as keys) to a
JSON-serializable way. Use :attr:`_decode_conversations_from_json` to decode.
Args:
conversations (:obj:`dict`): The conversations dict to transofrm to JSON.
Returns:
:obj:`str`: The JSON-serialized conversations dict | venv/lib/python3.8/site-packages/telegram/utils/helpers.py | encode_conversations_to_json | anthonyricci123/python-telegram-bot-heroku | 2 | python | def encode_conversations_to_json(conversations):
'Helper method to encode a conversations dict (that uses tuples as keys) to a\n JSON-serializable way. Use :attr:`_decode_conversations_from_json` to decode.\n\n Args:\n conversations (:obj:`dict`): The conversations dict to transofrm to JSON.\n\n Ret... | def encode_conversations_to_json(conversations):
'Helper method to encode a conversations dict (that uses tuples as keys) to a\n JSON-serializable way. Use :attr:`_decode_conversations_from_json` to decode.\n\n Args:\n conversations (:obj:`dict`): The conversations dict to transofrm to JSON.\n\n Ret... |
f159739109dbdc9806c06b84995cb33975ec8f8c302ab9de6b168102e727cf3c | def decode_conversations_from_json(json_string):
'Helper method to decode a conversations dict (that uses tuples as keys) from a\n JSON-string created with :attr:`_encode_conversations_to_json`.\n\n Args:\n json_string (:obj:`str`): The conversations dict as JSON string.\n\n Returns:\n :obj:`... | Helper method to decode a conversations dict (that uses tuples as keys) from a
JSON-string created with :attr:`_encode_conversations_to_json`.
Args:
json_string (:obj:`str`): The conversations dict as JSON string.
Returns:
:obj:`dict`: The conversations dict after decoding | venv/lib/python3.8/site-packages/telegram/utils/helpers.py | decode_conversations_from_json | anthonyricci123/python-telegram-bot-heroku | 2 | python | def decode_conversations_from_json(json_string):
'Helper method to decode a conversations dict (that uses tuples as keys) from a\n JSON-string created with :attr:`_encode_conversations_to_json`.\n\n Args:\n json_string (:obj:`str`): The conversations dict as JSON string.\n\n Returns:\n :obj:`... | def decode_conversations_from_json(json_string):
'Helper method to decode a conversations dict (that uses tuples as keys) from a\n JSON-string created with :attr:`_encode_conversations_to_json`.\n\n Args:\n json_string (:obj:`str`): The conversations dict as JSON string.\n\n Returns:\n :obj:`... |
d190e5430e1b143fbf8fe79b642c58024dff15abf218cc403a82e27a3b987b11 | def decode_user_chat_data_from_json(data):
'Helper method to decode chat or user data (that uses ints as keys) from a\n JSON-string.\n\n Args:\n data (:obj:`str`): The user/chat_data dict as JSON string.\n\n Returns:\n :obj:`dict`: The user/chat_data defaultdict after decoding\n '
tmp ... | Helper method to decode chat or user data (that uses ints as keys) from a
JSON-string.
Args:
data (:obj:`str`): The user/chat_data dict as JSON string.
Returns:
:obj:`dict`: The user/chat_data defaultdict after decoding | venv/lib/python3.8/site-packages/telegram/utils/helpers.py | decode_user_chat_data_from_json | anthonyricci123/python-telegram-bot-heroku | 2 | python | def decode_user_chat_data_from_json(data):
'Helper method to decode chat or user data (that uses ints as keys) from a\n JSON-string.\n\n Args:\n data (:obj:`str`): The user/chat_data dict as JSON string.\n\n Returns:\n :obj:`dict`: The user/chat_data defaultdict after decoding\n '
tmp ... | def decode_user_chat_data_from_json(data):
'Helper method to decode chat or user data (that uses ints as keys) from a\n JSON-string.\n\n Args:\n data (:obj:`str`): The user/chat_data dict as JSON string.\n\n Returns:\n :obj:`dict`: The user/chat_data defaultdict after decoding\n '
tmp ... |
03c5956be5bd9de73cb73f511c4ec4c6dab58f2553de0d25dabd279a1f0e1648 | def cuwb_data_csv():
'\n 1 minute of CUWB data\n 6 People\n 3 w/o acceleration data\n 5 Trays\n :return:\n '
return (os.path.dirname(os.path.realpath(__file__)) + '/fixtures/uwb.csv') | 1 minute of CUWB data
6 People
3 w/o acceleration data
5 Trays
:return: | tests/conftest.py | cuwb_data_csv | WildflowerSchools/wf-process-cuwb-data | 0 | python | def cuwb_data_csv():
'\n 1 minute of CUWB data\n 6 People\n 3 w/o acceleration data\n 5 Trays\n :return:\n '
return (os.path.dirname(os.path.realpath(__file__)) + '/fixtures/uwb.csv') | def cuwb_data_csv():
'\n 1 minute of CUWB data\n 6 People\n 3 w/o acceleration data\n 5 Trays\n :return:\n '
return (os.path.dirname(os.path.realpath(__file__)) + '/fixtures/uwb.csv')<|docstring|>1 minute of CUWB data
6 People
3 w/o acceleration data
5 Trays
:return:<|endoftext|> |
03721504319f55ce958359a65eabc9bf461eb1798a315bac21f77e1a2227aaee | def plot(self, figure=None, plot_class=None, domain=((- 5), 5), **opts):
'Uses McUtils to plot the wavefunction on the passed figure (makes a new one if none)\n\n :param figure:\n :type figure: Graphics | Graphics3D\n :return:\n :rtype:\n '
discrete = np.linspace(*domain, 100)... | Uses McUtils to plot the wavefunction on the passed figure (makes a new one if none)
:param figure:
:type figure: Graphics | Graphics3D
:return:
:rtype: | Psience/BasisReps/Wavefunctions.py | plot | McCoyGroup/Coordinerds | 0 | python | def plot(self, figure=None, plot_class=None, domain=((- 5), 5), **opts):
'Uses McUtils to plot the wavefunction on the passed figure (makes a new one if none)\n\n :param figure:\n :type figure: Graphics | Graphics3D\n :return:\n :rtype:\n '
discrete = np.linspace(*domain, 100)... | def plot(self, figure=None, plot_class=None, domain=((- 5), 5), **opts):
'Uses McUtils to plot the wavefunction on the passed figure (makes a new one if none)\n\n :param figure:\n :type figure: Graphics | Graphics3D\n :return:\n :rtype:\n '
discrete = np.linspace(*domain, 100)... |
ed48204ca6cbc97217048ed2ebd9206f9df4f9623046f2b4608d733102b5fd27 | def expect(self, operator):
'\n Provides expectation values of operators, but the operators have to be Operator objects...\n basically all the logic is inside the operator, but this is worth it for use in ExpansionWavefunction\n We can also potentially add support for ExpansionOperators or Sy... | Provides expectation values of operators, but the operators have to be Operator objects...
basically all the logic is inside the operator, but this is worth it for use in ExpansionWavefunction
We can also potentially add support for ExpansionOperators or SymbolicOperators in the future that are
able to very cleanly... | Psience/BasisReps/Wavefunctions.py | expect | McCoyGroup/Coordinerds | 0 | python | def expect(self, operator):
'\n Provides expectation values of operators, but the operators have to be Operator objects...\n basically all the logic is inside the operator, but this is worth it for use in ExpansionWavefunction\n We can also potentially add support for ExpansionOperators or Sy... | def expect(self, operator):
'\n Provides expectation values of operators, but the operators have to be Operator objects...\n basically all the logic is inside the operator, but this is worth it for use in ExpansionWavefunction\n We can also potentially add support for ExpansionOperators or Sy... |
d1eca41dcec149db90a722d0dc1116bba5e574b27c148d063eae97ebc2eba230 | def expectation(self, op, other):
'Computes the expectation value of operator op over the wavefunction other and self\n\n :param other: the other wavefunction\n :type other: AnalyticWavefunction\n :param op: the operator to take the matrix element of\n :type op: Operator\n :return... | Computes the expectation value of operator op over the wavefunction other and self
:param other: the other wavefunction
:type other: AnalyticWavefunction
:param op: the operator to take the matrix element of
:type op: Operator
:return:
:rtype: | Psience/BasisReps/Wavefunctions.py | expectation | McCoyGroup/Coordinerds | 0 | python | def expectation(self, op, other):
'Computes the expectation value of operator op over the wavefunction other and self\n\n :param other: the other wavefunction\n :type other: AnalyticWavefunction\n :param op: the operator to take the matrix element of\n :type op: Operator\n :return... | def expectation(self, op, other):
'Computes the expectation value of operator op over the wavefunction other and self\n\n :param other: the other wavefunction\n :type other: AnalyticWavefunction\n :param op: the operator to take the matrix element of\n :type op: Operator\n :return... |
6f7f2fc043c0830d915928cc2387a16700488473895947219fd58d895c915345 | def probability_density(self):
'Computes the probability density of the current wavefunction\n\n :return:\n :rtype:\n '
return self.data | Computes the probability density of the current wavefunction
:return:
:rtype: | Psience/BasisReps/Wavefunctions.py | probability_density | McCoyGroup/Coordinerds | 0 | python | def probability_density(self):
'Computes the probability density of the current wavefunction\n\n :return:\n :rtype:\n '
return self.data | def probability_density(self):
'Computes the probability density of the current wavefunction\n\n :return:\n :rtype:\n '
return self.data<|docstring|>Computes the probability density of the current wavefunction
:return:
:rtype:<|endoftext|> |
bfdffa351d65452865a239736266e3ad1a14477c674538ef4d677d7f84261e88 | def __init__(self, energy, coefficients, basis_wfns):
'\n :param energy: energy of the wavefunction\n :type energy: float\n :param coefficients: expansion coefficients\n :type coefficients: Iterable[float]\n :param basis_wfns: basis functions for the expansion\n :type basis... | :param energy: energy of the wavefunction
:type energy: float
:param coefficients: expansion coefficients
:type coefficients: Iterable[float]
:param basis_wfns: basis functions for the expansion
:type basis_wfns: Wavefunctions | Psience/BasisReps/Wavefunctions.py | __init__ | McCoyGroup/Coordinerds | 0 | python | def __init__(self, energy, coefficients, basis_wfns):
'\n :param energy: energy of the wavefunction\n :type energy: float\n :param coefficients: expansion coefficients\n :type coefficients: Iterable[float]\n :param basis_wfns: basis functions for the expansion\n :type basis... | def __init__(self, energy, coefficients, basis_wfns):
'\n :param energy: energy of the wavefunction\n :type energy: float\n :param coefficients: expansion coefficients\n :type coefficients: Iterable[float]\n :param basis_wfns: basis functions for the expansion\n :type basis... |
d962f7c99155eb6f8a184248af9e5d124cf8e43cc0f99d447b5f512980eeeeb4 | def evaluate(self, *args, **kwargs):
'\n Evaluates the wavecfunction as any other linear expansion.\n\n :param args: coordinates + any other args the basis takes\n :type args:\n :param kwargs: any keyword arguments the basis takes\n :type kwargs:\n :return: values of the wa... | Evaluates the wavecfunction as any other linear expansion.
:param args: coordinates + any other args the basis takes
:type args:
:param kwargs: any keyword arguments the basis takes
:type kwargs:
:return: values of the wavefunction
:rtype: | Psience/BasisReps/Wavefunctions.py | evaluate | McCoyGroup/Coordinerds | 0 | python | def evaluate(self, *args, **kwargs):
'\n Evaluates the wavecfunction as any other linear expansion.\n\n :param args: coordinates + any other args the basis takes\n :type args:\n :param kwargs: any keyword arguments the basis takes\n :type kwargs:\n :return: values of the wa... | def evaluate(self, *args, **kwargs):
'\n Evaluates the wavecfunction as any other linear expansion.\n\n :param args: coordinates + any other args the basis takes\n :type args:\n :param kwargs: any keyword arguments the basis takes\n :type kwargs:\n :return: values of the wa... |
99ef6389622297480fd6d03b86b32dfc498605645bc898c4ffaf20a5dcbf0353 | def expect(self, operator):
'\n Provides the expectation value of the operator `op`.\n Uses the basis to compute the reps and then expands with the expansion coeffs.\n\n :param operator:\n :type operator:\n :return:\n :rtype:\n '
op_vector = operator[(tuple((x.in... | Provides the expectation value of the operator `op`.
Uses the basis to compute the reps and then expands with the expansion coeffs.
:param operator:
:type operator:
:return:
:rtype: | Psience/BasisReps/Wavefunctions.py | expect | McCoyGroup/Coordinerds | 0 | python | def expect(self, operator):
'\n Provides the expectation value of the operator `op`.\n Uses the basis to compute the reps and then expands with the expansion coeffs.\n\n :param operator:\n :type operator:\n :return:\n :rtype:\n '
op_vector = operator[(tuple((x.in... | def expect(self, operator):
'\n Provides the expectation value of the operator `op`.\n Uses the basis to compute the reps and then expands with the expansion coeffs.\n\n :param operator:\n :type operator:\n :return:\n :rtype:\n '
op_vector = operator[(tuple((x.in... |
d770bcea4c3e593041f3ddab45361fc9080bff3169b1f787dc458c1953565530 | def expectation(self, op, other):
'\n Computes the expectation value of operator `op` over the wavefunction `other` and `self`.\n **Note**: _the basis of `other`, `self`, and `op` are assumed to be the same_.\n\n :param op: an operator represented in the basis of the expansion\n :type op... | Computes the expectation value of operator `op` over the wavefunction `other` and `self`.
**Note**: _the basis of `other`, `self`, and `op` are assumed to be the same_.
:param op: an operator represented in the basis of the expansion
:type op: Operator
:param other: the other wavefunction to expand over
:type other: E... | Psience/BasisReps/Wavefunctions.py | expectation | McCoyGroup/Coordinerds | 0 | python | def expectation(self, op, other):
'\n Computes the expectation value of operator `op` over the wavefunction `other` and `self`.\n **Note**: _the basis of `other`, `self`, and `op` are assumed to be the same_.\n\n :param op: an operator represented in the basis of the expansion\n :type op... | def expectation(self, op, other):
'\n Computes the expectation value of operator `op` over the wavefunction `other` and `self`.\n **Note**: _the basis of `other`, `self`, and `op` are assumed to be the same_.\n\n :param op: an operator represented in the basis of the expansion\n :type op... |
b5f577f2890813ae309743c42904094d47ffee7104673a9373127abae24c4d8d | def probability_density(self):
'Computes the probability density of the current wavefunction\n\n :return:\n :rtype:\n '
raise NotImplementedError | Computes the probability density of the current wavefunction
:return:
:rtype: | Psience/BasisReps/Wavefunctions.py | probability_density | McCoyGroup/Coordinerds | 0 | python | def probability_density(self):
'Computes the probability density of the current wavefunction\n\n :return:\n :rtype:\n '
raise NotImplementedError | def probability_density(self):
'Computes the probability density of the current wavefunction\n\n :return:\n :rtype:\n '
raise NotImplementedError<|docstring|>Computes the probability density of the current wavefunction
:return:
:rtype:<|endoftext|> |
4049e00911980430fcc28d29b21fbf6acfd2456a74852112806a6f32327da501 | def __init__(self, energies, coefficients, basis_wfns, **ops):
'\n :param energies: energies for the stored wavefunctions\n :type energies: Iterable[float]\n :param coefficients: expansion coefficients\n :type coefficients: Iterable[Iterable[float]]\n :param basis_wfns: wavefuncti... | :param energies: energies for the stored wavefunctions
:type energies: Iterable[float]
:param coefficients: expansion coefficients
:type coefficients: Iterable[Iterable[float]]
:param basis_wfns: wavefunctions to use as the basis for the expansion
:type basis_wfns: Wavefunctions
:param ops: extra options for feeding th... | Psience/BasisReps/Wavefunctions.py | __init__ | McCoyGroup/Coordinerds | 0 | python | def __init__(self, energies, coefficients, basis_wfns, **ops):
'\n :param energies: energies for the stored wavefunctions\n :type energies: Iterable[float]\n :param coefficients: expansion coefficients\n :type coefficients: Iterable[Iterable[float]]\n :param basis_wfns: wavefuncti... | def __init__(self, energies, coefficients, basis_wfns, **ops):
'\n :param energies: energies for the stored wavefunctions\n :type energies: Iterable[float]\n :param coefficients: expansion coefficients\n :type coefficients: Iterable[Iterable[float]]\n :param basis_wfns: wavefuncti... |
ef723efc10ddbccff7b70dee5e31971933e6eb7668e43efd3ebf3cd06b267f8c | @staticmethod
def Args(parser):
'Add arguments to the parser.\n\n Args:\n parser: argparse.ArgumentParser, This is a standard argparser parser with\n which you can register arguments. See the public argparse documentation\n for its capabilities.\n '
flags.AddZoneFlag(parser) | Add arguments to the parser.
Args:
parser: argparse.ArgumentParser, This is a standard argparser parser with
which you can register arguments. See the public argparse documentation
for its capabilities. | google-cloud-sdk/lib/surface/container/get_server_config.py | Args | KaranToor/MA450 | 1 | python | @staticmethod
def Args(parser):
'Add arguments to the parser.\n\n Args:\n parser: argparse.ArgumentParser, This is a standard argparser parser with\n which you can register arguments. See the public argparse documentation\n for its capabilities.\n '
flags.AddZoneFlag(parser) | @staticmethod
def Args(parser):
'Add arguments to the parser.\n\n Args:\n parser: argparse.ArgumentParser, This is a standard argparser parser with\n which you can register arguments. See the public argparse documentation\n for its capabilities.\n '
flags.AddZoneFlag(parser)<|docstring... |
aa2fb6d3e5f051e598083314d40b7a4ceb211bdf17660565bbde5f837d069f1c | def get_tf_tokenizer(module_handle):
'Creates a preprocessing function.'
tokenization_info = get_tokenization_info(module_handle)
table_initializer = tf.lookup.TextFileInitializer(filename=tokenization_info['vocab_file'], key_dtype=tf.string, key_index=tf.lookup.TextFileIndex.WHOLE_LINE, value_dtype=tf.int6... | Creates a preprocessing function. | language/orqa/utils/bert_utils.py | get_tf_tokenizer | alsuhr-c/language | 1,199 | python | def get_tf_tokenizer(module_handle):
tokenization_info = get_tokenization_info(module_handle)
table_initializer = tf.lookup.TextFileInitializer(filename=tokenization_info['vocab_file'], key_dtype=tf.string, key_index=tf.lookup.TextFileIndex.WHOLE_LINE, value_dtype=tf.int64, value_index=tf.lookup.TextFileIn... | def get_tf_tokenizer(module_handle):
tokenization_info = get_tokenization_info(module_handle)
table_initializer = tf.lookup.TextFileInitializer(filename=tokenization_info['vocab_file'], key_dtype=tf.string, key_index=tf.lookup.TextFileIndex.WHOLE_LINE, value_dtype=tf.int64, value_index=tf.lookup.TextFileIn... |
e7721fe82e7884a778bb1e49d6cf741da1bff3b8d6e09e551685707a77a9c84c | def tokenize_with_original_mapping(text_input, tokenizer):
'Tokenize with original mapping.'
text_input = tf.regex_replace(text_input, '\\p{Cc}|\\p{Cf}', ' ')
orig_tokens = tf_text.regex_split(text_input, bert_tokenizer._DELIM_REGEX_PATTERN, tokenizer._basic_tokenizer._keep_delim_regex_pattern, 'BertBasicTo... | Tokenize with original mapping. | language/orqa/utils/bert_utils.py | tokenize_with_original_mapping | alsuhr-c/language | 1,199 | python | def tokenize_with_original_mapping(text_input, tokenizer):
text_input = tf.regex_replace(text_input, '\\p{Cc}|\\p{Cf}', ' ')
orig_tokens = tf_text.regex_split(text_input, bert_tokenizer._DELIM_REGEX_PATTERN, tokenizer._basic_tokenizer._keep_delim_regex_pattern, 'BertBasicTokenizer')
normalized_tokens =... | def tokenize_with_original_mapping(text_input, tokenizer):
text_input = tf.regex_replace(text_input, '\\p{Cc}|\\p{Cf}', ' ')
orig_tokens = tf_text.regex_split(text_input, bert_tokenizer._DELIM_REGEX_PATTERN, tokenizer._basic_tokenizer._keep_delim_regex_pattern, 'BertBasicTokenizer')
normalized_tokens =... |
796a8a8899ae1151b2e4739dce974be0435187f28111341a9815d184dec81ee5 | def pad_or_truncate_pair(token_ids_a, token_ids_b, sequence_length, cls_id, sep_id):
'Pad or truncate pair.'
token_ids_a = token_ids_a[:(sequence_length - 3)]
truncated_len_a = tf.size(token_ids_a)
maximum_len_b = tf.maximum(((sequence_length - 3) - truncated_len_a), 0)
token_ids_b = token_ids_b[:ma... | Pad or truncate pair. | language/orqa/utils/bert_utils.py | pad_or_truncate_pair | alsuhr-c/language | 1,199 | python | def pad_or_truncate_pair(token_ids_a, token_ids_b, sequence_length, cls_id, sep_id):
token_ids_a = token_ids_a[:(sequence_length - 3)]
truncated_len_a = tf.size(token_ids_a)
maximum_len_b = tf.maximum(((sequence_length - 3) - truncated_len_a), 0)
token_ids_b = token_ids_b[:maximum_len_b]
trunca... | def pad_or_truncate_pair(token_ids_a, token_ids_b, sequence_length, cls_id, sep_id):
token_ids_a = token_ids_a[:(sequence_length - 3)]
truncated_len_a = tf.size(token_ids_a)
maximum_len_b = tf.maximum(((sequence_length - 3) - truncated_len_a), 0)
token_ids_b = token_ids_b[:maximum_len_b]
trunca... |
bec452472200c9f2502f2397ea1e1780834f826cf31173a104d6e758111c0a47 | def colorize(string, color, bold=False, highlight=False):
'Colorize a string.\n\n This function was originally written by John Schulman.\n '
attr = []
num = color2num[color]
if highlight:
num += 10
attr.append(str(num))
if bold:
attr.append('1')
return ('\x1b[%sm%s\x1b[... | Colorize a string.
This function was originally written by John Schulman. | spinup_bis/utils/logx.py | colorize | piojanu/spinningup_tf2 | 19 | python | def colorize(string, color, bold=False, highlight=False):
'Colorize a string.\n\n This function was originally written by John Schulman.\n '
attr = []
num = color2num[color]
if highlight:
num += 10
attr.append(str(num))
if bold:
attr.append('1')
return ('\x1b[%sm%s\x1b[... | def colorize(string, color, bold=False, highlight=False):
'Colorize a string.\n\n This function was originally written by John Schulman.\n '
attr = []
num = color2num[color]
if highlight:
num += 10
attr.append(str(num))
if bold:
attr.append('1')
return ('\x1b[%sm%s\x1b[... |
fe1a4cc1abed9edd82a4f3e80a8bb4638fa50b5decb762fe26abc57156ca3e3c | def __init__(self, output_dir=None, output_fname='progress.txt', exp_name=None, neptune_kwargs=None):
'Initialize a Logger.\n\n Args:\n output_dir (string): A directory for saving results to. If\n ``None``, defaults to a temp directory of the form\n ``/tmp/experiments... | Initialize a Logger.
Args:
output_dir (string): A directory for saving results to. If
``None``, defaults to a temp directory of the form
``/tmp/experiments/somerandomnumber``.
output_fname (string): Name for the tab-separated-value file
containing metrics logged throughout a training r... | spinup_bis/utils/logx.py | __init__ | piojanu/spinningup_tf2 | 19 | python | def __init__(self, output_dir=None, output_fname='progress.txt', exp_name=None, neptune_kwargs=None):
'Initialize a Logger.\n\n Args:\n output_dir (string): A directory for saving results to. If\n ``None``, defaults to a temp directory of the form\n ``/tmp/experiments... | def __init__(self, output_dir=None, output_fname='progress.txt', exp_name=None, neptune_kwargs=None):
'Initialize a Logger.\n\n Args:\n output_dir (string): A directory for saving results to. If\n ``None``, defaults to a temp directory of the form\n ``/tmp/experiments... |
3311710c2d0704d902e32d752bc5c44cbe8f27ee0c83b47203d8453e307a9c5d | def log(self, msg, color='green'):
'Print a colorized message to stdout.'
if (mpi_tools.proc_id() == 0):
print(colorize(msg, color, bold=True)) | Print a colorized message to stdout. | spinup_bis/utils/logx.py | log | piojanu/spinningup_tf2 | 19 | python | def log(self, msg, color='green'):
if (mpi_tools.proc_id() == 0):
print(colorize(msg, color, bold=True)) | def log(self, msg, color='green'):
if (mpi_tools.proc_id() == 0):
print(colorize(msg, color, bold=True))<|docstring|>Print a colorized message to stdout.<|endoftext|> |
cace6cbc8ec870e48e5f700eabe8b0d2d35de2faa358de793d152a40e298524e | def log_tabular(self, key, val):
'Log a value of some diagnostic.\n\n Call this only once for each diagnostic quantity, each iteration.\n After using ``log_tabular`` to store values for each diagnostic,\n make sure to call ``dump_tabular`` to write them out to file and\n stdout (otherwis... | Log a value of some diagnostic.
Call this only once for each diagnostic quantity, each iteration.
After using ``log_tabular`` to store values for each diagnostic,
make sure to call ``dump_tabular`` to write them out to file and
stdout (otherwise they will not get saved anywhere). | spinup_bis/utils/logx.py | log_tabular | piojanu/spinningup_tf2 | 19 | python | def log_tabular(self, key, val):
'Log a value of some diagnostic.\n\n Call this only once for each diagnostic quantity, each iteration.\n After using ``log_tabular`` to store values for each diagnostic,\n make sure to call ``dump_tabular`` to write them out to file and\n stdout (otherwis... | def log_tabular(self, key, val):
'Log a value of some diagnostic.\n\n Call this only once for each diagnostic quantity, each iteration.\n After using ``log_tabular`` to store values for each diagnostic,\n make sure to call ``dump_tabular`` to write them out to file and\n stdout (otherwis... |
0a69f961986feaf00b41205f9fe0810fdb04d1db1d90be4b6d34d148491aaa08 | def save_config(self, config):
"Log an experiment configuration.\n\n Call this once at the top of your experiment, passing in all important\n config vars as a dict. This will serialize the config to JSON, while\n handling anything which can't be serialized in a graceful way (writing\n as... | Log an experiment configuration.
Call this once at the top of your experiment, passing in all important
config vars as a dict. This will serialize the config to JSON, while
handling anything which can't be serialized in a graceful way (writing
as informative a string as possible).
Example use:
.. code-block:: python... | spinup_bis/utils/logx.py | save_config | piojanu/spinningup_tf2 | 19 | python | def save_config(self, config):
"Log an experiment configuration.\n\n Call this once at the top of your experiment, passing in all important\n config vars as a dict. This will serialize the config to JSON, while\n handling anything which can't be serialized in a graceful way (writing\n as... | def save_config(self, config):
"Log an experiment configuration.\n\n Call this once at the top of your experiment, passing in all important\n config vars as a dict. This will serialize the config to JSON, while\n handling anything which can't be serialized in a graceful way (writing\n as... |
6fb21d06ce94d73cf8ea036850936ac91ea2e6eefb867b0296841740bc61dbb7 | def dump_tabular(self):
'Write all of the diagnostics from the current iteration.\n\n Writes both to stdout, and to the output file.\n '
if (mpi_tools.proc_id() == 0):
vals = []
key_lens = [len(key) for key in self.log_headers]
max_key_len = max(15, max(key_lens))
k... | Write all of the diagnostics from the current iteration.
Writes both to stdout, and to the output file. | spinup_bis/utils/logx.py | dump_tabular | piojanu/spinningup_tf2 | 19 | python | def dump_tabular(self):
'Write all of the diagnostics from the current iteration.\n\n Writes both to stdout, and to the output file.\n '
if (mpi_tools.proc_id() == 0):
vals = []
key_lens = [len(key) for key in self.log_headers]
max_key_len = max(15, max(key_lens))
k... | def dump_tabular(self):
'Write all of the diagnostics from the current iteration.\n\n Writes both to stdout, and to the output file.\n '
if (mpi_tools.proc_id() == 0):
vals = []
key_lens = [len(key) for key in self.log_headers]
max_key_len = max(15, max(key_lens))
k... |
137d4ee9648040386ff945737e9310ea83d0f6f9eec5c0d7f919d0beb768b421 | def store(self, **kwargs):
"Save something into the epoch_logger's current state.\n\n Provide an arbitrary number of keyword arguments with numerical\n values.\n "
for (k, v) in kwargs.items():
if (k not in self.epoch_dict.keys()):
self.epoch_dict[k] = []
self.ep... | Save something into the epoch_logger's current state.
Provide an arbitrary number of keyword arguments with numerical
values. | spinup_bis/utils/logx.py | store | piojanu/spinningup_tf2 | 19 | python | def store(self, **kwargs):
"Save something into the epoch_logger's current state.\n\n Provide an arbitrary number of keyword arguments with numerical\n values.\n "
for (k, v) in kwargs.items():
if (k not in self.epoch_dict.keys()):
self.epoch_dict[k] = []
self.ep... | def store(self, **kwargs):
"Save something into the epoch_logger's current state.\n\n Provide an arbitrary number of keyword arguments with numerical\n values.\n "
for (k, v) in kwargs.items():
if (k not in self.epoch_dict.keys()):
self.epoch_dict[k] = []
self.ep... |
a19217b2850500ea4ef62b3d1bba97a54bda996e0af64e976b6a364d17c4771f | def log_tabular(self, key, val=None, with_min_and_max=False, average_only=False):
'Log a value or possibly the mean/std/min/max values of a diagnostic.\n\n Args:\n key (string): The name of the diagnostic. If you are logging a\n diagnostic whose state has previously been saved with\... | Log a value or possibly the mean/std/min/max values of a diagnostic.
Args:
key (string): The name of the diagnostic. If you are logging a
diagnostic whose state has previously been saved with
``store``, the key here has to match the key you used there.
val: A value for the diagnostic. If you h... | spinup_bis/utils/logx.py | log_tabular | piojanu/spinningup_tf2 | 19 | python | def log_tabular(self, key, val=None, with_min_and_max=False, average_only=False):
'Log a value or possibly the mean/std/min/max values of a diagnostic.\n\n Args:\n key (string): The name of the diagnostic. If you are logging a\n diagnostic whose state has previously been saved with\... | def log_tabular(self, key, val=None, with_min_and_max=False, average_only=False):
'Log a value or possibly the mean/std/min/max values of a diagnostic.\n\n Args:\n key (string): The name of the diagnostic. If you are logging a\n diagnostic whose state has previously been saved with\... |
e3584e7537f54406bc693a061160327936ddf81c1a5d36de9c0e4c3128892a9c | def test_markdown_page(client: Client) -> None:
'Test markdown rendering.'
response = client.get(reverse('about_test'))
assert (response.status_code == 200)
assert ('<h3>ReproHack History</h3>' in response.content.decode()) | Test markdown rendering. | reprohack_hub/reprohack/tests/test_views.py | test_markdown_page | Joe-Heffer-Shef/reprohack_site | 0 | python | def test_markdown_page(client: Client) -> None:
response = client.get(reverse('about_test'))
assert (response.status_code == 200)
assert ('<h3>ReproHack History</h3>' in response.content.decode()) | def test_markdown_page(client: Client) -> None:
response = client.get(reverse('about_test'))
assert (response.status_code == 200)
assert ('<h3>ReproHack History</h3>' in response.content.decode())<|docstring|>Test markdown rendering.<|endoftext|> |
4a2e6f658956fcf717c1883fea175ffe8b8c37d95efa56adb87ce7d32dbd1818 | def test_create_review(client: Client, user: User, review: Review) -> None:
'Test creating a review.'
assert (user not in review.reviewers.all())
review_dict = model_to_dict(review)
client.force_login(user)
response = client.post(reverse('review_new'), review_dict, follow=True)
assert (response.... | Test creating a review. | reprohack_hub/reprohack/tests/test_views.py | test_create_review | Joe-Heffer-Shef/reprohack_site | 0 | python | def test_create_review(client: Client, user: User, review: Review) -> None:
assert (user not in review.reviewers.all())
review_dict = model_to_dict(review)
client.force_login(user)
response = client.post(reverse('review_new'), review_dict, follow=True)
assert (response.status_code == 200)
r... | def test_create_review(client: Client, user: User, review: Review) -> None:
assert (user not in review.reviewers.all())
review_dict = model_to_dict(review)
client.force_login(user)
response = client.post(reverse('review_new'), review_dict, follow=True)
assert (response.status_code == 200)
r... |
91d0732ea4c346d2dd91804eec23d954602e8a5b614236470547343dc59fcc9f | def display_page(self, number: Optional[int]=None) -> None:
'Update page content and current page number, if possible.'
img_lines = self.model.get_page_content(target_size=self.screen_size, number=number)
if (img_lines is not None):
self.view.set_page_content(img_lines)
if (number is not Non... | Update page content and current page number, if possible. | pdftty/controller.py | display_page | kpj/pdftty | 1 | python | def display_page(self, number: Optional[int]=None) -> None:
img_lines = self.model.get_page_content(target_size=self.screen_size, number=number)
if (img_lines is not None):
self.view.set_page_content(img_lines)
if (number is not None):
self.model.current_page_number = number
... | def display_page(self, number: Optional[int]=None) -> None:
img_lines = self.model.get_page_content(target_size=self.screen_size, number=number)
if (img_lines is not None):
self.view.set_page_content(img_lines)
if (number is not None):
self.model.current_page_number = number
... |
77b6b8337787f5961b97b51a3a1779802f18a9df9d3db1617cb9ac52a9f9a1ed | async def test_setup(hass: HomeAssistant, fritz: Mock):
'Test setup of platform.'
device = FritzDeviceBinarySensorMock()
assert (await setup_config_entry(hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz))
state = hass.states.get(f'{ENTITY_ID}_alarm')
assert state
assert (s... | Test setup of platform. | tests/components/fritzbox/test_binary_sensor.py | test_setup | GrandMoff100/homeassistant-core | 30,023 | python | async def test_setup(hass: HomeAssistant, fritz: Mock):
device = FritzDeviceBinarySensorMock()
assert (await setup_config_entry(hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz))
state = hass.states.get(f'{ENTITY_ID}_alarm')
assert state
assert (state.state == STATE_ON)
... | async def test_setup(hass: HomeAssistant, fritz: Mock):
device = FritzDeviceBinarySensorMock()
assert (await setup_config_entry(hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz))
state = hass.states.get(f'{ENTITY_ID}_alarm')
assert state
assert (state.state == STATE_ON)
... |
820a0650b07bc47681ad2a749bc411407b0fd8bb0a4186bba6f0f78dbbfa6c63 | async def test_is_off(hass: HomeAssistant, fritz: Mock):
'Test state of platform.'
device = FritzDeviceBinarySensorMock()
device.present = False
assert (await setup_config_entry(hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz))
state = hass.states.get(f'{ENTITY_ID}_alarm')
... | Test state of platform. | tests/components/fritzbox/test_binary_sensor.py | test_is_off | GrandMoff100/homeassistant-core | 30,023 | python | async def test_is_off(hass: HomeAssistant, fritz: Mock):
device = FritzDeviceBinarySensorMock()
device.present = False
assert (await setup_config_entry(hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz))
state = hass.states.get(f'{ENTITY_ID}_alarm')
assert state
assert... | async def test_is_off(hass: HomeAssistant, fritz: Mock):
device = FritzDeviceBinarySensorMock()
device.present = False
assert (await setup_config_entry(hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz))
state = hass.states.get(f'{ENTITY_ID}_alarm')
assert state
assert... |
63a87277e56a4ad8f0ff769916cedd05399b9cd58c494f980ad25e4fe649f54a | async def test_update(hass: HomeAssistant, fritz: Mock):
'Test update without error.'
device = FritzDeviceBinarySensorMock()
assert (await setup_config_entry(hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz))
assert (fritz().update_devices.call_count == 1)
assert (fritz().logi... | Test update without error. | tests/components/fritzbox/test_binary_sensor.py | test_update | GrandMoff100/homeassistant-core | 30,023 | python | async def test_update(hass: HomeAssistant, fritz: Mock):
device = FritzDeviceBinarySensorMock()
assert (await setup_config_entry(hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz))
assert (fritz().update_devices.call_count == 1)
assert (fritz().login.call_count == 1)
next_... | async def test_update(hass: HomeAssistant, fritz: Mock):
device = FritzDeviceBinarySensorMock()
assert (await setup_config_entry(hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz))
assert (fritz().update_devices.call_count == 1)
assert (fritz().login.call_count == 1)
next_... |
015d0245ec854c10897fc5827ba000b1c5152dab74227d7284ac28104edcb007 | async def test_update_error(hass: HomeAssistant, fritz: Mock):
'Test update with error.'
device = FritzDeviceBinarySensorMock()
device.update.side_effect = [mock.DEFAULT, HTTPError('Boom')]
assert (await setup_config_entry(hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz))
ass... | Test update with error. | tests/components/fritzbox/test_binary_sensor.py | test_update_error | GrandMoff100/homeassistant-core | 30,023 | python | async def test_update_error(hass: HomeAssistant, fritz: Mock):
device = FritzDeviceBinarySensorMock()
device.update.side_effect = [mock.DEFAULT, HTTPError('Boom')]
assert (await setup_config_entry(hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz))
assert (fritz().update_devic... | async def test_update_error(hass: HomeAssistant, fritz: Mock):
device = FritzDeviceBinarySensorMock()
device.update.side_effect = [mock.DEFAULT, HTTPError('Boom')]
assert (await setup_config_entry(hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz))
assert (fritz().update_devic... |
2118b85026cacd949efdab79e276a5616b9e73efeb2f34076095cf2db26e3a1d | def is_member(user: User) -> bool:
'\n Checks whether the given user is a member.\n A member must have a name starting with "L".\n :param user: User\n :return: bool\n '
if (not user):
raise TypeError('user should not be None')
return user.name.startswith('L') | Checks whether the given user is a member.
A member must have a name starting with "L".
:param user: User
:return: bool | Testing/unit_test/pytest_for_python/src/codes.py | is_member | Ziang-Lu/Software-Development-and-Design | 1 | python | def is_member(user: User) -> bool:
'\n Checks whether the given user is a member.\n A member must have a name starting with "L".\n :param user: User\n :return: bool\n '
if (not user):
raise TypeError('user should not be None')
return user.name.startswith('L') | def is_member(user: User) -> bool:
'\n Checks whether the given user is a member.\n A member must have a name starting with "L".\n :param user: User\n :return: bool\n '
if (not user):
raise TypeError('user should not be None')
return user.name.startswith('L')<|docstring|>Checks whethe... |
fa5455518707250e0922f379e1315a7a6a2b14c44e8ff5b48a037b5e8ab08ac4 | def is_prime_member(user: User) -> bool:
'\n Checks whether the given user is a prime member.\n A prime member must have a name starting with "W".\n :param user: User\n :return: bool\n '
if (not user):
raise TypeError('user should not be None')
return user.name.startswith('W') | Checks whether the given user is a prime member.
A prime member must have a name starting with "W".
:param user: User
:return: bool | Testing/unit_test/pytest_for_python/src/codes.py | is_prime_member | Ziang-Lu/Software-Development-and-Design | 1 | python | def is_prime_member(user: User) -> bool:
'\n Checks whether the given user is a prime member.\n A prime member must have a name starting with "W".\n :param user: User\n :return: bool\n '
if (not user):
raise TypeError('user should not be None')
return user.name.startswith('W') | def is_prime_member(user: User) -> bool:
'\n Checks whether the given user is a prime member.\n A prime member must have a name starting with "W".\n :param user: User\n :return: bool\n '
if (not user):
raise TypeError('user should not be None')
return user.name.startswith('W')<|docstr... |
b928209e039133bb56d79f41b1149fa5f61e133e79576cebe6e26bb378969ef4 | def __init__(self, name: str, pwd: str):
'\n Constructor with parameter.\n :param name: str\n :param pwd: str\n '
print('This is a long long process of creating a user...')
self._name = name
self._pwd = pwd | Constructor with parameter.
:param name: str
:param pwd: str | Testing/unit_test/pytest_for_python/src/codes.py | __init__ | Ziang-Lu/Software-Development-and-Design | 1 | python | def __init__(self, name: str, pwd: str):
'\n Constructor with parameter.\n :param name: str\n :param pwd: str\n '
print('This is a long long process of creating a user...')
self._name = name
self._pwd = pwd | def __init__(self, name: str, pwd: str):
'\n Constructor with parameter.\n :param name: str\n :param pwd: str\n '
print('This is a long long process of creating a user...')
self._name = name
self._pwd = pwd<|docstring|>Constructor with parameter.
:param name: str
:param pwd: ... |
93a8f435239bbc6efbc9490469dd07a93e70c1018bbbb4f2b96b23501f46769e | @property
def name(self) -> str:
'\n Accessor of name.\n :return: str\n '
return self._name | Accessor of name.
:return: str | Testing/unit_test/pytest_for_python/src/codes.py | name | Ziang-Lu/Software-Development-and-Design | 1 | python | @property
def name(self) -> str:
'\n Accessor of name.\n :return: str\n '
return self._name | @property
def name(self) -> str:
'\n Accessor of name.\n :return: str\n '
return self._name<|docstring|>Accessor of name.
:return: str<|endoftext|> |
4f734f2e592931c6352888b2e9397adf337c4725fd017ffe63b6ff993c196fd4 | @property
def pwd(self) -> str:
'\n Accessor of pwd.\n :return: str\n '
return self._pwd | Accessor of pwd.
:return: str | Testing/unit_test/pytest_for_python/src/codes.py | pwd | Ziang-Lu/Software-Development-and-Design | 1 | python | @property
def pwd(self) -> str:
'\n Accessor of pwd.\n :return: str\n '
return self._pwd | @property
def pwd(self) -> str:
'\n Accessor of pwd.\n :return: str\n '
return self._pwd<|docstring|>Accessor of pwd.
:return: str<|endoftext|> |
66e924610d66234cb99114f2d53f3288df7eed3d11a5e8abaa142e0a7d54100f | def clean_up(self) -> None:
'\n Dummy method to do some clean-up work.\n '
print('Doing some clean-up work...') | Dummy method to do some clean-up work. | Testing/unit_test/pytest_for_python/src/codes.py | clean_up | Ziang-Lu/Software-Development-and-Design | 1 | python | def clean_up(self) -> None:
'\n \n '
print('Doing some clean-up work...') | def clean_up(self) -> None:
'\n \n '
print('Doing some clean-up work...')<|docstring|>Dummy method to do some clean-up work.<|endoftext|> |
13f855e78a628a7ebd87ded259359623560368fd84341a99a5288827bb565c92 | def normalize(type_str):
'\n TODO\n '
assert False | TODO | bimini/grammar.py | normalize | vaporydev/bimini | 7 | python | def normalize(type_str):
'\n \n '
assert False | def normalize(type_str):
'\n \n '
assert False<|docstring|>TODO<|endoftext|> |
03cef274a461e659efbad5a7e5fd7a0d26b82c79808ac7bdb8edf16bef6b58c8 | @functools.lru_cache(maxsize=None)
def parse(self, type_str):
'\n Parses a type string into an appropriate instance of\n :class:`~eth_abi.grammar.ABIType`. If a type string cannot be parsed,\n throws :class:`~eth_abi.exceptions.ParseError`.\n\n :param type_str: The type string to be par... | Parses a type string into an appropriate instance of
:class:`~eth_abi.grammar.ABIType`. If a type string cannot be parsed,
throws :class:`~eth_abi.exceptions.ParseError`.
:param type_str: The type string to be parsed.
:returns: An instance of :class:`~eth_abi.grammar.ABIType` containing
information about the pars... | bimini/grammar.py | parse | vaporydev/bimini | 7 | python | @functools.lru_cache(maxsize=None)
def parse(self, type_str):
'\n Parses a type string into an appropriate instance of\n :class:`~eth_abi.grammar.ABIType`. If a type string cannot be parsed,\n throws :class:`~eth_abi.exceptions.ParseError`.\n\n :param type_str: The type string to be par... | @functools.lru_cache(maxsize=None)
def parse(self, type_str):
'\n Parses a type string into an appropriate instance of\n :class:`~eth_abi.grammar.ABIType`. If a type string cannot be parsed,\n throws :class:`~eth_abi.exceptions.ParseError`.\n\n :param type_str: The type string to be par... |
a00bc9f24bde32eb14853b5170d7ee0a72d755859c9fe5d41eb2656595ebc5c1 | def to_int(self) -> int:
'转换为整数表示,用于串行化'
mapping = {FrameType.MIN1: 1, FrameType.MIN5: 2, FrameType.MIN15: 3, FrameType.MIN30: 4, FrameType.MIN60: 5, FrameType.DAY: 6, FrameType.WEEK: 7, FrameType.MONTH: 8, FrameType.QUARTER: 9, FrameType.YEAR: 10}
return mapping[self] | 转换为整数表示,用于串行化 | omicron/core/types.py | to_int | evimacs/omicron | 4 | python | def to_int(self) -> int:
mapping = {FrameType.MIN1: 1, FrameType.MIN5: 2, FrameType.MIN15: 3, FrameType.MIN30: 4, FrameType.MIN60: 5, FrameType.DAY: 6, FrameType.WEEK: 7, FrameType.MONTH: 8, FrameType.QUARTER: 9, FrameType.YEAR: 10}
return mapping[self] | def to_int(self) -> int:
mapping = {FrameType.MIN1: 1, FrameType.MIN5: 2, FrameType.MIN15: 3, FrameType.MIN30: 4, FrameType.MIN60: 5, FrameType.DAY: 6, FrameType.WEEK: 7, FrameType.MONTH: 8, FrameType.QUARTER: 9, FrameType.YEAR: 10}
return mapping[self]<|docstring|>转换为整数表示,用于串行化<|endoftext|> |
722d64235f6bf59489110d9def0db7c85adfc652a0fcb3f2c6cde2bc6a2baab5 | @staticmethod
def from_int(frame_type: int) -> 'FrameType':
'将整数表示的`frame_type`转换为`FrameType`类型'
mapping = {1: FrameType.MIN1, 2: FrameType.MIN5, 3: FrameType.MIN15, 4: FrameType.MIN30, 5: FrameType.MIN60, 6: FrameType.DAY, 7: FrameType.WEEK, 8: FrameType.MONTH, 9: FrameType.QUARTER, 10: FrameType.YEAR}
ret... | 将整数表示的`frame_type`转换为`FrameType`类型 | omicron/core/types.py | from_int | evimacs/omicron | 4 | python | @staticmethod
def from_int(frame_type: int) -> 'FrameType':
mapping = {1: FrameType.MIN1, 2: FrameType.MIN5, 3: FrameType.MIN15, 4: FrameType.MIN30, 5: FrameType.MIN60, 6: FrameType.DAY, 7: FrameType.WEEK, 8: FrameType.MONTH, 9: FrameType.QUARTER, 10: FrameType.YEAR}
return mapping[frame_type] | @staticmethod
def from_int(frame_type: int) -> 'FrameType':
mapping = {1: FrameType.MIN1, 2: FrameType.MIN5, 3: FrameType.MIN15, 4: FrameType.MIN30, 5: FrameType.MIN60, 6: FrameType.DAY, 7: FrameType.WEEK, 8: FrameType.MONTH, 9: FrameType.QUARTER, 10: FrameType.YEAR}
return mapping[frame_type]<|docstring|>... |
c6ba853096c7793898dec68e1cd0e6927895e9f9778b89be11990d813ee1493c | def zero_to_empty(raw_input):
'Return None when entry is 0'
if (utils.is_empty(raw_input) or (raw_input == '0')):
return None
else:
return raw_input | Return None when entry is 0 | django/common/scripts/cleaning/zero_to_empty.py | zero_to_empty | arkhn/fhir-river | 42 | python | def zero_to_empty(raw_input):
if (utils.is_empty(raw_input) or (raw_input == '0')):
return None
else:
return raw_input | def zero_to_empty(raw_input):
if (utils.is_empty(raw_input) or (raw_input == '0')):
return None
else:
return raw_input<|docstring|>Return None when entry is 0<|endoftext|> |
6f587b3b59a5be6846af2249fe4facf4a4f5b826f66403e6aa9b35b78460ecf8 | @abc.abstractmethod
def getType(self):
'获得奖励类型'
pass | 获得奖励类型 | plane_1.0/plane/award.py | getType | misaka46/Aircraft-war | 0 | python | @abc.abstractmethod
def getType(self):
pass | @abc.abstractmethod
def getType(self):
pass<|docstring|>获得奖励类型<|endoftext|> |
86ae589f2514aacddb9a862732e13ef252424e521af317794ebef9a5bca50dcc | def getTime():
'Get time in H:M:S format.'
_bigTime = time.strftime('%H:%M:%S')
return _bigTime | Get time in H:M:S format. | runbot.py | getTime | SuperShadowPlay/MCPD | 0 | python | def getTime():
_bigTime = time.strftime('%H:%M:%S')
return _bigTime | def getTime():
_bigTime = time.strftime('%H:%M:%S')
return _bigTime<|docstring|>Get time in H:M:S format.<|endoftext|> |
47f0f3d2468b540ae526019b302c86a65f469077500d9bbc5284f6f111ac61d4 | async def playerCountUpdate():
'Bot status for player count in the sidebar and output.\n\n The top part of this function is for the sidebar player count,\n the bottom part is for the output channel (if requested).\n '
(await client.wait_until_ready())
while (not client.is_closed()):
mcServe... | Bot status for player count in the sidebar and output.
The top part of this function is for the sidebar player count,
the bottom part is for the output channel (if requested). | runbot.py | playerCountUpdate | SuperShadowPlay/MCPD | 0 | python | async def playerCountUpdate():
'Bot status for player count in the sidebar and output.\n\n The top part of this function is for the sidebar player count,\n the bottom part is for the output channel (if requested).\n '
(await client.wait_until_ready())
while (not client.is_closed()):
mcServe... | async def playerCountUpdate():
'Bot status for player count in the sidebar and output.\n\n The top part of this function is for the sidebar player count,\n the bottom part is for the output channel (if requested).\n '
(await client.wait_until_ready())
while (not client.is_closed()):
mcServe... |
94d595ed8602675bd47c61113f7e43bf4b2c8b6f71491660dd40991e4c7936d2 | @client.event
async def on_message(message):
'On message portion, most of the actual programming is in this function.'
if (message.author == client.user):
return
msgSplit = message.content.split()
try:
msgSplit[0]
except IndexError:
return
if (cBasePrompt == '0'):
... | On message portion, most of the actual programming is in this function. | runbot.py | on_message | SuperShadowPlay/MCPD | 0 | python | @client.event
async def on_message(message):
if (message.author == client.user):
return
msgSplit = message.content.split()
try:
msgSplit[0]
except IndexError:
return
if (cBasePrompt == '0'):
cPrompt = (('<@' + str(client.user.id)) + '>')
else:
cPrompt... | @client.event
async def on_message(message):
if (message.author == client.user):
return
msgSplit = message.content.split()
try:
msgSplit[0]
except IndexError:
return
if (cBasePrompt == '0'):
cPrompt = (('<@' + str(client.user.id)) + '>')
else:
cPrompt... |
c1b4bc6b92b1a798c9ccf7232660053180b9d0fba575d8c7a44d22fd4a8d62d3 | async def printStatus():
'Print the updating status to the console.'
(await client.wait_until_ready())
while (not client.is_closed()):
mcServer = MinecraftServer(cIP, cPort)
serverStatus = mcServer.status()
if ((cEnableNames is True) and ('{1}' in cMessageSend) and (serverStatus.play... | Print the updating status to the console. | runbot.py | printStatus | SuperShadowPlay/MCPD | 0 | python | async def printStatus():
(await client.wait_until_ready())
while (not client.is_closed()):
mcServer = MinecraftServer(cIP, cPort)
serverStatus = mcServer.status()
if ((cEnableNames is True) and ('{1}' in cMessageSend) and (serverStatus.players.online != 0)):
mcQuery = mc... | async def printStatus():
(await client.wait_until_ready())
while (not client.is_closed()):
mcServer = MinecraftServer(cIP, cPort)
serverStatus = mcServer.status()
if ((cEnableNames is True) and ('{1}' in cMessageSend) and (serverStatus.players.online != 0)):
mcQuery = mc... |
32be21fc59851e04c2a7a379b8bae07b1e100a2f7bc963fbedc6e65837755517 | @client.event
async def on_ready():
'Log in and other such wonders.'
print('Logged in as:')
print(client.user.name)
print(client.user.id)
if (cBasePrompt == '0'):
cPromptText = ('@' + client.user.name)
else:
cPromptText = str(cBasePrompt)
print(('Prompt: ' + cPromptText))
... | Log in and other such wonders. | runbot.py | on_ready | SuperShadowPlay/MCPD | 0 | python | @client.event
async def on_ready():
print('Logged in as:')
print(client.user.name)
print(client.user.id)
if (cBasePrompt == '0'):
cPromptText = ('@' + client.user.name)
else:
cPromptText = str(cBasePrompt)
print(('Prompt: ' + cPromptText))
print('------') | @client.event
async def on_ready():
print('Logged in as:')
print(client.user.name)
print(client.user.id)
if (cBasePrompt == '0'):
cPromptText = ('@' + client.user.name)
else:
cPromptText = str(cBasePrompt)
print(('Prompt: ' + cPromptText))
print('------')<|docstring|>Log... |
6472b01902a6f33901061fa1f1b3fb33370791e0f9d2f68d6f9894995cefb7a3 | def predict_keras(img, alpha, rows):
'\n params: img: an input image with shape (1, 224, 224, 3)\n note: Image has been preprocessed (x /= 127.5 - 1)\n Runs forward pass on network and returns logits and the inference time\n '
input_tensor = Input(shape=(rows, rows, 3))
model = MobileNet... | params: img: an input image with shape (1, 224, 224, 3)
note: Image has been preprocessed (x /= 127.5 - 1)
Runs forward pass on network and returns logits and the inference time | test_mobilenet.py | predict_keras | JonathanCMitchell/mobilenet_v2_keras | 94 | python | def predict_keras(img, alpha, rows):
'\n params: img: an input image with shape (1, 224, 224, 3)\n note: Image has been preprocessed (x /= 127.5 - 1)\n Runs forward pass on network and returns logits and the inference time\n '
input_tensor = Input(shape=(rows, rows, 3))
model = MobileNet... | def predict_keras(img, alpha, rows):
'\n params: img: an input image with shape (1, 224, 224, 3)\n note: Image has been preprocessed (x /= 127.5 - 1)\n Runs forward pass on network and returns logits and the inference time\n '
input_tensor = Input(shape=(rows, rows, 3))
model = MobileNet... |
9e1850770b4fe4aaf6bc5613fac9a1e77264254f0c5a08e3b79054354ab753cf | def predict_slim(img, checkpoint, rows):
'\n params: img: a preprocessed image with shape (1, 224, 224, 3)\n checkpoint: the path to the frozen.pb checkpoint\n Runs a forward pass of the tensorflow slim mobilenetV2 model which has been frozen for inference\n returns: numpy array x, which are the... | params: img: a preprocessed image with shape (1, 224, 224, 3)
checkpoint: the path to the frozen.pb checkpoint
Runs a forward pass of the tensorflow slim mobilenetV2 model which has been frozen for inference
returns: numpy array x, which are the logits, and the inference time | test_mobilenet.py | predict_slim | JonathanCMitchell/mobilenet_v2_keras | 94 | python | def predict_slim(img, checkpoint, rows):
'\n params: img: a preprocessed image with shape (1, 224, 224, 3)\n checkpoint: the path to the frozen.pb checkpoint\n Runs a forward pass of the tensorflow slim mobilenetV2 model which has been frozen for inference\n returns: numpy array x, which are the... | def predict_slim(img, checkpoint, rows):
'\n params: img: a preprocessed image with shape (1, 224, 224, 3)\n checkpoint: the path to the frozen.pb checkpoint\n Runs a forward pass of the tensorflow slim mobilenetV2 model which has been frozen for inference\n returns: numpy array x, which are the... |
d9193621a5c0b80ca43c8457e63fda0d7b4876e56595907c050cbe462a32d4ed | def add(self, source, destination, port):
'\n Adds a route from "source" to "destination".\n '
return self.paths.add(source, destination, port) | Adds a route from "source" to "destination". | cloudless/providers/aws_mock/paths.py | add | getcloudless/cloudless | 8 | python | def add(self, source, destination, port):
'\n \n '
return self.paths.add(source, destination, port) | def add(self, source, destination, port):
'\n \n '
return self.paths.add(source, destination, port)<|docstring|>Adds a route from "source" to "destination".<|endoftext|> |
008bdb9384b033d1a79e7a94a7ad56c3725458c4d3d3282a883cde727fe71df2 | def remove(self, source, destination, port):
'\n Remove a route from "source" to "destination".\n '
return self.paths.remove(source, destination, port) | Remove a route from "source" to "destination". | cloudless/providers/aws_mock/paths.py | remove | getcloudless/cloudless | 8 | python | def remove(self, source, destination, port):
'\n \n '
return self.paths.remove(source, destination, port) | def remove(self, source, destination, port):
'\n \n '
return self.paths.remove(source, destination, port)<|docstring|>Remove a route from "source" to "destination".<|endoftext|> |
64879b32cfc4cca7a06e52ba9d65da69c88af68b4de1aea4a9178dadaa4088ea | def list(self):
'\n List all paths and return a dictionary structure representing a graph.\n '
return self.paths.list() | List all paths and return a dictionary structure representing a graph. | cloudless/providers/aws_mock/paths.py | list | getcloudless/cloudless | 8 | python | def list(self):
'\n \n '
return self.paths.list() | def list(self):
'\n \n '
return self.paths.list()<|docstring|>List all paths and return a dictionary structure representing a graph.<|endoftext|> |
8b8f4c61383f9b5a4ef0e1cb10055c59dda2afb60b05ef1f6a7493cb2f6c7bf7 | def internet_accessible(self, service, port):
'\n Return true if the given service is accessible on the internet.\n '
return self.paths.internet_accessible(service, port) | Return true if the given service is accessible on the internet. | cloudless/providers/aws_mock/paths.py | internet_accessible | getcloudless/cloudless | 8 | python | def internet_accessible(self, service, port):
'\n \n '
return self.paths.internet_accessible(service, port) | def internet_accessible(self, service, port):
'\n \n '
return self.paths.internet_accessible(service, port)<|docstring|>Return true if the given service is accessible on the internet.<|endoftext|> |
493943e53ad53265737004aceb9a3a8df8aa1e325b646686725c53d0200bd6db | def has_access(self, source, destination, port):
'\n Return true if there is a route from "source" to "destination".\n '
return self.paths.has_access(source, destination, port) | Return true if there is a route from "source" to "destination". | cloudless/providers/aws_mock/paths.py | has_access | getcloudless/cloudless | 8 | python | def has_access(self, source, destination, port):
'\n \n '
return self.paths.has_access(source, destination, port) | def has_access(self, source, destination, port):
'\n \n '
return self.paths.has_access(source, destination, port)<|docstring|>Return true if there is a route from "source" to "destination".<|endoftext|> |
d7f9a1827bd39a0e9abe4e221e617d39b97b9f964094ab775cde86bd2a1434dc | def get_full_name(self):
"\n Returns the user's fullname\n "
return self.fullname | Returns the user's fullname | users/models.py | get_full_name | rnovec/petgram-api | 1 | python | def get_full_name(self):
"\n \n "
return self.fullname | def get_full_name(self):
"\n \n "
return self.fullname<|docstring|>Returns the user's fullname<|endoftext|> |
a6fb138b7b5a4c52b11e88ba00e59200e53541fc634bbedf670926d5f24b25db | def __init__(self, lrkey=None, **kwargs):
'\n define local vars and send all other (keyworded) arguments to parent.\n '
if (lrkey is None):
print('{}: using default value of lapse rate ({})'.format(self.__class__.__name__, self.lrkey))
else:
self.lrkey = lrkey
super().__ini... | define local vars and send all other (keyworded) arguments to parent. | solver/rce.py | __init__ | msmithsm/rce | 0 | python | def __init__(self, lrkey=None, **kwargs):
'\n \n '
if (lrkey is None):
print('{}: using default value of lapse rate ({})'.format(self.__class__.__name__, self.lrkey))
else:
self.lrkey = lrkey
super().__init__(**kwargs) | def __init__(self, lrkey=None, **kwargs):
'\n \n '
if (lrkey is None):
print('{}: using default value of lapse rate ({})'.format(self.__class__.__name__, self.lrkey))
else:
self.lrkey = lrkey
super().__init__(**kwargs)<|docstring|>define local vars and send all other (keywo... |
d51eae68e2bd30a6637ab3965444c8d4e33d59e937d1f4da33def7ae4587b057 | def _convectiveadjustment(self, atms, flx, hr):
'\n Apply convective adjustment\n '
tconv = self._lr(atms, self.lrkey)
trad = atms.t.copy()
atms.t = np.where((atms.p >= atms._ttl_pmax), tconv, np.maximum(tconv, atms.t))
try:
iconv_top = (np.argwhere((tconv >= trad)).min() - 1)
... | Apply convective adjustment | solver/rce.py | _convectiveadjustment | msmithsm/rce | 0 | python | def _convectiveadjustment(self, atms, flx, hr):
'\n \n '
tconv = self._lr(atms, self.lrkey)
trad = atms.t.copy()
atms.t = np.where((atms.p >= atms._ttl_pmax), tconv, np.maximum(tconv, atms.t))
try:
iconv_top = (np.argwhere((tconv >= trad)).min() - 1)
except ValueError:
... | def _convectiveadjustment(self, atms, flx, hr):
'\n \n '
tconv = self._lr(atms, self.lrkey)
trad = atms.t.copy()
atms.t = np.where((atms.p >= atms._ttl_pmax), tconv, np.maximum(tconv, atms.t))
try:
iconv_top = (np.argwhere((tconv >= trad)).min() - 1)
except ValueError:
... |
b6f78b3d6732fa5776f148a2b5ae026acc0a8eccadab1c736b24bc26dcc43cba | def get_data_as_dataframe(self, start_date: datetime, end_date: datetime, method: str, aggregate: str, query: str):
'\n Returns data corresponding to the given query and from the specified time period.\n '
start_date_str = start_date.strftime('%Y.%m.%d %H:00:00')
end_date_str = end_date.strfti... | Returns data corresponding to the given query and from the specified time period. | src/osiris/adapters/sap_service.py | get_data_as_dataframe | Open-Dataplatform/osiris-sdk | 1 | python | def get_data_as_dataframe(self, start_date: datetime, end_date: datetime, method: str, aggregate: str, query: str):
'\n \n '
start_date_str = start_date.strftime('%Y.%m.%d %H:00:00')
end_date_str = end_date.strftime('%Y.%m.%d %H:00:00')
period_params = f"(IP_FROM_TIME='{start_date_str}',IP... | def get_data_as_dataframe(self, start_date: datetime, end_date: datetime, method: str, aggregate: str, query: str):
'\n \n '
start_date_str = start_date.strftime('%Y.%m.%d %H:00:00')
end_date_str = end_date.strftime('%Y.%m.%d %H:00:00')
period_params = f"(IP_FROM_TIME='{start_date_str}',IP... |
84c3cd85d5c6f616b9eacd63580b492236f880efa554645108e8bc7910b3e8b7 | def Equals(self, *__args):
'\n Equals(self: HierarchicalVirtualizationConstraints,comparisonConstraints: HierarchicalVirtualizationConstraints) -> bool\n\n Equals(self: HierarchicalVirtualizationConstraints,oCompare: object) -> bool\n '
pass | Equals(self: HierarchicalVirtualizationConstraints,comparisonConstraints: HierarchicalVirtualizationConstraints) -> bool
Equals(self: HierarchicalVirtualizationConstraints,oCompare: object) -> bool | release/stubs.min/System/Windows/Controls/__init___parts/HierarchicalVirtualizationConstraints.py | Equals | htlcnn/ironpython-stubs | 182 | python | def Equals(self, *__args):
'\n Equals(self: HierarchicalVirtualizationConstraints,comparisonConstraints: HierarchicalVirtualizationConstraints) -> bool\n\n Equals(self: HierarchicalVirtualizationConstraints,oCompare: object) -> bool\n '
pass | def Equals(self, *__args):
'\n Equals(self: HierarchicalVirtualizationConstraints,comparisonConstraints: HierarchicalVirtualizationConstraints) -> bool\n\n Equals(self: HierarchicalVirtualizationConstraints,oCompare: object) -> bool\n '
pass<|docstring|>Equals(self: HierarchicalVirtualizationConstraints,comp... |
a85998ec79c86fad76ba28b3f608ac7b259a02812801341eee32682bb060823a | def GetHashCode(self):
' GetHashCode(self: HierarchicalVirtualizationConstraints) -> int '
pass | GetHashCode(self: HierarchicalVirtualizationConstraints) -> int | release/stubs.min/System/Windows/Controls/__init___parts/HierarchicalVirtualizationConstraints.py | GetHashCode | htlcnn/ironpython-stubs | 182 | python | def GetHashCode(self):
' '
pass | def GetHashCode(self):
' '
pass<|docstring|>GetHashCode(self: HierarchicalVirtualizationConstraints) -> int<|endoftext|> |
afbec9d4036cd220dba8b92f655293f0f39188798750e21688134b4cd99b3518 | def __eq__(self, *args):
' x.__eq__(y) <==> x==y '
pass | x.__eq__(y) <==> x==y | release/stubs.min/System/Windows/Controls/__init___parts/HierarchicalVirtualizationConstraints.py | __eq__ | htlcnn/ironpython-stubs | 182 | python | def __eq__(self, *args):
' '
pass | def __eq__(self, *args):
' '
pass<|docstring|>x.__eq__(y) <==> x==y<|endoftext|> |
dcccb41d53b52c0ad8d56c0d3897f5fbdcc293dc83dc2c2e3e0daf8bb9724e0c | @staticmethod
def __new__(self, cacheLength, cacheLengthUnit, viewport):
'\n __new__(cls: type,cacheLength: VirtualizationCacheLength,cacheLengthUnit: VirtualizationCacheLengthUnit,viewport: Rect)\n\n __new__[HierarchicalVirtualizationConstraints]() -> HierarchicalVirtualizationConstraints\n '
pass | __new__(cls: type,cacheLength: VirtualizationCacheLength,cacheLengthUnit: VirtualizationCacheLengthUnit,viewport: Rect)
__new__[HierarchicalVirtualizationConstraints]() -> HierarchicalVirtualizationConstraints | release/stubs.min/System/Windows/Controls/__init___parts/HierarchicalVirtualizationConstraints.py | __new__ | htlcnn/ironpython-stubs | 182 | python | @staticmethod
def __new__(self, cacheLength, cacheLengthUnit, viewport):
'\n __new__(cls: type,cacheLength: VirtualizationCacheLength,cacheLengthUnit: VirtualizationCacheLengthUnit,viewport: Rect)\n\n __new__[HierarchicalVirtualizationConstraints]() -> HierarchicalVirtualizationConstraints\n '
pass | @staticmethod
def __new__(self, cacheLength, cacheLengthUnit, viewport):
'\n __new__(cls: type,cacheLength: VirtualizationCacheLength,cacheLengthUnit: VirtualizationCacheLengthUnit,viewport: Rect)\n\n __new__[HierarchicalVirtualizationConstraints]() -> HierarchicalVirtualizationConstraints\n '
pass<|docstrin... |
450ea4cbd9edeb66ffd2ced779ad7470dbe2f0845b1fdb03f1b912a6c980178f | def normalize_answer(s):
'Lower text and remove punctuation, articles and extra whitespace.'
def remove_articles(text):
return re.sub('\\b(a|an|the)\\b', ' ', text)
def white_space_fix(text):
return ' '.join(text.split())
def remove_punc(text):
exclude = set(string.punctuation... | Lower text and remove punctuation, articles and extra whitespace. | evals/eval_xor_engspan.py | normalize_answer | gowtham1997/XORQA | 62 | python | def normalize_answer(s):
def remove_articles(text):
return re.sub('\\b(a|an|the)\\b', ' ', text)
def white_space_fix(text):
return ' '.join(text.split())
def remove_punc(text):
exclude = set(string.punctuation)
return .join((ch for ch in text if (ch not in exclude)))
... | def normalize_answer(s):
def remove_articles(text):
return re.sub('\\b(a|an|the)\\b', ' ', text)
def white_space_fix(text):
return ' '.join(text.split())
def remove_punc(text):
exclude = set(string.punctuation)
return .join((ch for ch in text if (ch not in exclude)))
... |
c5db299caeb94ecdf9e51d70e2c050385506eb16e38d7f990991ab1aa5ef0723 | @pytest.fixture
def klass():
'Provide the CUT.'
from agile_analytics import LeadTimeDistributionReporter
return LeadTimeDistributionReporter | Provide the CUT. | tests/test_lead_reporter.py | klass | cmheisel/jira-agile-extractor | 14 | python | @pytest.fixture
def klass():
from agile_analytics import LeadTimeDistributionReporter
return LeadTimeDistributionReporter | @pytest.fixture
def klass():
from agile_analytics import LeadTimeDistributionReporter
return LeadTimeDistributionReporter<|docstring|>Provide the CUT.<|endoftext|> |
9424a06aa4861f46f8a3d9c9c0957718fec7f30c1ab802246bd67c6ce8699bb7 | def test_klass(klass):
'Ensure the fixture works.'
assert klass | Ensure the fixture works. | tests/test_lead_reporter.py | test_klass | cmheisel/jira-agile-extractor | 14 | python | def test_klass(klass):
assert klass | def test_klass(klass):
assert klass<|docstring|>Ensure the fixture works.<|endoftext|> |
ac8f212265ad8c18d6f5ee989f4c2d7c4c665f19680e0010bf7f3f326679dfdf | def test_date_selection(klass, datetime, tzutc):
'Ensure the CUT picks Sunday-Saturday date range'
r = klass('Foo')
r.start_date = datetime(2016, 5, 21, 0, 0, 0)
r.end_date = datetime(2016, 6, 21, 11, 59, 59)
assert (r.start_date == datetime(2016, 5, 15, 0, 0, 0, tzinfo=tzutc))
assert (r.end_dat... | Ensure the CUT picks Sunday-Saturday date range | tests/test_lead_reporter.py | test_date_selection | cmheisel/jira-agile-extractor | 14 | python | def test_date_selection(klass, datetime, tzutc):
r = klass('Foo')
r.start_date = datetime(2016, 5, 21, 0, 0, 0)
r.end_date = datetime(2016, 6, 21, 11, 59, 59)
assert (r.start_date == datetime(2016, 5, 15, 0, 0, 0, tzinfo=tzutc))
assert (r.end_date == datetime(2016, 6, 25, 11, 59, 59, tzinfo=tzu... | def test_date_selection(klass, datetime, tzutc):
r = klass('Foo')
r.start_date = datetime(2016, 5, 21, 0, 0, 0)
r.end_date = datetime(2016, 6, 21, 11, 59, 59)
assert (r.start_date == datetime(2016, 5, 15, 0, 0, 0, tzinfo=tzutc))
assert (r.end_date == datetime(2016, 6, 25, 11, 59, 59, tzinfo=tzu... |
84432e1478c427b17a603382771672aec43d9c7a0251227bd731d88b58d5f48c | def test_filter(klass, days_agos, AnalyzedAgileTicket, tzutc):
'filter_issues ignores issues completed before the specified range.'
issue_list_kwargs = []
for i in range(1, 3):
kwargs = dict(key='TEST-{}'.format(i), committed=dict(state='Committed', entered_at=days_agos[2]), started=dict(state='Star... | filter_issues ignores issues completed before the specified range. | tests/test_lead_reporter.py | test_filter | cmheisel/jira-agile-extractor | 14 | python | def test_filter(klass, days_agos, AnalyzedAgileTicket, tzutc):
issue_list_kwargs = []
for i in range(1, 3):
kwargs = dict(key='TEST-{}'.format(i), committed=dict(state='Committed', entered_at=days_agos[2]), started=dict(state='Started', entered_at=days_agos[2]), ended=dict(state='Ended', entered_at... | def test_filter(klass, days_agos, AnalyzedAgileTicket, tzutc):
issue_list_kwargs = []
for i in range(1, 3):
kwargs = dict(key='TEST-{}'.format(i), committed=dict(state='Committed', entered_at=days_agos[2]), started=dict(state='Started', entered_at=days_agos[2]), ended=dict(state='Ended', entered_at... |
2ab3d91cc44ae60359b7fa30f6b3e093199dd709532aa9a3c446723d16c584f7 | def test_report_summary(klass, datetime, tzutc):
'report_on returns an object with meta data.'
start_date = datetime(2016, 5, 15, 0, 0, 0, tzinfo=tzutc)
end_date = datetime(2016, 6, 25, 11, 59, 59, tzinfo=tzutc)
r = klass(title='Cycle Time Distribution Past 30 days', start_date=start_date, end_date=end_... | report_on returns an object with meta data. | tests/test_lead_reporter.py | test_report_summary | cmheisel/jira-agile-extractor | 14 | python | def test_report_summary(klass, datetime, tzutc):
start_date = datetime(2016, 5, 15, 0, 0, 0, tzinfo=tzutc)
end_date = datetime(2016, 6, 25, 11, 59, 59, tzinfo=tzutc)
r = klass(title='Cycle Time Distribution Past 30 days', start_date=start_date, end_date=end_date)
expected = dict(title='Cycle Time D... | def test_report_summary(klass, datetime, tzutc):
start_date = datetime(2016, 5, 15, 0, 0, 0, tzinfo=tzutc)
end_date = datetime(2016, 6, 25, 11, 59, 59, tzinfo=tzutc)
r = klass(title='Cycle Time Distribution Past 30 days', start_date=start_date, end_date=end_date)
expected = dict(title='Cycle Time D... |
5a3c1bc1550630676dab900a1d726c7488f3e29a942f65df713faec614ad836f | def test_report_table_empty(klass, days_agos):
'Ensure an empty list of tickets is handled.'
expected = [['Lead Time', 'Tickets']]
r = klass(title='Cycle Time Distribution Past 30 days', start_date=days_agos[30], end_date=days_agos[0])
report = r.report_on([])
assert (report.table == expected) | Ensure an empty list of tickets is handled. | tests/test_lead_reporter.py | test_report_table_empty | cmheisel/jira-agile-extractor | 14 | python | def test_report_table_empty(klass, days_agos):
expected = [['Lead Time', 'Tickets']]
r = klass(title='Cycle Time Distribution Past 30 days', start_date=days_agos[30], end_date=days_agos[0])
report = r.report_on([])
assert (report.table == expected) | def test_report_table_empty(klass, days_agos):
expected = [['Lead Time', 'Tickets']]
r = klass(title='Cycle Time Distribution Past 30 days', start_date=days_agos[30], end_date=days_agos[0])
report = r.report_on([])
assert (report.table == expected)<|docstring|>Ensure an empty list of tickets is han... |
c8e27c200a41bb2411e85ea843a9578d199247fb2ecc47575abe1d68a1042574 | def test_report_table(klass, days_agos, AnalyzedAgileTicket, tzutc):
'report_on returns an object with a tabular represenation of the data'
issue_list_kwargs = []
for i in range(1, 3):
kwargs = dict(key='TEST-{}'.format(i), committed=dict(state='Committed', entered_at=days_agos[2]), started=dict(sta... | report_on returns an object with a tabular represenation of the data | tests/test_lead_reporter.py | test_report_table | cmheisel/jira-agile-extractor | 14 | python | def test_report_table(klass, days_agos, AnalyzedAgileTicket, tzutc):
issue_list_kwargs = []
for i in range(1, 3):
kwargs = dict(key='TEST-{}'.format(i), committed=dict(state='Committed', entered_at=days_agos[2]), started=dict(state='Started', entered_at=days_agos[2]), ended=dict(state='Ended', ente... | def test_report_table(klass, days_agos, AnalyzedAgileTicket, tzutc):
issue_list_kwargs = []
for i in range(1, 3):
kwargs = dict(key='TEST-{}'.format(i), committed=dict(state='Committed', entered_at=days_agos[2]), started=dict(state='Started', entered_at=days_agos[2]), ended=dict(state='Ended', ente... |
0c52d0236b1f8069f3dfb9e2c60220c27725dcf2d7ff9c3d270f0c3454b935e9 | def search(strings, chars):
"Given a sequence of strings and an iterator of chars, return True\n if any of the strings would be a prefix of ''.join(chars); but\n only consume chars up to the end of the match."
raise NotImplementedError | Given a sequence of strings and an iterator of chars, return True
if any of the strings would be a prefix of ''.join(chars); but
only consume chars up to the end of the match. | reference/regexercise/literals.py | search | JaDogg/__py_playground | 1 | python | def search(strings, chars):
"Given a sequence of strings and an iterator of chars, return True\n if any of the strings would be a prefix of .join(chars); but\n only consume chars up to the end of the match."
raise NotImplementedError | def search(strings, chars):
"Given a sequence of strings and an iterator of chars, return True\n if any of the strings would be a prefix of .join(chars); but\n only consume chars up to the end of the match."
raise NotImplementedError<|docstring|>Given a sequence of strings and an iterator of chars, return... |
c641cf0e82c19ea9a1e30af1e307bb646f5e4bbe03110af57db10326eef7db1d | def split_dataset(dataset: pd.DataFrame) -> Tuple[(pd.DataFrame, pd.DataFrame)]:
'Split dataset into training and validation datasets, based on the "train" column'
training = dataset[dataset['train']]
validation = dataset[(~ dataset['train'])]
return (training, validation) | Split dataset into training and validation datasets, based on the "train" column | kitt/dataset.py | split_dataset | David-Ciz/kitt | 2 | python | def split_dataset(dataset: pd.DataFrame) -> Tuple[(pd.DataFrame, pd.DataFrame)]:
training = dataset[dataset['train']]
validation = dataset[(~ dataset['train'])]
return (training, validation) | def split_dataset(dataset: pd.DataFrame) -> Tuple[(pd.DataFrame, pd.DataFrame)]:
training = dataset[dataset['train']]
validation = dataset[(~ dataset['train'])]
return (training, validation)<|docstring|>Split dataset into training and validation datasets, based on the "train" column<|endoftext|> |
ebe8417f117d198fd7c37ab63a0a5153b5af5f7d6ed6f3ef5b6d32112d489def | def edit_gui_py(content, html_id):
'Function that will change some element in html GUI and is callable from other py scripts.\n\n Args:\n content (str): New content.\n html_id (str): Id of changed element.\n '
import eel
eel.edit_gui_js(content, html_id) | Function that will change some element in html GUI and is callable from other py scripts.
Args:
content (str): New content.
html_id (str): Id of changed element. | predictit/gui_start.py | edit_gui_py | Malachov/predict-it | 7 | python | def edit_gui_py(content, html_id):
'Function that will change some element in html GUI and is callable from other py scripts.\n\n Args:\n content (str): New content.\n html_id (str): Id of changed element.\n '
import eel
eel.edit_gui_js(content, html_id) | def edit_gui_py(content, html_id):
'Function that will change some element in html GUI and is callable from other py scripts.\n\n Args:\n content (str): New content.\n html_id (str): Id of changed element.\n '
import eel
eel.edit_gui_js(content, html_id)<|docstring|>Function that will ch... |
574d41598c9060ec5fbd57d611a679b79c75f59401ddc20ec85500f8294c7cc9 | def run_gui():
'Start web based GUI.'
import eel
web_path = str((Path(__file__).resolve().parents[0] / 'files_for_GUI'))
eel.init(web_path)
this_path = Path(__file__).resolve().parents[1]
this_path_string = str(this_path)
sys.path.insert(0, this_path_string)
config = predictit.config
... | Start web based GUI. | predictit/gui_start.py | run_gui | Malachov/predict-it | 7 | python | def run_gui():
import eel
web_path = str((Path(__file__).resolve().parents[0] / 'files_for_GUI'))
eel.init(web_path)
this_path = Path(__file__).resolve().parents[1]
this_path_string = str(this_path)
sys.path.insert(0, this_path_string)
config = predictit.config
predictit.misc.GLOBAL... | def run_gui():
import eel
web_path = str((Path(__file__).resolve().parents[0] / 'files_for_GUI'))
eel.init(web_path)
this_path = Path(__file__).resolve().parents[1]
this_path_string = str(this_path)
sys.path.insert(0, this_path_string)
config = predictit.config
predictit.misc.GLOBAL... |
1bf499c7e894679510eaa6f8715e021d34751bd22c7867cce10ef805e1fe8173 | @eel.expose
def make_predictions(configured):
'Function that from web GUI button trigger the predictit main predict function and return results on GUI.\n\n Args:\n configured (dict): Some configuration values can be configured in GUI.\n '
config.update(mypythontools.misc.json_to_py(conf... | Function that from web GUI button trigger the predictit main predict function and return results on GUI.
Args:
configured (dict): Some configuration values can be configured in GUI. | predictit/gui_start.py | make_predictions | Malachov/predict-it | 7 | python | @eel.expose
def make_predictions(configured):
'Function that from web GUI button trigger the predictit main predict function and return results on GUI.\n\n Args:\n configured (dict): Some configuration values can be configured in GUI.\n '
config.update(mypythontools.misc.json_to_py(conf... | @eel.expose
def make_predictions(configured):
'Function that from web GUI button trigger the predictit main predict function and return results on GUI.\n\n Args:\n configured (dict): Some configuration values can be configured in GUI.\n '
config.update(mypythontools.misc.json_to_py(conf... |
45274a98ef2a43301a7787176ac3f02eec94bc5597238d2f9217347f46d178cb | def test_score_screw_axes_equivalent_axes():
'Test the score_screw_axes function (when equivalent axes present).'
laue_group_info = laue_groups['P m -3']
reflections = flex.reflection_table()
reflections['miller_index'] = flex.miller_index([(0, 1, 0), (0, 2, 0), (0, 0, 1), (0, 0, 2)])
reflections['i... | Test the score_screw_axes function (when equivalent axes present). | tests/algorithms/symmetry/absences/test_laue_group_info.py | test_score_screw_axes_equivalent_axes | toastisme/dials | 58 | python | def test_score_screw_axes_equivalent_axes():
laue_group_info = laue_groups['P m -3']
reflections = flex.reflection_table()
reflections['miller_index'] = flex.miller_index([(0, 1, 0), (0, 2, 0), (0, 0, 1), (0, 0, 2)])
reflections['intensity'] = flex.double([0.05, 100.0, 0.02, 100.0])
reflections... | def test_score_screw_axes_equivalent_axes():
laue_group_info = laue_groups['P m -3']
reflections = flex.reflection_table()
reflections['miller_index'] = flex.miller_index([(0, 1, 0), (0, 2, 0), (0, 0, 1), (0, 0, 2)])
reflections['intensity'] = flex.double([0.05, 100.0, 0.02, 100.0])
reflections... |
1ce0facb11e4596c96ac3e8e4d37652d90503905647e6dfc4b7dc236e3212226 | def test_score_space_group():
'Test scoring of space groups by combining axis scores.'
laue_group = laue_groups['P 1 2/m 1']
axis_scores = [0.98]
(space_groups, scores) = score_space_groups(axis_scores, laue_group)
for (sg, score) in zip(space_groups, scores):
if (sg == 'P 21'):
... | Test scoring of space groups by combining axis scores. | tests/algorithms/symmetry/absences/test_laue_group_info.py | test_score_space_group | toastisme/dials | 58 | python | def test_score_space_group():
laue_group = laue_groups['P 1 2/m 1']
axis_scores = [0.98]
(space_groups, scores) = score_space_groups(axis_scores, laue_group)
for (sg, score) in zip(space_groups, scores):
if (sg == 'P 21'):
assert (score == pytest.approx(0.98))
elif (sg =... | def test_score_space_group():
laue_group = laue_groups['P 1 2/m 1']
axis_scores = [0.98]
(space_groups, scores) = score_space_groups(axis_scores, laue_group)
for (sg, score) in zip(space_groups, scores):
if (sg == 'P 21'):
assert (score == pytest.approx(0.98))
elif (sg =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.