content stringlengths 5 1.05M |
|---|
pkgname = "perl-test-deep"
pkgver = "1.130"
pkgrel = 0
build_style = "perl_module"
hostmakedepends = ["gmake", "perl"]
makedepends = ["perl"]
depends = ["perl"]
pkgdesc = "Extremely flexible deep comparison"
maintainer = "q66 <[email protected]>"
license = "Artistic-1.0-Perl OR GPL-1.0-or-later"
url = "https://meta... |
#流れ
#0.データの処理->prepro.shで実行、dataから必要なデータを取り出しpickle化、word2id,id2vecの処理
#1.contexts,questionsを取り出しid化
#2.dataloaderからbatchを取り出し(ただのshuffleされたid列)、それに従いbatchを作成してtorch化
#3.モデルに入れてp1,p2(スタート位置、エンド位置を出力)
#4.predictはp1,p2それぞれのargmaxを取り、それと正解の位置を比較して出力する
import warnings
warnings.filterwarnings('ignore')
import sys
sys.path.... |
# -*- coding: future_fstrings -*-
import struct
import sys
from libptmalloc.frontend import printutils as pu
from libptmalloc.ptmalloc import heap_structure as hs
class malloc_state(hs.heap_structure):
"python representation of a struct malloc_state"
# XXX - we can probably get the version directly from the ... |
import youtube_dl
import textwrap
import twitter
import json
import re
import os
import urllib.parse
import urllib.request
pathregex = re.compile("\\w{1,15}\\/(status|statuses)\\/\\d{2,20}")
generate_embed_user_agents = [
"Slackbot-LinkExpanding 1.0 (+https://api.slack.com/robots)",
"Mozilla/5.0 (Macintosh; In... |
# Custom metrics for the auto-encoder
import tensorflow as tf
# True positive on hard masks
class BinaryTP(tf.keras.metrics.Metric):
def __init__(self, name="binary_TP", **kwargs):
super(BinaryTP, self).__init__(name=name, **kwargs)
self.TP = self.add_weight(name="tp", initializer='zeros')
def ... |
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
"""MQTT Fiware Bridge
This microservice is optional for the NuvlaBox.
It takes as arguments:
- --mqtt-host: (mandatory) MQTT broker endpoint to connect to
- --mqtt-topic: (mandatory) MQTT topic to be subscribed
- --output-connector: (optional) From the available con... |
"""
Pygts: A Python Toolbox for gravity time series processing
Author: Jianing Gou([email protected])
==================================================================
Pygts is an open-source project dedicated to provide a Python framework for
processing continuous gravity time series data(such as superco... |
# coding=utf-8
from __future__ import absolute_import
import flask, pigpio
### (Don't forget to remove me)
# This is a basic skeleton for your plugin's __init__.py. You probably want to adjust the class name of your plugin
# as well as the plugin mixins it's subclassing from. This is really just a basic skeleton to ge... |
import time
import json
from pyroute2.config import kernel
from pyroute2.netlink import genlmsg
from pyroute2.netlink.generic import GenericNetlinkSocket
from pyroute2.netlink.nlsocket import Marshal
QUOTA_NL_C_UNSPEC = 0
QUOTA_NL_C_WARNING = 1
class dquotmsg(genlmsg):
prefix = 'QUOTA_NL_A_'
nla_map = (('QUOT... |
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(('0.0.0.0', 2222))
sock.listen(1)
while True:
conn, addr = sock.accept()
while True:
data = conn.recv(1024)
if not data or 'close' in data.encode('utf9').lower():
break
conn.send(data)
|
from structs import Noun
from helper import hprint, k100
import bisect
import random
import time
class Lesson:
@property
def name(self):
raise NotImplementedError
@property
def teacher(self):
raise NotImplementedError
def __init__(self, *args, **kwargs):
self.classroom =... |
# Copyright (c) 2019 Alliance for Sustainable Energy, LLC
# 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
# li... |
def first(array, element):
low = 0
high = len(array) - 1
ans = -1
while low <= high:
mid = (low + high) // 2
if array[mid] > element:
high = mid - 1
elif array[mid] < element:
low = mid + 1
else:
ans = mid
high... |
from rl.old_lib.ActionDistribution import ActionDistribution
class Policy:
"""
Selects an appropriate action.
"""
def get_action_distribution(self, state, action_space) -> ActionDistribution:
"""
Chooses one or several actions in the given action space, given an input state.
:p... |
# 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... |
import sqlite3
from sqlite3 import Connection
class SQLite:
_conn: Connection
def __init__(self, fileloc: str):
self._conn = sqlite3.connect(fileloc)
self._ensure_created()
def close(self):
self._conn.close()
def _ensure_created(self):
self._conn.exe... |
from unittest import TestCase
import psycopg2
from mygeocoder import Confidence, TigerGeocoder
class TigerGeocoderTests(TestCase):
"""
NOTE: Expects the geocoder database to be up and running.
"""
def setUp(self):
self.geocoder = TigerGeocoder("dbname=geocoder user=eric", raise_shared_mem_exc=... |
######################################################################
# Flat Shader
# This shader applies the given model view matrix to the vertices,
# and uses a uniform color value.
flatShader = (['''
uniform mat4 mvpMatrix;
attribute vec4 vVertex;
void main(void)
{
gl_Position = mvpMatrix * vVertex;
}'''],
[''... |
"""
Definition of views.
"""
from django.shortcuts import render
from django.http import HttpRequest
from django.template import RequestContext
from datetime import datetime
import app.models
# import random
from django.http import HttpResponse
# import getOptions
def home(request):
"""Renders the home page."""... |
#! /usr/bin/env python3
import serial
import signal
from time import sleep
import sys
from PyQt5.QtWidgets import (QApplication, QWidget, QPushButton, QSpinBox, QMessageBox)
from PyQt5.QtCore import QThread
class SerialReadThread(QThread):
def __init__(self, serial):
QThread.__init__(self)
self.s... |
import random
from abc import abstractmethod
import numpy as np
from tensorflow import keras
from constants import INDEX_RETURN_INDICATOR_NUMBER
from model.constants import FUND1_RETURN_NAME, FUND1_BENCHMARK_RETURN_NAME, \
FUND2_RETURN_NAME, FUND2_BENCHMARK_RETURN_NAME, INDEX_RETURN_NAME, MAIN_OUTPUT_NAME, AUXILI... |
# Copyright 2017 Robert Csordas. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
import pymongo
from decouple import config
from mongoengine import connect
host = config("HOST")
db = config("DB")
user = config("USERNAME")
pwd = config("PASSWORD")
conn = connect(db=db, username=user, password=pwd, host=host)
|
#!/usr/bin/env python
class AppControllerException(Exception):
"""A special Exception class that should be thrown if the user tries to
interact with an AppController, but receives a failure message back from
that AppController.
"""
pass
class AppEngineConfigException(Exception):
"""A special Exception c... |
import re
from IPython.core.debugger import Tracer; debughere=Tracer()
import logging
import threading
from paths import PATH
import subprocess
import os
import json
import datetime
from utility import eval_url
from exceptions import WrongDomainSyntax, DomainNoIp
from misc.settings import raas_dictconfig
import logging... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import, division
import glob
import sys
import os
import json
import logging
import warnings
import datetime
import io
from string import Template
from shutil import copyfile
warnings.filterwarnings("ignore")
import numpy ... |
# %%
import matplotlib.pyplot as plt
import numpy as np
from sklearn.datasets import fetch_openml, make_swiss_roll
from sklearn.decomposition import PCA, IncrementalPCA, KernelPCA
from sklearn.linear_model import LogisticRegression
from sklearn.manifold import LocallyLinearEmbedding, TSNE
from sklearn.metrics import me... |
import os
from shutil import copyfile
from typing import Dict
from models import Mentee
from environment import *
import sys
def cleanup_files():
print('Deleting submission files...')
submission_files = os.listdir(SUBMISSIONS_DIRECTORY)
for file in submission_files:
full_path = os.path.join(SUBMIS... |
#!/usr/bin/env python
# coding: utf-8
# # 명령문
# ## Assignment operator
# [Python library reference](<https//docs.python.org/reference/simple_stmts.html#assignment-statements>)
# says
#
# Assignment statements are used to (re)bind names to values and to
# modify attributes or items of mutable objects.
#
# I... |
# Python - 3.6.0
def oper_array(fct, arr, init):
r = [init]
for v in arr:
r.append(fct(r[-1], v))
return r[1:]
from math import gcd
gcdi = lambda a, b: gcd(abs(a), abs(b))
lcmu = lambda a, b: (abs(a) * abs(b)) // gcd(abs(a), abs(b))
som = lambda a, b: a + b
maxi = max
mini = min
|
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'Ui_LoginInterface.ui'
#
# Created by: PyQt5 UI code generator 5.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_LoginInterface(object):
def setupUi(self, LoginInterface)... |
"""
Summary
-------
The purpose of this script is to test the reading and writing functionality of
the `calsim_toolkit` module on HEC5Q data.
"""
# %% Import libraries.
# Import standard libraries.
import os
import sys
# Import custom libraries.
cwd = os.getcwd()
this_dir = os.path.dirname(os.path.abspath(__file__))
o... |
import unittest
import solution
class TicTacHomeworkTest(unittest.TestCase):
def test_empty(self):
b = solution.TicTacToeBoard()
empty_board = '\n -------------\n' +\
'3 | | | |\n' +\
' -------------\n' +\
'2 | | | |\n' +\
' ----------... |
import tkinter as tk
from lib import scraper
from lib import graphtransfer
from lib import yaml_editor
if __name__ == '__main__':
root = tk.Tk()
root.title('iDnes graph scraper')
# Create main containers
header = tk.Frame(root, width=450, height=50)
center = tk.Frame(root, width=50, heigh... |
from math import cos, sin, tan, tau
from reportlab.lib import pagesizes
from reportlab.lib.units import inch
from reportlab.pdfgen.canvas import Canvas
from .carddb import HSRarity
FONT_NAME = 'Times-Roman'
FONT_SIZE = 10
CAP_SIZE = 12
SC_SIZE = 10
CARDS_PER_CLASS =... |
#!~/envs/udacity_python3_mongodb
"""
Your task is to explore the data a bit more.
The first task is a fun one - find out how many unique users
have contributed to the map in this particular area!
The function process_map should return a set of unique user IDs ("uid")
"""
import xml.etree.cElementTree as et
import pp... |
from typing_extensions import NotRequired
from django.db import models
import uuid
# Create your models here.
class Voterdb(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
Voter_id= models.CharField(max_length=10)
phone = models.CharField(max_length=13)
firstn... |
import json
from src.util import Util
# Testing inputs
if __name__ == "__main__":
# Testing Place order
vals = [
b'O',
1234,
b"Claire ", # This must be 10 characters. Fill the unused characters with spaces.
b'B',
345624,
1234,
b"DAY ", # This must be... |
from sympy.ntheory.generate import Sieve, sieve
from sympy.ntheory.primetest import (
mr,
is_lucas_prp,
is_square,
is_strong_lucas_prp,
is_extra_strong_lucas_prp,
isprime,
is_euler_pseudoprime,
)
from sympy.testing.pytest import slow
def test_euler_pseudoprimes():
assert is_euler_pseu... |
import datetime
import re
import traceback
from typing import Optional, List, Any, Dict, Set, Union
import json
import os
import time
import sys
import requests
from dev_tools.github_repository import GithubRepository
GITHUB_REPO_NAME = 'cirq'
GITHUB_REPO_ORGANIZATION = 'quantumlib'
ACCESS_TOKEN_ENV_VARIABLE = 'CI... |
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name: __init__.py
Description :
Author : cat
date: 2018/1/22
-------------------------------------------------
Change Activity:
2018/1/22:
---------------------------------------------... |
from tkinter import*
import math,random,os
from tkinter import messagebox
class Bill_App:
def __init__(self, root):
self.root = root
self.root.geometry("1350x700+0+0")
self.root.title("AIMS BILL-SOFTWARE")
bg_color = "#074463"
#======= Please Enter Your Shop name.... |
# coding=utf-8
from __future__ import unicode_literals
from ..address import Provider as AddressProvider
class Provider(AddressProvider):
city_formats = ('{{city_name}}', )
street_name_formats = (
'{{first_name}}-{{last_name}}-{{street_suffix_long}}',
'{{last_name}}{{street_suffix_short}}'
... |
from decimal import Decimal
from .formed import Formed
from .formationmixin import FormationMixin
from .formationfactory import FormationFactory
class Squad(FormationFactory, Formed, FormationMixin):
def __init__(self):
FormationMixin.__init__(self)
self._attack_success = self.to_attack()
""... |
from .breed import Breed
from .dog import Dog
from .parenthood import Parenthood
from .role import Role
from .user import User
from .person import Person |
import csv
import requests
import json
str_articlesdata_csv = 'ArticlesData.csv'
str_launchesdata_csv = 'LaunchesData.csv'
str_eventsdata_csv = 'EventsData.csv'
def write_row_launches(csvWriter, article_my_id, article_api_id, data):
for d in data:
csvWriter.writerow(
[article_my_id, article_a... |
import copy
import pytest
from saleor.plugins.base_plugin import ConfigurationTypeField
from saleor.plugins.error_codes import PluginErrorCode
from saleor.plugins.manager import get_plugins_manager
from saleor.plugins.models import PluginConfiguration
from tests.api.utils import assert_no_permission, get_graphql_cont... |
import numpy as np
import pandas as pd
from sklearn.metrics import auc
def AUSUC(Acc_tr, Acc_ts):
""" Calc area under seen-unseen curve """
# Sort by X axis
X_sorted_arg = np.argsort(Acc_tr)
sorted_X = np.array(Acc_tr)[X_sorted_arg]
sorted_Y = np.array(Acc_ts)[X_sorted_arg]
# zero pad
l... |
# Generated by Django 3.1.3 on 2020-11-11 09:33
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Hospital',
fields=[
('id', models.AutoField... |
# 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, ... |
#!/usr/bin/python
#credits to http://www.devshed.com/c/a/python/ssh-with-twisted/
from twisted.internet import reactor
from twisted.web import server, resource from twisted.cred import portal, checkers from twisted.conch import manhole, manhole_ssh
class LinksPage(resource.Resource):
isLeaf = 1
def __init... |
import datetime
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
try:
from django.utils.timezone import now
except ImportError:
now = datetime.datetime.now
STATUS_CHOICES = ((0, "Placed"), (1, "Charged"),... |
import os.path
import subprocess
def FlagsForFile(filename, **kwargs):
flags = ['-std=c++14', '-I/usr/local/include', '-I.']
# Call the config script to get the directories for the Python3 interpreter
# in PATH.
py_includes = subprocess.check_output(
['python3-config', '--includes']
).deco... |
import torch
import torch.nn.functional as F
import matplotlib.pyplot as plt
from torch import nn
from torch import Tensor
from torchvision.transforms import Compose, Resize, ToTensor
from einops import rearrange, reduce, repeat
from einops.layers.torch import Rearrange, Reduce
from torchsummary import summary
# Pa... |
"""
MTG Card Quiz
(c) 2022 Matthew E Poush
"""
from collections import defaultdict
import json
import gzip
from sanitize_text import sanitize_text
class CardGenerator:
colors = {
'B': 'Black',
'G': 'Green',
'R': 'Red',
'W': 'White',
'U': 'Blue',
}
... |
from .base_buffer import *
from .replay_buffer import *
|
# /*******************************************************************************
# Copyright Intel Corporation.
# This software and the related documents are Intel copyrighted materials, and your use of them
# is governed by the express license under which they were provided to you (License).
# Unless the License pro... |
'''Meeus: Astronomical Algorithms (2nd ed.), chapter 13'''
import numpy as np
from constants import *
def local_sid(sid,lon):
'''calculation of local sidereal time from Greenwich sidereal time (in degrees)'''
return sid+lon
def ra2ha(ra,sid):
'''calculation of hour angle from RA'''
return sid-ra
de... |
from mdgen.constants import MARKDOWN_BOLD
class MarkdownBoldGenerator:
""" This class creates markdown bold text using input `text`."""
def new_bold_text(self, text: str = None):
return f"{MARKDOWN_BOLD}{text.strip()}{MARKDOWN_BOLD}"
|
# -*- coding: utf-8 -*-
from flask_restful import Api
from resources.person import PersonResource
from resources.company import CompanyResource
#Define app end points
def get_endpoints(app):
api = Api(app)
api.add_resource(PersonResource,'/people','/people/<string:username>')
api.add_resource(CompanyResou... |
from html2md.commands.Command import Command
from html2md.commands.Table import Table
class CellFeed(Command):
def __init__(self, args):
super().__init__()
self._rowspan = []
def __copy__(self):
return CellFeed(None)
def execute(self) -> str:
cell_content = super().execut... |
#coding:utf-8
import json
import os
def get_Frends_list():
k = 0
file_list=[i for i in os.listdir('./frends/') if i.endswith('json')]
frends_list=[]
for f in file_list:
try:
with open('./frends/{}'.format(f),'r',encoding='utf-8') as w:
data=w.read()[75:-4]
js=j... |
#
# 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
# ... |
# limitation :pattern count of each char to be max 1
text = "912873129"
pat = "123"
window_found = False
prev_min = 0
prev_max = 0
prev_pos = -1
lookup_tab = dict()
# detect first window formation when all characters are found
# change window whenever new character was the previous minimum
# if new window smaller t... |
class Transect:
def __init__(self, name="Transect", files=[]):
self.name = name
self.files = files
@property
def numFiles(self):
return len(self.files)
@property
def firstLastText(self):
first = self.files[0]
last = self.files[-1]
return f"{first.nam... |
import torch.nn as nn
from .transformer import TransformerBlock, TransformerBlock_AL
from .embedding import BERTEmbedding, BERTEmbedding_AL
class BERT(nn.Module):
"""
BERT model : Bidirectional Encoder Representations from Transformers.
"""
def __init__(self, vocab_size, hidden=768, n_layers=12, att... |
# -*- coding: utf-8 -*-
""" Tests for the configuration file/command-line arguments. """
# This test should be run from its directory.
# TODO A configmanager object cannot parse multiple times a config file
# and/or the command line, preventing to 'reload' a configuration.
import os
from . import config
config_fi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Simple download tool for scraping LabelPlanet.co.uk pages for label
template specifications. Can output the descriptions for use in an INX file
enum, as well as the definitions for use in the label_guides.py enxtension's
database.
Licenced under the GNU General Public ... |
import unittest
from openbadges.verifier.actions.tasks import add_task
from openbadges.verifier.tasks import task_named
from openbadges.verifier.tasks.task_types import VALIDATE_EXPECTED_NODE_CLASS
from openbadges.verifier.tasks.validation import OBClasses
class ValidateLanguagePropertyTests(unittest.TestCase):
... |
# Copyright 2022 DeepMind Technologies Limited
#
# 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 -*-
"""
Created on Thu Mar 15 09:55:13 2018
@author: Administrator
"""
import numpy as np
import tensorflow as tf
import math
class Gauss(object):
def __init__(self,u=0.0, e=1):
'''
:param u:
:param e:
'''
self.u=u
self.e=e
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from scipy.signal import deconvolve
__all__ = ['xcorr', 'levinson', 'lsf2poly', 'poly2lsf']
def xcorr(x, y=None, maxlags=None, norm='biased'):
"""Cross-correlation using np.correlate
Estimates the cross-correlation (and autocorrelation) sequenc... |
import uui
import network
from wlanstate import wlanState
import network
import machine
class WifiDialog(uui.Screen):
def __init__(self, parent, ssid, callback):
super().__init__(parent)
self.callback = callback
self.ssid = ssid
self.add(uui.TextPanel(self, b"SSID: %s" % ssid))
self.ad... |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
# Python Class 2406
# Lesson 12 Problem 1
# Author: snowapple (471208)
class Game:
def __init__(self, n):
'''__init__(n) -> Game
creates an instance of the Game class'''
if n% 2 == 0: #n has to be odd
print('Please enter an odd n!')
raise ValueError
self.n ... |
from util import reader_util, writer_util, data_util, config
from services import data_generator, solve
import data
import pprint, logging
if __name__ == '__main__':
data.init()
# Import engine subtypes
reader_util.import_engine_subtypes()
# Import removal information
data.removals_info, data.aos_cost = reader... |
# Copyright 2016 Rackspace US 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 ... |
import unittest
from rdflib import Literal
from light9.namespaces import L9
from light9.collector.device import toOutputAttrs, resolve
class TestUnknownDevice(unittest.TestCase):
def testFails(self):
self.assertRaises(NotImplementedError, toOutputAttrs, L9['bogus'], {})
class TestColorStrip(unittest.T... |
#!/usr/bin/env python
"""
Read adapter data while decoding ext2 custom fields
"""
import sys
from json import dumps
from common.utils.json_format import MessageToDict
from voltha.protos import adapter_pb2
adapter = adapter_pb2.Adapter()
binary = sys.stdin.read()
adapter.ParseFromString(binary)
print dumps(MessageToD... |
from __future__ import annotations
import enum
__all__ = ("Event",)
class Event(str, enum.Enum):
READY = "READY"
WILDCARD = "*"
CHANNEL_CREATE = "CHANNEL_CREATE"
CHANNEL_UPDATE = "CHANNEL_UPDATE"
CHANNEL_DELETE = "CHANNEL_DELETE"
CHANNEL_PINS_UPDATE = "CHANNEL_PINS_UPDATE"
THREAD_CREAT... |
from tree.elements import Node
class _Collection(Node):
_required_attributes = {"backup_set", "backup_date"}
def calculated_attributes(self):
return {'count': len(self._children)}
def append(self, event):
self._children.append(event)
def extend(self, events):
self._children.extend(events)
def... |
"""
Devops challenge
(c) 2020 - GHGSat inc.
"""
from pathlib import Path
import click
from PIL import Image
@click.command()
@click.argument("input", type=click.Path(exists=True, dir_okay=True, file_okay=False))
@click.argument("output", type=click.Path(exists=True, dir_okay=True, file_okay=False))
def main(input, ... |
# -*- coding: utf-8 -*-
# Copyright (c) 2014-2019, Camptocamp SA
# 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
#... |
import pickle
import time
import config
from utils.graphwave.graphwave import *
from utils.sparse_matrix_factorization import *
def sequence2list(filename):
graphs = dict()
with open(filename, 'r') as f:
for line in f:
walks = line.strip().split('\t')[:config.max_sequence+1]
#... |
# Copyright (c) 2021 Cristian Patrasciuc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from unittest.mock import Mock
from model.player_pair import PlayerPair
from ui.score_view import ScoreView
from ui.test_utils import GraphicUnitTest
... |
# -*- coding: utf-8 -*-
"""zfs-replicate CLI interface."""
|
"""Rotates all bodies along world z-direction by 45 degrees:
"""
from openravepy import *
import numpy
env = Environment() # create openrave environment
env.SetViewer('qtcoin') # attach viewer (optional)
env.Load('data/lab1.env.xml') # load a simple scene
Tz = matrixFromAxisAngle([0,0,numpy.pi/4])
with env:
for bo... |
import datetime as dt
import errno
import json
import os
import ntpath
import re
import shutil
import pandas as pd
import requests
import yaml
import csv
import sys
import subprocess
from teradatasql import OperationalError
from .dbutil import df_to_sql, sql_to_df
import webbrowser
import tdcsm
from pathlib import Pa... |
import plotly.offline as py
import plotly.graph_objs as go
data = [go.Bar(x=['JSON', 'XML'], y=[26.2, 77.3])]
layout = go.Layout(
title='JSON vs XML',
yaxis=dict(
title='KB',
titlefont=dict(
family='Courier New, monospace',
size=18,
color='#7f7f7f'
)... |
# coding=utf-8
"""
© 2013 LinkedIn Corp. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed t... |
import os
import sys
from pip._vendor.distlib import scripts
#specs = 'nova = novaclient.shell:main'
specs = sys.argv[1]
scripts_path = os.path.join(os.path.dirname(sys.executable), 'Scripts')
m = scripts.ScriptMaker(None, scripts_path)
m.executable = sys.executable
m.make(specs)
|
"""controlling.py controller deed module
"""
#print("module {0}".format(__name__))
import math
import time
import struct
from collections import deque
import inspect
from ....aid.sixing import *
from ....aid.odicting import odict
from ....aid import aiding, navigating, blending
from ....base import storing
from ..... |
"""Tests for fileUtils.py"""
from typing import List, Sequence
import pytest
import csv
import pandas as pd
from pathlib import Path
from nna import fileUtils
from testparams import INPUTS_OUTPUTS_PATH
IO_fileUtils_path = INPUTS_OUTPUTS_PATH / "fileUtils"
test_data_save_to_csv = [
(
(IO_fileUtils_path... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2020-02-05 08:47
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wildlifecompliance', '0416_auto_20200205_1603'),
]
... |
remoteapi_CUSTOM_ENVIRONMENT_AUTHENTICATION = ('HTTP_X_APPENGINE_INBOUND_APPID',
['test-brainstormcracy']) |
from Statistics.Stats.mean import mean
from Statistics.Stats.standard_deviation import standard_deviation
def Z_score(my_population):
mean_result = mean(my_population)
stdev_result = standard_deviation(my_population)
zscore = list()
for x in my_population:
my_score = (x - mean_result) / stdev_... |
import unittest
import carbonate.sieve
class FilterTest(unittest.TestCase):
def setUp(self):
config_file = "tests/conf/simple.conf"
config = carbonate.config.Config(config_file)
self.cluster = carbonate.cluster.Cluster(config)
def test_sieve(self):
inputs = ['metric.100',
... |
from unittest.mock import Mock, PropertyMock
import events.events # type: ignore
from systemlink.clients.tag._core._manual_reset_timer import ManualResetTimer
def MockManualResetTimer(): # noqa: N802
"""Construct a mock ManualResetTimer"""
m = Mock(ManualResetTimer)
type(m).elapsed = PropertyMock(retur... |
import numpy as np
import time
from toolbox.estimator.gcmi_estimator import copnorm, GCMIEstimator
## Check timing for entropy computation
from toolbox.estimator.linear_estimator import LinearEstimator
N = 10000 # 817
# M = 3 to 6 variables
M = 100
X = np.random.randn(M,N) # note the difference -
# the matlab code... |
# Example for "arrow functions". To run this example:
#
# python3 -m imphook -i mod_arrow_func -m example_arrow_func
f = (a, b) => a + b
print(f(1, 2))
res = ((a, b) => a + b)(3, 4)
print(res)
print(list(map((x) => x * 2, [1, 2, 3, 4])))
curry = (a) => (b) => a + b
print(curry(3)(100))
# Confirm there's no cras... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.