Determine in what region a content is.
503759
public function getRegion($content)
    {
        $region = $this->contentRegion->findOneBy(array('content' => $content));

        if ($region) {
            return $region->getRegion()->getName();
        }
    }
19871
def content_location(self) -> Optional[UnstructuredHeader]:
        """"""
        try:
            return cast(UnstructuredHeader, self[b'content-location'][0])
        except (KeyError, IndexError):
            return None
1312196
def find_region_end(self, lines):
        """"""
        if self.metadata and 'cell_type' in self.metadata:
            self.cell_type = self.metadata.pop('cell_type')
        else:
            self.cell_type = 'code'

        parser = StringParser(self.language or self.default_language)
        for i, line in enumerate(lines):
            # skip cell header
            if self.metadata is not None and i == 0:
                continue

            if parser.is_quoted():
                parser.read_line(line)
                continue

            parser.read_line(line)

            # New code region
            # Simple code pattern in LightScripts must be preceded with a blank line
            if self.start_code_re.match(line) or (
                    self.simple_start_code_re and self.simple_start_code_re.match(line) and
                    (self.cell_marker_start or i == 0 or _BLANK_LINE.match(lines[i - 1]))):

                if self.explicit_end_marker_required:
                    # Metadata here was conditioned on finding an explicit end marker
                    # before the next start marker. So we dismiss it.
                    self.metadata = None
                    self.language = None

                if i > 0 and _BLANK_LINE.match(lines[i - 1]):
                    if i > 1 and _BLANK_LINE.match(lines[i - 2]):
                        return i - 2, i, False
                    return i - 1, i, False
                return i, i, False

            if not self.ignore_end_marker and self.end_code_re:
                if self.end_code_re.match(line):
                    return i, i + 1, True
            elif _BLANK_LINE.match(line):
                if not next_code_is_indented(lines[i:]):
                    if i > 0:
                        return i, i + 1, False
                    if len(lines) > 1 and not _BLANK_LINE.match(lines[1]):
                        return 1, 1, False
                    return 1, 2, False

        return len(lines), len(lines), False
187404
private Locale getLocale(CmsXmlContent content) {

        List<Locale> locales = content.getLocales();
        if (locales.contains(Locale.ENGLISH) || locales.isEmpty()) {
            return Locale.ENGLISH;
        }
        return locales.get(0);
    }
387981
def parse_region(self):
        """"""

        try:
            auth_url = self.job_args['os_auth_url']
            if 'tokens' not in auth_url:
                if not auth_url.endswith('/'):
                    auth_url = '%s/' % auth_url
                auth_url = urlparse.urljoin(auth_url, 'tokens')
            return auth_url
        except KeyError:
            raise exceptions.AuthenticationProblem(
                'You Are required to specify an Auth URL, Region or Plugin'
            )
405190
def do_region(self, x, y, w, h):
        """"""
        infile = self.tmpfile
        outfile = self.basename + '.reg'
        # simeon@ice ~>cat m.pnm | pnmcut 10 10 100 200 > m1.pnm
        if (x is None):
            # print "region: full"
            self.tmpfile = infile
        else:
            # print "region: (%d,%d,%d,%d)" % (x,y,w,h)
            if (self.shell_call('cat ' + infile + ' | ' + self.pnmcut + ' ' + str(x) + ' ' + str(y) + ' ' + str(w) + ' ' + str(h) + '  > ' + outfile)):
                raise IIIFError(text="Oops... got nonzero output from pnmcut.")
            self.width = w
            self.height = h
            self.tmpfile = outfile
437911
def get_region(self, move_x, move_y):
        """"""
        top_left = (max(move_y-1, 0), max(move_x-1, 0))
        bottom_right = (min(move_y+1, self.board_height-1),
                        min(move_x+1, self.board_width-1))
        region_sum = self.mine_map[top_left[0]:bottom_right[0]+1,
                                   top_left[1]:bottom_right[1]+1].sum()

        return top_left, bottom_right, region_sum
67360
def _content_blocks(self, r):
    """"""
    return (self._block_rows - self._left_zero_blocks(r)
            - self._right_zero_blocks(r))
708147
def determine_content(request):
        

        if not request.META.get('CONTENT_LENGTH', None) \
           and not request.META.get('TRANSFER_ENCODING', None):
            return None

        return request.META.get('CONTENT_TYPE', None)
1244422
def get_region(self, x,z):
        """"""
        if (x,z) not in self.regions:
            if (x,z) in self.regionfiles:
                self.regions[(x,z)] = region.RegionFile(self.regionfiles[(x,z)])
            else:
                # Return an empty RegionFile object
                # TODO: this does not yet allow for saving of the region file
                # TODO: this currently fails with a ValueError!
                # TODO: generate the correct name, and create the file
                # and add the fie to self.regionfiles
                self.regions[(x,z)] = region.RegionFile()
            self.regions[(x,z)].loc = Location(x=x,z=z)
        return self.regions[(x,z)]
396364
function (content) {
            var contentType = content.contentType;

            if (contentType && contentType in this.contentProcessors) {
                return this.processContent(this.contentProcessors[contentType].processContent(content));
            }
            return content.value || "";
        }
1179029
private void checkContentType(String contentType) {
		if(contentType == null) {
			throw new IllegalArgumentException("the content type cannot be null");
		}
		int indexOfSlash = contentType.indexOf("/");
		if(indexOfSlash != -1) {
			if(!JainSipUtils.IANA_ALLOWED_CONTENT_TYPES.contains(contentType.substring(0, indexOfSlash))) {
				throw new IllegalArgumentException("the given content type " + contentType + " is not allowed");
			}
		} else if(!JainSipUtils.IANA_ALLOWED_CONTENT_TYPES.contains(contentType.toLowerCase())) {
			throw new IllegalArgumentException("the given content type " + contentType + " is not allowed");
		}
	}
653027
protected function checkContent()
    {
        if (is_array($this->content) && count($this->content)) {
            foreach ($this->content as $name => $value) {
                switch ($name) {
                    case 'category':
                    case 'mainMessage':
                    case 'buttonMessage':
                    case 'language':
                        $this->addContentOption($name, $value);
                        break;
                    case 'mainParams':
                    case 'buttonParams':
                        $this->addParamsOption($name, $value);
                        break;
                }
            }
        }
    }
1086130
def get_body_region(defined):
    """"""
    scope = defined.get_scope()
    pymodule = defined.get_module()
    lines = pymodule.lines
    node = defined.get_ast()
    start_line = node.lineno
    if defined.get_doc() is None:
        start_line = node.body[0].lineno
    elif len(node.body) > 1:
        start_line = node.body[1].lineno
    start = lines.get_line_start(start_line)
    scope_start = pymodule.logical_lines.logical_line_in(scope.start)
    if scope_start[1] >= start_line:
        # a one-liner!
        # XXX: what if colon appears in a string
        start = pymodule.source_code.index(':', start) + 1
        while pymodule.source_code[start].isspace():
            start += 1
    end = min(lines.get_line_end(scope.end) + 1, len(pymodule.source_code))
    return start, end
681763
def filter_all_contents(value: ecore.EPackage, type_):
        """"""
        return (c for c in value.eAllContents() if isinstance(c, type_))
943741
def in_region(rname, rstart, target_chr, target_start, target_end):
    
    return (rname == target_chr) and \
           (target_start <= rstart <= target_end)
942205
def content_type(self) -> Optional[ContentTypeHeader]:
        """"""
        try:
            return cast(ContentTypeHeader, self[b'content-type'][0])
        except (KeyError, IndexError):
            return None