(self, fname)
| 1006 | res = ((res * 227 + 1) ^ hash(line)) & 0x3fffffff |
| 1007 | return res |
| 1008 | def get_file(self, fname): |
| 1009 | if fname: |
| 1010 | try: |
| 1011 | self.fname = fname |
| 1012 | if fname in ('.', '..') or (os.stat(fname)[0] & 0x4000): |
| 1013 | os.chdir(fname) |
| 1014 | self.work_dir = os.getcwd() |
| 1015 | self.fname = "/" if self.work_dir == "/" else self.work_dir.split("/")[-1] |
| 1016 | self.content = ["Directory '{}'".format(self.work_dir), ""] + sorted(os.listdir('.')) |
| 1017 | self.is_dir = True |
| 1018 | else: |
| 1019 | if is_micropython: |
| 1020 | with open(fname) as f: |
| 1021 | self.content = f.readlines() |
| 1022 | else: |
| 1023 | with open(fname, errors="ignore") as f: |
| 1024 | self.content = f.readlines() |
| 1025 | self.write_tabs = False |
| 1026 | i = 0 |
| 1027 | for l in self.content: |
| 1028 | self.content[i] = self.expandtabs(l.rstrip()) |
| 1029 | i += 1 |
| 1030 | except OSError: |
| 1031 | self.message = "Error: file '" + fname + "' may not exist" |
| 1032 | self.hash = self.hash_buffer() |
| 1033 | def put_file(self, fname): |
| 1034 | tmpfile = fname + ".pyetmp" |
| 1035 | with open(tmpfile, "w") as f: |
no test coverage detected