bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
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 ()
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 ()
471,800
def set_debug_timeout (self, v): if self.timeout == HTTP_TIMEOUT: self.timeout = float (v)
def set_debug_timeout (self, v): if self.timeout == HTTP_TIMEOUT: self.timeout = float (v)
471,801
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.
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.
471,802
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.
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.
471,803
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.
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.
471,804
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)
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)
471,805
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
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
471,806
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
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
471,807
def create_object (self, about=None): """Creates an object with the about tag given. If the object already exists, returns the object instead.
def create_object(self, about=None): """Creates an object with the about tag given. If the object already exists, returns the object instead.
471,808
def create_object (self, about=None): """Creates an object with the about tag given. If the object already exists, returns the object instead.
def create_object (self, about=None): """Creates an object with the about tag given. If the object already exists, returns the object instead.
471,809
def create_object (self, about=None): """Creates an object with the about tag given. If the object already exists, returns the object instead.
def create_object (self, about=None): """Creates an object with the about tag given. If the object already exists, returns the object instead.
471,810
def create_namespace (self, path, description='', createParentIfNeeded=True, verbose=False): """Creates the namespace specified by path using the description given.
def create_namespace(self, path, description='', createParentIfNeeded=True, verbose=False): """Creates the namespace specified by path using the description given.
471,811
def create_namespace (self, path, description='', createParentIfNeeded=True, verbose=False): """Creates the namespace specified by path using the description given.
def create_namespace (self, path, description='', createParentIfNeeded=True, verbose=False): """Creates the namespace specified by path using the description given.
471,812
def create_namespace (self, path, description='', createParentIfNeeded=True, verbose=False): """Creates the namespace specified by path using the description given.
def create_namespace (self, path, description='', createParentIfNeeded=True, verbose=False): """Creates the namespace specified by path using the description given.
471,813
def create_namespace (self, path, description='', createParentIfNeeded=True, verbose=False): """Creates the namespace specified by path using the description given.
def create_namespace (self, path, description='', createParentIfNeeded=True, verbose=False): """Creates the namespace specified by path using the description given.
471,814
def create_namespace (self, path, description='', createParentIfNeeded=True, verbose=False): """Creates the namespace specified by path using the description given.
def create_namespace (self, path, description='', createParentIfNeeded=True, verbose=False): """Creates the namespace specified by path using the description given.
471,815
def create_namespace (self, path, description='', createParentIfNeeded=True, verbose=False): """Creates the namespace specified by path using the description given.
def create_namespace (self, path, description='', createParentIfNeeded=True, verbose=False): """Creates the namespace specified by path using the description given.
471,816
def delete_namespace (self, path, recurse=False, force=False, verbose=False): """Deletes the namespace specified by path.
def delete_namespace(self, path, recurse=False, force=False, verbose=False): """Deletes the namespace specified by path.
471,817
def delete_namespace (self, path, recurse=False, force=False, verbose=False): """Deletes the namespace specified by path.
def delete_namespace (self, path, recurse=False, force=False, verbose=False): """Deletes the namespace specified by path.
471,818
def delete_namespace (self, path, recurse=False, force=False, verbose=False): """Deletes the namespace specified by path.
def delete_namespace (self, path, recurse=False, force=False, verbose=False): """Deletes the namespace specified by path.
471,819
def delete_namespace (self, path, recurse=False, force=False, verbose=False): """Deletes the namespace specified by path.
def delete_namespace (self, path, recurse=False, force=False, verbose=False): """Deletes the namespace specified by path.
471,820
def describe_namespace (self, path): """Returns an object describing the namespace specified by the path.
def describe_namespace(self, path): """Returns an object describing the namespace specified by the path.
471,821
def describe_namespace (self, path): """Returns an object describing the namespace specified by the path.
def describe_namespace (self, path): """Returns an object describing the namespace specified by the path.
471,822
def describe_namespace (self, path): """Returns an object describing the namespace specified by the path.
def describe_namespace (self, path): """Returns an object describing the namespace specified by the path.
471,823
def describe_namespace (self, path): """Returns an object describing the namespace specified by the path.
def describe_namespace (self, path): """Returns an object describing the namespace specified by the path.
471,824
def describe_namespace (self, path): """Returns an object describing the namespace specified by the path.
def describe_namespace (self, path): """Returns an object describing the namespace specified by the path.
471,825
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.
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.
471,826
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.
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.
471,827
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.
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.
471,828
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.
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.
471,829
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.
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.
471,830
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.
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.
471,831
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.
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.
471,832
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)
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)
471,833
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)
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)
471,834
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)
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)
471,835
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)
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)
471,836
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)
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)
471,837
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.
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.
471,838
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.
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.
471,839
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.
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.
471,840
def get_tag_value_by_id (self, id, tag): """Gets the value of a tag on an object identified by the object's ID.
def get_tag_value_by_id(self, id, tag): """Gets the value of a tag on an object identified by the object's ID.
471,841
def get_tag_value_by_id (self, id, tag): """Gets the value of a tag on an object identified by the object's ID.
def get_tag_value_by_id (self, id, tag): """Gets the value of a tag on an object identified by the object's ID.
471,842
def get_tag_value_by_id (self, id, tag): """Gets the value of a tag on an object identified by the object's ID.
def get_tag_value_by_id (self, id, tag): """Gets the value of a tag on an object identified by the object's ID.
471,843
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_id (self, id, tags): return [self.get_tag_value_by_id (id, tag) for tag in tags]
471,844
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']
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']
471,845
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.
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.
471,846
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.
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.
471,847
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.
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.
471,848
def full_tag_path (self, tag): """Returns the absolute tag path (see above), prefixed with /tag.
def full_tag_path(self, tag): """Returns the absolute tag path (see above), prefixed with /tag.
471,849
def full_tag_path (self, tag): """Returns the absolute tag path (see above), prefixed with /tag.
def full_tag_path (self, tag): """Returns the absolute tag path (see above), prefixed with /tag.
471,850
def full_tag_path (self, tag): """Returns the absolute tag path (see above), prefixed with /tag.
def full_tag_path (self, tag): """Returns the absolute tag path (see above), prefixed with /tag.
471,851
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.
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.
471,852
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.
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.
471,853
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.
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.
471,854
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.
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.
471,855
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.
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.
471,856
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.
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.
471,857
def object_uri (id): """Returns the full URI for the FluidDB object with the given id.""" return '%s/objects/%s' % (FLUIDDB_PATH, id)
def object_uri(id): """Returns the full URI for the FluidDB object with the given id.""" return '%s/objects/%s' % (FLUIDDB_PATH, id)
471,858
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)
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)
471,859
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
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
471,860
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
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
471,861
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
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
471,862
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)
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)
471,863
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)
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)
471,864
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)
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)
471,865
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)
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)
471,866
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)
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)
471,867
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)
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)
471,868
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)
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)
471,869
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)
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)
471,870
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
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
471,871
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
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
471,872
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
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
471,873
def warning(msg): sys.stderr.write ('%s\n' % msg)
def warning(msg): sys.stderr.write('%s\n' % msg)
471,874
def fail(msg): warning (msg) sys.exit (1)
def fail(msg): warning(msg) sys.exit(1)
471,875
def nothing_to_do(): print 'Nothing to do.' sys.exit (0)
def nothing_to_do(): print 'Nothing to do.' sys.exit(0)
471,876
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'
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'
471,877
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'
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'
471,878
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'
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'
471,879
def describe_by_about (specifier): return 'with about="%s"' % specifier
def describe_by_about(specifier): return 'with about="%s"' % specifier
471,880
def describe_by_id (specifier): return specifier
def describe_by_id(specifier): return specifier
471,881
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)
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)
471,882
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)
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)
471,883
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)
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)
471,884
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)
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)
471,885
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)
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)
471,886
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)
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)
471,887
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))
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))
471,888
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))
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))
471,889
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
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
471,890
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
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
471,891
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))
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))
471,892
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))
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))
471,893
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))
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))
471,894
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))
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))
471,895
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))
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, obj.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))
471,896
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))
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))
471,897
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))
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))
471,898
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))
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))
471,899