text stringlengths 1 927k |
|---|
from dataclasses import dataclass
from dataclasses_json import dataclass_json
from snooker.models import JsonModel
@dataclass_json
@dataclass
class Player(JsonModel):
ID: int
Type: int
FirstName: str
MiddleName: str
LastName: str
TeamName: str
TeamNumber: int
TeamSeason: int
Shor... |
#!/usr/bin/env python
#-*-coding:utf-8-*-
'''
_ooOoo_
o8888888o
88" . "88
(| -_- |)
O\ = /O
____/`---'\____
.' \\| |// `.
/ \\||| : |||// \
/ _||||| -:- |||||- \
... |
import matplotlib.pyplot as plt
import numpy as np
from . import pretty_plot
def plot_butterfly(evoked, ax=None, sig=None, color=None, ch_type=None):
from mne import pick_types
if ch_type is not None:
picks = pick_types(evoked.info, ch_type)
evoked = evoked.copy()
evoked = evoked.pick_... |
import numpy as np
import pyspedas
from phdhelper.helpers import title_print
from phdhelper.helpers.CONSTANTS import c, k_B, m_e, m_i, mu_0, q
from pytplot import data_quants
import matplotlib.pyplot as plt
from datetime import datetime as dt
from cached_property import cached_property
class EventHandler:
FPI = N... |
from run import db
from flask_login import UserMixin
class Post(db.Model):
__tablename__ = "posts"
id = db.Column(db.Integer, primary_key=True)
image = db.Column(db.Text)
location = db.Column(db.String(255))
title = db.Column(db.String(255))
description = db.Column(db.String)
price = db.Co... |
import pandas as pd
# TODO: Set weight1, weight2, and bias
weight1 = 1.5
weight2 = 1.5
bias = -2.0
# DON'T CHANGE ANYTHING BELOW
# Inputs and outputs
test_inputs = [(0, 0), (0, 1), (1, 0), (1, 1)]
correct_outputs = [False, False, False, True]
outputs = []
# Generate and check output
for test_input, correct_output i... |
from typing import List
from unittest import TestCase
from puma.attribute import copied
from puma.buffer import Publishable
from puma.runnable import CommandDrivenRunnable
from puma.runnable.decorator.run_in_child_scope import run_in_child_scope
from puma.scope_id import get_current_scope_id
from tests.runnable.proxy.... |
# $Id$
#
# Copyright (C) 2003 Rational Discovery LLC
# All Rights Reserved
#
from rdkit import six
from rdkit.VLib.Node import VLibNode
class SupplyNode(VLibNode):
""" base class for nodes which supply things
Assumptions:
1) no parents
Usage Example:
>>> supplier = SupplyNode(contents=[1,2,3])
... |
# Generated by Django 2.0.3 on 2018-05-20 18:52
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('groups', '0004_auto_20180312_2139'),
('schools', '0018_auto_20180407_1742'),
('entrance', '0080_auto_2018052... |
from unittest import TestCase, skip
import os
import sys
from requests import Request
from azure_functions_worker.testutils_lc import (
LinuxConsumptionWebHostController
)
@skip('Flaky test and needs stabilization')
class TestLinuxConsumption(TestCase):
"""Test worker behaviors on specific scenarios.
S... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.special
~~~~~~~~~~~~~~~~~~~~~~~
Special lexers.
:copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from testflows._core.contrib.pygments.lexer import Lexer
from testflows._core.contr... |
# -*- coding: utf-8 -*-
"""Chemical Engineering Design Library (ChEDL). Utilities for process modeling.
Copyright (C) 2020 Caleb Bell <Caleb.Andrew.Bell@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
... |
import torch
import torch.nn.functional as F
from torch.nn import Linear
from torch_geometric.nn import SAGEConv, global_mean_pool
class NestedGraphSAGE(torch.nn.Module):
def __init__(self, dataset, num_layers, hidden, use_z=False, use_rd=False):
super(NestedGraphSAGE, self).__init__()
self.use_rd... |
import numpy as np
def print_matrix(data):
data_i = []
for i in list(data):
data_j = []
for j in i:
data_j.append(int("%d" % j))
data_i.append(data_j)
print(data_i)
def print_array(data):
datas = []
for i in data:
datas.append(float("%.3f" % i))
prin... |
#
# msequence.py
# Created by pira on 2017/07/28.
#
#coding: utf-8
u"""For M-Sequence."""
import numpy as np
def generateM(N):
u"""Create M-Sequence.
@param N : length 2**N-1
@return m : M-Sequence
"""
p = pow(2, N)
m = [0] * (p-1)
for i in np.arange(1,p,2):
f = p^i
a = p
#i = int()
for j in np.... |
import os
import tempfile
from bs4 import BeautifulSoup
from PIL import Image
from reportlab.pdfgen import canvas
from manganelo import utils, siterequests
def download_chapter(url, path):
path = utils.validate_path(path)
r = siterequests.get(url)
soup = BeautifulSoup(r.content, "html.parser")
urls = _get_... |
a = 1
b = dict(b1=[0, 1, 2],
b2=None,)
c = (1, 2)
d = 'string' |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
#!/usr/bin/python
# Copyright (c) 2014 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Script to generate list of seed nodes for chainparams.cpp.
This script expects two text files in the directory tha... |
#!/usr/bin/env python3
# Day 2: Design HashSet
#
# Design a HashSet without using any built-in hash table libraries.
#
# To be specific, your design should include these functions:
# - add(value): Insert a value into the HashSet.
# - contains(value) : Return whether the value exists in the HashSet or not.
# - remove(... |
# -*- coding: utf-8 -*-
import markdown
from sheer.templates import date_formatter
from .jinja2_env import Jinja2Environment
class SheerEnvironment(Jinja2Environment):
def setup_environment(self):
"""
Set up a Jinja2 environment that like the one created by Sheer.
"""
# Setup t... |
# -*- coding: utf-8 -*-
# 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... |
#!/usr/bin/python
import os
import re
import sys
if len(sys.argv) != 3 and len(sys.argv) != 4:
print("Use: %s <PassRegistry.def path> <passes> [run-tests]" % sys.argv[0])
exit(1)
passregpath = sys.argv[1]
def skip_first_pass(s):
count = 0
for i in range(len(s)):
c = s[i]
if c == '(':
count += 1... |
# Lista 04 - Itanu Romero - 2o. semestre
def questao01():
"""
Elabore um programa que efetue a leitura de duas strings e informe o seu conteúdo,
seguido de seu compri- mento. Indique também se as
duas strings possuem o mesmo comprimento e se são iguais ou diferentes no conteúdo.
"""
dicionario ... |
import os
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.getcwd() + '/blog.db'
SECRET_KEY = 'secret' |
"""
Objects describing the Inference activity, its inputs and outputs as specified
in NIDM-Results.
Specification: http://nidm.nidash.org/specs/nidm-results.html
@author: Camille Maumet <c.m.j.maumet@warwick.ac.uk>
@copyright: University of Warwick 2013-2014
"""
from nidmresults.objects.constants import *
from nidmre... |
# Payment rest api serializers
from rest_framework import serializers
from rest_framework.serializers import (
SerializerMethodField,
IntegerField
)
from ...sale.models import PaymentOption
from ...payment.models import MpesaPayment
class MpesaPaymentUpdateSeri... |
# 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, overload
from ... import _utilities
fro... |
# Copyright Istio Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... |
#-------------------------------------------------------------------------------
# Name: __init__.py
# Description:
# Author: slm
# Date: 2020/5/15
#------------------------------------------------------------------------------- |
from rest_framework import generics, permissions, authentication
from rest_framework.authtoken.views import ObtainAuthToken
from rest_framework.settings import api_settings
from user.serializers import UserSerializer, AuthTokenSerializer
class CreateUserView(generics.CreateAPIView):
"""Create a new user in the s... |
#
# This file is part of the FFEA simulation package
#
# Copyright (c) by the Theory and Development FFEA teams,
# as they appear in the README.md file.
#
# FFEA 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 ... |
# Generated by Django 3.2.7 on 2021-10-25 19:11
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('user_polls_2_app', '0009... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
import glob
import os
import sys
try:
sys.path.a... |
"""Profile models. """
# Django
from django.db import models
# Utils
from api.utils.models import TwModel
class Profile(TwModel):
"""Profile model."""
user = models.OneToOneField("users.User", on_delete=models.CASCADE)
picture = models.ImageField(
"Profile picture",
upload_to="users/pic... |
from hwt.hdl.constants import DIRECTION, READ, WRITE, NOP, READ_WRITE
from hwt.interfaces.agents.handshaked import HandshakedAgent
from hwt.interfaces.std import VectSignal, Signal
from hwt.simulator.agentBase import SyncAgentBase
from hwt.synthesizer.interface import Interface
from hwt.synthesizer.param import Param
f... |
# Tencent is pleased to support the open source community by making GNES available.
#
# Copyright (C) 2019 THL A29 Limited, a Tencent company. 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... |
from .tree import *
from .forest import *
from .sfs import *
from .size_matched_model import * |
#!/usr/bin/env python
#
# Example of two cubes, one with a convex shape, one with a primitive
# shape.
#
from siconos.mechanics.collision.tools import Contactor
from siconos.io.mechanics_run import MechanicsHdf5Runner
import siconos.numerics as sn
import siconos.kernel as sk
import random
import siconos
bullet_opt... |
from .woqlclient import WOQLClient # noqa
from .woqldataframe import woqlDataframe as WOQLDataFrame # noqa
from .woqlquery import WOQLQuery # noqa
from .woqlschema import * # noqa
from .woqlview import WOQLView # noqa |
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 21 15:16:18 2021
@author: Administrator
"""
from base import BaseModel
import torch
import math
import torch.nn as nn
import torch.nn.functional as F
from torchvision import models
import torch.utils.model_zoo as model_zoo
from utils.helpers import initialize_weights,set... |
# 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... |
'''
Manage information about files on the minion, set/read user, group, and mode
data
'''
# TODO: We should add the capability to do u+r type operations here
# some time in the future
# Import python libs
from contextlib import nested # For < 2.7 compat
import os
import re
import time
import shutil
import tempfile
i... |
from __future__ import absolute_import, division, unicode_literals
from pip9._vendor.six import text_type
import re
from codecs import register_error, xmlcharrefreplace_errors
from .constants import voidElements, booleanAttributes, spaceCharacters
from .constants import rcdataElements, entities, xmlEntities
from . i... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# 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 cop... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This is the main WSGI handler file for AIM.
It compiles a list of valid URLs from the 'pages' library folder,
and if a URL matches it runs the specific submodule's run() function. It
also handles CGI parsing and exceptions in the applications.
"""
# Main imports
imp... |
# 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 django.shortcuts import render
from rest_framework import serializers, viewsets, generics
from apps.scraper.models import Libros, Categorias
from django.http import JsonResponse
# Create your views here.
class libros_serializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Libros
... |
# Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmcv.ops import DeformConv2d
from mmdet.core import (build_assigner, build_sampler, images_to_levels,
multi_apply, unmap)
from mmdet.core.anchor.point_gener... |
# Copyright 2017 Neural Networks and Deep Learning lab, MIPT
#
# 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 applicab... |
#
# 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... |
# Copyright 2014 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
# -*- coding: UTF-8 -*-
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2006-2021 NV Access Limited, Joseph Lee, Łukasz Golonka, Julien Cochuyt
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.
"""App module for Windows Explorer (aka Windows shell and rename... |
"""General tools for gpx data processing based on gpxpy."""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import gpxpy
from vincenty import vincenty
import mplleaflet
from .general import smooth, closest_pt
# =============================== Misc. Config ===============================
# s... |
#!/usr/bin/env python3
# Copyright (c) 2012-2019 The Vadercoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Extract _("...") strings for translation and convert to Qt stringdefs so that
they can be picked up ... |
import torch
import torch.nn as nn
import time
import sys
softmax = nn.Softmax(dim=1).cuda()
def distributed_sinkhorn(Q, nmb_iters):
with torch.no_grad():
sum_Q = torch.sum(Q)
# dist.all_reduce(sum_Q)
Q /= sum_Q
u = torch.zeros(Q.shape[0]).cuda(non_blocking=True)
r = torc... |
from odoo import models, fields, api, _
from odoo.exceptions import UserError
class CashBox(models.TransientModel):
_register = False
name = fields.Char(string='Reason', required=True)
# Attention, we don't set a domain, because there is a journal_type key
# in the context of the action
amount = ... |
class Mobile:
def dial(self, number):
print(f"dialing number {number}")
def ring(self):
print("ringing using built in tones.....")
class SmartMobile(Mobile):
def ring(self):
"""
overriding a Method
"""
print("ringing using custom ring tones .... ") |
from time import time
import six
from six import with_metaclass
from eventsourcing.domain.model.events import QualnameABCMeta
from eventsourcing.domain.model.timebucketedlog import MessageLogged, Timebucketedlog, make_timebucket_id, \
next_bucket_starts, previous_bucket_starts
from eventsourcing.infrastructure.ev... |
import operator
from decimal import Decimal
from fractions import Fraction
from operator import eq
from operator import ne
import pytest
from pytest import approx
inf, nan = float("inf"), float("nan")
@pytest.fixture
def mocked_doctest_runner(monkeypatch):
import doctest
class MockedPdb:
def __init... |
"""rising Sphinx theme.
"""
from os import path
__version__ = '0.0.25'
__version_full__ = __version__
def get_html_theme_path():
"""Return list of HTML theme paths."""
cur_dir = path.abspath(path.dirname(path.dirname(__file__)))
return cur_dir
# See http://www.sphinx-doc.org/en/stable/theming.html#dist... |
# Copyright 2018 Delft University of Technology
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
# MIT License
#
# Copyright (c) 2017 Luca Angioloni
#
# 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, merg... |
'''
This script contains a class for representing the date.
Additionally, the class Scraper get the HTML code of a
Wikipedia page and extracts the name of celebrities that
were born in a certain date
'''
import re
import requests
from bs4 import BeautifulSoup
from datetime import datetime
class Date:
'''
This... |
'''
This file contains functions for pruning resnet-like model in layer level
1. prune_resconv_layer (resnet: conv layers)
2. prune_resnet_lconv_layer (resnet: lconv means identity layer)
3. prune_rbconv_by_indices (resnet: rbconv means right path's bottom layer)
4. prune_rbconv_by_number (resnet: u... |
import datetime
import re
import sre_constants
import time
from collections import defaultdict
from datetime import timedelta
from typing import (
AbstractSet,
Any,
Callable,
DefaultDict,
Dict,
Iterable,
List,
Optional,
Sequence,
Set,
Tuple,
TypeVar,
Union,
)
import ... |
import fix_paths
from models.author import Author
import basic_stats
from models.commit import Commit
import common
from models.file_diff import FileDiff
from models.hunk import Hunk
from models.patch import Patch
from collections import Counter, defaultdict
import pylab
import sqlalchemy
session = common.Session()
... |
"""
Copyright 2018 EPAM Systems, 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... |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
# pip install selenium==2.53.6
"""
if you wanna run it on your regular browser profile.
profile = webdriver.FirefoxProfile('/home/{your_username}/.mozilla/firefox/{your_default_profile}')
driver = webdriver.Firefox(profil... |
# Copyright (c) 2013 Google Inc. 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 must retain the above copyright
# notice, this list of conditions and the ... |
#!/usr/bin/env python
# coding: utf-8
# Author: Mandis Beigi
# Copyright (c) 2022 Medidata Solutions, Inc.
#
# 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 wi... |
# coding=utf-8
#
# Copyright 2018-present Open Networking 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... |
#!/usr/bin/python
import logging
import logging.handlers
import argparse
import sys
import os
import time
from bluetooth import *
class LoggerHelper(object):
def __init__(self, logger, level):
self.logger = logger
self.level = level
def write(self, message):
if message.rstrip() != "":... |
#!/usr/bin/python
# -*- coding: utf-8 -*
import sys
import csv
def main():
s = ''
l = []
with open(str(sys.argv[1])) as csvfile:
readCSV = csv.reader(csvfile, delimiter=',')
for row in readCSV:
c = row[1]
if 'CR' in c:
s = ''.join(l)
... |
"""
A test for items
"""
from dork.items import Item
def test_init_method():
"""
Testing the constructor
"""
name = 'Donut'
description = {'This is an old fasion donut'}
properties = {'eatable'}
item = Item(name, description, properties)
assert item.name == name
assert item.descrip... |
'''
<table class="ee-notebook-buttons" align="left">
<td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/NAIP/filter_poly.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td>
<td><a target="_blank" href="h... |
# __BEGIN_LICENSE__
#Copyright (c) 2015, United States Government, as represented by the
#Administrator of the National Aeronautics and Space Administration.
#All rights reserved.
# __END_LICENSE__
try:
import uuid
except ImportError:
uuid = None
from django.db import models
if uuid:
def makeUuid():
... |
x,y = map(int,input().split())
a = 0
for i in range(y-x-1):
a += i+1
print(a-x) |
#!/usr/bin/env python
# coding: utf-8
# In[29]:
import math
T = 10
RH = 50
AH_num = 6.112 * math.exp(17.67 * T / (T+243.5)) * RH * 2.1674
AH_den = 273.15 + T
AH = AH_num / AH_den
contenu_exp = (T-7.5)**2/196 + (RH-75)**2/625 + (AH-6)**2/2.89
IPTCC = 100 * math.exp(-0.5 * contenu_exp)
IPTCC
# In[9]:
math.exp... |
#!/usr/bin/python3
def make_montage(basedir, depths):
""" makes a montage of passive tracer animation from runs.animate_pt
run with different depths
Arguments:
basedir - basedir to which depths are appended i.e., runew-03-pt-z-
depths - depths at which stuff has been outputted
Retur... |
#!/usr/bin/env python3
# Copyright 2021 Canonical Ltd.
# See LICENSE file for licensing details.
import unittest
from unittest.mock import call, patch
from ops import testing
from ops.model import BlockedStatus
from charm import MagmaOrc8rEventdCharm
testing.SIMULATE_CAN_CONNECT = True
class Test(unittest.TestCas... |
# -*- coding: utf-8 -*-
# Owner(s): ["module: linear algebra"]
import torch
import numpy as np
import unittest
import itertools
import warnings
import math
from math import inf, nan, isnan
import random
from random import randrange
from itertools import product
from functools import reduce
from torch.testing._intern... |
# Copyright 2017-2018 Capital One Services, 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 agreed ... |
# Copyright DataStax, 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, softwa... |
import dill
from . import files
def expand(filename, folder=None):
data = dill.load(open(filename, 'rb'))
file_dict = data['files']
plotter = data['func']
if 'args' in data:
args = data['args']
plotter(**data['args'])
if folder is not None:
files.write_files_from_dict(fi... |
# Copyright 2017 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
# http://www.apache.org/licenses/LICENSE-2.0
# or in the "license" file... |
import seaborn as sns
import matplotlib.pyplot as plt
import pickle
import argparse
import numpy as np
import os
sns.set_context('paper', font_scale=1.5)
parser = argparse.ArgumentParser()
parser.add_argument("-n", type=int)
parser.add_argument('--resume-path', type=str, default=None)
parser.add_argument('--title', typ... |
"""
auth.backends
~~~~~~~~~~~~~
"""
from .app_id import AppIDBackend
from .cert import CertBackend
from .github import GitHubBackend
from .ldap import LDAPBackend
from .userpass import UserPassBackend
from stevedore import DriverManager
__all__ = ['AppIDBackend', 'CertBackend', 'GitHubBackend',
'L... |
# -*- coding: utf-8 -*-
#
# relate documentation build configuration file, created by
# sphinx-quickstart on Thu Jun 26 18:41:17 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# Al... |
import json
import uuid
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.db.models.constants import LOOKUP_SEP
from django.db.models.signals import post_delete
from django.dispatch import receiver
from django.urls import reverse
from django.utils.crypto import get_ran... |
import numpy as np
from scipy.stats import f
# Does analysis of variance for a number of sets x.
# Each set in x is an array containing mean, variance
# and number [mean, var, n].
def anova(x):
mean = np.mean(x[:, 0]) # overall mean
n = np.sum(x[:, 2]) # total N
r = len(x) # number of sets
ssb = 0.
... |
# Copyright 2013 Tiago Barroso
# Copyright 2013 Frank Kmiec
# Copyright 2013-2016 Aleksej
# Copyright 2017 Christian Weiß
# Copyright 2018 Timothée Chauvin
# Copyright 2017-2018 Joseph Lorimer <luoliyan@posteo.net>
#
# Permission to use, copy, modify, and distribute this software for any purpose
# with or without fee i... |
import sys
"""
collection of simple utilities shared throughout code
"""
__facility__ = "Offline"
__abstract__ = "collection of utility code"
__author__ = "Z.Fewtrell"
__date__ = "$Date: 2008/04/30 16:53:41 $"
__version__ = "$Revision: 1.3 $, $Author: fewtrell $"
__release__ = "$Name: $"
__credits__ ... |
from .car import * |
#! /bin/python3
if __name__ == "__main__":
# Collect data
f = open('OUTCAR', 'r')
forces = []
for l in f:
if "FORCES:" in l:
forces.append([float(x) for x in l.split()[-2:]])
f.close()
# Early exit check to avoid errors from empty arrays
if(len(forces) == 0):
print("No 'FORCES:' entries fou... |
from bg_helper.tools._docker import *
from bg_helper.tools._git import *
from bg_helper.tools._grep import *
from bg_helper.tools._ps import *
from bg_helper.tools._ssh import * |
from flask import Flask, jsonify
from flask_cors import CORS, cross_origin
from os import getenv
import psycopg2
import pickle
from secret import PG_PASSWORD
class Queries(object):
@staticmethod
def query(sql: str):
try:
with open('cache-{}'.format(hash(sql)), mode='rb') as infile:
... |
# Copyright The PyTorch Lightning team.
#
# 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 i... |
from thefuck.utils import for_app
@for_app('brew', at_least=2)
def match(command):
return (command.script_parts[1] in ['uninstall', 'rm', 'remove']
and "brew uninstall --force" in command.stdout)
def get_new_command(command):
command_parts = command.script_parts[:]
command_parts[1] = 'uninst... |
# 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.