text stringlengths 2 999k |
|---|
#!/usr/bin/env python
# pylint: disable=too-many-ancestors
# pylint: disable=invalid-name
"""No-frills temperature conversion utility in Python2 & Python3.
"""
try:
import tkinter as tk
except ImportError:
import Tkinter as tk
def convert_f2c(f_in):
"""Convert the value in temp_data from Fahrenheit to Ce... |
"""
Implements handlers required on top of aiosmtpd for testing.
"""
import asyncio
import base64
import logging
import socket
import threading
from email.errors import HeaderParseError
from email.message import Message
from aiosmtpd.handlers import Message as MessageHandler
from aiosmtpd.smtp import MISSING
from aios... |
import numpy as np
def Rx(theta):
return np.array([[ 1, 0 , 0 ],
[ 0, np.cos(theta),-np.sin(theta)],
[ 0, np.sin(theta), np.cos(theta)]])
def Ry(theta):
return np.array([[ np.cos(theta), 0, np.sin(theta)],
[ 0 ,... |
##############################################################################
#
# Copyright (c) 2006-2007 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.
# THI... |
from enum import Enum
class NoTagError(Exception):
pass
class TransmissionError(Exception):
pass
class Commands(Enum):
PCD_IDLE = 0x00
PCD_AUTHENT = 0x0E
PCD_RECEIVE = 0x08
PCD_TRANSMIT = 0x04
PCD_TRANSCEIVE = 0x0C
PCD_RESETPHASE = 0x0F
... |
import sys
def deduce_vertices_from_edges(edges):
""" Create the vertices list from the edges list. Thus, the graph cannot contain an isolated vertex. """
vertices = set()
for e in edges:
vertices.add(e[0])
vertices.add(e[1])
return vertices
def weight_of(vertex1, vertex2... |
# Generated by Django 2.0.5 on 2020-02-11 01:30
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('TCS', '0050_auto_20190918_1247'),
('TCS', '0050_auto_20191127_2331'),
]
operations = [
]
|
import csv, sys
from collections import namedtuple
import twobitreader as tbr
from tqdm import tqdm
from collections import defaultdict
from itertools import cycle
from mutagene.dna import chromosome_name_mapping
from mutagene.motifs import nucleotides, complementary_nucleotide
import logging
logger = logging.getLo... |
# --------------------------------------------------------
# Visual Detection: State-of-the-Art
# Copyright: Hanbo Zhang
# Licensed under The MIT License [see LICENSE for details]
# Written by Hanbo Zhang
# --------------------------------------------------------
import torch
import torch.nn as nn
import torch.nn.func... |
import codecademylib3_seaborn
from matplotlib import pyplot as plt
import numpy as np
import pandas as pd
# Bar Graph: Featured Games
games = ["LoL", "Dota 2", "CS:GO", "DayZ", "HOS", "Isaac", "Shows", "Hearth", "WoT", "Agar.io"]
viewers = [1070, 472, 302, 239, 210, 171, 170, 90, 86, 71]
# Pie Chart: League of Leg... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: flyteidl/admin/execution.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from go... |
# -*- coding: utf-8 -*-
#
# contrail-api-cli-extra documentation build configuration file, created by
# sphinx-quickstart on Wed Aug 24 09:17:32 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenera... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-11-30 18:11
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('blog', '0008_category'),
]
operations = [
... |
import math
import torch
import torch.nn as nn
#import torchvision
from . import block as B
#from . import spectral_norm as SN
#import functools #for RRDBS
#import torch.nn.functional as F #for RRDBS
#import models.archs.arch_util as arch_util #for RRDBS
####################
# RRDBNet Generator
####################
... |
"""
Copyright (c) 2016-2019 Keith Sterling http://www.keithsterling.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 without restriction, including without limitation
the rights to use, copy, m... |
"""
WSGI config for seriescope project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SE... |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Intangible()
result.template = "object/draft_schematic/structure/city/shared_cloning_tatooine.iff"
result.attribu... |
import os.path as osp
import torch
import torch.nn.functional as F
from torch.nn import Sequential, Linear, ReLU, GRU
import scripts.study_case.ID_4.torch_geometric.transforms as T
from scripts.study_case.ID_4.torch_geometric.datasets import QM9
from scripts.study_case.ID_4.torch_geometric.nn import NNConv, Set2Set
f... |
from django.http import Http404, HttpResponse
from django.shortcuts import render
from django.views.decorators.cache import cache_control
from .calendar import calendar_for_branch
from .fetch import fetch_next_days_for_branch
from .models import Branch
@cache_control(max_age=60 * 60 * 24, public=True)
def index(requ... |
# -*- coding: utf-8 -*-
"""trains DCGAN on mnist for 20 epochs and creates grid display genarated from fixed noise
Example:
in parent directory: python experiments/01basic_mnist.py
Todo:
grid display
move check directory to utils
move default result directory to result
__author__ = '{Jimmy ... |
# -*- coding: utf-8 -*-
import os
from setuptools import setup
from mock_server import __version__
root_dir = os.path.dirname(__file__)
def read(fname):
with open(os.path.join(root_dir, fname)) as f:
return f.read()
with open(os.path.join(root_dir, "requirements.txt")) as f:
install_requires = [r.s... |
# Make some plots of atmospheric refraction vs. wavelength for different zenith angles.
# Overplot the LSST filter bandpasses for reference.
import os
import numpy as np
import matplotlib.pyplot as plt
import _mypath
import chroma
datadir = '../../data/'
def refraction_vs_zenith():
zeniths = np.linspace(0, 70,... |
import tensorflow as tf
from absl import flags
from absl.testing import absltest
from scipy import stats
from distributions import compute_wass_dist, compute_co_raw_m2_loss, compute_mean_loss, compute_var_loss, \
compute_covar_loss, compute_skew_loss, sample_k
FLAGS = flags.FLAGS
class TestDistributions(absltes... |
"""
WSGI config for _main project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTIN... |
"""This module contains the ipvAuth instance to handle authentications"""
import ipviking_api_python.helpers.constants as ipv_consts
from ipviking_api_python.auth.objects import ipvAuthorizer
APIKEY = ipv_consts.SANDBOX_APIKEY
PROXY = ipv_consts.PROXIES['SANDBOX']
IPV_AUTH = ipvAuthorizer().configure(apikey = APIK... |
#!/usr/bin/python
#
# Copyright 2018-2020 Polyaxon, 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 ... |
# Copyright (c) 2012 OpenStack Foundation.
#
# 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... |
# lint as: python3
# 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 ... |
from utils.rpc_type import *
from data.config import Constants, Statics
def get_search_params(src: str, key: str, page: int = 0):
if src not in Constants.SEARCH_SRC:
return None
params_type = Constants.SEARCH_SRC[src]['params_type']
if params_type == 'kwargs':
return {"key": key, "page": p... |
# coding: utf-8
"""
ThingsBoard REST API
ThingsBoard open-source IoT platform REST API documentation. # noqa: E501
OpenAPI spec version: 3.3.3-SNAPSHOT
Contact: info@thingsboard.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
impo... |
# encoding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from .cbs import CBSBaseIE
from ..utils import (
parse_duration,
)
class CBSNewsIE(CBSBaseIE):
IE_DESC = 'CBS News'
_VALID_URL = r'https?://(?:www\.)?cbsnews\.com/(?:news|videos)/(?P<id>[\da-z_-]+)'
_TESTS = ... |
import pandas as pd
import numpy as np
def get_pooled_mean(n_i: np.array, mu_i: np.array) -> np.array:
return np.sum(n_i * mu_i) / np.sum(n_i)
def get_pooled_sd(n_i: np.array, mu_i: np.array, sd_i: np.array) -> np.array:
# TODO: check this formula, source: wikipedia.org
return np.sqrt(
(
... |
import sys
import time
import pyautogui
pyautogui.FAILSAFE = False
autogui_map = {"ESCAPE":"escape",
"ESC":"esc",
"ENTER":"enter",
"UP":"up",
"DOWN":"down",
"LEFT":"left",
"RIGHT":"right",
"UPARROW":"up",
"DOWNARROW":"down",
"LEFTARROW":"left",
"RIGHTARROW":"right",
"F1":"f1",
"F2":"f2",
"F3":"f3",
"F4":"f4",
"F5":"f... |
from torch.utils.data import Dataset
import nibabel as nib
import numpy as np
import random
class TrainDataset(Dataset):
def __init__(self, root_dir, args):
self.root_dir = root_dir
self.num_input = args.num_input
self.length = int(len(self.root_dir)/self.num_input)
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Each function returns Stan model code that are appropriate for modeling
distributions of binary or proportions data.
"""
def beta_binomial():
"""
Return Stan code for for a Beta-Binomial model that compares two samples
based on their summary statistics. Must ... |
import socket
import numpy as np
from multiprocessing import Array, Value, Process
import cv2
from time import sleep
NUMBOTS = 12
MEMORYDEPTH = 10
HOSTNAME = "localhost"
PORT = 1917
class pos():
def __init__(self):
xpos = np.zeros(MEMORYDEPTH*NUMBOTS,dtype=np.int16,order="C")
ypos = np.zeros(MEMOR... |
#!/usr/bin/env python3
import argparse
import subprocess
import os
def build_systemd_image(image_name, source_path):
"""
Build docker image with systemd at source_path.
Built image is tagged with image_name
"""
subprocess.check_call([
'docker', 'build', '-t', image_name, source_path
]... |
# OBSS SAHI Tool
# Code written by Fatih C Akyon, 2021.
from typing import List, Union
from sahi.prediction import ObjectPrediction
from sahi.annotation import Mask, BoundingBox, Category
import numpy as np
import copy
def calculate_area(box: Union[List[int], np.ndarray]) -> float:
"""
Args:
box (Lis... |
import unittest
from mock import patch, Mock
from munch import Munch
from pysvc import errors as svc_errors
from pysvc.unified.response import CLIFailureError
import controller.array_action.config as config
import controller.array_action.errors as array_errors
from controller.array_action.array_mediator_svc import SV... |
import logging
logger = logging.getLogger(__name__)
import os
import multiprocessing
import subprocess
from .content_extensions import ContentExtensionsList
KOLIBRI_BIN = "kolibri"
class KolibriServiceSetupProcess(multiprocessing.Process):
"""
Does initial setup for Kolibri such as scanning for pre-instal... |
#!/usr/bin/python
# encoding: utf-8
#pylint: disable=R0904
""" The openjson writer test class """
# upconvert.py - A universal hardware design file format converter using
# Format: upverter.com/resources/open-json-format/
# Development: github.com/upverter/schematic-file-converter
#
# Copyright 2011 Upverter, I... |
# The MIT License
#
# Copyright (c) 2008 Bob Farrell
# Copyright (c) 2012-2021 Sebastian Ramacher
#
# 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 without restriction, including without limi... |
#!C:\Users\jerry\AppData\Local\RLBotGUI\MyBots\BeardBot\BeardBot\venv\Scripts\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'setuptools==40.8.0','console_scripts','easy_install'
__requires__ = 'setuptools==40.8.0'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re... |
from fibertree import Fiber, Tensor, TensorImage
a = Fiber([ 0, 2, 8], [ 5, 6, 7 ])
a.print("Fiber")
i = TensorImage(a)
i.show()
|
import gym
import railrl.torch.pytorch_util as ptu
from railrl.data_management.obs_dict_replay_buffer import ObsDictRelabelingBuffer
from railrl.exploration_strategies.base import \
PolicyWrappedWithExplorationStrategy
from railrl.exploration_strategies.gaussian_and_epislon import \
GaussianAndEpislonStrategy
... |
from functools import wraps
def validate_params(valid_options, params):
"""
Helps us validate the parameters for the request
:param valid_options: a list of strings of valid options for the
api request
:param params: a dict, the key-value store which we really only care about... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
ANSIBALLZ_WRAPPER = True # For test-module script to tell this is a ANSIBALLZ_WRAPPER
import os
import os.path
import sys
import __main__
scriptdir = None
try:
scriptdir = os.path.dirname(os.path.realpath(__main__.__file__))
except (AttributeError, OSError):
pass
if scr... |
"""
Code that goes along with the Airflow tutorial located at:
https://github.com/apache/airflow/blob/master/airflow/example_dags/tutorial.py
"""
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from datetime import datetime, timedelta
default_args = {
'owner': 'airflow',
'depe... |
## IMPORTANT: Must be loaded after `02-service-common.py
## announcement service
service_env = dict()
service_url = f'{hub_hostname}:{service_port}'
if c.JupyterHub.internal_ssl:
# if we are using end-to-end mTLS, then pass
# certs to service and set scheme to `https`
# TODO: Generate certs automatic... |
from bs4 import BeautifulSoup
import re
import spacy
class sturm_tei_file():
def __init__(self, filename,nlp=None,with_position_tags=False):
self._allowed_tags={'persName':[],'persname':[],'placeName':[],'placename':[],'date':[]}
self._pagelist=[]
self._soup=None
self._note_list=[]... |
import re
token_reg_ex = {
"DAY": re.compile("^\\d{1,2}[,\\.]?:?$"),
"YEAR": re.compile("^[12]\\d{3}[,\\.]?:?$"),
"DATE_SHORT": re.compile(
"^(([0-3]?[0-9][/.-][0-3]?[0-9][/.-](?:[0-9]{2})?[0-9]{2})|" +
"((?:[0-9]{2})?[0-9]{2}[/.-][0-3]?[0-9][/.-][0-3]?[0-9]))[,\\.]?:?$"),
"TIME": re.co... |
"""
Django settings for pipeline_sdk_use project.
Generated by 'django-admin startproject' using Django 1.8.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Bui... |
from fennel.cli import cli
cli()
|
"""
Swaggy Jenkins
Jenkins API clients generated from Swagger / Open API specification # noqa: E501
The version of the OpenAPI document: 1.1.2-pre.0
Contact: blah@cliffano.com
Generated by: https://openapi-generator.tech
"""
import sys
import unittest
import swaggyjenkins
from swaggyjenkins.mo... |
#!/usr/bin/env python3
from glob import glob
from os import getcwd
from shutil import move
from sys import argv
print(argv)
if len(argv) < 4:
print(f"Usage: <name> <season> <extension>")
quit()
name = argv[1]
season = argv[2]
ext = argv[3]
files = sorted(glob(f"{getcwd()}/*.{ext}"))
to_move = []
for index, ... |
#!/usr/bin/env python3
"""
Script that automatically install Gil projects by:
- creating a link to project shellscript from main .bashrc.sh
"""
from subprocess import *
import subprocess
import shutil
import json
import sys
import os
try:
range = xrange
except NameError:
pass
def is_float(s):
... |
from codecs import open as codecs_open
from setuptools import setup, find_packages
# Get the long description from the relevant file
with codecs_open('README.md', encoding='utf-8') as f:
long_description = f.read()
setup(name='stacker',
version='0.0.1',
description=u"Image stacker.",
long_descri... |
from .properties import *
from .panels import *
from .operators import *
|
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
See "Gaussian Error Linear Units (GELUs)" by Dan Hendrycks and Kevin Gimpel with
the corresponding GitHub repo: https://github.com/hendryck... |
# Copyright (c) 2021-2021, Camptocamp SA
# 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... |
# Copyright (c) 2016 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 applic... |
from spotify_dl.youtube import fetch_youtube_url, get_youtube_dev_key
def test_fetch_youtube_url(capsys):
song_link = fetch_youtube_url("Red Hot Chili Peppers - Dani California [Official Music Video]",
get_youtube_dev_key())
assert song_link == 'https://www.youtube.com/watc... |
#!/usr/bin/env python3
# Copyright (c) 2017-2020 The Elixir Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test various command line arguments and configuration file parameters."""
import os
import time
from t... |
"""
13.Tendo como dado de entrada a altura (h) de uma pessoa, construa um algoritmo que
calcule seu peso ideal, utilizando as seguintes fórmulas:
H)Para homens: (72.7*h) - 58
M)Para mulheres: (62.1*h) - 44.7
"""
gen = str(input("Digite o seu sexo [Masculino/Feminino]: ")).strip().upper()[0]
while gen not in "FM":
... |
# Copyright 2020 Alibaba Group Holding Limited. 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 ... |
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:'
}
}
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'bridgekeeper',
]
SECRET_KEY = 'correct horse battery staple'
ROOT_URLCONF = 'bridgekeepe... |
import contextlib
import logging
import os
import shutil
import subprocess
import sys
import zipfile
from tempfile import mkdtemp
from typing import Optional
from dbnd._core.current import is_verbose
from targets import DirTarget
logger = logging.getLogger(__name__)
def _get_package_name_and_version_from_whl(whl_... |
#!/usr/bin/python3
"""
Indykey
A library for controlling keyboard backlight brightness
Copyright 2019 Gaven Royer <gavroyer@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright notice
and this permissio... |
# coding=utf-8
"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response
class PhoneNumberTestCase(Integr... |
DATABASE_AUTO_CREATE_INDEX = True
DATABASE_CASE_INSENSITIVE_INDEX = False
DATABASES = {
'default': {
'db': 'config',
'host': 'localhost',
'port': 27017,
'username': '',
'password': ''
}
}
CACHES = {
'default': {},
'local': {
'backend': 'spaceone.core.cach... |
"""
Script that trains multitask models on hiv dataset.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import numpy as np
import deepchem as dc
from hiv_datasets import load_hiv
# Only for debug!
np.random.seed(123)
# Load hiv dataset
n_features = 51... |
from __future__ import annotations
from dataclasses import dataclass
from typing import List
import datetime
import re
import xml.etree.ElementTree as ET
from .contribution_info import ContributionInfo
from .relaton_bib import to_ds_instance
@dataclass
class CopyrightAssociation:
from_: datetime.date
owner:... |
from .exceptions import Auth0Error, RateLimitError, TokenValidationError
|
# flake8: noqa
from allegro.utils.soup import get_soup
from allegro.utils.check import check_soup, check_captcha
|
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
import pymongo
import ScrapyCrawl.myUtil as myUtil
class ScrapycrawlPipeline(object):
def __init__(self, mongo_uri, mong... |
# 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... |
import sys
# ------------------------------------------------------------------------------
# PyQt5
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
import pista as base
# ------------------------------------------------------------------------------
# ----------------------------------------------------------... |
import sqlite3
from flask import g
DB_FILEPATH = './database/garage.db'
def get_db():
if 'db' not in g:
g.db = sqlite3.connect(DB_FILEPATH)
g.db.row_factory = sqlite3.Row
# enforce foreign key constraints for this connection
# unfortunately this setting does not persist and ha... |
import lmdb
import cv2
import numpy as np
import os
OUT_PATH = '/home/ljs/OCR_dataset/CRNN_DATA/test_lmdb'
IN_PATH = '/home/ljs/OCR_dataset/CRNN_DATA/images/360_test.txt'
PREFIX = '/home/ljs/OCR_dataset/CRNN_DATA/images'
def checkImageIsValid(imageBin):
if imageBin is None:
return False
try:
... |
class Set(object):
def __init__(self, l, c):
self.parent = self
self.rank = 0
self.label = l
self.col = c
|
import json
import sys
import csv
with open(sys.argv[1], "r") as file:
data = json.load(file)
with open(sys.argv[1] + ".csv", "w", newline='', encoding='utf-8') as csvfile:
writer = csv.writer(csvfile)
writer.writerow(
("time", "velocity", "acceleration", "x", "y", "radians", "curvat... |
from django.apps import AppConfig
class ExplorerConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "swapi_explorer.explorer"
|
"""show_lldp.py
supported commands:
*show lldp all
*show lldp timers
*show lldp tlv-select
*show lldp neighbors detail
*show lldp traffic
"""
import re
# metaparsers
from genie.metaparser import MetaParser
from genie.metaparser.util.schemaengine import Any, Or, Optional
#... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""isort:skip_file"""
import argparse
import importlib
import os
from fairseq.dataclass import FairseqDataclass
from fairseq.dataclass.utils ... |
import os
import sqlalchemy as sa
from sqlalchemy import Column, Integer, String, DateTime, REAL
from sqlalchemy.orm import Session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.engine.base import Engine
from typing import Dict, Text, List, Union, Optional
from random import cho... |
# -*- coding: utf-8 -*-
"""Test configs."""
from micromailer.app import create_app
from micromailer.settings import DevConfig, ProdConfig
def test_production_config():
"""Production config."""
app = create_app(ProdConfig)
assert app.config['ENV'] == 'prod'
assert app.config['DEBUG'] is False
asser... |
from django.test import TestCase
from models import Category, Person
class ManyToOneRecursiveTests(TestCase):
def setUp(self):
self.r = Category(id=None, name='Root category', parent=None)
self.r.save()
self.c = Category(id=None, name='Child category', parent=self.r)
self.c.save()
... |
# coding: utf-8
def hello():
print('world')
class Foo(object):
""" Bar """
def baz():
print('this is not tested') |
from .base import BaseResource
from ..models.account import Account
from ..models.filters import NameFilter
from .serializers import AccountSerializer
class Accounts(BaseResource):
model = Account
serializer = AccountSerializer
filters = [NameFilter]
def post(self):
Account.add(Account(self.... |
from .constraint import AbstractConstraint
from .constraint import ConstraintRule
from .constraint import find_constraint
from .constraint import get_constraints
from .match import AbstractMatch
from .match import find_match
from .match import get_matches
from .match import MatchableRule
from .match import MatchRule
fr... |
{
"method": "ftp",
"host": "ftp.ibes.com",
"user": "6886_towercap",
"pass": "686$tra",
"remote_dir": "qfs",
"local_dir": "ibes/ibes",
"regex": "qf[mtwrf]6886[emnal]?\.zip",
"prefix": "qfs_%Y_%U_",
"new_data_frequency": 6L*60L*60L*1000L,
}
|
#!/usr/bin/python3.4
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
# 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... |
from funvert import funvert, Funverted
import unittest
def incd(x, by=1):
return x + by
def incremented(x, by=1):
return x + by
class TestFunvert(unittest.TestCase):
def test_is_callable_from_test_funvert(self):
one = funvert(1)
self.assertTrue(isinstance(one, Funverted))
self.ass... |
error_whitelist = ['ImportError', 'NameError', 'ModuleNotFoundError', 'FileNotFoundError', 'IOError', 'TypeError', 'ValueError', 'AttributeError', 'SyntaxError', 'PermissionError', 'StdinNotImplementedError', 'RuntimeError', 'KeyError', 'OSError', 'TclError', 'IndentationError', 'PermissionDeniedError', 'OperationalErr... |
# $Filename$
# $Authors$
# Last Changed: $Date$ $Committer$ $Revision-Id$
#
# Copyright (c) 2003-2011, German Aerospace Center (DLR)
# All rights reserved.
#
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are
#met:
#
# * Redistr... |
'''
Name: evl_NN_Adam
Date: 15,Apr,2018
Train on: Google VM
Purpose:
- Adamoptimizer
- using batch size: 512
- using more random sample, shuffle -> iter from start
- failed due to memory error
- retry with another implementation
- Using one_hot representation
... |
from django.apps import AppConfig
class MechConfig(AppConfig):
name = 'MECH'
|
import numpy as np
import pandas as pd
class PCA(object):
def __init__(self, n_components=0.95, threshold=None, c_alpha=4.4172):
"""
The PCA model for anomaly detection
Args:
proj_C: The projection matrix for projecting feature vector to abnormal space
... |
import datetime
import importlib
import inspect
import linecache
import logging
import os
import pprint
import queue
import shlex
import sys
import threading
import time
import traceback
import uuid
from collections import OrderedDict, defaultdict
from itertools import chain, takewhile
from traceback import FrameSummar... |
# -*- coding: utf-8 -*-
"""
Google Cloud Storage pythonic interface
"""
import textwrap
import fsspec
import decorator
from base64 import b64encode, b64decode
import google.auth as gauth
import google.auth.compute_engine
import google.auth.credentials
from google.auth.transport.requests import AuthorizedSession
from... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.