text stringlengths 2 999k |
|---|
from app.models.post import FAQModel, NoticeModel, RuleModel
CATEGORY_MODEL_MAPPING = {
'FAQ': FAQModel,
'NOTICE': NoticeModel,
'RULE': RuleModel
}
|
# myTeam.py
# ---------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to http://ai.berkeley.edu.
#
# A... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import gzip
import pickle
import threading
import warnings
from datetime import datetime
from unittest import skipIf
from botocore.exceptions import ClientError
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from... |
# Copyright (c) 2019 Verizon Media
# 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 require... |
import os
import webbrowser
from invoke import task
def open_browser(path):
try:
from urllib import pathname2url
except:
from urllib.request import pathname2url
webbrowser.open("file://" + pathname2url(os.path.abspath(path)))
@task
def clean_build(c):
"""
Remove build artifacts
... |
# -*- coding: utf-8 -*-
"""
This file is covered by the LICENSING file in the root of this project.
"""
import sys
sys.path.append("..")
from client import app
from . import render
from flask_login import login_required
from client.functions import is_local
@app.route("/manage/create_event")
@login_required
def cr... |
from http.server import HTTPServer
import re
import os.path
import json
import urllib.request
import urllib.error
import urllib.parse
import logging
import math
from .sheetsdecorator import SheetsDecorator
from .messagerouter import MessageRouter
log_file_name = os.path.join('.', 'data', 'stat_log.txt')
player_data_f... |
# This file is part of beets.
# Copyright 2016, Thomas Scholtes.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy,... |
import json
import random
import re
from collections import defaultdict
import sys
import logging
import os
import datetime
import time
from pathlib import Path
from collections import Counter
import unicodedata
from tqdm import tqdm
def ask_yes_or_no(question, interactive=True, default=True):
# Default behaviou... |
from typing import Union
from common.rpc.utils import create_service, requires_master_secret
service = create_service(__name__)
@requires_master_secret
@service.route("/api/upload_grades")
def upload_grades(*, data: str):
...
|
import functools
import os
import time
from collections import namedtuple
import gym
from gym.spaces import Box, Discrete
import haiku as hk
import jax
import jax.experimental.optix as optix
import jax.numpy as jnp
from jax.experimental.optimizers import adam
from jax import random
import numpy as np
from jax_baselin... |
import numpy as np
import pandas as pd
import statsmodels.api as sm
from scipy.stats import entropy
from scipy.stats import pearsonr,spearmanr
from matplotlib import cm
from scipy import stats, optimize
from matplotlib import pyplot as plt
import os
import inspect
import dv_funcs
import time
import seaborn as sns
def... |
import os
import pkgutil
import socket
import sys
import typing as t
import warnings
from datetime import timedelta
from functools import update_wrapper
from functools import wraps
from threading import RLock
import werkzeug.utils
from werkzeug.exceptions import NotFound
from werkzeug.local import ContextVar
from werk... |
# !/usr/bin/env python3
# -*- encoding: utf-8 -*-
if __name__ == "__main__":
month = int(input("Введите месяц:"))
year = int(input("Введите год:"))
if month > 12 or month < 1:
print("Не может быть такого значения")
else:
if month == 2:
if (year % 400 == 0 and yea... |
from memoized_development.solids.solid_utils import get_hash_for_file
from dagster import solid
@solid(version=get_hash_for_file(__file__), config_schema={"tree_species": str})
def emit_tree(context):
species = context.solid_config["tree_species"]
return "tree", species
|
import argparse
import io # for py2/py3 compatible
import nbformat
def cleannb(nbfile):
with io.open(nbfile, "r", encoding="utf8") as f:
nb = nbformat.read(f, as_version=nbformat.NO_CONVERT)
nb["metadata"]["kernelspec"]["display_name"] = "Python 2"
nb["metadata"]["kernelspec"]["name"] = "python... |
# import unyt
# import pytest
# import numpy as np
# import scipy as sp
# import openpnm as op
# class UnytTest:
# def setup_class(self):
# self.ws = op.Workspace()
# self.ws.clear()
# self.net = op.network.Cubic(shape=[5, 5, 5])
# self.geo1 = op.geometry.StickAndBall(network=self... |
import argparse
import atexit
import copy
import datetime
import numpy as np
import os
import torch
import tensorboardX
from functools import partial
from prob_mbrl import utils, models, algorithms, envs
if __name__ == '__main__':
parser = argparse.ArgumentParser("Deep-PILCO with moment matching")
parser.add_... |
#!/usr/bin/env python2.7
"Run a regresion test the library cells for DRC"
import unittest
from testutils import header
import sys,os
sys.path.append(os.path.join(sys.path[0],"../.."))
sys.path.append(os.path.join(sys.path[0],".."))
import globals
import debug
import calibre
OPTS = globals.OPTS
class expand_region_te... |
from flask import request, make_response, jsonify
from flask_restplus import Namespace, Resource, cors
from flask_jwt_oidc import AuthError
__all__ = ['api']
api = Namespace('NameProcessing', description='Name Processing Service - Used by Namex API')
@api.errorhandler(AuthError)
def handle_auth_error(ex):
resp... |
# Copyright 2020 The TensorFlow Authors. 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 applica... |
# *****************************************************************************
# Copyright (c) 2014, 2019 IBM Corporation and other Contributors.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distrib... |
import unittest
from chconsole.tab import UserClient
from chconsole.tab import UserTracker
__author__ = 'minimair'
class Tester(unittest.TestCase):
def setUp(self):
self.s = UserTracker()
pass
def tearDown(self):
pass
def test_0(self):
res = self.s.users
self.as... |
# Lepton Get Object Temp Example
#
# This example shows off how to get an object's temperature using color tracking.
# By turning the AGC off and setting a max and min temperature range you can make the lepton into
# a great sensor for seeing objects of a particular temperature. That said, the FLIR lepton is a
# micro... |
import itertools
from itertools import product
from typing import List, Tuple, Union, Dict
import numpy as np
from quara.objects.state import State
from quara.objects.povm import Povm
from quara.objects.gate import Gate
from quara.objects.qoperation import QOperation
from quara.objects.qoperations import Se... |
#!/usr/bin/env python
from setuptools import find_packages
from setuptools import setup
import datetime
CURRENT_VERSION = "1.1.0"
# ### PYPI VERSION. ###
date_tmpl = '{dt:%y}.{dt.month}.{dt.day}.{dt.hour}.{dt.minute}.{dt.second}'
VERSION = ".".join([CURRENT_VERSION, date_tmpl.format(dt=datetime.datetime.now())])
####... |
import queue
import socket
import wsproto
from OpenSSL import SSL
from wsproto import WSConnection, events
from wsproto.connection import ConnectionType
from wsproto.events import AcceptConnection, CloseConnection, Message, Ping, Request
from wsproto.extensions import PerMessageDeflate
from seleniumwire.thirdparty.mi... |
"""Parser for LINK operation from KEGG API."""
import logging
from collections import defaultdict
from dabeplech.models.kegg import KeggLinksModel
from dabeplech.parsers.base import BaseParser
logging.basicConfig()
logger = logging.getLogger()
class KeggLinkParser(BaseParser):
"""Parser for LINK operation from ... |
# *******************************************************************************
#
# Copyright (c) 2020-2021 David Briant. All rights reserved.
#
# *******************************************************************************
import sys
if hasattr(sys, '_TRACE_IMPORTS') and sys._TRACE_IMPORTS: print(__name__)
... |
# coding: utf-8
"""
Accounting Extension
These APIs allow you to interact with HubSpot's Accounting Extension. It allows you to: * Specify the URLs that HubSpot will use when making webhook requests to your external accounting system. * Respond to webhook calls made to your external accounting system by HubSp... |
import ast
import pprint
class HParams(object):
def __init__(self, **kwargs): self.__dict__.update(kwargs)
def __setitem__(self, key, value): setattr(self, key, value)
def __getitem__(self, key): return getattr(self, key)
def __repr__(self): return pprint.pformat(self.__dict__)
def parse(self, str... |
from __future__ import print_function
import base64
import copy
import json
import logging
import os
import random
import ssl
import sys
import threading
import time
from builtins import object
from builtins import str
from flask import Flask, request, make_response, send_from_directory
from pydispatch import dispatc... |
'''
现在有一个列表,li = [1,2,3,'a','b','4','c'],有一个字典(此字典是
动态生成的,并不知道里面有多少键值对,所以用 dic = {} 模拟此字典 );
现在需要完成这样的操作:如果字典没有‘k1’这个键,那么就创建这个‘k1’这个键和
对应的值(该键值设为空列表),并将列表li中的索引位为奇数对应的元素,添加到‘k1’
这个键对应的值中
'''
li=[1,2,3,'a','b','4','c']
dic={}
res=print(dic.get("k1",-1))
l=[]
if res==-1:
dic["k1"]=" "
print(dic)
for i in range(7):
if ... |
#!/usr/bin/python
# Copyright (c) 2020, 2021 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... |
# Generated by Django 3.0.9 on 2020-08-24 20:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sources', '0003_sourcedetail_last_pull'),
]
operations = [
migrations.AlterField(
model_name='sourcedetail',
name='d... |
class Scene(object):
def enter(self):
pass
class Engine(object):
def __init__(self, scene_map):
pass
def play(self):
pass
class Death(Scene):
def enter(self):
pass
class CentralCorridor(Scene):
def enter(self):
pass
class LaserWeaponArmory(Scene):
... |
"""CFNgin destroy action."""
from __future__ import annotations
import logging
from typing import TYPE_CHECKING, Any, Callable, Optional, Union
from ..exceptions import StackDoesNotExist
from ..hooks.utils import handle_hooks
from ..status import (
INTERRUPTED,
PENDING,
SUBMITTED,
CompleteStatus,
... |
from typing import Any
from typing import Optional
from typing import Type
from typing import Union
from .apps.base import BaseApp
from .apps.basic import App
from .tasks import CronTask
from ..command.validators import VALIDATOR_TYPE
from ..event import Event
from ..types.handler import DECORATOR_ARGS_TYPE
from ..typ... |
#
# Copyright (c) 2019, Neptune Labs Sp. z o.o.
#
# 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... |
from flask_sqlalchemy import SQLAlchemy
from app.map.map import advance_delivery, DELIVERED
db = SQLAlchemy()
class Package(db.Model):
__tablename__ = "packages"
id = db.Column(db.Integer, primary_key=True)
sender = db.Column(db.String(255))
recipient = db.Column(db.String(255))
origin = db.Colu... |
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import os
import random
from scipy.optimize import curve_fit
from scipy.stats import norm
# Function Definitions
# Curve fitting part
# define the true objective function ----------------------------------------------
def psyFunction(x,mu,sd,k,offs... |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2020, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... |
#
# 394. Decode String
#
# Q: https://leetcode.com/problems/decode-string/
# A: https://leetcode.com/problems/decode-string/discuss/941684/Kt-Js-Py3-Cpp-Stack
#
class Solution:
def decodeString(self, encoded: str, freq = '', word = '') -> str:
s = []
for c in encoded:
if c == '[':
... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-03-06 14:33
from __future__ import unicode_literals
from django.db import migrations, models
import openslides.utils.models
class Migration(migrations.Migration):
initial = True
dependencies = [
("auth", "0006_require_contenttypes_0002"),... |
XML_EXC_C14N = "http://www.w3.org/2001/10/xml-exc-c14n#"
XMLDSIG = "http://www.w3.org/2000/09/xmldsig#"
XMLDSIG_SHA1 = "https://www.w3.org/2000/09/xmldsig#sha1"
XMLDSIG_RSA_SHA1 = "https://www.w3.org/2000/09/xmldsig#rsa-sha1"
XMLENC_SHA256 = "http://www.w3.org/2001/04/xmlenc#sha256"
XMLDSIG_RSA_SHA256 = "http://www.w3.... |
# Always prefer setuptools over distutils
# To use a consistent encoding
from codecs import open
from os import path
from setuptools import setup
HERE = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(HERE, 'README.md'), encoding='utf-8') as f:
long_descr... |
import os
from flask import Flask, request, abort, jsonify
from flask_sqlalchemy import SQLAlchemy
from flask_cors import CORS
from models import setup_db, Client, Artist, Project
from auth import AuthError, requires_auth
app = Flask(__name__)
setup_db(app)
CORS(app)
'''
GET '/projects'
- require permission 'ge... |
import base64
from datetime import datetime
from socket import gethostname
from threading import Thread
import scapy.layers.inet as scapy
from util import send_traceroute
class TracerouteThread(Thread):
def __init__(self, destination, traceroute_info):
super().__init__()
print(f"TracerouteThread... |
import webbrowser, sys, pyperclip
if len(sys.argv) > 1:
# Get address from command line.
address = ' '.join(sys.argv[1:])
else:
# Get address from clipboard.
address = pyperclip.paste()
webbrowser.open(f'https://www.google.com/maps/place/{address}')
|
#!/usr/bin/env python
#
# Copyright 2014 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# ... |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import datetime
# Time
t = datetime.time(5, 25, 5, 200)
print(t)
print(datetime.time.min)
print(datetime.time.max)
print(datetime.time.resolution)
# Date
today = datetime.date.today()
print(today)
print(today.timetuple())
print(f'{today.year}/{today.month}/{today.day}'... |
from ..output import OutputDevice
class SocketIOOutputDevice (OutputDevice):
""" SocketIOOutputDevice: Support for sending note on/off events via websockets.
Two types of event are sent at the moment:
note [ index, velocity, channel ] : The MIDI note number depressed.
... |
from transformers import *
import pdb
from torch.nn.utils import weight_norm as wn
from tqdm import tqdm
from torch.nn.utils.rnn import pad_sequence
import torch.nn as nn
import torch
from bpe_encoder import get_codec
from gpt2_model import GPT2
from utils import parse_config
def bert_encoder():
return BERTEncoder... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google 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... |
# -*- coding: utf-8 -*-
"""
There are three major popular libraries widely used for making
http request:
- ``requests``: http://docs.python-requests.org/en/master/
- ``scrapy``: https://doc.scrapy.org/en/latest/topics/request-response.html
- ``selenium``: http://selenium-python.readthedocs.io/index.html
And there ar... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/tasks_v2beta2/proto/cloudtasks.proto
import sys
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1"))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from ... |
#!/usr/bin/env python3
import typing
from enum import Enum
from inspect import signature
from typing import Any, Callable, List, Tuple, Union, cast, overload
import torch
from torch import Tensor, device
from torch.nn import Module
from .._utils.typing import Literal, TargetType
class ExpansionTypes(Enum):
repe... |
import math
#Fourier Class will hold efficient methods to solve more complicated communications problems later
class Fourier():
def fourierseries():
def fouriertransform():
def dfourierseries():
def dfouriertransform():
|
from modules.environment import Environment
from modules.player import Player
env = Environment(
p1=Player(name='Hanieh')
)
env.launch_game(iterations=10)
|
from django.conf import settings
from yubico_client import Yubico
def yubikey_authenticate(yubikey_otp):
"""
Checks a YubiKey OTP
:param yubikey_otp: Yubikey OTP
:type yubikey_otp:
:return: True or False or None
:rtype: bool
"""
if settings.YUBIKEY_CLIENT_ID is None or settings.YUBIK... |
# coding=utf-8
# Copyright 2020 The Google AI Perception Team Authors.
#
# 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 b... |
import time
import RPi.GPIO as GPIO
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
# GPIO pin assignment
GREEN_LED = 21
RED_LED = 20
START_BLINK = 16
# GPIO pin initialization
GPIO.setup(GREEN_LED, GPIO.OUT)
GPIO.output(GREEN_LED, False)
GPIO.setup(RED_LED, GPIO.OUT)
GPIO.output(RED_LED, False)
GPIO.setup(START_BLINK,... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright © 2017 bily Huazhong University of Science and Technology
#
# Distributed under terms of the MIT license.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import os.path as osp
import... |
from rest_framework import status
from rest_framework.reverse import reverse
from .utils import CRUDMixin, make_tag, make_user, prepare_project
class TestTagList(CRUDMixin):
@classmethod
def setUpTestData(cls):
cls.project = prepare_project()
cls.non_member = make_user()
make_tag(pro... |
class Grouping: pass |
"""Speciality app."""
from django.apps import AppConfig
class SpecialitiesConfig(AppConfig):
name = "snm.specialities"
|
#!/usr/bin/env python3
#
# Copyright (C) 2019 Intel Corporation
#
# 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 applicabl... |
from numbers import Integral
import numpy as np
from io import StringIO
from sklearn.tree import _tree
from sklearn.tree._criterion import FriedmanMSE
from m5py.main import is_leaf, ConstantLeafModel, M5Base, check_is_fitted
def export_text_m5(decision_tree, out_file=None, max_depth=None,
featur... |
from flask import Response, request
from io import BytesIO
import xml.etree.ElementTree
class RMG_Devices_DeviceKey_Scan():
endpoints = ["/devices/<devicekey>/scan", "/rmg/devices/<devicekey>/scan"]
endpoint_name = "rmg_devices_devicekey_scan"
endpoint_methods = ["GET", "POST", "DELETE"]
def __init__... |
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.13.7
# kernelspec:
# display_name: Python [conda env:bandit_py3]
# language: python
# name: conda-env-band... |
import torch
import pandas as pd
class ESXDataset(torch.utils.data.Dataset):
def __init__(self, train_X, train_Y, train_T, train_E):
self.train_X = torch.from_numpy(train_X).float()
self.train_T = torch.from_numpy(train_T).float() # label of treatment status
self.train_Y = torch.from_nump... |
import argparse
def main(fn_liftover, fn_normal, fn_output):
file = open(fn_liftover, 'r')#open('offset.vcf', 'r')#open("21_major.recode.vcf")
maj_pos = []
offset = []
ref_alleles = []
alt_alleles = []
for line in file:
if '#' not in line:
spl = line.split()
pos... |
#!/usr/bin/python
# encoding: utf-8
# (c) 2015-2016, Jiri Tyr <jiri.tyr@gmail.com>
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
module: yum_repository
autho... |
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = "3"
from tensorflow.keras.layers import *
from tensorflow.keras.models import Sequential
from tensorflow.keras.callbacks import EarlyStopping, ModelCheckpoint, ReduceLROnPlateau
from train_preprocessing import processed_data
def model_train(email):
input_dim, max_len,... |
from dataclasses import dataclass
from sqlalchemy import Column, String, Integer, Date
from base import Base
class User(Base):
__tablename__ = 'users'
id = Column(Integer, primary_key=True)
username = Column(String)
password = Column(String)
birth_date = Column(Date)
email = Column(String)
... |
# Copyright 2019 The Cirq Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
#To use this script all the file names should be stared with word 'meme' and end with a Number. Ex: meme1
from selenium import webdriver
from selenium.webdriver.chrome.options import *
from selenium.webdriver.common.keys import Keys
import autoit
from random import randint
import time
username = "###" #Enter your user... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from pyper import R
import os
from PreProcess import processTweet, is_ascii
class supervisedLDA:
def __init__(self, dataFileName, alpha=1.0, numtopics=5, eta=0.1, logistic=True, lamda=1.0, e_iter=10, m_iter=4, variance=0.25, cutoff=0.25):
model_filename = 'model... |
from .variant.clnsig import build_clnsig
from .variant.gene import build_gene
from .variant.compound import build_compound
from .variant.genotype import build_genotype
from .variant import build_variant
from .hpo import build_hpo_term
from .institute import build_institute
from .phenotype import build_phenotype
from .... |
import datetime
from pyramid.response import Response
from mist.api.helpers import view_config
from mist.api.helpers import params_from_request
from mist.api.helpers import trigger_session_update
from mist.api.exceptions import NotFoundError
from mist.api.exceptions import BadRequestError
from mist.api.exceptions im... |
#!/usr/bin/env python
"""Tests the client file finder action."""
import collections
import glob
import hashlib
import os
import platform
import shutil
import stat
import subprocess
import unittest
import mock
import psutil
from grr_response_client import comms
from grr_response_client.client_actions import file_find... |
import os
import re
from flask import Flask, jsonify, render_template, request, url_for
from flask_jsglue import JSGlue
from cs50 import SQL
from helpers import lookup
# configure application
app = Flask(__name__)
JSGlue(app)
# ensure responses aren't cached
if app.config["DEBUG"]:
@app.after_request
def aft... |
'''OpenGL extension AMD.vertex_shader_layer
This module customises the behaviour of the
OpenGL.raw.GL.AMD.vertex_shader_layer to provide a more
Python-friendly API
Overview (from the spec)
The gl_Layer built-in shading language variable was introduced with the
ARB_geometry_shader extension and subsequently prom... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from functools import partial
from operator import add
import warnings
import numpy as np
from ._logging import get_logger
from .tools import split, partition
from .util import mad
__all__ = ["balance_cooler"]
logger = get_logg... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010 Citrix Systems, 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/L... |
from django.shortcuts import render, get_object_or_404
from rest_framework.views import APIView
from rest_framework.response import Response
from .models import Post
from .serializers import PostSerializer
class BlogListView(APIView):
def get(self, request, *args, **kwargs):
posts = Post.postobjects.all(... |
"""
Inbetween Generator -> Simple script used to create Inbetween Transforms
@Guilherme Trevisan - TrevisanGMW@gmail.com - 2020-02-04
1.1 - 2020-02-18
Added Color Picker
1.2 - 2020-06-07
Updated naming convention to make it clearer. (PEP8)
Changed Script Name. (Previously rigLayer Generator)
Fixed ran... |
#!/usr/bin/env python2
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Base class for RPC testing
# Add python-bitcoinrpc to module search path:
import os
import sys
import... |
class IDefinition(object):
keyword_name = "" # Can be empty if it's not found as a keyword.
# Note: Could be None (i.e.: we found it in a library spec file which doesn't have the source).
source = ""
# Note: Could be None (i.e.: we found it in a library spec file which doesn't have the lineno).
... |
"""kikter_34297 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-... |
import os
import json
import json as simplejson
from rest_framework.decorators import api_view
from django.shortcuts import render
from django.http import HttpResponse
from rest_framework import generics
from django.contrib.auth import logout
from rest_framework.views import APIView
from rest_framework.response import... |
import base64
import json
import typing
import googleapiclient.discovery
import time
# example message
# {
# "project": "osm-vink",
# "zone": "us-central1-c",
# "name": "overpass-update",
# "machine_type": "n1-standard-1",
# "machine_label": "overpass_update",
# "script_url_base": "gs://vink-... |
# -*- coding: utf-8 -*-
# 直流电机连接的树莓派引脚(BCM编号)
LEFT_PIN_A = 6
LEFT_PIN_B = 5
LEFT_PWM = 0
RIGHT_PIN_A = 22
RIGHT_PIN_B = 27
RIGHT_PWM = 17
# 小车5档调速
GEARS = [0, 1, 2, 3, 4]
# 定义操作指令, 小车有可以执行下面几种命令并且可以是某些命令的组合
STOP = 0x0000
LEFT = 0x0001
RIGHT = 0x0010
FORWARD = 0x0100
BACKWARD = 0x1000
S... |
# -*- coding: utf-8 -*-
import pytest
import env # noqa: F401
m = pytest.importorskip("pybind11_tests.virtual_functions")
from pybind11_tests import ConstructorStats # noqa: E402
def test_override(capture, msg):
class ExtendedExampleVirt(m.ExampleVirt):
def __init__(self, state):
super(Ext... |
import re
import pathlib
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
BASE_PATH = pathlib.Path(__file__).parent
try:
version = re.findall(r"""^__version__ = "([^']+)"\r?$""",
(BASE_PATH / "siontp" / "__init__.py").read_text(),
... |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... |
"""
Defines the set of symbols used in text input to the model.
The default is a set of ASCII characters that works well for English or text that has been run
through Unidecode. For other data, you can modify _characters. See TRAINING_DATA.md for details.
"""
# from . import cmudict
from .korean import ALL_SYMBOLS, PA... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Order.shipping_address'
db.add_column(u'orders_order', 's... |
import unittest
import numpy as np
import logging
from dsbox.ml.neural_networks.keras_factory.text_models import LSTMFactory
from dsbox.ml.neural_networks.processing.workflow import TextNeuralNetPipeline, ImageNeuralNetPipeline
logging.getLogger("tensorflow").setLevel(logging.WARNING)
np.random.seed(42)
class T... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.