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 |
|---|---|---|---|---|---|---|---|---|---|
cd53e7a21e67311202167882d4470a78bd7756710ae4cabcde6af92f3d6fdb82 | def test_regex_invalid_tokens(self):
'Messages without anything looking like a token are not matched.'
tokens = ('', 'lemon wins', '..', 'x.y', 'x.y.', '.y.z', '.y.', '..z', 'x..z', ' . . ', '\n.\n.\n', 'hellö.world.bye', 'base64.nötbåse64.morebase64', '19jd3J.dfkm3d.€víł§tüff')
for token in tokens:
... | Messages without anything looking like a token are not matched. | tests/bot/cogs/test_token_remover.py | test_regex_invalid_tokens | ScarletKing001/bot | 1 | python | def test_regex_invalid_tokens(self):
tokens = (, 'lemon wins', '..', 'x.y', 'x.y.', '.y.z', '.y.', '..z', 'x..z', ' . . ', '\n.\n.\n', 'hellö.world.bye', 'base64.nötbåse64.morebase64', '19jd3J.dfkm3d.€víł§tüff')
for token in tokens:
with self.subTest(token=token):
results = token_remove... | def test_regex_invalid_tokens(self):
tokens = (, 'lemon wins', '..', 'x.y', 'x.y.', '.y.z', '.y.', '..z', 'x..z', ' . . ', '\n.\n.\n', 'hellö.world.bye', 'base64.nötbåse64.morebase64', '19jd3J.dfkm3d.€víł§tüff')
for token in tokens:
with self.subTest(token=token):
results = token_remove... |
1797bf11510c1f23fbde628db1300d256a5ca2e0de0f836e604d8bb082e16908 | def test_regex_valid_tokens(self):
'Messages that look like tokens should be matched.'
tokens = ('EXAMPLE_KEY', 'EXAMPLE_KEY', 'EXAMPLE_KEY', 'EXAMPLE_KEY')
for token in tokens:
with self.subTest(token=token):
results = token_remover.TOKEN_RE.fullmatch(token)
self.assertIsNot... | Messages that look like tokens should be matched. | tests/bot/cogs/test_token_remover.py | test_regex_valid_tokens | ScarletKing001/bot | 1 | python | def test_regex_valid_tokens(self):
tokens = ('EXAMPLE_KEY', 'EXAMPLE_KEY', 'EXAMPLE_KEY', 'EXAMPLE_KEY')
for token in tokens:
with self.subTest(token=token):
results = token_remover.TOKEN_RE.fullmatch(token)
self.assertIsNotNone(results, f'{token} was not matched by the rege... | def test_regex_valid_tokens(self):
tokens = ('EXAMPLE_KEY', 'EXAMPLE_KEY', 'EXAMPLE_KEY', 'EXAMPLE_KEY')
for token in tokens:
with self.subTest(token=token):
results = token_remover.TOKEN_RE.fullmatch(token)
self.assertIsNotNone(results, f'{token} was not matched by the rege... |
16e918b276d14b7d4832556a0f3a294c05587a65fc6e7a7f8e034057cd88c10a | def test_regex_matches_multiple_valid(self):
'Should support multiple matches in the middle of a string.'
token_1 = 'EXAMPLE_KEY'
token_2 = 'EXAMPLE_KEY'
message = f'garbage {token_1} hello {token_2} world'
results = token_remover.TOKEN_RE.finditer(message)
results = [match[0] for match in resul... | Should support multiple matches in the middle of a string. | tests/bot/cogs/test_token_remover.py | test_regex_matches_multiple_valid | ScarletKing001/bot | 1 | python | def test_regex_matches_multiple_valid(self):
token_1 = 'EXAMPLE_KEY'
token_2 = 'EXAMPLE_KEY'
message = f'garbage {token_1} hello {token_2} world'
results = token_remover.TOKEN_RE.finditer(message)
results = [match[0] for match in results]
self.assertCountEqual((token_1, token_2), results) | def test_regex_matches_multiple_valid(self):
token_1 = 'EXAMPLE_KEY'
token_2 = 'EXAMPLE_KEY'
message = f'garbage {token_1} hello {token_2} world'
results = token_remover.TOKEN_RE.finditer(message)
results = [match[0] for match in results]
self.assertCountEqual((token_1, token_2), results)<|... |
69990d5dfbf6d1365d7914f4535f2085ab33c82a2a7f91972b6193e6b1509a03 | @autospec('bot.cogs.token_remover', 'LOG_MESSAGE')
def test_format_log_message(self, log_message):
'Should correctly format the log message with info from the message and token.'
token = Token('NDY3MjIzMjMwNjUwNzc3NjQx', 'XsySD_', 's45jqDV_Iisn-symw0yDRrk_jf4')
log_message.format.return_value = 'Howdy'
... | Should correctly format the log message with info from the message and token. | tests/bot/cogs/test_token_remover.py | test_format_log_message | ScarletKing001/bot | 1 | python | @autospec('bot.cogs.token_remover', 'LOG_MESSAGE')
def test_format_log_message(self, log_message):
token = Token('NDY3MjIzMjMwNjUwNzc3NjQx', 'XsySD_', 's45jqDV_Iisn-symw0yDRrk_jf4')
log_message.format.return_value = 'Howdy'
return_value = TokenRemover.format_log_message(self.msg, token)
self.assert... | @autospec('bot.cogs.token_remover', 'LOG_MESSAGE')
def test_format_log_message(self, log_message):
token = Token('NDY3MjIzMjMwNjUwNzc3NjQx', 'XsySD_', 's45jqDV_Iisn-symw0yDRrk_jf4')
log_message.format.return_value = 'Howdy'
return_value = TokenRemover.format_log_message(self.msg, token)
self.assert... |
d040a7c5b48b4e8b6cc6afb4073f4e06ae2f02c3984e514274fde2e35e614d4c | @mock.patch.object(TokenRemover, 'mod_log', new_callable=mock.PropertyMock)
@autospec('bot.cogs.token_remover', 'log')
@autospec(TokenRemover, 'format_log_message')
async def test_take_action(self, format_log_message, logger, mod_log_property):
'Should delete the message and send a mod log.'
cog = TokenRemover(... | Should delete the message and send a mod log. | tests/bot/cogs/test_token_remover.py | test_take_action | ScarletKing001/bot | 1 | python | @mock.patch.object(TokenRemover, 'mod_log', new_callable=mock.PropertyMock)
@autospec('bot.cogs.token_remover', 'log')
@autospec(TokenRemover, 'format_log_message')
async def test_take_action(self, format_log_message, logger, mod_log_property):
cog = TokenRemover(self.bot)
mod_log = mock.create_autospec(Mo... | @mock.patch.object(TokenRemover, 'mod_log', new_callable=mock.PropertyMock)
@autospec('bot.cogs.token_remover', 'log')
@autospec(TokenRemover, 'format_log_message')
async def test_take_action(self, format_log_message, logger, mod_log_property):
cog = TokenRemover(self.bot)
mod_log = mock.create_autospec(Mo... |
5dfb396e198ebbbe26ddb3b057fcb5ed301d087178231403b09cd6045b09bf8c | @mock.patch.object(TokenRemover, 'mod_log', new_callable=mock.PropertyMock)
async def test_take_action_delete_failure(self, mod_log_property):
"Shouldn't send any messages if the token message can't be deleted."
cog = TokenRemover(self.bot)
mod_log_property.return_value = mock.create_autospec(ModLog, spec_s... | Shouldn't send any messages if the token message can't be deleted. | tests/bot/cogs/test_token_remover.py | test_take_action_delete_failure | ScarletKing001/bot | 1 | python | @mock.patch.object(TokenRemover, 'mod_log', new_callable=mock.PropertyMock)
async def test_take_action_delete_failure(self, mod_log_property):
cog = TokenRemover(self.bot)
mod_log_property.return_value = mock.create_autospec(ModLog, spec_set=True, instance=True)
self.msg.delete.side_effect = NotFound(M... | @mock.patch.object(TokenRemover, 'mod_log', new_callable=mock.PropertyMock)
async def test_take_action_delete_failure(self, mod_log_property):
cog = TokenRemover(self.bot)
mod_log_property.return_value = mock.create_autospec(ModLog, spec_set=True, instance=True)
self.msg.delete.side_effect = NotFound(M... |
7088b68d9a0dee89d0931a68e9176875f86d56d80be4d804ecf3e825961e7c66 | @autospec('bot.cogs.token_remover', 'TokenRemover')
def test_extension_setup(self, cog):
'The TokenRemover cog should be added.'
bot = MockBot()
token_remover.setup(bot)
cog.assert_called_once_with(bot)
bot.add_cog.assert_called_once()
self.assertTrue(isinstance(bot.add_cog.call_args.args[0], To... | The TokenRemover cog should be added. | tests/bot/cogs/test_token_remover.py | test_extension_setup | ScarletKing001/bot | 1 | python | @autospec('bot.cogs.token_remover', 'TokenRemover')
def test_extension_setup(self, cog):
bot = MockBot()
token_remover.setup(bot)
cog.assert_called_once_with(bot)
bot.add_cog.assert_called_once()
self.assertTrue(isinstance(bot.add_cog.call_args.args[0], TokenRemover)) | @autospec('bot.cogs.token_remover', 'TokenRemover')
def test_extension_setup(self, cog):
bot = MockBot()
token_remover.setup(bot)
cog.assert_called_once_with(bot)
bot.add_cog.assert_called_once()
self.assertTrue(isinstance(bot.add_cog.call_args.args[0], TokenRemover))<|docstring|>The TokenRemov... |
45f47acb38e5eb4929e93eb34efc9bc1afd0a680e53f2d2720f633f2375854aa | @property
def name(self):
'Name of filter service.'
return 'FilterService' | Name of filter service. | SLpackage/private/pacbio/pythonpkgs/pbalign/lib/python2.7/site-packages/pbalign/filterservice.py | name | fanglab/6mASCOPE | 5 | python | @property
def name(self):
return 'FilterService' | @property
def name(self):
return 'FilterService'<|docstring|>Name of filter service.<|endoftext|> |
c231337084ec02c01b365a19881036c016d55cc649414ed6f7ab8fd009d86f1b | @property
def progName(self):
'Program to call.'
return 'samFilter' | Program to call. | SLpackage/private/pacbio/pythonpkgs/pbalign/lib/python2.7/site-packages/pbalign/filterservice.py | progName | fanglab/6mASCOPE | 5 | python | @property
def progName(self):
return 'samFilter' | @property
def progName(self):
return 'samFilter'<|docstring|>Program to call.<|endoftext|> |
698283b89c0d8fe6ba96566cbce1e68501ca76babc4bc752bcdb9964d87d2555 | def __init__(self, inSamFile, refFile, outSamFile, alignerName, scoreSign, options, adapterGffFile=None):
'Initialize a FilterService object.\n Input:\n inSamFile: an input SAM/BAM file\n refFile : the reference FASTA file\n outSAM : an output SAM/BAM file\... | Initialize a FilterService object.
Input:
inSamFile: an input SAM/BAM file
refFile : the reference FASTA file
outSAM : an output SAM/BAM file
alnServiceName: the name of the align service
scoreSign: score sign of the aligner, can be -1 or 1
options : pbalign options
adapterGffFile: a GFF... | SLpackage/private/pacbio/pythonpkgs/pbalign/lib/python2.7/site-packages/pbalign/filterservice.py | __init__ | fanglab/6mASCOPE | 5 | python | def __init__(self, inSamFile, refFile, outSamFile, alignerName, scoreSign, options, adapterGffFile=None):
'Initialize a FilterService object.\n Input:\n inSamFile: an input SAM/BAM file\n refFile : the reference FASTA file\n outSAM : an output SAM/BAM file\... | def __init__(self, inSamFile, refFile, outSamFile, alignerName, scoreSign, options, adapterGffFile=None):
'Initialize a FilterService object.\n Input:\n inSamFile: an input SAM/BAM file\n refFile : the reference FASTA file\n outSAM : an output SAM/BAM file\... |
ef236306cf6af93f749124ba0e1def1cf5a87e7f13f8109417efde6c7fdf1302 | @property
def cmd(self):
'String of a command-line to execute.'
return self._toCmd(self.inSamFile, self.refFile, self.outSamFile, self.alignerName, self.scoreSign, self.options, self.adapterGffFile) | String of a command-line to execute. | SLpackage/private/pacbio/pythonpkgs/pbalign/lib/python2.7/site-packages/pbalign/filterservice.py | cmd | fanglab/6mASCOPE | 5 | python | @property
def cmd(self):
return self._toCmd(self.inSamFile, self.refFile, self.outSamFile, self.alignerName, self.scoreSign, self.options, self.adapterGffFile) | @property
def cmd(self):
return self._toCmd(self.inSamFile, self.refFile, self.outSamFile, self.alignerName, self.scoreSign, self.options, self.adapterGffFile)<|docstring|>String of a command-line to execute.<|endoftext|> |
6ab56f262643e3377ad1c25f7dd29c299db8a119b2f92d2efa878931d4767462 | def _toCmd(self, inSamFile, refFile, outSamFile, alignerName, scoreSign, options, adapterGffFile):
' Generate a samFilter command line from options.\n Input:\n inSamFile : the input SAM file\n refFile : the reference FASTA file\n outSamFile: the output SAM f... | Generate a samFilter command line from options.
Input:
inSamFile : the input SAM file
refFile : the reference FASTA file
outSamFile: the output SAM file
alignerName: aligner service name
scoreSign : score sign, can be -1 or 1
options : argument options
Output:
a command-line string | SLpackage/private/pacbio/pythonpkgs/pbalign/lib/python2.7/site-packages/pbalign/filterservice.py | _toCmd | fanglab/6mASCOPE | 5 | python | def _toCmd(self, inSamFile, refFile, outSamFile, alignerName, scoreSign, options, adapterGffFile):
' Generate a samFilter command line from options.\n Input:\n inSamFile : the input SAM file\n refFile : the reference FASTA file\n outSamFile: the output SAM f... | def _toCmd(self, inSamFile, refFile, outSamFile, alignerName, scoreSign, options, adapterGffFile):
' Generate a samFilter command line from options.\n Input:\n inSamFile : the input SAM file\n refFile : the reference FASTA file\n outSamFile: the output SAM f... |
52fb2999f10caed903d46bb8322019cce5064047df4bedfcb722c85264c70c63 | def run(self):
' Run the filter service. '
logging.info((self.name + ': Filter alignments using {0}.'.format(self.progName)))
return self._execute() | Run the filter service. | SLpackage/private/pacbio/pythonpkgs/pbalign/lib/python2.7/site-packages/pbalign/filterservice.py | run | fanglab/6mASCOPE | 5 | python | def run(self):
' '
logging.info((self.name + ': Filter alignments using {0}.'.format(self.progName)))
return self._execute() | def run(self):
' '
logging.info((self.name + ': Filter alignments using {0}.'.format(self.progName)))
return self._execute()<|docstring|>Run the filter service.<|endoftext|> |
525355e361f06ae92fcbe4b24625f72e071a6dac61b9da4eb68f917a6139ad6b | def create_std_type(net, data, name, element='line', overwrite=True):
'\n Creates type data in the type database. The parameters that are used for\n the loadflow have to be at least contained in data. These parameters are:\n - c_nf_per_km, r_ohm_per_km, x_ohm_per_km and max_i_ka (for lines)\n - ... | Creates type data in the type database. The parameters that are used for
the loadflow have to be at least contained in data. These parameters are:
- c_nf_per_km, r_ohm_per_km, x_ohm_per_km and max_i_ka (for lines)
- sn_kva, vn_hv_kv, vn_lv_kv, vsc_percent, vscr_percent, pfe_kw, i0_percent, shift_degree* (for tr... | pandapower/std_types.py | create_std_type | mathildebadoual/pandapower | 1 | python | def create_std_type(net, data, name, element='line', overwrite=True):
'\n Creates type data in the type database. The parameters that are used for\n the loadflow have to be at least contained in data. These parameters are:\n - c_nf_per_km, r_ohm_per_km, x_ohm_per_km and max_i_ka (for lines)\n - ... | def create_std_type(net, data, name, element='line', overwrite=True):
'\n Creates type data in the type database. The parameters that are used for\n the loadflow have to be at least contained in data. These parameters are:\n - c_nf_per_km, r_ohm_per_km, x_ohm_per_km and max_i_ka (for lines)\n - ... |
bd742cd7f340e114433b2a7ad91513cfa037f087a45c6116a8ba91468763cd3e | def create_std_types(net, data, element='line', overwrite=True):
'\n Creates multiple standard types in the type database.\n\n INPUT:\n **net** - The pandapower network\n\n **data** - dictionary of standard type parameter sets\n\n **element** - "line", "trafo" or "trafo3w"\n\n EXAMPLE:... | Creates multiple standard types in the type database.
INPUT:
**net** - The pandapower network
**data** - dictionary of standard type parameter sets
**element** - "line", "trafo" or "trafo3w"
EXAMPLE:
>>> linetypes = {"typ1": {"r_ohm_per_km": 0.01, "x_ohm_per_km": 0.02, "c_nf_per_km": 10, "max_i_ka": 0.... | pandapower/std_types.py | create_std_types | mathildebadoual/pandapower | 1 | python | def create_std_types(net, data, element='line', overwrite=True):
'\n Creates multiple standard types in the type database.\n\n INPUT:\n **net** - The pandapower network\n\n **data** - dictionary of standard type parameter sets\n\n **element** - "line", "trafo" or "trafo3w"\n\n EXAMPLE:... | def create_std_types(net, data, element='line', overwrite=True):
'\n Creates multiple standard types in the type database.\n\n INPUT:\n **net** - The pandapower network\n\n **data** - dictionary of standard type parameter sets\n\n **element** - "line", "trafo" or "trafo3w"\n\n EXAMPLE:... |
6a7b1953d5518877bfeae89cc98b2524c2b8393516e0de7394145dedaea459f1 | def copy_std_types(to_net, from_net, element='line', overwrite=True):
'\n Transfers all standard types of one network to another.\n\n INPUT:\n\n **to_net** - The pandapower network to which the standard types are copied\n\n **from_net** - The pandapower network from which the standard types are ... | Transfers all standard types of one network to another.
INPUT:
**to_net** - The pandapower network to which the standard types are copied
**from_net** - The pandapower network from which the standard types are taken
**element** - "line" or "trafo"
**overwrite** - if True, overwrites standard types ... | pandapower/std_types.py | copy_std_types | mathildebadoual/pandapower | 1 | python | def copy_std_types(to_net, from_net, element='line', overwrite=True):
'\n Transfers all standard types of one network to another.\n\n INPUT:\n\n **to_net** - The pandapower network to which the standard types are copied\n\n **from_net** - The pandapower network from which the standard types are ... | def copy_std_types(to_net, from_net, element='line', overwrite=True):
'\n Transfers all standard types of one network to another.\n\n INPUT:\n\n **to_net** - The pandapower network to which the standard types are copied\n\n **from_net** - The pandapower network from which the standard types are ... |
2ca249577e8d23cc9c7a4d65cac89e75104753b60c89757b443a62e478c26f11 | def load_std_type(net, name, element='line'):
'\n Loads standard type data from the linetypes data base. Issues a warning if\n linetype is unknown.\n\n INPUT:\n **net** - The pandapower network\n\n **name** - name of the standard type as string\n\n **element** - "line", "trafo" or "tra... | Loads standard type data from the linetypes data base. Issues a warning if
linetype is unknown.
INPUT:
**net** - The pandapower network
**name** - name of the standard type as string
**element** - "line", "trafo" or "trafo3w"
OUTPUT:
**typedata** - dictionary containing type data | pandapower/std_types.py | load_std_type | mathildebadoual/pandapower | 1 | python | def load_std_type(net, name, element='line'):
'\n Loads standard type data from the linetypes data base. Issues a warning if\n linetype is unknown.\n\n INPUT:\n **net** - The pandapower network\n\n **name** - name of the standard type as string\n\n **element** - "line", "trafo" or "tra... | def load_std_type(net, name, element='line'):
'\n Loads standard type data from the linetypes data base. Issues a warning if\n linetype is unknown.\n\n INPUT:\n **net** - The pandapower network\n\n **name** - name of the standard type as string\n\n **element** - "line", "trafo" or "tra... |
c42dc4aa941918d2864d2bfc37a205cf8ddbf3ad777c2d1addb875e35339c64f | def std_type_exists(net, name, element='line'):
'\n Checks if a standard type exists.\n\n INPUT:\n **net** - pandapower Network\n\n **name** - name of the standard type as string\n\n **element** - type of element ("line" or "trafo")\n\n OUTPUT:\n **exists** - True if standard ty... | Checks if a standard type exists.
INPUT:
**net** - pandapower Network
**name** - name of the standard type as string
**element** - type of element ("line" or "trafo")
OUTPUT:
**exists** - True if standard type exists, False otherwise | pandapower/std_types.py | std_type_exists | mathildebadoual/pandapower | 1 | python | def std_type_exists(net, name, element='line'):
'\n Checks if a standard type exists.\n\n INPUT:\n **net** - pandapower Network\n\n **name** - name of the standard type as string\n\n **element** - type of element ("line" or "trafo")\n\n OUTPUT:\n **exists** - True if standard ty... | def std_type_exists(net, name, element='line'):
'\n Checks if a standard type exists.\n\n INPUT:\n **net** - pandapower Network\n\n **name** - name of the standard type as string\n\n **element** - type of element ("line" or "trafo")\n\n OUTPUT:\n **exists** - True if standard ty... |
8b9502a71dde6ef8d0bb739d706859fe0e8d21e8a82d4ea56696b5c49f8899ff | def delete_std_type(net, name, element='line'):
'\n Deletes standard type parameters from database.\n\n INPUT:\n **net** - pandapower Network\n\n **name** - name of the standard type as string\n\n **element** - type of element ("line" or "trafo")\n\n '
library = net.std_types[eleme... | Deletes standard type parameters from database.
INPUT:
**net** - pandapower Network
**name** - name of the standard type as string
**element** - type of element ("line" or "trafo") | pandapower/std_types.py | delete_std_type | mathildebadoual/pandapower | 1 | python | def delete_std_type(net, name, element='line'):
'\n Deletes standard type parameters from database.\n\n INPUT:\n **net** - pandapower Network\n\n **name** - name of the standard type as string\n\n **element** - type of element ("line" or "trafo")\n\n '
library = net.std_types[eleme... | def delete_std_type(net, name, element='line'):
'\n Deletes standard type parameters from database.\n\n INPUT:\n **net** - pandapower Network\n\n **name** - name of the standard type as string\n\n **element** - type of element ("line" or "trafo")\n\n '
library = net.std_types[eleme... |
94114f972fd6bdac3a477faaed297927d6d6e2c645203aca0f2e82f953feea4b | def available_std_types(net, element='line'):
'\n Returns all standard types available for this network as a table.\n\n INPUT:\n **net** - pandapower Network\n\n **element** - type of element ("line" or "trafo")\n\n OUTPUT:\n **typedata** - table of standard type parameters\n\n '
... | Returns all standard types available for this network as a table.
INPUT:
**net** - pandapower Network
**element** - type of element ("line" or "trafo")
OUTPUT:
**typedata** - table of standard type parameters | pandapower/std_types.py | available_std_types | mathildebadoual/pandapower | 1 | python | def available_std_types(net, element='line'):
'\n Returns all standard types available for this network as a table.\n\n INPUT:\n **net** - pandapower Network\n\n **element** - type of element ("line" or "trafo")\n\n OUTPUT:\n **typedata** - table of standard type parameters\n\n '
... | def available_std_types(net, element='line'):
'\n Returns all standard types available for this network as a table.\n\n INPUT:\n **net** - pandapower Network\n\n **element** - type of element ("line" or "trafo")\n\n OUTPUT:\n **typedata** - table of standard type parameters\n\n '
... |
baeb705d0d0b2b1fda18201318c964a96ba592b17397f81e91b97c60a5ae6bc7 | def parameter_from_std_type(net, parameter, element='line', fill=None):
'\n Loads standard types data for a parameter, which can be used to add an additional parameter,\n that is not included in the original pandapower datastructure but is available in the standard\n type database.\n\n INPUT:\n *... | Loads standard types data for a parameter, which can be used to add an additional parameter,
that is not included in the original pandapower datastructure but is available in the standard
type database.
INPUT:
**net** - pandapower network
**parameter** - name of parameter as string
**element** - type of ... | pandapower/std_types.py | parameter_from_std_type | mathildebadoual/pandapower | 1 | python | def parameter_from_std_type(net, parameter, element='line', fill=None):
'\n Loads standard types data for a parameter, which can be used to add an additional parameter,\n that is not included in the original pandapower datastructure but is available in the standard\n type database.\n\n INPUT:\n *... | def parameter_from_std_type(net, parameter, element='line', fill=None):
'\n Loads standard types data for a parameter, which can be used to add an additional parameter,\n that is not included in the original pandapower datastructure but is available in the standard\n type database.\n\n INPUT:\n *... |
db512388782214e7999dafe32c0e4afe54ff607cea210bb890a1845d77076659 | def change_std_type(net, eid, name, element='line'):
'\n Changes the type of a given element in pandapower. Changes only parameter that are given\n for the type.\n\n INPUT:\n **net** - pandapower network\n\n **eid** - element index (either line or transformer index)\n\n **element** - t... | Changes the type of a given element in pandapower. Changes only parameter that are given
for the type.
INPUT:
**net** - pandapower network
**eid** - element index (either line or transformer index)
**element** - type of element ("line" or "trafo")
**name** - name of the new standard type | pandapower/std_types.py | change_std_type | mathildebadoual/pandapower | 1 | python | def change_std_type(net, eid, name, element='line'):
'\n Changes the type of a given element in pandapower. Changes only parameter that are given\n for the type.\n\n INPUT:\n **net** - pandapower network\n\n **eid** - element index (either line or transformer index)\n\n **element** - t... | def change_std_type(net, eid, name, element='line'):
'\n Changes the type of a given element in pandapower. Changes only parameter that are given\n for the type.\n\n INPUT:\n **net** - pandapower network\n\n **eid** - element index (either line or transformer index)\n\n **element** - t... |
179e0c199e218a82c274d258350d749b6b496c727dcea22b4ff31601fd08e6de | def find_std_type_by_parameter(net, data, element='line', epsilon=0.0):
'\n Searches for a std_type that fits all values given in the data dictionary with the margin of\n epsilon.\n\n INPUT:\n **net** - pandapower network\n\n **data** - dictionary of standard type parameters\n\n **elem... | Searches for a std_type that fits all values given in the data dictionary with the margin of
epsilon.
INPUT:
**net** - pandapower network
**data** - dictionary of standard type parameters
**element** - type of element ("line" or "trafo")
**epsilon** - tolerance margin for parameter comparison
OUTPU... | pandapower/std_types.py | find_std_type_by_parameter | mathildebadoual/pandapower | 1 | python | def find_std_type_by_parameter(net, data, element='line', epsilon=0.0):
'\n Searches for a std_type that fits all values given in the data dictionary with the margin of\n epsilon.\n\n INPUT:\n **net** - pandapower network\n\n **data** - dictionary of standard type parameters\n\n **elem... | def find_std_type_by_parameter(net, data, element='line', epsilon=0.0):
'\n Searches for a std_type that fits all values given in the data dictionary with the margin of\n epsilon.\n\n INPUT:\n **net** - pandapower network\n\n **data** - dictionary of standard type parameters\n\n **elem... |
3386c777ed1e68fc1720ce901714f87bb0915c371ff1186679f28f8529d222c1 | def add_zero_impedance_parameters(net):
'\n adds all parameters required for zero impedance calculations\n '
parameter_from_std_type(net, 'vector_group', element='trafo')
parameter_from_std_type(net, 'vsc0_percent', element='trafo')
parameter_from_std_type(net, 'vscr0_percent', element='trafo')
... | adds all parameters required for zero impedance calculations | pandapower/std_types.py | add_zero_impedance_parameters | mathildebadoual/pandapower | 1 | python | def add_zero_impedance_parameters(net):
'\n \n '
parameter_from_std_type(net, 'vector_group', element='trafo')
parameter_from_std_type(net, 'vsc0_percent', element='trafo')
parameter_from_std_type(net, 'vscr0_percent', element='trafo')
parameter_from_std_type(net, 'mag0_percent', element='traf... | def add_zero_impedance_parameters(net):
'\n \n '
parameter_from_std_type(net, 'vector_group', element='trafo')
parameter_from_std_type(net, 'vsc0_percent', element='trafo')
parameter_from_std_type(net, 'vscr0_percent', element='trafo')
parameter_from_std_type(net, 'mag0_percent', element='traf... |
b4528c3f0add44faee39a192d50622cb102409952a1cd401e11067380075f4b0 | def close(event):
' If the user closes one of the figure windows, the program is terminated.\n\n Args:\n event (matplotlib.backend_bases.CloseEvent): The event that was triggered by a figure being closed.\n '
exit(0) | If the user closes one of the figure windows, the program is terminated.
Args:
event (matplotlib.backend_bases.CloseEvent): The event that was triggered by a figure being closed. | code/plot_results.py | close | Roboskel-Manipulation/object_size_prediction | 0 | python | def close(event):
' If the user closes one of the figure windows, the program is terminated.\n\n Args:\n event (matplotlib.backend_bases.CloseEvent): The event that was triggered by a figure being closed.\n '
exit(0) | def close(event):
' If the user closes one of the figure windows, the program is terminated.\n\n Args:\n event (matplotlib.backend_bases.CloseEvent): The event that was triggered by a figure being closed.\n '
exit(0)<|docstring|>If the user closes one of the figure windows, the program is terminate... |
591b20c89e7a2d09fbbabeb7f00b8998aa31d2906a7551d8b8d69272e1a1e8ff | def press_key(event):
" Identify which key the user pressed while one of the figures was the active window.\n The 'up' and 'down' arrow keys are used to change the feature set for which the figures are plotted.\n The 'right' and 'left' arrow keys are used to change the model for which the figures are ... | Identify which key the user pressed while one of the figures was the active window.
The 'up' and 'down' arrow keys are used to change the feature set for which the figures are plotted.
The 'right' and 'left' arrow keys are used to change the model for which the figures are plotted.
The 'esc' key is used to ... | code/plot_results.py | press_key | Roboskel-Manipulation/object_size_prediction | 0 | python | def press_key(event):
" Identify which key the user pressed while one of the figures was the active window.\n The 'up' and 'down' arrow keys are used to change the feature set for which the figures are plotted.\n The 'right' and 'left' arrow keys are used to change the model for which the figures are ... | def press_key(event):
" Identify which key the user pressed while one of the figures was the active window.\n The 'up' and 'down' arrow keys are used to change the feature set for which the figures are plotted.\n The 'right' and 'left' arrow keys are used to change the model for which the figures are ... |
597233a92d91e0fe885ffcc93fb30feac738d75f26939cecc9462c99dd994c84 | def update_featimp_plot(feat_imp_dict, strategy, fsid):
" The feature imporances of the ExtraTrees model are plotted in the same figure for the given dataset split strategy, the given feature set and for each of the 20%, 40%, 60%, 80% and 100% movement completion \n percentages. \n\n Args:\n feat_i... | The feature imporances of the ExtraTrees model are plotted in the same figure for the given dataset split strategy, the given feature set and for each of the 20%, 40%, 60%, 80% and 100% movement completion
percentages.
Args:
feat_imp_dict (dictionary): A 2-level dictionary with a feature set id as the 1st-le... | code/plot_results.py | update_featimp_plot | Roboskel-Manipulation/object_size_prediction | 0 | python | def update_featimp_plot(feat_imp_dict, strategy, fsid):
" The feature imporances of the ExtraTrees model are plotted in the same figure for the given dataset split strategy, the given feature set and for each of the 20%, 40%, 60%, 80% and 100% movement completion \n percentages. \n\n Args:\n feat_i... | def update_featimp_plot(feat_imp_dict, strategy, fsid):
" The feature imporances of the ExtraTrees model are plotted in the same figure for the given dataset split strategy, the given feature set and for each of the 20%, 40%, 60%, 80% and 100% movement completion \n percentages. \n\n Args:\n feat_i... |
28e0986160b5ea3c69b60c6c4b8086625ee99331c8b9cfc01bba9b6934506b10 | def update_accuracies_plot(acc_dict, strategy, fsid, methods):
" The average accuracies of all the given models are plotted in the same figure for the given dataset split strategy, the given feature set and for each of the 20%, 40%, 60%, 80% and 100% movement completion\n percentages.\n\n Args:\n a... | The average accuracies of all the given models are plotted in the same figure for the given dataset split strategy, the given feature set and for each of the 20%, 40%, 60%, 80% and 100% movement completion
percentages.
Args:
acc_dict (dictionary): A 3-level dictionary with a feature set id as the 1st-level key... | code/plot_results.py | update_accuracies_plot | Roboskel-Manipulation/object_size_prediction | 0 | python | def update_accuracies_plot(acc_dict, strategy, fsid, methods):
" The average accuracies of all the given models are plotted in the same figure for the given dataset split strategy, the given feature set and for each of the 20%, 40%, 60%, 80% and 100% movement completion\n percentages.\n\n Args:\n a... | def update_accuracies_plot(acc_dict, strategy, fsid, methods):
" The average accuracies of all the given models are plotted in the same figure for the given dataset split strategy, the given feature set and for each of the 20%, 40%, 60%, 80% and 100% movement completion\n percentages.\n\n Args:\n a... |
6f6bdac289c803be92b4f42510756add332d9dc9e956a2c82c09156234755cd0 | def update_confmtx_plot(conf_mtx_dict, strategy, fsid, method):
" The confusion matrices of the given model are plotted in the same figure for the given dataset split strategy, the given feature set and for each of the 20%, 40%, 60%, 80% and 100% movement completion\n percentages.\n\n Args:\n conf_... | The confusion matrices of the given model are plotted in the same figure for the given dataset split strategy, the given feature set and for each of the 20%, 40%, 60%, 80% and 100% movement completion
percentages.
Args:
conf_mtx_dict (dictionary): A 3-level dictionary with a feature set id as the 1st-level key... | code/plot_results.py | update_confmtx_plot | Roboskel-Manipulation/object_size_prediction | 0 | python | def update_confmtx_plot(conf_mtx_dict, strategy, fsid, method):
" The confusion matrices of the given model are plotted in the same figure for the given dataset split strategy, the given feature set and for each of the 20%, 40%, 60%, 80% and 100% movement completion\n percentages.\n\n Args:\n conf_... | def update_confmtx_plot(conf_mtx_dict, strategy, fsid, method):
" The confusion matrices of the given model are plotted in the same figure for the given dataset split strategy, the given feature set and for each of the 20%, 40%, 60%, 80% and 100% movement completion\n percentages.\n\n Args:\n conf_... |
ec62f2a16f96eeea0580f3e447b4606894b2d801ff6dc5ac7b2b2a4cc27a5440 | def plot_results(acc_dict, conf_mtx_dict, feat_imp_dict, strategy, fs_ids, methods):
" Plot the accuracies and the confusion matrices interactively.\n The user can select the feature set and the model name for which the results are plotted. \n\n Args:\n acc_dict (dictionary): A 3-level dictionary w... | Plot the accuracies and the confusion matrices interactively.
The user can select the feature set and the model name for which the results are plotted.
Args:
acc_dict (dictionary): A 3-level dictionary with a feature set id as the 1st-level key, a movement completion percentage as the 2nd-level key and a meth... | code/plot_results.py | plot_results | Roboskel-Manipulation/object_size_prediction | 0 | python | def plot_results(acc_dict, conf_mtx_dict, feat_imp_dict, strategy, fs_ids, methods):
" Plot the accuracies and the confusion matrices interactively.\n The user can select the feature set and the model name for which the results are plotted. \n\n Args:\n acc_dict (dictionary): A 3-level dictionary w... | def plot_results(acc_dict, conf_mtx_dict, feat_imp_dict, strategy, fs_ids, methods):
" Plot the accuracies and the confusion matrices interactively.\n The user can select the feature set and the model name for which the results are plotted. \n\n Args:\n acc_dict (dictionary): A 3-level dictionary w... |
5b6572b031bd1ab73a71e480592d00fbdf64bf2de77b2db9215e60da7c3ec53d | def numUniqueEmails(self, emails: List[str]) -> int:
'\n stemming\n '
s = set()
for e in emails:
(local, domain) = e.split('@')
local = self.stem(local)
s.add((local, domain))
return len(s) | stemming | 929 Unique Email Addresses.py | numUniqueEmails | scorpionpd/LeetCode-all | 872 | python | def numUniqueEmails(self, emails: List[str]) -> int:
'\n \n '
s = set()
for e in emails:
(local, domain) = e.split('@')
local = self.stem(local)
s.add((local, domain))
return len(s) | def numUniqueEmails(self, emails: List[str]) -> int:
'\n \n '
s = set()
for e in emails:
(local, domain) = e.split('@')
local = self.stem(local)
s.add((local, domain))
return len(s)<|docstring|>stemming<|endoftext|> |
73fc31f9b1b2c15d13832a5f68f8dde4c9f548e6d1de6991d2ba3210c65fea96 | def get_flat_incdirs(self):
'return a flat include directories *generator*, only return flat values of self.inc_dirs'
fm = flat_map((lambda x: x), self.inc_dirs.values())
return fm | return a flat include directories *generator*, only return flat values of self.inc_dirs | enzi/file_manager.py | get_flat_incdirs | Yummot/enzi | 1 | python | def get_flat_incdirs(self):
fm = flat_map((lambda x: x), self.inc_dirs.values())
return fm | def get_flat_incdirs(self):
fm = flat_map((lambda x: x), self.inc_dirs.values())
return fm<|docstring|>return a flat include directories *generator*, only return flat values of self.inc_dirs<|endoftext|> |
0c109e7a34a6c36a7f14e711a0c785a1b9976ad2586021cd886c8176179f876e | def dedup(self):
'dedup files which are include files'
self.files -= self.inc_files
self.inc_files = set() | dedup files which are include files | enzi/file_manager.py | dedup | Yummot/enzi | 1 | python | def dedup(self):
self.files -= self.inc_files
self.inc_files = set() | def dedup(self):
self.files -= self.inc_files
self.inc_files = set()<|docstring|>dedup files which are include files<|endoftext|> |
5a50f242f3a893456169fce72bda805e23d1e50d4c9f8d982a7cef2b6be2c01f | def merge_into(self, other):
'merge into a new Fileset'
if (not isinstance(other, Fileset)):
raise ValueError('cannot merge a not Fileset object')
ret = Fileset()
ret.files = (self.files | other.files)
ret.inc_dirs.update(self.inc_dirs)
ret.inc_dirs.update(other.inc_dirs)
ret.inc_fil... | merge into a new Fileset | enzi/file_manager.py | merge_into | Yummot/enzi | 1 | python | def merge_into(self, other):
if (not isinstance(other, Fileset)):
raise ValueError('cannot merge a not Fileset object')
ret = Fileset()
ret.files = (self.files | other.files)
ret.inc_dirs.update(self.inc_dirs)
ret.inc_dirs.update(other.inc_dirs)
ret.inc_files = (self.inc_files | oth... | def merge_into(self, other):
if (not isinstance(other, Fileset)):
raise ValueError('cannot merge a not Fileset object')
ret = Fileset()
ret.files = (self.files | other.files)
ret.inc_dirs.update(self.inc_dirs)
ret.inc_dirs.update(other.inc_dirs)
ret.inc_files = (self.inc_files | oth... |
7facfc04cb2e027e79d1dde256b40449c09e624bd6db6ef69729926ce799b427 | def check_include_files(self, files_root, *, clogger=None):
'check all include files will full paths. Internal use only.'
if (clogger is None):
clogger = logger
for file in self.fileset.files:
dirname = os.path.dirname(file)
include_files = list(self.get_include_files(file))
... | check all include files will full paths. Internal use only. | enzi/file_manager.py | check_include_files | Yummot/enzi | 1 | python | def check_include_files(self, files_root, *, clogger=None):
if (clogger is None):
clogger = logger
for file in self.fileset.files:
dirname = os.path.dirname(file)
include_files = list(self.get_include_files(file))
if (not include_files):
continue
for incl... | def check_include_files(self, files_root, *, clogger=None):
if (clogger is None):
clogger = logger
for file in self.fileset.files:
dirname = os.path.dirname(file)
include_files = list(self.get_include_files(file))
if (not include_files):
continue
for incl... |
4afc162df80bc0bce8ceba9ebe148d940272688b952c668bb2e8eae339322e9f | def get_include_files(self, file):
'return a iterator of include files of the given file'
with open(file, 'rb') as f:
data = f.read().decode('utf-8')
lines = data.splitlines()
m = map(str.strip, lines)
ft = filter((lambda x: x.startswith('`include')), m)
ex = map((lambda ... | return a iterator of include files of the given file | enzi/file_manager.py | get_include_files | Yummot/enzi | 1 | python | def get_include_files(self, file):
with open(file, 'rb') as f:
data = f.read().decode('utf-8')
lines = data.splitlines()
m = map(str.strip, lines)
ft = filter((lambda x: x.startswith('`include')), m)
ex = map((lambda x: RE.search(x).group(1)), ft)
return ex | def get_include_files(self, file):
with open(file, 'rb') as f:
data = f.read().decode('utf-8')
lines = data.splitlines()
m = map(str.strip, lines)
ft = filter((lambda x: x.startswith('`include')), m)
ex = map((lambda x: RE.search(x).group(1)), ft)
return ex<|docs... |
10de169e016eca5ee6f7a4464cc1dab311b63bfdaf778480623a92e8c6a633a3 | def checkout(self):
'\n method to support caching remote project files\n '
pass | method to support caching remote project files | enzi/file_manager.py | checkout | Yummot/enzi | 1 | python | def checkout(self):
'\n \n '
pass | def checkout(self):
'\n \n '
pass<|docstring|>method to support caching remote project files<|endoftext|> |
17e71ecf9b68bbfddff867b6f9eb8f84d81f46cc205b68d9a5b4324fa493cdcb | def fetch(self):
'\n method to make files cache\n '
pass | method to make files cache | enzi/file_manager.py | fetch | Yummot/enzi | 1 | python | def fetch(self):
'\n \n '
pass | def fetch(self):
'\n \n '
pass<|docstring|>method to make files cache<|endoftext|> |
99b59a29902665a2de45ff5b6cc4fba56bb469249c5379dd3693ba666e20d664 | def cached_fileset(self):
'return a Fileset object containing the cached fileset'
if (self.status != FileManagerStatus.FETCHED):
self.fetch()
ret = self.resolver.resolve()
if FM_DEBUG:
pfmt = pprint.pformat(ret.dump_dict())
logger.info('cached fileset: \n{}'.format(pfmt))
ret... | return a Fileset object containing the cached fileset | enzi/file_manager.py | cached_fileset | Yummot/enzi | 1 | python | def cached_fileset(self):
if (self.status != FileManagerStatus.FETCHED):
self.fetch()
ret = self.resolver.resolve()
if FM_DEBUG:
pfmt = pprint.pformat(ret.dump_dict())
logger.info('cached fileset: \n{}'.format(pfmt))
return ret | def cached_fileset(self):
if (self.status != FileManagerStatus.FETCHED):
self.fetch()
ret = self.resolver.resolve()
if FM_DEBUG:
pfmt = pprint.pformat(ret.dump_dict())
logger.info('cached fileset: \n{}'.format(pfmt))
return ret<|docstring|>return a Fileset object containing ... |
1e9b170789afc31fa967847ddd872f390a4765cfb29e1c80cb1dcf7a0386d992 | def reshape_img_from_float(image, width, height):
'\n A helper method to denormalize and reshape previously saved image, turning it\n from float32 in [0,1] to grayscale uint8 in [0,255] and reshaping it to\n given dimensions for further processing.\n\n Arguments:\n image: A numpy array representi... | A helper method to denormalize and reshape previously saved image, turning it
from float32 in [0,1] to grayscale uint8 in [0,255] and reshaping it to
given dimensions for further processing.
Arguments:
image: A numpy array representing a 2D image, should be normalized.
width: Integer, desired width dimension.
... | granulo_utils.py | reshape_img_from_float | Midoriii/Anomaly_Detection_Diploma | 0 | python | def reshape_img_from_float(image, width, height):
'\n A helper method to denormalize and reshape previously saved image, turning it\n from float32 in [0,1] to grayscale uint8 in [0,255] and reshaping it to\n given dimensions for further processing.\n\n Arguments:\n image: A numpy array representi... | def reshape_img_from_float(image, width, height):
'\n A helper method to denormalize and reshape previously saved image, turning it\n from float32 in [0,1] to grayscale uint8 in [0,255] and reshaping it to\n given dimensions for further processing.\n\n Arguments:\n image: A numpy array representi... |
f306563bc1543c9637a7ad56e3b327697d8a0fdb9e828ad096c1678a3f04c8e4 | def threshold_image(image, threshold):
'\n Method that thresholds given image with binary thresholding, where values\n below given threshold are set to 255 and values above are set to 0. This is\n because granulometry works by counting remaining pixels, and in our data\n the stains that we want to isola... | Method that thresholds given image with binary thresholding, where values
below given threshold are set to 255 and values above are set to 0. This is
because granulometry works by counting remaining pixels, and in our data
the stains that we want to isolate and count are black or dark grey, hence
we need to set them to... | granulo_utils.py | threshold_image | Midoriii/Anomaly_Detection_Diploma | 0 | python | def threshold_image(image, threshold):
'\n Method that thresholds given image with binary thresholding, where values\n below given threshold are set to 255 and values above are set to 0. This is\n because granulometry works by counting remaining pixels, and in our data\n the stains that we want to isola... | def threshold_image(image, threshold):
'\n Method that thresholds given image with binary thresholding, where values\n below given threshold are set to 255 and values above are set to 0. This is\n because granulometry works by counting remaining pixels, and in our data\n the stains that we want to isola... |
90e11870e9074e93f727be56816b4c0551d08834d8d755623d2a86ee4a9e8744 | def adaptive_threshold_image(image, group_size, c):
'\n Adaptive thresholding method using Gaussian as the thresholding method,\n with given blockSize and constant C. Should possibly help\n with different lighting levels of images.\n\n Arguments:\n image: A numpy array representing a 2D image, in... | Adaptive thresholding method using Gaussian as the thresholding method,
with given blockSize and constant C. Should possibly help
with different lighting levels of images.
Arguments:
image: A numpy array representing a 2D image, in grayscale.
group_size: Integer, desired group size as per cv2 adaptive threshol... | granulo_utils.py | adaptive_threshold_image | Midoriii/Anomaly_Detection_Diploma | 0 | python | def adaptive_threshold_image(image, group_size, c):
'\n Adaptive thresholding method using Gaussian as the thresholding method,\n with given blockSize and constant C. Should possibly help\n with different lighting levels of images.\n\n Arguments:\n image: A numpy array representing a 2D image, in... | def adaptive_threshold_image(image, group_size, c):
'\n Adaptive thresholding method using Gaussian as the thresholding method,\n with given blockSize and constant C. Should possibly help\n with different lighting levels of images.\n\n Arguments:\n image: A numpy array representing a 2D image, in... |
2198147bab4342babb76a61c4893283833b9160ce1194e8dcf7bf5641da0200b | def remove_center(image):
'\n Helper function to remove the center 50 by 50 part of images. This is because\n this part contains the central hole that degraded granulometry performance.\n The method expects images of size 768x768, which might be changed in the future.\n\n Arguments:\n image: A nu... | Helper function to remove the center 50 by 50 part of images. This is because
this part contains the central hole that degraded granulometry performance.
The method expects images of size 768x768, which might be changed in the future.
Arguments:
image: A numpy array representing a 2D image with dimensions of 768x7... | granulo_utils.py | remove_center | Midoriii/Anomaly_Detection_Diploma | 0 | python | def remove_center(image):
'\n Helper function to remove the center 50 by 50 part of images. This is because\n this part contains the central hole that degraded granulometry performance.\n The method expects images of size 768x768, which might be changed in the future.\n\n Arguments:\n image: A nu... | def remove_center(image):
'\n Helper function to remove the center 50 by 50 part of images. This is because\n this part contains the central hole that degraded granulometry performance.\n The method expects images of size 768x768, which might be changed in the future.\n\n Arguments:\n image: A nu... |
e4b5ff3fb6e52c5f68dd783eb7822b01a4cc2282920006c2e8920727a7e178cf | def plot_histogram(image):
'\n Just a simple histogram visualisation of a given image. Works in grayscale.\n\n Arguments:\n image: A numpy array representing a 2D image.\n '
hist = cv2.calcHist([image], [0], None, [256], [0, 256])
plt.plot(hist)
plt.xlim([0, 256])
plt.show() | Just a simple histogram visualisation of a given image. Works in grayscale.
Arguments:
image: A numpy array representing a 2D image. | granulo_utils.py | plot_histogram | Midoriii/Anomaly_Detection_Diploma | 0 | python | def plot_histogram(image):
'\n Just a simple histogram visualisation of a given image. Works in grayscale.\n\n Arguments:\n image: A numpy array representing a 2D image.\n '
hist = cv2.calcHist([image], [0], None, [256], [0, 256])
plt.plot(hist)
plt.xlim([0, 256])
plt.show() | def plot_histogram(image):
'\n Just a simple histogram visualisation of a given image. Works in grayscale.\n\n Arguments:\n image: A numpy array representing a 2D image.\n '
hist = cv2.calcHist([image], [0], None, [256], [0, 256])
plt.plot(hist)
plt.xlim([0, 256])
plt.show()<|docstri... |
78c50dce39d1bc5069d3f7978800d14353ff310f7b25f022be136a8a0152417c | def show_opening(image, opening_element, label=''):
"\n A visualising method that shows the original thresholded image and the result\n of binary opening with given element on the picture.\n\n Arguments:\n image: A preferably thresholded image on which the opening will be performed,\n given a... | A visualising method that shows the original thresholded image and the result
of binary opening with given element on the picture.
Arguments:
image: A preferably thresholded image on which the opening will be performed,
given as a numpy array.
opening_element: Array of 0s and 1s representing the element wi... | granulo_utils.py | show_opening | Midoriii/Anomaly_Detection_Diploma | 0 | python | def show_opening(image, opening_element, label=):
"\n A visualising method that shows the original thresholded image and the result\n of binary opening with given element on the picture.\n\n Arguments:\n image: A preferably thresholded image on which the opening will be performed,\n given as ... | def show_opening(image, opening_element, label=):
"\n A visualising method that shows the original thresholded image and the result\n of binary opening with given element on the picture.\n\n Arguments:\n image: A preferably thresholded image on which the opening will be performed,\n given as ... |
1a2dba1de0e68c5626c69bcb6c29bb48a2f4793e7de1f9ea016ec57cd1585326 | def granulometry_score(image, opening_element):
"\n Performs binary opening on given image and afterwards sums up the pixels.\n Binary opening returns only 0s and 1s (False and True), so by simply\n summing the pixels one can get a sort of 'score' of how much of the picture\n remained after performing o... | Performs binary opening on given image and afterwards sums up the pixels.
Binary opening returns only 0s and 1s (False and True), so by simply
summing the pixels one can get a sort of 'score' of how much of the picture
remained after performing opening.
Arguments:
image: A numpy array representing a 2D image.
... | granulo_utils.py | granulometry_score | Midoriii/Anomaly_Detection_Diploma | 0 | python | def granulometry_score(image, opening_element):
"\n Performs binary opening on given image and afterwards sums up the pixels.\n Binary opening returns only 0s and 1s (False and True), so by simply\n summing the pixels one can get a sort of 'score' of how much of the picture\n remained after performing o... | def granulometry_score(image, opening_element):
"\n Performs binary opening on given image and afterwards sums up the pixels.\n Binary opening returns only 0s and 1s (False and True), so by simply\n summing the pixels one can get a sort of 'score' of how much of the picture\n remained after performing o... |
a9f8b6926cebdf0cd92c190832680da7277e965f025184cb8d1591b70604b72e | def perform_binary_granulometry(image, width, height, threshold, opening_element):
'\n Performs whole granulometry with binary thresholding using functions\n defined earlier in this module.\n\n Arguments:\n image: A numpy array of float32 [0,1] values representing an image.\n width: Original ... | Performs whole granulometry with binary thresholding using functions
defined earlier in this module.
Arguments:
image: A numpy array of float32 [0,1] values representing an image.
width: Original width dimension of the image.
height: Original height dimension of the image.
threshold: A value representi... | granulo_utils.py | perform_binary_granulometry | Midoriii/Anomaly_Detection_Diploma | 0 | python | def perform_binary_granulometry(image, width, height, threshold, opening_element):
'\n Performs whole granulometry with binary thresholding using functions\n defined earlier in this module.\n\n Arguments:\n image: A numpy array of float32 [0,1] values representing an image.\n width: Original ... | def perform_binary_granulometry(image, width, height, threshold, opening_element):
'\n Performs whole granulometry with binary thresholding using functions\n defined earlier in this module.\n\n Arguments:\n image: A numpy array of float32 [0,1] values representing an image.\n width: Original ... |
f1bc4d8aba820fb1f38463ed66dcee57714f57327574bd85e6cd4fae63570c17 | def add_character(self, character: str, speaking=True) -> Optional[int]:
'\n\t\t:param character: name\n\t\t:param speaking: whether found in quote or stand-alone\n\t\t:return: None if character is ignored\n\t\t'
character = self.character_mapped(character)
if (character is None):
return None
if... | :param character: name
:param speaking: whether found in quote or stand-alone
:return: None if character is ignored | scripts/parse_script.py | add_character | GeneralMisquoti/star-wars-prequels-dialogues | 0 | python | def add_character(self, character: str, speaking=True) -> Optional[int]:
'\n\t\t:param character: name\n\t\t:param speaking: whether found in quote or stand-alone\n\t\t:return: None if character is ignored\n\t\t'
character = self.character_mapped(character)
if (character is None):
return None
if... | def add_character(self, character: str, speaking=True) -> Optional[int]:
'\n\t\t:param character: name\n\t\t:param speaking: whether found in quote or stand-alone\n\t\t:return: None if character is ignored\n\t\t'
character = self.character_mapped(character)
if (character is None):
return None
if... |
63dcde1b357180351a83be011d3bcc3baf9dfeaf7002fc4fcee6b25a95fc1670 | def find_character_containing_word(self, character: str) -> Union[(None, int)]:
'\n\t\t:param character: Returns index of character whose one of\n\t\t\tthe words in its names is equal to it\n\t\t'
if (character in self.movie.data.strict):
return None
if (character.split(' ')[(- 1)] in self.numerals)... | :param character: Returns index of character whose one of
the words in its names is equal to it | scripts/parse_script.py | find_character_containing_word | GeneralMisquoti/star-wars-prequels-dialogues | 0 | python | def find_character_containing_word(self, character: str) -> Union[(None, int)]:
'\n\t\t:param character: Returns index of character whose one of\n\t\t\tthe words in its names is equal to it\n\t\t'
if (character in self.movie.data.strict):
return None
if (character.split(' ')[(- 1)] in self.numerals)... | def find_character_containing_word(self, character: str) -> Union[(None, int)]:
'\n\t\t:param character: Returns index of character whose one of\n\t\t\tthe words in its names is equal to it\n\t\t'
if (character in self.movie.data.strict):
return None
if (character.split(' ')[(- 1)] in self.numerals)... |
2a83c3aa5662581b1af78a0a0b2ed0a4aeb70c3f59a4a08e7d3c2c8081c24e8b | def character_mapped(self, character: str) -> Optional[str]:
'\n\t\t:param character: character to map\n\t\t:return: None if in ignored else str\n\t\t'
if (character in self.movie.data.ignored):
return None
if any(((x in character) for x in self.movie.data.blacklist_substrings)):
return None... | :param character: character to map
:return: None if in ignored else str | scripts/parse_script.py | character_mapped | GeneralMisquoti/star-wars-prequels-dialogues | 0 | python | def character_mapped(self, character: str) -> Optional[str]:
'\n\t\t:param character: character to map\n\t\t:return: None if in ignored else str\n\t\t'
if (character in self.movie.data.ignored):
return None
if any(((x in character) for x in self.movie.data.blacklist_substrings)):
return None... | def character_mapped(self, character: str) -> Optional[str]:
'\n\t\t:param character: character to map\n\t\t:return: None if in ignored else str\n\t\t'
if (character in self.movie.data.ignored):
return None
if any(((x in character) for x in self.movie.data.blacklist_substrings)):
return None... |
e20864e577e02e7506261de8dd0d082bb4efd29c59c1089837a47c417e4215d7 | def serialize(self):
"\n\t\tWe don't want characters who don't speak.\n\t\tWe can't just delete them, since we depend on the indexing.\n\n\t\tTherefore we create a new list of characters, by looping through the\n\t\tquotes, therefore only characters who have spoken will be taken into account.\n\t\t"
characters ... | We don't want characters who don't speak.
We can't just delete them, since we depend on the indexing.
Therefore we create a new list of characters, by looping through the
quotes, therefore only characters who have spoken will be taken into account. | scripts/parse_script.py | serialize | GeneralMisquoti/star-wars-prequels-dialogues | 0 | python | def serialize(self):
"\n\t\tWe don't want characters who don't speak.\n\t\tWe can't just delete them, since we depend on the indexing.\n\n\t\tTherefore we create a new list of characters, by looping through the\n\t\tquotes, therefore only characters who have spoken will be taken into account.\n\t\t"
characters ... | def serialize(self):
"\n\t\tWe don't want characters who don't speak.\n\t\tWe can't just delete them, since we depend on the indexing.\n\n\t\tTherefore we create a new list of characters, by looping through the\n\t\tquotes, therefore only characters who have spoken will be taken into account.\n\t\t"
characters ... |
bdf57498ac90bcd49f63508edb668eb8208b6b57e5aef014bca6cab6aab060b9 | @classmethod
def from_socket(cls, sock):
'Takes a socket, and attempts to get TCP_INFO stats on it. Returns a\n TcpInfo struct'
padsize = ctypes.sizeof(TcpInfo)
data = sock.getsockopt(socket.SOL_TCP, socket.TCP_INFO, padsize)
padded = data.ljust(padsize, b'\x00')
return cls.from_buffer_copy(p... | Takes a socket, and attempts to get TCP_INFO stats on it. Returns a
TcpInfo struct | mitigate.py | from_socket | ayyaruq/XivMitmLatencyMitigator | 0 | python | @classmethod
def from_socket(cls, sock):
'Takes a socket, and attempts to get TCP_INFO stats on it. Returns a\n TcpInfo struct'
padsize = ctypes.sizeof(TcpInfo)
data = sock.getsockopt(socket.SOL_TCP, socket.TCP_INFO, padsize)
padded = data.ljust(padsize, b'\x00')
return cls.from_buffer_copy(p... | @classmethod
def from_socket(cls, sock):
'Takes a socket, and attempts to get TCP_INFO stats on it. Returns a\n TcpInfo struct'
padsize = ctypes.sizeof(TcpInfo)
data = sock.getsockopt(socket.SOL_TCP, socket.TCP_INFO, padsize)
padded = data.ljust(padsize, b'\x00')
return cls.from_buffer_copy(p... |
0b66de1e54287e7d8dcaffceb3b3afc355d270d4da251ffb9b4852981bec1b58 | def split_args(self, args: Sequence[str]) -> SplitArgs:
'Split the specified arg list (or sys.argv if unspecified).\n\n args[0] is ignored.\n\n Returns a SplitArgs tuple.\n '
goals: OrderedSet[str] = OrderedSet()
scope_to_flags: DefaultDict[(str, list[str])] = defaultdict(list)
def... | Split the specified arg list (or sys.argv if unspecified).
args[0] is ignored.
Returns a SplitArgs tuple. | src/python/pants/option/arg_splitter.py | split_args | wimax-grapl/pants | 1,806 | python | def split_args(self, args: Sequence[str]) -> SplitArgs:
'Split the specified arg list (or sys.argv if unspecified).\n\n args[0] is ignored.\n\n Returns a SplitArgs tuple.\n '
goals: OrderedSet[str] = OrderedSet()
scope_to_flags: DefaultDict[(str, list[str])] = defaultdict(list)
def... | def split_args(self, args: Sequence[str]) -> SplitArgs:
'Split the specified arg list (or sys.argv if unspecified).\n\n args[0] is ignored.\n\n Returns a SplitArgs tuple.\n '
goals: OrderedSet[str] = OrderedSet()
scope_to_flags: DefaultDict[(str, list[str])] = defaultdict(list)
def... |
df92988ad411afda56e0e6c745ac5658732073c372e468576566482dfb1dbc03 | def likely_a_spec(self, arg: str) -> bool:
'Return whether `arg` looks like a spec, rather than a goal name.\n\n An arg is a spec if it looks like an AddressSpec or a FilesystemSpec.\n '
return (arg.startswith('!') or any(((c in arg) for c in (os.path.sep, '.', ':', '*', '#'))) or os.path.exists(o... | Return whether `arg` looks like a spec, rather than a goal name.
An arg is a spec if it looks like an AddressSpec or a FilesystemSpec. | src/python/pants/option/arg_splitter.py | likely_a_spec | wimax-grapl/pants | 1,806 | python | def likely_a_spec(self, arg: str) -> bool:
'Return whether `arg` looks like a spec, rather than a goal name.\n\n An arg is a spec if it looks like an AddressSpec or a FilesystemSpec.\n '
return (arg.startswith('!') or any(((c in arg) for c in (os.path.sep, '.', ':', '*', '#'))) or os.path.exists(o... | def likely_a_spec(self, arg: str) -> bool:
'Return whether `arg` looks like a spec, rather than a goal name.\n\n An arg is a spec if it looks like an AddressSpec or a FilesystemSpec.\n '
return (arg.startswith('!') or any(((c in arg) for c in (os.path.sep, '.', ':', '*', '#'))) or os.path.exists(o... |
7acc483bf942a9771580b7b5a35a1f6378e1eb2f2726350f749adada8739a5d4 | def _consume_scope(self) -> tuple[((str | None), list[str])]:
'Returns a pair (scope, list of flags encountered in that scope).\n\n Note that the flag may be explicitly scoped, and therefore not actually belong to this scope.\n\n For example, in:\n\n ./pants --check-some-opt=100 check <targ... | Returns a pair (scope, list of flags encountered in that scope).
Note that the flag may be explicitly scoped, and therefore not actually belong to this scope.
For example, in:
./pants --check-some-opt=100 check <target>
--check-some-opt should be treated as if it were --check-some-opt=100 in the check scope. | src/python/pants/option/arg_splitter.py | _consume_scope | wimax-grapl/pants | 1,806 | python | def _consume_scope(self) -> tuple[((str | None), list[str])]:
'Returns a pair (scope, list of flags encountered in that scope).\n\n Note that the flag may be explicitly scoped, and therefore not actually belong to this scope.\n\n For example, in:\n\n ./pants --check-some-opt=100 check <targ... | def _consume_scope(self) -> tuple[((str | None), list[str])]:
'Returns a pair (scope, list of flags encountered in that scope).\n\n Note that the flag may be explicitly scoped, and therefore not actually belong to this scope.\n\n For example, in:\n\n ./pants --check-some-opt=100 check <targ... |
e66f95691a0983697f02ddc17bb8819f5beb5e89ee964fd083e2fb610b47d1c9 | def _consume_flags(self) -> list[str]:
"Read flags until we encounter the first token that isn't a flag."
flags = []
while self._at_flag():
flag = self._unconsumed_args.pop()
if (not self._check_for_help_request(flag)):
flags.append(flag)
return flags | Read flags until we encounter the first token that isn't a flag. | src/python/pants/option/arg_splitter.py | _consume_flags | wimax-grapl/pants | 1,806 | python | def _consume_flags(self) -> list[str]:
flags = []
while self._at_flag():
flag = self._unconsumed_args.pop()
if (not self._check_for_help_request(flag)):
flags.append(flag)
return flags | def _consume_flags(self) -> list[str]:
flags = []
while self._at_flag():
flag = self._unconsumed_args.pop()
if (not self._check_for_help_request(flag)):
flags.append(flag)
return flags<|docstring|>Read flags until we encounter the first token that isn't a flag.<|endoftext|> |
b0bb72343bcc01ea273382964503e4d19df50d10680d3f9e79c083934255c011 | def _descope_flag(self, flag: str, default_scope: str) -> tuple[(str, str)]:
'If the flag is prefixed by its scope, extract the scope.\n\n Otherwise assume it belongs to default_scope.\n\n Returns a pair (scope, flag).\n '
for (scope_prefix, scope_info) in self._known_scoping_prefixes:
... | If the flag is prefixed by its scope, extract the scope.
Otherwise assume it belongs to default_scope.
Returns a pair (scope, flag). | src/python/pants/option/arg_splitter.py | _descope_flag | wimax-grapl/pants | 1,806 | python | def _descope_flag(self, flag: str, default_scope: str) -> tuple[(str, str)]:
'If the flag is prefixed by its scope, extract the scope.\n\n Otherwise assume it belongs to default_scope.\n\n Returns a pair (scope, flag).\n '
for (scope_prefix, scope_info) in self._known_scoping_prefixes:
... | def _descope_flag(self, flag: str, default_scope: str) -> tuple[(str, str)]:
'If the flag is prefixed by its scope, extract the scope.\n\n Otherwise assume it belongs to default_scope.\n\n Returns a pair (scope, flag).\n '
for (scope_prefix, scope_info) in self._known_scoping_prefixes:
... |
c460dbd5c097aa7a326cd8385ed74232d552a5e51cc06e1d4c6f1e19f8bb24fe | def src_dot_dst(src_field, dst_field, out_field):
'\n This function serves as a surrogate for `src_dot_dst` built-in apply_edge function.\n '
def func(edges):
return {out_field: (edges.src[src_field] * edges.dst[dst_field]).sum((- 1), keepdim=True)}
return func | This function serves as a surrogate for `src_dot_dst` built-in apply_edge function. | examples/pytorch/transformer/modules/functions.py | src_dot_dst | rpatil524/dgl | 9,516 | python | def src_dot_dst(src_field, dst_field, out_field):
'\n \n '
def func(edges):
return {out_field: (edges.src[src_field] * edges.dst[dst_field]).sum((- 1), keepdim=True)}
return func | def src_dot_dst(src_field, dst_field, out_field):
'\n \n '
def func(edges):
return {out_field: (edges.src[src_field] * edges.dst[dst_field]).sum((- 1), keepdim=True)}
return func<|docstring|>This function serves as a surrogate for `src_dot_dst` built-in apply_edge function.<|endoftext|> |
fcc98e69de035a7724ed2dad9e519c9e464a7a7d4b35512ef46a00b92e09b6ab | def scaled_exp(field, c):
'\n This function applies $exp(x / c)$ for input $x$, which is required by *Scaled Dot-Product Attention* mentioned in the paper.\n '
def func(edges):
return {field: th.exp((edges.data[field] / c).clamp((- 10), 10))}
return func | This function applies $exp(x / c)$ for input $x$, which is required by *Scaled Dot-Product Attention* mentioned in the paper. | examples/pytorch/transformer/modules/functions.py | scaled_exp | rpatil524/dgl | 9,516 | python | def scaled_exp(field, c):
'\n \n '
def func(edges):
return {field: th.exp((edges.data[field] / c).clamp((- 10), 10))}
return func | def scaled_exp(field, c):
'\n \n '
def func(edges):
return {field: th.exp((edges.data[field] / c).clamp((- 10), 10))}
return func<|docstring|>This function applies $exp(x / c)$ for input $x$, which is required by *Scaled Dot-Product Attention* mentioned in the paper.<|endoftext|> |
ca36eb163bad03a2eab760c67dc79657c102aebcebca35b98456585bb10bd2d1 | def _get_blob_name(blob):
'Return the blob name.\n\n :param blob: A blob string or BlobProperties\n :rtype: str\n '
try:
return blob.name
except AttributeError:
return blob | Return the blob name.
:param blob: A blob string or BlobProperties
:rtype: str | sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py | _get_blob_name | ibigbug/azure-sdk-for-python | 1 | python | def _get_blob_name(blob):
'Return the blob name.\n\n :param blob: A blob string or BlobProperties\n :rtype: str\n '
try:
return blob.name
except AttributeError:
return blob | def _get_blob_name(blob):
'Return the blob name.\n\n :param blob: A blob string or BlobProperties\n :rtype: str\n '
try:
return blob.name
except AttributeError:
return blob<|docstring|>Return the blob name.
:param blob: A blob string or BlobProperties
:rtype: str<|endoftext|> |
b24604422fda17d705fbd7dfc9b20f4d3777b78499b3bd7994eaeda0fdda3d70 | @classmethod
def from_container_url(cls, container_url, credential=None, **kwargs):
'Create ContainerClient from a container url.\n\n :param str container_url:\n The full endpoint URL to the Container, including SAS token if used. This could be\n either the primary endpoint, or the seco... | Create ContainerClient from a container url.
:param str container_url:
The full endpoint URL to the Container, including SAS token if used. This could be
either the primary endpoint, or the secondary endpoint depending on the current `location_mode`.
:type container_url: str
:param credential:
The credenti... | sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py | from_container_url | ibigbug/azure-sdk-for-python | 1 | python | @classmethod
def from_container_url(cls, container_url, credential=None, **kwargs):
'Create ContainerClient from a container url.\n\n :param str container_url:\n The full endpoint URL to the Container, including SAS token if used. This could be\n either the primary endpoint, or the seco... | @classmethod
def from_container_url(cls, container_url, credential=None, **kwargs):
'Create ContainerClient from a container url.\n\n :param str container_url:\n The full endpoint URL to the Container, including SAS token if used. This could be\n either the primary endpoint, or the seco... |
7e0c300d05cfe781aad8c8c0957d42bade843126d92ebea89100455bbf74f59c | @classmethod
def from_connection_string(cls, conn_str, container_name, credential=None, **kwargs):
'Create ContainerClient from a Connection String.\n\n :param str conn_str:\n A connection string to an Azure Storage account.\n :param container_name:\n The container name for the b... | Create ContainerClient from a Connection String.
:param str conn_str:
A connection string to an Azure Storage account.
:param container_name:
The container name for the blob.
:type container_name: str
:param credential:
The credentials with which to authenticate. This is optional if the
account URL alr... | sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py | from_connection_string | ibigbug/azure-sdk-for-python | 1 | python | @classmethod
def from_connection_string(cls, conn_str, container_name, credential=None, **kwargs):
'Create ContainerClient from a Connection String.\n\n :param str conn_str:\n A connection string to an Azure Storage account.\n :param container_name:\n The container name for the b... | @classmethod
def from_connection_string(cls, conn_str, container_name, credential=None, **kwargs):
'Create ContainerClient from a Connection String.\n\n :param str conn_str:\n A connection string to an Azure Storage account.\n :param container_name:\n The container name for the b... |
53bccf34ed18e9944fbe93ca14a449759a40bb57133f58f2339820febd4d7b6d | @distributed_trace
def create_container(self, metadata=None, public_access=None, **kwargs):
"\n Creates a new container under the specified account. If the container\n with the same name already exists, the operation fails.\n\n :param metadata:\n A dict with name_value pairs to assoc... | Creates a new container under the specified account. If the container
with the same name already exists, the operation fails.
:param metadata:
A dict with name_value pairs to associate with the
container as metadata. Example:{'Category':'test'}
:type metadata: dict[str, str]
:param ~azure.storage.blob.PublicAc... | sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py | create_container | ibigbug/azure-sdk-for-python | 1 | python | @distributed_trace
def create_container(self, metadata=None, public_access=None, **kwargs):
"\n Creates a new container under the specified account. If the container\n with the same name already exists, the operation fails.\n\n :param metadata:\n A dict with name_value pairs to assoc... | @distributed_trace
def create_container(self, metadata=None, public_access=None, **kwargs):
"\n Creates a new container under the specified account. If the container\n with the same name already exists, the operation fails.\n\n :param metadata:\n A dict with name_value pairs to assoc... |
4ebeca43d4f8f375455e8ca4a4a4ceeac3f87528eb2f8673e5dcf3667ea38d8a | @distributed_trace
def delete_container(self, **kwargs):
"\n Marks the specified container for deletion. The container and any blobs\n contained within it are later deleted during garbage collection.\n\n :keyword lease:\n If specified, delete_container only succeeds if the\n ... | Marks the specified container for deletion. The container and any blobs
contained within it are later deleted during garbage collection.
:keyword lease:
If specified, delete_container only succeeds if the
container's lease is active and matches this ID.
Required if the container has an active lease.
:param... | sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py | delete_container | ibigbug/azure-sdk-for-python | 1 | python | @distributed_trace
def delete_container(self, **kwargs):
"\n Marks the specified container for deletion. The container and any blobs\n contained within it are later deleted during garbage collection.\n\n :keyword lease:\n If specified, delete_container only succeeds if the\n ... | @distributed_trace
def delete_container(self, **kwargs):
"\n Marks the specified container for deletion. The container and any blobs\n contained within it are later deleted during garbage collection.\n\n :keyword lease:\n If specified, delete_container only succeeds if the\n ... |
ed8b415378a682a3250b5de31250c1ee0c0b8f0b71bd78d92ebefd40b709758a | @distributed_trace
def acquire_lease(self, lease_duration=(- 1), lease_id=None, **kwargs):
'\n Requests a new lease. If the container does not have an active lease,\n the Blob service creates a lease on the container and returns a new\n lease ID.\n\n :param int lease_duration:\n ... | Requests a new lease. If the container does not have an active lease,
the Blob service creates a lease on the container and returns a new
lease ID.
:param int lease_duration:
Specifies the duration of the lease, in seconds, or negative one
(-1) for a lease that never expires. A non-infinite lease can be
be... | sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py | acquire_lease | ibigbug/azure-sdk-for-python | 1 | python | @distributed_trace
def acquire_lease(self, lease_duration=(- 1), lease_id=None, **kwargs):
'\n Requests a new lease. If the container does not have an active lease,\n the Blob service creates a lease on the container and returns a new\n lease ID.\n\n :param int lease_duration:\n ... | @distributed_trace
def acquire_lease(self, lease_duration=(- 1), lease_id=None, **kwargs):
'\n Requests a new lease. If the container does not have an active lease,\n the Blob service creates a lease on the container and returns a new\n lease ID.\n\n :param int lease_duration:\n ... |
628bbdcd05277d418d542a21986f40f607088fa1a981051be1de982aae3ccea7 | @distributed_trace
def get_account_information(self, **kwargs):
"Gets information related to the storage account.\n\n The information can also be retrieved if the user has a SAS to a container or blob.\n The keys in the returned dictionary include 'sku_name' and 'account_kind'.\n\n :returns: A ... | Gets information related to the storage account.
The information can also be retrieved if the user has a SAS to a container or blob.
The keys in the returned dictionary include 'sku_name' and 'account_kind'.
:returns: A dict of account information (SKU and account type).
:rtype: dict(str, str) | sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py | get_account_information | ibigbug/azure-sdk-for-python | 1 | python | @distributed_trace
def get_account_information(self, **kwargs):
"Gets information related to the storage account.\n\n The information can also be retrieved if the user has a SAS to a container or blob.\n The keys in the returned dictionary include 'sku_name' and 'account_kind'.\n\n :returns: A ... | @distributed_trace
def get_account_information(self, **kwargs):
"Gets information related to the storage account.\n\n The information can also be retrieved if the user has a SAS to a container or blob.\n The keys in the returned dictionary include 'sku_name' and 'account_kind'.\n\n :returns: A ... |
3146e97fbd2cc59ef82b68ea92d9ec83461c34ac2be6ea796d6a7d699372aead | @distributed_trace
def get_container_properties(self, **kwargs):
"Returns all user-defined metadata and system properties for the specified\n container. The data returned does not include the container's list of blobs.\n\n :keyword lease:\n If specified, get_container_properties only succee... | Returns all user-defined metadata and system properties for the specified
container. The data returned does not include the container's list of blobs.
:keyword lease:
If specified, get_container_properties only succeeds if the
container's lease is active and matches this ID.
:paramtype lease: ~azure.storage.bl... | sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py | get_container_properties | ibigbug/azure-sdk-for-python | 1 | python | @distributed_trace
def get_container_properties(self, **kwargs):
"Returns all user-defined metadata and system properties for the specified\n container. The data returned does not include the container's list of blobs.\n\n :keyword lease:\n If specified, get_container_properties only succee... | @distributed_trace
def get_container_properties(self, **kwargs):
"Returns all user-defined metadata and system properties for the specified\n container. The data returned does not include the container's list of blobs.\n\n :keyword lease:\n If specified, get_container_properties only succee... |
87b366dc2c3326e524cd3f898865e6e37e8ee85aac4e7dcfb822ae783662687e | @distributed_trace
def set_container_metadata(self, metadata=None, **kwargs):
"Sets one or more user-defined name-value pairs for the specified\n container. Each call to this operation replaces all existing metadata\n attached to the container. To remove all metadata from the container,\n call ... | Sets one or more user-defined name-value pairs for the specified
container. Each call to this operation replaces all existing metadata
attached to the container. To remove all metadata from the container,
call this operation with no metadata dict.
:param metadata:
A dict containing name-value pairs to associate wi... | sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py | set_container_metadata | ibigbug/azure-sdk-for-python | 1 | python | @distributed_trace
def set_container_metadata(self, metadata=None, **kwargs):
"Sets one or more user-defined name-value pairs for the specified\n container. Each call to this operation replaces all existing metadata\n attached to the container. To remove all metadata from the container,\n call ... | @distributed_trace
def set_container_metadata(self, metadata=None, **kwargs):
"Sets one or more user-defined name-value pairs for the specified\n container. Each call to this operation replaces all existing metadata\n attached to the container. To remove all metadata from the container,\n call ... |
54ed50e0f70362685c15feb274a91bd3d0db6a68d3dd7f28cae05d980e5158b3 | @distributed_trace
def get_container_access_policy(self, **kwargs):
"Gets the permissions for the specified container.\n The permissions indicate whether container data may be accessed publicly.\n\n :keyword lease:\n If specified, get_container_access_policy only succeeds if the\n ... | Gets the permissions for the specified container.
The permissions indicate whether container data may be accessed publicly.
:keyword lease:
If specified, get_container_access_policy only succeeds if the
container's lease is active and matches this ID.
:paramtype lease: ~azure.storage.blob.BlobLeaseClient or st... | sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py | get_container_access_policy | ibigbug/azure-sdk-for-python | 1 | python | @distributed_trace
def get_container_access_policy(self, **kwargs):
"Gets the permissions for the specified container.\n The permissions indicate whether container data may be accessed publicly.\n\n :keyword lease:\n If specified, get_container_access_policy only succeeds if the\n ... | @distributed_trace
def get_container_access_policy(self, **kwargs):
"Gets the permissions for the specified container.\n The permissions indicate whether container data may be accessed publicly.\n\n :keyword lease:\n If specified, get_container_access_policy only succeeds if the\n ... |
740b34acdfadcf497161160d5ecab8a4ecce385beefbf027ec0ad74c0233da94 | @distributed_trace
def set_container_access_policy(self, signed_identifiers, public_access=None, **kwargs):
"Sets the permissions for the specified container or stored access\n policies that may be used with Shared Access Signatures. The permissions\n indicate whether blobs in a container may be acces... | Sets the permissions for the specified container or stored access
policies that may be used with Shared Access Signatures. The permissions
indicate whether blobs in a container may be accessed publicly.
:param signed_identifiers:
A dictionary of access policies to associate with the container. The
dictionary m... | sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py | set_container_access_policy | ibigbug/azure-sdk-for-python | 1 | python | @distributed_trace
def set_container_access_policy(self, signed_identifiers, public_access=None, **kwargs):
"Sets the permissions for the specified container or stored access\n policies that may be used with Shared Access Signatures. The permissions\n indicate whether blobs in a container may be acces... | @distributed_trace
def set_container_access_policy(self, signed_identifiers, public_access=None, **kwargs):
"Sets the permissions for the specified container or stored access\n policies that may be used with Shared Access Signatures. The permissions\n indicate whether blobs in a container may be acces... |
9c564ee4d2ed7846a5295522a946e2d971f2f01b3b6dee8e99ea6f19285cb298 | @distributed_trace
def list_blobs(self, name_starts_with=None, include=None, **kwargs):
"Returns a generator to list the blobs under the specified container.\n The generator will lazily follow the continuation tokens returned by\n the service.\n\n :param str name_starts_with:\n Filte... | Returns a generator to list the blobs under the specified container.
The generator will lazily follow the continuation tokens returned by
the service.
:param str name_starts_with:
Filters the results to return only blobs whose names
begin with the specified prefix.
:param list[str] include:
Specifies one o... | sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py | list_blobs | ibigbug/azure-sdk-for-python | 1 | python | @distributed_trace
def list_blobs(self, name_starts_with=None, include=None, **kwargs):
"Returns a generator to list the blobs under the specified container.\n The generator will lazily follow the continuation tokens returned by\n the service.\n\n :param str name_starts_with:\n Filte... | @distributed_trace
def list_blobs(self, name_starts_with=None, include=None, **kwargs):
"Returns a generator to list the blobs under the specified container.\n The generator will lazily follow the continuation tokens returned by\n the service.\n\n :param str name_starts_with:\n Filte... |
b577a4acef866f99d7b3f8e8f3b06eee3a7a96d2d0c7c5b4c5f2aa9a9d9751d1 | @distributed_trace
def walk_blobs(self, name_starts_with=None, include=None, delimiter='/', **kwargs):
"Returns a generator to list the blobs under the specified container.\n The generator will lazily follow the continuation tokens returned by\n the service. This operation will list blobs in accordanc... | Returns a generator to list the blobs under the specified container.
The generator will lazily follow the continuation tokens returned by
the service. This operation will list blobs in accordance with a hierarchy,
as delimited by the specified delimiter character.
:param str name_starts_with:
Filters the results t... | sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py | walk_blobs | ibigbug/azure-sdk-for-python | 1 | python | @distributed_trace
def walk_blobs(self, name_starts_with=None, include=None, delimiter='/', **kwargs):
"Returns a generator to list the blobs under the specified container.\n The generator will lazily follow the continuation tokens returned by\n the service. This operation will list blobs in accordanc... | @distributed_trace
def walk_blobs(self, name_starts_with=None, include=None, delimiter='/', **kwargs):
"Returns a generator to list the blobs under the specified container.\n The generator will lazily follow the continuation tokens returned by\n the service. This operation will list blobs in accordanc... |
9e586039bf2503bc9e25a795659c1dfc3f8bbfe2e325dc537e9fa9fb5ed9101a | @distributed_trace
def upload_blob(self, name, data, blob_type=BlobType.BlockBlob, length=None, metadata=None, **kwargs):
'Creates a new blob from a data source with automatic chunking.\n\n :param name: The blob with which to interact. If specified, this value will override\n a blob value specifie... | Creates a new blob from a data source with automatic chunking.
:param name: The blob with which to interact. If specified, this value will override
a blob value specified in the blob URL.
:type name: str or ~azure.storage.blob.BlobProperties
:param data: The blob data to upload.
:param ~azure.storage.blob.BlobType... | sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py | upload_blob | ibigbug/azure-sdk-for-python | 1 | python | @distributed_trace
def upload_blob(self, name, data, blob_type=BlobType.BlockBlob, length=None, metadata=None, **kwargs):
'Creates a new blob from a data source with automatic chunking.\n\n :param name: The blob with which to interact. If specified, this value will override\n a blob value specifie... | @distributed_trace
def upload_blob(self, name, data, blob_type=BlobType.BlockBlob, length=None, metadata=None, **kwargs):
'Creates a new blob from a data source with automatic chunking.\n\n :param name: The blob with which to interact. If specified, this value will override\n a blob value specifie... |
3ac7f9d51a462ce7e407332bf96b402dd2f5f96ebaf128634bf5265e8dcab0b2 | @distributed_trace
def delete_blob(self, blob, delete_snapshots=None, **kwargs):
'Marks the specified blob or snapshot for deletion.\n\n The blob is later deleted during garbage collection.\n Note that in order to delete a blob, you must delete all of its\n snapshots. You can delete both at the... | Marks the specified blob or snapshot for deletion.
The blob is later deleted during garbage collection.
Note that in order to delete a blob, you must delete all of its
snapshots. You can delete both at the same time with the delete_blob
operation.
If a delete retention policy is enabled for the service, then this ope... | sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py | delete_blob | ibigbug/azure-sdk-for-python | 1 | python | @distributed_trace
def delete_blob(self, blob, delete_snapshots=None, **kwargs):
'Marks the specified blob or snapshot for deletion.\n\n The blob is later deleted during garbage collection.\n Note that in order to delete a blob, you must delete all of its\n snapshots. You can delete both at the... | @distributed_trace
def delete_blob(self, blob, delete_snapshots=None, **kwargs):
'Marks the specified blob or snapshot for deletion.\n\n The blob is later deleted during garbage collection.\n Note that in order to delete a blob, you must delete all of its\n snapshots. You can delete both at the... |
19c126e671dce4be3b9947d5719ff7d16b63950c3315b0b32eea150d503866c8 | @distributed_trace
def download_blob(self, blob, offset=None, length=None, **kwargs):
"Downloads a blob to the StorageStreamDownloader. The readall() method must\n be used to read all the content or readinto() must be used to download the blob into\n a stream.\n\n :param blob: The blob with whi... | Downloads a blob to the StorageStreamDownloader. The readall() method must
be used to read all the content or readinto() must be used to download the blob into
a stream.
:param blob: The blob with which to interact. If specified, this value will override
a blob value specified in the blob URL.
:type blob: str or ~... | sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py | download_blob | ibigbug/azure-sdk-for-python | 1 | python | @distributed_trace
def download_blob(self, blob, offset=None, length=None, **kwargs):
"Downloads a blob to the StorageStreamDownloader. The readall() method must\n be used to read all the content or readinto() must be used to download the blob into\n a stream.\n\n :param blob: The blob with whi... | @distributed_trace
def download_blob(self, blob, offset=None, length=None, **kwargs):
"Downloads a blob to the StorageStreamDownloader. The readall() method must\n be used to read all the content or readinto() must be used to download the blob into\n a stream.\n\n :param blob: The blob with whi... |
8813ea0f4e2e0df8763d9eacc1bfa918ea1ee44b379ae9d0582dc4444cf86545 | def _generate_delete_blobs_options(self, snapshot=None, delete_snapshots=None, request_id=None, lease_access_conditions=None, modified_access_conditions=None, **kwargs):
'This code is a copy from _generated.\n\n Once Autorest is able to provide request preparation this code should be removed.\n '
... | This code is a copy from _generated.
Once Autorest is able to provide request preparation this code should be removed. | sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py | _generate_delete_blobs_options | ibigbug/azure-sdk-for-python | 1 | python | def _generate_delete_blobs_options(self, snapshot=None, delete_snapshots=None, request_id=None, lease_access_conditions=None, modified_access_conditions=None, **kwargs):
'This code is a copy from _generated.\n\n Once Autorest is able to provide request preparation this code should be removed.\n '
... | def _generate_delete_blobs_options(self, snapshot=None, delete_snapshots=None, request_id=None, lease_access_conditions=None, modified_access_conditions=None, **kwargs):
'This code is a copy from _generated.\n\n Once Autorest is able to provide request preparation this code should be removed.\n '
... |
a98e0df36be875d59d6253901d78fb466a5bef6171031aeab74ce12bb47aed64 | @distributed_trace
def delete_blobs(self, *blobs, **kwargs):
'Marks the specified blobs or snapshots for deletion.\n\n The blobs are later deleted during garbage collection.\n Note that in order to delete blobs, you must delete all of their\n snapshots. You can delete both at the same time with... | Marks the specified blobs or snapshots for deletion.
The blobs are later deleted during garbage collection.
Note that in order to delete blobs, you must delete all of their
snapshots. You can delete both at the same time with the delete_blobs operation.
If a delete retention policy is enabled for the service, then th... | sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py | delete_blobs | ibigbug/azure-sdk-for-python | 1 | python | @distributed_trace
def delete_blobs(self, *blobs, **kwargs):
'Marks the specified blobs or snapshots for deletion.\n\n The blobs are later deleted during garbage collection.\n Note that in order to delete blobs, you must delete all of their\n snapshots. You can delete both at the same time with... | @distributed_trace
def delete_blobs(self, *blobs, **kwargs):
'Marks the specified blobs or snapshots for deletion.\n\n The blobs are later deleted during garbage collection.\n Note that in order to delete blobs, you must delete all of their\n snapshots. You can delete both at the same time with... |
79287851a8ae883eae5bff15de67d203f8a0e87272cf1386c05f84be4895fdf3 | def _generate_set_tier_options(self, tier, rehydrate_priority=None, request_id=None, lease_access_conditions=None, **kwargs):
'This code is a copy from _generated.\n\n Once Autorest is able to provide request preparation this code should be removed.\n '
lease_id = None
if (lease_access_conditi... | This code is a copy from _generated.
Once Autorest is able to provide request preparation this code should be removed. | sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py | _generate_set_tier_options | ibigbug/azure-sdk-for-python | 1 | python | def _generate_set_tier_options(self, tier, rehydrate_priority=None, request_id=None, lease_access_conditions=None, **kwargs):
'This code is a copy from _generated.\n\n Once Autorest is able to provide request preparation this code should be removed.\n '
lease_id = None
if (lease_access_conditi... | def _generate_set_tier_options(self, tier, rehydrate_priority=None, request_id=None, lease_access_conditions=None, **kwargs):
'This code is a copy from _generated.\n\n Once Autorest is able to provide request preparation this code should be removed.\n '
lease_id = None
if (lease_access_conditi... |
ccd17c2e4c1e57d360b13c5fbf57ca90b46d2bf32abff5f942ef7628f4fa17b8 | @distributed_trace
def set_standard_blob_tier_blobs(self, standard_blob_tier, *blobs, **kwargs):
"This operation sets the tier on block blobs.\n\n A block blob's tier determines Hot/Cool/Archive storage type.\n This operation does not update the blob's ETag.\n\n :param standard_blob_tier:\n ... | This operation sets the tier on block blobs.
A block blob's tier determines Hot/Cool/Archive storage type.
This operation does not update the blob's ETag.
:param standard_blob_tier:
Indicates the tier to be set on the blob. Options include 'Hot', 'Cool',
'Archive'. The hot tier is optimized for storing data t... | sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py | set_standard_blob_tier_blobs | ibigbug/azure-sdk-for-python | 1 | python | @distributed_trace
def set_standard_blob_tier_blobs(self, standard_blob_tier, *blobs, **kwargs):
"This operation sets the tier on block blobs.\n\n A block blob's tier determines Hot/Cool/Archive storage type.\n This operation does not update the blob's ETag.\n\n :param standard_blob_tier:\n ... | @distributed_trace
def set_standard_blob_tier_blobs(self, standard_blob_tier, *blobs, **kwargs):
"This operation sets the tier on block blobs.\n\n A block blob's tier determines Hot/Cool/Archive storage type.\n This operation does not update the blob's ETag.\n\n :param standard_blob_tier:\n ... |
169c43a58a934fe6b5aac0fe50616de163c2eff9783d90ffedfa248b10ef1068 | @distributed_trace
def set_premium_page_blob_tier_blobs(self, premium_page_blob_tier, *blobs, **kwargs):
'Sets the page blob tiers on the blobs. This API is only supported for page blobs on premium accounts.\n\n :param premium_page_blob_tier:\n A page blob tier value to set the blob to. The tier c... | Sets the page blob tiers on the blobs. This API is only supported for page blobs on premium accounts.
:param premium_page_blob_tier:
A page blob tier value to set the blob to. The tier correlates to the size of the
blob and number of allowed IOPS. This is only applicable to page blobs on
premium storage ac... | sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py | set_premium_page_blob_tier_blobs | ibigbug/azure-sdk-for-python | 1 | python | @distributed_trace
def set_premium_page_blob_tier_blobs(self, premium_page_blob_tier, *blobs, **kwargs):
'Sets the page blob tiers on the blobs. This API is only supported for page blobs on premium accounts.\n\n :param premium_page_blob_tier:\n A page blob tier value to set the blob to. The tier c... | @distributed_trace
def set_premium_page_blob_tier_blobs(self, premium_page_blob_tier, *blobs, **kwargs):
'Sets the page blob tiers on the blobs. This API is only supported for page blobs on premium accounts.\n\n :param premium_page_blob_tier:\n A page blob tier value to set the blob to. The tier c... |
a53ed57065d921dfb6c4fd1ba26cdbab82a55a3c00cf282196cedffd16197f4d | def get_blob_client(self, blob, snapshot=None):
'Get a client to interact with the specified blob.\n\n The blob need not already exist.\n\n :param blob:\n The blob with which to interact.\n :type blob: str or ~azure.storage.blob.BlobProperties\n :param str snapshot:\n ... | Get a client to interact with the specified blob.
The blob need not already exist.
:param blob:
The blob with which to interact.
:type blob: str or ~azure.storage.blob.BlobProperties
:param str snapshot:
The optional blob snapshot on which to operate. This can be the snapshot ID string
or the response ret... | sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py | get_blob_client | ibigbug/azure-sdk-for-python | 1 | python | def get_blob_client(self, blob, snapshot=None):
'Get a client to interact with the specified blob.\n\n The blob need not already exist.\n\n :param blob:\n The blob with which to interact.\n :type blob: str or ~azure.storage.blob.BlobProperties\n :param str snapshot:\n ... | def get_blob_client(self, blob, snapshot=None):
'Get a client to interact with the specified blob.\n\n The blob need not already exist.\n\n :param blob:\n The blob with which to interact.\n :type blob: str or ~azure.storage.blob.BlobProperties\n :param str snapshot:\n ... |
c62f926beb48a51176722cfdd445ded51ead8af04a12d39970f8580a542dd6e4 | def __init__(self, address: str, client: Web3):
'\n :param address: The address of the market contract.\n :param client: The web3 client.\n\n Initialize the Market Module.\n\n '
super().__init__()
self.address = address
self.__abi_module = Market(client, address) | :param address: The address of the market contract.
:param client: The web3 client.
Initialize the Market Module. | thirdweb/modules/market.py | __init__ | princetonwong/python-sdk | 1 | python | def __init__(self, address: str, client: Web3):
'\n :param address: The address of the market contract.\n :param client: The web3 client.\n\n Initialize the Market Module.\n\n '
super().__init__()
self.address = address
self.__abi_module = Market(client, address) | def __init__(self, address: str, client: Web3):
'\n :param address: The address of the market contract.\n :param client: The web3 client.\n\n Initialize the Market Module.\n\n '
super().__init__()
self.address = address
self.__abi_module = Market(client, address)<|docstring|>... |
e0462722482f73e170980f767ecfaa87b129cb6af81af8a93c353de228c29fab | def list(self, arg: ListArg) -> Listing:
"\n :param arg: The listing details.\n :return: Does not return anything, yet.\n\n WIP: This method is still in beta and will contain bugs.\n Status: Listing works but decoding the logs is breaking due to a bug\n in the web3 library (https:... | :param arg: The listing details.
:return: Does not return anything, yet.
WIP: This method is still in beta and will contain bugs.
Status: Listing works but decoding the logs is breaking due to a bug
in the web3 library (https://github.com/ethereum/web3.py/pull/1484).
We're unable to return the new listing ID to the ca... | thirdweb/modules/market.py | list | princetonwong/python-sdk | 1 | python | def list(self, arg: ListArg) -> Listing:
"\n :param arg: The listing details.\n :return: Does not return anything, yet.\n\n WIP: This method is still in beta and will contain bugs.\n Status: Listing works but decoding the logs is breaking due to a bug\n in the web3 library (https:... | def list(self, arg: ListArg) -> Listing:
"\n :param arg: The listing details.\n :return: Does not return anything, yet.\n\n WIP: This method is still in beta and will contain bugs.\n Status: Listing works but decoding the logs is breaking due to a bug\n in the web3 library (https:... |
e5d0ba0a1279b5c2f90ca8af950f30020ab35f95a607c3d4c1cb023a045b3e7b | def __approve_erc_1155(self, address: str) -> Listing:
'\n BETA: This method is still in beta and might contain bugs.\n '
from_address = self.get_signer_address()
asset = ERC1155(self.get_client(), address)
approved = asset.is_approved_for_all.call(from_address, self.address)
if (not a... | BETA: This method is still in beta and might contain bugs. | thirdweb/modules/market.py | __approve_erc_1155 | princetonwong/python-sdk | 1 | python | def __approve_erc_1155(self, address: str) -> Listing:
'\n \n '
from_address = self.get_signer_address()
asset = ERC1155(self.get_client(), address)
approved = asset.is_approved_for_all.call(from_address, self.address)
if (not approved):
self.execute_tx(asset.set_approval_for_a... | def __approve_erc_1155(self, address: str) -> Listing:
'\n \n '
from_address = self.get_signer_address()
asset = ERC1155(self.get_client(), address)
approved = asset.is_approved_for_all.call(from_address, self.address)
if (not approved):
self.execute_tx(asset.set_approval_for_a... |
13ec095c9e68692864cc557db533a0cca4302976d5908bd3929ee40c773ea947 | def unlist(self, listing_id, quantity):
'\n :param listing_id: The listing ID.\n :param quantity: The quantity to unlist.\n\n Unlist a certain quantity of tokens from a listing.\n\n '
tx = self.__abi_module.unlist.build_transaction(listing_id, quantity, self.get_transact_opts())
... | :param listing_id: The listing ID.
:param quantity: The quantity to unlist.
Unlist a certain quantity of tokens from a listing. | thirdweb/modules/market.py | unlist | princetonwong/python-sdk | 1 | python | def unlist(self, listing_id, quantity):
'\n :param listing_id: The listing ID.\n :param quantity: The quantity to unlist.\n\n Unlist a certain quantity of tokens from a listing.\n\n '
tx = self.__abi_module.unlist.build_transaction(listing_id, quantity, self.get_transact_opts())
... | def unlist(self, listing_id, quantity):
'\n :param listing_id: The listing ID.\n :param quantity: The quantity to unlist.\n\n Unlist a certain quantity of tokens from a listing.\n\n '
tx = self.__abi_module.unlist.build_transaction(listing_id, quantity, self.get_transact_opts())
... |
8354f8b40d4963ce1629fe082f8db9b05cf2f1d085b77287822d79ccc1e4761a | def unlist_all(self, listing_id: int):
'\n :param listing_id: The listing ID.\n\n Unlist all available tokens from a listing.\n\n '
self.unlist(listing_id, self.get(listing_id).quantity) | :param listing_id: The listing ID.
Unlist all available tokens from a listing. | thirdweb/modules/market.py | unlist_all | princetonwong/python-sdk | 1 | python | def unlist_all(self, listing_id: int):
'\n :param listing_id: The listing ID.\n\n Unlist all available tokens from a listing.\n\n '
self.unlist(listing_id, self.get(listing_id).quantity) | def unlist_all(self, listing_id: int):
'\n :param listing_id: The listing ID.\n\n Unlist all available tokens from a listing.\n\n '
self.unlist(listing_id, self.get(listing_id).quantity)<|docstring|>:param listing_id: The listing ID.
Unlist all available tokens from a listing.<|endoftext|> |
c468125dd7325df44c5b27ac1252a05de6cf0a27dde21450907b027fcf5fdb8e | def buy(self, listing_id: int, quantity: int):
'\n\n :param listing_id: The listing ID.\n :param quantity: The quantity to buy.\n\n BETA: This method is still in beta and might contain bugs.\n\n Buy a listing.\n '
item = self.get(listing_id)
owner = self.get_signer_address... | :param listing_id: The listing ID.
:param quantity: The quantity to buy.
BETA: This method is still in beta and might contain bugs.
Buy a listing. | thirdweb/modules/market.py | buy | princetonwong/python-sdk | 1 | python | def buy(self, listing_id: int, quantity: int):
'\n\n :param listing_id: The listing ID.\n :param quantity: The quantity to buy.\n\n BETA: This method is still in beta and might contain bugs.\n\n Buy a listing.\n '
item = self.get(listing_id)
owner = self.get_signer_address... | def buy(self, listing_id: int, quantity: int):
'\n\n :param listing_id: The listing ID.\n :param quantity: The quantity to buy.\n\n BETA: This method is still in beta and might contain bugs.\n\n Buy a listing.\n '
item = self.get(listing_id)
owner = self.get_signer_address... |
e67c1d167f90f9cfc1ad7314036dad11a53d96c7678a0149418d31213493a68c | def set_market_fee_bps(self, amount: int):
'\n :note: For example, if you want to set the market fee to 0.1%, set amount to 10 (which is 0.1 x 100).\n :param amount: The amount of basis points.\n\n Set the market fee in basis points.\n\n '
tx = self.__abi_module.set_market_fee_bps.b... | :note: For example, if you want to set the market fee to 0.1%, set amount to 10 (which is 0.1 x 100).
:param amount: The amount of basis points.
Set the market fee in basis points. | thirdweb/modules/market.py | set_market_fee_bps | princetonwong/python-sdk | 1 | python | def set_market_fee_bps(self, amount: int):
'\n :note: For example, if you want to set the market fee to 0.1%, set amount to 10 (which is 0.1 x 100).\n :param amount: The amount of basis points.\n\n Set the market fee in basis points.\n\n '
tx = self.__abi_module.set_market_fee_bps.b... | def set_market_fee_bps(self, amount: int):
'\n :note: For example, if you want to set the market fee to 0.1%, set amount to 10 (which is 0.1 x 100).\n :param amount: The amount of basis points.\n\n Set the market fee in basis points.\n\n '
tx = self.__abi_module.set_market_fee_bps.b... |
25814feda3768d73532b2d8c96047d91759e50580b0f0399bcb2fd83399b3fed | def get(self, listing_id) -> Listing:
'\n :param listing_id: The listing ID.\n :return: Details about the listing.\n\n Get the details about a listing.\n\n '
listing = MarketListing(**self.__abi_module.get_listing.call(listing_id))
if (listing.listingId != listing_id):
ra... | :param listing_id: The listing ID.
:return: Details about the listing.
Get the details about a listing. | thirdweb/modules/market.py | get | princetonwong/python-sdk | 1 | python | def get(self, listing_id) -> Listing:
'\n :param listing_id: The listing ID.\n :return: Details about the listing.\n\n Get the details about a listing.\n\n '
listing = MarketListing(**self.__abi_module.get_listing.call(listing_id))
if (listing.listingId != listing_id):
ra... | def get(self, listing_id) -> Listing:
'\n :param listing_id: The listing ID.\n :return: Details about the listing.\n\n Get the details about a listing.\n\n '
listing = MarketListing(**self.__abi_module.get_listing.call(listing_id))
if (listing.listingId != listing_id):
ra... |
c800de826252cd79c979c53207cf6541c7ca85a35203e02bef1459679900b42f | def set_module_metadata(self, metadata: str):
'\n :param metadata: The metadata to set\n\n Sets the metadata for the module\n\n '
uri = self.get_storage().upload_metadata(metadata, self.address, self.get_signer_address())
tx = self.__abi_module.set_contract_uri.build_transaction(uri, se... | :param metadata: The metadata to set
Sets the metadata for the module | thirdweb/modules/market.py | set_module_metadata | princetonwong/python-sdk | 1 | python | def set_module_metadata(self, metadata: str):
'\n :param metadata: The metadata to set\n\n Sets the metadata for the module\n\n '
uri = self.get_storage().upload_metadata(metadata, self.address, self.get_signer_address())
tx = self.__abi_module.set_contract_uri.build_transaction(uri, se... | def set_module_metadata(self, metadata: str):
'\n :param metadata: The metadata to set\n\n Sets the metadata for the module\n\n '
uri = self.get_storage().upload_metadata(metadata, self.address, self.get_signer_address())
tx = self.__abi_module.set_contract_uri.build_transaction(uri, se... |
a6607ccb2867f5e89dc4554b351f382275165511f526cd8c236840418aaf9ad6 | def get_listing(self, listing_id: int) -> Listing:
'\n :param listing_id: The listing ID.\n :return: Details about the listing.\n\n Get the details about a listing.\n\n '
return self.get(listing_id) | :param listing_id: The listing ID.
:return: Details about the listing.
Get the details about a listing. | thirdweb/modules/market.py | get_listing | princetonwong/python-sdk | 1 | python | def get_listing(self, listing_id: int) -> Listing:
'\n :param listing_id: The listing ID.\n :return: Details about the listing.\n\n Get the details about a listing.\n\n '
return self.get(listing_id) | def get_listing(self, listing_id: int) -> Listing:
'\n :param listing_id: The listing ID.\n :return: Details about the listing.\n\n Get the details about a listing.\n\n '
return self.get(listing_id)<|docstring|>:param listing_id: The listing ID.
:return: Details about the listing.
G... |
8226b71128fed8ef111b2e8fbc37e3715e3a0932a8f24e9ae22001e66741f742 | def get_all(self, filter: Filter=None) -> List[Listing]:
'\n :param filter: Filter to apply to the listings.\n :return: A list of all the listings in the market.\n\n Returns all the listings.\n\n '
if (filter is None):
return self.__abi_module.get_all_listings.call()
elif... | :param filter: Filter to apply to the listings.
:return: A list of all the listings in the market.
Returns all the listings. | thirdweb/modules/market.py | get_all | princetonwong/python-sdk | 1 | python | def get_all(self, filter: Filter=None) -> List[Listing]:
'\n :param filter: Filter to apply to the listings.\n :return: A list of all the listings in the market.\n\n Returns all the listings.\n\n '
if (filter is None):
return self.__abi_module.get_all_listings.call()
elif... | def get_all(self, filter: Filter=None) -> List[Listing]:
'\n :param filter: Filter to apply to the listings.\n :return: A list of all the listings in the market.\n\n Returns all the listings.\n\n '
if (filter is None):
return self.__abi_module.get_all_listings.call()
elif... |
501f6363be8179a6906b5493472202b5d93d63590c6ac91e3db0346e8e96bc9c | def total_listings(self) -> int:
'\n :return: The total supply of the market.\n\n Returns the total supply of the market.\n\n '
return self.__abi_module.total_listings.call() | :return: The total supply of the market.
Returns the total supply of the market. | thirdweb/modules/market.py | total_listings | princetonwong/python-sdk | 1 | python | def total_listings(self) -> int:
'\n :return: The total supply of the market.\n\n Returns the total supply of the market.\n\n '
return self.__abi_module.total_listings.call() | def total_listings(self) -> int:
'\n :return: The total supply of the market.\n\n Returns the total supply of the market.\n\n '
return self.__abi_module.total_listings.call()<|docstring|>:return: The total supply of the market.
Returns the total supply of the market.<|endoftext|> |
05100d696634250c024265843a19ce4b81ade00f412e51b1f7c98b0edc7477d7 | def get_abi_module(self) -> Market:
'\n :return: The ABI module for the market.\n\n Returns the ABI module for the market.\n\n '
return self.__abi_module | :return: The ABI module for the market.
Returns the ABI module for the market. | thirdweb/modules/market.py | get_abi_module | princetonwong/python-sdk | 1 | python | def get_abi_module(self) -> Market:
'\n :return: The ABI module for the market.\n\n Returns the ABI module for the market.\n\n '
return self.__abi_module | def get_abi_module(self) -> Market:
'\n :return: The ABI module for the market.\n\n Returns the ABI module for the market.\n\n '
return self.__abi_module<|docstring|>:return: The ABI module for the market.
Returns the ABI module for the market.<|endoftext|> |
a426c260c47830a2ae8382eab3e4fd4a4530c312dd4e82988b7e6b0e2055d333 | def _logpdf(self, Fi, Yi):
'Compute logpdf for one sample'
F = Fi.reshape(self.df, (- 1))
W = np.sum((F[(..., None)] @ F[(:, None)]), 0)
Si = self._construct_symm(Yi[None])[0]
scale = (W / self.df)
numerator = ((((self.df - self.D) - 1) / 2) * np.log(np.linalg.det(Si)))
denominator = (((((se... | Compute logpdf for one sample | likelihoods/wishart.py | _logpdf | skitimoon/HetMOGP | 0 | python | def _logpdf(self, Fi, Yi):
F = Fi.reshape(self.df, (- 1))
W = np.sum((F[(..., None)] @ F[(:, None)]), 0)
Si = self._construct_symm(Yi[None])[0]
scale = (W / self.df)
numerator = ((((self.df - self.D) - 1) / 2) * np.log(np.linalg.det(Si)))
denominator = (((((self.df * self.D) / 2) * np.log(2... | def _logpdf(self, Fi, Yi):
F = Fi.reshape(self.df, (- 1))
W = np.sum((F[(..., None)] @ F[(:, None)]), 0)
Si = self._construct_symm(Yi[None])[0]
scale = (W / self.df)
numerator = ((((self.df - self.D) - 1) / 2) * np.log(np.linalg.det(Si)))
denominator = (((((self.df * self.D) / 2) * np.log(2... |
98d6c3cfdc3e1ff8948db1e208ffd550b22e70d48459b2b2cc3d6143664ebbf1 | def export_policies(self):
'\n Returns a QuerySet of all routing policies to evaluate on export.\n '
raise NotImplementedError() | Returns a QuerySet of all routing policies to evaluate on export. | peering/models/mixins.py | export_policies | jamesditrapani/peering-manager | 0 | python | def export_policies(self):
'\n \n '
raise NotImplementedError() | def export_policies(self):
'\n \n '
raise NotImplementedError()<|docstring|>Returns a QuerySet of all routing policies to evaluate on export.<|endoftext|> |
ff7d1c04929766fb68f9c797e57f28249f545e80b7ad123ed0ad45cd753c699f | def import_policies(self):
'\n Returns a QuerySet of all routing policies to evaluate on import.\n '
raise NotImplementedError() | Returns a QuerySet of all routing policies to evaluate on import. | peering/models/mixins.py | import_policies | jamesditrapani/peering-manager | 0 | python | def import_policies(self):
'\n \n '
raise NotImplementedError() | def import_policies(self):
'\n \n '
raise NotImplementedError()<|docstring|>Returns a QuerySet of all routing policies to evaluate on import.<|endoftext|> |
2c2a04c3be622f9a797d2fd051482aab7ba2572b03254eb89322c558017776d8 | def policies(self):
'\n Returns a QuerySet of all routing policies.\n '
return (self.export_policies() & self.import_policies()) | Returns a QuerySet of all routing policies. | peering/models/mixins.py | policies | jamesditrapani/peering-manager | 0 | python | def policies(self):
'\n \n '
return (self.export_policies() & self.import_policies()) | def policies(self):
'\n \n '
return (self.export_policies() & self.import_policies())<|docstring|>Returns a QuerySet of all routing policies.<|endoftext|> |
abd854a1e3c2f8114d110d3f93d39131b9a421fd2b3d23e6a9ce3208c2bc7f72 | def find_first_duplicate(sequence: Sequence[Any]) -> Any:
'Finds first duplicate in an array (high complexity).\n\n Args:\n sequence: an array\n\n Returns:\n first duplicate item\n\n Examples:\n >>> assert find_first_duplicate("abccd") == "c"\n >>> assert find_first_duplicate([1... | Finds first duplicate in an array (high complexity).
Args:
sequence: an array
Returns:
first duplicate item
Examples:
>>> assert find_first_duplicate("abccd") == "c"
>>> assert find_first_duplicate([1, 2, 3, 4, 4, 5]) == 4 | kata/07/first_duplicate.py | find_first_duplicate | vyahello/upgrade-python-kata | 0 | python | def find_first_duplicate(sequence: Sequence[Any]) -> Any:
'Finds first duplicate in an array (high complexity).\n\n Args:\n sequence: an array\n\n Returns:\n first duplicate item\n\n Examples:\n >>> assert find_first_duplicate("abccd") == "c"\n >>> assert find_first_duplicate([1... | def find_first_duplicate(sequence: Sequence[Any]) -> Any:
'Finds first duplicate in an array (high complexity).\n\n Args:\n sequence: an array\n\n Returns:\n first duplicate item\n\n Examples:\n >>> assert find_first_duplicate("abccd") == "c"\n >>> assert find_first_duplicate([1... |
98e5d88398b4c3ffd855f0954c68b8040b275fe818509105ca72fb192c49f282 | def find_first_duplicate_v2(sequence: Sequence[Any]) -> Any:
'Finds first duplicate in an array (high complexity).\n\n Args:\n sequence: an array\n\n Returns:\n first duplicate item\n\n Examples:\n >>> assert find_first_duplicate_v2("abccd") == "c"\n >>> assert find_first_duplic... | Finds first duplicate in an array (high complexity).
Args:
sequence: an array
Returns:
first duplicate item
Examples:
>>> assert find_first_duplicate_v2("abccd") == "c"
>>> assert find_first_duplicate_v2([1, 2, 3, 4, 4, 5]) == 4 | kata/07/first_duplicate.py | find_first_duplicate_v2 | vyahello/upgrade-python-kata | 0 | python | def find_first_duplicate_v2(sequence: Sequence[Any]) -> Any:
'Finds first duplicate in an array (high complexity).\n\n Args:\n sequence: an array\n\n Returns:\n first duplicate item\n\n Examples:\n >>> assert find_first_duplicate_v2("abccd") == "c"\n >>> assert find_first_duplic... | def find_first_duplicate_v2(sequence: Sequence[Any]) -> Any:
'Finds first duplicate in an array (high complexity).\n\n Args:\n sequence: an array\n\n Returns:\n first duplicate item\n\n Examples:\n >>> assert find_first_duplicate_v2("abccd") == "c"\n >>> assert find_first_duplic... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.