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
|
---|---|---|---|---|---|---|---|---|---|
b2a71ea80fb5dcb3a9d4be4dfff42c19c21ad98acdfcfa84f1c3aa137000c99a | @userlogset.command(name='leave')
async def user_leave_log(self, ctx: commands.Context, on_off: typing.Optional[bool]):
'Toggle logging when users leave the current server.\n\n If `on_off` is not provided, the state will be flipped.'
target_state = (on_off or (not (await self.config.guild(ctx.guild).leave())))
(await self.config.guild(ctx.guild).leave.set(target_state))
if target_state:
(await ctx.send('Logging users leaving is now enabled.'))
else:
(await ctx.send('Logging users leaving is now disabled.')) | Toggle logging when users leave the current server.
If `on_off` is not provided, the state will be flipped. | userlog/userlog.py | user_leave_log | salazar-brodart/enclave-cog | 0 | python | @userlogset.command(name='leave')
async def user_leave_log(self, ctx: commands.Context, on_off: typing.Optional[bool]):
'Toggle logging when users leave the current server.\n\n If `on_off` is not provided, the state will be flipped.'
target_state = (on_off or (not (await self.config.guild(ctx.guild).leave())))
(await self.config.guild(ctx.guild).leave.set(target_state))
if target_state:
(await ctx.send('Logging users leaving is now enabled.'))
else:
(await ctx.send('Logging users leaving is now disabled.')) | @userlogset.command(name='leave')
async def user_leave_log(self, ctx: commands.Context, on_off: typing.Optional[bool]):
'Toggle logging when users leave the current server.\n\n If `on_off` is not provided, the state will be flipped.'
target_state = (on_off or (not (await self.config.guild(ctx.guild).leave())))
(await self.config.guild(ctx.guild).leave.set(target_state))
if target_state:
(await ctx.send('Logging users leaving is now enabled.'))
else:
(await ctx.send('Logging users leaving is now disabled.'))<|docstring|>Toggle logging when users leave the current server.
If `on_off` is not provided, the state will be flipped.<|endoftext|> |
03d5f295144ac5445d09674efdc5d1f82430d2b766f7f752aae1459cd0d3eab2 | @userlogset.command(name='settings')
async def user_settings(self, ctx: commands.Context):
'See current settings.'
data = (await self.config.guild(ctx.guild).all())
channel = ctx.guild.get_channel((await self.config.guild(ctx.guild).channel()))
channel = ('None' if (not channel) else channel.mention)
embed = discord.Embed(colour=(await ctx.embed_colour()), timestamp=datetime.datetime.now())
embed.set_author(name=ctx.guild.name, icon_url=ctx.guild.icon_url)
embed.title = '**__User Log settings:__**'
embed.set_footer(text='*required to function properly')
embed.add_field(name='Channel*:', value=channel)
embed.add_field(name='Join:', value=str(data['join']))
embed.add_field(name='Leave:', value=str(data['leave']))
(await ctx.send(embed=embed)) | See current settings. | userlog/userlog.py | user_settings | salazar-brodart/enclave-cog | 0 | python | @userlogset.command(name='settings')
async def user_settings(self, ctx: commands.Context):
data = (await self.config.guild(ctx.guild).all())
channel = ctx.guild.get_channel((await self.config.guild(ctx.guild).channel()))
channel = ('None' if (not channel) else channel.mention)
embed = discord.Embed(colour=(await ctx.embed_colour()), timestamp=datetime.datetime.now())
embed.set_author(name=ctx.guild.name, icon_url=ctx.guild.icon_url)
embed.title = '**__User Log settings:__**'
embed.set_footer(text='*required to function properly')
embed.add_field(name='Channel*:', value=channel)
embed.add_field(name='Join:', value=str(data['join']))
embed.add_field(name='Leave:', value=str(data['leave']))
(await ctx.send(embed=embed)) | @userlogset.command(name='settings')
async def user_settings(self, ctx: commands.Context):
data = (await self.config.guild(ctx.guild).all())
channel = ctx.guild.get_channel((await self.config.guild(ctx.guild).channel()))
channel = ('None' if (not channel) else channel.mention)
embed = discord.Embed(colour=(await ctx.embed_colour()), timestamp=datetime.datetime.now())
embed.set_author(name=ctx.guild.name, icon_url=ctx.guild.icon_url)
embed.title = '**__User Log settings:__**'
embed.set_footer(text='*required to function properly')
embed.add_field(name='Channel*:', value=channel)
embed.add_field(name='Join:', value=str(data['join']))
embed.add_field(name='Leave:', value=str(data['leave']))
(await ctx.send(embed=embed))<|docstring|>See current settings.<|endoftext|> |
b46e04333c185697ae9c73fc730ea95897c4b129ac5616876fc2066a8beba52c | def __init__(self, name='User', *args, **kwargs):
'\n start the instance of dataView main window when it is called \n '
tk.Tk.__init__(self, *args, **kwargs)
self.user = name
self.resizable(0, 0)
self.title(setup.app_name)
self.iconbitmap(setup.icon)
self.check = False
self.protocol('WM_DELETE_WINDOW', self.quit)
self.container = ttk.Frame()
self.container.grid(column=0, row=0, sticky='NW')
self.container.grid_rowconfigure(0, weight=1)
self.container.grid_columnconfigure(0, weight=1)
self.frames = {}
menubar = tk.Menu(self.container)
filemenu = tk.Menu(menubar, tearoff=0)
filemenu.add_command(label='Choose Data Source', command=(lambda : selectFile('open', self)))
filemenu.add_command(label='Merge database', command=(lambda : self.openUpload()))
filemenu.add_command(label='Sign out', command=(lambda : showinfo('Unavailable', 'Function is not available, please come back for it later')))
filemenu.add_separator()
filemenu.add_command(label='Exit', command=self.quit)
DESmenu = tk.Menu(menubar, tearoff=0)
DESmenu.add_command(label='Gender', command=(lambda : self.show_frame(genderDES)))
DESmenu.add_separator()
DESmenu.add_command(label='Feature', command=(lambda : self.show_frame(featureDES)))
DESmenu.add_separator()
DESmenu.add_command(label='Location', command=(lambda : self.show_frame(locationDES)))
menubar.add_cascade(label='File', menu=filemenu)
menubar.add_cascade(label='Data view', menu=DESmenu)
tk.Tk.config(self, menu=menubar)
self.chatSession = Session(self.user)
self.loadDES()
self.userControl = UserControl()
self.dataHandler = DataHandler()
self.lastModified = self.dataHandler.checkRecord() | start the instance of dataView main window when it is called | view/dataView.py | __init__ | johndao1005/SDV602-Milestone3-QuangThanhDao | 1 | python | def __init__(self, name='User', *args, **kwargs):
'\n \n '
tk.Tk.__init__(self, *args, **kwargs)
self.user = name
self.resizable(0, 0)
self.title(setup.app_name)
self.iconbitmap(setup.icon)
self.check = False
self.protocol('WM_DELETE_WINDOW', self.quit)
self.container = ttk.Frame()
self.container.grid(column=0, row=0, sticky='NW')
self.container.grid_rowconfigure(0, weight=1)
self.container.grid_columnconfigure(0, weight=1)
self.frames = {}
menubar = tk.Menu(self.container)
filemenu = tk.Menu(menubar, tearoff=0)
filemenu.add_command(label='Choose Data Source', command=(lambda : selectFile('open', self)))
filemenu.add_command(label='Merge database', command=(lambda : self.openUpload()))
filemenu.add_command(label='Sign out', command=(lambda : showinfo('Unavailable', 'Function is not available, please come back for it later')))
filemenu.add_separator()
filemenu.add_command(label='Exit', command=self.quit)
DESmenu = tk.Menu(menubar, tearoff=0)
DESmenu.add_command(label='Gender', command=(lambda : self.show_frame(genderDES)))
DESmenu.add_separator()
DESmenu.add_command(label='Feature', command=(lambda : self.show_frame(featureDES)))
DESmenu.add_separator()
DESmenu.add_command(label='Location', command=(lambda : self.show_frame(locationDES)))
menubar.add_cascade(label='File', menu=filemenu)
menubar.add_cascade(label='Data view', menu=DESmenu)
tk.Tk.config(self, menu=menubar)
self.chatSession = Session(self.user)
self.loadDES()
self.userControl = UserControl()
self.dataHandler = DataHandler()
self.lastModified = self.dataHandler.checkRecord() | def __init__(self, name='User', *args, **kwargs):
'\n \n '
tk.Tk.__init__(self, *args, **kwargs)
self.user = name
self.resizable(0, 0)
self.title(setup.app_name)
self.iconbitmap(setup.icon)
self.check = False
self.protocol('WM_DELETE_WINDOW', self.quit)
self.container = ttk.Frame()
self.container.grid(column=0, row=0, sticky='NW')
self.container.grid_rowconfigure(0, weight=1)
self.container.grid_columnconfigure(0, weight=1)
self.frames = {}
menubar = tk.Menu(self.container)
filemenu = tk.Menu(menubar, tearoff=0)
filemenu.add_command(label='Choose Data Source', command=(lambda : selectFile('open', self)))
filemenu.add_command(label='Merge database', command=(lambda : self.openUpload()))
filemenu.add_command(label='Sign out', command=(lambda : showinfo('Unavailable', 'Function is not available, please come back for it later')))
filemenu.add_separator()
filemenu.add_command(label='Exit', command=self.quit)
DESmenu = tk.Menu(menubar, tearoff=0)
DESmenu.add_command(label='Gender', command=(lambda : self.show_frame(genderDES)))
DESmenu.add_separator()
DESmenu.add_command(label='Feature', command=(lambda : self.show_frame(featureDES)))
DESmenu.add_separator()
DESmenu.add_command(label='Location', command=(lambda : self.show_frame(locationDES)))
menubar.add_cascade(label='File', menu=filemenu)
menubar.add_cascade(label='Data view', menu=DESmenu)
tk.Tk.config(self, menu=menubar)
self.chatSession = Session(self.user)
self.loadDES()
self.userControl = UserControl()
self.dataHandler = DataHandler()
self.lastModified = self.dataHandler.checkRecord()<|docstring|>start the instance of dataView main window when it is called<|endoftext|> |
694779e0e433f3d853c0e6d646a168e71218564273cc583cbcaf29b1b7597e5b | def loadDES(self):
'\n Load the data explorer screen with the given data source else load the default data source\n '
for DES in (genderDES, locationDES, featureDES):
frame = DES(self.container, self)
frame.thread.start()
self.frames[DES] = frame
frame.grid(row=0, column=0, sticky='nsew')
self.updateDES = False
self.show_frame(featureDES) | Load the data explorer screen with the given data source else load the default data source | view/dataView.py | loadDES | johndao1005/SDV602-Milestone3-QuangThanhDao | 1 | python | def loadDES(self):
'\n \n '
for DES in (genderDES, locationDES, featureDES):
frame = DES(self.container, self)
frame.thread.start()
self.frames[DES] = frame
frame.grid(row=0, column=0, sticky='nsew')
self.updateDES = False
self.show_frame(featureDES) | def loadDES(self):
'\n \n '
for DES in (genderDES, locationDES, featureDES):
frame = DES(self.container, self)
frame.thread.start()
self.frames[DES] = frame
frame.grid(row=0, column=0, sticky='nsew')
self.updateDES = False
self.show_frame(featureDES)<|docstring|>Load the data explorer screen with the given data source else load the default data source<|endoftext|> |
5bb98767a96e45e60beee775235d2cd153f748657cc5ebba2da3ea7ac9e01108 | def refresh(self):
'redraw the graph to retrieve the latest data or render the upload data\n '
for DES in (genderDES, locationDES, featureDES):
frame = self.frames[DES]
frame.draw_graph(frame.DES) | redraw the graph to retrieve the latest data or render the upload data | view/dataView.py | refresh | johndao1005/SDV602-Milestone3-QuangThanhDao | 1 | python | def refresh(self):
'\n '
for DES in (genderDES, locationDES, featureDES):
frame = self.frames[DES]
frame.draw_graph(frame.DES) | def refresh(self):
'\n '
for DES in (genderDES, locationDES, featureDES):
frame = self.frames[DES]
frame.draw_graph(frame.DES)<|docstring|>redraw the graph to retrieve the latest data or render the upload data<|endoftext|> |
889bd72587d8bd0cd13ebf7418bd2ad38f63800f8ac664dcb59c4e99b0924d86 | def show_frame(self, newFrame):
'moving between data explorer screen \n Args:\n newFrame (object): the screen to be presented \n '
frame = self.frames[newFrame]
self.DES = frame.frametype
self.chatSession.switch_DES(self.DES)
frame.tkraise() | moving between data explorer screen
Args:
newFrame (object): the screen to be presented | view/dataView.py | show_frame | johndao1005/SDV602-Milestone3-QuangThanhDao | 1 | python | def show_frame(self, newFrame):
'moving between data explorer screen \n Args:\n newFrame (object): the screen to be presented \n '
frame = self.frames[newFrame]
self.DES = frame.frametype
self.chatSession.switch_DES(self.DES)
frame.tkraise() | def show_frame(self, newFrame):
'moving between data explorer screen \n Args:\n newFrame (object): the screen to be presented \n '
frame = self.frames[newFrame]
self.DES = frame.frametype
self.chatSession.switch_DES(self.DES)
frame.tkraise()<|docstring|>moving between data explorer screen
Args:
newFrame (object): the screen to be presented<|endoftext|> |
1d0b4cd88bbdab67ecd1869f81180414e002f13b69af6bb2a8a9fcd41a06a5d4 | def uploadWindow(self):
'\n start a Top level window (pop up window) which attached to the Tk(main window)\n '
self.check = True
self.upload = tk.Toplevel()
self.upload.title(setup.app_name)
self.upload.iconbitmap(setup.icon)
options = {'padx': 10, 'pady': 5}
label = ttk.Label(self.upload, text='Upload').grid(column=0, row=0, **options, columnspan=5)
self.upload.geometry('420x200+1000+200')
self.upload.protocol('WM_DELETE_WINDOW', self.closeUpload)
target = tk.StringVar()
label = ttk.Label(self.upload, text='Upload File').grid(column=0, row=2, **options)
text = tk.Entry()
self.target_entry = tk.Entry(self.upload, textvariable=target)
self.target_entry.grid(column=1, row=2, **options, columnspan=3)
browse_file = ttk.Button(self.upload, text='Select', command=(lambda : selectFile('upload', self.target_entry))).grid(column=4, row=2, **setup.pad10)
merge_btn = ttk.Button(self.upload, text='Upload', command=(lambda : mergeFiles(self.target_entry.get(), self))).grid(column=1, row=4, **setup.pad10)
quit_btn = ttk.Button(self.upload, text='Quit', command=(lambda : self.closeUpload())).grid(column=2, row=4, **setup.pad10) | start a Top level window (pop up window) which attached to the Tk(main window) | view/dataView.py | uploadWindow | johndao1005/SDV602-Milestone3-QuangThanhDao | 1 | python | def uploadWindow(self):
'\n \n '
self.check = True
self.upload = tk.Toplevel()
self.upload.title(setup.app_name)
self.upload.iconbitmap(setup.icon)
options = {'padx': 10, 'pady': 5}
label = ttk.Label(self.upload, text='Upload').grid(column=0, row=0, **options, columnspan=5)
self.upload.geometry('420x200+1000+200')
self.upload.protocol('WM_DELETE_WINDOW', self.closeUpload)
target = tk.StringVar()
label = ttk.Label(self.upload, text='Upload File').grid(column=0, row=2, **options)
text = tk.Entry()
self.target_entry = tk.Entry(self.upload, textvariable=target)
self.target_entry.grid(column=1, row=2, **options, columnspan=3)
browse_file = ttk.Button(self.upload, text='Select', command=(lambda : selectFile('upload', self.target_entry))).grid(column=4, row=2, **setup.pad10)
merge_btn = ttk.Button(self.upload, text='Upload', command=(lambda : mergeFiles(self.target_entry.get(), self))).grid(column=1, row=4, **setup.pad10)
quit_btn = ttk.Button(self.upload, text='Quit', command=(lambda : self.closeUpload())).grid(column=2, row=4, **setup.pad10) | def uploadWindow(self):
'\n \n '
self.check = True
self.upload = tk.Toplevel()
self.upload.title(setup.app_name)
self.upload.iconbitmap(setup.icon)
options = {'padx': 10, 'pady': 5}
label = ttk.Label(self.upload, text='Upload').grid(column=0, row=0, **options, columnspan=5)
self.upload.geometry('420x200+1000+200')
self.upload.protocol('WM_DELETE_WINDOW', self.closeUpload)
target = tk.StringVar()
label = ttk.Label(self.upload, text='Upload File').grid(column=0, row=2, **options)
text = tk.Entry()
self.target_entry = tk.Entry(self.upload, textvariable=target)
self.target_entry.grid(column=1, row=2, **options, columnspan=3)
browse_file = ttk.Button(self.upload, text='Select', command=(lambda : selectFile('upload', self.target_entry))).grid(column=4, row=2, **setup.pad10)
merge_btn = ttk.Button(self.upload, text='Upload', command=(lambda : mergeFiles(self.target_entry.get(), self))).grid(column=1, row=4, **setup.pad10)
quit_btn = ttk.Button(self.upload, text='Quit', command=(lambda : self.closeUpload())).grid(column=2, row=4, **setup.pad10)<|docstring|>start a Top level window (pop up window) which attached to the Tk(main window)<|endoftext|> |
239ccec46d206177fc1173589d28535cd06daa7ad2ccd28f1b11c2b2918f616c | def openUpload(self):
'check if an instance of upload event is exist, then open the upload window\n '
if (self.check == False):
self.uploadWindow() | check if an instance of upload event is exist, then open the upload window | view/dataView.py | openUpload | johndao1005/SDV602-Milestone3-QuangThanhDao | 1 | python | def openUpload(self):
'\n '
if (self.check == False):
self.uploadWindow() | def openUpload(self):
'\n '
if (self.check == False):
self.uploadWindow()<|docstring|>check if an instance of upload event is exist, then open the upload window<|endoftext|> |
722cd2405f33b0470d36557b505f6c9233604bbb662db741c47b9a0a6865db97 | def closeUpload(self):
'close the upload window and ensure the check if turn off to open new window\n '
self.check = False
self.upload.destroy() | close the upload window and ensure the check if turn off to open new window | view/dataView.py | closeUpload | johndao1005/SDV602-Milestone3-QuangThanhDao | 1 | python | def closeUpload(self):
'\n '
self.check = False
self.upload.destroy() | def closeUpload(self):
'\n '
self.check = False
self.upload.destroy()<|docstring|>close the upload window and ensure the check if turn off to open new window<|endoftext|> |
bb5b64e9565f743c41d827daa5797a6493e0d96276b6431806e7aad108d31ee5 | def setup_platform(hass, config, add_entities, discovery_info=None):
'Validate configuration, create devices and start monitoring thread.'
bt_device_id = config.get('bt_device_id')
beacons = config.get(CONF_BEACONS)
devices = []
for (dev_name, properties) in beacons.items():
namespace = get_from_conf(properties, CONF_NAMESPACE, 20)
instance = get_from_conf(properties, CONF_INSTANCE, 12)
name = properties.get(CONF_NAME, dev_name)
if ((instance is None) or (namespace is None)):
_LOGGER.error('Skipping %s', dev_name)
continue
devices.append(EddystoneTemp(name, namespace, instance))
if devices:
mon = Monitor(hass, devices, bt_device_id)
def monitor_stop(_service_or_event):
'Stop the monitor thread.'
_LOGGER.info('Stopping scanner for Eddystone beacons')
mon.stop()
def monitor_start(_service_or_event):
'Start the monitor thread.'
_LOGGER.info('Starting scanner for Eddystone beacons')
mon.start()
add_entities(devices)
mon.start()
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, monitor_stop)
hass.bus.listen_once(EVENT_HOMEASSISTANT_START, monitor_start)
else:
_LOGGER.warning('No devices were added') | Validate configuration, create devices and start monitoring thread. | homeassistant/components/eddystone_temperature/sensor.py | setup_platform | carlos-sarmiento/core | 7 | python | def setup_platform(hass, config, add_entities, discovery_info=None):
bt_device_id = config.get('bt_device_id')
beacons = config.get(CONF_BEACONS)
devices = []
for (dev_name, properties) in beacons.items():
namespace = get_from_conf(properties, CONF_NAMESPACE, 20)
instance = get_from_conf(properties, CONF_INSTANCE, 12)
name = properties.get(CONF_NAME, dev_name)
if ((instance is None) or (namespace is None)):
_LOGGER.error('Skipping %s', dev_name)
continue
devices.append(EddystoneTemp(name, namespace, instance))
if devices:
mon = Monitor(hass, devices, bt_device_id)
def monitor_stop(_service_or_event):
'Stop the monitor thread.'
_LOGGER.info('Stopping scanner for Eddystone beacons')
mon.stop()
def monitor_start(_service_or_event):
'Start the monitor thread.'
_LOGGER.info('Starting scanner for Eddystone beacons')
mon.start()
add_entities(devices)
mon.start()
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, monitor_stop)
hass.bus.listen_once(EVENT_HOMEASSISTANT_START, monitor_start)
else:
_LOGGER.warning('No devices were added') | def setup_platform(hass, config, add_entities, discovery_info=None):
bt_device_id = config.get('bt_device_id')
beacons = config.get(CONF_BEACONS)
devices = []
for (dev_name, properties) in beacons.items():
namespace = get_from_conf(properties, CONF_NAMESPACE, 20)
instance = get_from_conf(properties, CONF_INSTANCE, 12)
name = properties.get(CONF_NAME, dev_name)
if ((instance is None) or (namespace is None)):
_LOGGER.error('Skipping %s', dev_name)
continue
devices.append(EddystoneTemp(name, namespace, instance))
if devices:
mon = Monitor(hass, devices, bt_device_id)
def monitor_stop(_service_or_event):
'Stop the monitor thread.'
_LOGGER.info('Stopping scanner for Eddystone beacons')
mon.stop()
def monitor_start(_service_or_event):
'Start the monitor thread.'
_LOGGER.info('Starting scanner for Eddystone beacons')
mon.start()
add_entities(devices)
mon.start()
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, monitor_stop)
hass.bus.listen_once(EVENT_HOMEASSISTANT_START, monitor_start)
else:
_LOGGER.warning('No devices were added')<|docstring|>Validate configuration, create devices and start monitoring thread.<|endoftext|> |
7d5d9ad53365bcee0fde09b29860f5162b665701d791b026bf7e677adcff0156 | def get_from_conf(config, config_key, length):
'Retrieve value from config and validate length.'
string = config.get(config_key)
if (len(string) != length):
_LOGGER.error('Error in configuration parameter %s: Must be exactly %d bytes. Device will not be added', config_key, (length / 2))
return None
return string | Retrieve value from config and validate length. | homeassistant/components/eddystone_temperature/sensor.py | get_from_conf | carlos-sarmiento/core | 7 | python | def get_from_conf(config, config_key, length):
string = config.get(config_key)
if (len(string) != length):
_LOGGER.error('Error in configuration parameter %s: Must be exactly %d bytes. Device will not be added', config_key, (length / 2))
return None
return string | def get_from_conf(config, config_key, length):
string = config.get(config_key)
if (len(string) != length):
_LOGGER.error('Error in configuration parameter %s: Must be exactly %d bytes. Device will not be added', config_key, (length / 2))
return None
return string<|docstring|>Retrieve value from config and validate length.<|endoftext|> |
9d6151fd0d1c9625c867943c79f8e34cc5b4be85502a8ffd1ff2ace89dd04fe8 | def __init__(self, name, namespace, instance):
'Initialize a sensor.'
self._name = name
self.namespace = namespace
self.instance = instance
self.bt_addr = None
self.temperature = STATE_UNKNOWN | Initialize a sensor. | homeassistant/components/eddystone_temperature/sensor.py | __init__ | carlos-sarmiento/core | 7 | python | def __init__(self, name, namespace, instance):
self._name = name
self.namespace = namespace
self.instance = instance
self.bt_addr = None
self.temperature = STATE_UNKNOWN | def __init__(self, name, namespace, instance):
self._name = name
self.namespace = namespace
self.instance = instance
self.bt_addr = None
self.temperature = STATE_UNKNOWN<|docstring|>Initialize a sensor.<|endoftext|> |
c2acbec88b5ad13d0f458e2f3155e56fd2fabdb29665addbac450039553aa2e4 | @property
def name(self):
'Return the name of the sensor.'
return self._name | Return the name of the sensor. | homeassistant/components/eddystone_temperature/sensor.py | name | carlos-sarmiento/core | 7 | python | @property
def name(self):
return self._name | @property
def name(self):
return self._name<|docstring|>Return the name of the sensor.<|endoftext|> |
2332aa175059d2918f49427e214b876d8f44ca7e5ff2b4fd703bdce3ff585c16 | @property
def state(self):
'Return the state of the device.'
return self.temperature | Return the state of the device. | homeassistant/components/eddystone_temperature/sensor.py | state | carlos-sarmiento/core | 7 | python | @property
def state(self):
return self.temperature | @property
def state(self):
return self.temperature<|docstring|>Return the state of the device.<|endoftext|> |
6a1f8d39aa337235b71592b72b36a4861e76cf3dbec96ea5123b2885d4b9bcfb | @property
def unit_of_measurement(self):
'Return the unit the value is expressed in.'
return TEMP_CELSIUS | Return the unit the value is expressed in. | homeassistant/components/eddystone_temperature/sensor.py | unit_of_measurement | carlos-sarmiento/core | 7 | python | @property
def unit_of_measurement(self):
return TEMP_CELSIUS | @property
def unit_of_measurement(self):
return TEMP_CELSIUS<|docstring|>Return the unit the value is expressed in.<|endoftext|> |
e000b475afe38a8230ddadcf9d07474574da9ed13136a395c60ad5b7fc8a111d | @property
def should_poll(self):
'Return the polling state.'
return False | Return the polling state. | homeassistant/components/eddystone_temperature/sensor.py | should_poll | carlos-sarmiento/core | 7 | python | @property
def should_poll(self):
return False | @property
def should_poll(self):
return False<|docstring|>Return the polling state.<|endoftext|> |
58250094990d31f0d499d6a592a55ed336ba23d01d34f9264af778f2a4c6b619 | def __init__(self, hass, devices, bt_device_id):
'Construct interface object.'
self.hass = hass
self.devices = devices
self.bt_device_id = bt_device_id
def callback(bt_addr, _, packet, additional_info):
'Handle new packets.'
self.process_packet(additional_info['namespace'], additional_info['instance'], packet.temperature)
device_filters = [EddystoneFilter(d.namespace, d.instance) for d in devices]
self.scanner = BeaconScanner(callback, bt_device_id, device_filters, EddystoneTLMFrame)
self.scanning = False | Construct interface object. | homeassistant/components/eddystone_temperature/sensor.py | __init__ | carlos-sarmiento/core | 7 | python | def __init__(self, hass, devices, bt_device_id):
self.hass = hass
self.devices = devices
self.bt_device_id = bt_device_id
def callback(bt_addr, _, packet, additional_info):
'Handle new packets.'
self.process_packet(additional_info['namespace'], additional_info['instance'], packet.temperature)
device_filters = [EddystoneFilter(d.namespace, d.instance) for d in devices]
self.scanner = BeaconScanner(callback, bt_device_id, device_filters, EddystoneTLMFrame)
self.scanning = False | def __init__(self, hass, devices, bt_device_id):
self.hass = hass
self.devices = devices
self.bt_device_id = bt_device_id
def callback(bt_addr, _, packet, additional_info):
'Handle new packets.'
self.process_packet(additional_info['namespace'], additional_info['instance'], packet.temperature)
device_filters = [EddystoneFilter(d.namespace, d.instance) for d in devices]
self.scanner = BeaconScanner(callback, bt_device_id, device_filters, EddystoneTLMFrame)
self.scanning = False<|docstring|>Construct interface object.<|endoftext|> |
db290430865c48974604eeeabbd046850d758e354548814e688e07c2642fcbf0 | def start(self):
'Continuously scan for BLE advertisements.'
if (not self.scanning):
self.scanner.start()
self.scanning = True
else:
_LOGGER.debug('start() called, but scanner is already running') | Continuously scan for BLE advertisements. | homeassistant/components/eddystone_temperature/sensor.py | start | carlos-sarmiento/core | 7 | python | def start(self):
if (not self.scanning):
self.scanner.start()
self.scanning = True
else:
_LOGGER.debug('start() called, but scanner is already running') | def start(self):
if (not self.scanning):
self.scanner.start()
self.scanning = True
else:
_LOGGER.debug('start() called, but scanner is already running')<|docstring|>Continuously scan for BLE advertisements.<|endoftext|> |
d2c3e2d07bc3d65502ea285bdf07d3e8dde7072153d8b81fbcaa7b7cb481441f | def process_packet(self, namespace, instance, temperature):
'Assign temperature to device.'
_LOGGER.debug('Received temperature for <%s,%s>: %d', namespace, instance, temperature)
for dev in self.devices:
if ((dev.namespace == namespace) and (dev.instance == instance)):
if (dev.temperature != temperature):
dev.temperature = temperature
dev.schedule_update_ha_state() | Assign temperature to device. | homeassistant/components/eddystone_temperature/sensor.py | process_packet | carlos-sarmiento/core | 7 | python | def process_packet(self, namespace, instance, temperature):
_LOGGER.debug('Received temperature for <%s,%s>: %d', namespace, instance, temperature)
for dev in self.devices:
if ((dev.namespace == namespace) and (dev.instance == instance)):
if (dev.temperature != temperature):
dev.temperature = temperature
dev.schedule_update_ha_state() | def process_packet(self, namespace, instance, temperature):
_LOGGER.debug('Received temperature for <%s,%s>: %d', namespace, instance, temperature)
for dev in self.devices:
if ((dev.namespace == namespace) and (dev.instance == instance)):
if (dev.temperature != temperature):
dev.temperature = temperature
dev.schedule_update_ha_state()<|docstring|>Assign temperature to device.<|endoftext|> |
3bdecc18621538af1f8b5515e65e1993a432f3a7bd7a85d85738e9ea6d8bb0a5 | def stop(self):
'Signal runner to stop and join thread.'
if self.scanning:
_LOGGER.debug('Stopping...')
self.scanner.stop()
_LOGGER.debug('Stopped')
self.scanning = False
else:
_LOGGER.debug('stop() called but scanner was not running') | Signal runner to stop and join thread. | homeassistant/components/eddystone_temperature/sensor.py | stop | carlos-sarmiento/core | 7 | python | def stop(self):
if self.scanning:
_LOGGER.debug('Stopping...')
self.scanner.stop()
_LOGGER.debug('Stopped')
self.scanning = False
else:
_LOGGER.debug('stop() called but scanner was not running') | def stop(self):
if self.scanning:
_LOGGER.debug('Stopping...')
self.scanner.stop()
_LOGGER.debug('Stopped')
self.scanning = False
else:
_LOGGER.debug('stop() called but scanner was not running')<|docstring|>Signal runner to stop and join thread.<|endoftext|> |
c2a4bd0a60976825e993ec164f065c0ed128cfa7b5f3a9af6b510802d16ebb6d | def monitor_stop(_service_or_event):
'Stop the monitor thread.'
_LOGGER.info('Stopping scanner for Eddystone beacons')
mon.stop() | Stop the monitor thread. | homeassistant/components/eddystone_temperature/sensor.py | monitor_stop | carlos-sarmiento/core | 7 | python | def monitor_stop(_service_or_event):
_LOGGER.info('Stopping scanner for Eddystone beacons')
mon.stop() | def monitor_stop(_service_or_event):
_LOGGER.info('Stopping scanner for Eddystone beacons')
mon.stop()<|docstring|>Stop the monitor thread.<|endoftext|> |
e374e97e8437fbf3f763b1a6abb241d4d4309ed51c786ff417a65edc3ef6cdca | def monitor_start(_service_or_event):
'Start the monitor thread.'
_LOGGER.info('Starting scanner for Eddystone beacons')
mon.start() | Start the monitor thread. | homeassistant/components/eddystone_temperature/sensor.py | monitor_start | carlos-sarmiento/core | 7 | python | def monitor_start(_service_or_event):
_LOGGER.info('Starting scanner for Eddystone beacons')
mon.start() | def monitor_start(_service_or_event):
_LOGGER.info('Starting scanner for Eddystone beacons')
mon.start()<|docstring|>Start the monitor thread.<|endoftext|> |
d339d705e6ba46320b27ff39362fe4d8fcb85b43015358deb76d9e623c281bef | def callback(bt_addr, _, packet, additional_info):
'Handle new packets.'
self.process_packet(additional_info['namespace'], additional_info['instance'], packet.temperature) | Handle new packets. | homeassistant/components/eddystone_temperature/sensor.py | callback | carlos-sarmiento/core | 7 | python | def callback(bt_addr, _, packet, additional_info):
self.process_packet(additional_info['namespace'], additional_info['instance'], packet.temperature) | def callback(bt_addr, _, packet, additional_info):
self.process_packet(additional_info['namespace'], additional_info['instance'], packet.temperature)<|docstring|>Handle new packets.<|endoftext|> |
c6f8ab3e7b8afcead1f6569b6ad32dd8cc1ca0e40d8ffe4f43a17caa206ae13b | def apply_kNNO(Xs, Xt, ys=None, yt=None, scaling=True, k=10, contamination=0.1):
' Apply kNNO.\n k-distance is the distance of its k-th nearest neighbour in the dataset\n \n KNNO ranks all instances in a dataset by their k-distance, with higher distances signifying\n more anomalous instances\n Parameters\n ----------\n Xs : np.array of shape (n_samples, n_features), optional (default=None)\n The source instances.\n Xt : np.array of shape (n_samples, n_features), optional (default=None)\n The target instances.\n ys : np.array of shape (n_samples,), optional (default=None)\n The ground truth of the source instances.\n yt : np.array of shape (n_samples,), optional (default=None)\n The ground truth of the target instances.\n \n k : int (default=10)\n Number of nearest neighbors.\n\n contamination : float (default=0.1)\n The expected contamination in the data.\n\n Returns\n -------\n yt_scores : np.array of shape (n_samples,)\n Anomaly scores for the target instances.\n '
if (Xs is not None):
if (ys is None):
ys = np.zeros(Xs.shape[0])
(Xs, ys) = check_X_y(Xs, ys)
if (yt is None):
yt = np.zeros(Xt.shape[0])
(Xt, yt) = check_X_y(Xt, yt)
if scaling:
scaler = StandardScaler()
Xt = scaler.fit_transform(Xt)
tree = BallTree(Xt, leaf_size=16, metric='euclidean')
(D, _) = tree.query(Xt, k=(k + 1))
outlier_scores = D[(:, (- 1))].flatten()
gamma = (np.percentile(outlier_scores, int((100 * (1.0 - contamination)))) + 1e-10)
yt_scores = _squashing_function(outlier_scores, gamma)
return yt_scores | Apply kNNO.
k-distance is the distance of its k-th nearest neighbour in the dataset
KNNO ranks all instances in a dataset by their k-distance, with higher distances signifying
more anomalous instances
Parameters
----------
Xs : np.array of shape (n_samples, n_features), optional (default=None)
The source instances.
Xt : np.array of shape (n_samples, n_features), optional (default=None)
The target instances.
ys : np.array of shape (n_samples,), optional (default=None)
The ground truth of the source instances.
yt : np.array of shape (n_samples,), optional (default=None)
The ground truth of the target instances.
k : int (default=10)
Number of nearest neighbors.
contamination : float (default=0.1)
The expected contamination in the data.
Returns
-------
yt_scores : np.array of shape (n_samples,)
Anomaly scores for the target instances. | models/knno.py | apply_kNNO | weelingtan/LocIT | 0 | python | def apply_kNNO(Xs, Xt, ys=None, yt=None, scaling=True, k=10, contamination=0.1):
' Apply kNNO.\n k-distance is the distance of its k-th nearest neighbour in the dataset\n \n KNNO ranks all instances in a dataset by their k-distance, with higher distances signifying\n more anomalous instances\n Parameters\n ----------\n Xs : np.array of shape (n_samples, n_features), optional (default=None)\n The source instances.\n Xt : np.array of shape (n_samples, n_features), optional (default=None)\n The target instances.\n ys : np.array of shape (n_samples,), optional (default=None)\n The ground truth of the source instances.\n yt : np.array of shape (n_samples,), optional (default=None)\n The ground truth of the target instances.\n \n k : int (default=10)\n Number of nearest neighbors.\n\n contamination : float (default=0.1)\n The expected contamination in the data.\n\n Returns\n -------\n yt_scores : np.array of shape (n_samples,)\n Anomaly scores for the target instances.\n '
if (Xs is not None):
if (ys is None):
ys = np.zeros(Xs.shape[0])
(Xs, ys) = check_X_y(Xs, ys)
if (yt is None):
yt = np.zeros(Xt.shape[0])
(Xt, yt) = check_X_y(Xt, yt)
if scaling:
scaler = StandardScaler()
Xt = scaler.fit_transform(Xt)
tree = BallTree(Xt, leaf_size=16, metric='euclidean')
(D, _) = tree.query(Xt, k=(k + 1))
outlier_scores = D[(:, (- 1))].flatten()
gamma = (np.percentile(outlier_scores, int((100 * (1.0 - contamination)))) + 1e-10)
yt_scores = _squashing_function(outlier_scores, gamma)
return yt_scores | def apply_kNNO(Xs, Xt, ys=None, yt=None, scaling=True, k=10, contamination=0.1):
' Apply kNNO.\n k-distance is the distance of its k-th nearest neighbour in the dataset\n \n KNNO ranks all instances in a dataset by their k-distance, with higher distances signifying\n more anomalous instances\n Parameters\n ----------\n Xs : np.array of shape (n_samples, n_features), optional (default=None)\n The source instances.\n Xt : np.array of shape (n_samples, n_features), optional (default=None)\n The target instances.\n ys : np.array of shape (n_samples,), optional (default=None)\n The ground truth of the source instances.\n yt : np.array of shape (n_samples,), optional (default=None)\n The ground truth of the target instances.\n \n k : int (default=10)\n Number of nearest neighbors.\n\n contamination : float (default=0.1)\n The expected contamination in the data.\n\n Returns\n -------\n yt_scores : np.array of shape (n_samples,)\n Anomaly scores for the target instances.\n '
if (Xs is not None):
if (ys is None):
ys = np.zeros(Xs.shape[0])
(Xs, ys) = check_X_y(Xs, ys)
if (yt is None):
yt = np.zeros(Xt.shape[0])
(Xt, yt) = check_X_y(Xt, yt)
if scaling:
scaler = StandardScaler()
Xt = scaler.fit_transform(Xt)
tree = BallTree(Xt, leaf_size=16, metric='euclidean')
(D, _) = tree.query(Xt, k=(k + 1))
outlier_scores = D[(:, (- 1))].flatten()
gamma = (np.percentile(outlier_scores, int((100 * (1.0 - contamination)))) + 1e-10)
yt_scores = _squashing_function(outlier_scores, gamma)
return yt_scores<|docstring|>Apply kNNO.
k-distance is the distance of its k-th nearest neighbour in the dataset
KNNO ranks all instances in a dataset by their k-distance, with higher distances signifying
more anomalous instances
Parameters
----------
Xs : np.array of shape (n_samples, n_features), optional (default=None)
The source instances.
Xt : np.array of shape (n_samples, n_features), optional (default=None)
The target instances.
ys : np.array of shape (n_samples,), optional (default=None)
The ground truth of the source instances.
yt : np.array of shape (n_samples,), optional (default=None)
The ground truth of the target instances.
k : int (default=10)
Number of nearest neighbors.
contamination : float (default=0.1)
The expected contamination in the data.
Returns
-------
yt_scores : np.array of shape (n_samples,)
Anomaly scores for the target instances.<|endoftext|> |
61eebc5276bd4ad8983a63a3052e7c6af86e4eff078dd52fee7b422aea933ca7 | def _squashing_function(x, p):
' Compute the value of x under squashing function with parameter p. '
return (1.0 - np.exp((np.log(0.5) * np.power((x / p), 2)))) | Compute the value of x under squashing function with parameter p. | models/knno.py | _squashing_function | weelingtan/LocIT | 0 | python | def _squashing_function(x, p):
' '
return (1.0 - np.exp((np.log(0.5) * np.power((x / p), 2)))) | def _squashing_function(x, p):
' '
return (1.0 - np.exp((np.log(0.5) * np.power((x / p), 2))))<|docstring|>Compute the value of x under squashing function with parameter p.<|endoftext|> |
9ae3ff01aa7e5fea1e449f329211975dad8fa53c7b6099ecc357ee78e55a267c | def _pos_embeding(self, img, patched_img, pos_embed):
"Positiong embeding method.\n\n Resize the pos_embed, if the input image size doesn't match\n the training size.\n Args:\n img (torch.Tensor): The inference image tensor, the shape\n must be [B, C, H, W].\n patched_img (torch.Tensor): The patched image, it should be\n shape of [B, L1, C].\n pos_embed (torch.Tensor): The pos_embed weighs, it should be\n shape of [B, L2, c].\n Return:\n torch.Tensor: The pos encoded image feature.\n "
assert ((patched_img.ndim == 3) and (pos_embed.ndim == 3)), 'the shapes of patched_img and pos_embed must be [B, L, C]'
(x_len, pos_len) = (patched_img.shape[1], pos_embed.shape[1])
if (x_len != pos_len):
if (pos_len == (((self.img_size[0] // self.patch_size) * (self.img_size[1] // self.patch_size)) + 1)):
pos_h = (self.img_size[0] // self.patch_size)
pos_w = (self.img_size[1] // self.patch_size)
else:
raise ValueError('Unexpected shape of pos_embed, got {}.'.format(pos_embed.shape))
pos_embed = self.resize_pos_embed(pos_embed, img.shape[2:], (pos_h, pos_w), self.patch_size, self.interpolate_mode)
return self.pos_drop((patched_img + pos_embed)) | Positiong embeding method.
Resize the pos_embed, if the input image size doesn't match
the training size.
Args:
img (torch.Tensor): The inference image tensor, the shape
must be [B, C, H, W].
patched_img (torch.Tensor): The patched image, it should be
shape of [B, L1, C].
pos_embed (torch.Tensor): The pos_embed weighs, it should be
shape of [B, L2, c].
Return:
torch.Tensor: The pos encoded image feature. | semantic_segmentation/mmseg/models/backbones/vit.py | _pos_embeding | YangYangGirl/UniFormer | 367 | python | def _pos_embeding(self, img, patched_img, pos_embed):
"Positiong embeding method.\n\n Resize the pos_embed, if the input image size doesn't match\n the training size.\n Args:\n img (torch.Tensor): The inference image tensor, the shape\n must be [B, C, H, W].\n patched_img (torch.Tensor): The patched image, it should be\n shape of [B, L1, C].\n pos_embed (torch.Tensor): The pos_embed weighs, it should be\n shape of [B, L2, c].\n Return:\n torch.Tensor: The pos encoded image feature.\n "
assert ((patched_img.ndim == 3) and (pos_embed.ndim == 3)), 'the shapes of patched_img and pos_embed must be [B, L, C]'
(x_len, pos_len) = (patched_img.shape[1], pos_embed.shape[1])
if (x_len != pos_len):
if (pos_len == (((self.img_size[0] // self.patch_size) * (self.img_size[1] // self.patch_size)) + 1)):
pos_h = (self.img_size[0] // self.patch_size)
pos_w = (self.img_size[1] // self.patch_size)
else:
raise ValueError('Unexpected shape of pos_embed, got {}.'.format(pos_embed.shape))
pos_embed = self.resize_pos_embed(pos_embed, img.shape[2:], (pos_h, pos_w), self.patch_size, self.interpolate_mode)
return self.pos_drop((patched_img + pos_embed)) | def _pos_embeding(self, img, patched_img, pos_embed):
"Positiong embeding method.\n\n Resize the pos_embed, if the input image size doesn't match\n the training size.\n Args:\n img (torch.Tensor): The inference image tensor, the shape\n must be [B, C, H, W].\n patched_img (torch.Tensor): The patched image, it should be\n shape of [B, L1, C].\n pos_embed (torch.Tensor): The pos_embed weighs, it should be\n shape of [B, L2, c].\n Return:\n torch.Tensor: The pos encoded image feature.\n "
assert ((patched_img.ndim == 3) and (pos_embed.ndim == 3)), 'the shapes of patched_img and pos_embed must be [B, L, C]'
(x_len, pos_len) = (patched_img.shape[1], pos_embed.shape[1])
if (x_len != pos_len):
if (pos_len == (((self.img_size[0] // self.patch_size) * (self.img_size[1] // self.patch_size)) + 1)):
pos_h = (self.img_size[0] // self.patch_size)
pos_w = (self.img_size[1] // self.patch_size)
else:
raise ValueError('Unexpected shape of pos_embed, got {}.'.format(pos_embed.shape))
pos_embed = self.resize_pos_embed(pos_embed, img.shape[2:], (pos_h, pos_w), self.patch_size, self.interpolate_mode)
return self.pos_drop((patched_img + pos_embed))<|docstring|>Positiong embeding method.
Resize the pos_embed, if the input image size doesn't match
the training size.
Args:
img (torch.Tensor): The inference image tensor, the shape
must be [B, C, H, W].
patched_img (torch.Tensor): The patched image, it should be
shape of [B, L1, C].
pos_embed (torch.Tensor): The pos_embed weighs, it should be
shape of [B, L2, c].
Return:
torch.Tensor: The pos encoded image feature.<|endoftext|> |
4e4d4b2b202d16ef3f28b09e62164773f354ae8d31257cb03c32552fe6826ca8 | @staticmethod
def resize_pos_embed(pos_embed, input_shpae, pos_shape, patch_size, mode):
'Resize pos_embed weights.\n\n Resize pos_embed using bicubic interpolate method.\n Args:\n pos_embed (torch.Tensor): pos_embed weights.\n input_shpae (tuple): Tuple for (input_h, intput_w).\n pos_shape (tuple): Tuple for (pos_h, pos_w).\n patch_size (int): Patch size.\n Return:\n torch.Tensor: The resized pos_embed of shape [B, L_new, C]\n '
assert (pos_embed.ndim == 3), 'shape of pos_embed must be [B, L, C]'
(input_h, input_w) = input_shpae
(pos_h, pos_w) = pos_shape
cls_token_weight = pos_embed[(:, 0)]
pos_embed_weight = pos_embed[(:, (((- 1) * pos_h) * pos_w):)]
pos_embed_weight = pos_embed_weight.reshape(1, pos_h, pos_w, pos_embed.shape[2]).permute(0, 3, 1, 2)
pos_embed_weight = F.interpolate(pos_embed_weight, size=[(input_h // patch_size), (input_w // patch_size)], align_corners=False, mode=mode)
cls_token_weight = cls_token_weight.unsqueeze(1)
pos_embed_weight = torch.flatten(pos_embed_weight, 2).transpose(1, 2)
pos_embed = torch.cat((cls_token_weight, pos_embed_weight), dim=1)
return pos_embed | Resize pos_embed weights.
Resize pos_embed using bicubic interpolate method.
Args:
pos_embed (torch.Tensor): pos_embed weights.
input_shpae (tuple): Tuple for (input_h, intput_w).
pos_shape (tuple): Tuple for (pos_h, pos_w).
patch_size (int): Patch size.
Return:
torch.Tensor: The resized pos_embed of shape [B, L_new, C] | semantic_segmentation/mmseg/models/backbones/vit.py | resize_pos_embed | YangYangGirl/UniFormer | 367 | python | @staticmethod
def resize_pos_embed(pos_embed, input_shpae, pos_shape, patch_size, mode):
'Resize pos_embed weights.\n\n Resize pos_embed using bicubic interpolate method.\n Args:\n pos_embed (torch.Tensor): pos_embed weights.\n input_shpae (tuple): Tuple for (input_h, intput_w).\n pos_shape (tuple): Tuple for (pos_h, pos_w).\n patch_size (int): Patch size.\n Return:\n torch.Tensor: The resized pos_embed of shape [B, L_new, C]\n '
assert (pos_embed.ndim == 3), 'shape of pos_embed must be [B, L, C]'
(input_h, input_w) = input_shpae
(pos_h, pos_w) = pos_shape
cls_token_weight = pos_embed[(:, 0)]
pos_embed_weight = pos_embed[(:, (((- 1) * pos_h) * pos_w):)]
pos_embed_weight = pos_embed_weight.reshape(1, pos_h, pos_w, pos_embed.shape[2]).permute(0, 3, 1, 2)
pos_embed_weight = F.interpolate(pos_embed_weight, size=[(input_h // patch_size), (input_w // patch_size)], align_corners=False, mode=mode)
cls_token_weight = cls_token_weight.unsqueeze(1)
pos_embed_weight = torch.flatten(pos_embed_weight, 2).transpose(1, 2)
pos_embed = torch.cat((cls_token_weight, pos_embed_weight), dim=1)
return pos_embed | @staticmethod
def resize_pos_embed(pos_embed, input_shpae, pos_shape, patch_size, mode):
'Resize pos_embed weights.\n\n Resize pos_embed using bicubic interpolate method.\n Args:\n pos_embed (torch.Tensor): pos_embed weights.\n input_shpae (tuple): Tuple for (input_h, intput_w).\n pos_shape (tuple): Tuple for (pos_h, pos_w).\n patch_size (int): Patch size.\n Return:\n torch.Tensor: The resized pos_embed of shape [B, L_new, C]\n '
assert (pos_embed.ndim == 3), 'shape of pos_embed must be [B, L, C]'
(input_h, input_w) = input_shpae
(pos_h, pos_w) = pos_shape
cls_token_weight = pos_embed[(:, 0)]
pos_embed_weight = pos_embed[(:, (((- 1) * pos_h) * pos_w):)]
pos_embed_weight = pos_embed_weight.reshape(1, pos_h, pos_w, pos_embed.shape[2]).permute(0, 3, 1, 2)
pos_embed_weight = F.interpolate(pos_embed_weight, size=[(input_h // patch_size), (input_w // patch_size)], align_corners=False, mode=mode)
cls_token_weight = cls_token_weight.unsqueeze(1)
pos_embed_weight = torch.flatten(pos_embed_weight, 2).transpose(1, 2)
pos_embed = torch.cat((cls_token_weight, pos_embed_weight), dim=1)
return pos_embed<|docstring|>Resize pos_embed weights.
Resize pos_embed using bicubic interpolate method.
Args:
pos_embed (torch.Tensor): pos_embed weights.
input_shpae (tuple): Tuple for (input_h, intput_w).
pos_shape (tuple): Tuple for (pos_h, pos_w).
patch_size (int): Patch size.
Return:
torch.Tensor: The resized pos_embed of shape [B, L_new, C]<|endoftext|> |
c8481a9d1cc3c42fb647ce776c240f12c826afe221abf723b4244cb5d29fa7f0 | def __init__(self, in_chans, out_chans, drop_prob):
'\n Args:\n in_chans (int): Number of channels in the input.\n out_chans (int): Number of channels in the output.\n drop_prob (float): Dropout probability.\n '
super().__init__()
self.in_chans = in_chans
self.out_chans = out_chans
self.drop_prob = drop_prob
self.layers = nn.Sequential(nn.Conv2d(in_chans, out_chans, kernel_size=3, padding=1), nn.InstanceNorm2d(out_chans), nn.ReLU(), nn.Dropout2d(drop_prob), nn.Conv2d(out_chans, out_chans, kernel_size=3, padding=1), nn.InstanceNorm2d(out_chans), nn.ReLU(), nn.Dropout2d(drop_prob)) | Args:
in_chans (int): Number of channels in the input.
out_chans (int): Number of channels in the output.
drop_prob (float): Dropout probability. | models/unet_v2v/unet_model.py | __init__ | seansegal/fastMRI | 2 | python | def __init__(self, in_chans, out_chans, drop_prob):
'\n Args:\n in_chans (int): Number of channels in the input.\n out_chans (int): Number of channels in the output.\n drop_prob (float): Dropout probability.\n '
super().__init__()
self.in_chans = in_chans
self.out_chans = out_chans
self.drop_prob = drop_prob
self.layers = nn.Sequential(nn.Conv2d(in_chans, out_chans, kernel_size=3, padding=1), nn.InstanceNorm2d(out_chans), nn.ReLU(), nn.Dropout2d(drop_prob), nn.Conv2d(out_chans, out_chans, kernel_size=3, padding=1), nn.InstanceNorm2d(out_chans), nn.ReLU(), nn.Dropout2d(drop_prob)) | def __init__(self, in_chans, out_chans, drop_prob):
'\n Args:\n in_chans (int): Number of channels in the input.\n out_chans (int): Number of channels in the output.\n drop_prob (float): Dropout probability.\n '
super().__init__()
self.in_chans = in_chans
self.out_chans = out_chans
self.drop_prob = drop_prob
self.layers = nn.Sequential(nn.Conv2d(in_chans, out_chans, kernel_size=3, padding=1), nn.InstanceNorm2d(out_chans), nn.ReLU(), nn.Dropout2d(drop_prob), nn.Conv2d(out_chans, out_chans, kernel_size=3, padding=1), nn.InstanceNorm2d(out_chans), nn.ReLU(), nn.Dropout2d(drop_prob))<|docstring|>Args:
in_chans (int): Number of channels in the input.
out_chans (int): Number of channels in the output.
drop_prob (float): Dropout probability.<|endoftext|> |
846259ea34fe15411e507626e7399dad3868fdc9e12f3c5bb713e3002b687825 | def forward(self, input):
'\n Args:\n input (torch.Tensor): Input tensor of shape [batch_size, self.in_chans, height, width]\n\n Returns:\n (torch.Tensor): Output tensor of shape [batch_size, self.out_chans, height, width]\n '
return self.layers(input) | Args:
input (torch.Tensor): Input tensor of shape [batch_size, self.in_chans, height, width]
Returns:
(torch.Tensor): Output tensor of shape [batch_size, self.out_chans, height, width] | models/unet_v2v/unet_model.py | forward | seansegal/fastMRI | 2 | python | def forward(self, input):
'\n Args:\n input (torch.Tensor): Input tensor of shape [batch_size, self.in_chans, height, width]\n\n Returns:\n (torch.Tensor): Output tensor of shape [batch_size, self.out_chans, height, width]\n '
return self.layers(input) | def forward(self, input):
'\n Args:\n input (torch.Tensor): Input tensor of shape [batch_size, self.in_chans, height, width]\n\n Returns:\n (torch.Tensor): Output tensor of shape [batch_size, self.out_chans, height, width]\n '
return self.layers(input)<|docstring|>Args:
input (torch.Tensor): Input tensor of shape [batch_size, self.in_chans, height, width]
Returns:
(torch.Tensor): Output tensor of shape [batch_size, self.out_chans, height, width]<|endoftext|> |
b40dde620709494b04cdd13caa13b6b90fb1efd370728477ce6a4b6ed3333d83 | def __init__(self, in_chans, out_chans, kv, drop_prob):
'\n Args:\n in_chans (int): Number of channels in the input.\n out_chans (int): Number of channels in the output.\n drop_prob (float): Dropout probability.\n '
super().__init__()
self.in_chans = in_chans
self.out_chans = out_chans
self.drop_prob = drop_prob
self.layers = nn.Sequential(nn.Conv3d(in_chans, out_chans, kernel_size=(kv, 3, 3), padding=(((kv - 1) // 2), 1, 1)), nn.InstanceNorm3d(out_chans), nn.ReLU(), nn.Dropout3d(drop_prob), nn.Conv3d(out_chans, out_chans, kernel_size=(kv, 3, 3), padding=(((kv - 1) // 2), 1, 1)), nn.InstanceNorm3d(out_chans), nn.ReLU(), nn.Dropout3d(drop_prob)) | Args:
in_chans (int): Number of channels in the input.
out_chans (int): Number of channels in the output.
drop_prob (float): Dropout probability. | models/unet_v2v/unet_model.py | __init__ | seansegal/fastMRI | 2 | python | def __init__(self, in_chans, out_chans, kv, drop_prob):
'\n Args:\n in_chans (int): Number of channels in the input.\n out_chans (int): Number of channels in the output.\n drop_prob (float): Dropout probability.\n '
super().__init__()
self.in_chans = in_chans
self.out_chans = out_chans
self.drop_prob = drop_prob
self.layers = nn.Sequential(nn.Conv3d(in_chans, out_chans, kernel_size=(kv, 3, 3), padding=(((kv - 1) // 2), 1, 1)), nn.InstanceNorm3d(out_chans), nn.ReLU(), nn.Dropout3d(drop_prob), nn.Conv3d(out_chans, out_chans, kernel_size=(kv, 3, 3), padding=(((kv - 1) // 2), 1, 1)), nn.InstanceNorm3d(out_chans), nn.ReLU(), nn.Dropout3d(drop_prob)) | def __init__(self, in_chans, out_chans, kv, drop_prob):
'\n Args:\n in_chans (int): Number of channels in the input.\n out_chans (int): Number of channels in the output.\n drop_prob (float): Dropout probability.\n '
super().__init__()
self.in_chans = in_chans
self.out_chans = out_chans
self.drop_prob = drop_prob
self.layers = nn.Sequential(nn.Conv3d(in_chans, out_chans, kernel_size=(kv, 3, 3), padding=(((kv - 1) // 2), 1, 1)), nn.InstanceNorm3d(out_chans), nn.ReLU(), nn.Dropout3d(drop_prob), nn.Conv3d(out_chans, out_chans, kernel_size=(kv, 3, 3), padding=(((kv - 1) // 2), 1, 1)), nn.InstanceNorm3d(out_chans), nn.ReLU(), nn.Dropout3d(drop_prob))<|docstring|>Args:
in_chans (int): Number of channels in the input.
out_chans (int): Number of channels in the output.
drop_prob (float): Dropout probability.<|endoftext|> |
846259ea34fe15411e507626e7399dad3868fdc9e12f3c5bb713e3002b687825 | def forward(self, input):
'\n Args:\n input (torch.Tensor): Input tensor of shape [batch_size, self.in_chans, height, width]\n\n Returns:\n (torch.Tensor): Output tensor of shape [batch_size, self.out_chans, height, width]\n '
return self.layers(input) | Args:
input (torch.Tensor): Input tensor of shape [batch_size, self.in_chans, height, width]
Returns:
(torch.Tensor): Output tensor of shape [batch_size, self.out_chans, height, width] | models/unet_v2v/unet_model.py | forward | seansegal/fastMRI | 2 | python | def forward(self, input):
'\n Args:\n input (torch.Tensor): Input tensor of shape [batch_size, self.in_chans, height, width]\n\n Returns:\n (torch.Tensor): Output tensor of shape [batch_size, self.out_chans, height, width]\n '
return self.layers(input) | def forward(self, input):
'\n Args:\n input (torch.Tensor): Input tensor of shape [batch_size, self.in_chans, height, width]\n\n Returns:\n (torch.Tensor): Output tensor of shape [batch_size, self.out_chans, height, width]\n '
return self.layers(input)<|docstring|>Args:
input (torch.Tensor): Input tensor of shape [batch_size, self.in_chans, height, width]
Returns:
(torch.Tensor): Output tensor of shape [batch_size, self.out_chans, height, width]<|endoftext|> |
bc7c409c8ce4a584e071e10d9916742818710fdee70cf1f58d1489fa0c97417a | def __init__(self, in_chans, out_chans, chans, num_pool_layers, drop_prob):
'\n Args:\n in_chans (int): Number of channels in the input to the U-Net model.\n out_chans (int): Number of channels in the output to the U-Net model.\n chans (int): Number of output channels of the first convolution layer.\n num_pool_layers (int): Number of down-sampling and up-sampling layers.\n drop_prob (float): Dropout probability.\n '
super().__init__()
self.in_chans = in_chans
self.out_chans = out_chans
self.chans = chans
self.num_pool_layers = num_pool_layers
self.drop_prob = drop_prob
self.down_sample_layers = nn.ModuleList([Conv3dBlock(in_chans, chans, 1, drop_prob)])
ch = chans
for i in range((num_pool_layers - 1)):
self.down_sample_layers += [Conv3dBlock(ch, (ch * 2), 3, drop_prob)]
ch *= 2
self.conv = Conv3dBlock(ch, ch, 1, drop_prob)
self.up_sample_layers = nn.ModuleList()
for i in range((num_pool_layers - 1)):
self.up_sample_layers += [Conv3dBlock((ch * 2), (ch // 2), 3, drop_prob)]
ch //= 2
self.up_sample_layers += [Conv3dBlock((ch * 2), ch, 1, drop_prob)]
self.conv2 = nn.Sequential(nn.Conv3d(ch, (ch // 2), padding=(1, 1, 1), kernel_size=(3, 3, 3)), nn.Conv3d((ch // 2), out_chans, padding=(0, 1, 1), kernel_size=(1, 3, 3)), nn.Conv3d(out_chans, out_chans, padding=(1, 1, 1), kernel_size=(3, 3, 3))) | Args:
in_chans (int): Number of channels in the input to the U-Net model.
out_chans (int): Number of channels in the output to the U-Net model.
chans (int): Number of output channels of the first convolution layer.
num_pool_layers (int): Number of down-sampling and up-sampling layers.
drop_prob (float): Dropout probability. | models/unet_v2v/unet_model.py | __init__ | seansegal/fastMRI | 2 | python | def __init__(self, in_chans, out_chans, chans, num_pool_layers, drop_prob):
'\n Args:\n in_chans (int): Number of channels in the input to the U-Net model.\n out_chans (int): Number of channels in the output to the U-Net model.\n chans (int): Number of output channels of the first convolution layer.\n num_pool_layers (int): Number of down-sampling and up-sampling layers.\n drop_prob (float): Dropout probability.\n '
super().__init__()
self.in_chans = in_chans
self.out_chans = out_chans
self.chans = chans
self.num_pool_layers = num_pool_layers
self.drop_prob = drop_prob
self.down_sample_layers = nn.ModuleList([Conv3dBlock(in_chans, chans, 1, drop_prob)])
ch = chans
for i in range((num_pool_layers - 1)):
self.down_sample_layers += [Conv3dBlock(ch, (ch * 2), 3, drop_prob)]
ch *= 2
self.conv = Conv3dBlock(ch, ch, 1, drop_prob)
self.up_sample_layers = nn.ModuleList()
for i in range((num_pool_layers - 1)):
self.up_sample_layers += [Conv3dBlock((ch * 2), (ch // 2), 3, drop_prob)]
ch //= 2
self.up_sample_layers += [Conv3dBlock((ch * 2), ch, 1, drop_prob)]
self.conv2 = nn.Sequential(nn.Conv3d(ch, (ch // 2), padding=(1, 1, 1), kernel_size=(3, 3, 3)), nn.Conv3d((ch // 2), out_chans, padding=(0, 1, 1), kernel_size=(1, 3, 3)), nn.Conv3d(out_chans, out_chans, padding=(1, 1, 1), kernel_size=(3, 3, 3))) | def __init__(self, in_chans, out_chans, chans, num_pool_layers, drop_prob):
'\n Args:\n in_chans (int): Number of channels in the input to the U-Net model.\n out_chans (int): Number of channels in the output to the U-Net model.\n chans (int): Number of output channels of the first convolution layer.\n num_pool_layers (int): Number of down-sampling and up-sampling layers.\n drop_prob (float): Dropout probability.\n '
super().__init__()
self.in_chans = in_chans
self.out_chans = out_chans
self.chans = chans
self.num_pool_layers = num_pool_layers
self.drop_prob = drop_prob
self.down_sample_layers = nn.ModuleList([Conv3dBlock(in_chans, chans, 1, drop_prob)])
ch = chans
for i in range((num_pool_layers - 1)):
self.down_sample_layers += [Conv3dBlock(ch, (ch * 2), 3, drop_prob)]
ch *= 2
self.conv = Conv3dBlock(ch, ch, 1, drop_prob)
self.up_sample_layers = nn.ModuleList()
for i in range((num_pool_layers - 1)):
self.up_sample_layers += [Conv3dBlock((ch * 2), (ch // 2), 3, drop_prob)]
ch //= 2
self.up_sample_layers += [Conv3dBlock((ch * 2), ch, 1, drop_prob)]
self.conv2 = nn.Sequential(nn.Conv3d(ch, (ch // 2), padding=(1, 1, 1), kernel_size=(3, 3, 3)), nn.Conv3d((ch // 2), out_chans, padding=(0, 1, 1), kernel_size=(1, 3, 3)), nn.Conv3d(out_chans, out_chans, padding=(1, 1, 1), kernel_size=(3, 3, 3)))<|docstring|>Args:
in_chans (int): Number of channels in the input to the U-Net model.
out_chans (int): Number of channels in the output to the U-Net model.
chans (int): Number of output channels of the first convolution layer.
num_pool_layers (int): Number of down-sampling and up-sampling layers.
drop_prob (float): Dropout probability.<|endoftext|> |
46cb722c72ed444fda1773288020672de336a8f9ca1d8d45a259b38a7dd53202 | def forward(self, input):
'\n Args:\n input (torch.Tensor): Input tensor of shape [batch_size, self.in_chans, height, width]\n\n Returns:\n (torch.Tensor): Output tensor of shape [batch_size, self.out_chans, height, width]\n '
stack = []
output = input
for (i, layer) in enumerate(self.down_sample_layers):
output = layer(output)
stack.append(output)
output = F.max_pool3d(output, kernel_size=2)
output = self.conv(output)
for (j, layer) in enumerate(self.up_sample_layers):
output = F.interpolate(output, scale_factor=2, mode='trilinear', align_corners=False)
skip_tensor = stack.pop()
d_diff = (skip_tensor.shape[2] - output.shape[2])
assert (d_diff <= 1)
padding = (0, 0, 0, 0, d_diff, 0)
output_padded = F.pad(output, padding)
output = torch.cat([output_padded, skip_tensor], dim=1)
output = layer(output)
output = self.conv2(output)
return output | Args:
input (torch.Tensor): Input tensor of shape [batch_size, self.in_chans, height, width]
Returns:
(torch.Tensor): Output tensor of shape [batch_size, self.out_chans, height, width] | models/unet_v2v/unet_model.py | forward | seansegal/fastMRI | 2 | python | def forward(self, input):
'\n Args:\n input (torch.Tensor): Input tensor of shape [batch_size, self.in_chans, height, width]\n\n Returns:\n (torch.Tensor): Output tensor of shape [batch_size, self.out_chans, height, width]\n '
stack = []
output = input
for (i, layer) in enumerate(self.down_sample_layers):
output = layer(output)
stack.append(output)
output = F.max_pool3d(output, kernel_size=2)
output = self.conv(output)
for (j, layer) in enumerate(self.up_sample_layers):
output = F.interpolate(output, scale_factor=2, mode='trilinear', align_corners=False)
skip_tensor = stack.pop()
d_diff = (skip_tensor.shape[2] - output.shape[2])
assert (d_diff <= 1)
padding = (0, 0, 0, 0, d_diff, 0)
output_padded = F.pad(output, padding)
output = torch.cat([output_padded, skip_tensor], dim=1)
output = layer(output)
output = self.conv2(output)
return output | def forward(self, input):
'\n Args:\n input (torch.Tensor): Input tensor of shape [batch_size, self.in_chans, height, width]\n\n Returns:\n (torch.Tensor): Output tensor of shape [batch_size, self.out_chans, height, width]\n '
stack = []
output = input
for (i, layer) in enumerate(self.down_sample_layers):
output = layer(output)
stack.append(output)
output = F.max_pool3d(output, kernel_size=2)
output = self.conv(output)
for (j, layer) in enumerate(self.up_sample_layers):
output = F.interpolate(output, scale_factor=2, mode='trilinear', align_corners=False)
skip_tensor = stack.pop()
d_diff = (skip_tensor.shape[2] - output.shape[2])
assert (d_diff <= 1)
padding = (0, 0, 0, 0, d_diff, 0)
output_padded = F.pad(output, padding)
output = torch.cat([output_padded, skip_tensor], dim=1)
output = layer(output)
output = self.conv2(output)
return output<|docstring|>Args:
input (torch.Tensor): Input tensor of shape [batch_size, self.in_chans, height, width]
Returns:
(torch.Tensor): Output tensor of shape [batch_size, self.out_chans, height, width]<|endoftext|> |
7f72a153c37b7628ab511dca3782f757d2e41ee910e0419fa573d5c64f11cbec | def load_iris(iris_path, shuffle=True, tsize=0.8):
'\n 加载iris数据\n '
data = pd.read_csv(iris_path, header=0, delimiter=',')
if shuffle:
data = utils.shuffle(data)
species_dict = {'Iris-setosa': 0, 'Iris-versicolor': 1, 'Iris-virginica': 2}
data['Species'] = data['Species'].map(species_dict)
data_x = np.array([data['SepalLengthCm'], data['SepalWidthCm'], data['PetalLengthCm'], data['PetalWidthCm']]).T
data_y = np.array(data['Species'])
(x_train, x_test, y_train, y_test) = train_test_split(data_x, data_y, train_size=tsize, test_size=(1 - tsize), shuffle=False)
return (x_train, x_test, y_train, y_test) | 加载iris数据 | coding/classifier/decision_boundary.py | load_iris | deep-learning-algorithm/cs231n | 1 | python | def load_iris(iris_path, shuffle=True, tsize=0.8):
'\n \n '
data = pd.read_csv(iris_path, header=0, delimiter=',')
if shuffle:
data = utils.shuffle(data)
species_dict = {'Iris-setosa': 0, 'Iris-versicolor': 1, 'Iris-virginica': 2}
data['Species'] = data['Species'].map(species_dict)
data_x = np.array([data['SepalLengthCm'], data['SepalWidthCm'], data['PetalLengthCm'], data['PetalWidthCm']]).T
data_y = np.array(data['Species'])
(x_train, x_test, y_train, y_test) = train_test_split(data_x, data_y, train_size=tsize, test_size=(1 - tsize), shuffle=False)
return (x_train, x_test, y_train, y_test) | def load_iris(iris_path, shuffle=True, tsize=0.8):
'\n \n '
data = pd.read_csv(iris_path, header=0, delimiter=',')
if shuffle:
data = utils.shuffle(data)
species_dict = {'Iris-setosa': 0, 'Iris-versicolor': 1, 'Iris-virginica': 2}
data['Species'] = data['Species'].map(species_dict)
data_x = np.array([data['SepalLengthCm'], data['SepalWidthCm'], data['PetalLengthCm'], data['PetalWidthCm']]).T
data_y = np.array(data['Species'])
(x_train, x_test, y_train, y_test) = train_test_split(data_x, data_y, train_size=tsize, test_size=(1 - tsize), shuffle=False)
return (x_train, x_test, y_train, y_test)<|docstring|>加载iris数据<|endoftext|> |
742f9b3c2bc22f7def11eb61507ac1802f484c8a797d8d376129c7c47c8bbf5c | def pca(X, ratio=0.99, **kwargs):
'\n pca降维\n :param X: 大小为NxM,其中M是个数,N是维度,每个字段已是零均值\n :param ratio: 表示投影均方误差和方差比值,默认为0.99,保持99%的方差\n :param kwargs: 字典参数,如果指定了k值,则直接计算\n :return: 降维后数据\n '
(N, M) = X.shape[:2]
C = (X.dot(X.T) / M)
(u, s, v) = np.linalg.svd(C)
k = 1
if ('k' in kwargs):
k = kwargs['k']
else:
while (k < N):
s_k = np.sum(s[:k])
s_N = np.sum(s)
if (((s_k * 1.0) / s_N) >= ratio):
break
k += 1
p = u.transpose()[:k]
y = p.dot(X)
return (y, p) | pca降维
:param X: 大小为NxM,其中M是个数,N是维度,每个字段已是零均值
:param ratio: 表示投影均方误差和方差比值,默认为0.99,保持99%的方差
:param kwargs: 字典参数,如果指定了k值,则直接计算
:return: 降维后数据 | coding/classifier/decision_boundary.py | pca | deep-learning-algorithm/cs231n | 1 | python | def pca(X, ratio=0.99, **kwargs):
'\n pca降维\n :param X: 大小为NxM,其中M是个数,N是维度,每个字段已是零均值\n :param ratio: 表示投影均方误差和方差比值,默认为0.99,保持99%的方差\n :param kwargs: 字典参数,如果指定了k值,则直接计算\n :return: 降维后数据\n '
(N, M) = X.shape[:2]
C = (X.dot(X.T) / M)
(u, s, v) = np.linalg.svd(C)
k = 1
if ('k' in kwargs):
k = kwargs['k']
else:
while (k < N):
s_k = np.sum(s[:k])
s_N = np.sum(s)
if (((s_k * 1.0) / s_N) >= ratio):
break
k += 1
p = u.transpose()[:k]
y = p.dot(X)
return (y, p) | def pca(X, ratio=0.99, **kwargs):
'\n pca降维\n :param X: 大小为NxM,其中M是个数,N是维度,每个字段已是零均值\n :param ratio: 表示投影均方误差和方差比值,默认为0.99,保持99%的方差\n :param kwargs: 字典参数,如果指定了k值,则直接计算\n :return: 降维后数据\n '
(N, M) = X.shape[:2]
C = (X.dot(X.T) / M)
(u, s, v) = np.linalg.svd(C)
k = 1
if ('k' in kwargs):
k = kwargs['k']
else:
while (k < N):
s_k = np.sum(s[:k])
s_N = np.sum(s)
if (((s_k * 1.0) / s_N) >= ratio):
break
k += 1
p = u.transpose()[:k]
y = p.dot(X)
return (y, p)<|docstring|>pca降维
:param X: 大小为NxM,其中M是个数,N是维度,每个字段已是零均值
:param ratio: 表示投影均方误差和方差比值,默认为0.99,保持99%的方差
:param kwargs: 字典参数,如果指定了k值,则直接计算
:return: 降维后数据<|endoftext|> |
ca018593104d6b0dd61e4217621e13539160c2609a5e06c020c095c244014be4 | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction):
'Persist instance data.'
super().__init__(web3_or_provider, contract_address)
self._underlying_method = contract_function | Persist instance data. | thirdweb/abi/multiwrap.py | __init__ | nftlabs/nftlabs-sdk-python | 30 | python | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction):
super().__init__(web3_or_provider, contract_address)
self._underlying_method = contract_function | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction):
super().__init__(web3_or_provider, contract_address)
self._underlying_method = contract_function<|docstring|>Persist instance data.<|endoftext|> |
295188694246f118f97e5b6b2195c517e2108aa00d9230f499edebf85ae46703 | def call(self, tx_params: Optional[TxParams]=None) -> Union[(bytes, str)]:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method().call(tx_params.as_dict())
return Union[(bytes, str)](returned) | Execute underlying contract method via eth_call.
:param tx_params: transaction parameters
:returns: the return value of the underlying method. | thirdweb/abi/multiwrap.py | call | nftlabs/nftlabs-sdk-python | 30 | python | def call(self, tx_params: Optional[TxParams]=None) -> Union[(bytes, str)]:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method().call(tx_params.as_dict())
return Union[(bytes, str)](returned) | def call(self, tx_params: Optional[TxParams]=None) -> Union[(bytes, str)]:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method().call(tx_params.as_dict())
return Union[(bytes, str)](returned)<|docstring|>Execute underlying contract method via eth_call.
:param tx_params: transaction parameters
:returns: the return value of the underlying method.<|endoftext|> |
9ea0157eb6440eac095230a57efab5746974fbf6138037de26bad21761597b37 | def send_transaction(self, tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().transact(tx_params.as_dict()) | Execute underlying contract method via eth_sendTransaction.
:param tx_params: transaction parameters | thirdweb/abi/multiwrap.py | send_transaction | nftlabs/nftlabs-sdk-python | 30 | python | def send_transaction(self, tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().transact(tx_params.as_dict()) | def send_transaction(self, tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().transact(tx_params.as_dict())<|docstring|>Execute underlying contract method via eth_sendTransaction.
:param tx_params: transaction parameters<|endoftext|> |
6f2a541c7014fdc8f155b3763c2bdb103b684bbe9b83febdadafc5995b919d1d | def build_transaction(self, tx_params: Optional[TxParams]=None) -> dict:
'Construct calldata to be used as input to the method.'
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().buildTransaction(tx_params.as_dict()) | Construct calldata to be used as input to the method. | thirdweb/abi/multiwrap.py | build_transaction | nftlabs/nftlabs-sdk-python | 30 | python | def build_transaction(self, tx_params: Optional[TxParams]=None) -> dict:
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().buildTransaction(tx_params.as_dict()) | def build_transaction(self, tx_params: Optional[TxParams]=None) -> dict:
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().buildTransaction(tx_params.as_dict())<|docstring|>Construct calldata to be used as input to the method.<|endoftext|> |
11d4f9b449306eaf388ea7867de46d23b67cc54826ff61b156b8775f61102218 | def estimate_gas(self, tx_params: Optional[TxParams]=None) -> int:
'Estimate gas consumption of method call.'
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().estimateGas(tx_params.as_dict()) | Estimate gas consumption of method call. | thirdweb/abi/multiwrap.py | estimate_gas | nftlabs/nftlabs-sdk-python | 30 | python | def estimate_gas(self, tx_params: Optional[TxParams]=None) -> int:
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().estimateGas(tx_params.as_dict()) | def estimate_gas(self, tx_params: Optional[TxParams]=None) -> int:
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().estimateGas(tx_params.as_dict())<|docstring|>Estimate gas consumption of method call.<|endoftext|> |
bd6ecbd21737798857673ddd577f664fcc7a46e09b0c38a5ecabaa08667bed75 | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction, validator: Validator=None):
'Persist instance data.'
super().__init__(web3_or_provider, contract_address, validator)
self._underlying_method = contract_function | Persist instance data. | thirdweb/abi/multiwrap.py | __init__ | nftlabs/nftlabs-sdk-python | 30 | python | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction, validator: Validator=None):
super().__init__(web3_or_provider, contract_address, validator)
self._underlying_method = contract_function | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction, validator: Validator=None):
super().__init__(web3_or_provider, contract_address, validator)
self._underlying_method = contract_function<|docstring|>Persist instance data.<|endoftext|> |
d096226231897f3522f857a359839dfd4c5a68386432b970451a0ddc46142c92 | def validate_and_normalize_inputs(self, to: str, token_id: int):
'Validate the inputs to the approve method.'
self.validator.assert_valid(method_name='approve', parameter_name='to', argument_value=to)
to = self.validate_and_checksum_address(to)
self.validator.assert_valid(method_name='approve', parameter_name='tokenId', argument_value=token_id)
token_id = int(token_id)
return (to, token_id) | Validate the inputs to the approve method. | thirdweb/abi/multiwrap.py | validate_and_normalize_inputs | nftlabs/nftlabs-sdk-python | 30 | python | def validate_and_normalize_inputs(self, to: str, token_id: int):
self.validator.assert_valid(method_name='approve', parameter_name='to', argument_value=to)
to = self.validate_and_checksum_address(to)
self.validator.assert_valid(method_name='approve', parameter_name='tokenId', argument_value=token_id)
token_id = int(token_id)
return (to, token_id) | def validate_and_normalize_inputs(self, to: str, token_id: int):
self.validator.assert_valid(method_name='approve', parameter_name='to', argument_value=to)
to = self.validate_and_checksum_address(to)
self.validator.assert_valid(method_name='approve', parameter_name='tokenId', argument_value=token_id)
token_id = int(token_id)
return (to, token_id)<|docstring|>Validate the inputs to the approve method.<|endoftext|> |
36c8f3ba57fe3dc1b90d3d21591312c2622594992500be387484b8d764d9b109 | def call(self, to: str, token_id: int, tx_params: Optional[TxParams]=None) -> None:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
(to, token_id) = self.validate_and_normalize_inputs(to, token_id)
tx_params = super().normalize_tx_params(tx_params)
self._underlying_method(to, token_id).call(tx_params.as_dict()) | Execute underlying contract method via eth_call.
:param tx_params: transaction parameters
:returns: the return value of the underlying method. | thirdweb/abi/multiwrap.py | call | nftlabs/nftlabs-sdk-python | 30 | python | def call(self, to: str, token_id: int, tx_params: Optional[TxParams]=None) -> None:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
(to, token_id) = self.validate_and_normalize_inputs(to, token_id)
tx_params = super().normalize_tx_params(tx_params)
self._underlying_method(to, token_id).call(tx_params.as_dict()) | def call(self, to: str, token_id: int, tx_params: Optional[TxParams]=None) -> None:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
(to, token_id) = self.validate_and_normalize_inputs(to, token_id)
tx_params = super().normalize_tx_params(tx_params)
self._underlying_method(to, token_id).call(tx_params.as_dict())<|docstring|>Execute underlying contract method via eth_call.
:param tx_params: transaction parameters
:returns: the return value of the underlying method.<|endoftext|> |
9be56c4eb4109ae96c46899792792ce4246198dc3a699318c09deb0d458376a0 | def send_transaction(self, to: str, token_id: int, tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
(to, token_id) = self.validate_and_normalize_inputs(to, token_id)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(to, token_id).transact(tx_params.as_dict()) | Execute underlying contract method via eth_sendTransaction.
:param tx_params: transaction parameters | thirdweb/abi/multiwrap.py | send_transaction | nftlabs/nftlabs-sdk-python | 30 | python | def send_transaction(self, to: str, token_id: int, tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
(to, token_id) = self.validate_and_normalize_inputs(to, token_id)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(to, token_id).transact(tx_params.as_dict()) | def send_transaction(self, to: str, token_id: int, tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
(to, token_id) = self.validate_and_normalize_inputs(to, token_id)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(to, token_id).transact(tx_params.as_dict())<|docstring|>Execute underlying contract method via eth_sendTransaction.
:param tx_params: transaction parameters<|endoftext|> |
08680449adc58a1ba97d56f1e874f032dbcce34d0cd33e1e91577932a2de3ab6 | def build_transaction(self, to: str, token_id: int, tx_params: Optional[TxParams]=None) -> dict:
'Construct calldata to be used as input to the method.'
(to, token_id) = self.validate_and_normalize_inputs(to, token_id)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(to, token_id).buildTransaction(tx_params.as_dict()) | Construct calldata to be used as input to the method. | thirdweb/abi/multiwrap.py | build_transaction | nftlabs/nftlabs-sdk-python | 30 | python | def build_transaction(self, to: str, token_id: int, tx_params: Optional[TxParams]=None) -> dict:
(to, token_id) = self.validate_and_normalize_inputs(to, token_id)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(to, token_id).buildTransaction(tx_params.as_dict()) | def build_transaction(self, to: str, token_id: int, tx_params: Optional[TxParams]=None) -> dict:
(to, token_id) = self.validate_and_normalize_inputs(to, token_id)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(to, token_id).buildTransaction(tx_params.as_dict())<|docstring|>Construct calldata to be used as input to the method.<|endoftext|> |
c7b48fe710d2a11cab114e08e02b77e3b9d477ca729656a5036caaa6d3151411 | def estimate_gas(self, to: str, token_id: int, tx_params: Optional[TxParams]=None) -> int:
'Estimate gas consumption of method call.'
(to, token_id) = self.validate_and_normalize_inputs(to, token_id)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(to, token_id).estimateGas(tx_params.as_dict()) | Estimate gas consumption of method call. | thirdweb/abi/multiwrap.py | estimate_gas | nftlabs/nftlabs-sdk-python | 30 | python | def estimate_gas(self, to: str, token_id: int, tx_params: Optional[TxParams]=None) -> int:
(to, token_id) = self.validate_and_normalize_inputs(to, token_id)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(to, token_id).estimateGas(tx_params.as_dict()) | def estimate_gas(self, to: str, token_id: int, tx_params: Optional[TxParams]=None) -> int:
(to, token_id) = self.validate_and_normalize_inputs(to, token_id)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(to, token_id).estimateGas(tx_params.as_dict())<|docstring|>Estimate gas consumption of method call.<|endoftext|> |
bd6ecbd21737798857673ddd577f664fcc7a46e09b0c38a5ecabaa08667bed75 | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction, validator: Validator=None):
'Persist instance data.'
super().__init__(web3_or_provider, contract_address, validator)
self._underlying_method = contract_function | Persist instance data. | thirdweb/abi/multiwrap.py | __init__ | nftlabs/nftlabs-sdk-python | 30 | python | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction, validator: Validator=None):
super().__init__(web3_or_provider, contract_address, validator)
self._underlying_method = contract_function | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction, validator: Validator=None):
super().__init__(web3_or_provider, contract_address, validator)
self._underlying_method = contract_function<|docstring|>Persist instance data.<|endoftext|> |
58ced37a6e6c38ba0edf1b248f83c0d3d6bfda199c6181f7721dbeb9928fa395 | def validate_and_normalize_inputs(self, owner: str):
'Validate the inputs to the balanceOf method.'
self.validator.assert_valid(method_name='balanceOf', parameter_name='owner', argument_value=owner)
owner = self.validate_and_checksum_address(owner)
return owner | Validate the inputs to the balanceOf method. | thirdweb/abi/multiwrap.py | validate_and_normalize_inputs | nftlabs/nftlabs-sdk-python | 30 | python | def validate_and_normalize_inputs(self, owner: str):
self.validator.assert_valid(method_name='balanceOf', parameter_name='owner', argument_value=owner)
owner = self.validate_and_checksum_address(owner)
return owner | def validate_and_normalize_inputs(self, owner: str):
self.validator.assert_valid(method_name='balanceOf', parameter_name='owner', argument_value=owner)
owner = self.validate_and_checksum_address(owner)
return owner<|docstring|>Validate the inputs to the balanceOf method.<|endoftext|> |
62d1890204bd88d3124baa73394717841e7ae93d4c1bdd708deb52cc9c09ed09 | def call(self, owner: str, tx_params: Optional[TxParams]=None) -> int:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
owner = self.validate_and_normalize_inputs(owner)
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method(owner).call(tx_params.as_dict())
return int(returned) | Execute underlying contract method via eth_call.
:param tx_params: transaction parameters
:returns: the return value of the underlying method. | thirdweb/abi/multiwrap.py | call | nftlabs/nftlabs-sdk-python | 30 | python | def call(self, owner: str, tx_params: Optional[TxParams]=None) -> int:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
owner = self.validate_and_normalize_inputs(owner)
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method(owner).call(tx_params.as_dict())
return int(returned) | def call(self, owner: str, tx_params: Optional[TxParams]=None) -> int:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
owner = self.validate_and_normalize_inputs(owner)
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method(owner).call(tx_params.as_dict())
return int(returned)<|docstring|>Execute underlying contract method via eth_call.
:param tx_params: transaction parameters
:returns: the return value of the underlying method.<|endoftext|> |
35ee0d658b2cb40c70a30aa7cfe66f791ccdbb8352ca070b7d8458b6c0580ffe | def send_transaction(self, owner: str, tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
owner = self.validate_and_normalize_inputs(owner)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(owner).transact(tx_params.as_dict()) | Execute underlying contract method via eth_sendTransaction.
:param tx_params: transaction parameters | thirdweb/abi/multiwrap.py | send_transaction | nftlabs/nftlabs-sdk-python | 30 | python | def send_transaction(self, owner: str, tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
owner = self.validate_and_normalize_inputs(owner)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(owner).transact(tx_params.as_dict()) | def send_transaction(self, owner: str, tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
owner = self.validate_and_normalize_inputs(owner)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(owner).transact(tx_params.as_dict())<|docstring|>Execute underlying contract method via eth_sendTransaction.
:param tx_params: transaction parameters<|endoftext|> |
bb4de28c739cfa68029f5b225ed2570406e93e15090d27b844220ed39a3ed74c | def build_transaction(self, owner: str, tx_params: Optional[TxParams]=None) -> dict:
'Construct calldata to be used as input to the method.'
owner = self.validate_and_normalize_inputs(owner)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(owner).buildTransaction(tx_params.as_dict()) | Construct calldata to be used as input to the method. | thirdweb/abi/multiwrap.py | build_transaction | nftlabs/nftlabs-sdk-python | 30 | python | def build_transaction(self, owner: str, tx_params: Optional[TxParams]=None) -> dict:
owner = self.validate_and_normalize_inputs(owner)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(owner).buildTransaction(tx_params.as_dict()) | def build_transaction(self, owner: str, tx_params: Optional[TxParams]=None) -> dict:
owner = self.validate_and_normalize_inputs(owner)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(owner).buildTransaction(tx_params.as_dict())<|docstring|>Construct calldata to be used as input to the method.<|endoftext|> |
e0475dae447f41abd0f357f8f398528e17692f0443a2fe534d022f53010c53b6 | def estimate_gas(self, owner: str, tx_params: Optional[TxParams]=None) -> int:
'Estimate gas consumption of method call.'
owner = self.validate_and_normalize_inputs(owner)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(owner).estimateGas(tx_params.as_dict()) | Estimate gas consumption of method call. | thirdweb/abi/multiwrap.py | estimate_gas | nftlabs/nftlabs-sdk-python | 30 | python | def estimate_gas(self, owner: str, tx_params: Optional[TxParams]=None) -> int:
owner = self.validate_and_normalize_inputs(owner)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(owner).estimateGas(tx_params.as_dict()) | def estimate_gas(self, owner: str, tx_params: Optional[TxParams]=None) -> int:
owner = self.validate_and_normalize_inputs(owner)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(owner).estimateGas(tx_params.as_dict())<|docstring|>Estimate gas consumption of method call.<|endoftext|> |
ca018593104d6b0dd61e4217621e13539160c2609a5e06c020c095c244014be4 | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction):
'Persist instance data.'
super().__init__(web3_or_provider, contract_address)
self._underlying_method = contract_function | Persist instance data. | thirdweb/abi/multiwrap.py | __init__ | nftlabs/nftlabs-sdk-python | 30 | python | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction):
super().__init__(web3_or_provider, contract_address)
self._underlying_method = contract_function | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction):
super().__init__(web3_or_provider, contract_address)
self._underlying_method = contract_function<|docstring|>Persist instance data.<|endoftext|> |
295188694246f118f97e5b6b2195c517e2108aa00d9230f499edebf85ae46703 | def call(self, tx_params: Optional[TxParams]=None) -> Union[(bytes, str)]:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method().call(tx_params.as_dict())
return Union[(bytes, str)](returned) | Execute underlying contract method via eth_call.
:param tx_params: transaction parameters
:returns: the return value of the underlying method. | thirdweb/abi/multiwrap.py | call | nftlabs/nftlabs-sdk-python | 30 | python | def call(self, tx_params: Optional[TxParams]=None) -> Union[(bytes, str)]:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method().call(tx_params.as_dict())
return Union[(bytes, str)](returned) | def call(self, tx_params: Optional[TxParams]=None) -> Union[(bytes, str)]:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method().call(tx_params.as_dict())
return Union[(bytes, str)](returned)<|docstring|>Execute underlying contract method via eth_call.
:param tx_params: transaction parameters
:returns: the return value of the underlying method.<|endoftext|> |
9ea0157eb6440eac095230a57efab5746974fbf6138037de26bad21761597b37 | def send_transaction(self, tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().transact(tx_params.as_dict()) | Execute underlying contract method via eth_sendTransaction.
:param tx_params: transaction parameters | thirdweb/abi/multiwrap.py | send_transaction | nftlabs/nftlabs-sdk-python | 30 | python | def send_transaction(self, tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().transact(tx_params.as_dict()) | def send_transaction(self, tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().transact(tx_params.as_dict())<|docstring|>Execute underlying contract method via eth_sendTransaction.
:param tx_params: transaction parameters<|endoftext|> |
6f2a541c7014fdc8f155b3763c2bdb103b684bbe9b83febdadafc5995b919d1d | def build_transaction(self, tx_params: Optional[TxParams]=None) -> dict:
'Construct calldata to be used as input to the method.'
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().buildTransaction(tx_params.as_dict()) | Construct calldata to be used as input to the method. | thirdweb/abi/multiwrap.py | build_transaction | nftlabs/nftlabs-sdk-python | 30 | python | def build_transaction(self, tx_params: Optional[TxParams]=None) -> dict:
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().buildTransaction(tx_params.as_dict()) | def build_transaction(self, tx_params: Optional[TxParams]=None) -> dict:
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().buildTransaction(tx_params.as_dict())<|docstring|>Construct calldata to be used as input to the method.<|endoftext|> |
11d4f9b449306eaf388ea7867de46d23b67cc54826ff61b156b8775f61102218 | def estimate_gas(self, tx_params: Optional[TxParams]=None) -> int:
'Estimate gas consumption of method call.'
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().estimateGas(tx_params.as_dict()) | Estimate gas consumption of method call. | thirdweb/abi/multiwrap.py | estimate_gas | nftlabs/nftlabs-sdk-python | 30 | python | def estimate_gas(self, tx_params: Optional[TxParams]=None) -> int:
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().estimateGas(tx_params.as_dict()) | def estimate_gas(self, tx_params: Optional[TxParams]=None) -> int:
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().estimateGas(tx_params.as_dict())<|docstring|>Estimate gas consumption of method call.<|endoftext|> |
ca018593104d6b0dd61e4217621e13539160c2609a5e06c020c095c244014be4 | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction):
'Persist instance data.'
super().__init__(web3_or_provider, contract_address)
self._underlying_method = contract_function | Persist instance data. | thirdweb/abi/multiwrap.py | __init__ | nftlabs/nftlabs-sdk-python | 30 | python | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction):
super().__init__(web3_or_provider, contract_address)
self._underlying_method = contract_function | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction):
super().__init__(web3_or_provider, contract_address)
self._underlying_method = contract_function<|docstring|>Persist instance data.<|endoftext|> |
ca32d6807ebd9ceb15a2b64a172e6e81cfc9485bd1945b8aaf7461f0c2f67e87 | def call(self, tx_params: Optional[TxParams]=None) -> str:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method().call(tx_params.as_dict())
return str(returned) | Execute underlying contract method via eth_call.
:param tx_params: transaction parameters
:returns: the return value of the underlying method. | thirdweb/abi/multiwrap.py | call | nftlabs/nftlabs-sdk-python | 30 | python | def call(self, tx_params: Optional[TxParams]=None) -> str:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method().call(tx_params.as_dict())
return str(returned) | def call(self, tx_params: Optional[TxParams]=None) -> str:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method().call(tx_params.as_dict())
return str(returned)<|docstring|>Execute underlying contract method via eth_call.
:param tx_params: transaction parameters
:returns: the return value of the underlying method.<|endoftext|> |
9ea0157eb6440eac095230a57efab5746974fbf6138037de26bad21761597b37 | def send_transaction(self, tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().transact(tx_params.as_dict()) | Execute underlying contract method via eth_sendTransaction.
:param tx_params: transaction parameters | thirdweb/abi/multiwrap.py | send_transaction | nftlabs/nftlabs-sdk-python | 30 | python | def send_transaction(self, tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().transact(tx_params.as_dict()) | def send_transaction(self, tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().transact(tx_params.as_dict())<|docstring|>Execute underlying contract method via eth_sendTransaction.
:param tx_params: transaction parameters<|endoftext|> |
6f2a541c7014fdc8f155b3763c2bdb103b684bbe9b83febdadafc5995b919d1d | def build_transaction(self, tx_params: Optional[TxParams]=None) -> dict:
'Construct calldata to be used as input to the method.'
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().buildTransaction(tx_params.as_dict()) | Construct calldata to be used as input to the method. | thirdweb/abi/multiwrap.py | build_transaction | nftlabs/nftlabs-sdk-python | 30 | python | def build_transaction(self, tx_params: Optional[TxParams]=None) -> dict:
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().buildTransaction(tx_params.as_dict()) | def build_transaction(self, tx_params: Optional[TxParams]=None) -> dict:
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().buildTransaction(tx_params.as_dict())<|docstring|>Construct calldata to be used as input to the method.<|endoftext|> |
11d4f9b449306eaf388ea7867de46d23b67cc54826ff61b156b8775f61102218 | def estimate_gas(self, tx_params: Optional[TxParams]=None) -> int:
'Estimate gas consumption of method call.'
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().estimateGas(tx_params.as_dict()) | Estimate gas consumption of method call. | thirdweb/abi/multiwrap.py | estimate_gas | nftlabs/nftlabs-sdk-python | 30 | python | def estimate_gas(self, tx_params: Optional[TxParams]=None) -> int:
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().estimateGas(tx_params.as_dict()) | def estimate_gas(self, tx_params: Optional[TxParams]=None) -> int:
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().estimateGas(tx_params.as_dict())<|docstring|>Estimate gas consumption of method call.<|endoftext|> |
ca018593104d6b0dd61e4217621e13539160c2609a5e06c020c095c244014be4 | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction):
'Persist instance data.'
super().__init__(web3_or_provider, contract_address)
self._underlying_method = contract_function | Persist instance data. | thirdweb/abi/multiwrap.py | __init__ | nftlabs/nftlabs-sdk-python | 30 | python | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction):
super().__init__(web3_or_provider, contract_address)
self._underlying_method = contract_function | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction):
super().__init__(web3_or_provider, contract_address)
self._underlying_method = contract_function<|docstring|>Persist instance data.<|endoftext|> |
0d1feb2b3a7b114d5d1bcc63471ea6bd5ae2bbae2a964758f4d2e917c7d5b29a | def call(self, tx_params: Optional[TxParams]=None) -> int:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method().call(tx_params.as_dict())
return int(returned) | Execute underlying contract method via eth_call.
:param tx_params: transaction parameters
:returns: the return value of the underlying method. | thirdweb/abi/multiwrap.py | call | nftlabs/nftlabs-sdk-python | 30 | python | def call(self, tx_params: Optional[TxParams]=None) -> int:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method().call(tx_params.as_dict())
return int(returned) | def call(self, tx_params: Optional[TxParams]=None) -> int:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method().call(tx_params.as_dict())
return int(returned)<|docstring|>Execute underlying contract method via eth_call.
:param tx_params: transaction parameters
:returns: the return value of the underlying method.<|endoftext|> |
9ea0157eb6440eac095230a57efab5746974fbf6138037de26bad21761597b37 | def send_transaction(self, tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().transact(tx_params.as_dict()) | Execute underlying contract method via eth_sendTransaction.
:param tx_params: transaction parameters | thirdweb/abi/multiwrap.py | send_transaction | nftlabs/nftlabs-sdk-python | 30 | python | def send_transaction(self, tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().transact(tx_params.as_dict()) | def send_transaction(self, tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().transact(tx_params.as_dict())<|docstring|>Execute underlying contract method via eth_sendTransaction.
:param tx_params: transaction parameters<|endoftext|> |
6f2a541c7014fdc8f155b3763c2bdb103b684bbe9b83febdadafc5995b919d1d | def build_transaction(self, tx_params: Optional[TxParams]=None) -> dict:
'Construct calldata to be used as input to the method.'
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().buildTransaction(tx_params.as_dict()) | Construct calldata to be used as input to the method. | thirdweb/abi/multiwrap.py | build_transaction | nftlabs/nftlabs-sdk-python | 30 | python | def build_transaction(self, tx_params: Optional[TxParams]=None) -> dict:
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().buildTransaction(tx_params.as_dict()) | def build_transaction(self, tx_params: Optional[TxParams]=None) -> dict:
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().buildTransaction(tx_params.as_dict())<|docstring|>Construct calldata to be used as input to the method.<|endoftext|> |
11d4f9b449306eaf388ea7867de46d23b67cc54826ff61b156b8775f61102218 | def estimate_gas(self, tx_params: Optional[TxParams]=None) -> int:
'Estimate gas consumption of method call.'
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().estimateGas(tx_params.as_dict()) | Estimate gas consumption of method call. | thirdweb/abi/multiwrap.py | estimate_gas | nftlabs/nftlabs-sdk-python | 30 | python | def estimate_gas(self, tx_params: Optional[TxParams]=None) -> int:
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().estimateGas(tx_params.as_dict()) | def estimate_gas(self, tx_params: Optional[TxParams]=None) -> int:
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().estimateGas(tx_params.as_dict())<|docstring|>Estimate gas consumption of method call.<|endoftext|> |
bd6ecbd21737798857673ddd577f664fcc7a46e09b0c38a5ecabaa08667bed75 | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction, validator: Validator=None):
'Persist instance data.'
super().__init__(web3_or_provider, contract_address, validator)
self._underlying_method = contract_function | Persist instance data. | thirdweb/abi/multiwrap.py | __init__ | nftlabs/nftlabs-sdk-python | 30 | python | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction, validator: Validator=None):
super().__init__(web3_or_provider, contract_address, validator)
self._underlying_method = contract_function | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction, validator: Validator=None):
super().__init__(web3_or_provider, contract_address, validator)
self._underlying_method = contract_function<|docstring|>Persist instance data.<|endoftext|> |
b76b77deb7e8872b038fde53d1ad6ca36fcbd1a4f84057fa077f59488b979bc7 | def validate_and_normalize_inputs(self, token_id: int):
'Validate the inputs to the getApproved method.'
self.validator.assert_valid(method_name='getApproved', parameter_name='tokenId', argument_value=token_id)
token_id = int(token_id)
return token_id | Validate the inputs to the getApproved method. | thirdweb/abi/multiwrap.py | validate_and_normalize_inputs | nftlabs/nftlabs-sdk-python | 30 | python | def validate_and_normalize_inputs(self, token_id: int):
self.validator.assert_valid(method_name='getApproved', parameter_name='tokenId', argument_value=token_id)
token_id = int(token_id)
return token_id | def validate_and_normalize_inputs(self, token_id: int):
self.validator.assert_valid(method_name='getApproved', parameter_name='tokenId', argument_value=token_id)
token_id = int(token_id)
return token_id<|docstring|>Validate the inputs to the getApproved method.<|endoftext|> |
b4ffa91a77acf497f87845e803e7008e5aac6ef4505645f6d2a013bf16ca4e81 | def call(self, token_id: int, tx_params: Optional[TxParams]=None) -> str:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
token_id = self.validate_and_normalize_inputs(token_id)
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method(token_id).call(tx_params.as_dict())
return str(returned) | Execute underlying contract method via eth_call.
:param tx_params: transaction parameters
:returns: the return value of the underlying method. | thirdweb/abi/multiwrap.py | call | nftlabs/nftlabs-sdk-python | 30 | python | def call(self, token_id: int, tx_params: Optional[TxParams]=None) -> str:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
token_id = self.validate_and_normalize_inputs(token_id)
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method(token_id).call(tx_params.as_dict())
return str(returned) | def call(self, token_id: int, tx_params: Optional[TxParams]=None) -> str:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
token_id = self.validate_and_normalize_inputs(token_id)
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method(token_id).call(tx_params.as_dict())
return str(returned)<|docstring|>Execute underlying contract method via eth_call.
:param tx_params: transaction parameters
:returns: the return value of the underlying method.<|endoftext|> |
e27f80815f34ab833e17016d58c78e88a1e64dce6c8824207fba04df6aa3d88e | def send_transaction(self, token_id: int, tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
token_id = self.validate_and_normalize_inputs(token_id)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(token_id).transact(tx_params.as_dict()) | Execute underlying contract method via eth_sendTransaction.
:param tx_params: transaction parameters | thirdweb/abi/multiwrap.py | send_transaction | nftlabs/nftlabs-sdk-python | 30 | python | def send_transaction(self, token_id: int, tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
token_id = self.validate_and_normalize_inputs(token_id)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(token_id).transact(tx_params.as_dict()) | def send_transaction(self, token_id: int, tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
token_id = self.validate_and_normalize_inputs(token_id)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(token_id).transact(tx_params.as_dict())<|docstring|>Execute underlying contract method via eth_sendTransaction.
:param tx_params: transaction parameters<|endoftext|> |
687dfac0950732365c580176289be1f67bed0b6a35eea8671dbe2d8d8c5059ec | def build_transaction(self, token_id: int, tx_params: Optional[TxParams]=None) -> dict:
'Construct calldata to be used as input to the method.'
token_id = self.validate_and_normalize_inputs(token_id)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(token_id).buildTransaction(tx_params.as_dict()) | Construct calldata to be used as input to the method. | thirdweb/abi/multiwrap.py | build_transaction | nftlabs/nftlabs-sdk-python | 30 | python | def build_transaction(self, token_id: int, tx_params: Optional[TxParams]=None) -> dict:
token_id = self.validate_and_normalize_inputs(token_id)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(token_id).buildTransaction(tx_params.as_dict()) | def build_transaction(self, token_id: int, tx_params: Optional[TxParams]=None) -> dict:
token_id = self.validate_and_normalize_inputs(token_id)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(token_id).buildTransaction(tx_params.as_dict())<|docstring|>Construct calldata to be used as input to the method.<|endoftext|> |
97cb33886d64af0a51559709537b845f521d6110be3b37d16b1d9830eccf83f5 | def estimate_gas(self, token_id: int, tx_params: Optional[TxParams]=None) -> int:
'Estimate gas consumption of method call.'
token_id = self.validate_and_normalize_inputs(token_id)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(token_id).estimateGas(tx_params.as_dict()) | Estimate gas consumption of method call. | thirdweb/abi/multiwrap.py | estimate_gas | nftlabs/nftlabs-sdk-python | 30 | python | def estimate_gas(self, token_id: int, tx_params: Optional[TxParams]=None) -> int:
token_id = self.validate_and_normalize_inputs(token_id)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(token_id).estimateGas(tx_params.as_dict()) | def estimate_gas(self, token_id: int, tx_params: Optional[TxParams]=None) -> int:
token_id = self.validate_and_normalize_inputs(token_id)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(token_id).estimateGas(tx_params.as_dict())<|docstring|>Estimate gas consumption of method call.<|endoftext|> |
ca018593104d6b0dd61e4217621e13539160c2609a5e06c020c095c244014be4 | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction):
'Persist instance data.'
super().__init__(web3_or_provider, contract_address)
self._underlying_method = contract_function | Persist instance data. | thirdweb/abi/multiwrap.py | __init__ | nftlabs/nftlabs-sdk-python | 30 | python | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction):
super().__init__(web3_or_provider, contract_address)
self._underlying_method = contract_function | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction):
super().__init__(web3_or_provider, contract_address)
self._underlying_method = contract_function<|docstring|>Persist instance data.<|endoftext|> |
81d7fc00919098be3d7a12dc56a12ed81c98758fc8d7a6478e724579ba03a321 | def call(self, tx_params: Optional[TxParams]=None) -> Tuple[(str, int)]:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method().call(tx_params.as_dict())
return (returned[0], returned[1]) | Execute underlying contract method via eth_call.
:param tx_params: transaction parameters
:returns: the return value of the underlying method. | thirdweb/abi/multiwrap.py | call | nftlabs/nftlabs-sdk-python | 30 | python | def call(self, tx_params: Optional[TxParams]=None) -> Tuple[(str, int)]:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method().call(tx_params.as_dict())
return (returned[0], returned[1]) | def call(self, tx_params: Optional[TxParams]=None) -> Tuple[(str, int)]:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method().call(tx_params.as_dict())
return (returned[0], returned[1])<|docstring|>Execute underlying contract method via eth_call.
:param tx_params: transaction parameters
:returns: the return value of the underlying method.<|endoftext|> |
9ea0157eb6440eac095230a57efab5746974fbf6138037de26bad21761597b37 | def send_transaction(self, tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().transact(tx_params.as_dict()) | Execute underlying contract method via eth_sendTransaction.
:param tx_params: transaction parameters | thirdweb/abi/multiwrap.py | send_transaction | nftlabs/nftlabs-sdk-python | 30 | python | def send_transaction(self, tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().transact(tx_params.as_dict()) | def send_transaction(self, tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().transact(tx_params.as_dict())<|docstring|>Execute underlying contract method via eth_sendTransaction.
:param tx_params: transaction parameters<|endoftext|> |
6f2a541c7014fdc8f155b3763c2bdb103b684bbe9b83febdadafc5995b919d1d | def build_transaction(self, tx_params: Optional[TxParams]=None) -> dict:
'Construct calldata to be used as input to the method.'
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().buildTransaction(tx_params.as_dict()) | Construct calldata to be used as input to the method. | thirdweb/abi/multiwrap.py | build_transaction | nftlabs/nftlabs-sdk-python | 30 | python | def build_transaction(self, tx_params: Optional[TxParams]=None) -> dict:
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().buildTransaction(tx_params.as_dict()) | def build_transaction(self, tx_params: Optional[TxParams]=None) -> dict:
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().buildTransaction(tx_params.as_dict())<|docstring|>Construct calldata to be used as input to the method.<|endoftext|> |
11d4f9b449306eaf388ea7867de46d23b67cc54826ff61b156b8775f61102218 | def estimate_gas(self, tx_params: Optional[TxParams]=None) -> int:
'Estimate gas consumption of method call.'
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().estimateGas(tx_params.as_dict()) | Estimate gas consumption of method call. | thirdweb/abi/multiwrap.py | estimate_gas | nftlabs/nftlabs-sdk-python | 30 | python | def estimate_gas(self, tx_params: Optional[TxParams]=None) -> int:
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().estimateGas(tx_params.as_dict()) | def estimate_gas(self, tx_params: Optional[TxParams]=None) -> int:
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method().estimateGas(tx_params.as_dict())<|docstring|>Estimate gas consumption of method call.<|endoftext|> |
bd6ecbd21737798857673ddd577f664fcc7a46e09b0c38a5ecabaa08667bed75 | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction, validator: Validator=None):
'Persist instance data.'
super().__init__(web3_or_provider, contract_address, validator)
self._underlying_method = contract_function | Persist instance data. | thirdweb/abi/multiwrap.py | __init__ | nftlabs/nftlabs-sdk-python | 30 | python | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction, validator: Validator=None):
super().__init__(web3_or_provider, contract_address, validator)
self._underlying_method = contract_function | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction, validator: Validator=None):
super().__init__(web3_or_provider, contract_address, validator)
self._underlying_method = contract_function<|docstring|>Persist instance data.<|endoftext|> |
d0a6aab9a762954195f1451db2de2f436f8fee91627198f7885f2c494e7a82ab | def validate_and_normalize_inputs(self, role: Union[(bytes, str)]):
'Validate the inputs to the getRoleAdmin method.'
self.validator.assert_valid(method_name='getRoleAdmin', parameter_name='role', argument_value=role)
return role | Validate the inputs to the getRoleAdmin method. | thirdweb/abi/multiwrap.py | validate_and_normalize_inputs | nftlabs/nftlabs-sdk-python | 30 | python | def validate_and_normalize_inputs(self, role: Union[(bytes, str)]):
self.validator.assert_valid(method_name='getRoleAdmin', parameter_name='role', argument_value=role)
return role | def validate_and_normalize_inputs(self, role: Union[(bytes, str)]):
self.validator.assert_valid(method_name='getRoleAdmin', parameter_name='role', argument_value=role)
return role<|docstring|>Validate the inputs to the getRoleAdmin method.<|endoftext|> |
ccfdc990ea95831deb6f60c2470cf669df55073a05ddce2700c51a57616c243d | def call(self, role: Union[(bytes, str)], tx_params: Optional[TxParams]=None) -> Union[(bytes, str)]:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
role = self.validate_and_normalize_inputs(role)
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method(role).call(tx_params.as_dict())
return Union[(bytes, str)](returned) | Execute underlying contract method via eth_call.
:param tx_params: transaction parameters
:returns: the return value of the underlying method. | thirdweb/abi/multiwrap.py | call | nftlabs/nftlabs-sdk-python | 30 | python | def call(self, role: Union[(bytes, str)], tx_params: Optional[TxParams]=None) -> Union[(bytes, str)]:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
role = self.validate_and_normalize_inputs(role)
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method(role).call(tx_params.as_dict())
return Union[(bytes, str)](returned) | def call(self, role: Union[(bytes, str)], tx_params: Optional[TxParams]=None) -> Union[(bytes, str)]:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
role = self.validate_and_normalize_inputs(role)
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method(role).call(tx_params.as_dict())
return Union[(bytes, str)](returned)<|docstring|>Execute underlying contract method via eth_call.
:param tx_params: transaction parameters
:returns: the return value of the underlying method.<|endoftext|> |
ed5e7bb8efebffc5294bf0de4ed2024b31fea35791d6445d835f8dc6fad520a4 | def send_transaction(self, role: Union[(bytes, str)], tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
role = self.validate_and_normalize_inputs(role)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(role).transact(tx_params.as_dict()) | Execute underlying contract method via eth_sendTransaction.
:param tx_params: transaction parameters | thirdweb/abi/multiwrap.py | send_transaction | nftlabs/nftlabs-sdk-python | 30 | python | def send_transaction(self, role: Union[(bytes, str)], tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
role = self.validate_and_normalize_inputs(role)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(role).transact(tx_params.as_dict()) | def send_transaction(self, role: Union[(bytes, str)], tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
role = self.validate_and_normalize_inputs(role)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(role).transact(tx_params.as_dict())<|docstring|>Execute underlying contract method via eth_sendTransaction.
:param tx_params: transaction parameters<|endoftext|> |
e561df63cd344b14609b0e8e8ad178be3f709174a1d45687017f6dfc69efb8aa | def build_transaction(self, role: Union[(bytes, str)], tx_params: Optional[TxParams]=None) -> dict:
'Construct calldata to be used as input to the method.'
role = self.validate_and_normalize_inputs(role)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(role).buildTransaction(tx_params.as_dict()) | Construct calldata to be used as input to the method. | thirdweb/abi/multiwrap.py | build_transaction | nftlabs/nftlabs-sdk-python | 30 | python | def build_transaction(self, role: Union[(bytes, str)], tx_params: Optional[TxParams]=None) -> dict:
role = self.validate_and_normalize_inputs(role)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(role).buildTransaction(tx_params.as_dict()) | def build_transaction(self, role: Union[(bytes, str)], tx_params: Optional[TxParams]=None) -> dict:
role = self.validate_and_normalize_inputs(role)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(role).buildTransaction(tx_params.as_dict())<|docstring|>Construct calldata to be used as input to the method.<|endoftext|> |
01d5c30486f6f3e438e4b89cbce5830e7c0c7f2d9cd5f8cce6beff9e1da6608a | def estimate_gas(self, role: Union[(bytes, str)], tx_params: Optional[TxParams]=None) -> int:
'Estimate gas consumption of method call.'
role = self.validate_and_normalize_inputs(role)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(role).estimateGas(tx_params.as_dict()) | Estimate gas consumption of method call. | thirdweb/abi/multiwrap.py | estimate_gas | nftlabs/nftlabs-sdk-python | 30 | python | def estimate_gas(self, role: Union[(bytes, str)], tx_params: Optional[TxParams]=None) -> int:
role = self.validate_and_normalize_inputs(role)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(role).estimateGas(tx_params.as_dict()) | def estimate_gas(self, role: Union[(bytes, str)], tx_params: Optional[TxParams]=None) -> int:
role = self.validate_and_normalize_inputs(role)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(role).estimateGas(tx_params.as_dict())<|docstring|>Estimate gas consumption of method call.<|endoftext|> |
bd6ecbd21737798857673ddd577f664fcc7a46e09b0c38a5ecabaa08667bed75 | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction, validator: Validator=None):
'Persist instance data.'
super().__init__(web3_or_provider, contract_address, validator)
self._underlying_method = contract_function | Persist instance data. | thirdweb/abi/multiwrap.py | __init__ | nftlabs/nftlabs-sdk-python | 30 | python | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction, validator: Validator=None):
super().__init__(web3_or_provider, contract_address, validator)
self._underlying_method = contract_function | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction, validator: Validator=None):
super().__init__(web3_or_provider, contract_address, validator)
self._underlying_method = contract_function<|docstring|>Persist instance data.<|endoftext|> |
15b140b7e9c481d65c5df1a4e949d004d121973ce236d036c00934994c2a9bc7 | def validate_and_normalize_inputs(self, role: Union[(bytes, str)], index: int):
'Validate the inputs to the getRoleMember method.'
self.validator.assert_valid(method_name='getRoleMember', parameter_name='role', argument_value=role)
self.validator.assert_valid(method_name='getRoleMember', parameter_name='index', argument_value=index)
index = int(index)
return (role, index) | Validate the inputs to the getRoleMember method. | thirdweb/abi/multiwrap.py | validate_and_normalize_inputs | nftlabs/nftlabs-sdk-python | 30 | python | def validate_and_normalize_inputs(self, role: Union[(bytes, str)], index: int):
self.validator.assert_valid(method_name='getRoleMember', parameter_name='role', argument_value=role)
self.validator.assert_valid(method_name='getRoleMember', parameter_name='index', argument_value=index)
index = int(index)
return (role, index) | def validate_and_normalize_inputs(self, role: Union[(bytes, str)], index: int):
self.validator.assert_valid(method_name='getRoleMember', parameter_name='role', argument_value=role)
self.validator.assert_valid(method_name='getRoleMember', parameter_name='index', argument_value=index)
index = int(index)
return (role, index)<|docstring|>Validate the inputs to the getRoleMember method.<|endoftext|> |
72853995c228f42af1f9c5e446ac9f1579e37e11c464429cf596dea520ec4a82 | def call(self, role: Union[(bytes, str)], index: int, tx_params: Optional[TxParams]=None) -> str:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
(role, index) = self.validate_and_normalize_inputs(role, index)
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method(role, index).call(tx_params.as_dict())
return str(returned) | Execute underlying contract method via eth_call.
:param tx_params: transaction parameters
:returns: the return value of the underlying method. | thirdweb/abi/multiwrap.py | call | nftlabs/nftlabs-sdk-python | 30 | python | def call(self, role: Union[(bytes, str)], index: int, tx_params: Optional[TxParams]=None) -> str:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
(role, index) = self.validate_and_normalize_inputs(role, index)
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method(role, index).call(tx_params.as_dict())
return str(returned) | def call(self, role: Union[(bytes, str)], index: int, tx_params: Optional[TxParams]=None) -> str:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
(role, index) = self.validate_and_normalize_inputs(role, index)
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method(role, index).call(tx_params.as_dict())
return str(returned)<|docstring|>Execute underlying contract method via eth_call.
:param tx_params: transaction parameters
:returns: the return value of the underlying method.<|endoftext|> |
3b704dafa01bd6d7c8da0469749dca0f128de5ac5db10f2439232fbdd75d9083 | def send_transaction(self, role: Union[(bytes, str)], index: int, tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
(role, index) = self.validate_and_normalize_inputs(role, index)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(role, index).transact(tx_params.as_dict()) | Execute underlying contract method via eth_sendTransaction.
:param tx_params: transaction parameters | thirdweb/abi/multiwrap.py | send_transaction | nftlabs/nftlabs-sdk-python | 30 | python | def send_transaction(self, role: Union[(bytes, str)], index: int, tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
(role, index) = self.validate_and_normalize_inputs(role, index)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(role, index).transact(tx_params.as_dict()) | def send_transaction(self, role: Union[(bytes, str)], index: int, tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
(role, index) = self.validate_and_normalize_inputs(role, index)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(role, index).transact(tx_params.as_dict())<|docstring|>Execute underlying contract method via eth_sendTransaction.
:param tx_params: transaction parameters<|endoftext|> |
8758304db4e5eeb44fc2717379bce41d25f2045e04e325e998d45961f9c885be | def build_transaction(self, role: Union[(bytes, str)], index: int, tx_params: Optional[TxParams]=None) -> dict:
'Construct calldata to be used as input to the method.'
(role, index) = self.validate_and_normalize_inputs(role, index)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(role, index).buildTransaction(tx_params.as_dict()) | Construct calldata to be used as input to the method. | thirdweb/abi/multiwrap.py | build_transaction | nftlabs/nftlabs-sdk-python | 30 | python | def build_transaction(self, role: Union[(bytes, str)], index: int, tx_params: Optional[TxParams]=None) -> dict:
(role, index) = self.validate_and_normalize_inputs(role, index)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(role, index).buildTransaction(tx_params.as_dict()) | def build_transaction(self, role: Union[(bytes, str)], index: int, tx_params: Optional[TxParams]=None) -> dict:
(role, index) = self.validate_and_normalize_inputs(role, index)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(role, index).buildTransaction(tx_params.as_dict())<|docstring|>Construct calldata to be used as input to the method.<|endoftext|> |
8e9746150ea08da633cfb40c4c4f13e2c4ea4dfdfe0b215ef09c787318956d22 | def estimate_gas(self, role: Union[(bytes, str)], index: int, tx_params: Optional[TxParams]=None) -> int:
'Estimate gas consumption of method call.'
(role, index) = self.validate_and_normalize_inputs(role, index)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(role, index).estimateGas(tx_params.as_dict()) | Estimate gas consumption of method call. | thirdweb/abi/multiwrap.py | estimate_gas | nftlabs/nftlabs-sdk-python | 30 | python | def estimate_gas(self, role: Union[(bytes, str)], index: int, tx_params: Optional[TxParams]=None) -> int:
(role, index) = self.validate_and_normalize_inputs(role, index)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(role, index).estimateGas(tx_params.as_dict()) | def estimate_gas(self, role: Union[(bytes, str)], index: int, tx_params: Optional[TxParams]=None) -> int:
(role, index) = self.validate_and_normalize_inputs(role, index)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(role, index).estimateGas(tx_params.as_dict())<|docstring|>Estimate gas consumption of method call.<|endoftext|> |
bd6ecbd21737798857673ddd577f664fcc7a46e09b0c38a5ecabaa08667bed75 | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction, validator: Validator=None):
'Persist instance data.'
super().__init__(web3_or_provider, contract_address, validator)
self._underlying_method = contract_function | Persist instance data. | thirdweb/abi/multiwrap.py | __init__ | nftlabs/nftlabs-sdk-python | 30 | python | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction, validator: Validator=None):
super().__init__(web3_or_provider, contract_address, validator)
self._underlying_method = contract_function | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction, validator: Validator=None):
super().__init__(web3_or_provider, contract_address, validator)
self._underlying_method = contract_function<|docstring|>Persist instance data.<|endoftext|> |
7d9347292f0bd8cd5383905c728696c4c1551669b7059b3aadffc13714500266 | def validate_and_normalize_inputs(self, role: Union[(bytes, str)]):
'Validate the inputs to the getRoleMemberCount method.'
self.validator.assert_valid(method_name='getRoleMemberCount', parameter_name='role', argument_value=role)
return role | Validate the inputs to the getRoleMemberCount method. | thirdweb/abi/multiwrap.py | validate_and_normalize_inputs | nftlabs/nftlabs-sdk-python | 30 | python | def validate_and_normalize_inputs(self, role: Union[(bytes, str)]):
self.validator.assert_valid(method_name='getRoleMemberCount', parameter_name='role', argument_value=role)
return role | def validate_and_normalize_inputs(self, role: Union[(bytes, str)]):
self.validator.assert_valid(method_name='getRoleMemberCount', parameter_name='role', argument_value=role)
return role<|docstring|>Validate the inputs to the getRoleMemberCount method.<|endoftext|> |
3547b7860fddf17b978eaf703beb35cf850b9bbfedb1ef6bbfd641a272117308 | def call(self, role: Union[(bytes, str)], tx_params: Optional[TxParams]=None) -> int:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
role = self.validate_and_normalize_inputs(role)
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method(role).call(tx_params.as_dict())
return int(returned) | Execute underlying contract method via eth_call.
:param tx_params: transaction parameters
:returns: the return value of the underlying method. | thirdweb/abi/multiwrap.py | call | nftlabs/nftlabs-sdk-python | 30 | python | def call(self, role: Union[(bytes, str)], tx_params: Optional[TxParams]=None) -> int:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
role = self.validate_and_normalize_inputs(role)
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method(role).call(tx_params.as_dict())
return int(returned) | def call(self, role: Union[(bytes, str)], tx_params: Optional[TxParams]=None) -> int:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
role = self.validate_and_normalize_inputs(role)
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method(role).call(tx_params.as_dict())
return int(returned)<|docstring|>Execute underlying contract method via eth_call.
:param tx_params: transaction parameters
:returns: the return value of the underlying method.<|endoftext|> |
ed5e7bb8efebffc5294bf0de4ed2024b31fea35791d6445d835f8dc6fad520a4 | def send_transaction(self, role: Union[(bytes, str)], tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
role = self.validate_and_normalize_inputs(role)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(role).transact(tx_params.as_dict()) | Execute underlying contract method via eth_sendTransaction.
:param tx_params: transaction parameters | thirdweb/abi/multiwrap.py | send_transaction | nftlabs/nftlabs-sdk-python | 30 | python | def send_transaction(self, role: Union[(bytes, str)], tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
role = self.validate_and_normalize_inputs(role)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(role).transact(tx_params.as_dict()) | def send_transaction(self, role: Union[(bytes, str)], tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
role = self.validate_and_normalize_inputs(role)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(role).transact(tx_params.as_dict())<|docstring|>Execute underlying contract method via eth_sendTransaction.
:param tx_params: transaction parameters<|endoftext|> |
e561df63cd344b14609b0e8e8ad178be3f709174a1d45687017f6dfc69efb8aa | def build_transaction(self, role: Union[(bytes, str)], tx_params: Optional[TxParams]=None) -> dict:
'Construct calldata to be used as input to the method.'
role = self.validate_and_normalize_inputs(role)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(role).buildTransaction(tx_params.as_dict()) | Construct calldata to be used as input to the method. | thirdweb/abi/multiwrap.py | build_transaction | nftlabs/nftlabs-sdk-python | 30 | python | def build_transaction(self, role: Union[(bytes, str)], tx_params: Optional[TxParams]=None) -> dict:
role = self.validate_and_normalize_inputs(role)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(role).buildTransaction(tx_params.as_dict()) | def build_transaction(self, role: Union[(bytes, str)], tx_params: Optional[TxParams]=None) -> dict:
role = self.validate_and_normalize_inputs(role)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(role).buildTransaction(tx_params.as_dict())<|docstring|>Construct calldata to be used as input to the method.<|endoftext|> |
01d5c30486f6f3e438e4b89cbce5830e7c0c7f2d9cd5f8cce6beff9e1da6608a | def estimate_gas(self, role: Union[(bytes, str)], tx_params: Optional[TxParams]=None) -> int:
'Estimate gas consumption of method call.'
role = self.validate_and_normalize_inputs(role)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(role).estimateGas(tx_params.as_dict()) | Estimate gas consumption of method call. | thirdweb/abi/multiwrap.py | estimate_gas | nftlabs/nftlabs-sdk-python | 30 | python | def estimate_gas(self, role: Union[(bytes, str)], tx_params: Optional[TxParams]=None) -> int:
role = self.validate_and_normalize_inputs(role)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(role).estimateGas(tx_params.as_dict()) | def estimate_gas(self, role: Union[(bytes, str)], tx_params: Optional[TxParams]=None) -> int:
role = self.validate_and_normalize_inputs(role)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(role).estimateGas(tx_params.as_dict())<|docstring|>Estimate gas consumption of method call.<|endoftext|> |
bd6ecbd21737798857673ddd577f664fcc7a46e09b0c38a5ecabaa08667bed75 | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction, validator: Validator=None):
'Persist instance data.'
super().__init__(web3_or_provider, contract_address, validator)
self._underlying_method = contract_function | Persist instance data. | thirdweb/abi/multiwrap.py | __init__ | nftlabs/nftlabs-sdk-python | 30 | python | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction, validator: Validator=None):
super().__init__(web3_or_provider, contract_address, validator)
self._underlying_method = contract_function | def __init__(self, web3_or_provider: Union[(Web3, BaseProvider)], contract_address: str, contract_function: ContractFunction, validator: Validator=None):
super().__init__(web3_or_provider, contract_address, validator)
self._underlying_method = contract_function<|docstring|>Persist instance data.<|endoftext|> |
8573862374b35b69c41524565a33ff357c192a42df89da0a366b862e2b20cb0e | def validate_and_normalize_inputs(self, token_id: int):
'Validate the inputs to the getRoyaltyInfoForToken method.'
self.validator.assert_valid(method_name='getRoyaltyInfoForToken', parameter_name='_tokenId', argument_value=token_id)
token_id = int(token_id)
return token_id | Validate the inputs to the getRoyaltyInfoForToken method. | thirdweb/abi/multiwrap.py | validate_and_normalize_inputs | nftlabs/nftlabs-sdk-python | 30 | python | def validate_and_normalize_inputs(self, token_id: int):
self.validator.assert_valid(method_name='getRoyaltyInfoForToken', parameter_name='_tokenId', argument_value=token_id)
token_id = int(token_id)
return token_id | def validate_and_normalize_inputs(self, token_id: int):
self.validator.assert_valid(method_name='getRoyaltyInfoForToken', parameter_name='_tokenId', argument_value=token_id)
token_id = int(token_id)
return token_id<|docstring|>Validate the inputs to the getRoyaltyInfoForToken method.<|endoftext|> |
996e491e56b4350c42aaab82112ca2bc09289b9d4d54c085a81590b6aa55bc08 | def call(self, token_id: int, tx_params: Optional[TxParams]=None) -> Tuple[(str, int)]:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
token_id = self.validate_and_normalize_inputs(token_id)
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method(token_id).call(tx_params.as_dict())
return (returned[0], returned[1]) | Execute underlying contract method via eth_call.
:param tx_params: transaction parameters
:returns: the return value of the underlying method. | thirdweb/abi/multiwrap.py | call | nftlabs/nftlabs-sdk-python | 30 | python | def call(self, token_id: int, tx_params: Optional[TxParams]=None) -> Tuple[(str, int)]:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
token_id = self.validate_and_normalize_inputs(token_id)
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method(token_id).call(tx_params.as_dict())
return (returned[0], returned[1]) | def call(self, token_id: int, tx_params: Optional[TxParams]=None) -> Tuple[(str, int)]:
'Execute underlying contract method via eth_call.\n\n :param tx_params: transaction parameters\n :returns: the return value of the underlying method.\n '
token_id = self.validate_and_normalize_inputs(token_id)
tx_params = super().normalize_tx_params(tx_params)
returned = self._underlying_method(token_id).call(tx_params.as_dict())
return (returned[0], returned[1])<|docstring|>Execute underlying contract method via eth_call.
:param tx_params: transaction parameters
:returns: the return value of the underlying method.<|endoftext|> |
e27f80815f34ab833e17016d58c78e88a1e64dce6c8824207fba04df6aa3d88e | def send_transaction(self, token_id: int, tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
token_id = self.validate_and_normalize_inputs(token_id)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(token_id).transact(tx_params.as_dict()) | Execute underlying contract method via eth_sendTransaction.
:param tx_params: transaction parameters | thirdweb/abi/multiwrap.py | send_transaction | nftlabs/nftlabs-sdk-python | 30 | python | def send_transaction(self, token_id: int, tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
token_id = self.validate_and_normalize_inputs(token_id)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(token_id).transact(tx_params.as_dict()) | def send_transaction(self, token_id: int, tx_params: Optional[TxParams]=None) -> Union[(HexBytes, bytes)]:
'Execute underlying contract method via eth_sendTransaction.\n\n :param tx_params: transaction parameters\n '
token_id = self.validate_and_normalize_inputs(token_id)
tx_params = super().normalize_tx_params(tx_params)
return self._underlying_method(token_id).transact(tx_params.as_dict())<|docstring|>Execute underlying contract method via eth_sendTransaction.
:param tx_params: transaction parameters<|endoftext|> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.