Skip to content

Commit a1bc7f7

Browse files
authored
Merge pull request #9 from sourcerer-io/develop
feat: Releasing latest changes.
2 parents 41e32c8 + eb8d58f commit a1bc7f7

File tree

5 files changed

+20
-19
lines changed

5 files changed

+20
-19
lines changed

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,11 @@ Hall-of-fame code is entirely open source. You can run it in Google cloud yourse
2222
4. You should see code to insert in your README.md. It will look something like this:
2323

2424
```
25-
<a href="https://sourcerer.io/fame/$USER/$OWNER/$REPO/links/0"
26-
><img src="https://sourcerer.io/fame/$USER/$OWNER/$REPO/images/0" height="90px" hspace="4"></a>
25+
[![](https://sourcerer.io/fame/$USER/$OWNER/$REPO/images/0)](https://sourcerer.io/fame/$USER/$OWNER/$REPO/links/0)
2726
2827
...
2928
30-
<a href="https://sourcerer.io/fame/$USER/$OWNER/$REPO/links/7"
31-
><img src="https://sourcerer.io/fame/$USER/$OWNER/$REPO/images/7" height="90px" hspace="4"></a>
29+
[![](https://sourcerer.io/fame/$USER/$OWNER/$REPO/images/7)](https://sourcerer.io/fame/$USER/$OWNER/$REPO/links/7)
3230
```
3331
Paste that code into your README.md, and you should be good to go. Hall-of-fame will take care of the rest.
3432

@@ -52,4 +50,11 @@ Note that Hall-of-fame will use your GitHub token for hourly updates via GitHub
5250

5351
Contribute to Hall-of-fame by all means. Here is the live Hall-of-fame for this repo:
5452

55-
<a href="https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/links/0"><img src="https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/images/0" height="90px" hspace="4" /></a><a href="https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/links/1"><img src="https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/images/1" height="90px" hspace="4" /></a><a href="https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/links/2"><img src="https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/images/2" height="90px" hspace="4" /></a><a href="https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/links/3"><img src="https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/images/3" height="90px" hspace="4" /></a><a href="https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/links/4"><img src="https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/images/4" height="90px" hspace="4" /></a><a href="https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/links/5"><img src="https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/images/5" height="90px" hspace="4" /></a><a href="https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/links/6"><img src="https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/images/6" height="90px" hspace="4" /></a><a href="https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/links/7"><img src="https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/images/7" height="90px" hspace="4" /></a>
53+
[![](https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/images/0)](https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/links/0)
54+
[![](https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/images/1)](https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/links/1)
55+
[![](https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/images/2)](https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/links/2)
56+
[![](https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/images/3)](https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/links/3)
57+
[![](https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/images/4)](https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/links/4)
58+
[![](https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/images/5)](https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/links/5)
59+
[![](https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/images/6)](https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/links/6)
60+
[![](https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/images/7)](https://sourcerer.io/fame/sergey48k/sourcerer-io/hall-of-fame/links/7)

fame/avatar.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,10 @@ def _make_badge(self):
101101

102102

103103
class AvatarAdorner:
104-
105104
"""AvatarAdorner adorns avatars with badges."""
105+
106+
PADDING = 10 # Padding on each side of an adorned avatar.
107+
106108
def init_with_face(self, face_url):
107109
self.svg = ElementTree.fromstring(SVG_GITHUB)
108110
self._init_face_image()
@@ -185,16 +187,11 @@ def _make_badge(self):
185187
face_w, face_h = self.face_w, self.face_h
186188
badge_w, badge_h = self.badger.badge_w, self.badger.badge_h
187189

188-
w = face_w
189190
h = face_h + badge_h + self.badger.badge_off
191+
w = max(face_w, badge_w) + AvatarAdorner.PADDING * 2
190192

191-
if badge_w > face_w:
192-
# Badge is wider than face, center face with respect to badge.
193-
self.face_svg.set('x', '%.02f' % ((badge_w - face_w) / 2))
194-
w = badge_w
195-
else:
196-
# Face is wider than badge, center badge with respect to face.
197-
badge_svg.set('x', '%.02f' % ((face_w - badge_w) / 2))
193+
self.face_svg.set('x', '%.02f' % ((w - face_w) / 2)) # Center face.
194+
badge_svg.set('x', '%.02f' % ((w - badge_w) / 2)) # Center badge.
198195

199196
self.svg.set('viewBox', '0 0 %.02f %.02f' % (w, h))
200197
badge_svg.set('y', '%.02f' % (face_h + self.badger.badge_off))

fame/glory.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def _issue_badges(self, trending, new_faces, top_guns):
120120
# Generate a test HTML.
121121
f = io.StringIO()
122122
for i in range(len(profile_urls)):
123-
h = '<a href="%s"><img src="images/%d.svg"></a>\n'
123+
h = '<a href="%s"><img src="images/%d.svg"></a>'
124124
f.write(h % (profile_urls[i], i))
125125
test_html_path = self._get_test_html_path(temp=True)
126126
storage.save_file(test_html_path, f.getvalue(), 'text/html')
@@ -139,7 +139,7 @@ def _map_users_to_sourcerer(self, github_usernames):
139139
url = self._get_sourcerer_mapping_url(github_usernames)
140140
data = urlopen(url).read().decode()
141141
parsed = json.loads(data)
142-
self.user_mapping = {k: v for k,v in parsed.items() if v}
142+
self.user_mapping = {k: v for k, v in parsed.items() if v}
143143

144144
def _map_to_sourcerer(self, github_username):
145145
if github_username not in self.user_mapping:
@@ -168,7 +168,7 @@ def _cleanup(self):
168168
temp_image_dir = self._get_image_dir(temp=True)
169169
storage.make_dirs(temp_image_dir)
170170

171-
image_dir = self._get_image_dir(temp=False)
171+
image_dir = self._get_image_dir(temp=False)
172172
storage.make_dirs(image_dir)
173173

174174
def _install(self):

fame/ssl_hack.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import ssl
1010

11+
1112
def disable_ssl_host_check():
1213
"""Never use in production!"""
1314
try:

fame/storage/google_cloud_storage.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
__author__ = 'Sergey Surkov'
44
__copyright__ = '2018 Sourcerer, Inc'
55

6-
from datetime import datetime
7-
86
import pytz
97
from google.api_core.exceptions import NotFound
108
from google.cloud import storage as gstorage

0 commit comments

Comments
 (0)