Add the appropriate python typing to subject (e.g. Optional, List, ...)

        :param subject: Subject to be decorated
        :param all_are_optional: Force everything to be optional
        :return: Typed subject
340580
def signature_cardinality(self, subject: str, all_are_optional: bool = False) -> str:
        
        if self.multiple_elements:
            rval = f"jsg.ArrayFactory('{{name}}', _CONTEXT, {subject}, {self.min}, {self.max})"
        elif self.one_optional_element:
            rval = subject if subject.startswith("typing.Optional[") else f"typing.Optional[{subject}]"
        elif self.max == 0:
            rval = "type(None)"
        else:
            rval = subject
        if all_are_optional and not self.one_optional_element:
            rval = f"typing.Optional[{rval}]"
        return rval
960266
public void addSubject(String[] subject) {
		XmpArray array = new XmpArray(XmpArray.UNORDERED);
		for (int i = 0; i < subject.length; i++) {
			array.add(subject[i]);
		}
		setProperty(SUBJECT, array);
	}
1058551
def add_to(self, email):
        
        if email.substitutions:
            if isinstance(email.substitutions, list):
                for substitution in email.substitutions:
                    self.add_substitution(substitution)
            else:
                self.add_substitution(email.substitutions)
        if email.subject:
            if isinstance(email.subject, str):
                self.subject = email.subject
            else:
                self.subject = email.subject.get()
        self._tos.append(email.get())
1038931
def postprocess_subject(self, entry):
        

        if type(entry.subject) not in [str, unicode]:
            subject = u' '.join([unicode(k) for k in entry.subject])
        else:
            subject = entry.subject
        entry.subject = [k.strip().upper() for k in subject.split(';')]
300688
def typed(cls):
    
    for name, attr in _typed_from_items(vars(cls).items()).items():
        setattr(cls, name, attr)
    return cls
1236103
def required_types(self):
        
        required_types = set(x.type for x in self.params)
        required_types.add(self.type)
        required_types.discard(None)
        return required_types
1049145
def subject(self):
        """"""
        return Subject([(s.oid, s.value) for s in self.x509.subject])
428975
private void addRolesToSubject(Subject subject, Set<String> userRoles) {
        if (userRoles == null) {
            userRoles = Collections.emptySet();
        }

        Map<String, Set<String>> attributes =
                SubjectUtils.getAttributes(subject);

        Set<String> roles = attributes.get(ROLE_KEY);
        if (roles == null) {
            roles = new HashSet<String>(userRoles);
            attributes.put(ROLE_KEY, roles);
        } else {
            roles.addAll(userRoles);
        }
        if (logger.isDebugEnabled()) {
            for (String role : userRoles) {
                logger.debug("added role: {}", role);
            }
        }
    }
1265718
def _TypecheckDecorator(subject=None, **kwargs):
  
  if subject is None:
    return _TypecheckDecoratorFactory(kwargs)
  elif inspect.isfunction(subject) or inspect.ismethod(subject):
    return _TypecheckFunction(subject, {}, 2, None)
  else:
    raise TypeError()
100055
def _verbs_with_subjects(doc):
    """"""
    # TODO: UNUSED
    verb_subj = []
    for possible_subject in doc:
        if (possible_subject.dep_ == 'nsubj' and possible_subject.head.pos_ ==
                'VERB'):
            verb_subj.append([possible_subject.head, possible_subject])
    return verb_subj
1316687
def get_subjects(self):
        
        res = requests.get(self._url('/subjects'))
        raise_if_failed(res)
        return res.json()
800153
def subject(self) -> Optional[UnstructuredHeader]:
        """"""
        try:
            return cast(UnstructuredHeader, self[b'subject'][0])
        except (KeyError, IndexError):
            return None
1287214
def _superclasses_for_subject(self, graph, typeof):
        """"""
        # TODO - this might be replacing a fairly simple graph API query where
        # it doesn't need to
        classes = []
        superclass = typeof
        while True:
            found = False
            for p, o in self.schema_def.ontology[superclass]:
                if self.schema_def.lexicon['subclass'] == str(p):
                    found = True
                    classes.append(o)
                    superclass = o
            if not found:
                break
        return classes
273020
def entities(self, subject_id):
        
        res = self._cache.get(subject_id)
        if not res:
            raise KeyError("No such subject")
        else:
            return res
698897
def raise_on_changed_subject_identifier(self):
        
        if self.id and self.subject_identifier_is_set():
            with transaction.atomic():
                obj = self.__class__.objects.get(pk=self.id)
                if obj.subject_identifier != self.subject_identifier_as_pk.hex:
                    if self.subject_identifier != obj.subject_identifier:
                        raise RegisteredSubjectError(
                            'Subject identifier cannot be changed for '
                            'existing registered subject. Got {} <> {}.'.format(
                                self.subject_identifier, obj.subject_identifier))
1368726
def validate_all_types(kwargs):
        
        for key in kwargs:
            assert isinstance(kwargs[key], type), """\n
    Typedtuple needs its arguments to be types. Argument "{k:}" was {type_name:}({val_repr}).
    You might want to try:
        {k:} = {type_name:}\n\n""".format(k=key, type_name=type(kwargs[key]).__name__, val_repr=kwargs[key].__repr__())
63759
def add(self, type):
        # type: (InternalType) -> None
        
        try:
            if isinstance(type, SetType):
                if EMPTY_SET_TYPE in self.types_hashable:
                    self.types_hashable.remove(EMPTY_SET_TYPE)
            elif isinstance(type, ListType):
                if EMPTY_LIST_TYPE in self.types_hashable:
                    self.types_hashable.remove(EMPTY_LIST_TYPE)
            elif isinstance(type, IteratorType):
                if EMPTY_ITERATOR_TYPE in self.types_hashable:
                    self.types_hashable.remove(EMPTY_ITERATOR_TYPE)
            elif isinstance(type, DictType):
                if EMPTY_DICT_TYPE in self.types_hashable:
                    self.types_hashable.remove(EMPTY_DICT_TYPE)
                for item in self.types_hashable:
                    if isinstance(item, DictType):
                        if item.key_type == type.key_type:
                            item.val_type.merge(type.val_type)
                            return
            self.types_hashable.add(type)

        except (TypeError, AttributeError):
            try:
                if type not in self.types:
                    self.types.append(type)
            except AttributeError:
                if TypeWasIncomparable not in self.types:
                    self.types.append(TypeWasIncomparable)