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
| def merge(L, R): | |
| arr = [] | |
| while len(R) and len(L): | |
| left = L.pop(0) | |
| right = R.pop(0) | |
| if left < right: | |
| arr.append(left) | |
| R.insert(0, right) | |
| else: | |
| arr.append(right) |
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
| package main | |
| import "fmt" | |
| func split(sum int) (x, y int) { | |
| x = sum * 4 / 9 | |
| y = sum - x | |
| return | |
| } |
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
| # registry name in glue catalog is test and the name of the schema uploaded is topology :) | |
| glue = boto3.client('glue') | |
| result = glue.get_schema_version(SchemaId={'SchemaName': 'topology', 'RegistryName': "test"}, SchemaVersionNumber={"LatestVersion": True}) | |
| print(result['SchemaDefinition']) |
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
| #!/usr/bin/env python3 | |
| from pyvis.network import Network | |
| import networkx as nx | |
| G = nx.MultiDiGraph() | |
| G.add_node(1, label='Node 1', group=1) | |
| G.add_node(2, label='Node 2', group=1) | |
| G.add_node(3, label='Node 3', group=2) | |
| G.add_node(4, label='Node 4', group=2) | |
| G.add_node(5, label='Node 5', group=1) |
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
| from faust.models.fields import FieldDescriptor | |
| class UUIDField(FieldDescriptor[UUID]): | |
| def prepare_value( | |
| self, value: Any, *, coerce: Optional[bool] = None | |
| ) -> Optional[UUID]: | |
| if self.should_coerce(value, coerce): | |
| if value is not None and not isinstance(value, UUID): | |
| return uuid.UUID(value) | |
| else: |
OlderNewer