text stringlengths 2 999k |
|---|
"""
Created by hanruida on 2019-03-22
"""
import sys
import os
from scrapy.cmdline import execute
sys.path.append(os.path.abspath(os.path.dirname(__file__)))
execute(['scrapy', 'crawl', 'gpsspg']) |
###############################################################################
#
# IBT: Isolated Build Tool
# Copyright (C) 2016, Richard Cook. All rights reserved.
#
# Simple wrappers around Docker etc. for fully isolated build environments
#
###########################################################################... |
""" Cisco_IOS_XR_sysadmin_system
This module contains definitions
for the Calvados model objects.
This module contains a collection of YANG
definitions for Cisco IOS\-XR SysAdmin configuration.
This module defines the system users authentication
credentials and virtual IP that can be modified in
runtime.
Copyright... |
import os
import sys
import py
import pytest
import tox
from tox.interpreters import NoInterpreterInfo
from tox.session.commands.run.sequential import installpkg, runtestenv
from tox.venv import (
CreationConfig,
VirtualEnv,
getdigest,
prepend_shebang_interpreter,
tox_testenv_create,
tox_teste... |
from Config_Utils.config import config
from sentiment.analyzer import Analyzer
from pykafka import KafkaClient
import json
client = KafkaClient(hosts='127.0.0.1:9092')
tweet_topic = client.topics[bytes('twitterfeed', 'utf-8')]
sentiment_topic = client.topics[bytes('sentimentfeed', 'utf-8')]
sentiment_producer = sent... |
import math
import uuid
class Node:
def __init__(self):
self._label = math.inf
self._visited = False
self._neighbors = []
self._parent = None
self._id = uuid.uuid4()
def add_neighbor(self, node):
self._neighbors.append(node)
def mark_as_visited(self):
... |
"""Parent class for a cross-validation interface
built with a Ray Tune back-end.
Implementation derived from referencing the equivalent
GridSearchCV interfaces from Dask and Optuna.
https://ray.readthedocs.io/en/latest/tune.html
https://dask.org
https://optuna.org
-- Anthony Yu and Michael Chau
"""
import logging... |
#! flaskvenv/bin/python
from source import app
app.run(debug=True)
|
from django.urls import path
from .views import (
ResearchCreateView,
ResearchDeleteView,
ResearchDetailView,
ResearchListView
)
app_name = 'research'
urlpatterns = [
path("", view=ResearchListView.as_view(), name="research-list"),
path("create/", view=ResearchCreateView.as_view(), name="resea... |
# core python dependencies
import logging
import os
import sys
import yaml
from django.core.validators import URLValidator
from django.core.exceptions import ValidationError
import iter8_analytics.constants as constants
# def get_env_config():
# """
# Read the environment variables that control the server behavi... |
import argparse
import os
import random
import shutil
import warnings
import sys
warnings.filterwarnings("ignore")
from keras import backend as K
import numpy as np
from PIL import Image, ImageFilter
from skimage.measure import compare_ssim as SSIM
import keras
import tensorflow as tf
import os
os.environ["CUDA_VIS... |
# Extracted from scanpy, thanks!
from functools import lru_cache
from typing import Union, Sequence
from typing_extensions import Literal
import numpy as np
from matplotlib import pyplot as pl
from matplotlib import rcParams
from matplotlib.axes import Axes
from matplotlib.figure import SubplotParams as sppars
from ma... |
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from recipe import views
router = DefaultRouter()
router.register('tags', views.TagViewSet)
router.register('ingredients', views.IngredientViewSet)
router.register('recipes', views.RecipeViewSet)
app_name = 'recipe'
urlpatterns... |
#!/usr/bin/env python3
# Copyright (C) 2017 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 ap... |
from .sign import Sign
|
from algorithms.genetic import Genome
from collections import namedtuple
Thing = namedtuple('Thing', ['name', 'value', 'weight'])
first_example = [
Thing('Laptop', 500, 2200),
Thing('Headphones', 150, 160),
Thing('Coffee Mug', 60, 350),
Thing('Notepad', 40, 333),
Thing('Water Bottle', 30, 192),
]
... |
"""
===============
Embedding In Tk
===============
"""
from six.moves import tkinter as Tk
from matplotlib.backends.backend_tkagg import (
FigureCanvasTkAgg, NavigationToolbar2TkAgg)
# Implement the default Matplotlib key bindings.
from matplotlib.backend_bases import key_press_handler
from matplotlib.figure im... |
# Copyright (c) 2018, Ansible Project
import re
import sys
from typing import TYPE_CHECKING, List
from ansiblelint.rules import AnsibleLintRule
if TYPE_CHECKING:
from typing import Any
from ansiblelint.constants import odict
from ansiblelint.errors import MatchError
from ansiblelint.file_utils impor... |
from rest_framework import serializers
from . import models
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = models.User
fields = ('name', 'email', 'password', 'create_date')
|
import ncs
client = ncs.Client()
async def main():
query = "a" # the song you are looking for
genre = "" # the song's genre
mood = "" # the song's mood
artists = [] # the song's artists
page = 1 # the search's page
results = await client.search(
query, genre=genre, mood=mood, art... |
from botocore.exceptions import ClientError
import os
import pytest
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import s3data # noqa
@pytest.fixture(scope="module")
def s3_connection():
s3 = s3data.S3Data(os.environ['AWS_ACCESS_KEY_ID'],
os... |
from flask import Flask, json, jsonify, request, render_template
import mercantile
import requests
import shutil as sh
import caer
import os
from PIL import Image
from seg_mask import *
from secret import *
app = Flask(__name__)
PORT = 8001
@app.route("/")
def index():
return "Server is up and running"
@app.rou... |
import logging
from pprint import pprint # noqa
from banal import hash_data
from datetime import datetime
from followthemoney.util import get_entity_id
from aleph.index.util import index_name, index_settings, configure_index
from aleph.index.util import query_delete, index_safe
from aleph.index.util import KEYWORD
l... |
import logging
import coloredlogs
import os
def get_logger(name='', save_dir=None, distributed_rank=0, filename="log.txt"):
logger = logging.getLogger(name)
coloredlogs.install(level='DEBUG', logger=logger)
# logger.setLevel(logging.DEBUG)
# don't log results for the non-master process
if distribu... |
#coding:utf-8
# Copyright (c) 2019 PaddlePaddle 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 re... |
import sys
from testplan import test_plan
from testplan.report.testing.styles import Style, StyleEnum
from my_tests.mtest import make_multitest
# Hard coding interactive mode usage.
@test_plan(name='MyPlan',
interactive=True,
stdout_style=Style(
passing=StyleEnum.ASSERTION_DETAI... |
# Copyright (c) 2011 OpenStack Foundation
# Copyright 2013 IBM Corp.
# 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... |
#! /usr/bin/env python
"""This module implements elements of the RTF 1.6 specification defined by
Microsoft.
http://msdn.microsoft.com/en-us/library/aa140277(v=office.10)"""
|
#!/usr/bin/env python3
import sys
import json
import urllib.request
import difflib
ALLOWED_TMOS_TYPES = ['standard', 'large']
PUBLIC_REGIONS = ['us-south', 'us-east', 'eu-gb', 'eu-de', 'jp-tok', 'au-syd']
def get_public_images(region):
if not region:
region = 'us-south'
catalog_url = "... |
import tempfile
import os
import ssl
import sys
# Init logging
import logging
log = logging.getLogger('kafka')
log.addHandler(logging.StreamHandler(sys.stdout))
log.setLevel(logging.INFO)
def generate_ssl_context(ssl_check_hostname,
ssl_cafile,
ssl_cert... |
# Batch inference
import sys
import os
import logging
import glob
import subprocess
sys.path.append("/fairmot/src")
import _init_paths
from tracker.multitracker import JDETracker
from config import Config
import cv2
import numpy as np
def get_color(idx):
idx = idx * 3
color = ((37 * idx) % 255, (17 * idx) % ... |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, PermissionsMixin
class UserManager(BaseUserManager):
def create_user(self, email, password=None, **extra_fields):
"""creates and saves a new user"""
if not email:
raise ValueError('U... |
import os
import elasticsearch
from flask import Flask
from flask_cors import CORS
from apies import apies_blueprint
#BASE = 'http://pipelines/data/{}_in_es/datapackage.json'
BASE = 'http://api.yodaat.org/data/{}_in_es/datapackage.json'
ES_HOST = os.environ.get('ES_HOST', 'localhost')
ES_PORT = int(os.environ.get('... |
##############################################################################
#
# Copyright (c) 2019 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... |
from fireorm.Fields import Field
class BooleanField(Field):
def __init__(self, **kwargs):
super().__init__(validate=BooleanField.validate, **kwargs)
@staticmethod
def validate(value):
if not type(value) == bool:
raise Exception(f'Value: {value} is not valid boolean! It is type: {type(value)}')
if __name... |
from unittest import mock
from wptserve.request import Request, RequestHeaders, MultiDict
class MockHTTPMessage(dict):
"""A minimum (and not completely correctly) mock of HTTPMessage for testing.
Constructing HTTPMessage is annoying and different in Python 2 and 3. This
only implements the parts used by... |
#!/usr/bin/env python3
"""
Name: Achal Kumar Garg <achalkumargarg89@gmail.com>
Date: 2020-01-30
Purpose: Abuse
"""
import argparse
import random
# ---------------------------------------------------------
def get_args():
parser = argparse.ArgumentParser(
description = 'Heap abuse',
... |
num = int(input('Digite um número para saber se ele é primo: '))
cont = 0
for c in range(1, num + 1):
if num % c == 0:
cont = cont + 1
if 1 < cont < 3:
print('{} é um número primo.'.format(num))
else:
print('{} não é um número primo'.format(num))
|
# Copyright 2018 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, s... |
"""
Copyright (C) 2018-2020 Intel Corporation
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 i... |
# -*- coding: utf-8 -*-
#*****************************************************************************
# Copyright (C) 2003-2006 Gary Bishop.
# Copyright (C) 2006 Jorgen Stenarson. <jorgen.stenarson@bostream.nu>
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYIN... |
from __future__ import print_function, division
#from keras.utils.visualize_util import plot
import models
import img_utils
if __name__ == "__main__":
path = r""
val_path = "val_images/"
scale = 2
"""
Plot the models
"""
# model = models.ImageSuperResolutionModel(scale).create_model()
... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re... |
class Solution:
def XXX(self, x: int) -> bool:
s = list(str(x))
t = s[::-1]
return t==s
|
from django.conf import settings
from django.http import HttpResponse
from django.template import RequestContext
from django.template import loader
from django.views.decorators.cache import never_cache
from nss_admin.models import SysUser, SysMembership, SysGroup
from .models import ShareConnection
osMapping = {
... |
from collections import defaultdict
from copy import deepcopy
from typing import List, Tuple
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
class DiffOperation:
def __init__(self):
self._data_copy: pd.Series = pd.Series(dtype='float6... |
# This file is part of the CERN Indico plugins.
# Copyright (C) 2014 - 2018 CERN
#
# The CERN Indico plugins are free software; you can redistribute
# them and/or modify them under the terms of the MIT License; see
# the LICENSE file for more details.
from __future__ import unicode_literals
from datetime import date,... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created on 1/12/19 by Pat Blair
"""
.. currentmodule:: elastalk.client
.. moduleauthor:: Pat Daburu <pat@daburu.net>
Start a conversation with Elasticsearch!
"""
import base64
import binascii
import json
import logging
from typing import Any, Dict
import elasticsearch
f... |
# -*- coding: utf-8 -*-
#
# This file is part of DataCite.
#
# Copyright (C) 2016 CERN.
#
# DataCite is free software; you can redistribute it and/or modify it
# under the terms of the Revised BSD License; see LICENSE file for
# more details.
"""XML utilities."""
from collections import OrderedDict
from lxml import ... |
weight=10
def run():
@_spawn
def _():
lfliper(2)
_sync()
r.curve_rel(-122, 52)
r.forward(57)
r.forward(20)
#hvatanje
lfliper(1)
llift(0)
pump(0, 1)
sleep(1)
#provera zahvata
# p1 = sp_left.picked()
# @_do
# def _():
# if (p1.val):
# print("Uhvatio ------------------------------")
# else:
# pri... |
#!/usr/bin/python
"""
Site24x7 Oracle Weblogic 12 Plugin
"""
import json
import os
# if any impacting changes to this plugin kindly increment the plugin
# version here.
PLUGIN_VERSION = "1"
# Setting this to true will alert you when there is a communication
# problem while posting plugin data to server
HEARTBEAT =... |
#
# CanvasRenderQt.py -- for rendering into a ImageViewQt widget
#
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
import numpy as np
from ginga.qtw.QtHelp import (QtCore, QPainter, QPen, QPolygon, QColor,
QPainterPath, QImage,... |
from biosamples_py_api import biosamples_api
class Relations:
def __init__(self, relations=None):
if relations is None:
self._relations = None
self._cached = False
else:
self._relations = relations
self._cached = True
def derived_from(self):
return self.extract_relations(biosamples_api.query_api(... |
_base_ = '../mask_rcnn/mask_rcnn_r50_fpn_1x_coco.py'
norm_cfg = dict(type='GN', num_groups=32, requires_grad=True)
model = dict(
pretrained='open-mmlab://detectron/resnet50_gn',
backbone=dict(norm_cfg=norm_cfg),
neck=dict(norm_cfg=norm_cfg),
roi_head=dict(
bbox_head=dict(
type='Share... |
import os
import copy
import uuid
from Qt import QtWidgets, QtCore, QtGui
from avalon.vendor import qtawesome
from avalon.mongodb import (
AvalonMongoConnection,
AvalonMongoDB
)
from openpype.style import get_objected_colors
from openpype.tools.utils.widgets import ImageButton
from openpype.tools.utils.lib imp... |
def maximum_subarray(nums):
current_sum = max_sum = nums[0]
for num in nums[1:]:
current_sum = max(num, current_sum + num)
max_sum = max(max_sum, current_sum)
return max_sum
if __name__ == '__main__':
print(maximum_subarray([-2,1,-3,4,-1,2,1,-5,4])) |
from post_rec.retrievers.relation_searcher import KnowAlphaHTTPProxy
config_file="knowAlphaService.json"
server=KnowAlphaHTTPProxy(config_file)
server.start() |
import torch
from torch.distributions import constraints
from torch.distributions.utils import lazy_property
from pyro.distributions.torch_distribution import TorchDistribution
from pyro.distributions.util import broadcast_shape
class MaskedConstraint(constraints.Constraint):
"""
Combines two constraints int... |
import os
import shutil
import subprocess
import sys
import tempfile
from os import PathLike
from pathlib import Path
from typing import Dict, List, NamedTuple, Optional, Sequence, Union
from zipfile import ZipFile
import toml
from .environment import ParsedEnvironment
from .util import (BuildOptions, BuildSelector, N... |
class MatcherError(AssertionError):
pass
class CustomMatcherError(AssertionError):
pass
class MatcherNotFoundError(NotImplementedError):
pass
|
from django.shortcuts import render
from rest_framework import viewsets
from .models import Course
from .serializers import CourseSerializer
class CourseView(viewsets.ModelViewSet):
queryset = Course.objects.all()
serializer_class = CourseSerializer
|
from django.conf import settings
def site_common_text(request):
return {
'APP_NAME': settings.APPLICATION_NAME,
'SEASONABLE_EMOJI': settings.SEASONABLE_EMOJI,
'DRIVE_ID': settings.DRIVE_ID,
'CALENDAR_LINK': settings.CALENDAR_LINK
}
|
from DbxSync.CodeTransformer.LineTransformer.StringLine import StringLine
class DatabricksCellSeparatorLine(StringLine):
def __init__(self, string: str = '# COMMAND -------------'):
super(DatabricksCellSeparatorLine, self).__init__(string)
|
import imutils
import numpy as np
import cv2
import base64
def byte_to_image(string_byte):
jpg_original = base64.b64decode(string_byte)
jpg_as_np = np.frombuffer(jpg_original, dtype=np.uint8)
img = cv2.imdecode(jpg_as_np, flags=1)
return img
def file_to_image(file):
img = np.asarray(bytearray(fi... |
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import logging
from textwrap import dedent
from pants.base.specs import DescendantAddresses, SingleAddress
from pants.build_graph.address import Address, BuildFileAddress
from pants.engin... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import os
import sys
import matplotlib.pyplot as plt
import numpy as np
from scipy.signal import find_peaks_cwt
from datetime import datetime
#from scipy.signal import convolve
#get_ipython().run_line_magic('matplotlib', 'qt')
# Only run this cell once to avoid confusi... |
# Copyright 2011 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 required by applicable law or a... |
#!/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.
"""Useful util functions for testing the wallet"""
from collections import namedtuple
from test_framework.addr... |
__copyright__ = "Copyright (C) 2012 Andreas Kloeckner"
__license__ = """
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, ... |
import argparse
from dataclasses import dataclass
import io
import re
import sys
from typing import Iterator
PYTHON = re.compile(r"(\w+):.*")
GO = re.compile(r"(\w+) +.*")
@dataclass
class CommandLineOptions:
infile: io.TextIOWrapper
def get_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentP... |
# Copyright 2013-2022 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)
import tempfile
from spack.package import *
class PyTensorflowProbability(Package):
"""TensorFlow Probability (TFP)... |
from django.contrib.auth import get_user_model
from django.urls import reverse
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
from core.models import Tag
from recipe.serializers import TagSerializer
TAGS_URL = reverse('recipe:tag-list')
class PublicTag... |
# flake8: noqa
# There's no way to ignore "F401 '...' imported but unused" warnings in this
# module, but to preserve other warnings. So, don't check this module at all.
__version__ = "0.4.0.dev0"
from .accelerator import Accelerator
from .kwargs_handlers import DistributedDataParallelKwargs, GradScalerKwargs
from .n... |
#!/usr/bin/env python
"""
Runs MAGeT brain on all participants in the given study and calculates voxel
counts for the regions defined by the labels of the atlases in use.
If run with the init flag, the step up steps will be run automatically (See the
'DATMAN SETUP' section for this, or 'GENERAL SETUP' for projects tha... |
from hybrid_36 import hy36encode, hy36decode
# reading pdbs:
def get_chain(record):
return record[20:22].strip(" ")
def get_resname(record):
return record[17:20].strip(" ")
def get_resid(record):
return int(record[22:26].strip(" "))
def get_res_chain_id(record):
# the spacing is mission-critical!!
return ... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.5
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" Moving data from iRODS server to a Neo4j graphdb. """
from libs.cliinterface import cli as shell_app
# MAIN
if __name__ == '__main__':
shell_app(obj={})
|
#!/usr/bin/env python
# Copyright 2004-2005 by Michael Hoffman. All rights reserved.
# This file is part of the Biopython distribution and governed by your
# choice of the "Biopython License Agreement" or the "BSD 3-Clause License".
# Please see the LICENSE file that should have been included as part of this
# package.... |
class IRCMsg(object):
"""simple wrapper for breaking apart an IRC PRIVMSG
"""
def __init__(self, name, chan, msg):
self.name = name
self.channel = chan
self.message = msg
def splitPrivMsg(m):
name = m[1: m.index("!")]
chan = m.split(" ")[2]
msg = m.split(":")[2]
retu... |
#!/usr/bin/python3
UNKNOWN_RESULT = 'unknown'
LATENCY_ATTRIBUTE_MAPPING = [
# key = key in publish result json, value= string to search OLTPBench results for
('l_25', '25'), ('l_75', '75'), ('l_90', '90'), ('l_95', '95'), ('l_99', '99'),
('avg', 'av'), ('median', 'median'), ('min', 'min'), ('max', 'max')]
|
from itertools import permutations
def isPrimery(n: int):
i = 2
while i * i <= n:
if n % i == 0:
return False
i += 1
return True
def solution(numbers: str) -> int:
numbers = list(numbers)
l = len(numbers)
comb = set()
for i in range(1, l + 1):
comb |= ... |
from guillotina import app_settings
from guillotina import configure
from guillotina.content import get_cached_factory
from guillotina.interfaces import IConstrainTypes
from guillotina.interfaces import IDatabase
from guillotina.interfaces import IResource
from typing import List
from typing import Optional
from zope.i... |
from __future__ import absolute_import, unicode_literals
try:
import json
except ImportError:
import simplejson as json
import textwrap
from django.core import serializers
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from markupmirror.fields import Markup
from mar... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-09 18:02
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Module',... |
"""Selenium Page Objects for Draytek Web Admin."""
from draytekwebadmin.pages.basepageobject import BasePageObject
from draytekwebadmin.pages.menu_navigator import MenuNavigator
from draytekwebadmin.pages.login_page import LoginPage
from draytekwebadmin.pages.management_page import ManagementPage
from draytekwebadmin.p... |
# Training procedure for LeNet-5 CIFAR-100.
#Code base from https://github.com/BIGBALLON/cifar-10-cnn/blob/master/1_Lecun_Network/LeNet_dp_da_wd_keras.py
import keras
import numpy as np
from keras import optimizers
from keras.datasets import cifar100
from keras.models import Sequential
from keras.layers import Conv2D... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import cPickle as pickle
import gzip
import logging as loggers
import os
from threading import Thread
import filelock
import numpy as np
import theano
import theano.tensor as T
import deepy
from deepy.utils.map_dict import MapDict
from deepy.layers.block import Block
fro... |
# -*- coding: utf-8 -*-
# Copyright (c) 2021, it192 and Contributors
# See license.txt
from __future__ import unicode_literals
# import frappe
import unittest
class TestLibrarySettings(unittest.TestCase):
pass
|
# coding: utf-8
"""
MailSlurp API
MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://ww... |
'''Evaluation script'''
import argparse
from pathlib import Path
import numpy as np
from tqdm import tqdm
import torch
from torch.utils.data import DataLoader
from PIL import Image
from albumentations import Compose
from albumentations import CenterCrop
from torchvision.transforms.functional import to_pil_image
... |
# coding: utf-8
"""
FlashArray REST API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: 2.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re
import six
import typing
from .... |
"""
Small command line tool to generate a html version of a junit report file
"""
import os
from argparse import ArgumentParser
import sys
from junit2htmlreport import parser, matrix, merge
PARSER = ArgumentParser(prog="junit2html")
PARSER.add_argument("--summary-matrix", dest="text_matrix", action="store_true",
... |
# -*- coding: utf-8 -*- #
# 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 requir... |
# Copyright 2017-2021 Lawrence Livermore National Security, LLC and other
# CallFlow Project Developers. See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: MIT
# ------------------------------------------------------------------------------
"""
CallFlow's data structure API.
"""
from .supergraph i... |
# Generated by Django 3.2.6 on 2021-08-13 18:16
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0008_alter_note_links'),
]
operations = [
migrations.AlterField(
model_name='note'... |
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.exceptions import (
NotFound,
APIException,
PermissionDenied,
)
from rest_framework.generics import (
CreateAPIView,
DestroyAPIView,
ListAPIView,
UpdateAPIView
)
fro... |
import copy
import torch.nn as nn
from rlkit.launchers.launcher_util import setup_logger
import rlkit.torch.pytorch_util as ptu
from rlkit.core.ma_eval_util import get_generic_ma_path_information
def experiment(variant):
from multi_differential_game import MultiDifferentialGame
expl_env = MultiDifferentialGame... |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... |
class Color:
def __init__(self, r = 0, g = 0, b = 0):
self.red = r
self.green = g
self.blue = b
def adjust_brightness(self, alpha, to_int = False):
self.red *= alpha
self.green *= alpha
self.blue *= alpha
if to_int:
self.red = int(sel... |
# /uploadfileapp/
from django.conf.urls import url
from uploadfileapp import views
app_name = 'uploadfileapp'
urlpatterns = [
# uploadfileapp/
url(r'^$', views.HomeView.as_view(),name='home' ),
# uploadifileapp/register
url(r'^upload/$', views.VideoEntry.as_view(), name='video-entry'),
url(r'^... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.