text stringlengths 1 927k |
|---|
# -*- 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 TransmissionPerformance(Document):
pass |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "port.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
... |
# -*- coding: utf-8 -*-
"""
Created on Tue May 18 14:52:21 2021
@author: Csaba
"""
import math
def get_parcel_area_ha_2decimals_str(parcel):
# check the parcels projection. if it is not geographic then project it to WG84
orig_crs = parcel.crs
orig_crs_value = orig_crs['init'].split(":")[1]
if not ori... |
# -*- coding: utf-8 -*-
# @Time : 2020/10/2 21:15
# @Author : Zhiwei Yang
from log_lib import log
def remove_duplicates(nums: list) -> int:
"""
给定一个排序数组,你需要在原地删除重复出现的元素,使得每个元素只出现一次,返回移除后数组的新长度。
不要使用额外的数组空间,你必须在原地修改输入数组并在使用 O(1) 额外空间的条件下完成。
示例 1:
给定数组 nums = [1,1,2],
函数应该返回新的长度 2, 并且原数组 num... |
#
# Copyright (C) 2018-2019 de4dot@gmail.com
#
# 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, modify, merge, publ... |
from typing import List
import strawberry
from api.pretix.query import get_user_orders, get_user_tickets
from api.pretix.types import AttendeeTicket, PretixOrder
from api.submissions.types import Submission
from conferences.models import Conference
from submissions.models import Submission as SubmissionModel
@straw... |
"""ZoidbergStudios URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
C... |
# Copyright 2021 Elshan Agaev
#
# 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 operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from de... |
# Generated by Django 3.0.6 on 2020-05-23 10:17
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('photos', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='image',
old_name='image',
new_nam... |
import torch
import torch.nn as nn
import argparse
import numpy as np
from torch.utils.data import DataLoader , Dataset
import pandas as pd
from tqdm import tqdm
from transformers import (
BertTokenizer,
AdamW ,
get_linear_schedule_with_warmup ,
T5Tokenizer,
T5ForConditionalGeneration)
devi... |
# Copyright 2016-2017 The Meson development 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 agree... |
# coding: utf-8
import re
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class HealthMonitor:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is a... |
from methoddispatch import singledispatch
from simple_cqrs.domain_event_bus import DomainEventHandler
class Debugger(DomainEventHandler):
@singledispatch
def process(self, event):
print(
f"Event received: {type(event).__name__} at {event.occurred_on.isoformat()}"
) |
import komand
from .schema import ConnectionSchema
# Custom imports below
import ipahttp
class Connection(komand.Connection):
def __init__(self):
super(self.__class__, self).__init__(input=ConnectionSchema())
def connect(self, params):
server = params.get('server')
username = params.... |
_base_ = [
'../_base_/datasets/ade20k_repeat.py',
'../_base_/default_runtime.py',
'../_base_/schedules/schedule_160k_adamw.py'
]
norm_cfg = dict(type='SyncBN', requires_grad=True)
model = dict(
type='SDModule',
cfg_s=dict(
type='EncoderDecoder',
pretrained='pretrained/mit_b0.pth',
... |
"""
This file offers the methods to automatically retrieve the graph Anopheles funestus.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v11: protein--protein ass... |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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, modify, merge, publish,
... |
# Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import make_response, render_template
from app import app, ENV
@app.errorhandler(404)
def not_found(error):
error = "404 Not found"
return make_response(
render_template("error.html", title = ENV["sitename"], error = error),
404
)
... |
#!/usr/bin/env python3
# Copyright (C) 2017-2022 The btclib developers
#
# This file is part of btclib. It is subject to the license terms in the
# LICENSE file found in the top-level directory of this distribution.
#
# No part of btclib including this file, may be copied, modified, propagated,
# or distributed except... |
# encoding: utf-8
# Copyright 2011 Tree.io Limited
# This file is part of Treeio.
# License www.tree.io/license
#-*- coding: utf-8 -*-
from __future__ import absolute_import, with_statement
__all__ = ['SaleCommonHandler',
'SaleStatusHandler',
'ProductHandler',
'SaleSourceHandler',
... |
"""Retrieves information stored in stache entry secrets."""
import requests
import json
def auth(key, url, cred_type=None, get_all=False):
"""Takes api keys and returns the desired from the stache entry's secret.
Arguments:
key: The stache X-STACHE-READ-KEY.
url: The stache endpoint.
... |
# Copyright 2019 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import flt, getdate
from frappe import _
from frappe.model.mapper import get_mapped_doc
from frappe.model.document imp... |
#!/usr/bin/python
#
# Converts the *instanceIds.png annotations of the Cityscapes dataset
# to COCO-style panoptic segmentation format (http://cocodataset.org/#format-data).
# The convertion is working for 'fine' set of the annotations.
#
# By default with this tool uses IDs specified in labels.py. You can use flag
# -... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-27 13:56
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Creat... |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# Thegroove360 - XBMC Plugin
# Canale altadefinizione01
# ------------------------------------------------------------
import re
import urlparse
from core import config
from core import httptools
from core import logger
from core i... |
import os
import numpy as np
from termcolor import colored
def ndarray_to_bin(ndarray, out_path: str):
"""
ndarray to bin file
(4byte) dim
(4byte) shape x dim
:param ndarray: target numpy ndarrat
:param str out_path: output path
:return: None
"""
with open(out_path, 'wb') as file:... |
min_x = 0
min_y = 0
def init_game():
global min_x, min_y
min_x = 0
min_y = 0
def get_position_middle(max, current):
return int(abs((max - current) / 2))
def get_position_middle_reversed(min, current):
result = get_position_middle(min, current)
if result == 0:
result = 1
return ... |
#!python3.6
import argparse
import glob
import hashlib
import logging
import multiprocessing
import os
import pathlib
import shutil
import sys
from icrawler.builtin import BingImageCrawler
from typing import Any,List
sys.path.append(".")
from postprocessing import format_images
logging_fmt = "%(asctime)s %(levelname)... |
from aip.speech import AipSpeech
appId = '10749810'
apiKey='cxIvL8MP2PBVArtcLCYXZNdC'
secret = '6ef14e35f5376de5fa8b3377ccd7c4bb'
# def get_file_content(filePath):
# with open(filePath, 'rb') as fp:
# return fp.read()
aipSpeech = AipSpeech(appId,apiKey,secret)
vioceFile = open('vioce/180125-230730.wav','... |
import copy
import glob
import os
import time
import operator
from functools import reduce
import gym
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
from arguments import get_args
from vec_env.dummy_vec_env import D... |
import numpy as np
import networkx as nx
import cPickle as cp
import random
import ctypes
import os
import sys
from tqdm import tqdm
sys.path.append( '%s/setcover_lib' % os.path.dirname(os.path.realpath(__file__)) )
from setcover_lib import SetCoverLib
sys.path.append( '%s/../memetracker' % os.path.dirname(os.path.rea... |
from django.conf.urls import url,include
from . import views
from .forms import CustomAutoForm
from django.contrib.auth import views as auth_views
urlpatterns = [
url(r'^$', views.home,name='home'),
url(r'^login/$',auth_views.login, name='login', kwargs={"authentication_form":CustomAutoForm}),
url(r'^logout/$',a... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import asyncio
import sys
from typing import AsyncContextManager, AsyncIterator
from idb.utils.contextlib import asynccontextmanager
from idb.utils.typing import none_throws
READ_CHUNK_SIZE: int = 1024 * 1024 * 4 # 4Mb,... |
# Generated by Django 2.0.5 on 2018-06-19 18:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('transaction', '0023_auto_20180618_1151'),
]
operations = [
migrations.AlterField(
model_name='insurance',
name='is_i... |
b='Phi Feng Xu Tui Han Ku Shen Zhi Pang Zheng Li Wan Fan Xin Ya Vu Ju Shen Ron Mang Tun Zhuo Xi Yin Jing Tun Geng Ji Kei Dit Rom Rang Phen San Dit Ngac De Tron Mun Mep San Phop Zhuan Tie Zhi Ji Ying Wei Huan Ting Chan Jim Kui Qia Ban Cha Tuo Nan Jie Yan Tu Wen Cong Xu... |
# Copyright 2017 Google 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/LICENSE-2.0
#
# Unless required by applicable law or a... |
"""
Provides various authentication policies.
"""
from __future__ import unicode_literals
import base64
from django.contrib.auth import authenticate
from django.core.exceptions import ImproperlyConfigured
from django.middleware.csrf import CsrfViewMiddleware
from django.conf import settings
from rest_framework import ... |
#!/usr/bin/env python3
import sys
import os
import re
from collections import Counter, OrderedDict
from itertools import combinations
from random import sample
from logging import warning
from berttokenizer import basic_tokenize
# BERT special tokens
BERT_SPECIAL = set(['[PAD]', '[UNK]', '[CLS]', '[SEP]', '[MASK]'... |
import sys
import tempfile
import pytest
import csv
import pandas as pd
from tests import API_KEY
from ntropy_sdk import SDK
from ntropy_sdk.benchmark import main
TRANSACTIONS = [
{
"": "0",
"account_id": "6039c4ac1c63e9c7",
"description": "AMAZON WEB SERVICES AWS.AMAZON.CO WA Ref5543286... |
# coding: utf-8
import os
import sys
import cv2
import pandas as pd
import numpy as np
from configparser import ConfigParser
from logging import getLogger
logger = getLogger("__main__").getChild("dataloader")
def config(track, base_dname, config_file='config.ini'):
'''
Load ground_truth directory ini file
... |
import FWCore.ParameterSet.Config as cms
run2_egamma_2018 =cms.Modifier() |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "paratransit.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from typing import TYPE_CHECKING, Type
# To add a new reader add it both to TYPE_CHECKING and _READERS
if TYPE_CHECKING:
from .array_like_reader import ArrayLikeReader # noqa: F401
from .bioformats_reader import BioformatsReader # noqa: F401
from .czi_reade... |
# -*- coding: utf-8 -*-
"""
.. _tut-overview:
Overview of MEG/EEG analysis with MNE-Python
============================================
This tutorial covers the basic EEG/MEG pipeline for event-related analysis:
loading data, epoching, averaging, plotting, and estimating cortical activity
from sensor data. It introdu... |
"""
Convert characters (chr) to integer (int) labels and vice versa.
REVIEW: index 0 bug, also see:
https://github.com/baidu-research/warp-ctc/tree/master/tensorflow_binding
`ctc_loss`_ maps labels from 0=<unused>, 1=<space>, 2=a, ..., 27=z, 28=<blank>
See: https://www.tensorflow.org/api_docs/python/tf/nn/ctc_loss
"... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Get message from Telegram bot and parse it into funds_rate.db
# Copyright © 2021 Jerry Fedorenko aka VM
import sqlite3
import time
import requests
import cfg
def telegram_get(offset=None):
command_list = []
url = cfg.url
token = cfg.token
channel_id =... |
"""
crawler version 2: match strings to get values
"""
import requests
from parsel import Selector
import datetime as dt
import json
import time
import sys
import os
import pandas as pd
import fnmatch as fnm
from lxml import html
# start = time.time()
url='https://coronavirus.ohio.gov/wps/portal/gov/covid-19/'
toda... |
""" """
import pygame
class Robot:
def __init__(self, screen):
self.screen = screen
self.image = pygame.image.load('images/robot.bmp')
self.rect = self.image.get_rect()
self.screen_rect = screen.get_rect()
self.rect.centerx = self.screen_rect.centerx
self.re... |
import logging
from logging.handlers import RotatingFileHandler
from flask import Flask, logging as flask_logger, request
from formatter import ShellishFormatter
app = Flask(__name__)
@app.before_request
def log_request():
return None
@app.get("/hello")
def hello():
app.logger.info("Headers: {}".format(req... |
# coding=utf-8
from enum import *
from socket import *
host = gethostbyname(gethostname())
@unique
class Command(IntEnum):
LOGIN = 11
REGISTER = 12
SEND = 13
@unique
class Status(IntEnum):
MAIN_USER = 21
SPECIAL_USER = 22
@unique
class LoginResult(IntEnum):
SUCCESS = 31
USER_NONE = ... |
import c4d
def collect_material_info(mat, name):
'''Collects Cinama4D standard material informations
- cannot gather data from custom material models
Args:
mat (c4d.TextureTag): input material with data attached
name (str): material channel in which attributes are gathered
Returns:
... |
"""
Buckets for Histograms
"""
def bucket_labels(buckets):
labels = []
for idx, val in enumerate(buckets):
if idx < len(buckets)-2:
label = "{0}-{1}".format(val, buckets[idx+1]-1)
labels.append(label)
if idx == len(buckets)-2:
label = "{0}-{1}".format(val, buc... |
"""create gc_data_file_staging
Revision ID: a2daa4fb5658
Revises: a2424db07997
Create Date: 2021-09-29 11:35:50.653184
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'a2daa4fb5658'
down_revision = 'a2424db07997'
branch_labels = None
depends_on = None
def upgr... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# General information about the project.
import sys
import os
sys.path.insert(0, os.path.dirname(__file__))
from misc.cyverse_sphinx_conf import * # noqa
project = 'HTSeqQC Quick Start'
copyright = '2020, Renesh Bedre'
author = 'Renesh Bedre, Niranjan Baisakh, Kranth... |
#! /usr/bin/env python
# Copyright 2014 SUSE Linux Products GmbH
#
# 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... |
from abc import ABCMeta, abstractmethod
class Field(object, metaclass=ABCMeta):
"""
The "leaf" primitive data type in a schema.
E.g. string, integer, float, etc.
:param description: textual explanation of what the field represents
:param required: True by default. If false - the field is optional... |
# encoding: utf-8
"""A class for managing IPython extensions.
Authors:
* Brian Granger
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2010-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file C... |
from elasticsearch import Elasticsearch, helpers
import os
class ElasticSearch:
def __init__(self, index):
es_host = os.environ['es_hostname']
es_port = os.environ['es_port']
if es_host is None:
exit('You need to export Elasticsearch hostname')
if es_port is None... |
#set( $MyName ="Marco Aurélio Prado" )
#set( $MyEmail ="marco.pdsv@gmail.com" )
# !/usr/bin/env python
# -*- coding: utf-8 -*-
# ======================================================================================================================
# The MIT License (MIT)
# ==============================================... |
"""
Homework4.
Helper functions.
Written by Chen Kong, 2018.
"""
import numpy as np
import matplotlib.pyplot as plt
import scipy.optimize
import submission as sub
def _epipoles(E):
U, S, V = np.linalg.svd(E)
e1 = V[-1, :]
U, S, V = np.linalg.svd(E.T)
e2 = V[-1, :]
return e1, e2
def displayEpipola... |
import sha3
import ethereum
def sig_to_vrs(sig):
# sig_bytes = bytes.fromhex(sig[2:])
r = int(sig[2:66], 16)
s = int(sig[66:130], 16)
v = int(sig[130:], 16)
return v,r,s
def hash_personal_message(msg):
padded = "\x19Ethereum Signed Message:\n" + str(len(msg)) + msg
return sha3.keccak_256(b... |
# coding: utf-8
"""
여보세요 Service Reddit
"""
# std lib
from __future__ import unicode_literals
from django.conf import settings
from logging import getLogger
# external lib
from praw import Reddit as RedditAPI
# yeoboseyo
from yeoboseyo.services import Service
# create logger
logger = getLogger(__name__)
__all__ = ... |
"""
Cisco Intersight
Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environments in more advan... |
import numpy as np
import skflow
from sklearn import datasets
from sklearn import metrics
from sklearn.tree import DecisionTreeClassifier
import tensorflow as tf
import ndf
DEPTH = 4 # Depth of a tree (this includes the leaf probabilities)
N_LEAF = 2 ** (DEPTH - 1) # Number of leaf nodes
N_DECISION_NODES = 2 ** (DE... |
import re
from unittest.mock import Mock
import sqlalchemy as tsa
from sqlalchemy import create_engine
from sqlalchemy import event
from sqlalchemy import pool
from sqlalchemy import select
from sqlalchemy import testing
from sqlalchemy.engine import BindTyping
from sqlalchemy.engine import reflection
from sqlalchemy.... |
# -*- coding: utf-8 -*-
# @Author: 何睿
# @Create Date: 2019-02-02 09:56:05
# @Last Modified by: 何睿
# @Last Modified time: 2019-02-02 12:40:56
from collections import deque
# 实现一个单调非递增队列,继承于deque
class MonotonicQueue(deque):
def __init__(self):
self.queue = deque()
def push(self, n... |
from reamber.quaver.lists.notes import QuaHoldList
from tests.test.qua.test_fixture import qua_map
def test_type(qua_map):
assert isinstance(qua_map.holds, QuaHoldList)
def test_df_names(qua_map):
assert {'offset', 'column', 'length', 'key_sounds'}, set(qua_map.holds.df.columns)
def test_to_yaml(qua_map):
... |
import torch
from torch import nn, einsum
import torch.nn.functional as F
import torchvision.models as models
def exists(val):
return val is not None
# classes
class Inverse(nn.Module):
def __init__(self):
super(Inverse, self).__init__()
self.E = Encoder()
self.D = Img_decoder_v3()... |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Copyright (c) 2017 The Bull Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test a node with the -disablewallet option.
- Test that ... |
from os import remove
from os import execl
import sys
# from git import Repo
# from git.exc import GitCommandError
# from git.exc import InvalidGitRepositoryError
# from git.exc import NoSuchPathError
# from .. import bot
# from userbot.utils import register
import git
import asyncio
import random
import re
import t... |
# Logging level must be set before importing any stretch_body class
import stretch_body.robot_params
stretch_body.robot_params.RobotParams.set_logging_level("DEBUG")
import unittest
import stretch_body.lift
import time
class TestLift(unittest.TestCase):
def test_homing(self):
"""Test lift homes correct... |
# Copyright 2017 Google 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/LICENSE-2.0
#
# Unless required by applicable law or agre... |
from SimpleEvents import Dispatcher
# don't forget about those parentheses.
# It is a parameterized decorator,
# with just one optional parameter.
# @Dispatcher(delegateObject = None)
@Dispatcher()
def doNothing():
pass
@doNothing.subscribe
def noname():
print("A")
@doNothing.subscribe
def noname():
... |
# pylint: disable=wrong-or-nonexistent-copyright-notice
import itertools
import networkx
import numpy as np
import pytest
import matplotlib.pyplot as plt
import cirq
import examples.basic_arithmetic
import examples.bb84
import examples.bell_inequality
import examples.bernstein_vazirani
import examples.bcs_mean_field
... |
import os
import pyproj
from shapely.geometry import Point, LineString, asShape
from shapely.geometry.polygon import Polygon
from .utils import read_json
def generate_circle(lon, lat, radius_meters):
points = list()
for dir in range(0, 360, 15):
p = offset_point(lon, lat, radius_meters, dir)
p... |
# 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... |
"""Platform Models."""
from marshmallow import fields, Schema
from marshmallow.validate import OneOf
from ..enums import *
from ..models.BaseSchema import BaseSchema
from .UserSchema import UserSchema
class VerifyOtpSuccess(BaseSchema):
# User swagger.json
user = fields.Nested(UserSchema, required... |
from django.contrib import admin
from .models import Category,Location,Image
class CategoryAdmin(admin.ModelAdmin):
filter_horizontal =('image',)
admin.site.register(Category)
admin.site.register(Location)
admin.site.register(Image) |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2020 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
# Copyright (c) 2016, 2018, 2020 Claudiu Popa <pcmanticore@gmail.com>
# Copyright (c) 2016 Ceridwen <ceridwenv@gmail.com>
# Copyright (c) 2019 Benjamin Elven <25181435+S3ntinelX@users.noreply.github.com>
# Copyright (c) 2020 hippo91 <guillaume.peillex@gmail.com>
# Licensed under the LGPL: https://www.gnu.org/licenses/... |
# Generated by Django 3.2 on 2021-05-13 19:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('scrapers', '0008_retsinfodocument_scrapers_re_search__7f46e2_gin'),
]
operations = [
migrations.AddField(
model_name='retsinfodocu... |
from pygpu.parser import Compiler
OPERATORS = ['+', '-', '*', '/', '%', '//', '**', 'or', 'and', 'is', 'is not',
'<', '<=', '>', '>=', '!=', '==', '|', '^', '&', '<<', '>>']
PREFIXES = ['+', '-', 'not ', '~']
def test_operators():
for op in OPERATORS:
yield operators, op
def operators(op):
... |
import unittest
import mock
from ...management.resource_servers import ResourceServers
class TestResourceServers(unittest.TestCase):
@mock.patch('auth0.v3.management.resource_servers.RestClient')
def test_create(self, mock_rc):
mock_instance = mock_rc.return_value
r = ResourceServers(domain='... |
print("ff") |
#!/usr/bin/env python3
from __future__ import print_function
import json
import os
import sys
import requests
import traceback
class GoogleChatNotifyResource:
"""Notify resource implementation."""
def send(self, url, msg):
"""Construct the webhook request and send it."""
headers = {'Content-... |
from django import forms
from .models import UserModel
choices = [('vendedor', 'vendedor'), ('cliente', 'cliente')]
class RegisterUser(forms.Form):
imageuser = forms.ImageField()
username = forms.CharField(max_length=255)
email = forms.EmailField()
password = forms.CharField()
status = f... |
"""
Cisco Intersight
Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environments in more advan... |
import numpy as np
import pandas as pd
import random
import joblib
from sklearn.feature_extraction.text import *
print('Libraries imported.')
"""#Import Dataset e print it"""
filename = 'train_dataset.jsonl'
db = pd.read_json(filename,lines=True)
#print(db)
filename='test_dataset_blind.jsonl'
test_db = pd.read_jso... |
from __future__ import absolute_import
import argparse
import logging
import apache_beam as beam
from apache_beam.examples.cookbook.coders import JsonCoder
from apache_beam.io import ReadFromText, BigQueryDisposition
from apache_beam.io import WriteToBigQuery
from apache_beam.options.pipeline_options import PipelineO... |
from rest_framework import generics, mixins
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework.permissions import IsAuthenticated, IsAdminUser
from rest_framework import serializers
from api.models import Logs, Workspaces
from core import utils
from core import d... |
#!/usr/bin/env python
import cgitb; cgitb.enable()
print('Content-type: text/html\n')
print(
"""<html>
<head>
<title>CGI 4 - CSS</title>
<link rel="stylesheet" type="text/css" href="../css/estilo1.css">
</head>
<body>
<h1>Colocando CSS em um script a parte</h1>
<hr>
<p>Ola imagens CGI!</p>
<di... |
#
"""
"""
# end_pymotw_header
import imaplib
import time
import email.message
import imaplib_connect
new_message = email.message.Message()
new_message.set_unixfrom("pymotw")
new_message["Subject"] = "subject goes here"
new_message["From"] = "pymotw@example.com"
new_message["To"] = "example@example.com"
new_message.se... |
# Copyright 2018-2021 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 applicable law or agreed to in wr... |
# 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 modifications or derivat... |
from typing import Tuple
import numpy as np
def gamma_logpdf(x: float, k: float, theta: float) -> float:
"""Log-density of the Gamma distribution up to a constant factor.
Args:
x: Positive number at which to evaluate the Gamma distribution.
k: Shape parameter of the Gamma distribution.
... |
# -*- coding: utf-8 -*-
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
import numpy as np
### hyper parameters ###
IMG_X = 28
IMG_Y = 28
INPUT_DIM = IMG_X * IMG_Y
OUTPUT_DIM = 10
LR = 1e-4
MAX_LOOP = 10000
BATCH_SIZE = 50
KEEP_PROB = 0.5
### hyper parameters ###
# load data
mnist... |
# -*- coding: utf-8 -*-
"""Console script for tempest-zigzag."""
# ======================================================================================================================
# Imports
# ======================================================================================================================
fr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.