<commit_before>import sys
import os
import java.lang.System
import imp
from Screen import Screen

def _stripPackagePrefix(module_name):
   pdot = module_name.rfind('.')
   if pdot >= 0:
      return module_name[pdot+1:]
   return module_name

class SikuliImporter:

   class SikuliLoader:
      def __init__(self, path):
         self.path = path

      def _load_module(self, fullname):
         (file, pathname, desc) =  imp.find_module(fullname)
         try:
            return imp.load_module(fullname, file, pathname, desc)
         except Exception,e:
            raise ImportError( "Errors in loading sikuli module: %s\nYou may need to add \"from sikuli.Sikuli import *\" in the module.\n%s" %(fullname, e) )
         finally:
            if file:
               file.close()

      def load_module(self, module_name):
         #print "SikuliLoader.load_module", module_name
         module_name = _stripPackagePrefix(module_name)
         sys.path.append(self.path)
         img_path = java.lang.System.getProperty("SIKULI_IMAGE_PATH")
         if not img_path:
            img_path = ""
         elif img_path[-1] != ':' or img_path[-1] != ';':
            img_path += ':'
         img_path += self.path
         java.lang.System.setProperty("SIKULI_IMAGE_PATH", img_path)
         return self._load_module(module_name)

   def _find_module(self, module_name, fullpath):
      fullpath = fullpath + "/" + module_name + ".sikuli"
      if os.path.exists(fullpath):
         #print "SikuliImporter found", fullpath
         return self.SikuliLoader(fullpath)
      return None

   def find_module(self, module_name, package_path):
      #print "SikuliImporter.find_module", module_name, package_path
      module_name = _stripPackagePrefix(module_name)
      if package_path:
         paths = package_path
      else:
         paths = sys.path
         paths.append(".")
      for path in paths:
         mod = self._find_module(module_name, path)
         if mod:
            return mod
      return None


sys.meta_path.append(SikuliImporter())
del SikuliImporter<commit_msg>don't append '.' into sys.path everytime in import<commit_after>import sys
import os
import java.lang.System
import imp
from Screen import Screen

def _stripPackagePrefix(module_name):
   pdot = module_name.rfind('.')
   if pdot >= 0:
      return module_name[pdot+1:]
   return module_name

class SikuliImporter:

   class SikuliLoader:
      def __init__(self, path):
         self.path = path

      def _load_module(self, fullname):
         (file, pathname, desc) =  imp.find_module(fullname)
         try:
            return imp.load_module(fullname, file, pathname, desc)
         except Exception,e:
            raise ImportError( "Errors in loading sikuli module: %s\nYou may need to add \"from sikuli.Sikuli import *\" in the module.\n%s" %(fullname, e) )
         finally:
            if file:
               file.close()

      def load_module(self, module_name):
         #print "SikuliLoader.load_module", module_name
         module_name = _stripPackagePrefix(module_name)
         sys.path.append(self.path)
         img_path = java.lang.System.getProperty("SIKULI_IMAGE_PATH")
         if not img_path:
            img_path = ""
         elif img_path[-1] != ':' or img_path[-1] != ';':
            img_path += ':'
         img_path += self.path
         java.lang.System.setProperty("SIKULI_IMAGE_PATH", img_path)
         return self._load_module(module_name)

   def _find_module(self, module_name, fullpath):
      fullpath = fullpath + "/" + module_name + ".sikuli"
      if os.path.exists(fullpath):
         #print "SikuliImporter found", fullpath
         return self.SikuliLoader(fullpath)
      return None

   def find_module(self, module_name, package_path):
      #print "SikuliImporter.find_module", module_name, package_path
      module_name = _stripPackagePrefix(module_name)
      if package_path:
         paths = package_path
      else:
         paths = sys.path
         if not "." in paths:
            paths.append(".")
      for path in paths:
         mod = self._find_module(module_name, path)
         if mod:
            return mod
      return None


sys.meta_path.append(SikuliImporter())
del SikuliImporter
{'fraction_non_alphanumeric': 0.09929245283018868, 'fraction_numerical': 0.0018867924528301887, 'mean_word_length': 2.476229508196721, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4437240', 'n_tokens_mistral': 1321, 'n_tokens_neox': 1308, 'n_words': 307}