MCPcopy Index your code
hub / github.com/python/cpython / ispythonsource

Method ispythonsource

Lib/idlelib/editor.py:756–763  ·  view source on GitHub ↗
(self, filename)

Source from the content-addressed store, hash-verified

754 self.center()
755
756 def ispythonsource(self, filename):
757 if not filename or os.path.isdir(filename):
758 return True
759 base, ext = os.path.splitext(os.path.basename(filename))
760 if os.path.normcase(ext) in py_extensions:
761 return True
762 line = self.text.get('1.0', '1.0 lineend')
763 return line.startswith('#!') and 'python' in line
764
765 def close_hook(self):
766 if self.flist:

Callers 2

__init__Method · 0.95
_addcolorizerMethod · 0.95

Calls 6

splitextMethod · 0.80
normcaseMethod · 0.80
isdirMethod · 0.45
basenameMethod · 0.45
getMethod · 0.45
startswithMethod · 0.45

Tested by

no test coverage detected