text stringlengths 0 828 |
|---|
"""""" |
Prepare a query object for the RAPI. |
RAPI has lots of curious rules for coercing values. |
This function operates on dicts in-place and has no return value. |
@type query: dict |
@param query: Query arguments |
"""""" |
for name in query: |
value = query[name] |
# None is sent as an empty string. |
if value is None: |
query[name] = """" |
# Booleans are sent as 0 or 1. |
elif isinstance(value, bool): |
query[name] = int(value) |
# XXX shouldn't this just check for basestring instead? |
elif isinstance(value, dict): |
raise ValueError(""Invalid query data type %r"" % |
type(value).__name__)" |
1903,"def itemgetters(*args): |
"""""" |
Get a handful of items from an iterable. |
This is just map(itemgetter(...), iterable) with a list comprehension. |
"""""" |
f = itemgetter(*args) |
def inner(l): |
return [f(x) for x in l] |
return inner" |
1904,"def create_container(self, container, **kwargs): |
""""""Create container |
:param container(string): container name (Container is equivalent to |
Bucket term in Amazon). |
:param **kwargs(dict): extend args for specific driver. |
"""""" |
try: |
LOG.debug('create_container() with %s is success.', self.driver) |
return self.driver.create_container(container, **kwargs) |
except DriverException as e: |
LOG.exception('create_container() with %s raised\ |
an exception %s.', self.driver, e)" |
1905,"def delete_container(self, container): |
""""""Delete container |
:param container: container name (Container is equivalent to |
Bucket term in Amazon). |
"""""" |
try: |
LOG.debug('delete_container() with %s is success.', self.driver) |
return self.driver.delete_container(container) |
except DriverException as e: |
LOG.exception('delete_container() with %s raised\ |
an exception %s.', self.driver, e)" |
1906,"def stat_container(self, container): |
""""""Stat container metadata |
:param container: container name (Container is equivalent to |
Bucket term in Amazon). |
"""""" |
LOG.debug('stat_container() with %s is success.', self.driver) |
return self.driver.stat_container(container)" |
1907,"def update_container(self, container, metadata, **kwargs): |
""""""Update container metadata |
:param container: container name (Container is equivalent to |
Bucket term in Amazon). |
:param metadata(dict): additional metadata to include in the request. |
:param **kwargs(dict): extend args for specific driver. |
"""""" |
LOG.debug('update_object() with %s is success.', self.driver) |
return self.driver.update_container(container, metadata, **kwargs)" |
1908,"def upload_object(self, container, obj, contents, |
content_length=None, metadata=None, **kwargs): |
""""""Upload object |
:param container: container name (Container is equivalent to |
Bucket term in Amazon). |
:param obj: object name (Object is equivalent to |
Key term in Amazon). |
:param contents: object content. |
:param content_length(int): content length. |
:param metadata (dict): addition infomation. |
:param **kwargs(dict): extend args for specific driver. |
"""""" |
try: |
LOG.debug('upload_object() with %s is success.', self.driver) |
return self.driver.upload_object(container, obj, |
contents=contents, |
content_length=content_length, |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.