rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
self.host = choose_host () self.debug = choose_debug_mode () self.timeout = choose_http_timeout () def set_debug_timeout (self, v):
self.host = choose_host() self.debug = choose_debug_mode() self.timeout = choose_http_timeout() def set_debug_timeout(self, v):
def set_connection_from_global (self): """Sets the host on the basis of the global variable flags, if that exists. Used to enable the tests to run against alternate hosts.""" self.host = choose_host () self.debug = choose_debug_mode () self.timeout = choose_http_timeout ()
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
self.timeout = float (v) def call (self, method, path, body=None, hash=None, **kw):
self.timeout = float(v) def call(self, method, path, body=None, hash=None, **kw):
def set_debug_timeout (self, v): if self.timeout == HTTP_TIMEOUT: self.timeout = float (v)
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
headers = self.headers.copy ()
headers = self.headers.copy()
def call (self, method, path, body=None, hash=None, **kw): """Calls FluidDB with the attributes given. This function was lifted nearly verbatim from fluiddb.py, by Sanghyeon Seo, with additions by Nicholas Tollervey.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
print ('method: %r\nurl: %r\nbody: %s\nheaders:' %
print('method: %r\nurl: %r\nbody: %s\nheaders:' %
def call (self, method, path, body=None, hash=None, **kw): """Calls FluidDB with the attributes given. This function was lifted nearly verbatim from fluiddb.py, by Sanghyeon Seo, with additions by Nicholas Tollervey.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
print 'status: %d; content: %s' % (status, str (result))
print 'status: %d; content: %s' % (status, str(result))
def call (self, method, path, body=None, hash=None, **kw): """Calls FluidDB with the attributes given. This function was lifted nearly verbatim from fluiddb.py, by Sanghyeon Seo, with additions by Nicholas Tollervey.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
def _get_tag_value (self, path):
def _get_tag_value(self, path):
def _get_tag_value (self, path): headers = self.headers.copy () url = _get_url(self.host, path, hash=None, kw=None) http = _get_http(self.timeout) response, content = http.request(url, 'GET', None, headers) content_type = response['content-type'] if content_type == PRIMITIVE_CONTENT_TYPE: result = json.loads(content) content_type = None else: result = content return response.status, (result, content_type)
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
def _set_tag_value (self, path, value, value_type=None): headers = self.headers.copy ()
def _set_tag_value(self, path, value, value_type=None): headers = self.headers.copy()
def _set_tag_value (self, path, value, value_type=None): headers = self.headers.copy () if value_type is None: value = json.dumps (value) value_type = PRIMITIVE_CONTENT_TYPE headers['content-type'] = value_type url = _get_url(self.host, path, hash=None, kw=None) http = _get_http(self.timeout) response, content = http.request(url, 'PUT', value, headers) return response.status, content
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
value = json.dumps (value)
value = json.dumps(value)
def _set_tag_value (self, path, value, value_type=None): headers = self.headers.copy () if value_type is None: value = json.dumps (value) value_type = PRIMITIVE_CONTENT_TYPE headers['content-type'] = value_type url = _get_url(self.host, path, hash=None, kw=None) http = _get_http(self.timeout) response, content = http.request(url, 'PUT', value, headers) return response.status, content
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
def create_object (self, about=None):
def create_object(self, about=None):
def create_object (self, about=None): """Creates an object with the about tag given. If the object already exists, returns the object instead.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
body = json.dumps ({'about' : about})
body = json.dumps({'about' : about})
def create_object (self, about=None): """Creates an object with the about tag given. If the object already exists, returns the object instead.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
(status, o) = self.call ('POST', '/objects', body)
(status, o) = self.call('POST', '/objects', body)
def create_object (self, about=None): """Creates an object with the about tag given. If the object already exists, returns the object instead.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
def create_namespace (self, path, description='',
def create_namespace(self, path, description='',
def create_namespace (self, path, description='', createParentIfNeeded=True, verbose=False): """Creates the namespace specified by path using the description given.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
fullPath = self.abs_tag_path (path) parts = fullPath.split ('/')[1:]
fullPath = self.abs_tag_path(path) parts = fullPath.split('/')[1:]
def create_namespace (self, path, description='', createParentIfNeeded=True, verbose=False): """Creates the namespace specified by path using the description given.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
if len (parts) < 2:
if len(parts) < 2:
def create_namespace (self, path, description='', createParentIfNeeded=True, verbose=False): """Creates the namespace specified by path using the description given.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
parent = '/'.join (parts[:-1])
parent = '/'.join(parts[:-1])
def create_namespace (self, path, description='', createParentIfNeeded=True, verbose=False): """Creates the namespace specified by path using the description given.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
body = json.dumps ({'name' : subNS, 'description' : description}) status, result = self.call ('POST', containingNS, body)
body = json.dumps({'name' : subNS, 'description' : description}) status, result = self.call('POST', containingNS, body)
def create_namespace (self, path, description='', createParentIfNeeded=True, verbose=False): """Creates the namespace specified by path using the description given.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
if len (parts) > 2: self.create_namespace ('/' + parent, verbose=verbose) return self.create_namespace (path, description,
if len(parts) > 2: self.create_namespace('/' + parent, verbose=verbose) return self.create_namespace(path, description,
def create_namespace (self, path, description='', createParentIfNeeded=True, verbose=False): """Creates the namespace specified by path using the description given.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
def delete_namespace (self, path, recurse=False, force=False,
def delete_namespace(self, path, recurse=False, force=False,
def delete_namespace (self, path, recurse=False, force=False, verbose=False): """Deletes the namespace specified by path.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
absPath = self.abs_tag_path (path)
absPath = self.abs_tag_path(path)
def delete_namespace (self, path, recurse=False, force=False, verbose=False): """Deletes the namespace specified by path.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
if fullPath.endswith ('/'):
if fullPath.endswith('/'):
def delete_namespace (self, path, recurse=False, force=False, verbose=False): """Deletes the namespace specified by path.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
status, result = self.call ('DELETE', fullPath)
status, result = self.call('DELETE', fullPath)
def delete_namespace (self, path, recurse=False, force=False, verbose=False): """Deletes the namespace specified by path.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
def describe_namespace (self, path):
def describe_namespace(self, path):
def describe_namespace (self, path): """Returns an object describing the namespace specified by the path.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
absPath = self.abs_tag_path (path)
absPath = self.abs_tag_path(path)
def describe_namespace (self, path): """Returns an object describing the namespace specified by the path.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
if fullPath.endswith ('/'):
if fullPath.endswith('/'):
def describe_namespace (self, path): """Returns an object describing the namespace specified by the path.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
status, result = self.call ('GET', fullPath, returnDescription=True,
status, result = self.call('GET', fullPath, returnDescription=True,
def describe_namespace (self, path): """Returns an object describing the namespace specified by the path.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
return O (result) if status == STATUS.OK else status def create_abstract_tag (self, tag, description=None, indexed=True):
return O(result) if status == STATUS.OK else status def create_abstract_tag(self, tag, description=None, indexed=True):
def describe_namespace (self, path): """Returns an object describing the namespace specified by the path.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
(user, subnamespace, tagname) = self.tag_path_split (tag)
(user, subnamespace, tagname) = self.tag_path_split(tag)
def create_abstract_tag (self, tag, description=None, indexed=True): """Creates an (abstract) tag with the name (full path) given. The tag is not applied to any object. If the tag's name (tag) contains slashes, namespaces are created as needed.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
fields = json.dumps (hash) (status, o) = self.call ('POST', fullnamespace, fields)
fields = json.dumps(hash) (status, o) = self.call('POST', fullnamespace, fields)
def create_abstract_tag (self, tag, description=None, indexed=True): """Creates an (abstract) tag with the name (full path) given. The tag is not applied to any object. If the tag's name (tag) contains slashes, namespaces are created as needed.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
id = self.create_namespace (namespace) if type (id) in types.StringTypes:
id = self.create_namespace(namespace) if type(id) in types.StringTypes:
def create_abstract_tag (self, tag, description=None, indexed=True): """Creates an (abstract) tag with the name (full path) given. The tag is not applied to any object. If the tag's name (tag) contains slashes, namespaces are created as needed.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
(status, o) = self.call ('POST', fullnamespace, fields)
(status, o) = self.call('POST', fullnamespace, fields)
def create_abstract_tag (self, tag, description=None, indexed=True): """Creates an (abstract) tag with the name (full path) given. The tag is not applied to any object. If the tag's name (tag) contains slashes, namespaces are created as needed.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
def delete_abstract_tag (self, tag):
def delete_abstract_tag(self, tag):
def delete_abstract_tag (self, tag): """Deletes an abstract tag, removing all of its concrete instances from objects. Use with care. So db.delete_abstract_tag ('njr/rating') removes the njr/rating from ALL OBJECTS IN FLUIDDB.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
So db.delete_abstract_tag ('njr/rating') removes
So db.delete_abstract_tag('njr/rating') removes
def delete_abstract_tag (self, tag): """Deletes an abstract tag, removing all of its concrete instances from objects. Use with care. So db.delete_abstract_tag ('njr/rating') removes the njr/rating from ALL OBJECTS IN FLUIDDB.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
fullTag = self.full_tag_path (tag) (status, o) = self.call ('DELETE', fullTag)
fullTag = self.full_tag_path(tag) (status, o) = self.call('DELETE', fullTag)
def delete_abstract_tag (self, tag): """Deletes an abstract tag, removing all of its concrete instances from objects. Use with care. So db.delete_abstract_tag ('njr/rating') removes the njr/rating from ALL OBJECTS IN FLUIDDB.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
def tag_object_by_id (self, id, tag, value=None, value_type=None,
def tag_object_by_id(self, id, tag, value=None, value_type=None,
def tag_object_by_id (self, id, tag, value=None, value_type=None, createAbstractTagIfNeeded=True): """Tags the object with the given id with the tag given, and the value given, if present. If the (abstract) tag with corresponding to the tag given doesn't exist, it is created unless createAbstractTagIfNeeded is set to False. """ fullTag = self.abs_tag_path (tag) objTag = '/objects/%s%s' % (id, fullTag)
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
fullTag = self.abs_tag_path (tag)
fullTag = self.abs_tag_path(tag)
def tag_object_by_id (self, id, tag, value=None, value_type=None, createAbstractTagIfNeeded=True): """Tags the object with the given id with the tag given, and the value given, if present. If the (abstract) tag with corresponding to the tag given doesn't exist, it is created unless createAbstractTagIfNeeded is set to False. """ fullTag = self.abs_tag_path (tag) objTag = '/objects/%s%s' % (id, fullTag)
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
(status, o) = self._set_tag_value (objTag, value, value_type)
(status, o) = self._set_tag_value(objTag, value, value_type)
def tag_object_by_id (self, id, tag, value=None, value_type=None, createAbstractTagIfNeeded=True): """Tags the object with the given id with the tag given, and the value given, if present. If the (abstract) tag with corresponding to the tag given doesn't exist, it is created unless createAbstractTagIfNeeded is set to False. """ fullTag = self.abs_tag_path (tag) objTag = '/objects/%s%s' % (id, fullTag)
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
o = self.create_abstract_tag (tag) if type (o) == types.IntType:
o = self.create_abstract_tag(tag) if type(o) == types.IntType:
def tag_object_by_id (self, id, tag, value=None, value_type=None, createAbstractTagIfNeeded=True): """Tags the object with the given id with the tag given, and the value given, if present. If the (abstract) tag with corresponding to the tag given doesn't exist, it is created unless createAbstractTagIfNeeded is set to False. """ fullTag = self.abs_tag_path (tag) objTag = '/objects/%s%s' % (id, fullTag)
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
return self.tag_object_by_id (id, tag, value, value_type, False)
return self.tag_object_by_id(id, tag, value, value_type, False)
def tag_object_by_id (self, id, tag, value=None, value_type=None, createAbstractTagIfNeeded=True): """Tags the object with the given id with the tag given, and the value given, if present. If the (abstract) tag with corresponding to the tag given doesn't exist, it is created unless createAbstractTagIfNeeded is set to False. """ fullTag = self.abs_tag_path (tag) objTag = '/objects/%s%s' % (id, fullTag)
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
def untag_object_by_id (self, id, tag, missingConstitutesSuccess=True):
def untag_object_by_id(self, id, tag, missingConstitutesSuccess=True):
def untag_object_by_id (self, id, tag, missingConstitutesSuccess=True): """Removes the tag from the object with id if present. If the tag, or the object, doesn't exist, the default is that this is considered successful, but missingConstitutesSuccess can be set to False to override this behaviour.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
fullTag = self.abs_tag_path (tag)
fullTag = self.abs_tag_path(tag)
def untag_object_by_id (self, id, tag, missingConstitutesSuccess=True): """Removes the tag from the object with id if present. If the tag, or the object, doesn't exist, the default is that this is considered successful, but missingConstitutesSuccess can be set to False to override this behaviour.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
(status, o) = self.call ('DELETE', objTag)
(status, o) = self.call('DELETE', objTag)
def untag_object_by_id (self, id, tag, missingConstitutesSuccess=True): """Removes the tag from the object with id if present. If the tag, or the object, doesn't exist, the default is that this is considered successful, but missingConstitutesSuccess can be set to False to override this behaviour.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
def get_tag_value_by_id (self, id, tag):
def get_tag_value_by_id(self, id, tag):
def get_tag_value_by_id (self, id, tag): """Gets the value of a tag on an object identified by the object's ID.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
fullTag = self.abs_tag_path (tag)
fullTag = self.abs_tag_path(tag)
def get_tag_value_by_id (self, id, tag): """Gets the value of a tag on an object identified by the object's ID.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
status, (value, value_type) = self._get_tag_value (objTag)
status, (value, value_type) = self._get_tag_value(objTag)
def get_tag_value_by_id (self, id, tag): """Gets the value of a tag on an object identified by the object's ID.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
def get_tag_values_by_id (self, id, tags): return [self.get_tag_value_by_id (id, tag) for tag in tags] def get_tag_values_by_about (self, about, tags): return [self.get_tag_value_by_about (about, tag) for tag in tags] def query (self, query):
def get_tag_values_by_id(self, id, tags): return [self.get_tag_value_by_id(id, tag) for tag in tags] def get_tag_values_by_about(self, about, tags): return [self.get_tag_value_by_about(about, tag) for tag in tags] def query(self, query):
def get_tag_values_by_id (self, id, tags): return [self.get_tag_value_by_id (id, tag) for tag in tags]
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
(status, o) = self.call ('GET', '/objects', query=query)
(status, o) = self.call('GET', '/objects', query=query)
def query (self, query): """Runs the query to get the IDs of objects satisfying the query. If the query is successful, the list of ids is returned, as a list; otherwise, an error code is returned. """ (status, o) = self.call ('GET', '/objects', query=query) return status if status != STATUS.OK else o['ids']
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
def abs_tag_path (self, tag):
def abs_tag_path(self, tag):
def abs_tag_path (self, tag): """Returns the absolute path for the tag nominated, in the form /namespace/.../shortTagName If the already tag starts with a '/', no action is taken; if it doesn't, the username from the current credentials is added.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
abs_tag_path ('rating') = '/njr/rating' abs_tag_path ('/njr/rating') = '/njr/rating' abs_tag_path ('/tags/njr/rating') = '/njr/rating' abs_tag_path ('foo/rating') = '/njr/foo/rating' abs_tag_path ('/njr/foo/rating') = '/njr/foo/rating' abs_tag_path ('/tags/njr/foo/rating') = '/njr/foo/rating'
abs_tag_path('rating') = '/njr/rating' abs_tag_path('/njr/rating') = '/njr/rating' abs_tag_path('/tags/njr/rating') = '/njr/rating' abs_tag_path('foo/rating') = '/njr/foo/rating' abs_tag_path('/njr/foo/rating') = '/njr/foo/rating' abs_tag_path('/tags/njr/foo/rating') = '/njr/foo/rating'
def abs_tag_path (self, tag): """Returns the absolute path for the tag nominated, in the form /namespace/.../shortTagName If the already tag starts with a '/', no action is taken; if it doesn't, the username from the current credentials is added.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
if tag.startswith ('/'): if tag.startswith ('/tags/'):
if tag.startswith('/'): if tag.startswith('/tags/'):
def abs_tag_path (self, tag): """Returns the absolute path for the tag nominated, in the form /namespace/.../shortTagName If the already tag starts with a '/', no action is taken; if it doesn't, the username from the current credentials is added.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
def full_tag_path (self, tag):
def full_tag_path(self, tag):
def full_tag_path (self, tag): """Returns the absolute tag path (see above), prefixed with /tag.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
full_tag_path ('foo/rating') = '/tags/njr/foo/rating' full_tag_path ('/njr/foo/rating') = '/tags/njr/foo/rating' full_tag_path ('/tags/njr/foo/rating') = '/tags/njr/foo/rating' """ if tag.startswith ('/tags/'):
full_tag_path('foo/rating') = '/tags/njr/foo/rating' full_tag_path('/njr/foo/rating') = '/tags/njr/foo/rating' full_tag_path('/tags/njr/foo/rating') = '/tags/njr/foo/rating' """ if tag.startswith('/tags/'):
def full_tag_path (self, tag): """Returns the absolute tag path (see above), prefixed with /tag.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
return '/tags%s' % self.abs_tag_path (tag) def tag_path_split (self, tag):
return '/tags%s' % self.abs_tag_path(tag) def tag_path_split(self, tag):
def full_tag_path (self, tag): """Returns the absolute tag path (see above), prefixed with /tag.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
tag_path_split ('rating') = ('njr', '', 'rating') tag_path_split ('/njr/rating') = ('njr', '', 'rating') tag_path_split ('/tags/njr/rating') = ('njr', '', 'rating') tag_path_split ('foo/rating') = ('njr', 'foo', 'rating') tag_path_split ('/njr/foo/rating') = ('njr', 'foo', 'rating') tag_path_split ('/tags/njr/foo/rating') = ('njr', 'foo',
tag_path_split('rating') = ('njr', '', 'rating') tag_path_split('/njr/rating') = ('njr', '', 'rating') tag_path_split('/tags/njr/rating') = ('njr', '', 'rating') tag_path_split('foo/rating') = ('njr', 'foo', 'rating') tag_path_split('/njr/foo/rating') = ('njr', 'foo', 'rating') tag_path_split('/tags/njr/foo/rating') = ('njr', 'foo',
def tag_path_split (self, tag): """A bit like os.path.split, this splits any old kind of a FluidDB tag path into a user, a subnamespace (if there is one) and a tag. But unlike os.path.split, if no namespace is given, the one from the user credentials is returned.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
tag_path_split ('foo/bar/rating') = ('njr', 'foo/bar', 'rating') tag_path_split ('/njr/foo/bar/rating') = ('njr', 'foo/bar',
tag_path_split('foo/bar/rating') = ('njr', 'foo/bar', 'rating') tag_path_split('/njr/foo/bar/rating') = ('njr', 'foo/bar',
def tag_path_split (self, tag): """A bit like os.path.split, this splits any old kind of a FluidDB tag path into a user, a subnamespace (if there is one) and a tag. But unlike os.path.split, if no namespace is given, the one from the user credentials is returned.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
tag_path_split ('/tags/njr/foo/bar/rating') = ('njr', 'foo/bar',
tag_path_split('/tags/njr/foo/bar/rating') = ('njr', 'foo/bar',
def tag_path_split (self, tag): """A bit like os.path.split, this splits any old kind of a FluidDB tag path into a user, a subnamespace (if there is one) and a tag. But unlike os.path.split, if no namespace is given, the one from the user credentials is returned.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
tag = self.abs_tag_path (tag) parts = tag.split ('/')
tag = self.abs_tag_path(tag) parts = tag.split('/')
def tag_path_split (self, tag): """A bit like os.path.split, this splits any old kind of a FluidDB tag path into a user, a subnamespace (if there is one) and a tag. But unlike os.path.split, if no namespace is given, the one from the user credentials is returned.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
if len (parts) < 3:
if len(parts) < 3:
def tag_path_split (self, tag): """A bit like os.path.split, this splits any old kind of a FluidDB tag path into a user, a subnamespace (if there is one) and a tag. But unlike os.path.split, if no namespace is given, the one from the user credentials is returned.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
if len (parts) > 3: subnamespace = '/'.join (parts[2:-1])
if len(parts) > 3: subnamespace = '/'.join(parts[2:-1])
def tag_path_split (self, tag): """A bit like os.path.split, this splits any old kind of a FluidDB tag path into a user, a subnamespace (if there is one) and a tag. But unlike os.path.split, if no namespace is given, the one from the user credentials is returned.
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
def object_uri (id):
def object_uri(id):
def object_uri (id): """Returns the full URI for the FluidDB object with the given id.""" return '%s/objects/%s' % (FLUIDDB_PATH, id)
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
def tag_uri (namespace, tag):
def tag_uri(namespace, tag):
def tag_uri (namespace, tag): """Returns the full URI for the FluidDB tag with the given id.""" return '%s/tags/%s/%s' % (FLUIDDB_PATH, namespace, tag)
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
def get_credentials_file (unixFile=UNIX_CREDENTIALS_FILE,
def get_credentials_file(unixFile=UNIX_CREDENTIALS_FILE,
def get_credentials_file (unixFile=UNIX_CREDENTIALS_FILE, windowsFile=WINDOWS_CREDENTIALS_FILE): if os.name == 'posix': homeDir = os.path.expanduser('~') return os.path.join (homeDir, unixFile) elif os.name : from win32com.shell import shellcon, shell homeDir = shell.SHGetFolderPath(0, shellcon.CSIDL_APPDATA, 0, 0) return os.path.join (homeDir, windowsFile) else: return None
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
return os.path.join (homeDir, unixFile)
return os.path.join(homeDir, unixFile)
def get_credentials_file (unixFile=UNIX_CREDENTIALS_FILE, windowsFile=WINDOWS_CREDENTIALS_FILE): if os.name == 'posix': homeDir = os.path.expanduser('~') return os.path.join (homeDir, unixFile) elif os.name : from win32com.shell import shellcon, shell homeDir = shell.SHGetFolderPath(0, shellcon.CSIDL_APPDATA, 0, 0) return os.path.join (homeDir, windowsFile) else: return None
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
return os.path.join (homeDir, windowsFile)
return os.path.join(homeDir, windowsFile)
def get_credentials_file (unixFile=UNIX_CREDENTIALS_FILE, windowsFile=WINDOWS_CREDENTIALS_FILE): if os.name == 'posix': homeDir = os.path.expanduser('~') return os.path.join (homeDir, unixFile) elif os.name : from win32com.shell import shellcon, shell homeDir = shell.SHGetFolderPath(0, shellcon.CSIDL_APPDATA, 0, 0) return os.path.join (homeDir, windowsFile) else: return None
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
def get_typed_tag_value (v):
def get_typed_tag_value(v):
def get_typed_tag_value (v): """Uses some simple rules to extract simple typed values from strings. Specifically: true and t (any case) return True (boolean) false and f (any case) return False (boolean) simple integers (possibly signed) are returned as ints simple floats (possibly signed) are returned as floats (supports '.' and ',' as floating-point separator, subject to locale) Everything else is returned as a string, with matched enclosing quotes stripped. """ if v.lower () in ('true', 't'): return True elif v.lower () in ('false', 'f'): return False elif re.match (INTEGER_RE, v): return int (v) elif re.match (DECIMAL_RE, v) or re.match (DECIMAL_RE2, v): try: r = float (v) except ValueError: return str (v) return r elif len (v) > 1 and v[0] == v[-1] and v[0] in ('"\''): return v[1:-1] else: return str (v)
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
if v.lower () in ('true', 't'):
if v.lower() in ('true', 't'):
def get_typed_tag_value (v): """Uses some simple rules to extract simple typed values from strings. Specifically: true and t (any case) return True (boolean) false and f (any case) return False (boolean) simple integers (possibly signed) are returned as ints simple floats (possibly signed) are returned as floats (supports '.' and ',' as floating-point separator, subject to locale) Everything else is returned as a string, with matched enclosing quotes stripped. """ if v.lower () in ('true', 't'): return True elif v.lower () in ('false', 'f'): return False elif re.match (INTEGER_RE, v): return int (v) elif re.match (DECIMAL_RE, v) or re.match (DECIMAL_RE2, v): try: r = float (v) except ValueError: return str (v) return r elif len (v) > 1 and v[0] == v[-1] and v[0] in ('"\''): return v[1:-1] else: return str (v)
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
elif v.lower () in ('false', 'f'):
elif v.lower() in ('false', 'f'):
def get_typed_tag_value (v): """Uses some simple rules to extract simple typed values from strings. Specifically: true and t (any case) return True (boolean) false and f (any case) return False (boolean) simple integers (possibly signed) are returned as ints simple floats (possibly signed) are returned as floats (supports '.' and ',' as floating-point separator, subject to locale) Everything else is returned as a string, with matched enclosing quotes stripped. """ if v.lower () in ('true', 't'): return True elif v.lower () in ('false', 'f'): return False elif re.match (INTEGER_RE, v): return int (v) elif re.match (DECIMAL_RE, v) or re.match (DECIMAL_RE2, v): try: r = float (v) except ValueError: return str (v) return r elif len (v) > 1 and v[0] == v[-1] and v[0] in ('"\''): return v[1:-1] else: return str (v)
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
elif re.match (INTEGER_RE, v): return int (v) elif re.match (DECIMAL_RE, v) or re.match (DECIMAL_RE2, v):
elif re.match(INTEGER_RE, v): return int(v) elif re.match(DECIMAL_RE, v) or re.match(DECIMAL_RE2, v):
def get_typed_tag_value (v): """Uses some simple rules to extract simple typed values from strings. Specifically: true and t (any case) return True (boolean) false and f (any case) return False (boolean) simple integers (possibly signed) are returned as ints simple floats (possibly signed) are returned as floats (supports '.' and ',' as floating-point separator, subject to locale) Everything else is returned as a string, with matched enclosing quotes stripped. """ if v.lower () in ('true', 't'): return True elif v.lower () in ('false', 'f'): return False elif re.match (INTEGER_RE, v): return int (v) elif re.match (DECIMAL_RE, v) or re.match (DECIMAL_RE2, v): try: r = float (v) except ValueError: return str (v) return r elif len (v) > 1 and v[0] == v[-1] and v[0] in ('"\''): return v[1:-1] else: return str (v)
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
r = float (v)
r = float(v)
def get_typed_tag_value (v): """Uses some simple rules to extract simple typed values from strings. Specifically: true and t (any case) return True (boolean) false and f (any case) return False (boolean) simple integers (possibly signed) are returned as ints simple floats (possibly signed) are returned as floats (supports '.' and ',' as floating-point separator, subject to locale) Everything else is returned as a string, with matched enclosing quotes stripped. """ if v.lower () in ('true', 't'): return True elif v.lower () in ('false', 'f'): return False elif re.match (INTEGER_RE, v): return int (v) elif re.match (DECIMAL_RE, v) or re.match (DECIMAL_RE2, v): try: r = float (v) except ValueError: return str (v) return r elif len (v) > 1 and v[0] == v[-1] and v[0] in ('"\''): return v[1:-1] else: return str (v)
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
return str (v)
return str(v)
def get_typed_tag_value (v): """Uses some simple rules to extract simple typed values from strings. Specifically: true and t (any case) return True (boolean) false and f (any case) return False (boolean) simple integers (possibly signed) are returned as ints simple floats (possibly signed) are returned as floats (supports '.' and ',' as floating-point separator, subject to locale) Everything else is returned as a string, with matched enclosing quotes stripped. """ if v.lower () in ('true', 't'): return True elif v.lower () in ('false', 'f'): return False elif re.match (INTEGER_RE, v): return int (v) elif re.match (DECIMAL_RE, v) or re.match (DECIMAL_RE2, v): try: r = float (v) except ValueError: return str (v) return r elif len (v) > 1 and v[0] == v[-1] and v[0] in ('"\''): return v[1:-1] else: return str (v)
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
elif len (v) > 1 and v[0] == v[-1] and v[0] in ('"\''):
elif len(v) > 1 and v[0] == v[-1] and v[0] in ('"\''):
def get_typed_tag_value (v): """Uses some simple rules to extract simple typed values from strings. Specifically: true and t (any case) return True (boolean) false and f (any case) return False (boolean) simple integers (possibly signed) are returned as ints simple floats (possibly signed) are returned as floats (supports '.' and ',' as floating-point separator, subject to locale) Everything else is returned as a string, with matched enclosing quotes stripped. """ if v.lower () in ('true', 't'): return True elif v.lower () in ('false', 'f'): return False elif re.match (INTEGER_RE, v): return int (v) elif re.match (DECIMAL_RE, v) or re.match (DECIMAL_RE2, v): try: r = float (v) except ValueError: return str (v) return r elif len (v) > 1 and v[0] == v[-1] and v[0] in ('"\''): return v[1:-1] else: return str (v)
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
return str (v) def form_tag_value_pairs (tags):
return str(v) def form_tag_value_pairs(tags):
def get_typed_tag_value (v): """Uses some simple rules to extract simple typed values from strings. Specifically: true and t (any case) return True (boolean) false and f (any case) return False (boolean) simple integers (possibly signed) are returned as ints simple floats (possibly signed) are returned as floats (supports '.' and ',' as floating-point separator, subject to locale) Everything else is returned as a string, with matched enclosing quotes stripped. """ if v.lower () in ('true', 't'): return True elif v.lower () in ('false', 'f'): return False elif re.match (INTEGER_RE, v): return int (v) elif re.match (DECIMAL_RE, v) or re.match (DECIMAL_RE2, v): try: r = float (v) except ValueError: return str (v) return r elif len (v) > 1 and v[0] == v[-1] and v[0] in ('"\''): return v[1:-1] else: return str (v)
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
eqPos = tag.find ('=')
eqPos = tag.find('=')
def form_tag_value_pairs (tags): pairs = [] for tag in tags: eqPos = tag.find ('=') if eqPos == -1: pairs.append (TagValue (tag, None)) else: t = tag[:eqPos] v = get_typed_tag_value (tag[eqPos+1:]) pairs.append (TagValue (t, v)) return pairs
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
pairs.append (TagValue (tag, None))
pairs.append(TagValue(tag, None))
def form_tag_value_pairs (tags): pairs = [] for tag in tags: eqPos = tag.find ('=') if eqPos == -1: pairs.append (TagValue (tag, None)) else: t = tag[:eqPos] v = get_typed_tag_value (tag[eqPos+1:]) pairs.append (TagValue (t, v)) return pairs
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
v = get_typed_tag_value (tag[eqPos+1:]) pairs.append (TagValue (t, v))
v = get_typed_tag_value(tag[eqPos+1:]) pairs.append(TagValue(t, v))
def form_tag_value_pairs (tags): pairs = [] for tag in tags: eqPos = tag.find ('=') if eqPos == -1: pairs.append (TagValue (tag, None)) else: t = tag[:eqPos] v = get_typed_tag_value (tag[eqPos+1:]) pairs.append (TagValue (t, v)) return pairs
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
sys.stderr.write ('%s\n' % msg)
sys.stderr.write('%s\n' % msg)
def warning(msg): sys.stderr.write ('%s\n' % msg)
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
warning (msg) sys.exit (1)
warning(msg) sys.exit(1)
def fail(msg): warning (msg) sys.exit (1)
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
sys.exit (0)
sys.exit(0)
def nothing_to_do(): print 'Nothing to do.' sys.exit (0)
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
return describe_by_about (specifier)
return describe_by_about(specifier)
def describe_by_mode(specifier, mode): """mode can be a string (about, id or query) or a flags object with flags.about, flags.query and flags.id""" if mode == 'about': return describe_by_about (specifier) elif mode == 'id': return describe_by_id (specifier) elif mode == 'query': return describe_by_id (specifier) raise ModeError, 'Bad Mode'
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
return describe_by_id (specifier)
return describe_by_id(specifier)
def describe_by_mode(specifier, mode): """mode can be a string (about, id or query) or a flags object with flags.about, flags.query and flags.id""" if mode == 'about': return describe_by_about (specifier) elif mode == 'id': return describe_by_id (specifier) elif mode == 'query': return describe_by_id (specifier) raise ModeError, 'Bad Mode'
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
return describe_by_id (specifier)
return describe_by_id(specifier)
def describe_by_mode(specifier, mode): """mode can be a string (about, id or query) or a flags object with flags.about, flags.query and flags.id""" if mode == 'about': return describe_by_about (specifier) elif mode == 'id': return describe_by_id (specifier) elif mode == 'query': return describe_by_id (specifier) raise ModeError, 'Bad Mode'
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
def describe_by_about (specifier):
def describe_by_about(specifier):
def describe_by_about (specifier): return 'with about="%s"' % specifier
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
def describe_by_id (specifier):
def describe_by_id(specifier):
def describe_by_id (specifier): return specifier
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
print ('Tagged object %s with %s'
print('Tagged object %s with %s'
def execute_tag_command(objs, db, tags, options): tags = form_tag_value_pairs(tags) actions = { 'id': db.tag_object_by_id, 'about': db.tag_object_by_about, } for obj in objs: description = describe_by_mode(obj.specifier, obj.mode) for tag in tags: o = actions[obj.mode](obj.specifier, tag.name, tag.value) if o == 0: if options.verbose: print ('Tagged object %s with %s' % (description, formatted_tag_value (tag.name, tag.value))) else: warning('Failed to tag object %s with %s' % (description, tag.name)) warning('Error code %d' % o)
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
formatted_tag_value (tag.name, tag.value)))
formatted_tag_value(tag.name, tag.value)))
def execute_tag_command(objs, db, tags, options): tags = form_tag_value_pairs(tags) actions = { 'id': db.tag_object_by_id, 'about': db.tag_object_by_about, } for obj in objs: description = describe_by_mode(obj.specifier, obj.mode) for tag in tags: o = actions[obj.mode](obj.specifier, tag.name, tag.value) if o == 0: if options.verbose: print ('Tagged object %s with %s' % (description, formatted_tag_value (tag.name, tag.value))) else: warning('Failed to tag object %s with %s' % (description, tag.name)) warning('Error code %d' % o)
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
def execute_untag_command (objs, db, tags, options):
def execute_untag_command(objs, db, tags, options):
def execute_untag_command (objs, db, tags, options): actions = { 'id': db.untag_object_by_id, 'about': db.untag_object_by_about, } for obj in objs: description = describe_by_mode(obj.specifier, obj.mode) for tag in tags: o = actions[obj.mode](obj.specifier, tag) if o == 0: if options.verbose: print ('Removed tag %s from object %s\n' % (tag, description)) else: warning ('Failed to remove tag %s from object %s' % (tag, description)) warning ('Error code %d' % o)
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
print ('Removed tag %s from object %s\n'
print('Removed tag %s from object %s\n'
def execute_untag_command (objs, db, tags, options): actions = { 'id': db.untag_object_by_id, 'about': db.untag_object_by_about, } for obj in objs: description = describe_by_mode(obj.specifier, obj.mode) for tag in tags: o = actions[obj.mode](obj.specifier, tag) if o == 0: if options.verbose: print ('Removed tag %s from object %s\n' % (tag, description)) else: warning ('Failed to remove tag %s from object %s' % (tag, description)) warning ('Error code %d' % o)
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
warning ('Failed to remove tag %s from object %s'
warning('Failed to remove tag %s from object %s'
def execute_untag_command (objs, db, tags, options): actions = { 'id': db.untag_object_by_id, 'about': db.untag_object_by_about, } for obj in objs: description = describe_by_mode(obj.specifier, obj.mode) for tag in tags: o = actions[obj.mode](obj.specifier, tag) if o == 0: if options.verbose: print ('Removed tag %s from object %s\n' % (tag, description)) else: warning ('Failed to remove tag %s from object %s' % (tag, description)) warning ('Error code %d' % o)
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
warning ('Error code %d' % o) def formatted_tag_value (tag, value):
warning('Error code %d' % o) def formatted_tag_value(tag, value):
def execute_untag_command (objs, db, tags, options): actions = { 'id': db.untag_object_by_id, 'about': db.untag_object_by_about, } for obj in objs: description = describe_by_mode(obj.specifier, obj.mode) for tag in tags: o = actions[obj.mode](obj.specifier, tag) if o == 0: if options.verbose: print ('Removed tag %s from object %s\n' % (tag, description)) else: warning ('Failed to remove tag %s from object %s' % (tag, description)) warning ('Error code %d' % o)
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
elif type (value) in types.StringTypes:
elif type(value) in types.StringTypes:
def formatted_tag_value (tag, value): if value == None: return tag elif type (value) in types.StringTypes: return '%s = "%s"' % (tag, value) else: return '%s = %s' % (tag, str (value))
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
return '%s = %s' % (tag, str (value)) def get_ids_or_fail (query, db):
return '%s = %s' % (tag, str(value)) def get_ids_or_fail(query, db):
def formatted_tag_value (tag, value): if value == None: return tag elif type (value) in types.StringTypes: return '%s = "%s"' % (tag, value) else: return '%s = %s' % (tag, str (value))
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
if type (ids) == types.IntType: fail ('Query failed')
if type(ids) == types.IntType: fail('Query failed')
def get_ids_or_fail (query, db): ids = db.query(query) if type (ids) == types.IntType: fail ('Query failed') else: # list of ids print '%s matched' % Plural (len (ids), 'object') return ids
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
print '%s matched' % Plural (len (ids), 'object')
print '%s matched' % Plural(len(ids), 'object')
def get_ids_or_fail (query, db): ids = db.query(query) if type (ids) == types.IntType: fail ('Query failed') else: # list of ids print '%s matched' % Plural (len (ids), 'object') return ids
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
def execute_show_command (objs, db, tags, options):
def execute_show_command(objs, db, tags, options):
def execute_show_command (objs, db, tags, options): actions = { 'id': db.get_tag_value_by_id, 'about': db.get_tag_value_by_about, } for obj in objs: description = describe_by_mode (obj.specifier, obj.mode) print 'Object %s:' % description for tag in tags: fulltag = db.abs_tag_path (tag) if tag == '/id': if obj.mode == 'about': o = db.query ('fluiddb/about = "%s"' % obj.specifier) if type (o) == types.IntType: # error status, v = o, None else: status, v = STATUS.OK, o[0] else: status, v = STATUS.OK, specifier else: status, v = actions[obj.mode](obj.specifier, tag) if status == STATUS.OK: print ' %s' % formatted_tag_value (fulltag, v) elif status == STATUS.NOT_FOUND: print ' %s' % cli_bracket ('tag %s not present' % fulltag) else: print cli_bracket ('error code %d getting tag %s' % (status, fulltag))
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
description = describe_by_mode (obj.specifier, obj.mode)
description = describe_by_mode(obj.specifier, obj.mode)
def execute_show_command (objs, db, tags, options): actions = { 'id': db.get_tag_value_by_id, 'about': db.get_tag_value_by_about, } for obj in objs: description = describe_by_mode (obj.specifier, obj.mode) print 'Object %s:' % description for tag in tags: fulltag = db.abs_tag_path (tag) if tag == '/id': if obj.mode == 'about': o = db.query ('fluiddb/about = "%s"' % obj.specifier) if type (o) == types.IntType: # error status, v = o, None else: status, v = STATUS.OK, o[0] else: status, v = STATUS.OK, specifier else: status, v = actions[obj.mode](obj.specifier, tag) if status == STATUS.OK: print ' %s' % formatted_tag_value (fulltag, v) elif status == STATUS.NOT_FOUND: print ' %s' % cli_bracket ('tag %s not present' % fulltag) else: print cli_bracket ('error code %d getting tag %s' % (status, fulltag))
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
fulltag = db.abs_tag_path (tag)
fulltag = db.abs_tag_path(tag)
def execute_show_command (objs, db, tags, options): actions = { 'id': db.get_tag_value_by_id, 'about': db.get_tag_value_by_about, } for obj in objs: description = describe_by_mode (obj.specifier, obj.mode) print 'Object %s:' % description for tag in tags: fulltag = db.abs_tag_path (tag) if tag == '/id': if obj.mode == 'about': o = db.query ('fluiddb/about = "%s"' % obj.specifier) if type (o) == types.IntType: # error status, v = o, None else: status, v = STATUS.OK, o[0] else: status, v = STATUS.OK, specifier else: status, v = actions[obj.mode](obj.specifier, tag) if status == STATUS.OK: print ' %s' % formatted_tag_value (fulltag, v) elif status == STATUS.NOT_FOUND: print ' %s' % cli_bracket ('tag %s not present' % fulltag) else: print cli_bracket ('error code %d getting tag %s' % (status, fulltag))
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
o = db.query ('fluiddb/about = "%s"' % obj.specifier) if type (o) == types.IntType:
o = db.query('fluiddb/about = "%s"' % obj.specifier) if type(o) == types.IntType:
def execute_show_command (objs, db, tags, options): actions = { 'id': db.get_tag_value_by_id, 'about': db.get_tag_value_by_about, } for obj in objs: description = describe_by_mode (obj.specifier, obj.mode) print 'Object %s:' % description for tag in tags: fulltag = db.abs_tag_path (tag) if tag == '/id': if obj.mode == 'about': o = db.query ('fluiddb/about = "%s"' % obj.specifier) if type (o) == types.IntType: # error status, v = o, None else: status, v = STATUS.OK, o[0] else: status, v = STATUS.OK, specifier else: status, v = actions[obj.mode](obj.specifier, tag) if status == STATUS.OK: print ' %s' % formatted_tag_value (fulltag, v) elif status == STATUS.NOT_FOUND: print ' %s' % cli_bracket ('tag %s not present' % fulltag) else: print cli_bracket ('error code %d getting tag %s' % (status, fulltag))
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
status, v = STATUS.OK, specifier
status, v = STATUS.OK, obj.specifier
def execute_show_command (objs, db, tags, options): actions = { 'id': db.get_tag_value_by_id, 'about': db.get_tag_value_by_about, } for obj in objs: description = describe_by_mode (obj.specifier, obj.mode) print 'Object %s:' % description for tag in tags: fulltag = db.abs_tag_path (tag) if tag == '/id': if obj.mode == 'about': o = db.query ('fluiddb/about = "%s"' % obj.specifier) if type (o) == types.IntType: # error status, v = o, None else: status, v = STATUS.OK, o[0] else: status, v = STATUS.OK, specifier else: status, v = actions[obj.mode](obj.specifier, tag) if status == STATUS.OK: print ' %s' % formatted_tag_value (fulltag, v) elif status == STATUS.NOT_FOUND: print ' %s' % cli_bracket ('tag %s not present' % fulltag) else: print cli_bracket ('error code %d getting tag %s' % (status, fulltag))
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
print ' %s' % formatted_tag_value (fulltag, v)
print ' %s' % formatted_tag_value(fulltag, v)
def execute_show_command (objs, db, tags, options): actions = { 'id': db.get_tag_value_by_id, 'about': db.get_tag_value_by_about, } for obj in objs: description = describe_by_mode (obj.specifier, obj.mode) print 'Object %s:' % description for tag in tags: fulltag = db.abs_tag_path (tag) if tag == '/id': if obj.mode == 'about': o = db.query ('fluiddb/about = "%s"' % obj.specifier) if type (o) == types.IntType: # error status, v = o, None else: status, v = STATUS.OK, o[0] else: status, v = STATUS.OK, specifier else: status, v = actions[obj.mode](obj.specifier, tag) if status == STATUS.OK: print ' %s' % formatted_tag_value (fulltag, v) elif status == STATUS.NOT_FOUND: print ' %s' % cli_bracket ('tag %s not present' % fulltag) else: print cli_bracket ('error code %d getting tag %s' % (status, fulltag))
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
print ' %s' % cli_bracket ('tag %s not present' % fulltag)
print ' %s' % cli_bracket('tag %s not present' % fulltag)
def execute_show_command (objs, db, tags, options): actions = { 'id': db.get_tag_value_by_id, 'about': db.get_tag_value_by_about, } for obj in objs: description = describe_by_mode (obj.specifier, obj.mode) print 'Object %s:' % description for tag in tags: fulltag = db.abs_tag_path (tag) if tag == '/id': if obj.mode == 'about': o = db.query ('fluiddb/about = "%s"' % obj.specifier) if type (o) == types.IntType: # error status, v = o, None else: status, v = STATUS.OK, o[0] else: status, v = STATUS.OK, specifier else: status, v = actions[obj.mode](obj.specifier, tag) if status == STATUS.OK: print ' %s' % formatted_tag_value (fulltag, v) elif status == STATUS.NOT_FOUND: print ' %s' % cli_bracket ('tag %s not present' % fulltag) else: print cli_bracket ('error code %d getting tag %s' % (status, fulltag))
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py
print cli_bracket ('error code %d getting tag %s' % (status,
print cli_bracket('error code %d getting tag %s' % (status,
def execute_show_command (objs, db, tags, options): actions = { 'id': db.get_tag_value_by_id, 'about': db.get_tag_value_by_about, } for obj in objs: description = describe_by_mode (obj.specifier, obj.mode) print 'Object %s:' % description for tag in tags: fulltag = db.abs_tag_path (tag) if tag == '/id': if obj.mode == 'about': o = db.query ('fluiddb/about = "%s"' % obj.specifier) if type (o) == types.IntType: # error status, v = o, None else: status, v = STATUS.OK, o[0] else: status, v = STATUS.OK, specifier else: status, v = actions[obj.mode](obj.specifier, tag) if status == STATUS.OK: print ' %s' % formatted_tag_value (fulltag, v) elif status == STATUS.NOT_FOUND: print ' %s' % cli_bracket ('tag %s not present' % fulltag) else: print cli_bracket ('error code %d getting tag %s' % (status, fulltag))
e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py