filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_6961 | from django.contrib import admin
from django.utils.html import format_html
from .models import File
@admin.register(File)
class FileAdmin(admin.ModelAdmin):
view_on_site = False
raw_id_fields = ('version',)
list_display = ('__str__', 'addon_slug', 'addon_guid')
search_fields = (
'^version__a... |
the-stack_0_6963 | from django.db import models
# Create your models here.
class HumenManage(models.Manager):
def create_girl(self,name):
res = Humen.objects.create(
name = name,
age = 18,
money = 1
)
return res
class Humen(models.Model):
name = models.CharField(
... |
the-stack_0_6965 | #!/usr/bin/env python3
#coding:utf8
from sanic.log import logger
# 全局debug开关 如果通过sanic命令行开启会自动忽略该字段
# 通过命令行运行
# https://sanic.readthedocs.io/en/latest/sanic/deploying.html
# python3 -m sanic app.app --host=0.0.0.0 --port=9000 --worker=1 --debug
DEBUG_MODE=True
def create_app():
global DEBUG_MODE
import os
... |
the-stack_0_6967 | import torch
from .Criterion import Criterion
from .utils import clear
class L1Cost(Criterion):
def __init__(self):
super(L1Cost, self).__init__()
self.output_tensor = torch.Tensor(1)
def updateOutput(self, input, target=None):
assert target is None
if self.output_tensor is N... |
the-stack_0_6968 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 5/15/20 4:49 PM
# @File : grover.py
# qubit number=4
# total number=18
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
#thatsNoCode
def make_circuit(n: int, input_qubit):
c = cirq.Ci... |
the-stack_0_6969 | # matrix_determinant 练习测试,作用,返回方阵的行列式 .行列式的概念可参考:https://www.jianshu.com/p/0fd8ac349b5e
import tensorflow as tf
import numpy as np
# 方阵
data = np.mat([[11.1,12.1],
[21.1,22.1]]);
with tf.Session() as sess:
z = tf.matrix_determinant(data);
print(sess.run(z));
|
the-stack_0_6970 | import json
source = "Île-de-France Mobilités 04/2019"
no_dataset_id = True
query = [('park_ride', 'yes')]
master_tags = ('amenity',)
max_distance = 800
max_request_boxes = 3
overpass_timeout = 550
def dataset(fileobj):
import codecs
source = json.load(codecs.getreader('utf-8-sig')(fileobj))
#source = j... |
the-stack_0_6971 | # cifar10_svm.py
# Support Vector Machine (SVM)
import time
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from sklearn import model_selection
from scipy.io import loadmat
from sklearn.svm import SVC, LinearSVC
from sklearn.metrics import hinge_loss
from sklearn.metrics import classification_... |
the-stack_0_6972 | from infi.clickhouse_orm import migrations
from ee.clickhouse.sql.session_recording_events import SESSION_RECORDING_EVENTS_MATERIALIZED_COLUMN_COMMENTS_SQL
from posthog.client import sync_execute
from posthog.settings import CLICKHOUSE_CLUSTER, CLICKHOUSE_REPLICATION
def create_has_full_snapshot_materialized_column(... |
the-stack_0_6975 | # standart modules
import threading
import struct
import os
# blender modules
import bpy
import bmesh
# addon modules
import taichi as ti
import numpy as np
from .engine import mpm_solver
from . import types
from . import particles_io
from . import nodes
WARN_SIM_NODE = 'Node tree must not contain more than 1 "Simu... |
the-stack_0_6976 | import sys
import os
print('Welcome User ....')
print('yt : for browsing youtube\n'+
'news : for browsing Google News\n'+
#'run : for running codes on GeeksforGeeks Online IDE\n'+
'shuffle : to shuffle play the songs of your favorite artists\n'+
'play : to shuffle play songs from your playlist\... |
the-stack_0_6979 | """Testing Deep Learning with Graph Neural Networks."""
import logging
import logging.config
import os
import sys
import matplotlib.pyplot as plt # this is for making the graph
import networkx as nx
import numpy as np
# import pandas as pd
import pygraphviz as pgv # sudo apt install libgraphviz-dev
from gnn.lib.com... |
the-stack_0_6980 | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import numpy as np
epsilon = 1e-8
def whitening(image):
"""Whitening
Normalises image to zero mean and unit variance
Parameters
----------
image : np.ndarray
image to be whitened... |
the-stack_0_6981 | """
0123. Best Time to Buy and Sell Stock III
Say you have an array for which the ith element is the price of a given stock on day i.
Design an algorithm to find the maximum profit. You may complete at most two transactions.
Note: You may not engage in multiple transactions at the same time (i.e., you must sell the s... |
the-stack_0_6982 | from __future__ import absolute_import, division, print_function, unicode_literals
import collections
import numpy as np
from caffe2.python import utils, workspace
from caffe2.quantization.server import dnnlowp_pybind11
from hypothesis import assume
# This function asserts quantized results (output[1:]) are close e... |
the-stack_0_6985 | #!/usr/bin/env python
# Assume python 2.6 or 2.7
import glob
import os
import subprocess
## Simple test runner.
# -- config -----------------------
# Absolute path pointing to your cloned git repo of https://github.com/KhronosGroup/glTF-Sample-Models
sample_model_dir = "/home/syoyo/work/glTF-Sample-Models"
base_mo... |
the-stack_0_6986 | import os
import time
import hashlib
import argparse
import pandas as pd
import subprocess
def unmount_SDs(sd_prefix):
'''
Unmount all disks named with matching prefix
Inputs:
sd_prefix: user-specified list of sd card prefixes to use
'''
cwd = os.getcwd()
filename = "SDlist.txt"
for i in range(len(sd_pr... |
the-stack_0_6987 | import struct
from io import BytesIO
from ot_types import *
#inline below:
# import ot_table
# from ot_font import OTFont, TableRecord
# from ot_file import calcCheckSum
class Table_head:
_expectedTag = "head"
# head v1.0 format
_head_version = ">2H"
_head_version_size = struct.calcsize(_head_v... |
the-stack_0_6988 | import numpy as np
import pandas as pd
from scipy.sparse import issparse
from . ItClust import transfer_learning_clf
from . calculate_adj import distance
from . calculate_adj import calculate_adj_matrix
from . utils import find_l
import tensorflow as tf
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)
c... |
the-stack_0_6993 | from __future__ import print_function, unicode_literals, division
import os
import re
import codecs
import platform
import logging
from subprocess import check_output
from tempfile import mkdtemp
from functools import partial
try:
from configparser import ConfigParser
except ImportError:
from ConfigParser im... |
the-stack_0_6994 | from __future__ import print_function
import pprint
from collections import OrderedDict
from nose.tools import assert_equal
from tools import unit
from xdress.doxygen import class_docstr, func_docstr
car_dict = {'file_name': 'Cars.h',
'kls_name': 'util::Car',
'members': {'methods': ['Car',
'... |
the-stack_0_6995 | from tqdm import tqdm
import torch
from .utils import get_cosine_schedule
from . import mcmc
import math
from .exp_utils import evaluate_model
class SGLDRunner:
def __init__(self, model, dataloader, dataloader_test, epochs_per_cycle, warmup_epochs,
sample_epochs, learning_rate=1e-2, skip=1, metri... |
the-stack_0_6997 | """sneh_figma_test_app_22681 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='... |
the-stack_0_6999 | """
This module contains the classes for Nodes, Arcs used in the optimizer with mnetgen format,
for the solvers.
"""
from typing import List
class Arc:
def __init__(
self,
name: int,
from_node: int,
to_node: int,
commodity: int,
cost: float,
capacity: int,... |
the-stack_0_7001 | # coding: utf-8
from __future__ import unicode_literals
import json
import re
import time
from .common import InfoExtractor
from ..compat import (
compat_urlparse,
compat_HTTPError,
)
from ..utils import (
USER_AGENTS,
ExtractorError,
int_or_none,
unified_strdate,
remove_end,
update_ur... |
the-stack_0_7002 | import os
import sys
import pathlib
import time
import shutil
try:
import pymake
except:
msg = "Error. Pymake package is not available.\n"
msg += "Try installing using the following command:\n"
msg += " pip install https://github.com/modflowpy/pymake/zipball/master"
raise Exception(msg)
try:
... |
the-stack_0_7005 | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 11 11:34:57 2021
@author: SethHarden
"""
import math
import heapq
def maxCandies(arr, k):
bags = []
minutes = k
#push the list into a heap
for i in arr:
heapq.heappush(bags, -i)
#set our minimum
answer = 0
#while we have time and there are b... |
the-stack_0_7008 | """
A module implementing EOPatch merging utility
Credits:
Copyright (c) 2018-2020 William Ouellette
Copyright (c) 2017-2020 Matej Aleksandrov, Matej Batič, Grega Milčinski, Matic Lubej, Devis Peresutti (Sinergise)
Copyright (c) 2017-2020 Nejc Vesel, Jovan Višnjić, Anže Zupanc (Sinergise)
This source code is licensed... |
the-stack_0_7011 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Part of the PsychoPy library
# Copyright (C) 2012-2020 iSolver Software Solutions (C) 2021 Open Science Tools Ltd.
# Distributed under the terms of the GNU General Public License (GPL).
from __future__ import division, absolute_import, print_function
from builtins import... |
the-stack_0_7013 | import pandas as pd
from bokeh.plotting import figure, show, curdoc
from bokeh.layouts import widgetbox, layout, row, column
from bokeh.models import ColumnDataSource, Button, Slider, Dropdown, PreText, DataTable, TableColumn, MultiSelect, NumberFormatter, Spacer
from collections import OrderedDict, Counter
import nump... |
the-stack_0_7014 | #!/usr/bin/env python3
import os
import pathlib
import sys
import github
import msgpack
import packaging.version
from jinja2 import Template
from slugify import slugify
from tqdm import tqdm
DISABLE_TQDM = "CI" in os.environ
HEADERS = {"user-agent": "https://github.com/salt-extensions/salt-extensions-index"}
REPO_RO... |
the-stack_0_7015 | # 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_7018 | import allure
from tep.client import request
@allure.title("重定向--put")
def test(env_vars):
# 描述
# 数据
# 请求
response = request(
"put",
url=env_vars.domain + "/redirect-to?url=https%3A%2F%2Fwww.baidu.com&status_code=200",
headers={'Host': 'httpbin.org', 'Proxy-Connection': 'keep-a... |
the-stack_0_7019 | from __future__ import annotations
import re
import warnings
from typing import TYPE_CHECKING, Any, Dict, List, Optional
import pandas as pd
from dateutil import parser
from cimsparql.query_support import combine_statements, unionize
if TYPE_CHECKING: # pragma: no cover
from cimsparql.model import CimModel
as... |
the-stack_0_7020 | """
Includes the XMattersEvent class which wraps the xMatters Event to make it easier
to use correct formatting
"""
import json
# pylint: disable = import-error
from common_utils.setup_logging import setup_logging
# pylint: enable = import-error
DEFAULT_LOGGER = setup_logging('xmatters_alert_action.log', 'xma... |
the-stack_0_7022 | #searches file
import sqlite3
import os
import databaseCreate
#seacrh function
db=sqlite3.connect("SongStorage.db")
def searchSong(searchBy , searchText):
databaseCreate.createDb()
db = """SELECT * FROM song WHERE ? = ? """(searchBy ,searchText)
try:
cur = db.cursor()
cur.execute(db)
output... |
the-stack_0_7025 | #!/usr/local/bin/python3
import json, os, sys
from diff_adt import DiffConfig, DiffResult
from time import localtime, strftime
from subprocess import call
from diff_lev import *
CURRENT_TIMESTAMP = strftime("%Y-%m-%d-%H%M", localtime())
DEBUG_MODE = False
def main():
print('Getting config and preparing run ...'... |
the-stack_0_7027 | # Copyright 2018 Mycroft AI 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 writin... |
the-stack_0_7028 | from flask import Blueprint, jsonify, request
from multiprocessing.connection import Client
from interface import IRequest, IPageResult, MessageProtocol
import uuid, zlib
from datetime import datetime, timedelta
from tool import log
l = log("Api")
NAME = ("localhost", 25100)
Api = Blueprint('Api', __name__)
@Api.ro... |
the-stack_0_7032 | """
Utilities of MobileNet training
"""
from models import modules
import os
import sys
import time
import math
import shutil
import tabulate
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import torchvision
import torch.optim as optim
import torchvision.transforms as transforms
import matplo... |
the-stack_0_7036 | #!/usr/bin/env python3
# Copyright (c) 2014-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Helpful routines for regression testing."""
from base64 import b64encode
from binascii import unhexlif... |
the-stack_0_7037 | # MIT license
#
# Copyright (C) 2018 by XESS Corporation / Hildo Guillardi Junior
#
# 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 right... |
the-stack_0_7038 | """Common datatypes and pytd utilities."""
from typing import Any, List, Tuple
import dataclasses
from pytype import utils
from pytype.pytd import pytd
from pytype.pytd import pytd_utils
from pytype.pytd.codegen import pytdgen
from pytype.pytd.parse import node as pytd_node
from typed_ast import ast3
_STRING_TYPE... |
the-stack_0_7040 | #!/usr/bin/env python3
import os
import argparse
import torch
import torch.distributed as dist
import torchvision
import torchvision.transforms as transforms
from torchvision.models import AlexNet
from torchvision.models import vgg19
import deepspeed
from deepspeed.pipe import PipelineModule
from deepspeed.utils im... |
the-stack_0_7041 | import argparse
import os
import pickle
parser = argparse.ArgumentParser()
parser.add_argument("--model_ind", type=int, required=True)
parser.add_argument("--out_root", type=str,
default="/scratch/shared/slow/xuji/iid_private")
given_config = parser.parse_args()
given_config.out_dir = os.path.joi... |
the-stack_0_7044 | # encoding: utf-8
"""
Paragraph-related proxy types.
"""
from __future__ import (
absolute_import, division, print_function, unicode_literals
)
from ..enum.text import WD_LINE_SPACING
from ..shared import ElementProxy, Emu, lazyproperty, Length, Pt, Twips
from .tabstops import TabStops
class ParagraphFormat(El... |
the-stack_0_7045 | # Copyright (C) 2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import logging as log
import os
import subprocess
import sys
from openvino.tools.mo.utils.versions_checker import check_python_version # pylint: disable=no-name-in-module
def log_ie_not_found():
log.error("Could not find the Inference... |
the-stack_0_7047 | from unittest.mock import patch
from django.core.management import call_command
from django.db.utils import OperationalError
from django.test import TestCase
class CommandTests(TestCase):
def test_wait_for_db_ready(self):
"""Test if operational error is thrown!"""
with patch('django.db.utils.Conn... |
the-stack_0_7048 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
the-stack_0_7050 | # Copyright (c) Facebook, Inc. and its affiliates.
# Copyright (c) 2020, Emanuele Bugliarello (@e-bug).
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import sys
import json
import yaml
import random
import logging
import argparse
... |
the-stack_0_7051 | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... |
the-stack_0_7052 | '''
python-lambda-local: Test Direct Invocations
(command-line and direct).
Meant for use with py.test.
Copyright 2015-2020 HENNGE K.K. (formerly known as HDE, Inc.)
Licensed under MIT
'''
import json
import argparse
from multiprocessing import Process
import os
from lambda_local.main import run as lambda_run
from la... |
the-stack_0_7053 | import turtle as tt
from random import randint, sample
def draw():
size = randint(40, 300)
angles = (144, 150, 157.5, 160, 165)
angle = sample(angles, 1)[0]
colors = [
('#922B21', '#E6B0AA'), ('#76448A', '#D2B4DE'), ('#1F618D', '#AED6F1'), ('#515A5A', '#EAEDED'),
('#148F77'... |
the-stack_0_7059 | # Copyright 2021 The NetKet 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 ... |
the-stack_0_7064 | """
Internal subroutines for e.g. aborting execution with an error message,
or performing indenting on multiline output.
"""
import os
import six
import sys
import struct
import textwrap
from traceback import format_exc
def _encode(msg, stream):
if six.PY2 and isinstance(msg, six.text_type) \
and hasa... |
the-stack_0_7065 | from programs.schema.attributes.abstractattribute import AbstractAttribute
from constants import CC
class HHRaceAttr(AbstractAttribute):
@staticmethod
def getName():
return CC.ATTR_HHRACE
@staticmethod
def getLevels():
return {
'white' : [0],
'black' ... |
the-stack_0_7068 | # Copyright (c) 2012 OpenStack Foundation.
#
# 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_0_7070 | __all__ = ['atleast_1d', 'atleast_2d', 'atleast_3d', 'block', 'hstack',
'stack', 'vstack']
import functools
import itertools
import operator
import warnings
from . import numeric as _nx
from . import overrides
from .multiarray import array, asanyarray, normalize_axis_index
from . import fromnumeric as _fro... |
the-stack_0_7071 | # coding: utf-8
"""
ThingsBoard REST API
ThingsBoard open-source IoT platform REST API documentation. # noqa: E501
OpenAPI spec version: 3.3.3-SNAPSHOT
Contact: info@thingsboard.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
impor... |
the-stack_0_7073 | """runpy.py - locating and running Python code using the module namespace
Provides support for locating and running Python scripts using the Python
module namespace instead of the native filesystem.
This allows Python code to play nicely with non-filesystem based PEP 302
importers when locating support scripts ... |
the-stack_0_7074 | import os
import io
import sys
import csv
import random
import hashlib
import pandas as pd
import numpy as np
import tensorflow as tf
from PIL import Image
import xml.etree.ElementTree as ET
from matplotlib import pyplot as plt
from object_detection.utils import label_map_util
from object_detection.utils import visuali... |
the-stack_0_7075 | from crfnet.utils.transform import random_transform_generator
from crfnet.utils.anchor_parameters import AnchorParameters
from crfnet.data_processing.generator.splits.nuscenes_splits import Scenes
from crfnet.utils.anchor_calc import anchor_targets_bbox
from crfnet.utils.anchor import guess_shapes
def create_generator... |
the-stack_0_7076 | # DENG: dynamic engine - powerful 3D game engine
# licence: Apache, see LICENCE file
# file: BackendChooser.py - Embeddable Python script to select a correct backend to use for required program
# author: Karl-Mihkel Ott
import tkinter as tk
import tkinter.messagebox as msgbox
from enum import IntEnum
class ApiType(I... |
the-stack_0_7080 | """Script to download the entire Box directory structure.
Skips anything that has been downloaded before.
Syncs to LOCAL_BOX_DIR
To obtain a developer token, navigate to
https://salesforcecorp.app.box.com/developers/console/app/1366340/configuration
and select "Generate Developer Token", then copy-paste it below.
Ex... |
the-stack_0_7081 | import os
import sys
import argparse
import yaml
import time
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.optim as optim
import torchlight
from torchlight import str2bool
from torchlight import DictAction
from torchlight im... |
the-stack_0_7082 | import numpy as np
import pandas as pd
from scipy.stats import rankdata
def rolling_mean(data, period):
rm = pd.rolling_mean(data, period)
rm = rm[~np.isnan(rm)]
return rm
def mean(value):
value = np.mean(value)
if np.isnan(value):
return 0.
return value
class DCA:
def __init__... |
the-stack_0_7083 | def findDecision(obj): #obj[0]: Passanger, obj[1]: Time, obj[2]: Coupon, obj[3]: Gender, obj[4]: Age, obj[5]: Children, obj[6]: Education, obj[7]: Occupation, obj[8]: Income, obj[9]: Bar, obj[10]: Coffeehouse, obj[11]: Restaurant20to50, obj[12]: Direction_same, obj[13]: Distance
# {"feature": "Age", "instances": 34, "... |
the-stack_0_7084 | #!/usr/bin/python
"""
(C) Copyright 2020-2021 Intel Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
"""
import time
from apricot import TestWithServers
from general_utils import bytes_to_human, human_to_bytes
from server_utils import ServerFailed
class PoolTestBase(TestWithServers):
"""Base pool test ... |
the-stack_0_7085 | from __future__ import annotations
from typing import Tuple, NoReturn
from ...base import BaseEstimator
import numpy as np
from itertools import product
from ...metrics import misclassification_error
class DecisionStump(BaseEstimator):
"""
A decision stump classifier for {-1,1} labels according to the CART a... |
the-stack_0_7086 | # -*- coding: utf-8 -*-
import json
import logging
import re
from concurrent import futures
from urllib.parse import quote, unquote, urlparse
from bs4 import BeautifulSoup
from bs4.element import Tag
from ..utils.crawler import Crawler
logger = logging.getLogger('BABELNOVEL')
search_url = 'https://babelnovel.com/ap... |
the-stack_0_7087 | import tkinter as tk
class AutoScrollbar(tk.Scrollbar):
"""Create a scrollbar that hides iteself if it's not needed. Only
works if you use the pack geometry manager from tkinter.
https://stackoverflow.com/questions/57030781/auto-hiding-scrollbar-not-showing-as-expected-with-tkinter-pack-method
"""
... |
the-stack_0_7089 | # Ke Yan, Imaging Biomarkers and Computer-Aided Diagnosis Laboratory,
# National Institutes of Health Clinical Center, July 2019
"""Utilities for DeepLesion"""
import numpy as np
#from openpyxl import load_workbook
import json
from collections import Counter
#from maskrcnn.utils.miscellaneous import unique
from fcos_co... |
the-stack_0_7092 | import requests
import datetime
import random
import time
import json
def get_time():
return datetime.datetime.now().strftime("%H:%M:%S %Y-%m-%d")
def get_token():
return open('token.txt', 'r', encoding='UTF-8').read()
def change_status_text(token, text):
url = 'https://discord.com/api/v9/... |
the-stack_0_7094 | import asyncio
import functools
import random
import time
from testing import Client
from testing import default_test_setup
from testing import gen_data
from testing import gen_points
from testing import gen_series
from testing import InsertError
from testing import PoolError
from testing import QueryError
from testing... |
the-stack_0_7095 | """ The MIT License (MIT)
Copyright (c) 2014 Kyle Hollins Wray, University of Massachusetts
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 ... |
the-stack_0_7096 | import glob
import cv2
import numpy as np
import pickle
def _initialize_object_points(n_horizontal, n_vertical):
objp = np.zeros((n_horizontal * n_vertical, 3), np.float32)
objp[:, :2] = np.mgrid[0:n_horizontal, 0:n_vertical].T.reshape(-1, 2)
return objp
def get_distortion_matrix(input_path, image_dims,... |
the-stack_0_7097 | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: david@reciprocitylabs.com
# Maintained By: david@reciprocitylabs.com
import ggrc
import ggrc.builder
import ggrc.services
import json
import random... |
the-stack_0_7099 | from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import gridspec
class Plotter:
def __init__(self, target, glide_angle_deg, bounds_radius_k... |
the-stack_0_7100 | import sys
import os
import crawler
import parser
import json
import datetime
if('COURT' in os.environ):
court = os.environ['COURT']
else:
sys.stderr.write("Invalid arguments, missing parameter: 'COURT'.\n")
os._exit(1)
if('YEAR' in os.environ):
year = os.environ['YEAR']
else:
sys.stderr.write("Inv... |
the-stack_0_7105 | # read_numbers.py
#
# Sample program to read numbers from a file, count them and sum them.
# Assumes each line in the file contains a valid number.
# CSC 110
# Winter 2012
# open the file 'numbers.txt' for reading
infile = open('numbers.txt', 'r')
total = 0 # initialization
count = 0 # initialization
line = infile... |
the-stack_0_7106 | """."""
import networkx as nx
from regraph import Rule
from regraph import NXHierarchy, NXGraph
# from regraph import print_graph
# from regraph import (HierarchyError)
import regraph.primitives as prim
class TestRelations(object):
def __init__(self):
hierarchy = NXHierarchy()
base = NXGraph()
... |
the-stack_0_7107 | # Run Validation test. Use functions to test run and get output
import util
import time
def create_service(nspc, image):
port = "-p 80/http"
fullName = util.rioRun(nspc, port, image)
return fullName
def stage_service(image, fullName, version):
util.rioStage(image, fullName, version)
return
... |
the-stack_0_7110 | # -*- coding: utf-8 -*-
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
the-stack_0_7111 | import numpy
import theano
import theano.tensor as tensor
from nmt import RNNsearch
from binmt import BiRNNsearch
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
import tools
from layer import LayerFactory
from config import *
from optimizer import adadelta, SGD, adam, adam_slowstart
from data im... |
the-stack_0_7112 | # Copyright (c) 2020 Portworx
#
# 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_7113 | """ nftfw - Geoip2 support
Requires python3-geoip2 and geoupupdate packages
and a license from MaxMind
https://dev.maxmind.com/geoip/geoip2/geolite2/
"""
import os.path
class GeoIPCountry:
"""Lookup ip addresses in geoip2 """
# Set up reader
countryreader = None
# Country database
country = '/v... |
the-stack_0_7114 | """
coast - Plot land and water.
"""
from pygmt.clib import Session
from pygmt.exceptions import GMTInvalidInput
from pygmt.helpers import (
args_in_kwargs,
build_arg_string,
fmt_docstring,
kwargs_to_strings,
use_alias,
)
@fmt_docstring
@use_alias(
R="region",
J="projection",
A="area_... |
the-stack_0_7116 | from PIL import Image, ImageOps
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import time
from timeit import default_timer as timer
#########from IPython.display import display
#Création des fonctions de tri
def triParComptage(Tab):
# Initialisation des variables
bSup=max(Tab)
TabComptage=[... |
the-stack_0_7118 | """
Note: When using this api many of the commands come with an option to skip the initilization of the comms e.g. ...
def read_word(self, address, initialize_comms=True):
setting initialize_comms=False will skip the comms initialization step and save ~0.2 seconds. However one intialization
needs to be done to get thin... |
the-stack_0_7119 | # -*- coding: utf-8 -*-
# Copyright (c) 2019 - 2021 Geode-solutions
#
# 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, co... |
the-stack_0_7121 | """
@author syt123450 / https://github.com/syt123450
"""
import os
import shutil
from tf.pb2json.pb2json_conversion import convert
import subprocess
input_format_config = '--input_format=tf_saved_model'
def preprocess_saved_model(input_path, output_path, output_node_names):
print("Preprocessing tensorflow saved... |
the-stack_0_7122 | import torch
from torch.utils.data import Dataset, DataLoader
import numpy as np
import yaml
from yaml import Loader
import os
from pathlib import Path
from pdb import set_trace as st
## Vocab code
class Vocab:
def __init__(self):
## set architecture vocab data structures
self.architecture_voc... |
the-stack_0_7123 | """
Mask R-CNN
The main Mask R-CNN model implemenetation.
Copyright (c) 2017 Matterport, Inc.
Licensed under the MIT License (see LICENSE for details)
Written by Waleed Abdulla
"""
import os
import sys
import glob
import random
import math
import datetime
import itertools
import json
import re
import logging
from col... |
the-stack_0_7124 | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import os
from pants.backend.jvm.targets.java_library import JavaLibrary
from pants.back... |
the-stack_0_7129 | #! coding:utf-8
"""
compiler tests.
These tests are among the very first that were written when SQLAlchemy
began in 2005. As a result the testing style here is very dense;
it's an ongoing job to break these into much smaller tests with correct pep8
styling and coherent test organization.
"""
from sqlalchemy.testin... |
the-stack_0_7130 | import math
import torch as th
from torch import nn
from torch.nn import functional as F
from . import torch_util as tu
from gym3.types import Real, TensorType
REAL = Real()
class Encoder(nn.Module):
"""
Takes in seq of observations and outputs sequence of codes
Encoders can be stateful, meaning that yo... |
the-stack_0_7131 | # Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
import os
from urlparse import urlparse
import subprocess
import threading
from git_checkout import local_git_parsers
from libs.gitiles.git_r... |
the-stack_0_7133 | from tornado.web import RequestHandler
from swampdragon.default_settings import SwampDragonSettings
from django.conf import settings as django_settings
from .same_origin import set_origin_cookie
def get_host():
host = django_settings.DRAGON_URL
if host.endswith('/'):
return host[:-1]
return host
... |
the-stack_0_7134 | import os
import ycm_core
from clang_helpers import PrepareClangFlags
# Set this to the absolute path to the folder (NOT the file!) containing the
# compile_commands.json file to use that instead of 'flags'. See here for
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
# Most projects will NOT n... |
the-stack_0_7135 | from itertools import count
import pytest
import numpy as np
import astropy.units as u
from astropy._erfa import DJM0
from astropy.time import Time, TimeFormat
from astropy.time.utils import day_frac
class SpecificException(ValueError):
pass
@pytest.fixture
def custom_format_name():
for i in count():
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.