text stringlengths 2 999k |
|---|
#!/usr/bin/env python
try:
import unittest2 as unittest
except ImportError:
import unittest
from csvkit import sql
from csvkit import table
from sqlalchemy import BigInteger, Boolean, Date, DateTime, Float, Integer, String, Time
class TestSQL(unittest.TestCase):
def setUp(self):
self.csv_table =... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
""" [2018] vbyk
"""
################## vim:fenc=utf-8 tabstop=8 expandtab shiftwidth=4 softtabstop=4
import sys
import os
import pdb
import sqlite3
"""
-- sample trace file format --
tick: 2; tid: 4; ev_ts: top; lvl: 1; lno: 80; name: recv
tick: ... |
# MIT License
#
# Copyright (c) 2022 Quandela
#
# 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, modify, merge, pub... |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Pershyancoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Functionality to build scripts, as well as SignatureHash().
This file is modified from python-per... |
"""
This module provides the molior ProjectVersionDependency
database model.
"""
from sqlalchemy import Column, Integer, ForeignKey, Table, UniqueConstraint
from .database import Base
ProjectVersionDependency = Table( # pylint: disable=invalid-name
"projectversiondependency",
Base.metadata,
Column("projec... |
"""Core XML support for Python.
This package contains three sub-packages:
dom -- The W3C Document Object Model. This supports DOM Level 1 +
Namespaces.
parsers -- Python wrappers for XML parsers (currently only supports Expat).
sax -- The Simple API for XML, developed by XML-Dev, led by David
Meggins... |
#!/usr/bin/env python3
# Copyright (c) 2017-2019 The Rhombus Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import time
from test_framework.test_rhombus import RhombusTestFramework
from test_framework.messages im... |
# coding=utf-8
# Copyright 2018 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
from flask import Flask, render_template
from flask_bcrypt import Bcrypt
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
from flask_restplus import Api
from app.config import BaseConfig
app = Flask(__name__)
app.config.from_object(BaseConfig)
app.config.from_envvar('APP_CONFIG')
# regis... |
# Django settings for openeats project.
import os, datetime
# We can't set the debug just using the env var.
# Python with evaluate any string as a True bool.
DEBUG = False
if os.environ.get('DJANGO_DEBUG', 'False').lower() == 'true':
DEBUG = True
SERVE_MEDIA = True
# Build paths inside the project like this: os... |
#!/usr/bin/env python
import pycondor
if __name__ == "__main__":
# Declare the error, output, log, and submit directories for Condor Job
error = 'condor/error'
output = 'condor/output'
log = 'condor/log'
submit = 'condor/submit'
# Setting up first PyCondor Job
job1 = pycondor.Job('exampl... |
# Django settings for VOS project.
from os import path
# Set the debug values
DEBUG = False
DEBUG_TOOLBAR = False
# Notification admins
ADMINS = ()
# Set managers to admins
MANAGERS = ADMINS
# Package out-of-date emails for orphans
#NOTIFICATIONS = ['']
# Full path to the data directory
DEPLOY_PATH = path.dirname(... |
import os
import chess.engine
# make sure stockfish environment variable exists
if "STOCKFISH_EXECUTABLE" not in os.environ:
raise KeyError('This bot requires an environment variable called "STOCKFISH_EXECUTABLE"'
' pointing to the Stockfish executable')
# make sure there is actually a file
STO... |
"""Functions dealing with config-user.yml / config-developer.yml."""
import collections.abc
import datetime
import fnmatch
import logging
import os
import sys
import warnings
from functools import lru_cache
from pathlib import Path
import yaml
from esmvalcore.cmor.table import CMOR_TABLES, read_cmor_tables
from esmva... |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for POSIX-based L{IReactorProcess} implementations.
"""
import errno, os, sys
try:
import fcntl
except ImportError:
platformSkip = "non-POSIX platform"
else:
from twisted.internet import process
platformSkip = None
fro... |
def good_phone(phone):
if not phone:
return False
return len(phone) == 13 and phone[:4] == "+375" and phone[1:].isdigit()
|
# MIT License
#
# Copyright (c) 2020 Mechatronics and Haptic Interfaces Lab
#
# 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... |
import math
import numpy as np
import scipy.special
from optuna import distributions
from optuna.pruners import HyperbandPruner
from optuna.samplers import base
from optuna.samplers import random
from optuna.samplers.tpe.parzen_estimator import _ParzenEstimator
from optuna.samplers.tpe.parzen_estimator import _Parzen... |
# Imports from libraries
from typing import Dict
from pytups import SuperDict, TupList
# Imports from cornflow libraries
from cornflow_client import ExperimentCore
# Imports from internal modules
from .instance import Instance
from .solution import Solution
class Experiment(ExperimentCore):
def __init__(self, i... |
#!/usr/bin/python3
# *****************************************************************************
# Copyright 2004-2008 Steve Menard
#
# 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
#
# ... |
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/01_layers.ipynb (unless otherwise specified).
from __future__ import annotations
__all__ = ['module', 'Identity', 'Lambda', 'PartialLambda', 'Flatten', 'ToTensorBase', 'View', 'ResizeBatch',
'Debugger', 'sigmoid_range', 'SigmoidRange', 'AdaptiveConcatPool1d... |
"""
===================================================
Segmenting the picture of a raccoon face in regions
===================================================
This example uses :ref:`spectral_clustering` on a graph created from
voxel-to-voxel difference on an image to break this image into multiple
partly-homogeneous... |
from collections import namedtuple
from datetime import datetime
from eventsourcing.domain.services.transcoding import AbstractTranscoder
from eventsourcing.domain.services.transcoding import ObjectJSONDecoder
from eventsourcing.domain.services.transcoding import id_prefix_from_event
from eventsourcing.domain.services.... |
# Generated by Django 2.1 on 2019-05-27 13:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('stacks', '0002_auto_20190527_1151'),
]
operations = [
migrations.AddField(
model_name='stack',
name='download_url',
... |
#
# Copyright (c) 2015, Intel Corporation.
#
# SPDX-License-Identifier: GPL-2.0-only
#
# AUTHORS
# Ed Bartosh <ed.bartosh@linux.intel.com>
"""Test cases for wic."""
import os
import sys
import unittest
from glob import glob
from shutil import rmtree, copy
from functools import wraps, lru_cache
from tempfile import N... |
# 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... |
#!/usr/bin/env python
"""
@file ion/util/test/test_resource_lcs_policy.py
@author Ian Katz
@test ion.util.resource_lcs_policy Unit test suite
"""
from unittest.case import SkipTest
from ion.util.geo_utils import GeoUtils
from pyon.public import IonObject, RT, log
from nose.plugins.attrib import attr
from pyon.util.u... |
"""
Profile Model Access
"""
import logging
from ozpcenter import models
from django.contrib import auth
import ozpcenter.model_access as generic_model_access
from plugins.plugin_manager import system_has_access_control
logger = logging.getLogger('ozp-center.' + str(__name__))
def get_self(username):
"""
... |
#!/usr/bin/env python3
# Copyright (c) 2014-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Helpful routines for regression testing."""
from base64 import b64encode
from binascii import unhexlif... |
import subprocess
import gzip
import os
def main():
print("Building container image")
subprocess.run(
[
"docker",
"build",
"container",
"--platform",
"linux/amd64",
"--tag",
"dangerzone.rocks/dangerzone",
]
... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... |
#!/usr/bin/env python
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for
# full license information.
import credentials
print (credentials.login['ConnectionString'])
import random
import time
import sys
from iothub_client import IoTHubClient, IoTH... |
import numpy as np
import pytest
from pandas.core.dtypes.common import ensure_platform_int
import pandas as pd
from pandas import Float64Index, Index, Int64Index, RangeIndex
import pandas.util.testing as tm
from ..test_numeric import Numeric
# aliases to make some tests easier to read
RI = RangeIndex
I64 = Int64Ind... |
#!/usr/bin/python
import pyrebase
import subprocess
import os
home = os.path.expanduser('~')
url = 'scouting-2018-houston'
config = {
'apiKey': 'mykey',
'authDomain': url + '.firebaseapp.com',
'databaseURL': 'https://' + url + '.firebaseio.com/',
'storageBucket': url + '.appspot.com'
}
firebase = pyrebase.initi... |
import logging
from dataclasses import dataclass, field
from typing import Any, Dict, List, NamedTuple, Optional, Union
from eth_utils.address import to_checksum_address
from gevent.lock import Semaphore
from typing_extensions import Literal
from rotkehlchen.chain.ethereum.manager import EthereumManager, address_to_b... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2019 The FATE 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/lic... |
import pygame
class MenuGame:
def __init__(self):
self.menu_font = pygame.font.Font("game/fonts/menu_font.ttf", 24)
self.name_font = pygame.font.Font("game/fonts/name_font.ttf", 30)
self.cre_by = pygame.font.Font("game/fonts/menu_font.ttf", 14)
self.score_font = pygame.font.Font("g... |
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... |
import pygame
import math
import copy
from objects.controllable import Hiding, Seeker
from objects.fixed import Wall
from ext.supportive import Point, Collision, MapGenerator
import random
from ext.loggers import LOGGING_DASHES, logger_engine, logger_hiding, logger_seeker
import numpy as np
from ext.config import confi... |
import numpy as np
from pytorchrl.agent.env.openai_baselines_dependencies.vec_env.vec_env import VecEnv
from pytorchrl.agent.env.openai_baselines_dependencies.vec_env.util import copy_obs_dict, dict_to_obs, obs_space_info
class DummyVecEnv(VecEnv):
"""
VecEnv that does runs multiple environments sequentially,... |
"""
Pyperclip
A cross-platform clipboard module for Python, with copy & paste functions for plain text.
By Al Sweigart al@inventwithpython.com
BSD License
Usage:
import pyperclip
pyperclip.copy('The text to be copied to the clipboard.')
spam = pyperclip.paste()
if not pyperclip.is_available():
print("Cop... |
import tensorflow as tf
import tensorflow.keras.models as models
import tensorflow.keras.layers as layers
from common import EncoderResidualBlock, Swish
class ConvBlock(layers.Layer):
def __init__(self, in_channels, out_channels):
super(ConvBlock, self).__init__()
self._seq = mo... |
"""
Parallel Files
~~~~~~~~~~~~~~
The VTK library supports parallel file foramts. Reading meshes broken up into
several files is natively supported by VTK and ``vtki``
"""
# sphinx_gallery_thumbnail_number = 1
import vtki
from vtki import examples
import os
############################################################... |
# used for sanity checking the test harness
# a NOP "pass" test
|
# -*- coding: utf8 -*-
"""
Functions used for estimating position from spike trains and fitting trajectory of the animal (used for sequence replay detection)
based on: Davison et al. 2009 (the difference is that the tau_i(x) tuning curves are known here, since we generated them... see: `poisson_proc.py`)
author: András... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
# coding: utf-8
from __future__ import absolute_import
from django.conf.urls import url
from .views import spell_check, filebrowser, css, spell_check_callback
urlpatterns = [
url(r'^spellchecker/$', spell_check, name='tinymce-spellchecker'),
url(r'^filebrowser/$', filebrowser, name='tinymce-filebrowser'),
... |
import setuptools
with open('README.md', 'r', encoding='utf-8') as fh:
long_description = fh.read()
setuptools.setup(
name='symbiotic',
version='1.0.0-alpha3',
author='Stefano Frazzetto',
author_email='stefano+symbiotic@hey.com',
license='Apache-2.0',
description='Connect your smart device... |
# forward checking algorithm for magnet puzzle problem
import AC3
import MRV
import LCV
from puzzle import Puzzle
def backtrack_search():
assignment = puzzle.variables.copy()
return forward_check(assignment)
def forward_check(assignment):
assigned_count = len(list(filter(lambda x: type(x) is str, assi... |
class ToolTipEventArgs(RoutedEventArgs):
""" Provides event information for events that occur when a tooltip opens or closes. """
|
import argparse
import os.path
from unittest import mock
import pytest
import pre_commit.constants as C
from pre_commit import main
from pre_commit.error_handler import FatalError
from testing.auto_namedtuple import auto_namedtuple
@pytest.mark.parametrize(
('argv', 'expected'),
(
((), ['f']),
... |
# Copyright 2010-2018 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... |
from __future__ import print_function, division, absolute_import
import collections
import itertools as it
import math
import toolz
from toolz import curry, curried
__all__ = [
'DaskCounter',
'DaskDict',
'RuleSet',
'apply',
'chained',
'extension_rules',
'mean',
'repartition',
'ru... |
import argparse
import numpy as np
import tensorflow as tf
from typing import List
from datetime import datetime
import yaml
try:
from yaml import CLoader as Loader, CDumper as Dumper
except ImportError:
from yaml import Loader, Dumper
def matmul(shape_a: List[int], shape_b: List[int], output_file: str) -> No... |
from temboo.Library.Zendesk.UserIdentities.AddUserIdentity import AddUserIdentity, AddUserIdentityInputSet, AddUserIdentityResultSet, AddUserIdentityChoreographyExecution
from temboo.Library.Zendesk.UserIdentities.AddUserIdentityByEndUser import AddUserIdentityByEndUser, AddUserIdentityByEndUserInputSet, AddUserIdentit... |
# -*- coding: utf-8 -*-
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
from collections import OrderedDict
from difflib import unified_diff
from os.path import splitext
from pathlib import Path
from mezzanine.pages.models import Page
from me... |
import libsalt
import math
def test(salt_scenario):
# for i in range(2):
libsalt.start(salt_scenario)
#libsalt.setCurrentStep(25200)
step = libsalt.getCurrentStep()
while step <= 87000:
#while step <= 36000:
if (step % 10 == 0):
#print("Simulation... |
from django.views.generic import TemplateView
from django.utils.decorators import method_decorator
from django.contrib.auth.decorators import login_required
from django.conf import settings
class OauthView(TemplateView):
template_name = "core/oauth.html"
def get_context_data(self, **kwargs):
return_u... |
#! /usr/bin/env python3
import subprocess
import os
import argparse
import time
import glob
from shutil import copy
from itertools import groupby, count
import vcstools.metadb_utils as meta
parser = argparse.ArgumentParser(description="""
Wraps the splice_psrfits.sh script to automate it. Should be run from the foul... |
"""
Copyright BOOSTRY 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 in writing,
software distr... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from nest import NestMsClient
if __name__ == '__main__':
HOST ='localhost'
PORT = 7086
client = NestMsClient(HOST, PORT)
pattern = 'TEST_PATTERN'
res = client.send(pattern, None)
print(res)
pattern = { 'cmd' :'TEST_PATTERN' }
res = client.se... |
import warnings
def deprecated(message):
def deprecated_decorator(func):
def deprecated_func(*args, **kwargs):
warnings.warn("{} is a deprecated function. {}".format(func.__name__, message),
category=DeprecationWarning,
stacklevel=2)
warnings.... |
# Copyright European Organization for Nuclear Research (CERN)
#
# 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
#
# Authors:
# - Martin Barisits, <m... |
"""
scaffoldgraph.prioritization.prioritization_rules
Implements abstract rules for scaffold prioritization when constructing scaffold trees
"""
from abc import ABCMeta, abstractmethod
from itertools import compress
class BaseScaffoldFilterRule(metaclass=ABCMeta):
"""Abstract base class for defining rules for s... |
import numpy as np
from qibo.models import Circuit
from qibo import gates, K
from datasets import create_dataset, create_target, fig_template, world_map_template
from matplotlib.cm import get_cmap
from matplotlib.colors import Normalize
import os
class single_qubit_classifier:
def __init__(self, name, layers, gri... |
"""SimpleProject URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/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... |
#! /usr/bin/env python
# -*- coding:utf-8 -*-
"""
@author: Vesper Huang
"""
class Solution(object):
def convertInteger(self, A, B):
"""
:type A: int
:type B: int
:rtype: int
"""
tmp = A ^ B
count = 0
for i in range(32):
count += tmp & 1
... |
#!/usr/bin/python3
"""
userrights.py
MediaWiki Action API Code Samples
Demo of `Userrights` module: Add and remove user rights by
changing the user's group membership.
MIT license
"""
import requests
S = requests.Session()
URL = "https://test.wikipedia.org/w/api.php"
# Step 1: Retrieve a login... |
# -*- coding: utf-8 -*-
""" Module summary description.
More detailed description.
"""
from math import ceil
# __all__ = []
# __version__ = '0.1'
__author__ = 'Benjamin Pillot'
__copyright__ = 'Copyright 2018, Benjamin Pillot'
__email__ = 'benjaminpillot@riseup.net'
def flatten(alist):
""" Return a list of it... |
#!/usr/bin/env python
import os
import sys
if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings.local')
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure tha... |
# Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# This file is 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://aws.amazon.com/apache2.0/
#
# This file is d... |
import collections
import logging
import pkg_resources
from datahelpers.DataHelperML import DataHelperML
from datahelpers.Data import AAData
from datahelpers.Data import LoadMethod
class DataHelperMLNormal(DataHelperML):
Record = collections.namedtuple('Record', ['file', 'author', 'content'])
problem_name = ... |
import unittest
import numpy as np
from tensorflow import keras
from tensorflow.keras import backend as K
from keras_bert.layers import TaskEmbedding
class TestTaskEmbedding(unittest.TestCase):
def test_mask_zero(self):
embed_input = keras.layers.Input(shape=(5, 4))
task_input = keras.layers.In... |
# Copyright (c) 2016 Hewlett-Packard Enterprise Development Company, L.P.
#
# 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... |
"""
Copyright (C) 2016 Garry Lachman garry@lachman.co under GNU LGPL
https://github.com/garrylachman/PyProxyToolkit
https://rev.proxies.online
This library is free software; you can redistribute it and/or modify it under the terms of the
GNU Lesser General Public License version 2.1, as published by the Free Software ... |
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
a = [list(map(int, readline().split())) for i in range(3)]
n = int(readline())
b = [int(readline()) for _ in range(n)]
for bb in b:
for j in range(3):
for k in ... |
import os
import wbuild
import drop
import sys
from unittest.mock import patch
from .common import *
@pytest.yield_fixture(scope="session", autouse=True)
def demo_dir(tmpdir_factory):
"""
Directory containing files downloaded from Gagneurlab ready to run the demo pipeline
:param testdirectory: inherits fr... |
#!/usr/bin/env python
# Class autogenerated from /home/sam/Downloads/aldebaran_sw/nao/naoqi-sdk-2.1.4.13-linux64/include/alproxies/alwavingdetectionproxy.h
# by Sammy Pfeiffer's <Sammy.Pfeiffer at student.uts.edu.au> generator
# You need an ALBroker running
from naoqi import ALProxy
class ALWavingDetection(object):... |
#!/usr/bin/python
import sys
import _commoncrypto
digest2hex = lambda s: ''.join([hex(ord(x))[2:].zfill(2) for x in s])
def md5(handler):
ctx = _commoncrypto.MD5_Init()
while True:
line = handler.readline(1024)
if len(line) == 0: break
_commoncrypto.MD5_Update(ctx, line)
s = _comm... |
import os
import numpy as np
import tensorflow.keras as keras
from tensorflow.keras.preprocessing import image
from tensorflow.keras import layers
latent_dim = 32
height = 32
width = 32
channels = 3
# =========================================
generator_input = keras.Input(shape=(latent_dim,))
# First, transform th... |
# Copyright 2017 Google Inc. 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 applicable law or ag... |
import os
from jina.flow import Flow
cur_dir = os.path.dirname(os.path.abspath(__file__))
def test_visualization_with_yml_file_img(tmpdir):
Flow.load_config(os.path.join(cur_dir, '../yaml/test_flow_visualization.yml')).plot(
output=os.path.join(tmpdir, 'flow.svg')
)
assert os.path.exists(os.path... |
"""
This module defines handlers for storing sessions when handles
sessions of users connecting to the server.
There are two similar but separate stores of sessions:
ServerSessionHandler - this stores generic game sessions
for the game. These sessions has no knowledge about
how they are connected t... |
from ProblemFeatures import Problema, No, Auxiliar
from Buscas.Cega import Cega
from Buscas.Local import Local
from Problemas.Puzzle8 import Puzzle8
from Problemas.Rainhas import Rainhas
import time
class Main:
def executar(self):
ini = time.time() #Tempo
Select = Rainhas() #Selecionar qual o prob... |
#!/usr/bin/env python3
# Copyright (c) 2016 The DonCoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import DonCoinTestFramework
from test_framework.util import (
start_nod... |
import d6tflow
import luigi
import sklearn, sklearn.datasets, sklearn.svm
import pandas as pd
# define workflow
class TaskGetData(d6tflow.tasks.TaskPqPandas): # save dataframe as parquet
def run(self):
iris = sklearn.datasets.load_iris()
df_train = pd.DataFrame(iris.data,columns=['feature{}'.for... |
from tqdm import tqdm
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.distributions import Categorical
import numpy as np
import gym
import random
from tqdm import tqdm
from collections import namedtuple, deque
from network import DuelingNetwork, Branc... |
# Copyright 2021 Edward Leardi. All Rights Reserved.
#
# Copyright 2020 IBM Corp. 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/L... |
# 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... |
""" Decorator Parametors
In the previous ideos we saw some built-in decorators that can handle some arguments:
@wraps(fn) @lru_cache(maxsize=256) <\
def inner(): def factorial(n): \
... ... \>function call
This should loo... |
# Copyright (c) 2013, mike wakerly <opensource@hoho.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of source code must retain the above copyright notice, this
# list of c... |
# download youtube video
vid_url = 'https://www.youtube.com/watch?v=dj8wKg2OOUo'
# import library
from pytube import YouTube
# get the video
youtube = YouTube(vid_url)
# get the info
print('Title: %s' % (youtube.title))
print('ID : %s' % (youtube.video_id))
print('AGE RESTRICTED: %s' % (youtube.age_restricted))
#... |
from oempro.api import Client |
import string
import unittest
from email import _header_value_parser as parser
from email import errors
from email import policy
from test.test_email import TestEmailBase, parameterize
class TestTokens(TestEmailBase):
# EWWhiteSpaceTerminal
def test_EWWhiteSpaceTerminal(self):
x = parser.EWWhiteSpace... |
"""This pipeline is intended for selecting the more appropriate feature"""
import os
import numpy as np
from sklearn.externals import joblib
from collections import Counter
path_feat_sel = '/data/prostate/results/mp-mri-prostate/exp-3/selection-extraction/rf/adc/feat_sel.pkl'
# Load the data and select the 5th perce... |
default_app_config = 'server.apps.ServerAppConfig'
|
from surprise import SVD
from surprise import Dataset, print_perf, Reader
from surprise.model_selection import cross_validate
import os
# 指定文件所在路径
file_path = os.path.expanduser('mydata.csv')
# 告诉文本阅读器,文本的格式是怎么样的
reader = Reader(line_format='user item rating', sep=',')
# 加载数据
data = Dataset.load_from_file(fi... |
"""empty message
Revision ID: 2cc127c4ea12
Revises:
Create Date: 2020-05-12 20:18:08.387848
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '2cc127c4ea12'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto gene... |
# -- coding: utf-8 --
import random
import StringIO
import sys
import time
import pycurl
from . import Fetcher
from ..core.task import Task
from ..core.settings import settings
class Sock5Fetcher(Fetcher):
def __init__(self):
Fetcher.__init__(self)
def url_fetch(self, url, useProxy=False):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.