filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_106_19321 | import itertools
import logging
import os
import sys
from contextlib import closing
import flask
from flask import render_template
from flask import request
from packaging.version import parse
from sqlalchemy import Column
from sqlalchemy import create_engine
from sqlalchemy import Integer
from sqlalchemy import Strin... |
the-stack_106_19324 | """
Tools for opening a cluster's web UI.
"""
import click
from dcos_e2e_cli.common.options import (
existing_cluster_id_option,
verbosity_option,
)
from dcos_e2e_cli.common.utils import check_cluster_id_exists
from dcos_e2e_cli.common.web import launch_web_ui
from ._common import ClusterInstances, existing_... |
the-stack_106_19325 | from __future__ import absolute_import, annotations
import logging
from operator import itemgetter
from typing import Any, Dict, List, Set, Tuple
import numpy as np
import scipy
from nltk.metrics import edit_distance
from ..models.graph import Edge, Graph, Node
from ..models.nlp import Embeddings
from ..models.ontol... |
the-stack_106_19332 | class InvalidPage(Exception):
pass
class Paginator(object):
def __init__(self, object_list, per_page, orphans=0, allow_empty_first_page=True):
self.object_list = object_list
self.per_page = per_page
self.orphans = orphans
self.allow_empty_first_page = allow_empty_first_page
... |
the-stack_106_19333 | import re
from model.contact import Contact
def test_main_page_db(app, db):
contacts_from_home_page = sorted(app.contact.get_contact_list(), key=Contact.id_or_max)
contacts_from_db = sorted(db.get_contact_list(), key=Contact.id_or_max)
assert len(contacts_from_home_page) == len(contacts_from_db)
for i ... |
the-stack_106_19334 | from xdsl.dialects.builtin import *
from xdsl.dialects.std import *
from xdsl.dialects.arith import *
from xdsl.printer import Printer
from xdsl.dialects.affine import *
def get_example_affine_program(ctx: MLContext, builtin: Builtin, std: Std,
affine: Affine) -> Operation:
def aff... |
the-stack_106_19335 | #!/usr/bin/env python
import os
import sys
from setuptools import setup
try:
from setuptools import find_namespace_packages
except ImportError:
# the user has a downlevel version of setuptools.
print('Error: dbt requires setuptools v40.1.0 or higher.')
print('Please upgrade setuptools with "pip install... |
the-stack_106_19336 | # Copyright 2017 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_106_19337 | #Import required packages
from PyPDF2 import PdfFileWriter, PdfFileReader
import io
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import A4
# Define variables
debugGrid = False
def write_pdf(destinationPath, signatureImage, neighbor, gnr, bnr, adress):
packet = io.BytesIO()
# Create a new P... |
the-stack_106_19338 | l,r = input().split()
l,r = int(l), int(r)
if l == 0 and r == 0:
print("Not a moose")
elif l == r:
print("Even", l+r)
elif l != r:
mx = max(l,r)
print("Odd", mx*2)
|
the-stack_106_19339 | #!/usr/local/bin/python3
import serial, io
import time
device = '/dev/cu.usbmodem1431' # serial port
baud = 9600 # baud rate
now=time.localtime(time.time())
currentyear=now.tm_year
currentmonth=now.tm_mon
currentday=now.tm_mday
filename = '{0}_{1}_{2}GAC-log.txt'.format(currentyear,cur... |
the-stack_106_19341 | # coding: utf-8
"""
Copyright 2019 Amazon.com, Inc. or its affiliates. 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.
A copy of the License is located at
http://www.apache.org/licenses/LICENSE-2.0
or in ... |
the-stack_106_19342 | import faiss
import numpy as np
class FaissKMeans:
def __init__(self, n_clusters=8, n_init=1, max_iter=50):
self.n_clusters = n_clusters
self.n_init = n_init
self.max_iter = max_iter
self.kmeans = None
self.cluster_centers_ = None
self.inertia_ = None
self.la... |
the-stack_106_19343 | from data_importers.management.commands import BaseHalaroseCsvImporter
from django.contrib.gis.geos import Point
class Command(BaseHalaroseCsvImporter):
council_id = "E06000019"
addresses_name = (
"parl.2019-12-12/Version 1/polling_station_export-2019-11-08here.csv"
)
stations_name = (
... |
the-stack_106_19345 | #!/usr/bin/env python
import sys
import os
import re
import yaml
HEADER = '''---
permalink: "/{}/all/"
---'''
def main(language, configPath, crossrefPath, rootDir):
slugs, markers = readConfig(configPath)
crossref = readCrossref(crossrefPath, markers['crossref'])
print(HEADER.format(language))
be... |
the-stack_106_19346 | """
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
distri... |
the-stack_106_19347 | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. 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 requ... |
the-stack_106_19348 | #!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'ar'
import os
import glob
import shutil
import numpy as np
import matplotlib.pyplot as plt
import pycocotools.coco as coco
from pycocotools.coco import COCO
from pycocotools import mask
import skimage.io as skio
import skimage.color as skcl
import warnings
####... |
the-stack_106_19349 | import collections
from . import base
__all__ = ["AdaGrad"]
class AdaGrad(base.Optimizer):
"""AdaGrad optimizer.
Parameters
----------
lr
eps
Attributes
----------
g2 : collections.defaultdict
Examples
--------
>>> from river import datasets
>>> from river import ... |
the-stack_106_19350 | import logging
from functools import partial
from typing import Optional
from qcodes import VisaInstrument
from qcodes import ChannelList, InstrumentChannel
from qcodes.utils import validators as vals
import numpy as np
from qcodes import MultiParameter, ArrayParameter
log = logging.getLogger(__name__)
class Freque... |
the-stack_106_19352 | import sys
import os
import json
parent_dir = os.path.abspath(os.path.dirname(__file__))
vendor_dir = os.path.join(parent_dir, 'vendor')
sys.path.insert(1, vendor_dir)
from multiprocessing import Process
from twisted.internet import reactor
from scrapy.crawler import CrawlerRunner
from scrapy.spiderloader import Spid... |
the-stack_106_19353 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
the-stack_106_19354 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import string
from django.core.exceptions import ValidationError
from django.test import SimpleTestCase
from select_multiple_field.codecs import encode_list_to_csv
from select_multiple_field.models import SelectMultipleField
from select_multiple_field.v... |
the-stack_106_19358 | """
raven.contrib.django.client
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import logging
from django.conf import settings
from django.core.exceptions import Suspicio... |
the-stack_106_19359 | from .forms import NewProjectForm,ProfileForm,Votes
from django.contrib.auth.decorators import login_required
from django.shortcuts import render,redirect,get_object_or_404
from django.http import HttpResponse
from .models import Project,Profile,Ratings
from django.contrib.auth.models import User
# from django.http im... |
the-stack_106_19362 | from __future__ import print_function
import sys
import os
import keras
from tensorflow.python.platform import gfile
import numpy as np
import tensorflow as tf
from tensorflow.python.layers.core import Dense
from utils.data_manager import load_data
from utils.vocab import load_vocab_all
from utils.bleu import moses_mul... |
the-stack_106_19363 | # -*- coding: utf-8 -*-
"""ProximityForest test code."""
import numpy as np
from numpy import testing
from sktime.classification.distance_based import ProximityForest
from sktime.datasets import load_unit_test
def test_pf_on_unit_test_data():
"""Test of ProximityForest on unit test data."""
# load unit test ... |
the-stack_106_19365 | '''Parsing HTML forms.'''
import re
import warnings
from lxml import html
from .htmlib import rm_ws
from .httplib import retry_get
from .quick import contains
# 判断表格是否包含相关数据
def is_table(tables, within, without):
'''Determine whether the table contains relevant data.'''
is_tab, table = False, None
for ... |
the-stack_106_19366 | # -*- encoding: utf-8 -*-
"""
Copyright (c) Minu Kim - minu.kim@kaist.ac.kr
Templates from AppSeed.us
"""
from app import db, login, app
from flask_login import UserMixin, AnonymousUserMixin
from werkzeug.security import generate_password_hash, check_password_hash
from time import time
import jwt
import json
enrolmen... |
the-stack_106_19368 | from django.shortcuts import redirect
from django.utils.cache import patch_vary_headers
from amo.helpers import urlparams
from amo.urlresolvers import set_url_prefix
from mkt.constants.carriers import CARRIER_MAP
from . import set_carrier
class CarrierURLMiddleware(object):
"""
Supports psuedo-URL prefixes ... |
the-stack_106_19370 | from django.http import Http404
from django.views.decorators.cache import cache_page
from django.utils.decorators import method_decorator
from rest_framework.response import Response
from rest_framework.generics import ListAPIView
from rest_framework.views import APIView
from . import filters
from . import models
fro... |
the-stack_106_19371 | import numpy as np
import cv2
import json
import sys
shape='n/a'
imgPath="C:\\xampp\\htdocs\\projektmunka\\python\\haromszog.png"
img = cv2.imread(imgPath, -1)
alpha = img[:,:,3]
img = ~alpha
thresh = 100
ret,thresh_img = cv2.threshold(img, thresh, 255, cv2.THRESH_BINARY)
contours, hierarchy = cv2.findContours(thre... |
the-stack_106_19373 | from django.conf import settings
from django.db.models import Model
from wagtail import hooks
from wagtail.models import Locale
class SimpleTranslation(Model):
"""
SimpleTranslation, dummy model to create the `submit_translation` permission.
We need this model to be concrete or the following management ... |
the-stack_106_19375 | import asyncio
import json
from multiprocessing import Queue
from typing import Awaitable, Dict, List
import websockets
from liualgotrader.common import market_data
from liualgotrader.common.tlog import tlog
from ..common import config
from .streaming_base import StreamingBase, WSConnectState
NY = "America/New_York... |
the-stack_106_19378 |
class Wire:
def __init__( self, nm, layer, direction, *, clg, spg):
self.nm = nm
self.layer = layer
self.direction = direction
assert direction in ['v','h']
self.clg = clg
self.spg = spg
def segment( self, netName, pinName, center, bIdx, eIdx, *, bS=None, eS=Non... |
the-stack_106_19381 | #
# Copyright 2018 Analytics Zoo 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 or agreed to... |
the-stack_106_19382 | import sys
from os.path import abspath, dirname, join
import airsim
import numpy as np
import os
import tempfile
import pprint
from time import sleep
import random
import re
import torch
import pickle
import time
from problems.flocking import FlockingProblem
from utils import *
import argparse
from network_agg import N... |
the-stack_106_19384 | import numpy as np
import matplotlib.pyplot as plt
from custom_poling.utils.pmf import pmf
class Crystal:
""" A class for a poled crystal.
Attr:
domain_width
number_domains
z0
length = domain_width * number_domains
domain_walls
domain_middles
"""
d... |
the-stack_106_19385 | """
Copyright 2017 Inmanta
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_106_19386 | from unittest.mock import Mock
from django.test import RequestFactory, TestCase
from .middleware import WiretapMiddleware
from .models import Message, Tap
class WiretapTestCase(TestCase):
def setUp(self):
self.request_factory = RequestFactory()
self.mock = Mock()
self.wiretap_middleware ... |
the-stack_106_19387 | import sys, os.path
import math
dir_nodo = (os.path.abspath(os.path.join(os.path.dirname(__file__), '..','..')) + '\\EXPRESION\\EXPRESION\\')
sys.path.append(dir_nodo)
ent_nodo = (os.path.abspath(os.path.join(os.path.dirname(__file__), '..','..')) + '\\ENTORNO\\')
sys.path.append(ent_nodo)
from Expresion import Expr... |
the-stack_106_19389 | # Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.c (the "License");
# you may not use this file except in compliance with the License.
""" Userbot module for having some fun with people. """
import time
import datetime
from telethon import events
import i... |
the-stack_106_19390 | # -*- coding: utf-8 -*-
# (C) Copyright Ji Liu and Luciano Bello 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or ... |
the-stack_106_19392 | import datetime
import os
import tempfile
from io import StringIO
from wsgiref.util import FileWrapper
from django import forms
from django.conf.urls import url
from django.contrib import admin
from django.contrib.admin import BooleanFieldListFilter
from django.contrib.admin.views.main import ChangeList
from django.co... |
the-stack_106_19393 | import numpy as np
import tensorflow as tf
from tfumap.umap import compute_cross_entropy
from pynndescent import NNDescent
from scipy.sparse import csr_matrix
from sklearn.utils import check_random_state, check_array
from umap.umap_ import fuzzy_simplicial_set, discrete_metric_simplicial_set_intersection
from scipy im... |
the-stack_106_19397 | import csv
import requests
from bs4 import BeautifulSoup
import re
'''
Created on 28 Sep 2013
@author: rob dobson
'''
class StockSymbolList():
def getStocksFromCSV(self):
self.stockList = []
with open('ukstocks.csv', 'r') as csvfile:
stkReader = csv.reader(csvfile)
... |
the-stack_106_19398 | # -*- coding: utf-8 -*-
"""
Created on Sun May 5 22:56:49 2019
@author: MiaoLi
"""
import time
import idea1_stimuliGeneration_a0428
# https://morvanzhou.github.io/tutorials/python-basic/multiprocessing/5-pool/
import multiprocessing as mp
from functools import partial
from tqdm import tqdm
# =========================... |
the-stack_106_19399 | from __future__ import annotations
from datetime import timedelta
import operator
from typing import (
TYPE_CHECKING,
Any,
Callable,
Literal,
Sequence,
)
import numpy as np
from pandas._libs import algos as libalgos
from pandas._libs.arrays import NDArrayBacked
from pandas._libs.tslibs import (
... |
the-stack_106_19400 | #!/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 the rawtransaction RPCs.
Test the following RPCs:
- createrawtransaction
- signrawtransacti... |
the-stack_106_19401 | # -*- coding: utf-8 -*-
from branca.element import CssLink, Element, Figure, JavascriptLink
from branca.utilities import none_max, none_min
from folium.map import Layer
from jinja2 import Template
class HeatMapWithTime(Layer):
"""
Create a HeatMapWithTime layer
Parameters
----------
data: list... |
the-stack_106_19402 | import os
import angr
import angrop # pylint: disable=unused-import
BIN_DIR = os.path.join(os.path.dirname(__file__), "..", "..", "binaries")
def test_arm_conditional():
"""
Currently, we don't model conditional execution in arm. So we don't allow
conditional execution in arm at this moment.
"""
... |
the-stack_106_19403 | a,b=input().split()
a,b=int(a),int(b)
c=a-b
c1=str(a)
c2=str(b)
c=str(c)
if(len(c)==1):
if(int(c)!=9):
print(int(c)+1)
else:
print(int(c)-1)
else:
if(int(c[0])!=9):
print(str(int(c[0])+1),end="")
else:
print(str(int(c[0])-1),end="")
print(c[1:])
|
the-stack_106_19404 | from asyncio import sleep
from json import loads
from json.decoder import JSONDecodeError
from os import environ
from sys import setrecursionlimit
import spotify_token as st
from requests import get
from telethon.tl.functions.account import UpdateProfileRequest
from sample_config import Config
from uniborg.util impor... |
the-stack_106_19406 |
from mcpi.minecraft import Minecraft
mc = Minecraft.create()
from flask import Flask
app = Flask(__name__)
@app.route("/")
def showName():
pos = mc.player.getTilePos()
return "Player position: x: "+str(pos.x)+" y: "+str(pos.y) +" z: "+str(pos.z)
if __name__ == '__main__':
app.run()
|
the-stack_106_19407 | """
plottr/apps/inspectr.py -- tool for browsing qcodes data.
This module provides a GUI tool to browsing qcodes .db files.
You can drap/drop .db files into the inspectr window, then browse through
datasets by date. The inspectr itself shows some elementary information
about each dataset and you can launch a plotting ... |
the-stack_106_19411 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Utility for plotting peaks in a certain region.
"""
import os
import sys
import math
import argparse
import itertools
import cmder
import inflect
import pandas as pd
import pyBigWig
from seqflow import Flow, task, logger
import matplotlib.pylab as plt
import seaborn ... |
the-stack_106_19413 | from django.urls import reverse
from django.test import TestCase
from rest_framework import status
from core.models import Ingredient, Recipe
from rest_framework.test import APIClient
from django.contrib.auth import get_user_model
from recipe.serializers import IngredientSerializer
INGREDIENTS_URL = reverse('recipe:i... |
the-stack_106_19414 | import numpy as np
from gym_wmgds import Env, spaces
from gym_wmgds.utils import seeding
def categorical_sample(prob_n, np_random):
"""
Sample from categorical distribution
Each row specifies class probabilities
"""
prob_n = np.asarray(prob_n)
csprob_n = np.cumsum(prob_n)
return (csprob_n ... |
the-stack_106_19421 | class ReadFile:
"""ReadFile is a class for reading the lines from a given txt file.
"""
def __init__(self):
"""Keyword argumnets:
file_name -- path to the file wished to be read
"""
try:
print("Started creation of object type of ReadFile succesfully.")
exc... |
the-stack_106_19422 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Distributed under terms of the MIT license.
from .extractor import Extractor
from ..vocab import Vocab
import jieba
import re
import numpy as np
UNK_IDX = 0
EOS_IDX = 2
class WordEmbedExtractor(Extractor):
def __init__(self):
Extractor.... |
the-stack_106_19424 |
# Auto-Discovery of Content Files
# print('This is working')
# write in base.html the navigation links
template = open("template/base.html").read()
#read files in the content directory
import glob
all_html_files = glob.glob("content/*.html")
i=0
pages = []
template = open("template/base.html").read()
navbar = ... |
the-stack_106_19425 |
"""
Given a sorted array and a target value, return the index if the target is found.
If not, return the index where it would be if it were inserted in order.
You may assume no duplicates in the array.
@author: Lisong Guo <lisong.guo@me.com>
@date: July 30, 2018
"""
class Solution:
def _searchInsert(self, num... |
the-stack_106_19427 | # Copyright 2020 Mike Iacovacci
#
# 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 writi... |
the-stack_106_19428 | import pygame
import pygame.gfxdraw
class PrimitiveManager(pygame.sprite.Sprite):
"""A primitive manager for each platoon
"""
def __init__(self, map_instance, platoon_id, vehicle_type):
pygame.sprite.Sprite.__init__(self)
self.platoon_id = platoon_id
self.vehicle_type = vehicle_typ... |
the-stack_106_19429 | # Copyright (c) 2019 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_106_19431 | # -*- coding: utf-8 -*-
# Copyright (c) 2006-2014 LOGILAB S.A. (Paris, FRANCE) <contact@logilab.fr>
# Copyright (c) 2014-2018 Claudiu Popa <pcmanticore@gmail.com>
# Copyright (c) 2014 Google, Inc.
# Copyright (c) 2015-2017 Ceridwen <ceridwenv@gmail.com>
# Copyright (c) 2015 Florian Bruhin <me@the-compiler.org>
# Copyri... |
the-stack_106_19432 | import re
import math
import numpy as np
from matplotlib import pyplot as plt
class EM:
X = []
Y = []
F = ""
def __init__(self, func, size, initialX, initialY, finalX):
self.f = func
self.h = size
self.x0 = initialX
self.y0 = initialY
self.xf = fi... |
the-stack_106_19435 | import paystacklib
from paystacklib.base.baseapi import BaseApi
from paystacklib.util.utils import clean_params
class Page(BaseApi):
object_type = '/page'
def __init__(
self, secret_key=None,
uri=paystacklib.api_base + object_type, method=None,
headers=None, params=None):
... |
the-stack_106_19438 | """."""
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
plt.style.use('fivethirtyeight')
data = pd.read_csv('data/data_3.csv')
ids = data['Responder_id']
ages = data['Age']
bins = np.arange(10, 110, step=10)
plt.hist(ages, bins=bins, edgecolor='black', log=True)
median_ag... |
the-stack_106_19439 | # -*- coding: utf-8 -*-
# Copyright 2018 IBM.
#
# 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 agre... |
the-stack_106_19440 | # coding=utf8
# Copyright 2018-2025 JDCLOUD.COM
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
the-stack_106_19441 | #
# Copyright 2018 the original author or 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 or... |
the-stack_106_19443 | from discord.ext import commands
from discord import utils
from datetime import datetime as d
import typing
from botmodules import converters
class Converters(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.color = 0xffffff
@commands.command(
brief="Wandle Morsecode um",
... |
the-stack_106_19444 | # Copyright (c) 2020 Rik079, Worthy Alpaca, Zibadian, Micro-T. All rights reserved.
__version__ = "Alpha"
# Discord login Token
token = ""
# Path to modules folder
modulepath = "./modules"
# AWS credentials
aws_id = ''
aws_secret = ''
aws_region = 'us-west-2'
# Staff
# ------------------------
# Admins
adminids ... |
the-stack_106_19446 | # -- coding: utf-8 --
'''
Script for comparing our Bayesian preference learning approach with the results from Habernal 2016.
Steps in this test:
1. Load word embeddings for the original text data that were used in the NN approach in Habernal 2016. -- done, but
only using averages to combine them.
2. Load feature ... |
the-stack_106_19448 | #!/usr/bin/env pytest-3
# -*- coding: utf-8 -*-
__author__ = "Marc-Olivier Buob"
__maintainer__ = "Marc-Olivier Buob"
__email__ = "marc-olivier.buob@nokia-bell-labs.com"
__copyright__ = "Copyright (C) 2020, Nokia"
__license__ = "BSD-3"
from pybgl.ipynb import in_ipynb, ipynb_display_graph
from pybgl.n... |
the-stack_106_19449 | import os
from typing import Dict
from typing import List
from typing import cast
from cleo.helpers import argument
from cleo.helpers import option
from poetry.console.application import Application
from poetry.console.commands.init import InitCommand
from poetry.console.commands.update import UpdateCommand
class ... |
the-stack_106_19450 | from django.shortcuts import render,redirect
from django.http import JsonResponse,HttpResponse
from django.contrib.auth import login
from django.conf import settings
from django.views import View
from QQLoginTool.QQtool import OAuthQQ
from oauth.models import OAuthQQUser
from django_redis import get_redis_connection
... |
the-stack_106_19451 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_str,
compat_xpath,
compat_urlparse,
)
from ..utils import (
ExtractorError,
find_xpath_attr,
fix_xml_ampersands,
float_or_none,
HEADRequest,
RegexNotFou... |
the-stack_106_19452 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2016, Silvio Peroni <essepuntato@gmail.com>
#
# Permission to use, copy, modify, and/or distribute this software for any purpose
# with or without fee is hereby granted, provided that the above copyright notice
# and this permission notice appear in all copies.
... |
the-stack_106_19453 | #!/usr/bin/env python
import pandas as pd
import os
import tensorflow as tf
from utils import load_dataset, data_augment
from config import *
from networks import *
from sklearn.model_selection import train_test_split
from sklearn.metrics import roc_auc_score
import math
train_data = pd.read_csv(train_path)
train_d... |
the-stack_106_19454 | import pandas as pd
import mol_sim
def test_input_data():
'''Tests input_data function in mol_sim.py'''
input_df = pd.read_csv('playground_df_cleaned_kegg_with_smiles.csv')
test_df = mol_sim.input_data(input_df)
assert isinstance(test_df, pd.DataFrame) == True, """TypeError,
function should retur... |
the-stack_106_19457 | #!/usr/bin/python3
import os
import sys
import matplotlib.pyplot as plt
import cv2
import numpy as np
#image = cv2.imread("/Users/sam/code/Hackathon/InnerOuter/0-0/12.250-CF716-U02822-35625-2017-11-17-NA_B1.JPG")
#image = cv2.imread("/Users/sam/code/Hackathon/InnerOuter/0-0/DSC01277.JPG")
def get_circles(filename, ci... |
the-stack_106_19461 | """
Tests to verify text fields are rendered correctly.
"""
import os
from django.test.html import parse_html
from tbxforms.tbxforms.helper import FormHelper
from tbxforms.tbxforms.layout import (
Field,
Layout,
Size,
)
from tests.forms import (
CheckboxesForm,
TextInputForm,
)
from tests.utils i... |
the-stack_106_19463 | import logging
import reversion
from django.conf import settings
from django.db import transaction
from django.db.models import (
Count,
ExpressionWrapper,
F,
OuterRef,
PositiveSmallIntegerField,
Q,
Subquery,
)
from django.db.models.aggregates import Sum
from django.http import HttpResponse... |
the-stack_106_19464 | from itertools import chain
from cms.exceptions import NoHomeFound
from cms.utils import get_language_from_request, get_template_from_request
from cms.utils.moderator import get_cmsplugin_queryset, get_page_queryset
from cms.plugin_rendering import render_plugins, render_placeholder, render_placeholder_toolbar
from cms... |
the-stack_106_19465 | from Echo import *
from Broadcast import *
from RestPersistBroadcast import *
from RestPersistSendToGroup import *
from RestPersistSendToUser import *
from RestSendToGroup import *
from RestSendToUser import *
from RestBroadcast import *
from SendToClient import *
from SendToGroup import *
from StreamingEcho import *
f... |
the-stack_106_19466 | from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from django.db.models import Count, F
from django.template.loader import render_to_string
from django.urls import reverse
from django.utils.html import escape
from django.utils.safestring import ... |
the-stack_106_19468 | import re
import shutil
import subprocess
import sys
import time
from pathlib import Path
from random import random
from pythonfuzz.main import PythonFuzz
class Result(object):
"""
Use the output from the tool to collect the information about its execution.
Very sensitive to the format of the output as t... |
the-stack_106_19469 | import discord
import os
import requests
import json
client = discord.Client()
def get_quote():
response = requests.get("https://zenquotes.io/api/random")
json_data = json.loads(response.text)
quote = json_data[0]['q'] + " -" + json_data[0]['a']
return(quote)
@client.event
async def on_ready():
print('We h... |
the-stack_106_19470 | from string import printable
from typing import (Any, Callable, Generic, Iterable, NoReturn, Tuple, TypeVar,
Union)
from . import (Dict, Immutable, List, aio_trampoline, effect, either, maybe,
trampoline)
try:
from hypothesis.strategies import (
booleans,
builds,... |
the-stack_106_19471 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
archivebot.py - discussion page archiving bot.
usage:
python pwb.py archivebot [OPTIONS] TEMPLATE_PAGE
Bot examines backlinks (Special:WhatLinksHere) to TEMPLATE_PAGE.
Then goes through all pages (unless a specific page specified using options)
and archives old discu... |
the-stack_106_19472 | #FLM: Typerig Panel
# ----------------------------------------
# (C) Vassil Kateliev, 2018 (http://www.kateliev.com)
# (C) Karandash Type Foundry (http://www.karandash.eu)
#-----------------------------------------
# www.typerig.com
# No warranties. By using this you agree
# that you use it at your own risk!
# - Depe... |
the-stack_106_19475 | import os
import shutil
from openpype.hosts import tvpaint
from openpype.lib import (
PreLaunchHook,
get_pype_execute_args
)
import avalon
class TvpaintPrelaunchHook(PreLaunchHook):
"""Launch arguments preparation.
Hook add python executable and script path to tvpaint implementation before
tvpa... |
the-stack_106_19477 | #!/usr/bin/env python
import os
import sys
import vtk
from vtk.util.misc import vtkGetDataRoot, vtkGetTempDir
gotWarning = False
gotError = False
def WarningCallback(obj, evt):
global gotWarning
gotWarning = True
VTK_DATA_ROOT = vtkGetDataRoot()
VTK_TEMP_DIR = vtkGetTempDir()
# Image pipeline
image1 = vtk.... |
the-stack_106_19479 | from asyncio import get_running_loop
from tesoro import REVEALER
from sys import exc_info
import logging
logger = logging.getLogger(__name__)
def kapicorp_labels(req_uid, req_obj):
"returns kapicorp labels dict for req_obj"
labels = {}
try:
for label_key, label_value in req_obj["metadata"]["label... |
the-stack_106_19481 | """Notification Model"""
from datetime import datetime
from enum import Enum
import requests
from flask import current_app
from pushover_complete import PushoverAPI
from .. import db
class Service(Enum):
Pushover = "Pushover"
LineNotify = "Line Notify"
VALID_ARGS = {
Service.Pushover: [
"devic... |
the-stack_106_19482 | # encoding: utf-8
# This file contains commonly used parts of external libraries. The idea is
# to help in removing helpers from being used as a dependency by many files
# but at the same time making it easy to change for example the json lib
# used.
#
# NOTE: This file is specificaly created for
# from ckan.common i... |
the-stack_106_19483 | import setuptools
import castero
install_requires = [
'requests',
'grequests',
'cjkwrap',
'beautifulsoup4',
'lxml',
'python-vlc',
'python-mpv'
]
tests_require = [
'pytest',
'coverage',
'codacy-coverage'
]
extras_require = {
'test': tests_require
}
def long_description()... |
the-stack_106_19486 | import speech_recognition as sr
import re
import philips_hue as ph
import soundclassify as sc
import pyaudio
import wave
from jesica4 import create_dashboard
from jesica4 import command_light
from jesica4 import command_SoundSystem
from jesica4 import command_Door
from jesica4 import command_detectsound
command_light... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.