rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
@param source: source PDB file or pickled PDBModel or PDBModel object | @param source: PDBModel object | def update( self, model, source, skipRes=None, lookHarder=0 ): """ Update empty or missing fields of model from the source. The model will be connected to the source via model.source. Override! @param model: existing model @type model: PDBModel @param source: source PDB file or pickled PDBModel or PDBModel object @typ... |
model.setAtoms( model.atoms or s.getAtoms() ) | model.atoms = model.atoms or s.getAtoms() | def update( self, model, source, skipRes=None, lookHarder=0 ): """ Update empty or missing fields of model from the source. The model will be connected to the source via model.source. Override! @param model: existing model @type model: PDBModel @param source: source PDB file or pickled PDBModel or PDBModel object @typ... |
model.setXyz( model.xyz or s.getXyz() ) | model.xyz = model.xyz or s.getXyz() | def update( self, model, source, skipRes=None, lookHarder=0 ): """ Update empty or missing fields of model from the source. The model will be connected to the source via model.source. Override! @param model: existing model @type model: PDBModel @param source: source PDB file or pickled PDBModel or PDBModel object @typ... |
raise FastSurf_Error, 'Cannot find SurfaceRacer directory. Set your path in ~/.biskit/settings.dat as surfaceracer_bin' | raise SurfaceRacer_Error, 'Cannot find SurfaceRacer directory. Set your path in ~/.biskit/settings.dat as surfaceracer_bin' | def __init__( self, model, probe, vdw_set=1, mode=3, **kw ): """ SurfaceRacer creates three output files:: result.txt - contains breakdown of surface areas and is writen to the directory where the program resides. This file is discharded here. file *.txt - contains the accessible, molecular surface areas and average cu... |
Parse the SurfaceRacer output file which has the same mane as the input pdb, but with a txt extension. The output ends up un the same folser | Parse the SurfaceRacer output file which has the same nawe as the input pdb, but with a txt extension. The output ends up un the same folder | def parse_result( self, output ): """ Parse the SurfaceRacer output file which has the same mane as the input pdb, but with a txt extension. The output ends up un the same folser as the input. In addition a file called result.txt is created in the same directory as the binary. @param output: full path to input pdb-fil... |
lines = open( self.f_out_name ).readlines() | out_file = open( self.f_out_name ) lines = out_file.readlines() out_file.close() | def parse_result( self, output ): """ Parse the SurfaceRacer output file which has the same mane as the input pdb, but with a txt extension. The output ends up un the same folser as the input. In addition a file called result.txt is created in the same directory as the binary. @param output: full path to input pdb-fil... |
if m.profile('relASA', 0) != 0: | if m.profile('relAS', 0) != 0: | def __addSurface( self, m ): """ Add surface area to model. |
d.addASA() | d.addSurfaceRacer() | def __addSurface( self, m ): """ Add surface area to model. |
return MU.standardDeviation(centropy) | return MU.SD(centropy) | def entropySD(self): centropy = N.sum(-N.log(self.msm)*\ self.msm)/float(self.n_cluster) return MU.standardDeviation(centropy) |
sd = MU.standardDeviation(self.msm) | sd = MU.SD(self.msm) | def standardDeviation(self): sd = MU.standardDeviation(self.msm) return sd |
@param asarray: option, convert to array @type asarray: 1|0 | @param asarray: 1.. autodetect type, 0.. force list, 2.. force array @type asarray: 2|1|0 | def __array_or_list( self, prof, asarray ): """ Convert to array or list depending on asarray option |
self.xyzChanged = 0 self.atomsChanged = 0 self.forcePickle = 0 self.initVersion = self.version() self.info = { 'date':t.dateSortString() } | def __init__( self, source=None, pdbCode=None, noxyz=0, skipRes=None ): """ - PDBModel() creates an empty Model to which coordinates (field xyz) and PDB infos (field atoms) have still to be added. - PDBModel( file_name ) creates a complete model with coordinates and PDB infos taken from file_name (pdb, pdb.gz, pickled ... | |
kw[ k ] = T.toList( kw[ k ] ) | kw[ k ] = t.toList( kw[ k ] ) | def filterIndex( self, mode=0, **kw ): """ Get atom positions that match a combination of key=values. E.g. filter( chain_id='A', name=['CA','CB'] ) -> PDBModel @param mode: 0 combine with AND (default), 1 combine with OR @type mode: 0||1 @param kw: combination of atom dictionary keys and values/list of values that wi... |
HINT: If you want to instect the alignment used for modeling: | HINT: If you want to inspect the alignment used for modeling: | def _use(): print """ |
EHandler.warning("Cannot read/update profiles from source: %r"\ | B.EHandler.warning("Cannot read/update profiles from source: %r"\ | def update( self, model, source, skipRes=None, lookHarder=0 ): """ Update empty or missing fields of model from the source. The model will be connected to the source via model.source. Override! @param model: existing model @type model: PDBModel @param source: PDBModel object @type source: str | file | PDBModel @param... |
r = take( r, range( 0, len( r ), step ) ).tolist() | r = N.take( r, range( 0, len( r ), step ) ).tolist() | def memberIndices( self, member, step=1 ): """ List of frame indices for this member:: memberIndices( int_member, [int_step] ) |
folders = os.listdir(validation_folder) | folders = self.__listDir(validation_folder) | def global_rmsd_aa(self, validation_folder= None): """ Global RMSD values. @param validation_folder: folder vith validation data (defult: None S{->} outFolder/L{F_TEMPLATE_FOLDER}) @type validation_folder: str |
folders = os.listdir(validation_folder) | folders = self.__listDir(validation_folder) | def global_rmsd_ca(self, validation_folder= None): """ Global RMSD CA values. @param validation_folder: folder vith validation data (defult: None S{->} outFolder/L{F_TEMPLATE_FOLDER}) @type validation_folder: str |
folders = os.listdir(validation_folder) | folders = self.__listDir(validation_folder) | def get_identities(self, nb_templates, validation_folder = None): """ Calculate the mean of the percentage of identities for each template with the others. @param nb_templates: number of templates used in the cross-validation @type nb_templates: int @param validation_folder: folder vith validation data (defult: None ... |
folders = os.listdir(validation_folder) | folders = self.__listDir(validation_folder) | def get_score(self, validation_folder = None): """ Get the best global modeller score for each template re-modeled |
templates = os.listdir(template_folder) | templates = self.__listDir(template_folder) | def go(self, output_folder = None, template_folder = None): """ Run analysis of models. |
host=None, **kw ): | host=None, verbose=1, **kw ): | def __init__( self, cmd, owner, finp=None, log=0, host=None, **kw ): """ @param cmd: command to execute @type cmd: str @param owner: Docker job to run to run @type owner: Docker instance @param finp: hex macro file (default: None) @type finp: str @param log: write log file (default: 0) @type log: 1|0 @param host: h... |
matrix = Numeric.array(matrix, N.Float32) | matrix = Numeric.array(matrix, Numeric.Float32) | def nextComplex(self): """ Take list of lines, extract all Hex info about one complex (Solution number, hex energy,..) also extract 16 numbers of the transformation matrix and put them into 4 by 4 numeric array. @return: Complex created from the output from Hex @rtype: Complex """ ## get set of lines describing next c... |
def __settings2dict( self ): | def settings2dict( self ): | def __settings2dict( self ): """ Create dictionary from settings. @return: dictionary of parameter names (keys) and values @rtype: dict {str : any} """ return dict( [ (s.name, s.value) for s in self.settings.values() ] ) |
d = self.__settings2dict() | d = self.settings2dict() | def updateNamespace( self, ns ): """ 1. Parse in default configuration and user configuration file 2. Merge the two, preferring valid user settings 3. Create missing user configuration file if createmissing=True 4. Insert parameters into the given namespace |
return testparam | r = m.settings2dict()['testparam'] return r | def run( self, local=0 ): """ run function test @param local: transfer local variables to global and perform other tasks only when run locally @type local: 1|0 |
assert test.run( ) == test.expected_result() | assert test.run( local=1 ) == test.expected_result() | def expected_result( self ): """ Precalculated result to check for consistent performance. |
verb - int, verbosity level | v - int, verbosity level | def _use(): print """ Run unittest tests for biskit. log - str, path to logfile that will be written verb - int, verbosity level tests - [str], list of the test suits to be run, one or more of:: biskit - most Biskit modules biskit_app - Biskit modules calling external applications biskit_pvm - Bisk... |
verb = T.toInt( o['verb'] ) | verb = T.toInt( o['v'] ) | def report( file ): """ Parses the log file and collects some data. @param file: log-file path @type file: str @return: the log, list of failed tests, number of tests and number of passed tests @rtype: [str], [str], int, int """ r = open(file,'r') test_result = r.readlines() r.close() ## full log message full_log =... |
print 'A total of %i tests were run.'%passed | print 'A total of %i tests were run.' % (passed + len(failed) ) | def report( file ): """ Parses the log file and collects some data. @param file: log-file path @type file: str @return: the log, list of failed tests, number of tests and number of passed tests @rtype: [str], [str], int, int """ r = open(file,'r') test_result = r.readlines() r.close() ## full log message full_log =... |
l = f.split() m = l[1].strip('()').split('.')[-1] doc_str = vars()['Test'].__dict__[m].__dict__[l[0]].__doc__ module = re.findall( 'L\{(Biskit[A-Za-z\._\s]*)\}', doc_str.strip() ) print ' - test in module %s failed'%module[0] | try: l = f.split() m = l[1].strip('()').split('.')[-1] doc_str = vars()['Test'].__dict__[m].__dict__[l[0]].__doc__ module = re.findall( 'L\{(Biskit[A-Za-z\._\s0-9]*)\}', doc_str.strip() ) print ' - test in module %s failed'%module[0] except IndexError, error: EHandler.warning('cannot extract module name from... | def report( file ): """ Parses the log file and collects some data. @param file: log-file path @type file: str @return: the log, list of failed tests, number of tests and number of passed tests @rtype: [str], [str], int, int """ r = open(file,'r') test_result = r.readlines() r.close() ## full log message full_log =... |
return None | return [] | def getHosts( section, option ): """ Strip comment from setting (separator #) Split list (separator 'space') """ if conf.has_option( section, option ): setting = conf.get( section, option ) setting = S.split( setting, '#' ) hosts = [] for host in S.split( setting[0], ' ' ): if len(host) != 0: hosts += [ S.strip(host) ]... |
if len(sys.argv) < 4: _use() | def test(): options = defOptions() dir = testRoot() + '/dock/' options['lig'] = dir + 'lig/1A19_model.dic' options['rec'] = dir + 'rec/1A2P_model.dic' options['hex'] = dir + 'hex/1A2P-1A19_hex.out' options['o'] = dir + 'hex/complexes.cl' options['p'] = 1 return options | |
options = test() | options = cmdDict( defOptions() ) | def test(): options = defOptions() dir = testRoot() + '/dock/' options['lig'] = dir + 'lig/1A19_model.dic' options['rec'] = dir + 'rec/1A2P_model.dic' options['hex'] = dir + 'hex/1A2P-1A19_hex.out' options['o'] = dir + 'hex/complexes.cl' options['p'] = 1 return options |
@todo: clean up, re-organize parsing | def version( self ): return ProfileCollection.version(self) + '; PDBModel $Revision$' | |
@todo: use Profiles instead of space consuming atom dictionaries ? | @todo: use Profiles instead of space consuming atom dictionaries | def version( self ): return ProfileCollection.version(self) + '; PDBModel $Revision$' |
f = PDBFile( fname, mode='w' ) | f = IO.PDBFile( fname, mode='w' ) | def writePdb( self, fname, ter=1, amber=0, original=0, left=0, wrap=0, headlines=None, taillines=None): """ Save model as PDB file. |
Cereate a map of residue residue for atoms in model. | Create a map of residue residue for atoms in model. | def __calcResMap( self, mask=None ): """ Cereate a map of residue residue for atoms in model. |
""" | """ for m in pdb_list: m.disconnect() | def write_PDBModels(self, pdb_list, model_folder = None): """ Dump the list of PDBModels. @param pdb_list: list of models @type pdb_list: ModelList @param model_folder: ouput folder (default: None -> L{F_PDBModels}) @type model_folder: str """ T.Dump(pdb_list, '%s'%(model_folder + self.F_PDBModels)) |
import tempfile, time | import tempfile, time, os | def run( self, run=0 ): """ run function test |
lines = open( self.f_out_name ).readlines() | try: lines = open( self.f_out_name ).readlines() except: raise SurfaceRacer_Error,\ 'SurfaceRacer result file %s does not exist. You have probably encountered a very rare SurfaceRacer round off error that have caused the program to terminate. The simplest remedy to this problem is to increase the probe radii with a ver... | def parse_result( self, output ): """ Parse the SurfaceRacer output file which has the same mane as the input pdb, but with a txt extension. The output ends up un the same folser as the input. In addition a file called result.txt is created in the same directory as the binary. @param output: full path to input pdb-fil... |
if self.probe == 1.4: | if round(self.probe, 1) == 1.4 and self.vdw_set == 1: | def finish( self ): """ Overrides Executor method """ Executor.finish( self ) self.result = self.parse_result( self.output ) if self.probe == 1.4: self.__relExposure('MS') self.__relExposure('AS') else: print "No relative accessabilities calculated when using other prob radius then 1.4 A" |
print "No relative accessabilities calculated when using other prob radius then 1.4 A" | T.flushPrint("\nNo relative accessabilities calculated when using a prob radius other than 1.4 A or not using the Richards vdw radii set.") def failed( self ): """ Called if external program failed, Overrides Executor method. In some very rare cases SurfaceRacer round off error cause the program to terminate. The si... | def finish( self ): """ Overrides Executor method """ Executor.finish( self ) self.result = self.parse_result( self.output ) if self.probe == 1.4: self.__relExposure('MS') self.__relExposure('AS') else: print "No relative accessabilities calculated when using other prob radius then 1.4 A" |
print "Starting SurfaceRAcer" x = SurfaceRacer( m, 1.4, vdw_set=2, debug=1, verbose=1 ) | print "Starting SurfaceRacer" x = SurfaceRacer( m, 1.4, vdw_set=1, debug=1, verbose=1 ) | def finish( self ): """ Overrides Executor method """ Executor.finish( self ) self.result = self.parse_result( self.output ) if self.probe == 1.4: self.__relExposure('MS') self.__relExposure('AS') else: print "No relative accessabilities calculated when using other prob radius then 1.4 A" |
self.DescWaitSpin.connect('value-changed', self.set_desc_wait) | self.DescWaitSpin.connect('focus-out-event', self.set_desc_wait) | def __init__(self, gladeFile): '''Create a new preferences dialog to take in preferences.''' gnomeglade.Component.__init__(self, gladeFile, 'PreferencesDialog') |
else: self.__load_checklist() | def __SRPM_into_properties(self, filename): msg = "Please select 'New => From SRPM'\nor 'New => From Bugzilla' to start the QA process." try: self.properties.load_SRPM(filename) except Properties.FileError, message: self.startLabel.set_text("Unable to process that SRPM: %s\n%s" % (message.__str__(), msg)) except Proper... | |
outPropName = '<i>' + propName + '</i>' | outPropName = '<span foreground="red" style="italic">' \ + propName + '</span>' | def create_layout(self): ''' ''' props = self.model if not props: label = gtk.Label('This CheckList does not contain any properties.') self.add(label) label.show() return self.labels = gtk.VBox() self.entries = gtk.VBox() self.add(self.labels) self.add(self.entries) self.propDisplays = {} |
if len(arguments) == 1: | if len(arguments) == 2: | def __init__(self, arguments): """Creates a new QA reviewer window. Keyword -- arguments: arguments: A commandline to process when setting up the environment """ ### FIXME: take care of the command line args |
outputList[res] = None | outputList[res] = '' | def add_item_to_checklist_callback(self, callingMenu): """Adds a checklist entry to the checklist. Sometimes there's something wrong with a product undergoing QA that isn't on the checklist. Using this action allows you to add an entry to the checklist you are currently filling out. """ |
filename = app.program.locate_file(gnome.FILE_DOMAIN_DATADIR, | filename = app.locate_file(gnome.FILE_DOMAIN_DATADIR, | def _load_functions(self): '''Load functions file if it's valid. |
idRE = re.compile(gpgId) for identity in gpgIdentities: if idRE.match(identity): continue model.append((identity,)) else: for identity in gpgIdentities: | for identity in gpgIdentities: if gpgId != identity: | def create_gpg_ids_list(self, gpgPath): ''' ''' key = GCONFPREFIX + '/user/gpg-identity' model = self.SignIdCombo.get_model() try: gpgId = self.gconfClient.get_string(key) except gobject.GError: gpgId = None gpgIdentities = gpg.list_secret_keys(gpgPath) if gpgId: model.append((gpgId,)) self.SignIdCombo.set_active(0) id... |
create_gpg_ids_list(entry.value.get_string()) | self.create_gpg_ids_list(entry.value.get_string()) | def change_gpg_path(self, client, connectId, entry, extra): '''Update the gpgID list when the gpg program is updated. ''' if entry.value and entry.value.type == gconf.VALUE_STRING: create_gpg_ids_list(entry.value.get_string()) |
def set_gpg_path(self, comboBox): ''' ''' model = comboBox.get_model() | def set_gpg_path(self, fileEntry): ''' ''' | def set_gpg_path(self, comboBox): ''' ''' model = comboBox.get_model() self.gconfClient.set_string(GCONFPREFIX + '/files/gpg-path', model.get_value(comboBox.get_active_iter(),0)) |
model.get_value(comboBox.get_active_iter(),0)) def set_gpg_identity(self, comboBox): ''' ''' model = comboBox.get_model() self.gconfClient.set_string(GCONFPREFIX + '/user/gpg-identity', model.get_value(comboBox.get_active_iter(),0)) def set_state_dir(self, comboBox): ''' ''' model = comboBox.get_model() | fileEntry.gtk_entry().get_text()) def set_gpg_identity(self, entry, event=None): ''' ''' if event: self.gconfClient.set_string(GCONFPREFIX + '/user/gpg-identity', entry.get_text()) else: self.gconfClient.set_string(GCONFPREFIX + '/user/gpg-identity', entry.child.get_text()) def set_state_dir(self, fileEntry): ''' ''' | def set_gpg_path(self, comboBox): ''' ''' model = comboBox.get_model() self.gconfClient.set_string(GCONFPREFIX + '/files/gpg-path', model.get_value(comboBox.get_active_iter(),0)) |
print entry | def on_menu_paste_activate(self, *extra): '''Copy from the clipboard into the selection.''' entry = self.ReviewerWindow.focus_widget if isinstance(entry, gtk.Editable): print entry entry.paste_clipboard() | |
if checkFile == None: | if not checkFile: | def __load_checklist(self): ### FIXME: When calling this function to load a new checklist, we # need to be careful. There was a bug where loading a new checklist # was causing editing of cells to no longer work. I think we have # to reload our checklistPane everytime we load a new checklist.... # -- Some restructurin... |
self.entries[category.prop('name')] = newCat | self.entries[category.prop('name').lower()] = newCat | def __init__(self, path): ''' Create a new CheckList |
self.entries[entry.name] = entryIter | self.entries[entry.namelower()] = entryIter | def __init__(self, path): ''' Create a new CheckList |
if self.entries.has_key(summary): raise error.DuplicateItem, ('%s is already present in the checklist.' % (self.entries[summary])) | sumLow = summary.lower() if self.entries.has_key(sumLow): raise error.DuplicateItem, ('%s is already present in the checklist.' % (self.entries[sumLow])) | def add_entry(self, summary, item=None, display=None, desc=None, resolution=None, output=None, resList=None, outputList=None): '''Adds new items to the checklist. Arguments: summary -- Summary of problem (also its key.) Keyword arguments: item -- entry is an item rather than a category. (default True) display -- disp... |
if summary == 'Custom Checklist Items': | if sumLow == 'custom checklist items': | def add_entry(self, summary, item=None, display=None, desc=None, resolution=None, output=None, resList=None, outputList=None): '''Adds new items to the checklist. Arguments: summary -- Summary of problem (also its key.) Keyword arguments: item -- entry is an item rather than a category. (default True) display -- disp... |
self.entries[summary] = newItem | self.entries[sumLow] = newItem | def add_entry(self, summary, item=None, display=None, desc=None, resolution=None, output=None, resList=None, outputList=None): '''Adds new items to the checklist. Arguments: summary -- Summary of problem (also its key.) Keyword arguments: item -- entry is an item rather than a category. (default True) display -- disp... |
entryIter = self.entries[key] | entryIter = self.entries[key.lower()] | def set_output_string(self, key, resolution, output): '''Set the output string for the key and resolution. Arguments: key -- summary that is used to key the entries resolution -- resolution state this output applies to output -- output string to set the entry:resolution to |
outputList[key] = output | outputList[resolution] = output | def set_output_string(self, key, resolution, output): '''Set the output string for the key and resolution. Arguments: key -- summary that is used to key the entries resolution -- resolution state this output applies to output -- output string to set the entry:resolution to |
item = item or True display = display or True | if item == None: item = True if display == None: display = True | def add_entry(self, summary, item=None, display=None, desc=None, resolution=None, output=None, resList=None, outputList=None): '''Adds new items to the checklist. Arguments: summary -- Summary of problem (also its key.) Keyword arguments: item -- entry is an item rather than a category. (default True) display -- disp... |
rtok = rtoks[0].firstChild.nodeValue | rtok = rtoks[0].firstChild.nodeValue.strip() | def print_response(url): f = StringIO() mycurl(url, f) dom = parse(f) for c in dom.getElementsByTagName("record"): OUT.write(c.toprettyxml(" ")) rtoks = dom.getElementsByTagName("resumptionToken") if rtoks: rtok = rtoks[0].firstChild.nodeValue else: rtok = None return rtok.strip() |
return rtok.strip() | return rtok | def print_response(url): f = StringIO() mycurl(url, f) dom = parse(f) for c in dom.getElementsByTagName("record"): OUT.write(c.toprettyxml(" ")) rtoks = dom.getElementsByTagName("resumptionToken") if rtoks: rtok = rtoks[0].firstChild.nodeValue else: rtok = None return rtok.strip() |
referer="%s/yourbaskets.py/display" % weburl, | referer="%s/yourbaskets/display" % weburl, | def perform_modifybasket(req, userID, callback='yes', confirm=0): """modify email and password of an account""" (auth_code, auth_message) = is_adminuser(req) if auth_code != 0: return mustloginpage(req, auth_message) subtitle = """<a name="2"></a>2. Modify baskets.   <small>[<a title="See guide" href="%s/... |
enter as many e-mail adresses you want and press <strong>reset</strong>.<br> | enter as many e-mail addresses you want and press <strong>reset</strong>.<br> | def perform_resetdefaultsettings(req, superusers=[], confirm=0): """delete all roles, actions and authorizations presently in the database and add only the default roles. only selected users will be added to superadmin, rest is blank """ (auth_code, auth_message) = is_adminuser(req) if auth_code != 0: return mustlogin... |
enter as many e-mail adresses you want and press <strong>add</strong>.<br> | enter as many e-mail addresses you want and press <strong>add</strong>.<br> | def perform_adddefaultsettings(req, superusers=[], confirm=0): """add the default settings, and keep everything else. probably nothing will be deleted, except if there has been made changes to the defaults.""" (auth_code, auth_message) = is_adminuser(req) if auth_code != 0: return mustloginpage(req, auth_message) # c... |
print >> sys.stderr, name, rd, pythoncom.VT_UNKNOWN | s = linePrefix + 'def ' + name + '(self' + BuildCallList(fdesc, names, defNamedOptArg, defNamedNotOptArg, defUnnamedArg, defOutArg) + '):' | |
top2.context = "%s__%s_meth.html" % (top.name, top2.name) | top2.context = "%s__%s_meth.html" % (_urlescape(top.name), top2.name) | def parseTopics(cat, input): # Sucks in a AutoDuck Dump file. # format: # topicname\tcontext\tTags: # \ttagname # \t\tfield1\tfield2\t...... # repeat tag/field section until the next topicname\tcontext line. # tagnames we care about: lTags = ["module", "object", "topic"] line = input.readline() if line == '': return #... |
top2.context = "%s__%s_prop.html" % (top.name, top2.name) | top2.context = "%s__%s_prop.html" % (_urlescape(top.name), top2.name) | def parseTopics(cat, input): # Sucks in a AutoDuck Dump file. # format: # topicname\tcontext\tTags: # \ttagname # \t\tfield1\tfield2\t...... # repeat tag/field section until the next topicname\tcontext line. # tagnames we care about: lTags = ["module", "object", "topic"] line = input.readline() if line == '': return #... |
hs = win32service.OpenService(hscm, serviceName, win32service.SERVICE_ALL_ACCESS) | hs = SmartOpenService(hscm, serviceName, win32service.SERVICE_ALL_ACCESS) | def ChangeServiceConfig(pythonClassString, serviceName, startType = None, errorControl = None, serviceDeps = None, userName = None, password = None, exeName = None, displayName = None, perfMonIni = None, perfMonDll = None): # Before doing anything, remove any perfmon counters. try: import perfmon perfmon.UnloadPerfCoun... |
hs = win32service.OpenService(hscm, serviceName, win32service.SERVICE_ALL_ACCESS) | hs = SmartOpenService(hscm, serviceName, win32service.SERVICE_ALL_ACCESS) | def RemoveService(serviceName): try: import perfmon perfmon.UnloadPerfCounterTextStrings("python.exe "+serviceName) except (ImportError, win32api.error): pass hscm = win32service.OpenSCManager(None,None,win32service.SC_MANAGER_ALL_ACCESS) try: hs = win32service.OpenService(hscm, serviceName, win32service.SERVICE_ALL_A... |
hs = win32service.OpenService(hscm, serviceName, win32service.SERVICE_ALL_ACCESS) | hs = SmartOpenService(hscm, serviceName, win32service.SERVICE_ALL_ACCESS) | def ControlService(serviceName, code, machine = None): hscm = win32service.OpenSCManager(machine,None,win32service.SC_MANAGER_ALL_ACCESS) try: hs = win32service.OpenService(hscm, serviceName, win32service.SERVICE_ALL_ACCESS) try: status = win32service.ControlService(hs, code) finally: win32service.CloseServiceHandle(h... |
hs = win32service.OpenService(hscm, serviceName, win32service.SERVICE_ALL_ACCESS) | hs = SmartOpenService(hscm, serviceName, win32service.SERVICE_ALL_ACCESS) | def StartService(serviceName, args = None, machine = None): hscm = win32service.OpenSCManager(machine,None,win32service.SC_MANAGER_ALL_ACCESS) try: hs = win32service.OpenService(hscm, serviceName, win32service.SERVICE_ALL_ACCESS) try: win32service.StartService(hs, args) finally: win32service.CloseServiceHandle(hs) fin... |
hs = win32service.OpenService(hscm, serviceName, win32service.SERVICE_QUERY_STATUS) | hs = SmartOpenService(hscm, serviceName, win32service.SERVICE_QUERY_STATUS) | def QueryServiceStatus(serviceName, machine=None): hscm = win32service.OpenSCManager(machine,None,win32service.SC_MANAGER_CONNECT) try: hs = win32service.OpenService(hscm, serviceName, win32service.SERVICE_QUERY_STATUS) try: status = win32service.QueryServiceStatus(hs) finally: win32service.CloseServiceHandle(hs) fina... |
s = '%s\treturn self._oleobj_.InvokeTypes(0x%x, LCID, %s, %s, %s%s)' % (linePrefix, id, fdesc[4], retDesc, argsDesc, _BuildArgList(fdesc, names)) | s = '%s\treturn self._oleobj_.InvokeTypes(%d, LCID, %s, %s, %s%s)' % (linePrefix, id, fdesc[4], retDesc, argsDesc, _BuildArgList(fdesc, names)) | s = linePrefix + 'def ' + name + '(self' + BuildCallList(fdesc, names, defNamedOptArg, defNamedNotOptArg, defUnnamedArg) + '):' |
s = '%s\tret = self._oleobj_.InvokeTypes(0x%x, LCID, %s, %s, %s%s)\n' % (linePrefix, id, fdesc[4], retDesc, `argsDesc`, _BuildArgList(fdesc, names)) | s = '%s\tret = self._oleobj_.InvokeTypes(%d, LCID, %s, %s, %s%s)\n' % (linePrefix, id, fdesc[4], retDesc, `argsDesc`, _BuildArgList(fdesc, names)) | s = linePrefix + 'def ' + name + '(self' + BuildCallList(fdesc, names, defNamedOptArg, defNamedNotOptArg, defUnnamedArg) + '):' |
s = s + '%s\treturn str(self._oleobj_.InvokeTypes(0x%x, LCID, %s, %s, %s%s))' % (linePrefix, id, fdesc[4], retDesc, `argsDesc`, _BuildArgList(fdesc, names)) | s = s + '%s\treturn str(self._oleobj_.InvokeTypes(%d, LCID, %s, %s, %s%s))' % (linePrefix, id, fdesc[4], retDesc, `argsDesc`, _BuildArgList(fdesc, names)) | s = linePrefix + 'def ' + name + '(self' + BuildCallList(fdesc, names, defNamedOptArg, defNamedNotOptArg, defUnnamedArg) + '):' |
s = s + '%s\treturn self._oleobj_.InvokeTypes(0x%x, LCID, %s, %s, %s%s)' % (linePrefix, id, fdesc[4], retDesc, `argsDesc`, _BuildArgList(fdesc, names)) | s = s + '%s\treturn self._oleobj_.InvokeTypes(%d, LCID, %s, %s, %s%s)' % (linePrefix, id, fdesc[4], retDesc, `argsDesc`, _BuildArgList(fdesc, names)) | s = linePrefix + 'def ' + name + '(self' + BuildCallList(fdesc, names, defNamedOptArg, defNamedNotOptArg, defUnnamedArg) + '):' |
s = '%s\treturn self._ApplyTypes_(0x%x, %s, %s, %s, %s, %s%s)' % (linePrefix, id, fdesc[4], retDesc, argsDesc, `name`, resclsid, _BuildArgList(fdesc, names)) | s = '%s\treturn self._ApplyTypes_(%d, %s, %s, %s, %s, %s%s)' % (linePrefix, id, fdesc[4], retDesc, argsDesc, `name`, resclsid, _BuildArgList(fdesc, names)) | s = linePrefix + 'def ' + name + '(self' + BuildCallList(fdesc, names, defNamedOptArg, defNamedNotOptArg, defUnnamedArg) + '):' |
ret.append(s + hex(entry.dispid) + ",0,%d,1)+args),'%s')" % (invoketype, names[0])) | ret.append(s + str(entry.dispid) + ",0,%d,1)+args),'%s')" % (invoketype, names[0])) | ret.append(linePrefix + 'def ' + name + '(' + argPrefix + ', *args):') |
if indir_vt == pythoncom.VT_CARRAY: return pythoncom.VT_CARRAY, None, None | def _ResolveType(typerepr, itypeinfo): # Resolve VT_USERDEFINED (often aliases or typed IDispatches) | |
tb.dialog.SaveState() frame.ShowControlBar(tb, 0, 1) | if tb.dialog is not None: tb.dialog.SaveState() frame.ShowControlBar(tb, 0, 1) | def close(self, frameShutdown = 0): # abortClose indicates if we have total shutdown # (ie, main window is dieing) if self.pumping: # Can stop pump here, as it only posts a message, and # returns immediately. if not self.StopDebuggerPump(): # User cancelled close. return 0 # NOTE - from this point on the close can not ... |
traceback.print_exc() | if self.logger is not None: self.logger.exception("pythoncom server error") else: traceback.print_exc() | def _HandleException_(self): """Called whenever an exception is raised. |
for arg in args[:-1]: print arg, print args[-1] | if self.logger is not None: record = " ".join(map(str, args)) self.logger.debug(record) else: for arg in args[:-1]: print arg, print args[-1] | def _trace_(self, *args): for arg in args[:-1]: print arg, print args[-1] |
import win32traceutil print "Object with win32trace dispatcher created (object=%s)" % `object` | if self.logger is None: import win32traceutil self._trace_("Object with win32trace dispatcher created (object=%s)" % `object`) | def __init__(self, policyClass, object): DispatcherTrace.__init__(self, policyClass, object) import win32traceutil # Sets up everything. print "Object with win32trace dispatcher created (object=%s)" % `object` |
import pywin.debugger | def __init__(self, policyClass, ob): import pywin.debugger pywin.debugger.brk() # DEBUGGER Note - You can either: # * Hit Run and wait for a (non Exception class) exception to occur! # * Set a breakpoint and hit run. # * Step into the object creation (a few steps away!) DispatcherBase.__init__(self, policyClass, ob) | |
import pywin.debugger, pywin.debugger.dbgcon | def _HandleException_(self): """ Invoke the debugger post mortem capability """ # Save details away. typ, val, tb = exc_info() import pywin.debugger, pywin.debugger.dbgcon debug = 0 try: raise typ, val except Exception: # AARG - What is this Exception??? # Use some inside knowledge to borrow a Debugger option which dic... | |
print "have", la_enum.length print "0=", ord(la_enum.lana[0]), "1=", ord(la_enum.lana[1]) | def ACTION_HEADER(): return NCBStruct(ACTION_HEADER_ITEMS) | |
mod = GetModuleForTypelib(typelibCLSID, lcid, major, minor) | try: mod = GetModuleForTypelib(typelibCLSID, lcid, major, minor) except ImportError: mod = None | def GetModuleForCLSID(clsid): """Get a Python module for a CLSID Given a CLSID, return a Python module which contains the class which wraps the COM object. Returns the Python module, or None if no module is available. Params progid -- A COM CLSID (ie, not the description) """ clsid_str = str(clsid) try: typelibCLSID... |
try: return _GetModule(modName) except ImportError: return None | return _GetModule(modName) | def GetModuleForTypelib(typelibCLSID, lcid, major, minor): """Get a Python module for a type library ID Given the CLSID of a typelibrary, return an imported Python module, else None Params typelibCLSID -- IID of the type library. major -- Integer major version. minor -- Integer minor version lcid -- Integer LCID for ... |
spec.FromTypelib(tlb, typelibCLSID) | spec.FromTypelib(tlb, str(typelibCLSID)) | def GenerateFromTypeLibSpec(typelibInfo, file = None, verboseLevel = None, progressInstance = None, bUnicodeToString=1, bQuiet = None, bGUIProgress = None ): if bQuiet is not None or bGUIProgress is not None: print "Please dont use the bQuiet or bGUIProgress params" print "use the 'verboseLevel', and 'progressClass' pa... |
'PyIDistList': 'IMAPIProp', | 'PyIDistList': 'IMAPIContainer', | def finalize_options(self): if self.install_dir is None: installobj = self.distribution.get_command_obj('install') self.install_dir = installobj.install_lib print 'Installing data files to %s' % self.install_dir install_data.finalize_options(self) |
sys.appargvoffset = 1 | sys.appargvoffset = 2 | # def write(self,message): |
zf = zipfile.ZipFile(zip_file) f = cStringIO.StringIO(zf.read(zip_path)) zf.close() | try: zf = zipfile.ZipFile(zip_file) f = cStringIO.StringIO(zf.read(zip_path)) zf.close() except IOError: return | def _LoadDicts(): import cPickle # Load the dictionary from a .zip file if that is where we live. zip_pos = win32com.__gen_path__.find(".zip\\") if zip_pos >= 0: import zipfile, cStringIO zip_file = win32com.__gen_path__[:zip_pos+4] zip_path = win32com.__gen_path__[zip_pos+5:] zip_path = os.path.join(zip_path, "dicts.d... |
return _GetModule(modName) | mod = _GetModule(modName) if not mod.__dict__.has_key("_in_gencache_"): AddModuleToCache(typelibCLSID, lcid, major, minor) assert mod.__dict__.has_key("_in_gencache_") return mod | def GetModuleForTypelib(typelibCLSID, lcid, major, minor): """Get a Python module for a type library ID Given the CLSID of a typelibrary, return an imported Python module, else None Params typelibCLSID -- IID of the type library. major -- Integer major version. minor -- Integer minor version lcid -- Integer LCID for ... |
unittest_modules = "testIterators testvbscript_regexp".split() | class PyCOMTest(unittest.TestCase): def testit(self): fname = os.path.join(os.path.dirname(this_file), "testPyComTest.py") cmd = '%s "%s" -q 2>&1' % (sys.executable, fname) f = os.popen(cmd) data = f.read() rc = f.close() if rc: print data self.fail("Executing '%s' failed (%d)" % (cmd, rc)) data = string.strip(data) ... | def _test_with_import(capture, module_name, fn_name, desc): try: mod = __import__(module_name) except (ImportError, pythoncom.com_error): print "The '%s' test can not be run - failed to import test module" % desc return capture.capture() try: func = getattr(mod, fn_name) func() capture.release() print "%s generated %d ... |
import unittest testRunner = unittest.TextTestRunner(verbosity=1) | verbosity = 1 if "-v" in sys.argv: verbosity += 1 testRunner = unittest.TextTestRunner(verbosity=verbosity) suite = unittest.TestSuite() | def _test_with_import(capture, module_name, fn_name, desc): try: mod = __import__(module_name) except (ImportError, pythoncom.com_error): print "The '%s' test can not be run - failed to import test module" % desc return capture.capture() try: func = getattr(mod, fn_name) func() capture.release() print "%s generated %d ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.