def _download_swagger(self, location):
        """
        Download the file from given local or remote location and return it

        Parameters
        ----------
        location : str or dict
            Local path or S3 path to Swagger file to download. Consult the ``__init__.py`` documentation for specifics
            on structure of this property.

        Returns
        -------
        dict or None
            Downloaded and parsed Swagger document. None, if unable to download
        """

        if not location:
            return

        bucket, key, version = self._parse_s3_location(location)
        if bucket and key:
            LOG.debug("Downloading Swagger document from Bucket=%s, Key=%s, Version=%s", bucket, key, version)
            swagger_str = self._download_from_s3(bucket, key, version)
            return yaml_parse(swagger_str)

        if not isinstance(location, string_types):
            # This is not a string and not a S3 Location dictionary. Probably something invalid
            LOG.debug("Unable to download Swagger file. Invalid location: %s", location)
            return

        # ``location`` is a string and not a S3 path. It is probably a local path. Let's resolve relative path if any
        filepath = location
        if self.working_dir:
            # Resolve relative paths, if any, with respect to working directory
            filepath = os.path.join(self.working_dir, location)

        if not os.path.exists(filepath):
            LOG.debug("Unable to download Swagger file. File not found at location %s", filepath)
            return

        LOG.debug("Reading Swagger document from local file at %s", filepath)
        with open(filepath, "r") as fp:
            return yaml_parse(fp.read())
def _download_swagger ( self , location ) : if not location : return bucket , key , version = self . _parse_s3_location ( location ) if bucket and key : LOG . debug ( "Downloading Swagger document from Bucket=%s, Key=%s, Version=%s" , bucket , key , version ) swagger_str = self . _download_from_s3 ( bucket , key , version ) return yaml_parse ( swagger_str ) if not isinstance ( location , string_types ) : LOG . debug ( "Unable to download Swagger file. Invalid location: %s" , location ) return filepath = location if self . working_dir : filepath = os . path . join ( self . working_dir , location ) if not os . path . exists ( filepath ) : LOG . debug ( "Unable to download Swagger file. File not found at location %s" , filepath ) return LOG . debug ( "Reading Swagger document from local file at %s" , filepath ) with open ( filepath , "r" ) as fp : return yaml_parse ( fp . read ( ) )
Download the file from given local or remote location and return it

        Parameters
        ----------
        location : str or dict
            Local path or S3 path to Swagger file to download. Consult the ``__init__.py`` documentation for specifics
            on structure of this property.

        Returns
        -------
        dict or None
            Downloaded and parsed Swagger document. None, if unable to download