filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_3321 | from setuptools import find_packages
from setuptools import setup
package_name = 'ament_cppcheck'
setup(
name=package_name,
version='0.8.0',
packages=find_packages(exclude=['test']),
data_files=[
('share/' + package_name, ['package.xml']),
('share/ament_index/resource_index/packages',
... |
the-stack_0_3322 | #!/usr/bin/env python3
# Copyright (c) 2010 ArtForz -- public domain half-a-node
# Copyright (c) 2012 Jeff Garzik
# Copyright (c) 2010-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://www.opensource.org/licenses/mit-license.php .
#
# mininode... |
the-stack_0_3325 | from __future__ import unicode_literals
from django.test import TestCase
from .models import Article, Car, Driver, Reporter
class ManyToOneNullTests(TestCase):
def setUp(self):
# Create a Reporter.
self.r = Reporter(name='John Smith')
self.r.save()
# Create an Article.
se... |
the-stack_0_3326 | # Lint as: python2, python3
# Copyright 2019 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... |
the-stack_0_3329 | # -*- coding: utf-8 -*-#
'''
# Name: dnn_regression-keras
# Description:
# Author: super
# Date: 2020/6/2
'''
from HelperClass2.MnistImageDataReader import *
from keras.models import Sequential
from keras.layers import Dense
import matplotlib.pyplot as plt
import os
os.environ['KMP_DUPLICATE... |
the-stack_0_3332 | from theano import function, config, shared, tensor
import numpy
import time
vlen = 10 * 30 * 768 # 10 x #cores x # threads per core
iters = 1000
rng = numpy.random.RandomState(22)
x = shared(numpy.asarray(rng.rand(vlen), config.floatX))
f = function([], tensor.exp(x))
print(f.maker.fgraph.toposort())
t0 = time.time... |
the-stack_0_3334 | # flake8: noqa: E402
import time
from kube_hunter.conf import Config, set_config
set_config(Config())
from kube_hunter.core.events.event_handler import handler
from kube_hunter.core.events.types import K8sVersionDisclosure
from kube_hunter.modules.hunting.cves import (
K8sClusterCveHunter,
ServerApiVersionEn... |
the-stack_0_3340 | ### Simulate a large number of coin flips using Python ###
from random import randint
def coingame(numflips: int, gamenum: int):
flips = []
for _ in range(0, numflips):
flips.append(randint(0, 1))
heads = flips.count(0)
tails = flips.count(1)
# Printing the results and showing the distribu... |
the-stack_0_3341 | # 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, software
# distributed under t... |
the-stack_0_3344 | import mock
import csv
import furl
import pytz
import pytest
from datetime import datetime, timedelta
from nose import tools as nt
from django.test import RequestFactory
from django.http import Http404
from django.core.files.uploadedfile import SimpleUploadedFile
from django.utils import timezone
from django.core.urlr... |
the-stack_0_3345 | #!/usr/bin/env python
#
# Public Domain 2014-2016 MongoDB, Inc.
# Public Domain 2008-2014 WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compil... |
the-stack_0_3346 | """
pyEngine_problem
"""
# =============================================================================
# Imports
# =============================================================================
from .pyAero_problem import AeroProblem
class EngineProblem(AeroProblem):
"""
The EngineProblem class inherits fro... |
the-stack_0_3347 | import mock
import pytest
from ocflib.ucb.cas import verify_ticket
@pytest.yield_fixture
def mock_get():
with mock.patch('requests.get') as mock_get:
yield mock_get
GOOD_RESPONSE = """
<cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'>
<cas:authenticationSuccess>
<cas:... |
the-stack_0_3350 | import logging
from Request import *
from RandomUtil import *
# Extremely basic check to determine if a post is what we are looking for
def determineExchangeType(submission):
opFlair = submission.link_flair_text
opTitle = submission.title.lower()
opTitle = opTitle.split("[w]")[0]
# Check to ensur... |
the-stack_0_3351 | from models.network import Net
from learning.learning import create_learners, train_model, test_model, Trainer
from learning.testing import CorrelationMatrix, ResidualStatistics
from data.load_data import load_synth_spectra, split_data
import matplotlib.pyplot as plt
import numpy as np
import torch
from torch.autograd ... |
the-stack_0_3352 | import tkinter as tk
import tkinter.messagebox as msg
import os
import sqlite3
class Todo(tk.Tk):
def __init__(self, tasks=None):
super().__init__()
if not tasks:
self.tasks = []
else:
self.tasks = tasks
self.tasks_canvas = tk.Canvas(self)
self.tas... |
the-stack_0_3353 | import io
from notifypy.cli import entry
import os
import sys
from setuptools import Command, find_packages, setup
# import notifypy
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name="notify_py",
version="0.3.2",
author="Mustafa Mohamed",
author_email="ms7mohamed@gmail.... |
the-stack_0_3357 | #
# 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_3358 | # Copyright 2003-2008 by Leighton Pritchard. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
#
# Contact: Leighton Pritchard, Scottish Crop Research Institute,
# ... |
the-stack_0_3360 | # -*- coding: utf-8 -*-
"""
Setup
-----
Install troposphere in the current python environment.
"""
# ----------------------------------------------------------------------------
# Imports
# ----------------------------------------------------------------------------
# ---- Future
from __future__ import print_functio... |
the-stack_0_3362 | 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=0, alpha=None, size_average=True):
super(FocalLoss, self).__init__()
self.gamma = gamma
self.alpha = alpha
if isinstance(alpha,... |
the-stack_0_3364 | # Copyright 2019-2020 Xanadu Quantum Technologies 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... |
the-stack_0_3365 | from __future__ import absolute_import
try:
import holoviews as hv
except ImportError:
hv = None
import pytest
from bokeh.plotting import figure
from panel.layout import Row
from panel.links import Link
from panel.pane import Bokeh, HoloViews
from panel.widgets import FloatSlider, RangeSlider, ColorPicker, T... |
the-stack_0_3366 |
import uuid
from datetime import datetime
from flasgger import swag_from
from flask import Blueprint, jsonify, request
from cloudinary.uploader import upload
from src.models import Author, Book, UserProfile, db
from src.google import get_user_info
from src.constants.http_status_codes import HTTP_201_CREATED, HTTP_40... |
the-stack_0_3368 | import argparse
import optparse
import sys
import turtle
from turtle import *
import numpy as np
parser = optparse.OptionParser(description='paint')
parser.add_option('--name', type=str, default='circle',
help='file name')
parser.add_option('--start_length', type=int, default=0, help='number of forw... |
the-stack_0_3369 | # Copyright 1996-2021 Cyberbotics 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 in... |
the-stack_0_3371 | from swsscommon import swsscommon
import time
import json
import random
import time
from pprint import pprint
def create_entry(tbl, key, pairs):
fvs = swsscommon.FieldValuePairs(pairs)
tbl.set(key, fvs)
time.sleep(1)
def create_entry_tbl(db, table, separator, key, pairs):
tbl = swsscommon.Table(db, ... |
the-stack_0_3373 | def get_parent_index(h, idx):
## calculate the maximum index first
## if the input is too large, return a negative 1
max_idx = 2**h - 1
if max_idx < idx:
return -1
# otherwise, carry on
else:
node_offset = 0
continue_flag = True
subtree_size = max_idx
... |
the-stack_0_3375 | from sklearn.model_selection import train_test_split
from sklearn.utils import shuffle
import pandas as pd
import os
import argparse
def create_folder(parent_path, folder):
if not parent_path.endswith('/'):
parent_path += '/'
folder_path = parent_path + folder
if not os.path.exists(folder_path):
... |
the-stack_0_3376 | """
Support for HomematicIP sensors.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/sensor.homematicip_cloud/
"""
import logging
from homeassistant.core import callback
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.dispatc... |
the-stack_0_3378 | from devito.ir.clusters.queue import QueueStateful
from devito.ir.support import (SEQUENTIAL, PARALLEL, PARALLEL_INDEP, PARALLEL_IF_ATOMIC,
AFFINE, ROUNDABLE, TILABLE, Forward)
from devito.tools import as_tuple, flatten, timed_pass
__all__ = ['analyze']
@timed_pass()
def analyze(cluste... |
the-stack_0_3380 | """
Functions connecting the whole process. 'visual_from_signal' should be run if signal visualization of certain signal is requested.
'visual_from_data' should be run if signal visualization of any point on Earth is requested.
Miha Lotric, April 2020
"""
import io
from signal_visualizer import getters as gt
def v... |
the-stack_0_3383 | from srcs.interpretator.interpretator_callback import InterpretatorCallback
from srcs.interpretator.context import Context
class Interpretator:
def __init__(self, runner, meta=None):
self.runner = runner
self.meta = meta
self.callbacks = []
self.context = Context()
self.curr... |
the-stack_0_3384 | from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from structlog import get_logger
from covidfaq import config, routers
# from covidfaq.evaluating.model.bert_plus_ood import BertPlusOODEn, BertPlusOODFr
# from covidfaq.scrape.scrape import (
# load_latest_source_data,
# download_O... |
the-stack_0_3386 | from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = "E07000086"
addresses_name = "parl.2019-12-12/Version 1/Parliamentary Election - Democracy_Club__12December2019east.tsv"
stations_name = "parl.2019-12-12/Versi... |
the-stack_0_3387 | # Author: Zheng Hao Tan
# Email: tanzhao@umich.edu
import sys
import SMS
if len(sys.argv) != 6:
sys.exit('Invalid arguments. Please rerun the script')
accountSID = sys.argv[1]
authToken = sys.argv[2]
from_ = sys.argv[3]
to = sys.argv[4]
smsBody = sys.argv[5]
print('Setting up phone numbers and logging in...')
sms... |
the-stack_0_3389 | from django.conf.urls import url, include
from django.contrib import admin
from . import views
from django.conf import settings
from django.conf.urls.static import static
from login.views import *
app_name='home'
urlpatterns = [
#Home
url(r'^$', index, name='index'),
#semantic
url(r'^varta/', video_chat_view,... |
the-stack_0_3390 | # coding=utf-8
# Copyright 2021 The TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
the-stack_0_3392 | ## \file Projectile.py
# \author Samuel J. Crawford, Brooks MacLachlan, and W. Spencer Smith
# \brief Contains the entire Projectile program
import math
import sys
## \brief Calculates flight duration: the time when the projectile lands (s)
# \param v_launch launch speed: the initial speed of the projectile when launc... |
the-stack_0_3393 | #!/usr/bin/env python3
# Copyright (c) 2014-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test longpolling with getblocktemplate."""
from decimal import Decimal
from test_framework.test_frame... |
the-stack_0_3394 | '''
实验名称:大气压强传感器BMP280
版本:v1.0
日期:2020.5
作者:01Studio(www.01studio.org)
'''
#导入相关模块
import time,board,busio
from analogio import AnalogIn
import adafruit_ssd1306,adafruit_hcsr04
#构建I2C对象
i2c = busio.I2C(board.SCK, board.MOSI)
#构建oled对象,01Studio配套的OLED地址为0x3C
display = adafruit_ssd1306.SSD1306_I2C(128, 64, i2c, addr=0... |
the-stack_0_3398 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 7 10:13:43 2018
@author: Stamatis Lefkimmiatis
@email : s.lefkimmatis@skoltech.ru
"""
import argparse
import os.path
import torch as th
from pydl.networks.ResDNet.net import ResDNet_denoise
from pydl.utils import psnr
from pydl.datasets.BSDS import... |
the-stack_0_3399 | # --------------------------------------------------------------------------------------------
# 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_3400 | # -*- coding: UTF-8 -*-
import os
from setuptools import setup
from typing import List
def _get_relative_path(file_path: str) -> str:
return os.path.join(os.path.dirname(__file__), file_path)
def load_requirements() -> List[str]:
# Load requirements
requirements = [] # type: List[str]
with open(_g... |
the-stack_0_3403 | """
/*********************************************************************************/
* The MIT License (MIT) *
* *
* Copyright (c) 2014 EOX IT Services GmbH ... |
the-stack_0_3404 | # -*- coding: utf-8 -*-
import random
import gym
import numpy as np
from collections import deque
from keras.models import Sequential
from keras.layers import Dense
from keras.optimizers import adam_v2
EPISODES = 1000
class DQNAgent:
def __init__(self, state_size, action_size):
self.state_size = state_siz... |
the-stack_0_3407 | import logging
import time
import traceback
from pathlib import Path
from secrets import token_bytes
from typing import Any, Dict, List, Optional, Tuple
from blspy import AugSchemeMPL
from dogechia.types.blockchain_format.coin import Coin
from dogechia.types.blockchain_format.program import Program
from dogechia.type... |
the-stack_0_3408 | def buddy(start, limit):
for i in range(start, limit):
res=prime(i)
if res>i:
res2=prime(res-1)
if (res2-i)==1:
return [i,res-1]
return "Nothing"
def prime(n):
total=1
for i in range(2, int(n**0.5)+1):
if n%i==0:
total+=(i)
... |
the-stack_0_3409 | from typing import Any
import torch
from torch import fx
class NodeProfiler(fx.Interpreter):
"""
This is basically a variant of shape prop in
https://github.com/pytorch/pytorch/blob/74849d9188de30d93f7c523d4eeceeef044147a9/torch/fx/passes/shape_prop.py#L65.
Instead of propagating just the shape, we r... |
the-stack_0_3412 | import unicodedata
from .add_whitespace_around_character import AddWhitespaceAroundCharacter
class AddWhitespaceAroundPunctuation(AddWhitespaceAroundCharacter):
"""
Recognize punctuation characters and add whitespace around each punctuation character
E.g.
>>> from uttut.pipeline.ops.add_whitespace_... |
the-stack_0_3413 | """
Unit tests for Unified/Monitor.py module
Author: Valentin Kuznetsov <vkuznet [AT] gmail [DOT] com>
"""
from __future__ import division, print_function
import time
# system modules
import unittest
from copy import deepcopy
# WMCore modules
from WMCore.MicroService.Unified.MSMonitor import MSMonitor
from WMQuality... |
the-stack_0_3415 | # Copyright 2012-2017 The Meson development team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agree... |
the-stack_0_3416 | from django.apps.registry import Apps
from django.db import DatabaseError, models
from django.utils.functional import classproperty
from django.utils.timezone import now
from .exceptions import MigrationSchemaMissing
class MigrationRecorder:
"""
Deal with storing migration records in the database.
Becau... |
the-stack_0_3417 | from __future__ import absolute_import, division, print_function
from cfn_model.model.ModelElement import ModelElement
class EC2NetworkInterface(ModelElement):
"""
Ec2 network interface model lement
"""
def __init__(self, cfn_model):
"""
Initialize
:param cfn_model:
""... |
the-stack_0_3420 | # Copyright 2018 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
the-stack_0_3422 | import cv2
import mediapipe as mp
import numpy as np
import pyautogui
from google.protobuf.json_format import MessageToDict
from datetime import datetime
import os
from os import path
import time
from tkinter import *
from tkinter import filedialog
from PIL import Image
from PIL import ImageTk
import imutils
import sys... |
the-stack_0_3424 | import numpy as np
from bpn import new, trf
from bpn.utils import get
from numpy.linalg.linalg import inv
def demo():
"""camera, object = demo()"""
d = Dancer()
d.translate((2, 1, 0))
d.turn(30)
d.turn_head(45)
return d
class Dancer:
def __init__(self):
# create dancer
body... |
the-stack_0_3425 | """
Bayesian Network class
"""
import pandas as pd
from .conditional_probability_table import ConditionalProbabilityTable as CPT
from .directed_acyclic_graph import DirectedAcyclicGraph
from .markov_network import MarkovNetwork
from .factor import Factor
from .null_graphviz_dag import NullGraphvizDag
class BayesianN... |
the-stack_0_3428 | import operator
import uuid
from functools import reduce
import arrow
import django_filters
from arrow.parser import ParserError
from django.conf import settings
from guardian.core import ObjectPermissionChecker
from django.contrib.auth import get_user_model
from django.utils.translation import ugettext_lazy as _
from... |
the-stack_0_3429 | #!/usr/bin/env python
from pyscf import gto, scf, dft
from pyscf.prop import hfc
mol = gto.M(atom='''
C 0 0 0
N 0 0 1.1747
''',
basis='ccpvdz', spin=1, charge=0, verbose=3)
mf = scf.UHF(mol).run()
gobj = hfc.uhf.HFC(mf).set(verbose=4)
gobj.sso = True
gobj.soo = True
gobj... |
the-stack_0_3431 | from orbit_fits import *
def ref_frame():
"""Print properties of the reference frame"""
print(gc_frame)
def potentials():
"""Print properties of the gravitational potentials used"""
pot = [ham, ham_bovy, ham_heavy]
name = ['fiducial', 'bovy', 'heavy']
#pos = np.array([[0, 0, 25],... |
the-stack_0_3433 | # -*- coding: utf-8 -*-
# Copyright (c) St. Anne's University Hospital in Brno. International Clinical
# Research Center, Biomedical Engineering. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# Std imports
# Third pary imports
import numpy as np
# Local imports
from ... |
the-stack_0_3434 | #!/usr/bin/env python3
"""
Tests of ktrain text classification flows
"""
import testenv
import numpy as np
from unittest import TestCase, main, skip
import ktrain
from ktrain.imports import ACC_NAME, VAL_ACC_NAME
from ktrain import utils as U
Sequential = ktrain.imports.keras.models.Sequential
Dense = ktrain.imports.... |
the-stack_0_3435 | #!/usr/bin/env python3
import pytest
import sys
import fileinput
from os.path import splitext, abspath
F_NAME = splitext(abspath(__file__))[0][:-1]
def answer(lines):
tot = 0
for line in map(str.strip, lines):
print(line)
l, w, h = map(int, line.split('x'))
sides = []
sides.appe... |
the-stack_0_3437 | #!/usr/bin/env python
import rospy
import math
from geometry_msgs.msg import Twist
from sensor_msgs.msg import LaserScan
from std_msgs.msg import Float32
from kobuki_msgs.msg import BumperEvent
from kobuki_msgs.msg import CliffEvent
import sys, select, termios, tty
range_center = Float32()
range_left = Float32()
r... |
the-stack_0_3438 | import numpy as np
import pandas as pd
import os
import sqlalchemy
from time import sleep
import pickle
from numbers import Number
def serialize(x):
if not isinstance(x, (str, Number)):
return pickle.dumps(x)
else:
return x
def unserialize(x):
if not isinstance(x, (str, Number)):
... |
the-stack_0_3440 | import socket
host = '127.0.0.1'
port = 80
client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
client.sendto(b'AAABBBCCC', (host, port))
data, addr = client.recvfrom(4096)
print(data)
|
the-stack_0_3441 | #!/usr/bin/env python3
import operator
from collections import Counter
def read_pt_br_words(filename='/usr/share/dict/brazilian'):
with open(filename) as f:
lines = list(f)
words = [line[:-1] for line in lines]
print(f"Leu {len(words)} palavras em pt-BR")
return words
def make_sbk_table(words... |
the-stack_0_3442 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from setuptools import setup
name_ = 'lindh-jsonobject'
github_name = 'jsonobject'
version_ = '1.4.0'
packages_ = [
'lindh.jsonobject',
]
with open("README.rst", "r") as fh:
long_description = fh.read()
classifiers = [
"Programming Language :: Python :: 3"... |
the-stack_0_3443 | import pandas as pd
def get_density(s, T):
try:
s = s.replace('%20', '+')
except:
pass
density_url = 'http://ddbonline.ddbst.de/DIPPR105DensityCalculation/DIPPR105CalculationCGI.exe?component=' + s
if s == 'Hexane':
rho = float(655)
else:
density = pd.read_html(dens... |
the-stack_0_3444 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import logging
from typing import Optional, Sequence
from hydra.core.utils import JobReturn
from hydra.plugins.launcher import Launcher
from hydra.types import HydraContext, TaskFunction
from omegaconf import DictConfig
from hydra_plugins.hydra_ra... |
the-stack_0_3447 | # -*- coding: utf-8 -*-
import logging
import operator
from pymongo.errors import DuplicateKeyError, BulkWriteError
import pymongo
from anytree import RenderTree, Node, search, resolver
from anytree.exporter import DictExporter
from scout.exceptions import IntegrityError
LOG = logging.getLogger(__name__)
class HpoH... |
the-stack_0_3448 | from __future__ import unicode_literals, absolute_import
import io
import os
import re
import abc
import csv
import sys
import zipp
import operator
import functools
import itertools
import collections
from ._compat import (
install,
NullFinder,
ConfigParser,
suppress,
map,
FileNotFoundError,
... |
the-stack_0_3450 | import os
import torch
import torch.nn as nn
import torchvision.models
import collections
import math
def weights_init(modules, type='xavier'):
m = modules
if isinstance(m, nn.Conv2d):
if type == 'xavier':
torch.nn.init.xavier_normal_(m.weight)
elif type == 'kaiming': # msra
... |
the-stack_0_3451 | #!/usr/bin/env python
from os import listdir
from os.path import isfile, join
import pickle
import os
from loguru import logger
def diff(l1, l2):
return list(set(l2) - set(l1))
logger.info("Running")
WORK_DIR = os.environ['WORK_DIR']
cur_files = [f for f in listdir(WORK_DIR) if isfile(join(WORK_DIR, f))]
try:
... |
the-stack_0_3452 | """
Copyright (c) 2013, SMART Technologies ULC
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 copyright notice,
this list of conditions an... |
the-stack_0_3454 | """
Robust Principal Component Analysis
"""
import numpy as np
from numpy.linalg import norm
from numpy.linalg import svd
def rpca_alm(M, mu=None, l=None, mu_tol=1E7, tol=1E-7, max_iter=1000):
"""Matrix recovery/decomposition using Robust Principal Component Analysis
Decompose a rectengular matrix M into a... |
the-stack_0_3455 | #PART 1 - CORPUS
import random
import time
import csv
from collections import Counter
t1=time.time()
print("Warning: This program is long, and takes some time to execute, because of the big file sizes.")
print("It took around 30s on an i7 7700HQ laptop with 16 GB of RAM. Performance might vary.")
def combine_li... |
the-stack_0_3457 | """
Agent namespaced tasks
"""
from __future__ import print_function
import glob
import os
import shutil
import sys
import platform
from distutils.dir_util import copy_tree
import invoke
from invoke import task
from invoke.exceptions import Exit
from .utils import bin_name, get_build_flags, get_version_numeric_only, ... |
the-stack_0_3458 | import pymysql
from .function import create_insert_sql_values, create_update_sql, create_insert_sql_column
from . import SQLConfig
class MySqldb(object):
def __init__(self):
self.SQLConfig = SQLConfig
# self.db = pymysql.connect(SQLConfig.SQL_ADDRESS,SQLConfig.SQL_USERNAME,\
# SQLConfi... |
the-stack_0_3459 | from oracles.abstract_oracle import *
from json import loads
import requests
class WebStatusBinaryOracle(AbstractOracle):
name = 'web_status_boolean_oracle'
description = 'Creates a binary oracle based on HTTP status code'
arguments = [OracleArgumentDescription('url','Base URL', True),
O... |
the-stack_0_3460 | # Copyright 2021 Karan Sharma - ks920@cam.ac.uk
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
# following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following dis... |
the-stack_0_3462 | """
Create the numpy.core.multiarray namespace for backward compatibility. In v1.16
the multiarray and umath c-extension modules were merged into a single
_multiarray_umath extension module. So we replicate the old namespace
by importing from the extension module.
"""
import functools
from . import overrides
from . i... |
the-stack_0_3464 | # Third party
from github import UnknownObjectException
# Local
from utils import (
set_up_github_client,
get_cc_organization,
get_team_slug_name
)
PERMISSIONS = {
'Project Contributor': None,
'Project Collaborator': 'triage',
'Project Core Committer': 'push',
'Project Maintainer': 'maint... |
the-stack_0_3465 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import argparse
import itertools
from pathlib import Path
from typing import Iterator, List, Optional, Any
impo... |
the-stack_0_3467 | #!/usr/bin/python
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# This script creates yaml files to build conda environments
# For generating a conda file for running only python code:
# $ python generate_conda_file.py
# For generating a conda file for running python gp... |
the-stack_0_3468 | # from __future__ import absolute_import
# from __future__ import division
# from __future__ import print_function
import os
import time
os.environ["CUDA_VISIBLE_DEVICES"] = "1"
import numpy as np
# import cv2
import tensorflow as tf
from tensorflow.data import Iterator
from Dataset import SegDataLoader, VocRgbDataL... |
the-stack_0_3472 | import setuptools
with open('README.md', 'r') as fh:
long_description = fh.read()
setuptools.setup(
name='pico_sdk',
version='0.1.4',
author='Meaty Solutions',
author_email='info@meaty.io',
description='High performance, gap-free streaming from any Pico Technology oscilloscope',
... |
the-stack_0_3473 | import torch
import torch.nn as nn
def standardize(x, bn_stats):
if bn_stats is None:
return x
bn_mean, bn_var = bn_stats
view = [1] * len(x.shape)
view[1] = -1
x = (x - bn_mean.view(view)) / torch.sqrt(bn_var.view(view) + 1e-5)
# if variance is too low, just ignore
x *= (bn_var... |
the-stack_0_3477 | # python3
# Copyright 2020 DeepMind Technologies Limited. 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 re... |
the-stack_0_3478 | """Perform inference on one or more datasets."""
import argparse
import cv2
import os
import pprint
import sys
import time
from six.moves import cPickle as pickle
import torch
import _init_paths # pylint: disable=unused-import
from core.config import cfg, merge_cfg_from_file, merge_cfg_from_list, assert_and_infer_c... |
the-stack_0_3481 | import pandas as pd
import datetime
import copy
import requests
from data.dataloader.base import BaseLoader
class Covid19IndiaLoader(BaseLoader):
"""Dataloader that gets casecount data from 'https://api.covid19india.org'
We use the JSON api and not the CSV api
Different API are accessed and then converte... |
the-stack_0_3482 | import sys
import logging
from collections import namedtuple
logging.basicConfig(stream=sys.stderr, level=logging.WARNING)
class Parser(object):
"""Defines the common interface for parser objects.
Parser transofrm natural text into graphbrain hyperedges.
"""
def __init__(self, lemmas=False):
... |
the-stack_0_3483 | # -*- coding: utf-8 -*-
from hypothesis import assume, given
import hypothesis.strategies as st
import pytest
from matchpy.expressions.expressions import Arity, Operation, Symbol, Wildcard, Pattern
from matchpy.functions import ReplacementRule, replace, replace_all, substitute, replace_many, is_match
from matchpy.matc... |
the-stack_0_3484 | from ast import Mod
import cv2
import numpy as np
import os
from matplotlib import pyplot
def edit():
#Read the image
image = cv2.imread('Media/sample.jpg')
#greyscale filter
def greyscale(img):
greyscale = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
return greyscale
# brightness adjus... |
the-stack_0_3485 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class KoubeiMarketingCampaignMemberRelationUnbindModel(object):
def __init__(self):
self._member_template_id = None
self._out_member_no = None
self._request_id = None
se... |
the-stack_0_3487 | from __future__ import print_function
import random
import string
import subprocess
import time
from configparser import SafeConfigParser
import MySQLdb
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.mail import EmailMessage
from django.http import JsonResponse
from django.views.generic im... |
the-stack_0_3488 | import gym
from gym.spaces import Box, Discrete, Tuple
import logging
import random
import numpy as np
logger = logging.getLogger(__name__)
# Agent has to traverse the maze from the starting position S -> F
# Observation space [x_pos, y_pos, wind_direction]
# Action space: stay still OR move in current wind direction... |
the-stack_0_3490 | import logging
import os
import sys
import time
import click
from .investing import Investing
from .sendtext import SendText
__version__ = "0.0.4"
def setup_logging():
"""Create a basic console based logger object.
Args:
None
Returns:
logger (logging.logger): Logger object.
"""
... |
the-stack_0_3491 | #Given a list of numbers and a number k, return whether any two numbers from the list add up to k.
#For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17.
#Bonus: Can you do this in one pass?
if __name__ == "__main__":
l = list( int(i) for i in input().split(' '))
k = int(input())
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.