Brief description of what this PR does, and why it is needed.
Fixes #XXX
Optional. Screenshots, curl examples, etc.
| def safeget(dct, *keys): | |
| dct = dict(dct) | |
| for key in keys: | |
| try: | |
| dct = dct[key] | |
| except (KeyError, AttributeError, TypeError) as e: | |
| return None | |
| return dct |
| # ~/.tmuxinator/health.yml | |
| name: health | |
| root: ~/code/health/ | |
| # Optional tmux socket | |
| # socket_name: foo | |
| # Runs before everything. Use it to start daemons etc. | |
| pre: |
| from apistar import App, Include, Route, schema | |
| from apistar.docs import docs_routes | |
| from apistar.http import Response | |
| from apistar.statics import static_routes | |
| _hotdogs = ['hotdog', 'hotdogs'] | |
| class Hotdog(schema.String): |
| {"lastUpload":"2018-07-05T17:21:35.097Z","extensionVersion":"v2.9.2"} |
| class Car(models.Model): | |
| COLOR_CHOICES = ( | |
| ('RED', 'red'), | |
| ('WHITE', 'white'), | |
| ('BLUE', 'blue'), | |
| ) | |
| color = models.CharField(max_length=5, choices=COLOR_CHOICES, default='RED') | |
| # ... |
| int REED_PIN = D0; | |
| int MOTOR_PIN = D3; | |
| int LED_PIN = D7; | |
| int MOTOR_SPEED = 255; | |
| void setup() { | |
| pinMode(LED_PIN, OUTPUT); | |
| pinMode(REED_PIN, INPUT_PULLUP); | |
| pinMode(MOTOR_PIN, OUTPUT); | |
| } |
| {"lastUpload":"2022-01-25T01:47:36.730Z","extensionVersion":"v3.4.3"} |
| import base64 | |
| import pickle | |
| from django.contrib.sessions.models import Session | |
| from django.utils.encoding import force_unicode | |
| def decode_session_data(session_key): | |
| """Decode the data in a session object stored under ``session_key``. |
| import logging | |
| import time | |
| import typing as T | |
| from cProfile import Profile | |
| log = logging.getLogger(__name__) | |