bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def test_missing_import_source(self): # from import a tree = \ (257, (267, (268, (269, (281, (283, (1, 'from'), (1, 'import'), (286, (284, (1, 'fred')))))), (4, ''))), (4, ''), (0, '')) self.check_bad_tree(tree, "from import a") | def test_missing_import_source(self): # from import a tree = \ (257, (267, (268, (269, (281, (283, (1, 'from'), (1, 'import'), (286, (284, (1, 'fred')))))), (4, ''))), (4, ''), (0, '')) self.check_bad_tree(tree, "from import a") | 457,300 |
def test_checkcache(self): getline = linecache.getline # Create a source file and cache its contents source_name = support.TESTFN + '.py' self.addCleanup(test_support.unlink, source_name) with open(source_name, 'w') as source: source.write(SOURCE_1) getline(source_name, 1) | def test_checkcache(self): getline = linecache.getline # Create a source file and cache its contents source_name = support.TESTFN + '.py' self.addCleanup(support.unlink, source_name) with open(source_name, 'w') as source: source.write(SOURCE_1) getline(source_name, 1) | 457,301 |
def test_font_eq(self): font1 = font.nametofont("TkDefaultFont") font2 = font.nametofont("TkDefaultFont") self.assertIsNot(font1, font2) self.assertEqual(font1, font2) self.assertNotEqual(font1, font1.copy()) self.assertNotEqual(font1, 0) | def test_font_eq(self): fontname = "TkDefaultFont" try: f = font.Font(name=fontname, exists=True) except tkinter._tkinter.TclError: f = font.Font(name=fontname, exists=False) font1 = font.nametofont(fontname) font2 = font.nametofont(fontname) self.assertIsNot(font1, font2) self.assertEqual(font1, font2) self.assertNotE... | 457,302 |
def discover(self, start_dir, pattern='test*.py', top_level_dir=None): """Find and return all test modules from the specified start directory, recursing into subdirectories to find them. Only test files that match the pattern will be loaded. (Using shell style pattern matching.) | def discover(self, start_dir, pattern='test*.py', top_level_dir=None): """Find and return all test modules from the specified start directory, recursing into subdirectories to find them. Only test files that match the pattern will be loaded. (Using shell style pattern matching.) | 457,303 |
def test_mbcs_name(self): try: chars = os.fsencode("\u65e5\u672c") except UnicodeError: raise unittest.SkipTest("Unable to encode for this platform.") | def test_unicode_name(self): try: os.fsencode("\xf1") except UnicodeError: raise unittest.SkipTest("Unable to encode for this platform.") | 457,304 |
def test_mbcs_name(self): try: chars = os.fsencode("\u65e5\u672c") except UnicodeError: raise unittest.SkipTest("Unable to encode for this platform.") | def test_mbcs_name(self): try: chars = os.fsencode("\u65e5\u672c") except UnicodeError: raise unittest.SkipTest("Unable to encode for this platform.") | 457,305 |
def addHandler(self, hdlr): """ Add the specified handler to this logger. """ if not (hdlr in self.handlers): self.handlers.append(hdlr) | def addHandler(self, hdlr): """ Add the specified handler to this logger. """ if not (hdlr in self.handlers): self.handlers.append(hdlr) | 457,306 |
def removeHandler(self, hdlr): """ Remove the specified handler from this logger. """ if hdlr in self.handlers: hdlr.acquire() try: self.handlers.remove(hdlr) finally: hdlr.release() | def removeHandler(self, hdlr): """ Remove the specified handler from this logger. """ _acquireLock() try: if hdlr in self.handlers: self.handlers.remove(hdlr) finally: hdlr.release() | 457,307 |
def removeHandler(self, hdlr): """ Remove the specified handler from this logger. """ if hdlr in self.handlers: hdlr.acquire() try: self.handlers.remove(hdlr) finally: hdlr.release() | def removeHandler(self, hdlr): """ Remove the specified handler from this logger. """ if hdlr in self.handlers: hdlr.acquire() try: self.handlers.remove(hdlr) finally: hdlr.release() | 457,308 |
def detect_encoding(readline): """ The detect_encoding() function is used to detect the encoding that should be used to decode a Python source file. It requires one argment, readline, in the same way as the tokenize() generator. It will call readline a maximum of twice, and return the encoding used (as a string) and a... | def detect_encoding(readline): """ The detect_encoding() function is used to detect the encoding that should be used to decode a Python source file. It requires one argment, readline, in the same way as the tokenize() generator. It will call readline a maximum of twice, and return the encoding used (as a string) and ... | 457,309 |
def detect_encoding(readline): """ The detect_encoding() function is used to detect the encoding that should be used to decode a Python source file. It requires one argment, readline, in the same way as the tokenize() generator. It will call readline a maximum of twice, and return the encoding used (as a string) and a... | def detect_encoding(readline): """ The detect_encoding() function is used to detect the encoding that should be used to decode a Python source file. It requires one argment, readline, in the same way as the tokenize() generator. It will call readline a maximum of twice, and return the encoding used (as a string) and a... | 457,310 |
def detect_encoding(readline): """ The detect_encoding() function is used to detect the encoding that should be used to decode a Python source file. It requires one argment, readline, in the same way as the tokenize() generator. It will call readline a maximum of twice, and return the encoding used (as a string) and a... | def detect_encoding(readline): """ The detect_encoding() function is used to detect the encoding that should be used to decode a Python source file. It requires one argment, readline, in the same way as the tokenize() generator. It will call readline a maximum of twice, and return the encoding used (as a string) and a... | 457,311 |
def tokenize(readline): """ The tokenize() generator requires one argment, readline, which must be a callable object which provides the same interface as the readline() method of built-in file objects. Each call to the function should return one line of input as bytes. Alternately, readline can be a callable function ... | def tokenize(readline): """ The tokenize() generator requires one argment, readline, which must be a callable object which provides the same interface as the readline() method of built-in file objects. Each call to the function should return one line of input as bytes. Alternately, readline can be a callable function... | 457,312 |
def tokenize(readline): """ The tokenize() generator requires one argment, readline, which must be a callable object which provides the same interface as the readline() method of built-in file objects. Each call to the function should return one line of input as bytes. Alternately, readline can be a callable function ... | def tokenize(readline): """ The tokenize() generator requires one argment, readline, which must be a callable object which provides the same interface as the readline() method of built-in file objects. Each call to the function should return one line of input as bytes. Alternately, readline can be a callable function ... | 457,313 |
def handle_close(self): self.baseclass.push('226 transfer complete') self.close() | def handle_close(self): self.baseclass.push('226 transfer complete') self.close() | 457,314 |
def close(self): try: if isinstance(self.socket, ssl.SSLSocket): if self.socket._sslobj is not None: self.socket.unwrap() finally: super(SSLConnection, self).close() | def close(self): try: if isinstance(self.socket, ssl.SSLSocket): if self.socket._sslobj is not None: self.socket.unwrap() finally: super(SSLConnection, self).close() | 457,315 |
def test_data_connection(self): # clear text sock = self.client.transfercmd('list') self.assertNotIsInstance(sock, ssl.SSLSocket) sock.close() self.client.voidresp() | def test_data_connection(self): # clear text sock = self.client.transfercmd('list') self.assertNotIsInstance(sock, ssl.SSLSocket) sock.close() self.client.voidresp() | 457,316 |
def test_data_connection(self): # clear text sock = self.client.transfercmd('list') self.assertNotIsInstance(sock, ssl.SSLSocket) sock.close() self.client.voidresp() | def test_data_connection(self): # clear text sock = self.client.transfercmd('list') self.assertNotIsInstance(sock, ssl.SSLSocket) sock.close() self.client.voidresp() | 457,317 |
def test_data_connection(self): # clear text sock = self.client.transfercmd('list') self.assertNotIsInstance(sock, ssl.SSLSocket) sock.close() self.client.voidresp() | def test_data_connection(self): # clear text sock = self.client.transfercmd('list') self.assertNotIsInstance(sock, ssl.SSLSocket) sock.close() self.client.voidresp() | 457,318 |
def __init__(self, flist=None, filename=None, key=None, root=None): if EditorWindow.help_url is None: dochome = os.path.join(sys.prefix, 'Doc', 'index.html') if sys.platform.count('linux'): # look for html docs in a couple of standard places pyver = 'python-docs-' + '%s.%s.%s' % sys.version_info[:3] if os.path.isdir('... | def __init__(self, flist=None, filename=None, key=None, root=None): if EditorWindow.help_url is None: dochome = os.path.join(sys.prefix, 'Doc', 'index.html') if sys.platform.count('linux'): # look for html docs in a couple of standard places pyver = 'python-docs-' + '%s.%s.%s' % sys.version_info[:3] if os.path.isdir('... | 457,319 |
def write_results(self, show_missing=True, summary=False, coverdir=None): """ @param coverdir """ if self.calledfuncs: print() print("functions called:") for filename, modulename, funcname in sorted(calls.keys()): print(("filename: %s, modulename: %s, funcname: %s" % (filename, modulename, funcname))) | def write_results(self, show_missing=True, summary=False, coverdir=None): """ @param coverdir """ if self.calledfuncs: print() print("functions called:") calls = self.calledfuncs.keys() for filename, modulename, funcname in sorted(calls): print(("filename: %s, modulename: %s, funcname: %s" % (filename, modulename, func... | 457,320 |
def test_pep3147_paths(self): # Ensure that the default behavior of compileall's CLI is to create # PEP 3147 pyc/pyo files. retcode = subprocess.call( (sys.executable, '-m', 'compileall', '-q', self.pkgdir)) self.assertEqual(retcode, 0) # Verify the __pycache__ directory contents. cachedir = os.path.join(self.pkgdir, '... | def test_pep3147_paths(self): # Ensure that the default behavior of compileall's CLI is to create # PEP 3147 pyc/pyo files. retcode = subprocess.call( (sys.executable, '-m', 'compileall', '-q', self.pkgdir)) self.assertEqual(retcode, 0) # Verify the __pycache__ directory contents. cachedir = os.path.join(self.pkgdir, '... | 457,321 |
def test_legacy_paths(self): # Ensure that with the proper switch, compileall leaves legacy # pyc/pyo files, and no __pycache__ directory. retcode = subprocess.call( (sys.executable, '-m', 'compileall', '-b', '-q', self.pkgdir)) self.assertEqual(retcode, 0) # Verify the __pycache__ directory contents. cachedir = os.pat... | def test_legacy_paths(self): # Ensure that with the proper switch, compileall leaves legacy # pyc/pyo files, and no __pycache__ directory. retcode = subprocess.call( (sys.executable, '-m', 'compileall', '-b', '-q', self.pkgdir)) self.assertEqual(retcode, 0) # Verify the __pycache__ directory contents. cachedir = os.pat... | 457,322 |
def test_abspath_issue3426(self): # Check that abspath returns unicode when the arg is unicode # with both ASCII and non-ASCII cwds. abspath = self.pathmodule.abspath for path in ('', 'fuu', 'f\xf9\xf9', '/fuu', 'U:\\'): self.assertIsInstance(abspath(path), str) | def test_abspath_issue3426(self): # Check that abspath returns unicode when the arg is unicode # with both ASCII and non-ASCII cwds. abspath = self.pathmodule.abspath for path in ('', 'fuu', 'f\xf9\xf9', '/fuu', 'U:\\'): self.assertIsInstance(abspath(path), str) | 457,323 |
def testBufferOutputStartTestAddSuccess(self): real_out = self._real_out real_err = self._real_err | def testBufferOutputStartTestAddSuccess(self): real_out = self._real_out real_err = self._real_err | 457,324 |
def testBufferOutputAddErrorOrFailure(self): for message_attr, add_attr, include_error in [ ('errors', 'addError', True), ('failures', 'addFailure', False), ('errors', 'addError', True), ('failures', 'addFailure', False) ]: result = self.getStartedResult() buffered_out = sys.stdout buffered_err = sys.stderr result._ori... | def testBufferOutputAddErrorOrFailure(self): for message_attr, add_attr, include_error in [ ('errors', 'addError', True), ('failures', 'addFailure', False), ('errors', 'addError', True), ('failures', 'addFailure', False) ]: result = self.getStartedResult() buffered_out = sys.stdout buffered_err = sys.stderr result._ori... | 457,325 |
def testBufferOutputAddErrorOrFailure(self): for message_attr, add_attr, include_error in [ ('errors', 'addError', True), ('failures', 'addFailure', False), ('errors', 'addError', True), ('failures', 'addFailure', False) ]: result = self.getStartedResult() buffered_out = sys.stdout buffered_err = sys.stderr result._ori... | def testBufferOutputAddErrorOrFailure(self): for message_attr, add_attr, include_error in [ ('errors', 'addError', True), ('failures', 'addFailure', False), ('errors', 'addError', True), ('failures', 'addFailure', False) ]: result = self.getStartedResult() buffered_out = sys.stdout buffered_err = sys.stderr result._ori... | 457,326 |
def parse_response(self, response): # read response data from httpresponse, and parse it if response.getheader("Content-Encoding", "") == "gzip": stream = GzipDecodedResponse(response) else: stream = response | def parse_response(self, response): # read response data from httpresponse, and parse it if hasattr(response, 'getheader'): if response.getheader("Content-Encoding", "") == "gzip": stream = GzipDecodedResponse(response) else: stream = response else: stream = response | 457,327 |
def _netbios_getnode(): """Get the hardware address on Windows using NetBIOS calls. See http://support.microsoft.com/kb/118623 for details.""" import win32wnet, netbios ncb = netbios.NCB() ncb.Command = netbios.NCBENUM ncb.Buffer = adapters = netbios.LANA_ENUM() adapters._pack() if win32wnet.Netbios(ncb) != 0: return a... | def _netbios_getnode(): """Get the hardware address on Windows using NetBIOS calls. See http://support.microsoft.com/kb/118623 for details.""" import win32wnet, netbios ncb = netbios.NCB() ncb.Command = netbios.NCBENUM ncb.Buffer = adapters = netbios.LANA_ENUM() adapters._pack() if win32wnet.Netbios(ncb) != 0: return a... | 457,328 |
def _netbios_getnode(): """Get the hardware address on Windows using NetBIOS calls. See http://support.microsoft.com/kb/118623 for details.""" import win32wnet, netbios ncb = netbios.NCB() ncb.Command = netbios.NCBENUM ncb.Buffer = adapters = netbios.LANA_ENUM() adapters._pack() if win32wnet.Netbios(ncb) != 0: return a... | def _netbios_getnode(): """Get the hardware address on Windows using NetBIOS calls. See http://support.microsoft.com/kb/118623 for details.""" import win32wnet, netbios ncb = netbios.NCB() ncb.Command = netbios.NCBENUM ncb.Buffer = adapters = netbios.LANA_ENUM() adapters._pack() if win32wnet.Netbios(ncb) != 0: return a... | 457,329 |
def _netbios_getnode(): """Get the hardware address on Windows using NetBIOS calls. See http://support.microsoft.com/kb/118623 for details.""" import win32wnet, netbios ncb = netbios.NCB() ncb.Command = netbios.NCBENUM ncb.Buffer = adapters = netbios.LANA_ENUM() adapters._pack() if win32wnet.Netbios(ncb) != 0: return a... | def _netbios_getnode(): """Get the hardware address on Windows using NetBIOS calls. See http://support.microsoft.com/kb/118623 for details.""" import win32wnet, netbios ncb = netbios.NCB() ncb.Command = netbios.NCBENUM ncb.Buffer = adapters = netbios.LANA_ENUM() adapters._pack() if win32wnet.Netbios(ncb) != 0: return a... | 457,330 |
def addHandler(self, hdlr): """ Add the specified handler to this logger. """ if not (hdlr in self.handlers): self.handlers.append(hdlr) | def addHandler(self, hdlr): """ Add the specified handler to this logger. """ if not (hdlr in self.handlers): self.handlers.append(hdlr) | 457,331 |
def removeHandler(self, hdlr): """ Remove the specified handler from this logger. """ if hdlr in self.handlers: #hdlr.close() hdlr.acquire() try: self.handlers.remove(hdlr) finally: hdlr.release() | def removeHandler(self, hdlr): """ Remove the specified handler from this logger. """ if hdlr in self.handlers: #hdlr.close() hdlr.acquire() try: self.handlers.remove(hdlr) finally: hdlr.release() | 457,332 |
def removeHandler(self, hdlr): """ Remove the specified handler from this logger. """ if hdlr in self.handlers: #hdlr.close() hdlr.acquire() try: self.handlers.remove(hdlr) finally: hdlr.release() | def removeHandler(self, hdlr): """ Remove the specified handler from this logger. """ if hdlr in self.handlers: #hdlr.close() hdlr.acquire() try: self.handlers.remove(hdlr) finally: hdlr.release() | 457,333 |
def basicConfig(**kwargs): """ Do basic configuration for the logging system. This function does nothing if the root logger already has handlers configured. It is a convenience method intended for use by simple scripts to do one-shot configuration of the logging package. The default behaviour is to create a StreamHan... | def basicConfig(**kwargs): """ Do basic configuration for the logging system. This function does nothing if the root logger already has handlers configured. It is a convenience method intended for use by simple scripts to do one-shot configuration of the logging package. The default behaviour is to create a StreamHan... | 457,334 |
def getLogger(name=None): """ Return a logger with the specified name, creating it if necessary. If no name is specified, return the root logger. """ if name: return Logger.manager.getLogger(name) else: return root | def getLogger(name=None): """ Return a logger with the specified name, creating it if necessary. If no name is specified, return the root logger. """ if name: return Logger.manager.getLogger(name) else: return root | 457,335 |
def _power_exact(self, other, p): """Attempt to compute self**other exactly. | def _power_exact(self, other, p): """Attempt to compute self**other exactly. | 457,336 |
def strftest1(self, now): if test_support.verbose: print "strftime test for", time.ctime(now) now = self.now # Make sure any characters that could be taken as regex syntax is # escaped in escapestr() expectations = ( ('%a', calendar.day_abbr[now[6]], 'abbreviated weekday name'), ('%A', calendar.day_name[now[6]], 'full ... | def strftest1(self, now): if test_support.verbose: print "strftime test for", time.ctime(now) now = self.now # Make sure any characters that could be taken as regex syntax is # escaped in escapestr() expectations = ( ('%a', calendar.day_abbr[now[6]], 'abbreviated weekday name'), ('%A', calendar.day_name[now[6]], 'full ... | 457,337 |
def http_error_401(self, req, fp, code, msg, headers): url = req.full_url return self.http_error_auth_reqed('www-authenticate', url, req, headers) | def http_error_401(self, req, fp, code, msg, headers): url = req.full_url response = self.http_error_auth_reqed('www-authenticate', url, req, headers) | 457,338 |
def http_error_407(self, req, fp, code, msg, headers): # http_error_auth_reqed requires that there is no userinfo component in # authority. Assume there isn't one, since urllib.request does not (and # should not, RFC 3986 s. 3.2.1) support requests for URLs containing # userinfo. authority = req.host return self.http_... | def http_error_407(self, req, fp, code, msg, headers): # http_error_auth_reqed requires that there is no userinfo component in # authority. Assume there isn't one, since urllib.request does not (and # should not, RFC 3986 s. 3.2.1) support requests for URLs containing # userinfo. authority = req.host response = self.h... | 457,339 |
def _fixup_command(self, cmd): # When Python was build with --enable-shared, -L. is not good enough # to find the libpython<blah>.so. This is because regrtest runs it # under a tempdir, not in the top level where the .so lives. By the # time we've gotten here, Python's already been chdir'd to the # tempdir. # # To fu... | def _fixup_command(self, cmd): # When Python was build with --enable-shared, -L. is not good enough # to find the libpython<blah>.so. This is because regrtest runs it # under a tempdir, not in the top level where the .so lives. By the # time we've gotten here, Python's already been chdir'd to the # tempdir. # # To fu... | 457,340 |
def test_issue9936(self): tracer = trace.Trace(trace=0, count=1) modname = 'test.tracedmodules.testmod' # Ensure that the module is executed in import if modname in sys.modules: del sys.modules[modname] cmd = ("import test.tracedmodules.testmod as t;" "t.func(0); t.func2();") with captured_stdout() as stdout: self._cov... | def test_issue9936(self): tracer = trace.Trace(trace=0, count=1) modname = 'test.tracedmodules.testmod' # Ensure that the module is executed in import if modname in sys.modules: del sys.modules[modname] cmd = ("import test.tracedmodules.testmod as t;" "t.func(0); t.func2();") with captured_stdout() as stdout: self._cov... | 457,341 |
def test_ignored(self): jn = os.path.join ignore = trace.Ignore(['x', 'y.z'], [jn('foo', 'bar')]) self.assertTrue(ignore.names('x.py', 'x')) self.assertFalse(ignore.names('xy.py', 'xy')) self.assertFalse(ignore.names('y.py', 'y')) self.assertTrue(ignore.names(jn('foo', 'bar', 'baz.py'), 'baz')) self.assertFalse(ignore.... | def test_ignored(self): jn = os.path.join ignore = trace._Ignore(['x', 'y.z'], [jn('foo', 'bar')]) self.assertTrue(ignore.names('x.py', 'x')) self.assertFalse(ignore.names('xy.py', 'xy')) self.assertFalse(ignore.names('y.py', 'y')) self.assertTrue(ignore.names(jn('foo', 'bar', 'baz.py'), 'baz')) self.assertFalse(ignore... | 457,342 |
def _removeHandlerRef(wr): """ Remove a handler reference from the internal cleanup list. """ _acquireLock() try: if wr in _handlerList: _handlerList.remove(wr) finally: _releaseLock() | def _removeHandlerRef(wr): """ Remove a handler reference from the internal cleanup list. """ if _acquireLock is not None: _acquireLock() try: if wr in _handlerList: _handlerList.remove(wr) finally: _releaseLock() | 457,343 |
def shutdown(handlerList=_handlerList): """ Perform any cleanup actions in the logging system (e.g. flushing buffers). Should be called at application exit. """ for wr in reversed(handlerList[:]): #errors might occur, for example, if files are locked #we just ignore them if raiseExceptions is not set try: h = wr() h.f... | def shutdown(handlerList=_handlerList): """ Perform any cleanup actions in the logging system (e.g. flushing buffers). Should be called at application exit. """ for wr in reversed(handlerList[:]): #errors might occur, for example, if files are locked #we just ignore them if raiseExceptions is not set try: h = wr() if ... | 457,344 |
def test_forever(tests=list(selected)): while True: for test in tests: yield test if bad: return | def test_forever(tests=list(selected)): while True: for test in tests: yield test if bad: return | 457,345 |
def work(): # A worker thread. try: while True: try: test, args_tuple = next(pending) except StopIteration: output.put((None, None, None, None)) return # -E is needed by some tests, e.g. test_import popen = Popen([sys.executable, '-E', '-m', 'test.regrtest', '--slaveargs', json.dumps(args_tuple)], stdout=PIPE, stderr=P... | def work(): # A worker thread. try: while True: try: test, args_tuple = next(pending) except StopIteration: output.put((None, None, None, None)) return # -E is needed by some tests, e.g. test_import popen = Popen([sys.executable, '-E', '-m', 'test.regrtest', '--slaveargs', json.dumps(args_tuple)], stdout=PIPE, stderr=P... | 457,346 |
def work(): # A worker thread. try: while True: try: test, args_tuple = next(pending) except StopIteration: output.put((None, None, None, None)) return # -E is needed by some tests, e.g. test_import popen = Popen([sys.executable, '-E', '-m', 'test.regrtest', '--slaveargs', json.dumps(args_tuple)], stdout=PIPE, stderr=P... | def work(): # A worker thread. try: while True: try: test, args_tuple = next(pending) except StopIteration: output.put((None, None, None, None)) return # -E is needed by some tests, e.g. test_import popen = Popen([sys.executable, '-E', '-m', 'test.regrtest', '--slaveargs', json.dumps(args_tuple)], stdout=PIPE, stderr=P... | 457,347 |
def __long__(self): return -163L | def __long__(self): return -163L | 457,348 |
def __long__(self): return -163L | def __long__(self): return -163L | 457,349 |
def assertRaises(self, excClass, callableObj=None, *args, **kwargs): """Fail unless an exception of class excClass is thrown by callableObj when invoked with arguments args and keyword arguments kwargs. If a different type of exception is thrown, it will not be caught, and the test case will be deemed to have suffered ... | def assertRaises(self, excClass, callableObj=None, *args, **kwargs): """Fail unless an exception of class excClass is thrown by callableObj when invoked with arguments args and keyword arguments kwargs. If a different type of exception is thrown, it will not be caught, and the test case will be deemed to have suffered ... | 457,350 |
def threading_setup(): import thread return thread._count(), | def threading_setup(): if thread: return thread._count(), else: return 1, | 457,351 |
def threading_cleanup(nb_threads): import thread _MAX_COUNT = 10 for count in range(_MAX_COUNT): n = thread._count() if n == nb_threads: break time.sleep(0.1) # XXX print a warning in case of failure? | def threading_cleanup(nb_threads): if not thread: return _MAX_COUNT = 10 for count in range(_MAX_COUNT): n = thread._count() if n == nb_threads: break time.sleep(0.1) # XXX print a warning in case of failure? | 457,352 |
def test_main_invalid_unicode(self): import locale non_decodable = b"\xff" encoding = locale.getpreferredencoding() try: non_decodable.decode(encoding) except UnicodeDecodeError: pass else: self.skipTest('%r is decodable with encoding %s' % (non_decodable, encoding)) code = b'print("' + non_decodable + b'")' p = subpro... | def test_main_invalid_unicode(self): import locale non_decodable = b"\xff" encoding = locale.getpreferredencoding() try: non_decodable.decode(encoding) except UnicodeDecodeError: pass else: self.skipTest('%r is decodable with encoding %s' % (non_decodable, encoding)) code = b'print("' + non_decodable + b'")' p = subpro... | 457,353 |
def unlink(filename): try: os.unlink(filename) except OSError as error: # The filename need not exist. if error.errno != errno.ENOENT: raise | def unlink(filename): try: os.unlink(filename) except OSError as error: # The filename need not exist. if error.errno not in (errno.ENOENT, errno.ENOTDIR): raise | 457,354 |
def test_close(self): p = xmlrpclib.ServerProxy(URL) self.assertEqual(p('close')(), None) | def test_close(self): p = xmlrpclib.ServerProxy(self.url) self.assertEqual(p('close')(), None) | 457,355 |
def test_transport(self): t = xmlrpclib.Transport() p = xmlrpclib.ServerProxy(URL, transport=t) self.assertEqual(p('transport'), t) | def test_transport(self): t = xmlrpclib.Transport() p = xmlrpclib.ServerProxy(self.url, transport=t) self.assertEqual(p('transport'), t) | 457,356 |
def upload_file(self, command, pyversion, filename): # Sign if requested if self.sign: gpg_args = ["gpg", "--detach-sign", "-a", filename] if self.identity: gpg_args[2:2] = ["--local-user", self.identity] spawn(gpg_args, dry_run=self.dry_run) | def upload_file(self, command, pyversion, filename): # Sign if requested if self.sign: gpg_args = ["gpg", "--detach-sign", "-a", filename] if self.identity: gpg_args[2:2] = ["--local-user", self.identity] spawn(gpg_args, dry_run=self.dry_run) | 457,357 |
def main(args=None): """Compile several source files. The files named in 'args' (or on the command line, if 'args' is not specified) are compiled and the resulting bytecode is cached in the normal manner. This function does not search a directory structure to locate source files; it only compiles files named explicit... | def main(args=None): """Compile several source files. The files named in 'args' (or on the command line, if 'args' is not specified) are compiled and the resulting bytecode is cached in the normal manner. This function does not search a directory structure to locate source files; it only compiles files named explicit... | 457,358 |
def main(args=None): """Compile several source files. The files named in 'args' (or on the command line, if 'args' is not specified) are compiled and the resulting bytecode is cached in the normal manner. This function does not search a directory structure to locate source files; it only compiles files named explicit... | def main(args=None): """Compile several source files. The files named in 'args' (or on the command line, if 'args' is not specified) are compiled and the resulting bytecode is cached in the normal manner. This function does not search a directory structure to locate source files; it only compiles files named explicit... | 457,359 |
def _do_test_commandline(self, cmdline, expected): cmd = '"%s" -c "import sys;print sys.argv" %s' % (python, cmdline) data = os.popen(cmd).read() + '\n' got = eval(data)[1:] # strip off argv[0] self.assertEqual(got, expected) | def _do_test_commandline(self, cmdline, expected): cmd = '%s -c "import sys;print sys.argv" %s' % (python, cmdline) data = os.popen(cmd).read() + '\n' got = eval(data)[1:] # strip off argv[0] self.assertEqual(got, expected) | 457,360 |
def module_funcs(stdscr): "Test module-level functions" for func in [curses.baudrate, curses.beep, curses.can_change_color, curses.cbreak, curses.def_prog_mode, curses.doupdate, curses.filter, curses.flash, curses.flushinp, curses.has_colors, curses.has_ic, curses.has_il, curses.isendwin, curses.killchar, curses.longn... | def module_funcs(stdscr): "Test module-level functions" for func in [curses.baudrate, curses.beep, curses.can_change_color, curses.cbreak, curses.def_prog_mode, curses.doupdate, curses.filter, curses.flash, curses.flushinp, curses.has_colors, curses.has_ic, curses.has_il, curses.isendwin, curses.killchar, curses.longn... | 457,361 |
def test_issue4228(self): # Packing a long may yield either 32 or 64 bits with _check_py3k_warnings(("struct integer overflow masking is deprecated", DeprecationWarning)): x = struct.pack('L', -1)[:4] self.assertEqual(x, '\xff'*4) | def test_issue4228(self): # Packing a long may yield either 32 or 64 bits with _check_py3k_warnings(("struct integer overflow masking is deprecated", DeprecationWarning), quite=True): x = struct.pack('L', -1)[:4] self.assertEqual(x, '\xff'*4) | 457,362 |
def open(self, url, new=0, autoraise=True): assert "'" not in url # hack for local urls if not ':' in url: url = 'file:'+url | def open(self, url, new=0, autoraise=True): assert "'" not in url # hack for local urls if not ':' in url: url = 'file:'+url | 457,363 |
def testBufferOutputAddErrorOrFailure(self): for message_attr, add_attr, include_error in [ ('errors', 'addError', True), ('failures', 'addFailure', False), ('errors', 'addError', True), ('failures', 'addFailure', False) ]: result = self.getStartedResult() buffered_out = sys.stdout buffered_err = sys.stderr result._ori... | def testBufferOutputAddErrorOrFailure(self): for message_attr, add_attr, include_error in [ ('errors', 'addError', True), ('failures', 'addFailure', False), ('errors', 'addError', True), ('failures', 'addFailure', False) ]: result = self.getStartedResult() buffered_out = sys.stdout buffered_err = sys.stderr result._ori... | 457,364 |
def test_returns_new_copy(self): val = self.marshal(b'1234') # On immutable types these MAY return a reference to themselves # but on mutable types like bytearray they MUST return a new copy. for methname in ('zfill', 'rjust', 'ljust', 'center'): method = getattr(val, methname) newval = method(3) self.assertEqual(val, ... | deffor expr in ('val.split()[0]', 'val.rsplit()[0]', 'val.partition(".")[0]', 'val.rpartition(".")[2]', 'val.splitlines()[0]', 'val.replace("", "")'): newval = eval(expr) self.assertEqual(val, newval) self.assertTrue(val is not newval, expr+' returned val on a mutable object') test_returns_new_copy(self):for expr in ('... | 457,365 |
def _escapeAndEncode(text): m = _controlCharPat.search(text) if m is not None: raise ValueError("strings can't contains control characters; " "use plistlib.Data instead") text = text.replace("\r\n", "\n") # convert DOS line endings text = text.replace("\r", "\n") # convert Mac line endings text = text.rep... | def _escapeAndEncode(text): m = _controlCharPat.search(text) if m is not None: raise ValueError("strings can't contains control characters; " "use plistlib.Data instead") text = text.replace("\r\n", "\n") # convert DOS line endings text = text.replace("\r", "\n") # convert Mac line endings text = text.rep... | 457,366 |
def _convert_for_comparison(self, other, equality_op=False): """Given a Decimal instance self and a Python object other, return an pair (s, o) of Decimal instances such that "s op o" is equivalent to "self op other" for any of the 6 comparison operators "op". """ if isinstance(other, Decimal): return self, other # Co... | def _convert_for_comparison(self, other, equality_op=False): """Given a Decimal instance self and a Python object other, return a pair (s, o) of Decimal instances such that "s op o" is equivalent to "self op other" for any of the 6 comparison operators "op". """ if isinstance(other, Decimal): return self, other # Com... | 457,367 |
def delx(self): del self.__x | def delx(self): del self.__x | 457,368 |
def _fixup_command(self, cmd): # When Python was build with --enable-shared, -L. is not good enough # to find the libpython<blah>.so. This is because regrtest runs it # under a tempdir, not in the top level where the .so lives. By the # time we've gotten here, Python's already been chdir'd to the # tempdir. # # To fu... | def _fixup_command(self, cmd): # When Python was build with --enable-shared, -L. is not good enough # to find the libpython<blah>.so. This is because regrtest runs it # under a tempdir, not in the top level where the .so lives. By the # time we've gotten here, Python's already been chdir'd to the # tempdir. # # To fu... | 457,369 |
def _kill_with_event(self, event, name): tagname = "test_os_%s" % uuid.uuid1() m = mmap.mmap(-1, 1, tagname) m[0] = 0 # Run a script which has console control handling enabled. proc = subprocess.Popen([sys.executable, os.path.join(os.path.dirname(__file__), "win_console_handler.py"), tagname], creationflags=subprocess.... | def _kill_with_event(self, event, name): tagname = "test_os_%s" % uuid.uuid1() m = mmap.mmap(-1, 1, tagname) m[0] = 0 # Run a script which has console control handling enabled. proc = subprocess.Popen([sys.executable, os.path.join(os.path.dirname(__file__), "win_console_handler.py"), tagname], creationflags=subprocess.... | 457,370 |
def close(self): self.sync() try: self.dict.close() except AttributeError: pass self.dict = _ClosedDict() | def close(self): self.sync() try: self.dict.close() except AttributeError: pass self.dict = _ClosedDict() | 457,371 |
def print_window(self, event): m = tkMessageBox.Message( title="Print", message="Print to Default Printer", icon=tkMessageBox.QUESTION, type=tkMessageBox.OKCANCEL, default=tkMessageBox.OK, master=self.text) reply = m.show() if reply != tkMessageBox.OK: self.text.focus_set() return "break" tempfilename = None saved = se... | def print_window(self, event): m = tkMessageBox.Message( title="Print", message="Print to Default Printer", icon=tkMessageBox.QUESTION, type=tkMessageBox.OKCANCEL, default=tkMessageBox.OK, master=self.text) reply = m.show() if reply != tkMessageBox.OK: self.text.focus_set() return "break" tempfilename = None saved = se... | 457,372 |
def elementKey(element): """to be used in sort() and sorted() as key=. Sort by tile type, value, case""" aPos = chr('xdwsbcfy'.index(element[0].lower()) + ord('0')) bPos = element[1].lower() if bPos in 'wfs': bPos = chr('eswn'.index(bPos) + ord('0')) # add element: upper/lowercase should have a defined order too return... | def elementKey(element): """to be used in sort() and sorted() as key=. Sort by tile type, value, case. element can also be a meld from the summary.""" group = element[0].lower() aPos = chr('xdwsbcfy'.index(group) + ord('0')) bPos = element[1].lower() if bPos in 'wfs': bPos = chr('eswn'.index(bPos) + ord('0')) # add ele... | 457,373 |
def elementKey(element): """to be used in sort() and sorted() as key=. Sort by tile type, value, case""" aPos = chr('xdwsbcfy'.index(element[0].lower()) + ord('0')) bPos = element[1].lower() if bPos in 'wfs': bPos = chr('eswn'.index(bPos) + ord('0')) # add element: upper/lowercase should have a defined order too return... | def elementKey(element): """to be used in sort() and sorted() as key=. Sort by tile type, value, case""" aPos = chr('xdwsbcfy'.index(element[0].lower()) + ord('0')) bPos = element[1].lower() if group in 'wfy' and bPos in 'eswn': bPos = chr('eswn'.index(bPos) + ord('0')) # add element: upper/lowercase should have a defi... | 457,374 |
def i18nc(dummyContext, englishIn, *args): """dummy for server""" return i18n(englishIn, *args) | def i18nc(dummyContext, englishIn, *args): """dummy for server""" return i18n(englishIn, *args) | 457,375 |
def appdataDir(): """the per user directory with kajongg application information like the database""" path = os.path.expanduser('~/.kde/share/apps/kajongg/') if not os.path.exists(path): os.makedirs(path) return path | def appdataDir(): """the per user directory with kajongg application information like the database""" return os.path.dirname(str(KGlobal.dirs().locateLocal("appdata", "kajongg.db"))) + '/' except ImportError: def appdataDir(): """the per user directory with kajongg application information like the database""" kdehome =... | 457,376 |
def appdataDir(): """the per user directory with kajongg application information like the database""" path = os.path.expanduser('~/.kde/share/apps/kajongg/') if not os.path.exists(path): os.makedirs(path) return path | def appdataDir(): """the per user directory with kajongg application information like the database""" path = os.path.expanduser('~/.kde/share/apps/kajongg/') if not os.path.exists(path): os.makedirs(path) return path | 457,377 |
def newTilePositions(self): """returns list(TileAttr). The tiles are not associated to any board.""" result = list() newUpperMelds = sorted(self.player.exposedMelds, key=meldKey) if self.player.concealedMelds: newLowerMelds = sorted(self.player.concealedMelds) else: tileStr = ''.join(self.player.concealedTileNames) con... | def newTilePositions(self): """returns list(TileAttr). The tiles are not associated to any board.""" result = list() newUpperMelds = self.player.exposedMelds[:] if self.player.game.isScoringGame(): newLowerMelds = self.player.concealedMelds[:] else: if self.player.concealedMelds: newLowerMelds = sorted(self.player.conc... | 457,378 |
def newTilePositions(self): """returns list(TileAttr). The tiles are not associated to any board.""" result = list() newUpperMelds = sorted(self.player.exposedMelds, key=meldKey) if self.player.concealedMelds: newLowerMelds = sorted(self.player.concealedMelds) else: tileStr = ''.join(self.player.concealedTileNames) con... | def newTilePositions(self): """returns list(TileAttr). The tiles are not associated to any board.""" result = list() newUpperMelds = sorted(self.player.exposedMelds, key=meldKey) if self.player.concealedMelds: newLowerMelds = sorted(self.player.concealedMelds) else: tileStr = ''.join(self.player.concealedTileNames) con... | 457,379 |
def newTilePositions(self): """returns list(TileAttr). The tiles are not associated to any board.""" result = list() newUpperMelds = sorted(self.player.exposedMelds, key=meldKey) if self.player.concealedMelds: newLowerMelds = sorted(self.player.concealedMelds) else: tileStr = ''.join(self.player.concealedTileNames) con... | def newTilePositions(self): """returns list(TileAttr). The tiles are not associated to any board.""" result = list() newUpperMelds = sorted(self.player.exposedMelds, key=meldKey) if self.player.concealedMelds: newLowerMelds = sorted(self.player.concealedMelds) else: tileStr = ''.join(self.player.concealedTileNames) con... | 457,380 |
def newTilePositions(self): """returns list(TileAttr). The tiles are not associated to any board.""" result = list() newUpperMelds = sorted(self.player.exposedMelds, key=meldKey) if self.player.concealedMelds: newLowerMelds = sorted(self.player.concealedMelds) else: tileStr = ''.join(self.player.concealedTileNames) con... | def newTilePositions(self): """returns list(TileAttr). The tiles are not associated to any board.""" result = list() newUpperMelds = sorted(self.player.exposedMelds, key=meldKey) if self.player.concealedMelds: newLowerMelds = sorted(self.player.concealedMelds) else: tileStr = ''.join(self.player.concealedTileNames) con... | 457,381 |
def calcPlaces(self, adding=None): """returns a dict. Keys are existing tiles, Values are TileAttr instances. Values may be None: This is a tile to be removed from the board.""" # TODO: this does not work for scoringGame with tiles like c3, c3, c3c4c5, # dump() will find wrong xoffsets. # we should do sync(addingTile,a... | def calcPlaces(self, adding=None): """returns a dict. Keys are existing tiles, Values are TileAttr instances. Values may be None: This is a tile to be removed from the board.""" # TODO: this does not work for scoringGame with tiles like c3, c3, c3c4c5, # dump() will find wrong xoffsets. # we should do sync(addingTile,a... | 457,382 |
def __setRuleData(column, content, value): """change rule data in the model""" # pylint: disable-msg=R0912 # allow more than 12 branches dirty = False if column == 0: name = str(value.toString()) if content.name != english(name): dirty = True content.name = english(name) elif column == 1: if content.parType: if conten... | def __setRuleData(column, content, value): """change rule data in the model""" # pylint: disable-msg=R0912 # allow more than 12 branches dirty = False if column == 0: name = str(value.toString()) if content.name != english(name): dirty = True content.name = english(name) elif column == 1: if content.parType: if conten... | 457,383 |
def setData(self, index, value, role=Qt.EditRole): """change data in the model""" # pylint: disable-msg=R0912 # allow more than 12 branches if not index.isValid(): return False try: dirty = False column = index.column() item = index.internalPointer() ruleset = item.ruleset() content = item.rawContent print 'setData:',... | def setData(self, index, value, role=Qt.EditRole): """change data in the model""" # pylint: disable-msg=R0912 # allow more than 12 branches if not index.isValid(): return False try: dirty = False column = index.column() item = index.internalPointer() ruleset = item.ruleset() content = item.rawContent if role == Qt.Edi... | 457,384 |
def setModelData(self, editor, model, index): """move changes into model""" print 'setModelData:', index.column() column = index.column() if column == 2: item = index.internalPointer() rule = item.rawContent assert isinstance(rule, Rule) print 'unit:', rule.score.unit, editor.currentIndex() if rule.score.unit != editor... | def setModelData(self, editor, model, index): """move changes into model""" column = index.column() if column == 2: item = index.internalPointer() rule = item.rawContent assert isinstance(rule, Rule) print 'unit:', rule.score.unit, editor.currentIndex() if rule.score.unit != editor.currentIndex(): rule.score.unit = edi... | 457,385 |
def setModelData(self, editor, model, index): """move changes into model""" print 'setModelData:', index.column() column = index.column() if column == 2: item = index.internalPointer() rule = item.rawContent assert isinstance(rule, Rule) print 'unit:', rule.score.unit, editor.currentIndex() if rule.score.unit != editor... | def setModelData(self, editor, model, index): """move changes into model""" print 'setModelData:', index.column() column = index.column() if column == 2: item = index.internalPointer() rule = item.rawContent assert isinstance(rule, Rule) if rule.score.unit != editor.currentIndex(): rule.score.unit = editor.currentIndex... | 457,386 |
def setModelData(self, editor, model, index): """move changes into model""" print 'setModelData:', index.column() column = index.column() if column == 2: item = index.internalPointer() rule = item.rawContent assert isinstance(rule, Rule) print 'unit:', rule.score.unit, editor.currentIndex() if rule.score.unit != editor... | def setModelData(self, editor, model, index): """move changes into model""" print 'setModelData:', index.column() column = index.column() if column == 2: item = index.internalPointer() rule = item.rawContent assert isinstance(rule, Rule) print 'unit:', rule.score.unit, editor.currentIndex() if rule.score.unit != editor... | 457,387 |
def m18n(englishText, *args): """wrapper around i18n converting QString into a Python unicode string""" try: if isinstance(englishText, unicode): englishText = englishText.encode('utf-8') result = unicode(i18n(englishText, *args)) if not args: if result != englishText: ENGLISHDICT[result] = englishText return result e... | def m18n(englishText, *args): """wrapper around i18n converting QString into a Python unicode string""" try: if isinstance(englishText, unicode): englishText = englishText.encode('utf-8') result = unicode(i18n(englishText, *args)) if not args: if result != englishText: ENGLISHDICT[result] = englishText return result e... | 457,388 |
def __init__(self, ruleset, string, rules=None): """evaluate string using ruleset. rules are to be applied in any case.""" self.ruleset = ruleset self.string = string self.rules = [] for rule in rules or []: if not isinstance(rule, Rule): rule = ruleset.findManualRuleByName(rule) self.rules.append(rule) self.original =... | def __init__(self, ruleset, string, rules=None): """evaluate string using ruleset. rules are to be applied in any case.""" self.ruleset = ruleset self.string = string self.rules = [] for rule in rules or []: if not isinstance(rule, Rule): rule = ruleset.findManualRuleByName(rule) self.rules.append(rule) self.original =... | 457,389 |
def timeout(self): """we should not need this...""" print '************animations timeout', id(self), 'remaining:', self.pending self.pending = 1 self.animationFinished() | def timeout(self): """If we define a property animation on a property which already has a running animation, the old animation is aborted and never sends the finished() signal. Test this with a scoring game, rapidly moving tiles from hand to hand by using the keyboard.""" self.pending = 1 self.animationFinished() | 457,390 |
def syncHandBoard(self, tileName=None): """update display of handBoard""" myBoard = self.handBoard myBoard.clear() for meld in self.exposedMelds: myBoard.receive(meld.pairs, None, False) for tile in self.bonusTiles: myBoard.receive(tile, None, False) if self.concealedMelds: # hand has ended for meld in self.concealedMe... | def syncHandBoard(self, tileName=None): """update display of handBoard. Set Focus to tileName.""" myBoard = self.handBoard myBoard.clear() for meld in self.exposedMelds: myBoard.receive(meld.pairs, None, False) for tile in self.bonusTiles: myBoard.receive(tile, None, False) if self.concealedMelds: # hand has ended for ... | 457,391 |
def validate(self, inputData, pos): result, newPos = QSpinBox.validate(self, inputData, pos) if result == QValidator.Acceptable: if int(input) % self.parties != 0: result = QValidator.Intermediate return (result, newPos) | def validate(self, inputData, pos): result, newPos = QSpinBox.validate(self, inputData, pos) if result == QValidator.Acceptable: if int(inputData) % self.parties != 0: result = QValidator.Intermediate return (result, newPos) | 457,392 |
def fset(self, state): if state == EXPOSED: self.__pairs.toLower() if self.meldType == CLAIMEDKONG: self.__pairs[3].toUpper() elif state == CONCEALED: self.__pairs.toUpper() if len(self.__pairs) == 4: self.__pairs.toLower(0) self.__pairs.toLower(3) else: raise Exception('meld.setState: illegal state %d' % state) for id... | def fset(self, state): if state == EXPOSED: self.__pairs.toLower() if self.meldType == CLAIMEDKONG: self.__pairs.toUpper(3) elif state == CONCEALED: self.__pairs.toUpper() if len(self.__pairs) == 4: self.__pairs.toLower(0) self.__pairs.toLower(3) else: raise Exception('meld.setState: illegal state %d' % state) for idx,... | 457,393 |
def __init__(self): if util.PREF: logException(Exception('PREF is not None')) util.PREF = self KConfigSkeleton.__init__(self) self.addString('General', 'tilesetName', 'default') self.addString('General', 'windTilesetName', 'traditional') self.addString('General', 'backgroundName', 'default') self.addBool('Network', 'au... | def __init__(self): if util.PREF: logException(Exception('PREF is not None')) util.PREF = self KConfigSkeleton.__init__(self) self.addString('General', 'tilesetName', 'default') self.addString('General', 'windTilesetName', 'traditional') self.addString('General', 'backgroundName', 'default') self.addInteger('Network', ... | 457,394 |
def __init__(self): if util.PREF: logException(Exception('PREF is not None')) util.PREF = self KConfigSkeleton.__init__(self) self.addString('General', 'tilesetName', 'default') self.addString('General', 'windTilesetName', 'traditional') self.addString('General', 'backgroundName', 'default') self.addBool('Network', 'au... | def __init__(self): if util.PREF: logException(Exception('PREF is not None')) util.PREF = self KConfigSkeleton.__init__(self) self.addString('General', 'tilesetName', 'default') self.addString('General', 'windTilesetName', 'traditional') self.addString('General', 'backgroundName', 'default') self.addBool('Network', 'au... | 457,395 |
def __getattr__(self, name): """undefined attributes might be parameters""" if not name in Preferences._Parameters: raise AttributeError par = Preferences._Parameters[name] return par.itemValue() return result | def __getattr__(self, name): """undefined attributes might be parameters""" if not name in Preferences._Parameters: raise AttributeError par = Preferences._Parameters[name] return par.itemValue() return result | 457,396 |
def computeLastMeld(self, lastTile): """returns the best last meld for lastTile""" lastMelds = [x for x in self.hiddenMelds if lastTile in x.pairs] if not lastMelds: if not self.hiddenMelds: raise Exception('lastMeld: no hidden melds') raise Exception('lastTile %s not in any hidden meld %s' % \ (lastTile, ' '.join(x.j... | def computeLastMeld(self, lastTile): """returns the best last meld for lastTile""" if lastTile[0].isupper(): checkMelds = self.hiddenMelds else: checkMelds = self.declaredMelds checkMelds = [x for x in checkMelds if len(x) < 4] lastMelds = [x for x in checkMelds if lastTile in x.pairs] assert lastMelds lastMeld = lastM... | 457,397 |
def addUser(self, user): """add user to this table""" if user.name in list(x.name for x in self.users): raise srvError(pb.Error, m18nE('You already joined this table')) if len(self.users) == 4: raise srvError(pb.Error, m18nE('All seats are already taken')) self.users.append(user) if len(self.users) == 4: self.readyForG... | def addUser(self, user): """add user to this table""" if user.name in list(x.name for x in self.users): raise srvError(pb.Error, m18nE('You already joined this table')) if len(self.users) == 4: raise srvError(pb.Error, m18nE('All seats are already taken')) self.users.append(user) if len(self.users) == 4: self.readyForG... | 457,398 |
def __init__(self): if util.PREF: logException(Exception('PREF is not None')) util.PREF = self KConfigSkeleton.__init__(self) self.addString('General', 'tilesetName', 'default') self.addString('General', 'windTilesetName', 'traditional') self.addString('General', 'backgroundName', 'default') self.addBool('General', 'de... | def __init__(self): if util.PREF: logException(Exception('PREF is not None')) util.PREF = self KConfigSkeleton.__init__(self) self.addString('General', 'tilesetName', 'default') self.addString('General', 'windTilesetName', 'traditional') self.addString('General', 'backgroundName', 'default') self.addBool('General', 'de... | 457,399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.