text stringlengths 1 927k |
|---|
# -*- coding: utf-8 -*-
# ############# version ##################
import os.path
import re
import subprocess
from pkg_resources import get_distribution, DistributionNotFound
GIT_DESCRIBE_RE = re.compile('^(?P<version>v\d+\.\d+\.\d+)-(?P<git>\d+-g[a-fA-F0-9]+(?:-dirty)?)$')
__version__ = None
try:
_dist = get_d... |
import numpy as np
import platform
if platform.system() == 'Windows':
import pandas as pd
else:
import modin.pandas as pd
import matplotlib.pyplot as plt
import sys
sys.path.append("..") # Adds higher directory to python modules path.
from ta import *
# Load data
df = pd.read_csv('../data/datas.csv', sep='... |
import requests
from bs4 import BeautifulSoup
def find_meaning(word):
url="http://www.collinsdictionary.com/dictionary/english/"+word
r=requests.get(url)
soup = BeautifulSoup(r.content)
mean= soup.find_all("div",{"class":"sense"})
for item in mean:
try:
# print (item.contents[0].text)
# print (item.co... |
### IMPORTS ###
import os
import time
from typing import (
List,
Dict,
Union,
)
import threading
import uuid
import numpy as np
from pydantic import (
BaseModel,
validator,
Field,
)
from fastapi import (
FastAPI,
Response,
status,
)
from fastapi.middleware.cors import CORSMiddlewar... |
__author__ = 'patras'
from domain_exploreEnv import *
from timer import DURATION
from state import state, rv
DURATION.TIME = {
'survey': 5,
'monitor': 5,
'screen': 5,
'sample': 5,
'process': 5,
'fly': 3,
'deposit': 1,
'transferData': 1,
'take': 2,
'put': 2,
'move': 10,
'... |
"""
This module provides WSGI application to serve the Home Assistant API.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/http/
"""
from ipaddress import ip_network
import logging
import os
import ssl
from aiohttp import web
from aiohttp.web_exceptions... |
from django.contrib import admin
from .models import Comment
@admin.register(Comment)
class CommentAdmin(admin.ModelAdmin):
pass |
#encoding: utf-8
import numpy as np
from RTDEhandler import RTDEhandler
from URconnect import URCom
import socket
from threading import Thread
import time
from queue import Queue
class scheduler:
def __init__(self, robotip):
self.robot=URCom(robotip,30002)
self.servsock=socket.socket(socket.AF_INET... |
from flask import Flask, Blueprint, request, current_app
from flask_login import login_user
from notifications import Notifications, db
from user import User
import json, requests
from datetime import datetime
user_api = Blueprint('user_api', __name__)
@user_api.route("/signup", methods=["POST"])
def signup():
da... |
from io import BytesIO
from unittest.mock import Mock
import pandas as pd
from fastparquet import write as pq_write
from batch.models import DatasetRetrievals
from batch.s3_access_log_aggregator.aggregate_to_db import (
count_get_requests,
aggregate_to_db,
read_parquet,
)
def test_read_parquet():
in... |
from fastapi import APIRouter, Depends, Request, Response
from sqlalchemy.orm import Session
from typing import List
from uuid import UUID
from api.models.analysis_module_type import (
AnalysisModuleTypeCreate,
AnalysisModuleTypeRead,
AnalysisModuleTypeUpdate,
)
from api.routes import helpers
from db impor... |
import unittest
from datetime import date
from function import *
from sanitation import UnknownCollectionDate
class TestCollDateToSpeech(unittest.TestCase):
def test_raises_UnknownCollectionDate_when_in_past(self):
now = date(2019, 4, 22)
coll_date = date(2019, 4, 21)
with self.assertRai... |
import codecademylib3
# Import pandas with alias
import pandas as pd
# Import dataset as a Pandas Dataframe
movies = pd.read_csv("movie_show.csv", index_col=0)
# Print the first five rows of the dataframe
print(movies.head())
# Print the data types of the dataframe
print(movies.dtypes)
# Replace any missing values... |
#函数的3要素:名字, 参数,返回值
def bmi(height, weight):
"""计算BMI的值:
公式: 身高/(体重*体重)。
身高是以米为单位,如1.78
体重是以公斤为单位,如62公斤
函数返回计算好的BMI值,保留1位小数
"""
bmi_value = weight/(height*height)
return round(bmi_value, 1)
print(bmi.__doc__)
print(round.__doc__)
#print(bmi(1.68, 72)) |
#!/usr/bin/env python3
import os.path
import os
import sys
from github import Github
from git import Repo, InvalidGitRepositoryError
import toml
import urllib3
import certifi
import configparser
import tarfile
import signal
from delayed_interrupt import DelayedInterrupt
from auth_github import auth_github
self_update... |
import math
import torch
from torch.optim.optimizer import Optimizer
from .types import Betas2, OptFloat, OptLossClosure, Params
__all__ = ('AdaMod',)
class AdaMod(Optimizer):
r"""Implements AccSGD algorithm.
It has been proposed in `Adaptive and Momental Bounds for Adaptive
Learning Rate Methods`__.
... |
"""
Definition of urls for django_get_started.
"""
from datetime import datetime
from django.conf.urls import patterns, url
from app.forms import BootstrapAuthenticationForm
# Uncomment the next lines to enable the admin:
# from django.conf.urls import include
# from django.contrib import admin
# admin.autodiscover()... |
from django.utils.translation import gettext_lazy as _
from django_ilmoitin.dummy_context import dummy_context
from django_ilmoitin.registry import notifications
from organisations.consts import NotificationTemplate
from organisations.factories import (
OrganisationFactory,
OrganisationProposalFactory,
Pers... |
from photons_canvas.animations.infrastructure.finish import Finish
from photons_canvas.animations.run_options import make_run_options
from photons_canvas.animations.infrastructure.state import State
from photons_canvas.animations.infrastructure import cannons
from photons_canvas import Canvas
from photons_app.special ... |
from theheck.utils import which
dnf_available = bool(which('dnf')) |
from typing import Dict, List
from overrides import overrides
import torch
from allennlp.common.checks import ConfigurationError
from allennlp.common.util import pad_sequence_to_length
from allennlp.data.tokenizers.token import Token
from allennlp.data.token_indexers.token_indexer import TokenIndexer, IndexedTokenLis... |
from django.utils.functional import wraps
from caseworker.core.constants import Permission
from core.exceptions import PermissionDeniedError
from caseworker.core import helpers
def has_permission(permission: Permission):
"""
Decorator for views that checks that the user has a given permission
"""
de... |
from measurements import Measurement
from pygame.time import get_ticks
from timers import Timer
from units.time import Second
from units.prefixes.small import Milli
class PyGameTimer(Timer):
def __init__(self):
Timer.__init__(self)
def time(self):
measurement = Measurement(1, Second()).convertTo(Milli())... |
from railrl.envs.multitask.multitask_env import MultitaskToFlatEnv
from railrl.envs.multitask.point2d import MultitaskImagePoint2DEnv
from railrl.envs.mujoco.pusher2d import Pusher2DEnv
from railrl.envs.wrappers import NormalizedBoxEnv
from railrl.exploration_strategies.base import (
PolicyWrappedWithExplorationStr... |
# -*- coding: utf-8 -*-
import scrapy
# pages = int(input('How Many Pages Do You Want to Scrape: '))
pages = 1
dictonary = {'One': 1, 'Two': 2, 'Three': 3, 'Four': 4, 'Five': 5}
class ThespiderSpider(scrapy.Spider):
name = 'books'
# allowed_domains = ['book.toscrape.com']
start_urls = ['http://books.tosc... |
import csv
import multiprocessing as mp
import os
from common import timeit, load_configurations, create_demand_matrix_for_configuration
from network import BfsDanNetwork
FIG_NUM = 0
@timeit
def main(show=False):
configurations = load_configurations("../config.json")
active_config = configurations[1]
re... |
# coding=utf-8
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------------------------... |
"""Module that provides operators that reproduce individuals."""
import numpy as np
from peal.community import Community
from peal.operators.iteration import (
SingleIteration,
RandomStraightIteration,
)
from peal.operators.operator import Operator
from peal.population import Population
class Copy(Operator)... |
from .port import Port
from .status import Status
from .alarm_status import AlarmStatus
from .pumping_direction import PumpingDirection
from .exceptions import *
import typing
import binascii
import re
import time
import enum
import threading
class Pump :
"""Pump."""
MODEL_NUMBER_IGNORE = 0
"""Model numb... |
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Fast R-CNN config system.
This file specifies default config option... |
import os
from unittest import TestCase
from unittest.mock import Mock, call, patch
from botocore.exceptions import NoCredentialsError, ClientError
from pathlib import Path
from parameterized import parameterized
from samcli.local.layers.layer_downloader import LayerDownloader
from samcli.commands.local.cli_common.u... |
#!/usr/bin/python
################################################################################
# 22f7e138-5cc5-11e4-af55-00155d01fe08
#
# Justin Dierking
# justindierking@hardbitsolutions.com
# phnomcobra@gmail.com
#
# 10/24/2014 Original Construction
################################################################... |
__version__ = "0.0.1"
import importlib.util
from zenithml import data
from zenithml import utils
from zenithml import metrics
from zenithml import nvt
from zenithml import preprocess as pp
from zenithml.config_manager import ConfigManager
from zenithml.ray import runner as ray_runner
if importlib.util.find_spec("torc... |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Sunil Govind and Contributors
# See license.txt
from __future__ import unicode_literals
# import frappe
import unittest
class TestControlMechanism(unittest.TestCase):
pass |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
# python3
# pylint: disable=invalid-name
"""Compiler IR."""
import enum
from src.lib import helper
class Op(enum.Enum):
UNK = 0
SINGLE = 1
CTL = 2
SECTION = 3
END_SECTION = 4
class Node:
"""Single node in the IR."""
def __init__(self, opcode, name, idx0, idx1, gate, val):
self._opcode = opcode
... |
import struct
from src.system.controller.python.messaging.messages import *
from src.system.controller.python.messaging.messages.hello import HelloMessage
from src.system.controller.python.messaging.messages.ack import AckMessage
from src.system.controller.python.messaging.messages.welcome import WelcomeMessage
from s... |
"""
This file offers the methods to automatically retrieve the graph Tolypocladium paradoxum.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v11: protein--protei... |
from setuptools import setup, find_packages
setup(
name='lcp',
version='0.0.1',
packages=['lcp',],
license='MIT',
long_description='Collection of tools for Least Cost Path Analysis in Python.',
url='https://doi.org/10.1559/152304010791232163',
author='Thomas Pingel',
author_email='thom... |
import os
import sys
from typing import List, Tuple
import numpy as np
import tensorflow as tf
from dataloader_iam import Batch
# Disable eager mode
tf.compat.v1.disable_eager_execution()
class DecoderType:
"""CTC decoder types."""
BestPath = 0
BeamSearch = 1
WordBeamSearch = 2
class Model:
"... |
__copyright__ = "Copyright 2016, http://radical.rutgers.edu"
__license__ = "MIT"
import time
import pymongo
import radical.utils as ru
from .. import utils as rpu
from .. import constants as rpc
# ------------------------------------------------------------------------------
#
DEFAULT_BULK_COLLECTION_TI... |
# qubit number=4
# total number=47
import cirq
import qiskit
from qiskit.providers.aer import QasmSimulator
from qiskit.test.mock import FakeVigo
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import ... |
# Third-party
from astropy.constants import G
import astropy.units as u
import numpy as np
import pytest
# gala
from gala.dynamics import get_staeckel_fudge_delta, PhaseSpacePosition
import gala.potential as gp
from gala.units import galactic
from .helpers import HAS_GALPY
@pytest.mark.skipif(not HAS_GALPY,
... |
from typing import Union
from copy import deepcopy
import gym
# flake8: noqa F401
from touchstone.environments.base_vec_env import AlreadySteppingError, NotSteppingError, VecEnv, VecEnvWrapper, \
CloudpickleWrapper
from touchstone.environments.dummy_vec_env import DummyVecEnv
from touchstone.environments.subproc_... |
from django.urls import path
from .views import ArticleListCreateAPIView, ArticleRetrieveUpdateDeleteCommentCreateAPIView, \
CommentUpdateDeleteAPIView, CommentListAPIView, ArticleUpvoteAPIView, ArticleDownvoteAPIView
urlpatterns = [
path('<str:channel_slug>/posts/', ArticleListCreateAPIView.as_view()),
p... |
# Copyright 2014 Netflix, 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... |
""" Core CardIO objects """
from .ecg_batch import EcgBatch, add_actions
from .ecg_dataset import EcgDataset
from . import kernels |
''' Dictionary Nesting '''
# Dictionary in string
dict_str = {
'sector': 'dictionary in string',
'variable': 'dictionary',
}
str_nest = dict_str
print(str_nest)
# Dictionary in list
dict_list = {
'sector': 'dictionary in list',
'variable': 'dictionary',
}
list_nest = [dict_list]
print(list_nest)
# ... |
# Copyright (C) 2015 Catalyst IT 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 o... |
"""
author : Julien SEZNEC
Produce the experiment and record the relevant data to reproduce Figure 2 of [Seznec et al., 2019a]
Reference: [Seznec et al., 2019a]
Rotting bandits are not harder than stochastic ones;
Julien Seznec, Andrea Locatelli, Alexandra Carpentier, Alessandro Lazaric, Michal Valko ;
Proceedings of... |
"""djangoVue URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-bas... |
import logging
import time
from contextlib import contextmanager
from urllib.parse import quote_plus as urlquote
import psycopg2
import psycopg2.errorcodes
import sqlalchemy
from dagster import Field, IntSource, Selector, StringSource, check
from dagster.core.storage.sql import get_alembic_config, handle_schema_errors... |
"""
WSGI config for learnforfree project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_... |
import requests
import sys
def main():
url = str(sys.argv[1])
response = requests.get(url)
if (response.status_code == 200):
response = response.json()
test_result = response['msg']
if (test_result != "True"):
raise Exception(F'Integration tests failed.')
else:
raise Exception(F'GET fai... |
from .db import db
class Review(db.Model):
__tablename__ = 'reviews'
id = db.Column(db.Integer, primary_key=True)
overall = db.Column(db.Integer, nullable=False)
review = db.Column(db.String(2500), nullable=False, default="")
recipeId = db.Column(db.Integer, db.ForeignKey("recipes.id"), nullable=... |
import logging
import os
import json
import networkx as nx
from utils import Singleton
class Przystanki(metaclass=Singleton):
def __init__(self, path=None):
if path is None:
self.path = os.environ['TRAM_ROOT'] + "/data/przystanki_0_159.json"
else:
self.path = path
... |
import math
import fnmatch
import glob
import json
import os
import re
import pipes
import platform
import shutil
import socket
import tempfile
import _thread
import time
from subprocess import check_output, Popen, PIPE
import subprocess
from collections import defaultdict
import psutil
from behave import given, when,... |
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 18 02:43:27 2019
@author: z
"""
import numpy as np
import scipy.stats as ss
import matplotlib.pyplot as plt
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
h = 1
sd = 1
n = 50
n_n = 1000
def gen_data(n, h, sd1, s... |
# encoding: utf-8
"""
leuvenmapmatching
~~~~~~~~~~~~~~~~~
:author: Wannes Meert
:copyright: Copyright 2015-2018 DTAI, KU Leuven and Sirris.
:license: Apache License, Version 2.0, see LICENSE for details.
"""
import logging
from . import map, matcher, util
# visualization is not loaded by default (avoid loading unneces... |
import sqlite3
CONNSTR = 'todo.db'
def init_db():
'''Initialize the database by creating all necessary tables.'''
with sqlite3.connect(CONNSTR) as conn:
cursor = conn.cursor()
cursor.execute('''
CREATE TABLE
todo_item
(desc... |
"""
asyncio socket server for handling messages
"""
import os
import asyncio
import logging
from .parser import parse_message
__all__ = ('runserver', )
LOG = logging.getLogger(__name__)
class MessageProtocol(asyncio.Protocol):
"""
Takes the recv'd bytes and parses it with the
message handler. In real c... |
# -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2020 PyBuilder 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/l... |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "homework.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the... |
# -*- coding: utf-8 -*-
'''
The module used to execute states in salt. A state is unlike a module
execution in that instead of just executing a command it ensure that a
certain state is present on the system.
The data sent to the state calls is as follows:
{ 'state': '<state module name>',
'fun': '<state fun... |
###########################################################################
#
# Copyright 2019 Google 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
#
# https://www.apache.org/... |
import logging
log = logging.getLogger(__name__)
import json
import requests
import requests.exceptions
import botologist.plugin
BASE_URL = 'https://qdb.lutro.me'
def _get_quote_url(quote):
return BASE_URL + '/' + str(quote['id'])
def _get_qdb_data(url, query_params):
response = requests.get(url, query_params, ... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: storyboard_node.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.prot... |
# coding: utf-8
import glob
import logging
import os
import json
import sys
import socket
import time
import numpy as np
import pickle
import pytest
import ray
import ray.ray_constants as ray_constants
import ray.cluster_utils
import ray.test_utils
from ray import resource_spec
import setproctitle
from ray.test_util... |
import scraper.amazon
import scraper.bestbuy
import scraper.bhphotovideo
import scraper.microcenter
import scraper.newegg
from scraper.common import ScraperFactory
def init_scrapers(driver, urls: list):
return [ScraperFactory.create(driver, url) for url in urls] |
# Copyright (C) 2014, Red Hat, 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... |
"""
Test the signals module
"""
# Author: Gael Varoquaux, Alexandre Abraham
# License: simplified BSD
import os.path
import warnings
from distutils.version import LooseVersion
import numpy as np
import pytest
# Use nisignal here to avoid name collisions (using nilearn.signal is
# not possible)
from nilearn import si... |
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class Hpgmg(MakefilePackage):
"""HPGMG implements full multigrid (FMG) algorithms using ... |
DIRECT = 'direct'
FANOUT = 'fanout'
TOPIC = 'topic'
HEADERS = 'headers'
class Blocking:
@staticmethod
def queue(queue_name, callback=None, exchange_name=None, routing_key=None, exchange_type=DIRECT, host='localhost',
port=None, prefetch_count=0, durable=False):
import pika
from p... |
###############################################################################
#
# Packager - A class for writing the Excel XLSX Worksheet file.
#
# Copyright 2013-2016, John McNamara, jmcnamara@cpan.org
#
# Standard packages.
import os
import sys
import tempfile
from shutil import copy
from .compatibility import St... |
from __future__ import unicode_literals
from reviewboard.admin import ModelAdmin, admin_site
from reviewboard.webapi.models import WebAPIToken
class WebAPITokenAdmin(ModelAdmin):
list_display = ('user', 'local_site', 'time_added', 'last_updated')
raw_id_fields = ('user',)
admin_site.register(WebAPIToken, W... |
# Copyright 2013 Answers for AWS LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import datetime
import json
import os
import random
import sqlite3
import sys
import time
import urllib
from importlib import reload
import dns.resolver
import pandas
import requests
reload(sys)
##############################################################################... |
import os
from pathlib import PurePath
from jupyter_core.paths import jupyter_path
import tornado
class SnippetsLoader:
def __init__(self):
self.snippet_paths = jupyter_path("snippets")
def collect_snippets(self):
snippets = []
for root_path in self.snippet_paths:
for d... |
from .db import *
from sklearn.ensemble import RandomForestClassifier
from sklearn.neural_network import MLPClassifier
#from answerer import tsv2mat
import numpy as np
from sklearn.preprocessing import OneHotEncoder
# it might work better for larger databases
def_learner=MLPClassifier(
hidden_layer_sizes=(16,16),
... |
from django.urls import path
from . import views
urlpatterns = [
path('exception/<int:jid>', views.exception_receiver),
] |
import csv
import logging
import os
from flask import Blueprint, render_template, abort, url_for,current_app
from flask_login import current_user, login_required
from jinja2 import TemplateNotFound
from app.db import db
from app.db.models import Song
from app.songs.forms import csv_upload
from werkzeug.utils import s... |
"""The test for the min/max sensor platform."""
import unittest
from homeassistant.setup import setup_component
from homeassistant.const import (
STATE_UNKNOWN, STATE_UNAVAILABLE, ATTR_UNIT_OF_MEASUREMENT, TEMP_CELSIUS,
TEMP_FAHRENHEIT)
from tests.common import get_test_home_assistant
class TestMinMaxSensor(... |
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
from django.views.generic.base import TemplateView
from mysite.core import views
urlpatterns = [
path('', TemplateView.as_view(template_name='home.html'), name='home'... |
# Copyright 2018 The TensorFlow Hub Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
"""
Learning the shape of an object using uncertainty based sampling.
In this example, we will demonstrate the use of ActiveLearner with
the scikit-learn implementation of the kNN classifier algorithm.
"""
import numpy as np
from copy import deepcopy
from sklearn.ensemble import RandomForestClassifier
from modAL.mode... |
"""
Data module
***********
"""
from .data import (el_nino, tahiti, mascaret, marthe)
__all__ = ['el_nino', 'tahiti', 'mascaret', 'marthe'] |
import os
import warnings
from typing import Dict
from typing import List
from typing import Tuple
from typing import Union
import pytest
from flake8_nb.parsers import CellId
from flake8_nb.parsers.notebook_parsers import InputLineMapping
from flake8_nb.parsers.notebook_parsers import InvalidNotebookWarning
from flak... |
import _plotly_utils.basevalidators
class FontValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(
self, plotly_name='font', parent_name='layout.legend', **kwargs
):
super(FontValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_na... |
from crypto_news_api import CryptoControlAPI
import pandas as pd
# Connect to the CryptoControl API
api = CryptoControlAPI("c570bf2c119d13e0cc9eb0b3d69d414d")
# Connect to a self-hosted proxy server (to improve performance) that points to cryptocontrol.io
proxyApi = CryptoControlAPI(
"c570bf2c119d13e0cc9eb0b3d69d4... |
import sys
import json
from aiohttp.client_exceptions import ClientError
from kivy import base, utils
from kivy.clock import Clock
from kivy.core.window import Window
from kivy.factory import Factory
from kivy.lang import Builder
from kivy.uix.label import Label
from kivy.utils import platform
from electrum_zcash.gui... |
# Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.b (the "License");
# you may not use this file except in compliance with the License.
#
#
""" Userbot module for having some fun with people. """
import asyncio
import random
import re
import time
from use... |
# -*- coding: utf-8 -*-
"""
BitmapPanel | Adds a bitmap as the background on a wxPanel.
Version 1.0
Requires: wxPython, resource_path.py (v1.0)
@author: Kinetos#6935
"""
import wx
from helpers_pyinstaller import resource_path
# --------------------------------------------------------------------------- #
class Bi... |
"""
Contraction Clustering (RASTER):
Reference Implementation in Python with an Example
(c) 2016, 2017 Fraunhofer-Chalmers Centre for Industrial Mathematics
Algorithm development and implementation:
Gregor Ulm (gregor.ulm@fcc.chalmers.se)
Requirements:
. Python 3
. external libraries: numpy, pandas, matplotlib
This... |
# 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
# distr... |
def clockwise_spiral:
print clockwise_spiral([[1, 2, 3, 4, 5],
[6, 7, 8, 9, 10],
[11, 12, 13, 14, 15],
[16, 17, 18, 19, 20]]) |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import functools
import multiprocessing as mp
import os
import time
import numpy as np
from lvis import LVIS
from pycocotools import mask as maskUtils
def annToRLE(ann, img_size):
h, w = img_size
segm = ann['segmentation']
if type(se... |
import sys
# from visualize.visual import *
import h5py
import json
import random
import cv2
import numpy as np
import os
from skimage.transform import resize
from skimage.filters import gaussian
import matplotlib.pyplot as plt
from scipy import misc
font=cv2.FONT_HERSHEY_SIMPLEX
false_results_dir = "vqa-mfb/mfb_coat... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
example.py
~~~~~~~~~
A simple command line application to run flask apps.
:copyright: 2019 Miller
:license: BSD-3-Clause
"""
# Known bugs that can't be fixed here:
# - synopsis() cannot be prevented from clobbering existing
# loaded modules.
... |
from math import log
import pytest
from charge.chargers import CDPCharger, DPCharger, ILPCharger, MeanCharger, MedianCharger, ModeCharger, \
SymmetricILPCharger, SymmetricDPCharger, SymmetricCDPCharger
def test_mean_charger(mock_repository, ref_graph):
charger = MeanCharger(mock_repository, 2)
charger.c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.