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 python | |
import re | |
import sys | |
from argparse import ArgumentParser | |
from google.cloud import datastore | |
def get_client(project: str, database: str | None) -> datastore.Client: | |
return datastore.Client(project=project, database=database) |
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 | |
import json | |
import os | |
from typing import Callable, Mapping | |
FUNCTIONS: Mapping[str, Callable[..., str]] = { | |
"concat": lambda *args: "".join(args), | |
"json_object": lambda **kwargs: json.dumps(kwargs), | |
"env": lambda name: os.getenv(name, ""), | |
"format": lambda fmt, *args, **kwargs: fmt.format(*args, **kwargs), |
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
diff --git a/backend/apps/api/versions/v1/urls.py b/backend/apps/api/versions/v1/urls.py | |
index af63485..2980116 100644 | |
--- a/backend/apps/api/versions/v1/urls.py | |
+++ b/backend/apps/api/versions/v1/urls.py | |
@@ -83,7 +83,7 @@ urlpatterns = [ | |
name="source-objects", | |
), | |
path( | |
- "source/<int:source_id>/objects/<int:object_id>/", | |
+ "source/<int:source_id>/objects/<int:pk>/", |
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 tornado.httpclient import HTTPRequest | |
import timeit | |
from collections import deque | |
class View: | |
pass | |
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 blah(data []map[string]interface{}) map[string]string { | |
result := make(map[string]string) | |
for _, item := range data { | |
tagTypeName := item["tag_type_name"].(string) | |
tagName := item["tag_name"].(string) | |
if tagTypeName == "profanity_status" { |
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 functools import update_wrapper | |
class call_count: | |
def __init__(self, name): | |
self.__name = name | |
self.__count = 0 | |
def __call__(self, fn, *args, **kwargs): | |
def wrapper(*args, **kwargs): |
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 genInts(count int) (ints chan int, quit chan bool) { | |
ints, quit = make(chan int), make(chan bool) | |
go func() { | |
defer close(ints) |
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 time | |
import asyncio | |
from functools import wraps | |
from timeit import default_timer | |
def time_it(fn): | |
if asyncio.iscoroutinefunction(fn): | |
@wraps(fn) | |
async def wrapper(*args, **kwargs): |
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 pkgutil | |
def get_test_routes(): | |
from tests import routes | |
test_modules = [] | |
for importer in pkgutil.iter_modules(routes.__path__): | |
if importer.ispkg is False: | |
print(f"Loading test routes for {importer.name}") | |
test_modules.append(importer.module_finder.find_module(importer.name).load_module(importer.name)) |
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 | |
import argparse | |
import subprocess | |
import sys | |
from collections import defaultdict | |
from statistics import mean | |
HELP = """Usage: wrkd <options> <url> |
NewerOlder