content stringlengths 5 1.05M |
|---|
# coding: utf-8
"""
Copyright 2016 SmartBear Software
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... |
"""empty message
Revision ID: 5674286baf3e
Revises: 356a0effa031
Create Date: 2017-08-21 13:34:38.213253
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '5674286baf3e'
down_revision = '356a0effa031'
branch_labels = None
depends_on = None
def upgrade():
# ... |
import pytest
def test_fake1():
x = 5
y = 6
assert x+1 == y, "values true"
|
from functools import reduce
from typing import List
from itertools import combinations
def get_input(path: str):
input = []
with open(path, "r") as f:
for line in f.readlines():
input.append(int(line.strip()))
return input
def search_for_numbers_that_sums_to(input: List, num: int, h... |
from baselayer.app.handlers.base import BaseHandler
from cesium.features.graphs import (feature_categories, feature_tags,
dask_feature_graph, extra_feature_docs)
class FeatureListHandler(BaseHandler):
def get(self):
def get_docstring(func):
return ' '.join(... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-03 11:13
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0006_repository_author'),
]
operations = [
migrations.AddField(
... |
# coding:utf-8
from db.mysql_model import BaseModel
import datetime
from settings.config import config
from peewee import *
class BlogPostCategory(BaseModel):
name = CharField(verbose_name='标题')
str = CharField(verbose_name='str', unique=True)
@staticmethod
def get_by_name(str):
try:
... |
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_AUTHENTICATION_METHOD = "username_email"
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
ACCOUNT_DEFAULT_HTTP_PROTOCOL = "https"
ACCOUNT_LOGIN_ON_EMAIL_CONFIRMATION = True
# Confirmation Email
ACCOUNT_CONFIRM_EMAIL_ON_GET = True
ACCOUNT_EMAIL_CONFIRMATION_EXPIRE_DATS = 3
ACCOUNT_EMAIL_... |
import smtplib
from email.mime.text import MIMEText
def send(recipient, sender, subject, message):
msg = MIMEText(message)
msg['Subject'] = subject
msg['From'] = sender
msg['To'] = recipient
s = smtplib.SMTP('outgoing.mit.edu', 25)
s.sendmail(sender, [recipient], msg.as_string())
s.quit()... |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = {
'description': 'A program does that is a DJ by using feedback provided by the dancers.',
'author': 'Thomas Schaper',
'url': 'https://gitlab.com/SilentDiscoAsAService/DJFeet',
'download_url': 'https... |
import numpy as np
import pandas as pd
def caricamento_dataset(file_path, columns_names =["Age","Tipo_lavoro","fnlwgt","Istruzione","Anni_istruzione","Stato_sociale",
"Occupazione","Condizione_familiare","Etnia","Genere","Cap_guadagnato",
"Cap_perso","Ore_settimanali","Paese_nativo","Red... |
import os
from injector import inject
class WfTemplatesRender(object):
"""Proccess the templates to generate a whole Oozie Workflow using Jinja2 syntax"""
@inject(templates_lib='templates_lib', filesystem='filesystem', logger='logger')
def __init__(self, templates_lib, filesystem, logger):
"""
... |
#!/usr/bin/python3
# MIT License
#
# Copyright (c) 2021 Mario Blanco Dominguez, Juan Tecedor
#
# 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 limitati... |
from oarepo_taxonomies.utils import get_taxonomy_json
from oarepo_oai_pmh_harvester.decorators import rule
from oarepo_oai_pmh_harvester.transformer import OAITransformer
@rule("uk", "xoai", "/uk/file-availability/value", phase="pre")
def call_accessibility(el, **kwargs):
return accessibility(el, **kwargs) # pr... |
# type: ignore
'''Provide tests for loaders.'''
import inspect
import os
import sys
import pkg_resources
from anymod import PluginLoader
# config_path = os.path.dirname(os.path.realpath(__file__))
# toml_path = os.path.join(config_path, 'settings.toml')
mock_path = os.path.join(os.path.dirname(__file__), 'mock_modu... |
from distutils.core import setup
setup(
name='StackExchangeAPI',
version='0.0.1',
packages=['tests', 'stackexapi'],
url='',
license='',
author='Petros Panagopoulos',
author_email='pepanago@gmail.com',
description='StackExchangeAPIAccess'
)
|
#!/usr/bin/env python
#
# Copyright 2014 Matthew Wall
# See the file LICENSE.txt for your rights.
# Modified by Yann Chemin for IWMI MWS station
# March 2015 Public Domain if previous copyright allows.
# Building Manual for the Mobile Weather Station is here:
# http://www.iwmi.cgiar.org/resources/mobile-weather-station... |
# _*_ coding: utf-8 _*_
class ValidationError(ValueError):
pass |
from ...core.api.routers import DefaultRouter
router = DefaultRouter(trailing_slash=False)
|
"""Functions for exclusive $B\to V\ell^+\ell^-$ decays."""
from math import sqrt, log
from flavio.physics.bdecays.common import meson_quark
from flavio.physics.common import conjugate_par, conjugate_wc
from flavio.physics.bdecays.wilsoncoefficients import wctot_dict
from flavio.config import config
from flavio.physics... |
from django.urls import re_path, path
from django.views.generic import RedirectView
from rest_framework.documentation import include_docs_urls
from helium.common.admin import admin_site
from helium.common.views.apis.infoviews import InfoResourceView
from helium.common.views.apis.statusviews import HealthResourceView, ... |
t = int(input())
while t:
N, K = map(int, input().split())
c = 0
min = list(map(int, input().split()))
for i in range(N):
if (K+min[i])%7 == 0:
c = c+1
print(c)
t = t-1
|
class Solution(object):
def maxProduct(self, nums):
# Handle edge case
if len(nums) == 1 and nums[0] < 0:
return nums[0]
# Keep track of current maxima and minima
cur_max = nums[0]
cur_min = nums[0]
glob_max = nums[0]
# Iterate through all nums ... |
from abc import ABC
from typing import Callable, Any
from .utils import ComsolModelAttributes, evaluate_global_ev, clean
class Individual(ABC):
def __init__(self, x, model):
self.x = x
self.model = model
self.materials = None
self.geometry = None
self.dataset = None
... |
"""
This file contains all the joint data and functions to parse the configuration file
"""
import numpy as np
from json import loads
import math
class Joint:
"""
Contains all the information related to joints
"""
def __init__(self, config, parent=None):
"""
Initialises the objects with the following data:
... |
# Copyright 2006 James Tauber and contributors
# Copyright (C) 2009 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
#
# 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/... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
import uuid
from datetime import datetime, timedelta
from django.test import SimpleTestCase, TestCase
from django.test.utils import override_settings
import pytz
from corehq.util.es.elasticsearch import ConnectionError
from mock import MagicMock, patch
from casexml.apps.case.const import CASE_ACTION_CREATE
from case... |
"""
Dataset and DataLoader designed for representing
Multi-cause ITE problem setting.
"""
# Author: Jason Zhang (yurenzhang2017@gmail.com)
# License: BSD 3 clause
from typing import Optional
import numpy as np
import pytorch_lightning as pl
import torch
from torch.utils.data import Dataset, DataLoader, random_split
... |
"""Sphinx contrib plugin for documenting Henson CLI extensions."""
from sphinxcontrib.autoprogram import AutoprogramDirective
def _import_extension(import_path):
module_name, extension_name = import_path.split(':', 1)
module = __import__(module_name, None, None, [extension_name])
return getattr(module, e... |
# 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 ... |
from datetime import datetime
import io
import json
import re
import lxml.etree as ET
import web_cache
def parse_timestamp(stamp):
# Returns a local datetime with timezone information.
m = re.match(r"(\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d\.\d\d\d[+-]\d\d):(\d\d)$", stamp)
assert m
ret = datetime.strptime... |
"""
Command-line argument wrapper.
Singleton implementation. Each class declare a subset of flags. Flags all need
to be declared before calling "make".
Use "get" for all external usage. Do not call CmdArgs class constructor unless
absolutely necessary.
"""
import argparse
cmd_args = None
def init(description):
... |
from model.pessoa import Pessoa
from dao.pessoa_db import PessoaDb
class PessoaController:
p = Pessoa()
p_db = PessoaDb()
def listar_todos(self):
return self.p_db.listar_todos()
def exportar(self):
lpc = self.p_db.listar_todos()
self.p.exportar_txt(lpc)
|
import numpy as np
from hypothesis import given, example, assume
from hypothesis.strategies import text, sampled_from, floats, lists, data, \
one_of, just
from qcodes.dataset.plotting import _make_rescaled_ticks_and_units, \
_ENGINEERING_PREFIXES, _UNITS_FOR_RESCALING
@given(param_name=text(min_size=1, max_s... |
"""A class with an instance variable."""
class MyClass(object):
def __init__(myself, value):
#print(value)
myself.instance_var = value
# create an object
obj = MyClass("It is an instance variable")
print(obj.instance_var)
print("\n\n-------- Class With Methods -----------")
class MyClassWithMe... |
Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Determine if you are able to reach the last index.
For example:
A = [2,3,1,1,4], return true.
A = [3,2,1,0,4], return false.
class Solut... |
def dirReduc(arr):
opposite_dirs = {
'NORTH': 'SOUTH',
'SOUTH': 'NORTH',
'WEST': 'EAST',
'EAST': 'WEST',
}
if len(arr) == 0:
return arr
result = [arr[0]]
for i in range(len(arr) - 1):
if len(result) > 0 and result[-1] == opposite_dirs.get(arr[i + 1]... |
#public symbols
__all__ = ['XYplotter']
import sys
import os
import numpy as np
from enthought.traits.api import on_trait_change
from openmdao.main.api import Component, ExprEvaluator
from openmdao.lib.api import Str
if 'matplotlib' not in sys.modules:
import matplotlib
if sys.platform == 'darwin':
... |
class Meter:
def __init__(self, serialNumber, type, measurementType, location, *args, **kwargs):
"""Represents a meter"""
self.serial_number = serialNumber
self.type = type
self.measurement_type = measurementType
self.location = Location(**location)
def get_meter_id(self... |
from django.contrib import admin
from account.models import CustomUser
from .models import EmailChange
from django.contrib.auth.admin import UserAdmin
from .forms import CreateUserForm, ChangeUserForm, ChangeEmailForm
@admin.register(CustomUser)
class CustomUserAdmin(UserAdmin):
add_form = CreateUserForm
chan... |
from django.core.management import setup_environ
import clouds.settings
setup_environ(clouds.settings)
from clouds.models import Image
import math
import PIL.Image, PIL.ImageDraw
minimum_points = 20
generation=1
import sys
image = Image.objects.get(pk=sys.argv[1])
kwargs = dict(line__linevalues__generation__pk=4, li... |
# =============================================================================
#
# Jade Tree Personal Budgeting Application | jadetree.io
# Copyright (c) 2020 Asymworks, LLC. All Rights Reserved.
#
# =============================================================================
from flask import current_app
from flas... |
from flask_wtf import FlaskForm
from wtforms import (StringField, TextAreaField,
SubmitField, SelectField)
from wtforms.validators import Required
class PostForm(FlaskForm):
title = StringField("Blog title:", validators=[Required()])
post = TextAreaField("Type Away:", validators=[Required()... |
import json, requests, os
# TODO:
# request json filename
# request chat channels to grab images from
# request output folder
json_filename = input("Chat-store filename: ")
output_filename = input("Output folder: ")
chat = input("Chat to archive: ")
chat = '/' + chat
channel = chat.rsplit('/', 1)[1]
ship = chat.rspl... |
import pytest
import logging
from peloton_client.pbgen.peloton.api.v1alpha.job.stateless.stateless_pb2 import (
JobSpec,
)
from google.protobuf import json_format
from tests.integration.stateless_job_test.util import (
assert_pod_id_changed,
)
from tests.integration.stateless_update import StatelessUpdate
fr... |
# To save images on the filesystem instead of the db
# (filesystem space is cheaper, in db we store paths only)
import os
# To cache all & home posts to spend less time
# loading Posts and Home webpages
from cachetools import cached, TTLCache
# To save the image better
from werkzeug.utils import secure_filename
# We n... |
from time import time
from typing import Coroutine
from nextcord import Embed
from nextcord.ext.commands import Cog, Context, command
from src import Bot
class Ping(Cog):
"""A cog for a simple ping command."""
def __init__(self, bot: Bot) -> None:
self.bot = bot
@staticmethod
async def tim... |
secret = 'password123!'
password = 'thisisnotapassword' #nohusky
command = 'print "this command is not secure!!"'
exec(command)
print(secret)
|
import torch
import torch.nn as nn
import torch.nn.functional as F
from .resnet import resnet18,resnet34,resnet50
import random
from ptsemseg.utils import split_psp_dict
from ptsemseg.models.td2_psp.pspnet_2p import pspnet_2p
import logging
import pdb
import os
from ptsemseg.loss import OhemCELoss2D,Segmentat... |
# Generated by Django 3.0.7 on 2020-06-13 22:30
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('addresses', '0001_initial'),
('core', '0005_touristspot_reviews'),
]
operations = [
migrations.AddF... |
#!/usr/bin/env python3
import os.path
import itertools as it
import pyeda.boolalg.expr as expr
import synth.constraint as constraint
from synth.util import assert_cnf
class Synth:
def __init__(self, function):
self.function_container = function
self.function = self.function_container.function
... |
# -*- coding: utf-8 -*-
"""
cron: 48 7 * * *
new Env('微博');
"""
from urllib import parse
import requests
import urllib3
from notify_mtr import send
from utils import get_data
urllib3.disable_warnings()
class WeiBo:
def __init__(self, check_items):
self.check_items = check_items
@staticmethod
... |
from django.shortcuts import render, redirect
from phone import models
from django.views import View
# Create your views here.
class Index(View):
template_name = 'index.html'
def get(self, request):
return render(request, 'index.html')
def post(self, request):
func = models.Func.creat... |
__________________________________________________________________________________________________
sample 88 ms submission
class Solution:
def findMinMoves(self, machines: List[int]) -> int:
n = len(machines)
if sum(machines)%n !=0 :
return -1
goal = sum(machines)//n
... |
from direct.directnotify import DirectNotifyGlobal
from direct.fsm import StateData
import CogHQLoader
from toontown.toonbase import ToontownGlobals
from direct.gui import DirectGui
from toontown.toonbase import TTLocalizer
from toontown.toon import Toon
from direct.fsm import State
import BoardbotHQExterior
import Boa... |
"""Helper functions to prepare data for faster rcnn
"""
import cv2
import numpy as np
import matplotlib.pyplot as plt
import math
import xml.etree.cElementTree as ET
def bbox_coord_extractor(annotations,file_name,buff=10):
"""Extract the annotations, which originally are formatted as the top left corner (x,y) an... |
from dataclasses import dataclass, field
from datetime import datetime, timezone
from typing import Dict, List, Optional
import humanize
@dataclass
class Label:
"""Labels on a Pull Request."""
name: str
@dataclass
class PullRequest:
"""Models a Pull Request"""
number: int
title: str
draft... |
from absl import app
from absl import flags
import warnings
warnings.simplefilter(action='ignore', category=(FutureWarning, DeprecationWarning, RuntimeWarning))
import train_exp as train
import dsprites_dci as eval
def run_experiment(argv):
# del argv
# Train model
model_dir = train.main(argv)
# Evalu... |
import logging
import yaml
from tapi_yandex_metrika import YandexMetrikaManagement
logging.basicConfig(level=logging.DEBUG)
with open("../config.yml", "r") as stream:
data_loaded = yaml.safe_load(stream)
ACCESS_TOKEN = data_loaded["token"]
COUNTER_ID = data_loaded["counter_id"]
api = YandexMetrikaManagement(
... |
from flask import Blueprint, render_template
temptest_bp = Blueprint('temptest_bp',
__name__,
template_folder='templates',
static_folder='static',
static_url_path='assets',
)
@temptest_bp.route('/'... |
num1 = int(input('Enter first number: '))
num2 = int(input('Enter second number: '))
num3 = int(input('Enter third number: '))
def sort():
if (num1 >= num2) and (num1 >= num3):
print(num1)
elif (num2 >= num1) and (num2 >= num3):
print(num2)
else:
print(num3)
sort()
|
#!/usr/bin/env python
import rospkg
import rospy
import yaml
from std_msgs.msg import Int8, String
from duckietown_msgs.msg import PatrolBot, BoolStamped, RobotName
import numpy as np
import tf.transformations as tr
from geometry_msgs.msg import PoseStamped
import time
class PatrollingNode(object):
def __init__(s... |
import sys,os
import pathlib
import tarfile
import urllib.request
import pandas as pd
import numpy as np
from sklearn.model_selection import StratifiedShuffleSplit
from sklearn.impute import SimpleImputer
from sklearn.preprocessing import OneHotEncoder, StandardScaler
from sklearn.base import BaseEstimator, Transformer... |
class FunctionOfTwo(object):
"""
A function of 2 distributions that can be evaluated later at specific
values.
"""
def __init__(self, distribution_1, distribution_2, method):
self._distribution_1 = distribution_1
self._distribution_2 = distribution_2
self.method = method
... |
"""
Definition of ListNode
class ListNode(object):
def __init__(self, val, next=None):
self.val = val
self.next = next
"""
class Solution:
"""
@param head: The first node of linked list
@param x: An integer
@return: A ListNode
"""
def partition(self, head, x):
# wr... |
import asyncio
import aiohttp
import sqlalchemy
from datetime import datetime
from sqlalchemy_utils import database_exists, create_database
import re
import sys
import math
import json
import time
import atexit
import datetime
from datetime import datetime, timezone
class Client:
def __init__(self, config={}):
... |
import inspect
import os
import pytest
import validx
DEV_MODE = os.environ.get("VALIDX_DEV", False)
@pytest.mark.skipif(not DEV_MODE, reason="Development mode test")
def test_public_names(module):
for name in module.__all__:
assert name in validx.__all__
obj = getattr(module, name)
i... |
from ophyd.mca import (EpicsMCA, EpicsDXP)
from ophyd import (Component as Cpt, Device, EpicsSignal, EpicsSignalRO,
EpicsSignalWithRBV, DeviceStatus)
from ophyd.device import (BlueskyInterface, Staged)
class SaturnMCA(EpicsMCA):
# TODO: fix upstream
preset_real_time = Cpt(EpicsSignal, '.PRT... |
"""
Class for reading and decoding the Find who to look at [1] dataset
[1] Xu, M., Liu, Y., Hu, R., & He, F. (2018).
Find who to look at: Turning from action to saliency.
IEEE Transactions on Image Processing, 7(9), 4529-4544. IEEE.
"""
import os
import numpy as np
import pandas as pd
import scipy.io as si... |
from freilanz.config import get_config
class Services():
def __init__(self):
self.services = get_config()['positions']
print(services) |
from keras.engine.topology import Layer, InputSpec
from keras import initializers
import keras.backend as K
import tensorflow as tf
class RoiResizeConv(Layer):
"""
Implements the region of interest max pooling layer. Crops the region instead of max pooling it.
"""
def __init__(self, pool_size, num_ro... |
from setuptools import setup
with open('requirements.txt') as f:
required = f.read().splitlines()
setup(name='huey_queue_stats',
version='0.3.0',
description='Shows basic information about one or more huey queues',
author='Adtech @ APG SGA AG',
author_email='marco.glauser@apgsga.ch',
... |
"""
https://adventofcode.com/2016/day/6
"""
from base import base
class RepetitionDecoder:
def __init__(self, fileName=None):
self.repetitions = []
if fileName:
self.readRepetitions(fileName)
def readRepetitions(self, fileName):
for line in base.getInputLines(fileName):
... |
# Generated by Django 3.0.9 on 2020-08-14 06:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('lcore', '0012_auto_20200812_2058'),
]
operations = [
migrations.AddField(
model_name='customer',
name='sector',
... |
from peewee import PostgresqlDatabase
from peewee import Model
from bot.utilities.database.constants import DATABASE
class Base(Model):
class Meta:
database: PostgresqlDatabase = DATABASE
legacy_table_names: bool = False
|
#!/bin/env python3
from __future__ import print_function
import ROOT
ROOT.PyConfig.IgnoreCommandLineOptions = True
import os
import sys
import argparse
import numpy as np
from DQMServices.FileIO.blacklist import get_blacklist
import multiprocessing
def create_dif(base_file_path, pr_file_path, pr_number, test_number, ... |
import _pickle as cPickle
import numpy as np
import matplotlib.pyplot as plt
import networkx as nx
"""
Scale-Free Networks found on Reddit
=> plot the degree distribution in log-log scale
=> follows a power-law
"""
Gs = cPickle.load(open('../dataset/proc/REDDIT-BINARY-Gs.pkl', 'rb'))
degs, mdeg = [], 0
for G... |
import platform
from datetime import datetime
from time import strftime
def getPythonVersion():
pythonVersion = int(platform.python_version()[0])
if(pythonVersion > 2):
print("\tCurrently running Python 3")
else:
print("\tCurrently running Python 2")
return pythonVersion
if __name__ == "__main__":
print(date... |
from .mobnetcnn import MobileNetCNN
__all__ = ['MobileNetCNN', 'Dataset']
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__) # type: ignore
|
import numpy as np
import pytest
from resample.permutation import usp
@pytest.mark.parametrize("n", (10, 100, 1000, 10000))
@pytest.mark.parametrize("k", (2, 10, 100))
@pytest.mark.parametrize("method", ("patefield", "shuffle"))
def test_usp(k, n, method, benchmark):
w = np.zeros((k, k))
rng = np.random.defa... |
# Copyright (c) 2014 Eric Davis
# Licensed under the MIT License
import os, sys, urwid, collections, configparser, subprocess
class Config:
def __init__(self, custom_file=None):
self.home = os.path.abspath(os.path.expanduser('~'))
defaults = \
{
'cfg_sn_username' : '',
... |
#!/usr/bin/python2.4
#
# Copyright 2008 Google 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 o... |
from tdw.controller import Controller
from tdw.tdw_utils import TDWUtils
from tdw.add_ons.third_person_camera import ThirdPersonCamera
from tdw.add_ons.image_capture import ImageCapture
from tdw.backend.paths import EXAMPLE_CONTROLLER_OUTPUT_PATH
"""
Add a pressurized cloth ball to the scene.
"""
c = Controller()
cam... |
from datetime import datetime
import logging
from pathlib import Path
class Logger:
def __init__(self, model_name, log_dir: Path, level=logging.INFO, echo=False):
self.model_name = model_name
(log_dir / "summaries").mkdir(parents=True, exist_ok=True)
date_str = datetime.now().strftime('%Y%... |
#!/usr/bin/env python
"""Combine multiple movies into one"""
import argparse
import sys
import os
import glob
import shutil
import future
from im2movie import makeMovie
__author__ = "Margriet Palm"
__copyright__ = "Copyright 2018"
__credits__ = "Margriet Palm"
__license__ = "MIT"
__version__ = "0.1"
__maintainer__ =... |
#!/usr/bin/env python3
# coding=utf-8
#
# Copyright (c) 2021 Huawei Device Co., 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... |
# Copyright 2017 Battelle Energy Alliance, 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 t... |
from typing import Iterable
def add_notebook_quotes(
lines: Iterable[str]
):
"""
Add %% above and below docs quotes with triple quotes.
Used for conversion to ipynb notebooks
Parameters
----------
lines
An iterable of lines loaded from a notebook file
Returns
-------... |
#! python2.7
## -*- coding: utf-8 -*-
## kun for Apk View Tracing
## ParseView.py
from InitDevice import init_service
from GetConfigInfo import GetViewServerInfo
from ParseElement import ParseElement
import telnetlib
class ParseView():
def __init__(self):
self.element_parser = ParseEle... |
from paprika.connectors.Helper import Helper
from paprika.repositories.Repository import Repository
class ProcessDefinitionRepository(Repository):
def __init__(self, connector):
Repository.__init__(self, connector)
def find_by_id(self, id):
connection = self.get_connection()
cursor = ... |
import re
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User
from storefront.models import Account
from storefront.lib import encoder
class ApiUrlBackend(ModelBackend):
def authenticate(self, username=None, password=None, request=None):
password = password.r... |
# -*- coding: utf-8 -*-
from helper import Helper
from ..formatter.output_formatter import OutputFormatter
class FormatterHelper(Helper):
def format_section(self, section, message, style='info'):
return '<%s>[%s]</%s> %s' % (style, section, style, message)
def format_block(self, messages, style, la... |
from Sequences.Combinatorics.Other import catalan, bell, gould, lazy_caterer, \
cake, central_binomial, natural_subsets, combinadic, pascal_triangle, \
eulerian_triangle, dyck_words, dyck_language, dyck_words_str, \
dyck_language_str, naranya_triangle, schroder_hipparchus, \
schroder, motzki... |
import os
import pandas as pd
data_format1_path = './data/data_format1/'
feature_path = './feature/'
user_log = pd.read_csv(os.path.join(data_format1_path, 'user_log_format1.csv'), dtype={'time_stamp': 'str'})
user_info = pd.read_csv(os.path.join(data_format1_path, 'user_info_format1.csv'))
df_train = pd.read_csv(os.... |
import torch
import torch.nn as nn
import math
import torch.utils.model_zoo as model_zoo
import torchvision.models as models
from nets.Calibrator3D import GC_L33Dnb, GC_T13Dnb, GC_S23DDnb, GC_CLLDnb
__all__ = ['ResNet', 'resnet50', 'resnet101','resnet152']
model_urls = {
'resnet18': 'https://download.pytorch.org... |
# coding=utf-8
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
import argparse
import faulthandler
import logging
import threading
from os.path import expanduser
from mock import MagicMock
from twisted.internet import reactor
from... |
# -*- python -*-
# This software was produced by NIST, an agency of the U.S. government,
# and by statute is not subject to copyright in the United States.
# Recipients of this software assume all responsibilities associated
# with its operation, modification and maintenance. However, to
# facilitate maintenance we as... |
import copy
import math
import os
import random
import string
from tkinter import *
from gameModules import board
from gameModules import drawboard
from gameModules import ui
from gameModules.api import API
from gameModules.ball import Ball, SuperBall
from gameModules.block import Block, Target
#####################... |
#FLM: Export Upper2Lower pairs
# Description:
# Export a list of kernign pairs, to be used in the Contextual Kerning tool
#
# It only reports MAIN pairs (ie. those using classes)
# If you want ALL pairs, run this macro on a copy of your font having the kerning manually expanded
#
# Pablo Impallari
# http://www.impa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.