text stringlengths 8 6.05M |
|---|
file = "./2020/Day08/mattinput.txt"
def has_infinity(history):
h_len = len(history) - 1
for i in range(h_len):
history_compare = history[h_len - i - 1:]
if history_compare[0] == history_compare[len(history_compare) - 1] and len(history_compare) > 1:
if history_compare == history[-(... |
from django.utils.deprecation import MiddlewareMixin
class TestMid(MiddlewareMixin):
def process_request(self, request):
print('TESTTESTTESTTESTTESTTEST')
return None
|
#!/usr/bin/python2.7
# -*- coding:utf-8 -*-
'''
HZ偶尔会拿些专业问题来忽悠那些非计算机专业的同学。
今天测试组开完会后,他又发话了:在古老的一维模式识别中,常常需要计算连续子向量的最大和,
当向量全为正数的时候,问题很好解决。
但是,如果向量中包含负数,是否应该包含某个负数,并期望旁边的正数会弥补它呢?
例如:{6,-3,-2,7,-15,1,2,2},连续子向量的最大和为8(从第0个开始,到第3个为止)。
给一个数组,返回它的最大连续子序列的和,你会不会被他忽悠住?(子向量的长度至少是1)
'''
class Solution:
def FindGreatestSumOf... |
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
from dataclasses import dataclass
from typing import FrozenSet
from pants.backend.codegen.protobuf.target_types import (
ProtobufDependenciesField,
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#遇到分隔符'|'
f = open('index.txt','w')
r = open('r.txt')
for line in r.readlines():
if not line.strip():
continue
import linecache
print linecache.getline('r.txt',3)
|
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name = 'DataChaser',
version = '1.0.1',
author = 'SuulCoder',
author_email = 'saulcontreras@acm.org',
description = 'This packages autocompletes the information that is lost in a CSV using AI',
long_des... |
# Generated by Django 3.1 on 2020-10-16 06:58
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('announcement', '0002_announcement_to_group'),
migrations.swappable_dependency(settings.AUTH_USER_M... |
#!/usr/bin/python
# -*- coding: latin-1 -*-
"""
Rigoberto Sáenz Imbacuán
Desarrollador para Dispositivos Móviles - Colombia Games
Ingeniero de Sistemas y Computación - Universidad Nacional de Colombia
http://www.rigobertosaenz.com/
"""
from src.Controller import eActivityId, ResourceController, eQuestionAnswe... |
#!/usr/bin/python3
class Rectangle:
""" empty class that defines a rectangle """
pass
|
import sys
import os
import subprocess
sys.path.insert(0, 'scripts')
sys.path.insert(0, 'tools/families')
sys.path.insert(0, 'tools/generax')
import saved_metrics
import rf_cells
import experiments as exp
import shutil
import time
import fam
import sequence_model
import fast_rf_cells
import extract_event_number
import ... |
import chainer
import numpy as np
import chainer.functions as F
import chainer.links as L
from chainer import optimizers
from chainer import Variable
from chainer import serializers
import PIL.Image as Image
import matplotlib.pyplot as plt
def trainer(G,D,data,len_z=100,n_epoch=10000,pre_epoch=0,batchsize=500,save_in... |
# coding with UTF-8
# ******************************************
# *****CIFAR-10 with ResNet8 in Pytorch*****
# *****deconv_network.py *****
# *****Author:Shiyi Liu *****
# *****Time: Oct 22nd, 2019 *****
# ******************************************
import torch
import torch.nn as ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import urllib2
import google
from urlparse import urlparse
import sys
import os
from sys import argv as s
import time
from tqdm import tqdm
from termcolor import colored
import platform
from os.path import expanduser
import wget
if platform.release() == 7:
import ctypes
fro... |
from flask import Flask, flash, request, redirect, url_for, render_template
import urllib.request
import os
from werkzeug.utils import secure_filename
import pickle
from keras.applications.imagenet_utils import preprocess_input, decode_predictions
from keras.models import load_model
from keras.preprocessing import imag... |
import scrapy
from registrarData.items import RegistrardataItem
class ComSciSpider(scrapy.Spider):
name = "ComSciClasses"
allowed_domains = ["registrar.ucla.edu"]
start_urls = [
"http://www.registrar.ucla.edu/schedule/crsredir.aspx?termsel=14F&subareasel=COM+SCI"
]
def parse(self, respon... |
#!/usr/bin/env python2
# Imports for connecting to SQLite DB
from sqlalchemy import create_engine, exc
from sqlalchemy.orm import sessionmaker
from database_setup import Base, Category, Item, User
# Connect to DB
DBNAME = "sqlite:///itemcatalogwithusers.db"
engine = create_engine(DBNAME)
Base.metadata.bind = engine... |
import telegram
import os
def send_telegram(message=None,image=None):
chat_id=os.getenv('TELEGRAM_CHANNEL_ID')
bot = telegram.Bot(token=os.getenv('TELEGRAM_TOKEN'))
if image and message:
bot.send_message(chat_id=chat_id, text=message)
with open(image, 'rb') as img:
... |
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 31 18:56:59 2019
@author: Raghav
"""
import numpy as np
import cv2
from sklearn.svm import SVC
from sklearn.model_selection import cross_val_score
from sklearn.externals import joblib
import os
dirs = os.listdir('output/')
DIRECTORY = './output/'
def trainingDataForma... |
__author__ = 'iceke'
|
__version__ = "3.3.1-beta4"
__version_info__ = (3, 3, 1, 'beta4')
|
import matplotlib.pyplot as plt
import numpy as np
import uncertainties.unumpy as unp
import scipy.constants as con
from scipy.optimize import curve_fit
from scipy import stats
from uncertainties import ufloat
################################################################################
print('\n' + '(I) Bestimmung... |
#
# (C) Copyright 2012 Enthought, Inc., Austin, TX
# All right reserved.
#
# This file is open source software distributed according to the terms in
# LICENSE.txt
#
from .transition_manager import TransitionManager
_transition_manager = None
def get_transition_manager():
""" Get the global transition manager. ""... |
#!/usr/bin/python3
"""Single linked list Module"""
class Node():
"""Sigly linked list Node.
Private instance attribute: data:
property def data(self):
property setter def data(self, value):
Private instance attribute: next_node:
property def next_node(self).
property setter... |
#User function Template for python3
def checkOddEven(x):
if(x % 2 == 0):
# Complete the statement below
return True
elif (x % 2 != 0):
# Complete the statement below
return False
|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('basketball', '0053_auto_20160606_1919'),
]
operations = [
migrations.AddField(
model_name='dailystatline',
... |
num = 1
flt = 20.21
word = 'Thor'
sentence = '''
Star Wars
are better
than Avengers
'''
bln = True
print(f'Variable: {num}', '-', type(num))
print(f'Variable: {flt}', '-', type(flt))
print(f'Variable: {word}', '-', type(word))
print(f'Variable: {sentence}', '-', type(sentence))
print(f'Variable: {bln}', '-', type(bln)... |
'''
四键键盘问题-打印最多次A
'''
# 原始版
def max_a(N):
def dp(n, a_num, copy):
if n <= 0:
return a_num
return max(dp(n-1, a_num+1, copy), dp(n-1, a_num+copy, copy), dp(n-2, a_num, a_num))
return dp(N,0,0)
# 消除重叠子
def max_a(N):
memo = dict()
def dp(n, a_num, copy):
if n <= 0:
return a_num
if (n, a_num, ... |
from .sgc import SGC
from .ssgc import SSGC
from .gcn import GCN
from .base_sat import BaseSAT
|
from flask import Flask
from flask_wtf.csrf import CSRFProtect
from . import auth, csrf_token, clients
def init_app(app: Flask):
csrf = CSRFProtect(app)
app.register_blueprint(auth.bp)
app.register_blueprint(csrf_token.bp)
app.register_blueprint(clients.bp)
# This bp does not have csrf protection.... |
import load_vendor_to_datalake, delete_data_datalake
#loading data from vendor source to our data mart
load_vendor_to_datalake
#deleting data from data marts that is older than X days
delete_data_datalake
|
# coding: utf-8
import requests
import time
import json
DIR_NAME = "ndl"
token = "eyJhbGciOiJSUzI1NiIsImtpZCI6ImMzZjI3NjU0MmJmZmU0NWU5OGMyMGQ2MDNlYmUyYmExMTc2ZWRhMzMiLCJ0eXAiOiJKV1QifQ.eyJuYW1lIjoidS5uYWthbXVyYS5zYXRvcnUgdSIsInBpY3R1cmUiOiJodHRwczovL2xoMy5nb29nbGV1c2VyY29udGVudC5jb20vLXBZeVhMVEpMeFE0L0FBQUFBQUFBQUFJL... |
import tensorflow.keras as keras
model = keras.models.load_model('data/dogsvscats/vgg16model-small.h5')
for layer in model.layers[:-1]:
layer.trainable = False
model.add(keras.layers.Dense(3))
model.add(keras.layers.Activation('softmax'))
model.summary()
model.compile(loss='categorical_crossentropy',
... |
#OOP paradigm
class Person:
#Class attribute//Properties
species="Homo sapien sapien"
#Methods- functions defined inside a class
#def key word
def walk(self):
print("{} Is walking".format(self.name))
def sleep(self):
print("{} Is sleeping".format(self.name)) #.format to access ... |
#!/usr/bin/env python
# coding: utf-8
# # Riemann's Zeta-Function and Riemann's Hypothesis
#
# Powered by: Dr. Hermann Völlinger, DHBW Stuttgart(Germany); May 2021
#
# Prereq.'s: you need to extract the zip-file 'Images.zip' in a directory with name 'Images'
#
# ## Item1: Riemann's Zeta-Function
#
# See: ht... |
'''
Created on Jul 14, 2012
@author: jon
'''
from struct import unpack
def parse(data):
while 1:
# Parse payload length
length_bytes = data.read(2)
if not length_bytes:
break
packet_length = unpack('>H', length_bytes)[0]
# Parse payload (rest of packet)
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 24 14:16:33 2018
@author: thomas
"""
def main():
#nvert_bot1up = 4921
#nvert_bot1low = 1330
nvert_boundary = 34878
Ks = 1.0e6
f = open('boundary.target','w')
f.write("%i\n" %(nvert_boundary))
for i in range(nve... |
from PIL import Image
img_input = Image.open('lena.bmp')
img_output = Image.new(img_input.mode, img_input.size )
pixels_input = img_input.load()
pixels_output = img_output.load()
# upside-down
for x in range(img_output.height):
for y in range(img_output.width):
pixels_output[x, y] = pixels_input[x, ... |
"""
The module `core.vectorlist` defines a `VectorList` object, normally used
to store the module vectors.
Module class executes `_register_vectors()` at init to initialize the `VectorList`
object as `self.vectors` module attribute.
The methods exposed by VectorList can be used to get the result of a
given vector exe... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Destaque',
fields=[
('id', models.AutoField(ver... |
from django.shortcuts import render
from django.http import HttpResponse
import pandas as pd
from .models import Dataset
from .forms import ModelFormCSVFile
def home(request):
question = 1
return render(request, 'analyst/home.html', {'question': question})
def data(request):
if request.method == 'POST':
... |
def fibonaci_gen(limit):
a, b = 0, 1
for i in range(limit):
yield b
a, b = b, a + b
print([value for value in fibonaci_gen(10)])
|
"""
The implementation of hidden markov model using tensorflow for multiple sequences of discrete observations.
This implementation is simpler than the original version.
The tutorial of the original version can be found here: https://web.stanford.edu/~jurafsky/slp3/A.pdf
"""
import csv
from multiprocessing import cu... |
from time import time
from utils import make_batch
from models import WaveNet, Generator
from IPython.display import Audio
import matplotlib.pyplot as plt
import librosa.display
import numpy as np
inputs, targets = make_batch('./voice.wav')
output_path = './output.wav'
num_time_samples = inputs.shape[1]
num_channels =... |
"""
These are comment related models.
"""
from dataclasses import dataclass, field
from typing import List, Optional
from .base import BaseModel
from .mixins import DatetimeTimeMixin
from .common import BaseApiResponse, BaseResource
@dataclass
class CommentSnippetAuthorChannelId(BaseModel):
"""
A class ... |
'''
双向链表
'''
# -*- coding:utf-8 -*-
class Node(object):
def __init__(self, data, _prev=None, _next=None):
self.data = data
self._prev = _prev
self._next = _next
class DoubleLinkedList(object):
'''
方法:
insert_new_value_to_head 在头部插入新结点
insert_new_value_after_target_node 在给定结点后
插入新结点
insert_new_value_befo... |
import os
import json
from notebook_rendering import Notebook
def test_notebook_render(tmpdir):
output_path = os.path.join(tmpdir, 'notebook.ipynb')
input_path = 'tests/files/hello.ipynb'
with open(input_path, 'r') as file:
actual = json.load(file)['cells']
expected = [
{
... |
"""Util functions for StrategyLearner."""
import datetime as dt
import os
import pandas as pd
import numpy as np
def symbol_to_path(symbol, base_dir=None):
"""Return CSV file path given ticker symbol."""
if base_dir is None:
base_dir = os.environ.get("MARKET_DATA_DIR", '../data/')
return os.path.j... |
from django.shortcuts import render
def main(request):
context = {'like': 'Django很棒'}
return render(request, 'main/main.html', context)
def about(request):
context = {'range10': range(10)}
return render(request, 'main/about.html', context) |
# Generated by Django 2.2.1 on 2019-05-19 20:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('events', '0005_auto_20190519_1542'),
]
operations = [
migrations.AddField(
model_name='event',
name='event_descripti... |
import numpy as np
def nullspace(A, atol=1e-13, rtol=0):
u, d, v = np.linalg.svd(A)
rank = (d>1e-13).sum()
e = v[rank:].conj().T
return(e/e[2])
def findEpipole(A):
return nullspace(A.T)
if __name__ == "__main__":
F = np.array([[-1.29750186e-06, 8.07894025e-07, 1.84071967e-03],
[3.54098411e-06,... |
class Fraction:
""" class Fraction """
def __init__(self, N, D):
self.num = N
self.den = D
def __str__(self):
# user by print(varibale)
res = str(self.num) + "/" + str(self.den)
return res
def __repr__(self):
# user by varibale without print(varibale)
... |
import feature_extraction
from sklearn.feature_extraction import FeatureHasher
import common
import sys
import numpy as np
if __name__ == '__main__':
X,y = common.generate_ucf_dataset('frames') |
from os import listdir
import cv2 as cv
import numpy as np
from os import path, makedirs
import math
import matplotlib.pyplot as plt
import argparse
import tqdm
import tensorflow as tf
import time
import threading
from guided_filter import guided_filter_cv as guided_filter
class bbox:
def __init__(self, lt, rb):
... |
from django.forms import (
ModelForm, Textarea, Form, IntegerField
)
from django.core.exceptions import ValidationError
from .models import (
Query, Feedback
)
import re
EXPRESSION_TO_MATCH_ALPHABET_WITH_SPACE = re.compile('^[a-z][a-z, ]*$', re.IGNORECASE)
class TrackingForm(Form):
tracking_... |
import win32com.client
# ****************************************************
# * Initialize OpenDSS
# ****************************************************
# Instantiate the OpenDSS Object
try:
DSSObj = win32com.client.Dispatch("OpenDSSEngine.DSS")
except:
print ("Unable to start the OpenDSS Engine")
raise... |
import numpy as np
class pca:
def __init__(self):
print ''
def meanVector(self,vectorLijst):
result = np.zeros(vectorLijst[0].size)
i=0
for vector in vectorLijst:
result = result + vector
i += 1
result = result/i
return result
def c... |
# Generated by Django 2.2.7 on 2020-01-26 09:20
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('statics', '0020_auto_20200126_1444'),
('statics', '0022_reply_deleted'),
]
operations = [
]
|
"""s6 services management.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import abc
import errno
import os
import logging
import six
from treadmill import fs
from .. import _utils
from .. import _service_base... |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index),
url(f'^treasurehunt$', views.find_Thunt),
url(f'^treasurehunt/add$', views.create_Thunt),
url(f'^cluenode/delete$', views.delete_node),
url(f'^cluenode/add', views.create_node),
]
|
# read through file one line at a time
def clean_word(word):
return word.strip().lower()
def get_vowel_in_word(words):
vowel = "aeiou"
vowel_in_word = ''
for char in words:
if char in vowel:
vowel_in_word += char
return vowel_in_word
# main program
# def main():
file_obj = ... |
from django import forms
class unknownWordForm(forms.Form):
unknownWord = forms.CharField(label='')
class studentZipcode(forms.Form):
zip_code = forms.CharField(label='') |
class Player:
""" Base class of a cuatro player """
def __init__(self, name):
self.name = name
# the color is assigned by the Game, when the player is added.
self.color = None
def play(self, *args):
print "not implemented"
return []
def place(self, *args):
... |
from base.utils import get_model_object
from challenges.models import Challenge
from .models import ChallengeHost, ChallengeHostTeam
def get_challenge_host_teams_for_user(user):
"""Returns challenge host team ids for a particular user"""
return ChallengeHost.objects.filter(user=user).values_list('team_name',... |
"""degree of anarray, return the shortest length of the subarrray has same degree with input array."""
from collections import defaultdict
def degree_array(nums):
records = defaultdict(list)
degree = len(nums) # largest degree is all numbers are same
result = 0
for i, n in enumerate(nums):... |
#!/usr/bin/python3
# 2020-03-17
# [✅] mysql登录爆破
# 增加mysql超时重连
# 读取数量修改为线程数100倍
# 2020-03-18
# [❌] 增加Windows Powershell登录爆破 [!] 待完善
# 2020-03-19
# [❌] 增加mssql爆破 [!] 待完善
# [✅] redis爆破
import time
import optparse
import queue
import threading
import pymysql
import redis
from pexpect import pxssh # ssh
class Pydra:... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
__version__ = "1.0"
from mtenv.core import MTEnv # noqa: F401
from mtenv.envs.registration import make # noqa: F401
__all__ = ["MTEnv", "make"]
|
from pyUbiForge.misc import mesh
from plugins import BasePlugin
from pyUbiForge.ACU.type_readers.datablock import Reader as DataBlock
from pyUbiForge.ACU.type_readers.entity import Reader as Entity
from pyUbiForge.ACU.type_readers.visual import Reader as Visual
from pyUbiForge.ACU.type_readers.lod_selector import Reade... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""Wrapper to fix the number of tasks in an existing multitask environment
and return the id of the task as part of the observation."""
from gym.spaces import Dict as DictSpace
from gym.spaces import Discrete
from mtenv import MTEnv
from mtenv.uti... |
#!/usr/bin/env python
"""Simple Class"""
# Docs
__author__ = 'Vaux Gomes'
__version__ = '1.0.0'
#
class Contact(object):
"""Sample Contact class"""
#
def __init__(self, name, surname, comp, number):
""" Constructor """
self.name = name.title()
self.surname = surname.title()
self.comp = comp.title()
sel... |
import urllib.request
url='https://blog.csdn.net/'
headers=('User-Agent','Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36')
opener=urllib.request.build_opener() #正常情况使用默认的opener,现在添加报头创建个性opener
opener.addheaders=[headers]
data=opener.open(url).read()
pri... |
t = int(input())
while t > 0:
x0 , x1 , x2 = map(int,input().split())
y0 , y1 , y2 = map(int,input().split())
total = 0
a = min(x0,y2)
y2 -= a
b = min(x1,y0)
x1 -= b
m = min(x2,y1)
total += 2*m
total -= 2*min(x1,y2)
print(total)
t = t-1 |
#!/usr/bin/python
##############################################################################
# Copyright (c) Members of the EGEE Collaboration. 2010.
# See http://www.eu-egee.org/partners/ for details on the copyright
# holders.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use t... |
from pygments_css import __version__
def test_dummy():
assert True
|
import time
import random
import itertools
import logging
from functools import wraps
def _retry(fn):
"""
retry a process multiple times before logging the error
"""
@wraps(fn)
def wrapper(*args, **kwargs):
for i in itertools.count():
try:
return fn(*args, **kwa... |
from .classifier import CovidClassifier
from .masked_lm import MaskedLanguageModel
from .reactivity_classifier import ReactivityClassifier
from .final_classifier import FinalClassifier
|
# -*- coding: utf-8 -*-
"""
Script to convert n-gram files http://ufal.mff.cuni.cz/~hajic/courses/npfl067/stats/czech.html to python dictionaries
"""
from pprint import pprint
import pprint
import re
import sys
import codecs
import string
from unidecode import unidecode
NGRAM_LENGTH = 5
FILE_PATH = "czech-letters-5.t... |
import os
import json
import csv
import shutil
from helper import remove_hidden_folder
from variables import *
def convert_yolo_bbox(img_size, box, category):
dw = 1./img_size[0]
dh = 1./img_size[1]
x = (int(box[0]) + int(box[2]))/2.0
y = (int(box[1]) + int(box[3]))/2.0
w = abs(int(box[2]) - int(bo... |
#!/usr/bin/env python
import base64
import sys
import os
import random
import struct
from Crypto.Cipher import AES
from Crypto.Hash import SHA256
from Crypto import Random
from cexceptions import *
chunk_length = 16
pad = lambda s: s + (chunk_length - len(s) % chunk_length) * chr(chunk_length - len(s) % chunk_leng... |
from chardet.universaldetector import UniversalDetector
from collections import defaultdict
from .base_object import BaseObject
from itertools import tee
from glob import glob
import hashlib
import codecs
import types
import time
import json
import csv
import sys
import os
class UTF8Recoder:
"""
Python2.7: It... |
from django.contrib import admin
from . import models
from django.contrib.auth.models import User
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
# Register your models here.
class LivreAdmin(admin.ModelAdmin):
""" Classe indiquant l'affichage et les opérations possibles sur les
objets Livre d... |
from deck import Deck
from hand import Hand
class GameController():
def __init__(self, player_count):
self.game_deck = Deck()
self.game_deck.fill_deck()
self.game_deck.shuffle()
self.discard_deck = Deck()
self.player_hands = []
for _ in range(player_count):
... |
#!/usr/bin/python3
import sys
from datetime import datetime
import timeit
# Global variables
pwlist = []
result01 = 0
result02 = 0
# Functions
def part01():
global pwlist
global result01
sum = 0
for pwline in pwlist:
unique_pw = set()
for pw in pwline:
unique_pw.add(pw)
... |
import os
import scipy.io as sio
import DictionaryLearning.ODL as ODL
import set_params
import numpy as np
def dictionaryLearning(X):
k = set_params.k
clf = ODL.ODL(k, lambd=0.01)
dic, cof = clf.fit(X, verbose=True, iterations=10)
return dic, cof
def main(featurePath):
if not os.path.exists(fea... |
srcDir = "/srv/unmix-server/1_sources/RockBand-GuitarHero/"
destDir = "/srv/unmix-server/2_prepared/RockBand-GuitarHero/"
# Handle multitrackdownloads-alphanumeric
# This folder contains mogg files (sometimes directly in song folder, sometimes in subfolder).
# Take those and convert them with ffmpeg.
import subproc... |
# Generated by Django 2.2.4 on 2019-09-29 11:00
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('residents', '0003_resident_default_lot'),
]
operations = [
migrations.AlterField(
model_name='r... |
import logging
import logging.config
from pathlib import Path
logging.config.fileConfig(str(Path(__file__).parents[1] / 'config' / 'log.ini'))
def get_logger(logger_name):
return logging.getLogger(logger_name)
|
class Solution:
# @param A : integer
# @param B : integer
# @return an integer
def gcd(self, A, B):
if A == 0:
return B
else:
o = self.gcd(B%A , A)
return o |
#!/usr/bin/python2
import cgitb,cgi,commands,random
print "Contant-type:text/html"
print ""
cgitb.enable()
x=cgi.FieldStorage()
n=x.getvalue("num")
u=x.getvalue('uname')
p=x.getvalue('pas')
port=random.randint(6000,7000)
commands.getoutput("sudo systemctl restart docker")
print "<html>"
print "access your container ... |
import numpy as np
## aligning moment compliance test
data=[[0,0],[0.5401,13.7340],[1.0801,30.2148],[1.2463,41.2020],[1.5372,61.8030],[1.6203,75.5370],[1.9944,89.2710],[2.0774,103.0050]]
defl=data(:,1)
Nm=data(:,2)
nf=np.linspace(-100,100,21)
##fitting the data to a parametric curve
options = optimset('MaxFunEval... |
import setuptools
import versioneer
LONG_DESCRIPTION = """
**aospy**: automated gridded climate data analysis and management
A framework that enables automated calculations using gridded climate data.
Following some basic description of where your data lives and defining any
functions of variables stored in that dat... |
mail=input("Please, enter your maila address E.g (abc@def.com)")
referenceMail="ceng113@iyte.edu.tr"
if '@' in mail:
mail=mail.lower()
part1=mail.split('@')[0]
part1=part1.replace('.','')
part_2 = mail.split("@")[1]
mail = part1 + "@" + part_2
print(mail)
if mail == referenceMail:
pri... |
# Dependencies
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from bs4 import BeautifulSoup
# Use selenium to grab html on site (after waiting for site to fully load)
def get_html(url, wait):
print("\nStarting headless Firefox driver!")
print(f"Navigating to {url}")
p... |
import web_scrape as client
print client.get_property_by_zpid(83154148) |
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
from enum import Enum
from pants.util.osutil import get_normalized_arch_name, get_normalized_os_name
class PlatformError(Exception):
"""Raise whe... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2020-01-17 15:37
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('user', '0003_auto_20200117_1532'),
]
operations = [
migrations.AlterField(
... |
import logging
import logging.handlers
import appdirs
import os
log_dir = appdirs.user_log_dir('nab')
log_file = os.path.join(log_dir, 'log.txt')
def _init():
log = logging.getLogger("nab")
log.setLevel(logging.DEBUG)
log.propagate = False
formatter = logging.Formatter('%(asctime)s: %(levelname)s:\t'
... |
# ============LICENSE_START=======================================================
# Copyright (c) 2019-2022 AT&T Intellectual Property. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not... |
"""-----------------------------------------------------------
SpaCy :
Utterance classification with SpaCy
by comparing extracted tokens from sentences
--------------------------------------------------------------"""
import pandas as pd
import numpy as np
from preprocessing import *
from vectorization_spaCy im... |
"""Modoboa limits utilities."""
from . import constants
def get_user_limit_templates():
"""Return defined templates."""
return list(constants.DEFAULT_USER_LIMITS.items())
def get_domain_limit_templates():
"""Return defined templates."""
return list(constants.DEFAULT_DOMAIN_LIMITS.items())
def mov... |
import json,os
def modal():
a='''{% macro modal(id="myModal",body=None) %}
<button type="button" class="btn btn-primary" onclick="showmodal()">
Launch demo modal111
</button>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#{{ id }}">
Launch demo modal
</button>
<div cla... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.