Browse Source

lint: Mass convert str.format to unicode.format (#9615)

Replaces: #6449
Matt Robenolt 6 years ago
parent
commit
d292fd4680

+ 2 - 2
setup.py

@@ -66,7 +66,7 @@ IS_LIGHT_BUILD = os.environ.get('SENTRY_LIGHT_BUILD') == '1'
 
 
 def get_requirements(env):
-    with open('requirements-{}.txt'.format(env)) as fp:
+    with open(u'requirements-{}.txt'.format(env)) as fp:
         return [x.strip() for x in fp.read().split('\n') if not x.startswith('#')]
 
 
@@ -79,7 +79,7 @@ optional_requires = get_requirements('optional')
 DJANGO_VERSION = os.environ.get('DJANGO_VERSION')
 if DJANGO_VERSION:
     install_requires = [
-        'Django{}'.format(DJANGO_VERSION)
+        u'Django{}'.format(DJANGO_VERSION)
         if r.startswith('Django>=') else r
         for r in install_requires
     ]

+ 1 - 1
src/sentry/admin.py

@@ -31,7 +31,7 @@ class OptionAdmin(admin.ModelAdmin):
     search_fields = ('key', )
 
     def value_repr(self, instance):
-        return '<pre style="display:inline-block;white-space:pre-wrap;">{}</pre>'.format(
+        return u'<pre style="display:inline-block;white-space:pre-wrap;">{}</pre>'.format(
             escape(saferepr(instance.value))
         )
 

+ 1 - 1
src/sentry/api/base.py

@@ -68,7 +68,7 @@ class Endpoint(APIView):
         )
         base_url = absolute_uri(urlquote(request.path))
         if querystring:
-            base_url = '{0}?{1}'.format(base_url, querystring)
+            base_url = u'{0}?{1}'.format(base_url, querystring)
         else:
             base_url = base_url + '?'
 

+ 1 - 1
src/sentry/api/endpoints/event_apple_crash_report.py

@@ -68,7 +68,7 @@ class EventAppleCrashReportEndpoint(Endpoint):
                                 content_type='text/plain')
 
         if request.GET.get('download') is not None:
-            filename = "{}{}.crash".format(
+            filename = u"{}{}.crash".format(
                 event.event_id, symbolicated and '-symbolicated' or '')
             response = StreamingHttpResponse(
                 apple_crash_report_string,

+ 1 - 1
src/sentry/api/endpoints/group_details.py

@@ -333,7 +333,7 @@ class GroupDetailsEndpoint(GroupEndpoint, EnvironmentMixin):
         # endpoint
         try:
             response = client.put(
-                path='/projects/{}/{}/issues/'.format(
+                path=u'/projects/{}/{}/issues/'.format(
                     group.project.organization.slug,
                     group.project.slug,
                 ),

+ 1 - 1
src/sentry/api/endpoints/group_events_latest.py

@@ -37,6 +37,6 @@ class GroupEventsLatestEndpoint(GroupEndpoint):
             return Response({'detail': 'No events found for group'}, status=404)
 
         try:
-            return client.get('/events/{}/'.format(event.id), request=request)
+            return client.get(u'/events/{}/'.format(event.id), request=request)
         except client.ApiError as e:
             return Response(e.body, status=e.status_code)

+ 1 - 1
src/sentry/api/endpoints/group_events_oldest.py

@@ -37,6 +37,6 @@ class GroupEventsOldestEndpoint(GroupEndpoint):
             return Response({'detail': 'No events found for group'}, status=404)
 
         try:
-            return client.get('/events/{}/'.format(event.id), request=request)
+            return client.get(u'/events/{}/'.format(event.id), request=request)
         except client.ApiError as e:
             return Response(e.body, status=e.status_code)

+ 1 - 1
src/sentry/api/endpoints/organization_avatar.py

@@ -11,4 +11,4 @@ class OrganizationAvatarEndpoint(AvatarMixin, OrganizationEndpoint):
 
     def get_avatar_filename(self, obj):
         # for consistency with organization details endpoint
-        return '{}.png'.format(obj.slug)
+        return u'{}.png'.format(obj.slug)

+ 1 - 1
src/sentry/api/endpoints/organization_details.py

@@ -244,7 +244,7 @@ class OrganizationSerializer(serializers.Serializer):
                 relation={'organization': org},
                 type=self.init_data.get('avatarType', 'upload'),
                 avatar=self.init_data.get('avatar'),
-                filename='{}.png'.format(org.slug),
+                filename=u'{}.png'.format(org.slug),
             )
         if 'require2FA' in self.init_data and self.init_data['require2FA'] is True:
             org.handle_2fa_required(self.context['request'])

+ 1 - 1
src/sentry/api/endpoints/organization_member_index.py

@@ -150,7 +150,7 @@ class OrganizationMemberIndexEndpoint(OrganizationEndpoint):
         except IntegrityError:
             return Response({'email': 'The user %s is already a member' % result['email']}, 409)
 
-        lock = locks.get('org:member:{}'.format(om.id), duration=5)
+        lock = locks.get(u'org:member:{}'.format(om.id), duration=5)
         with TimedRetryPolicy(10)(lock.acquire):
             self.save_team_assignments(om, teams)
 

Some files were not shown because too many files changed in this diff