text stringlengths 2 999k |
|---|
import string
from ctypes import *
# visual studio
# dll_c = CDLL('dll/ctypes_dll.dll')
# vscode
dll_c = CDLL('dll/libctypes_dll.dll')
# read data of value
# method1 byref
c_value = c_int(0)
ret = dll_c.test_value(byref(c_value))
print('ret: {}'.format(ret))
print('c_value: {}'.format(c_value))
# method2 pointer
c_va... |
# ------------------------------------------------------------------------
# coding=utf-8
# ------------------------------------------------------------------------
import warnings
from django import template
from django.conf import settings
from django.db.models import Q
from django.http import HttpRequest
from fei... |
from __future__ import unicode_literals
from django.test import TestCase
from .models import Tournament, Organiser, Pool, PoolStyle
class ExistingRelatedInstancesTests(TestCase):
fixtures = ['tournament.json']
def test_foreign_key(self):
with self.assertNumQueries(2):
tournament = Tourn... |
__version__ = '0.1.3'
__author__ = 'D-Wave Systems Inc.'
__authoremail__ = 'mwong@dwavesys.com'
__description__ = "Generates penalty models using SciPy's linear programming."
|
#! /usr/bin/python2
import subprocess
import sys
import os
import time
from subprocess import PIPE
import socket
default_params = ''
output_file_prefix = 'output'
if len(sys.argv) > 1:
output_file_prefix = sys.argv[1]
#
# SCENARIO
#
# 0: radial dam break
# 1: gaussian
# 2: balanced steady state u
# 3: balanced ste... |
"""A generic way to handle errors in GUI applications.
This module also contains a ErrorHandlerAspect, which can be easily
attached to a class' method and will raise the error dialog when the
method exits with an exception.
"""
import pdb
import sys
from gi.repository import Gtk
from gaphor.i18n import gettext
de... |
from __future__ import print_function
import torch.utils.data as data
from PIL import Image
import os
import os.path
import errno
import torch
import codecs
class fashion(data.Dataset):
"""`MNIST <http://yann.lecun.com/exdb/mnist/>`_ Dataset.
Args:
root (string): Root directory of dataset where ``proc... |
from rpi_ws281x import *
import numpy as np
# LED strip configuration:
LED_COUNT = 100 # Number of LED pixels.
LED_PIN = 18 # GPIO pin connected to the pixels (18 uses PWM!).
#LED_PIN = 10 # GPIO pin connected to the pixels (10 uses SPI /dev/spidev0.0).
LED_FREQ_HZ = 800000 # LED ... |
def get_form_schema():
return {
"schema": {
"description": "Optimisez votre système de culture",
"type": "object",
"properties": {
"problem": {
"title": "Sur quel sujet pouvons-nous vous aider ?",
"required": False
... |
import random
def mergeSort(arr):
if len(arr) <= 1:
return arr
half = len(arr) // 2
sortedLeft = mergeSort(arr[:half])
sortedRight = mergeSort(arr[half:])
return mergeSortedArrays(sortedLeft, sortedRight)
def mergeSortedArrays(left, right):
leftIndex, rightIndex = 0 , 0
result = []
... |
import logging
from datetime import timedelta
from django.contrib import messages
from django.db.models import Q
from django.http import Http404
from django.shortcuts import redirect
from django.utils.formats import date_format
from django.utils.timezone import now
from django.utils.translation import ugettext_lazy as... |
from .hook import TorchHook
from .tensor import _SyftTensor, _LocalTensor, _PointerTensor
from .tensor import _FixedPrecisionTensor, _TorchTensor, _PlusIsMinusTensor, _GeneralizedPointerTensor
from .tensor import _SPDZTensor, _SNNTensor
from enum import Enum, auto
__all__ = ['TorchHook', '_SyftTensor', '_LocalTensor',... |
#!/usr/bin/env python
"""Simple parsers for configuration files."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import logging
import os
import re
import stat
from future.builtins import zip
from future.utils import iteritems
from future.utils impor... |
import os
import datetime
from performance.driver.core.classes import Reporter
from performance.driver.core.events import LogLineEvent, TickEvent
class LogReporter(Reporter):
"""
The **Log Lines Reporter** is writing the contents of every ``LogLineEvent``
into a file stream.
::
reporters:
- class... |
# Generated by Django 2.2 on 2019-05-21 16:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('openbook_posts', '0030_post_is_closed'),
]
operations = [
migrations.AddField(
model_name='post',
name='is_deleted',
... |
from supersql.engines.postgres import *
|
import numpy as np
import tensorflow as tf
from tensorflow.keras import layers, initializers
EVONORM_B0 = 'evonorm_b0'
EVONORM_S0 = 'evonorm_s0'
LAYER_TYPES = (EVONORM_B0, EVONORM_S0)
class EvoNorm(layers.Layer):
def __init__(self,
name='evonorm',
layer_type=EVONORM_B0,
... |
# Copyright 2018 The Magenta 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 ... |
from flask import jsonify
from flask_api import status
def ok(json_data: dict) -> tuple:
return json_data, status.HTTP_200_OK
def created(json_data: dict) -> tuple:
return json_data, status.HTTP_201_CREATED
def bad_request(message: dict) -> tuple:
return jsonify(message), status.HTTP_400_BAD_REQUEST
... |
"""
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 2.1.1.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
# ... |
import datetime
import core
import logging
import time
from core.helpers import Url
import json
logging = logging.getLogger(__name__)
'''
https://torrentapi.org/apidocs_v2.txt
This api is limited to one request every 2 seconds.
'''
timeout = None
_api_token = None
_token_timeout = datetime.datetime.now()
def base_... |
import pandas as pd
from django.core.cache import cache
from django.db.models import IntegerField, Avg, Max, Min, Q
from django.utils.functional import cached_property
from firecares.utils import AttrDict
from firecares.firestation.managers import Ntile, Case, When
class FireDepartmentMetrics(object):
def __init_... |
# Copyright (c) 2015 Nicolas JOUANIN
#
# See the file license.txt for copying permission.
import asyncio
from fullyconnect.mqtt_codecs import bytes_to_int, decode_data_with_length, decode_string, decode_bytes_string,\
encode_data_with_length, encode_string, encode_byte_string, int_to_bytes, read_or_raise
from full... |
"""
Examples how strings work in python
Sequence of characters
Contains a-z, 0-9, @
in double or single quotes
"""
a = "This is a simple string"
b = 'Using single quotes'
print(a)
print(b)
c = "Need to use 'quotes' inside a string"
print(c)
d = "Another way to handle \"quotes\""
print(d)
a = "This is a single str... |
import numpy
import scipy.constants as Const
def AtmLayers(hG):
Layers = ([0, 11e3, 25e3, 47e3, 53e3, 79e3, 90e3, 105e3])
FHght = numpy.digitize(hG,Layers)
switcher = {
1: numpy.array([False, -6.5e-3]),
2: numpy.array([True, 216.66]),
3: numpy.array([False, 3e-3]),
4: numpy.a... |
import random
from datetime import datetime
from typing import List
def calc_progressive_percentage(
percentage: int,
start_date: str,
end_date: str,
max_value: int,
date_format: str,
) -> int:
if datetime.today() < datetime.strptime(
start_date, date_format
) or datetime.today() >... |
#!/usr/bin/python
import numpy as np
import os
import sys
import h5py
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from PIL import Image, ImageChops, ImageDraw
def analyse(classifier, regressor, image, batch_size, patch_size, interval):
# open the image and convert to array
image = image.convert(... |
"""
A comprehensive example that shows the whole workflow of
1) Loading data
2) Defining the model structure for a joint distribution
3) Estimating the parameter values of the model ("Fitting")
4) Computing a 3D environmental contour
"""
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from vir... |
from __future__ import absolute_import, unicode_literals
from . import settings
import os
from celery import Celery
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'fr_celery.settings')
app = Celery('fr_celery')
# Using a string here means the work... |
# Copyright 2018 The Oppia 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 applicable ... |
# Copyright (c) 2020 Dell Inc. or its subsidiaries.
#
# 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... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from .. import _utilitie... |
from django.urls import include, path, re_path
from django.views.generic.base import TemplateView
from django.views.decorators.cache import never_cache
from . import views
services_patterns = [
re_path(r'^monitor\.json$', never_cache(views.monitor), name='amo.monitor'),
re_path(r'^loaded$', never_cache(views.... |
""" Multiscale curvature classification of ground points with color updates """
import numpy as np
from copy import copy
from .classification import make_sgd_pipeline
from .features import calculate_color_features
from .pointutils import equal_sample, intersect_rows
from pymcc_lidar import calculate_excess_height
... |
import os
from dotenv import load_dotenv
from .celery import app as celery_app
PROJECT_BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
load_dotenv(os.path.join(PROJECT_BASE_DIR, '.env'))
__all__ = ('celery_app',)
|
#!/usr/bin/env python
# coding: utf-8
import os
import time
print '安装WeChatU到你的Linux系统'
print '正在初始化安装'
cwd = os.getcwd() + '/'
desktop = '/usr/share/applications/wechatu.desktop'
tpl = 'wechatu.desktop'
f = open(tpl, 'r')
conf_str = f.read()
f.close()
conf_str = conf_str.format(cwd, cwd)
print '正在装载配置,请等待'
if not... |
from .deps import get_current_user, get_db
from .response_schemas import *
from .schemas import * |
import os
import shutil
import sys
import tempfile
import traceback
from http import HTTPStatus
import click
import requests
from eth_utils import (
decode_hex,
encode_hex,
remove_0x_prefix,
to_canonical_address,
to_checksum_address,
)
from web3 import HTTPProvider, Web3
from web3.middleware import... |
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
# Copyright 2015 and onwards Google, 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/license... |
# Copyright 2020 MONAI Consortium
# 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, s... |
#
# 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 PRO... |
# -*- coding: utf-8 -*-
"""root transport layer protocol
:mod:`pcapkit.protocols.transport.transport` contains
:class:`~pcapkit.protocols.transport.transport.Transport`,
which is a base class for transport layer protocols, eg.
:class:`~pcapkit.protocols.transport.transport.tcp.TCP` and
:class:`~pcapkit.protocols.trans... |
r"""
Subwords
A subword of a word `w` is a word obtained by deleting the letters at some
(non necessarily adjacent) positions in `w`. It is not to be confused with the
notion of factor where one keeps adjacent positions in `w`. Sometimes it is
useful to allow repeated uses of the same letter of `w` in a "generalized"
... |
with open('2015/day_14/list.txt', encoding="utf-8") as f:
lines = f.readlines()
def calcul(v, t, pause, d):
q, pause = divmod(d, t + pause)
distance = (q*t + min(pause, t))*v
return distance
temp = []
t = []
d = 2503
for i in lines:
arr = i.split(' ')
for a in arr:
if a.isdigit():
... |
# coding=utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import os
import pprint
import re
import sys
import pytest
from scout_apm.core.config import Null, ScoutConfig, scout_config
from tests.compat import mock
def test_get_config_value_from_env():
os.en... |
import numpy as np
def linear_regression(x, u, lamb):
"""Estimates linear system dynamics
x, u: data used in the regression
lamb: regularization coefficient
"""
# Want to solve W^* = argmin sum_i ||W^T z_i - y_i ||_2^2 + lamb ||W||_F,
# with z_i = [x_i u_i] and W \in R^{n + d} x n
Y = x[2 ... |
import glob
import json
import os
import random
from torch.utils import data
from torch.nn import CrossEntropyLoss
from torch.utils.data import Subset
from datasets.episode import Episode
from datasets.wsd_dataset import WordWSDDataset, MetaWSDDataset
from datasets.ner_dataset import NERSampler, read_examples_from_fi... |
from abc import ABC
class ILogger(ABC):
def __repr__(self):
return f'{self.__class__.__name__}()'
class ICommProtocol(ABC):
def __init__(self, logger: ILogger):
self._logger = logger
def __repr__(self):
return f'{self.__class__.__name__}({self._logger})'
class ICommunicator(AB... |
# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from detectron2.config import CfgNode as CN
def add_detr_config(cfg):
"""
Add config for DETR.
"""
cfg.MODEL.DETR = CN()
cfg.MODEL.DETR.NUM_CLASSES = 80
# For Segmentation
cfg.MODEL.DETR.FROZEN_... |
# Copyright 2022 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... |
def unittest(data_path, temp_path):
import image
e = 0.0000001
# Load image
img = image.Image("/sd/unittest/data/cat.pgm", copy_to_fb=True)
# Load histogram
with open("/sd/unittest/data/cat.csv", "r") as f:
hist1 = [float(x) for x in f.read().split(',')]
f.close()
#... |
# 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.
# -----------------------------------------------------... |
# coding=utf-8
from Cryptodome.Cipher import AES
from Cryptodome.Protocol.KDF import scrypt
from Cryptodome.Random import get_random_bytes
from typing import Tuple
from base64 import b64encode, b64decode
from io import UnsupportedOperation
from os import path, remove
class SecureBox(object):
"""SecureBox class ... |
# qubit number=4
# total number=28
import cirq
import qiskit
from qiskit import IBMQ
from qiskit.providers.ibmq import least_busy
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from ma... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from .. import _utilities, _tables
__al... |
""" radiative.py
Routines for calculating quantities useful for
radiative transfer, such as Einstein coefficients
"""
import numpy as np
import pandas as pd
from scipy import constants
from pyspectools.units import kbcm, MHz2cm
def parse_str(filepath):
# Function that will parse a .str file from SPCAT
... |
from django.urls import include, path
from rest_framework import routers
from . import views
from rest_framework.authtoken.views import ObtainAuthToken
from .views import *
router = routers.DefaultRouter()
router.register(r'users', views.UserViewSet)
router.register(r'profile', views.UserProfileViewSet)
router.registe... |
from __future__ import absolute_import, print_function, division
import sys
from textwrap import dedent
import collections
import warnings
import logging
import numpy as np
from six import integer_types
from six.moves import xrange
import theano
from theano.compat import izip
from theano.gradient import DisconnectedT... |
def fermat(num):
"""Runs a number through 1 simplified iteration of Fermat's test."""
if ((2 ** num) - 2) % num == 0:
return True
else: return False
def gen_primes(maxnum):
"""Generates primes using fermat"""
if maxnum % 2 == 0: # finds odd number
maxnum -= 1
num = maxnum
wh... |
import unittest
from decimal import Decimal
from . import read_fixture
from walutomatpy import WalutomatOrder
from walutomatpy import OrderCurrencyPair, OrderCurrencyEnum
from walutomatpy import AccountBalances
class TestWalutomatOrder(unittest.TestCase):
def test_order_parsing(self):
raw_order = read_f... |
def find(lst,n):
count=0
lst_=range(1,n+1)
for i,j in enumerate(lst):
#print j
if (abs(lst_.index(j)-i))>2:
return "Too chaotic"
for i in xrange(n-1,0,-1):
#print "---",i
if (lst[i] - (i+1)>2):
return "Too chaotic"
for j in xrange(max(0,lst[i]-2),i):
#print ">>",j,lst[j],lst[i]
... |
# -*- coding: utf-8 -*-
#
# pyramid_restler documentation build configuration file, created by
# sphinx-quickstart on Mon Jun 13 13:03:33 2011.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.... |
from pickle import load
from matplotlib.pyplot import subplots
from matplotlib.cm import get_cmap
with open('carehome_no_vacc_sol.pkl','rb') as f:
no_vacc_output, ave_hh_by_class = load(f)
lgd=['S','E','M', 'C', 'R', 'D']
t = no_vacc_output['t']
data_list = [no_vacc_output['S_no_vacc']/ave_hh_by_class,
no_va... |
import sys
def isPython2():
version = sys.version
return version.startswith('2.')
import junit_xml
class Testcase (junit_xml.TestCase):
Count = 0
def __init__(self, description):
self.tcId = Testcase.Count
Testcase.Count += 1
self.description = description
... |
from skyfield.api import (
Star, load, load_constellation_map, position_from_radec,
)
def test_constellations():
ts = load.timescale(builtin=True)
t = ts.utc(2000)
lookup = load_constellation_map()
assert lookup(position_from_radec(0, 0)) == 'Psc'
assert lookup(position_from_radec(360, 90)) ==... |
import decimal
from threading import local
from django.db import DEFAULT_DB_ALIAS
from django.db.backends import util
from django.utils import datetime_safe
from django.utils.importlib import import_module
class BaseDatabaseWrapper(local):
"""
Represents a database connection.
"""
ops = None
def ... |
from settings.globalsettings import GlobalSettings
globalsettings = GlobalSettings()
AWS_ACCOUNT_ID = globalsettings.AWS_ACCOUNT_ID
AWS_REGION = globalsettings.AWS_REGION
def code_build_batch_policy_in_json(project_ids):
"""
Define an IAM policy statement for CodeBuild batch operation.
:param project_id... |
import pytest
import os
import datetime
import logging
import tempfile
from s100py import s100
@pytest.fixture(scope="module")
def s100_file():
h, fstr = tempfile.mkstemp(".h5", dir=os.path.split(__file__)[0])
os.close(h)
# create a S100 file to do basic tests, each test of a specific spec (102, 111) wi... |
# Copyright 2012 OpenStack Foundation
# Copyright 2013 IBM Corp.
#
# 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... |
"""
Created on 27 Sep 2016
@author: Bruno Beloff (bruno.beloff@southcoastscience.com)
"""
import re
import json
from collections import OrderedDict
from copy import deepcopy
from scs_core.data.json import JSONable
# --------------------------------------------------------------------------------------------------... |
# Pedir 3 nomes de alunos / grupos e sortear um deles
from random import choice
aluno0 = str(input('\033[33mPrimeiro aluno:\033[m')).strip()
aluno1 = str(input('\033[33mSegundo aluno:\033[m')).strip()
aluno2 = str(input('\033[33mTerceiro aluno:\033[m')).strip()
lista = [aluno0, aluno1, aluno2]
sorteado = choice(lista... |
# 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... |
#!python
from queue import Queue
class BinaryTreeNode(object):
def __init__(self, data):
"""Initialize this binary tree node with the given data."""
self.data = data
self.left = None
self.right = None
def __repr__(self):
"""Return a string representation of this binar... |
from dogwood.engine import Game, Player, Story, SaveFile, Map, Inventory
from dogwood.grammar import Command, Word, Lexicon
|
import sys
import numpy as np
n, a, b = map(int, sys.stdin.readline().split())
s, d = np.array(sys.stdin.read().split()).reshape(-1, 2).T
d = d.astype(np.int64)
def main():
d[d < a] = a
d[d > b] = b
w = s == "West"
d[w] = np.negative(d[w])
res = np.sum(d)
if res == 0:
... |
"""Test the messenger module"""
import unittest
import asyncio
from loguru import logger
from nats_messenger.messenger import Messenger
from nats_messenger.tests.config_test import (
URL,
CREDENTIALS,
CLUSTER_ID,
CLIENT_ID,
TEST_PAYLOAD,
TEST_TOPIC,
)
class MessengerNonDurableTestCase(unittes... |
# SOLUTION 1
# Nth Fibonacci
# Complexity
# Average: Time: | Space:
# Worst: Time: | Space: |
import requests, sys, os, random
from bs4 import BeautifulSoup
SERVER = sys.argv[1]
# SERVER = 'http://d39e092608f9769e2696bf07d987072b4b2dd1dc9bce5e0151910fc276ae.project.ssof.rnl.tecnico.ulisboa.pt/'
session = requests.session()
# Random user credentials
user = str(random.randint(2**27, 2**28))
password = str(ran... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
# 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 ... |
class PrinterError(RuntimeError):
pass
class Printer:
def __init__(self, pages_per_s: int, capacity: int):
self.pages_per_s = pages_per_s
self._capacity = capacity
def print(self, pages):
if pages > self._capacity:
raise PrinterError('Printer does not have enough c... |
# -*- coding: utf-8 -*-
"""
定义一个求平均值的协程,让它返回一个结果
A coroutine to compute a running average.
Testing ``averager`` by itself::
# BEGIN RETURNING_AVERAGER_DEMO1
>>> coro_avg = averager()
>>> next(coro_avg)
>>> coro_avg.send(10) # <1>
>>> coro_avg.send(30)
>>> coro_avg.send(6.5)
>>> coro_avg.send... |
#!/usr/bin/env python
import curses, sys, time
import global_mod as g
import monitor
import process
import hotkey
import splash
def check_window_size(interface_queue, state, window, min_y, min_x, max_y, max_x):
# TODO: use SIGWINCH interrupt
if (state['y'], state['x']) != window.getmaxyx():
new_y, ne... |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Smoke tests for gclient.py.
Shell out 'gclient' and run basic conformance tests.
This test assumes GClientSmokeBase.URL_BASE i... |
#!/usr/bin/env python3
import sys
import traceback
from os import makedirs
from os.path import basename, splitext
from os.path import join as pjoin
from catas import parsers
from catas.parsers import FileType
from catas.parsers import ParseError
from catas.cli import MyArgumentError
from catas.gentest.cli import cli... |
from py_crypto_hd_wallet.monero.hd_wallet_monero_enum import (
HdWalletMoneroWordsNum, HdWalletMoneroLanguages, HdWalletMoneroCoins,
HdWalletMoneroDataTypes, HdWalletMoneroKeyTypes
)
from py_crypto_hd_wallet.monero.hd_wallet_monero_factory import HdWalletMoneroFactory
from py_crypto_hd_wallet.monero.hd_wallet_m... |
"""
With these settings, tests run faster.
"""
from .base import * # noqa
from .base import env
# GENERAL
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
SECRET_KEY = env(
"DJANGO_SECRET_KEY",
default="HKGOtkvd6... |
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
from cms.models import Page
from cms.utils.page_permissions import user_can_add_page, user_can_add_subpage
from .wizards.wizard_pool import wizard_pool
from .wizards.wizard_base import Wizard
from .forms.wizards import CreateCMSPageForm,... |
class A:
pass
a = A()
print(a.f<caret>oo)
def func(c):
x = A() if c else None
return x.foo
# Sentinel reference to make sure that other warnings are still present
<error descr="Unresolved reference 'UNRESOLVED'">UNRESOLVED</error> |
# (2) 영상 처리 및 이미지 기반의 데이터 분석 통합 GUI 툴
# --> RAW, GIF, JPG, PNG, BMP, TIF 영상 데이터 분석 및 처리
# --> 영상 데이터와 CSV, SQLite, MySQL, XLS 저장 및 로딩 기능 지원
# --> Image Processing 알고리즘 (화소점, 화소영역, 기하학 등)
# --> 히스토그램을 통한 데이터 분석 및 영상 개선 알고리즘
# --> 대량의 영상 빅데이터 자동변환 기능 (자동화)
## 라이브러리
from tkinter import *
from tkinter.filedialog impo... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import contextlib
import os
import random
import time
from collections import defaultdict, deque
from typing import Any,... |
"""
Copyright 2020 The OneFlow 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 applicable law or agr... |
import os, glob, platform
#find out if we're running on mac or linux and set the dynamic library extension
dylib_ext = ""
if platform.system().lower() == "darwin":
dylib_ext = ".dylib"
else:
dylib_ext = ".so"
print("Running on " + platform.system())
#make sure the release folder exists, and cl... |
import angr
import claripy
import archinfo
import unittest
from angr.sim_type import SimTypePointer, SimTypeFunction, SimTypeChar, SimTypeInt, parse_defns
from angr.errors import AngrCallableMultistateError
import logging
l = logging.getLogger("angr_tests")
import os
from common import slow_test, bin_location as loc... |
from qutip import *
import numpy as np
import scipy as sc
import matplotlib.pyplot as plt
import time
## this is for spcific configurations, default set to false
parallel_active = False
if parallel_active == True:
from qutip.parallel import parfor, parallel_map, serial_map
# Example: a spin chain with temperature... |
#
# This file is part of LiteX.
#
# Copyright (c) 2013-2015 Sebastien Bourdeauducq <sb@m-labs.hk>
# Copyright (c) 2014-2019 Florent Kermarrec <florent@enjoy-digital.fr>
# Copyright (c) 2017-2019 Tim 'mithro' Ansell <me@mith.ro>
# Copyright (c) 2018 William D. Jones <thor0505@comcast.net>
# Copyright (c) 2019 Antmicro <... |
from collections import OrderedDict
from fwgen import fwgen
class OrderedDefaultDict(OrderedDict):
"""
Helper class for ordered default dicts
"""
def __missing__(self, key):
val = self[key] = OrderedDefaultDict()
return val
class TestFwGen(object):
def test_zone_expansion(self):
... |
# - Generated by tools/entrypoint_compiler.py: do not edit by hand
"""
Transforms.ImagePixelExtractor
"""
import numbers
from ..utils.entrypoints import EntryPoint
from ..utils.utils import try_set, unlist
def transforms_imagepixelextractor(
column,
data,
output_data=None,
model=None... |
# Copyright 2015 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... |
def power_canon(expr, args):
# u = log x; x^p --> exp(u^p) --> log(exp(u^p)) = p * u
return expr.p * args[0], []
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.