Skip to content

Commit

Permalink
Explicitely numbered replacement fields
Browse files Browse the repository at this point in the history
  • Loading branch information
quantifiedcode-bot authored and nanorepublica committed Jun 9, 2017
1 parent 4004991 commit 8fa04d7
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
# General information about the project.
project = u'Duedil'
authors = u'Bruno Alla'
copyright = u'{}, Founders4Schools'.format(datetime.datetime.now().year)
copyright = u'{0}, Founders4Schools'.format(datetime.datetime.now().year)

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down
12 changes: 6 additions & 6 deletions duedil/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def set_api(self, api_key=None, sandbox=False):
try:
self.base_url = API_URLS.get(self.api_type, 'lite')
except AttributeError:
raise ValueError('Duedil API type must be "{}"'.format('", "'.join(API_URLS.keys())))
raise ValueError('Duedil API type must be "{0}"'.format('", "'.join(API_URLS.keys())))

# Are we in a sandbox?
self.sandbox = sandbox
Expand Down Expand Up @@ -118,7 +118,7 @@ def _get(self, endpoint, data=None):

if self.api_type in ["pro", "lite"]:
data_format = 'json'
resp_format = '.{}'.format(data_format)
resp_format = '.{0}'.format(data_format)
else:
resp_format = ''

Expand Down Expand Up @@ -164,7 +164,7 @@ def search(self, query):
raise NotImplementedError

def __str__(self):
return 'Duedil Client type:{}'.format(self.api_type)
return 'Duedil Client type:{0}'.format(self.api_type)

class LiteClient(Client):
api_type = 'lite'
Expand Down Expand Up @@ -299,13 +299,13 @@ class InternationalClient(Client):
search_list_class = InternationalSearchResourceList

def search(self, country_code, query):
endpoint = '{}/search'.format(country_code)
endpoint = '{0}/search'.format(country_code)
return self._search(endpoint, InternationalCompanySearchResult, query=query)

def get(self, country_code, endpoint, data):
endpoint = '{}/{}'.format(country_code, endpoint)
endpoint = '{0}/{1}'.format(country_code, endpoint)
return self._get(endpoint, data)

# this should be a Resource and not here...
def report(self, country_code, id):
return self.get(country_code, 'report/{}'.format(id), {})
return self.get(country_code, 'report/{0}'.format(id), {})
2 changes: 1 addition & 1 deletion duedil/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def kwargs_key_generator(namespace, fn, **kw):
def generate_key(*args, **kwargs):
args_str = "_".join(str(s) for s in args)
kwargs_str = json.dumps(kwargs)
key = '{}_{}:{}_{}'.format(namespace, fname, args_str, kwargs_str)
key = '{0}_{1}:{2}_{3}'.format(namespace, fname, args_str, kwargs_str)
hashkey = hashlib.md5(key.encode('utf-8'))
return hashkey.hexdigest()
return generate_key
Expand Down
2 changes: 1 addition & 1 deletion duedil/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def __missing__(self, key):
raise KeyError('{0!s} in not a valid attribute'.format(key))

def __str__(self):
return '{} ({})'.format(self.__class__.__name__, self.id)
return '{0} ({1})'.format(self.__class__.__name__, self.id)

def __eq__(self, other):
return self.id == other.id
Expand Down
2 changes: 1 addition & 1 deletion duedil/resources/pro/company/accounts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ def details(self):
module, resource = resource.rsplit('.', 1)
resource = getattr(sys.modules['duedil.resources.{0!s}'.format(module)], resource)
resource_obj = self.load_related('details', resource, self.full_endpoint)
resource_obj.path = '{}'.format(self.path)
resource_obj.path = '{0}'.format(self.path)
resource_obj.loaded = True
return resource_obj
2 changes: 1 addition & 1 deletion duedil/search/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def __eq__(self, other):
return self.id == other

def __str__(self):
return 'Search Result: {} ({})'.format(self.name, self.id)
return 'Search Result: {0} ({1})'.format(self.name, self.id)



Expand Down
2 changes: 1 addition & 1 deletion duedil/search/pro/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(self, results, result_klass, client):
self._length = page.get('total', len(self.result_list))

def __str__(self):
return "Pro Search Result List - total: {}".format(len(self))
return "Pro Search Result List - total: {0}".format(len(self))

@property
def next_url(self):
Expand Down

0 comments on commit 8fa04d7

Please sign in to comment.