filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_11382 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2017-2020 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: BSD-2-Clause
import unittest
import os
from tern.classes.image_layer import ImageLayer
from tern.classes.package import Package
from tern.classes.file_data import FileData
from tern.utils import rootfs
fro... |
the-stack_0_11383 | try:
from setuptools import setup, Extension
except ImportError:
from distutils.core import setup
from distutils.extension import Extension
import sys, platform
sys.path.append('python')
extra_compile_args = ['-DHAVE_KALLOC']
include_dirs = ["."]
if platform.machine() in ["aarch64", "arm64"]:
include_dirs.appen... |
the-stack_0_11384 | from fontTools.designspaceLib import DesignSpaceDocument
from fontTools.pens.pointPen import PointToSegmentPen
from fontTools.varLib.models import VariationModel, allEqual, normalizeLocation
from ufoLib2 import Font as UFont
from .objects import Component, Glyph, MathDict
from .utils import makeTransformVarCo, tuplifyL... |
the-stack_0_11387 | # coding: utf-8
#
# Copyright 2021 The Oppia 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 requi... |
the-stack_0_11389 | import argparse
import logging
import os
import platform
from yaml import safe_load
configdata = None
if platform.system() == "Windows":
APPDATA = os.environ["APPDATA"]
CONFIGFILE = os.path.join(APPDATA, "svtplay-dl", "svtplay-dl.yaml")
else:
CONFIGFILE = os.path.expanduser("~/.svtplay-dl.yaml")
class ... |
the-stack_0_11391 | from django.conf.urls import include, url
from resources import views
from resources.api import ResourceResource, ResourceSubmissionResource
resource_resource = ResourceResource()
resource_submission_resource = ResourceSubmissionResource()
urlpatterns = [
url(r'^api/', include(resource_resource.urls)),
url(r'... |
the-stack_0_11395 | #!/usr/bin/env python3
"""
Setup script that reads in the users.yml and courses.yml files in the ../data directory and then
creates the users and courses for the system. This is primarily used by Vagrant and Travis to
figure the environments easily, but it could be run pretty much anywhere, unless the courses
already e... |
the-stack_0_11396 | """
A binary search tree is a sorted binary tree that allows for log complexity* searching. Unlike binary search on an
array, inserting and deleting nodes only takes log time*
*Assuming the tree is relatively balanced such as an AVL tree or red-black tree. As an extreme example, the binary tree
below is essentially a ... |
the-stack_0_11397 | import warnings
warnings.filterwarnings('ignore')
# data processing
import pandas as pd
import numpy as np
# image processing
from PIL import Image
# tf and keras
import tensorflow as tf
import keras
from keras.models import Sequential, Model, load_model
from keras.layers import Input, concatenate, Conv2D, MaxPoolin... |
the-stack_0_11398 | import pymssql
from scrape_microcenter import ScrapeMicrocenter
from time import time
class MSSQL_Database:
def __init__(self, server, user, password, database, autocommit=True):
self._server = server
self._user = user
self._password = password
self._database = database
self... |
the-stack_0_11399 | import numpy as np
from src.strategize.game import Game
def prisoners_dilemma():
player_set = np.array(['Alice', 'Bob'])
action_set = np.array([['Cooperate', 'Defect'], ['Cooperate', 'Defect']])
utility_set = np.array([[[2, 2], [0, 3]], [[3, 0], [1, 1]]])
pd = Game(player_set, action_set, utility_set)
... |
the-stack_0_11402 | #!/usr/bin/python
'''
Copyright 2011 Daniel Arndt
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_11404 | import cv2
import numpy as np
def showImage():
filename="Images/lena.jpg"
img = cv2.imread(filename, cv2.IMREAD_GRAYSCALE)
cv2.imshow('image', img)
equ_img = cv2.equalizeHist(img)
cv2.imshow('equalized image', equ_img)
cv2.waitKey(0)
cv2.destroyAllWindows()
showImage() |
the-stack_0_11406 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
class FocalLoss(nn.Module):
def __init__(self, gamma=2, alpha=0.25, size_average=True):
super(FocalLoss, self).__init__()
self.gamma = gamma
self.alpha = alpha
if isinstance(alpha... |
the-stack_0_11407 | from django.conf import settings
from django.http import Http404
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.renderers import JSONRenderer
from rest_framework.views import APIView
from netbox.api.authentication import TokenAuthentication
fro... |
the-stack_0_11409 | import numpy as np
import pandas
output_data = []
train_csv = pandas.read_csv('data/train.csv', index_col=0)
test_csv = pandas.read_csv('data/test_2.csv', index_col=0)
train_X = train_csv.drop(train_csv.columns[range(146, 210)], axis=1).values
for i in range(62): # t=121 to 180, and D+1, D+2
if i == 60:
... |
the-stack_0_11410 | # -*- coding: utf-8 -*-
"""
numcolorpy.py
Created Saturday April 22 2017
@author: del
lanier4@illinois.edu
mradmstr514226508@gmail.com
import numcolorpy as ncp
"""
import time
import numpy as np
from PIL import Image as IP
from PIL import ImageColor as IC
import colorsys
def range_norm(Z, lo=0.0, hi=1.0):
""" ... |
the-stack_0_11411 | #!/usr/bin/env python2
# Copyright (c) 2014 The oaccoin Core developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
Exercise the wallet backup code. Ported from walletbackup.sh.
Test case is:
4 nodes. 1 2 and 3 send ... |
the-stack_0_11412 | #!/usr/bin/env python3
# Copyright (c) 2013-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Generate seeds.txt from Pieter's DNS seeder
#
NSEEDS=512
MAX_SEEDS_PER_ASN=2
MIN_BLOCKS = 337600
#... |
the-stack_0_11413 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: alexnet-dorefa.py
# Author: Yuxin Wu, Yuheng Zou ({wyx,zyh}@megvii.com)
import cv2
import tensorflow as tf
import argparse
import numpy as np
import os
import sys
from tensorpack import *
from tensorpack.tfutils.symbolic_functions import prediction_incorrect
from... |
the-stack_0_11414 | import csv
import os
import re
import subprocess
from threading import Thread
from enum import Enum
JAVACLASSES = {}
DEPENDENCIES = []
MATCHES = {}
## Support for multithreading with return value
class ThreadWithReturnValue(Thread):
def __init__(self, group=None, target=None, name=None,
args=(), ... |
the-stack_0_11417 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
the-stack_0_11419 | # patchbomb.py - sending Mercurial changesets as patch emails
#
# Copyright 2005-2009 Matt Mackall <mpm@selenic.com> and others
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
'''command to send changesets as (a series of) patch ... |
the-stack_0_11421 | import bpy
import math
import bmesh
bonesCount = 0
def write(filepath,
applyMods=False
):
bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.transform_apply(location = True, scale = True, rotation = True)
bpy.ops.object.select_all(action='DESELECT')
scene = bpy.context.scene
meshData = MeshData()
ani... |
the-stack_0_11422 | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="InstaPython",
version="1.1.1",
author="Micha Birklbauer",
author_email="micha.birklbauer@gmail.com",
description="A set of classes and functions to access Instagram.",
long_description... |
the-stack_0_11423 | import pytest
from dvc.cli import parse_args
from dvc.command.plot import CmdPlotDiff, CmdPlotShow
def test_metrics_diff(mocker):
cli_args = parse_args(
[
"plot",
"diff",
"--file",
"result.extension",
"-t",
"template",
"-... |
the-stack_0_11424 | import sqlalchemy as sa
from alembic import op
revision = "dddddddddddd"
down_revision = "cccccccccccc"
branch_labels = None
depends_on = None
def upgrade():
op.add_column("foo", sa.Column("bar_id", sa.Integer(), server_default="9"))
def downgrade():
op.drop_column("foo", "bar_id")
|
the-stack_0_11427 | #!/usr/bin/env python
# Copyright 2017-present WonderLabs, Inc. <support@wondertechlabs.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
... |
the-stack_0_11428 | from __future__ import (absolute_import, division, print_function)
# make plot of ozone concentration data on
# lambert conformal conic map projection, drawing coastlines, state and
# country boundaries, and parallels/meridians.
# the data is interpolated to the native projection grid.
from mpl_toolkits.basemap impor... |
the-stack_0_11431 | from django.urls import re_path
from .views import (
PostListView,
PostDetailView,
PostCreateView,
PostDeleteView,
PostUpdateView,
)
APP_NAME = 'posts'
urlpatterns = [
re_path(r'^list/$', PostListView.as_view(), name='list'),
re_path(r'^create/$', PostCreateView.as_view(), name='create'),
... |
the-stack_0_11437 | from typing import List, Dict
import spacy
from rb.core.lang import Lang
from rb.core.text_element import TextElement
from rb.core.text_element_type import TextElementType
from rb.core.word import Word
class Span(TextElement):
def __init__(self, lang: Lang, text: str, words: List[Word], index_in_container: in... |
the-stack_0_11438 | # *** Create a Channel Type Role with full permissions for Chat ***
# Code based on https://www.twilio.com/docs/chat/rest/roles
# Download Python 3 from https://www.python.org/downloads/
# Download the Twilio helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client
#from d... |
the-stack_0_11439 | """
控制结构练习:
1.选择结构:三角形面积周长
2.循环结构:判断素数、最大公约数和最小公倍数
"""
import math
class Triangle:
def __init__(self, a, b, c):
if a + b > c and a + c > b and b + c > a:
self.a = a
self.b = b
self.c = c
else:
print('不能构成三角形')
def perimeter(self):
... |
the-stack_0_11443 | import logging
from django.contrib import messages
from django.contrib.auth.decorators import user_passes_test
from django.urls import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import render, get_object_or_404
from dojo.filters import ProductTypeFilter
from dojo.forms import Product_Ty... |
the-stack_0_11444 | from typing import Any, Dict, List, Optional
import aiohttp
from chia.cmds.units import units
from chia.consensus.block_record import BlockRecord
from chia.rpc.farmer_rpc_client import FarmerRpcClient
from chia.rpc.full_node_rpc_client import FullNodeRpcClient
from chia.rpc.wallet_rpc_client import WalletRpcClient
fr... |
the-stack_0_11445 |
# Emma's change
# another change
# Fluffy Happiness: Test code to grab pictures of cute animals from
# the Internet
# Usage: >> python get_fluffy.py [options] V.A. Moss
# (vmoss.astro@gmail.com)
__author__ = "V.A. Moss"
__date__ = "$22-oct-2018 22:00:00$"
__version__ = "0.2"
# Imports
import os
import sys
import urll... |
the-stack_0_11446 | import torch
import torch.nn as nn
import torch.nn.functional as F
from autoencoder import Encoder, Decoder
class BasicBlock(torch.nn.Module):
def __init__(self, filters=64):
'residual basic block'
super().__init__()
self.residual = torch.nn.Sequential(
nn.Conv2d(filters, fil... |
the-stack_0_11448 | import datetime as dt
import cx_Oracle
from typing import List
from src.typeDefs.metricsDataRecord import IMetricsDataRecord
def getIexRtmBlockWiseData(appDbConnStr: str, col_attributes: str, startDt: dt.datetime, endDt: dt.datetime) -> List[IMetricsDataRecord]:
targetColumns = ['TRUNC(TIME_STAMP)', 'COL_A... |
the-stack_0_11449 | # -*- coding: utf-8 -*-
"""KPI views for creating and viewing the kpis."""
import logging
from typing import Any, Dict, List, Optional, Tuple
from flask.blueprints import Blueprint
from flask.globals import request
from flask.json import jsonify
from flask_sqlalchemy import Pagination
from sqlalchemy.orm.attributes im... |
the-stack_0_11451 | class Solution:
def findLeaves(self, root: TreeNode) -> List[List[int]]:
d = collections.defaultdict(list)
self.dfs(d, root)
res = []
for v in d.values():
res.append(v)
return res
def dfs(self, d, node):
if not node:
return 0
... |
the-stack_0_11452 | from math import atan2
from ..Qt import QtGui, QtCore
from ..Point import Point
from .. import functions as fn
from .GraphicsObject import GraphicsObject
from .UIGraphicsItem import UIGraphicsItem
from .TextItem import TextItem
from .ScatterPlotItem import Symbols, makeCrosshair
from .ViewBox import ViewBox
import stri... |
the-stack_0_11453 | from callsmusic.callsmusic import client as USER
from pyrogram import Client, filters
from pyrogram.types import Message, InlineKeyboardButton, InlineKeyboardMarkup
import config
from config import BOT_USERNAME
from pyrogram.errors import UserAlreadyParticipant
from helpers.decorators import errors, authorized_users_on... |
the-stack_0_11455 | from sqlalchemy import engine_from_config
from sqlalchemy.orm import sessionmaker
from sqlalchemy.orm import configure_mappers
import zope.sqlalchemy
# import or define all models here to ensure they are attached to the
# Base.metadata prior to any initialization routines
from .horse import Horse
from .race import Rac... |
the-stack_0_11456 | #!/bin/usr/python3
import logging
import os
import json
import uuid
import datetime
import urllib.request
from utils import getConfig
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
LOG_FILE = os.path.join(BASE_DIR, 'output.log')
logger = logging.getLogger('transatlanticTorrentExpress')
logger.setLevel(loggin... |
the-stack_0_11457 | # 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_11458 | # Copyright 2020 Intel 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 to in wri... |
the-stack_0_11459 | from PIL import Image, ImageFilter
import time
class MyGaussianBlur(ImageFilter.GaussianBlur):
name = "GaussianBlur"
def __init__(self, size,radius=2, bounds=None):
super().__init__()
self.radius = radius
self.bounds = bounds
self.size=size
# print(size)
def filte... |
the-stack_0_11460 | #aprimorando matriz em python
matriz = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
somapar = maior = somacoluna = 0
for l in range(0, 3):
for c in range(0, 3):
matriz[l][c] = int(input(f'Digite um valor para [{l}, {c}]: '))
print('-=' * 25)
for l in range(0, 3):
for c in range(0, 3):
print(f'[{matriz[l][c... |
the-stack_0_11461 | # -*- coding: utf-8 -*-
"""Train a CapsNet Network on the MNIST dataset.
See the corresponding paper for explanations of the network
@inproceedings{sabour2017dynamic,
title={Dynamic routing between capsules},
author={Sabour, Sara and Frosst, Nicholas and Hinton, Geoffrey E},
booktitle={Advances in Neural Informa... |
the-stack_0_11463 | # coding=utf-8
# Copyright 2013 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
# noqa: E241
from __future__ import print_function
fr... |
the-stack_0_11464 | #!/usr/bin/env python
# Run this test like so:
# vtkpython TestLinePlot.py -D $VTK_DATA_ROOT \
# -B $VTK_DATA_ROOT/Baseline/Charts/
import os
import vtk
import vtk.test.Testing
import math
class TestLinePlot(vtk.test.Testing.vtkTest):
def testLinePlot(self):
"Test if line plots can be built with python"... |
the-stack_0_11465 | from kashgari.corpus import ChineseDailyNerCorpus
from kashgari.embeddings import BERTEmbedding
import kashgari
from kashgari.tasks.labeling import BiLSTM_CRF_Model
"""
pip install tensorflow==1.15.3
pip install 'kashgari>=1.0.0,<2.0.0'
"""
"""
https://eliyar.biz/nlp_chinese_bert_ner/
"""
def main():
# train_x... |
the-stack_0_11469 | from core.himesis import Himesis
import uuid
class HMother2Woman(Himesis):
def __init__(self):
"""
Creates the himesis graph representing the DSLTrans rule Mother2Woman.
"""
# Flag this instance as compiled now
self.is_compiled = True
super(HMothe... |
the-stack_0_11470 | ##############################################################################
# Copyright (c) 2016 ZTE Corporation
# feng.xiaowei@zte.com.cn
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, ... |
the-stack_0_11472 | """
Robocopy backup script
In "execute_robocopy" replace the string "drive" with the actual drive letter.
Also, replace the path-placeholders with the actual paths.
Author: Fred Snyder
"""
# modules
import string
from glob import glob
from sys import argv
from sys import exit
from subprocess import call
# variable... |
the-stack_0_11473 | import math
import torch
import torch.fft
import torch.nn as nn
class AutoCorrelation(nn.Module):
"""AutoCorrelation Mechanism with the following two phases:
(1) period-based dependencies discovery (2) time delay aggregation This block can replace the self-attention family mechanism seamlessly.
"""
... |
the-stack_0_11474 | import datetime
from rich.padding import Padding
from rich.panel import Panel
from rich.text import Text
from rich.console import Group
from .config import console_print, console, key_at_index
def toggle_timer(log, labels) -> None:
label_name = key_at_index(labels, log.cur_index)
if log.active_label == False... |
the-stack_0_11476 | #Semáforo peatonal
#Ernesto Tolocka 2021
#www.profetolocka.com.ar/pytrainer
#Normalmente está en verde hasta que un peatón pulsa teclaVerde, entonces cambia a Amarillo y luego Rojo.
#Después de un tiempo en rojo, vuelve a la condición inicial
from PyTrainer import *
from time import sleep
#Comienza con ver... |
the-stack_0_11477 | from typing import Dict, List, Optional, Set
from chia.types.coin_record import CoinRecord
from chia.types.condition_with_args import ConditionWithArgs
from chia.util.clvm import int_from_bytes
from chia.util.condition_tools import ConditionOpcode
from chia.util.errors import Err
from chia.util.ints import uint32, uint... |
the-stack_0_11480 | """Elasticsearch document model for django-elasticsearch-dsl
"""
from elasticsearch_dsl import analyzer
from django_elasticsearch_dsl import Document, fields, Keyword
from django_elasticsearch_dsl.registries import registry
from .models import ChildPage
booksearch_analyzer = analyzer(
"booksearch_analyzer",
t... |
the-stack_0_11483 | #
# Copyright (c) 2021, 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 ... |
the-stack_0_11485 | """
Tests for relationship detection.
"""
from itertools import chain
from typing import List, Optional, Tuple
import geopandas as gpd
import numpy as np
import pandas as pd
import pytest
from matplotlib import pyplot as plt
from matplotlib.axes import Axes
from matplotlib.figure import Figure
from shapely.geometry im... |
the-stack_0_11486 | from __future__ import unicode_literals # at top of module
import datetime
import json
import arrow
import pytest
from cryptography import x509
from cryptography.hazmat.backends import default_backend
from marshmallow import ValidationError
from freezegun import freeze_time
from mock import patch
from lemur.certifi... |
the-stack_0_11487 | from setuptools import setup, find_packages
with open('README.md', 'r', encoding='utf-8') as f:
long_description = f.read()
setup(
name="getpalette",
version="1.0.7",
description="Get color palette from images",
long_description=long_description,
long_description_content_type="text/markdown",
... |
the-stack_0_11488 | from .illustration import plot_data_w_fluid, plot_mixing
from .activation import activation_fn_dispatcher
import json
import numpy as np
import sys
def do_measurements(ex, _config, _run, sim_info, pXs, pVs, acc, ms, fXs, fVs, plotting_this_iteration, save_all_data_this_iteration):
if acc is not None:
_run.... |
the-stack_0_11489 | import math
import torch
from torch.optim.optimizer import Optimizer
from torch.nn.utils import parameters_to_vector, vector_to_parameters
import torch.nn as nn
import torch.nn.functional as F
################################
## PyTorch Optimizer for VOGN ##
################################
required = object()
def u... |
the-stack_0_11493 | from typing import List
SELFID = "0" * 32
def maybe_and(sql, a):
if a:
return sql + " AND "
else:
return sql
def maybe_or(sql, a):
if a:
return sql + " OR "
else:
return sql
# TODO counts
def get_property_value(agent_memory, mem, prop):
# order of precedence:
... |
the-stack_0_11494 | # Time: O(n * k), n is the number of coins, k is the amount of money
# Space: O(k)
class Solution(object):
def coinChange(self, coins, amount):
"""
:type coins: List[int]
:type amount: int
:rtype: int
"""
INF = 0x7fffffff # Using float("inf") would be slower.
... |
the-stack_0_11497 | from django.core.management.base import BaseCommand
from django.core.cache import cache
from redis.exceptions import ResponseError
class Command(BaseCommand):
def handle(self, *args, **kwargs):
try:
cache.clear()
except ResponseError:
cache.clear()
self.stdout.write(... |
the-stack_0_11498 | import unittest
import six
from pynetbox.core.endpoint import Endpoint
if six.PY3:
from unittest.mock import patch, Mock
else:
from mock import patch, Mock
class EndPointTestCase(unittest.TestCase):
def test_filter(self):
with patch(
"pynetbox.core.query.Request.get", return_value=... |
the-stack_0_11499 | import sys
import re
import argparse
parser = argparse.ArgumentParser(description='Filter morpho-analyzed data from stdin.')
parser.add_argument('--max', type=int, default=500000, help="How many unique words to include. Default %(default)d.")
parser.add_argument('FILE', default='extension/dict-purelist/fi_FI', action=... |
the-stack_0_11500 | #!/usr/bin/env python
#------------------------------------------------------------------------------
# Copyright 2015 Esri
# 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.apac... |
the-stack_0_11502 | print('A frese é palíndromo?')
frase = str(input('Escreva uma frase sem pontuação e acentos: ')).strip().upper()
palavras = frase.split()
junto = ''.join(palavras)
inverso = ''
for letra in range(len(junto) - 1, -1, -1):
inverso += junto[letra]
print('O inverso de {} é {}'.format(junto, inverso))
if junto == inver... |
the-stack_0_11506 | # Copyright 2010 New Relic, 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 writ... |
the-stack_0_11508 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 The SymbiFlow Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier: ISC
""" Implements routines for converting FPGA in... |
the-stack_0_11511 | # ------------------------------------------------------------------------------
# Functions to save and restore different data types.
# ------------------------------------------------------------------------------
import os
# PICKLE
import pickle
def pkl_dump(obj, name, path='obj'):
r"""Saves an object in pickl... |
the-stack_0_11516 | import numpy as np
import pytest
from numpy.testing import assert_array_equal
from landlab import RasterModelGrid
from landlab.layers import EventLayers
def test_EventLayersMixIn():
grid = RasterModelGrid((4, 4))
assert hasattr(grid, "event_layers")
assert grid.event_layers.number_of_layers == 0
asse... |
the-stack_0_11518 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Convert references to JSON file."""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from __future__ import absolute_import
from __future__ import with_statement
import re
import os
import sys
import glob
im... |
the-stack_0_11521 | from setuptools import setup
import os
VERSION = "0.6"
def get_long_description():
with open(
os.path.join(os.path.dirname(os.path.abspath(__file__)), "README.md"),
encoding="utf8",
) as fp:
return fp.read()
setup(
name="airtable-export",
description="Export Airtable data to... |
the-stack_0_11523 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------------------------------------... |
the-stack_0_11524 | import warnings
from collections import defaultdict
import copy
from coffea.nanoevents.schemas.base import BaseSchema, zip_forms
from coffea.nanoevents.util import quote
class PHYSLITESchema(BaseSchema):
"""PHYSLITE schema builder - work in progress.
This is a schema for the `ATLAS DAOD_PHYSLITE derivation
... |
the-stack_0_11527 | from const import GAME_COUNT
from game import game, TACTIC_LIST, game_process
from itertools import combinations
if __name__ == "__main__":
t = TACTIC_LIST
s = {i:0 for i in t.keys()}
for i, j in combinations(t.keys(), r=2):
x, y = game_process(t[i], t[j], GAME_COUNT)
print(f'{i} vs {j}: +... |
the-stack_0_11528 | # -*- coding: utf-8 -*-
"""
Created on Tue Aug 1 15:07:20 2017
@author: spxrxs
"""
from __future__ import division
import matplotlib.pyplot as plt
import numpy as np
import astropy.io.fits as fits
import matplotlib.cm as cm
import os
import matplotlib.ticker as ticker
from astropy.wcs import WCS
import matplotlib.co... |
the-stack_0_11530 | # 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_11531 | import json
import re
from rasa_nlu.model import Interpreter
# Custom Components
class SemesterExtractor:
@staticmethod
def process(text):
words = text.split(" ")
ordinal_values = {"first": 1, "second": 2, "third": 3, "fourth": 4, "fifth": 5, "sixth": 6, "seventh": 7, "eigth": 8}
... |
the-stack_0_11532 | from test import support
import time
import unittest
import locale
import sysconfig
import sys
import platform
try:
import threading
except ImportError:
threading = None
# Max year is only limited by the size of C int.
SIZEOF_INT = sysconfig.get_config_var('SIZEOF_INT') or 4
TIME_MAXYEAR = (1 << 8 * SIZEOF_INT... |
the-stack_0_11533 | """
Low-level serial communication for Trinamic TMCM-140-42-SE controller
(used internally for the Thorlabs MFC1)
"""
import serial, struct, time, collections
try:
# this is nicer because it provides deadlock debugging information
from acq4.util.Mutex import RecursiveMutex as RLock
except ImportError:
fr... |
the-stack_0_11534 | # Python 3 - Verifica disponibilidade de sites
# verifica conexao com um teste que sempre esta online e armazena log em um arquivo de texto.
from urllib.request import Request, urlopen
from urllib.error import URLError
from datetime import datetime
import time
class Url(object):
def __init__(self, url, nome):
... |
the-stack_0_11536 | # coding=utf-8
from __future__ import print_function, unicode_literals
import numpy as np
import pandas as pd
import json
import requests
import argparse
data = pd.read_csv('/home/purvar/Downloads/location/t_sup_complaint.csv',
names=np.arange(27))
# text = data.iloc[:, 11]
NER_URL = 'http://api.bo... |
the-stack_0_11537 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... |
the-stack_0_11538 | # Copyright 2014: Mirantis Inc.
# 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 b... |
the-stack_0_11540 | from tests.unit.dataactcore.factories.staging import DetachedAwardFinancialAssistanceFactory
from dataactcore.models.domainModels import CountyCode
from tests.unit.dataactvalidator.utils import number_of_errors, query_columns
_FILE = 'fabs40_detached_award_financial_assistance_1'
def test_column_headers(database):
... |
the-stack_0_11541 | #!/bin/bash/env python
import argparse
import numpy as np
import math
from numpy.linalg import inv
from numpy import linalg as LA
from os.path import basename, expanduser, isfile, join, splitext
import socket
from matplotlib import pyplot as plt
import time
from skimage import measure
import rospy
from sensor_msgs.ms... |
the-stack_0_11542 | """This module contains the ``SeleniumMiddleware`` scrapy middleware"""
from importlib import import_module
from scrapy import signals
from scrapy.exceptions import NotConfigured
from scrapy.http import HtmlResponse
from selenium.webdriver.support.ui import WebDriverWait
from .http import SeleniumRequest
class Sel... |
the-stack_0_11544 | # Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import sys,argparse
from fnmatch import fnmatch
from openvino.tools.benchmark.utils.utils import show_available_devices
def str2bool(v):
if v.lower() in ('yes', 'true', 't', 'y', '1'):
return True
elif v.lower() in ('no... |
the-stack_0_11545 | """
This module provides fundamental solar physical constants.
"""
import io
from astropy.table import Table
from astropy.time import Time
from sunpy.sun import _constants as _con
__all__ = [
'get', 'find', 'print_all', 'spectral_classification', 'au', 'mass', 'equatorial_radius',
'volume', 'surface_area', '... |
the-stack_0_11546 | # 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_11547 | import unittest
from find_max_indices import find_max_indices
from drop_first import drop_first
class TestFindMaxIndices(unittest.TestCase):
def test_find_max_indices(self):
Ms = [[[1, 2, 3], [9, 8, 7, 6], [4, 5]]]
expecteds = [(1, (0, 9))]
for M, expected in zip(Ms, expecteds):
... |
the-stack_0_11548 | from filebeat import BaseTest
from beat.beat import INTEGRATION_TESTS
import os
import unittest
import glob
import subprocess
from elasticsearch import Elasticsearch
import json
import logging
class Test(BaseTest):
def init(self):
self.elasticsearch_url = self.get_elasticsearch_url()
print("Using... |
the-stack_0_11550 | from __future__ import annotations
import itertools
from typing import (
TYPE_CHECKING,
cast,
)
import numpy as np
import pandas._libs.reshape as libreshape
from pandas._libs.sparse import IntIndex
from pandas._typing import Dtype
from pandas.util._decorators import cache_readonly
from pandas.core.dtypes.ca... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.