Flatten any multi-level nested iterable, and return a new iterable.
after installing the requirements, just run py.test tests.py
, it will generate several test cases automatically
import argparse | |
from i3ipc import Connection | |
sway = Connection() | |
outputs = [o for o in sway.get_outputs() if o.active] | |
def focus_monitor(args): | |
indices = {"left": 0, "center": 1, "right": 2} | |
orientation = indices[args.orientation] |
from .initialize import setup_cache | |
from .connections import connection | |
@app.on_event('startup') | |
async def setup_connections(): | |
await setup_cache() | |
@app.middleware("http") | |
async def connections_middleware(request, call_next): |
import logging | |
from django.contrib.gis.db.backends.postgis.base import \ | |
DatabaseWrapper as PostgisDBWrapper | |
from django.db import ProgrammingError | |
from .schema import TimescaleSchemaEditor | |
logger = logging.getLogger(__name__) |
from django.db.models.sql.compiler import SQLCompiler | |
from django.db.models.sql.constants import NO_RESULTS | |
class DropChunkCompiler(SQLCompiler): | |
def as_sql(self): | |
result = 'SELECT drop_chunks(interval %s, %s)' | |
return result, [self.query.interval, self.query.db_table] | |
def execute_sql(self, result_type=NO_RESULTS, *args, **kwargs): |
import XMonad | |
import XMonad.Config.Desktop | |
import XMonad.Config.Mate | |
import XMonad.Hooks.EwmhDesktops | |
import XMonad.Hooks.DynamicLog | |
import XMonad.Hooks.ManageDocks | |
import XMonad.Hooks.InsertPosition | |
import XMonad.Util.Run(spawnPipe) | |
import XMonad.Util.EZConfig(additionalKeysP) | |
import XMonad.Actions.FloatKeys |
javascript:(function(){ | |
$('a.lecture-link').each(function (index){ | |
var $lectureLink = $(this); | |
var videoLink = $lectureLink.attr('href').replace('view','download.mp4'); | |
var subtitleLink = $lectureLink.attr('href').trim().replace('view','subtitles').replace('lecture_id', 'q') + "_en"; | |
var videoName = '\"' + (index+1) + '.' + $lectureLink.text().trim() + '.mp4\"'; | |
var subtitleName = '\"' + (index+1) + '.' + $lectureLink.text().trim() + '.srt\"'; | |
var cookieHeader = ' --header \"Cookie:'+ document.cookie + '\" '; | |
console.log('curl -L' + cookieHeader + videoLink + ' > ' + videoName); | |
console.log('curl -L' + cookieHeader + subtitleLink + ' > ' + subtitleName); |