content stringlengths 5 1.05M |
|---|
# Copyright (c) 2020 Cisco Systems, Inc. All rights reserved.
"""
pydme.options
~~~~~~~~~~~~~~~~~~~
This module contains helpers to construct REST API options for PyDME.
"""
class ApiOptions(dict):
"""Dict like data structure capturing REST API options."""
def __and__(self, other):
return ApiOption... |
class Solution:
def canWin(self, s: str) -> bool:
for i in range(len(s)-1):
if s[i:i+2] == '++':
temp = s[:i]+'--'+s[i+2:]
if not self.canWin(temp):
return True
return False
|
"""
Accounts
--------
Models
~~~~~~
.. automodule:: accounts.models
:members:
Views
~~~~~
.. automodule:: accounts.views
:members:
:show-inheritance:
Forms
~~~~~
.. automodule:: accounts.forms
:members:
Admin
~~~~~
.. automodule:: accounts.admin
:members:
"""
|
import pytest
from eth_utils import (
to_bytes,
)
from web3._utils.empty import (
empty,
)
from web3.exceptions import (
ValidationError,
)
def test_transacting_with_contract_no_arguments(w3, math_contract, transact, call):
initial_value = call(contract=math_contract,
contra... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
pi_cam_interface.py
This script is intended to provide a
simple interface to a raspberry pi camera
"""
################################
#LOAD LIBRARIES
################################
import os
from picamera import PiCamera
################################
#USER INP... |
import os
import sys
from setuptools import setup, find_packages
with open(os.path.join(os.path.dirname(__file__), "weber", "__version__.py")) as version_file:
exec(version_file.read()) # pylint: disable=W0122
_INSTALL_REQUIRES = [
'click>=4.0',
'emport',
'Flask',
'Logbook',
'Jinja2',
'py'... |
class Importer(object):
def fetch(self):
raise NotImplementedError() # pragma: no cover
|
from django.conf import settings
from django.contrib.auth.models import User
from avatar import AVATAR_DEFAULT_URL
def get_default_avatar_url():
base_url = getattr(settings, 'STATIC_URL', None)
if not base_url:
base_url = getattr(settings, 'MEDIA_URL', '')
# We'll be nice and make sure there are ... |
__all__ = ['collections', 'core', 'solving', 'threading', 'web']
|
r'''
FX is a toolkit for developers to use to transform ``nn.Module``
instances. FX consists of three main components: a **symbolic tracer,**
an **intermediate representation**, and **Python code generation**. A
demonstration of these components in action:
::
import torch
# Simple module for demonstr... |
# -*- coding: utf-8 -*-
from setuptools import setup
def readme():
with open('README.rst') as f:
return f.read()
setup(
name='python_sudeste',
version='0.1.8',
url='https://github.com/samukasmk/python-sudeste-module',
license='Apache2',
author='Samuel Sampaio',
author_email='samuka... |
# 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... |
from __future__ import print_function
from neatsociety.ctrnn import CTNeuron, Neuron, Network
# TODO: These tests are just smoke tests to make sure nothing has become badly broken. Expand
# to include more detailed tests of actual functionality.
def test_basic():
# create two output neurons (they won't receive ... |
import artm
import numpy as np
import pandas as pd
import functools
import operator
from collections import OrderedDict
def weigh_average(gamma, x, axis):
'''
Calculates average of x with weights gamma.
'''
if isinstance(axis, int):
nom = np.sum(gamma * x, axis=axis)
denom = np.sum(ga... |
#!/usr/bin/env python3
# Copyright (c) 2021 Peter Kwan
#
# 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, ... |
# -*- coding: utf-8 -*-
import scrapy
from tangspiderframe.items import TangspiderframeItem
class TextVietnamVidictContentSpider(scrapy.Spider):
name = 'text_vietnam_vdict_content'
allowed_domains = ['www.vdict.co']
start_urls = ['http://www.vdict.co/index.php?word=hello&dict=en_vi']
def parse(self, ... |
# Copyright (C) 2020. Huawei Technologies Co., Ltd. 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, including without limitation the rights
# to us... |
from copy import copy
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
import brewer2mpl as b2mpl
from tqdm import tqdm
import seaborn.apionly as sns
from .FS_colorLUT import get_lut
from seaborn.utils import set_hls_values
def electrode_grid(gridx=16, gridy=16, elects_to_plot=None, anatomy... |
from ievv_auth.project.develop.common_settings import *
# Disable migrations when running tests
class DisableMigrations(object):
def __contains__(self, item):
return True
def __getitem__(self, item):
import django
if django.VERSION[0:3] > (1, 11, 0):
return None
re... |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from django.urls import reverse
from kolibri.core.auth.constants.user_kinds import ANONYMOUS
from kolibri.core.auth.constants.user_kinds import LEARNER
from kolibri.core.content.hooks import ContentNod... |
from celery import Task
from .domain_utils import get_domain
class DomainTask(Task):
abstract = True
def apply_async(self, args=None, kwargs=None, **rest):
self._include_request_context(kwargs)
return super(DomainTask, self).apply_async(args, kwargs, **rest)
def apply(self, args=None, kwa... |
import requests
import lxml
from bs4 import BeautifulSoup
import threading
import urljoin
import hashlib
import sys
from lxml import etree
import urllib3
import re
from bs4 import BeautifulSoup
from distutils.filelist import findall
requests.packages.urllib3.disable_warnings()
#//*[@id="wrap_all"]/div[2]/div... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys,os
sys.path.append(os.getcwd() + '/../')
from lnasr.hmm import HMM
import numpy as np
n = 2 # 状态集:H, C
m = 3 # 观测集:1, 2, 3
A = np.array([
[0.6, 0.4],
[0.5, 0.5]], dtype=np.float)
B = np.array([
[0.2, 0.4, 0.4],
[0.5, 0.4, 0.1]], dtype=np.f... |
import numpy as np # importing numpy module
# taking endpoints from the user as point_1, point_2 & point_3
point_1 = list(map(float,input().split()))
point_2 = list(map(float,input().split()))
point_3 = list(map(float,input().split()))
arr = np.array([point_1,point_2,point_3])
volume = abs(np.lina... |
# Generated by Django 2.0.1 on 2018-04-19 17:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('experiences', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='ormexperience',
name='saves_count',... |
def test_to_internal_camera_state_to_camera_state_modified():
from zivid import CameraState
from zivid._camera_state_converter import to_camera_state, to_internal_camera_state
modified_camera_state = CameraState(connected=True)
converted_camera_state = to_camera_state(
to_internal_camera_state... |
# -*- coding: utf-8 -*-
"""loss.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/13lQiLDH3_PD0nJgzZCNKsj3bbXYRJ65u
"""
import matplotlib
import numpy as np
import pandas as pd
import torch
import torchvision
import torch.nn as nn
import torch.nn.... |
from sqlalchemy import Column, Integer, BigInteger, Float, String, ForeignKey, Table
from sqlalchemy.orm import relationship, backref
from vwsfriend.model.base import Base
from vwsfriend.model.datetime_decorator import DatetimeDecorator
trip_tag_association_table = Table('trip_tag', Base.metadata,
... |
from __future__ import print_function
from __future__ import absolute_import
from sandbox.rocky.tf.core.parameterized import Parameterized
import sandbox.rocky.tf.core.layers as L
import itertools
class LayersPowered(Parameterized):
def __init__(self, output_layers, input_layers=None):
self._output_layer... |
#!/pxrpythonsubst
#
# Copyright 2020 Pixar
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
#
... |
#optunaが最適化する関数
def objective(trial):
global layer_depth
global first_hidden_dim
global second_hidden_dim
global third_hidden_dim
global latent_dim
global beta
global kappa
global batch_size
global learning_rate
#leaky_reluの時に使用する
global leaky_alpha
#ドロップアウトを用いる場合
glo... |
#!/usr/bin/env python
from __future__ import print_function
import os
from flask.ext.script import Manager, Server
from notifications_delivery.app import create_app
from notifications_delivery.processor.sqs_processor import process_all_queues
application = create_app()
manager = Manager(application)
port = int(os.... |
# Generated by Django 3.0.8 on 2020-07-04 21:37
import uuid
import django.db.models.deletion
import django.utils.timezone
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency... |
from __future__ import division
import numpy as np
import scipy
import scipy.stats
import scipy.fftpack
import scipy.optimize
import logging
import stingray.lightcurve as lightcurve
import stingray.utils as utils
from stingray.gti import bin_intervals_from_gtis, check_gtis
from stingray.utils import simon
from stingra... |
__________________________________________________________________________________________________
sample 60 ms submission
class Solution:
def groupThePeople(self, groupSizes: List[int]) -> List[List[int]]:
count = collections.defaultdict(list)
for i, size in enumerate(groupSizes):
count... |
"""Client Interface
================
This provides direct access the Pelion Device Management API.
.. warning::
It is not recommended that this is used directly, instead please use this class from an SDK instance
(:mod:`mbed_cloud.sdk.sdk`).
.. code-block:: python
from mbed_cloud import SDK
pelion_d... |
"""Configuration of pytest."""
from urllib.parse import urljoin
import pytest
# pylint: disable=redefined-outer-name
@pytest.fixture
def rule_match_all(server_rule_factory, server_rule_prototype):
"""Registered rule that matches every request."""
rule = server_rule_prototype.create_new(rule_type="MATCHALL",... |
# -*- coding: utf-8 -*-
DESC = "ckafka-2019-08-19"
INFO = {
"DescribeRoute": {
"params": [
{
"name": "InstanceId",
"desc": "Unique instance ID"
}
],
"desc": "This API is used to view route information."
},
"DescribeGroupInfo": {
"params": [
{
"name": "Inst... |
import unittest
import os
import sys
class ContextMock(object):
project = {"type": "Project", "id": 375, "name": "dev1"}
class BaseClass(unittest.TestCase):
@classmethod
def setUpClass(cls):
if os.getenv("TK_FRAMEWORK_CONSULADOUTILS") not in sys.path:
sys.path.insert(0, os.getenv("TK... |
#!python
# Test that substitution does NOT happen in strings. In current
# preprocess.py it *does* (hence this test is currently expected to
# fail). However, the long term goal is to understand languages' string
# tokens and skip them for substitution.
if __name__ == '__main__':
foo = 1
# The V-A-R should _n... |
from pylab import *
import matplotlib.dates as mdates
import os, sys, datetime, string
import numpy as np
from netCDF4 import Dataset
import time
import numpy.ma as ma
import calclight
from subprocess import call
import mpl_util
import pandas as pd
import calculateLightUnderIce
import prettyplotlib as ppl
import brewe... |
from dynamic_graph.sot.torque_control.main import *
from dynamic_graph.sot.torque_control.utils.sot_utils import smoothly_set_signal, stop_sot
from dynamic_graph import plug
import numpy as np
robot.timeStep = 0.0015
robot = main_v3(robot, startSoT=1, go_half_sitting=1)
robot.torque_ctrl.KpTorque.value = 30 * (0.0, )
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*
"""UdPyBlog Tests"""
from webtest import TestApp
import unittest
from main import app
from google.appengine.ext import testbed
from google.appengine.api import memcache, apiproxy_stub_map, datastore_file_stub
from google.appengine.api.app_identity import app_identity_stub
... |
# BEGIN GPL LICENSE BLOCK #####
#
# This program 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 2
# of the License, or (at your option) any later version.
#
# This program is distributed i... |
from django.db import models
PASSWORD_LENGTH = 200
NAME_LENGTH = 150
POSITION_LENGTH = 300
TYPE_LENGTH = 200
# Create your models here.
class users(models.Model):
Authority_Choices = (('LEVEL0', 'Admin'), ('LEVEL1', 'ChiefManager'), ('LEVEL2', 'Manager'), ('LEVEL3', 'User'))
username = models.CharField(max_l... |
from django.conf import settings
EXPOSE_MODEL_TO_ADMIN = getattr(settings, 'SITEPREFS_EXPOSE_MODEL_TO_ADMIN', False)
"""Toggles internal preferences model showing up in the Admin."""
DISABLE_AUTODISCOVER = getattr(settings, 'SITEPREFS_DISABLE_AUTODISCOVER', False)
"""Disables preferences autodiscovery on Django apps... |
import os, time, json, shutil
from numpy import array
from TFIDF import TFIDF
from Initial import Initial
from Mymodel import Mymodel
from SaveLog import SaveLog
from ContentParser import ContentParser
from bert_serving.client import BertClient
from bert_serving.server import BertServer
from bert_serving.serve... |
from api import API, FolioFn
from objects import Note, Loan, FolioLoan
from analytic import NotesAnalytic, LoansAnalytic
__doc__ = """ Created-by: Peerakit Champ Somsuk
- api
- analytic
- note, loan
""" |
#!/usr/bin/env python
# coding: utf-8
"""
Analyze for which timeframes what data is available. This turns out to be a mojor problem in teh DWD data because days
without any readings are not listed in the produkt_*.txt files and it varis a lot what data was recorded (or is being
made available for each day. Similar is ... |
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
import dace.library
@dace.library.environment
class OpenBLAS:
cmake_minimum_version = "3.6"
cmake_packages = ["BLAS"]
cmake_variables = {"BLA_VENDOR": "OpenBLAS"}
cmake_includes = [] # For some reason, FindBLAS does not find... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# @auther:FelixFu
# @Date: 2021.10.1
# @github:https://github.com/felixfu520
from loguru import logger
import torch.multiprocessing
from core.modules.register import Registers
from core.modules.dataloaders.augments import get_transformer
from core.modules.dataloaders.util... |
# Generated by Django 3.1.6 on 2021-02-09 19:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dog_shelters', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='dog',
name='adoption_date',
... |
import click
from ranger_cli.utils import CONTEXT_SETTINGS
from ranger_cli.policy.commands import policy
from ranger_cli.service.commands import service
from ranger_cli.configure.commands import configure
from ranger_cli.servicedef.commands import servicedef
from ranger_cli.plugins.commands import plugins
from ranger_... |
import numpy as np
class Display:
def __init__(self, parent=None):
self.parent = parent
def raw_image(self, data):
_view = self.parent.ui.raw_image_view.getView()
_view_box = _view.getViewBox()
_state = _view_box.getState()
self.parent.state_of_raw = _state
... |
"""This files contains the tests for `main.py`."""
from unittest import TestCase
from PROJECT_NAME_UNS.main import main
def test_main():
assert main() == 0
class TestMain(TestCase):
def test_main(self):
assert main() == 0
|
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
from __future__ import absolute_import
import re
import json
import copy
from svtplay_dl.service import Service, OpenGraphThumbMixin
from svtplay_dl.error import ServiceError
from svtplay_dl.fetcher.rtmp import RTMP
from svtplay_d... |
import io
import json
import asyncio
import gitlab.v4.objects as gl_objects
import urllib.parse
from aiohttp import ClientSession
class AioGitlab(object):
def __init__(self, gl, gitlab_url, gitlab_token):
self._gitlab_url = gitlab_url
self._gitlab_token = gitlab_token
self._gl = gl
de... |
import time
import logging
from math import floor
from os.path import getsize
from dtest import Tester
logger = logging.getLogger(__name__)
class TestSSTableSplit(Tester):
def test_split(self):
"""
Check that after running compaction, sstablessplit can succesfully split
The resultant s... |
# Copyright (C) 2019 YouCompleteMe contributors
#
# This file is part of YouCompleteMe.
#
# YouCompleteMe 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) ... |
import pytest
def test_announce_routes(fib_t0):
"""Simple test case that utilize fib_t0 to announce route in order to a newly setup test bed receive
BGP routes from remote devices
"""
assert(True)
|
# -*- coding=utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
from abc import ABCMeta, abstractmethod
# base implementation of state pattern
# 允许对象在内部状态改变时改变它的行为, 对象看起来好像修改了它的类.
# 当控制一个对象的状态转换的条件表达式过于复杂时,把状态的判断逻辑转移到表示不同状态的一系列类当中,可以把复杂的判断逻辑简化
# (当一个对象的行为取决于它的状态,并且它必须在运行时刻根据状态改变他的行为)... |
from bullets.portfolio import *
|
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 12 13:49:48 2018
@author: 754672
"""
import numpy as np
import h5py
import os
from sklearn.preprocessing import StandardScaler
#load MIPAS files
def calculate_ci(x):
return x[137]/x[138]
# function to calculate the NI
def calculate_ni(x):
... |
import lxml.html
import urllib2
import re
import random
import time
from pushbullet import PushBullet
from time import sleep
import config
pb_api_key = config.pb_api_key
user_agent = config.user_agent
n6_gb_url = 'https://play.google.com/store/devices/details/Nexus_6_64GB_Cloud_White?id=nexus_6_white_64gb'
items = {
... |
# Copyright (c) 2012 The Khronos Group Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and /or associated documentation files (the "Materials "), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publis... |
def task1():
c = 0
while 1:
try:
x = int(input())
except EOFError:
break
c += x // 3 - 2
return c
def task2():
c = 0
while 1:
try:
x = int(input())
except EOFError:
break
while x >= 6:
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pprint import pprint as pp
import sys
import os
import re
# merging two source directories into one
BASE1 = u'/apps/content/raw_files/UCM/LIJA'
BASE2 = u'/apps/content/raw_files/UCM/LIJA-no md/'
BASE3 = u'/apps/content/new_path/UCM/LIJA'
def main(argv=None):
fi... |
# coding: utf-8
"""
license:MIT
Copyright (c) 2016 DKZ
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... |
import sys
import os.path
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
from kep_determination import lamberts_kalman
import numpy as np
import pytest
from numpy.testing import assert_array_equal
# The first test checks the fact that if we give to the kalman filter three ide... |
# -*- coding: utf-8 -*-
#
# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U
#
# This file is part of FI-WARE project.
#
# 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:
#
# ... |
# Copyright 2017 ICON Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... |
from win10toast import ToastNotifier
import pathlib
from backup import recompile
from utils import check_space_availability
def show_toast_task(title, message, path_image):
toaster = ToastNotifier()
toaster.show_toast(title,
message,
duration=10, icon_path=path_im... |
from rest_framework.urls import path
from rest_framework.routers import DefaultRouter
from .views import (
DecoratedTokenObtainPairView,
DecoratedTokenRefreshView,
UserViewSet,
FeedbackViewSet,
DashNewsViewSet,
)
router = DefaultRouter()
router.register(r'users', UserViewSet, basename='users')
rout... |
# Copyright FuseSoC contributors
# Licensed under the 2-Clause BSD License, see LICENSE for details.
# SPDX-License-Identifier: BSD-2-Clause
from fusesoc.capi2.generator import Generator
class MacroGenerator(Generator):
def run(self):
assert self.config["filename"]
self.add_files([self.config["fi... |
import datetime
from playhouse.test_utils import test_database
from peewee import *
from archive_db.models.Model import Archive, Upload, Verification, Removal, init_db
from archive_db.app import routes
from tornado.web import Application
from tornado.escape import json_encode, json_decode
from tornado.testing import... |
from math import sqrt
import argparse
import musicpd
def wilson_lower_bound(likes, dislikes, z=1.44):
total = likes + dislikes
if total < 1:
return 0
likes_rel = likes / total
denominator = 1 + z**2/total
centre_adjusted_probability = likes_rel + z*z / (2*total)
adjusted_standard_devia... |
##===============================================================================
# This file is part of TEMPy.
# It implements a genetic algorithm for the purpose of fitting multiple component into the assembly map
#
# TEMPy is a software designed to help the user in the manipulation
# and analys... |
from pypy.interpreter.gateway import unwrap_spec
from pypy.interpreter.pyparser import pygram
@unwrap_spec(tok=int)
def isterminal(space, tok):
return space.newbool(tok < 256)
@unwrap_spec(tok=int)
def isnonterminal(space, tok):
return space.newbool(tok >= 256)
@unwrap_spec(tok=int)
def iseof(space, tok):
... |
from .interface import Mmams
|
""" Faça um programa que leia o sexo de uma pessoa, mas só aceita os valores 'M' e 'F'. Caso esteja errado,
peça a digitação novamente até ter um valor correto. """
sexo = ''
while sexo != 'M' and sexo != 'F':
sexo = str(input('Digite seu sexo:[M]|[F]? ').strip().upper()[0])
print('OK')
|
#!/usr/bin/env python
########################################################################
##
## File:
## Author:
## Email:
## File Description:
##
## Ref: https://docs.python.org/2/library/xml.etree.elementtree.html
##
## Created: 4/07/2016
## Last Modified: 4/07/2016
##
#######################################... |
from string import Template
from graphene.test import Client
from django.test import TestCase
from virtualization.models import ClusterType
from netbox_graphql.schema import schema
from netbox_graphql.tests.utils import obj_to_global_id
from netbox_graphql.tests.factories.virtualization_factories import ClusterType... |
__all__: object = ['ImageRepositoryBase', 'S3ImageRepository', 'FSImageRepository', 'ImageRepositoryFactory']
|
import torch
from torchvision.models import vgg16
from .ops.deform_v2 import DCN
class VGG16(object):
def __init__(self, dilation=[1, 1, 1], fix_block1_2=True):
"""
Initializes a vgg16 network and extracts the backbone and classifier.
:param dilation: Integer. The dilation to use.
:param fix_block1_2: Bool.... |
# -*- coding=utf-8
from qcloud_cos import CosConfig
from qcloud_cos import CosS3Client
from qcloud_cos import CosServiceError
from qcloud_cos import CosClientError
secret_id = 'COS_SECRETID' # 替换为用户的secret_id
secret_key = 'COS_SECRETKEY' # 替换为用户的secret_key
region = 'COS_REGION' # 替换为用户的region
token = None ... |
#
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Jeff Byrnes
# Based on SublimeLinter-rubocop, written by Aparajita Fishman
# Contributors: Francis Gulotta, Josh Hagins, Mark Haylock
# Copyright (c) 2015-2016 The SublimeLinter Community
# Copyright (c) 2013-2014 Apa... |
# Copyright 2014 Diamond Light Source Ltd.
#
# 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 t... |
# Copyright (c) 2006-2012 CSIRO
# Australia Telescope National Facility (ATNF)
# Commonwealth Scientific and Industrial Research Organisation (CSIRO)
# PO Box 76, Epping NSW 1710, Australia
# atnf-enquiries@csiro.au
#
# This file is part of the ASKAP software distribution.
#
# The ASKAP software distribution is free so... |
import numpy as np
import pandas as pd
from .BaseMatrix import BaseMatrix
class SudarshanIyengar(BaseMatrix):
''' Calculates Vulnerability Index using Sudarshan & Iyengar's method (1982)
Attributes:
df (DataFrame) takes a pandas dataframe containing Vulnerability Indicators for given ... |
from django.utils.text import slugify
def overlap_percent(geom1, geom2):
# How much of the area of geom2 is also inside geom1
# (expressed as a percentage)
g1 = geom1.transform(27700, clone=True)
g2 = geom2.transform(27700, clone=True)
intersection = g1.intersection(g2)
return (intersection.ar... |
"""
Imports all the useful stuff
"""
from .definitions import (
VicarEnum,
SystemLabel,
SpecialLabel,
NumberFormat,
IntFormat,
RealFormat,
DataType,
DataOrg
)
from .definitions import isRealFormat, isIntFormat, getSystemTypes, LABEL_ENCODING
from .types import *
|
# An attempt at a WaveToy using the NRPy+ infrastructure
# TODO: Parity on grid functions
import os, re
from datetime import date
from sympy import symbols, Function, diff
import grid
import NRPy_param_funcs as par
import finite_difference as fin
from outputC import indent_Ccode, add_to_Cfunction_dict, outCfunction, c... |
import sys
sys.path.append("../")
import Utilities
import plots
import numpy as np
import streamlit as st
from hydralit import HydraHeadApp
class TrajClass(HydraHeadApp):
def __init__(
self,
data,
how_speed,
geometry_wall,
transitions,
geominX,
geomaxX,
... |
from cloud.permission import Permission, NeedPermission
# Define the input output format of the function.
# This information is used when creating the *SDK*.
info = {
'input_format': {
'start_key?': 'str',
'limit?': 'int',
'show_system_user?': 'bool',
'query?': 'list'
},
'o... |
import unittest
from ascetic.databases import databases
from ascetic.mappers import Mapper, mapper_registry
from ascetic.contrib.tree import MpMapper, MpModel
Location = None
class TestMpTree(unittest.TestCase):
maxDiff = None
create_sql = {
'postgresql': """
DROP TABLE IF EXISTS asceti... |
from django import forms
from .models import SignUp
class SignUpForm(forms.ModelForm):
email = forms.EmailField(
widget=forms.TextInput(
attrs={"class": "form-control", "placeholder": "Enter your email",}
),
label="",
)
class Meta:
model = SignUp
fields... |
import json
import unittest
from rest_framework import status
from django.test import TestCase
from django.urls import reverse
from ..models import Client
from .token import get_token
class CreateNewClientTest(TestCase):
""" Test module for inserting a new Client """
def setUp(self):
self.client.defa... |
import caelum
caelum.start_game()
|
# coding: utf-8
# Copyright (c) Materials Virtual Lab.
# Distributed under the terms of the BSD License.
"""
This package contains various command line interfaces for common
pymatgen functionality such as file conversion, etc. Entry points to these
interfaces are defined in setup.py.
""" |
from dataclasses import dataclass
@dataclass
class TempFile:
def __enter__(self):
pass
def __exit__(self):
pass
pass
def download(media):
"""Download the given Media Object immediately in the user’s browser."""
pass
def from_file(filename, mime_type, name):
"""Creates a M... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.