Retrieve all memberships associated with an organization,
        ordered by expiration date.
778749
def get_memberships_for_org(self, account_num, verbose=False):
        
        if not self.client.session_id:
            self.client.request_session()

        query = "SELECT Objects() FROM Membership " \
                "WHERE Owner = '%s' ORDER BY ExpirationDate" % account_num

        membership_list = self.get_long_query(query, verbose=verbose)
        return membership_list or []
1165441
def get_member(self, jid, default=None):
        """"""
        member = filter(lambda m: m['JID'] == jid, self.params['MEMBERS'])
        if len(member) == 1:
            return member[0]
        elif len(member) == 0:
            return default
        else:
            raise Exception('Multple members have the same JID of [%s]' % (jid,))
593409
def organization_organization_memberships(self, organization_id, **kwargs):
        ""
        api_path = "/api/v2/organizations/{organization_id}/organization_memberships.json"
        api_path = api_path.format(organization_id=organization_id)
        return self.call(api_path, **kwargs)
1275618
def by_group(self):  # pragma: no cover
        
        group_membership = {}
        for record in self.__get_groups_with_membership():
            group_membership[record.cn.value] = [
                i for i in record.memberUid.values
            ]
        return group_membership
206924
def organizations(self, organization, include=None):
        
        return self._query_zendesk(self.endpoint.organizations, 'ticket', id=organization, include=include)
366231
def get_organizations(self, page=None):
        """"""
        opts = {}
        if page:
            opts['page'] = page
        return self.api_call(ENDPOINTS['organizations']['list'], **opts)
889600
@Deprecated
    public List<Membership> getMemberships(int projectId) throws RedmineException {
        return transport.getChildEntries(Project.class, projectId, Membership.class);
    }
20750
public OrganizationMember getMember(int orgId, int userId) {
		return getResourceFactory().getApiResource(
				"/org/" + orgId + "/member/" + userId).get(
				OrganizationMember.class);
	}
772931
def organization_subscriptions(self, organization_id, **kwargs):
        ""
        api_path = "/api/v2/organizations/{organization_id}/subscriptions.json"
        api_path = api_path.format(organization_id=organization_id)
        return self.call(api_path, **kwargs)
427892
def get_orgs(self):
        
        return github.PaginatedList.PaginatedList(
            github.Organization.Organization,
            self._requester,
            "/user/orgs",
            None
        )
1139820
private MembershipImpl getFromCache(String userName, String groupId, String type)
   {
      return (MembershipImpl)cache.get(cache.getMembershipKey(userName, groupId, type), CacheType.MEMBERSHIP);
   }
576066
def __parse_affiliations_json(self, affiliations, uuid):
        """"""

        enrollments = []

        for affiliation in affiliations.values():
            name = self.__encode(affiliation['name'])

            try:
                start_date = str_to_datetime(affiliation['active'])
                end_date = str_to_datetime(affiliation['inactive'])
            except InvalidDateError as e:
                raise InvalidFormatError(cause=str(e))

            # Ignore affiliation
            if not start_date and not end_date:
                continue

            if not start_date:
                start_date = MIN_PERIOD_DATE
            if not end_date:
                end_date = MAX_PERIOD_DATE

            org = self._organizations.get(name, None)

            # Set enrolllment period according to organization data
            if org:
                start_date = org.active if start_date < org.active else start_date
                end_date = org.inactive if end_date > org.inactive else end_date

            if not org:
                org = Organization(name=name)
                org.active = MIN_PERIOD_DATE
                org.inactive = MAX_PERIOD_DATE

            enrollment = Enrollment(start=start_date, end=end_date,
                                    organization=org)
            enrollments.append(enrollment)

        return enrollments
1235700
def getmembers(object, predicate=None):
    """"""
    results = []
    for key in dir(object):
        value = getattr(object, key)
        if not predicate or predicate(value):
            results.append((key, value))
    results.sort()
    return results
828795
def group_memberships(self, user, include=None):
        
        return self._query_zendesk(self.endpoint.group_memberships, 'group_membership', id=user, include=include)
289074
def list_group_memberships(self, group_id, filter_states=None):
        
        path = {}
        data = {}
        params = {}

        # REQUIRED - PATH - group_id
        """ID"""
        path["group_id"] = group_id

        # OPTIONAL - filter_states
        """Only list memberships with the given workflow_states. By default it will
        return all memberships."""
        if filter_states is not None:
            self._validate_enum(filter_states, ["accepted", "invited", "requested"])
            params["filter_states"] = filter_states

        self.logger.debug("GET /api/v1/groups/{group_id}/memberships with query params: {params} and form data: {data}".format(params=params, data=data, **path))
        return self.generic_request("GET", "/api/v1/groups/{group_id}/memberships".format(**path), data=data, params=params, all_pages=True)
354360
def getschemas(cls):
        
        members = getmembers(cls, lambda member: isinstance(member, Schema))

        result = OrderedDict()

        for name, member in members:
            result[name] = member

        return result
50960
def get_members(pkg_name, module_filter = None, member_filter = None):
    
    modules = get_modules(pkg_name, module_filter)

    ret = {}
    for m in modules:
        members = dict(("{0}.{1}".format(v.__module__, k), v) for k, v in getmembers(m, member_filter))
        ret.update(members)

    return ret