text stringlengths 1 927k |
|---|
from selfdrive.car.tesla.speed_utils.movingaverage import MovingAverage
class FleetSpeed:
def __init__(self, average_speed_over_x_suggestions):
self.speed_avg = MovingAverage(average_speed_over_x_suggestions)
self.frame_last_adjustment = 0
def adjust(self, CS, max_speed_ms, frame):
if... |
from cmu_graphics import *
# Variables
app.background = 'Black'
app.startScreen = True
app.infoScreen = False
app.levelScreen = False
app.controlScreen = False
app.backButtonEnabled = False
app.mightyMeadows = False
app.menacingMountains = False
app.monstrousMoat = False
app.playButton = False
app.playerControlMovemen... |
class Article:
def __init__(self, title, views, reactions, comments, url, creation_time=None, tags=None):
self.title = title
self.views = views
self.reactions = reactions
self.comments = comments
self.url = url
self.creation_time = creation_time
self.tags = t... |
import numpy
from mayavi.mlab import *
def test_plot3d():
"""Generates a pretty set of lines."""
n_mer, n_long = 6, 11
pi = numpy.pi
dphi = pi / 1000.0
phi = numpy.arange(0.0, 2 * pi + 0.5 * dphi, dphi)
mu = phi * n_mer
x = numpy.cos(mu) * (1 + numpy.cos(n_long * mu / n_mer) * 0.5)
y = ... |
# Copyright 2021 The ProLoaF Authors. All Rights Reserved.
#
# 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... |
import dask
import pytest
import xarray as xr
from xarray.testing import assert_allclose
from climpred.bootstrap import dpp_threshold
from climpred.stats import decorrelation_time, dpp
try:
from climpred.bootstrap import varweighted_mean_period_threshold
from climpred.stats import varweighted_mean_period
... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** 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
from ... import _utilities, _tables
from... |
import os
import pickle
import numpy as np
import ray
import sys
import rl.rllib_script.agent.model.ray_model
from blimp_env.envs import ResidualPlanarNavigateEnv
from ray.rllib.agents import ppo
from ray.tune.logger import pretty_print
checkpoint_path = os.path.expanduser(
"~/catkin_ws/src/AutonomousBlimpDRL/RL/... |
""" implement Chatbot functionality
"""
import json
import logging
import pyjq # jq like functionality to handle nested structure of FHIR like json bundle
import re # regex for lookup
import sys # added for function support
import uuid # unique id for ... |
# 이진 분할 알고리즘이 구현된 파이썬 표준 라이브러리, lower bound 사용 위해 임포트
import bisect
def init_db():
db = {}
language_list = ["cpp", "java", "python", "-"]
position_list = ["backend", "frontend", "-"]
career_list = ["junior", "senior", "-"]
food_list = ["chicken", "pizza", "-"]
for l in language_list:
f... |
#!/usr/bin/env python3
# Problem: Count all paths from top left to bottom right,
# given that you can only go right or down.
# Every move there are two choices, move right or left
# - recursively take choice 1/2 till you reach dest(rows, cols)
#
# Recurrence relation
# T(m,n) = T(m-1, n) + T(m, n-1)
# T(0,1) = 1
# ... |
# noinspection PyPackageRequirements
import mock
from twindb_backup.destination.ssh import Ssh
# noinspection PyUnresolvedReferences
@mock.patch.object(Ssh, '_status_exists')
def test_get_status_empty(mock_status_exists):
mock_status_exists.return_value = False
dst = Ssh(remote_path='/foo/bar')
status =... |
import os
import shutil
from flask import Flask, request, jsonify
from werkzeug.utils import secure_filename
from tensorflow.keras.models import load_model
from tensorflow.keras.metrics import top_k_categorical_accuracy
from keras_preprocessing.image import ImageDataGenerator
from keras.applications.mobilenet import p... |
#!/usr/bin/env python
import argparse
import logging
import os
import time
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple, Union
import gevent
from gevent.lock import Semaphore
from typing_extensions import Literal
from rotkehlchen.accounting.accountant import Accountant
from rotkehlche... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@created: 27.11.19
@author: felix
"""
from collections import deque
from itertools import chain, islice, repeat
def window(iterable, n, *, fillvalue=None):
if n == 0:
return
iterator = iter(iterable)
first_n_items = islice(chain(iterator, repeat(... |
import pandas as pd
import sklearn
import sklearn.utils
import nltk
from nltk.corpus import stopwords
fake = pd.read_csv("data/Fake.csv")
true = pd.read_csv("data/True.csv")
fake['target'] = 'fake'
true['target'] = 'true'
data = pd.concat([fake, true]).reset_index(drop=True)
from sklearn.utils import shuffle
data =... |
import sys
from setuptools import find_packages, setup # noqa
# from flytekit.tools.lazy_loader import LazyLoadPlugin # noqa
# extras_require = LazyLoadPlugin.get_extras_require()
MIN_PYTHON_VERSION = (3, 7)
CURRENT_PYTHON = sys.version_info[:2]
if CURRENT_PYTHON == (3, 6):
print(
f"Flytekit native typ... |
import os
import glob
import torch
import numpy as np
from PIL import Image
from skimage import io
from alisuretool.Tools import Tools
from torch.utils.data import DataLoader
from src.MyTrain_MIC5_Decoder8 import BASNet, DatasetUSOD
def one_decoder():
# --------- 1. get path ---------
has_mask = True
more... |
from transaction import Transaction
class FidelityCsvImporter(object):
transactions = []
def __init__(self, filepath):
with open(filepath, "r") as f:
lines = []
index_line = []
count = 0
for line in f:
items = line.strip().split(",")
... |
#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012, Cloudscaling
# 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
#
# ... |
# Generated by Django 2.2.4 on 2020-04-17 14:30
import core.storage.utils
from django.db import migrations, models
import storages.backends.gcloud
class Migration(migrations.Migration):
dependencies = [
('users', '0015_auto_20200417_0938'),
]
operations = [
migrations.AlterField(
... |
__Author__ = "noduez"
import pygame
from pygame.sprite import Sprite
class Ship(Sprite):
def __init__(self,ai_settings, screen):
'''初始化飞船并设置其初始位置'''
super(Ship, self).__init__()
self.screen = screen
self.ai_settings = ai_settings
# 加载飞船图像并获取其外接矩形
self.image = pyg... |
# This Python file uses the following encoding: utf-8
"""autogenerated by genpy from radar_msgs/RadarTrackArray.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import geometry_msgs.msg
import radar_msgs.msg
import protocol.std_msgs.msg as std_msgs
cl... |
from __future__ import absolute_import, division, print_function, unicode_literals
import os,sys
import time
import xml.etree.ElementTree as ET
import json
import requests
splunkhome = os.environ['SPLUNK_HOME']
sys.path.append(os.path.join(splunkhome, 'etc', 'apps', 'DA-ESS-MitreContent', 'lib'))
from seynurlib.valida... |
#!/home/jepoy/anaconda3/bin/python
class Duck:
sound = 'Quack quack.'
movement = 'Walks like a duck.'
def quack(self):
print(self.sound)
def move(self):
print(self.movement)
def main():
donald = Duck()
donald.quack()
donald.move()
if __name__ == '__main__':
main() |
"""Test the helper method for writing tests."""
import asyncio
import functools as ft
import json
import logging
import os
import uuid
import sys
import threading
from collections import OrderedDict
from contextlib import contextmanager
from datetime import timedelta
from io import StringIO
from unittest.mock import M... |
"""Utility functions to simplify construction of GNN layers."""
import collections
from typing import Any, Callable, Mapping, Optional, Set
import tensorflow as tf
from tensorflow_gnn.graph import adjacency as adj
from tensorflow_gnn.graph import graph_constants as const
from tensorflow_gnn.graph import graph_tensor... |
# coding: utf-8
"""
Intersight REST API
This is Intersight REST API
OpenAPI spec version: 1.0.9-255
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class WorkflowWorkflowMetaList(object):
"""
NOTE: T... |
"""An expanded decorator class for using Placebo when unit testing boto3 calls.
Typical usage examples:
bluepill.default_script = script(client_type="cloudformation",
folder_path="responses",
session=boto3_session)
@bluepill()
d... |
import openpyxl
import sys, os, requests, uuid, json
from requests.exceptions import HTTPError
from os import lseek, path
class c_Args:
'''
Argument initialization class
Update this to provide default
'''
def __init__ (self, **kwargs):
self._theSpreadsheet = kwargs['theSpreadsheet'] if 't... |
# -*- coding:utf-8 -*-
from __future__ import print_function, unicode_literals, division
from io import open
import glob
import os
import unicodedata
import string
import argparse
import torch
import torch.nn as nn
import random
import time
import math
import matplotlib.pyplot as plt
import matplotlib.ticker as tick... |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.util.prefix import Prefix
from spack.hooks.sbang import filter_shebang
import os
class Hip(CMakePackage):
... |
from django.urls import path
from company import views
from django.contrib.auth.views import LoginView
urlpatterns = [
path('companyclick', views.companyclick_view),
path('companylogin', LoginView.as_view(template_name='company/companylogin.html'),name='companylogin'),
path('companysignup', views.company_signup_view,n... |
# Copyright (c) 2017-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
from datetime import date
class Calendar:
day_name = [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday",
]
day_name_short = ["mon", "tue", "wed", "thu", "fri", "sat", "sun"]
def __init__(self, year=None, month=None):
... |
import os
import sys
sys.path.append("../../../monk/");
import psutil
from pytorch_prototype import prototype
from compare_prototype import compare
from common import print_start
from common import print_status
import torch
import numpy as np
from pytorch.losses.return_loss import load_loss
def test_layer_average_p... |
# # ⚠ 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... |
#
# 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 us... |
import numpy as np
import matplotlib.pyplot as plt
import glob
#from moviepy.editor import VideoFileClip
from collections import deque
from sklearn.utils.linear_assignment_ import linear_assignment
from kalman_tracker import helpers
from kalman_tracker import detector
from kalman_tracker import tracker
import cv2
# G... |
import asyncio
import logging
import sys
from pathlib import Path
import click
DEFAULT_STRIPE_SIZE = 65536
log = logging.getLogger(__name__)
def show_plots(root_path: Path):
from replaceme.plotting.util import get_plot_directories
print("Directories where plots are being searched for:")
print("Note tha... |
# -*- coding: utf-8 -*-
import re
import json
from httpretty import HTTPretty
from urlparse import parse_qs, urljoin
from collections import defaultdict
import time
import hashlib
from itertools import ifilter
PK = "_id"
def generate_etag():
""" Helper function for generating random etag. """
return hashlib.... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from datetime import date
import sys
if __name__ == '__main__':
# Список работников.
workers = []
# Организовать бесконечный цикл запроса команд.
while True:
# Запросить команду из терминала.
command = input(">>> ").lower()
# Вып... |
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
dataset = pd.read_csv('train.csv')
X = dataset.iloc[:, 1:4].values
y = dataset.iloc[:, 0].values
from sklearn.preprocessing import LabelEncoder, OneHotEncoder
labelencoder_X_1 = LabelEncoder()
X[:, 2] = labelencoder_X_1.fit_transform(X[:, 2])
oneh... |
#!/usr/bin/env python3
import logging as _logging
import sys as _sys
from enum import IntEnum as _IntEnum
class LogLevel(_IntEnum):
NONE = OFF = 0
CRITICAL = FATAL = 1
ERROR = 2
WARNING = WARN = 3
NOTICE = 4
INFO = 5
DEBUG = 6
TRACE = 7
ALL = 8
locals().update(LogLevel.__membe... |
import numpy as np
import biorbd_casadi as biorbd
from bioptim import (
OptimalControlProgram,
DynamicsFcn,
DynamicsList,
Bounds,
QAndQDotBounds,
InitialGuess,
ObjectiveFcn,
ObjectiveList,
ConstraintList,
ConstraintFcn,
InterpolationType,
Node,
BoundsList,
OdeSol... |
import gym
from gym import spaces
from gym.envs.registration import EnvSpec
import numpy as np
from gym.spaces import MultiDiscrete
class MultiAgentEnv(gym.Env):
"""Environment for all agents in the multiagent world.
currently code assumes that no agents will be created/destroyed at runtime!
"""
metad... |
import name_lib_main
my_name = "Fred"
my_length = name_lib_main.name_length(my_name)
my_lower_case = name_lib_main.lower_case_name(my_name)
print(f"In my code, my length is {my_length} and my lower case name is: {my_lower_case}") |
# author: Artan Zandian
# date: 2022-01-22
"""
Reads two source images, one as the initial content image and second as the target style image,
and applies Neural Style Transfer on the content image to create a stylized rendering of the content
image based on the texture and style of the style image.
Usage: python styl... |
# -*- coding: utf-8 -*-
"""
celery.five
~~~~~~~~~~~
Compatibility implementations of features
only available in newer Python versions.
"""
from __future__ import absolute_import
__all__ = ['Counter', 'reload', 'UserList', 'UserDict', 'Queue', 'Empty',
'zip_longest', 'map', 'string', 'stri... |
# Copyright 2022 MosaicML Composer authors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import typing
from typing import TYPE_CHECKING, Callable, Type
import pytest
from composer.datasets.dataset_hparams import DataLoaderHparams
from composer.trainer import Trainer
from composer.trainer.... |
from pytest import mark, fixture
from qmriddle import solve
@mark.parametrize('riddle', [
'?',
'?b',
'??',
'???',
'abc',
'a?',
'ab?',
'?a',
'??a',
'??b',
'??c',
'a?a',
'a?b',
'a?c',
'a?a?a',
'a?a?b',
'a?b?b',
'a?b?c',
'?a?b??c???d????',
'... |
from .DFMModel import (DFMModel_from_info, DFMModel_from_path,
DFMModelInfo, get_available_devices,
get_available_models_info) |
# Copyright 2014-2018 The PySCF Developers. 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 appl... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
"""Keyvaul... |
from dp_excel.ExcelRowOptions import ExcelRowOptions
from dp_excel.ExcelCell import ExcelCell
class ExcelRowTemplate:
def __init__(self):
self.rows = []
def __get_current_row(self):
return self.rows[-1]
def add_column(self, value, options=None, is_empty=False):
cell = ExcelCell(v... |
#!/usr/bin/env python
from __future__ import print_function
from roslibpy import Message, Ros, Topic
import rospy
import logging
import atexit
import signal
from bond.msg import Status
from sensor_msgs.msg import LaserScan
from std_msgs.msg import Float32
logging.basicConfig(level=logging.INFO)
global my
class ROSCl... |
from logging import getLogger
from que.erigonesd import cq
from que.exceptions import TaskLockError
redis = cq.backend.client
logger = getLogger(__name__)
KEY_PREFIX = cq.conf.ERIGONES_CACHE_PREFIX
def redis_set(key, value, timeout=None, nx=False):
# TODO: This code will be deprecated soon (related to redis 2.... |
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.transforms as transforms
from matplotlib.colors import Normalize
class _MidpointNormalize(Normalize):
def __init__(self, vmin=None, vmax=None, midpoint=None, clip=False):
self.midpoint = midpoint
Normali... |
from anytree import Node
from csv import reader
from pickle import dump
def make_category_tree(path_to_data):
parents = {}
nodes = {}
with open(path_to_data + '/categories.csv', newline='') as csvfile:
rdr = reader(csvfile, delimiter=',')
for row in rdr:
if (row[1] == 'id'):
... |
import numpy as np
from hotstepper.core.data_model import DataModel
from hotstepper.utilities.helpers import get_epoch_start
def apply_math_function(caller,other,math_function, sample_points=None):
"""
Apply the supplied function to two objects evaluated at the union of all their unique step keys.
For ex... |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2021, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#---------------------------------------------------... |
# O(log n) - but i don't know really why
# 2^100 = 2^50 * 2^50 so we can calculate x = 2^50 and then x * x = 2^50 * 2^50 = 2^100 so we don't have to calculate powers
# from 2^50 to 2^100
# 2^101 = 2^1 * 2^100 = 2^1 * (2^50 * 2^50) - we subtract 1 from odd exponents, we get even exponent, do the trick \
# for that eve... |
from flask import Flask, jsonify
import os
app = Flask(__name__)
@app.route('/')
def index():
return jsonify({"Choo Choo": "Welcome to your Flask app 🚅"})
if __name__ == '__main__':
app.run(debug=True, port=os.getenv("PORT", default=5000)) |
import csv
import numpy as np
import mediapipe as mp
import cv2
class_name = "Speaking"
mp_drawing = mp.solutions.drawing_utils # Drawing helpers
mp_holistic = mp.solutions.holistic # Mediapipe Solutions
str_source = input("dir:")
cap = cv2.VideoCapture(str_source)
# Initiate holistic model
with mp_holistic.Holist... |
from robotoy.components import pins
def main():
print(pins.MOTOR_LEFT_BACK)
if __name__ == "__main__":
main() |
##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... |
#!/usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2013, SRI International
# 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 ... |
from __future__ import absolute_import
from django.core.exceptions import ImproperlyConfigured
from django.utils.encoding import smart_unicode
from compressor.exceptions import ParserError
from compressor.parser import ParserBase
from compressor.utils.cache import cached_property
class LxmlParser(ParserBase):
@... |
import numpy as np
import time
print('1. 创建大小为 10 的空向量')
a = np.zeros(10)
print(a)
print('2. 查看矩阵占据的内存大小')
print('用元素个数乘以每个元素的大小')
print(f'占据 {a.size * a.itemsize} 字节')
print('3. 创建一个向量,值从 10 到 49')
a = np.arange(10, 50)
print(a)
print('4. 翻转一个向量')
a = a[::-1]
print(a)
print('5. 创建一个 3x3 的矩阵,值从 0 到 8')
a = np.aran... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... |
# -*- coding: utf-8 -*-
# A Survey on Negative Transfer
# https://github.com/chamwen/NT-Benchmark
import argparse
import os, sys
import os.path as osp
import numpy as np
import torch as tr
import torch.nn as nn
import torch.optim as optim
from scipy.spatial.distance import cdist
import torch.utils.data as Data
from uti... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The setup script."""
import sys
from pathlib import Path
from setuptools import setup, find_packages
def create_version_file(version):
print('-- Building version ' + version)
version_path = Path.cwd() / 'fastai' / 'version.py'
with open(version_path, 'w') ... |
#
# Copyright (c) 2021, 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 copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
from rest_framework import serializers
from goods.models import SKU
class CartAddSerializer(serializers.Serializer):
sku_id = serializers.IntegerField()
count = serializers.IntegerField(min_value=1,max_value=5)
selected = serializers.BooleanField(default=True,required=False)
def validated_sku_id(self,... |
import json
import logging
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
from evengsdk.api import EvengApi
from evengsdk.exceptions import EvengHTTPError, EvengLoginError
class EvengClient:
def __init__(
self,
host: str = None,
protocol: str = "h... |
from algorithmx import http_server
server = http_server(host="0.0.0.0", port=5050)
canvas = server.canvas()
def start():
canvas.nodes(range(1, 8)).add()
canvas.edges([(i, i + 1) for i in range(1, 7)] + [(1, 3), (2, 4), (2, 7)]).add()
for i in range(1, 8):
canvas.pause(0.5)
canvas.node(i)... |
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from de... |
from setuptools import setup, find_packages
import sys
if sys.version_info < (3,):
sys.exit("Sorry, Python3 is required.")
with open("README.md", encoding="utf8") as f:
readme = f.read()
setup(
name="nlpaug",
version="0.0.5",
author="Edward Ma",
author_email="makcedward@gmail.com",
url="h... |
from django.conf import settings
from django.contrib.comments.models import Comment
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.core.management.base import NoArgsCommand
from articles.models import Article
import simplejson as json
import re
import... |
from rest_framework import generics
from rest_framework.permissions import IsAuthenticated
from ..models import Credit
from ..permissions import IsInASociety
from ..serializers import CreditSerializer
class NewCreditView(generics.CreateAPIView):
"""
Make a contribution.
"""
permission_classes = (IsAuthenticated,... |
#!/usr/bin/env python3
import datetime
import os
import time
from pathlib import Path
from typing import Dict, Optional, Tuple
import psutil
from smbus2 import SMBus
import cereal.messaging as messaging
from cereal import log
from common.filter_simple import FirstOrderFilter
from common.numpy_fast import clip, interp... |
"""Generated client library for dataproc version v1."""
# NOTE: This file is autogenerated and should not be edited by hand.
from googlecloudsdk.third_party.apitools.base.py import base_api
from googlecloudsdk.third_party.apis.dataproc.v1 import dataproc_v1_messages as messages
class DataprocV1(base_api.BaseApiClient... |
"""
Test VAR Model
"""
from __future__ import print_function
# pylint: disable=W0612,W0231
from statsmodels.compat.python import (iteritems, StringIO, lrange, BytesIO,
range)
from nose.tools import assert_raises
import nose
import os
import sys
import numpy as np
import statsmod... |
import pandas as pd
# Baca file sample_tsv.tsv untuk 10 baris pertama saja
df = pd.read_csv("https://storage.googleapis.com/dqlab-dataset/sample_tsv.tsv", sep="\t", nrows=10)
# Cetak data frame awal
print("Dataframe awal:\n", df)
# Set index baru
df.index = ["Pesanan ke-" + str(i) for i in range(1, 11)]
# Cetak data fr... |
##
# 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
# distributed under the... |
# FiveTime.py
print('My name is')
i=0
while i<5:
print('Jimmy Five Times ('+str(i)+')')
i=i+1 |
from .modal_type_enum import *
class Modal:
def __init__(
self, message: str = "", type: MODAL_TYPE = MODAL_TYPE.SUCCESS, headline: str = "Hinweis"
):
self.modal_type = type
self.modal_msg = message
self.modal_headline = headline
def to_dict(self):
tmp_dict = {
... |
import unittest
import pathlib
import io
from igv_reports.feature import FeatureReader, _NonIndexed, parse_gff
from igv_reports import datauri
class FeatureFileTest(unittest.TestCase):
def test_query(self):
gff = str((pathlib.Path(__file__).parent / "data/minigenome/annotations.gtf.gz").resolve())
... |
"""
Build tool system for mining and building :)
Good luck!
"""
from random import randrange, randint, random
from ursina import Entity, color, texture, Vec3
from numpy import floor
class Mining_system:
def __init__(this, _subject, _axe, _camera, _subsets):
# We create a reference to these here,
... |
import unittest
import six
from pyrad import tools
try:
import ipaddress
except ImportError:
ipaddress = None
class EncodingTests(unittest.TestCase):
def testStringEncoding(self):
self.assertRaises(ValueError, tools.EncodeString, 'x' * 254)
self.assertEqual(
tools.EncodeSt... |
# Copyright 2019 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.
"""Provide a TestCase to facilitate testing LegacyPageTest instances."""
import shutil
import tempfile
import unittest
from telemetry.internal.results impo... |
from .utils import STRING_TYPE
###{standalone
class LarkError(Exception):
pass
class GrammarError(LarkError):
pass
class ParseError(LarkError):
pass
class LexError(LarkError):
pass
class UnexpectedInput(LarkError):
pos_in_stream = None
def get_context(self, text, span=40):
pos = se... |
#-----------------------------------------------------------------------
# VL53L1X - Example 3
#-----------------------------------------------------------------------
#
# Ported by SparkFun Electronics, October 2019
# Author: Nathan Seidle
# Ported: Wes Furuya
# SparkFun Electronics
#
# License: This code is public ... |
from typing import Sequence, TypeVar, Union
from hamcrest.core.base_matcher import BaseMatcher
from hamcrest.core.core.anyof import any_of
from hamcrest.core.description import Description
from hamcrest.core.helpers.wrap_matcher import wrap_matcher
from hamcrest.core.matcher import Matcher
__author__ = "Jon Reid"
__c... |
import gym
import numpy as np
import pytest
from gym import spaces
from stable_baselines3 import A2C, DDPG, DQN, PPO, SAC, TD3
from stable_baselines3.common.env_util import make_vec_env
from stable_baselines3.common.envs import BitFlippingEnv, SimpleMultiObsEnv
from stable_baselines3.common.evaluation import evaluate_... |
from .nidaq import Nidaq |
#!/usr/bin/env python
import webnsock
import web
from signal import signal, SIGINT
from os import path
class SimpleUIServer(webnsock.WebServer):
def __init__(self):
webnsock.WebServer.__init__(
self,
None,
# path.join(
# path.dirname(__file__),
... |
"""
Sequential feature selection
"""
from .._selection import (
_CUR,
_FPS,
_PCovCUR,
_PCovFPS,
)
class FPS(_FPS):
"""
Transformer that performs Greedy Feature Selection using Farthest Point Sampling.
Parameters
----------
initialize: int, list of int, or 'random', default=0
... |
# 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... |
# 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
# distributed unde... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.