mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	Silence (Syntax|Deprecation)Warning for 'inspect'. Had to remove tuple
unpacking in a parameter list and set some constants by hand that were pulled from the 'compiler' package.
This commit is contained in:
		
							parent
							
								
									c6a30ecf7a
								
							
						
					
					
						commit
						f5eb2ff100
					
				
					 1 changed files with 9 additions and 5 deletions
				
			
		|  | @ -41,9 +41,10 @@ | ||||||
| from abc import ABCMeta | from abc import ABCMeta | ||||||
| from operator import attrgetter | from operator import attrgetter | ||||||
| from collections import namedtuple | from collections import namedtuple | ||||||
| from compiler.consts import (CO_OPTIMIZED, CO_NEWLOCALS, CO_VARARGS, |  | ||||||
|     CO_VARKEYWORDS, CO_GENERATOR) |  | ||||||
| 
 | 
 | ||||||
|  | # These constants are from Include/code.h. | ||||||
|  | CO_OPTIMIZED, CO_NEWLOCALS, CO_VARARGS, CO_VARKEYWORDS = 0x1, 0x2, 0x4, 0x8 | ||||||
|  | CO_NESTED, CO_GENERATOR, CO_NOFREE = 0x10, 0x20, 0x40 | ||||||
| # See Include/object.h | # See Include/object.h | ||||||
| TPFLAGS_IS_ABSTRACT = 1 << 20 | TPFLAGS_IS_ABSTRACT = 1 << 20 | ||||||
| 
 | 
 | ||||||
|  | @ -428,8 +429,9 @@ def getfile(object): | ||||||
| def getmoduleinfo(path): | def getmoduleinfo(path): | ||||||
|     """Get the module name, suffix, mode, and module type for a given file.""" |     """Get the module name, suffix, mode, and module type for a given file.""" | ||||||
|     filename = os.path.basename(path) |     filename = os.path.basename(path) | ||||||
|     suffixes = map(lambda (suffix, mode, mtype): |     suffixes = map(lambda info: | ||||||
|                    (-len(suffix), suffix, mode, mtype), imp.get_suffixes()) |                    (-len(info[0]), info[0], info[1], info[2]), | ||||||
|  |                     imp.get_suffixes()) | ||||||
|     suffixes.sort() # try longest suffixes first, in case they overlap |     suffixes.sort() # try longest suffixes first, in case they overlap | ||||||
|     for neglen, suffix, mode, mtype in suffixes: |     for neglen, suffix, mode, mtype in suffixes: | ||||||
|         if filename[neglen:] == suffix: |         if filename[neglen:] == suffix: | ||||||
|  | @ -630,7 +632,9 @@ def __init__(self): | ||||||
|         self.passline = False |         self.passline = False | ||||||
|         self.last = 1 |         self.last = 1 | ||||||
| 
 | 
 | ||||||
|     def tokeneater(self, type, token, (srow, scol), (erow, ecol), line): |     def tokeneater(self, type, token, srow_scol, erow_ecol, line): | ||||||
|  |         srow, scol = srow_scol | ||||||
|  |         erow, ecol = erow_ecol | ||||||
|         if not self.started: |         if not self.started: | ||||||
|             # look for the first "def", "class" or "lambda" |             # look for the first "def", "class" or "lambda" | ||||||
|             if token in ("def", "class", "lambda"): |             if token in ("def", "class", "lambda"): | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Brett Cannon
						Brett Cannon