content stringlengths 5 1.05M |
|---|
import unittest
from copy import deepcopy
from ssg import Featurizer
class TestFeaturize(unittest.TestCase):
def setUp(self):
self.F = Featurizer(N=3)
self.true_result = {'X': [
['-1|#', '0|a', '-2|#', '1|b', '-3|#', '2|c', '-4|#', '3|d', '-4|###', '-3|###', '-2|##a', '-1|#ab', '0|abc',... |
# https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons/
# There are some spherical balloons spread in two-dimensional space. For each
# balloon, provided input is the start and end coordinates of the horizontal
# diameter. Since it's horizontal, y-coordinates don't matter, and hence the
# x-coordin... |
from sqlalchemy import Column, Integer, String, DateTime
class Gans:
__tablename__ = 'gans'
gans_id = Column(Integer, primary_key=True)
user_id = Column(Integer)
date = Column(DateTime)
|
from class_vis import prettyPicture
from prep_terrain_data import makeTerrainData
from sklearn import tree
import matplotlib.pyplot as plt
import numpy as np
import pylab as pl
features_train, labels_train, features_test, labels_test = makeTerrainData()
clf1 = tree.DecisionTreeClassifier(min_samples_split=2)
clf2 =... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.28 on 2020-02-16 11:56
from __future__ import unicode_literals
import datetime
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('team', '0006_auto_2019... |
from ROAR.agent_module.agent import Agent
from ROAR.utilities_module.vehicle_models import Vehicle, VehicleControl
from ROAR.configurations.configuration import Configuration as AgentConfig
from pathlib import Path
from ROAR.control_module.mpc_controller import VehicleMPCController
from ROAR.planning_module.mission_pla... |
from datetime import datetime
from sqlalchemy import Table , Column, Integer, String, ForeignKey, TEXT, DATE, Numeric, create_engine
from sqlalchemy.engine.url import URL
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, backref
Base = declarative_base()
class DanmuMsg(o... |
import numpy as np
import pytest
import starman.util as util
def test_as_square_array():
assert util.as_square_array(1).shape == (1, 1)
assert util.as_square_array([1]).shape == (1, 1)
assert util.as_square_array([[1, 2], [3, 4]]).shape == (2, 2)
def test_as_square_array_needs_square_input():
with py... |
# Importing the necesary packages
import os
import pandas as pd
import numpy as np
from sklearn.feature_extraction.text import CountVectorizer
# Extracting the current directory
_cur_dir = os.path.dirname(os.path.abspath(__file__))
# Defining the path to data
_data_path = os.path.join(_cur_dir, 'netflix_titles.c... |
import torch
import torch.nn as nn
from torchvision import models
import numpy as np
class Resnet(nn.Module):
"""
Resnet module
"""
def __init__(self, model_depth, modality, in_channels):
super(Resnet, self).__init__()
if model_depth == 18:
self.model = models.resnet18(pr... |
# -*- coding: utf-8 -*-
import re
from os.path import splitext
from django.db.models import Q
from allink_core.core.constants import STOP_WORDS_RE
from django.conf import settings
from django.utils.text import get_valid_filename as get_valid_filename_django
from django.template.defaultfilters import slugify
_base_url ... |
from aip import AipOcr
def get_file_content(filePath):
with open(filePath, 'rb') as fp:
return fp.read()
""" 你的 APPID AK SK """
with open(r'/home/pi/Documents/WinUIAutomation/ipconfig.txt') as f:
#with open('./ipconfig.txt') as f:
text = f.read()
name = text.split('\n')
workingdir = name[2].sp... |
import numpy as np
from pymc3.blocking import DictToArrayBijection
from . import models
from pymc3.step_methods.hmc.base_hmc import BaseHMC
import pymc3
from .checks import close_to
def test_leapfrog_reversible():
n = 3
start, model, _ = models.non_normal(n)
step = BaseHMC(vars=model.vars, model=model)
... |
from itertools import tee,izip,izip_longest,cycle
def _grouper(iterable, n):
"Collect data into minimum-length chunks or blocks"
# grouper('ABCDEFG', 3) --> ABC DEF GNoneNone
args = [iter(iterable)] * n
return izip_longest(fillvalue=None, *args)
def grouper(n):
def inner(it):
return _group... |
from changes.api.serializer import Serializer, register
from changes.models.repository import Repository, RepositoryBackend
@register(Repository)
class RepositorySerializer(Serializer):
def serialize(self, instance, attrs):
return {
'id': instance.id.hex,
'url': instance.url,
... |
from django.conf.urls import patterns, url
from fjord.heartbeat.analyzer_views import SurveyCreateView, SurveyUpdateView
from fjord.heartbeat.api_views import HeartbeatV2API
urlpatterns = patterns(
'fjord.heartbeat.views',
url(r'^api/v2/hb/?$', HeartbeatV2API.as_view(), name='heartbeat-api')
)
# Analyzer-g... |
# Copyright 2019 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... |
from . import (base_trainer, dynamic_values, feed_dict, hooks,
loss_trainer, validator)
__all__ = sum(
[m.__all__ for m in [base_trainer, dynamic_values, feed_dict, hooks,
loss_trainer, validator]],
[]
)
from .base_trainer import *
from .dynamic_values import *
from .fe... |
# 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... |
import time
from rltools.learners import Learner
class TemporalDifferenceLearner(Learner):
'''
Learner that uses the temporal difference methods described by Richard Sutton in
`Learning to Predict by the Methods of Temporal Differences`.
'''
def __init__(self, l=0.6, discount_factor=1, learning_r... |
import json
import sys
import uuid
import dcoscli
import docopt
import rollbar
import six
from concurrent.futures import ThreadPoolExecutor
from dcos import http, mesos, util
from dcoscli.constants import (ROLLBAR_SERVER_POST_KEY,
SEGMENT_IO_CLI_ERROR_EVENT,
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import warnings
import torch
from torch import sigmoid
from torch.nn import Dropout, LayerNorm, Linear, Module
from torch.nn.functional import dropout, linear, relu, softmax
from torch.nn.init import normal_
from torch.nn.modules.activation import MultiheadAttention
from t... |
import argparse
def parse_args():
parser = argparse.ArgumentParser(description='neural model for factuality')
parser.add_argument('--bert_model', type=str, default='./bert-base-uncased', help='path to the bert-base-uncased model')
parser.add_argument('--train_data_path', type=str,
d... |
# Copyright 2016 Rackspace Australia
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2021 Edward Higgins <ed.higgins@york.ac.uk>
#
# Distributed under terms of the MIT license.
"""
"""
import dash_html_components as html
import dash_core_components as dcc
from dash.dependencies import Input,Output
from dash_ui.app impor... |
"""empty message
Revision ID: 564960ba0967
Revises: 416dcaf9d750
Create Date: 2014-09-02 20:51:30.218855
"""
# revision identifiers, used by Alembic.
revision = '564960ba0967'
down_revision = '416dcaf9d750'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - ... |
import logging
from datetime import datetime
from typing import List, Optional
from db import (
Event,
EventFoodPreference,
EventImage,
User,
UserAcceptedEvent,
UserRecommendedEvent,
session_scope
)
from domain.data import (
EventData,
EventImageData,
EventViewData
)
def creat... |
import cv2 as cv2
import numpy as np
import matplotlib.pyplot as plt
import torch
from sklearn.metrics import roc_auc_score, average_precision_score, precision_recall_curve, roc_curve
from skimage.metrics import structural_similarity as ssim
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
def ca... |
import requests
import numpy as np
import json
def getNumAlgos():
page = requests.get('http://terminal.c1games.com/leaderboard')
contents = str(page.content)[2:-1]
contents = contents[contents.find('algos')+5:]
search = 'algos" class="value"> '
pos = contents.find(search)
return int(contents[pos+len(search):po... |
from unittest import skip
import cattr
from django.urls import reverse
from projectroles.tests.test_permissions_api import TestProjectAPIPermissionBase
import requests_mock
from .factories import SiteFactory
from ..models import Site
from ..models_api import BeaconAlleleRequest
class TestOrganisationAjaxViews(Test... |
from watson_developer_cloud import LanguageTranslatorV3
language_translator = LanguageTranslatorV3(version="2018-05-01", iam_apikey="rvE894AVGJQ_t_ZNuUoQrclWWQwvpFB0_78jr9pvtjIl")
print "Enter a sentence in English:"
eng_sent = raw_input()
translation = language_translator.translate(text=eng_sent, model_id="en-fr").g... |
import datetime
from django.db import models
from django.contrib.auth.models import AbstractUser,UserManager as _UserManager
from django.db.models.signals import post_save
from django.dispatch import receiver
from utils.models import ModelBase
# Create your models here.
class UserManager(_UserManager):
"""
defi... |
from typing import List
from ListQues import ListNode
import queue
import collections
def delete_node(head: ListNode, val: int) -> ListNode:
"""
Offer 18. 删除链表的节点
:param head:
:param val:
:return:
"""
virtual = ListNode(0)
virtual.next = head
pre, cur = virtual, he... |
#!/usr/bin/python3
"""manage.py"""
from sys import argv
from typing import Any
import subprocess
import datetime
import sqlite3
import pathlib
PATH = pathlib.Path.cwd()
HELP_TEXT = '''
Usage: manage.py [-h] database
-h, --help bring up this help message
database name of cert database
'''
MENU_T... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import tensorflow as tf
import numpy as np
def cal_loss(features,labels,nrof_classes,alpha,lambda_c=0.2,lambda_g=0.2,w_init=tf.constant_initializer(0)):
... |
import requests
from bs4 import BeautifulSoup
import sys
import datetime
payload = {'key': 'b5bde5d3527582e1bc8284c0a1a73720', 'url':
'https://www.lawrenceville.org/houseletter'}
def get_letter():
resp = requests.get('http://api.scraperapi.com', params=payload)
soup=BeautifulSoup(resp.text,'html.parser')
... |
# Create function to add two numbers
def adding_two_numbers(number_1,number_2):
"""
This function returns the sum of two numbers.
PARAMETERS;
number_1: float, takes in the first numbber to sum;
number_2: float, takes in the second number to sum;
RETURN TYPE;
The return type should be in float.
EXAMPLE:
add(7,7... |
from get_graph_laplacian_variables_ready import get_graph_laplacian_variables_ready
from graph_laplacian import graph_laplacian
def graph_construction(feature,\
n_sample,\
n_feature,\
M):
c=get_graph_laplacian_variables_ready(feature, n_sample, n... |
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class DistributedGagTreeAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedGagTreeAI')
|
from numpy.random import seed
seed(28)
from tensorflow.compat.v1 import set_random_seed
set_random_seed(28)
from reinforcement_learning.utils.plotter import plot_running_average
from reinforcement_learning.deep_RL.const import LIBRARY_TF, LIBRARY_KERAS, LIBRARY_TORCH, \
OPTIMIZER_Adam, OPTIMIZER_RMSprop, OPTIMIZER... |
#
# inq.py
#
# Author(s):
# Matteo Spallanzani <spmatteo@iis.ee.ethz.ch>
#
# Copyright (c) 2020-2021 ETH Zurich.
#
# 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... |
# Define here the models for your scraped items
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/items.html
import scrapy
class BiliVideoItem(scrapy.Item):
# 上传时间
senddate = scrapy.Field()
# rank_offset - 基本等于 play
rank_offset = scrapy.Field()
# rank_score - ?
rank_score = ... |
import tensorflow as tf
g1 = tf.Graph()
with g1.as_default():
with tf.Session() as sess:
a = tf.constant([6,5],tf.int32,name="constant_a")
b = tf.placeholder(tf.int32,name="constant_b")
c = tf.constant([3,2],tf.int32,name="constant_c")
y = a * b + c
print(sess.run... |
#matriceElementsSum
def matrixElementsSum(matrix):
if len(matrix) > 1:
for row in range(1, len(matrix)):
for room in range(len(matrix[row])):
if matrix[row - 1][room] == 0:
matrix[row][room] = 0
sum = 0
for row in matrix:
for room in... |
# Copyright 2013 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 required by applicab... |
import colorlover as cl
import plotly.graph_objects as go
from collections.abc import Iterable
from os.path import basename
from plotly.subplots import make_subplots
def plotly_peak_shapes(
mint_results,
n_cols=1,
biomarkers=None,
peak_labels=None,
legend=True,
verbose=False,
legend_orie... |
import b2d
import numpy
import time
class Timer:
def __enter__(self):
self.start = time.time()
return self
def __exit__(self, *args):
self.end = time.time()
self.interval = self.end - self.start
n_verts = 100
repeats = 1000
as_list = [b2d.b2Vec2(x, 0) for x in range(n_vert... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# level_1_cheese.py
# write by yamaguchi takuya @dashimaki360
## GO and Back only
import rospy
import random
from geometry_msgs.msg import Twist
from nav_msgs.msg import Odometry
from sensor_msgs.msg import JointState
class CheeseBurger():
def __init__(self, bot_na... |
from django.shortcuts import render
from .models import Image
import pyperclip
# Create your views here.
def homepage(request):
all_images = Image.display_all_images()
return render(request, 'homepage.html', {"all_images": all_images})
def single_image(request, id):
specific_image = Image.get_image_by_id... |
import pandas as pd
import pytest
from evalml.exceptions import MethodPropertyNotFoundError
from evalml.pipelines.components import (
ComponentBase,
FeatureSelector,
RFClassifierSelectFromModel,
RFRegressorSelectFromModel
)
def make_rf_feature_selectors():
rf_classifier = RFClassifierSelectFromMo... |
from distutils.core import setup
setup(
name = 'ld12',
version = '1.0.1',
description = 'Analysis for LD12 genomes and the freshwater against marine comparison paper.',
long_description = open('README.md').read(),
license = 'MIT',
url ... |
"""
pretix-nimiq
Copyright 2021 Marvin Schopf
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writ... |
import unittest
from os.path import join, exists
from sqlalchemy import Column, Integer
from sqlalchemy_media.attachments import Image, Thumbnail, ImageList
from sqlalchemy_media.stores import StoreManager
from sqlalchemy_media.tests.helpers import Json, TempStoreTestCase
from sqlalchemy_media.exceptions import Thum... |
import pytest
from utils import Paddle
import config as cfg
PADDLE_POSITION = (0, 0)
PADDLE_Y_UPPER_HEIGHT = 0
@pytest.fixture()
def paddle():
return Paddle(PADDLE_POSITION, PADDLE_Y_UPPER_HEIGHT, cfg.WINDOW_SIZE[1] - cfg.PADDLE_HEIGHT)
def test_constructor(paddle):
assert (paddle.rect.x, paddle.rect.y) == P... |
from .classic import ClassicSession
from .studio import StudioSession
from .helper import WinProcess
from SasSubmit.helper import parse_session_name
##############################################################
# Define functions and modules to be used #
#############################################... |
# -*- coding: utf-8 -*-
import base64
from odoo import api, fields, models, tools, _
from odoo.modules.module import get_resource_path
class Company(models.Model):
_inherit = "res.company"
def _default_qrcode(self):
image_path = get_resource_path(
"website_china_extends", "st... |
from .core.systemtopology import Proteins, Lipids, Protein
from .core.computecontacts import ComputeContacts, contacts_dataframe, retrieve_contacts, retrieve_contacts_flat
from .vis.show_points import show_points
from .vis.show_network import show_network
from .vis.show_contact_projection import show_contact_pr... |
# Form implementation generated from reading ui file 'DeleteComandForm.ui'
#
# Created by: PyQt6 UI code generator 6.2.0
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt6 import QtCore, QtGui, QtWidgets
cl... |
# Copyright (c) 2012 Lars Hupfeldt Nielsen, Hupfeldt IT
# All rights reserved. This work is under a BSD license, see LICENSE.TXT.
from __future__ import print_function
# pylint: disable=E0611
from pytest import raises
from .utils.utils import config_error, config_warning, lineno
from .. import ConfigRoot, ConfigItem... |
# Funkcje i zasięg zmiennych w Python
# https://tinyurl.com/popo-namespace
# główna przestrzeń nazw: "__main__"
# przestrzenie nazw funkcji są osobne
some_value = 12
some_list = [1, 2]
def function_1():
print(some_value)
print(some_list)
def function_2():
some_value = "Other value" # zmienna rodzaju im... |
from statistics import mean, median, stdev
import json
from collections import OrderedDict
app_path = '/home/marcela/Research/lib-isolation/cpython'
apps = ['hello', 'alexa', 'plant_watering', 'twitterPhoto']
bench_types = ['e2e-latency', 'syscall-latency', 'iter-latency']
datasets = ['nopyr', 'pyr']
def get_e2e_l... |
#!/usr/bin/python3
# Date: 11/07/2021
# Author: Anugrah Ramadhan
# Description: Instagram bruteforce
# from lib.proxy import Proxy
import os
import time
from sys import exit
from lib import database
from lib.proxy_manager import ProxyManager
# from os.path import exists
from lib.bruter import Bruter
from lib.display ... |
import os
import sys
import cv2
import json
import numpy as np
import subprocess
from dimensionfour.stages.base_stage import BaseStage
class MotionDetectStage(BaseStage):
def __init__(self, args):
super().__init__(args)
self.detections = []
self.frameCounter = 0
self.cap = cv2.VideoCaptur... |
"""A set of tools to facilitate code testing"""
import numpy as np
import pandas as pd
import xarray as xr
class DummyData():
"""Generate dummy data."""
def __init__(self,
num_rows=1000,
num_cols=5,
cols=None,
rate=10,
jitt... |
# -*- coding: utf-8 -*-
##
# @file serialize.py
# @brief
# @author Wells
# @version 0.5
# @date 2016-08-07
from datetime import datetime
import pandas as pd
from quantity.digger.datastruct import PContract, Contract
import json
from json import JSONEncoder
class DataStructCoder(JSONEncoder):
def default(self, o... |
# run kallisto pseudo-alignment procedure over all couples of paired-end reads
def kallistoWrap(data_dir, fastq_dir, out_dir):
"""
This is a utility wrapper for the Kallisto pseudo-alignment command line
tool, to be used for iteratively performing alignments on paired-end RNA-seq
reads from an arbitrar... |
"""
utility functions for working with DataFrames
"""
import pandas
TEST_DF = pandas.DataFrame([1,2,3,4,5,6])
|
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import random
from PIL import Image, ImageDraw, ImageFont, ImageFilter
from io import BytesIO
_letter_cases = "abcdefghjkmnpqrstuvwxy" # 小写字母,去除可能干扰的i,l,o,z
_upper_cases = _letter_cases.upper() # 大写字母
_numbers = ''.join(map(str, range(3, 10))) # 数字
init_chars = ''.join((... |
import logging
from io import BytesIO
from urllib.parse import urlparse, parse_qs, urlunparse
import config
from app.aws.s3 import S3
from app.crawler.base_crawler import BaseCrawlerWorker
from app.db_operator.mysql_client import MySQLClient
from app.exceptions import RetryableException
from app.models.job_posting imp... |
def foofunc():
return 'This is foo.' |
import collections
import itertools
import json
import os
import attr
import torch
import numpy as np
from tensor2struct.models import abstract_preproc, encoder
from tensor2struct.modules import embedders, lstm, attention, rat, bert
from tensor2struct.utils import serialization, vocab, registry
@attr.s
class Encode... |
"""Helpers to work with check files (Python and YAML)."""
# std
import logging
import os
from urlparse import urljoin
# project
from util import check_yaml
log = logging.getLogger(__name__)
def get_conf_path(check_name):
"""Return the yaml config file path for a given check name or raise an IOError."""
from... |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def HostFibreChannelOverEthernetTargetTransport(vim, *args, **kwargs):
'''Fibre Channel O... |
from manimlib.imports import *
class QuadraticBezier(Scene):
CONFIG = {
"bezier_points": [(6,0),(-4,3),(-6,-2)],
"anim_kwargs": {
"rate_func": linear,
"run_time": 13
},
"bezier_lines_kwargs": {
"color": TEAL,
"stroke_opacity": 0.5,
... |
# Copyright (c) 2016-2017 Adobe Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modif... |
"""
For Python iMTech Mid Semester Exam - 26 Sep, 2012
For Question 1
newtonRaphson module - must contain a function with the name 'findRealRoots'
"""
# ======================================================================================================
# all your imports, globals and functions come here - between... |
import unittest
import unittest.mock
from programy.storage.entities.oobs import OOBsStore
class OOBsStoreTest(unittest.TestCase):
def test_load(self):
store = OOBsStore()
with self.assertRaises(NotImplementedError):
collector = unittest.mock.Mock()
store.load(collector)
|
"""Take list of hosts/URIs or Nmap XML as input, scan hosts on given ports,
and return a searchable and sortable HTML report."""
import argparse
from argparse import RawDescriptionHelpFormatter
from datetime import datetime
import hashlib
from functools import partial
from multiprocessing.dummy import Pool as ThreadPo... |
#!/usr/bin/env python3
import datetime
#Create a program that asks the user to enter their name and their age. Print out a message addressed to them that tells#them the year that they will turn 100 years old.
#Extras:
#Add on to the previous program by asking the user for another number and printing out that many copie... |
import random
from typing import Dict, List, Tuple
from environments.trick_taking_game import TrickTakingGame
from util import Card, Suit, OutOfTurnException
class TwentyFive(TrickTakingGame):
'''
Environment for twenty-five, a 4-player trump trick taking game.
This variation plays with 8 cards of each ... |
# coding=UTF-8
import os
import os.path
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import pickle
from PIL import Image
from load.load_mnist import load
from sklearn.datasets import load_iris
def mask_one_hot(data, centers, k=3):
distances = np.array(... |
from websites_metrics_collector.communication.webpages_fetcher import fetch_list_of_urls
from confluent_kafka_producers_wrapper.producer import Producer
import logging
from typing import Optional,Tuple
logger = logging.getLogger()
logging.basicConfig(
format='%(asctime)s:%(levelname)s:%(message)s', level=logging.I... |
from flask import Flask, escape, request, jsonify,make_response
from src.models.labeling import getLabeledDivision
from src.models.pipeline import pipeline
from src.data.DownloadTranscripts import DownloadTranscript
from flask_cors import CORS, cross_origin
app = Flask(__name__)
cors = CORS(app)
app.config['CORS_HEAD... |
from io import DEFAULT_BUFFER_SIZE, UnsupportedOperation
from pathlib import Path
from typing import BinaryIO
from unittest.mock import Mock, call
import pytest
from xz.io import IOAbstract
#
# len
#
def test_len() -> None:
obj = IOAbstract(10)
assert len(obj) == 10
#
# fileno
#
def test_fileno(tmp_pat... |
#
# 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
# ... |
import re
from dataclasses import dataclass
from functools import cached_property
from pathlib import Path
from typing import List, Optional, Set
import yaml
REX_EL = re.compile(r'li>\{\{\s*SVGElement\(["\']([a-zA-Z-]+)["\']\)\s*\}\}\.?</')
DEPRECATED = [
# attributes of <font-face> which is deprecated
'unde... |
#!/usr/bin/env python3
import rospy
import math
from sensor_msgs.msg import LaserScan
from srcp2_msgs.msg import VolSensorMsg
from obstacle.msg import Obstacles
# @TODO: check/test for logic errors someone else
class Obstacle:
def __init__(self):
rospy.init_node('Obstacle', anonymous=True)
self.... |
# decomposer.py
# ALS 2017/06/01
import os
from shutil import copyfile
from astropy.io import fits
import astropy.units as u
import astropy.table as at
import numpy as np
from ..decomposer import Decomposer
from ... import tabtools
from . import matchpsf
from . import plotpsf_tools
class plainDecomposer(Decomposer)... |
from sympy import Rational, Symbol, Real, I, sqrt, oo, nan, pi, E, Integer, \
Basic, S, factorial
from sympy.core.power import integer_nthroot
from sympy.core.numbers import igcd, ilcm, igcdex
from sympy.utilities.pytest import XFAIL, raises
def test_igcd():
assert igcd(0, 0) == 0
assert igcd(0, 1) =... |
from datetime import datetime
from typing import (Optional,
List,
Dict)
from cetus.types import (ColumnValueType,
OrderingType,
UpdatesType)
from cetus.utils import join_str
ALL_COLUMNS_ALIAS = '*'
NULL_VALUE = 'NULL'
ORDERS_ALI... |
"""
Django settings for project project.
Generated by 'django-admin startproject' using Django 3.2.4.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
from logging ... |
"""
Tests for certificate generation handler
"""
import logging
from unittest import mock
import ddt
from common.djangoapps.course_modes.models import CourseMode
from common.djangoapps.student.tests.factories import CourseEnrollmentFactory, UserFactory
from lms.djangoapps.certificates.data import CertificateStatuses
... |
# Authors: Bratulic Melanie, mail: m.bratulic@laposte.net
# Durand-Viel Albane, mail:
# Giraudo Anthony, mail: anthonygi13@hotmail.fr
# Marinho Louise, mail : louise.marinho@free.fr
# Creation date : 11/04/2017
# File : astro_essai.py
from pylab import *
import os
def B3V_line(g_r)... |
from pyspark.sql import SparkSession
from pyspark.sql import functions as func
from pyspark.sql.types import StructType, StructField, IntegerType, LongType
spark = SparkSession.builder.appName('PopularMovies').getOrCreate()
# Create schema when reading u.data
schema = StructType([
StructField('user_id', IntegerTy... |
# https://www.pramp.com/challenge/MW75pP53wAtzNPVLPG2b
#########################################################
# CODE INSTRUCTIONS: #
# 1) The method findInOrderSuccessor you're asked #
# to implement is located at line 30. #
# 2) Use the helper code below to... |
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 14 13:31:39 2020
@author: Ian Cheung
"""
##Creating objects for the game
class Player(object):
def __init__(self, Team, Health, Stamina, Level, State, DamageCaused, Casted):
self.Team = Team
self.Health = Health
self.Stamina = Sta... |
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
computer = "you are the robot"
robot = "you are the computer"
def robo_site(request, blob):
global computer, robot
print(blob)
ret = blob.split(',')
ret.pop(0)
ret = ",".join(ret)
if (blob.split(... |
"""
Tests for :mod:`ranger-ims-server.ext.klein`
"""
from klein import KleinRenderable
from klein.test.test_resource import Klein, MockRequest
from twisted.web.iweb import IRequest
from ..klein import static
from ..trial import TestCase
__all__ = ()
class StaticDecoratorTests(TestCase):
"""
Tests for :fun... |
from celery import Celery
def get_app(name, url, queues):
app = Celery(name, broker=url, backend=url)
app.conf.task_queues = queues
return app
|
import re
import sys
from textwrap import dedent
import pytest
from ipypublish.bib2glossary import BibGlossDB
bib_str = """\
@glsterm{gtkey1,
description = {the description},
name = {name}
}
@glsterm{gtkey2,
description = {the description of other},
name = {other name}
}
@glsacronym... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.