content stringlengths 5 1.05M |
|---|
from dataclasses import dataclass
from rich.console import Console
import random
import sys
# Modules for testing
import io
import time
from unittest import TestCase, mock, main
@dataclass
class Card:
'''An individual card in the deck'''
name: str # The name of the card
value: int # The value of the card
... |
msg = 'Olá, Mundo!'
print(msg)
|
# 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.db import models
# Create your models here.
class Listing(models.Model):
"""
represent a job listing object
"""
title = models.CharField(max_length=100)
company = models.ForeignKey("Company", related_name="listings")
location = models.CharField(max_length=100)
job_description ... |
import numpy as np
class DotAgent(object):
def __init__(self, initialPosition):
self.position = np.array(initialPosition)
def getBodyPosition(self):
return np.array([self.position, self.position], dtype="object") |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 CERN.
# Copyright (C) 2020 Northwestern University.
# Copyright (C) 2020 European Union.
#
# Invenio-Records-Resources is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see LICENSE file for more
# details.
"""Record Service A... |
#
# Copyright (c) 2013-2016 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# All Rights Reserved.
#
""" inventory numa node Utilities and helper functions."""
import os
from os import listdir
from os.path import isfile
from os.path import join
import r... |
import cv2
import os
import numpy as np
image_folder = 'viss'
mt_image_folder = '/home/fothar/MaskTrackRCNN/None/'
def imFunc(e):
return int(e[:-4])
def sceneFunc(e):
return int(e)
scenes = [scene for scene in os.listdir(image_folder) if os.path.isdir(os.path.join(image_folder, scene))]
scenes.sort(key=scen... |
# Borrowed from Alex Martelli's sort from Python cookbook using inlines
# 2x over fastest Python version -- again, maybe not worth the effort...
# Then again, 2x is 2x...
#
# C:\home\eric\wrk\scipy\weave\examples>python dict_sort.py
# Dict sort of 1000 items for 300 iterations:
# speed in python: 0.2509999275... |
import pulumi
from pulumi_aws import ec2, get_availability_zones
stack_name = pulumi.get_stack()
project_name = pulumi.get_project()
config = pulumi.Config('vpc')
vpc = ec2.Vpc(resource_name=f"eks-{project_name}-{stack_name}",
cidr_block="10.100.0.0/16",
enable_dns_support=True,
... |
from endless_pagination.views import AjaxListView
from django.views.generic import ListView, DetailView
from django.utils import timezone
from .models import Post, Poem, Letter
class PostListView(AjaxListView):
model = Post
queryset = Post.objects.all()
context_object_name = "posts"
def get_context_... |
import numpy as np
from structure import Structure
from tqdm import tqdm as Tqdm
from pdb import set_trace
class VariableDimensionStructure(Structure):
def default_initialize_structure(self, in_dim, out_dim):
structure = {"modules" : []}
if out_dim % self.module_out_size != 0:
raise ValueError("Proble... |
import time, datetime, os, requests, glob, horizonJPLLoader, json
from dateutil.relativedelta import relativedelta
# all time in UTC
# Rise Transit and Set times
class RTSTime :
def __init__(self, d, s) :
self.d = d
self.s = s
# list of RTSTimes for body at longitude
rts = {} # rts[body][longitud... |
n = int(input())
T = [int(input()) for _ in range(n)]
Tdic = {}
for t in T:
Tdic[t] = Tdic.get(t, 0) + 1
T.sort()
print(sum([(len(T)-cnt) * t for cnt, t in enumerate(T)]))
ans = 1
div = 10**9 + 7
def fact(n):
ret = 1
for i in range(1,n+1):
ret = (ret*i) % div
return ret
for k in Tdic.keys():
... |
from app.common import definitions, values
from app.common.utilities import execute_command, error_exit, get_code, backup_file, \
show_partial_diff, backup_file_orig, restore_file_orig, replace_file, get_code_range, \
find_file_using_path
from app.tools import converter, emitter, finder, extractor, logger
from ... |
fruit = {"orange": "a sweet, orange, citrus fruit",
"apple": "good for making cider",
"lemon": "a sour, yellow, citrus fruit"}
veg = {"cabbage": "every child's favorite",
"sprouts": "mmmm, lovely",
"spinach": "can I have some more fruit, please"}
print(veg)
veg.update(fruit)
... |
#read and display the contents of Employee.csv in 23-a
import csv
with open('compresult.csv',"r") as fhObj:
cReader = csv.reader(fhObj)
for rec in cReader:
print(rec)
|
import re
heroRegex = re.compile(r'Batman|Tina Fey')
mo1 = heroRegex.search('Batman and Tina Fey')
print(mo1.group())
mo2 = heroRegex.search('Tina Fey and Batman')
print(mo2.group()) |
#!/usr/bin/python
import numpy as np
class ExponentialDecay:
def __init__(self, starter_value, decay_step, decay_rate, staircase=False):
"""Function that applyes an exponential decay to a value.
@param starting_value the value to decay
@param global_step the global step to use for decay ... |
# Encoding: UTF-8
# File: obs3.py
# Creation: Tuesday January 26th 2021
# Author: Arthur Dujardin (arthurdjn)
# ------
# Copyright (c) 2021, Makina Corpus
# Basic imports
from collections import defaultdict
import re
import math
import pandas as pd
# GNSS Tools
from .reader import ABCReader
from .datasets import Obs... |
# Copyright (c) Facebook, Inc. and its affiliates.
import torch
from pythia.common.registry import registry
from pythia.models.pythia import Pythia
from pythia.modules.layers import ClassifierLayer
from pythia.modules.attention import ProjectAttention
@registry.register_model("lorra")
class LoRRA(Pythia):
def __... |
from aiogram import types
from bot_app.states import GameStates
from aiogram.dispatcher import FSMContext
from . app import dp, bot
from . keyboards import inline_kb
from . data_fetcher import get_random, get_next
@dp.message_handler(commands='train_all', state="*")
async def train_all(message: types.Message, state: ... |
import requests
import xml.etree.ElementTree as ET
fahrenheit = input('Informe a temperatura em Fahrenheit (ºF):')
print('Fazendo a convesão...Aguarde')
url = 'https://www.w3schools.com/xml/tempconvert.asmx'
header = {'Content-Type' : 'application/soap+xml; charset=utf-8'}
body = """<?xml version='1.0' encoding='utf-8... |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, print_function, unicode_literals, \
absolute_import
import os
import unittest
from collections import OrderedDict
import numpy as np
from pymatgen.io.lammps.data import L... |
# Paths to images and labels
train_data_dir = "model/data/train"
train_coco = "model/data/drone.json"
# Parameters for dataloader
train_shuffle_dl = True
num_workers_dl = 4
# Training hyperparameters
train_batch_size = 1
lr = 1e-3
momentum = 0.9
weight_decay = 1e-3
num_classes = 2 # Two classes, only tar... |
import inspect
import os
import os.path
def get_path_to_this_file():
return inspect.getfile(inspect.currentframe())
def get_asset_path(rel_path, check_existing=False):
if rel_path.startswith("/"):
full_path = rel_path
else:
full_path = os.path.join(os.path.dirname(__file__), "../../data/... |
# Generated by Django 3.2 on 2021-04-26 08:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hole', '0018_userprofile'),
]
operations = [
migrations.AddField(
model_name='userprofile',
name='encrypted_email',
... |
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def home_page():
players = ["adele","shakira", "shawn"]
return render_template (
"index.html",
players=players ,
no_players = True)
if __name__ == '__main__':
app.run(debug = True) |
from prolog_parser import PrologParser
from inference import Inference
from copy import deepcopy
import sys
import lark
def read(file):
with open(file) as f:
return f.read()
class Interpreter:
builtin_file = 'data/builtin.pl'
def __init__(self, input_file):
program_parser = PrologParser()
self.request_parse... |
import FWCore.ParameterSet.Config as cms
import RecoLocalCalo.HcalRecProducers.HBHEMethod3Parameters_cfi as method3
import RecoLocalCalo.HcalRecProducers.HBHEMethod2Parameters_cfi as method2
import RecoLocalCalo.HcalRecProducers.HBHEMethod0Parameters_cfi as method0
import RecoLocalCalo.HcalRecProducers.HBHEPulseShapeFl... |
import discord
from discord.ext import commands
import cogs.specialized.character as db
import shlex
from cogs.utils.SimplePaginator import SimplePaginator
def parseMarkedArgs(ctx, args, namecheck=False):
out = {}
while True:
if args[0] == ('--n') and namecheck:
name, args = args[1], args[... |
# -*- coding: utf-8 -*-
from fftool.ffdata import *
from fftool.teams import *
from fftool.fftool import * |
"""
Bootstrapper for test framework plugins.
"""
|
# -*- coding: utf-8 -*-
from sklearn.linear_model import LogisticRegression
from sklearn.datasets import fetch_mldata
TRAINING_SIZE = 10000
class CNN():
def __init__(self):
self.clf = LogisticRegression(penalty='l1', C=10000.0)
mnist = fetch_mldata('MNIST original')
self.X = mnist.data[0... |
#! /usr/bin/env python
#######################################
# A python script to read in a CSV file
# with a colour table and produce the C++
# code to be used with the SPD Points Viewer.
#
# Author: Pete Bunting
# Email: petebunting@mac.com
# Date: 11/01/2012
# Version: 1.0
#######################################... |
"""
All the code for evaluation.
Copyright 2015, University of Freiburg.
Elmar Haussmann <haussmann@cs.uni-freiburg.de>
"""
from collections import namedtuple
from dateutil import parser as dateparser
import logging
import random
import json
import time
logger = logging.getLogger(__name__)
def load_eval_queries(da... |
from django.shortcuts import render, redirect, get_object_or_404
from django.db.models import Q
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.urls import reverse
from django.views.decorators.csrf import csrf_exempt
from django.conf import settings
from django.contrib.auth import a... |
# Copyright 2004-present Facebook. All Rights Reserved.
from typing import List, Optional
import labgraph as lg
from ..window_trigger import (
make_window_trigger_node,
WindowTriggerConfig,
)
###############################################################################
# Types us... |
#!/usr/bin/python
from math import sqrt
p = 277678
n = int(sqrt(p) + 1)
c = int((n + 1) / 2)
steps = list(range(c-1, n-1))
steps = list(reversed(steps)) + steps[1:] + [n-1]
print(
[steps[i % len(steps)] for i, v in enumerate(
range(((n-2)**2)+1, (n**2)+1)
) if v == p][0]
)
|
"""
Remove files.
usage: rm [-h] [-r] [-d] files [files ...]
positional arguments:
files files to remove
options:
-h, --help show this help message and exit
-r remove files recursively
-d remove directories
"""
import argparse
import shutil
import os
def main():
parser = argpars... |
import numpy as np
import spikeextractors as se
from scipy.optimize import linear_sum_assignment
from .sortingcomparison import SortingComparison
class MultiSortingComparison():
def __init__(self, sorting_list, name_list=None, delta_tp=10, minimum_accuracy=0.5):
if len(sorting_list) > 1 and np.all(isinstan... |
'''
Created on 12 Dec 2016
@author: matt
'''
import logging
from optparse import OptionParser
from model import EdgeGenerate, NodeGenerate
import render
import rulesets
def main():
logging.basicConfig()
logging.getLogger().setLevel(logging.INFO)
parser = OptionParser()
parser.add_option('-m', des... |
# Demo of the bootstrap filter under a
# nonlinear discrete system
import jax
from jsl.nlds.base import NLDS
from jsl.nlds.bootstrap_filter import filter
import jax.numpy as jnp
import matplotlib.pyplot as plt
from jax import random
def plot_samples(sample_state, sample_obs, ax=None):
fig, ax = plt.subplots()
... |
# Copyright (c) 2010-2012 OpenStack 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 agree... |
import sys
import codecs
import cpplint
import utils
def run_lint( paths, nudgeOn=False ):
# errors are as of 10/14
# idea is not to let it any new type of error
# as we knock one out, we should remove line
# note: not all of these are things we want, so please check first
nudge = [] # things w... |
# coding=utf-8
# *** WARNING: this file was generated by crd2pulumi. ***
# *** 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
__all__ = [
'... |
from pylab import *
def linestyle(ls,name):
size = 256,16
dpi = 72.0
figsize= size[0]/float(dpi),size[1]/float(dpi)
fig = figure(figsize=figsize, dpi=dpi)
fig.patch.set_alpha(0)
axes([0,0,1,1],frameon=False)
X = np.arange(11)
Y = np.ones(11)
plot(X,Y,ls,color=(.0,.0,1,1), lw=3, ms=1... |
"""
Performs SQL injection payloads on selected form,
Looks for the string "error"
"""
__author__ = "sword"
import sys,os
from os.path import dirname,abspath
# Importing PinkWave extensions
sys.path.append(dirname(dirname(dirname(abspath(__file__)))))
from extensions.Util import Util,report,payloads
import extensions... |
#############################################################################
#
# Copyright (c) 2008 by Casey Duncan and contributors
# All Rights Reserved.
#
# This software is subject to the provisions of the MIT License
# A copy of the license should accompany this distribution.
# THE SOFTWARE IS PROVIDED "AS IS", W... |
from typing import TYPE_CHECKING, Final
from botus_receptus.gino import Gino, ModelMixin
db: Final = Gino()
if TYPE_CHECKING:
from gino.crud import CRUDModel
class Base(CRUDModel, ModelMixin):
pass
else:
Base = db.Model
|
import os
from dotenv import load_dotenv
import logging
load_dotenv()
class Config(object):
DEBUG = False
TESTING = False
SECRET_KEY = os.getenv('SECRET_KEY')
DB_NAME=os.getenv('DB_NAME')
DB_PASSWORD=os.getenv('DB_PASSWORD')
DB_HOST=os.getenv('DB_HOST')
DB_HOST_PROD_HOST=os.getenv('DB_PROD_... |
import os.path
from chordparser.analysers.chords_analyser import ChordAnalyser
from chordparser.editors.chord_roman_converter import ChordRomanConverter
from chordparser.editors.chords_editor import ChordEditor
from chordparser.editors.keys_editor import KeyEditor
from chordparser.editors.notes_editor import NoteEdito... |
# Author: Satrajit
import sys
import urllib.request
import urllib.parse
import re
query_string = urllib.parse.urlencode({"search_query" : sys.argv[1]})
html_content = urllib.request.urlopen("http://www.youtube.com/results?" + query_string)
search_results = re.findall(r'href=\"\/watch\?v=(.{11})', html_content.read(... |
#!/usr/bin/env python
import urllib2
from bs4 import BeautifulSoup
from parsingLibrary import loadHtmlTags, parseChannel, remove_duplicate_elements
from pymongo import MongoClient
from mongoConfiguration import load_mongo_configuration
mongo_address, mongo_port = load_mongo_configuration()
client = MongoClient(mongo_... |
"""Shared configuration and functionality for awesome_panel apps"""
from functools import wraps
from typing import Optional, Union
import panel as pn
from awesome_panel_extensions.site.gallery import GalleryTemplate
from awesome_panel_extensions.site.models import Application
from panel.template import FastGridTemplat... |
#!/usr/bin/env python
import argparse
import h5py
import scipy.io
import numpy as np
import os
import sys
sys.path.insert(1, os.path.join(os.path.dirname(__file__), '../..'))
from vdetlib.vdet.dataset import index_vdet_to_det
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('d... |
# encoding: utf-8
from __future__ import unicode_literals
import re
import json
from .common import InfoExtractor
class CBSNewsIE(InfoExtractor):
IE_DESC = 'CBS News'
_VALID_URL = r'http://(?:www\.)?cbsnews\.com/(?:[^/]+/)+(?P<id>[\da-z_-]+)'
_TESTS = [
{
'url': 'http://www.cbsnews.... |
from django.contrib import admin
from .models import Reference
# Register your models here.
@admin.register(Reference)
class ReferenceAdmin(admin.ModelAdmin):
list_display = ('id','author','title', 'body','description','link','created','updated')
list_filter = ('title','link')
search_fields = ('title','l... |
"""
Danish specific SpaCy augmenters.
"""
from functools import partial
from typing import Callable, Iterator
import spacy
from spacy.language import Language
from spacy.training import Example
from .character import char_replace_augmenter
@spacy.registry.augmenters("æøå_augmenter.v1")
def create_æøå_augmenter(
... |
game = GuessNumber(56, 0, 100)
class GuessNumber:
def __init__(self, number, mn=0, mx=100):
self.number = number
self.guesses = 0
self.min = mn
self.max = mx
def get_guess(self):
guess = input(f"Please guess a number ({self.min} - {self.max}): ")
if... |
import ctypes as C
import enum
from typing import Final
from astruct import typed_struct
from astruct.type_hints import *
from utils import CountedTable
from .fusioncompat import fusion_compat_name_for_id
@enum.unique
class ClassStatIndex(enum.IntEnum):
"""The indexes into various ClassOrItem arrays that corres... |
from .evaluator_vcoco import vcoco_evaluate, vcoco_accumulate
from .evaluator_hico import hico_evaluate
def hoi_evaluator(args, model, criterion, postprocessors, data_loader, device, thr=0):
if args.dataset_file == 'vcoco':
return vcoco_evaluate(model, criterion, postprocessors, data_loader, device, args.o... |
from rest_framework import generics, viewsets
from django.shortcuts import get_object_or_404
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework.decorators import action
from rest_framework.authentication import BasicAuthentication
from rest_framework.permissions... |
###############
### IMPORTS ###
###############
# ERROR
from error import Error, IllegalCharError, InvalidSyntaxError
# POSITION
from position import Position
# TOKENS
from token import TOKENTYPE_INT, TOKENTYPE_FLOAT, TOKENTYPE_PLUS, TOKENTYPE_MINUS, TOKENTYPE_MUL, TOKENTYPE_DIV, TOKENTYPE_LEFTPARENTESIS, TOKENTYPE_RI... |
# Generated by Django 3.1 on 2020-08-27 17:08
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... |
from django.contrib import admin
from .models import *
@admin.register(Device)
class DeviceAdmin(admin.ModelAdmin): pass
@admin.register(Endpoint)
class EndpointAdmin(admin.ModelAdmin): pass
@admin.register(EndpointMatrix)
class EndpointMatrixAdmin(admin.ModelAdmin): pass |
default_app_config = 'swag_auth.gitlab.apps.GitlabAppConfig'
|
# Copyright (c) 2020. Huawei Technologies Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (c) 2019 MendelXu
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
import math
import torch
import torch.nn as nn
import torch.nn.functional as ... |
import ext25
sentence = "All good things come to those who wait."
words = ext25.break_words(sentence)
print words
sorted_words = ext25.sort_words(words)
print sorted_words
ext25.print_first_word(words)
ext25.print_last_word(words)
#wrods
print words
print "----\nprinting first word:"
ext25.print_first_word(sorted... |
import flask
import numpy as np
import pandas as pd
import pickle
from sklearn.tree import DecisionTreeClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.neighbors import KDTree
import os
#---------- MODEL IN MEMORY ----------------#
df = pd.DataFrame(pickle.load(open('static/dummied_recent_d... |
import os
import re
import shutil
import subprocess
import tempfile
from pathlib import Path
__all__ = ("get_repo", "clone")
GIT_PREFIX = ("git@", "git://", "git+")
GIT_POSTFIX = (".git",)
RE_GITHUB = re.compile(r"^gh:/?")
RE_GITLAB = re.compile(r"^gl:/?")
def get_repo(url: str) -> str:
url = str(url) # In c... |
from lxml.builder import ElementMaker
from oadr_core.oadr_payloads.oadr_payloads_general import NAMESPACES, ELEMENTS, eiResponse
def ei_event_descriptor(event):
ei_event_descriptor = ELEMENTS['ei'].eventDescriptor()
ei_event_descriptor.append(ELEMENTS['ei'].eventID(event.event_id))
ei_event_descriptor.ap... |
#
# PySNMP MIB module DSD-OPT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DSD-OPT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:39:40 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 0... |
from flask import Flask, render_template,url_for
app=Flask(__name__)
posts=[
{
"author": "AbdulMalik Sharif",
"title": "Blog Post 1",
"content": "First Post Content",
"posted_date": "April 8, 2018"
},
{
"author": "Corey Schafer",
"title": "Blog Post 2",
"content"... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# --------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2014 Jonathan Labéjof <jonathan.labejof@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and assoc... |
#!/usr/bin/env python
import subprocess
import sys
import psutil
def start(vm_name, is_headless=True):
cmd = ["C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", "startvm", vm_name]
if is_headless:
cmd.append('--type')
cmd.append('headless')
return cmd
def close(vm_name):
return... |
"""Unit test package for thetagang_notifications."""
|
'''
Created on Oct 6, 2013 (from DialogPluginManager.py)
@author: Mark V Systems Limited
(c) Copyright 2013 Mark V Systems Limited, All rights reserved.
'''
from tkinter import simpledialog, Toplevel, font, messagebox, VERTICAL, HORIZONTAL, N, S, E, W
from tkinter.constants import DISABLED, ACTIVE
try:
from tkinte... |
#!/usr/bin/env python
'''
Mask regions of a FASTA file with N based on a BED file containing regions to
convert.
'''
import sys
import argparse
import os
import re
import ncov.fasta.mask as mask
from Bio import SeqIO
parser = argparse.ArgumentParser()
parser.add_argument('-f', '--fasta', help='FASTA file to process')... |
# Copyright (c) 2016 Universidade Federal Fluminense (UFF)
# Copyright (c) 2016 Polytechnic Institute of New York University.
# Copyright (c) 2018, 2019, 2020 President and Fellows of Harvard College.
# This file is part of ProvBuild.
"""'run' command"""
from __future__ import (absolute_import, print_function,
... |
import os
import re
from setuptools import setup
def _requires_from_file(filename):
with open(filename,"r") as f:
return f.read().splitlines()
def get_version(package):
path = os.path.join(package,"__init__.py")
with open(path,"r",encoding="utf-8") as f:
init_py = f.read()
return re.search("__... |
"""
System profile plugin for POSIX Platforms.
"""
import logging
import subprocess
import os
import shlex
import pwd
import tempfile
from functools import partial
from .base import AbstractProfiler
from ..rpc import ttypes
from .. import conf
logger = logging.getLogger(__name__)
__all__ = ["SystemProfiler"]
clas... |
# Generated by Django 2.0.9 on 2018-10-17 16:17
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('eve_sde', '0001_initial'),
('abyssal_modules', '0004_move_dogma_attributes'),
]
operations = [
migr... |
"""(Non-central) F distribution."""
import numpy
from scipy import special
from ..baseclass import Dist
from ..operators.addition import Add
class f(Dist):
"""F distribution."""
def __init__(self, dfn, dfd, nc):
Dist.__init__(self, dfn=dfn, dfd=dfd, nc=nc)
def _pdf(self, x, dfn, dfd, nc):
... |
import requests
import json
import time
api_key = "dD6vL4WCEnKquFTLsUWpWm2RaUCTiQlSgr-lw0m4DrDkbzmycTXIcOyPZUDttVeWkaRY1lr9WFD87ebLoy4sS6raIcPED-jiChg8KPLa9mGL3JAILiNtUZqnHOW3W3Yx"
search_url = "https://api.yelp.com/v3/businesses/search"
details_url = "https://api.yelp.com/v3/businesses/" # {id} after last backslash
... |
#!/usr/bin/env python3
#
# This file is part of LiteX-Boards.
#
# Copyright (c) 2022 Primesh Pinto <primeshp@gmail.com>
# SPDX-License-Identifier: BSD-2-Clause
from migen import *
from litex.build.generic_platform import *
from litex.build.xilinx.vivado import vivado_build_args, vivado_build_argdict
from litex_boar... |
import pytest
from work_classes.string_calculator import StringCalculator
def test_empty_string(mocker):
mc = mocky_ret(mocker, [])
task_string = ""
assert StringCalculator.add(task_string) == 0
mc.assert_called_once_with(task_string)
def test_one_value_sum(mocker):
mc = mocky_... |
__author__ = 'Daniel Alexander Ross Evans'
import os
import simplejson as json
import shutil
import sys
import fire
from collections import defaultdict
from pkg_resources import resource_string
ext = resource_string(__name__, "extensions.json")
extensions = json.loads(ext)
def path_to_folder(path):
"""Finds the ... |
# proxy module
from traitsui.wx.ui_modal import *
|
#!/usr/bin/env python
import os
import subprocess
import sys
from setuptools import setup, find_packages
# Get the Quickstart document
with open('README.md') as readme:
README = readme.read()
# Update version from latest git tags.
# Create a version file in the root directory
version_py = os.path.join(os.path.d... |
"""
Helper functions for plotting.
"""
import gc
import sys
import altair as alt
import matplotlib.pyplot as plt
import numpy as np
import statsmodels.distributions as sm_dist
# Use statsmodels for empirical cdf function
import statsmodels.tools as sm_tools # isort:skip
# Alias the empirical cdf function. The if-st... |
import carla
import py_trees
from scenario_runner_extension.rss_ext_behavior import RssExtBehavior
from scenario_runner_extension.rss_criteria import RssTest
from srunner.tools.scenario_helper import *
from srunner.scenarios.basic_scenario import BasicScenario
from srunner.scenariomanager.scenarioatomics.atomic_behav... |
#!/usr/bin/env python
#
# Copyright (c) 2015 Pavel Lazar pavel.lazar (at) gmail.com
#
# The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED.
#####################################################################
"""
Transforms an OpenBox configuration in to a Click's configuration
"""
import capabilities
... |
from itertools import combinations
import numpy as np
from torch.autograd import Variable
import torch as th
import torch.nn as nn
import torch.nn.functional as F
from components.transforms import _check_inputs_validity, _to_batch, _from_batch, _adim, _bsdim, _tdim, _vdim, _check_nan
from models.basic import RNN as Re... |
"""
Test utilities component of divdet
"""
import os
import os.path as op
import unittest
import numpy as np
from numpy.testing import assert_equal
from divdet.utils_data import (_get_all_valid_corners)
class Test(unittest.TestCase):
"""Test utilities functionality"""
def test_valid_corners(self):
... |
#!/usr/bin/env python3
# Copyright (c) 2004-present Facebook All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import argparse
import sys
from typing import List
from partnerscripts.utils import add_base_args
from psym import PsymClient
from psym... |
class DBFNotFound(IOError):
"""Raised if the DBF file was not found."""
pass
class MissingMemoFile(IOError):
"""Raised if the corresponding memo file was not found."""
__all__ = ['DBFNotFound', 'MissingMemoFile']
|
"""Retrieve upstream datasets from a specified dataset."""
import argparse
from typing import List, Dict
import tamr_toolbox as tbox
from tamr_unify_client.dataset.resource import Dataset
def main(*, instance_connection_info: Dict[str, str], dataset_id: str) -> List[Dataset]:
"""Retrieve upstream datasets from ... |
import base64
from google.cloud import kms_v1
import os
# CONSTANTS
PROJECT_ID = os.environ['GCP_PROJECT']
LOCATION_ID = 'global'
KEY_RING_ID = os.environ['KEY_RING_ID']
KEY_ID = os.environ['KEY_ID']
KMS_CLIENT = kms_v1.KeyManagementServiceClient()
CRYPTO_KEY = KMS_CLIENT.crypto_key_path_path(PROJECT_ID, LOCATION_ID,... |
import numpy as np
import pandas as pd
import pickle
import os
import lightgbm as lgb
import statsmodels.api as sm
from sklearn.preprocessing import StandardScaler
from bokeh.layouts import row
from bokeh.plotting import figure, output_file, show, gridplot
from bokeh.models import ColumnDataSource, FactorRange
from b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.