text
stringlengths
38
1.54M
import numpy as np import matplotlib.pyplot as plt x = np.array([1, 2, 3]) print(x) # array([1, 2, 3]) y = np.arange(10) # like Python's range, but returns an array print(y) # array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) b = np.linspace(0, 2, 4) # create an array with 4 equally spaced points starting with 0 and ending with...
from feature_generation.datasets.Heatmap import Heatmap class MoocImages(Heatmap): def __init__(self): super().__init__("mooc-images") self.subject_id_column = "subject" self.label = "posttest" self.labels_are_categorical = False def heatmap_label(self, metadata_file, id): ...
# -*- coding: utf-8 -*- """ Created on Mon Mar 18 21:55:15 2019 @author: Xiaoyin """ import numpy as np import random import math import cv2 import os import glob import shutil def confidence_(logits): confidence=0 confidence=-1*math.log(min(softmax(logits))) return confidence ...
import random from .base import BaseCommand class HeadToHeadCommand(BaseCommand): """Return the results of the previous games between two players.""" command_term = 'head-to-head' url_path = 'api/match/head_to_head/' help = ( 'Use the `head-to-head` command to see all results between two pla...
import matplotlib.pyplot as plt import networkx as nx import pprint from collections import defaultdict def readFromPayek(): G = nx.read_pajek("euler.net") # print(G.edges) # print(G.nodes) # G1.number_of_nodes() # G1.number_of_edges() # G.degree[1] koliko ima brida pojedini vrh # list(G...
import pessoa1 class Funcionario(pessoa1.Pessoa): def __init__(self): # idPessoa self._id = 0 self._cargo = "" #Getter do id @property def id(self): return self._id # Getter e Setter do cargo @property def cargo(self): return self._cargo @cargo....
import random from graphics import * import Learn class Creature: def __init__(self,type): self.type=type x=random.randrange(0,Learn.width) y=random.randrange(0,Learn.height) health=100 age=0 #sight=3 #record self.draw() def draw(self): ...
"""API Endpoints relating to users""" import bcrypt from flask import Blueprint from flask_restful import Api, Resource, request from kite.api.response import Error, Fail, Success from kite.api.v2.parsers.user_parse import post_parser, put_parser from kite.models import User, db from kite.settings import FORUM_ADMIN, ...
range(5) range (0,5) for i in range(5): print(i) range(5, 10) list(range (5, 10)) list(range(10, 15)) list(range(0,10, 2))
# python 3.6 """网络爬虫和搜索引擎 """ def quick_sort_pages(ranks, pages): if not pages or len(pages) <= 1: return pages else: pivot = ranks[pages[0]] worse = [] better = [] for page in pages[1:]: if ranks[page] <= pivot: worse.append(page) ...
import collections class Solution: def fourSumCount(self, A, B, C, D): """ :type A: List[int] :type B: List[int] :type C: List[int] :type D: List[int] :rtype: int """ # A_counts = {} # B_counts = {} # C_counts = {} # D_counts =...
import tkinter as tk def my_command(): print("command") def my_command2(): print("commanded") root = tk.Tk() # all our code goes here root.geometry('800x600') menu_bar = tk.Menu(root) file_menu = tk.Menu(menu_bar, tearoff=0) # all file menu-items will be added here next edit_menu = tk.Menu(me...
"""Decorators for use with SimpleRPG""" from discord.ext import commands from ..exceptions import HasNoCharacterException def has_character(): def predicate(ctx): if ctx.bot.get_or_load_character(ctx.message.author.id): return True else: raise HasNoCharacterException r...
import numpy as np from matplotlib import pyplot as plt plt.figure(1) plt.ion() l1 = 1 l2 = 1 l3 = 1 theta1 = 10 theta2 = -5 theta3 = -5 i=0 while i<60: p1 = [l1*np.cos(np.radians(theta1)), l1*np.sin(np.radians(theta1))] p2 = [p1[0] + l1*np.cos(np.radians(theta2 + theta1)), p1[1] + l1*np.sin(np.radians(the...
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
""" Generate a dataset containing features for each of the specified log datasets. """ import os import pandas as pd from global_constants import RESULTS_DIR from src.data_config import DataConfigs from src.helpers.data_manager import DataManager from src.utils import get_vocabulary_indices, get_token_counts_batch from...
# 生成一个扁平的盘状结构元素。 # # 如果像素与原点之间的欧几里得距离不大于半径,则该像素在邻域内。
#!/usr/bin/env python # coding: utf-8 # In[1]: from keras.preprocessing.image import load_img from keras.preprocessing.image import img_to_array from keras.applications.vgg16 import preprocess_input from keras.applications.vgg16 import decode_predictions from keras.applications.vgg16 import VGG16 from keras import bac...
DAMAGE_SPELL = "damage_spell" HEAL_SPELL = "heal_spell" SINGLE_TARGET_SPELL = "single_target_spell"
import copy import math import os import numpy as np from OpenGL import GL from OpenGL import GLU from prototype import quaternion as QUAT def to_seg(value,precs = 4): seg_value = (360/(2*math.pi))*value hour = int(seg_value) min_value = (seg_value - hour)*60 min = int(min_value) sec = round((mi...
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file './ui/login_form.ui' # # Created by: PyQt5 UI code generator 5.12.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtSql db = QtSql.QSqlDatabase.addDatabase('QPSQL') db.setHostName("localhost") db.s...
import tkinter from tkinter import * from process_module import process from output_module import output def send(): msg = EntryBox.get("1.0",'end-1c').strip() EntryBox.delete("0.0",END) if msg != '': ChatBox.config(state=NORMAL) ChatBox.insert(END, "You: " + msg + '\n\n') ChatBox...
# -*- coding: utf-8 -*- """ Created on Fri Jul 20 13:20:03 2018 @author: XIECHEN """ import requests import json import time starttime=time.asctime(time.localtime(time.time())) starttime1=time.time(); def getjson(ocoo): url='http://api.map.baidu.com/direction/v2/transit?origin='+ocoo+'&destination=3...
# -*- coding: utf-8 -*- import datetime import logging import telegram from django.utils import timezone from tgbot.handlers import commands from tgbot.handlers import static_text as st from tgbot.handlers import manage_data as md from tgbot.handlers import keyboard_utils as kb from tgbot.handlers.utils import handl...
import time def calculate_time(func): def wrapper(numbers): start = time.time() result = func(numbers) end = time.time() print(func.__name__+ " took " + str(end-start)) return result return wrapper @calculate_time def multipication(numbers): result = [] for n...
#!/usr/bin/env python __title__ = 'MakeChart' __version__ = 0.2 __author__ = "Ryan McGreal ryan@quandyfactory.com" __homepage__ = "http://quandyfactory.com/projects/56/makechart" __copyright__ = "(C) 2009 by Ryan McGreal. Licenced under GNU GPL 2.0\nhttp://www.gnu.org/licenses/old-licenses/gpl-2.0.html" """ MakeChart...
import flask from flask import render_template, Flask, redirect, json ,jsonify , url_for from flask import request import device_mgmt_class from flask import jsonify import database import smtplib device_detail_array = ['dev_id', 'dev_name' ,'dev_console', 'dev_mgmt','dev_power', 'used_by', 'dev_topo'] app = Flask(_...
# -*- coding: utf-8 -*- import time from datetime import timedelta, datetime, date import urllib, urllib2 import os import json from django.http import HttpResponseRedirect, HttpResponse, Http404 from django.template import Context, RequestContext from django.contrib.auth.decorators import login_required, permission_...
"""For each node in a binary tree, create a new duplicate node, and insert the duplicate as the left child of the original node.""" class TreeNode: def __init__(self, data): self.data = data self.left = None self.right = None def doubleTree(root) : if root is None: return None...
from typing import Dict from copy import deepcopy import logging import warnings logger = logging.getLogger(__name__) def reformat_config(config: Dict) -> Dict: """ Reformat old config files to enable their use for new versions of xopt. Raise a bunch of warnings so it annoys people into updating their co...
# Generated by Django 3.1.4 on 2021-02-05 10:28 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('posts', '0055_auto_20210122_1659'), ] operations = [ migrations.CreateModel( name='message', fields=[ ...
''' Created on Feb 6, 2016 @author: vagif ''' import datetime from lib.ShelveStorage import ShelveStorage class VaultStorage(): ## TODO Make the time format the same as AWS uses __TIME_FORMAT = "%Y%m%d_%H%M%S" __PATTERN_VAULT_STORAGE_FILE = 'vault_%s_%s' __KEY_ARCHIVES = 'archives' __KEY_LAST_I...
# --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.4.2 # kernelspec: # display_name: Python [conda env:PROJ_IrOx_Active_Learning_OER] # language: python # name: conda-env-PROJ_IrOx_Active_Lea...
# -*- coding: utf-8 -*- import pandas as pd url = "http://bit.ly/uforeports" data = pd.read_csv(url) print(data) print(data.isnull().head()) print(data[data.City.isnull()]) print(data.isnull().sum()) print(data.shape) #data = data.dropna(how = "any") #data = data.dropna(subset = ['City','Colors Reported...
""" Blind simulation: ICs - /home/app/reseed/snapshot_099 Final snapshot - /home/app/reseed/IC.gadget3 """ import sys sys.path.append("/Users/lls/Documents/mlhalos_code") import matplotlib matplotlib.rcParams.update({'axes.labelsize': 18}) import numpy as np from mlhalos import parameters from mlhalos import machinel...
from starter2 import * from collections import defaultdict import fnmatch class plot(): """container object that connects images with parameters""" def __init__(self,fname=".",parameters={}): self.fname=fname self.parameters=parameters class core_target(): def __init__(self, h5ptr...
import PySimpleGUI as sg import threading import os import re from start import start from setup import setup from caption import caption_setup from main import main import utils, overnight from unfollower import unfollow WINDOW_TITLE = 'IG Upload Helper' x = 650 y = 750 sg.theme('Dark') # Add a touch of color # A...
import os import re import imageio from itertools import islice from PIL import Image #from skimage import transform,io import cv2 def generateVideo(path, output_name): sorted_files = [] for file in os.listdir(path): if file.startswith('frame') and "rigid" not in file: complete_path = path...
import json import paho.mqtt.client as mqtt import yaml from functools import partial def on_connect(topic, client, userdata, flags, rc): print("Connected with result code " + str(rc)) # Subscribing in on_connect() means that if we lose the connection and # reconnect then subscriptions will be renewed. ...
from django.contrib.admin.utils import model_ngettext from jinja2.nodes import Mod from rest_framework.serializers import ModelSerializer from .models import * class ProvinceSerializer(ModelSerializer): class Meta: model = Province fields = ["id", "name"] class LocationSerializer(ModelSerializer...
from analyze_network import get_weights import numpy as np import matplotlib.pyplot as plt wm_abs_dif_list = [] for arguments in [('/home/nhoang1/saralab/popgen-hmm-dl/dl/TD_pop/TD_pop_model.hdf5', 'pop', 'TD', 'TD'), ('/home/nhoang1/saralab/popgen-hmm-dl/dl/dupl_pop/dupl_pop_model.hdf5', 'pop_1', ...
# import colorgram # colors = colorgram.extract('spot.jpg', 20) # image_colors=[] # for i in colors: # image_colors.append((i.rgb.r,i.rgb.g,i.rgb.b)) # print(image_colors) import turtle as turtle_module import random colors = [(216, 148, 92), (221, 78, 57), (45, 94, 146), (151, 64, 91), (232, 219, 93), (217, ...
import shelve def get_data(id: int, type: str): data = {} with shelve.open('database' + str(id) + '.txt') as db: if type == 'plan': data = db['plan'] if type == 'timetable': data = db['timetable'] return data def add_data(id: int, type: str, action: str): with...
#!/usr/bin/env python import code, re try: import here except ImportError: import sys import os.path as op sys.path.insert(0, op.abspath(op.join(op.dirname(__file__), '..'))) import here from pprint import pprint import csv import codecs from cStringIO import StringIO class UnicodeWriter: """...
from django.shortcuts import render, redirect, get_object_or_404 from account.decorators import manager_required from account.forms import User, UpdateUserForm from care_point.forms import UpdateManagerForm from care_point.models import Manager @manager_required def managers(request): managers = Manager.objects.a...
#!/usr/bin/env python3 # call with parameter: MongoDB URI. import random import sys import time import statistics import pprint import datetime from _datetime import date,timedelta from multiprocessing import Process from pymongo import MongoClient, WriteConcern # Number of processes to launch processesNumber = 16 ...
import os import json import requests from bs4 import BeautifulSoup google_image="https://www.google.com/search?biw=1600&tbm=isch&source=hp&biw=&bih=783&ei=r8RAYLO4B-2Z4-EP1_S2uAw&" user_agent={"User-Agent":'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.72 Safari/...
import time class TokenBucket(object): """Implements token bucket algorithm. https://en.wikipedia.org/wiki/Token_bucket """ def __init__(self, fill_rate, capacity): self._fill_rate = float(fill_rate) self._capacity = float(capacity) self._count = float(capacity) self...
from math import * def isPrime(n): i = 2 while(i**2 < n+1): p = n%i if p == 0: #print("% 3d est un diviseur de % d " %(i,n) ) return False i+=1 return True print(isPrime(1001)) #crible à revoir def eratosthene(n): liste = [i for i in range...
# Generated by Django 3.1.1 on 2020-09-26 12:33 from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('auctions', '0010_bookmark'), ] operations = [ migrations.RemoveField( model_name='bookmark', ...
''' Created on 2017. 6. 6. @author: Joonki ''' from rest_framework import serializers from reviews.models import Review, Like, Comment class ReviewSerializer(serializers.ModelSerializer): user = serializers.ReadOnlyField(source='user.userame') class Meta: model = Review fie...
from django import forms from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.hashers import make_password from django.contrib.auth.models import User from django.contrib.auth.forms import UserCreationForm class FormUser(forms.ModelForm): def save(self, commit=True): user = supe...
from jeu import * from ui import * import sys #Pour l'interface from PyQt5 import QtGui, QtCore, QtWidgets, uic #Importations d'éléments de PyQt5 from pygame import mixer import numpy as np import unittest #classes : Entite, Joueur(entite), Ia(entite), Plateau(nd.array), C...
# Generated by Django 3.0.6 on 2020-05-20 22:55 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('authentication', '0015_useractivationtoken'), ] operations = [ migrations.AlterField( model_name='useractivationtoken', ...
from sympy import symbols from .utils import sympify_expr from ..numeric_method import NumericMethod from .utils import error_absoluto, error_relativo class Newton2Method(NumericMethod): def calculate(self, params): tol = eval(params["tol"]) xa = eval(params["x0"]) n_iter = eval(params["n...
import numpy as np from PIL import Image from matplotlib import pyplot as plt im = Image.open('./../image/lena.png') print(im.size) img = np.array(im) # image类 转 numpy print(img.shape) img = img[:,:,0:3] b = img[:,:,0:1] plt.imshow(img, 'Blues') plt.show() plt.savefig('out.png')
# File: train_embedder.py # Creation: Saturday September 19th 2020 # Author: Arthur Dujardin # Contact: arthur.dujardin@ensg.eu # arthurd@ifi.uio.no # -------- # Copyright (c) 2020 Arthur Dujardin # Basic imports import torch import torch.nn as nn import torch.optim as optim from torch.utils.data import Data...
import streamlit as st from PIL import Image import pickle import numpy as np import pandas as pd import time st.set_option('deprecation.showfileUploaderEncoding', False) # Load the pickled model model = pickle.load(open('flight.pkl','rb')) def predict_price(Total_Stops, Jounary_day, Jounary_Month, Deep_hour, Deep_mi...
from PyObjCTools.TestSupport import TestCase import WebKit class TestDOMHTMLElement(TestCase): def testMehods(self): self.assertResultIsBOOL(WebKit.DOMHTMLElement.isContentEditable)
import os import json from logging import * # Rules def createRulesFile(folder, *args): """ Creates the a rules file for the given folder. Args: - folder: string, a path for the folder which we are creating the rule file. - *args: strings, all the rules that will constitute the rules file....
from flask import Flask, jsonify from flask_socketio import SocketIO from flask_cors import CORS from RPi import GPIO from helpers.Database import Database from SerialPort import SerialPort import threading serialPort = SerialPort() GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) app = Flask(__name__) CORS(app) so...
from bs4 import BeautifulSoup as bs from splinter import Browser import requests import pandas as pd import time import re executable_path = {'executable_path': 'C:\\Users\\Murtadha Almayahi\\Documents\\Python Scripts\\chromedriver.exe'} browser = Browser('chrome', **executable_path, headless=False) # NASA Mars News ...
a=int(input("Ingrese el primer numero: ")) b=int(input("Ingrese el segundo numero: ")) print('La receta auténtica del alioli:\n1- Sumar \n2- Restar \n3- Multiplicar \n4- Dividir \n5- Salir') opcion=int(input("Ingrese una opcion: ")) if opcion == 1: resultado=a+b print("el resultado de la suma es",result...
from PIL import ImageGrab import numpy as np import cv2 from .constant import MALE, FEMALE # bgr TEMPLATE_MALE = cv2.imread("./image/male.png", 0) # TEMPLATE_MALE = TEMPLATE_MALE[:, :, 0] TEMPLATE_FEMALE = cv2.imread("./image/female.png", 0) # TEMPLATE_FEMALE = TEMPLATE_FEMALE[:, :, 2] DEBUG_NUM = 0 ...
#!/usr/bin/env python # __author__ = '北方姆Q' # -*- coding: utf-8 -*- import jieba, os, re from gensim.corpora import WikiCorpus def get_wiki_text(): outp = "../../data/wiki/wiki.zh.txt" inp = "../../data/wiki/zhwiki-20190720-pages-articles-multistream.xml.bz2" space = " " output = open(outp, 'w', e...
from django.shortcuts import render, redirect, get_object_or_404 from django.http import HttpResponse from django.contrib.auth.decorators import login_required from .models import Person from .forms import PersonForm from django.core import serializers import json # Create your views here. @login_required def person...
from django.shortcuts import render from django.http import JsonResponse from rest_framework import viewsets from .serializers import UserSerializer from .models import User from rest_framework.response import Response from django.views.decorators.http import require_http_methods import json # Create your views here. ...
import datetime import typing import kubernetes.client class V1ScopeSelector: match_expressions: typing.Optional[ list[kubernetes.client.V1ScopedResourceSelectorRequirement] ] def __init__( self, *, match_expressions: typing.Optional[ list[kubernetes.client.V1Sc...
class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def reverseList(self, head): prev = None while head: curr = head head = head.next curr.next = prev prev = curr return pre...
import os import dbus import XlibGetWindowId import KActivities ####################################################################### # Function returns the window id for the current window # ####################################################################### def _getWindowId(): try: w...
from django.conf.urls import url from . import views urlpatterns = [ url( r'^create-support-survey/$', views.create_support_survey, name='create_support_survey' ), url(r'^support-survey/(?P<pk>\w+)$', views.complete_support_survey, name='complete_support_survey'...
from flask import Flask, render_template, request from flask_wtf import CSRFProtect from config import Config from helpers import df, get_musicbrainz_info, get_my_year_album import wikipedia import requests app = Flask(__name__) app.config.from_object(Config) csrf = CSRFProtect(app) @app.route('/') def index(): list...
# Copyright 2014 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
# Created by MechAviv # [Athena Pierce] | [10200] # Maple Road : Split Road of Destiny sm.setSpeakerID(10200) sm.sendNext("Bowmen are blessed with dexterity and power, taking charge of long-distance attacks, providing support for those at the front line of the battle. Very adept at using landscape as part of the ars...
from django.db import models from django.conf import settings from django.core.validators import FileExtensionValidator from spectra.models import * import os from uuid import uuid4 from django.db import models from django.core.files.storage import FileSystemStorage class OverwriteStorage(FileSystemStorage): def _sa...
import test_runner import time import math import os from odrive.enums import * from test_runner import * teensy_code_template = """ float position = 0; // between 0 and 1 float velocity = 1; // [position per second] void setup() { pinMode({pwm_gpio}, OUTPUT); } // the loop routine runs over and over again for...
# Copyright 2019 Scalyr Inc. # # 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, so...
## https://leetcode.com/problems/climbing-stairs/ class Solution: def climbStairs(self, n: int) -> int: dp = [0]*n return self.Climb_Stairs(0,n,dp) def Climb_Stairs(self,i,n,dp): if i > n: return 0 if i == n: return 1 if dp[...
# Generated by Django 2.2.3 on 2019-07-30 10:43 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('song', '0001_initial'), migrations.swappable_dependency(setting...
def success(x): def _make_continue(k_continue, k_fail): return k_continue(x) return _make_continue def error(x): def _make_fail(k_continue, k_fail): return k_fail(x) return _make_fail def get_account(name): if name == "Irek": return success(1) elif name == "John": return su...
''' Created on Feb 24, 2012 @author: mkiyer ''' import logging import argparse import os import subprocess import xml.etree.ElementTree as etree from base import check_executable, check_sam_file RETCODE_SUCCESS = 0 RETCODE_ERROR = 1 DESCRIPTION = "Chimerascan2 chimeric transcript (gene fusion) discovery tool" DEFAU...
#!/usr/bin/env python # coding: utf-8 # **Imports** # In[ ]: import numpy as np import pandas as pd import random as rnd from os import * import seaborn as sns import matplotlib.pyplot as plt import sklearn as sk get_ipython().magic(u'matplotlib inline') import os # **Data Input** # In[ ]: train_df = pd.read_...
#!/usr/bin/env python test_numbers = [1, 4, 5, 7, 2, 3, 6, 8, 9] def merge_sort(input_numbers): print "merge_sort() input %s " % input_numbers result = [] #terminating condition if len(input_numbers) <= 1: return #divide in half first_half = input_numbers[0:len(input_numbers)/2] ...
from tools.RedisToSession import Session import requests constant = { # token过期时间 'expireTime': 60 * 60, 'mySession': Session(), # 手机userAgent 'mobileUA': 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1', # 电脑...
""" /api/views/legoset.py Views for /legoset """ import re from flask import Blueprint, jsonify, request from api.controllers.auth import authenticate, verify_admin from api.controllers.legoset import search, update_stock_levels from api.errors import FlaskError, exception_json_response blueprint = Blueprint(...
from keras.models import Sequential from keras.layers import Dense, Flatten, Dropout, Conv1D, MaxPooling1D from keras.utils import np_utils from keras.layers.normalization import BatchNormalization def join_windows(x, y, mode = 'alternate'): n_windows, n_samples = x.shape cnn_input = np.zeros((2 * n_windows, n_...
import asyncio import websockets from websockets.exceptions import ConnectionClosedError from processor import Processor from flask import Flask, render_template, request, Response from queue import LifoQueue import threading import json import time class Brain(): def __init__(self): self.channels = {} ...
from helpers.db import Db class RetrieveCompanyData: """Contains all the functions to retrieve the data for the django project Attributes: db (Db): headcount Db instance query (str): query instance """ def __init__(self): self.db = Db('company_headcount/headcou...
import pickle f = open('data.p', 'rb') data = pickle.load(f) print("HELLO FROM load_data.py", data)
x = input() if x == '01' : print('OK') elif x == '02' : print('OK') elif x == '20' : print('OK') elif x == '21' : print('OK') elif x == '22' : print('OK') elif x == '23' : print('OK') elif x == '24' : print('OK') elif x == '25' : print('OK') elif x == '26' : print('OK') elif x == '27' : print('OK') elif x == '28' : pri...
#!/usr/bin/env python # -*- coding: utf-8 -*- # import json import requests from pymongo import MongoClient from InstagramAPI import InstagramAPI # TODO: Fill in username and password InstagramAPI = InstagramAPI("<username>", "<password>") InstagramAPI.login() users = [ 'happycatclub', 'yiyun.zhu', 'dd_ma...
# -*- coding: utf-8 -*- # Import the reverse lookup function from django.core.urlresolvers import reverse # view imports from django.views.generic import DetailView from django.views.generic import ListView # Only authenticated users can access views using this. from braces.views import LoginRequiredMixin from .mode...
import pygame from jeu.fleche import Fleches from jeu.joueur import Joueur class Gestion def __init__ (self): self.score = 10 self.appreciation = "" self.vitesse = 9.81 self.mode = 2 self.musique = ".mp3" self.rythme = 70.5 self.page = 3 ...
import os from collections import defaultdict from datetime import date import shutil # Class object that can hold a file's path and contents, as well as provides a method for returning # the contents of the file with a header and footer class TextFile: def __init__(self, file_name, directory): self.file_...
import numpy as np import sys """This script implements a two-class logistic regression model. """ class logistic_regression(object): def __init__(self, learning_rate, max_iter): self.learning_rate = learning_rate self.max_iter = max_iter def fit_GD(self, X, y): """Train perceptron m...
import Utility as Util from Utility import * from Particle import * import MyGame gPlayer = None gWorldSize = Util.WH gCheckAngle = 0.707 gFriction = 10.0 gMaxSpeed = 60.0 gGround = Util.H * 0.05 gJump = Util.H * 1.8 gVel = Util.W * 0.8 gWalk = Util.W * 0.3 gIncVel = Util.W * 1.6 gDecVel = Util.W * 2.5 gRange = Util....
def my_function(x: int) -> int: """ type hints - truly hints, in the sense that python doesn't enforce them, your IDE may yell at you this means that we expect x to be an integer and it will return an integer """ # could cause issues with inheritance. if type(x) == int: print('yep i...
import sys sys.stdin = open('perfect_square.txt') sys.setrecursionlimit(10 ** 6) T = int(input()) for test_case in range(1, T + 1): N = int(input()) S = [list(map(int, input().split())) for i in range(N)] dp = [[1] * N for i in range(N)] dx = [0, 0, 1, -1] dy = [1, -1, 0, 0] idx = [0, 0] ch...
# -*- coding: utf-8 -*- import scrapy class PatchCategorySpider(scrapy.Spider): name = "patch_category" start_urls = [ "https://www.pathofexile.com/search/results/Content+Update/search-within/threads/forums/366/page/1" ] def parse(self, response): author_page_links = response.css('td....
import urllib.parse from http.cookiejar import CookieJar import json class Site(): def __init__(self, host=None, apiurl='/w/api.php', timeout=100, srlimit=500, apfrom=None, aplimit=5000, bllimit=5000, aulimit=5000, ...