text stringlengths 2 999k |
|---|
async def get_location_count() -> int:
return 234
async def get_locations_used() -> int:
return 230
|
from __future__ import annotations
import asyncio
from datetime import datetime
from typing import TYPE_CHECKING, Union, Optional, List, Dict, Any
import discord
from .base import DatabaseChecker
from .punishments import Punisher
if TYPE_CHECKING:
from .punishments import Punishment
from discord.ext import ... |
#!/usr/bin/env python2
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test re-org scenarios with a mempool that contains transactions
# that spend (directly or indirectly)... |
# coding: utf-8
# In[1]:
import numpy as np
def get_homograph(u,v):
A = np.array([[u[0][0], u[0][1], 1, 0, 0, 0, -1 * u[0][0] * v[0][0], -1 * u[0][1] * v[0][0]],
[0, 0, 0, u[0][0], u[0][1], 1, -1 * u[0][0] * v[0][1], -1 * u[0][1] * v[0][1]],
[u[1][0], u[1][1], 1, 0, 0, 0, -1 ... |
#!/usr/bin/env pytest
# -*- coding: utf-8 -*-
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: FlatGeobuf driver test suite.
# Author: Björn Harrtell <bjorn@wololo.org>
#
###############################################################... |
import re
class DisambiguatorPrefixRule7(object):
"""Disambiguate Prefix Rule 7
Rule 7 : terCerv -> ter-CerV where C != 'r'
"""
def disambiguate(self, word):
"""Disambiguate Prefix Rule 7
Rule 7 : terCerv -> ter-CerV where C != 'r'
"""
matches = re.match(... |
import librosa
import soundfile
import os, glob, pickle
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.neural_network import MLPClassifier
from sklearn.metrics import accuracy_score
def extract_feature(file_name, mfcc, chroma, mel):
with soundfile.SoundFile(file_name)... |
# coding=utf-8
# Copyright 2018 The HuggingFace Inc. 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... |
"""
WSGI config for ifollow project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` ... |
"""
====================================================
Compute LCMV inverse solution in volume source space
====================================================
Compute LCMV beamformers on an auditory evoked dataset in a volume source
space, and show activation on ``fsaverage``.
"""
# Author: Alexandre Gramfort <ale... |
## -*- coding: utf-8 -*-
from .vendor.Qt import QtCore, QtGui, QtWidgets
import maya.cmds as cmds
import maya.mel as mel
import maya.OpenMayaUI as OpenMayaUI
import maya.OpenMaya as OpenMaya
import json
import os
def maya_version():
return int(cmds.about(v=True)[:4])
def maya_api_version():
return int(cmds.ab... |
# coding=utf-8
# Copyright 2017-2019 The THUMT Authors
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
_ENGINE = None
def enable_distributed_training():
global _ENGINE
try:
import horovod.tensorflow as hvd
_ENGINE = hvd... |
from django.urls import reverse
from oscar.test.testcases import WebTestCase
from oscar.apps.partner import models
class TestPartnerDashboard(WebTestCase):
is_staff = True
def test_allows_a_partner_user_to_be_created(self):
partner = models.Partner.objects.create(
name="Acme Ltd")
... |
default_app_config = 'repeating_tasks.apps.RepeatingTasksConfig'
|
import external_movie_data
import fresh_tomatoes
import json
import media
def validate_movie_info(movie_info):
# TODO: Aritmethic Error handling
# Convert and round rating range
rating = round(movie_info['rating'] * 5 / 10, 1)
# TODO: Supply the list to the view and loop through it
# Check if gen... |
import numpy as np
from cottonwood.core.activation import Tanh
from cottonwood.core.initializers import LSUV
from cottonwood.core.layers.generic_layer import GenericLayer
from cottonwood.core.optimizers import SGD
import cottonwood.core.toolbox as tb
class Dense(GenericLayer):
def __init__(
self,
... |
import math
import numpy as np
import tensorflow as tf
from ..learning.nn.injectors import SkipGramInjector
def sensor2vec(num_sensors, sensor_event_list, embedding_size=20,
batch_size=128, num_skips=8, skip_window=5,
num_neg_samples=64, learning_rate=1.0):
"""Sensor to Vector
""... |
# Uses python3
import sys
""" def get_majority_element(a, left, right):
if left == right:
return -1
if left + 1 == right:
return a[left]
#write your code here
return -1 """
def get_majority_element_hash_approach(a, n):
new = {}
for e in a:
if e not in new:
... |
from kivy.uix.button import Button
from kivy.properties import StringProperty, BooleanProperty, NumericProperty, ObjectProperty
from kivy.graphics import Color, Rectangle, RoundedRectangle, Ellipse
from kivy.lang import Builder
Builder.load_string('''
<FlatButton>:
background_normal: ''
background_color: [0,0,... |
"""
ASGI config for reportsmanagement project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJ... |
"""
Django settings for app project.
Generated by 'django-admin startproject' using Django 3.2.9.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
from pathlib imp... |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 8
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from isi_sdk_8_2_1.models.node_dr... |
# ******************* BLOG MODULE ****************************** #
# ** Created by Yossep
# ** github: https://github.com/j2B237/
# ** Project : Joblogueur
# ** Description:
#
# Within this module we have many functions designed to help display posts
# Methods such as :
# display all posts
# display posts per category
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
import logging
from sites import foolSlide
from sites import readcomicOnlineto
from sites import comicNaver
from sites import mangaHere
from sites import rawSenManga
from sites... |
from django.urls import path
from . import views
app_name = 'subscribers'
urlpatterns = [
path('', views.IndexView.as_view(), name='index'),
path('manage/', views.manage, name='manage'),
path('goodbye/<uuid:mailing_list_uuid>/', views.goodbye, name='goodbye'),
path('subscribe/<uuid:mailing_list_uuid... |
#!/usr/bin/env python
import random
import argparse
import cv2
import torch
import torch.nn as nn
import torch.optim as optim
from tensorboardX import SummaryWriter
import torchvision.utils as vutils
import gym
import gym.spaces
import numpy as np
log = gym.logger
log.set_level(gym.logger.INFO)
LATENT_VECTOR_SIZE... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import time
import MySQLdb
import datetime
import random
brand_data = {}
today = datetime.date.today()
report_tittle = "milk/milk_{}.html".format(today.strftime("%Y_%m"))
first = today.replace(day=1)
last_year = first - datetime.timedelta(days=365)
rang_low = today.strftime... |
_base_ = './gfl_r50_fpn_1x_coco.py'
# learning policy
lr_config = dict(step=[16, 22])
runner = dict(type='EpochBasedRunner', max_epochs=24)
work_dir = 'work_dirs/coco/gfl/gfl_r50_fpn_2x_coco' |
import timeit
class timer(object):
def __init__(self, repeats=3, loops=1, gc=False):
self.repeats = repeats
self.loops = loops
self.gc = gc
def __enter__(self):
return self
def __exit__(self, type, value, traceback):
if type is not None:
return False
... |
# -*- coding: utf8 -*-
#
# 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... |
"""
Harness for visualising a neural network.
-- kandasamy@cs.cmu.edu
"""
# pylint: disable=invalid-name
import functools
import graphviz as gv
import os
import networkx as nx
import numpy as np
# Parameters for plotting
_SAVE_FORMAT = 'eps'
# _SAVE_FORMAT = 'png'
_LAYER_SHAPE = 'rectangle'
_IPOP_SHAPE = 'circle... |
from django.contrib.auth.models import User, Group
from rest_framework import serializers
from .models import *
class UserSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = User
fields = ['url', 'username', 'email', 'groups']
class GroupSerializer(serializers.HyperlinkedMode... |
import functools
import os
from contextlib import contextmanager
from .platforms.basepath import BasePath, Root, InstallRoot, DestDir # noqa
from .platforms.host import platform_info
Path = platform_info().Path
def abspath(path, type=Path, **kwargs):
return type.abspath(path, **kwargs)
def commonprefix(paths... |
import pytest
from tests.helpers.run_command import run_command
from tests.helpers.runif import RunIf
"""
A couple of sanity checks to make sure the model doesn't crash with different running options.
"""
def test_fast_dev_run():
"""Test running for 1 train, val and test batch."""
command = ["train.py", "++... |
import argparse
import binascii
import sys
import time
from inkfish.proof_of_time import (create_proof_of_time_wesolowski,
create_proof_of_time_nwesolowski,
create_proof_of_time_pietrzak,
check_proof_of_time_wesolo... |
import pathlib
from ruamel import yaml
from qhub.schema import verify
from qhub.provider.cicd.linter import comment_on_pr
def create_validate_subcommand(subparser):
subparser = subparser.add_parser("validate")
subparser.add_argument(
"configdeprecated",
help="qhub configuration yaml file (dep... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import datetime
import decimal
import io
import uuid
from flask import current_app
from flask import json as _json
from flask import request
from sqlalchemy import types
import arrow
text_type = str
def _wrap_reader_for_text(fp, encoding):
if is... |
"""An implementation of Matching Layer."""
import typing
import tensorflow as tf
from tensorflow.keras import layers
class MatchingLayer(layers.Layer):
"""
Layer that computes a matching matrix between samples in two tensors.
:param normalize: Whether to L2-normalize samples along the
dot produc... |
# python 2.7, pytorch 0.3.1
import os, sys
sys.path.insert(1, '../')
import torch
import cv2
import shutil
import torchvision
import numpy as np
import itertools
import subprocess
import random
import matplotlib.pyplot as plt
import torch.nn as nn
import torch.optim as optim
import torchvision.transforms as transform... |
# Simple image recommender
#
# required:
# data/images: a folder containing your images dataset
# data/users: can be empty, but the folder needs to exist (for now ?)
#
# optional:
# data/tags.csv: a comma-separated list containing the names of your
# images and the corresponding semicolon-separated tags
# (eg. "37.pn... |
# Copyright 2020 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... |
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2021 Scipp contributors (https://github.com/scipp)
# @author Neil Vaytet
from .. import config
from ..core import concatenate, values, dtype, units, nanmin, nanmax, histogram, \
full_like
from ..core import Variable, DataArray
from ..core import abs as ab... |
# -*- Python -*-
# Return the options to use for a C++ library or binary build.
# Uses the ":optmode" config_setting to pick the options.
load(
"//tensorflow/core/platform:default/build_config_root.bzl",
"if_dynamic_kernels",
"if_static",
"tf_additional_grpc_deps_py",
"tf_additional_xla_deps_py",
... |
# Copyright 2012 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 ... |
#
# Copyright (c) 2015 Juniper Networks, Inc. All rights reserved.
#
#!/usr/bin/python
doc = """\
Node manager listens to process state change events and
other flag value change events to provide advanced service
management functionality.
Rules files looks like following:
====================
{ "Rules": [
{"pro... |
from django import forms
from django.forms.widgets import PasswordInput
from modules.common.id_choicefield import IdentificationField
class PartyForm(forms.Form):
error_messages = {
'password_mismatch': (
'The confirmation was different from that you chose.'
),
}
party_name =... |
# Copyright 2012 Nebula, 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 agree... |
from PygFW import Event
import pygame
class EntityClickEvent(Event):
def __init__(self, scene_surface):
Event.__init__(self, scene_surface, pygame.MOUSEBUTTONDOWN)
def executor(self, scene, event):
for entity in scene.entities._list_:
if entity.clickable:
if en... |
#!/usr/bin/env python
# ___INFO__MARK_BEGIN__
#######################################################################################
# Copyright 2008-2021 Univa Corporation (acquired and owned by Altair Engineering Inc.)
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file exc... |
import argparse
import os
import numpy as np
import tensorflow as tf
from matplotlib import pyplot as plt
from PIL import Image
import models
def predict(model_data_path, image_path):
# Default input size
height = 228
width = 304
channels = 3
batch_size = 1
# Read image
img = Image.o... |
import pyaf.tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Logit'] , ['MovingAverage'] , ['Seasonal_DayOfMonth'] , ['LSTM'] ); |
import inspect
import io
import json
import logging as logginglib
import sys
from datetime import datetime
from typing import Any, Callable, Dict, List, Optional, Set, TextIO, Tuple
from typing_extensions import Literal
from hpc.autoscale import hpclogging as logging
from hpc.autoscale.codeanalysis import hpcwrapclas... |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
with open('LICENSE') as f:
license = f.read()
setup(
name='borg_hydro',
version='0.1.0',
author='Stefan Lüdtke',
url='https://git.gfz-potsdam.de:sluedtke/borg_hydro.git',
packages=find_packages(),
license=license,
in... |
"""
This module defines the basic `DefaultObject` and its children
`DefaultCharacter`, `DefaultAccount`, `DefaultRoom` and `DefaultExit`.
These are the (default) starting points for all in-game visible
entities.
"""
import time
import inflect
from builtins import object
from future.utils import with_metaclass
from col... |
from django.contrib import admin
from .models import Preference, Profile, Allergy, Goal
admin.site.register(Preference)
admin.site.register(Profile)
admin.site.register(Allergy)
admin.site.register(Goal) |
from rest_framework import serializers
import markdown2
from .models import Content
from omaralbeik import server_variables as sv
class ContentSerializer(serializers.ModelSerializer):
tags = serializers.SerializerMethodField()
html_text = serializers.SerializerMethodField()
website_url = serializers.Seria... |
#!/usr/bin/env python
# coding: utf-8
# # GenCode Explore
#
# Explore the human RNA sequences from GenCode.
#
# Assume user downloaded files from GenCode 38 [FTP](http://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_human/release_38/)
# to a subdirectory called data.
#
# Move the GenCodeLoader class to its own python... |
# 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... |
from __future__ import absolute_import
import numpy as np
from scipy.spatial import Delaunay
from spektral.utils import label_to_one_hot, numpy_to_nx
RETURN_TYPES = {'numpy', 'networkx'}
MAX_K = 7 # Maximum number of nodes in a graph
def generate_data(return_type='networkx', classes=0, n_samples_in_class=1000,
... |
#
# Copyright (c) 2009 Testrepository Contributors
#
# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
# license at the users choice. A copy of both licenses are available in the
# project source as Apache-2.0 and BSD. You may not use this file except in
# compliance with one of these two lice... |
# Generated by Django 3.1.12 on 2021-06-24 10:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("users", "0075_auto_20210607_1312"),
]
operations = [
migrations.AlterField(
model_name="userprofile",
name="lang",
... |
# 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, s... |
#!/usr/bin/env python
import argparse
import os,time
import numpy as np
from astropy.io import fits
from astropy.table import Table
from pypeit import msgs
from pypeit.par.util import make_pypeit_file
class SmartFormatter(argparse.HelpFormatter):
def _split_lines(self, text, width):
if text.startswith('R... |
# cinder documentation build configuration file, created by
# sphinx-quickstart on Sat May 1 15:17:47 2010.
#
# This file is execfile()d with the current directory set
# to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values hav... |
# -*- coding: utf-8 -*-
"""
Django settings for Agrus project.
Generated by 'django-admin startproject' using Django 1.11.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/se... |
"""awards URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/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')
Class-bas... |
__version__ = '1.0.5'
# Deprecated, keep it here for a while for backward compatibility.
import multidict # noqa
# This relies on each of the submodules having an __all__ variable.
from multidict import * # noqa
from . import hdrs # noqa
from .protocol import * # noqa
from .connector import * # noqa
from .clien... |
class Solution:
def findMin(self, nums: List[int]) -> int:
l = 0
r = len(nums) - 1
while r - l > 3:
m = (l + r) // 2
if nums[m] > nums[l] and nums[m] > nums[r]:
l = m + 1
else:
r = m
return min(nums[l:r+1])
|
from django.contrib.admin import ModelAdmin
from django.contrib.gis.admin.widgets import OpenLayersWidget
from django.contrib.gis.gdal import OGRGeomType
from django.contrib.gis.db import models
class GeoModelAdmin(ModelAdmin):
"""
The administration options class for Geographic models. Map settings
may be... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... |
######################################################################
# Copyright
# John Holland <john@zoner.org>
# All rights reserved.
#
# This software is licensed as described in the file LICENSE.txt, which
# you should have received as part of this distribution.
#
##############################################... |
load(
"//haskell:providers.bzl",
"HaskellInfo",
"HaskellLibraryInfo",
)
load(":private/set.bzl", "set")
def gather_dep_info(ctx, deps):
"""Collapse dependencies into a single `HaskellInfo`.
Args:
ctx: Rule context.
deps: deps attribute.
Returns:
HaskellInfo: Unified informat... |
# Copyright (C) 2018 Intel Corporation
#
# SPDX-License-Identifier: MIT
from django.contrib import admin
from .models import Task, Segment, Job, Label, AttributeSpec
class JobInline(admin.TabularInline):
model = Job
can_delete = False
# Don't show extra lines to add an object
def has_ad... |
__all__ = ['ZoneMapper'] |
# Copyright (c) 2017-2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
"""
This module has been relocated to ``dazl.client``, ``dazl.damlast``, ``dazl.protocols``, or
``dazl.query``.
"""
from typing import TYPE_CHECKING, TypeVar, Union
import warnin... |
# full assembly of the sub-parts to form the complete net
import torch.nn.functional as F
from .unet_parts import *
class UNet(nn.Module):
def __init__(self, n_channels, n_classes):
super(UNet, self).__init__()
self.inc = inconv(n_channels, 64)
self.down1 = down(64, 128)
self.down... |
# The MIT License (MIT)
#
# Copyright (c) 2016 Adafruit Industries
#
# 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, cop... |
from unittest import TestCase
from model_mommy import mommy
from physical.commands import HostCommandOL6, HostCommandOL7
class CommandsBaseTestCase(object):
OS_VERSION = ''
HOST_COMMAND_CLASS = None
EXPECTED_CMD_TMPL = ''
def setUp(self):
self.host = mommy.make(
'Host',
... |
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2020, David Swarbrick.
#
# 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 ... |
# Copyright (C) 2019-2020, Therapixel SA.
# All rights reserved.
# This file is subject to the terms and conditions described in the
# LICENSE file distributed in this package.
"""The dcm2model module provides methods that can be used to convert pydicom.Dataset
instances to sqlalchemy instances.
"""
from typing import ... |
from typing import Callable, Optional
import gin
import gym
from interact.agents.ddpg.ddpg import DDPGAgent
from interact.agents.utils import register
@gin.configurable(name_or_fn="td3", denylist=["env_fn"])
@register("td3")
class TD3Agent(DDPGAgent):
"""The Twin Delayed DDPG (TD3) algorithm.
This algorith... |
# Copyright (c) 2022, Leonardo Lamanna
# All rights reserved.
# This source code is licensed under the MIT-style license found in the
# LICENSE file in the root directory of this source tree.
import pandas as pd
import os
pd.options.display.max_colwidth = 100
def generate_latex_table(data_file, labels, tab_name, ca... |
#!/usr/bin/env python
import torch
import torch.nn as nn
from colossalai.nn import CheckpointModule
from .utils.dummy_data_generator import DummyDataGenerator
from .registry import non_distributed_component_funcs
class NetWithRepeatedlyComputedLayers(CheckpointModule):
"""
This model is to test with layers w... |
import math
import torch
from ..abstract import ExtendedTorchModule
from ..functional import sparsity_error
from ._abstract_recurrent_cell import AbstractRecurrentCell
class HardSoftmaxNACLayer(ExtendedTorchModule):
"""Implements the NAC (Neural Accumulator)
Arguments:
in_features: number of ingoing... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------------------------------------... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
from django.http import HttpResponse
from django.shortcuts import render
# Create your views here.
def index(request):
return HttpResponse('{"response": "Synth is running!"}')
def test(request):
return HttpResponse('ANOTHER RESPONSE YO')
|
import py
import sys, shutil, os
from rpython.tool.udir import udir
from pypy.interpreter.gateway import interp2app
from pypy.module._cffi_backend.newtype import _clean_cache
if sys.platform == 'win32':
WIN32 = True
else:
WIN32 = False
class AppTestRecompilerPython:
spaceconfig = dict(usemodules=['_cffi_b... |
"""
Django settings for app project.
Generated by 'django-admin startproject' using Django 2.1.15.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
# Bu... |
#!/usr/bin/python3
"""
Defines a class TestFileStorage.
"""
from models.engine.file_storage import FileStorage
import unittest
import models
import os
class TestFileStorage(unittest.TestCase):
"""Represent a TestFileStorage."""
def setUp(self):
"""SetUp method"""
self.file_storage = F... |
# Rework of model.py
# https://github.com/ddddwee1/sul
# This wrap-up is targeted for better touching low-level implementations
import layers2 as L
import tensorflow as tf
config = tf.ConfigProto()
config.gpu_options.allow_growth=True
tf.enable_eager_execution(config=config)
import numpy as np
import os
import ran... |
"""
Tests the continuous link flap in SONiC.
Parameters:
--orch_cpu_threshold <port> (int): Which port you want the test to send traffic
to. Default is 3.
"""
import logging
import time
import pytest
from tests.common.helpers.assertions import pytest_assert, pytest_require
from tests.common import port_t... |
# -*- coding: utf-8 -*-
import os
import sys
from news_crawler.spiders import BaseSpider
from scrapy.spiders import Rule
from scrapy.linkextractors import LinkExtractor
from datetime import datetime
sys.path.insert(0, os.path.join(os.getcwd(), "..",))
from news_crawler.items import NewsCrawlerItem
from new... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
if __name__ == "__main__":
def midlgeom(a):
if len(a) != 0:
res = 0
for i in range(len(a)):
res += 1/a[i]
return len(a) / res
else:
return None
raw = input('Введите последо... |
import sys
import yaml
try:
from yaml import CSafeLoader as SafeLoader, CSafeDumper as SafeDumper
except ImportError:
print("Failed to load fast LibYAML bindings. You should install them to speed up kluctl.", file=sys.stderr)
from yaml import SafeLoader as SafeLoader, SafeDumper as SafeDumper
def constr... |
"""
Plotting data points
--------------------
GMT shines when it comes to plotting data on a map. We can use some sample data that is
packaged with GMT to try this out. PyGMT provides access to these datasets through the
:mod:`pygmt.datasets` package. If you don't have the data files already, they are
automatically do... |
#!/usr/bin/env python
"""Copyright (c) 2005-2019, University of Oxford.
All rights reserved.
University of Oxford means the Chancellor, Masters and Scholars of the
University of Oxford, having an administrative office at Wellington
Square, Oxford OX1 2JD, UK.
This file is part of Chaste.
Redistribution and use in ... |
#!/usr/bin/env python3
""" Health authority back end REST and static content server """
__copyright__ = """
Copyright 2020 Diomidis Spinellis
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 L... |
import numpy as np
from sklearn.metrics import roc_auc_score
from numba import jit
def array2str(tmp_array, sep = " "):
str_list = ["{:.3f}".format(tmp_item) for tmp_item in tmp_array]
return sep.join(str_list)
def generate_sorted_groups(pred, y, a):
a_idx = np.where(a == 0)
b_idx = np.where(a == 1)... |
from model.contact import Contact
from random import randrange
def test_contacts_on_homepage(app, db):
contacts_from_homepage = sorted(app.contact.get_contact_list(), key = Contact.id_or_max)
contacts_from_db = sorted(db.get_contact_list(), key = Contact.id_or_max)
assert len(contacts_from_homepage) == l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.