Makes filename text
960253
def _make_fn_text(self):
        """"""
        if not self._f:
            text = "(not loaded)"
        elif self._f.filename:
            text = os.path.relpath(self._f.filename, ".")
        else:
            text = "(filename not set)"
        return text
10568
def _join_all_filenames_and_text(
            self):
        
        self.log.info('starting the ``_join_all_filenames_and_text`` method')

        contentString = u""
        for i in self.directoryContents:
            contentString += u"%(i)s\n" % locals()
            if os.path.isfile(os.path.join(i)):
                if i[-4:] in [".png", ".jpg", ".gif"]:
                    continue
                readFile = codecs.open(i, encoding='ISO-8859-1', mode='r')
                if ".DS_Store" in i:
                    continue
                data = readFile.read()
                contentString += u"%(data)s\n" % locals()
                readFile.close()

        self.contentString = contentString

        self.log.info('completed the ``_join_all_filenames_and_text`` method')
        return None
294378
def _save_filename(self, ext):
        
        hash_token = abs(self.__hash__())
        return 'plotnine-save-{}.{}'.format(hash_token, ext)
468646
def _safe_name(file_name, sep):
    """"""
    file_name = stringify(file_name)
    if file_name is None:
        return
    file_name = ascii_text(file_name)
    file_name = category_replace(file_name, UNICODE_CATEGORIES)
    file_name = collapse_spaces(file_name)
    if file_name is None or not len(file_name):
        return
    return file_name.replace(WS, sep)
1000752
private static function makeFolderForFilename()
    {
        $filename = self::getFilename();
        $dirname = dirname($filename);
        if (!file_exists($dirname)) {
            mkdir($dirname, 0777, true);
        }
    }
314136
def pretty_filename(filename):
    ''''''
    try:
        a = os.path.abspath(filename)
        r = os.path.relpath(filename)
    except ValueError:
        # Catch relpath exception. Happens, because it can not produce relative path
        # if wroking directory is on different drive.
        a = r = filename
    return a if '..' in r else r
712592
def set_filename(self, filename):
        
        self.filename = filename
        self.logger = logging.getLogger(filename)
37482
def to_text(self, filename=None, overwrite=True):
        '''
        
        '''

        table = self.standardized
        #table = hstack([self.identifiers,
        #                self._coordinate_table(),
        #                self.magnitudes,
        #                self.errors])

        if filename == None:
            filename = '{}.txt'.format(self.name)
        self.speak('saving to {}'.format(filename))
        table.write(filename, format='ascii.ecsv', overwrite=overwrite)
117033
def output_file_name(self):
    """"""

    safe_path = re.sub(r":|/", "_", self.source_urn.Path().lstrip("/"))
    return "results_%s%s" % (safe_path, self.output_file_extension)
110047
def make_writeable(filename):
    
    if not os.access(filename, os.W_OK):
        st = os.stat(filename)
        new_permissions = stat.S_IMODE(st.st_mode) | stat.S_IWUSR
        os.chmod(filename, new_permissions)
1065771
def _temp_filename(contents):
    
    fp = tempfile.NamedTemporaryFile(
        prefix='codequalitytmp', delete=False)
    name = fp.name
    fp.write(contents)
    fp.close()
    _files_to_cleanup.append(name)
    return name
822605
def random_filename(path=None):
    """"""
    filename = uuid4().hex
    if path is not None:
        filename = os.path.join(path, filename)
    return filename
986230
def normalizeFilename(filename):
    
    result = os.path.expanduser(filename)
    result = os.path.abspath(result)
    return result
48846
def _set_filename(self, fn):
        """"""
        try:
            self.filename = self.fs = self.fn = os.path.abspath(fn.name)
        except AttributeError:
            self.filename = self.fs = self.fn = os.path.abspath(fn)
110506
def safe_filename(file_name, sep='_', default=None, extension=None):
    """"""
    if file_name is None:
        return decode_path(default)

    file_name = decode_path(file_name)
    file_name = os.path.basename(file_name)
    file_name, _extension = os.path.splitext(file_name)
    file_name = _safe_name(file_name, sep=sep)
    if file_name is None:
        return decode_path(default)
    file_name = file_name[:MAX_LENGTH]
    extension = _safe_name(extension or _extension, sep=sep)
    if extension is not None:
        file_name = '.'.join((file_name, extension))
        file_name = file_name[:MAX_LENGTH]
    return file_name
918391
def filename(self, value):
        """"""
        warnings.warn(
            "The 'filename' attribute will be removed in future versions.  "
            "Use 'source' instead.",
            DeprecationWarning, stacklevel=2
        )
        self.source = value
825776
def get_html_filename(filename):
    """"""
    if ".html" in filename:
        newFilename = filename
    elif ".md" in filename:
        newFilename = filename.replace(".md", ".html")
    elif ".tile" in filename:
        newFilename = filename.replace(".tile", ".html")
    elif ".jade" in filename:
        newFilename = filename.replace(".jade", ".html")
    elif ".txt" in filename:
        newFilename = filename.replace(".txt", ".html")
    elif ".rst" in filename:
        newFilename = filename.replace(".rst", ".html")
    elif ".docx" in filename:
        newFilename = filename.replace(".docx", ".html")
    else:
        print(filename + " is not a valid file type!")

    return newFilename