text stringlengths 2 999k |
|---|
# -*- coding: utf-8 -*-
"""
These functions "walk" the profile, and return either a boolean variable to
tell whether an option is configured or not, or the actual value
"""
import base64
import inspect
import logging
import hashlib
import os
import re
import shutil
import sys
import yaml
from cryptography.fernet import... |
"""
Computes a dendrogram based on a given categorical observation.
"""
from typing import Optional, Sequence, Dict, Any
import pandas as pd
from anndata import AnnData
from pandas.api.types import is_categorical_dtype
from .. import logging as logg
from .._utils import _doc_params
from ..tools._utils import _choose... |
# python3
# Copyright 2018 DeepMind Technologies Limited. 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... |
"""
Add version column to history_dataset_association table
"""
import logging
from sqlalchemy import (
Column,
Integer,
MetaData,
Table,
)
log = logging.getLogger(__name__)
version_column = Column("version", Integer, default=1)
def upgrade(migrate_engine):
print(__doc__)
metadata = MetaDa... |
"""
"""
from __future__ import absolute_import
import sys
import traceback
import click
DEBUG = False
def debug(message, *args):
if args:
message = message % args
if DEBUG:
click.echo(message)
def info(message, *args, **kwargs):
if args:
message = message % args
fg = kwar... |
# The Nature of Code
# Daniel Shiffman
# Fernando Otávio
# http://natureofcode.com
# Example 1-1: Bouncing Ball, no vectors
import pygame, random, sys, math
# Define some colors
# R G B
BLACK = ( 0, 0, 0)
GRAY = (100, 100, 100)
NAVYBLUE = ( 60, 60, 100)
WHITE = (255, 255, 255)
RED ... |
print "-----"
print [] and 5
print {} and 5
print False and 5
print True and 5
print "-----"
print [] or 5
print {} or 5
print False or 5
print True or 5
print "-----"
print 5 and []
print 5 and {}
print 5 and False
print 5 and True
print "-----"
print 5 or []
print 5 or {}
print 5 or False
print 5 or True
print "-----... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from pathlib import Path
from qlib.model.meta.task import MetaTask
from qlib.contrib.meta.data_selection.model import MetaModelDS
from qlib.contrib.meta.data_selection.dataset import InternalData, MetaDatasetDS
from qlib.data.dataset.handler impor... |
# Lint as: python3
# Copyright 2018 The TensorFlow 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 ... |
"""Start up a fake bulb to test features without a real bulb."""
import json
import socketserver
import threading
from typing import Any, Callable, Dict
def get_initial_pilot() -> Dict[str, Any]:
return {
"method": "getPilot",
"env": "pro",
"result": {
"mac": "ABCABCABCABC",
... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.12.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re... |
#
# Copyright (C) 2019 GreenWaves Technologies
#
# 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 agre... |
# Copyright 2020 The TensorFlow 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 required by applicable ... |
"""
The installer didn't handle snowflake URLs with a region containing '.',
such as azure_account.azure_region.azure.snowflakecomputing.com
"""
from scripts.install import parse_snowflake_url
TEST_URLS = {
"account": ['account', None],
"account.snowflakecomputing.com": ['account', 'us-west-2'],
"account... |
import os
def coverage(name):
if os.path.isfile(name + '_Cov_test.py'):
os.remove(name + '_Cov_test.py')
counter = 0
with open(name + "_Cov_test.py", "a") as out:
with open(name + ".py", "r") as code:
out.write("global _TheTestingCounter_\n")
out.write("_T... |
# Copyright 2014: Mirantis 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 b... |
import os
import pickle
import h5py
import torch
from torch.utils.data import Dataset
import torchvision.transforms as transforms
from PIL import Image
from torch.utils.data import DataLoader
from prefetch_generator import BackgroundGenerator
__all__ = [
"DataLoaderPFG", "DenseCapDataset", 'DenseCapDatasetV2'
]
... |
#! /usr/bin/env python
"""
Script to observe sentence counts by language
"""
import os
import json
from argparse import ArgumentParser
from collections import Counter
from multiprocessing import Pool
from typing import Generator
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
MINIMUM_MEAN_SE... |
# pylint: disable-msg=E1101,W0612
from datetime import datetime, timedelta
import nose
import numpy as np
import pandas as pd
from pandas import (Index, Series, DataFrame, Timestamp, isnull, notnull,
bdate_range, date_range, _np_version_under1p7)
import pandas.core.common as com
from pandas.compa... |
from diagrams import Diagram
from diagrams.custom import Custom
from diagrams.firebase.develop import *
from diagrams.programming.framework import React
from diagrams.saas.chat import Discord
graph_attr = {
"pad": "1.0",
"splines": "curved",
}
with Diagram(filename="build/trade_ingestion", show=False, graph_a... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import uuid
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('inventory', '0011_auto_20160722_0918'),
('datastore', '0001_initial'),
migration... |
from menpodetect.ffld2 import load_ffld2_frontal_face_detector
import menpo.io as mio
takeo = mio.import_builtin_asset.takeo_ppm()
def test_frontal_face_detector():
takeo_copy = takeo.copy()
ffld2_detector = load_ffld2_frontal_face_detector()
pcs = ffld2_detector(takeo_copy, threshold=2)
assert len(p... |
from flask_mail import Message
from flask import render_template
from . import mail
def mail_message(subject,template,to,**kwargs):
sender_email ='minutepitch781@gmail.com'
email = Message(subject, sender=sender_email, recipients=[to])
email.body= render_template(template + ".txt",**kwargs)
email.htm... |
"""'UniProt_reference_proteome_manager.py' written by Delan Huang, OHSU, July 2017.
The MIT License (MIT)
Copyright (c) 2017 OHSU
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 restrict... |
"""
API for yt.frontends.nc4_cm1
"""
from .data_structures import CM1Dataset, CM1Grid, CM1Hierarchy
from .fields import CM1FieldInfo
from .io import CM1IOHandler
|
class Settings:
# APP SETTINGS
ENABLE_CUSTOM_TITLE_BAR = True
MENU_WIDTH = 240
LEFT_BOX_WIDTH = 240
RIGHT_BOX_WIDTH = 240
TIME_ANIMATION = 500
# BTNS LEFT AND RIGHT BOX COLORS
BTN_LEFT_BOX_COLOR = "background-color: rgb(44, 49, 58);"
BTN_RIGHT_BOX_COLOR = "background-color: #ff... |
# Copyright (c) 2021, Framras AS-Izmir and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class TRUBLBillingReference(Document):
pass
|
from py_models_parser import parse
def test_simple_pony_model():
model = """
class Person(db.Entity):
name = Required(str)
age = Required(int)
cars = Set('Car')
class Car(db.Entity):
make = Required(str)
model = Required(str)
owner = Required(Person)
"""
result = parse(model)
... |
# 9th percentile.
from collections import Counter
class Solution(object):
def majorityElement(self, nums):
return Counter(nums).most_common()[0][0]
# 26th percentile.
class Solution(object):
def majorityElement(self, nums):
counter = {}
max_count = 0
max_num = None
fo... |
import pyeccodes.accessors as _
def load(h):
h.add(_.Position('offsetSection1'))
h.add(_.Section_length('section1Length', 4))
h.add(_.Section_pointer('section1Pointer', _.Get('offsetSection1'), _.Get('section1Length'), 1))
h.add(_.Unsigned('numberOfSection', 1))
h.add(_.StringCodetable('centre', ... |
""" -----------------------------------------------------
# TECHNOGIX
# -------------------------------------------------------
# Copyright (c) [2022] Technogix SARL
# All rights reserved
# -------------------------------------------------------
# Keywords to manage CODEARTIFACT tasks
# -------------------------... |
# --------------------------------------------------------------
# Warp API Demo
# (C) Michael DeHaan <michael@michaeldehaan.net>, 2020
# --------------------------------------------------------------
# https://soundcloud.com/mpdehaan/probability-of-monster
# as recorded: 3x Arturia ObXA synth instances + Lexicon UAD ... |
"""Init file for Supervisor Docker object."""
from ipaddress import IPv4Address
import logging
from typing import Awaitable, Dict, Optional
import docker
import requests
from ..const import ENV_TIME, ENV_TOKEN, ENV_TOKEN_OLD, LABEL_MACHINE, MACHINE_ID
from ..exceptions import DockerAPIError
from .interface import Com... |
"""
mnist_loader
~~~~~~~~~~~~
A library to load the MNIST image data. For details of the data
structures that are returned, see the doc strings for ``load_data``
and ``load_data_wrapper``. In practice, ``load_data_wrapper`` is the
function usually called by our neural network code.
"""
#### Libraries
# Standard lib... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
VERSION =... |
import json
import pprint
import random
import time
import torch
import torch.multiprocessing as mp
from models.nn.resnet import Resnet
from data.preprocess import Dataset
from importlib import import_module
class Eval(object):
# tokens
STOP_TOKEN = "<<stop>>"
SEQ_TOKEN = "<<seg>>"
TERMINAL_TOKENS = [... |
# encoding: utf-8
"""Class Declaration of Transformer's Input layers."""
import logging
import chainer
import chainer.functions as F
import chainer.links as L
import numpy as np
from espnet.nets.chainer_backend.transformer.embedding import PositionalEncoding
class Conv2dSubsampling(chainer.Chain):
"""Convoluti... |
import torch
import torch.nn as nn
import torchvision.models as models
class Siamese(nn.Module):
def __init__(self, in_channels, out_size, dropout):
super(Siamese, self).__init__()
self.dropout = dropout
self.dropout_layer = nn.Dropout(dropout)
#self.model = models.vgg16(pr... |
import math
import random
h = 0
k = int(input('Number of dots: '))
for i in range(0,k):
x = (random.randint(0,100)/100)
y = (random.randint(0,100)/100)
if math.sqrt(math.pow(x,2)+math.pow(y,2))<=1:
h+=1
print(h/k)
|
#!/usr/bin/py#thon
# $Id$
import glob
import os
from distutils.core import setup
PACKAGE_NAME = "impacket"
setup(name = PACKAGE_NAME,
version = "0.9.13-dev",
description = "Network protocols Constructors and Dissectors",
url = "http://corelabs.coresecurity.com/index.php?module=Wiki&action=view&typ... |
from __future__ import absolute_import, unicode_literals
import six
from django import forms
from django.db import models
from django.utils.text import capfirst
from django.utils.translation import gettext_lazy as _
from mptt.models import MPTTModel
from feincms.content.application.models import ApplicationContent
fr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
import datetime
from os.path import join, dirname, abspath
import repogen
from pelican.plugins import webassets
import pelican.themes.webosbrew
AUTHOR = 'webOS Homebrew Project'
SITENAME = 'webOS Homebrew Project'
SITEURL = ''
THEME = 'webosbrew'
THEME_STATIC_PATHS = [... |
import numpy as np
import tensorflow as tf
from rltools.rltools import tfutil
from rltools.rltools import util
TINY = 1e-10
class Distribution(object):
@property
def dim(self):
raise NotImplementedError()
def kl(self, old, new):
raise NotImplementedError()
def log_density(self, di... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-10-22 16:54
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migratio... |
from flask import current_app
def add_to_index(index, model):
if not current_app.elasticsearch:
return
payload = {}
for field in model.__searchable__:
payload[field] = getattr(model, field)
current_app.elasticsearch.index(index=index, doc_type=index, id=model.id,
... |
#!/usr/bin/env python3
###############################################################################
# Copyright 2017 The Apollo 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... |
def register_com_class(classobj):
import win32com.server.register
win32com.server.register.UseCommandLine(classobj)
def raise_com_exception(e):
from win32com.server.exception import COMException
raise COMException(desc="ppf error : \""+str(e)+"\"", scode=0x80040201)
def retrieve(module, server, tag, what):
... |
"""Programme qui inteprète les fichier donné"""
import tokenizer
import muparser as parser
import sys
def main(text:str):
tokens = tokenizer.tokenize(text)
return parser.parse(tokens)
if __name__=="__main__":
if len(sys.argv)==1:
p=input("Enter file to execute:")
else:
p=sys.argv[1]
f=open(p,"r... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 19 14:34:30 2019
@author: m
"""
from matplotlib import pyplot as plt
# pairs = [ [ [ 0, 0 ], [ 0.4, 0 ] ], [ [ 0.2, 0.16666666666666666 ], [ 0.6000000000000001, 0.16666666666666666 ] ], [ [ 0.2, 0.3333333333333333 ], [ 0.6000000000000001, 0.33333... |
# Copyright (c) 2016 Reduxio Systems
# 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 requi... |
import unittest
from binary_search_leetcode_704.binary_search import Solution
class TestSearch(unittest.TestCase):
def setUp(self) -> None:
self.solution = Solution()
self.data_1 = [-1, 0, 3, 5, 9, 12]
self.data_2 = [-1, 0, 3, 5, 9, 12]
def test_search(self):
self.assertEqua... |
from unittest import TestCase
from mock import Mock, patch, call
from samtranslator.public.sdk.resource import SamResource, SamResourceType
from samtranslator.public.exceptions import InvalidEventException, InvalidResourceException, InvalidDocumentException
from samtranslator.plugins.api.implicit_rest_api_plugin impor... |
from voluptuous import *
from . import settings
### Schema information ###
def aliases(**kwargs):
# This setting is used by the alias filtertype and is required
return { Required('aliases'): Any(str, [str], unicode, [unicode]) }
def allocation_type(**kwargs):
return { Optional('allocation_type', default=... |
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
# Copyright (C) 2016-2020 German Aerospace Center (DLR) and others.
# SUMOPy module
# Copyright (C) 2012-2017 University of Bologna - DICAM
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public ... |
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect
from .models import User, Token
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth import login, logout
from django.contrib.auth import authenticate
from django.core import signing
import time
impo... |
from django.contrib.auth.models import User
from django.test import TestCase
from django.urls import reverse
from boards.models import Board, Post, Topic
from boards.views import PostUpdateView
class PostUpdateViewTestCase(TestCase):
def setUp(self):
self.board = Board.objects.create(name='Django', descr... |
# Copyright 2020 The Nomulus 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 required by applicable... |
# Copyright (c) 2021 PranithChowdary. All rights reserved.
#
# Google Kick Start 2021 Round C - Problem D. Binary Operator
# https://codingcompetitions.withgoogle.com/kickstart/round/0000000000435c44/00000000007ec290
#
# Time: O(N * E^2)
# Space: O(N * E^2)
#
from random import seed, randint
def hash(lookup, x, y):
... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Daniel and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class Epp(Document):
pass
|
# Generated by Django 2.2.9 on 2020-01-21 01:27
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0003_auto_20200121_1017'),
]
operations = [
migrations.RenameField(
model_name='user',
old_name='avartar',
... |
# 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)
from spack import *
class PkgConfig(AutotoolsPackage):
"""pkg-config is a helper tool used when compiling applicatio... |
from flask import Flask, jsonify, request
from flask_jwt_extended import JWTManager, jwt_required, \
create_access_token, get_jwt_identity
app = Flask(__name__)
app.secret_key = 'super-secret' # Change this!
# Setup the Flask-JWT-Extended extension
jwt = JWTManager(app)
# This is a simple example of a complex ... |
from mpi4py import MPI
import mpiunittest as unittest
import sys
datatypes_c = [
MPI.CHAR, MPI.WCHAR,
MPI.SIGNED_CHAR, MPI.SHORT, MPI.INT, MPI.LONG,
MPI.UNSIGNED_CHAR, MPI.UNSIGNED_SHORT, MPI.UNSIGNED, MPI.UNSIGNED_LONG,
MPI.LONG_LONG, MPI.UNSIGNED_LONG_LONG,
MPI.FLOAT, MPI.DOUBLE, MPI.LONG_DOUBLE,
]
datatypes_c99 = [... |
from django.db import models
from django.db.models.deletion import CASCADE
from django.db.models.fields import BooleanField
import uuid
from oauth2_provider.models import AbstractApplication
from apps.users.models import User
# Create your models here.
class App(AbstractApplication):
id = models.CharField(max_le... |
from flask import Flask, render_template, request, redirect, url_for
import base64
import re
import numpy as np
from io import BytesIO
from tkinter import *
from PIL import Image, ImageTk
import time
import threading
import cv2
import os
from sklearn.model_selection import train_test_split
import matplotl... |
from __future__ import print_function
import os.path
from binding import LLVM_VERSION
above_33 = ("MC")
last_mtime = 0
def _init(root=__name__, file=__file__):
"""
This is reimported in everything subpackages and must be run in the
__init__.py of them.
"""
global last_mtime
base = os.path.di... |
import cv2 # type: ignore
import numpy as np
def extract_frame_of_movie(tiff_movie, frame_number, output_file):
"""Extract a certain frame of tiff_movie, and write it into a separate file. Used for testing find_frame_of_image
Args:
tiff_movie (str): path to input
frame_number (int): which frame to extract
Rai... |
from enum import Enum
from json import JSONEncoder
from typing import Any
from strips_hgn.features import AbstractFeatureMapper
class MetricsEncoder(JSONEncoder):
""" For encoding evaluation metrics """
def default(self, o: Any) -> Any:
if isinstance(o, Enum):
return o.value
else... |
import grpc
import time
from ..utils.log import get_logger
from .stubs import daemon_pb2
from .stubs import daemon_pb2_grpc
logger = get_logger('communication')
class RemoteError(Exception):
pass
COMMANDS = {
'DRYRUN': daemon_pb2.Command.CommandType.DRYRUN,
'TEST': daemon_pb2.Command.CommandType.TEST,
... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-10-28 23:46
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main_app', '0002_lineitem'),
]
operations = [
migrations.AddField(
... |
#!/usr/bin/env python
#
# Copyright 2018 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 applic... |
# -*- coding: utf-8 -*-
# encoding: utf-8
from __future__ import unicode_literals
import frappe, json
from frappe.utils import get_url, fmt_money, month_diff
from frappe.model.mapper import get_mapped_doc
from one_fm.api.notification import create_notification_log
from frappe.modules import scrub
from frappe import _
f... |
#!/usr/bin/python
#-*- coding: utf-8 -*-
#===========================================================
# File Name: paris6k_dataset.py
# Author: Xu Zhang, Columbia University
# Creation Date: 09-26-2017
# Last Modified: Sat Mar 2 20:52:27 2019
#
# Description: Paris 6K dataset
#
# Copyright (C) 2018 Xu Zhang
# ... |
#!/usr/bin/env python
import sys
import os
import math
# ensure that the kicad-footprint-generator directory is available
#sys.path.append(os.environ.get('KIFOOTPRINTGENERATOR')) # enable package import from parent directory
#sys.path.append("D:\hardware\KiCAD\kicad-footprint-generator") # enable package import fro... |
# config.py
import os
import multiprocessing
debug = True
loglevel = 'debug'
bind = "0.0.0.0:9099"
pidfile = "log/gunicorn.pid"
accesslog = "log/access.log"
errorlog = "log/debug.log"
daemon = False
workers = multiprocessing.cpu_count()
x_forwarded_for_header = 'X-FORWARDED-FOR'
|
#Tests proper handling of a MeritRemoval where one Element is already archived.
#Types.
from typing import Dict, IO, Any
#PartialMeritRemoval class.
from e2e.Classes.Consensus.MeritRemoval import PartialMeritRemoval
#TestError Exception.
from e2e.Tests.Errors import TestError
#Meros classes.
from e2e.Meros.Meros im... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.utils.timezone import utc
import datetime
class Migration(migrations.Migration):
dependencies = [
('events', '0008_auto_20150813_1529'),
]
operations = [
migrations.AddFi... |
"""`plot_axon_map`, `plot_implant_on_axon_map`"""
# https://stackoverflow.com/questions/21784641/installation-issue-with-matplotlib-python
from sys import platform
import matplotlib as mpl
if platform == "darwin": # OS X
mpl.use('TkAgg')
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import pat... |
import os
use_gpu = True
if use_gpu:
os.environ['CUDA_VISIBLE_DEVICES']= '0' # using GPU 0
else:
os.environ['CUDA_VISIBLE_DEVICES']= '-1' # using only CPU
import tensorflow as tf
import tensorflow.contrib.slim as slim
from tensorflow.python.ops import control_flow_ops
from tf_extended import tf_utils
from... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import json
import warnings
import pulumi
import pulumi.runtime
from typing import Union
from .. import utilities, tables
__config__ =... |
import copy
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils.weight_norm import WeightNorm
from util import box_ops
from util.misc import (NestedTensor, nested_tensor_from_tensor_list,
accuracy, get_world_size, is_dist_avail_and_initialized, inve... |
"""Defines the classes that manages job execution metrics"""
from __future__ import unicode_literals
import datetime
import logging
from collections import namedtuple
from job.execution.configuration.json.exe_config import ExecutionConfiguration
from job.execution.job_exe import RunningJobExecution
from job.models im... |
# 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 ... |
# Generated by Django 2.2.17 on 2021-01-20 20:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gestionTomaDatos', '0008_auto_20210120_1903'),
]
operations = [
migrations.CreateModel(
name='AdqData_EEG_Protocolo',
... |
import click
from click_repl import register_repl
class CmdGlobal(object):
def __init__(self):
self.current_resource_type = None
self.current_resource = None
def __str__(self):
return u'CmdGlobal(current_resource_type={}, current_resource={})'.format(self.current_resource_type, self.c... |
# 5.3
alien_color = 'green'
if alien_color == 'green':
print('You win 5 points !')
# 5.4
if alien_color == 'green':
print('You win 5 points !')
else:
print('You win 10 points !')
# 5.5
if alien_color == 'green':
print('You win 5 points !')
elif alien_color == 'yellow':
print('You win 10 points !')... |
# Copyright (c) 2017-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 data_importers.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = "MAI"
addresses_name = (
"2021-03-23T12:00:12.575638/Maidstone Democracy_Club__06May2021.tsv"
)
stations_name = "2021-03-23T12:00:12.575638/Maidston... |
#!/usr/bin/env python
# coding: utf-8
from __future__ import absolute_import, division, print_function
import json
import logging
import math
import os
import random
import warnings
from multiprocessing import cpu_count
from dataclasses import asdict
import numpy as np
from scipy.stats import mode, pearsonr
from sk... |
#!/usr/bin/env python3
import json
import os
import fire
import numpy as np
import tensorflow as tf
import encoder
import model
import sample
def interact_model(
model_name='345M',
seed=None,
nsamples=1,
batch_size=1,
length=None,
temperature=1,
top_k=0,
... |
#!/usr/bin/env python3
import logging
from discord import Intents
from discord.ext.commands import Bot, Context, check, when_mentioned_or
from config import CONFIG
from utils.utils import is_compsoc_exec_in_guild
DESCRIPTION = """
Apollo is the Discord bot for the University of Warwick Computing Society, designed to... |
# Generated by Django 3.2 on 2021-05-18 14:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('django_api', '0020_auto_20210518_1332'),
]
operations = [
migrations.AddField(
model_name='ane',
name='hasInd',
... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'instagram_clone.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
rais... |
def for_W():
for row in range(6):
for col in range(5):
if (col==0 or col==4) or ( row>2 and (row+col==5 or row-col==1)):
print("*",end=" ")
else:
print(end=" ")
print()
def while_W():
i=0
while i<6:
j=0
wh... |
import pandas as pd
import os
import logging
import yaml
import datetime
def df_to_ontology(params, staging_dir, pass_df=None):
'''
Takes the text file from staging, or the pandas df passed from the merge
app, and converts to an ontology dictionary suitable from the annotation
ontology API add_annotat... |
# Copyright (c) 2011, 2012 Nicira, 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 to... |
"""
MX Platform API
The MX Platform API is a powerful, fully-featured API designed to make aggregating and enhancing financial data easy and reliable. It can seamlessly connect your app or website to tens of thousands of financial institutions. # noqa: E501
The version of the OpenAPI document: 0.1.0
... |
'''
views.py: part of expfactory package
Copyright (c) 2017, Vanessa Sochat
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this... |
import gym
import numpy as np
import cv2
from gym import spaces
def line_intersection(line1, line2):
# calculate the intersection point
xdiff = (line1[0][0] - line1[1][0], line2[0][0] - line2[1][0])
ydiff = (line1[0][1] - line1[1][1], line2[0]
[1] - line2[1][1]) # Typo was here
def det(a, b):
... |
import re
class OpenStackConnectionMock:
"""
OpenStackConnectionMock is a mock class for the openstack.connection.Connection class.
It is used to avoid making real calls to the OpenStack API while running unit and integration tests.
Right now, only a few OpenStack APIs are supported and return realist... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.