text stringlengths 2 999k |
|---|
# Generated by Django 3.2.4 on 2021-06-26 12:40
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Pet',
fields=[
('id', models.BigAutoField(a... |
import os
from glob import glob
from binascii import unhexlify
contracts = {
"Forward": {
"version": "v1.0-RC1",
"abi": '[{"constant":false,"inputs":[{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type"... |
_base_ = [
'../_base_/datasets/coco_with_sub_image_detection.py',
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
]
sub_images = [
'default.png',
# 'filled.png'
]
rpn_weight = 0.7
# use caffe img_norm
img_norm_cfg = dict(
mean=[103.530, 116.280, 123.675], std=[1.0, 1.0, 1.0], to... |
#!/usr/bin/env python
#coding:utf-8
# Author: mozman --<mozman@gmx.at>
# Purpose: gradients module
# Created: 26.10.2010
# Copyright (C) 2010, Manfred Moitzi
# License: MIT License
"""
Gradients consist of continuously smooth color transitions along a vector
from one color to another, possibly followed by additional t... |
from collections import deque
string = deque(input())
stack = []
result = "YES"
while string:
symbol = string.popleft()
if symbol in '{[(':
stack.append(symbol)
else:
try:
popped_symbol = stack.pop()
except:
result = "NO"
break
if (popped... |
# -*- coding: utf-8 -*-
# Copyright (c) 2006-2013, Alexis Royer, http://alexis.royer.free.fr/CLI
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code mus... |
# Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information regarding
# copyright ownership. The Modin Development Team licenses this file to you under the
# Apache License, Version 2.0 (the "License"); you may not u... |
import argparse
import os
import numpy as np
from tqdm import tqdm
from ipdb import set_trace
from mypath import Path
from dataloaders import make_data_loader
from modeling.sync_batchnorm.replicate import patch_replication_callback
from modeling.deeplab import *
from modeling.unet import *
from utils.loss import Segmen... |
# Copyright 2018 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 law or agreed to in writing, ... |
# Generated by Django 2.1.7 on 2019-03-13 13:17
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0003_ingredient'),
]
operations = [
migrations.CreateModel(
... |
# -*- coding: utf-8 -*-
class MetaSingleton(type):
def __call__(cls, *args, **kwargs):
if not cls.__dict__.get("_instance"):
cls._instance = cls.__new__(cls, *args)
cls._instance.__init__(*args, **kwargs)
return cls._instance
class Singleton(object):
__metaclass__ = MetaSingleton
@classmethod
def Inst... |
from IPython.core.display import HTML, SVG
import pandas as pd
import numpy as np
import xport
import IPython
from ipywidgets import Layout
from ipywidgets import widgets
from IPython.display import display
import matplotlib.ticker as ticker
import matplotlib.cm as cm
import matplotlib as mpl
from matplotlib.gridspec ... |
#!/usr/bin/env python3
import calendar
import datetime
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import logging
import smtplib
import collections
import Constants
def sendmail(topic, alert, message, always_email=Constants.ALWAYS_EMAIL):
today = datetime.datetime.today()
da... |
from rtamt.operation.abstract_operation import AbstractOperation
import rtamt.operation.stl.dense_time.offline.intersection as intersect
class ImpliesOperation(AbstractOperation):
def __init__(self):
self.left = []
self.right = []
self.last = []
def update(self, *args, **kargs):
... |
#!/usr/bin/env python
# this shebang uses the python that is currently activated
import glob
import subprocess
import os
import sys
import psutil
vr_base_glob = os.getenv('VR_BASE')
sys.path.append('%s/bluebird' % vr_base_glob)
import load_config as lc
def get_accounts():
"""
extract all existing account na... |
from datetime import datetime
from pprint import pprint
import networkx as nx
import pytest
import helpers
from cargonet.constants.numbers import (
MININT,
STATUS_ARRIVAL,
STATUS_DEPARTURE,
STATUS_DRIVE_THROUGH,
)
from cargonet.preprocessing.graphs.tgraph import TransportGraph
@pytest.fixture
def st... |
# Copyright 2016 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 applicable ... |
from aiogram.types import Message
from aiogram.types import ChatType
from bot.platforms.telegram import dispatcher
from bot.platforms.telegram import guards
from bot.utilities.types import Command
@dispatcher.message_handler(
lambda message:
message.chat.type == ChatType.PRIVATE and
guards[messa... |
from __future__ import absolute_import, print_function, division
from getpass import getuser
import pytest
sa = pytest.importorskip('sqlalchemy')
pytest.importorskip('pymysql')
from odo import odo, drop, discover
import pandas as pd
import numpy as np
from blaze import symbol, compute
from blaze.utils import exam... |
import copy
import gc
import os
import random
import time
from multiprocessing import Process, Queue
from threading import Thread
import numpy as np
import pytest
import redis
from atom import AtomError, Element, MetricsLevel, SetEmptyError
from atom.config import (
ATOM_CALLBACK_FAILED,
ATOM_COMMAND_NO_ACK,
... |
from typing import Dict, Any, Optional
import ray.cloudpickle as pickle
from ray.serve.common import (BackendTag, EndpointInfo, EndpointTag,
TrafficPolicy)
from ray.serve.long_poll import LongPollNamespace
from ray.serve.kv_store import RayInternalKVStore
from ray.serve.long_poll import L... |
from django.test import TestCase
from sponsoring.models import SponsoringPackage
class SponsoringPackageTest(TestCase):
def test_css_class(self):
package = SponsoringPackage(package_type=1)
self.assertEqual(package.css_class, 'gold')
package = SponsoringPackage(package_type=2)
sel... |
import pdf_to_json as p2j
import json
url = "file:data/multilingual/Cyrl.KOI/Serif_8/udhr_Cyrl.KOI_Serif_8.pdf"
lConverter = p2j.pdf_to_json.pdf_to_json_converter()
lConverter.mImageHashOnly = True
lDict = lConverter.convert(url)
print(json.dumps(lDict, indent=4, ensure_ascii=False, sort_keys=True))
|
"""distutils.core
The only module that needs to be imported to use the Distutils; provides
the 'setup' function (which is to be called from the setup script). Also
indirectly provides the Distribution and Command classes, although they are
really defined in distutils.dist and distutils.cmd.
"""
__revision__ ... |
from typing import TYPE_CHECKING, no_type_check
import logging
from qtpy.QtCore import QEvent, QPoint, QSize, Qt, Signal
from qtpy.QtGui import QContextMenuEvent, QCursor, QFontMetrics, QIcon, QMouseEvent
from qtpy.QtWidgets import (QBoxLayout, QFrame, QLabel, QMenu, QSizePolicy,
QStyle, QW... |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import copy
from functools import reduce
from typing import Tuple, Dict, Optional, List,... |
#! /usr/bin/env python3
# This was forked from https://github.com/rustyrussell/lightning-payencode/tree/acc16ec13a3fa1dc16c07af6ec67c261bd8aff23
import re
import time
from hashlib import sha256
from binascii import hexlify
from decimal import Decimal
from typing import Optional, TYPE_CHECKING, Type
import random
impo... |
import io
import operator
import pytest
import hypothesis as h
import hypothesis.strategies as hs
import amqpframe.types as at
from . import strategies
ALL_TYPES = at.BaseType.__subclasses__()
NUMERIC_TYPES = (
at.SignedByte,
at.UnsignedByte,
at.SignedShort,
at.UnsignedShort,
at.SignedLong,
... |
from detectem.plugin import Plugin
from .helpers import meta_generator
class WordpressPlugin(Plugin):
name = 'wordpress'
homepage = 'https://wordpress.org/'
tags = ['wordpress']
matchers = [
{'url': r'/wp-includes/js/wp-embed.min.js\?ver=(?P<version>[0-9\.]+)'},
{'xpath': (meta_gener... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
http://www.scipy.org/Cookbook/Least_Squares_Circle
"""
from numpy import *
# Coordinates of the 2D points
# x = r_[ 9, 35, -13, 10, 23, 0]
# y = r_[ 34, 10, 6, -14, 27, -10]
x = r_[36, 36, 19, 18, 33, 26]
y = r_[14, 10, 28, 31, 18, 26]
# R0 = 25
# nb_pts ... |
"""Provide default settgins"""
from pathlib import Path
BIOPIPEN_DIR = Path(__file__).parent.parent.resolve()
REPORT_DIR = BIOPIPEN_DIR / "reports"
SCRIPT_DIR = BIOPIPEN_DIR / "scripts"
|
import csv
from django.core.management import BaseCommand
from extlinks.links.models import URLPattern
from extlinks.organisations.models import Organisation, Collection
from extlinks.programs.models import Program
class Command(BaseCommand):
help = """
Imports Programs, Orgs, Collections, and URLPat... |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 7
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from isi_sdk_8_2_0.models.event_e... |
# -*- coding: utf-8 -*-
# BioSTEAM: The Biorefinery Simulation and Techno-Economic Analysis Modules
# Copyright (C) 2020, Yoel Cortes-Pena <yoelcortes@gmail.com>
#
# This module is under the UIUC open-source license. See
# github.com/BioSTEAMDevelopmentGroup/biosteam/blob/master/LICENSE.txt
# for license details.
"""... |
from django.contrib import admin
# Register your models here.
from animal_care.models import Animal
admin.site.register(Animal)
|
"""IIR and FIR filtering and resampling functions."""
from copy import deepcopy
from functools import partial
import numpy as np
from .annotations import _annotations_starts_stops
from .io.pick import _picks_to_idx
from .cuda import (_setup_cuda_fft_multiply_repeated, _fft_multiply_repeated,
_setu... |
import pandas as pd
from utils.exceptions import WrongDataFrameSize, NoScanAvailable
from IPython.core.debugger import Tracer; debughere = Tracer()
import json
def pop_all(l):
r, l[:] = l[:], []
return r
def extract_scan(df ,ip="",protocol='tcp'):
no_scan = []
if ip:
scan = df[df["ip"] == i... |
# http://www.nhc.noaa.gov/data/hurdat/hurdat2-format-atlantic.pdf
storms = {'WV':'Tropical Wave','HU':'Hurricane','TS':'Tropical Storm',
'EX':'Extratropical','SD':'Subtropical Depression',
'TD':'Tropical Depression',
'SS':'Subtropical storm','DB':'Disturbance','LO':'Low'}
events = {'L':'Landfa... |
from to_import2 import return_func
def func():
return return_func
|
import datetime
from nose.tools import assert_equal
from bushel.monitoring import OK, WARNING, CRITICAL, UNKNOWN
from bushel.monitoring import oldest_datetime
from bushel.monitoring import utc_datetime_too_old
def test_oldest_datetime():
dts = {
"millenium": datetime.datetime(2000, 1, 1),
"endof... |
#
# Copyright 2018 Analytics Zoo 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... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
Provides:
- List; like list but returns None instead of IndexOutOfBounds
- Storage; like dictionary allowi... |
#!/usr/bin/python3
# *****************************************************************************
#
# 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 ... |
import pytest
pytest.importorskip("ipywidgets")
from ipykernel.comm import Comm
from ipywidgets import Widget
from distributed.compatibility import WINDOWS
#################
# Utility stuff #
#################
# Taken from ipywidgets/widgets/tests/test_interaction.py
# https://github.com/ipython/ipywidg... |
import pygame
from src.game_objects.game_object import GameObject
class Dynamic(GameObject):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.dx = 0
self.dy = 0
def draw(self):
super().draw()
def update(self):
s... |
# Copyright 2012 Grid Dynamics
# Copyright 2013 Inktank Storage, Inc.
# Copyright 2014 Mirantis, 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.or... |
import copy
import strutture_dati
from strutture_dati import *
import CreaReteJSON as conv_json
def diagnosiLineare(diagnosicatore, osservazione, stampare):
stampa = ""
for label in osservazione:
label_esistente = False
for cammino in diagnosicatore.lista_cammini:
if cammino.oss ==... |
"""The oem component."""
|
# -*- coding: utf-8 -*-
import logging
import time
from typing import Type
from examples.utils import add_to_eastmoney
from zvt import zvt_config
from zvt.api import get_top_volume_entities
from zvt.api.kdata import get_latest_kdata_date
from zvt.contract import AdjustType
from zvt.contract.api import get_entities, ge... |
# -*- coding: utf-8 -*-
###############################################################################
#
# UpdateCallerID
# Updates an existing caller id.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file e... |
"""
mixins.py defines custom classes that our endpoints can use to filter/lookup objects.
"""
from django.shortcuts import get_object_or_404
class MultipleFieldLookupMixin(object):
"""
Apply this mixin to any view or viewset to get multiple field filtering
based on a `lookup_fields` attribute, instead of the def... |
"""
BenchExec is a framework for reliable benchmarking.
This file is part of BenchExec.
Copyright (C) 2007-2015 Dirk Beyer
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
... |
import csv
import json
class PathFinder:
def __init__(self, departure, destination):
self.departure = departure
self.destination = destination
self.parseTimeTable()
def findFastest(self, trips):
fastest = {"notFound" : True, "duree": 9999999}
for trip in self.findEver... |
"""
General projector code.
Functions that handel the registration of projector elements and the rendering
of the data to present it on the projector.
"""
from typing import Any, Callable, Dict, List
from .cache import element_cache
AllData = Dict[str, Dict[int, Dict[str, Any]]]
ProjectorElementCallable = Callabl... |
#!/usr/bin/env python3
# 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, softwar... |
# coding=utf-8
from __future__ import unicode_literals
from .. import Provider as InternetProvider
class Provider(InternetProvider):
user_name_formats = (
'{{last_name_female}}.{{first_name_female}}',
'{{last_name_male}}.{{first_name_male}}',
'{{last_name_male}}.{{first_name_male}}',
... |
# -*- coding: utf-8 -*-
"""
create on 2019-03-20 04:19
author @lilia
"""
from sklearn.neural_network import MLPClassifier
from analysis_llt.ml.cv.base import BaseCV
class MLPClassifierCV(BaseCV):
def __init__(self, hidden_layer_sizes=(100,), learning_rate_init=0.001, cv=None, random_state=None, verbose=0,
... |
import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import logging, math, multiprocessing, random
import numpy as np
import tensorflow as tf
import sklearn
import sklearn.manifold.t_sne as tsne
from collections import defaultdict, OrderedDict
def calc_sims(latents):
'''C... |
import itertools
from distutils.version import LooseVersion
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.colors import to_rgb, to_rgba
import pytest
from numpy.testing import assert_array_equal, assert_array_almost_equal
from .. import distributions as dist
from ..palet... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import time
import os
import tempfile
import shutil
import random
import codecs
from pabot import pabot
from robot.utils import PY2
from robot import __version__ as ROBOT_VERSION
s = pabot.SuiteItem
t = pabot.TestItem
class PabotTests(unittest.TestCase):
... |
from os.path import basename as _basename
from molsysmt.utils.exceptions import *
from molsysmt.native.topology import Topology as molsysmt_Topology
form_name=_basename(__file__).split('.')[0].replace('api_','').replace('_','.')
is_form={
molsysmt_Topology : form_name,
'molsysmt.Topology': form_name
}
info=[... |
# The system is developed for Virushack hackathon
# It allows to work with self-service ticket office via voise commands
from random import random
import threading
import time
import random
from text_to_command_conversion.command_to_kos import ThereIsNoProductWithCurrentName, TryOneMoreTime
from text_to_command_conv... |
"""
Copyright 2015, Institute for Systems Biology
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 w... |
import os
from itertools import count
from pathlib import Path
from typing import cast
from fastapi import FastAPI
from piccolo.columns import Integer, Text
from piccolo.conf.apps import AppConfig, AppRegistry
from piccolo.engine import SQLiteEngine, engine_finder
from piccolo.table import Table
from pytest import fix... |
"""This module contains the general information for DhcpAcquired ManagedObject."""
import sys, os
from ...ucsmo import ManagedObject
from ...ucscoremeta import UcsVersion, MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class DhcpAcquiredConsts():
pass
class DhcpAcquired(ManagedObject):
"""This i... |
import pygame
from statemachine import StateMachine
WINDOW_WIDTH = 800
WINDOW_HEIGHT = 600
SCREEN = pygame.display.set_mode((WINDOW_WIDTH, WINDOW_HEIGHT))
pygame.display.set_caption("Flappy Bird")
clock = pygame.time.Clock()
# C R G B
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
BLUE = (0, 0, 255)
GREEN = (0, ... |
import numpy as np
from scipy import linalg
import compound_poisson
import dataset
def main():
downscale = compound_poisson.Downscale(dataset.AnaDual10Training())
precision_array = np.linspace(250, 300, 50)
for precision in precision_array:
cov_chol = downscale.square_error.copy()
cov_cho... |
# 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 ... |
# coding: utf-8
"""
Influx API Service
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: 0.1.0
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
class Anal... |
# Copyright (c) Microsoft. All Rights Reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
# TODO: baselining (see json.py)
# TODO: Handle manager.agg_type (see json.py)
# TODO: Run pylint or any tool that detects Py2/Py3 differences.
import datetime
import j... |
from __future__ import print_function, unicode_literals
import json
from wee_slack import SlackTS, command_reply
parent_ts = SlackTS("1485975824.000004")
child_ts = SlackTS("1485975835.000005")
def test_replying_to_child_should_use_parent_ts(
realish_eventrouter, team, channel_general
):
datafiles = [
... |
# This module is adapted from https://github.com/mahyarnajibi/FreeAdversarialTraining/blob/master/main_free.py
# Which in turn was adapted from https://github.com/pytorch/examples/blob/master/imagenet/main.py
import init_paths
import argparse
import os
import time
import sys
import torch
import torch.nn as nn
import to... |
import matplotlib.pyplot as plt; import importlib; importlib.reload(plt)
plt.clf()
import numpy as np
import pandas as pd
# Any Dataset
df = pd.read_csv('.csv', index_col = 0)
gdp_cap = list(df.gdp_cap)
life_exp = list(df.life_exp)
pop = list(df['population']/1e6)
cont = list(df.cont)
lut = {
'Asia':'red... |
# -*- coding: utf-8 -*-
from rf4ce import Rf4ceNode, Rf4ceFrame, Rf4ceConstants, Rf4ceException
from linkconfig import LinkConfig
from scapy.all import Dot15d4FCS, Dot15d4Data, Raw, makeFCS
# Keep scapy from parsing the RF4CE payload
Dot15d4Data.payload_guess = [({}, Raw)]
import scapy.config
from scapy.themes impor... |
# Generated by Django 3.2 on 2021-05-04 16:29
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
opera... |
import os
import shutil
import argparse
import random
import math
from libs.RegularLDPC import RegularLDPC
from libs.ProtographLDPC import ProtographLDPC
from libs.Protograph import Protograph
from libs.TannerGraph import *
def get_parser():
# argument parser
parser = argparse.ArgumentParser(description='Inp... |
sum=0
# Ask user to enter the number
num=int(input("Enter a number:"))
temp=num
# Using while loop
while(num):
i=1
fact=1
rem=num%10
while(i<=rem):
fact=fact*i # Find factorial of each number
i=i+1
sum=sum+fact
num=num//10
if(sum==temp):
print... |
"""
@author: Gabriele Girelli
@contact: gigi.ga90@gmail.com
@description: methods for batching
"""
import gzip
import itertools
import logging
import multiprocessing as mp
import os
import tempfile
from enum import Enum
from typing import IO, Any, List, Optional, Tuple, Type, Union
import oligo_melting as om # type:... |
# Copyright Hybrid Logic Ltd. See LICENSE file for details.
"""
Effectful interface to packaging tools.
"""
import requests
from requests_file import FileAdapter
from characteristic import attributes
from effect import sync_performer, TypeDispatcher
from subprocess import check_call, check_output
from gzip import Gz... |
from math import acos, degrees, hypot
def CalcAngle(P1, P2):
if P2[0] < P1[0]:
return 360 - degrees(
acos((P2[1] - P1[1]) * 1.0 / hypot(P2[0] - P1[0], P2[1] - P1[1]))
)
return round(
degrees(acos((P2[1] - P1[1]) * 1.0 / hypot(P2[0] - P1[0], P2[1] - P1[1]))), 0
)
def C... |
import gdspy
import numpy as np
from copy import deepcopy
from spira.core.transforms import *
from spira.yevon import constants
from spira.yevon.gdsii.elem_list import ElementList
from spira.yevon.gdsii.group import Group
from spira.yevon.gdsii.polygon import __ShapeElement__
from spira.yevon.geometry import shapes
fr... |
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Valiant Systems and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class Flats(Document):
pass
|
load("//:defs.bzl", _jest_node_test = "jest_node_test")
def jest_node_test(name, srcs, deps = [], **kwargs):
_jest_node_test(
name = name,
srcs = srcs,
deps = deps + [
"@jest_node_test_example_deps//jest-cli",
"@jest_node_test_example_deps//fs-extra",
],
... |
from pygraphblas import Matrix, BOOL, semiring
from typing import Dict, Tuple, List
from src.Graph import Graph
class AdjMatrix:
def __init__(self, graph):
self.M_dict: Dict[str, Tuple[List[int], List[int]]] = {}
self.M_bin: Dict[str, Matrix] = {}
self.graph: Graph = graph
self.gra... |
import io
import os
from setuptools import setup
from setuptools.command.test import test as TestCommand
import sys
import pyasq
here = os.path.abspath(os.path.dirname(__file__))
def read(*filenames, **kwargs):
encoding = kwargs.get('encoding', 'utf-8')
sep = kwargs.get('sep', '\n')
buf = []
for fil... |
from __future__ import print_function, division
from mpmath.libmp.libmpf import prec_to_dps
from sympy.core.add import Add
from sympy.core.basic import Basic
from sympy.core.expr import Expr
from sympy.core.function import expand_mul
from sympy.core.power import Pow
from sympy.core.symbol import (Symbol, Dummy, symbo... |
import numpy as np
class ExplorationExploitationScheduler(object):
def __init__(self, DQN, n_actions, eps_initial=1, eps_final=0.1, eps_final_frame=0.01,
eps_evaluation=0.0, eps_annealing_frames=1000000,
replay_memory_start_size=50000, max_frames=25000000, cutoff_frame=50000):
... |
import aioredis
import pytest
from aioredis import Redis
@pytest.fixture
async def redis_connection_string(request, worker_id):
base_connection_string = request.config.getoption("redis_connection_string")
number = 0 if worker_id == "master" else int(worker_id[2:])
return f"{base_connection_string}/{numbe... |
import serial
import matplotlib.pyplot as plt
import numpy as np
import time
pd = "/dev/tty.wchusbserial1410"
#pd = "/dev/tty.usbmodem1421"
p = serial.Serial(port=pd, baudrate=115200,
bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE)
p.flush()
time.sleep(0.5)
#plt.axis([0, 10, 0, 1])
plt.ion()
s... |
import pytest
import os
import tempfile
import traceback
from mitmproxy import options
from mitmproxy import exceptions
from mitmproxy.http import HTTPFlow
from mitmproxy.websocket import WebSocketFlow
from mitmproxy.proxy.config import ProxyConfig
from mitmproxy.net import tcp
from mitmproxy.net import http
from ...... |
import socket
from threading import Thread
socketList = []
def waitConnect(s):
"""
cmd format --> # -H $IP -p $PORT -c <start|stop>
"""
while True:
sock, addr = s.accept()
if sock not in socketList:
socketList.append(sock)
def sendCmd(cmd):
print("Send command......"... |
handle = '20141103\ All\ IRD'
def get_header(n_nodes):
header = '\
#!/bin/sh \n\
#$ -S /bin/sh \n\
#$ -cwd \n\
#$ -V\n\
#$ -m e\n\
#$ -M ericmjl@mit.edu \n\
#$ -pe whole_nodes {0}\n\
#$ -l mem_free=2G\n\
#############################################\n\n'.format(n_nodes)
return header
import os
import pickle as pkl... |
from . import options
from .semantics import *
NAME = 'core'
MUTATORS = [
'constants', 'erase-children', 'merge-children', 'replace-by-variable', 'sort-children', 'substitute-children', 'top-level-binary-reduction'
]
class Constants:
"""Replaces any node by a constant."""
def mutations(self, node):
... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from .extension import *
class BottleneckM(nn.Module):
def __init__(self, in_planes, out_planes, stride, groups):
super(BottleneckM, self).__init__()
self.stride = stride
mid_planes = out_planes // 4
g = 1 if in_pla... |
"""
This module contains some additional logging functionality on top of the
standard python logging library that could be useful for applications.
"""
import os
import sys
import socket
import logging
from logging.handlers import SysLogHandler
class ResilientSysLogHandler(SysLogHandler):
"""
A resilient sy... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... |
# model settings
model = dict(
type='FasterRCNN',
pretrained='open-mmlab://resnet50_caffe',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=False),
norm_eval=True,
... |
from django.conf.urls import url
from siptrackweb import views
from siptrackweb.views import root
from siptrackweb.views import display
from siptrackweb.views import view
from siptrackweb.views import attribute
from siptrackweb.views import template
from siptrackweb.views import counter
from siptrackweb.views import ne... |
import asyncio
import dataclasses
import logging
import multiprocessing
from concurrent.futures.process import ProcessPoolExecutor
from enum import Enum
from typing import Dict, List, Optional, Set, Tuple, Union
from clvm.casts import int_from_bytes
from chives.consensus.block_body_validation import validate_block_bo... |
#!/usr/bin/python
#
# Copyright 2020 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.