Best Python code snippet using lisa_python
docx_comment.py
Source:docx_comment.py  
...152        :type: datetime153        """154        self._comment_date = comment_date155    @property156    def is_top_level(self):157        """Gets the is_top_level of this DocxComment.  # noqa: E501158        True if the comment is at the top level, false if this comment is a child reply of another comment  # noqa: E501159        :return: The is_top_level of this DocxComment.  # noqa: E501160        :rtype: bool161        """162        return self._is_top_level163    @is_top_level.setter164    def is_top_level(self, is_top_level):165        """Sets the is_top_level of this DocxComment.166        True if the comment is at the top level, false if this comment is a child reply of another comment  # noqa: E501167        :param is_top_level: The is_top_level of this DocxComment.  # noqa: E501168        :type: bool169        """170        self._is_top_level = is_top_level171    @property172    def is_reply(self):173        """Gets the is_reply of this DocxComment.  # noqa: E501174        True if this comment is a reply to another comment, false otherwise  # noqa: E501175        :return: The is_reply of this DocxComment.  # noqa: E501176        :rtype: bool177        """178        return self._is_reply...graphql_body.py
Source:graphql_body.py  
1import os2from moonleap.utils.case import l03def graphql_body(4    type_spec,5    define_type=False,6    indent=0,7    skip=None,8    recurse=True,9    type_specs_to_import=None,10):11    is_top_level = not skip12    skip = skip or [type_spec.type_name]13    if type_specs_to_import is None:14        type_specs_to_import = []15    result = []16    if type_spec.extract_gql_fields and not (define_type and is_top_level):17        type_specs_to_import.append(type_spec)18        result.append(" " * indent + "${" + l0(type_spec.type_name) + "GqlFields}")19    else:20        field_specs = [21            x22            for x in sorted(list(type_spec.get_field_specs()), key=lambda x: x.name)23            if "client" in x.has_api24        ]25        for field_spec in field_specs:26            if field_spec.field_type not in ("fk", "relatedSet"):27                result.append(" " * indent + f"{field_spec.name}")28        for field_spec in field_specs:29            if field_spec.field_type in ("fk", "relatedSet"):30                target_type_spec = field_spec.target_type_spec31                if (is_top_level or recurse) and target_type_spec.type_name not in skip:32                    include_field_name = field_spec.field_type in ("fk", "relatedSet")33                    if include_field_name:34                        result.append(" " * indent + f"{field_spec.name} {{")35                        indent += 236                    result.extend(37                        graphql_body(38                            target_type_spec,39                            define_type,40                            indent,41                            skip + [target_type_spec.type_name],42                            recurse=recurse,43                            type_specs_to_import=type_specs_to_import,44                        )45                    )46                    if include_field_name:47                        indent -= 248                        result.append(" " * indent + "}")49    if is_top_level:50        return type_specs_to_import, os.linesep.join(result)51    else:52        return result53def get_dependency_type_specs(type_spec, skip=None, recurse=True):54    is_top_level = not skip55    skip = skip or [type_spec.type_name]56    result = []57    for field_spec in sorted(list(type_spec.get_field_specs()), key=lambda x: x.name):58        if field_spec.field_type in ("fk", "relatedSet"):59            target_type_spec = field_spec.target_type_spec60            if (is_top_level or recurse) and target_type_spec.type_name not in skip:61                if target_type_spec.extract_gql_fields:62                    if target_type_spec not in result:63                        result.append(target_type_spec)64                else:65                    result.extend(66                        get_dependency_type_specs(67                            target_type_spec,68                            skip + [target_type_spec.type_name],69                            recurse=recurse,70                        )71                    )...arduino_sketchbook.py
Source:arduino_sketchbook.py  
1#!/usr/bin/env python2#-*- coding: utf-8 -*-3# 1. Copyright4# 2. Lisence5# 3. Author6"""7Documents8"""9from __future__ import absolute_import10from __future__ import print_function11from __future__ import division12from __future__ import unicode_literals13import os14from . import base15non_sketch_dirs = ['hardware', 'examples', 'libraries']16class Sketchbook(base.abs_file.Dir):17    def __init__(self, path, is_top_level=True, is_big_project=False):18        super(Sketchbook, self).__init__(path)19        self.is_big_project = is_big_project20        self.sub_sketches = []21        self.load_sub_sketches(is_top_level)22    def load_sub_sketches(self, is_top_level):23        sub_dirs = []24        if is_top_level:25            sub_dirs = self.list_dirs()26            sub_dirs = [d for d in sub_dirs27                        if not d.name.lower() in non_sketch_dirs]28        if is_top_level and self.is_big_project:29            is_top_level = False30        sub_sketches = [Sketchbook(d.path, is_top_level) for d in sub_dirs]31        self.sub_sketches = [s for s in sub_sketches if s.is_sketch()]32    def has_primary_file(self):33        return has_primary_file(self.path, self.name)34    def is_sketch(self):35        return (self.sub_sketches or self.has_primary_file())36    def get_sub_sketches(self):37        return self.sub_sketches38    def set_name(self, name):39        self.name = name40def has_primary_file(dir_path, project_name):41    state = False42    exts = ['.ino', '.pde', '.cpp', '.c', '.S']43    for ext in exts:44        primary_file_name = project_name + ext45        primary_file_path = os.path.join(dir_path, primary_file_name)46        if os.path.isfile(primary_file_path):47            state = True48            break...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
