text stringlengths 1 927k |
|---|
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from math import floor
from maro.backends.frame import node, NodeBase, NodeAttribute
def gen_vessel_definition(stop_nums: tuple):
@node("vessels")
class Vessel(NodeBase):
# The capacity of vessel for transferring containers.
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from .userinfo import UserInfo
import datetime
import json
import logging
import time
import requests
from requests_toolbelt import MultipartEncoder
import uuid
import re
from .commentGen import commentGen
from .filesCount import files... |
import numpy as np
import pytest
import pandas.util._test_decorators as td
from pandas import (
DataFrame,
NaT,
Series,
Timestamp,
date_range,
period_range,
)
import pandas._testing as tm
class TestDataFrameValues:
@td.skip_array_manager_invalid_test
def test_values(self, float_frame... |
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# 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
#
# htt... |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "petsite.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
... |
import numpy as np
from joblib import Parallel, delayed
import multiprocessing
num_cores = multiprocessing.cpu_count()
def pearson_corr_distance_matrix(timelines, lag=0):
if lag == 0:
return np.corrcoef(timelines)
def corr(timelines, timeline, lag):
corr_mat = np.zeros((1, len(timelines)))
... |
#
# Copyright 2016 Cluster Labs, 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 agreed to in ... |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(name='rdalchemy',
version='0.0.21',
description='Using SQLAlchemy with chemical databases',
packages=['rdalchemy'],
install_requires=[
'psycopg2-binary',
'SQLAlchemy>=0.7.0',
],
) |
# O(n^2)
def arithmetic_series(n: int) -> int:
if n < 0:
raise ValueError('Argument n is not a natural number')
return int((n + 1) * n * 0.5)
def arithmetic_series_loop(n: int) -> int:
if n < 0:
raise ValueError('Argument n is not a natural number')
s: int = 0
while n > 0:
... |
"""Configuration of pytest."""
import pytest
from looseserver.server.core import Manager
@pytest.fixture
def core_manager(base_endpoint):
"""Core manager."""
return Manager(base=base_endpoint) |
#!/usr/bin/python
"""
takes a shadow.config.xml file and replaces args with new format used in shadow v1.10.0.
this is to say the first 2 args of every tor node args line are removed.
"""
import sys
from lxml import etree
if len(sys.argv) != 3: print >>sys.stderr, "{0} input.xml output.xml".format(sys.argv[0]);exit(... |
import unittest
import numpy as np
import scipy
import random
import bayesian_bootstrap.bootstrap as bb
from bayesian_bootstrap.bootstrap import (
mean,
var,
bayesian_bootstrap,
central_credible_interval,
highest_density_interval,
BayesianBootstrapBagging,
covar,
)
from sklearn.linear_model ... |
#!/usr/bin/env python
"""The setup script."""
from setuptools import setup, find_packages
from os.path import basename
from os.path import splitext
from glob import glob
with open("README.rst") as readme_file:
readme = readme_file.read()
with open("HISTORY.rst") as history_file:
history = history_file.read(... |
from datetime import datetime
import matplotlib.pyplot as plt
import torch
from evaluation.evaluate_forecasting_util import timeframe
from load_forecasting.forecast_util import dataset_df_to_np
from load_forecasting.post_processing import recalibrate
from load_forecasting.predict import predict_transform
from models.... |
#https://github.com/IfcOpenShell/IfcOpenShell/blob/master/src/ifcopenshell-python/ifcopenshell/guid.py#L56
#Thomas Krijnen
#Matthis Thorade
#buildingSMART
###############################################################################
# #
# Th... |
from typing import List
class Solution:
"""TITLE: 寻找两个正序数组的中位数
给定两个大小分别为 m 和 n 的正序(从小到大)数组 nums1 和 nums2。
请你找出并返回这两个正序数组的 中位数 。
NOTE: 示例
示例 1:
输入:nums1 = [1,3], nums2 = [2]
输出:2.00000
解释:合并数组 = [1,2,3] ,中位数 2
示例 2:
输入:nums1 = [1,2], nums2 = [3,4]
输出:2.50000
解释:合并数组 = [1... |
import pandas as pd
import collections as col
import numpy as np
def join_main_category(new_category, sub_categories, word_dict, size, data):
'''
this function joins sub_categories into a main category
==============================================================
input:
- new_... |
import unittest
from context import parser
class TVShowFileParserTests(unittest.TestCase):
def setUp(self):
self.filename = parser.Parser("test.(2018).s01E01.1080p.avi")
def tearDown(self):
self.filename = None
def testObjValuesSet(self):
self.assertEqual(self.filename.showName,... |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_httpauth import HTTPBasicAuth
import logging
from logging.handlers import RotatingFileHandler
# initialization
app = Flask(__name__)
handler = RotatingFileHandler('foo.log', maxBytes=10000, backupCount=1)
handler.setLevel(logging.INFO)
app.lo... |
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file '_options.ui'
##
## Created by: Qt User Interface Compiler version 6.3.0
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
##################... |
import adv.adv_test
from adv import *
from slot.a import *
from slot.d import *
def module():
return W_Elisanne
class W_Elisanne(Adv):
comment = '2in1'
conf = {}
conf = {}
conf['acl'] = """
`s1,fsc and s2.charged<s2.sp-749
`s2
`s3,fsc and not this.s2debuff.get()
... |
#!/usr/bin/env python3
"""
Created on 23 Jun 2019
@author: Bruno Beloff (bruno.beloff@southcoastscience.com)
DESCRIPTION
The display utility is used to set the content for a visual display, such as the Pimoroni Inky pHAT eInk module.
Content is gained from several sources:
* The display_conf settings
* System statu... |
import smart_imports
smart_imports.all()
def login_required(func):
@functools.wraps(func)
def wrapper(resource, *argv, **kwargs):
from the_tale.accounts import logic as accounts_logic
if resource.account.is_authenticated:
return func(resource, *argv, **kwargs)
else:
... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('spirit_topic... |
# -*- coding: utf-8 -*-
"""
Created on Tue May 4 13:36:39 2021
@author: MorganaGiorgio
"""
from Learner import *
class Greedy_Learner(Learner):
def __init__(self, n_arms):
super().__init__(n_arms)
self.expected_rewards = np.zeros(n_arms)
def pull_arm(self):
#all'inizio pulo ... |
# Copyright 2018-2020 Streamlit 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 agreed to in wr... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: elily.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 google.protobuf impor... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from jinja2 import Template
import sys
tmpl = """
{% for link in links %}
<a href="{{link.href}}">{{link.name}}</a>
{% endfor %}
"""
if __name__ == '__main__':
links = [
{'name': 'Google', 'href': 'https://www.google.com'},
{'name': 'Facebook', 'href': 'https://... |
# 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 -*-
'''
:codeauthor: Jayesh Kariya <jayeshk@saltstack.com>
'''
# Import Python Libs
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt Testing Libs
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.unit import TestCase
from tests.supp... |
# -*- encoding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
from django.forms import ModelForm
from django import forms
from transmanager.utils import get_model_choices, get_application_choices
from .models import TransTask, TransModelLanguage, TransApplicationLanguage, TransUser
class TransAp... |
# Copyright (c) OpenMMLab. All rights reserved.
import mmcv
def wider_face_classes():
return ['face']
def voc_classes():
return [
'aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car', 'cat',
'chair', 'cow', 'diningtable', 'dog', 'horse', 'motorbike', 'person',
'pottedplant'... |
from kivy.uix.splitter import Splitter, SplitterStrip
from kivy.lang import Builder
from kivy.core.window import Window
from kivy.properties import BooleanProperty
from kivystudio.behaviors import HoverBehavior
Builder.load_string('''
#: import Factory kivy.factory.Factory
<StudioSplitter>:
strip_cls: Factory.St... |
import logging
from socketserver import ThreadingTCPServer
from config import Service as ServiceConfig
from lib.tcp.server import FileHandler
logger = logging.getLogger('mig')
if __name__ == '__main__':
serv = ThreadingTCPServer(('', ServiceConfig.PORT), FileHandler)
serv.request_queue_size = 20 # 提高queue大小,... |
import numpy as np
import torch.utils.data as utils
from neuralpredictors.data.samplers import RepeatsBatchSampler
def get_oracle_dataloader(dat, toy_data=False, oracle_condition=None, verbose=False, file_tree=False):
if toy_data:
condition_hashes = dat.info.condition_hash
else:
dat_info = d... |
#!"C:\Users\Juan Pablo\Documents\GitHub\REGEX-BOT-v1\venv\Scripts\python.exe"
# EASY-INSTALL-ENTRY-SCRIPT: 'setuptools==40.8.0','console_scripts','easy_install-3.8'
__requires__ = 'setuptools==40.8.0'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'... |
# -*- coding: utf-8 -*-
from glob import glob
import numpy as np
import psycopg2
from prettytable import PrettyTable
from sqlalchemy import create_engine, MetaData
import contextlib
from resources.paths import *
from resources.tables_func import *
from utilities.files_function import calculate_time
class Db:
def __... |
#!/usr/bin/env python3
# Copyright (c) 2016 The Bitcoin Core developers
# Copyright (c) 2017 The Californiacoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test version bits warning system.
Generate chains w... |
# -*- coding: utf-8 -*- #
# Copyright 2019 Google LLC. 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 requir... |
import os.path as osp
from copy import deepcopy
from datetime import datetime
import ignite.distributed as idist
import mmcv
from functools import partial
from ignite.contrib.handlers import ProgressBar
from ignite.contrib.metrics import ROC_AUC, AveragePrecision
from ignite.engine import Engine, Events
from ignite.ha... |
import pytest
import torch
import torch.nn as nn
from pytorch_lightning import Trainer, Callback
from pytorch_lightning.utilities.device_dtype_mixin import DeviceDtypeModuleMixin
from tests.base import EvalModelTemplate
class SubSubModule(DeviceDtypeModuleMixin):
pass
class SubModule(nn.Module):
def __ini... |
# -*- coding: utf-8 -*-
from __future__ import division
import logging
import collections
import ast
import _ast
import string
import numpy as np
import math
import sys
import six
import copy
import difflib
if hasattr(_ast, 'Num'):
ast_Num = _ast.Num
ast_Str = _ast.Str
else: # Python3.8
ast_Num = _ast.Co... |
import FWCore.ParameterSet.Config as cms
from PhysicsTools.SelectorUtils.tools.vid_id_tools import *
from PhysicsTools.PatAlgos.tools.helpers import getPatAlgosToolsTask, addToProcessAndTask
def miniAOD_customizeCommon(process):
process.patMuons.isoDeposits = cms.PSet()
process.patElectrons.isoDeposits = cms... |
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("games", "0001_initial")]
operations = [
migrations.CreateModel(
name="GameVideo",
fields=[
(
"id",
... |
#! /usr/bin/python3
import sys, os, time
from typing import Tuple, List
def runGenerations(fishes: List[int], generations: int) -> int:
fishCounts = [ 0 ] * 9
for fish in fishes:
fishCounts[fish] += 1
for _ in range(generations):
fishesAtZero = fishCounts[0]
for day in range(8):
... |
from glouton.infrastructure.satnogClient import SatnogClient
import os
import requests
class SatnogDbClient(SatnogClient):
def __init__(self):
SatnogClient.__init__(self)
self._url = self.config['DEFAULT']['DB_API_URL']
def get(self, url, params=None):
return requests.get(url, params=... |
from functools import reduce
FILENAME = './puzzle9/data/input'
height_points = []
with open(FILENAME) as file:
for line in file:
height_points.append([int(x) for x in list(line.strip())])
def generate_zero():
zero_list = []
for i in range(0, len(height_points)):
zero_list.append([0 for x... |
from ..models.producto import Producto
from rest_framework import serializers, viewsets
from rest_framework import permissions
from django.db.models import Q
from operator import __or__ as OR
from functools import reduce
class ProductoSerializer(serializers.ModelSerializer):
class Meta:
model = Producto
... |
import json
from adapters.base_adapter import Adapter
from adapters.adapter_with_battery import AdapterWithBattery
from devices.switch.on_off_switch import OnOffSwitch
# TODO: Think how to reuse the code between classes
class SirenAdapter(Adapter):
def __init__(self):
super().__init__()
self.switch... |
'''
MLCommons
group: TinyMLPerf (https://github.com/mlcommons/tiny)
image classification on cifar10
eval_functions_eembc.py: performances evaluation functions from eembc
refs:
https://github.com/SiliconLabs/platform_ml_models/blob/master/eembc/Methodology/eval_functions_eembc.py
'''
import numpy as np
import matplo... |
"""
split_fields
============
"""
from ansys.dpf.core.dpf_operator import Operator
from ansys.dpf.core.inputs import Input, _Inputs
from ansys.dpf.core.outputs import Output, _Outputs, _modify_output_spec_with_one_type
from ansys.dpf.core.operators.specification import PinSpecification, Specification
"""Operators from... |
from __future__ import annotations
from typing import List
from functools import reduce
import torch
from utils.distributions import get_distribution_by_name, Base
def _get_distributions(dists_names) -> List[Base]:
dists = []
for i, name in enumerate(dists_names):
is_gammatrick = name[-1] == '*'
... |
from typing import Tuple
from elegy.metrics.metric import Metric
import typing as tp
import haiku as hk
from elegy import utils
import jax
def forward_all(metrics_fn):
def _metrics_fn(**kwargs):
if isinstance(metrics_fn, (tp.List, tp.Tuple, tp.Dict)):
metrics = jax.tree_multimap(lambda f: f(... |
# 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, software
# d... |
# Define the functions used to get Get the weighted global mean temperature
# from pangeo CMIP6 results.
# Import packages
import stitches.fx_pangeo as pangeo
import stitches.fx_data as data
import stitches.fx_util as util
import os
import pkg_resources
import pandas as pd
def get_global_tas(path):
"""
Calcu... |
from django.db import models
from accounts.models import Profile
from django.contrib.auth.models import User
class Shop(models.Model):
name = models.CharField(max_length=100)
desc = models.TextField()
address = models.CharField(max_length=100)
admin = models.ForeignKey(
Profile,
on_dele... |
# -*- coding: utf-8 -*-
"""Tools to build Columns HighCharts parameters."""
from .base import JSONView
class BaseColumnsHighChartsView(JSONView):
"""Base Class to generate Column HighCharts configuration.
Define at least title, yUnit, providers, get_labels() and
get_data() to get started.
"""
pro... |
import asyncio
import sys
if sys.platform == "win32" and sys.version_info >= (3, 8, 0):
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) |
from django.test import TestCase
from .models import Post, Profile, Location, NeighbourHood, Business
from django.contrib.auth.models import User
# Neighbourhood Model Tests
class NeighbourhoodTestClass(TestCase):
def setUp(self):
# create a location instance
self.location = Location(name='Test L... |
from typing import List, Dict, Sequence
import click
from valohai_cli.ctx import get_project
from valohai_cli.models.project import Project
from valohai_cli.range import IntegerRange
from valohai_cli.table import print_table
from valohai_cli.utils import subset_keys
def download_execution_data(project: Project, cou... |
"""
The flask application package.
"""
from flask import Flask
app = Flask(__name__)
import bucketlist.views |
"""Makers"""
from contextlib import suppress
from typing import Mapping, Iterable, TypeVar, Callable
from itertools import product
from collections import defaultdict
T = TypeVar('T')
with suppress(ModuleNotFoundError, ImportError):
from numpy.random import randint, choice
def random_graph(n_nodes=7):
... |
"""
Prepare eo3 metadata for Sentinel-2 Level 1C data produced by Sinergise or esa.
Takes ESA zipped datasets or Sinergise dataset directories
"""
import fnmatch
import json
import logging
import sys
import uuid
import zipfile
from pathlib import Path
from typing import Tuple, Dict, List, Optional, Iterable, Mapping
... |
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from decimal import Decimal
import glob
import os
import shutil
import csv
import sys
import argparse
import math
parser = argparse.ArgumentParser(description='ALiBaSeq (Alignment-Based Sequence extraction)',formatter_class=argparse.Argu... |
"""Upload local Files to gDrive
Syntax:
.gdrive
.sdrive
.gdir
.dfolder
.drive delete | get
.gclear """
# The entire code given below is verbatim copied from
# https://github.com/cyberboysumanjay/Gdrivedownloader/blob/master/gdrive_upload.py
# there might be some changes made to suit the needs for this repository
# Lic... |
# Copyright 2016-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from torch.autograd import Function
from torch.nn import Module
from .utils import *
from .metadata import Metadata
from .s... |
print(0 ^ (1 << 80))
print((1 << 80) ^ (1 << 80))
print((1 << 80) ^ 0)
a = 0xfffffffffffffffffffffffffffff
print(a ^ (1 << 100))
print(a ^ (1 << 200)) |
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
import numpy as np
import tensorflow as tf
tf.enable_eager_execution()
def eval_model(interpreter, coco_ds):
total_seen = 0
num_correct = 0
for img, label in coco_ds:
total_seen += 1
interpreter.set_tensor(input_index, img)
interpreter.invoke()
... |
# Generated by Django 3.1.5 on 2021-01-22 18:07
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('catalog', '0004_bookinstance_borrower'),
]
operations = [
migrations.AlterModelOptions(
name='bookinstance',
options={'order... |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from nipype.testing import assert_equal
from nipype.interfaces.afni.preprocess import ZCutUp
def test_ZCutUp_inputs():
input_map = dict(args=dict(argstr='%s',
),
environ=dict(nohash=True,
usedefault=True,
),
ignore_exception=dict(nohash=True... |
from phabricator import Phabricator
import sys
import json
def get_value_from_payload(value, payload, field):
if payload:
try:
return payload[field][value] if payload[field] else None
except KeyError:
raise KeyError(f'{value} not found')
def get_token(payload):
return g... |
import logging
import struct
from textx.metamodel import metamodel_from_file
from ppci import ir
from ppci.irutils import verify_module
from ppci import api
def pack_string(txt):
ln = struct.pack('<Q', len(txt))
return ln + txt.encode('ascii')
class TcfCompiler:
""" Compiler for the Tcf language """
... |
import threading
import logging
from apscheduler.schedulers.blocking import BlockingScheduler
from huobi.connection.impl.private_def import *
from huobi.utils.time_service import get_current_timestamp
def watch_dog_job(*args):
watch_dog_obj = args[0]
for idx, websocket_manage in enumerate(watch_dog_obj.webs... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 16
Keras Implementation of Deep Multiple Graph Convolution Neural Network (DMGCN) model in:
Hu Yang, Wei Pan, Zhong Zhuang.
@author: Hu Yang (hu.yang@cufe.edu.cn)
"""
from keras.layers import Layer
from keras import activations, initializers, constraints
from keras import... |
from src.indices import spindex
from py_expression_eval import Parser
import pandas as pd
import json
parser = Parser()
# Adding band attribute
for key in spindex.SpectralIndices:
SpectralIndex = spindex.SpectralIndices[key]
formula = parser.parse(SpectralIndex.formula)
SpectralIndex.bands = formula.varia... |
from .test_data_builder import *
from .test_stream_data import * |
from setuptools import setup, find_packages
with open('README.md') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
setup(
name='design-patterns',
version='0.1.0',
description='Design patterns in Python',
long_description=readme,
author='Sebastian Czech',
author_... |
import math
import numpy as np
import torch
import random
# ipt is nparray with dimension (height, width, channel)
# xml is nparray with dimension (height, width)
def addNoise(ipt, miu, std):
noise = np.random.normal(miu, std, ipt.shape)
noise = np.float32(noise)
return ipt + noise
def thAddNoise(ipt, m... |
# Copyright (c) 2019, NVIDIA Corporation. All rights reserved.
#
# This work is made available under the Nvidia Source Code License-NC.
# To view a copy of this license, visit
# https://nvlabs.github.io/stylegan2/license.html
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
import numpy as np
import tensorflow as tf
i... |
# Generated by Django 3.2 on 2021-05-09 07:58
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('game', '0006_alter_gameroom_status'),
]
operations... |
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import ExtractorError
class FreeVideoIE(InfoExtractor):
_VALID_URL = r'^http://www.freevideo.cz/vase-videa/(?P<id>[^.]+)\.html(?:$|[?#])'
_TEST = {
'url': 'http://www.freevideo.cz/vase-videa/vysukany-zadecek-22033... |
from .control_constraints import ControlConstraint, ControlDeltaConstraint
from .state_constraints import (StateConstraint, ConstantMeanStateConstraint,
MovingMeanStateConstraint) |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/api/http.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 google.protobuf import reflection a... |
"""Test Home Assistant template helper methods."""
from datetime import datetime
import math
import random
import pytest
import pytz
from homeassistant.components import group
from homeassistant.const import (
LENGTH_METERS,
MASS_GRAMS,
MATCH_ALL,
PRESSURE_PA,
TEMP_CELSIUS,
VOLUME_LITERS,
)
fr... |
#!/usr/bin/python3
#Reducer.py
import sys
dict_ven={}
#Partitoner
for line in sys.stdin:
line=line.strip('\n')
if (len(line.split(','))==4):
venue,v1,batsman,run=line.split(',')
venue=venue+','+v1
else:
venue,batsman,run=line.split(',')
key=(venue,batsman)
if(key not in dic... |
from pydantic import BaseModel
from prometheus_adaptive_cards.config import Target
class Payload(BaseModel):
data: dict
targets: list[Target] |
# 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 django.core.exceptions import ImproperlyConfigured
from rest_framework.pagination import CursorPagination
from rest_framework.response import Response
class ActivityCursorPagination(CursorPagination):
"""
Cursor pagination for activities.
The activity stream service scrapes specified endpoints at re... |
import mmd_scripting.core.nuthouse01_core as core
import mmd_scripting.core.nuthouse01_pmx_parser as pmxlib
import mmd_scripting.core.nuthouse01_pmx_struct as pmxstruct
from mmd_scripting.scripts_for_gui import morph_scale
_SCRIPT_VERSION = "Script version: Nuthouse01 - v1.07.01 - 7/23/2021"
# This code is free to us... |
# 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.
import copy
import logging
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import List
fr... |
from jcasts.users.emails import send_user_notification_email
class TestSendUserNotificationEmail:
def test_send(self, user, mailoutbox):
send_user_notification_email(
user,
"testing!",
"account/emails/test_email.txt",
"account/emails/test_email.html",
... |
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Tests for the engine utils module
"""
from __future__ import print_function, division, unicode_literals, absolute_import
from builtins import range, open
import os
from copy impo... |
import logging
import oe.classutils
import shlex
from bb.process import Popen, ExecutionError
from distutils.version import LooseVersion
logger = logging.getLogger('BitBake.OE.Terminal')
class UnsupportedTerminal(Exception):
pass
class NoSupportedTerminals(Exception):
def __init__(self, terms):
self... |
import argparse
import ray
import rl.rllib_script.agent.model.ray_model
from blimp_env.envs import ResidualPlanarNavigateEnv
from blimp_env.envs.script import close_simulation
from ray import tune
from ray.rllib.agents import ppo
from ray.tune.registry import register_env
from rl.rllib_script.util import find_nearest_... |
from keras.layers import merge
from keras.layers.core import *
from keras.layers.recurrent import LSTM
from keras.models import *
from attention_utils import get_activations, get_data_recurrent
INPUT_DIM = 2
TIME_STEPS = 20
# if True, the attention vector is shared across the input_dimensions where the attention is a... |
import numpy as np
import pyexotica as exo
import unittest
from numpy import testing as nptest
from scipy.optimize import minimize
class TestBoxQP(unittest.TestCase):
"""Tests BoxQP implementation against scipy."""
def test_zero_q(self):
np.random.seed(100)
# check against 100 state,cont... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'transgendercare.settings')
try:
from django.core.management import execute_from_command_line
exc... |
from autode.neb.original import NEB
from autode.neb.ci import CINEB
__all__ = ['NEB',
'CINEB'] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.