rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
else: regExpParser = re.compile('Protection.*: d') if ( regExpParser.match(fileclassDirCheckOutput) == None): raise StageOutError("Output path is not a directory !")
def createOutputDirectory(self, targetPFN): """ _createOutputDirectory_
self.createDir(targetDir, self.permissions) else: regExpParser = re.compile('Protection.*: d') if ( regExpParser.match(targetDirCheckOutput) == None): raise StageOutError("Output path is not a directory !")
self.createDir(targetDir)
def createOutputDirectory(self, targetPFN): """ _createOutputDirectory_
def createDir(self, directory, mode):
def checkDirExists(self, directory): """ _checkDirExists_ Check if directory exists (will fail if it exists as a file) """ command = "rfstat %s 2> /dev/null | grep Protection" % directory print "Check dir existence : %s" % command try: exitCode, output = runCommandWithOutput(command) except Exception, ex: msg = "Erro...
def createDir(self, directory, mode): """ _createDir_
Creates directory with no permissions """ cmd = "nsmkdir -m %s -p \"%s\"" % (mode, directory) execute(cmd)
Creates directory with correct permissions """ command = "(umask %s ; nsmkdir -m %s -p \"%s\")" % (self.umask, self.permissions, directory) execute(command)
def createDir(self, directory, mode): """ _createDir_
args['producer'] = 'ProdSys' args['step'] = 'Pass-1'
def httpPost(self, analysisFile): """ _httpPost_
args['workflow'] = self.inputDataset args['mssname'] = self.mssNames[filename]
def httpPost(self, analysisFile): """ _httpPost_
edit_toolbar_button, accelerator='<Ctrl>c')
edit_toolbar, accelerator='<Ctrl>c')
def _setup_toolbars(self, have_toolbox): """ Setup the toolbars.. """ project_toolbar = gtk.Toolbar() custom_slide_toolbar = gtk.Toolbar() custom_stator_toolbar = gtk.Toolbar() edit_toolbar = gtk.Toolbar()
edit_toolbar_button, accelerator='<Ctrl>v')
edit_toolbar, accelerator='<Ctrl>v')
def _setup_toolbars(self, have_toolbox): """ Setup the toolbars.. """ project_toolbar = gtk.Toolbar() custom_slide_toolbar = gtk.Toolbar() custom_stator_toolbar = gtk.Toolbar() edit_toolbar = gtk.Toolbar()
if self.sr.last is not None: data = self.sr.last.labels[0] if data is not None: clipBoard.set_text(str(data))
if self.sr.last is None and self.sr.last.labels[0] is not None: clipBoard.set_text(self.sr.last.labels[0])
def _copy_cb(self, arg=None): """ Copy a number to the clipboard from the active slide. """ clipBoard = gtk.Clipboard() if self.sr.last is not None: data = self.sr.last.labels[0] if data is not None: clipBoard.set_text(str(data)) return
def _show_slides(self, top, bottom, function):
def _show_slides(self, slide, stator, function):
def _show_slides(self, top, bottom, function): self._hide_all() self._top_combo.set_active(_SLIDES.index(top)) self.set_slide() self._bottom_combo.set_active(_STATORS.index(bottom)) self.set_stator() self._function_combo.set_active(_FUNCTIONS.index(function)) self.sr.update_slide_labels() self.sr.update_results_label()
self._top_combo.set_active(_SLIDES.index(top))
self._slide_combo.set_active(_SLIDES.index(slide))
def _show_slides(self, top, bottom, function): self._hide_all() self._top_combo.set_active(_SLIDES.index(top)) self.set_slide() self._bottom_combo.set_active(_STATORS.index(bottom)) self.set_stator() self._function_combo.set_active(_FUNCTIONS.index(function)) self.sr.update_slide_labels() self.sr.update_results_label()
self._bottom_combo.set_active(_STATORS.index(bottom))
self._stator_combo.set_active(_STATORS.index(stator))
def _show_slides(self, top, bottom, function): self._hide_all() self._top_combo.set_active(_SLIDES.index(top)) self.set_slide() self._bottom_combo.set_active(_STATORS.index(bottom)) self.set_stator() self._function_combo.set_active(_FUNCTIONS.index(function)) self.sr.update_slide_labels() self.sr.update_results_label()
self._show_slides(_L, _L2, _FL)
self._show_slides(_L, _L, _FL)
def show_l(self): """ linear scale """ self.sr.active_slide = self.sr.name_to_slide('L') self.sr.active_stator = self.sr.name_to_stator('L2') self._show_slides(_L, _L2, _FL)
def _top_combo_cb(self, arg=None):
def _slide_combo_cb(self, arg=None):
def _top_combo_cb(self, arg=None): """ Read value from slide combo box """ _top_dictionary = {_C: 'C', _CI: 'CI', _A: 'A', _K: 'K', _S: 'S', _T: 'T', _L: 'L', _LL0: 'LL0', _LLn: 'LLn', _UD: 'custom'} self.sr.active_slide = self.sr.name_to_slide(_top_dictionary[ _SLIDES[self._top_combo.get_active()]]) function = self._p...
_SLIDES[self._top_combo.get_active()]])
_SLIDES[self._slide_combo.get_active()]])
def _top_combo_cb(self, arg=None): """ Read value from slide combo box """ _top_dictionary = {_C: 'C', _CI: 'CI', _A: 'A', _K: 'K', _S: 'S', _T: 'T', _L: 'L', _LL0: 'LL0', _LLn: 'LLn', _UD: 'custom'} self.sr.active_slide = self.sr.name_to_slide(_top_dictionary[ _SLIDES[self._top_combo.get_active()]]) function = self._p...
def _bottom_combo_cb(self, arg=None):
def _stator_combo_cb(self, arg=None):
def _bottom_combo_cb(self, arg=None): """ Read value from stator combo box """ _bottom_dictionary = {_D: 'D', _DI: 'DI', _L: 'L2', _B: 'B', _K: 'K2', _S: 'S2', _T: 'T2', _LL0: 'LL02', _LLn: 'LLn2', _UD: 'custom2'} self.sr.active_stator = self.sr.name_to_stator(_bottom_dictionary[ _STATORS[self._bottom_combo.get_active(...
_STATORS[self._bottom_combo.get_active()]])
_STATORS[self._stator_combo.get_active()]])
def _bottom_combo_cb(self, arg=None): """ Read value from stator combo box """ _bottom_dictionary = {_D: 'D', _DI: 'DI', _L: 'L2', _B: 'B', _K: 'K2', _S: 'S2', _T: 'T2', _LL0: 'LL02', _LLn: 'LLn2', _UD: 'custom2'} self.sr.active_stator = self.sr.name_to_stator(_bottom_dictionary[ _STATORS[self._bottom_combo.get_active(...
self._top_combo = _combo_factory(_SLIDES, _C, _('slides'), self._top_combo_cb,
self._slide_combo = _combo_factory(_SLIDES, _C, _('slides'), self._slide_combo_cb,
def _setup_toolbars(self, have_toolbox): """ Setup the toolbars.. """
self._bottom_combo = _combo_factory(_STATORS, _D, _('stators'), self._bottom_combo_cb, project_toolbar)
self._stator_combo = _combo_factory(_STATORS, _D, _('stators'), self._stator_combo_cb, project_toolbar)
def _setup_toolbars(self, have_toolbox): """ Setup the toolbars.. """
list = self.list
list = self.list[:]
def find_sprite(self, pos): list = self.list list.reverse() for spr in list: if spr.hit(pos): return spr return None
if self.sr.last is None and self.sr.last.labels[0] is not None:
if self.sr.last is not None and self.sr.last.labels[0] is not None:
def _copy_cb(self, arg=None): """ Copy a number to the clipboard from the active slide. """ clipBoard = gtk.Clipboard() if self.sr.last is None and self.sr.last.labels[0] is not None: clipBoard.set_text(self.sr.last.labels[0]) return
self.parent._min_entry.set_text('NaN')
self.parent._domain_min[slide].set_text('NaN')
def make_custom_slide(self, offset_text, label_text, calculate_text, min_text, max_text, step_text, slide): """ Create custom slide and stator from text entered on toolbar. """ try: min_value = float(min_text) except ValueError: self.parent._min_entry.set_text('NaN') return try: max_value = float(max_text) except Value...
self.parent._max_entry.set_text('NaN')
self.parent._domain_max[slide].set_text('NaN')
def make_custom_slide(self, offset_text, label_text, calculate_text, min_text, max_text, step_text, slide): """ Create custom slide and stator from text entered on toolbar. """ try: min_value = float(min_text) except ValueError: self.parent._min_entry.set_text('NaN') return try: max_value = float(max_text) except Value...
self.parent._step_entry.set_text('NaN')
self.parent._step_size[slide].set_text('NaN')
def make_custom_slide(self, offset_text, label_text, calculate_text, min_text, max_text, step_text, slide): """ Create custom slide and stator from text entered on toolbar. """ try: min_value = float(min_text) except ValueError: self.parent._min_entry.set_text('NaN') return try: max_value = float(max_text) except Value...
scale *= float(SWIDTH - 2 * OFFSET) / SCALE
def mark(self, offset, height3, height2, height1, string=None, flip=False, scale=1.0): """ Plot marks in a range from 1 to 10 along the length of the slide """ svg = '' scale *= float(SWIDTH - 2 * OFFSET) / SCALE if flip: ln = (log10 - offset) * SCALE * scale + OFFSET else: ln = offset * SCALE * scale + OFFSET if strin...
ln = (log10 - offset) * SCALE * scale + OFFSET else: ln = offset * SCALE * scale + OFFSET
log = (log10 - offset) * SCALE * scale + OFFSET else: log = offset * SCALE * scale + OFFSET
def mark(self, offset, height3, height2, height1, string=None, flip=False, scale=1.0): """ Plot marks in a range from 1 to 10 along the length of the slide """ svg = '' scale *= float(SWIDTH - 2 * OFFSET) / SCALE if flip: ln = (log10 - offset) * SCALE * scale + OFFSET else: ln = offset * SCALE * scale + OFFSET if strin...
svg += ' x="%0.2f"\n' % (ln)
svg += ' x="%0.2f"\n' % (log)
def mark(self, offset, height3, height2, height1, string=None, flip=False, scale=1.0): """ Plot marks in a range from 1 to 10 along the length of the slide """ svg = '' scale *= float(SWIDTH - 2 * OFFSET) / SCALE if flip: ln = (log10 - offset) * SCALE * scale + OFFSET else: ln = offset * SCALE * scale + OFFSET if strin...
svg += ' d="M %0.2f,%d,%0.2f,%d"\n' % (ln, height1, ln, height2)
svg += ' d="M %0.2f,%d,%0.2f,%d"\n' % (log, height1, log, height2)
def mark(self, offset, height3, height2, height1, string=None, flip=False, scale=1.0): """ Plot marks in a range from 1 to 10 along the length of the slide """ svg = '' scale *= float(SWIDTH - 2 * OFFSET) / SCALE if flip: ln = (log10 - offset) * SCALE * scale + OFFSET else: ln = offset * SCALE * scale + OFFSET if strin...
scale *= float(SWIDTH - 2 * OFFSET) / SCALE
def special_mark(self, offset, height3, height2, height1, string, flip=False, scale=1.0): """ Plot special marks, e.g., e and pi """ svg = '' scale *= float(SWIDTH - 2 * OFFSET) / SCALE if flip: ln = (log10 - offset) * SCALE * scale + OFFSET else: ln = offset * SCALE * scale + OFFSET svg += ' <text style="font-size:12...
ln = (log10 - offset) * SCALE * scale + OFFSET else: ln = offset * SCALE * scale + OFFSET
log = (log10 - offset) * SCALE * scale + OFFSET else: log = offset * SCALE * scale + OFFSET
def special_mark(self, offset, height3, height2, height1, string, flip=False, scale=1.0): """ Plot special marks, e.g., e and pi """ svg = '' scale *= float(SWIDTH - 2 * OFFSET) / SCALE if flip: ln = (log10 - offset) * SCALE * scale + OFFSET else: ln = offset * SCALE * scale + OFFSET svg += ' <text style="font-size:12...
svg += ' x="%0.2f"\n' % (ln)
svg += ' x="%0.2f"\n' % (log)
def special_mark(self, offset, height3, height2, height1, string, flip=False, scale=1.0): """ Plot special marks, e.g., e and pi """ svg = '' scale *= float(SWIDTH - 2 * OFFSET) / SCALE if flip: ln = (log10 - offset) * SCALE * scale + OFFSET else: ln = offset * SCALE * scale + OFFSET svg += ' <text style="font-size:12...
svg += ' d="M %0.2f,%d,%0.2f,%d"\n' % (ln, height1, ln, height2)
svg += ' d="M %0.2f,%d,%0.2f,%d"\n' % (log, height1, log, height2)
def special_mark(self, offset, height3, height2, height1, string, flip=False, scale=1.0): """ Plot special marks, e.g., e and pi """ svg = '' scale *= float(SWIDTH - 2 * OFFSET) / SCALE if flip: ln = (log10 - offset) * SCALE * scale + OFFSET else: ln = offset * SCALE * scale + OFFSET svg += ' <text style="font-size:12...
scale *= float(SWIDTH - 2 * OFFSET) / SCALE
def mark(self, offset, height3, height2, height1, string=None, flip=False, scale=1.0): """ Plot marks in a range from 1 to 10 along the length of the slide """ svg = '' scale *= float(SWIDTH - 2 * OFFSET) / SCALE if flip: ln = (log10 - offset) * SCALE * scale + OFFSET else: ln = offset * SCALE * scale + OFFSET if strin...
scale *= float(SWIDTH - 2 * OFFSET) / SCALE
def mark(self, offset, height3, height2, height1, string=None, flip=False, scale=1.0): """ Plot marks in a range from 1 to 10 along the length of the slide """ svg = '' scale *= float(SWIDTH - 2 * OFFSET) / SCALE if flip: ln = (log10 - offset) * SCALE * scale + OFFSET else: ln = offset * SCALE * scale + OFFSET if strin...
return math.exp(x / 1000.)
return math.pow(10, x / 1000.)
def label_function(x): return math.exp(x / 1000.)
y = math.pow(10, precision)
y = pow(10, precision)
def round(x, precision=2): if precision == 2: return(float(int(x * 100 + 0.5) / 100.)) elif precision == 1: return(float(int(x * 10 + 0.5) / 10.)) elif precision == 0: return(int(x + 0.5)) else: y = math.pow(10, precision) return(float(int(x * y + 0.5) / y))
return round(math.exp(dx / SCALE) * rescale)
return round(exp(dx / SCALE) * rescale)
def _calc_log(dx): """ C and D scales """ rescale = 1 if dx < 0: rescale = 0.1 dx += SWIDTH - (2.0 * OFFSET) return round(math.exp(dx / SCALE) * rescale)
return round(10.0/ math.exp(dx / SCALE) * rescale)
return round(10.0 / exp(dx / SCALE) * rescale)
def _calc_inverse_log(dx): """ CI and DI scales """ rescale = 1 if dx < 0: rescale = 0.1 dx += SWIDTH - (2.0 * OFFSET) return round(10.0/ math.exp(dx / SCALE) * rescale)
A = math.exp(2 * dx / SCALE) * rescale
A = exp(2 * dx / SCALE) * rescale
def _calc_log_squared(dx): """ A and B scales """ rescale = 1 if dx < 0: dx += SWIDTH - (2.0 * OFFSET) rescale = 0.01 A = math.exp(2 * dx / SCALE) * rescale if A > 50: return round(A, 1) else: return round(A)
K = math.exp(3 * dx / SCALE) * rescale
K = exp(3 * dx / SCALE) * rescale
def _calc_log_cubed(dx): """ K scale """ rescale = 1 if dx < 0: rescale = 0.001 dx += SWIDTH - (2.0 * OFFSET) K = math.exp(3 * dx / SCALE) * rescale if K > 500: return round(K, 0) elif K > 50: return round(K, 1) else: return round(K)
LL0 = math.exp(math.exp(dx / SCALE) / 1000)
LL0 = exp(exp(dx / SCALE) / 1000)
def _calc_log_log(dx): """ LL0 scale """ if dx < 0: dx += SWIDTH - (2.0 * OFFSET) LL0 = math.exp(math.exp(dx / SCALE) / 1000) if LL0 > 1.002: return round(LL0, 5) else: return round(LL0, 6)
return round(10 * ((dx / SCALE) / math.log(10) - 1.0))
return round(10 * ((dx / SCALE) / log(10) - 1.0))
def _calc_linear(dx): """ L scale """ if dx < 0: dx += SWIDTH - (2.0 * OFFSET) return round(10 * ((dx / SCALE) / math.log(10) - 1.0)) else: return round(10 * (dx / SCALE) / math.log(10))
return round(10 * (dx / SCALE) / math.log(10))
return round(10 * (dx / SCALE) / log(10))
def _calc_linear(dx): """ L scale """ if dx < 0: dx += SWIDTH - (2.0 * OFFSET) return round(10 * ((dx / SCALE) / math.log(10) - 1.0)) else: return round(10 * (dx / SCALE) / math.log(10))
s = math.exp(dx)/10
s = exp(dx)/10
def _calc_sine(dx): """ S scale """ dx /= SCALE s = math.exp(dx)/10 if s > 1.0: s = 1.0 S = 180.0 * math.asin(s) / math.pi if S > 60: return round(S, 1) else: return round(S)
S = 180.0 * math.asin(s) / math.pi
S = 180.0 * asin(s) / pi
def _calc_sine(dx): """ S scale """ dx /= SCALE s = math.exp(dx)/10 if s > 1.0: s = 1.0 S = 180.0 * math.asin(s) / math.pi if S > 60: return round(S, 1) else: return round(S)
t = math.exp(dx)/10
t = exp(dx)/10
def _calc_tangent(dx): """ T scale """ dx /= SCALE t = math.exp(dx)/10 if t > 1.0: t = 1.0 return round(180.0 * math.atan(t) / math.pi)
return round(180.0 * math.atan(t) / math.pi)
return round(180.0 * atan(t) / pi)
def _calc_tangent(dx): """ T scale """ dx /= SCALE t = math.exp(dx)/10 if t > 1.0: t = 1.0 return round(180.0 * math.atan(t) / math.pi)
600, SHEIGHT)
800, SHEIGHT)
def __init__(self, canvas, path, parent=None): """ Handle launch from both within and without of Sugar environment. """ SLIDES = {'C':[C_slide, self._calc_C], 'CI':[CI_slide, self._calc_CI], 'A':[A_slide, self._calc_A], 'K':[K_slide, self._calc_K], 'S':[S_slide, self._calc_S], 'T':[T_slide, self._calc_T], 'L':[L_slide,...
self.make_custom_slide('math.log(x, 10)', 'x', 'math.exp(x)', 1, 10, 1)
self.make_custom_slide('log(x, 10)', 'x', 'exp(x)', 1, 10, 1)
def __init__(self, canvas, path, parent=None): """ Handle launch from both within and without of Sugar environment. """ SLIDES = {'C':[C_slide, self._calc_C], 'CI':[CI_slide, self._calc_CI], 'A':[A_slide, self._calc_A], 'K':[K_slide, self._calc_K], 'S':[S_slide, self._calc_S], 'T':[T_slide, self._calc_T], 'L':[L_slide,...
if k == 'a':
if k in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'period', 'minus', 'Return', 'BackSpace']: if self.reticule.match(self.last): if self.last == self.reticule.tabs[TOP].spr: self._process_numeric_input(self.last, k) elif k == 'a':
def _keypress_cb(self, area, event): """ Keypress: moving the slides with the arrow keys """ k = gtk.gdk.keyval_name(event.keyval) if self.parent == None: return if k == 'a': self.parent.show_a() elif k == 'k': self.parent.show_k() elif k == 'c' or k == 'asterisk' or k == 'x': self.parent.show_c() elif k == 'i': self.p...
elif k == 'Left' or k == 'comma': self._move_slides(self.last, -1) elif k == 'Right' or k == 'period': self._move_slides(self.last, 1) elif k == 'Home' or k == 'Pause':
elif k == 'Left' or k == 'less': if self.last is not None: self._move_slides(self.last, -1) elif k == 'Right' or k == 'greater': if self.last is not None: self._move_slides(self.last, 1) elif k == 'Home' or k == 'Pause' or k == 'Up':
def _keypress_cb(self, area, event): """ Keypress: moving the slides with the arrow keys """ k = gtk.gdk.keyval_name(event.keyval) if self.parent == None: return if k == 'a': self.parent.show_a() elif k == 'k': self.parent.show_k() elif k == 'c' or k == 'asterisk' or k == 'x': self.parent.show_c() elif k == 'i': self.p...
elif k == 'Return' or k == 'BackSpace':
elif k == 'Down':
def _keypress_cb(self, area, event): """ Keypress: moving the slides with the arrow keys """ k = gtk.gdk.keyval_name(event.keyval) if self.parent == None: return if k == 'a': self.parent.show_a() elif k == 'k': self.parent.show_k() elif k == 'c' or k == 'asterisk' or k == 'x': self.parent.show_c() elif k == 'i': self.p...
min = float(min_text)
min_value = float(min_text)
def make_custom_slide(self, offset_text, label_text, calculate_text, min_text, max_text, step_text): """ Create custom slide and stator from text entered on toolbar. """ try: min = float(min_text) except ValueError: self.parent._min_entry.set_text('NaN') return try: max = float(max_text) except ValueError: self.parent....
max = float(max_text)
max_value = float(max_text)
def make_custom_slide(self, offset_text, label_text, calculate_text, min_text, max_text, step_text): """ Create custom slide and stator from text entered on toolbar. """ try: min = float(min_text) except ValueError: self.parent._min_entry.set_text('NaN') return try: max = float(max_text) except ValueError: self.parent....
step = float(step_text)
step_value = float(step_text)
def make_custom_slide(self, offset_text, label_text, calculate_text, min_text, max_text, step_text): """ Create custom slide and stator from text entered on toolbar. """ try: min = float(min_text) except ValueError: self.parent._min_entry.set_text('NaN') return try: max = float(max_text) except ValueError: self.parent....
self._calc_custom, custom_offset_function, custom_label_function, min, max, step)
self._calc_custom, custom_offset_function, custom_label_function, min_value, max_value, step_value)
myf = "def f(x): return " + label_text.replace('import','')
custom_label_function, min, max, step)
custom_label_function, min_value, max_value, step_value)
myf = "def f(x): return " + label_text.replace('import','')
v_right = round(math.log(10)) + v_left
v_right = round(log(10)) + v_left
def _update_top(self, function): v_left = function() if self.active_stator.name == 'L2': v_right = 10 + v_left elif self.active_stator.name == 'D': v_right = v_left * 10. elif self.active_stator.name == 'B': v_right = v_left * 100. elif self.active_stator.name == 'K2': v_right = v_left * 1000. elif self.active_stator.n...
'ch': { 'title': u'中文 - 0%' },
def header(): c.slackslog = request.POST if ('submit' in request.POST and request.POST['submit'] == _gettext('Search')): redirect( url( controller = 'root', action = 'template', templatefile = 'docs', parameter1 = request.POST['search'].replace(' ', '').lower() ), code = 303 ) c.loop.languages = { 'ch': { 'title': u'中文...
}, 'pl': { 'title': u'Polski - 0%'
def header(): c.slackslog = request.POST if ('submit' in request.POST and request.POST['submit'] == _gettext('Search')): redirect( url( controller = 'root', action = 'template', templatefile = 'docs', parameter1 = request.POST['search'].replace(' ', '').lower() ), code = 303 ) c.loop.languages = { 'ch': { 'title': u'中文...
return escape(json.dumps(string, sort_keys=True, indent=4))
return json.dumps(string, sort_keys=True, indent=4)
def format(string): string = templating.getvariable(string, '.', c) return escape(json.dumps(string, sort_keys=True, indent=4))
}, { 'title': 'try', 'url': 'try' }, { 'title': 'return', 'url': 'return' }, { 'title': 'trim', 'url': 'trim'
def docs(): c.loop.articles = [ { 'articles': [ { 'title': 'Getting Started', 'url': 'gettingstarted' }, { 'title': 'Comparison of SUIT to its Alternatives', 'url': 'comparison' }, { 'title': 'Features', 'url': 'features' }, { 'title': 'Reading Docs', 'url': 'readingdocs' }, { 'title': 'Rules', 'url': 'rules' }, { 'tit...
'articles': [],
'articles': [ { 'title': 'b', 'url': 'b' }, { 'title': 'i', 'url': 'i' }, { 'title': 'u', 'url': 'u' }, { 'title': 's', 'url': 's' }, { 'title': 'url (BBCode Rule)', 'url': 'urlbbcoderule' }, { 'title': 'email', 'url': 'email' }, { 'title': 'img', 'url': 'img' }, { 'title': 'size', 'url': 'size' }, { 'title': 'font', '...
def docs(): c.loop.articles = [ { 'articles': [ { 'title': 'Getting Started', 'url': 'gettingstarted' }, { 'title': 'Comparison of SUIT to its Alternatives', 'url': 'comparison' }, { 'title': 'Features', 'url': 'features' }, { 'title': 'Reading Docs', 'url': 'readingdocs' }, { 'title': 'Rules', 'url': 'rules' }, { 'tit...
'articles': [], 'title': 'Helper Functions', 'url': 'helperfunctions' }, {
def docs(): c.loop.articles = [ { 'articles': [ { 'title': 'Getting Started', 'url': 'gettingstarted' }, { 'title': 'Comparison of SUIT to its Alternatives', 'url': 'comparison' }, { 'title': 'Features', 'url': 'features' }, { 'title': 'Reading Docs', 'url': 'readingdocs' }, { 'title': 'Rules', 'url': 'rules' }, { 'tit...
blockconf = IBlockConfig(self.context) self.image_layout = blockconf.image_layout
self.blockconf = IBlockConfig(self.context) self.image_layout = self.blockconf.image_layout
def __init__(self, context, request): super(BlockView, self).__init__(context, request) self.portal_state = getMultiAdapter((self.context, self.request), name=u'plone_portal_state') self.sl_portal_url = self.portal_state.portal_url() blockconf = IBlockConfig(self.context) self.image_layout = blockconf.image_layout
blockconf = IBlockConfig(self.context) return blockconf.block_height or ''
height = self.blockconf.block_height return height and '%spx' % height or ''
def getBlockHeight(self): blockconf = IBlockConfig(self.context) return blockconf.block_height or ''
def image_wrapper_style(self): """ sets width of the div wrapping the image, so the caption linebreaks """ blockconf = IBlockConfig(self.context) width, height = blockconf.image_dimension return "width: %spx" % width
def getImageTag(self): alt = unicode(self.context.getImageAltText(), self.context.getCharset()) title = unicode(self.context.getImageCaption(), self.context.getCharset())
parser.add_option('--value', dest='template_values', action = 'append',
parser.add_option('--value', dest='template_values', action = 'append',default = [],
def main(args): parser = OptionParser("usage: %prog [-o file] [-i file] [--value name1=value --value name2=value ...] template") parser.add_option('--search-path-template', dest='template_search_path', default='.', action = 'store', help = 'Comma seperated list of directories to search for templates (defaults to ".")')...
creator=request.user, name=name, description=description, is_active=True)
creator=request.user, name=name, category=category, description=description, is_active=True)
def create_project(request): if request.method != 'POST': new_project_form = ProjectForm() project_datasets = ProjectDataSetFormSet(prefix='project_datasets') else: project_datasets = ProjectDataSetFormSet(request.POST, prefix='project_datasets') new_project_form = ProjectForm(request.POST) if new_project_form.is_vali...
if self.generator_module_name == 'initial_data': if os.path.exists('initial_data.json'): os.rename('initial_data.json', 'initial_data.json.bak') print "renaming initial_data.json" else: from django.core import management management.call_command('reset', 'auth', 'sites', 'contenttypes', interactive=False)
def execute(self): # We need a temporary database to store the data created within the # fixture generators. If we don't setup the temporary database, our # actual production database will most likely be dirtied. if self.generator_module_name == 'initial_data': if os.path.exists('initial_data.json'): os.rename('initia...
management.call_command(DJANGO_DUMP_DATA_INTO_FIXTURE_COMMAND)
management.call_command(DJANGO_DUMP_DATA_INTO_FIXTURE_COMMAND, exclude=["contenttypes"])
def _try_to_generate_fixture(self): # The generator file name is relative to its path. Since we're # not executing from that path, we need the full file path to it. generator_file_name = self._get_full_generator_file_name() fixture_name = self._construct_fixture_file_name() print 'Using fixture generator "%s" to gen...
nodesbytotalawardmoney.sort(bytotalawardmoney) nodesbytotalawardmoney.reverse() for i in range(0, 50): nodesbytotalawardmoney[i].labelvisible=true for i in range(0, 10): print str(nodesbytotalawardmoney[i].label) + ": " + str(nodesbytotalawardmoney[i].totalawardmoney)
nodesByTotalAwardMoney.sort(bytotalawardmoney) nodesByTotalAwardMoney.reverse() for i in range(0, min(nodesByTotalAwardMoney.size(), 50)): nodesByTotalAwardMoney[i].labelvisible=true for i in range(0, min(nodesByTotalAwardMoney, 10)): print str(nodesByTotalAwardMoney[i].label) + ": " + str(nodesByTotalAwardMoney[i].t...
def bytotalawardmoney(n1,n2): return cmp(n1.totalawardmoney, n2.totalawardmoney)
addNodeField(ORIGINAL_LABEL_FIELD_NAME, Types.VARCHAR, "") setattr(g.nodes, ORIGINAL_LABEL_FIELD_NAME, g.nodes.label) addEdgeField(ORIGINAL_LABEL_FIELD_NAME, Types.VARCHAR, "") setattr(g.edges, ORIGINAL_LABEL_FIELD_NAME, g.edges.label)
def initializeGlobalVariables(): # put all the color names into an array for i in colorInfo: colorList.append(i[0]) gStuff = globals() # all variables that have been declared # the properties of nodes and edges specified in the gdf file originalGraphProperties = [] wantedDefaultProperties = [] # get all methods and va...
return HttpResponseredirect(reverse(DEACTIVATED_ACCOUNT_VIEW))
return HttpResponseRedirect(reverse(DEACTIVATED_ACCOUNT_VIEW))
def forgot_password(request): if request.method != 'POST': form = ForgotPasswordForm() else: form = ForgotPasswordForm(request.POST) if form.is_valid(): user = form.cleaned_data['user'] if not user.is_active: return HttpResponseredirect(reverse(DEACTIVATED_ACCOUNT_VIEW)) new_password = UserManager().make_random_pass...
email_body = loader.get_template('core/registration_email.html')
email_body = loader.get_template('core/registration_email.txt')
def form_email_about_registration(request, user, profile): email_body = loader.get_template('core/registration_email.html') activation_url = request.build_absolute_uri( reverse('epic.core.views.activate', kwargs={'activation_key': profile.activation_key})) login_url = request.build_absolute_uri(reverse('django.contrib....
email_body = loader.get_template('core/password_reset_email.html')
email_body = loader.get_template('core/password_reset_email.txt')
def _form_email_about_password_changed(request, user, new_password): email_body = loader.get_template('core/password_reset_email.html') login_url = request.build_absolute_uri(reverse('django.contrib.auth.views.login')) # TODO: Probably not the best security to be sending a plaintext password. template_context_data = {...
'f': '%f', 'd': '%f',
'f': '%.15f', 'd': '%.15f',
def fmt2printfmt(fmt): """Returns printf-like formatter for given binary data type sepecifier.""" fmttypes = { 'B': '%d', # PT_8BUI 'h': '%d', # PT_16BSI 'H': '%d', # PT_16BUI 'i': '%d', # PT_32BSI 'I': '%d', # PT_32BUI 'f': '%f', # PT_32BF 'd': '%f', # PT_64BF 's': '%s' } return fmttypes.get(fmt, 'f')
extgeom = "ST_Envelope(ST_SetSRID('POLYGON((%f %f,%f %f,%f %f,%f %f,%f %f))'::geometry, %d))" % \
extgeom = "ST_Envelope(ST_SetSRID('POLYGON((%.15f %.15f,%.15f %.15f,%.15f %.15f,%.15f %.15f,%.15f %.15f))'::geometry, %d))" % \
def make_sql_addrastercolumn(options, pixeltypes, nodata, pixelsize, blocksize, extent): assert len(pixeltypes) > 0, "No pixel types given" ts = make_sql_schema_table_names(options.table) pt = make_sql_value_array(pixeltypes) nd = 'null' if nodata is not None and len(nodata) > 0: nd = make_sql_value_array(nodata) odb...
sql = "SELECT AddRasterColumn('%s','%s','%s',%d, %s, %s, %s, %s, %f, %f, %s, %s, %s);\n" % \
sql = "SELECT AddRasterColumn('%s','%s','%s',%d, %s, %s, %s, %s, %.15f, %.15f, %s, %s, %s);\n" % \
def make_sql_addrastercolumn(options, pixeltypes, nodata, pixelsize, blocksize, extent): assert len(pixeltypes) > 0, "No pixel types given" ts = make_sql_schema_table_names(options.table) pt = make_sql_value_array(pixeltypes) nd = 'null' if nodata is not None and len(nodata) > 0: nd = make_sql_value_array(nodata) odb...
sql = make_sql_insert_raster(gen_table, options.column, hexwkb, options.filename, file)
sql = make_sql_insert_raster(gen_table, options.column, hexwkb, options.filename, infile)
def wkblify_raster_level(options, ds, level, band_range, infile, i): assert ds is not None assert level >= 1 assert len(band_range) == 2 band_from = band_range[0] band_to = band_range[1] # Collect raster and block dimensions raster_size = ( ds.RasterXSize, ds.RasterYSize ) if options.block_size is not None: block_siz...
wkblify_raster(opts, filename, i)
wkblify_raster(opts, filename.replace( '\\', '/') , i)
def main(): (opts, args) = parse_command_line() global VERBOSE VERBOSE = opts.verbose global SUMMARY SUMMARY = [] saved_out = sys.stdout if type(opts.output) is str: filename = opts.output opts.output = open(filename, "w") # BEGIN opts.output.write('BEGIN;\n') # If overviews requested, CREATE TABLE raster_overvie...
def test2(): point_list = [[i] for i in range(1,32)]
def testKdSearchNN(): n = 2**8 point_list = [[i,n-i] for i in range(1,n)]
def test2(): point_list = [[i] for i in range(1,32)] node = kdTree(point_list) node.show() print 'point_list', point_list for point in point_list: best = kdSearchNN(node, point, node, 0) print 'point =', point, ', best =', best.location
best = kdSearchNN(node, point, node, 0) print 'point =', point, ', best =', best.location
point2 = [x + .4 for x in point] point2 = point best = kdSearchNN(node, point2, node, 0) print 'point =', point, 'point2 =', point2, ', best =', best.location, '***' if point != best.location else ''
def test2(): point_list = [[i] for i in range(1,32)] node = kdTree(point_list) node.show() print 'point_list', point_list for point in point_list: best = kdSearchNN(node, point, node, 0) print 'point =', point, ', best =', best.location
test2()
testKdSearchNN()
def test2(): point_list = [[i] for i in range(1,32)] node = kdTree(point_list) node.show() print 'point_list', point_list for point in point_list: best = kdSearchNN(node, point, node, 0) print 'point =', point, ', best =', best.location
showTitle = sys.argv[1].lower().replace(' ', '_') showTitle = sys.argv[1].replace('-', '_')
showTitle = sys.argv[1] showTitle = showTitle.lower() showTitle = showTitle.replace(' ', '_') showTitle = showTitle.replace('-', '_')
def fixupTitle(): showTitle = sys.argv[1].lower().replace(' ', '_') showTitle = sys.argv[1].replace('-', '_') showTitle = showTitle.replace(':', '') showTitle = re.sub('^the_', '', showTitle) showTitle = re.sub('two_and_a_half_men', 'two_half_men', showTitle) return showTitle
def GlueByContents(fout, url, regmemdate): ur = urllib.urlopen(url)
def GlueByContents(fout, url_contents, regmemdate): ur = urllib.urlopen(url_contents)
def GlueByContents(fout, url, regmemdate): ur = urllib.urlopen(url) sr = ur.read() ur.close() soup = BeautifulSoup.BeautifulSoup(sr) mps = soup.find('a', attrs={'name':'A'}).parent.findNextSiblings('p') for p in mps: ur = urlparse.urljoin(url, p.a['href']) print " reading " + ur ur = urllib.urlopen(ur) sr = ur.read() ...
ur = urlparse.urljoin(url, p.a['href']) print " reading " + ur ur = urllib.urlopen(ur)
url = urlparse.urljoin(url_contents, p.a['href']) print " reading " + url ur = urllib.urlopen(url)
def GlueByContents(fout, url, regmemdate): ur = urllib.urlopen(url) sr = ur.read() ur.close() soup = BeautifulSoup.BeautifulSoup(sr) mps = soup.find('a', attrs={'name':'A'}).parent.findNextSiblings('p') for p in mps: ur = urlparse.urljoin(url, p.a['href']) print " reading " + ur ur = urllib.urlopen(ur) sr = ur.read() ...
if re.match('200[6789]', date):
if int(date[0:4]) >= 2006:
def parse_day(self, fp, text, date): self.date = date
for ixurl in ( 'http://www.publications.parliament.uk/pa/cm/cmregmem/memi02.htm', 'http://www.publications.parliament.uk/pa/cm200304/cmregmem/memi02.htm' ): ur = urllib.urlopen(ixurl) content = ur.read() ur.close(); allurls = re.findall('<a href="([^>]*)">(?i)', content) for url in allurls: if url.find("memi02") >...
ixurl = 'http://www.publications.parliament.uk/pa/cm/cmregmem/memi02.htm' ur = urllib.urlopen(ixurl) content = ur.read() ur.close(); allurls = re.findall('<a href="([^>]*)">(?i)', content) for url in allurls: if url.find("100203/") >= 0: continue if url.find("memi02") >= 0: url = urlparse.urljoin(ixurl, url) ur ...
def FindRegmemPages(): urls = [] # Meta index is here: 'http://www.publications.parliament.uk/pa/cm/cmhocpap.htm' # We just grab some specific session index pages as it is too hard otherwise. # The first URL /pa/cm/cmregmem/memi02.htm should get all new regmems as they # arrive anyway. for ixurl in ( 'http://www.public...
if len(args) == 1: buildconfig = _GetConfig(args[0])
if len(args) >= 1: buildconfig = _GetConfig(args[-1])
def main(): # Parse options usage = "usage: %prog [options] cbuildbot_config" parser = optparse.OptionParser(usage=usage) parser.add_option('-r', '--buildroot', help='root directory where build occurs', default=".") parser.add_option('-n', '--buildnumber', help='build number', type='int', default=0) parser.add_option('...
'client.*.DEBUG')
'%s*.DEBUG' % os.path.basename(test))
def _GenerateReportText(self): """Prints a result report to stdout.
if buildconfig['master']: if cbuildbot_comm.HaveSlavesCompleted(config): _UprevPush(buildroot) _UprevCleanup(buildroot)
if options.debug: if buildconfig['master']: if cbuildbot_comm.HaveSlavesCompleted(config): _UprevPush(buildroot) else: _UprevCleanup(buildroot) Die('CBUILDBOT - One of the slaves has failed!!!')
def main(): # Parse options usage = "usage: %prog [options] cbuildbot_config" parser = optparse.OptionParser(usage=usage) parser.add_option('-r', '--buildroot', help='root directory where build occurs', default=".") parser.add_option('-n', '--buildnumber', help='build number', type='int', default=0) parser.add_option('...
_UprevCleanup(buildroot) Die('CBUILDBOT - One of the slaves has failed!!!') else: if buildconfig['important']: cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_COMPLETE) _UprevCleanup(buildroot)
if buildconfig['important']: cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_COMPLETE) _UprevCleanup(buildroot)
def main(): # Parse options usage = "usage: %prog [options] cbuildbot_config" parser = optparse.OptionParser(usage=usage) parser.add_option('-r', '--buildroot', help='root directory where build occurs', default=".") parser.add_option('-n', '--buildnumber', help='build number', type='int', default=0) parser.add_option('...
def FixPostInst(mount_point): postinst_in = os.path.join(mount_point, POST_INST_IN_FILENAME) f = open(postinst_in, 'r') postinst = f.read() f.close() m1 = postinst.find(EFI_CODE_MARKER_START) m2 = postinst.find(EFI_CODE_MARKER_END) if (m1 == -1) or (m2 == -1) or (m1 > m2): return m2 += len(EFI_CODE_MARKER_END) postins...
def FixXorgConf(mount_point): xorg_conf_filename = os.path.join(mount_point, XORG_CONF_FILENAME) f = open(xorg_conf_filename, 'r') xorg_conf = f.read() f.close() more_sections = 1 last_found = 0 while (more_sections): # Find the input section. m1 = xorg_conf.find(INPUT_SECTION_MARKER, last_found) if m1 > -1: m2 = xorg...
parser.add_option('--for_qemu', dest='for_qemu',
parser.add_option('--enable_tablet', dest='enable_tablet',
def main(): parser = OptionParser(USAGE) parser.add_option('--mounted_dir', dest='mounted_dir', help='directory where the Chromium OS image is mounted') parser.add_option('--for_qemu', dest='for_qemu', default="true", help='fixup image for qemu') (options, args) = parser.parse_args() if not options.mounted_dir: parser...
if options.for_qemu not in ('true', 'false'): parser.error("Please specify either true or false for --for_qemu")
if options.enable_tablet not in ('true', 'false'): parser.error("Please specify either true or false for --enable_tablet")
def main(): parser = OptionParser(USAGE) parser.add_option('--mounted_dir', dest='mounted_dir', help='directory where the Chromium OS image is mounted') parser.add_option('--for_qemu', dest='for_qemu', default="true", help='fixup image for qemu') (options, args) = parser.parse_args() if not options.mounted_dir: parser...
FixPostInst(options.mounted_dir) if (options.for_qemu == 'true'):
if (options.enable_tablet == 'true'):
def main(): parser = OptionParser(USAGE) parser.add_option('--mounted_dir', dest='mounted_dir', help='directory where the Chromium OS image is mounted') parser.add_option('--for_qemu', dest='for_qemu', default="true", help='fixup image for qemu') (options, args) = parser.parse_args() if not options.mounted_dir: parser...
if (revision_file):
if (revisionfile):
def _UprevPackages(buildroot, revisionfile): revisions = None if (revision_file): rev_file = revisionfile.open(revisionfile) revisions = rev_file.read() rev_file.close() # Note: Revisions == "None" indicates a Force Build. if revisions and revisions != 'None': print 'CBUILDBOT - Revision list found %s' % revisions pr...
def RevGitFile(filename, key, value): """Update and push the git file.
def setUp(self): self.mox = mox.Mox()
def RevGitFile(filename, key, value): """Update and push the git file. Args: filename: file to modify that is in a git repo already key: board or host package type e.g. x86-dogfood value: string representing the version of the prebuilt that has been uploaded. """ prebuilt_branch = 'prebuilt_branch' old_cwd = os.getcwd...
Args: filename: file to modify that is in a git repo already key: board or host package type e.g. x86-dogfood value: string representing the version of the prebuilt that has been uploaded. """ prebuilt_branch = 'prebuilt_branch' old_cwd = os.getcwd() os.chdir(os.path.dirname(filename)) cros_build_lib.RunCommand('repo s...
def tearDown(self): self.mox.UnsetStubs() self.mox.VerifyAll()
def RevGitFile(filename, key, value): """Update and push the git file. Args: filename: file to modify that is in a git repo already key: board or host package type e.g. x86-dogfood value: string representing the version of the prebuilt that has been uploaded. """ prebuilt_branch = 'prebuilt_branch' old_cwd = os.getcwd...