Searches child accounts by name, starting from the given account
540261
def get_by_name_from(self, root: Account, name: str) -> List[Account]:
        
        result = []

        if root.name == name:
            result.append(root)

        for child in root.children:
            child_results = self.get_by_name_from(child, name)
            result += child_results

        return result
1140224
function findByUsername(username, cb) {
  db.getClient(function(err, client, done) {
    client.query(SELECT_USERNAME, [username], function(err, r) {
      var result = r && r.rows[0];
      if(!err && !result) { err = new exceptions.NotFound(); }
      if(err) {
        cb(err);
        done(err);
      } else {
        cb(null, result);
        done();
      }
    });
  });
}
219434
def get_account_details(self, account):
        
        _form = mechanize.HTMLForm(self.SEARCH_MEMBERS_URL, method="POST")
        _form.new_control('text', 'username', {'value': account})
        _form.new_control('text', '_', {'value': ''})

        try:
            r = self.post_url(self.SEARCH_MEMBERS_URL, form=_form)
        except AuthRequiredException:
            self._auth()
            r = self.post_url(self.SEARCH_MEMBERS_URL, form=_form)

        if r:
            # single quoted json parameters are not valid so convert
            # them into double quoted parameters
            _decoded = json.loads(r.replace("'", '"'))
            # we have a double array result so retrieve only what's
            # essential
            if _decoded[0]:
                return _decoded[0][0]

        raise InvalidAccountException
549626
function findByNameEx(args, matches) {

		// create a variable to store the matches
		matches = matches || [];
		
		// set option defaults
		args.name       = Array.isArray(args.name) ? args.name : [args.name];
		args.recursive  = (typeof(args.recursive) === 'boolean') ? args.recursive : false;
		args.limit      = !isNaN(args.limit) ? args.limit : 1;
		args.properties = args.properties || [];
		
		// check for a starting point, if one doesnt exist begin at the datacenter level
		if (!args.parent) {
			return rootSearch(args)
			.then(function(parents) {
				return findByNameEx({
					type       : args.type,
					name       : args.name,
					properties : args.properties,
					parent     : parents,
					recursive  : args.recursive,
					limit      : args.limit
				}, matches);
			});
		}
		
		// convert the parent to an array if it is not one
		args.parent = Array.isArray(args.parent) ? args.parent : [args.parent];
		
		// perform the search
		return Promise.each(args.parent, function(parent) {
			
			// check if the match limit is met
			if (matches.length >= args.limit) {
				return;
			}
			
			// perform the search on each name
			return Promise.each(args.name, function(name) {
				
				// check if the match limit is met
				if (matches.length >= args.limit) {
					return;
				}
				
				// perform the search
				return _client.getServiceContent({
					method: 'FindChild',
					service: 'searchIndex',
					params: {
						entity: util.moRef(parent.type, parent.id),
						name: name
					}
				})
				.then(function(result) {

					var id = _.get(result, '$value');
					
					if (id) {
						matches.push(id);
					}					
				});
			})
			.then(function() {
				
				// check if the match limit is met, if not and recursive
				// attempt to descend the child objects
				if (matches.length < args.limit && args.recursive) {
					
					// get the children of the current parent
					return _client.retrieve({
						type: parent.type,
						id: parent.id,
						properties: ['childEntity']
					})
					.then(function(mo) {

						var parents = [];
						
						// get all of the child folders
						_.forEach(_.get(mo, '[0].childEntity'), function(child) {
							if (child.match(/^group-.*/)) {
								parents.push({
									type: 'Folder',
									id: child
								});
							}
						});
						
						// if there were folders, recurse
						if (parents.length > 0) {
							return findByNameEx({
								type       : args.type,
								name       : args.name,
								properties : args.properties,
								parent     : parents,
								recursive  : args.recursive,
								limit      : args.limit
							}, matches);
						}
					});
				}
			});
		})
		.then(function() {
			return matches;
		});
	}
947918
function(known) {
        if (known) {
            return childrenSpec
                .filter(function(x) {
                    return (that.$[x.name] !== undefined);
                })
                .map(function(x) { return x.name;});
        } else {
            return Object.keys(that.$)
                .filter(function(x) {
                    return ((x !== naming.TOP) && (x !== naming.CA) &&
                            (x !== naming.LOADER) &&
                            (!that.$[x].__ca_isNotUnknown__) &&
                            (childrenSpecObj[x] === undefined));
                });
        }
    }
1324203
def find_by_name(name)
      if name.include?(',')
        name = name.split(',').map(&:strip).reverse.join(" ")
      end
      entries = search(base: "ou=People,o=Columbia University, c=US", filter: Net::LDAP::Filter.eq("cn", name))
      (entries.count == 1) ? entries.first : nil
    end
1312475
def find_by_name(name)
      Twinfield::Finder.new(@session).
        search(Twinfield::FinderSearch.new('DIM', name, 0, 1, 0, { office: @company, dimtype: 'DEB'} )).
        body[:search_response][:data]
    end
1346559
def get_accounts_context(self):
        """"""
        income_parent = Account.objects.get(name='Income')
        housemate_parent = Account.objects.get(name='Housemate Income')
        expense_parent = Account.objects.get(name='Expenses')
        current_liabilities_parent = Account.objects.get(name='Current Liabilities')
        long_term_liabilities_parent = Account.objects.get(name='Long Term Liabilities')

        return dict(
            housemate_accounts=Account.objects.filter(parent=housemate_parent),
            expense_accounts=expense_parent.get_descendants(),
            current_liability_accounts=Account.objects.filter(parent=current_liabilities_parent),
            long_term_liability_accounts=Account.objects.filter(parent=long_term_liabilities_parent),
            other_income_accounts=Account.objects.filter(~Q(pk=housemate_parent.pk), parent=income_parent)
        )
203657
def children(self, alias, bank_id):
        
        return self._root + self._safe_alias(alias) + '/child/ids/' + str(bank_id)
942157
@PostAuthorize("hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(#accountName, 'READ')")
    @Transactional(readOnly = true)
    public E findByAccountName(String accountName) {
        return dao.findByAccountName(accountName);
    }
243545
def find_by_username(self, username):
        """"""
        data = (db.select(self.table).select('username', 'email', 'real_name',
                                             'password', 'bio', 'status', 'role', 'uid').
                condition('username', username).execute()
                )
        if data:
            return self.load(data[0], self.model)
434576
def show(self, username):
        """"""
        filter = ['(objectclass=posixAccount)', "(uid={})".format(username)]
        return self.client.search(filter)
287675
def search_by_name(cls, name):
        
        records = aleph.downloadRecords(
            aleph.searchInAleph("aut", name, False, "wau")
        )

        for record in records:
            marc = MARCXMLRecord(record)

            author = cls.parse_author(marc)

            if author:
                yield author
272942
def list_roles(self, account_id, show_inherited=None, state=None):
        
        path = {}
        data = {}
        params = {}

        # REQUIRED - PATH - account_id
        """The id of the account to retrieve roles for."""
        path["account_id"] = account_id

        # OPTIONAL - state
        """Filter by role state. If this argument is omitted, only 'active' roles are
        returned."""
        if state is not None:
            self._validate_enum(state, ["active", "inactive"])
            params["state"] = state

        # OPTIONAL - show_inherited
        """If this argument is true, all roles inherited from parent accounts will
        be included."""
        if show_inherited is not None:
            params["show_inherited"] = show_inherited

        self.logger.debug("GET /api/v1/accounts/{account_id}/roles with query params: {params} and form data: {data}".format(params=params, data=data, **path))
        return self.generic_request("GET", "/api/v1/accounts/{account_id}/roles".format(**path), data=data, params=params, all_pages=True)
273902
def get_all_accounts(self):
        """"""
        for address_hash, rlpdata in self.secure_trie.trie.iter_branch():
            if rlpdata != trie.BLANK_NODE:
                yield rlp.decode(rlpdata, Account, db=self.db, addr=address_hash)
1355026
def find_children_banks(all_banks, visited_banks=[])
      visited_banks << self
      children = []
      sub_children = []
      all_banks.each do |bank|
        children << bank if bank.parent_id && bank.parent_id == self.original_id && !visited_banks.include?(bank)
      end
      children.each do |child|
        sub_children += child.find_children_banks(all_banks, visited_banks)
      end
      return children + sub_children
    end
601204
private void removeAccount(Account parent, Account child) {
        parent.getChildren().remove(child);
        sendAccountRemoved(parent, child);
    }