text stringlengths 1 927k |
|---|
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
__version__ = '1.13.142'
# -----------------------------------------------------------------------------
import asyncio
import concurrent
import socket
import time
import math
import random
import certifi
import ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os.path
import subprocess
import uuid
from aptts import alarmpi_tts
class trypico2wave(alarmpi_tts):
def play(self, content, ramdrive='/mnt/ram/'):
if self.debug:
print "Trying pico2wave."
rval = True
p2w = self.sconfig['head']
lang =self.sc... |
# Copyright 2019 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 or agreed to in writing,... |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, steve and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class DailyDefaultSetting(Document):
pass |
import click
import configparser
import json
import sys
from arxtools import export_clues, fetch_clues
from arxtools.clue import Clue
@click.group()
def cli():
pass
def get_character_info(name):
config = configparser.ConfigParser()
config.read('arxtools.ini')
try:
return config[name.lower()]... |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2015 Thomas Voegtlin
#
# 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... |
# This file is Copyright 2010 Dean Hall.
#
# This file is part of the Python-on-a-Chip program.
# Python-on-a-Chip is free software: you can redistribute it and/or modify
# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1.
#
# Python-on-a-Chip is distributed in the hope that it will be useful,
# ... |
# MIT License
#
# Copyright (c) 2020 Brett Graves
#
# 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,... |
##
# \brief Test ability to determine best fit copula via AIC
from __future__ import print_function, division
from starvine.bvcopula.pc_base import PairCopula
import unittest
import numpy as np
import os
pwd_ = os.getcwd()
dataDir = pwd_ + "/tests/data/"
np.random.seed(123)
class TestGaussFrozen(unittest.TestCase):
... |
#appModules/totalcmd.py
#A part of NonVisual Desktop Access (NVDA)
#Copyright (C) 2006-2012 NVDA Contributors
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
import appModuleHandler
from NVDAObjects.IAccessible import IAccessible
import speech
import controlTypes
import... |
"""Entry point for the analysis runner."""
import os
import sys
import hail as hl
import hailtop.batch as hb
from analysis_runner import dataproc
OUTPUT = os.getenv('OUTPUT')
assert OUTPUT
hl.init(default_reference='GRCh38')
POP = sys.argv[1] if len(sys.argv) > 1 else 'nfe'
service_backend = hb.ServiceBackend(
... |
from botstory import matchers, utils
from botstory.ast import callable, forking, loop
from botstory.ast.story_context import reducers
from botstory.utils import advanced_json_encoder
import numbers
import logging
import uuid
logger = logging.getLogger(__name__)
class MissedStoryPart(Exception):
pass
class Sto... |
import os, sys
import pydicom as pyd
import matplotlib.pyplot as plt
import collections
import pandas as pd
PatientRecord = collections.namedtuple('PatientRecord', ['patient_id', 'image_folder', 'original_id', 'gender', 'age', 'pathology', 'all_scans', 'scans', 'scans_list', 'scans_total'])
PatientScans = collections... |
#!/usr/local/bin/python3
"""input_counter.py"""
myset = set()
mydict = {}
mysetlength = len(myset)
while True:
text = input("Enter a line (or Enter to quit): ")
if not text:
break
for punc in ",?;.":
text = text.replace(punc, "")
textwords = (text.lower().split())
for word in textwo... |
"""Simple helloWorld service."""
import json
def sayHello(event, context):
"""Return a message in the response body."""
print('Event is: {}'.format(json.dumps(event)))
body = {
"message": "Hello! Your Auth0 authorized function executed successfully!"
}
response = {
"statusCode": 2... |
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from fuji_server.models.base_model_ import Model
from fuji_server.models.data_provenance_output import DataProvenanceOutput # noqa: F401,E501
from fuji_server.models.d... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Maintenance.disable_alarms'
db.add_column(u'maintenance_m... |
"""Converts Jupyter Notebooks to Jekyll compliant blog posts"""
from datetime import datetime
import re, os, logging
from nbdev import export2html
from nbdev.export2html import Config, Path, _re_digits, _to_html, _re_block_notes
from fast_template import rename_for_jekyll
warnings = set()
# Modify the naming proc... |
#!/usr/bin/env python
# Visual stock/share trading RL environment with continuous trade actions
# Chapter 5, TensorFlow 2 Reinforcement Learning Cookbook | Praveen Palanisamy
import os
import random
from typing import Dict
import cv2
import gym
import numpy as np
import pandas as pd
from gym import spaces
from tradi... |
from neuron import h
class TransformTC4:
def __init__(self):
# Create a section lookup by section name
# Note: this assumes each section has a unique name
self.name2section = { sec.name(): sec for sec in h.allsec() }
# This will store the new section coordinates
self.secti... |
"""REST API implementation."""
import json
import logging
import os
import pathlib
from datetime import datetime
from aiohttp import web
from core.addons.api.dto.details import Details
from core.addons.api.dto.location import Location
from core.addons.api.dto.photo import PhotoDetailsResponse, PhotoEncoder, PhotoResp... |
"""
@brief test log(time=150s)
"""
import os
import unittest
from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import check_pep8, ExtTestCase
class TestCodeStyle(ExtTestCase):
"""Test style."""
def test_style_src(self):
thi = os.path.abspath(os.path.dirname(__file__))
sr... |
import torch
class ActionCrossEntropyFunction(torch.autograd.Function):
@staticmethod
def forward(self,input,target,action,force = None):
self.mb_size,self.dim = input.size()
# save the force for backward
self.force = force
# get action difference
action_input = torch... |
import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
__VERSION__ = "0.2.10"
setuptools.setup(
name="lescode",
packages=setuptools.find_packages(),
version=__VERSION__,
author="nghoangdat",
author_email="18.hoang.dat.12@gmail.com",
descripti... |
from typing import List
import logging
import json
import random
import pandas as pd
from tqdm import tqdm
from haystack.schema import Document, Label
from haystack.modeling.data_handler.processor import _read_squad_file
logging.basicConfig()
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
tqdm... |
# Django settings for {{ project_name }} project.
import os
PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add ... |
"""
Package allows to interact with Yeelight bulbs.
"""
__author__ = "Savilov N." |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# ODRI Motor Board Firmware for CAN Communication documentation build
# configuration file, created by sphinx-quickstart on Thu Aug 12 17:06:32 2021.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible confi... |
#!/usr/bin/python
import subprocess
def main():
layout_map = {"us":"EN", "il":"HE", "ru":"RU"}
layout = subprocess.Popen("/home/lxgreen/scripts/wm"
"/language_bar/xkb-switch",
stdout=subprocess.PIPE).stdout.read()
print layout_map[layout[:2]]
if __name__ == '__main__':
main() |
#!/usr/bin/env python3
'''A simple implementation of a sorting algorithm, meant to allow
people to manually rank a list of items using whatever subjective or
objective criteria they want.
This program can be called as a script and used interactively. You
can provide the list of things to sort as command line argument... |
# ==============================================================================
# MIT License
#
# Copyright 2020 Institute for Automotive Engineering of RWTH Aachen University.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "S... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2020 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
"""add study template
Revision ID: 4f53ec506661
Revises: 4302608638bc
Create Date: 2018-05-23 15:44:01.450488
"""
# revision identifiers, used by Alembic.
revision = '4f53ec506661'
down_revision = '4302608638bc'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade(engi... |
from __future__ import absolute_import, division, print_function
from cctbx.array_family import flex
import os, sys
from libtbx.utils import Sorry
from libtbx.test_utils import approx_equal
from mmtbx.model import manager as model_manager
from iotbx.data_manager import DataManager
def exercise(file_name, out = sys.std... |
import abc
from collections import defaultdict
from contextlib import contextmanager
from dataclasses import dataclass, field, replace
import math
import struct
import sys
import traceback
import typing
from typing import (
AbstractSet,
Callable,
Collection,
DefaultDict,
Dict,
Iterator,
List... |
import pytest
from pkg_resources import parse_version
import ibis.expr.datatypes as dt
from ibis.backends.clickhouse.client import ClickhouseDataType
def test_column_types(alltypes):
df = alltypes.execute()
assert df.tinyint_col.dtype.name == 'int8'
assert df.smallint_col.dtype.name == 'int16'
assert... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import glob
import re
import sys
import urllib
import tarfile
import zipfile
import os.path as osp
from scipy.io import loadmat
import numpy as np
import h5py
from scipy.misc import imsave
from torch... |
"""
Define the SeriesGroupBy and DataFrameGroupBy
classes that hold the groupby interfaces (and some implementations).
These are user facing as the result of the ``df.groupby(...)`` operations,
which here returns a DataFrameGroupBy object.
"""
from __future__ import annotations
from collections import abc
from functo... |
'''
Author: Liu Xin
Date: 2021-11-21 18:10:58
LastEditors: Liu Xin
LastEditTime: 2021-11-21 21:38:30
Description: file content
FilePath: /CVMI_Sementic_Segmentation/utils/runner/optimizer/builder.py
'''
import copy
import inspect
import torch
from utils.registry import Registry, build
OPTIMIZERS = Registry('optimizer'... |
from .py_yahoo import YWeather |
"""
Demo 01 Made with python and pygame
to test and improve the laylib-pygame framework for fast game prototyping.
----
Author: Amardjia Amine
Date: 20/10/18
Github: ---
- This demo shows how the Resources manager loads and
separates the different data and their associated variables.
All resources are showed in t... |
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import tensorflow as tf
import psutil
import numpy as np
import os
from tensorflow.keras.callbacks import Callback
from datetime import datetime
from mpunet.logging import ScreenLogger
from mpunet.utils.plotting import (imshow_with_label_overlay, i... |
import string
import random
def generate_password():
chars = string.ascii_letters + string.digits + string.punctuation
return ''.join([random.choice(chars) for i in range(0, 15)])
def main():
print(generate_password())
if __name__ == '__main__':
main() |
# coding: utf-8
"""
Paragon Insights APIs
API interface for PI application # noqa: E501
OpenAPI spec version: 4.0.0
Contact: healthbot-feedback@juniper.net
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class RuleSchemaF... |
import json
import pytest
from sqlalchemy.sql import text as sa_text
from sqlalchemy.orm.session import sessionmaker
from opencdms.models.climsoft import v4_1_1_core as climsoft_models
from apps.climsoft.db.engine import db_engine
from apps.climsoft.schemas import regkey_schema
from datagen.climsoft import regkey as cl... |
from collections import OrderedDict
import tldextract
import re
from . import helpers
from . import helpdesk_helper
from urllib.parse import urlparse
def extract_root_from_input(input_string):
# We cant parse the url since user might have not enter a proper link
# We assume that the string is already the pro... |
"""
Copyright (c) 2017 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import unicode_literals
from jsonschema import ValidationError
import io
import logging
import os
import pkg_resources
import... |
"""
create_playlist.py
creates a playlist in user librabry and returns the playlist id
parameters: auth, list of tracks to add
"""
import spotipy
from spotipy.oauth2 import SpotifyOAuth
from .spotifyoauth import get_token
from ..common import session
def create_playlist(name, songs):
#get token
session[... |
from picograd.configs.base import BaseConfig
class Config(BaseConfig):
def __init__(self, **kwargs):
self.a = 2
self.b = None
super().__init__(**kwargs) |
'''
Script to motion correct a single multipage .tif stack using the Python Tif Motion Correction (ptmc) package
Requires ptmc, PIL and their dependencies
'''
from ptmc import io
from ptmc import processing as pro
from PIL import Image
import numpy as np
if __name__ == "__main__":
#Full Processing without I/O ta... |
from prj.api import serializers, permissions, authenticators
from rest_framework.views import APIView
from django.contrib.auth.models import User
from rest_framework.response import Response
from rest_framework import viewsets
from django.contrib.auth import login, logout
from rest_framework.permissions import AllowAny... |
"""Dataset for Predicting a Pulsar Star"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow_datasets.public_api as tfds
import tensorflow as tf
import os
_CITATION = """\
@article{10.1093/mnras/stw656,
author = {Lyon, R. J. and Stappe... |
import pytest
from mitmproxy import certs
from mitmproxy import http
from mitmproxy import exceptions
from mitmproxy.test import tflow, tutils
from mitmproxy.io import protobuf
class TestProtobuf:
def test_roundtrip_client(self):
c = tflow.tclient_conn()
del c.reply
c.rfile = None
... |
# Generated by Django 3.1.3 on 2020-12-07 19:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('website', '0010_auto_20201120_2052'),
]
operations = [
migrations.AlterField(
model_name='profile',
name='image',
... |
# -*- coding: utf-8 -*-
#BEGIN_HEADER
# The header block is where all import statments should live
import logging
import os
from pprint import pformat
from Bio import SeqIO
from installed_clients.AssemblyUtilClient import AssemblyUtil
from installed_clients.KBaseReportClient import KBaseReport
#END_HEADER
class Con... |
from PySock import client
def abc(data,con):
print(f"Message from {data['sender_name']} : {data['data']}")
con.SEND("test","Hurrah! it's working.")
def client_msg(data):
print(f"Message from : {data['sender_name']} => {data['data']}")
c = client(client_name = "swat", debug = True)
c.CLIENT("localhost",88... |
# coding: utf-8
"""
UltraCart Rest API V2
UltraCart REST API Version 2 # noqa: E501
OpenAPI spec version: 2.0.0
Contact: support@ultracart.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class OrderFormat(object):
... |
#!/usr/bin/env python3
"""
Pull forward a few cm, spin around, dock.
"""
from math import radians
from time import sleep
from pyroombaadapter import PyRoombaAdapter
PORT = "/dev/ttyUSB0"
adapter = PyRoombaAdapter(PORT)
adapter.change_mode_to_safe()
# Warn people we're coming
adapter.send_song_cmd(0, 9,
... |
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
from PyQt5 import QtCore, QtGui, QtWidgets, QtDataVisualization
import math
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas... |
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
import logging
import os
import shutil
from build_workflow.build_artifact_checks import BuildArtifactChecks
from manifests.bui... |
#!/usr/bin/env python
import io
import sys
from collections import OrderedDict
current_dir = "dockerfileinfo2"
current_dir = current_dir.lower()
pwd = "/home/ubuntu/SecureWilly/StaticAnalysis/dockerfile_info2/Parser"
pre_pwd = "/home/ubuntu/SecureWilly/StaticAnalysis/dockerfile_info2"
#This will be our preliminery p... |
"""
idx 0 1 2 3 val = 3 -> ret 2, [2, 2]
elm 2 2 2 3
i
idx
i: all elements to the left hand side of i (including) are the result to return
j: current index to scan whole input array
res = 0
"""
class Solution:
def removeElement(self, nums: List[int], val: int)... |
# Generated by Django 2.2 on 2020-10-07 13:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('quiz', '0012_quiz_answerkey'),
]
operations = [
migrations.CreateModel(
name='Tester',
fields=[
('id',... |
size=int(input("enter size="))
dict1={}
for i in range(1,size+1):
subjects = input("enter subjects=")
marks = int(input("enter marks="))
dict1[subjects]=marks
print(dict1)
for subjects,marks in dict1.items():
print(subjects,"=",marks) |
# 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 dataclasses import dataclass
from datetime import datetime
@dataclass
class AuthResponse:
email: str
image_access: bool
search_access: bool
created: datetime
modified: datetime
@dataclass
class FontResponse:
filename: str
id: str
alias: str
_self: str
@dataclass
class Meme... |
from django.conf import settings
SEQUENCE = []
if settings.DATABASES['default']['ENGINE'].endswith('mysql'):
SEQUENCE.append('fields_changed_longtext') |
import asyncio
import cryptology
import logging
import os
from aiohttp import WSServerHandshakeError
from datetime import datetime
from decimal import Decimal
from pathlib import Path
from typing import Optional
SERVER = os.getenv('SERVER', 'wss://marketdata.cryptology.com')
NAME = Path(__file__).stem
logging.basicC... |
#!/usr/bin/env python3
#-*- coding: UTF-8 -*-
from .shikimoriapi import *
__all__ = ['Api'] |
#
# Copyright (c) 2017 nexB Inc. and others. All rights reserved.
# http://nexb.com and https://github.com/nexB/scancode-toolkit/
# The ScanCode software is licensed under the Apache License version 2.0.
# Data generated with ScanCode require an acknowledgment.
# ScanCode is a trademark of nexB Inc.
#
# You may not use... |
import warnings
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from ..registry import NECKS
@NECKS.register_module
class FPN(nn.Module):
def __init__(self,
in_channels,
out_channels,
num_outs,
... |
import warnings
import numpy as np
from .pdb2sqlcore import pdb2sql
from .interface import interface
from .superpose import get_trans_vect, get_rotation_matrix, superpose_selection
from . import transform
import os
import pickle
class StructureSimilarity(object):
def __init__(self, decoy, ref, verbose=False, en... |
import sys
import logging
import socket
from typing import List
import telegram_log.handler
from yad_uploader.arguments import Arguments
def configure_logger(logger: logging.Logger, tg_token: str, tg_chat_ids: List[str]):
logger.setLevel(logging.DEBUG)
host_name = socket.gethostname()
log_format = '%(as... |
print("second = hour * 60 * 60") |
import os
import pytest
from httpie.input import ParseError
from utils import TestEnvironment, http, HTTP_OK
from fixtures import FILE_PATH_ARG, FILE_PATH, FILE_CONTENT
class TestMultipartFormDataFileUpload:
def test_non_existent_file_raises_parse_error(self, httpbin):
with pytest.raises(ParseError):
... |
from .ljspeech import LJSpeech
from .reader import DataReader |
#!/usr/bin/python
#
# Copyright 2018-2022 Polyaxon, Inc.
#
# 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 ... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
# -*- coding: utf-8 -*-
# snapshottest: v1 - https://goo.gl/zC4yUc
from __future__ import unicode_literals
from snapshottest import Snapshot
snapshots = Snapshot()
snapshots['TestEnvironmentSchema.test_basic_invalid_config_on_run_config_schema[non_launchable_in_memory_instance_lazy_repository] 1'] = {
'runConfig... |
def test_safe(filename, acceptable_functions=[]):
"""tests all the function calls in a file against a set of acceptable ones.
this function also does not allow importing of other modules.
returns True, [] if there are only acceptable function calls,
returns False and a list of bad function call... |
import doctest
import pytest
from insights.parsers import ParseException, SkipException
from insights.parsers import sctp
from insights.parsers.sctp import SCTPEps
from insights.parsers.sctp import SCTPAsc, SCTPAsc7
from insights.parsers.sctp import SCTPSnmp
from insights.tests import context_wrap
SCTP_EPS_DETAILS = ... |
# Copyright 2019 Google LLC. 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 a... |
"""Functions that expose information about templates that might be
interesting for introspection.
"""
import typing as t
from . import nodes
from .compiler import CodeGenerator
from .compiler import Frame
if t.TYPE_CHECKING:
from .environment import Environment
class TrackingCodeGenerator(CodeGenerator):
""... |
# -*- 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
# -----------------------------------------------------------------------------
try:
basestri... |
from test_framework.messages import ToHex
from test_framework.util import assert_equal
def check_validaterawtx(node, tx,
has_valid_inputs = True,
is_minable = True,
enough_fee = True, num_errors = 0):
res = node.validaterawtransaction(ToHex(tx))
if enough_fee:
assert(res["txfee"] >= re... |
from pygame import Surface
from pygame.sprite import Sprite
class Box(Sprite):
def __init__(self, color, x=0, y=0):
super().__init__()
self.image = Surface((50, 50))
self.rect = self.image.get_rect()
self.rect.x = x
self.rect.y = y
self.color = color
self.im... |
import boto3
import json
s3 = boto3.resource('s3')
def lambda_handler(event, context):
bucket = s3.Bucket("diotsoumas-book-tracker-config-files")
sns_client = boto3.client('sns')
arn = "arn:aws:sns:eu-west-1:169367514751:Lamdba-caller"
for obj in bucket.objects.filter():
message = {"s3_key":... |
"""
WSGI config for sra_django_api project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANG... |
from .advanced_supvervised_model_trainer import AdvancedSupervisedModelTrainer
from .supervised_model_trainer import SupervisedModelTrainer
from .datasets import load_diabetes
from .common.csv_loader import load_csv
from .common.file_io_utilities import load_saved_model
__all__ = [
'AdvancedSupervisedModelTrainer'... |
import sqlalchemy as alchemy
from . import base
from typing import Optional
class FacebookReportTableModel(base.ReportTableModel):
@property
def date_column_name(self) -> str:
return 'date_start'
class FacebookCampaignReportTableModel(FacebookReportTableModel):
@property
def table_name(self) -> str:
... |
import gspread
import subprocess
import argparse
import auto_archive
import datetime
def main():
parser = argparse.ArgumentParser(
description="Automatically use youtube-dl to download media from a Google Sheet")
parser.add_argument("--sheet", action="store", dest="sheet")
args = parser.parse_args... |
# -*- coding: utf-8 -*-
# @Author: Zeyuan Shang
# @Date: 2016-05-13 12:50:43
# @Last Modified by: Zeyuan Shang
# @Last Modified time: 2016-05-13 12:50:54
import re
for i in range(int(raw_input())):
S = raw_input().strip()
pre_match = re.search(r'^[456]\d{3}(-?)\d{4}\1\d{4}\1\d{4}$',S)
if pre_match:
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Script to manage categories.
Syntax:
python pwb.py category action [-option]
where action can be one of these
* add - mass-add a category to a list of pages.
* remove - remove category tag from all pages in a category.
* move - move all pag... |
# Copyright 2016 Canonical 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 in writing, s... |
# Credits to Userge for Remove and Rename
import io
import os
import os.path
import re
import shutil
import time
from datetime import datetime
from os.path import basename, dirname, exists, isdir, isfile, join, relpath
from shutil import rmtree
from tarfile import TarFile, is_tarfile
from zipfile import ZIP_DEFLATED, ... |
"""Checks that disabling 'wrong-import-order' on an import prevents subsequent
imports from being considered out-of-order in respect to it but does not prevent
it from being considered for 'ungrouped-imports'."""
# pylint: disable=unused-import,import-error,no-name-in-module
from first_party.foo import bar # pylint: d... |
"""
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
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, merg... |
import pytest
from dpm.distributions import *
import dpm.utils as utils
import torch
def test_arcsine():
model = Arcsine()
assert model.expectation == 0.5
assert model.median == 0.5
assert model.variance == 0.125
assert model.skewness == 0.
assert model.kurtosis == -1.5
model = Arcsine(-1... |
import asyncio
import sys
import random
import string
from aiohttp import web
def get_random_string(k=16):
return ''.join(random.choices(string.ascii_lowercase + string.digits, k=k))
class Handler:
def __init__(self):
self.store = {}
self.headers = {'Access-Control-Allow-Origin': '*'}
as... |
"""
Copyright 2018 Goldman Sachs.
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 di... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.