text stringlengths 2 999k |
|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# big_abs documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
#
# 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
# aut... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
from typing import Optional, Tuple, cast
import gym
import hydra.utils
import numpy as np
import omegaconf
impo... |
from typing import Union
from ..types import TealType
from ..ir import TealOp, Op, TealBlock
from ..errors import TealInputError
from .leafexpr import LeafExpr
class Int(LeafExpr):
"""An expression that represents a uint64."""
def __init__(self, value: int) -> None:
"""Create a new uint64.
A... |
"""python wrapper for CAISO Oasis API"""
__version__ = "0.2.7"
|
import pytest
from frictionless import describe, Resource, Package, helpers
from frictionless.plugins.csv import CsvDialect
# General
@pytest.mark.skipif(helpers.is_platform("windows"), reason="It doesn't work for Windows")
def test_describe():
resource = describe("data/table.csv")
assert resource.metadata_... |
# Django settings for patchman project.
from __future__ import unicode_literals, absolute_import
import os
import sys
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DEBUG = True
ALLOWED_HOSTS = ['127.0.0.1']
ADMINS = []... |
# Copyright 2016 PerfKitBenchmarker 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 appli... |
def odd(n):
"""Tells is a number is odd."""
if n <= 0:
return False
return not odd(n-1)
|
import pika, time
credentials = pika.PlainCredentials('therabbit', 'secret123')
parameters = pika.ConnectionParameters(host='rabbitmq', port=5672, virtual_host='/', credentials=credentials)
print(f'Parameters: {parameters}')
connection = pika.BlockingConnection(parameters)
channel = connection.channel()
channel.queue... |
# -*- coding: utf-8 -*-
'''
Return data to an ODBC compliant server. This driver was
developed with Microsoft SQL Server in mind, but theoretically
could be used to return data to any compliant ODBC database
as long as there is a working ODBC driver for it on your
minion platform.
:maintainer: C. R. Oldham (cr@sal... |
#MenuTitle: Move Vietnamese Marks to top_viet Anchor in Circumflex
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
from builtins import str
__doc__="""
Where possible, puts acute(comb), grave(comb), hookabovecomb on 'top_viet' position in all layers in all selected glyphs. Assu... |
import numpy as np
import cv2
class SeamCarver:
def __init__(self, filename, out_height, out_width, protect_mask='', object_mask=''):
# initialize parameter
self.filename = filename
self.out_height = out_height
self.out_width = out_width
# read in image and store as np.flo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.constant.ParamConstants import *
class KoubeiSalesKbassetStuffCancelstockinorderQueryModel(object):
def __init__(self):
self._ext_info = None
self._page_no = None
self._page_size = None
@prop... |
#!/usr/bin/env python
import numpy as np
def convert_to_x4_q7_weights(weights):
[r, h, w, c] = weights.shape
weights = np.reshape(weights, (r, h*w*c))
num_of_rows = r
num_of_cols = h*w*c
new_weights = np.copy(weights)
new_weights = np.reshape(new_weights, (r*h*w*c))
counter = 0
for i i... |
from .motifprogram import MotifProgram
import io
import re
from subprocess import Popen, PIPE
from tempfile import NamedTemporaryFile
from gimmemotifs.motif import Motif
class Meme(MotifProgram):
"""
Predict motifs using MEME.
Reference:
"""
def __init__(self):
self.name = "MEME"
... |
import src.util.type_helper as th
class Converters:
def __init__(self, *args, **kwargs):
self.verbose = False
self.debug = False
if 'verbose' in kwargs:
value = kwargs.get('verbose')
th.validate(name_of_value='verbose', value_to_check=value, d_type=bool)
... |
from subprocess import Popen, PIPE
from config_parser import getModuleIntervals
from config_parser import getTimestampsFile
import sys
import pickle
import time
import myexceptions
def execute(command):
output = Popen(command, shell=True, stdout=PIPE, stderr=PIPE)
return output.stdout.readlines()
def getExec... |
# Generated by Django 3.2.5 on 2021-08-10 21:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0014_corereinvitation'),
]
operations = [
migrations.AddField(
model_name='historicalmanuscript',
name='addi... |
# coding: utf-8
"""
Cherwell REST API
Unofficial Python Cherwell REST API library. # noqa: E501
The version of the OpenAPI document: 9.3.2
Contact: See AUTHORS.
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from pycherwell.configuration imp... |
"""info_variables.py
Used to provide basic variable information in a way that
can be useful for beginners without overwhelming them.
"""
import ast
import builtins
import sys
from . import utils
from . import debug_helper
from . import token_utils
from .path_info import path_utils
from .my_gettext import current_lan... |
# (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
__version__ = '3.9.0'
|
from pytest_mock import MockFixture
from opta.pre_check import dependency_check
class TestPreCheck:
def test_dependency_check(self, mocker: MockFixture) -> None:
validate_version = mocker.patch("opta.pre_check.Terraform.validate_version")
dependency_check()
validate_version.assert_calle... |
#!/usr/bin/python
# 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
# "Licens... |
import json
import subprocess
import arrow
import click
import yaml
from tasklib import Task
from tasklib.serializing import SerializingObject
from .cmd import quiet, task, tw
def rewrite_task(backend, data):
dates_cols = ("due", "wait")
for col in dates_cols:
if col in data:
serializer ... |
print('Python module loaded')
import numpy as np
def sum(i, j):
return np.array(i) + np.array(j).tolist() # using numpy arrays as return types would require eigen |
import cv2
from screen import Screen
from typing import Tuple, Union, List
from dataclasses import dataclass
import numpy as np
from logger import Logger
import time
import os
from config import Config
from utils.misc import load_template, list_files_in_folder, alpha_to_mask
@dataclass
class TemplateMatch:
name: ... |
from typing import List, Tuple
import tensorflow as tf
import random
AUTOTUNE = tf.data.experimental.AUTOTUNE
class DataLoader(object):
"""A TensorFlow Dataset API based loader for semantic segmentation problems."""
def __init__(self, image_paths: List[str], mask_paths: List[str], image_size: Tuple[int],
... |
"""Forex Controller."""
__docformat__ = "numpy"
import argparse
import logging
import os
from datetime import datetime, timedelta
from typing import List
import pandas as pd
from prompt_toolkit.completion import NestedCompleter
from gamestonk_terminal import feature_flags as gtff
from gamestonk_terminal.decorators i... |
#!/usr/bin/env python
import os
def main():
"""Adds newlines back to every file, to make them PEP8 compliant."""
root_path = os.getcwd()
for dirpath, dirnames, filenames in os.walk(root_path):
for filename in filenames:
path = os.path.join(dirpath, filename)
if path.endswit... |
from typing import Union, List, Optional
from pyspark.sql.types import StructType, StructField, StringType, ArrayType, DataType
# This file is auto-generated by generate_schema so do not edit it manually
# noinspection PyPep8Naming
class SubstanceSourceMaterial_FractionDescriptionSchema:
"""
Source material ... |
# encoding=utf-8
import unittest
from ..similarities import *
from .. import similarities as sims
from numpy.testing import assert_allclose
class TestSimilarities(unittest.TestCase):
def setUp(self):
self.X = [
[1, 0, 1, 0],
[1, 1, 0, 1],
[0, 1, 0, 0]
]
... |
from torch.utils.data import Dataset, DataLoader, Subset
from zipfile import BadZipFile
import os
from process_data import files_utils, mesh_utils, points_utils
import options
from constants import DATASET
from custom_types import *
import json
class MeshDataset(Dataset):
@property
def transforms(self):
... |
# Copyright 2021 IBM Corporation
#
# 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... |
#
# 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... |
#!/usr/bin/python2
'''
Perform basic ELF security checks on a series of executables.
Exit status will be 0 if successful, and the program will be silent.
Otherwise the exit status will be 1 and it will log which executables failed which checks.
Needs `readelf` (for ELF) and `objdump` (for PE).
'''
from __future__ impor... |
import os
from dcos import constants
import pytest
from .common import config_set, exec_command, update_config
@pytest.fixture
def env():
r = os.environ.copy()
r.update({
constants.PATH_ENV: os.environ[constants.PATH_ENV],
constants.DCOS_CONFIG_ENV: os.path.join("tests", "data", "dcos.toml"... |
# -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import sys
import unittest
from tdda.constraints.testbase import *
from tdda.referencetest import ReferenceTestCase
try:
from tdda.constraints.pd.testpdconstraints import *
except ... |
# coding: utf-8
# /*##########################################################################
# Copyright (C) 2016 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# i... |
from nltk.corpus.reader import CHILDESCorpusReader, NS, string_types
from nltk.corpus.reader.xmldocs import ElementTree
sent_node = './/{%s}u' % NS
word_node = './/{%s}w' % NS
word_pos_tag_node = './/{%s}c' % NS
replacement_node = './/{%s}w/{%s}replacement' % (NS, NS)
replaced_word_node = './/{%s}w/{%s}replacement/{%... |
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
import torch
from torch.nn import functional as F
models_urls = {
'101_voc': 'https://cloudstor.aarnet.edu.au/plus/s/Owmttk9bdPROwc6/download',
'18_imagenet': 'https://download.pytorch.org/models/resnet18-5c106cde.pth',
'34_imagenet': 'https:... |
from django.conf.urls import url
from AiSHABot import views
urlpatterns = [
url(r'^7a8bc5f20d6c86b3021a74a4a1bca1bbe411ea6b9f04628f6a/?$', views.AiSHAView.as_view()),
url(r'^privacy', views.privacy)
] |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import pandas as pd
static = pd.read_csv("CCG_AIS_Static_Data_2018-05-01.csv")
cs_countries = pd.read_csv("CallSignSeriesRanges-1cc49d48-935c-4514-9ba2-3aabef92c7aa.csv")
cs_countries[cs_countries['Series'].str.contains("VGdd")].shape[0]
static = static.drop_dup... |
import pandas as pd
import numpy as np
def unprocessed(csv_file):
df = pd.read_csv('../data/raw/mars-weather.csv')
return df
def load_and_process(csv_file):
df = pd.read_csv('../data/raw/mars-weather.csv')
df1=(df.copy().drop(['atmo_opacity','wind_speed','id'], axis=1)
.rename(columns={"terres... |
# GENERATED BY KOMAND SDK - DO NOT EDIT
from .action import SubmitFiles
|
#!/usr/bin/env python
#
# Copyright (c) 2016, Nest Labs, 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:
# 1. Redistributions of source code must retain the above copyright
# notice, this ... |
#!/usr/bin/env python
import sys
import os
import subprocess
import errno
import multiprocessing
from multiprocessing import Process
import time
import argparse
#NSE Documentation
#Running
#dns-cache-snoop: Performs DNS cache snooping against DNS dns-cache-snoop.mode=timed,dns-cache-snoop.domains... |
from fastai.text import *
import fire
BOS = 'xbos' # beginning-of-sentence tag
FLD = 'xfld' # data field tag
BOS_LABEL = '_bos_'
PAD = '_pad_'
re1 = re.compile(r' +')
def read_file(filepath):
assert os.path.exists(filepath)
sentences = []
labels = []
with open(filepath, encoding='utf-8') as f:
... |
# -*- coding: utf-8 -*-
#
# BGPStream documentation build configuration file, created by
# sphinx-quickstart on Thu Oct 22 09:31:35 2015.
#
# 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.
#
#... |
from drf_yasg import openapi
import winter
from winter_openapi import QueryParametersInspector
from winter.web.routing import get_route
class ControllerForQueryParameter:
@winter.route_get('{?valid_query_param,mapped_query_param}')
@winter.map_query_parameter('mapped_query_param', to='invalid_query_param')
... |
"""Initial Migration
Revision ID: 90a0a2f4afc9
Revises:
Create Date: 2021-11-14 15:14:33.638202
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '90a0a2f4afc9'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto ... |
import glob
import logging
import os
import subprocess
from matplotlib import pyplot as plt
import numpy as np
from grakel import Graph
from grakel.datasets import fetch_dataset
try:
from clogging.CustomFormatter import CustomFormatter
except:
from ..clogging.CustomFormatter import CustomFormatter
cla... |
import numpy as np
import math
import grid_generate as GridGen
import estimate_method as EstMeth
import frequency_oracle as FreOra
import itertools
import choose_granularity
class AG_Uniform_Grid_1_2_way_optimal:
def __init__(self, args = None):
self.args = args
self.group_attribute_num = 2 # to c... |
import urllib.parse
import requests
import os
import bs4
######### DO NOT CHANGE THIS CODE #########
def get_request(url):
'''
Open a connection to the specified URL and if successful
read the data.
Inputs:
url: must be an absolute URL
Outputs:
request object or None
Examp... |
import appdaemon.plugins.hass.hassapi as hass
#
# Listen for presence sensor change state and change alarm control panel state.
#
# Args:
# sensor - home presence 'sensor'
# ha_panel - alarm control panel entity (to arm and disarm).
# constraint - (optional, input_boolen), if turned off - alarm panel will be n... |
# -*- coding: utf-8 -*-
"""
This file contains all jobs that are used in tests. Each of these test
fixtures has a slighty different characteristics.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import os
import time
import sys
from rq import Connect... |
# encoding: utf-8
import logging
import os
import zipfile
from .charfields import CharField
from .computed import ComputedFieldMixin
# pyuca only supports version 5.2.0 of the collation algorithm on Python 2.x
COLLATION_FILE = "allkeys-5.2.0.txt"
COLLATION_ZIP_FILE = os.path.join(os.path.dirname(__file__), "allkeys-... |
#!/usr/bin/env python
#############################################################################
##
## Copyright (C) 2018 Riverbank Computing Limited.
## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
##
## This file is part of the examples of PyQt.
##
## $QT_BEGIN_LICENSE:BSD$
## You may use this file ... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/googleads_v6/proto/resources/remarketing_action.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from ... |
from pathlib import Path
from fhir.resources.valueset import ValueSet as _ValueSet
from oops_fhir.utils import ValueSet
from oops_fhir.r4.code_system.linkage_type import LinkageType as LinkageType_
__all__ = ["LinkageType"]
_resource = _ValueSet.parse_file(Path(__file__).with_suffix(".json"))
class LinkageType... |
import adafruit_ble
from adafruit_ble.advertising import Advertisement
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
from adafruit_ble.services.standard.device_info import DeviceInfoService
from adafruit_ble.services.standard.hid import HIDService
from adafruit_hid.keyboard import Keyboard
... |
import logging
import os
import pickle
import mmcv
import torch
from mmcv.runner import HOOKS, Hook
from mmcv.runner.dist_utils import master_only
@HOOKS.register_module()
class PickleDataHook(Hook):
"""Pickle Useful Data Hook.
This hook will be used in SinGAN training for saving some important data
tha... |
from .base import Distribution, Probability
from .normal import (
Normal,
MixedNormal
)
def parse_distribution(dist_type, dist_params):
dist_type = dist_type.lower()
if dist_type == "normal":
return Normal.instantiate(dist_params)
if dist_type == "mixed_normal":
return MixedNormal.i... |
#!/usr/bin/env python3
import struct
import sys
class Patcher:
PATCH_TYPE_BYTES = 0
PATCH_TYPE_JUMP = 1
PATCH_TYPE_JAL = 2
PATCH_TYPE_PTR = 3
patchTypes = ['bytes', 'jump', 'jal', 'ptr']
def __init__(self):
self.patches = []
self.sections = {}
self.symbols = {}
... |
# Copyright 2019 DeepMind Technologies Limited. 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 ... |
from flask import render_template, session, redirect, url_for, current_app, abort,flash, request, make_response
from .. import db
from ..models import User, Role, Post, Permission, Comment
from ..email import send_email
from . import main
from .forms import EditProfileForm, EditProfileAdminForm, PostForm, CommentForm
#... |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, VHRS and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class NeighbourhoodCheck1(Document):
pass
|
import chess
import math
from colorama import Fore, Style, Back
import inquirer
from enum import Flag
import search
import paint
import networkx as nx
import graph
class Player(Flag):
COMPUTER = True
HUMAN = False
def ask_player_type(color: chess.Color) -> Player:
questions = [
inquirer.List(
... |
import logging
import pytest
from sanic.signals import RESERVED_NAMESPACES
from sanic.touchup import TouchUp
def test_touchup_methods(app):
assert len(TouchUp._registry) == 9
@pytest.mark.parametrize(
"verbosity,result", ((0, False), (1, False), (2, True), (3, True))
)
async def test_ode_removes_dispatch_... |
from Motor import MotorADC
class Master:
__instance = None
def __init__(self):
#self.status_vector = dict()
#self.command_vector = dict()
self.motor_adc = MotorADC()
Master.__instance = self
@staticmethod
def get_instance():
if Master.__instance is None:
... |
import numpy as np
from ceres.constants import muSun, AU, SPD
from ceres.orbits import TwoBody
# Orbital elements for CERES (from SBDB):
a = 2.766043062222408*AU
e = 0.07850100198908602
i = np.deg2rad(10.58769305845201)
peri = np.deg2rad(73.63703979153577)
RAAN = np.deg2rad(80.26859547732911)
M = np.deg2rad(291.37559... |
str_N = input("Please enter a number to find summation of 1..N: ")
N = int(str_N) + 1
total = 0
for n in range(3,N,3):
total = total + n
print(total)
|
class Pessoa:
olhos = 2
def __init__(self, *filhos, nome=None, idade=35):
self.idade = idade
self.nome = nome
self.filhos = list(filhos)
def cumprimentar(self):
return f'olá {id(self)}'
@staticmethod
def metodo_estatico():
return 42
@classmethod
de... |
#!/usr/bin/env python
# coding: utf-8
"""
The approach taken is explained below. I decided to do it simply.
Initially I was considering parsing the data into some sort of
structure and then generating an appropriate README. I am still
considering doing it - but for now this should work. The only issue
... |
from typing import TextIO
from .datatypes import OsuFile
from .sections import Metadata, TimingPoints, HitObjects, Events, Colours, make_default_metadata_sections
from .combinator import ParserPair
from .utils import spliton
class Parser:
# base parsers
def parse_bool(self, x): return bool(int(x))
def writ... |
from unittest.mock import patch
PLAYERS = ['Player 1', 'Player 2']
def test_print_intro(capsys):
print_intro()
capture = capsys.readouterr()
assert capture.out == "...rock...\n...paper...\n...scissors...\n"
def test_player_1_input():
with patch('builtins.input', return_value='rock'):
test_n... |
from .test_billable_hours import TestBillableHours
from .test_hourly import TestHourlyReport
from .test_payroll import PayrollTest
from .test_productivity import TestProductivityReport
|
from flaskdocs import mail, twilio
from flask_mail import Message
def send_email_to_staff(staff, document, daysleft):
msg = Message(f'Уведомление о документе - {document.name}', sender="noreply@dochub.info", recipients=[staff.email])
msg.body = f'''{staff.first_name} {staff.second_name}, Ваш {document.name} и... |
import os
from googleapiclient.discovery import build
import googleapiclient.errors
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials
from youtube_dl import YoutubeDL
import constants
from parameter_store import ParameterStore
class YoutubeClient:
"""
... |
"""
This file offers the methods to automatically retrieve the graph Clostridium tetanomorphum.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v11: protein--prot... |
##########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2020, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
##########################################################################
import uuid
from ... |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
def solution(A):
# write your code in Python 3.6
nums = set()
for n in A:
if n in nums:
nums.remove(n)
else:
nums.add(n)
return nums.pop() |
import asyncio
import time
from multiprocessing import Queue
from threading import Thread
import pytest
from liualgotrader.common.types import QueueMapper, WSEventType
from liualgotrader.data.gemini import GeminiStream
gemini_stream: GeminiStream
queues: QueueMapper
stop: bool = False
@pytest.fixture
def event_loo... |
from tracardi.domain.context import Context
from tracardi.domain.entity import Entity
from tracardi.domain.event import Event
from tracardi.domain.profile import Profile
from tracardi.domain.session import Session
from tracardi_plugin_sdk.service.plugin_runner import run_plugin
from datetime import datetime
from tracar... |
#!/usr/bin/env python2.7
from serial import Serial
from optparse import OptionParser
import binascii
parser = OptionParser()
parser.add_option("-s", "--serial", dest="serial_port", default="/dev/ttyUSB0", help="Serial port")
(options, args) = parser.parse_args()
ser = Serial(options.serial_port, 115200, 8)
cmd = "... |
from django import forms
from openslides.utils.forms import CssClassMixin
class OptionForm(CssClassMixin, forms.Form):
def __init__(self, *args, **kwargs):
extra = kwargs.pop('extra')
formid = kwargs.pop('formid')
kwargs['prefix'] = "option-%s" % formid
super(OptionForm, self).__i... |
import os
import ConfigParser
class BaseConfig(object):
def __init__(self, config_file=None):
if config_file is None:
config_file = 'config.ini'
config_path = os.path.join(os.path.dirname(__file__), 'config/' + config_file)
self.config = ConfigParser.ConfigParser()
se... |
"""
Filename: correct_mask.py
Author: Damien Irving, irving.damien@gmail.com
Description: Correct a bogus mask (e.g. some models put 1.0 or Nan as the mask value)
"""
# Import general Python modules
import sys, os, pdb
import argparse
import numpy
import iris
import cmdline_provenance as cmdprov
# Impor... |
#Em um campeonato de futebol existem 5 times e cada um possui onze jogadores.
#Faça um programa que receba idade e o peso de cada um dos jogadores
#Calcule e mostre:
#A quantidade de jogadores com idade inferior a 18 anos;
#A média das idades dos jogadores de cada time;
#A porcentagem de jogadores com mais de 80 quilos... |
# Copyright 2016 Google Inc. 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 law or a... |
from flask import Blueprint, render_template, request
import requests
import os
from app.views.main.main import *
"""
### Pa .não sei se vou fazer o user. LACK OF TIME
Blueprints: Are a way to organize our project. So to put it simpler, is a means to organize our project in folders
In python each folder is a module.... |
from sklearn.base import TransformerMixin
import pandas as pd
import numpy as np
from time import time
class IndexBasedTransformer(TransformerMixin):
def __init__(self, case_id_col, cat_cols, num_cols, max_events=None, fillna=True, create_dummies=True):
self.case_id_col = case_id_col
self.cat_... |
#
# Copyright (c) 2020, NVIDIA CORPORATION.
#
# 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 ... |
# 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.
# Changes ... |
import numpy as np
import pytest
from smcpy import SMCSampler
@pytest.fixture
def phi_sequence():
return np.linspace(0, 1, 11)
@pytest.fixture
def step_list(phi_sequence, mocker):
num_particles = 5
step_list = []
for phi in phi_sequence[1:]:
particles = mocker.Mock()
particles.log_w... |
# -*- coding:utf-8 -*-
from emgen.cli.main import main
|
from __future__ import annotations
from spark_auto_mapper_fhir.fhir_types.uri import FhirUri
from spark_auto_mapper_fhir.value_sets.generic_type import GenericTypeCode
from spark_auto_mapper.type_definitions.defined_types import AutoMapperTextInputType
# This file is auto-generated by generate_classes so do not edi... |
import collections
import logging
from lms import notifications
from lms.lmsdb import models
class IdenticalSolutionSolver:
def __init__(
self,
solution_check_pk: str,
logger: logging.Logger,
):
self._solution_id = solution_check_pk
self._solution = None
... |
# Copyright 2019 The Cirq Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
from django.test import TestCase
import datetime
from django.utils import timezone
from locallibrary.catalog.forms import RenewBookForm
class RenewBookFormTest(TestCase):
def test_renew_form_date_field_label(self):
form = RenewBookForm()
self.assertTrue(form.fields['renewal_date'].label == None or... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.