filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_15519 | #!/usr/bin/python3.6
import sys, os, importlib
from .system import console, execute
from .util import glob_with_extensions, glob_folders_with_name_match
from .build_config import BuildConfig
from .build_target import BuildTarget
from .build_dependency import BuildDependency
from .dependency_chain import load_dependency... |
the-stack_0_15520 | while True:
n = input()
if n == "END": break
if n == "1":
print(1)
continue
ans = 1
p = len(n)
tmp = 0
while True:
if tmp == p:
break
tmp = p
p = len(str(p))
ans += 1
print(ans) |
the-stack_0_15522 | import numpy as np
import os.path
def subset_x_y(target, features, start_index:int, end_index:int):
"""Keep only the rows for X and y sets from the specified indexes
Parameters
----------
target : pd.DataFrame
Dataframe containing the target
features : pd.DataFrame
Dataframe contain... |
the-stack_0_15524 | # pylint: disable=missing-docstring,no-self-use,no-member,misplaced-comparison-constant,expression-not-assigned
import logging
from unittest.mock import patch, Mock
import pytest
from expecter import expect
import yorm
from yorm import common
from yorm.decorators import attr
from yorm.types import Dictionary, List
f... |
the-stack_0_15525 | '''
Created on 2015/12/29
:author: hubo
'''
from __future__ import print_function
from vlcp.utils.connector import async_processor, async_to_async, Connector,\
generator_to_async
from vlcp.event.event import withIndices, Event, M_
from vlcp.config import defaultconfig
from vlcp.server.module import Module, call_ap... |
the-stack_0_15526 | import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import os
import pickle
import pdb
def find_and_print_lowest_value(x,y, x_key, y_key):
idx = np.argmin(y)
x_min = x[idx]
y_min = y[idx]
print('The lowest value of %s is %.8f at %s %.2f' % (y_key, y... |
the-stack_0_15528 | """
Regularizer class for that also supports GPU code
Michael Chen mchen0405@berkeley.edu
David Ren david.ren@berkeley.edu
March 04, 2018
"""
import arrayfire as af
import numpy as np
from opticaltomography import settings
np_complex_datatype = settings.np_complex_datatype
np_float_datatype = settings.np_fl... |
the-stack_0_15529 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Element handle module."""
import copy
import logging
import math
import os.path
from typing import Any, Dict, List, Optional, TYPE_CHECKING
from pyppeteer.connection import CDPSession
from pyppeteer.execution_context import ExecutionContext, JSHandle
from pyppeteer.e... |
the-stack_0_15530 | from abc import ABC, abstractmethod
from collections import Counter
from functools import reduce
from re import split
from sys import version_info
import pandas as pd
from flashtext import KeywordProcessor
from scattertext.ScatterChart import check_topic_model_string_format
from scattertext.features.FeatsFromSpacyDoc... |
the-stack_0_15532 | # Copyright DataStax, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwa... |
the-stack_0_15533 | # Download images and labels related to the validation/test set in the dataset
import os
import cv2
import shutil
import argparse
from PIL import Image
parser = argparse.ArgumentParser()
parser.add_argument('--inp', type = str, help = 'Input path.')
parser.add_argument('--out', type = str, help = 'Output path.')
pars... |
the-stack_0_15535 |
import random
import sys
from datetime import datetime
import torch
import numpy as np
import os
import logging
import torch.utils.data as data
import json
def seed_all_rng(seed=None):
"""
Set the random seed for the RNG in torch, numpy and python.
Args:
seed (int): if None, will use a strong ran... |
the-stack_0_15536 | import setuptools
# Reads the content of your README.md into a variable to be used in the setup below
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name='jv_toolbox', # should match the package folder
packages=['jv_toolbox'... |
the-stack_0_15538 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2013-2015 clowwindy
#
# 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_15539 | # Copyright DataStax, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwa... |
the-stack_0_15540 | from builtins import range
import tensorflow as tf
import numpy as np
import math
import sys
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(BASE_DIR)
sys.path.append(os.path.join(BASE_DIR, "../utils"))
import tf_util
from structural_losses.tf_nndistance import nn_distance
from structur... |
the-stack_0_15544 | import os
import warnings
import numpy as np
import pytorch_lightning as pl
import toml
import torch
import torch.nn.functional as F
import wandb
from pytorch_lightning.callbacks import ModelCheckpoint
from torch import nn
from torch import optim
from torchvision import models
from torchvision.models._utils import Int... |
the-stack_0_15547 | ############################################################################## Setup
"""
1D Bayesian Optimization Test:
(1) Gemerate 1D objective.
(2) Initialize with data.
(3) Test predictions, variance estimation, and sampling.
(4) Run single iteration of each acquisition function.
"""
# Imports
import numpy as np
... |
the-stack_0_15548 | """I/O for UCSC Browser Extensible Data (BED)."""
from __future__ import absolute_import, division, print_function
from builtins import map, next
import shlex
import pandas as pd
from Bio.File import as_handle
from .util import report_bad_line
def read_bed(infile):
"""UCSC Browser Extensible Data (BED) format.... |
the-stack_0_15549 | from __future__ import absolute_import, division, print_function
from xfel.ui import settings_dir
from xfel.ui.db import db_proxy, get_run_path
import os, shutil
known_job_statuses = ["DONE", "ERR", "PEND", "RUN", "SUSP", "PSUSP", "SSUSP", "UNKWN", "EXIT", "DONE", "ZOMBI", "DELETED", "SUBMIT_FAIL", "SUBMITTED", "HOLD"... |
the-stack_0_15550 | """
Defines models
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Function
from torch.autograd import Variable
from torch.nn.utils.rnn import pack_padded_sequence
from torch.nn.utils.rnn import pad_packed_sequence
def init_weights(m):
if type(m) == nn.Linear or ... |
the-stack_0_15552 | import os
from pathlib import Path
from typing import Any, Dict, Union
from unittest.mock import Mock
import pytest
import torch
from pytorch_lightning import Trainer
from pytorch_lightning.accelerators import CPUAccelerator
from pytorch_lightning.plugins import SingleDevicePlugin
from pytorch_lightning.plugins.preci... |
the-stack_0_15554 | # Copyright (c) 2015 Huawei Technologies Co., Ltd.
# 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
#
# ... |
the-stack_0_15555 | """ Hyperparameters for Large Scale Data Collection (LSDC) """
import os.path
from visual_mpc.policy.cem_controllers.variants.ensemble_vidpred import CEM_Controller_Ensemble_Vidpred
from visual_mpc.agent.benchmarking_agent import BenchmarkAgent
from visual_mpc.envs.mujoco_env.cartgripper_env.autograsp_env import Autog... |
the-stack_0_15556 | import json, os
import math, copy, time
import numpy as np
from collections import defaultdict
import pandas as pd
from utils import *
import math
from tqdm import tqdm
import seaborn as sb
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import dill
from functools import partial
import multiprocessing as ... |
the-stack_0_15559 | #!/usr/bin/env python
import sys
import os
import platform
import subprocess
def check_for_executable(exe_name, args=['--version']):
try:
cmd = [exe_name]
cmd.extend(args)
subprocess.check_output(cmd)
return True
except Exception:
return False
def main():
import ar... |
the-stack_0_15560 | import os
import textwrap
import warnings
from xml.dom import minidom
from conans.client.tools import msvs_toolset
from conans.errors import ConanException
from conans.util.files import save, load
class MSBuildToolchain(object):
filename = "conantoolchain.props"
def __init__(self, conanfile):
self.... |
the-stack_0_15561 | from __future__ import division, absolute_import, print_function
import sys
from numpy.testing import (TestCase, run_module_suite, assert_,
assert_array_equal)
from numpy import random
from numpy.compat import long
import numpy as np
class TestRegression(TestCase):
def test_VonMises_r... |
the-stack_0_15562 | from __future__ import print_function
import ROOT,itertools,math #
from array import array #
from DataFormats.FWLite import Events, Handle
ROOT.FWLiteEnabler.enable()
#
tag='output'
##A class to keep BMTF data
###Common methods############
def fetchStubsOLD(event,ontime=False,isData=True):
... |
the-stack_0_15563 | #!/usr/bin/env python3
#
# Copyright (c) 2013-2019, Intel Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyrig... |
the-stack_0_15565 | #####################################################################
#
# Predictive Failure Analysis (PFA)
# Graph JES2 Resource Data for Jobs
#
#This python script is for use with data that is collected, created,
#and written by the PFA_JES2_RESOURCE_EXHAUSTION check only. Its
... |
the-stack_0_15568 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
.. currentmodule:: olmos.version
.. moduleauthor:: NarekA <my_email>
This module contains project version information.
"""
__version__ = '0.0.1' #: the working version
__release__ = '0.0.1' #: the release version
|
the-stack_0_15569 | from glfw import *
from OpenGL.GL import *
import numpy as np
from ctypes import *
from learnopengl import *
from PIL import Image
import glm
def resize(window, width, height):
glViewport(0, 0, width, height)
def main():
# Initialize the library
if not init():
return
# Create a windowed mode ... |
the-stack_0_15573 | # Inspired from OpenAI Baselines. This uses the same design of having an easily
# substitutable generic policy that can be trained. This allows to easily
# substitute in the I2A policy as opposed to the basic CNN one.
import os
os.environ["CUDA_VISIBLE_DEVICES"]="1"
import numpy as np
import tensorflow as tf
from comm... |
the-stack_0_15575 | """
Code to extract some key info from the zresults*fits file that gets produced
after running zspec on calibrated DEIMOS data
"""
import sys
from astropy.io import fits as pf
from astropy.table import Table
maskname = sys.argv[1]
hdu = pf.open(maskname)
tdat = hdu[1].data
nobj = len(tdat)
for i in range(nobj):
... |
the-stack_0_15576 | """
Test fiberassign target operations.
"""
import os
import subprocess
import re
import shutil
import unittest
from datetime import datetime
import json
import glob
import numpy as np
import fitsio
import desimodel
import fiberassign
from fiberassign.utils import option_list, GlobalTimers
from fiberassign.hardwa... |
the-stack_0_15577 | # -*- coding: utf-8 -*-
# MIT License
#
# Copyright 2018-2021 New York University Abu Dhabi
#
# 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 limitatio... |
the-stack_0_15579 | # Copyright (c) 2015 OpenStack Foundation.
# 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... |
the-stack_0_15580 | import argparse
import os
import random
import sys
import time
import struct
from collections import Counter
from collections import deque
from operator import itemgetter
from tempfile import NamedTemporaryFile as NTF
import SharedArray as sa
import numpy as np
from numba import jit
from text_embedding.documents import... |
the-stack_0_15581 | # Copyright (c) 2019-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import functools
import logging
import multiprocessing
import os
import signal
import sys
from multiprocessing import Event
from pathlib import Pat... |
the-stack_0_15582 | def compare(before, after):
def extract(f):
for i in open(f):
if i.startswith(' '):
yield i.strip()
bwords = set(extract(before))
awords = set(extract(after))
print(len(bwords), len(awords))
print('Removed:')
for w in sorted(awords - bwords):
print(... |
the-stack_0_15583 | from devito.ir.iet import IterationTree, FindSections, FindSymbols
from devito.symbolics import Keyword, Macro
from devito.tools import as_tuple, filter_ordered, split
from devito.types import Array, Global, LocalObject
__all__ = ['filter_iterations', 'retrieve_iteration_tree', 'derive_parameters',
'diff_pa... |
the-stack_0_15584 | # -*- coding: utf-8 -*-
# This program is free software; you can redistribute it and/or modify it under
# the terms of the (LGPL) GNU Lesser General Public License as published by the
# Free Software Foundation; either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed i... |
the-stack_0_15588 | from __future__ import absolute_import, print_function, unicode_literals
import datetime
import random
from django.db.models import Max, Min, Sum
from django.db.models.query import F
from kolibri.auth.filters import HierarchyRelationsFilter
from kolibri.auth.models import Classroom, Facility, FacilityUser
from kolibr... |
the-stack_0_15590 | #!/usr/bin/env python
# encoding: utf-8
# Sample-based Monte Carlo Denoising using a Kernel-Splatting Network
# Michaël Gharbi Tzu-Mao Li Miika Aittala Jaakko Lehtinen Frédo Durand
# Siggraph 2019
#
# Copyright (c) 2019 Michaël Gharbi
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use... |
the-stack_0_15592 | #!/usr/bin/env python3
# Copyright 2019 Stanford University
#
# 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 applicab... |
the-stack_0_15593 | # MIT License
#
# Copyright (c) 2018 Evgeny Medvedev, evge.medvedev@gmail.com
#
# 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
# ... |
the-stack_0_15595 | r"""Inspect MEG and EEG raw data, and interactively mark channels as bad.
example usage:
$ mne_bids inspect --subject_id=01 --task=experiment --session=test \
--datatype=meg --suffix=meg --bids_root=bids_root
"""
# Authors: Richard Höchenberger <richard.hoechenberger@gmail.com>
#
# License: BSD (3-clause)
from mne.u... |
the-stack_0_15597 | """This file and its contents are licensed under the Apache License 2.0. Please see the included NOTICE for copyright information and LICENSE for a copy of the license.
"""
import logging
import drf_yasg.openapi as openapi
from drf_yasg.utils import swagger_auto_schema
from rest_framework import generics, status
from ... |
the-stack_0_15598 | import csv
from decimal import Decimal
from io import BytesIO, StringIO
import os
from collections import OrderedDict
from tempfile import TemporaryDirectory
from unittest import skipIf
from zipfile import ZipFile
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.c... |
the-stack_0_15599 | # copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
the-stack_0_15601 | dsg = dict(
zip(
[ord(c) for c in "\x60\x61\x66\x67\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x7b\x7e"],
u"\u25c6\u2592\u25cb\u00b1\u2518\u2510\u250c\u2514\u253c\u2500\u2500\u2500\u2500\u2500\u251c\u2524\u2534\u252c\u2502\u03c0\xb7"
)
)
text = {
0: "reset",
24: "underl... |
the-stack_0_15602 | from __future__ import print_function
import os, shutil
"""
A little module to wrap the params enum for use in Cython code
Ian Bell, May 2014
"""
def params_constants(enum_key):
fName = os.path.join('..', '..', 'include', 'DataStructures.h')
contents = open(fName, 'r').read()
left = contents.find('{',... |
the-stack_0_15603 | # Copyright 2020 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_15604 | from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
import sys
import random
from mega import MutableNamedTuple
from line import *
from gl_skel import *
# TODO layers, lighting, rects blinks, symbols
def draw_line(line):
glLoadIdentity()
glTranslatef(0.1, 0.1, -2.0)
... |
the-stack_0_15605 | #!/usr/bin/env python
# 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 ... |
the-stack_0_15607 | # -*- coding: utf-8 -*-
"""
Created on Thu Oct 11 00:06:05 2018
__Kaggle DIGIT RECOGNATION BY XGBOOST___________
@author: MD SAIF UDDIN
"""
import pandas as pd
train = pd.read_csv("train.csv").as_matrix()
X = train[:, 1:]
Y = train[:, 0]
test = pd.read_csv("test.csv").as_matrix()
from xgboost import XG... |
the-stack_0_15608 | import os
import subprocess
from nmigen.build import *
from nmigen.vendor.lattice_ecp5 import *
from .resources import *
__all__ = ["VersaECP5Platform"]
class VersaECP5Platform(LatticeECP5Platform):
device = "LFE5UM-45F"
package = "BG381"
speed = "8"
default_clk = "clk100"
defaul... |
the-stack_0_15611 | # Copyright 2020 QuantumBlack Visual Analytics Limited
#
# 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 SOFTWARE IS PROVIDED "AS IS",... |
the-stack_0_15613 | from tkinter import*
import sqlite3
root = Tk()
root.title('Honeycomb Cakes Customer Information System!')
root.geometry('550x420')
root.iconbitmap(r"C:\Users\Oreoluwa Daramola\Documents\Data Science projects\cake.ico")
root.configure(bg='black')
#Create Data base
con = sqlite3.connect('Customer Informati... |
the-stack_0_15614 | from dateutil import rrule
from .regexes import ElementPart, element_kind_map, regex_list
from .util import ts_to_datetime
class CronValidator:
@classmethod
def parse(cls, expression):
"""
:param str expression:
:return:
"""
parts = expression.split(" ")
if le... |
the-stack_0_15616 | # -*- 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_15620 | # coding=utf-8
import time
import multiprocessing
import os
import sys
import signal
try:
from setproctitle import getproctitle, setproctitle
except ImportError:
setproctitle = None
from diamond.utils.signals import signal_to_exception
from diamond.utils.signals import SIGALRMException
from diamond.utils.sig... |
the-stack_0_15622 | #!/usr/bin/env python3
import sys, random
assert sys.version_info >= (3,7), "This script requires at least Python 3.7"
def choose_color(last_color):
colors = ['red','orange','yellow','green','blue','violet','purple']
c = random.choice(colors)
while c == last_color:
c = random.choice(colors)
re... |
the-stack_0_15624 | #!/usr/bin/env python
"""
Real-time rep counter for jumping jacks and squats.
Usage:
run_fitness_rep_counter.py [--camera_id=CAMERA_ID]
[--path_in=FILENAME]
[--path_out=FILENAME]
[--title=TITLE]
[--mod... |
the-stack_0_15625 | from bisect import bisect_left
def gcd(a, b):
while(b):
a %= b
a, b = b, a # Swap para tener el mas chico en b
return a
def divisors(n):
d = []
for i in range(1, int(n**0.5)+1):
if (n % i == 0):
d.append(i) if(i*i == n) else d.extend([i, n//i])
return list(so... |
the-stack_0_15627 | from __future__ import division, print_function
import apache_beam as beam
import apache_beam as beam
import sqlalchemy
from sqlalchemy.orm import sessionmaker
class ReadFromDBFn(beam.DoFn):
def __init__(self, url, query, query_params={}, *args, **kwargs):
super(ReadFromDBFn, self).__init__(*args, ... |
the-stack_0_15628 | class Solution:
def twoSum(self, nums: List[int], target: int) -> List[List[int]]:
complement = {}
out = []
for i,n in enumerate(nums):
complement[target-n] = i
for i,n in enumerate(nums):
idx = complement.get(n, None)
if idx != None and idx !... |
the-stack_0_15632 | # -*- coding: utf-8 -*-
'''
Run tests of notebooks using nbval -- called from testDocumentation
Created on May 24, 2017
@author: cuthbert
'''
import sys
import subprocess
# noinspection PyPackageRequirements
import pytest # @UnusedImport # pylint: disable=unused-import,import-error
# noinspection PyPackageRequireme... |
the-stack_0_15634 | import pytest
import pandas as pd
from pyam import IamDataFrame, compare
# when making any updates to this file,
# please also update the `data_table_formats` tutorial notebook!
def test_cast_from_value_col(test_df_year):
df_with_value_cols = pd.DataFrame(
[
["model_a", "scen_a", "World", "E... |
the-stack_0_15635 | # mypy: allow-untyped-defs
import sys
from mozlog.structured import structuredlog, commandline
from .. import wptcommandline
from .update import WPTUpdate
def remove_logging_args(args):
"""Take logging args out of the dictionary of command line arguments so
they are not passed in as kwargs to the update co... |
the-stack_0_15636 | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import sys
class Subread(MakefilePackage):
"""The Subread software package is a tool kit for pro... |
the-stack_0_15637 | # -*- coding: utf-8 -*-
# Copyright 2018-2019 Streamlit 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 applicabl... |
the-stack_0_15639 | import argparse
import os
import subprocess
import pandas as pd
# To get the trec_eval script you can follow this link: https://trec.nist.gov/trec_eval/
def run_to_csv_using_trec_eval(run_names, out_file_name,
trec_eval_location='./alter_library_code/anserini/eval/trec_eval.9.0.4/trec_... |
the-stack_0_15640 | #!/usr/bin/env python
# -- coding: utf-8 --
"""
Copyright (c) 2019. All rights reserved.
Created by C. L. Wang on 2020/2/18
"""
import os
import cv2
import torch
import torchvision.models as models
import torchvision.transforms as transforms
from PIL import Image
from core.img_core.model import IQAModel
from root_dir... |
the-stack_0_15641 | import common
import unittest
import os
import datetime
import subprocess
from pathlib import Path
unique_name = common.unique_name
def get_timestamp(y, m, d):
ts = datetime.datetime(y, m, d, 9, 0, 0)
return int(datetime.datetime.timestamp(ts))
class Test(common.TestBase):
def setUp(self):
... |
the-stack_0_15644 | #!/usr/bin/env python
import sys
import os
import math
# ensure that the kicad-footprint-generator directory is available
#sys.path.append(os.environ.get('KIFOOTPRINTGENERATOR')) # enable package import from parent directory
#sys.path.append("D:\hardware\KiCAD\kicad-footprint-generator") # enable package import fro... |
the-stack_0_15646 | import logging
import pendulum
from discord.ext import commands
import helpers.BOT_ERROR as BOT_ERROR
from helpers.SQLiteHelper import SQLiteHelper
import CONFIG
class SantaCountdownHelper():
def __init__(self, sqlitehelper: SQLiteHelper):
self.pend_format = "M/D/YY [@] h:m A Z"
self.cd_table_nam... |
the-stack_0_15648 | from __future__ import print_function
from tensorboardX import SummaryWriter
import torch
from torch.optim.lr_scheduler import ReduceLROnPlateau
from utils import evaluate, get_lr, load_checkpoint, save_checkpoint, test, train
from config import TrainConfig as C
from loader.MSVD import MSVD
from loader.MSRVTT import ... |
the-stack_0_15649 | # coding: utf-8
import pprint
import re
import six
class ListCertificatesRequest:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the ... |
the-stack_0_15651 | #! /usr/bin/python3
"""
This module contains implementation of the Observer pattern for State Machine
"""
import copy
import os
from abc import ABC, abstractmethod
from datetime import datetime, timedelta as td
from pathlib import Path
from shutil import copyfile
from time import sleep
from predictor.S... |
the-stack_0_15652 | # coding: utf-8
"""
Shutterstock API Reference
The Shutterstock API provides access to Shutterstock's library of media, as well as information about customers' accounts and the contributors that provide the media. # noqa: E501
OpenAPI spec version: 1.0.11
Generated by: https://github.com/swagge... |
the-stack_0_15653 | import gurobipy as gurobi
import numpy as np
from copy import deepcopy as copy
import matplotlib.pyplot as plt
# success !
# need test for multi-area-multi-time
# TODO: why the ub and lb doesn't apply to the voltage_square ????
# TODO: p2 always be zero, don't know why?
# first i change the generator cost
# second ... |
the-stack_0_15657 | from deepdab.ai import *
from deepdab import *
import tensorflow as tf
import numpy as np
class TDOneGradientPolicyCNNV2c(Policy):
"""
Adds padding to the initial convolutional layer, followed by max-pooling.
"""
def __init__(self, board_size):
self._sess = tf.Session()
self._board_siz... |
the-stack_0_15660 | import numpy as np
import find_best_threshold as fbt
def random_booster(X, y, T):
"""
The function ``random_booster`` uses random thresholds and indices to train a
classifier. It performs ``T`` rounds of boosted decision stumps to classify
the data ``X``, which is an m-by-n matrix of m training exam... |
the-stack_0_15661 | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="monk_gluon_cuda102", # Replace with your own username
version="0.0.1",
author="Tessellate Imaging",
author_email="abhishek@tessellateimaging.com",
description="Monk Classification Library ... |
the-stack_0_15664 | import json
from code import EmotionModeltrainer, EmotionClassifier
from code import get_emotion_trainingdata, get_testdata, get_models, write_classification_report
# PROMPT TRAINING SETTINGS FROM USER
modelnr = input('What is the model number? (type number)\n')
teid = True if input('Do you want to extent the MELD wi... |
the-stack_0_15666 | # coding: utf-8
import os
from setuptools import setup
with open(os.path.join(os.path.dirname(__file__), 'README.md')) 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-info_screen',
... |
the-stack_0_15667 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
### TODO
## a label can have multiple representative points (e.g., arrangement on a torus)
from __future__ import print_function
import numpy as np
import pandas as pd
import matplotlib as mpl
mpl.use('Agg')
import sys
import chainer
import chainer.functions as F
import c... |
the-stack_0_15671 | # -*- coding: utf-8 -*-
import logging
from discord.ext import commands
from handlers.calendar import Calendar, Event
from infra.manager import SecretManager
class EventMeBot(commands.Cog):
def __init__(self, bot_client):
self._bot = bot_client
self._subcommands = ['new']
self._cal_serv... |
the-stack_0_15672 | # 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_15673 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import print_function, unicode_literals
import frappe
no_cache = 1
def get_context(context):
if frappe.flags.in_migrate:
return
context.http_status_code = 500
try:
context["button_color"]=frap... |
the-stack_0_15677 | from typing import List
import databases
import sqlalchemy
from fastapi import FastAPI
from pydantic import BaseModel
# SQLAlchemy specific code, as with any other app
DATABASE_URL = "sqlite:///./test.db"
# DATABASE_URL = "postgresql://user:password@postgresserver/db"
database = databases.Database(DATABASE_URL)
met... |
the-stack_0_15679 | # 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_15680 | #from os import path
import tkinter as tk
from tkinter.filedialog import * # pour les gestions de fichiers
from PIL import Image as Img
from PIL import ImageTk
import lib.DataTool as DT
from tkinter import messagebox
def export_page(fileToExport):
"""
[Description]
Fonction permettant de générer la page ... |
the-stack_0_15682 | """Tests for instantiating new synchronized objects."""
# pylint: disable=unused-variable,singleton-comparison
from dataclasses import dataclass, field
from typing import Dict
from datafiles import Missing, datafile
from datafiles.utils import logbreak, write
from . import xfail_with_pep_563
@datafile("../tmp/sam... |
the-stack_0_15685 | #!/usr/bin/env python3
"""
Retrieve datasets from Eurostat.
Allow for updates without checking metadata.
@author: giuseppeperonato
"""
import json
import logging
import os
import sys
import pandas as pd
import pandasdmx as sdmx
import requests
import utilities
# Constants
logging.basicConfig(level=logging.INFO)
ISRA... |
the-stack_0_15687 | """Code for bucketing annotations by time frame and document."""
import collections
import datetime
from urllib.parse import urlparse
import newrelic.agent
from pyramid import i18n
from h import links, presenters
_ = i18n.TranslationStringFactory(__package__)
class DocumentBucket:
def __init__(self, document,... |
the-stack_0_15689 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""Bot to find all pages on the wiki with mixed latin and cyrilic alphabets."""
#
# (C) Pywikibot team, 2006-2014
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, print_function, unicode_literals
__version__ = '$Id: 1a58aab22d569f16... |
the-stack_0_15696 | #!/usr/bin/env python
import rospy
import numpy as np
import matplotlib.pyplot as plt
from sklearn.neighbors import NearestNeighbors # for KNN algorithm
from scipy.optimize import differential_evolution
import copy
import pandas as pd
from nav_msgs.msg import OccupancyGrid, MapMetaData
from tf.transformations import qu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.