text stringlengths 1 927k |
|---|
from django.core.mail.backends.smtp import SMTPEmailBackend
from emailhub.utils.email import process_outgoing_email
class EmailBackend(SMTPEmailBackend):
def _send(self, message):
process_outgoing_email(message)
super(EmailBackend, self)._send(message) |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# File: dev_test_cex_full_non_stop.py
#
# Part of ‘UNICORN Binance WebSocket API’
# Project website: https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api
# Documentation: https://oliver-zehentleitner.github.io/unicorn-binance-websocket-api
# PyPI: https:... |
from empire import *
from empire.strings.casing import *
from empire.structs.abstract_struct import AbstractStruct
from empire.structs.struct_serializable import StructSerializable
from empire.util.log import *
from collections import OrderedDict
from fuzzywuzzy import fuzz
class Assignment:
@staticmethod
de... |
# MIT License
#
# Copyright (c) 2019 Tuomas Halvari, Juha Harviainen, Juha Mylläri, Antti Röyskö, Juuso Silvennoinen
#
# 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, inc... |
import setuptools
with open("README.md") as fp:
long_description = fp.read()
setuptools.setup(
name="monorepo_codepipeline_trigger",
version="0.0.1",
description="An empty CDK Python app",
long_description=long_description,
long_description_content_type="text/markdown",
author="author"... |
#!/usr/bin/env python3.7
# Copyright 2020, Gurobi Optimization, LLC
# This example reads a model from a file and tunes it.
# It then writes the best parameter settings to a file
# and solves the model using these parameters.
import sys
import gurobipy as gp
if len(sys.argv) < 2:
print('Usage: tune.py filenam... |
# 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... |
__source__ = 'https://leetcode.com/problems/k-closest-points-to-origin/'
# Time: O(NLogN ~ N)
# Space: O(N)
#
# Quick Select: K-problem
# Description: Leetcode # 973. K Closest Points to Origin
#
# We have a list of points on the plane. Find the K closest points to the origin (0, 0).
#
# (Here, the distance between t... |
#!/usr/bin/env python
######################################################################################################################
# Copyright 2020-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# ... |
#!/usr/bin/python
# Author: Zion Orent <zorent@ics.com>
# Copyright (c) 2015 Intel Corporation.
#
# 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 limi... |
#! /usr/bin/env python
import itertools
from . import common
from . import core
from ..xml import structures as xml
class Assessment(common.QTICommentContainer):
"""The Assessment data structure is used to contain the exchange of test
data structures. It will always contain at least one Section and may
... |
"""The tests for recorder platform."""
from __future__ import annotations
from datetime import timedelta
from homeassistant.components.input_number import (
ATTR_MAX,
ATTR_MIN,
ATTR_MODE,
ATTR_STEP,
DOMAIN,
)
from homeassistant.components.recorder.db_schema import StateAttributes, States
from home... |
from django.db import models
from django.contrib.auth.models import User
from simple_history.models import HistoricalRecords
from django.core.validators import MinValueValidator
from preferences.models import PaymentMethod
from django.core.exceptions import ValidationError
class Category(models.Model):
"""
A p... |
# SGAnalyzerApp - gui
# importing modules required to run
from tkinter import *
import json
import time
from SGAnalyzerAppDir.SGAnalyzerApp import Dome9SG
def app():
# creating root object
root = Tk()
root.geometry("840x270")
root.title("Dome9-SG-LookUp")
root.resizable(0, 0)
Tops = Frame... |
from core.loss import d_wasserstein_loss
from core.loss import g_wasserstein_loss
from core.nn.conv.wgan import generator
from core.nn.conv.wgan import critic
from core.callbacks import GANMonitor
from core.model import WGAN_GP
import tensorflow as tf
import numpy as np
import config
train_images = tf.keras.utils.ima... |
#CAF,INDICATEUR SUR LA PART DES PRESTATIONS DANS LES RESSOURCES DES FOYERS ALLOCATAIRES PAR COMMUNE,
#DependancePrestaCom,http://data.caf.fr/dataset/indicateur-sur-la-part-des-prestations-dans-les-ressources-des-foyers-allocataires-par-commune
#CAF,BENEFICIAIRES BAS REVENUS,
#BasrevnuCom,http://data.caf.fr/dataset/ben... |
import json
import re
import requests
from django.conf import settings
from cathie.exceptions import CatsAnswerCodeException
from cathie import authorization
def cats_check_status():
pass
@authorization.check_authorization_for_cats
def cats_submit_solution(source_text: str, problem_id: int, de_id: int, source... |
from exceptions import *
from pyx import *
import random
from sets import Set
Set.__add__ = Set.__or__
Set.__iadd__ = Set.__ior__
#==========[ go board ]==========
def areSequential(i1, i2):
return abs(i1-i2) <= 1
def areConnected(pos1, pos2):
return areSequential(pos1[0], pos2[0]) or areSequential(pos1[1], pos2... |
#!/usr/bin/env python
from argparse import ArgumentParser
from os import path, listdir, stat
from os.path import isfile, join
from time import sleep
import subprocess
import threading
class Shell():
def __init__(self, objFolder, name, link):
self.__objFolder = objFolder
self.__name = name
... |
# Copyright 2020 - 2021 MONAI Consortium
# 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 wri... |
import unittest
from .data import GetData
from .. import init
from ..constant import REG_CN
class TestAutoData(unittest.TestCase):
_setup_kwargs = {}
provider_uri = "~/.qlib/qlib_data/cn_data_simple" # target_dir
provider_uri_1day = "~/.qlib/qlib_data/cn_data" # target_dir
provider_uri_1min = "~/.q... |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from datetime import time
from flask import request
from markupsafe import escape
from wtforms.fields imp... |
from jax import numpy as jnp
import jax
def cr_fn(x, y):
return x @ x + y * y
cr_jac = jax.jacfwd(cr_fn, argnums=(0, 1))
cr_jac(jnp.eye(3), jnp.eye(3))
def cr_j(x, y):
return cr_jac(x, y) |
from time import time
from functools import partial
def timeit(func, validator=lambda x: True, rep=50):
time_record = []
i = 0
try:
for i in range(rep):
print('Running test {} of {}'.format(i+1, rep))
start = time()
x = func()
if validator(x):
... |
#!/usr/bin/env python
"""Script to generate atest runners based on data files.
Usage: %s path/to/data.file
"""
from __future__ import with_statement
from os.path import abspath, basename, dirname, exists, join
import os
import sys
if len(sys.argv) != 2:
print __doc__ % basename(sys.argv[0])
sys.exit(1)
IN... |
# Generated by Django 3.1.6 on 2021-02-23 17:50
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... |
def estrai_classico(lista, lettera):
output = []
for l in lista:
if l[0] == lettera:
output.append(l)
return output
def quadrati(val_massimo):
output = []
for v in range(val_massimo):
output.append(v ** 2)
return output
def quadrato(numero):
return numero ** 2
def costruisci_pari(i):
return "{} è p... |
#!/usr/bin/env python
# Copyright 2015 Sam Yaple
#
# 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 a... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from collections import defaultdict
from refinery.lib.structures import MemoryFile
from refinery.lib import xml
from refinery.units.sinks.ppxml import ppxml
from refinery.units.formats import PathExtractorUnit, UnpackResult
class xtxml(PathExtractorUnit):
"""
Ex... |
from flask import ( g, redirect, url_for )
from tmc.db import get_db, make_dicts
# Get list of all adversaries per industry available in the database.
def get_adversaries_x_industry():
db = get_db()
try:
db.row_factory = make_dicts
#db.row_factory = lambda cursor, row: {row: row[0]}
qu... |
import sys
import cv2
import math
import time
import rospy
import serial
import argparse
import numpy as np
from std_srvs.srv import Empty
from turtlesim.msg import Pose
from geometry_msgs.msg import Twist
# ROS movement global variables and function definitions
x = 0
y = 0
z = 0
yaw = 0
def poseCallback(pose_message... |
# Copyright 2017 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... |
import unittest
from paddle.v2.fluid.op import Operator
import paddle.v2.fluid.core as core
import numpy
class TestUniformRandomOp(unittest.TestCase):
def test_uniform_random_cpu(self):
self.uniform_random_test(place=core.CPUPlace())
def test_uniform_random_gpu(self):
if core.is_compile_gpu()... |
# -*- coding: utf-8 -*-
"""
Copyright (c) Microsoft Open Technologies (Shanghai) Co. Ltd. All rights reserved.
The MIT License (MIT)
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 res... |
# Kornpob Bhirombhakdi
import numpy as np
import matplotlib.pyplot as plt
import copy,glob,os
from astropy.io import fits
from math import pi
class AXEhelper_BKG:
def __init__(self,axeflist=None,fltflist=None,
padxleft=5,padxright=5,
padylow=10,halfdy=3,padyup=10,
... |
import sys
from optparse import OptionParser
import torch
import torch.backends.cudnn as cudnn
import torch.nn as nn
import torch.nn.functional as F
from torch import optim
from torch.autograd import Variable
from eval import eval_net
from models.unet import UNet
from utils import *
def train_net(net, epochs=100, ba... |
from pathlib import Path
import pandas as pd
from PIL import Image as PILImage
import torch
from torchvision import transforms, ops
from fastai.basic_train import load_learner
from fastai.vision import Image
from fastai.core import FloatItem
import matplotlib.pyplot as plt
from scipy import stats
class Model:
def... |
import firebase_admin
from firebase_admin import credentials,firestore
from firebase_admin import storage
cred = credentials.Certificate("./adminKey.json")
firebase_admin.initialize_app(cred, {
'storageBucket': 'women-e598c.appspot.com'
})
#Database Methods
db = firestore.client()
#discrip = ""
title = "Plight o... |
#!/usr/bin/env python
"""
python-bluebutton
FILE: cms_parser
Created: 3/3/15 12:16 PM
convert CMS BlueButton text to json
"""
__author__ = 'Mark Scrimshire:@ekivemark'
import json
import re
import os, sys
from collections import OrderedDict
from apps.bluebutton.cms_parser_utilities import *
from apps.bluebutton.c... |
"""
project = "Protecting Patron Privacy on the Web: A Study of HTTPS and Google Analytics Implementation in Academic Library Websites"
name = "4_test_google_privacy.py",
version = "1.0",
author = "Patrick OBrien",
date = "07/25/2018"
author_email = "patrick@revxcorp.com",
description = ("Audit tests for unique researc... |
# Generated with CombinedLoadingApproach
#
from enum import Enum
from enum import auto
class CombinedLoadingApproach(Enum):
""""""
LRFD = auto()
WSD = auto()
def label(self):
if self == CombinedLoadingApproach.LRFD:
return "LRFD"
if self == CombinedLoadingApproach.WSD:
... |
"""
Generate Dataset
1. Converting video to frames
2. Extracting features
3. Getting change points
4. User Summary ( for evaluation )
"""
import os, sys
sys.path.append('../')
from networks.CNN import ResNet
from utils.KTS.cpd_auto import cpd_auto
from tqdm import tqdm
import math
import cv2
impor... |
# Copyright 2015 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... |
import json
import subprocess
def run_script():
data = json.load(open('store.json', 'r'))
script = data['script_to_run']
if script == "":
# Nothing will be run
return 1
subprocess.call(['/usr/bin/python', script])
return 0
if __name__ == "__main__":
run_script() |
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# formats: ipynb,scripts//py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.2'
# jupytext_version: 1.1.6
# kernelspec:
# display_name: Python [conda env:thesis] *
# language: pyt... |
#!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Train a new model on one or across multiple GPUs.
"""
import argparse
import logging
import math
import os
impor... |
import logging
import re
from skyhook.plugins.extractor import Extractor
from skyhook.items import CommonItem
from skyhook.plugins.processor.general import General
class CommonSpiderStepExecutor(object):
def __init__(self, response, parsed_list, policy_depth, rule, spider, item=None):
self.response = resp... |
import sys
sys.path.insert(1, '/data/s2675544/git/neural_deprojection/')
sys.path.insert(1, '/home/matthijs/git/neural_deprojection/')
from graph_nets import blocks
from graph_nets.utils_tf import concat
import tensorflow as tf
import sonnet as snt
from graph_nets.graphs import GraphsTuple
from graph_nets.utils_tf i... |
"""Create infrastructure: connect charging points to transformer and charging points to
charging stations."""
from copy import deepcopy
from elvis.charging_station import ChargingStation
from elvis.charging_point import ChargingPoint
from elvis.infrastructure_node import Transformer, Storage
from elvis.battery im... |
class Solution:
def pivotIndex(self, nums: [int]) -> int:
sum_nums = sum(nums)
left = 0
for i in range(len(nums)):
if left * 2 == sum_nums - nums[i]:
return i
left += nums[i]
return -1 |
"""Contact Matcher to match the specific contact"""
import re
from re import Pattern
import inspect
from wechaty_plugin_contrib.config import (
get_logger,
Contact,
)
from .matcher import Matcher
logger = get_logger("ContactMatcher")
class ContactMatcher(Matcher):
async def match(self, target: Contact... |
import argparse
import os
from warnings import simplefilter
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from pandas.plotting import register_matplotlib_converters
from TimeSeriesCrossValidation import splitTrain
from sklearn.preprocessing import MinMaxScaler, StandardScaler
from tensorflow.ke... |
# -*- coding: utf-8 -*-
'''
Return data to an influxdb server.
.. versionadded:: 2015.8.0
To enable this returner the minion will need the python client for influxdb
installed and the following values configured in the minion or master
config, these are the defaults:
.. code-block:: yaml
influxdb.db: 'salt'
... |
from django.shortcuts import render
from rest_framework import viewsets, permissions, generics
from .serializers import EducationSerializer, WorkExperienceSerializer, AchievementsSerializer
from .models import Education, WorkExperience, Achievements
from Feed.models import Feed
from Profile.models import FacultyProfile... |
#!/usr/bin/python3
'''
Server for tracing patched sudo. run it with sudo or as root.
Requires 'cmds' file as gdb comamnds in current directory.
Running command:
python gdbroot.py
'''
import os
import time
FIFO_PATH = "/tmp/gdbsudo"
try:
os.unlink(FIFO_PATH)
except:
pass
os.umask(0)
os.mkfifo(FIFO_PATH, 0o666)
wh... |
from flask import Flask, request, Response, render_template, g, redirect, url_for, send_file, jsonify
from functools import wraps
import stripe
import os, uuid, json
from hackeriet.web.brusweb import brusdb, members
from hackeriet.mqtt import MQTT
# teste stripe
# lage bruker for gratis brus
# brus/error virker ikke
#... |
import json
import requests
data = json.dumps({'name':'Aditya'})
res = requests.post('http://127.0.0.1:10001/api', data)
print(res.text) |
import pandas
from pandas import DataFrame
import building_energy_data as bed
def main():
reporter = bed.BuidingEnergyReporter('file.csv')
# Q1: What was the name of the building that had the largest NumberofFloors?
building_name = reporter.max_number_of_floors()
print('Question 1: Name of the building t... |
import copy
import tabulator
import requests
from .config import Config
from ..config.log import logger
from ..config.consts import CONFIG_SKIP_ROWS, CONFIG_TAXONOMY_ID, CONFIG_FORMAT, CONFIG_ALLOW_INSECURE_TLS
from ..taxonomies import TaxonomyRegistry, Taxonomy
_workbook_cache = {}
def trimmer(extended_rows):
... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import torch
from maskrcnn_benchmark.modeling.box_coder import BoxCoder
from maskrcnn_benchmark.modeling.rbox_coder import RBoxCoder
from maskrcnn_benchmark.structures.bounding_box import BoxList, RBoxList
from maskrcnn_benchmark.structures.rboxli... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="payrun", # Replace with your own username
version="0.0.1",
author="Andrii Pushkar",
author_email="zingeon1@gmail.com",
description="A Python SDK for PayRun API",
long_description=long_... |
# -*- coding: utf-8 -*-
from collections.abc import MutableSequence, MutableMapping
from collections import OrderedDict
from itertools import chain
class Snode(MutableSequence):
"""A sequence object that knows it's parent"""
# this will allow easy subclassing to extend the container types that can
# be p... |
__author__ = 'brad'
import pygame
class Surface(pygame.Surface):
def __init__(self, (width, height), flags=0):
surface_flags = {0: 0, 1: pygame.SRCALPHA, 2: pygame.HWSURFACE, 3: pygame.SRCALPHA | pygame.HWSURFACE}
pygame.Surface.__init__(self, (width, height), flags=surface_flags[flags]) |
# Copyright 2017, Inderpreet Singh, All rights reserved.
import unittest
import json
from controller import AutoQueuePattern
from web.serialize import SerializeAutoQueue
class TestSerializeConfig(unittest.TestCase):
def test_is_list(self):
patterns = [
AutoQueuePattern(pattern="one"),
... |
#!/usr/bin/env python
from __future__ import print_function
import argparse
from datetime import datetime
import sys
import json
import yaml
import urllib
import requests
import time
import re
# import logging
# import httplib as http_client
# http_client.HTTPConnection.debuglevel = 1
# logging.basicConfig()
# logging... |
# Unit Tests for the PyDM drawing widgets
import os
from logging import ERROR
import pytest
from qtpy.QtGui import QColor, QBrush, QPixmap
from qtpy.QtWidgets import QApplication
from qtpy.QtCore import Property, Qt, QPoint, QSize
from qtpy.QtDesigner import QDesignerFormWindowInterface
from ...widgets.base import P... |
import copy
from pathlib import Path
from typing import Dict, List, Optional, Union
import torch
from pytorch_lightning.metrics import Accuracy
from torch import Tensor, optim
from torch.utils import data
import pytorch_lightning as pl
from pytorch_lightning.loggers import LightningLoggerBase
from pytorch_lightning.c... |
import time
def timeit(method):
def timed(*args, **kw):
ts = time.time()
result = method(*args, **kw)
te = time.time()
if 'log_time' in kw:
name = kw.get('log_name', method.__name__.upper())
kw['log_time'][name] = int((te - ts) * 1000)
else:
... |
preco = float(input('Preço: '))
print(f'Depois do desconto de 5% aplicado: {preco * 0.95:.2f}') |
# Compute MMD distance using pytorch
import torch
import torch.nn as nn
class MMD_loss(nn.Module):
def __init__(self, kernel_type='rbf', kernel_mul=2.0, kernel_num=5):
super(MMD_loss, self).__init__()
self.kernel_num = kernel_num
self.kernel_mul = kernel_mul
self.fix_sigma = None
... |
# -*- coding: utf-8 -*-
'''
Connection module for Amazon RDS
.. versionadded:: 2015.8.0
:configuration: This module accepts explicit rds credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then automatically obtained from AWS API and no
fu... |
"""Functions to write Science Instrument Aperture Files (SIAF).
SIAF content in an aperture_collection object can be written to an xml file that can be ingested in
the PRD. Format and order of the xml fields are defined in SIAF reference files.
Writing to Microsoft Excel .xlsx format is supported.
Writing to .csv and ... |
from __future__ import division
from datetime import datetime, timedelta
import numpy as np
import pandas as pd
from ..base.aggregation_primitive_base import (
AggregationPrimitive,
make_agg_primitive
)
from featuretools.variable_types import (
Boolean,
DatetimeTimeIndex,
Discrete,
Index,
... |
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 7 14:11:59 2020
@author: Akhil
"""
from __future__ import print_function
import re
from pathlib import Path
from pycparser import c_ast, c_generator, parse_file
from pycparser.c_ast import FuncDef
z = []
class FuncDefVisitor(c_ast.NodeVisitor):
def visit_FuncDe... |
# <copyright file="databank_download.py" company="Oxford Economics">
# Copyright (c) 2017 Oxford Economics Ltd. All rights reserved.
# Licensed under the MIT License. See LICENSE file in the
# project root for full license information.
# </copyright>
import json
import requests
import sys
API_KEY = # insert api key... |
#
# 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... |
# coding: utf-8
"""
Senzing REST API
This is the Senzing REST API. It describes the REST interface to Senzing API functions available via REST. It leverages the Senzing native API which is documented at [https://docs.senzing.com](https://docs.senzing.com) # noqa: E501
OpenAPI spec version: 1.6.0
... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v1.10.6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
from aio... |
import validators
import requests
import base64
from app import app
def intelixlookup(ioc):
#Get a token
token = get_token()
# use Validators to redirect the IOC to the correct Intelix endpoint
if validators.ipv4(ioc):
u = f"https://de.api.labs.sophos.com/lookup/ips/v1/{ioc}"
elif validator... |
#!/usr/bin/python
# Copyright (C) 2013 Steven Watanabe
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.txt or copy at
# https://www.bfgroup.xyz/b2/LICENSE.txt)
import BoostBuild
import MockToolset
t = BoostBuild.Tester(arguments=['toolset=mock', '--ignore-site-config', '... |
#!/usr/bin/env python
#
# Copyright 2015 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 requir... |
import os
class Config:
__dir = os.path.dirname(__file__)
SERVER = {
'host': 'localhost',
'port': 8080
}
PATH = {
'question_ans': __dir + '/../../data/bangla_questions_ans.pkl',
'question_domain': __dir + '/../../data/bangla_questions_domain.pkl',
'original_qu... |
from datetime import datetime
import pyttsx3
import speech_recognition as sr
engine = pyttsx3.init()
def say(sentence: str):
print(sentence)
engine.say(sentence)
engine.runAndWait()
def recognize_speech_from_mic(recognizer, microphone):
"""Transcribe speech from recorded from `microphone`.
... |
# coding: utf-8
"""
OpsGenie REST API
OpsGenie OpenAPI Specification # noqa: E501
OpenAPI spec version: 2.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from opsgenie_swagger.models.ack_integration_action import AckI... |
import asyncio
from datetime import datetime
from typing import Any, Callable, List, Optional, Union, TYPE_CHECKING
from aat import AATException
from aat.config import ExitRoutine, InstrumentType, TradingType
from aat.core import Instrument, ExchangeType, Event, Order, Trade, OrderBook
from aat.exchange import Exchang... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class CashierClosingPayments(Document):
pass |
#! /usr/bin/env python3
"""converts list to comma separated string"""
items = ['foo', 'bar', 'xyz']
print (','.join(items))
"""list of numbers to comma separated"""
numbers = [2, 3, 5, 10]
print (','.join(map(str, numbers)))
"""list of mix data"""
data = [2, 'hello', 3, 3.4]
print (','.join(map(str, data))) |
from setuptools import setup, find_packages
with open("README.md", 'r') as f:
long_description = f.read()
with open('requirements.txt') as f:
required = f.read().splitlines()
setup(name="foamfile",
version="0.11",
description='OpenFOAM config file parser',
long_description=long_description,... |
from flask import request, jsonify, make_response
from flask_restful import Resource, reqparse, abort
import time
import datetime
import json
from app.models import User
from app import db
class Register(Resource):
def get(self):
pass
def post(self):
# parser = reqparse.RequestParser()
... |
# Copyright 2012, Nachi Ueno, NTT MCL, 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
#
# U... |
from lxml import html
from normality import collapse_spaces, slugify
from pantomime.types import HTML
from opensanctions.core import Context
from opensanctions import helpers as h
TYPES = {"OSOBY": "Person", "PODMIOTY": "Company"}
CHOPSKA = [
("Nr NIP", "taxNumber"),
("NIP", "taxNumber"),
("Nr KRS", "regi... |
import curses
import readline
import bz2
assert(bz2.decompress(bz2.compress(b'IT WORKS IT WORKS IT WORKS')) == b'IT WORKS IT WORKS IT WORKS')
import platform
isNotPypy = platform.python_implementation() != 'PyPy'
isCaveman = platform.python_version_tuple()[0] == '2'
if isCaveman:
import gdbm
else:
import db... |
# Copyright 2019, The TensorFlow Federated 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... |
from typing import Iterator, List, Tuple
import os
import random
import numpy as np
from tensorflow import data as tfd
from tensorflow import image as tfi
from tensorflow import io as tfio
from tensorflow import dtypes
import tensorflow as tf
from google_drive_downloader import GoogleDriveDownloader
class Omniglo... |
"""
ResNet code gently borrowed from
https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py
"""
from __future__ import print_function, division, absolute_import
from collections import OrderedDict
import math
import torch
import torch.nn as nn
from torch.utils import model_zoo
__all__ = ['SENet', '... |
def declare_variables(variables, macro):
"""
This is the hook for the functions
- variables: the dictionary that contains the variables
- macro: a decorator function, to declare a macro.
"""
@macro
def inputcode(filename, language):
f = open(filename, 'r')
text = f.read()
... |
import requests
from flask import current_app
from notifications_utils.statsd_decorators import statsd
from app import notify_celery
from app.dao.broadcast_message_dao import dao_get_broadcast_event_by_id
@notify_celery.task(name="send-broadcast-event")
@statsd(namespace="tasks")
def send_broadcast_event(broadcast_... |
import pandas as pd
import numpy as np
from sklearn.tree import *
from sklearn.ensemble import *
from sklearn.preprocessing import *
from sklearn.model_selection import *
from sklearn.metrics import *
data = pd.read_csv('data.csv')
X = data.drop(['Company','Processor Name'],axis='columns')
y = data.drop(['Turbo Spee... |
#
# pool2d paddle model generator
#
import numpy as np
from save_model import saveModel
import sys
def yolo_box(name : str, x, img_size, attrs : dict):
import paddle as pdpd
pdpd.enable_static()
with pdpd.static.program_guard(pdpd.static.Program(), pdpd.static.Program()):
node_x = pdpd.static.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: common.py
# Author: Yuxin Wu <ppwwyyxxc@gmail.com>
import random
import time
import multiprocessing
from tqdm import tqdm
from six.moves import queue
from tensorpack.utils.concurrency import StoppableThread, ShareSessionThread
from tensorpack.callbacks import Callb... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.