mirror of
https://github.com/powerline/powerline.git
synced 2025-07-29 08:45:15 +02:00
Move common segment imports
This commit is contained in:
parent
b57174a16c
commit
0d097139d6
@ -1,10 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
|
||||||
import socket
|
|
||||||
|
|
||||||
from powerline.lib.vcs import guess
|
|
||||||
from powerline.lib import memoize
|
from powerline.lib import memoize
|
||||||
|
|
||||||
# Weather condition code descriptions available at http://developer.yahoo.com/weather/#codes
|
# Weather condition code descriptions available at http://developer.yahoo.com/weather/#codes
|
||||||
@ -22,6 +19,7 @@ weather_conditions_codes = {
|
|||||||
|
|
||||||
|
|
||||||
def hostname():
|
def hostname():
|
||||||
|
import socket
|
||||||
if not os.environ.get('SSH_CLIENT'):
|
if not os.environ.get('SSH_CLIENT'):
|
||||||
return None
|
return None
|
||||||
return socket.gethostname()
|
return socket.gethostname()
|
||||||
@ -37,6 +35,7 @@ def user():
|
|||||||
|
|
||||||
|
|
||||||
def branch():
|
def branch():
|
||||||
|
from powerline.lib.vcs import guess
|
||||||
repo = guess(os.path.abspath(os.getcwd()))
|
repo = guess(os.path.abspath(os.getcwd()))
|
||||||
if repo:
|
if repo:
|
||||||
return repo.branch()
|
return repo.branch()
|
||||||
@ -44,6 +43,7 @@ def branch():
|
|||||||
|
|
||||||
|
|
||||||
def cwd(dir_shorten_len=None, dir_limit_depth=None):
|
def cwd(dir_shorten_len=None, dir_limit_depth=None):
|
||||||
|
import re
|
||||||
cwd = os.getcwdu()
|
cwd = os.getcwdu()
|
||||||
home = os.environ.get('HOME')
|
home = os.environ.get('HOME')
|
||||||
if home:
|
if home:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user