Lichen

Change of lib/__builtins__/file.py

356:8327049267bf
lib/__builtins__/file.py
     1.1 --- a/lib/__builtins__/file.py	Fri Dec 09 16:26:50 2016 +0100
     1.2 +++ b/lib/__builtins__/file.py	Fri Dec 09 17:27:30 2016 +0100
     1.3 @@ -20,7 +20,7 @@
     1.4  """
     1.5  
     1.6  from __builtins__.types import check_int, check_string
     1.7 -import native
     1.8 +from native import fclose, fopen, fread, fwrite
     1.9  
    1.10  class filestream:
    1.11  
    1.12 @@ -42,7 +42,7 @@
    1.13          # Read any indicated number of bytes.
    1.14  
    1.15          if n > 0:
    1.16 -            return native.fread(self.__data__, n)
    1.17 +            return fread(self.__data__, n)
    1.18  
    1.19          # Read all remaining bytes.
    1.20  
    1.21 @@ -53,7 +53,7 @@
    1.22  
    1.23              try:
    1.24                  while True:
    1.25 -                    l.append(native.fread(self.__data__, self.bufsize))
    1.26 +                    l.append(fread(self.__data__, self.bufsize))
    1.27  
    1.28              # Handle end-of-file reads.
    1.29  
    1.30 @@ -67,13 +67,13 @@
    1.31          "Write string 's' to the stream."
    1.32  
    1.33          check_string(s)
    1.34 -        native.fwrite(self.__data__, s)
    1.35 +        fwrite(self.__data__, s)
    1.36  
    1.37      def close(self):
    1.38  
    1.39          "Close the stream."
    1.40  
    1.41 -        native.fclose(self.__data__)
    1.42 +        fclose(self.__data__)
    1.43  
    1.44  class file(filestream):
    1.45  
    1.46 @@ -84,7 +84,7 @@
    1.47          "Open the file with the given 'filename' using the given access 'mode'."
    1.48  
    1.49          get_using(filestream.__init__, self)(bufsize)
    1.50 -        self.__data__ = native.fopen(filename, mode)
    1.51 +        self.__data__ = fopen(filename, mode)
    1.52  
    1.53      def readline(self, size=None): pass
    1.54      def readlines(self, size=None): pass