content stringlengths 5 1.05M |
|---|
"""Tests for the diagnostics data provided by the PVOutput integration."""
from aiohttp import ClientSession
from homeassistant.core import HomeAssistant
from tests.common import MockConfigEntry
from tests.components.diagnostics import get_diagnostics_for_config_entry
async def test_diagnostics(
hass: HomeAssis... |
import pymongo
import sys
# establish a connection to the database
connection = pymongo.Connection("mongodb://localhost", safe=True)
def insert():
# get a handle to the school database
db=connection.school
people = db.people
print "insert, reporting for duty"
richard ={"name... |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import io
import itertools
import os.path
import sys
from operator import attrgetter
import pkg_resources
import pytest
installed_things = {
pkg.key: pkg
for pkg in pkg_resources.working_set
... |
# Given the head of a singly linked list, reverse the list, and return the reversed list.
#
#
# Example 1:
#
#
# Input: head = [1,2,3,4,5]
# Output: [5,4,3,2,1]
#
#
# Example 2:
#
#
# Input: head = [1,2]
# Output: [2,1]
#
#
# Example 3:
#
#
# Input: head = []
# Output: []
#
#
#
# Constraints:
#
#
# The number of n... |
from .generate_application_entrypoint import generate_application_entrypoint
from .generate_tool_alias import generate_tool_alias
from .wine_reg_add import wine_reg_add
|
import pytest
from numpy import nan
from pandas import DataFrame
from df_to_azure import df_to_azure
def test_wrong_method():
"""
Not existing method
"""
df = DataFrame()
with pytest.raises(ValueError):
df_to_azure(
df=df,
tablename="wrong_method",
sche... |
import dataclasses
import re
from typing import List, Optional, Tuple, Union
from . import helpers
from .helpers import MatchError
from .js_enum import JsEnum
from .js_function import JsFunction
from .js_object import JsClass, JsObject
from .js_type import JsTypeAlias
from .models import Context, NamespaceContext, ToR... |
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.cm as cm
def plot_levels(func, xrange=None, yrange=None, levels=None):
"""
Plotting the contour lines of the function.
Example:
--------
>> oracle = oracles.QuadraticOracle(np.array([[1.0, 2.0], [2.0, 5.0]]), n... |
# coding=utf-8
# Copyright 2022 The Fiddle-Config 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... |
name = 'relimp'
|
#!/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... |
# Index 1: ICG formula
def get_index_1(x):
index = (x[:, :, 60] +
x[:, :, 61] +
x[:, :, 62] +
x[:, :, 63] +
x[:, :, 64] +
x[:, :, 65] +
x[:, :, 66]) / 7
return index
|
# -*- coding: utf-8 -*-
# Generated by Django 1.9.10 on 2016-11-10 13:36
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("base", "0069_auto_20161103_0829"),
]
operations = [
migrations.AlterField(
... |
#!/usr/bin/python
#coding=utf8
"""
# Created : 2018/12/24
# Version : python2.7
# Author : yibo.li
# File : __init__.py
# Desc :
"""
|
# Copyright (c) 2014 Stefan C. Mueller
# 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, publish, di... |
#!/usr/bin/env python
######################################################################################################################
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# ... |
from .list_s3 import list_s3
from .metadata import metadata
from .mosaic import mosaic
from .mosaic_bulk import mosaic_bulk
|
#!/usr/bin/env python3
import os
from collections import namedtuple, defaultdict
dir_path = os.path.dirname(os.path.realpath(__file__))
file = open(dir_path + "/input.txt", "r")
lines = [l.strip() for l in file.readlines()]
# lines = [
# 'mask = XXXXXXXXXXXXXXXXXXXXXXXXXXXXX1XXXX0X',
# 'mem[8] = 11',
# 'mem[7]... |
# 6.22
mapping = {
2: ["a", "b", "c"],
3: ["d", "e", "f"],
4: ["g", "h", "i"],
5: ["j", "k", "l"],
6: ["m", "n", "o"],
7: ["p", "q", "r", "s"],
8: ["t", "u", "v"],
9: ["w", "x", "y", "z"]
}
def get_mnemonics_recursive(ph_num, mnemonic):
if len(ph_num) == 0:
print mnemonic
... |
# -*- coding: UTF-8 -*-
# Copyright (C) 2019, Raffaello Bonghi <raffaello@rnext.it>
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above cop... |
from flask import Blueprint, render_template, abort, request, redirect, session
from flask.ext.login import current_user, login_user, logout_user
from datetime import datetime, timedelta
from KerbalStuff.email import send_confirmation, send_reset
from KerbalStuff.objects import User, Mod
from KerbalStuff.database impor... |
# Copyright (c) 2016 NIST
# All Rights Reserved.
# Author: Junkai Huang
import os
import sys
import requests
import socket
import six
from threading import Thread
from multiprocessing import Process
from pprint import pprint
import configparser
INI_FILE_PATH= 'setting.conf'
class _Proxy(Process):
def __i... |
from .dao_generate_config import DaoGenerateConfig
from .generate_config import GenerateConfig
from .generator import Generator
from .query_generate_config import QueryGenerateConfig
|
from django.contrib import admin
# Register your models here.
from gym.models import Gym, GymImage
admin.site.register(Gym)
admin.site.register(GymImage) |
import logging
from asyncio import AbstractEventLoop as EventLoop
import pytest
from fastapi.testclient import TestClient
from app import crud
from app.core.security import verify_password
from app.models import User
from app.schemas import UserCreateBySuperuser, UserCreateMe
from app.schemas.user import UserUpdateBy... |
"""Store Imports and Initialization Unit Tests"""
import subprocess
import time
from pytest import fixture, raises
import proxystore as ps
REDIS_HOST = 'localhost'
REDIS_PORT = 59465
@fixture(scope='session', autouse=True)
def init() -> None:
"""Launch Redis Server for Tests"""
redis_handle = subprocess.Po... |
# This file is part of GridCal.
#
# GridCal is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GridCal is distributed in the hope that... |
from fastapi import FastAPI
from .endpoints import router as endpoints_router
from .redis import router as redis_router
from .settings import settings
app = FastAPI(debug=settings.DEBUG)
app.include_router(redis_router)
app.include_router(endpoints_router)
if __name__ == '__main__': # pragma: no cover
from uvic... |
__author__ = 'anthonymendoza'
from rest_framework import serializers
from django.apps import apps
class CountrySerializer(serializers.ModelSerializer):
class Meta:
model = apps.get_model("water_store", "Country")
fields = ('id', 'name', 'abbreviation', 'country_code')
read_only_fields = [... |
# -*- coding:utf-8 -*-
from flask import current_app, render_template_string
import mimetypes, os, logging
from frequests import requests
from models import Settings
mimetypes.init()
def guess_mimetype(name):
type_found = mimetypes.guess_type(name)
if type_found:
return type_found[0] # Best guess
... |
# Copyright 2018 Open Source Robotics Foundation, 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... |
# GENERATED BY KOMAND SDK - DO NOT EDIT
from .get_findings.action import GetFindings
|
"""
Initialize an SQLite database
in the db directory.
File name is "sqlite.db".
Designed to be invoked from one level up, i.e.,
run 'python3 db/initdb-sqlite.db' from the
main Flask directory.
M Young, April 2016 for CIS 422
"""
DBFILE = "db/sqlite.db"
from schema import DBSCHEMA_SQL
import arrow # Date-Time modu... |
import pygame
from pygame.sprite import Sprite
class Alien_Bullet(Sprite):
"""A CLASS TO MANAGE BULLETS FIRED FROM THE SHIP"""
def __init__(self, ai_settings, screen, alien):
"""CREATE A BULLET OBJECT AT THE SHIP'S CURRENT POSITION"""
super(Alien_Bullet, self).__init__()
self.screen = ... |
# -*- coding:utf-8 -*-
import logging
import os
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s %(filename)s[%(lineno)d] %(levelname)s %(message)s')
logger = logging.getLogger()
logger_dir = os.getenv("MADDPG_LOG_DIR")
if logger_dir is None or logger_dir == "":
logger_dir = os.path.join("/t... |
"""
olintut module.
---------------
Source code for tech talk: https://docs.google.com/presentation/d/1lDDqROrpEvDYb1TcDBQBwKLQjWyTT0gs4vN1-2sraMg/edit#slide=id.g4e2f016a03_1_5
Author: Chris Lee
Email: chris@indico.io
""" |
# GUIWiki.py
import wikipedia
#python to docx
from docx import Document
def Wiki(keyword,lang='th'):
wikipedia.set_lang(lang)
# summary สำหรับบทความที่สรุป
data = wikipedia.summary(keyword)
#page + content บทความทั้งหน้า
data2 = wikipedia.page(keyword)
data2 = data2.content
... |
import os
import numpy as np
import pandas as pd
from torch.utils.data import Dataset, DataLoader
class DiabetesDataset(Dataset):
"""
docstring - todo
"""
def __init__(self, df, continuous_features=None,
categorical_features=None, output_features=None):
"""
docstring ... |
import sys
import re
import snowballstemmer
def usage():
print("testapp.py <algorithm> \"sentence\"...")
def main():
argv = sys.argv
if len(argv) < 1:
usage()
return
algorithm = 'english'
if len(argv) > 2:
algorithm = argv[1]
argv = argv[2:]
else:
argv ... |
# Copyright 2020 Google LLC
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
from setuptools import find_packages, setup
install_requires = [
'sqlparse >= 0.3.0',
'google-cloud >= 0.34.0',
... |
from zope.interface import implementer
from twisted.plugin import IPlugin
from twisted.application.service import IServiceMaker
from carbon import conf
@implementer(IServiceMaker, IPlugin)
class CarbonCacheServiceMaker(object):
tapname = "carbon-cache"
description = "Collect stats for graphite."
option... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
set_length = 20000 #20000 is the number we used for the parameter sweep initially
sampling_rate = 700
frequency = 60 #analogous to heart rate (per minute)
high = 0.5
low = -0.5
squarewave_array = np.zeros([set_length])
period = int(60 * sampling_... |
# 811000500 - Princess No (pno)
response = sm.sendAskYesNo("Would you like to leave?")
if response:
sm.clearPartyInfo(811000100)
sm.dispose()
|
#!/usr/bin/python
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed... |
from __future__ import absolute_import
from functools import reduce
def get_value(d, *keys):
return reduce(lambda a, b: a[b], keys, d)
def first_item(l):
"""Returns first item in the list or None if empty."""
return l[0] if len(l) > 0 else None
class cache(object):
'''Computes attribute value and c... |
import os
from colormath.color_objects import sRGBColor, LabColor
from colormath.color_conversions import convert_color
from colormath.color_diff import delta_e_cie2000
import pyscreenshot as screenshot
import cv2
import numpy
import pyautogui
from pynput.keyboard import Key, Listener
def capture_region(region):
... |
"""
Initliazation file for library module.
"""
import csv
import datetime
import re
from email.utils import mktime_tz, parsedate_tz
from textwrap import shorten
import github
from etc import config
from github import UnknownObjectException
from .connection import CONN
# Match a ticket number like "ABC-123".
JIRA_TIC... |
import pytest
import argopy
from . import requires_connection
def test_invalid_dataset():
with pytest.raises(ValueError):
argopy.tutorial.open_dataset('invalid_dataset')
@requires_connection
def test_localftp_dataset():
ftproot, flist = argopy.tutorial.open_dataset('localftp')
assert isinstance(f... |
#print(prediction_probabilities)
#print(prediction_probabilities[0])
#raise
if 0:
num_batches = len(test_generator)
num_files = test_generator.n
batch_size = test_generator.batch_size
seen_files = 0
predictions_list = list()
t0 = time.... |
"""
performance.py
Created by Luca Camerani at 06/02/2021, University of Milano-Bicocca.
(l.camerani@campus.unimib.it)
All rights reserved.
This file is part of the EcoFin-Library (https://github.com/LucaCamerani/EcoFin-Library),
and is released under the "BSD Open Source License".
"""
import math
import json
from ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_django_serverless_cron
------------
Tests for `django_serverless_cron` admin module.
"""
from django.test import TestCase
from django.utils import timezone
from django_serverless_cron.admin import run_selected_jobs
from django_serverless_cron.models import JobR... |
import paramiko
import plotter
import time
import measurement
import sys
# Run python runner.py <config_file_path> to execute. Config file must be like 'default_config.config'
# It's important to include the appropriate ssh keys to be able to run ssh correctly.
CONST_SERVER_COMPILE = 'source $HOME/.cargo/env && cd r... |
from __future__ import division
import colorsys
import sys
def main(filepath):
with open(filepath, 'r') as f:
for line in f.readlines():
if line:
line = line.strip()
print convert_to_rgb(line)
def convert_to_rgb(colour_code):
if colour_code[0] ... |
import time
def test_boot(shell_command):
shell_command.run_check("true")
def test_phoc(shell_command):
time.sleep(5)
output, _, _ = shell_command.run("ps")
print("\n".join(output))
shell_command.run_check("pidof phoc")
def test_phosh(shell_command):
time.sleep(5)
output, _, _ = shell_... |
from .harness import MCMCTest
from pprint import pprint
import pytest
@pytest.mark.skip(reason="Pyro stuck forever")
def test_logistic():
data = {}
data['N'] = 7
data['M'] = 2
data['y'] = [0, 1, 1, 1, 1, 1, 1]
data['x'] = [[1, 1.329799263],
[1, 1.272429321],
[1, -1... |
import discord
import yaml
from src.utils.embeds_manager import EmbedsManager
with open('run/config/tokens.yml', 'r') as file:
tokens = yaml.safe_load(file)
async def end_request(client: discord.Client, message: discord.Message):
if message.author.id not in tokens['teacher_ids']:
return await messag... |
#-------------------------------------------------------------------------------
# op2mark.py
#
# converting an operator to its mark
#
# Copyright (C) 2013, Shinya Takamaeda-Yamazaki
# License: Apache 2.0
#-------------------------------------------------------------------------------
operator_mark = {
'Uminus':'... |
"""
Python money class with optional CLDR-backed locale-aware formatting
and an extensible currency exchange solution.
"""
from .money import Money, XMoney
from .exchange import xrates
__version__ = '1.2.1'
|
# -*- coding: utf-8 -*-
# @File : SimpleRewMsfModule.py
# @Date : 2019/1/11
# @Desc :
from Lib.ModuleAPI import *
class PostModule(PostMSFCSharpModule):
NAME_ZH = "MS17-010利用(CSharp)"
DESC_ZH = "模块内存执行定制版的Eternalblue.exe.\n" \
"模块支持Detect和Exploit两种模式,支持利用Win7及Win2008的MS17-010利用.\n" \
... |
import os
import random
from multiprocessing import cpu_count
import numpy as np
import paddle
from PIL import Image
# 测试图片的预处理
def train_mapper(sample):
img, crop_size = sample
img = Image.open(img)
# 随机水平翻转
r1 = random.random()
if r1 > 0.5:
img = img.transpose(Image.FLIP_LEFT_RIGHT)
... |
from django.contrib import admin
from django.db import models
from django.utils.text import slugify
from django.utils.translation import ugettext_lazy as _
class Unit(models.Model):
TYPE_CHOICES = [
('shopping', _('Shopping')),
('usage', _('Usage')),
]
name = models.CharField(verbose_name... |
from pytest import raises
from ..validators import parse_as_number, ValidationError
def test_validate_as_number():
assert parse_as_number('AS012345') == ('AS12345', 12345)
assert parse_as_number('as4294967290') == ('AS4294967290', 4294967290)
with raises(ValidationError) as ve:
parse_as_number('... |
class Vertex:
def __init__(self, node):
self.id = node
# Mark all nodes unvisited
self.visited = False
def add_neighbor(self, neighbor, G):
G.add_edge(self.id, neighbor)
def get_connections(self, G):
return G.adjMatrix(self.id)
def get_vertex_ID(self):
... |
#!/usr/bin/env python3
"""
This script requires describegraph.json and will generate its own config file.
Running on node hardware is not recommended, copy describegraph.json to a
desktop.
This script attempts to find peers that will substantially improve a node's
betweenness centrality. This does not guarantee that s... |
from storage.s3 import bucket_operator
from storage.base import BaseStorage
from typing import TypeVar, Union, Iterator, List
from boto3 import Session
import uuid
Boto3Session = TypeVar('Boto3Session', Session, None)
class S3Bucket(BaseStorage):
def __init__(self, client: Boto3Session = None, name: str = "", ti... |
#!/usr/bin/env python3
from sys import argv
from collections import defaultdict
import heapq
R=[]
with open(argv[1]) as fp:
for i, l in enumerate(fp):
l=l.strip()
R.append([int(n) for n in l])
rlen = len(R)
clen = len(R[0])
visited = set()
def dijkstra(grid):
heep = [(0, (0,0))]
while he... |
from datetime import datetime
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import MetaData
from sqlalchemy.orm import relationship
metadata = MetaData()
Base = declarative_base(metadata=metadata)
class Expense(Base):
... |
"""\
PROMORT example.
"""
import argparse
import random
import sys
import os
import glob
import yaml
def main(args):
train_path = args.train_dir
val_path = args.val_dir
test_path = args.test_dir
name = args.name
desc = args.desc
out_fn = args.out_filename
if not name:
name = trai... |
"""init
Revision ID: 24993e230206
Revises:
Create Date: 2018-08-20 17:54:35.986112
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '24993e230206'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by ... |
"""Reference implementation for LimaCharlie.io services."""
__version__ = "1.8.6"
__author__ = "Maxime Lamothe-Brassard ( Refraction Point, Inc )"
__author_email__ = "maxime@refractionpoint.com"
__license__ = "Apache v2"
__copyright__ = "Copyright (c) 2020 Refraction Point, Inc"
from .service import Service # noqa: ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Tool used to manage metadata for Artella Assets
"""
from __future__ import print_function, division, absolute_import
__author__ = "Tomas Poveda"
__license__ = "MIT"
__maintainer__ = "Tomas Poveda"
__email__ = "tpovedatd@gmail.com"
import artellapipe
# Defines ID of... |
#Runlike this exec(open("scratch/jake/tune_1000x_noTES_nist.py").read())
band=2
if band==0:
#####################################
# band 0
S.set_att_uc(band,26)
S.set_att_dc(band,18)
resonly=[4095.08,4324.68,4345.73,4221.15,4287.94,4183.74,4222.49,4288.72,4443.77,4223.43,4291.01,4310.50,4224.67,443... |
'''
Created on 2016年2月3日
给个图,每个节点有value,还有是否是surface (boolean值)。找到一个起点和终点都在surface的path,使得path上的所有节点和最大。
@author: Darren
'''
def add_end(L=None):
print(L)
if L is None:
L = []
L.append('END')
return L
print(add_end())
print(add_end())
print(add_end()) |
#from twilio.rest import Client
import TradingBotConfig as theConfig
def SendWhatsappMessage(messageToSend):
if (theConfig.CONFIG_INPUT_MODE_IS_REAL_MARKET == True):
pass
# Your Account Sid and Auth Token from twilio.com/console
# account_sid = '<fill id here>'
# auth_token ... |
import os
f = os.path.join(os.getenv('PREFIX'), 'no_link_file.example')
assert os.path.isfile(f), "File does not exist"
assert os.stat(f).st_nlink <= 1, "File is hard-linked where it should not be (link count = {})".format(os.stat(f).st_nlink)
assert not os.path.islink(f), "File is a symlink where it should not be"
|
from .analyzer import *
from .analyzer_factory import *
from .arm import *
from .mips import *
from .intel import *
|
"""The test validator package."""
|
from cc3d.core.PySteppables import *
class ConnectivityElongationSteppable(SteppableBasePy):
def __init__(self, frequency=10):
SteppableBasePy.__init__(self, frequency)
def start(self):
for cell in self.cell_list:
if cell.type == 1:
cell.connectivityOn = True
... |
"""Utilities for implementing `nbio_interface.AbstractIOServices` for
pika connection adapters.
"""
import collections
import errno
import functools
import logging
import numbers
import os
import socket
import ssl
import sys
import traceback
from pika.adapters.utils.nbio_interface import (AbstractIOReference,
... |
#!/usr/bin/env python
""" This is my first Python program """
NUMBER = 10
def my_func():
"""My first function """
msg = '''Printing
the
List'''
print msg
num_list = range(10)
for num in num_list:
print num
def some_function():
"""My second function """
try:
# Divisi... |
# -*- encoding: UTF-8 -*-
from __future__ import absolute_import, unicode_literals
from os import environ
from werkzeug.routing import Map, Rule
from mongorest.middlewares import CORSMiddleware
from mongorest.testcase import TestCase
from mongorest.wrappers import Response
from mongorest.wsgi import WSGIWrapper, WSG... |
from django.conf.urls import url, include
from django.contrib import admin
from rest_framework import routers
from vocabs.api_views import *
from tokens.api_views import *
from rest_framework_swagger.views import get_swagger_view
schema_view = get_swagger_view(title='ECCE API')
router = routers.DefaultRouter()
rout... |
# coding: utf-8
import os
import time
import math
from PIL import Image, ImageDraw
import random
# === 思路 ===
# 核心:每次落稳之后截图,根据截图算出棋子的坐标和下一个块顶面的中点坐标,
# 根据两个点的距离乘以一个时间系数获得长按的时间
# 识别棋子:靠棋子的颜色来识别位置,通过截图发现最下面一行大概是一条直线,就从上往下一行一行遍历,
# 比较颜色(颜色用了一个区间来比较)找到最下面的那一行的所有点,然后求个中点,
# 求好之后再让 Y 轴坐标减小棋子底盘的一半高度从而得到中... |
"""
This module contains some very easy wrappers for commonly used functions.
Usage:
import utility
After this one can call related functions in form - utility.function_call(...)
Requires Python 3.x
"""
import os
import errno
import subprocess
import fileinput
import hashlib
import re
import shutil
import tempfile
d... |
import logging
#from core.output import say
from core.config.settings import logger, DEMO_MUSIC_DIR
import subprocess
import os, random
class Reaction:
"""class Reaction"""
def __str__(self):
return 'Reac'
@classmethod
def __init__(self, *args, **kwargs):
""" original request string ""... |
from utils.read_csv import read_from_csv
# from utils.deserialize_json import deserialize_json #use it to read test data from JSON
_user_data = 'test_data/users.csv'
USER_IDS = read_from_csv(_user_data)
|
#!C:\Users\alex1\Anaconda3\envs\djangoapp\python.exe
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
|
from types import FunctionType, MethodType
from typing import NoReturn, Any, Union
import time
import logging
logger = logging.getLogger(__name__)
def wait_for(func:Union[FunctionType, MethodType], value:Any, interval:int=1, timeout:int=30) -> NoReturn:
"""wait for function to return specified value
Args:
... |
"""
Copyright 2018 IBM Corporation
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... |
from django.shortcuts import render,redirect
from django.http import Http404
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.auth.decorators import login_required
from .models import Profile,Project,Rating
from .forms import UploadProjectForm,AddProfileForm,AddRatingForm
from .filters import P... |
# -*- coding: utf-8 -*-
import io
import os
import azure.storage.blob
from pytest import fixture
import smart_open
_AZURE_CONTAINER = os.environ.get('SO_AZURE_CONTAINER')
_AZURE_STORAGE_CONNECTION_STRING = os.environ.get('AZURE_STORAGE_CONNECTION_STRING')
_FILE_PREFIX = '%s://%s' % (smart_open.azure.SCHEME, _AZURE_... |
from .pop import PopulationLocation
|
from __future__ import division
from __future__ import print_function
import time
import argparse
import numpy as np
import torch
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
from models import *
import os
# Training settings
parser = argparse.ArgumentParser()
pars... |
# coding=utf-8
"""
init module
"""
from .app import create_app
|
#!/usr/bin/env python3
import clock
def main():
print('The current date is {}'.format(clock.current_time()))
if __name__ == '__main__':
main()
|
import pygame, random, os, pickle, math
# Version
SPECIAL_VERSION = False
VERSION = "Beta 1.2.0"
# 遊戲存檔地址
GAMESAVE_FILE_ADDRESS = 'saves/game_save.gs'
# 設定檔地址
CONFIG_FILE_ADDRESS = 'config.txt'
# Screen_Setting
WIDTH = 1280
HEIGHT = 720
FPS = 60
if not os.path.isfile(CONFIG_FILE_ADDRESS):
# 建立遊... |
# coding: utf-8
import pytest
import ujson
import msgpack
from bookworm.document import create_document
from bookworm.document.uri import DocumentUri
from bookworm.document.serde import dump_toc_tree, load_toc_tree
def test_serde_toc_tree(asset):
uri = DocumentUri.from_filename(asset("epub30-spec.epub"))
epub... |
# TApplication is so incredibly annoying.
# STOP SNOOPING THE ARGUMENT LIST AND PRINTING BOGUS HELP MESSAGES!!
import sys
_argv = sys.argv
sys.argv = []
import ROOT
# Have to do something with the module to get TApplication initialized
ROOT.TObject # This just fetches the class and does nothing else
sys.argv = _argv
d... |
# (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2019
class SpanContext():
def __init__(
self,
trace_id=None,
span_id=None,
baggage=None,
sampled=True,
level=1,
synthetic=False
):
self.level = level
... |
# 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.