def __str__(self): buff = [text_type(self.line)] for k, v in sorted(self.additions.items()): buff.append(u' {}: {}'.format(k, v)) for k, (v1, v2) in sorted(self.changes.items()): buff.append(u' {}: {} -> {}'.format(k, v1, v2)) return u'\n'.join(buff)
def write(self, files_list): """ Write the cache file """ debug('Writing cache in %s', self.cache_file) with open(self.cache_file, 'w') as out_file: for file in files_list: out_file.write(text_type(path(file).realpath())) out_file.write(u'\n')
def autodiscover(self, tempdir, appdir): """ Tries to find under *appdir* in the *tempdir* all the ``js`` files and returns the matching requirejs module names. """ args = [] info('Auto discovering JS %s', appdir) appdir = path(appdir) for dir in path(tempdir).walkdirs(appdir): args.extend(text_type(appdir.joinpath(x.namebase)) for x in dir.files('*.js')) debug('Autodicovered: %s', args) return args
def test_runner(options): debug(options) from django.core.management import call_command verbosity = int(options.test_runner.verbosity) if 'verbosity' in options.test_runner else 1 del sys.argv[1:] for key, values in options.test_runner.items(): if not isinstance(values, list): values = [values] for value in values: sys.argv.append(u'--' + key) sys.argv.append(text_type(value)) debug('Calling django test with %s', sys.argv) call_command('test', verbosity=verbosity)
def Element(tag, text): el = ET.Element(tag) el.text = text_type(text) return el