##// END OF EJS Templates
rename py3compat.getcwd() -> os.getcwd()
Srinivas Reddy Thatiparthy -
Show More
@@ -126,7 +126,7 b' class BaseIPythonApplication(Application):'
126 126 config_file_paths = List(Unicode())
127 127 @default('config_file_paths')
128 128 def _config_file_paths_default(self):
129 return [py3compat.getcwd()]
129 return [os.getcwd()]
130 130
131 131 extra_config_file = Unicode(
132 132 help="""Path to an extra config file to load.
@@ -215,7 +215,7 b' class BaseIPythonApplication(Application):'
215 215 super(BaseIPythonApplication, self).__init__(**kwargs)
216 216 # ensure current working directory exists
217 217 try:
218 py3compat.getcwd()
218 os.getcwd()
219 219 except:
220 220 # exit if cwd doesn't exist
221 221 self.log.error("Current working directory doesn't exist.")
@@ -487,7 +487,7 b' class HistoryManager(HistoryAccessor):'
487 487 @default('dir_hist')
488 488 def _dir_hist_default(self):
489 489 try:
490 return [py3compat.getcwd()]
490 return [os.getcwd()]
491 491 except OSError:
492 492 return []
493 493
@@ -593,7 +593,7 b' class HistoryManager(HistoryAccessor):'
593 593 optionally open a new session."""
594 594 self.output_hist.clear()
595 595 # The directory history can't be completely empty
596 self.dir_hist[:] = [py3compat.getcwd()]
596 self.dir_hist[:] = [os.getcwd()]
597 597
598 598 if new_session:
599 599 if self.session_number:
@@ -549,7 +549,7 b' class InteractiveShell(SingletonConfigurable):'
549 549
550 550 # keep track of where we started running (mainly for crash post-mortem)
551 551 # This is not being used anywhere currently.
552 self.starting_dir = py3compat.getcwd()
552 self.starting_dir = os.getcwd()
553 553
554 554 # Indentation management
555 555 self.indent_current_nsp = 0
@@ -177,7 +177,7 b' class OSMagics(Magics):'
177 177 winext += '|py'
178 178 execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
179 179 isexec = lambda fname:os.path.isfile(fname) and execre.match(fname)
180 savedir = py3compat.getcwd()
180 savedir = os.getcwd()
181 181
182 182 # Now walk the paths looking for executables to alias.
183 183 try:
@@ -239,7 +239,7 b' class OSMagics(Magics):'
239 239 In [9]: pwd
240 240 Out[9]: '/home/tsuser/sprint/ipython'
241 241 """
242 return py3compat.getcwd()
242 return os.getcwd()
243 243
244 244 @skip_doctest
245 245 @line_magic
@@ -283,7 +283,7 b' class OSMagics(Magics):'
283 283 /home/tsuser/parent/child
284 284 """
285 285
286 oldcwd = py3compat.getcwd()
286 oldcwd = os.getcwd()
287 287 numcd = re.match(r'(-)(\d+)$',parameter_s)
288 288 # jump in directory history by number
289 289 if numcd:
@@ -351,7 +351,7 b' class OSMagics(Magics):'
351 351 except OSError:
352 352 print(sys.exc_info()[1])
353 353 else:
354 cwd = py3compat.getcwd()
354 cwd = os.getcwd()
355 355 dhist = self.shell.user_ns['_dh']
356 356 if oldcwd != cwd:
357 357 dhist.append(cwd)
@@ -361,7 +361,7 b' class OSMagics(Magics):'
361 361 os.chdir(self.shell.home_dir)
362 362 if hasattr(self.shell, 'term_title') and self.shell.term_title:
363 363 set_term_title('IPython: ' + '~')
364 cwd = py3compat.getcwd()
364 cwd = os.getcwd()
365 365 dhist = self.shell.user_ns['_dh']
366 366
367 367 if oldcwd != cwd:
@@ -436,7 +436,7 b' class OSMagics(Magics):'
436 436
437 437 dir_s = self.shell.dir_stack
438 438 tgt = os.path.expanduser(parameter_s)
439 cwd = py3compat.getcwd().replace(self.shell.home_dir,'~')
439 cwd = os.getcwd().replace(self.shell.home_dir,'~')
440 440 if tgt:
441 441 self.cd(parameter_s)
442 442 dir_s.insert(0,cwd)
@@ -724,7 +724,7 b' class OSMagics(Magics):'
724 724 if not args:
725 725 raise UsageError("%bookmark: You must specify the bookmark name")
726 726 elif len(args)==1:
727 bkms[args[0]] = py3compat.getcwd()
727 bkms[args[0]] = os.getcwd()
728 728 elif len(args)==2:
729 729 bkms[args[0]] = args[1]
730 730 self.shell.db['bookmarks'] = bkms
@@ -180,10 +180,10 b' class ProfileList(Application):'
180 180 print("Available profiles in %s:" % self.ipython_dir)
181 181 self._print_profiles(profiles)
182 182
183 profiles = list_profiles_in(py3compat.getcwd())
183 profiles = list_profiles_in(os.getcwd())
184 184 if profiles:
185 185 print()
186 print("Available profiles in current directory (%s):" % py3compat.getcwd())
186 print("Available profiles in current directory (%s):" % os.getcwd())
187 187 self._print_profiles(profiles)
188 188
189 189 print()
@@ -187,7 +187,7 b' class ProfileDir(LoggingConfigurable):'
187 187 is not found, a :class:`ProfileDirError` exception will be raised.
188 188
189 189 The search path algorithm is:
190 1. ``py3compat.getcwd()``
190 1. ``os.getcwd()``
191 191 2. ``ipython_dir``
192 192
193 193 Parameters
@@ -199,7 +199,7 b' class ProfileDir(LoggingConfigurable):'
199 199 will be "profile_<profile>".
200 200 """
201 201 dirname = u'profile_' + name
202 paths = [py3compat.getcwd(), ipython_dir]
202 paths = [os.getcwd(), ipython_dir]
203 203 for p in paths:
204 204 profile_dir = os.path.join(p, dirname)
205 205 if os.path.isdir(profile_dir):
@@ -19,9 +19,9 b' def test_unicode_cwd():'
19 19 """Check that IPython starts with non-ascii characters in the path."""
20 20 wd = tempfile.mkdtemp(suffix=u"€")
21 21
22 old_wd = py3compat.getcwd()
22 old_wd = os.getcwd()
23 23 os.chdir(wd)
24 #raise Exception(repr(py3compat.getcwd()))
24 #raise Exception(repr(os.getcwd()))
25 25 try:
26 26 app = BaseIPythonApplication()
27 27 # The lines below are copied from Application.initialize()
@@ -41,7 +41,7 b' class Test_magic_run_completer(unittest.TestCase):'
41 41 for d in self.dirs:
42 42 os.mkdir(join(self.BASETESTDIR, d))
43 43
44 self.oldpath = py3compat.getcwd()
44 self.oldpath = os.getcwd()
45 45 os.chdir(self.BASETESTDIR)
46 46
47 47 def tearDown(self):
@@ -94,7 +94,7 b' class Test_magic_run_completer_nonascii(unittest.TestCase):'
94 94 for fil in [u"aaø.py", u"a.py", u"b.py"]:
95 95 with open(join(self.BASETESTDIR, fil), "w") as sfile:
96 96 sfile.write("pass\n")
97 self.oldpath = py3compat.getcwd()
97 self.oldpath = os.getcwd()
98 98 os.chdir(self.BASETESTDIR)
99 99
100 100 def tearDown(self):
@@ -485,7 +485,7 b' class TestSafeExecfileNonAsciiPath(unittest.TestCase):'
485 485 os.mkdir(self.TESTDIR)
486 486 with open(join(self.TESTDIR, u"åäötestscript.py"), "w") as sfile:
487 487 sfile.write("pass\n")
488 self.oldpath = py3compat.getcwd()
488 self.oldpath = os.getcwd()
489 489 os.chdir(self.TESTDIR)
490 490 self.fname = u"åäötestscript.py"
491 491
@@ -393,9 +393,9 b' def test_parse_options():'
393 393
394 394 def test_dirops():
395 395 """Test various directory handling operations."""
396 # curpath = lambda :os.path.splitdrive(py3compat.getcwd())[1].replace('\\','/')
397 curpath = py3compat.getcwd
398 startdir = py3compat.getcwd()
396 # curpath = lambda :os.path.splitdrive(os.getcwd())[1].replace('\\','/')
397 curpath = os.getcwd
398 startdir = os.getcwd()
399 399 ipdir = os.path.realpath(_ip.ipython_dir)
400 400 try:
401 401 _ip.magic('cd "%s"' % ipdir)
@@ -408,7 +408,7 b' class TestMagicRunWithPackage(unittest.TestCase):'
408 408 self.value = int(random.random() * 10000)
409 409
410 410 self.tempdir = TemporaryDirectory()
411 self.__orig_cwd = py3compat.getcwd()
411 self.__orig_cwd = os.getcwd()
412 412 sys.path.insert(0, self.tempdir.name)
413 413
414 414 self.writefile(os.path.join(package, '__init__.py'), '')
@@ -53,7 +53,7 b' class AvoidUNCPath(object):'
53 53 os.system(cmd)
54 54 """
55 55 def __enter__(self):
56 self.path = py3compat.getcwd()
56 self.path = os.getcwd()
57 57 self.is_unc_path = self.path.startswith(r"\\")
58 58 if self.is_unc_path:
59 59 # change to c drive (as cmd.exe cannot handle UNC addresses)
@@ -173,7 +173,7 b' class AvoidUNCPath(object):'
173 173 os.system(cmd)
174 174 """
175 175 def __enter__(self):
176 self.path = py3compat.getcwd()
176 self.path = os.getcwd()
177 177 self.is_unc_path = self.path.startswith(r"\\")
178 178 if self.is_unc_path:
179 179 # change to c drive (as cmd.exe cannot handle UNC addresses)
@@ -158,7 +158,7 b' def filefind(filename, path_dirs=None):'
158 158 path_dirs = (path_dirs,)
159 159
160 160 for path in path_dirs:
161 if path == '.': path = py3compat.getcwd()
161 if path == '.': path = os.getcwd()
162 162 testname = expand_path(os.path.join(path, filename))
163 163 if os.path.isfile(testname):
164 164 return os.path.abspath(testname)
@@ -52,7 +52,7 b' def find_cmd(cmd):'
52 52
53 53 def abbrev_cwd():
54 54 """ Return abbreviated version of cwd, e.g. d:mydir """
55 cwd = py3compat.getcwd().replace('\\','/')
55 cwd = os.getcwd().replace('\\','/')
56 56 drivepart = ''
57 57 tail = cwd
58 58 if sys.platform == 'win32':
@@ -93,7 +93,7 b" elif sys.platform == 'win32':"
93 93
94 94 try:
95 95 # Cannot be on network share when issuing system commands
96 curr = py3compat.getcwd()
96 curr = os.getcwd()
97 97 os.chdir("C:")
98 98 ret = os.system("title " + title)
99 99 finally:
@@ -356,7 +356,7 b' class TestShellGlob(object):'
356 356 @classmethod
357 357 @contextmanager
358 358 def in_tempdir(cls):
359 save = py3compat.getcwd()
359 save = os.getcwd()
360 360 try:
361 361 os.chdir(cls.tempdir.name)
362 362 yield
General Comments 0
You need to be logged in to leave comments. Login now