text stringlengths 2 999k |
|---|
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import pandas as pd
class AbstractTransformer:
"""An abstract class that provides an sklearn-like API."""
def fit(self, df: pd.DataFrame, *args, **kwargs) -> None:
raise NotImplementedError()
def transform(self, df: pd.DataFrame, *args, **kwargs) -> pd.DataFrame:
raise NotImplementedError... |
from flask import Blueprint
auth = Blueprint('auth',__name__)
from . import views
from . import forms |
# Copyright (c) 2018 PaddlePaddle 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 app... |
# Copyright 2019 Extreme Networks, 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 i... |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string'
FLASK_ADMIN = os.environ.get('FLASK_ADMIN')
SQLALCHEMY_TRACK_MODIFICATIONS = False
FLASKY_POSTS_PER_PAGE = 5
FLASKY_COMMENTS_PER_PAGE = 5
FLASKY_FOLL... |
#!/usr/bin/env python
"""
classic rpyc server (threaded, forking or std) running a SlaveService
usage:
rpyc_classic.py # default settings
rpyc_classic.py -m forking -p 12345 # custom settings
# ssl-authenticated server (keyfile and certfile are required)
rpyc_classic.py --ss... |
from django.conf.urls import url
from ..views.oj import AnnouncementAPI
urlpatterns = [
url(r"^announcement/?$", AnnouncementAPI.as_view(), name="announcement_api"),
]
|
"""empty message
Revision ID: 9b413d81e5f7
Revises: 3b7f9f378040
Create Date: 2020-08-15 13:08:33.700509
"""
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
# revision identifiers, used by Alembic.
revision = '9b413d81e5f7'
down_revision = '3b7f9f378040'
branch_labels = None
depends_on = None
... |
from django.conf import settings
from django.template import TemplateDoesNotExist
from django.utils.translation import ugettext
from django.template.loader import select_template
from pinax.notifications_backends.utils import get_class_from_path
from pinax.notifications.backends.email import EmailBackend
from mail_t... |
#
# Copyright 2019 The FATE 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... |
# 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 agreed to in writing, ... |
# Generated by Django 1.11.24 on 2019-10-03 22:27
from django.db import migrations, models
from django.db.backends.postgresql.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
def update_role(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None:
UserProfile = apps.get_mo... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import logging
import re
from flexget import plugin
from flexget.event import event
from flexget.plugins.internal.urlrewriting import UrlRewritingError
from flexget.utils.... |
import json
from unittest import TestCase
from osbot_utils.utils.Dev import Dev
from gw_bot.api.gw.skd_editor.API_SISL import API_SISL
class test_API_SISL(TestCase):
def setUp(self):
self.sisl = API_SISL()
self.result = None
self.path_sisl_zip_file = '/tmp/tmp-input/doc-1.docx.zip'
... |
from django.conf.urls import url
from . import views
from rest_framework_swagger.views import get_swagger_view
schema_view = get_swagger_view(title='SmartContract API')
urlpatterns = [
url(r'stamp/', views.Stamp.as_view()),
url(r'verify/', views.Verify.as_view()),
url(r'getBlockNumber/', views.GetBlockNu... |
"""
WSGI config for app project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app.settings")
from django.core.wsgi impo... |
class IndexRecord(object):
def __init__(self):
self.title = None
self.author = None
self.subjects = None
self.location = None
self.issn = None
self.isbn = None
self.collections = None
self.series = None
self.callnum = None
self.notes = ... |
from dataclasses import dataclass
from wca.storage import Storage
import logging
import requests
log = logging.getLogger(__name__)
@dataclass
class HTTPStorage(Storage):
http_endpoint: str = 'http://127.0.0.1:8000'
def store(self, metrics):
log.info('sending!')
try:
requests.pos... |
import hypothesis
import numpy as np
import torch
def build_ratio_estimator(architecture, variables, **kwargs):
creator = architectures[architecture]
return creator(architecture, variables, **kwargs)
def build_mlp_ratio_estimator(architecture, variables, **kwargs):
from hypothesis.nn.amortized_ratio_e... |
from pypi import get_lib_days, get_no_of_releases
from utils import load_requirements, get_requirement_files, get_requirement_name_and_version
class Libyear:
def __init__(self, config={}):
name = "libyear"
def get_libyear(self, path):
requirements = set()
requirements_files = list... |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name='kgschart',
version='0.4',
description='KGS rank graph parser',
author='Kota Mori',
author_email='kmori05@gmail.com',
url='https://github.com/kota7/kgschart',
packages=['kgschart'],
install_requires=[... |
import praw
from threading import Thread
from friendbot import friend_bot
from hintbot import hint_bot
if __name__ == "__main__":
t1 = Thread(target = friend_bot)
t2 = Thread(target = hint_bot)
t1.setDaemon(True)
t2.setDaemon(True)
t1.start()
t2.start()
while True:
pass |
#!/usr/bin/env python
import matplotlib
matplotlib.use('Agg')
import os, sys
from importlib import import_module
import netCDF4 as nc
import scipy as sp
import matplotlib.pyplot as pl
from matplotlib import colors
from mpl_toolkits.basemap.cm import s3pcpn_l, sstanom
import g5lib.plotters as ptrs
from g5lib import c... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('books', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='book',
name='author',
... |
# Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
# model file: example-models/ARM/Ch.13/y_x.stan
import torch
import pyro
import pyro.distributions as dist
def init_vector(name, dims=None):
return pyro.sample(name, dist.Normal(torch.zeros(dims), 0.2 * torch.ones(dims)).to_event(... |
# (C) Copyright IBM Corporation 2004, 2005
# All Rights Reserved.
# Copyright (c) 2015 Intel Corporation
#
# 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 with... |
# Print the Fibonacci Series
a, b, c = 0, 1, 0
print(a, ",", b, end=", ")
for i in range(3, 10):
c = a+b
print(c, end=", ")
a = b
b = c
print()
|
#!/usr/bin/env python3
# Copyright (c) 2014-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test running cillocoind with -reindex and -reindex-chainstate options.
- Start a single node and gener... |
import sublime, sublime_plugin
# Command to 'rename' the current file
# Uses the RenamePathCommand implemented by the Sidebar.
class RenameCurrentViewCommand(sublime_plugin.TextCommand):
def run(self, edit):
p = self.view.file_name()
if p != None :
self.view.window().run_command... |
import json
import logging
import datetime
import hmac
import hashlib
from typing import List, Any
from cryptoxlib.WebsocketMgr import Subscription, WebsocketMgr, WebsocketMessage, Websocket, CallbacksType
from cryptoxlib.clients.eterbase.exceptions import EterbaseException
LOG = logging.getLogger(__name__)
class E... |
#####################################################################################
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of t... |
#import logging
#from datetime import datetime
def Tweet(config, t):
#logging.info("[<] " + str(datetime.now()) + ':: format+Tweet')
if config.Format:
output = config.Format.replace("{id}", t.id_str)
output = output.replace("{date}", t.datestamp)
output = output.replace("{time}", t.time... |
# 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... |
"""
Set of unit tests for handling of Apache Hive queries
"""
import pytest
from sql_metadata import get_query_columns, get_query_tables
def test_insert_overwrite_table():
assert ["foo_report"] == get_query_tables("INSERT TABLE foo_report")
assert ["foo_report"] == get_query_tables("INSERT OVERWRITE TABLE fo... |
"""
Gives all permutations of a string given as user input.
Example:
Input: Please enter the string: test
Output:
t
e
te
s
ts
es
tes
t
tt
et
tet
st
tst
est
test
"""
def permute(string):
... |
import matplotlib
matplotlib.use('Agg')
import numpy
from pylab import *
import time
import scipy.io
import pickle
import sys
import mutation_stuff
import mytools
Nmc = 150
rateE = 0.72
rateI = 7.0
NsynE = 10000
NsynI = 2500
rdSeed = 1
tstop = 12000 #ms
oscfreq = 1.0 #Hz
phase = 0 #in [0,2pi]
rateCoeffDiff = 0.25
f... |
import requests
import csv
from bs4 import BeautifulSoup
def read(url):
r = requests.get(url)
r.encoding = r.apparent_encoding
return BeautifulSoup(r.content, 'html.parser')
def parse_toppage(html):
lenses = []
for div in html.find_all('div', class_='s5-listItem4__main'):
url = div.find('a... |
# 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, software
# d... |
###########################################################################
#
# 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
#
# https://www.apache.org/l... |
'''
Perform supervised learning using the MPA-JHU results.
Used DR8.
'''
# Setup non-interactive plotting
import matplotlib
matplotlib.use('Agg')
import numpy as np
import matplotlib.pyplot as p
from pandas import DataFrame
# Use seaborn for pretty plots
import seaborn
from sklearn.cross_validation import train_te... |
def test():
# Here we can either check objects created in the solution code, or the
# string value of the solution, available as __solution__. A helper for
# printing formatted messages is available as __msg__. See the testTemplate
# in the meta.json for details.
# If an assertion fails, the messag... |
# -*- coding: utf-8 -*-
# Licensed to the StackStorm, Inc ('StackStorm') 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 "Lice... |
import sys
import os
import inspect
import json
import logging
from asyncio import Queue, CancelledError
from sanic import Sanic, Blueprint, response
from sanic.request import Request
from typing import Text, List, Dict, Any, Optional, Callable, Iterable, Awaitable
from rasa.core.channels.channel import UserMessage, In... |
import re
regex = '^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$'
email = input("Enter email: ")
if(re.search(regex,email)):
print("Valid Email")
else:
print("Invalid Email")
|
""" Model for editorial application.
Models
======
People: User, Organization, Network
Contributors: ContributorInfo, OrganizationContributorInfo
Platforms: Platform, PlatformAccount
Projects: Project
Series: Series
Story: Story
Facet: FacetTemplate, Facet, FacetContributor, Content... |
# Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
... |
#look at try/except for error handling and screening for correct inputs
#look at mapping to simplify the iterations
import pandas as pd
import numpy as np
import xlsxwriter as xls
import datasheetFormat as form
workbook = xls.Workbook('ava_Datasheets.xlsx')
actDescriptors = {'type': ('Basic', 'Smart'), 'siz... |
import re
import functools
import distutils.core
import distutils.errors
import distutils.extension
from setuptools.extern.six.moves import map
from .monkey import get_unpatched
def _have_cython():
"""
Return True if Cython can be imported.
"""
cython_impl = 'Cython.Distutils.build_ext'
try:
... |
# Copyright (c) 2021 PaddlePaddle 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... |
#!/usr/bin/env python3
# This modules contains all the routes for the functioning
# of the application.
from flask import Flask, render_template, request, redirect, jsonify, url_for
from flask import flash, make_response
from flask import session as login_session
from sqlalchemy import create_engine, asc
from sqlalche... |
#!/usr/bin/env python3
# encoding: utf-8
import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
from rls.algos.base.off_policy import Off_Policy
from rls.utils.tf2_utils import (tsallis_squash_rsample,
gaussian_entropy,
... |
# system configuration generated and used by the sysconfig module
build_time_vars = {'ABIFLAGS': '',
'AC_APPLE_UNIVERSAL_BUILD': 0,
'AIX_GENUINE_CPLUSPLUS': 0,
'ANDROID_API_LEVEL': 0,
'AR': 'x86_64-apple-darwin13.4.0-ar',
'ARFLAGS': 'rcs',
'BASECFLAGS': '-fno-strict-aliasing -Wsign-compare -Wunreachable-code',
'... |
import pdb
import six
import deepmatcher as dm
import torch
from deepmatcher.batch import AttrTensor
def sequence_mask(lengths, max_len=None):
batch_size = lengths.numel()
max_len = max_len or lengths.max()
return (torch.arange(0, max_len).type_as(lengths).repeat(batch_size, 1).lt(
lengths.unsq... |
from os.path import splitext
from typing import Optional
import discord
from dataclasses import dataclass
from redbot.core.utils.chat_formatting import box
from .base import BaseRule
from .config.models import InfractionInformation, BlackOrWhiteList
WHITELIST_EXTENSIONS = "whitelist_extensions"
BLACKLIST_EXTENSION... |
import pickle
import json
import sys
import time
import os
import argparse
import tensorflow as tf
from tensorflow.python.ops import math_ops
from tensorflow.python.framework import dtypes
from tf_dataset_hw import *
from tf_data_feeder import *
from tf_models_hw_classification import *
from utils import get_model_di... |
from typing import Callable
from typing import List
from pydantic import BaseModel
class SSOConfigModel(BaseModel):
sso_auth_jwt_key: str = ""
sso_auth_jwt_verify_signature: bool = False
sso_auth_jwt_algorithms: List[str] = ["RS256"]
sso_auth_validation_enabled: bool = False
sso_validation_ignore... |
import re
def parse(input_data):
"Return list of dictionaries representing passports with key value pairs"
passport_strings = re.split('\n\n', input_data)
# split on whitespace to create lists of key value pairs for each passport
field_lists = [re.split('\s', p) for p in passport_strings]
pass... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from oscar.core.compat import AUTH_USER_MODEL, AUTH_USER_MODEL_NAME
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing ... |
import sqlite3, hashlib
from tkinter import *
from tkinter import simpledialog
from functools import partial
#Database Source
with sqlite3.connect("password_vault.db") as db:
cursor = db.cursor()
cursor.execute("""
CREATE TABLE IF NOT EXISTS masterpassword(
id INTEGER PRIMARY KEY,
password TEXT NOT NULL);
""")
... |
# coding=utf-8
from pymongo import MongoClient
mongo_client = MongoClient(maxPoolSize=None, maxIdleTimeMS=(120 * 1000))
db = mongo_client.sentinel
|
import os
import time
import json
import argparse
import torch
import torch.nn as nn
import torch.optim as optim
from torch.optim.lr_scheduler import StepLR
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter
from cruw import CRUW
from rodnet.datasets.CRDataset import CRDataset
... |
import sys
import os
import random
li=[]
#color=open("AllColors.txt","r")
fdFinal=open("output-cont.gdf","w+")
doc1=[]
doc2=[]
edgeConWT=[]
edgeElaWT=[]
edgeStart=[]
edgeEnd=[]
for file in os.listdir(os.getcwd()):
if file.endswith(".tab.scores"):
fdTemp=open(file,"r")
for i in fdTemp:
line... |
from aiogram import Dispatcher
from .throttling import ThrottlingMiddleware
def setup(dp: Dispatcher):
dp.middleware.setup(ThrottlingMiddleware())
|
import numpy as np
import pdb |
from argparse import ArgumentParser, Namespace
import attr
from pathlib import Path
import subprocess
import sys
import typing
from kgtk.io.kgtkreader import KgtkReader
from kgtk.utils.argparsehelpers import optional_bool
@attr.s(slots=True, frozen=True)
class DocUpdater():
"""
This class updates KGTK Markdow... |
import simplejson
from casexml.apps.case.models import CommCareCase
from pact.enums import PACT_HP_GROUP_ID
def run():
print "starting out"
pact_cases = CommCareCase.view('case/by_owner_lite', key=[PACT_HP_GROUP_ID, True],
include_docs=True, reduce=False).all()
for c in... |
# Generated by Django 2.1.15 on 2020-08-17 13:35
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0009_alter_user_last_name_max_length'),
]
operations = [
migrations.CreateModel(
name='User',
... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import bisect
import copy
import itertools
import logging
import numpy as np
import pickle
import torch.utils.data
from fvcore.common.file_io import PathManager
from tabulate import tabulate
from termcolor import colored
from detectron2.structures ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2019-03-14 11:48
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('orders', '0001_initial'),
]
o... |
# -*- coding: utf-8 -*-
# Author: Óscar Nájera
# License: 3-clause BSD
"""
Testing the rst files generator
"""
from __future__ import division, absolute_import, print_function
import pytest
from sphinx.errors import ExtensionError
import sphinx_gallery.backreferences as sg
from sphinx_gallery.py_source_parser import s... |
from fastapi import FastAPI
from pydantic import BaseModel, EmailStr
app = FastAPI()
class UserBase(BaseModel):
username: str
email: EmailStr
full_name: str = None
class UserIn(UserBase):
password: str
class UserOut(UserBase):
pass
class UserInDB(UserBase):
hashed_password: str
def fa... |
import pytest
from jax import numpy as np
from jax import random
from mcx.distributions import Categorical
@pytest.fixture
def rng_key():
return random.PRNGKey(0)
#
# LOGPDF CORRECTNESS
#
out_of_support_cases = [
{"probs": np.array([0.1, 0.2, 0.7]), "x": -1, "expected": -np.inf},
{"probs": np.array([0... |
"""Utilities for working with Connections"""
import win32com.server.util, pythoncom
class SimpleConnection:
"A simple, single connection object"
def __init__(self, coInstance = None, eventInstance = None, eventCLSID = None, debug = 0):
self.cp = None
self.cookie = None
self.debug = debug
if not coInstance is... |
from importlib.machinery import SourceFileLoader
from pathlib import Path
from setuptools import setup
THIS_DIR = Path(__file__).resolve().parent
long_description = THIS_DIR.joinpath('README.rst').read_text()
# avoid loading the package before requirements are installed:
version = SourceFileLoader("__version__", "aio... |
# 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... |
import pyglet
from pyglet.gl import *
# pyglet.options['debug_gl_shaders'] = True
window = pyglet.window.Window(width=540, height=540, resizable=True)
batch = pyglet.graphics.Batch()
print("OpenGL Context: {}".format(window.context.get_info().version))
program = pyglet.graphics.get_default_shader()
###############... |
# 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... |
#!/usr//bin/python
from bcc import BPF
program = """
int hello(void *ctx) {
bpf_trace_printk("Greetings!\\n");
return 0;
}
"""
b = BPF(text=program)
b.attach_kprobe(event="__x64_sys_clone", fn_name="hello")
b.trace_print()
|
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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... |
from gql import gql
from dds import client as dds_client
link_service_mutation = gql(
"""
mutation {
linkService(
serviceType: REDIS,
serviceName: "test-service",
appname: "test-app"
) {
ok
error
}
}
"""
)
result = dds... |
import pgpy
import json
from LocalMessage import LocalMessage
from Pocket import Pocket
class TransitMessage:
'''storage format of all messages in transit'''
def __init__(self, local_message = None, password = None, jsoned_message = None):
# if importing an existing TransitMessage
if (jsoned_message != None):
... |
#
# Author: Zoltan Varga (vargaz@gmail.com)
# License: MIT/X11
#
#
# This is a mono support mode for gdb 7.0 and later
# Usage:
# - copy/symlink this file to the directory where the mono executable lives.
# - run mono under gdb, or attach to a mono process started with --debug=gdb using gdb.
#
import os
class String... |
''' pydevd - a debugging daemon
This is the daemon you launch for python remote debugging.
Protocol:
each command has a format:
id\tsequence-num\ttext
id: protocol command number
sequence-num: each request has a sequence number. Sequence numbers
originating at the debugger are odd, sequence numbers ori... |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... |
"""
Django settings for task_managment project.
Generated by 'django-admin startproject' using Django 3.1.5.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
from d... |
import sys
from ...vendor.Qt import QtWidgets, QtCore
from ... import io, schema, api, style
from .. import lib as tools_lib
from ..widgets import AssetWidget
from ..models import TasksModel
from .dialogs import TasksCreateDialog, AssetCreateDialog
module = sys.modules[__name__]
module.window = None
class Window(... |
#!/usr/bin/env python
"""Take a catalogue file and construct a observation configuration file."""
from __future__ import print_function
from astrokat import Observatory, __version__
import argparse
import sys
from contextlib import contextmanager
@contextmanager
def smart_open(filename):
"""Open catalogue fil... |
"""
Simple Fun #40: Timed Reading
https://www.codewars.com/kata/simple-fun-number-40-timed-reading/python
Timed Reading is an educational tool used in many schools to improve and advance reading skills. A young elementary student has just finished his very first timed reading exercise. Unfortunately he's not a v... |
# -*- coding: utf-8 -*-
# Time : 2021/12/22 9:04
# Author : QIN2DIM
# Github : https://github.com/QIN2DIM
# Description:
from typing import Optional, Sequence
class AntiEmailException(Exception):
def __init__(
self, msg: Optional[str] = None, stacktrace: Optional[Sequence[str]] = None
) ... |
from flask_wtf import FlaskForm
from wtforms import StringField, RadioField, SelectField
from flask_wtf.file import FileRequired, FileField
from conekt.models.species import Species
class AddExpressionProfilesForm(FlaskForm):
species_id = SelectField('Species', coerce=int)
source = SelectField('Source', cho... |
# coding: utf-8
# In[ ]:
# import necessary modules
# uncomment to get plots displayed in notebook
#%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from classy import Class
from scipy.optimize import fsolve
from scipy.interpolate import interp1d
import math
# In[ ]:
# esthe... |
#!/usr/bin/env python
# This a simple lambda function writting timestamp in a concrete file in S3
# Required env vars (filled with examples values):
# S3_BUCKET=the-example-bucket
# S3_FILENAME="example/lasttimestamp"
#
# Reminder: If the bucket doesn't exists is going to be created
from datetime import datetime
i... |
import functools
import json
import logging
import yaml
from django.conf import settings
from django.core.exceptions import MiddlewareNotUsed
try:
from django.utils.deprecation import MiddlewareMixin
except ImportError:
MiddlewareMixin = object
logger = logging.getLogger(__name__)
class ApiSecurityExcepti... |
import bpy
import torch
import numpy as np
objects = bpy.context.scene.objects
def get_centroids():
return [np.array(obj.location) for obj in objects]
#print (get_centroids())
def perturb(struct, size):
perturbed = []
amplitude = size / 5
for point in struct:
perturb = np.random.multivariate_normal([0,0,0], [... |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Basic list exercises
# Fill in the code for the functions below. main() is already set ... |
# -*- coding: utf-8 -*-
import subprocess
import sys
class Config(object):
def __init__(self, wkhtmltoimage='', meta_tag_prefix='imgkit-'):
self.meta_tag_prefix = meta_tag_prefix
self.wkhtmltoimage = wkhtmltoimage
if not self.wkhtmltoimage:
if sys.platform == 'win32':
... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云(BlueKing) available.
Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
You may obt... |
#
# QAPI types generator
#
# Copyright IBM, Corp. 2011
# Copyright (c) 2013-2016 Red Hat Inc.
#
# Authors:
# Anthony Liguori <aliguori@us.ibm.com>
# Markus Armbruster <armbru@redhat.com>
#
# This work is licensed under the terms of the GNU GPL, version 2.
# See the COPYING file in the top-level directory.
from qapi ... |
# Copyright (c) 2015 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 agreed to ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.