Print the role information.
420970
def role(name, report, role_name_length):
    
    pad_role_name_by = 11 + role_name_length

    defaults = field_value(report["total_defaults"], "defaults", "blue", 16)
    facts = field_value(report["total_facts"], "facts", "purple", 16)
    files = field_value(report["total_files"], "files", "dark gray", 16)
    lines = field_value(report["total_lines"], "lines", "normal", 16)

    print "{0:<{1}} {2} {3} {4} {5}".format(
        clr.stringc(name, c.LOG_COLOR[report["state"]]),
        pad_role_name_by, defaults, facts, files, lines)
709937
protected function actionListUserRole()
    {
        list($selected, $action, $value) = $this->getPostedAction();

        $deleted = $updated = 0;

        foreach ($selected as $role_id) {

            if ($action === 'status' && $this->access('user_role_edit')) {
                $updated += (int) $this->role->update($role_id, array('status' => $value));
            }

            if ($action === 'delete' && $this->access('user_role_delete')) {
                $deleted += (int) $this->role->delete($role_id);
            }
        }

        if ($updated > 0) {
            $text = $this->text('Updated %num item(s)', array('%num' => $updated));
            $this->setMessage($text, 'success');
        }

        if ($deleted > 0) {
            $text = $this->text('Deleted %num item(s)', array('%num' => $deleted));
            $this->setMessage($text, 'success');
        }
    }
1029364
def get_user_roles(user):
    """"""
    if not hasattr(user, '_role_cache'):
        user._role_cache = list(TenantRole.objects.filter(user=user).values_list(
            'group', 'role', 'tenant'))
    return user._role_cache
76041
public function actionRoleAssign() : void
    {
        $username = $this->prompt('Username:', ['required' => true]);
        $user = $this->findModel($username);
        $roleName = $this->select('Role:', ArrayHelper::map($this->authManager->getRoles(), 'name', 'description'));
        $role = $this->authManager->getRole($roleName);
        $this->authManager->assign($role, $user->id);
        $this->log(true);
    }
1084158
def list_roles():
    
    click.echo(green('\nListing roles:'))
    click.echo(green('-' * 40))
    with get_app().app_context():
        roles = Role.query.all()
        if not roles:
            click.echo(red('No roles found'))
            return

        for index,role in enumerate(roles):
            click.echo('{}. {}: {}'.format(
                index + 1,
                yellow(role.handle),
                role.title
            ))

    click.echo()
980976
def _do_identity_role_list(args):
    
    rest_client = RestClient(args.url)
    state = rest_client.list_state(subtree=IDENTITY_NAMESPACE + _ROLE_PREFIX)

    head = state['head']
    state_values = state['data']
    printable_roles = []
    for state_value in state_values:
        role_list = RoleList()
        decoded = b64decode(state_value['data'])
        role_list.ParseFromString(decoded)

        for role in role_list.roles:
            printable_roles.append(role)

    printable_roles.sort(key=lambda r: r.name)

    if args.format == 'default':
        tty_width = tty.width()
        for role in printable_roles:
            # Set value width to the available terminal space, or the min width
            width = tty_width - len(role.name) - 3
            width = width if width > _MIN_PRINT_WIDTH else _MIN_PRINT_WIDTH
            value = (role.policy_name[:width] + '...'
                     if len(role.policy_name) > width
                     else role.policy_name)
            print('{}: {}'.format(role.name, value))
    elif args.format == 'csv':
        try:
            writer = csv.writer(sys.stdout, quoting=csv.QUOTE_ALL)
            writer.writerow(['KEY', 'VALUE'])
            for role in printable_roles:
                writer.writerow([role.name, role.policy_name])
        except csv.Error:
            raise CliException('Error writing CSV')
    elif args.format == 'json' or args.format == 'yaml':
        roles_snapshot = {
            'head': head,
            'roles': {role.name: role.policy_name
                      for role in printable_roles}
        }
        if args.format == 'json':
            print(json.dumps(roles_snapshot, indent=2, sort_keys=True))
        else:
            print(yaml.dump(roles_snapshot, default_flow_style=False)[0:-1])
    else:
        raise AssertionError('Unknown format {}'.format(args.format))
590917
def report(self):
        """"""
        from pprint import pprint
        print "s2n"
        pprint(self.symbol2number)
        print "n2s"
        pprint(self.number2symbol)
        print "states"
        pprint(self.states)
        print "dfas"
        pprint(self.dfas)
        print "labels"
        pprint(self.labels)
        print "start", self.start
1257956
def tally_role_columns(self):
        
        totals = self.report["totals"]
        roles = self.report["roles"]

        totals["dependencies"] = sum(roles[item]
                                     ["total_dependencies"] for item in roles)
        totals["defaults"] = sum(roles[item]
                                 ["total_defaults"] for item in roles)
        totals["facts"] = sum(roles[item]["total_facts"] for item in roles)
        totals["files"] = sum(roles[item]["total_files"] for item in roles)
        totals["lines"] = sum(roles[item]["total_lines"] for item in roles)
971658
def display_info(self):
        """"""

        if self.moc is None:
            print('No MOC information present')
            return

        if self.moc.name is not None:
            print('Name:', self.moc.name)
        if self.moc.id is not None:
            print('Identifier:', self.moc.id)
        print('Order:', self.moc.order)
        print('Cells:', self.moc.cells)
        print('Area:', self.moc.area_sq_deg, 'square degrees')
250895
def print_node(node, detailed=False):
    """"""
    nodename = node['name']
    print(colors.yellow("\n" + nodename))
    # Roles
    if detailed:
        for role in get_roles_in_node(node):
            print_role(_get_role(role), detailed=False)
    else:
        print('  Roles: {0}'.format(", ".join(get_roles_in_node(node))))
    # Recipes
    if detailed:
        for recipe in get_recipes_in_node(node):
            print "  Recipe:", recipe
            print "    attributes: {0}".format(node.get(recipe, ""))
    else:
        print('  Recipes: {0}'.format(", ".join(get_recipes_in_node(node))))
    # Node attributes
    print "  Node attributes:"
    for attribute in node.keys():
        if attribute == "run_list" or attribute == "name":
            continue
        print "    {0}: {1}".format(attribute, node[attribute])
995103
private void printLirs() {
    System.out.println("** LIRS stack TOP **");
    for (Node n = headS.nextS; n != headS; n = n.nextS) {
      checkState(n.isInS);
      if (n.status == Status.HIR_NON_RESIDENT) {
        System.out.println("<NR> " + n.key);
      } else if (n.status == Status.HIR_RESIDENT) {
        System.out.println("<RH> " + n.key);
      } else {
        System.out.println("<RL> " + n.key);
      }
    }
    System.out.println("** LIRS stack BOTTOM **");

    System.out.println("\n** LIRS queue END **");
    for (Node n = headQ.nextQ; n != headQ; n = n.nextQ) {
      checkState(n.isInQ);
      System.out.println(n.key);
    }
    System.out.println("** LIRS queue front **");

    System.out.println("\nLIRS EVICTED PAGE sequence:");
    for (int i = 0; i < evicted.size(); i++) {
      System.out.println("<" + i + "> " + evicted.get(i));
    }
  }
580177
def list_roles(self):
    
        '''
            
        '''

        title = '%s.list_certificates' % self.__class__.__name__

    # send request for list of certificates
        self.printer('Querying AWS for iam roles.')
        try:
            response = self.connection.list_roles()
        except:
            raise AWSConnectionError(title)

    # construct certificate list from response
        role_list = []
        if 'Roles' in response.keys():
            for role in response['Roles']:
                role_list.append(role['RoleName'])

    # report results and return list
        if role_list:
            print_out = 'Found iam roles'
            if len(role_list) > 1:
                print_out += 's'
            from labpack.parsing.grammar import join_words
            print_out += ' %s.' % join_words(role_list)
            self.printer(print_out)
        else:
            self.printer('No iam roles found.')

        self.role_list = role_list
        
        return self.role_list
465201
def role_list(endpoint_id):
    
    client = get_client()
    roles = client.endpoint_role_list(endpoint_id)

    resolved_ids = LazyIdentityMap(
        x["principal"] for x in roles if x["principal_type"] == "identity"
    )

    def principal_str(role):
        principal = role["principal"]
        if role["principal_type"] == "identity":
            username = resolved_ids.get(principal)
            return username or principal
        elif role["principal_type"] == "group":
            return (u"https://app.globus.org/groups/{}").format(principal)
        else:
            return principal

    formatted_print(
        roles,
        fields=[
            ("Principal Type", "principal_type"),
            ("Role ID", "id"),
            ("Principal", principal_str),
            ("Role", "role"),
        ],
    )
175470
private static void printData()
   {
      Map<String, StatisticsContext> tmpContexts = CONTEXTS;
      for (StatisticsContext context : tmpContexts.values())
      {
         printData(context);
      }
   }
686576
def roles(self):
        """"""
        roles = []
        for ur in self.roleusers:
            roles.append(ur.role)
        return set(roles)
1011202
def show(self):
        """"""
        for entry in self._entries:
            print "{'%s': %s, 'records': %s}" % (
                entry._record_type, entry.host, entry.records)
        print
100728
def post(self):
        """"""
        self.reqparse.add_argument('name', type=str, required=True)
        self.reqparse.add_argument('color', type=str, required=True)
        args = self.reqparse.parse_args()

        role = Role()
        role.name = args['name']
        role.color = args['color']

        db.session.add(role)
        db.session.commit()
        auditlog(event='role.create', actor=session['user'].username, data=args)

        return self.make_response('Role {} has been created'.format(role.role_id), HTTP.CREATED)