Find one element matching condition
        :param by: Type of condition
        :param value: Condition value
        :param view_cls: Optional custom class to wrap returned elements
        :return: Matching element wrapped in a view
434698
def find_element(self, by, value, view_cls=None):
        # type: (By, Any, View) -> View
        
        if view_cls is None:
            view_cls = View

        return view_cls(lambda: self.driver.find_element(by, value))
167575
def prj_view_atype(self, *args, **kwargs):
        
        if not self.cur_prj:
            return
        i = self.prj_atype_tablev.currentIndex()
        item = i.internalPointer()
        if item:
            atype = item.internal_data()
            self.view_atype(atype)
348237
def search(cls, element, pattern):
        
        if isinstance(element, Layout):
            return [el for cell in element for el in cls.search(cell, pattern)]
        if isinstance(element, (NdOverlay, Overlay)):
            return [el for el in element if el.matches(pattern)]
        elif isinstance(element, Element):
            return [element] if element.matches(pattern) else []
1283090
def _search_for_view(self, obj):
        
        evaluator = partial(self._evaluate_tempyREPR, obj)
        sorted_reprs = sorted(
            _filter_classes(obj.__class__.__dict__.values(), TempyREPR),
            key=evaluator,
            reverse=True,
        )
        if sorted_reprs:
            # If we find some TempyREPR, we return the one with the best score.
            return sorted_reprs[0]
        return None
105748
def findViewType(self, viewTypeName):
        
        for viewType in self._viewTypes:
            if ( viewType.viewTypeName() == viewTypeName ):
                return viewType
        return None
1180033
def _get_view_results(self, view):
        
        if view == TREE_VIEW:
            result = self.tree
        else:
            result = TextResult(tree_results=self.tree)
            result.cleanup()  # clean up text-style result dictionary
        return result
1133951
def find_value_in_object(attr, obj):
    

    # Carry on inspecting inside the list or tuple
    if isinstance(obj, (collections.Iterator, list)):
        for item in obj:
            yield from find_value_in_object(attr, item)

    # Final object (dict or entity) inspect inside
    elif isinstance(obj, collections.Mapping):

        # If result is found, inspect inside and return inner results
        if attr in obj:

            # If it is iterable, just return the inner elements (avoid nested
            # lists)
            if isinstance(obj[attr], (collections.Iterator, list)):
                for item in obj[attr]:
                    yield item

            # If not, return just the objects
            else:
                yield obj[attr]

        # Carry on inspecting inside the object
        for item in obj.values():
            if item:
                yield from find_value_in_object(attr, item)
640848
def match_classes(self, el, classes):
        """"""

        current_classes = self.get_classes(el)
        found = True
        for c in classes:
            if c not in current_classes:
                found = False
                break
        return found
134994
function(view, template, element) {
          var _tr = function(modifier) {
            return template.replace('*', modifier);
          };

          var fns = {
            hasModifier: function(modifier) {
              return element.hasClass(_tr(modifier));
            },

            removeModifier: function(modifier) {
              element.removeClass(_tr(modifier));
            },

            addModifier: function(modifier) {
              element.addClass(_tr(modifier));
            },

            setModifier: function(modifier) {
              var classes = element.attr('class').split(/\s+/),
                  patt = template.replace('*', '.');

              for (var i = 0; i < classes.length; i++) {
                var cls = classes[i];

                if (cls.match(patt)) {
                  element.removeClass(cls);
                }
              }

              element.addClass(_tr(modifier));
            },

            toggleModifier: function(modifier) {
              var cls = _tr(modifier);
              if (element.hasClass(cls)) {
                element.removeClass(cls);
              } else {
                element.addClass(cls);
              }
            }
          };

          var append = function(oldFn, newFn) {
            if (typeof oldFn !== 'undefined') {
              return function() {
                return oldFn.apply(null, arguments) || newFn.apply(null, arguments);
              };
            } else {
              return newFn;
            }
          };

          view.hasModifier = append(view.hasModifier, fns.hasModifier);
          view.removeModifier = append(view.removeModifier, fns.removeModifier);
          view.addModifier = append(view.addModifier, fns.addModifier);
          view.setModifier = append(view.setModifier, fns.setModifier);
          view.toggleModifier = append(view.toggleModifier, fns.toggleModifier);
        }
193337
def get_view(self, request, view_class, opts=None):
        
        kwargs = {}
        if opts:
            if not isinstance(opts, dict):
                opts = opts.__dict__
        else:
            opts = {}

        if not view_class in VALID_MIXIN_OPTIONS:
            valid_options = view_class.__dict__.keys()
            for cls in view_class.__bases__:
                if cls != object:
                    valid_options += cls.__dict__.keys()
            VALID_MIXIN_OPTIONS[view_class] = valid_options

        for key in VALID_MIXIN_OPTIONS[view_class]:
            if key in opts:
                kwargs[key] = opts[key]
            elif hasattr(self, key):
                kwargs[key] = getattr(self, key)

        view = view_class(**kwargs)
        view.request = request
        view.kwargs = {}
        return view
309197
private int compareView(ViewRef<?> viewA, 
                          ViewRef<?> viewB,
                          Class<?> type)
  {
    int cmp = viewB.priority() - viewA.priority();
    
    if (cmp != 0) {
      return cmp;
    }
    
    cmp = typeDepth(viewA.type(), type) - typeDepth(viewB.type(), type);

    if (cmp != 0) {
      return cmp;
    }
    
    // equivalent views are sorted by name to ensure consistency
    
    String nameA = viewA.resolver().getClass().getName();
    String nameB = viewB.resolver().getClass().getName();
    
    return nameA.compareTo(nameB); 
  }
598637
def get_instance(attr, value):
        
        for i in list(BrowserView.instances.values()):
            try:
                if getattr(i, attr) == value:
                    return i
            except AttributeError:
                break

        return None
425832
def get_value(self, class_name, attr, default_value=None,
                  state='normal', base_name='View'):
        
        styles = self.get_dict_for_class(class_name, state, base_name)
        try:
            return styles[attr]
        except KeyError:
            return default_value
906411
function (elements, attribute, value) {
            var foundElements = [], value = value || null;
            for (i = 0; i < elements.length; i++) {
                // If the value parameter is set, return only the
                // elements that has the given attribute value.
                if (value !== null) {
                    if (elements[i].getAttribute(attribute) === value)
                        foundElements.push(elements[i]);
                } else {
                    if (elements[i].getAttribute(attribute) !== null)
                        foundElements.push(elements[i]);
                }
            }

            return foundElements;
        }
362071
def findViewsWithAttribute(self, attr, val, root="ROOT"):
        '''
        

        '''

        return self.__findViewsWithAttributeInTree(attr, val, root)
1365531
def value(self, view, template=None):
        
        if view.exists():
            value, _ = view.first()
            return self.convert(value, view)
        elif self.default is REQUIRED:
            # Missing required value. This is an error.
            raise NotFoundError(u"{0} not found".format(view.name))
        else:
            # Missing value, but not required.
            return self.default
1312565
def get_object(self, view_name, view_args, view_kwargs):
        
        lookup_value = view_kwargs[self.lookup_url_kwarg]
        lookup_kwargs = {self.lookup_field: lookup_value}
        return self.get_queryset().get(**lookup_kwargs)