Unnamed: 0
int64
0
10k
function
stringlengths
79
138k
label
stringclasses
20 values
info
stringlengths
42
261
700
def get(self, key, default=None): try: return self[key] except __HOLE__: return default
KeyError
dataset/ETHPy150Open wcong/ants/ants/utils/datatypes.py/MergeDict.get
701
def run_examples(): exceptions = [] failures = 0 for input_command, expected_output, exit_code in INPUTS_AND_OUTPUTS: print '\t', input_command, remove_all_pycs(os.path.abspath(os.path.dirname(__file__))) try: process = subprocess.Popen(input_command, ...
AssertionError
dataset/ETHPy150Open hltbra/pycukes/specs/console_examples/run_examples.py/run_examples
702
def is_ffi_instance(obj): # Compiled FFI modules have a member, ffi, which is an instance of # CompiledFFI, which behaves similarly to an instance of cffi.FFI. In # order to simplify handling a CompiledFFI object, we treat them as # if they're cffi.FFI instances for typing and lowering purposes. try...
TypeError
dataset/ETHPy150Open numba/numba/numba/typing/cffi_utils.py/is_ffi_instance
703
def is_cffi_func(obj): """Check whether the obj is a CFFI function""" try: return ffi.typeof(obj).kind == 'function' except __HOLE__: try: return obj in _ool_func_types except: return False
TypeError
dataset/ETHPy150Open numba/numba/numba/typing/cffi_utils.py/is_cffi_func
704
def previous_current_next(items): """ From http://www.wordaligned.org/articles/zippy-triples-served-with-python Creates an iterator which returns (previous, current, next) triples, with ``None`` filling in when there is no previous or next available. """ extend = itertools.chain([None], ite...
StopIteration
dataset/ETHPy150Open kylef-archive/lithium/lithium/forum/templatetags/forum.py/previous_current_next
705
def quoteaddr(addr): """Quote a subset of the email addresses defined by RFC 821. Should be able to handle anything rfc822.parseaddr can handle. """ m = (None, None) try: m = email.utils.parseaddr(addr)[1] except __HOLE__: pass if m == (None, None): # Indicates par...
AttributeError
dataset/ETHPy150Open deanhiller/databus/webapp/play1.3.x/python/Lib/smtplib.py/quoteaddr
706
def connect(self, host='localhost', port = 0): """Connect to a host on a given port. If the hostname ends with a colon (`:') followed by a number, and there is no port specified, that suffix will be stripped off and the number interpreted as the port number to use. Note:...
ValueError
dataset/ETHPy150Open deanhiller/databus/webapp/play1.3.x/python/Lib/smtplib.py/SMTP.connect
707
def getreply(self): """Get a reply from the server. Returns a tuple consisting of: - server response code (e.g. '250', or such, if all goes well) Note: returns -1 if it can't read response code. - server response string corresponding to response code (multiline...
ValueError
dataset/ETHPy150Open deanhiller/databus/webapp/play1.3.x/python/Lib/smtplib.py/SMTP.getreply
708
def __init__(self, resultfunc, downloadid, peerid, ip, port, rawserver, encrypted = False): self.resultfunc = resultfunc self.downloadid = downloadid self.peerid = peerid self.ip = ip self.port = port self.encrypted = encrypted self.closed = False...
IOError
dataset/ETHPy150Open Cclleemm/FriendlyTorrent/src/tornado/BitTornado/BT1/NatCheck.py/NatCheck.__init__
709
def answer(self, result): self.closed = True try: self.connection.close() except __HOLE__: pass self.resultfunc(result, self.downloadid, self.peerid, self.ip, self.port)
AttributeError
dataset/ETHPy150Open Cclleemm/FriendlyTorrent/src/tornado/BitTornado/BT1/NatCheck.py/NatCheck.answer
710
def __getattr__(self, attr): if attr not in self.defaults.keys(): raise AttributeError("Invalid HEDWIG setting: '%s'" % attr) try: # Check if present in user settings val = self.user_settings[attr] except __HOLE__: # Fall back to defaults ...
KeyError
dataset/ETHPy150Open ofpiyush/hedwig-py/hedwig/core/settings.py/Settings.__getattr__
711
def process_request(self, req, resp): # req.stream corresponds to the WSGI wsgi.input environ variable, # and allows you to read bytes from the request body. # # See also: PEP 3333 if req.content_length in (None, 0): # Nothing to do return body = ...
UnicodeDecodeError
dataset/ETHPy150Open falconry/falcon/tests/test_example.py/JSONTranslator.process_request
712
@falcon.before(max_body(64 * 1024)) def on_post(self, req, resp, user_id): try: doc = req.context['doc'] except __HOLE__: raise falcon.HTTPBadRequest( 'Missing thing', 'A thing must be submitted in the request body.') proper_thing = se...
KeyError
dataset/ETHPy150Open falconry/falcon/tests/test_example.py/ThingsResource.on_post
713
def __init__(self): # initialize OptionsLoaderMiddleware from django.conf import settings self.loaders = [] for loader_path in getattr(settings, 'OPTIONS_LOADERS', getattr(settings, 'options_loaders', [])) : try: mw_module, mw_classname = loader_path.rspli...
ImportError
dataset/ETHPy150Open joke2k/django-options/django_options/middleware.py/OptionsLoaderMiddleware.__init__
714
@lazyproperty def core_properties(self): """ Instance of |CoreProperties| holding the read/write Dublin Core document properties for this presentation. Creates a default core properties part if one is not present (not common). """ try: return self.part_rel...
KeyError
dataset/ETHPy150Open scanny/python-pptx/pptx/package.py/Package.core_properties
715
@classmethod def parse(cls, header, updates_to=None, type=None): """ Parse the header, returning a CacheControl object. The object is bound to the request or response object ``updates_to``, if that is given. """ if updates_to: props = cls.update_dict() ...
ValueError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/webob-1.1.1/webob/cachecontrol.py/CacheControl.parse
716
@property def certificate(self): """ Retrieves the certificate used to sign the bounce message. TODO: Cache the certificate based on the cert URL so we don't have to retrieve it for each bounce message. *We would need to do it in a secure way so that the cert couldn't be ove...
ImportError
dataset/ETHPy150Open django-ses/django-ses/django_ses/utils.py/BounceMessageVerifier.certificate
717
def display_available_branches(): """Displays available branches.""" branches = get_branches() if not branches: print(colored.red('No branches available')) return branch_col = len(max([b.name for b in branches], key=len)) + 1 for branch in branches: try: bran...
TypeError
dataset/ETHPy150Open kennethreitz/legit/legit/cli.py/display_available_branches
718
def move_to_tre_server(self, fnm): source = os.path.join(conf.get(self.backend_name, 'blob.datadir'), fnm) target = os.path.join(conf.get('general', 'tre_data_folder'), fnm) try: os.symlink(os.path.abspath(source), os.path.abspath(target)) except __HOLE__, ex: if ...
OSError
dataset/ETHPy150Open livenson/vcdm/src/vcdm/backends/blob/localdisk.py/POSIXBlob.move_to_tre_server
719
def run(self): """Main run loop.""" self._timer_init() self.log.info("Starting the run loop at %sHz", self.HZ) start_time = time.time() loops = 0 secs_per_tick = self.secs_per_tick self.next_tick_time = time.time() try: while self.done is ...
KeyboardInterrupt
dataset/ETHPy150Open missionpinball/mpf/mpf/media_controller/core/media_controller.py/MediaController.run
720
def bcp_hello(self, **kwargs): """Processes an incoming BCP 'hello' command.""" try: if LooseVersion(kwargs['version']) == ( LooseVersion(version.__bcp_version__)): self.send('hello', version=version.__bcp_version__) else: self....
KeyError
dataset/ETHPy150Open missionpinball/mpf/mpf/media_controller/core/media_controller.py/MediaController.bcp_hello
721
def bcp_player_variable(self, name, value, prev_value, change, player_num, **kwargs): """Processes an incoming BCP 'player_variable' command.""" try: self.player_list[int(player_num)-1][name] = value except (__HOLE__, KeyError): pass
IndexError
dataset/ETHPy150Open missionpinball/mpf/mpf/media_controller/core/media_controller.py/MediaController.bcp_player_variable
722
def bcp_player_score(self, value, prev_value, change, player_num, **kwargs): """Processes an incoming BCP 'player_score' command.""" try: self.player_list[int(player_num)-1]['score'] = int(value) except (IndexError, __HOLE__): pass
KeyError
dataset/ETHPy150Open missionpinball/mpf/mpf/media_controller/core/media_controller.py/MediaController.bcp_player_score
723
def bcp_player_turn_start(self, player_num, **kwargs): """Processes an incoming BCP 'player_turn_start' command.""" self.log.debug("bcp_player_turn_start") if ((self.player and self.player.number != player_num) or not self.player): try: self.player ...
IndexError
dataset/ETHPy150Open missionpinball/mpf/mpf/media_controller/core/media_controller.py/MediaController.bcp_player_turn_start
724
def get_debug_status(self, debug_path): if self.options['loglevel'] > 10 or self.options['consoleloglevel'] > 10: return True class_, module = debug_path.split('|') try: if module in self.active_debugger[class_]: return True else: ...
KeyError
dataset/ETHPy150Open missionpinball/mpf/mpf/media_controller/core/media_controller.py/MediaController.get_debug_status
725
def _set_machine_var(self, name, value): try: prev_value = self.machine_vars[name] except __HOLE__: prev_value = None self.machine_vars[name] = value try: change = value-prev_value except TypeError: if prev_value != value: ...
KeyError
dataset/ETHPy150Open missionpinball/mpf/mpf/media_controller/core/media_controller.py/MediaController._set_machine_var
726
def __eq__(self, other): """Check if the properties and bodies of this Message and another Message are the same Received messages may contain a 'delivery_info' attribute, which isn't compared. """ try: return super(Message, self).__eq__(other) and self.body == other.body ...
AttributeError
dataset/ETHPy150Open veegee/amqpy/amqpy/message.py/Message.__eq__
727
@classmethod def resolve_alias(cls, heading): """""" titled_heading = heading.title() try: return cls.ALIASES[titled_heading] except __HOLE__: return heading
KeyError
dataset/ETHPy150Open KristoforMaynard/SublimeAutoDocstring/docstring_styles.py/Section.resolve_alias
728
def exists(path): try: return os.path.exists(path) except __HOLE__: return False
IOError
dataset/ETHPy150Open comodit/synapse-agent/synapse/resources/files-plugin/unix-files.py/exists
729
def is_file(path): try: return os.path.isfile(path) except __HOLE__: return False
IOError
dataset/ETHPy150Open comodit/synapse-agent/synapse/resources/files-plugin/unix-files.py/is_file
730
def create_folders(path): try: # Recursive mkdirs if dir path is not complete os.makedirs(path) except __HOLE__: #Already exists, no prob ! pass except Exception as err: # Another problem raise ResourceException('Failed when creating folders: %s' % err)
OSError
dataset/ETHPy150Open comodit/synapse-agent/synapse/resources/files-plugin/unix-files.py/create_folders
731
def update_meta(path, owner, group, filemode): if not os.path.exists(path): raise ResourceException('This path does not exist.') ownerid = get_owner_id(owner) groupid = get_group_id(group) octfilemode = int(filemode, 8) try: os.chmod(path, octfilemode) os.chown(path, owneri...
ValueError
dataset/ETHPy150Open comodit/synapse-agent/synapse/resources/files-plugin/unix-files.py/update_meta
732
def delete(path): try: os.remove(path) except __HOLE__: log.debug('File %s does not exist', path)
OSError
dataset/ETHPy150Open comodit/synapse-agent/synapse/resources/files-plugin/unix-files.py/delete
733
def owner(path): if not os.path.exists(path): raise ResourceException('File does not exist.') si = os.stat(path) uid = si.st_uid try: return pwd.getpwuid(uid).pw_name except __HOLE__ as err: raise ResourceException(err)
KeyError
dataset/ETHPy150Open comodit/synapse-agent/synapse/resources/files-plugin/unix-files.py/owner
734
def get_owner_id(name): try: return pwd.getpwnam(name).pw_uid except __HOLE__ as err: raise ResourceException(err)
KeyError
dataset/ETHPy150Open comodit/synapse-agent/synapse/resources/files-plugin/unix-files.py/get_owner_id
735
def group(path): if not os.path.exists(path): raise ResourceException('File does not exist.') si = os.stat(path) gid = si.st_gid try: return grp.getgrgid(gid).gr_name except __HOLE__ as err: raise ResourceException(err)
KeyError
dataset/ETHPy150Open comodit/synapse-agent/synapse/resources/files-plugin/unix-files.py/group
736
def get_group_id(name): try: return grp.getgrnam(name).gr_gid except __HOLE__ as err: raise ResourceException(err)
KeyError
dataset/ETHPy150Open comodit/synapse-agent/synapse/resources/files-plugin/unix-files.py/get_group_id
737
def get_readme(): try: return open(os.path.join(os.path.dirname(__file__), 'README.rst')).read() except __HOLE__: return ''
IOError
dataset/ETHPy150Open Atomidata/django-audit-log/setup.py/get_readme
738
def http_emitter(message, log, agentConfig, endpoint): "Send payload" url = agentConfig['sd_url'] log.debug('http_emitter: attempting postback to ' + url) # Post back the data try: payload = json.dumps(message) except __HOLE__: message = remove_control_chars(message) pa...
UnicodeDecodeError
dataset/ETHPy150Open serverdensity/sd-agent/emitter.py/http_emitter
739
def assert_series_equal(left, right, check_names=True, **kwargs): """Backwards compatibility wrapper for ``pandas.util.testing.assert_series_equal`` Examples -------- >>> import pandas as pd >>> s = pd.Series(list('abc'), name='a') >>> s2 = pd.Series(list('abc'), name='b') >>> assert_se...
TypeError
dataset/ETHPy150Open blaze/blaze/blaze/compatibility.py/assert_series_equal
740
def _load_github_hooks(github_url='https://api.github.com'): """Request GitHub's IP block from their API. Return the IP network. If we detect a rate-limit error, raise an error message stating when the rate limit will reset. If something else goes wrong, raise a generic 503. """ try: ...
KeyError
dataset/ETHPy150Open nickfrostatx/flask-hookserver/flask_hookserver.py/_load_github_hooks
741
def create_event(message_type=None, routing_key='everybody', **kwargs): ''' Create an event in VictorOps. Designed for use in states. The following parameters are required: :param message_type: One of the following values: INFO, WARNING, ACKNOWLEDGEMENT, CRITICAL, RECOVERY. The followi...
TypeError
dataset/ETHPy150Open saltstack/salt/salt/modules/victorops.py/create_event
742
def chunks(self, chunk_size=None): """ Read the file and yield chucks of ``chunk_size`` bytes (defaults to ``UploadedFile.DEFAULT_CHUNK_SIZE``). """ if not chunk_size: chunk_size = self.DEFAULT_CHUNK_SIZE try: self.seek(0) except (__HOLE__...
AttributeError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Django-1.6.10/django/core/files/base.py/File.chunks
743
def read_utf8(self): try: import codecs f = codecs.open(self.filepath, encoding='utf_8', mode='r') except __HOLE__ as ioe: sys.stderr.write("Glue Plugin Error: Unable to open file for read with read_utf8() method.") raise ioe try: retur...
IOError
dataset/ETHPy150Open chrissimpkins/glue/GlueIO.py/FileReader.read_utf8
744
def write_utf8(self, text): try: import codecs f = codecs.open(self.filepath, encoding='utf_8', mode='w') except __HOLE__ as ioe: sys.stderr.write("Glue Plugin Error: Unable to open file for write with the write_utf8() method.") raise ioe try: ...
IOError
dataset/ETHPy150Open chrissimpkins/glue/GlueIO.py/FileWriter.write_utf8
745
def postproc(traj, results, idx): get_root_logger().info(idx) if isinstance(traj.v_storage_service, (LockWrapper, ReferenceWrapper)): traj.f_load_skeleton() if isinstance(traj.v_storage_service, (QueueStorageServiceSender, PipeStorageServiceSender)): try: traj.f_load() ...
NotImplementedError
dataset/ETHPy150Open SmokinCaterpillar/pypet/pypet/tests/integration/pipeline_test.py/postproc
746
def vacuum(self, i, namespace, duration): """ Trim metrics that are older than settings.FULL_DURATION and purge old metrics. """ begin = time() # Discover assigned metrics unique_metrics = list(self.redis_conn.smembers(namespace + 'unique_metrics')) keys_...
IndexError
dataset/ETHPy150Open etsy/skyline/src/horizon/roomba.py/Roomba.vacuum
747
def _cursor(self): if self.connection is None: ## The following is the same as in django.db.backends.sqlite3.base ## settings_dict = self.settings_dict if not settings_dict['NAME']: raise ImproperlyConfigured("Please fill out the database NAME in the settings ...
AttributeError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.2/django/contrib/gis/db/backends/spatialite/base.py/DatabaseWrapper._cursor
748
def validate(self, value, model_instance): super(JSONField, self).validate(value, model_instance) try: json.dumps(value) except __HOLE__: raise exceptions.ValidationError( self.error_messages['invalid'], code='invalid', para...
TypeError
dataset/ETHPy150Open django/django/django/contrib/postgres/fields/jsonb.py/JSONField.validate
749
def as_sql(self, compiler, connection): key_transforms = [self.key_name] previous = self.lhs while isinstance(previous, KeyTransform): key_transforms.insert(0, previous.key_name) previous = previous.lhs lhs, params = compiler.compile(previous) if len(key_t...
ValueError
dataset/ETHPy150Open django/django/django/contrib/postgres/fields/jsonb.py/KeyTransform.as_sql
750
def __getitem__(self, coord): x, y = coord if isinstance(x, slice) or isinstance(y, slice): if isinstance(x, slice): x_indices = x.indices(self.width) else: x_indices = [x] if isinstance(y, slice): y_indices = y.indic...
IndexError
dataset/ETHPy150Open PythonProgramming/Beginning-Game-Development-with-Python-and-Pygame/gameobjects/grid.py/Grid.__getitem__
751
def get_layout_by_name(layout_name): """ Get a layout. Parameters ---------- layout_name : str a valid layout name Returns ------- layout_str : str the layout as a string Raises ------ KeyError if the layout_name is not known See Also -------- ...
KeyError
dataset/ETHPy150Open ASPP/pelita/pelita/layout.py/get_layout_by_name
752
def __new__(cls): global undefined try: return undefined except __HOLE__: undefined = super().__new__(cls) return undefined
NameError
dataset/ETHPy150Open tailhook/pyzza/pyzza/abc.py/Undefined.__new__
753
@classmethod def init_conn(cls): try: hive except __HOLE__: raise DbError('Hive client module not found/loaded. Please make sure all dependencies are installed\n') cls.conn = cls.conn() cls.cursor = cls.conn.cursor() cls.conn_initialized = True ...
NameError
dataset/ETHPy150Open appnexus/schema-tool/schematool/db/_hive.py/HiveDb.init_conn
754
@classmethod def _check_geo_field(cls, opts, lookup): """ Utility for checking the given lookup with the given model options. The lookup is a string either specifying the geographic field, e.g. 'point, 'the_geom', or a related lookup on a geographic field like 'address__poi...
AttributeError
dataset/ETHPy150Open CollabQ/CollabQ/vendor/django/contrib/gis/db/models/sql/where.py/GeoWhereNode._check_geo_field
755
def start_new_thread(function, args, kwargs={}): """Dummy implementation of _thread.start_new_thread(). Compatibility is maintained by making sure that ``args`` is a tuple and ``kwargs`` is a dictionary. If an exception is raised and it is SystemExit (which can be done by _thread.exit()) it is cau...
SystemExit
dataset/ETHPy150Open amrdraz/kodr/app/brython/www/src/Lib/_dummy_thread.py/start_new_thread
756
def test_is_iterable_failure(self): try: assert_that(123).is_iterable() fail('should have raised error') except __HOLE__ as ex: assert_that(str(ex)).is_equal_to('Expected iterable, but was not.')
AssertionError
dataset/ETHPy150Open ActivisionGameScience/assertpy/tests/test_collection.py/TestCollection.test_is_iterable_failure
757
def test_is_not_iterable_failure(self): try: assert_that(['a','b','c']).is_not_iterable() fail('should have raised error') except __HOLE__ as ex: assert_that(str(ex)).is_equal_to('Expected not iterable, but was.')
AssertionError
dataset/ETHPy150Open ActivisionGameScience/assertpy/tests/test_collection.py/TestCollection.test_is_not_iterable_failure
758
def test_is_subset_of_failure(self): try: assert_that(['a','b','c']).is_subset_of(['a','b']) fail('should have raised error') except __HOLE__ as ex: assert_that(str(ex)).is_equal_to("Expected <['a', 'b', 'c']> to be subset of ['a', 'b'], but <c> was missing.")
AssertionError
dataset/ETHPy150Open ActivisionGameScience/assertpy/tests/test_collection.py/TestCollection.test_is_subset_of_failure
759
def test_is_subset_of_failure(self): try: assert_that(set([1,2,3])).is_subset_of(set([1,2])) fail('should have raised error') except __HOLE__ as ex: assert_that(str(ex)).is_equal_to('Expected <%s> to be subset of [1, 2], but <3> was missing.' % set([1,2,3]))
AssertionError
dataset/ETHPy150Open ActivisionGameScience/assertpy/tests/test_collection.py/TestCollection.test_is_subset_of_failure
760
def test_is_subset_of_bad_val_failure(self): try: assert_that(123).is_subset_of(1234) fail('should have raised error') except __HOLE__ as ex: assert_that(str(ex)).is_equal_to('val is not iterable')
TypeError
dataset/ETHPy150Open ActivisionGameScience/assertpy/tests/test_collection.py/TestCollection.test_is_subset_of_bad_val_failure
761
def test_is_subset_of_bad_arg_failure(self): try: assert_that(['a','b','c']).is_subset_of() fail('should have raised error') except __HOLE__ as ex: assert_that(str(ex)).is_equal_to('one or more superset args must be given')
ValueError
dataset/ETHPy150Open ActivisionGameScience/assertpy/tests/test_collection.py/TestCollection.test_is_subset_of_bad_arg_failure
762
def releaseLicenseForRenderNode(self, licenseName, renderNode): """ :licenseName: :renderNode: render node object expected """ if "&" not in licenseName: licenseName += "&" for licName in licenseName.split("&"): if len(licName): ...
KeyError
dataset/ETHPy150Open mikrosimage/OpenRenderManagement/src/octopus/dispatcher/licenses/licensemanager.py/LicenseManager.releaseLicenseForRenderNode
763
def reserveLicenseForRenderNode(self, licenseName, renderNode): if "&" not in licenseName: licenseName += "&" globalsuccess = True liclist = [] for licName in licenseName.split("&"): if len(licName): try: lic = self.lice...
KeyError
dataset/ETHPy150Open mikrosimage/OpenRenderManagement/src/octopus/dispatcher/licenses/licensemanager.py/LicenseManager.reserveLicenseForRenderNode
764
def setMaxLicensesNumber(self, licenseName, number): try: lic = self.licenses[licenseName] if lic.maximum != number: lic.setMaxNumber(number) except __HOLE__: self.licenses[licenseName] = LicenseManager.License(licenseName, number) p...
KeyError
dataset/ETHPy150Open mikrosimage/OpenRenderManagement/src/octopus/dispatcher/licenses/licensemanager.py/LicenseManager.setMaxLicensesNumber
765
def create_size(self, photosize): if self.size_exists(photosize): return try: im = Image.open(self.image.storage.open(self.image.name)) except IOError: return # Save the original format im_format = im.format # Apply effect if found ...
IOError
dataset/ETHPy150Open jdriscoll/django-photologue/photologue/models.py/ImageModel.create_size
766
def create_sample(self): try: im = Image.open(SAMPLE_IMAGE_PATH) except __HOLE__: raise IOError( 'Photologue was unable to open the sample image: %s.' % SAMPLE_IMAGE_PATH) im = self.process(im) buffer = BytesIO() im.save(buffer, 'JPEG', qua...
IOError
dataset/ETHPy150Open jdriscoll/django-photologue/photologue/models.py/BaseEffect.create_sample
767
def pre_process(self, im): if self.transpose_method != '': method = getattr(Image, self.transpose_method) im = im.transpose(method) if im.mode != 'RGB' and im.mode != 'RGBA': return im for name in ['Color', 'Brightness', 'Contrast', 'Sharpness']: f...
ValueError
dataset/ETHPy150Open jdriscoll/django-photologue/photologue/models.py/PhotoEffect.pre_process
768
def match_iter(self, req, body, sizes): """\ This skips sizes because there's its not part of the iter api. """ for line in req.body: if b'\n' in line[:-1]: raise AssertionError("Embedded new line: %r" % line) if line != body[:len(line)]: ...
StopIteration
dataset/ETHPy150Open benoitc/gunicorn/tests/treq.py/request.match_iter
769
def get_heartbeat(self, worker): try: heartbeat = worker.heartbeats[-1] except __HOLE__: return # Check for timezone settings if getattr(settings, "USE_TZ", False): return aware_tstamp(heartbeat) return datetime.fromtimestamp(heartbeat)
IndexError
dataset/ETHPy150Open celery/django-celery/djcelery/snapshot.py/Camera.get_heartbeat
770
def _get_model(model_identifier): """ Helper to look up a model from an "app_label.model_name" string. """ try: return apps.get_model(model_identifier) except (LookupError, __HOLE__): raise base.DeserializationError("Invalid model identifier: '%s'" % model_identifier)
TypeError
dataset/ETHPy150Open django/django/django/core/serializers/python.py/_get_model
771
@when(u'paasta mark-for-deployments is run against the repo') def step_paasta_mark_for_deployments_when(context): fake_args = mock.MagicMock( deploy_group='test_cluster.test_instance', service='fake_deployments_json_service', git_url=context.test_git_repo_dir, commit=context.expected...
SystemExit
dataset/ETHPy150Open Yelp/paasta/general_itests/steps/deployments_json_steps.py/step_paasta_mark_for_deployments_when
772
@when(u'paasta stop is run against the repo') def step_paasta_stop_when(context): fake_args = mock.MagicMock( clusters='test_cluster', instance='test_instance', soa_dir='fake_soa_configs', service='fake_deployments_json_service', ) context.force_bounce_timestamp = format_time...
SystemExit
dataset/ETHPy150Open Yelp/paasta/general_itests/steps/deployments_json_steps.py/step_paasta_stop_when
773
@when(u'we generate deployments.json for that service') def step_impl_when(context): context.deployments_file = os.path.join('fake_soa_configs', 'fake_deployments_json_service', 'deployments.json') try: os.remove(context.deployments_file) except __HOLE__: pass fake_args = mock.MagicMock(...
OSError
dataset/ETHPy150Open Yelp/paasta/general_itests/steps/deployments_json_steps.py/step_impl_when
774
def dset_sheet(dataset, ws, freeze_panes=True): """Completes given worksheet from given Dataset.""" _package = dataset._package(dicts=False) for i, sep in enumerate(dataset._separators): _offset = i _package.insert((sep[0] + _offset), (sep[1],)) for i, row in enumerate(_package): ...
TypeError
dataset/ETHPy150Open kennethreitz/tablib/tablib/formats/_xlsx.py/dset_sheet
775
def main(): # setup packages setuptools.setup( version=VERSION, author='Anton Gavrik', name='polaris-gslb', description=('A versatile Global Server Load Balancing(GSLB) ' 'solution, DNS-based traffic manager.'), packages = setuptools.find_packages(...
KeyError
dataset/ETHPy150Open polaris-gslb/polaris-gslb/setup.py/main
776
def _initialize(self, settings_module): """ Initialize the settings from a given settings_module settings_module - path to settings module """ #Get the global settings values and assign them as self attributes self.settings_list = [] for setting in dir(global_sett...
ImportError
dataset/ETHPy150Open VikParuchuri/percept/percept/conf/base.py/Settings._initialize
777
def _setup(self): """ Perform initial setup of the settings class, such as getting the settings module and setting the settings """ settings_module = None #Get the settings module from the environment variables try: settings_module = os.environ[global_setting...
KeyError
dataset/ETHPy150Open VikParuchuri/percept/percept/conf/base.py/Settings._setup
778
@misc.disallow_when_frozen(FrozenNode) def disassociate(self): """Removes this node from its parent (if any). :returns: occurences of this node that were removed from its parent. """ occurrences = 0 if self.parent is not None: p = self.parent self.par...
ValueError
dataset/ETHPy150Open openstack/taskflow/taskflow/types/tree.py/Node.disassociate
779
def dump_packet(data): def is_ascii(data): if byte2int(data) >= 65 and byte2int(data) <= 122: #data.isalnum(): return data return '.' try: print "packet length %d" % len(data) print "method call[1]: %s" % sys._getframe(1).f_code.co_name print "method...
ValueError
dataset/ETHPy150Open uwdata/termite-data-server/web2py/gluon/contrib/pymysql/connections.py/dump_packet
780
def unpack_int24(n): try: return struct.unpack('B',n[0])[0] + (struct.unpack('B', n[1])[0] << 8) +\ (struct.unpack('B',n[2])[0] << 16) except __HOLE__: return n[0] + (n[1] << 8) + (n[2] << 16)
TypeError
dataset/ETHPy150Open uwdata/termite-data-server/web2py/gluon/contrib/pymysql/connections.py/unpack_int24
781
def unpack_int32(n): try: return struct.unpack('B',n[0])[0] + (struct.unpack('B', n[1])[0] << 8) +\ (struct.unpack('B',n[2])[0] << 16) + (struct.unpack('B', n[3])[0] << 24) except __HOLE__: return n[0] + (n[1] << 8) + (n[2] << 16) + (n[3] << 24)
TypeError
dataset/ETHPy150Open uwdata/termite-data-server/web2py/gluon/contrib/pymysql/connections.py/unpack_int32
782
def unpack_int64(n): try: return struct.unpack('B',n[0])[0] + (struct.unpack('B', n[1])[0]<<8) +\ (struct.unpack('B',n[2])[0] << 16) + (struct.unpack('B',n[3])[0]<<24)+\ (struct.unpack('B',n[4])[0] << 32) + (struct.unpack('B',n[5])[0]<<40)+\ (struct.unpack('B',n[6])[0] << 48) + (stru...
TypeError
dataset/ETHPy150Open uwdata/termite-data-server/web2py/gluon/contrib/pymysql/connections.py/unpack_int64
783
def send_email(request, context, template_name, cls=None, to_email=None): """ Sends an e-mail based on a Django template. """ # Imports moved into function because it was causing installer to fail # because django may not be installed when installer is running # MOLLY-244 from django.templa...
ValueError
dataset/ETHPy150Open mollyproject/mollyproject/molly/utils/__init__.py/send_email
784
def _create_cache(backend, **kwargs): try: # Try to get the CACHES entry for the given backend name first try: conf = settings.CACHES[backend] except __HOLE__: try: # Trying to import the given backend, in case it's a dotted path import...
KeyError
dataset/ETHPy150Open django/django/django/core/cache/__init__.py/_create_cache
785
def __getitem__(self, alias): try: return self._caches.caches[alias] except AttributeError: self._caches.caches = {} except __HOLE__: pass if alias not in settings.CACHES: raise InvalidCacheBackendError( "Could not find con...
KeyError
dataset/ETHPy150Open django/django/django/core/cache/__init__.py/CacheHandler.__getitem__
786
def setup_logging(conf): """ Sets up the logging options for a log with supplied name :param conf: a cfg.ConfOpts object """ if conf.log_config: # Use a logging configuration file for all settings... if os.path.exists(conf.log_config): logging.config.fileConfig(conf.log...
AttributeError
dataset/ETHPy150Open rcbops/glance-buildpackage/glance/common/config.py/setup_logging
787
def load_paste_app(conf, app_name=None): """ Builds and returns a WSGI app from a paste config file. We assume the last config file specified in the supplied ConfigOpts object is the paste config file. :param conf: a cfg.ConfigOpts object :param app_name: name of the application to load :...
ImportError
dataset/ETHPy150Open rcbops/glance-buildpackage/glance/common/config.py/load_paste_app
788
def get_value(obj,key,create = False): key_fragments = key.split(".") current_dict = obj last_dict = None last_key = None for key_fragment in key_fragments: try: if create and not key_fragment in current_dict: current_dict[key_fragment] = {} except TypeErr...
TypeError
dataset/ETHPy150Open adewes/blitzdb/blitzdb/helpers.py/get_value
789
def set_value(obj,key,value,overwrite = True): key_fragments = key.split('.') current_dict = obj last_dict = None last_key = None for key_fragment in key_fragments: try: if not key_fragment in current_dict: current_dict[key_fragment] = {} except __HOLE__: ...
TypeError
dataset/ETHPy150Open adewes/blitzdb/blitzdb/helpers.py/set_value
790
def delete_value(obj,key): key_fragments = key.split('.') current_dict = obj last_dict = None for key_fragment in key_fragments: try: if not key_fragment in current_dict: return except __HOLE__: return last_dict = current_dict curre...
TypeError
dataset/ETHPy150Open adewes/blitzdb/blitzdb/helpers.py/delete_value
791
def lxml(self): """Get an lxml etree if possible.""" if ('html' not in self.mimetype and 'xml' not in self.mimetype): raise AttributeError('Not an HTML/XML response') from lxml import etree try: from lxml.html import fromstring except __HOLE__: ...
ImportError
dataset/ETHPy150Open GeekTrainer/Flask/Work/Trivia - Module 5/env/Lib/site-packages/werkzeug/contrib/testtools.py/ContentAccessors.lxml
792
def json(self): """Get the result of simplejson.loads if possible.""" if 'json' not in self.mimetype: raise AttributeError('Not a JSON response') try: from simplejson import loads except __HOLE__: from json import loads return loads(self.data)
ImportError
dataset/ETHPy150Open GeekTrainer/Flask/Work/Trivia - Module 5/env/Lib/site-packages/werkzeug/contrib/testtools.py/ContentAccessors.json
793
def ring_new(self, element): if isinstance(element, PolyElement): if self == element.ring: return element elif isinstance(self.domain, PolynomialRing) and self.domain.ring == element.ring: return self.ground_new(element) else: r...
ValueError
dataset/ETHPy150Open sympy/sympy/sympy/polys/rings.py/PolyRing.ring_new
794
def index(self, gen): """Compute index of ``gen`` in ``self.gens``. """ if gen is None: i = 0 elif isinstance(gen, int): i = gen if 0 <= i and i < self.ngens: pass elif -self.ngens <= i and i <= -1: i = -i - 1 ...
ValueError
dataset/ETHPy150Open sympy/sympy/sympy/polys/rings.py/PolyRing.index
795
def parse_body(self): try: js = json.loads(self.body) if js[js.keys()[0]]['response_type'] == "ERROR": raise RimuHostingException(js[js.keys()[0]]['human_readable_message']) return js[js.keys()[0]] except __HOLE__: raise RimuHostingExceptio...
ValueError
dataset/ETHPy150Open infincia/AEServmon/libcloud/drivers/rimuhosting.py/RimuHostingResponse.parse_body
796
@staticmethod def load(path, name): cluster_path = os.path.join(path, name) filename = os.path.join(cluster_path, 'cluster.conf') with open(filename, 'r') as f: data = yaml.load(f) try: install_dir = None if 'install_dir' in data: i...
KeyError
dataset/ETHPy150Open pcmanus/ccm/ccmlib/cluster_factory.py/ClusterFactory.load
797
def run(self): """ Return True in the case we succeed in running, False otherwise. This means we can use several processors and have one or the other work. """ if not self.extension in self.supported_extensions: return self.refuse() self.accept() # We accept...
OSError
dataset/ETHPy150Open koenbok/Cactus/cactus/static/external/__init__.py/External.run
798
def add_to_app(self, app, **kwargs): """ Instead of adding a route to the flask application this will include and load routes similar, same as in the :py:class:`flask_via.Via` class.abs .. versionchanged:: 2014.05.08 * ``url_prefix`` now injected into kwargs when loading in...
KeyError
dataset/ETHPy150Open thisissoon/Flask-Via/flask_via/routers/__init__.py/Include.add_to_app
799
def get_arg_clause(self, view, arg_value): field = self.get_field(view) try: value = field.deserialize(arg_value) except __HOLE__ as e: errors = ( self.format_validation_error(message) for message, path in utils.iter_validation_errors(e.mes...
ValidationError
dataset/ETHPy150Open 4Catalyzer/flask-resty/flask_resty/filtering.py/FilterFieldBase.get_arg_clause