filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_2 | # A sample recursive neural network for text classification
# @Time: 8/13/2020
# @Author: lnblanke
# @Email: fjh314.84@gmail.com
# @File: cnn.py
import numpy as np
import tensorflow as tf
from blocks import RNN, Dense
from model import Model
import os
path = os.path.join("glove.6B.100d.txt")
embedding_indices = {}
... |
the-stack_0_3 | # -*- 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_6 | import os
from setuptools import setup, find_packages
with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django_admin_monitoring... |
the-stack_0_7 | # Authors: Peter Prettenhofer <peter.prettenhofer@gmail.com> (main author)
# Mathieu Blondel (partial_fit support)
#
# License: BSD 3 clause
"""Classification and regression using Stochastic Gradient Descent (SGD)."""
import numpy as np
import warnings
from abc import ABCMeta, abstractmethod
from... |
the-stack_0_9 | from datetime import datetime, timedelta
import pytest
import pytz
from kaffepause.breaks.selectors import get_pending_break_invitations
from kaffepause.breaks.test.factories import BreakFactory, BreakInvitationFactory
pytestmark = pytest.mark.django_db
def test_get_break_invitations_awaiting_reply_returns_unanswe... |
the-stack_0_10 | import numpy as np
from scipy.sparse import diags
from scipy.sparse import kron
from scipy.sparse import eye
from .two_particles import TwoParticles
from ..util.constants import *
from .. import Eigenstates
class TwoFermions(TwoParticles):
def get_eigenstates(self, H, max_states, eigenvalues, eigenvectors):
... |
the-stack_0_13 | """
Copyright 2018 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
di... |
the-stack_0_14 | import base64
import logging
from urllib import urlencode
from dateutil.tz import tzutc
import httplib2
from sharpy.exceptions import AccessDenied
from sharpy.exceptions import BadRequest
from sharpy.exceptions import CheddarError
from sharpy.exceptions import CheddarFailure
from sharpy.exceptions import NaughtyGatewa... |
the-stack_0_15 | from fastbook import *
from fastai.vision.widgets import *
def create_dataloader(path):
print(" Creating dataloader.. ")
db = DataBlock(
blocks=(ImageBlock, CategoryBlock),
get_items=get_image_files,
splitter=RandomSplitter(valid_pct=0.2, seed=42),
get_y=parent_label,
... |
the-stack_0_17 | # Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
# Python
import copy
import json
import logging
import re
from collections import OrderedDict
from datetime import timedelta
# OAuth2
from oauthlib import oauth2
from oauthlib.common import generate_token
# Django
from django.conf import settings
from django.... |
the-stack_0_18 | # copyright (c) 2020 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_20 | import sqlite3
import json
import math
from sqlite3.dbapi2 import Error
from flask import Flask, request, Response, render_template
app = Flask(__name__)
def open_db():
db = sqlite3.connect('./transactions.db')
db.row_factory = sqlite3.Row
return db
@app.route('/', methods=['GET'])
def transactions():... |
the-stack_0_22 | """A collection of tasks."""
import logging
from ..const import AddonState
from ..coresys import CoreSysAttributes
from ..exceptions import (
AddonsError,
AudioError,
CliError,
CoreDNSError,
HomeAssistantError,
MulticastError,
ObserverError,
)
from ..host.const import HostFeature
from ..job... |
the-stack_0_23 | """Patch to fix MNIST download issue as described here:
- https://github.com/pytorch/ignite/issues/1737
- https://github.com/pytorch/vision/issues/3500
"""
import os
import subprocess as sp
import torch
from torchvision.datasets.mnist import MNIST, read_image_file, read_label_file
from torchvision.datasets.utils impo... |
the-stack_0_25 | # -*- coding: utf-8 -*-
# :Project: metapensiero.pj -- compatibility
# :Created: lun 30 mar 2020, 01:48:33
# :Author: Alberto Berti <alberto@metapensiero.it>
# :License: GNU General Public License version 3 or later
# :Copyright: © 2020 Alberto Berti
#
import ast
import sys
is_py36 = sys.version_info >= (3, ... |
the-stack_0_27 | # ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... |
the-stack_0_30 | from proteus import Context
from proteus import Comm
comm = Comm.get()
ctx = Context.get()
# simulation flags for error analysis
#
# simFlagsList is initialized in proteus.iproteus
#
simFlagsList[0]['errorQuantities']=['u']
simFlagsList[0]['errorTypes']= ['numericalSolution'] #compute error in soln and glob. mass bal
... |
the-stack_0_32 | from keras_applications import get_submodules_from_kwargs
def Conv2dBn(
filters,
kernel_size,
strides=(1, 1),
padding='valid',
data_format=None,
dilation_rate=(1, 1),
activation=None,
activation_dtype=None,
kernel_initializer='glorot_uniform',
... |
the-stack_0_33 | #!/usr/bin/env python3
import os
import random
import unittest
from math import exp, pi
import gpytorch
import torch
from gpytorch.distributions import MultivariateNormal
from gpytorch.kernels import RBFKernel, ScaleKernel
from gpytorch.likelihoods import GaussianLikelihood, FixedNoiseGaussianLikelihood
from gpytorch... |
the-stack_0_34 | """
Interfaces for serializing Django objects.
Usage::
from django.core import serializers
json = serializers.serialize("json", some_query_set)
objects = list(serializers.deserialize("json", json))
To add your own serializers, use the SERIALIZATION_MODULES setting::
SERIALIZATION_MODULES = {
... |
the-stack_0_35 | __copyright__ = "Copyright 2017, Georgia Institute of Technology"
__license__ = "MIT"
__version_info__ = ('0', '0', '1')
__version__ = '.'.join(__version_info__)
__maintainer__ = "Marat Dukhan"
__email__ = "maratek@gmail.com"
import logging
logger = logging.getLogger("confu")
logger.setLevel(logging.INFO)
console_han... |
the-stack_0_36 | import pytest
from commitizen import BaseCommitizen, defaults, factory
from commitizen.config import BaseConfig
from commitizen.exceptions import NoCommitizenFoundException
def test_factory():
config = BaseConfig()
config.settings.update({"name": defaults.name})
r = factory.commiter_factory(config)
a... |
the-stack_0_38 | import collections
import enum
from itertools import starmap, product
import six
from ibis.compat import suppress
import ibis.util as util
import ibis.common as com
import ibis.expr.types as ir
import ibis.expr.schema as sch
import ibis.expr.datatypes as dt
try:
from cytoolz import curry, compose, identity
exce... |
the-stack_0_39 | """
Test Convex Breaking
"""
import pytest
import secrets
from convex_api.account import Account
from convex_api.api import API
from convex_api.exceptions import ConvexAPIError
from convex_api.utils import (
add_0x_prefix,
to_address
)
def test_convex_recursion(convex, test_account):
chain_length... |
the-stack_0_40 | # Autores:
# Darlan de Castro Silva Filho
# Marcos Henrique Fernandes Marcone
from pandas import Series, DataFrame
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import plotly.graph_objs as go
import plotly.express as px
import dash
import dash_core_components as dcc
import dash_html_component... |
the-stack_0_43 | # -*- coding: utf-8 -*-
"""
werkzeug.testapp
~~~~~~~~~~~~~~~~
Provide a small test application that can be used to test a WSGI server
and check it for WSGI compliance.
:copyright: (c) 2013 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.... |
the-stack_0_44 | # -*- coding: utf-8 -*-
import pandas as pd
from .ecg_eventrelated import ecg_eventrelated
from .ecg_intervalrelated import ecg_intervalrelated
def ecg_analyze(data, sampling_rate=1000, method="auto"):
"""Performs ECG analysis on either epochs (event-related
analysis) or on longer periods of data such as res... |
the-stack_0_46 | # 47. Permutations II
class Solution:
def permuteUnique(self, nums: List[int]) -> List[List[int]]:
"""
Given a collection of numbers that might contain duplicates, return all possible unique permutations.
"""
permutations = set()
self.helper(nums, [], permutations)
r... |
the-stack_0_47 | import torch
import numpy as np
def train_perm_orth(train_loader, model, optimizer, scheduler, criterion, regularizer=None, rho=1E-4, delta=0.5,
nu=1E-2, eps=1E-3, tau=1E-2, lagrange_pen=1E-2, perm_flag=True, t_step=40):
if perm_flag:
tau_min = 1E-24
tau_max = 1E-1
c = ... |
the-stack_0_48 | """The test for the History Statistics sensor platform."""
# pylint: disable=protected-access
from datetime import timedelta
import unittest
from unittest.mock import patch
from homeassistant.const import STATE_UNKNOWN
from homeassistant.setup import setup_component
from homeassistant.components.sensor.history_stats i... |
the-stack_0_49 | """
This module implements some special functions that commonly appear in
combinatorial contexts (e.g. in power series); in particular,
sequences of rational numbers such as Bernoulli and Fibonacci numbers.
Factorials, binomial coefficients and related functions are located in
the separate 'factorials' module.
"""
fr... |
the-stack_0_52 | from __future__ import annotations
import ast
import functools
import sys
from typing import Iterable
from tokenize_rt import NON_CODING_TOKENS
from tokenize_rt import Offset
from tokenize_rt import Token
from pyupgrade._ast_helpers import ast_to_offset
from pyupgrade._ast_helpers import is_name_attr
from pyupgrade.... |
the-stack_0_53 | import argparse
import logging
import time
import sys
from twilio.rest import Client
import settings
import RPi.GPIO as GPIO
twilio = Client(settings.TWILIO_PUBLIC_KEY, settings.TWILIO_SECRET_KEY)
log = logging.getLogger(__name__)
class SaltLevelMonitor(object):
def __init__(self, force_report=False, unit=sett... |
the-stack_0_54 | from __future__ import absolute_import
from __future__ import unicode_literals
import time
import socket
import logging
from ._compat import bytes_types, string_types
from ._compat import struct_l
from .version import __version__
try:
import ssl
except ImportError:
ssl = None # pyflakes.ignore
try:
fro... |
the-stack_0_56 | import numpy as np
from openmdao.api import ExplicitComponent
from pycycle.constants import P_REF, R_UNIVERSAL_ENG, R_UNIVERSAL_SI, MIN_VALID_CONCENTRATION
class PropsCalcs(ExplicitComponent):
"""computes, S, H, Cp, Cv, gamma, given a converged equilibirum mixture"""
def initialize(self):
self.opti... |
the-stack_0_57 | import numpy as np
from PIL import Image
from tqdm import tqdm
import torch
from torch import nn, optim
from torch.autograd import Variable, grad
from torchvision import utils
from model import Generator, Discriminator
from datetime import datetime
import random
import copy
import os
import config
import utils
imp... |
the-stack_0_58 | #
# 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_59 | # -*- coding: utf-8 -*-
# Copyright (c) 2010-2017 Tuukka Turto
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy,... |
the-stack_0_61 | # pylint: disable=W0611
# coding: utf-8
'''
Window
======
Core class for creating the default Kivy window. Kivy supports only one window
per application: please don't try to create more than one.
'''
__all__ = ('Keyboard', 'WindowBase', 'Window')
from os.path import join, exists
from os import getcwd
from kivy.core... |
the-stack_0_62 | import pytest
from nmcli.data import Connection
from nmcli.dummy._connection import DummyConnectionControl
def test_call():
result_call = [Connection('a', 'b', 'ethernet', 'eth0')]
c = DummyConnectionControl(result_call)
assert c() == result_call
def test_call_when_raise_error():
c = DummyConnectio... |
the-stack_0_63 | # Copyright 2017 Workonline Communications (Pty) Ltd. All rights reserved.
#
# The contents of this file are 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/LIC... |
the-stack_0_64 | import numpy as np
import tensorflow as tf
from numbers import Number
import gym
import time
from spinup.algos.tf1.sac1 import core
from spinup.algos.tf1.sac1.core import get_vars
from spinup.utils.logx import EpochLogger
from gym.spaces import Box, Discrete
from spinup.utils.frame_stack import FrameStack
import os
cl... |
the-stack_0_66 | """1248. Count Number of Nice Subarrays
Medium"""
class Solution(object):
def numberOfSubarrays(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: int
"""
#########
m = [0]*50001
res = 0
curr = 0
m[0] = 1
for i in r... |
the-stack_0_68 | #!/usr/bin/env python
# coding=utf-8
"""
__created__ = '4/22/16'
__author__ = 'deling.ma'
"""
import multiprocessing
bind = '0.0.0.0:7777'
max_requests = 10000
keepalive = 5
proc_name = 'fitahol'
workers = multiprocessing.cpu_count() * 2 + 1
worker_class = 'gaiohttp'
loglevel = 'info'
errorlog = '-'
x_forwarded_f... |
the-stack_0_69 | import numpy as np
import tensorflow as tf
import tensorflow.compat.v1.keras as keras
import pickle
import os
from math import ceil
from utils import preprocess_flags, save_kernel, save_kernel_partial
from utils import load_data,load_model,load_model_json,load_kernel
from utils import data_folder,kernel_folder,arch_fo... |
the-stack_0_71 | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... |
the-stack_0_72 | # vim: set encoding=utf-8
# Copyright (c) 2016 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 require... |
the-stack_0_74 | #!/usr/bin/env python3
##############################################################################
# EVOLIFE http://evolife.telecom-paris.fr Jean-Louis Dessalles #
# Telecom Paris 2021 www.dessalles.fr #
# ----------------------------------------------------------... |
the-stack_0_76 | # 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_77 | import hashlib
import json
import logging
from pathlib import Path
from typing import List
import ckanapi
import pandas as pd
from airflow.models.baseoperator import BaseOperator
from airflow.utils.decorators import apply_defaults
class BackupDatastoreResourceOperator(BaseOperator):
"""
Reads datastore resou... |
the-stack_0_78 | import os
import torch
from utils.runs import Run
from utils.utils import print_message, save_checkpoint
from parameters import SAVED_CHECKPOINTS
def print_progress(scores):
positive_avg, negative_avg = round(scores[:, 0].mean().item(), 2), round(scores[:, 1].mean().item(), 2)
print("#>>> ", positive_avg, ... |
the-stack_0_80 | import os
import numpy as np
import tables
import os
from .normalize import normalize_data_storage, reslice_image_set
def create_data_file(out_file, n_channels, n_samples, n_truth_labels, image_shape):
""" Initializes the hdf5 file and gives pointers for its three arrays
"""
try:
os.makedirs(os.... |
the-stack_0_83 | import os
import time
from collections import defaultdict
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader
from torchvision.utils import save_image
from config import get_cfg
# models
from models.volume_rendering import VolumeRenderer
from models.anim_nerf impo... |
the-stack_0_84 | from mmdet.models.builder import DETECTORS
from .single_stage_text_detector import SingleStageTextDetector
from .text_detector_mixin import TextDetectorMixin
@DETECTORS.register_module()
class FCENet(TextDetectorMixin, SingleStageTextDetector):
"""The class for implementing FCENet text detector
FCENet(CVPR20... |
the-stack_0_87 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import string
PY2 = sys.version_info[0] == 2
PY3 = sys.version_info[0] == 3
if PY3:
string_types = str,
integer_types = int,
else:
string_types = basestring,
integer_types = (int, long)
SEP = "____"
KLS_NAME_CHARSET = set(string.ascii_letters ... |
the-stack_0_88 | from typing import List
import dash_html_components as html
from .. import WebvizPluginABC
class ExampleTour(WebvizPluginABC):
@property
def tour_steps(self) -> List[dict]:
return [
{"id": self.uuid("blue_text"), "content": "This is the first step"},
{"id": self.uuid("red_tex... |
the-stack_0_92 | #!/usr/bin/env python
try:
from setuptools import setup
requires = {
'install_requires': ['django >= 4.0'],
}
except ImportError:
from distutils.core import setup
requires = {}
from os.path import abspath, dirname, join
with open(join(dirname(abspath(__file__)), 'src', 'rfdoc', 'version.p... |
the-stack_0_94 | from pelican import signals
from pelican.generators import ArticlesGenerator, PagesGenerator
# Make sure than when a title breaks, there will never be
# a single word "alone" on its line
# Does not work if the last "word" of the title is an emoji
# in the form of an image (like Twemoji)
# Title has to be more than fo... |
the-stack_0_95 | from werkzeug.local import LocalStack, LocalProxy
def _find_bot():
from .wx import get_bot
top = _wx_ctx_stack.top
if top is None:
top = get_bot()
_wx_ctx_stack.push(top)
return top
_wx_ctx_stack = LocalStack()
current_bot = LocalProxy(_find_bot)
|
the-stack_0_96 | _base_ = 'faster_rcnn_r50_fpn_mstrain_3x_coco.py'
model = dict(
backbone=dict(
norm_cfg=dict(requires_grad=False),
norm_eval=True,
style='caffe',
init_cfg=dict(
type='Pretrained',
checkpoint='open-mmlab://detectron2/resnet50_caffe')))
# use caffe img_norm
img... |
the-stack_0_99 | #!/usr/bin/env python3
import os
os.environ['NOCRASH'] = '1'
import unittest
import matplotlib
matplotlib.use('svg')
from selfdrive.config import Conversions as CV
from selfdrive.car.honda.values import CruiseButtons as CB
from selfdrive.test.longitudinal_maneuvers.maneuver import Maneuver
from selfdrive.manager.proc... |
the-stack_0_101 | import numpy as np
from .._helpers import _writer_map, read, reader_map, write
def add_args(parser):
parser.add_argument("infile", type=str, help="mesh file to be read from")
parser.add_argument(
"--input-format",
"-i",
type=str,
choices=sorted(list(reader_map.keys())),
... |
the-stack_0_102 | from sklearn.datasets import load_boston
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import cross_val_predict, cross_val_score
import matplotlib.pyplot as plt
import pandas as pd
# load the data set we'll be working with. In this case the Boston housing
boston = load_boston()
boston... |
the-stack_0_103 | ###########################################################################
### Estimation of Slope along the boundary using the buffer distance ###
### Author : Lakshmi E ###
### Last Edit: 13-April-2020 ###
############... |
the-stack_0_104 | import leveldb
db = leveldb.LevelDB('./db')
# single put
db.Put(b'hello', b'hello world')
print(db.Get(b'hello').decode('utf-8'))
# multiple put/delete applied atomically, and committed to disk
batch = leveldb.WriteBatch()
batch.Put(b'hello', b'world')
batch.Put(b'hello again', b'world')
batch.Delete(b'hello')
db.W... |
the-stack_0_106 | from __future__ import absolute_import, unicode_literals
from datetime import date
from django.db import models
from modelcluster.contrib.taggit import ClusterTaggableManager
from modelcluster.fields import ParentalKey
from taggit.models import TaggedItemBase
from wagtail.utils.pagination import paginate
from wagtai... |
the-stack_0_109 | #!/usr/bin/env python
from os import path
import setuptools
def parse_requirements(filename):
""" load requirements from a pip requirements file """
lineiter = (line.strip() for line in open(filename))
return [line for line in lineiter if line and not line.startswith("#")]
from metaappscriptsdk import ... |
the-stack_0_110 | """
Module description:
"""
__version__ = '0.1'
__author__ = 'Vito Walter Anelli, Claudio Pomo'
__email__ = 'vitowalter.anelli@poliba.it, claudio.pomo@poliba.it'
import numpy as np
from ast import literal_eval as make_tuple
from tqdm import tqdm
from elliot.dataset.samplers import pointwise_pos_neg_sampler as pws
f... |
the-stack_0_112 | class BuySellStock:
# @param prices, a list of stock prices
# @return index of buy and sell price
def choiceStocks(self, prices):
n = len(prices)
if n == 0:
return None, None
if n == 1:
return 0, 0
maxPrice = prices[n - 1]
mpIndex = n - 1
maxProfit = 0
for price in range(n)... |
the-stack_0_114 | m = h = mu = 0
while True:
print(25*'-')
print(' CADASTRE UMA PESSOA')
print(25*'-')
i = int(input('Idade: '))
if i > 17:
m+=1
while True:
s = input('Sexo: [M/F] ').strip().upper()[0]
if s in 'MF':
break
print(25*'-')
if s == 'M':
h+=1
if... |
the-stack_0_115 | # -*- coding: utf-8 -*-
"""
MTD Parser to sqlAlchemy model.
Creates a Python file side by side with the original MTD file.
Can be overloaded with a custom class to enhance/change available
functions. See pineboolib/pnobjectsfactory.py
"""
from pineboolib import application, logging
from pineboolib.application import ... |
the-stack_0_116 | #!/usr/bin/python
# Tests if the SS segment override prefix is not explicitly produced when unnecessary
# Github issue: #9
# Author: Duncan (mrexodia)
from keystone import *
import regress
class TestX86(regress.RegressTest):
def runTest(self):
# Initialize Keystone engine
ks = Ks(KS_ARCH_X86, K... |
the-stack_0_117 | # Copyright (c) 2015-present, Facebook, Inc.
# All rights reserved.
"""
The main training/evaluation loop
Modified from: https://github.com/facebookresearch/deit
"""
import argparse
import datetime
import numpy as np
import time
import torch
import torch.backends.cudnn as cudnn
import json
import os
from pathlib impor... |
the-stack_0_118 | ###################################
# File Name : exception_performance.py
###################################
#!/usr/bin/python3
import os
import time
TRY_TEST_FILE="performance_try_file"
TRY_ELSE_TEST_FILE="performance_try_else_file"
def write_file_only_try():
try:
f = open(TRY_TEST_FILE, "w")
... |
the-stack_0_120 | #
# 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 us... |
the-stack_0_121 | # coding: utf-8
"""
EPIC API
REST API for interacting with EPIC (https://epic.zenotech.com) services. <br /> Please note this API is in BETA and does not yet contain all EPIC functionality. # noqa: E501
The version of the OpenAPI document: v2
C... |
the-stack_0_123 | """InVEST specific code utils."""
import codecs
import math
import os
import contextlib
import logging
import tempfile
import shutil
from datetime import datetime
import time
import pandas
import numpy
from shapely.wkt import loads
from osgeo import gdal
from osgeo import osr
import pygeoprocessing
LOGGER = logging.... |
the-stack_0_125 | # -*- coding: utf-8 -*-
# python std lib
import random
# rediscluster imports
from .crc import crc16
from .exceptions import RedisClusterException, RedisClusterConfigError
# 3rd party imports
from redis import Redis
from redis._compat import unicode, long, basestring
from redis.connection import Encoder
from redis i... |
the-stack_0_126 | # Copyright 2014 Facebook, Inc.
# You are hereby granted a non-exclusive, worldwide, royalty-free license to
# use, copy, modify, and distribute this software in source code or binary
# form for use in connection with the web services and APIs provided by
# Facebook.
# As with any software that integrates with the Fa... |
the-stack_0_129 | from unittest import mock
from django.conf import settings
from django.test import TestCase, override_settings
from daiquiri.jobs.tests.mixins import AsyncTestMixin
from daiquiri.query.models import QueryJob, Example
@override_settings(QUERY_ANONYMOUS=True)
@mock.patch(settings.ADAPTER_DATABASE + '.submit_query', m... |
the-stack_0_130 | import json
import traceback
from datetime import timedelta
from flask import request, g, current_app
from sqlalchemy import desc, func
from apps.auth.models.users import User
from apps.project.business.credit import CreditBusiness
from apps.project.models.assets import Phone, PhoneRecord, VirtualAsset, PhoneBorrow
f... |
the-stack_0_135 | from functools import reduce
from jinja2 import Markup
import json
import logging
import os
import shutil
from sigal import signals
from sigal.utils import url_from_path
from sigal.writer import AbstractWriter
logger = logging.getLogger(__name__)
ASSETS_PATH = os.path.normpath(
os.path.join(os.path.abspath(os.pa... |
the-stack_0_136 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 12 11:52:04 2021
@author: Sarah
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 7 11:30:49 2021
@author: Sarah
"""
import pandas as pd
import pandasql
import dash
from dash.dependencies import Input, Output
import dash_co... |
the-stack_0_137 | # -*- coding: utf-8 -*-
__version__ = '19.9.0.dev1'
PROJECT_NAME = "galaxy-data"
PROJECT_OWNER = PROJECT_USERAME = "galaxyproject"
PROJECT_URL = "https://github.com/galaxyproject/galaxy"
PROJECT_AUTHOR = 'Galaxy Project and Community'
PROJECT_DESCRIPTION = 'Galaxy Datatype Framework and Datatypes'
PROJECT_EMAIL = 'ga... |
the-stack_0_138 | from __future__ import unicode_literals
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Field, Layout, Submit
from django import forms
from django.contrib.auth import get_user_model
from . import models
User = get_user_model()
class UserForm(forms.ModelForm):
def __init__(self, *arg... |
the-stack_0_139 | # SPDX-FileCopyrightText: 2019 Scott Shawcroft for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
`adafruit_bitmap_font.bdf`
====================================================
Loads BDF format fonts.
* Author(s): Scott Shawcroft
Implementation Notes
--------------------
**Hardware:**
**Software and De... |
the-stack_0_142 | import torch
from torch import nn
from torch.nn import functional as F
class DetLoss(nn.Module):
def __init__(self):
super().__init__()
self.hm_criterion = nn.BCEWithLogitsLoss(reduction='none')
self.ori_criterion = nn.SmoothL1Loss(reduction='none')
self.box_criterion = nn.SmoothL1... |
the-stack_0_143 | from django.db.models.signals import pre_save
from django.dispatch import receiver
from order.models import Order
from order.tpaga import revertedPaid
@receiver(pre_save, sender=Order)
def changeReverted(sender, instance, **kwargs):
try:
old = sender.objects.get(id=instance.id)
status = old.status
... |
the-stack_0_144 | import bing_face_api as bfa
if __name__ == '__main__':
'''
コマンドライン引数を使用する場合
顔認識する画像のディレクトリ
search_dir = sys.argv[0]
'''
# 顔認識する画像のディレクトリ
search_dir = "./image/original/"
# 顔認識する画像のファイル名を取得
img_path_list = bfa.get_image_path_list(search_dir)
# 顔認識
bfa.detect_image(img_path_li... |
the-stack_0_148 | # -*- coding: utf-8 -*-
import asyncio
from datetime import datetime
from cmyui import log, Ansi
from cmyui.osu import Mods
from discord import Embed
from discord.ext import commands
from discord.threads import Thread
from tinydb.operations import set as dbset
from tinydb.queries import Query
from objec... |
the-stack_0_151 | from gpflow.kernels import Kernel
from gpflow.utilities import positive
from gpflow import Parameter
import tensorflow as tf
from tensorflow_probability import bijectors as tfb
class Batch_simple_SSK(Kernel):
"""
with hyperparameters:
1) match_decay float
decrease the contribution of long subsequenc... |
the-stack_0_154 | from os import getcwd
import sys
sys.path.append(getcwd() + '/..') # Add src/ dir to import path
import traceback
import logging
from os.path import join
from itertools import combinations
import networkx as nx
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
... |
the-stack_0_155 | import asyncio
import datetime
import logging
import json
import functools
import re
import csv
from io import StringIO, BytesIO
from pathlib import Path
from tabulate import tabulate
from typing import List, Literal, Optional, Union
import discord
from redbot.core import Config, checks, commands
from redbot.core.i18n... |
the-stack_0_157 | from api.api_error import APIError
from api.api_message import APIMessage
from api.json_connector import JSONConnector
from api.api_config import APIConfig
from api.ptp_connector import PTPConnector
class BotMethods:
@staticmethod
def start_bot(req):
"""
Starts a PTP Bot object.
:para... |
the-stack_0_158 | from fastapi import APIRouter, BackgroundTasks, Depends, File, UploadFile
from typing import List
from sqlalchemy.orm import Session
from api.utils.auth import get_db
from api.auth.auth import auth_check
from api.db.crud import templates as crud
from api.db.crud import settings as scrud
from api.db.schemas import te... |
the-stack_0_161 | # Copyright (c) 2020 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 app... |
the-stack_0_162 | # -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
from scrapy.item import Item, Field
class XiaobaiheItem(Item):
# define the fields for your item here like:
# name = scrapy.Field()
username = Field()
... |
the-stack_0_164 | """ Tests for the various cli programs """
from pyontutils.integration_test_helper import _TestCliBase, Folders
class TestCli(Folders, _TestCliBase):
commands = (
['googapis', '--help'],
['graphml-to-ttl', '--help'],
['necromancy', '--help'],
['ontload', '--help'],
['overl... |
the-stack_0_165 | #!/usr/bin/python
import math
import matplotlib.pyplot as plt
from graphtheory.structures.edges import Edge
from graphtheory.structures.graphs import Graph
from graphtheory.structures.factory import GraphFactory
from graphtheory.structures.points import Point
from graphtheory.forests.treeplot import TreePlot
from grap... |
the-stack_0_166 | import pandas as pd
import numpy as np
import joblib
import Levenshtein
import argparse
import ast
from scipy import stats
from src import nlp_preprocessing
def preprocess_txt(txt: str):
"""Executa preprocessamento textual padrão"""
cleaned_txt = nlp_preprocessing.clean_text(txt)
token_txt = nlp_preproces... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.