text stringlengths 1 927k |
|---|
from django.shortcuts import render
from flightApp.models import Flight, Passenger, Reservation
from flightApp.serializers import FlightSerializer, PassengerSerializer, ReservationSerializer
from rest_framework import viewsets
from rest_framework.response import Response
from rest_framework.decorators import api_view
f... |
# Copyright (c) 2020, NVIDIA 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 appli... |
import os
from . import model
from . import routes
from . import views
MODELS = [model.AddonS3UserSettings, model.AddonS3NodeSettings]
USER_SETTINGS_MODEL = model.AddonS3UserSettings
NODE_SETTINGS_MODEL = model.AddonS3NodeSettings
ROUTES = [routes.settings_routes]
SHORT_NAME = 's3'
FULL_NAME = 'Amazon S3'
OWNERS ... |
n = input()
front_n = n[0:len(n)//2]
back_n = n[len(n)//2:len(n)]
front_n = map(int,front_n)
back_n = map(int,back_n)
result_f = sum(front_n)
result_b = sum(back_n)
if result_f == result_b:
print('LUCKY')
else:
print('READY') |
"""!
@brief pyclustering module for samples.
@authors Andrei Novikov (pyclustering@yandex.ru)
@date 2014-2020
@copyright BSD-3-Clause
"""
class answer_reader:
"""!
@brief Answer reader for samples that are used by pyclustering library.
"""
def __init__(self, answer_path):
"""!
@br... |
from django.shortcuts import render, render_to_response
from django.http import Http404
from django.http import HttpResponse, HttpResponseRedirect
from django.template import RequestContext
from django.views.decorators.http import require_GET, require_POST, require_http_methods
from models import *
from forms import *
... |
import re
pattern = "[a-zA-Z0-9]+@[a-zA-z]+\.(com|edu|net)"
user_input = input()
if(re.search(pattern, user_input)):
print("valid email")
else:
print("invalid email") |
from flask import Flask, request
from reservation_service import get_qnode, read_data, register, delete_namespace
import json
import logging
from tabulate import tabulate
app = Flask(__name__)
ALLOWED_EXTENSIONS = {'xls', 'yaml', 'csv', 'json'}
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
# logging.ba... |
from keras.applications.resnet50 import ResNet50
from keras.applications.vgg16 import VGG16
from keras.layers import Flatten, Dropout, Lambda, GlobalAveragePooling2D, merge, Input, Dense
from keras.models import Model
import keras.backend as K
#from keras.utils.visualize_util import plot
#from SpatialPyramidPooling imp... |
# import dependencies
import os, re, io, sys
import pandas as pd
#import mysql.connector
import json
import numpy as np
# import function collections
from Functions.j_functions import *
from Functions.language import *
from Functions.functions import *
# set universal variables
project_root = os.path.abspath(os.path... |
#!/usr/bin/env python3
import argparse
import csv
import json
import logging
import math
import socket
import subprocess
import sys
import time
import traceback
from datetime import datetime
from collections import namedtuple
import requests
import six.moves.urllib as urllib
from common import (get_marathon_auth_par... |
# -*- coding: utf-8 -*-
from .__module__ import Module, dependency, source
from .tools import Tools
from .boost import Boost
from .python import Python
from .opencv import Opencv
@dependency(Tools, Python, Boost, Opencv)
@source('git')
class Caffe(Module):
def build(self):
pyver = self.composer.ver(Pytho... |
try:
from grippy.message import Message
except:
Message = None
from .location import Location
import math
import datetime
from . import tools
class SimpleGribMessage(Message):
def __init__(self, data, offset):
super(SimpleGribMessage, self).__init__(data, offset)
@property
def model_time... |
from pathlib import Path
from time import sleep
import io
import sys
import pytest
from . import TEST_DIR
try:
from pygls.features import INITIALIZE, TEXT_DOCUMENT_DID_OPEN
from pygls.types import DidOpenTextDocumentParams, TextDocumentItem, InitializeParams
except ImportError:
pytest.skip("pygls unavail... |
import os
from unittest import TestCase, mock
from emailnetwork.extract import MBoxReader
# from emailnetwork.graph import plot_single_email
import emailnetwork.graph as graph
MBOX_PATH = f'{os.path.dirname(__file__)}/test.mbox'
@mock.patch(f"{__name__}.graph.plt")
def test_plot_single_directed(mock_plt):
reader... |
import warnings
import click
import jmespath
from globus_cli import config
# Format Enum for output formatting
# could use a namedtuple, but that's overkill
JSON_FORMAT = "json"
TEXT_FORMAT = "text"
UNIX_FORMAT = "unix"
class CommandState:
def __init__(self):
# default is config value, or TEXT if it's ... |
from django.contrib.auth.forms import UserCreationForm
from django.urls import reverse_lazy
from django.views import generic
class SignUpView(generic.CreateView):
form_class = UserCreationForm
success_url = reverse_lazy('login')
template_name = 'signup.html' |
import argparse
import os
import pandas as pd
import numpy as np
import torch as t
from torch.optim import Adam
import pickle5 as pickle
import json
import random
from sample import sample_with_input, sample_with_beam
from utils.batch_loader import BatchLoader, clean_str
from model.paraphraser import Paraphraser
from... |
from setuptools import setup, find_packages
from pyjamaparty.strutils.string_builder import StringBuilder
description = 'Set of casual python utilities'
long_description = StringBuilder('{}, written standing on shoulders of giants.'.format(description))
long_description += ' Tools include a string builder, singleton d... |
import hashlib
import re
from datetime import date, timedelta
from flask import Flask, render_template, request, abort
from jinja2.utils import urlize
from sqlalchemy import asc, desc
from sqlalchemy.orm import joinedload
from quassel import quassel_session, Message, Buffer, Sender, Network
import settings
app = Fla... |
# model
model = Model()
i1 = Input("input", "TENSOR_BOOL8", "{3, 4}")
axis = Int32Scalar("axis", 1)
keepDims = False
out1 = Output("output", "TENSOR_BOOL8", "{3}")
model = model.Operation("REDUCE_ANY", i1, axis, keepDims).To(out1)
# Example 1. Input in operand 0, 1
input0 = {i1: # input 0
[False, False, Fals... |
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Relax(CMakePackage):
"""A set of Reflex libraries for the most common used general data ty... |
"""
Keras RFCN
Copyright (c) 2018
Licensed under the MIT License (see LICENSE for details)
Written by parap1uie-s@github.com
"""
'''
This is a demo to Eval a RFCN model with DeepFashion Dataset
http://mmlab.ie.cuhk.edu.hk/projects/DeepFashion.html
'''
from KerasRFCN.Model.Model import RFCN_Model
from KerasRFCN.Config... |
#!/usr/bin/env python3
"""
This program contains generic functions to build a Turtle (Terse RDF Triple Language) document.
Authors:
- Arno Klein, 2017-2020 (arno@childmind.org) http://binarybottle.com
- Jon Clucas, 2017–2018 (jon.clucas@childmind.org)
Copyright 2020, Child Mind Institute (http://childmind.or... |
import cv2
import numpy as np
from glob import glob
import matplotlib.pyplot as plt
np.random.seed(0)
num_classes = 2
img_height, img_width = 64, 64
CLS = ['akahara', 'madara']
# get train data
def data_load(path, hf=False, vf=False, rot=None):
xs = []
ts = []
paths = []
for dir_path in glob(pa... |
from django.urls import path
from user import views
app_name = 'user'
urlpatterns = [
path('create/', views.createUserView.as_view(), name='create'),
path('token/', views.CreateTokenView.as_view(), name='token'),
path('me/', views.ManageUserView.as_view(), name='me'),
] |
from django import template
register = template.Library()
@register.filter
def model_name(obj):
try:
return obj._meta.model_name
except AttributeError:
return None
@register.filter
def filter_course_id(obj, filter_):
return obj.filter(course_id=filter_) |
from decimal import Decimal
from opnreco.models.db import File
from opnreco.models.db import Movement
from opnreco.models.db import now_func
from opnreco.models.db import OwnerLog
from opnreco.models.db import Peer
from opnreco.models.db import TransferDownloadRecord
from opnreco.models.db import TransferRecord
from op... |
import unittest
from pprint import pprint
from .. import transaction
from ..address import Address, ScriptOutput, PublicKey
from ..bitcoin import TYPE_ADDRESS, TYPE_PUBKEY, TYPE_SCRIPT
from ..keystore import xpubkey_to_address
from ..util import bh2u
unsigned_blob = '010000000149f35e43fefd22d8bb9e4b3ff294c6286154c2... |
#!/usr/bin/env python3
# Archive reason: No longer in use.
"""Parser for the Bonneville Power Administration area of the USA."""
import logging
from io import StringIO
import arrow
import pandas as pd
import requests
GENERATION_URL = "https://transmission.bpa.gov/business/operations/Wind/baltwg.txt"
GENERATION_MA... |
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import os
from six.moves import configparser # pylint: disable=import-error
def get_your_keys(credentials_file):
"""reads the secret keys in your credentials file in order to be able to
look for them in the submit... |
# !/usr/bin/env python3
# -*-coding:utf-8-*-
# @file:
# @brief:
# @author: Changjiang Cai, ccai1@stevens.edu, caicj5351@gmail.com
# @version: 0.0.1
# @creation date: 23-10-2019
# @last modified: Wed 30 Oct 2019 03:17:36 PM EDT
"""
file: ResnetV2.py
author: Changjiang Cai
mark: adopted from:
... |
def main():
n = int(input())
welfare = []
for i in range(n):
a, b, c = map(int, input().split())
welfare.append([a, b, c])
dp = [[0, 0, 0] for _ in range(n+1)]
for i in range(1, n+1):
dp[i][0] = max(dp[i-1][1] + welfare[i-1][0], dp[i-1][2] + welfare[i-1][0])
dp[i][1... |
from setuptools import setup, find_packages
long_description = """
DemonHunter is a framework to create a Honeypot network very simple and easy.
"""
requirements = [
"httptools==0.0.11",
"aiohttp==2.3.10",
"bcrypt==3.1.4",
"flask==0.12.2",
"flask-login==0.4.1",
"flask-sqlalchemy==2.3.2",
... |
# taken from https://gist.github.com/anler/1144867
def C3(cls, *mro_lists):
"""Implementation of the Python's C3 Algorithm.
Notes:
* The order of items in an MRO should be preserved in all of
its future subclasses
"""
import itertools
# Make a copy so we don't change existing... |
"""jc - JSON CLI output utility `netstat` command output parser
Caveats:
- Use of multiple `l` options is not supported on OSX (e.g. `netstat -rlll`)
- Use of the `A` option is not supported on OSX when using the `r` option (e.g. `netstat -rA`)
Usage (cli):
$ netstat | jc --netstat
or
$ jc netstat
Usa... |
import time
from pathlib import Path, PurePath
import docker
import pytest
import requests
from ..utils import (
CONTAINER_NAME,
IMAGE_NAME,
get_config,
get_logs,
remove_previous_container,
)
client = docker.from_env()
def verify_container(container, response_text):
config_data = get_config... |
import torch.nn as nn
import torch.nn.functional as F
from utils.noisy_liner import NoisyLinear
from torch.nn import LayerNorm
class NoisyRNNAgent(nn.Module):
def __init__(self, input_shape, args):
super(NoisyRNNAgent, self).__init__()
self.args = args
self.fc1 = nn.Linear(input_shape, arg... |
import numpy as np
import torch
import torch.nn.functional as F
from nflows import transforms, distributions, flows, utils
import nflows.nn.nets as nn_
import matplotlib.pyplot as pl
from modules import resnet
# https://github.com/stephengreen/lfi-gw/blob/master/lfigw/nde_flows.py
def create_linear_transform(input_di... |
import base64
import requests
import json
import hashlib
import hmac
from enum import IntEnum
from datetime import datetime, timedelta
import os
secretKey = os.getenv("SECRET_KEY")
def valid_token(token):
return ('.' in token) and len(token.split('.')) == 3
def verify_credentials(email, pwd):
data = {"email... |
import sys
import time
import cv2
import numpy as np
def scenedetect(cap, threshold=30, min_scene_len=15):
w = cap.get(cv2.CAP_PROP_FRAME_WIDTH)
downscale_factor = int(w / 200)
last_hsv = None
first = 0
curr = 0
while True:
ret, im = cap.read()
if not ret:
break
... |
"""
Created on Feb 09, 2018
@author: StarlitGhost
"""
import re
from collections import OrderedDict
from twisted.plugin import IPlugin
from zope.interface import implementer
from desertbot.moduleinterface import IModule
from desertbot.modules.commandinterface import BotCommand, admin
from desertbot.response import I... |
# Copyright 2020 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... |
# Copyright 2021 Unicorn
# See LICENSE file for licensing details.
#
# Learn more about testing at: https://juju.is/docs/sdk/testing
import unittest
from unittest import mock
import charm
from ops.model import Unit
from ops.testing import Harness
class TestCharm(unittest.TestCase):
def assert_active_unit(self, u... |
# Copyright 2019 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... |
# Create your views here.
from __future__ import print_function
import logging
from datetime import timedelta
from django import http
from django.contrib import messages
from django.contrib.auth.mixins import UserPassesTestMixin
from django.core.exceptions import ValidationError
from django.http import Http404, HttpR... |
from flask import Blueprint
reserve = Blueprint('reserve', __name__)
from . import views |
#
# This source file is part of appleseed.
# Visit https://appleseedhq.net/ for additional information and resources.
#
# This software is released under the MIT license.
#
# Copyright (c) 2016-2019 Esteban Tovagliari, The appleseedhq Organization
#
# Permission is hereby granted, free of charge, to any person obtainin... |
#!/usr/bin/env python3
# Copyright (c) 2014-2018 The Picacoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test coinbase transactions return the correct categories.
Tests listtransactions, listsinceblock, and... |
# Copyright (c) 2010 Doug Hellmann. All rights reserved.
#
"""Negative look behind assertion.
"""
# end_pymotw_header
import re
address = re.compile(
"""
^
# An address: username@domain.tld
[\w\d.+-]+ # username
# Ignore noreply addresses
(?<!noreply)
@
([\w\d.]+\.)+ # do... |
import pytest
import numpy as np
import pandas as pd
import pandas.util.testing as tm
@pytest.mark.parametrize('ordered', [True, False])
@pytest.mark.parametrize('categories', [
['b', 'a', 'c'],
['a', 'b', 'c', 'd'],
])
def test_factorize(categories, ordered):
cat = pd.Categorical(['b', 'b', 'a', 'c', No... |
#!/usr/bin/env python
"""
Unfortunately the "expanded_url" as supplied by Twitter aren't fully
expanded one hop past t.co.
unshrtn.py will attempt to completely unshorten URLs and add them as the
"unshortened_url" key to each url, and emit the tweet as JSON again on stdout.
This script starts 10 seaprate processes w... |
#!/usr/bin/env python
import argparse
import contextlib
import copy
import glob
import hashlib
import http.client
import json
import logging
import os
import shutil
import stat
import sys
import typing
import urllib.error
from unittest import mock
SYSTEM_EXCS = (urllib.error.URLError, http.client.HTTPException, OSErr... |
import numpy as np
import pandas as pd
import re
import nltk
nltk.download('stopwords')
from nltk.corpus import stopwords
from nltk.stem.porter import PorterStemmer
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import GaussianNB... |
from __future__ import division, print_function, absolute_import
import numpy as np
import scipy.stats
class AbstractValueProvider(object):
def __call__(self, seqlet):
raise NotImplementedError()
@classmethod
def from_hdf5(cls, grp):
the_class = eval(grp.attrs["class"])
return th... |
import torch
class Flatten(torch.nn.Module):
def forward(self,input):
return input.view(input.size(0), -1) |
import argparse
import logging
import os
from openfold.data import mmcif_parsing
from openfold.np import protein, residue_constants
def main(args):
fasta = []
for fname in os.listdir(args.data_dir):
basename, ext = os.path.splitext(fname)
basename = basename.upper()
fpath = os.path.jo... |
# model settings
model = dict(
type='CascadeRCNN',
pretrained=None,
backbone=dict(
type='SwinTransformer',
embed_dim=96,
depths=[2, 2, 6, 2],
num_heads=[3, 6, 12, 24],
window_size=7,
mlp_ratio=4.,
qkv_bias=True,
qk_scale=None,
drop_rate... |
"""
iflytek stream ASR service class (using WebSocket)
"""
import gevent
import os
from .interface import (
SpeechRecognitionConfig,
SpeechRecognitionRequest,
SpeechRecognitionResponse,
)
from .stream_asr import StreamAsr
from ..tokenizer import Tokenizer
import sys
import hashlib
from hashlib import sha1... |
# -*-coding:utf-8-*-
import os
class BaseConfig(object):
"""Base configuration."""
DEBUG = True
BROKER_URL = os.getenv('BROKER_URL', 'amqp://guest:guest@localhost:5672/')
BROKER_POOL_LIMIT = os.getenv('BROKER_POOL_LIMIT', None)
CELERY_ENABLE_UTC = True
CELERY_TIMEZONE = os.getenv('CELERY_TIMEZO... |
from .prophet_helper import ProphetHelper
__all__ = ['ProphetHelper'] |
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""
Shell Widget for the IPython Console
"""
import ast
import uuid
from qtpy.QtCore import Signal
from qtpy.QtWidgets import QMessageBox
from spyder.config.base i... |
from __future__ import division, generators, print_function
import torch
import torch.nn as nn
import macarico
import macarico.util as util
from macarico.util import Var, Varng
class BOWActor(macarico.Actor):
def __init__(self, attention, n_actions, act_history_length=1, obs_history_length=0):
self.att_d... |
from core.models import Project, Volume
from rest_framework import serializers
from api.v2.serializers.summaries import ProjectSummarySerializer
from .volume import VolumeSerializer
class ProjectRelatedField(serializers.PrimaryKeyRelatedField):
def get_queryset(self):
return Project.objects.all()
def... |
# Copyright 2021 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, ... |
"""
Emotion Detection Task
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import time
import argparse
import multiprocessing
import sys
sys.path.append("../")
import paddle
import paddle.fluid as fluid
import numpy as np
from models.classif... |
from generate_captchas import CHAR_POSSIBILITIES
from generate_captchas import generate_captcha
from generate_captchas import get_random_captcha_names_and_lines
from digital_processing_image_approach import clean_image_kernel4
import keras
from keras.models import Sequential, load_model
from keras.layers import Dense, ... |
import sys
import os
import torch
import torch.onnx
import torch.distributed as dist
import torch.nn as nn
import onnxruntime
from datetime import datetime
from torch.utils.data import DataLoader
import torch.multiprocessing as mp
from pepper_variant.modules.python.models.dataloader_predict import SequenceDataset
from... |
import numpy as np
import h5py
import networkx as nx
import argparse
import itertools
import random
import pickle
import neurokernel.mpi_relaunch
import neurokernel.core_gpu as core
from neurokernel.LPU.InputProcessors.StepInputProcessor import StepInputProcessor
from neurokernel.LPU.InputProcessors.FileInputProcesso... |
from flask_restplus import Model, fields
NewTaskResult = Model('NewTaskResult', {
'message': fields.String(required=True, description='Server response when an anyschronous task is created'),
'task_id': fields.String(required=True, description='UUID of the created asynchronous task')
})
TaskResult = Model(... |
# 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 ... |
# 문제: https://programmers.co.kr/learn/courses/30/lessons/72414
# --- 첫 풀이 ---
# 31개 테스트 케이스 중 시간초과 18개
from bisect import bisect_left, bisect_right
def solution(play_time, adv_time, logs):
adv_time = 3600*int(adv_time[:2]) + 60*int(adv_time[3:5]) + int(adv_time[6:])
starts, ends = [], []
for log in ... |
from numpy import array
def scigrid_2011_01_07_01():
ppc = {"version": '2'}
ppc["baseMVA"] = 100.0
ppc["bus"] = array([
[586, 3, 0, 0, 0, 0, 0, 1.0, 0, 220.0, 0, 1.1, 0.9 ],
[589, 2, 0, 0, 0, 0, 0, 1.0, 0, 380.0, 0, 1.1, 0.9 ],
[590, 2, 0, 0, 0, 0, 0, 1.0, 0, 380.0, 0, 1.1,... |
from tkinter import Tk, IntVar, Checkbutton, Button, Label, StringVar
from evaluator import Evaluator
#src.assignments.assignment13.
class Win(Tk):
def __init__(self):
Tk.__init__(self, None, None)
self.wm_title('My first window')
self.evaluator = Evaluator()
self.label_var = Stri... |
# Copyright 2018 The TensorFlow Probability 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... |
def nextDay(year, month, day):
"""Simple version: assume every month has 30 days"""
if day < 30:
return year, month, day + 1
else:
if month == 12:
return year + 1, 1, 1
else:
return year, month + 1, 1
def dateIsBefore(year1, month1, day1, year2, month... |
import logging
from unittest.mock import Mock, patch
from django.test import TestCase
import intake.services.submissions as SubmissionsService
from intake.tests import mock, factories
from intake.tests.mock_org_answers import get_answers_for_orgs
from intake.tests.base_testcases import ExternalNotificationsPatchTestCas... |
"""restaurant URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/4.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-ba... |
from .predict_sentiment import predict as _predict
def predict(sentence):
r = _predict([sentence])[0]
if r == 0:
#positive
return 1
elif r == 1:
#strongly positive
return 2
elif r == 2:
#negative
return -1
else:
#strongly negative
return -2 |
import datetime
import unittest
from bson import DBRef, ObjectId, SON
import pytest
from mongoengine import (
BooleanField,
ComplexDateTimeField,
DateField,
DateTimeField,
DictField,
Document,
DoesNotExist,
DynamicDocument,
DynamicField,
EmbeddedDocument,
EmbeddedDocumentFi... |
# File: pipeline/cleaning.py
"""Functions to clean datasets.
Calling each function returns a clean version of the associated dataset.
"""
import numpy as np
import pandas as pd
from la_funding_analysis.getters.local_authority_data import (
get_epc,
get_grants,
get_imd,
get_old_parties,
get_parties... |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... |
# Setup library
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import numpy as np
import PIL.Image as Image
from PIL import ImageFile
import tensorflow as tf
import tensorflow_hub as hub
from tensorflow.keras import layers
import matplotlib.pylab as plt
import efficientnet... |
from queue_interface import QueueInterface
from src.list.node import Node
class LinkedQueueImproved(QueueInterface):
""" implementation of a queue using a linked list """
def __init__(self):
""" create an empty queue """
self.length = 0
self.head = None
self.tail = None
def isEmpty(self):
"... |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... |
from alembic_utils.pg_function import PGFunction
from alembic_utils.replaceable_entity import register_entities, registry
from alembic_utils.testbase import run_alembic_command
def to_upper():
return PGFunction(
schema="public",
signature="to_upper(some_text text)",
definition="""
... |
from __future__ import division
import logging
log = logging.getLogger(__name__)
import numpy as np
from scipy import signal
from traits.api import Instance, Float, Property, Int
from traitsui.api import (View, Item, ToolBar, Action, ActionGroup, VGroup,
HSplit, MenuBar, Menu, HGroup)
from ... |
# Author: Jochen Gast <jochen.gast@visinf.tu-darmstadt.de>
import numpy as np
import torch
from matplotlib import cm
from torch import nn
# ----------------------------------------------------------------------------------------
# See https://matplotlib.org/examples/color/colormaps_reference.html
#
# Typical choices ... |
#!/usr/bin/env python3
import argparse
import re
import subprocess
import sys
from datetime import datetime
from pathlib import Path
from typing import Dict, Iterable, Sequence, Union
RELEASE_COMMIT_FMT = """Release {release_version} (Part 1/2) release commit
- Update version.py files
- Marked releases in changelogs... |
##########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2020, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
##########################################################################
import uuid
from ... |
from django.shortcuts import get_object_or_404
from rest_framework import serializers
from .models import Category, Comment, Genre, Review, Title
class CategorySerializer(serializers.ModelSerializer):
class Meta:
model = Category
fields = (
"name",
"slug",
)
clas... |
# 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 agreed to in writing... |
import sys
import numpy as np
from numpy import matlib
from scipy.stats import multivariate_normal
from read_data import read_data
import matplotlib.pyplot as plt
import time
import visual
########## Description of Algorithm ###########
# We will assume having m events
# Each event should have k=3 jets
# Each event sh... |
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Miscellaneous utility functions
"""
from __future__ import (print_function, unicode_literals, division,
absolute_import)
from builtins import next, str
im... |
from . import *
class AWS_Redshift_ClusterParameterGroup_Parameter(CloudFormationProperty):
def write(self, w):
with w.block("parameter"):
self.property(w, "ParameterName", "parameter_name", StringValueConverter())
self.property(w, "ParameterValue", "parameter_value", StringValueConverter())
class ... |
"""Top level command for Treadmill reports.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import json
import click
import pandas as pd
import tabulate
from six.moves import urllib_parse
from treadmill import ... |
# ========================================================= #
from .stocks import StocksClient
from .streaming import StreamClient, AsyncStreamClient
from .forex import ForexClient
from .crypto import CryptoClient
from .reference_apis import ReferenceClient
from .options import (OptionsClient, build_option_symbol, pars... |
logo = '''
______ __ __ _ __ __
/ ____/__ __ ___ _____ _____ / /_ / /_ ___ / | / /__ __ ____ ___ / /_ ___ _____
/ / __ / / / // _ \ / ___// ___/ / __// __ \ / _ \ / |/ // / / // __ `__ \ / __ \ / _ \ / ___/
/ /_/ // ... |
# -*- encoding: utf-8 -*-
#
# Copyright © 2019–2021 Mergify SAS
#
# 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 appl... |
# Copyright 2013 Google Inc. All Rights Reserved.
"""'dns managed-zone list' command."""
from apiclient import errors
from googlecloudsdk.calliope import base
from googlecloudsdk.calliope import exceptions
from googlecloudsdk.core import properties
from googlecloudsdk.dns.lib import util
class List(base.Command):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.