text stringlengths 2 999k |
|---|
import os
import torch
from torch import nn
from torch.nn import functional as F
from torchvision import datasets, transforms
from src.models.base import BaseModel
class MNIST(BaseModel):
def _setup(self):
self.conv1 = nn.Conv2d(1, 10, kernel_size=5)
self.conv2 = nn.Conv2d(10, 20, kernel_size=5... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import os
import pprint
from base import BaseObject
from base import FileIO
class GenerateParents(BaseObject):
""" Generate the parent (type) for each term
this is the SINGLE SOURCE OF TRUTH for parents in the entire system
this generated file can ... |
import os
import unittest
from contextlib import redirect_stdout
from datetime import datetime
from io import StringIO
from unittest.mock import patch
from uuid import uuid4
import pytest
from prompt_toolkit.document import Document
from prompt_toolkit.validation import ValidationError
from pepys_import.core.store.da... |
import sys
import copy
import json
from collections import OrderedDict
from keys import *
from keys import _NO_ARG
def _is_valid_object(name, object_):
if not isinstance(object_, Keyable):
raise Exception("Invalid schema. %s is not a Keyable." % name)
def _proto_message_name(string):
if string != st... |
#!/usr/bin/env python3
"""
Representation of a patient, with phenotypes described with HPO terms.
"""
__author__ = 'Orion Buske (buske@cs.toronto.edu)'
import json
import logging
import csv
logger = logging.getLogger(__name__)
class Patient:
def __init__(self, id, hp_terms, neg_hp_terms=None, onset=None, diagn... |
#!/usr/bin/python
# TODO: test scenario
import sys
import time
import os
processes = {}
sys.path.append(os.path.abspath(__file__ + '/../../..'))
from library import runner, optionParser
def issueRequest(opts, url, expectedResult):
print 'connecting to localhost:%s' % opts.httpdPort
connection = runner.createCon... |
import sys
import operator
import pytest
import ctypes
import gc
import numpy as np
from numpy.core._rational_tests import rational
from numpy.core._multiarray_tests import create_custom_field_dtype
from numpy.testing import (
assert_, assert_equal, assert_array_equal, assert_raises, HAS_REFCOUNT)
from ... |
from django.test import TestCase, Client
from django.contrib.auth import get_user_model
from django.urls import reverse
class AdminSiteTests(TestCase):
def setUp(self):
self.client = Client()
self.admin_user = get_user_model().objects.create_superuser(
email='admin@gmail.com',
... |
import re
from io import StringIO
from contextlib import contextmanager
import snowflake.connector
import snowflake.connector.errors
import dbt.compat
import dbt.exceptions
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization
from dbt.adapters.base import C... |
#!/usr/bin/env python
#
# Copyright 2018 Espressif Systems (Shanghai) PTE 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 req... |
import json
from tornado import web
from jupyterhub.apihandlers import APIHandler, default_handlers
class BatchSpawnerAPIHandler(APIHandler):
@web.authenticated
def post(self):
"""POST set user's spawner port number"""
user = self.get_current_user()
data = self.get_json_body()
... |
load("@bazel_skylib//lib:paths.bzl", "paths")
# we disable implicit native rules by default for antlir things, but for
# third-party cxx rules it is easier to just use the buck native ruleset
cxx_library = native.cxx_library
prebuilt_cxx_library = native.prebuilt_cxx_library
def subdir_glob(glob_specs):
# Simple ... |
# -*- coding: utf-8 -*-
# Copyright 2014-2016 OpenMarket Ltd
# Copyright 2018 New Vector 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.... |
# Copyright 2020 Toyota Research Institute. All rights reserved.
# Adapted from monodepth2
# https://github.com/nianticlabs/monodepth2/blob/master/networks/depth_decoder.py
from __future__ import absolute_import, division, print_function
import numpy as np
import torch
import torch.nn as nn
from collections import... |
# -*- coding: utf-8 -*-
from django.apps import AppConfig
class OrganizationsConfig(AppConfig):
name = "organizations"
verbose_name = "Organizations"
|
"""Molecule tests for the default scenario."""
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ["MOLECULE_INVENTORY_FILE"]
).get_hosts("all")
def test_rustup_init_installed(host):
"""Ensure that rustup-init was installed."""
rus... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('scd_app', '0003_auto_20151025_2136'),
]
operations = [
migrations.CreateModel(
name='ScdComutador',
... |
# Copyright (c) 2022 Mira Geoscience Ltd.
#
# This file is part of geoapps.
#
# geoapps is distributed under the terms and conditions of the MIT License
# (see LICENSE file at the root of this source code package).
from uuid import UUID
from geoh5py.data import FloatData
from geoh5py.groups import ContainerGroup
... |
from django.db import models
# models from other Apps
from account.models import User
# python packages
import datetime
# ------------------------- COURSE MODEL -----------------------------------------
class Course(models.Model):
course_name = models.CharField("course name", max_length=60)
course_code = m... |
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 9 21:25:15 2020
@author: lenovouser
"""
import matplotlib.pyplot as plt
import numpy as np
N_MOVES = 150
DNA_SIZE = N_MOVES*2 # 40 x moves, 40 y moves
DIRECTION_BOUND = [0, 1]
CROSS_RATE = 0.8
MUTATE_RATE = 0.0001
POP_SIZE = 100
N_GENERATIONS = 200
GOAL_POINT =... |
#!/usr/bin/env python3
# date: 2019.12.08
# https://stackoverflow.com/questions/59238605/finding-page-element-using-seleniumpython
import selenium.webdriver
url = 'https://www.textnow.com/login'
driver = selenium.webdriver.Firefox()
driver.get(url)
item = driver.find_element_by_xpath('//input[@id="txt-use... |
"""
Basic tool parameters.
"""
import contextlib
import json
import logging
import os
import os.path
import re
from webob.compat import cgi_FieldStorage
import galaxy.model
from galaxy import util
from galaxy.tool_util.parser import get_input_source as ensure_input_source
from galaxy.util import (
dbkeys,
sa... |
# Copyright 2021 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, ... |
# Copyright (c) 2016-present, Facebook, 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 law or agreed... |
from socket import *
from threading import *
def send_msg(socket):
while True:
msg = input()
socket.send(bytes(msg,"utf-8"))
PORT = 1234
client = socket()
address=("localhost", PORT)
# connect to the given address
client.connect(address)
Thread(target=send_msg, args=(client, )).start()
msg = client.recv(102... |
#
# PySNMP MIB module CXLapBConv-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CXLapBConv-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:33:01 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2... |
"""
Copyright (c) 2019, 2020, Oracle Corporation and/or its affiliates. All rights reserved.
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
"""
from java.io import File
from java.io import FileInputStream
from java.io import FileOutputStream
from java.io import I... |
from ..extension import _load_library
try:
_load_library("Decoder")
_HAS_GPU_VIDEO_DECODER = True
except (ImportError, OSError):
_HAS_GPU_VIDEO_DECODER = False
|
from pyorama.graphics.graphics_system import *
from pyorama.graphics.graphics_events import *
from pyorama.graphics.mesh_utils import *
from pyorama.graphics.camera import *
from pyorama.graphics.frame_buffer import *
from pyorama.graphics.image import *
from pyorama.graphics.index_buffer import *
from pyorama.g... |
from crocs.regex import Pattern, Repeat, Group
e = Pattern('a', Repeat('b'), Repeat(Group('cd')))
e.test()
e.hits() |
IPS1 Cond1 FW1
IPS1 Cond2 Proxy1
Proxy1 Cond3 FW2 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2013 PolyBeacon, 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... |
from django.contrib import admin
from learning_logs.models import Topic,Entry
# Register your models here.
admin.site.register(Topic)
admin.site.register(Entry) |
from flask import Flask
from flask import request, redirect, render_template
from fastai.learner import load_learner
import pathlib
from fastai.vision.core import PILImage
import platform
import ensign_multicat as utils
application = Flask(__name__)
application.config['MAX_CONTENT_LENGTH'] = 12 * 1024 * 1024
MIN_STAND... |
import webiopi
import datetime
GPIO = webiopi.GPIO
LIGHT = 17 # GPIO pin using BCM numbering
HOUR_ON = 8 # Turn Light ON at 08:00
HOUR_OFF = 18 # Turn Light OFF at 18:00
# setup function is automatically called at WebIOPi startup
def setup():
# set the GPIO used by the light to output
GPIO.setFunction(LIG... |
from boa3.builtin import public
from boa3.builtin.type import UInt160
@public
def Main(value: bytes) -> bool:
if len(value) == 20:
value = UInt160(value)
return isinstance(value, UInt160)
|
# coding=utf-8
class TDXParams:
#市场
MARKET_SZ = 0 # 深圳
MARKET_SH = 1 # 上海
#K线种类
# K 线种类
# 0 - 5 分钟K 线
# 1 - 15 分钟K 线
# 2 - 30 分钟K 线
# 3 - 1 小时K 线
# 4 - 日K 线
# 5 - 周K 线
# 6 - 月K 线
# 7 - 1 分钟
# 8 - 1 分钟K 线
# 9 - 日K 线
# 10 - 季K 线
... |
from __future__ import print_function
import argparse
from math import log10
import os
import torch
import torch.nn as nn
from PIL import Image, ImageEnhance
import torch.backends.cudnn as cudnn
import torch.nn.functional as F
from torch.utils.data import DataLoader
from modules import *
import torchvision... |
#Dieses Skript funktioniert nicht!!!
#Erstellen einer Liste von wilkürlich gewählten Buchstaben
def enthalten_buchstaben(s, #Wilkürlich erstellte Liste von Buchstaben
x #gewählter Buchstabe nach dem gesucht werden soll
):
print(s) ... |
#!/usr/bin/env python
# -*- coding: utf8 -*-
#
# Copyright (c) 2014 unfoldingWord
# http://creativecommons.org/licenses/MIT/
# See LICENSE file for details.
#
# Contributors:
# Jesse Griffin <jesse@distantshores.org>
"""
Generates HTML page of recently edited pads.
"""
import os
import sys
import time
import cod... |
from collections import OrderedDict
from datetime import datetime
from itertools import product
import numpy as np
import pytest
from xarray import (
DataArray,
Dataset,
auto_combine,
combine_by_coords,
combine_nested,
concat,
)
from xarray.core import dtypes
from xarray.core.combine import (
... |
"""Application Models."""
from marshmallow import fields, Schema
from marshmallow.validate import OneOf
from ..enums import *
from ..models.BaseSchema import BaseSchema
class FormRegisterRequestSchemaPhone(BaseSchema):
# User swagger.json
country_code = fields.Str(required=False)
mobile = ... |
#
# This file is part of Python Client Library for Sample Database Model.
# Copyright (C) 2020-2021 INPE.
#
# Python Client Library for Sample Database Model is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
#
"""Utility functions for Sam... |
# ---
# jupyter:
# jupytext:
# cell_metadata_filter: all,-execution,-papermill,-trusted
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.11.5
# kernelspec:
# display_name: Python 3 (ipykernel)
# language: python
# ... |
from setuptools import setup, find_packages
setup(
name='jobtech-common',
version='1.0.2',
packages=find_packages(),
include_package_data=True,
install_requires=[
'flask', 'flask-restx', 'flask-cors', 'elasticsearch', 'certifi', 'pymemcache'
],
tests_require=["pytest"]
)
|
"""
WSGI config for vien_nchl project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`... |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyTorch(PythonPackage, CudaPackage):
"""Tensors and Dynamic neural networks in Python
... |
from bluepy import btle
"""
This class enables us to scan for BLE devices.
"""
class BLEScanner:
"""
Scan for BLE devices and returns these devices as ScanEntry
:param interface the Bluetooth interface
:param timeout how long scan operation takes (in seconds)
:return A list of ScanEntry obj... |
# This is written for PYTHON 3
# Don't forget to install requests package
import requests
import json
customerId = '5dab1ecc322fa016762f32ba'
apiKey = '9a9b28bee3b788f897c76ceca369b6da'
url = f'http://api.reimaginebanking.com/customers/{customerId}/accounts?key={apiKey}'
payload = {
"type": "Credit Card",
"nickn... |
"""Helper for adding a projectum to the projecta collection.
Projecta are small bite-sized project quanta that typically will result in
one manuscript.
"""
import datetime as dt
import dateutil.parser as date_parser
from dateutil.relativedelta import relativedelta
from regolith.helpers.basehelper import DbHelpe... |
import mitmproxy
class CheckCA:
def __init__(self):
self.failed = False
def configure(self, updated):
has_ca = (
mitmproxy.ctx.master.server and
mitmproxy.ctx.master.server.config and
mitmproxy.ctx.master.server.config.certstore and
mitmproxy.ct... |
from bilibili import bilibili
from statistics import Statistics
import printer
from printer import Printer
import rafflehandler
from configloader import ConfigLoader
import utils
import asyncio
import struct
import json
import sys
import aiohttp
class BaseDanmu():
__slots__ = ('ws', 'roomid', 'area_id', 'client'... |
from django.contrib import admin
from .models import Flight, Airport, Passenger
# Register your models here.
admin.site.register(Flight)
admin.site.register(Airport)
admin.site.register(Passenger)
|
# 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 django.contrib import admin
from .models import Ingredients
# Register your models here.
admin.site.register(Ingredients) |
import unittest
from next_greater_element_ii import next_greater_element
class NextGreaterElementIITests(unittest.TestCase):
"""Tests for next greater element ii challenge."""
def test_case_1(self):
self.assertEqual(next_greater_element([1, 2, 1]), [2, -1, 2])
if __name__ == "__main__":
unit... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown Copyright 2017-2021 Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions a... |
"""Module containing our file processor that tokenizes a file for checks."""
import contextlib
import logging
import sys
import tokenize
from typing import List
import flake8
from flake8 import defaults
from flake8 import exceptions
from flake8 import utils
LOG = logging.getLogger(__name__)
PyCF_ONLY_AST = 1024
NEWLI... |
#! /usr/bin/env python3
from build import ninja_common
build = ninja_common.Build("slam")
build.build_cmd(
'auv-slamd',
[
'ekf.cc',
'slam.cc',
'slam_filter.cc',
'slam_server.cc',
'proto/slam_msg.pb.cc',
],
deps=['zmq', 'protob... |
"""Auto-generated file, do not edit by hand. ZW metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_ZW = PhoneMetadata(id='ZW', country_code=263, international_prefix='00',
general_desc=PhoneNumberDesc(national_number_pattern='2(?:[0-57-9]\\d{6,8}|6[0-24-9]\\d{7})|(?... |
import flask_restful as restful
import flask_restful.reqparse as reqparse
import flask_restful.fields as fields
from townmapserver.resources import resource_base as rb
import townmapserver.database as db
CATCHES_MARSHALLER = {
'trainerName': fields.String(attribute=lambda x: x.user.trainerName),
'trainerLeve... |
#!/usr/bin/env python
# Copyright 2020-2021 OpenDR European Project
#
# 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 ... |
# Generated by Django 3.0.7 on 2020-06-21 06:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('quiz', '0008_quiz_dist'),
]
operations = [
migrations.AlterField(
model_name='quiz',
name='dist',
... |
"""
outputs.py is a decorator function that prints to stdout.
This eliminates lots of boilerplate code in superviseModelTrainer.
"""
import inspect
from functools import partial, wraps
def trainer_output(func):
"""
Trainer output decorator for functions that train models.
This is a decora... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-10-26 07:50
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('partner', '0082_auto_20181019_0933'),
]
operations = [
migrations.AlterUniqueToget... |
import argparse
from loggy import loggy
from sys import stdout
LOGGY = loggy('loggy')
if __name__ == '__main__':
parser = argparse.ArgumentParser("This does something")
# parser.add_argument('infile', type=argparse.FileType('r'))
# parser.add_argument('--someval', type=int, help="")
# parser.add_argumen... |
from rest_framework import serializers
from profiles_api import models
class HelloSerializer(serializers.Serializer):
"""Serializes a name field for testing our ApiView"""
name = serializers.CharField(max_length=10)
class UserProfileSerializer(serializers.ModelSerializer):
"""Serializes a user profile o... |
# -*- 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
#... |
import unittest
from cupy import testing
@testing.gpu
class TestCorrelation(unittest.TestCase):
@testing.for_all_dtypes()
@testing.numpy_cupy_allclose()
def test_corrcoef(self, xp, dtype):
a = testing.shaped_arange((2, 3), xp, dtype)
return xp.corrcoef(a)
@testing.for_all_dtypes()
... |
print('Hello World!!')
|
import os
import math
import pytest
from .common import *
from helpers.cluster import ClickHouseCluster
from helpers.dictionary import Field, Row, Dictionary, DictionaryStructure, Layout
from helpers.external_sources import SourceFile
SOURCE = SourceFile("File", "localhost", "9000", "node", "9000", "", "")
cluster... |
"""URL patterns includes for Figures development website
"""
from __future__ import absolute_import
from django.conf.urls import include, url
from django.contrib import admin
from django.conf import settings
from django.views.generic import TemplateView
urlpatterns = [
url(r'^$', TemplateView.as_view(template_nam... |
import os
class RepeatPrinter:
"""
The class allows printing repeating messages on the last line of a terminal (Unix only). This can be used to display a counter that does not scroll the terminal
example:
printer = RepeatPrinter()
printer.prompt('Hello World')
for i in range(20):
... |
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
"""
.. module:: pytfa
:platform: Unix, Windows
:synopsis: Thermodynamics-based Flux Analysis
.. moduleauthor:: pyTFA team
Tests for the pytfa module
"""
import pytfa.io
import csv
import lpdiff
import pytest
import os
from pytfa.utils import numerics
from setti... |
#!/usr/bin/env python
import os
from os.path import expanduser
home = expanduser("~")
import sys
import h5py
import argparse
from datetime import datetime
from time import time
import numpy as np
from numpy.random import permutation, seed
from scipy.cluster.vq import kmeans
import glob
import torch
import torch.nn as ... |
from tensorflow.keras import layers
from tensorflow.keras import models
from tensorflow.keras.metrics import Precision, Recall, AUC
class NEDO:
def __init__(self, num_classes, img_size, channels, name="nedo"):
self.name = name
self.num_classes = num_classes
self.input_width_height = img_s... |
#!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test for the ZMQ RPC methods."""
from test_framework.test_framework import DollarTestFramework
from test_fr... |
import os, sys
import cupy as cp
import numpy as np
from numba import cuda
from chopperhack19.mock_obs.tests import random_weighted_points
from chopperhack19.mock_obs.tests.generate_test_data import (
DEFAULT_RBINS_SQUARED)
from chopperhack19.mock_obs import chaining_mesh as cm
from chopperhack19.mock_obs.double_... |
# -*- coding: utf-8 -*-
from PyQt5.QtCore import pyqtSignal
from PyQt5.QtWidgets import QWidget
from .......GUI import gui_option
from .......GUI.Dialog.DMachineSetup.SLamParam.DAVDuct.PVentTrap.Gen_PVentTrap import (
Gen_PVentTrap,
)
class PVentTrap(Gen_PVentTrap, QWidget):
"""Page to setup the Ventilation... |
from PyQt5 import QtWidgets, uic
from PyQt5.QtWidgets import QTableWidgetItem, QMessageBox
from PyQt5.QtGui import QPen, QColor, QImage, QPixmap, QPainter, QTransform, QPolygonF
from PyQt5.QtCore import Qt, QTime, QCoreApplication, QEventLoop, QPointF
import copy
red = Qt.red
blue = Qt.blue
black = Qt.black
now = None... |
#!/usr/bin/env python2
# Copyright (c) 2014-2015 The Clicoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Test descendant package tracking code
from test_framework.test_framework import ClicoinTestFramework
f... |
# -*- 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 'Team.active'
db.add_column(u'djangocms_personlist_team', ... |
from pathlib import Path
class Config:
ROOT_DIR = Path(__file__).absolute().parent
MODELS_DIR = ROOT_DIR / "trained_models"
DATASETS_DIR = ROOT_DIR / "datasets"
|
"""add third party roles to lemur
Revision ID: 5bc47fa7cac4
Revises: c05a8998b371
Create Date: 2017-12-08 14:19:11.903864
"""
# revision identifiers, used by Alembic.
revision = "5bc47fa7cac4"
down_revision = "c05a8998b371"
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column(
"... |
def day01(digits, step=1):
n = len(digits)
s = 0
for i in range(n):
j = (i + step) % n
if digits[i] == digits[j]:
s += int(digits[i])
return s
def main():
with open("inputs/day01.txt") as file:
digits = file.readline().rstrip()
result = day01(digits, 1)
... |
# Author: Birnadin Erick
# Copyright © 2021. All rights are reserved by Birnadin Erick.
# This script can be used without any written acknowledgement from author for personal or commercial purpose.
#
from datetime import datetime as dt
from time import sleep
from flask import abort
from flask_restful i... |
import abc
class SubCmd(abc.ABC):
@abc.abstractmethod
def add_parser(self, subparser):
return NotImplemented
@abc.abstractmethod
def execute(self, args):
return NotImplemented
|
# Generated by Django 2.1.7 on 2019-02-23 05:35
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('blog', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name... |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the rawtransaction RPCs.
Test the following RPCs:
- issuenewntp1token
"""
from test_framework... |
# coding: utf-8
from __future__ import unicode_literals
import hashlib
import random
import re
import time
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
ExtractorError,
int_or_none,
parse_duration,
try_get,
urlencode_postdata,
)
class NexxIE(InfoExtracto... |
# encoding: utf-8
try:
from django.contrib.auth import get_user_model
except ImportError: # django < 1.5
from django.contrib.auth.models import User
else:
User = get_user_model()
import datetime
from django.db.models.aggregates import Count
from south.db import db
from south.v2 import DataMigration
from dj... |
import os
import torch
import torch.nn as nn
from ignite.engine import Events, Engine
from ignite.contrib.engines.common import (
setup_common_training_handlers,
save_best_model_by_val_score,
add_early_stopping_by_val_score,
setup_tb_logging,
setup_visdom_logging,
)
from ignite.handlers import Te... |
from typing import List
import pandas as pd
def tagmap(word: str) -> str:
if word in [".", ";", "!"]:
return "PERIOD"
if word == "?":
return "QUESTION"
if word in [",", ":", '-']:
return "COMMA"
else:
return "O"
def replacing(sentence: str) -> str:
return sentenc... |
from django.shortcuts import render
from notifications.signals import notify
# Create your views here.
def leave_module_notif(sender, recipient, type, date=None):
url = 'leave:leave'
module = 'Leave Module'
sender=sender
recipient=recipient
verb=''
if type=='leave_applied':
verb="Your ... |
"""
This module contains evaluation related functions.
"""
import collections
import logging
import pandas as pd
import six
import py_entitymatching.catalog.catalog_manager as cm
import py_entitymatching.utils.catalog_helper as ch
from py_entitymatching.debugmatcher.debug_gui_utils import _get_dataframe, _get_metric
... |
from amlutils.web import (
download,
requests,
)
|
# SPDX-License-Identifier: 0BSD
# Copyright 2019 Alexander Kozhevnikov <mentalisttraceur@gmail.com>
"""The classic ``compose``, with all the Pythonic features."""
__all__ = ('compose',)
__version__ = '1.2.8'
try:
from reprlib import recursive_repr as _recursive_repr
_recursive_repr_if_available = _recursive... |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import ast
from compas_rv2.rhino import get_scene
from compas_rv2.rhino.forms.settings import Settings_Tab
import rhinoscriptsyntax as rs
import scriptcontext as sc
import Eto.Drawing as drawing
import Eto.F... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 28 19:35:41 2018
@author: ska
GCDDIV
"""
def pfac(n):
ar =[]
if n%2 == 0:
ar.append(2)
while n%2 ==0:
n //= 2
for i in range(3, int(math.sqrt(n))+1,2):
if n%i == 0:
ar.append(i)
while n%i ... |
import copy
from PyQt5.QtWidgets import (QDialog, QLineEdit, QTextEdit, QVBoxLayout, QLabel,
QWidget, QHBoxLayout, QComboBox)
from btchip.btchip import BTChipException
from electrum.gui.qt.util import PasswordLineEdit
from electrum.i18n import _
from electrum import constants, bitcoin
f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.