text stringlengths 2 999k |
|---|
"""Support for Orvibo S20 Wifi Smart Switches."""
import logging
from orvibo.s20 import S20, S20Exception, discover
import voluptuous as vol
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
from homeassistant.const import (
CONF_DISCOVERY,
CONF_HOST,
CONF_MAC,
CONF_NAME,
C... |
#
# 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 us... |
import sys
import os
import argparse
import logging
import json
import time
import numpy as np
import openslide
import PIL
import cv2
import matplotlib.pyplot as plt
from scipy import ndimage
from torch.utils.data import DataLoader
import math
import json
import logging
import time
import tensorflow as tf
from tensorfl... |
from movies.core.db.models.base_class import Base
from movies.core.db.models.genre import Genre # noqa
from sqlalchemy import Boolean, Column, Date, Float, ForeignKey, Integer, String, Table
from sqlalchemy.orm import relationship
movie_genres = Table(
"movie_genres",
Base.metadata,
Column("movie_id", Int... |
class ColorTester:
def __init__(self, on_canvas, name, height=None):
self.name = name
self.height = height
self.position_to_color_expected = {}
self.on_canvas = on_canvas
self.position_to_color_found = {}
def add_check(self, x, y, color_list_expected):
yadj ... |
""" This script is used to clean team offense data and load into database """
# Standard library imports
import logging
from pathlib import Path
# Third party imports
import pandas as pd
# Local imports
from naccbis.Common import utils, metrics
from naccbis.Common.splits import Split
class TeamOffenseETL:
"""ET... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import os
from pathlib import Path
from typing import Any, List
import optuna
from hydra.core.override_parser.overrides_parser import OverridesParser
from hydra.core.plugins import Plugins
from hydra.plugins.sweeper import Sweeper
from hydra.test_u... |
from ...isa.inst import *
import numpy as np
class Vmv_v_i(Inst):
name = 'vmv.v.i'
# vmv.v.i vd, imm
def golden(self):
if self['vl']==0:
return self['ori']
result = self['ori'].copy()
vstart = self['vstart'] if 'vstart' in self else 0
for ii in range(v... |
import sqlite3
class DBHelper:
def __init__(self, dbname="nsnotif.sqlite"):
self.dbname = dbname
self.conn = sqlite3.connect(dbname)
def setup(self):
tblstmt = "CREATE TABLE IF NOT EXISTS users (username text , cid text, PRIMARY KEY(username))"
self.conn.execute(tblstmt)
... |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.base.exchange import Exchange
import math
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import AuthenticationE... |
from __future__ import unicode_literals
import logging
from django.conf import settings
from django.core.exceptions import ValidationError
from nodeconductor.openstack.models import SecurityGroup, SecurityGroupRule
logger = logging.getLogger(__name__)
def set_spl_default_availability_zone(sender, instance=None, *... |
# coding: utf-8
""" Handle Steps Plugins """
import importlib
import os
import pkgutil
import sys
import tmt
import fmf
log = fmf.utils.Logging('tmt').logger
def explore():
""" Explore all available plugins """
# Check all tmt steps for native plugins
root = os.path.dirname(os.path.realpath(tmt.__fil... |
"""
Functions used by the dyn_model
"""
# Modules
# ------------------------------------------------------------------------------
import ipdb
import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import fminbound, nnls, minimize_scalar
from scipy.signal import dlsim, dlti
from models import ModelDyn... |
import numpy as np #import numpy library
#integers
i = 10 #integer
print(type(i)) #print out the data type of i
a_i = np.zeros(i,dtype=int) #declare an array of ints
print(type(a_i)) #will return ndarray
print(type(a_i[0])) #will return int64
#floats
x = 119.0 #floating point number
print(typ... |
import ml
import gym
import cv2
import operator
import random
import torch
import torchvision
import numpy as np
import functools as ftools
import torch.nn as nn
import torch.nn.functional as F
import torchvision.datasets as datasets
from collections import deque
class RLModel:
... |
#!/usr/bin/env python
import plivohelper
# URL of the Plivo REST service
REST_API_URL = 'http://127.0.0.1:8088'
API_VERSION = 'v0.1'
# Sid and AuthToken
SID = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
AUTH_TOKEN = 'YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY'
# Define Channel Variable - http://wiki.freeswitch.org/wiki/Channel_Vari... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import os
import sys
from io import open
from setuptools import setup
def read_file(fpath):
with open(fpath, encoding='utf-8') as r:
return r.read()
def find_version(*file_paths):
fpath = os.path.join(os.path.dirname(__file__), *file_paths)
... |
import cv2
import os
import numpy as np
INIT_SIZE = 24
FONT_WIDTH_FACTOR = 0.8
c_h, c_w = 128, 128
scale = 3
img_num = 7
max_row_w = 6
i_size = (1920, 1080)
start_index = len('The_SoulTaker_01_a_sr_')
font_size = 24
header_h = font_size * 3
coords = [(780, 966), (579, 762), (482, 497),
(385, 968), (485, 10... |
import matplotlib.pyplot as plt
import numpy as np
import qcodes as qc
from qcodes import (
Measurement,
load_or_create_experiment,
)
from qcodes.dataset.plotting import plot_dataset
from qcodes_driver.driver import *
pulse_len = 1000
config = {
"version": 1,
"controllers": {
"con1": {
... |
"""izi/_version.py
Defines izi version information
Copyright (C) 2018 IZI Global
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 u... |
"""initial import
Revision ID: 60e67101bbe0
Revises:
Create Date: 2020-05-11 00:00:14.098387
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '60e67101bbe0'
down_revision = None
branch_labels = None
depends_on = None
... |
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 15 14:35:42 2018
@author: stuti.verma
"""
from requests import get
from requests.exceptions import RequestException
from contextlib import closing
from bs4 import BeautifulSoup
def simple_get(url):
"""
Attempts to get the content at `url` by maki... |
import string
# ! The cide below will store the alphabet.
# "abcdefghijklmnopqrstuvwxyz"
alphabet = string.ascii_lowercase
def decrypt(encrypted_message, key):
encrypted_message = encrypted_message.lower()
decrypted_message = ""
for c in encrypted_message:
if c in alphabet:
position ... |
# -*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
# Name: util
# Purpose:
#
# Authors: Maik Heistermann
#
# Created: 2015-11-6
# Copyright: (c) Maik Heistermann
# Licence: The MIT License
#--------------------------------------------------... |
import bpy
from bpy_extras.io_utils import ImportHelper
from bpy.types import Operator
from bpy.utils import register_class
from bpy.props import (
BoolProperty,
CollectionProperty,
StringProperty,
)
import math
import os
import struct
pitch_offset = math.radians(90)
bpy.context.scene.render.fps = 60.0
... |
from django.contrib.auth.models import User, Group
from rest_framework import serializers
from controller.models import Device, Sensor
|
#!/usr/bin/env python3
"""CS 424 Program 1
@author Jacob Rigby
@date 6 July 2017
The dice game Beetle, developed using Python 3.6.1, using a Tk GUI"""
# Copyright 2017 Jacob Rigby
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Li... |
from errant.alignment import Alignment
from errant.edit import Edit
from spacy.tokens import Doc
import logging
logging.basicConfig(
format="[%(asctime)s.%(msecs)03d] %(levelname)s %(message)s",
datefmt="%Y-%m-%d_%H:%M:%S",
level=logging.INFO,
)
# Main ERRANT Annotator class
class Annotator:
# Input ... |
"""
Several answers to smoking questions were incorrectly coded as questions
This rule generates corrected rows and deletes incorrect rows
"""
import bq_utils
from constants.cdr_cleaner import clean_cdr as cdr_consts
import sandbox
SMOKING_LOOKUP_TABLE = 'smoking_lookup'
NEW_SMOKING_ROWS = 'new_smoking_rows'
SMOKING_... |
# -*- coding: utf-8 -*-
"""
Bootstrap-Flask
~~~~~~~~~~~~~~
:copyright: (c) 2017 by Grey Li.
:license: MIT, see LICENSE for more details.
"""
from os import path
from codecs import open
from setuptools import setup
here = path.abspath(path.dirname(__file__))
# Get the long description from the README f... |
#Given an array of integers, calculate the fractions of its elements that are positive, negative, and are zeros.
#Print the decimal value of each fraction on a new line.
import math
import os
import random
import re
import sys
def plusMinus(arr,i):
c=0
d=0
e=0
for n in arr:
if n>0:
... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 28 16:55:14 2017
@author: hj
"""
import pandas as pd
import tensorflow as tf
import numpy as np
def retrieve_data(year):
df_data = pd.DataFrame.from_csv("ca-features-{0}.dataframe".format(year))
return df_data
def input_fn(df):
... |
'''Returns the one hot vectors for the y label'''
import torch
from torchvision import datasets, transforms
MNIST_TEST_SIZE = 10000
NUM_MNIST_CLASSES = 10
def get_test_y_onehot():
# Return onehot matrix of test y labels
test = datasets.MNIST('./data', train=False, download=True, transform=transforms.ToTens... |
import os
import time
import subprocess
import requests
import json
#from .create_load_test_file import *
import logging
def get_url_delete(URL,data):
try:
if URL[len(URL)-1] == '/':
A = ''
else:
A = '/'
URL = URL + A
NAME = data.keys()
VALUE... |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "PolyTrend", cycle_length = 0, transform = "Logit", sigma = 0.0, exog_count = 0, ar_order = 0); |
from header_sounds import *
sounds = [
("click", sf_2d|sf_vol_3,["drum_3.ogg"]),
("tutorial_1", sf_2d|sf_vol_7,["tutorial_1.ogg"]),
("tutorial_2", sf_2d|sf_vol_7,["tutorial_2.ogg"]),
("gong", sf_2d|sf_priority_9|sf_vol_7, ["s_cymbals.ogg"]),
("quest_taken", sf_2d|sf_priority_9|sf_vol_7, []),
("quest_comp... |
import sys
import ast
import re,os
import pandas as pd
import numpy as np
import itertools
from fmtutil.row.parse_verbose_argvars import ParsedTuple
from pathlib import Path
from pdb import set_trace as st
from typing import Dict, List, Any, Iterable
from toolz.functoolz import compose_left
from dataclasses import da... |
#!/usr/bin/env python2
'''
Unit tests for oc user
'''
# To run
# ./oc_user.py
#
# ..
# ----------------------------------------------------------------------
# Ran 2 tests in 0.003s
#
# OK
import os
import sys
import unittest
import mock
# Removing invalid variable names for tests so that I can
# keep them brief
# p... |
# encoding=UTF-8
# Copyright © 2007-2016 Jakub Wilk <jwilk@jwilk.net>
#
# 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,... |
# Copyright 2021 cstsunfu. 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 agr... |
import nose
# import custom RFCx modules from modules folder
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from modules import service_layer
from modules.domain_modules import load_sound
from modules.domain_modules import spectral_analysis
from modules.domain_modules... |
import taichi as ti
@ti.all_archs
def test_loops():
x = ti.var(ti.f32)
y = ti.var(ti.f32)
N = 512
@ti.layout
def place():
ti.root.dense(ti.i, N).place(x)
ti.root.dense(ti.i, N).place(y)
ti.root.lazy_grad()
for i in range(N // 2, N):
y[i] = i - 300
@ti.kernel
def func():
for i i... |
from django.urls import path
from cadastroEmp.views import IndexTemplateView, EstabelecimentoListView, EstabelecimentoUpdateView, EstabelecimentoCreateView, \
EstabelecimentoDeleteView
from . import views
app_name = 'cadastroEmp'
urlpatterns = [
path('', IndexTemplateView.as_view(), name="index"),
path(... |
# coding: utf-8
import app.core.game_module_def as game_module_def
import app.core.module.game_main as game_main
import app.base.game_module_mgr
import app.core.module.gm as gm
import app.core.module.mainplayer as mainplayer
import app.core.module.pet as pet
import app.core.module.partner as partner
import app.core.mo... |
class PizzaDelivery:
def __init__(self, name, price, ingredients):
self.name = name
self.price = price
self.ingredients = ingredients
self.ordered = False
def add_extra(self, ingredient, quantity, price_per_ingredient):
if not self.ordered:
if ingredient in s... |
import sys
#sys.path.append('path_to_sasmodels')
import numpy as np
from bumps.names import *
from sasmodels.core import load_model
from sasmodels.bumps_model import Model, Experiment
from sasmodels.data import load_data, plot_data
# IMPORT THE DATA USED
data = load_data(sys.argv[1])
#setattr(data, 'qmin', 0.0)
#se... |
import _plotly_utils.basevalidators
class TokenValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(self, plotly_name="token", parent_name="ohlc.stream", **kwargs):
super(TokenValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... |
def get_codes():
results = []
with open('./emojis.txt') as f: lines = f.read().split('\n')
for l in lines:
temp = l.split(';')[0].strip().split('..')
if len(temp) > 1:
results.append( [int(temp[0], 16), int(temp[1], 16)] )
else:
results.append( [int(temp[0], 1... |
import math
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sweetviz.sv_types import FeatureType
import sweetviz.graph
from sweetviz.config import config
import itertools
import matplotlib.patches as patches
from textwrap import wrap
# Portions of this file contain code from the following r... |
r"""HTTP/1.1 client library
<intro stuff goes here>
<other stuff, too>
HTTPConnection goes through a number of "states", which define when a client
may legally make another request or fetch the response for a particular
request. This diagram details these state transitions:
(null)
|
| HTTPConnection(... |
# -*- coding: utf-8 -*-
import DAQmxConfig
from DAQmxTypes import *
from DAQmxConstants import *
from DAQmxFunctions import *
from Task import Task
import DAQmxConstants
import DAQmxFunctions
all_types = ['int8', 'uInt8', 'int16', 'uInt16', 'int32', 'uInt32', 'float32', 'float64', 'int64', 'uInt64', 'bool32',
... |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class CarItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
CarModel = scrapy.Field()
CarType = sc... |
"""
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
import pytest
from byceps.services.authentication.session import service as session_service
from byceps.services.user import event_service
@pytest.fixture
def client(admin_app, site):
return admin_app.test_... |
from __future__ import annotations
from logging import getLogger
from socket import AF_INET, SOCK_STREAM
from threading import Thread
from types import TracebackType
from typing import Optional, Tuple, Type
from ..constants import buffer_size
from ..log.util import log_method_call
from ..receive import IReceiveListener... |
#!"D:\Users\Baptiste\Documents\Perso\Cours\Master\Projet Girbau\projetgirbau\backend\venv\Scripts\python.exe"
# EASY-INSTALL-ENTRY-SCRIPT: 'timestring==1.6.4','console_scripts','timestring'
__requires__ = 'timestring==1.6.4'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
... |
"""Everything related to the CLI."""
import click
from _pytask.config import hookimpl
@hookimpl
def pytask_extend_command_line_interface(cli):
"""Add stata related options to the command line interface."""
additional_parameters = [
click.Option(
["--stata-keep-log"],
help=(
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 7 20:46:41 2020
@author: inderpreet
This code plots the calibration curves for both QRNN-single and QRNN-all
This script is used to plot Figure 11 of the article.
"""
import os
import matplotlib.pyplot as plt
import numpy as np
import netCDF4
fr... |
from django.test import TestCase
from django.contrib.auth import get_user_model
class ModelTests(TestCase):
def test_create_user_with_email_successful(self):
"""Test creating a new user with an email successful"""
email = 'test@india.com'
password = 'Testpass123'
user = get_user_mo... |
from .readers import CollectionReader
from .utils import has_tensorboard
from argparse import ArgumentParser
import subprocess
import os
from os.path import join
import re
#http://localhost:8001/source/examples/2.html#walkthrough-2-using-cox-with-tensorboardx
def main():
'''
This function is meant to be run vi... |
"""Top-level package for ETL Markup Toolkit."""
__author__ = """Leo Qin"""
__email__ = 'leozqin@gmail.com'
__version__ = '0.1.0'
|
'''Sequence to sequence example in Keras
English to Tagalog sentence pairs.
http://www.manythings.org/anki/tgl-eng.zip
Lots of neat sentence pairs datasets can be found at:
http://www.manythings.org/anki/
# References
- Sequence to Sequence Learning with Neural Networks
https://arxiv.org/abs/1409.3215
- Learni... |
# check to strings that represent version numbers and finds the greatest,
# 'equals' if they are the same version or 'Invalid Format'
# example: “1.2” is greater than “1.1”.
# for reusability this function just returns the version number or the word equals
# if a more elaborated answer is needed an interface would be... |
from flask import render_template
from data import tours, departures
def tour_html(id):
return render_template('tour.html',tour = tours[int(id)], departure = departures) |
# MIT License
#
# Copyright (c) 2021 Intelligent Systems Club
#
# 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, mo... |
# Database Credentials - Use this file rather than hard coding them into scripts
# These credentials are no longer valid!
class Config:
def __init__(self):
self.host = ""
self.user = ""
self.passwd = ""
self.database = ""
|
#!/usr/bin/env python
"""
ensight2vtk script
==================
This script converts parts from EnSight Gold case into
files in VTK legacy ASCII format.
Demonstrates reading steady-state geometry, node coordinates,
connectivity, per-node and per-element variable data
using memory-mapped I/O.
For commandline usage, ... |
# Generated by Django 2.1.15 on 2020-09-30 15:42
import core.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0004_recipe'),
]
operations = [
migrations.AddField(
model_name='recipe',
name='image',
... |
import torch
import torch.nn as nn
from models.arch_util import ConvGnLelu
from models.stylegan.stylegan2_rosinality import Generator
class Stylegan2LatentBank(nn.Module):
def __init__(self, pretrained_model_file, encoder_nf=64, encoder_max_nf=512, max_dim=1024, latent_dim=512, encoder_levels=4, decoder_levels=3... |
import numpy as np
from starspot import phase_dispersion_minimization as pdm
import matplotlib.pyplot as plt
import starspot as ss
def test_sj2():
np.random.seed(42)
N = 10000
t = np.linspace(0, .1, N)
x = np.random.randn(N)
sj2 = pdm.sj2(x, 0, N)
assert np.isclose(sj2, 1, atol=.01)
def test... |
from tracardi.service.storage.driver import storage
from tracardi.service.plugin.runner import ActionRunner
from tracardi.service.plugin.domain.register import Plugin, Spec, MetaData, Form, FormGroup, FormField, FormComponent, \
Documentation, PortDoc
from tracardi.service.plugin.domain.result import Result
from py... |
from django.db import models
import fts
class Blog(fts.SearchableModel):
title = models.CharField(max_length=100)
body = models.TextField()
# Defining a SearchManager without fields will use all CharFields and TextFields
# this is the default and you do not need to explicitly add the following... |
# Copyright (c) 2012 Roberto Alsina y otros.
# 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... |
from setuptools import setup
# This is the atca_rapid_response_api Python library.
# Jamie Stevens 2017
# ATCA Senior Systems Scientist
# Jamie.Stevens@csiro.au
setup(name='atca_rapid_response_api',
version='1.2',
description='ATCA Rapid Response Mode API',
url='https://github.com/ste616/atca-rapid-... |
import platform
import pytest
import torch
from torch.utils.data.dataloader import DataLoader
from torch.utils.data.dataset import Subset
import tests.base.utils as tutils
from pytorch_lightning import Trainer
from pytorch_lightning.utilities.exceptions import MisconfigurationException
from tests.base import EvalMode... |
# Copyright (c) 2021 Johnathan P. Irvin
#
# 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,... |
import sys
import click
from tabulate import tabulate
from . import admin
from ...session import Session
from ..pretty import print_error, print_fail
@admin.command()
def keypair():
'''
Show the server-side information of the currently configured access key.
'''
fields = [
('User ID', 'user_... |
from talon import Context, Module, actions
mod = Module()
mod.list("windows_dlls", desc="A list of shortcut names for windows DLLs")
ctx = Context()
ctx.matches = r"""
mode: user.windbg
"""
ctx.lists["self.windows_dlls"] = {
"core": "ntdll",
"en tea": "ntdll",
"user": "user32",
}
@mod.capture(rule="{... |
# Suppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of favorite
# restaurants represented by strings.
# You need to help them find out their common interest with the least list index sum. If there is a
# choice tie between answers, output all of them with no order requirement. Yo... |
# -*- coding: utf-8 -*-
import logging
import os
import tempfile
import xml.etree.ElementTree as ET
from collections import OrderedDict, defaultdict
from functools import lru_cache
import numpy as np
import torch
from detectron2.data import MetadataCatalog
from detectron2.utils import comm
from detectron2.utils.logge... |
#!/usr/bin/env python
import rospy
import cv2
from cv_bridge import CvBridge, CvBridgeError
from sensor_msgs.msg import Image
from std_msgs.msg import String, Float32
import numpy as np
import cv2.aruco as aruco
import sys
class ImageProcessor():
def __init__(self):
#cv bridge class
self.bridge ... |
"""$Id: entry.py 699 2006-09-25 02:01:18Z rubys $"""
__author__ = "Sam Ruby <http://intertwingly.net/> and Mark Pilgrim <http://diveintomark.org/>"
__version__ = "$Revision: 699 $"
__date__ = "$Date: 2006-09-25 02:01:18 +0000 (Mon, 25 Sep 2006) $"
__copyright__ = "Copyright (c) 2002 Sam Ruby and Mark Pilgrim"
from ba... |
# -*- coding: utf-8 -*-
"""
sqldiff.py - Prints the (approximated) difference between models and database
TODO:
- better support for relations
- better support for constraints (mainly postgresql?)
- support for table spaces with postgresql
- when a table is not managed (meta.managed==False) then only do a one-way
... |
#! /usr/bin/python3
import numpy
import argparse
import logging
import sacrebleu
# local dependency
# noinspection PyUnresolvedReferences
from bleu_weighted_precision import WeightedBLEU
OVERLAP_FUNCTIONS = ["word", "bleu2", "chrf"]
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argumen... |
from __future__ import absolute_import
from checkout_sdk.api_client import ApiClient
from checkout_sdk.authorization_type import AuthorizationType
from checkout_sdk.checkout_configuration import CheckoutConfiguration
from checkout_sdk.client import Client
from checkout_sdk.payments.payments import RefundRequest, VoidR... |
from django.contrib import admin
from django.forms.models import ModelForm
from django.forms.widgets import CheckboxInput
from django.shortcuts import redirect
from django.urls import re_path, reverse
from django.utils.html import format_html
from django.utils.translation import gettext_lazy as _
from rest_framework.re... |
import json
import time
import threading
import os
import cv2
import igraph as ig
from tcp_server import TcpServer
from pg_parser import PgParser
COLOR_DICT = {
"ConceptNode": "#0C6DEF",
"ObjectNode": "#EF0C0C"
}
class PgViewer(object):
def __init__(self):
self.parser_ = PgParser()
def ... |
# 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... |
# Copyright (c) 2022 PaddlePaddle 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 appli... |
# Copyright 2022 Accenture Global Solutions Limited
#
# 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 ... |
#!/usr/bin/env python3
# Copyright 2014-2018 PUNCH Cyber Analytics Group
#
# 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
#
# Un... |
import spotipy
from spotipy.oauth2 import SpotifyClientCredentials
CLIENT_ID = '458d767d30034a44828d668093119d4f'
CLIENT_SECRET = '94362b7769f64dd298ae57852647527b'
SPOTIFY = spotipy.Spotify(client_credentials_manager=SpotifyClientCredentials(
client_id=CLIENT_ID, client_secret=CLIENT_SECRET))
# <-- Artist Spo... |
"""Copyright 2009 Chris Davis
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
dist... |
""" MD2Slide
NAME
md2slide - markdown to slide
SYNOPSIS
md2slide [OPTION] [Directory]
DESCRIPTION
-h, --help
show usage
-p, -port
assign the port number of web server
-v, --verbose
EXAMPLES
# see the tutorial
md2slide
# see the mdslide in the folder
md2slide ... |
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
from keras.utils import to_categorical
import numpy as np
import keras
import pickle
OOV = '<UNK>'
BOS = '<BOS>'
EOS = '<EOS>'
def tokenize(tknzr, text, maxlen=40, pad=True):
'''
Tokenize a list of sentences
... |
def nonDivisibleSubset(k, s):
remainderArray = [0] * k
for i in s:
remainderArray[i % k] += 1
if remainderArray[0] > 0:
maxSet = 1
else:
maxSet = 0
for x in range(1, (k+1) // 2):
maxSet += max(remainderArray[x], remainderArray[k-... |
from .logging_middleware import LoggingMiddleware # noqa
try:
from .django_db_middleware import DjangoDBMiddleware # noqa
except ImportError:
pass
|
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Proenterprise Ventures and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
class Settings(Document):
pass
|
from django.views.generic import TemplateView, DetailView
from .models import Page
class HomeView(TemplateView):
template_name = 'main/home.html'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['page'] = Page.objects.get_home_page()
return co... |
import logging
import pytest
import mock
import datetime
import random
import faker
import inspect
from milvus import Milvus
from milvus.client.types import Status, IndexType, MetricType
from milvus.client.abstract import IndexParam, CollectionSchema
from milvus.grpc_gen import status_pb2, milvus_pb2
from mishards impo... |
# import datetime
# def round_time(time, round_to, sign):
# rounded = time + datetime.timedelta(minutes=round_to/2.)
# rounded -= datetime.timedelta(minutes=rounded.minute % round_to,
# seconds=rounded.second,
# microseconds=rounded.microsecond)
# #dir is positive:
# if sign>0:
# if rounded>... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.