text stringlengths 2 999k |
|---|
from tests.testcase import TestCase
from edmunds.validation.validator import Validator
from wtforms import Form, BooleanField, StringField, PasswordField, validators
from werkzeug.datastructures import MultiDict
class TestValidator(TestCase):
"""
Test the validator
"""
def test_validates(self):
... |
import _plotly_utils.basevalidators
class ColorbarValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="colorbar", parent_name="streamtube", **kwargs):
super(ColorbarValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... |
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/09_vision.augment.ipynb (unless otherwise specified).
__all__ = ['RandTransform', 'TensorTypes', 'FlipItem', 'DihedralItem', 'PadMode', 'CropPad', 'RandomCrop',
'OldRandomCrop', 'ResizeMethod', 'Resize', 'RandomResizedCrop', 'AffineCoordTfm', 'RandomResizedCro... |
'''
Copyright (C) 2021 CG Cookie
http://cgcookie.com
hello@cgcookie.com
Created by Jonathan Denning, Jonathan Williamson, and Patrick Moore
This program 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... |
string = '<option value="1" >Malda</option><option value="2" >Hooghly</option><option value="3" >Calcutta</option><option value="4" >Jalpaiguri</option><option value="6" >Coochbehar</option><option value="7" >Paschim Medinpur</option><option value="8" >Birbhum</option><option value="9" >Purba Medinipur</option><option ... |
from werkzeug.exceptions import TooManyRequests
from webargs.flaskparser import parser
from webargs.fields import (
Str,
Int,
DelimitedList,
)
from marshmallow import (
ValidationError,
)
from sqlalchemy import exc, desc, select, func
from webargs import validate
from nv.models import (
User,
To... |
# Pretty-printers for SpiderMonkey strings.
import gdb
import mozilla.prettyprinters
from mozilla.prettyprinters import pretty_printer, ptr_pretty_printer
try:
chr(10000) # UPPER RIGHT PENCIL
except ValueError as exc: # yuck, we are in Python 2.x, so chr() is 8-bit
chr = unichr # replace with teh unicodes
# ... |
#!/usr/bin/env python
"""A script to download all images in a web page."""
__author__ = 'Ismail Sunni'
__copyright__ = 'Ismail Sunni'
__license__ = 'MIT'
__version__ = '0.0.1'
__maintainer__ = 'Ismail Sunni'
__email__ = 'imajimatika@gmail.com'
__status__ = 'Prototype'
__date__ = '29 Nov 2013'
import urllib
import url... |
"""
Flask-JSONAPI
-------------
JSONAPI View Generators for Flask
"""
from setuptools import setup
setup(name='Flask-JSONAPI',
version='0.1',
uri='http://github.com/coltonprovias/flask-jsonapi',
license='MIT',
author='Colton J. Provias',
author_email='cj@coltonprovias.com',
descr... |
"""
AMPAREX Rest API Documentation
This is the description of the AMPAREX Rest API. All REST calls plus the corresponding data model are described in this documentation. Direct calls to the server are possible over this page.<br/>Following steps are needed to use the API:<br/><br/>1. Get the ... |
from dataclasses import dataclass
from typing import Dict, List, Tuple
import base64
import io
import PIL.Image
import numpy as np
@dataclass
class BBox:
"""Bounding box dataclass.
(x1, y1) - top left corner, (x2, y2) - bottom right one
"""
x1: int
y1: int
x2: int
y2: int
class BaseOb... |
from .util import apply, normalize, transpose, invert
from .type import Scalar, Float32, Int32, Vec2, Vec3, Vec4, scalar, float32, int32, vec2, vec3, vec4
from .affine import identity, translation, rotation, rotation_x, rotation_y, rotation_z, scale, look_at
from .projection import orthographic, frustum, perspective
|
## Compiled from NodeLoads.ipynb on Sun Dec 10 12:51:11 2017
## DO NOT EDIT THIS FILE. YOUR CHANGES WILL BE LOST!!
## In [1]:
import numpy as np
from salib import extend
## In [9]:
class NodeLoad(object):
def __init__(self,fx=0.,fy=0.,mz=0.):
if np.isscalar(fx):
self.forces = np.matrix([f... |
import operator
def getTopTrends(script):
trends = {}
for page in script:
for section in page["content"]:
roundedX = round(section["segment"][0]["x"])
if roundedX not in trends:
trends[roundedX] = 1
else:
trends[roundedX] += 1
tre... |
# Copyright 2013 Cloudbase Solutions Srl
# 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 r... |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
#
# The MIT License (MIT)
# Copyright (c) 2016 Taro Sato
#
# 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 wi... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-10 14:42
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('inventario', '0001_initial'),
]
operations = [
migrations.CreateModel(
... |
#!/usr/bin/python2.7
import os
# from graph_tool.all import *
import bisect
import matplotlib.pyplot as plt
# edge = 28280084
node = 1559667
# node = 13
size, md, d = 0, 0, 0
graph = [[] for x in xrange(node)]
vertices = [0]*node
deg = [0]*node
with open("/home/akhil/Documents/hadoop_project/graph_ab_ba_all_edges_py... |
import csv
from twitter_specials import *
word_counts_dict = {}
with open("labeled_corpus.tsv", encoding="utf-8") as csvfile:
readCSV = csv.reader(csvfile, delimiter='\t')
for row in readCSV:
line_arr = list(row)
tweet = line_arr[0]
tweet = clean_tweet(tweet, emo_repl_order, emo_repl,... |
#!/usr/bin/env python
# coding:utf-8
import os
import urlparse
import simple_http_server
import global_var as g
from xlog import getLogger
xlog = getLogger("smart_router")
current_path = os.path.dirname(os.path.abspath(__file__))
root_path = os.path.abspath(os.path.join(current_path, os.pardir, os.pardir))
top_p... |
import numpy as np
import os.path as osp
from util import Map
# Classes in pascal dataset
PASCAL_CATS = ['aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car' , 'cat', 'chair', 'cow',
'diningtable', 'dog', 'horse', 'motorbike', 'person', 'potted plant', 'sheep', 'sofa',
'train',... |
#!/usr/bin/env python3
# Copyright (c) 2010 ArtForz -- public domain half-a-node
# Copyright (c) 2012 Jeff Garzik
# Copyright (c) 2010-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# mininode.p... |
from networkx.algorithms.assortativity import *
from networkx.algorithms.boundary import *
from networkx.algorithms.centrality import *
from networkx.algorithms.cluster import *
from networkx.algorithms.clique import *
from networkx.algorithms.communicability_alg import *
from networkx.algorithms.community import *
fro... |
# Diophantine equation
import numpy as np
from fractions import Fraction
LIMIT = 1000
def solve():
def minimal_solution(D):
if np.sqrt(D) % 1 == 0:
return 0
a0 = int(np.floor(np.sqrt(D)))
a = a0
m = 0
d = 1
n = Fraction(0, 1)
denominators = [... |
# Copyright 2015 Cisco Systems
# 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... |
from os.path import join
import warnings
import json
import numpy as np
import pandas as pd
from bids.utils import listify
from .entities import NodeIndex
from .variables import SparseRunVariable, DenseRunVariable, SimpleVariable
BASE_ENTITIES = ['subject', 'session', 'task', 'run']
ALL_ENTITIES = BASE_ENTITIES + [... |
from __future__ import absolute_import
import six
from rest_framework.response import Response
from sentry_sdk import Hub
from sentry_sdk.tracing import Span
from sentry.api.base import Endpoint
from sentry.api.permissions import RelayPermission
from sentry.api.authentication import RelayAuthentication
from sentry.r... |
# coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
from django.apps import AppConfig
class ActionConfig(AppConfig):
name = 'action'
def ready(self):
import action.signals
|
from celery import Celery
from crawler import crawl, add_results_to_queue
from parserlist import get_parser
queue_name = 'celery'
app = Celery(
'tasks',
broker_url='redis://127.0.0.1:6379/1',
# result_backend='redis://127.0.0.1:6379/1',
# result_expires=30,
)
app_client = app.connection().channel().cl... |
"""Helper functions for the various strategies
"""
import structlog
class StrategyUtils():
"""Helper functions for the various strategies
"""
def __init__(self):
"""Initializes Utils class
"""
self.logger = structlog.get_logger()
def get_high_prices(self, historical_data):
... |
from django.contrib import admin
# Register your models here.
from .models import Author, Genre, Book, BookInstance, Language
admin.site.register(Language)
admin.site.register(Genre)
class BookInline(admin.TabularInline):
model = Book
extra = 0
#admin.site.register(Author)
# Define the admin class - Reempl... |
import RPi.GPIO as GPIO
import time
import sys
import os
import requests
ON = False
OFF = True
class State:
def __init__(self, name, initial_value):
print "Initialize", name, "to", initial_value
self.name = name
self.value = initial_value
self.listeners = []
de... |
import numpy as np
from gym.spaces import Dict, Discrete
from rlkit.data_management.replay_buffer import ReplayBuffer
class ObsDictRelabelingBuffer(ReplayBuffer):
"""
Replay buffer for environments whose observations are dictionaries, such as
- OpenAI Gym GoalEnv environments.
https://blog.... |
import starter
def create_event():
"""
creates an event for unit tests
:return: dict
"""
prefix1 = 'sjd'
prefix2 = 'illon'
env = 'dev'
region = 'us-west-2'
event = dict()
event['region'] = 'us-west-2'
event['sleep_seconds'] = 0
bucket_format = "s3-{prefix1}-{prefix2}-{... |
import urllib
from bdtrans._global import _
ERROR_MSG = {
'52001': _('request timeout: please retry.'),
'52002': _('system error: please retry.'),
'52003': _('unauthorized user: check if your appid is correct or if the '
'service is open.'),
'54000': _('the required parameters are blank: check wheth... |
# # ⚠ 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... |
# coding: utf-8
import re
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class VpcInfo:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribu... |
# Welcome to the fourth lesson in the Yesselman Group's Python series
# Topics covered: For and While loops
########################################################################################################################
# Part I: The For Loop
# So far, you've learned how to assign data to variables and manipul... |
import subprocess
commit_count = (
subprocess.run(["git", "rev-list", "HEAD", "--count"], stdout=subprocess.PIPE)
.stdout.decode("utf-8")
.strip()
)
commit_sha = (
subprocess.run(["git", "rev-parse", "--short", "HEAD"], stdout=subprocess.PIPE)
.stdout.decode("utf-8")
.strip()
)
__version__ = ... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import mock
import pytest
from headlessvim.runtimepath import RuntimePath
@pytest.fixture
def list(request):
return ['~/.vim',
'/var/lib/vim/addons',
'/usr/share/vimfiles',
'/usr/share/vim/vim74',
'/usr/share/vim/vimfil... |
from collections import deque
from typing import Dict, Optional
import numpy as np
try:
import torch
except ImportError:
torch = None
def _to_numpy(value):
type_ = type(value)
if type_ == float or type_ == int:
return value
if type_ == np.ndarray:
return value
if torch is ... |
import numpy as np
from kipoi_utils.external.torch.sampler import BatchSampler
import collections
from kipoi_utils.data_utils import (numpy_collate, numpy_collate_concat, get_dataset_item,
DataloaderIterable, batch_gen, get_dataset_lens, iterable_cycle)
from copy import deepcopy
from... |
# GENERATED BY KOMAND SDK - DO NOT EDIT
import insightconnect_plugin_runtime
import json
class Component:
DESCRIPTION = "Identifies if a new incident has been created"
class Input:
FREQUENCY = "frequency"
QUERY = "query"
class Output:
SYSTEM_ID = "system_id"
class IncidentCreat... |
import logging
import os
import sqlite3
from dataclasses import dataclass
from pathlib import Path
from types import ModuleType
from typing import Optional, Union, Type, List, Any
import inspect
import click
from linkml_runtime import SchemaView
from linkml_runtime.linkml_model import SchemaDefinition
import linkml_ru... |
import numpy as np
import pandas as pd
from pytest import approx
from lenskit.metrics.topnFair import *
from lenskit import topnFair
import lk_test_utils as lktu
def test_run_one():
rla = topnFair.FairRecListAnalysis()
rla.add_metric('rND')
recs = pd.DataFrame({'user': 1, 'item': [2] 'Action': [0]})... |
import os
import platform
import unittest
import sys
from collections import defaultdict
from cpt.builds_generator import BuildConf
from cpt.packager import ConanMultiPackager
from conans import tools
from cpt.test.utils.tools import TestBufferConanOutput
from conans.model.ref import ConanFileReference
from cpt.test.... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {}
modules = []
doc_url = "https://josiahls.github.io/"
git_url = "https://github.com/josiahls/character_tracker/tree/master/"
def custom_doc_links(name): return None
|
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... |
# -*- coding: utf-8 -*-
__author__ = 'lundberg'
from django import forms
from . import common
from apps.noclook.models import Dropdown
class NewSiteForm(common.NewSiteForm):
name = forms.CharField()
country_code = forms.CharField(widget=forms.widgets.HiddenInput,
initial='... |
from __future__ import division, print_function
import argparse
# from aer.api import *
from aer.commands.imgos.imgos import entrypoint
# pylint: disable=I0011,E1129
def init(parent_parser):
from aer.commands import imgos
cont_parser = parent_parser.add_parser(
'imgos', help='Command for writing a... |
# Generated by Django 3.0 on 2020-03-28 16:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('upload', '0004_auto_20200328_1643'),
]
operations = [
migrations.AddField(
model_name='profile',
name='organisation',
... |
# -*- coding: utf-8 -*-
import numpy as np
import os
import pandas as pd
import time
import scanpy as sc
import scipy.sparse as ssp
from .. import help_functions as hf
from .. import plotting as CSpl
from .optimal_transport import *
from .. import settings
from .. import logging as logg
####################
# Con... |
#!/usr/bin/env python
import numpy as np
import pandas as pd
pd.set_option('display.max_colwidth', -1)
from functools import partial
from typing import List
from sklearn.metrics import confusion_matrix, roc_auc_score, precision_score, f1_score, recall_score
from scipy import stats
def _mean_confidence_interval(data,... |
import logging
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = ()
MANAGERS = ADMINS
SETTINGS = {
'SERVER_HOST': '0.0.0.0',
'SERVER_PORT': '3274',
'GRAPHITE_HOST': 'localhost',
'GRAPHITE_PORT': 8000,
'MONGODB_HOST': 'localhost',
'MONGODB_PORT': 27017,
'MONGODB_DB': 'copilot',
'GMAPS_KEY': ... |
# coding: utf-8
"""
monitoring
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from ncloud_monitoring.model.metric import Metric # noqa: F401,E501
class GetListMetricsResponse(object):
"""NOTE: This class is auto generated b... |
# Local imports
from uplink import utils, clients
from uplink.clients import io, exceptions as client_exceptions
class MockClient(clients.interfaces.HttpClientAdapter):
def __init__(self, mock_client):
self._mock_client = mock_client
self._exceptions = client_exceptions.Exceptions()
self._... |
"""Unit tests for Expectation Maximization."""
import geomstats.backend as gs
import geomstats.tests
from geomstats.geometry.hypersphere import Hypersphere
from geomstats.geometry.poincare_ball import PoincareBall
from geomstats.learning.expectation_maximization import \
find_normalization_factor, find_variance_fr... |
import os
import stat
import csv
import platform
import fnmatch
from subprocess import run
from jinja2 import Template
from ..client import Host
from .base import BaseCommand
from .base import ArgumentRequired
from .utils import table_print, simple_print, field_print, ssh_format_print, grep, input_is_ye... |
'''Copyright © 2015 Sunoru Sidw <s@sunoru.com>
MIT license
http://sunoru.mit-license.org/
'''
import sys
import os
import openpyxl
def qexit():
os.system('pause')
sys.exit()
def main():
if len(sys.argv) < 2 or not os.path.exists(sys.argv[1]):
print("输入文件错误", file=sys.stderr)
... |
import time
import dgl
from dgl.nn.pytorch import GATConv
import torch
import torch.nn as nn
import torch.nn.functional as F
from .. import utils
class GAT(nn.Module):
def __init__(self,
num_layers,
in_dim,
num_hidden,
num_classes,
... |
from rest_framework import pagination
from rest_framework.response import Response
from spillway import query
from spillway.collections import NamedCRS
class FeaturePagination(pagination.PageNumberPagination):
"""Feature pagination by page number."""
def get_paginated_response(self, data):
if hasatt... |
import shutil
import shlex
import subprocess
import sys, os, gc
import numpy as np
import xarray as xr
import pandas as pd
import multiprocessing as mp
from glob import glob
from io import StringIO
from datetime import datetime, timedelta
core_limit = 8
nbm_dir = '/scratch/general/lustre/u1070830/nbm/'
# urma_dir = ... |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import glob
import json
import os
import pathlib
import shutil
import stat
import subprocess
import sys
from .dyndep... |
#!/usr/bin/env python
#
# cleanup_3d.py
# DAVA SDK
#
# Created by Yury Danilov on 6/28/13.
# Copyright (c) 2013 DAVA Consulting, LLC. All rights reserved.
#
import os;
import os.path;
import shutil;
#cleanup Data/3d
currentDir = os.getcwd();
dataDir = os.path.realpath(currentDir + "/../Data/3d/")
if os.path.ex... |
import re
GENERIC_REGISTRY_REGEX_PATTERN = "(.*[.][^/]*)/(.*)"
DEFAULT_DOCKER_REGISTRY = "docker.io"
DEFAULT_TAG = "latest"
def getRegistry(imageName):
if re.match(GENERIC_REGISTRY_REGEX_PATTERN, imageName, re.IGNORECASE):
return re.search(GENERIC_REGISTRY_REGEX_PATTERN, imageName, re.IGNORECASE).group(1... |
_base_ = ['../../../../_base_/datasets/posetrack18.py']
log_level = 'INFO'
load_from = 'https://download.openmmlab.com/mmpose/top_down/resnet/res50_coco_256x192-ec54d7f3_20200709.pth' # noqa: E501
resume_from = None
dist_params = dict(backend='nccl')
workflow = [('train', 1)]
checkpoint_config = dict(interval=1)
evalu... |
from acq4.pyqtgraph import Vector, SRTTransform3D
class Frame(object):
"""A single frame of imaging data including meta information.
Expects *info* to be a dictionary with some minimal information:
* 'frameTransform' maps from the image coordinates (0,0 at top-left) to
the coordinate system of the... |
import torch
import torch.nn as nn
from torch.nn import init
from torch.nn import utils
import torch.nn.functional as F
import functools
from torch.optim import lr_scheduler
###############################################################################
# Helper Functions
#############################################... |
"""
=================================
Parallel reconstruction using CSD
=================================
This example shows how to use parallelism (multiprocessing) using
``peaks_from_model`` in order to speedup the signal reconstruction
process. For this example will we use the same initial steps
as we used in :ref:... |
"""
Copyright: MAXON Computer GmbH
Author: Rick Barrett, Maxime Adam
Description:
- Creates a Dialog which display the latest RSS feed of Cineversity.
- Opens the web browser of the current displayed news when the user click a button.
Note:
- Dialog options are saved in the World Container to set them bac... |
# any functions for plots
from matplotlib import pyplot as plt
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
from matplotlib import dates as mdates
from matplotlib.ticker import FormatStrFormatter
import numpy as np
import pandas as pd
from pathlib import Path
import glob, os
import datetime
def deploy... |
from sklearn.datasets.samples_generator import make_moons
from sklearn.datasets.samples_generator import make_circles
from sklearn.datasets.samples_generator import make_blobs
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
###### CIRCLES #########
# generate 2d classification dataset
n = 10000... |
# qubit number=3
# total number=83
import numpy as np
from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ
from qiskit.visualization import plot_histogram
from typing import *
from pprint import pprint
from math import log2
from collections import Counter
from... |
########## 4.2. Importância do recurso de permutação ##########
# A importância do recurso de permutação é uma técnica de inspeção de modelo que pode ser usada para qualquer estimador ajustado quando os dados são tabulares. Isso é especialmente útil para estimadores não lineares ou opacos. A importância do recurso... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Update encrypted deploy password in Travis config file
"""
from __future__ import print_function
import base64
import json
import os
from getpass import getpass
import yaml
from cryptography.hazmat.primitives.serialization import load_pem_public_key
from cryptography.h... |
from abc import abstractmethod
from typing import Any, Optional, Union
from PySide6.QtWidgets import QCheckBox, QDoubleSpinBox, QHBoxLayout, QLabel, QSpinBox
from cilissa_gui.widgets.inputs.base import (
MAX_NEG_INTEGER,
MAX_POS_INTEGER,
CQInputWidget,
)
class CQNumberInputWidget(CQInputWidget):
sb:... |
import game
if __name__ == '__main__':
game.Game()
|
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
# -*- coding: utf-8 -*-
import utils
# import sys
# import os
import numpy as np
import scipy as sp
import pandas as pd
import warnings
#import qvalue # not used
import limix.qtl.qtl as qtl
#sp.random.seed(10) # set global seed
def run_permutations(function, x_dat, pv_observed, n_permute=1000,
permute_seed=10... |
# Copyright (c) 2010-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 agree... |
# Source
# ======
# https://www.hackerrank.com/contests/projecteuler/challenges/euler001
#
# Problem
# =======
# If we list all the natural numbers below 10 that are multiples of 3 or 5,
# we get 3, 5, 6 and 9. The sum of these multiples is 23.
#
# Find the sum of all the multiples of 3 or 5 below N.
#
# Input Format
... |
"""The tests for the MQTT switch platform."""
import unittest
from homeassistant.setup import setup_component
from homeassistant.const import STATE_ON, STATE_OFF, STATE_UNAVAILABLE,\
ATTR_ASSUMED_STATE
import homeassistant.components.switch as switch
from tests.common import (
mock_mqtt_component, fire_mqtt_me... |
import types
import warnings
import sys
import traceback
import pickle
from copy import deepcopy
from functools import partial
from inspect import signature
import numpy as np
from scipy import sparse
from scipy.stats import rankdata
from . import IS_PYPY
from . import _joblib
from .testing import assert_raises, _get... |
"""
#Trains a ResNet on the CIFAR10 dataset.
"""
from __future__ import print_function
import keras
from keras.layers import Dense, Conv2D, BatchNormalization, Activation
from keras.layers import AveragePooling2D, Input, Flatten
from keras.optimizers import Adam
from keras.callbacks import ModelCheckpoint, LearningRa... |
# Question 2 Lab Assignment 03
# @AB Satyaprakash, 180123062
# imports
from math import exp, sqrt
import numpy as np
import time
# Initialising a dictionary -- C++ equivalent to map<>
Map = {}
# functions ---------------------------------------------------------------------------
def recursion(n, Smax, S, T, r, sig... |
"""
MIT License
Copyright (c) 2019 GamingGeek
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, modify, merge, publi... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# __coconut_hash__ = 0x245000d
# Compiled with Coconut version 1.4.0 [Ernest Scribbler]
# Coconut Header: -------------------------------------------------------------
from __future__ import generator_stop
import sys as _coconut_sys
from builtins import chr, filter, hex... |
import os
import uuid
from datetime import datetime
from django.apps import apps
from django.core.exceptions import ImproperlyConfigured
from django.core.files.storage import default_storage
from django.utils.translation import get_language
from importlib import import_module
# Conversion table from language to locale... |
import pytest
@pytest.mark.flaky(reruns=2)
def test_new_source(
driver, user, super_admin_token, upload_data_token, view_only_token, ztf_camera
):
driver.get(f'/become_user/{user.id}')
driver.get('/')
driver.wait_for_xpath('//*[text()="Add a Source"]')
# test add sources form
driver.wait_fo... |
import importlib
import logging
import os
from pathlib import Path
from typing import Any, Dict, Optional, Callable, Union
from git import Repo
from .exceptions import ArcaMisconfigured
class NotSet:
""" For default values which can't be ``None``.
"""
def __repr__(self):
return "NOT_SET"
NOT_S... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Grafana_and_SiLK_connection_using_a_Python_HTTP_Server documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible... |
# -*- coding: utf-8 -*-
"""
Ejemplo de un evaluador de expresiones aritméticas con PLY.
"""
from ply import lex, yacc
# Reglas del lexer.
tokens = ('NUMBER', 'PLUS', 'MINUS', 'TIMES', 'DIVIDE', 'LPAREN', 'RPAREN')
def t_NUMBER(token):
r'\d+'
token.value = int(token.value)
return token
t_PLUS = r'\+'
t... |
import re
def css2json(css):
def trim(s):
return s.strip()
# Remove all comments from the css-file
while True:
comment_open = css.find('/*')
comment_close = css.find('*/')
if (comment_open == -1) or (comment_close == -1):
break
css = css[:comment_open] ... |
from django.db import migrations, models
from django.db.models.functions import Upper
class Migration(migrations.Migration):
dependencies = [
("zerver", "0111_botuserstatedata"),
]
operations = [
migrations.AddIndex(
model_name="mutedtopic",
index=models.Index(
... |
import fnmatch
import os
import pickle
import time
import xml.etree.ElementTree as ElementTree
from pathlib import Path
from typing import List
from commonroad.common.solution import VehicleType
from commonroad.geometry.shape import Rectangle
from commonroad.planning.planning_problem import PlanningProblem
from tqdm.n... |
# Show all cards in the deck
def show_all_cards_in_deck(deck_dict):
for card in deck_dict:
print card[0] + " of " + card[1]
# Returns cards that contain the suit the user picked
def pull_suit_cards(deck_dict):
suit_chosen = raw_input("What card suit would you like to display? ")
for card in de... |
# encoding: utf-8
# module gi._gi
# from /usr/lib/python3/dist-packages/gi/_gi.cpython-35m-x86_64-linux-gnu.so
# by generator 1.145
# no doc
# imports
import _gobject as _gobject # <module '_gobject'>
import _glib as _glib # <module '_glib'>
import gi as __gi
import gobject as __gobject
from .type import type
class... |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.async.base.exchange import Exchange
# -----------------------------------------------------------------------------
try:
ba... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.