text stringlengths 1 927k |
|---|
from autograd import grad
import autograd.numpy as np
from scipy.stats import logistic, norm
from scipy.optimize import minimize
def logistic_pdf(x, loc, scale):
y = (x - loc)/scale
return np.exp(-y)/(scale * (1 + np.exp(-y))**2)
def logistic_cdf(x, loc, scale):
y = (x-loc)/scale
if y < -100:
... |
from proxy_parse import ProxyParser
from proxy_parse.spiders import HideMySpider
def test_proxy_parser():
proxy_parser = ProxyParser(scrapy_spiders=[HideMySpider])
result = proxy_parser.parse()
assert type(result) is list
assert all(type(proxy) is str and ":" in proxy for proxy in result) |
from rest_framework import serializers
from db.models.repos import CodeReference
class CodeReferenceSerializer(serializers.ModelSerializer):
class Meta:
model = CodeReference
exclude = ['created_at', 'updated_at'] |
"""Client-side implementations of the Jupyter protocol"""
from ._version import version_info, __version__, protocol_version_info, protocol_version
from .connect import *
from .launcher import *
from .client import KernelClient
from .manager import KernelManager, AsyncKernelManager, run_kernel
from .blocking import Blo... |
from som.primitives.primitives import Primitives
from som.vmobjects.primitive import UnaryPrimitive
def _holder(rcvr):
return rcvr.get_holder()
def _signature(rcvr):
return rcvr.get_signature()
class InvokablePrimitivesBase(Primitives):
def install_primitives(self):
self._install_instance_prim... |
# Arquivo utilizado até a aula 3, quando então passamos a utilizar a classe
# ExtratorURL no arquivo extrator_url.py
url = "bytebank.com/cambio?quantidade=100&moedaOrigem=real&moedaDestino=dolar"
# Sanitização da URL
url = url.strip()
# Validação da URL
if url == "":
raise ValueError("A URL está vazia")
# Separa... |
# (c) Continuum Analytics, Inc. / http://continuum.io
# All Rights Reserved
#
# conda is distributed under the terms of the BSD 3-clause license.
# Consult LICENSE.txt or http://opensource.org/licenses/BSD-3-Clause.
'''conda is a tool for managing environments and packages.
conda provides the following commands:
... |
# Copyright The OpenTelemetry 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 or agree... |
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.16.7
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class IssueLabelsOption(object):
"""NOTE: This class ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 5/15/20 4:49 PM
# @File : grover.py
# qubit number=4
# total number=45
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
#thatsNoCode
from cirq.contrib.svg import SVGCircuit
# Symbols for... |
import zeeguu.core
from zeeguu.core.sql.learner.words import words_not_studied, learned_words
from ._common_api_parameters import _get_student_cohort_and_period_from_POST_params
from .. import api, json_result, with_session
db = zeeguu.core.db
@api.route("/student_words_not_studied", methods=["POST"])
@with_session
... |
from reliability.Reliability_testing import one_sample_proportion
result = one_sample_proportion(trials=30, successes=29)
print(result)
'''
(0.8278305443665873, 0.9991564290733695)
''' |
import cv2
import binascii
from randcam import RandCam
with RandCam(0, True) as rc:
result, random = rc.seed()
while True:
result, image = rc.feed.read()
cv2.imshow('Captured Image', image)
key = cv2.waitKey(1)
# 'S' key - reseed
if key == ord('s'):
result,... |
import requests
import pandas as pd
from plotnine import *
import json
import time
from fpdf import FPDF
from datetime import datetime
# change pandas display options
pd.options.display.max_columns = 101
pd.options.display.max_rows = 200
pd.options.display.precision = 7
# get aemet and home information
last_day = {
... |
from abc import ABC, abstractmethod
# abstract class
class FlyBehavior(ABC):
@staticmethod
@abstractmethod
def fly():
pass
# Concrete implementations
class FlyWithWings(FlyBehavior):
@staticmethod
def fly():
print("I'm flying!!")
class FlyNoWay(FlyBehavior):
@staticmethod
... |
# Generated by Django 2.2.5 on 2020-02-04 21:51
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... |
"""Text wrapping and filling.
"""
# Copyright (C) 1999-2001 Gregory P. Ward.
# Copyright (C) 2002, 2003 Python Software Foundation.
# Written by Greg Ward <gward@python.net>
import re
__all__ = ['TextWrapper', 'wrap', 'fill', 'dedent', 'indent', 'shorten']
# Hardcode the recognized whitespace characters to the US-A... |
# game2d.py
# Walker M. White (wmw2)
# November 14, 2015
"""Module to provide simple 2D game support.
This module provides all of the classes that are to use (or subclass) to create your game.
DO NOT MODIFY THE CODE IN THIS FILE. See the online documentation in Assignment 7 for
more guidance. It includes informati... |
# Copyright (c) 2018-2021, NVIDIA Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of condit... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Dan Klein, Itay Marom
Cisco Systems, Inc.
Copyright (c) 2015-2015 Cisco Systems, 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://ww... |
load("//tools/bzl:maven_jar.bzl", "maven_jar")
SHIBBOLETH = "https://build.shibboleth.net/nexus/content/repositories/releases/"
OPENSAML_VERSION = "3.4.3"
PAC4J_VERSION = "3.8.0"
def external_plugin_deps():
# Transitive dependency of velocity
maven_jar(
name = "commons-collections",
artifact... |
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
SECRET_KEY = os.environ['S... |
from turtle import Turtle
import random
COLORS = ['red', 'orange', 'yellow', 'green', 'blue', 'purple']
STARTING_MOVE_DISTANCE = 5
MOVE_INCREMENT = 10
class CarManager:
def __init__(self):
self.all_cars = []
self.car_speed = STARTING_MOVE_DISTANCE
def create_car(self):
random_chance... |
# Copyright 2017 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... |
from nltk.tokenize import RegexpTokenizer
# from stop_words import get_stop_words
from nltk.stem.porter import PorterStemmer
from string import punctuation
import re
from nltk.corpus import stopwords
en_stop = stopwords.words('english')
from nltk.corpus import wordnet
import html
from common.commons import *
CODE_PATH... |
#This is a parser to generate control flow of a SystemC design from its extracted run-time information by GDB and present it in XML or txt format.
#Copyright (c) 2019 Group of Computer Architecture, university of Bremen. All Rights Reserved.
#Filename: ControlFlowGenerator.py
#Version 1 09-July-2019
# -- coding: utf-8... |
'''tzinfo timezone information for America/Moncton.'''
from pytz.tzinfo import DstTzInfo
from pytz.tzinfo import memorized_datetime as d
from pytz.tzinfo import memorized_ttinfo as i
class Moncton(DstTzInfo):
'''America/Moncton timezone definition. See datetime.tzinfo for details'''
zone = 'America/Moncton'
... |
"""
WSGI config for ReefberryPi 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.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ReefberryPi.settings")
from djang... |
import os
import socket
from contextlib import closing
import pytest
import requests
from fastapi import BackgroundTasks
from quetz.authorization import Rules
from quetz.dao import Dao
from quetz.db_models import User
from quetz.tasks.workers import RQManager, SubprocessWorker, ThreadingWorker
@pytest.fixture
def s... |
#!/usr/bin/env python
"""An LL(1) lexer. This lexer is very tolerant of errors and can resync."""
import logging
import re
from grr.lib import utils
class Token(object):
"""A token action."""
state_regex = None
def __init__(self, state_regex, regex, actions, next_state, flags=re.I):
"""Constructor.
... |
from hw2skeleton import cluster as cl
from hw2skeleton import io
import sklearn.metrics as sk
import os
import pandas as pd
import numpy as np
import math
aa3 = "ALA CYS ASP GLU PHE GLY HIS ILE LYS LEU MET ASN PRO GLN ARG SER THR VAL TRP TYR".split()
aa_df = pd.DataFrame(0, index=list(aa3), columns=['Count'])
def cal... |
from collections import namedtuple
import inspect
import os
from ghost import Ghost
class Client(object):
def __init__(self, url=None):
if url:
self.url = url
assert self.url, "All clients must have a URL attribute"
self._attributes = self._collect_attributes()
self._c... |
def rotate90acw(matrix):
outMatrix = []
for x in range(len(matrix)):
outArray = []
for y in range(len(matrix)):
outArray.append(matrix[len(matrix)-1-y][len(matrix)-1-x])
outMatrix.append(outArray[::-1])
return outMatrix
def rotate90cw(matrix):
outMatrix... |
# Test cases for Opportunistic Wireless Encryption (OWE)
# Copyright (c) 2017, Jouni Malinen <j@w1.fi>
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import binascii
import logging
logger = logging.getLogger()
import time
import os
import struct
import hostapd
... |
from logging.config import fileConfig
from sqlalchemy import engine_from_config
from sqlalchemy import pool
from models import *
from db.base import Base
from core.config import settings
from alembic import context
from models import *
# this is the Alembic Config object, which provides
# access to the values within t... |
"""Base word embedding"""
import torch
import torch.nn as nn
import os
from bootleg.utils import logging_utils
class BaseWordEmbedding(nn.Module):
"""
Base word embedding class. We split the word embedding from the sentence encoder, similar to BERT.
Attributes:
pad_id: id of the pad word index
... |
from rest_framework import generics, views
from rest_framework.response import Response
class SomeView(views.APIView):
"""
URL: /api/someview
"""
def get(self, request, *args, **kwargs):
"""
```
{
"success": "Hello, world!"
}
```
"""
... |
# MIT License
#
# Copyright The SCons Foundation
#
# 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, modify, merge, ... |
# actions.py
from .exceptions import ParseException
from .util import col
class OnlyOnce:
"""
Wrapper for parse actions, to ensure they are only called once.
"""
def __init__(self, method_call):
from .core import _trim_arity
self.callable = _trim_arity(method_call)
self.call... |
import pickle
from py.game_logic.Game import Game
GAMES_FILE = 'db/GAMELIST.pickle'
class GameList(object):
def __init__(self):
self.games = [Game()]
def __len__(self):
return len(self.games)
def addGame(self):
self.games.append(Game())
# this turned... |
"""
Setup file for ellpy.
Use setup.cfg to configure your project.
This file was generated with PyScaffold 4.0.2.
PyScaffold helps you to put up the scaffold of your new Python project.
Learn more under: https://pyscaffold.org/
"""
from setuptools import setup
if __name__ == "__main__":
try:
... |
# 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... |
import pandas as pd
labels = pd.read_csv('../Fusion_dummy_His_MUT_joined.csv', header=0)
# line = pd.read_csv('../../Line1.csv', header=0)
line = pd.read_csv('../EC_cyclin_expression.csv', header=0)
# line['name'] = line['Proteomics_Participant_ID']
# line = line.drop(['Proteomics_Participant_ID', 'Histologic_type', ... |
"""
Read and write ZIP files.
XXX references to utf-8 need further investigation.
"""
import binascii
import importlib.util
import io
import itertools
import os
import posixpath
import shutil
import stat
import struct
import sys
import threading
import time
import contextlib
try:
import zlib # We may need its com... |
#!/ufs/guido/bin/sgi/python
# Receive live video UDP packets.
# Usage: Vreceive [port]
import sys
import struct
from socket import * # syscalls and support functions
from SOCKET import * # <sys/socket.h>
from IN import * # <netinet/in.h>
import select
import struct
import gl, GL, DEVICE
sys.path.append('/ufs/gu... |
import re
import requests
import urllib.request
import urllib3
from bs4 import BeautifulSoup
print('Beginning file download with urllib2...')
url = "https://www.aurora.nats.co.uk/htmlAIP/Publications/2020-04-09/html/eSUP/EG-eSUP-2020-017-en-GB.html"
"""Parse the given table into a beautifulsoup object"""
count = 0
ht... |
import os
from algorithms.sorting.wordle_solver import _read_file, get_best_guess, get_most_common
def test_get_most_common():
file_data = _read_file(os.path.join('algorithms', 'assets', 'wordle_answer_list.json'))
most_common_start, most_common_letters, possible_words = get_most_common(file_data)
asser... |
from torch.utils.data import Dataset
from typing import List
import bisect
import torch
import logging
import numpy as np
from tqdm import tqdm
from .. import SentenceTransformer
from ..readers.InputExample import InputExample
from multiprocessing import Pool, cpu_count
import multiprocessing
class SentenceLabelDatase... |
# coding=utf-8
from random import randint
import os
from Crypto.Cipher import AES
from base64 import b64decode
all = [
"MDAwMDAwTm93IHRoYXQgdGhlIHBhcnR5IGlzIGp1bXBpbmc=",
"MDAwMDAxV2l0aCB0aGUgYmFzcyBraWNrZWQgaW4gYW5kIHRoZSBWZWdhJ3MgYXJlIHB1bXBpbic=",
"MDAwMDAyUXVpY2sgdG8gdGhlIHBvaW50LCB0byB0aGUgcG9pbnQsIG5vIGZha2luZw==... |
import argparse
import os
import queue
import multiprocessing as mp
# import SharedArray as sa
import numpy as np
from copy import deepcopy
from time import time
from pprint import pprint
from utils.data_manipulators import *
from evolution.operators import *
from to.probabilistic_model import ProbabilisticModel
fro... |
from other_language.testing_ast.BinaryExpression import *
class Div(BinaryExpression):
def __init__(self, left: Expression, right: Expression):
super().__init__(left, right)
def eval(self):
self.left.eval() // self.right.eval() |
# tests.dataset
# Helper functions for tests that utilize downloadable datasets.
#
# Author: Benjamin Bengfort <bbengfort@districtdatalabs.com>
# Created: Thu Oct 13 19:55:53 2016 -0400
#
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: dataset.py [8f4de77] benjamin@bengfort... |
from django.shortcuts import render, redirect
from django.http import HttpResponse
from django.views import View
from .forms import TwitterForm
from .models import *
from .tasks import get_tweets
#from twython import Twython
# Create your views here.
def twitter_view(request):
if request.method == 'GET':
form = Tw... |
# -*- coding: utf-8 -*-
import mimetypes
import os
import shutil
import zipfile
from django import forms
from django.conf import settings
from django.core.cache import cache
from django.core.files.storage import default_storage as storage
import pytest
from freezegun import freeze_time
from unittest.mock import Mock... |
#!/usr/bin/env python3
import glob
import argparse
import numpy as np
import subprocess
import os
import time
import sys
#from rapvis_merge import merge_profiles, merge_gene_counts
#from rapvis_gene_dis import gene_dis
#from rapvis_quality import rRNAratio
from rapvis_general import current_time
import rapvis_rRNA
d... |
import os
import configuration
output = '/etc/fstab'
with open(output, mode='a') as fstab:
fstab.write('\n\n')
for entry in configuration.nfs_entries:
os.makedirs(entry[1], exist_ok=True)
fstab.write(entry[0].ljust(50) + entry[1].ljust(40) + 'nfs'.ljust(10) + 'noauto'.ljust(30) + '0 0\n') |
# 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
from .. import _utilities, _tables
from ... |
import socket
from frostbite_rcon_utils import create_packet, encode_packet, decode_packet, contains_complete_packet
connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
connection.settimeout(1)
connection.connect(('188.126.64.4', 47215))
connection.setblocking(1)
packet_to_send = encode_packet(create_pac... |
from sympy import Basic
from sympy.strategies.branch.traverse import top_down, sall
from sympy.strategies.branch.core import do_one, identity
def inc(x):
if isinstance(x, int):
yield x + 1
def test_top_down_easy():
expr = Basic(1, 2)
expected = Basic(2, 3)
brl = top_down(inc)
assert s... |
# qubit number=3
# total number=15
import numpy as np
from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ
import networkx as nx
from qiskit.visualization import plot_histogram
from typing import *
from pprint import pprint
from math import log2
from collectio... |
import numpy as np
import pandas as pd
from datetime import datetime
import warnings
from xray import conventions
from . import TestCase, requires_netCDF4
class TestMaskedAndScaledArray(TestCase):
def test(self):
x = conventions.MaskedAndScaledArray(np.arange(3), fill_value=0)
self.assertEqual(x.... |
class StrategyManager():
def __init__():
pass |
"""
Octave (and Matlab) code printer
The `OctaveCodePrinter` converts SymPy expressions into Octave expressions.
It uses a subset of the Octave language for Matlab compatibility.
A complete code generator, which uses `octave_code` extensively, can be found
in `sympy.utilities.codegen`. The `codegen` module can be us... |
#IMPORTAMOS LIBRERIAS.
import numpy as np
import matplotlib.pyplot as plt
import animatplot as amp
#INTRODUCIMOS DATOS.
x = np.linspace(0, 1, 50)
t = np.linspace(0, 1, 20)
X, T = np.meshgrid(x, t)
Y = np.zeros(int(51*(X+T)))
#CREAMOS OBJETO "timeline".
timeline = amp.Timeline(t, units='s', fps=60)
#GENERAMOS ANIMA... |
#
# 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 us... |
def find_exact_time(text):
"""从文本中发现确切表述的时间, 如2012-09-03 2014-07- 2014-07 2015年08月下旬 2015年08月 2015年9月17日, 并不提取表示时间段的词语, 如三月前等"""
import re
#匹配具体时间点, 如2012-09-03, 2014-07-, 2014-07, 2015年08月下旬, 2015年08月, 2015年9月17日, 03年, 2009年
time_re_1 = r'\d{2,4}[-年](?:\d{1,2})?[-月]?(?:\d{1,2})?(?:日|号|下旬|上旬|上旬|初... |
# 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 ... |
# encoding: utf-8
import warnings
from sdsstools import get_config, get_logger, get_package_version
warnings.filterwarnings(
'ignore', '.*Skipped unsupported reflection of expression-based index .*q3c.*')
NAME = 'sdssdb'
__version__ = get_package_version(path=__file__, package_name=NAME)
log = get_logger(NA... |
'''
The salt api module loader interface
'''
# Import python libs
import os
# Import Salt libs
import salt.loader
import saltapi
def netapi(opts):
'''
Return the network api functions
'''
load = salt.loader._create_loader(
opts,
'netapi',
'netapi',
base... |
import dis
import math
import os
import unittest
import sys
import ast
import _ast
import tempfile
import types
import textwrap
from test import support
from test.support import script_helper, requires_debug_ranges
from test.support.os_helper import FakePath
class TestSpecifics(unittest.TestCase):
def compile_si... |
import auditory_stream
import chainer
import visual_stream
### MODEL ###
class ResNet18(chainer.Chain):
def __init__(self):
super(ResNet18, self).__init__(
aud = auditory_stream.ResNet18(),
vis = visual_stream.ResNet18(),
fc = chainer.links.Linear(512, 5, initialW = chai... |
"""XXBDailyFresh URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/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... |
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 16 02:05:23 2022
@author: Sagi
"""
'''
Sample choice node text:
;-BLOCK-------------------------------------------------------------------------
*f20 # Label
gosub *regard_update
!sd
if %sceneskip==1 && %1020==1 skip 4
gosub *s20
mov %1020,1
skip 9
`You have already vie... |
################################################################################
# STD LIBS
import sys
# 3RD PARTY LIBS
import numpy
import pyaudio
import analyse
# USER LIBS
import notes
import timing
from constants import *
################################################################################
# Thes... |
import sys
import os
sys.path.append(os.path.abspath("../"))
from unittest import TestCase
from icon_cylance_protect.connection.connection import Connection
from icon_cylance_protect.actions.update_agent import UpdateAgent
import json
import logging
class TestUpdateAgent(TestCase):
def test_integration_update_a... |
"""
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 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modif... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2020, 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'chromium_code': 1,
},
'targets': [
{
# GN version: //ui/aura_extra
'target_name': 'aura_extra',
'type': '<(... |
# Lab 5 Logistic Regression Classifier
import tensorflow as tf
tf.set_random_seed(777) # for reproducibility
x_data = [[1, 2], [2, 3], [3, 1], [4, 3], [5, 3], [6, 2]]
y_data = [[0], [0], [0], [1], [1], [1]]
# placeholders for a tensor that will be always fed.
X = tf.placeholder(tf.float32, shape=[None, 2])
Y = tf.pl... |
import openpnm as op
import openpnm.models.physics as pm
import scipy as sp
class MeniscusTest:
def setup_class(self):
sp.random.seed(1)
self.net = op.network.Cubic(shape=[5, 1, 5], spacing=5e-5)
self.geo = op.geometry.StickAndBall(network=self.net,
... |
#!/usr/bin/python
# Copyright (c) 2020, 2022 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... |
from pathlib import Path
import panel as pn
import pandas as pd
import plotly.express as px
from models.pages import Page
from models.utils.paths import get_prepared_data_path, get_standardized_data_file
from dashboard.widgets import heatmap
PREPARED_DATA_DIR = get_prepared_data_path()
PREPARED_DATA_FILE = get_stand... |
import datetime
import json
import multiprocessing
import os
import random
import re
import time
import discum
version = 'v0.01'
config_path = 'data/config.json'
logo = f'''
###### ### ### ## ####### ### ## ## ###
## ## ## ## ## ## ## ## ## ## ## ## ## ##
## ## ## ... |
import ast
import re
import pickle
from Crypto.PublicKey import RSA
from base64 import b64decode,b64encode
from tkinter import messagebox
def str2obj(s):
return ast.literal_eval(s.replace('true', 'True').replace('false', 'False'))
def trim_name(name):
return name.replace('@','').replace('#','')
def remove_sp... |
# import modules
from gps3 import gps3
import serial
import math
import time
import csv
import os
# setup gps socket
ser = serial.Serial("/dev/ttyUSB0", 9600)
gps_socket = gps3.GPSDSocket()
data_stream = gps3.DataStream()
gps_socket.connect()
gps_socket.watch()
# read csv files
def track():
# prefix parameter
... |
#!/usr/bin/python
"""
Author: Fabio Hellmann <info@fabio-hellmann.de>
This is a layer between the raw execution unit and the database.
"""
import logging
from datetime import datetime
from . import rf_rpi
from .models import Protocol, Signal
from ..gpio import RaspberryPi3 as GPIO_PI
from app.database impor... |
#
# Copyright (C) [2020] Futurewei Technologies, Inc.
#
# FORCE-RISCV is 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
#
# THIS SOFTWARE IS PR... |
import math
from typing import Iterable, Set, List, Optional
import problog
import time
from problog.logic import And, Term
from mai_version.classification.example_partitioning import ExamplePartitioner
from mai_version.representation.TILDE_query import TILDEQuery
from mai_version.representation.example import Exampl... |
# ImageNet-CoG Benchmark
# Copyright 2021-present NAVER Corp.
# 3-Clause BSD License
import argparse
import copy
import logging
import math
import os
import shutil
import time
import optuna
import torch as th
import feature_ops
import metrics
import utils
from iterators import TorchIterator
from meters import Avera... |
'''
May 2017
@author: Burkhard A. Meier
'''
#======================
# imports
#======================
import tkinter as tk
from tkinter import ttk
# Create instance
win = tk.Tk()
# Add a title
win.title("Python GUI")
tabControl = ttk.Notebook(win) # Create Tab Control
tab1 = ttk.Frame(tabControl)... |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import functools
from ._version import VERSIONS_SUPPORTED
def check_for_unsupported_actions_types(*args, **kwargs):
client = args[0]
# this assumes the clien... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/googleads_v0/proto/resources/shared_criterion.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... |
'''
File name: pythonpractice.py
Author: Hannah Lewis
Date created: 08/03/2020
Date last modified: 08/03/2020
Python Version: 3.7
'''
import random
def main():
'''
Create a program that will play the “cows and bulls” game with the user.
'''
print("You will try to guess a random 4-digit nu... |
from django.contrib import admin
from .models import (
Category,
Game,
Thread,
ThreadImage
)
admin.site.register(Category)
admin.site.register(Game)
admin.site.register(Thread)
admin.site.register(ThreadImage) |
from pelican import readers
from pelican.readers import PelicanHTMLTranslator
from pelican import signals
from docutils import nodes
def register():
class HeaderIDPatchedPelicanHTMLTranslator(PelicanHTMLTranslator):
def depart_title(self, node):
close_tag = self.context[-1]
parent =... |
import discord
import time
import asyncio
from datetime import datetime
import time
from discord.ext import tasks, commands
from tinydb import TinyDB, Query
import re
class Events(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_guild_join(self, guild... |
"""
Components/List
===============
.. seealso::
`Material Design spec, Lists <https://material.io/components/lists>`_
.. rubric:: Lists are continuous, vertical indexes of text or images.
.. image:: https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/lists.png
:align: center
The class :... |
#!/usr/bin/env python3
# 12.04.21
# Assignment lab 04
# Master Class: Machine Learning (5MI2018)
# Faculty of Economic Science
# University of Neuchatel (Switzerland)
# Lab 4, see ML21_Exercise_4.pdf for more information
# https://github.com/RomainClaret/msc.ml.labs
# Authors:
# - Romain Claret @RomainClaret
# - Sy... |
from flask import Blueprint
bp = Blueprint('admin', __name__)
from app.admin import views |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.