text stringlengths 38 1.54M |
|---|
species(
label = '[CH2]C(C[C]=O)OO(13197)',
structure = SMILES('[CH2]C(C[C]=O)OO'),
E0 = (45.8543,'kJ/mol'),
modes = [
HarmonicOscillator(frequencies=([2750,2850,1437.5,1250,1305,750,350,1855,455,950,3615,1310,387.5,850,1000,3000,3100,440,815,1455,1000,1380,1390,370,380,2900,435,361.368],'cm^-1'... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-11-12 06:21
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('webapp', '0001_initial'),
]
operations = [
migrations.AddField(
... |
import tensorflow as tf
import logging
import sys
from collections import namedtuple
from tensorflow.contrib.layers import fully_connected
from tfTools.gradientTools import average_gradients, handle_gradients
from tfModels.tools import warmup_exponential_decay, choose_device, lr_decay_with_warmup, stepped_down_decay, ... |
#
# Copyright 2005-2010 Dustin Bernard
#
# This file is part of UruAgeManager/Drizzle.
#
# UruAgeManager/Drizzle is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, ... |
def add(n1, n2):
return n1 + n2
# 心知肚明哪些可以做
print(add(3, 5))
print(add(3, 2.2))
print(add("hello", "abd"))
# print(add("hello", 3))
# 沒加():紙 有加(): 紙->執行
b = add
print(b(3, 5))
c = print
c("hello")
def test():
return print
test()("hello")
# 預設值
def add(n1, n2, digit=2, mul=1):
return mul * round(n1+n2,... |
from hexcell import HexCell
if __name__ == "__main__":
c0 = HexCell(0, 0)
assert 3 == c0.ne().ne().ne().distance(c0)
assert 0 == c0.ne().ne().sw().sw().distance(c0)
assert 2 == c0.ne().ne().s().s().distance(c0)
assert 3 == c0.se().sw().se().sw().sw().distance(c0)
# follow path i... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from h import models
from .base import ModelFactory
class FeatureCohort(ModelFactory):
class Meta:
model = models.FeatureCohort
|
# RootTools imports
from RootTools.core.TreeVariable import TreeVariable, VectorTreeVariable, ScalarTreeVariable
from RootTools.core.helpers import cStringTypeDict, defaultCTypeDict
def getCTypeString(typeString):
'''Translate ROOT shortcuts for branch description to proper C types
'''
if typeString in cS... |
import json
import pickle
import time
import copy
import os
import numpy as np
import cv2
from sklearn.linear_model import LinearRegression
# from sklearn.utils.linear_assignment_ import linear_assignment
from res.fields import get_mask_movements_heatmaps
import matplotlib
if os.name == 'nt':
matplotlib.use('Qt5... |
test = raw_input()
test = int(test)
for t in range(1,test+1):
error = 1
n = raw_input()
nint = int(n)
numbers = {}
for i in range(0,10):
numbers[i] = 0
# print numbers
if(nint==0):
print "Case #"+str(t)+": INSOMNIA"
else:
k = 1
while(1):
error = 0
for c in n:
numbers[int(c)] = numbers[int(c)... |
import random
random.seed(20)
gridMax = 18
gridDimX = random.randint(8, gridMax)
gridDimY = random.randint(8, gridMax)
energy = random.randint(4, 30)
# print("X: ", x)
# print("Y: ", y)
startX = random.randint(1, gridDimX - 1)
startY = random.randint(1, gridDimY - 1)
curPosX = startX
curPosY = startY... |
#! /usr/bin/env python
# coding: utf-8
"""
Module with text preparation functionality.
"""
import re
import string
import numpy as np
import pandas as pd
from src import *
__all__ = ['pre_clean', 'remove_things', 'agressive_clean', 'clean_text',
'tokenize_text', 'join_string']
def pre_clean(text):
... |
fin = open("linear.in", "r")
fout = open("linear.out", "w")
#main----------------------------------------------
main_mass = [int(i) for i in fin.read().split()]
n = main_mass[0]
mass_times = main_mass[(main_mass[0]*2) + 2:]
time = []
cor = main_mass[1 : (main_mass[0]*2) + 1 : 2]
massiv_s_n = main_mass[0 : (mai... |
from sqlalchemy import Table, Column, Integer, String
from tools.dbconnect import engine,Session
from sqlalchemy.ext.declarative import declarative_base
import settings
Base = declarative_base()
class DBVersion(Base):
__tablename__ = 'dbversion'
id = Column(Integer, primary_key=True)
Version = Column(Inte... |
from django.contrib import admin
from . models import *
# Register your models here.
admin.site.register(customer)
admin.site.register(order)
admin.site.register(product)
admin.site.register(review)
admin.site.register(ordered_item)
admin.site.register(category)
admin.site.register(shipping)
admin.site.regist... |
#!/usr/bin/env python
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
import os
from openpyxl import Workbook
from selenium.webdriver.common.by import By
from docx import Document
option = webdriver.ChromeOptions()
option.add_argument("--incognito")
option.add_argument("--sta... |
"""
MicroPython Aosong DHT12 I2C driver
"""
class DHTBaseI2C:
def __init__(self, i2c=None, addr=0x5c):
if i2c == None:
from machine import I2C
self.i2c = I2C(sda=21, scl=22)
else:
self.i2c = i2c
self.addr = addr
self.buf = bytearray(5)
def mea... |
import sys
import random
import signal
from time import time
import copy
from operator import itemgetter
class Team65():
def __init__(self):
self.available_moves = []
self.backup_move = (0, 0)
self.up = [-1, 0, 1, 0]
self.down = [0, 1, 0, -1]
self.inc_costs = [0,1, 100, 10... |
def preamble():
return ("""
This script takes a file with pregnacies of interest and looks for prior VBAC or vaginal pregnanicies from another data set
Usage: search_data.py -d [list of all pregnancies saved as CSV UTF-8] -p [Pregnancies and metadata of interest]
Last Updated: 30 July 2021
Maxim Seferovic, s... |
import numpy
print(numpy.max(numpy.min(numpy.array([input().split() for _ in range(int(input().split()[0]))],int),axis=1)))
|
#!/usr/bin/env python
#encoding=utf-8
import sys
import os.path
module_dir = os.path.dirname(os.path.realpath(__file__))
sys.path.append(module_dir+'/../../lib/')
from tencent_ai_texsmart import *
print('##################################################')
print('# Example-2: Parsing text using options')
print('####... |
n, m = list(map(int, input().split()))
relations = {}
for i in range(m):
a, b = list(map(int, input().split()))
if(relations.get(a) == None):
relations[a] = []
if(relations.get(b) == None):
relations[b] = []
relations[a].append(b)
relations[b].append(a)
result = False
def lookup... |
from pynput.mouse import Button, Controller as MouseController
from pynput.keyboard import Key, KeyCode, Controller as KeyboardController
from pyautogui import typewrite
from time import sleep, time
from threading import Thread
class ClickEvent:
KEYWORD = "click"
MOUSE_LEFT = 1
MOUSE_RIGHT = 2
def __init__( ... |
__author__ = 'xiaoj'
#空间首页
from StoneUIFramework.public.common.basepage import Page
class _SPACEPAGE1(Page):
#定位:空间列表
def Kjlb(self):
self.Kjlb = self.p.get_element("id->com.yunlu6.stone:id/navi_item_zone","空间列表")
return self.Kjlb
# 空间列表-主菜单
def Kjlb_mainmenu(self):
self.Kjlb_m... |
import json
import re
file = open('pokemon_full.json')
pokemon_full = file.read()
file.close()
print('1. Общее количество символов:', len(pokemon_full))
pokemon_non_prep = re.sub('[\w]', '', pokemon_full)
print('2. Количество символов без знаков препинания:', len(pokemon_full) - len(pokemon_non_prep))
p... |
from flask import jsonify
from SSMSchema.ssmschema import customersearchesschema
from models.database import Database
import uuid
class CustomerSearches(object):
def __init__(self,customer_id,search,date,search_id=None):
self.search_id = uuid.uuid4().hex if search_id is None else search_id
... |
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class AddressesConfig(AppConfig):
name = "project.addresses"
verbose_name = _("Address Book")
|
# -*- coding: utf-8 -*-
# @Time : 2019-09-16 21:19
# @Author : icarusyu
# @FileName: zhishu.py
# @Software: PyCharm
import math
def f():
n = int(input())
arr = [0,0]
# if n <3:return arr[n-1]
for i in range(2,n+1):
# 是合数
if simple_cnt(i):
for k in range(2, int(math.sqrt(i))+1... |
from django.test import TestCase
from dojo.utils import set_duplicate
from dojo.management.commands.fix_loop_duplicates import fix_loop_duplicates
from dojo.models import Finding
import logging
deduplicationLogger = logging.getLogger("dojo.specific-loggers.deduplication")
class TestDuplication(TestCase):
fixtures... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os.path
from Store import Store
# from Writer import Writer
# from Reader import Reader
# from tools import ETimer
# lin
SCAN_PATH = "/home/nia/Music" # 130 - gz 2.6 k
SCAN_PATH = "/home/nia/Android" # 31105 - gz 504.8 k
SCAN_PATH = "/home/nia... |
import pickle
import inflection
import pandas as pd
import numpy as np
import math
import time
import datetime
class Rossmann(object):
def __init__(self):
state = 1
self.home_path = 'C:/Users/Caio/Desktop/Caio/repos/data_science_em_producao/'
self.competition_distance_scaler = pi... |
from turtle import *
pencolor("red")
for i in range(4):
forward(90)
left(90)
for i in range(7):
forward(90)
if i<6:
left(60)
pencolor("blue")
for i in range(2):
left(120)
forward(90)
left(228)
for j in range(4):
forward(90)
right(72)
mainloop() |
from q17_and_18 import *
import numpy as np
"""
This program solve the high-dimension decision stump problem.
The answer is shown below.
Author: SunnerLi
Finish: 19/10/2016
"""
# Compute the result of specific hypothesis
H = lambda s, x: s if x - theta > 0 else -s
# Variable
trainRowNumber = 100 ... |
import numpy as np
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt
#I0 = 3.56
#F0 = 61.04*2*np.pi
data = np.genfromtxt('current1.2A.csv', delimiter=',', names=['t', 'X', 'J', 'I'])
def friction(x, a):
integral = [0]
for i in range(len(x)-1):
integral.append(integral[-1] + (a)*(x[i... |
# Copyright 2020 The SQLFlow 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 applicable law o... |
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
class RBFNet(tf.keras.Model):
def __init__(self, n, input_dim = 1, output_dim = 1):
super().__init__()
self.input_dim = input_dim
self... |
import networkx as nx
from subgraph_generator import gen_subgraph_list
def get_api_info():
with open('Sensitive') as f:
lines = f.readlines()
lines = [line.strip().split('#') for line in lines]
api_list = [line[0] for line in lines]
api_coeff = {line[0]: float(line[1]) for line in lines}
return api_list, api_c... |
print("Please wait while we import some important libraries and models to run the software.")
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
print("*")
from tkinter import Tk
print("*")
from tkinter.filedialog import askopenfilename
print("*")
from time import sleep
print("*")
import pandas as pd
print("*")
import... |
# Copyright 2013 OpenStack Foundation
# 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 requ... |
t = eval(input())
while t:
t -= 1
y = []
z = []
x = str(input())
for i in range(len(x)):
if (not int(i)%2):
y.append(x[i])
else:
z.append(x[i])
print("".join(y) + " " + "".join(z))
|
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
# removing duplicates from class list
def remove_duplicates(values):
output = []
seen = set()
for value in values:
# If value has not been encountered yet,
# ... add it to both list and set.
if value not... |
# Copyright (c) 2021 Ichiro ITS
#
# 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, distribu... |
# Muhammad Ibrahim (mi2ye)
print('Think of a number between 1 and 100 and I\'ll guess it.')
guesses = int(input('How many guesses do I get? '))
upper_bound = 100
lower_bound = 0
number_of_guesses = 0
previous_mean_bounds = 0
answer = 'none'
while number_of_guesses < guesses:
mean_bounds = ((upper_bound +... |
import cv2
import numpy as np
import math
import matplotlib.pyplot as plt
class Canny():
def __init__(self,image_path):
self.image_path = image_path
################################################
# 自定义padding函数
################################################
def Padding(self,im... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
__author__ = "Fedor Marchenko"
__email__ = "mfs90@mail.ru"
__date__ = "Jul 13, 2016"
from django.conf import settings
ISSUE_REPOSITORY_USER = getattr(settings, 'ISSUE_REPOSITORY_USER', None)
ISSUE_REPOSITORY_NAME =... |
'''
For every good kata idea there seem to be quite a few bad ones!
In this kata you need to check the provided array (x) for good ideas 'good' and bad ideas 'bad'.
If there are one or two good ideas, return 'Publish!', if there are more than 2 return 'I smell a series!'.
If there are no good ideas, as is ofte... |
#!/usr/bin/env python
#
# Regenerate JNI headers for
#
# NOTE: doesn't work with JDK 10 because javah was removed [1] from JDK, and javac doesn't seem to
# be able to generate native headers from .class files.
#
# NOTE: this script must be python2/3 compatible
from __future__ import absolute_import, print_function
im... |
###################################### Stacked Autoencoder ############################################
## Author: Sara Regina Ferreira de Faria
## Email: sarareginaff@gmail.com
#Needed libraries
import numpy
import matplotlib.pyplot as plt
import pandas
import math
import scipy.io as spio
import scipy.ndimage
from sk... |
import collections
import envi.symstore.symcache as es_symcache
# Symbol Type Constants ( for serialization )
SYMSTOR_SYM_SYMBOL = 0
SYMSTOR_SYM_FUNCTION = 1
SYMSTOR_SYM_SECTION = 2
SYMSTOR_SYM_MODULE = 3
class Symbol:
symtype = SYMSTOR_SYM_SYMBOL
def __init__(self, name, value, size=0, fname=None):
... |
from conans import ConanFile, CMake
class ArgumentParser(ConanFile):
name = "cracker"
version = "0.0.0"
license = "MIT"
url = "<Package recipe repository url here, for issues about the package>"
description = "Simple argument parser for CLI in C++"
settings = "os", "compiler", "build_type", "a... |
import card
import random
class Deck:
suits = ['Club', 'Diamond', 'Heart', 'Spade']
def clear(self):
self.cards = []
def add_deck(self, deck):
self.addrange(deck.cards)
deck.clear()
def add(self, card):
self.cards.append(card)
def addrange(self, cards):
... |
import math
__author__ = 'Danyang'
class Solution(object):
def solve(self, cipher):
L, S1, S2, qs = cipher
v = abs(S1 - S2) / math.sqrt(2)
rets = []
for q in qs:
t = (L - math.sqrt(q)) / v
rets.append(t)
return "\n".join(map(lambda x: "%f... |
import pandas as pd
import numpy as np
s = pd.Series([1,3,5, np.nan, 44, 1])
#print(s)
dates = pd.date_range('20190910', periods = 6)
#print(dates)
df = pd.DataFrame(np.arange(24).reshape(6,4),index=dates,columns=['a','b','c','d'])
#print(df)
df2 = pd.DataFrame({'A' : 1.,
'B' : pd.Timestamp('2... |
import itertools
flatten_iter = itertools.chain.from_iterable
def factors(n):
return list(set(flatten_iter((i, n//i)
for i in range(1, int(n**0.5)+1) if n % i == 0)))
def is_prime(n):
if factors(n)==[1,n]:
return True
else:
return False
def summation(numbers):
x=0
for a in numbers:
... |
from django.shortcuts import render, get_object_or_404, redirect
from django.contrib.auth.decorators import login_required
from .models import Category, Goal, Step, Reward, Profile
from .forms import CatForm, GoalForm, StepForm, RewardForm
# Create your views here.
def index(request):
return render(request, 'goals... |
from django.db import models
from datetime import datetime
class Realtor(models.Model):
name = models.CharField(max_length=60, verbose_name='Name')
photo = models.ImageField(upload_to='photos/%Y/%m/%d')
description = models.TextField(blank=True, verbose_name='Description')
phone = models.CharField(max_... |
from architectures.core import Graph, Cluster, Node, Edge, Flow
from architectures.themes import Default, LightMode
from architectures.providers.azure.general import Computer
from architectures.providers.azure.compute import VirtualMachineWindows
from architectures.providers.azure.storage import ManagedDiskStandardHdd... |
from Cb_constants import CbServer
from bucket_collections.collections_base import CollectionBase
from bucket_utils.bucket_ready_functions import BucketUtils
from cb_tools.cbstats import Cbstats
from couchbase_helper.documentgenerator import doc_generator
from remote.remote_util import RemoteMachineShellConnection
from ... |
# Generated by Django 2.2 on 2021-03-10 02:57
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('CFP_Portal', '0015_auto_20210310_0105'),
]
operations = [
migrations.AddField(
model_name='person',
... |
class Solution:
# @param S, a list of integer
# @return a list of lists of integer
def subsets(self, S):
n = len(S)
m = 1<<n
ans = []
S.sort()
for i in range(m):
temp = []
for j in range(n):
if i&(1<<j)>0:
te... |
import torchvision
models_dict = {
'inception_v3': torchvision.models.inception_v3(pretrained =True),
'resnet18': torchvision.models.resnet18(pretrained =True),
'resnet50': torchvision.models.resnet50(pretrained =True),
'resnet101': torchvision.models.resnet101(pretrained =True),
'go... |
if __name__ == '__main__':
for i in range(32):
b = bin(i)[2:]
length = len(b)
if length != 5:
b = '0'*(5-length)+b
print(b) |
PasswordChangedEmail = \
"""Hi {0},
Your password has been successfully changed. If you did not request a password
change, please let an IMSS rep know immediately.
Thanks!
The Ruddock Website
"""
ResetPasswordEmail = \
"""Hi {0},
We have received a request to reset this account's password. If you didn't
request thi... |
from django.db import models
from account.models import StudentUser
from result.models import Class
from django.utils.translation import ugettext as _
class Attendance(models.Model):
DAY_OF_THE_WEEK = [
('1',_(u'Sunday')),
('2',_(u'Monday')),
('3',_(u'Tuesday')),
('4',_(u'Wednesday... |
#########################################################
#########################################################
##################### TWITTER #####################
#########################################################
#### in case of twitter API interrupting, this code ####
# still works (there are few t... |
import os
import numpy as np
import pandas as pd
from sklearn.utils import shuffle
def filter_file(filename,filter_path):
all_data = pd.read_excel(filename)
a_list = ['a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8']
indexes = False
for item in a_list:
indexes = ((all_data.loc[:, item] > 100) | (a... |
from setuptools import setup, find_packages, Extension
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name="dnn_from_scratch",
version="0.1.dev1",
author="Shivam Shrirao",
author_email="shivamshrirao@gmail.com",
description="A high level deep learning library for Convol... |
from rest_framework import serializers
from .models import *
from django.db import models
class EventSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Event
fields = ('id', 'name', 'date', 'description' , 'image')
class TrackSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
... |
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 27 12:45:02 2019
@author: ZhuangChi
"""
"""
请你来实现一个 atoi 函数,使其能将字符串转换成整数。
首先,该函数会根据需要丢弃无用的开头空格字符,直到寻找到第一个非空格的字符为止。
当我们寻找到的第一个非空字符为正或者负号时,则将该符号与之后面尽可能多的连续数字组合起来,作为该整数的正负号;假如第一个
非空字符是数字,则直接将其与之后连续的数字字符组合起来,形成整数。
该字符串除了有效的整数部分之后也可能会存在多余的字符,这些字符可以被忽略,它们对于函数... |
from django.contrib import admin
from djcelery.admin import PeriodicTaskAdmin
from djcelery.models import PeriodicTask
class PeriodicTaskDbaas(PeriodicTaskAdmin):
actions = ['action_enable_tasks', 'action_disable_tasks']
def _set_tasks_status(self, queryset, status):
for periodic_task in queryset:
... |
import os, pickle
import numpy as np
import pandas as pd
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import silhouette_samples, silhouette_score
from collections import Counter
from pathlib import PurePath
current_dir = os.path... |
from datetime import date, datetime
from decimal import Decimal
from itertools import chain
from typing import (Any, Callable, Dict, Iterator, List, Optional, Set, Tuple,
Type, Union)
from uuid import UUID
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.backends.utils imp... |
# run this script to take a list of fighter names, create INSERT statements, and write them to a file
from get_data import *
with open('fighter_stats.csv', 'a') as f:
f.write('name, age, height, weight, reach, gym\n')
list_of_fighter_names = all_fighters()
for f in list_of_fighter_names:
try:
f_dict... |
import math as m
from seqfold import dg, dg_cache, fold, Struct#download seqfold by JJ Timons from github
from typing import List
header=num=''
count=add=0
with open("input1.txt","r") as file1:#single line fasta file required
read=file1.read()
data=read.split("\n")
#print(data)# Check your process... |
from django.contrib import admin
from .models import BillingProfil
admin.site.register(BillingProfil) |
from django.contrib.auth.models import AnonymousUser, User
from django.test import TestCase, RequestFactory
from.views import user_login, auth_view
class SimpleTest(TestCase):
def setUp(self):
self.factory = RequestFactory()
self.user = User.objects.create_user(username='sc13da... |
import pandas as pd
import numpy as np
from keras.layers import Input, Conv2D
from keras.models import Model
from PIL import Image
import matplotlib.pyplot as plt
input_file = ("/home/flipper/ananthsmap/req/27220156.csv")
SMAP_LABLE='SoilMoisture'
latD=6
lonD=6
varD=1
inputs = Input((latD,lonD,varD))
df = pd.r... |
#!/usr/bin/env python
import argparse
import subprocess
header = """
import Pike.Pike
object prog extends Pike {
def main(args: Array[String]): Unit = {
"""
closer = """
run
}
}
"""
def main():
parser = argparse.ArgumentParser()
parser.add_argument("file")
parser.add_argument("-j", "--jar", default="p... |
import argparse
import json
from collections import defaultdict
import serifxml3
def parse_args():
parser = argparse.ArgumentParser(description="convert serifxml to jsonlines format")
parser.add_argument("-i", "--input_serifxml_list", type=str, required=True, help="input serifxml filepaths list")
parser.a... |
from django.db import models
from django.contrib.auth.models import AbstractUser
from django.contrib.auth.signals import user_logged_out
from django.dispatch import receiver
from django.contrib import messages
# Create your models here.
def img_upload_directory(instance, filename):
return f"profile/{instance.userna... |
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright SAS Institute
#
# 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 b... |
import os
from flask import Flask
from flask import render_template
from flask_script import Manager
from flask_bootstrap import Bootstrap
from flask_moment import Moment
from datetime import datetime
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField
from wtforms.validators import Required
fr... |
from lxml import etree
from fontFeatures import FontFeatures, Routine, Substitution
from babelfont import Babelfont
from fontFeatures.feaLib import FeaUnparser
from fontTools.feaLib.builder import Builder
from fontTools.ttLib import TTFont
from fontFeatures.ttLib import unparse
from Flux.computedroutine import Computed... |
import logging
import boto3
from ....utils.get_sns_subscriptions import get_sns_subscriptions
LOG = logging.getLogger(__name__)
def destroy_sns_event(app_name, env, region):
""" Destroys all Lambda SNS subscription
Returns:
boolean: True if subscription destroyed successfully
"""
session = ... |
"""
Copyright ©2020. The Regents of the University of California (Regents). All Rights Reserved.
Permission to use, copy, modify, and distribute this software and its documentation
for educational, research, and not-for-profit purposes, without fee and without a
signed licensing agreement, is hereby granted, provided ... |
#!/usr/bin/env python
import os
import sys
import re
if len(sys.argv)!= 3:
print("usage: filter.py intput output")
quit()
fin = open(sys.argv[1],'r')
fout = open(sys.argv[2],'w')
for line in fin:
if not re.match(r'^\s*$',line):
fout.write(line)
fin.close()
fout.close()
|
#!/usr/bin/env python3
# Renames all files given as arguments to "track#-title.ext".
# The track and title data is extracted from the files' id3 tags.
import sys, os
from mutagen.id3 import ID3
for file in sys.argv[1:]:
if not os.path.isfile(file):
print(f"Invalid path: {file}")
exit(1)
id3 ... |
import pymysql as mysql
MYSQL_HOST = '117.16.123.11'
MYSQL_CONN = mysql.connect(
host=MYSQL_HOST,
port=3306,
user='root',
passwd='dkimsmu',
db='testDB',
charset='utf8'
)
def conn_mysqldb():
if not MYSQL_CONN.open:
MYSQL_CONN.ping(reconnect=True)
return MYSQL_CONN
... |
import talib
import numpy
from numpy import genfromtxt
data = genfromtxt('15MinutesCandles.csv', delimiter=',')
# print(data)
close = data[:,4]
# print(close)
# close = numpy.random.random(100)
# print(close)
# sma = talib.SMA(close)
# print(sma)
rsi = talib.RSI(close)
print(rsi) |
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.generic import TemplateView
from django.contrib.auth.decorators import login_required
from .robots import robots_txt
# http://stackoverflow.com/a/13186337
admin.site.login = login_r... |
# Author:Cecilia
import os
import sys
from tcp_server import server
if __name__ == '__main__':
server.run() |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 9 20:23:04 2019
@author: jasonmeverett
"""
from scipy.spatial.transform import Rotation as R
from numpy import *
from ananke.planets import *
def Rot_I_Perifocal(Om, i, om, degrees=True):
if degrees:
Om = Om * pi/180
i =... |
import shelve
import requests
class Exchange:
file = 'exchange_db'
standart = ['EUR', 'USD', 'RUB', 'UAH']
currency = ["AED", "ARS", "AUD", "BGN", "BRL", "BSD", "CAD", "CHF", "CLP", "CNY", "COP", "CZK", "DKK", "DOP", "EGP", "EUR", "FJD", "GBP", "GTQ", "HKD", "HRK", "HUF", "IDR", "ILS", "INR", "ISK", "JPY", ... |
# -*- coding: utf-8 -*-
'''
One string is an anagram of another if the second is simply a rearrangement of the first. For example, 'heart' and 'earth' are anagrams.
The strings 'python' and 'typhon' are anagrams as well.
For the sake of simplicity, we will assume that the two strings in question are of equal length an... |
"""
SOLR module
Generates the required Solr cores
"""
from pyspark.sql import SparkSession
from pyspark.sql.types import ArrayType, StringType
import sys
from pyspark.sql.functions import (
when,
col,
lit,
first,
concat_ws,
collect_set,
flatten,
collect_list,
udf,
)
COLUMN_MAPPE... |
# Copyright (c) 2016 Servionica
#
# 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, s... |
import random
from enum import Enum
import string
import logging
logger = logging.getLogger('hearthstone')
class Card:
CARD_DB = {
'The Coin':
{'mana_cost': 0, 'spell_play_effect': 'this_turn_mana+1', 'is_spell': True, 'is_minion': False},
'Mage_Hero_Fireblast':
{'attack'... |
from pan_dag import *
from scipy.special import comb
def corr_worker(X_dag, X_positive, corr_method, i, j):
"""
Calculate the correlation between the i-th and j-th genes in
X_dag using only the cells that have positive expression in
both genes.
"""
both_positive = np.logical_and(X_positive[:, ... |
from unittest.mock import MagicMock
import api.query_handler as query_handler
from classes import ThreadsManager
from constants import get_default_city_name
from database import CrawlerCacheModel
from tests import BaseTestCase
from tests.data import expected_udm_crawler_data, expected_uqam_crawler_data, expected_conco... |
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
def GetParamGUID(param):
if hasattr(param, "GuidValue"): return param.GuidValue.ToString()
else: return None
params = UnwrapElement(IN[0])
if isinstance(IN[0], list): OUT = [GetParamGUID(x) for x in params]
else: OUT = GetParamGUID(params) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.