text stringlengths 1 927k |
|---|
from sbody.alignment.mesh_distance import * |
# Copyright 2021 Huawei Technologies Co., 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 agreed to... |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2021 fetchai
#
# 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
#
#... |
from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret the config file for Python... |
'''
Created on 29.09.2017
@author: lemmerfn
'''
import numpy as np
import scipy.stats
from functools import total_ordering
from .measures import AbstractInterestingnessMeasure, BoundedInterestingnessMeasure
from .utils import effective_sample_size, powerset
from .subgroup import SubgroupDescription, Subgroup, Nominal... |
"""
Handle the files generation.
""" |
# -*- coding:utf-8 -*-
"""
mincheng:mc.cheng@my.cityu.edu.hk
"""
from __future__ import division
import sys
import printlog
import datetime
import os
import time
import sklearn
from sklearn.metrics import confusion_matrix
from baselines import sclearn
import evaluation
from collections import defaultdict
import tensorf... |
import json
import os
import discord
import asyncio
import datetime
from discord.ext import commands, tasks
with open('config.json') as e:
infos = json.load(e)
token = infos['token']
prefix = infos['prefix']
lara = commands.Bot(command_prefix=prefix, case_insensitive=True, intents=discord.Intents.all())
... |
from PIL import Image
import hashlib
import time
import os
import xbmcaddon
addonPath = xbmcaddon.Addon().getAddonInfo("path")
communityStreamPath = os.path.join(addonPath,'resources')
communityStreamPath = os.path.join(communityStreamPath,'community')
#print 'path is ',communityStreamPath
import math
class VectorCom... |
# 15. 3Sum
from collections import defaultdict
class Solution:
# TLE at test # 312 out of 313
def threeSum(self, nums):
n = len(nums)
dic = defaultdict(set)
nums.sort()
mini = nums[0]
# d = {}
for i in range(n):
dic[nums[i]].add(i)
# d.setd... |
import math
import torch
import random
import numpy as np
import torch.nn as nn
from numpy import int64 as int64
import torchvision.transforms as transforms
from PIL import Image, ImageOps, ImageFilter
class Normalize(object):
"""Normalize a tensor image with mean and standard deviation.
Args:
mean (... |
'''
Properly implemented ResNet-s for CIFAR10 as described in paper [1].
The implementation and structure of this file is hugely influenced by [2]
which is implemented for ImageNet and doesn't have option A for identity.
Moreover, most of the implementations on the web is copy-paste from
torchvision's resnet and has w... |
import re
class EndpointManager(object):
def __init__(self, session):
self.session = session
def __getattr__(self, name):
return SessionContext(self.session, name)
class SessionContext(object):
def __init__(self, session, name):
self.session = session
self.prefix = '/api... |
#!/usr/bin/env python
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------... |
import sonnet as snt
import tensorflow as tf
from util.helper import GraphKeys, add_to_collection
from util.layers import DenseLayer, LossLayer, OptimizerLayer, ModelBase
class PairwiseGMF(ModelBase):
def __init__(self, config):
"""
:param config:
"""
# super(PairwiseGMF, self)._... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
# -*- 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... |
# Copyright (C) 2019 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Test user permissions loading and caching."""
import mock
from appengine import base
from ggrc.models import all_models
from ggrc.cache import utils as cache_utils
from integration.ggrc import TestCase,... |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2021, John McNamara, jmcnamara@cpan.org
#
import unittest
from io import StringIO
from ...worksheet import Worksheet
class TestWriteSheetViews(unittest.TestCase):
"""
Test the Wor... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-09-01 01:44
from __future__ import unicode_literals
import django.contrib.auth.models
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0001_initial'),
... |
import jieba
import jieba.posseg as pseg
def user_dict():
from sagas.conf import resource_path
dictf = resource_path('dict_zh.txt')
jieba.load_userdict(dictf)
seg_list = jieba.cut("列出所有的采购订单") # 默认是精确模式
print(", ".join(seg_list))
def user_words():
jieba.add_word('寄账单地址', tag='typ')
jieba... |
# -*- coding: utf8 -*-
import pandas as pd
import pymysql
# import configuration in parent dir
import os, sys, inspect
current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parent_dir = os.path.dirname(current_dir)
sys.path.insert(0, parent_dir)
import configuration as conf
# import ... |
# Copyright 2014-2015 Canonical Limited.
#
# 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 ... |
#!/usr/bin/env python
#-*- coding:utf-8; mode:python; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*-
from bes.testing.unit_test import unit_test
from bes.git.git_head_info import git_head_info
class test_git_head_info(unit_test):
def test_parse_head_info(self):
f = git_head_info.parse_head_info
... |
class ResNet |
import pickle
from myutils import load_dataset, call_home, CMDisplay
from itertools import chain
import torch
import torch.nn.functional as F
from torch.nn import Linear as Lin
from torch.optim import Adam
from torch_geometric.nn import XConv, fps, global_mean_pool
import pytorch_lightning as pl
from pytorch_lightni... |
from NFSP.TrainingProfile import TrainingProfile
from NFSP.workers.driver.Driver import Driver
from PokerRL import DiscretizedNLHoldem, Poker
from PokerRL.eval.lbr import LBRArgs
from PokerRL.game import bet_sets
if __name__ == '__main__':
# Agent processes: 1 Chief, 2 Parameter-servers, 11 LAs
# Eval processe... |
from .message_type import MessageType
class BaseMessage(object):
def __init__(self, message_type):
self.type = MessageType(message_type)
class BaseHeadersMessage(BaseMessage):
"""
All messages expct ping can carry aditional headers
"""
def __init__(self, message_type, headers):
... |
#!/usr/bin/env python3
# The Notices and Disclaimers for Ocean Worlds Autonomy Testbed for Exploration
# Research and Simulation can be found in README.md in the root directory of
# this repository.
import rospy
import actionlib
from ow_lander.msg import *
from LanderInterface import MoveItInterface
from LanderInterf... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-12-21 23:06
from __future__ import unicode_literals
from django.db import migrations, models
from identipy_app.models import SearchRun
def define_runs(apps, schema_editor):
PepXMLFile = apps.get_model('identipy_app', 'PepXMLFile')
SearchRun = apps.g... |
import random
import time
from pythonosc import osc_message_builder
from pythonosc import udp_client
client=udp_client.SimpleUDPClient("127.0.0.1",8000)
dest = [
"/red/scale",
"/red/offset",
"/red/speed",
"/green/scale",
"/green/offset",
"/green/speed",
"/blue/scale",
"/blue/offset",
... |
r"""Functional interface, port from torch/optim/_function.py"""
import torch
from torch import Tensor
from typing import List, Optional
def is_master_weight(param, params_attr):
return (
param.dtype == torch.float and
param in params_attr and
'bf16_param' in params_attr[param]
)
def g... |
# -*- coding: utf-8 -*-
"""
command line interface (cli) code.
"""
# pylint: disable=line-too-long
from __future__ import print_function
import argparse
from .arguments import Arguments
import json
from .pycompat import configparser
import logging
import os
import sys
import textwrap
from . import __version__
def err... |
#Implementation of Two Player Tic-Tac-Toe game in Python.
''' We will make the board using dictionary
in which keys will be the location(i.e : top-left,mid-right,etc.)
and initialliy it's values will be empty space and then after every move
we will change the value according to player's choice of move. '... |
import logging
from collections.abc import MutableMapping
import AFQ.data as afd
logging.basicConfig(level=logging.INFO)
__all__ = ["PediatricBundleDict", "BundleDict"]
def do_preprocessing():
raise NotImplementedError
BUNDLES = ["ATR", "CGC", "CST", "IFO", "ILF", "SLF", "ARC", "UNC",
"FA", "FP"]... |
from controllers import pages
wsgi_routes = [
(r'/', pages.home),
(r'/(\w+)', pages.template),
] |
import os
import sys
from RLTest import Env
from redisgraph import Graph, Node, Edge
from collections import Counter
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from base import FlowTestsBase
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../../')
from demo import QueryInfo
GRAPH_I... |
##########################################################################
#
# Copyright (c) 2015, John Haddon. 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 so... |
#
# A wrapper script that trains the SELDnet. The training stops when the early stopping metric - SELD error stops improving.
#
import os
import sys
import numpy as np
import cls_feature_class
import cls_data_generator
from cls_compute_seld_results import ComputeSELDResults, reshape_3Dto2D
import keras_model
import pa... |
"""SmartFactory code generator for JSONRPC format.
Defines JSONRPC format specific code generation rules.
"""
import string
from generator.generators import SmartFactoryBase
from model.enum_element import EnumElement
class CodeGenerator(SmartFactoryBase.CodeGenerator):
"""JSONRPC SmartFactory generator.
... |
import os
from prequ._pip_compat import (
create_package_finder, install_req_from_editable, install_req_from_line)
from prequ.exceptions import (
IncompatibleRequirements, NoCandidateFound, UnsupportedConstraint)
from .dirs import FAKE_PYPI_WHEELS_DIR
from .test_repositories import get_pypi_repository
try:
... |
import networkx as nx
import threading
from dbt.compat import PriorityQueue
from dbt.node_types import NodeType
GRAPH_SERIALIZE_BLACKLIST = [
'agate_table'
]
def from_file(graph_file):
linker = Linker()
linker.read_graph(graph_file)
return linker
def is_blocking_dependency(node):
return node... |
# Copyright 2017 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 csv
import os
import math
from . import dictionary
from . import texthandler
from itertools import islice
import string
punctuation = ['.', ',', '!', '?', '(', ')', '$', ':', ';', '{', '}', '[', ']', '•', '|']
def text_from_path(path):
with open(path) as f:
return f.read()
def text_from_directory(dirpath)... |
"""Contains the base scenario class."""
from flow.core.params import InitialConfig
from flow.core.params import TrafficLightParams
from flow.core.params import SumoCarFollowingParams
from flow.core.params import SumoLaneChangeParams
import time
import xml.etree.ElementTree as ElementTree
from lxml import etree
from co... |
from __future__ import absolute_import, division, print_function
'''
'''
import iotbx.pdb
import mmtbx.model
from iotbx.file_reader import any_file
from iotbx.data_manager import DataManagerBase
from libtbx import Auto
from libtbx.utils import Sorry
# =================================================================... |
# Auto generated from issue_113.yaml by pythongen.py version: 0.4.0
# Generation date: 2020-08-04 09:37
# Schema: schema
#
# id: https://microbiomedata/schema
# description:
# license: https://creativecommons.org/publicdomain/zero/1.0/
import dataclasses
import sys
from typing import Optional, List, Union, Dict, Class... |
"""
Mask R-CNN
The main Mask R-CNN model implementation.
Copyright (c) 2017 Matterport, Inc.
Licensed under the MIT License (see LICENSE for details)
Written by Waleed Abdulla
"""
import os
import datetime
import re
import math
from collections import OrderedDict
import multiprocessing
import numpy as np
import tenso... |
"""
Unit and regression test for the pyrism package.
"""
# Import package, test suite, and other packages as needed
import pyrism
import pytest
import sys
def test_pyrism_imported():
"""Sample test, will always pass so long as import statement worked"""
assert "pyrism" in sys.modules |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
def exclusive_cumprod(tensor, dim: int, eps: float = 1e-10):
"""
Implementing exclusive cumprod.
There is cumprod i... |
# the code mostly from https://github.com/sdoria/SimpleSelfAttention
# adapted from https://github.com/fastai/fastai/blob/master/examples/train_imagenette.py
# added self attention parameter
# changed per gpu bs for bs_rat
from fastai.script import *
from fastai.vision import *
from fastai.callbacks import *
from fa... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ppdb_mvt.settings')
try:
from django.core.management import execute_from_command_line
except Imp... |
"""
This module is largely inspired by django-rest-framework settings.
Settings for the OAuth2 Provider are all namespaced in the OAUTH2_PROVIDER setting.
For example your project's `settings.py` file might look like this:
OAUTH2_PROVIDER = {
"CLIENT_ID_GENERATOR_CLASS":
"oauth2_provider.generators.Client... |
from typing import Any, Dict, List, Optional, Type
import gym
import torch as th
from torch import nn
from stable_baselines3.common.policies import BasePolicy, register_policy
from stable_baselines3.common.torch_layers import BaseFeaturesExtractor, FlattenExtractor, NatureCNN, create_mlp
from stable_baselines3.common... |
import _plotly_utils.basevalidators
class ZautoValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(self, plotly_name="zauto", parent_name="histogram2d", **kwargs):
super(ZautoValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... |
# The MIT License (MIT)
#
# Copyright (c) 2016 Francis T. O'Donovan
#
# 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, co... |
import os
import requests
import matplotlib.pyplot as plt
from PIL import Image
from io import BytesIO, StringIO
import uuid
#config
download_folder = "data/huskies"
search_term = "siberian husky"
bing_api_key = os.path.join(os.getenv('HOME'), ".bingimagessearchkey")
subscription_key = open(bing_api_key,"rt").readlin... |
# 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 ... |
import hug
import sub_api
@hug.cli()
def echo(text: hug.types.text):
return text
@hug.extend_api(sub_command="sub_api")
def extend_with():
return (sub_api,)
if __name__ == "__main__":
hug.API(__name__).cli() |
import tensorflow as tf
class InverseDecay(tf.optimizers.schedules.LearningRateSchedule):
def __init__(self, initial_learning_rate, decay_rate):
super(InverseDecay, self).__init__()
self.initial_learning_rate = initial_learning_rate
self.decay_rate = decay_rate
def __call__(self, ste... |
#!python
from linkedlist import LinkedList
class LinkedStack(object):
def __init__(self, iterable=None):
"""Initialize this stack and push the given items, if any."""
# Initialize a new linked list to store the items
self.list = LinkedList()
if iterable is not None:
f... |
import argparse
import bokeh.plotting
import bokeh.models
import bokeh.palettes
import bokeh.colors
import cartopy
import numpy as np
import netCDF4
GOOGLE = cartopy.crs.Mercator.GOOGLE
PLATE_CARREE = cartopy.crs.PlateCarree()
def parse_args(argv=None):
parser = argparse.ArgumentParser()
parser.add_argument... |
#!/usr/bin/python
import os,sys,re,json
TESTING = ['ca', 'un.int']
def sortInfo(a, b):
if a[0] > b[0]:
return -1
elif a[0] < b[0]:
return 1
else:
return 0
class Courts():
def __init__(self, opt):
self.opt = opt
self.walk()
def checkFile(self, dirname... |
"""
Copyright (c) 2022 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W... |
class Solution:
def maxEqualRowsAfterFlips(self, matrix: List[List[int]]) -> int:
pattern = collections.defaultdict(int)
for row in matrix:
pattern[tuple(row)] += 1
pattern[tuple(1 - c for c in row)] += 1
return max(pattern.values()) |
# Generated by Django 2.2.3 on 2019-07-17 13:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main_hub', '0004_auto_20190717_1154'),
]
operations = [
migrations.RemoveField(
model_name='document',
name='file',
... |
# coding:utf8
"""系统全局加载模块
外部调用想要影响fastweb行为,必须通过改模块中的方法
所有工作都是在启动前完成,外部导入全部使用全路径引用,防止错误的引入
"""
import json
from .accesspoint import ioloop
import fastweb.manager
from fastweb.util.tool import timing
from fastweb.accesspoint import AsyncHTTPClient
from fastweb.util.configuration import ConfigurationParser
from fastw... |
import unittest
import circuitgraph as cg
from circuitgraph.analysis import *
from circuitgraph.sat import sat
from random import choice, randint
from itertools import product
class TestAnalysis(unittest.TestCase):
def setUp(self):
self.s27 = cg.strip_blackboxes(cg.from_lib("s27"))
def test_avg_sens... |
# 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 ... |
# coding=utf-8
# Copyright 2014-2016 F5 Networks 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 o... |
load("//build_defs/kotlin_native:repo.bzl", "get_dependencies")
KtNativeInfo = provider(
doc = "The minimum info about a Kotlin/Native dependency",
fields = dict(
klibraries = "Depset of klib files to compile against.",
),
)
def _common_args(ctx, klibs):
args = ctx.actions.args()
# Pass d... |
"""
This file is part of the OpenProtein project.
For license information, please see the LICENSE file in the root directory.
"""
import sys
from enum import Enum
import glob
import pickle
import numpy as np
import torch
import torch.autograd as autograd
import torch.nn as nn
import openprotein
from experiments.tmhmm... |
import psyneulink as pnl
comp = pnl.Composition(name="comp")
A = pnl.TransferMechanism(
name="A",
function=pnl.Linear(default_variable=[[0]]),
termination_measure=pnl.Distance(
metric=pnl.MAX_ABS_DIFF, default_variable=[[[0]], [[0]]]
),
)
B = pnl.TransferMechanism(
name="B",
function=p... |
# 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 ... |
#!/usr/bin/env python3
""" Demo for Renyi mutual information estimators.
Analytical vs estimated value is illustrated for normal random variables.
"""
from numpy.random import rand, multivariate_normal
from numpy import arange, zeros, dot, ones
import matplotlib.pyplot as plt
from ite.cost.x_factory import co_fact... |
"""
Advanced reporter configuration module
This module retrieves configuration in YAML format and converts it to JSON
There is only PUT method for editing the configuration
Path to configuration is specified in config.ini in this folder.
"""
from liberouterapi import config
from liberouterapi.error import ApiExcepti... |
#!/usr/bin/env python3
import argparse
import hashlib
# This script reads the --value argument from the command
# line and outputs its SHA 512 hash.
# In this tutorial, we use this for generating the value
# that the application uses for its basic authentication.
# We do this, so the basic auth secret is not stored i... |
"""Initialize OrcaBaseWorkChain"""
from .base import OrcaBaseWorkChain |
from .hotline_db import hotline_db
class crisis_numbers(hotline_db.Document):
country = hotline_db.StringField(required=True, unique=True)
numbers = hotline_db.StringField(required=True)
website = hotline_db.StringField(required=True) |
# -*- coding: utf-8 -*-
import yaml
from bag.core import BagProject
from serdes_ec.layout.analog.passives import PassiveCTLE
if __name__ == '__main__':
with open('specs_test/serdes_ec/passives/ctle.yaml', 'r') as f:
block_specs = yaml.load(f)
local_dict = locals()
if 'bprj' not in local_dict:
... |
import yaml
from definitions import CONFIG_PATH, DEFAULT_SETTINGS
config = yaml.safe_load(open(CONFIG_PATH, encoding="utf8"))
for setting, default_value in DEFAULT_SETTINGS.items():
if setting not in config:
config[setting] = default_value |
from typing import Dict, Optional
from marshmallow import fields, validate
from tortuga.node.state import ALLOWED_NODE_STATES
from tortuga.types.base import BaseType, BaseTypeSchema
NodeStateValidator = validate.OneOf(
choices=ALLOWED_NODE_STATES,
error="Invalid node state '{input}'; must be one of {choices... |
from typing import List
from blspy import AugSchemeMPL, G2Element, PrivateKey
from chives.types.blockchain_format.sized_bytes import bytes32
from chives.types.coin_spend import CoinSpend
from chives.util.condition_tools import conditions_by_opcode, conditions_for_solution, pkm_pairs_for_conditions_dict
from tests.cor... |
from django.apps import AppConfig
class CreditoConfig(AppConfig):
name = 'credito' |
# This module contains entities for some specific application domain,
# namely - for the university
from pony.orm import *
from base_entities import db
class Teacher(db.User):
degree = Required(str)
courses = Set("Course")
class Student(db.User):
group = Required("Group")
courses = Set("Course")
... |
from collections import defaultdict
from django import template
from django.db.models import Q
from django.utils.safestring import SafeString
from cobra.apps.accounts.utils import get_user_info
from cobra.core.loading import get_model
from cobra.core.permissions import is_organization_admin, can_manage_org
from cobra.c... |
import datetime
from flask_wtf import FlaskForm
from wtforms import SelectField, SelectMultipleField, widgets, StringField
from wtforms.validators import DataRequired
from flask_babel import lazy_gettext
from app.main.helpers import is_even_year
class MultiCheckboxField(SelectMultipleField):
widget = widgets.Lis... |
from django.urls import path
from rest_framework_jwt.views import obtain_jwt_token, refresh_jwt_token
from .views import RegisterAPIView
urlpatterns = [
# JWT
path('register/', RegisterAPIView.as_view()),
path('login/', obtain_jwt_token),
] |
# Copyright (c) 2017 Sony Corporation. 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 applicabl... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
This is the implement of standard training on GTSRB dataset.
Copyright (c) Yiming Li, 2020
'''
from __future__ import print_function
import argparse
import os
import shutil
import time
import random
import torch
import torch.nn as nn
import torch.nn.parallel
impor... |
# -*- coding: utf-8 -*-
###
# (C) Copyright [2019] Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#... |
#!/usr/bin/env python
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013,2014,2015,2016 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with... |
# -*- coding: utf-8 -*-
"""
File containing different functions to aggregate data using Moderate Deviations. The expressions have been obtained from the following paper:
A.H. Altalhi, J.I. Forcén, M. Pagola, E. Barrenechea, H. Bustince, Zdenko Takáč,
Moderate deviation and restricted equivalence functions for measurin... |
astr = 'HelloThere'
try:
istr = int(astr)
except:
istr = -1
print('First', istr)
astr = '123'
try:
istr = int(astr)
except:
istr = -1
print('Second', istr) |
import json
from ..utils import format_item_payload, validate_response
class ProfileEmbedding():
"""Manage embedding related profile calls."""
def __init__(self, api):
"""Init."""
self.client = api
def get(self, source_key, key=None, reference=None, email=None, fields={}):
"""
... |
from django.conf.urls import url
from . import views
app_name = "users"
urlpatterns = [
url(
regex=r'^$',
view=views.Notifications.as_view(),
name='notifications'
),
] |
import cadquery as cq
# These can be modified rather than hardcoding values for each dimension.
length = 80.0 # Length of the block
height = 60.0 # Height of the block
thickness = 10.0 # Thickness of the block
# Create a 3D block based on the dimension variables above.
# 1. Establishes a workplane tha... |
# Generated by Django 3.2.12 on 2022-02-16 17:52
import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUT... |
import _plotly_utils.basevalidators
class TextValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self, plotly_name="text", parent_name="barpolar.marker.colorbar.title", **kwargs
):
super(TextValidator, self).__init__(
plotly_name=plotly_name,
parent_... |
class Queue:
# A container with a first-in-first-out (FIFO) queuing policy.
def __init__(self):
self.list = []
def push(self,item):
# Enqueue the 'item' into the queue
self.list.insert(0, item)
def pop(self):
# Dequeue the earliest enqueued item still in the queue. This... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.