content stringlengths 5 1.05M |
|---|
# -*- coding: utf-8 -*-
"""
@Time:Created on 2019/9/17 8:36
@author: LiFan Chen
@Filename: model.py
@Software: PyCharm
"""
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import math
import numpy as np
from sklearn.metrics import roc_auc_score, precision_score, recall_sco... |
# Copyright 2017, OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
import pytest
from trinity.console import console
def test_console(jsonrpc_ipc_pipe_path):
# Test running the console, actually start it.
with pytest.raises(OSError, match='^reading .* stdin .* captured$'):
console(jsonrpc_ipc_pipe_path)
def test_python_console(jsonrpc_ipc_pipe_path):
# Test ru... |
import pytest
from dask_remote.runner.cluster_process import ClusterProcess, ResultPicklingError
from .conftest import PingCluster
class TestClusterProcessProxy:
@pytest.mark.parametrize("attr", ["scheduler_address"])
def test_cluster_attribute(self, cluster_process_proxy, cmd_pipe, result_pipe, attr):
... |
import pytest
from .conftest import Case
CASES = (
Case(["10.0.0", "5.0.0", "0.0.0"], ["0.0.0", "5.0.0", "10.0.0"]),
Case(
["2020.1.1", "1900.0.99", "2020.1.1-alpha.99", "2020.1.1-alpha.1"],
["1900.0.99", "2020.1.1-alpha.1", "2020.1.1-alpha.99", "2020.1.1"],
),
)
@pytest.mark.parametrize... |
from pgdrive.envs.generation_envs.safe_pgdrive_env import SafePGDriveEnv
def test_safe_env():
env = SafePGDriveEnv({"environment_num": 100, "start_seed": 75})
try:
o = env.reset()
total_cost = 0
for i in range(1, 100):
o, r, d, info = env.step([0, 1])
total_cost... |
#
# PySNMP MIB module Fore-Framnetmod-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Fore-Framnetmod-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:03:30 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... |
# -*- coding: utf-8 -*-
"""
Created on Tue May 28 11:32:33 2019
@author: yoelr
"""
__all__ = ['Facility']
from ..._facility import Facility
from ._boiler_turbogenerator import *
from ._cooling_tower import *
from ._chilled_water_package import *
from ._process_water_center import *
from ._air_distribution_package im... |
"""
# trans-tool
# The translation files checker and syncing tool.
#
# Copyright ©2021 Marcin Orlowski <mail [@] MarcinOrlowski.com>
# https://github.com/MarcinOrlowski/trans-tool/
#
"""
def overrides(contract) -> callable:
"""
Introduces @overrides decorator. Source: https://stackoverflow.com/a/8313042
... |
#!/usr/bin/env python
# Copyright 2020 Calico 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 ... |
#!/usr/bin/env python
# coding: utf-8
# # MySchool data scraping project
# ## Done
# * Done the basic data scraping from a base school starting page.
# * Done the basic POST Request to get other grade, domain and viewMode from base page
# * Done write dictionaries for year, grade, domain and viewMode
# * Done worked ... |
from etcdstate import EtcdBackedState
class CheeseCaveConfigs(EtcdBackedState):
def __init__(self):
super().__init__('/cheesecave/config')
def default_state(self):
return {
# How many sensors are plugged in.
'sensors': 0,
# Whether the humidifier is plugged... |
from abc import ABC, abstractmethod
import torch
from torch import nn
from torch import optim
from torch.nn import functional as F
import mlflow
class BaseGCN(nn.Module, ABC):
"""Base model for GCN and RGCN.
Parameters
----------
graph: dgl.DGLGraph
The graph on which the model is applied.
... |
class BaseCache(object):
"""
Every cache should be a subclass of this class
"""
def put(self, key, value, ex=None, ttl=None):
"""
Put a new value for key in cache
:param key: key (usually URL of resource)
:param value: value (usually text of response)
:param ex: e... |
# Generated by Django 3.0.7 on 2020-08-16 03:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('school', '0010_auto_20200816_0326'),
]
operations = [
migrations.AddField(
model_name='teacher',
name='courses',
... |
class DataGridViewColumn(DataGridViewBand,ICloneable,IDisposable,IComponent):
"""
Represents a column in a System.Windows.Forms.DataGridView control.
DataGridViewColumn()
DataGridViewColumn(cellTemplate: DataGridViewCell)
"""
def Clone(self):
"""
Clone(self: DataGridViewColumn) -> object
Re... |
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 2.0 * np.pi, 100)
y = np.sin(x)
plt.figure()
plt.plot(x, y)
plt.show()
|
import os
from pptx import Presentation
from st2common.runners.base_action import Action
from st2common.exceptions.action import InvalidActionParameterException
__all__ = [
'BuildPresentationAction',
]
class BuildPresentationAction(Action):
def __init__(self, config):
super(BuildPresentationAction, ... |
"""
This file contains the EncoderDecoderModel we used, we will soon upload the code to train these
model, currently we have only provided the model definations.
"""
import torch.nn as nn
import torch
class EncoderDecoderMLP(nn.Module):
def __init__(self,input_dim,encode_dim):
super(EncoderDecoderMLP,sel... |
city = "spb"
if city == "tallinn":
print("Население: 441000")
else:
print("Не знаю такого города: '" + city + "'")
|
from . import tool
import datetime
import html
import re
def markdown(conn, data, title, main_num):
curs = conn.cursor()
data = '<div id="render_contect">' + re.sub('\r\n', '<br>', html.escape(data)) + '</div>'
plus_data = '<script>render_markdown();</script>'
backlink = []
return [data, plus_da... |
# Parts of this file were adopted from https://github.com/huggingface/transformers
#
# Copyright 2021 The Board of Trustees of the Leland Stanford Junior University
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team
#
# Redistribution and use in source and bina... |
from core_filters.filters import FilterField
class TestFilterField:
def test_init(self):
filter = FilterField(name='foo', required=True, lookup_type='iexact')
assert filter.name == 'foo'
assert filter.required == True
assert filter.lookup_type == 'iexact'
|
import numpy as np
import SimpleITK as sitk
import pydeform
import stk
from . import interruptible
from pydeform import (
__version__,
version,
has_gpu,
LogLevel
)
def _convert_image(sitk_image):
""" Converts a SimpleITK.Image to a pydeform.Volume
Return:
pydeform.Volume if sitk_... |
import gym
import torch
import typing
from vel.api import RnnLinearBackboneModel, ModelFactory, BackboneModel
from vel.modules.input.identity import IdentityFactory
from vel.rl.api import Rollout, Trajectories, Evaluator, RlRnnModel
from vel.rl.modules.action_head import ActionHead
from vel.rl.modules.value_head impor... |
'''
Сумма квадратов
'''
N = int(input())
sum = 0
while (N != 0):
sum += N**2
N -= 1
print(sum)
|
from mxnet.gluon.nn import Activation, Conv2D, BatchNorm, LeakyReLU, HybridSequential, HybridBlock
import numpy as np
# Define the PatchGAN discriminator
class Discriminator(HybridBlock):
def __init__(self, in_channels, ndf=64, n_layers=3, use_sigmoid=False, use_bias=False):
super(Discriminator, self).__i... |
import numpy as np
import pacpy
import os
from pacpy.filt import firfls, morletf, firf
def test_firf():
"""
Confirm consistency in FIR filtering
"""
# Load data
data = np.load(os.path.dirname(pacpy.__file__) + '/tests/exampledata.npy')
assert np.allclose(
np.sum(np.abs(firf(data, (13, ... |
import logging
from os.path import expanduser, join
from unittest import mock
import pytest
from click.testing import CliRunner
from configparser import ConfigParser
from apparate.configure import configure
from apparate.cli_commands import upload, upload_and_update
logging.basicConfig(level=logging.INFO)
logger = ... |
from tkinter import *
import logging
from src.View import ContouringWorkspace
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
def main():
root = Tk()
ContouringWorkspace(root)
root.mainloop()
if __name__ == "__main__":
main()
|
import time
import taichi as ti
t = time.time()
ti.init(arch=ti.cuda, print_kernel_llvm_ir_optimized=True)
@ti.kernel
def p():
print(42)
p()
print(f'{time.time() - t:.3f} s')
ti.core.print_profile_info()
|
from pyrogram import Client, filters
from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton
from helpers.filters import other_filters2
@Client.on_message(other_filters2)
async def start(_, message: Message):
await message.reply_photo("https://telegra.ph/file/e775aff9d6a97c5664d65.jpg")
... |
# © 2009 EduSense BV (<http://www.edusense.nl>)
# © 2011-2013 Therp BV (<https://therp.nl>)
# © 2014-2016 Serv. Tecnol. Avanzados - Pedro M. Baeza
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import _, api, fields, m... |
from common import *
from database import *
from links import *
import sys
class ScrapeCountry(CommonBasics):
def __init__(self):
self.c_link = Links.baseDirectory
self.scrape(self.c_link)
self.parseContent()
def parseContent(self):
main_container = self.soup.select('.container')[0]
container_content =... |
from sdk.color_print import c_print
from tqdm import tqdm
def add_users(session: object, users_to_add: list, logger):
'''
Accepts a tenant session object and a list of users to add.
Adds each user in the list to the tenant of the provided tenant session.
The User Profiles in the users_to_add list have... |
#!/usr/bin/env python
"""
--------------------------------------------------------------------------------
Created: Jackson Lee 7/1/14
This script converts a single filter readlist to a paired readlist. This script
is used in AMOS Ray cluster file filtering.
Input cluster file format:
readindex
readindex
offsetindex... |
from __future__ import unicode_literals, print_function, absolute_import
from scrapel.decorators import response_middleware
__author__ = 'Fill Q and Scrapy developers'
__all__ = ['ChunkedTransferMiddleware']
PRIORITY = 830
class ChunkedTransferMiddleware(object):
"""This middleware adds support for chunked tra... |
import ckan.plugins as plugins
def group_create(context, data_dict=None):
return {'success': False, 'msg': 'No one is allowed to create groups'}
class ExampleIAuthFunctionsPlugin(plugins.SingletonPlugin):
plugins.implements(plugins.IAuthFunctions)
def get_auth_functions(self):
return {'group_cr... |
#!/usr/bin/env python
"""A test to verify Psycopg collaboration with other blocking I/O.
Please run the script ``wait_server.py`` in a separate shell to make the
test work.
If the test works you should see download tasks overlapping query tasks.
"""
# Copyright (C) 2010-2020 Daniele Varrazzo <daniele.varrazzo@gmail.... |
"""
Admin site bindings for contentstore
"""
import logging
from config_models.admin import ConfigurationModelAdmin
from django.contrib import admin
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
from django.utils.translation import ugettext as _
from edx_django_utils.admin.mixins import ReadOnlyAdminM... |
"""
File: largest_digit.py
Name: Alan Chen
----------------------------------
This file recursively prints the biggest digit in
5 different integers, 12345, 281, 6, -111, -9453
If your implementation is correct, you should see
5, 8, 6, 1, 9 on Console.
"""
def main():
print(find_largest_digit(12345)) # 5
print... |
"""Next Greater Element II"""
class Solution(object):
def nextGreaterElements(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
## R2:
stack = []
res = [-1 for _ in range(len(nums))]
for i in range(len(nums))*2:
while stack and... |
from eda_serialcoms import *
sensor = Sensor()
exp = Experiment()
# connect with the sensor
sensor.establishConnection()
# set sensor time
sensor.setSensorTime() # does not work
# set the sensor into compressed recording mode for field
sensor.recordCompression()
# get sensor time
sensor.getSensorTime() # works
... |
import curses
class Window(object):
def __init__(self, parent, nlines, ncols, begin_y = 0, begin_x = 0):
self.window = parent.derwin(nlines, ncols, begin_y, begin_x)
def derwin(self, nlines, ncols, begin_y = 0, begin_x = 0):
return self.window.derwin(nlines, ncols, begin_y, begin_x)
def a... |
"""
The MIT License (MIT)
Copyright (c) 2021-present Village
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, mer... |
import numpy as np
class FeatureLister(object):
def __init__(self, X, idx_store, num_docs):
self.X = X
self.idx_store = idx_store
self.num_docs = num_docs
def output(self):
# () -> list
toret = [{} for i in range(self.num_docs)]
X = self.X.tocoo()
for row, col, val in zip(X.row, X.col, X.data):
to... |
import requests
from datetime import datetime
class GenericSource:
def __init__(self,url,source_name):
self.template_url = url
self.source_name = source_name
def get_source_name(self):
return self.source_name
def get_prices(self,currency_pairs):
full_response = {}
... |
from sklearn.metrics import confusion_matrix
from threading import Thread
import time
from Queue import Queue, Empty
import multiprocessing
from lib.in_subject_cross_validation import *
import lib.in_subject_cross_validation as libcv
import sys
import argparse
q = Queue()
# Performs recursive feature elimination un... |
#!/usr/bin/env python3
#!/home/niekh/miniconda3/envs/snakemake/bin/python
import sys
import argparse
__author__= "N.A.H. Huijsmans"
__version__= "quast-report v1.1.0"
__date__= "3th of April, 2020"
#making arguments
parser = argparse.ArgumentParser(prog="quast-report", description="",usage="%(prog)s -q <int> o- <f... |
name = 'Amol Borcar'
age = 25
height = 70 # inches
weight = 180 # pounds
eyes = "Brown"
teeth = "White"
hair = "Black"
print "Let's talk about %s." % name
print "He's %d inches tall." % height
print "He's %d pounds heavy." % weight
print "Actually that's not too heavy."
print "He's got %s eyes and %s hair." % (eyes, h... |
"""
Training a model to classify chord (pitch class set) labels from chormagram
features. The architecture consists of a few 1D convolutional layers followed
by LSTM and 12 sigmoids at the end (for multi-label classification).
On GTX 980 Ti one epoch takes 15 seconds.
"""
import arrow
from keras.callbacks import Mode... |
#!/bin/python
import sys
t = int(raw_input().strip())
result = []
for a0 in xrange(t):
n,k = raw_input().strip().split(' ')
n,k = [int(n),int(k)]
a = map(int,raw_input().strip().split(' '))
current = 0
for aVal in a:
if aVal <= 0:
current += 1
if current >= k:
resu... |
import random
from Game_move_logic import Possible_moves, Make_Board_Move
from Piece_class_stuff import Sprites, Colour
def Bot_Choice(number, b, colour):
if number == 1:
move = Random_Bot(b, colour)
return move
def Random_Bot(b, colour):
available_moves = {}
for line in b:
for p... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Distributed under terms of the MIT license.
"""
Translate the diffs into actual commands to apply
in an IOS-like environment.
"""
import sys
from io import StringIO
from transintentlation.compare_v2 import Comparing
class Translate():
""" Transla... |
import unittest
from ..class_method import ClassMethod, class_method
from . import scratch
class ClassMethodTest(unittest.TestCase):
def _process(self, m):
list(m.process(
scratch, 'header',
{'class_name': 'MethodTest'}))
list(m.process(
scratch, 'impl',
... |
from tkinter import *
import requests
import json
root = Tk()
root.title("Weather App")
root.geometry("700x400")
root.configure(background = "black")
lable_temp = Label(root,text="...",width = 5,bg='white',font=("bold",10),fg='blue')
lable_temp.place(x=192,y=220)
lable_pres = Label(root,text="...",width = 5,bg='whit... |
#import the necessary modules
import freenect
import cv2
import numpy as np
#function to get RGB image from kinect
def get_video():
array,_ = freenect.sync_get_video()
array = cv2.cvtColor(array,cv2.COLOR_RGB2BGR)
return array
#function to get depth image from kinect in 2 dimensions (heigth, width)
def ge... |
from types import SimpleNamespace
from models import SimpleDQN, DuelingDQN
import torch
import warnings
import ptan
import ptan.ignite as ptan_ignite
from ignite.engine import Engine
from ignite.metrics import RunningAverage
from ignite.contrib.handlers import tensorboard_logger as tb_logger
from datetime import time... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @File : tests\test_model\test_cnn_cifar10.py
# @Time : 2022-05-03 12:14:53
# @Author : Bingjie Yan
# @Email : bj.yan.pa@qq.com
# @License : Apache License 2.0
import torch
from torch import optim
from torch.utils.data import DataLoader
from fedhf.api ... |
class DataPH(object):
"""docstring for DataPH."""
def __init__(self, data, hour):
super(DataPH, self).__init__()
self.data = data
self.hour = hour
def __str__(self):
return "Hour: " + str(self.hour) + " Data: " + str(self.data)
data_list = [{"hour":17,"data":20},{"hour":17... |
import asyncio
import http
from typing import List, Union
from fastapi import HTTPException
from app.models.base import APIDocument
from app.models.channel import Channel
from app.models.message import Message, MessageReaction
from app.models.user import User
from app.schemas.messages import MessageCreateSchema
from ... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 27 14:06:23 2020
@author: James Kring
@email: jdk0026@auburn.edu
"""
|
import time
import threading
def add():
result = 0
for i in range(1, 50000001):
result += i
print(result)
if __name__ == '__main__':
start = time.time()
tlist = []
for i in range(2):
t = threading.Thread(target=add)
tlist.append(t) # 将线程加入到列表
t.start()
for ... |
from functools import lru_cache
import numpy as np
import inspect
import os
import logging
# TODO: Add options for mnu, h0 default, omega_b, etc
@lru_cache(maxsize=32)
def getCambGenerator(redshift=0.51, om_resolution=101, h0_resolution=1, h0=0.676, ob=0.04814, ns=0.97, recon_smoothing_scale=21.21):
return Cam... |
# Copyright 2018 The TensorFlow 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 ... |
#--- Exercício 4 - Variáveis
#--- Imprima a tela de um itinerário de viagem
#--- O itinerário deve conter o ponto de partida e de destino
#--- O ponto de partida e de destino devem estar armazenados em variáveis
#--- Entre os dois pontos deve conter no mínimo 10 pontos de parada
#--- Cada item ponto de parada deve con... |
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
import collections
import os
import sys
from decimal import Decimal
import pytest
from tabledata import TableData
import pytablewriter as ptw
from ..._common import print_test_result
from ...data import headers, value_matrix
try:
import p... |
"""
An example for removing numeric literals
"""
x = 12
y = 3.14
s = 1.3e+4
c = 2+3j
b = 0b100
o = 0o320
h = 0x12b
|
# coding: utf8
import cache_file
def translation_search_in_cache(txt, end_lang):
res = {
'result': False,
'text': ''
}
try:
res['text'] = cache_file.translations[end_lang][txt]
res['result'] = True
print('used translation cache')
except Exception:
pass... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('web', '0003_auto_20150819_1453'),
('web', '0002_auto_20150819_1407'),
]
operations = [
]
|
import requests
import re
import os
import time
def Download():
print("开始下载......")
i = 1
# 建立以时间命名的目录
#
# ----获取系统时间 年 月 日
ymd = time.strftime("%Y%m%d", time.localtime(time.time()))
# ---- 获取系统时间 小时 分钟 秒。 输出:120043
hms = time.strftime("%H%M%S", time.localtime(time.time()))
#
p... |
# pc_socket_test.py
# Created: 2018.02.09
# Uvindu Wijesinghe and Oliver Wilkins
#
# Description:
# Sets up a UDP socket to facilitate communication between
# the PC and an RPi.
# Waits to receive a message from the Pi and then sends one back.
#
# Usage:
# Start this program, and then run the corresponding program on ... |
import unittest
import json
from xml.etree import ElementTree as ET
# This test suite uses xmlunittest package. Install it by running 'pip install xmlunittest'.
# Documentation at http://python-xmlunittest.readthedocs.io/en/latest/
from xmlunittest import XmlTestMixin
from Utils.lad_logging_config import *
from Utils.... |
from graphviz import Digraph
from model.infrastructure import Infrastructure
dot = Digraph(comment='Microservices Infrastructure Roadmap', format='png')
infrastructure = Infrastructure()
infrastructure.build(dot)
dot.render('images/microservices-infrastructure-roadmap.gv')
|
import os
import binascii
import yaml
import paho.mqtt.client as mqtt
import re
from lib.state import State as Entry
print "Welcome to SecurityQTPi!"
# Update the mqtt state topic
def update_state(value, topic):
print "State change triggered: %s -> %s" % (topic, value)
client.publish(topic, value, retain=Tr... |
# <Script name>
# Author: Angela Brooks
# Program Completion Date:
# Description:
# Modification Date(s):
# Copyright (c) 2011, Angela Brooks. anbrooks@gmail.com
# All rights reserved.
import sys
import optparse
import os
import pdb
import math
#############
# CONSTANTS #
#############
# DEF_MIN_FO... |
import time
import psutil
import xprintidle
import subprocess
POLL_MILLISECONDS = 100
def _kill_all(pid):
parent = psutil.Process(pid)
for child in parent.children(recursive=True):
child.kill()
parent.kill()
def do(args, polltime=POLL_MILLISECONDS):
"""Run something until the user is idlin... |
#!/usr/bin/env python
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the PyMVPA package for the
# copyright and license terms.... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2022 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/... |
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)))
import test_n0vault
test_n0vault.main()
|
'''
Created on July 2nd, 2015
@author: dan
'''
import ckanext.hdx_user_extra.model as ue_model
import ckan.logic as logic
NotFound = logic.NotFound
@logic.side_effect_free
def user_extra_show(context, data_dict):
'''
Retrieves user extra list based on 'user_id'
:param context:
:param data_dict: con... |
# Copyright (c) 2019 Microsoft Corporation
# Distributed under the MIT software license
import sys
from interpret.ext.extension_utils import load_class_extensions
from interpret.ext.extension import GLASSBOX_EXTENSION_KEY, _is_valid_glassbox_explainer
load_class_extensions(
sys.modules[__name__], GLASSBOX_EXTENSI... |
#############################################################################
#
# VFRAME
# MIT License
# Copyright (c) 2020 Adam Harvey and VFRAME
# https://vframe.io
#
#############################################################################
import click
from vframe.utils.click_utils import processor
@click.... |
"""Attributes used by docs/packaging."""
__author__ = "Bradley Dice"
__version__ = "0.1.0"
|
from ..platforms.platform import SyscallNotImplemented, unimplemented
from .linux_syscalls import amd64
class SyscallStubs:
"""
DEVELOPING NEW SYSTEM CALLS:
* Whenever you need to add proper support for a system call to Manticore, cut and paste the stub from this file into
manticore/platforms/linux.... |
# $Id$
#
# Copyright (C) 2003 Rational Discovery LLC
# All Rights Reserved
#
import sys
from rdkit.VLib.Node import VLibNode
class TransformNode(VLibNode):
""" base class for nodes which filter their input
Assumptions:
- transform function takes a number of arguments equal to the
number of input... |
from django.conf import settings
from django.core.management import call_command
from django.core.management.base import NoArgsCommand, CommandError
from fixture import DjangoFixture
from fixture.style import NamedDataStyle
from fixturapp.management.commands import find_datasets, fill_database
class Command(NoArgsCo... |
from flask import render_template, url_for, flash, redirect, request, abort
from . import main
from flask_login import login_required, current_user
from .forms import PitchForm, CommentForm
from ..models import User, Category, Pitch, Comment
from ..import db
@main.route('/')
def index():
return render_template('ind... |
from gmusicapi import Mobileclient
from spotipy import oauth2
from spotipy import Spotify
from spotipy import util
import secrets
import sys
GOOGLE_PROVIDER = 'google'
SPOTIFY_PROVIDER = 'spotify'
class Track(object):
def __init__(self, track_id, source, **kwargs):
self.id = track_id
self.source =... |
##############################
# day11/blackjack.py
# modification...ace can be 11 or 1
##############################
import os
import random
card_values = {
"2": 2, "3": 3, "4": 4, "5": 5,
"6": 6, "7": 7, "8": 8, "9": 9, "10": 10,
"J": 10, "Q": 10, "K": 10, "A": 11
}
def new_deck():
return [
... |
import inspect
def test(func):
def test_decorator(test_func):
def wrapper(self, *args, **kwargs):
solution_class = getattr(inspect.getmodule(func), func.__qualname__.rsplit('.', 1)[0])
solution = solution_class()
def _test(*params, result=None, **states):
... |
from google_auth_oauthlib.flow import InstalledAppFlow
from googleapiclient.discovery import build
from google.auth.transport.requests import Request
from google.oauth2 import credentials
import json
import os
import sys
CLIENT_SECRETS_FILE = 'client_secrets.json'
CREDENTIALS_FILE = 'credentials.json'
EXPORT_DIR = 'ex... |
#! /bin/env python3
# This code is based on the assumption that there have been
# created a 'black (custom)' in the 'IoT Rapid Prototyping' wapp.
# The certificates, have then been downloaded
# unpack and saved into the config-folder of you project.
import time
from porcupineIO import GPIO
import wappstoiot
def m... |
import os
import subprocess
import sys
import numpy as np
from setuptools import Extension, setup
from setuptools.command.build_ext import build_ext
python_version = sys.version_info
min_python_version = (3, 7)
min_python_version_str = f"{min_python_version[0]}.{min_python_version[1]}"
if python_version < min_python_... |
from typing import Iterable, Tuple
#from . import plot
import plot
import importlib
def test_plot8():
importlib.reload(plot)
data: Iterable[Iterable[Iterable[Tuple[int, int]]]] = ((
("points", ((0, 0), (-10, -10))),
("points", ((10, 10), (-9, -9))),
("points", ((5, 5), (-6, 8))),
... |
CAFFE_ROOT = '../caffe'
CAFFE_GPU = True
|
#! /usr/bin/env python
import os
import sys
import glob
version = (int(sys.argv[1]), int(sys.argv[2]), int(sys.argv[3]), int(sys.argv[4]))
def substitute_file(name):
subst = ''
f = open(name)
for l in f:
if '#define LIBTORRENT_VERSION_MAJOR' in l and name.endswith('.hpp'):
l = '#define LIBTORRENT_VERSION_MAJO... |
import os
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from xvfbwrapper import Xvfb
LOGIN_PAGE = 'https://stackoverflow.... |
from PyQt4 import QtGui
# from mainwindow import Ui_MainWindow
class Login(QtGui.QDialog):
def __init__(self, parent=None):
super(Login, self).__init__(parent)
self.textName = QtGui.QLineEdit(self)
self.textPass = QtGui.QLineEdit(self)
self.buttonLogin = QtGui.QPushButton('Login'... |
import os
from PIL import Image
import numpy as np
cropped_path = 'data/Archive_cropped/'
os.makedirs(cropped_path, exist_ok=True)
paths = []
with open('data/patch - patch_list.csv', 'r', encoding='utf-8') as f:
records = f.read().split('\n')
for record in records[1:]:
record = record.split(',')
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.