Unnamed: 0
int64
0
10k
function
stringlengths
79
138k
label
stringclasses
20 values
info
stringlengths
42
261
300
def get_title(self): """ Return the string literal that is used in the template. The title is used in the admin screens. """ try: return extract_literal(self.meta_kwargs['title']) except __HOLE__: slot = self.get_slot() if slot is not N...
KeyError
dataset/ETHPy150Open edoburu/django-fluent-contents/fluent_contents/templatetags/fluent_contents_tags.py/PagePlaceholderNode.get_title
301
def get_role(self): """ Return the string literal that is used in the template. The role can be "main", "sidebar" or "related", or shorted to "m", "s", "r". """ try: return extract_literal(self.meta_kwargs['role']) except __HOLE__: return None
KeyError
dataset/ETHPy150Open edoburu/django-fluent-contents/fluent_contents/templatetags/fluent_contents_tags.py/PagePlaceholderNode.get_role
302
def get_fallback_language(self): """ Return whether to use the fallback language. """ try: # Note: currently not supporting strings yet. return extract_literal_bool(self.kwargs['fallback']) or None except __HOLE__: return False
KeyError
dataset/ETHPy150Open edoburu/django-fluent-contents/fluent_contents/templatetags/fluent_contents_tags.py/PagePlaceholderNode.get_fallback_language
303
def _get_placeholder_arg(arg_name, placeholder): """ Validate and return the Placeholder object that the template variable points to. """ if placeholder is None: raise RuntimeWarning(u"placeholder object is None") elif isinstance(placeholder, Placeholder): return placeholder elif...
AttributeError
dataset/ETHPy150Open edoburu/django-fluent-contents/fluent_contents/templatetags/fluent_contents_tags.py/_get_placeholder_arg
304
def get_bug_list(self): """Returns a list of bugs associated with this review request.""" if self.bugs_closed == "": return [] bugs = list(set(re.split(r"[, ]+", self.bugs_closed))) # First try a numeric sort, to show the best results for the majority # case of bug ...
ValueError
dataset/ETHPy150Open reviewboard/reviewboard/reviewboard/reviews/models/base_review_request_details.py/BaseReviewRequestDetails.get_bug_list
305
def available(): try: import av from PIL import Image except __HOLE__: return False else: return True
ImportError
dataset/ETHPy150Open soft-matter/pims/pims/pyav_reader.py/available
306
def test_wanted_dirs(self): # _candidate_tempdir_list contains the expected directories # Make sure the interesting environment variables are all set. with test_support.EnvironmentVarGuard() as env: for envname in 'TMPDIR', 'TEMP', 'TMP': dirname = os.getenv(envname)...
AttributeError
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/test/test_tempfile.py/test__candidate_tempdir_list.test_wanted_dirs
307
def test_noinherit(self): # _mkstemp_inner file handles are not inherited by child processes if not has_spawnl: return # ugh, can't use TestSkipped. if test_support.verbose: v="v" else: v="q" file = self.do_create() fd = "%...
NameError
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/test/test_tempfile.py/test__mkstemp_inner.test_noinherit
308
def _Exists(self): """Returns true if the disk exists.""" cmd = util.GcloudCommand(self, 'compute', 'disks', 'describe', self.name) stdout, _, _ = cmd.Issue(suppress_warning=True) try: json.loads(stdout) except __HOLE__: return False return True
ValueError
dataset/ETHPy150Open GoogleCloudPlatform/PerfKitBenchmarker/perfkitbenchmarker/providers/gcp/gce_disk.py/GceDisk._Exists
309
def _get_key_value(string): """Return the (key, value) as a tuple from a string.""" # Normally all properties look like this: # Unique Identifier: 600508B1001CE4ACF473EE9C826230FF # Disk Name: /dev/sda # Mount Points: None key = '' value = '' try: key, value = string.split(...
ValueError
dataset/ETHPy150Open openstack/proliantutils/proliantutils/hpssa/objects.py/_get_key_value
310
def _hpssacli(*args, **kwargs): """Wrapper function for executing hpssacli command. :param args: args to be provided to hpssacli command :param kwargs: kwargs to be sent to processutils except the following: - dont_transform_to_hpssa_exception - Set to True if this method shouldn'...
OSError
dataset/ETHPy150Open openstack/proliantutils/proliantutils/hpssa/objects.py/_hpssacli
311
def __init__(self, id, properties, parent): """Constructor for a LogicalDrive object.""" # Strip off 'Logical Drive' before storing it in id self.id = id[15:] self.parent = parent self.properties = properties # 'string_to_bytes' takes care of converting any returned ...
ValueError
dataset/ETHPy150Open openstack/proliantutils/proliantutils/hpssa/objects.py/LogicalDrive.__init__
312
def __init__(self, id, properties, parent): """Constructor for a PhysicalDrive object.""" self.parent = parent self.properties = properties # Strip off physicaldrive before storing it in id self.id = id[14:] size = self.properties['Size'].replace(' ', '') # 'str...
ValueError
dataset/ETHPy150Open openstack/proliantutils/proliantutils/hpssa/objects.py/PhysicalDrive.__init__
313
def insert_stats(self, stats): try: with self._cursor() as c: ri = stats['run_info'] try: c.execute("""INSERT INTO run_info VALUES (?, ?, ?, ?, ?, ?, ?, ?)""", [ri['id'], int(float(ri['timestamp'])), ri['machine'], ri['user'], ri['version'], r...
KeyError
dataset/ETHPy150Open pantsbuild/pants/src/python/pants/stats/statsdb.py/StatsDB.insert_stats
314
def _is_valid_name(self, project_name): def _module_exists(module_name): try: import_module(module_name) return True except __HOLE__: return False if not re.search(r'^[_a-zA-Z]\w*$', project_name): print('Error: Project...
ImportError
dataset/ETHPy150Open scrapy/scrapy/scrapy/commands/startproject.py/Command._is_valid_name
315
def main(options): client = get_client(options.host, options.port, options.user, options.password) def compute_signature(index): signature = index["ns"] for key in index["key"]: try: signature += "%s_%s" % (key, int(index["key"][key])) except __HOLE__: ...
ValueError
dataset/ETHPy150Open jwilder/mongodb-tools/mongodbtools/redundant_indexes.py/main
316
def _handle_request(self, request): res = webob.Response() res_content_type = None path = request.path if path.startswith(self._webpath): path = path[len(self._webpath):] routepath, func = self.find_route(path) if routepath: content = func() ...
TypeError
dataset/ETHPy150Open openstack/wsme/wsme/root.py/WSRoot._handle_request
317
def print_(object_): import threading import sys # START OF CRITICAL SECTION __builtin__.__GIL__.acquire() try: import multiprocessing if multiprocessing.current_process().name == 'MainProcess': sys.stdout.write("<%s:%s> : %s\n" % (multiprocessing.current_process(...
ImportError
dataset/ETHPy150Open ikotler/pythonect/pythonect/internal/lang.py/print_
318
def _is_valid(report): """ checks if this meets the preconditions for being allowed in the cache """ try: return ( report.request.domain and report.request.couch_user._id and report.request.get_full_path().startswith( '/a/{domain}/'.format(doma...
AttributeError
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/reports/cache.py/_is_valid
319
def _secure_open_write(filename, fmode): # We only want to write to this file, so open it in write only mode flags = os.O_WRONLY # os.O_CREAT | os.O_EXCL will fail if the file already exists, so we only # will open *new* files. # We specify this because we want to ensure that the mode we pass is t...
OSError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/cachecontrol/caches/file_cache.py/_secure_open_write
320
def set(self, key, value): name = self._fn(key) # Make sure the directory exists try: os.makedirs(os.path.dirname(name), self.dirmode) except (IOError, __HOLE__): pass with self.lock_class(name) as lock: # Write our actual file wi...
OSError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/cachecontrol/caches/file_cache.py/FileCache.set
321
def test_accessors_not_setup(self): info = TorInfo(self.protocol) self.assertTrue(info.__dict__['_setup'] is False) self.assertRaises(TypeError, len, info) dir(info) try: info[0] self.fail("Should have raised TypeError") except __HOLE__: ...
TypeError
dataset/ETHPy150Open meejah/txtorcon/test/test_torinfo.py/InfoTests.test_accessors_not_setup
322
def test_with_arg(self): self.protocol.answers.append('''info/names= multi/path/arg/* a documentation string ''') info = TorInfo(self.protocol) self.assertTrue(hasattr(info, 'multi')) self.assertTrue(hasattr(getattr(info, 'multi'), 'path')) self.assertTrue( hasattr(ge...
TypeError
dataset/ETHPy150Open meejah/txtorcon/test/test_torinfo.py/InfoTests.test_with_arg
323
def test_with_arg_error(self): self.protocol.answers.append('''info/names= multi/no-arg docstring ''') info = TorInfo(self.protocol) try: info.multi.no_arg('an argument') self.assertTrue(False) except __HOLE__: pass
TypeError
dataset/ETHPy150Open meejah/txtorcon/test/test_torinfo.py/InfoTests.test_with_arg_error
324
def __init__ (self,reactor): self.reactor = reactor self.logger = Logger() self.parser = Parser.Text(reactor) try: for name in self.functions: self.callback['text'][name] = Command.Text.callback[name] except __HOLE__: raise RuntimeError('The code does not have an implementation for "%s", please cod...
KeyError
dataset/ETHPy150Open Exa-Networks/exabgp/lib/exabgp/reactor/api/api.py/API.__init__
325
def clean(self, value): super(EEPersonalIdentificationCode, self).clean(value) if value in EMPTY_VALUES: return '' match = re.match(idcode, value) if not match: raise ValidationError(self.error_messages['invalid_format']) century, year, month, day, check...
ValueError
dataset/ETHPy150Open django/django-localflavor/localflavor/ee/forms.py/EEPersonalIdentificationCode.clean
326
def __next__(self, full=False): if self.max_items is not None: if self.count >= self.max_items: raise StopIteration try: item = six.next(self._iter) self.count += 1 if 'timestamp' in item: item['timestamp'] = parse_timestamp...
StopIteration
dataset/ETHPy150Open mwclient/mwclient/mwclient/listing.py/List.__next__
327
def handle(self, *args, **options): update_all = options.get('all') recalculate = options.get('recalculate') if update_all: if recalculate: raise CommandError('--recalculate cannot be used with --all') q = ReviewRequest.objects.all() else: ...
ValueError
dataset/ETHPy150Open reviewboard/reviewboard/reviewboard/reviews/management/commands/reset-issue-counts.py/Command.handle
328
@types.convert(image={"type": "glance_image"}, flavor={"type": "nova_flavor"}) @validation.image_valid_on_flavor("flavor", "image") @validation.valid_command("command") @validation.number("port", minval=1, maxval=65535, nullable=True, integer_only=True) @validat...
ValueError
dataset/ETHPy150Open openstack/rally/rally/plugins/openstack/scenarios/vm/vmtasks.py/VMTasks.boot_runcommand_delete
329
def do_load(self, line): """Load a backup based on its number per `list`.. """ try: i = int(line) filename = self.get_filenames()[i] except (ValueError, __HOLE__): print('\x1b[31;1mBad backup number!\x1b[0m') print('\x1b[32;1mPick one of th...
KeyError
dataset/ETHPy150Open gratipay/gratipay.com/bin/snapper.py/Snapper.do_load
330
def run(infile, options, report_step=10000): options.tablename = quoteTableName( options.tablename, backend=options.backend) if options.map: m = {} for x in options.map: f, t = x.split(":") m[f] = t options.map = m else: options.map = {} ...
ValueError
dataset/ETHPy150Open CGATOxford/cgat/CGAT/CSV2DB.py/run
331
def test_auth(self): # client without global auth set hsc = HubstorageClient(endpoint=self.hsclient.endpoint) self.assertEqual(hsc.auth, None) # check no-auth access try: hsc.push_job(self.projectid, self.spidername) except HTTPError as exc: self....
HTTPError
dataset/ETHPy150Open scrapinghub/python-hubstorage/tests/test_project.py/ProjectTest.test_auth
332
def filter(self, userinfo, user_info_claims=None): """ Return only those claims that are asked for. It's a best effort task; if essential claims are not present no error is flagged. :param userinfo: A dictionary containing the available user info. :param user_info_claims...
KeyError
dataset/ETHPy150Open rohe/pyoidc/src/oic/utils/userinfo/__init__.py/UserInfo.filter
333
def __call__(self, userid, client_id, user_info_claims=None, **kwargs): try: return self.filter(self.db[userid], user_info_claims) except __HOLE__: return {}
KeyError
dataset/ETHPy150Open rohe/pyoidc/src/oic/utils/userinfo/__init__.py/UserInfo.__call__
334
def get_most_significant_input_dimensions(self, which_indices=None): """ Determine which dimensions should be plotted Returns the top three most signification input dimensions if less then three dimensions, the non existing dimensions are labeled as None, so for a 1 dimensional...
ValueError
dataset/ETHPy150Open SheffieldML/GPy/GPy/kern/src/kern.py/Kern.get_most_significant_input_dimensions
335
def set_editor(self, editor): try: self.setHtml(editor.to_html()) except (TypeError, __HOLE__): self.setHtml('<center>No preview available...</center>') self._editor = None self.hide_requested.emit() else: if self._editor is not None an...
AttributeError
dataset/ETHPy150Open OpenCobolIDE/OpenCobolIDE/open_cobol_ide/extlibs/pyqode/core/widgets/preview.py/HtmlPreviewWidget.set_editor
336
def _update_preview(self): try: # remember cursor/scrollbar position p = self.textCursor().position() v = self.verticalScrollBar().value() # display new html self.setHtml(self._editor.to_html()) # restore cursor/scrollbar position ...
AttributeError
dataset/ETHPy150Open OpenCobolIDE/OpenCobolIDE/open_cobol_ide/extlibs/pyqode/core/widgets/preview.py/HtmlPreviewWidget._update_preview
337
@web.authenticated @gen.coroutine def get(self): app = self.application capp = app.capp try: broker = Broker(capp.connection().as_uri(include_password=True), http_api=app.options.broker_api) except __HOLE__: self.write({}) ...
NotImplementedError
dataset/ETHPy150Open mher/flower/flower/views/monitor.py/BrokerMonitor.get
338
def run_only_if_bernhard_is_available(func): try: import bernhard except __HOLE__: bernhard = None pred = lambda: bernhard is not None return run_only(func, pred)
ImportError
dataset/ETHPy150Open BrightcoveOS/Diamond/src/diamond/handler/test/testriemann.py/run_only_if_bernhard_is_available
339
def ext_pillar(minion_id, pillar, profile=None): ''' Read pillar data from Confidant via its API. ''' if profile is None: profile = {} # default to returning failure ret = { 'credentials_result': False, 'credentials': None, 'credentials_metadata': None } p...
TypeError
dataset/ETHPy150Open saltstack/salt/salt/pillar/confidant.py/ext_pillar
340
def search(request): params = request.GET q = params.get('q', '') page = params.get('page', 1) fmt = params.get('format', 'html') raw = params.get('raw', False) online = params.get('online', False) page_size = params.get('page_size', 20) try: page = int(page) page_size =...
ValueError
dataset/ETHPy150Open gwu-libraries/launchpad/lp/ui/views.py/search
341
def get_format_args(fstr): """ Turn a format string into two lists of arguments referenced by the format string. One is positional arguments, and the other is named arguments. Each element of the list includes the name and the nominal type of the field. # >>> get_format_args("{noun} is {1:d} ye...
ValueError
dataset/ETHPy150Open mahmoud/boltons/boltons/formatutils.py/get_format_args
342
def __format__(self, fmt): value = self.get_value() pt = fmt[-1:] # presentation type type_conv = _TYPE_MAP.get(pt, str) try: return value.__format__(fmt) except (ValueError, __HOLE__): # TODO: this may be overkill return type_conv(value).__...
TypeError
dataset/ETHPy150Open mahmoud/boltons/boltons/formatutils.py/DeferredValue.__format__
343
def getStream(self): """Gets the resource as stream. @see: L{IApplicationResource.getStream} """ try: ds = DownloadStream(file(self._sourceFile, 'rb'), self.getMIMEType(), self.getFilename()) length ...
IOError
dataset/ETHPy150Open rwl/muntjac/muntjac/terminal/file_resource.py/FileResource.getStream
344
def getOptPort(rets, f_target, l_period=1, naLower=None, naUpper=None, lNagDebug=0): """ @summary Returns the Markowitz optimum portfolio for a specific return. @param rets: Daily returns of the various stocks (using returnize1) @param f_target: Target return, i.e. 0.04 = 4% per period @param l_peri...
RuntimeError
dataset/ETHPy150Open QuantSoftware/QuantSoftwareToolkit/QSTK/qstkutil/tsutil.py/getOptPort
345
def OptPort( naData, fTarget, naLower=None, naUpper=None, naExpected=None, s_type = "long"): """ @summary Returns the Markowitz optimum portfolio for a specific return. @param naData: Daily returns of the various stocks (using returnize1) @param fTarget: Target return, i.e. 0.04 = 4% per period @par...
ImportError
dataset/ETHPy150Open QuantSoftware/QuantSoftwareToolkit/QSTK/qstkutil/tsutil.py/OptPort
346
def get_uid_gid(username, groupname=None): """Try to change UID and GID to the provided values. The parameters are given as names like 'nobody' not integer. May raise KeyError. Src: http://mail.mems-exchange.org/durusmail/quixote-users/4940/1/ """ try: uid, default_grp = pwd.getpwnam(username)[2:4] e...
KeyError
dataset/ETHPy150Open cloudera/hue/desktop/core/src/desktop/lib/daemon_utils.py/get_uid_gid
347
def finalize_options(self): if self.match is None: raise DistutilsOptionError( "Must specify one or more (comma-separated) match patterns " "(e.g. '.zip' or '.egg')" ) if self.keep is None: raise DistutilsOptionError("Must specify numbe...
ValueError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/setuptools-0.6c11/setuptools/command/rotate.py/rotate.finalize_options
348
@register.function @jinja2.contextfunction def breadcrumbs(context, items=list(), add_default=True, crumb_size=40): """ show a list of breadcrumbs. If url is None, it won't be a link. Accepts: [(url, label)] """ if add_default: app = context['request'].APP crumbs = [(urlresolvers.rev...
TypeError
dataset/ETHPy150Open mozilla/addons-server/src/olympia/amo/helpers.py/breadcrumbs
349
@register.function @jinja2.contextfunction def impala_breadcrumbs(context, items=list(), add_default=True, crumb_size=40): """ show a list of breadcrumbs. If url is None, it won't be a link. Accepts: [(url, label)] """ if add_default: base_title = page_name(context['request'].APP) cr...
TypeError
dataset/ETHPy150Open mozilla/addons-server/src/olympia/amo/helpers.py/impala_breadcrumbs
350
@register.filter def is_choice_field(value): try: return isinstance(value.field.widget, CheckboxInput) except __HOLE__: pass
AttributeError
dataset/ETHPy150Open mozilla/addons-server/src/olympia/amo/helpers.py/is_choice_field
351
@register.function @jinja2.contextfunction def remora_url(context, url, lang=None, app=None, prefix=''): """Wrapper for urlresolvers.remora_url""" if lang is None: _lang = context['LANG'] if _lang: lang = to_locale(_lang).replace('_', '-') if app is None: try: ...
KeyError
dataset/ETHPy150Open mozilla/addons-server/src/olympia/amo/helpers.py/remora_url
352
@register.function @jinja2.contextfunction def hasOneToOne(context, obj, attr): try: getattr(obj, attr) return True except __HOLE__: return False
ObjectDoesNotExist
dataset/ETHPy150Open mozilla/addons-server/src/olympia/amo/helpers.py/hasOneToOne
353
def recv_reply(self): code = None message_lines = [] incomplete = True input = self.recv_buffer while incomplete: start_i = 0 while start_i is not None: match = reply_line_pattern.match(input, start_i) if match: ...
UnicodeDecodeError
dataset/ETHPy150Open slimta/python-slimta/slimta/smtp/io.py/IO.recv_reply
354
def __eq__(self, other): """'Deep, sparse compare. Deeply compare two entities, following the non-None attributes of the non-persisted object, if possible. """ if other is self: return True elif not self.__class__ == other.__class__: return False...
AttributeError
dataset/ETHPy150Open RoseOu/flasky/venv/lib/python2.7/site-packages/sqlalchemy/testing/entities.py/ComparableEntity.__eq__
355
def __init__(self, key=None, api_url=None, version=None, center=None, zoom=None, dom_id='map', kml_urls=[], polylines=None, polygons=None, markers=None, template='gis/google/google-map.js', js_module='geodjango', extra_context={}): ...
AttributeError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/contrib/gis/maps/google/gmap.py/GoogleMap.__init__
356
def _get_config_errors(request, cache=True): """Returns a list of (confvar, err_msg) tuples.""" global _CONFIG_ERROR_LIST if not cache or _CONFIG_ERROR_LIST is None: error_list = [ ] for module in appmanager.DESKTOP_MODULES: # Get the config_validator() function try: validator = getat...
AttributeError
dataset/ETHPy150Open cloudera/hue/desktop/core/src/desktop/views.py/_get_config_errors
357
def parse_ivorn(ivorn): """ Takes an IVORN of the form ivo://authorityID/resourceKey#local_ID and returns (authorityID, resourceKey, local_ID). Raise if that isn't possible. Refer to the IVOA Identifiers Recommendation (1.12) for justification, but note that document is not as clear a...
AttributeError
dataset/ETHPy150Open jdswinbank/Comet/comet/utility/voevent.py/parse_ivorn
358
def __getattr__(self, name): try: return self.providers[name] except __HOLE__: msg = "'_SocialState' object has no attribute '%s'" % name raise AttributeError(msg)
KeyError
dataset/ETHPy150Open mattupstate/flask-social/flask_social/core.py/_SocialState.__getattr__
359
def __init__(self): # grammar.app_context: [grammar instances with given app_content field] self.global_grammars = [] self.active_global_grammars = [] self.local_grammars = {} self.active_local_grammars = {} self.triggered = { 'word': { 'before...
AttributeError
dataset/ETHPy150Open evfredericksen/pynacea/pynhost/pynhost/grammarhandler.py/GrammarHandler.__init__
360
def load_grammars_from_module(self, module): clsmembers = inspect.getmembers(sys.modules[module.__name__], inspect.isclass) for member in clsmembers: # screen for objects with grammarbase.GrammarBase ancestor class_hierarchy = inspect.getmro(member[1]) if len(class_hi...
KeyError
dataset/ETHPy150Open evfredericksen/pynacea/pynhost/pynhost/grammarhandler.py/GrammarHandler.load_grammars_from_module
361
def set_active_grammars(self): try: self.active_global_grammars = utilities.filter_grammar_list(self.global_grammars, self.process_contexts) except __HOLE__: self.active_global_grammars = [] self.active_local_grammars = {} self.active_global_grammars.sort(reverse=...
KeyError
dataset/ETHPy150Open evfredericksen/pynacea/pynhost/pynhost/grammarhandler.py/GrammarHandler.set_active_grammars
362
def __init__(self, connexion, graph, logger, separator = '@@@', has_root = False ): """initialize a Redisgraph instance connexion: a redis connexion graph: a graph name (string) logger: a logger separator: fields separator must not be in an...
AttributeError
dataset/ETHPy150Open kakwa/pygraph_redis/pygraph_redis/directed_graph.py/Directed_graph.__init__
363
@classmethod def _loadUserModule(cls, userModule): """ Imports and returns the module object represented by the given module descriptor. :type userModule: ModuleDescriptor """ if not userModule.belongsToToil: userModule = userModule.localize() if userModu...
ImportError
dataset/ETHPy150Open BD2KGenomics/toil/src/toil/job.py/Job._loadUserModule
364
def run(self, fileStore): #Unpickle the service userModule = self._loadUserModule(self.serviceModule) service = self._unpickle( userModule, BytesIO( self.pickledService ) ) #Start the service startCredentials = service.start(fileStore) try: #The start credenti...
RuntimeError
dataset/ETHPy150Open BD2KGenomics/toil/src/toil/job.py/ServiceJob.run
365
def render(self, context): if 'forloop' in context: parentloop = context['forloop'] else: parentloop = {} context.push() try: values = self.sequence.resolve(context, True) except VariableDoesNotExist: values = [] if values i...
TypeError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/_internal/django/template/defaulttags.py/ForNode.render
366
def render(self, context): if not include_is_allowed(self.filepath): if settings.DEBUG: return "[Didn't have permission to include file]" else: return '' # Fail silently for invalid includes. try: fp = open(self.filepath, 'r') ...
IOError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/_internal/django/template/defaulttags.py/SsiNode.render
367
def render(self, context): try: value = self.val_expr.resolve(context) maxvalue = self.max_expr.resolve(context) max_width = int(self.max_width.resolve(context)) except VariableDoesNotExist: return '' except ValueError: raise TemplateSy...
ValueError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/_internal/django/template/defaulttags.py/WidthRatioNode.render
368
def mkdirs(path): try: makedirs(path) except __HOLE__ as err: if err.errno != EEXIST: raise
OSError
dataset/ETHPy150Open openstack/python-swiftclient/swiftclient/service.py/mkdirs
369
def __init__(self, path, body, headers): self._path = path self._body = body self._actual_read = 0 self._content_length = None self._actual_md5 = None self._expected_etag = headers.get('etag') if ('x-object-manifest' not in headers and 'x-static-l...
ValueError
dataset/ETHPy150Open openstack/python-swiftclient/swiftclient/service.py/_SwiftReader.__init__
370
def _download_object_job(self, conn, container, obj, options): out_file = options['out_file'] results_dict = {} req_headers = split_headers(options['header'], '') pseudodir = False path = join(container, obj) if options['yes_all'] else obj path = path.lstrip(os_path_sep...
ValueError
dataset/ETHPy150Open openstack/python-swiftclient/swiftclient/service.py/SwiftService._download_object_job
371
def _submit_page_downloads(self, container, page_generator, options): try: list_page = next(page_generator) except __HOLE__: return None if list_page["success"]: objects = [o["name"] for o in list_page["listing"]] if options["shuffle"]: ...
StopIteration
dataset/ETHPy150Open openstack/python-swiftclient/swiftclient/service.py/SwiftService._submit_page_downloads
372
def upload(self, container, objects, options=None): """ Upload a list of objects to a given container. :param container: The container (or pseudo-folder path) to put the uploads into. :param objects: A list of file/directory names (strings) or ...
ValueError
dataset/ETHPy150Open openstack/python-swiftclient/swiftclient/service.py/SwiftService.upload
373
def _is_identical(self, chunk_data, path): try: fp = open(path, 'rb') except __HOLE__: return False with fp: for chunk in chunk_data: to_read = chunk['bytes'] md5sum = md5() while to_read: da...
IOError
dataset/ETHPy150Open openstack/python-swiftclient/swiftclient/service.py/SwiftService._is_identical
374
def _upload_object_job(self, conn, container, source, obj, options, results_queue=None): if obj.startswith('./') or obj.startswith('.\\'): obj = obj[2:] if obj.startswith('/'): obj = obj[1:] res = { 'action': 'upload_object', ...
OSError
dataset/ETHPy150Open openstack/python-swiftclient/swiftclient/service.py/SwiftService._upload_object_job
375
@task def serve(port=8000): """Simple HTTP server for the docs""" import os from SimpleHTTPServer import SimpleHTTPRequestHandler import SocketServer os.chdir("./build/dirhtml") httpd = SocketServer.TCPServer(("", port), SimpleHTTPRequestHandler) try: print "Serving documentation o...
KeyboardInterrupt
dataset/ETHPy150Open armstrong/docs.armstrongcms.org/fabfile.py/serve
376
def connect(self, obj, name, callback, user_arg=None, weak_args=None, user_args=None): """ :param obj: the object sending a signal :type obj: object :param name: the signal to listen for, typically a string :type name: signal name :param callback: the function to call whe...
KeyError
dataset/ETHPy150Open AnyMesh/anyMesh-Python/example/urwid/signals.py/Signals.connect
377
@property def organization(self): """Name of the organization/employer.""" try: # For v1 of gdata ("service" modules)? return self.entry.organization.org_name.text except __HOLE__: # For v3 of gdata ("client" modules)? return self.entry.organiz...
AttributeError
dataset/ETHPy150Open vinitkumar/googlecl/src/googlecl/contacts/__init__.py/ContactsEntryToStringWrapper.organization
378
@property # Overrides Base's title. "name" will still give name of contact. def title(self): """Title of contact in organization.""" try: # For v1 of gdata ("service" modules)? return self.entry.organization.org_title.text except __HOLE__: # For v3 of ...
AttributeError
dataset/ETHPy150Open vinitkumar/googlecl/src/googlecl/contacts/__init__.py/ContactsEntryToStringWrapper.title
379
def main(): try: logFileDir = sys.argv[1] except IndexError: print 'Usage: %s <log file directory>' % sys.argv[0] sys.exit(1) spy.findLCMModulesInSysPath() catalogThread = CatalogThread(logFileDir, 'DECKLINK_VIDEO_CAPTURE') catalogThread.start() serverThread = Server...
KeyboardInterrupt
dataset/ETHPy150Open RobotLocomotion/director/src/python/scripts/videoLogServer.py/main
380
def get_code_dir(self): #Rationale for the default code directory location: # PEP 3147 # http://www.python.org/dev/peps/pep-3147/ # # Which standardizes the __pycache__ directory as a place to put # compilation artifacts for python programs source_dir, source_file...
OSError
dataset/ETHPy150Open bryancatanzaro/copperhead/copperhead/runtime/cufunction.py/CuFunction.get_code_dir
381
def on_get_value(self, rowref, column): fname = os.path.join(self.dirname, rowref) try: filestat = os.stat(fname) except __HOLE__: return None mode = filestat.st_mode if column is 0: if stat.S_ISDIR(mode): return folderpb ...
OSError
dataset/ETHPy150Open anandology/pyjamas/pygtkweb/demos/049-filelisting-gtm.py/FileListModel.on_get_value
382
def on_iter_next(self, rowref): try: i = self.files.index(rowref)+1 return self.files[i] except __HOLE__: return None
IndexError
dataset/ETHPy150Open anandology/pyjamas/pygtkweb/demos/049-filelisting-gtm.py/FileListModel.on_iter_next
383
def on_iter_nth_child(self, rowref, n): if rowref: return None try: return self.files[n] except __HOLE__: return None
IndexError
dataset/ETHPy150Open anandology/pyjamas/pygtkweb/demos/049-filelisting-gtm.py/FileListModel.on_iter_nth_child
384
def mkdir_p(path): try: os.makedirs(path) except __HOLE__ as e: if e.errno != errno.EEXIST or not os.path.isdir(path): raise
OSError
dataset/ETHPy150Open msanders/cider/cider/_sh.py/mkdir_p
385
def read_config(path, fallback=None): is_json = os.path.splitext(path)[1] == ".json" try: with open(path, "r") as f: contents = f.read() or "{}" return json.loads(contents) if is_json else yaml.load(contents) except __HOLE__ as e: if fallback is not None and e.errno =...
IOError
dataset/ETHPy150Open msanders/cider/cider/_sh.py/read_config
386
def get_credentials(): try: with open('metadata') as cred_file: creds = yaml.safe_load(cred_file) creds['opsmgr'] creds['opsmgr']['url'] creds['opsmgr']['username'] creds['opsmgr']['password'] except __HOLE__ as e: print >> sys.stderr, 'metadata file is missing a value:', e.message sys.exit(1) e...
KeyError
dataset/ETHPy150Open cf-platform-eng/tile-generator/lib/opsmgr.py/get_credentials
387
def get_config(self, credit_card): setting_name_base = 'LIVE' if not self.test_mode else 'TEST' setting_names = ['%s_%s' % (setting_name_base, CARD_NAMES[credit_card.card_type]), setting_name_base] for name in setting_names: try: config_dict ...
KeyError
dataset/ETHPy150Open agiliq/merchant/billing/gateways/global_iris_gateway.py/GlobalIrisBase.get_config
388
def register_user(register_user): url = BH_URL + "/api/v1/user" try: response = requests.post(url, data=register_user.to_JSON(), headers=json_headers) response.raise_for_status() # Return our username on a successful resp...
HTTPError
dataset/ETHPy150Open rcaloras/bashhub-client/bashhub/rest_client.py/register_user
389
def login_user(login_form): url = BH_URL + "/api/v1/login" try: response = requests.post(url, data=login_form.to_JSON(), headers=json_headers) response.raise_for_status() login_response_json = json.dumps(response.json()) ...
HTTPError
dataset/ETHPy150Open rcaloras/bashhub-client/bashhub/rest_client.py/login_user
390
def register_system(register_system): url = BH_URL + "/api/v1/system" headers = {'content-type': 'application/json'} try: response = requests.post(url, data=register_system.to_JSON(), headers=json_auth_headers()) response.rais...
HTTPError
dataset/ETHPy150Open rcaloras/bashhub-client/bashhub/rest_client.py/register_system
391
def get_system_information(mac): url = BH_URL + '/api/v1/system' payload = {'mac': mac} try: response = requests.get(url, params=payload, headers=json_auth_headers()) response.raise_for_status() system_json = json.dumps(...
HTTPError
dataset/ETHPy150Open rcaloras/bashhub-client/bashhub/rest_client.py/get_system_information
392
def get_command(uuid): url = BH_URL + "/api/v1/command/{0}".format(uuid) try: response = requests.get(url, headers=json_auth_headers()) response.raise_for_status() json_command = json.dumps(response.json()) return Command.from_JSON(json_command) except ConnectionError as err...
HTTPError
dataset/ETHPy150Open rcaloras/bashhub-client/bashhub/rest_client.py/get_command
393
def delete_command(uuid): url = BH_URL + "/api/v1/command/{0}".format(uuid) try: response = requests.delete(url, headers=base_auth_headers()) response.raise_for_status() return uuid except ConnectionError as error: pass except __HOLE__ as error: print(error) ...
HTTPError
dataset/ETHPy150Open rcaloras/bashhub-client/bashhub/rest_client.py/delete_command
394
@property def tagdict(self): """return a dict converted from this string interpreted as a tag-string .. code-block:: py >>> from pprint import pprint >>> dict_ = IrcString('aaa=bbb;ccc;example.com/ddd=eee').tagdict >>> pprint({str(k): str(v) for k, v in dict_.it...
ValueError
dataset/ETHPy150Open gawel/irc3/irc3/utils.py/IrcString.tagdict
395
def maybedotted(name): """Resolve dotted names: .. code-block:: python >>> maybedotted('irc3.config') <module 'irc3.config' from '...'> >>> maybedotted('irc3.utils.IrcString') <class 'irc3.utils.IrcString'> .. """ if not name: raise LookupError( ...
ImportError
dataset/ETHPy150Open gawel/irc3/irc3/utils.py/maybedotted
396
def info(self): '''Returns the number of completed Adobe payloads, and the AdobeCode of the most recently completed payload.''' last_adobecode = "" logfile = self.get_current_log() if logfile: if self.kind in ['CS6', 'CS5']: regex = r'END TIMER :: \[P...
AttributeError
dataset/ETHPy150Open munki/munki/code/client/munkilib/adobeutils.py/AdobeInstallProgressMonitor.info
397
def killStupidProcesses(): '''A nasty bit of hackery to get Adobe CS5 AAMEE packages to install when at the loginwindow.''' stupid_processes = ["Adobe AIR Installer", "Adobe AIR Application Installer", "InstallAdobeHelp", "open -a /Libr...
OSError
dataset/ETHPy150Open munki/munki/code/client/munkilib/adobeutils.py/killStupidProcesses
398
def runAdobeInstallTool( cmd, number_of_payloads=0, killAdobeAIR=False, payloads=None, kind="CS5", operation="install"): '''An abstraction of the tasks for running Adobe Setup, AdobeUberInstaller, AdobeUberUninstaller, AdobeDeploymentManager, etc''' # initialize an AdobeInstallProgressMonit...
TypeError
dataset/ETHPy150Open munki/munki/code/client/munkilib/adobeutils.py/runAdobeInstallTool
399
def writefile(stringdata, path): '''Writes string data to path. Returns the path on success, empty string on failure.''' try: fileobject = open(path, mode='w', buffering=1) print >> fileobject, stringdata.encode('UTF-8') fileobject.close() return path except (__HOLE__, IO...
OSError
dataset/ETHPy150Open munki/munki/code/client/munkilib/adobeutils.py/writefile