content stringlengths 5 1.05M |
|---|
from pygments.lexer import RegexLexer, inherit, words
from pygments.token import *
from pygments.lexers.c_cpp import CppLexer
gridtools_keywords = ((
'accessor',
'in_accessor',
'inout_accessor',
'aggregator_type',
'arg',
'tmp_arg',
'param_list',
'backward... |
import xarray as xr
import torch
import numpy as np
import pathlib
def save_as_netcdf(sdf, real_flows, pred_flows, indices, epoch, level, name, data_dir):
# Convert to numpy array
sdf = sdf.numpy()
real_flows = real_flows.numpy()
pred_flows = pred_flows.numpy()
sub_dir = pathlib.Path(f'{data_d... |
import pandas as pd
from rrcforest import LagFeatures
def test_lag_features():
data = pd.DataFrame({
'A': list(range(10)),
'B': list(range(10, 20)),
})
lf = LagFeatures(2, data.columns)
assert set(lf.feature_columns) == {'A_0', 'A_1', 'B_0', 'B_1'}
# No data inserted yet
ass... |
rows, cols = [int(el) for el in input().split()]
matrix = [list(input()) for row in range(rows)]
commands = list(input())
spawn_pos = ((-1, 0), (0, 1), (1, 0), (0, -1))
player_pos = []
dead = False
won = False
result = ""
for row in range(rows):
for col in range(cols):
if matrix[row][col] == "P"... |
# Copyright (C) 2015-2019 Tormod Landet
# SPDX-License-Identifier: Apache-2.0
import dolfin
from ocellaris.utils import ocellaris_error, RunnablePythonString
_BOUNDARY_CONDITIONS = {}
def add_boundary_condition(name, boundary_condition_class):
"""
Register a boundary condition
"""
_BOUNDARY_CONDITI... |
import arrow
from flask.views import MethodView
from flask import render_template, request, redirect, url_for
from database import db
from models.appointment import Appointment
from forms.new_appointment import NewAppointmentForm
class AppointmentResourceDelete(MethodView):
def post(self, id):
appt = db... |
# -*- coding: gbk -*-
"""
HTTP Client
http://www.hzfc365.com/house_search/search_prj.jsp?lpid=1374
"""
import sys, os, logging, re
from http_client import HTTPClient
class SimpleCrawler(object):
def __init__(self):
self.http = HTTPClient()
self.debug = True
def start(sel... |
'''
263. Ugly Number Easy
An ugly number is a positive integer whose prime factors are limited to 2, 3, and 5.
Given an integer n, return true if n is an ugly number.
Example 1:
Input: n = 6
Output: true
Explanation: 6 = 2 × 3
Example 2:
Input: n = 8
Output: true
Explanation: 8 = 2 × 2 × 2
Example 3:
Input: n =... |
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import numpy as np
import os
import math
from config import load_config
from preprocess import load_data
from model import Model
import urllib.request
def save_checkpoint(model, optimizer, args, epoch):
print('Model S... |
class Solution(object):
def pathSum(self, root, S):
if not root: return False
opt = []
stack = []
stack.append((root, 0, []))
while stack:
node, s, path = stack.pop()
s += node.val
path = path + [node.val]
if n... |
#F = G.m1.m2/r^2
import matplotlib.pyplot as plt
#draw graph
def drawGraph(x,y):
plt.plot(x, y, marker='o')
plt.xlabel('Distances')
plt.ylabel('Gravitational force in Newton')
plt.title("Gravitational Force vs distance")
plt.show()
def generateR():
r = range(100, 1001, ... |
# @Time : 11/11/21 9:43 PM
# @Author : Fabrice Harel-Canada
# @File : pyfuzz_h03_20191644.py
import sys
import os
sys.path.insert(1, os.path.abspath("."))
import h03_20191644 as testee
from pyfuzz.fuzzers import *
from pyfuzz.byte_mutations import *
from pyfuzz.fuzz_data_interpreter import *
import torch
im... |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# 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... |
from model.project import Project
import re
class ProjectHelper:
def __init__(self, app):
self.app = app
project_cache = None
def create(self, project):
wd = self.app.wd
self.app.navigation.open_project_page()
wd.find_element_by_xpath('//input[@value="создать новый проек... |
import os
BROKER_URL = os.environ.get('CLOUDAMQP_URL')
MONGODB_URI = os.environ.get('MONGODB_URI')
BACKEND_URI = os.environ.get('BACKEND_URI')
DB_NAME = os.environ.get('DB_NAME')
IG_PROFILE_COLL = 'instagram-profile'
IG_PROFILE_POST_COLL = 'instagram-post'
IG_HASHTAG_POST_COLL = 'instagram-hashtag-post'
FB_PROFILE_C... |
# Generated by Django 3.0.3 on 2020-02-22 18:22
from django.db import migrations
def fix_application_null(apps, schema_editor):
"""Fix Application meta_fields being null"""
Application = apps.get_model("passbook_core", "Application")
for app in Application.objects.all():
if app.meta_launch_url is... |
from .vision import VisionDataset
from PIL import Image
import os
import os.path
from typing import Any, Callable, Optional, Tuple
class CocoCaptions(VisionDataset):
"""`MS Coco Captions <https://cocodataset.org/#captions-2015>`_ Dataset.
Args:
root (string): Root directory where images are downloade... |
from plumbum import local
from plumbum.path.local import LocalPath
from plumbum import local, FG
from plaster.tools.schema import check
from plaster.tools.utils import utils
def get_user():
user = local.env.get("RUN_USER")
if user is None or user == "":
raise Exception("User not found in $USER")
r... |
import hashlib
from options.options import SysOptions
from rest_framework import generics, permissions, status
from rest_framework.response import Response
from django.contrib.auth.models import Permission
from django.core.cache import cache
from django.conf import settings
from conf.models import JudgeServer
from dja... |
#!/usr/bin/env python3
# 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 parlai.utils.safety import OffensiveLanguageClassifier
from parlai.utils.safety import OffensiveStringMatche... |
###
### scan_extensions.py - Code used to build extensions.csv file from
### present vocola_ext_*.py files.
###
###
### Copyright (c) 2011, 2015 by Hewlett-Packard Development Company, L.P.
###
### Permission is hereby granted, free of charge, to any person
### obtaining a copy of this soft... |
from connector.elfinder.commands import COMMANDS_MAP
class HttpRequestParser(object):
def __init__(self, request, get=None, post=None, files=None):
self._req = request
self.post = post or {}
self.get = get or {}
self.files = files or {}
self.command = ''
self.params = {}
try:
self.parse()
except Ex... |
from machine import Pin,ADC,PWM
import time
adc14 = ADC(Pin(14),atten=ADC.ATTN_11DB)
PWM_A = PWM(Pin(11)) #Set PWM output pin
PWM_A.freq(20000) #Set PWM frequency
PWM_A.duty(0) #Set PWM duty cycle
AIN1 = Pin(12,Pin.OUT)
AIN2 = Pin(13,Pin.OUT)
STBY = Pin(10,Pin.OUT)
AIN1.on() #MOTOR forward
AIN2.off()
STBY.on() #When ... |
# -*- encoding: utf-8 -*-
import xlrd
from accounts.models import Authority
from notifications.models import NotificationTemplate, NotificationAuthority
def import_notification_excel(template_id, file):
template = NotificationTemplate.objects.get(id=template_id)
try:
xl_book = xlrd.open_workbook(fil... |
"""
This file contains constants used throughout AppScale.
"""
import os
from kazoo.retry import KazooRetry
class HTTPCodes(object):
OK = 200
BAD_REQUEST = 400
UNAUTHORIZED = 401
FORBIDDEN = 403
NOT_FOUND = 404
INTERNAL_ERROR = 500
NOT_IMPLEMENTED = 501
class MonitStates(object):
MISSING = 'missing'... |
'''
## MIT License
Copyright (c) 2016 David Sandberg
Process Flow:
1.Read the image
2.send to detect face
3.get the coordinates
4.draw bounding box on face
5.write the image
6.store the time in seperate text file ,image name, count of faces, dimension, time log for each image.
The below code is used for checking dete... |
import pytest
from django.urls import reverse
from metadeploy.conftest import format_timestamp
from ..constants import ORGANIZATION_DETAILS
from ..models import Job, Plan, PreflightResult
@pytest.mark.django_db
def test_user_view(client):
response = client.get(reverse("user"))
assert response.status_code =... |
from collections import defaultdict
from .core import GameObject, Message, game_loop
from .linguistics import Thing, there_are_things_here
def exit(direction, destination, key=None):
if key is None:
locked = False
else:
locked = True
def exit_handler(message):
nonlocal locked
... |
# (c) Copyright 2017-2018 SUSE 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 writ... |
import sys
import os
import re
import stack
operators = ['add','sub','neg','and','or','not']
logicalOperators = ['gt','lt','eq']
operation_symbol = {
"eq": "JNE",
"gt": "JLE",
"lt": "JGE"}
memoryOperators = ['push','pop']
branchingCommands = ['label','goto','if-goto'] #!!!
functionCommands = ['function','c... |
from django import forms
from .models import Offer
class MakeOfferForm(forms.ModelForm):
offer_datetime = forms.DateTimeInput(attrs={'placeholder': "Date and time"})
class Meta:
model = Offer
fields = ['offer_datetime', 'client_address', 'payment_method', 'comment']
labels = {
... |
#!/usr/bin/env ipython
# -*- coding: utf-8 -*-
import random as ran
import math
import numpy as np
"""Define auxiliary functions for Corona Testing Simulation."""
def _make_test(testlist, current_success_rate, false_posivite_rate, prob_sick,
tests_repetitions=1, test_result_decision_strategy='max'):
... |
# %%
import numpy as np
from scipy.integrate import solve_ivp
import matplotlib.pyplot as plt
from seaborn import set_style
set_style('whitegrid')
# %%
# Example 1: exponential decay
def exponential_decay(t, y):
return -0.5 * y
# %%
sol = solve_ivp(exponential_decay, [0, 10], [2, 4, 8])
# %%
for i in range(3):... |
from elementalcms.extends import Controller
class Applet:
name: str
__controllers: [Controller] = []
def __init__(self, name, controllers: [Controller]):
self.name = name
self.__controllers = controllers
def get_controllers(self) -> [Controller]:
return self.__controllers
|
from Setup import Setup
from shaderWhisperer import R, shaderWhisperer
#TODO: add testing class
def testSentences(sw):
print("\n --- sentences testing\n")
for s in ["switch", "case", "while", "do", "for", "if", "break", "continue", "return"]:
print(s, "\t:", sw.sentences(s))
def tes... |
#!/usr/bin/env python
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes, padding
from cryptography.hazmat.primitives.asymmetric import ec
from cryptography.hazmat.primitives.kdf.hkdf import HKDF
from cryptography.hazmat.primitives.ciphers import Cipher, algorith... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('course_modes', '0006_auto_20160208_1407'),
]
operations = [
migrations.AddField(
model_name='coursemode',
name='bulk_sku',
field=models.CharField(default... |
import numpy as np
import numpy.polynomial.hermite_e as her
import numpy.polynomial.legendre as legd
class Polynomial(object):
'''
class: polynomial class
'''
def __init__(self, order, coef):
self.order = order
self.coef = coef
def __str__(self):
string = 'P(x)... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-05-29 09:37
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
def add_resulting_fragments(apps, schema_editor):
"""
Fills the resulting_fragment column on Selections
... |
from bs4 import BeautifulSoup as soup
from fake_useragent import UserAgent
from selenium import webdriver
import time
import re
import json
from Common import Common
delay_time = 10
def run():
driver = Common.getDriver()
# sticker_link = "https://steamcommunity.com/market/search?q=&category_730_ItemSet%5B%5D... |
import json
import html
from pathlib import Path
from elm_doc.utils import Namespace
# Note: title tag is omitted, as the Elm app sets the title after
# it's initialized.
PAGE_TEMPLATE = '''
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="shortcut icon" size="16x16, 32x32, 48x48, 64x64, 128... |
"""Main module."""
import requests
import base64
from datetime import datetime
from time import sleep
from urllib.parse import urljoin
class Unimus:
def __init__(self, url, token):
self.url = url
self.token = token
def _api_request(self, method, url, *args, **kwargs):
url = urljoin("{... |
from django.template.loader import render_to_string
def render_html(email_alerts):
context = {
'opportunities': {
'email_alerts': email_alerts
}
}
return render_to_string('exops/is-exops-user-email-alerts.html', context)
def test_email_alert_title():
html = render_html([
... |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, 9t9it and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.naming import make_autoname
def autoname(doc, method):
"""
This override should be deprecated and removed when Ba... |
import numpy as np
import naa_csv_reader
import naa_csv_maker
import naa_isotope_verifier
import naa_peak_effects
import naa_background
from becquerel.tools import nndc
from pandas import DataFrame
import uncertainties
from itertools import chain
from operator import itemgetter
def naa_isotope_analyzer(fil... |
import os
import shutil
class PathOperator:
def __init__(self):
self.current = os.getcwd()
def create_path(self, path_name: str) -> None:
target_path = os.path.join(self.current, path_name)
if os.path.exists(target_path):
print(f'path name: {path_name} already exists')
... |
import os
from concurrent.futures.process import ProcessPoolExecutor
from itertools import repeat
from math import ceil
from time import time
import numpy as np
import psutil as psutil
from absl import logging
from datasets.base import register_dataset, DatasetBase
from util import get_normalizing_scale_fa... |
#!/usr/bin/env python
# Copyright (c) PLUMgrid, Inc.
# Licensed under the Apache License, Version 2.0 (the "License")
from ctypes import c_uint, c_ulong, Structure
from bcc import BPF
from time import sleep
import sys
from unittest import main, TestCase
text = """
#include <linux/ptrace.h>
struct Ptr { u64 ptr; };
st... |
#
# PySNMP MIB module CIENA-CES-ACCESS-LIST-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CIENA-CES-ACCESS-LIST-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:31:33 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.... |
# -*- coding: utf-8 -*-
from django.conf.urls import url
from search.views import SearchPostByOrder
urlpatterns = [
url(r'^post/(?P<search_word>.+)/(?P<order>\w+)/$', SearchPostByOrder.as_view(), name='search_post_by_order'),
]
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
###
# Name: Jarod Penniman, Jared Love
# Student ID: 2258875, 1818306
# Email: penni112@mail.chapman.edu, love115@mail.chapman.edu
# Class: PHYS 220 Fall 2017
# Assignment: CW07
###
import numpy as np
import nose
import taylor_approx as ta
import array_calculus as ac
""... |
# -*- coding: utf-8 -*-
import json
import weakref
import time
from datetime import datetime
from flask_restful import reqparse
from flask_restful import fields
from util.log import LogHandler
from util.utils import ParseRequestParameters
from flask_restful import Resource
from util.utils import zcompress
log = LogHan... |
import html
from preprocessing.Processor import Processor
class HtmlEncodingProcessor(Processor):
def process(self, data):
data['text'] = self.remove_html_encoding(data)
return self.next_processor.process(data)
@staticmethod
def remove_html_encoding(data):
return data['text'].s... |
# Time: O(n)
# Space: O(n)
# 1063
# Given an array A of integers, return the number of non-empty continuous subarrays
# that satisfy the following condition:
# The leftmost element of the subarray is not larger than other elements in the subarray.
class Solution(object):
def validSubarrays(self, nums):
"... |
'''
Created on Oct 19, 2016
@author: nixer
'''
from datetime import datetime
import os
import sys
import pymysql
import pymysql.cursors
import re
import requests
from symbol import parameters
from dbus import connection
def getLog(logdir, trid):
"""
Creates 'logs' directory, if it doesn't exist,
creates ... |
"""Bootstrap code starts and runs the Fluidinfo tools and services."""
import sys
from bzrlib.errors import BzrCommandError
from commandant import builtins
from commandant.controller import CommandController
from fluiddb.application import APIServiceOptions
from fluiddb.scripts import commands
from fluiddb.scripts.t... |
#!/usr/bin/env python
###
# Copyright 2015, EMBL-EBI
#
# 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 o... |
"""Programa 5_7.py
Descrição: Alterar o programa anterior de forma que o usuário informe também o final da tabuada
Autor:Cláudio Schefer
Data:
Versão: 001
"""
# Declaração de variáveis
xi = int(0)
xf = int(0)
t = int(0)
# Entrada de dados
t = int(input("Digite qual tabuada deseja imprimir: "))
xi = int(input("Digi... |
"""
License: MIT
Copyright (c) 2019 - present AppSeed.us
"""
# This will make sure the app is always imported when
# Django starts so that shared_task will use this app.
from .celery import app as celery_app
__all__ = ('celery_app',) |
import os, re, sys, glob, types, itertools
import numpy as np
from collections import defaultdict
def _xor(a, b):
return not ((a and b) or (not a and not b))
def _is_property(obj, name):
return isinstance(getattr(type(obj), name, None), property)
def _is_method(x):
return type(x) in [types.MethodType, type... |
import os
import sys
from flask import Flask
from flask import render_template, request, send_from_directory, flash, url_for
from flask import current_app as app
from werkzeug.utils import secure_filename
app = Flask(__name__)
UPLOAD_FOLDER = './'
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
app.secret_key = "secret k... |
import time
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from nw_util import *
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("nwapp=" + os.path.dirname(os.path.abspath(__f... |
from sklearn.preprocessing import normalize
from gensim.models import Word2Vec
from mineral_helper import *
import networkx as nx
import numpy as np
import argparse
def sample_cascade(cascade_graph, root, h, num_nodes):
"""
Uniformly samples a cascade from a cascade graph starting at a given root
node.... |
'''
@Description: Blueprint for event
@Author: Tianyi Lu
@Date: 2019-08-09 15:41:15
@LastEditors: Tianyi Lu
@LastEditTime: 2019-08-17 17:15:40
'''
from flask import render_template, session, redirect, url_for, current_app, flash, request, Markup, abort
from flask_login import login_required, current_user
from .. import... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of nautilus-pdf-tools
#
# Copyright (c) 2012-2019 Lorenzo Carbonell Cerezo <a.k.a. atareao>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal... |
import sys
import os
curr_path = os.path.dirname(os.path.abspath(__file__)) # 当前文件所在绝对路径
parent_path = os.path.dirname(curr_path) # 父路径
sys.path.append(parent_path) # 添加路径到系统路径
import gym
import torch
import datetime
from common.utils import save_results, make_dir
from common.utils import plot_rewards, plot_rewards... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test.client import RequestFactory
from djmercadopago import signals
from djmercadopago.tests import tests_utils
class TestExternalReferenceIsNotRequired(tests_utils.BaseSignalTestCase):
SIGNALS = [
[signals.checkout_preference... |
# String {L = a ^ n b ^ m n + m = even}
# dfa = state (zeroth) of DFA
def start(c):
if (c == 'a'):
dfa = 1
elif (c == 'b'):
dfa = 2
# -1 is used to check for any
else:
dfa = -1
return dfa
# This function is for the first
def state1(c):
if (c == 'a'):
dfa = 0
elif (c == ... |
#!/usr/bin/env python3
import sys, random
assert sys.version_info >= (3,7), "This script requires at least Python 3.7"
print('Greetings!') # The program greets the user.
colors = ['red','orange','yellow','green','blue','violet','purple'] # The program initializes an array of colors.
play_again = '' # the variable pl... |
import math
class Solution(object):
def ReverseStr(self, str, k):
ans=''
n = int (math.ceil(len(str) / (2.0*k) ))
for i in range(n):
ans += str[2*i*k:(2*i+1)*k][::-1] #reverse k str
print '1',ans
ans += str[(2*i+1)*k:(2*i+2)*k]
print '2',ans
... |
##############################################################################
#
# Copyright (c) 2008 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 SOF... |
from django.apps import AppConfig
class CompilerConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'compiler'
|
"""
datos de entrada
lado1-->l1-->float
lado2-->l2-->float
lado3-->l3-->float
datos de salida
area-->a-->float
"""
#entrada
l1=float(input("digite el lado 1: "))
l2=float(input("digite el lado 2: "))
l3=float(input("digite el lado 3: "))
#caja negra
s=(l1+l2+l3)/2
a=(s*(s-l1)*(s-l2)*(s-l3))**(1/2)
#... |
#!/usr/bin/python
import sys
from os import path
import sqlite3
import datetime
tasktype = {
0:"task",
1: "project",
2: "contact",
6: "url"
}
recurrence_string = {
0: "",
1: "+1w",
2: "+1m",
3: "+1y",
5: "+2w",
7: "+6m",
9: "",
50: "+1m",
101:"+1w",
105: "+2w",
... |
from ZSI.wstools.Namespaces import *
class PPCRL:
BASE = "http://schemas.microsoft.com/Passport/SoapServices/PPCRL"
FAULT = "http://schemas.microsoft.com/Passport/SoapServices/SOAPFault"
IDS = "http://schemas.microsoft.com/passport/IDS"
class MSWS:
STORAGE = "http://www.msn.com/webservices/storage... |
#!/usr/bin/python3
"""
Source:
https://github.com/rshk/render-tiles
"""
from collections import namedtuple
import math
import mapnik
import worker
# ============================================================
# MAP TILE SETTINGS
# ==================================================... |
# Copyright 2021 The Bellman Contributors
#
# 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... |
from __future__ import print_function
import os
import sys
import re
import time
import argparse
import warnings
from contextlib import contextmanager
from collections import defaultdict, OrderedDict
from six import string_types
from six.moves import cStringIO
from numpy import ndarray
try:
import objgraph
except... |
# -*- coding: utf-8 -*-
import re
from django.utils.encoding import smart_unicode
from forum.models.user import User
def find_best_match_in_name(content, uname, fullname, start_index):
uname = smart_unicode(uname)
fullname = smart_unicode(fullname)
end_index = start_index + len(fullname)
... |
#!/usr/bin/env python3
# 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 test.multiprocess_test_case import MultiProcessTestCase
import crypten
from crypten.debug import configure_loggi... |
# Generated by Django 3.0.6 on 2020-05-19 10:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('products', '0013_auto_20200519_1052'),
]
operations = [
migrations.AlterField(
model_name='original',
name='build_ye... |
import A_downloadVids
import B_processDownloads
import C_FixMissedDownloads
def run():
channelList = [
"https://www.youtube.com/channel/UC_OTXxqZn1F0vtqiCLRDEmQ", #ღ NightcoreGalaxy ღ
"https://www.youtube.com/channel/UCtY3IhWM6UOlMBoUG-cNQyQ", #Foxy
"https://www.youtube.com/channel/UCNOymlVIxfFW0mVmZiNq6DA", #S A... |
from scipy.integrate import odeint
from swing_config import *
f = cloudpickle.load(open('./swing_open_loop_dynamic.dll', 'rb'))
def fv_gen(amp, ome, phi, q_max):
return lambda t, y: amp * np.sin(ome * t + phi) / (1 + np.exp((np.abs(y[1:3])-q_max) / 0.01) * np.logical_or(np.abs(y[1:3]) < q_max, y[1:3] * y[4:] > 0)... |
import numpy as np # type: ignore
import pandas as pd # type: ignore
import matplotlib.pyplot as plt # type: ignore
import seaborn as sns # type: ignore
# This gives an error when running from a python script.
# Maybe, this should be set in the jupyter notebook directly.
# get_ipython().magic('matplotlib inline')... |
# Generated by Django 3.1.8 on 2021-06-04 00:25
from django.db import migrations
def create_user_input_types(apps, schema_editor):
"""
Initialize the database with the WorkflowStepUserInputType that we have schemas available for.
"""
WorkflowStepUserInputType = apps.get_model(
"django_workfl... |
import cp2k_wfn
wfn = cp2k_wfn.cp2k_wavefunction()
wfn.read_cp2k_wfn("H2O-RESTART.wfn")
wfn.add_H()
#wfn.write_cp2k_wfn("H2O-RESTART-scf.wfn")
print wfn
|
#!/usr/bin/python3
from __future__ import print_function
from html.parser import HTMLParser
import json
import logging
import os
import re
import requests
import time
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.DEBUG)
logging.getLogger('requests').setLevel(logging.ERROR)
session = requests... |
"""SQLAlchemy Database"""
from flask_sqlalchemy import SQLAlchemy
from flask_login import UserMixin
from . import DB
class User(UserMixin, DB.Model):
"""User information"""
id = DB.Column(DB.Integer, primary_key=True, autoincrement=True)
email = DB.Column(DB.String, unique=True)
password = DB.Column(... |
# -*- coding: utf 8 -*-
"""
Define a suite a tests for the Curve module.
"""
import numpy as np
from welly import Synthetic
def test_synthetic():
"""
Test basic stuff.
"""
data = np.array([4, 2, 0, -4, -2, 1, 3, 6, 3, 1, -2, -5, -1, 0])
params = {'dt': 0.004}
s = Synthetic(data, params=params... |
'''
Basic utilities.
'''
# Copyright (c) 2012-2013 Wladimir J. van der Laan
#
# 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... |
import sys, os, time
if sys.version_info[0] == 2:
import xml.etree.cElementTree as ET
else:
import xml.etree.ElementTree as ET
import cv2
import numpy as np
import collections
import torchvision
import torchvision.transforms as T
from collections import Counter
# detector utils
import sys
sys.path.append('.... |
"""
pywopwop - https://github.com/fchirono/pywopwop
Collection of convenience routines to parse and create PSU-WOPWOP input
files version 1.0.
--> PSU-WOPWOP file readers and writers
Author:
Fabio Casagrande Hirono
Dec 2021
"""
import numpy as np
import struct
from consts_and_dicts import ENDI... |
import os
from uuid import uuid4
from pytube import YouTube
from loguru import logger
def progress_function(stream, chunk, file_handle, bytes_remaining):
size = stream.filesize
percent = int((size-bytes_remaining)/size * 100)
logger.info(f'{stream.title} @ {percent} %')
def download_music(link, filenam... |
import os
import re
import json
import sys
import getopt
import argparse
from docopt import docopt
from urllib2 import urlopen, Request
import urllib
import urllib2
import requests
url_phenotypes = 'http://localhost:9000/api/phenotypes'
url_genotypes = 'http://localhost:9000/api/genotypes'
token = 'Bearer eyJhbGciOiJI... |
# -----------------------------------------------------------------------------
# Copyright (C) 2019-2021 The python-ndn authors
#
# This file is part of python-ndn.
#
# 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 ... |
"""
@ Harris Christiansen (code@HarrisChristiansen.com)
Generals.io Automated Client - https://github.com/harrischristiansen/generals-bot
Bot_control: Create a human controlled bot
"""
import logging
from .base import bot_moves
# Set logging level
logging.basicConfig(level=logging.INFO)
######################### ... |
# -*- coding: utf-8 -*-
"""
Profile: http://hl7.org/fhir/StructureDefinition/SearchParameter
Release: R4
Version: 4.0.1
Build ID: 9346c8cc45
Last updated: 2019-11-01T09:29:23.356+11:00
"""
import sys
from . import backboneelement, domainresource
class SearchParameter(domainresource.DomainResource):
""" Search ... |
from setuptools import setup
setup(
name='telegraf_ultimaker3',
version='0.1',
packages=['requests==2.22.0'],
url='',
license='MIT',
author='Aubustou',
author_email='',
description='Script that allows data collection from Ultimaker 3\'s API to Telegraf'
)
|
"""
GNN models
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
def get_model(model_name=None):
from .model import SegmentClassifier as mm
from .model_more import SegmentClassifier as mm_more
from .model_smart import SegmentCl... |
# Copyright 2022 MosaicML Composer authors
# SPDX-License-Identifier: Apache-2.0
import os
from typing import Optional
import py
import pytest
import torch
from torch.utils.data import DataLoader
from composer import Trainer
from composer.algorithms import get_algorithm_registry
from tests.algorithms.algorithm_setti... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.