filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_4036 | # Import flask and template operators
from flask import Flask, render_template
# Import SQLAlchemy
from flask_sqlalchemy import SQLAlchemy
# Define the WSGI application object
app = Flask(__name__)
# Configurations
app.config.from_object('config')
# Define the database object which is imported
# by modules and cont... |
the-stack_0_4037 | # Copyright (c) 2021 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 appli... |
the-stack_0_4038 | from math import floor
def format_(number: int) -> float:
return round(float(number), 2)
def play_for( a_performance: dict, plays: dict) -> dict:
return plays[a_performance["playID"]]
def amount_for(a_performance: dict, plays: dict) -> int:
result: int = 0
if play_for(a_performance, plays)["type"] ... |
the-stack_0_4039 | # -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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... |
the-stack_0_4041 | from rocketpyBeta import *
from numpy.random import normal, uniform, choice
from datetime import datetime
IN = {
"impulse": (1240, 100),
"burnOut": (2.84, 0.15),
"nozzleRadius": (30/1000, 0.5/1000),
"throatRadius": (8/1000, 0.5/1000),
"grainSeparation": (1/1000, 0.5/1000),
"grainDensity": (1707, 24),
"grainOuterRadius... |
the-stack_0_4045 | from datetime import timedelta
import aiohttp
import aiohttp_client_cache
from sqlalchemy.ext.asyncio import AsyncSession
from Backend.core.errors import CustomException
from Backend.crud import discord_users
from Backend.database.models import DiscordUsers
from Backend.networking.bungieAuth import BungieAuth
from Ba... |
the-stack_0_4048 | """empty message
Revision ID: dd7377000e2e
Revises: 3a28d0608e7f
Create Date: 2020-08-18 14:14:59.119395
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'dd7377000e2e'
down_revision = '3a28d0608e7f'
branch_labels = None
depends_on = None
def upgrade():
# ... |
the-stack_0_4051 | print('\033[1;31m comparando valores \033[m')
ja_chega = float(input('digite um valor'))
desisto = float(input('digite um valor '))
if ja_chega > desisto:
print('o primeiro valor é maior !!')
elif desisto > ja_chega:
print('o segundo valor é maior !!')
else:
print('os dois valores são iguais')
escolha4 = ''... |
the-stack_0_4052 | import torch
import torch.nn as nn
#from .utils import load_state_dict_from_url
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resnet152', 'resnext50_32x4d', 'resnext101_32x8d',
'wide_resnet50_2', 'wide_resnet101_2']
model_urls = {
'resnet18': 'https://download.pyto... |
the-stack_0_4053 | # Copyright 2012-2019 The Meson development team
# 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 agree... |
the-stack_0_4054 | # Copyright 2019 PerfKitBenchmarker 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 appli... |
the-stack_0_4056 | import json
from django.db.models import Count
from django.http import HttpResponse
from django.template import loader
from .models import Scent, TestResult
def index(request):
template = loader.get_template('smelltest/index.html')
context = {
}
return HttpResponse(template.render(context, request))... |
the-stack_0_4060 | #!/usr/bin/env python
# Copyright 2019, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this fi... |
the-stack_0_4061 | import json
import requests
def webhook(event, context):
print(event)
body = json.loads(event['Records'][0]['body'])
print(body)
headers = {
'Authorization': body['token'],
'Content-Type': 'application/x-www-form-urlencoded'
}
r = requests.post('https://notify-api.line.me/api/n... |
the-stack_0_4063 | # 要添加一个新单元,输入 '# %%'
# 要添加一个新的标记单元,输入 '# %% [markdown]'
# %% [markdown]
# # 含并行连结的网络(GoogLeNet)
#
# Inception块
# %%
import torch
from torch import nn
from torch.nn import functional as F
from d2l import torch as d2l
class Inception(nn.Module):
def __init__(self, in_channels, c1, c2, c3, c4, **kwargs):
su... |
the-stack_0_4065 | #!/usr/bin/env python3
# Copyright 2018 Brocade Communications Systems LLC. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may also obtain a copy of the License at
# http://www.apache.org/licenses/LICENS... |
the-stack_0_4066 | # Copyright The OpenTelemetry 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 or agreed to in ... |
the-stack_0_4068 | """This file contains functions used as part of a user creation pipeline, such as django-social-auth."""
# pylint: disable=W0613
from urllib.parse import urlunparse, urlparse
from .models import TermsAndConditions
from django.http import HttpResponseRedirect, QueryDict
from django.conf import settings
import logging
... |
the-stack_0_4071 | # 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_0_4072 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import soundfile as sf
from ifdvsonogramonly import ifdvsonogramonly
import matplotlib
matplotlib.rcParams['pdf.fonttype'] = 42
matplotlib.rcParams['ps.fonttype'] = 42
from matplotlib.backends.backend_pdf import PdfPages
# import seaborn as sns; sns... |
the-stack_0_4073 | class ElementConstructor(type):
def __new__(cls, name, classes, fields):
fields["cache"] = dict()
return super().__new__(cls, name, classes, fields)
# Common abstract classes
class Element(metaclass=ElementConstructor):
def __new__(cls, key, *args, **kwargs):
if not str(key) in cls.ca... |
the-stack_0_4075 | # coding: utf-8
# 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... |
the-stack_0_4077 | def findSmollest(arr):
smallest = arr[0]
smallest_index = 0
for i in range(1, len(arr)):
if arr[i] < smallest:
smallest = arr[i]
smallest_index = i
return smallest_index
def selectionSort(arr):
newArr = []
for i in range(len(arr)):
smallest = findSmollest... |
the-stack_0_4078 | """ Static order of nodes in dask graph
Dask makes decisions on what tasks to prioritize both
* Dynamically at runtime
* Statically before runtime
Dynamically we prefer to run tasks that were just made available. However when
several tasks become available at the same time we have an opportunity to break
ties in ... |
the-stack_0_4081 | import os
import uuid
from datetime import datetime
from django.conf import settings
from django.utils.translation import gettext as _
from rest_framework.pagination import LimitOffsetPagination
from magpie.apps.files.models import File
from magpie.apps.files.versions.v1.serializers.file import (
FileSerializer,
... |
the-stack_0_4083 | import re
import numpy as np
from specutils import SpectrumList
from specutils.io.registers import data_loader
from .common import get_times
from ..loaders import FITS_FILE_EXTS, no_auto_identify
def calc_aaomega_resolutions(hdr):
# TODO: Add MODE = MOS / IFU
grat = hdr.get("GRATID")
gang = hdr.get("GR... |
the-stack_0_4084 | #*****************************************************
# *
# Copyright 2019 Amazon.com, Inc. or its affiliates. *
# All Rights Reserved. *
# *
#********************************************... |
the-stack_0_4087 | """jc - JSON CLI output utility `systemctl` command output parser
Usage (cli):
$ systemctl | jc --systemctl
or
$ jc systemctl
Usage (module):
import jc.parsers.systemctl
result = jc.parsers.systemctl.parse(systemctl_command_output)
Schema:
[
{
"unit": string,
... |
the-stack_0_4088 |
# https://practice.geeksforgeeks.org/problems/leaders-in-an-array-1587115620/1/?track=md-arrays&batchId=144#
# https://www.geeksforgeeks.org/leaders-in-an-array/
def leaders(A,N):
#Code here
ls = []
max_from_right = A[-1]
for i in range(N-2,-1,-1):
# max_ele=max(A[i+1... |
the-stack_0_4089 | # Given a list of iterators, implement a FlattenedIterator class which incrementally iterates over the integers from all the iterators in an interleaved fashion.
# Example:
# Iterators[0] = [1,2,3]
# Iterators[1] = [4,5]
# Iterators[2] = [6,7,8]
# FlattenedIterator = [1, 4, 6, 2, 5, 7, 3, 8]
# An iterator implement... |
the-stack_0_4090 | from django.core.exceptions import ValidationError
from django.test import TestCase
from wagtail.core.models import Page
from wagtail.tests.utils import WagtailPageTests
from bc.standardpages.tests.fixtures import IndexPageFactory, InformationPageFactory
from ...standardpages.models import IndexPage, InformationPage... |
the-stack_0_4091 | gab = ["A", "C", "E", "B", "D", "B", "B", "C", "A", "E"]
n = []
while True:
p = []
print('-'*50)
nome = input('NOME DO CANDIDATO(digite N para sair): ').upper()
if nome == "N":
break
else:
ac = 0
p.append(nome)
for i in range(1, 11):
print('-'*50)
... |
the-stack_0_4092 | from django.http import HttpResponseRedirect
from django.shortcuts import render, redirect, get_object_or_404
from django.http import HttpResponse
from django.views.generic import TemplateView
from .forms import PostForm, CommentForm
from .models import Post, Comment
from django.contrib.auth.models import User
from dja... |
the-stack_0_4093 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
the-stack_0_4094 | #!/usr/bin/env python3
# -*- coding: utf-8 -*
import sys
sys.path.append('../') # or just install the module
sys.path.append('../../fuzzy-tools') # or just install the module
sys.path.append('../../astro-lightcurves-handler') # or just install the module
sys.path.append('../../astro-lightcurves-fats') # or just install... |
the-stack_0_4096 | """This module contains simple helper functions """
from __future__ import print_function
import torch
import numpy as np
from PIL import Image
import os
from typing import Any, List, Tuple, Union
import sys
import random
def set_seed(seed=None):
if seed is not None:
torch.manual_seed(seed)
np.rand... |
the-stack_0_4100 | """add project settings
Revision ID: 1bb8cb3abf60
Revises: 393a0cce62c7
Create Date: 2018-08-22 15:20:47.132129
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '1bb8cb3abf60'
down_revision = '393a0cce62c7'
branch_labels... |
the-stack_0_4102 | from __future__ import absolute_import, division, print_function
import os,sys
from iotbx import pdb
from iotbx import reflection_file_reader
from iotbx import file_reader
from mmtbx.refinement.real_space import individual_sites
import mmtbx
import libtbx.phil.command_line
from six.moves import range
master_phil = lib... |
the-stack_0_4105 | import os
import sys
sys.path.insert(0, os.getcwd())
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
from torch.nn import Linear
import torch.optim as optim
import networkx as nx
from torch_geometric.data import InMemoryDataset, Data
from torch_geometric.nn import GCNConv
import a... |
the-stack_0_4106 | import sys
sys.path.insert(0, '/home/paul/.conda/envs/tensorflow/lib/python3.6/site-packages')
import keras.preprocessing.image
import deepometry.image.iterator_balanced, deepometry.image.iterator
class ImageDataGenerator(keras.preprocessing.image.ImageDataGenerator):
def __init__(self,
height_... |
the-stack_0_4108 | # Copyright 2019-2020 ETH Zurich and the DaCe authors. All rights reserved.
import os
import multiprocessing as mp
from simple_systolic_array import P, N, make_sdfg
from dace.config import Config
import dace.dtypes
import numpy as np
def run_test(do_async):
Config.set("compiler", "intel_fpga", "launch_async", v... |
the-stack_0_4110 | from com.bridgelabz.utility.queue import Queue
class Banking:
def run(self):
queue=Queue()
money=0
char ='y'
while(char!='n'):
choice=input("select e for enqueue and d for dequeue")
if(choice=='e'):
name=input("enter name")
queu... |
the-stack_0_4111 | # copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
# Modifications copyright (c) 2021 DocYard Authors. All Rights Reserve.
#
# 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
#
# ... |
the-stack_0_4112 | import errno
from collections import defaultdict
from select import select
import socket
from circus import util
from circus import logger
from zmq.eventloop import ioloop
class BaseStatsCollector(ioloop.PeriodicCallback):
def __init__(self, streamer, name, callback_time=1., io_loop=None):
ioloop.Period... |
the-stack_0_4114 | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# Copyright 2018 Michael Still and Aptira
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file exce... |
the-stack_0_4115 | import errno
import json
import logging
import os
import re
import subprocess
import sys
from distutils.util import strtobool
from urllib.parse import parse_qs
sys.path.insert(0, "lib")
import requests # noqa: E402
def get_database_config(development_mode=False):
if any(
[x.startswith("MXRUNTIME_Databa... |
the-stack_0_4117 | # Copyright 2021 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... |
the-stack_0_4118 | # Code source from Jiayuan Gu: https://github.com/Jiayuan-Gu/torkit3d
import torch
import torch.nn as nn
from ..common.mlp import mlp1d_bn_relu, mlp_bn_relu, mlp_relu, mlp1d_relu
__all__ = ["PointNet"]
class PointNet(nn.Module):
"""PointNet for classification.
Notes:
1. The original implementation i... |
the-stack_0_4120 | import os
import pymongo
from crawl_terms import make_vocab_to_def_json
# using dotenv to fetch MongoDB Atlas URL environment variable
MONGO_URL = os.getenv("MONGO_URL")
print("Connecting MongoDB Atlas to: " + MONGO_URL)
# accessing MongoDB Atlas with pymongo MongoClient
client = pymongo.MongoClient(MONGO_URL)
# con... |
the-stack_0_4121 | import logging
from logging import handlers
class logger(object):
level_relations = {
'debug':logging.DEBUG,
'info':logging.INFO,
'warning':logging.WARNING,
'error':logging.ERROR,
'crit':logging.CRITICAL
}#日志级别关系映射
#def __init__(self,filename,level='info',when='D',b... |
the-stack_0_4122 | from pybullet_utils import pd_controller_stable
from pybullet_envs.deep_mimic.env import humanoid_pose_interpolator
import math
chest = 1
neck = 2
rightHip = 3
rightKnee = 4
rightAnkle = 5
rightShoulder = 6
rightElbow = 7
leftHip = 9
leftKnee = 10
leftAnkle = 11
leftShoulder = 12
leftElbow = 13
jointFrictionForce = 0
... |
the-stack_0_4123 | import sys
from notebook import Notebook
class Menu:
'''display a menu and respond to choices when run.'''
def __init__(self):
self._notebook = Notebook()
self._choices = {"1" : self._show_notes,
"2": self._search_notes,
"3": self._add_... |
the-stack_0_4124 | # coding=utf-8
import json
from cStringIO import StringIO
import cv2
import numpy as np
import requests
class InferenceService(object):
"""
Die Klasse ist für das Senden von Bildern zum Inferece Server zuständig.
"""
def __init__(self, interference_server_address):
"""
Konstruktor zu... |
the-stack_0_4125 | """
:copyright: 2010-2015 by Ronny Pfannschmidt
:license: MIT
"""
import os
import warnings
from .config import Configuration
from .utils import function_has_arg, string_types
from .version import format_version, meta
from .discover import iter_matching_entrypoints
PRETEND_KEY = "SETUPTOOLS_SCM_PRETEND_VERSION"
TEMP... |
the-stack_0_4133 | #!/usr/bin/env python3
# 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 hashlib
import os
from typing import Iterable, List, Tuple, Union
import pandas as pd
from pytest_regressions.da... |
the-stack_0_4134 | """
Module containing helper functions for the JASMIN notifications app.
"""
__author__ = "Matt Pryor"
__copyright__ = "Copyright 2015 UK Science and Technology Facilities Council"
from datetime import date
from django.conf import settings
from django.urls import reverse
from django.contrib.auth import get_user_mode... |
the-stack_0_4136 | """Doc2Vec sklearn wrapper"""
from pathlib import Path
import multiprocessing
import statistics
import logging
from sklearn.base import BaseEstimator, TransformerMixin
from gensim.models.doc2vec import Doc2Vec, TaggedDocument
import numpy as np
logging.getLogger("gensim").setLevel(logging.WARNING)
class Doc2VecVect... |
the-stack_0_4137 | """
Bundle Adjustment using GBP.
"""
import numpy as np
import argparse
from gbp import gbp_ba
import vis
parser = argparse.ArgumentParser()
parser.add_argument("--bal_file", required=True,
help="BAL style file with BA data")
parser.add_argument("--n_iters", type=int, default=200,
... |
the-stack_0_4138 | """
Copyright (c) 2017 Max deGroot, Ellis Brown
Released under the MIT license
https://github.com/amdegroot/ssd.pytorch
Updated by: Takuya Mouri
"""
# -*- coding: utf-8 -*-
import torch
import torch.nn as nn
import torch.nn.functional as F
# handbook
# from torch.autograd import Variable
# handbook
from data import coc... |
the-stack_0_4139 | #/usr/bin/env python
# -*- coding: utf-8 -*-
'''from: http://www.dongwm.com/archives/pythonban-ge-ren-jian-li/'''
import re
import random
def color(messages):
color = '\x1B[%d;%dm' % (1, random.randint(30, 37))
return '%s %s\x1B[0m' % (color, messages)
def len_zh(data):
temp = re.findall('[^a-zA-Z0-9.... |
the-stack_0_4140 | # -*- coding: utf-8 -*-
#!/usr/bin/env python
#
"""
解析docker 容器的启动参数
require: python 3
author: Song yanlin
mail: hanxiao2100@qq.com
date: 2021-12-26
"""
import os
from sys import argv
import docker
from docker.errors import APIError
def unit_converter(size: int) -> str or int:
"""存储单位转换
byte 转换 GB、MB、KB... |
the-stack_0_4143 | import numpy as np
import pytest
import sys
from tempfile import TemporaryDirectory
import tensorflow as tf
from tensorflow.keras.layers import Dense, InputLayer
from typing import Callable
from alibi_detect.ad import AdversarialAE, ModelDistillation
from alibi_detect.cd import ChiSquareDrift, KSDrift, MMDDrift, Tabula... |
the-stack_0_4144 | # Copyright 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 applicabl... |
the-stack_0_4145 | # Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
the-stack_0_4148 | """This module provides classes that make up an issue report."""
import logging
import json
import operator
from jinja2 import PackageLoader, Environment
from typing import Dict, List
import hashlib
from mythril.solidity.soliditycontract import SolidityContract
from mythril.analysis.swc_data import SWC_TO_TITLE
from m... |
the-stack_0_4149 |
import os
from flask_babel import _
from flask_login import current_user, login_required
from flask import render_template, redirect, url_for, flash, request,abort
from app.main.forms import PostForm, ProfileForm, BeginForm, MiddleForm, FinalForm
from app.main import bp
from app.models import User, Post
from ext ... |
the-stack_0_4153 | """
This module uses ROSEGRAPHICS to demonstrate:
-- CONSTRUCTING objects,
-- applying METHODS to them, and
-- accessing their DATA via INSTANCE VARIABLES.
Authors: David Mutchler, Dave Fisher, Vibha Alangar, Mark Hays, Amanda Stouder,
their colleagues and Michael Kuznicki.
""" # DONE: 1. PUT YOUR NAME... |
the-stack_0_4154 | #! /usr/bin/python
from __future__ import absolute_import
from __future__ import print_function
from . import rowingdata
from sys import argv
def main():
readFile=argv[1]
try:
rowerFile=argv[2]
except IndexError:
rowerFile="defaultrower.txt"
rower=rowingdata.getrower(rowerFile)
c... |
the-stack_0_4155 | #!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin Core developers
# Copyright (c) 2017 The Raven Core developers
# Copyright (c) 2018 The Kimora Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test wallet i... |
the-stack_0_4156 | import scrapy
from sec.items import SecItem
import re
class SecSpider(scrapy.Spider):
name = 'sec'
allowed_domains = ['sec.gov']
start_urls = [
'https://www.sec.gov/cgi-bin/browse-edgar?CIK=t&owner=exclude&action=getcompany&count=100',
]
def parse(self, response):
for s... |
the-stack_0_4157 | """
Migration script to alter the type of the tool_dependency.version column from TrimmedString(40) to Text.
"""
import logging
from sqlalchemy import (
MetaData,
Table
)
log = logging.getLogger(__name__)
metadata = MetaData()
def upgrade(migrate_engine):
print(__doc__)
metadata.bind = migrate_engi... |
the-stack_0_4158 | from collections import OrderedDict
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.paginator import Paginator, InvalidPage
from django.http import HttpResponseRedirect
from django.shortcuts import render, get_object_or_404
from django.urls import reverse
... |
the-stack_0_4160 | """
This file must not depend on any other CuPy modules.
"""
import ctypes
import json
import os
import os.path
import shutil
import sys
import warnings
# '' for uninitialized, None for non-existing
_cuda_path = ''
_nvcc_path = ''
_rocm_path = ''
_hipcc_path = ''
_cub_path = ''
"""
Library Preloading
--------------... |
the-stack_0_4161 | import string
BASE_CHARACTERS = string.ascii_letters + string.digits
SAFE_CHARACTERS = frozenset(BASE_CHARACTERS + '-_.')
KEY_LENGTH = (2, 128)
NONCE_LENGTH = (6, 128)
SECRET_LENGTH = (6, 128)
default_app_config = 'django_lti_login.apps.DjangoLTILoginConfig'
|
the-stack_0_4162 | # -*- coding: utf-8 -*-
import numpy as np
import os
from VDE.VASPMoleculeFeature import VASP_DataExtract
import pickle
from dlmep.DatasetOffer import print_file
class DatasetMaker(object):
def __init__(self,dir_list):
if not isinstance(dir_list,list):
dir_list = [dir_list]
self.... |
the-stack_0_4163 | # Copyright 2017, OpenCensus 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 or agreed to in w... |
the-stack_0_4164 | # Copyright 2016 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_4165 | from django.db import migrations
from job_board.models.job_type import JobType
from job_board.resources.job_types import JOB_TYPES
class Migration(migrations.Migration):
dependencies = [
('job_board', '0001_initial'),
]
def generate_jobType_data(apps, schema_editor):
for jobType in JOB_T... |
the-stack_0_4167 | from __future__ import division
from itertools import product, groupby
import numpy as np
import logging
from scipy.special._ufuncs import erfc
from statsmodels.stats.multitest import fdrcorrection
logging.basicConfig(level=logging.DEBUG)
def timelag_by_for_loop (timeseries1, timeseries2):
"""Returns for each e... |
the-stack_0_4169 | # Copyright 2018 The Cirq Developers
#
# 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 ... |
the-stack_0_4171 | #!/usr/bin/env python3
import copy
import os
import pickle
import sys
import time
from src.channel_maps import channel_loc_map
from src.data_preprocess import data_1D_to_2D
from src.movement_onset_detect import *
db_dir = os.getcwd()
ME_db_fname = "prelim_ME_db_128.pickle"
ME_Kin_db_fname = "noneeg_ME_db_128.pickle"... |
the-stack_0_4174 | import apsw
import logging
import re
import threading
import traceback
from collections import deque
import ob2.config as config
from ob2.database import DbCursor
from ob2.database.helpers import (
assign_grade_batch,
get_repo_owners,
get_users_by_ids,
)
from ob2.dockergrader.job import JobFailedError
from... |
the-stack_0_4175 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# test_model.py
#
#
from datetime import datetime
import mock
import pytz
from django.conf import settings
from django.test import TestCase
from qa.mixins import DateMixin
TZ = settings.TIME_ZONE
# This is the function that replaces django.utils.timezone.now()
d... |
the-stack_0_4176 | import os
import datetime
import argparse
import cv2
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from progress.spinner import Spinner
import ntpath
def make_safe(unsafe_string):
return "".join([c for c in unsafe_string if c.isalpha() or c.isdigit()]).rstrip()
parser = argparse.Argumen... |
the-stack_0_4177 | import tkinter as tk
from predict import load_model, classify_text
class Todo(tk.Tk):
def __init__(self, tasks=None):
super().__init__()
self.title("Text Language Identifier")
self.geometry("600x210")
self.language_note = tk.Label(self, text="Language Identified", bg="lightgrey",... |
the-stack_0_4178 | graph = {
'0': ['1', '2'],
'1': ['0', '2', '3', '4', '10'],
'2': ['0', '1', '3', '4', '7', '9'],
'3': ['1', '2', '4', '5'],
'4': ['1', '2', '3', '5', '6', '7', '8'],
'5': ['3', '4', '6', '8'],
'6': ['4', '5'],
'7': ['2', '4', '9', '10'],
'8': ['4', '5'],
'9': ['2', '7'],
'10'... |
the-stack_0_4179 | # -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
the-stack_0_4180 | from __future__ import absolute_import
from tornado import web, testing
from tornado.ioloop import IOLoop
from pyswagger import SwaggerApp
from pyswagger.contrib.client.tornado import TornadoClient
from ...utils import create_pet_db, get_test_data_folder, pet_Mary
import json
import sys
import pytest
import six
sapp ... |
the-stack_0_4181 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0016_auto_20151222_0052'),
]
operations = [
migrations.AlterModelOptions(
name='photo',
opti... |
the-stack_0_4182 | #!/usr/bin/env python
from time import sleep
from drive import RosAriaDriver
from math import sin, cos
### replace X with the robot number
robot=RosAriaDriver('/PIONIER4')
skan=robot.ReadLaser()
### read and write in json format
import json
with open('data_stereo.json','w') as json_data_file:
json.dump(skan,json... |
the-stack_0_4184 | import numpy as np
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
""" attention pad mask """
def get_attn_pad_mask(seq_q, seq_k, i_pad):
batch_size, len_q = seq_q.size()
batch_size, len_k = seq_k.size()
pad_attn_mask = seq_k.data.eq(i_pad).unsqueeze(1).expand(batch_size, l... |
the-stack_0_4185 | from flask import Blueprint, render_template, url_for, request, redirect
from logzero import logger
from base.utils.auth import admin_required, get_jwt
from base.forms import AdminEditToolContainerVersion
from caendr.services.tool_versions import get_all_containers, get_available_version_tags, get_container, get_vers... |
the-stack_0_4186 | '''
Created on Sep 6, 2021
@author: mhindle
'''
import numpy as np
import numbers
from typing import Tuple, List, Dict, Union, Set
import itertools
from collections import defaultdict
import pandas as pd
class JointAllellicDistribution(object):
def __init__(self, snp_ordered, chromosome2snp=None, pseudocount = 1... |
the-stack_0_4188 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2010-2016 PPMessage.
# Guijin Ding, dingguijin@gmail.com
#
#
from .basehandler import BaseHandler
from ppmessage.api.error import API_ERR
from ppmessage.db.models import OrgGroup
from ppmessage.db.models import OrgGroupUserData
from ppmessage.core.constant import API_LEVEL
f... |
the-stack_0_4190 | #!/usr/bin/env python
from _title_word import ngram_line, ngram, run
from collections import Counter, defaultdict
def parse_word(title, txt):
count = defaultdict(int)
# word_set = set()
total = len(title) + len(txt)
for i in ngram_line(title):
if len(i) > 1:
count[i] = 1
for i in ngram_line(tx... |
the-stack_0_4192 | """Benchmark for merge0.
Trains a small percentage of autonomous vehicles to dissipate shockwaves caused
by merges in an open network. The autonomous penetration rate in this example
is 10%.
- **Action Dimension**: (5, )
- **Observation Dimension**: (25, )
- **Horizon**: 750 steps
"""
from flow.envs import MergePOEnv... |
the-stack_0_4194 | from collections import OrderedDict
from datetime import timedelta as td
from django.core.urlresolvers import reverse
from django.template.defaultfilters import slugify
from cachecow.decorators import cached_function
from django.utils.translation import ugettext, ugettext_lazy as _, pgettext, pgettext_lazy
from djang... |
the-stack_0_4195 | #!/usr/bin/env python
import os
import re
import sys
from setuptools import setup, find_packages
version = re.compile(r'VERSION\s*=\s*\((.*?)\)')
def get_package_version():
"returns package version without importing it"
base = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(base, "flo... |
the-stack_0_4196 | # -*- coding: utf-8 -*-
"""
Trac WebAdmin plugin for administration of custom fields.
License: BSD
(c) 2005-2012 ::: www.CodeResort.com - BV Network AS (simon-code@bvnetwork.no)
(c) 2007-2009 ::: www.Optaros.com (.....)
"""
from pkg_resources import resource_filename
from trac.config import Option
from trac.core im... |
the-stack_0_4197 | from whatsapp_defines import (
WATags,
WASingleByteTokens,
WADoubleByteTokens,
WAWebMessageInfo,
)
class WABinaryReader:
def __init__(self, data):
self.data = data
self.index = 0
def checkEOS(self, length):
if self.index + length > len(self.data):
raise EOF... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.