text stringlengths 2 999k |
|---|
# ===============================================================================
# Copyright 2015 Jake Ross
#
# 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... |
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
class NewUserForm(UserCreationForm):
email = forms.EmailField(required=True)
class Meta:
model = User
fields = ('username', 'email', 'password1', 'password2')
def save(self, commit=True... |
import copy
import math
import random
import unittest
import numpy as np
from manimlib.constants import *
from manimlib.mobject.mobject import Mobject
import test.mobject_generator as mob_gen
def __func__(mob):
mob.name = "lambda"
def __dt_func__(mob, dt):
mob.name = str(dt)
def __x_func__(mob):
mob.set_... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from . import Attribute
class Item(object):
"""
"""
ID = 0
def __init__(self):
"""
"""
self.id = Ite... |
def main():
i = 0
while True:
# input
num = int(input())
i += 1
# output
if num != 0:
ans = 'Case ' + str(i) + ': ' + str(num)
print(ans)
else:
exit()
if __name__ == "__main__":
main()
|
# -*- coding: utf-8 -*-
import h5py
def make_missing(npdata):
import random
import numpy as np
rows, cols = npdata.shape
random_cols = range(cols)
for col in random_cols:
random_rows = random.sample(range(rows - 1), int(0.1 * rows))
npdata[random_rows, col] = np.nan
return np... |
import os
from common import service
# Initialize modules
import roles # noqa
import session # noqa
if __name__ == "__main__":
service.run(workers=int(os.getenv("WORKERS", "2")))
|
import wx
from wx.tools.img2py import img2py
import sys, os
class myImg2py(object):
def __init__(self):
pass
def start(self):
imgFolderPath = os.path.join(os.path.dirname(os.path.abspath(os.path.dirname(__file__))), 'img')
fileLists = os.listdir(imgFolderPath)
for file in fil... |
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system's.
sys.path.pop(0)
from setuptools import setup
sys.path.append("..")
import sdist_upip
setup(
name="micropython-stat",
version="0.5.1",
description="CPython stat module ported to MicroPython",... |
from manimlib.constants import *
from manimlib.mobject.mobject import Mobject
from manimlib.utils.bezier import interpolate
from manimlib.utils.color import color_gradient
from manimlib.utils.color import color_to_rgba
from manimlib.utils.color import rgba_to_color
from manimlib.utils.config_ops import digest_config
fr... |
# This file is a part of GrumpyWidgets.
# The source code contained in this file is licensed under the MIT license.
# See LICENSE.txt in the main project directory, for more information.
from pythonic_testcase import *
from grumpywidgets.testhelpers import assert_same_html, template_widget
from grumpywidgets.widgets ... |
import datetime
def unix_time(dt):
epoch = datetime.datetime.utcfromtimestamp(0)
delta = dt - epoch
return delta.total_seconds()
def unix_time_millis(dt):
return unix_time(dt) * 1000.0 |
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from foundations import hparams
from lottery.desc import LotteryDesc
from pruning.sparse_global import Strategy
from testing import tes... |
import setuptools
setuptools.setup(
name="Pizdyuk",
version="0.0.1",
author="Jahangir Gasimov",
description="Stock Market Simulation tool",
url="https://github.com/aufdnb/Pizdyuk.git",
package_dir={"": "pizdyuk"},
packages=setuptools.find_packages(where="pizdyuk"),
install_requires=[
... |
import json
from pystachio import Choice, Default, Enum, Float, Integer, List, Ref, Required, String, Struct
from pystachio.naming import frozendict
def test_choice_type():
IntStr = Choice("IntStrFloat", (Integer, String))
one = IntStr(123)
two = IntStr("123")
three = IntStr("abc")
assert one == IntStr(12... |
# coding: utf-8
#
# Copyright 2016 The MyCleanIndia 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
#
# Unles... |
import random
user_name = ["none","banu","nagi","naveen","risi","hari","moorthi","priya"]
user_pass_var = [chr(x) for x in range(65,123)]
salary = []
user_pass = []
temp = ''
size = int(input("how many input you want : "))
pass_size = int(input("enter password len : "))
for i in range(size):
user_pass.append(temp)... |
import anndata
""" Reads in a gct file .
The main method is parse. parse_into_3 creates the row
metadata, column metadata, and data dataframes, while the
assemble_multi_index_df method in GCToo.py assembles them.
1) Example GCT v1.3:
----- start of file ------
#1.3
96 36 9 15
--------... |
import json
from unittest.mock import patch
from click.testing import CliRunner
from mythx_models.response import VersionResponse
from mythx_cli.cli import cli
from .common import get_test_case, mock_context
VERSION_RESPONSE = get_test_case("testdata/version-response.json", VersionResponse)
VERSION_SIMPLE = get_tes... |
from gladia_api_utils.model_management import download_models |
##############################################################################
# Institute for the Design of Advanced Energy Systems Process Systems
# Engineering Framework (IDAES PSE Framework) Copyright (c) 2018-2020, by the
# software owners: The Regents of the University of California, through
# Lawrence Berkeley N... |
from tensordata.utils.pip._pip import *
|
"""let URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-b... |
##############################################################################
#
# Copyright (c) Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE... |
import numpy as np
import torch
import torch.nn as nn
from torch.distributions import Normal
from rl_sandbox.constants import OBS_RMS, CPU
from rl_sandbox.model_architectures.actor_critics.actor_critic import ActorCritic
from rl_sandbox.model_architectures.shared import Conv2DEncoder, Flatten, Fuse, Split
from rl_san... |
import pytest
from pdm.cli import actions
from pdm.models.specifiers import PySpecSet
@pytest.mark.usefixtures("repository")
def test_add_package(project, working_set, is_dev):
actions.do_add(project, is_dev, packages=["requests"])
section = (
project.tool_settings["dev-dependencies"]["dev"]
... |
"""
This network uses the last 26 observations of gwl, tide, and rain to predict the next 18
values of gwl for well MMPS-175
"""
import pandas as pd
from pandas import DataFrame
from pandas import concat
from pandas import read_csv
from sklearn.metrics import mean_squared_error
from sklearn.preprocessing imp... |
import heapq
def solution(scoville, K):
answer = 0 # 횟수
heap = []
for i in scoville:
heapq.heappush(heap, i)
while len(heap) > 1:
if heap[0] >= K:
return answer
else:
make_it_spicy(heap)
answer += 1
if heap[0] >= K:
return answer... |
# -*- coding: utf-8 -*-
# Auto-generated by Stone, do not modify.
# flake8: noqa
# pylint: skip-file
try:
from . import stone_validators as bv
from . import stone_base as bb
except (SystemError, ValueError):
# Catch errors raised when importing a relative module when not in a package.
# This makes testi... |
"""Elasticsearch resource for querying events
Uses the events index to filter for all events. Can use more specific queries
for `location_name`, `name` and description.
"""
from flask import request
from flask_rest_jsonapi.resource import Resource
from elasticsearch_dsl import Search
from app.models.search.event imp... |
"""Chrono URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... |
import numpy as np
import sys
sys.path.insert(0, 'embedding/')
NORMALIZATION = 'individual' # 'individual', 'once', or 'none'
EPSILON = 1e-5 # only to prevent division by zero
from fasttext_web_table_embeddings import FastTextWebTableModel
class WebTableMultiEmbeddingModel:
def __init__(self, filenames):
... |
import os, random
names = """
John Manning
Christopher Levine
Jose Marshall
Keith Hunt
Pamela Morton
Randall Carter
Kimberly Mcdaniel
Tammy Harrison
Katherine Norman
Richard Shea
Amanda King
Cynthia Barry
Christopher Weber
Elaine Montgomery
Gene Lopez
Eric Richard
Rebecca Raymond
Brian Russell
Benjamin Hall
Jason Cook... |
#! python
# (c) DL, UTA, 2009 - 2016
import sys, string, time
from random import *
wordsize = 24 # everything is a word
numregbits = 3 # actually +1, msb is indirect bit
opcodesize = 5
addrsize = wordsize - (opcodesize+numregbits+1) ... |
"""
Form Widget classes specific to the Django admin site.
"""
from __future__ import unicode_literals
import copy
from django.db.models.deletion import CASCADE
from django.forms import widgets
from django.forms.widgets import *
from django.template.loader import render_to_string
from django.urls import reverse
from ... |
# -*- coding: utf-8 -*-
'''
Operations on regular files, special files, directories, and symlinks
=====================================================================
Salt States can aggressively manipulate files on a system. There are a number
of ways in which files can be managed.
Regular files can be enforced wit... |
import update_map
import pandas as pd
import adusql as ads
def test_update_map():
PIN = 3626039263
adunit = ads.Connection("adunits.db")
df = adunit.getParcelCoords(PIN)
neighbors = adunit.getNeighbors(df)
result = update_map.update_map(df, neighbors)
assert(isinstance(result, object))
|
"""
find docker-compose.yml files
"""
import fnmatch
import os
def find_yml_files(path):
"""
find docker-compose.yml files in path
"""
matches = {}
for root, _, filenames in os.walk(path, followlinks=True):
for _ in fnmatch.filter(filenames, 'docker-compose.yml'):
key = root.sp... |
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
# 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/LICEN... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# https://projecteuler.info/problem=3
# 6857
from lib import get_primes
from math import sqrt, ceil
number = 600851475143
if __name__ == '__main__':
primes = get_primes(ceil(sqrt(number)))
for el in range(len(primes) - 1, 0, -1):
if number % primes[el] ... |
#!/usr/bin/env python
"""
_TestSpec_
Test spec with known output modules used for testing.
"""
from WMCore.WMSpec.WMWorkload import newWorkload
class TestWorkloadFactory(object):
"""
_TestWorkloadFactory_
Stamp out test workfloads.
"""
def createWorkload(self):
"""
_createWork... |
from noise.connection import NoiseConnection
import typer
import base64
def main(protocol_name: str = "Noise_NN_25519_ChaChaPoly_SHA256"):
proto = NoiseConnection.from_name(protocol_name.encode())
proto.set_as_initiator()
proto.start_handshake()
print("Handshake (send this):", base64.b64encode(proto.wr... |
#
# 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... |
import unittest
import os
from kali_extractor.custom_xml_parser import CustomXmlParser
from xml.etree import ElementTree
dirname = os.path.dirname(__file__)
xml_path = os.path.join(dirname, 'fixtures/KALITEXT_STRUCT_1.xml')
class CustomXmlParserTests(unittest.TestCase):
def test_2099_parsing(self):
with... |
import _plotly_utils.basevalidators
class BgcolorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self, plotly_name="bgcolor", parent_name="barpolar.hoverlabel", **kwargs
):
super(BgcolorValidator, self).__init__(
plotly_name=plotly_name,
parent_nam... |
import httplib
from flask import render_template
from flasky.main import main
@main.errorhandler(httplib.NOT_FOUND)
def page_not_found(ex):
return render_template('404.html'), httplib.NOT_FOUND
|
#!/usr/bin/env python
# coding: utf-8
import requests
from collections import defaultdict
import pandas as pd
import time
endpoint_items = 'http://bdce.unb.br/api/items'
endpoint_collections = 'http://bdce.unb.br/api/collections'
response = requests.get(endpoint_items, params = {'page':'1'})
metadata_dict = defaultdi... |
# -*- coding: utf-8 -*-
"""
test_django-watchman
------------
Tests for `django-watchman` management commands.
"""
from __future__ import unicode_literals
from io import StringIO
import unittest
from django.core.management import call_command
class TestWatchman(unittest.TestCase):
def test_successful_manage... |
# -*- coding=utf-8 -*-
'''
给定一个字符串,找出不含有重复字符的最长子串的长度。
示例 1:
输入: "abcabcbb"
输出: 3
解释: 无重复字符的最长子串是 "abc",其长度为 3。
示例 2:
输入: "bbbbb"
输出: 1
解释: 无重复字符的最长子串是 "b",其长度为 1。
示例 3:
输入: "pwwkew"
输出: 3
解释: 无重复字符的最长子串是 "wke",其长度为 3。
请注意,答案必须是一个子串,"pwke" 是一个子序列 而不是子串。
'''
class Solution(object):
def lengthOfLongestSubst... |
"""
This module contains helper functions which dispatch
the creation of appropriate generators depending on
the input types.
"""
__all__ = ['Integer', 'Timestamp']
from .base import TohuBaseGenerator
from .primitive_generators import Integer as IntegerPrimitive, Timestamp as TimestampPrimitive
from .derived_generato... |
#########################
# Import required modules
#########################
import argparse
import pprint
import json
import logging
import os
import sys
import pandas as pd
import random
import time
import glob
import numpy as np
from collections import defaultdict
import torch
import torch.distributed as dist
imp... |
distinct = set()
base = [str(x) for x in xrange(1,21)]
for hit1 in [None, 'B', 'DB'] + ['S' + str(x) for x in base] + ['D' + str(x) for x in base] + ['T' + str(x) for x in base]:
for hit2 in [None, 'B', 'DB'] + ['S' + str(x) for x in base] + ['D' + str(x) for x in base] + ['T' + str(x) for x in base]:
for... |
import os, pytest
from pathlib import Path
from ..convertwarp import ConvertWarp
@pytest.mark.parametrize("inputs, outputs", [])
def test_ConvertWarp(test_data, inputs, outputs):
in_file = Path(test_data) / "test.nii.gz"
if inputs is None:
inputs = {}
for key, val in inputs.items():
try:
... |
import radical.saga as saga
import os
remote_tmp = saga.filesystem.Directory ("sftp://india.futuregrid.org/tmp/copy_test", saga.filesystem.CREATE_PARENTS)
print "initial:"
for u in remote_tmp.list () :
print str(u)
local_dir = saga.filesystem.Directory ("file:///etc")
local_dir.copy ('h*', "sftp://india.future... |
"""
coral_model - utils
@author: Gijs G. Hendrickx
@contributor: Peter M.J. Herman
"""
import os
# TODO: Restructure all utils-related files, methods, and methods.
import numpy as np
from netCDF4 import Dataset
class SpaceTime:
"""Spacetime-object, which validates the definition of the spacetime dimensions."""
... |
from newton.rules.rule import Rule
from newton.exchange.action import Action
from newton.exchange.currency_pairs import CurrencyPair
class Entry(Rule):
def __init__(self, currency_pair, amount, action='bid', name=None):
self.currency_pair = CurrencyPair(currency_pair)
self.amount = amount
... |
from gene_dao import GeneDAO
from go_dao import GoDAO
from disease_dao import DiseaseDAO
from elasticsearch_dao import ElasticSearchDAO
|
import warnings
try:
from Cython.Distutils import build_ext
from setuptools import setup, Extension
HAVE_CYTHON = True
except ImportError as e:
warnings.warn(e.message)
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
HAVE_CYTHON = False
import num... |
from setuptools import setup, find_packages
setup( name='stoc', version='0.0',
description='Stochastic Optimal Control Library',
url='https://github.com/yoon-gu/stoc/',
author='Jacob Hwang',
author_email='yz0624@gmail.com',
license='MIT',
packages=find_packages(),
install_requires=[
'numpy',
# 'sci... |
from opwen_email_server import azure_constants as constants
from opwen_email_server import config
from opwen_email_server import events
from opwen_email_server.backend import client_datastore
from opwen_email_server.backend import server_datastore
from opwen_email_server.services.queue import AzureQueue
from opwen_emai... |
"""SCons.Tool.packaging.msi
The msi packager.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundation
#
# 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 wi... |
"""
Here a list of proxy object that can be used when lazy=True at neo.io level.
This idea is to be able to postpone that real in memory loading
for objects that contains big data (AnalogSIgnal, SpikeTrain, Event, Epoch).
The implementation rely on neo.rawio, so it will available only for neo.io that
ineherits neo.ra... |
# -*- coding: utf-8 -*-
"""
Portions of this code have been taken and modified from the "asciidag" project.
Access Date:
Commit: 7c1eefe3895630dc3906bbe9d553e0169202756a
PermalinkURL
URL: https://github.com/sambrightman/asciidag/
File: asciidag/graph.py
Commit: 7c1eefe3895630dc3906bbe9d553e0169202756a
Acce... |
version = '1.0.622'
|
from typing import Dict
from typing import List
from botocore.paginate import Paginator
class ListDeploymentJobs(Paginator):
def paginate(self, filters: List = None, PaginationConfig: Dict = None) -> Dict:
pass
class ListFleets(Paginator):
def paginate(self, filters: List = None, PaginationConfig: D... |
#!/usr/bin/env python3
from os import path
import random
import textwrap
module_data = path.join(path.dirname(__file__), "data")
ascii_path = path.join(module_data, "ascii")
quotes_path = path.join(module_data, "quotes")
def build_bubble(quote=""):
wrap_limit = 50
wrap_list = textwrap.wrap(quote, wrap_limit)... |
import io
import unittest
from contextlib import redirect_stdout
from unittest.mock import patch
class TestQ(unittest.TestCase):
@patch('builtins.input', side_effect=[
'9 6 2015',
'6 6 2015',
])
def test_case_0(self, input_mock=None):
text_trap = io.StringIO()
with redirect... |
"""
Creates a well formed srcjar from sources (i.e. properly rooted according to packages).
"""
def _overlay_sources(ctx, srcs, overlay_srcs, root = ""):
all_srcs = [
f
for f in srcs
if not any([f.path.endswith(x.label.name[len(root):]) for x in getattr(ctx.attr, overlay_srcs)])
]
a... |
# -*- coding: utf-8 -*-
#
# 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
#... |
#Prompt the user for hours
hours = input("Enter Hours: ")
#Prompt the user for the rate
rate = input("Enter Rate: ")
def computepay(hours, rate):
try:
hours = float(hours)
rate = float(rate)
if hours <= 40:
wage = hours * rate
else:
wage = 40 * rate + (hours ... |
#!/usr/bin/env python
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
=================
fMRI: FEEDS - FSL
=================
A pipeline example that data from the FSL FEEDS set. Single subject, two
stimuli.
You can find it at http://www.fmrib.ox.ac.... |
# -*- 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... |
import os
def local_assignments_from_csv(file):
"""
Read a comma-separated values file containing assignments of compounds to
retention time boundaries.
File format:
compound_1_name,lower bound (float), upper bound (float),
compound_2_name,lower bound (float), upper bound (float),
... |
# ---
# jupyter:
# jupytext:
# cell_metadata_filter: collapsed,code_folding
# formats: ipynb,py:percent
# notebook_metadata_filter: all
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.2'
# jupytext_version: 1.2.3
# kernelspec:
# display... |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2013,2014,2015,2016,2019 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ma... |
try:
raise IOError("foo")
except Exception, e:
print e.message
try:
raise IOError("foo")
except:
print "x"
try:
raise IOError("foo")
except TypeError:
print "type"
except IOError:
print "io"
except:
print "y"
def foo():
try:
raise IOError("foo")
except TypeError, e:
... |
# -*- coding: utf-8 -*-
import sys
from toolchain import Recipe
class PythonAliasRecipe(Recipe):
is_alias = True
def init_after_import(self, ctx):
python = ctx.state.get("python")
if not python:
# search in wanted_recipes if it's the first time
if "python2" in ctx.wante... |
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
#
from c7n_kube.query import QueryResourceManager, TypeInfo
from c7n_kube.provider import resources
@resources.register('volume')
class PersistentVolume(QueryResourceManager):
class resource_type(TypeInfo):
group = 'Core'
... |
#!/usr/bin/env python
import time
import dot3k.backlight as backlight
import dot3k.lcd as lcd
print("""
This example shows you different ways of setting the bargraph.
You should see the graph light up in sequence and then fade in.
Press CTRL+C to exit.
""")
# Clear the LCD and display Hello World
lcd.clear()
lcd... |
from dpo.commands.InitialiseExecutionCommand import InitialiseExecutionCommand
from dpo.commands.GetLastSuccessfulExecutionCommand import GetLastSuccessfulExecutionCommand
from dpo.commands.GetExecutionCompletionTimestampCommand import GetExecutionCompletionTimestampCommand
from dpo.commands.InitialiseStepCommand impor... |
"""
This file offers the methods to automatically retrieve the graph Carboxydothermus islandicus.
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--pr... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Created by Ross on 19-1-25
def solve(string: str, pos: int):
if string is None:
return None
length = len(string)
if pos > length or pos < 0:
return None
elif pos == length or pos == 0:
return string
else:
return string[po... |
import os
import platform
import stat
import zipfile
from os.path import basename
from unittest import TestCase
from six import StringIO
from conans.client.output import ConanOutput
from conans.client.tools.files import unzip
from conans.test.utils.test_files import temp_folder
from conans.util.files import save
cl... |
# Generated by Django 3.0.8 on 2020-09-23 18:27
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),
]
ope... |
"""jsonld admin routes."""
from aiohttp import web
from aiohttp_apispec import docs, request_schema, response_schema
from marshmallow import INCLUDE, Schema, fields
from pydid import VerificationMethod
from ...admin.request_context import AdminRequestContext
from ...config.base import InjectionError
from ...resolver.... |
"""
MIT License
Copyright (c) 2021 TheHamkerCat
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, ... |
#!/usr/bin/python
# to use: navigate to pfam_hmm_done/ana/ folder, do: for i in *; do python ~/Documents/Fan/scratch/code/cdhit_clst_parser.py /Users/metagenomics/Documents/Fan/scratch/xander_701/$i/nucl_cdhit.fasta.clstr > /Users/metagenomics/Documents/Fan/scratch/blast_desc/clstr_parsed/$i.x701.clstr.parsed; done#
#... |
"""Kernel Bandwidth Optimization.
Copyright (c) 2014 Subhasis Ray
License: GPL v3
Original matlab code (sskernel.m) here:
http://2000.jukuin.keio.ac.jp/shimazaki/res/kernel.html
This was translated into Python by Subhasis Ray, NCBS. Tue Jun 10
23:01:43 IST 2014
"""
import numpy as np
def nextpow2(x):
"""Return ... |
class Value:
def __init__(self):
self.amount = 0
def __get__(self, obj, obj_type):
return self.amount
def __set__(self, obj, value):
self.amount = value - value * obj.commission
class Account:
amount = Value()
def __init__(self, commission):
self.commission = com... |
# ----- Info ------------------------------------------------------------------
__author__ = 'Michael Montero <mcmontero@gmail.com>'
# ----- Imports ---------------------------------------------------------------
from tinyAPI.base.data_store.provider import DataStoreMySQL
from tinyAPI.base.services.mysql.index_check... |
import random
from cola import Cola
nombres = ['angel', 'esteban', 'facundo', 'gabriel', 'maria', 'mora', 'romina', 'ruth', 'sofía', 'tomás']
random.shuffle(nombres)
cola_de_espera = Cola()
# llega el primero
cola_de_espera.encolar(nombres[0])
cola_de_espera.imprimir()
# llega el segundo
cola_de_espera.encolar(nom... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import requests
from bs4 import BeautifulSoup
import time
import json
from ingrediente import Ingrediente
from receita import Receita
from pymongo import MongoClient
client = MongoClient('connection url')
db = client.receitas
f = open('urls.dat', 'r')
receitas = []
def pars... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.18
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import si... |
from __future__ import print_function
import os
import sys
import argparse
from six.moves import xrange
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
import numpy as np
from cakechat.utils.env import init_theano_env
init_theano_env()
from cakechat.dialog_model.model... |
"""
Peewee integration with APSW, "another python sqlite wrapper".
Project page: https://rogerbinns.github.io/apsw/
APSW is a really neat library that provides a thin wrapper on top of SQLite's
C interface.
Here are just a few reasons to use APSW, taken from the documentation:
* APSW gives all functionality of SQLi... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# vim:set shiftwidth=2 tabstop=2 expandtab textwidth=79:
import asyncio
import cgi
import logging
import os
import random
import re
import string
import time
import urllib
import urllib.parse
from collections import namedtuple
import aiohttp
import async_timeout
import reques... |
from faker import Faker
from yandex_market_language.models.condition import (
Condition,
CONDITION_CHOICES
)
fake = Faker()
def create_random_condition(
condition_type=fake.random_element(CONDITION_CHOICES),
reason=fake.text()
) -> Condition:
return Condition(condition_type, reason)
Conditio... |
# Generated by Django 2.2 on 2020-03-23 04:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('store', '0004_empresa'),
]
operations = [
migrations.AlterField(
model_name='empresa',
name='facebook',
fi... |
from __future__ import absolute_import
from __future__ import print_function
import os
import numpy as np
from utils.tensorboard_logging import log_scalar
from tensorflow.keras.callbacks import Callback
import tensorflow.keras.backend as K
class LearningRateScheduler(Callback):
"""Learning rate sc... |
# Generates comments with the specified indentation and wrapping-length
def generateComment(comment, length=100, indentation=""):
out = ""
for commentChunk in [
comment[i : i + length] for i in range(0, len(comment), length)
]:
out += indentation + "// " + commentChunk + "\n"
return out
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.