Unnamed: 0
int64
0
10k
function
stringlengths
79
138k
label
stringclasses
20 values
info
stringlengths
42
261
9,600
def load_tool(result): """ Load the module with the tool-specific code. """ def load_tool_module(tool_module): if not tool_module: logging.warning('Cannot extract values from log files for benchmark results %s ' '(missing attribute "toolmodule" on tag "res...
AttributeError
dataset/ETHPy150Open sosy-lab/benchexec/benchexec/tablegenerator/__init__.py/load_tool
9,601
def parse_results_file(resultFile, run_set_id=None, ignore_errors=False): ''' This function parses a XML file with the results of the execution of a run set. It returns the "result" XML tag. @param resultFile: The file name of the XML file with the results. @param run_set_id: An optional identifier ...
TypeError
dataset/ETHPy150Open sosy-lab/benchexec/benchexec/tablegenerator/__init__.py/parse_results_file
9,602
@staticmethod def create_from_xml(sourcefileTag, get_value_from_logfile, listOfColumns, correct_only, log_zip_cache): ''' This function collects the values from one run. Only columns that should be part of the table are collected. ''' def read_logfile...
KeyError
dataset/ETHPy150Open sosy-lab/benchexec/benchexec/tablegenerator/__init__.py/RunResult.create_from_xml
9,603
def get_table_head(runSetResults, commonFileNamePrefix): # This list contains the number of columns each run set has # (the width of a run set in the final table) # It is used for calculating the column spans of the header cells. runSetWidths = [len(runSetResult.columns) for runSetResult in runSetResul...
ValueError
dataset/ETHPy150Open sosy-lab/benchexec/benchexec/tablegenerator/__init__.py/get_table_head
9,604
def write_table_in_format(template_format, outfile, template_values, show_table): # read template Template = tempita.HTMLTemplate if template_format == 'html' else tempita.Template template_file = TEMPLATE_FILE_NAME.format(format=template_format) try: template_content = __loader__.get_data(templ...
NameError
dataset/ETHPy150Open sosy-lab/benchexec/benchexec/tablegenerator/__init__.py/write_table_in_format
9,605
def main(args=None): if sys.version_info < (3,): sys.exit('table-generator needs Python 3 to run.') signal.signal(signal.SIGINT, sigint_handler) arg_parser = create_argument_parser() options = arg_parser.parse_args((args or sys.argv)[1:]) logging.basicConfig(format="%(levelname)s: %(messag...
AttributeError
dataset/ETHPy150Open sosy-lab/benchexec/benchexec/tablegenerator/__init__.py/main
9,606
def day_selected(self, event): """ Event for when calendar is selected, update/create date string. """ date = event.GetDate() # WX sometimes has year == 0 temporarily when doing state changes. if date.IsValid() and date.GetYear() != 0: year = date.GetYear() ...
ValueError
dataset/ETHPy150Open enthought/traitsui/traitsui/wx/date_editor.py/SimpleEditor.day_selected
9,607
def selected_list_changed(self, evt=None): """ Update the date colors of the days in the widgets. """ for cal in self.cal_ctrls: cur_month = cal.GetDate().GetMonth() + 1 cur_year = cal.GetDate().GetYear() selected_days = self.selected_days # When multi_se...
ValueError
dataset/ETHPy150Open enthought/traitsui/traitsui/wx/date_editor.py/MultiCalendarCtrl.selected_list_changed
9,608
def _weekday_clicked(self, evt): """ A day on the weekday bar has been clicked. Select all days. """ evt.Skip() weekday = evt.GetWeekDay() cal = evt.GetEventObject() month = cal.GetDate().GetMonth()+1 year = cal.GetDate().GetYear() days = [] # Messy math...
ValueError
dataset/ETHPy150Open enthought/traitsui/traitsui/wx/date_editor.py/MultiCalendarCtrl._weekday_clicked
9,609
def runTest(self): try: actual = openid.urinorm.urinorm(self.case) except __HOLE__, why: self.assertEqual(self.expected, 'fail', why) else: self.assertEqual(actual, self.expected)
ValueError
dataset/ETHPy150Open adieu/python-openid/openid/test/test_urinorm.py/UrinormTest.runTest
9,610
def jsonrpc_server_call(target, jsonrpc_request, json_decoder=None): """Execute the given JSON-RPC request (as JSON-encoded string) on the given target object and return the JSON-RPC response, as a dict """ if json_decoder is None: json_decoder = ScrapyJSONDecoder() try: req = json_...
KeyError
dataset/ETHPy150Open wcong/ants/ants/utils/jsonrpc.py/jsonrpc_server_call
9,611
def load_module(module_name): """ Dynamically load a module TODO: Throw a custom error and deal with better. Returns: module: an imported module name """ try: module = resolve_name(module_name) except __HOLE__: raise error.NotFound(msg=module_name) return m...
ImportError
dataset/ETHPy150Open panoptes/POCS/panoptes/utils/modules.py/load_module
9,612
def run_command(command, input=None): if not isinstance(command, list): command = shlex.split(command) if not input: input = None elif isinstance(input, unicode_type): input = input.encode('utf-8') elif not isinstance(input, binary_type): input = input.read() try: ...
OSError
dataset/ETHPy150Open opencollab/debile/debile/utils/commands.py/run_command
9,613
def view_debater(request, debater_id): debater_id = int(debater_id) try: debater = Debater.objects.get(pk=debater_id) except Debater.DoesNotExist: return render_to_response('error.html', {'error_type': "View Debater", 'error...
ValueError
dataset/ETHPy150Open jolynch/mit-tab/mittab/apps/tab/debater_views.py/view_debater
9,614
def enter_debater(request): if request.method == 'POST': form = DebaterForm(request.POST) if form.is_valid(): try: form.save() except __HOLE__: return render_to_response('error.html', {'error_type': "De...
ValueError
dataset/ETHPy150Open jolynch/mit-tab/mittab/apps/tab/debater_views.py/enter_debater
9,615
def _is_valid_key(self, key): """Validate a proposed dictionary key Parameters ---------- key : object Returns ------- boolean """ # The key should be a tuple if not isinstance(key, tuple): return False # The tuple sh...
TypeError
dataset/ETHPy150Open Axelrod-Python/Axelrod/axelrod/deterministic_cache.py/DeterministicCache._is_valid_key
9,616
def test_is_in_failure(self): try: assert_that(4).is_in(1,2,3) fail('should have raised error') except __HOLE__ as ex: assert_that(str(ex)).is_equal_to('Expected <4> to be in (1, 2, 3), but was not.')
AssertionError
dataset/ETHPy150Open ActivisionGameScience/assertpy/tests/test_in.py/TestIn.test_is_in_failure
9,617
def test_is_in_missing_arg_failure(self): try: assert_that(1).is_in() fail('should have raised error') except __HOLE__ as ex: assert_that(str(ex)).is_equal_to('one or more args must be given')
ValueError
dataset/ETHPy150Open ActivisionGameScience/assertpy/tests/test_in.py/TestIn.test_is_in_missing_arg_failure
9,618
def test_is_not_in_failure(self): try: assert_that(1).is_not_in(1,2,3) fail('should have raised error') except __HOLE__ as ex: assert_that(str(ex)).is_equal_to('Expected <1> to not be in (1, 2, 3), but was.')
AssertionError
dataset/ETHPy150Open ActivisionGameScience/assertpy/tests/test_in.py/TestIn.test_is_not_in_failure
9,619
def test_is_not_in_missing_arg_failure(self): try: assert_that(1).is_not_in() fail('should have raised error') except __HOLE__ as ex: assert_that(str(ex)).is_equal_to('one or more args must be given')
ValueError
dataset/ETHPy150Open ActivisionGameScience/assertpy/tests/test_in.py/TestIn.test_is_not_in_missing_arg_failure
9,620
def get_config_loader(path, request=None): i = path.rfind('.') module, attr = path[:i], path[i + 1:] try: mod = import_module(module) except ImportError, e: raise ImproperlyConfigured( 'Error importing SAML config loader %s: "%s"' % (path, e)) except __HOLE__, e: ...
ValueError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/djangosaml2-0.13.0/djangosaml2/conf.py/get_config_loader
9,621
def save_changelog_del(sender, instance, using, **kwargs): if sender in settings.MODELS and using == settings.LOCAL: cl = ChangeLog.objects.create(object=instance, action=DELETION) try: k = repr(instance.natural_key()) DeleteKey.objects.create(changelog=cl, key=k) exc...
AttributeError
dataset/ETHPy150Open zlorf/django-synchro/synchro/handlers.py/save_changelog_del
9,622
def __init__(self, srs_input=''): """ Creates a GDAL OSR Spatial Reference object from the given input. The input may be string of OGC Well Known Text (WKT), an integer EPSG code, a PROJ.4 string, and/or a projection "well known" shorthand string (one of 'WGS84', 'WGS72', 'NAD27'...
ValueError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/contrib/gis/gdal/srs.py/SpatialReference.__init__
9,623
@property def srid(self): "Returns the SRID of top-level authority, or None if undefined." try: return int(self.attr_value('AUTHORITY', 1)) except (__HOLE__, ValueError): return None #### Unit Properties ####
TypeError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/contrib/gis/gdal/srs.py/SpatialReference.srid
9,624
def get_species_list(self): """Return a formatted list of all species.""" c = self.assets.db.cursor() c.execute("select distinct name from assets where type = 'species' order by name") names = [x[0] for x in c.fetchall()] formatted = [] for s in names: if s ...
IndexError
dataset/ETHPy150Open wizzomafizzo/starcheat/starcheat/assets/species.py/Species.get_species_list
9,625
def get_appearance_data(self, name, gender, key): species = self.get_species(name) # there is another json extension here where strings that have a , on # the end are treated as 1 item lists. there are also some species with # missing keys try: results = self.get_gend...
KeyError
dataset/ETHPy150Open wizzomafizzo/starcheat/starcheat/assets/species.py/Species.get_appearance_data
9,626
def get_preview_image(self, name, gender): """Return raw image data for species placeholder pic. I don't think this is actually used anywhere in game. Some mods don't include it.""" species = self.get_species(name.lower()) try: try: key = self.get_ge...
TypeError
dataset/ETHPy150Open wizzomafizzo/starcheat/starcheat/assets/species.py/Species.get_preview_image
9,627
def render_player(self, player, armor=True): """Return an Image of a fully rendered player from a save.""" name = player.get_race() gender = player.get_gender() species = self.get_species(name.lower()) if species is None: return Image.open(BytesIO(self.assets.items()...
ValueError
dataset/ETHPy150Open wizzomafizzo/starcheat/starcheat/assets/species.py/Species.render_player
9,628
def get_hair_image(self, name, hair_type, hair_group, gender, directives): # TODO: bbox is from .frame file, need a way to read them still species = self.get_species(name.lower()) image_path = "/humanoid/%s/%s/%s.png" % (name, hair_type, hair_group) try: image = self.assets....
OSError
dataset/ETHPy150Open wizzomafizzo/starcheat/starcheat/assets/species.py/Species.get_hair_image
9,629
def get_field(self): try: field = self.REQUEST['sort'] except (KeyError, ValueError, __HOLE__): field = '' return (self.direction == 'desc' and '-' or '') + field
TypeError
dataset/ETHPy150Open directeur/django-sorting/django_sorting/middleware.py/get_field
9,630
def get_direction(self): try: return self.REQUEST['dir'] except (KeyError, ValueError, __HOLE__): return 'desc'
TypeError
dataset/ETHPy150Open directeur/django-sorting/django_sorting/middleware.py/get_direction
9,631
def persist(self): ''' Persist the modified schedule into <<configdir>>/minion.d/_schedule.conf ''' config_dir = self.opts.get('conf_dir', None) if config_dir is None and 'conf_file' in self.opts: config_dir = os.path.dirname(self.opts['conf_file']) if config_...
OSError
dataset/ETHPy150Open saltstack/salt/salt/utils/schedule.py/Schedule.persist
9,632
def handle_func(self, multiprocessing_enabled, func, data): ''' Execute this method in a multiprocess or thread ''' if salt.utils.is_windows(): # Since function references can't be pickled and pickling # is required when spawning new processes on Windows, regenera...
OSError
dataset/ETHPy150Open saltstack/salt/salt/utils/schedule.py/Schedule.handle_func
9,633
def eval(self): ''' Evaluate and execute the schedule ''' schedule = self.option('schedule') if not isinstance(schedule, dict): raise ValueError('Schedule must be of type dict.') if 'enabled' in schedule and not schedule['enabled']: return ...
ValueError
dataset/ETHPy150Open saltstack/salt/salt/utils/schedule.py/Schedule.eval
9,634
def clean_proc_dir(opts): ''' Loop through jid files in the minion proc directory (default /var/cache/salt/minion/proc) and remove any that refer to processes that no longer exist ''' for basefilename in os.listdir(salt.minion.get_proc_dir(opts['cachedir'])): fn_ = os.path.join(salt.minion...
OSError
dataset/ETHPy150Open saltstack/salt/salt/utils/schedule.py/clean_proc_dir
9,635
def setup (**attrs): """The gateway to the Distutils: do everything your setup script needs to do, in a highly flexible and user-driven way. Briefly: create a Distribution instance; find and parse config files; parse the command line; run each Distutils command found there, customized by the options ...
KeyboardInterrupt
dataset/ETHPy150Open ofermend/medicare-demo/socialite/jython/Lib/distutils/core.py/setup
9,636
def run_setup (script_name, script_args=None, stop_after="run"): """Run a setup script in a somewhat controlled environment, and return the Distribution instance that drives things. This is useful if you need to find out the distribution meta-data (passed as keyword args from 'script' to 'setup()', or ...
SystemExit
dataset/ETHPy150Open ofermend/medicare-demo/socialite/jython/Lib/distutils/core.py/run_setup
9,637
def _find_queue_item_id(self, master_base_url, changes_bid): """Looks in a Jenkins master's queue for an item, and returns the ID if found. Args: master_base_url (str): Jenkins master URL, in scheme://host form. changes_bid (str): The identifier for this Jenkins build, typically ...
StopIteration
dataset/ETHPy150Open dropbox/changes/changes/backends/jenkins/builder.py/JenkinsBuilder._find_queue_item_id
9,638
def _find_build_no(self, master_base_url, job_name, changes_bid): """Looks in a Jenkins master's list of current/recent builds for one with the given CHANGES_BID, and returns the build number if found. Args: master_base_url (str): Jenkins master URL, in scheme://host form. ...
StopIteration
dataset/ETHPy150Open dropbox/changes/changes/backends/jenkins/builder.py/JenkinsBuilder._find_build_no
9,639
def _get_jenkins_job(self, step): try: job_name = step.data['job_name'] build_no = step.data['build_no'] except __HOLE__: raise UnrecoverableException('Missing Jenkins job information') try: return self._get_json_response( step.dat...
KeyError
dataset/ETHPy150Open dropbox/changes/changes/backends/jenkins/builder.py/JenkinsBuilder._get_jenkins_job
9,640
def mark_dead(self, server): with self._lock: try: self._servers.remove(server) self._dead.insert(0, (time.time() + self._retry_time, server)) except __HOLE__: pass
ValueError
dataset/ETHPy150Open aparo/pyes/pyes/connection.py/ServerSet.mark_dead
9,641
def get_terminal_size(defaultx=80, defaulty=25): """Return size of current terminal console. This function try to determine actual size of current working console window and return tuple (sizex, sizey) if success, or default size (defaultx, defaulty) otherwise. Dependencies: ct...
ImportError
dataset/ETHPy150Open ipython/ipython-py3k/IPython/utils/terminal.py/get_terminal_size
9,642
def filedown(environ, filename, cache=True, cache_timeout=None, action=None, real_filename=None, x_sendfile=False, x_header_name=None, x_filename=None, fileobj=None, default_mimetype='application/octet-stream'): """ @param filename: is used for display in download @param real_filename: if used f...
OSError
dataset/ETHPy150Open limodou/uliweb/uliweb/utils/filedown.py/filedown
9,643
def get_client(self, name): if name in self._connected_clients: return self._connected_clients[name] try: aclass = next(s for s in self._supported_clients if name in s.__name__) sclient = aclass() connected_client = sclient.create...
StopIteration
dataset/ETHPy150Open openstack/kolla/tests/clients.py/OpenStackClients.get_client
9,644
def start(self): """ Starts the IEDriver Service. :Exceptions: - WebDriverException : Raised either when it can't start the service or when it can't connect to the service """ try: cmd = [self.path, "--port=%d" % self.port] if...
TypeError
dataset/ETHPy150Open RoseOu/flasky/venv/lib/python2.7/site-packages/selenium/webdriver/ie/service.py/Service.start
9,645
def stop(self): """ Tells the IEDriver to stop and cleans up the process """ #If its dead dont worry if self.process is None: return #Tell the Server to die! try: from urllib import request as url_request except __HOLE__: ...
ImportError
dataset/ETHPy150Open RoseOu/flasky/venv/lib/python2.7/site-packages/selenium/webdriver/ie/service.py/Service.stop
9,646
def main(): parser = argparse.ArgumentParser() parser.add_argument('key', metavar='KEY', nargs='?', default=None, help='key associated with values to reduce') group = parser.add_mutually_exclusive_group() group.add_argument('--min', action='store_true', default=None) group.ad...
ValueError
dataset/ETHPy150Open bittorrent/btc/btc/btc_reduce.py/main
9,647
def load(self): if self.savefile is None: return if os.path.exists(self.savefile): try: # set dirty flag and re-save if invalid data in save file dirty = False data = json.load(open(self.savefile)) for item in data: ...
ValueError
dataset/ETHPy150Open yaybu/callsign/callsign/dns.py/RuntimeAuthority.load
9,648
def read_previous_results(): """Read results of previous run. :return: dictionary of results if exist """ try: with open(settings.LOAD_TESTS_PATHS['load_previous_tests_results'], 'r') as results_file: results = jsonutils.load(results_file) except (IOError, __HO...
ValueError
dataset/ETHPy150Open openstack/fuel-web/nailgun/nailgun/test/performance/base.py/read_previous_results
9,649
def nova_notify_supported(): try: import neutron.notifiers.nova # noqa since unused return True except __HOLE__: return False
ImportError
dataset/ETHPy150Open openstack/neutron/neutron/cmd/sanity/checks.py/nova_notify_supported
9,650
def ofctl_arg_supported(cmd, **kwargs): """Verify if ovs-ofctl binary supports cmd with **kwargs. :param cmd: ovs-ofctl command to use for test. :param **kwargs: arguments to test with the command. :returns: a boolean if the supplied arguments are supported. """ br_name = base.get_rand_device_n...
RuntimeError
dataset/ETHPy150Open openstack/neutron/neutron/cmd/sanity/checks.py/ofctl_arg_supported
9,651
def dnsmasq_version_supported(): try: cmd = ['dnsmasq', '--version'] env = {'LC_ALL': 'C'} out = agent_utils.execute(cmd, addl_env=env) m = re.search(r"version (\d+\.\d+)", out) ver = float(m.group(1)) if m else 0 if ver < MINIMUM_DNSMASQ_VERSION: return F...
IndexError
dataset/ETHPy150Open openstack/neutron/neutron/cmd/sanity/checks.py/dnsmasq_version_supported
9,652
def ovsdb_native_supported(): # Running the test should ensure we are configured for OVSDB native try: ovs = ovs_lib.BaseOVS() ovs.get_bridges() return True except __HOLE__ as ex: LOG.error(_LE("Failed to import required modules. Ensure that the " "pytho...
ImportError
dataset/ETHPy150Open openstack/neutron/neutron/cmd/sanity/checks.py/ovsdb_native_supported
9,653
def ovs_conntrack_supported(): br_name = base.get_rand_device_name(prefix="ovs-test-") with ovs_lib.OVSBridge(br_name) as br: try: br.set_protocols( "OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13,OpenFlow14") except __HOLE__ as e: LOG.debug("Exception while...
RuntimeError
dataset/ETHPy150Open openstack/neutron/neutron/cmd/sanity/checks.py/ovs_conntrack_supported
9,654
def ebtables_supported(): try: cmd = ['ebtables', '--version'] agent_utils.execute(cmd) return True except (__HOLE__, RuntimeError, IndexError, ValueError) as e: LOG.debug("Exception while checking for installed ebtables. " "Exception: %s", e) return Fal...
OSError
dataset/ETHPy150Open openstack/neutron/neutron/cmd/sanity/checks.py/ebtables_supported
9,655
def ipset_supported(): try: cmd = ['ipset', '--version'] agent_utils.execute(cmd) return True except (OSError, RuntimeError, __HOLE__, ValueError) as e: LOG.debug("Exception while checking for installed ipset. " "Exception: %s", e) return False
IndexError
dataset/ETHPy150Open openstack/neutron/neutron/cmd/sanity/checks.py/ipset_supported
9,656
def ip6tables_supported(): try: cmd = ['ip6tables', '--version'] agent_utils.execute(cmd) return True except (OSError, RuntimeError, IndexError, __HOLE__) as e: LOG.debug("Exception while checking for installed ip6tables. " "Exception: %s", e) return Fal...
ValueError
dataset/ETHPy150Open openstack/neutron/neutron/cmd/sanity/checks.py/ip6tables_supported
9,657
def dibbler_version_supported(): try: cmd = ['dibbler-client', 'help'] out = agent_utils.execute(cmd) return '-w' in out except (OSError, __HOLE__, IndexError, ValueError) as e: LOG.debug("Exception while checking minimal dibbler version. " "Excep...
RuntimeError
dataset/ETHPy150Open openstack/neutron/neutron/cmd/sanity/checks.py/dibbler_version_supported
9,658
def detect_c_compiler(self, want_cross): evar = 'CC' if self.is_cross_build() and want_cross: compilers = [self.cross_info.config['binaries']['c']] ccache = [] is_cross = True exe_wrap = self.cross_info.config['binaries'].get('exe_wrapper', None) e...
OSError
dataset/ETHPy150Open mesonbuild/meson/mesonbuild/environment.py/Environment.detect_c_compiler
9,659
def detect_fortran_compiler(self, want_cross): evar = 'FC' if self.is_cross_build() and want_cross: compilers = [self.cross_info['fortran']] is_cross = True exe_wrap = self.cross_info.get('exe_wrapper', None) elif evar in os.environ: compilers = os...
OSError
dataset/ETHPy150Open mesonbuild/meson/mesonbuild/environment.py/Environment.detect_fortran_compiler
9,660
def detect_cpp_compiler(self, want_cross): evar = 'CXX' if self.is_cross_build() and want_cross: compilers = [self.cross_info.config['binaries']['cpp']] ccache = [] is_cross = True exe_wrap = self.cross_info.config['binaries'].get('exe_wrapper', None) ...
OSError
dataset/ETHPy150Open mesonbuild/meson/mesonbuild/environment.py/Environment.detect_cpp_compiler
9,661
def detect_objc_compiler(self, want_cross): if self.is_cross_build() and want_cross: exelist = [self.cross_info['objc']] is_cross = True exe_wrap = self.cross_info.get('exe_wrapper', None) else: exelist = self.get_objc_compiler_exelist() is_cro...
OSError
dataset/ETHPy150Open mesonbuild/meson/mesonbuild/environment.py/Environment.detect_objc_compiler
9,662
def detect_objcpp_compiler(self, want_cross): if self.is_cross_build() and want_cross: exelist = [self.cross_info['objcpp']] is_cross = True exe_wrap = self.cross_info.get('exe_wrapper', None) else: exelist = self.get_objcpp_compiler_exelist() ...
OSError
dataset/ETHPy150Open mesonbuild/meson/mesonbuild/environment.py/Environment.detect_objcpp_compiler
9,663
def detect_java_compiler(self): exelist = ['javac'] try: p = subprocess.Popen(exelist + ['-version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) except __HOLE__: raise EnvironmentException('Could not execute Java compiler "%s"' % ' '.join(exelist)) (out, err)...
OSError
dataset/ETHPy150Open mesonbuild/meson/mesonbuild/environment.py/Environment.detect_java_compiler
9,664
def detect_cs_compiler(self): exelist = ['mcs'] try: p = subprocess.Popen(exelist + ['--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) except __HOLE__: raise EnvironmentException('Could not execute C# compiler "%s"' % ' '.join(exelist)) (out, err) = p....
OSError
dataset/ETHPy150Open mesonbuild/meson/mesonbuild/environment.py/Environment.detect_cs_compiler
9,665
def detect_vala_compiler(self): exelist = ['valac'] try: p = subprocess.Popen(exelist + ['--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) except __HOLE__: raise EnvironmentException('Could not execute Vala compiler "%s"' % ' '.join(exelist)) (out, _) ...
OSError
dataset/ETHPy150Open mesonbuild/meson/mesonbuild/environment.py/Environment.detect_vala_compiler
9,666
def detect_rust_compiler(self): exelist = ['rustc'] try: p = subprocess.Popen(exelist + ['--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) except __HOLE__: raise EnvironmentException('Could not execute Rust compiler "%s"' % ' '.join(exelist)) (out, _) ...
OSError
dataset/ETHPy150Open mesonbuild/meson/mesonbuild/environment.py/Environment.detect_rust_compiler
9,667
def detect_swift_compiler(self): exelist = ['swiftc'] try: p = subprocess.Popen(exelist + ['-v'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) except __HOLE__: raise EnvironmentException('Could not execute Swift compiler "%s"' % ' '.join(exelist)) (_, err) = p....
OSError
dataset/ETHPy150Open mesonbuild/meson/mesonbuild/environment.py/Environment.detect_swift_compiler
9,668
def detect_static_linker(self, compiler): if compiler.is_cross: linker = self.cross_info.config['binaries']['ar'] else: evar = 'AR' if evar in os.environ: linker = os.environ[evar].strip() elif isinstance(compiler, VisualStudioCCompiler): ...
OSError
dataset/ETHPy150Open mesonbuild/meson/mesonbuild/environment.py/Environment.detect_static_linker
9,669
def detect_ccache(self): try: has_ccache = subprocess.call(['ccache', '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) except __HOLE__: has_ccache = 1 if has_ccache == 0: cmdlist = ['ccache'] else: cmdlist = [] return c...
OSError
dataset/ETHPy150Open mesonbuild/meson/mesonbuild/environment.py/Environment.detect_ccache
9,670
@staticmethod def load_page(key): print("Loading %s" % key) try: raw = wikipedia.page(key, preload=True) print(unidecode(raw.content[:80])) print(unidecode(str(raw.links)[:80])) print(unidecode(str(raw.categories)[:80])) except __HOLE__: ...
KeyError
dataset/ETHPy150Open Pinafore/qb/util/cached_wikipedia.py/CachedWikipedia.load_page
9,671
def __getitem__(self, key): key = key.replace("_", " ") if key in self._cache: return self._cache[key] if "/" in key: filename = "%s/%s" % (self._path, key.replace("/", "---")) else: filename = "%s/%s" % (self._path, key) page = None i...
AttributeError
dataset/ETHPy150Open Pinafore/qb/util/cached_wikipedia.py/CachedWikipedia.__getitem__
9,672
def _set_slice(self, index, values): "Assign values to a slice of the object" try: iter(values) except __HOLE__: raise TypeError('can only assign an iterable to a slice') self._check_allowed(values) origLen = len(self) valueList = list(valu...
TypeError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/contrib/gis/geos/mutable_list.py/ListMixin._set_slice
9,673
def test_should_not_use_m2m_field_name_for_update_field_list(self): another_user = UserModel.objects.create(name='vova') data = { 'title': 'goodbye', 'users_liked': [self.user.pk, another_user.pk] } serializer = CommentSerializer( instance=self.get_com...
ValueError
dataset/ETHPy150Open chibisov/drf-extensions/tests_app/tests/unit/serializers/tests.py/PartialUpdateSerializerMixinTest.test_should_not_use_m2m_field_name_for_update_field_list
9,674
def test_should_not_use_related_set_field_name_for_update_field_list(self): another_user = UserModel.objects.create(name='vova') another_comment = CommentModel.objects.create( user=another_user, title='goodbye', text='moon', ) data = { 'nam...
ValueError
dataset/ETHPy150Open chibisov/drf-extensions/tests_app/tests/unit/serializers/tests.py/PartialUpdateSerializerMixinTest.test_should_not_use_related_set_field_name_for_update_field_list
9,675
def test_should_not_try_to_update_fields_that_are_not_in_model(self): data = { 'title': 'goodbye', 'not_existing_field': 'moon' } serializer = CommentSerializer(instance=self.get_comment(), data=data, partial=True) self.assertTrue(serializer.is_valid()) tr...
ValueError
dataset/ETHPy150Open chibisov/drf-extensions/tests_app/tests/unit/serializers/tests.py/PartialUpdateSerializerMixinTest.test_should_not_try_to_update_fields_that_are_not_in_model
9,676
def test_should_not_use_update_fields_when_related_objects_are_saving(self): data = { 'title': 'goodbye', 'user': { 'id': self.user.pk, 'name': 'oleg' } } serializer = CommentSerializerWithExpandedUsersLiked(instance=self.get_c...
ValueError
dataset/ETHPy150Open chibisov/drf-extensions/tests_app/tests/unit/serializers/tests.py/PartialUpdateSerializerMixinTest.test_should_not_use_update_fields_when_related_objects_are_saving
9,677
def test_should_not_use_pk_field_for_update_fields(self): old_pk = self.get_comment().pk data = { 'id': old_pk + 1, 'title': 'goodbye' } serializer = CommentSerializer( instance=self.get_comment(), data=data, partial=True) self.assertTrue(seria...
ValueError
dataset/ETHPy150Open chibisov/drf-extensions/tests_app/tests/unit/serializers/tests.py/PartialUpdateSerializerMixinTest.test_should_not_use_pk_field_for_update_fields
9,678
def save_instance(self, instance, fields=None, fail_message='saved', commit=True, exclude=None, construct=True): """ Saves bound Form ``form``'s cleaned_data into model instance ``instance``. If commit=True, then the changes to ``instance`` will be saved to the ...
ValidationError
dataset/ETHPy150Open mozilla/inventory/mozdns/forms.py/BaseForm.save_instance
9,679
@defer.inlineCallbacks def on_GET(self, request): requester = yield self.auth.get_user_by_req( request, allow_guest=True, ) is_guest = requester.is_guest room_id = None if is_guest: if "room_id" not in request.args: raise Sy...
ValueError
dataset/ETHPy150Open matrix-org/synapse/synapse/rest/client/v1/events.py/EventStreamRestServlet.on_GET
9,680
def save_segment(self, term, term_info, update=False): """ Writes out new index data to disk. Takes a ``term`` string & ``term_info`` dict. It will rewrite the segment in alphabetical order, adding in the data where appropriate. Optionally takes an ``update`` parameter,...
OSError
dataset/ETHPy150Open toastdriven/microsearch/microsearch.py/Microsearch.save_segment
9,681
def git_version(): """ Parse version information from the current git commit. Parse the output of `git describe` and return the git hash and the number of commits since the last version tag. """ def _minimal_ext_cmd(cmd): # construct minimal environment env = {} for k in ['...
OSError
dataset/ETHPy150Open enthought/envisage/setup.py/git_version
9,682
def write_version_py(filename=_VERSION_FILENAME): """ Create a file containing the version information. """ template = """\ # This file was automatically generated from the `setup.py` script. version = '{version}' full_version = '{full_version}' git_revision = '{git_revision}' is_released = {is_released} if n...
ImportError
dataset/ETHPy150Open enthought/envisage/setup.py/write_version_py
9,683
@classmethod def handle_simple(cls, name): try: from django.conf import settings except __HOLE__: prefix = '' else: prefix = iri_to_uri(getattr(settings, name, '')) return prefix
ImportError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.3/django/templatetags/static.py/PrefixNode.handle_simple
9,684
def set_type(self, typ): try: del self.extension_attributes[XSI_NIL] except KeyError: pass try: self.extension_attributes[XSI_TYPE] = typ except __HOLE__: self._extatt[XSI_TYPE] = typ
AttributeError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/pysaml2-2.4.0/src/saml2/saml.py/AttributeValueBase.set_type
9,685
def get_type(self): try: return self.extension_attributes[XSI_TYPE] except (KeyError, __HOLE__): try: return self._extatt[XSI_TYPE] except KeyError: return ""
AttributeError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/pysaml2-2.4.0/src/saml2/saml.py/AttributeValueBase.get_type
9,686
def clear_type(self): try: del self.extension_attributes[XSI_TYPE] except KeyError: pass try: del self._extatt[XSI_TYPE] except __HOLE__: pass
KeyError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/pysaml2-2.4.0/src/saml2/saml.py/AttributeValueBase.clear_type
9,687
def set_text(self, val, base64encode=False): typ = self.get_type() if base64encode: import base64 val = base64.encodestring(val) self.set_type("xs:base64Binary") else: if isinstance(val, basestring): if not typ: ...
AttributeError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/pysaml2-2.4.0/src/saml2/saml.py/AttributeValueBase.set_text
9,688
def harvest_element_tree(self, tree): # Fill in the instance members from the contents of the XML tree. for child in tree: self._convert_element_tree_to_member(child) for attribute, value in tree.attrib.iteritems(): self._convert_element_attribute_to_member(attribute, val...
KeyError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/pysaml2-2.4.0/src/saml2/saml.py/AttributeValueBase.harvest_element_tree
9,689
def __escape_extensible_value(self, value): '''Escape X10 string values to remove ambiguity for special characters.''' def _translate(char): try: return self.__ESCAPE_CHAR_MAP[char] except __HOLE__: return char return ''.join(map(_translat...
KeyError
dataset/ETHPy150Open kra3/py-ga-mob/pyga/requests.py/X10.__escape_extensible_value
9,690
def is_view_dart_script(view): """Checks whether @view looks like a Dart script file. Returns `True` if @view's file name ends with '.dart'. Returns `False` if @view isn't saved on disk. """ try: if view.file_name() is None: return False return is_dart_script(view.file_n...
AttributeError
dataset/ETHPy150Open guillermooo/dart-sublime-bundle/lib/path.py/is_view_dart_script
9,691
def is_pubspec(path_or_view): """Returns `True` if @path_or_view is 'pubspec.yaml'. """ try: if path_or_view.file_name() is None: return return path_or_view.file_name().endswith('pubspec.yaml') except __HOLE__: return path_or_view.endswith('pubspec.yaml')
AttributeError
dataset/ETHPy150Open guillermooo/dart-sublime-bundle/lib/path.py/is_pubspec
9,692
def only_for_dart_files(func): @wraps(func) def inner(self, view): try: fname = view.file_name() if fname and is_dart_script(fname): return func(self, view) except __HOLE__: assert view is None, "wrong usage" return inner
AttributeError
dataset/ETHPy150Open guillermooo/dart-sublime-bundle/lib/path.py/only_for_dart_files
9,693
def _readNumber(self): isfloat = False result = self._next() peek = self._peek() while peek is not None and (peek.isdigit() or peek == "."): isfloat = isfloat or peek == "." result = result + self._next() peek = self._peek() try: if...
ValueError
dataset/ETHPy150Open gashero/talklog/android_sms/json.py/JsonReader._readNumber
9,694
def _readString(self): result = "" assert self._next() == '"' try: while self._peek() != '"': ch = self._next() if ch == "\\": ch = self._next() if ch in 'brnft': ch = self.escapes[ch] ...
StopIteration
dataset/ETHPy150Open gashero/talklog/android_sms/json.py/JsonReader._readString
9,695
def _hexDigitToInt(self, ch): try: result = self.hex_digits[ch.upper()] except KeyError: try: result = int(ch) except __HOLE__: raise ReadException, "The character %s is not a hex digit." % ch return result
ValueError
dataset/ETHPy150Open gashero/talklog/android_sms/json.py/JsonReader._hexDigitToInt
9,696
def _readCStyleComment(self): try: done = False while not done: ch = self._next() done = (ch == "*" and self._peek() == "/") if not done and ch == "/" and self._peek() == "*": raise ReadException, "Not a valid JSON comme...
StopIteration
dataset/ETHPy150Open gashero/talklog/android_sms/json.py/JsonReader._readCStyleComment
9,697
def _readDoubleSolidusComment(self): try: ch = self._next() while ch != "\r" and ch != "\n": ch = self._next() except __HOLE__: pass
StopIteration
dataset/ETHPy150Open gashero/talklog/android_sms/json.py/JsonReader._readDoubleSolidusComment
9,698
def google_adwords_sale(context): """ Output our receipt in the format that Google Adwords needs. """ order = context['order'] try: request = context['request'] except KeyError: print >> sys.stderr, "Template satchmo.show.templatetags.google.google_adwords_sale couldn't get the r...
KeyError
dataset/ETHPy150Open dokterbob/satchmo/satchmo/apps/satchmo_store/shop/templatetags/satchmo_google.py/google_adwords_sale
9,699
def google_adwords_signup(context): """ Output signup info in the format that Google adwords needs. """ request = context['request'] try: request = context['request'] except KeyError: print >> sys.stderr, "Template satchmo.show.templatetags.google.google_adwords_sale couldn't get...
AttributeError
dataset/ETHPy150Open dokterbob/satchmo/satchmo/apps/satchmo_store/shop/templatetags/satchmo_google.py/google_adwords_signup