rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
"Bad option for '--disable-plugins=%s'. Expecting one of: %s" | "Bad option for '--disable-plugin=%s'. Expecting one of: %s" | def set_config_opts_per_cmdline(config_opts, options, args): "takes processed cmdline args and sets config options." # do some other options and stuff if options.arch: config_opts['target_arch'] = options.arch if options.rpmbuild_arch: config_opts['rpmbuild_arch'] = options.rpmbuild_arch elif config_opts['rpmbuild_arch... |
"Bad option for '--enable-plugins=%s'. Expecting one of: %s" | "Bad option for '--enable-plugin=%s'. Expecting one of: %s" | def set_config_opts_per_cmdline(config_opts, options, args): "takes processed cmdline args and sets config options." # do some other options and stuff if options.arch: config_opts['target_arch'] = options.arch if options.rpmbuild_arch: config_opts['rpmbuild_arch'] = options.rpmbuild_arch elif config_opts['rpmbuild_arch... |
stream.write("\t\t" + name + " = " + enums[name] + ",\n") | stream.write("\t\tGL_" + name + " = " + enums[name] + ",\n") | typedef struct __GLsync *GLsync; |
stream.write("\t\tFunctor(\"gl" + function["name"] + "\", " + function["name"] + ");\n") | stream.write("\t\tFunctor(\"gl" + function["name"] + "\", gl" + function["name"] + ");\n") | typedef struct __GLsync *GLsync; |
stream.write(" (*" + function["name"] + ")") | stream.write(" (*gl" + function["name"] + ")") | typedef struct __GLsync *GLsync; |
stream.write(" fallback" + function["name"]) | stream.write(" fallback_gl" + function["name"]) | typedef struct __GLsync *GLsync; |
stream.write("" + function["name"] + "(fallback" + function["name"] + ")") | stream.write("gl" + function["name"] + "(fallback_gl" + function["name"] + ")") | typedef struct __GLsync *GLsync; |
self.assertRaises(Exception, test_view('company_work_time')) | test_view('company_work_time') | def test0005views(self): ''' Test views. ''' self.assertRaises(Exception, test_view('company_work_time')) |
regex(r'^(.*)/sai/(\w+)_s_(\d)_1\.sai$'), inputs([r'\1/sai/\2_s_\3_2.sai', r'\1/sai/\2_s_\3_1.sai', | regex(r'^(.*)/sai/(\w+)_s_(\d+)_1_sequence\.sai$'), inputs([r'\1/sai/\2_s_\3_2_sequence.sai', r'\1/sai/\2_s_\3_1_sequence.sai', | def fastq_to_sai(input_file, output_file): '''Convert FASTQ files to SAI files.''' cmd_dict = CMD_DICT.copy() cmd_dict['infile'] = input_file cmd_dict['outfile'] = output_file pmsg('FASTQ to SAI', cmd_dict['infile'], cmd_dict['outfile']) bwacmd = '%(bwa)s aln -t %(threads)s %(genome)s %(infile)s > %(outfile)s' call(bwa... |
out_file = os.path.splitext(out_file)[0] + '.fastq.gz' | out_file = out_file.split(os.path.extsep)[0] + '.fastq.gz' | def copy_sequence_generator(): for in_file in glob('staging_area/*'): out_file = os.path.split(in_file)[-1] out_file = os.path.splitext(out_file)[0] + '.fastq.gz' out_file = os.path.join('fastq', out_file) yield [in_file, out_file] |
yield [file, '%s/fastq/%s.fastq.gz' % (cwd, filename.strip('.txt'))] | yield [file, '%s/fastq/%s.fastq.gz' % (cwd, filename.rstrip('.txt'))] | def copy_sequence_generator(): cwd = os.getcwd() for file in glob('/media/thumper1/nextgen/staging_area/*_sequence.txt'): filename = paired_strings['sequence'] % paired_re.search(file).groupdict() yield [file, '%s/fastq/%s.fastq.gz' % (cwd, filename.strip('.txt'))] |
pmsg('Sequence Copy', cmd_dict['infile'], cmd_dict['outfile']) SeqIO.convert(input_file, 'fastq-illumina', output_file.strip('.gz'), 'fastq-sanger') if 'fastq.gz' not in output_file: zip(output_file) | cmd_dict['outfile_prefix'] = output_file.rstrip('.gz') pmsg('Sequence Copy', input_file, cmd_dict['outfile_prefix']) SeqIO.convert(cmd_dict['infile'], 'fastq-illumina', cmd_dict['outfile_prefix'], 'fastq-sanger') pmsg('Compressing file', cmd_dict['outfile_prefix'], cmd_dict['outfile']) zip(cmd_dict['outfile_prefix']) | def copy_sequences(input_file, output_file): """Copy sequence files from staging area on thumper1""" cmd_dict = CMD_DICT.copy() cmd_dict['infile'] = input_file cmd_dict['outfile'] = output_file pmsg('Sequence Copy', cmd_dict['infile'], cmd_dict['outfile']) SeqIO.convert(input_file, 'fastq-illumina', output_file.strip('... |
@transform(sam_to_bam, regex(r'^(.*)/bam/(.*).bam$'), r'\1/namesorted_bam/\2.bam') | @transform(sam_to_bam, regex(r'^(.*)/bam/(.*).bam$'), r'\1/namesorted_bam/\2.namesorted.bam') | def sam_to_bam(input_file, output_file): '''Convert SAM files to BAM files.''' cmd_dict = cdict.copy() finfo = unpaired_re.search(input_file).groupdict() cmd_dict['infile'] = input_file cmd_dict['ofile'] = output_file pmsg('SAM to BAM', cmd_dict['infile'], cmd_dict['ofile']) samcmd = '%(samtools)s import %(ref)s.fai %(... |
cmd_dict['outprefix'] = os.path.splitext(output_file) | cmd_dict['outprefix'] = os.path.splitext(output_file)[0] | def namesort_bam(input_file, output_file): '''Sort BAM files by name.''' cmd_dict = cdict.copy() cmd_dict['infile'] = input_file cmd_dict['outfile'] = output_file cmd_dict['outprefix'] = os.path.splitext(output_file) pmsg('BAM Name Sort', cmd_dict['infile'], cmd_dict['outfile']) samcmd = '%(samtools)s sort -n %(infile)... |
picard_cmd = '%(picard)s MarkDupilcates I=%(infile)s O=%(outfile)s REMOVE_DUPLICATES=true' | picard_cmd = '%(picard)s MarkDuplicates I=%(infile)s O=%(outfile)s REMOVE_DUPLICATES=true' | def remove_duplicates(input_file, output_file): '''Remove duplicates from BAM file''' cmd_dict = CMD_DICT.copy() cmd_dict['infile'] = input_file cmd_dict['outfile'] = output_file pmsg('Remove duplicates', input_file, output_file) picard_cmd = '%(picard)s MarkDupilcates I=%(infile)s O=%(outfile)s REMOVE_DUPLICATES=true'... |
call(samtools_cmd, cmd_dict) | call(samtools_cmd, cmd_dict, is_logged=False) | def fix_mate_realigned(input_file, output_file): '''Fix mate info post-realignment''' cmd_dict = CMD_DICT.copy() cmd_dict['infile'] = input_file cmd_dict['outfile'] = output_file pmsg('Fix Mate Info', cmd_dict['infile'], cmd_dict['outfile']) picard_cmd = '%(picard)s FixMateInformation ' + \ 'INPUT=%(infile)s ' + \ 'OUT... |
call('ln %(infile)s %(outfile)s', cmd_dict, is_logged=False) | call('ln -s %(infile)s %(outfile)s', cmd_dict, is_logged=False) | def remove_duplicates(input_file, output_file): '''Remove duplicates from BAM file''' cmd_dict = CMD_DICT.copy() cmd_dict['infile'] = input_file cmd_dict['outfile'] = output_file if cmd_dict['sam_type'] == 'sampe': cmd_dict['metrics'] = output_file.rstrip('bam') + 'metrics' pmsg('Removing duplicates', input_file, outpu... |
regex(r'^(.+)/sai/([\d_]+)_s_(\d)_1.sai$'), | regex(r'^(.*)/sai/(\w+)_s_(\d)_1.sai$'), | def fastq_to_sai(input_file, output_file): '''Convert FASTQ files to SAI files.''' cmd_dict = cdict.copy() cmd_dict['infile'] = input_file cmd_dict['outfile'] = output_file pmsg('FASTQ to SAI', cmd_dict['infile'], cmd_dict['outfile']) bwacmd = '%(bwa)s aln -t %(threads)s %(ref)s %(infile)s > %(outfile)s' % cmd_dict cal... |
pmsg('SAM to BAM', cmd_dict['infile'], cmd_dict['ofile']) | pmsg('SAM to BAM', cmd_dict['infile'], cmd_dict['outfile']) | def sam_to_bam(input_file, output_file): '''Convert SAM files to BAM files.''' cmd_dict = cdict.copy() cmd_dict['infile'] = input_file cmd_dict['outfile'] = output_file pmsg('SAM to BAM', cmd_dict['infile'], cmd_dict['ofile']) samcmd = '%(samtools)s import %(ref)s.fai %(infile)s %(outfile)s' % cmd_dict call(samcmd) |
cmd_dict['outfile'] = os.path.splitext(output_file)[0] cmd_dict['outprefix'] = cmd_dict['outfile'] | cmd_dict['outfile'] = output_file cmd_dict['outprefix'] = os.path.splitext(cmd_dict['outfile'])[0] | def sort_bam(input_file, output_file): '''Sort BAM files by coordinate.''' cmd_dict = cdict.copy() cmd_dict['infile'] = input_file cmd_dict['outfile'] = os.path.splitext(output_file)[0] cmd_dict['outprefix'] = cmd_dict['outfile'] pmsg('BAM Coord Sort', cmd_dict['infile'], cmd_dict['outfile']) samcmd = '%(samtools)s sor... |
samcmd = '%(samtools)s sort %(infile)s %(outprefix)s' % cmd_dict call(samcmd) | picard_cmd = '%(sort_sam)s INPUT=%(infile)s OUTPUT=%(outfile)s SORT_ORDER=coordinate ' + \ 'MAX_RECORDS_IN_RAM=5000000' call(picard_cmd % cmd_dict) | def sort_bam(input_file, output_file): '''Sort BAM files by coordinate.''' cmd_dict = cdict.copy() cmd_dict['infile'] = input_file cmd_dict['outfile'] = os.path.splitext(output_file)[0] cmd_dict['outprefix'] = cmd_dict['outfile'] pmsg('BAM Coord Sort', cmd_dict['infile'], cmd_dict['outfile']) samcmd = '%(samtools)s sor... |
cmd_dict['read_group'] = os.path.split(output_file)[0] | cmd_dict['read_group'] = os.path.split(input_file)[1].rstrip('.sorted.bam') | def fix_header(input_file, output_file): '''Fix header info''' cmd_dict = cdict.copy() cmd_dict['infile'] = input_file cmd_dict['outfile'] = output_file cmd_dict['read_group'] = os.path.split(output_file)[0] cmd_dict.update(read_group_re.match(cmd_dict['read_group']).groupdict()) open(cmd_dict['header_tmp'] % cmd_dict,... |
open(cmd_dict['header_tmp'] % cmd_dict, 'w').write( | cmd_dict['header_tmp'] = cmd_dict['header_tmp'] % cmd_dict open(cmd_dict['header_tmp'], 'w').write( | def fix_header(input_file, output_file): '''Fix header info''' cmd_dict = cdict.copy() cmd_dict['infile'] = input_file cmd_dict['outfile'] = output_file cmd_dict['read_group'] = os.path.split(output_file)[0] cmd_dict.update(read_group_re.match(cmd_dict['read_group']).groupdict()) open(cmd_dict['header_tmp'] % cmd_dict,... |
picard_cmd = '%(replace_header) INPUT=%(infile)s HEADER=%(header_tmp)s OUTPUT=%(outfile)s' | picard_cmd = '%(replace_header)s INPUT=%(infile)s HEADER=%(header_tmp)s OUTPUT=%(outfile)s' | def fix_header(input_file, output_file): '''Fix header info''' cmd_dict = cdict.copy() cmd_dict['infile'] = input_file cmd_dict['outfile'] = output_file cmd_dict['read_group'] = os.path.split(output_file)[0] cmd_dict.update(read_group_re.match(cmd_dict['read_group']).groupdict()) open(cmd_dict['header_tmp'] % cmd_dict,... |
@transform(fix_header, regex(r'^(.*)/prepped_bam/(.*).bam'), r'\1/prepped_bam/\2.bai') | @transform(fix_header, regex(r'^(.*)/prepped_bam/(.*).bam'), r'\1/prepped_bam/\2.bam.bai') | def fix_header(input_file, output_file): '''Fix header info''' cmd_dict = cdict.copy() cmd_dict['infile'] = input_file cmd_dict['outfile'] = output_file cmd_dict['read_group'] = os.path.split(output_file)[0] cmd_dict.update(read_group_re.match(cmd_dict['read_group']).groupdict()) open(cmd_dict['header_tmp'] % cmd_dict,... |
pmsg('Create BAM Index', input_file.strip('.gz'), output_file.strip('.gz')) | pmsg('Create BAM Index', input_file, output_file) | def bam_index(input_file, output_file): '''Index BAM file and create a BAI file.''' pmsg('Create BAM Index', input_file.strip('.gz'), output_file.strip('.gz')) cmd_dict = cdict.copy() cmd_dict['infile'] = input_file.strip('.gz') idxcmd = '%(samtools)s index %(infile)s' % cmd_dict call(idxcmd) |
cmd_dict['infile'] = input_file.strip('.gz') | cmd_dict['infile'] = input_file | def bam_index(input_file, output_file): '''Index BAM file and create a BAI file.''' pmsg('Create BAM Index', input_file.strip('.gz'), output_file.strip('.gz')) cmd_dict = cdict.copy() cmd_dict['infile'] = input_file.strip('.gz') idxcmd = '%(samtools)s index %(infile)s' % cmd_dict call(idxcmd) |
print "Please choose one of the following options:" for stage, fn in pipeline_stages.items(): print '\t%s:\t%s' % (stage, fn.__doc__) | print "Please choose one of the following options (* default stage):" for pipeline, stages_dict in pipeline_stages.items(): print '\t%s' % (pipeline) for stage, fn in stages_dict.items(): if stage is not 'default': if fn == stages_dict['default']: print '\t\t*%s:\t%s' % (stage, fn.__doc__) else: print '\t\t%s:\t%s' % (... | def show_pipeline_stage_help(): print "The pipeline stage you selected does not exist." print "Please choose one of the following options:" for stage, fn in pipeline_stages.items(): print '\t%s:\t%s' % (stage, fn.__doc__) sys.exit(0) |
if options.stage not in pipeline_stages.keys(): | if options.stage not in pipeline_stages[options.pipeline].keys(): | def show_pipeline_stage_help(): print "The pipeline stage you selected does not exist." print "Please choose one of the following options:" for stage, fn in pipeline_stages.items(): print '\t%s:\t%s' % (stage, fn.__doc__) sys.exit(0) |
@files(['bam/', 'clipped/', 'sam/', 'sorted/'], None) | @files(['sam/', 'sorted/'], None) | def create_intervals_generator(): for infile in glob('deduped/*.bam'): outfile = '%(line)s_s_%(lane)s.intervals' % filename_re.search(infile).groupdict() yield [infile, 'intervals/%s' % outfile] |
start_stage = bam_index | start_stage = pipe1.bam_index | def show_pipeline_stage_help(): print "The pipeline stage you selected does not exist." print "Please choose one of the following options:" for stage, fn in pipeline_stages.items(): print '\t%s:\t%s' % (stage, fn.__doc__) sys.exit(0) |
cmd_dict['header_tmp'] = '/tmp/header_%(read_group)s_%(lane)' % cmd_dict | cmd_dict['header_tmp'] = '/tmp/header_%(read_group)s_%(lane)s' % cmd_dict | def fix_header(input_file, output_file): '''Fix header info''' cmd_dict = CMD_DICT.copy() cmd_dict['infile'] = input_file cmd_dict['outfile'] = output_file cmd_dict.update(read_group_re.match(input_file).groupdict()) cmd_dict['header_tmp'] = '/tmp/header_%(read_group)s_%(lane)' % cmd_dict open(cmd_dict['header_tmp'], '... |
inputs([r'\1/indels/\2.detailed.bed']), | inputs(r'\1/indels/\2.detailed.bed'), | def snp_genotyping(input_file, output_file): '''Call SNP variants''' cmd_dict = CMD_DICT.copy() cmd_dict['infile'] = input_file cmd_dict['outfile'] = output_file pmsg('SNP Genotyping', cmd_dict['infile'], cmd_dict['outfile']) gatk_cmd = '%(gatk)s ' + \ '-T UnifiedGenotyper ' + \ '-R %(genome)s ' + \ '-D %(dbsnp)s ' + \... |
pmsg('Index BAM', cmd_dict['infile'], cmd_dict['outfile']) picard_cmd = '%(picard)s BuildBamIndex ' + \ 'I=%(outfile)s ' + \ 'O=%(outfile)s.bai ' + \ 'OVERWRITE=true' call(picard_cmd, cmd_dict) | samtools_cmd = '%(samtools)s index %(outfile)s' call(samtools_cmd, cmd_dict) | def fix_header(input_file, output_file): '''Fix header info''' cmd_dict = CMD_DICT.copy() cmd_dict['infile'] = input_file cmd_dict['outfile'] = output_file cmd_dict.update(read_group_re.match(input_file).groupdict()) cmd_dict['header_tmp'] = '/tmp/header_%(read_group)s_%(lane)s' % cmd_dict open(cmd_dict['header_tmp'], ... |
@jobs_limit(2) | def copy_sequence_generator(): for in_file in glob('staging_area/*'): out_file = os.path.split(in_file)[-1] out_file = out_file.split(os.path.extsep)[0] + '.fastq.gz' out_file = os.path.join('fastq', out_file) yield [in_file, out_file] | |
cmd_dict = CMD_DICT.copy() cmd_dict['infile'] = input_file cmd_dict['outfile'] = output_file cmd_dict['outfile_prefix'] = output_file.rstrip('.gz') pmsg('Copying sequence files', input_file, cmd_dict['outfile_prefix']) | pmsg('Copying sequence files', input_file, output_file) input_file_handle = gzip.open(input_file, 'rb') if input_file.endswith('gz') \ else open(input_file) output_file_handle = gzip.open(output_file, 'wb') | def copy_sequence(input_file, output_file): '''Copy sequence files from staging area''' cmd_dict = CMD_DICT.copy() cmd_dict['infile'] = input_file cmd_dict['outfile'] = output_file cmd_dict['outfile_prefix'] = output_file.rstrip('.gz') pmsg('Copying sequence files', input_file, cmd_dict['outfile_prefix']) try: SeqIO.co... |
SeqIO.convert(cmd_dict['infile'], 'fastq-illumina', cmd_dict['outfile_prefix'], 'fastq-sanger') | SeqIO.convert(input_file_handle, 'fastq-illumina', output_file_handle, 'fastq') | def copy_sequence(input_file, output_file): '''Copy sequence files from staging area''' cmd_dict = CMD_DICT.copy() cmd_dict['infile'] = input_file cmd_dict['outfile'] = output_file cmd_dict['outfile_prefix'] = output_file.rstrip('.gz') pmsg('Copying sequence files', input_file, cmd_dict['outfile_prefix']) try: SeqIO.co... |
call('cp %(infile)s %(outfile_prefix)s', cmd_dict, is_logged=False) pmsg('Compressing file', cmd_dict['outfile_prefix'], cmd_dict['outfile']) zip(cmd_dict['outfile_prefix']) | if isinstance(input_file_handle, gzip.GzipFile): call('cp %(infile)s %(outfile)s', {'infile': input_file, 'outfile': output_file}, is_logged=False) else: call('gzip -c %(infile)s > %(outfile)s', {'infile': input_file, 'outfile': output_file}, is_logged=False) finally: input_file_handle.close() output_file_handle.clos... | def copy_sequence(input_file, output_file): '''Copy sequence files from staging area''' cmd_dict = CMD_DICT.copy() cmd_dict['infile'] = input_file cmd_dict['outfile'] = output_file cmd_dict['outfile_prefix'] = output_file.rstrip('.gz') pmsg('Copying sequence files', input_file, cmd_dict['outfile_prefix']) try: SeqIO.co... |
content += 'Enclosure: %s (Type: %s, Size: %d)' \ | content += '\nEnclosure: %s (%s, %d bytes)' \ | def format_mail(id, link, title, timestamp, author, body, feed_title, feed_author, enclosures): """ Returns a `(subject, author, body)` tuple, forming the mail's Subject and From headers and the mail's body, respectively. All arguments passed expect for `id` and `timestamp` can be ``None``. The returned tuple's items... |
% (enclosure.href, enclosure.type, enclosure.length) | % (enclosure.href, enclosure.type, length) | def format_mail(id, link, title, timestamp, author, body, feed_title, feed_author, enclosures): if not title: if body: title = body[:70] + '...' else: title = link if not author: author = feed_author or '' if feed_title: title = feed_title + ': ' + title content = BufferedUnicode() content += title + '\n' + (link or... |
smtp_server.sendmail(SENDER_MAIL, RECIPIENT_MAIL, mail.as_string()) | smtp_server.sendmail( config.SENDER_MAIL, config.RECIPIENT_MAIL, mail.as_string() ) | def main(): if os.path.exists('.seen'): with open('.seen', 'r') as fobj: seen = pickle.load(fobj) else: seen = {} mail_queue = [] for feed in config.FEEDS: if isinstance(feed, (list, tuple)): feed, feed_id = feed else: feed_id = feed seen.setdefault(feed_id, set()) for entry in fetch_entries(feed, seen[feed_id]): mai... |
mail = email.mime.text.MIMEText(body.encode(ENCODING), 'plain', codec) | mail = email.mime.text.MIMEText(body, 'plain', codec) | def generate_mail_for_entry(entry): body = select_plaintext_body(entry) title = select_plaintext_title(entry) or body[50:] + '...' timestamp = select_timestamp(entry) feed_title = entry['feed_title'] or '' if feed_title: if 'html' in feed_title.type: feed_title = html2text(feed_title.value).replace('\n', ' ') else: fee... |
mail['Subject'] = title | mail['Subject'] = subject | def generate_mail_for_entry(entry): # the entry's content: body = force_unicode(select_plaintext_body(entry)) # the entry's title: title = force_unicode(select_plaintext_title(entry)) # the date+time the entry was updated/published: timestamp = select_timestamp(entry) # the entry's feed's title: feed_title = force_unic... |
if not author: author = feed_author or '' | def format_mail(id, link, title, timestamp, author, body, feed_title, feed_author, enclosures): if not title: if body: title = body[:70] + '...' else: title = link if not author: author = feed_author or '' if feed_title: title = feed_title + ': ' + title content = BufferedUnicode() content += title + '\n' + (link or... | |
title = feed_title + ': ' + title | author = feed_title else: if not author: author = feed_author or '' | def format_mail(id, link, title, timestamp, author, body, feed_title, feed_author, enclosures): if not title: if body: title = body[:70] + '...' else: title = link if not author: author = feed_author or '' if feed_title: title = feed_title + ': ' + title content = BufferedUnicode() content += title + '\n' + (link or... |
def getDependentConfigFiles(filename, addSelf=True, outfile=None): | def getDependentConfigFiles(baseFolder, infile, addSelf=True, outfile=None): | def getDependentConfigFiles(filename, addSelf=True, outfile=None): config = ConfigParser.RawConfigParser() config.read(filename) dependents = set() if addSelf: dependents.add(filename) path = os.path.dirname(filename) try: extends = config.get('buildout', 'extends') except ConfigParser.NoSectionError: return depende... |
config.read(filename) | config.read(infile) | def getDependentConfigFiles(filename, addSelf=True, outfile=None): config = ConfigParser.RawConfigParser() config.read(filename) dependents = set() if addSelf: dependents.add(filename) path = os.path.dirname(filename) try: extends = config.get('buildout', 'extends') except ConfigParser.NoSectionError: return depende... |
dependents.add(filename) path = os.path.dirname(filename) | dependents.add(infile) | def getDependentConfigFiles(filename, addSelf=True, outfile=None): config = ConfigParser.RawConfigParser() config.read(filename) dependents = set() if addSelf: dependents.add(filename) path = os.path.dirname(filename) try: extends = config.get('buildout', 'extends') except ConfigParser.NoSectionError: return depende... |
fullname = os.path.join(path, part) | fullname = os.path.join(baseFolder, part) | def getDependentConfigFiles(filename, addSelf=True, outfile=None): config = ConfigParser.RawConfigParser() config.read(filename) dependents = set() if addSelf: dependents.add(filename) path = os.path.dirname(filename) try: extends = config.get('buildout', 'extends') except ConfigParser.NoSectionError: return depende... |
fullname, filename)) | fullname, infile)) | def getDependentConfigFiles(filename, addSelf=True, outfile=None): config = ConfigParser.RawConfigParser() config.read(filename) dependents = set() if addSelf: dependents.add(filename) path = os.path.dirname(filename) try: extends = config.get('buildout', 'extends') except ConfigParser.NoSectionError: return depende... |
dependents.update(getDependentConfigFiles(fullname)) | dependents.update(getDependentConfigFiles(os.path.dirname(fullname), fullname)) | def getDependentConfigFiles(filename, addSelf=True, outfile=None): config = ConfigParser.RawConfigParser() config.read(filename) dependents = set() if addSelf: dependents.add(filename) path = os.path.dirname(filename) try: extends = config.get('buildout', 'extends') except ConfigParser.NoSectionError: return depende... |
newname = os.path.split(filename)[-1] | newname = os.path.split(infile)[-1] | def getDependentConfigFiles(filename, addSelf=True, outfile=None): config = ConfigParser.RawConfigParser() config.read(filename) dependents = set() if addSelf: dependents.add(filename) path = os.path.dirname(filename) try: extends = config.get('buildout', 'extends') except ConfigParser.NoSectionError: return depende... |
dependents.remove(filename) | dependents.remove(infile) | def getDependentConfigFiles(filename, addSelf=True, outfile=None): config = ConfigParser.RawConfigParser() config.read(filename) dependents = set() if addSelf: dependents.add(filename) path = os.path.dirname(filename) try: extends = config.get('buildout', 'extends') except ConfigParser.NoSectionError: return depende... |
dependencies = getDependentConfigFiles(template_path, | dependencies = getDependentConfigFiles(os.path.dirname(template_path), projectConfigFilename, | def build(configFile, options): # Read the configuration file. logger.info('Loading configuration file: ' + configFile) config = ConfigParser.RawConfigParser() config.read(configFile) # Create the project config parser logger.info('Creating Project Configuration') projectParser = ConfigParser.RawConfigParser() templat... |
base.do('python setup.py sdist register upload', cwd = tagDir) | base.do('python setup.py sdist upload', cwd = tagDir) | def createRelease(self, version, branch): logger.info('Creating release %r for %r from branch %r' %( version, self.pkg, branch)) # 0. Skip creating releases in offline mode. if self.options.offline: logger.info('Offline: Skip creating a release.') return # 1. Create Release Tag branchUrl = self.getBranchURL(branch) tag... |
class PostscriptStemSnapFormatter(NSFormatter): def stringForObjectValue_(self, obj): if obj is None or isinstance(obj, NSNull): return "" return " ".join([str(i) for i in obj]) def getObjectValue_forString_errorDescription_(self, value, string, error): if not string.strip(): return True, [], "" try: values = [int(i)... | def _textEditCallback(self, sender): value = sender._get() if value != "-": try: v = int(value) if v > 0: sender.set("") return except ValueError: if value.startswith("-"): value = value = "-" else: value = "" sender.set(value) return if self._finalCallback is not None: self._finalCallback(sender) | |
print value | def noneToZero(value): print value if value is None: return 0 return value | |
controlClass=PanoseControl, controlOptions=dict(formatter=PostscriptBluesFormatter.alloc().init()) | controlClass=PanoseControl | def openTypeOS2WeightClassToUFO(value): return value + 1 |
controlOptions=dict(formatter=PostscriptBluesFormatter.alloc().init()) | conversionFromUFO=infoListFromUFO, conversionToUFO=postscriptBluesToUFO, | def openTypeOS2WeightClassToUFO(value): return value + 1 |
controlOptions=dict(formatter=PostscriptStemSnapFormatter.alloc().init()) | conversionFromUFO=infoListFromUFO, conversionToUFO=postscriptStemSnapToUFO, | def openTypeOS2WeightClassToUFO(value): return value + 1 |
d[key] = getattr(font, attr) | if attr == defaultFontIDAttribute: value = makeDefaultIDString(font) else: value = getattr(font, attr) d[key] = value | def _fontChanged(self, notification): font = notification.object if font not in self._wrappedListItems: return d = self._wrappedListItems[font] for key, attr in self._keyToAttribute.items(): d[key] = getattr(font, attr) |
from netauth import log log.info( 'start validate' ) | def validate(self, request, data): | |
log.info( 'create request' ) | def validate(self, request, data): | |
'code': data['code'] | 'code': data['code'], | def validate(self, request, data): |
extra_fields = [i for i in self.PROFILE_MAPPING] return response.users.getInfo([self.identity], extra_fields)[0] | request = self.get_request( url=self.API_URL, parameters = { 'access_token': self.identity }) content = self.load_request(request) return simplejson.loads(content) | def get_extra_data(self, response): |
log.info( twitter_data ) | def validate(self, request, data): try: parameters = dict( oauth_token = data['oauth_token'], oauth_verifier = data.get('oauth_verifier', None)) except MultiValueDictKeyError: messages.error(request, lang.BACKEND_ERROR) raise Redirect('publicauth-login') | |
if response[ 'status' ] == 200: | if response[ 'status' ] == '200': | def get_extra_data(self, response): user_id = urlparse.parse_qs(response, keep_blank_values=False)['user_id'][0] url = self.API_URL % user_id response, content = httplib2.Http().request(url) result = dict() if response[ 'status' ] == 200: result = simplejson.loads(content) return result |
log.info(content) log.info(cookie_data) | def validate(self, request, data): cookie_name = "vk_app_%s" % settings.VKONTAKTE_APPLICATION_ID try: cookie_data = self.parse_qs(request.COOKIES[cookie_name]) value = "" for i in ('expire', 'mid', 'secret', 'sid'): value += "%s=%s" % (i, cookie_data[i][0] ) if cookie_data['sig'][0] == md5(value + settings.VKONTAKTE_AP... | |
callback = request.build_absolute_uri(reverse('publicauth-complete', args=[self.provider])) url = self.__get_url( http_url=self.REQUEST_TOKEN_URL, parameters={ 'oauth_callback' : callback }) | url = self.__get_url( http_url=self.REQUEST_TOKEN_URL ) | def begin(self, request, data): """ Try to get Request Token from OAuth Provider and redirect user to provider's site for approval. """ callback = request.build_absolute_uri(reverse('publicauth-complete', args=[self.provider])) url = self.__get_url( http_url=self.REQUEST_TOKEN_URL, parameters={ 'oauth_callback' : callb... |
log.info(response) | def begin(self, request, data): """ Try to get Request Token from OAuth Provider and redirect user to provider's site for approval. """ callback = request.build_absolute_uri(reverse('publicauth-complete', args=[self.provider])) url = self.__get_url( http_url=self.REQUEST_TOKEN_URL, parameters={ 'oauth_callback' : callb... | |
url = self.__get_url( token = Token.from_string( content ), http_url=self.AUTHORIZE_URL,) | callback = request.build_absolute_uri(reverse('publicauth-complete', args=[self.provider])) url = self.__get_url( token = Token.from_string( content ), http_url=self.AUTHORIZE_URL, parameters = dict( oauth_callback = callback )) | def begin(self, request, data): """ Try to get Request Token from OAuth Provider and redirect user to provider's site for approval. """ # callback = request.build_absolute_uri(reverse('publicauth-complete', args=[self.provider])) url = self.__get_url( http_url=self.REQUEST_TOKEN_URL ) |
super( OAuthBackend, self ).__init__( *args, **kwargs ) | def __init__( self, *args, **kwargs ): self.consumer = Consumer(self.CONSUMER_KEY, self.CONSUMER_SECRET) self.signature_method = SignatureMethod_HMAC_SHA1() super( OAuthBackend, self ).__init__( *args, **kwargs ) | |
url = self.__get_url( http_url=self.REQUEST_TOKEN_URL ) | callback = request.build_absolute_uri(reverse('publicauth-complete', args=[self.provider])) url = self.__get_url( http_url=self.REQUEST_TOKEN_URL, parameters = dict( oauth_callback = callback )) | def begin(self, request, data): """ Try to get Request Token from OAuth Provider and redirect user to provider's site for approval. """ url = self.__get_url( http_url=self.REQUEST_TOKEN_URL ) |
callback = request.build_absolute_uri(reverse('publicauth-complete', args=[self.provider])) url = self.__get_url( token = Token.from_string( content ), http_url=self.AUTHORIZE_URL, parameters = dict( oauth_callback = callback )) | url = self.__get_url( token = Token.from_string( content ), http_url=self.AUTHORIZE_URL,) | def begin(self, request, data): """ Try to get Request Token from OAuth Provider and redirect user to provider's site for approval. """ url = self.__get_url( http_url=self.REQUEST_TOKEN_URL ) |
self.identity = urlparse.parse_qs(content, keep_blank_values=False)['oauth_token'][0] | twitter_data = urlparse.parse_qs(content, keep_blank_values=False) log.info( twitter_data ) self.identity = twitter_data['oauth_token'][0] | def validate(self, request, data): try: parameters = dict( oauth_token = data['oauth_token'], oauth_verifier = data.get('oauth_verifier', None)) except MultiValueDictKeyError: messages.error(request, lang.BACKEND_ERROR) raise Redirect('publicauth-login') |
content = request.COOKIES[cookie_name] cookie_data = self.parse_qs(content) | cookie_data = self.parse_qs(request.COOKIES[cookie_name]) | def validate(self, request, data): cookie_name = "vk_app_%s" % settings.VKONTAKTE_APPLICATION_ID try: content = request.COOKIES[cookie_name] cookie_data = self.parse_qs(content) value = "" for i in ('expire', 'mid', 'secret', 'sid'): value += "%s=%s" % (i, cookie_data[i][0] ) if cookie_data['sig'][0] == md5(value + set... |
return content | return data | def validate(self, request, data): cookie_name = "vk_app_%s" % settings.VKONTAKTE_APPLICATION_ID try: content = request.COOKIES[cookie_name] cookie_data = self.parse_qs(content) value = "" for i in ('expire', 'mid', 'secret', 'sid'): value += "%s=%s" % (i, cookie_data[i][0] ) if cookie_data['sig'][0] == md5(value + set... |
request = Request( self.AUTHORIZE_URL, parameters = { | request = Request( url=self.AUTHORIZE_URL, parameters = { | def begin( self, request, data ): request = Request( self.AUTHORIZE_URL, parameters = { 'client_id' : self.APP_ID, 'redirect_uri' : request.build_absolute_uri(reverse('publicauth-complete', args=[self.provider])), }) raise Redirect(request.to_url()) |
if response[ 'status' ] != 200: | if response[ 'status' ] != '200': | def begin(self, request, data): """ Try to get Request Token from OAuth Provider and redirect user to provider's site for approval. """ # callback = request.build_absolute_uri(reverse('publicauth-complete', args=[self.provider])) url = self.__get_url( http_url=self.REQUEST_TOKEN_URL ) |
log.info(response) | def begin(self, request, data): """ Try to get Request Token from OAuth Provider and redirect user to provider's site for approval. """ # callback = request.build_absolute_uri(reverse('publicauth-complete', args=[self.provider])) url = self.__get_url( http_url=self.REQUEST_TOKEN_URL ) | |
if response[ 'status' ] != 200: | if response[ 'status' ] != '200': | def validate(self, request, data): try: parameters = dict( oauth_token = data['oauth_token'], oauth_verifier = data.get('oauth_verifier', None)) except MultiValueDictKeyError: messages.error(request, lang.BACKEND_ERROR) raise Redirect('publicauth-login') |
print pos, self.frame_size, self._analysis_params.sizeNextRead, len(audio) | def find_peaks(self, audio): """Find and return all spectral peaks in a given audio signal. If the signal contains more than 1 frame worth of audio, it will be broken up into separate frames, with a list of peaks returned for each frame.""" self.peaks = [] pos = 0 self._analysis_params.iSizeSound = len(audio) while pos... | |
__file__ + ":TestSimplSMS.test_residual_synthesis"] | __file__ + ":TestSimplSMS.test_harmonic_synthesis"] | def test_residual_synthesis(self): """test_residual_synthesis Compare pysms residual signal with SMS residual""" audio, sampling_rate = self.get_audio() pysms.sms_init() snd_header = pysms.SMS_SndHeader() # Try to open the input file to fill snd_header if(pysms.sms_openSF(self.input_file, snd_header)): raise NameError(... |
def test_peak_detection(self): """test_peak_detection Compare simplsms Peaks with SMS peaks. Exact peak information cannot be retrieved using libsms. Basic peak detection is performed by sms_detectPeaks, but this is called multiple times with different frame sizes by sms_analyze. This peak data cannot be returned from ... | def test_size_next_read(self): """test_size_next_read Make sure pysms PeakDetection is calculating the correct value for the size of the next frame.""" audio, sampling_rate = self.get_audio() | |
import debug debug.print_partials(sms_partials) print debug.print_partials(partials) | def test_partial_tracking(self): """test_partial_tracking Compare pysms Partials with SMS partials.""" audio, sampling_rate = self.get_audio() | |
self._analysis_params.iSamplingRate = self.sampling_rate | self._analysis_params.iSamplingRate = self._sampling_rate | def __init__(self): simpl.PeakDetection.__init__(self) simplsms.sms_init() # analysis parameters self._analysis_params = simplsms.SMS_AnalParams() simplsms.sms_initAnalParams(self._analysis_params) self._analysis_params.iSamplingRate = self.sampling_rate # set default hop and frame sizes to match those in the parent cl... |
print 'todo: change hop size to', hop_size | simplsms.sms_freeAnalysis(self._analysis_params) self._analysis_params.iFrameRate = self.sampling_rate / hop_size if simplsms.sms_initAnalysis(self._analysis_params) != 0: raise Exception("Error allocating memory for analysis_params") def get_max_peaks(self): return self._analysis_params.maxPeaks | def set_hop_size(self, hop_size): #self._analysis_params.iFrameRate = self.sampling_rate / hop_size #simplsms.sms_changeHopSize(hop_size, self._analysis_params) print 'todo: change hop size to', hop_size |
if max_peaks > simplsms.SMS_MAX_NPEAKS: print "Warning: max peaks (" + str(max_peaks) + ")", print "set to more than the maximum number of peaks possible in libsms." print " Setting to", simplsms.SMS_MAX_NPEAKS, "instead." max_peaks = simplsms.SMS_MAX_NPEAKS simplsms.sms_freeAnalysis(self._analysis_params) | def set_max_peaks(self, max_peaks): # TODO: compare to SMS_MAX_NPEAKS # also, if > current max_peaks, need to reallocate memory in # analysis_params self._max_peaks = max_peaks self._analysis_params.nTracks = max_peaks self._analysis_params.maxPeaks = max_peaks self._analysis_params.nGuides = max_peaks # TO... | |
if simplsms.sms_initAnalysis(self._analysis_params) != 0: raise Exception("Error allocating memory for analysis_params") simplsms.sms_freeSpectralPeaks(self._peaks) | def set_max_peaks(self, max_peaks): # TODO: compare to SMS_MAX_NPEAKS # also, if > current max_peaks, need to reallocate memory in # analysis_params self._max_peaks = max_peaks self._analysis_params.nTracks = max_peaks self._analysis_params.maxPeaks = max_peaks self._analysis_params.nGuides = max_peaks # TO... | |
self._sampling_rate = sampling_rate | def set_sampling_rate(self, sampling_rate): self._sampling_rate = sampling_rate # TODO: update analysis params framerate? self._analysis_params.iSamplingRate = sampling_rate | |
self.assertEquals(status, 0) | assert status == 0 | def test_size_next_read(self): """test_size_next_read Make sure pysms PeakDetection is calculating the correct value for the size of the next frame.""" audio, sampling_rate = self.get_audio() |
self.assertEquals(sms_next_read_sizes[current_frame], pd.frame_size) | assert sms_next_read_sizes[current_frame] == pd.frame_size | def test_size_next_read(self): """test_size_next_read Make sure pysms PeakDetection is calculating the correct value for the size of the next frame.""" audio, sampling_rate = self.get_audio() |
"""test_sms_analyzebt43lztar | """test_sms_analyze | def test_sms_analyze(self): """test_sms_analyzebt43lztar Make sure that the simplsms.sms_analyze function does the same thing as the sms_analyze function from libsms.""" audio, sampling_rate = self.get_audio() |
self.assertEquals(len(sms_partials), len(simplsms_partials)) | assert len(sms_partials) == len(simplsms_partials) | def test_sms_analyze(self): """test_sms_analyzebt43lztar Make sure that the simplsms.sms_analyze function does the same thing as the sms_analyze function from libsms.""" audio, sampling_rate = self.get_audio() |
self.assertEquals(sms_partials[i].get_length(), simplsms_partials[i].get_length()) | assert sms_partials[i].get_length() == simplsms_partials[i].get_length() | def test_sms_analyze(self): """test_sms_analyzebt43lztar Make sure that the simplsms.sms_analyze function does the same thing as the sms_analyze function from libsms.""" audio, sampling_rate = self.get_audio() |
self.assertAlmostEquals(sms_partials[i].peaks[peak_number].amplitude, simplsms_partials[i].peaks[peak_number].amplitude, places = self.FLOAT_PRECISION) self.assertAlmostEquals(sms_partials[i].peaks[peak_number].frequency, simplsms_partials[i].peaks[peak_number].frequency, places = self.FLOAT_PRECISION) self.assertAlmos... | assert_almost_equals(sms_partials[i].peaks[peak_number].amplitude, simplsms_partials[i].peaks[peak_number].amplitude, self.FLOAT_PRECISION) assert_almost_equals(sms_partials[i].peaks[peak_number].frequency, simplsms_partials[i].peaks[peak_number].frequency, self.FLOAT_PRECISION) assert_almost_equals(sms_partials[i].pea... | def test_sms_analyze(self): """test_sms_analyzebt43lztar Make sure that the simplsms.sms_analyze function does the same thing as the sms_analyze function from libsms.""" audio, sampling_rate = self.get_audio() |
self.assertEquals(status, 0) | assert status == 0 | def test_multi_sms_peak_detection(self): """test_multi_sms_peak_detection Test that running the same peak detection process twice in a row produces the same results each time. This makes sure that results are independent, and also helps to highlight any memory errors.""" audio, sampling_rate = self.get_audio() simplsms... |
self.assertEquals(status, 0) | assert status == 0 | def test_peak_detection(self): """test_peak_detection Compare simplsms Peaks with SMS peaks. Exact peak information cannot be retrieved using libsms. Basic peak detection is performed by sms_detectPeaks, but this is called multiple times with different frame sizes by sms_analyze. This peak data cannot be returned from ... |
self.assertEquals(len(sms_peaks), len(simpl_peaks)) | assert len(sms_peaks) == len(simpl_peaks) | def test_peak_detection(self): """test_peak_detection Compare simplsms Peaks with SMS peaks. Exact peak information cannot be retrieved using libsms. Basic peak detection is performed by sms_detectPeaks, but this is called multiple times with different frame sizes by sms_analyze. This peak data cannot be returned from ... |
self.assertEquals(len(sms_frame), len(simpl_frame)) | assert len(sms_frame) == len(simpl_frame) | def test_peak_detection(self): """test_peak_detection Compare simplsms Peaks with SMS peaks. Exact peak information cannot be retrieved using libsms. Basic peak detection is performed by sms_detectPeaks, but this is called multiple times with different frame sizes by sms_analyze. This peak data cannot be returned from ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.