text stringlengths 2 999k |
|---|
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# Copyright 2014 Steve Huang
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this... |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Sphinx configuration."""
from __future__ import print_function
import os
import... |
import logging
import os
import sys
import click
import stackprinter
import datahub as datahub_package
from datahub.cli.check_cli import check
from datahub.cli.cli_utils import DATAHUB_CONFIG_PATH, write_datahub_config
from datahub.cli.delete_cli import delete
from datahub.cli.docker import docker
from datahub.cli.ge... |
import _plotly_utils.basevalidators
class TicklenValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self,
plotly_name='ticklen',
parent_name='scatter.marker.colorbar',
**kwargs
):
super(TicklenValidator, self).__init__(
plotly_name=plotl... |
import json
import logging
import requests
import unittest
log = logging.getLogger()
for handler in log.handlers:
log.removeHandler(handler)
#filter logging for import modules
#logging.getLogger("requests").setLevel(logging.WARNING)
logging.getLogger("urllib3").setLevel(logging.WARNING)
logging_format = logging... |
import re
import sys
from typing import Dict
# https://github.com/pypa/twine/pull/551
if sys.version_info[:2] < (3, 9): # coverage: exclude
import importlib_resources
else: # coverage: exclude
import importlib.resources as importlib_resources
QUERIES_REGEX = re.compile(r"(?:\n|^)-- ([a-z0-9_]+) --\n(?:-- .+... |
import os
from algorithms.settings import INFERENCE_MODEL
from algorithms.io.aws_connection_definition import download_aws_folder, download_aws_file
from algorithms.io.path_definition import get_project_dir
if __name__ == "__main__":
download_aws_folder(f"data/app/models/YOLO/{INFERENCE_MODEL['YOLO']}/",
... |
from pysnmp.proto.secmod.rfc3414.priv import base
from pysnmp.proto import errind, error
class NoPriv(base.AbstractEncryptionService):
serviceID = (1, 3, 6, 1, 6, 3, 10, 1, 2, 1) # usmNoPrivProtocol
def hashPassphrase(self, authProtocol, privKey):
return
def localizeKey(self, authProtocol, pri... |
import random
from xml.dom import minidom
from scrapy.utils.project import get_project_settings
class RandomUserAgentMiddleware(object):
settings = get_project_settings()
source_path = 'data/user_agents.xml'
def __init__(self, *args, **kwargs):
xmldoc = minidom.parse(self.source_path)
ite... |
with open('Day16/test_input.txt') as f:
data = f.readlines()[0].rstrip()
class Packet():
def __init__(self, version, type_id, number, parent=None):
self.version = version
self.id = type_id
self.parent = parent
self.number = number
def __repr__(self):
return f"|Vers... |
# 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... |
import logging
from flask_sqlalchemy import SQLAlchemy
SCHEMA_FILE = "baracoda/sql/schema.sql"
logger = logging.getLogger(__name__)
db = SQLAlchemy()
def reset_db():
"""
Initialise the required database components.
"""
logger.debug("init_db()")
with open(SCHEMA_FILE, "r") as schema_file:
... |
description = 'real flight path'
group = 'lowlevel'
includes = ['detector']
devices = dict(
real_flight_path = device('nicos_mlz.refsans.devices.resolution.RealFlightPath',
description = description,
table = 'det_table',
pivot = 'det_pivot',
),
)
|
# Copyright (c) 2021 Grumpy Cat Software S.L.
#
# This Source Code is licensed under the MIT 2.0 license.
# the terms can be found in LICENSE.md at the root of
# this project, or at http://mozilla.org/MPL/2.0/.
import numpy as np
import shapelets.compute as sc
def test_explicit_list_creation():
sa = sc.array([[... |
class Stream:
"""
Stream is abstract stream for string and list
"""
EOF = (-1)
def __init__(self, src):
if not isinstance(src, (str, list, tuple)):
raise TypeError('invalid type of source in absstream.stream.Stream')
self._src = src
self._limit = len(src)
... |
#!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin Core developers
# Copyright (c) 2017 The Raven Core developers
# Copyright (c) 2018 The Rito Core developers
# Copyright (c) 2020 The KringleProjectCoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www... |
i = 1
while i <= 5:
print i
i += 1
if i == 3:
break
else:
print 'Hit the While/Else Statement!'
|
"""py.test configuration"""
import os
from sys import version_info
from pathlib import Path
import numpy as np
import nibabel as nb
import pandas as pd
import pytest
import tempfile
import pkg_resources
from .utils.bids import collect_data
test_data_env = os.getenv(
"TEST_DATA_HOME", str(Path.home() / ".cache" / ... |
#! /usr/bin/python
# Copyright Notice:
# Copyright 2019-2020 DMTF. All rights reserved.
# License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/Redfish-Tacklebox/blob/master/LICENSE.md
"""
Tasks Module
File : tasks.py
Brief : This file contains the definitions and functionalities for interac... |
import os
from fastapi import HTTPException, status, Request
from fastapi.security import OAuth2PasswordBearer
from passlib.context import CryptContext
from datetime import datetime, timedelta
from jose import jwt, JWTError
from ..repositories import user_repository
class JWTAuthenticator:
__SECRET_KEY: str
__... |
import matplotlib.pyplot as plt
import numpy as np
import sklearn
import sklearn.linear_model
def plot_decision_boundary(model, X, y):
# Set min and max values and give it some padding
x_min, x_max = X[0, :].min() - 1, X[0, :].max() + 1
y_min, y_max = X[1, :].min() - 1, X[1, :].max() + 1
h = 0.01
#... |
from DeviceControllerTelegramBot import bot
# for bot
api_key = "telegram_api_key"
admin_chat_ids_list = [
# admin chat id,
# in integers
]
# Serial communication configuration with Arduino board
serial_comms_conf = {
'PORT': "COM[PORT_NUMBER]",
'baud_rate': 9600,
'timeout': 0.0,
'encoding': '... |
fajl=open("egyszamjatek.txt", "r")
#sdkjfhsdkfjh
jatekos=[]
for sor in fajl:
rekord=sor.rstrip().split()
Fszam=len(rekord)-1
for i in range(Fszam):
rekord[i]=int(rekord[i])
jatekos.append(rekord)
fajl.close()
Jszam=len(jatekos)
print("3. feladat: Játékosok száma: ", Jszam)
print("4. feladat: For... |
#
# Copyright (c) 2019 Universidad Politecnica de Madrid.
#
# This file is part of ACTIVAGE.
# See http://www.activageproject.eu/ for further info.
#
# 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 Licens... |
try:
import os, gettext
locale_dir = os.path.split(__file__)[0]
gettext.install("4Suite", locale_dir)
except (ImportError, AttributeError, IOError):
def _(msg):
return msg
SYNTAX_ERR_MSG = _(
"Error parsing expression:\n'%s'\nSyntax error at or near '%s' Line: %d"
)
INTERNAL_ERR_MSG = _(... |
from rest_framework import mixins, viewsets
from .models import Job
from .serializers import JobSerializer
class JobViewSet(mixins.CreateModelMixin,
mixins.ListModelMixin,
mixins.RetrieveModelMixin,
viewsets.GenericViewSet):
queryset = Job.objects.all()
seri... |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
def main():
print('Hello from Python!')
if __name__ == '__main__':
main() |
from crypt import crypt
import sqlalchemy.exc
from typing import List
from error import DoesNotExist
from storage import UnixPasswordStorage
from password import UnixPassword
from .sqlite_api import (
Database,
DatabaseApi
)
from .password_schema import Password
def _fmt_password(password: Password) -> Unix... |
import os
import urllib
from cached_property import cached_property
from ebi_eva_common_pyutils.pg_utils import get_all_results_for_query
from eva_submission.eload_submission import Eload
from eva_submission.eload_utils import get_reference_fasta_and_report, get_project_alias, download_file
class EloadBacklog(Eload... |
###TESTING GEE
import os, sys, inspect, argparse, logging, shutil, re, geojson
import ee
ee.Initialize() #Initialize the ee object, but this requires work the first time through
# https://developers.google.com/earth-engine/python_install
import geopandas as gpd
import pandas as pd
try:
from gbdxt... |
import discord
from discord.ext import commands
from discord.ext.commands import CommandNotFound
from discord.utils import get
import asyncio
import random
import time
import os
import requests
import json
import re
file = open("blocked-words.txt", "r")
content = file.read()
blocked_words = content.split("... |
# Copyright (C) 2009 Canonical
#
# Authors:
# Michael Vogt
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# Th... |
#! /usr/bin/python3
import sys
import pennylane as qml
from pennylane import numpy as np
def binary_list(m, n):
"""Converts number m to binary encoded on a list of length n
Args:
- m (int): Number to convert to binary
- n (int): Number of wires in the circuit
Returns:
- (list(in... |
import os
import sys
import simulation
import numpy as np
from multiprocessing import Pool
from test_model import *
from rational_model import *
n_players = 1
pars = 100*(0.97)**np.array(range(500))
light_fields = ['0-1en01', '1-1en01', '2-1en01', '3-1en01']
out_dir = '../../modeling/'
try:
os.makedirs(out_d... |
##############################################################################
#
# Copyright (c) 2008 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 . import client
import json
# Testing the main page
def test_read_main():
response = client.get("/")
assert response.status_code == 200
assert response.json() == {"message": "The Entire Application"}
# Testing if new users with valid
# credentials can register successfully.
def test_user_registrati... |
# -*- 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 "Li... |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 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 wallet import RPCs.
Test rescan behavior of importaddress, importpubkey, importprivkey, and
impor... |
# -*- coding: utf-8 -*-
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ... |
from __future__ import unicode_literals, division, absolute_import
import difflib
import logging
import re
from bs4.element import Tag
from flexget.utils.soup import get_soup
from flexget.utils.requests import Session
from flexget.utils.tools import str_to_int
from flexget.plugin import get_plugin_by_name, PluginErro... |
#!/usr/bin/env python
from django.utils import simplejson
from tastypie.fields import ApiField
class GeometryApiField(ApiField):
"""
Custom ApiField for dealing with data from GeometryFields (by serializing them as GeoJSON) .
"""
dehydrated_type = 'geometry'
help_text = 'Geometry data.'
... |
from django.contrib import admin
# Register your models here.
from services.models import Activity
admin.site.register(Activity) |
from ksc.parse_ks import parse_ks_filename
from ksc.expr import Def, EDef, GDef, Rule, Const, Var, Lam, Call, Let, If, Assert
from ksc.expr import pystr
from ksc.type_propagate import type_propagate_decls
# Pretty printing
# Importing prettyprint to get the decorated printers for Expression and Type
import ksc.prett... |
# 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 may ... |
"""todo URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based vi... |
#!/usr/bin/python
"""Compiles the C and Fortran modules used by CoMEt."""
############################################################################
# First compile the C code
# Load required modules
from distutils.core import setup, Extension
import subprocess, numpy, os
thisDir = os.path.dirname(os.path.realpat... |
/usr/lib/python2.6/os.py |
#!/usr/bin/python
# Filename: base_for.py
for i in range(0, 5):
print i
else:
print 'The for loop is end'
print 'Done.'
|
# Copyright 2013-2021 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 RLimsolve(RPackage):
"""Solving Linear Inverse Models
Functions that (1) find the min... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
__... |
import requests
from bs4 import BeautifulSoup
def main():
url = 'http://blog.castman.net/web-crawler-tutorial/ch1/connect.html'
print(get_elem_text(url, 'p'))
print(get_elem_text(url, 'title'))
print(get_elem_text(url, 'not_exist'))
def get_elem_text(url, elem):
try:
resp = requests.get(ur... |
"""
This module reads a file path that is passed in using ActiveDoc.importFile()
and returns a object formatted so that it can be used by grist for a bulk add records action
"""
import csv
import logging
import os
import chardet
import messytables
import messytables.excel
import six
from six.moves import zip
import p... |
# 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 2.3.3... |
# coding: utf-8
"""
Cisco Intersight
Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environmen... |
import struct
import base64
import mimetypes
from os import path
from abc import ABC, abstractmethod
from typing import Optional
from .utils import create_parent_dirs
GLB_JSON_CHUNK_TYPE, = struct.unpack('<I', b'JSON')
GLB_BINARY_CHUNK_TYPE, = struct.unpack('<I', b'BIN\x00')
class GLTFResource(ABC):
"""
Bas... |
import os
import copy
import pandas as pd
import numpy as np
from bienes_inmuebles.dataset.csv_preprocesamiento import CSV, PATH4
def test_cvs_to_dataframe():
objeto_csv = CSV(os.path.join(PATH4, "data/csv_barcelona.csv"))
assert objeto_csv.df.columns[1] == "listing_url" # funcion de comprobacion -> como un ... |
import requests
from enum import Enum
import operator
import random
import html
from utils import json_request
from urllib.parse import urlencode
import json
"""
This is a quiz game to play with your friends.
Example of a question data:
"category":"Entertainment: Japanese Anime & Manga",
"type":"multi... |
# -*- coding: utf-8 -*-
from nbsite.shared_conf import *
project = u'Panel'
authors = u'Panel contributors'
copyright = u'2019 ' + authors
description = 'High-level dashboarding for python visualization libraries'
import param
param.parameterized.docstring_signature = False
param.parameterized.docstring_describe_pa... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
from chat.models import Chat, Message
class ChatAppTests(TestCase):
def setUp(self):
self.user1 = User.objects.create_... |
"""
WSGI config for airone 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.2/howto/deployment/wsgi/
"""
import os
import importlib
from django.conf import settings
from configurations.wsgi import get_ws... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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 cop... |
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class ReverseLinkList(object):
def reverseList(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
temp = None
while head:
... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Red Hat, 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
#
#... |
#! /usr/bin/python
from pip._internal import main as pip_main
import sys
if __name__ == '__main__':
python_version = sys.version_info
deps = [
"execnet>=1.0.9",
"pytest",
"pyzmq",
"sqlalchemy",
"Jinja2",
]
print("Setting up dependencies...")
result = pip_ma... |
import torch
import extlib
try:
import extlib_cuda
except:
print('not loading cuda jagged ops')
from torch.autograd import Function
from torch.nn import Module
import numpy as np
#----------------------
# jagged_log_softmax
#----------------------
class JaggedLogSoftmaxFunc(Function):
@staticmethod
d... |
import re
from setuptools import find_packages, setup
with open('README.rst', encoding='utf8') as f:
long_description = f.read()
with open('brawlstats/__init__.py') as f:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE).group(1)
requirements = []
with open('requirements... |
# ------------------------------------------------------------------------------------------------------
# Copyright (c) Leo Hanisch. All rights reserved.
# Licensed under the BSD 3-Clause License. See LICENSE.txt in the project root for license information.
# ---------------------------------------------------------... |
'''
Supports the Bayeux protocol over long-polling and WebSocket transports in
Tornado.
Copyright (c) The Dojo Foundation 2011. All Rights Reserved.
Copyright (c) IBM Corporation 2008, 2011. All Rights Reserved.
'''
from .manager import BayeuxManager
from .session import BayeuxSession
from .connection import BayeuxCo... |
import random
KILLERS = {
"Michael Myers": 7,
"Jason Vorhees": 6,
"Freddy Krueger": 8,
"Jigsaw": 2,
"Pinhead": 9,
"Leatherface": 5,
"Ghostface": 3,
"Hannibal Lecter": 4,
}
def get_killer():
return random.choice(list(KILLERS.keys()))
def killer_battle(k1, k2):
if k1 not in KI... |
import os
import re
import json
from . import helpers
from ratelimit import rate_limited
def get_helpscout_api_key():
hs_api_key = os.environ.get('HELP_SCOUT_API_KEY')
if not hs_api_key:
raise ValueError("None HELP_SCOUT_API_KEY from environment variables")
return hs_api_key
def is_helpdesk_ur... |
"""
WSGI config for ongherdeiros 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/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO... |
# -*- coding: utf-8 -*-
import collections
import mimetypes
import os
import random
import uuid
from django.conf import settings
from django.utils.translation import activate
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test.client import RequestFactory
from fxa.constants import ENVIRONME... |
"""Code generation for native function bodies."""
from typing import Union
from typing_extensions import Final
from mypyc.common import (
REG_PREFIX, NATIVE_PREFIX, STATIC_PREFIX, TYPE_PREFIX, MODULE_PREFIX,
)
from mypyc.codegen.emit import Emitter
from mypyc.ir.ops import (
OpVisitor, Goto, Branch, Return, A... |
import json
from requests import Session
from requests.exceptions import ConnectionError, Timeout, TooManyRedirects
class APIError(Exception):
def __init__(self, r):
super().__init__(repr(r))
self.res = r
class CoinMarketCap:
def __init__(self, api_key=None):
self.__base_api_url = "... |
# Copyright 2018 The Cirq Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
# 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... |
import ctypes as c
import pathlib
from contextlib import contextmanager, redirect_stdout
from io import StringIO
import numpy as np
from plaster.run.sigproc_v3.c.build import build_dev
from plaster.tools.c_common import c_common_tools
from plaster.tools.c_common.c_common_tools import (
CException,
F64Arr,
... |
from enum import IntEnum
from time import sleep
from . import GPIBBase, InstrumentException
class ITC503(GPIBBase):
"""
Interface to an ITC 503 intelligent temperature controller.
The preferred way of using this object is through context management:
>>> with ITC503() as tempcontroller:
... p... |
import dis
def sum():
vara = 10
varb = 10
sum = vara + varb
print "vara + varb = %d" % sum
print sum()
|
import numpy as np
import itertools
import os
# imgW,imgH: dimensions of the generated dataset images
imgW = 720
imgH = 720
cardW = 60
cardH = 114
cornerXmin = 3 * 4
cornerXmax = 9 * 4
cornerYmin = 3 * 4
cornerYmax = 19 * 4
# We convert the measures from mm to pixels: multiply by an arbitrary factor 'zoom'
zoom = 4... |
#!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin Core developers
# Copyright (c) 2017 The Raven Core developers
# Copyright (c) 2018 The DCLRcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test compac... |
#!/usr/bin/env python
'''
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")... |
"""
Copyright 2017 Government of Canada - Public Services and Procurement Canada - buyandsell.gc.ca
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
Unles... |
from django.conf.urls import patterns, url
from openslides.utils.views import RedirectView
from .signals import config_signal
from .views import ConfigView
urlpatterns = patterns(
'',
url(r'^$',
RedirectView.as_view(url_name='config_general'),
name='config_first_config_collection_view')
)
fo... |
from tqdm import tqdm
import torch
from torch import nn, optim
import torchvision
from torchvision.models.resnet import ResNet, BasicBlock
from torchvision import datasets, transforms
from inference_pipeline import inference_pipeline
class TeacherModel(ResNet):
def __init__(self):
super(TeacherModel, se... |
"""Notebook related utilities"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import asyncio
import concurrent.futures
import ctypes
import errno
import inspect
import os
import socket
import stat
import sys
from distutils.version import LooseVersion
from urll... |
# Generated by Django 2.2 on 2020-02-19 13:59
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Projects',
fields=[
('id', models.AutoField(a... |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 The Fujicoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test logic for skipping signature validation on old blocks.
Test logic for skipping signature validat... |
"""Created on Sun Feb 4 17:57:57 2020
@author: nkalyan🤠
Implementing fraction calculator by using classes and functions, which takes fractions as inputs,
and performs arithmetic operations"""
class Fraction:
""""Support addition, subtraction, multiplication, and division of fractions
... |
import datetime
import gzip
import json
import logging
import os
import tempfile
import zipfile
import pytest
import retrying
__maintainer__ = 'mnaboka'
__contact__ = 'dcos-cluster-ops@mesosphere.io'
# Expected latency for all dcos-diagnostics units to refresh after postflight plus
# another minute to allow for che... |
#!/bin/env python
import numpy as np
from nvidia.dali.pipeline import Pipeline
import nvidia.dali.ops as ops
import nvidia.dali.types as types
try:
from matplotlib import pyplot as plt
has_matplotlib = True
except ImportError:
has_matplotlib = False
BATCH_SIZE=4
COUNT=5
VIDEO_FILES=["prepared.mp4"]
ITE... |
# Lint as: python3
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
#!/usr/bin/env python
# coding: utf-8
"""
"""
from __future__ import division
import datetime
import cmf
import spotpy
from spotpy.parameter import Uniform as param
import sys
import os
import numpy as np
from datawriter_multi_objective import DataWriter
# Calibration time span
# 1979: Spin-Up
... |
import sys
class CsvReader():
def __init__(self, file_name, sep=',', header=False, skip_top=0, skip_bottom=0):
self.file = open(file_name, 'r')
self.sep = sep
self.header = header
self.skip_top = skip_top
self.skip_bottom = skip_bottom
self.csv_lines = []
sel... |
#!/bin/python3
import itertools as it
# Complete the miniMaxSum function below.
def miniMaxSum(arr):
variations = list(it.combinations(arr,4))
m1 = 0; m2 = sum(variations[0])
for i in range(len(variations)):
if sum(variations[i]) > m1:
m1 = sum(variations[i])
if sum(variations[... |
import sys
from time import time
import subprocess
import argparse
def convert(infile, density=300, resize='25%'):
assert infile.split('.')[-1] == 'pdf'
outfile = '.'.join(infile.split('.')[:-1] + ['png'])
s = 'convert -density {density} {input} -resize {resize} {out}'.format(
input=infile, out=ou... |
from typing import List, Tuple, Optional
from mint.types.blockchain_format.coin import Coin
from mint.types.blockchain_format.program import Program
from mint.types.blockchain_format.sized_bytes import bytes32
from mint.types.condition_opcodes import ConditionOpcode
from mint.types.coin_spend import CoinSpend
from min... |
"""Tests for the USB Discovery integration."""
import datetime
import os
import sys
from unittest.mock import MagicMock, patch, sentinel
import pytest
from homeassistant.components import usb
from homeassistant.const import EVENT_HOMEASSISTANT_STARTED
from homeassistant.setup import async_setup_component
import homea... |
from storages.backends.s3boto3 import S3Boto3Storage
class S3Boto3StorageForWagtailDocument(S3Boto3Storage):
# Enable signing.
querystring_auth = True
querystring_expire = 60
# Signing URLs does not work with custom domains.
custom_domain = None
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.