@@ -205,6 +205,12 @@ class Type(object):
205205 "is_filesystem" ,
206206 "is_java_class" ,
207207 "is_java_source" ,
208+ "is_julia_source" ,
209+ "is_python_source" ,
210+ "is_javascript_source" ,
211+ "is_cpp_source" ,
212+ "is_rust_source" ,
213+ "is_go_source" ,
208214 "is_media" ,
209215 "is_media_with_meta" ,
210216 "is_office_doc" ,
@@ -743,7 +749,17 @@ def is_source(self):
743749 return False
744750
745751 # Recognize "known-by-extension" source types
746- elif self .is_java_source or self .is_c_source or self .is_julia_source :
752+ elif (
753+ self .is_java_source or
754+ self .is_c_source or
755+ self .is_julia_source or
756+ self .is_python_source or
757+ self .is_javascript_source or
758+ self .is_cpp_source or
759+ self .is_rust_source or
760+ self .is_go_source
761+
762+ ):
747763 return True
748764
749765 elif self .filetype_pygment or self .is_script is True :
@@ -772,6 +788,26 @@ def is_julia_source(self):
772788 """
773789 return self .is_file and self .location .lower ().endswith (".jl" )
774790
791+ @property
792+ def is_python_source (self ):
793+ return self .is_file and self .file_name .lower ().endswith (('.py' , '.pyw' ))
794+
795+ @property
796+ def is_javascript_source (self ):
797+ return self .is_file and self .file_name .lower ().endswith (('.js' , '.mjs' ))
798+
799+ @property
800+ def is_cpp_source (self ):
801+ return self .is_file and self .file_name .lower ().endswith (('.cpp' , '.cc' , '.cxx' , '.hpp' ))
802+
803+ @property
804+ def is_rust_source (self ):
805+ return self .is_file and self .file_name .lower ().endswith ('.rs' )
806+
807+ @property
808+ def is_go_source (self ):
809+ return self .is_file and self .file_name .lower ().endswith ('.go' )
810+
775811 @property
776812 def is_c_source (self ):
777813 C_EXTENSIONS = set (
0 commit comments