Permalink
Browse files

Remove whitespace [Gun.io WhitespaceBot]

  • Loading branch information...
1 parent cc1daa4 commit 34dcee285b184c6417b51b03c8a4f4ba6aa6c17d Gun.io Whitespace Robot committed Dec 17, 2011
View
@@ -10,13 +10,13 @@ convert_logs.py supports more formats than we have documented here. For more in
cd path/to/svn/project
svn log -v > my_svn.log
python convert_logs.py -s path/to/svn/project/my_svn.log -o svn_log.xml
-
+
# git #
cd path/to/git/project
git-log --name-status --pretty=format:'%n------------------------------------------------------------------------%nr%h | %ae | %ai (%aD) | x lines%nChanged paths:' > my_git_project.log
python convert_logs.py -g path/to/git/project/my_git_project -o git_log.xml
-
+
# Startteam #
View
@@ -24,7 +24,7 @@ import md5
from random import random
from threading import Thread
from shutil import copy
-
+
def parse_args():
from optparse import OptionParser
@@ -55,15 +55,15 @@ def parse_args():
def main():
"""
Visualizes the project in the current working directory.
-
+
Doing this automagically involves three steps:
1) Discovering what kind of repository is used in the current working
directory.
-
+
2) Converting the log formats from each kind of repository to the event
xml format that code_swarm expects.
-
- 3) Invoking code_swarm
+
+ 3) Invoking code_swarm
"""
options = parse_args()[0]
@@ -127,7 +127,7 @@ def invoke_code_swarm(code_swarm_jar, proj_cfg, options):
path_64 = os.path.join(path, "linux-x86_64")
path = os.pathsep.join([path_64, path])
return "-Djava.library.path=" + os.pathsep.join([path, old_path])
-
+
classpath = os.pathsep.join([code_swarm_jar, get_jars(), "."])
ea = "-da"
if options.debug: ea = "-ea"
@@ -175,15 +175,15 @@ def autogenerate_files(options):
if options.reload or not os.path.exists(os.path.join(dir, "log.xml")):
generate_log(dir)
-
+
proj_cfg = os.path.join(dir, "project.config")
if not os.path.exists(proj_cfg):
print >>sys.stderr, "Creating default config file at " + proj_cfg
cp_tpl = os.path.join(root_path(), "bin", "config.template")
copy(cp_tpl, proj_cfg)
-
+
return proj_cfg
-
+
def do_cmds(*cmds):
for cmd in cmds:
@@ -222,7 +222,7 @@ def do_hg(dir):
def do_darcs(dir):
tmp = os.path.join(dir, "darcs.xml")
xml = os.path.join(dir, "log.xml")
-
+
return do_cmds("darcs changes -s --xml-output > '%s'" % tmp
,"convert_logs.py -d '%s' -o '%s'" % (tmp, xml)
,"rm -f '%s'" % tmp)
@@ -240,7 +240,7 @@ def do_freebase(domain):
cfgf.write("InputFile=%s\n" % xml)
cfgf.close()
return cfg
-
-
+
+
if __name__ == "__main__":
main()
View
@@ -6,7 +6,7 @@ InputFile=log.xml
# Color assignment rules
# Keep in order, do not skip numbers. Numbers start
# at 1.
-#
+#
# Pattern: "Label", "regex", R,G,B, R,G,B
# Label is optional. If it is omitted, the regex
# will be used.
@@ -37,6 +37,6 @@ IsInputSorted=true
# To use local avatars, uncomment this line:
#AvatarFetcher=LocalAvatar
-# then place png files named after the usernames of committers in
+# then place png files named after the usernames of committers in
# the data/local_avatars directory
# data/local_avatars/default.png is used by default
View
@@ -35,7 +35,7 @@ Background=0,0,0
# Color assignment rules
# Keep in order, do not skip numbers. Numbers start
# at 1.
-#
+#
# Pattern: "Label", "regex", R,G,B, R,G,B
# Label is optional. If it is omitted, the regex
# will be used.
View
@@ -36,7 +36,7 @@ Background=0,0,0
# Color assignment rules
# Keep in order, do not skip numbers. Numbers start
# at 1.
-#
+#
# Pattern: "Label", "regex", R,G,B, R,G,B
# Label is optional. If it is omitted, the regex
# will be used.
@@ -64,7 +64,7 @@ Font=SansSerif
FontSize=10
FontColor=255,255,255
-# Font for people's names immediately after they've made an edit
+# Font for people's names immediately after they've made an edit
BoldFont=SansSerif
BoldFontSize=14
@@ -103,7 +103,7 @@ IsInputSorted=false
# Particle sprite file
ParticleSpriteFile=src/particle.png
-# OpenGL has problems on some platforms. We're closer to having it work
+# OpenGL has problems on some platforms. We're closer to having it work
# automatically out of the box, but not close enough to enable it by default
UseOpenGL=false
@@ -114,7 +114,7 @@ AvatarFetcher=GravatarFetcher
#AvatarFetcher=NoAvatar
-# looks for avatar images (with the same name as the user name) in
+# looks for avatar images (with the same name as the user name) in
# the LocalAvatarDirectory
#AvatarFetcher=LocalAvatar
View
@@ -11,35 +11,35 @@
public class AvatarFetcher {
protected CodeSwarmConfig cfg;
- public int size;
+ public int size;
public AvatarFetcher(CodeSwarmConfig cfg) {
this.cfg = cfg;
size = cfg.getPositiveIntProperty("AvatarSize");
}
-
+
public String fetchUserImage(String username) {
throw new RuntimeException("Override fetchUserImage in your Avatar Fetcher");
}
-
+
protected static String getFilename(String key){
return "image_cache/" + key;
}
-
+
protected static boolean imageCached(String key) {
return new File(getFilename(key)).exists();
}
-
+
protected static String getImage(String key, URL url) {
String filename = getFilename(key);
if (!imageCached(key)){
- boolean successful = fetchImage(filename, url);
+ boolean successful = fetchImage(filename, url);
if (!successful)
return null;
}
-
+
return filename;
}
-
+
protected static boolean fetchImage(String filename, URL url) {
try {
new File("image_cache").mkdirs();
@@ -72,7 +72,7 @@ protected static boolean fetchImage(String filename, URL url) {
return false;
}
}
-
+
//these two methods taken from http://en.gravatar.com/site/implement/java
private static String hex(byte[] array) {
StringBuffer sb = new StringBuffer();
View
@@ -108,8 +108,8 @@
public static final String DRAW_CIRCULAR_AVATARS = "CircularAvatars";
private List<Properties> propStack;
-
-
+
+
// Cache variables
private Color _background = null;
@@ -118,7 +118,7 @@ public CodeSwarmConfig(String configFileName) throws IOException {
initPropStack();
addPropertiesLayer(configFileName);
}
-
+
public CodeSwarmConfig(Iterable<String> configFileNames) throws IOException {
initPropStack();
for (String filename: configFileNames)
@@ -134,12 +134,12 @@ public void addPropertiesLayer(String filename) throws IOException {
props.load(new FileInputStream(filename));
addPropertiesLayer(props);
}
-
+
protected void initPropStack() {
propStack = new LinkedList<Properties>();
propStack.add(createDefaults());
}
-
+
private Properties createDefaults() {
Properties def = new Properties();
def.setProperty( COLOR_ASSIGN_KEY + "1" , DEFAULT_COLOR_ASSIGN );
@@ -148,7 +148,7 @@ private Properties createDefaults() {
/**
- *
+ *
* @param key
* @return Returns the first key found in the stack of config files.
*/
@@ -163,7 +163,7 @@ public Color getColorProperty(String key) {
return stringToColor( getStringProperty(key) );
}
-
+
/**
* Specify the path to the Xml-input file containing the repository
* entries.<br />
@@ -176,13 +176,13 @@ public void setInputFile(String filePath){
propStack.get(0).setProperty(INPUT_FILE_KEY, filePath);
}
-
+
public boolean getBooleanProperty(String key) {
return Boolean.valueOf(getStringProperty(key));
}
-
+
/**
- *
+ *
* @param key
* @return value of property if found, 0 if not found.
*/
@@ -191,7 +191,7 @@ public int getIntProperty( String key ) {
}
/**
- *
+ *
* @param key
* @param defValue
* @return value of property if found.
@@ -204,7 +204,7 @@ public int getPositiveIntProperty(String key) {
}
/**
- *
+ *
* @param key
* @param defValue
* @return defValue if not found or found value isn't negative, Value of property if found.
@@ -219,7 +219,7 @@ public int getNegativeIntProperty( String key) {
/**
- *
+ *
* @param key
* @return value of property if found, 0 if not found.
*/
@@ -228,7 +228,7 @@ public long getLongProperty( String key ) {
}
/**
- *
+ *
* @param key
* @return value of property if found, 0 if not found.
*/
@@ -237,7 +237,7 @@ public float getFloatProperty( String key ) {
}
/**
- *
+ *
* @param index
* @return String containing the regex and rgb values used to colorcode nodes, null if not found
*/
@@ -246,7 +246,7 @@ public String getColorAssignProperty( Integer index ) {
}
/**
- *
+ *
* @param str
* @return Color object constructed from values in str
*/
@@ -15,7 +15,7 @@ public FreebaseAvatarFetcher(CodeSwarmConfig cfg) {
}
static private Pattern imageIDPattern = Pattern.compile("\"image:id\"\\s*:\\s*\"(.*?)\"");
-
+
private static String readURLToString(URL url) {
try {
URLConnection con = url.openConnection();
@@ -25,7 +25,7 @@ private static String readURLToString(URL url) {
if (length == -1){
//read until exhausted
while(true){
- String line = reader.readLine();
+ String line = reader.readLine();
if (line == null) break;
sb.append(line);
}
@@ -41,7 +41,7 @@ private static String readURLToString(URL url) {
return null;
}
}
-
+
private static String getUserImageID(String username) {
try {
new File("image_cache").mkdirs();
@@ -58,17 +58,17 @@ private static String getUserImageID(String username) {
}
return null;
}
-
+
public String fetchUserImage(String username) {
String key = md5Hex("metaweb:" + username);
if (imageCached(key))
return getFilename(key);
try {
String imageID = getUserImageID(username);
if (imageID == null) return null;
- return getImage(key, new URL("http://www.freebase.com/api/trans/image_thumb/"
- + imageID
- + "?maxheight=" + size
+ return getImage(key, new URL("http://www.freebase.com/api/trans/image_thumb/"
+ + imageID
+ + "?maxheight=" + size
+ "&maxwidth=" + size
+ "&mode=fillcrop"));
} catch (MalformedURLException e) {
View
@@ -18,7 +18,7 @@ public String fetchUserImage(String username) {
return null;
}
}
-
+
private Pattern emailPattern = Pattern.compile("<(.*?@.*?\\..*?)>");
private String getEmail(String username) {
Matcher emailMatcher = emailPattern.matcher(username);
Oops, something went wrong.

0 comments on commit 34dcee2

Please sign in to comment.