_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
31
13.1k
language
stringclasses
1 value
meta_information
dict
q30200
PublicKey.from_signature
train
def from_signature(message, signature): """ Attempts to create PublicKey object by deriving it from the message and signature. Args: message (bytes): The message to be verified. signature (Signature): The signature for message. The recovery_id must not be ...
python
{ "resource": "" }
q30201
Signature.from_der
train
def from_der(der): """ Decodes a Signature that was DER-encoded. Args: der (bytes or str): The DER encoding to be decoded. Returns: Signature: The deserialized signature. """ d = get_bytes(der) # d must conform to (from btcd): # [0 ] 0x30...
python
{ "resource": "" }
q30202
Signature.from_bytes
train
def from_bytes(b): """ Extracts the r and s components from a byte string. Args: b (bytes): A 64-byte long string. The first 32 bytes are extracted as the r component and the second 32 bytes are extracted as the s component. Returns: Signat...
python
{ "resource": "" }
q30203
Signature.to_der
train
def to_der(self): """ Encodes this signature using DER Returns: bytes: The DER encoding of (self.r, self.s). """ # Output should be: # 0x30 <length> 0x02 <length r> r 0x02 <length s> s r, s = self._canonicalize()
python
{ "resource": "" }
q30204
HDKey.from_bytes
train
def from_bytes(b): """ Generates either a HDPrivateKey or HDPublicKey from the underlying bytes. The serialization must conform to the description in: https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#serialization-format Args: b (bytes): A byte stream ...
python
{ "resource": "" }
q30205
HDKey.to_b58check
train
def to_b58check(self, testnet=False): """ Generates a Base58Check encoding of this key. Args: testnet (bool): True if the key is to be used with testnet, False otherwise. Returns:
python
{ "resource": "" }
q30206
HDPrivateKey.master_key_from_entropy
train
def master_key_from_entropy(passphrase='', strength=128): """ Generates a master key from system entropy. Args: strength (int): Amount of entropy desired. This should be a multiple of 32 between 128 and 256. passphrase (str): An optional passphrase for the generat...
python
{ "resource": "" }
q30207
HDPrivateKey.master_key_from_seed
train
def master_key_from_seed(seed): """ Generates a master key from a provided seed. Args: seed (bytes or str): a string of bytes or a hex string Returns: HDPrivateKey: the master private key. """ S = get_bytes(seed) I = hmac.new(b"Bitcoin seed", S, ...
python
{ "resource": "" }
q30208
HDPrivateKey.from_parent
train
def from_parent(parent_key, i): """ Derives a child private key from a parent private key. It is not possible to derive a child private key from a public parent key. Args: parent_private_key (HDPrivateKey): """ if not isinstance(parent_key, HDPrivateKey): ...
python
{ "resource": "" }
q30209
is_hex_string
train
def is_hex_string(string): """Check if the string is only composed of hex characters.""" pattern
python
{ "resource": "" }
q30210
long_to_hex
train
def long_to_hex(l, size): """Encode a long value as a hex string, 0-padding to size. Note that size is the size of the resulting hex string. So, for a 32Byte long size should be 64 (two
python
{ "resource": "" }
q30211
PrivateKey.get_public_key
train
def get_public_key(self): """Get the PublicKey for this PrivateKey.""" return PublicKey.from_verifying_key(
python
{ "resource": "" }
q30212
PrivateKey.get_extended_key
train
def get_extended_key(self): """Get the extended key. Extended keys contain the network bytes and the public or private key. """ network_hex_chars = hexlify(
python
{ "resource": "" }
q30213
PrivateKey.from_wif
train
def from_wif(cls, wif, network=BitcoinMainNet): """Import a key in WIF format. WIF is Wallet Import Format. It is a base58 encoded checksummed key. See https://en.bitcoin.it/wiki/Wallet_import_format for a full description. This supports compressed WIFs - see this for an explan...
python
{ "resource": "" }
q30214
PrivateKey.from_master_password
train
def from_master_password(cls, password, network=BitcoinMainNet): """Generate a new key from a master password. This password is hashed via a single round of sha256 and is highly breakable, but it's the standard brainwallet approach.
python
{ "resource": "" }
q30215
PublicKey.get_key
train
def get_key(self, compressed=None): """Get the hex-encoded key. :param compressed: False if you want a standard 65 Byte key (the most standard option). True if you want the compressed 33 Byte form. Defaults to None, which in turn uses the self.compressed attribute. :type...
python
{ "resource": "" }
q30216
PublicKey.from_hex_key
train
def from_hex_key(cls, key, network=BitcoinMainNet): """Load the PublicKey from a compressed or uncompressed hex key. This format is defined in PublicKey.get_key() """ if len(key) == 130 or len(key) == 66: # It might be a hexlified byte array try: ...
python
{ "resource": "" }
q30217
PublicKey.create_point
train
def create_point(self, x, y): """Create an ECDSA point on the SECP256k1 curve with the given coords. :param x: The x coordinate on the curve :type x: long :param y: The y coodinate on the curve :type y: long """ if
python
{ "resource": "" }
q30218
PublicKey.from_point
train
def from_point(cls, point, network=BitcoinMainNet, **kwargs): """Create a PublicKey from a point on the SECP256k1 curve. :param point: A point on the
python
{ "resource": "" }
q30219
get_chart
train
def get_chart(chart_type, time_span=None, rolling_average=None, api_code=None): """Get chart data of a specific chart type. :param str chart_type: type of chart :param str time_span: duration of the chart. Default is 1 year for most charts, 1 week for mempool charts (optional) (Example: 5weeks) ...
python
{ "resource": "" }
q30220
get_pools
train
def get_pools(time_span=None, api_code=None): """Get number of blocks mined by each pool. :param str time_span: duration of the chart. Default is 4days (optional) :param str api_code: Blockchain.info API code (optional) :return: an instance of dict:{str,int} """ resource = 'pools' if t...
python
{ "resource": "" }
q30221
Wallet.send
train
def send(self, to, amount, from_address=None, fee=None): """Send bitcoin from your wallet to a single address. :param str to: recipient bitcoin address :param int amount: amount to send (in satoshi) :param str from_address: specific address to send from (optional) :param int fee...
python
{ "resource": "" }
q30222
Wallet.send_many
train
def send_many(self, recipients, from_address=None, fee=None): """Send bitcoin from your wallet to multiple addresses. :param dictionary recipients: dictionary with the structure of 'address':amount :param str from_address: specific address to send from (optional) :param int fee: transac...
python
{ "resource": "" }
q30223
Wallet.list_addresses
train
def list_addresses(self): """List all active addresses in the wallet. :return: an array of :class:`Address` objects """ params = self.build_basic_request() response = util.call_api("merchant/{0}/list".format(self.identifier), params, base_url=self.service_url) ...
python
{ "resource": "" }
q30224
create_wallet
train
def create_wallet(password, api_code, service_url, priv=None, label=None, email=None): """Create a new Blockchain.info wallet. It can be created containing a pre-generated private key or will otherwise generate a new private key. :param str password: password for the new wallet. At least 10 c...
python
{ "resource": "" }
q30225
get_block
train
def get_block(block_id, api_code=None): """Get a single block based on a block hash. :param str block_id: block hash to look up :param str api_code: Blockchain.info API code (optional) :return: an instance of :class:`Block` class """ resource = 'rawblock/' + block_id if api_code is not Non...
python
{ "resource": "" }
q30226
get_tx
train
def get_tx(tx_id, api_code=None): """Get a single transaction based on a transaction hash. :param str tx_id: transaction hash to look up :param str api_code: Blockchain.info API code (optional) :return: an instance of :class:`Transaction` class """ resource = 'rawtx/' + tx_id if api_code i...
python
{ "resource": "" }
q30227
get_block_height
train
def get_block_height(height, api_code=None): """Get an array of blocks at the specified height. :param int height: block height to look up :param str api_code: Blockchain.info API code (optional) :return: an array of :class:`Block` objects """ resource = 'block-height/{0}?format=json'.format(h...
python
{ "resource": "" }
q30228
get_address
train
def get_address(address, filter=None, limit=None, offset=None, api_code=None): """Get data for a single address including an address balance and list of relevant transactions. :param str address: address(base58 or hash160) to look up :param FilterType filter: the filter for transactions selection (optional...
python
{ "resource": "" }
q30229
get_xpub
train
def get_xpub(xpub, filter=None, limit=None, offset=None, api_code=None): """Get data for a single xpub including balance and list of relevant transactions. :param str xpub: address(xpub) to look up :param FilterType filter: the filter for transactions selection (optional) :param int limit: limit number...
python
{ "resource": "" }
q30230
get_multi_address
train
def get_multi_address(addresses, filter=None, limit=None, offset=None, api_code=None): """Get aggregate summary for multiple addresses including overall balance, per address balance and list of relevant transactions. :param tuple addresses: addresses(xpub or base58) to look up :param FilterType filter...
python
{ "resource": "" }
q30231
get_balance
train
def get_balance(addresses, filter=None, api_code=None): """Get balances for each address provided. :param tuple addresses: addresses(xpub or base58) to look up :param FilterType filter: the filter for transactions selection (optional) :param str api_code: Blockchain.info API code (optional) :return...
python
{ "resource": "" }
q30232
get_unspent_outputs
train
def get_unspent_outputs(addresses, confirmations=None, limit=None, api_code=None): """Get unspent outputs for a single address. :param tuple addresses: addresses(xpub or base58) to look up :param int confirmations: minimum confirmations to include (optional) :param int limit: limit number of unspent ou...
python
{ "resource": "" }
q30233
get_unconfirmed_tx
train
def get_unconfirmed_tx(api_code=None): """Get a list of currently unconfirmed transactions. :param str api_code: Blockchain.info API code (optional) :return: an array of :class:`Transaction` objects
python
{ "resource": "" }
q30234
get_blocks
train
def get_blocks(time=None, pool_name=None, api_code=None): """Get a list of blocks for a specific day or mining pool. Both parameters are optional but at least one is required. :param int time: time in milliseconds :param str pool_name: name of the mining pool :param str api_code: Blockchain.info AP...
python
{ "resource": "" }
q30235
Culebron.populateViewTree
train
def populateViewTree(self, view): ''' Populates the View tree. ''' vuid = view.getUniqueId() text = view.__smallStr__() if view.getParent() is None: self.viewTree.insert('', Tkinter.END, vuid, text=text) else:
python
{ "resource": "" }
q30236
Culebron.command
train
def command(self, keycode): ''' Presses a key. Generates the actual key press on the device and prints the line in the script. '''
python
{ "resource": "" }
q30237
Culebron.cancelOperation
train
def cancelOperation(self): ''' Cancels the ongoing operation if any. ''' if self.isLongTouchingPoint:
python
{ "resource": "" }
q30238
Culebron.saveSnapshot
train
def saveSnapshot(self): ''' Saves the current shanpshot to the specified file. Current snapshot is the image being displayed on the main window. ''' filename = self.snapshotDir + os.sep + '${serialno}-${focusedwindowname}-${timestamp}' + '.' + self.snapshotFormat.lower() ...
python
{ "resource": "" }
q30239
Culebron.saveViewSnapshot
train
def saveViewSnapshot(self, view): ''' Saves the View snapshot. ''' if not view: raise ValueError("view must be provided to take snapshot") filename = self.snapshotDir + os.sep + '${serialno}-' + view.variableNameFromId() + '-${timestamp}' + '.' + self.snapshotFormat....
python
{ "resource": "" }
q30240
Culebron.toggleLongTouchPoint
train
def toggleLongTouchPoint(self): ''' Toggles the long touch point operation. ''' if not self.isLongTouchingPoint: msg = 'Long touching point' self.toast(msg, background=Color.GREEN) self.statusBar.set(msg) self.isLongTouchingPoint = True ...
python
{ "resource": "" }
q30241
WifiManager.getWifiState
train
def getWifiState(self): ''' Gets the Wi-Fi enabled state. @return: One of WIFI_STATE_DISABLED, WIFI_STATE_DISABLING, WIFI_STATE_ENABLED, WIFI_STATE_ENABLING, WIFI_STATE_UNKNOWN ''' result = self.device.shell('dumpsys wifi')
python
{ "resource": "" }
q30242
AdbClient.setTimer
train
def setTimer(self, timeout, description=None): """ Sets a timer. :param description: :param timeout: timeout in seconds :return: the timerId """ self.timerId += 1 timer =
python
{ "resource": "" }
q30243
AdbClient.getProperty
train
def getProperty(self, key, strip=True): ''' Gets the property value for key ''' self.__checkTransport() import collections MAP_PROPS = collections.OrderedDict([ (re.compile('display.width'), self.__getDisplayWidth), (re.compile('display.height'), self.__getDispla...
python
{ "resource": "" }
q30244
AdbClient.isLocked
train
def isLocked(self): ''' Checks if the device screen is locked. @return True if the device screen is locked ''' self.__checkTransport() lockScreenRE = re.compile('mShowingLockscreen=(true|false)') dwp = self.shell('dumpsys window policy') m = lockScreenRE...
python
{ "resource": "" }
q30245
AdbClient.isScreenOn
train
def isScreenOn(self): """ Checks if the screen is ON. @return: True if the device screen is ON """ self.__checkTransport() screenOnRE = re.compile('mScreenOnFully=(true|false)')
python
{ "resource": "" }
q30246
AdbClient.percentSame
train
def percentSame(image1, image2): ''' Returns the percent of pixels that are equal @author: catshoes ''' # If the images differ in size, return 0% same. size_x1, size_y1 = image1.size size_x2, size_y2 = image2.size if (size_x1 != size_x2 or ...
python
{ "resource": "" }
q30247
AdbClient.imageInScreen
train
def imageInScreen(screen, image): """ Checks if image is on the screen @param screen: the screen image @param image: the partial image to look for @return: True or False @author: Perry Tsai <ripple0129@gmail.com> """ # To make sure image smaller than sc...
python
{ "resource": "" }
q30248
AdbClient.isKeyboardShown
train
def isKeyboardShown(self): ''' Whether the keyboard is displayed. ''' self.__checkTransport()
python
{ "resource": "" }
q30249
ControlPanel.tabLayout
train
def tabLayout(self): ''' For all tabs, specify the number of buttons in a row ''' self.childWindow.column += 1
python
{ "resource": "" }
q30250
debugArgsToDict
train
def debugArgsToDict(a): """ Converts a string representation of debug arguments to a dictionary. The string can be of the form IDENTIFIER1=val1,IDENTIFIER2=val2
python
{ "resource": "" }
q30251
View.getHeight
train
def getHeight(self): ''' Gets the height. ''' if self.useUiAutomator: return self.map['bounds'][1][1] - self.map['bounds'][0][1]
python
{ "resource": "" }
q30252
View.getWidth
train
def getWidth(self): ''' Gets the width. ''' if self.useUiAutomator: return self.map['bounds'][1][0] - self.map['bounds'][0][0]
python
{ "resource": "" }
q30253
View.getVisibility
train
def getVisibility(self): ''' Gets the View visibility ''' try: if self.map[GET_VISIBILITY_PROPERTY] == 'VISIBLE': return VISIBLE elif self.map[GET_VISIBILITY_PROPERTY] == 'INVISIBLE': return INVISIBLE
python
{ "resource": "" }
q30254
View.__getX
train
def __getX(self): ''' Gets the View X coordinate ''' if DEBUG_COORDS: print >>sys.stderr, "getX(%s %s ## %s)" % (self.getClass(), self.getId(), self.getUniqueId()) x = 0 if self.useUiAutomator: x = self.map['bounds'][0][0] else: ...
python
{ "resource": "" }
q30255
View.__getY
train
def __getY(self): ''' Gets the View Y coordinate ''' if DEBUG_COORDS: print >>sys.stderr, "getY(%s %s ## %s)" % (self.getClass(), self.getId(), self.getUniqueId()) y = 0 if self.useUiAutomator: y = self.map['bounds'][0][1] else: ...
python
{ "resource": "" }
q30256
View.getCoords
train
def getCoords(self): ''' Gets the coords of the View @return: A tuple containing the View's coordinates ((L, T), (R, B)) ''' if DEBUG_COORDS: print >>sys.stderr, "getCoords(%s %s ##
python
{ "resource": "" }
q30257
View.getCenter
train
def getCenter(self): ''' Gets the center coords of the View @author: U{Dean Morin <https://github.com/deanmorin>} '''
python
{ "resource": "" }
q30258
View.isFocused
train
def isFocused(self): ''' Gets the focused value @return: the focused value. If the property cannot be found returns C{False} ''' try: return True
python
{ "resource": "" }
q30259
EditText.setText
train
def setText(self, text): """ This function makes sure that any previously entered text is deleted before setting the value of the field. """ if self.text() == text: return self.touch() maxSize = len(self.text()) + 1
python
{ "resource": "" }
q30260
UiDevice.openNotification
train
def openNotification(self): ''' Opens the notification shade. ''' # the tablet has a different Notification/Quick Settings bar depending on x w13 = self.device.display['width'] / 3 s = (w13, 0)
python
{ "resource": "" }
q30261
UiDevice.openQuickSettings
train
def openQuickSettings(self): ''' Opens the Quick Settings shade. ''' # the tablet has a different Notification/Quick Settings bar depending on x w23 = 2 * self.device.display['width'] / 3 s = (w23, 0) e = (w23, self.device.display['height']/2) self.device...
python
{ "resource": "" }
q30262
UiAutomator2AndroidViewClient.StartElement
train
def StartElement(self, name, attributes): ''' Expat start element event handler ''' if name == 'hierarchy': pass elif name == 'node': # Instantiate an Element object attributes['uniqueId'] = 'id/no_id/%d' % self.idCount bounds = re....
python
{ "resource": "" }
q30263
Excerpt2Code.CharacterData
train
def CharacterData(self, data): ''' Expat character data event handler ''' if data.strip():
python
{ "resource": "" }
q30264
ViewClient.__updateNavButtons
train
def __updateNavButtons(self): """ Updates the navigation buttons that might be on the device screen. """ navButtons = None for v in self.views: if v.getId() == 'com.android.systemui:id/nav_buttons': navButtons = v break if navB...
python
{ "resource": "" }
q30265
ViewClient.list
train
def list(self, sleep=1): ''' List the windows. Sleep is useful to wait some time before obtaining the new content when something in the window has changed. This also sets L{self.windows} as the list of windows. @type sleep: int @param sleep: sleep in seconds bef...
python
{ "resource": "" }
q30266
ViewClient.findViewById
train
def findViewById(self, viewId, root="ROOT", viewFilter=None): ''' Finds the View with the specified viewId. @type viewId: str @param viewId: the ID of the view to find @type root: str @type root: View @param root: the root node of the tree where the View will be ...
python
{ "resource": "" }
q30267
ViewClient.findViewByTagOrRaise
train
def findViewByTagOrRaise(self, tag, root="ROOT"): ''' Finds the View with the specified tag or raise a ViewNotFoundException
python
{ "resource": "" }
q30268
ViewClient.findViewWithAttribute
train
def findViewWithAttribute(self, attr, val, root="ROOT"): ''' Finds the View with the specified attribute and value ''' if DEBUG: try: print >> sys.stderr, u'findViewWithAttribute({0}, {1}, {2})'.format(attr, unicode(val, encoding='utf-8', errors='replace'), ro...
python
{ "resource": "" }
q30269
ViewClient.findViewsWithAttribute
train
def findViewsWithAttribute(self, attr, val, root="ROOT"): ''' Finds the Views with the specified attribute and value. This allows you to see all
python
{ "resource": "" }
q30270
ViewClient.findViewWithAttributeThatMatches
train
def findViewWithAttributeThatMatches(self, attr, regex, root="ROOT"): ''' Finds the list of Views with the specified attribute matching regex
python
{ "resource": "" }
q30271
ViewClient.click
train
def click(self, x=-1, y=-1, selector=None): """ An alias for touch.
python
{ "resource": "" }
q30272
ViewClient.pressKeyCode
train
def pressKeyCode(self, keycode, metaState=0): '''By default no meta state''' if self.uiAutomatorHelper: if DEBUG_UI_AUTOMATOR_HELPER: print >> sys.stderr, "pressKeyCode(%d, %d)" % (keycode, metaState)
python
{ "resource": "" }
q30273
ViewClient.__pickleable
train
def __pickleable(tree): ''' Makes the tree pickleable. ''' def removeDeviceReference(view): ''' Removes the reference to a L{MonkeyDevice}. ''' view.device = None ##################################################################...
python
{ "resource": "" }
q30274
ViewClient.distanceTo
train
def distanceTo(self, tree): ''' Calculates the distance between the current state and the tree passed as argument. @type tree: list of Views @param tree: Tree of Views @return:
python
{ "resource": "" }
q30275
ViewClient.distance
train
def distance(tree1, tree2): ''' Calculates the distance between the two trees. @type tree1: list of Views @param tree1: Tree of Views @type tree2: list of Views @param tree2: Tree of Views @return: the distance ''' ################################...
python
{ "resource": "" }
q30276
ViewClient.__hammingDistance
train
def __hammingDistance(s1, s2): ''' Finds the Hamming distance between two strings. @param s1: string @param s2: string @return: the distance @raise ValueError: if the lenght of the strings differ ''' l1 = len(s1)
python
{ "resource": "" }
q30277
ViewClient.hammingDistance
train
def hammingDistance(self, tree): ''' Finds the Hamming distance between this tree and the one passed as argument.
python
{ "resource": "" }
q30278
ViewClient.__levenshteinDistance
train
def __levenshteinDistance(s, t): ''' Find the Levenshtein distance between two Strings. Python version of Levenshtein distance method implemented in Java at U{http://www.java2s.com/Code/Java/Data-Type/FindtheLevenshteindistancebetweentwoStrings.htm}. This is the number of chang...
python
{ "resource": "" }
q30279
ViewClient.levenshteinDistance
train
def levenshteinDistance(self, tree): ''' Finds the Levenshtein distance between this tree and the one passed as argument.
python
{ "resource": "" }
q30280
Worker.run
train
def run(self): """ Continously receive tasks and execute them """ while True: task = self.tasks_queue.get() if task is None: self.tasks_queue.task_done() break # No exception detected in any thread, # continue the execution....
python
{ "resource": "" }
q30281
ThreadPool.add_task
train
def add_task(self, func, *args, **kargs): """ Add
python
{ "resource": "" }
q30282
ThreadPool.start_parallel
train
def start_parallel(self): """ Prepare threads to run tasks"""
python
{ "resource": "" }
q30283
ThreadPool.result
train
def result(self): """ Stop threads and return the result of all called tasks """ # Send None to all threads to cleanly stop them for _ in range(self.num_threads): self.tasks_queue.put(None) # Wait for completion of all the tasks in the queue self.tasks_queue.join() ...
python
{ "resource": "" }
q30284
xml_marshal_bucket_notifications
train
def xml_marshal_bucket_notifications(notifications): """ Marshals the notifications structure for sending to S3 compatible storage :param notifications: Dictionary with following structure: { 'TopicConfigurations': [ { 'Id': 'string', 'Arn': 'string'...
python
{ "resource": "" }
q30285
_add_notification_config_to_xml
train
def _add_notification_config_to_xml(node, element_name, configs): """ Internal function that builds the XML sub-structure for a given kind of notification configuration. """ for config in configs: config_node = s3_xml.SubElement(node, element_name) if 'Id' in config: id...
python
{ "resource": "" }
q30286
xml_marshal_delete_objects
train
def xml_marshal_delete_objects(object_names): """ Marshal Multi-Object Delete request body from object names. :param object_names: List of object keys to be deleted. :return: Serialized XML string for multi-object delete request body. """ root = s3_xml.Element('Delete') # use quiet mode in...
python
{ "resource": "" }
q30287
PostPolicy.set_key
train
def set_key(self, key): """ Set key policy condition. :param key: set key name. """ is_non_empty_string(key)
python
{ "resource": "" }
q30288
PostPolicy.set_key_startswith
train
def set_key_startswith(self, key_startswith): """ Set key startswith policy condition. :param key_startswith: set key
python
{ "resource": "" }
q30289
PostPolicy.set_bucket_name
train
def set_bucket_name(self, bucket_name): """ Set bucket name policy condition. :param bucket_name: set bucket name. """ is_valid_bucket_name(bucket_name)
python
{ "resource": "" }
q30290
PostPolicy.set_content_type
train
def set_content_type(self, content_type): """ Set content-type policy condition. :param content_type: set content type name. """
python
{ "resource": "" }
q30291
PostPolicy.base64
train
def base64(self, extras=()): """ Encode json into base64. """ s = self._marshal_json(extras=extras) s_bytes = s if isinstance(s, bytes) else s.encode('utf-8')
python
{ "resource": "" }
q30292
PostPolicy.is_valid
train
def is_valid(self): """ Validate for required parameters. """ if not isinstance(self._expiration, datetime.datetime): raise InvalidArgumentError('Expiration datetime must
python
{ "resource": "" }
q30293
post_presign_signature
train
def post_presign_signature(date, region, secret_key, policy_str): """ Calculates signature version '4' for POST policy string. :param date: datetime formatted date. :param region: region of the bucket for the policy. :param secret_key: Amazon S3 secret access key. :param policy_str: policy stri...
python
{ "resource": "" }
q30294
presign_v4
train
def presign_v4(method, url, access_key, secret_key, session_token=None, region=None, headers=None, expires=None, response_headers=None, request_date=None): """ Calculates signature version '4' for regular presigned URLs. :param method: Method to be presigned examples 'PUT', 'G...
python
{ "resource": "" }
q30295
get_signed_headers
train
def get_signed_headers(headers): """ Get signed headers. :param headers: input dictionary to be sorted. """ signed_headers = []
python
{ "resource": "" }
q30296
sign_v4
train
def sign_v4(method, url, region, headers=None, access_key=None, secret_key=None, session_token=None, content_sha256=None): """ Signature version 4. :param method: HTTP method used for signature. :param url: Final url which needs to be signed. :param r...
python
{ "resource": "" }
q30297
generate_canonical_request
train
def generate_canonical_request(method, parsed_url, headers, signed_headers, content_sha256): """ Generate canonical request. :param method: HTTP method. :param parsed_url: Parsed url is input from :func:`urlsplit` :param headers: HTTP header dictionary. :param content_sha256: Content sha256 hex...
python
{ "resource": "" }
q30298
generate_string_to_sign
train
def generate_string_to_sign(date, region, canonical_request): """ Generate string to sign. :param date: Date is input from :meth:`datetime.datetime` :param region: Region should be set to bucket region. :param canonical_request: Canonical request generated previously. """ formatted_date_tim...
python
{ "resource": "" }
q30299
generate_signing_key
train
def generate_signing_key(date, region, secret_key): """ Generate signing key. :param date: Date is input from :meth:`datetime.datetime` :param region: Region should be set to bucket region. :param secret_key: Secret access key. """ formatted_date = date.strftime("%Y%m%d") key1_string =...
python
{ "resource": "" }