for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
import socket
class Location(object):
"""Represents the location of a file."""
def __init__(self, locationString):
if ':' in locationString:
parts = locationString.split(':')
self.hostname = parts[0]
self.path = parts[1]
else:
self.hostname = socket.gethostname()
self.path = locationString
def toDictionary(self):
d = {}
d['path'] = self.path
d['hostname'] = self.hostname
d['location'] = str(self)
return d
def toUrl(self):
return 'file://{0}{1}'.format(self.hostname, self.path)
def __str__(self):
return self.toString()
def toString(self):
return ':'.join([self.hostname, self.path])