index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
998,100
6c04350a6741a594e2c05972af8a5bc262792336
# -*- coding: utf-8 -*- # Copyright 2019 ICON Foundation # # 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 ...
998,101
348fcd3f0350f21fd10f946e1b0d7136e42e4b48
from scrapy import Spider from scrapy.selector import Selector from get_weather.items import GetWeatherItem from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support i...
998,102
dfe95e5ecb3d46313d55d7bfa9092e563ea1e020
from compute_ghcm_mdt_one_user import compute_ghcm_mdt_one_user as cgou cgou(4)
998,103
d02154b27da930bcdac29cf5b093577ccd1c3b53
from HMM_helper import * from HMM import * from makeRhymeDic import getRhymeDicShakes import random import numpy as np # Parse the text file f = open('data/shakespeare.txt') obs, obs_map = parse_observations(f.read()) f.close() X = obs # Parse the A and O matrices A = np.loadtxt('HMM_A.txt') O = np.load...
998,104
09e92db174c24f1bcb49b24af31470604cc389da
import heapq from options import Options from tile import Tile from drop import Drop class AStar: NSEW = -Options.tiles_x, Options.tiles_x, 1, -1 # Add to find tile in a direction def __init__(self, zombie, survivor): for tile in Tile.opens: # Reset from last search tile.pa...
998,105
4db2157789ca6feab0754681966c1433aedf8193
import FWCore.ParameterSet.Config as cms process = cms.Process("MyAnal") process.load("Configuration.StandardSequences.Geometry_cff") process.load("RecoJets.Configuration.CaloTowersES_cfi") process.load("FWCore.MessageService.MessageLogger_cfi") process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1...
998,106
483807fc64e55f4a625bf21922aed528b2747954
# This example sets a weight of 1.0 for all clones of the active Cloner object import c4d from c4d.modules import mograph def main(): # Aborts if no active object or if it is not a Cloner if op is None or op.GetType() != 1018544: return # Builds list for clones weights values weights = [1...
998,107
07acf84f656095b9926e4d276f99d5b480c8b50a
from pyo import * import math import time import os import glob import load s=Server(sr=44100,duplex=0).boot() name = "nessaAllTrim.wav" path = "../samples" name="BD TI.wav" infile = os.path.join(path, name) print "current file is: " + infile table = SndTable(path=infile) dur = table.getDur() trig=Trig...
998,108
9c5e3939732ede0863d130bd48960fe3ccb350c0
from enum import Enum from typing import List, Optional from pydantic import BaseModel, Field, PositiveInt, validator class MaritalStatus(str, Enum): single = "single" married = "married" class OwnershipStatus(str, Enum): mortgaged = "mortgaged" owned = "owned" class House(BaseModel): ownersh...
998,109
87c5deec30c62992f15680911f37f76d6d7fc026
import numpy as np import pandas as pd from gradientDescend_oops import lm,logit import matplotlib.pyplot as plt import seaborn as sns import statsmodels.api as sm import statsmodels.discrete.discrete_model as smd #from gradientDescend import logit ###################### reading data ##################################...
998,110
0351908ef3dc33f70df8fc4fc33c9a1d9e5df8d1
from django.shortcuts import render, get_object_or_404 from restful import restful from ..models import Cat from ..forms import CatModelForm from django.http import HttpResponseRedirect from django.urls import reverse import sys @restful def edit(request, cat): if request.method == 'POST': ...
998,111
51b279f08c59f7e055cca2cef4308bdf3d76594a
""" ===== LIGHT SEQUENCE RUNNER v.1.0b ===== Copyright (C) 2019 - 2020 IU7Games Team. Запуск стратегии 7EQUEENCEGAME игрока, для проверки на отсутствие segmentation fault, бесконечных циклов и так далее. """ import os from games.sequence.sequence_runner import start_sequence_game def light_sequence_r...
998,112
0a313d58805d64820850beadce26c07972e4579e
from odoo import api, fields, models, _ from odoo.exceptions import UserError from odoo.tools import amount_to_text_en, float_round import odoo.addons.decimal_precision as dp #================================================== # Class : BiJournalVoucher # Description : Account Receipt Details #=========================...
998,113
12b9cd5ad1a2e0b29ecf1b7df4b2bc8ef09641e0
# -*- coding: utf-8 -*- """ Code Challenge Name: Titanic Analysis Filename: titanic.py Dataset: training_titanic.csv Problem Statement: It’s a real-world data containing the details of titanic ships passengers list. Import the training set "training_titanic.csv" Answer the Fo...
998,114
22bf197cf19246f3959ee8445732165990cd9c3a
#!/usr/bin/python3 # -*- coding: utf-8 -*- #from test0 import test from exams import quiz import sys # Let's load the csv with the data csv = open('pinyin.csv', 'r', encoding='utf-8').read().split("\n") language = 2 # default: english if len(sys.argv) > 1: # some parameters introduced! if sys.argv[1] == "--spani...
998,115
7bc909213c53c94b277d182f8db205ad08b8a236
from core.effect.base import EffectBase from core.helper import chance from core.tuning.skill import SkillTuning from raisecap.tuning.effect import EffectTuning from siege import game, Locale class Precision(EffectBase): TUNING = EffectTuning.PRECISION @property def description(self): return Loc...
998,116
13ff5ad2c69dfe8bfc01aea24f67b73dbd222336
####### STANDARD/INSTALLED PACKAGES ####### from blogREST.common.utils import token_required from flask import current_app, request, Flask, Blueprint, jsonify, redirect, url_for, session from flask_restplus import Resource, Api, fields, Namespace from flask_pymongo import PyMongo from flask_dance.contrib.google import ...
998,117
26be626185a0455e8c689e1622678bf526980d55
#!/usr/bin/env python3 # # Copyright 2017, The Android Open Source Project # # 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 requir...
998,118
7d10827a017d7090c10bdc89bbae4dbaeafe0efe
import math d = int(input()) day = math.sqrt(d) if day % 2 == 0: print("OK") else: print("NG") # 入力例1 # 256 # 出力例1 # OK # 入力例2 # 255 # 出力例2 # NG
998,119
3aa50d34a3689d9fbee1cf59b346fa054fa18b67
print("Enter your name:") name = input() print("Enter your age:") age = input() print("You entered: " + name + " " + age)
998,120
54bdf9404be5096358c6ce413a2fda26c6c3df7d
''' 请解析IP地址和对应的掩码,进行分类识别。要求按照A/B/C/D/E类地址归类,不合法的地址和掩码单独归类。 所有的IP地址划分为 A,B,C,D,E五类 A类地址1.0.0.0~126.255.255.255; B类地址128.0.0.0~191.255.255.255; C类地址192.0.0.0~223.255.255.255; D类地址224.0.0.0~239.255.255.255; E类地址240.0.0.0~255.255.255.255 私网IP范围是: 10.0.0.0~10.255.255.255 172.16.0.0~172.31.255.255 192.168.0.0~192.168.255.25...
998,121
3057d997c71f44ba98e538f18aaa900730d8476f
# Copyright (c) 2019 NTT DATA # # 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, ...
998,122
abac2fa97a42f4b3040cf3904ee985c099017ed2
""" 内容:集合 data:2019.6.19 """ # 1. 用{}括起来的,但是没有体现映射关系,集合中的元素是无序的,集合中的元素输出后都是唯一的 num1 = {} print(num1) num1 = {1,2,3,4,5} print(num1) set1 = {} set2 = set([1,2,3,4,5,6]) # 用set()创建集合参数为列表 print(set1) print(set2) list1 = [1, 2, 3, 4, 4, 2, 7, 8, 9] list1 = list(set([1, 2, 3, 4, 4, 2, 7, 8, 9])) print(list1) print(0 i...
998,123
1f9e8df064adaf93d6d7fa21e9bd687c4854c573
""" MIT License Copyright (c) 2020-2021 Ecole Polytechnique. @Author: Khaled Zaouk <khaled.zaouk@polytechnique.edu> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including...
998,124
243461e7b70a633bf2ae431b294c99df121d95ea
a=int(input()) x= [int(n) for n in input().split()] def median(x): x.sort() mid = len(x) // 2 return (x[mid] + x[~mid]) // 2 s1=median(x) print(s1)
998,125
d03d8477dccbdec4c8787dab1fff0f4b8e918987
import pygame from game import Game import os start_btn = pygame.image.load(os.path.join('menu', 'button_play.png')) logo = pygame.image.load('logo.png') class MainMenu: def __init__(self): self.width = 1250 self.height = 700 self.win = pygame.display.set_mode((self.width, self....
998,126
d11beb2dc14ad353b42cabd46eef3ce4619f5570
from django.core import validators from django import forms from django.db.models import fields from django.forms import widgets from .models import Student class StudentRegistration(forms.ModelForm): class Meta: model = Student fields = ('name', 'email', 'password') #We can use list as well ...
998,127
a12206b7bbbf61147507c844977c4b09240e21ae
import time import torch import subprocess import os from model import EAST from model2 import EASTER from detect import detect_dataset import numpy as np import shutil def eval_model(model_path, test_img_path, submit_path='./submit', save_flag=True, set_scale=4, model='EAST', limit=False): if os.path.exists(submit_...
998,128
96351f36468876e8fe5e433357c95ee9b283c265
def get_fibonacci_last_digit(n): if (n < 1): return n prev = 0 curr = 1 for _ in range(n - 1): prev, curr = curr % 10, (prev + curr) % 10 return curr % 10 def get_fibonacci_sum(n): last_digit = get_fibonacci_last_digit((n + 2) % 60) sum_last_digit = get_last_digit_after_...
998,129
90e4336b9f271c410edc63189503e7bedb6a164d
#Ibrahim Kamal #ik363 #Ball class to draw the ball from Drawable import Drawable import pygame class Ball(Drawable): def __init__(self , location , color , radius , visibility): super().__init__(visibility) #visibility boolean of ball self.location = location #location of ball self.color =...
998,130
9f05528974185ab74758a3f49b3f642580b9b068
import json import numpy as np from fastai.text import * from azureml.core.model import Model import logging logging.basicConfig(level=logging.DEBUG) def init(): global model model_path = Model.get_model_path('sa_classifier') model_path = os.path.split(model_path) model = load_learner(path=model_p...
998,131
afbcff4f0accfe775ef91c55864960e307825488
from townsquare import db, app, manager db.init_app(app) if __name__ == '__main__': manager.run()
998,132
0af9eb188dc4d963651e2960b95cf3428baec82f
from pyscf import gto, scf, ao2mo import numpy as np mol = gto.M(atom='H 0 0 0; H 0 0 0.7414', basis='sto3g') mol.build() mf = scf.RHF(mol) ehf = mf.kernel() hij = mf.get_hcore() print(hij) print("Mo coeff: " + str(mf.mo_coeff)) mohij = np.dot(np.dot(mf.mo_coeff.T, hij), mf.mo_coeff) print(mohij) print("Orbitals ene...
998,133
f7defb9a743d98a098d38e39f5a42fed6aa919e1
# 导入pygame包 import pygame # 初始化pygame pygame.init() # pygame内容 编写游戏的代码 print("游戏的代码。。。") # 退出pygame 释放内存 pygame.quit()
998,134
8243f2b6777c3fb6917dedcba210116d5737deea
import matplotlib.pyplot as plt from _3 import RandomWalk rw = RandomWalk() rw.fill_walk() plt.scatter(rw.x_values, rw.y_values, s=15) plt.show()
998,135
318e193079c933e6b9523adf05f701b242085ca4
# -*- coding: cp936 -*- import copy #D=[['A','B','C','D'], # ['B','C','E'], # ['A','B','C','E'], # ['B','D','E'], # ['A','B','C','D'] # ] D=[['I1','I2','I5'], ['I2','I4'], ['I2','I3'], ['I1','I2','I4'], ['I1','I3'], ['I2','I3'], ['I1','I3'], ['I1','I2','I3','I5'], ['I1','I2','I3'] ...
998,136
e93baca7a39b345f15bd7c15f0ecd2bf5311fc92
from flask import Flask, jsonify import json from tasks import connect app = Flask(__name__) data = {"han": 0, "hon": 0, "den": 0, "det": 0, "denna":0, "denne": 0, "hen": 0, 'alltweets': 0} @app.route('/run') def index(): connect.delay() return "He...
998,137
466d68a3561bd50d46ca793b2146e23d9b39a753
from app import manager if __name__ == '__main__': manager.run(host='0.0.0.0', ssl_context='adhoc')
998,138
9577eaac34c2fd2351c29f2e3587d886ec423c31
class Course: def __init__(self, name: str, num: str, instructor: str = 'TBA', schedule: str, credit: int = 0): self.name = name self.num = num self.credit = credit self.instructor = instructor department = '' for i in self.num: if i not in '1234567890': ...
998,139
955dac6633fc84e99d1571d64c3da37c95f78045
import unittest from config import Config class VestingBalanceTestCase(unittest.TestCase): def testCreateVestingBalance(self): params = { "owner": "testaccount6", "amount": 10000, "asset": "1.3.4", "start": "2019-08-6T10:00:00", "_type": "cdd", ...
998,140
5d40dd7be51f6204225634bdfeb12525de9d28fe
################################################################## # MESURE DU TAUX D'OCCUPATION DE PARKINGS A L'AIDE # # DE CAMERAS VIDEOS # # -------------------------------------------------------------- # # Rémi Jacquemard - TB 2018 - HEIG-VD ...
998,141
5eb48e01141598ff7e686b9a4c84f152e0101afe
from __future__ import print_function import keras from keras.datasets import mnist import matplotlib.pyplot as plt import pickle import numpy as np (X_train, y_train), (X_test, y_test) = mnist.load_data() pant = mnist.load_data() class_names = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] X_train = X_train/25...
998,142
2c6741805ca69ac177670de4171cfe742cba5c68
from django.test import TestCase from .calc import add, subtract class CalcTests(TestCase): def test_add_two_numbers(self): """test that two numbers are added""" self.assertEqual(add(5, 9), 14) def test_subtract_numbers(self): """test that two numbers are subtracted from each other ...
998,143
8214d59b5fd50f4117e3de598244994636e04edb
# Demonstrates logging # Attributes that can be put into the basicConfig: # level # filename # filemode # format # %(name)s - %(levelname)s - %(message)s - %(asctime)s - %(lineno)s import logging # Determines the level at which logging will be issued: Info will show all levels up from INFO (INFO, # WARN...
998,144
df89d0b7d39ba30f3d814e71b7c660cbfcac5687
kilometri=input("Unesite kilometre: ") kilometri_float=float(kilometri) milje=kilometri_float * 0.6213 print (milje)
998,145
3edd24fadce05375eed7719540734f797047b69b
import sys sys.path.append("..") from _231_motifMatrix import profileMotifs, score, countMotifs, consensus from _251_profileMostProbableKmer import profileMostProbableKmer from lib import verticalPrint, spacedPrint def greedyMotifSearch(dna, k, t): #computes a collection of strings as best motifs. bestMotifs ...
998,146
782fc9d99165ac2d4d6c180819d97e9b3ef14d93
import torch import torch.nn as nn from torch.autograd import Variable, grad import numpy as np import os import common class MWCNN(nn.Module): def __init__(self, args, conv=common.default_conv): super(MWCNN, self).__init__() #n_resblocks = args.n_resblocks n_feats = 64#args.n...
998,147
0d1e3fb200d496d9e8c1ef27962e3e7478a647fc
from django.db import models from django.contrib import admin class Cursos(models.Model): nombrecurso = models.CharField(max_length=30) def __str__(self): return self.nombrecurso class Alumnos(models.Model): nombrealumno = models.CharField(max_length=60) calificaciones = models.TextFi...
998,148
8e35544a47ff3ac3482b3c80c8ff0f8d45d3814c
from serial import Serial from time import sleep ''' 1) Try crack single byte. Run logic for ~300 sec ''' ''' 2) Save logic to CSV file (this directory) ''' ''' 3) Run read_csv.py to display time ''' ser = Serial('COM3', 9600) ser.close() for key in range(255, 0, -1): ser.open() sleep(0.02) # send 16 ze...
998,149
89c63ef05ceaea4950443e6ac67a1785c6a4c033
# Author: Zsolt Kébel # Date: 18/11/2020 file = open("text.txt") swFile = open("sensitive_words.txt") text = file.read() sensitiveWords = swFile.readlines() newText = "" for sensitiveWord in sensitiveWords: newText = text.replace(sensitiveWord, "*") print(newText) file.close() swFile.close()
998,150
539a0b290cd374d822e9d0d576596ecb96e496d9
# -*- coding: utf-8 -*- import scrapy from datetime import datetime from papermedia.items import ScienceAdvancesItem from scrapy.http import Request class ScienceAdvancesSpider(scrapy.Spider): name = "scienceadvances" # allowed_domains = ["advances.sciencemag.org"] __url_root = 'http://advances.science...
998,151
04d6e322ce254ac6a9cfa5b21f6d94beddba571b
import os import subprocess from weakref import ref from lib import pyjack import pyrser from pyrser import meta from pyrser.grammar import Grammar from cnorm.parsing.declaration import Declaration from cnorm.parsing.expression import Expression from cnorm import nodes from kooc_nodes import Import from kooc_nodes ...
998,152
678c69e0de709884695b9acf4aad4a310b6cba4c
import streamlit as st import pandas as pd import numpy as np from openpyxl import Workbook, load_workbook import SessionState """ This function takes in a dataframe and returns a dictionary with the topic title as key and the leading comment as value """ #@st.cache(suppress_st_warning=True, allow_output_mutation=True...
998,153
9fa63b60043d5684455ac79c54e332daaf490778
# Tentamen versie :BMFWRDZN # Gegevens :Reuben Domacasse 0918901 23-10-2017 # Opgave :1-001 # Inleiding: De inhoud van een voorwerp met een diameter van 33 cm wordt berekend met de formule: 1/8 x 3,14 x (33^4) / 5 # Opdracht: Schrijf een programma dat deze berekening uitvoert. # Eisen: ...
998,154
534489e080080c32d8e77c3c74435cdeeb523ece
# Ejercicio propuesto por Guillermo Cirer # Lesson 2: Problem set (Optional 2) # Superhero Nuisance # Enunciado del ejercicio: # Write a Python procedure fix_machine to take 2 string inputs # and returns the 2nd input string as the output if all of its # characters can be found in the 1st input string and "Give me # so...
998,155
6d55d42180b146cae6ab59196feab66f56fe912b
from lib.util import BaseAPIView from rest_framework.views import APIView from rest_framework.permissions import AllowAny from rest_framework.response import Response from rest_framework import status from Apps.fcb.models import * from rest_framework.generics import ListAPIView from Apps.fcb.serializers import P...
998,156
b965383e225fd381da63b82edf80d981c0da7e96
import sys import socket import json """ Method evaluates bond order based on price. Returns a json order to execute """ def evaluate_bond_order(book, order_id, positions): if book['BOND'][0] == 0: return {"type": "add", "order_id": order_id, "symbol": "BOND", "dir": "BUY", "price": 999, "size": 1} if ...
998,157
15464512d5e19f604ddb0db052047993c5df079a
from tkinter import Tk, Canvas, Frame, Button, BOTH, TOP, BOTTOM, LEFT, RIGHT, Label import copy from gameAI import Game_Solver from sudokuGenerator import generate MARGIN = 80 SIDE = 120 WIDTH = HEIGHT = MARGIN * 2 + SIDE * 9 LEVEL = "Easy" class SudokuUI(Frame): """ """ def __init__(self, parent, game):...
998,158
156942020e684d80daf56ef5041d235ef4c0fdda
# -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2016-11-22 01:10 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('rescuteApp', '0003_report_location'), ] operations = [ migrations.AddField(...
998,159
29970f43d3f01729f71097b37b6c9eb300f55abc
# Import necessary modules from flask import Flask, request import pickle import pandas as pd app = Flask(__name__) with open('xgb_model_new','rb') as m: model = pickle.load(m) with open('features.pkl', 'rb') as m: features = pickle.load(m) @app.route("/") def index(): return 'Server is up and runnin...
998,160
d779c5f1b1fdc19b1ae5006cf0eed836c0701a87
import sys from collections import deque def input(): return sys.stdin.readline().strip() def main(): """ Nを-2べきで展開したときの末端項がmod 2で決定できるから 末尾から再帰的に桁が決められたのか。。。 """ N = int(input()) if N == 0: print(0) return idx = 0 ans = deque([]) while N != 0: if N % 2 == 0...
998,161
a061a06e3209f6705b1fe949a600d860be1f98d9
from .base import Base from app.db import db class PastPerformance(Base): __tablename__ = 'past_performances' __table_args__ = ( db.Index( '_horse_track_date', 'horse_id', 'track_code', 'race_date' ), db.UniqueConstraint( 'ho...
998,162
aabbd5a2f2bbdf011c60694f2722c7bd2ed1d8ed
''' See examples.py, constants.py, or main.py for configurable code. ''' def clamp(value, min_value, max_value): return min(max_value, max(min_value, value)) def smoothstep(min_edge, max_edge, value): value = clamp((value-min_edge) / (max_edge-min_edge), 0, 1) return value * value * (3 - 2 * value) impor...
998,163
c6d4cc1e52cd9db8bff2e588b3b9d5d178d4a79d
#! /usr/bin/env python print "Configure Server Started!!!" from shutil import copy, copytree, move import subprocess #the copy and copytree methods can help you move stuff out of your expanded package to various places on the server. #subprocess.call(["rm /var/www/html/test.py",""], shell=True) #subprocess.call(["rm...
998,164
06d008c5a3fb04c1a0297d632c38f6dc1bf3f5f7
import random import numpy as np from cs231n.data_utils import load_CIFAR10 import matplotlib.pyplot as plt plt.rcParams['figure.figsize'] = (10.0, 8.0) plt.rcParams['image.interpolation'] = 'nearest' plt.rcParams['image.cmap'] = 'gray' cifar10_dir = 'cifar-10-batches-py' X_train, y_train, X_test, y_test = load_CIF...
998,165
c419aceacc79e28cc296f40a1cef14753f0c67df
import csv import datetime import time import os dirpath = os.getcwd() print("current directory is : " + dirpath) path_to_file = './input/' os.chdir(path_to_file) print("current directory is : " + os.getcwd()) # get inactivity period from .txt inactivity_period_file = open('inactivity_period.txt', mode='r') inactivi...
998,166
9c959fac06208eb7724c4897e062c390c302733e
from flask_sqlalchemy import SQLAlchemy from flask_marshmallow import Marshmallow from marshmallow_sqlalchemy import SQLAlchemyAutoSchema import datetime db = SQLAlchemy() class Libro(db.Model): id = db.Column(db.Integer, primary_key = True) titulo = db.Column( db.String(50) ) autor = db.Column( db.St...
998,167
8c237bdb7868c7b7868a35237a5080a2ce00e1b7
#coding=utf-8 ##################################################### # Written By lsvih # # 2016-11-07 # # Convert algebraic expression # # to functional expression # ###################################...
998,168
1bb70e84949fa3c86f2de52b817879f035e527c4
import setuptools setuptools.setup( name='seleniumslicer', version='0.0.1', author='Feng Liu', author_email='feng3245@gmail.com', description='Given selenium drive and elements. Extract the element screen capture', long_description='Given a driver and an element on the p...
998,169
4fd746e39f5735f234cf057ee9ddfd27b543c432
roots = { 'com': { 'extend': None, 'domain_name': r'Domain Name:\s?(.+)', 'registrar': r'Registrar:\s?(.+)', 'registrant': None, 'creation_date': r'Creation Date:\s*(.+)\s*', 'expiration_date': r'Expiration Date:\s*(.+)\s*', 'updated_date': ...
998,170
a68e6cfcaeaaa3dc27788e9bd33e982691de41b4
import pymysql import datetime from datetime import date, datetime, timedelta import time import urllib.request import json import urllib.parse #Asumsi : Database main diisi oleh program di main server write_api="ZK7J4CMO3WDQ7YTF" read_api="C2LETLVY0NPLWBMT" while True: ### MEREKUES DATA DARI DATABASE main SERVE...
998,171
4926f2ce9ccc62178c89d3f5e150d52b7ff4ed77
from parameterized import parameterized from unittest import TestCase, mock from insightconnect_plugin_runtime.exceptions import PluginException from komand_active_directory_ldap.actions.disable_users import DisableUsers from komand_active_directory_ldap.actions.disable_users.schema import Input, Output from common im...
998,172
c871061e07442d06cc50fed109e21d9fc60b856a
import flask import pandas as pd
998,173
5748998a5a570edbe587c15d4dee854849d5c0d4
import random import json class Animal(object): DEAD_RATIO = 0.8 DEAD_CHANCE_RATIO = 0.8 LIFE_EXPECTANCIES = {'Snake': 12, 'Horse': 30, 'Wolf': 25, 'Tiger': 24, 'Bear': 40 } AV...
998,174
535639656374abf2def5d4d91e1bf77756a36f83
from http.server import BaseHTTPRequestHandler, HTTPServer from postcrd import Postgres import re from json import dumps class Handler(BaseHTTPRequestHandler): def header(self): self.send_response(200) self.send_header('Content_type', '') self.end_headers() def do_GET(self): ...
998,175
be3e197df204b9f79ca548dd9f9014507c2f40cc
import make_registers from lxml import etree def extract_ecat_ids_sax(xml_file, ids_file): ids = make_registers.extract_ecat_ids(xml_file) print(len(ids)) open(ids_file, 'w').write('\n'.join((str(id) for id in ids))) def extract_ecat_ids_xpath(xml_file, ids_file): namespaces = { 'mdb': 'http...
998,176
532ba476ab24bc9431c082d2ebd25858ed75432c
#coding:utf-8 #数字和数学计算 print "I will now count my chickens:" print "Hens", 25 + 30 /6 print "Roosters",100-25 *3/4 print "Now I will count the eggs:" print 3 + 2 + 1 - 5 + 4 % 2 -1 /4 +6 print "It is true that 3 + 2 < 5 -7?" print 3 +2 < 5-7 print "What is 3+2?", 3+2 print "What is 5-7?", 5-7 print "Oh, that...
998,177
c87cc29197577fd631259beec521c4c82bec21c0
import pygame,sqlite3,random from pygame.constants import MOUSEBUTTONUP, MOUSEMOTION pygame.init() #width and height for the screen display_width=800 display_height=600 #make the slide window gameDisplay = pygame.display.set_mode((display_width,display_height)) FPS=60 #width and height for the board Boardwidt...
998,178
07ca3bcbf9d17a26cf576984aa36104bfa0e4a4d
calificaciones = {"calculo": 10, "dibujo": 5} sumaCalificaciones = calificaciones.get("calculo") + calificaciones.get("dibujo") totalNota = sumaCalificaciones / 2 print("El promedio mayor es calculo: ", calificaciones.get("calculo"), '\n', calificaciones.get("dibujo"), '\n', totalNota)
998,179
3923a1046583d2898b6bdb64243fa9aee1a65bb4
from django.views.generic.base import TemplateView from rest_framework.views import APIView from rest_framework.response import Response from rest_framework import authentication, permissions from api.models import Member from api.serializers import UserSerializer from authentication import QuietBasicAuthentication fro...
998,180
dbf010209a585ca953bb2092271e93fa2778584e
import cv2 cap = cv2.VideoCapture(1) while True: _, vid = cap.read() cv2.imshow("Camera", vid) if cv2.waitKey(10) == ord('q'): break cap.release() cv2.destroyAllWindows()
998,181
85f9436227040564788d24c38a3b5518b57538c8
import numpy as np A = np.random.randint(0, 10, size=(3, 2)) B = np.random.randint(0, 10, size=(3, 3, 3)) C = np.random.randint(0, 10, size=(3, 1)) # print(A**2) # print(np.sqrt(A)) # print(A) # print(C) # print(A + C) # print(B + C) print(B) B[:, 0:2, 0:2] -= 20 print(B)
998,182
994cd8fbb4dbdb67ff6a6e4223e5018bcf5a64f1
""" 预处理部分1: 利用清华语料库,处理10类的新闻数据 从清华数据源文件中提取需要的5万数据 """ import os import shutil class_list = {'财经': 'Economics', '房产': 'House', '社会': 'Society', '时尚': 'Fashion', '教育': 'Education', '科技': 'Technology', '时政': 'Politics', '体育': 'PE', '游戏': 'Game', '娱乐': 'Entertainment'} for class_name, class_name_en in class...
998,183
e3ed13673c44664007218104d153448ccccef9cf
#!/usr/bin/python3 import requests username = "natas25" password = "GHF6X7YwACaYYssHVY05cFq83hRktl4c" url = 'http://'+username+'.natas.labs.overthewire.org/' info = 'http://'+username+'.natas.labs.overthewire.org/var/www/natas/natas25/logs/natas25_' session = requests.session() data = {'lang' : '../etc/natas_webpass...
998,184
80caafddd1f27cb6cff631a9e7f44c65989b8410
# Introduction: How H1st.AI enables the Industrial AI Revolution This tutorial will teach you how H1st AI can help solve the Cold Start problem in domains where labeled data is not available or prohibitively expensive to obtain. One example of such a domain is cybersecurity, which is increasingly looking forward to a...
998,185
36182f4eefe3a27364f75bf1b251f8a8584224ae
''' Doubly linked list (ADT). ''' class DoublyLinkedList(object): class Node(object): ''' Data input (referrenced as the node below) can be of any format (or within any other data type.) ''' def __init__(self, data = None, prev = None, next = None): self.data = data self.prev = prev self.next = nex...
998,186
c04d587ec5b211eabcc7a217a5b49e9a023ef501
from numpy import mean from numpy import std import numpy as np import pandas as pd import sklearn import math import os from sklearn.metrics import log_loss, accuracy_score, classification_report from sklearn.metrics import matthews_corrcoef, make_scorer, roc_auc_score, roc_curve from sklearn.model_selection ...
998,187
80063c3bb4646b380579899f24b1649d13f8f374
print("Hello World!\n Just testing the work folder and commands to run via terminal")
998,188
471d141d97d5a5d70da45429f0ab2ca0b89f28ff
""" 68. Ward法によるクラスタリングPermalink 国名に関する単語ベクトルに対し,Ward法による階層型クラスタリングを実行せよ. さらに,クラスタリング結果をデンドログラムとして可視化せよ. """ from scipy.cluster.hierarchy import linkage, dendrogram from knock67 import make_dataframe, collect_countries import matplotlib.pyplot as plt import pandas as pd if __name__ == "__main__": dataframe = make...
998,189
e0998c54df03880afb47af50013bf18be820cece
"""Inject a given image into the SinGAN. This can be used for Super-Resolution, Paint-to-Image, Harmonization and Editiing.""" import torch from src.singan import SinGAN import argparse from datetime import datetime from skimage import io import numpy as np from src.image import load_img from skimage.color import lab2r...
998,190
a654dd5d13eaeeb2b96edce9c1c896f240b599af
import pygame as pyg from fileslibparcial.libreria import * if __name__ == "__main__": pyg.init() pantalla = pyg.display.set_mode([ANCHO,ALTO]) changeCentroPlano(200, 300) # Cuadrado cuadrado = [[100,100], [-100,100], [-100,-100], [100, -100]] # Linea separadora linea = [[210, 110], [210...
998,191
c421c7a1c8a5d97eca8ca38bf04c44fb0c24eba7
#!/usr/bin/env python # encoding: utf-8 ''' @author: kdb @file: urls.py @time: 2018/7/15 0015 下午 8:47 ''' from django.conf.urls import url from users.views import register,UserUpdateView app_name = 'users' urlpatterns = [ url(r'^register/',register,name='register'), url(r'^user_update/(?P<pk>\d+)/$',UserUpda...
998,192
d34e04e749d535bee499c446419819858a05cb55
from string import ascii_lowercase, ascii_uppercase LENGTH = len(ascii_lowercase) def rotate(text, rot): """ Implementation of the rotational cipher, also sometimes called the Caesar cipher. :param text: Text to encode :param rot: How many places to rotate. 13 means rotate by 13 places. :return: ...
998,193
b4aa9f367639087855e9ad64585720487ca83d63
import re from threading import Thread from os.path import getsize from time import sleep tfname = './x2.txt' sfname = './x2_completed.txt' sfname2 = './x2_error.txt' re_control_char = re.compile('[\x00-\x09|\x0b-\x0c|\x0e-\x1f]') re_email = re.compile(r'\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*') completed = Fals...
998,194
8636d9ebd02335f9d333663d8a6c564d4f156afe
import pandas as pd import joblib from fastapi import FastAPI app = FastAPI() # define a root `/` endpoint @app.get("/") def index(): return {"ok": True} # Implement a /predict endpoint @app.get("/predict/") def create(acousticness, danceability, duration_ms, energy, exp...
998,195
b76282137c0f2e95c99ab2fabe491e72db487024
import pprint from django.conf import settings from django.core.management.base import BaseCommand import requests class Command(BaseCommand): def handle(self, *args, **options): item_id = 171266044 url = settings.FLYER['item_url'].format(item_id) response = requests.get(url) dat...
998,196
c54a19bc49f9996e6bf9d26b495f877b213b27d4
import requests import os, csv, time url = 'http://stats.moe.gov.tw/files/detail/{0}/{0}_student.csv' for year in range(103, 109): csvdata = requests.get(url.format(year)).text rows = csvdata.split('\n') data = list() columns = rows[0].split(',') for row in rows[1:]: try: row = r...
998,197
64fbeff8cce0f3b890e14ef82cae3fcc715676c3
# coding: utf-8 import psycopg2 DBNAME = "kumo" DEFAULT_LIMIT = 100 def is_station_id(station_id): cnx = psycopg2.connect("dbname={}".format(DBNAME)) with cnx.cursor() as cur: cur.execute("SELECT last_value FROM stations_id_seq;") last_value = cur.fetchone()[0] return station_id <= last...
998,198
8e708c2da757183ff4be0866e09a73cad85b3cad
from tensorflow.keras.models import load_model if __name__ == '__main__': # Load the data # ... # Preprocessing # ... # Load the trained models #for example model_task1 = load_model('./nn_task1.h5') # Predict on the given samples #for example y_pred_task1 = model_task1....
998,199
120804177bd3e537a5a8ed11c9eb9ded8d07731d
class first(): def method(self): print('method of first class') class second(): def method(self): print('method of second class') obj=first() obj.method() obj=second() obj.method()