text stringlengths 1 927k |
|---|
# -*- 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
#... |
import pandas as pd
import numpy as np
def replace_outliers(data, columns):
'''
Quantile-based Flooring and Capping
'''
df = data.copy()
for column in columns:
ten_percentile = (df[column].quantile(0.10))
ninety_percentile = (df[column].quantile(0.90))
... |
# Copyright: (c) 2008, Jarek Zgoda <jarek.zgoda@gmail.com>
__revision__ = "$Id: models.py 28 2009-10-22 15:03:02Z jarek.zgoda $"
import datetime
import secrets
from base64 import b32encode
from typing import List, Mapping, Optional, Union
from urllib.parse import urljoin
from django.conf import settings
from django.c... |
# 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 2.3.33.0
# ... |
# coding=utf-8
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
from ipaddress import AddressValueError
from unittest import TestCase
from qrl.core.misc import logger
from qrl.core.misc.helper import parse_peer_addr
logger.initial... |
import os
import sys
import pytest
from cellfinder.train.train_yml import main as train_run
data_dir = os.path.join(
os.getcwd(), "tests", "data", "integration", "training"
)
cell_cubes = os.path.join(data_dir, "cells")
non_cell_cubes = os.path.join(data_dir, "non_cells")
training_yml_file = os.path.join(data_dir... |
from __future__ import print_function
import sys
import pytest
import hunter
from hunter import And
from hunter import Backlog
from hunter import CallPrinter
from hunter import CodePrinter
from hunter import Debugger
from hunter import From
from hunter import Manhole
from hunter import Not
from hunter import Or
from... |
"""
Manage Galaxy eggs
"""
import ConfigParser
import glob
import HTMLParser
import os
import pkg_resources
import shutil
import sys
import urllib
import urllib2
import zipfile
import zipimport
import logging
log = logging.getLogger( __name__ )
log.addHandler( logging.NullHandler() )
galaxy_dir = os.path.abspath( o... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... |
from dataclasses import dataclass
from typing import Tuple
from command.command_bus import CommandBus
from command.command_handler import CommandHandler, Command, Status
from event.event_store import Event
@dataclass
class SimpleCommand(Command):
name: str
@dataclass
class SimpleCommandExecuted(Event):
def... |
import unittest
import os
import json
from programy.extensions.geocode.geocode import GeoCodeExtension
from programy.utils.geo.google import GoogleMaps
from programy.context import ClientContext
from programytest.aiml_tests.client import TestClient
class MockGoogleMaps(GoogleMaps):
def __init__(self, data_file... |
"""
Django settings for SRC project.
Generated by 'django-admin startproject' using Django 2.2.14.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os
# Bu... |
import torch
import torch.nn.functional as F
import numpy as np
import matplotlib.pyplot as plt
import torch.nn as nn
import torch.optim as optim
x = torch.unsqueeze(torch.linspace(-1, 1, 100), dim=1)
y = x.pow(2) + 0.2 * torch.rand(x.size())
# plt.scatter(x.numpy(), y.numpy())
# plt.show()
class Net(nn.Module):
... |
# coding: utf-8
"""
Pure Storage FlashBlade REST 1.8.1 Python SDK
Pure Storage FlashBlade REST 1.8.1 Python SDK, developed by [Pure Storage, Inc](http://www.purestorage.com/). Documentations can be found at [purity-fb.readthedocs.io](http://purity-fb.readthedocs.io/).
OpenAPI spec version: 1.8.1
Cont... |
#!/bin/python
# helper script to regenerate helm chart file: partial of charts/cert-management/templates/deployment.yaml
import re
options = """
cert-class
cert-target-class
controllers
cpuprofile
default-issuer
default-issuer-domain-ranges
disable-namespace-restriction
dns
dns-namespace
dns-owner-id
dns.id
help
in... |
import numpy as np
from ..helpers import *
import pytest
from hail.utils.java import FatalError, HailUserError
setUpModule = startTestHailContext
tearDownModule = stopTestHailContext
def assert_ndarrays(asserter, exprs_and_expecteds):
exprs, expecteds = zip(*exprs_and_expecteds)
expr_tuple = hl.tuple(exprs)... |
from django.test import TestCase
from graphql_jwt.path import PathDict, filter_strings
class FilterStringsTests(TestCase):
def test_filter_strings(self):
items = filter_strings(['0', '1', 0, '2'])
self.assertIsInstance(items, tuple)
self.assertNotIn(0, items)
class PathDictTests(TestC... |
import numpy as np
def plot(b,d,C,t,x1,y1,x2,y2,fn, show_solution=False):
'''
This function finds solutions.
b,d : boundary conditions,
C : thermal diffusivity
t : time
x2-x1 : size of a square in X direction,
y2-y1 : size of the square in Y direction,
fn : initial condition
'''
impo... |
"""personal_portfolio URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
... |
# Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework 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
... |
from django.urls import path
from clxquery import views
urlpatterns = [path("clxquery/<str:query>", views.run_query)] |
from __future__ import absolute_import
from datetime import timedelta
from django.utils import timezone
from rest_framework.response import Response
from sentry.api.base import Endpoint
from sentry.api.permissions import assert_perm
from sentry.api.serializers import serialize
from sentry.models import Group, GroupSt... |
import random
def max_sum_subarray(arr):
max_found = None
current_range_sum = 0
for val in arr:
current_range_sum += val
max_found = max(max_found, current_range_sum)
# if a current_range has gotten to be negative,
# we reset the current_range_sum to 0 because
# the next contiguous subar... |
from db_utils import read_select, get_temptable,\
insert_temp_ret_table, drop_temp_table
from weights import get_portfolio_weights, get_single_ticker_weight
from pandas import DataFrame
import pandas as pd
def load_constituent_prices(ticker, db):
q = """
SELECT *
FROM eq_prices... |
"""Generated code. Do not edit.""" |
#!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
def logistic(r=2.0, N=100):
xs = 0.5*np.ones(N)
for i in np.arange(N-1):
xs[i+1] = r*xs[i]*(1.0-xs[i])
return xs
fig, axes = plt.subplots(2, 2)
axes[0, 0].plot(logistic(2.7), 'bo')
axes[1, 0].plot(logistic(3.1), 'ro')
axes[... |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/stable/config
# -- Path setup ------------------------------------------------------------... |
"""
Custom logging module for scripts
Copyright (c) 2018-2020 Qualcomm Technologies, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met:
Redistr... |
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
import pytest # noqa: F401
import numpy as np # noqa: F401
import awkward as ak # noqa: F401
to_list = ak._v2.operations.convert.to_list
def test_broadcast_arrays():
a = ak._v2.Array([[1.1, 2.2, 3.3], [], [4.4, 5.5]], che... |
import numpy as np
import matplotlib.pyplot as plt
dfile = '/home/jujuman/Research/SingleNetworkTest/train_05/diffs.dat'
f = open(dfile, 'r')
for l in f:
diffs = np.array(l.split(','),dtype=np.float)
plt.scatter(np.arange(diffs.size), diffs, color='black', label='DIFF', linewidth=1)
plt.show() |
#!/usr/bin/env python
"""
randbot.py
An example Tron bot which moves in a random direction.
There's a lot of tricky stuff going on behind the scenes
here which you can probably mostly ignore. On each turn,
this program will read an entire board position from stdin
(which is supplied by the engine that runs it), and t... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: service_spec.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobu... |
import pytest
import logging
from dtest import Tester
from tools.assertions import assert_all
since = pytest.mark.since
logger = logging.getLogger(__name__)
@pytest.mark.upgrade_test
class TestCompatibilityFlag(Tester):
"""
Test 30 protocol compatibility flag
@jira CASSANDRA-13004
"""
def _com... |
"""
Django settings for app project.
Generated by 'django-admin startproject' using Django 2.1.15.
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
# Bu... |
"""
This module contains the google asr speech recognizer
"""
import logging
from queue import Queue
from threading import Thread
from typing import Any, Generator, Union
import numpy as np
from google.cloud import speech
from google.oauth2 import service_account
from spokestack.context import SpeechContext
_LOG = l... |
import pyautogui
import time
import math
import random
GLIMMER_FILE_LOC = "glimmer.png" # The local file location of the glimmer button image
GLOOM_FILE_LOC = "gloom.png" # The local file location of the gloom button image
TILE_REMOVE_LENIENCY = 5 # The maximum number of pixels different two buttons can be before the... |
#!/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.
import socket
import traceback, sys
from binascii import hexlify
import time, os
from socks5 import Socks5Conf... |
import copy
import sys
import gc
import tempfile
import pytest
from os import path
from io import BytesIO
from itertools import chain
import numpy as np
from numpy.testing import (
assert_, assert_equal, IS_PYPY, assert_almost_equal,
assert_array_equal, assert_array_almost_equal, assert_raises,
... |
"""
MIT License
Copyright (c) 2021 Suffyx
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, merge, publish, distri... |
import math
import tensorflow as tf
from .utils import base_name
class Layer(object):
def __init__(self, input_sizes, output_size, scope):
"""Cretes a neural network layer."""
if type(input_sizes) != list:
input_sizes = [input_sizes]
self.input_sizes = input_sizes
sel... |
import re
from DbxSync.CodeTransformer.LineTransformer.ImportLine import ImportLine
class ImportLineParser:
def parse(self, line):
matches = re.match('^from[ ]+([^ ]+) import ([^ ]+)$', line)
if matches is None:
return None
else:
return ImportLine(matches.group(1),... |
##===-- commandwin.py ----------------------------------------*- Python -*-===##
##
# The LLVM Compiler Infrastructure
##
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
##
##===----------------------------------------------------------------------===##
i... |
#!/usr/bin/env python
""" NumPy is the fundamental package for array computing with Python.
It provides:
- a powerful N-dimensional array object
- sophisticated (broadcasting) functions
- tools for integrating C/C++ and Fortran code
- useful linear algebra, Fourier transform, and random number capabilities
- and much... |
from typing import Type
import logging
import binascii
import os
from django.conf import settings
from django.db import models
from django.db.models.signals import pre_save
from django.dispatch import receiver
from django.utils.translation import gettext_lazy as _
from django.contrib.auth.models import Group
from r... |
"""
Created on 27 Friday feb 16:53:34 2020
@author: nkalyan🤠
Implementing Python scripts on slicing and dicing files"""
def get_line(file_name):
"""This function opens the given file and reads it and yield each number of values at a time,
or raise exception if there is no such files exis... |
import logging
import time
from functools import wraps
def logger(fn):
@wraps(fn)
def wrapper(*args, **kwargs):
start_time = time.time()
logging.debug('About to run %s' % fn.__name__)
try:
return fn(*args, **kwargs)
except Exception as error:
raise error... |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
InterlisDialog
A QGIS plugin
Interlis Import/Export
-------------------
begin : 2014-01-18
copyright : (C) 20... |
"""ANNtf2_operations.py
# Author:
Richard Bruce Baxter - Copyright (c) 2020-2022 Baxter AI (baxterai.com)
# License:
MIT License
# Installation:
see ANNtf2.py
# Usage:
see ANNtf2.py
# Description:
ANNtf operations
"""
import tensorflow as tf
import numpy as np
import ANNtf2_globalDefs
import math
debugSingleLay... |
import sympy as sp
print('Single integral computed by SymPy indefinite integral')
print('Example 1-01 indefinite integral')
print('Integral of 2xe^-x from x=1 to x=5')
x = sp.Symbol('x')
f = 2 * x * sp.exp(-x)
integral = sp.Integral(f, x)
primitive = integral.doit()
print('Primitive is ', primitive)
primitive_lambda... |
# Copyright (c) ZenML GmbH 2021. 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... |
# -*- coding: utf-8 -*-
import itertools
import logging
import bigsuds
from ..base import BasePlugin
from networkapi.plugins import exceptions as base_exceptions
from networkapi.plugins.F5 import monitor
from networkapi.plugins.F5 import node
from networkapi.plugins.F5 import pool
from networkapi.plugins.F5 import po... |
import requests
from subprocess import check_output
class TestMicrok8sBranches(object):
def test_branches(self):
"""Ensures LP builders push to correct snap tracks.
We need to make sure the LP builders pointing to the master github branch are only pushing
to the latest and current k8s sta... |
import io
import sys
import numpy as np
import tensorflow as tf
keras=tf.contrib.keras
l2=keras.regularizers.l2
SEPARABLE = 0
GROUP = 1
SHUFFLE = 2
GATED = 3
def res3d(inputs, weight_decay):
# Res3D Block 1
conv3d_1 = keras.layers.Conv3D(64, (3,7,7), strides=(1,2,2), padding='same',
dilation_... |
import sys, os
import subprocess
from git_tools import git_tools
import matplotlib.pylab as pylab
current_dir = os.getcwd()
authors_data = {}
def commit_analysis(commit_hash, initial_date):
# print("commit: " + commit_hash)
author_name_cmd = "git log -1 --pretty=format:'%an' " + commit_hash
author_name_... |
from unittest import TestCase
from pdf_annotate.util.geometry import identity
from pdf_annotate.util.geometry import matrix_multiply
from pdf_annotate.util.geometry import matrix_inverse
from pdf_annotate.util.geometry import rotate
from pdf_annotate.util.geometry import scale
from pdf_annotate.util.geometry import tr... |
#!/usr/bin/env python
import json
import sys
from bioblend import galaxy
history_id=None
if len(sys.argv) < 3:
print "Usage: %s <host> <APIkey> [optional history_id]" % sys.argv[0]
sys.exit(1)
elif len(sys.argv) == 3:
pass
elif len(sys.argv) == 4:
history_id=sys.argv[3]
else:
print "Usage: %s <host> <APIkey... |
VTABLE(_Main) {
<empty>
Main
}
FUNCTION(_Main_New) {
memo ''
_Main_New:
_T0 = 4
parm _T0
_T1 = call _Alloc
_T2 = VTBL <_Main>
*(_T1 + 0) = _T2
return _T1
}
FUNCTION(main) {
memo ''
main:
_T4 = 5
_T5 = 0
_T6 = (_T4 < _T5)
if (_T6 == 0) branch _L10
_T7 = "Decaf runti... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="robustbench",
version="1.0",
author="Francesco Croce, Maksym Andriushchenko, Vikash Sehwag, Edoardo Debenedetti",
author_email="adversarial.benchmark@gmail.com",
description="This package ... |
from . import overworld
from . import dungeon1
from . import dungeon2
from . import dungeon3
from . import dungeon4
from . import dungeon5
from . import dungeon6
from . import dungeon7
from . import dungeon8
from . import dungeonColor
from .requirements import AND, OR, COUNT, FOUND
from .location import Location
from l... |
from dns.resolver import Resolver
# make a system resolver using /etc/resolv.conf
sys_r = Resolver()
dns = ['ns1.dreamhost.com', 'ns2.dreamhost.com', 'ns3.dreamhost.com']
dreamhost_dns = [ item.address for server in dns for item in sys_r.query(server) ]
# a resolver using dreamhost dns server
dreamhost_r = Resolver(... |
#!/usr/bin/env python3
# Copyright (c) 2017 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 various command line arguments and configuration file parameters."""
import os
from test_framework.te... |
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.2'
# jupytext_version: 1.2.1
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %% [markdown]
# # A... |
#!/usr/bin/env python
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: Test "random" TIFF files
# Author: Even Rouault, <even dot rouault at mines dash paris dot org>
#
#################################################################... |
import numpy as np
import torch
from torchvision.ops import nms
from model.utils.bbox_tools import loc2bbox
def _get_inside_index(anchor, H, W):
index_inside = np.where(
(anchor[:, 0] >= 0) &
(anchor[:, 1] >= 0) &
(anchor[:, 2] <= H) &
(anchor[:, 3] <= W)
)[0]
return index_i... |
# coding: utf-8
"""
Wodby API Client
Wodby Developer Documentation https://wodby.com/docs/dev # noqa: E501
OpenAPI spec version: 3.0.14
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re # noqa: F401
# python 2 and python 3... |
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
""" Download and prepare entsoe load profile from opsd data portal.
SPDX-FileCopyrightText: 2016-2019 Uwe Krien <krien@uni-bremen.de>
SPDX-License-Identifier: MIT
"""
__copyright__ = "Uwe Krien <krien@uni-bremen.de>"
__license__ = "MIT"
# Python libraries
import os
... |
import torch
from torch import nn as nn
from .custom_blocks import int_size
from ..builder import build_loss
from mmcv.runner import auto_fp16, force_fp32
class DUpsamplingBlock(nn.Module):
def __init__(self, inplanes, scale, num_class=21, pad=0):
super(DUpsamplingBlock, self).__init__()
self.inpl... |
import requests
import re
import lxml.html
#import datetime
import MySQLdb
conn = MySQLdb.connect(db='Crawler', user='cloud', passwd='1111', charset='utf8mb4')
c=conn.cursor()
delete_sql = 'DELETE from re_info where site_name = "잡코리아"'
c.execute(delete_sql)
def crawling(page_count):
front_url="http://www.jobk... |
import pytest
import sys
import pdb
class TestPriorityQueue:
def test_add(self, pq):
test_val = '123456'
pq.add(test_val)
val = pq.pop()
pq.add(test_val)
assert val == test_val
def test_max_length(self, pq):
test_vals = range(pq.MAX_QUEUE_LENGTH + 1)
fo... |
# coding: utf-8
"""
SQE API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: v1
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from qumra... |
from .templateparser import Preprocessor |
from django.test import TestCase
from django.utils import timezone
from data_refinery_common.models import (
SurveyJob,
DownloaderJob,
ProcessorJob,
)
class SanityTestJobsTestCase(TestCase):
def test_jobs_sanity(self):
"""Just makes sure creating Jobs doesn't fail"""
s_job = SurveyJob... |
#!/usr/bin/env python3
# encoding: utf-8
'''
spearWrapper -- AClib target algorithm warpper for SAT solver spear
@author: Marius Lindauer, Chris Fawcett, Alex Fréchette, Frank Hutter
@copyright: 2014 AClib. All rights reserved.
@license: GPL
@contact: lindauer@informatik.uni-freiburg.de, fawcettc@cs.ubc.ca... |
import datetime
import logging
from django.shortcuts import get_object_or_404
from drawquest.api_decorators import api_decorator
from canvas.templatetags.jinja_base import render_jinja_to_string
from canvas.view_guards import require_staff, require_user
from services import Services
urlpatterns = []
api = api_decor... |
from __future__ import division
import itertools
import sys
from .helpers import SeededTest, select_by_precision
from ..vartypes import continuous_types
from ..model import Model, Point, Potential, Deterministic
from ..blocking import DictToVarBijection, DictToArrayBijection, ArrayOrdering
from ..distributions import... |
"""Mailroom Madness module lets a user track and thank donors and donations."""
DONORS = { # pragma no cover
'ANNA SHELBY': [300, 10, 15],
'MORGAN NOMURA': [10, 200, 50],
'EDGAR POE': [1000]
}
WELCOME = '''
\n
Welcome to Mailroom Madness!\n
Mailroom Madness is a state-of-the-art text-based interface
des... |
# 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 random
from torch.nn import Module
from MinkowskiEngine import SparseTensor
class Wrapper(Module):
"""
Wrapper for the segment... |
import os, time
from deluge_client import DelugeRPCClient, FailedToReconnectException
from bottle import Bottle, run, route, request, abort
from truckpad.bottle.cors import CorsPlugin, enable_cors
DELUGE_ADDR = os.getenv('DELUGE_ADDR', '127.0.0.1')
DELUGE_PORT = os.getenv('DELUGE_PORT', 58846)
DELUGE_USER = os.getenv(... |
from typing import Optional, Dict, Tuple
class CodeLocation:
"""
Stands for a specific program point by specifying basic block address and statement ID (for IRSBs), or SimProcedure
name (for SimProcedures).
"""
__slots__ = ('block_addr', 'stmt_idx', 'sim_procedure', 'ins_addr', 'context', 'info',... |
from utilities.models import ConnectionInfo
from ucscsdk.ucschandle import UcscHandle
from ucsmsdk.ucshandle import UcsHandle
conn, _ = ConnectionInfo.objects.get_or_create(name='Cisco UCS')
try:
handle = UcscHandle(conn.ip, conn.username, conn.password, conn.port)
except Exception:
# not a UCS central serve... |
# enginedbedit.py
# Copyright 2015 Roger Marsh
# Licence: See LICENCE (BSD licence)
"""Customise edit toplevel to edit or insert chess engine definition record.
"""
import tkinter.messagebox
from solentware_grid.gui.dataedit import DataEdit
from solentware_misc.gui.exceptionhandler import ExceptionHandler
from .eng... |
import numpy as np
import matplotlib.pyplot as plt
# =============================================================================
# ADAPTIC classes
# =============================================================================
class adap0: # base class with funtions to read num files
def __init__(self,name):
... |
from typing import Any, Dict, IO, Mapping, Optional, Sequence, Tuple, Union
import cyvcf2
import logging
import numpy as np
log = logging.getLogger(__name__)
# have to re-declare here since only exist in cyvcf2 stub and fails on execution
Text = Union[str, bytes]
Primitives = Union[int, float, bool, Text]
def _nump... |
from pyramid.config import Configurator
from pyramid.security import Authenticated
from pyramid.security import Allow
from pyramid.config import not_
class RootContext(object):
def __init__(self, request):
self.request = request
@property
def __acl__(self):
return [(Allow, Authenticated, ... |
from itertools import cycle
from common.intcode import IntCode, ProgramTerminatedError
def max_thruster_single_mode(program, phase_settings):
output = 0
for phase in phase_settings:
computer = IntCode(program)
computer.queue_input(phase)
computer.queue_input(output)
output = c... |
import pytest
from unittest import mock
import inspect
from rdkit import Chem
from openfe.utils.visualization import (
_match_elements, _get_unique_bonds_and_atoms, draw_mapping,
draw_one_molecule_mapping, draw_unhighlighted_molecule
)
# default colors currently used
_HIGHLIGHT_COLOR = (220/255, 50/255, 32/2... |
# Copyright (C) 2016 Ayan Chakrabarti <ayanc@ttic.edu>
import numpy as np
def trunc(img):
w = img.shape[0]; h = img.shape[1]
w = (w//8)*8
h = (h//8)*8
return img[0:w,0:h,...].copy()
def _clip(img):
return np.maximum(0.,np.minimum(1.,img))
def bayer(img,nstd):
v = np.zeros((img.shape[0],i... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import warnings
from sklearn import svm
from sklearn import metrics
from sklearn import model_selection
from sklearn import preprocessing
def main():
files = {
"./Results/JanNov2016.csv": {"label": 0, "color": "#880000"},
"./... |
import pdftables.line_segments as line_segments
from nose.tools import assert_equals, raises
from pdftables.line_segments import LineSegment
def segments(segments):
return [line_segments.LineSegment.make(a, b) for a, b in segments]
def test_segments_generator():
seg1, seg2 = segs = segments([(1, 4), (2, 3... |
from django.conf.urls import url
from .api_views import APICommentListView, APICommentView
from .views import (
DocumentCommentCreateView, DocumentCommentDeleteView,
DocumentCommentDetailView, DocumentCommentEditView,
DocumentCommentListView
)
urlpatterns = [
url(
regex=r'^documents/(?P<docume... |
import typing
import sys
import numpy as np
import numba as nb
@nb.njit
def cross(x0: int, y0: int, x1: int, y1: int) -> int:
return x0 * y1 - x1 * y0
@nb.njit((nb.i8, ) * 4 + (nb.i8[:, :], ), cache=True)
def solve(
x0: int,
y0: int,
x1: int,
y1: int,
xy: np.ndarray,
) -> typing.NoReturn:
n = len... |
# -*- coding: utf-8 -*-
import os
import sys
sys.path.insert(0, os.path.abspath('../../samples'))
sys.path.insert(0, os.path.abspath('../../samples/an_example_pypi_project'))
needs_sphinx = '1.3'
needs_extensions = {'sphinx.ext.autosummary': '1.3'}
extensions = ['publishing.withsphinx']
master_doc = 'index'
latex_do... |
# 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... |
"""
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="Nentp4983... |
# Copyright 2012-2018 CERN for the benefit of the ATLAS collaboration.
#
# 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... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Slightly based on AboutModules in the Ruby Koans
#
from runner.koan import *
class AboutMultipleInheritance(Koan):
class Nameable:
def __init__(self):
self._name = None
def set_name(self, new_name):
self._name = new_name
... |
import numpy
import anmichelpers.tools.tools as tools
import math
from anmichelpers.tools.tools import norm
from math import exp
# For all measures see http://www.ncbi.nlm.nih.gov/pmc/articles/PMC2350220/
def overlap(mode_i, mode_j):
"""
Measure of the similarity between 2 modes.
Overlap value is in the r... |
import core.implant
class HashDumpSAMImplant(core.implant.Implant):
NAME = "SAM Hash Dump"
DESCRIPTION = "Dumps the SAM hive off the target system."
AUTHORS = ["zerosum0x0"]
def load(self):
self.options.register("LPATH", "/tmp/", "local file save path")
self.options.register("RPATH", ... |
from django.urls import path
from .views import pollen_measurement_form, pollen_measurement_delete, pollen_measurement_list
urlpatterns = [
path('', pollen_measurement_form, name='pollen_measurement_insert'),
path('<int:id>/', pollen_measurement_form, name='pollen_measurement_update'),
path('delete/<int:i... |
import numpy as np
from qcodes import VisaInstrument, validators as vals
from qcodes.utils.validators import Numbers
from qcodes.utils.helpers import create_on_off_val_mapping
from qcodes.utils.deprecate import deprecate_moved_to_qcd
def parse_on_off(stat):
if stat.startswith('0'):
stat = 'Off'
elif s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.