content stringlengths 5 1.05M |
|---|
VERSION = '0.15.1'
|
import logging
import subprocess
from os import makedirs, path, remove, symlink
from typing import Any, Dict, Optional
from tinycert import Session
from .interfaces import AbstractModule
log = logging.getLogger(__name__)
class TinyCert(AbstractModule):
def _write_file(
self,
file_path: str,
... |
import trimesh
import pocketing
import matplotlib.pyplot as plt
if __name__ == '__main__':
# load 2D geometry into polygon object
path = trimesh.load('../models/wrench.dxf')
polygon = path.polygons_full[0]
radius = .125
step = radius * 0.75
toolpath = pocketing.trochoidal.toolpath(polygon,
... |
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings.project') |
from __future__ import absolute_import
from typing import Callable, Optional
from mypy.nodes import ARG_POS, SymbolTableNode
from mypy.plugin import FunctionContext
from mypy.types import CallableType
from mypy.types import Type as MypyType
from returns.contrib.mypy._structures.args import FuncArg
from returns.contri... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# s12_clinvar_vep_stat.py
# made by Daniel Minseok Kwon
# 2020-02-10 15:29:47
#########################
import sys
import os
SVRNAME = os.uname()[1]
if "MBI" in SVRNAME.upper():
sys_path = "/Users/pcaso/bin/python_lib"
elif SVRNAME == "T7":
sys_path = "/ms1/bin/pyth... |
# 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... |
from django.views.generic import ListView, FormView
class BrowseView(ListView, FormView):
"""
Class Based view for working with changelists.
"""
def post(self, *args, **kwargs):
return self.http_method_not_allowed(*args, **kwargs)
def get_form_kwargs(self):
kwargs = {
... |
import unittest
import tempfile
import os
from pathlib import Path
from install import UpdateEnvVariablesStage
class UpdateEnvVariablesStageTest(unittest.TestCase):
def setUp(self) -> None:
self.tmp_dir = tempfile.TemporaryDirectory()
def create_file(self, path):
os.makedirs(os.path.dirname(p... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import logging
import sys
import os
import os.path
from pprint import pformat
from time import time
from shutil import copyfile
from urllib.parse import unquote
from datetime import datetime
from slcli.apis.reseplanerare3_1 import tripapi, journeydetailapi... |
# -*- coding: utf-8 -*-
import re
import json
import scrapy
from locations.items import GeojsonPointItem
from locations.hours import OpeningHours
class DesignerShoeWarehouseSpider(scrapy.Spider):
download_delay = 1
name = "dsw"
item_attributes = {"brand": "Designer Shoe Warehouse", "brand_wikidata": "Q52... |
# -*- encoding: utf-8 -*-
import time
import json
import pandas as pd
class Hmm:
def __init__(self):
self.trans_p = {'S': {}, 'B': {}, 'M': {}, 'E': {}}
self.emit_p = {'S': {}, 'B': {}, 'M': {}, 'E': {}}
self.start_p = {'S': 0, 'B': 0, 'M': 0, 'E': 0}
self.state_num = {'S': 0, 'B':... |
import time
from gpiozero import LED
class Light:
def __init__(self, pin: int) -> None:
self.led = LED(3)
def on(self):
self.led.on()
def off(self):
self.led.off()
def blink(self, loop_time= 5):
for i in range(loop_time):
self.led.toggle()
time.sl... |
import sys
import logging
import os
import json
from openvino.inference_engine import IECore, IENetwork
from OpenVINO_Config import Engine_State, Model_Flag, OpenVINO_Model_Data
from OpenVINO_Core import OpenVINO_Core
import subprocess
from pathlib import Path
import yaml
import cv2
import time
import cpuinfo
class Op... |
import io
import os
import re
from setuptools import setup
def read(*paths):
with io.open(os.path.join(*paths), encoding="utf_8") as f:
return f.read()
def find_version(*file_paths):
version_file = read(*file_paths)
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, r... |
from datetime import datetime
BASE_URL = 'http://api.stackexchange.com/2.2'
COMMON_WRAPPER_FIELDS = frozenset([
".has_more",
".items",
".quota_max",
".quota_remaining"
])
MAX_PAGE_SIZE = 100 # Limit set by stackexchange API
ANSWER_BATCH_SIZE = 100 # Limit set by stackexchange API
def augment_api_fi... |
from .get_span_row_count import get_span_row_count
def get_span_char_height(span, row_heights):
"""
Get the height of a span in the number of newlines it fills.
Parameters
----------
span : list of list of int
A list of [row, column] pairs that make up the span
row_heights : list of i... |
# -*- coding: utf-8 -*-
"""
manage
~~~~~~
Manager module
"""
from flask_script import Manager
from flask import json, current_app
from flaskproject import app
from flaskproject.core import db
from flaskproject.users.models import User
from flaskproject.entries.models import Entry, EntryCategory
from flask... |
from a2ml.api.utils.provider_runner import ProviderRunner
from a2ml.api.utils.show_result import show_result
class A2ML(object):
"""Facade to A2ML providers."""
def __init__(self, ctx, provider = None):
super(A2ML, self).__init__()
self.ctx = ctx
self.runner = ProviderRunner(ctx, prov... |
from django.contrib import admin
from .models import Manager
class ManagerAdmin(admin.ModelAdmin):
list_display = ('id', 'name', 'email')
list_display_links = ('id', 'name')
search_fields = ('name',)
list_per_page = 25
admin.site.register(Manager, ManagerAdmin)
|
import math
import pickle
import pandas
import operator
from misc import *
if len(args) < 2:
err("for numeric-only col.s of a csv, bin those quantities into modes (if applicable)" +
"\n\tcsv_bin [input file.csv]")
in_f = args[1]
if not exists(in_f):
err("could not find input file")
# input data:
lin... |
# -*- coding: utf-8 -*-
# Copyright 2015 Red Hat, 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... |
import os
import json
import maya.cmds as cmds
MAX_SIZE = 2147483647
def proxyObj(proxyName, move=None, proxyBone=None, radius=0.5):
# check name is unique
newName = proxyName
i = 1
while cmds.objExists(newName):
newName = proxyName + str(i)
i += 1
name = newName
... |
import InstallMisc
class InstallLocalState(InstallMisc.InstallMisc):
command_name = 'install_localstate'
description = "install modifiable host-specific data"
def _get_distribution_filelists(self):
return self.distribution.localstate_files
|
from datetime import datetime
from sqlalchemy import Boolean, Column, DateTime, Integer, String
from sqlalchemy.orm import relationship
from app.config import settings
from app.db.base_class import Base
from app.models.image_config import DockerImageConfig # noqa
from app.models.image_relationship import DockerImage... |
""" bou.backing
~~~
A bit of support code to locate where migrations are.
"""
import collections
import enum
import importlib
import logging
import os
import sqlite3
import sys
from bou.constants import INPUT, OUTPUT, TYPE
from bou import BouError
def create(database):
""" Create an em... |
# Noise reduction method
#
# utilizing "Gradual Release of Sensitive Data under Differential Privacy"
# by Fragkiskos Koufogiannis, Shuo Han, and George J. Pappas
# Background:
# We wish to release a function f of a private database, say D.
# The true output is a numpy array M = f(D).
# Each entry of M has "sensitivit... |
"""Template tests."""
import os
import pytest
from docknv.tests.utils import using_temporary_directory, copy_sample
from docknv.utils.ioutils import io_open
from docknv.project import Project
from docknv.template import (
MissingTemplate,
MalformedTemplate,
renderer_render_template,
)
CONFIG_DATA = "... |
from typing import Any, List, Literal, TypedDict
from .FHIR_code import FHIR_code
from .FHIR_decimal import FHIR_decimal
from .FHIR_Element import FHIR_Element
from .FHIR_string import FHIR_string
from .FHIR_uri import FHIR_uri
# A duration of time during which an organism (or a process) has existed.
FHIR_Age = Typed... |
import socket
import ast
import sys
ocp-
import build
import json
import time
class socketserver:
def __init__(self, address='', port=9090):
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.address = address
self.port = port
self.sock.bind((self.address, self.port... |
from enum import Enum
class ChoiceClasses(Enum):
logic = 1
if_to_iff = 2
or_to_and = 3
iff_to_if = 4
nothing = 5
negative_literal_premise = 6
atmospheric = 7
ignore_not = 8
anti_atmospheric = 9
not_classified = 10
class PremiseTree:
"""
Class representing premises a... |
#!/usr/bin/env python
from setuptools import setup
import os, sys, codecs
try:
# nose uses multiprocessing if available.
# but setup.py atexit fails if it's loaded too late.
# Traceback (most recent call last):
# File "...python2.6/atexit.py", line 24, in _run_exitfuncs
# func(*targs, **karg... |
import os
import numpy as np
import xarray as xr
from unittest import TestCase
from pathlib import Path
import uxarray as ux
current_path = Path(os.path.dirname(os.path.realpath(__file__)))
class TestGrid(TestCase):
def test_read_ugrid_write_exodus(self):
"""Reads a ugrid file and writes and exodus fi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from json.decoder import JSONDecodeError
import os
import pytest
from mindmeld.models.helpers import FileBackedList
def test_file_backed_list_data():
# test that the file backed list saves and retrieves data properly
test_data = [1, 2, 3, {"a": "a"}, ["1", "2", "... |
from unittest import TestCase
from pred.queries.predictionquery import PredictionQuery
QUERY_BASE = """SET search_path TO %s,public;
select
max(common_name) as common_name,
string_agg(name, '; ') as name,
case WHEN max(value) > abs(min(value)) THEN
round(max(value), 4)
ELSE
round(min(value), 4)
end as max_value,
m... |
# coding: utf-8
import os
from envparse import env
# Try to read an env file with the development
# configs
env.read_envfile()
class Production(object):
""" Production configuration """
ENVIRONMENT = "production"
SECRET_KEY = env("SECRET")
APP_DIR = os.path.abspath(os.path.dirname(__file__))
PR... |
#!/usr/bin/env python3
import unittest
from dabasco.adf.adf_graph import ADF
from dabasco.adf.adf_node import ADFNode
from dabasco.adf.import_strass import import_adf
from dabasco.dbas.dbas_import import import_dbas_graph, import_dbas_user
from os import path
import logging.config
log_file_path = path.join(path.dirn... |
import argparse
import datetime
import os
from pathlib import Path
import stat
import subprocess
import git
from git import Repo
import numpy as np
from setuptools import sandbox
default_log_dir = f"/home/{os.environ['USER']}/logs" if "USER" in os.environ else "/tmp"
if default_log_dir == "/tmp":
print("CAUTION: ... |
"""Process the raw DEMoS dataset.
This assumes the file structure from the original compressed file:
/.../
DEMOS/
NP_*.wav
PR_*.wav
NEU/
*.wav
...
"""
from pathlib import Path
import click
from ertk.dataset import resample_audio, write_annotations, write_filelist
emotion_map = {... |
import numpy as np
import cv2
from ..config import config
def get_circles(img):
final_rectangles = []
cascade = cv2.CascadeClassifier(config['CASCADE']['CascadeFile'])
new_img = img.copy()
sf = min(640. / new_img.shape[1], 480. / new_img.shape[0])
gray = cv2.resize(new_img, (0, 0), None, sf, sf)
... |
# @date 2018-08-23
# @author Frederic Scherma, All rights reserved without prejudices.
# @license Copyright (c) 2018 Dream Overflow
# Websocket connector for bitmex.com
import websocket
import threading
import traceback
import ssl
from time import sleep
import json
import decimal
from .apikeyauth import generate_nonce... |
import os
from sdc_etl_libs.sdc_data_exchange.SDCDataExchangeEndpoint import SDCDataExchangeEndpoint
from sdc_etl_libs.sdc_filetransfer.SFTPFileTransfer import SFTP
from sdc_etl_libs.aws_helpers.aws_helpers import AWSHelpers
from sdc_etl_libs.sdc_dataframe.Dataframe import Dataframe
from sdc_etl_libs.sdc_file_helpers.... |
#!/usr/bin/env python3
from time import time_ns, sleep
from threading import Thread
from .clock_abstract import ClockAbstract
class ClockInternal(ClockAbstract):
verbose = False
class _Clock(Thread):
def __init__(self, bpm: int, callback):
Thread.__init__(self)
self._bpm ... |
'''THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE
DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OT... |
import sys
import time
import win32api
if (len(sys.argv) < 4):
print "Usage: python mousemove.py dx dy speed"
sys.exit()
current = win32api.GetCursorPos()
cx = sx = current[0]
cy = sy = current[1]
mx = int(sys.argv[1])
my = int(sys.argv[2])
vx = vy = int(sys.argv[3])
print "Moving", mx, my, "with", vx, "pixels pe... |
import pickle
import argparse
import numpy as np
from vocab import Vocabulary
from gensim.models import KeyedVectors
def main(opt):
vocab = pickle.load(open(opt.vocab_path, 'rb'))
num = len(vocab)
print (num)
model = KeyedVectors.load_word2vec_format(opt.embed_weight, binary=True)
matrix_le... |
def get_template_dict() -> dict:
""" Get a template for the level.dat nbt structure.
:return: A template for level.dat.
"""
return {
'allowCommands': 1,
'BorderCenterX': 0,
'BorderCenterZ': 0,
'BorderDamagePerBlock': 0.2,
'BorderSafeZone': 5,
'BorderSize'... |
"""
https://leetcode.com/problems/backspace-string-compare/
Given two strings S and T, return if they are equal when both are typed into empty text editors. # means a backspace character.
Note that after backspacing an empty text, the text will continue empty.
Example 1:
Input: S = "ab#c", T = "ad#c"
Output: true
Ex... |
import pytest
from poetry.core.exceptions import PoetryCoreException
from poetry.core.toml import TOMLFile
from poetry.core.utils._compat import decode
def test_old_pyproject_toml_file_deprecation(
pyproject_toml, build_system_section, poetry_section
):
from poetry.core.utils.toml_file import TomlFile
w... |
import torch
from torch import nn
class RunningStats(nn.Module):
def __init__(self, shape, eps = 1e-5):
super().__init__()
shape = shape if isinstance(shape, tuple) else (shape,)
self.shape = shape
self.eps = eps
self.n = 0
self.register_buffer('old_mean', torch.ze... |
# zapp.py - Reactive data viz app template for Coda.to
__version__ = '0.1'
__all__ = ['layout', 'callback']
#import collections
#import json
import os
#import pickle
#from datetime import datetime
#from pathlib import Path
#import requests as req
import pandas as pd
import dash_core_components as dcc
import dash_html... |
"""Module that contains exceptions handled in config parsing and loading."""
import traceback
from typing import Any
class ParseError(Exception):
"""Parsing exception caused by a syntax error in INI file."""
def __init__(self, message: str, line: int = None) -> None:
super().__init__()
self.... |
"""
Unit tests for testing inheritance mixins
"""
import unittest
from unittest.mock import Mock
import ddt
from django.utils.timezone import now, timedelta
from xblock.core import XBlock
from xblock.fields import ScopeIds
from xblock.test.tools import TestRuntime
from xmodule.modulestore.inheritance import Inherit... |
'''The user module.'''
import views
import models
|
import re
import os
import time
import json
import math
import asyncio
import traceback
from io import BytesIO
from pySmartDL import SmartDL
from datetime import datetime
from pyrogram import filters, errors
from pyrogram.types import Message
from tronx import app
from tronx.helpers import (
gen,
)
app.CMD_HE... |
from setuptools import setup
setup(name="cryx4ck",
version="1.0",
description="This package is a multi text cryptograpy package.",
author="Rakib Hossain",
author_email="teamx4ck@gmail.com",
license="License",
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',... |
#!/usr/bin/env python
#
# Tests for bind configuration parsing
from leapp.libraries.common import isccfg
#
# Sample configuration stubs
#
named_conf_default = isccfg.MockConfig("""
//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as... |
# Copyright (c) 2021 PaddlePaddle 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 app... |
#
# Py-Alpha-AMD Registration Framework
# Author: Johan Ofverstedt
# Reference: Fast and Robust Symmetric Image Registration Based on Distances Combining Intensity and Spatial Information
#
# Copyright 2019 Johan Ofverstedt
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this softwa... |
import aiohttp
from logging import getLogger
logger = getLogger(__name__)
async def asyncGet(*args, **kwargs):
async with aiohttp.ClientSession() as client:
async with client.get(*args, **kwargs) as response:
if response.status == 200:
response.body = await response.read()
... |
from rest_framework import permissions
from rest_framework_simplejwt.authentication import JWTAuthentication
class IsNotAuthenticated(permissions.BasePermission):
message = 'Not accessible if authenticated.'
def has_permission(self, request, view):
return not request.user or not request.user.is_authe... |
"""
OpenVINO DL Workbench
Class for local profiling job
Copyright (c) 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
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name='fn_utilities',
version='1.0.5',
license='MIT',
author='IBM Resilient',
author_email='support@resilientsystems.com',
description="Resilient Circuits Utility Functions",
long_description="R... |
from setuptools import setup
setup(
name="saffio_core",
version="0.2.5",
description="core",
url="",
author="Ivoria Nairov",
author_email="",
license="MIT",
packages=["saffio_core"],
install_requires=[
"numpy",
"pandas",
"nltk",
"pythainlp"
],
... |
# -*- coding: utf-8 -*-
from django.test import TestCase
import io
import wave
from 臺灣言語平臺.項目模型 import 平臺項目表
from django.core.exceptions import ObjectDoesNotExist
class 項目模型試驗(TestCase):
def setUp(self):
self.外語內容 = {
'外語資料': '水母',
}
檔案 = io.BytesIO()
with wave.open(檔... |
'''
@Description:
@Author: HCQ
@Company(School): UCAS
@Date: 2020-07-16 00:38:08
@LastEditors: HCQ
@LastEditTime: 2020-07-16 13:22:49
'''
# https://blog.csdn.net/t8116189520/article/details/81874309
# post 需要传参
from flask import Flask, g
from flask_restful import reqparse, Api, Resource
from flask_httpauth import HT... |
import unittest
import os
from ibis.model.join import Join
from ibis.utilities.config_manager import ConfigManager
from ibis.settings import UNIT_TEST_ENV
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
class JoinActionFunctionsTest(unittest.TestCase):
"""Tests the functionality of the Join Action class"""... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-10-08 19:33
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('portal', '0007_auto_20171007_0031'),
... |
from sforce.api.client import JsonResource
resources_tree = {
'simple': {},
'custom_path': {'path': 'custom/'},
'custom_class': {'class': JsonResource},
'custom_class_module': {'class': 'sforce.api.client.JsonResource'},
'cascading': {'resources': {'foo':{}}},
}
|
# -*- coding: utf-8 -*-
# ======================================================================================================================
# Copyright (©) 2015-2021 LCS - Laboratoire Catalyse et Spectrochimie, Caen, France. =
# CeCILL-B FREE SOFTWARE LICENSE AGREEMENT - See ful... |
from django.db import models
class Todo(models.Model):
title = models.CharField(max_length=128, null=False)
status = models.BooleanField(default=True)
created = models.DateTimeField(auto_now_add=True, editable=False)
class Meta:
app_label = 'todo'
ordering = ('-status', '-created',)
|
# Local Imports
import re
import nltk
from nltk import PorterStemmer
from crawler.crawler_instance.constants.strings import STRINGS, ERROR_MESSAGES
from crawler.crawler_services.constants.constant import spell_check_constants
from crawler.crawler_services.helper_services.helper_method import helper_method
class spell... |
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow, QDialog, QMessageBox, QFileDialog
from PyQt5.QtCore import QSettings, QTextCodec
from demo_main_window import *
from demo_company_list import *
from demo_check_item_list import *
class mainWindow(QMainWindow, Ui_MainWindow):
def __init__(s... |
#!/usr/bin/env python
from distutils.core import setup
import pathlib
here = pathlib.Path(__file__).parent.resolve()
# Get the long description from the README file
long_description = (here / 'README.md').read_text(encoding='utf-8')
try: # Python 3.x
from distutils.command.build_py import build_py_2to3 as buil... |
from autonmt.vocabularies.bytes_vocab import BytesVocabulary
from autonmt.vocabularies.whitespace_vocab import Vocabulary
|
from x64dbgpy.utils import is_64bit
from .. import x64dbg
def Size():
return x64dbg.Size()
# x86 Registers
def GetEAX():
return x64dbg.GetEAX()
def SetEAX(value):
return x64dbg.SetEAX(value)
def GetAX():
return x64dbg.GetAX()
def SetAX(value):
return x64dbg.SetAX(value)
def GetAH():
retu... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2017-04-03 13:10
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0001_initial'),
]
operations = [
migrations.AddField(
m... |
from peewee import *
from Model.BaseModel import BaseModel
class Person(BaseModel):
id = AutoField()
nomeperson = CharField(max_length=80, unique=True)
emailperson = CharField()
dtanascimentoperson = DateField()
telefoneperson = CharField(max_length=14)
|
# Copyright 2017 FiberHome Telecommunication Technologies CO.,LTD
# 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/LI... |
from rest_framework import serializers
class TestSimpleBoundField:
def test_empty_bound_field(self):
class ExampleSerializer(serializers.Serializer):
text = serializers.CharField(max_length=100)
amount = serializers.IntegerField()
serializer = ExampleSerializer()
... |
# leetcode
class Solution:
def hammingDistance(self, x: int, y: int) -> int:
ans = 0
xor = bin(x^y)[2:]
for l in xor:
if l == '1':
ans += 1
return ans |
#!/usr/bin/env python
import logging
logger = logging.getLogger()
import argparse
import sys
import os
import string
import re
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Filters uncertainty symbols ?,* and + from MLST call files.")
parser.add_argument("-o", "--output", type=str,... |
# -*- coding: utf-8 -*-
system_proxies = None;
disable_proxies = {'http': None, 'https': None};
proxies_protocol = "http";
proxies_protocol = "socks5";
defined_proxies = {
'http': proxies_protocol+'://127.0.0.1:8888',
'https': proxies_protocol+'://127.0.0.1:8888',
};
proxies = system_proxies;
if __name_... |
#!/usr/bin/python
# sl_control.py
# display structured light patterns via OSC
# capture images via mjpeg-streamer
# requires osc_display_client
# requires mjpeg-streamer (patched for valid timestamps)
import signal, os
import cv2
import sys
import urllib
import optparse
import numpy as np
import time
from Queue impor... |
from __future__ import print_function
from logging import root
from gevent import monkey
monkey.patch_all()
import gevent
from pysoda import (
submit_dataset_progress,
bf_add_account_api_key,
bf_add_account_username,
bf_account_list,
bf_dataset_account,
bf_account_details,
bf_submit_dataset... |
#!/usr/bin/python3
"""Define User
"""
from models.base_model import BaseModel
class User(BaseModel):
"""User
Attr:
email: string - empty string
password: string - empty string
first_name: string - empty string
last_name: string - empty string
"""
em... |
"""Computing statistics from a polynomial expansions."""
from equadratures.basis import Basis
import numpy as np
from itertools import *
class Statistics(object):
"""
Compute statistics (mean, variance, skewness, kurtosis and sensitivity indices) of an orthogonal polynomial defined via parameters, a basis and ... |
import numpy as np
def sigmoid(z):
""" z: vector / Numpy array --> Ham se ap dung tren toan cac phan tu --> Vectorized form """
return 1.0 / (1.0 + np.exp(-z))
|
# BS mark.1-55
# /* coding: utf-8 */
# BlackSmith plugin
# macrokill_plugin.py
# Coded by: WitcherGeralt (WitcherGeralt@jabber.ru)
# http://witcher-team.ucoz.ru/
def handler_set_botnick(type, source, body):
if source[1] in GROUPCHATS:
if body:
nick = replace_all(body, {' ': '_', '"': '', "'": ''})
if len(... |
def test_double_index_event(deployed_logs_events, blockchain_client):
"""
This is a really week test but I'm not sure what to test yet.
"""
txn_a_hash = deployed_logs_events.logDoubleIndex('test-key-a', 'test-key-b', 'test-val_a', 12345)
txn_b_hash = deployed_logs_events.logSingleIndex('test-key-a... |
from .models import *
from .deprecated.wikidump_io import *
from .deprecated.table_parser import *
from .deprecated.rdd_datasets import *
from .misc import *
|
'''Trains a simple convnet on the permuted MNIST dataset.
Gets to 99.25% test accuracy after 12 epochs
(there is still a lot of margin for parameter tuning).
16 seconds per epoch on a GRID K520 GPU.
'''
from __future__ import print_function
import keras
from keras.datasets import mnist
from keras.models import Sequen... |
# regression testing of core logic:
# - always (?) compare to basic negamax implementation
# - build random game trees and test that both come up with the same outcome
# - need to build random game trees
# - run standard AIs on these
# - test same output
# - also some unit tests for specific changes
# - build s... |
# Copyright 2020 Huy Le Nguyen (@usimarit)
#
# 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... |
from flask import Flask
app = Flask(__name__)
from app import views
"""
This script should be in your 'app' folder, where you application package is located. We create the object 'Flask' as app. Then we invoke the views.py file.
"""
|
from random import choice
mMD = ['tsenitelya', 'pisatelya', 'obyvatelya', 'pokoritelya', 'sozidatelya', 'slushatelya', 'vykljuchatelya', 'osvezhitelya', 'pravitelya', 'dejatelya', 'dushitelya', 'obvinitelya', 'razrushitelya', 'potrebitelya', 'blagodetelya', 'rastochitelya', 'tselitelyem', 'grabitelyem', 'tsenitelyem', ... |
#!/usr/bin/env python
####################################################################
### This is the PYTHON version of program 3.2 from page 64 of #
### "Modeling Infectious Disease in humans and animals" #
### by Keeling & Rohani. #
### #
### It is the SIS model wit... |
# Copyright 2018 The Tensor2Tensor 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 agr... |
import json
import logging
from abc import abstractmethod
from datetime import datetime
from typing import Any, Dict, Tuple
from django.conf import settings
from django.utils import timezone
from rest_framework import serializers
from rest_framework.exceptions import ValidationError
from gnosis.eth.django.serializer... |
import os
import json
from files import Files
from pyramide import Pyramide
from write import Write_Files
class Edit():
def PyrorLos(self, fichier):
self.a = input("Saisissez une hauteur inférieur ou égale à 1000 pour votre {}: ".format("losange" if self.x == 'l' else "pyramide"))
if self.a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.