filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_8653 | # Please Pass the coded messages
from itertools import combinations
def solution(l):
l.sort(reverse = True)
for i in reversed(range(1, len(l) + 1)):
for tup in combinations(l, i):
if sum(tup) % 3 == 0: return int(''.join(map(str, tup)))
return 0
|
the-stack_0_8654 | """
Lexicon Plesk Provider
Author: Jens Reimann, 2018
API Docs: https://docs.plesk.com/en-US/onyx/api-rpc
"""
from __future__ import absolute_import
import logging
from collections import OrderedDict
import requests
from lexicon.providers.base import Provider as BaseProvider
try:
import xmltodict # optional ... |
the-stack_0_8655 | # -*- coding: utf-8 -*-
__author__ = "Konstantin Klementiev"
__date__ = "08 Mar 2016"
import os, sys; sys.path.append(os.path.join('..', '..', '..')) # analysis:ignore
import numpy as np
import xrt.backends.raycing as raycing
import xrt.backends.raycing.sources as rs
#import xrt.backends.raycing.apertures as ra
impor... |
the-stack_0_8657 | import deserialize
import pytest
import mumoco
@pytest.fixture
def remote():
return mumoco.Remote("myName", "myUrl")
def test_default_values(remote):
assert remote.name == "myName"
assert remote.url == "myUrl"
assert remote.verify_ssl is True
assert remote.priority == 0
assert remote.force ... |
the-stack_0_8658 | # -*- coding: utf-8 -*-
import mne
import os.path as op
raw_dir = '/brainstudio/MEG/metwo/metwo_101/181206/'
raw_files = ['metwo_101_7m_01_raw.fif',
'metwo_101_7m_02_raw.fif',
'metwo_101_04_raw.fif',
'metwo_101_03_raw.fif']
for file in raw_files:
file_path = op.join(raw_d... |
the-stack_0_8659 | import redis
import os, time, multiprocess, logging, sys
import json
from compute import Config_ini
from compute.log import Log
from compute.file import get_algo_local_dir, get_population_dir
def get_logger(logger_name, log_file, level=logging.INFO):
l = logging.getLogger(logger_name)
formatter = logging.Form... |
the-stack_0_8661 | # -*- coding: utf-8 -*-
"""
this module contains all usable variables for native python type.
"""
import datetime
import re
import six
from booleano.operations.operands.classes import Variable
from booleano.operations.operands.constants import String
from booleano.parser.symbol_table_builder import SymbolTableBuilder... |
the-stack_0_8662 | import handle_input as input
import game_flags as flags
import pygame as pg
class Food(pg.sprite.Sprite):
# Constructor
def __init__(self, pos=(-1, -1)):
# Call the parent class (Sprite) constructor
pg.sprite.Sprite.__init__(self)
size = (32, 32)
self.pos = pos
... |
the-stack_0_8663 | import argparse
parser = argparse.ArgumentParser()
parser.add_argument("a", help="alphabet size", type=int)
parser.add_argument("l", help="sequence length", type=int)
parser.add_argument("-name", help="name of output folder")
parser.add_argument("-data", help="path to input data",
type=str, required... |
the-stack_0_8665 | from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='message_media_messages',
version='2.0.0',
description... |
the-stack_0_8666 | import sys
import json
import numpy as np
from flask import Flask, request, jsonify, make_response
# from flask import session
from flask import render_template, send_from_directory
from flask_cors import CORS
import lib.recommender_tools as rec_tools
from lib.recommender_data import RECCOMEND_DATA
from lib.tools im... |
the-stack_0_8668 | import functools
import json
import textwrap
import mongoengine
from .. import util
from .. import entities
from . import look, verb
import architext.strings as strings
class LobbyMenu(verb.Verb):
'''Helper class that has the method that shows the lobby menu'''
def show_lobby_menu(self):
out_message... |
the-stack_0_8669 | # Copyright 2016-2021, Pulumi 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 t... |
the-stack_0_8670 | # 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 itertools
import json
import logging
import os
from argparse import Namespace
import numpy as np
from fairseq import metrics, options... |
the-stack_0_8671 | #!/usr/bin/env python3
# You are probably well aware of the 'birthday paradox'
# https://en.wikipedia.org/wiki/Birthday_problem
# Let's try simulating it
# We will have a variable number of bins (can be months or days)
# And some number of trials for the simulation
# And some number of people whose have random birthda... |
the-stack_0_8672 | # coding: utf-8
"""
Copyright 2016 SmartBear Software
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... |
the-stack_0_8673 | from bs4 import BeautifulSoup
ENDPOINT = 'https://www2.correios.com.br/sistemas/rastreamento/ctrl/ctrlRastreamento.cfm'
def __make_request(session, tracking_id):
payload = {
'acao': 'track',
'objetos': tracking_id,
'btnPesq': 'Buscar'
}
return session.post(ENDPOINT, data=payload)... |
the-stack_0_8680 | #!/usr/bin/python3
# coding=utf-8
"""
:Copyright: © 2022 Advanced Control Systems, Inc. All Rights Reserved.
@Author: Stephen Hung
@Author: Darren Liang
@Date : 2022-02-18
"""
import os
import sys
sys.path.append("..")
from adms_api.core.OracleInterface import OracleInterface
# from acsprism import RtdbAddress, Rtd... |
the-stack_0_8684 | from datasource.data_orchestrator import DataOrchestrator
from datasource.factors.factors_processor import FactorsProcessor
from logic.embeddings.spacy_embedder import SpacyEmbedder
from logic.reduction.umap_reducer import UmapReducer
from logic.clustering.hdbscan_clusterer import HDBScanClusterer
from logic.ml_model_d... |
the-stack_0_8685 | import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
def model(mnist, epoches=1000, batch_size=100, learning_rate=0.003):
print("Start model")
with tf.name_scope('X'):
X = tf.placeholder(tf.float32, [None, 784], name='X')
x_image = tf.reshape(X, [-1, 28, 28, 1])
... |
the-stack_0_8686 | """
NCL_station_3.py
================
This script illustrates the following concepts:
- Drawing station numbers on a map, and removing ones that overlap
- Attaching lots of text strings to a map
- Using Cartopy's GeoAxes.gridlines as a workaround to adding tick labels on Axes with Mercator (or another) map pro... |
the-stack_0_8687 | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
the-stack_0_8688 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for form validation."""
import json
import unittest
from werkzeug import MultiDict
import webcompat
from webcompat import form
FIREFOX_UA = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:48.0) Gecko/20100101 Firefox/48.0' # nopep8
class TestForm(unittest... |
the-stack_0_8690 | from typing import List, Union
import warnings
import pandas as pd
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.utils.validation import check_is_fitted
from feature_engine.dataframe_checks import (
_is_dataframe,
_check_contains_na,
_check_input_matches_training_df,
)
from feature... |
the-stack_0_8691 | import os
from serde.json import from_json
from edge.command.common.precommand_check import precommand_checks
from edge.config import EdgeConfig
from edge.exception import EdgeException
from edge.state import EdgeState
from edge.train import TrainedModel
from edge.tui import TUI, StepTUI, SubStepTUI
from edge.vertex_d... |
the-stack_0_8693 | """Interop with cc_* rules
These rules are temporary and will be deprecated in the future.
"""
load(":private/providers.bzl",
"HaskellBuildInfo",
"HaskellLibraryInfo",
"HaskellBinaryInfo",
"CcSkylarkApiProviderHacked",
)
load(":private/set.bzl", "set")
load("@bazel_skylib//:lib.bzl", "paths")
loa... |
the-stack_0_8696 | # --------------
##File path for the file
file_path
def read_file(path):
file = open(path,mode='r')
sentence = file.readline()
file.close()
return sentence
sample_message = read_file(file_path)
#Code starts here
# --------------
#Code starts here
message_1 = read_file(file_path_1)
mess... |
the-stack_0_8697 | #!/usr/bin/env python
import pytest
import random
import os
import filecmp
from devtools_shorthand_sql import core
random.seed(1234)
@pytest.fixture
def functionbuilder_basic():
fields = [core.IDField('id', 'test'), core.TextField('COL2', 'test2'),
core.IntegerField('col1', 'test')]
sql_writer... |
the-stack_0_8699 | from django.db import models
from django.contrib.postgres.fields import JSONField
class Log(models.Model):
started_on = models.DateTimeField(auto_now_add=True)
finished_on = models.DateTimeField(blank=True, null=True)
finished_successfully = models.NullBooleanField()
command_name = models.TextField(... |
the-stack_0_8700 | import csv
import re
from lxml.html import fromstring
class CsvCallback:
def __init__(self):
self.writer = csv.writer(open('../data/countries_or_districts.csv', 'w'))
self.fields = ('area', 'population', 'iso', 'country_or_district', 'capital',
'continent', 'tld', 'currency_... |
the-stack_0_8705 | # Copyright 2018 The Bazel 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 applicable la... |
the-stack_0_8706 | from panda3d.core import TextNode
from direct.gui.DirectGui import DirectFrame
from direct.gui.DirectGui import DirectButton
from direct.gui.DirectGui import DirectLabel
from direct.gui import DirectGuiGlobals
from toontown.toonbase import ToontownGlobals
from toontown.toonbase import TTLocalizer
class JellybeanReward... |
the-stack_0_8708 | #!/usr/bin/env python
''' Python DB API 2.0 driver compliance unit test suite.
This software is Public Domain and may be used without restrictions.
"Now we have booze and barflies entering the discussion, plus rumours of
DBAs on drugs... and I won't tell you what flashes through my mind each
time... |
the-stack_0_8711 | # Copyright (c) Open-MMLab. All rights reserved.
from .colorspace import (bgr2gray, bgr2hls, bgr2hsv, bgr2rgb, bgr2ycbcr,
gray2bgr, gray2rgb, hls2bgr, hsv2bgr, imconvert,
rgb2bgr, rgb2gray, rgb2ycbcr, ycbcr2bgr, ycbcr2rgb)
from .geometric import (cutout, imcrop, imflip,... |
the-stack_0_8712 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#author:fugui
from typing import Counter, Text
import urllib.request
import ssl
import json
import os
import sys
import datetime
#定义11点 用于开启server 酱推送
global d_time0,d_time1,d_time2,n_time
d_time0 = datetime.datetime.strptime(str(datetime.datetime.now().date()) + '11:00... |
the-stack_0_8713 | import twitter
from searchtweets import ResultStream, gen_rule_payload, load_credentials, collect_results
import json
import os.path
user_list = []
followers_list = []
# api = twitter.Api(consumer_key='C0Q2slgd38EQUV82soOig68Uo',
# consumer_secret='JKJ0tVC8vnlDmVbvPT4BF67nx7r5VqnJTSPHMiGqJL... |
the-stack_0_8714 | #%%
import numpy as np
import numpy.linalg as lin
import scipy.stats as sts
import scipy.integrate as intgr
import scipy.optimize as opt
import matplotlib
import matplotlib.pyplot as plt
import pandas as pd
from mpl_toolkits.mplot3d import Axes3D
#%%
incomes = np.array([[100, 200, 300, 400, 500, 600, 700, 800, 900, 10... |
the-stack_0_8715 | import json
import shutil
import logging
from flask import Blueprint, request
from tempfile import mkdtemp
from werkzeug.exceptions import BadRequest
from normality import safe_filename, stringify
from servicelayer.archive.util import ensure_path
from aleph.core import db, archive
from aleph.model import Document, Ent... |
the-stack_0_8717 | from PyQt5 import QtCore, QtGui
from PyQt5.QtWidgets import *
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(831, 682)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap("logo.ico"), QtGui.QIcon.Normal, Q... |
the-stack_0_8720 | r"""
Elements of bounded height in number fields
Sage functions to list all elements of a given number field with height less
than a specified bound.
AUTHORS:
- John Doyle (2013): initial version
- David Krumm (2013): initial version
- TJ Combs (2018): added Doyle-Krumm algorithm - 4
- Raghukul Raman (2018): adde... |
the-stack_0_8722 | # -*- coding: utf-8 -*-
""" HTTP API for triggering Earthstar events and
a simple web based controller that connects to the API.
Events are published to a ZeroMQ socket where they
are consumed by the EffectBox (and potentially other subscribers such
as an event logger).
"""
import click
from flask im... |
the-stack_0_8723 | from netCDF4 import Dataset
import numpy as np
import tables as tb
from glob import glob
import sys
MISSING_PBL = -1
def read_nc_data(in_file):
rootgrp = Dataset(in_file, "r", format="NETCDF4")
time_axis = rootgrp.variables['time']
height_axis = rootgrp.variables['range']
beta_raw = np.array(root... |
the-stack_0_8724 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# *****************************************************************************/
# * Authors: Joseph Tarango
# *****************************************************************************/
from __future__ import absolute_import, division, print_function, unicode_literals... |
the-stack_0_8725 | import numpy as np
import os
import cv2
from .colors import get_color
class BoundBox:
def __init__(self, xmin, ymin, xmax, ymax, c = None, classes = None):
self.xmin = xmin
self.ymin = ymin
self.xmax = xmax
self.ymax = ymax
self.c = c
self... |
the-stack_0_8727 | import unittest
from igraph import *
class DirectedUndirectedTests(unittest.TestCase):
def testToUndirected(self):
graph = Graph([(0,1), (0,2), (1,0)], directed=True)
graph2 = graph.copy()
graph2.to_undirected(mode=False)
self.assertTrue(graph2.vcount() == graph.vcount())
s... |
the-stack_0_8728 | import pytest
import sdk_cmd
import sdk_install
import sdk_plan
from tests import config
@pytest.fixture(scope='module', autouse=True)
def configure_package(configure_security):
try:
sdk_install.uninstall(config.PACKAGE_NAME, config.SERVICE_NAME)
options = {
"service": {
... |
the-stack_0_8732 | # -*- coding: utf-8 -*-
'''
Module for returning various status data about a minion.
These data can be useful for compiling into stats later,
or for problem solving if your minion is having problems.
.. versionadded:: 0.12.0
:depends: - wmi
'''
# Import Python Libs
from __future__ import absolute_import, unicode_li... |
the-stack_0_8734 |
from bentoml import BentoService, api, env, artifacts
from bentoml.artifact import PickleArtifact
from bentoml.adapters import FileInput
@artifacts([PickleArtifact('model')])
@env(pip_dependencies=['easyocr'],
conda_channels=["conda-forge"],
conda_dependencies=["ruamel.yaml"])
class TextDetectionService(B... |
the-stack_0_8735 | """
modify file with additions or substitutions, and making as few other changes
as possible (no formatting, whitespace, encoding etc)
Authors:
Carl Anderson (carl.anderson@weightwatchers.com)
"""
import os
import logging
class FileModifier:
"""
class that modifies file with addi... |
the-stack_0_8736 | import datetime
import json
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, JsonResponse
from django.shortcuts import get_object_or_404, redirect
from compose.models import DailyEntry, get_current_streak, get_longest_streak
@login_required
def fetch(request):
toda... |
the-stack_0_8738 | import pandas as pd
pd.DataFrame()
class RailwayForm:
formType = "RailwayForm"
def printData(self):
print(f"Name is {self.name}")
print(f"Train is {self.train}")
harrysApplication = RailwayForm()
harrysApplication.name = "Harry"
harrysApplication.train = "Rajdhani Express"
harrysAp... |
the-stack_0_8739 | import argparse
from argparse import ArgumentParser, Namespace
from typing import Any, Dict, Optional
from emmental.utils.utils import (
nullable_float,
nullable_int,
nullable_string,
str2bool,
str2dict,
)
def parse_args(parser: Optional[ArgumentParser] = None) -> ArgumentParser:
r"""Parse th... |
the-stack_0_8740 | #!/usr/bin/env python
import os
import scipy.io as sio
import glob
PYTHON_DIR = os.path.dirname(os.path.realpath(__file__))
DATA_DIR = os.path.join(os.path.dirname(PYTHON_DIR), 'pmtkdataCopy')
def load_mat(matName):
"""look for the .mat file in pmtk3/pmtkdataCopy/
currently only support .mat files create by... |
the-stack_0_8742 | #!/usr/bin/env python3
# Copyright (c) 2016 The Bitcoin Core developers
# Copyright (c) 2017-2018 The Astral Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test compact blocks (BIP 152).
Version 1 compact block... |
the-stack_0_8747 | #this was initiated by atom(conan)
#partially modified by opkr
import os
import math
from cereal import car, log
from common.params import Params
from selfdrive.car.hyundai.spdcontroller import SpdController
import common.log as trace1
from selfdrive.controls.lib.events import Events
EventName = car.CarEvent.Event... |
the-stack_0_8748 | #!/usr/bin/env python3
# Copyright (c) 2014-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
ZMQ example using python3's asyncio
monkycoind should be started with the command line argum... |
the-stack_0_8749 | import os
from tqdm import tqdm
import requests
from bs4 import BeautifulSoup
# get list of download urls from the database
data_url = "https://www1.ncdc.noaa.gov/pub/data/swdi/stormevents/csvfiles/"
r = requests.get(data_url)
soup = BeautifulSoup(r.text, features="html.parser")
urls = [link.get('href') for link in so... |
the-stack_0_8750 | # -*- coding: utf-8 -*-
"""
Not so simple tkinter based gui around the pdf2xlsx.do_it function.
"""
from tkinter import Tk, ttk, filedialog, messagebox, StringVar, Toplevel, END
import os
import shutil
from .managment import do_it, do_it2
from .config import config
__version__ = '0.2.0'
class ConfOption:
"""
... |
the-stack_0_8752 | """Home Assistant control object."""
import asyncio
from ipaddress import IPv4Address
import logging
from pathlib import Path
import shutil
import tarfile
from tempfile import TemporaryDirectory
from typing import Optional
from uuid import UUID
from awesomeversion import AwesomeVersion, AwesomeVersionException
from se... |
the-stack_0_8753 | # Ana 1.
class bankAccount():
def __init__(self, ownerName, balance):
self.ownerName = ownerName
self.balance = balance
def bankAccountDetails(self):
print("Account Holder :", self.ownerName)
print("Available Balance :", self.balance)
def deposit(self):
... |
the-stack_0_8754 | import unittest
import nideconv
import numpy as np
from scipy import signal
def double_gamma_with_d(x, a1=6, a2=12, b1=0.9, b2=0.9, c=0.35, d1=5.4, d2=10.8):
return (x/(d1))**a1 * np.exp(-(x-d1)/b1) - c*(x/(d2))**a2 * np.exp(-(x-d2)/b2)
class ResponseFytterTest(unittest.TestCase):
"""Tests for ResponseFytte... |
the-stack_0_8760 | import os
from transformers import BertTokenizer
from utils import get_rank, mkdir, synchronize
class CustomBertTokenizer(BertTokenizer):
def __init__(self, *args, **kwargs):
super(CustomBertTokenizer, self).__init__(*args, **kwargs)
def decode(self, token_ids, skip_special_tokens=True,
... |
the-stack_0_8762 | #!/usr/bin/python3
import sys
from collections import OrderedDict
from eth_typing import Hash32
from eth_utils import big_endian_to_int
import rlp
from Crypto.Hash import keccak
from rlp.sedes import BigEndianInt, big_endian_int, Binary, binary
from rlp import encode
from eth_utils import to_bytes, to_hex
from web3 i... |
the-stack_0_8764 | """
Define application-wide configuration.
"""
import os
import pytz
basedir = os.path.abspath(os.path.dirname(__file__))
DEBUG = False
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or 'sqlite:///' + os.path.join(basedir, 'data.sqlite')
SQLALCHEMY_TRACK_MODIFICATIONS = False
# DATABASE TIMEZONE. All da... |
the-stack_0_8767 | """
Tests shared by MaskedArray subclasses.
"""
import numpy as np
import pandas as pd
import pandas._testing as tm
from pandas.tests.extension.base import BaseOpsUtil
class ComparisonOps(BaseOpsUtil):
def _compare_other(self, data, op_name, other):
op = self.get_op_from_name(op_name)
# array
... |
the-stack_0_8769 |
# Copyright (c) 2019, NVIDIA 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 t... |
the-stack_0_8770 | """Test converting quaternions to and from rotation matrices"""
from __future__ import division, print_function, absolute_import
import unittest
import numpy as np
import os
import rowan
zero = np.array([0, 0, 0, 0])
one = np.array([1, 0, 0, 0])
half = np.array([0.5, 0.5, 0.5, 0.5])
# Load test files
TESTDATA_FILEN... |
the-stack_0_8772 | # -*- coding: utf-8 -*-
#
# Copyright 2019 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... |
the-stack_0_8775 | from __future__ import absolute_import
from __future__ import print_function
import sys
import os
# the next line can be removed after installation
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))))
from veriloggen import *
def mkTest():
m = Module('... |
the-stack_0_8776 | class Solution:
def numRollsToTarget(self, d: int, f: int, target: int) -> int:
m = 10 ** 9 + 7
dp = [[0] * (target + 1) for _ in range(d + 1)]
dp[0][0] = 1
for i in range(1, d + 1):
for j in range(1, f + 1):
for k in range(j, target + 1):
... |
the-stack_0_8778 | from migen import *
from migen.genlib.cdc import MultiReg
from misoc.interconnect.csr import *
from migen.fhdl.decorators import ClockDomainsRenamer
class SDTriggerOutputDriver(Module, AutoCSR):
def __init__(self, trig_out, latch_in, posedge_in):
posedge_prev = Signal()
self.sync += [
... |
the-stack_0_8779 | import urllib
import urllib2
url="http://licensing.research.ncsu.edu/technologies"
values1={"limit":200,"offset":0}
values2={"limit":200,"offset":200}
data1=urllib.urlencode(values1)
data2=urllib.urlencode(values2)
theurl1=url+"?"+data1
theurl2=url+"?"+data2
r1=urllib2.urlopen(theurl1)
r2=urllib2.urlopen(theurl2)
... |
the-stack_0_8782 | # Copyright 2020 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... |
the-stack_0_8783 | import copy
from django.conf import settings
from django.contrib import messages
from django.http import Http404, HttpResponseRedirect
from django.shortcuts import redirect
from django.template.loader import render_to_string
from django.urls import reverse
from django.utils.decorators import method_decorator
from djan... |
the-stack_0_8786 | from .triangle_metric import *
from .triangle_condition_metric import *
class TriangleShapeMetric(TriangleMetric):
def __init__(self):
super(TriangleShapeMetric, self).__init__(
name='Triangle Shape',
dimension='1',
acceptable_range=Range(min=0.25, max=1),
... |
the-stack_0_8788 | from flask import Flask, Response, request
import requests
import random
app = Flask(__name__)
@app.route('/chance', methods=['GET'])
def chance():
# Gets a shot
shot_response = requests.get("http://service-2:5001/shooter")
shot = (shot_response.text)
# Gets the dive
dive_response = requests.get("... |
the-stack_0_8789 | # -*- coding: utf-8 -*-
from maya import mel
from maya import cmds
from . import lang
from . import common
import os
import json
import re
class WeightCopyPaste():
def main(self, skinMeshes, mode='copy', saveName='default', method='index', weightFile='auto',
threshold=0.2, engine='maya', t... |
the-stack_0_8790 |
#Faça um programa que leia o ano de nascimento
#de um jovem e informe, de acordo com sua idade.
#Se ele ainda vai se alistar ao serviço militar
#se è a hora de se alistar
#Se ja passou do tempo do alistamento
#Seu programa tambem devera mostrar o tempo que
#falta ou se passou do prazo.
from datetime import date
ano... |
the-stack_0_8792 | # Copyright 2019 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 a... |
the-stack_0_8795 | # NOTE: bad django practice but /ee specifically depends on /posthog so it should be fine
from datetime import timedelta
from typing import Any, Dict, List, Optional, Tuple
from dateutil.relativedelta import relativedelta
from django.utils import timezone
from rest_framework import serializers
from rest_framework.deco... |
the-stack_0_8796 | """
Gateway for Binance Crypto Exchange.
"""
import urllib
import hashlib
import hmac
import time
from copy import copy
from datetime import datetime, timedelta
from enum import Enum
from threading import Lock
import pytz
from vnpy.api.rest import RestClient, Request
from vnpy.api.websocket import WebsocketClient
fro... |
the-stack_0_8798 | """Example minimal input plugin for the Mjolnir-Config-Template."""
# Local imports
import brokkr.pipeline.baseinput
class ExampleMinimalInput(brokkr.pipeline.baseinput.ValueInputStep):
def __init__(
self,
example_argument=True,
**value_input_kwargs):
super().__init__(... |
the-stack_0_8799 | """
BALLAST: Builder Assistant to Lay out, Label and Arrange Spectra
Together
This is a simple program to combine and display spectra together.
"""
import sys
import os
import re
import argparse
import typing as tp
import configparser as cfg
from math import *
import numpy as np
i... |
the-stack_0_8800 | import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
from torch.autograd import Function
from torch.autograd import Variable
from ..box_utils import decode, nms
from data import v2 as cfg
class Detect(Function):
"""At test time, Detect is the final layer of SSD. Decode location preds,
appl... |
the-stack_0_8802 | import io
import cv2
import discord
from discord.ext import commands
import debubble as db
import scrape
import secret
# Listen for RSS
# Get image from RSS
# Send to discord
bot = commands.Bot(
command_prefix="!",
description=(
"DebubbleBot automatically removes the text from speech bubbles in "
... |
the-stack_0_8804 | # class AbstractContract is a template for any
# EVM based contract and initializing with contract address and ABI.
# Address and ABI can be found on blockchain explorer such as https://etherscan.io
from abc import ABC
import sys
from web3 import Web3
import decimal
import argparse
# Binance Smart Chain http node p... |
the-stack_0_8807 | from __future__ import unicode_literals
import re
import six
import re
from collections import deque
from collections import namedtuple
def get_filter_expression(expr, names, values):
"""
Parse a filter expression into an Op.
Examples
expr = 'Id > 5 AND attribute_exists(test) AND Id BETWEEN 5 AND... |
the-stack_0_8808 | import setuptools
import sys
import pathlib
if sys.version_info.major < 3:
print("\nPython 2 is not supported! \nPlease upgrade to Python 3.\n")
print(
"Installation of BookCut stopped, please try again with\n"
"a newer version of Python!"
)
sys.exit(1)
# The directory cont... |
the-stack_0_8810 | from flask import g
from models import Duck, Pink
from core.base import single_query
from core.singleton import redis
def pink_serializer(pink=None, pinks=None):
if not pinks:
result = pink.__json__()
result['last_access'] = redis.hget('last_access', g.pink_id)
if pink.id == g.pink_id:
... |
the-stack_0_8811 | # -*- coding: utf-8 -*-
import pytest
from cmarshmallow import fields
from cmarshmallow.marshalling import Marshaller, Unmarshaller, missing
from cmarshmallow.exceptions import ValidationError
from tests.base import User
def test_missing_is_falsy():
assert bool(missing) is False
class TestMarshaller:
@pyt... |
the-stack_0_8812 | __version__ = '1.0'
__author__ = 'Zachary Nowak'
"""STANDARD LIBRARY IMPORTS"""
import glob
import os
import json
os.chdir("/Users/zacan/OneDrive/Documents/GitHub/Keyboard-Biometric-Testing/Project_Tuples/library")
listOfTxtFiles = []
for file in glob.glob("*.txt"):
listOfTxtFiles.append(file)
print(listOfTxtFiles)
... |
the-stack_0_8813 | import json
import logging
from datetime import timedelta
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db.models import F, Q, Count
from itertools import chain
from tornado import ioloop, gen
from tornado.websocket import WebSocketHandler, WebSocketClosedError
from c... |
the-stack_0_8817 | from dask.delayed import delayed
from .data import get_closes, get_volumes, get_yahoo_data
from .signals import get_signals
def get_full_pipeline(tickers, start_date, end_date):
"""Return the full simulation pipeline"""
yahoo_data = delayed(get_yahoo_data)(
tickers, start_date, end_date, dask_key_nam... |
the-stack_0_8818 | import os
import sys
import urllib.request
import json
from pathlib import Path
def main():
file_path = 'logs/release_stats.json'
repository_name = os.environ.get("REPOSITORY_NAME")
request_url = "https://api.github.com/repos/{0}/releases".format(repository_name)
print('request_url = ', r... |
the-stack_0_8820 | """
*******
GraphML
*******
Read and write graphs in GraphML format.
This implementation does not support mixed graphs (directed and unidirected
edges together), hyperedges, nested graphs, or ports.
"GraphML is a comprehensive and easy-to-use file format for graphs. It
consists of a language core to describe the stru... |
the-stack_0_8821 | """Implementations of Real NVP."""
import torch
from torch import nn
from nflows.transforms.base import Transform
from nflows.utils import torchutils
class RealNVP(Transform):
def __init__(self, D, d, hidden):
assert d > 0
assert D > d
assert hidden > 0
super().__init__()
... |
the-stack_0_8822 | # 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)
from spack import *
from spack.operating_systems.mac_os import macos_version
import os
import sys
MACOS_VERSION = macos_v... |
the-stack_0_8824 | import time
class Control_system():
def __init__(self, kp = 1, ki = 0, kd = 0):
self.kp = kp # Proportional gain
self.ki = ki # Integral gain
self.kd = kd # Derivative gai
self.state = 0
self.acc_error = 0 # error integral
self.der_error = 0 # erro... |
the-stack_0_8826 | import scrapy # noqa: F401
import snoop
import isort # noqa: F401
from itertools import zip_longest
class SPIDER_2084(scrapy.Spider):
name = 'spider_2084'
start_urls = ["https://leodido.dev/demystifying-profraw/"]
@snoop
def parse(self, response):
srch_titles = response.xpath("//h1/text(... |
the-stack_0_8827 | from manimlib.animation.creation import ShowCreation
from manimlib.animation.fading import FadeIn
from manimlib.animation.transform import MoveToTarget
from manimlib.animation.transform import Transform
from manimlib.constants import *
from manimlib.mobject.geometry import Arrow
from manimlib.mobject.geometry import Ci... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.