rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
self._indxr_refined_distance = distance
indxr._indxr_refined_distance = distance
def _mosflm_refine_cell(self): '''Perform the refinement of the unit cell. This will populate all of the information needed to perform the integration.'''
print 'Collected from/to: %f %f' % s.getCollect()
print 'Epoch from/to: %d %d' % tuple(map(int, s.getCollect())) collect_time = map(time.ctime, s.getCollect()) print 'Collected from: %s' % collect_time[0] print ' to: %s' % collect_time[1]
def print_sweeps(): global known_sweeps sweeplists = known_sweeps.keys() sweeplists.sort() for sweep in sweeplists: sweeps = known_sweeps[sweep] # this should sort on exposure epoch ...? sweeps.sort() for s in sweeps: print 'Sweep: %s' % os.path.join(s.getDirectory(), s.getTemplate()) print 'Images: %d to %d' % (min...
poingroup = pl.get_pointgroup()
pointgroup = pl.get_pointgroup()
def _scale(self): '''Perform all of the operations required to deliver the scaled data.'''
name, energy, fp, fp = tuple(map(string.strip, o.split('|')[1:5]))
name, energy, fp, fpp = tuple(map(string.strip, o.split('|')[1:5]))
def scan(self): '''Run chooch.'''
'fpp':float(fp),
'fpp':float(fpp),
def scan(self): '''Run chooch.'''
reindex_op = pl.get_reindexing_operation()
reindex_op = pl.get_reindex_operator()
def _scale(self): '''Perform all of the operations required to deliver the scaled data.'''
raise RuntimeError, 'wavelength for sweep %s does not ' + \ 'match wavelength %s' % (name, wavelength.getName())
format = 'wavelength for sweep %s does not ' + \ 'match wavelength %s' raise RuntimeError, format % (name, wavelength.get_name())
def __init__(self, name, wavelength, directory = None, image = None, integrated_reflection_file = None, beam = None, distance = None, resolution = None, frames_to_process = None, epoch = 0): '''Create a new sweep named name, belonging to XWavelength object wavelength, representing the images in directory starting with ...
if beam: self._beam = beam self._keep_beam = beam else: self._keep_beam = None
self._beam = beam
def __init__(self, template, directory, id_image = None, beam = None):
if not self._keep_beam:
if not self._beam:
def update(self): '''Check to see if any more frames have appeared - if they have update myself and reset.'''
else: self._beam = self._keep_beam
def update(self): '''Check to see if any more frames have appeared - if they have update myself and reset.'''
'tI':79, 'hP':143, 'cP':195, 'cF':196, 'cI':197}
'tI':79, 'hP':143, 'hR':143, 'cP':195, 'cF':196, 'cI':197}
def do_funky(pdb_file_name): pdb, cell, symm = parse_pdb(pdb_file_name) if cell[0] * cell[1] * cell[2] < 100.0: # this is an unlikely unit cell... return print '----------- Analysing %s ----------' % pdb o = Othercell() o.set_cell(cell) o.set_lattice(symm[0].lower()) o.generate() lattices = o.get_possible_lattices...
'xiaindex.mat'), 'w')
'xiaindex-%s.mat' % lattice), 'w')
def _mosflm_refine_cell(self): '''Perform the refinement of the unit cell. This will populate all of the information needed to perform the integration.'''
self.input('matrix xiaindex.mat')
self.input('matrix xiaindex-%s.mat' % lattice)
def _mosflm_refine_cell(self): '''Perform the refinement of the unit cell. This will populate all of the information needed to perform the integration.'''
xds_inp.write('UNIT_CELL_CONSTANTS=%f %f %f %f %f %f' % \
xds_inp.write('UNIT_CELL_CONSTANTS=%6.2f %6.2f %6.2f %6.2f %6.2f %6.2f\n' % \
def run(self): '''Run idxref.'''
for j in range[6]:
for j in range(6):
def run(self): '''Run idxref.'''
self._substructure_finder.set_scaler(self._get_scaler())
self._substructure_finder.substructure_find_set_scaler( self._get_scaler())
def _get_substructure_finder(self): if self._substructure_finder is None: self._substructure_finder = SubstructureFinder()
self._substructure_finder.set_atom(atoms[0])
self._substructure_finder.substructure_find_set_atom(atoms[0])
def _get_substructure_finder(self): if self._substructure_finder is None: self._substructure_finder = SubstructureFinder()
self._substructure_finder.set_n_sites(info.get_number_total())
self._substructure_finder.substructure_find_set_n_sites( info.get_number_total())
def _get_substructure_finder(self): if self._substructure_finder is None: self._substructure_finder = SubstructureFinder()
self._substructure_finder.set_n_sites(
self._substructure_finder.substructure_find_set_n_sites(
def _get_substructure_finder(self): if self._substructure_finder is None: self._substructure_finder = SubstructureFinder()
self._substructure_finder.set_spacegroup(
self._substructure_finder.substructure_find_set_spacegroup(
def _get_substructure_finder(self): if self._substructure_finder is None: self._substructure_finder = SubstructureFinder()
self._substructure_finder.set_name(self._name)
self._substructure_finder.substructure_find_set_name(self._name)
def _get_substructure_finder(self): if self._substructure_finder is None: self._substructure_finder = SubstructureFinder()
header['phi_start'] == current_sweep['phi_end']:
((header['phi_start'] - current_sweep['phi_end']) % 360.0) < 0.01:
def headers2sweeps(header_dict): '''Parse a dictionary of headers to produce a list of summaries.''' images = header_dict.keys() images.sort() if len(images) == 0: return [] sweeps = [] current_sweep = header_dict[images[0]] current_sweep['images'] = [images[0]] current_sweep['collect_start'] = current_sweep['epoc...
result += ' %f' % value
result += ' %s' % value
def __repr__(self): result = 'Crystal: %s\n' % self._name if self._aa_sequence: result += 'Sequence: %s\n' % self._aa_sequence.get_sequence() for wavelength in self._wavelengths.keys(): result += str(self._wavelengths[wavelength])
template, directory = image2template_directory(sys.argv[index + 1])
image = sys.argv[index + 1] if image[-1] == '\\': try: image = '%s %s' % (sys.argv[index + 1][:-1], sys.argv[index + 2]) except: raise RuntimeError, 'image name ends in \\' template, directory = image2template_directory(image)
def _read_image(self): '''Read image information from the command line.'''
self._default_image = sys.argv[index + 1]
self._default_image = image
def _read_image(self): '''Read image information from the command line.'''
print solutions[k]
def _parse_mosflm_index_output(index_output_list): '''Parse the output text from autoindexing to build up a picture of the solutions.''' collect_solutions = False solutions = { } correct_number = 0 for i in range(len(index_output_list)): output = index_output_list[i] if 'No PENALTY SDCELL' in output: collect_solut...
lattice_to_spacegroup(self._indxr_lattice))
lattice_to_spacegroup[self._indxr_lattice])
def _index(self): '''Actually index the diffraction pattern. Note well that this is not going to compute the matrix...'''
result += 'Sequence: %s' % self._aa_sequence.get_sequence()
result += 'Sequence: %s\n' % self._aa_sequence.get_sequence()
def __repr__(self): result = 'Crystal: %s\n' % self._name if self._aa_sequence: result += 'Sequence: %s' % self._aa_sequence.get_sequence() for wavelength in self._wavelengths.keys(): result += str(self._wavelengths[wavelength])
result += 'Scaled & merged reflections: %s\n' % \ self.get_scaled_merged_reflections()
reflections = self.get_scaled_merged_reflections() if type(reflections) == type('string'): result += 'Scaled & merged reflections: %s\n' % \ reflections elif type(reflections) == type([]): for reflection_file in reflections: result += 'Scaled & merged reflections: %s\n' % \ reflection_file
def __repr__(self): result = 'Crystal: %s\n' % self._name if self._aa_sequence: result += 'Sequence: %s' % self._aa_sequence.get_sequence() for wavelength in self._wavelengths.keys(): result += str(self._wavelengths[wavelength])
if 'Refined mosaic spread (excluding)' in o:
if 'Refined mosaic spread (excluding safety factor)' in o:
def _mosflm_refine_cell(self): '''Perform the refinement of the unit cell. This will populate all of the information needed to perform the integration.'''
{'aP': 1, 'cF': 196, 'cI': 197, 'cP': 195, 'hP': 143, 'hR': 146, 'mC': 5, 'mP': 3, 'oA': 38, 'oC': 20, 'oF': 22, 'oI': 23, 'oP': 16, 'tI': 79, 'tP': 75} {'Ammm': 'oA', 'C2/m': 'mC', 'Cmmm': 'oC', 'Fm-3': 'cF', 'Fm-3m': 'cF', 'Fmmm': 'oF', 'H-3': 'hR', 'H-3m1': 'hR', 'I4/m': 'tI', 'I4/mmm': 'tI', 'Im-3': 'cI', 'Im-3m': ...
lattice_to_spacegroup = {'aP': 1, 'cF': 196, 'cI': 197, 'cP': 195, 'hP': 143, 'hR': 146, 'mC': 5, 'mP': 3, 'oA': 38, 'oC': 20, 'oF': 22, 'oI': 23, 'oP': 16, 'tI': 79, 'tP': 75} lauegroup_to_lattice = {'Ammm': 'oA', 'C2/m': 'mC', 'Cmmm': 'oC', 'Fm-3': 'cF', 'Fm-3m': 'cF', 'Fmmm': 'oF', 'H-3': 'hR', 'H-3m1': 'hR', 'I4/m...
def lauegroup_to_lattice(lauegroup): '''Convert a Laue group representation (from pointless, e.g. I m m m) to something useful, like the implied crystal lattice (in this case, oI.)''' # this has been calculated from the results of Ralf GK's sginfo and a # little fiddling...
residues = self._aa_sequence().get_sequence()
residues = self._aa_sequence.get_sequence()
def __repr__(self): result = 'Crystal: %s\n' % self._name if self._aa_sequence: result += 'Sequence: %s\n' % self._aa_sequence.get_sequence() for wavelength in self._wavelengths.keys(): result += str(self._wavelengths[wavelength])
hklout_dict[datasets[0]] = hklout
hklout_dict['only'] = hklout
def scale(self): '''Actually perform the scaling.'''
global_integration_parameters.set_parameters( crystal_id, self._integrater.get_integrater_export_parameters()) Chatter.write('Stored integration parameters for crystal %s' % \ crystal_id)
if self._integrater.get_integrater_export_parameters(): global_integration_parameters.set_parameters( crystal_id, self._integrater.get_integrater_export_parameters()) Chatter.write('Stored integration parameters' + \ ' for crystal %s' % crystal_id)
def get_integrater_reflections(self): reflections = self._get_integrater().get_integrater_reflections() # look to see if there are any global integration parameters # we can store...
def __init__(self):
def __init__(self, image = None):
def __init__(self):
if n_full > 0: n_full = 1 if n_partial > 0: n_partial = 1
def _refine_sd_parameters_remerge(self, scales_file, sdadd_f, sdb_f, sdadd_p, sdb_p): '''Actually compute the RMS deviation from scatter / sigma = 1.0 from the scales.''' epochs = self._sweep_information.keys() epochs.sort()
Admin.write('Deleted: %s' % f, forward = False)
out.write('Deleted: %s\n' % f)
def __del__(self): for f in self._temporary_files: try: os.remove(f) Admin.write('Deleted: %s' % f, forward = False) except: Admin.write('Failed to delete: %s' % f, forward = False)
Admin.write('Failed to delete: %s' % f, forward = False)
out.write('Failed to delete: %s\n' % f)
def __del__(self): for f in self._temporary_files: try: os.remove(f) Admin.write('Deleted: %s' % f, forward = False) except: Admin.write('Failed to delete: %s' % f, forward = False)
Admin.write('Output file (%s): %s' % f, forward = False)
out.write('Output file (%s): %s\n' % f)
def __del__(self): for f in self._temporary_files: try: os.remove(f) Admin.write('Deleted: %s' % f, forward = False) except: Admin.write('Failed to delete: %s' % f, forward = False)
self._indxr_cell = tuple(map(float, o.split()[-6:]))
indxr._indxr_cell = tuple(map(float, o.split()[-6:]))
def _mosflm_refine_cell(self): '''Perform the refinement of the unit cell. This will populate all of the information needed to perform the integration.'''
self._indxr_mosaic = float(o.split()[-1])
indxr._indxr_mosaic = float(o.split()[-1])
def _mosflm_refine_cell(self): '''Perform the refinement of the unit cell. This will populate all of the information needed to perform the integration.'''
if self._lattice_to_lauegroup = { }:
if self._lattice_to_lauegroup == { }:
def set_correct_lattice(self, lattice): '''In a rerunning situation, set the correct lattice, which will assert a correct lauegroup based on the previous run of the program...'''
self._beam = beam()
self._beam = beam
def __init__(self, template, directory, id_image = None, beam = None):
79: 'tI', 197: 'cI', 89: 'tP', 97: 'tI'
79: 'tI', 197: 'cI', 89: 'tP', 97: 'tI',
def lauegroup_to_lattice(lauegroup): '''Convert a Laue group representation (from pointless, e.g. I m m m) to something useful, like the implied crystal lattice (in this case, oI.)''' # parse syminfo, symop -> generate mapping table current_spacegroup = 0 lauegroup_info = {0:{ }} for record in open(os.path.join(os.e...
Chatter.write('Testing SdAdd %4.2f: %4.2f %4.2f' % \
Chatter.write('Tested SdAdd %4.2f: %4.2f %4.2f' % \
def _refine_sd_parameters(self, scales_file): '''To some repeated merging (it is assumed that the data have already ben scaled) to determine appropriate values of sd_add, sd_fac, sd_b for fulls, partials. FIXME at some point this should probably be for each run as well...'''
Chatter.write('Testing SdB %4.1f: %4.2f %4.2f' % \
Chatter.write('Tested SdB %4.1f: %4.2f %4.2f' % \
def _refine_sd_parameters(self, scales_file): '''To some repeated merging (it is assumed that the data have already ben scaled) to determine appropriate values of sd_add, sd_fac, sd_b for fulls, partials. FIXME at some point this should probably be for each run as well...'''
ls = LabelitScreen() ls.addImage(s.imagename(i)) ls.setBeam(beam[0], beam[1]) ls.setRefine_beam(False) ls.index()
try:
def xia2scan(): '''Do the scan.''' template, directory = CommandLine.getTemplate(), \ CommandLine.getDirectory() if not template or not directory: raise RuntimeError, 'no image information supplied' # if this isnot set, then we will presume that it is correct # in the image headers beam = CommandLine.getBeam() swe...
solution = ls.getSolutions()[1] lsd = LabelitStats_distl() lsd.stats_distl() stats = lsd.getStatistics(s.imagename(i)) summary_info[i] = { } summary_info[i]['volume'] = solution['volume'] summary_info[i]['mosaic'] = solution['mosaic'] summary_info[i]['spots_good'] = stats['spots_good'] summary_info[i]['spots_total'] =...
ls = LabelitScreen() ls.addImage(s.imagename(i)) ls.setBeam(beam[0], beam[1]) ls.setRefine_beam(False) ls.index() solution = ls.getSolutions()[1] lsd = LabelitStats_distl() lsd.stats_distl() stats = lsd.getStatistics(s.imagename(i)) summary_info[i] = { } summary_info[i]['volume'] = solution['volume'] summary_info[i][...
def xia2scan(): '''Do the scan.''' template, directory = CommandLine.getTemplate(), \ CommandLine.getDirectory() if not template or not directory: raise RuntimeError, 'no image information supplied' # if this isnot set, then we will presume that it is correct # in the image headers beam = CommandLine.getBeam() swe...
Science.write('Negative mosaic spread (%5.2)' % mosaic)
Science.write('Negative mosaic spread (%5.2f)' % mosaic)
def _mosflm_refine_cell(self): '''Perform the refinement of the unit cell. This will populate all of the information needed to perform the integration.'''
standard_deviation_info = { } for key in loggraph.keys(): if 'standard deviation v. Intensity' in key: dataset = key.split(',')[-1].strip() standard_deviation_info[dataset] = transpose_loggraph( loggraph[key]) for dataset in standard_deviation_info.keys(): info = standard_deviation_info[dataset] for j in range(...
def _scale(self): '''Perform all of the operations required to deliver the scaled data.'''
scales_file = os.path.join(self.get_working_directory(), '%s.scales' % self._common_xname)
def _scale(self): '''Perform all of the operations required to deliver the scaled data.'''
cell_ref_images.append((images[0], images[min_images]))
cell_ref_images.append((images[0], images[min_images - 1]))
def _mosflm_refine_cell(self): '''Perform the refinement of the unit cell. This will populate all of the information needed to perform the integration.'''
datasets.append(run[4])
if not run[4] in datasets: datasets.append(run[4])
def scale(self): '''Actually perform the scaling.'''
self._integrater.set_integrate_indexer(self.getIndexer())
self._integrater.set_integrater_indexer(self._get_indexer())
def _get_integrater(self): '''Get my integrater, and if it is not set, create one.'''
directory = os.path.join(os.environ['DPA_ROOT'], 'Data', 'Test', 'Images')
directory = os.path.join('z:', 'data', '12287')
def get_crystal_lattice(self): '''Get the parent crystal lattice pointer.''' try: latitce = self.get_wavelength().get_crystal().get_lattice() except: lattice = None
print xs.get_indexer_lattice() print xs.get_indexer_cell()
def get_crystal_lattice(self): '''Get the parent crystal lattice pointer.''' try: latitce = self.get_wavelength().get_crystal().get_lattice() except: lattice = None
if correct_r / r_merge > 1.5 and delta > 0.1:
if correct_r / r_merge > 1.5 and \ correct_delta > 0.1:
def decide_pointgroup(self): '''Decide on the correct pointgroup for hklin.'''
pointgroup = False
pointgroup = True
def get_confidence(self): return self._confidence
spacegroups = self._get_scaler().get_likely_spacegroups()
spacegroups = self._get_scaler().get_scaler_likely_spacegroups()
def __repr__(self): result = 'Crystal: %s\n' % self._name if self._aa_sequence: result += 'Sequence: %s\n' % self._aa_sequence.get_sequence() for wavelength in self._wavelengths.keys(): result += str(self._wavelengths[wavelength])
self.setExecutable('pointless-1.0.6')
self.setExecutable('pointless-1.0.8')
def __init__(self): # generic things CCP4DriverInstance.__class__.__init__(self) self.setExecutable('pointless-1.0.6')
return self._pointgroup
return self._spacegroup
def getPointgroup(self): return self._pointgroup
self._parameter_dict[crystal] = parameters
self._parameter_dict[crystal] = copy.deepcopy(parameters)
def set_parameters(self, crystal, parameters): self._parameter_dict[crystal] = parameters
return self._parameter_dict.get(crystal, { })
return copy.deepcopy(self._parameter_dict.get(crystal, { }))
def get_parameters(self, crystal): return self._parameter_dict.get(crystal, { })
if self._template and self._directory:
if self._fp_template and self._fp_directory:
def setup_from_image(self, image): if self._template and self._directory: raise RuntimeError, 'FrameProcessor implementation already set up' self._setup_from_image(image)
('marccd', 3072, 73):'mar 300'}
('marccd', 3072, 73):'mar 225'}
def check(self, image): return self._headers.has_key(image)
pattern_keys = [r'(.*)_([0-9]*)\.(.*)', r'([^\.]*)\.([0-9]+)',
pattern_keys = [r'([^\.]*)\.([0-9]+)', r'(.*)_([0-9]*)\.(.*)',
def image2template(filename): '''Return a template to match this filename.''' # check that the file name doesn't contain anything mysterious if filename.count('#'): raise RuntimeError, '# characters in filename' # the patterns in the order I want to test them pattern_keys = [r'(.*)_([0-9]*)\.(.*)', r'([^\.]*)\.([0-9...
patterns = {r'(.*)_([0-9]*)\.(.*)':'%s_%s.%s', r'([^\.]*)\.([0-9]+)':'%s.%s%s',
patterns = {r'([^\.]*)\.([0-9]+)':'%s.%s%s', r'(.*)_([0-9]*)\.(.*)':'%s_%s.%s',
def image2template(filename): '''Return a template to match this filename.''' # check that the file name doesn't contain anything mysterious if filename.count('#'): raise RuntimeError, '# characters in filename' # the patterns in the order I want to test them pattern_keys = [r'(.*)_([0-9]*)\.(.*)', r'([^\.]*)\.([0-9...
pattern_keys = [r'(.*)_([0-9]*)\.(.*)', r'([^\.]*)\.([0-9]+)',
pattern_keys = [r'([^\.]*)\.([0-9]+)', r'(.*)_([0-9]*)\.(.*)',
def image2image(filename): '''Return an integer for the template to match this filename.''' # check that the file name doesn't contain anything mysterious if filename.count('#'): raise RuntimeError, '# characters in filename' # the patterns in the order I want to test them pattern_keys = [r'(.*)_([0-9]*)\.(.*)', r'(...
patterns = {r'(.*)_([0-9]*)\.(.*)':'%s_%s.%s', r'([^\.]*)\.([0-9]+)':'%s.%s%s',
patterns = {r'([^\.]*)\.([0-9]+)':'%s.%s%s', r'(.*)_([0-9]*)\.(.*)':'%s_%s.%s',
def image2image(filename): '''Return an integer for the template to match this filename.''' # check that the file name doesn't contain anything mysterious if filename.count('#'): raise RuntimeError, '# characters in filename' # the patterns in the order I want to test them pattern_keys = [r'(.*)_([0-9]*)\.(.*)', r'(...
correct_number = int(output.split()[-2])
correct_number = int(output.split()[2])
def _parse_mosflm_index_output(index_output_list): '''Parse the output text from autoindexing to build up a picture of the solutions.''' collect_solutions = False solutions = { } correct_number = 0 for i in range(len(index_output_list)): output = index_output_list[i] if 'No PENALTY SDCELL' in output: collect_solut...
('marccd', 3072, 73):'mar 225'}
('marccd', 3072, 73):'mar 225', ('mar', 2300, 150):'mar 345'}
def check(self, image): return self._headers.has_key(image)
'pixel':0.001}}
'pixel':0.001}, 'mar':{'wavelength':1.0, 'pixel':1.0}}
def readheader(self): '''Read the image header.'''
if 'Image size' in o:
if 'Image Size' in o:
def readheader(self): '''Read the image header.''' # if we have the results already then don't bother # with the program if self._header: return copy.deepcopy(self._header)
if 'Pixel size' in o:
if 'Pixel Size' in o:
def readheader(self): '''Read the image header.''' # if we have the results already then don't bother # with the program if self._header: return copy.deepcopy(self._header)
shelxc.set_n_sites(self._n_sites)
shelxc.set_n_sites(self._ssfnd_n_sites)
def _shelxc_prepare_data(self): '''Use shelxc to prepare the data (now we know we have it...'''
except: Admin.write('No shelxc!')
except exceptions.Exception, e: Admin.write('No shelxc? %s' % str(e))
def _substructure_find_prepare(self): '''Prepare the data for site location using shelxc.'''
labin_command += ' E%d=%s_%s' % \
labout_command += ' E%d=%s_%s' % \
def update(self): '''Update the information for one reflection file.'''
def flow( self, text ):
def flow( self, text, debug=False ):
def flow( self, text ): """This is the real workhorse function, The parameter text contains the text to be flowed""" if not isinstance( text, str ): raise TypeError( "Parameter to flow must be of type string" ) return self.wrap(self.unwrap(text, debug), debug)
"then crlf convention)\n" + "\n>Another quoted test using the greater than sign \n" +
"then crlf convention)\n\n" + ">Another quoted test using the greater than sign \n" +
def testUnwrapAll( self ): flow = flowtext.FormatText() testText = ( "This line spans a few \n" + "lines and has a couple of soft \n" + "breaks in it. It also has a very, very long line which spans a little " + "too long and therefore needs to be well wrapped.\n" + "\nAfter which there is a new paragraph. This new para...
" And now an indented (therefore quoted) section" + " which also spans a few lines, with soft line breaks (using the space " + "then crlf convention)\n" + "\n>Another quoted test using the greater than sign " +
" And now an indented (therefore quoted) section " + "which also spans a few lines, with soft line breaks (using the space " + "then crlf convention)\n\n" + ">Another quoted test using the greater than sign " +
def testUnwrapAll( self ): flow = flowtext.FormatText() testText = ( "This line spans a few \n" + "lines and has a couple of soft \n" + "breaks in it. It also has a very, very long line which spans a little " + "too long and therefore needs to be well wrapped.\n" + "\nAfter which there is a new paragraph. This new para...
def testUnwrapQuotedWithSpace( self ): flow = flowtext.FormatText() testText = ( " This line is \n" + " quoted and has a couple of soft \n" + " breaks in it." ) expectedText = ( " This line is " + "quoted and has a couple of soft " + "breaks in it." ) debug = False if(debug): print "\n---------------------------\ninput...
def testUnwrapTwoParagraphs( self ): flow = flowtext.FormatText() testText = ( "This line spans a few \n" + "lines and has a couple of soft \n" + "breaks in it.\n\n" + "and sneakily has a second \n" + "paragraph" ) expectedText = ( "This line spans a few " + "lines and has a couple of soft " + "breaks in it.\n\n" + "an...
self.assertEqual( expectedText, flow.unwrap( testText ) ) def testUnwrapTwoSpaceQuotedLines( self ): flow = flowtext.FormatText() testText = ( " This line is \n" + " quoted and has a couple of soft \n" + " breaks in it.\n\n" + " This line is also \n" + " quoted" ) expectedText = ( " This line is " + "quoted and has a ...
def testUnwrapTwoGTQuotedLines( self ): flow = flowtext.FormatText() testText = ( ">This line is \n" + ">quoted and has a couple of soft \n" + ">breaks in it.\n\n" + ">This line is also \n" + ">quoted" ) expectedText = ( ">This line is " + "quoted and has a couple of soft " + "breaks in it.\n\n" + ">This line is also "...
" And now an indented (therefore quoted) section \n"
" And now an indented (therefore space stuffed) section \n"
def testUnwrapAll( self ): flow = flowtext.FormatText() testText = ( "This line spans a few \n" "lines and has a couple of soft \n" "breaks in it. It also has a very, very long line which spans a little " "too long and therefore needs to be well wrapped.\n" "\nAfter which there is a new paragraph. This new paragraph ha...
" And now an indented (therefore quoted) section "
" And now an indented (therefore space stuffed) section "
def testUnwrapAll( self ): flow = flowtext.FormatText() testText = ( "This line spans a few \n" "lines and has a couple of soft \n" "breaks in it. It also has a very, very long line which spans a little " "too long and therefore needs to be well wrapped.\n" "\nAfter which there is a new paragraph. This new paragraph ha...
for label, attrs in re.findall(r'([^[\n\t]+?)\s+\[((?:[^\]]|"(?:[^"]|\\.)*?")*?)\]', s):
for label, attrs in re.findall(r'([^[\n\t]+?)\s+\[((?:[^"\]]|"(?:[^"]|\\.)*?")*?)\]', s):
def parseDot(s): import re nodes = {} edges = [] defaults = {} # look greedy inside [] for label, attrs in re.findall(r'([^[\n\t]+?)\s+\[((?:[^\]]|"(?:[^"]|\\.)*?")*?)\]', s): h = {} for k, v1, v2 in re.findall(r'([^=,\s]+)=(?:"((?:[^"\\]|\\.)*?)"|([^,""]*))', attrs): v = v1 or v2 if k == 'pos' and v.startswith('e'): a...
if string.find(greetline, "Netscape IMAP4rev1 Service 3.6") > 0: warnings = warnings + """ This server violates the RFC2060 requirement that a BODY[TEXT] fetch should set the messages's Seen flag. As a result, if you use the keep option the same messages will be downloaded over and over. """
def autoprobe(self):
5. A polling interval. 6. Options to fetch old messages as well as new, uor to suppress
5. A poll interval in seconds. If 0, fetchmail will run in the foreground once when started. If > 0, fetchmail will run in the background and start a new poll cycle after the interval has elapsed. 6. Options to fetch old messages as well as new, or to suppress
def fetch(self, widgetclass, field):
if string.find(self.mailname, "@") > -1:
if self.mailname.find("@") > -1:
def testmail(self, n=None): "Send test mail to the site." server = smtplib.SMTP("localhost") fromaddr = "esr@thyrsus.com" if string.find(self.mailname, "@") > -1: toaddr = self.mailname else: toaddr = "%s@%s" % (self.mailname, self.host) msg = ("From: %s\r\nTo: %s\r\n\r\n" % (fromaddr, toaddr)) if n != None: msg += `n`...
self.fastuidl = 10
self.fastuidl = 4
def __init__(self):
child_stdout = os.popen(command + " 2>&1", "r")
child_stdout = os.popen(command + " 2>&1 </dev/null", "r")
def __init__(self, command, master, parent):
RunWindow("fetchmail -d0 -v --nosyslog", Toplevel(), self)
cmd = "fetchmail -N -d0 --nosyslog -v" if rcfile: cmd = cmd + " -f " + rcfile RunWindow(cmd, Toplevel(), self)
def test(self):
RunWindow("fetchmail -d0", Toplevel(), self)
cmd = "fetchmail -N -d0" if rcfile: cmd = cmd + " -f " + rcfile RunWindow(cmd, Toplevel(), self)
def run(self):
cmd = "umask 077 && fetchmail -f " + rcfile + " --configdump --nosyslog >" + tmpfile
cmd = "umask 077 && fetchmail </dev/null -f " + rcfile + " --configdump --nosyslog >" + tmpfile
def copy_instance(toclass, fromdict):
cmd = "umask 077 && fetchmail --configdump --nosyslog >" + tmpfile
cmd = "umask 077 && fetchmail </dev/null --configdump --nosyslog >" + tmpfile
def copy_instance(toclass, fromdict):
self.label47 = gtk.Label(_("Abort User's Uploads(s)"))
self.label47 = gtk.Label(_("Abort User's Upload(s)"))
def __init__(self, create = True, accel_group = None): if accel_group is None: self.accel_group = gtk.AccelGroup() else: self.accel_group = accel_group if create: self.MainWindow = gtk.Window(gtk.WINDOW_TOPLEVEL) self.MainWindow.set_default_size(800, 600) self.MainWindow.set_title(_("Nicotine")) self.MainWindow.set_pos...
if win32:
if sys.platform == "win32":
def UserInfoRequest(self, msg):
homedir = pwd.getpwuid(os.getuid())[5]
if win32: place = "Windows" homedir = "C:\windows" else: place = "Home" homedir = pwd.getpwuid(os.getuid())[5]
def SetSettings(self, config): transfers = config["transfers"] homedir = pwd.getpwuid(os.getuid())[5] if transfers["incompletedir"] is not None: self.IncompleteDir.set_text(recode(transfers["incompletedir"])) if transfers["downloaddir"] is not None: self.DownloadDir.set_text(recode(transfers["downloaddir"])) if transfe...
popupWarning(None, "Warning","Security Risk: you should not share your home directory!")
popupWarning(None, "Warning","Security Risk: you should not share your %s directory!" %place)
def SetSettings(self, config): transfers = config["transfers"] homedir = pwd.getpwuid(os.getuid())[5] if transfers["incompletedir"] is not None: self.IncompleteDir.set_text(recode(transfers["incompletedir"])) if transfers["downloaddir"] is not None: self.DownloadDir.set_text(recode(transfers["downloaddir"])) if transfe...
print self.UploadButtons
def UpdateTransferButtons(self): if self.np.config.sections["transfers"]["enabletransferbuttons"]: self.DownloadButtons.show() self.UploadButtons.show() else: print self.UploadButtons self.UploadButtons.hide() self.DownloadButtons.hide()
self.ChatTabLabel.set_image(status == 1 and self.images["hilite"] or self.images["hilite"])
self.ChatTabLabel.set_image(status == 1 and self.images["hilite"] or self.images["online"])
def ChatRequestIcon(self, status = 0): if status == 1 and not self.got_focus: self.MainWindow.set_icon(self.images["hilite2"]) if self.notebook1.get_current_page() == 0: return if status == 0: if self.ChatTabLabel.get_image() == self.images["hilite"]: return self.ChatTabLabel.set_image(status == 1 and self.images["hili...