text stringlengths 2 999k |
|---|
from app import app
from util.useremails import send_recovery_email
from data import model
import argparse
from flask import Flask, current_app
from flask_mail import Mail
def sendReset(username):
user = model.user.get_nonrobot_user(username)
if not user:
print "No user found"
return
... |
# This file is part of the TMHMM3 project.
#
# @author Jeppe Hallgren
#
# For license information, please see the LICENSE file in the root directory.
import torch
from torch.utils.data.dataset import Dataset
import numpy as np
import math
import random
from util import write_out
class TMDataset(Dataset):
def __i... |
#!/usr/bin/env python
import itertools
from dataclasses import dataclass
from functools import reduce
from typing import Generator, List, Set
EIGHT_DIRECTIONS = [
(-1, -1),
(-1, 0),
(-1, 1),
(0, -1),
(0, 1),
(1, -1),
(1, 0),
(1, 1),
]
def product(list_):
return reduce(lambda x, y... |
import gc
import os
import pickle
import logging
import sys
import nose
import angr
from nose.plugins.attrib import attr
from angr.state_plugins.history import HistoryIter
l = logging.getLogger("angr.tests")
test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../binaries/tests'))
target... |
#
# Copyright 2019 The FATE 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 appli... |
import os
import yaml
width = 256
height = 256
num_folds = 5
batch_size = 8
num_epochs = 50
num_workers = 4
learning_rate = 0.001
mode = 'train'
experiment = 'LungSeg'
encoders = ['vgg16']
#nodes = ['vti2-ib', 'vti1-ib', 'pti']
nodes = ['vti2-ib', 'vti2-ib', 'vti2-ib']
#nodes = ['vti1-ib', 'vti1-ib', 'vti1-ib']
#no... |
import time
from Queue import Queue
from threading import Thread
from random import normalvariate
import collectd
numbers = Queue()
conn = collectd.Connection()
def is_prime(n):
for i in xrange(2, n):
if n % i == 0:
return False
return True
def watch_queue():
while True:
conn... |
"""
category: Database
name: Search E.coli parts (RegulonDB)
description: search the RegulonDB database for E.coli parts
icon: database.png
menu: yes
specific for: Part
tool: yes
"""
from tinkercell import *
try:
RegulonDB.ECOLI_PROMOTERS.has_key("hello");
except:
tc_print("RegulonDB is being loaded for the ... |
#!/usr/bin/env python
#
# Use the raw transactions API to spend BABs received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a basecoind or baseco... |
# Generated by Django 1.10.7 on 2017-06-07 18:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('data_interfaces', '0010_automaticupdaterule_workflow'),
]
operations = [
migrations.AddField(
model_name='domaincaserulerun',
... |
# Copyright 2018 BMW Car IT GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... |
from subprocess import CalledProcessError
from subprocess import check_output, Popen
from unittest import SkipTest
import os
import uuid
import shutil
import getpass
import platform
import copy
import logging
import pytest
from mock import patch
from dvc.utils.compat import str
from dvc.main import main
from dvc.conf... |
# Copyright 2016-2021 The Van Valen Lab at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
#
# Licensed under a modified Apache License, Version 2.0 (the "License");... |
"""
Sample Hook to provide helpful message that project generated successfully.
"""
from __future__ import print_function
import os
TERMINATOR = "\x1b[0m"
INFO = "\x1b[1;33m [INFO]: "
SUCCESS = "\x1b[1;32m [SUCCESS]: "
HINT = "\x1b[3;33m"
def remove_optional_files():
filenames = ["event.json"]
for file... |
import os
import pandas as pd
from babel.numbers import format_currency, format_decimal
from notify.exceptions import EnvironmentVariablesError
def format_numbers(df: pd.DataFrame, currency_columns: list = None, number_columns: list = None):
"""
Deze functie converteerd currency (bedrag) en number (getal) k... |
"""
Helper script to call pip freeze inside a container
"""
import subprocess
subprocess.run("pip freeze", shell=True)
|
"""
Unit tests for tensorflow backend.
"""
import geomstats.backend as gs
import geomstats.tests
@geomstats.tests.tf_only
class TestBackendTensorFlow(geomstats.tests.TestCase):
def test_vstack(self):
import tensorflow as tf
with self.test_session():
tensor_1 = tf.convert_to_tensor([[1... |
#012
preço = float(input('Digite seu preço R$'))
novo = preço - (preço * 5 / 100)
parcelado = preço + (preço *5 / 100)
print('O produto que custava {:.2f}R$ na promoção com desconto de 5%, vai custar: {:.2f} a vista'.format(preço, novo))
print('se voce pagar parcelado vai sair com uma taxa de 5% a mais que no ... |
# Raspberry Pi Cat Laser Driver
# This code controls the laser pointer servos to target the laser at different
# locations. Make sure to modify the MQTT_SERVER variable below so that it points
# to the name or IP address of the host computer for the cloud server VM (i.e. the
# machine running the Vagrant virtual machi... |
import numpy as np
from pycocotools.coco import COCO
from .custom import CustomDataset
from .registry import DATASETS
@DATASETS.register_module
class CocoDatasetSeen65(CustomDataset):
CLASSES = ('person', 'bicycle', 'car', 'motorcycle', 'bus', 'truck', 'boat',
'traffic_light', 'fire_hy... |
import sys
from collections import deque
import numpy as np
class Player():
def __init__(self, id, deck):
self.id = id
self.deck = deque(deck)
def __str__(self):
return f'<Player({self.id}, {self.deck})>'
def __repr__(self):
return str(self)
def play_card(self):
... |
# This file is just for segregate ugly SQL queries from the codes...
drop_table = 'DROP TABLE IF EXISTS doc_index;'
create_table = '''
CREATE TABLE doc_index (
lang TEXT,
doc_id INT,
doc_path TEXT,
url TEXT,
title TEXT,
begin INT,
end INT,
PRIMARY KEY (lang, doc_id)
);'''
create_index =... |
import logging
from collections import defaultdict
from copy import deepcopy
import aitodpycocotools.mask as mask_utils
from .lvis import LVIS
class LVISResults(LVIS):
def __init__(self, lvis_gt, results, max_dets=300):
"""Constructor for LVIS results.
Args:
lvis_gt (LVIS class insta... |
from flask import Flask, request, Response, jsonify
from .helpers.request_helper import read_audio
from .helpers.files_helper import clean_files
from .utils.wav_converter import convert_to_wav
from .utils.audio_recognizer import recognize_audio
app = Flask(__name__)
@app.route('/ping')
def ping():
return "I'm ali... |
from django.db import models
from django.conf import settings
import datetime
from django.db import models
from django.db.models import permalink
# Create your models here.
class Org(models.Model):
name = models.CharField(max_length=50, unique=True)
created_date = models.DateTimeField(auto_now_add=True, null=... |
# GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Component:
DESCRIPTION = "Lists all snapshots belonging to the account"
class Input:
pass
class Output:
SNAPSHOTS = "snapshots"
class ListSnapshotsInput(komand.Input):
schema = json.loads("""
{}
""")
def __ini... |
'''
a short example on how to use the constrained prim function.
for more details see Kwakkel (2019) A generalized many‐objective optimization
approach for scenario discovery, doi: https://doi.org/10.1002/ffo2.8
'''
import pandas as pd
import matplotlib.pyplot as plt
from ema_workbench.analysis import prim
from ema_... |
# 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... |
# Generated by Django 3.2.6 on 2021-08-23 03:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('registration', '0007_alter_data_image'),
]
operations = [
migrations.AlterField(
model_name='data',
name='image',
... |
import os
import pandas as pd
from .utils import load_setting
class Divider(object):
def __init__(self, df, files, base):
self.data = df
self.files = files
self.base = base
self.writers = dict()
def _setup_writer(self, outdir):
assert self.files
os.makedirs(o... |
# -*- coding: utf-8 -*-
"""
module for implementation of indicator class, which is designed as MinIn for systems with netvalues
"""
import pandas as pd
from pyecharts import options as opts
from pyecharts.charts import Kline, Line, Bar, Grid
from pyecharts.commons.utils import JsCode
from xalpha.cons import line_opts... |
#
# 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... |
# Generated by Django 3.1.2 on 2020-11-03 08:36
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('index', '0018_website_cover_img'),
]
operations = [
migrations.RemoveField(
model_name='website',
name='cover_img',
... |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Script to generate list of seed nodes for chainparams.cpp.
This script expects two text files in the dir... |
import xadmin
from xadmin import views
from xadmin.layout import Fieldset, Main, Row, Side
from acheve_mgt.models import MyClass, Student, Course, ScoreShip
class MyClassAdmin(object):
list_display = ['name', 'grade', 'dept']
ordering = ['-create_time', 'name', 'grade']
serch_fields = ['name', 'grade', '... |
from django.http import HttpResponse
from django.shortcuts import render, get_object_or_404
from django.contrib.auth.views import LoginView
from stories.models import Stage, StageForm
class SigninView(LoginView):
redirect_authenticated_user = True
def index(request):
return HttpResponse('This ia accounts ind... |
from src.orm_model import Tweet, Author
import pandas as pd
from sklearn.linear_model import LogisticRegression
# import pickle
def get_most_likely_author(tweet_body, spacy_model):
authors = Author.query.all()
features = pd.DataFrame()
target = pd.Series()
for a in authors:
for t in a.tweets:
... |
__version__ = "0.0.31"
from . import viz
from . import scrape
from . import utils
|
import requests
from marshmallow import Schema, fields, post_load
from restit._response import Response
from restit.decorator import path, request_body
from restit.internal.request_body_properties import RequestBodyProperties
from restit.request import Request
from restit.resource import Resource
from test.base_test_s... |
"""KDDCUP 99 dataset.
A classic dataset for anomaly detection.
The dataset page is available from UCI Machine Learning Repository
https://archive.ics.uci.edu/ml/machine-learning-databases/kddcup99-mld/kddcup.data.gz
"""
import errno
from gzip import GzipFile
import logging
import os
from os.path import dirname, ex... |
import argparse
from libmproxy import cmdline
import tutils
def test_parse_replace_hook():
x = cmdline.parse_replace_hook("/foo/bar/voing")
assert x == ("foo", "bar", "voing")
x = cmdline.parse_replace_hook("/foo/bar/vo/ing/")
assert x == ("foo", "bar", "vo/ing/")
x = cmdline.parse_replace_hook(... |
# # from os import name
# from urllib.request import urlopen
# class News:
# '''
# News class to define News Objects
# '''
# def __init__(self,id,name,description,url,category,country,language):
# # def __init__(self,author,title,description,url,urlToImage,content):
# self.id =id
# ... |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from ..dti import DTIRecon
def test_DTIRecon_inputs():
input_map = dict(
DWI=dict(
argstr="%s",
extensions=None,
mandatory=True,
position=1,
),
args=dict(
argstr="%s",
... |
import warnings
warnings.filterwarnings("ignore")
import sys
import matplotlib.pylab as plt
import scipy
sys.path.append('waveglow/')
import numpy as np
import torch
from hparams import create_hparams
from train import load_model
from text import text_to_sequence
def plot_data(data, figsize=(16, 4)):
fig, ax... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2016, Florent Thiery
# https://github.com/holacracyone/glassfrog-api/tree/API_v3
import os
import sys
import time
import math
import hashlib
import requests
import json
session = None
# Do not edit this directly, create a config.json file instead
CONFIG_DEFA... |
#!/usr/bin/env python
"""Demonstrate the task-pull paradigm for high-throughput computing
using mpi4py. Task pull is an efficient way to perform a large number of
independent tasks when there are more tasks than processors, especially
when the run times vary for each task.
This code is over-commented for instructiona... |
'''
Module providing the clingo-like pyclingo application.
'''
from clingo import Application, clingo_main
class PyClingoApplication(Application):
'''
This is an example app mimimicking clingo.
'''
program_name = "pyclingo"
def main(self, control, files):
for file_ in files:
co... |
# coding=utf-8
# Copyright 2021 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... |
"""
Node classes (`Apply`, `Variable`) and expression graph algorithms.
"""
from __future__ import absolute_import, print_function, division
from collections import deque
from copy import copy
from itertools import count
import theano
from theano import config
from theano.gof import utils
from six import string_types... |
import numpy as np
import torch
from torch import nn
import os
from collections import OrderedDict
from torch.autograd import Variable
import itertools
import util.util as util
from .base_model import BaseModel
from . import networks_basic as networks
from scipy.ndimage import zoom
import fractions
import functools
imp... |
# coding: utf-8
"""
Copyright 2018 OSIsoft, 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 o... |
import os
import sys
import tensorflow as tf
include_path = tf.sysconfig.get_include()
lib_path = tf.sysconfig.get_lib()
os.system('sh ./build.sh {} {}'.format(include_path, lib_path)) |
"""Tests for redflags run with pytest"""
import json
import unittest
from ... import create_app
class QuestionTestCase(unittest.TestCase):
"""
This class represents the question test cases
"""
def setUp(self):
APP = create_app("testing")
self.app = APP.test_client()
self.que... |
import requests
from bs4 import BeautifulSoup
from clint.textui import progress
import sys
import os
session = requests.Session()
os.chdir(r"C:\Users\user\Downloads") #setting default download directory uncomment the line by removing the # and editting the address in quotes
url = input("Episode URL: ")
slice_i... |
from __future__ import absolute_import
import os
from django.core.files.base import ContentFile
from sentry.models import File, FileBlob
from sentry.testutils import TestCase
class FileBlobTest(TestCase):
def test_from_file(self):
fileobj = ContentFile('foo bar'.encode('utf-8'))
my_file1 = Fil... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from conans import ConanFile, tools
import os
class DoctestConan(ConanFile):
name = "doctest"
version = "1.2.6"
url = "https://github.com/bincrafters/conan-doctest"
description = "C++98/C++11 single header testing framework"
license = "MIT"
export... |
# -*- coding: utf-8 -*-
from torch.testing._internal.common_utils import run_tests
# Quantization core tests. These include tests for
# - quantized kernels
# - quantized functional operators
# - quantized workflow modules
# - quantized workflow operators
# - quantized tensor
# 1. Quantized Kernels
# TODO: merge the ... |
from __future__ import print_function
import tensorflow as tf
import numpy as np
import TensorflowUtils as utils
import read_MITSceneParsingData as scene_parsing
import datetime
import BatchDatsetReader as dataset
from six.moves import xrange
import os.path as osp
FLAGS = tf.flags.FLAGS
tf.flags.DEFINE_integer("batc... |
#!/usr/bin/env python3
# by dongchao <cookie@maxcale.cn>
from flask import render_template
from . import dashboard
@dashboard.route('/dashboard_index/', methods=['POST', 'GET'])
def dashboard_index():
return render_template('dashboard.html')
|
# -*- coding: utf-8 -*-
__author__ = 'Shaon Majumder'
__email__ = 'smazoomder@gmail.com'
__version__ = '0.0.0.2.1' |
"""Hungry Robots, by Al Sweigart al@inventwithpython.com
Escape the hungry robots by making them crash into each other.
This and other games are available at https://nostarch.com/XX
Tags: large, game"""
__version__ = 0
import random, sys
# Set up the constants:
WIDTH = 40 # (!) Try changing this to 70 or 10.... |
# SPDX-FileCopyrightText: 2019 Dave Astels for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
PyPortal based alarm clock.
Adafruit invests time and resources providing this open source code.
Please support Adafruit and open source hardware by purchasing
products from Adafruit!
Written by Dave Astels for Ad... |
class CompilerError(Exception):
pass
class UnsatError(Exception):
pass
class NoContractFoundError(Exception):
pass |
# coding: utf-8
"""
Jamf Pro API
## Overview This is a sample Jamf Pro server which allows for usage without any authentication. The Jamf Pro environment which supports the Try it Out functionality does not run the current beta version of Jamf Pro, thus any newly added endpoints will result in an error and sh... |
# Copyright 2014 Big Switch Networks, 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... |
#!/usr/bin/env python
#
# Copyright (c) Greenplum Inc 2008. All Rights Reserved.
#
# Unit Testing of catalog module.
#
import unittest2 as unittest
from gppylib import gplog
from gppylib.db import dbconn
from gppylib.db import catalog
from gppylib.db.test import skipIfDatabaseDown
logger=gplog.get_default_logger... |
import pybamm
import numpy as np
import pandas as pd
import os
import unittest
class TestSimulation(unittest.TestCase):
def test_basic_ops(self):
model = pybamm.lithium_ion.SPM()
sim = pybamm.Simulation(model)
self.assertEqual(model.__class__, sim._model_class)
# check that the ... |
# 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... |
def tipleft():
from time import sleep
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
forward = 18
backward = 17
GPIO.setup(forward,GPIO.OUT)
GPIO.setup(backward,GPIO.OUT)
GPIO.output(forward,1)
sleep(0.3)
GPIO.output(forward,0)
sleep(1)
GPI... |
import random
import numpy as np
import torch
from src.utils.action_label_to_idx import action_label_to_idx
from ..utils.tensors import collate
from ..utils.misc import to_torch
import src.utils.rotation_conversions as geometry
UNSUPERVISED_BABEL_ACTION_CAT_LABELS_IDXS = [48, 50, 28, 38, 52, 11, 29, 19, 51, 22, 14, 21... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
import os
from frappe import _
from frappe.model.document import Document
import dropbox, json
from frappe.utils.backups import new_... |
#!/usr/bin/env python
"""Types-related part of GRR API client library."""
from grr_api_client import errors
from grr_api_client import utils
from grr.proto import flows_pb2
class UnknownFlowName(errors.Error):
pass
class Types(object):
"""Object that helps users to deal with GRR type system."""
def __init_... |
import sys
sys.path.append('..')
import numpy as np
import parameters.aerosonde_parameters as MAV
# size of the waypoint array used for the path planner. This is the
# maximum number of waypoints that might be transmitted to the path
# manager.
size_waypoint_array = 100
# airspeed commanded by planner
Va0 = MAV.u0
... |
from keras.models import Sequential
from keras.layers import Activation, Dense, Dropout, LSTM
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from sklearn.metrics import mean_absolute_error, mean_squared_error, r2_score
def train_test_split(df, test_size=0.2):
split_row... |
# Generated by Django 3.2.3 on 2021-05-29 15:01
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0012_alter_user_first_name_max_length'),
]
operations = [
migrations.CreateModel(
name='User',
... |
from manimlib.imports import *
# Electric field animation, 3Blue1Brown property
# This animation belongs to the file:
# https://github.com/3b1b/manim/blob/master/from_3b1b/old/div_curl.py#L1293
# This code is not my own, I simply updated it to the recent
# version and documented it.
def get_force_field_func(*point_st... |
from django.test import TestCase
from django.urls import reverse
class IndexViewTests(TestCase):
def test_view(self):
response = self.client.get(reverse("app_index"))
self.assertEqual(200, response.status_code)
|
import os
from copy import deepcopy
import pytest
import torch
from torch.optim import SGD, Adadelta, Adagrad, Adam, RMSprop
from pythae.customexception import BadInheritanceError
from pythae.models.base.base_utils import ModelOutput
from pythae.models import VQVAE, VQVAEConfig
from pythae.trainers import BaseTraine... |
#!/usr/bin/env python
import sys
from azure.storage.blob import AppendBlobService
from azure.storage.table import TableService
def prepare_storage_account(storage_account_name, storage_access_key, endpoint_suffix, protocol="https"):
blob_service = AppendBlobService(account_name=storage_account_name, account_key=s... |
from .base import * # noqa
from .base import env
# GENERAL
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = True
# https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
SECRET_KEY = env('DJANGO_SECRET_KEY', de... |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2021, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... |
# -*- coding: utf-8 -*-
import os
import leancloud
from wsgiref import simple_server
from app import app
from cloud import engine
APP_ID = 'lVuhkVzMAnyuCuBa5MS30lY7-gzGzoHsz' #os.environ['LC_APP_ID']
MASTER_KEY = 'UWBunXpUqMTgXTkjiNCTxAQO' #os.environ['LC_APP_MASTER_KEY']
PORT = int(os.environ['LC_APP_POR... |
# -*- coding: utf-8 -*-
###############################################################################
#
# GetPriceEstimates
# Returns an estimated price range for each product offered at a given location.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version... |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 7
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_2_0
from i... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def default_thumbnail_to_https(apps, schema_editor):
Music = apps.get_model("music", "Music")
for music in Music.objects.all():
if music.thumbnail == "http://i1.ytimg.com/vi/Z0X2FyRl-9s/sddefault.... |
from itertools import chain
from rest_framework import serializers
from django.contrib.auth.models import User
from travel.models import TravelLog, TravelEntity
from travel.extras import games
class TravelLogSerializer(serializers.ModelSerializer):
class Meta:
model = TravelLog
fields = '__all__... |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2018, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
from threading import Thread, Event
from mock import Mock
from mitmproxy.controller import Reply, DummyReply, Channel, ServerThread, ServerMaster, Master
from six.moves import queue
from mitmproxy.exceptions import Kill
from mitmproxy.proxy import DummyServer
from netlib.tutils import raises
class TestMaster(objec... |
from lark.visitors import v_args
import roman
from ebl.corpus.domain.chapter import Stage
from ebl.transliteration.domain.text_id import TextId
from ebl.transliteration.domain.museum_number import MuseumNumber
from ebl.transliteration.domain.genre import Genre
from ebl.transliteration.domain.labels import LabelTransfo... |
# -*- coding: utf-8 -*-
from .nodemixin import NodeMixin
from .util import _repr
class Node(NodeMixin, object):
def __init__(self, name, parent=None, children=None, **kwargs):
u"""
A simple tree node with a `name` and any `kwargs`.
Args:
name: A name or any other object this... |
import pytest
from .helpers import enable_trio_mode
test_text = """
import pytest
import trio
from hypothesis import given, settings, strategies
async def test_pass():
await trio.sleep(0)
async def test_fail():
await trio.sleep(0)
assert False
@settings(deadline=None, max_examples=5)
@given(strategies.... |
import os
from codesync.constants import DEFAULT_FILE_PERMISSIONS
def fix_permission(path, permission=DEFAULT_FILE_PERMISSIONS):
os.chmod(path, permission) # read/write by everyone
|
"""
Calculate the response of a star as a result of mass loss.
"""
from amuse.lab import *
Second_Asymptotic_Giant_Branch = 6 | units.stellar_type
set_printing_strategy("custom",
preferred_units = [units.MSun, units.RSun, units.Myr],
precision = 6, prefix = "",
... |
#!/usr/bin/python
#
# Copyright (c) 2009, Whispersoft s.r.l.
# 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 source code must retain the above copyright
# notice, this l... |
"""Documentation about justatest"""
import logging
from .__version__ import __version__
logging.getLogger(__name__).addHandler(logging.NullHandler())
__author__ = "John Smith"
__email__ = "yourname@esciencecenter.nl"
|
""" This module provides template tags for extra functionality
over and above the built-in Django tags.
"""
import os
from django import template
from InvenTree import version, settings
from InvenTree.helpers import decimal2string
from common.models import InvenTreeSetting, ColorTheme
register = template.Library()
... |
"""user URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/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-based vi... |
import tensorflow as tf
import numpy as np
from tommy2tommy.optimizers import radam
class RAdamTest(tf.test.TestCase):
pass
if __name__ == "__main__":
tf.test.main()
|
import _plotly_utils.basevalidators
class LineValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="line", parent_name="layout.newshape", **kwargs):
super(LineValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... |
# 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 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.