text stringlengths 1 927k |
|---|
from typing import Union, List, Optional
from pyspark.sql.types import StructType, StructField, StringType, ArrayType, DataType
# This file is auto-generated by generate_schema so do not edit it manually
# noinspection PyPep8Naming
class Device_UdiCarrierSchema:
"""
A type of a manufactured item that is used... |
# Based off of https://github.com/getninjas/celery-executor/
#
# Apache Software License 2.0
#
# Copyright (c) 2018, Alan Justino da Silva
#
# 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
#
# ... |
#A script that determines what spaces move to which space, and what spaces receive pieces from each space
#This is found using the adjacent spaces and a recursive function
from board1 import B1, B1_Data
from board2 import B2, B2_Data
from board3 import B3, B3_Data
from board4 import B4, B4_Data
directions = ["ul", "... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This is the land object of the game.
@Author: yanyongyu
"""
__author__ = "yanyongyu"
__all__ = ["Land"]
import pygame
from utils import getHitmask
class Land(pygame.sprite.Sprite):
def __init__(self, bg_size):
pygame.sprite.Sprite.__init__(self)
... |
#######################################################################
# Copyright (C) 2017 Shangtong Zhang(zhangshangtong.cpp@gmail.com) #
# Permission given to modify the code as long as you keep this #
# declaration at the top #
################################... |
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 26 00:06:46 2019
@author: Acc
"""
import matplotlib.pyplot as plt
import numpy as np
import os
from sklearn import preprocessing
import tensorflow as tf
from tensorflow.keras import backend as K
from tqdm import tqdm
data_dir='dataset'
model_dir='pretrained'
def norm(d... |
# coding=utf-8
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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/lice... |
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino.tools.mo.front.common.replacement import FrontReplacementPattern
from openvino.tools.mo.front.tf.loader import variables_to_constants
from openvino.tools.mo.graph.graph import Graph
class VariablesToConstants(FrontReplace... |
import argparse
import os
from collections import OrderedDict
from glob import glob
import pandas as pd
import torch
import torch.backends.cudnn as cudnn
import torch.nn as nn
import torch.optim as optim
import yaml
from albumentations.augmentations import transforms
from albumentations.core.composition import Compose... |
import sqlite3
from os import listdir
import pandas as pd
from transfer_data import pick_path
def database_pipeline(path):
connection = sqlite3.connect("./baseData/allPlayerStats.db")
cursor = connection.cursor()
# See this for various ways to import CSV into sqlite using Python. Pandas used here beca... |
def cuda(x):
if isinstance(x, list):
return [xi.cuda() for xi in x]
elif isinstance(x, dict):
return {key: x[key].cuda() for key in x}
else:
return x.cuda()
def cpu(x):
if isinstance(x, list):
return [xi.cpu() for xi in x]
elif isinstance(x, dict):
return {k... |
from plot_convergence_test import plot_convergence_test
testName = 'dcmip2012_test41'
suffix = '_dcmip4_X100'
dtRef = 0.1
indRef = 15
fileRef = './output_tsteptype5_tstep%2.1f_dcmip4_X100/%s.nc' \
% (dtRef, testName)
plot_convergence_test(testName, fileRef, dtRef, indRef, varRef, suffix=suffix) |
from djangobench.base_settings import * # NOQA
INSTALLED_APPS = ['query_dates'] |
from setuptools import setup
from solstice.tools.snowgenerator import __version__
setup() |
from typing import TYPE_CHECKING, Any, Dict, List
from aiopoke.objects.utility.common_models import Name, NamedResource
from aiopoke.utils.minimal_resources import MinimalResource
if TYPE_CHECKING:
from aiopoke.objects.resources import PokemonSpecies
class EvolutionTrigger(NamedResource):
pokemon_species: L... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import multiprocessing
import tensorflow as tf
from tflib.data.dataset import batch_dataset, Dataset
_N_CPU = multiprocessing.cpu_count()
def disk_image_batch_dataset(img_paths, batch_size, labels=None, pr... |
import glob
import os
import pretrainedmodels
import torch
from torch import nn
from torchvision import models as torch_models
import cifar_models as models
from adversarial_defense.model.denoise_resnet import DenoiseResNet50, DenoiseResNet101, DenoiseResNet152
from adversarial_defense.model.pcl_resnet import Prototype... |
import asyncio
import datetime
import json
import logging
import random
import dateutil.parser
import pytz
import irc.client
import sqlalchemy
import common.http
import common.time
import common.storm
import lrrbot.decorators
from common import googlecalendar
from common import utils
from common.config import config
... |
from collections import defaultdict
from django.contrib.contenttypes.models import ContentType
from django.db.models import QuerySet
from django.db.models.query import BaseIterable
class CategoryQuerySet(QuerySet):
pass
class ProductQuerySet(QuerySet):
def specific(self):
"""
This efficient... |
from functools import lru_cache
from jinja2 import Markup
from markdown import markdown
import re
@lru_cache()
def markdown_to_html(text):
html = markdown(
text,
extensions=[
'mdx_urlize',
])
html = fix_preposition_nbsp(html)
return Markup(html)
def fix_preposition_nb... |
from nose.tools import * # noqa
from faker import Factory
fake = Factory.create()
import uuid
from scripts.dropbox import migrate_to_external_accounts as migration
from framework.mongo import database
from tests.base import OsfTestCase
from tests.factories import ProjectFactory, UserFactory
from website.models im... |
# Copyright 2016 ZTE 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 ... |
# Generated by Django 3.0.14 on 2021-04-27 18:00
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='AdUrl',
fields=[
('id', models.AutoField(a... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, imageio contributors
# imageio is distributed under the terms of the (new) BSD License.
""" Storage of image data in tiff format.
"""
from __future__ import absolute_import, print_function, division
from .. import formats
from ..core import Format, has_module
_itk = Non... |
"""
Implements the DIAL-protocol to communicate with the Chromecast
"""
from collections import namedtuple
import json
import logging
import socket
import ssl
import urllib.request
from uuid import UUID
import zeroconf
from .const import CAST_TYPE_CHROMECAST, CAST_TYPES, SERVICE_TYPE_HOST
XML_NS_UPNP_DEVICE = "{urn:... |
# coding=utf-8
# Copyright 2019 The Edward2 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 o... |
# 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.
"""Unit tests for compiler_gym.datasets.uri."""
from compiler_gym.datasets import BenchmarkUri
from tests.test_main import main
pytest_plugins... |
from .example import Example
from .datastreams import datastreams |
# 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... |
# Copyright 2020, 37.78 Tecnologia Ltda.
#
# 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 applicabl... |
# -*- coding: utf-8 -*-
from djangocms_text_ckeditor.models import Text
from django.contrib.admin.sites import site
from django.contrib.admin.utils import unquote
from django.contrib.auth import get_user_model
from django.contrib.auth.models import AnonymousUser, Group, Permission
from django.contrib.sites.models impor... |
#!/usr/bin/env python3
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
im... |
# File: move_images.py
# Author: Rosy Davis, rosydavis@ieee.org
# Last modified: 2017 Nov. 28
#
# A utility script to copy DWT images from a folder that keeps them placed by file name
# (as is true of the source MP3s in the FMA dataset) to folders that split them by dataset
# split (test, train, val) and genre (folk, h... |
from napari.layers import Labels
import magicgui
from qtpy.QtWidgets import QLabel, QVBoxLayout, QPushButton, QWidget
from superqt.collapsible import QCollapsible
from .skeleton_pruner import SkeletonPruner
class QtSkeletonSelector(QWidget):
def __init__(self, napari_viewer):
super().__init__()
s... |
#!/usr/bin/env python3
import socket
import os
import http.client
import subprocess
import sys
import gzip
import threading
import time
import signal
PORT = -1
ORIGIN_PORT = 8080
ORIGIN_HOST = ''
SOCK = None
DNS_KEY = 'jds1D41HPQ2110D85ef92jdaf341kdfasfk123154'
'''
Will be called as follows:
./httpserver -p <port>... |
from functools import wraps
import hmac
import hashlib
import time
import warnings
import logging
import requests
logger = logging.getLogger(__name__)
class BitstampError(Exception):
pass
class TransRange(object):
"""
Enum like object used in transaction method to specify time range
from which to g... |
from .ModbusProtocol import ModbusProtocol
from .ModbusException import ModbusException, BadCRCResponse
from .utilites import computeCRC, checkCRC
import time
import struct
import asyncio
class ModbusProtocolTcp(ModbusProtocol):
def __init__(self, transport, **kwargs):
super().__init__(transport, **kwarg... |
# -*- 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 "Lic... |
#!/usr/bin/env python
# Copyright 2014-2018 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... |
#!/usr/bin/env python
from Exscript import Queue, Logger
from Exscript.util.log import log_to
from Exscript.util.decorator import autologin
from Exscript.util.file import get_hosts_from_file, get_accounts_from_file
from Exscript.util.report import status, summarize
logger = Logger() # Logs everything to memory.
@lo... |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.base.exchange import Exchange
import math
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import AuthenticationE... |
import compas_ags
from compas_ags.diagrams import FormGraph
from compas_ags.diagrams import FormDiagram
from compas_ags.diagrams import ForceDiagram
FILE = compas_ags.get('debugging/zero.obj')
graph = FormGraph.from_obj(FILE)
form = FormDiagram.from_graph(graph)
force = ForceDiagram.from_formdiagram(form)
form.edge... |
import ipaddress
from aiohttp import web
def register_routes(app: web.Application):
app.add_routes(
[
web.get("/echo", echo),
web.get("/endpoints", list_endpoints),
web.post("/endpoints", add_endpoints),
web.delete("/endpoints", delete_endpoints),
]... |
"""
lab 3
"""
# 3.1
str_list = ['a','d','e','b','c']
print(str_list)
str_list.sort()
print(str_list)
# 3.2
str_list.append('f')
print(str_list)
# 3.3
str_list.remove('d')
print(str_list)
# 3.4
print(str_list[2])
# 3.5
my_list = ['a','123',123,'b','B','False',False,123,None,'None']
print(len(set(my_list)))
# 3.6
pr... |
# pylint: disable=too-few-public-methods
class XContentTypeOptionsMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
response = self.get_response(request)
response['X-Content-Type-Options'] = 'nosniff'
return response
# ... |
from full_observation.Full_observation_functions import *
from Partial_observation_model_functions import *
number_samples = [1500]
number_cascades = 3
number_decimal = 3
# 20 nodes network:
# for n_sample in number_samples:
# g_20, threshold_array = load_20_nodes_graph(number_cascades, number_decimal)
# x_... |
# 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 ... |
from Bio import Entrez
from configurations.config import *
# A brief example of how to pull an article abstract based on a key word search.
# Used "fever" as a key word search which returns the article IDs.
# Then used the first article ID to pull out the article title and abstract text as an example.
my_email = mike... |
"""
# Definition for a Node.
class Node:
def __init__(self, val: int = 0, left: 'Node' = None, right: 'Node' = None, next: 'Node' = None):
self.val = val
self.left = left
self.right = right
self.next = next
"""
"""
The main idea is to go level by level and use already existing .next... |
import numpy,csv
def csv(infile,delimiter=','):
'''reads csv with arbitrary delimiter, returns numpy array of strings'''
with open(infile) as f:
rv = [ l.strip().split(delimiter) for l in f
if l.strip() # no empty lines
and not l.startswith('#'... |
import re
from io import StringIO
from pathlib import Path
import warnings
from typing import TextIO, Optional
def dump_parameters_text(PARAMETERS: dict, file: Optional[TextIO] = None):
from .parameters import Parameter, SequenceParameter, PlaceholderParameter
for path, param in PARAMETERS.items():
p... |
# https://www.runoob.com/python/python-object.html
# !/usr/bin/python
# -*- coding: UTF-8 -*-
class Parent: # 定义父类
parentAttr = 100
def __init__(self):
print("调用父类构造函数")
def parentMethod(self):
print('调用父类方法')
def setAttr(self, attr):
Parent.parentAttr = attr
def getAt... |
# -*- coding: utf-8 -*-
description = '3He detector'
group = 'optional'
includes = ['filesavers']
tango_base = 'tango://resedahw2.reseda.frm2:10000/reseda'
devices = dict(
timer = device('nicos.devices.tango.TimerChannel',
description = 'Timer channel 2',
tangodevice = '%s/frmctr/timer' % tango... |
import sys
import os
from sklearn.linear_model import LogisticRegression
from sklearn.linear_model import LogisticRegression
from sklearn.linear_model import SGDClassifier
from sklearn.model_selection import train_test_split
#For sample ranking function from https://github.com/davefernig/alp
from active_learning.activ... |
# Copyright 2018 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://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... |
#!/usr/bin/env python
# coding=utf8
"""A tiny library for parsing, modifying, and composing SRT files."""
from __future__ import unicode_literals
import functools
import re
from datetime import timedelta
import logging
import io
LOG = logging.getLogger(__name__)
# "." is not technically valid as a delimiter, but m... |
# Copyright (c) ZenML GmbH 2022. 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:
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
# Mostly based on the code written by Clement Godard:
# https://github.com/mrharicot/monodepth/blob/master/utils/evaluation_utils.py
import numpy as np
from collections import Counter
from path import Path
from scipy.misc import imread
from tqdm import tqdm
import datetime
class test_framework_KITTI(object):
def ... |
# -*- coding: utf-8 -*-
import sys
sys.path.insert(0,"../../src2")
import math
import functools
import time
import torch
import numpy as np
from scipy.special import gamma
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import emcee
from source_1d_likelihood_fn import compute_log_likelihood_2
... |
"""
Django settings for codelnmain project on Heroku. For more info, see:
https://github.com/heroku/heroku-django-template
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/setting... |
# coding: utf-8
import pprint
import re
import six
class Port:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key i... |
# 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 gzip
import io
from multiprocessing import Process, Queue, cpu_count
from pathlib import Path
from urllib.request import urlopen
import numpy as np
from asreview.utils import get_data_home
EMBEDDING_EN = {
"url": "https://dl.fbaipublicfiles.com/fasttext/vectors-crawl/cc.en.300.vec.gz", # noqa
"name"... |
from collections import defaultdict
from time import sleep
import vk
# If you don't have an access token,
# it can be obtained as vk.AuthSession(app_id='appid', user_login='jake@gmail.com', user_password='Finn').access_token
my_access_token = 'xxxxxx'
GROUP_PREFIX='https://vk.com/public'
def print_top_groups(popular_... |
"""
WSGI config for app 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/4.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_... |
from dataclasses import dataclass, field
from functools import partial
import heapq
from itertools import starmap
import math
from typing import Any, Dict, List, Optional, Tuple
import psycopg2
from tqdm import tqdm
from inverted_index.tokenizer import Tokenizer
from inverted_index.encoders import GammaEncoder, Delta... |
r"""
Macdonald Polynomials
Notation used in the definitions follows mainly [Macdonald1995]_.
The integral forms of the bases `H` and `Ht` do not appear in
Macdonald's book. They correspond to the two bases
`H_\mu[X;q,t] = \sum_{\nu} K_{\nu\mu}(q,t) s_\mu[X]` and
`{\tilde H}_\mu[X;q,t] = t^{n(\mu)} \sum_{\nu} K_{\nu\... |
# dataset settings
dataset_type = 'VrdDataset'
data_root = 'data/vrd/'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='LoadAnnotations', with_bbox=True, with_rel=True),
dict(type='Resize', img_sc... |
import tensorflow as tf
# ===============================================
# Previously was snippets.py of: 3_2_RNNs
# ===============================================
# i = input_gate, j = new_input, f = forget_gate, o = output_gate
# Get 4 copies of feeding [inputs, m_prev] through the "Sigma" diagram.
# Note that ea... |
from __future__ import print_function
import sys
from pacolib import *
if len(sys.argv) < 2:
sys.stderr.write("\nUsage: "+sys.argv[0]+" relsize\n\n")
sys.exit(1)
n = int(sys.argv[1])
print ("Require Export Program.Basics. Open Scope program_scope.")
print ("From Paco Require Import paco"+str(n)+" pacotac.")
pr... |
# need a dict to set bloody .name field
from io import BytesIO
import logging
import os
import stat
import uuid
import git
from git.cmd import Git
from git.compat import (
defenc,
is_win,
)
from git.config import (
SectionConstraint,
GitConfigParser,
cp
)
from git.exc import (
InvalidGitReposit... |
#!python
#!/usr/bin/env python
from kivy.app import App
from kivy.uix.bubble import Bubble
from kivy.animation import Animation
from kivy.uix.floatlayout import FloatLayout
from kivy.lang import Builder
from kivy.factory import Factory
from kivy.clock import Clock
from actilectrum.gui.kivy.i18n import _
Builder.load_... |
from heapq import heappush, heappop
class Solution:
def findItinerary(self, tickets: List[List[str]]) -> List[str]:
flights = collections.defaultdict(list)
result = []
for ticket in tickets:
heappush(flights[ticket[0]], ticket[1])
self.dfs("JFK", flights, result)
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020-2022 F4PGA 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
#
# Unl... |
import json
import pytest
from aiohttp import web
from tartiflette import Engine, Resolver, create_engine
from tartiflette_aiohttp import register_graphql_handlers
async def test_awaitable_engine(aiohttp_client, loop):
@Resolver("Query.bob", schema_name="test_awaitable_engine")
async def resolver_lol(*args... |
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
from neptune_load.sigv4_signer.sigv4_signer import SigV4Signer
from neptune_load.bulk_loader.bulk_loader import BulkLoader
import logging
import os
import sys
logger = logging.getLogger("bulk_load")
logger.setL... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise Impor... |
# -*- coding: utf-8 -*-
__version__ = "0.17" |
# -*- coding: utf-8 -*-
"""
Covenant Add-on
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This prog... |
#!/usr/bin/env python3
''' Counts and displays the number of vowels in user input'''
word = input('Enter a Word(s) : ')
vowel_count = 0
for letter in word:
if letter.upper() in ['A', 'E', 'I', 'O', 'U']:
print('{0}, '.format(letter), sep='', end='')
vowel_count +=1
print('({0} vowels)'.format(vowe... |
import numpy as np
from toolbox.sqDistance import *
from toolbox.oneOfK import *
class KnnModel():
def fit(self, X, y, K, C=None):
self.X = X
self.y = y
self.K = K
if C is not None:
self.C = C
else:
self.C = np.size(np.unique(y))
def predict(se... |
import numpy as np
from .topology import _Topology
class _LeftRightTopology(_Topology):
"""Represents the topology for a left-right HMM, imposing an upper-triangular transition matrix.
Parameters
----------
n_states: int
Number of states in the HMM.
random_state: numpy.random.RandomState
... |
''' device.py
'''
from transitions import Machine
from core.clock import ClockReference
from core.message_router import MessageRouter
class Device:
''' Device:
A base class that all accelerator components inherit from.
A device requires a clock-reference and a message-router (to communicate)
Args:
... |
from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from store.models import Product, Store, TimeStampedModel, Category
# Create your models here.
class Cart(TimeStampedModel):
user = models.ForeignKey(User, verbose_name=_("Customer"), nul... |
#!/usr/bin/env python3
"""
Rpi Server
author: Michael Binder
dependencies: tcp.py, RPi.GPIO, sys
description: Establishes a connection via Tcp/Ip in the local network
and waits for messages sent from the app.
Then it evaluates those messages and sends them via the connected 433MHz RF-Module
to the 433MHz re... |
from application import db
from flask import Blueprint
from flask_login import current_user
from flask import current_app as app
from flask import request, jsonify, make_response
from flask_jwt_extended import jwt_required
import logging
# Blueprint Configuration
friends_bp = Blueprint('friends_bp', __name__)
@frien... |
# -*- coding: utf-8 -*-
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distr... |
#! /usr/bin/env python
"""
Extrapolation of correction parameters.
"""
__author__ = "Christian Waluga (waluga@ma.tum.de)"
__copyright__ = "Copyright (c) 2013 %s" % __author__
from dolfin import *
from correction import *
from meshtools import *
from singular import *
import math
def extrapolate_gamma_least_squares(... |
from django.contrib.auth import authenticate, login
from rest_framework import serializers
from .models import User
# LOGIN------------------------------------------------------------------------
def get_and_authenticate_user(email,password):
user = authenticate(username=email, password=password)
if user is N... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import urllib.request
import pytest
import numpy as np
from ....tests.helper import assert_quantity_allclose, catch_warnings
from .. import iers
from .... import units as u
from ....table import QTable
from ....time import Time, TimeDelta
from... |
_base_ = [
'../_base_/models/apcnet_r50-d8.py', '../_base_/datasets/ade20k.py',
'../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py'
]
model = dict(
decode_head=dict(num_classes=150), auxiliary_head=dict(num_classes=150)) |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
"""Setup standard unit test class for NodeSequences."""
from unittest import TestCase
from ensmallen import Graph # pylint: disable=no-name-in-module
class TestNodeSequences(TestCase):
def setUp(self):
self._graph = Graph.from_csv(
edge_path="tests/data/small_ppi.tsv",
sources_co... |
# -*- coding: utf-8 -*-
""" Atividade - Ciclo 4 :
Criação de um programa em python, que calcula IMC e registra as informações
em um banco de dados SQLite.
"""
import sqlite3
conn = sqlite3.connect('dbimc.db')
cursor = conn.cursor()
p_nome = input("Nome Completo: ")
p_endereco = input("Endereço C... |
def labels(extra):
labels = {
"org.opencontainers.image.authors": "https://github.com/whilp",
"org.opencontainers.image.url": "https://github.com/whilp/world",
"org.opencontainers.image.source": "https://github.com/whilp/world",
"org.opencontainers.image.documentation": "https://gith... |
#clear
d = {} #create an empty dictionary
d['name']='Gumby'
d['age']=42
print(d)
returned_value = d.clear()
print(d)
print(returned_value)
x = {}
y = x
x['key'] = 'value'
print(x)
print(y)
x = {}
print(x)
print(y)
x = {}
y = x
x['key'] = 'value'
print(x)
print(y)
x.clear()
print(x)
print(y) #y is also cleared if usin... |
# Copyright 2012 OpenStack Foundation
# 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 requ... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making GameAISDK available.
This source code file is licensed under the GNU General Public License Version 3.
For full details, please refer to the file "LICENSE.txt" which is provided as part of this source code package.
Copyright... |
import json
from flask import Flask, request, render_template
from owlready2 import *
from static_params import cluster_properties
import logging
import ontospy
from ontospy.ontodocs.viz.viz_d3dendogram import *
import errno, os, stat, shutil
onto = get_ontology("physics_v0.1.owl").load()
onto.base_iri
def cluster_a... |
# Copyright 2017 Real Kinetic, LLC. All Rights Reserved.
import unittest
import cloudstorage
import mock
from cloud_ftp import error
from cloud_ftp.storage.providers.gcs import GCSStorageProvider
class GCSTestCase(unittest.TestCase):
def test_path(self):
p = GCSStorageProvider(bucket='bucket')
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.