index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
984,600 | 1e6505e0a1f57a66f04b51ef9f4563f72ac0c13d | #!/usr/bin/env python
# Author: weikun
# Created Time: Mon 25 Mar 2019 10:17:01 AM CST
f = open('SUMMARY.md', 'r+')
infos = f.readlines()
f.close()
dirs=[]
dirHash = {}
curDir = None
curDirName = None
for info in infos[4:]:
info = info.strip('\n')
if info.startswith('###'):
curDir = []
curDir... |
984,601 | dd13238c5ce30f4f2ac72b90ef7d80d700e0e0c3 | #!/usr/bin/env python3
# coding utf-8
''''
# join 方法
from multiprocessing import Process
import time,os
def task():
# print('%s is running' %os.getpid())
print('%s is running ,parnt id <%s>' % (os.getpid(), os.getppid()))
time.sleep(3)
# print('%s is done' %os.getpid())
print('%s is done ,p... |
984,602 | 5d40e24476f2a68970b7664bef769cb3e6fa43dd | import matplotlib.pyplot as plt
import numpy as np
import random
import SimpleITK as sitk # For loading the dataset
import torch
import torch.nn as nn
from torch.utils.data import Dataset
import os
import math
def read_img(img_path):
"""
Reads a .nii.gz image and returns as a numpy array.
"""
retu... |
984,603 | 99ab9bac11918993f6e934fe67bc60944574930a | import logging
import shutil
import subprocess
import uuid
import jsonlines
from murakami.errors import RunnerError
from murakami.runner import MurakamiRunner
logger = logging.getLogger(__name__)
class DashClient(MurakamiRunner):
"""Run Dash tests."""
def __init__(self, config=None, data_cb=None,
l... |
984,604 | 323d6177a3d179e4725d44ad4ba11d261ef84b70 | """
This module implements a meter service.
A meter service reads a consumption value and sends it to a predefined broker.
The current implementation mocks the reading by generating a uniformly distributed value between 0 and 9000.
Author: Ludovic Mouline
"""
from __future__ import annotations
import logging
import t... |
984,605 | f6771d823414427cc59019fcb4ed5ee598c787cb | import sys
input=sys.stdin.readline
if __name__ == '__main__':
t=int(input())
for _ in range(t):
n=int(input())
num_list=[]
for i in range(n):
num_list.append(input().strip())
num_list.sort()
flag=False
for i in range(n-1):
length=len(n... |
984,606 | 0d4879b2036c554dce87753c28e55952a741f2e9 | from django.urls import path
from . import views
urlpatterns = [
#No paths for now
#path('api/',)
] |
984,607 | d2f1ae4c1ab73b7b5370a950dbf0e911650ab591 | # -*- coding: utf-8 -*-
# !/Library/Frameworks/Python.framework/Versions/3.5/bin/python3
from bs4 import BeautifulSoup
from urllib.request import urlopen
import re
def getText(base_url, til_url):
content = urlopen(base_url + til_url)
bsObj = BeautifulSoup(content, "lxml")
i = 0
record = False
for... |
984,608 | 2a37c5390f2a61ccf1478d6b5a8a6da9e4944e11 | """
This script can be run with pure "python". (pytest not needed).
"get_driver()" is from [seleniumbase/core/browser_launcher.py].
"""
from seleniumbase import get_driver
from seleniumbase import js_utils
from seleniumbase import page_actions
driver = get_driver("chrome", headless=False)
try:
driver.get... |
984,609 | b3014a6a1e58a98b26b30f1838f5459bb9cea1d7 | import requests
from requests import sessions
#不使用Session对象发送请求,其中set/cookies/Bill相当于向服务器写入一个名为name的Cookie,值为Bill
requests.get('http://httpbin.org/cookies/set/name/Bill')
#第二次发送请求,这两次请求不在同一个Session中,第一次请求发送的Cookie在第二次请求中是无法获取道德
r1 = requests.get('http://httpbin.org/cookies')
print(r1.text)
#使用Session,创建Session对象
sess... |
984,610 | 483937b7b8aec986ea8aa1793293e54a6fac4916 | while True:
n = int(input("ingresa un numero positivo: "))
if n > 0:
print(n)
break
else:
print("ingresa un numero positivo valido")
print("fin") |
984,611 | 4f0fa3649e71428f42b3c8debb0cc9229678de73 | #Program takes fresco .out output as its input and converts to just angle and angular cross-section
import sys
import matplotlib.pyplot as plt
# import matplotlib.axes.Axes as axes
def hasNumbers(inputString):
return any(char.isdigit() for char in inputString)
angle_list=[]
# cross_section_list=[]
b... |
984,612 | 9e58bdb66a6c7f161fdc44498ffa427ba586f703 |
import os
from ..log import NodeLoggingMixin
from ..http import HttpClientMixin
from ..basemixin import BaseGuiMixin
from ..widgets.image import BleedImage
from ..widgets.labels import ColorLabel
from ..widgets.image import StandardImage
from ..widgets.labels import SelfScalingLabel
from ..widgets.colors import Co... |
984,613 | e7ed0efc3bbe6978dc14b66d07ff0f5cf2f5368c | from django.contrib import admin
import models
ballroom_models = [
models.Level,
models.Style,
models.Dance,
models.Position,
models.Figure,
models.Routine,
models.Video,
models.Profile,
models.FigureInstance,
models.Annotation
]
admin.site.register(ballroom_models)
|
984,614 | 9034b64c0bb317a33ed9bab518e898f5517d19a3 | from bcrypt import hashpw, gensalt
class Message:
"""
Represents message in database
"""
def __init__(self, text, sender_id, recipient_id):
self.text = text
self.sender_id = sender_id
self.recipient_id = recipient_id
def send(self, cursor):
sql = 'INSERT INTO mess... |
984,615 | 128b84754c70b4278e80a5cb5ade6ad683806825 | import datetime
import os
import shutil
import tempfile
from contextlib import contextmanager
@contextmanager
def environment_append(env_vars):
unset_vars = []
for key in env_vars.keys():
if env_vars[key] is None:
unset_vars.append(key)
for var in unset_vars:
env_vars.pop(var, ... |
984,616 | cce36395a93b470ffb36c6bf0944e44e3282d927 | #!/usr/bin/env python3
"""
HOW TO USE THIS SCRIPT:
put this as an .autorun file in the root of the USB stick,
along with a file named zone-<X> where <X> is the id of the zone (0 to 3) to use.
(The file can be blank and should have no extension)
"""
import socket
import json
import time
from enum import Enum
from thre... |
984,617 | 41aa4c794eff96c2290a47756ce3a9a56d7728b5 | # Hill cipher! Works with any key matrix size, any modulus
from hill import *
# wiki expamples
# key = 'GYBNQKURP'
# msg = 'ACT'
key = [[6, 24, 1], [13, 16, 10], [20, 17, 15]]
msg = [0, 2, 19]
cipher = Hill(key, mod=26)
enc = cipher.encrypt(msg)
print(enc)
dec = cipher.decrypt(enc)
print(dec)
key = [[3, 3], [2, 5]]... |
984,618 | 789edd11d7eaeea757dc7d3c289ec8c4aab53f8c | """add whitelist table
Revision ID: b1d666d55f79
Revises: 71fa00181562
Create Date: 2021-02-21 00:41:21.425630
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'b1d666d55f79'
down_revision = '71fa00181562'
branch_labels = None
depends_on = None
def upgrade():
... |
984,619 | ac782d67e4bfe8ea19ad65178c87f00005bdee41 | #!/usr/bin/env python
#coding=utf-8
from pylab import *
from configobj import ConfigObj
import matplotlib.pyplot as plt
def display2Dpointset(A):
fig = plt.figure()
ax = fig.add_subplot(111)
#ax.grid(True)
ax.plot(A[:,0],A[:,1],'yo',markersize=8,mew=1)
labels = plt.getp(plt.gca(), 'xticklabels')
... |
984,620 | 1e431b3070502d500df59eeb2d81030c0a55785e | for i in range(100,1000):
a=i/100
b=(i%100)/10
c=(i%100)%10
if a**3+b**3+c**3==i:
print i
|
984,621 | 0b8bebd88417d46b03553d2a06f40201dd3c1293 |
from django.db import models
class NewsQueryset(models.QuerySet):
"""
"""
def news_for_week(self):
"""All news from website for week."""
raise NotImplementedError
def news_for_month(self):
"""All news from website for month."""
raise NotImplementedError
def n... |
984,622 | 993ffda4ac667d4c4e76b87b70eea290b7b73879 | """misc build utility functions"""
# Copyright (c) PyZMQ Developers
# Distributed under the terms of the Modified BSD License.
import copy
import logging
import os
import sys
from pprint import pprint
from shlex import quote
from subprocess import PIPE, Popen
from .msg import warn
pjoin = os.path.join
def customi... |
984,623 | 562205f6e653a044a030b192ee6d92e74cd37a88 | from torch.utils import data
from torchvision import transforms as T
from torchvision.datasets import ImageFolder
from PIL import Image
import torch
import os
import random
import pdb
class ImageFolder(data.Dataset):
"""Dataset class for the CelebA dataset."""
def __init__(self, image_dir, transform,mode):
... |
984,624 | b7ea4032aeb959124d3b9b7c724e5046a930d806 | from django.db import models
from tenant_schemas.models import TenantMixin
class Tenant(TenantMixin):
name = models.CharField(max_length=100)
auto_create_schema = True
# class Domain(DomainMixin):
# pass
|
984,625 | ddddc929e7993fb8f87d581cef2961f322b39cb5 | from .csmnet import CSMNet
__all__ = [
"CSMNet"
] |
984,626 | 32e4a2e74beead088e26dd373f42a30e68107645 | # @abrightmoore
# from numpy import *
from math import sqrt, tan, sin, cos, pi, ceil, floor, acos, atan, asin, degrees, radians, log, atan2
import os
import time
from random import randint, random, Random
import io
from io import BytesIO
import sys
from numpy import *
from PIL import Image, ImageDraw
fro... |
984,627 | b05b5b47e218579a8ae7a7484c5eef24c89bc3a3 | #!/usr/bin/env python3
import sys
numbers = sorted([int(x) for x in sys.stdin.readline().split(' ')])
d = {}
for k, v in zip('ABC', numbers):
d[k] = v
print(' '.join(['{}'.format(d[k]) for k in sys.stdin.readline().rstrip()]))
|
984,628 | e0df592a5d07c3a574990368c83349ea83534d30 | import json, urllib.request
from socket import error as SocketError
import errno
import datetime
# Retirve Json Data from Within API
mylist = []
today = datetime.date.today()
mylist.append(today)
currentDate = mylist[0]
url = "http://empisapi.accline.com/api/attendance/getattendancesbydate?date={}&deptId=0&desigId=0"... |
984,629 | 5e66dbd36ae6e73c64012ac09d964db2e822afbd |
A = [[1,2,3],
[4,5,6],
[7,8,9]]
B = [[5,8,1,2],
[1,2,6,8],
[4,5,9,1]]
result = [[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0]]
for i in range(len(A)):
for j in range(len(B[0])):
for k in range(len(B)):
result[i][j] += A[i][k... |
984,630 | 082d4ae47d23d812f69f9640bc0747ce49770724 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2012 Yahoo! Inc. All Rights Reserved.
# Copyright (C) 2012 New Dream Network, LLC (DreamHost) All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the Licens... |
984,631 | c5f5668883747e3bda4da0f7d2608dd1862e9fd4 | from .models import *
from .forms import StopCreateForm
from django.shortcuts import render, redirect
from django.http import HttpResponseRedirect
from django.contrib.auth.decorators import login_required
from django.contrib import messages
def stop(request, slug):
s = Stop.objects.filter(slug=slug).first()
... |
984,632 | 2bb80eca9e1ea7dc5742973b822d68e6ae88ff31 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math
# 空函数
def nop():
pass
def my_abs(x):
if not isinstance(x, (int, float)):
raise TypeError('bad operand type')
if x >= 0:
return x
else:
return -x
def move(x, y, step, angle=0):
nx = x + step * math.cos(angle)
... |
984,633 | a3193bce83ccc5722163ffad89c8da58a481d511 | '''
Created on 16-Oct-2018
@author: Vishnu
'''
from VoiceAuthentication.Features import mfcc
from sklearn.externals import joblib
import os
from sklearn.neighbors import LSHForest
from sklearn.metrics import pairwise_distances_argmin_min
path = os.getcwd() + '/VoiceAuthentication/VoiceAuthentication'
def predict(lo... |
984,634 | ac545b03a52e233a3c0168eee7625b94ca08d3ee | """
Helper functions for displaying data and making interactive plots.
"""
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
import ipywidgets as widgets
from IPython.display import display, clear_output
import cmocean
import cartopy.crs as ccrs
from cartopy.mpl.ticker import L... |
984,635 | 14327fc566f97fb27448fae3efb1021383990568 | #!/usr/bin/python3
"""
# -*- coding: utf-8 -*-
# @Time : 2020/8/28 17:42
# @File : pre_process.py
"""
import torchvision
from torchvision import transforms
from torchtoolbox.transform import Cutout
def normal_transform():
normal = torchvision.transforms.Compose([
torchvision.transforms.ToTensor... |
984,636 | 3a18c727e48c2742c065bf528f8e49961b393d26 | t#/usr/bin/python3
if __name__ == '__main__':
print("This is a package , please import it into your code")
|
984,637 | 40795ca7cb66724997c3fa0bcfaf59f5dcf86db1 | # Generated by Django 3.1.7 on 2021-04-20 07:53
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('blog', '0002_auto_20210420_1019'),
]
operations = [
migrations.AddField(
m... |
984,638 | 7c1db888d6df7dd87417a209251712d4c52aebeb | """ Test Gemini Astroquery module.
For information on how/why this test is built the way it is, see the astroquery
documentation at:
https://astroquery.readthedocs.io/en/latest/testing.html
"""
from datetime import date
import json
import os
import pytest
import requests
from astropy import units
from astropy.coordin... |
984,639 | 463c066c7583e72989a35eec3ce22b55fda4b78c | import sys, os
sys.path.append('./gen-py')
from thrift import Thrift
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
from services import HelloFriend
from services import FileResourceService
from server import Server
SERVICE_TIMEOUT_IN_mS = 3... |
984,640 | 972a02dd915e121dfa16c96ebef1726f9aa1edd5 | # Generated by Django 2.1.7 on 2019-02-22 23:50
import django.contrib.gis.db.models.fields
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='NaicsCodesData',
... |
984,641 | fa8b6b3906370e1efe689f4d5ad950f092b5e986 | # -*- coding: utf-8 -*-
"""
Created on Sun Feb 2 23:46:43 2014
@author: cbeery
"""
# grid prints a n by n grid of box such that pipes
# and hyphens form walls and plus signs form corners
# input: sidelength, this is the number of boxes
# form one side of the grid;
# assumes non-negative integer
# ... |
984,642 | 631494313922fb6098d9c110fae98a8d199ce4e0 | # -*- coding: utf-8 -*-
from mustaine.client import HessianProxy
import urllib2
import json
proxy = HessianProxy('http://webservice.build.index.com:9011/webservice/3gcms')
class DocFetcher:
def fetchDoc(self, channelid, ftime, ttime, offset, size):
return proxy.get3GArticles(channelid, ftime, ttime, offset, s... |
984,643 | da4535c6b677c8fe2bd83675d58c16bb79987f8c | from social_core.backends.facebook import FacebookOAuth2
from . import BaseBackend
from ...site import AuthenticationBackends
class CustomFacebookOAuth2(BaseBackend, FacebookOAuth2):
DB_NAME = AuthenticationBackends.FACEBOOK
|
984,644 | bef50526bf4691760d960bf70ac5ffd67ea6457e | __author__ = 'frieder'
import random
import EventController
class Node:
def __init__(self,id,samplingRate,location = "Santander",):
self.samplingRate = samplingRate
self.id = id
self.location = location
self.type = "Random Generator Source Node"
def getSensorValu... |
984,645 | deb545d02eb0f7c9690ae10ade0e1569eb6717f9 | # coding=utf-8
from pymongo import MongoClient
import pymongo
import json
from bson.objectid import ObjectId
client = MongoClient("192.168.8.200:27000")
target_db = client['single_cluster']
target_collection = target_db['clusters']
def move_to_one_collection():
db = client['cluster_demo']
collection_name_li... |
984,646 | 96e24924aff6bb89b275925660470b3543b80e1a | import logging
from typing import Optional, Iterable
from . import View
from . import Model
from . import Statement
log = logging.getLogger(__name__) # pylint: disable=C0103
class Query:
def __init__(self, view: View, statements: Optional[Iterable[Statement]] = None):
log.debug('Query.__init__')
... |
984,647 | b1d8b8a4899011ffaf577a2db2e4c8944735dcbe | import context
from src.petsittingco.application import db
from src.petsittingco.database import Account, Pet, Job
from werkzeug.security import generate_password_hash
acc1 = Account(id = "1", is_owner = True, is_sitter = False, is_shelter = False, is_admin = False, first_name = "John", last_name = "Smith", email = "JS... |
984,648 | 2aba5fe2acd1ece04c7b678ac465b331759b1be4 | def dfs(nums, path, result):
if (len(nums) == len(path)):
result.append(path[:])
return
for n in nums:
if n in path:
continue
path.append(n)
dfs(nums, path, result)
path.pop()
def permute(nums):
res = []
if not nums:
return res
df... |
984,649 | 2b438825c5d7d8c2093089a08a273a76bf39f916 | from tkinter import *
import tkinter.messagebox
import time
import random
import winsound
window = Tk()
window.title ("Space Shooter")
img1 = PhotoImage(file="ship.png")
img2 = PhotoImage(file="missle_purple.png")
img3 = PhotoImage(file="missle_red.png")
points = 0
def play_shoot():
winsound.PlaySound('shoot.w... |
984,650 | 195ac59bfa651482b6536e017ca8fecd5c2672ac | """blogengine 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-ba... |
984,651 | bcd4d87f73f6c1686ba3dd3448bcf6cf8e29aee3 | # -*- encoding: utf-8 -*-
import datetime
import os
from django import template
from django.template import Node, resolve_variable, TemplateSyntaxError
from django.conf import settings
from djtrac.utils import url_params
register = template.Library()
@register.filter
def to_datetime(t):
"""
:param t: время в ... |
984,652 | fc05c7b235f4c1351d74eae9c791ec5f19f81b18 | print("Twinkle, twinkle, little star,")
print('\t',"How I wonder what you are!")
print('\t','\t',"Up above the world so high,")
print('\t','\t',"Like a diamond in the sky.")
print("Twinkle, twinkle, little star,")
print('\t',"How I wonder what you are")
import sys
print("Python version")
print (sys.version)
from date... |
984,653 | 2654a7ec81b56b625d128a4748840c2552f0905d | vel = float(input('Informe a velocidade do carro em Km/h'))
if (vel > 80):
print('Você foi multado')
vel -= 80
print('Sua multa é de R${:.2f}'.format(vel * 7.00))
else:
print('Dirija com segunça')
print('Siga em frente') |
984,654 | 4921c9045a7e6deb0138c957aeea75cafe02609d | #!/usr/bin/env python
import cProfile
import pstats
from subprocess import PIPE, Popen
import numpy as np
from lmfit import Parameters, minimize
def get_git_version():
proc = Popen(['git', 'rev-parse', '--short', 'HEAD'], stdout=PIPE)
return proc.communicate()[0].strip()
# define objective function: retu... |
984,655 | 8fb96b150a4b0d1e35a78b465f3388c6c00b3211 | import pandas as pd
dic = {"สมศรี":167, "พิมพ์พร":170, "สุดใจ":165, "สมหญิง":164}
ps = pd.Series(dic)
print("------------------------------------")
print(type(dic))
print(ps)
|
984,656 | 8b49e70d5ced861c1743d9efb0a3a0d6afa8ebf9 | class Solution:
def maxSubArrayLen(self, a: List[int], k: int) -> int:
g = {0 : -1}
s = 0
z = 0
for i in range(len(a)):
s += a[i]
if s - k in g:
z = max(z, i - g[s - k])
if s not in g:
g[s] = i
return z |
984,657 | 1d8e5b09475a2d32b31e39b0deba80dae38a7bd2 | #!/usr/bin/env python
import unittest
class MyTest(unittest.TestCase):
base_url = "http://139.196.43.67:8080/"
# def setUp(self,url):
# self.base_url = "http://139.196.43.67:8080/"
# return self.base_url
def tearDown(self):
print(self.result)
|
984,658 | 81d9feafebe97ac6330ec2b6e70e47a8cdcb4494 | import user
from models import UserProfile
from django.shortcuts import render, render_to_response
from forms import UserForm, UserProfileForm
from django.contrib.auth import authenticate, logout
from django.contrib.auth import login as auth_login
from django.http import HttpResponseRedirect, HttpResponse
from django.t... |
984,659 | af28eb8a2fcd2774fd9070e086aef35bf81093ad | """An example of how to use your own dataset to train a classifier that recognizes people.
"""
# MIT License
#
# Copyright (c) 2016 David Sandberg
#
# 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 Sof... |
984,660 | 0e0acdfa9ae36d4cd96cc142acd6ac785870a59d | import sys
tempdict={}
filename=open(sys.argv[1],"r")
lines=filename.readlines()
filename.close()
counter=0
for i in lines:
i=i[:-1]
words=i.split(" ")
numberofwords=len(words)
for a in words:
for b in words:
for c in words:
if (a!=b and a!=c and b!=c)... |
984,661 | 94b7f06265514622c10aef167084953302a67b28 | from aocd.models import Puzzle
puzzle = Puzzle(year=2022, day=2)
abc_map = {"A": "R", "B": "P", "C": "S"}
score_map = {"R": 1, "P": 2, "S": 3}
how_to_win_map = {"R": "P", "P": "S", "S": "R"}
how_to_lose_map = {"R": "S", "P": "R", "S": "P"}
def get_total_score(inp):
total_score = 0
for line in inp.split("\n"... |
984,662 | 50e1e34495204121c8796fb9288e2f3519274b8a | def leiaint(mensagem):
ok =False
valor = 0
while True:
numero = str(input(mensagem))
if numero.isnumeric():
valor = int(numero)
ok = True
else:
print("\033[0:31mErro! Informe um numero inteiro valido.\033[m")
if ok:
break
re... |
984,663 | 0d9584c8ea15ccdb12462f4d917f01445b7758db | from django.db import models
from django_extensions.db.models import TimeStampedModel
# Create your models here.
class Position(TimeStampedModel):
id = models.AutoField(primary_key = True)
lng = models.FloatField(null=False,blank=False,max_length=50)
lat = models.FloatField(null=False,blank=False,max_length=50)
def... |
984,664 | 659e4aaf0ef2cdc4f04a3b5fcf238ad76f5a0d76 | #!usr/bin/python
# encoding: utf-8
__all__ = ['Record','RecordCollection','FileReader','Stats']
from constants import *
# 03001 10 11 12 13 26 28 11 10307806 0 0 898744 1 2003-2-20 2003-2-23
class Record:
def __init__(self,parts):
self.__init(parts)
self.__stats()
#print self.str()
#print self.stats_str(... |
984,665 | c9600fbea1ebd68a2e6337d00133aa78b90c5fb5 | import ast
from cgi import log
import requests
import telebot
import constants1 as constants
from telebot import types
from choice import choice_main, location_search, users_count
sm = u'\U0001F603'
sm1 = u'\U0001F601'
bot = telebot.TeleBot(constants.token)
@bot.message_handler(commands=['help'])
def... |
984,666 | c7f211e67a8d26e5946fdcc0d7b6ea3f02e58705 | params = {
'vocab_size': 15000,
'embed_dim': 100,
'dropout': 0.5,
'pad_len': 200,
'pad_type': 'post',
'batch_size': 64
}
|
984,667 | 17c7dffe18074974ea764e0387d397e7ed63a831 | #!/usr/bin/env python3
# -*-encoding: utf-8-*-
# author: Valentyn Kofanov
import docx
from docx.shared import RGBColor
def main(filename_input, filename_output, c1=RGBColor(255, 0, 0), c2=RGBColor(45, 50, 0)):
doc1 = docx.Document(filename_input)
doc2 = docx.Document()
for paragraph in list(doc1.par... |
984,668 | 788ebd9ce180618da5e9415d8613d16a5ff45437 | import matplotlib.pyplot as plt
import numpy as ny
import math
import os
from math import sqrt
import time
import operator
import random
import sys
from collections import deque
def pearsoncor(X, Y, code = 0):
"""
Computes pearson's correlation coefficient.
code
0 - using deviations f... |
984,669 | 9a79ffeba0077b0ff8e01def70ba94ac06e147e0 | from PyGMO.problem import base as base_problem
from PyKEP import epoch,DAY2SEC,planet_ss,MU_SUN,lambert_problem,propagate_lagrangian,fb_prop, AU, closest_distance
from math import pi, cos, sin, acos
import math
from scipy.linalg import norm
from gtoc6 import europa, io, JR, MU_JUPITER
import numpy as np
from numpy impo... |
984,670 | 79b1f02be4171c517d1ac21c107213d28eee37dc | import calendar
from typing import Dict
from collections import namedtuple
from db_tools.database import Encounter
from .tools import safe_get_value, safe_get_date, BaseProcess, ConvertException
day_stat = namedtuple('day_stat', ['day', 'visit_amount'])
class EncounterProcess(BaseProcess):
_model = Encounter
... |
984,671 | 445e32998a1dede6891e64a9c24b6c23c462d90a | import time
import random
def selection_sort(arr):
for k in range(len(arr)):
min = k
j = k
while j < len(arr)-1:
j +=1
cur = j
if (arr[cur]<arr[min]):
min = cur
if min != k:
temp = arr[k]
arr[k] = arr[min]
... |
984,672 | c7cc02a5fea295a2cc79fa33f463f22314f2bcb5 | list2 = [1,2,3,4,5]
list1 = [1,2,3,4,5,6]
print "modulo", 9%9
result = all(elem in list1 for elem in list2)
if result:
print("Yes, list1 contains all elements in list2")
else :
print("No, list1 does not contains all elements in list2")
if str(list2[-1]) != str(4):
print "test"
def stringToList(string... |
984,673 | dc9c4ecb51fe3487a22dafe32ff78f1e9d9b7761 | import postgresql
file_name = 'tablStudent.txt'
db = postgresql.open("pq://postgres:G24O02d24230303@127.0.0.1:5432/my_db")
tablStudent = db.prepare("select * from tstudent")
print('TablStudent :')
with db.xact():
with open(file_name,'w', encoding = 'UTF-8') as f:
for row in tablStudent:
... |
984,674 | ff92ee5ec72c016ab07b1c58b10157dc66fab85b | #!/usr/bin/env python3
n = int(input())
s = n * (n+1) * (2*n+1) // 6
print (s) |
984,675 | 24be4f01491259ebf483b2e70e458774b26d0d12 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... |
984,676 | a12c5cf31ccbf8b3ed3b2ab19343fbbffa6fe857 | import numpy as np
l = [ [5, 6, 9, 10, 11], [ 1, 2, 3, 5, 6 ] ]
print( l, type(l), len(l) )
arr = np.array( l )
print( f"arr = { arr }", type( arr ), len( arr ), arr.shape )
print( f"arr[0] = { arr[0] }" )
print()
print( "Printing Numpy Array in the loop" )
for i in arr:
print( f"i : { i }", end=' and ... |
984,677 | 149547a1382999b470dc3dccc945bbe62688c309 | import pytest
import re
import os
import sys
import shutil
from pathlib import Path
from io import StringIO
from ast import literal_eval
from launch_multiple_simulations import Launcher
import institutionevolution.filemanip as fman
from institutionevolution.population import Population as Pop
from files import INITIALI... |
984,678 | 65fd328e5252379e333368c6250a60e681360a80 | from flask import render_template, url_for, flash, redirect, request, abort
from app.models import User, Post
from app.forms import RegistrationForm, LoginForm, UpdateAccountForm, PostForm
# ! here inport bcrypt not Bcrypt
from app import application, db, bcrypt
from flask_login import login_user, current_user, logout_... |
984,679 | 5bffe1c3669850ebeaf6904b1c9a9cfa85d8d752 | import pandas as pd
import shutil
import openpyxl
from module.globals import *
import module.forms_maker._0420502_SCHA as scha
import module.forms_maker._0420502_Rasshifr as rf
import module.forms_maker._0420502_Podpisant as pp
import module.forms_maker._0420502_Zapiski as zap
import module.forms_maker._0420503_Priros... |
984,680 | b47a845ca2700fa9a5a5a0d23848116cf68647d7 | from django.shortcuts import render
from django.shortcuts import redirect
from django.shortcuts import get_object_or_404
from .models import Post
from .models import Tag
from django.views.generic import View
from .forms import TagForm
#from django.http import HttpResponse
# def post_list(request):
# return HttpRespo... |
984,681 | 44df75a01199a3b1233dd0141695b34e7ca2f22c | import os
from django.shortcuts import render, redirect
from django.http import HttpResponse, HttpResponseRedirect
from django.template.loader import render_to_string, get_template
from django.contrib.auth.decorators import login_required
from django.contrib.auth import logout
from django.contrib import messages
from d... |
984,682 | 306ecde3283170cfec0529dbd042fff156ad7927 | class TicTacToe:
def __init__(self):
self.xTurn = True
self.turn_count = 0
self.win_flag = False
self.quit_flag = False
self.game_pieces = ['X', 'O']
self.coordinates = {"a1": 0, "b1": 1, "c1": 2, # The coordinates and their respective move_list indices
... |
984,683 | f53cfad3d8a33d2c2a4b408c870a46d75ee3942f | """
Term rewriting systems
"""
import functools
from functools import reduce
from collections import namedtuple
import types
__all__ = ['MODULES', 'Var', 'Term', 'Rule', 'RULES_DB']
MODULES = {}
RULES_DB = []
class Var(str):
"""Representation of term variables"""
class Term:
"""Representation of terms."""... |
984,684 | 90e822718e02692fc07b4a7a5773647c9438dc7a | #!/usr/bin/env python
import os,sys
import optparse
import fileinput
import commands
import time
import glob
import subprocess
from os.path import basename
import ROOT
if __name__ == "__main__":
usage = 'usage: %prog [options]'
parser = optparse.OptionParser(usage)
parser.add_option ('-f', '--fed', des... |
984,685 | bbad9b431d23884bf7d1faea5d33ffc287834a7d | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import glob
import os
import tensorflow as tf
import io
from util import Vocab
import pickle
import random
__author__ = 'Jaycolas'
FILEPATH='./dataset/email'
input_fname_pattern='*.txt'
TRAIN_TFRECORD_FILE = os.path.join(FILEPATH, 'train.tfrecords')
DEV_TFRECORD_FILE = os.pa... |
984,686 | 63ae889f460df3048fb8d2b5b6121c4cea959a3c | import main_class_based_backup as main
import os
import ConfigParser
import time
r = '\033[31m' #red
b = '\033[34m' #blue
g = '\033[32m' #green
y = '\033[33m' #yellow
m = '\033[34m' #magenta
c = '\033[36m' #magenta
e = '\033[0m' #end
#obj=main()
class Driver_main():
def __init__(self):
self.NmapScanObj=main.NmapSca... |
984,687 | 6fd1078d7863b3f2a5e7eee6ec4ced674cca3bd4 | import logging
import traceback
class base_config_generator(object):
"""
The config generator determines how new configurations are sampled. This can take very different levels of
complexity, from random sampling to the construction of complex empirical prediction models for promising
configurations.
"""
def __i... |
984,688 | 00cc7d5e725f019d5d4d919cdc286b707f93186c | #!/usr/bin/env python2
import os
import time
import ConfigParser
import selenium.webdriver as webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import TimeoutException
from selenium.common.exceptions import ElementNotInteractab... |
984,689 | 439298e56eb116dcd735809496ab6d2103d79a37 | """
File Name : sessionManager.py
File Owner : Nabanita Dutta
Description : This files defines the classes and methods for creating,
maintaining and tearing session for remote amd local shell.
History :
Modified By Version Date ... |
984,690 | f19cb3023d4602ba2791a508697a3721189cde18 | import os
from os import system
from time import sleep, time
import socket
import math
from math import sin, cos
from socket import error as socket_error
import errno
import sys
import cv2
import numpy as np
from fractions import Fraction
import startracker
import beast
import ctypes
import serial
import struct
######... |
984,691 | 5482f62d157f9d5656f09ae7dbb10243096e0ff7 | person = {
'first_name': 'Tony',
'last_name': 'Macaroni',
'age': 29
}
print('first_name in person?', 'first_name' in person)
print('Tony in person?', 'Tony' in person)
|
984,692 | 70f13183249cf55c4c721e971e455cdd07e1e907 | import random
res_path = "/home/swante/downloads/"
test_lines = [line.strip() for line in open(res_path + "input.txt")]
random.seed(1)
def input():
global test_lines
res = test_lines[0]
test_lines = test_lines[1:]
return res
# =======================
import sys, math, fractions
possible, impossibl... |
984,693 | 069aa472db40e03188d2b3a20b4723849dc2e2bf | import datetime
import logging
import os
import time
from typing import List
import dotenv
import requests
from utils import hyphenate_citizen_id
dotenv.load_dotenv()
AIRTABLE_API_KEY = os.environ.get('AIRTABLE_API_KEY')
AIRTABLE_BASE_ID = os.environ.get('AIRTABLE_BASE_ID')
AIRTABLE_TABLE_NAME = "Care%20Requests"
A... |
984,694 | 97e7a7b64415a382384e01e61eb2add5b94dedf0 | from django.shortcuts import render
from django.shortcuts import get_object_or_404
from catalog.models import Product
from .cart import Cart
from django.http import HttpResponse
import json
def cart_add(request):
cart = Cart(request)
product_id = request.GET.get('product_id', None)
product = Product.obje... |
984,695 | 2692ad6e5904438d7e6048e383ed2158f15fdff5 | from pprint import pprint
import json
projects_map = {}
class Project:
def __init__(self, val):
super().__init__()
self.val = val
self.neighbours = []
self.dependencies = 0
def add_dependency(self, project):
self.neighbours.append(project)
pro... |
984,696 | f6d473411fd4f9f6cf638c20b193478dbeb8564e | # Generated by Django 2.2.6 on 2019-10-28 14:15
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('sport', '0002_auto_20191028_1414'),
]
operations = [
migrations.RemoveField(
model_name='sportsman',
name='gym_name',
... |
984,697 | cdfca714634519f51b9a6bc4fcd64035829f6954 | from .decode import decode
from .splice import Splice
from .stream import Stream
|
984,698 | cbb58be457aae937cb2af13dbd85694e1d166389 | #!/usr/bin/python
"""
Print the directed network graph for a given EPUB ebook.
The output, printed to stdout, is in graphviz (dot) format.
The nodes are the spine items, identified by their manifest id.
The black arcs are direct links between content documents,
the red arcs show the spine progression.
"""
# standa... |
984,699 | 46c71974aaf549d8119b61ae9d3e973f6ab95ecb | # Criar objeto do submarino com atributos de posição:
# Criar movimentos
# Se movimento for igual a 'R', então some 1 ao x
# movimento = input
# movimento dividir por letras
# loop for letras com as funicções de movimento
#Class submarine, with position parameters
class Submarino:
def __init__(self, x=False, y=... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.