rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
self._membership_state(cr, uid, partner_ids, 'membership_state', None, context=context) self._membership_start(cr, uid, partner_ids, 'membership_start', None, context=context) self._membership_stop(cr, uid, partner_ids, 'membership_stop', None, context=context) self._membership_cancel(cr, uid, partner_ids, 'membership_... | if partner_ids: self.write(cr, uid, partner_ids, {}, context) | def _membership_state_job(self, cr, uid, ids=False, context={}): today = datetime.date.today() yesterday = today - datetime.timedelta(days=1) membership_line_ids = self.pool.get('membership.membership_line').search(cr, uid, ['|', ('date_to','=', yesterday), ('date_from','=', today)], context=context) partner_tmp_ids = ... |
except Exception, e: print >> sys.stderr, "XMLRPC Error: %s" % e | except Exception, err: print >> sys.stderr, "XMLRPC Error: %s" % err | def webimport(self, cr, uid, web_ids, context={}): cnew = cupdate = cerror = 0 for website in self.pool.get('esale_joomla.web').browse(cr, uid, web_ids): server = _xmlrpc(website) try: #get languages languages = server.openerp2vm.get_languages(website.login, website.password) if website.language_id.code not in language... |
label = "%s@%s:%d" %(function_name, source, cur_lineNum) | if iter_string != '': iter_string = '$' + iter_string label = "%s@%s:%d%s" %(function_name, source, cur_lineNum, iter_string) | def create_temp(dot_filename): """Create a temporary dot file with "..." truncated edge labels.""" # TODO we really should use the xdot parser to do this, instead of this ad hoc one! MAX_NODE_NAME = 64 temp_dot_filename = '_temp.dot' try: temp_dot_file = open(temp_dot_filename, 'w') except: home_dir = os.environ.get("H... |
dialog.destroy() | def on_rename_activate(self, *args): """Shows a dialog to rename the current tab. """ entry = gtk.Entry() entry.set_text(self.selected_tab.get_label()) entry.set_property('can-default', True) entry.show() | |
f = os.path.join(guake_globals.IMAGE_DIR, x) | f = os.path.join(guake.globals.IMAGE_DIR, x) | def pixmapfile(x): f = os.path.join(guake_globals.IMAGE_DIR, x) if not os.path.exists(f): raise IOError('No such file or directory: %s' % f) return os.path.abspath(f) |
f = os.path.join(guake_globals.GLADE_DIR, x) | f = os.path.join(guake.globals.GLADE_DIR, x) | def gladefile(x): f = os.path.join(guake_globals.GLADE_DIR, x) if not os.path.exists(f): raise IOError('No such file or directory: %s' % f) return os.path.abspath(f) |
params = ['identify', '-t'] | cmd = [self.exe, 'identify', '-t'] | def get_tag(self): params = ['identify', '-t'] # workaround for #4 params.extend(['--config', 'defaults.identify=']) return self._run_cmd([self.exe, *params]).strip() or None |
params.extend(['--config', 'defaults.identify=']) return self._run_cmd([self.exe, *params]).strip() or None | cmd.extend(['--config', 'defaults.identify=']) return self._run_cmd(cmd).strip() or None | def get_tag(self): params = ['identify', '-t'] # workaround for #4 params.extend(['--config', 'defaults.identify=']) return self._run_cmd([self.exe, *params]).strip() or None |
if not value: return | if not value or not 'hg_version' in attr: return | def version_calc_plugin(dist, attr, value): """ Handler for parameter to setup(use_hg_version=value) """ if not value: return # if the user indicates an increment, use it increment = value if 'increment' in attr else None dist.metadata.version = calculate_version(increment) patch_egg_info() |
class LibraryManager(HGManager): | class LibraryManager(HGRepoManager): | def find_files(): """ Use the hg command to recursively find versioned files in dirname. """ try: proc = subprocess.Popen( ['hg', 'locate'], stdout=subprocess.PIPE, cwd=self.location, ) stdout, stderr = proc.communicate() except: # Let's behave a bit nicer and return nothing if something fails. return [] return stdout.... |
globals.update(vars()) | globals().update(vars()) | def do_imports(self): try: from mercurial.__version__ import version from mercurial import hg, ui, cmdutil except ImportError: pass |
os.environ.get('HG_SETUPTOOLS_FORCE_CMD', False) | force_cmd = os.environ.get('HG_SETUPTOOLS_FORCE_CMD', False) | def is_valid(self): os.environ.get('HG_SETUPTOOLS_FORCE_CMD', False) return not force_cmd and 'hg' in globals() and self.version_match() |
ptag = self.get_parent_tag() | ptag = self.get_parent_tag('tip') | def get_tagged_version(self): """ Get the version of the local working set as a StrictVersion or None if no viable tag exists. If the local working set is itself the tagged commit and the tip, use the tag on the parent changeset. """ tag = self.get_tag() if tag == 'tip': ptag = self.get_parent_tag() if ptag: tag = ptag... |
if self.distribution.use_hg_version: | using_hg_version = ( self.distribution.use_hg_version or self.distribution.use_hg_version_increment ) if using_hg_version: | def tagged_version(self): if self.distribution.use_hg_version: result = safe_version(self.distribution.get_version()) else: result = orig_ver(self) self.tag_build = result return result |
return self._run_cmd([self.exe, 'identify', '-t']).strip() or None | params = ['identify', '-t'] params.extend(['--config', 'defaults.identify=']) return self._run_cmd([self.exe, *params]).strip() or None | def get_tag(self): return self._run_cmd([self.exe, 'identify', '-t']).strip() or None |
or self.distribution.use_hg_version or self.distribution.use_hg_version_increment | or getattr(self.distribution, 'use_hg_version', False) or getattr(self.distribution, 'use_hg_version_increment', False) | def tagged_version(self): using_hg_version = ( force_hg_version or self.distribution.use_hg_version or self.distribution.use_hg_version_increment ) if using_hg_version: result = safe_version(self.distribution.get_version()) else: result = orig_ver(self) self.tag_build = result return result |
Retrun the version of the current state of the repository -- a tagged version, if present, or the next version based on prior tagged releases. """ return str(self.get_tagged_version()) or self.get_next_version(increment) | Return as a string the version of the current state of the repository -- a tagged version, if present, or the next version based on prior tagged releases. """ ver = self.get_tagged_version() or self.get_next_version(increment) return str(ver) | def get_current_version(self, increment=None): """ Retrun the version of the current state of the repository -- a tagged version, if present, or the next version based on prior tagged releases. """ return str(self.get_tagged_version()) or self.get_next_version(increment) |
>>> VersionManagement.infer_next_version('3.2', '0.0.1') | >>> VM_infer = lambda *params: str(VersionManagement.infer_next_version(*params)) >>> VM_infer('3.2', '0.0.1') | def infer_next_version(last_version, increment): """ Given a simple application version (as a StrictVersion), and an increment (1.0, 0.1, or 0.0.1), guess the next version. >>> VersionManagement.infer_next_version('3.2', '0.0.1') '3.2.1' >>> VersionManagement.infer_next_version(StrictVersion('3.2'), '0.0.1') '3.2.1' >>... |
>>> VersionManagement.infer_next_version(StrictVersion('3.2'), '0.0.1') | >>> VM_infer(StrictVersion('3.2'), '0.0.1') | def infer_next_version(last_version, increment): """ Given a simple application version (as a StrictVersion), and an increment (1.0, 0.1, or 0.0.1), guess the next version. >>> VersionManagement.infer_next_version('3.2', '0.0.1') '3.2.1' >>> VersionManagement.infer_next_version(StrictVersion('3.2'), '0.0.1') '3.2.1' >>... |
>>> VersionManagement.infer_next_version('3.2.3', '0.1') | >>> VM_infer('3.2.3', '0.1') | def infer_next_version(last_version, increment): """ Given a simple application version (as a StrictVersion), and an increment (1.0, 0.1, or 0.0.1), guess the next version. >>> VersionManagement.infer_next_version('3.2', '0.0.1') '3.2.1' >>> VersionManagement.infer_next_version(StrictVersion('3.2'), '0.0.1') '3.2.1' >>... |
>>> VersionManagement.infer_next_version('3.1.2', '1.0') | >>> VM_infer('3.1.2', '1.0') | def infer_next_version(last_version, increment): """ Given a simple application version (as a StrictVersion), and an increment (1.0, 0.1, or 0.0.1), guess the next version. >>> VersionManagement.infer_next_version('3.2', '0.0.1') '3.2.1' >>> VersionManagement.infer_next_version(StrictVersion('3.2'), '0.0.1') '3.2.1' >>... |
>>> VersionManagement.infer_next_version('3.0.9', '0.0.1') | >>> VM_infer('3.0.9', '0.0.1') | def infer_next_version(last_version, increment): """ Given a simple application version (as a StrictVersion), and an increment (1.0, 0.1, or 0.0.1), guess the next version. >>> VersionManagement.infer_next_version('3.2', '0.0.1') '3.2.1' >>> VersionManagement.infer_next_version(StrictVersion('3.2'), '0.0.1') '3.2.1' >>... |
>>> VersionManagement.infer_next_version('3.1a1', '0.0.1') | >>> VM_infer('3.1a1', '0.0.1') | def infer_next_version(last_version, increment): """ Given a simple application version (as a StrictVersion), and an increment (1.0, 0.1, or 0.0.1), guess the next version. >>> VersionManagement.infer_next_version('3.2', '0.0.1') '3.2.1' >>> VersionManagement.infer_next_version(StrictVersion('3.2'), '0.0.1') '3.2.1' >>... |
return str(sum) | return sum | def infer_next_version(last_version, increment): """ Given a simple application version (as a StrictVersion), and an increment (1.0, 0.1, or 0.0.1), guess the next version. >>> VersionManagement.infer_next_version('3.2', '0.0.1') '3.2.1' >>> VersionManagement.infer_next_version(StrictVersion('3.2'), '0.0.1') '3.2.1' >>... |
return (tagged_revision(*line.split()) for line in lines if line) | return ( tagged_revision(*line.rsplit(None, 1)) for line in lines if line ) | def get_tags(self): tagged_revision = namedtuple('tagged_revision', 'tag revision') lines = self._run_cmd([self.exe, 'tags']).splitlines() return (tagged_revision(*line.split()) for line in lines if line) |
return self_run_cmd(['hg', 'locate']).splitlines() | return self._run_cmd(['hg', 'locate']).splitlines() | def find_files(self): """ Find versioned files in self.location """ return self_run_cmd(['hg', 'locate']).splitlines() |
self.do_imports() | self.setup() | def __init__(self, location='.'): self.location = location self.do_imports() |
def do_imports(self): | def setup(self): | def do_imports(self): pass |
return subprocess.call([self.exe, 'version']) == 0 | return 0 == subprocess.call( [self.exe, 'version'], stdout=self._get_devnull(), ) | def is_valid(self): return subprocess.call([self.exe, 'version']) == 0 |
def find_files(): | def find_files(self): | def find_files(): """ Use the hg command to recursively find versioned files in dirname. """ try: proc = subprocess.Popen( ['hg', 'locate'], stdout=subprocess.PIPE, cwd=self.location, ) stdout, stderr = proc.communicate() except: # Let's behave a bit nicer and return nothing if something fails. return [] return stdout.... |
def do_imports(self): | def setup(self): | def do_imports(self): try: from mercurial.__version__ import version from mercurial import hg, ui, cmdutil except ImportError: pass |
from mercurial import error | from mercurial.error import RepoError | def do_imports(self): try: from mercurial.__version__ import version from mercurial import hg, ui, cmdutil except ImportError: pass |
from mercurial import repo as error RepoError = error.RepoError | from mercurial.repo import RepoError | def do_imports(self): try: from mercurial.__version__ import version from mercurial import hg, ui, cmdutil except ImportError: pass |
del error | def do_imports(self): try: from mercurial.__version__ import version from mercurial import hg, ui, cmdutil except ImportError: pass | |
def _get_excluded(self, repo): | @property def repo(self): if not hasattr(self, '_repo'): self._repo = self._get_repo() return self._repo def _get_excluded(self): | def _get_excluded(self, repo): """ Return all files that hg knows about, but haven't been added, deleted, or removed or have an unknown status. """ modified, added, removed, deleted, unknown = repo.status()[:5] return removed + deleted + unknown |
modified, added, removed, deleted, unknown = repo.status()[:5] | modified, added, removed, deleted, unknown = self.repo.status()[:5] | def _get_excluded(self, repo): """ Return all files that hg knows about, but haven't been added, deleted, or removed or have an unknown status. """ modified, added, removed, deleted, unknown = repo.status()[:5] return removed + deleted + unknown |
repo = self._get_repo() | def find_files(self): """ Use the Mercurial library to recursively find versioned files in dirname. """ repo = self._get_repo() excluded = self._get_excluded() rev = None match = cmdutil.match(repo, [], {}, default='relglob') match.bad = lambda x, y: False return (abs for abs in repo[rev].walk(match) if rev and abs in ... | |
match = cmdutil.match(repo, [], {}, default='relglob') | match = cmdutil.match(self.repo, [], {}, default='relglob') | def find_files(self): """ Use the Mercurial library to recursively find versioned files in dirname. """ repo = self._get_repo() excluded = self._get_excluded() rev = None match = cmdutil.match(repo, [], {}, default='relglob') match.bad = lambda x, y: False return (abs for abs in repo[rev].walk(match) if rev and abs in ... |
for abs in repo[rev].walk(match) if rev and abs in repo.dirstate and abs not in excluded | for abs in self.repo[rev].walk(match) if (rev or abs in self.repo.dirstate) and abs not in excluded | def find_files(self): """ Use the Mercurial library to recursively find versioned files in dirname. """ repo = self._get_repo() excluded = self._get_excluded() rev = None match = cmdutil.match(repo, [], {}, default='relglob') match.bad = lambda x, y: False return (abs for abs in repo[rev].walk(match) if rev and abs in ... |
repo = self._get_repo() | def find_files(self): repo = self._get_repo() excluded = self._get_excluded() from mercurial import util node = None walker = cmdutil.walk(repo, [], {}, node=node, badmatch=util.always, default='relglob') return (abs for src, abs, rel, exact in walker if src != 'b' and (node or abs in repo.dirstate) and abs not in excl... | |
walker = cmdutil.walk(repo, [], {}, node=node, | walker = cmdutil.walk(self.repo, [], {}, node=node, | def find_files(self): repo = self._get_repo() excluded = self._get_excluded() from mercurial import util node = None walker = cmdutil.walk(repo, [], {}, node=node, badmatch=util.always, default='relglob') return (abs for src, abs, rel, exact in walker if src != 'b' and (node or abs in repo.dirstate) and abs not in excl... |
from mercurial.error import RepoError except ImportError: | def setup(self): try: from mercurial.__version__ import version from mercurial import hg, ui, cmdutil except ImportError: pass | |
except BaseException, e: | except Exception, e: | def file_finder_plugin(dirname="."): """ Find the files in ``dirname`` under Mercurial version control according to the setuptools spec (see http://peak.telecommunity.com/DevCenter/setuptools#adding-support-for-other-revision-control-systems ). """ import distutils.log dirname = dirname or '.' try: for mgr in HGRepoMan... |
def patch_egg_info(): | def patch_egg_info(force_hg_version=False): | def patch_egg_info(): from setuptools.command.egg_info import egg_info from pkg_resources import safe_version import functools orig_ver = egg_info.tagged_version @functools.wraps(orig_ver) def tagged_version(self): using_hg_version = ( self.distribution.use_hg_version or self.distribution.use_hg_version_increment ) if ... |
self.distribution.use_hg_version | force_hg_version or self.distribution.use_hg_version | def tagged_version(self): using_hg_version = ( self.distribution.use_hg_version or self.distribution.use_hg_version_increment ) if using_hg_version: result = safe_version(self.distribution.get_version()) else: result = orig_ver(self) self.tag_build = result return result |
return self.get_tagged_version() or self.get_next_version(increment) | return str(self.get_tagged_version()) or self.get_next_version(increment) | def get_current_version(self, increment=None): """ Retrun the version of the current state of the repository -- a tagged version, if present, or the next version based on prior tagged releases. """ return self.get_tagged_version() or self.get_next_version(increment) |
self.telnet = telnetlib.Telnet(self.IP, self.Query, self.Timeout) | self.telnet = telnetlib.Telnet(self.IP, self.Query) | def connect(self): """ Open a link to the Teamspeak 3 query port @return: A tulpe with a error code. Example: ('error', 0, 'ok') """ try: self.telnet = telnetlib.Telnet(self.IP, self.Query, self.Timeout) except telnetlib.socket.error: raise TS3Error(10, 'Can not open a link on the port or IP') output = self.telnet.read... |
print notParsedCMDStatus | def command(self, cmd, parameter={}, option=[]): """ Send a command with paramters and options to the TS3 Query. @param cmd: The command who wants to send. @type cmd: str @param parameter: A dict with paramters and value. Example: sid=2 --> {'sid':'2'} @type cmd: dict @param option: A list with options. Example: –uid -... | |
print ReturnCMDStatus | def command(self, cmd, parameter={}, option=[]): """ Send a command with paramters and options to the TS3 Query. @param cmd: The command who wants to send. @type cmd: str @param parameter: A dict with paramters and value. Example: sid=2 --> {'sid':'2'} @type cmd: dict @param option: A list with options. Example: –uid -... | |
return self.catalog(['Folder', 'Workspace', 'TabbedViewFolder' ]) | return self.catalog( ['Folder', 'Workspace', 'TabbedViewFolder' ], sort_on = 'created')[:-1] | def folders(self): return self.catalog(['Folder', 'Workspace', 'TabbedViewFolder' ]) |
sort_on = 'sortable_title', sort_order = '') | sort_on = 'getObjPositionInParent', sort_order = '') | def folders(self): # import pdb; pdb.set_trace( ) subfolders = [] folderobjects = [] all_folders = self.catalog( ['Folder', 'Workspace', 'TabbedViewFolder'], depth=1, sort_on = 'sortable_title', sort_order = '') return all_folders |
if not workspace: return getUtility(IVocabularyFactory, name='plone.principalsource.Users', context=context)(context) | def __call__(self, context): workspace = find_workspace(context) catalog = getToolByName(context, 'portal_catalog') query = dict( portal_type='Contact', path='/'.join(workspace.getPhysicalPath()), sort_on = 'sortable_title') if not workspace: return getUtility(IVocabularyFactory, name='plone.principalsource.Users', con... | |
def catalog(self, types, depth=2, sort_on='modified'): | def catalog(self, types, depth=2, sort_on='modified', sort_order='reverse'): | def catalog(self, types, depth=2, sort_on='modified'): return self.context.portal_catalog( portal_type=types, path=dict(depth=depth, query='/'.join(self.context.getPhysicalPath())), sort_on=sort_on, sort_order='reverse') |
sort_order='reverse') | sort_order=sort_order) | def catalog(self, types, depth=2, sort_on='modified'): return self.context.portal_catalog( portal_type=types, path=dict(depth=depth, query='/'.join(self.context.getPhysicalPath())), sort_on=sort_on, sort_order='reverse') |
['Folder', 'Workspace', 'TabbedViewFolder'], sort_on='created')[:-1] for item in all_folders: folderObject = item.getObject() if folderObject.getParentNode() == self.context: subfolders.append(item) return subfolders | ['Folder', 'Workspace', 'TabbedViewFolder'], depth=1, sort_on = 'sortable_title', sort_order = '') return all_folders | def folders(self): # import pdb; pdb.set_trace( ) subfolders = [] all_folders = self.catalog( ['Folder', 'Workspace', 'TabbedViewFolder'], sort_on='created')[:-1] for item in all_folders: folderObject = item.getObject() if folderObject.getParentNode() == self.context: subfolders.append(item) return subfolders |
try: size = float(item.getObjSize.split(' ', 1)[0]) except (AttributeError, ValueError): size = 0 has_file = size > 0 | has_file = item_type in direct_downloadable_types | def icon(item, value): url_method = lambda: '#' #item = hasattr(item, 'aq_explicit') and item.aq_explicit or item if hasattr(item, 'getURL'): url_method = item.getURL elif hasattr(item, 'absolute_url'): url_method = item.absolute_url # lazy file check try: size = float(item.getObjSize.split(' ', 1)[0]) except (Attribut... |
props = getToolByName(getSite(), 'portal_properties') | def icon(item, value): url_method = lambda: '#' #item = hasattr(item, 'aq_explicit') and item.aq_explicit or item if hasattr(item, 'getURL'): url_method = item.getURL elif hasattr(item, 'absolute_url'): url_method = item.absolute_url # lazy file check try: size = float(item.getObjSize.split(' ', 1)[0]) except (Attribut... | |
if item.portal_type in types_using_view: | if item_type in types_using_view: | def icon(item, value): url_method = lambda: '#' #item = hasattr(item, 'aq_explicit') and item.aq_explicit or item if hasattr(item, 'getURL'): url_method = item.getURL elif hasattr(item, 'absolute_url'): url_method = item.absolute_url # lazy file check try: size = float(item.getObjSize.split(' ', 1)[0]) except (Attribut... |
link = u'<a href="%s/at_download">%s</a>' % (url_method(), img) | if has_file: link = u'<a href="%s/at_download/file">%s</a>' % (url_method(), img) else: link = u'<a href="%s/view">%s</a>' % (url_method(), img) | def icon(item, value): url_method = lambda: '#' #item = hasattr(item, 'aq_explicit') and item.aq_explicit or item if hasattr(item, 'getURL'): url_method = item.getURL elif hasattr(item, 'absolute_url'): url_method = item.absolute_url img = u'<img src="%s/%s"/>' % (item.portal_url(), item.getIcon) link = u'<a href="%s/a... |
assert result.stdout.fnmatch_lines([ '*- Captured log -*', '*text going to logger*', '*- Captured stdout -*', 'text going to stdout', '*- Captured stderr -*', 'text going to stderr' ]) | fnmatch = result.stdout.fnmatch_lines assert fnmatch(['*- Captured log -*', '*text going to logger*']) assert fnmatch(['*- Captured stdout -*', 'text going to stdout']) assert fnmatch(['*- Captured stderr -*', 'text going to stderr']) | def test_foo(): sys.stdout.write('text going to stdout') sys.stderr.write('text going to stderr') logging.getLogger().info('text going to logger') assert False |
config.pluginmanager.register(Capturer(config), 'capturelog') | config.pluginmanager.register(Capturer(config), '_capturelog') | def pytest_configure(config): """Activate log capturing if appropriate.""" if config.getvalue('capturelog'): config.pluginmanager.register(Capturer(config), 'capturelog') |
if os.path.isfile(cached_path): | if os.path.exists(cached_path): | def download_cached(self, url, md5sum=None): """Download a file from a URL using the cache. |
convertcmd = 'gprof ' + cmdline + process + ' ' + destdir + '/gmon.out >& ' + destdir + '/gprof.out' | convertcmd = 'gprof ' + cmdline + ' ' + destdir + '/gmon.out >& ' + destdir + '/gprof.out' | def load(self, destdir, trial, process, thread): |
if type( self._utorrent ) == uTorrentServer: | if not self._utorrent or type( self._utorrent ) == uTorrentServer: | def _get_data( self, loc, data = None, retry = True ): last_e = None for i in range( self._retry_max if retry else 1 ): try: headers = { k : v for k, v in self._request.header_items() } if data: bnd = email.generator._make_boundary() headers[ 'Content-Type' ] = 'multipart/form-data; boundary={}'.format( bnd ) data = da... |
a = bencode( bdecode( torrent_data )[ 'info' ] ) f = open( '/tmp/aaa', 'wb' ) f.write(a) f.close() | def get_info_hash( torrent_data ): a = bencode( bdecode( torrent_data )[ 'info' ] ) f = open( '/tmp/aaa', 'wb' ) f.write(a) f.close() return sha1( bencode( bdecode( torrent_data )[ 'info' ] ) ).hexdigest().upper() | |
if not hasattr( torrents, '__iter__' ): | if not hasattr( torrents, '__iter__' ) or isinstance( torrents, str ): | def _get_hashes( self, torrents ): if not hasattr( torrents, '__iter__' ): torrents = ( torrents, ) out = [] for t in torrents: if isinstance( t, self._TorrentClass ): out.append( t.hash ) elif isinstance( t, str ): out.append( t ) else: raise uTorrentError( 'Hash designation only supported via Torrent class or string'... |
if self.ac.send_goal_and_wait(DoorGoal(self.userdata.door), rospy.Duration(30), rospy.Duration(30)): | if self.ac.send_goal_and_wait(DoorGoal(self.userdata.door), rospy.Duration(30), rospy.Duration(30)) == GoalStatus.SUCCEEDED: | def enter(self): if self.ac.send_goal_and_wait(DoorGoal(self.userdata.door), rospy.Duration(30), rospy.Duration(30)): result = self.ac.get_result() self.userdata.door = result.door if self.userdata.door.latch_state == Door.UNLATCHED: return 'unlatched' else: return 'closed' return 'aborted' |
@smach.cb_interface(outcomes=['unlatched', 'closed', 'aborted']) | @smach.cb_interface( outcomes=['unlatched', 'closed', 'aborted'], output_keys=['door']) | def main(): rospy.init_node('doors_executive') # construct state machine sm = StateMachine( ['succeeded', 'aborted', 'preempted'], input_keys = ['door'], output_keys = ['door']) with sm: StateMachine.add('INIT_CONTROLLERS', SwitchControllersState( stop_controllers = ["r_arm_cartesian_tff_controller"], start_controlle... |
result_slots = ['door'], | def detect_door_result_cb(ud, status, result): if status == GoalStatus.SUCCEEDED: if result.door.latch_state == Door.UNLATCHED: return 'unlatched' else: return 'closed' return 'aborted' | |
SimpleActionState('detect_handle', DoorAction, goal_slots = ['door'], result_slots = ['door']), | SimpleActionState('detect_handle', DoorAction, goal_slots = ['door'], | def detect_door_result_cb(ud, status, result): if status == GoalStatus.SUCCEEDED: if result.door.latch_state == Door.UNLATCHED: return 'unlatched' else: return 'closed' return 'aborted' |
SimpleActionState('detect_handle', DoorAction, goal_slots = ['door'], { 'succeeded': 'APPROACH_DOOR', 'aborted': 'DETECT_HANDLE'}) | SimpleActionState('detect_handle', DoorAction, goal_slots = ['door']), { 'succeeded': 'APPROACH_DOOR', 'aborted': 'DETECT_HANDLE'}) | def detect_handle_result_cb(ud, status, result): if status == GoalStatus.SUCCEEDED: ud.door = result.door |
file = open(pdbfile,'r') | file = open(pdbfile2,'r') | def Run(argv=None): if argv is None: argv=sys.argv quote = """'""" pdbfile = 'none' mtzfile = 'none' pdbfile2 = 'none' workingdir = 'none' runid = '1' runid_int = 0 projectlog = 'project_history.txt' multi_search = 'no' match_pdbin = 'no' mr_r = 'none' ilabel = 'none' flabel = 'none' sigflabel = 'none' seq_insertion_... |
'spacegroup_no': 0, | 'spacegroup_no': '0', | def runJob(self): |
config['spacegroup_no'] = self.spaceGroupComboBox.currentIndex() | config['spacegroup_no'] = str(self.spaceGroupComboBox.currentIndex()) | def runJob(self): |
stream.setVersion(QtCore.QDataStream.Qt_4_0) | stream.setVersion(QtCore.QDataStream.Qt_4_5) | def exec_script(script): """Executes the given script in the associated MIFit session""" global socketId result = QtCore.QString() sock = QtNetwork.QLocalSocket() sock.connectToServer(socketId) if sock.waitForConnected(): stream = QtCore.QDataStream(sock) stream.setVersion(QtCore.QDataStream.Qt_4_0) scriptString = Qt... |
scriptString = QtCore.QString(script + "\b") stream << scriptString | data = QtCore.QByteArray() out = QtCore.QDataStream(data, QtCore.QIODevice.WriteOnly) out.setVersion(QtCore.QDataStream.Qt_4_5) out.writeUInt32(0) out << QtCore.QString(script) out.device().seek(0) out.writeUInt32(data.size() - 8) sock.write(data) | def exec_script(script): """Executes the given script in the associated MIFit session""" global socketId result = QtCore.QString() sock = QtNetwork.QLocalSocket() sock.connectToServer(socketId) if sock.waitForConnected(): stream = QtCore.QDataStream(sock) stream.setVersion(QtCore.QDataStream.Qt_4_0) scriptString = Qt... |
if not sock.waitForReadyRead(): | QtGui.qApp.processEvents() if not sock.waitForReadyRead(200): | def exec_script(script): """Executes the given script in the associated MIFit session""" global socketId result = QtCore.QString() sock = QtNetwork.QLocalSocket() sock.connectToServer(socketId) if sock.waitForConnected(): stream = QtCore.QDataStream(sock) stream.setVersion(QtCore.QDataStream.Qt_4_0) scriptString = Qt... |
str = QtCore.QString() stream >> str i = str.indexOf('\b'); if i >= 0: str = str.mid(0, i) moreInput = False result.append(str) | if dataSize == 0: if sock.bytesAvailable() < 8: continue dataSize = stream.readUInt32() if sock.bytesAvailable() < dataSize: continue stream >> result moreInput = False | def exec_script(script): """Executes the given script in the associated MIFit session""" global socketId result = QtCore.QString() sock = QtNetwork.QLocalSocket() sock.connectToServer(socketId) if sock.waitForConnected(): stream = QtCore.QDataStream(sock) stream.setVersion(QtCore.QDataStream.Qt_4_0) scriptString = Qt... |
stream << QtCore.QString("ack\b") | def exec_script(script): """Executes the given script in the associated MIFit session""" global socketId result = QtCore.QString() sock = QtNetwork.QLocalSocket() sock.connectToServer(socketId) if sock.waitForConnected(): stream = QtCore.QDataStream(sock) stream.setVersion(QtCore.QDataStream.Qt_4_0) scriptString = Qt... | |
save_mode = arg == 'safe' | safe_mode = arg == 'safe' | def sph_markdown(value, arg='', oldmd=None, extra_macros={}): try: from sphene.contrib.libs.markdown import markdown except ImportError: if settings.DEBUG: raise template.TemplateSyntaxError, "Error in {% markdown %} filter: The Python markdown library isn't installed." return value else: save_mode = arg == 'safe' macr... |
return 'sphboard_rendered_body_%s' % str(self.id) | return '%s-sphboard_rendered_body_%s' % (settings.CACHE_MIDDLEWARE_KEY_PREFIX, str(self.id)) | def __get_render_cachekey(self): return 'sphboard_rendered_body_%s' % str(self.id) |
return 'sphboard_signature_%s' % user_id | return '%s_sphboard_signature_%s' % (settings.CACHE_MIDDLEWARE_KEY_PREFIX, user_id) | def __get_signature_cachekey(user_id): return 'sphboard_signature_%s' % user_id |
print "asdf %s" % self.fileupload.name | def is_image(self): print "asdf %s" % self.fileupload.name (type, encoding) = mimetypes.guess_type(self.fileupload.name) print "xx" if type is None: return False return type.startswith('image/') | |
print "xx" | def is_image(self): print "asdf %s" % self.fileupload.name (type, encoding) = mimetypes.guess_type(self.fileupload.name) print "xx" if type is None: return False return type.startswith('image/') | |
user = models.ForeignKey( ugettext_lazy(u'User'), User, unique = True) | user = models.ForeignKey( User, unique = True) | def is_active(self): from sphene.community.middleware import get_current_request req = get_current_request() if not req: return False nav = getattr(req, 'nav', req.path) if self.href == '/': return self.href == nav or nav == '' return nav.startswith(self.href) |
role_member = models.ForeignKey( ugettext_lazy(u'Role member'), RoleMember ) object_type = models.ForeignKey(ugettext_lazy(u'Object type'), ContentType) | role_member = models.ForeignKey( RoleMember ) object_type = models.ForeignKey(ContentType) | def get_limitations_string(self): if not self.has_limitations: return "None" limitation = self.rolememberlimitation_set.get() return "%s: %s" % (limitation.object_type.model_class()._meta.object_name, unicode(limitation.content_object)) |
signals.post_syncdb.connect(init_data, sender=models) | signals.post_syncdb.connect(init_data, sender=models, dispatch_uid="communitytools.sphenecoll.sphene.community.management") | def do_changelog(app, created_models, verbosity, **kwargs): app_models = get_models( app ) if app_models == None: return sql = () invokes = () for clazz in app_models: changelog = getattr(clazz, 'changelog', None) if not changelog: continue #changelog = get_changelog(None) version = None currentversion = changelog[-1... |
if post.pk == thread.latest().pk: | if post.pk == self.latest().pk: | def thread_has_newer_posts(self, post): """ Check if there are posts newer than 'post' """ if post.pk == thread.latest().pk: return True return False |
group = get_current_group() from django.conf import settings | try: group = get_current_group() except AttributeError, e: group = None | def my_get_current(self): group = get_current_group() from django.conf import settings if not group: return self.get(pk=settings.SITE_ID) else: return Site( pk=settings.SITE_ID, domain = group.baseurl, name = group.name ) |
return self.threadinformation_set.count() | return self.threadinformation_set.filter(root_post__is_hidden=0).count() | def threadCount(self): return self.threadinformation_set.count() |
return self.posts.filter(is_hidden=False).count() | return self.posts.filter(is_hidden=0).count() | def postCount(self): return self.posts.filter(is_hidden=False).count() |
return self.posts.filter(is_hidden=False).latest( 'postdate' ) | return self.posts.filter(is_hidden=0).latest( 'postdate' ) | def get_latest_post(self): return self.posts.filter(is_hidden=False).latest( 'postdate' ) |
quotepost = Post.objects.get( pk = request.REQUEST['quote'] ) | quotepost = get_object_or_404(Post, pk = request.REQUEST['quote'] ) | def post(request, group = None, category_id = None, post_id = None, thread_id = None): """ View method to allow users to: - create new threads (post_id and thread_id is None) - reply to threads (post_id is None) - edit posts (post_id is the post which should be edited, thread_id is None) post_id and thread_id can eith... |
if thr and (original.thread.pk != instance.thread.pk | if thr and (original.thread != instance.thread | def clear_post_cache(sender, instance, *args, **kwargs): """ If post being saved has changed 'thread' field or 'category' field or 'is_hidden' field then clear cache of all other posts in same thread as page numeration may be changed """ from sphene.community.models import Group from sphene.sphboard.models import Post,... |
try: upc = self.get(user = user, group = group) except UserPostCount.DoesNotExist: upc = UserPostCount(user = user, group = group) | upc, created = UserPostCount.objects.get_or_create(user = user, group = group) | def update_post_count(self, user, group): if user is None: return None try: upc = self.get(user = user, group = group) except UserPostCount.DoesNotExist: upc = UserPostCount(user = user, group = group) upc.update_post_count() upc.save() return upc.post_count |
qry = qry.filter(category__group__isnull = True).count() | qry = qry.filter(category__group__isnull = True) | def update_post_count(self): qry = self.user.sphboard_post_author_set try: qry = qry.filter(category__group = self.group) except: qry = qry.filter(category__group__isnull = True).count() qry = qry.filter(is_hidden=0) self.post_count = qry.count() |
raise ValidationError( _(u"Uploaded an invalid image.") ) | raise djangoforms.ValidationError( _(u"Uploaded an invalid image.") ) | def clean_community_advprofile_avatar(self): f = self.cleaned_data['community_advprofile_avatar'] if f is None: return f # Verify file size .. size = len(self.cleaned_data['community_advprofile_avatar']) max_size = get_sph_setting( 'community_avatar_max_size' ) if size > max_size: raise djangoforms.ValidationError( _(... |
kwargs = { 'url': 'latest/%d' % self.id } ) | kwargs = { 'category_id': self.id } ) | def get_absolute_url_rss_latest_threads(self): """ Returns the absolute url to the RSS feed displaying the latest threads. This will only work since django changeset 4901 (>0.96) """ return reverse( 'sphboard-feeds', urlconf = get_urlconf(), kwargs = { 'url': 'latest/%d' % self.id } ) |
first_name = forms.CharField(label=_(u'First name')) last_name = forms.CharField(label=_(u'Last name')) | first_name = forms.CharField(label=_(u'First name'), required=False) last_name = forms.CharField(label=_(u'Last name'), required=False) | def is_separator(self): return True |
description="Task type (Maintainer: %s)", | description="Task type (Maintainer: %s)" % maintainer, | def read(*rnames): return open('/'.join(rnames)).read() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.