text stringlengths 2 999k |
|---|
# write_Crosswalk_UDSA_CoA_Cropland.py (scripts)
# !/usr/bin/env python3
# coding=utf-8
# ingwersen.wesley@epa.gov
"""
Create a crosswalk linking the downloaded USDA_CoA_Cropland to NAICS_12. Created by selecting unique Activity Names and
manually assigning to NAICS
NAICS8 are unofficial and are not used again after ... |
#!/usr/bin/env python3
from setuptools import setup
__version__ = '0.0.1'
setup(name='mdec-jeb',
version=__version__,
description='mdec-jeb',
packages=['mdecjeb'],
install_requires=['mdec-base'],
python_requires='>=3.6'
)
|
# 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 ... |
# coding: utf-8
# # Download Publicly Available Neutrophil Dataset
#
# **Gregory Way, 2018**
#
# Here, I download [GSE103706](https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE103706) which is associated with [Rincon et al. 2018](https://doi.org/10.1186/s12864-018-4957-6).
#
# This dataset includes two acute m... |
import os
import math
import numpy as np
from PIL import Image
import skimage.transform as trans
import cv2
import torch
from data import dataset_info
from data.base_dataset import BaseDataset
import util.util as util
dataset_info = dataset_info()
class CasiaDataset(BaseDataset):
@staticmethod
def modify_comm... |
from pathlib import PurePath
import mptt
from django.db import migrations
from datahub.core.migration_utils import load_yaml_data_in_migration
def load_services(apps, schema_editor):
load_yaml_data_in_migration(
apps,
PurePath(__file__).parent / '0011_update_services.yaml'
)
def rebuild_tre... |
# -*- coding: utf-8 -*-
# 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... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from .base import BasePolicy, AttachedPreparationMixin, ForwardActionGeneratorMixin, AbstractActionGenerator
from .update import ContainerUpdateMixin
from .utils import is_initial
from .simple import (SimpleCreateMixin, SimpleStartMixin, SimpleStopMixin, ... |
import torch
from torch import nn
import torch.nn.functional as F
from models.attention import ChannelAttention
class AttConvBlock(nn.Module):
def __init__(self, in_chans, out_chans, use_att=True, reduction=16, use_gap=True, use_gmp=True):
super().__init__()
self.in_chans = in_chans
self.... |
import torch
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
from train_utils.util_functions import *
# -------------------------------------------------
# Reference Equations
# -------------------------------------------------
# Output height = (Input height + padding height top + ... |
# Copyright 2018 Amazon.com, Inc. or its 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
from __future__ import with_statement
import hashlib
import threading
import time
import weakref
from pyramid.threadlocal import get_current_request
from pyramid_debugtoolbar.compat import json
from pyramid_debugtoolbar.compat import bytes_
from pyramid_debugtoolbar.compat import url_quote
from pyramid_debugtoolbar.... |
# should work with both python2 and python3
def findSingleton(sList):
""" Returns entries that only occured once in list """
# Count dict is used for storing if we've seen a element
# and how many times it occured
count_dict = {}
# Single dict is used for storing which elements we've seen only onc... |
# coding: utf-8
"""
convertapi
Convert API lets you effortlessly convert file formats and types. # noqa: E501
OpenAPI spec version: v1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import cloudmersive_convert_api_... |
import binascii
import brownie
from scripts.const import (
GIF_RELEASE,
REGISTRY_CONTROLLER_NAME,
REGISTRY_NAME,
)
from scripts.util import (
h2s,
s2b32,
)
def test_registry_release(registry, owner):
assert GIF_RELEASE == h2s(registry.getRelease({'from': owner}))
def test_re... |
# Copyright 2018 University of Groningen
#
# 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 i... |
from numpy import random
def round_params(self):
'''Picks the paramaters for a round based on the available
paramater permutations using the param_log index'''
# pick the permutation for the round
if self.search_method == 'random':
_choice = random.choice(self.param_log)
elif self.searc... |
import time
import os
import bluesky.plan_stubs as bps
import bluesky_darkframes
import bluesky_darkframes.sim
from bluesky.plans import count
from event_model import RunRouter
from ophyd.sim import NumpySeqHandler
import pytest
from suitcase.tiff_series import Serializer
# This is some simulated hardware for demo p... |
import pytest
from numpy.testing import assert_allclose
import numpy as np
import scipy.sparse as sparse
from keras import backend as K
from keras.backend import theano_backend as KTH, floatx, set_floatx, variable
from keras.backend import tensorflow_backend as KTF
from keras.utils.conv_utils import convert_kernel
d... |
#!/usr/bin/env python
import os
import readline
from pprint import pprint
from flask import *
from app import *
os.environ['PYTHONINSPECT'] = 'True' |
# This file is part of the pyMOR project (https://www.pymor.org).
# Copyright pyMOR developers and contributors. All rights reserved.
# License: BSD 2-Clause License (https://opensource.org/licenses/BSD-2-Clause)
from pymor.core.config import config
config.require('VTKIO')
from pathlib import Path
import meshio
fro... |
import pytest
from assertpy import assert_that
def test_page_screenshot_capturing_on(configuration):
assert_that(
configuration(page_screenshot_capturing=True).page_screenshot_capturing
).is_true()
def test_page_screenshot_capturing_off(configuration):
assert_that(configuration(page_source_captu... |
# coding: utf-8
import re
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class UpdateCloudServiceCustomPolicyRequest:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_... |
#
# Autogenerated by Thrift
#
# DO NOT EDIT
# @generated
#
import enum
import folly.iobuf as _fbthrift_iobuf
import fbcode.thrift.py3lite.types as _fbthrift_py3lite_types
import fbcode.thrift.py3lite.exceptions as _fbthrift_py3lite_exceptions
class SimpleException(metaclass=_fbthrift_py3lite_exceptions.GeneratedEr... |
__author__ = 'alanseciwa'
'''
This code removes b' characters from utf-8 formatted tweets. This allows tweets to have hex values
of emojis used in tweets. After stripping away the unwanted characters, it is outputted to a new
cvs file.
'''
import sys
import csv
def clean(t):
# set csv file to variable
csv... |
from app.main import main
from app.minor import minor
from app.auth import auth
router_list = [
main,
minor,
auth
]
|
# -*- coding: utf-8 -*-
# Listing_23-10.py
# Copyright Warren & Csrter Sande, 2013
# Released under MIT license http://www.opensource.org/licenses/mit-license.php
# Version $version ----------------------------
# Szalone Ăłsemki - tura komputera
# Zwróć uwagę, że to nie jest kompletny program. Aby utowrzyć k... |
z test.test_json zaimportuj PyTest, CTest
klasa JSONTestObject:
dalej
klasa TestRecursion:
def test_listrecursion(self):
x = []
x.append(x)
spróbuj:
self.dumps(x)
wyjąwszy ValueError:
dalej
inaczej:
self.fail("didn't podnieś ValueEr... |
from create_milp_dict import create_problem_dict
from uc_model import solve_milp, solution_to_schedule
from rl4uc.rl4uc.environment import make_env
import numpy as np
import pandas as pd
def test_kazarlis():
"""Kazarlis 1996 problem"""
demand = np.array([700, 750, 850, 950, 1000, 1100,
... |
from fabric.api import env
host1 = 'root@10.84.13.32'
host2 = 'root@10.84.13.33'
host3 = 'root@10.84.13.38'
host4 = 'root@10.84.13.19'
host5 = 'root@10.84.13.22'
host6 = 'root@10.84.13.44'
ext_routers = []
router_asn = 64512
#public_vn_rtgt = 10003
#public_vn_subnet = "10.204.219.32/29"
host_build = 'stack@10.84.24.6... |
"""Test AdaNet freezer single graph implementation.
Copyright 2018 The AdaNet 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
https://www.apache.org/licenses/LICE... |
#!/usr/bin/env python3
import subprocess
import os
import sys
sys.path.append("../lib/")
sys.path.append("../volume/")
import json_parser
import ibofos
import cli
import test_result
import json
import MOUNT_VOL_BASIC_1
def clear_result():
if os.path.exists( __file__ + ".result"):
os.remove( __file__ + ".r... |
from django import forms
from django.contrib.auth import authenticate
class RegistrationForm(forms.Form):
email = forms.EmailField()
password = forms.CharField(widget=forms.PasswordInput)
confirm_password = forms.CharField(widget=forms.PasswordInput)
def __init__(self, *args, **kwargs):
super... |
import numpy as np
import unittest
import os
import openmdao.api as om
from openmdao.utils.assert_utils import assert_rel_error
from example_cycles.high_bypass_turbofan import HBTF
class CFM56OffdesignTestCase(unittest.TestCase):
def setUp(self):
self.prob = om.Problem()
des_vars = self.prob.... |
# -*- coding: utf-8 -*-
"""
test_config
~~~~~~~~~~~
Test the sphinx.config.Config class and its handling in the
Application class.
:copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from six import PY3, iteritems
from util import mock
... |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 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 proper accounting with a double-spend conflict
#
from test_framework.test_framework import Bitc... |
"""
Linear UVLM State Space System
"""
import sharpy.linear.utils.ss_interface as ss_interface
import numpy as np
import sharpy.linear.src.linuvlm as linuvlm
import sharpy.linear.src.libsparse as libsp
import sharpy.utils.settings as settings
import scipy.sparse as sp
import sharpy.utils.rom_interface as rom_interface... |
# Copyright 2021 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... |
from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name='mkdocs-render-otherfile-plugin',
version='1.0.0',
description='MkDocs Plugin to render other foramt files.',
long_description=long_description,
long_description_content_type... |
"""vswprinter 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... |
#!/usr/bin/python
"""
Your mapper function should print out 10 lines containing longest posts, sorted in
ascending order from shortest to longest.
Please do not use global variables and do not change the "main" function.
"""
import sys
import csv
def lineCompare(x,y):
return len(x[4]) - len(y[4])
def mapper():
... |
from rest_framework import renderers
import json
class UserRenderer(renderers.JSONRenderer):
charset='utf-8'
def render(self, data, accepted_media_type=None, renderer_context=None):
response = ''
if 'ErrorDetail' in str(data):
response = json.dumps({'errors': data})
else:
... |
# (c) Copyright 2015 Hewlett-Packard Development Company, L.P.
# (c) Copyright 2015 ThoughtWorks, 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/... |
import movie
import json
import random
import urllib
import datetime
import time
import cPickle
from random import shuffle
from geoip import geolite2
movie.read_movie_list()
print len(movie.movies)
SCORES_FILE_PATH = "./scores.txt"
INITIAL_ID = 0
GAMES = {}
SCORES = []
class game:
def __init__(self, country):
... |
#OKOKOKOK
########### Python 3.2 #############
import http.client, urllib.request, urllib.parse, urllib.error, base64, sys
import json
import numpy
import cv2
headers = {
# Request headers. Replace the placeholder key below with your subscription key.
'Content-Type': 'application/json',
'Ocp-Apim-Subscrip... |
print("hey")
text = "CFDQPCBODQLCYPULTJBBULURULXFDTXSCNTDZJBICLDQBTNDAUJBPOUJLGOCJLNCBTNDAUJBPOUJLLDDANCBTJPIDPPDFUELUPPXTQVVFQGMCBTCTDISCNNPLUPGOUTDQPDBPOUILCNNJBPOUNQBNDQBTCNVUUEJSUBPQEPDDQLLDDACBTKQTIUTJSDQVTPCMUCBCEAXNUVYJYDQBTPOCPNSUUPAJNNNDEOJCNPCBTJBIJBOULTDDLSOJGOSCNBUWPPDDQLNCBTNOUPDDMAUJBOULLDDACBTNOQPPOUTDD... |
from django.contrib import admin
from about.models import Inquiry
admin.site.register(Inquiry)
|
# Copyright 2015 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... |
# Made by @Eviral
# Don't remove these lines else gay..
# Kang with credits..
import asyncio
from FIREX.utils import admin_cmd
from userbot.cmdhelp import CmdHelp
@bot.on(admin_cmd("hdd"))
async def _(event):
if event.fwd_from:
return
animation_interval = 1
animation_ttl = range(0, 50)
awai... |
from setuptools import setup, find_packages # Always prefer setuptools over distutils
from codecs import open # To use a consistent encoding
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
setup(
name='imgurpython',
# Versions should comply ... |
#!/usr/bin/env python3
import sys
if sys.version_info < (3, 3):
raise RuntimeError('At least Python 3.3 is required')
import struct
from datetime import datetime, timedelta
from pytz import utc
import filestuff, worker, common
import fcntl, os.path, stat, os, itertools
from os import fstat, mkdir, fchmod, chmod, utim... |
# coding: utf-8
"""
Hydrogen Integration API
The Hydrogen Integration API # noqa: E501
OpenAPI spec version: 1.3.1
Contact: info@hydrogenplatform.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from integration_api.con... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.21 on 2020-02-11 18:20
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('example_labeller', '0002_auto... |
#!usr/bin/python
# encoding=utf8
import subprocess
from threading import Thread
from .database import RedisClient
SAVE_PATH = ".\\torrents"
STOP_TIMEOUT = 60
MAX_CONCURRENT = 16
MAX_MAGNETS = 256
CMD = (
"aria2c -d {save_path} "
"--bt-metadata-only=true "
"--bt-save-metadata=true "
"--listen-port=68... |
# coding:utf8
"""
爬虫中间件
"""
class SpiderMiddleware(object):
def process_request(self, request):
print('SpiderMiddleware:process_request')
return request
def process_response(self, response):
# 处理请求
print('SpiderMiddleware:process_response')
return response
|
# coding=utf-8
from flask import jsonify
from flask import make_response
from os import path
import json
from api.helpers import make_json_response, make_error
from api.cache import cache
top_cache_timeout = 1800
mp_top_attendance = {}
mp_top_minutes_talked = {}
mp_top_stands_taken = {}
with open(path.dirname(__fil... |
#Calculadora
while True:
print()
num_1 = input("Digite um número: ")
num_2 = input("Digite outro número: ")
operador = input("Digite um operador: ")
sair = input("Deseja sair? [s]im ou [n]ão: ")
if sair == "s":
break
if not num_1.isnumeric() or not num_2.isnumeric():
print(... |
import sys
import requests
import csv
import io
from datetime import datetime
from .utils import store_data
# ------------------------------------------------------------------------
# Globals
URL = "https://raw.githubusercontent.com/idandrd/israel-covid19-data/master/IsraelCOVID19.csv"
LOC = "case-counts/Asia/Wes... |
"""
Problem link:
Solution By Keshav Mishra
"""
from sys import stdin,stdout
def input(): return stdin.readline().strip()
# def print(s): stdout.write(str(s)+'\n')
from collections import Counter
# Constants
YES = 'YES'
NO = 'NO'
yes = 'yes'
no = 'no'
true = 'true'
false = 'false'
def solve(t):
n = int(inp... |
# Dependencies and Setup
from flask import Flask, render_template
from flask_pymongo import PyMongo
import scrape_mars
app = Flask(__name__)
app.config["MONGO_URI"] = "mongodb://localhost:27017/mars_app"
mongo = PyMongo(app)
@app.route("/")
def index():
mars = mongo.db.mars.find_one()
return render_template(... |
import logging
import time
import unittest
import redstone
class KeyProtectTestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.rc = redstone.service("ResourceController")
cls.instance_id, cls.crn = cls.rc.create_instance(
name="redstone-keyprotect-integration-tests"... |
from construct import *
# FPO DATA
FPO_DATA = Struct("FPO_DATA",
ULInt32("ulOffStart"), # offset 1st byte of function code
ULInt32("cbProcSize"), # number of bytes in function
ULInt32("cdwLocals"), # number of bytes in locals/4
ULInt16("cdwParams"), # number of byt... |
#!/usr/bin/env python
import logging
import os
import os.path
import re
import shutil
import sys
import tempfile
import time
import unittest
from platform import architecture
import cli_common
from cli_common import (file_text, find_utility, is_windows, list_upto,
path_for_gpg, pswd_pipe, rais... |
import asyncio
import os
from typing import Text
import matplotlib
import pytest
import rasa.utils.io
from rasa.core.agent import Agent
from rasa.core.channels.channel import CollectingOutputChannel
from rasa.core.domain import Domain
from rasa.core.interpreter import RegexInterpreter
from rasa.core.nlg import Templa... |
# Copyright 2019 The Keras Tuner Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
#!/usr/bin/env 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")... |
import uvicorn as uvicorn
from fastapi import FastAPI, Request, Response
from fastapi.staticfiles import StaticFiles
from starlette.middleware.sessions import SessionMiddleware
from dspback.config import get_settings
from dspback.database.models import SessionLocal
from dspback.routers import authentication, repositor... |
# Copyright (c) 2014, Adam J. Rossi. All rights reserved. See README for licensing details.
import sys, os
sys.path.append(os.path.abspath("."))
import Chain # Chain must be imported first, requirement of registry
import Sources, FeatureExtraction, FeatureMatch, BundleAdjustment, Cluster, Visualization
# path to... |
import torch.nn as nn
import math
import torch
import pickle
# weights from https://github.com/cydonia999/VGGFace2-pytorch
# pretrained_model_path = "..\\models\\pretrained_models\\resnet50_scratch_weight.pkl"
# pretrained on traning data VGGFace2
# resnet50_scratch ResNet-50 trained from scratch on VGGFace2
# [INPUT ... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# author:jingtongyu
# datetime:2020/6/7 10:14 下午
# software: PyCharm
from flask import current_app
from sqlalchemy import and_
from . import db
from .base import BaseModel
from sqlalchemy import orm, and_
from datetime import datetime
class LogsModel(BaseModel):
__ta... |
# -*- coding: utf-8 -*-
"""Base exchange class"""
# -----------------------------------------------------------------------------
__version__ = '1.34.26'
# -----------------------------------------------------------------------------
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import NetworkEr... |
# Copyright (c) 2017 The Verde Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
#
# This code is part of the Fatiando a Terra project (https://www.fatiando.org)
#
"""
Functions for least-squares fitting with optional regularization.
"""
from warnings import ... |
from typing import Any, Dict
from django.shortcuts import render
from django.views.generic import TemplateView
# Create your views here.
class IndexView(TemplateView):
"""
Main app view
"""
template_name = 'frontend/index.html'
def get_context_data(self, **kwargs: Any) -> Dict[str, Any]:
... |
import os
import sys
import array
import unittest
from ctypes import c_int, byref, cast, POINTER, c_void_p
from sdl2.ext import CTypesView
from sdl2 import SDL_Init, SDL_Quit, SDL_INIT_EVERYTHING
from sdl2.stdinc import Uint8, Uint32, SDL_TRUE, SDL_FALSE
from sdl2 import blendmode, pixels, rect, surface, rwops, error
... |
"""Unit tests for locations.py."""
# standard library
import unittest
# py3tester coverage target
__test_target__ = 'delphi.utils.geo.locations'
class UnitTests(unittest.TestCase):
"""Basic unit tests."""
def test_no_empty_regions(self):
for loc in Locations.region_map:
with self.subTest(loc=loc):
... |
#!/usr/bin/env python3
#######################################################################################
#### This script is only check connectivity via fio #######
#### Please use other performance script if you want to measure I/O speed. #######
################################... |
from flask import flash, redirect, render_template, request, url_for
from flask_login import (current_user, login_required, login_user,
logout_user)
from rq import queue
from . import account
from .. import db
from ..email import send_email
from ..models import User
from .forms import (ChangeE... |
from __future__ import absolute_import, division, print_function
from datashape import dshape
from blaze.expr import *
from blaze.expr.core import subs
def test_subs():
from blaze.expr import TableSymbol
t = TableSymbol('t', '{name: string, amount: int, id: int}')
expr = t['amount'] + 3
assert expr._... |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM Corp. 2017 and later.
#
# 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.... |
"""
.. module:: dj-stripe.tests.test_utils
:synopsis: dj-stripe Utilities Tests.
.. moduleauthor:: Daniel Greenfeld (@pydanny)
.. moduleauthor:: Alex Kavanaugh (@kavdev)
"""
import time
from copy import deepcopy
from datetime import datetime
from decimal import Decimal
from unittest import skipIf
from unittest.moc... |
r"""
Query Builder Base, Region and Neurosynth Mixins
================================================
Base classes to construct Datalog programs.
Capabilities to declare, manage and manipulate symbols.
Mixins provide capabilities related to brain volumes and
Neurosynth metadata manipulation
"""
from contextlib import ... |
import json
import os
import shutil
import uuid
from scheduler.slurm import Slurm
class Bilby(Slurm):
def __init__(self, settings, ui_id, job_id):
"""
Initialises the slurm scheduler class for Bilby
:param settings: The settings from settings.py
:param ui_id: The UI id of the job... |
import math
import random
import threading
import time
from typing import Tuple
import copy
from emulators.Device import Device
from emulators.Medium import Medium
from emulators.MessageStub import MessageStub
class ConsensusRequester:
def consensus_reached(self, element):
raise NotImplementedError
... |
"""
actuators.py
Classes to control the motors and servos. These classes
are wrapped in a mixer class before being used in the drive loop.
"""
import time
import donkeycar as dk
class PCA9685:
'''
PWM motor controler using PCA9685 boards.
This is used for most RC Cars
'''
def __init__... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... |
from sklearn.metrics import confusion_matrix
# acutal is the list of actual labels, pred is the list of predicted labels.
# positive_pred is the favorable result in prediction task. e.g. get approved for a loan
def TNR(actual,pred,positive_pred):
classes = list(set(actual))
matrix = confusion_matrix(actual, pr... |
"""
pyhik.hikvision
~~~~~~~~~~~~~~~~~~~~
Provides api for Hikvision events
Copyright (c) 2016-2019 John Mihalic <https://github.com/mezz64>
Licensed under the MIT license.
Based on the following api documentation:
System:
http://oversea-download.hikvision.com/uploadfile/Leaflet/ISAPI/HIKVISION%20ISAPI_2.0-IPMD%20Servi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.ExtraInfo import ExtraInfo
from alipay.aop.api.domain.CarRentalMerchantInfo import CarRentalMerchantInfo
from alipay.aop.api.domain.CarRentalStoreInfo import CarRentalStoreInfo
cl... |
nome = str(input())
salario = float(input())
vendas = float(input())
comissao = 0.15 * vendas
salario += comissao
print("TOTAL = R$ %0.2f" %salario) |
# Nextstrain colors encoded as RGB integers for misuse as Newick branch lengths
cladeBogusLengths = { 'A1a': 4803553, 'A2': 4948969, 'A2a': 6073807,
'A3': 7849892, 'A6': 10146938, 'A7': 11386193,
'B': 15322442, 'B1': 16756801, 'B2': 16742965,
'B4': 1633... |
# coding: utf-8
from itertools import chain, starmap
from collections import Counter
import torch
from torchtext.data import Dataset as TorchtextDataset
from torchtext.data import Example
from torchtext.vocab import Vocab
def _join_dicts(*args):
"""
Args:
dictionaries with disjoint keys.
Return... |
import json
import uuid
import requests
from dcplib import aws
from .. import config
from .query_jobs import set_job_status
def create_async_query_job(query, params):
q = aws.resources.sqs.Queue(aws.clients.sqs.get_queue_url(QueueName=config.async_queries_queue_name)["QueueUrl"])
sqs_receipt = q.send_messag... |
from __future__ import print_function
import gevent
import unittest
class TestDestroyDefaultLoop(unittest.TestCase):
def tearDown(self):
self._reset_hub()
super(TestDestroyDefaultLoop, self).tearDown()
def _reset_hub(self):
from gevent._hub_local import set_hub
from gevent._h... |
# type: ignore
import pytest
import datetime
from sqlalchemy import create_engine
from sqlalchemy.types import Integer, String, DateTime
from sqlalchemy.schema import Column, ForeignKey
from sqlalchemy.orm import relationship, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy_oso i... |
"""
Authors: Arjun Kumar <karjun@seas.upenn.edu> and Jnaneshwar Das <jnaneshwar.das@gmail.com>
Testing simple formation control
"""
import rospy
import subprocess
import os
import sys
import math
import tf
import time
import geodesy
import numpy as np
import pid
from std_msgs.msg import Float64, Float64MultiArray, I... |
# Copyright 2018 Amazon.com, Inc. or its 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
#!/usr/bin/env python
from distutils.core import setup
import os
def find(path='.'):
r = []
for f in os.listdir(path):
if os.path.isdir(f):
r.extend(find(f))
else:
r.append(os.path.join(path, f))
return r
setup(name='pique', version='0.02.0',
author='Ryan Marquardt',
author_email='ryan.marquardt@gmail... |
"""
A set of abstract widgets which require a subclass to be useful.
"""
from wtforms.widgets.core import Input, HTMLString
from abc import ABCMeta
from ..common import CustomWidgetMixin
import wtforms.widgets.core as wt_core
class BootstrapPlainCheckboxRadio(wt_core.CheckboxInput, CustomWidgetMixin):
"""
Abs... |
import logging
def get_logger(obj):
if isinstance(obj, str):
name = obj
else:
name = obj.__class__.__name__
return logging.getLogger(name)
|
''' A timeseries plot of glucose data readings. This example demonstrates
adding box annotations as well as a multi-line title.
.. bokeh-example-metadata::
:sampledata: glucose
:apis: bokeh.plotting.figure.line, bokeh.plotting.figure.scatter, bokeh.models.annotations.BoxAnnotation
:refs: :ref:`userguide_an... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.