filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_106_19489 | from PyQt5 import QtCore, QtGui, QtWidgets
from morphine.globals import __enviroments__, __intended_audience__, __programming_lang__, __license__, find_packages
import os
from yapf.yapflib.yapf_api import FormatCode
from morphine.template import __minimal_deps__ as template
class Ui_minimal_deps(object):
def __in... |
the-stack_106_19490 | # coding=utf8
# Copyright 2018 JDCLOUD.COM
#
# 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 ... |
the-stack_106_19491 | import logging
from typing import Tuple, Optional
from flask import current_app
import redis
from redis import Redis
from sqlalchemy.exc import OperationalError
from sqlalchemy.orm import sessionmaker
from sqlalchemy import create_engine
from backend.database.objects import DBObjectBase
logger = logging.getLogger(__na... |
the-stack_106_19493 | """This config file is just a dictionnary of useful values."""
# Author: Juju
import os
from pathlib import Path
import dotmap
PATHS = dotmap.DotMap
DATA = dotmap.DotMap
OS = os.name
PATHS.lib = str(Path(os.path.abspath(__file__)).parent.parent)
# replace ~ by the full path name
PATHS.home = os.path.expanduser('~')... |
the-stack_106_19497 | """
Monkeypatches for the Content class in Pelican, which has some assumptions that
it is working with HTML.
"""
import os
import re
import logging
from html import unescape
from urllib.parse import urlparse, urlunparse, urljoin, unquote
logger = logging.getLogger(__name__)
def _get_intrasite_link_regex(self):
... |
the-stack_106_19504 | from typing import Tuple, List, Optional
def swap_sum(arr_a: List[int], arr_b: List[int]) -> Optional[Tuple]:
sum_a = sum(arr_a)
sum_b = sum(arr_b)
# sum_a - a + b = sum_b - b + a
# a - b = (sum_a - sum_b) / 2
diff = sum_a - sum_b
if diff % 2 != 0:
return None
target = int(diff / ... |
the-stack_106_19505 | """Implementation of SPNEGO wsgi middleware."""
import functools
import logging
import re
import base64
import gssapi
from werkzeug import local
from werkzeug.wrappers import BaseRequest, BaseResponse
_LOGGER = logging.getLogger(__name__)
_AUTH_ERROR = functools.partial(BaseResponse, status=500)
_FORBIDDEN = fun... |
the-stack_106_19507 | # Copyright (C) 2018 Atsushi Togo
# All rights reserved.
#
# This file is part of phonopy.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notic... |
the-stack_106_19508 | #!/usr/bin/env python
from mininet.cli import CLI
from mininet.node import Link, Host
from mininet.net import Mininet
from mininet.node import RemoteController
from mininet.term import makeTerm
from mininet.topo import Topo
from functools import partial
class VLANHost( Host ):
"Host connected to VLAN interface"
... |
the-stack_106_19510 | from skyfield.api import Topos, load
import math
import random
import logging
import sys
import os
from datetime import datetime, timedelta, timezone
logging.disable(logging.INFO)
#Challenge
#Grab data from local text file for speed and consistency
#-------------------------------------------#
satellites = load.tle('... |
the-stack_106_19512 | import sys
from datetime import datetime
from threading import RLock
from .CacheStorage import CachedItem, ItemNotCached
from .MemoryStorage import MemoryStorage
class ItemExpired(ItemNotCached): pass
class LRUCache:
'''
Collection of data where data may be removed to make room
Each peace of data is ... |
the-stack_106_19513 | # encoding=utf-8
import numpy as np
import math
import sys
import os
import time
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
import torch.optim as optim
from torch.autograd import Variable
import torch.nn.functional as F
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
... |
the-stack_106_19515 | # coding: utf-8
"""
NiFi Rest Api
The Rest Api provides programmatic access to command and control a NiFi instance in real time. Start and stop processors, monitor queues, query provenance data, and more. Each endpoint below includes a description, ... |
the-stack_106_19516 | from board import SCL, SDA
import busio
from PIL import Image, ImageDraw, ImageFont
import adafruit_ssd1306
class display:
def __init__( self, config:object ):
self.i2c = busio.I2C(SCL,SDA)
self.display = adafruit_ssd1306.SSD1306_I2C( config['DISPLAY']['WIDTH'], config['DISPLAY']['HEIGHT'], Self.i2... |
the-stack_106_19517 | # 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
the-stack_106_19519 | """
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
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, merg... |
the-stack_106_19520 | '''
Created by auto_sdk on 2020.05.19
'''
from aliexpress.top.api.base import RestApi
class AliexpressAffiliateProductdetailGetRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.app_signature = None
self.fields = None
self.product_ids = None
self... |
the-stack_106_19521 | # Write a program (using functions!) that asks the user for a long string containing multiple words. Print back to the user the same string, except with the words in backwards order. For example, say I type the string:
# My name is Michele
# Then I would see the string:
# Michele is name My
# shown back to me.
s... |
the-stack_106_19522 | # 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)
from spack import *
class PyDatrie(PythonPackage):
"""Super-fast, efficiently stored Trie for Python (2.x and 3.x). ... |
the-stack_106_19524 | #Compounding style
Simple = 0 # 1+rt
Compounded = 1 # (1+r)^t
Continuous = 2 # e^{rt}
SimpleThenCompounded = 3 # Simple up to the first period then Compounded
def compounding_from_name(name):
dic = {'Simple': Simple,
'Compounded': Compounded,
'Contin... |
the-stack_106_19526 | import re
from itertools import permutations
def calculate(prev, next, op):
if op == '+': return prev + next
elif op == '-': return prev - next
else: return prev * next
def getNodes(string):
numbers = re.findall(r'(\d+)', string)
operators = re.findall(r'[+*-]', string)
return numbers, opera... |
the-stack_106_19528 | import unittest
from glif import parsing
from glif import Glif
from glif import commands
from glif import utils
class TestBasicParsing(unittest.TestCase):
def test_parse_argument(self):
def test(s,k,v):
pr = parsing.parseCommandArg(s)
if not pr.success:
print(pr.log... |
the-stack_106_19529 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
import frappe, unittest
class TestDynamicLinks(unittest.TestCase):
def setUp(self):
frappe.db.sql('delete from `tabEmail Unsubscribe`')
def test_delete_normal(self):
event = frappe.get_doc({
'doctype': 'Event'... |
the-stack_106_19530 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# fake_enrichment documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in th... |
the-stack_106_19532 | import unittest
from aiohttp.test_utils import unittest_run_loop
from ws.tests.testcase import MyHomeTestCase
class ApplianceTestCase(MyHomeTestCase):
@unittest_run_loop
async def test_get(self):
for collection in self.app.resources.appliances:
for appliance in self.app.resources.appliance... |
the-stack_106_19533 | # Copyright 2021 Huawei Technologies 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 agreed to... |
the-stack_106_19534 | # Copyright (c) 2017 Quilt Data, Inc. All rights reserved.
"""
Version tests
"""
import json
import requests
from unittest.mock import patch
from quilt_server.core import hash_contents, GroupNode, RootNode
from .utils import QuiltTestCase
class VersionTestCase(QuiltTestCase):
"""
Test version endpoints.
... |
the-stack_106_19536 | """
Ory APIs
Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers. # noqa: E501
The version of the OpenAPI document: v0.0.1-alpha.187
Contact: support@ory.sh
Generated by: ht... |
the-stack_106_19538 | #!/usr/bin/env python3
#
# Copyright (c) 2016, The OpenThread Authors.
# 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
# ... |
the-stack_106_19539 | import os
import sys
import random
import math
import time
class BadInputError(Exception):
pass
class Player():
def __init__(self, name):
self.id = None
self.name = name
self.type = 'Human'
self.hand = Hand()
self.legalCards = []
self.wildCards = []
sel... |
the-stack_106_19540 | #!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://www.opensource.org/licenses/mit-license.php .
#
# Helpful routines for regression testing
#
import os
import sys
from binascii import hexlify, unh... |
the-stack_106_19541 | from injector import inject
from domain.connection.DeleteConnection.DeleteConnectionCommand import DeleteConnectionCommand
from domain.connection.services.ConnectionService import ConnectionService
from domain.notification.SendNotification.SendNotificationCommand import SendNotificationCommand
from domain.notification... |
the-stack_106_19543 | import pybullet as p
from time import sleep
import pybullet_data
physicsClient = p.connect(p.GUI)
p.setAdditionalSearchPath(pybullet_data.getDataPath())
p.setGravity(0, 0, -10)
planeId = p.loadURDF("plane.urdf", [0,0,-2])
boxId = p.loadURDF("cube.urdf", [0,3,2],useMaximalCoordinates = True)
bunnyId = p.loadSoftBody(... |
the-stack_106_19545 | default_client_config = {
'exception_on_negative_response' : True,
'exception_on_invalid_response' : True,
'exception_on_unexpected_response' : True,
'security_algo' : None,
'security_algo_params' : None,
'tolerate_zero_padding' : True,
'ignore_all_zero_dtc' : True,
'dtc_snapshot_did_size' : 2, # No... |
the-stack_106_19546 | """Several helper functions to convert between data objects and JSON."""
import json
from tinycards.model import Card, Concept, Deck, Fact, Favorite
from tinycards.model import SearchableData, Side, Trendable, TrendableData
from tinycards.model import User
# --- User conversion
def json_to_user(json_data):
"""Co... |
the-stack_106_19547 | n = int(input("Digite o termo da sequência Fibonacci: "))
a = 1
b = 1
k = 1
while k <= n - 2:
tmp = a
a = b
b = tmp + b
k = k + 1
print("O {}º da Sequência de Fibonacci é ocupado pelo número {}.".format(n,b))
#https://pt.stackoverflow.com/q/358586/101
|
the-stack_106_19548 | #!/usr/bin/env python3
from time import sleep
import os
import RPi.GPIO as GPIO
pin = 14 # GPIO pin
maxTMP = 55 # The temperature in Celsius after which we trigger the fan
minTMP = 40 # The temperature in Celsius after which we stop the fan
sleepTime = 5
debug = False
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
G... |
the-stack_106_19549 | from django.forms import ModelForm, TextInput
from django.core.exceptions import ValidationError
from .models import Paquete, Promocion
'''
PaqueteForm -> Creacion, modificacion y validacion de Paquetes
Clase relacionada -> CD18 [Control]
Casos de Uso relacionados -> {BE15, BE16}
'''
class PaqueteForm(ModelForm):
... |
the-stack_106_19550 | """
Private utilities.
"""
import os
from typing import Any, Callable, Mapping, Optional, cast
import pyramid.config
def get_base_path(config: pyramid.config.Configurator) -> str:
return cast(str, env_or_config(config, "C2C_BASE_PATH", "c2c.base_path", "/c2c"))
def env_or_config(
config: Optional[pyramid.c... |
the-stack_106_19551 | """
Return records as named tuples.
This saves a lot of memory.
"""
from collections import namedtuple
from dbfread import DBF
table = DBF('files/people.dbf', lowernames=True)
# Set record factory. This must be done after
# the table is opened because it needs the field
# names.
Record = namedtuple('Record', table.f... |
the-stack_106_19553 | import numpy as np
import scipy.sparse as sp
import time
import scipy.linalg as la
class CLPerceptron():
S_X = np.array([[0, 1], [1, 0]], dtype=complex)
S_Y = np.array([[0, complex(0, -1)], [complex(0, 1), 0]], dtype=complex)
S_Z = np.array([[1, 0], [0, -1]], dtype=complex)
S = np.array([S_X, S_Y, S_Z... |
the-stack_106_19554 | # MIT License
#
# Copyright (c) 2019 ABN AMRO Bank N.V.
#
# 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, mo... |
the-stack_106_19555 | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# 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 ... |
the-stack_106_19560 | from abc import ABC
from abc import abstractmethod
from functools import wraps
import inspect
import re
import types
from typing import List
import syft
from syft.generic.pointers import PointerTensor
from syft.generic.pointers import MultiPointerTensor
from syft.generic.tensor import initialize_tensor
from syft.gener... |
the-stack_106_19561 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
from status_dock.bar import Bar
CONFIG_FILE = f"{os.environ['HOME']}/.i3/status.conf.json"
if __name__ == "__main__":
import sys
try:
layout = sys.argv[1]
except IndexError:
raise ValueError("Please supply the layout as the only ... |
the-stack_106_19562 | from django.core.management.base import BaseCommand, CommandError
from django.core.management import call_command
from django.conf import settings
from django.db import connection
from django.utils.text import slugify
from django.db import IntegrityError
from contactnetwork.cube import compute_interactions
from contac... |
the-stack_106_19563 | import sqlite3
from sqlite3 import Error
def create_connection(db_file):
conn = None
try:
conn = sqlite3.connect(db_file)
return conn
except Error as e:
print(e)
return conn
def fetch_user(conn, username):
cur = conn.cursor()
cur.execute(f'SELECT * FROM users where na... |
the-stack_106_19565 | import dataclasses
import numpy as np
import tensorflow as tf
def _standard_scaled_mse(std):
std = tf.constant(std, dtype=std.dtype)
def custom_loss(y_true, y_pred):
return tf.math.reduce_mean(
tf.math.reduce_mean(tf.math.square((y_pred - y_true) / std), axis=0)
)
return cust... |
the-stack_106_19566 | from typing import Any, List, cast
from src.helpers.general import findInListOfDicts
from src.libs.Web3Client.exceptions import NetworkNotFound
from src.libs.Web3Client.types import NetworkConfig
from web3.middleware import geth_poa_middleware
supportedNetworks: List[NetworkConfig] = [
# Ethereum
{
"na... |
the-stack_106_19567 | #!/usr/bin/python
# (c) 2018, NetApp, Inc
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... |
the-stack_106_19568 | import pickle
from typing import IO, Optional
import numpy as np
from ..definitions import (DenseMatrix, DenseScoreArray, InteractionMatrix,
UserIndexArray)
from ._ials import IALSLearningConfigBuilder
from ._ials import IALSTrainer as CoreTrainer
from .base import (BaseRecommenderWithItemE... |
the-stack_106_19571 | from freefall.falling_objects import frc_power_cell
from freefall.simulators import simulate_earth_surface
from freefall.simulators import terminate_vy_less_zero
from freefall.utilities import find_vx_vy, float_range
import matplotlib.pyplot as plt
X_INITIAL = 0 # m
Y_INITIAL = 27 / 40 # m
SPEED = 5 # m/s
ANGLE = ... |
the-stack_106_19572 | #
# Copyright (c) 2017 NORDUnet A/S
# Copyright (c) 2018 SUNET
# 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
# ... |
the-stack_106_19573 | # Authors: Robert Luke <mail@robertluke.net>
# Eric Larson <larson.eric.d@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD (3-clause)
import os.path as op
import pytest
import numpy as np
from mne.datasets.testing import data_path
from mne.io import read_raw_nirx, Base... |
the-stack_106_19575 | import hydra
import os
import torch
from tqdm import tqdm, trange
from tacotron.utils import reset_logging, set_seed, get_abspath, ResultWriter
from tacotron import get_process, get_model, get_vocgan
from tacotron.configs import NonAttentiveTacotronConfig
from hydra.core.config_store import ConfigStore
import logging
f... |
the-stack_106_19577 | #!/usr/bin/env python3
#
# This file is part of the MicroPython project, http://micropython.org/
#
# The MIT License (MIT)
#
# Copyright (c) 2020 Damien P. George
# Copyright (c) 2020 Jim Mussared
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated document... |
the-stack_106_19580 | def notaPostulanteEstMultiple():
#Definir Variables
notaFinal=0
#Datos de entrada
areaCarrera=input("Introduce el area a la que corresponde tu carrera:\nB=Biomedicas\nI=Ingenieria\nS=Sociales")
notaEP=float(input("Ingrese la nota de EP:"))
notaRM=float(input("Ingrese la nota de RM:"))
notaRV=float(inp... |
the-stack_106_19582 | import abc
import sys
import time
from collections import OrderedDict
from functools import reduce
import numba
import numpy as np
from det3d.core.bbox import box_np_ops
from det3d.core.bbox.geometry import (
is_line_segment_intersection_jit,
points_in_convex_polygon_3d_jit,
points_in_convex_... |
the-stack_106_19583 | # -*- coding: utf-8 -*-
# Copyright 2015 Cyan, Inc.
# Copyright 2017, 2018 Ciena Corporation.
import collections
import struct
from six import string_types, text_type
from .common import BufferUnderflowError
_NULL_SHORT_STRING = struct.pack('>h', -1)
def _buffer_underflow(what, buf, offset, size):
return Buff... |
the-stack_106_19584 | import argparse
import numpy as np
import torch
import model
def run_grad_weight(kcnn, sentence):
out = kcnn.rank(sentence)
h = kcnn.compute_grad_norm(torch.sum(out[1]))
for w, score in zip(sentence.split(), h):
print(w, score)
def run_grad_pca(kcnn, sentence):
out = kcnn.rank(sentence)
... |
the-stack_106_19585 | from mission.constants.missions import Gate, Path
from mission.constants import teagle
from conf.vehicle import is_mainsub
# HYDROPHONES_PINGER_DEPTH = 4.7
NONSURFACE_MIN_DEPTH = 0.5 # if is_mainsub else 1.5
# Note: These values are copied straight from the Teagle configuration.
# They need to be updated for Transd... |
the-stack_106_19587 | """
"""
import os
import h5py
import numpy as np
from ..subhalo_mass_function import log10_cumulative_shmf
from ..subhalo_mass_function import DEFAULT_SHMF_PARAMS, DEFAULT_SHMF_PARAM_BOUNDS
_THIS_DRNAME = os.path.dirname(os.path.abspath(__file__))
def test_default_shmf_agrees_with_bpl():
fname = os.path.join(_TH... |
the-stack_106_19588 | import torch
from .base_model import BaseModel
from . import networks
from typing import Union
class IntrinsicUnetModel(BaseModel):
""" This class implements the pix2pix model, for learning a mapping from input images to output images given paired data.
The model training requires '--dataset_mode aligned' da... |
the-stack_106_19590 | """
OXASL_OPTPCASL: Widget to control the optimization process
Copyright (c) 2019 University of Oxford
"""
import os
import wx
import wx.grid
from ..structures import ScanParams, PhysParams, ATTDist, Limits
from ..cost import CBFCost, ATTCost, DOptimalCost
from .widgets import TabPage, NumberChooser
class Optimizer... |
the-stack_106_19591 | __all__ = ["model"]
from icevision.imports import *
from icevision.backbones import resnet_fpn
from icevision.models.torchvision.utils import *
from torchvision.models.detection.keypoint_rcnn import (
keypointrcnn_resnet50_fpn,
KeypointRCNNPredictor,
KeypointRCNN,
)
from torchvision.models.detection.faste... |
the-stack_106_19592 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
#
# FreeType high-level python API - Copyright 2011 Nicolas P. Rougier
# Distributed under the terms of the new BSD license.
#
# ---------------------------------------------------------------... |
the-stack_106_19593 | #!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Basic list exercises
# Fill in the code for the functions below. main() is already set ... |
the-stack_106_19594 | import unittest
from torpido.pmpi import Communication
class PmpiTest(unittest.TestCase):
def test_communication(self):
sent = {"mydata", 200}
def my_function(data):
self.assertEqual(data, sent)
comm = Communication()
comm.register("ID", my_function)
sender =... |
the-stack_106_19596 | import pandas
import xlwt
from srblib import abs_path
def excel_to_data(inp_path):
inp_path = abs_path(inp_path)
raw_data = pandas.read_excel(inp_path)
header = list(raw_data.columns)
if(len(header) == 0):
return []
temp_data = []
for head in header:
col = list(raw_data[head]... |
the-stack_106_19597 | from statsmodels.compat.python import (lrange, iterkeys, iteritems, lzip,
reduce, itervalues, zip, string_types,
range)
from collections import OrderedDict
import datetime
import re
import textwrap
import numpy as np
import pandas as pd
fr... |
the-stack_106_19598 | import copy
import torchvision.models as models
from ptsemseg.models.fcn import fcn8s, fcn16s, fcn32s
from ptsemseg.models.segnet import segnet
from ptsemseg.models.unet import unet
from ptsemseg.models.pspnet import pspnet
from ptsemseg.models.icnet import icnet
from ptsemseg.models.linknet import linknet
from ptsems... |
the-stack_106_19599 | #!/usr/bin/env python
# coding=utf-8
"""
Copyright (c) 2017
Gabriel Pacheco <gabriel.pacheco@dcc.ufmg.br>
Guilherme Sousa <gadsousa@gmail.com>
Joao Paulo Bastos <joaopaulosr95@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated do... |
the-stack_106_19603 | from sys import maxsize
from networkx.algorithms.shortest_paths.weighted \
import dijkstra_predecessor_and_distance
from domino_puzzle import BoardGraph, BadPositionError, find_boards_with_deap
class BlockingBoardGraph(BoardGraph):
def walk(self, board, size_limit=maxsize):
states = super().walk(boa... |
the-stack_106_19605 | import time
from test.querybuildertestcase import QueryBuilderTestCase
from selenium.webdriver.common.alert import Alert
class QueryHistoryTest(QueryBuilderTestCase):
def test_query_history(self):
self.load_queries_into_history()
time.sleep(3)
self.assertIn('Custom query', self.browser.t... |
the-stack_106_19607 | #!/usr/bin/env python3
import bs4
import requests
url = "https://github.com/trending?l=Python"
soup = bs4.BeautifulSoup(requests.get(url).content, "lxml") # or 'html5lib'
repos = soup.find("ol", class_="repo-list").find_all("a", href=True)
repos = (r.text.strip().replace(" ", "") for r in repos if "/" in r.text)
pri... |
the-stack_106_19608 | """Test methods for `zcode/inout/timer.py`.
Can be run with:
$ nosetests inout/tests/test_timer.py
"""
from __future__ import absolute_import, division, print_function, unicode_literals
from six.moves import xrange
from numpy.testing import run_module_suite
import numpy as np
# from nose.tools import assert_true... |
the-stack_106_19609 | """add application draft status
Revision ID: 5a4b8a4896fb
Revises: a2327cf14296
Create Date: 2022-05-29 01:14:04.196440+00:00
"""
import sqlalchemy as sa
import sqlmodel
from alembic import op
# revision identifiers, used by Alembic.
revision = "5a4b8a4896fb"
down_revision = "a2327cf14296"
branch_labels = None
depen... |
the-stack_106_19610 | from setuptools import setup
with open("README.md", "r") as f:
long_description = f.read()
setup(
name="qwhale_client", # How you named your package folder
packages=["qwhale_client"], # Chose the same as "name"
include_package_data=True,
version="v0.1.20", # Start with a small number and increa... |
the-stack_106_19612 | """Recursive Policy Gradients."""
import os
import sys
import numpy as np
import tensorflow as tf
from ray import tune
from . import utils as U
from .meta import make_with_custom_variables
def stop_forward(x):
"""Implements the Magic Box operator."""
with tf.name_scope("stop_forward"):
op = tf.exp(... |
the-stack_106_19614 | # -*- coding: utf-8 -*-
"""
"""
from __future__ import print_function
import numpy as np
from openmdao.api import Component
'''
Component which combines the mass design variables with the masses of the points not defined as design variables to create a single input vector for the Nastran components
'''
class MixedI... |
the-stack_106_19615 | # orm/state.py
# Copyright (C) 2005-2017 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Defines instrumentation of instances.
This module is usually not directly visible t... |
the-stack_106_19617 | import random as rd
lst=[]
lst2=[]
numberlst=[]
variationArray=[]
weightl=[]
#READING INPUT FROM FILE
with open('F:\\CSE422\\New folder\\genetic.txt') as file:
lst=file.read().split()[1:]
#LIST HANDELING
def listAdjust():
for item in lst:
if item=='l' :
lst2.append('l')
... |
the-stack_106_19619 | # uncompyle6 version 3.2.0
# Python bytecode 2.4 (62061)
# Decompiled from: Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)]
# Embedded file name: pirates.launcher.PiratesDummyLauncher
from otp.launcher.DummyLauncherBase import DummyLauncherBase
from pirates.launcher.PiratesQuickLau... |
the-stack_106_19620 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Shunta Saito
# https://github.com/mitmul/chainer-faster-rcnn/
import chainer
import chainer.functions as F
import chainer.links as L
class VGG16(chainer.Chain):
def __init__(self, train=False):
super(VGG16, self).__init__()
self.... |
the-stack_106_19624 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
the-stack_106_19625 | from datetime import datetime
from django.utils.translation import ugettext_lazy as _
from django_prbac.utils import has_privilege as prbac_has_privilege
from corehq import feature_previews, toggles
from corehq.apps.app_manager.exceptions import AddOnNotFoundException
from corehq.apps.app_manager.models import Advan... |
the-stack_106_19627 | import matplotlib.pyplot as plt
import numpy as np
def plot_errors(policy_error, value_error):
"""
Method to plot the errors collected for each key in the value and policy errors
:param policy_error: Policy error as an array
:param value_error: Value error as an array
:return: None
"""
... |
the-stack_106_19628 | """
Ideia: Gerar todas as combinações de livros possívei e salvar o preço de cada combinação em uma lista,
aí foi sí ordernar a lista e somar os n primeiros.
complexidade: O(n^5)
Complexidade das funções do python:
.sort() -> O(n*log(n))
.reverse() -> O(n)
list() -> O(n)
map() -> O(n)
"""
def somar(*livros):
som... |
the-stack_106_19629 | # BY @Deonnn
""" Game of Thrones Dialogues That You Can Use In Everyday Situations
command .gotm
by @Deonnn
"""
import asyncio
import random
from telethon import events
@borg.on(events.NewMessage(pattern=r"\.gotm", outgoing=True))
async def _(event):
if event.fwd_from:
return
await event.edit("... |
the-stack_106_19630 | """Unit tests for read orientation inference module."""
from pathlib import Path
import pytest
from htsinfer import infer_read_orientation
test_files_dir = Path(__file__).parent.absolute() / "test_files"
file_1 = str(test_files_dir / "first_mate.fastq")
file_2 = str(test_files_dir / "second_mate.fastq")
fasta_human... |
the-stack_106_19631 | from deephyper.benchmark import Problem
from candlepb.Combo.models.candle_mlp_9 import create_structure
# We create our Problem object with the Problem class, you don't have to name your Problem object 'Problem' it can be any name you want. You can also define different problems in the same module.
Problem = Problem()... |
the-stack_106_19635 | # --- Simple example of Langmuir oscillations in a uniform plasma
from pywarpx import picmi
constants = picmi.constants
##########################
# physics parameters
##########################
plasma_density = 1.e25
plasma_xmin = 0.
plasma_x_velocity = 0.1*constants.c
##########################
# numerics parame... |
the-stack_106_19636 | # Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information regarding
# copyright ownership. The Modin Development Team licenses this file to you under the
# Apache License, Version 2.0 (the "License"); you may not u... |
the-stack_106_19639 | import json
import sys
from os import path
import vk
from PyQt5 import QtGui
from PyQt5.QtCore import QRegExp, QObject, pyqtSignal, QEventLoop
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.uic import loadUi
import google_export
import vktests
class Window(QMainWindow):
def __init__(self, pa... |
the-stack_106_19640 | for _ in range(int(input())):
N,A,B = map(int, input().split())
s=input()
time=0
for i in s:
if(i=="1"):
time+=B
if(i=="0"):
time+=A
print(time) |
the-stack_106_19643 | import os
import sys
import numpy as np
import pandas as pd
import logging
import gc
import tqdm
import pickle
import json
import time
import tempfile
from gensim.models import Word2Vec
from sklearn.metrics import accuracy_score, roc_auc_score
import torch
from torch import nn
import torch.nn.functional as F
from da... |
the-stack_106_19644 | #!/usr/bin/python3
import numpy as np
import helper.basis
import helper.function
class FinanceInterpolant(helper.function.Interpolant):
def __init__(
self, basis, X, L, I, fX, aX=None, bounds=None,
boundsTransformed=None, gridType=None, p=None, struct=None,
info=None):
super().__init_... |
the-stack_106_19645 | # Copyright 2015 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" file accompa... |
the-stack_106_19646 | # pybatch
# github.com/sbritorodr/pybatch
# This program executes any instruction for all files inside a folder
# (e.g. convert all these mp4 files into mkv using ffmpeg)
# the idea is to take, for example:
# ffmpeg -i [i] [o]
# sustitute input for each instance and generate an output with the same
# name inside an ... |
the-stack_106_19647 | # -*- coding: utf-8 -*-
"""Windows Registry custom event formatter helpers."""
from plaso.formatters import interface
from plaso.formatters import manager
class WindowsRegistryValuesFormatterHelper(
interface.CustomEventFormatterHelper):
"""Windows Registry values formatter helper."""
IDENTIFIER = 'windows_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.