This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This decorator (rscDecorator) is used to prevent infinite re-renders of | |
* rsc pages. | |
* | |
* See https://github.com/storybookjs/storybook/issues/30317#issuecomment-2615462131 | |
* | |
* Rewritten to be compatible with Storybook 9 | |
*/ | |
let PrevStory: PartialStoryFn<ReactRenderer, object> | null = null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This file re-implements hive's createSupergraphManager to return a fetcher | |
* which uses node's native fetch api. This is required due to errors when | |
* the fetch library used by hive is instrumented by the observability package. | |
* | |
* See https://github.com/graphql-hive/console/issues/6359#issuecomment-2679100600 | |
*/ | |
import type { SupergraphSDLFetcherOptions } from "@graphql-hive/apollo"; | |
import { createHash } from "@graphql-hive/core"; | |
import fetchRetry from "fetch-retry"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# type Product string | |
f := jen.NewFile("mypackage") | |
f.Type().Id("Product).String().Line() | |
f.Save("output.go") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Price struct { | |
ID string `json:"id,omitempty"` | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#%RAML 1.0 DataType | |
(package): Common | |
displayName: Price | |
type: object | |
properties: | |
id?: | |
type: string | |
value: | |
type: Money | |
country?: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AttributeDefinitionDraftSchema(marshmallow.Schema): | |
type = helpers.Discriminator( | |
discriminator_field=("name", "name"), | |
discriminator_schemas={ | |
"boolean": "AttributeBooleanTypeSchema", | |
"datetime": "AttributeDateTimeTypeSchema", | |
}, | |
unknown=marshmallow.EXCLUDE, | |
allow_none=True | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import inspect | |
import logging | |
from collections import defaultdict | |
from wagtail.core import blocks | |
logger = logging.getLogger(__name__) | |
class _FieldCacheManager(): |
NewerOlder