I hereby claim:
- I am mvantellingen on github.
- I am mvantellingen (https://keybase.io/mvantellingen) on keybase.
- I have a public key ASC8-eS38tVDJR4p9Evixizm-G08LMoxSc786Jew1rVcwAo
To claim this, I am signing this object:
# type Product string | |
f := jen.NewFile("mypackage") | |
f.Type().Id("Product).String().Line() | |
f.Save("output.go") |
type Price struct { | |
ID string `json:"id,omitempty"` | |
} |
#%RAML 1.0 DataType | |
(package): Common | |
displayName: Price | |
type: object | |
properties: | |
id?: | |
type: string | |
value: | |
type: Money | |
country?: |
func (obj *ScopedPrice) UnmarshalJSON(data []byte) error { | |
type Alias ScopedPrice | |
if err := json.Unmarshal(data, (*Alias)(obj)); err != nil { | |
return err | |
} | |
if obj.Value != nil { | |
obj.Value = mapDiscriminatorTypedMoney(obj.Value) | |
} | |
return nil | |
} |
import attr, marshmallow, typing | |
@attr.s(auto_attribs=True, init=False, repr=False) | |
class Price: | |
id: typing.Optional[str] | |
def __init__(self, *, id: typing.Optional[str] = None) -> None: | |
self.id = id | |
class AttributeDefinitionDraftSchema(marshmallow.Schema): | |
type = helpers.Discriminator( | |
discriminator_field=("name", "name"), | |
discriminator_schemas={ | |
"boolean": "AttributeBooleanTypeSchema", | |
"datetime": "AttributeDateTimeTypeSchema", | |
}, | |
unknown=marshmallow.EXCLUDE, | |
allow_none=True | |
) |
>>> import ast, astunparse | |
>>> node = ast.parse("value = {'foo': 'bar'}") | |
>>> print(ast.dump(node)) | |
Module(body=[Assign( | |
targets=[Name(id='value', ctx=Store())], | |
value=Dict(keys=[Str(s='foo')], values=[Str(s='bar')]) | |
)]) | |
>>> code = astunparse.unparse(node) | |
>>> print(code) |
import inspect | |
import logging | |
from collections import defaultdict | |
from wagtail.core import blocks | |
logger = logging.getLogger(__name__) | |
class _FieldCacheManager(): |
from django.apps import AppConfig | |
class CMSConfig(AppConfig): | |
name = 'myproj.apps.cms' | |
def ready(self): | |
from wagtail.wagtailcore.models import Site | |
root_paths = Site.get_site_root_paths() |
I hereby claim:
To claim this, I am signing this object: