Returns the long_description_content_type based on the extension of the
    package describe path (e.g. .txt, .rst, or .md).
10873
def get_description_type(path=PKG_DESCRIBE):
    
    _, ext = os.path.splitext(path)
    return {
        ".rst": "text/x-rst",
        ".txt": "text/plain",
        ".md": "text/markdown",
    }[ext]
23672
def get_content_type(local_file_path)
      png = Regexp.new("\x89PNG".force_encoding("binary"))
      jpg = Regexp.new("\xff\xd8\xff\xe0\x00\x10JFIF".force_encoding("binary"))
      jpg2 = Regexp.new("\xff\xd8\xff\xe1(.*){2}Exif".force_encoding("binary"))
      case IO.read(local_file_path, 10)
      when /^GIF8/
        'image/gif'
      when /^#{png}/
        'image/png'
      when /^#{jpg}/
        'image/jpeg'
      when /^#{jpg2}/
        'image/jpeg'
      else
        if local_file_path.end_with? '.txt'
          'text/plain'
        else
          'application/octet-stream'
        end
        # mime_type = `file #{local_file_path} --mime-type`.gsub("\n", '') # Works on linux and mac
        # raise UnprocessableEntity, "unknown file type" if !mime_type
        # mime_type.split(':')[1].split('/')[1].gsub('x-', '').gsub(/jpeg/, 'jpg').gsub(/text/, 'txt').gsub(/x-/, '')
      end
    end
806397
def determine_file_type(self, z):
        """"""

        content = z.read('[Content_Types].xml')
        with io.BytesIO(content) as b:
            encoding = self._analyze_file(b)
            if encoding is None:
                encoding = 'utf-8'
            b.seek(0)
            text = b.read().decode(encoding)
            soup = bs4.BeautifulSoup(text, 'xml')
            for o in soup.find_all('Override'):
                name = o.attrs.get('PartName')
                for k, v in MIMEMAP.items():
                    if name.startswith('/{}/'.format(k)):
                        self.type = v
                        break
                if self.type:
                    break
        self.filepattern = DOC_PARAMS[self.type]['filepattern']
        self.namespaces = DOC_PARAMS[self.type]['namespaces']
        self.captures = sv.compile(DOC_PARAMS[self.type]['captures'], DOC_PARAMS[self.type]['namespaces'])
1270572
function getContentType()
    {
        $formatExtension = $this->getFormatExtension();

        return isset($this->environment->contentTypes[$formatExtension])
            ? $this->environment->contentTypes[$formatExtension]
            : false;
    }
802140
def get_long_description():
    """"""
    root_path = get_root_path()
    readme_path = os.path.join(root_path, "README.md")

    try:
        import pypandoc

        return pypandoc.convert(readme_path, "rst").strip()
    except ImportError:
        return "Cloudsmith CLI"
706414
def long_description
      text = @command.long_description
      return "" if text.nil? # empty description

      lines = text.split("\n")
      lines.map do |line|
        # In the CLI help, we use 2 spaces to designate commands
        # In Markdown we need 4 spaces.
        line.sub(/^  \b/, '    ')
      end.join("\n")
    end
255396
def get_content_type (headers):
    
    ptype = headers.get('Content-Type', 'application/octet-stream')
    if ";" in ptype:
        # split off not needed extension info
        ptype = ptype.split(';')[0]
    return ptype.strip().lower()
177758
def render_long_description(self, dirname):
        
        with changedir(dirname):
            self.setuptools.check_valid_package()
            long_description = self.setuptools.get_long_description()
            outfile = abspath('.long-description.html')
            self.docutils.publish_string(long_description, outfile, self.styles)
            return outfile
73145
@Override
  public String getDescription() {
    String ucExt = extension.substring(1).toUpperCase();
    return (ucExt + " Files (*" + extension + ')');
  }
1349218
def get_long_description():
    
    here = os.path.abspath(os.path.dirname(__file__))

    with copen(os.path.join(here, 'DESCRIPTION.rst'), encoding='utf-8') as description:
        return description.read()
1087284
def _get_long_description(self):
        

        if self.description is None:
            return None

        lines = [x for x in self.description.split('\n')]
        if len(lines) == 1:
            return None

        elif len(lines) >= 3 and lines[1] == '':
            return '\n'.join(lines[2:])

        return self.description
168545
@Restricted(NoExternalUse.class)
    public final String getLongDescription() {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        PrintStream ps = new PrintStream(out);

        printUsageSummary(ps);
        ps.close();
        return out.toString();
    }
44200
def get_content_type(*names):
    """"""
    for name in names:
        if name is not None:
            mimetype, encoding = mimetypes.guess_type(name)
            if mimetype is not None:
                if isinstance(mimetype, bytes):
                    return mimetype.decode("ascii")
                else:
                    return mimetype
    else:
        return "application/octet-stream"
1247432
def long_description(*paths):
    '''
    '''
    result = ''

    # attempt to import pandoc
    try:
        import pypandoc
    except (ImportError, OSError) as e:
        print("Unable to import pypandoc - %s" % e)
        return result

    # attempt md -> rst conversion
    try:
        for path in paths:
            result += '\n' + pypandoc.convert(
                path, 'rst', format='markdown'
            )
    except (OSError, IOError) as e:
        print("Failed to convert with pypandoc - %s" % e)
        return result

    return result
954393
def long_description():
    
    changes = latest_changes()
    changes[0] = "`Changes for v{}".format(changes[0][1:])
    changes[1] = '-' * len(changes[0])
    return "\n\n\n".join([
        read_file('README.rst'),
        '\n'.join(changes),
        "`Full changelog <https://{}.readthedocs.io/en/develop/changelog.html"
        "#changelog>`_.".format(PACKAGE_NAME),
    ])
25585
def check_restructuredtext(self):
        
        # Warn that this command is deprecated
        # Don't use self.warn() because it will cause the check to fail.
        Command.warn(
            self,
            "This command has been deprecated. Use `twine check` instead: "
            "https://packaging.python.org/guides/making-a-pypi-friendly-readme"
            "#validating-restructuredtext-markup"
        )

        data = self.distribution.get_long_description()
        content_type = getattr(
            self.distribution.metadata, 'long_description_content_type', None)

        if content_type:
            content_type, _ = cgi.parse_header(content_type)
            if content_type != 'text/x-rst':
                self.warn(
                    "Not checking long description content type '%s', this "
                    "command only checks 'text/x-rst'." % content_type)
                return

        # None or empty string should both trigger this branch.
        if not data or data == 'UNKNOWN':
            self.warn(
                "The project's long_description is either missing or empty.")
            return

        stream = _WarningStream()
        markup = render(data, stream=stream)

        if markup is None:
            self.warn(
                "The project's long_description has invalid markup which will "
                "not be rendered on PyPI. The following syntax errors were "
                "detected:\n%s" % stream)
            return

        self.announce(
            "The project's long description is valid RST.",
            level=distutils.log.INFO)
173530
def content_type
      type = (self.path.match(/\.(\w+)$/)[1] rescue "octet-stream").downcase
      case type
      when %r"jp(e|g|eg)"            then "image/jpeg"
      when %r"tiff?"                 then "image/tiff"
      when %r"png", "gif", "bmp"     then "image/#{type}"
      when "txt"                     then "text/plain"
      when %r"html?"                 then "text/html"
      when "js"                      then "application/js"
      when "csv", "xml", "css"       then "text/#{type}"
      else
        # On BSDs, `file` doesn't give a result code of 1 if the file doesn't exist.
        content_type = (Paperclip.run("file", "-b --mime-type :file", :file => self.path).split(':').last.strip rescue "application/x-#{type}")
        content_type = "application/x-#{type}" if content_type.match(/\(.*?\)/)
        content_type
      end
    end