content stringlengths 5 1.05M |
|---|
TEST = 'noe'
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
routines for getting network interface addresses
"""
# by Benjamin C. Wiley Sittler, BSD/OSX support by Greg Hazel
__all__ = [
'getifaddrs',
'getaddrs',
'getnetaddrs',
'getbroadaddrs',
'getdstaddrs',
'main',
'IFF_UP',
'IFF_BROADCAST',
... |
from .main import *
from .database import *
from .headless import *
from .bdi import *
from .spq import *
from .oci import *
from .stai import *
from .starter import *
from .two_of_four_ocd_practice import *
from .two_of_four_ocd_test import *
from .extra import *
from .teacher_practice import *
from .teacher_test imp... |
# Do not edit this file directly.
# It was auto-generated by: code/programs/reflexivity/reflexive_refresh
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
def imgui():
http_archive(
name = "imgui",
build_file = "... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Perform a functional test of the status command."""
import os
import orion.core.cli
def test_no_experiments(clean_db, monkeypatch, capsys):
"""Test status with no experiments."""
monkeypatch.chdir(os.path.dirname(os.path.abspath(__file__)))
orion.core.cli.... |
import json
import sqlite3
with open('../data_retrieval/authors/author_info.json') as data_file:
data = json.load(data_file)
connection = sqlite3.connect('scholarDB.db')
with connection:
cursor = connection.cursor()
for row in data:
name = row['name']
website = row['website']
emai... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
"""
Custom Jupyterhub Authenticator to use Facebook OAuth with business manager check.
""... |
import numpy as np
import pandas as pd
from sklearn import *
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
from matplotlib import pyplot
import time
import os
showPlot=True
#prepare data
data_file_name = "../FinalCost.csv"
data_csv = pd.read_csv(data_file_na... |
import numpy as np
class ZeroNoisePrng:
"""
A dummy PRNG returning zeros always.
"""
def laplace(self, *args, size=1, **kwargs):
return np.zeros(shape=size)
def exponential(self, *args, size=1, **kwargs):
return np.zeros(shape=size)
def binomial(self, *args, size=1, **kwargs):... |
'''
@author: Sana Dev Team
Created on May 24, 2011
'''
from __future__ import with_statement
import sys, traceback
from django.conf import settings
from django.core import urlresolvers
from piston.utils import decorator
from sana import api
from sana.api.fields import REQUEST, DISPATCHABLE
CRUD = {'GET':'read', 'PO... |
"""You are given an integer n, the number of teams in a tournament that has strange rules:
If the current number of teams is even, each team gets paired with another team. A total of n / 2 matches are played, and n / 2 teams advance to the next round.
If the current number of teams is odd, one team randomly advances i... |
from django.contrib import admin
from publicmarkup.legislation.models import Resource, Legislation, Title, Section
class LegislationAdmin(admin.ModelAdmin):
prepopulated_fields = {"slug": ("name",)}
class SectionInline(admin.TabularInline):
model = Section
extra = 5
class TitleAdmin(admin.Mod... |
from pyscenario import *
from util.arg import *
from util.scene import RoadSideGen
class Scenario(PyScenario):
def get_description(self):
return 'Test random boxes at the border of roads'
def get_map(self):
return arg_get('-map', 'shapes-1')
def init(self):
gen = RoadSideGen(self.... |
def two(x, y, *args):
print(x, y, args)
if __name__ == '__main__':
two('a', 'b', 'c')
|
#!/usr/bin/env python3
from _common import StreamContext
import sys
from argparse import ArgumentParser
import itertools
from shelltools.ressample import ReservoirSampler
from typing import Sequence
def _has_dupes(items: Sequence):
if len(items) <= 1:
return False
if len(items) == 2:
return it... |
import sys
import argparse
import matplotlib.pyplot as plt
import pandas as pd
import tensorflow as tf
from sklearn.utils import shuffle
def main(_):
# read data
df = pd.read_csv('../../data/boston/boston_train.csv', header=0)
print(df.describe())
f, ax1 = plt.subplots()
for i in range(1, 8):
... |
# Copyright 2021 Michal Krassowski
from collections import defaultdict
from time import time
from jedi.api.classes import Completion
from .logger import log
class LabelResolver:
def __init__(self, format_label, time_to_live=60 * 30):
self.format_label = format_label
self._cache = {}
sel... |
import pandas as pd
import numpy as np
#seri olusturma
#s = pd.Series(data, index=index) ile seri olusturulur
# s = pd.Series(np.random.randn(5)) #index --> 0,1,2,3,4
# s = pd.Series(np.random.randn(5),index=['a','b','c','d','e'])
# print(s)
# print('-'*50)
# print(s.index)
# print('*'*50)
# data = {'a':2... |
import numpy as np
def fieldFromCurrentLoop(current, radius, R, Z):
"""
Checks inputs to fieldFromCurrentLoop() for TypeErrors etc.
"""
if type(current) != type(0.):
raise TypeError("Current should be a float, "+str(type(current))+" detected.")
if type(radius) != type(0.):
raise ... |
n = int(input('number: '))
count = 0
for i in range(1, n+1):
if n % i == 0:
count += 1
print(i, end=' ')
print()
print('count:', count) |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright © 2014, 2015, 2017 Kevin Thibedeau
# (kevin 'period' thibedeau 'at' gmail 'punto' com)
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software... |
import unittest
from sqlalchemy.orm import sessionmaker
from nesta.core.orms.nomis_orm import Base
from nesta.core.orms.orm_utils import get_mysql_engine
class TestNomis(unittest.TestCase):
'''Check that the WiktionaryNgram ORM works as expected'''
engine = get_mysql_engine("MYSQLDBCONF", "mysqldb")
Sessi... |
from django.apps import AppConfig
class DeptConfig(AppConfig):
name = 'dept'
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Amir Mofasser <amir.mofasser@gmail.com> (@amimof)
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
DOCUMENTATION = """
module: ibmim_installer
version_added: "1.9.4"
short_description: Install/Uninstall IBM Inst... |
"""
This file defines and implements the basic goal descriptors for PDDL2.2.
The implementation of comparison goals is implemented in DomainInequality.
"""
from typing import Union, List
from enum import Enum
from pddl.domain_formula import DomainFormula, TypedParameter
from pddl.domain_time_spec import TIME_SPEC
cl... |
# pylint # {{{
# vim: tw=100 foldmethod=indent
# pylint: disable=bad-continuation, invalid-name, superfluous-parens
# pylint: disable=bad-whitespace, mixed-indentation
# pylint: disable=redefined-outer-name
# pylint: disable=missing-docstring, trailing-whitespace, trailing-newlines, too-few-public-methods
# }}}
import... |
import mock
import unittest
import mongomock
from core.seen_manager import canonize, SeenManager
from core.metadata import DocumentMetadata
from tests.test_base import BaseTestClass
class TestSeenManager(BaseTestClass):
def test_canonize(self):
input_url = ["http://www.google.com",
"... |
""" Python generator utilities for DMT """
import shutil
from pathlib import Path
from setuptools import setup, find_packages
here = Path(__file__).parent.resolve()
# Remove build and dist folders
shutil.rmtree(Path("build"), ignore_errors=True)
shutil.rmtree(Path("dist"), ignore_errors=True)
# Get the lo... |
#!/usr/bin/env python
# coding: utf-8
# <!--BOOK_INFORMATION-->
# <img align="left" style="padding-right:10px;" src="images/book_cover.jpg" width="120">
#
# *This notebook contains an excerpt from the [Python Programming and Numerical Methods - A Guide for Engineers and Scientists](https://www.elsevier.com/books/pyth... |
import markdown
from django.template.loader import render_to_string
from modules.polygon import models
CONTEST_TAG_RE = r'(?i)\[polygon_contest\s+id:(?P<contest_id>\d+)\]'
class ContestExtension(markdown.Extension):
"""Contest plugin markdown extension for SIStema wiki."""
def extendMarkdown(self, md):
... |
########
# PART 1
def get_numbers():
numbers = None
with open("event2019/day16/input.txt", "r") as file:
for line in file:
numbers = list(map(int, line[:-1]))
#numbers = [int(x) for x in line[:-1]]
return numbers
def fft(inp):
''' TODO: optimize with part 2 '''
... |
import streamlit as st
def app():
st.write("# About")
col1, col2, col3 = st.columns([5,2,5])
with col1:
st.image("davide.jpg")
st.write("### Davide Torlo")
st.write("Ricercatore PostDoc all'Università SISSA di Trieste")
st.write("Ideatore principale di concept, metriche e g... |
keywords = {
".5" : "FOR[ITERATION]",
"wrap" : "KEYWORD",
"as" : "KEYWORD[ASSIGNMENT]",
"let" : "KEYWORD[RELOP]",
"pp" : "INCRE[RELOP]",
".2" : "IF[CONDITIONAL]",
"vomit" : "KEYWORD[PRINT]",
"|" : "PARANTHESIS",
"--" ... |
"""
JAX DSP utility functions
"""
from functools import partial
import jax
import jax.numpy as jnp
import librosa
from jax.numpy import ndarray
def rolling_window(a: ndarray, window: int, hop_length: int):
"""return a stack of overlap subsequence of an array.
``return jnp.stack( [a[0:10], a[5:15], a[10:20],... |
# -*- encoding: utf-8 -*-
'''
Created on 2012-3-23
@author: Neil
'''
from django.shortcuts import render_to_response
from grnglow.glow.views import people
from grnglow.glow.models.photo import Photo
def base(request):
return render_to_response('base.html')
def index(request):
if request.user.is_authenticat... |
# -*- coding: utf-8 -*-
"""
Created on Fri May 24 15:17:13 2019
@author: DaniJ
"""
'''
It is like the four_layer_model_2try_withFixSpeciesOption_Scaling.py, but with two surfaces. There is not Poisson-Boltzman interaction between the two surfaces.
'''
import numpy as np
from scipy import linalg
def four_layer_two_su... |
# Step 1 - Gather Data
import pandas as pd
import datetime
import re
import json
import os
import unittest
import time
import sys
# Own Imports
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
from deployment.Control_Enactor import Enactor
from deployment.Data_Retreiver import Data_Retreiver
class Contro... |
# Generated by Django 2.2.6 on 2020-01-18 06:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0002_auto_20200116_2309'),
]
operations = [
migrations.AddField(
model_name='enroll',
name='outofmid',
... |
# Copyright (c) 2016, Dennis Meuwissen
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions an... |
# Simple XML to CSV
# e.g. for https://ghr.nlm.nih.gov/download/ghr-summaries.xml
# Silas S. Brown 2017 - public domain - no warranty
# Bugs: may not correctly handle descriptions that mix
# tags with inline text on the same level.
# FOR EXPLORATORY USE ONLY.
# Where to find history:
# on GitHub at https://github.com... |
def seat_spec_to_id(seat_spec):
row = 0
for pos in range(7):
if seat_spec[pos] == 'B':
row = row + pow(2,6-pos)
# print("adding row", pow(2,6-pos))
# print("row", row)
col = 0
for pos in range(3):
if seat_spec[7+pos] == 'R':
col = col + pow(2,2-pos)
# print("adding col", pow(2,... |
import argparse
import math
import sys
def main() -> int:
parser = argparse.ArgumentParser(
description="Utility for generating the pitch register table C source.",
)
parser.add_argument(
'c',
metavar='C_FILE',
type=str,
help='The C file we should generate.',
)
... |
from llvmlite import ir as lir
import llvmlite.binding as ll
import numba
import hpat
from hpat.utils import debug_prints
from numba import types
from numba.typing.templates import (infer_global, AbstractTemplate, infer,
signature, AttributeTemplate, infer_getattr, bound_function)
fr... |
from py.webSocketParser import SurveyTypes
neo = [
{"sigma_tp": 7.2258e-06, "diameter": 16.84, "epoch_mjd": 56800.0, "ad": 1.782556743092633, "producer": "Otto Matic", "rms": 0.49521, "H_sigma": "", "closeness": 3366.5887401966647, "spec_B": "S", "K2": "", "K1": "", "M1": "", "two_body": "", "full_name": "433 Eros... |
#
# This script should be sourced after slicerqt.py
#
def tcl(cmd):
global _tpycl
try:
_tpycl
except NameError:
# no tcl yet, so first bring in the adapters, then the actual code
import tpycl
_tpycl = tpycl.tpycl()
packages = ['freesurfer', 'mrml', 'mrmlLogic', 'teem', 'vtk', 'vtkITK']
... |
import os
import shutil
import sys
from pathlib import Path
from subprocess import Popen
from cmd.Tasks.Task import Task
from cmd.Tasks.Tasks import Tasks
from cmd.Tasks.Build.manifest_config import manifest_config
import json
class Build(Task):
NAME = Tasks.BUILD
def __build_app(self):
print('****'... |
from django.apps import AppConfig
class Sql3Config(AppConfig):
name = 'SQL3'
|
# Testing environment setting
|
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 3 07:06:58 2019
@author: astar
"""
import random
import math
import matplotlib.pyplot as plt
from time import clock
class Ant:
def __init__(self, map_):
self.map = map_
self.path = []
self.path_length = math.inf
... |
import unittest
from datetime import datetime
from pyopenrec.comment import Comment
class TestComment(unittest.TestCase):
c = Comment()
def test_get_comment(self):
dt = datetime(2021, 12, 21, 0, 0, 0)
data = self.c.get_comment("n9ze3m2w184", dt)
self.assertEqual(200, data["status"])
... |
from numpy.testing import *
import time
import random
import skimage.graph.heap as heap
def test_heap():
_test_heap(100000, True)
_test_heap(100000, False)
def _test_heap(n, fast_update):
# generate random numbers with duplicates
random.seed(0)
a = [random.uniform(1.0, 100.0) for i in range(n /... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-01-25 23:37
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0014_auto_20181116_0716'),
]
operations = [
migrations.AlterField(... |
import discord
from discord.ext import commands
import chickensmoothie as cs
class Pet:
def __init__(self, bot):
self.bot = bot
@commands.command()
@commands.guild_only()
async def pet(self, ctx, link: str = ''): # Pet command
pet = await cs.pet(link) # Get pet data
if pet ... |
# ----------------------------------------
# Created on 3rd Apr 2021
# By the Cached Coder
# ----------------------------------------
'''
This script defines the function required
to get a the email ids to send the mail to
from the GForms' responses.
Functions:
getAllResponses():
No Inputs
Returns ... |
import numpy as np
from simulation_api import SimulationAPI
from simulation_control.dm_control.utility import EnvironmentParametrization
from simulation_control.dm_control.utility import SensorsReading
# Check if virtual_arm_environment API works with a given step input
sapi = SimulationAPI()
sapi.step(np.array([0, 0... |
def pg(obs, num_particles=100, num_mcmc_iter=2000):
T = len(obs)
X = np.zeros([num_mcmc_iter, T])
params = [] # list of SV_params
# YOUR CODE
return X, params
|
# -*- coding: utf-8 -*-
import sys
import numpy as np
import scipy.io.wavfile
def main():
try:
if len(sys.argv) != 5:
raise ValueError("Invalid arguement count");
if sys.argv[1] == "towave":
toWave(sys.argv[2], sys.argv[3], float(sys.argv[4]))
elif sys.... |
#
# BSD 3-Clause License
#
# Copyright (c) 2017 xxxx
# All rights reserved.
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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 ... |
# ===- test_floats.py ----------------------------------*- python -*-===//
#
# Copyright (C) 2021 GrammaTech, Inc.
#
# This code is licensed under the MIT license.
# See the LICENSE file in the project root for license terms.
#
# This project is sponsored by the Office of Naval Research, One Liberty
# Center, 875 ... |
# Copyright Tom SF Haines
#
# 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, soft... |
import json
import numpy as np
import boto3
import scipy
import scipy.sparse
from io import BytesIO
import os
ACCESS_KEY = os.environ['ACCESS_KEY']
SECRET_ACCESS_KEY = os.environ['SECRET_ACCESS_KEY']
def getData():
BUCKET = 'personal-bucket-news-ranking'
client = boto3.client('s3',
... |
B = input().strip()
B1 = ''
for b in B:
if b in ['X', 'L', 'C']:
B1 += b
else:
break
if B1 == 'LX':
B1 = 'XL'
B2 = B[len(B1):]
if B2 == 'VI':
B2 = 'IV'
elif B2 == 'I' and B1.endswith('X'):
B1 = B1[:-1]
B2 = 'IX'
if B1 == 'LX':
B1 = 'XL'
print(B1+B2)
|
from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from django.conf import settings
import pymongo
from . import permissions
@api_view(['GET'])
def root(request, **kwargs):
permitted_user_types = ['interviewer']
if permissions.check(r... |
import unittest
import sys
import inspect
from unittest.mock import Mock
from io import StringIO
from math import ceil
from damage import Damage
from classes import Paladin
from spells import PaladinSpell
from models.spells.loader import load_paladin_spells_for_level
class PaladinTests(unittest.TestCase):
def se... |
# -*- coding: UTF-8 -*-
import pika
if __name__ == '__main__':
connection = pika.BlockingConnection(pika.ConnectionParameters("localhost"))
channel = connection.channel()
channel.exchange_declare(exchange="tang",type="fanout")
message = "You are awsome!"
for i in range(0, 100): # 循环100次发送消息
... |
import torch.nn as nn
import config
from utils.manager import PathManager
class BaseModel(nn.Module):
def __init__(self,
model_params: config.ParamsConfig,
path_manager: PathManager,
loss_func,
data_source,
**kwargs):
s... |
import pandas as pd
from IPython.display import display_html, Image
import weasyprint as wsp
import matplotlib.pyplot as plt
import os
import math
experiment_pref = 'experiment-log-'
test_file_pref = 'test_file_'
csv_ext = '.csv'
txt_ext = '.txt'
def display_best_values(directory=None):
real_list = []
oracl... |
'''Collects tweets, embeddings and save to DB'''
from flask_sqlalchemy import SQLAlchemy
from dotenv import load_dotenv
import os
import tweepy
import basilica
from .models import DB, Tweet, User
TWITTER_USERS = ['calebhicks', 'elonmusk', 'rrherr', 'SteveMartinToGo',
'alyankovic', 'nasa', 'sadserver... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... |
import logging
from contextlib import contextmanager
from unittest import mock
import pytest
import hedwig.conf
from hedwig.backends.base import HedwigPublisherBaseBackend
from hedwig.backends.import_utils import import_module_attr
from hedwig.testing.config import unconfigure
from tests.models import MessageType
t... |
# author: Drew Botwinick, Botwinick Innovations
# license: 3-clause BSD
import os
import sys
# region Daemonize (Linux)
# DERIVED FROM: http://code.activestate.com/recipes/66012-fork-a-daemon-process-on-unix/
# This module is used to fork the current process into a daemon.
# Almost none of this is necessary (or ad... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-30 14:57
from __future__ import unicode_literals
import cms.models.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('cms', '0016_au... |
import pandas as pd
#%%
print('hello') |
import pygeoip
gip = pygeoip.GeoIP("GeoLiteCity.dat")
res = gip.record_by_addr('192.168.29.160')
for key, val in res.items():
print('%s : %s' % (key, val)) |
"""
Simple data container for a observable
"""
from tcvx21 import Quantity
import numpy as np
class MissingDataError(Exception):
"""An error to indicate that the observable is missing data"""
pass
class Observable:
def __init__(self, data, diagnostic, observable, label, color, linestyle):
"""Si... |
import numpy as np
from scipy.special import loggamma
from scipy.spatial import KDTree
from matplotlib import pyplot as plt
from scipy.optimize import minimize
from mpl_toolkits import mplot3d
from math import frexp
from mpmath import mp, hyper, nstr, hyperu
from exactlearning import BFGS_search, analyse
mp.... |
#!/usr/bin/env python3
# coding: utf-8
"""
@author: Ping Qiu qiuping1@genomics.cn
@last modified by: Ping Qiu
@file:test_find_markers.py
@time:2021/03/16
"""
import sys
sys.path.append('/data/workspace/st/stereopy-release')
from stereo.tools.spatial_pattern_score import *
import pandas as pd
from anndata import Ann... |
import timeit
import functools
import numpy as np
def timefunc(number=10000):
def _timefunc(func):
@functools.wraps(func)
def time_func_wrapper(*args, **kwargs):
t0 = timeit.default_timer()
for _ in range(number):
value = func(*args, **kwargs)
t1... |
#!/usr/bin/env python
"""
This module provides File.GetID data access object.
"""
from WMCore.Database.DBFormatter import DBFormatter
from dbs.utils.dbsExceptionHandler import dbsExceptionHandler
class GetID(DBFormatter):
"""
File GetID DAO class.
"""
def __init__(self, logger, dbi, owner):
"""... |
class Solution:
def fourSumCount(self, nums1: List[int], nums2: List[int], nums3: List[int], nums4: List[int]) -> int:
cnt = 0
m = {}
for num1 in nums1:
for num2 in nums2:
m[num1 + num2] = m.get(num1 + num2, 0) + 1
for num3 in nums3:
for num4 i... |
DEBUG = False
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
SECRET_KEY = 'na2Tei0FoChe3ooloh5Yaec0ji7Aipho'
INSTALLED_APPS=(
'mailrobot',
)
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'APP_... |
VERSION = "2.0.113"
VERSION_APP = "1265"
API_KEY = "270072d0fb4811ebacd96f6726fbdbb1"
API_SECRET = "2d0288d0fb4811ebabfbd57e57c6ae64"
ENDPOINT = "https://api.myxplora.com/api"
|
from .dataset_evaluator import DatasetEvaluator
__all__ = [
'DatasetEvaluator'
] |
cities = [
'Tallinn',
'Tartu',
'Narva',
'Kohtla-Jaerve',
'Paernu',
'Viljandi',
'Rakvere',
'Sillamaee',
'Maardu',
'Kuressaare',
'Voru',
'Valga',
'Haapsalu',
'Johvi',
'Paide',
'Keila',
'Kivioli',
'Tapa',
'Polva',
'Jogeva',
'Tueri',
'E... |
#!/usr/bin/env python3
"""
* Example demonstrating the Position closed-loop servo.
* Tested with Logitech F350 USB Gamepad inserted into Driver Station]
*
* Be sure to select the correct feedback sensor using configSelectedFeedbackSensor() below.
*
* After deploying/debugging this to your RIO, first use the left... |
#!/usr/bin/env python3
from copy import deepcopy
from queue import Queue
from pickle import dump, load
from colorama import Fore, Style
class GoBoard(object):
black = 1
space = 0
white = -1
featureCount = 22
printDic = {space : '.', black : 'B', white : 'W'}
colorDic = {space : Fore.WHITE + S... |
from flask_login.utils import confirm_login
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField
from wtforms.validators import DataRequired, Email, EqualTo
from wtforms import ValidationError
from myproject.models import User
class loginForm(FlaskForm):
email = StringF... |
import unittest
from function.piecewise_linear_function import PiecewiseLinearFunction
class Test(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_basic_plf(self):
array = [(5, 1), (7, 3), (10, 6), (12, 8)]
f = PiecewiseLinearFunction(array)
... |
from collections.abc import Iterable
from collections.abc import Mapping
from xml.dom import minidom
from xml.dom.minidom import Element
import pandas as pd
from trainerroad.Utils.Str import *
class Workout:
def __init__(self):
pass
def add_workout_to_document(self, workouts: Iterable, document: mi... |
import torch
import torch.nn as nn
from torch.quantization.observer import MinMaxObserver, PerChannelMinMaxObserver
import warnings
class _InputEqualizationObserver(nn.Module):
r"""Observer for tracking the running min/max values of input columns, and
computing the quantization parameters for the overall min... |
# Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import math
import torch
from torch.distributions import constraints
from torch.distributions.utils import lazy_property
from pyro.distributions.torch import Chi2
from pyro.distributions.torch_distribution import TorchDistributio... |
"""
The :mod:`sklearn.feature_selection` module implements feature selection
algorithms. It currently includes univariate filter selection methods and the
recursive feature elimination algorithm.
"""
from ._univariate_selection import chi2
from ._univariate_selection import f_classif
from ._univariate_selectio... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2017-04-28 19:35
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('osf', '0026_rename_preprintservice_subjects'),
]
operations = [
migrations.Alt... |
import requests
from crawl_service.util.config import CONFIG
def new_session() -> requests.Session:
session = requests.Session()
session.proxies = CONFIG.get('proxies', dict())
return session
|
#!/usr/bin/python
# Copyright (c) 2020, 2021 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... |
# ===============================================================================
# Copyright 2014 Jake Ross
#
# 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... |
from django.core.management.base import BaseCommand, CommandError
from game.models import *
import settings
from PIL import Image
import random
def hex_to_rgb(value):
value = value.lstrip('#')
lv = len(value)
if lv == 1:
v = int(value, 16)*17
return v, v, v
if lv == 3:
return tu... |
'''ইউজার একটি পুর্ন সংখ্যা ইনপুট দিবে সংখ্যা জোর হলে আউটপুট হবে(even)
আর বিজোড় হলে আউটপুট হবে (odd)'''
#input
num=int(input("Enter the number:"))
#logic
if (num%2==0):
print(f"{num} is even")
else:
print(f"{num} is odd") |
#
# Copyright 2018-2019 IBM Corp. 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... |
# Generated by Django 2.2.9 on 2020-01-11 21:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bio_app', '0013_auto_20200111_2035'),
]
operations = [
migrations.AlterField(
model_name='clusters',
name='cluster_i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.