rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
elif iNetwork.configuredNetworkAdapters.has_key('ath0') is True:
elif 'ath0' in iNetwork.configuredNetworkAdapters:
def ErrorMessageClosed(self, *ret): if iNetwork.configuredNetworkAdapters.has_key('wlan0') is True: self.session.openWithCallback(self.AdapterSetupClosed, AdapterSetupConfiguration, 'wlan0') elif iNetwork.configuredNetworkAdapters.has_key('ath0') is True: self.session.openWithCallback(self.AdapterSetupClosed, AdapterSe...
("Dutch nld", "Dutch"), ("Englisch English", "English"),
("Dutch dut ndl", "Dutch"), ("Englisch English eng", "English"),
def updateDemuxSize(el): enigma.setDemuxSize(int(el.value)) print "[SETTING] getDemuxSize=", enigma.getDemuxSize()
("French", "French"), ("German Deutsch", "German"),
("French fra", "French"), ("German Deutsch deu", "German"),
def updateDemuxSize(el): enigma.setDemuxSize(int(el.value)) print "[SETTING] getDemuxSize=", enigma.getDemuxSize()
("Romanian ron", "Romanian"), ("Russian", "Russian"),
("Romanian ron rum", "Romanian"), ("Russian rus", "Russian"),
def updateDemuxSize(el): enigma.setDemuxSize(int(el.value)) print "[SETTING] getDemuxSize=", enigma.getDemuxSize()
("Spanish", "Spanish"),
("Spanish esp", "Spanish"),
def updateDemuxSize(el): enigma.setDemuxSize(int(el.value)) print "[SETTING] getDemuxSize=", enigma.getDemuxSize()
("Dutch", "Dutch"), ("Englisch English", "English"),
("Dutch dut ndl", "Dutch"), ("Englisch English eng", "English"),
def updateDemuxSize(el): enigma.setDemuxSize(int(el.value)) print "[SETTING] getDemuxSize=", enigma.getDemuxSize()
try: rospy.wait_for_service('tilt_hokuyo_node/set_parameters', 1.0) except rospy.exceptions.ROSException, e: return
try: rospy.wait_for_service('tilt_hokuyo_node/set_parameters', 1.0) except rospy.exceptions.ROSException, e: rospy.logerr("Couldn't set parameters %s" % e) return
def configure_laser(): #TODO: remove hack to get things working in gazebo try: rospy.wait_for_service('tilt_hokuyo_node/set_parameters', 1.0) except rospy.exceptions.ROSException, e: return #end TODO client = dynamic_reconfigure.client.Client('tilt_hokuyo_node') old_config = client.get_configuration(2.0) new_config = ...
client = dynamic_reconfigure.client.Client('tilt_hokuyo_node') old_config = client.get_configuration(2.0) new_config = {'skip': 0, 'intensity': 0, 'min_ang': -1.57, 'max_ang': 1.57, 'calibrate_time': 1, 'cluster': 1, 'time_offset': 0.0} rospy.loginfo('Setting laser to the navigation configuration: %s' % new_config) cli...
client = dynamic_reconfigure.client.Client('tilt_hokuyo_node') global old_config old_config = client.get_configuration(2.0) new_config = {'skip': 0, 'intensity': 0, 'min_ang': -1.57, 'max_ang': 1.57, 'calibrate_time': 1, 'cluster': 1, 'time_offset': 0.0} rospy.loginfo('Setting laser to the navigation configuration: %s'...
def configure_laser(): #TODO: remove hack to get things working in gazebo try: rospy.wait_for_service('tilt_hokuyo_node/set_parameters', 1.0) except rospy.exceptions.ROSException, e: return #end TODO client = dynamic_reconfigure.client.Client('tilt_hokuyo_node') old_config = client.get_configuration(2.0) new_config = ...
try: rospy.wait_for_service('tilt_hokuyo_node/set_parameters', 1.0) except rospy.exceptions.ROSException, e: return
try: rospy.wait_for_service('tilt_hokuyo_node/set_parameters', 1.0) except rospy.exceptions.ROSException, e: rospy.logerr("Couldn't set parameters %s" % e) return
def restore_laser(): #TODO: remove hack to get things working in gazebo try: rospy.wait_for_service('tilt_hokuyo_node/set_parameters', 1.0) except rospy.exceptions.ROSException, e: return #end TODO rospy.loginfo('Setting laser back to this configuration: %s' % old_config) client = dynamic_reconfigure.client.Client('ti...
while not move_base_client.wait_for_result(rospy.Duration(0.1)): if server.is_preempt_requested(): if server.is_new_goal_available(): goal = server.accept_new_goal() move_base_client.send_goal(goal, None, None, feedback_cb) else: move_base_client.cancel_goal()
while not move_base_client.wait_for_result(rospy.Duration(0.1)): if server.is_preempt_requested(): if not server.is_new_goal_available(): move_base_client.cancel_goal() server.set_preempted(MoveBaseResult(), "Got preempted by a new goal") return
def execute_cb(goal): rospy.loginfo("Received a goal") if not set_tilt_profile([1.05, -.7, 1.05], [0.0, 1.8, 2.0125 + .3]): server.set_aborted(MoveBaseResult(), "Couldn't set the profile on the laser") return configure_laser() configure_head() move_base_client.send_goal(goal, None, None, feedback_cb) while not move...
old_config = {}
global old_config old_config = {}
def execute_cb(goal): rospy.loginfo("Received a goal") if not set_tilt_profile([1.05, -.7, 1.05], [0.0, 1.8, 2.0125 + .3]): server.set_aborted(MoveBaseResult(), "Couldn't set the profile on the laser") return configure_laser() configure_head() move_base_client.send_goal(goal, None, None, feedback_cb) while not move...
Construct a new EasyXML node with a certain name. Any keyword arguments are set as attributes on the new element. This should
Construct a new EasyXML node with a certain name. This should
def __init__(self, name): ''' Construct a new EasyXML node with a certain name. Any keyword arguments are set as attributes on the new element. This should only be used to create the root node, all child nodes should be created with the attribute syntax in the above example. ''' self._parent = None self._name = name ...
created with the attribute syntax in the above example.
created with the attribute syntax (see books example above).
def __init__(self, name): ''' Construct a new EasyXML node with a certain name. Any keyword arguments are set as attributes on the new element. This should only be used to create the root node, all child nodes should be created with the attribute syntax in the above example. ''' self._parent = None self._name = name ...
returned element.
returned element to add it.
def __getattr__(self, name): ''' If an element with the given name has already been added, just return that element. Otherwise, return a new element with the given name and this object as a parent. This does NOT add the returned element to this object yet, you still need to call the returned element. ''' if name.star...
timestamp = header.stamp.to_seconds()
timestamp = header.stamp.to_sec()
def callback(data): chatter = data.data header = data.header timestamp = header.stamp.to_seconds() print rospy.get_caller_id(), header.seq, "I just heard that %s at %12f"%(chatter, timestamp)
special_cases = {"start": "html", "page": "html", "style": "css", "functions":"js"}
def get_table_structure(self, table): '''Returns a list of tuples (name, type) with the table columns name and type'''
if element_name in special_cases.keys(): element_type = special_cases[element_name]
if element_name in common.FILE_SPECIAL_CASES.keys(): element_type = common.FILE_SPECIAL_CASES[element_name]
def get_table_structure(self, table): '''Returns a list of tuples (name, type) with the table columns name and type'''
self.paths.append(new_column_path)
new_elements.append(new_column_path) self.paths = self.paths + new_elements
def mknod(self, path, mode, rdev): spath = path.split("/")
result.append(element[0])
result.append(element[0].encode("ascii"))
def get_tables(self): '''Returns a list with the names of the database tables'''
"INTEGER": "int"}
"INTEGER": "int", "BLOB": "jpg"}
def get_table_structure(self, table): '''Returns a list of tuples (name, type) with the table columns name and type'''
response = str(response) else: response = ""
if type(response) == buffer: for b in response: result += b else: result = str(response) result += '\n'
def get_element_data(self, table_name, element_column, element_id): '''Returns the data of a cell'''
response += '\n' return response
return result
def get_element_data(self, table_name, element_column, element_id): '''Returns the data of a cell'''
print " " * idt + "parts[%d].iov_base = null;" % part_idx
print " " * idt + "parts[%d].iov_base = pad.ptr;" % part_idx
def to_iovec(self, idt, ctx_name, part_idx): print if self.length_expr(ctx_name): # FIXME: context pointer for length_expr (?) print " " * idt + "assert (%s == %s.%s.length);" % (self.length_expr(ctx_name), ctx_name,self.name) print " " * idt + "parts[%d].iov_base = %s.%s.ptr;" % (part_idx, ctx_name,self.name) pr...
print " " * idt + "parts[%d].iov_base = null;" % part_idx
print " " * idt + "parts[%d].iov_base = pad.ptr;" % part_idx
def to_iovec(self, idt, ctx_name, part_idx): print print " " * idt + "parts[%d].iov_base = %s.%s.ptr;" % (part_idx, ctx_name,self.list_name) print " " * idt + "parts[%d].iov_len = bitcount(%s.%s) * %s.sizeof;" % (part_idx, ctx_name,self.mask_name, tr('CARD32')) part_idx += 1 print print " " * idt + "parts[%d]....
print " " * idt + "parts[%d].iov_base = null;" % part_idx
print " " * idt + "parts[%d].iov_base = pad.ptr;" % part_idx
def nested_from_bytes(ctx_name, members, idt): var_fields = [i for i in members if type(i) is ListMember] print " " * idt + "auto %s_buf = cast(ubyte*)&%s;" % (ctx_name,ctx_name) if len(var_fields) == 0: print " " * idt + "%s_buf[0..%s.sizeof] = buf[offset_idx..offset_idx+%s.sizeof];" % (ctx_name,ctx_name,ctx_nam...
for d in self.context.getWeekdays(): day = self.context.getDateForWeekday(d)
for d in self.getWeekdays(): day = self.getDateForWeekday(d)
def getEventDisplays(self): all_displays = [] for d in self.context.getWeekdays(): day = self.context.getDateForWeekday(d) self.column_day = day occurrences = self.getOccurrencesInDay(day) displays = [getMultiAdapter([occurrence, self], IEventDisplay) for occurrence in occurrences] # Handle overlapping displays: daygr...
icon = os.path.join('data', 'zim.png') mimedir = os.path.join(self.install_data, 'share', 'mime') for cmd in ( ('update-desktop-database',), ('update-mime-database', mimedir), ): print 'Trying: ' + ' '.join(cmd) subprocess.call(cmd)
if not self.skip_cmd: mimedir = os.path.join(self.install_data, 'share', 'mime') for cmd in ( ('update-desktop-database',), ('update-mime-database', mimedir), ): print 'Trying: ' + ' '.join(cmd) subprocess.call(cmd)
def run(self): install_class.run(self)
text = text.replace('_', '\_')
text = text.replace('\\','SOMETHINGWHICHIHOPEWILLNEVERTURNUPINATEXTOTHERWISETHISWILLSCREWUP') text = text.replace('&','\\&') text = text.replace('$','\\$ ') text = text.replace('^','\\^{}') text = text.replace('%','\\%') text = text.replace(' text = text.replace('_', '\\_') text = text.replace('SOMETHINGWHICHIHOPEWILLN...
def tex_encode(text): if not text is None: text = text.replace('_', '\_') return text else: return ''
output.append(list.text)
output.append(tex_encode(list.text))
def dump_children(self, list, output, list_level = -1): if list.text: output.append(list.text)
if level == 1: output.append('\\chapter{'+element.text+'}') elif level == 2: output.append('\\section{'+element.text+'}') elif level == 3: output.append('\\subsection{'+element.text+'}') elif level == 4: output.append('\\subsubsection{'+element.text+'}') elif level == 4: output.append('\\paragraph{'+element.text+'}')
if level == 1: output.append('\\chapter{'+text+'}') elif level == 2: output.append('\\section{'+text+'}') elif level == 3: output.append('\\subsection{'+text+'}') elif level == 4: output.append('\\subsubsection{'+text+'}') elif level == 4: output.append('\\paragraph{'+text+'}')
def dump_children(self, list, output, list_level = -1): if list.text: output.append(list.text)
output.append(text.element)
output.append(element.text)
def dump_children(self, list, output, list_level = -1): if list.text: output.append(list.text)
output.append('\\includegraphics{%s}'%url_encode(self.linker.link(element.attrib['src'])))
output.append('\\includegraphics{%s}'% self.linker.link(element.attrib['src']))
def dump_children(self, list, output, list_level = -1): if list.text: output.append(list.text)
href = url_encode(self.linker.link(element.attrib['href']))
href = self.linker.link(element.attrib['href'])
def dump_children(self, list, output, list_level = -1): if list.text: output.append(list.text)
output.append('\\emph{'+element.text+'}')
output.append('\\emph{'+text+'}')
def dump_children(self, list, output, list_level = -1): if list.text: output.append(list.text)
output.append('\\textbf{'+element.text+'}')
output.append('\\textbf{'+text+'}')
def dump_children(self, list, output, list_level = -1): if list.text: output.append(list.text)
output.append('\\underline{'+element.text+'}')
output.append('\\underline{'+text+'}')
def dump_children(self, list, output, list_level = -1): if list.text: output.append(list.text)
output.append('\\sout{'+element.text+'}')
output.append('\\sout{'+text+'}')
def dump_children(self, list, output, list_level = -1): if list.text: output.append(list.text)
success = false
success = False
def dump_children(self, list, output, list_level = -1): if list.text: output.append(list.text)
if not delim in element.text: success = true output.append('\\verb'+delim+element.text+delim)
if not delim in text: success = True output.append('\\verb'+delim+text+delim)
def dump_children(self, list, output, list_level = -1): if list.text: output.append(list.text)
output.append(element.tail)
output.append(tex_encode(element.tail))
def dump_children(self, list, output, list_level = -1): if list.text: output.append(list.text)
self.task_labels = [s.strip() for s in self.preferences['labels'].split(',')]
string = self.preferences['labels'].strip(' ,') if string: self.task_labels = [s.strip() for s in self.preferences['labels'].split(',')] else: self.task_labels = []
def _set_preferences(self): self.all_checkboxes = self.preferences['all_checkboxes'] self.task_labels = [s.strip() for s in self.preferences['labels'].split(',')] regex = '(' + '|'.join(map(re.escape, self.task_labels)) + ')' self.task_label_re = re.compile(regex)
self._show_toggle(action, False) if style: action = self.actiongroup.get_action('toggle_format_'+style) if not action is None: self._show_toggle(action, True)
if name == self._current_toggle_action: continue else: action.handler_block_by_func(self.do_toggle_format_action) action.set_active(name == style_toggle) action.handler_unblock_by_func(self.do_toggle_format_action)
def do_textstyle_changed(self, buffer, style): # set statusbar #~ print '>>> SET STYLE', style if style: label = style.title() else: label = 'None' self.ui.mainwindow.statusbar_style_label.set_text(label)
def _show_toggle(self, action, state): action.handler_block_by_func(self.do_toggle_format_action) action.set_active(state) action.handler_unblock_by_func(self.do_toggle_format_action)
def do_textstyle_changed(self, buffer, style): # set statusbar #~ print '>>> SET STYLE', style if style: label = style.title() else: label = 'None' self.ui.mainwindow.statusbar_style_label.set_text(label)
output.append('[['+href+'|'+element.text+']]')
if element.text: output.append('[['+href+'|'+element.text+']]') else: output.append('[['+href+']]')
def dump_children(self, list, output, list_level=-1): if list.text: output.append(list.text)
self.spell.detach()
if textview.gtkspell \ and textview.gtkspell == self.spell: textview.gtkspell.detach() textview.gtkspell = None
def do_toggle_spellcheck(self, enable=None): #~ print 'do_toggle_spellcheck', enable if enable is None: action = self.actiongroup.get_action('toggle_spellcheck') enable = action.get_active()
textview.gtkspell = None
def do_toggle_spellcheck(self, enable=None): #~ print 'do_toggle_spellcheck', enable if enable is None: action = self.actiongroup.get_action('toggle_spellcheck') enable = action.get_active()
templates_model = templates_combobox.get_model() templates_model.clear()
def set_templates(formats_combobox, templates_combobox): format = formats_combobox.get_active_text() # TODO clear templates_combobox template_dict = zim.templates.list_templates(format) templates = sorted(template_dict.keys()) for name in templates: templates_combobox.append_text(name) templates_combobox.append_text(_(...
pass
templates_combobox.set_active(0)
def set_templates(formats_combobox, templates_combobox): format = formats_combobox.get_active_text() # TODO clear templates_combobox template_dict = zim.templates.list_templates(format) templates = sorted(template_dict.keys()) for name in templates: templates_combobox.append_text(name) templates_combobox.append_text(_(...
self.assertEqual(parse_date('1/1'), (today.year, 1, 1)) self.assertEqual(parse_date('1-1'), (today.year, 1, 1)) self.assertEqual(parse_date('1:1'), (today.year, 1, 1)) self.assertEqual(parse_date('11/11'), (today.year, 11, 11))
year = today.year if today.month > 6: year += 1 self.assertEqual(parse_date('1/1'), (year, 1, 1)) self.assertEqual(parse_date('1-1'), (year, 1, 1)) self.assertEqual(parse_date('1:1'), (year, 1, 1))
def testParseDate(self): '''Test parsing dates''' from datetime import date today = date.today() self.assertEqual(parse_date('1/1'), (today.year, 1, 1)) self.assertEqual(parse_date('1-1'), (today.year, 1, 1)) self.assertEqual(parse_date('1:1'), (today.year, 1, 1)) self.assertEqual(parse_date('11/11'), (today.year, 11, ...
if filter(_is_line_based_tag, tags):
if iter.starts_line() and filter(_is_line_based_tag, tags):
def iter_get_zim_tags(self, iter): '''Like gtk.TextIter.get_tags() but only returns our own tags and assumes inline tags (like 'strong', 'emphasis' etc.) have "left gravity". The "line based" tags (like 'indent', 'h', 'pre') gravitate both ways (but not at the same time). This method is used to determing which tags sho...
wimg, himg, gtk.gdk.INTERP_HYPER)
wimg, himg, gtk.gdk.INTERP_NEAREST)
def _render(self): # remove timer if any if self._render_timeout: gobject.source_remove(self._render_timeout)
wimg, himg, gtk.gdk.INTERP_HYPER,
wimg, himg, gtk.gdk.INTERP_NEAREST,
def _render(self): # remove timer if any if self._render_timeout: gobject.source_remove(self._render_timeout)
gtk.VBox.__init__(self)
self._buffer_signals = []
def __init__(self, ui, secondairy=False): self.ui = ui gtk.VBox.__init__(self) self.page = None self.readonly = True self.readonlyset = False self.secondairy = secondairy if secondairy: self.readonlyset = True self.undostack = None self.image_generator_plugins = {}
self._prev_buffer.delete(*self._prev_buffer.get_bounds())
for id in self._buffer_signals: self._prev_buffer.disconnect(id) self._buffer_signals = [] self._prev_buffer.clear()
def set_page(self, page): print 'START set page' # unhook from previous page if self.page: self.page.set_ui_object(None)
buffer.connect('textstyle-changed', self.do_textstyle_changed) buffer.connect('modified-changed', lambda o: self.on_modified_changed(o))
self._buffer_signals.append( buffer.connect('textstyle-changed', self.do_textstyle_changed) ) self._buffer_signals.append( buffer.connect('modified-changed', lambda o: self.on_modified_changed(o)) )
def set_page(self, page): print 'START set page' # unhook from previous page if self.page: self.page.set_ui_object(None)
path = 'notebook-' + dir.path.replace('/', '_').strip('_')
if os.name == 'nt': path = 'notebook-' + dir.path.replace('\\', '_').replace(':', '').strip('_') else: path = 'notebook-' + dir.path.replace('/', '_').strip('_')
def _cache_dir(self, dir): from zim.config import XDG_CACHE_HOME path = 'notebook-' + dir.path.replace('/', '_').strip('_') return XDG_CACHE_HOME.subdir(('zim', path))
output.extend(eqfid.readlines())
output.extend(eqfid.read().strip())
def dump_children(self, list, output, list_level = -1): if list.text: output.append(tex_encode(list.text))
return url_encode(path)
return url_encode(path.replace(' ', '_'))
def page(self, link): try: page = self.notebook.resolve_path(link, source=self.path) except PageNameError: return '' else: if page == self.path: return ''
ezdefaults['scheduler'] = scheduler.mpirun
ezdefaults['scheduler'] = scheduler().mpirun
def ez_map(func, *arglist, **kwds): """higher-level map interface for selected mapper and launcher
ezdefaults['scheduler'] = scheduler.srun
ezdefaults['scheduler'] = scheduler().srun
def ez_map(func, *arglist, **kwds): """higher-level map interface for selected mapper and launcher
ezdefaults['scheduler'] = scheduler.mpirun
ezdefaults['scheduler'] = scheduler().mpirun
def ez_map2(func, *arglist, **kwds): """higher-level map interface for selected mapper and launcher
ezdefaults['scheduler'] = scheduler.srun
ezdefaults['scheduler'] = scheduler().srun
def ez_map2(func, *arglist, **kwds): """higher-level map interface for selected mapper and launcher
return self.cmd(self.command() + ' co ' + quiet_option + '"' + self.src + '/" "' + path([base, self.name]) + '"')
return self.cmd(self.command() + ' co ' + quiet_option + '"' + self.src + '/@" "' + path([base, self.name]) + '"')
def add(self, base, quiet = False): '''Add overlay.'''
return self.cmd(self.command() + ' up ' + quiet_option + '"' + path([base, self.name]) + '"')
return self.cmd(self.command() + ' up ' + quiet_option + '"' + path([base, self.name + '@']) + '"')
def sync(self, base, quiet = False): '''Sync overlay.'''
'"' + path([base, self.parent.name + '@']) + '"')
'"' + checkout_location() + '"')
def sync(self, base, quiet = False): '''Sync overlay.'''
self.description = ensure_unicode(_desc.text.strip())
d = WHITESPACE_REGEX.sub(' ', _desc.text.strip()) self.description = ensure_unicode(d) del d
def create_overlay_source(source_elem): _type = source_elem.attrib['type'] try: _class = OVERLAY_TYPES[_type] except KeyError: raise Exception('Unknown overlay type "%s"!' % _type) _location = ensure_unicode(source_elem.text.strip()) return _class(self, xml, config, _location, ignore, quiet)
Type : None; Priority: 10
Type : Subversion; Priority: 10
def __str__(self): ''' >>> here = os.path.dirname(os.path.realpath(__file__)) >>> import xml.etree.ElementTree as ET # Python 2.5 >>> document = ET.parse(here + '/../tests/testfiles/global-overlays.xml') >>> overlays = document.findall('overlay') + document.findall('repo') >>> a = Overlay(overlays[0], dict()) >>> print...
wrobel [None ] (https://o.g.o/svn/dev/wrobel )
wrobel [Subversion] (https://o.g.o/svn/dev/wrobel )
def short_list(self, width = 0): ''' >>> here = os.path.dirname(os.path.realpath(__file__)) >>> import xml.etree.ElementTree as ET # Python 2.5 >>> document = ET.parse(here + '/../tests/testfiles/global-overlays.xml') >>> overlays = document.findall('repo') + document.findall('overlay') >>> a = Overlay(overlays[0], dic...
if not os.access(mpath, os.W_OK): OUT.warn('You do not have permission to update the cache.')
if os.path.exists(mpath) and not os.access(mpath, os.W_OK): OUT.warn('You do not have permission to update the cache (%s).' % mpath)
def cache(self): ''' Copy the remote overlay list to the local cache.
return
continue
def cache(self): ''' Copy the remote overlay list to the local cache.
result += u'\nType : ' + self.type
if len(self.sources) == 1: result += u'\nType : ' + self.sources[0].type else: result += u'\nType : ' + '/'.join(sorted(set(e.type for e in self.sources)))
def __str__(self): ''' >>> here = os.path.dirname(os.path.realpath(__file__)) >>> import xml.etree.ElementTree as ET # Python 2.5 >>> document = ET.parse(here + '/../tests/testfiles/global-overlays.xml') >>> overlays = document.findall('overlay') + document.findall('repo') >>> a = Overlay(overlays[0], dict()) >>> print...
mtype = ' [' + pad(self.type, 10) + ']'
if len(set(e.type for e in self.sources)) == 1: _type = self.sources[0].type else: _type = '%s/..' % self.sources[0].type mtype = ' [' + pad(_type, 10) + ']'
def terminal_width(): '''Determine width of terminal window.''' try: width = int(os.environ['COLUMNS']) if width > 0: return width except: pass try: import struct, fcntl, termios query = struct.pack('HHHH', 0, 0, 0, 0) response = fcntl.ioctl(1, termios.TIOCGWINSZ, query) width = struct.unpack('HHHH', response)[1] if wi...
>>> a = DummyTar()
>>> from layman.overlays.overlay import Overlay >>> a = Overlay(repo, config, quiet=False)
... def __init__(self):
def add(self, base, quiet = False): '''Add overlay.''' self.supported() mdir = path([base, self.parent.name]) if os.path.exists(mdir): raise Exception('Directory ' + mdir + ' already exists. Will not ov' 'erwrite its contents!')
def _extract(self, base, tar_url, dest_dir):
def add(self, base, quiet = False): '''Add overlay.'''
tar = urllib2.urlopen(self.src).read()
tar = urllib2.urlopen(tar_url).read()
def add(self, base, quiet = False): '''Add overlay.'''
if self.subpath: target = path([base, 'tmp']) else: target = mdir os.makedirs(target)
def add(self, base, quiet = False): '''Add overlay.'''
+ u'" -C "' + target + u'"') if self.subpath: source = target + '/' + self.subpath
+ u'" -C "' + dest_dir + u'"') os.unlink(pkg) return result def _add_unchecked(self, base, quiet): final_path = path([base, self.parent.name]) temp_path = tempfile.mkdtemp(dir=base) result = self._extract(base=base, tar_url=self.src, dest_dir=temp_path) if result == 0: if self.subpath: source = temp_path + '/' + self...
def add(self, base, quiet = False): '''Add overlay.'''
os.rename(source, mdir)
os.rename(source, final_path)
def add(self, base, quiet = False): '''Add overlay.'''
source + ' to ' + mdir + '\nError was:'
source + ' to ' + final_path + '\nError was:'
def add(self, base, quiet = False): '''Add overlay.'''
shutil.rmtree(target)
OUT.info('Deleting directory "%s"' % temp_path, 2) shutil.rmtree(temp_path)
def add(self, base, quiet = False): '''Add overlay.'''
+ target + '"\nError was:' + str(error)) os.unlink(pkg)
+ temp_path + '"\nError was:' + str(error))
def add(self, base, quiet = False): '''Add overlay.'''
self.delete(base) self.add(base)
self._add_unchecked(base, quiet)
def sync(self, base, quiet = False): '''Sync overlay.'''
'owner_name', 'priority', 'src', 'status'):
'owner_name', 'priority', 'status'):
def __eq__(self, other): for i in ('description', 'homepage', 'name', 'owner_email', 'owner_name', 'priority', 'src', 'status'): if getattr(self, i) != getattr(other, i): return False return True
mth = ['*'], obj = ['*'], var = ['*']):
mth = None, obj = None, var = None): if mth == None: mth = ['*'] if obj == None: obj = ['*'] if var == None: var = ['*']
def __init__(self, module = '', err = sys.stderr, dbg = sys.stderr, debugging_level = 4, debugging_verbosity = 2, info_level = 4, warn_level = 4, col = True, mth = ['*'], obj = ['*'], var = ['*']):
for line in f: if (not line.startswith(' break
def IsFailureOutput(self, output): f = file(self.expected) # Skip initial '#' comment and spaces for line in f: if (not line.startswith('#')) and (not line.strip()): break # Convert output lines to regexps that we can match env = { 'basename': basename(self.file) } patterns = [ ] for line in f: if not line.strip(): con...
self.default_install_path = '${PREFIX_NODE}/lib/node/libraries'
self.default_install_path = self.env['NODE_PATH']
def init_node_addon(self): self.default_install_path = '${PREFIX_NODE}/lib/node/libraries' self.uselib = self.to_list(getattr(self, 'uselib', '')) if not 'NODE' in self.uselib: self.uselib.append('NODE') self.env['MACBUNDLE'] = True
print e
def set(self, key, val, **kw): try: self.call_db(key, 'put', key, val) return True except Exception, e: print e return False
def drawsquare(pos, size, texture, level=0.0): texture() glPushMatrix() glTranslate(pos[0], pos[1], 0) glBegin(GL_QUADS) glTexCoord(0.0, 0.0) glVertex(0.0, 0.0, level) glTexCoord(0.0, 1.0) glVertex(0.0, size[1], level) glTexCoord(1.0, 1.0) glVertex(size[0], size[1], level) glTexCoord(1.0, 0.0) glVertex(size[0], 0.0, le...
def transitionto(world): global currentworld currentworld = world(currentworld)
pos[0] = (pos[0] - 0.25) / 0.75
pos[0] = (pos[0]) / 0.75
def worldpos2gridpos(pos, hexsize): pos = [x/hexsize for x in pos] pos[0] = (pos[0] - 0.25) / 0.75 pos[0] = int(math.floor(pos[0] + 0.5)) pos[1] /= math.sqrt(3)/2 if pos[0] % 2 == 0: pos[1] -= 0.5 pos[1] = int(math.floor(pos[1] + 0.5)) return pos
print (size, 0), (size/2, size*math.sqrt(3)/2), (-size/2, size*math.sqrt(3)/2), (-size, 0), (-size/2, -size*math.sqrt(3)/2), (size/2, -size*math.sqrt(3)/2)
def drawhex(pos, size): size = float(size)/2 glPushMatrix() glTranslate(pos[0], pos[1], 0) glBegin(GL_TRIANGLE_FAN) glVertex(size, 0) glVertex(size/2, size*math.sqrt(3)/2) glVertex(-size/2, size*math.sqrt(3)/2) glVertex(-size, 0) glVertex(-size/2, -size*math.sqrt(3)/2) glVertex(size/2, -size*math.sqrt(3)/2) glEnd() glP...
drawhex((x * hexsize * 0.75 + 0.25, y * hexsize * math.sqrt(3)/2), hexsize * 0.98)
drawhex((x * hexsize * 0.75 + 0.25 * hexsize, y * hexsize * math.sqrt(3)/2), hexsize * 0.98)
def drawhexgrid(gridsize, hexsize): for x in xrange(gridsize[0]): for y in xrange(gridsize[1]): if x % 2 == 0: drawhex((x * hexsize * 0.75 + 0.25, y * hexsize * math.sqrt(3)/2), hexsize * 0.98) else: drawhex((x * hexsize * 0.75 + 0.25, y * hexsize * math.sqrt(3)/2 + math.sqrt(3)/4), hexsize * 0.98)
drawhex((x * hexsize * 0.75 + 0.25, y * hexsize * math.sqrt(3)/2 + math.sqrt(3)/4), hexsize * 0.98)
drawhex((x * hexsize * 0.75 + 0.25 * hexsize, y * hexsize * math.sqrt(3)/2 + math.sqrt(3)/4 * hexsize), hexsize * 0.98)
def drawhexgrid(gridsize, hexsize): for x in xrange(gridsize[0]): for y in xrange(gridsize[1]): if x % 2 == 0: drawhex((x * hexsize * 0.75 + 0.25, y * hexsize * math.sqrt(3)/2), hexsize * 0.98) else: drawhex((x * hexsize * 0.75 + 0.25, y * hexsize * math.sqrt(3)/2 + math.sqrt(3)/4), hexsize * 0.98)
if 0 > adj[0] or adj[0] >= 12 or 0 > adj[1] or adj[1] >= 8:
if 0 > adj[0] or adj[0] >= self.size[0] or 0 > adj[1] or adj[1] >= self.size[1]:
def worldstep(self, dt): for x in xrange(self.size[0]): for y in xrange(self.size[1]): tile = self.worldstate[x][y] if not tile['zombie'] > 1: normpop = tile['hpop'] / tile['food'] tile['hpop'] += normpop * (1 - normpop) * dt * tile['food'] / 10 tile['hpop'] = max(0, tile['hpop']) zombiegrowth = min(tile['hpop'], tile[...
if self.parent.id != 'TEXT' and isinstance(self.parent.value, AttributeValue):
if self.inherited:
def foreground(self): if self.parent.id != 'TEXT' and isinstance(self.parent.value, AttributeValue): return self.parent.value.foreground if self.default_fore: return self.transform(self.default_fore) if self.parent.id != "TEXT": return self.parent.value.foreground return None
if self.parent.id != 'TEXT' and isinstance(self.parent.value, AttributeValue):
if self.inherited:
def background(self): if self.parent.id != 'TEXT' and isinstance(self.parent.value, AttributeValue): return self.parent.value.background if self.default_back: return self.transform(self.default_back, 0 if self.default_fore else 0.15) if self.parent.id != "TEXT": return self.parent.value.background return None
if self.parent.id != 'TEXT' and isinstance(self.parent.value, AttributeValue):
if self.inherited:
def effect_color(self): if self.parent.id != 'TEXT' and isinstance(self.parent.value, AttributeValue): return self.parent.value.effect_color if self.default_effect_color: return self.transform(self.default_effect_color) if self.parent.id != "TEXT": return self.parent.value.effect_color return None
load_default_attributes('C:/JetBrains/IDEA/community/platform/platform-resources/src/DefaultColorSchemesManager.xml')
load_default_attributes('DefaultColorSchemesManager.xml')
def load_default_attributes(scheme_path): scheme = ET.ElementTree(file=scheme_path) attributes = scheme.findall('.//attributes/option') for attr in attributes: name = attr.attrib.get('name') options = attr.findall('./value/option') attr_value = DerivedAttributeValue() for option in options: option_name = option.attrib....
"DIFF_CONFLICT"
"DIFF_CONFLICT", "CUSTOM_KEYWORD1_ATTRIBUTES", "CUSTOM_KEYWORD2_ATTRIBUTES", "CUSTOM_KEYWORD3_ATTRIBUTES", "CUSTOM_KEYWORD4_ATTRIBUTES", "BREAKPOINT_ATTRIBUTES", "EXECUTIONPOINT_ATTRIBUTES"
def load_default_attributes(scheme_path): scheme = ET.ElementTree(file=scheme_path) attributes = scheme.findall('.//attributes/option') for attr in attributes: name = attr.attrib.get('name') options = attr.findall('./value/option') attr_value = DerivedAttributeValue() for option in options: option_name = option.attrib....
opSign = Attribute("JAVA_OPERATION_SIGN", text, scope='punctuation') parenths = Attribute("JAVA_PARENTH", opSign) brackets = Attribute("JAVA_BRACKETS", opSign) braces = Attribute("JAVA_BRACES", opSign) comma = Attribute("JAVA_COMMA", opSign) dot = Attribute("JAVA_DOT", opSign) semicolon = Attribute("JAVA_SEMICOLON", op...
opSign = Attribute("JAVA_OPERATION_SIGN", text, scope='keyword.operator') parenths = Attribute("JAVA_PARENTH", text, scope='punctuation') brackets = Attribute("JAVA_BRACKETS", text, scope='punctuation') braces = Attribute("JAVA_BRACES", text, scope='punctuation') comma = Attribute("JAVA_COMMA", text, scope='punctuation...
def load_default_attributes(scheme_path): scheme = ET.ElementTree(file=scheme_path) attributes = scheme.findall('.//attributes/option') for attr in attributes: name = attr.attrib.get('name') options = attr.findall('./value/option') attr_value = DerivedAttributeValue() for option in options: option_name = option.attrib....
py_comment = Attribute("PY.COMMENT", line_comment)
py_comment = Attribute("PY.LINE_COMMENT", line_comment)
def load_default_attributes(scheme_path): scheme = ET.ElementTree(file=scheme_path) attributes = scheme.findall('.//attributes/option') for attr in attributes: name = attr.attrib.get('name') options = attr.findall('./value/option') attr_value = DerivedAttributeValue() for option in options: option_name = option.attrib....