bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def update_status(text): view.execute_script(''' ui.Header.update_status('%s'); ''' % text); pass | def update_status(text): view.execute_script(''' ui.StatusBox.update_status('%s'); ''' % text); pass | 464,300 |
def request(uuid, method, url, params={}, headers={}): if (method == 'POST'): result = _post(url, params, headers) else: result = _get(url, params, headers) scripts = '' if result[0] != '{' and result[0] != '[': scripts = '''lib.twitterapi.success_task_table['%s']('%s'); ''' % (uuid, result) else: scripts = '''lib.twi... | def request(uuid, method, url, params={}, headers={}): scripts = '' try: if (method == 'POST'): result = _post(url, params, headers) else: result = _get(url, params, headers) except urllib2.HTTPError, e: content = '<p><label>HTTP Code:</label> %s <br/><label>URL:</label> %s<br/><label>Details:</label> %s<br/></p>' % (e... | 464,301 |
def request(uuid, method, url, params={}, headers={}): if (method == 'POST'): result = _post(url, params, headers) else: result = _get(url, params, headers) scripts = '' if result[0] != '{' and result[0] != '[': scripts = '''lib.twitterapi.success_task_table['%s']('%s'); ''' % (uuid, result) else: scripts = '''lib.twi... | def request(uuid, method, url, params={}, headers={}): if (method == 'POST'): result = _post(url, params, headers) else: if result[0] != '{' and result[0] != '[': scripts = '''lib.twitterapi.success_task_table['%s']('%s'); ''' % (uuid, result) else: scripts = '''lib.twitterapi.success_task_table['%s'](%s); ''' % (uuid,... | 464,302 |
def build_gui(self): self.window = gtk.Window() gtk.window_set_default_icon_from_file( config.get_ui_object('imgs/ic64_hotot.png')) self.window.set_icon_from_file( config.get_ui_object('imgs/ic64_hotot.png')) | def build_gui(self): self.window = gtk.Window() gtk.window_set_default_icon_from_file( config.get_ui_object('imgs/ic64_hotot.png')) self.window.set_icon_from_file( config.get_ui_object('imgs/ic64_hotot.png')) | 464,303 |
def build_package_iati_form(is_admin=False): builder = package.build_package_form() # IATI specifics #Publishing Entity: builder.add_field(AtLeastOneGroupSelectField('groups', allow_empty=False)) #builder.add_field(common.TextExtraField('publisher')) #builder.set_field_text('publisher', _('Publishing entity')) #P... | def build_package_iati_form(is_admin=False): builder = package.build_package_form() # IATI specifics #Publishing Entity: builder.add_field(AtLeastOneGroupSelectField('groups', allow_empty=False)) #builder.add_field(common.TextExtraField('publisher')) #builder.set_field_text('publisher', _('Publishing entity')) #P... | 464,304 |
def build_package_iati_form(is_admin=False): builder = package.build_package_form() # IATI specifics #Publishing Entity: builder.add_field(AtLeastOneGroupSelectField('groups', allow_empty=False)) #builder.add_field(common.TextExtraField('publisher')) #builder.set_field_text('publisher', _('Publishing entity')) #P... | def build_package_iati_form(is_admin=False): builder = package.build_package_form() # IATI specifics #Publishing Entity: builder.add_field(AtLeastOneGroupSelectField('groups', allow_empty=False)) #builder.add_field(common.TextExtraField('publisher')) #builder.set_field_text('publisher', _('Publishing entity')) #P... | 464,305 |
def build_package_iati_form(is_admin=False): builder = package.build_package_form() # IATI specifics #Publishing Entity: builder.add_field(AtLeastOneGroupSelectField('groups', allow_empty=False)) #builder.add_field(common.TextExtraField('publisher')) #builder.set_field_text('publisher', _('Publishing entity')) #P... | def build_package_iati_form(is_admin=False): builder = package.build_package_form() # IATI specifics #Publishing Entity: builder.add_field(AtLeastOneGroupSelectField('groups', allow_empty=False)) #builder.add_field(common.TextExtraField('publisher')) #builder.set_field_text('publisher', _('Publishing entity')) #P... | 464,306 |
def build_package_iati_form(is_admin=False): builder = package.build_package_form() # IATI specifics #Publishing Entity: builder.add_field(AtLeastOneGroupSelectField('groups', allow_empty=False)) #builder.add_field(common.TextExtraField('publisher')) #builder.set_field_text('publisher', _('Publishing entity')) #P... | defbuild_package_iati_form(is_admin=False):builder=package.build_package_form()#IATIspecifics#PublishingEntity:builder.add_field(AtLeastOneGroupSelectField('groups',allow_empty=False))#builder.add_field(common.TextExtraField('publisher'))#builder.set_field_text('publisher',_('Publishingentity'))#PublishingEntityType:(D... | 464,307 |
def build_package_iati_form(is_admin=False): builder = package.build_package_form() # IATI specifics #Publishing Entity: builder.add_field(AtLeastOneGroupSelectField('groups', allow_empty=False)) #builder.add_field(common.TextExtraField('publisher')) #builder.set_field_text('publisher', _('Publishing entity')) #P... | defbuild_package_iati_form(is_admin=False):builder=package.build_package_form()#IATIspecifics#PublishingEntity:builder.add_field(AtLeastOneGroupSelectField('groups',allow_empty=False))#builder.add_field(common.TextExtraField('publisher'))#builder.set_field_text('publisher',_('Publishingentity'))#PublishingEntityType:(D... | 464,308 |
def load_fixtures_via_api(api_url, api_key): cc = ckanclient.CkanClient(base_location=api_url, api_key=api_key) fp = open(FIXTURES_PATH, 'r') fixtures = json.load(fp) fp.close() for fixture in fixtures.get('packages'): name = fixture['name'] = fixture.get('name').lower() print "Loading %s" % fixture.get('title').encode... | def load_fixtures_via_api(api_url, api_key): cc = ckanclient.CkanClient(base_location=api_url, api_key=api_key) fp = open(FIXTURES_PATH, 'r') fixtures = json.load(fp) fp.close() for fixture in fixtures.get('packages'): name = fixture['name'] = fixture.get('name').lower() print "Loading %s" % fixture.get('title').encode... | 464,309 |
def AjouteZero(n): N = str(n) a = [] for i in range(len(N),4): a.append("0") a.append(N) return "".join(a) | def AjouteZero(n): N = str(n) a = [] for i in range(len(N),4): a.append("0") a.append(N) return "".join(a) | 464,310 |
def AjouteZero(n): N = str(n) a = [] for i in range(len(N),4): a.append("0") a.append(N) return "".join(a) | def AjouteZero(n): N = str(n) a = [] for i in range(len(N),4): a.append("0") a.append(N) return "".join(a) | 464,311 |
def AjouteZero(n): N = str(n) a = [] for i in range(len(N),4): a.append("0") a.append(N) return "".join(a) | def AjouteZero(n): N = str(n) a = [] for i in range(len(N),4): a.append("0") a.append(N) return "".join(a) | 464,312 |
def __init__(self, label=u'', validators=None, parse_kwargs=None, display_format='%Y-%m-%d %H:%M', **kwargs): super(DateTimeField, self).__init__(label, validators, **kwargs) if parse_kwargs is None: parse_kwargs = {} self.parse_kwargs = parse_kwargs self.display_format = display_format self.raw_data = None | def __init__(self, label=u'', validators=None, parse_kwargs=None, display_format='%Y-%m-%d %H:%M', **kwargs): super(DateTimeField, self).__init__(label, validators, **kwargs) if parse_kwargs is None: parse_kwargs = {} self.parse_kwargs = parse_kwargs self.display_format = display_format self.raw_data = None | 464,313 |
def _value(self): if self.raw_data is not None: return self.raw_data else: return self.data and self.data.strftime(self.display_format) or u'' | def _value(self): if self.raw_data: return u' '.join(self.raw_data) else: return self.data and self.data.strftime(self.display_format) or u'' | 464,314 |
def process_formdata(self, valuelist): if valuelist: self.raw_data = str.join(' ', valuelist) parse_kwargs = self.parse_kwargs.copy() if 'default' not in parse_kwargs: try: parse_kwargs['default'] = self.default() except TypeError: parse_kwargs['default'] = self.default try: self.data = parser.parse(self.raw_data, **pa... | def process_formdata(self, valuelist): if valuelist: date_str = u' '.join(valuelist) parse_kwargs = self.parse_kwargs.copy() if 'default' not in parse_kwargs: try: parse_kwargs['default'] = self.default() except TypeError: parse_kwargs['default'] = self.default try: self.data = parser.parse(self.raw_data, **parse_kwarg... | 464,315 |
def process_formdata(self, valuelist): if valuelist: self.raw_data = str.join(' ', valuelist) parse_kwargs = self.parse_kwargs.copy() if 'default' not in parse_kwargs: try: parse_kwargs['default'] = self.default() except TypeError: parse_kwargs['default'] = self.default try: self.data = parser.parse(self.raw_data, **pa... | def process_formdata(self, valuelist): if valuelist: self.raw_data = str.join(' ', valuelist) parse_kwargs = self.parse_kwargs.copy() if 'default' not in parse_kwargs: try: parse_kwargs['default'] = self.default() except TypeError: parse_kwargs['default'] = self.default try: self.data = parser.parse(date_str, **parse_k... | 464,316 |
def __call__(self, form, field): if field.raw_data is not None and (not field.raw_data or not field.raw_data[0].strip()): field.errors[:] = [] raise StopValidation() | def __call__(self, form, field): if field.raw_data is None or not field.raw_data or not field.raw_data[0].strip(): field.errors[:] = [] raise StopValidation() | 464,317 |
def __init__(self, label=u'', validators=None, reference_class=None, label_attr=None, allow_blank=False, blank_text=u'', **kwargs): super(ReferencePropertyField, self).__init__(label, validators, **kwargs) self.label_attr = label_attr self.allow_blank = allow_blank self.blank_text = blank_text self._set_data(None) if r... | def __init__(self, label=u'', validators=None, reference_class=None, label_attr=None, allow_blank=False, blank_text=u'', **kwargs): super(ReferencePropertyField, self).__init__(label, validators, **kwargs) self.label_attr = label_attr self.allow_blank = allow_blank self.blank_text = blank_text self._set_data(None) if r... | 464,318 |
def pre_validate(self, form): if not self.allow_blank or self.data is not None: for obj in self.queryset: if self.data == str(obj.key()): break else: raise ValidationError('Not a valid choice') | def pre_validate(self, form): if not self.allow_blank or self.data is not None: for obj in self.queryset: if self.data == str(obj.key()): break else: raise ValidationError('Not a valid choice') | 464,319 |
def test(self): d = datetime(2008, 5, 5, 4, 30, 0, 0) form = self.F(DummyPostData(a=['2008-05-05', '04:30:00'], b=['2008-05-05 04:30'])) self.assertEqual(form.a.data, d) self.assertEqual(form.a(), u"""<input id="a" name="a" type="text" value="2008-05-05 04:30:00" />""") self.assertEqual(form.b.data, d) self.assertEqual... | def test(self): d = datetime(2008, 5, 5, 4, 30, 0, 0) form = self.F(DummyPostData(a=['2008-05-05', '04:30:00'], b=['2008-05-05 04:30'])) self.assertEqual(form.a.data, d) self.assertEqual(form.a(), u"""<input id="a" name="a" type="text" value="2008-05-05 04:30:00" />""") self.assertEqual(form.b.data, d) self.assertEqual... | 464,320 |
def test_default_value(self): form_class = model_form(Author) | def test_default_value(self): form_class = model_form(Author) | 464,321 |
def pre_validate(self, form): if not self.allow_blank or self.data is not None: for obj in self.queryset: if self.data == str(obj.key()): break else: raise ValueError(self.gettext(u'Not a valid choice')) | def pre_validate(self, form): if not self.allow_blank or self.data is not None: for obj in self.query: if self.data == str(obj.key()): break else: raise ValueError(self.gettext(u'Not a valid choice')) | 464,322 |
def convert_DateProperty(model, prop, kwargs): """Returns a form field for a ``db.DateProperty``.""" if prop.auto_now or prop.auto_now_add: return None return f.DateTimeField(format='%Y-%m-%d', **kwargs) | def convert_DateProperty(model, prop, kwargs): """Returns a form field for a ``db.DateProperty``.""" if prop.auto_now or prop.auto_now_add: return None return f.DateField(format='%Y-%m-%d', **kwargs) | 464,323 |
def convert_RatingProperty(model, prop, kwargs): """Returns a form field for a ``db.RatingProperty``.""" kwargs['validators'].append(validators.NumberRange(min=0, max=100)) return f.IntegerField(**kwargs) | def convert_RatingProperty(model, prop, kwargs): """Returns a form field for a ``db.RatingProperty``.""" kwargs['validators'].append(validators.NumberRange(min=0, max=100)) return f.IntegerField(**kwargs) | 464,324 |
def __init__(self, label=u'', validators=None, filters=tuple(), description=u'', id=None, default=None, widget=None, _form=None, _name=None, _prefix=''): """ Construct a new field. | def __init__(self, label=u'', validators=None, filters=tuple(), description=u'', id=None, default=None, widget=None, _form=None, _name=None, _prefix=''): """ Construct a new field. | 464,325 |
def __init__(self, label=u'', validators=None, filters=tuple(), description=u'', id=None, default=None, widget=None, _form=None, _name=None, _prefix=''): """ Construct a new field. | def __init__(self, label=u'', validators=None, filters=tuple(), description=u'', id=None, default=None, widget=None, _form=None, _name=None, _prefix=''): """ Construct a new field. | 464,326 |
def __call__(self, field, **kwargs): if self.hide_value: kwargs['value'] = '' return super(PasswordInput, self).__call__(field, **kwargs) | def __call__(self, field, **kwargs): if self.hide_value: kwargs['value'] = '' return super(PasswordInput, self).__call__(field, **kwargs) | 464,327 |
def __call__(self, form, field): if field.raw_data is None or not field.raw_data or not field.raw_data[0].strip(): field.errors[:] = [] raise StopValidation() | def __call__(self, form, field): if not field.raw_data or isinstance(field.raw_data[0], basestring) and not field.raw_data[0].strip(): field.errors[:] = [] raise StopValidation() | 464,328 |
def main(self): i = 0 line = "" first_line = True | def main(self): i = 0 line = "" first_line = True | 464,329 |
def init_colors(self): curses.init_pair(1, curses.COLOR_RED, curses.COLOR_BLACK) #errors curses.init_pair(2, curses.COLOR_MAGENTA, curses.COLOR_BLACK) #keywords curses.init_pair(3, curses.COLOR_CYAN, curses.COLOR_BLACK) curses.init_pair(4, curses.COLOR_MAGENTA, curses.COLOR_WHITE) curses.init_pair(5, curses.COLOR_GREEN... | def init_colors(self): curses.init_pair(1, curses.COLOR_RED, curses.COLOR_BLACK) #errors curses.init_pair(2, curses.COLOR_MAGENTA, curses.COLOR_BLACK) #keywords curses.init_pair(3, curses.COLOR_CYAN, curses.COLOR_BLACK) curses.init_pair(4, curses.COLOR_MAGENTA, curses.COLOR_WHITE) curses.init_pair(5, curses.COLOR_GREEN... | 464,330 |
def init_colors(self): curses.init_pair(1, curses.COLOR_RED, curses.COLOR_BLACK) #errors curses.init_pair(2, curses.COLOR_MAGENTA, curses.COLOR_BLACK) #keywords curses.init_pair(3, curses.COLOR_CYAN, curses.COLOR_BLACK) curses.init_pair(4, curses.COLOR_MAGENTA, curses.COLOR_WHITE) curses.init_pair(5, curses.COLOR_GREEN... | def init_colors(self): curses.init_pair(1, curses.COLOR_RED, curses.COLOR_BLACK) #errors curses.init_pair(2, curses.COLOR_MAGENTA, curses.COLOR_BLACK) #keywords curses.init_pair(3, curses.COLOR_CYAN, curses.COLOR_BLACK) curses.init_pair(4, curses.COLOR_MAGENTA, curses.COLOR_WHITE) curses.init_pair(5, curses.COLOR_GREEN... | 464,331 |
def init_colors(self): curses.init_pair(1, curses.COLOR_RED, curses.COLOR_BLACK) #errors curses.init_pair(2, curses.COLOR_MAGENTA, curses.COLOR_BLACK) #keywords curses.init_pair(3, curses.COLOR_CYAN, curses.COLOR_BLACK) curses.init_pair(4, curses.COLOR_MAGENTA, curses.COLOR_WHITE) curses.init_pair(5, curses.COLOR_GREEN... | def init_colors(self): curses.init_pair(1, curses.COLOR_RED, curses.COLOR_BLACK) #errors curses.init_pair(2, curses.COLOR_MAGENTA, curses.COLOR_BLACK) #keywords curses.init_pair(3, curses.COLOR_CYAN, curses.COLOR_BLACK) curses.init_pair(4, curses.COLOR_MAGENTA, curses.COLOR_WHITE) curses.init_pair(5, curses.COLOR_GREEN... | 464,332 |
def updateCurrentLine(self, s): suggestions = {} try: lineTokens = self.cs164bparser.tokenize(s) if lineTokens: suggestions = dict(interpreter.complete(lineTokens[-1])) except NameError, e: lineTokens = [] #TODO color line red | def updateCurrentLine(self, s): suggestions = {} try: lineTokens = self.cs164bparser.tokenize(s) if lineTokens: suggestions = dict(interpreter.complete(lineTokens[-1])) except NameError, e: lineTokens = [] #TODO color line red | 464,333 |
def updateCurrentLine(self, s): suggestions = {} try: lineTokens = self.cs164bparser.tokenize(s) if lineTokens: suggestions = dict(interpreter.complete(lineTokens[-1])) except NameError, e: lineTokens = [] #TODO color line red | def updateCurrentLine(self, s): suggestions = {} try: lineTokens = self.cs164bparser.tokenize(s) if lineTokens: suggestions = dict(interpreter.complete(lineTokens[-1])) except NameError, e: lineTokens = [] #TODO color line red | 464,334 |
def updateCurrentLine(self, s): suggestions = {} try: lineTokens = self.cs164bparser.tokenize(s) if lineTokens: suggestions = dict(interpreter.complete(lineTokens[-1])) except NameError, e: lineTokens = [] #TODO color line red | def updateCurrentLine(self, s): suggestions = {} try: lineTokens = self.cs164bparser.tokenize(s) if lineTokens: suggestions = dict(interpreter.complete(lineTokens[-1])) except NameError, e: lineTokens = [] #TODO color line red | 464,335 |
def main(self): i = 0 line = "" | def main(self): i = 0 line = "" | 464,336 |
def main(self): i = 0 line = "" first_line = True | def main(self): i = 0 line = "" first_line = True | 464,337 |
def main(self): i = 0 line = "" first_line = True | def main(self): i = 0 line = "" first_line = True | 464,338 |
def main(self): i = 0 line = "" first_line = True | def main(self): i = 0 line = "" first_line = True | 464,339 |
def doSDT(edge): children = [x for x in getChildren(edge) if x] if len(children) == 1 and len(children[0])==2: #terminal term = children[0] return [saObject(None,[],term[1])] | def doSDT(edge): children = [x for x in getChildren(edge) if x] if len(children) == 1 and len(children[0])==2: #terminal term = children[0] return [saObject(None,[],term[1])] | 464,340 |
def main(self): i = 0 line = "" | def main(self): i = 0 line = "" | 464,341 |
def main(self): i = 0 line = "" | def main(self): i = 0 line = "" | 464,342 |
def showSuggestions(self, suggestions): if suggestions: width = self.screen.getmaxyx()[1] - 6 sugList = [] for k,v in suggestions.iteritems(): # pretty representation of functions - add others as needed if isinstance(v, interpreter.FunVal): suggestions[k] = "function(" + reduce(lambda x,y: x+","+y, v.fun.argList) + ")" | def showSuggestions(self, suggestions): if suggestions: width = self.screen.getmaxyx()[1] - 6 sugList = [] for k,v in suggestions.iteritems(): # pretty representation of functions - add others as needed if isinstance(v, interpreter.FunVal): suggestions[k] = "function(" + reduce(lambda x,y: x+","+y, v.fun.argList) + ")" | 464,343 |
funcdef = lookup(e[2]) | funcdef = lookup(e[2]) | 464,344 |
funcdef = lookup(e[2]) | funcdef = lookup(e[2]) | 464,345 |
def updateCurrentLine(self, s, tab=False, stringCompletion=False): | def updateCurrentLine(self, s, tab=False, stringCompletion=False): | 464,346 |
def updateCurrentLine(self, s, tab=False, stringCompletion=False): | def updateCurrentLine(self, s, tab=False, stringCompletion=False): | 464,347 |
def findFunctionalUnit(tokens): if not tokens: # can't fill the hole in your heart, I mean, code return None | def findFunctionalUnit(tokens): if not tokens: # can't fill the hole in your heart, I mean, code return None | 464,348 |
def init_colors(self): curses.init_pair(1, curses.COLOR_RED, curses.COLOR_BLACK) #errors curses.init_pair(2, curses.COLOR_MAGENTA, curses.COLOR_BLACK) #keywords curses.init_pair(3, curses.COLOR_CYAN, curses.COLOR_BLACK) curses.init_pair(4, curses.COLOR_YELLOW, curses.COLOR_BLACK) curses.init_pair(5, curses.COLOR_GREEN,... | def init_colors(self): curses.init_pair(1, curses.COLOR_RED, curses.COLOR_BLACK) #errors curses.init_pair(2, curses.COLOR_MAGENTA, curses.COLOR_BLACK) #keywords curses.init_pair(3, curses.COLOR_CYAN, curses.COLOR_BLACK) curses.init_pair(4, curses.COLOR_YELLOW, curses.COLOR_BLACK) curses.init_pair(5, curses.COLOR_GREEN,... | 464,349 |
def updateCurrentLine(self, s, tab=False, stringCompletion=False, interruptFlag=False): | def updateCurrentLine(self, s, tab=False, stringCompletion=False, interruptFlag=False): | 464,350 |
def __init__(self): #initialize parser cs164grammarFile = './cs164b.grm' self.cs164bparser = parser_generator.makeParser(grammar_parser.parse(open(cs164grammarFile).read())) | def __init__(self): #initialize parser cs164grammarFile = './cs164b.grm' self.cs164bparser = parser_generator.makeParser(grammar_parser.parse(open(cs164grammarFile).read())) | 464,351 |
def parse_line(self,line): try: tokens = self.cs164bparser.tokenize(line) if tokens: # no need to consume non-code lines input_ast = self.parser.send(tokens) # parse this line if type(input_ast) == tuple: # parsing completed on this line; execute result interpreter.ExecGlobalStmt... | def parse_line(self,line): try: tokens = self.cs164bparser.tokenize(line) if tokens: # no need to consume non-code lines input_ast = self.parser.send(tokens) # parse this line if type(input_ast) == tuple: # parsing completed on this line; execute result interpreter.ExecGlobalStmt... | 464,352 |
def parse_line(self,line): try: tokens = self.cs164bparser.tokenize(line) if tokens: # no need to consume non-code lines input_ast = self.parser.send(tokens) # parse this line if type(input_ast) == tuple: # parsing completed on this line; execute result interpreter.ExecGlobalStmt... | def parse_line(self,line): try: tokens = self.cs164bparser.tokenize(line) if tokens: # no need to consume non-code lines input_ast = self.parser.send(tokens) # parse this line if type(input_ast) == tuple: # parsing completed on this line; execute result interpreter.ExecGlobalStmt... | 464,353 |
def main(self): i = 0 line = "" | def main(self): i = 0 line = "" | 464,354 |
def loadProgram(self, p_file): #message to return message = "" | def loadProgram(self, p_file): #message to return message = "" | 464,355 |
def loadProgram(self, p_file): #message to return message = "" | def loadProgram(self, p_file): #message to return message = "" | 464,356 |
def parse_line(self, line): complete = False # a flag set each time a statement is completed try: tokens = self.cs164bparser.tokenize(line) if tokens: # no need to consume non-code lines input_ast = self.parser.send(tokens) # parse this line self.currLine = se... | def parse_line(self, line): complete = False # a flag set each time a statement is completed try: tokens = self.cs164bparser.tokenize(line) if tokens: # no need to consume non-code lines input_ast = self.parser.send(tokens) # parse this line self.currLine = se... | 464,357 |
def __init__(self): #initialize curses self.screen = curses.initscr() curses.start_color() self.init_colors() curses.noecho() self.screen.keypad(1) curses.curs_set(1) curses.cbreak() self.screen.clear() self.screen.leaveok(False) self.infoBox = 0 | def __init__(self): #initialize curses self.screen = curses.initscr() curses.start_color() self.init_colors() curses.noecho() self.screen.keypad(1) curses.curs_set(1) curses.cbreak() self.screen.clear() self.screen.leaveok(False) self.infoBox = 0 | 464,358 |
def parse_line(self,line): parser = self.parser.parse() parser.next() try: tokens = self.parser.tokenize(line) if tokens: # no need to consume non-code lines input_ast = parser.send(tokens) # parse this line if type(input_ast) == tuple: # parsing completed on this line; execute r... | def parse_line(self,line): try: tokens = self.parser.tokenize(line) if tokens: # no need to consume non-code lines input_ast = parser.send(tokens) # parse this line if type(input_ast) == tuple: # parsing completed on this line; execute result interpreter.ExecGlobalStmt(input_ast,... | 464,359 |
def parse_line(self,line): parser = self.parser.parse() parser.next() try: tokens = self.parser.tokenize(line) if tokens: # no need to consume non-code lines input_ast = parser.send(tokens) # parse this line if type(input_ast) == tuple: # parsing completed on this line; execute r... | def parse_line(self,line): parser = self.parser.parse() parser.next() try: tokens = self.cs164bparser.tokenize(line) if tokens: # no need to consume non-code lines input_ast = parser.send(tokens) # parse this line if type(input_ast) == tuple: # parsing completed on this line; exe... | 464,360 |
def parse_line(self,line): parser = self.parser.parse() parser.next() try: tokens = self.parser.tokenize(line) if tokens: # no need to consume non-code lines input_ast = parser.send(tokens) # parse this line if type(input_ast) == tuple: # parsing completed on this line; execute r... | def parse_line(self,line): parser = self.parser.parse() parser.next() try: tokens = self.parser.tokenize(line) if tokens: # no need to consume non-code lines input_ast = self.parser.send(tokens) # parse this line if type(input_ast) == tuple: # parsing completed on this line; exec... | 464,361 |
def parse_line(self,line): parser = self.parser.parse() parser.next() try: tokens = self.parser.tokenize(line) if tokens: # no need to consume non-code lines input_ast = parser.send(tokens) # parse this line if type(input_ast) == tuple: # parsing completed on this line; execute r... | def parse_line(self,line): self.parser = self.cs164bparser.parse() self.parser.next() try: tokens = self.parser.tokenize(line) if tokens: # no need to consume non-code lines input_ast = parser.send(tokens) # parse this line if type(input_ast) == tuple: # parsing completed on this... | 464,362 |
def parse_line(self,line): parser = self.parser.parse() parser.next() try: tokens = self.parser.tokenize(line) if tokens: # no need to consume non-code lines input_ast = parser.send(tokens) # parse this line if type(input_ast) == tuple: # parsing completed on this line; execute r... | def parse_line(self,line): self.parser = self.cs164bparser.parse() self.parser.next() try: tokens = self.parser.tokenize(line) if tokens: # no need to consume non-code lines input_ast = parser.send(tokens) # parse this line if type(input_ast) == tuple: # parsing completed on this... | 464,363 |
def parse_line(self,line): parser = self.parser.parse() parser.next() try: tokens = self.parser.tokenize(line) if tokens: # no need to consume non-code lines input_ast = parser.send(tokens) # parse this line if type(input_ast) == tuple: # parsing completed on this line; execute r... | def parse_line(self,line): self.parser = self.cs164bparser.parse() self.parser.next() try: tokens = self.parser.tokenize(line) if tokens: # no need to consume non-code lines input_ast = parser.send(tokens) # parse this line if type(input_ast) == tuple: # parsing completed on this... | 464,364 |
def main(self): i = 0 line = "" | def main(self): i = 0 line = "" | 464,365 |
def get_title_from_google(movie_name, interactive=False): try: query = urllib.quote("site:www.imdb.com/title/ " + movie_name) url = 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=' + query data_string = urllib2.urlopen(url).read() first_result = json.loads(data_string)["responseData"]["results"][0] m = re... | def get_title_from_google(movie_name, interactive=False): try: query = urllib.quote("site:www.imdb.com/title/ " + movie_name) url = 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=' + query data_string = urllib2.urlopen(url).read() first_result = json.loads(data_string)["responseData"]["results"][0] m = re... | 464,366 |
def get_title_from_imdb(movie_name, interactive=False): """ Searches for a film on IMDb. * If only one result is found return that * If no films are found, return an error. * If more than one film is found, either return an error when not in interactive mode, or prompt for a selection """ s_result = ia.search_movie(mov... | def get_title_from_imdb(movie_name, interactive=False): """ Searches for a film on IMDb. * If only one result is found return that * If no films are found, return an error. * If more than one film is found, either return an error when not in interactive mode, or prompt for a selection """ s_result = ia.search_movie(mov... | 464,367 |
def get_data_for_movie(movie): """ Takes an IMDbPY movie object, updates it and formats it into a stagfs friendly dict. """ # Not all data was retrieved so update the movie object ia.update(movie) ia.update(movie, 'keywords') output = { 'title': movie.get('title', []), 'canonical_title': movie.get('canonical title', ... | def get_data_for_movie(movie): """ Takes an IMDbPY movie object, updates it and formats it into a stagfs friendly dict. """ # Not all data was retrieved so update the movie object ia.update(movie) ia.update(movie, 'keywords') output = { 'title': movie.get('title', []), 'canonical_title': movie.get('canonical title', ... | 464,368 |
def __init__(self): self.throw_error = False | def __init__(self): self.throw_error = False | 464,369 |
def __init__(self): global mcid self.id = mcid self.closed = False mcid += 1 | def __init__(self): global mcid self.id = mcid mcid += 1 | 464,370 |
def close(self): pass | def close(self): pass | 464,371 |
def testmanager(self): manager = pool.manage(mock_dbapi, use_threadlocal=True) | def testmanager(self): manager = pool.manage(mock_dbapi, use_threadlocal=True) | 464,372 |
def testbadargs(self): manager = pool.manage(mock_dbapi) | def testbadargs(self): manager = pool.manage(mock_dbapi) | 464,373 |
def testnonthreadlocalmanager(self): manager = pool.manage(mock_dbapi, use_threadlocal = False) | def testnonthreadlocalmanager(self): manager = pool.manage(mock_dbapi, use_threadlocal = False) | 464,374 |
def creator(): raise Exception("no creates allowed") | defcreator():raiseException("nocreatesallowed") | 464,375 |
def _do_testthreadlocal(self, useclose=False): for p in pool.QueuePool(creator=mock_dbapi.connect, pool_size=3, max_overflow=-1, use_threadlocal=True), \ pool.SingletonThreadPool(creator=mock_dbapi.connect, use_threadlocal=True): c1 = p.connect() c2 = p.connect() self.assert_(c1 is c2) c3 = p.unique_connection() self.a... | def _do_testthreadlocal(self, useclose=False): dbapi = MockDBAPI() for p in pool.QueuePool(creator=dbapi.connect, pool_size=3, max_overflow=-1, use_threadlocal=True), \ pool.SingletonThreadPool(creator=mock_dbapi.connect, use_threadlocal=True): c1 = p.connect() c2 = p.connect() self.assert_(c1 is c2) c3 = p.unique_conn... | 464,376 |
def _do_testthreadlocal(self, useclose=False): for p in pool.QueuePool(creator=mock_dbapi.connect, pool_size=3, max_overflow=-1, use_threadlocal=True), \ pool.SingletonThreadPool(creator=mock_dbapi.connect, use_threadlocal=True): c1 = p.connect() c2 = p.connect() self.assert_(c1 is c2) c3 = p.unique_connection() self.a... | def _do_testthreadlocal(self, useclose=False): for p in pool.QueuePool(creator=mock_dbapi.connect, pool_size=3, max_overflow=-1, use_threadlocal=True), \ pool.SingletonThreadPool(creator=dbapi.connect, use_threadlocal=True): c1 = p.connect() c2 = p.connect() self.assert_(c1 is c2) c3 = p.unique_connection() self.assert... | 464,377 |
def test_properties(self): dbapi = MockDBAPI() p = pool.QueuePool(creator=lambda: dbapi.connect('foo.db'), pool_size=1, max_overflow=0, use_threadlocal=False) | def test_properties(self): dbapi = MockDBAPI() p = pool.QueuePool(creator=lambda: dbapi.connect('foo.db'), pool_size=1, max_overflow=0, use_threadlocal=False) | 464,378 |
def test_listeners(self): dbapi = MockDBAPI() | def test_listeners(self): dbapi = MockDBAPI() | 464,379 |
def _pool(**kw): return pool.QueuePool(creator=lambda: dbapi.connect('foo.db'), use_threadlocal=False, **kw) | def _pool(**kw): return pool.QueuePool(creator=lambda: dbapi.connect('foo.db'), use_threadlocal=False, **kw) | 464,380 |
def assert_listeners(p, total, conn, fconn, cout, cin): for instance in (p, p.recreate()): self.assert_(len(instance.dispatch.on_connect) == conn) self.assert_(len(instance.dispatch.on_first_connect) == fconn) self.assert_(len(instance.dispatch.on_checkout) == cout) self.assert_(len(instance.dispatch.on_checkin) == cin... | def assert_listeners(p, total, conn, fconn, cout, cin): for instance in (p, p.recreate()): self.assert_(len(instance.dispatch.on_connect) == conn) self.assert_(len(instance.dispatch.on_first_connect) == fconn) self.assert_(len(instance.dispatch.on_checkout) == cout) self.assert_(len(instance.dispatch.on_checkin) == cin... | 464,381 |
def assert_listeners(p, total, conn, fconn, cout, cin): for instance in (p, p.recreate()): self.assert_(len(instance.dispatch.on_connect) == conn) self.assert_(len(instance.dispatch.on_first_connect) == fconn) self.assert_(len(instance.dispatch.on_checkout) == cout) self.assert_(len(instance.dispatch.on_checkin) == cin... | def assert_listeners(p, total, conn, fconn, cout, cin): for instance in (p, p.recreate()): self.assert_(len(instance.dispatch.on_connect) == conn) self.assert_(len(instance.dispatch.on_first_connect) == fconn) self.assert_(len(instance.dispatch.on_checkout) == cout) self.assert_(len(instance.dispatch.on_checkin) == cin... | 464,382 |
def test_listeners_callables(self): dbapi = MockDBAPI() | def test_listeners_callables(self): dbapi = MockDBAPI() | 464,383 |
def _pool(**kw): return cls(creator=lambda: dbapi.connect('foo.db'), use_threadlocal=False, **kw) | def _pool(**kw): return cls(creator=lambda: dbapi.connect('foo.db'), use_threadlocal=False, **kw) | 464,384 |
def assert_listeners(p, total, conn, cout, cin): for instance in (p, p.recreate()): eq_(len(instance.dispatch.on_connect), conn) eq_(len(instance.dispatch.on_checkout), cout) eq_(len(instance.dispatch.on_checkin), cin) | def assert_listeners(p, total, conn, cout, cin): for instance in (p, p.recreate()): eq_(len(instance.dispatch.on_connect), conn) eq_(len(instance.dispatch.on_checkout), cout) eq_(len(instance.dispatch.on_checkin), cin) | 464,385 |
def assert_listeners(p, total, conn, cout, cin): for instance in (p, p.recreate()): eq_(len(instance.dispatch.on_connect), conn) eq_(len(instance.dispatch.on_checkout), cout) eq_(len(instance.dispatch.on_checkin), cin) | def assert_listeners(p, total, conn, cout, cin): for instance in (p, p.recreate()): eq_(len(instance.dispatch.on_connect), conn) eq_(len(instance.dispatch.on_checkout), cout) eq_(len(instance.dispatch.on_checkin), cin) | 464,386 |
def test_listener_after_oninit(self): """Test that listeners are called after OnInit is removed""" called = [] def listener(*args): called.append(True) engine = create_engine(testing.db.url) event.listen(listener, 'on_connect', engine.pool) engine.execute(select([1])).close() assert called, "Listener not called on con... | def test_listener_after_oninit(self): """Test that listeners are called after OnInit is removed""" called = [] def listener(*args): called.append(True) engine = create_engine(testing.db.url) event.listen(listener, 'on_connect', engine.pool) engine.execute(select([1])).close() assert called, "Listener not called on con... | 464,387 |
def _do_testqueuepool(self, useclose=False): p = pool.QueuePool(creator=mock_dbapi.connect, pool_size=3, max_overflow=-1, use_threadlocal=False) | def _do_testqueuepool(self, useclose=False): p = pool.QueuePool(creator=mock_dbapi.connect, pool_size=3, max_overflow=-1, use_threadlocal=False) | 464,388 |
def test_timeout(self): p = pool.QueuePool(creator=mock_dbapi.connect, pool_size=3, max_overflow=0, use_threadlocal=False, timeout=2) c1 = p.connect() c2 = p.connect() c3 = p.connect() now = time.time() try: c4 = p.connect() assert False except tsa.exc.TimeoutError, e: assert int(time.time() - now) == 2 | def test_timeout(self): p = self._queuepool_fixture(pool_size=3, max_overflow=0, timeout=2) c1 = p.connect() c2 = p.connect() c3 = p.connect() now = time.time() try: c4 = p.connect() assert False except tsa.exc.TimeoutError, e: assert int(time.time() - now) == 2 | 464,389 |
def test_timeout_race(self): # test a race condition where the initial connecting threads all race # to queue.Empty, then block on the mutex. each thread consumes a # connection as they go in. when the limit is reached, the remaining # threads go in, and get TimeoutError; even though they never got to # wait for the ... | def test_timeout_race(self): # test a race condition where the initial connecting threads all race # to queue.Empty, then block on the mutex. each thread consumes a # connection as they go in. when the limit is reached, the remaining # threads go in, and get TimeoutError; even though they never got to # wait for the ... | 464,390 |
def creator(): time.sleep(.05) return mock_dbapi.connect() | def creator(): time.sleep(.05) return mock_dbapi.connect() | 464,391 |
def test_mixed_close(self): p = pool.QueuePool(creator=mock_dbapi.connect, pool_size=3, max_overflow=-1, use_threadlocal=True) c1 = p.connect() c2 = p.connect() assert c1 is c2 c1.close() c2 = None assert p.checkedout() == 1 c1 = None lazy_gc() assert p.checkedout() == 0 lazy_gc() assert not pool._refs | def test_mixed_close(self): p = self._queuepool_fixture(pool_size=3, max_overflow=-1, use_threadlocal=True) c1 = p.connect() c2 = p.connect() assert c1 is c2 c1.close() c2 = None assert p.checkedout() == 1 c1 = None lazy_gc() assert p.checkedout() == 0 lazy_gc() assert not pool._refs | 464,392 |
def test_weakref_kaboom(self): p = pool.QueuePool(creator=mock_dbapi.connect, pool_size=3, max_overflow=-1, use_threadlocal=True) c1 = p.connect() c2 = p.connect() c1.close() c2 = None del c1 del c2 gc_collect() assert p.checkedout() == 0 c3 = p.connect() assert c3 is not None | def test_weakref_kaboom(self): p = self._queuepool_fixture(pool_size=3, max_overflow=-1, use_threadlocal=True) c1 = p.connect() c2 = p.connect() c1.close() c2 = None del c1 del c2 gc_collect() assert p.checkedout() == 0 c3 = p.connect() assert c3 is not None | 464,393 |
def test_trick_the_counter(self): """this is a "flaw" in the connection pool; since threadlocal uses a single ConnectionFairy per thread with an open/close counter, you can fool the counter into giving you a ConnectionFairy with an ambiguous counter. i.e. its not true reference counting.""" | def test_trick_the_counter(self): """this is a "flaw" in the connection pool; since threadlocal uses a single ConnectionFairy per thread with an open/close counter, you can fool the counter into giving you a ConnectionFairy with an ambiguous counter. i.e. its not true reference counting.""" | 464,394 |
def test_recycle(self): p = pool.QueuePool(creator=mock_dbapi.connect, pool_size=1, max_overflow=0, use_threadlocal=False, recycle=3) c1 = p.connect() c_id = id(c1.connection) c1.close() c2 = p.connect() assert id(c2.connection) == c_id c2.close() time.sleep(4) c3 = p.connect() assert id(c3.connection) != c_id | def test_recycle(self): p = self._queuepool_fixture(pool_size=1, max_overflow=0, recycle=3) c1 = p.connect() c_id = id(c1.connection) c1.close() c2 = p.connect() assert id(c2.connection) == c_id c2.close() time.sleep(4) c3 = p.connect() assert id(c3.connection) != c_id | 464,395 |
def test_invalidate(self): dbapi = MockDBAPI() p = pool.QueuePool(creator=lambda : dbapi.connect('foo.db'), pool_size=1, max_overflow=0, use_threadlocal=False) c1 = p.connect() c_id = c1.connection.id c1.close() c1 = None c1 = p.connect() assert c1.connection.id == c_id c1.invalidate() c1 = None c1 = p.connect() assert... | def test_invalidate(self): p = self._queuepool_fixture(pool_size=1, max_overflow=0) c1 = p.connect() c_id = c1.connection.id c1.close() c1 = None c1 = p.connect() assert c1.connection.id == c_id c1.invalidate() c1 = None c1 = p.connect() assert c1.connection.id != c_id | 464,396 |
def test_recreate(self): dbapi = MockDBAPI() p = pool.QueuePool(creator=lambda : dbapi.connect('foo.db'), pool_size=1, max_overflow=0, use_threadlocal=False) p2 = p.recreate() assert p2.size() == 1 assert p2._use_threadlocal is False assert p2._max_overflow == 0 | def test_recreate(self): p = self._queuepool_fixture(pool_size=1, max_overflow=0) p2 = p.recreate() assert p2.size() == 1 assert p2._use_threadlocal is False assert p2._max_overflow == 0 | 464,397 |
def test_reconnect(self): """tests reconnect operations at the pool level. SA's engine/dialect includes another layer of reconnect support for 'database was lost' errors.""" | def test_reconnect(self): """tests reconnect operations at the pool level. SA's engine/dialect includes another layer of reconnect support for 'database was lost' errors.""" | 464,398 |
def test_detach(self): dbapi = MockDBAPI() p = pool.QueuePool(creator=lambda : dbapi.connect('foo.db'), pool_size=1, max_overflow=0, use_threadlocal=False) c1 = p.connect() c1.detach() c_id = c1.connection.id c2 = p.connect() assert c2.connection.id != c1.connection.id dbapi.raise_error = True c2.invalidate() c2 = None... | def test_detach(self): dbapi, p = self._queuepool_dbapi_fixture(pool_size=1, max_overflow=0) c1 = p.connect() c1.detach() c_id = c1.connection.id c2 = p.connect() assert c2.connection.id != c1.connection.id dbapi.raise_error = True c2.invalidate() c2 = None c2 = p.connect() assert c2.connection.id != c1.connection.id c... | 464,399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.