text stringlengths 1 927k |
|---|
"""A pytest plugin which helps testing Django applications
This plugin handles creating and destroying the test environment and
test database and provides some useful text fixtures.
"""
import contextlib
import inspect
from functools import reduce
import os
import pathlib
import sys
import pytest
from .django_compa... |
from typing import Any, Dict, List, Optional, Tuple, Type, Union, overload
import numpy as np
from squad.exceptions import (
EdgeAlreadyExists,
EdgeNotFound,
NodeAlreadyExists,
NodeNotFound,
)
class Node:
"""
Single node in a graph.
"""
def __init__(self, name: str, **data: Any) -> ... |
'''
This script will validate a DataModel against an collection of
input files. It will verify they are able to be parsed correctly.
'''
import os, sys, time, glob
sys.path.append("c:/peach")
print """
]] Peach Validate Multiple Files
]] Copyright (c) Michael Eddington
"""
if len(sys.argv) < 3:
print """
This pr... |
# python3
import itertools
n, m = list(map(int, input().split()))
A = []
for i in range(n):
A += [list(map(int, input().split()))]
b = list(map(int, input().split()))
clauses = []
for i, coefficient in enumerate(A):
non_coefficients = [(j, coefficient[j]) for j in range(m) if 0 != coefficient[j]]
l = len(non_c... |
IN_LONG_VERSION_PY = True
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by github's download-from-tag
# feature). Distribution tarballs (build by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter f... |
´´´
## NAME
[programName].py
## VERSION
[#.#]
## AUTHOR
Zara Paulina Martinez Sanchez <zaram042001@gmail.com>
[Other authors]: [Modifications]
## DATE
[dd/mm/yyyy]
## DESCRIPTION
[briefly describe what the program does]
## CATEGORY
[category of the program: sequence analysis for example]
## USAGE
... |
import importlib
import sys
from aoc_input import get_input
if __name__ == "__main__":
if len(sys.argv) < 3:
print("Specify which file to run! [year, day]")
sys.exit()
try:
year = int(sys.argv[1])
day = int(sys.argv[2])
except ValueError:
print("Integer required!")
sys.exit()
module = importlib.impo... |
# Copyright 2017 Intel 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 wri... |
"""
Adapted from the pytorch-lamb library at https://github.com/cybertronai/pytorch-lamb
"""
import torch
from torch.optim import Optimizer
from colossalai.registry import OPTIMIZERS
@OPTIMIZERS.register_module
class Lamb(Optimizer):
r"""Implements Lamb algorithm.
It has been proposed in `Large Batch Optimi... |
# Copyright 2018 Recruit Communications Co., Ltd.
#
# 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/env python
import h5py
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import sys
runnr = int(sys.argv[1])
filename = '/asap3/flash/gpfs/bl1/2017/data/11001733/processed/hummingbird/r%04d_ol1.h5' %runnr
with h5py.File(filename, 'r') as f:
hitscore = f['entry_1/... |
# 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 may ... |
# Copyright 2018 Iguazio
#
# 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, softwa... |
# Copyright 2013-2020 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 *
TUNE_VARIANTS = (
'none',
'cp2k-lmax-4',
'cp2k-lmax-5',
'cp2k-lmax-6',
... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 17 18:06:40 2020
@author: Kokkinos
lines for telnet communication: 31,32,136,139,149,152,201,204,212,215,296
"""
from threading import Thread
import numpy as np
import scipy.io as sio
from pylsl import StreamInlet, resolve_stream
from tkinter import *
import telnetlib
i... |
from socket import socket
def main():
with socket() as tcp_socket:
tcp_socket.bind(('', 8080))
tcp_socket.listen()
client_socket, client_addr = tcp_socket.accept()
with client_socket:
print(f"[肉鸡{client_addr}已经上线:]\n")
while True:
cmd = input... |
import os
import numpy as np
import torch
from tensorboardX import SummaryWriter
import distributed
from models.reporter_ext import ReportMgr, Statistics
from others.logging import logger
from others.utils import test_rouge, rouge_results_to_str
def _tally_parameters(model):
n_params = sum([p.nelement() for p i... |
# Copyright 2017 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... |
from kdsl.apps.v1 import Deployment, DeploymentSpec
from kdsl.core.v1 import Service, ServiceSpec, PodSpec, ObjectMeta, ContainerItem
import values
name = "redis"
labels = dict(component=name)
annotations = values.shared_annotations
metadata = ObjectMeta(
name=name,
namespace=values.NAMESPACE,
labels=di... |
"""Apache Configuration based off of Augeas Configurator."""
# pylint: disable=too-many-lines
import filecmp
import logging
import os
import re
import shutil
import socket
import time
import zope.interface
from acme import challenges
from letsencrypt import errors
from letsencrypt import interfaces
from letsencrypt ... |
from utils.db import Database
from datetime import datetime
import hashlib
import json
import os
import requests
url = 'https://maps.googleapis.com/maps/api/geocode/json'
api_key = os.environ['GOOGLE_MAPS_API_KEY']
params = {'key': api_key, 'address': 'Mountain View, CA'}
print("Downloading entities")
db = Database()... |
#!/usr/bin/python3
from collections import OrderedDict
import sys
import urllib
import xml.etree.ElementTree as etree
import urllib.request
def parse_xml(path):
file = urllib.request.urlopen(path) if path.startswith("http") else open(path, 'r')
with file:
tree = etree.parse(file)
return tree
def patch_file(pat... |
"""
A collection of tests covering legacy user management in DC/OS.
Legacy user management is considered to be the user management API offered by
`dcos-oauth` up to DC/OS release 1.12.
Assume that access control is activated in Master Admin Router (could be
disabled with `oauth_enabled`) and therefore authenticate in... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 19 10:16:35 2019
@author: naiara
"""
# SCORE MATRIX OR SUBSTITUTION MATRIX
"""
1 = "ACAGGTGGACCT"
2 = "ACTGGTCGACTC"
P(A) = 5/24 P(A, A) = 2/12 P(C, C) = 2/12 P(G, T) = 1
P(C) = 6/24 P(A, C) = 1 P(C, G) = 1... |
import yaml
from celery import Celery
from pymongo import MongoClient
from models.todo_dao import MongoDAO
from models.todo import TodoSchema
from library.utils import replace_env, make_url
with open("/config/todos/default_config.yml", "r") as f:
config = yaml.load(f, yaml.SafeLoader)
replace_env(config)
url = m... |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2017, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... |
# Copyright 2021 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, ... |
# -*- coding: utf-8 -*-
import glob
import json
import numpy
import os
import PIL.Image
import PIL.ImageChops
import pytest
import six
from large_image import constants
from large_image.exceptions import TileSourceException
import large_image_source_gdal
from . import utilities
def _assertImageMatches(image, test... |
import uuid
from datetime import datetime
from django.db import models
from django.utils import timezone
from .game import Game
from .player import Player
from .util import generate_code
class SupplyCodeManager(models.Manager):
def create_supply_code(self, game: Game, value: 5, code: None) -> 'SupplyCode':
... |
from je_editor.ui.ui_event.text_process import * |
# Copyright (c) 2019 Sony Corporation. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... |
# -*- coding: utf-8 -*-
def test_calls_add(slack_time):
assert slack_time.calls.add
def test_calls_end(slack_time):
assert slack_time.calls.end
def test_calls_info(slack_time):
assert slack_time.calls.info
def test_calls_update(slack_time):
assert slack_time.calls.update
def test_calls_partici... |
from django.urls import path
from .views import RecruiterIndexView, take_on_application_view, SaveTaskChangesView
urlpatterns = [
path('', RecruiterIndexView.as_view(), name='recruiter_portal'),
path('take_on_application/<application_pk>/', take_on_application_view, name='take_on_application'),
path('save... |
from __future__ import division, absolute_import, print_function
import os
import sys
from distutils.command.build import build as old_build
from distutils.util import get_platform
from numpy.distutils.command.config_compiler import show_fortran_compilers
class build(old_build):
sub_commands = [('config_cc', ... |
#!/usr/bin/env python3
# Copyright (c) 2016 The Bitcoin Core developers
# Copyright (c) 2017 The Whiff Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test RPC commands for signing and verifying messages."""
fro... |
#
# (c) Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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/licens... |
import os
import platform
import pytest
from ground.base import (Context,
get_context)
from hypothesis import (HealthCheck,
settings)
on_azure_pipelines = bool(os.getenv('TF_BUILD', False))
is_pypy = platform.python_implementation() == 'PyPy'
settings.register_profile(... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'SqlToModel.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise Imp... |
'''
This is the file that contains the Diffie-Hellman algorithm to establish shared keys between Alice, Bob, and the KDC. It'll just be functions that are going
to be used in other files.
Using this video to help me out with Diffie-Hellman: https://www.youtube.com/watch?v=Yjrfm_oRO0w
g and n are public numbers. g i... |
# This file is covered by the BSD license. See LICENSE in the root directory.
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from django.core import mail
from django.test import TestCase
from django.urls import reverse
from rest_framework import status
User = get_user_model... |
from app.lib.dns.helpers.shared import SharedHelper
import os
import datetime
import json
import progressbar
from app import db
class DNSImportManager(SharedHelper):
IMPORT_TYPE_ZONE = 1
IMPORT_TYPE_RECORD = 2
@property
def last_error(self):
return self.__last_error
@last_error.setter
... |
# Generated by Django 3.0.5 on 2020-04-10 10:01
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Vets',
fields=[
('id', models.AutoField(aut... |
"""
SC101 Baby Names Project
Adapted from Nick Parlante's Baby Names assignment by
Jerry Liao.
------------------------------------------
File: babynames.py
Name: Calvin Chen
This file reads the most famous baby names from 1900 to
2010 in the US and stores the .txt into the dictionary
to provide the information for the... |
from __future__ import absolute_import
import json
import logging
from datetime import datetime
from threading import Thread
from tornado import web
from tornado import gen
from tornado.escape import json_decode
from tornado.web import HTTPError
from celery import states
from celery.result import AsyncResult
from c... |
import sys
import numpy as np
import matplotlib.pyplot as plt
import sys
import os
import time
import argparse
from visual_utils import generate_listcol
import seaborn as sns
def calculate_npent(death_scales):
sd = np.sum(death_scales)
npent = 0
for d in death_scales:
dr = d/sd
npent -= dr*... |
import os
from niveristand import _errormessages, errors
from niveristand import _internal
from niveristand._translation.py2rtseq.utils import _py_param_name_to_rtseq_param_name
from niveristand.clientapi import stimulusprofileapi
from niveristand.clientapi._factory import _DefaultGatewayFactory
from niveristand.client... |
#
# Copyright (c) 2020, Gabriel Linder <linder.gabriel@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 permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS"... |
from __future__ import absolute_import
# Copyright (c) 2010-2016 openpyxl
"""Write worksheets to xml representations."""
# Python stdlib imports
from io import BytesIO
from openpyxl import LXML
# package imports
from openpyxl.xml.functions import (
Element,
xmlfile,
)
from openpyxl.xml.constants import SHEE... |
# Copyright 2017 DiCTIS UGR
# 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... |
#######################################################################################################################
# Taran Wells
# Wellst
# https://docs.google.com/document/d/1RBeOXjYBBjZ507wVeQVIPBrU7gBvTNJi8BYGDvtC53w/edit?usp=sharing
##############################################################################... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="basketball_reference_scraper",
version="1.0.28",
author="Vishaal Agartha",
author_email="vishaalagartha@gmail.com",
license="MIT",
description="A Python client for scraping stats and d... |
Pair Sums
'''
Pair Sums
Given a list of n integers arr[0..(n-1)], determine the number of different pairs of elements within it which sum to k.
If an integer appears in the list multiple times, each copy is considered to be different; that is, two pairs are considered different if one pair includes at least one array ... |
#! /usr/bin/env python
"""
@author: maedbhking
based heavily on flexible functionality of nilearn `setup.py`
"""
descr = """A python package for cerebellar neuroimaging..."""
import sys
import os
from setuptools import setup, find_packages
def load_version():
"""Executes SUITPy/version.py in a globals dictiona... |
import rbm_rm as RBM
import Learning_rm as Learning
class DBN:
def __init__(self, n_in, n_out, hidden_arch, prediction_type, lts=None, net_regs=None, gaussian_input=False, default_lt='Logistic'):
self.n_in = n_in
self.n_out= n_out
# determine the architectures for the autoencoder and the
... |
from logging import getLogger
from pathlib import Path
from typing import List, Optional
from typer import Argument
from deckz.cli import app
from deckz.paths import Paths
from deckz.watching import watch as watching_watch
_logger = getLogger(__name__)
@app.command()
def watch(
targets: Optional[List[str]] = A... |
# -*- coding: utf-8 -*-
import os
from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
# 导入对应产品模块的client models。
from tencentcloud.cvm.v20170312 import cvm_client, models
import json
# 导入可选配置类
from tencentcloud.common.profile.client_p... |
from django.db import models
class Category(models.Model):
name = models.CharField(max_length=100)
created_at = models.DateTimeField(auto_now_add=True)
def __str__(self):
return self.name
class Meta:
verbose_name_plural = 'Categorias'
class Transactions(models.Model):
date = models.DateField()
... |
# 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 ... |
from __future__ import print_function
import kernels
import numpy as np
import unittest
import gplvm
class TestBayesianGPLVM(unittest.TestCase):
def setUp(self):
N = 10 # number of data points
D = 1 # latent dimensions
M = 5 # inducings points
R = 2 # data dimension
k = ker... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import pywt
x = np.linspace(0, 1, num=512)
data = np.sin(250 * np.pi * x**2)
wavelet = 'db2'
level = 4
order = "freq" # other option is "normal"
interpolation = 'nearest'
cmap = plt.cm.cool
# Construct wavelet packet... |
# -*- coding: utf-8 -*-
"""
References:
http://deeplearning.net/software/theano/library/config.html
Check Settings:
python -c 'import theano; print theano.config' | less
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import utool as ut
import os
from os.path import join
... |
"""
This file offers the methods to automatically retrieve the graph Desulfotomaculum copahuensis.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v11: protein--p... |
from redis import StrictRedis as Redis
from pathlib import Path
import hashlib
import time
lua_script_path = Path(__file__).parent / 'ratelimit.lua'
with open(lua_script_path) as f:
LUA_SCRIPT = f.read()
del lua_script_path # don't want it polluting the module
class RateLimit(object):
def __init__(self,
... |
def _safe_int(string):
try:
return int(string)
except ValueError:
return string
__version__ = '3.0.6'
VERSION = tuple(_safe_int(x) for x in __version__.split('.')) |
from plato.test.base import BaseTestCase
from sqlalchemy.exc import IntegrityError
from plato import db
from plato.model.user import User
from plato.test.utils import add_user
class TestUserModel(BaseTestCase):
def test_user_model(self):
user = add_user('foo', 'foo@bar.com', 'test_pwd')
self.asse... |
# Dependencies
import tweepy
import time
import json
from config import consumer_key, consumer_secret, access_token, access_token_secret
# Twitter API Keys
consumer_key = consumer_key
consumer_secret = consumer_secret
access_token = access_token
access_token_secret = access_token_secret
# Setup Tweepy API Authenticat... |
"""WizardKit: Config - Log"""
# vim: sts=2 sw=2 ts=2
DEBUG = {
'level': 'DEBUG',
'format': '[%(asctime)s %(levelname)s] [%(name)s.%(funcName)s] %(message)s',
'datefmt': '%Y-%m-%d %H%M%S%z',
}
DEFAULT = {
'level': 'INFO',
'format': '[%(asctime)s %(levelname)s] %(message)s',
'datefmt': '%Y-%m-%d %H%M%z',
... |
import time
from apmserver import integration_test
from apmserver import ClientSideBaseTest, ElasticTest, ExpvarBaseTest, ProcStartupFailureTest
from helper import wait_until
from es_helper import index_metric, index_transaction, index_error, index_span, index_onboarding, index_name
@integration_test
class Test(Elas... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
import logging
#Configure logging
logging_filename = "../logs/example.log"
logging.basicConfig(filename=logging_filename, level=logging.DEBUG)
#----------------
# Example logging
#----------------
# When you are writing code, instead of using the 'print' statement (which only
# is shown on the command line), you can... |
'''OpenGL extension NV.multigpu_context
This module customises the behaviour of the
OpenGL.raw.GLX.NV.multigpu_context to provide a more
Python-friendly API
The official definition of this extension is available here:
http://www.opengl.org/registry/specs/NV/multigpu_context.txt
'''
from OpenGL import platform, cons... |
from PyQt4 import QtCore, QtGui
from boxes import ConnectedDevice
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(cont... |
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "<h1>Welcome to Python Flask App!</h1> <p1>hello this sample page</p1>"
if __name__ == "__main__":
app.run() |
# Copyright 2019 DeepMind Technologies 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 ... |
/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copyreg.py |
"""Tests for the Home Assistant auth module."""
from datetime import timedelta
from unittest.mock import Mock, patch
import pytest
from homeassistant import auth, data_entry_flow
from homeassistant.auth import (
models as auth_models, auth_store, const as auth_const)
from homeassistant.auth.mfa_modules import SES... |
'''
On a plane there are n points with integer coordinates points[i] = [xi, yi]. Your task is to find the minimum time in seconds to visit all points.
You can move according to the next rules:
In one second always you can either move vertically, horizontally by one unit or diagonally (it means to move one unit vertic... |
from selenium_ui.jira import modules
from extension.jira import extension_ui # noqa F401
# this action should be the first one
def test_0_selenium_a_login(jira_webdriver, jira_datasets, jira_screen_shots):
modules.login(jira_webdriver, jira_datasets)
def test_1_selenium_browse_projects_list(jira_webdriver, jir... |
"""
pgoapi - Pokemon Go API
Copyright (c) 2016 tjado <https://github.com/tejado>
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... |
# coding=utf-8
"""
The Lists API endpoint
Documentation: http://developer.mailchimp.com/documentation/mailchimp/reference/lists/
Schema: https://api.mailchimp.com/schema/3.0/Lists/Instance.json
"""
from __future__ import unicode_literals
from mailchimp3.baseapi import BaseApi
from mailchimp3.entities.listabusereports... |
#!/usr/bin/env python
# Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
# Allows controlling a vehicle with a keyboard. For a simpler and more
# docu... |
from __future__ import division, absolute_import, print_function
from ooxcb.protocol import (
xtest,
)
from ooxcb.constant import (
ButtonPress,
ButtonRelease,
KeyPress,
KeyRelease,
MotionNotify
)
import ooxcb
from ooxcb.keysymdef import keysyms
import subprocess
import os
from ._common import ... |
def exercise_the_api():
var1 = java_common.JavaRuntimeInfo
var2 = JavaInfo
var3 = java_proto_common
exercise_the_api()
def my_rule_impl(ctx):
return struct()
java_related_rule = rule(
implementation = my_rule_impl,
doc = "This rule does java-related things.",
attrs = {
"first": a... |
"""Tests for chebyshev module.
"""
import numpy as np
import numpy.polynomial.chebyshev as ch
from numpy.testing import *
def trim(x) :
return ch.chebtrim(x, tol=1e-6)
T0 = [ 1]
T1 = [ 0, 1]
T2 = [-1, 0, 2]
T3 = [ 0, -3, 0, 4]
T4 = [ 1, 0, -8, 0, 8]
T5 = [ 0, 5, 0, -20, 0, 16]
T6 = [-1,... |
# generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else []
PROJECT_CATKIN_DEPENDS = "".replace(';', ' ')
PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else []
PROJECT_NAME = "rrbot_gazebo"
PROJECT_SPACE_DIR = "/h... |
from boa.blockchain.vm.Neo.Blockchain import GetHeight, GetHeader
from boa.blockchain.vm.Neo.Header import GetTimestamp, GetConsensusData
from boa.blockchain.vm.Neo.Runtime import Log
from boa.code.builtins import concat, list, range, take, substr
def blockTimeStamp():
current_height = GetHeight()
c... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
if __name__ == '__main__':
m = int
n = int(input("Value of n? "))
for i in range(1, int(n / 2) + 1):
if n % i == 0:
print(i) |
import logging
import json
import time
import os
import config.config as pconfig
import env
from avalon_sdk.connector.direct.jrpc.jrpc_worker_registry import \
JRPCWorkerRegistryImpl
from avalon_sdk.connector.direct.jrpc.jrpc_work_order import \
JRPCWorkOrderImpl
from avalon_sdk.worker.worker_details import \
... |
from datetime import timedelta
import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
Index,
Int64Index,
Series,
Timedelta,
TimedeltaIndex,
array,
date_range,
timedelta_range,
)
import pandas._testing as tm
from ..datetimelike import DatetimeLike
ran... |
import requests
import json
#html = '<h1>hello world</h1>This is html'
f = open("../../week05/carviewer.html", "r")
html = f.read()
#print (html)
apiKey = '46ceed910c24ff7cce8240e89ec7b71912f6f40f2ec55fd217ce150a d6d4f1c4'
url = 'https://api.html2pdf.app/v1/generate'
data = {'html': html,'apiKey': apiKey}... |
# 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.
# -----------------------------------------------------... |
for i in range(int(input())):
for a in range(1, i + 2):
print(a, end='')
print() |
"""npm packaging
Note, this is intended for sharing library code with non-Bazel consumers.
If all users of your library code use Bazel, they should just add your library
to the `deps` of one of their targets.
"""
load("//:providers.bzl", "DeclarationInfo", "JSNamedModuleInfo", "LinkablePackageInfo", "NodeContextInfo... |
from os.path import join
import pytest
from cosmo_tester.test_suites.agent import validate_agent
from cosmo_tester.framework.examples import get_example_deployment
from cosmo_tester.test_suites.snapshots import (
create_copy_and_restore_snapshot,
)
@pytest.mark.four_vms
def test_migrate_agents_cluster_to_aio(
... |
from __future__ import absolute_import
import os
import unittest
import re
from vmaf.config import VmafConfig
from vmaf.core.feature_extractor import VmafFeatureExtractor, \
MomentFeatureExtractor, \
PsnrFeatureExtractor, SsimFeatureExtractor, MsSsimFeatureExtractor, \
VifFrameDifferenceFeatureExtractor, ... |
#!/usr/bin/env python3
import json
from pathlib import Path
def get_valid_file_path(file_path: str) -> Path:
"""Check if file exists and return valid Path object"""
path = Path(file_path).resolve()
if not path.is_file():
raise Exception("No file found! Please check your path and try again.")
... |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
import pandas as pd
import os
from pathlib import Path
import frontmatter
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("path", help="path containing .md files")
args = parser.parse_args()
data = [frontmatter.load(path).metadata for path in Path(args... |
import time
def getMaxSubSum(a):
s = 0
s1 = s
for i in range(0, n):
s += a[i]
s1 = max(s1, s)
if (s < 0):
s = 0;
return s1
n = 10000
a = []
for i in range(0, n):
a.append(pow(-1, i) * i)
#for i in range(0, n):
# print(a[i], " ")
#print();
start = time.pe... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 3.6.0-bd605d07 (http://hl7.org/fhir/StructureDefinition/ChargeItemDefinition) on 2018-12-20.
# 2018, SMART Health IT.
from . import domainresource
class ChargeItemDefinition(domainresource.DomainResource):
""" Definition of properties and ru... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.