mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-07-13 09:42:32 +03:00
apply black formatting
This commit is contained in:
parent
4ba3b544c9
commit
6d5cfee94f
|
@ -30,22 +30,26 @@ singledispatch = import_single_dispatch()
|
||||||
|
|
||||||
def _is_dunder(name):
|
def _is_dunder(name):
|
||||||
"""Returns True if a __dunder__ name, False otherwise."""
|
"""Returns True if a __dunder__ name, False otherwise."""
|
||||||
return (len(name) > 4 and
|
return (
|
||||||
name[:2] == name[-2:] == '__' and
|
len(name) > 4
|
||||||
name[2:3] != '_' and
|
and name[:2] == name[-2:] == "__"
|
||||||
name[-3:-2] != '_')
|
and name[2:3] != "_"
|
||||||
|
and name[-3:-2] != "_"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def _is_sunder(name):
|
def _is_sunder(name):
|
||||||
"""Returns True if a _sunder_ name, False otherwise."""
|
"""Returns True if a _sunder_ name, False otherwise."""
|
||||||
return (len(name) > 2 and
|
return (
|
||||||
name[0] == name[-1] == '_' and
|
len(name) > 2
|
||||||
name[1:2] != '_' and
|
and name[0] == name[-1] == "_"
|
||||||
name[-2:-1] != '_')
|
and name[1:2] != "_"
|
||||||
|
and name[-2:-1] != "_"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def convert_choice_name(name):
|
def convert_choice_name(name):
|
||||||
name = force_text(name).encode('utf8').decode('ascii', 'ignore')
|
name = force_text(name).encode("utf8").decode("ascii", "ignore")
|
||||||
name = to_const(name)
|
name = to_const(name)
|
||||||
if _is_sunder(name) or _is_dunder(name):
|
if _is_sunder(name) or _is_dunder(name):
|
||||||
name = "A%s" % name
|
name = "A%s" % name
|
||||||
|
|
|
@ -4,7 +4,7 @@ from __future__ import absolute_import
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
CHOICES = ((1, u"1: this漢"), (2, _(u"2: that漢")), (u'_3漢', "__amount__"))
|
CHOICES = ((1, u"1: this漢"), (2, _(u"2: that漢")), (u"_3漢", "__amount__"))
|
||||||
|
|
||||||
|
|
||||||
class Pet(models.Model):
|
class Pet(models.Model):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user