Check whether the work is the author's opus maximum.

        Two cases:
        1. the work is flagged as opus max
        2. there is only one work by this author

        :return: boolean
519489
def is_opus_maximum(self):
        
        opmax = self._get_opus_maximum()
        types = self.ecrm_P2_has_type

        if opmax in types:
            return True
        else:
            if len(self.author.get_works()) == 1:
                return True
            else:
                return False
1181950
protected function checkJobLimit()
    {
        // Make sure we don't run more than maxJobs jobs on this worker:
        $this->totalJobs++;

        if ($this->maxJobs != -1 && $this->maxJobs <= $this->totalJobs) {
            $this->stopWorker();
        }
    }
1143070
def max_n(self):
        """"""
        return max(term.max_n() for term in self.terms if term.ops)
676921
def _check_is_max_context(doc_spans, cur_span_index, position):
    """"""

    # Because of the sliding window approach taken to scoring documents, a single
    # token can appear in multiple documents. E.g.
    #  Doc: the man went to the store and bought a gallon of milk
    #  Span A: the man went to the
    #  Span B: to the store and bought
    #  Span C: and bought a gallon of
    #  ...
    #
    # Now the word 'bought' will have two scores from spans B and C. We only
    # want to consider the score with "maximum context", which we define as
    # the *minimum* of its left and right context (the *sum* of left and
    # right context will always be the same, of course).
    #
    # In the example the maximum context for 'bought' would be span C since
    # it has 1 left context and 3 right context, while span B has 4 left context
    # and 0 right context.
    best_score = None
    best_span_index = None
    for (span_index, doc_span) in enumerate(doc_spans):
        end = doc_span.start + doc_span.length - 1
        if position < doc_span.start:
            continue
        if position > end:
            continue
        num_left_context = position - doc_span.start
        num_right_context = end - position
        score = min(num_left_context, num_right_context) + 0.01 * doc_span.length
        if best_score is None or score > best_score:
            best_score = score
            best_span_index = span_index

    return cur_span_index == best_span_index
564657
boolean takeWorkPermit(boolean takeTaskPermit)
    {
        int taskDelta = takeTaskPermit ? 1 : 0;
        while (true)
        {
            long current = permits.get();
            int workPermits = workPermits(current);
            int taskPermits = taskPermits(current);
            if (workPermits == 0 || taskPermits == 0)
                return false;
            if (permits.compareAndSet(current, combine(taskPermits - taskDelta, workPermits - 1)))
            {
                if (takeTaskPermit && taskPermits == maxTasksQueued && hasRoom.hasWaiters())
                    hasRoom.signalAll();
                return true;
            }
        }
    }
1003812
def postprocess_authors_full(self, entry):
        
        if type(entry.authors_full) is not list:
            entry.authors_full = [entry.authors_full]
683870
protected boolean checkSmallStep() {
		double max = Math.max(stp, stprev);
		return( Math.abs(stp - stprev)/max < tolStep );
	}
1359925
public boolean isTooMany() {

        return (m_tooManyCount != null)
            || ((m_workflowResources != null)
                && (m_workflowResources.size() > OpenCms.getWorkflowManager().getResourceLimit()));
    }
839118
def xstatus(self):
        
        return max(node.xstatus for node in self.nodes) if len(self.nodes) else 0
1087161
def validate(cls):
        
        if not SWITCHER_EL.checked:
            return True

        if not cls.selected_code:
            cls.original_author_el.style.border = "2px solid red"
            return False

        cls.original_author_el.style.border = "0"
        return True
84834
public static function maxCount($value, int $maxCount): bool
    {
        if (!static::isCountable($value)) {
            return false;
        }

        return count($value) <= $maxCount;
    }
1300399
def has_authors(edge_data: EdgeData) -> bool:
    """"""
    return CITATION in edge_data and CITATION_AUTHORS in edge_data[CITATION] and edge_data[CITATION][CITATION_AUTHORS]
1350215
def validate(self):
        
        assert isinstance(self.author, str) , "Assumption Failed: Author is not a string"
        assert isinstance(self.aggregator, str) , "Assumption Failed: Aggregator is not a string"
        assert isinstance(self.provider, str) , "Assumption Failed: Provider is not a string"
        assert isinstance(self.files, list), "Assumption Failed: Files is not a list"
        assert isinstance(self.questions, list), "Assumption Failed: Questions is not a list"
        assert isinstance(self.extra_fields, dict), "Assumption Failed: Extra fields is not a dict"
        return super(TreeNode, self).validate()
113680
def validate(self) -> bool:
        
        # Asset class allocation should match the sum of children's allocations.
        # Each group should be compared.
        sum = Decimal(0)

        # Go through each asset class, not just the top level.
        for ac in self.asset_classes:
            if ac.classes:
                # get the sum of all the children's allocations
                child_alloc_sum = ac.child_allocation
                # compare to set allocation
                if ac.allocation != child_alloc_sum:
                    message = f"The sum of child allocations {child_alloc_sum:.2f} invalid for {ac}!"
                    self.logger.warning(message)
                    print(message)
                    return False

        # also make sure that the sum of 1st level children matches 100
        for ac in self.classes:
            sum += ac.allocation
        if sum != Decimal(100):
            message = f"The sum of all allocations ({sum:.2f}) does not equal 100!"
            self.logger.warning(message)
            print(message)
            return False

        return True
616594
function hasMultiplicationBesideDivision(node) {
  if (!Node.Type.isOperator(node)) {
    return false;
  }
  if (node.op === '*') {
    return true;
  }
  // we ony recurse through division
  if (node.op !== '/') {
    return false;
  }
  return node.args.some(hasMultiplicationBesideDivision);
}
1080169
def maximum(self):
        """"""
        value = self._schema.get("maximum", None)
        if value is None:
            return
        if not isinstance(value, NUMERIC_TYPES):
            raise SchemaError(
                "maximum value {0!r} is not a numeric type".format(
                    value))
        return value
161844
def limit_author_choices():
    
    LIMIT_AUTHOR_CHOICES = getattr(settings, 'BLOG_LIMIT_AUTHOR_CHOICES_GROUP', None)
    if LIMIT_AUTHOR_CHOICES:
        if isinstance(LIMIT_AUTHOR_CHOICES, str):
            limit = Q(groups__name=LIMIT_AUTHOR_CHOICES)
        else:
            limit = Q()
            for s in LIMIT_AUTHOR_CHOICES:
                limit = limit | Q(groups__name=s)
        if getattr(settings, 'BLOG_LIMIT_AUTHOR_CHOICES_ADMIN', False):
            limit = limit | Q(is_staff=True)
    else:
        limit = {'is_staff': True}
    return limit