text stringlengths 1 927k |
|---|
import warnings
import numpy as np
import scipy as sp
from scipy import stats
import torch
import torch.nn as nn
import torch.nn.functional as F
from .. import utilities
def create_batches(features, y, batchsize):
# Create random indices to reorder datapoints
n = features.shape[0]
p = features.shape[1]
... |
#-*- coding: utf-8 -*-
import numpy as np
from sklearn.cluster import AgglomerativeClustering as sk_AgglomerativeClustering
from sklearn.externals.joblib import Memory
from .clustering import Clustering
class AgglomerativeClustering(Clustering):
"""docstring for AgglomerativeClustering."""
def __init__(self, d... |
#
# Copyright (c) 2017 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
from sysinv.puppet import openstack
from sysinv.common import constants
class SystemInventoryPuppet(openstack.OpenstackBasePuppet):
"""Class to encapsulate puppet operations for sysinv configuration"""
SERVICE_NAME = ... |
#-*- coding:utf-8 -*-
#所有encoder的基类
import copy
class Base(object):
def __init__(self, **kwargs):
pass
def embed_fun(self, text_id, name = 'base_embedding', **kwargs):
input_dict = {}
input_dict[name] = text_id
return input_dict |
import importlib
import xarray as xr
import numpy as np
import pandas as pd
import sys
from CASutils import filter_utils as filt
from CASutils import readdata_utils as read
from CASutils import calendar_utils as cal
importlib.reload(filt)
importlib.reload(read)
importlib.reload(cal)
expname=['SASK_SNOWDa_CLM5F_02.0... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2019.
#
# 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... |
import logging
import os
import argparse
from github import Github, GithubException
"""Creates new comment or updates existing comment on a PR using a PAT token"""
def create_update_comment(token, org, repo_name, pr_number, comment_body):
"""Creates or updates existing comment on a PR"""
# auth with GH token
... |
#!E:\pyproject\venv\Scripts\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==10.0.1','console_scripts','pip3'
__requires__ = 'pip==10.0.1'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(
... |
with open('input.txt') as f:
img_data = f.readline().strip()
img_w = 25
img_h = 6
layer_num_pixels = img_w * img_h
img_num_layers = len(img_data) // layer_num_pixels
print("img_num_layers = %d" % img_num_layers)
layer_data = []
for i in range(img_num_layers):
a, b = layer_num_pixels*i, layer_num_pixels*(i+1... |
from .client import Client
__author__ = ".Yo"
__title__ = "discordtxt"
__license__ = "MIT"
__version__ = "1.0.0" |
from django.conf.urls import patterns, url
from landingpage import views
urlpatterns = patterns('', url(r'^$', views.index, name='landingpage')) |
from os import listdir, system, chdir
PROJECTPATH="../atpg/"
SEARCHPATH="../atpg/work/Internet2/"
chdir(PROJECTPATH)
for f in listdir(SEARCHPATH):
if "combo" in f:
system("./atpg_internet2.py -p 10 -f i2-10.sqlite --folder ~/SDN_Project2/SDN_Project/atpg/work/Internet2/" + f + "/ > ./work/i2-10_" + f + "... |
import logging
import json
import sys
from testconfig import config
from tests.integration.core.utility_testcase import UtilityTestCase
from tests.integration.utils.test_blockdevices.test_blockdevice import TestBlockDevice
from tests.integration.utils.test_filesystems.test_filesystem import TestFileSystem
logger = lo... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-05-14 13:02
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('photo', '0002_comment_post'),
]
operations = [
migrations.RemoveField(
mo... |
#!/usr/bin/env python3
import sys
def count_characters(text):
chars = {}
for char in text:
if char not in chars:
chars[char] = 0
chars[char] += 1
counts = [False, False, False, False]
for count in chars.values():
if count < len(counts):
counts[count] = T... |
#
# 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... |
from operator import mod
from django.db import models
from django.db.models.base import Model
# Create your models here.
class Users(models.Model):
username = models.CharField(max_length=50)
phone = models.CharField(max_length=32,null=True,blank=True)
avatar = models.CharField(max_length=20)
address ... |
# Copyright 2018-2021 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the 'license' fil... |
# Copyright The PyTorch Lightning team.
#
# 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... |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Stream(_BaseTraceHierarchyType):
# maxpoints
# ---------
@property
def maxpoints(self):
"""
Sets the maximum number of points to keep on the plots from an
incoming str... |
from django.db import models
from django.contrib.auth.models import AbstractUser
from django.conf import settings
CLASSES_LIST = (
('1-A', '1-A'),
('1-B', '1-B'),
('2-A', '2-A'),
('2-B', '2-B'),
('3-A', '3-A'),
('3-B', '3-B'),
)
class User(AbstractUser):
surname = models.CharField(ma... |
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from matplotlib.ticker import PercentFormatter
data = pd.read_csv('C:\\Users\\stewue\\OneDrive - Wuersten\\Uni\\19_HS\\Masterarbeit\\Repo\\Evaluation\\RQ1_Results\\aggregated\\executiontime.csv')
totalTime = data['executionTime'] * data['parameteri... |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2021 BigML
#
# 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 ... |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
# Dictionaries are like lists except that they use keys
# instead of numbers to look up values
lst = list()
lst.append(21)
lst.append(183)
print(lst)
lst[0] = 23
print(lst)
ddd = dict()
ddd['age'] = 21
ddd['course'] = 182
print(ddd)
ddd['age'] = 23
print(ddd) |
from flask import Flask
from flask_login import LoginManager
from little_notes.ext.db.models import User
from .main import blueprint
login_manager = LoginManager()
def init_app(app: Flask):
login_manager.init_app(app=app)
login_manager.login_view = "auth.login"
@login_manager.user_loader
def load_... |
"""
Generates the default configuration for all sections.
"""
import configparser
import socket
def set_defaults():
"""
Generates the default configuration for all sections.
:return: configparser.ConfigParser object
"""
config = configparser.ConfigParser(allow_no_value=True)
common = {
... |
from math import sqrt
EPSILON = 1e-7
def dot3(a, b):
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]
def cross3(a, b):
return (a[1] * b[2] - a[2] * b[1],
a[2] * b[0] - a[0] * b[2],
a[0] * b[1] - a[1] * b[0])
def subtract3(a, b):
return (a[0] - b[0],
a[1] - b[1],
... |
from celery_app import * |
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Button, ButtonHolder, Field, Hidden, Layout, Submit
from django import forms
from django.core.exceptions import ValidationError
from django.shortcuts import get_object_or_404
from django.urls import reverse
from django.utils.safestring import ma... |
import numpy as np
import matplotlib.pyplot as plt
from scipy.spatial import voronoi_plot_2d, Voronoi, KDTree
import pandas as pd
'''
Logical intuition: cannot use linear scan because time complexity O(n^2) is far too slow for a
large list; cannot sort also for poor time complexity.
Chosen step therefore for the 2D ... |
# 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, software
# d... |
# -*- coding: utf-8 -*-
"""
Extension template for clusterers.
Purpose of this implementation template:
quick implementation of new estimators following the template
NOT a concrete class to import! This is NOT a base class or concrete class!
This is to be used as a "fill-in" coding template.
How to use th... |
from django.db import models
from django.db.models import Q
from core.models import (
choices,
DateTime,
EventField,
GivName,
SurName,
link_inc,
link_dec,
)
from person_app.person.models import Person
class Birth(EventField):
_person = models.ForeignKey(
Person,
on_del... |
# 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... |
from nets.arcface import arcface
from utils.dataloader import LFWDataset
from utils.utils_metrics import test
if __name__ == "__main__":
#--------------------------------------#
# 主干特征提取网络的选择
# mobilefacenet
# mobilenetv1
# mobilenetv2
# mobilenetv3
# iresnet50
#------------... |
from chat_service.chat_core.chat_domain import * |
from __future__ import annotations
from PySide2.QtCore import QSize, Signal
from PySide2.QtGui import QIcon, QColor
from PySide2.QtWidgets import QWidget, QPushButton, QHBoxLayout, QSizePolicy, QFrame
from bsmu.vision.widgets.combo_slider import ComboSlider
from bsmu.vision.widgets.images import icons_rc # noqa
DEF... |
from random import randint
nome = int(input('\nInsira um número de 1 a 5: '))
randomico = randint(1, 5)
if randomico == nome:
print('Você VENCEU\n')
else:
print('Você PERDEU\n') |
# intersection_of_sf.py
# This script uses Library of Congress tags,
# plus a list of volumes called "science fiction"
# by the OCLC, to extract Hathi vols likely to
# be SF. Some further manual grooming
# will be required.
import csv
from difflib import SequenceMatcher
import SonicScrewdriver as utils
def titleregu... |
# Problem: https://www.hackerrank.com/challenges/maximize-it/problem
# Score: 50
from itertools import product
k, m = map(int, input().split())
n = (list(map(int, input().split()))[1:] for _ in range(k))
results = (sum(i**2 for i in x) % m for x in product(*n))
print(max(results)) |
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 4.0.2
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
"""
The lldb module contains the public APIs for Python binding.
Some of the important classes are described here:
... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: modeldb/metadata/MetadataService.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import sym... |
mytuple = (9,8,7,5,4,1,2,3)
num = len(mytuple)
print("# of element:", num)
min_value = min(mytuple)
max_value = max(mytuple)
print("Min value:", min_value)
print("Max value:", max_value) |
# Copyright 2021 The SeqIO 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 agreed to in wr... |
"""
Django settings for config project.
Generated by 'django-admin startproject' using Django 3.2.9.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
from pathlib ... |
"""
Downloading images scrapped from the https://substance3d.adobe.com/assets/allassets
and saved in local SQLite file
"""
import os
import time
import sys
import platform
from os import path
import requests # to get image from the web
import shutil # to save it locally
from rich import pretty
from rich.console i... |
#!/usr/bin/python
#
# ==-- process-stats-dir - summarize one or more Swift -stats-output-dirs --==#
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014-2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://s... |
# flake8: noqa
from .version import __version__
from .manager_utils import (
ManagerUtilsMixin, ManagerUtilsManager, ManagerUtilsQuerySet, post_bulk_operation,
upsert, bulk_update, single, get_or_none, bulk_upsert, bulk_upsert2, id_dict, sync,
sync2
)
default_app_config = 'manager_utils.apps.ManagerUtilsCo... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... |
# 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 __future__ import absolute_import
from .Magics import * # noqa
__version__ = "1.5.7" |
# %%
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""Benchmark all the baseline agents
on a given CyberBattleSim environment and compare
them to the dumb 'random agent' baseline.
NOTE: You can run this `.py`-notebook directly from VSCode.
You can also generate a traditional Jupyter Noteboo... |
from app.api.data.query.ExerciseEvaluationMongoQueryRepository import ExerciseEvaluationMongoQueryRepository
from tests.integration.PdbMongoIntegrationTestBase import PdbMongoIntegrationTestBase
class ExerciseEvaluationMongoQueryRepositoryIntegrationTest(PdbMongoIntegrationTestBase):
def setUp(self):
sel... |
"""Config flow to configure Neato integration."""
import logging
from pybotvac import Account, Neato, Vorwerk
from pybotvac.exceptions import NeatoLoginException, NeatoRobotException
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
# pyli... |
# Generated by Django 2.0.2 on 2018-02-25 14:51
from django.db import migrations
import lists.models
class Migration(migrations.Migration):
dependencies = [
('lists', '0002_auto_20180225_1540'),
]
operations = [
migrations.AlterField(
model_name='todo',
name='due... |
for_sale_category = {
"antiques": "ata",
"appliances": "ppa",
"arts+crafts": "ara",
"atv/utv/sno": "sna",
"auto parts": "pta wta",
"baby+kids": "baa",
"barter": "bar",
"beauty+hlth": "haa",
"bikes": "bia bip",
"boats": "boo bpa",
"books": "bka",
"business": "bfa",
"ca... |
# Copyright 2020 Spotify AB
#
# 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, so... |
# -*- coding: UTF-8 -*-
import os
import argparse
import sys
import logging
import time
import numpy as np
import tensorflow as tf
import gym
import scipy.signal
import os
import time
import inspect
from utils.general import get_logger, Progbar, export_plot
from config import get_config
parser = argparse.ArgumentPars... |
import csv
import os
import glob
import time
# from astropy.coordinates import Angle
import numpy as np
import pandas as pd
import pymongo
import inspect
import json
import argparse
# import timeout_decorator
import signal
import traceback
import datetime
import pytz
from numba import jit
# import fastavro as avro
from... |
import torch
def calculate_topk_accuracy(y_pred, y, k = 4):
with torch.no_grad():
batch_size = y.shape[0]
_, top_pred = y_pred.topk(k, 1)
top_pred = top_pred.t()
correct = top_pred.eq(y.view(1, -1).expand_as(top_pred))
correct_1 = correct[:1].reshape(-1).float().sum(0, keep... |
import boto3
import requests
import unittest
import os
class HelloWorldTests(unittest.TestCase):
stack_outputs = None
def get_stack_outputs(self):
if self.stack_outputs is None:
stack_name = "python-serverless-example-{}".format(os.getenv('SERVERLESS_STAGE',
... |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import unittest
fro... |
#!/usr/bin/env python
"""
Modified by CSE to fit ASSEMBLYLINE service
"""
from pdf_id.pdfid.pdfid import cPluginParent, AddPlugin
# 2014/10/13
class cPDFiDEmbeddedFile(cPluginParent):
# onlyValidPDF = True
name = 'EmbeddedFile plugin'
def __init__(self, oPDFiD, options):
self.oPDFiD = oPDFiD
... |
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 31 12:49:38 2018
@author: suvod
"""
from main.git_log import git2repo
from main.api import api_access
import pygit2
import re
import pandas as pd
from datetime import datetime
import re, unicodedata
from pygit2 import GIT_SORT_TOPOLOGICAL, GIT_SORT_REVERSE
import os
from... |
# 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 ... |
class Solution:
def findAllRecipes(self, recipes: List[str], ingredients: List[List[str]], supplies: List[str]) -> List[str]:
supplies, recipies = set(supplies), set(recipes)
indegree = {elem:0 for elem in recipies}
graph = defaultdict(list)
for i, recipie in enumerate(recipes):
... |
# encoding: utf-8
'''Votes module handles comment and thread votes posting/models'''
import views |
# Generated by Django 2.0.3 on 2018-10-10 07:21
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='QueueLength',
fields=[
('id', models.AutoFi... |
import os
import numpy as np
import pandas as pd
import time as tm
from joblib import Parallel, delayed
from sklearn.svm import LinearSVC
from sklearn.ensemble import AdaBoostClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.... |
from easygraphics.turtle import *
def arcl(side, degree):
for i in range(degree):
fd(side)
lt(1)
def arcr(side, degree):
for i in range(degree):
fd(side)
rt(1)
def main():
create_world(800, 600)
set_speed(50)
arcr(2, 90)
arcl(2, 90)
pause()
close_w... |
from . import ProgressiveTest, skip, skipIf
from progressivis.io import CSVLoader
from progressivis.table.constant import Constant
from progressivis.table.table import Table
from progressivis.datasets import (get_dataset, get_dataset_bz2,
get_dataset_gz,
... |
#!/usr/bin/env python
###
# Copyright (c) 2002-2007 Systems in Motion
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS I... |
from math import sqrt, floor
def solution(n):
if n<3 or n>200:
return 0
else:
sum = 0
cache = []
for x in range(0, n):
temp = []
for y in range(0, n):
temp.append(-1)
cache.append(temp)
for i in ran... |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
browser = webdriver.Chrome()
browser.get("http://www.python.org")
assert "Python" in browser.title
time.sleep(1)
search_box = browser.find_element_by_name("q")
search_box.clear()
search_box.send_keys("pycon")
time.sleep(2)
searc... |
# -*- coding: utf-8 -*-
import base64
import logging
import sys
import threading
import openerp
import openerp.report
from openerp import tools
import security
_logger = logging.getLogger(__name__)
# TODO: set a maximum report number per user to avoid DOS attacks
#
# Report state:
# False -> True
self_reports... |
# -*- coding: utf-8 -*-
import glob
import os
import codecs
import math
from collections import Counter, defaultdict
from itertools import chain, cycle
import torch
import torchtext.data
from torchtext.data import Field, RawField
from torchtext.vocab import Vocab
from torchtext.data.utils import RandomShuffler
from ... |
from .task_wrappers import task, create_task, run_generation_task
from .gpu_map import bind_devices as _bind_devices, get_device
_bind_devices() |
from config import BaseConfig
import gridfs
class Userdb:
client = BaseConfig.MONGOD_DATABASE_URI
# client = MongoClient('localhost:27017')
db = BaseConfig.DB_NAME
# db = 'users'
def __init__(self, coll):
# self.db = db
self.coll = coll
def conn(self):
return self.cli... |
"""Test function argument checker on __init__
Based on test/functional/arguments.py
"""
# pylint: disable=C0111,R0903,W0231
class Class1Arg(object):
def __init__(self, first_argument):
"""one argument function"""
class Class3Arg(object):
def __init__(self, first_argument, second_argument, third_argu... |
import unittest
import rpy2.robjects as robjects
r = robjects.r
try:
import numpy
has_numpy = True
import rpy2.robjects.numpy2ri as rpyn
except:
has_numpy = False
class MissingNumpyDummyTestCase(unittest.TestCase):
def testMissingNumpy(self):
self.assertTrue(False) # numpy is missing. No ... |
#Andrew Sivaprakasam
#Purdue University
#Email: asivapr@purdue.edu
#DESCRIPTION: Code written to isolate the magnitudes of harmonics of a
#given f_0 for a given audiofile/stimulus.
#Additional Dependencies: scipy, numpy, matplotlib
# pip3 install scipy
# pip3 install numpy
# pip3 install matplotlib
#May require ffmp... |
# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial
# 4.0 International License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
# Creative Commons, PO Box 1866, Mountain ... |
"""
Django settings for IdentityAccessManager project.
"""
from os import path
PROJECT_ROOT = path.dirname(path.abspath(path.dirname(__file__)))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
HOST = {
'PROTOCOL': "http",
'IP': "192.168.1.2", #"192.168.1.68",
'PORT': 8000,
'PATH': ''
}
ALLOWED_HOSTS = (
'*... |
import feedparser
#import webbrowser
from pathlib import Path
import os
#TODO: Subscribe, Unsubscribe, any new(Requires file of last known rss, compare)?
feeds = []
cwd = os.path.realpath(os.path.join(os.getcwd(),os.path.dirname(__file__)))
def findFile(name):
return os.path.join(cwd,name)
#Does windows/linux p... |
# coding=utf-8
# Copyright 2020 The Edward2 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... |
# This file makes sure that our API has not changed. Doing so can not be accidental. Whenever it
# happens, we should bump our major build number, because we may have broken someone.
from inspect import getargspec
import sys
from conda_build import api
def test_api_config():
assert hasattr(api, 'Config')
... |
# base16-qutebrowser (https://github.com/theova/base16-qutebrowser)
# Base16 qutebrowser template by theova
# Nord scheme by arcticicestudio
base00 = "#2E3440"
base01 = "#3B4252"
base02 = "#434C5E"
base03 = "#4C566A"
base04 = "#D8DEE9"
base05 = "#E5E9F0"
base06 = "#ECEFF4"
base07 = "#8FBCBB"
base08 = "#88C0D0"
base09 ... |
# -*- coding: utf-8 -*-
#@+leo-ver=5-thin
#@+node:ekr.20031218072017.2608: * @file leoApp.py
#@@first
#@+<< imports >>
#@+node:ekr.20120219194520.10463: ** << imports >> (leoApp)
import importlib
import io
import optparse
import os
import sqlite3
import subprocess
import string
import sys
import time
import traceback
f... |
""" RLLIB SUMO Utils - SUMO Connector
Author: Lara CODECA lara.codeca@gmail.com
See:
https://github.com/lcodeca/rllibsumoutils
https://github.com/lcodeca/rllibsumodocker
for further details.
"""
import logging
import os
import sys
# Attach $SUMO_HOME/tools to the path to import SUMO libr... |
import numpy as np
from time import sleep
from shutil import rmtree
from cache_decorator import Cache
from .utils import standard_test_arrays
@Cache(
cache_path="{cache_dir}/{_hash}.npz",
cache_dir="./test_cache",
backup=False,
)
def cached_function_single(a):
sleep(2)
return np.array([1, 2, 3])
@... |
# pip install base58 / ecdsa
# tested in python 3.6.5
import os, binascii, hashlib, base58, ecdsa
def ripemd160(x):
d = hashlib.new('ripemd160')
d.update(x)
return d
for n in range(1): # number of key pairs to generate`
# generate private key, uncompressed bitcoin WIF starts with "5"
priv_key ... |
import torch
from torch.autograd import Function
class DiceCoeff(Function):
"""Dice coeff for individual examples"""
def forward(self, input, target):
self.save_for_backward(input, target)
eps = 0.0001
self.inter = torch.dot(input.view(-1), target.view(-1))
self.union = torch.... |
################################################################################
# Copyright (c) 2009 The MadGraph5_aMC@NLO Development team and Contributors
#
# This file is a part of the MadGraph5_aMC@NLO project, an application which
# automatically generates Feynman diagrams and matrix eleme... |
from objectives.results._objective_result import *
from objectives.results._add_sub_stat import add_stat_all, sub_stat_all
MAG_PWR_ADDRESS = 0x161d
add_mag_pwr = add_stat_all(MAG_PWR_ADDRESS, "mag_pwr")
sub_mag_pwr = sub_stat_all(MAG_PWR_ADDRESS, "mag_pwr")
class Field(field_result.Result):
def src(self, count):
... |
from turtle import *
peacecolors = ("blue","black", "red3", "orange", "yellow", "seagreen4", "orchid4")
reset()
Screen()
up()
shape("turtle")
resizemode("user")
shapesize(8, 8)
goto(-320, -195)
width(70)
for pcolor in peacecolors:
color(pcolor)
down()
forward(640)
up()
backward(640)
left(90)
... |
import json
import logging
import re
from typing import TYPE_CHECKING, Dict, Iterable, List, Optional, Tuple
import numpy
from openff.utilities import requires_package
from pydantic import ValidationError
from openff.recharge.esp import ESPSettings, PCMSettings
from openff.recharge.esp.storage import MoleculeESPRecor... |
from rest_framework import exceptions as rest_exceptions
from rest_framework.exceptions import ValidationError
from devproject.core import models
class APIErrorsMixin:
"""
Mixin that transforms Django and Python exceptions into rest_framework ones.
without the mixin, they return 500 status code which is ... |
# 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... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function, unicode_literals
from ...data import DataStore, ObservationFilter, EventListBase
from ...utils.testing import requires_data
def test_event_filter_types():
for method_str in Observation... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.