Unnamed: 0
int64
0
10k
function
stringlengths
79
138k
label
stringclasses
20 values
info
stringlengths
42
261
4,100
def _get_max_speed(self): # Get max speed buf = array.array('I', [0]) try: fcntl.ioctl(self._fd, SPI._SPI_IOC_RD_MAX_SPEED_HZ, buf, True) except __HOLE__ as e: raise SPIError(e.errno, "Getting SPI max speed: " + e.strerror) return buf[0]
OSError
dataset/ETHPy150Open vsergeev/python-periphery/periphery/spi.py/SPI._get_max_speed
4,101
def _set_max_speed(self, max_speed): if not isinstance(max_speed, int) and not isinstance(max_speed, float): raise TypeError("Invalid max_speed type, should be integer or float.") # Set max speed buf = array.array('I', [int(max_speed)]) try: fcntl.ioctl(self._fd,...
OSError
dataset/ETHPy150Open vsergeev/python-periphery/periphery/spi.py/SPI._set_max_speed
4,102
def _get_bit_order(self): # Get mode buf = array.array('B', [0]) try: fcntl.ioctl(self._fd, SPI._SPI_IOC_RD_MODE, buf, True) except __HOLE__ as e: raise SPIError(e.errno, "Getting SPI mode: " + e.strerror) if (buf[0] & SPI._SPI_LSB_FIRST) > 0: ...
OSError
dataset/ETHPy150Open vsergeev/python-periphery/periphery/spi.py/SPI._get_bit_order
4,103
def _set_bit_order(self, bit_order): if not isinstance(bit_order, str): raise TypeError("Invalid bit_order type, should be string.") elif bit_order.lower() not in ["msb", "lsb"]: raise ValueError("Invalid bit_order, can be \"msb\" or \"lsb\".") # Read-modify-write mode, ...
OSError
dataset/ETHPy150Open vsergeev/python-periphery/periphery/spi.py/SPI._set_bit_order
4,104
def _get_bits_per_word(self): # Get bits per word buf = array.array('B', [0]) try: fcntl.ioctl(self._fd, SPI._SPI_IOC_RD_BITS_PER_WORD, buf, True) except __HOLE__ as e: raise SPIError(e.errno, "Getting SPI bits per word: " + e.strerror) return buf[0]
OSError
dataset/ETHPy150Open vsergeev/python-periphery/periphery/spi.py/SPI._get_bits_per_word
4,105
def _set_bits_per_word(self, bits_per_word): if not isinstance(bits_per_word, int): raise TypeError("Invalid bits_per_word type, should be integer.") if bits_per_word < 0 or bits_per_word > 255: raise ValueError("Invalid bits_per_word, must be 0-255.") # Set bits per wor...
OSError
dataset/ETHPy150Open vsergeev/python-periphery/periphery/spi.py/SPI._set_bits_per_word
4,106
def _get_extra_flags(self): # Get mode buf = array.array('B', [0]) try: fcntl.ioctl(self._fd, SPI._SPI_IOC_RD_MODE, buf, True) except __HOLE__ as e: raise SPIError(e.errno, "Getting SPI mode: " + e.strerror) return buf[0] & ~(SPI._SPI_LSB_FIRST | SPI._SPI...
OSError
dataset/ETHPy150Open vsergeev/python-periphery/periphery/spi.py/SPI._get_extra_flags
4,107
def _set_extra_flags(self, extra_flags): if not isinstance(extra_flags, int): raise TypeError("Invalid extra_flags type, should be integer.") if extra_flags < 0 or extra_flags > 255: raise ValueError("Invalid extra_flags, must be 0-255.") # Read-modify-write mode, becaus...
OSError
dataset/ETHPy150Open vsergeev/python-periphery/periphery/spi.py/SPI._set_extra_flags
4,108
def info(name): ''' Return information about a group CLI Example: .. code-block:: bash salt '*' group.info foo ''' try: grinfo = grp.getgrnam(name) except __HOLE__: return {} else: return {'name': grinfo.gr_name, 'passwd': grinfo.gr_pass...
KeyError
dataset/ETHPy150Open saltstack/salt/salt/modules/pw_group.py/info
4,109
def Convert2Num(text): """converts text to python type in order Int, hex, Float, Complex ValueError if can't """ #convert to number if possible try: value = int(text, 10) return value except ValueError as ex: pass try: value = int(text, 16) ...
ValueError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Convert2Num
4,110
def Convert2CoordNum(text): """converts text to python type in order FracDeg, Int, hex, Float, Complex ValueError if can't """ #convert to FracDeg Coord if possible dm = REO_LatLonNE.findall(text) #returns list of tuples of groups [(deg,min)] if dm: deg = float(dm[0][0]) ...
ValueError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Convert2CoordNum
4,111
def Convert2BoolCoordNum(text): """converts text to python type in order None, Boolean, Int, Float, Complex ValueError if can't """ #convert to None if possible if text.lower() == 'none': return None #convert to boolean if possible if text.lower() in ['true', 'yes']: ...
ValueError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Convert2BoolCoordNum
4,112
def Convert2StrBoolCoordNum(text): """converts text to python type in order Boolean, Int, Float, complex or double quoted string ValueError if can't """ if REO_Quoted.match(text): #text is double quoted string return text.strip('"') #strip off quotes if REO_QuotedSingle.match(te...
ValueError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Convert2StrBoolCoordNum
4,113
def Convert2PathCoordNum(text): """converts text to python type in order Boolean, Int, Float, Complex ValueError if can't """ #convert to path string if possible if REO_PathNode.match(text): return (text) try: return (Convert2CoordNum(text)) except __HOLE__: ...
ValueError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Convert2PathCoordNum
4,114
def Convert2BoolPathCoordNum(text): """converts text to python type in order Boolean, Int, Float, Complex ValueError if can't """ #convert to None if possible if text.lower() == 'none': return None #convert to boolean if possible if text.lower() in ['true', 'yes']: ...
ValueError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Convert2BoolPathCoordNum
4,115
def Convert2StrBoolPathCoordNum(text): """converts text to python type in order Boolean, Int, Float, complex or double quoted string ValueError if can't """ if REO_Quoted.match(text): #text is double quoted string return text.strip('"') #strip off quotes if REO_QuotedSingle.matc...
ValueError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Convert2StrBoolPathCoordNum
4,116
def build(self, fileName='', mode=None, metas=None, preloads=None, behaviors=None): """ Allows building from multiple files. Essentially files list is stack of files fileName is name of first file. Load commands in any files push (append) file onto files until file completed loa...
IOError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.build
4,117
def buildLoad(self, command, tokens, index): """ load filepathname """ try: name = tokens[index] index +=1 self.files.append(self.currentFile) #push currentFile self.counts.append(self.currentCount) #push current line ct cwd...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildLoad
4,118
def buildHouse(self, command, tokens, index): """Create a new house and make it the current one house dreams """ try: name = tokens[index] index +=1 self.verifyName(name, command, tokens, index) self.currentHouse = housing.House(name ...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildHouse
4,119
def buildInit(self, command, tokens, index): """Initialize share in current store init destination to data destination: absolute path data: direct init destination from source destination: [(value...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildInit
4,120
def buildServer(self, command, tokens, index): """create server tasker in current house server has to have name so can ask stop server name [at period] [be scheduled] [rx shost:sport] [tx dhost:dport] [in order] [to prefix] [per data] [for source] schedu...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildServer
4,121
def buildLogger(self, command, tokens, index): """create logger in current house logger logname [to prefix] [at period] [be scheduled] [flush interval] scheduled: (active, inactive, slave) logger basic at 0.125 logger basic """ if not self.currentH...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildLogger
4,122
def buildLog(self, command, tokens, index): """create log in current logger log name [to fileName] [as (text, binary)] [on rule] rule: (once, never, always, update, change) default fileName is log's name default type is text default rule is update ...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildLog
4,123
def buildLoggee(self, command, tokens, index): """add loggee(s) to current log loggee tag sharepath tag sharepath ... """ if not self.currentLog: msg = "Error building %s. No current log." % (command,) raise excepting.ParseError(msg, tokens, index) if...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildLoggee
4,124
def buildFramer(self, command, tokens, index): """Create a new framer and make it the current one framework framername [be (active, inactive, aux, slave)] [at period] [first frame] [via (main, mine, inode)] framework framername be active at 0.0 f...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildFramer
4,125
def buildFirst(self, command, tokens, index): """set first (starting) frame for current framer first framename """ if not self.currentFramer: msg = "Error building %s. No current framer." % (command,) raise excepting.ParseError(msg, tokens, index) try...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildFirst
4,126
def buildFrame(self, command, tokens, index): """Create frame and attach to over frame if indicated frame frameName frame frameName overName the frameName next is reserved """ if not self.currentStore: msg = "Error building %s. No current store." %...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildFrame
4,127
def buildOver(self, command, tokens, index): """Makes frame the over frame of the current frame over frame """ self.verifyCurrentContext(tokens, index) #currentStore, currentFramer, currentFrame exist try: over = tokens[index] index +=1 s...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildOver
4,128
def buildUnder(self, command, tokens, index): """Makes frame the primary under frame of the current frame under frame """ self.verifyCurrentContext(tokens, index) #currentStore, currentFramer, currentFrame exist try: under = tokens[index] index +=1 ...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildUnder
4,129
def buildNext(self, command, tokens, index): """Explicitly assign next frame for timeouts and as target of go next next frameName next blank frameName means use lexically next allows override if multiple next commands to default of lexical """ self...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildNext
4,130
def buildAux(self, command, tokens, index): """Parse 'aux' command for simple, cloned, or conditional aux of forms Simple Auxiliary: aux framername Cloned Auxiliary: aux framername as (mine, clonedauxname) [via (main, mine, inode)] Simple Conditi...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildAux
4,131
def buildRear(self, command, tokens, index): """ Parse 'rear' verb Two Forms: only first form is currently supported rear original [as mine] [be aux] in frame framename framename cannot be me or in outline of me rear original as clonename be schedule ...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildRear
4,132
def buildRaze(self, command, tokens, index): """ Parse 'raze' verb raze (all, last, first) [in frame [(me, framename)]] """ self.verifyCurrentContext(tokens, index) #currentStore, currentFramer, currentFrame exist try: connective = None who = N...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildRaze
4,133
def buildDone(self, command, tokens, index): """ Creates complete action that indicates tasker(s) completed by setting .done state to True native context is enter done tasker [tasker ...] done [me] tasker: (taskername, me) """...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildDone
4,134
def buildTimeout(self, command, tokens, index): """creates implicit transition to next on elapsed >= value timeout 5.0 """ self.verifyCurrentContext(tokens, index) try: value = abs(Convert2Num(tokens[index])) #convert text to number if valid format i...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildTimeout
4,135
def buildRepeat(self, command, tokens, index): """creates implicit transition to next on recurred >= value repeat 2 go next if recurred >= 2 """ self.verifyCurrentContext(tokens, index) try: value = abs(Convert2Num(tokens[index])) #convert text to nu...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildRepeat
4,136
def buildPrint(self, command, tokens, index): """prints a string consisting of space separated tokens print message print hello world """ self.verifyCurrentContext(tokens, index) #currentStore, currentFramer, currentFrame exist try: message = ' '.join...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildPrint
4,137
def buildPut(self, command, tokens, index): """Build put command to put data into share put data into destination data: direct destination: [(value, fields) in] indirect """ self.verifyCurrentContext(tokens, index) #currentStore, c...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildPut
4,138
def buildInc(self, command, tokens, index): """Build inc command to inc share by data or from source inc destination by data inc destination from source destination: [(value, field) in] indirect data: directone source: ...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildInc
4,139
def buildCopy(self, command, tokens, index): """Build copy command to copy from one share to another copy source into destination source: [(value, fields) in] indirect destination: [(value, fields) in] indirect """ self.verifyCurre...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildCopy
4,140
def buildSet(self, command, tokens, index): """Build set command to generate goal actions set goal to data set goal from source goal: elapsed recurred [(value, fields) in] absolute [(value, fields) in] relativegoal ...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildSet
4,141
def buildGo(self, command, tokens, index): """Parse 'go' command transition with transition conditions of forms Transitions: go far go far if [not] need go far if [not] need [and [not] need ...] Far: next ...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildGo
4,142
def buildLet(self, command, tokens, index): """Parse 'let' command benter action with entry conditions of forms Before Enter: let [me] if [not] need let [me] if [not] need [and [not] need ...] Far: next me frame ...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildLet
4,143
def buildDo(self, command, tokens, index): """ do kind [part ...] [as name [part ...]] [at context] [via inode] [to data][by source] [with data] [from source] [per data] [for source] [cum data] [qua source] deed: name [part...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildDo
4,144
def buildBid(self, command, tokens, index): """ bid control tasker [tasker ...] [at period] bid control [me] [at period] bid control all [at period] control: (stop, start, run, abort, ready) tasker: (tasker, me, all) period: nu...
ValueError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildBid
4,145
def buildReady(self, command, tokens, index): """ ready taskName """ self.verifyCurrentContext(tokens, index) #currentStore, currentFramer, currentFrame exist try: tasker = tokens[index] index +=1 self.verifyName(tasker, command, tokens, ...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildReady
4,146
def buildStart(self, command, tokens, index): """ start taskName """ self.verifyCurrentContext(tokens, index) #currentStore, currentFramer, currentFrame exist try: tasker = tokens[index] index +=1 self.verifyName(tasker, command, tokens, ...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildStart
4,147
def buildStop(self, command, tokens, index): """ stop taskName """ self.verifyCurrentContext(tokens, index) #currentStore, currentFramer, currentFrame exist try: tasker = tokens[index] index +=1 self.verifyName(tasker, command, tokens, in...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildStop
4,148
def buildRun(self, command, tokens, index): """ run taskName """ self.verifyCurrentContext(tokens, index) #currentStore, currentFramer, currentFrame exist try: tasker = tokens[index] index +=1 self.verifyName(tasker, command, tokens, inde...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildRun
4,149
def buildAbort(self, command, tokens, index): """ abort taskName """ self.verifyCurrentContext(tokens, index) #currentStore, currentFramer, currentFrame exist try: tasker = tokens[index] index +=1 self.verifyName(tasker, command, tokens, ...
IndexError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildAbort
4,150
def parseNeedGoal(self, statePath, stateField, tokens, index): """Parse required goal method must be wrapped in appropriate try excepts """ goalPath = None #default goalField = None #default direct = False goal = tokens[index] #parse required goal ...
ValueError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.parseNeedGoal
4,151
def parseFramerNeedGoal(self, statePath, stateField, tokens, index): """ Parse required goal for special framer need such as elapsed or recurred method must be wrapped in appropriate try excepts """ goalPath = None #default goalField = None #default di...
ValueError
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.parseFramerNeedGoal
4,152
def load_special(self, cnf, typ, metadata_construction=False): for arg in SPEC[typ]: try: self.setattr(typ, arg, cnf[arg]) except __HOLE__: pass self.context = typ self.load_complex(cnf, typ, metadata_construction=metadata_construction) ...
KeyError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/pysaml2-2.4.0/src/saml2/config.py/Config.load_special
4,153
def load_complex(self, cnf, typ="", metadata_construction=False): try: self.setattr(typ, "policy", Policy(cnf["policy"])) except KeyError: pass # for srv, spec in cnf["service"].items(): # try: # self.setattr(srv, "policy", # ...
KeyError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/pysaml2-2.4.0/src/saml2/config.py/Config.load_complex
4,154
def unicode_convert(self, item): try: return unicode(item, "utf-8") except __HOLE__: _uc = self.unicode_convert if isinstance(item, dict): return dict([(key, _uc(val)) for key, val in item.items()]) elif isinstance(item, list): ...
TypeError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/pysaml2-2.4.0/src/saml2/config.py/Config.unicode_convert
4,155
def load(self, cnf, metadata_construction=False): """ The base load method, loads the configuration :param cnf: The configuration as a dictionary :param metadata_construction: Is this only to be able to construct metadata. If so some things can be left out. :return: The Conf...
KeyError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/pysaml2-2.4.0/src/saml2/config.py/Config.load
4,156
def endpoint(self, service, binding=None, context=None): """ Goes through the list of endpoint specifications for the given type of service and returns a list of endpoint that matches the given binding. If no binding is given all endpoints available for that service will be returned. ...
ValueError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/pysaml2-2.4.0/src/saml2/config.py/Config.endpoint
4,157
def log_handler(self): try: _logconf = self.logger except __HOLE__: return None handler = None for htyp in LOG_HANDLER: if htyp in _logconf: if htyp == "syslog": args = _logconf[htyp] if "socktyp...
KeyError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/pysaml2-2.4.0/src/saml2/config.py/Config.log_handler
4,158
def setup_logger(self): if root_logger.level != logging.NOTSET: # Someone got there before me return root_logger _logconf = self.logger if _logconf is None: return root_logger try: root_logger.setLevel(LOG_LEVEL[_logconf["loglevel"].lower()]) ...
KeyError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/pysaml2-2.4.0/src/saml2/config.py/Config.setup_logger
4,159
def vo_conf(self, vo_name): try: return self.virtual_organization[vo_name] except __HOLE__: return None
KeyError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/pysaml2-2.4.0/src/saml2/config.py/SPConfig.vo_conf
4,160
@reflection.cache def get_columns(self, connection, table_name, schema=None, **kw): """ kw arguments can be: oracle_resolve_synonyms dblink """ resolve_synonyms = kw.get('oracle_resolve_synonyms', False) dblink = kw.get('dblink', '') info_...
KeyError
dataset/ETHPy150Open RoseOu/flasky/venv/lib/python2.7/site-packages/sqlalchemy/dialects/oracle/base.py/OracleDialect.get_columns
4,161
def _cohn_kanade_orig(datadir, im_shape, na_val=-1): """Creates dataset (pair of X and y) from Cohn-Kanade image data (CK+)""" images = [] landmarks = [] labels = [] n = 0 for name in os.listdir(os.path.join(datadir, 'images')): n += 1 print('processed %d' % n) impath...
IOError
dataset/ETHPy150Open dfdx/masque/masque/datasets.py/_cohn_kanade_orig
4,162
def get_revision_metadata(changeset, metadata_property_map=None, repository_uri=None, encoding="utf-8"): """ Return dictionary of metadatas defined in metadata_property_map. Uses slow solution (git log query per property) to avoid "delimiter inside result" problem. """ # it looks like git is d...
ValueError
dataset/ETHPy150Open ella/citools/citools/git.py/get_revision_metadata
4,163
def __init__(self, qs, request): self.qs = qs self.request = request self.page_size = request.session.get('page_size', self.available_page_sizes[0]) # overwrite with new value, if it is correct if 'page_size' in request.GET: try: ps = int...
ValueError
dataset/ETHPy150Open dndtools/dndtools/dndtools/dnd/dnd_paginator.py/DndPaginator.__init__
4,164
def _bulk_register(watch_states, notifier, cb, details_filter=None): """Bulk registers a callback associated with many states.""" registered = [] try: for state in watch_states: if not notifier.is_registered(state, cb, details_filter=details_filt...
ValueError
dataset/ETHPy150Open openstack/taskflow/taskflow/listeners/base.py/_bulk_register
4,165
def main(): parser = argparse.ArgumentParser('pupa', description='pupa CLI') parser.add_argument('--debug', nargs='?', const='pdb', default=None, help='drop into pdb (or set =ipdb =pudb)') parser.add_argument('--loglevel', default='INFO', help=('set log level. options are: ' ...
ImportError
dataset/ETHPy150Open opencivicdata/pupa/pupa/cli/__main__.py/main
4,166
def Paginate(self, query, default_limit): """Returns a list of entities limited to limit, with a next_page cursor.""" try: limit = int(self.request.get('limit', default_limit)) except __HOLE__: limit = default_limit if limit not in QUERY_LIMITS: limit = default_limit cursor = self...
ValueError
dataset/ETHPy150Open google/simian/src/simian/mac/admin/__init__.py/AdminHandler.Paginate
4,167
def rescale(self, units): ''' Return a copy of the AnalogSignal(Array) converted to the specified units ''' to_dims = pq.quantity.validate_dimensionality(units) if self.dimensionality == to_dims: to_u = self.units signal = np.array(self) el...
AssertionError
dataset/ETHPy150Open NeuralEnsemble/python-neo/neo/core/analogsignal.py/BaseAnalogSignal.rescale
4,168
def test_composite_attr_happy(self): obj = FakeResource.existing(**{'attr3': '3'}) try: self.assertEqual('3', obj.third) except __HOLE__: self.fail("third was not found as expected")
AttributeError
dataset/ETHPy150Open openstack/python-openstacksdk/openstack/tests/unit/test_resource.py/ResourceTests.test_composite_attr_happy
4,169
def test_composite_attr_fallback(self): obj = FakeResource.existing(**{'attr_three': '3'}) try: self.assertEqual('3', obj.third) except __HOLE__: self.fail("third was not found in fallback as expected")
AttributeError
dataset/ETHPy150Open openstack/python-openstacksdk/openstack/tests/unit/test_resource.py/ResourceTests.test_composite_attr_fallback
4,170
def _test_resource_serialization(self, session_method, resource_method): attr_type = resource.Resource class Test(resource.Resource): allow_create = True attr = resource.prop("attr", type=attr_type) the_id = 123 sot = Test() sot.attr = resource.Resource(...
TypeError
dataset/ETHPy150Open openstack/python-openstacksdk/openstack/tests/unit/test_resource.py/ResourceMapping._test_resource_serialization
4,171
def get_access_token(self, target_id, scope, grant_type): """ :param target_id: :param scope: :param grant_type: :return: """ # No default, either there is an explicit policy or there is not try: lifetime = self.token_policy['access_token'][ta...
KeyError
dataset/ETHPy150Open rohe/pyoidc/src/oic/utils/token_handler.py/TokenHandler.get_access_token
4,172
def refresh_access_token(self, target_id, token, grant_type, **kwargs): """ :param target_id: Who gave me this token :param token: The refresh_token :param grant_type: Which grant type the token is connected to :param kwargs: Extra key word arguments :return: New access_...
KeyError
dataset/ETHPy150Open rohe/pyoidc/src/oic/utils/token_handler.py/TokenHandler.refresh_access_token
4,173
def get_refresh_token(self, target_id, grant_type, sid): try: lifetime = self.token_policy['refresh_token'][target_id][grant_type] except __HOLE__: raise NotAllowed( 'Issue access token for grant_type {} for target_id {} not allowed') else: ret...
KeyError
dataset/ETHPy150Open rohe/pyoidc/src/oic/utils/token_handler.py/TokenHandler.get_refresh_token
4,174
def follow_messages(so, stdout, stderr): try: resp = follow_events(so["basedir"], "messages", catchup=True) if resp.status != 200: print >>stderr, "Error:", resp.status, resp.reason return 1 # httplib is not really built to read a stream of lines while True: ...
KeyboardInterrupt
dataset/ETHPy150Open warner/petmail/petmail/scripts/messages.py/follow_messages
4,175
def get_filing_forms_w_sections(self): """ Returns a list of tuples, each containing a FilingForm object and list of FilingFormSection objects, if specific sections of the filing form are relevant to the model. """ from calaccess_raw.annotations import FilingForm ...
KeyError
dataset/ETHPy150Open california-civic-data-coalition/django-calaccess-raw-data/calaccess_raw/models/base.py/CalAccessBaseModel.get_filing_forms_w_sections
4,176
def _run_pyroma(data): # pragma: no cover """Run pyroma (used to perform checks before releasing a new version). """ import sys from zest.releaser.utils import ask if not ask("Run pyroma on the package before uploading?"): return try: from pyroma import run result = run...
ImportError
dataset/ETHPy150Open LabPy/lantz/lantz/__init__.py/_run_pyroma
4,177
@staticmethod def are_concurrent(*lines): """Is a sequence of linear entities concurrent? Two or more linear entities are concurrent if they all intersect at a single point. Parameters ========== lines : a sequence of linear entities. Returns =====...
AttributeError
dataset/ETHPy150Open sympy/sympy/sympy/geometry/line3d.py/LinearEntity3D.are_concurrent
4,178
def event_choices(events): """ Get the possible events from settings """ if events is None: msg = "Please add some events in settings.WEBHOOK_EVENTS." raise ImproperlyConfigured(msg) try: choices = [(x, x) for x in events] except __HOLE__: """ Not a valid iterator, so we ...
TypeError
dataset/ETHPy150Open pydanny/dj-webhooks/djwebhooks/models.py/event_choices
4,179
def handle_noargs(self, **options): from django.db import connection, transaction, models from django.conf import settings from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal verbosity = int(options.get('verbosity', 1)) interactive = options.get('i...
ImportError
dataset/ETHPy150Open CollabQ/CollabQ/vendor/django/core/management/commands/syncdb.py/Command.handle_noargs
4,180
def command_start(args): procfile_path = _procfile_path(args.app_root, _choose_procfile(args)) procfile = _procfile(procfile_path) concurrency = _parse_concurrency(args.concurrency) env = _read_env(args.app_root, args.env) quiet = _parse_quiet(args.quiet) port = _choose_port(args, env) if ...
KeyError
dataset/ETHPy150Open nickstenning/honcho/honcho/command.py/command_start
4,181
def _procfile(filename): try: with open(filename) as f: content = f.read() except IOError: raise CommandError('Procfile does not exist or is not a file') try: procfile = environ.parse_procfile(content) except __HOLE__ as e: raise CommandError(str(e)) ret...
AssertionError
dataset/ETHPy150Open nickstenning/honcho/honcho/command.py/_procfile
4,182
def _read_env(app_root, env): files = [e.strip() for e in env.split(',')] content = [] for envfile in files: try: with open(os.path.join(app_root, envfile)) as f: content.append(f.read()) except __HOLE__: pass return environ.parse('\n'.join(conten...
IOError
dataset/ETHPy150Open nickstenning/honcho/honcho/command.py/_read_env
4,183
def _mkdir(path): if os.path.exists(path): return try: os.makedirs(path) except __HOLE__ as e: log.error("Could not create export directory") raise CommandError(e)
OSError
dataset/ETHPy150Open nickstenning/honcho/honcho/command.py/_mkdir
4,184
def _write_file(path, content): _mkdir(os.path.dirname(path)) try: with open(path, 'w') as fp: fp.write(content) except __HOLE__ as e: log.error("Could not write to export file") raise CommandError(e)
IOError
dataset/ETHPy150Open nickstenning/honcho/honcho/command.py/_write_file
4,185
def handle(self): """Runs through the SMTP session, receiving commands, calling handlers, and sending responses. :raises: :class:`~slimta.smtp.ConnectionLost` or unhandled exceptions. """ if self.tls and self.tls_immediately: if not self._encrypt_session(): ...
StopIteration
dataset/ETHPy150Open slimta/python-slimta/slimta/smtp/server.py/Server.handle
4,186
def _command_AUTH(self, arg): if 'AUTH' not in self.extensions: unknown_command.send(self.io) return if not self.ehlo_as or self.authed or self.have_mailfrom: bad_sequence.send(self.io) return auth = self.extensions.getparam('AUTH') try: ...
ValueError
dataset/ETHPy150Open slimta/python-slimta/slimta/smtp/server.py/Server._command_AUTH
4,187
def _command_MAIL(self, arg): match = from_pattern.match(arg) if not match: bad_arguments.send(self.io) return start = match.end(0) end = find_outside_quotes(arg, b'>', start) if end == -1: bad_arguments.send(self.io) return ...
ValueError
dataset/ETHPy150Open slimta/python-slimta/slimta/smtp/server.py/Server._command_MAIL
4,188
def synopsis(filename, cache={}): """Get the one-line summary out of a module file.""" mtime = os.stat(filename).st_mtime lastupdate, result = cache.get(filename, (0, None)) if lastupdate < mtime: info = inspect.getmoduleinfo(filename) try: file = open(filename) ...
IOError
dataset/ETHPy150Open deanhiller/databus/webapp/play1.3.x/python/Lib/pydoc.py/synopsis
4,189
def safeimport(path, forceload=0, cache={}): """Import a module; handle errors; return None if the module isn't found. If the module *is* found but an exception occurs, it's wrapped in an ErrorDuringImport exception and reraised. Unlike __import__, if a package path is specified, the module at th...
AttributeError
dataset/ETHPy150Open deanhiller/databus/webapp/play1.3.x/python/Lib/pydoc.py/safeimport
4,190
def document(self, object, name=None, *args): """Generate documentation for an object.""" args = (object, name) + args # 'try' clause is to attempt to handle the possibility that inspect # identifies something in a way that pydoc itself has issues handling; # think 'super' a...
AttributeError
dataset/ETHPy150Open deanhiller/databus/webapp/play1.3.x/python/Lib/pydoc.py/Doc.document
4,191
def getdocloc(self, object): """Return the location of module docs or None""" try: file = inspect.getabsfile(object) except __HOLE__: file = '(built-in)' docloc = os.environ.get("PYTHONDOCS", "http://docs.python.org/libra...
TypeError
dataset/ETHPy150Open deanhiller/databus/webapp/play1.3.x/python/Lib/pydoc.py/Doc.getdocloc
4,192
def docmodule(self, object, name=None, mod=None, *ignored): """Produce HTML documentation for a module object.""" name = object.__name__ # ignore the passed-in name try: all = object.__all__ except AttributeError: all = None parts = split(name, '.')...
TypeError
dataset/ETHPy150Open deanhiller/databus/webapp/play1.3.x/python/Lib/pydoc.py/HTMLDoc.docmodule
4,193
def docclass(self, object, name=None, mod=None, funcs={}, classes={}, *ignored): """Produce HTML documentation for a class object.""" realname = object.__name__ name = name or realname bases = object.__bases__ contents = [] push = contents.append...
TypeError
dataset/ETHPy150Open deanhiller/databus/webapp/play1.3.x/python/Lib/pydoc.py/HTMLDoc.docclass
4,194
def docmodule(self, object, name=None, mod=None): """Produce text documentation for a given module object.""" name = object.__name__ # ignore the passed-in name synop, desc = splitdoc(getdoc(object)) result = self.section('NAME', name + (synop and ' - ' + synop)) try: ...
TypeError
dataset/ETHPy150Open deanhiller/databus/webapp/play1.3.x/python/Lib/pydoc.py/TextDoc.docmodule
4,195
def pipepager(text, cmd): """Page through text by feeding it to another program.""" pipe = os.popen(cmd, 'w') try: pipe.write(text) pipe.close() except __HOLE__: pass # Ignore broken pipes caused by quitting the pager program.
IOError
dataset/ETHPy150Open deanhiller/databus/webapp/play1.3.x/python/Lib/pydoc.py/pipepager
4,196
def ttypager(text): """Page through text on a text terminal.""" lines = split(plain(text), '\n') try: import tty fd = sys.stdin.fileno() old = tty.tcgetattr(fd) tty.setcbreak(fd) getchar = lambda: sys.stdin.read(1) except (ImportError, __HOLE__): ...
AttributeError
dataset/ETHPy150Open deanhiller/databus/webapp/play1.3.x/python/Lib/pydoc.py/ttypager
4,197
def locate(path, forceload=0): """Locate an object by name or dotted path, importing as necessary.""" parts = [part for part in split(path, '.') if part] module, n = None, 0 while n < len(parts): nextmodule = safeimport(join(parts[:n+1], '.'), forceload) if nextmodule: module, n = ...
AttributeError
dataset/ETHPy150Open deanhiller/databus/webapp/play1.3.x/python/Lib/pydoc.py/locate
4,198
def doc(thing, title='Python Library Documentation: %s', forceload=0): """Display text documentation, given an object or a path to an object.""" try: pager(render_doc(thing, title, forceload)) except (__HOLE__, ErrorDuringImport), value: print value
ImportError
dataset/ETHPy150Open deanhiller/databus/webapp/play1.3.x/python/Lib/pydoc.py/doc
4,199
def writedoc(thing, forceload=0): """Write HTML documentation to a file in the current directory.""" try: object, name = resolve(thing, forceload) page = html.page(describe(object), html.document(object, name)) file = open(name + '.html', 'w') file.write(page) file...
ImportError
dataset/ETHPy150Open deanhiller/databus/webapp/play1.3.x/python/Lib/pydoc.py/writedoc