content stringlengths 5 1.05M |
|---|
from abc import ABCMeta, abstractmethod
from .tilfile import *
from .utils import *
RESERVED_BYTE = 0xFF
TYPE_BASE_MASK = 0x0F
TYPE_FLAGS_MASK = 0x30
TYPE_MODIF_MASK = 0xC0
TYPE_FULL_MASK = TYPE_BASE_MASK | TYPE_FLAGS_MASK
BT_UNK = 0x00
BT_VOID = 0x01
BTMT_SIZE0 = 0x00
BTMT_SIZE12 = 0x10
BTMT_SIZE48 = 0x20
BTMT_SIZ... |
"""Level Playlist Service."""
from playlist.enums import PlaylistCategory, LevelPlaylistName
from playlist.models import Playlist
from playlist.service.abstract import AbstractPlaylistService
from playlist.utils import formulas
from playlist.utils.definition import ConstraintDefinition
class LevelService(AbstractPlay... |
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 13 13:35:33 2020
"""
#for finding loss of significances
x=1e-1
flag = True
a=0
while (flag):
print (((2*x)/(1-(x**2))),"......",(1/(1+x))-(1/(1-x)))
x= x*(1e-1)
a=a+1
if(a==25):
flag=False
|
# -*- coding: utf-8 -*-
#
# 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
#... |
from twilio.rest.resources.util import transform_params
from twilio.rest.resources import InstanceResource, ListResource
class Sandbox(InstanceResource):
id_key = "pin"
def update(self, **kwargs):
"""
Update your Twilio Sandbox
"""
a = self.parent.update(**kwargs)
sel... |
# https://www.hackerrank.com/challenges/defaultdict-tutorial/problem
from collections import defaultdict
A_size, B_size = map(int, input().split())
A_defaultdict = defaultdict(list)
B_list = list()
for i in range(0, A_size):
A_defaultdict[input()].append(i + 1)
for i in range(0, B_size):
B_list = B_list ... |
def test_basic_front_end(flask_app):
with flask_app.test_client() as client:
response = client.get(
"/a/random/page"
)
assert response.status_code == 200
def test_basic_front_end_next(flask_app, auth_user):
with flask_app.test_client(user=auth_user) as client:
with cli... |
"""
"""
from django.contrib.auth.models import AbstractUser
from django.db import models
class BPUser(AbstractUser):
is_tester = models.NullBooleanField(db_column='IS_TESTER', null=True, blank=False)
last_login = models.DateTimeField(db_column='LAST_LOGIN', auto_now_add=True, blank=False)
class Meta:
... |
# --------------
# Importing header files
import numpy as np
# Path of the file has been stored in variable called 'path'
data_file=path
data=np.genfromtxt(data_file, delimiter=",", skip_header=1)
print("\nData: \n\n", data)
print("\nType of data: \n\n", type(data))
#New record
new_record=[[50, 9, 4, 1, ... |
# coding:utf-8
from users import (User, UserIp, UserInvitation, Characters, Permission, Role, Message,
UserMessage, UserOnline, PermissionRole, permission_has_role, role_is_admin)
from info import Donate, GuildInfo, Agreement
from prompt import AlivePrompt, LevelPrompt, RacePrompt, JobPrompt, Gender... |
###USER should be able to edit password
import webbrowser
import json
import requests
## assume dictionary of password for each user
def getContent(url):
content = requests.get(url).content
user_dic = json.loads(content)
return user_dic
API_url = "http://127.0.0.1:8000/request/"
resoinse_dict = getContent... |
# why do we need reference variables:
# बस इतना समझ लीजिए की अगर हीलीअम गैस से भरे गुब्बारे को किसी धागे से नहीं बाँधेंगे तो क्या होगा?
# गुब्बारा इधर-उधर उड़ जाएगा!
class Mobile:
def __init__(self, brand, price):
print("Mobile created using location ID: ", id(self))
self.brand = brand
self... |
import json
from girder import events
from girder.constants import registerAccessFlag, AccessType, TokenScope
from girder.plugins.jobs.constants import JobStatus
from girder.utility.model_importer import ModelImporter
from . import constants
from .rest import ItemTask
from .json_tasks import createItemTasksFromJson, c... |
"""Agilent N6705B Power Supply SCIPI Class.
Copyright (c) 2014 The Project Loon Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file
"""
__author__ = "Alfred Cohen"
__email__ = "alfredcohen@google.com"
import time
class Driver(object):
"""A... |
import os
from collections import OrderedDict
from .config import Config
from .utils import Utils, Clr
from .bitbucket import BitBucketApi
class Setup:
def __init__(self):
pass
@staticmethod
def service(package_dir=None, m_service=None):
i = 0
pkg_txt = ' '
pkg_input_hint... |
# Generated by Django 3.1.3 on 2020-11-23 11:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fit', '0005_auto_20201123_1627'),
]
operations = [
migrations.CreateModel(
name='Pharmacy',
fields=[
... |
#!/usr/bin/python
###
# Copyright (2016-2017) Hewlett Packard Enterprise Development LP
#
# 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
#
# Unle... |
# coding:utf-8
"""
@Time : 2021/6/16 上午10:03
@Author: chuwt
"""
|
diccionario={'José':27,'Rafa':90,'Sara':30,'Luis':40}
print(diccionario['Rafa'])
print(len(diccionario))
|
def gcd(a, b):
while b:
a, b = b, a % b
return a
for a in range(1, 500):
b1 = 1000 * (500 - a)
b2 = 1000 - a
if gcd(b1, b2) == b2:
b = b1 // b2
c = 1000 - a - b
print(a * b * c)
break
|
from setuptools import setup, find_packages
from hand_obj_interaction import commands
setup(
name='hand_obj_interaction',
version='0.1',
description='2D to 3D',
python_requires='>=3.7',
packages=find_packages()
) |
from .st import *
from .mt import makeMask
import numpy as np, matplotlib.pyplot as plt, cv2
def Erode_Dilate(mask):
def process(mask_, kernel, iters):
top_erode1 = cv2.erode(mask_, kernel, iterations=iters)
top_dilate = cv2.dilate(top_erode1, kernel, iterations=iters*2)
top_erode2 = cv2.erode(top_dilate, kerne... |
from gym.envs.mujoco import HalfCheetahEnv
import rlkit.torch.pytorch_util as ptu
import gym
import os
from rlkit.data_management.env_replay_buffer import EnvReplayBuffer
from rlkit.envs.wrappers import NormalizedBoxEnv
from rlkit.launchers.launcher_util import setup_logger
from rlkit.samplers.data_collector import M... |
from enum import Enum, auto
class Category:
def __init__(self, name, key):
self.name = name
self.key = key
class CategoryEnum(Enum):
PETI_MIN = Category('5minutovka na míru', '5min')
DOMOV = Category("Z domova", "domov")
ZAHRANICI = Category("Zahraničí", "zahranici")
SPORT = Catego... |
from google.appengine.ext import vendor
vendor.add('./Lib') |
import logging
from rest_framework import serializers
from rest_framework.validators import UniqueTogetherValidator
from rr.models.certificate import Certificate, certificate_validator
from rr.serializers.common import ActiveListSerializer
logger = logging.getLogger(__name__)
class CertificateSerializer(serializer... |
"""
test of drawing relations from relation space
"""
import torch
import numpy as np
from texrel import relations, spaces
def test_prep_equality():
left1 = relations.LeftOf()
left2 = relations.LeftOf()
above1 = relations.Above()
above2 = relations.Above()
assert left1 == left2
assert above1... |
from enum import Enum
class SpinnakerBootOpCode(Enum):
""" Boot message Operation Codes
"""
HELLO = 0x41
FLOOD_FILL_START = 0x1
FLOOD_FILL_BLOCK = 0x3
FLOOD_FILL_CONTROL = 0x5
def __new__(cls, value, doc=""):
obj = object.__new__(cls)
obj._value_ = value
r... |
from authors.apps.authentication.models import User
from rest_framework.test import APIClient, APITestCase
from rest_framework import status
from authors.apps.articles.models import Article
from authors.apps.articles.extra_methods import create_slug
class BaseTest(APITestCase):
articles_url = '/api/articles/'
... |
# -*- coding: utf-8 -*-
"""
**visualize** module
-------------------
"""
__all__ = ['show_hist', 'show_scatter', 'show_plot']
def show_hist(data, bins=10, orientation='vertical'):
# df = pd.concat([dataX,dataY], axis=1)
# df.hist(bins=bins, orientation=orientation).get_figure()
return data.plot(kind='hist', bins... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: protos/model/v1/datapoint.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
f... |
import unittest
from mppsolar.protocols.jk04 import jk04 as pi
class test_jk04_decode(unittest.TestCase):
maxDiff = None
def test_getInfo(self):
""" test the decode of a getInfo response"""
protocol = pi()
response = bytes.fromhex(
"55aaeb9003f14a4b2d4232413234530000000000... |
""" Tests for QUInt and QInt """
import unittest
from qublets import QPU, QUInt
class QUIntTest(unittest.TestCase):
def test_num_qubits(self):
q1 = QUInt.zeros(2)
q2 = QUInt.zeros(10)
self.assertEqual(q1.num_qubits, 2, "quint count mismatch")
self.assertEqual(q2.num_qubits, 10, "quint count misma... |
import os
from flask import Flask, render_template, jsonify, make_response
from flask_sqlalchemy import SQLAlchemy
import config
# Configure Flask app
app = Flask(__name__, static_url_path='/templates')
app.config.from_object(os.environ['APP_SETTINGS'])
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True
# Database
d... |
import click
import json
import os
from lib.common.config import CONFIG
from lib.services.avatar import AvatarService
@click.group()
def common_cmd():
pass
@common_cmd.command('list:ships')
def list_ships():
if not os.path.exists('data/ship.json'):
print('Data not exist, please update data first.')... |
import sutil.math.core as core
import sutil.math.integrate as integrate
# Heaviside function
def heaviside(x):
if x < 0:
return 0
elif x == 0:
return 0.5
else:
return 1
# Indicator function
def indicator(x, subset):
if x in subset:
return 1
else:
return 0
... |
import collections
import pandas as pd
import warnings
from typing import Union, Optional, List, Dict, Tuple
from autogluon.core.constants import MULTICLASS, BINARY, REGRESSION
from .constants import NULL, CATEGORICAL, NUMERICAL, TEXT
#TODO, This file may later be merged with the infer type logic in tabular.
def is_... |
import tkinter as tk
import tkinter.ttk as ttk
import math as m
# main definitions
import time
# rpyc servic definition
import rpyc
class MyService(rpyc.Service):
def __init__(self, tkRoot):
rpyc.Service.__init__(self)
self.root = tkRoot
print('Instantiated MyService with root: {}'.format(... |
from crispy_forms_gds.helper import FormHelper
from crispy_forms_gds.layout import Button
from crispy_forms_gds.layout import Layout
from django import forms
from django.contrib.auth.models import User
from django.db import transaction
from importer import models
from importer.chunker import chunk_taric
from importer.... |
from systems.commands import profile
import copy
class ProfileComponent(profile.BaseProfileComponent):
def priority(self):
return 7
def run(self, name, config):
networks = self.pop_values('network', config)
subnets = self.pop_values('subnets', config)
provider = self.pop_val... |
import sys
import argparse
from pathlib import Path
import pandas as pd
import yaml
def create_configs_from_inputs_csv(exp, scenarios_csv_file_path, simulation_settings_path, config_path,
run_script_path, update_check_rho=False):
"""
Create one simulation configuration fi... |
from tests.util import BaseTest
class Test_I2041(BaseTest):
def error_code(self) -> str:
return "I2041"
def test_pass_1(self):
code = """
import os.path as pat
from os import path
"""
result = self.run_flake8(code)
assert result == []
def test_pass... |
import argparse
import cv2
import random
from glob import glob
import time
import os, sys, inspect
current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
code_dir = os.path.dirname(os.path.dirname(current_dir))
sys.path.insert(0, code_dir)
from tools.utils import mkdir
from data.folde... |
"""
This module provides the molior UserRole database model.
UserRole : sqlAlchemy table
Constraint :
* the primary key is on the pair user_id/project_id
Columns :
* user_id
* user
* project_id
* project
* role
UserRoleEnum : array of possible roles
"""
from sqlalchemy import Column, ForeignKey, En... |
from django.db import models
from backends.mosso import cloudfiles_upload_to
class Photo(models.Model):
title = models.CharField(max_length=50)
image = models.ImageField(upload_to=cloudfiles_upload_to)
def __unicode__(self):
return self.title |
from .NamedObject import NamedObject
from .PPtr import PPtr
class Material(NamedObject):
def __init__(self, reader):
super().__init__(reader=reader)
version = self.version
self.m_Shader = PPtr(reader) # Shader
if version[0] == 4 and version[1] >= 1: # 4.x
self.m_ShaderKeywords = reader.read_string_array... |
#! python3
# takt-tickets.py is used to look for new Jira tickets or updated comments and notify
# via Slack.
import jira, shelve, requests
NOTIFICATIONS = {
'slack':True,
'email':False
}
notifyMsg = ''
# Create file to save settings
settings = shelve.open(".settings")
# Add setting to shelve if missi... |
# Generated by Django 3.1.8 on 2021-07-19 15:10
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="Videos",
fields=[
("id", models.AutoField(auto_c... |
from itertools import repeat
import yaml
import csv
import netmiko
import subprocess
from platform import system as system_name
from concurrent.futures import ThreadPoolExecutor, as_completed
import re
from netmiko import ConnectHandler
def ping_ip(ip):
param = "-n" if system_name().lower() == "windows" else "-c... |
"""Kraken - maths.vec2 module.
Classes:
Vec2 -- Vector 2 object.
"""
import math
from kraken.core.kraken_system import ks
from math_object import MathObject
class Vec2(MathObject):
"""Vector 2 object."""
def __init__(self, x=0.0, y=0.0):
"""Initializes x, y values for Vec2 object."""
super... |
class Warrior:
def __init__(self):
self.health = 50
self.attack = 5
@property
def is_alive(self):
return self.health > 0
def take_hit(self, hit):
self.health -= hit
return hit
def do_attack(self, other1, other2 = None, **options):
hit = options.get(... |
import sys
def merge_in_order(seq_a, seq_b):
seq_a = seq_a.copy()
seq_b = seq_b.copy()
result = []
while seq_a and seq_b:
if seq_a[0] > seq_b[0]:
result.append(seq_b.pop(0))
else:
result.append(seq_a.pop(0))
while seq_a:
result.append(seq_a.pop(0))
... |
[x1 for <error descr="Assignment expression cannot be used as a target here">(x1 := 2)</error> in (1, 2, 3)]
for <error descr="Assignment expression cannot be used as a target here">(x1 := 2)</error> in (1, 2, 3):
pass |
"""The tests for the Dialogflow component."""
import copy
import json
import pytest
from homeassistant import data_entry_flow
from homeassistant.components import dialogflow, intent_script
from homeassistant.config import async_process_ha_core_config
from homeassistant.core import callback
from homeassistant.setup im... |
import typing as ty
import numpy as np
from scipy import stats
import tensorflow as tf
import tensorflow_probability as tfp
import flamedisx as fd
export, __all__ = fd.exporter()
o = tf.newaxis
SIGNAL_NAMES = dict(photoelectron='s1', electron='s2')
class MakeFinalSignals(fd.Block):
"""Common code for MakeS1 a... |
from model import get_model
from data_loader import get_data
from tensorflow.keras.optimizers import SGD
from tensorflow.keras.losses import categorical_crossentropy
import os
os.system("pip install wandb -q")
import wandb
from wandb.keras import WandbCallback
growth_rate = int(input("Growth rate: "))
d = int(input("... |
import os
import sys
import re
import yaml
import numpy as np
import pandas as pd
import math
from tqdm import tqdm
from scipy import interpolate
sys.path.append("..")
class MaterialLoader:
def __init__(self,
wl_s=0.2,
wl_e=2.0):
super().__init__()
sel... |
from pathlib import Path
import pandas as pd
#------------------------------------------------------
fd_out='./out/a00_clean_01_tumor'
f_in='./out/a00_clean_00_load/tumor.csv'
l_cat=['None', 'IC', 'Small', 'Medium', 'Large']
#------------------------------------------------------
Path(fd_out).mkdir(exist_ok=True, par... |
# SPDX-License-Identifier: Apache-2.0
# Licensed to the Ed-Fi Alliance under one or more agreements.
# The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
# See the LICENSE and NOTICES files in the project root for more information.
import os
import pandas as pd
from edfi_schoology_ex... |
# MIT License
#
# Copyright (c) 2017
#
# 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... |
import argparse
import operator
import os
import random
import sys
from typing import Tuple
from rotkehlchen.assets.asset import Asset
from rotkehlchen.config import default_data_directory
from rotkehlchen.db.dbhandler import DBHandler
from rotkehlchen.db.utils import AssetBalance, LocationData
from rotkehlchen.fval i... |
import os
from dca.DCA import DCA
from dca.schemes import (
DCALoggers,
DelaunayGraphParams,
ExperimentDirs,
GeomCAParams,
HDBSCANParams,
REData,
)
import typer
import CL_utils
import numpy as np
import pickle
app = typer.Typer()
@app.command()
def CL_mode_truncation(cleanup: int = 1):
ex... |
import discord
import typing
import asyncio
import time
from discord.ext import commands
from nerdlandbot.translations.Translations import get_text as translate
from nerdlandbot.helpers.TranslationHelper import get_culture_from_context as culture
from nerdlandbot.helpers.TranslationHelper import get_culture_from_conte... |
#
# 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
# ... |
import json
from edge.blast import blast_genome
from edge.models import Operation
from Bio.Seq import Seq
class CrisprTarget(object):
def __init__(self, fragment_id, fragment_name, strand, subject_start, subject_end, pam):
self.fragment_id = fragment_id
self.fragment_name = fragment_name
... |
##
# Contains TranscriptomeIndexListView, TranscriptomeIndexDetailView, and needed serializer
##
from django.utils.decorators import method_decorator
from rest_framework import filters, generics, serializers
from django_filters.rest_framework import DjangoFilterBackend
from drf_yasg import openapi
from drf_yasg.utils... |
# -*- coding: utf-8 -*-
"""
String
collection of string related functions
Created on Sat May 2 19:05:23 2020
@author: Tim
"""
# return copy of given list of strings with suffix appended to each string
def string_append (strings: list, suffix: str) -> list:
temp = []
for s in strings:
temp.append(... |
from typing import Union
from pythonequipmentdrivers import Scpi_Instrument
from time import sleep
import numpy as np
class Agilent_N893XX(Scpi_Instrument):
"""
Agilent_N893XX(address)
address : str, address of the connected power supply
object for accessing basic functionallity of the Agilent... |
#! /usr/bin/python
# -*- coding: iso-8859-15
num = int(input("Escriba número: "))
if num > 0:
print("positivo")
elif num < 0:
print("negativo")
else:
print("0")
|
from __future__ import absolute_import
from PyQt4.QtGui import QToolBar, QLabel, QPixmap, QApplication, QCursor
from PyQt4 import QtGui, QtCore
from PyQt4.QtCore import pyqtSlot, Qt
from views.core import centraltabwidget
from gui.wellplot.subplots.wellplotwidget import WellPlotWidget
from globalvalues.appsetting... |
import numpy as np
from glob import glob
from os.path import basename
def load_features(folder):
dataset = None
classmap = {}
for class_idx, filename in enumerate(glob('%s/*.csv' % folder)):
class_name = basename(filename)[:-4]
classmap[class_idx] = class_name
samples = np.loadtxt(f... |
class Solution:
def firstUniqChar(self, s: str) -> int:
d = {}
seen = set()
for idx, c in enumerate(s):
if c not in seen:
d[c] = idx
seen.add(c)
elif c in d:
del d[c]
return min(d.values()) if d else -1
Time: O(... |
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
import pyodbc
import yaml
import pprint
from sqlalchemy import create_engine, Column, MetaData, Table, Index
from sqlalchemy import Integer, String, Text, Float, Boolean, BigInteger, Numeric, SmallInteger,Unicode,UnicodeText
import ConfigPa... |
# Generated by Django 3.1.1 on 2020-09-23 10:20
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='AbstractObject',
fields=[
('id', models.Aut... |
from rest_framework.test import APITestCase
from rest_framework.exceptions import APIException
from ..custom_validations import validate_avatar as vd
class ValidationTest(APITestCase):
""" Class to test custom validations."""
def setUp (self):
"""
Sample avatars
"""
self.avatar_1 = "test.pdf"
self.avata... |
#!/usr/bin/env python
from distutils.core import setup
# patch distutils if it can't cope with the "classifiers" or
# "download_url" keywords
from sys import version
if version < '2.2.3':
from distutils.dist import DistributionMetadata
DistributionMetadata.classifiers = None
DistributionMetadata.download_ur... |
from django.test import TestCase
from . models import Image, Profile, Comment, Like
# Create your tests here.
class ProfileTestClass(TestCase):
"""
class that test the characteristics of the Profile model
"""
def test_instance(self):
self.assertTrue(isinstance(self.profile,Profile))
def ... |
import os
import argparse
from collections import OrderedDict
from datetime import datetime
import torch
import numpy as np
from torch.utils.data import DataLoader
from lib.dataset import ScanReferDataset
from models.snt import ShowAndTell
from models.tdbu import ShowAttendAndTell
from models.retr import Retrieval2D
fr... |
from collections import defaultdict
from dataclasses import dataclass
import structlog
from eth_utils import encode_hex, is_binary_address, to_canonical_address, to_hex
from gevent.lock import RLock
from web3.exceptions import BadFunctionCallOutput
from raiden.constants import (
EMPTY_BALANCE_HASH,
EMPTY_SIGN... |
import numpy as np
import torch
import os
import json
import pickle
import math
import pdb
import time
import pdb
import argparse
from tqdm import tqdm
def get_input_frame(current_frame):
return (current_frame - 1)*2 + 11 - 2*5
def data_prepare(csv_path, file_info_path, data_path, rep_type, target_path):
with open(... |
"""
Copyright 2019 Christos Diou
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... |
# -*- coding: utf-8 -*-
from app.airport.Airport import Airport
from app.common.http_methods_unittests import get_request
from app.common.target_urls import MY_AIRPORT
import unittest
class TestAirport(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.__html_page = get_request(MY_AIRPORT)
... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.12 on 2018-04-09 08:19
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('about_me_plugin', '0004_auto_20180409_1506'),
]
operations = [
migrations.... |
import re
import sys
import json
import torch
import logging
import argparse
import mysql.connector
from dialogparser import get_intents
from connector import request_db
from deanonymization import anonymization
from telegram import Update
from telegram.ext import (
Updater, CommandHandler, MessageHandler, Filters,... |
from django.core.management.base import BaseCommand
from django.core.management import call_command
from django.utils.text import slugify
import subprocess
import datetime
import logging
class Command(BaseCommand):
args = ""
mei_data_locations = {
# 'st_gallen_390': "data_dumps/mei/csg-390",
... |
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import plotly
import plotly.plotly as py
import plotly.graph_objs as go
def plotly_plot(x=None, y=None, df=None, style='scatter',
title=None, filename='plotly_plot_test', xlabel=None, ylabel=None... |
# jitsi shortcuts for keybow 2040
# based on the hid-keys-simple.py example by Sandy Macdonald
# drop the keybow2040.py file into your `lib` folder on your `CIRCUITPY` drive.
# NOTE! requires the adafruit_hid CircuitPython library also!
import board
from keybow2040 import Keybow2040
import usb_hid
from adafruit_hid... |
import torch.multiprocessing as mp
import torch
from . import embed_eval
from .embed_save import save_model
import timeit
import numpy as np
from tqdm import tqdm
from .logging_thread import write_tensorboard
from .graph_embedding_utils import manifold_dist_loss_relu_sum, metric_loss
from .manifold_initialization impo... |
"""
Test for One Hot Design Generator Module
"""
import numpy as np
import pytest
from tagupy.design.generator import OneHot
@pytest.fixture
def correct_inputs():
return [1, 2, 3, 4, 5, 6, 7]
def test_init_invalid_input():
arg = [
["moge", None, np.ones((2, 3)), 3.4, 0, -22]
]
for el in ar... |
import numpy as np
from mxnet import ndarray as nd
def calculate_indexes(current_index, shape, gradients_cumulative, coordinates):
if len(coordinates) == 1:
return gradients_cumulative[current_index] + coordinates[0]
if len(coordinates) == 2:
return gradients_cumulative[current_index] + (coord... |
import logging
from django.conf import settings
from django.db import transaction
from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
from api import serializers
from api.common import constants
from api.resources.decorators import tenant_user_api
fr... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
import sys
from PyQt4.QtGui import *
# Create an PyQT4 application object.
a = QApplication(sys.argv)
# The QWidget widget is the base class of all user interface objects in PyQt4.
w = QWidget()
# Set window size.
w.resize(320, 240)
# Set window title
w.s... |
"""Testing for Word ExtrAction for time SEries cLassification."""
import numpy as np
import pytest
import re
from scipy.sparse import csr_matrix, hstack
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_selection import chi2
from pyts.approximation import SymbolicFourierApproximation
fro... |
# uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\situations\complex\single_sim_visitor_situation.py
# Compiled at: 2018-07-22 23:25:27
# Size of sour... |
from django.db import models
# Create your models here.
class itemlost(models.Model):
product_title = models.CharField(max_length=100)
place = models.TextField(default='Lost this item near ..')
date = models.DateField()
time=models.TimeField()
description = models.TextField()
contactme = models... |
from rest_framework import serializers
from rest_framework.serializers import ModelSerializer, DateTimeField
from modules.kanban.models.pipe_line import PipeLine
class PipeLineSerializer(ModelSerializer):
updated_at = DateTimeField(format="%Y-%m-%d %H:%M:%S", required=False, read_only=True)
card_set = serial... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@version: v1.0
@author: Evan
@time: 2019/12/11 9:33
"""
class User(object):
def __init__(self, account, password):
self.account = account
self.password = password
|
#!/usr/bin/env python3
import re
s = input()
print("YES" if all(a == b or "*" in (a, b) for a, b in zip(s, s[::-1])) else "NO") |
import random, math, os, pylab
output_dir = 'direct_disks_box_movie'
def direct_disks_box(N, sigma):
condition = False
while condition == False:
L = [(random.uniform(sigma, 1.0 - sigma), random.uniform(sigma, 1.0 - sigma))]
for k in range(1, N):
a = (random.uniform(sigma, 1.0 - sig... |
# -*- coding: utf-8 -*-
import re
import bisect
import datetime
import numpy as np
import pandas as pd
from collections import OrderedDict, defaultdict
from copy import copy
from utils.adjustment import *
from utils.datetime import (
get_end_date,
get_previous_trading_date,
)
from . asset_service import AssetTy... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.