content stringlengths 5 1.05M |
|---|
# -*- coding: UTF-8 -*-
#
# Copyright (c) 2008, Yung-Yu Chen <yyc@solvcon.net>
#
# 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 copyrigh... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import pytest
import sys
import os
import json
from .scripts import get_variable_value, get_variables, get_data_frame_info, get_data_frame_rows, check_for_ipython
import imp
haveIPython = check_for_ipython()
@pyte... |
from django.contrib.auth.models import AbstractUser, UserManager
from django.db import models
from django.views.decorators.debug import sensitive_variables
from .exceptions import KerberosManagementError
class KerberosUserManager(UserManager):
@sensitive_variables("password")
def _create_user(self, username,... |
# Main file in pyaws
import config
import Configure
import MenuTemplates
def startmenu():
print("Checking 'config' file based on your config.py...")
Configure.createconfigfile(config.defaultregion)
print("Checking 'credentials' file based on your config.py...")
Configure.createcredentialsfile(config... |
import warnings
from pathlib import Path
from hangar import Repository
def init_repo(name=None, email=None, overwrite=False):
""" init hangar repo, create stock file and add details to .gitignore """
if not Path.cwd().joinpath(".git").exists():
warnings.warn(
"initializing stock repositor... |
import unittest
from unittest.mock import MagicMock
from imagekitio.client import ImageKit
from tests.dummy_data.file import SUCCESS_DETAIL_MSG
from tests.helpers import ClientTestCase, get_mocked_success_resp
imagekit_obj = ImageKit(
private_key="private_fake:", public_key="public_fake123:", url_endpoint="fake.c... |
from rest_framework import viewsets
from countries.api.serializers import CountrySerializer
from countries.models import Country
class CountryViewSet(viewsets.ModelViewSet):
queryset = Country.objects.all()
serializer_class = CountrySerializer
|
print ("_" * 80)
nome = input ("Digite o nome do aluno: ")
turma = input ("Digite a turma em que ele está: ")
n1 = float(input("Digite a primeira nota. "))
n2 = float(input("Digite a segunda nota. "))
n3 = float(input("Digite a terceira nota. "))
media = (n1 + n2 + n3)/3
if media < 5:
print('Infelizmente o a... |
"""
This library consists of four classes and one function to assist with node
server development. The classes :class:`polyglot.nodeserver_api.NodeServer` and
:class:`polyglot.nodeserver_api.SimpleNodeServer` and basic structures for
creating a node server. The class :class:`polyglot.nodeserver_api.Node` is
used as an ... |
class dotModelInfo_t(object):
# no doc
aModelName=None
aModelPath=None
aModelTemplateName=None
aServerName=None
ConnectToServer=None
ConvertBetweenSingleAndMultiuser=None
CurrentDataBaseVersion=None
CurrentPhase=None
ExcludeFromSharing=None
IsModelSaved=None
IsSharedModel=None
IsSingleUserModel=None
Mode=... |
from fractions import Fraction
from ukz.midi import Limits
class Event:
def __init__(self,t,d,c=None):
self.t = t
self.d = d
self.c = c #content
def copy(self):
return Event(self.t,self.d)
def __eq__(self,other):
return self.t == other.t \
and self.d == other.d
def s... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from .representation import Representation
from .resources import JSONResource, CSVResource
from .location import Location, IndexSlice, RangeSlice
from .preprocessing import PreprocessingFunc
from .variables import Variable
from .alignments import DimAlignment, ValueAlignment
... |
#!/usr/bin/env python3
"""
Author : Ken Youens-Clark <kyclark@gmail.com>
Date : 2019-02-04
Purpose: Emulate head
"""
import os
import sys
# --------------------------------------------------
def main():
args = sys.argv[1:]
if len(args) < 1 or len(args) > 2:
print('Usage: {} FILE [NUM_LINES]'.forma... |
"""
Perform full update of the Google sheet with local observations
@author: vandalt
"""
from argparse import ArgumentParser
import gspread_pandas as gspd
import pandas as pd
import maintenance as mtn
import utils as ut
# Set pattern to fits files
parser = ArgumentParser(description="Update the Google Sheet with ne... |
__version__ = "1.2.105"
|
# client.py
import socket
import sys
# Create a TCP/IP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Connect the socket to the port where the server is listening
server_address = ('localhost', 10000)
print('connecting to {} port {}'.format(*server_address))
sock.connect(server_address)
name = inp... |
import uuid
from django.core.validators import RegexValidator, validate_ipv4_address
from django.db import models
from django.urls import reverse
from bailiwick import regex
from . import validators
class ARecord(models.Model):
id = models.UUIDField(
primary_key=True,
unique=True,
default... |
import nixnet
from nixnet import constants
CAN_port= 'CAN5'
count = 5
print('Starting the Program')
try:
with nixnet.FrameInStreamSession(CAN_port) as input_session:
input_session.intf.can_term = constants.CanTerm.ON
input_session.intf.baud_rate = 125000
frames = input_session.f... |
from . import core, handlers
from .core import (GraphModule, current_context, has_trt_tensor,
register_node_handler, torch2trt, torch2tvm, trt_network,
tvm_network)
from .inference.inference import InferenceContext, TorchInferenceContext
from .module import (TensorRTModule, TensorR... |
#!/usr/bin/env python2
import loremipsum
def main(flag):
paragraphs = loremipsum.get_paragraphs(len(flag) + 1, True)
print('\n\n'.join('%s\r%s' % pair for pair in zip(flag, paragraphs)))
if __name__ == '__main__':
with open('flag.txt', 'r') as file:
flag = file.read()
main(flag)
|
# #
# Copyright 2007-2014 University Of Southern California
#
# 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... |
# transcation formattranscation_list
# {
# "sender": "<public-key>"
# "receiver": "<public-key>"
# "amount" : value
# }
import Blockchain
from flask import Flask
from flask import request
from flask import Blueprint
from flask import json
from flask import jsonify
from Util import ComplexEncoder... |
resistor = {'black':0, 'brown':1, 'red':2, 'orange':3, 'yellow':4, 'green': 5, 'blue':6, 'violet':7, 'grey':8, 'white':9}
first = str(resistor[input()])
if first == 0:
first = ''
second = str(resistor[input()])
if second == 0:
second = ''
answer = int(first + second)
third = 10**resistor[input()]
if answer ==... |
import uuid
from django.contrib.auth import get_user_model
from django.contrib.contenttypes.fields import (
GenericForeignKey,
GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError
from django.db import models
from django.db.models impo... |
# -*- coding:utf-8 -*-
import sys, os
reload(sys)
sys.setdefaultencoding('utf-8')
import requests
from bs4 import BeautifulSoup
def php_proxy_request(url, form_data = {}, method = "get", cookies_str = None, user_agent = None) :
cookies = {}
if cookies_str is not None :
cookies = {"Cookie": cookies_st... |
from __future__ import absolute_import
from .preprocessor import Preprocessor |
"""
Class Features
Name: drv_data_io_geo
Author(s): Fabio Delogu (fabio.delogu@cimafoundation.org)
Date: '20180521'
Version: '2.0.7'
"""
######################################################################################
# Library
import logging
import numpy as np
from os.path import ... |
import pygame
class Object:
def __init__(self, width, height, pos_x, pos_y, image_url = None):
if image_url:
self.image_surface = pygame.image.load(image_url)
self.image_url = image_url
self.width = width
self.height = height
self.size = (self.width, self.height)
self.pos_x = pos_x
self.pos_y = pos_... |
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth.models import User
from django.contrib import auth
from django.contrib.auth.decorators import login_required
from product.models import Product
from django.http import Http404
@login_required
def index(request):
if request.u... |
from typing import Optional
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_ACCESS_TOKEN
from homeassistant.core import HomeAssistant
from .exception import NoTokenException
class TokenRepository:
def __init__(self) -> None:
self._token: Optional[str] = None
... |
from __future__ import annotations
from pathlib import Path
from scry import errors
from scry.tokens import Token
from scry.tokens import TokenType
from scry.types import Type
class Lexer:
def __init__(self, file: str | Path) -> None:
self._file = Path(file) if isinstance(file, str) else file
se... |
from typing import TypeVar, Generic
from yapic.di import Inject
__all__ = ["SomeModule_A", "GenericClass"]
class SomeModule_A:
pass
class SomeModule_B:
pass
T = TypeVar("T")
class GenericClass(Generic[T]):
attr: Inject[T]
def __init__(self, x: T):
self.x_init = x
|
import os
import numpy as np
from shapely.geometry import box, Polygon
import geopandas as gpd
from ..utils.core import _check_gdf_load, _check_crs
from ..utils.tile import save_empty_geojson
from ..utils.geo import gdf_get_projection_unit
from tqdm import tqdm
class VectorTiler(object):
"""An object to tile geos... |
#!/usr/bin/env python
class Error(Exception):
""" Base Exception Class """
pass
class StopEtlPipelineWarningException(Error):
""" A warning is raised during the ETL Pipeline """
pass
class StopEtlPipelineErrorException(Error):
""" An error is raised during the ETL Pipeline """
pass
cl... |
#!/usr/bin/env python3
import os, sys, csv, argparse, time
from competitivetracker import CompetitiveTracker
from competitivetracker.exceptions import CompetitiveTrackerAPIException
def eprint(*args, **kwargs):
"""
Print to stderr - see https://stackoverflow.com/a/14981125/8545455
"""
print(*args, fil... |
'''
@author: Dallas Fraser
@date: 2016-04-12
@organization: MLSB API
@summary: The views for finding what divisions are in a given league
'''
from flask_restful import Resource, reqparse
from flask import Response
from json import dumps
from api.cached_items import get_divisions_for_league_and_year
parser = reqparse.Re... |
import importlib
import sys
from datetime import timedelta as delta
import numpy as np
import parcels
import xarray as xr
sys.path.append("/nethome/4302001/diffusion-hydro-mod/kernels")
import EM_3D_BC
import M1_3D_BC
import Markov1_3D_BC_taper
import density_elements_sampled
dt = 20*60 # seconds
inpath = "/data/oc... |
"""Quack Tests"""
|
# Word Cloud Project - Stevan Ramon
# Importando bibliotecas que serão utilizadas;
import re
from nltk.tokenize import word_tokenize
from nltk.probability import FreqDist
import wordcloud
# 1) Receber Texto como INPUT;
texto = "The indefinite article takes two forms. It’s the word a when it precedes a word tha... |
# coding: utf-8
'''A helper script to look up the names of pylint errors.'''
import sys
PYLINT_MAP = {
'C0102': 'blacklisted-name',
'C0103': 'invalid-name',
'C0111': 'missing-docstring',
'C0112': 'empty-docstring',
'C0113': 'unneeded-not',
'C0121': 'singleton-comparison',
'C0122': 'misplaced-comparison-constant... |
import json
class A:
def __init__(self):
self.prop1 = "value1"
self.prop_2 = "value_2"
self.prop3 = {"a":"a1", "b":1}
def get_prop1(self):
return self.prop1
def get_prop_2(self):
return self.prop_2
if __name__ == '__main__':
a = A()
s = json.dumps(a.__di... |
# 590. N-ary Tree Postorder Traversal
#
# Copyright (C) 2019 Sang-Kil Park <likejazz@gmail.com>
# All rights reserved.
#
# This software may be modified and distributed under the terms
# of the BSD license. See the LICENSE file for details.
class Solution:
vals: List = []
def postorder(self, root: 'Node') -> ... |
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
from bs4 import BeautifulSoup
def sanitize(text, default="No description available"):
"""
Removes all html tags but includes the href links inside the text. If no text is given then it will return
... |
import serial
arduino=serial.Serial('/dev/ttyACM0')
#arduino=serial.Serial('/dev/ttyUSB0')
print arduino
# while 1!=0:
# valore = raw_input('Inserisci una stringa:')
#arduino.write('?')
#print (arduino.read())
|
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed under the MIT License.
License for BK-BASE 蓝鲸基础平台:
---------------------------------------------... |
import base64
import pathlib
from config import GITHUB_WORKSPACE, RELEASE_FILE_PATH
from release import InvalidReleaseFileError, get_release_info
release_file = pathlib.Path(GITHUB_WORKSPACE) / RELEASE_FILE_PATH
release_info = None
status = "MISSING"
if not release_file.exists():
status = "MISSING"
else:
t... |
#!/opt/anaconda2/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
"""
################################################################################
#
# Copyright (c) 2015 Wojciech Migda
# All rights reserved
# Distributed under the terms of the MIT license
#
#############################... |
from http import HTTPStatus
from unittest.mock import patch
from django.test import TestCase
from django.urls import reverse
import factory
from faker import Faker
from rest_framework.test import APIClient
from products.models import Product
from .factories import ProductFactory
PRODUCT_ENDPOINT = reverse('produc... |
from collections import abc
from functools import wraps
from time import time
import os, errno
from numpy import float64
def nested_dict_iter(nested):
for key, value in nested.items():
if isinstance(value, abc.Mapping):
yield from nested_dict_iter(value)
else:
yield key, va... |
from .chrome import *
|
# coding: utf-8
from os import path
from zaglushka_tests import ZaglushkaAsyncHTTPTestCase, EXAMPLES_DIR, TEST_RESOURCES_DIR
RESPONSE_BODY = 'headers'
class FileBasedHeadersTestCase(ZaglushkaAsyncHTTPTestCase):
HEADERS_ISSUE11 = {'Date': 'Wed, 23 Apr 2014 06: 13: 20 GMT',
'X-GitHub-Reque... |
from flask import Flask
# Always use relative import for custom module
from .package.module import MODULE_VALUE
app = Flask(__name__)
@app.route("/")
def index():
return (
"Try /hello/Chris for parameterized Flask route.\n"
"Try /module for module import guidance"
)
@app.route("/hello/<name>... |
import os.path
import sys
import time
from shared import config
from shared import common
from shared import database
from shared import mimetype_detector as mdet
from pst_tree_reader import PstTreeReader
BATCH = 1
"""Required arguments: input_path to directory with 1+ pst files, each representing a source/custodian... |
import OpenPNM
import scipy as sp
class MolarDensityTest:
def setup_class(self):
self.net = OpenPNM.Network.Cubic(shape=[3, 3, 3])
self.phase = OpenPNM.Phases.GenericPhase(network=self.net)
self.phase['pore.molecular_weight'] = 0.0291 # kg/mol
self.phase['pore.density'] = 1.19 # ... |
from time import sleep
for x in range(2,51,2):
print(x , end=" ")
sleep(0.5)
|
import plac
from utils import dumps_jsonl, load_jsonl_file
def remove_textual_data(relation):
return {
'Arg1': relation['Arg1']['TokenList'],
'Arg2': relation['Arg2']['TokenList'],
'Connective': relation['Connective']['TokenList'],
'DocID': relation['DocID']
}
def main(relat... |
from datetime import datetime
from app import db
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(64), index=True, unique=True)
email = db.Column(db.String(120), index=True, unique=True)
password_hash = db.Column(db.String(128))
posts = db.relations... |
# -*- coding: utf-8 -*-
"""
Download Sub-Application
"""
from sage_bootstrap.download.transfer import Download
from sage_bootstrap.download.mirror_list import MirrorList
|
import os
import tools
import config
import xml.etree.ElementTree as etree
def build(root, geometries, materials_ids, links_simple, links_revert):
"""
Exports all the geometry into a folder for later use in the scene.
Return a list of ids for the geometry
"""
if config.verbose : print("shapes_builder_fbx launche... |
import json
import re
import subprocess
import time
from abc import ABC
from collections import defaultdict
from logging import getLogger
from pathlib import Path
from typing import Iterable, Tuple
import requests
from sidekick import api as sk
import fred
log = getLogger('maestro')
PYTEST_GRADE_AS_TEST_RATIO = lam... |
import numpy as np
import torchvision.transforms.functional as torchvision_fn
from PIL import Image
from torch import Tensor
def opencv_image_to_torch_tensor(image: np.ndarray) -> Tensor:
import cv2
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
image = Image.fromarray(image)
return torchvision_fn.to_... |
"""IGV Server
This app dynamically builds experiment and sample menus for IGV, using an
Airtable database. Clicking on a sample in the IGV server will load the BAM
directly from an S3 bucket (set as environment variable). AWS credentials must
be set in a format that boto3 can recognize.
The Airtable database must hav... |
from itertools import chain
from . import base
from . import manager
from . import field
from . import index
from . import errors
class Collection(base.Document):
pass
class CollectionRef(object):
def __init__(self, metadata, name):
self._metadata = metadata
self._name = name
def __ge... |
# Generated by Django 3.0.8 on 2020-08-05 12:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('boards', '0011_auto_20200517_1011'),
]
operations = [
migrations.AddField(
model_name='task',
name='due_date',
... |
# -*- coding: utf-8 -*-
"""
chebpy.cheba
============
Applications of Chebyshev spectral methods to solve PDEs.
"""
from time import time
from math import cos, acos
import numpy as np
from scipy.linalg import expm, expm2, expm3, inv
from scipy.fftpack import dst, idst, dct, idct
import matplotlib.pyplot as plt
from... |
import os
from gi.repository import GLib
from app.commons import run_idle, run_task, log
from app.connections import download_data, DownloadType, upload_data
from app.settings import SettingsType
from app.ui.backup import backup_data, restore_data
from app.ui.main_helper import append_text_to_tview
from app.ui.settin... |
"""Tests for the discrimination methods."""
from __future__ import annotations
import pytest
from sensopy.discrimination.methods import DiscriminationMethod
from sensopy.discrimination.mplusn import mplusn_mc
def test_abstract_psychometric_function():
"""Test abstract psychometric function."""
class _Cust... |
from Bio.PDB import *
from Bio.PDB import PDBParser
from Bio.PDB import Superimposer
from Bio.PDB.Atom import *
from Bio.PDB.Residue import *
from Bio.PDB.Chain import *
from Bio.PDB.Model import *
from Bio.PDB.Structure import *
from Bio.PDB.Vector import *
from Bio.PDB.Entity import *
import math
from PeptideBuilder ... |
class add(int):
def __init__(self,n):
self = n
def __call__(self,x):
return add(self+x)
|
import pytest
import os
from meltano.core.config_service import PluginAlreadyAddedException
from meltano.core.plugin import PluginType
class TestELTContext:
@pytest.fixture
def target_postgres(self, project_add_service):
try:
return project_add_service.add(PluginType.LOADERS, "target-post... |
import abc
import dataclasses
import datetime
import decimal
import enum
from typing import Optional, Text
class OptionTypes(enum.Enum):
PUT = 0
CALL = 1
@dataclasses.dataclass
class Option(abc.ABC):
"""This class defines the basic type for the backtester or live trader -- an option.
Other classes such as p... |
# must be loaded from python source file to allow
# cobra dcode module serialization :)
jquery_2_1_0 = r'''
/*!
* jQuery JavaScript Library v2.1.0
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
* Released under the MIT l... |
# -*- coding:utf-8 -*-
from bs4 import BeautifulSoup
from Queue import Queue
import urllib2, urlparse, urllib
import cookielib
import re
import os, sys
import threading
import time
import bloomfilter
def valid_filename(s):
import string
valid_chars = "-_.() %s%s" % (string.ascii_letters, string.di... |
from tucao import tucao
__author__ = 'RayYu03'
__version__ = '0.0.1'
|
from ctypes import c_int, c_float, pointer, POINTER
import numpy as np
from .load_libmatting import load_libmatting
library = load_libmatting()
# Need those types for function signatures:
c_int_p = POINTER(c_int)
c_float_p = POINTER(c_float)
# Declare function signatures
_knn = library.knn
_knn.argtypes = [
c_fl... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012 Team-XBMC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option... |
#!/usr/bin/env python3
from urllib.parse import urlparse
import requests
from bs4 import BeautifulSoup
from ecmwf.opendata import Client
url = urlparse(Client().url)
top = url.scheme + "://" + url.netloc
def crawl(url):
print(f"{top}{url}")
r = requests.get(f"{top}{url}")
r.raise_for_status()
soup ... |
#https://api.elsevier.com/content/search/scopus?query=DOI(10.1016/j.stem.2011.10.002)+OR+DOI(10.1098/rsbl.2011.0293)&field=citedby-count,prism:doi&apiKey=7f59af901d2d86f78a1fd60c1bf9426a
import requests
from pprint import pprint
import xml.etree.ElementTree as ET
from pathlib import Path
def getxml(doi, path):... |
# Generated by Django 3.1.7 on 2021-03-05 10:06
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... |
# Generated by Django 2.0.8 on 2018-09-26 20:57
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(se... |
#!/usr/bin/python
from SMDS.method import Method
from SMDS.mdserver import *
from SMDS.user import *
from SMDS.parameter import *
from SMDS.auth import Auth
from SMDS.faults import *
from SMDS.filter import *
class GetUsers( Method ):
"""
Get a list of users
"""
accepts = [
Auth(),
F... |
import xbmc
import xbmcvfs
import xbmcgui
import datetime
import time
import resources.lib.utils as utils
from resources.lib.croniter import croniter
from resources.lib.backup import XbmcBackup
class BackupScheduler:
monitor = None
enabled = "false"
next_run = 0
next_run_path = None
restore_point =... |
#!/usr/bin/python3
import io
import re
GROUPS = {
'Smileys & People': 'smileys',
'Animals & Nature': 'animals',
'Food & Drink': 'food',
'Travel & Places': 'travel',
'Activities': 'activities',
'Objects': 'objects',
'Symbols': 'symbols',
'Flags': 'flags'
}
class Builder(object):
de... |
import setuptools
import numpy
try:
from Cython.Build import cythonize
HAS_CYTHON = True
except ImportError:
HAS_CYTHON = False
extensions = [setuptools.Extension('zplib.image._sample_texture',
sources = ['zplib/image/_sample_texture.' + 'pyx' if HAS_CYTHON else 'c'],
inclu... |
from systems.models.index import ModelFacade
class HostFacade(ModelFacade('host')):
def get_field_token_display(self, instance, value, short):
if value and short:
return super().get_field_token_display(instance, value[:10] + '...', short)
return super().get_field_token_display(instanc... |
#!/usr/bin/env python3
hrs = input("Enter Hours:")
hrs_number = float(hrs)
rate = input("Enter rate per hour:")
base_rate = float(rate)
extra_rate = 1.5*base_rate
if hrs_number <= 40:
print(str(hrs_number*base_rate))
else:
extra_hrs_number = hrs_number - 40
print(str(extra_hrs_number*extra_rate + 40*base_r... |
from .full_output import *
|
from __future__ import print_function
import sys
# import iroha library from nested folder
sys.path.insert(0, 'build/shared_model/bindings')
import iroha
import time
import block_pb2
import endpoint_pb2
import endpoint_pb2_grpc
import queries_pb2
import grpc
tx_builder = iroha.ModelTransactionBuilder()
query_builder... |
import os
import json
import re
import gzip
import StringIO
import netrc
import urllib
import urllib2
import time
import arcpy
import numpy as np
try:
from PIL import Image # get pillow from here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pillow
except ImportError:
raise arcpy.ExecuteError("Python module P... |
import pytest
from tests.integration import login
from tests.integration.server import FlaskTestServer
from warehouse14 import create_app
@pytest.fixture
def server(tmpdir, db, storage, authenticator):
app = create_app(
db,
storage,
authenticator,
restrict_project_creation=["admin... |
a=[]
arr=[]
def assign(n):
for i in range (0,n):
a.append(i+1)
def printIt(i,n):
if i==n:
string=""
for j in range(0,n):
string=string+str(a[j])
arr.append(string)
else:
for j in range(i,n):
a[i],a[j]=a[j],a[i]
printIt(i+1,n)
a[i],a[j]=a[j],a[i]
t=int(raw_input())
for i in range(0,t):
n=int(ra... |
from opentrons import protocol_api
import json
import os
import math
# metadata
metadata = {
'protocolName': 'V1 Station Prep SARS CoV2 MagMax',
'author': 'Ricmag <ricmags@sapo.pt>',
'source': 'Custom Protocol Request',
'apiLevel': '2.3'
}
NUM_SAMPLES = 32
BB_VOLUME = 275
ICPK_VOlUME = 10
TIP_TRACK = ... |
# -*- coding: utf8 -*-
"""
Functions used for generating hippocampal like spike trains (inhomogeneous Poisson process)
Setup: many repetitions on a circular track or (mapped) linear [0, 2pi] track
authors: András Ecker, Eszter Vértes, Szabolcs Káli last update: 10.2018
"""
import numpy as np
f_theta = 7.0 # theta o... |
# This example code is in the Public Domain (or CC0 licensed, at your option.)
# Unless required by applicable law or agreed to in writing, this
# software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied.
# -*- coding: utf-8 -*-
from __future__ import pri... |
# -*- coding: utf-8 -*-
# Copyright (C) 2015-2016 Tim Langeman and contributors
# <see AUTHORS.txt file>
#
# This library is part of the Neotext project:
# http://www.neotext.net/
# The code for this server library is released under the MIT License:
# http://www.opensource.org/licenses/mit-license
from bs4 import Bea... |
from django.shortcuts import render
# Create your views here.
from django.http import request
from django.shortcuts import render,redirect
from django.contrib.auth.forms import UserCreationForm
from .models import Profile,NeighbourHood,Business
from .forms import CreateUserForm, UserUpdateForm, ProfileUpdateForm,Pos... |
#!/usr/bin/env python
# encoding: utf-8
'''
@author: zst
@file: Locatation_curve_prediction.py
@date 2019-09-18 15:59
@desc:
'''
import numpy as np
from sklearn.preprocessing import PolynomialFeatures
import joblib
def prediction(LactationNumber, database):
# 305预测
X = np.arange(1, 306)[:, np.newaxis]
... |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modif... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pony.orm import *
from core.data import ProxyItem
from datetime import datetime, timedelta
import logging
class Plugin():
def start(self, hosting):
logging.debug('local plugin running...')
with db_session:
if not exists(x for x in Proxy... |
import fire
from flask import Flask, jsonify, request
from flask_cors import CORS
from flask_restful import Resource, Api
from graph_knn import load_entity_knn, load_multi_knn
class Knn(Resource):
def __init__(self, **kwargs):
self.knn = kwargs['knn']
def post(self):
json_data = request.get_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.