cleanup: pep8

This commit is contained in:
2014-11-21 20:58:44 +01:00
parent 47a6eaa936
commit aac29c824d
12 changed files with 57 additions and 77 deletions

View File

@@ -189,7 +189,6 @@ class bam_session:
os.path.join(session_rootdir, ".bam_tmp.zip"),
}
with open(os.path.join(session_rootdir, ".bam_paths_uuid.json")) as f:
import json
paths_uuid = json.load(f)
@@ -293,7 +292,6 @@ class bam_commands:
print("Project %r initialized" % proj_dirname)
@staticmethod
def create(session_name):
import os
@@ -382,7 +380,7 @@ class bam_commands:
tot_size = 0
for chunk in r.iter_content(chunk_size=1024):
if chunk: # filter out keep-alive new chunks
if chunk: # filter out keep-alive new chunks
tot_size += len(chunk)
f.write(chunk)
f.flush()
@@ -404,7 +402,6 @@ class bam_commands:
@staticmethod
def commit(paths, message):
import sys
import os
import requests
@@ -439,11 +436,9 @@ class bam_commands:
with open(os.path.join(session_rootdir, ".bam_paths_uuid.json")) as f:
paths_uuid = json.load(f)
with open(os.path.join(session_rootdir, ".bam_deps_remap.json")) as f:
deps_remap = json.load(f)
paths_add = {}
paths_modified = {}
paths_remove = {}
@@ -458,7 +453,6 @@ class bam_commands:
print("Nothing to commit!")
return
for fn_rel, fn_abs in list(paths_modified.items()):
# we may want to be more clever here
deps = deps_remap.get(fn_rel)
@@ -555,7 +549,6 @@ class bam_commands:
# TODO(cam)
# if all goes well, rewrite sha1's
@staticmethod
def status(paths):
# TODO(cam) multiple paths
@@ -565,7 +558,6 @@ class bam_commands:
session_rootdir = bam_config.find_sessiondir(path, abort=True)
print(session_rootdir)
paths_add = {}
paths_modified = {}
paths_remove = {}
@@ -623,7 +615,6 @@ class bam_commands:
if file_type != "dir":
print(" %s" % name_short)
@staticmethod
def deps(paths, recursive=False):
import blendfile_path_walker
@@ -717,7 +708,7 @@ def create_argparse_checkout(subparsers):
help="Path to checkout on the server",
)
subparse.add_argument(
"-o", "--output",dest="output", type=str, metavar='DIRNAME',
"-o", "--output", dest="output", type=str, metavar='DIRNAME',
help="Local name to checkout the session into (optional, falls back to path name)",
)
subparse.set_defaults(func=subcommand_checkout_cb)

View File

@@ -7,7 +7,6 @@ import os
MODULE_DIR = os.path.dirname(__file__)
with open(os.path.join(MODULE_DIR, 'config.json'), 'r') as config:
import json
config = json.load(config)
@@ -29,7 +28,7 @@ def request_url(path):
# print (r.json())
# with open(local_filename, 'wb') as f:
# for chunk in r.iter_content(chunk_size=1024):
# for chunk in r.iter_content(chunk_size=1024):
# if chunk: # filter out keep-alive new chunks
# f.write(chunk)
# f.flush()
@@ -39,7 +38,7 @@ def request_url(path):
# with open(filepath) as fh:
# mydata = fh.read()
# response = requests.put('https://api.elasticemail.com/attachments/upload',
# data=mydata,
# data=mydata,
# auth=('omer', 'b01ad0ce'),
# headers={'content-type':'text/plain'},
# params={'file': filepath}
@@ -55,12 +54,11 @@ payload = {
}
files = {'file': open('buck.mp4', 'rb')}
#files = {'name': ('filename', (open('mytest.txt', 'rb')))}
# files = {'name': ('filename', (open('mytest.txt', 'rb')))}
r = requests.put(request_url('/file'),
r = requests.put(request_url('/file'),
params=payload,
auth=('bam', 'bam'),
files=files)
print(r.text)

View File

@@ -184,7 +184,8 @@ class Application(tk.Frame):
but.grid(row=row, column=0)
self.grid_members.append(but)
def fn(idname=name_short, but_path=but_path): exec_path_dir(idname, but_path)
def fn(idname=name_short, but_path=but_path):
exec_path_dir(idname, but_path)
but = tk.Button(self.frame, text=name_short + "/", fg="green", command=fn)
but.grid(row=row, column=1, sticky="nw")
@@ -213,7 +214,9 @@ class Application(tk.Frame):
if item_type == "file":
but = tk.Label(self.frame, text="(b)", width=3, borderwidth="1", relief="solid")
but.grid(row=row, column=0)
def fn(idname=name_short): exec_path_blendfile(idname)
def fn(idname=name_short):
exec_path_blendfile(idname)
self.grid_members.append(but)
but = tk.Button(self.frame, text=name_short, fg="blue", command=fn)
@@ -231,4 +234,3 @@ root = tk.Tk()
app = Application(root).pack(side="top", fill="both", expand=True)
root.title("BAM")
root.mainloop()