Search is not available for this dataset
text
stringlengths
75
104k
def appendtext(self, window_name, object_name, data): """ Append string sequence. @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to type in, either fu...
def getcursorposition(self, window_name, object_name): """ Get cursor position @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to type in, either full ...
def setcursorposition(self, window_name, object_name, cursor_position): """ Set cursor position @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to type...
def cuttext(self, window_name, object_name, start_position, end_position=-1): """ cut text from start position to end position @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param o...
def deletetext(self, window_name, object_name, start_position, end_position=-1): """ delete text from start position to end position @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @p...
def pastetext(self, window_name, object_name, position=0): """ paste text from start position to end position @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Objec...
def main(port=4118, parentpid=None): """Main entry point. Parse command line options and start up a server.""" if "LDTP_DEBUG" in os.environ: _ldtp_debug = True else: _ldtp_debug = False _ldtp_debug_file = os.environ.get('LDTP_DEBUG_FILE', None) if _ldtp_debug: print("Parent ...
def server_bind(self, *args, **kwargs): '''Server Bind. Forces reuse of port.''' self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) # Can't use super() here since SimpleXMLRPCServer is an old-style class SimpleXMLRPCServer.server_bind(self, *args, **kwargs)
def log(self, message, level=logging.DEBUG): """ Logs the message in the root logger with the log level @param message: Message to be logged @type message: string @param level: Log level, defaul DEBUG @type level: integer @return: 1 on success and 0 on error ...
def stoplog(self): """ Stop logging. @return: 1 on success and 0 on error @rtype: integer """ if self._file_logger: self.logger.removeHandler(_file_logger) self._file_logger = None return 1
def imagecapture(self, window_name=None, out_file=None, x=0, y=0, width=None, height=None): """ Captures screenshot of the whole desktop or given window @param window_name: Window name to look for, either full name, LDTP's name convention, or a Unix glob. @t...
def onwindowcreate(self, window_name, fn_name, *args): """ On window create, call the function with given arguments @param window_name: Window name to look for, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param fn_name: Callback f...
def registerevent(self, event_name, fn_name, *args): """ Register at-spi event @param event_name: Event name in at-spi format. @type event_name: string @param fn_name: Callback function @type fn_name: function @param *args: arguments to be passed to the callback ...
def deregisterevent(self, event_name): """ Remove callback of registered event @param event_name: Event name in at-spi format. @type event_name: string @return: 1 if registration was successful, 0 if not. @rtype: integer """ if event_name in self._pollE...
def registerkbevent(self, keys, modifiers, fn_name, *args): """ Register keystroke events @param keys: key to listen @type keys: string @param modifiers: control / alt combination using gtk MODIFIERS @type modifiers: int @param fn_name: Callback function ...
def deregisterkbevent(self, keys, modifiers): """ Remove callback of registered event @param keys: key to listen @type keys: string @param modifiers: control / alt combination using gtk MODIFIERS @type modifiers: int @return: 1 if registration was successful, 0 ...
def windowuptime(self, window_name): """ Get window uptime @param window_name: Window name to look for, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @return: "starttime, endtime" as datetime python object """ tm...
def verifyscrollbarvertical(self, window_name, object_name): """ Verify scrollbar is vertical @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to type in, eithe...
def verifyscrollbarhorizontal(self, window_name, object_name): """ Verify scrollbar is horizontal @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to type in, e...
def setmax(self, window_name, object_name): """ Set max value @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to type in, either full name, LDTP's name...
def setmin(self, window_name, object_name): """ Set min value @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to type in, either full name, LDTP's name...
def scrollup(self, window_name, object_name): """ Scroll up @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to type in, either full name, LDTP's name c...
def scrolldown(self, window_name, object_name): """ Scroll down @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to type in, either full name, LDTP's na...
def scrollleft(self, window_name, object_name): """ Scroll left @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to type in, either full name, LDTP's na...
def scrollright(self, window_name, object_name): """ Scroll right @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to type in, either full name, LDTP's ...
def onedown(self, window_name, object_name, iterations): """ Press scrollbar down with number of iterations @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to ...
def oneup(self, window_name, object_name, iterations): """ Press scrollbar up with number of iterations @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to type...
def oneright(self, window_name, object_name, iterations): """ Press scrollbar right with number of iterations @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name t...
def oneleft(self, window_name, object_name, iterations): """ Press scrollbar left with number of iterations @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to ...
def selecttab(self, window_name, object_name, tab_name): """ Select tab based on name. @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to type in, eith...
def selecttabindex(self, window_name, object_name, tab_index): """ Select tab based on index. @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to type i...
def verifytabname(self, window_name, object_name, tab_name): """ Verify tab name. @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to type in, either fu...
def gettabcount(self, window_name, object_name): """ Get tab count. @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to type in, either full name, ...
def gettabname(self, window_name, object_name, tab_index): """ Get tab name @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to type in, either full nam...
def mouseleftclick(self, window_name, object_name): """ Mouse left click on an object. @param window_name: Window name to look for, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to look for, ei...
def mouserightclick(self, window_name, object_name): """ Mouse right click on an object. @param window_name: Window name to look for, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to look for, ...
def generatemouseevent(self, x, y, eventType="b1c", drag_button_override='drag_default_button'): """ Generate mouse event on x, y co-ordinates. @param x: X co-ordinate @type x: int @param y: Y co-ordinate @type y: int @param eve...
def doubleclick(self, window_name, object_name): """ Double click on the object @param window_name: Window name to look for, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to look for, either fu...
def selectitem(self, window_name, object_name, item_name): """ Select combo box / layered pane item @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to ...
def selectindex(self, window_name, object_name, item_index): """ Select combo box item / layered pane based on index @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name...
def getallitem(self, window_name, object_name): """ Get all combo box item @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to type in, either full name, ...
def showlist(self, window_name, object_name): """ Show combo box list / menu @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to type in, either full na...
def hidelist(self, window_name, object_name): """ Hide combo box list / menu @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to type in, either full na...
def verifydropdown(self, window_name, object_name): """ Verify drop down list / menu poped up @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to type i...
def verifyselect(self, window_name, object_name, item_name): """ Verify the item selected in combo box @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name ...
def getcombovalue(self, window_name, object_name): """ Get current selected combobox value @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to type in, ...
def login(self, username=None, password=None, android_id=None): """Authenticate the gmusicapi Mobileclient instance. Parameters: username (Optional[str]): Your Google Music username. Will be prompted if not given. password (Optional[str]): Your Google Music password. Will be prompted if not given. andro...
def get_google_songs(self, include_filters=None, exclude_filters=None, all_includes=False, all_excludes=False): """Create song list from user's Google Music library. Parameters: include_filters (list): A list of ``(field, pattern)`` tuples. Fields are any valid Google Music metadata field available to the M...
def get_google_playlist(self, playlist): """Get playlist information of a user-generated Google Music playlist. Parameters: playlist (str): Name or ID of Google Music playlist. Names are case-sensitive. Google allows multiple playlists with the same name. If multiple playlists have the same name, the fi...
def get_google_playlist_songs(self, playlist, include_filters=None, exclude_filters=None, all_includes=False, all_excludes=False): """Create song list from a user-generated Google Music playlist. Parameters: playlist (str): Name or ID of Google Music playlist. Names are case-sensitive. Google allows multipl...
def cast_to_list(position): """Cast the positional argument at given position into a list if not already a list.""" @wrapt.decorator def wrapper(function, instance, args, kwargs): if not isinstance(args[position], list): args = list(args) args[position] = [args[position]] args = tuple(args) return fun...
def _pybossa_req(method, domain, id=None, payload=None, params={}, headers={'content-type': 'application/json'}, files=None): """ Send a JSON request. Returns True if everything went well, otherwise it returns the status code of the response. """ url = _opts['e...
def get_projects(limit=100, offset=0, last_id=None): """Return a list of registered projects. :param limit: Number of returned items, default 100 :type limit: integer :param offset: Offset for the query, default 0 :type offset: integer :param last_id: id of the last project, used for pagination...
def get_project(project_id): """Return a PYBOSSA Project for the project_id. :param project_id: PYBOSSA Project ID :type project_id: integer :rtype: PYBOSSA Project :returns: A PYBOSSA Project object """ try: res = _pybossa_req('get', 'project', project_id) if res.get('id')...
def find_project(**kwargs): """Return a list with matching project arguments. :param kwargs: PYBOSSA Project members :rtype: list :returns: A list of projects that match the kwargs """ try: res = _pybossa_req('get', 'project', params=kwargs) if type(res).__name__ == 'list': ...
def create_project(name, short_name, description): """Create a project. :param name: PYBOSSA Project Name :type name: string :param short_name: PYBOSSA Project short name or slug :type short_name: string :param description: PYBOSSA Project description :type decription: string :returns: ...
def update_project(project): """Update a project instance. :param project: PYBOSSA project :type project: PYBOSSA Project :returns: True -- the response status code """ try: project_id = project.id project = _forbidden_attributes(project) res = _pybossa_req('put', 'proj...
def delete_project(project_id): """Delete a Project with id = project_id. :param project_id: PYBOSSA Project ID :type project_id: integer :returns: True -- the response status code """ try: res = _pybossa_req('delete', 'project', project_id) if type(res).__name__ == 'bool': ...
def get_categories(limit=20, offset=0, last_id=None): """Return a list of registered categories. :param limit: Number of returned items, default 20 :type limit: integer :param offset: Offset for the query, default 0 :type offset: integer :param last_id: id of the last category, used for paginat...
def get_category(category_id): """Return a PYBOSSA Category for the category_id. :param category_id: PYBOSSA Category ID :type category_id: integer :rtype: PYBOSSA Category :returns: A PYBOSSA Category object """ try: res = _pybossa_req('get', 'category', category_id) if re...
def find_category(**kwargs): """Return a list with matching Category arguments. :param kwargs: PYBOSSA Category members :rtype: list :returns: A list of project that match the kwargs """ try: res = _pybossa_req('get', 'category', params=kwargs) if type(res).__name__ == 'list': ...
def create_category(name, description): """Create a Category. :param name: PYBOSSA Category Name :type name: string :param description: PYBOSSA Category description :type decription: string :returns: True -- the response status code """ try: category = dict(name=name, short_name...
def update_category(category): """Update a Category instance. :param category: PYBOSSA Category :type category: PYBOSSA Category :returns: True -- the response status code """ try: res = _pybossa_req('put', 'category', category.id, payload=category.data) ...
def delete_category(category_id): """Delete a Category with id = category_id. :param category_id: PYBOSSA Category ID :type category_id: integer :returns: True -- the response status code """ try: res = _pybossa_req('delete', 'category', category_id) if type(res).__name__ == 'b...
def get_tasks(project_id, limit=100, offset=0, last_id=None): """Return a list of tasks for a given project ID. :param project_id: PYBOSSA Project ID :type project_id: integer :param limit: Number of returned items, default 100 :type limit: integer :param offset: Offset for the query, default 0...
def find_tasks(project_id, **kwargs): """Return a list of matched tasks for a given project ID. :param project_id: PYBOSSA Project ID :type project_id: integer :param kwargs: PYBOSSA Task members :type info: dict :rtype: list :returns: A list of tasks that match the kwargs """ try:...
def create_task(project_id, info, n_answers=30, priority_0=0, quorum=0): """Create a task for a given project ID. :param project_id: PYBOSSA Project ID :type project_id: integer :param info: PYBOSSA Project info JSON field :type info: dict :param n_answers: Number of answers or TaskRuns per tas...
def update_task(task): """Update a task for a given task ID. :param task: PYBOSSA task """ try: task_id = task.id task = _forbidden_attributes(task) res = _pybossa_req('put', 'task', task_id, payload=task.data) if res.get('id'): return Task(res) else...
def delete_task(task_id): """Delete a task for a given task ID. :param task: PYBOSSA task """ #: :arg task: A task try: res = _pybossa_req('delete', 'task', task_id) if type(res).__name__ == 'bool': return True else: return res except: # pragma:...
def get_taskruns(project_id, limit=100, offset=0, last_id=None): """Return a list of task runs for a given project ID. :param project_id: PYBOSSA Project ID :type project_id: integer :param limit: Number of returned items, default 100 :type limit: integer :param offset: Offset for the query, de...
def find_taskruns(project_id, **kwargs): """Return a list of matched task runs for a given project ID. :param project_id: PYBOSSA Project ID :type project_id: integer :param kwargs: PYBOSSA Task Run members :rtype: list :returns: A List of task runs that match the query members """ try...
def delete_taskrun(taskrun_id): """Delete the given taskrun. :param task: PYBOSSA task """ try: res = _pybossa_req('delete', 'taskrun', taskrun_id) if type(res).__name__ == 'bool': return True else: return res except: # pragma: no cover raise
def get_results(project_id, limit=100, offset=0, last_id=None): """Return a list of results for a given project ID. :param project_id: PYBOSSA Project ID :type project_id: integer :param limit: Number of returned items, default 100 :type limit: integer :param offset: Offset for the query, defau...
def find_results(project_id, **kwargs): """Return a list of matched results for a given project ID. :param project_id: PYBOSSA Project ID :type project_id: integer :param kwargs: PYBOSSA Results members :type info: dict :rtype: list :returns: A list of results that match the kwargs """...
def update_result(result): """Update a result for a given result ID. :param result: PYBOSSA result """ try: result_id = result.id result = _forbidden_attributes(result) res = _pybossa_req('put', 'result', result_id, payload=result.data) if res.get('id'): ret...
def _forbidden_attributes(obj): """Return the object without the forbidden attributes.""" for key in list(obj.data.keys()): if key in list(obj.reserved_keys.keys()): obj.data.pop(key) return obj
def create_helpingmaterial(project_id, info, media_url=None, file_path=None): """Create a helping material for a given project ID. :param project_id: PYBOSSA Project ID :type project_id: integer :param info: PYBOSSA Helping Material info JSON field :type info: dict :param media_url: URL for a m...
def get_helping_materials(project_id, limit=100, offset=0, last_id=None): """Return a list of helping materials for a given project ID. :param project_id: PYBOSSA Project ID :type project_id: integer :param limit: Number of returned items, default 100 :type limit: integer :param offset: Offset ...
def find_helping_materials(project_id, **kwargs): """Return a list of matched helping materials for a given project ID. :param project_id: PYBOSSA Project ID :type project_id: integer :param kwargs: PYBOSSA HelpingMaterial members :type info: dict :rtype: list :returns: A list of helping ma...
def update_helping_material(helpingmaterial): """Update a helping material for a given helping material ID. :param helpingmaterial: PYBOSSA helping material """ try: helpingmaterial_id = helpingmaterial.id helpingmaterial = _forbidden_attributes(helpingmaterial) res = _pybossa_...
def login(self, oauth_filename="oauth", uploader_id=None): """Authenticate the gmusicapi Musicmanager instance. Parameters: oauth_filename (str): The filename of the oauth credentials file to use/create for login. Default: ``oauth`` uploader_id (str): A unique id as a MAC address (e.g. ``'00:11:22:33:AA...
def get_google_songs( self, include_filters=None, exclude_filters=None, all_includes=False, all_excludes=False, uploaded=True, purchased=True): """Create song list from user's Google Music library. Parameters: include_filters (list): A list of ``(field, pattern)`` tuples. Fields are any valid Google Mus...
def download(self, songs, template=None): """Download Google Music songs. Parameters: songs (list or dict): Google Music song dict(s). template (str): A filepath which can include template patterns. Returns: A list of result dictionaries. :: [ {'result': 'downloaded', 'id': song_id, 'file...
def upload(self, filepaths, enable_matching=False, transcode_quality='320k', delete_on_success=False): """Upload local songs to Google Music. Parameters: filepaths (list or str): Filepath(s) to upload. enable_matching (bool): If ``True`` attempt to use `scan and match <http://support.google.com/googlepl...
def convert_cygwin_path(path): """Convert Unix path from Cygwin to Windows path.""" try: win_path = subprocess.check_output(["cygpath", "-aw", path], universal_newlines=True).strip() except (FileNotFoundError, subprocess.CalledProcessError): logger.exception("Call to cygpath failed.") raise return win_path
def _get_mutagen_metadata(filepath): """Get mutagen metadata dict from a file.""" try: metadata = mutagen.File(filepath, easy=True) except mutagen.MutagenError: logger.warning("Can't load {} as music file.".format(filepath)) raise return metadata
def _mutagen_fields_to_single_value(metadata): """Replace mutagen metadata field list values in mutagen tags with the first list value.""" return dict((k, v[0]) for k, v in metadata.items() if v)
def _split_field_to_single_value(field): """Convert number field values split by a '/' to a single number value.""" split_field = re.match(r'(\d+)/\d+', field) return split_field.group(1) or field
def _normalize_metadata(metadata): """Normalize metadata to improve match accuracy.""" metadata = str(metadata) metadata = metadata.lower() metadata = re.sub(r'\/\s*\d+', '', metadata) # Remove "/<totaltracks>" from track number. metadata = re.sub(r'^0+([0-9]+)', r'\1', metadata) # Remove leading zero(s) from ...
def compare_song_collections(src_songs, dst_songs): """Compare two song collections to find missing songs. Parameters: src_songs (list): Google Music song dicts or filepaths of local songs. dest_songs (list): Google Music song dicts or filepaths of local songs. Returns: A list of Google Music song dicts or ...
def get_supported_filepaths(filepaths, supported_extensions, max_depth=float('inf')): """Get filepaths with supported extensions from given filepaths. Parameters: filepaths (list or str): Filepath(s) to check. supported_extensions (tuple or str): Supported file extensions or a single file extension. max_dept...
def exclude_filepaths(filepaths, exclude_patterns=None): """Exclude file paths based on regex patterns. Parameters: filepaths (list or str): Filepath(s) to check. exclude_patterns (list): Python regex patterns to check filepaths against. Returns: A list of filepaths to include and a list of filepaths to exc...
def _check_field_value(field_value, pattern): """Check a song metadata field value for a pattern.""" if isinstance(field_value, list): return any(re.search(pattern, str(value), re.I) for value in field_value) else: return re.search(pattern, str(field_value), re.I)
def _check_filters(song, include_filters=None, exclude_filters=None, all_includes=False, all_excludes=False): """Check a song metadata dict against a set of metadata filters.""" include = True if include_filters: if all_includes: if not all(field in song and _check_field_value(song[field], pattern) for field,...
def filter_google_songs(songs, include_filters=None, exclude_filters=None, all_includes=False, all_excludes=False): """Match a Google Music song dict against a set of metadata filters. Parameters: songs (list): Google Music song dicts to filter. include_filters (list): A list of ``(field, pattern)`` tuples. ...
def filter_local_songs(filepaths, include_filters=None, exclude_filters=None, all_includes=False, all_excludes=False): """Match a local file against a set of metadata filters. Parameters: filepaths (list): Filepaths to filter. include_filters (list): A list of ``(field, pattern)`` tuples. Fields are any vali...
def get_suggested_filename(metadata): """Generate a filename for a song based on metadata. Parameters: metadata (dict): A metadata dict. Returns: A filename. """ if metadata.get('title') and metadata.get('track_number'): suggested_filename = '{track_number:0>2} {title}'.format(**metadata) elif metadata.g...
def template_to_filepath(template, metadata, template_patterns=None): """Create directory structure and file name based on metadata template. Parameters: template (str): A filepath which can include template patterns as defined by :param template_patterns:. metadata (dict): A metadata dict. template_patterns...
def walk_depth(path, max_depth=float('inf')): """Walk a directory tree with configurable depth. Parameters: path (str): A directory path to walk. max_depth (int): The depth in the directory tree to walk. A depth of '0' limits the walk to the top directory. Default: No limit. """ start_level = os.path.a...
def get_local_songs( filepaths, include_filters=None, exclude_filters=None, all_includes=False, all_excludes=False, exclude_patterns=None, max_depth=float('inf')): """Load songs from local filepaths. Parameters: filepaths (list or str): Filepath(s) to search for music files. include_filters (list): A ...