text stringlengths 1 927k |
|---|
import datetime
import re
import pytest
from fastjsonschema import JsonSchemaValueException
exc = JsonSchemaValueException('data must be date-time', value='{data}', name='data', definition='{definition}', rule='format')
@pytest.mark.parametrize('value, expected', [
('', exc),
('bla', exc),
('2018-02-05T... |
#!/usr/bin/env python3
n = int(input())
d = list(map(int, input().split()))
t = [list(map(int, input().split())) for _ in range(3)]
ivals = [[[0]*n for _ in range(n)] for _ in range(3)]
for p in range(3):
for i in range(n):
curt = 0
for j in range(n):
ivals[p][i][(i+j)%n] = (curt, curt... |
# coding:utf-8
import logging
import numpy as np
from scipy.special import expit
from mla.base import BaseEstimator
from mla.utils import batch_iterator
np.random.seed(9999)
sigmoid = expit
"""
References:
A Practical Guide to Training Restricted Boltzmann Machines https://www.cs.toronto.edu/~hinton/absps/guideTR.p... |
"""
Cuboid route
"""
if __name__ == '__main__':
res, m, n = 0, 0, 0
for i in range(1, int(2000000 ** 0.5)):
for j in range(i, int(2000000 ** 0.5)):
s = i * (i + 1) * j * (j + 1) // 4
if abs(res - 2000000) > abs(s - 2000000):
res, m, n = s, i, j
print("m = ", m... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import autoslug.fields
import ckeditor_uploader.fields
class Migration(migrations.Migration):
dependencies = [
('calendareshop', '0016_project_image_translation'),
]
operations = [
m... |
#!/usr/bin/env python
# Copyright 2017 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.
"""Splits a branch into smaller branches and uploads CLs."""
from __future__ import print_function
import collections
import os
impor... |
import requests
import json
from urllib.parse import urljoin
class IGCAPI(object):
'''an object for intereacting with an instance of IGC via json API'''
def __init__(self, uname, passwd, host, port=9443, api_path='/ibm/iis/igc-rest/v1/'):
self.api_host = host
self.api_port = port
self... |
import numpy as np
import scipy as sp
from numpy.linalg import inv, cholesky
from scipy.linalg import eig
from sklearn.metrics.cluster import normalized_mutual_info_score as nmi
from sklearn.metrics.cluster import adjusted_rand_score as ari
from sklearn.metrics.cluster import contingency_matrix
from sklearn.cluster i... |
# Copyright 2017 Alethea Katherine Flowers
#
# 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... |
from stripstream.pddl.logic.connectives import Not, And
from stripstream.pddl.logic.atoms import Atom
from stripstream.pddl.logic.operations import Initialize
from stripstream.algorithms.instantiation import smart_instantiate_operator
from stripstream.utils import INF
from stripstream.pddl.problem import STRIPStreamPro... |
#!/usr/bin/env python3
import numpy as np
import json
import os
import sys
import scipy.io as sio
import wfdb
"""
Written by: Xingyao Wang, Chengyu Liu
School of Instrument Science and Engineering
Southeast University, China
chengyu@seu.edu.cn
"""
R = np.array([[1, -1, -0.5],... |
from django.contrib import admin
from snippify.snippets.models import Snippet, SnippetComment, SnippetVersion
class SnippetAdmin(admin.ModelAdmin):
exclude = ('author',)
list_display = ('title', 'lexer', 'created_date', 'author')
list_filter = ('lexer', 'author', )
search_fields = ('title', 'body', )
... |
"""
Estimates the likihood of an input senetnce and finds an order of words
that is most likely in the longuage model
"""
import os
import argparse
import pickle
from keras.models import load_model
from keras.preprocessing.sequence import pad_sequences
from keras import backend as k
import numpy as np
from itertool... |
# Copyright (c) 2020 Intel Corporation
#
# 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, publish, d... |
from io import SEEK_CUR
from os import name
from types import FunctionType
import matplotlib.pyplot as plt
from matplotlib.pyplot import legend, plot, xticks
## class for plot function
class PlotFunction():
"""Make Data visualization Easier !"""
def __init__(self, y_data, x_label, y_label, x_ticklabels=[], x_t... |
from hw_asr.datasets.custom_audio_dataset import CustomAudioDataset
from hw_asr.datasets.custom_dir_audio_dataset import CustomDirAudioDataset
from hw_asr.datasets.librispeech_dataset import LibrispeechDataset
from hw_asr.datasets.lj_speech_dataset import LJSpeechDataset
__all__ = [
"LibrispeechDataset",
"Cust... |
#!/usr/bin/env python3
# Copyright (c) 2015-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test BIP66 (DER SIG).
Test that the DERSIG soft-fork activates at (regtest) height 1251.
"""
from tes... |
#!/usr/bin/env python3
# vim: sts=4 sw=4 et
import pytest
import pathlib
import tempfile
version = tuple([int(x) for x in pytest.__version__.split('.')[:2]])
if version < (3, 9):
@pytest.fixture
def tmp_path():
with tempfile.TemporaryDirectory() as tmp:
yield pathlib.Path(tmp) |
from editor.attributes.player.player_attribute import (
PlayerAttribute,
PlayerAttributeTypes,
)
from editor.attributes.player.player_attribute_wb import (
PlayerAttributeWb,
)
from editor.attributes.player.player_attribute_acceleration import (
PlayerAttributeAcceleration,
)
from editor.attributes.p... |
import tensorflow as tf
############################################################
# Miscellenous Graph Functions
############################################################
def trim_zeros_graph(boxes, name='trim_zeros'):
"""Often boxes are represented with matrices of shape [N, 4] and
are padded with zero... |
#!/usr/bin/env python3
##########################################
# Duino-Coin Python AVR Miner (v2.5.7)
# https://github.com/revoxhere/duino-coin
# Distributed under MIT license
# © Duino-Coin Community 2019-2021
##########################################
# Import libraries
import sys
from configparser import ConfigPa... |
# Copyright 2021 The Kubeflow 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 applicable law or agreed to in... |
# coding: utf-8
"""
InsightVM API
OpenAPI spec version: 3
Contact: support@rapid7.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import py_insightvm_sdk
from py_insightvm_sdk.models.database_size import DatabaseSize ... |
# Copyright (c) 2018 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... |
from sympy.core.function import expand_mul
from sympy.core.numbers import (I, Rational)
from sympy.core.singleton import S
from sympy.core.symbol import (Symbol, symbols)
from sympy.core.sympify import sympify
from sympy.simplify.simplify import simplify
from sympy.matrices.matrices import (ShapeError, NonSquareMatrixE... |
import asyncio
import dataclasses
import ipaddress
import logging
import random
import time
from typing import List, Dict
import aiosqlite
from replaceme.seeder.peer_record import PeerRecord, PeerReliability
log = logging.getLogger(__name__)
class CrawlStore:
crawl_db: aiosqlite.Connection
last_timestamp: ... |
# coding=utf-8
# Copyright 2019 The Google AI Language Team 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 ... |
# Copyright (c) 2021 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 appli... |
import requests
import sys
class Check():
def __init__(self, owner, repo, number, access_token):
self.owner = owner
self.repo = repo
self.number = number
self.access_token = access_token
def add_processing_tag(self):
url = 'https://gitee.com/api/v5/repos/{}/{}/pulls/{}... |
# -*- coding: utf-8 -*-
"""
test_cli
----------------------------------
Tests for `cli` module.
"""
# thirdparty libraies
import pytest
# This package
from ar_too import cli
class TestCli:
def test_cli(self, cli_runner):
result = cli_runner.invoke(cli.cli, ['--help'])
assert result.exit_code ==... |
#!/usr/bin/env python3
from math import exp, log
from scipy.stats import pearsonr, t
from sklearn import svm
from sklearn.model_selection import GridSearchCV, KFold
from sklearn.utils import resample
import argparse
import collections
import itertools
import numpy as np
import pandas as pd
import random
import sys
M... |
""" Callables
What are callables?
Any object that can be called using the () # operator always return a value -> like functions and methods -> but it goes beyond these two...
Many other objects in Python are also callable
To see if an object is callable, we can use the builtin function: callable
... |
n = 1001
arr = [[0 for _ in range(n)] for _ in range(n)]
i = j = n // 2
k = 1
num = 2
arr[i][j] = 1
while i != 0 or j != n - 1:
if i == 0:
while j != n - 1:
arr[i][j + 1] = num
num += 1
j += 1
break
# Right
for l in range(k):
arr[i][j + 1] = num
... |
# Copyright 2014 CloudFounders NV
#
# 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 writ... |
# from django.shortcuts import render
from meuapp.models import Pessoa
from django.http import HttpResponse
from rest_framework.generics import ListAPIView, CreateAPIView, UpdateAPIView, DestroyAPIView, RetrieveAPIView
from .serializers import PessoaSerializer
def hello_world(request):
return HttpResponse('Hell... |
from .local import *
# A test database may be specified through use of the TEST_DATABASE_URL
# environment variable. If not provided, unit tests will be run against an
# in-memory SQLite database.
TEST_DATABASE_URL = os.getenv('TEST_DATABASE_URL')
if TEST_DATABASE_URL:
TEST_DATABASE = dj_database_url.parse(TEST_D... |
# This is Cyder's main settings file. If you need to override a setting
# locally, use cyder/settings/local.py
import glob
import itertools
import logging
import os
import socket
import sys
from django.utils.functional import lazy
from lib.path_utils import ROOT, path
##########################
# copied from funfact... |
from PyQt4 import QtCore, QtGui
class MainWindow(QtGui.QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.central_widget = QtGui.QStackedWidget()
self.setCentralWidget(self.central_widget)
login_widget = LoginWidget(s... |
# examples from http://linuxgazette.net/100/pramode.html
def foo():
yield 1
yield 2
g = foo()
assert next(g)==1
assert next(g)==2
def foo():
return
yield 1
assert [x for x in foo()]==[]
def foo(n):
for i in range(2):
if (n < 3):
yield 1
else:
return
... |
num1 = input('Digite um numero: ')
num2 = input('Digite outro numero: ')
try:
num1 = float(num1)
num2 = float(num2)
print(num1 + num2)
except:
print('Error') |
import pytest
import stardog.content as content
import stardog.content_types as content_types
import os
# STARDOG_ENDPOINT = os.environ.get('STARDOG_ENDPOINT', None)
STARDOG_HOSTNAME_NODE_1 = os.environ.get("STARDOG_HOSTNAME_NODE_1", None)
STARDOG_HOSTNAME_CACHE = os.environ.get("STARDOG_HOSTNAME_CACHE", None)
STARDOG... |
import logging
from django.conf.urls.defaults import *
from piston.resource import Resource as R
from piston.authentication import HttpBasicAuthentication
import handlers
l = logging.getLogger(__name__)
class Auth(HttpBasicAuthentication):
def is_authenticated(self, request):
user = super(Auth, self).is_authent... |
import os
import platform
import time
import sys
time.sleep(3)
if platform.system() == "Linux":
os.system("screen -L -S Amme java -jar DiscordBot.jar -restart")
else:
os.system("java -jar Amaya-1.0-SNAPSHOT.jar")
sys.exit(0) |
import google.oauth2.credentials
import google_auth_oauthlib.flow as oauth_flow
def fetch_new_creds(config):
return oauth_flow.InstalledAppFlow.from_client_config(
config,
scopes=[
'https://www.googleapis.com/auth/gmail.send',
'https://www.googleapis.com/auth/spreadsheets.readonly',
... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-28 15:26
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependen... |
"""Modularity matrix of graphs.
"""
# Copyright (C) 2004-2019 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
import networkx as nx
from networkx.utils import not_implemented_for
__author__ = "\n".join(['Aric... |
# -*- coding: utf-8 -*-
#
"""
Helper functions and classes for decoding text data which are used after
reading raw text data.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import tensorflow a... |
# Copyright 2017 Rackspace, US 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 a... |
#!/usr/bin/python
import sys
import os
import shutil, errno
from pathlib import Path
import hashlib
import json
import urllib.request
import re
from xml.dom.minidom import parseString
from python_lib.gweis.isoduration import parse_duration
TYPE_AUDIO = "audio"
TYPE_VIDEO = "video"
if len(sys.argv) < 3:
print("Pl... |
import aiohttp
import pytest
from aioresponses import aioresponses
from lxml import etree
from pretend import stub
from zeep import asyncio, exceptions
from zeep.cache import InMemoryCache
@pytest.mark.requests
def test_no_cache(event_loop):
transport = asyncio.AsyncTransport(loop=event_loop)
assert transpor... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# stdlib imports
import os.path
import re
# third party imports
import numpy as np
import pandas as pd
import pkg_resources
# Local imports
from gmprocess.metrics.station_summary import StationSummary
from gmprocess.core.stationstream import StationStream
from gmprocess.... |
# import rospy
from math import atan2, pi, sqrt
from pid import PID
GAS_DENSITY = 2.858
ONE_MPH = 0.44704
class TwistController(object):
def __init__(self, max_angular_velocity, accel_limit, decel_limit):
self.max_angular_velocity = max_angular_velocity
self.accel_limit = accel_limit
self.... |
#!/usr/bin/env python
# Copyright 2016 Google Inc. 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... |
from json import loads
from tenable_io.api.base import BaseApi, BaseRequest
from tenable_io.api.models import User, UserKeys, UserList
class UsersApi(BaseApi):
def get(self, user_id):
response = self._client.get('users/%(user_id)s', {'user_id': user_id})
return User.from_json(response.text)
... |
# 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)
import os
from spack import *
class XxdStandalone(MakefilePackage):
"""xxd creates a hex dump of a given file or st... |
"""
expr_parse.py
"""
from __future__ import print_function
import sys
from _devbuild.gen.syntax_asdl import token
from _devbuild.gen.id_kind_asdl import Id, Kind
from _devbuild.gen.types_asdl import lex_mode_e
from core import meta
from core import util
#from core.util import log
from pgen2 import parse
from typin... |
import argparse
import pandas as pd
import numpy as np
import re
import nltk
from sklearn.preprocessing import LabelEncoder
from ..utils import serialize
from .tokenization import tokenize_articles, nan_to_str, convert_tokens_to_int, get_words_freq
from gensim.models.doc2vec import Doc2Vec, TaggedDocument
from nltk.... |
# 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 agreed to in writing, ... |
import pytest
from custom_components.racelandshop.share import SHARE
from custom_components.racelandshop.validate import (
async_initialize_rules,
async_run_repository_checks,
)
@pytest.mark.asyncio
async def test_async_initialize_rules(racelandshop):
await async_initialize_rules()
@pytest.mark.asynci... |
#!/usr/bin/env python
# Copyright 2014 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.
"""Code generator DeviceCapabilities literal."""
import argparse
import ctypes
import glob
import evdev
import os
import sys
TEST_DA... |
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
n, k, *a = map(int, read().split())
v = 0
ans = 0
for i in range(40, -1, -1):
cnt = 0
for aa in a:
if (aa >> i) & 1:
cnt += 1
if n - cnt > c... |
# Copyright (c) 2020-2022, Andrea Zoppi.
# 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 ... |
import numpy as np
import pyqtgraph as pg
from qtpy import QtGui
from __code._utilities.parent import Parent
from __code.radial_profile.display import Display
class EventHandler(Parent):
def file_index_changed(self):
file_index = self.parent.ui.slider.value()
live_image = self.parent.get_selecte... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
#autoindent
"""
Generic Parcellation class:
Contains all the items that define a multi-subject parcellation
Author : Bertrand Thirion, 2005-2008
TODO : add a method 'global field', i.e. non-subject-speci... |
# ExcelRefresh.py
import win32com.client
import win32con
import shutil
import time
import ctypes
import os
from pathlib import Path
from pythoncom import com_error
def ExcelRefresh (filename, path):
file = filename
SourcePathName = (path + '/')
if os.path.exists(SourcePathName+file):
# Open Excel
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "Christian Heider Nielsen"
__doc__ = r"""
Created on 18-02-2021
"""
__all__ = [
"monochrome_hatch_cycler",
"simple_hatch_cycler",
"monochrome_line_no_marker_cycler",
"monochrome_line_cycler",
]
from matplotlib import c... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
=================================================================
Selecting dimensionality reduction with Pipeline and GridSearchCV
=================================================================
This example constructs a pipeline that does dimensionality
reduction f... |
import asyncio
import time
n = 0
async def monitor():
global n
while True:
await asyncio.sleep(1)
print(f"{n} req/sec")
n = 0
async def client(address, num):
global n
reader, writer = await asyncio.open_connection(*address)
while True:
writer.write(b'1000')
... |
# coding=utf-8
# Copyright 2020 The HuggingFace Inc. team.
#
# 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... |
# -*- coding: utf-8 -*-
from hcloud.actions.client import BoundAction
from hcloud.core.client import BoundModelBase, ClientEntityBase, GetEntityByNameMixin
from hcloud.core.domain import add_meta_to_result
from hcloud.images.domain import Image
class BoundImage(BoundModelBase):
model = Image
def __init__(se... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# :Id: $Id: smartquotes.py 8095 2017-05-30 21:04:18Z milde $
# :Copyright: © 2010 Günter Milde,
# original `SmartyPants`_: © 2003 John Gruber
# smartypants.py: © 2004, 2007 Chad Miller
# :Maintainer: docutils-develop@lists.sourceforge.net
# :Li... |
import numpy as np
import sys
if "../" not in sys.path:
sys.path.append("../")
from lib.envs.gridworld import GridworldEnv
env = GridworldEnv()
def policy_eval(policy, env, discount_factor=1.0, theta=0.00001):
"""
Evaluate a policy given an environment and a full description of the
environment's dyn... |
#!C:\Users\DTI-GSAMPAIO\Python\Day of Data Science\GPTo\venv\Scripts\python.exe
# $Id: rst2odt_prepstyles.py 5839 2009-01-07 19:09:28Z dkuhlman $
# Author: Dave Kuhlman <dkuhlman@rexx.com>
# Copyright: This module has been placed in the public domain.
"""
Fix a word-processor-generated styles.odt for odtwriter use: D... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_lethe
----------------------------------
Tests for `lethe` module.
"""
import sys
import shutil
import unittest
from datetime import datetime
import os
from lethe.rollardex import Person, RollarDex
fixtures_dir = os.path.join(os.path.dirname(__file__), 'fixtur... |
import sys
import os
import datetime as dt
import unicodedata
import networkx as nx
import numpy as np
import logging as lg
from . import settings
def citation():
"""
Print the OSMnx package's citation information.
Boeing, G. 2017. OSMnx: New Methods for Acquiring, Constructing, Analyzing,
and Visual... |
"""Android USB serial PL2303 driver.
Classes:
Pl2303Serial
"""
from struct import pack, unpack
import time
from .utilserial4a import (
SerialBase,
SerialException,
to_bytes,
PortNotOpenError,
Timeout,
)
from usb4a import usb
class Pl2303Serial(SerialBase):
"""PL2303 serial port class."""
... |
"""
Component for controlling Pandora stations through the pianobar client.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/media_player.pandora/
"""
import logging
import re
import os
import signal
from datetime import timedelta
import shutil
from homeass... |
from rest_framework_jwt.views import JSONWebTokenAPIView
from rest_framework_jwt.serializers import JSONWebTokenSerializer
from django.contrib.auth import authenticate
from rest_framework import serializers
from django.utils.translation import ugettext as _
from rest_framework_jwt.settings import api_settings
jwt_paylo... |
# 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)
import re
import spack.compiler
class Arm(spack.compiler.Compiler):
# Subclasses use possible names of C compiler
... |
# -*- encoding: utf-8 -*-
from django.conf.urls import url
from notification.views import test_ios_notification, test_android_notification
urlpatterns = [
url(r'test/ios/$', test_ios_notification, name='test-ios-notification'),
url(r'test/android/$', test_android_notification, name='test-android-notification'... |
import random
from constants import *
from util import dice, stop_watch
from anime.hit_anime import hit_particle, Hit_Anime
class Fighter:
def __init__(self, hp=0, defense=0, STR=0, DEX=0, INT=0, speed=10,
evasion=0, xp_reward=0, level=1,
# 物理:オレンジ, 火:赤, 氷:白, 雷:青, 酸:黄色, 毒:紫, 精神:ピ... |
# Copyright 2017 ZTE Corporation.
#
# 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 ... |
#Download pretrained model
import os
import sys
import urllib2
def main(argv):
OUTPUT_PATH="./pretrain/"
if not os.path.isdir(OUTPUT_PATH):
os.mkdir(OUTPUT_PATH)
with open(OUTPUT_PATH+'agegender_age101_squeezenet.hdf5','wb') as f:
f.write(urllib2.urlopen("http://www.abars.biz/keras/agegender_age101_squeezenet.... |
from qfengine.exchange.exchange import Exchange
import datetime
class SimulatedExchange(Exchange):
"""
The SimulatedExchange class is used to model a live
trading venue.
It exposes methods to inform a client class intance of
when the exchange is open to determine when orders can
be executed.
... |
# coding: utf-8
#
# Copyright 2020 The Oppia 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 requi... |
# This solution may be wrong
class Solution:
def minNumberOfSemesters(self, n: int, dependencies: List[List[int]], k: int) -> int:
graph = [[] for _ in range(n)]
memo_indegrees = [0] * n
for u, v in dependencies:
u -= 1
v -= 1
memo_indegrees[v] += 1
... |
#!/usr/bin/env python3
## USE LASTZ TO SOFTMASK REPEATS OF A GIVEN FASTA SEQUENCE FILE.
import os
from sonLib.bioio import catFiles
from cactus.shared.common import cactus_call
from cactus.shared.common import RoundedJob
class RepeatMaskOptions:
def __init__(self,
fragment=200,
minPerio... |
import re
import setuptools
from pathlib import Path
with open("README.md", "r") as fh:
long_description = fh.read()
def get_version(prop, project):
project = Path(__file__).parent / project / "__init__.py"
result = re.search(
r'{}\s*=\s*[\'"]([^\'"]*)[\'"]'.format(prop), project.read_text()
)... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="treemaker",
version="0.0.1",
author="Tony Simpson",
author_email="agjasimpson@gmail.com",
description="Prints command line trees",
long_description=long_description,
long_descripti... |
#! /usr/bin/env python
import rospy
from sensor_msgs.msg import NavSatFix, Imu
from tf.transformations import euler_from_quaternion
from std_msgs.msg import Float64
from geometry_msgs.msg import Point, Twist
import math
import utm
import numpy as np
x, y, theta = 0.0, 0.0, 0.0
xx, yy = [], []
def newGPS(msg):
g... |
#!/usr/bin/env python3
# Copyright (c) 2018-2020 The worldwideweb Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the Partially Signed Transaction RPCs.
"""
from decimal import Decimal
from itertools import... |
class TokenDoesNotExist(Exception):
"""Raised when the requested token does not exist."""
class TokenDoesNotBelongToUser(Exception):
"""Raised when a token does not belong to a user."""
class MaximumUniqueTokenTriesError(Exception):
"""
Raised when the maximum tries has been exceeded while generatin... |
# 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 ... |
##########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2020, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
##########################################################################
from pgadmin.util... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# pyutils_sh documentation build configuration file, created by
# sphinx-quickstart on Thu Mar 15 22:24:38 2018.
#
# 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
#... |
"""Tests of getting ABI from different sources."""
import os
from collections import namedtuple
import pytest
from evmscript_parser.core.ABI import get_cached_combined
from evmscript_parser.core.ABI.storage import CachedStorage, ABIKey
from evmscript_parser.core.decode import decode_function_call
CUR_DIR = os.path.d... |
import time
import algorithms as alg
import puzzle as pzl
class ClueError(Exception):
"""Exception thrown when a puzzle doesn't have enough clues, less than 17, to solve it."""
def __init__(self, file_name, num_clues):
self.file_name = file_name
self.num_clues = num_clues
def parse_file(fil... |
"""
Limited dependent variable and qualitative variables.
Includes binary outcomes, count data, (ordered) ordinal data and limited
dependent variables.
General References
--------------------
A.C. Cameron and P.K. Trivedi. `Regression Analysis of Count Data`.
Cambridge, 1998
G.S. Madalla. `Limited-Dependent an... |
#!/usr/bin/env python
# Copyright 2017 H2O.ai; Apache License Version 2.0; -*- encoding: utf-8 -*-
import pytest
import time
from tests import typed, py3only, TTypeError
# Stub
def foo():
return False
def test_func_0args0kws():
@typed()
def foo():
return True
assert foo()
with pytest.r... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.