text stringlengths 2 999k |
|---|
import os
def log_check_call(command, stdin=None, env=None, shell=False, cwd=None):
status, stdout, stderr = log_call(command, stdin, env, shell, cwd)
if status != 0:
from subprocess import CalledProcessError
raise CalledProcessError(status, ' '.join(command), '\n'.join(stderr))
return stdout
def log_call(co... |
import os
import collections
from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor
from sklearn.linear_model import (LinearRegression, SGDClassifier,
RidgeClassifierCV, ARDRegression,
BayesianRidge)
MODELS_TYPE_DICT = {'RandomFore... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import logging
from builtins import str
from rasa_core import utils
from rasa_core.agent import Agent
from rasa_core.channels.console import ConsoleInpu... |
"""
Django settings for running tests for rolca-core package.
"""
import os
from django.utils.translation import gettext_lazy as _
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
SECRET_KEY = 'secret'
DEBUG = True
MIDDLEWARE = [
'django.contrib.sessions.middleware.SessionMiddleware',
'django.mid... |
import tarfile
from . import *
class TestUserArgs(IntegrationTest):
def __init__(self, *args, **kwargs):
super().__init__(os.path.join(examples_dir, '12_custom_args'),
configure=False, *args, **kwargs)
def _check_help(self, args):
output = self.assertPopen(args)
... |
# Create your views here.
from crons.models import Entry, Cronjob
from django.template import RequestContext
from django.shortcuts import get_object_or_404, render_to_response
from django.http import HttpResponseRedirect, HttpResponse
from django.core.urlresolvers import reverse
from django.core.exceptions import Vali... |
import json
import requests
import xmltodict
from odp.lib.exceptions import MediaRepositoryError
class MediaRepoClient:
def __init__(
self,
media_repo_url: str,
username: str,
password: str,
):
self.media_repo_url = media_repo_url
self.username... |
import discord
from random import seed
from random import randint
def wow(received):
seed()
selector = randint(1, 5)
if selector == 1:
embed = discord.Embed(
color=discord.Colour.random(),
title='✧・゚: *✧・☆Wow!☆・゚✧*:・゚✧',
... |
#!/usr/bin/env python3
# Copyright (c) 2014-2018 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 the invalidateblock RPC."""
import time
from test_framework.test_framework import SinTestFramewo... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from torch.autograd import Variable
from onnx import numpy_helper
import io
import onnx
import os
import shutil
import torch
import traceback
import test_onnx_common
fr... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('modoboa_public_api', '0001_initial'),
]
operations = [
migrations.AddField(
model_n... |
"""Single target interactions."""
from .._tool import Tool
class SingleTarget(Tool):
"""Class to represent single target interactions."""
BASE_COMMAND = "run" # This will prolly need to dynamic
def connect_to_host(self: object, aid: str):
"""Initialize a RTR session with the host matching the A... |
{'application':{'type':'Application',
'name':'Template',
'backgrounds': [
{'type':'Background',
'name':'bgTemplate',
'title':'Standard Template with File->Exit menu',
'size':(451, 362),
'style':['resizeable'],
'menubar': {'type':'MenuBar',
'men... |
# Copyright 2021, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... |
from threading import Thread
import subprocess,shlex,os
def bet_T1(in_file):
cmd = 'bet '+in_file+ '.nii '+in_file+'_brain.nii '+\
'-R -f 0.55 -g 0'
print cmd
env = os.environ.copy()
task = shlex.split(cmd)
subprocess.call(task, env=env)
def bet_T2(in_file):
cmd = 'bet '+in_file+ '.nii... |
import os
import pandas as pd
import numpy as np
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'trp_assistant_bot.settings')
import django
from django.core import exceptions
django.setup()
from open_course.models import Teacher, Assistant, Classroom
class GenerateFakeData:
@classmethod
def generate_fake_email(self... |
__version__ = '2.0.13'
|
{
"targets": [{
"target_name": "sleep",
"sources": ["src/sleep.cc"],
"include_dirs": [
"<!(node -e \"require('nan')\")"
],
"cflags": ["-std=c++11"]
}]
}
|
# -*- coding: utf-8 -*-
__author__ = """Xinyang Li"""
__email__ = 'xinyang.li@rochester.edu'
__version__ = '0.1.0'
|
from eth_hash.auto import keccak
import rlp
from eth.rlp.logs import Log
def hash_log_entries(log_entries):
"""
Helper function for computing the RLP hash of the logs from transaction
execution.
"""
logs = [Log(*entry) for entry in log_entries]
encoded_logs = rlp.encode(logs)
logs_hash =... |
# Copyright 2013 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 ag... |
import pygame
import math
import random
import sys
#COLORS
RED = (255,0,0)
GREEN = (0,255,0)
BLUE = (0,0,255)
PURPLE = (255,0,255)
CYAN = (0,255,255)
YELLOW = (255,255,0)
width = 800
height = 500
screen = pygame.display.set_mode((width,height))
clock = pygame.time.Clock()
def CalculateGravitationalPull(mass,xS,yS,x... |
import os
import sys
# sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)), '../..'))
sys.path.insert(
0,
os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))))
# from model_with_split import ModelSplit
from model import Model
from config.path import subdirs5resultd... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: resembla.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _refl... |
from payex.handlers import BaseHandler
class PxOrderHandler(BaseHandler):
"""
Base handler for PxOrder methods.
"""
production_url = 'https://external.payex.com/pxorder/pxorder.asmx?WSDL'
testing_url = 'https://test-external.payex.com/pxorder/pxorder.asmx?WSDL'
def __call__(self, *args, **kwa... |
#!/usr/bin/env python3
import os
import re
import sys
script_dir = os.path.dirname(__file__)
directory_to_check = os.path.join(script_dir, "../book/content/")
def remove_comments(text_string):
"""Function to omit html comment identifiers in a text string using
regular expression matches
Arguments:
text_st... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 18 09:23:26 2017
@author: Mostafa Hammoud
This function uses the interval, segment, and value to get the current health
of the user.
Every Heart beat will have a corresponding warning associated with it.
If it is a normal heart beat the warninig will be []
"""
import n... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
"""
@file : const.py
@Time : 2020/10/30 17:29
@Author: Tao.Xu
@Email : tao.xu2008@outlook.com
"""
from config.global_settings import *
# --- set/get: Global const keys/values
_global_dict = {}
def set_value(key, value):
global _global_dict
_global_dict[key] = val... |
# Copyright 2014-2016 OpenMarket Ltd
# Copyright 2018 New Vector 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 ... |
import setuptools
from codecs import open
from os import path
import numpy as np
# set the command line scripts
entry_points = {'console_scripts': [
'tresmerge-process = tresmerge.process:main'
]}
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="tresmerge",
... |
import os
import sys
import glob
import math
import socket
import numpy as np
from collections import Counter
from utils import utils
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
from torch.optim.lr_scheduler import LambdaLR
from torch.autograd imp... |
# GPL 2.0
#
# written by Gregg Rice, gmr@unc.edu, rice.gregg@gmail.com
# copywrite 2013-2015
# all rights reserved
#
##################################################################################
# render one or two CT secondary structures with helices shown as semicircular arcs
# This simple version of the script... |
# # ⚠ Warning
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
# LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIA... |
import random
import operator
class Turkey(object):
def __init__(self, maze, alpha=0.5, gamma=0.9, epsilon0=0.3):
self.maze = maze
self.valid_actions = self.maze.valid_actions
self.state = None
self.action = None
# Set Parameters of the Learning Turkey
self.alpha ... |
#!/usr/bin/env python3
from discord.permissions import permission_alias
import requests
from urllib.parse import urlsplit, parse_qs
import base64
import time
import json
from datetime import datetime
class MYGES:
def __init__(self, discordid, username=None, password=None):
self.actionurl = "https://api.ko... |
"""
Tapers
======
This example shows how to create some basic tapers in 1d, 2d, and 3d
using the :py:mod:`pylops.utils.tapers` module.
"""
import matplotlib.pyplot as plt
import pylops
plt.close('all')
############################################
# Let's first define the time and space axes
par = {'ox':-200, 'dx':2, ... |
#*****************************************************************************
#
# Project: Contour Trimming
# Purpose: Identify short-length contours that are peaks, not spurious and
# annoying contours left over from high-res source DEM
# Author: Jacob Adams, jacob.adams@cachecounty.org
#
#*******... |
#!/usr/bin/python3
__version__ = '0.0.7' # Time-stamp: <2021-08-16T23:19:38Z>
## Language: Japanese/UTF-8
"""Simulation Buddhism Prototype No.2 - Initialize
初期化ルーチン
"""
##
## Author:
##
## JRF ( http://jrf.cocolog-nifty.com/statuses/ (in Japanese))
##
## License:
##
## The author is a Japanese.
... |
class Project:
def __init__(self):
self.projectId = None # type: int
self.projectName = None # type: str
self.taskList = None # type: list[Task]
def __str__(self):
return f"[id: {self.projectId}, name: {self.projectName}, taskList: {self.taskList}]" |
import unittest
import os
from mock import call, patch
from plugins import music
from CmdInterpreter import JarvisAPI
from tests import PluginTest, MockHistoryBuilder
class MusicTest(PluginTest):
def setUp(self):
self.music = self.load_plugin(music.play)
self.song_name = 'torero chayanne'
d... |
#!/usr/bin/env python2.7
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Simple module to implement a build-local cache."""
import logging
import os
BUILD_PATH = os.path.abspath(os.path.join(os.path.d... |
from typing import List
import numpy as np
from scipy.spatial import distance_matrix
from itertools import count
import networkx as nx
from .point import Point
class Cluster:
"""
Represents a cluster of points.
"""
_id = count()
def __init__(self, points: List[Point]):
self.id = next(s... |
from pathlib import Path
from typing import Callable
from pytest import Testdir, RunResult
import pytest
import sys
def test_cli_start_is_fast(testdir: Testdir):
"""
Checks that a call to ``rasa --help`` does not import any slow imports.
If this is failing this means, that a simple "rasa --help" command... |
list1 = [0,1,2,4,3,20,6,79,60,78,62,151,7,14,31,45,32,47,95,113,146,166,148,189,8,81,33,116,34,117,96,181,150,211,152,212,16,165,67,164,69,188,123,226,196,255,197,256,101,121,138,198,140,216,225,266,239,278,253,281,104,179,142,200,144,209,227,267,250,286,251,287,5,9,10,115,11,18,93,111,12,97,94,218,21,178,206,261,108,2... |
import datetime as dt
import os
from base64 import b64encode
from functools import wraps
from typing import Optional
import pytz
from firestore_ci import FirestoreDocument
from flask import flash, redirect, url_for, render_template, request, current_app, Response, make_response
from flask_login import UserMixin, curre... |
# Copyright 2009-2017 Ram Rachum.
# This program is distributed under the MIT license.
'''
Defines the `ContextManager` and `ContextManagerType` classes.
Using these classes to define context managers allows using such context
managers as decorators (in addition to their normal use) and supports writing
context manag... |
"""
ASGI config for dynomonitor 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.0/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_S... |
import os
import numpy as np
from cg_openmm.parameters.reweight import *
import matplotlib.pyplot as plt
from openmmtools.multistate import MultiStateReporter
from openmmtools.multistate import ReplicaExchangeAnalyzer
import pymbar
from pymbar import timeseries
from scipy import interpolate
from sklearn.utils import re... |
from clients.AbstractClient import AbstractClient
import config
class QuickstepClient(AbstractClient):
def __init__(self):
raise Exception("Quickstep Client Not Implemented")
def execute(self, query_text):
raise Exception("Quickstep Client Not Implemented")
def _result_to_string(self):
... |
#!/usr/bin/env python
import random
import string
import sys
N = int(sys.argv[1])
print('[\"default\",', end='');
def print_tag():
print('\"', end='')
print(''.join(random.choices(string.ascii_lowercase + string.ascii_uppercase + string.digits, k=8)), end='')
print('\"', end='')
for i in range(1,N-1):
... |
import pathlib
import xml.etree.ElementTree
def load_constants(constants_xml_path=None):
"""
Load known constants from an XML file. Returns a dict() mapping constant values to strings.
"""
if constants_xml_path is None:
constants_xml_path = pathlib.Path(__file__).parent / "data" / "constants.... |
import hashlib
import re
from sqlalchemy.exc import IntegrityError
from atst.database import db
from atst.domain.exceptions import AlreadyExistsError
def first_or_none(predicate, lst):
return next((x for x in lst if predicate(x)), None)
def getattr_path(obj, path, default=None):
_obj = obj
for item in... |
#!/usr/bin/env python
"""
Main training workflow
"""
from __future__ import division
import argparse
import glob
import os
import random
import signal
import time
import torch
#from pytorch_pretrained_bert import BertConfig
from transformers import BertConfig
import distributed
from models import data_loader, mo... |
import argparse
import logging
import os
import pathlib
import time
from logging import handlers
from watchdog.events import FileSystemEventHandler
from watchdog.observers import Observer
from sync import synchronize
log = logging.getLogger(__name__)
MOUNT_PREFIX = "Panono"
DEFAULT_LOG_DIRECTORY = "./logs"
class ... |
#!/usr/bin/env python
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import fnmatch
import glob
import os
import re
import sys
from setuptools import setup
from setuptools.extension import Extension
# Need a recursive glob to find all package data files if there are
# subdirectories. Doesn't exist ... |
import asyncio
import collections
import logging
import os
import threading
import time
import unittest
from integration_tests.env_variable_names import (
SLACK_SDK_TEST_CLASSIC_APP_BOT_TOKEN,
SLACK_SDK_TEST_RTM_TEST_CHANNEL_ID,
)
from integration_tests.helpers import async_test
from slack_sdk.rtm import RTMCl... |
"""
Author: Guanghan Ning
Date: August, 2019
Adapted from the official Pytorch implementation:
https://github.com/xingyizhou/CenterNet
Homage to [PyTorch to Mxnet cheetsheet]:
https://gist.github.com/zhanghang1989/3d646f71d60c17048cf8ad582393ac6c
"""
from __future__ import absolute_import
import mxnet
from mxnet i... |
import numpy
from tools.numpy_tools import ndarray_auto_extending_assign, str_highlight_value
dots = []
fold_instructions = []
with open("13.input.txt", "r") as f:
state = 'dots'
for line in f.readlines():
line = line.strip()
if state == 'dots':
if line == "":
state... |
__all__ = ["Result", "Results"]
from abc import ABCMeta, abstractmethod
from java.lang import Object
class Result(ABCMeta):
@abstractmethod
def getDisplayPath(cls):
pass
@abstractmethod
def getPath(cls):
pass
@abstractmethod
def getType(cls):
pass
@abstractmeth... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
__author__ = 'Richard J. Sears'
VERSION = "0.6 (2021-04-22)"
### Simple python script that helps to move my chia plots from my plotter to
### my nas. I wanted to use netcat as it was much faster on my 10GBe link than
### rsync and the servers are secure so I wrote this scri... |
# 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... |
"""
Visualizations
--------------
Helper functions to visualize results of ABCSMC runs.
"""
import numpy as np
from .transition import MultivariateNormalTransition, silverman_rule_of_thumb
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
def kde_1d(df, w, x, xmin=None, xmax=None, numx=50):
... |
from linsys import LinearSystem
from plane import Plane
from vector import Vector
p1 = Plane(normal_vector=Vector(['0.786','0.786','0.588']), constant_term='-0.714')
p2 = Plane(normal_vector=Vector(['-0.138','-0.138','0.244']), constant_term='0.319')
s = LinearSystem([p1,p2])
print s
tf = s.compute_rref()
print tf
p =... |
# 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... |
"""Tests for Renault sensors."""
from unittest.mock import patch
import pytest
from renault_api.kamereon import exceptions
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
from homeassistant.const import ATTR_ICON, STATE_UNAVAILABLE, STATE_UNKNOWN
from homeassistant.core import HomeAssistant
from ... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import logging
import numpy as np
import torch
from torch import nn
from detectron2.structures import ImageList
from detectron2.utils.events import get_event_storage
from detectron2.utils.logger import log_first_n
from ..backbone import build_back... |
import numpy as np
from skimage._shared.testing import assert_equal, assert_almost_equal
from skimage.feature import ORB
from skimage._shared import testing
from skimage import data
from skimage._shared.testing import test_parallel, xfail, arch32
img = data.coins()
@test_parallel()
def test_keypoints_orb_desired_no... |
"""
Licensing
Copyright 2020 Esri
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
di... |
import unittest
from util import *
class HexTests(unittest.TestCase):
def test_hex_to_bytes(self):
LEN = 4
buf, buf_len = make_cbuffer('00' * LEN)
for i in range(256):
for s in ("%02X" % i, "%02x" % i): # Upper/Lower
ret, written = wally_hex_to_bytes(utf8(s * L... |
import time
import PySide2.QtCore as QtCore
from data_manager import DataStore
import network
class Thread(QtCore.QThread):
done_setup = QtCore.Signal()
login_status = QtCore.Signal(str)
def __init__(self, is_first_time):
super().__init__()
self.is_first_time = is_first_time
def e... |
"""
Batch Discriminative Reward
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import time
import misc.utils as utils
from collections import OrderedDict
import torch
from torch.autograd import Variable
import sys
def array_to_str(a... |
# Copyright (c) 2021 NVIDIA CORPORATION & 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... |
# -*- coding: utf-8 -*-
#
# pyramid documentation build configuration file, created by
# sphinx-quickstart on Wed Jul 16 13:18:14 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't picklea... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, 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 cop... |
"""POLLEN Dataset Classes
Original author: Francisco Massa
https://github.com/fmassa/vision/blob/voc_dataset/torchvision/datasets/voc.py
Updated by: Ellis Brown, Max deGroot
"""
import os.path as osp
import pickle
import cv2
import numpy as np
import torch
import torch.utils.data as data
from .config import HOME
P... |
import os.path as osp
from .builder import DATASETS
from .custom import CustomDataset
@DATASETS.register_module()
class ChaseDB1Dataset(CustomDataset):
"""Chase_db1 dataset.
In segmentation map annotation for Chase_db1, 0 stands for background,
which is included in 2 categories. ``reduce_zero_label`` is... |
class Solution:
def searchInsert(self, nums: list[int], target: int) -> int:
for i in range(len(nums)):
if target not in nums:
if target > max(nums):
return nums.index(max(nums)) + 1
elif target < nums[i]:
return i
... |
#expand tabs
s1 = '123\trstuv\t56780'
print(s1) # -- ET1
print(s1.expandtabs()) # -- ET2
print(s1.expandtabs(2)) # -- ET3
print(s1.expandtabs(3)) # -- ET4
print(s1.expandtabs(4)) # -- ET5
print(s1.expandtabs(5)) # -- ET6
print(s1.expandtabs(6)) # -- ET7
|
from discord.ext import commands
import modules.config as cfg
from match.classes import Match
from classes import Base
class MatchesCog(commands.Cog, name='matches'):
"""
Matches cog, handle the user commands in matches channels
"""
def __init__(self, client):
self.client = client
async ... |
#MenuTitle: Green Blue Manager
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
from builtins import str
__doc__="""
Define an angle above which a node will be set to blue, below which it will be set to green.
"""
import vanilla
from math import degrees, atan2
from Foundation i... |
def foregone(n):
i = 0
result = 0
while(n>0):
if n % 10 == 4:
result += 10**i
i += 1
n //= 10
return result
if __name__ == '__main__':
testnum = int(input())
for test in range(testnum):
n = int(input())
result = foregone(n)
... |
import pytest
import vqgan_clip.generate
from vqgan_clip import esrgan
import os
import vqgan_clip._functional as VF
import glob
from vqgan_clip import video_tools
TEST_DATA_DIR = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
'test_files',
)
SMALL_IMAGE_PNG = os.path.join(TEST_DATA_DIR,'smal... |
# Generated by Django 2.2.3 on 2019-08-16 11:17
import core.model_fields
import core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('great_international', '0068_auto_20190815_1210'),
]
operations = [
migrations.AddField(
... |
import os
import sys
import argparse
import ConfigParser
from alerta.common.utils import Bunch
CONF = Bunch() # config options can be accessed using CONF.verbose or CONF.use_syslog
prog = os.path.basename(sys.argv[0])
DEFAULTS = {
'config_file': '/etc/alerta/alerta.conf',
'timezone': 'Europe/London', # A... |
import cpseg_functions as cps
import numpy as np
import pandas as pd
from PIL.Image import fromarray
from skimage.measure import label, regionprops_table
from skimage.morphology import disk, remove_small_objects, skeletonize
from skimage.segmentation import clear_border
from skimage.metrics import mean_squared_error,... |
#!/usr/bin/env python
from appkit.api.v0_2_4 import App
import codecs
app = App(__file__)
@app.route('^/$')
def index():
html = codecs.open('ui.html', 'r', encoding='utf8').read()
return html
@app.route('/test/(.+)/(.+)/')
def test(text1=None, text2=None):
return ('<h1>' + text1 + ' ' + text2 + '</h1>'... |
#
# Copyright 2016 GoPro Inc.
#
# 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 ... |
from builtins import range
from builtins import object
import numpy as np
from ..layers import *
from ..layer_utils import *
class TwoLayerNet(object):
"""
A two-layer fully-connected neural network with ReLU nonlinearity and
softmax loss that uses a modular layer design. We assume an input dimension
... |
from io import BytesIO
from pickle import loads, dumps
from autogoal.datasets import dummy
from autogoal.grammar import generate_cfg, DiscreteValue, CategoricalValue
from autogoal.kb import *
from autogoal.ml import AutoML
from autogoal.search import RandomSearch
from autogoal.utils import nice_repr
@nice_repr
class... |
"""
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 2.2.24.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os
#... |
from ansible import playbook, callbacks
import logging
import pprint
class LoggingCallbacks(callbacks.PlaybookCallbacks):
def log(self, level, msg, *args, **kwargs):
logging.log(level, msg, *args, **kwargs)
def on_task_start(self, name, is_conditional):
self.log(logging.INFO, 'task: {0}'.form... |
#! /usr/bin/env python
"""
# -----------------------------------------------------------------------
# encoding: utf-8
# DIAMOnD.py
# Joerg Menche, Susan D. Ghiassian
# Last Modified: 2020-22-09
# This code runs the DIAMOnD algorithm as described in
#
# A DIseAse MOdule Detection (DIAMOnD) Algorithm derived from a
# ... |
#!/usr/bin/env python3
"""
Usage:
dev <command> [-- <extra_args>...]
dev cd [<repository>]
dev clone <repository_or_url>
dev init <shell>
dev open <target>
dev update
dev [-hvct]
Options:
-h, --help Show this screen
-v, --version Show version
-c, --commands List all commands
-t, --task... |
import math
from PyTCI.models.base import Three
class Dexmed(Three):
""" base class for demedetomidine"""
pass
class Hannivoort(Dexmed):
def __init__(self, weight: int):
""" 3 compartment dexmedetomidine Pk model
Units:
weight(kg)
Reference:
Hannivoort, L, et a... |
"""
>>> getRootFolder()["manfred"] = Mammoth()
>>> from zope.testbrowser.wsgi import Browser
>>> browser = Browser()
>>> browser.handleErrors = False
Form variables such as GET parameters are dispatched to arguments of
the render() method, should the method choose to take them:
>>> browser.open("http://loc... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'profile_project.settings')
try:
from django.core.management import execute_from_command_line
exc... |
# coding: utf-8
# /*##########################################################################
# Copyright (C) 2016-2019 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to dea... |
# Copyright 2018 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... |
# Copyright 2011 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... |
# --------------
# Importing header files
import numpy as np
import warnings
warnings.filterwarnings('ignore')
#New record
new_record=[[50, 9, 4, 1, 0, 0, 40, 0]]
#Reading file
data = np.genfromtxt(path, delimiter=",", skip_header=1)
census=np.concatenate((data,new_record))
age=census[:,0]
max_age... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.