index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
7,900 | 3b61d389eda85ddb4c96f93c977a33b91da579ce | import numpy as np
import pandas as pd
INPUT_FILE = 'data_full.csv'
data = pd.read_csv(INPUT_FILE)
data['date'] = pd.to_datetime(data['date'], format='%d-%m-%Y %H:%M:%S')
# Wyodrębnienie użytkowników i stron na jakie wchodzili do postaci <USER> [<SITES>]
data = data[['ip', 'address']]
data['sites'] = data.groupby(['i... |
7,901 | 7112348631bc60767bfb79c7f6966fc9189c522b | aes_key = 'eR5ceExL4IpUUY2lqALN7gLXzo11jlXPOwTwFGwOO3h='
|
7,902 | b6470ffda9040223951a99abc600ce1e99fe146b | from functions2 import *
import numpy as np
#from functions import TermStructure,load_data
import numpy as np
import math
from scipy import optimize
import pylab as pl
from IPython import display as dp
class Vasicek():
def __init__(self,rs,vol):
self.t = rs.columns
self.ps= rs[-1:]
self.... |
7,903 | ab79e2f9584dbbb526c62bde882a1bc9874b56f9 | from threading import Thread, Lock
from utils import reloj
import random
class Imprimidor(Thread):
def __init__(self, nombre, berlin, bolsa_dinero):
super().__init__()
pass
def run(self):
'''
Funcionalidad de iMPRIMIDOR que imprime dinero cada 5 minutos, cada
iteracio... |
7,904 | 023dc23a5e649c2fbbb45ff577dffa3b5d2aac64 | import weakref
from Qt import QtCore
from Qt import QtGui
from Qt.QtWidgets import QDoubleSpinBox
from Qt.QtWidgets import QSpinBox
from Qt.QtWidgets import QWidget
from Qt.QtWidgets import QSpacerItem
from Qt.QtWidgets import QPushButton
from Qt.QtWidgets import QComboBox
from Qt.QtWidgets import QLineEdit
from Qt.QtW... |
7,905 | 9fdcaf65f070b7081afd327442dd20e3284c71eb | #!/usr/bin/env python
"""This script draws a boxplot of each atom contribution to the cavity."""
import sys
if sys.version < "2.7":
print >> sys.stderr, "ERROR: This script requires Python 2.7.x. "\
"Please install it and try again."
exit(1)
try:
import matplotlib.pyplot as pyp... |
7,906 | 67452f31a49f50cdb2555406287b31e53a994224 | #!/usr/local/bin/python3
def printGrid(grid):
for row in grid:
print(row)
print("")
def validFormatting(grid):
if (type(grid) is not list):
return False
elif (len(grid) != 9):
return False
else:
for row in grid:
if (type(row) is not list):
... |
7,907 | 13c0af340c4fff815919d7cbb1cfd3116be13771 | ##############################################################################
#
# Copyright (c) 2003 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... |
7,908 | 84fb0e364ee3cd846148abfc9326f404f008c510 | # 내 풀이
with open("sequence.protein.2.fasta", "w") as fw:
with open("sequence.protein.fasta", "r") as fr:
for line in fr:
fw.write(line)
# 강사님 풀이
# fr = open('sequence.protein.fasta','r'):
# lines=fr.readlines()
# seq_list=list()
# for line in lines:
|
7,909 | 1292b894b75676abec3f97a8854fe406787baf1d | # -*- coding: utf-8 -*-
"""
Created on Fri Dec 30 22:01:06 2016
@author: George
"""
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 24 23:22:16 2016
@author: George
"""
import os
import clr
import numpy as np
clr.AddReference(os.getcwd() + "\\libs\\MyMediaLite\\MyMediaLite.dll")
from MyMediaLite import IO, RatingP... |
7,910 | efa94f8442c9f43234d56a781d2412c9f7ab1bb3 | # -*- coding: utf-8 -*-
"""
Created on Fri Nov 15 10:39:55 2019
@author: PC
"""
import pandas as pd
dictionary={"Name":["Ali","Buse","Selma","Hakan","Bülent","Yağmur","Ahmet"],
"Age":[18,45,12,36,40,18,63],
"Maas":[100,200,400,500,740,963,123]}
dataFrame1=pd.DataFrame(dictionary) ... |
7,911 | 196147d7b2b0cf7176b5baa50d7e7618f88df493 | import tensorflow as tf
import csv
from tensorflow.keras import layers
from tensorflow.keras.layers.experimental import preprocessing
import pandas as pd
import numpy as np
import random
import matplotlib.pyplot as plt
import math
def plot_loss(history):
plt.plot(history.history['loss'], label='loss')
plt.plot(his... |
7,912 | c01ea897cd64b3910531babe9fce8c61b750185d | import os
path = r'D:\python\风变编程\python基础-山顶班\fb_16'
path1 = 'test_01'
path2 = 'fb_csv-01-获取网页内容.py'
print(os.getcwd()) # 返回当前工作目录
print(os.listdir(path)) # 返回path指定的文件夹包含的文件或文件夹的名字的列表
#print(os.mkdir(path1)) # 创建文件夹
print(os.path.abspath(path)) # 返回绝对路径
print(os.path.basename(path)) # 返回文件名
print(os.path.isfi... |
7,913 | 65752c8ac50205df0fea105123935110e4a30aba | from math import pi
width = float(input("Enter the width of the tire in mm (ex 205): "))
aspectRatio = float(input("Enter the aspect ratio of the tire (ex 60): "))
diameter = float(input("Enter the diameter of the wheel in inches (ex 15): "))
approxVolume = (pi * (width ** 2) * aspectRatio * ((width * aspectRatio) + ... |
7,914 | c589ce4ba2ae60d14787a8939146f6140fff1f01 | import pygame
import random
from pygame.locals import *
import pygame
from pygame.locals import *
class GameObject(pygame.sprite.Sprite):
SIZE = 8
def __init__(self, x, y, surface):
super(GameObject, self).__init__()
self.x = x
self.y = y
self.surface = surface
... |
7,915 | fe406f40b48bf4982e7a48737b6b30514ae1fa71 | #Checks if all declared prefixes are used in the RDF File
import glob
import logging
import sys
import Utility as utility
import re
# set log level
logging.basicConfig(level=logging.INFO)
root_path = "../"
rdf_file_extension = {".ttl":"turtle", ".nt":"nt", ".rdf":"application/rdf+xml"}
regex_prefix = {".ttl": r'@pr... |
7,916 | 98dac1ea372f16ecdb818fbe3287ab7e51a0d67c | from sqlalchemy import literal, Column, String, Integer, ForeignKey
from sqlalchemy.orm import relationship
from common.db import Base
class Airplane(Base):
__tablename__ = 'airplanes'
id = Column(Integer, primary_key=True)
icao_code = Column(String(6), unique=True, nullable=False) # ICAO 24-bit identifi... |
7,917 | 0df20722fba6223c9d4fc9f72bfb399b479db6ac | o = input()
v = []
s = 0
for i in range(12):
col = []
for j in range(12):
col.append(float(input()))
v.append(col)
a = 1
for i in range(1, 12):
for j in range(a):
s += v[i][j]
a+=1
if o == 'S':
print("%.1f"%s)
if o == 'M':
print("%.1f"%(s/66))
|
7,918 | dd96b7f73c07bf0c74e6ce4dbff1a9cc09729b72 | from hicity.graphics.graphics import HiCityGUI
def GUI():
app = HiCityGUI()
app.mainloop()
if __name__ == '__main__':
GUI()
|
7,919 | ead843f1edcfe798613effb049e3ca79dcd03b71 | # Generated by Django 3.2.4 on 2021-07-18 02:05
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
('tracker', '0003_auto_20210626_0735'),
]
operations = [
migrations.CreateMod... |
7,920 | ee8bf681adcb07c4f79245c8f118131bbcabd2fa | num1 = input("첫 번째 실수 : ")
num2 = input("두 번째 실수 : ")
print(float(num1) + float(num2))
num1 = float(input("첫 번째 실수 : "))
num2 = float(input("두 번째 실수 : "))
print(num1 + num2)
|
7,921 | 786bc5d44115b46bd246e85e85c8f8c1f20737b9 | """config 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-based ... |
7,922 | f900e08c06ae736f5e32ac748e282700f9d0a969 | import datetime
import logging
from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional
from dagster import check
from dagster.core.utils import coerce_valid_log_level, make_new_run_id
if TYPE_CHECKING:
from dagster.core.events import DagsterEvent
DAGSTER_META_KEY = "dagster_meta"
class DagsterM... |
7,923 | a9b895e4d0830320276359944ca6fdc475fd144e | """
函数对象有一个__defaults__属性,是保存定位参数和关键字参数默认值的元组,
仅限关键字参数默认值在__kwdefaults__属性中,参数的名称在__code__属性中(__code__本身是对象引用,有很多属性)
使用inspect模块提取函数签名更加方便,很多框架和IDE都是以此来验证代码的
"""
def tag(name, *content, cls=None, **attrs):
""" 生成一个或多个HTML标签 """
if cls is not None:
attrs['class'] = cls
if attrs:
attrs_str = ''.join(' %s="%s"' ... |
7,924 | 670a23aa910a6709735281b7e64e5254a19277c6 | import datetime
import logging
import os
import requests
from bs4 import BeautifulSoup
import telebot
from azure.storage.blob import BlobClient
import hashlib
import azure.functions as func
def hash_string(input_string: str) -> str:
return hashlib.sha256(input_string.encode("utf-8")).hexdigest()
... |
7,925 | d514413c303dd174d8f56685158780a1681e1aba | # -*- coding: utf-8 -*-
"""
Created on Sat Nov 2 08:04:11 2019
@author: yocoy
"""
import serial, time
arduino = serial.Serial('COM7', 9600)
time.sleep(4)
lectura = []
for i in range(100):
lectura.append(arduino.readline())
arduino.close()
print(lectura) |
7,926 | f9d1013fa278b9078e603b012abbdde0be2e0962 | def del_ops3(str1, str2):
# find all common letters in both strings
common1 = [x for x in str1 if x in str2]
common2 = [x for x in str2 if x in str1]
if len(common2) < len(common1):
common1, common2 = common2, common1
# find total of strings with 0, 1, or 2 characters, (2 chars - only if c... |
7,927 | f819d1b1f2f6f3052247cda592007eac40aca37a | #!/usr/bin/env python3
# -*- coding: ascii -*-
"""
A script removing animations from SVG graphics.
"""
import sys, os, re
# etree fails utterly at producing nice-looking XML
from xml.dom import minidom
def process(inpt, outp):
def traverse(node):
for child in node.childNodes:
if child.nodeTy... |
7,928 | 86a15bb2e4d59fb5c8763fa2de31164beb327685 | import re
from xml.etree import ElementTree
def get_namespace(xml_path):
with open(xml_path) as f:
namespaces = re.findall(r"xmlns:(.*?)=\"(.*?)\"", f.read())
return dict(namespaces)
def get_comic_data(item, ns):
return {
"title": item.find("title").text,
"post_date": item.find("... |
7,929 | f7e2fc7b5420b90f733a9520b75555bd869cea98 | class TreeNode(object):
"""
Implementation of a TreeNode
A TreeNode is a Node with a value and a list of children. Each child is also
a TreeNode
Class invariants:
- self.value: The value for this TreeNode : Any
- self.children: The list of children for this Node : TreeNode List
"""
def __... |
7,930 | 61a58b934c6663e87824e4f9f9ffd92c3236947c | from django.db import models
class Link(models.Model):
text = models.CharField(max_length=100)
link = models.URLField()
def __str__(self):
return self.text
|
7,931 | bcb028bd25732e17ed1478e122ac3b2d1abf2520 | from __future__ import division
from pyoperators import pcg
from pysimulators import profile
from qubic import (
create_random_pointings, equ2gal, QubicAcquisition, PlanckAcquisition,
QubicPlanckAcquisition, QubicInstrument)
from qubic.data import PATH
from qubic.io import read_map
import healpy as hp
import ma... |
7,932 | 7a359d4b31bd1fd35cd1a9a1de4cbf4635e23def | """
Write a program that prompts for the user’s favorite number.
Use json.dump() to store this number in a file. Write a separate program that reads in this value and
prints the message, “I know your favorite number! It’s _____.”
"""
import json
file_name = 'supporting_files/favourite_number.json'
favourite_number = ... |
7,933 | 1e853d58c2066f3fbd381d0d603cd2fcece0cf15 | # Generated by Django 3.1.7 on 2021-05-05 23:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('travels', '0011_auto_20210505_2230'),
]
operations = [
migrations.RenameField(
model_name='trip',
old_name='hotel_de... |
7,934 | 16446c2c5612a14d4364cbefb949da0b473f7454 | import contextlib
import datetime
import fnmatch
import os
import os.path
import re
import subprocess
import sys
import click
import dataset
def get_cmd_output(cmd):
"""Run a command in shell, and return the Unicode output."""
try:
data = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDO... |
7,935 | 4758d6efde21e3b5d91f107188f24b6ddf7cbbe4 | import numpy as np
import tensorflow as tf
import math
from .. import util
def debug_inference(inference, dummy, entropy, cross_entropy, expected_log_likelhood):
dummy = tf.Print(dummy, [entropy], 'entropy: ')
dummy = tf.Print(dummy, [cross_entropy], 'cross_entropy: ')
dummy = tf.Print(dummy, [expected_log... |
7,936 | 27e685750e5caa2f80c5a6399b07435ee9aa9fb9 | """
Created on Feb 10, 2013
@author: jens
Deprecated module for crystallogrphy related geometry operations. And a lot
of other stuff that I put here.
"""
import numpy as np
atomtable = {'H': 1, 'He': 2, 'Li': 3, 'Be': 4, 'B': 5, 'C': 6, 'N': 7, 'O': 8,
'F': 9, 'Ne': 10, 'Na': 11, 'Mg': 12, 'Al': 13, '... |
7,937 | 703ed320e7c06856a0798d9c0de9aafe24458767 | from entities.GpsFix import GpsFix
class Visit(object):
"""
A Visit, which represents an arrival-departure to a stay point
Attributes:
id_visit: the id of the visit itself
id_stay_point: the id of the stay point
pivot_arrival_fix: the GpsFix that corresponds to real wo... |
7,938 | eed3ec2897d4da20b576cb4e2ce95331ae223f76 | #########
# Copyright (c) 2015 GigaSpaces Technologies Ltd. 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... |
7,939 | 66cc9ca3d8cbe9690da841e43cef217f3518122c | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import functools
import os
import platform
import sys
import webbrowser
import config
from pushbullet import Pushbullet
class Zui:
def __init__(self):
self.pb = Pushbullet(self.api_key())
self.target = self.make_devices()
self.dayone = confi... |
7,940 | 06aa2d261e31dfe2f0ef66dca01c1fe3db1ca94e |
import os, sys
top=sys.argv[1]
max=int(sys.argv[2])
cnts={}
for d, dirs, files in os.walk(top):
for f in files:
i=f.find(".")
if i ==-1: i=0
suf=f[i:]
rec=cnts.setdefault(suf, [0,0])
fn=d+'/'+f
if os.path.islink(fn):
sz=0
else:
sz=o... |
7,941 | 9c7ecd3c878d43633606439aa63f840176f20dee | # Library for Stalker project
#Libraries
import pandas as pd
import seaborn as sns
from IPython.display import Image, display
import matplotlib.pyplot as plt
# Google search
from googlesearch import search
# Tldextract to get domain of url
import tldextract as tld
# BeautifulSoup
from bs4 import BeautifulSoup as bs
f... |
7,942 | c3970ad8bddb1ca136724f589ff9088024157662 |
import logging
from common.loghdl import getLogHandler
from datastore.dbutil import DBSQLLite, getDSConnStr
#from utils.generator import random_password
#from datastore.dbadmin import DBAdmin
#from datastore.initevaldb import *
############################ TESTING TO BE REMOVED
# md = cfg
#def test_spetest(c... |
7,943 | 17326597d0597d16717c87c9bdf8733fb3acb77b | #! /usr/bin/python
import glo
print glo.x
a = "hello world"
print id(a)
a = "ni hao"
print id(a)
for y in range(0, 5, 2):
print y
for y in 1, 2, 3:
print y
if (glo.x == 2):
print("a==2")
else:
print("a!=2")
tuple_name = ("name", "age", "school") #can't modify, only-read
list_name = ["boy", "girl... |
7,944 | 8502ebdb13c68a9a56a1a4ba51370d8458ca81dc | #!/usr/bin/python
# -*- coding:utf-8 -*-
import importlib
def import_string(path):
"""
根据字符串的形式去导入路径中的对象
:param path: 'src.engine.agent.AgentHandler'
:return:
"""
module_path,cls_name = path.rsplit('.',maxsplit=1)
module = importlib.import_module(module_path)
return getattr(module,cls... |
7,945 | 24a538dcc885b37eb0147a1ee089189f11b20f8a | # import necessary modules
import cv2
import xlsxwriter
import statistics
from matplotlib import pyplot as plt
import math
import tqdm
import numpy as np
import datetime
def getDepths(imgs, img_names, intersectionCoords, stakeValidity, templateIntersections,
upperBorder, tensors, actualTensors, intersectionDist, b... |
7,946 | c355be4e05d1df7f5d6f2e32bbb5a8086babe95b | #5.8-5.9
users = ['user1', 'user2', 'user3', 'user4', 'admin']
#users = []
if users:
for user in users:
if user == 'admin':
print(f"Hello, {user}, would you like to see a status report?")
else:
print(f"Hello, {user}, thank you for logging in again")
else:
print("We need t... |
7,947 | ececcf40005054e26e21152bcb5e68a1bce33e88 | ' a test module '
__author__ = 'Aaron Jiang'
import sys
def test():
args = sys.argv
if len(args) == 1:
print('Hello World')
elif len(args) == 2:
print('Hello, %s!' % args[1])
else:
print('TOO MANY ARGUMENTS!')
if __name__ == '__main__':
test()
class Test():
count =... |
7,948 | f1eaba91e27dc063f3decd7b6a4fe4e40f7ed721 | #! /usr/bin python3
# -*- coding: utf-8 -*-
from scrapy import Request
from scrapy.linkextractors.lxmlhtml import LxmlLinkExtractor
from scrapy.spiders import CrawlSpider
from scrapy.spiders import Rule
from xici_bbs.spiders.author import get_author_item
from xici_bbs.spiders.comment import get_comment_list, get_comme... |
7,949 | cd9cc656a62728b3649b00c03ca8d05106015007 | from rest_framework import serializers
#from rest_framework.response import Response
from .models import Category, Product
class RecursiveSerializer(serializers.Serializer):
def to_representation(self, value):
serializer = self.parent.parent.__class__(value, context=self.context)
return ... |
7,950 | 2f76bcfde11597f87bb9e058f7617e95c78ed383 | # app/__init__.py
import json
from flask_api import FlaskAPI, status
import graphene
from graphene import relay
from graphene_sqlalchemy import SQLAlchemyConnectionField, SQLAlchemyObjectType
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import func
from flask import request, jsonify, abort, make_response
fr... |
7,951 | 8279c6d5f33d5580bef20e497e2948461a1de62c | # Authors: Robert Luke <mail@robertluke.net>
#
# License: BSD (3-clause)
import numpy as np
from mne.io.pick import _picks_to_idx
def run_GLM(raw, design_matrix, noise_model='ar1', bins=100,
n_jobs=1, verbose=0):
"""
Run GLM on data using supplied design matrix.
This is a wrapper function fo... |
7,952 | e492680efe57bd36b58c00977ecd79196501997a | threehome = 25 * 3
twotonnel = 40 * 2
alldude = threehome + twotonnel
print('%s Заварушку устроили' % alldude)
|
7,953 | 2bc0d76e17f2f52fce9cc1925a3a0e0f53f5b81d | from fractions import Fraction
import itertools
# With MOD
MOD = 10**9+7
def ncomb(n, r):
return reduce(lambda a, b: (a*b)%MOD, (Fraction(n-i, i+1) for i in range(r)), 1)
# No MOD
def ncomb(n, r):
return reduce(lambda a, b: (a*b), (Fraction(n-i, i+1) for i in range(r)), 1)
def comb(a, l):
return [subset ... |
7,954 | 6c91114e0c32628b64734000c82354105032b2fd | zi=["L","Ma","Mi","J","Vi","S","D"]
V=[]
for i in range(0,len(zi)):
x=input("dati salariul de: {} ".format(zi[i]))
V.append(int(x))
print("Salariul in fiecare zi: {}".format(V))
print(sum(V))
print(round(sum(V)/7,2))
print(max(V))
vMax=[]
vMin=[]
for i in range(0,len(zi)):
if V[i]==max(V):
... |
7,955 | 89db4431a252d024381713eb7ad86346814fcbe4 | from sklearn.svm import SVC
from helper_functions import *
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split
from sklearn.utils import shuffle
from sklearn.preprocessing import StandardScaler
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import glob
impor... |
7,956 | 53b6d30bf52c43daaebe8158002db1072e34f127 | from setuptools import setup, find_packages
setup(
name='spt_compute',
version='2.0.1',
description='Computational framework for the Streamflow Prediciton Tool',
long_description='Computational framework to ingest ECMWF ensemble runoff forcasts '
' or otherLand Surface Model foreca... |
7,957 | ca75e23d91eef8a5c5b78c0ea7c903b80640af25 | def fibonacci(n):
'''returns the nth number of the Fibonacci
sequence. where the first position is indexed at 0.
n must be an iteger greater than or equal to 0'''
#these are the first two numbers in the sequence.
fib = [0,1]
#If the users enters a number less than 2 then just get that number fr... |
7,958 | c65e14de297cc785b804e68f29bd5766ca7a8cf7 | # _*_ coding:utf-8 _*_
import csv
c=open(r"e:/test.csv","r+")
#read=csv.reader(c)
#for line in read:
# print line
read=c.readlines()
print read
c.close() |
7,959 | c62647b0b226d97926d1f53975a7aac7c39949d8 | '''This class contains a custom made format for printing complex numbers'''
class ComplexCustom(complex):
'''
This class contains function for
a custom made printing format for complex numbers
'''
def __format__(self, fmt):
'''This function creates a custom made format for printing complex n... |
7,960 | 710bb0e0efc2c4a3ba9b1ae85e1c22e81f8ca68e | from timemachines.skatertools.testing.allregressiontests import REGRESSION_TESTS
import time
import random
TIMEOUT = 60*5
# Regression tests run occasionally to check various parts of hyper-param spaces, etc.
if __name__=='__main__':
start_time = time.time()
elapsed = time.time()-start_time
while elapsed ... |
7,961 | d0287b057530883a50ad9c1e5e74dce10cd825b6 | """ Python Package Support """
# Not applicable
""" Django Package Support """
# Not applicable
""" Internal Package Support """
from Data_Base.models import School, Person, Child
"""
Data_Base/Data/Imports/child_import.py
Author: Matthew J Swann;
Yong Kin;
Bradon Atkins; and
... |
7,962 | 13a4fb5ce9ab0a3ef9ce503698615eae4157a637 | #!/usr/bin/env python
from cos_correct_v2 import *
from angle_to_position import *
import pandas as pd
import datetime as dt
def get_position_from_angle(razon, data, start, end):
# Obtain cos factors and corrected data
dni_df, altitude_angles, azimuth_angles = data
cos_correct_df = razon.get_cos_factors(... |
7,963 | 4453b8176cda60a3a8f4800860b87bddfdb6cafa |
# -*- coding: utf-8 -*-
"""
ORIGINAL PROGRAM SOURCE CODE:
1: from __future__ import division, print_function, absolute_import
2:
3: import os
4: from os.path import join
5:
6: from scipy._build_utils import numpy_nodepr_api
7:
8:
9: def configuration(parent_package='',top_path=None):
10: from numpy.distutils.... |
7,964 | fb16009985ee7fe4a467a94160f593723b5aaf03 | # -*- coding: utf-8 -*-
from django.http import Http404
from django.shortcuts import render,render_to_response, get_object_or_404, redirect, HttpResponse
from django.core.context_processors import csrf
from django.views.decorators.csrf import csrf_protect, csrf_exempt
from django.template import RequestContext,Context... |
7,965 | 3ee20391d56d8c429ab1bd2f6b0e5b261721e401 | from django.urls import path
from jobscrapper.views import *
urlpatterns = [
path('', home_vacancies_view, name="vacancy-home"),
path('list/', vacancies_view, name="vacancy"),
] |
7,966 | ba73562cd8ffa52a1fede35c3325e7e76a6dad54 | #!/usr/bin/env python
from __future__ import print_function
from types_ import SimpleObject, SimpleObjectImmutable, NamedTuple, SimpleTuple, c_struct
import timeit
import random
TYPES = [
SimpleObjectImmutable,
SimpleObject,
NamedTuple,
SimpleTuple,
c_struct,
]
a = 1035
b = b'\x54 - fo!'
c =... |
7,967 | 6c7162a9bd81d618abda204c24031c5a5acc61b4 | '''
@Description:
@Version: 1.0
@Autor: Henggao
@Date: 2020-02-20 16:17:05
@LastEditors: Henggao
@LastEditTime: 2020-02-20 16:32:45
'''
name = "henggao"
def change():
name = "Brill"
print(name)
print(locals())
print(globals())
change()
print(name) |
7,968 | 05a80a904548e90bea635469b94264f219062560 | def best_rank_selection(generation):
max_selected = len(generation) // 10
sorted_by_fitness = sorted(generation, key=lambda x: x.fitness, reverse=True)
return sorted_by_fitness[:max_selected]
|
7,969 | 931e73ffce6d24dbfb92501670245e20fc403a7a | # -*- coding:utf-8 -*-
from spider.driver.spider.base.spider import *
class LvmamaHotelSpider(Spider):
def get_comment_info2(self,shop_data):
params_list_comment1 = self.params_dict.get(ParamType.COMMENT_INFO_1)
comment_len = shop_data.get(FieldName.SHOP_COMMENT_NUM)
while(True):
... |
7,970 | 04867e8911f7cb30af6cefb7ba7ff34d02a07891 | #coding: utf8
import sqlite3
from random import shuffle
import argparse
def wordCount(db):
words = {}
for sent, labels in iterReviews(db):
for word in sent:
if word not in words:
words[word] = 1
else:
words[word] += 1
return words
def filt... |
7,971 | b297a09ee19bb8069eb65eb085903b3219c6fe5a | import math
import datetime
import numpy as np
import matplotlib.pyplot as plt
def draw_chat(
id, smooth_id, main_mode,
my_name, chat_day_data,
main_plot, pie_plot, list_chats_plot):
min_in_day = 1440
possible_smooth = [1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, 18, 20, 24, 30, 32, 36, 40, 45, 48, ... |
7,972 | ac32fb5fcd71790f9dbf0794992a9dc92a202c9b | 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))
|
7,973 | 8d5e652fda3fb172e6faab4153bca8f78c114cd1 | from datareader import *
import matplotlib.pyplot as plt
from plotting import *
from misc import *
import leastSquares as lsModel
import masim as mAvgSim
import numpy as np
import pandas as pd
import statistics as stat
from datetime import datetime as dt
from time import mktime
def main():
# scrape_data(pd.read_csv('... |
7,974 | 054d7e4bd51110e752a18a5c0af4432a818ef3b8 | __all__ = ["AddonsRepository", "Addon", "Addons", "Utils"] |
7,975 | 3c79c528cc19380af8f2883b9e35855e29b151a3 | #CartPoleStarter
import gym
## Defining the simulation related constants
NUM_EPISODES = 1000
def simulate():
## Initialize the "Cart-Pole" environment
env = gym.make('CartPole-v0')
for episode in range(NUM_EPISODES):
done = False
# Reset the environment
obv = env.reset()
... |
7,976 | a6f03340c2f60c061977fed6807703cdaeb1b7fd | #!/usr/bin/python3
#start up curses
import curses
HEIGHT = 24
WIDTH = 80
TESTING = True
curses.initscr()
stdscr = curses.newwin(HEIGHT, WIDTH, 0, 0)
curses.noecho() #don't echo keys
stdscr.keypad(1)
#function for displaying other players decision
#statement is the number of the other player's death funciton returne... |
7,977 | a801ca6ae90556d41fd278032af4e58a63709cec | # -*- coding: utf-8 -*-
import sys
import getopt
import datetime
import gettext
import math
import datetime
import json
import gettext
from datetime import datetime
FIELD_INDEX_DATE = 0
FIELD_INDEX_DATA = 1
def getPercentile(arr, percentile):
percentile = min(100, max(0, percentile))
index = (percentile / 10... |
7,978 | a2e00af84f743e949b53840ae6d5509e08935486 | from mcpi.minecraft import Minecraft
import random,time
while True:
x,y,z = mc.player.getTilePos()
color = random.randrange(0,9)
mc.setBlock(x,y,z-1,38,color)
time.sleep(0.01)
|
7,979 | 94286fc36e06598b9faa65d9e5759f9518e436c6 | import argparse
import requests
from ba_bypass_bruteforce import bruteforce, stop_brute, success_queue, dict_queue, success_username
from random import choice
from time import sleep
MAX_ROUND = 3 # 爆破的轮数
curr_round = 0 # 当前的轮数
sleep_time = 2 # 每一轮休眠的秒数
def login_limit_user():
"""
登录函数
"""
try:
... |
7,980 | fcccbc8d582b709aa27500ef28d86103e98eee4c | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
#
# This code is sample only. Not for use in production.
#
# Author: Babu Srinivasan
# Contact: babusri@amazon.com, babu.b.srinivasan@gmail.com
#
# Spark Streaming ETL script
# Input:
# 1/ Kinesis Data Strea... |
7,981 | ce7b7980d1e93f23e7e3ef048ddadc0c779ef9ce | import os
import telebot
bot = telebot.TeleBot(os.environ.get('TELEGRAM_ACCESS_TOCKEN',
'TOKEN'))
|
7,982 | 19ff064f8c27b9796eb435c7d2b9ebf87ee90ad6 | from time import strftime
from Stats.SQL.Compteur import compteurSQL
from Stats.SQL.Rapports import rapportsSQL
from Stats.SQL.Daily import dailySQL
from Stats.SQL.CompteurP4 import compteurJeuxSQL
from Stats.SQL.Historique import histoSQL, histoSQLJeux
from Stats.SQL.ConnectSQL import connectSQL
tableauMois={"01":"ja... |
7,983 | 160f272edd8283ea561552f22c71967db4a1660a |
# parsetab.py
# This file is automatically generated. Do not edit.
# pylint: disable=W,C,R
_tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'AND BREAK CHAR COLON COMA CTE_F CTE_I CTE_STRING DETERMINANT DIFFERENT DIVIDE DO DOUBLEEQUAL ELSE EQUAL FLOAT FROM FUNCTION ID IF INPUT INT INVERSA LBRACE LCORCH LOWERE... |
7,984 | 19949b07c866d66b3ef00b6a386bf89f03e06294 | ############################## Import Modules ##################################
import pandas as pd
import numpy as np
import re
from scipy import stats
import matplotlib.pyplot as plt
############################## Define Functions ################################
# generate list containing data of standard curve
de... |
7,985 | a5eb1f559972519dbe0f3702e03af77e61fbfb4e | #!/usr/bin/env python3
import sys
import re
from collections import namedtuple
def isnum(name):
return name.startswith('-') or name.isdigit()
class WireValues:
def __init__(self):
self.wires = {}
def __getitem__(self, name):
return int(name) if isnum(name) else self.wires[name]
def _... |
7,986 | 5bdc08b66916959d462314b8a6e5794e5fa12b55 | import os
import pathlib
import enum
import warnings
import colorama
import requests
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
import invoke
class MoleculeDriver(enum.Enum):
docker = 1
lxd = 2
vagrant = 3
class TestPlatform(enum.Enum):
linux... |
7,987 | f8635c815b375dc77e971d4ea0f86547215ab2f9 | __author__ = 'GazouillisTeam'
import numpy as np
import os
import sys
import time
from keras.callbacks import Callback
def save_architecture(model, path_out):
"""
Based on the keras utils 'model.summary()'
"""
# Redirect the print output the a textfile
orig_stdout = sys.stdout
# and store the... |
7,988 | 192e789129a51aa646a925fc4f8c3f8f4e14d478 | import datetime
from random import SystemRandom
import re
import string
import time
from django.db import models
from django.utils import timezone
from app.translit import translit
# Each model extends models.Model
class alumni(models.Model):
alumnus_id = models.AutoField(primary_key=True)
full_name = model... |
7,989 | e35dbcdef8779ffabc34b5e5c543e35b29523971 | #!/usr/bin/env python3
import pandas
from matplotlib import pyplot as plt
from sklearn.tree import DecisionTreeRegressor
from sklearn.ensemble import AdaBoostRegressor
import numpy as np
from sklearn.metrics import mean_absolute_error, mean_squared_error
from math import sqrt
def main():
df = pandas.read_csv("201... |
7,990 | b883e63c70f3dfeac3294989fab93c1331b6329c | import zipfile, re
f = zipfile.ZipFile("channel.zip")
num = '90052'
comments = []
while True:
content = f.read(num + ".txt").decode("utf-8")
print(content)
comments.append(f.getinfo(num + ".txt").comment.decode("utf-8"))
match = re.search("Next nothing is (\d+)", content)
if match == None:
... |
7,991 | 6e3de57f7c65e9f6195dabc3326b05744249cefe | # -*- coding: utf-8 -*-
"""Form content type."""
from briefy.plone.content.interfaces import IBriefyContent
from plone.dexterity.content import Container
from zope.interface import implementer
class IForm(IBriefyContent):
"""Interface for a Composite Page."""
@implementer(IForm)
class Form(Container):
"""A ... |
7,992 | b7be9fd366d03068a5d6c3cee703d579b9866fd3 | DEFAULT_SERVER_LISTEN_PORT = 2011
DEFAULT_CLIENT_LISTEN_PORT = 2012
import pickle
import socket
from player import Player
from averageddata import *
import zlib
import g
import pygame
from collections import defaultdict
from periodic import Periodic
import random
from projectile import Projectile
TICKTIME = 0.05
cla... |
7,993 | c7881c0d06600a43bdc01f5e464127c596db6713 | import unittest
from datetime import datetime
from models import *
class Test_PlaceModel(unittest.TestCase):
"""
Test the place model class
"""
def setUp(self):
self.model = Place()
self.model.save()
def test_var_initialization(self):
self.assertTrue(hasattr(self.model, "... |
7,994 | dffa5e2f34788c6f5a5ccc7d8375317a830288b5 | from microbit import *
import radio
radio.on()
# receiver will show the distance to the beacon
# the number of receivers should be easily adjustable
while True:
message=radio.receive_full()
# the stronger the signal the higher the number
if message:
strength = message[1]+100
displaystrength... |
7,995 | 96425986305171a9d23231f60b35dcbcbbd12d2d | from selenium import webdriver
import time
import xlwt
from JD_PhoneNo import get_phone_no
book = xlwt.Workbook(encoding="utf-8")
sheet1=book.add_sheet("Sheet 1")
browser = webdriver.Firefox()
browser.get("https://www.zomato.com/bhopal/dinner")
z_hotel_list = []
z_address_list = []
z_phone_list = []
z_rating... |
7,996 | a8e67ddbb741af6a9ff7540fef8c21468321ede0 | import argparse
import sys
import subprocess
import getpass
# Process arguments
parser = argparse.ArgumentParser(description='Setup a new apache virtual host on an Ubuntu system. Only tested on versions 18.04 and 20.04')
parser.add_argument('domain_name', metavar='D', type=str, nargs='+', help='domain name to give to ... |
7,997 | 8adda42dfebd3f394a1026720465824a836c1dd1 | import random
from turtle import Turtle
colors = ["red", "blue", 'green', 'peru', 'purple', 'pink', 'chocolate', 'grey', 'cyan', 'brown']
class Food(Turtle):
def __init__(self):
super().__init__()
self.shape("circle")
self.penup()
self.color("red")
self.speed("fastest")
... |
7,998 | f275085a2e4e3efc8eb841b5322d9d71f2e43846 | from graphics.rectangle import *
from graphics.circle import *
from graphics.DGraphics.cuboid import *
from graphics.DGraphics.sphere import *
print ("------rectangle-------")
l=int(input("enter length : "))
b=int(input("enter breadth : "))
print("area of rectangle : ",RectArea(1,b))
print("perimeter of rectang... |
7,999 | f3d34379cc7fbfe211eeebec424112f3da0ab724 | # -*- coding: utf-8 -*-
import tensorflow as tf
from yolov3 import *
from predict import predict
from load import Weight_loader
class Yolo(Yolov3):
sess = tf.Session()
def __init__(self, input=None, weight_path=None, is_training=False):
self.is_training = is_training
try:
self... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.