text stringlengths 2 999k |
|---|
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
import mpld3
from .db_stats import DataBaseStats
matplotlib.... |
from commitizen.cz.jira import JiraSmartCz
def test_questions(config):
cz = JiraSmartCz(config)
questions = cz.questions()
assert isinstance(questions, list)
assert isinstance(questions[0], dict)
def test_answer(config):
cz = JiraSmartCz(config)
answers = {
"message": "new test",
... |
# function that returns [deps/dt, dX/dt, dR/dt]
import math
import numpy as np
from scipy.integrate import odeint
class viscoPlastic1D:
def __init__(self, K, n, H, D, h, d):
self.K = K
self.n = n
self.H = H
self.D = D
self.h = h
self.d = d
# function that returns ... |
import json
import logging
import subprocess
from shlex import quote
from aiohttp import web
log = logging.getLogger(__name__)
async def list_networks(request):
"""
Get request will return a list of discovered ssids.
"""
res = {"list": []}
try:
cmd = [
"nmcli",
"-... |
import torch
import os
import pandas as pd
import langpractice.utils.save_io as lpio
from tqdm import tqdm
def get_stats_dataframe(model_folders,
names=None,
incl_hyps=False,
verbose=False):
"""
Sorts through all checkpoints of all models ... |
"""
Compares frequencies between the validation and discovery cohorts.
For each patient group, the Euclidean distance is used.
"""
import numpy as np
import pandas as pd
from click import *
from logging import *
@command()
@option(
'--validation-input',
required=True,
help='the CSV file to read validat... |
from __future__ import annotations
from dataclasses import dataclass
import bbgo_pb2
from ..enums import ChannelType
from ..enums import DepthType
@dataclass
class Subscription:
exchange: str
channel: ChannelType
symbol: str
depth: DepthType = None
interval: str = None
def to_pb(self) -> b... |
# Generated by Django 4.1.dev20220219193601 on 2022-03-23 05:23
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... |
#!/usr/bin/env python3
# encoding: utf-8
import os
import sys
import requests
from bs4 import BeautifulSoup
import logging
import cookielib
import mechanize
logging.getLogger(__name__)
class Dcard:
account = 'obsidiany@gmail.com'
password = 'login12345'
base_url = 'https://www.dcard.tw/'
def __in... |
"""
Django settings for mortytown project.
Generated by 'django-admin startproject' using Django 2.0.7.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""
import os
... |
# coding: utf-8
"""
Memsource REST API
Welcome to Memsource's API documentation. To view our legacy APIs please [visit our documentation](https://wiki.memsource.com/wiki/Memsource_API) and for more information about our new APIs, [visit our blog](https://www.memsource.com/blog/2017/10/24/introducing-rest-apis... |
# coding: utf-8
"""
Copyright 2016 SmartBear Software
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... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright 2016 Fedele Mantuano (https://twitter.com/fedelemantuano)
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/lice... |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'chromium_code': 1, # Use higher warning level.
'chromium_enable_vtune_jit_for_v8%': 0, # enable the vtune support for V8 en... |
# Generated by Django 2.0 on 2020-11-24 14:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('article', '0006_article_signature'),
]
operations = [
migrations.AddField(
model_name='person',
name='signature',
... |
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class UsersConfig(AppConfig):
name = "django_proficiency_test.users"
verbose_name = _("Users")
def ready(self):
try:
import django_proficiency_test.users.signals # noqa F401
except Import... |
# Creadit by https://github.com/sandy1709/catuserbot
# Ported by me @X_ImFine
import base64
from asyncio import sleep
from telethon.tl.functions.messages import ImportChatInviteRequest as Get
from userbot import BOTLOG, BOTLOG_CHATID, bot, LOGS, CMD_HELP
from userbot.utils import parse_pre
from userbot.modules.sql_h... |
from contextlib import closing
from enum import Enum, unique
from http import HTTPStatus
from karapace import version as karapace_version
from karapace.avro_compatibility import is_incompatible
from karapace.compatibility import check_compatibility, CompatibilityModes
from karapace.config import read_config
from karapa... |
### Copyright 2014, MTA SZTAKI, www.sztaki.hu
###
### 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 logging
import threading
from time import sleep
import pyHook
from pyHook.HookManager import GetKeyState
from pyHook.HookManager import HookConstants
import keyboard
import win32gui
import pythoncom
logger = logging.getLogger('debug')
class HeldKeyError(Exception):
pass
class KeyCodes:
key_to_id =... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 26 14:17:10 2020
@author: dhaar01
"""
def average(array):
return sum(set(array))/len(set(array))
if __name__ == '__main__':
n = int(input())
arr = list(map(int, input().split()))
result = average(arr)
print(result) |
from ortools.sat.python import cp_model
def SolveRosteringWithTravel():
model = cp_model.CpModel()
# [duration, start, end, location]
jobs = [[3, 0, 6, 1], [5, 0, 6, 0], [1, 3, 7, 1], [1, 3, 5, 0], [3, 0, 3, 0],
[3, 0, 8, 0]]
max_length = 20
num_machines = 3
all_machines = range(num_machines)... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 10 10:00:26 2020
@author: heiko
"""
import unittest
import numpy as np
class TestBootstrap(unittest.TestCase):
""" bootstrap tests
"""
def test_bootstrap_sample(self):
from pyrsa.inference import bootstrap_sample
from... |
# Copyright (C) 2011 Google Inc. 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 conditions and the ... |
class MultiFieldConvergenceControls:
def mfconv(self, lab="", toler="", minref="", **kwargs):
"""Sets convergence values for an ANSYS Multi-field solver analysis.
APDL Command: MFCONV
Parameters
----------
lab
Valid labels:
toler
Convergenc... |
#!/usr/bin/python3
# This code write by Mr.nope
import os
import time
from colorama import Fore,init
init()
def screen():
os.system("figlet -f slant Locatin-robber")
def banner():
print(Fore.GREEN)
screen()
print(Fore.WHITE)
def version():
print(Fore.RED + "Version: " + Fore.BLUE + "1.2... |
"""Automatically generated by hassfest.
To update, run python3 -m script.hassfest
"""
# fmt: off
ZEROCONF = {
"_Volumio._tcp.local.": [
{
"domain": "volumio"
}
],
"_airplay._tcp.local.": [
{
"domain": "samsungtv",
"manufacturer": "samsung*"
... |
"""Process to acquire the authorization cookie for a service in UFSC
The authentication is made using selenium webdriver because
we have some hard times trying to authenticate using requests.
"""
from typing import Dict
from urllib.parse import quote as url_encode
from selenium import webdriver
from .config import s... |
import codecs
from io import StringIO
from pathlib import Path
import colorama
colorama.init()
from colorama import Fore, Back, Style
import click
import csv
import io
def echo_error(message=None, file=None, nl=True, err=True, color=None):
if message:
message = f"{Fore.RED}{message}{Fore.RESET}"
click... |
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/00_torch_core.ipynb (unless otherwise specified).
__all__ = ['progress_bar', 'master_bar', 'subplots', 'show_image', 'show_titled_image', 'show_images', 'ArrayBase',
'ArrayImageBase', 'ArrayImage', 'ArrayImageBW', 'ArrayMask', 'tensor', 'set_seed', 'unsqueeze'... |
from voximplant.apiclient import VoximplantAPI, VoximplantException
if __name__ == "__main__":
voxapi = VoximplantAPI("credentials.json")
# Charge the frozen phone number: 79993330011.
PHONE_NUMBER = "79993330011"
try:
res = voxapi.charge_account(phone_number=PHONE_NUMBER)
pr... |
from apispec.ext.marshmallow.swagger import fields2jsonschema, field2property
import flask_marshmallow
import marshmallow_mongoengine
from werkzeug import cached_property
from flask_restplus.model import Model as OriginalModel
class SchemaMixin(object):
def __deepcopy__(self, memo):
# XXX: Flask-RESTplu... |
import math
class Vector():
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
def __add__(self, other):
if (type(other) == type(self)):
a = self.x + other.x
b = self.y + other.y
c = self.z + other.z
else:
a = s... |
import xlrd
excel_file = ("/home/student/sample.xlsx")
book_obj = xlrd.open_workbook(excel_file)
excel_sheet = book_obj.sheet_by_index(0)
result = excel_sheet.cell_value(0, 1)
print(result)
|
#!/usr/bin/env python3
# Copyright 2018 CMU and 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 requir... |
import logging
import os
import time
from typing import List
from celery import shared_task
from dateutil.relativedelta import relativedelta
from django.db.models import F
from django.utils import timezone
from posthog.models import Cohort
logger = logging.getLogger(__name__)
MAX_AGE_MINUTES = 15
PARALLEL_COHORTS =... |
import logging
import requests
from protect_archiver.errors import Errors
class UniFiOSClient:
def __init__(
self,
protocol: str,
address: str,
port: int,
username: str,
password: str,
verify_ssl: bool,
):
self.protocol = protocol
self.ad... |
from django.conf.urls import url
from cobra.core.application import Application
from cobra.core.loading import get_class
class TeamApplication(Application):
name = 'team'
team_create_view = get_class('team.views', 'TeamCreateView')
team_settings_view = get_class('team.views', 'TeamSettingsView')
team... |
from models import User
# user at id=1
user = User.at(1).getone()
user = User.findone(id=1)
# all users
users = User.getall()
# user 2 < id < 5
users = User.findall(User.id > 2, User.id < 5)
|
#!/usr/bin/env python
import numpy as np
import mirheo as mir
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--domain", type=float, nargs=3, default=[4., 2., 3.])
args = parser.parse_args()
ranks = (1, 1, 1)
domain = args.domain
density = 8
u = mir.Mirheo(ranks, tuple(domain), dt=0, debug_... |
'''
Helper functions for the library
'''
import platform
import struct
import subprocess
import time
from functools import lru_cache
from typing import Any, List, Tuple, Union
if int(platform.python_version_tuple()[1]) < 9:
from typing import Generator
else:
from collections.abc import Generator
class Screen... |
from rest_framework import viewsets, status
from rest_framework.decorators import list_route
from rest_framework.response import Response
from .models import User, Alert
from .serializers import UserSerializer, AlertSerializer
import traceback
from ebaysdk.exception import ConnectionError
from ebaysdk.finding import C... |
# -*- coding: utf-8 -*-
from docutils import nodes
PACKAGES = ["kartothek"]
def _is_external_target(target):
return not any(((target == p) or target.startswith(p + ".") for p in PACKAGES))
def _is_private_target(target):
return any((part.startswith("_") for part in target.split(".")))
def missing_referen... |
from __future__ import print_function
from __future__ import unicode_literals
import os
import json
import cPickle
from collections import Counter
import numpy as np
import utils
import h5py
import torch
from torch.utils.data import Dataset
from tqdm import tqdm
from random import choice
class Dictio... |
# Copyright The IETF Trust 2019, All Rights Reserved
# Copyright 2018 Cisco and its affiliates
#
# 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... |
"""
Class that provides functions from a given SAM template
"""
import logging
from typing import Dict, List, Optional, cast, Iterator, Any
from samcli.commands.local.cli_common.user_exceptions import InvalidLayerVersionArn
from samcli.lib.providers.exceptions import InvalidLayerReference
from samcli.lib.utils.colors ... |
import os
from execUtils import append_to_file
import logging
logging.basicConfig(filename='setup_ports.log',
level=logging.INFO)
if not os.path.exists("/usr/ports"):
# get_ports = """
# cd /usr
# doas cvs -qd anoncvs@anoncvs3.usa.openbsd.org:/cvs checkout -rOPENBSD_7_0 -P ports
# "... |
""" Command Result Model tests """
from django.test import TestCase
from django.test import Client
from django.conf import settings
from django.utils import timezone
from app.logic.commandrepo.models.CommandGroupModel import CommandGroupEntry
from app.logic.commandrepo.models.CommandSetModel import CommandSetEntry
fro... |
"""
Taxi simulator
==============
Driving a taxi from the console::
>>> from taxi_sim import taxi_process
>>> taxi = taxi_process(ident=13, trips=2, start_time=0)
>>> next(taxi)
Event(time=0, proc=13, action='leave garage')
>>> taxi.send(_.time + 7)
Event(time=7, proc=13, action='pick up pass... |
# ========================================================================
# Copyright 2018 ELIT
#
# 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... |
from kingfisher_scrapy.extensions import KingfisherItemCount
from kingfisher_scrapy.items import FileError, FileItem
from tests import spider_with_crawler
def test_item_scraped_file(caplog):
spider = spider_with_crawler()
item_extension = KingfisherItemCount.from_crawler(spider.crawler)
item = spider.buil... |
import threading
import time
import unittest
import ZODB
class ZODBClientThread(threading.Thread):
sleep_time = 3
def __init__(self, db, test):
threading.Thread.__init__(self)
self._exc_info = None
self.setDaemon(True)
self.db = db
self.test = test
self.event... |
"""
Notice : 神兽保佑 ,测试一次通过
//
// ┏┛ ┻━━━━━┛ ┻┓
// ┃ ┃
// ┃ ━ ┃
// ┃ ┳┛ ┗┳ ┃
// ┃ ┃
// ┃ ┻ ┃
// ┃ ┃
// ┗━┓ ┏━━━┛
// ┃ ┃ Author: somewheve
// ┃ ┃ Datetime: 2019/7/6 下午2:13 ---> 无知即是罪恶
// ┃ ┗━━━━━━━━━┓
// ┃ ... |
import time
import sys
try:
import Quartz
except:
assert False, "You must first install pyobjc-core and pyobjc: https://pyautogui.readthedocs.io/en/latest/install.html"
import AppKit
import pyautogui
if sys.platform != 'darwin':
raise Exception('The pyautogui_osx module should only be load... |
BOT_NAME = "firmware"
SPIDER_MODULES = ["firmware.spiders"]
NEWSPIDER_MODULE = "scraper.spiders"
ITEM_PIPELINES = {
"firmware.pipelines.FirmwarePipeline" : 1,
}
FILES_STORE = "./output/"
AUTOTHROTTLE_ENABLED = True
AUTOTHROTTLE_START_DELAY = 0
AUTOTHROTTLE_MAX_DELAY = 15
CONCURRENT_REQUESTS = 8
DOWNLOAD_TIMEOU... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is subject to the terms and conditions defined in
# file 'LICENSE.md', which is part of this source code package.
#
from kubernetes.models.unversioned.BaseModel import BaseModel
from kubernetes.models.v1.ObjectMeta import ObjectMeta
from kubernetes.utils imp... |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, \
PermissionsMixin
from django.conf import settings
class UserManager(BaseUserManager):
# если ф-ия внутри класса нужно писать self
# model - Model
def create_use... |
import numpy as np
import os
import dtdata as dt
from sklearn.neighbors import NearestNeighbors
from sklearn.decomposition import PCA
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(color_codes=True)
plt.rcParams['interactive'] == True
# fix random seed for reproducibility
np.random.seed(90210)
subset... |
# -*- coding: utf-8 -*-
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.contrib.auth.decorators import permission_required
from principal.forms import UserEditForm, FileUploadForm
from django.http.response import HttpResponseRedirect
from django.utils.translation... |
import dao.mysql_connect as myc
class Textos:
def __init__(self,id_pessoa,qtd_types,qtd_tokens,rtt,id_texto):
self.id_pessoa =str(id_pessoa)
self.qtd_types=str(qtd_types)
self.qtd_tokens= str(qtd_tokens)
self.rtt =str(rtt)
self.id_texto = str(id_texto)
def inser... |
import base64
import os
import pytest
from aries_cloudagent.wallet.basic import BasicWallet
from aries_cloudagent.wallet.indy import IndyWallet
from . import test_basic_wallet
@pytest.fixture()
async def basic_wallet():
wallet = BasicWallet()
await wallet.open()
yield wallet
await wallet.close()
... |
class FOCN_hyperconfig:
def __init__(self):
super().__init__()
self.in_dropout = [0.1, 0.2, 0.3, 0.4]
self.out_dropout = [0.1, 0.2, 0.3, 0.4]
self.hidden_dropout = [0.1, 0.2, 0.3, 0.4]
# epochs = 10
# limit = 50000
def process_config(self, config):
retu... |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... |
"""
Vdirsyncer synchronizes calendars and contacts.
Please refer to https://vdirsyncer.pimutils.org/en/stable/packaging.html for
how to package vdirsyncer.
"""
from setuptools import Command
from setuptools import find_packages
from setuptools import setup
requirements = [
# https://github.com/mitsuhiko/click/is... |
import setuptools
with open("README.rst", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="xrd_simulator",
version="0.3.15",
author="Axel Henningsson",
author_email="nilsaxelhenningsson@gmail.com",
description="Tools for diffraction simulation of s3dxrd type ... |
import _plotly_utils.basevalidators
class TitlefontValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(
self,
plotly_name='titlefont',
parent_name='scattergl.marker.colorbar',
**kwargs
):
super(TitlefontValidator, self).__init__(
plotly_... |
# @Title: 对角线遍历 (Diagonal Traverse)
# @Author: KivenC
# @Date: 2020-08-04 10:57:20
# @Runtime: 232 ms
# @Memory: 16.6 MB
class Solution:
def findDiagonalOrder(self, matrix: List[List[int]]) -> List[int]:
# # 记录每一层从右上角到左下角对角线的元素
# # 当层数为偶数时,反转列表后添加
# m, n, res = len(matrix), len(matrix) and... |
# Copyright 2018 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
import os
import shutil
import tempfile
from copy import deepcopy
from io import StringIO
from unittest import mock
from django.conf import settings
from django.contrib.auth.models import User
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test import TestCase
from django.test.utils import o... |
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
# Get times that fall within one SD of mean in distribution
def get_1sd_times(df_std, sd = 1):
mean = df_std.mean()
lb = mean - (df_std.std() * sd)
ub = mean + (df_std.std() * sd)
try:
temp = df_std.to_frame()
excep... |
def test_nav_directories():
pass
|
# generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else []
PROJECT_CATKIN_DEPENDS = "".replace(';', ' ')
PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else []
PROJECT_NAME = "camera_info_publisher"
PROJECT_SPACE_... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import time
from sqlalchemy import event
from sqlalchemy.engine import Engine
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, ... |
from marshmallow import Schema, fields, post_load
from ebl.bibliography.application.serialization import create_object_entry
from ebl.bibliography.domain.reference import BibliographyId, Reference, ReferenceType
from ebl.schemas import NameEnum
class ReferenceSchema(Schema):
id = fields.String(required=True)
... |
r"""
Free modules
Sage supports computation with free modules over an arbitrary commutative ring.
Nontrivial functionality is available over `\ZZ`, fields, and some principal
ideal domains (e.g. `\QQ[x]` and rings of integers of number fields). All free
modules over an integral domain are equipped with an embedding in... |
"""
flask_security.core
~~~~~~~~~~~~~~~~~~~
Flask-Security core module
:copyright: (c) 2012 by Matt Wright.
:copyright: (c) 2017 by CERN.
:copyright: (c) 2017 by ETH Zurich, Swiss Data Science Center.
:copyright: (c) 2019-2021 by J. Christopher Wagner (jwag).
:license: MIT, see LICENSE... |
n = 600851475143
i = 2
while i * i < n:
while n % i == 0:
n = n / i
i = i + 1
print (n)
|
# Ldaptor, a Pure-Python library for LDAP
# Copyright (C) 2003 Tommi Virtanen
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distributed in the hope ... |
"""MXNet Module for GraphSAGE layer"""
# pylint: disable= no-member, arguments-differ, invalid-name
import math
from numbers import Integral
import mxnet as mx
from mxnet import nd
from mxnet.gluon import nn
from .... import function as fn
class SAGEConv(nn.Block):
r"""GraphSAGE layer from paper `Inductive Repres... |
from ._abstract import AbstractScraper
from ._utils import get_minutes, normalize_string, get_yields
class CookieAndKate(AbstractScraper):
@classmethod
def host(self):
return 'cookieandkate.com'
def title(self):
return self.soup.find(
'h1',
{'class': 'entry-title'... |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 10
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_9_0_0
from ... |
# 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 agreed ... |
#!/usr/bin/python3
from flask import Flask, Response, request, jsonify
from random import random
from apscheduler.schedulers.background import BackgroundScheduler
from json import loads, dumps
import grequests
import requests
import gevent
import paramiko
import traceback
# Note previous patch to avoid error with para... |
#!/usr/bin/python
# There are some file handling changes etc.
import csv
#Input the file name.
fname = raw_input("Enter file name including extension: ")
data = csv.reader(open(fname), delimiter = ',')
#Skip the 1st header row.
data.next()
#Get the name of the file to write out
output_file = fname.strip('csv')
f =... |
class Person:
def __init__(self, first_name, last_name, id_number):
self.first_name = first_name
self.last_name = last_name
self.id_number = id_number
def print_person(self):
# print("Name:", self.last_name + ",", self.first_name)
# print("ID:", self.id_number)
... |
# encoding: UTF-8
'''
本文件仅用于存放对于事件类型常量的定义。
由于python中不存在真正的常量概念,因此选择使用全大写的变量名来代替常量。
这里设计的命名规则以EVENT_前缀开头。
常量的内容通常选择一个能够代表真实意义的字符串(便于理解)。
建议将所有的常量定义放在该文件中,便于检查是否存在重复的现象。
'''
EVENT_TIMER = 'eTimer' # 计时器事件,每隔1秒发送一次
#----------------------------------------------------------------------
def test()... |
VERSION = "1.3.0" # Set the PYSlot Version
|
m="Twinkle,twinkle,little star,\n\tHow I wonder what you are!\n\t\tUp above the world so high,\n\t\tLike a diamond in the sky.\nTwinkle,twinkle,little star,\nHow I wonder what you are!"
print(m)
|
from . import wifi
from . import ssh
from . import kerberos
from . import node
PLUGINS = [node.Node, wifi.Wifi, ssh.Ssh, kerberos.Kerberos]
|
from cold_silence.main import generate_project, parse_args
from cold_silence.utils import DEFAULT_PATH, DEFAULT_PROJECT_DIRECTORY
import os
import unittest
class MainTestSuite(unittest.TestCase):
def test_create_project(self):
generate_project()
self.assertEqual(
True,
os.... |
import os
import os.path
import re
import shutil
import mlflow
from mlflow import cli
from mlflow.utils import process
from tests.integration.utils import invoke_cli_runner
import pytest
EXAMPLES_DIR = "examples"
def is_conda_yaml(path):
return bool(re.search("conda.ya?ml$", path))
def find_conda_yaml(directo... |
import os
import sys
import numpy as np
import tensorflow as tf
from tqdm import tqdm
from config import cfg
from utils import load_data
from capsNet import CapsNet
def save_to():
if not os.path.exists(cfg.results):
os.mkdir(cfg.results)
if cfg.is_training:
loss = cfg.results + '/loss.csv'
... |
import aiosqlite
from typing import Optional, List, Dict, Tuple, Any
from goldcoin.types.blockchain_format.sized_bytes import bytes32
from goldcoin.types.blockchain_format.coin import Coin
from goldcoin.types.blockchain_format.program import Program, SerializedProgram
from goldcoin.util.ints import uint64, uint32
fro... |
# connOracleEE_native = connectTo 'jdbc:oracle:thin:@sayonara.microlab.cs.utexas.edu:1521:orcl' 'C##cs329e_UTEid' 'orcl_UTEid' 'native_mode' nodebug
connOracleEE = connectTo 'jdbc:oracle:thin:@sayonara.microlab.cs.utexas.edu:1521:orcl' 'C##cs329e_UTEid' 'orcl_UTEid' 'rdf_mode' 'A0' nodebug
# connOracleRDFNoSQL = conne... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
""" Initializing columns for tables: Articles, Categories """
import sqlalchemy
from sqlalchemy import orm
from .db_session import SqlAlchemyBase
association_table = sqlalchemy.Table("association", SqlAlchemyBase.metadata,
sqlalchemy.Col... |
from mmdet.datasets.builder import PIPELINES
from mmdet.datasets.pipelines import LoadAnnotations, LoadImageFromFile
@PIPELINES.register_module()
class LoadMultiImagesFromFile(LoadImageFromFile):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def __call__(self, results):
... |
import threading
import discord
from discord.ext import commands
import asyncio
import youtube_dl
class HelperBot(commands.Bot):
"""
Helper bot that gets spawned by GeBeO to handle playing sounds in multiple channels in one server at once.
Must be run using start() and NOT run() (run is blocking)
... |
# Copyright (c) 2003-2005 The Regents of The University of Michigan
# 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 ... |
# Copyright 2011 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 req... |
#!/usr/bin/env python
#
#-----------------------------------------------------------------------
# A test suite for the table interface built on bsddb.db
#-----------------------------------------------------------------------
#
# Copyright (C) 2000, 2001 by Autonomous Zone Industries
# Copyright (C) 2002 Gregor... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.