Created
January 31, 2019 11:43
-
-
Save ryochin/ad6bc91e381cf872d711a77c5a6c674c to your computer and use it in GitHub Desktop.
python3 patch for pit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/pit.py b/pit.py | |
| index 8b3dadd..47d8165 100644 | |
| --- a/pit.py | |
| +++ b/pit.py | |
| @@ -31,7 +31,7 @@ class Pit: | |
| os.remove(path) | |
| if result == c: | |
| - print 'No Changes' | |
| + print('No Changes') | |
| if name in profile: | |
| return profile[nane] | |
| return | |
| @@ -47,8 +47,8 @@ class Pit: | |
| @staticmethod | |
| def get(name, opts={}): | |
| load_data = Pit._load() | |
| - ret = load_data[name] if load_data.has_key(name) else {} | |
| - if opts.has_key('require'): | |
| + ret = load_data[name] if name in load_data else {} | |
| + if 'require' in opts: | |
| keys = set(opts['require'].keys()) - set(ret.keys()) | |
| if keys: | |
| for key in keys: | |
| @@ -72,13 +72,13 @@ class Pit: | |
| def _load(): | |
| if not os.path.exists(Pit.DIRECTORY): | |
| os.mkdir(Pit.DIRECTORY) | |
| - os.chmod(Pit.DIRECTORY, 0700) | |
| + os.chmod(Pit.DIRECTORY, 0o700) | |
| if not os.path.exists(Pit._config): | |
| yaml.dump({'profile' : 'default'}, | |
| open(Pit._config, 'w'), | |
| default_flow_style=False) | |
| - os.chmod(Pit._config, 0600) | |
| + os.chmod(Pit._config, 0o600) | |
| Pit.switch(Pit.config()['profile']) | |
| @@ -86,7 +86,7 @@ class Pit: | |
| yaml.dump({}, | |
| open(Pit._profile, 'w'), | |
| default_flow_style=False) | |
| - os.chmod(Pit._profile, 0600) | |
| + os.chmod(Pit._profile, 0o600) | |
| return yaml.load(open(Pit._profile)) or {} | |
| @staticmethod | |
| @@ -95,6 +95,6 @@ class Pit: | |
| if __name__ == '__main__': | |
| config = Pit.get('34twitter.com',{'require': {'email':'your email','password':'your password'}}) | |
| - print config | |
| - print config['email'] | |
| - print config['password'] | |
| + print(config) | |
| + print(config['email']) | |
| + print(config['password']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment