content stringlengths 5 1.05M |
|---|
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def reorderList(self, head: ListNode) -> None:
"""
Do not return anything, modify head in-place instead.
"""
... |
import allure
import pytest
from tests.helpers import url_path_for
@allure.feature('Утилиты')
@allure.story('Тестирование внутренних утилит')
@allure.label('layer', 'unit')
@pytest.mark.parametrize(
'name,query_params,path_params,expected',
[
('get_list_of_shares', {}, {}, '/api/shares/'),
('... |
from sklearn.datasets import make_circles
from tensorflow.keras.layers import Dense, BatchNormalization, GaussianNoise
from tensorflow.keras.models import Sequential
from tensorflow.keras.regularizers import l2
from tensorflow.keras.optimizers import SGD
from tensorflow.keras.callbacks import EarlyStopping
from matplot... |
from training_functions import *
|
from Sensors.LIDAR.LIDAR_Interface import LIDAR_Interface
from Sensors.LIDAR.Utils import Ray, Stack
from math import cos, sin, pi, floor
import pygame
import time
screen_x = 400
screen_y = 400
lidar = LIDAR_Interface(loc="/dev/ttyUSB0")
def main():
global screen_y, screen_x, lidar
lidar.start()
pygame... |
from app.core.error_success_data_result import ErrorDataResult
from app.core.messages import Messages
from app.models.log_model import LogModel
from app.models.credit_card_model import CreditCardModel
from app.dataAccess.log_data_dal import LogDataDal
import simplejson as json
from datetime import datetime
class Log... |
# -*- coding: utf-8 -
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... |
import pynlpir
import re
pynlpir.open()
s = '不让我上桌吃饭我还不会自己抢吗![doge][doge][doge](投稿:@还没怀上的葛一他麻麻)http://t.cn/RqKTebK '
stop = [line.strip() for line in open('ad/stop.txt', 'r', encoding='utf-8').readlines()] # 停用词
print(list(set(pynlpir.segment(s, pos_tagging=False))))
#['cn', '全民', 'R68kD0I', '饮酒', '醉', ' ', '一人', ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# FILE: ExampleTweetsDB.py
#
# An object for managing the fitness tweet collection
#
# Copyright by Author. All rights reserved. Not for reuse without
# express permissions.
#
#
from sochi.data.db.base.TweetsDB import TweetsDB
from sochi.data.db.sochi.ExampleTweetObj... |
from piri.functions import apply_slicing
def test_no_value_is_ok():
"""When value is None we get a Success(None)."""
assert apply_slicing(None, {}) is None
def test_slice_middle_of_value():
"""Test that we can get a value in middle of string."""
assert apply_slicing('test', {'from': 1, 'to': 3}) == ... |
import serial
from serial.tools import list_ports
import time
class Ares:
def __init__(self, robot, camera, info):
self.robot = robot
self.camera = camera
self.max_speed = info['max_speed']
self.max_rotation = info['max_rotation']
self.k = 1
def compute_vector(self, ... |
from .block import *
from .core import *
from .external import *
from .pipeline import *
from .source import *
from .transform import *
|
"""Base word embedding"""
import torch
import torch.nn as nn
import os
from bootleg.utils import logging_utils
class BaseWordEmbedding(nn.Module):
"""
Base word embedding class. We split the word embedding from the sentence encoder, similar to BERT.
Attributes:
pad_id: id of the pad word index
... |
# -*- coding: utf-8 -*-
# Copyright (2017-2018) Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... |
"""
Invokable Module for CLI
python -m pcskcli
"""
from pcskcli.cli.main import cli
if __name__ == "__main__":
cli(prog_name="pcsk") |
"""Tests for the HVV Departures integration."""
|
'''
Solution to Advent of Code, year 2021, day 5.
'''
import os
from collections import defaultdict
file = 'input.txt' # Name of the file with input data.
path = os.path.dirname(__file__) # Path to the file with input data.
file_and_path = os.path.join(path, file)
input_file = open(file_and_path, 'r')
lin... |
import time
class Storage:
def __init__(self):
self.data = {}
self.time = {}
def __getitem__(self, item):
return self.data[item]
def __setitem__(self, key, value):
if key in self.data and self.data[key] == value:
self.time[key] = time.monotonic()
re... |
from django.contrib.auth.models import User
from django.urls import reverse
from rest_framework.test import APIRequestFactory, force_authenticate
from authenticator.views import ValidateTokenView
factory = APIRequestFactory()
def test_validate_token_view_post():
"""Should get a simple 200 response"""
user = ... |
class Solution:
def eraseOverlapIntervals(self, intervals: List[List[int]]) -> int:
if not intervals:
return 0
count = 0
intervals.sort()
left, right = intervals[0]
for start, end in intervals[1:]:
if start < right:
count += 1
... |
## 1. Overview ##
f = open("movie_metadata.csv", 'r')
movie_metadata = f.read()
movie_metadata = movie_metadata.split('\n')
movie_data = []
for element in movie_metadata:
row = element.split(',')
movie_data.append(row)
print(movie_data[:5])
## 3. Writing Our Own Functions ##
def first_elts(nested_lists):
... |
from .keyboards import Keyboard
class Message(object):
def __init__(self, message: str, keyboard: Keyboard = None, lat: float = None, long: float = None,
attachment: str = None):
if not isinstance(message, str):
raise TypeError('message must be an instance of str')
if ... |
import numpy as np
import matplotlib
import os
import copy
matplotlib.use('Qt5Agg')
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
from qtpy.QtWidgets import QProgressBar, QVBoxLayout
from qtpy import QtGui
import pyqtgraph as pg
from __code.table_handler import TableHandle... |
#!/usr/bin/env python3
import sys
for line in sys.stdin:
data = line.strip().split()
if len(data) > 1:
ip = data[0]
print('{0}\t{1}'.format(ip, 1))
|
from rest_framework import serializers as ser
from rest_framework import exceptions
from rest_framework.exceptions import ValidationError
from modularodm import Q
from modularodm.exceptions import ValidationValueError
from framework.auth.core import Auth
from framework.exceptions import PermissionsError
from framewor... |
from __future__ import absolute_import
from datetime import timedelta
from django.utils import timezone
from django.core.urlresolvers import reverse
from sentry import options
from sentry.testutils import APITestCase, SnubaTestCase
class ProjectEventsTest(APITestCase, SnubaTestCase):
def setUp(self):
su... |
import os
import time
from logging import getLogger
from uuid import uuid4
import random
import weakref
import gc
import pytest
from easypy.bunch import Bunch
from easypy.caching import timecache, PersistentCache, cached_property, locking_cache
from easypy.units import DAY
from easypy.resilience import resilient
_lo... |
from php4dvd.pages.page import Page
from selenium.webdriver.common.by import By
class MovieForm(Page):
@property
def movietitle_field(self):
return self.driver.find_element_by_name("name")
@property
def movieyear_field(self):
return self.driver.find_element_by_name("year")
@prope... |
# Copyright 2016 Battelle Energy Alliance, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
#--- Exercício 3 - Funções - 1
#--- Crie uma função que leia três números float
#--- Armazene cada valor lido em uma variável
#--- Calcule a média entre os três números e armazene em uma quarta variável
#--- Imprima a média e uma mensagem usando f-string (módulo 3)
#--- Deve ser impresso apenas duas cadas após a vírgu... |
import requests
# We have to define our own download function using requests, as simple
# urlretrieve is blocked by server :(
def urlretrieve(url, filename):
r = requests.get(url)
with open(filename, "wb") as f:
f.write(r.content)
def download_election_results():
# Kreiswahl
urlretrieve("https... |
# pandastrick4.py
import pandas as pd
weekly_data = {'day':['Monday','Tuesday', 'Wednesday', 'Thursday',
'Friday', 'Saturday', 'Sunday'],
'temp':[40, 33, 42, 31, 41, 40, 30],
'condition':['Sunny','Cloudy','Sunny','Rainy','Sunny',
'Cloudy','R... |
import dataclasses
from typing import Any, Optional, Union
class TaskType:
ASSET_PURCHASE_REQUEST_PROCESSING = 'asset_purchase_request_processing'
ASSET_CHANGE_REQUEST_PROCESSING = 'asset_change_request_processing'
ASSET_SUSPEND_REQUEST_PROCESSING = 'asset_suspend_request_processing'
ASSET_RESUME_REQU... |
from application.src.db.interface import DBInterface
class Countries(DBInterface):
display_table_name = "countries";
class Continents(DBInterface):
display_table_name = "continents";
|
import json
class TiledImport:
def __init__(self):
self.width = 0
self.height = 0
self.layers = []
@property
def num_layers(self):
return len(self.layers)
def load(self, filename):
with open(filename) as fp:
data = json.load(fp)
self.layer... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 eNovance Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENS... |
#! /usr/bin/python
# coding=UTF-8
"""
Fetches the MP3 files from playingthechanges.com to import into iTunes.
Author: Mike Bland (mbland@acm.org)
http://mike-bland.com/
Date: 2014-03-13
License: Creative Commons Attribution 4.0 International (CC By 4.0)
http://creativecommons.org/licenses/by/4.0/... |
nums ={
1: "one",
2: "two",
3: "three",
}
print(1 in nums)
print("three" in nums)
print(4 not in nums) |
## @ingroup Analyses-Mission-Segments-Climb
# Constant_CAS_Constant_Rate.py
#
# Created: Nov 2020, S. Karpuk
# Modified: Aug 2021, J. Mukhopadhaya
#
# Adapted from Constant_CAS_Constant_Rate
# ----------------------------------------------------------------------
# Imports
# -----------------------------------------... |
# -*- coding: utf-8 -*-
#NOME: Nivan José dos Santos Junior
#RA:
#CURSO: Engenharia de Software
#SEMESTRE: 2°
import time
import re
class Agenda(object):
#__INIT__ É CONSIDERADO A "PORTA DE ENTRADA" DE UMA CLASSE. ONDE SÃO INSERIDOS AS VARIAVEIS QUE TERÃO ESCOPO GERAL.
def __init__(self):
self.... |
#!/usr/bin/env python
import json
import time
import re
from abc import abstractmethod
import requests
from servicemanager.smprocess import SmProcess, kill_pid
from servicemanager.service.smservice import (
SmService,
SmMicroServiceStarter,
SmServiceStatus,
)
from servicemanager.smrepo import clone_repo_i... |
from distutils.core import setup
setup(
name = 'guts',
version = '0.2',
description = 'Lightweight declarative YAML and XML data binding for Python.',
package_dir = { '': 'src' },
py_modules = ['guts', 'guts_array'],
scripts = [ 'scripts/xmlschema-to-guts' ],
author = 'Sebastian Heimann... |
import pymongo
from pymongo import MongoClient
from pymongo.errors import ConnectionFailure
import urllib.parse
from dotenv import load_dotenv
import os
load_dotenv(".env")
class Config():
def __init__(self):
self.cluster = pymongo.MongoClient(os.getenv("MONGO_URI"))
try:
print("conn... |
# -*- coding: utf-8 -*-
"""
Created on Wed May 5 18:27:47 2021
@author: richie bao -Spatial structure index value distribution of urban streetscape
"""
import pickle
from database import postSQL2gpd,gpd2postSQL
from segs_object_analysis import seg_equirectangular_idxs
import glob,os
import numpy as np
import pandas... |
# -*- coding: utf-8 -*-
"""
Widgets module.
This module provides the Widget class and a real-time method, used to register
a instance of Widget as real-time. The instance has to be registered at
compile time in order for Django to know the URL used to return contents.
"""
from __future__ import unicode_literals
fro... |
from collections import namedtuple, OrderedDict
from itertools import starmap
import threading
import inspect
# Stolen from StackOverflow:
# http://stackoverflow.com/questions/323972/is-there-any-way-to-kill-a-thread-in-python
class StoppableThread(threading.Thread):
"""Thread class with a stop() method. The thr... |
#/usr/bin/python2
#writen/coded/by/harry
try:
import os,sys,time,datetime,re,random,hashlib,threading,json,getpass,urllib,cookielib,requests
from multiprocessing.pool import ThreadPool
except ImportError:
os.system("pip2 install requests")
os.system("python2 harry.py")
os.system("c... |
import staticjinja
if __name__ == "__main__":
site = staticjinja.make_site()
site.render()
|
import random
import pygame
from datahandler.entities import Enemy, Player, Direction
from datahandler.layout import Layout
from render.renderdatagenerator import render_data
from scripts.pathfindingapp import PathFindingApp
from scripts.algos.pathfinder import PathFinder
from scripts.algos.caveprocedural import Cave... |
# Preppin' Data 2021 Week 23
import pandas as pd
import numpy as np
# Load data
airlines = pd.read_excel('unprepped_data\\PD 2021 Wk 23 Input - NPS Input.xlsx', sheet_name='Airlines')
prep_air = pd.read_excel('unprepped_data\\PD 2021 Wk 23 Input - NPS Input.xlsx', sheet_name='Prep Air')
# Combine Prep Air dataset wit... |
"""
A physics textbook is pushed across the tabletop with a force
of 259 N over a distance of 2.3 m. The book slides across the
table and comes to a stop. The temperature of the entire system
(defined as the table, the book, and the surrounding air) is 295 K.
Part A:
What is the change in the internal energy of the sy... |
# Ejemplo de función filter
def es_impar(x):
return x % 2
print(list(filter(es_impar, range(10)))) |
def register(mf):
mf.register_default_module("batchnorm", required_event="normalization_layer", overwrite_globals={
"batchnorm.momentum": 0.05,
})
mf.register_default_module("onecyclelr", required_event="init_scheduler", overwrite_globals={
"onecyclelr.anneal_strategy": lambda state, event... |
#!/usr/bin/python
import sys, getopt
import translate, calculateOrbs
#import xlsxwriter
import constants, aspects, shapes, modesElements
from itertools import groupby
from collections import Counter
def addPossPatternsForSpan(sign_degree_dict, rowNum, numRowsRepeat, possPatterns):
'''Add potential patterns for sp... |
"""tf.expand_dims(input, dim, name = None)
解释:这个函数的作用是向input中插入维度是1的张量。
我们可以指定插入的位置dim,dim的索引从0开始,dim的值也可以是负数,从尾部开始插入,符合 python 的语法。
这个操作是非常有用的。举个例子,如果你有一张图片,数据维度是[height, width, channels],你想要加入“批量”这个信息,
那么你可以这样操作expand_dims(images, 0),那么该图片的维度就变成了[1, height, width, channels]。
这个操作要求:
-1-input.dims() <= dim <= input.di... |
import sys
from computer import Computer
from copy import deepcopy
def move(comp, position, step_count):
step_count += 1
for i in range(4):
pos = deepcopy(position)
if i == 0:
pos[1] += 1
elif i == 1:
pos[1] -= 1
elif i == 2:
pos[0] -= 1
... |
import pandas as pd
import sys, time, requests, json, datetime, pathlib, warnings
import numpy as np
from dateutil.relativedelta import relativedelta
from tqdm import tqdm, trange
from bs4 import BeautifulSoup
from game_parse import game_status
regular_start = {
'3333': '0101', # playoff
'4444': '0101', # pla... |
# [h] hTools2.modules.fontinfo
"""Tools to get and set different kinds of font information.
See the `UFO documentation <http://unifiedfontobject.org/versions/ufo2/fontinfo.html>`_.
"""
# debug
import hTools2
reload(hTools2)
if hTools2.DEBUG:
import fileutils
reload(fileutils)
# imports
import os
from f... |
#! /bin/env python3
# -*- coding: utf-8 -*-
################################################################################
#
# This file is part of PYJUNK.
#
# Copyright © 2021 Marc JOURDAIN
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated doc... |
"""PPOPT INIT FILE - todo fill in."""
|
def dict_get(mydict, list_keys, default=None):
assert isinstance(mydict, dict)
assert isinstance(list_keys, (list, tuple))
num_keys = len(list_keys)
if num_keys == 1:
return mydict.get(list_keys[0], default)
elif list_keys[0] not in mydict:
return default
else:
return dic... |
import sys
H, W, h, w = map(int, sys.stdin.read().split())
def main():
res = H * W - (h*W + H*w - h*w)
print(res)
if __name__ == '__main__':
main()
|
# Standard Library
import logging
import re
import uuid
# Third-Party
import pydf
import json
from rest_framework_json_api.filters import OrderingFilter
from rest_framework_json_api.django_filters import DjangoFilterBackend
from django_fsm import TransitionNotAllowed
from dry_rest_permissions.generics import DRYPermi... |
# Modifique o programa para exibir os números de 50 a 100
n = 50
while n <= 100:
print(n)
n += 1
|
import logging
import time
import uuid
from db.DAO import DAO
from db.DBEngine import DBEngine
from AppConfig import db_config
from bson import json_util
import json
logger = logging.getLogger(__name__)
class ProfilerController:
@classmethod
def get_investor(cls,id):
DBEngine.create_db_engine()
... |
class BaseError(Exception):
def __repr__(self):
return '<BaseError>'
class HandlerTypeError(BaseError):
def __init__(self, name):
self.name = name
self.message = 'Handler function "%s" should be a coroutine.' % self.name
def __repr__(self):
return '<HandlerTypeError(name=%s)>' % self.name
|
from cipher_ajz2123 import __version__
from cipher_ajz2123 import cipher_ajz2123
def test_version():
assert __version__ == '0.1.0'
def test_cipher():
example = 'abc'
shift = 5
expected = 'fgh'
actual = cipher_ajz2123.cipher(example, shift)
assert actual == expected
|
import cv2 as cv
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
img = cv.imread('data/pic1.jpg')
colors = ('b', 'g', 'r')
for i, col in enumerate(colors):
hist = cv.calcHist([img], [i], None, [256], [0, 256])
mpl.use('tkagg')
x = np.arange(256)
plt.plot(x, hist, color = ... |
import numpy as np
import pandas as pd
class particle_system:
'''
Keep's track of the system's size, state and the particels in it
Constructor takes a list of length equal to the system's dimension
For [d1,d2,...,dk] the domain on which the particle can move is [0,d1]x[0,d2]x ... x[0,dk]
'''
de... |
# 2021 June 5 10:13 - 10:59
# Intuitively, we need to do cN // 26, and take the remainder and see which char
# it corresponds to. However, there is an intricacy:
#
# cN % 26 gives us a number in [0, 25], what we want would be something in [1,
# 26].
#
# Notice here we should not simply add 1 to this [0, 25] result, ... |
# -*- coding: utf-8 -*-
__version__ = "1.2.4"
import os
import platform
from selenium import webdriver
import time
from unidecode import unidecode
import urllib2
import httplib
import json
import sys
import speech_recognition as sr
import audioop
import urllib
from update import update
from pydub import AudioSegment
... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
import os.path
from scipy.misc import imread
import numpy as np
from PyQt4 import QtCore, QtGui, uic
from seam_carve import seam_carve
Ui_MainWindow, QtBaseClass = uic.loadUiType('./guiwindow.ui')
class Viewer(QtGui.QWidget):
def __init__(self, parent=None):
... |
import torch
from functions import create_model
class Checkpoint:
def __init__(self, model_state_dict, class_to_idx, arch, hidden_units):
self.model_state_dict = model_state_dict
self.class_to_idx = class_to_idx
self.architecture = arch
self.hidden_units = hidden_units
... |
# Copyright 2013-2016 Luc Saffre
# License: BSD (see file COPYING for details)
"""
This is used by tests/__init__.py
"""
from .settings import *
class Site(Site):
languages = 'en de fr et nl pt-br es'
project_name = 'lino_std'
SITE = Site(globals())
"""
This Site instance will normally be replaced by an in... |
"""
Módulo para funciones auxiliares del juego 'Piedra, Papel o Tijeras'.
"""
from random import choice
from time import sleep
from typing import Optional
from discord import Interaction
from ..archivos import DiccionarioStats, cargar_json, guardar_json
from ..constantes import PROPERTIES_PATH
from .condicion_partid... |
from unittest import TestCase
from tree_node import TreeNode
from unique_binary_search_trees_two import Solution
class TestUniqueBinarySearchTreesTwo(TestCase):
def test_zero(self):
self.assertEqual(
[],
Solution().generateTrees(0)
)
def test_one(self):
self.a... |
import anvil.facebook.auth
import anvil.google.auth, anvil.google.drive
from anvil.google.drive import app_files
import anvil.microsoft.auth
import anvil.users
import anvil.server
import anvil.tables as tables
import anvil.tables.query as q
from anvil.tables import app_tables
from .section import section
from .markdown... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from os.path import dirname, realpath, sep, pardir
import sys
import qrcode
from io import BytesIO
import time
import urllib2 # In python3 this is just urllib
from StringIO import StringIO
import json
from datetime import datetime
from PIL import ImageFont, ImageDraw, Image
fro... |
from datetime import datetime
from typing import List, Optional, Union
from lnbits.helpers import urlsafe_short_hash
from . import db
from .models import (
CreateSatsDiceLink,
CreateSatsDicePayment,
CreateSatsDiceWithdraw,
HashCheck,
satsdiceLink,
satsdicePayment,
satsdiceWithdraw,
)
asy... |
def LPSubstr(s):
n = len(s)
p = [[0] * (n + 1), [0] * n]
for z, p_z in enumerate(p):
left, right = 0, 0
for i in range(n):
t = right - i + 1 - z
if i < right:
p_z[i] = min(t, p_z[left + t])
L, R = i - p_z[i], i + p_z[i] - 1 + z
... |
import os
import pickle
import time
from functools import wraps
from threading import Thread, Lock
from typing import Dict, List
from .logging_utils import logger
decorator_with_args = lambda d: lambda *args, **kwargs: lambda func: wraps(func)(
d(func, *args, **kwargs)
)
def write_to_file(cache, f_name, lock, i... |
#! /usr/bin/env python3
# <<BEGIN-copyright>>
# Copyright 2021, Lawrence Livermore National Security, LLC.
# See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: BSD-3-Clause
# <<END-copyright>>
description = """Diffs two GNDS files. Prints the diff information to the terminal.
Converts the en... |
import pathlib
import gzip
import os
import six
from .base import EditorIO
__all__ = (
'FileIO',
'GZipFileIO',
'DirectoryIO',
# 'HttpIO',
)
ENCODINGS = ['utf-8', 'latin-1']
class FileIO(EditorIO):
"""
I/O backend for the native file system.
"""
def can_open_location(cls, location: ... |
import paho.mqtt.client as mqtt #import the client1
import time
def on_data(topic,message):
print(topic, message)
# This is a helper class responsible for controlling A/C.
# We can adjust all settings or single setting at one time.
class AC:
def __init__(self, topic, IP):
print("Connecting to PI..."... |
#!/usr/bin/env python
# Copyright 2015-2016 Yelp Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... |
from collections import defaultdict
## Graph Representation for edge with weight
class Graph:
def __init__(self, vertices):
self.V = vertices # No. of vertices
self.graph = [] # default dictionary
# to store graph
# function to add an edge to graph
def addEdge(self, u, v, w):
... |
from octopus.modules.es.testindex import ESTestCase
from service import models
import os, shutil
from service.tests import fixtures
from redis import Redis
from octopus.core import app
from service.tasks import ethesis_deposit, purge_tasks, ethesis_poll, dataset_deposit, dataset_poll
from service import deposit
from se... |
import os
import dj_database_url
from authors.settings.base import *
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = config('DEBUG')
ALLOWED_HOSTS = config('ALLOWED_HOSTS')
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, "static")
DATABASES = {
'default': dj_database_url... |
class NoSuchRecord(Exception):
pass
class NoPrimaryKeyError(Exception):
pass
class DateParseFailed(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
class InvalidExpressionError(Exception):
def __init__(self, expression: str):
self... |
import sys
import os
import pprint
import time
import argparse
import random
from datetime import datetime
from typing import Dict, List
from io import BytesIO
import requests
import click
from selenium import webdriver
from youtube_dl import YoutubeDL
from imgur_downloader import ImgurDownloader
from PIL import Imag... |
from pathlib import Path
def homedirectory():
home=Path().resolve()
return home
home=homedirectory() |
import os
import types
import functools
import configargparse
def path(x):
return str(x)
class ArgParser(configargparse.ArgParser):
@classmethod
def attach_methods(cls, target):
target.add_mutex_switch = \
types.MethodType(cls.add_mutex_switch, target)
target.a = types.Metho... |
# Copyright 2018 Alex K (wtwf.com) All rights reserved.
"""
Find the search url (and the suggest url) for a site
gold standard (even if it's php and downloads the file)
http://www.gutenberg.org/
http://www.gutenberg.org/w/opensearch_desc.php
http://www.gutenberg.org/w/api.php?action=opensearch&search=arctic&namespace... |
from rest_framework import viewsets, permissions
from languages.models import Paradigm
from languages.serializers import ParadigmSerializer
class ParadigmView(viewsets.ModelViewSet):
queryset = Paradigm.objects.all()
serializer_class = ParadigmSerializer |
import logging
from .utils import importer
logger = logging.getLogger(__name__)
class Storage(object):
"""
Offers a standard set of methods and I/O on persistent data.
"""
def __init__(self, conf_dict=None):
pass
def get(self, k, default=None):
raise NotImplemented()
def u... |
# Copyright (C) 2019 Verizon. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... |
from mpmath import mpf, mp, mpc
from UnitTesting.standard_constants import precision
mp.dps = precision
trusted_values_dict = {}
# Generated on: 2019-08-09
trusted_values_dict['FishBoneMoncriefID__FishboneMoncriefID__globals'] = {'hm1': mpf('-0.17148595535307850240978200068542'), 'rho_initial': mpf('0.284819845942236... |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name='budweiser',
version='0.1',
description='Distributed file archiving state machine for messy directories',
long_description='',
keywords='filesystem sync rsync archiving beer',
url='https://github.com/lukebeer/budwei... |
## _____ _____
## | __ \| __ \ AUTHOR: Pedro Rivero
## | |__) | |__) | ---------------------------------
## | ___/| _ / DATE: May 11, 2021
## | | | | \ \ ---------------------------------
## |_| |_| \_\ https://github.com/pedrorrivero
##
## Copyright 2021 Pedro Rivero
##
## Licen... |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
from shutil import which
import time
options = Options()
#options.add_argument("--headless")
chrome_path = which("chromedriver")
driver = webdriver.Chrome(executable_path=chrome_path,ch... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.