text stringlengths 2 999k |
|---|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import pyrotein as pr
import givens as gv
from display import plot_dmat, plot_singular, plot_left_singular, plot_coeff
import multiprocessing as mp
from loaddata import load_xlsx, label_TMs
import colorsimple as cs
def reverse_sign(u, vh, rank, index_... |
from epanet.coordinates import Coordinates
import shapefile
from epanet.layer_base import LayerBase
class Tanks(LayerBase):
class Tank(object):
def __init__(self, id, elevation, capacity, lon, lat):
self.id = "Tank-" + str(id)
self.elevation = elevation or 0
self.capaci... |
"""
Copyright 2021 The LightSeq Team
Copyright Facebook Fairseq
We use layers from Facebook Fairseq as our baseline for unit test
"""
from typing import Dict, List, Optional, Callable
import math
from copy import deepcopy
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq import utils
fro... |
import webbrowser
from PyQt5.QtCore import *
from PyQt5.QtWebEngineWidgets import *
class WebEnginePage(QWebEnginePage):
def acceptNavigationRequest(self, url, navtype, mainframe):
return False
class Browser(QWebEngineView):
PMV_LINK_PREFIX = "pmv://"
pmv_link_clicked = pyqtSignal(str)
def ... |
#-----------------------------------------------------------------------
#
# FitnessCalcBase.py
#
# Base class for fitness calculations. Always returns 1.0 (perfect).
#
# Copyright and Distribution
#
# Part of SimplePyGA: Simple Genetic Algorithms in Python
# Copyright (c) 2016 Terry McKiernan (terry@mckiernan.co... |
"""Config flow for Somfy MyLink integration."""
import asyncio
from copy import deepcopy
import logging
from somfy_mylink_synergy import SomfyMyLinkSynergy
import voluptuous as vol
from homeassistant import config_entries, core, exceptions
from homeassistant.components.dhcp import HOSTNAME, IP_ADDRESS, MAC_ADDRESS
fr... |
# Copyright 2010 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 or agreed to in writing, ... |
from biicode.common.model.renames import Renames
from biicode.common.model.id import ID
from biicode.common.model.brl.block_cell_name import BlockCellName
from biicode.common.model.symbolic.block_version import BlockVersion
from biicode.common.model.cells import CellDeserializer
from biicode.common.utils.serializer imp... |
from django.shortcuts import render,redirect,get_object_or_404,HttpResponse
from django.db.models import Q
import datetime
from .models import Expense
# Create your views here.
def home(request):
sumincome = 0
sumexpense = 0
#for this month logic
sumincomemonth = 0
sumexpensemonth = 0
#toda... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import os, sys, glob, argparse, re, json, time
from future.builtins import (ascii, str, filter, hex, map, oct, zip)
from jinja2 import Environment, FileSystemLoader
SCRIPTPARENT = os.path.dirname(os.path.abspath(__file__))
CUR_DIR ... |
from django.test import TestCase
from .models import Image
# Create your tests here.
class ImageTestClass(TestCase):
"""
Class ImageTestClass to test the functionality and instantiation
of class Image
"""
def setUp(self):
"""
setUp method to create an instance of Image
... |
# Copyright 2012 Locaweb.
# 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 appl... |
MASTER_MODE = True
DB_HOST = 'localhost'
DB_UNAME = 'rama'
DB_PASSWORD = 'ramapradana24'
DB_PORT = 3306
DB_NAME = 'db_federated'
UNIQUE_ID = 1
SINK_ADDR = 'tcp://192.168.229.1:5558'
SECRET_KEY = 'pTbkqdQBaNxJGLWY'
IV_KEY = 'PWlUhNdDwAebzYcu'
LOG_ROW_LIMIT = 100
VEN_WORKER_ADDR = 'tcp://*:5557'
LIMIT_PROC_ROW = 0
THREAD... |
# !/usr/bin/env python
from pv_simulator import pv_simulator
from meter import meter
meter = meter()
pv_simulator = pv_simulator(meter.getChannel(), meter.getConnection())
print("creating meter values")
values = meter.createDayMeterValues() # Creates random power values for one day & writes it into an array as json e... |
r"""
Tangent-Space Automorphism Fields
The class :class:`AutomorphismField` implements fields of automorphisms of
tangent spaces to a generic (a priori not parallelizable) differentiable
manifold, while the class :class:`AutomorphismFieldParal`
is devoted to fields of automorphisms of tangent spaces to a parallelizabl... |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..resampling import WarpTimeSeriesImageMultiTransform
def test_WarpTimeSeriesImageMultiTransform_inputs():
input_map = dict(args=dict(argstr='%s',
),
dimension=dict(argstr='%d',
position=1,
usedefaul... |
# Copyright 2016 PerfKitBenchmarker 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 appli... |
import numpy as np
def SIEVE_PRIMES(x):
return x and x[:1] + SIEVE_PRIMES([n for n in x if n % x[0]])
def decompose_to_primes(max_prime):
""" Decompose number into the primes """
for prime in SIEVE_PRIMES(list(range(2, max_prime))):
if prime * prime > max_prime:
break
while m... |
class Node:
def __init__(self,key):
self.left=None
self.right=None
self.data=key
self.bf=0
self.count=1
self.parent=None
self.lkids=0
self.rkids=0
def rotateNBalance(node):
if node.bf < 0:
if node.right.bf <= 0:
rotateLeft(node... |
import datetime
from django.shortcuts import render
from django.http import HttpResponseRedirect, HttpResponse
from django.contrib.auth.decorators import login_required
from django.db import transaction
from django.forms import inlineformset_factory
from django.views import View
from django.core.paginator import Pagin... |
from StringIO import StringIO
import json
import platform
import os
import re
import time
import subprocess
import shutil
import tempfile
import functools
import pkg_resources
import OpenSSL
import zope.interface
from twisted.python import usage, log
from twisted.plugin import IPlugin
from twisted.internet import reac... |
import numpy as np
from typing import Callable
def CMAES(initialMean:np.ndarray, initialSigma:float, numIterations:int, f:Callable, params, minimize:bool):
"""
This is an implementation of the Covariance Matrix Adaptation Evolution Strategy (CMA-ES).
It is a python implementation translated from th... |
# coding=utf-8
# Copyright 2021 Google Health Research.
#
# 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 la... |
import django_filters
import netaddr
from django.core.exceptions import ValidationError
from django.db.models import Q
from netaddr.core import AddrFormatError
from dcim.models import Device, Interface, Region, Site
from extras.filters import CustomFieldFilterSet, CreatedUpdatedFilterSet
from tenancy.filters import Te... |
import json
import os
from typing import Callable, Union
import discord
from discord.embeds import Embed
from discord.ext.commands.core import command
from discord.ext.commands.errors import MissingAnyRole, MissingPermissions, MissingRole
import pyowm
import pyowm.weatherapi25.observation
import ai_m2
import random
fr... |
# -*- coding: utf-8 -*-
__version__ = '0.1.0'
import tests.test_pyugend
|
from rest_framework import status
from rest_framework.reverse import reverse
from tests.test_resource_tracker.test_api.base_test_api import BaseTestAPI
class TestTextAttributeDefinitionUpdate(BaseTestAPI):
def setUp(self):
super(TestTextAttributeDefinitionUpdate, self).setUp()
self.url = reverse... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response,RequestContext
from django.contrib.auth.decorators import login_required
from forms import PermissionListForm
from models ... |
from __future__ import print_function
import json
import numpy as np
import pandas as pd
from networkx.readwrite import json_graph
from argparse import ArgumentParser
''' To evaluate the embeddings, we run a logistic regression.
Run this script after running unsupervised training.
Baseline of using features-only can ... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: yacht/config/proto/meta.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import refl... |
import random
import string
import uuid
import cfnresponse
"""
If included in a Cloudformation build as a CustomResource, generate a random string of length
given by the 'length' parameter.
By default the character set used is upper and lowercase ascii letters plus digits.
If the 'punctuation' parameter is specified t... |
"""
This examples trains BERT for the STSbenchmark from scratch. It generates sentence embeddings
that can be compared using cosine-similarity to measure the similarity.
"""
from torch.utils.data import DataLoader
import math
from sentence_transformers import SentenceTransformer, SentencesDataset, LoggingHandler, loss... |
# -*- coding: utf-8 -*-
# Copyright 2020 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 o... |
import unittest
import sys
import os
import time
import app
from kafka_monitor.consumer import Consumer
from kafka_monitor.producer import Producer
from utils.config import Config
from utils.file import File
from kafka.admin import KafkaAdminClient
# TODO test shoudld have setUP & tearDown but ignored for simplicity... |
from models.custom_loss import Bayes_BCE_Loss_With_Logits
import torch
from tools.create_data import create_gt
x = torch.randn(256,256,256, requires_grad=True)
sigma = torch.ones(256,256,256, dtype=torch.float, requires_grad=True)
y = torch.tensor(create_gt(10531), dtype=torch.float)
loss_fn = Bayes_BCE_Loss... |
# Copyright 2018, The TensorFlow Federated Authors.
#
# 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 collections import defaultdict
from contextlib import asynccontextmanager
from dataclasses import dataclass
import itertools
import json
import logging
import typing
import cdp
import trio # type: ignore
from trio_websocket import connect_websocket_url, open_websocket_url # type: ignore
logger = logging.getLogg... |
"""Exceptions used throughout package"""
import configparser
from itertools import chain, groupby, repeat
from typing import TYPE_CHECKING, Dict, List, Optional
from pipenv.patched.notpip._vendor.pkg_resources import Distribution
from pipenv.patched.notpip._vendor.requests.models import Request, Response
if TYPE_CHE... |
import unittest
import shutil
import os
from francis import io
from francis import preprocess
from francis import split_filter
from francis import spectrogram
from francis import model_adaptor
from francis import model
class EndToEndTest(unittest.TestCase):
def setUp(self):
# change to test directory
... |
from ipywidgets import Button, Dropdown
def prev_dropdown_next(description, options, on_change):
def get_prev_next_functions(dropdown):
def on_prev(b):
dropdown.value = (dropdown.value - 1) % len(dropdown.options)
def on_next(b):
dropdown.value = (dropdown.value + 1) % len(d... |
#
# Autogenerated by Frugal Compiler (3.13.1)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
import asyncio
from datetime import timedelta
import inspect
from frugal.aio.processor import FBaseProcessor
from frugal.aio.processor import FProcessorFunction
from frugal.exceptions import TApplica... |
"""
Show how to use acceleration and friction
Artwork from http://kenney.nl
If Python and Arcade are installed, this example can be run from the command line with:
python -m arcade.examples.sprite_move_keyboard_accel
"""
import arcade
import os
SPRITE_SCALING = 0.5
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600
SCREEN_TIT... |
"""
This file was generated with the customdashboard management command and
contains the class for the main dashboard.
To activate your index dashboard add the following to your settings.py::
GRAPPELLI_INDEX_DASHBOARD = 'progile.dashboard.CustomIndexDashboard'
"""
from django.utils.translation import ugettext_laz... |
""" Artifacts used to build bazel-diff """
load("@rules_jvm_external//:specs.bzl", "maven")
BAZEL_DIFF_MAVEN_ARTIFACTS = [
maven.artifact("junit", "junit", "4.13", testonly = True),
maven.artifact("org.mockito", "mockito-core", "3.5.15", testonly = True),
"info.picocli:picocli:jar:4.3.2",
"com.google.... |
# Copyright 2021 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 applica... |
import os
from os.path import dirname, join, abspath
from dotenv import load_dotenv
# /artcase/artcase_proj
PROJECT_DIR = dirname(dirname(dirname(abspath(__file__))))
# /artcase
BASE_DIR = dirname(PROJECT_DIR)
# secret vars
dotenv_path = join(BASE_DIR, '.env')
load_dotenv(dotenv_path)
SECRET_KEY = os.environ.get("SE... |
"""
Sample entry point for the server.
"""
from txghserf.server import CONFIGURATION, resource
# Shut the linter.
resource
def handle_event(event):
"""
Custom code handling events.
"""
print event
CONFIGURATION['callback'] = handle_event
|
# Copyright (C) 2014 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... |
from inspect import getmembers
import os, os.path,time
import win32com.client as win32
excel = win32.gencache.EnsureDispatch('Excel.Application')
def print_members(obj, obj_name="placeholder_name"):
"""Print members of given COM object"""
try:
fields = list(obj._prop_map_get_.keys())
excep... |
#!/usr/bin/env python
import json
class BooksOfTheBible:
"""
Data class containing the books of the Bible and the Chapters
"""
def __init__(self, input_file):
ifile = open(input_file,'r')
rawData = ''.join(ifile.readlines())
self.data = json.loads(rawData)
def returnBooks... |
# generated by datamodel-codegen:
# filename: schema/entity/data/metrics.json
# timestamp: 2021-08-17T03:53:57+00:00
from __future__ import annotations
from typing import Optional
from pydantic import BaseModel, Field, constr
from ...type import basic, entityReference, usageDetails
class Metrics(BaseModel):
... |
"""
Scripts to import output from the DFN generator developed by Michael Welch and Mikael Lüthje at DTU.
"""
#TODO: Plot 2D representation of centre lines from fracture network
#%%
|
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from django.core.management.base import BaseCommand
from ralph_scrooge.utils.common import validate_date as valid_date
from ralph_scrooge.utils.... |
import pytest
from django.conf import settings
from django.test import RequestFactory
from nobody_will_see_this.users.tests.factories import UserFactory
@pytest.fixture(autouse=True)
def media_storage(settings, tmpdir):
settings.MEDIA_ROOT = tmpdir.strpath
@pytest.fixture
def user() -> settings.AUTH_USER_MODEL... |
#!/usr/bin/env python3
####################################################################################################################################
# A CLI Script to update list of domains instead from the UI. Can be useful for people who want to execute updates from a cronjob
#
# Tip:
# When running from a cr... |
import os
import sys
from setuptools import setup
package_basename = 'pypower'
sys.path.insert(0, os.path.join(os.path.dirname(__file__), package_basename))
import _version
version = _version.__version__
setup(name=package_basename,
version=version,
author='cosmodesi',
author_email='',
descr... |
#!/usr/bin/env python
# coding: utf-8
# # Pachyderm-Seldon Integration: Version Controlled Models
#
# [Pachyderm](https://pachyderm.io/) is a data science platform that combines Data Lineage with End-to-End Pipelines. [Seldon-Core](https://www.seldon.io/tech/products/core/) is an open-source platform for rapidly depl... |
import numpy as np
import pandas as pd
from etna.transforms import SegmentEncoderTransform
def test_segment_encoder_transform(dummy_df):
transform = SegmentEncoderTransform()
transformed_df = transform.fit_transform(dummy_df)
assert (
len(transformed_df.loc[:, pd.IndexSlice[:, "regressor_segment_... |
# Copyright 2022 The KerasTuner Authors
#
# 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 ... |
# coding: utf-8
# Copyright (c) 2010-2012 OpenStack Foundation
#
# 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... |
"""
Supervised Reptile learning and evaluation on arbitrary
datasets.
"""
import random
import tensorflow as tf
from .variables import (interpolate_vars, average_vars, subtract_vars, add_vars, scale_vars,
VariableState)
class Reptile:
"""
A meta-learning session.
Reptile can ope... |
# A tree data structure which stores a list of degrees and can quickly retrieve the min degree element,
# or modify any of the degrees, each in logarithmic time. It works by creating a binary tree with the
# given elements in the leaves, where each internal node stores the min of its two children.
import math
class... |
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 25 13:25:03 2019
@author: Yuki-F
"""
import numpy as np
import matplotlib.pyplot as plt
import scipy.signal as signal
from . import FilterSpec
from . import FIRDesign
from . import IIRDesign
from . import IO |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-08-19 17:47
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('heroquest', '0002_auto_20160819_1747'),
('armery', '0001_initial'),
]
operations = [... |
from plark_game.classes.pantherAgent import Panther_Agent
class PantherAgentTestTurn(Panther_Agent):
def __init__(self):
self.moves_taken = 0
def getAction(self, state):
# Alternately move up/down
action = 0 if self.moves_taken % 2 == 0 else 3
self.moves_taken += 1
return self.action_lookup(action)
|
import argparse
import json
import os
import pickle
import sys
import sagemaker_containers
import pandas as pd
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import torch.utils.data
from model import LSTMClassifier
from utils import review_to_words, convert_and_pad
def model_fn(mod... |
#
# test_model
#
# Copyright (c) 2011-2021 Akinori Hattori <hattya@gmail.com>
#
# SPDX-License-Identifier: MIT
#
import ayame
from ayame import model
from base import AyameTestCase
class ModelTestCase(AyameTestCase):
def test_model(self):
m = model.Model(None)
self.assertIsNone(m.object)
... |
'''
As the book states,
for a list of about ten million elements, the search times for where an item is found around the middle, are these:
Binary Search: 0.02
Linear Search: 105
list.sort() takes about 3500 for a list of ten million, which means that in order to profit from sorting and binary searching, we will need
... |
vnect_skeleton = [
# Right lower body
["PELVIS", "RIGHT_HIP"],
["RIGHT_HIP", "RIGHT_KNEE"],
["RIGHT_KNEE", "RIGHT_ANKLE"],
["RIGHT_ANKLE", "RIGHT_TOE"],
# Left lower body
["PELVIS", "LEFT_HIP"],
["LEFT_HIP", "LEFT_KNEE"],
["LEFT_KNEE", "LEFT_ANKLE"],
["LEFT_ANKLE", "LEFT_TOE"],... |
print('Digite tres valores, para saber se eles podem formar um triagulo')
v1 = float(input('Primeiro valor:'))
v2 = float(input('Segundo valor:'))
v3 = float(input('O ultimo valor'))
if v1 < v2 + v3 and v2 < v3 + v1 and v3 < v2+ v1:
print('É possivel montar um triangulo com esses valores!')
else:
print('Não é p... |
import time
from RPi import GPIO
GPIO.setmode(GPIO.BCM)
class PwmFan:
def __init__(self, pin, freq, duty_cycle):
self.pwm = None
GPIO.setup(pin, GPIO.OUT)
self.pwm = GPIO.PWM(pin, freq)
self.pwm.start(duty_cycle)
self._duty_cycle = duty_cycle
def __del__(s... |
"""
PASSENGERS
"""
numPassengers = 26643
passenger_arriving = (
(9, 7, 5, 9, 1, 5, 3, 4, 1, 2, 0, 0, 0, 5, 6, 5, 3, 4, 3, 8, 1, 3, 3, 0, 0, 0), # 0
(6, 7, 6, 5, 9, 2, 2, 1, 4, 3, 1, 1, 0, 11, 3, 5, 5, 8, 6, 1, 3, 4, 0, 2, 0, 0), # 1
(15, 7, 4, 14, 5, 2, 4, 6, 3, 0, 0, 0, 0, 7, 8, 6, 5, 4, 3, 8, 2, 3, 0, 4, 0, 0... |
#!/usr/bin/env python3
# Copyright (c) 2020 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 asmap config argument for ASN-based IP bucketing.
Verify node behaviour and debug log when launching f... |
#!/usr/bin/env python
"""
MetaWIBELE: extract_uniprot_pfam module
Extract the Pfam and UniProt mapping info
Copyright (c) 2019 Harvard School of Public Health
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... |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
# FEDERAL UNIVERSITY OF UBERLANDIA
# Faculty of Electrical Engineering
# Biomedical Engineering Lab
# ------------------------------------------------------------------------------
# Author: Italo Gustavo Sampaio Fe... |
import os
from flask import Flask, flash, request, redirect, url_for, jsonify
from werkzeug.utils import secure_filename
from flask import send_from_directory
from flask_cors import CORS, cross_origin
import json
import zipfile
from augmentations import *
from sample import *
from modelStats import *
from train import ... |
# Part of Pull Req #2 by @MaskedVirus | github.com/swatv3nub
import time
from datetime import timedelta
import requests
from pyrogram import filters
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
from wbb import app
from wbb.core.decorators.errors import capture_err
__MODULE__ = "Anime"
__HEL... |
from .error_correction_level import ErrorCorrectionLevel
from .symbol import Symbol
from .symbols import Symbols
|
import asyncio
import pytest
import dask
pytestmark = pytest.mark.gpu
ucp = pytest.importorskip("ucp")
from distributed import Client, Scheduler, wait
from distributed.comm import connect, listen, parse_address, ucx
from distributed.comm.registry import backends, get_backend
from distributed.deploy.local import Lo... |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2021, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... |
'''OpenGL extension SGIS.multisample
This module customises the behaviour of the
OpenGL.raw.GL.SGIS.multisample to provide a more
Python-friendly API
'''
from OpenGL import platform, constants, constant, arrays
from OpenGL import extensions, wrapper
from OpenGL.GL import glget
import ctypes
from OpenGL.raw.GL.SGIS.m... |
# Copyright 2016 Alethea Katherine Flowers
#
# 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... |
from django.db import models
from random import randint
from django.db.models import Count
class Class_Section(models.Model):
class Meta:
verbose_name = "Course section"
verbose_name_plural = "Sections"
DAY_CHOICES = (
('Monday', 'Monday'),
('Tuesday', 'Tuesday'),
('Wed... |
# Copyright 2017-present Open Networking Foundation
#
# 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 agr... |
import random
import time
def source_random(**kwargs):
min = kwargs.get('min', 0.0)
max = kwargs.get('max', 100.0)
digits = kwargs.get('digits', 2)
sleep = kwargs.get('sleep', 0)
time.sleep(sleep)
return round(random.uniform(min, max), digits)
|
# position/views_admin.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
from .controllers import generate_position_sorting_dates_for_election, positions_import_from_master_server, \
refresh_cached_position_info_for_election, \
refresh_positions_with_candidate_details_for_election, \
refresh... |
#!/usr/bin/env python3
from rrc_simulation.tasks import move_cube
from rrc_simulation.trifinger_platform import TriFingerPlatform
COLLISION_TOLERANCE = 3.5 * 1e-03
MU = 0.5
VIRTUAL_CUBE_HALFWIDTH = 0.0395
CUBE_WIDTH = move_cube._CUBE_WIDTH
MIN_HEIGHT = move_cube._min_height
MAX_HEIGHT = move_cube._max_height
ARENA_RAD... |
# Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.d (the "License");
# you may not use this file except in compliance with the License.
#
""" Userbot module containing commands related to android"""
import asyncio
import json
import math
import os
import r... |
import sys
import os
import re
if len(sys.argv) < 3:
print("python 'Network' '[How to insert into markdown](www.github.com/agavrel)' '{optional}Author'")
exit()
topic = sys.argv[1]
pattern = "### 0x[0-9a-f][0-9af] " + topic
filename="README.md"
s = r"cat "+ filename +" | grep -n '" + pattern + "' " + filename + " |... |
#!/usr/bin/python
# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/tools/models/buildtool/buildSBEImage.py $
#
# OpenPOWER sbe Project
#
# Contributors Listed Below - COPYRIGHT 2017
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file exce... |
# link: https://leetcode.com/problems/validate-stack-sequences/
class Solution(object):
def validateStackSequences(self, pushed, popped):
"""
:type pushed: List[int]
:type popped: List[int]
:rtype: bool
"""
stack = []
j=0
for num in pushed:
... |
"""
Django settings for demoapp11_dev_23213 project.
Generated by 'django-admin startproject' using Django 2.2.2.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
... |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2018
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... |
# Copyright 2017 The KaiJIN 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 ... |
# Helper package version.
# - v1.3.0: 2021-05-09
# - Move lib_tasks.py inside helpers
__version__ = "1.3.0"
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012-2021 Snowflake Computing Inc. All right reserved.
#
import datetime
import math
import random
from io import BytesIO
import pytest
from snowflake.connector.arrow_context import ArrowConverterContext
from snowflake.connector.cursor import SnowflakeC... |
from pathlib import Path
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torchvision.datasets as datasets
import torchvision.transforms as transforms
from ignite.contrib.handlers import TensorboardLogger
from ignite.engine import Eve... |
"""
Copyright (C) 2007 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 or agreed to in writing, softwa... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import logging
import shutil
from glob import glob
from gmprocess.subcommands.lazy_loader import LazyLoader
base = LazyLoader("base", globals(), "gmprocess.subcommands.base")
class CleanModule(base.SubcommandModule):
"""Clean (i.e., remove) project data."... |
from __future__ import print_function
import argparse
import torch.backends.cudnn as cudnn
import torch.nn.functional as F
import torch.optim as optim
import torch.utils.data.distributed
from torchvision import models
import horovod.torch as hvd
import timeit
import numpy as np
# Benchmark settings
parser = argparse.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.