Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3ecd641

Browse files
committed
Basic packages reorg
1 parent 096e987 commit 3ecd641

File tree

5 files changed

+82
-0
lines changed

5 files changed

+82
-0
lines changed

util-git/gitify.py

Whitespace-only changes.

util-git/gitsh.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import sh
22
import os
33

4+
45
home_dir = os.environ['HOME']
6+
'''
57
repo_dir = os.path.join(home_dir, 'learn-me/misc/git-sh')
68
79
git = sh.git.bake(_cwd=repo_dir)
@@ -19,5 +21,35 @@
1921
2022
# now we are one commit ahead
2123
print(git.status())
24+
'''
25+
26+
mkdir_cmd = sh.Command('/bin/mkdir')
27+
28+
29+
def git_init(dir_to_use):
30+
if os.path.isdir(dir_to_use):
31+
print(dir_to_use + ": already exists")
32+
return None
33+
34+
mkdir_cmd(dir_to_use)
35+
git_cmd = sh.git.bake(_cwd=dir_to_use)
36+
print(git_cmd.init())
37+
return git_cmd
38+
39+
40+
41+
repo_dir = os.path.join(home_dir, 'learn-me/misc/git-sh2')
42+
43+
git = git_init(repo_dir)
44+
45+
print("From returned command ...\n{}".format(git.status()))
46+
47+
48+
49+
50+
51+
52+
53+
2254

2355

util/refactor.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import os
2+
from utils import Logger
3+
4+
join = os.path.join
5+
6+
def get_file_list():
7+
return None
8+
9+
10+
def modify_java_file(file_dir, file_name):
11+
return None
12+
13+
home_dir = os.environ['HOME']
14+
source_path_name = join(home_dir, 'learn-master/udemy/python-complete-reorg/zips/')
15+
target_path_name = join(home_dir, 'learn-master/udemy/python-complete-reorg/')
16+
file_extensions = ['java', 'py', 'txt']
17+
18+
if not (os.path.isdir(source_path_name) and os.path.isdir(target_path_name)):
19+
print('One or more invalid input directories: ')
20+
print('\t' + source_path_name)
21+
print('\t' + target_path_name)
22+
exit(1)
23+
24+
log_file_name = Logger.get_log_name(home_dir, 'refactor')
25+
26+
print(log_file_name)
27+
28+
# log_file = open(log_file_name, mode='w')
29+
30+
31+
'''
32+
package com.timbuchalka;
33+
34+
/**
35+
* Created by dev on 8/3/15.
36+
*/
37+
public class Dog extends Animal {
38+
'''

utils/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from utillog import Logger

utils/utillog.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from datetime import datetime
2+
3+
4+
class Logger(object):
5+
@staticmethod
6+
def get_log_name(target_dir, base_name):
7+
# probably an easier way to do this, but brute force suffices ...
8+
now = datetime.now()
9+
log_suffix = str.format("{:04d}{:02d}{:02d}_{:02d}{:02d}{:02d}", now.year, now.month, now.day, now.hour, now.minute, now.second)
10+
return str.format("{}/{}_{}.log", target_dir, base_name, log_suffix)
11+

0 commit comments

Comments
 (0)