text stringlengths 1 927k |
|---|
# Generated by Django 3.1.7 on 2021-04-01 09:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('locations', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='locations',
name='featured_image',
... |
from __future__ import unicode_literals
import logging
import os
# TODO: Remove entirely if you don't register GStreamer elements below
import pygst
pygst.require('0.10')
from mopidy import config, ext
__version__ = '0.1.0'
# TODO: If you need to log, use loggers named after the current Python module
logger = log... |
# engine/util.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
from .. import exc
from .. import util
try:
from sqlalchemy.cyextension.util im... |
# -*- coding: utf-8 -*-
import datetime
import math
from pathlib import Path
from shapely.geometry import Polygon, MultiPolygon, LineString, Point, MultiPoint, MultiLineString, \
GeometryCollection
import shapely.wkt
import pytest
from pyramid_oereb.lib.records.geometry import GeometryRecord
from pyramid_oereb.... |
import click
from .main import jf
@click.command()
@click.option("--processes", default=1, help="Number of processes to use.")
@click.option(
"--from_file",
"-f",
help="read transformation from file. This is also activated for query strings that ends with '.jf'",
is_flag=True,
)
@click.option("--impor... |
# Copyright 2017 BBVA
#
# 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, softwar... |
from setuptools import find_packages, setup
setup(
name='src',
packages=find_packages(),
version='0.1.0',
description='Kaggle's organic vs. recyclables waste classification dataset',
author='Jeffrey Osiwala',
license='MIT',
)
print('asdfasdf') |
#!/usr/bin/python3
import mysql.connector as mariadb
# Change with correct info ##
sqlusername = "topaz" #
sqlpassword = "password" #
sqldatabase = "tpzdb" #
#############################
def all_characters(cursor, cursor2):
print("Items Available:\
\n1) Nomad Cap\
\n2) Moogle Cap\
\n3... |
import ActividadVolcanica.JcampReader.fileHandler as handler
import numpy as np
def parser (filename):
ToParse = handler.read(filename)
ArgList = ToParse.split("##")
ArgList.remove("")
Parameters =dict()
for x in ArgList:
try:
y = x.split("=")
if y[0] != "XYDATA":
... |
from collections import namedtuple
from enum import Enum
class EncryptionMethod(Enum):
def __str__(self):
return str(self.value)
MD5 = 'md5'
SHA512 = 'sha512'
UNKNOWN = 'unknown'
DeviceInfo = namedtuple(
"DeviceInfo", [
"mac_address",
"serial_number",
"manufacturer... |
from project import db
import datetime
from project.corsi.models import Corso
# Tabella di relazione 1 Corso : N Serate
class Serata(db.Model):
__tablename__ = "serata"
__table_args__ = (db.UniqueConstraint("id", "data", name="constraint_serata"),)
id = db.Column(db.Integer(), primary_key=True)
nom... |
#!/usr/bin/env python
"""This is a selenium test harness used interactively with Selenium IDE."""
import copy
import socket
import threading
from wsgiref import simple_server
import logging
# pylint: disable=g-bad-import-order
from grr.gui import django_lib
# pylint: enable=g-bad-import-order
from grr.lib import a... |
from django.conf import settings
from django.db import models
from django.utils import translation
from olympia import amo
from olympia.addons.models import Addon
from olympia.amo.models import ModelBase
from olympia.amo.utils import send_mail
from olympia.users.models import UserProfile
class AbuseReport(ModelBase)... |
import streamlit as st
from _scheduler.work import Room, Staff, EType, RType
from _scheduler.manager import RoomManager
import graphviz as graphviz
import datetime as dt
from datetime import datetime, date, timedelta
import scheduler
def get_num_of_staff():
num_of_staff = st.text_input("How many staff do you want... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2013-2019 European Commission (JRC);
# Licensed under the EUPL (the 'Licence');
# You may not use this work except in compliance with the Licence.
# You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl
"""(DEPRECATED) Compares the results of... |
from django.contrib.auth import get_user_model, authenticate
from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
from pprint import pprint
class UserSerializer(serializers.ModelSerializer):
"""serializer for the users object"""
class Meta:
model = get_user... |
from django.db import models
# Create your models here.
class StudentDataDropout(models.Model) :
studentID = models.CharField(max_length=100000)
Complete1 = models.IntegerField()
CompleteCIP1 = models.IntegerField()
CompleteDevEnglish = models.IntegerField()
CompleteDevMath = models.IntegerField(... |
"""
Django settings for profiles_project project.
Generated by 'django-admin startproject' using Django 2.2.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
impor... |
"""
This module *does not* contain API routes. It exclusively contains dependencies to be used in FastAPI routes
"""
import inspect
from typing import (
Any,
AsyncGenerator,
cast,
Optional,
Type,
TypeVar,
)
from fastapi import (
Cookie,
Form,
Header,
Query,
Response,
)
from ... |
from typing import Optional
from rx.core import typing
from rx.disposable import CompositeDisposable, Disposable, SingleAssignmentDisposable
from ..schedulerbase import SchedulerBase
class TkinterScheduler(SchedulerBase):
"""A scheduler that schedules work via the Tkinter main event loop.
http://infohost.n... |
from more.jinja2 import Jinja2App
class App(Jinja2App):
pass
@App.path(path="persons/{name}")
class Person:
def __init__(self, name):
self.name = name
@App.template_directory()
def get_template_dir():
return "templates"
@App.html(model=Person, template="person_inherit.jinja2")
def person_def... |
#!/usr/bin/env python3
import os
import time
import queue
import random
import logging
import tempfile
from glob import glob
from configparser import ConfigParser
from picamera import PiCamera, Color
from ft5406 import Touchscreen
from PIL import Image
from camera import Camera, CameraError, CameraNotConnectedError
f... |
# Replace "Keeper" with game file name. Ex: if your game file is called MyGame.Py, Write MyGame instead of Keeper
from \
Keeper \
import *
from OpenGL.GLUT import *
# Setup Variables
screenwidth = 800
screenheight = 800
gameTitle = b"BEKA Engine"
def Timer(v):
Update()
glutTimerFunc(time_interval, ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import sys
import os
import time
import itertools
from heapq import heappush, heappop
# Compatibility with Python < 2.6
#
try:
from heapq import heappushpop
except ImportError:
def heappushpop(heap, item):
heappush(heap, item)
return heappop(heap)
import n... |
import sys
from dataclasses import dataclass
@dataclass
class WindowsConsoleFeatures:
"""Windows features available."""
vt: bool = False
"""The console supports VT codes."""
truecolor: bool = False
"""The console supports truecolor."""
try:
import ctypes
from ctypes import wintypes
... |
# 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... |
from netapp.netapp_object import NetAppObject
class VolumeLanguageAttributes(NetAppObject):
"""
Information about the volume language settings.
"""
_language_code = None
@property
def language_code(self):
"""
The volume's language code (e.g. 'en_US').
<p>
Vo... |
# --coding:utf-8--
# Copyright (c) 2017 Intel 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 l... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.constant.ParamConstants import *
class SubMerchantParams(object):
def __init__(self):
self._sub_merchant_id = None
self._sub_merchant_name = None
self._sub_merchant_service_description = None
... |
from tensorflow import keras
import tensorflow as tf
class BatchNormalization(keras.layers.BatchNormalization):
"""
Identical to keras.layers.BatchNormalization, but adds the option to freeze parameters.
"""
def __init__(self, freeze, *args, **kwargs):
self.freeze = freeze
super(BatchN... |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
import numba
from numba import *
from numba import error, nodes
from numba.type_inference import module_type_inference
from numba import typesystem
if PY3:
import builtins
else:
import __builtin__ as builtins
debug = Fal... |
# VAEのサンプルコード, MNIST使用
import numpy as np
import matplotlib.pyplot as plt
if __name__ == '__main__':
import sys
# コマンドライン引数を読み込み
# 引数が'-1'なら学習しない
args = sys.argv
train_mode = ['train', 'retrain', 'load']
mode = 0 if len(args) < 2 else int(args[1])
train_mode = train_mode[mode]
... |
# imports - module imports
from pipupgrade import cli
from pipupgrade.table import _sanitize_string, Table
def test__sanitize_string():
assert _sanitize_string(cli.format("foobar", cli.GREEN)) == "foobar"
assert _sanitize_string(cli.format("foobar", cli.BOLD)) == "foobar"
def test_table():
table =... |
"""
*****************
Utility Functions
*****************
Utility functions useful in the implementation and testing of the Synapse client.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from future.utils import ... |
#!usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Given two strings X and Y of length m and n, respectively, find the longest
common subsequence (LCS).
Algorithm: (Dynamic programming)
Denote LCS(X, Y) to be the LCS of X and Y.
Consider the final characters x_m and y_n:
1. x_m and y_n are the same:
Let X' = {X - x... |
import os
import pytorch_lightning as pl
import hydra
from hydra.utils import instantiate
from omegaconf import DictConfig, OmegaConf
from src.model import EncoderDecoderModule, GPT2LMHeadModule
from src.data_utils import CMGDataModule
@hydra.main(config_path="conf", config_name="config")
def main(cfg: DictConfig)... |
import logging
import time
from itertools import chain, zip_longest
from pymongo import UpdateMany
from pymodm.context_managers import no_auto_dereference
from arvet.core.system import VisionSystem
from arvet.core.trial_result import TrialResult
from arvet.core.image import Image
from arvet.core.image_source import Ima... |
import asyncio
import json
from typing import Dict, List, Optional, Union
import discord
import yaml
from redbot.core import commands
from redbot.core.commands import (
BadArgument,
CheckFailure,
Converter,
MessageConverter,
TextChannelConverter,
)
from redbot.core.utils import menus
class String... |
from django.shortcuts import render, get_object_or_404, redirect
from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage
from django.db.models import Q
from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.contrib import messages
from midstream.forms import *
# Create your ... |
import os
from typing import Optional
from fastapi import APIRouter
from fastapi import HTTPException
from fastapi import Request
from management.models.addresses import Addresses
from management.utils import user_is_admin
from management.utils import user_logged
from pydantic import BaseModel
router = APIRouter()
... |
version_info = (6, 0, 0, 'beta7')
__version__ = '.'.join(map(str, version_info))
__frontend_version__ = '^2.0.20' |
class Interface:
def __init__(
self,
number: int,
name: str,
disabled: bool,
running: bool,
slave: bool,
dynamic: bool,
comment: str,
) -> None:
self.number = number
self.name = name
self.disabled = disabled
self.run... |
from __future__ import unicode_literals
import youtube_dl
class YoutubeDLClient():
"""docstring for YoutubeDLClient"""
def __init__(self, ydl_opts):
ydl_opts.update({'logger': self.MyLogger()})
ydl_opts.update({'progress_hooks': [self.my_hook]})
self.ydl_opts = ydl_opts
self.ydl... |
import numpy as np
MAP_NUM_TYPE = {
# bool-type is not supported
'b': np.bool_,
'i8': np.uint8,
'i32': np.int32,
'i64': np.int64,
'f16': np.float16,
'f32': np.float32,
'f64': np.float64,
} |
from asyncpg import Connection
from . import upgrade_table
@upgrade_table.register(description="Initial asyncpg revision", transaction=False)
async def upgrade_v1(conn: Connection):
create_table_queries = [
"""
CREATE TABLE "user" (
mxid TEXT PRIMARY KEY,
li_mem... |
from __future__ import print_function
from __future__ import absolute_import
# Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved.
import argparse
import sys
import time
from .cifar10 import Cifar10Downloader
from .cifar100 import Cifar100Downloader
from .mnist import MnistDownloader
if __name__ == '_... |
# logging
import logging
log = logging.getLogger(__name__)
# stdlib
import datetime
# pypi
import sqlalchemy
# localapp
from ... import lib
from .. import utils
from ...model import utils as model_utils
from ...model import objects as model_objects
# ===============================================================... |
# Generated by Django 2.2.16 on 2020-10-16 19:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("testresults", "0018_testresult_robot_tags"),
]
operations = [
migrations.AlterField(
model_name="testresult",
name=... |
# coding: utf-8
import numpy as np
x1 = np.asarray([0, 0, 1, 1])
x2 = np.asarray([0, 1, 0, 1])
X = np.row_stack((np.ones(shape=(1, 4)), x1, x2))
print("X:\n%s" % X)
y = np.asarray([0, 1, 1, 0])
W1 = np.asarray([[-1, 2, -2],
[-1, -2, 2]])
W2 = np.asarray([-1, 2, 2])
def sigmoid(input):
return 1 ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-05-04 13:37
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('occurrence', '0002_auto_20160415_1549'),
]
operatio... |
#
# WARNING: This file is in the L1T configuration critical path.
#
# All changes must be explicitly discussed with the L1T offline coordinator.
#
import FWCore.ParameterSet.Config as cms
L1TGlobalPrescalesVetosRcdSource = cms.ESSource("EmptyESSource",
recordName = cms.string('L1TGlobalPrescalesVetosRcd'),
iov... |
# Copyright (c) maiot GmbH 2020. 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... |
# coding=utf-8
# Copyright 2022 The TensorFlow Datasets 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 appl... |
"""
Role tests
"""
import os
from testinfra.utils.ansible_runner import AnsibleRunner
testinfra_hosts = AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_package(host):
"""
Ensure package installed
"""
if host.system_info.distribution in ('debian', 'ubuntu'):
... |
"""
Django settings for vpn_30372 project.
Generated by 'django-admin startproject' using Django 2.2.2.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os
... |
from tkinter import *
import sqlite3
#import matplotlib.pyplot as plt
#import pandas as pd
from datetime import *
from tkinter import messagebox
#root=Tk()
#root.configure(bg='gray27')
#root.title('EPMS')
#conn=sqlite3.connect('epms.db')
def main():
def emp():
def back():
top.destroy... |
from enum import Enum
import sys
class Mode(Enum):
"""MODE: Interactive mode. The normal, default mode is PAN_ZOOM, which
allows for normal interactivity with the canvas.
The SELECT mode allows for entire shapes to be selected, moved and
resized.
The DIRECT mode allows for shapes to be selected ... |
from itertools import groupby
def count_consecutives(s):
return ''.join(str(sum(1 for _ in g)) + k for k, g in groupby(s))
# PEP8: kata should use snake_case instead of mixedCase
countConsecutives = count_consecutives |
from numpy import pi
def do_something():
π = pi
print(π)# this will make it much easier in future problems to see that something is actually happening |
from django.conf.urls import url
from . import views
urlpatterns=[
#The landing page
url(r'^$',views.index,name='index')
] |
def stripQuotes(string):
"""Strip leading and trailing quotes from a string.
Does nothing unless starting and ending quotes are present and
the same type (single or double).
"""
single = string.startswith("'") and string.endswith("'")
double = string.startswith('"') and string.endswith('"')
... |
import math
import unittest
from complex_numbers import (
ComplexNumber,
)
# Tests adapted from `problem-specifications//canonical-data.json`
class ComplexNumbersTest(unittest.TestCase):
# Real part
def test_real_part_of_a_purely_real_number(self):
self.assertEqual(ComplexNumber(1, 0).real, ... |
# 1167. Minimum Cost to Connect Sticks
import heapq
class Solution:
# Greedy | Heap
def connectSticks(self, sticks: list[int]) -> int:
heapq.heapify(sticks)
cost = 0
while len(sticks) > 1:
# Always pick two of the smallest sticks to connect.
stick1, stick2 = h... |
from view_common import *
class DashboardSliceInteractions(View):
def get(self, request, name="users", **kwargs):
colors = ["#005586", "#6ebe49", "orange", "#707170", "#00c4b3", "#077767", "dodgerblue", "#a79b94", "#c4e76a", "red"]
groups = []
matrix = []
slices = list(Slice.object... |
import time
from src import log_setup
LOGGER = log_setup.get_logger(__name__)
def monitor(func):
def wrapped_function(*args, **kwargs):
start = time.monotonic_ns()
return_value = func(*args, **kwargs)
LOGGER.info(
f'function {func.__name__} took {(time.monotonic_ns() - start)... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
def ensure_dir(path):
if not os.path.exists(path):
os.makedirs(path)
def get_instance(module, name, config, *args):
return getattr(module, config[name]['type'])(*args, **config[name]['args']) |
import sys
from os.path import abspath, dirname, join
from os import makedirs
import datetime
import jinja2
from shutil import copytree
ROOT_PATH = abspath(dirname(__file__))
TEMPLATE_PATH = abspath(join(ROOT_PATH, 'templates'))
# pair of template name and output file name
TEMPLATE_DATA = [
('socket_debugger.temp... |
from __future__ import print_function
from sklearn.cluster import DBSCAN
import argparse
import hashlib
import os
import time
from datetime import date, datetime, timedelta
from functools import reduce
from math import degrees
from concurrent.futures import ThreadPoolExecutor
import concurrent.futures
from azure.st... |
# Copyright 2018 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... |
#!/usr/bin/python
'''
Extract _("...") strings for translation and convert to Qt4 stringdefs so that
they can be picked up by Qt linguist.
'''
from subprocess import Popen, PIPE
import glob
import operator
import os
import sys
OUT_CPP="qt/gentesharestrings.cpp"
EMPTY=['""']
def parse_po(text):
"""
Parse 'po' ... |
# Copyright 2019 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... |
import os
import sys
sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
import torch.nn as nn
import torch.nn.functional as F
#from layers.graph_convolution_layer import GraphConvolutionLayer
from layers.graph_unet_layer import GraphUNetLayer
from readouts.basic_readout import readout_functi... |
# 给定一个不超过5位的正整数,判断该数的位数,依次打印出十位,百位千位,万位的数字
num = int(input(':>> '))
length = len(str(num))
if num < 100000 and num>=0:
for x in range(length):
print(num%10)
num //= 10
num = int(input(':>> '))
length = len(str(num))
if num < 100000 and num >= 0:
for x in range(length):
tmp = num // 1... |
# Copyright 2019, OpenCensus 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 or agreed to in w... |
import gocept.selenium
import logging
import pkg_resources
import plone.testing
import urlparse
import zeit.cms.testing
import zeit.content.text.jinja
import zeit.push.interfaces
import zeit.workflow.testing
import zope.interface
log = logging.getLogger(__name__)
class PushNotifier(object):
zope.interface.impl... |
import sys,ctypes,pydbgeng
## types
class GUID(ctypes.Structure):
_fields_ = [
("Data1", c_ulong),
("Data2", c_ushort),
("Data3", c_ushort),
("Data4", c_byte*8)
]
def set(self, string):
# extract guid
if string[0] != "{" and string[-1] != "}":
rai... |
import os
import imageio
import numpy as np
from ISR.utils.logger import get_logger
class DataHandler:
"""
DataHandler generate augmented batches used for training or validation.
Args:
lr_dir: directory containing the Low Res images.
hr_dir: directory containing the High Res images.
... |
# Copyright 2020 Huy Le Nguyen (@usimarit)
#
# 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 t... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.test import TestCase
from django.db import models
from opps.flatpages.models import FlatPage
class FlatPagesFields(TestCase):
def test_show_in_menu(self):
field = FlatPage._meta.get_field_by_name('show_in_menu')[0]
self.assertFalse(field.... |
#!/usr/bin/env python
"""This file is part of the django ERP project.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLD... |
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
from jinja2 import Environment, FileSystemLoader
from os import path
from yaml import SafeLoader, safe_load
CASES_FILENAME = 'cmdline.yml'
TEMPLATE_FILENAME = 'cmdline_gen.jinja'
TEST_FILENAME = 'test_cmdline_gen.c'
ROOT_DIRPATH = path.dirname(path.dirname(path.join(path.abspath(__file__))))
COMMON_DIRPATH = ... |
"""Support for Mailgun."""
import hashlib
import hmac
import json
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.const import CONF_API_KEY, CONF_DOMAIN, CONF_WEBHOOK_ID
from homeassistant.helpers import config_entry_flow
from .const import DOMAIN
_LO... |
class DateTimeWrapper:
def __init__(self, app, dt):
self._app = app
if isinstance(dt, str):
self._dt = self._parse_datetime(dt)
else:
self._dt = dt
def datetime(self):
return self._dt
def before(self, dt_str):
time = self._parse_datetime(dt_... |
from flask import Flask, render_template
from flask_wtf import Form
from wtforms import StringField, PasswordField
from wtforms.validators import InputRequired, Email, Length, AnyOf
from flask_bootstrap import Bootstrap
app = Flask(__name__)
Bootstrap(app)
app.config['SECRET_KEY'] = 'DontTellAnyone'
class LoginForm(... |
from django.apps import AppConfig
class DrfappConfig(AppConfig):
name = 'drfapp' |
#!/usr/bin/python env
# The MIT License (MIT)
#
# Copyright (c) 2015 by Brian Horn, trycatchhorn@gmail.com.
#
# 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 w... |
from __future__ import print_function
import pyslurm
def main():
try:
a = pyslurm.job()
jobs = a.get()
print(jobs)
except ValueError as e:
print("Job list error - {0}".format(e.args[0]))
if __name__=="__main__":
main() |
#!/usr/bin/env python
# coding: utf-8
import logging
import easylogconfig
log = logging.getLogger(__name__)
easylogconfig.auto(debug=True)
log.info("info message")
log.error("error message")
log.debug("debug message") |
import json
import numpy as np
import metrics
import tokenization
import utils
from config import opt
def write2file(data, path):
with open(path, 'w') as f:
f.write(json.dumps(data, ensure_ascii=False))
def get_BIO(self, tag):
return self.id2tag[tag]
# if tag == 0:
# return 'O'
# if ... |
import requests
import sys
res = requests.put("http://challenges.clusterfights.com/challenge/" + sys.argv[1], json={
"solution": {
"secret": sys.argv[2]
}
})
print(res.json()['runtime']) |
from math import floor
import numpy as np
from .graph import load_edge_list, load_adjacency_matrix
from .graph_dataset import BatchedDataset
from ..config_loader import get_config
def load_dataset():
data_config = get_config().data
if graph_data_type == "edge":
idx, objects, weights = load_edge_lis... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.4'
# jupytext_version: 1.2.0
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# # s_ch... |
# -*- 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 -*-
""" Print accepted talks not scheduled and not accepted talks which have been
scheduled.
"""
from collections import defaultdict
from optparse import make_option
import operator
import simplejson as json
from django.core.management.base import BaseCommand, CommandError
from djan... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# booksforcha documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
#... |
"""
https://sat-cdn1.apple-mapkit.com/tile?style=7&size=1&scale=1&z=19&x=84135&y=202065&v=4002&accessKey=1549129912_6641142575737855346_%2F_9%2F4MX0U5yhJDc3LDXazhcQj3xjCJU%2BYsiKcviN%2FnWxE%3D&emphasis=standard&tint=dark
https://sat-cdn4.apple-mapkit.com/tile?style=7&size=1&scale=1&z=19&x=84135&y=202061&v=4002&accessK... |
# -*- coding: utf-8 -*-
"""
This module offers a generic Easter computing method for any given year, using
Western, Orthodox or Julian algorithms.
"""
import datetime
__all__ = ["easter", "EASTER_JULIAN", "EASTER_ORTHODOX", "EASTER_WESTERN"]
EASTER_JULIAN = 1
EASTER_ORTHODOX = 2
EASTER_WESTERN = 3
def easter(year,... |
import argparse
import errno
import importlib
import logging
import os
import typing
from components import CheckSolver
logging.basicConfig(
format='%(asctime)s - %(message)s',
datefmt='%d-%b-%y %H:%M:%S',
level=logging.INFO
)
LOGGER = logging.getLogger()
SOLUTIONS_DIR = os.environ["SOLUTIONS_DIR"]
ATTRIBUTES... |
from django.apps import AppConfig
class AddConfig(AppConfig):
name = 'add' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.