text stringlengths 2 999k |
|---|
from rest_framework import serializers
from . models import employee, knowledge
from django.contrib.auth.models import User
class employeesSerializer(serializers.ModelSerializer):
class Meta:
model = employee
fields = '__all__'
class knowledgeSerializer(serializers.ModelSerializer):
class Me... |
#!/usr/bin/env python
import unittest
def solution(H):
nblocks, blocks = 0, []
for h in H:
if not blocks or h >= blocks[-1]:
blocks.append(h)
continue
b = blocks[-1]
tmp = set()
while b > h:
tmp.add(b)
blocks.pop()
if ... |
from imageai.Classification.Custom import ClassificationModelTrainer
model_trainer = ClassificationModelTrainer()
model_trainer.setModelTypeAsResNet50()
model_trainer.setDataDirectory("idenprof")
model_trainer.trainModel(num_objects=10, num_experiments=200, enhance_data=True, batch_size=32, show_network_summary=True)... |
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def __init__(self):
self.ans = 0
def maxDepth_bottom_up(self, root: TreeNode) -> int:
if root == None:
return 0
return max((self.... |
from obj_model import Class, Instance, TYPE, OBJECT
def test_creation():
test_attribute()
test_subclass()
test_callmethod()
def test_attribute():
# Python Code
class A(object):
pass
obj = A()
obj.a = 1
assert obj.a == 1
obj.b = 2
assert obj.b == 2
obj.a = 3
... |
# -*- coding: utf-8 -*-
# Copyright 2018-2019 Streamlit 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 applicabl... |
# Copyright 2011, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... |
# SPDX-License-Identifier: Apache-2.0
"""
subarulink - A Python Package for interacting with Subaru Starlink Remote Services API.
For more details about this api, please refer to the documentation at
https://github.com/G-Two/subarulink
"""
import subarulink.const as const
from subarulink.controller import Controller... |
"""
Copyright (c) 2021 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 writin... |
import platform
plat = platform.system()
if plat == 'Windows':
# WINDOWS MACHINES
from win32api import GetSystemMetrics
w = GetSystemMetrics(0)
h = GetSystemMetrics(1)
elif plat == 'Darwin':
# MAC OSX
# import AppKit
# screen = AppKit.NSScreen.screens()[0]
# w = int(screen.frame().size.w)
# h = int(screen.f... |
from setuptools import setup, find_packages
import os
this_dir = os.path.dirname(os.path.realpath(__file__))
# Parse version
main_ns = {}
with open(os.path.join(this_dir, "paiargparse", "version.py")) as f:
exec(f.read(), main_ns)
__version__ = main_ns["__version__"]
setup(
name="paiargparse",
versio... |
__version_info__ = (1, 17, 1)
__version__ = '.'.join(map(str, __version_info__))
|
import tkinter as tk
import tkinter.font as tkFont
import tkinter.ttk as ttk
import tkinter.messagebox as tkMessageBox
import pymysql.cursors
## Model Class ###############################################################
class Model:
"""
Right now the only options for variables in the url are:
{domain}
... |
import pytest
from tensorflow.core.framework.attr_value_pb2 import AttrValue, NameAttrList
@pytest.fixture(scope='session')
def name_attr_list():
attr = {
'float': AttrValue(f=3.14159),
'list': AttrValue(list=AttrValue.ListValue(b=[True, False, True]))
}
return NameAttrList(name='test_name... |
from rest_framework import serializers
import statistics
from foundation.models import TimeSeriesDatum, Sensor, Instrument
class DashboardSerializer(serializers.BaseSerializer):
def get_values(self,sensor_name, insturments):
sensor = Sensor.objects.get(
name = sensor_name,
instrume... |
# Generated by Django 2.2.17 on 2021-06-16 20:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tfat', '0003_auto_20210108_1518'),
]
operations = [
migrations.AlterField(
model_name='encounter',
name='sex',
... |
if a+1 >= 1 and a == 3 and a == 5 and 1 and 2:
a and b
a = a + 1
b = a
elif a == 0 or a < b+1 or a == 1:
a = 100
elif a()+1:
pass
elif not a:
pass
elif cc:
pass
elif a > b > c < 1:
pass
elif (a>b)>(c==d):
# break
pass
else:
print "error!"
|
# #! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Module that contains functions and classes related with IKs
"""
from __future__ import print_function, division, absolute_import
import maya.cmds
from tpDcc import dcc
from tpDcc.libs.math.core import scalar
from tpDcc.dccs.maya.core import attribute as attr_util... |
import datetime
from concurrent.futures import ThreadPoolExecutor
from pandaharvester.harvestercore import core_utils
from pandaharvester.harvestercore.work_spec import WorkSpec
from pandaharvester.harvestercore.worker_errors import WorkerErrors
from pandaharvester.harvestercore.plugin_base import PluginBase
from pan... |
# coding:utf-8
# author LuShan
# version : 1.1.9
__all__ = 'google_translator'
__version__ = '1.1.9'
from .google_trans_new import google_translator
from .constant import DEFAULT_SERVICE_URLS, LANGUAGES |
"""
NLP Sandbox Data Node API
# Overview The NLP Sandbox Data Node is a repository of data used to benchmark NLP Tools like the NLP Sandbox Date Annotator and Person Name Annotator. The resources that can be stored in this Data Node and the operations supported are listed below: - Create and manage datasets... |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='gust',
version='1.0.2',
description='Gust shim for Python.',
author='Sam Gammon',
author_email='sam.g@cookies.co',
url='https://github.com/sgammon/GUST',
packages=["gust", "gust.core"],
requires=['protobuf']... |
import sys
import re
import traceback
import argparse
import os.path
from modules.combat import CombatModule
from modules.commission import CommissionModule
from modules.enhancement import EnhancementModule
from modules.mission import MissionModule
from modules.retirement import RetirementModule
from modules.headquarte... |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 10
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_9_0_0
from ... |
#!/usr/bin/env python3
from __future__ import annotations
from typing import Generator, Iterable, Optional
from turnips.model import Model
from turnips.multi import (
MultiModel,
TripleModels,
SpikeModels,
DecayModels,
BumpModels,
)
from turnips.ttime import AnyTime
class MetaModel(MultiModel):... |
from django.contrib import admin
from .models import BasicRun, BitbucketRun
admin.site.register(BasicRun)
admin.site.register(BitbucketRun)
|
"""
Data structure for 1-dimensional cross-sectional and time series data
"""
from __future__ import annotations
from textwrap import dedent
from typing import (
IO,
TYPE_CHECKING,
Any,
Callable,
Hashable,
Iterable,
Literal,
Sequence,
Union,
cast,
overload,
)
import warnings... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
import dash
from dash.dependencies import Input, Output
import dash_daq as daq
import dash_html_components as html
import dash_core_components as dcc
from app import app
import pandas as pd
# Hard coded sub category to save space for model on heroku
sub_category_list= [[{'label': 'Art', 'value': 10}, {'label'... |
#!/usr/bin/env python
from __future__ import print_function
import argparse
import sqlite3
import sys
from pycoin.key.Keychain import Keychain
from pycoin.key.subpaths import subpaths_for_path_range
from pycoin.networks.registry import (
network_codes, network_for_netcode
)
def create_parser():
codes = net... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import rospy
from sensor_msgs.msg import *
def callback(joint):
print joint.position
def joint_read():
rospy.init_node('joint_state_publisher', anonymous=True)
sub = rospy.Subscriber('joint_states', JointState, callback)
rospy.spin()
if __name__ == '__main__':
... |
"""
Tic Tac Toe Player
"""
import math
import copy
X = "X"
O = "O"
EMPTY = None
def initial_state():
"""
Returns starting state of the board.
"""
return [[EMPTY, EMPTY, EMPTY],
[EMPTY, EMPTY, EMPTY],
[EMPTY, EMPTY, EMPTY]]
def player(board):
"""
Returns player who ha... |
from rest_framework import serializers
from ..models import ProdottoCombinato
from .barcode import BarcodeInline
from .costo import CostoInline
from .prezzo import PrezzoInline
from .prodotto import ProdottoSerializerMininal
from .prodotto_immagine import ProdottoImmagineInline
class ProdottoCombinatoSerializer(seri... |
import itertools
from abc import abstractmethod
from typing import Union, Iterable
import numpy as np
from scipy.sparse import issparse
from sklearn.base import BaseEstimator, MultiOutputMixin, RegressorMixin
from sklearn.utils.sparsefuncs import mean_variance_axis
from sklearn.utils.validation import check_random_sta... |
import concurrent.futures
from metadata.get_data import MetadataStractor
from scrape.get_links import Scraper
# 4 threads
class SearchEngine:
general_links={}
def __init__(self,root,db):
self.root= root
self.db = db
def index_page(self):
links,content,title = Scraper(self.... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# This signature was contributed by RedSocks - http://redsocks.nl
# See the file 'docs/LICENSE' for copying permission.
from lib.cuckoo.common.abstracts import Signature
class WinSCP(Signature):
name ... |
# -*- coding: utf-8 -*-
"""
Script that contains utliity functions for PhoREAL
Copyright 2019 Applied Research Laboratories, University of Texas at Austin
This package is free software; the copyright holder gives unlimited
permission to copy and/or distribute, with or without modification, as
long as this notice is p... |
import os
import pandas
from tqdm import tqdm
from dlex.datasets.nlp.utils import normalize_string, write_vocab, Vocab
from dlex.utils.logging import logger
from .nmt import NMTBaseDataset
DOWNLOAD_URLS = {
('fra', 'eng'): "https://www.manythings.org/anki/fra-eng.zip",
('spa', 'eng'): "http://stor... |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "actiereg.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
|
# -*- coding: utf-8 -*-
#================================================================
# God Bless You.
#
# author: klaus
# email: klaus.cheng@qq.com
# created date: 2019/12/06
# description:
#
#================================================================
import json
if __name__ == "__main__":
f... |
#!/usr/bin/env python
def simple_search(l:list, item):
"""Perform simple search on a homogenous list for an item and return it's
location.
Args:
l (list): the homogenous list to be searched
item (): the item to look for in the list
Returns:
int: index location of item in list... |
"""
Matplotlib volumetric benchmarking plotting routines.
"""
#***************************************************************************************************
# Copyright 2015, 2019 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
# Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Go... |
"""
Description : This file implements the IPLoM algorithm for log parsing
Author : LogPAI team
License : MIT
"""
import copy
import sys
from datetime import datetime
import os
import gc
import re
import pandas as pd
import hashlib
import string
class Partition:
""" Wrap around the log... |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import tensorflow as tf
import numpy as np
import SimpleITK as sitk
import traceback
class AbstractReader(object):
"""Abstract reader
Abstract reader class for data I/O. Provides the queue handling an... |
# coding: utf-8
import hmac
from json import dumps, loads
from base64 import b64encode,b64decode
from Crypto.Hash import SHA256
from Crypto.Cipher import AES
import warnings
from zope.interface import implementer
from pyramid.security import Everyone, Authenticated
from pyramid.interfaces import IAuthenticationPolicy... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'gui2.ui'
#
# Created by: PyQt5 UI code generator 5.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.... |
# https://github.com/methylDragon/opencv-python-reference/blob/master/02%20OpenCV%20Feature%20Detection%20and%20Description.md
# Source: https://docs.opencv.org/3.4.4/dc/dc3/tutorial_py_matcher.html
import numpy as np
import cv2 as cv
img1 = cv.imread("box.png") # queryImage
img2 = cv.imread("box_in_scene.png") # t... |
from __future__ import print_function
import os
import sys
import time
import torch
import math
import numpy as np
import cv2
def _gaussian(
size=3, sigma=0.25, amplitude=1, normalize=False, width=None,
height=None, sigma_horz=None, sigma_vert=None, mean_horz=0.5,
mean_vert=0.5):
# handle ... |
# Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information regarding
# copyright ownership. The Modin Development Team licenses this file to you under the
# Apache License, Version 2.0 (the "License"); you may not u... |
# ----------------------------------------------------------------------------
# Copyright 2014 Nervana 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.o... |
import rlp
from indy_common.constants import ROLE, TGB, TRUST_ANCHOR
from plenum.common.constants import VERKEY, TRUSTEE, STEWARD, THREE_PC_PREFIX, \
TXN_TIME
from plenum.common.types import f
from storage.kv_store import KeyValueStorage
from storage.optimistic_kv_store import OptimisticKVStore
from stp_core.commo... |
import os
import random
import xml.etree.ElementTree as ET
from utils.utils import get_classes
#--------------------------------------------------------------------------------------------------------------------------------#
# annotation_mode用于指定该文件运行时计算的内容
# annotation_mode为0代表整个标签处理过程,包括获得VOCdevkit/VOC2007/Imag... |
#!/usr/bin/env python3
# Copyright (c) 2014-2019 The Eozi Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the listtransactions API."""
from decimal import Decimal
from io import BytesIO
from test_framework.... |
from django.db import models
from hosts.cus_auth import UserProfile
# Create your models here.
class Host(models.Model):
name = models.CharField(max_length=64)
sn = models.CharField(max_length=128)
# 此处sn不加非空约束是因为hostbiao可以包含虚拟机,我们cmdb中的server也不能直接外键关联到host表,后续可以通过第三方脚本来实现数据导入
ip_address = models.Gene... |
"""DNS Authenticator for Linode."""
import logging
import re
from lexicon.providers import linode
from lexicon.providers import linode4
import zope.interface
from certbot import errors
from certbot import interfaces
from certbot.plugins import dns_common
from certbot.plugins import dns_common_lexicon
logger = loggin... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipaySecurityProdFacepayVerifyModel(object):
def __init__(self):
self._check_code = None
self._face_image = None
self._ftoken = None
self._store_id = None
... |
# -*- coding: UTF-8 -*-
"""
This module is intend to solve the matrix equation
sum_i=1^r Ax_i X Ay_i = F
Where Ay_i are circulant matrices
Ax_i is in general are band matrices
"""
import numpy as np
from scipy.linalg import circulant, inv
from scipy.sparse import csr_matrix, diags
from scipy.sparse.linalg... |
# Copyright The OpenTelemetry 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 by applicable law or agreed to in ... |
"""added user is_active
Revision ID: 0502a89b8394
Revises: 8f9f223976a8
Create Date: 2021-01-27 12:30:38.668195
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '0502a89b8394'
down_revision = '8f9f223976a8'
branch_labels = None
depends_on = None
def upgrade():... |
#!/usr/bin/env python
"""@package docstring
File: me_zrl_odes.py
Author: Adam Lamson
Email: adam.lamson@colorado.edu
Description: Class that contains the all ODEs relevant to solving the moment
expansion formalism of the Fokker-Planck equation for bound crosslinking motors.
"""
from scipy.integrate import dblquad
from... |
import time
import datetime
import os
import sys
lib_path = os.path.abspath(os.path.join('..'))
sys.path.append(lib_path)
import re
import subprocess
import pprint
import json
import copy
import yaml
from fcntl import fcntl, F_GETFL, F_SETFL
from os import O_NONBLOCK, read
import socket
import struct
from collections i... |
#
# 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 us... |
from stable_baselines3.c51.c51 import C51
from stable_baselines3.c51.policies import MlpPolicy
|
import torch
from torch.utils import data
from torch import nn
from torch.optim import lr_scheduler
from dataset import custom_dataset
from model import EAST
from loss import Loss
import os
import time
import numpy as np
def train(train_img_path, train_gt_path, pths_path, batch_size, lr, num_workers, epoch_iter, inte... |
"""Generate an integration."""
import json
from pathlib import Path
from .const import COMPONENT_DIR, TESTS_DIR
from .model import Info
TEMPLATE_DIR = Path(__file__).parent / "templates"
TEMPLATE_INTEGRATION = TEMPLATE_DIR / "integration"
TEMPLATE_TESTS = TEMPLATE_DIR / "tests"
def generate(info: Info) -> None:
... |
'''
Created on Mar 22, 2013
@author: Ash Booth
'''
class OrderList(object):
def __init__(self):
self.headOrder = None
self.tailOrder = None
self.length = 0
self.volume = 0 # Total share volume
self.last = None
def __len__(self):
return self.length
... |
from django.test import TestCase
from django.core.exceptions import ValidationError
from chatterbot.ext.django_chatterbot.views import ChatterBotView
class MockResponse(object):
def __init__(self, pk):
self.session = {'chat_session_id': pk}
class ViewTestCase(TestCase):
def setUp(self):
su... |
import pygame
from octagon.utils import get_outline_mask, var
from octagon.utils.static import angle_deg, conv_deg_rad, sin, cos
class Attack(pygame.sprite.Sprite):
def __init__(self, env, image, offset=0, displacement=20):
pygame.sprite.Sprite.__init__(self)
self.env = env
self.env.melee... |
# -*- coding: utf-8 -*-
#
# Flit documentation build configuration file, created by
# sphinx-quickstart on Sun Mar 15 19:16:41 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... |
# Copyright (c) 2016 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'test-compile-as-winrt',
'type': 'executable',
'msvs_windows_sdk_version': 'v10.0',
'msvs_s... |
from django.urls import path,include, re_path
from django.conf import settings
from django.conf.urls.static import static
from . import views
from django.conf.urls import url
urlpatterns= [
path('', views.index, name='index'),
url(r'^new/post/$', views.new_post, name='new_post'),
url(r'^projects/$', views.... |
# # 01 solution
def palindrome(sequence):
result = []
for element in range(len(sequence)):
backwards_number = ''.join(reversed(sequence[element]))
if sequence[element] == backwards_number:
result.append(sequence[element])
return print(result)
line = input().split(" ")
search_fo... |
import collections
from collections import defaultdict
import numpy as np
import torch
import torch.nn.functional as F
from torch.utils.data.dataloader import default_collate
from .data_container import DataContainer
def collate(batch, samples_per_gpu=1):
"""Puts each data field into a tensor/DataContainer with... |
import time
import tkinter
from tkinter import filedialog
from bs4 import BeautifulSoup
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
language_save = [... |
#!/usr/bin/env python
# Copyright 2014-2019 The PySCF Developers. 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
#
# U... |
"""
This migration script adds the following new tables for supporting Galaxy forms:
1) form_definition_current
2) form_definition
3) form_values
4) request_type
5) request
6) sample
7) sample_state
8) sample_event
"""
import datetime
import logging
from sqlalchemy import (
Boolean,
Column,
DateTime,
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
import requests
import argparse
from decimal import Decimal
def build_parser():
parser = argparse.ArgumentParser(description='Check bandwidth status')
parser.add_argument('-H', '--host', type=str, required=True, dest='host')
parser.add_... |
import keyboard
import os
import numpy as np
import time
import cv2
from typing import Union, TypeVar, Callable
from utils.custom_mouse import mouse
from utils.misc import wait, cut_roi, image_is_equal
from logger import Logger
from config import Config
from screen import grab, convert_screen_to_monitor, convert_abs_to... |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from collections import OrderedDict
import json
from xml.dom.minidom import Entity
from sim_model import graph
# ==========================================================... |
# Soma os dois valores informados e mostra o resultado no final.
print('Ola, este programa serve para você diminuir 2 valores')
n1 = int(input('Digite um valor: '))
n2 = int(input('Digite um valor: '))
r = n1 - n2
print (f'A soma do valor {n1} e do valor {n2}, teve como resultado o valor {r}') |
#!/usr/bin/env python3
# encoding: utf-8
import sys
import argparse
import json
import codecs
import yaml
import torch
import torchaudio
import torchaudio.compliance.kaldi as kaldi
from torch.utils.data import Dataset, DataLoader
torchaudio.set_audio_backend("sox_io")
class CollateFunc(object):
''' Collate fun... |
from __future__ import division
from __future__ import print_function
import imaginet.simple_data as sd
import imaginet.data_provider as dp
import imaginet.vendrov_provider as vendrov
import imaginet.experiment as E
import imaginet.defn.audiovis_rhn as Speech
import imaginet.defn.visual2_rhn as Text
import imaginet.tas... |
from __future__ import absolute_import
from builtins import range
import logging
import keras.backend as ker
from numpy import pi as pi_const
from keras.layers import Lambda, Multiply, Add
from keras.models import Input
from keras.models import Model
from .sampling import sample_standard_normal_noise
from .architect... |
#!/usr/bin/python
# Copyright 2003 Dave Abrahams
# Copyright 2002, 2003, 2004 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
import BoostBuild
def test_basic():
t = BoostBuild.Tester... |
from pprint import pprint
class Bit:
ZERO = 0x0000
ONE = 0x0001
TWO = 0x0002
THREE = 0x0004
FOUR = 0x0008
FIVE = 0x0010
SIX = 0x0020
SEVEN = 0x0040
EIGHT = 0x0080
def __init__(self):
self.__value = self.ZERO
def set(self, position):
self.__value |= positi... |
import rebiber
from rebiber.bib2json import normalize_title, load_bib_file
import argparse
import json
import bibtexparser
import os
import re
def construct_bib_db(bib_list_file, start_dir=""):
with open(bib_list_file) as f:
filenames = f.readlines()
bib_db = {}
for filename in file... |
#!/usr/bin/env python3
from flask import abort, jsonify, request
from flask_classful import FlaskView
from marshmallow import ValidationError
from utils import ponytoken_required, this_player, anyadmin_required, json_required
from model import db, Pony, Hug
from schemas import PonySchema
class PoniesView(FlaskView... |
# -*- coding: utf-8 -*-
# Copyright (c) 2021, Teampro and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
class DSVideo(Document):
pass
|
FILE_NOT_FOUND = "FILE_NOT_FOUND"
ELEMENT_NOT_FOUND = "ELEMENT_NOT_FOUND"
|
from django.conf import settings
from djangae import environment
import logging
import os
import grpc
default_app_config = 'djangae.tasks.apps.DjangaeTasksConfig'
CLOUD_TASKS_PROJECT_SETTING = "CLOUD_TASKS_PROJECT_ID"
CLOUD_TASKS_LOCATION_SETTING = "CLOUD_TASKS_LOCATION"
def get_cloud_tasks_client():
"""
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/1/14 12:38
# @Author : WIX
# @File : NumberOf1InBinary.py
"""
题目:请实现一个函数,输入一个整数,输出该数二进制表示中1的个数。例如把9表示成二进制是1001,有2位是1。因此如果输入9,该函数输出2。
"""
"""
总结:
把一个整数减1后在和原来的整数做位的与运算,得到的结果相当于把整数的二进制表示中最右边的1变成0
"""
import unittest
class Solution(object):
def nu... |
#! /usr/bin/env python
import sys
import os
import re
import datetime
from argparse import ArgumentParser
from log_it import *
#############################################################################
# Created on September 25, 2013 by Gail Schmidt, USGS/EROS
# Created Python script to generate the configuration ... |
from unittest import TestCase
from flask_sqlalchemy import SQLAlchemy
from logistik.db import HandlerConf
from logistik.utils.decorators import with_session
from logistik.utils.exceptions import HandlerNotFoundException
from test.base import MockEnv
from flask import Flask
from logistik import environ
from logistik.... |
"""Make / Download Telegram Sticker Packs without installing Third Party applications
Available Commands:
.kangsticker [Optional Emoji]
.packinfo
.getsticker"""
from telethon import events
from io import BytesIO
from PIL import Image
import asyncio
import datetime
from collections import defaultdict
import math
import ... |
# Copyright (c) 2018 Micro Focus or one of its affiliates.
# Copyright (c) 2018 Uber Technologies, 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... |
"""Support for Roku binary sensors."""
from __future__ import annotations
from collections.abc import Callable
from dataclasses import dataclass
from rokuecp.models import Device as RokuDevice
from homeassistant.components.binary_sensor import (
BinarySensorEntity,
BinarySensorEntityDescription,
)
from homea... |
import os
import argparse
import struct
import random
import numpy as np
from sklearn import linear_model
from scipy.misc import imresize
# File names
TRAIN_DAT = 'train-images-idx3-ubyte'
TRAIN_LAB = 'train-labels-idx1-ubyte'
TEST_DAT = 't10k-images-idx3-ubyte'
TEST_LAB = 't10k-labels-idx1-ubyte'
def show(image):
... |
import pygame as pg, random as rnd
BREITE, HÖHE = 1000, 600
GRÖßE = 20
score, tempo = 0, 5
snake = [(BREITE//2, HÖHE//2)]
richt_x, richt_y = 1, 0
bonus_x, bonus_y = 300, 300
richtungen = {pg.K_DOWN:(0,1), pg.K_UP: (0,-1), pg.K_LEFT: (-1,0), pg.K_RIGHT: (1,0)}
with open('Teil_18_Highscore.txt','r') as f:
high = int(f... |
# coding: utf-8
#
import argparse
import socket
from pprint import pprint
import tornado.ioloop
from logzero import logger
from rethinkdb import r
from tornado.httpserver import HTTPServer
from tornado.log import enable_pretty_logging
from web.database import db
from web.entry import make_app
from web.views import O... |
#!/usr/bin/env python3
# This file is covered by the LICENSE file in the root of this project.
import imp
import torch
import torch.nn as nn
import torch.nn.functional as F
from tasks.semantic.postproc.CRF import CRF
import __init__ as booger
class Segmentator(nn.Module):
def __init__(self, ARCH, nclasses, path=Non... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.