text stringlengths 2 999k |
|---|
"""
WSGI config for OnlineCourseRegistration project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefa... |
# Copyright 2014-present MongoDB, 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 or agreed to in wr... |
# -*- coding: utf-8 -*-
"""
(c) 2019-2019 - Copyright Red Hat Inc
Authors:
Pierre-Yves Chibon <pingou@pingoured.fr>
Patrick Uiterwijk <patrick@puiterwijk.org>
"""
from __future__ import unicode_literals, absolute_import
import json
import os
import sys
from mock import Mock
sys.path.insert(
0, os.pat... |
"""
Copyright 2020 The OneFlow 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 applicable law or agr... |
"""Modules copied from Python 3 standard libraries, for internal use only.
Individual classes and functions are found in d2._backport.misc. Intended
usage is to always import things missing from 3.1 from that module: the
built-in/stdlib objects will be used if found.
"""
|
import torch
from torch.utils.data import Dataset
import cv2
import numpy as np
import pandas as pd
__all__ = ['VideoDataset', 'VideoLabelDataset']
class VideoDataset(Dataset):
""" Video Dataset for loading video.
It will output only path of video (neither video file path or video folder path).
... |
"""Support for Xiomi Gateway alarm control panels."""
from functools import partial
import logging
from miio import DeviceException
from homeassistant.components.alarm_control_panel import (
SUPPORT_ALARM_ARM_AWAY,
AlarmControlPanelEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassist... |
# -----------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -----------------------------------------------------------------------------
""... |
from pyspark.context import SparkContext
from pyspark.sql.session import SparkSession
sc = SparkContext('local')
spark = SparkSession(sc)
df = spark \
.read \
.format("kafka") \
.option("kafka.bootstrap.servers", "172.25.0.12:9092,172.25.0.13:9092") \
.option("startingOffsets", "earliest") \
.option("subscri... |
import sys
import typing
import numba as nb
import numpy as np
@nb.njit(
(nb.i8[:], ),
cache=True,
)
def solve(
s: np.ndarray,
) -> typing.NoReturn:
mod = 10 ** 9 + 7
n = s.size
dp = np.zeros(n + 2, np.int64)
dp[0] = 1
for i in range(n):
j = i - 1
while j >= 0:
if s... |
# fileName : plugins/dm/callBack/pdfFormatter.py
# copyright ©️ 2021 nabilanavab
import os
import time
import fitz
import shutil
from PIL import Image
from time import sleep
from pdf import PROCESS
from pyrogram import filters
from Configs.dm import Config
from plugins.checkPdf import checkPdf
from plugins.progress im... |
import mock
from fastapi import status
from fastapi.testclient import TestClient
from tests.conftest import root_token
from main import app
client = TestClient(app)
def test_welcome():
response = client.get("/")
assert response.status_code == status.HTTP_200_OK
assert response.json() == {"message": "M... |
# coding=utf-8
'''
Layer definitions
'''
import json
import cPickle as pkl
import numpy
from collections import OrderedDict
import theano
import theano.tensor as tensor
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
from initializers import *
from util import *
from theano_util import *
from a... |
# -*- coding: utf-8 -*-
# Authors: Binh Nguyen <tuan-binh.nguyen@inria.fr>
from hidimstat.knockoffs.data_simulation import simu_data
from hidimstat.knockoffs.gaussian_knockoff import (
_estimate_distribution, gaussian_knockoff_generation)
SEED = 42
fdr = 0.1
def test_estimate_distribution():
n = 100
p =... |
# coding=utf-8
#
# The MIT License (MIT)
#
# Copyright (c) 2016-2017 yutiansut/QUANTAXIS
#
# 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 t... |
from gadk import *
class MyService(Workflow):
def __init__(self) -> None:
super().__init__("my_service", "my service workflow")
paths = [
"src/service/*.py",
"src/service.yml",
]
self.on(
pull_request=On(paths=paths), push=On(branches=["master"]... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
def sayHello():#Function to print Hello World
print("Hello world !")
sayHello()#Calling the function
|
"""
Various utility functions.
"""
import numpy as np
import tensorflow as tf
def batch_to_seq(h, nbatch, nsteps, flat=False):
if flat:
h = tf.reshape(h, [nbatch, nsteps])
else:
h = tf.reshape(h, [nbatch, nsteps, -1])
return [tf.squeeze(v, [1]) for v in tf.split(axis=1, num_or_size_splits=... |
# -*- encoding:utf-8 -*-
# Copyright (c) Alibaba, Inc. and its affiliates.
# Date: 2020-10-06
# Filename:export_test.py
import functools
import json
import logging
import os
import unittest
import numpy as np
import tensorflow as tf
import easy_rec
from easy_rec.python.inference.predictor import Predictor
from easy_r... |
# Copyright 2016 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... |
# MusicPlayer, https://github.com/albertz/music-player
# Copyright (c) 2012, Albert Zeyer, www.az2000.de
# All rights reserved.
# This code is under the 2-clause BSD license, see License.txt in the root directory of this project.
import better_exchook
better_exchook.install()
class Song:
def __init__(self, fn):
sel... |
from skt.vault_utils import get_secrets
def get_hive_conn():
from pyhive import hive
hiveserver2 = get_secrets(path="ye/hiveserver2")
host = hiveserver2["ip"]
port = hiveserver2["port"]
user = hiveserver2["user"]
conn = hive.connect(host, port=port, username=user)
return conn
def get_hd... |
"""
Dummy conftest.py for markusvae.
If you don't know what this is for, just leave it empty.
Read more about conftest.py under:
- https://docs.pytest.org/en/stable/fixture.html
- https://docs.pytest.org/en/stable/writing_plugins.html
"""
# import pytest
|
# Copyright (c) 2020, Manfred Moitzi
# License: MIT License
from typing import TYPE_CHECKING
from ezdxf.lldxf import validator
from ezdxf.lldxf.const import SUBCLASS_MARKER
from ezdxf.lldxf.attributes import (
DXFAttr, DXFAttributes, DefSubclass, XType, RETURN_DEFAULT,
group_code_mapping,
)
from ezdxf.math im... |
from .mgmt_testcase import AzureMgmtTestCase, AzureMgmtPreparer
from .mgmt_recorded_testcase import AzureMgmtRecordedTestCase
from .azure_recorded_testcase import AzureRecordedTestCase
from .azure_testcase import AzureTestCase, is_live, get_region_override
from .resource_testcase import (
FakeResource,
Resource... |
"""
WSGI config for rookie project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` s... |
from config.Resources import UnitTypes
from Utils import dist
class Controller:
def do(self, unit, all_units):
pass
def find_nearest_obj(self, unit, units, set_of_types=None):
found = []
if set_of_types is None:
found = units
else:
for obj in units:
... |
# Copyright (c) 2018 getcarrier.io
#
# 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 i... |
from keras.models import Model
from keras.layers import Input
from keras.layers import LSTM
from keras.layers import Dense
from keras.layers import GRU,Embedding,concatenate,Reshape
import numpy as np
import keras
#from loaddata2 import *
path1 = "C:\\Users\\bdu\\Desktop\\gzy\\BusBunching\\BusRoute400\\Test\\... |
# coding: utf-8
"""
Stakeholder engagement API
This API enables Intelligent Engagement for your Business. iEngage is a platform that combines process, augmented intelligence and rewards to help you intelligently engage customers.
OpenAPI spec version: 1.0
Generated by: https://github.com/swagger... |
from django.http import Http404
from devilry.apps.core.models import Period
from devilry.devilry_cradmin import devilry_crinstance
from devilry.devilry_student.cradminextensions import devilry_crmenu_student
from devilry.devilry_student.views.period import overview
class Menu(devilry_crmenu_student.Menu):
def ... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import json
import warnings
import pulumi
import pulumi.runtime
from .. import utilities, tables
class DelegationSet(pulumi.CustomReso... |
import json
import pymysql
import argparse
def InsertToMySQL(conn, record):
cursor = conn.cursor()
cursor.execute( "INSERT business values (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)",
[record['business_id'],record['name'].encode('utf-8'),record['full_address'].encode('utf-8'),record['city'].encode('utf-8'),reco... |
from __future__ import absolute_import
from ..config import *
try:
from Tkinter import *
import tkFont
except ImportError:
from tkinter import *
from tkinter import font as tkFont
try:
import queue
except ImportError:
import Queue as queue
from .menu_bar import ConsolePopupMenu
import re
re... |
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 18 11:58:07 2017
@author: Biagio Brattoli
"""
import os, numpy as np
import torch
import torch.utils.data as data
from scipy.misc import imread, imresize
from scipy.sparse import csr_matrix
from PIL import Image
import xml.etree.ElementTree as ET
import torchvision.trans... |
'''setup.py'''
"""
Create a build for pip
This code should only be executed by developers, not users.
"""
import os
import re
import sys
from setuptools import setup, find_packages
def pip_version():
with open(os.path.abspath('auto_editor/__init__.py')) as f:
version_content = f.read()
version_matc... |
"""Unit test package for heic_to_jpg."""
|
import matplotlib.pyplot as plt
import numpy as np
from numpy.linalg import norm
# Don't delete this line, even if PyCharm says it's an unused import.
# It is required for projection='3d' in add_subplot()
# from mpl_toolkits.mplot3d import Axes3D
def rand_rotation_matrix(deflection=1.0, seed=None):
"""Creates a ... |
# Copyright The PyTorch Lightning team.
#
# 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 i... |
"""
Copyright (c) 2018 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 applicable law or agreed to in wri... |
# -*- coding: utf-8 -*-
import os
import sys
import datetime
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.append(os... |
# coding: utf-8
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"... |
from cereal import car
from opendbc.can.parser import CANParser
from opendbc.can.can_define import CANDefine
from selfdrive.config import Conversions as CV
from selfdrive.car.interfaces import CarStateBase
from selfdrive.car.chrysler.values import DBC, STEER_THRESHOLD
class CarState(CarStateBase):
def __init__(self... |
import six
import json
from kubernetes import watch
from kubernetes.client.rest import ApiException
from .apply import apply
from .discovery import EagerDiscoverer, LazyDiscoverer
from .exceptions import api_exception, KubernetesValidateMissing, ApplyException
from .resource import Resource, ResourceList, Subresource... |
"""
ydk.ext
The code below is taken from Flask <http://flask.pocoo.org> project, and
the original docstring is listed below.
Redirect imports for extensions. This module basically makes it possible
for us to transition from flaskext.foo to flask_foo without having to
force all extensions to u... |
# (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
__version__ = "11.11.1"
|
from .test_base import TestBase
from werkzeug.exceptions import NotFound, MethodNotAllowed
from app.exceptions import ValidationError
class TestEndpoints(TestBase):
""" Test the API endpoints """
def test_api_index(self):
res, json = self.client.get('/api/v1')
self.assertEqual(res.status_code... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import warnings
warnings.filterwarnings('ignore')
import numpy as np
import getopt
import sys
import os
import math
import time
import argparse
from visdom import Visdom
sys.path.insert(0, os.path.join('..', '..'))
import torch as T
from torch.autograd import Variable ... |
# coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... |
from __future__ import print_function
from django.core.management.base import BaseCommand, CommandError
from django.core.exceptions import ImproperlyConfigured
from django.db.models import get_app, get_models
from django.db.models.loading import get_model
from ...bakery import Baker
class Command(BaseCommand):
ar... |
from pydantic import BaseModel, validator
class A(BaseModel):
abc: str # expected
class B(A):
abc: str
A(ab<caret>c='cde')
B(abc='cde')
# count 1 |
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('test_builtin_func/<arg>/', views.builtin, name='test_builtin_func'),
path('test_package_func/', views.date, name='test_package_func'),
path('test_user_func1/', views.test_func1, name='test_user_... |
"""
Plotting Earth relief
=====================
Plotting a map of Earth relief can use the data accessed by the
:meth:`pygmt.datasets.load_earth_relief` method. The data can then be plotted using the
:meth:`pygmt.Figure.grdimage` method.
.. note::
This tutorial assumes the use of a Python notebook, such as IPyth... |
#!/usr/bin/env python
import numpy as np
import cv2 as cv
from umucv.stream import Camera
from umucv.util import ROI, putText
from skimage.feature import hog
cv.namedWindow('cam')
roi = ROI('cam')
PPC = 16
CPB = 2
SHOW = False
cam = Camera()
def feat(region):
r = cv.cvtColor(regi... |
"""Support for Huawei LTE routers."""
from __future__ import annotations
from collections import defaultdict
from collections.abc import Callable
from contextlib import suppress
from dataclasses import dataclass, field
from datetime import timedelta
import logging
import time
from typing import Any, NamedTuple, cast
... |
import xlsxwriter
import csv
import os
import xlsxwriter
from collections import OrderedDict
import datetime
# this functon saves all the data into a single excel workbook of multiple sheets
from pyproj import Proj, transform
# Excel file name =WEAP_Output
# "C:/Users/Adel/Documents/Results/
# ProvidedDir=self.
# excel... |
__author__ = 'Jonas Jaeger, Gereon Reus'
from flask_user import current_user, UserMixin
from werkzeug.security import generate_password_hash, check_password_hash
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, DateTime, Float, Text, Boolean
from sqlalchemy.dialect... |
"""
21. Merge Two Sorted Lists
Merge two sorted linked lists and return it as a new list.
The new list should be made by splicing together the nodes of the first two lists.
"""
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solutio... |
"""
Created on Jan 25, 2017
@author: Martin Vo
"""
import unittest
import numpy as np
from lcc.entities.star import Star
from lcc.stars_processing.deciders.supervised_deciders import QDADec
from lcc.stars_processing.descriptors.abbe_value_descr import AbbeValueDescr
from lcc.stars_processing.descriptors.curves_shap... |
import argparse
import os
from pathlib import PurePosixPath
import re
import urllib
from typing import (
Any,
)
from eth_typing import (
Hash32,
HexStr,
)
from eth_utils import (
decode_hex,
is_hex,
to_int,
remove_0x_prefix,
ValidationError,
)
from trinity.sync.common.checkpoint impor... |
from typing import Type, Any, Callable, Union, List, Optional
import torch
import torch.nn as nn
from torch import Tensor
from ._internally_replaced_utils import load_state_dict_from_url
from .utils import _log_api_usage_once
__all__ = [
"ResNet",
"resnet18",
"resnet34",
"resnet50",
"resnet101",... |
# Copyright 1999-2020 Alibaba Group Holding Ltd.
#
# 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 a... |
load("//fs_image/bzl:oss_shim.bzl", "buck_genrule")
# Create a signed copy of the test RPM file passed in. It is signed with
# the key from //fs_image/rpm:gpg-test-keypair.
#
# name: Target name.
# filename: RPM filename to pass to export_file() and sign.
#
def sign_rpm_test_file(name, filename):
export_file(name ... |
# Copyright 2018 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... |
import random
from flask import ( Flask, render_template, jsonify )
app = Flask(__name__)
@app.get('/')
def index():
return render_template('index.html.j2')
@app.get('/api')
def api():
return jsonify({'lucky': random.randrange(1, 100)})
application = app |
from pathlib import Path
DATA_DIR = Path('data')
DATA_DIRS = {
'fetched': DATA_DIR / 'fetched',
'wrangled': DATA_DIR / 'wrangled'
}
for k, ddir in DATA_DIRS.items():
ddir.mkdir(exist_ok=True, parents=True)
|
"""
Arcade's version of the OpenGL Context.
Contains pre-loaded programs
"""
from contextlib import contextmanager
from pathlib import Path
from typing import Dict, Optional, Tuple, Union
from PIL import Image
import pyglet
from pyglet.math import Mat4
from arcade.gl import BufferDescription, Context
from arcade.gl.p... |
import json
import os
import tempfile
from unittest import mock
from filtercascade import FilterCascade
from olympia import amo
from olympia.amo.tests import (
addon_factory, TestCase, user_factory, version_factory)
from olympia.blocklist.models import Block
from olympia.blocklist.mlbf import MLBF
from olympia.fi... |
import os
from datetime import datetime
from pytz import timezone
from django.test import TestCase
from calendars.parsing import read_feed, get_events
class FeedTests(TestCase):
"""
When provided with an ICS feed URL, the app should be able to request the
feed content, parse the events from the feed, ch... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
class Hidden(nn.Module):
def __init__(self, inplanes, planes, stride=1):
super(Hidden, self).__init__()
def forward(self, x):
out=x.view(x.shape[0],-1)
out = out.... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# SOURCE: https://github.com/twbs/bootstrap
# SOURCE: https://github.com/twbs/bootstrap/releases
# SOURCE: https://www.w3schools.com/bootstrap4/bootstrap_grid_examples.asp
import logging
from flask import Flask, render_template
app = Flask(__... |
from django.views.generic import TemplateView
from django.shortcuts import render
from django.shortcuts import redirect
from django.urls import reverse
from irekua_database.models import Collection
from irekua_database.models import SiteType
from irekua_permissions.data_collections import (
sites as site_permissio... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
# May 2018 xyz
from __future__ import print_function
import os
import sys, glob
import numpy as np
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = os.path.dirname(BASE_DIR)
sys.path.append(os.path.join(ROOT_DIR))
DATASETS = ['MATTERPORT', 'SCANNET', 'ETH', 'MODELNET40']
for ds in DATASETS:
sys.pa... |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... |
# -*- coding: utf-8 -*-
import cv2
import os
from root.config.main import rAnk, mAster_rank
from screws.miscellaneous.timer import MyTimer
from screws.miscellaneous.random_string.digits import randomStringDigits
def make_a_video_from_images_in_folder(image_folder, video_name=None, duration=5, clear_images=False):
... |
"""
Django settings for Projeto1 project.
Generated by 'django-admin startproject' using Django 1.11.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""... |
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unittests for the partial_mock test helper code."""
from __future__ import print_function
from chromite.lib import cros_test_lib
from chromite.li... |
"""
Bubble Sort Algorithm
@complexity O(n^2)
@author Akafael
@ref https://en.wikipedia.org/wiki/Bubble_sort
"""
# !/usr/bin/env python
def bubble_sort(arr):
""" Sort Array Elements using Bubble Sort Algorithm
:return:
Examples:
>>> bubble_sort([1])
[1]
>>> bubble_sort([10,9,8,7,6,5,4,3,2... |
"""
FactSet Concordance API
The FactSet Concordance API provides the ability to programmatically look up several types of entities by their name and other attributes. It attempts to match attributes that you supply for the entity and returns as many match candidates as it can find. The result is a \"concorded\... |
# -*- coding: utf-8 -*-
# Copyright (C) 2018 by
# Marta Grobelna <marta.grobelna@rwth-aachen.de>
# Petre Petrov <petrepp4@gmail.com>
# Rudi Floren <rudi.floren@gmail.com>
# Tobias Winkler <tobias.winkler1@rwth-aachen.de>
# All rights reserved.
# BSD license.
#
# Authors: Marta Grobelna <marta.grob... |
""""
名称:045 体感灯光
硬件: 童芯派
功能介绍:实现led灯跟随童芯派姿态的变化而改变位置。
难度:⭐⭐⭐
支持的模式:上传、在线都支持
使用到的API及功能解读:
"""
# ---------程序分割线----------------程序分割线----------------程序分割线----------
import cyberpi
import time
a = 0
cyberpi.led.on('k k b k k')
while True:
a = cyberpi.get_roll()
time.sleep(0.2)
if cyberpi.get_roll() - a >... |
import os
import os.path as osp
import argparse
from datetime import datetime
import torch
import torch.nn.functional as F
from torch.nn import Sequential as Seq, Linear as Lin, ReLU, BatchNorm1d as BN, Dropout
from torch.optim.lr_scheduler import StepLR
import torch_geometric.transforms as T
from torch_geometric.d... |
# 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
# distributed under t... |
#mouse ile herhangi bir objenin üzerine tıklayıp hareket ettirebilirsiniz
import cv2
import numpy as np
cap = cv2.VideoCapture(0)
#Create old frame
_, frame = cap.read()
oldGray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
# Lucas kanade params
lkParams = dict(winSize=(15, 15),
maxLevel=4,
... |
"""
WSGI config for car_forum project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SET... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.linear_model import Lasso
def lassFunction(data, thresh=2-):
data = data.copy()
# Generate an alias list: [x_1, ..., x_n]
colBackup = data.columns.copy()
predictors = ['x_%d'%i for i in range(1, data.shape[1])]
... |
from app import create_app,db
from flask_script import Manager,Server
from app.models import User,Pitch,Comment
from flask_migrate import Migrate, MigrateCommand
#creating app instance
app = create_app('development')
manager = Manager(app)
manager.add_command('server',Server)
migrate = Migrate(app,db)
manager.ad... |
"""
Agent API
This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key mana... |
import _plotly_utils.basevalidators
class ColorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self, plotly_name="color", parent_name="layout.ternary.caxis.tickfont", **kwargs
):
super(ColorValidator, self).__init__(
plotly_name=plotly_name,
parent... |
from django.db.models import F, Sum, Case, Value, When
from usaspending_api.accounts.serializers import (
ObjectClassFinancialSpendingSerializer,
MinorObjectClassFinancialSpendingSerializer,
)
from usaspending_api.financial_activities.models import FinancialAccountsByProgramActivityObjectClass
from usaspending_... |
# Generated by Django 1.11.6 on 2018-04-03 01:52
from django.db import migrations
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
def migrate_fix_invalid_bot_owner_values(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None:
... |
"""Client for Renault API."""
import logging
from datetime import datetime
from datetime import timezone
from typing import cast
from typing import Dict
from typing import List
from typing import Optional
import aiohttp
from .credential_store import CredentialStore
from .exceptions import RenaultException
from .kamer... |
# coding: UTF-8
""" Telco Benchmark for measuring the performance of decimal calculations
- http://speleotrove.com/decimal/telco.html
- http://speleotrove.com/decimal/telcoSpec.html
A call type indicator, c, is set from the bottom (least significant) bit of the duration (hence c is 0 or 1).
A rate, r, is determined f... |
#!/usr/bin/env python3
"""Helper script to bump the current version."""
import argparse
from datetime import datetime
import re
import subprocess
from packaging.version import Version
from homeassistant import const
def _bump_release(release, bump_type):
"""Bump a release tuple consisting of 3 numbers."""
m... |
'''
Created on Mar 14, 2020
@author: ballance
'''
from typing import Dict, List
from vsc.model.covergroup_model import CovergroupModel
class CoverageRegistry(object):
_inst = None
def __init__(self):
# Map of 'simple' typename to a list of specific covergroup
# implementations. Diff... |
# -*- coding: UTF-8 -*-
# Copyright 2011-2019 Rumma & Ko Ltd
# License: BSD (see file COPYING for details)
from __future__ import unicode_literals
from builtins import object
from builtins import str
import logging ; logger = logging.getLogger(__name__)
import json
from io import StringIO
from lxml import etree
from ... |
from textual.app import App
from textual import events
from textual.view import View
from textual.widgets import Placeholder
from textual.layouts.grid import GridLayout
class GridTest(App):
async def on_load(self, event: events.Load) -> None:
await self.bind("q,ctrl+c", "quit", "Quit")
async def on_s... |
from typing import Optional
from pydantic import BaseModel, conint
from datetime import datetime
from . classes import cls_jobs
from .val_user import UserInclude
class JobInclude(BaseModel):
id: int
name: cls_jobs.Name
area: cls_jobs.Area
class Config:
orm_mode = True
class JobCreate(BaseMo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.