content stringlengths 5 1.05M |
|---|
import json
import pandas as pd
from sklearn.linear_model import LinearRegression
from sklearn.datasets import fetch_california_housing
from sklearn.model_selection import train_test_split
import numpy as np
import mlflow
import matplotlib.pyplot as plt
import os
# loading the California housing dataset
cali_housing =... |
# parsetab.py
# This file is automatically generated. Do not edit.
_tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'rightASIGNARleftSUMARESTAleftMULTDIVrightUMINUSINCLUDE USING NAMESPACE STD COUT CIN GET CADENA RETURN VOID INT ENDL IDENTIFICADOR ENTERO ASIGNAR SUMA RESTA MULT DIV POTENCIA MODULO MINUSMINUS ... |
import collections
import json
import os
import threading
import time
from hydrus.core import HydrusConstants as HC
from hydrus.core import HydrusExceptions
from hydrus.core import HydrusImageHandling
from hydrus.core import HydrusThreading
from hydrus.core import HydrusData
from hydrus.core import HydrusGlobals as HG... |
import pandas as pd
import numpy as np
import math
class DPcovariance:
# Implementation is based off of https://github.com/privacytoolsproject/PSI-Library
def __init__(self, n, cols, rng, global_eps, epsilon_dist=None, alpha=0.05):
# TODO finish adding functionality for intercept
... |
import socket
import datetime
from dataclasses import dataclass, replace
from functools import partial
from typing import Any, Optional, Type, Callable, Dict, List
from xrpc.const import SERVER_SERDE_INST
from xrpc.dsl import rpc, regular, socketio, signal, DEFAULT_GROUP
from xrpc.generic import build_generic_context... |
import planckStyle as s
from pylab import *
g=s.plotter
g.settings.line_labels = False
g.settings.setWithSubplotSize(4)
g.settings.tight_layout=True
g.settings.lab_fontsize=32
g.settings.axes_fontsize = 24
g.settings.lw1 = 2
g.setAxes(lims=[0.0, 2.0, 0.0, 1.1])
roots=['base_mnu_planck_lowl_lowLike_highL','base_mnu_... |
from optparse import OptionParser
from classification_model import ClassificationModel
from regression_model import RegressionModel
def main():
parser = OptionParser()
parser.add_option('-m', '--model', type='string', help='Model name: {linear, dnn}')
parser.add_option('-t', '--tab', type='string', help=... |
from lxml import etree
from lxml.builder import E
from odoo import api, fields, models
from odoo.tools.translate import _
from odoo.addons.base.res.res_users import name_boolean_group, name_selection_groups
class GroupsView(models.Model):
_inherit = "res.groups"
is_custom_group = fields.Boolean(
"Cu... |
import numpy as np
from common import activations
from common import metrics
from math import ceil
from tqdm import tqdm
rng = np.random.default_rng(12345)
class NeuralNetworkModel:
def __init__(self, in_features=784, out_features=10, layers=3, channels=16, activation='relu', learning_rate=1e-4):
self.in... |
# To use this code, make sure you
#
# import json
#
# and then, to convert JSON from a string, do
#
# result = users_response_from_dict(json.loads(json_string))
from dataclasses import dataclass
from typing import Optional, Any, List, TypeVar, Type, cast, Callable
T = TypeVar("T")
def from_str(x: Any) -> s... |
# coding: utf-8
import pprint
import six
from enum import Enum
class DatabaseTranslatedStringItem:
swagger_types = {
'language': 'str',
'language_code': 'str',
'translation': 'str',
}
attribute_map = {
'language': 'language','language_code': 'languageCode','translat... |
#!/usr/bin/env python3
# coding: utf-8
import tldevicesync
tio = tldevicesync.DeviceSync()
syncStreams = tio.syncStreamsStart([tio.vmr0.vector,tio.vmr1.vector])
data = tio.syncStreamsRead(syncStreams, samples=3)
print(data) |
from conans import ConanFile, CMake
import shutil, os
class ConsumerConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False]}
default_options = "shared=False"
generators = "cmake"
exports_sources = "src/*"
build_requires = "source/0.1@user/testing"... |
from figures import FuzzySet
def main():
"""
1. number of inputs/outputs
1.1. how many input variables do you want?
1.2. how many output variables do you want?
2. configure inputs/outputs (range of separate i/o, name of each i/o, params of each i/o)
2.1 input_1 what a type of mf do you want ... |
#SNMP class
1.3.6.1.2.1.1.1
from snmp_helper import snmp_get_oid, snmp_extract
COMMUNITY_STRING = 'galileo'
SNMP_PORT = 161
IP = " "
device_name = (IP, COMMUNITY_STRING, SNMP_PORT)
OID = '1.3.6.1.2.1.1.0'
snmp_data = snmp_get_oid(device_name, oid=OID)
print snmp_data
output = snmp_extract(snmp_data)
print outp... |
# https://github.com/ssarfraz/SPL/blob/master/SPL_Loss/
import torch
import torch.nn as nn
import torch.nn.functional as F
import pdb
########################
# Losses
########################
## Gradient Profile (GP) loss
## The image gradients in each channel can easily be computed
## by simple 1-pixel shifted im... |
#!/usr/bin/env python3
#
# Copyright 2018 Google LLC
#
# Use of this source code is governed by an MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
import argparse
import errno
import random
import socket
import sys
import adiantum
def fail(msg):
sys.stderr.w... |
import socket
from datetime import datetime, timedelta
from functools import partial
from os import environ
from subprocess import check_output
from typing import List
import click
from click import Choice, ClickException
from plexapi.exceptions import NotFound, Unauthorized
from plexapi.myplex import MyPlexAccount, M... |
a=input('Digite algo:')
print('O tipo primitivo desse valor "{}" é: {}'.format(a, type(a)))
print('"{}" É um número ? "{}"'.format(a, a.isnumeric()))
print('"{}" É alfabético ? "{}"'.format(a, a.isalpha()))
print('"{}" É alfanúmerico ? "{}"'.format(a, a.isalnum()))
print('"{}" Só tem espaço ? "{}"'.format(a, a.isspace(... |
# Copyright 2019 1QBit
#
# 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 ... |
#!/afs/bx.psu.edu/project/pythons/linux-i686-ucs4/bin/python2.7
"""
Application to convert MAF file to AXT file, projecting to any two species.
Reads a MAF file from standard input and writes an AXT file to standard out;
some statistics are written to standard error. The user must specify the
two species of intere... |
from django.db import models
from django.core.validators import MinValueValidator
class Post(models.Model):
news = 'news'
article = 'article'
Posts = [(news, 'news'), (article, 'article'), ('select', 'select')]
choosing = models.BooleanField(default=False)
time_in = models.DateTimeField(auto_now_a... |
import pickle
import numpy as np
from flask import Flask, render_template, request
app = Flask(__name__)
model = pickle.load(open('svc_trained_model.pkl', 'rb'))
@app.route('/')
def home():
return render_template('index.html')
@app.route('/predict', methods=['POST'])
def predict():
features = [i... |
import gym
import numpy as np
import tensorflow as tf
from tensorflow.contrib.layers import fully_connected
def get_square_data(side_len):
def inner(batch_size):
data = np.random.rand(batch_size, 2) * side_len
labels = (data.sum(axis=1) > side_len).astype(int)
return data, labels
r... |
from __future__ import absolute_import, division, print_function
import io
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_array_equal
import pytest
from matplotlib.testing.decorators import image_comparison
import matplotlib.pyplot as plt
from matplotlib import patches, transforms
f... |
# Form implementation generated from reading ui file 'generator.ui'
#
# Created by: PyQt6 UI code generator 6.2.2
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt6 import QtCore, QtGui, QtWidgets
class Ui_... |
a, b, c = map(int, input().split())
if c-(a+b) > 0 and a*b*4 < (c-a-b)**2:
print('Yes')
else:
print('No')
|
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-10-12 08:13
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('clone', '0001_initial'),
]
operations = [
migrations.AlterField(
... |
""" Implementation of WaterFrame.max_diff(parameter1, parameter2) """
def max_diff(self, parameter1, parameter2):
"""
It calculates the maximum difference between the values of two parameters.
Parameters
----------
parameter1: str
Key name of column 1 to calculate the di... |
import ctypes
import ctypes.util
import re
import struct
from caw_memory_editors import MacOSX, CannotReadException
BASE_WORLD_NAME = "Von Haunt Estate".encode('utf-8')
REPLACE_WORLD_NAME = "Apple Fritters are tasty".encode('utf-8')
class ChangeWorldNames:
def __init__(self, process):
self.process = proce... |
# Generated by Django 3.2.4 on 2021-09-06 22:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('members', '0004_alter_profile_picture'),
]
operations = [
migrations.AddField(
model_name='profile',
name='degree',
... |
import sys
def parse_url(url, proj, DRS_len):
parts = line.split('/')
match = 0
for i,pp in enumerate (parts):
if pp == proj:
match = i
break
return '.'.join(parts[i:(i+DRS_len)])
def parse_openid(x):
parts = x.split('/')
return parts[2], parts[5]
|
import torch
import torch.nn as nn
import numpy as np
import cv2
from libs.backbone import BackboneVGG16, SSD
from libs.data import getDataLoader
from libs.utils import getAllName, seedReproducer
import os
os.environ["CUDA_VISIBLE_DEVICES"] = '0'
def predict(test_loader, model, device):
... |
from typing import Iterable
def folder(
api,
url: str,
http_method: str,
cloud_path: str,
limit=100,
offset=0,
sort={"type":"name","order":"asc"}) -> dict:
data = {
"home": cloud_path,
"token": api.csrf_token,
"limit": limit,
"offset": offset,
"s... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
owner_users = {'email': 'qa845@meta.ua',
'password': 'selenide'}
provider_users = {'lexins@bigmir.net': 'fondriest'
# 'qatest55@meta.ua': 'selenide',
# 'test-supply@meta.ua': '0564305488',
# 'Rudakov.d@meta.ua'... |
from collections import defaultdict
from dataclasses import dataclass, field
from pathlib import Path
from typing import DefaultDict, Dict, Generator, List
from ward._errors import ParameterisationError
from ward._fixtures import FixtureCache
from ward.fixtures import TeardownResult
from ward.models import Scope
from ... |
import pandas as pd
import numpy as np
import scipy as s
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn import preprocessing
plt.style.use('fivethirtyeight')
pd.set_option('display.max_columns', 500)
from pylab import cm
import warnings
warnings.filterwarnings('ignore')
from pywaffle import Waffl... |
import numpy as np
from collections import OrderedDict
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
import random
import sys
import os
import time
import argparse
import Data
import Model
from transformers import AdamW
parser = argparse.ArgumentParser(description='Trai... |
print('Omolewa is teaching a class')
print('Lanre is still making changes')
print('Omolewa has made a change too')
|
# coding: utf-8
# pylint: disable= invalid-name, unused-import
"""For compatibility and optional dependencies."""
import abc
import os
import sys
from pathlib import PurePath
assert (sys.version_info[0] == 3), 'Python 2 is no longer supported.'
# pylint: disable=invalid-name, redefined-builtin
STRING_TYPES = (str,)... |
# -*- coding: utf-8 -*-
"""
Pycharm
2019/3/28 10:25
zc-bnlp
RonWong
"""
|
# 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! ***
# Export this package's modules as members:
from .algorithm_type_ns_service import *
from .dhcp_relay_profile import *
from .dhcp_relay... |
import numpy as np
import sys
import warnings
warnings.filterwarnings('ignore')
import george
from george import kernels
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.gaussian_process.kernels import RBF,WhiteKernel, ConstantKernel as C, DotProduct, RationalQuadratic, Matern
from scipy.op... |
from django import template
from RollMarkingApp.models import Attendance, Absence
register = template.Library()
@register.filter
def filter_cadet_attendance(cadet, term_date):
return Attendance.objects.filter(cadet=cadet, meeting=term_date)
@register.filter
def filter_cadet_uniform(cadet, term_date):
return ... |
import pickle
from twisted.internet import defer
from jasmin.protocols.smpp.configs import SMPPClientConfig
from jasmin.protocols.cli.managers import Manager, Session
from jasmin.vendor.smpp.pdu.constants import (addr_npi_name_map, addr_ton_name_map,
replace_if_present_flap_name_m... |
import pygame
from math import pi
# Initialize the game engine
pygame.init()
# Define the colors we will use in RGB format
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
BLUE = (0, 0, 255)
GREEN = (0, 255, 0)
RED = (255, 0, 0)
# Set the height and width of the screen
size = [400, 300]
screen = pygame.display.set_mode(siz... |
# Copyright (c) 2018 Cloudify Platform Ltd. 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 ap... |
#!/usr/bin/env python3
"""Deploys documentation to GitHub pages.
If the environment variable :attr:`TRAVIS_BRANCH` is set, it overrides
the current git branch.
If the environment variable :attr:`GH_TOKEN` is set, it is used as the API
token.
"""
import os
import shutil
import subprocess as sub
import ... |
#!/usr/bin/env python3
#
# ~~~
# This file is part of the dune-gdt project:
# https://github.com/dune-community/dune-gdt
# Copyright 2010-2018 dune-gdt developers and contributors. All rights reserved.
# License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
# or GPL-2.0+ (... |
'''
/**
* created by cicek on 13.04.2018 10:03
*/
'''
# 3*(x**2) - y**2 = 8
# 8*(x**3) - 24*x = 1 problem kaç iterasyon sonrasında çözülür
from math import e
def f(x,y):
return 3 * (x ** 2) - y ** 2 - 8
def g(x,y):
return 8*(x**3) - 24*x - 1
def fx(x,y):
return 6*x
def fy(x,y):
return -2*y
def gx... |
from django.shortcuts import reverse
from wildlifelicensing.apps.main.tests import helpers as helpers
class RoutingViewTest(helpers.BasePermissionViewTestCase):
view_url = reverse('home')
@property
def permissions(self):
return {
'get': {
'allowed': self.all_users,
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: Tristan Le Guern <tleguern at bouledef.eu>
# 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
DOCUMENTATION = '''
---
module: proxmo... |
# AUTOGENERATED! DO NOT EDIT! File to edit: 00_core.ipynb (unless otherwise specified).
__all__ = ['Clusterer']
# Cell
import numpy as np
import pandas as pd
import warnings
with warnings.catch_warnings():
warnings.simplefilter("ignore")
from tslearn.clustering import TimeSeriesKMeans
from netdata_pandas.dat... |
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
import os
from posts import new_posts
def crear_carpeta(carpeta):
if not os.path.exists(carpeta):
os.makedirs(carpeta)
def generar_datos_post(plantilla,post):
return (plantilla.replace("*t",post["titulo"])
.replace("*d",post["resumen"])
.replace(... |
root = []
root[:] = [root, root, None]
print(root)
print(id(root))
print(id(root[0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0... |
import json
from functools import partial
import time
try:
from queue import Full, Empty
except ImportError:
from Queue import Full, Empty
from collections import namedtuple
from tornado.ioloop import IOLoop, PeriodicCallback
from tornado.httpclient import AsyncHTTPClient
from tornado.escape import json_decode... |
from .evaluation import EvalSection
from django.db import models
class Polygraphic(EvalSection):
eval_data = models.OneToOneField(
'drf_schemas.Item',
null=True,
on_delete=models.CASCADE,
related_name='polygraphic_eval'
)
|
#
# * This library is free software; you can redistribute it and/or
# * modify it under the terms of the GNU Lesser General Public
# * License as published by the Free Software Foundation; either
# * version 2.1 of the License, or (at your option) any later version.
# *
# * This library is distributed in the hope that ... |
# -*- coding: utf-8 -*-
import re
from cms.models import CMSPlugin
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from cms.utils.plugins import downcast_plugins
from tests.models import DummyLink, DummySpacer, DummyText
from djangocms_translations.utils import get_text_field_child_... |
# Copyright (c) 2020 PaddlePaddle 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 app... |
import os
from datetime import datetime
from collections import OrderedDict
#-------------------------------------------------------------------------------
class SpecfitParser:
"""Parse and modify parameter files for the SpecFit task"""
def __init__(self, filename, ext=-1):
self.filename = filename
... |
# Generated by Django 3.1.8 on 2021-04-13 07:09
from decimal import Decimal
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("store", "0002_auto_20210413_0706"),
]
operations = [
migrations.AlterField(
... |
from __future__ import absolute_import
from .exceptions import CartesianMotionError
from .analytical_inverse_kinematics import AnalyticalInverseKinematics
from .analytical_plan_cartesian_motion import AnalyticalPlanCartesianMotion
from .solvers import (
OffsetWristKinematics,
SphericalWristKinematics,
UR... |
import pixellib
from pixellib.tune_bg import alter_bg
change_bg = alter_bg()
change_bg.load_pascalvoc_model(
"deeplabv3_xception_tf_dim_ordering_tf_kernels.h5")
change_bg.color_bg(
"img/sample.jpg", colors=(0, 128, 0), output_image_name="colored_bg.jpg"
)
|
"""
Protocol buffer writer in Python
author: Atsushi Sakai
"""
import addressbook_pb2
def main():
print("start!!")
address_book = addressbook_pb2.AddressBook()
person1 = address_book.people.add()
person1.id = 1234
person1.name = "John Doe"
person1.email = "jdoe@example.com"
# perso... |
import time
import unittest
from paprika import sleep_after, sleep_before, repeat
class UtilityTestCases(unittest.TestCase):
# We cannot be too sure that sleeping exceeds the time, so give it 10ms leeway
SLEEP_TOLERANCE = 0.01
def test_sleep_after(self):
start = time.perf_counter()
@sle... |
class Query:
"""Range Query representation
Query have some QueryConditions
"""
def __init__(self, conditions):
"""
Args:
conditions (QueryCondition[]): list of QueryCondition
"""
self.conditions = conditions
def show(self):
"""Print q... |
from metagraph import translator, dtypes
from metagraph.plugins import has_pandas, has_scipy
import numpy as np
from .. import has_cudf
from metagraph.plugins.numpy.types import NumpyNodeSet, NumpyNodeMap, NumpyVector
from metagraph.plugins.python.types import PythonNodeSet, PythonNodeMap, dtype_casting
if has_cudf:
... |
import contextlib
import os
import re
import secrets
import shutil
from pathlib import Path
from flask import Flask
from pygluu.kubernetes.gui.extensions import csrf, socketio, gluu_settings
from pygluu.kubernetes.gui.views.main import main_blueprint
from pygluu.kubernetes.gui.views.wizard import wizard_blueprint
fro... |
"""
Copyright (c) Nikita Moriakov and Jonas Teuwen
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import pathlib
import SimpleITK as sitk
import numpy as np
DICOM_MODALITY_TAG = '0008|0060'
_DICOM_VOI_LUT_FUNCTION = '0028|1056'
_DICOM_WINDOW... |
WTF_CSRF_ENABLED = True
SECRET_KEY = 'Bleh'
|
def max_dot_product(a, b):
#write your code here
res = 0
a=sorted(a)
b=sorted(b)
for i in range(len(a)):
res += a[i] * b[i]
return res
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
print(max_dot_product(a, b))
|
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible 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) any later version.
#
# Ansible is distribut... |
"""
Support for getting current pollen levels from Pollenkollen.se
Visit https://pollenkoll.se/pollenprognos/ to find available cities
Visit https://pollenkoll.se/pollenprognos-ostersund/ to find available allergens
Example configuration
sensor:
- platform: pollenniva
scan_interval: 4 (default, optional)
st... |
import os
import argparse
import torch
import torch.nn as nn
from torch.nn import functional as F
from torch.autograd import Variable
from torch.utils.data import DataLoader
from torch.optim.lr_scheduler import ReduceLROnPlateau
from Yolo_v2_pytorch.src.anotherMissOh_dataset import AnotherMissOh, Splits, SortFullRect, ... |
"""
Authorization Utilities
"""
from shared.models.user_entities import User
from shared.service.jwt_auth_wrapper import JWTAuthManager
manager = JWTAuthManager(oidc_vault_secret="oidc/rest",
object_creator=lambda claims, assumed_role, user_roles: User(
first_name=... |
import os
from mock import patch, Mock
from unittest import skipUnless
from unittest import skip
from testconfig import config
import logging
logger = logging.getLogger("test")
logger.setLevel(logging.DEBUG)
from tests.integration.core.chroma_integration_testcase import ChromaIntegrationTestCase
class TestHsmCoord... |
# Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved. Contact: Pasi Eronen <pasi.eronen@nokia.com>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributio... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (division, print_function, unicode_literals)
import warnings, sys, os, inspect, fileinput, re
from future.builtins import *
__all__ = ['main']
warnings.simplefilter('module')
setX = 'problems_perl'
def xform_args(args, path_pfx):
return map... |
import numpy as np
import pandas as pd
import tensorflow as tf
from tensorstream.finance.signals import MovingAverageConvergenceDivergenceSignal as MACDSignal
from tensorstream.tests import TestCase
class MACDSignalSpec(TestCase):
def setUp(self):
self.sheets = self.read_ods(
self.from_test_res('macd_sign... |
PRICE_TABLE = {
'A': 50,
'B': 30,
'C': 20,
'D': 15,
'E': 40,
'F': 10,
'G': 20,
'H': 10,
'I': 35,
'J': 60,
'K': 70,
'L': 90,
'M': 15,
'N': 40,
'O': 10,
'P': 50,
'Q': 30,
'R': 50,
'S': 20,
'T': 20,
'U': 40,
'V': 50,
'W': 20,
'... |
import numpy as np
import random
'''
just a little structure to hold extra data
'''
class ExperienceInput(object):
def __init__(self, niter, prev_fs, rs, actions, next_fs, terminal):
self.niter = niter
self.prev_fs = prev_fs
self.rs = rs
self.actions = actions
self.next_fs ... |
import logging
def get_logger(filename):
logger = logging.getLogger("logger")
logger.setLevel(logging.DEBUG)
logging.basicConfig(format="%(message)s", level=logging.DEBUG)
handler = logging.FileHandler(filename)
handler.setLevel(logging.DEBUG)
handler.setFormatter(logging.Formatter("%(asctime)s... |
exchange_rate_url = 'http://api.hnb.hr/tecajn/v2?valuta=EUR&valuta=USD&valuta=GBP'
country_name_list = (
'Afghanistan',
'Albania',
'Algeria',
'Andorra',
'Angola',
'Antigua & Deps',
'Argentina',
'Armenia',
'Australia',
'Austria',
'Azerbaijan',
'Bahamas',
'Bahrain',
... |
import pandas as pd
def mono_channels(file):
"""Defines the column name for each monotonic data channel based on the
channel headers.
Defines stress and geometry columns separately from others b/c
some data will have stress, some will not. Same with geometry"""
#Read data file...
data = pd.r... |
'''IR Codes for Sony BluRay (remote RMT-VB310U)
These are derived from code set #6528 from the Global Cache IR code database ("Control Tower").
They seem to have been compiled from multiple sources, hence the slight variations in timing
from one code to another.
'''
CARRIER_FREQUENCY = 40000
REPEAT_OFFSET = 1
REPEAT... |
# GENERATED BY KOMAND SDK - DO NOT EDIT
import insightconnect_plugin_runtime
import json
class Component:
DESCRIPTION = "Return all new alerts"
class Input:
FREQUENCY = "frequency"
class Output:
ALERT = "alert"
class GetAlertsInput(insightconnect_plugin_runtime.Input):
schema =... |
import pdb
class irange:
def __init__(self, *args):
if len(args) == 0:
raise TypeError("irange expected 1 arguments, got 0")
elif len(args) > 3:
raise TypeError(
"irange expected at most 3 arguments got {l}"
.format(l=len(args))
... |
import os
import shutil
import sys
import tempfile
from typing import List, Tuple
import numpy
from scipy.sparse.csr import csr_matrix
from labours.cors_web_server import web_server
IDEAL_SHARD_SIZE = 4096
def train_embeddings(
index: List[str],
matrix: csr_matrix,
tmpdir: None,
shard_size: int = I... |
from docker.errors import APIError, ImageNotFound
import click
from gigantumcli.dockerinterface import DockerInterface
from gigantumcli.changelog import ChangeLog
from gigantumcli.utilities import is_running_as_admin
@click.command()
@click.option('--edge', '-e', type=bool, is_flag=True, default=False,
... |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from google.ads.google_ads.v6.proto.resources import keyword_plan_ad_group_pb2 as google_dot_ads_dot_googleads__v6_dot_proto_dot_resources_dot_keyword__plan__ad_... |
import os
import pytest
from common import PORTS
@pytest.mark.parametrize("ports", PORTS)
def test_main(ports, mock_device, monkeypatch, capsys):
from numato_gpio.__main__ import main
monkeypatch.setattr("serial.Serial.ports", ports)
main()
cap = capsys.readouterr()
assert cap.out.startswith(f"D... |
import json
import os
import re
import subprocess
import time
import zipfile
import config.config
all_cap_csv = re.compile(r'capture-[0-9]+\.(cap|csv)$')
def save_data(to_save: dict, path: str) -> None:
with open(path, 'w') as save_file:
save_file.writelines(json.dumps(to_save, sort_keys=True, indent=4)... |
from django.utils import timezone
from django.db import connection, transaction
from validr import T
from rssant_common.detail import Detail
from rssant_api.monthly_story_count import MonthlyStoryCount
from .helper import Model, ContentHashMixin, models, optional, User
from .feed import Feed, UserFeed
MONTH_18 = tim... |
import numpy as np
import urllib
import time
import cv2
from yolact_edge.inference import YOLACTEdgeInference
weights = "yolact_edge_resnet50_54_800000.pth"
# All available model configs, depends on which weights
# you use. More info could be found in data/config.py.
model_configs = [
'yolact_edge_mobilenetv2_conf... |
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('register', views.register, name='register'),
path('logout', views.logout, name='logout'),
path('accounts/leave/', views.employee_form,name='employee_insert'),
path('accounts/leave/<int:i... |
import pandas as pd
import os
import datetime
import fsspec
import xarray as xr
def add_time_info(df,verbose=False):
'''add start, stop and nt for all zstores in df'''
starts = []; stops = []; nts = []; calendars = []; units = []; ttypes = []
dz = df.copy()
for index, row in df.iterrows():
zsto... |
from kivy.app import App
from kivy.config import Config
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen, FadeTransition
from MainPanel import MainPanel
from ConfigureScreen import Configure
Config.set('graphics', 'fullscreen', 'auto') # 'auto' -> Fullscreen | '0' -> Normal... |
"""
lvsfunc, a collection of VapourSynth functions and wrappers written and/or modified by LightArrowsEXE.
If you spot any issues, please do not hesitate to send in a Pull Request
or reach out to me on Discord (LightArrowsEXE#0476)!
"""
# flake8: noqa
from . import (aa, comparison, dehalo, dehardsub, dei... |
import os
import pytest
AWNAS_TEST_NASBENCH = os.environ.get("AWNAS_TEST_NASBENCH", None)
@pytest.mark.skipif(not AWNAS_TEST_NASBENCH, reason="do not test the nasbench301 BTC by default.")
@pytest.mark.parametrize("case", ["xgb_v0.9", "gnn_gin_v0.9"])
def test_nb301_query(case):
from aw_nas.btcs.nasbench_301 impo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.