index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
996,800
1bd70b68afbf23af22673ffe3203e643e7eef276
""" The unsigned transaction of setAccount Property (test1, value1): { "transactionJSON": { "senderPublicKey": "6282332ff83fb3ce267157e5a7d04921f0b7f719aad5bf2117561c2ca7850d19", "feeNQT": "100000000", "type": 1, "version": 1, "phased": false, "ecBlockId": "68279388...
996,801
d4f3a0e5e10d877778b7c3735f0c0bedf82a4f63
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function import pylab as plt import netCDF4 import datetime import numpy as np """ Testing the gridded obs-data as forcing data for SnowHow-Crocus modelling. Author: kmunve """ precip_f = r"..\Test\Data\snowhow_pilot\seNorge_v2_0_PREC1h_grid_2...
996,802
55ee354ae04fa2a29b471528e601966f158d3ef9
import matplotlib.pyplot as plt def loss(history): plt.plot(history.history['loss'],'b') plt.plot(history.history['val_loss'],'r') plt.title('Collaborative Filter Loss') plt.ylabel('Loss') plt.xlabel('Epoch') plt.legend(['Train','Validation'],loc='upper right') plt.show()
996,803
9f8eac69a73d32239586841251d5d0649503d5b5
""" AWS S3 Storage backends. We override the backends provided by django-storages to add some small pieces that we need to make our project to work as we want. For example, using ManifestFilesMixin for static files and OverrideHostnameMixin to make it work in our Docker Development environment. """ # Disable abstract...
996,804
9845b7909d0ce7c5c324edfc823cf87d630b0ba9
#!/usr/bin/env python import calendar import datetime import functools import importlib import uuid from flask import jsonify, request import minion.backend.utils as backend_utils import minion.backend.tasks as tasks from minion.backend.app import app from minion.backend.views.base import api_guard fr...
996,805
463c16a1c980915894b73fc8ad3b5db0bdde9816
from urllib.request import urlopen def fetch_words_from_url(): with urlopen('http://sixty-north.com/c/t.txt') as story: story_word = [] for line in story: for word in line.split(): story_word.append(word.decode('utf-8')) print(story_word) if(__name__ == '__mai...
996,806
5d869948e75a17bdc0b05a3fe122cbb5422c1f99
from __future__ import print_function def check_hash(giv_str): h = 7 letters = "acdegilmnoprstuw" for i in giv_str: h = h * 37 + letters.index(i) return h def reverse_hash(h): letters = "acdegilmnoprstuw" ind = [] i = 0 while h > 37: ind.append(int(h % 37)) h /=...
996,807
fc0dfa538824b623ea1d673153669100eb51f4c1
from math import ceil from typing import List, Optional, Tuple import numpy as np import pandas as pd from time_series_expectations.generator.daily_time_series_generator import ( DailyTimeSeriesGenerator, ) from time_series_expectations.generator.time_series_generator import TrendParams class HourlyTimeSeriesGe...
996,808
2c4b2519b277926b42327e40a92807faf645f222
from .iterator import Iterator from .map import map
996,809
71a24f817e08a41dd2f0acbd2154d72dd64f2b89
//push constant 0 @0 D=A @SP A=M M=D @SP M=M+1 //pop local 0 @LCL D=M @0 D=A+D @R13 M=D @SP M=M-1 A=M D=M @R13 A=M M=D //label LOOP_START (LOOP_START) //push argument 0 @ARG D=M @0 A=A+D D=M @SP A=M M=D @SP M=M+1 //push local 0 @LCL D=M @0 A=A+D D=M @SP A=M M=D @SP M=M+1 //add @SP M=M-1 A=M D=M A=A-1 M...
996,810
4d88712fd3ca77ba5eac9355bc4c64e47f5d6f0c
from keras.layers import Input, Lambda, Dense, Flatten from keras.layers import AveragePooling2D, MaxPooling2D from keras.layers.convolutional import Conv2D from keras.models import Model, Sequential from keras.applications.vgg16 import VGG16 from keras.applications.vgg16 import preprocess_input from keras.prep...
996,811
80606e29e34e7de2b4175d931234f84775f15932
__author__ = 'avbelkum' import json import requests class liquidplanner(): base_uri = 'https://app.liquidplanner.com/api' workspace_id = None email = None password = None session = None account_id = None def __init__(self, email, password): self.email = email self.password...
996,812
d8b2c56d997a9f6eab054325e118f1a2e5826dbb
# -*- coding: utf-8 -*- from app.engine_v1 import app_config, logger, image_process_wrap from app.engine_v1.worker import BaseFuncWorker from app.engine_v1.ai_modules.cartoongan_pt import adapter as cartoongan_pt_adapter class CartoonganPtHayaoFuncWorker(BaseFuncWorker): """CartoonganPt Hayao 引擎子进程 """ ...
996,813
d4285afd7c255ffefdccfbc6b216032d48dd593a
import os import configparser class config: """ config.ini object config -- list with ini data default -- if true, we have generated a default config.ini """ config = configparser.ConfigParser() fileName = "" # config filename default = True # Check if config.ini exists and load/generate it def __init__(...
996,814
ccbc13aa937ad176d6a0bd0ae5a83b554a0e0694
from tkinter import * class Application(Frame): def __init__ (self, master): Frame.__init__(self, master) self.grid() self.create_widget() def create_widget(self): Label(self, text='Enter student information.').grid(row=0, column=0, columnspan=3, sticky=S) Label(self, ...
996,815
74dc6caa4735201a2a74b9520b4173c78b9b8e1c
from csl.node import Node import numpy as np import pandas as pd from scipy.optimize import minimize import json import time from threading import Thread class Central_Node(Node): gradients_all_sites = [] current_coefficients = [] global_gradients = [] second_nodes = [] def __init__(self, outcome...
996,816
0e959128ef0d92f6696708ad93b5b8d0d6e5e945
# a = [12,13,14,12,12,14,13,12,14,15] # print(a.count(14)) # li = [5,6,7,9,-1,4,67,89,100,34,12] # print(li[:-4:-1]) # # print(li[:4]) # print(li[4:]) # print(li[4::-1]) # print(li[-1:-4:-1]) # print(li[-4:]) # # print(li[::-1]) # print(li[-1:-4]) #输出[] # print(li[-2:]) # print(li[2:4]) # a = [20,10,40,30] # a....
996,817
7249f147052267f5369d523bdaa2f707454286af
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import array from bisect import * from collections import * import fractions import heapq from itertools import * import math import random import re import string import sys N, M = map(int, input().split()) if N == M: print("Yes") else: print("No")
996,818
24f90f5de02df5eebfef1ad2f7ec2c6d1cadd30a
# -*- coding: utf-8 -*- # Generated by Django 1.10.4 on 2016-12-06 15:16 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): initial = True depe...
996,819
a181cade60d9df91867eda22522dcc60031f4cf4
#!/usr/bin/python # Import the CGI, string, sys modules import cgi, string, sys, os, re, random import cgitb; cgitb.enable() # for troubleshooting import sqlite3 import session import time import datetime #Get Databasedir MYLOGIN="wang1247" DATABASE="/homes/"+MYLOGIN+"/PeteTwitt/pete_twitt.db" IMAGEPATH="/homes/"+MY...
996,820
fddcf5f097b956ab6715a93545dfc5e4598f73df
import numpy as np import pandas as pd from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split from sklearn import linear_model #various new tools we'll be using for this week! :0 from sklearn.preprocessing import LabelEncoder from sklearn.model_selection import cross...
996,821
fd5a46f0ccee2706734e830e59f4d2dec89ed01f
from rest_framework.pagination import PageNumberPagination class StandardResultsSetPagination(PageNumberPagination): """ Classe personalizada para gerenciar a paginacao. http://www.django-rest-framework.org/api-guide/pagination/#pagenumberpagination """ page_size = 100 page_query_param = "pag...
996,822
7599016f5254a03d1692059c44e870e1cc84090e
import re from autograd import jacobian from autograd import grad import autograd.numpy as np from scipy.stats import uniform from surpyval import round_sig, fs_to_xcn from scipy.special import ndtri as z from surpyval import nonparametric as nonp from copy import deepcopy, copy import matplotlib.pyplot as plt from s...
996,823
a9148072db6d1b9d679e3ea8d67bf28e5e2a2174
""" """ import torch import torch.nn as nn import torch.nn.functional as F from models.jointnet.attention2d import MultiHeadAttention2D, conv_for_sequence def expand(img_seq, expansion): if expansion < 2: return img_seq new_seq = [] for idx in range(img_seq.shape[1]): new_seq.append(img_...
996,824
2223aec1e4b37724251b8fc3506645787b877345
from ..mapper import PropertyMapper, ApiInterfaceBase from ..mapper.types import Timestamp, AnyType __all__ = ['Related', 'RelatedInterface'] class RelatedInterface(ApiInterfaceBase): name: AnyType id: int type: AnyType class Related(PropertyMapper, RelatedInterface): pass
996,825
dbccf38dd819e947232e5cef74eb52ff5709f46c
# Given a list of numbers and a number k, return whether any two numbers from the list add up to k. # For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17. # Bonus: Can you do this in one pass? array = [10, 15, 3, 7] k = 16 array.sort() print(array) def doNumbersAddUp(array, k): for i ...
996,826
39ba870f705f9edb3932fbea0c902182891062bb
from django.http import HttpResponse from django.shortcuts import render def home(request): return render(request,'home.html') def count(request): s = request.GET['fulltext'] count = [x for x in s.split(' ')] if count[0]!='': l = len(count) return render(request,'count.html',{ 'l' : l,...
996,827
e9ecc0a06269ca7b2e9b02c4bb224b2c92cbf32c
""" Simulator session base class for bonsai3 library """ __copyright__ = "Copyright 2020, Microsoft Corp." # pyright: strict import abc import logging import sys import numpy as np import signal import time from functools import partial from types import FrameType from typing import Dict, Any, Optional, List import...
996,828
fde23e8d38fdc0f4c083b002217088a5f6fe32fa
"""This file contains functions to randomly generate mazes. The main function in this file is generate_random_maze_matrix(), which generates a maze with no dead ends and no open squares. """ import numpy as np # Maximum iteration through a while loop _MAX_ITERS = int(1e5) def _get_neighbors(size, point): """Ge...
996,829
ab806de07d36635a59e031b610df681023383076
import plotly.express as px import csv import numpy as np def getDataSource( data_path): marks_In_Percentage = [] days_Present= [] with open(data_path) as csv_file: csv_reader = csv.DictReader(csv_file) for row in csv_reader: marks_In_Percentage.append( flo...
996,830
4aaeab4316c3a6bc95edf87068fde3f5c7c537b3
# -*- coding: utf-8 -*- from PyQt5 import QtWidgets from src.ui.main_ui.UiMain import UiMain if __name__ == '__main__': import sys app = QtWidgets.QApplication(sys.argv) MainWindow = UiMain() MainWindow.show() sys.exit(app.exec_())
996,831
477e3dc397ea14d7cf57b9698384ca1710dfbed0
x = min(inp[2*cur+2], inp[2*cur+1]) inp[cur] = x inp[2*cur+1] -= x i
996,832
8e8bf0475245def7ea91df0d00778c5ae43ab658
from django.urls import path from . import views urlpatterns = [ path('', views.carros, name='carros'), path('<int:id>', views.car_detalle, name='car_detalle'), path('search', views.search, name='search'), ]
996,833
e3e76a7a012188beb4426b0f036fe1206d8b7261
#!/usr/bin/env python # encoding: utf-8 """ filter-hospitals.py Created by Christian Swinehart on 2019/11/26. Copyright (c) 2019 Samizdat Drafting Co. All rights reserved. """ import os from csv import DictReader, DictWriter _root = os.path.dirname(os.path.abspath(__file__)) def main(): # read in the whole huge cs...
996,834
ed7114f96a31a9c34e7f85baed34fe19f612704a
''' Here we train spell checker model which is Seq2Seq model based on different operations in 2 Levenstein len ''' from zipfile import ZipFile, ZIP_DEFLATED from io import BytesIO import torch import time import numpy as np import math import yaml import shutil import sys import random import re import os import tran...
996,835
a8333756ca8a2856aefe89a4af6986e9dc3f0845
# -*- coding: utf-8 -*- """ProtSTonKGs model architecture components.""" from __future__ import annotations import logging from dataclasses import dataclass from functools import lru_cache from typing import Optional import torch from torch import nn from transformers import ( BertModel, BigBirdConfig, ...
996,836
0043280a430bdf989b4a829aeea0d46d670b35bc
#-*- coding: utf-8 -*- #https://habrahabr.ru/post/280238/ #http://www.stoloto.ru/ruslotto/game #-*- coding: utf-8 -*- from bs4 import BeautifulSoup import sys #import lxml #import requests #try: #f=open('/home/user/work/parsers/lot/raw4.html','r') #f=open('raw3.html','r', encoding='utf-8') f=open('raw4.html','r')...
996,837
0b977a4dc33c23f2edec69fd3b8277022bb7436e
a = [1,3,4,5] print(a.index(3)) print(a[1:]) # def maxSubArray(nums): # f = [nums[0]] # for i in range(1, len(nums)): # f.append(max((f[-1]+nums[i]), nums[i])) # print(f) # return max(f) # maxSubArray(a)
996,838
2ef516b223f7dc502ee78a21a33bbc7455e0dd50
num_string = input('Input number: ') print(int(num_string)) print(float(num_string))
996,839
dfd120591734b9e834c681a74212c13d1423d21c
r_type = {} r_type["add"] = {} r_type["add"]["opcode"] = "0110011" r_type["add"]["funct3"] = "000" r_type["add"]["funct7"] = "0000000" r_type["sll"] = {} r_type["sll"]["opcode"] = "0110011" r_type["sll"]["funct3"] = "001" r_type["sll"]["funct7"] = "0000000" r_type["srl"] = {} r_type["srl"]["opcode"] = "01...
996,840
a8f8b931c2b2bf87b51dff4e099a69ead98f3637
default_app_config = 'algorithm.apps.AlgorithmConfig'
996,841
343d30726daac5e552a2de410c7e6f65ae352e51
#for extracting specific content from tsv files import csv #cols is a list of numbers which specify which columns should be extracted def extractColumns(path, cols, name): with open(path, 'r') as tsvin, open(name, 'w') as t: tsvin = csv.reader(tsvin, delimiter='\t') tsvout = csv.writer(t, delimite...
996,842
9d90940de1cee65dffa97ac35dea54b6b3357aa5
# -*- coding: utf-8 -*- # # This file is part of compono released under the Apache 2 license. # See the NOTICE for more information. from django.conf import Settings from django.template import Library, Node, Template, TemplateSyntaxError from mtcompono.models import Page, Type register = Library() class ListTypeNo...
996,843
46627acccbff0c29473e2dbcd9c23f93a368ac96
#!/usr/local/bin/python3 def fib(n): arr = [0, 1] for i in range(2,n+1): arr.append(arr[i-1] + arr[i-2]) #print(arr) return arr[n] #print(' '.join([str(fib(x)) for x in range(5)])) #print (list(map(lambda x: fib(int(x))**3, [i for i in range(int(input()))]))) #print (list(map(lambda x: x**3, ...
996,844
3bc159ca0bf99c9916b53007f87275c80bc63be4
from django.shortcuts import render, get_object_or_404 from .models import Listing from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator from .choices import price_choices, bedroom_choices, state_choices # Create your views here. def index(requests): listings = Listing.objects.order_b...
996,845
660c50b826aab7ae0f0456702e4a238ecae59923
# Generated by Django 2.0.4 on 2020-11-20 19:02 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0002_auto_20201120_1632'), ] operations = [ migrations.RenameField( model_name='tracker', old_name='route', ...
996,846
1d08d358e2f1674fa2045e33fce057e15f75a358
import pandas as pd from scipy.interpolate import interp1d import numpy as np import matplotlib.pyplot as plt from keras.models import Sequential from keras.layers import Dense, LSTM, Dropout from keras.layers.advanced_activations import LeakyReLU def sub_Sampler(sample, subSampleLength): ''' Pass a window of...
996,847
c0607656e12ed3ce924e48c839603f0954374588
"""Change EHR analysis to work with SQLite database.""" import datetime as dt import sqlite3 import os DAYS_IN_YEAR = 365.25 """Create database to store data and open connection""" if os.path.exists("ehr.db"): os.remove("ehr.db") con = sqlite3.connect("ehr.db") def parse_patient_data(filename: st...
996,848
3f76f62b60cf04214b9794384b388cb81d4f64a8
from src.collect.google.get_places_from_google_api import get_google_places_for_current_of_higene_data_establishments from src.collect.google.combine_to_overall_and_comments import combine_google_found_to_overall from util import setup_logger google_logger = setup_logger("google") def get_and_combine_to_overall(): ...
996,849
c0271f309da2be7d5c93a5e2d2177ff421883953
#-*- coding=utf-8 -*- #author: zhihua.ye@spreadtrum.com """ 1. assemble sipp cmd sipp -sf reg.xml -p 5060 -t u1 -m 1 -trace_err 2. assemble tmtc cmd echo -n "c-reg" | busybox nc 127.0.0.1 21904 """ import sys import json import os from logConf import * from utjsonparser import * from time import gmti...
996,850
ca95509c5264c6257a233f094ad448358fcb2ff2
Spelling checker in Python For any type of text processing or analysis, checking the spelling of the word is one of the basic requirements. This article discusses various ways that you can check the spellings of the words and also can correct the spelling of the respective word. ## Using textblob library...
996,851
56b1d183e0781351833a6e2a30e8e5aff899e436
import psycopg2 import os from urllib.parse import urlparse url = urlparse(os.environ['DATABASE_URL']) dbname = url.path[1:] db = psycopg2.connect(dbname=dbname, user=url.username, password=url.password, host=url.hostname, port=url.port)
996,852
8d24fc1ed4f59a01c2fe28a614697ac5bd0ac969
def check_equal(str1, str2): return str1 == str2 str1 = 'hei' str2 = 'hello' str3 = 'hello' print(check_equal(str1, str2)) print(check_equal(str3, str2))
996,853
ffee632df6dd2467eaaba69ada94a059fcba73cb
from my_home_server.models.user import User class AuthenticationContext(object): __authentication_context = None @staticmethod def init_context(user: User): AuthenticationContext.__authentication_context = AuthenticationContext() AuthenticationContext.__authentication_context.current_use...
996,854
9c65b135d6566e780f451c5e1e4efb690576b323
from enum import Enum from pydantic import BaseModel class MyException(Exception): pass class Index(str, Enum): KeyRate = "Ключевая ставка" USD = "Курс USD" EURO = "Курс EURO" CurrencyRate = "Курс обмена" class Information: def __init__(self, dt): self.name = None self.date ...
996,855
35301682e0ed9e4fb98ee66a673f51f12b62fb59
import argparse import cv2 import matplotlib.pyplot as plt import key_feature_extraction as key def setup_cli(): parser = argparse.ArgumentParser() parser.add_argument("path") parser.add_argument("-c", "--canny", action="store_true") parser.add_argument("-d", "--distance") parser.add_argument("-f"...
996,856
a3ade0a1697fde66c59795fa8aa20162ff8a8ab3
import numpy as np from progressivis.core.utils import (slice_to_arange, indices_len, fix_loc) from . import Table from . import TableSelectedView from ..core.slot import SlotDescriptor from .module import TableModule from ..core.bitmap import bitmap from .mod_impl import ModuleImpl from .binop import ops from collec...
996,857
57421a8355d18c2893a9b8f6326c9526663e1904
# -*- coding: utf-8 -*- """ Created on Mon May 21 15:22:39 2018 @author: Ramsey """ import numpy as np import matplotlib.pyplot as plt # get a bifurcation plot of x^2+c # start with x = whatever, maybe 0? def func(x, c): return np.multiply(x,x) + c lower_bound = -2 upper_bound = .25 step_size =...
996,858
27995f9d9a2c76eea33d8e70204fd5e687f5e489
arr = input().split(' ') (a, b) = tuple((int(x) for x in arr)) area = a * b circumference = (a + b) * 2 print(area, circumference)
996,859
dc047277174409e061d51dbdfff9ba635888c9db
#!/usr/bin/env python3 import numpy as np import pytest from sklearn.neighbors import NearestNeighbors import deann import sys from extern.brute import BruteNN from extern.faiss import FaissIVF import time def gaussian_kernel(q,X,h): return np.exp(-np.sum((q[None,:]-X)**2,axis=1)/h/h/2) def exponenti...
996,860
0dc5e6c58f0d10a7c61075ae933703c4a990f359
print "The %(foo)s is %(bar)i." % {'foo': 'answer', 'bar':42} print("The {foo} is {bar}".format(foo='answer', bar=42))
996,861
7bfee06201d235ff4de39f188414bc7b61fc6dcf
import re re.search('n','\n') #first item is pattern and second item is string #when we run above code , we did'nt get anything because in python '\n' means new line, it is not #two character , it is a single character i.e new line re.search('n','\\n') #But when we give double \\ we will get the result, so a e...
996,862
8419f0225e4b5bbafd79d433faf727a81ef922d5
import cgi #dates months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] def valid_month(month): if month.title() in ...
996,863
4df7f4c758cbe6af348d7bd33737eb4c75447e87
def delete(): conn = sqlte3.connet("tasklist.db") c = conn.cursor c.execute("DELETE FROMtaska WHERE oid=" + delete_box.get()) delete_box.delete(0, END) # commit changes conn.commit() # close connection conn.close
996,864
7b106035a1b14d413ef6481fe3cf19d0a4c5f92c
import requests from flask import url_for from application.core.constants import LANDING_MESSAGE # ACCESS_TOKEN = os.environ['ACCESS_TOKEN'] ACCESS_TOKEN = 'EAACy5fCj3rgBAP98hkUBZB2GCgecTnWfPz1b47b0SeLSq2QZAD8lvJxZCrnNlxrvuEQV3vVxqQ3CNER49BZCTlAlBvPMx6XX0f8K8cPGF9cQvXgJwboPLVwJPxOuMrZAAWl2AFaCSFJ2EROyhPEVxv0hfiZClq...
996,865
6456ec6e482bcec0d8f8bb29b1552d6a64bc8a08
#!/usr/bin/env python import time import serial class car: def __init__(self, port = '/dev/ttyACM0',baud_rate = 9600): try: self.car = serial.Serial(port, 9600) print "Arduino connected on port {}".format(port) except (RuntimeError, TypeError, NameError): print "...
996,866
1a02545ad87d5b3eb7d6684b94aab0b39eb816eb
import os import requests import git import shutil from getpass import getpass ORG = 'EC327-Fall2019' def parse_students(): students = [] student_count = 0 while True: filename = input("Enter the path to your usernames file: ") if os.path.exists(filename): break print("Invalid file") with open(filename, ...
996,867
a7ca18c6fefb9afdec3d94a3ab85a668c8e9ed85
# Fails : 181. py # Autors : Egils Keišs # Apliecibas numurs : 181REB314 # Datums : 03.12.18 # Sagatave funkcijas saknes mekleeshanai ar dihatomijas metodi # -*- coding : utf -8 -*- from math import cos, fabs from time import sleep def f1(x): return ((x*x)+x+1)/((cos(x)*cos(x)+0.1) h=0 a = 0.; b = 6.2832 I1 = 0. ...
996,868
cf6f19680bfe942e813a3e922b207c7be9cf8b54
# -*- coding: utf-8 -*- import datetime from django.db import transaction from django.db.models import Q from django.shortcuts import render, get_object_or_404 from django.contrib.auth.decorators import login_required from django.contrib import auth, messages from django.shortcuts import render from django.http import...
996,869
c6dce336c8ea75fabfab3eb538b8232e7ed789f3
from django.db import models from django.contrib.auth.models import User class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='profiles') country = models.CharField(max_length=250, blank=True, null=True) b_day = models.DateField()
996,870
b951349dd94a0d15dacfe36c9cc7f8e744fbfaee
#!/usr/bin/env python # coding: utf-8 # # Training a ConvNet PyTorch # # In this notebook, you'll learn how to use the powerful PyTorch framework to specify a conv net architecture and train it on the human action recognition dataset. # # In[30]: #ip install -r requirements.txt # In[1]: import torch import t...
996,871
cf0ab04f13d89f1d9a214857e0ddf6d434343b55
# file: intersect.py """ Measuring the time for searching in a list and a set including creation time of the data structure. """ import timeit from searching import compare def intersect_list(n): """Measure the run time for intersecting two lists. """ list_a = range(n) list_b = range(n-3, 2 * n) ...
996,872
a781d858c1e8c02c4bd691f9fe847fe576644d9a
from mongodm.base import BaseDocument class Document(BaseDocument): pass class EmbeddedDocument(BaseDocument): pass
996,873
1edec8277868635625b27a27dd4f1a269c1df6c7
from TrainOfHope import os, db from datetime import datetime class Event(db.Model): __tablename__ = "events" id = db.Column(db.Integer, nullable=False, primary_key=True, autoincrement=True) title = db.Column(db.Text,nullable=False) location = db.Column(db.Text,nullable=False) description = db.Co...
996,874
86e69cc691520d41209e9e3b1062ab281b93a296
#! C:\Users\Gherardelli\Documents\PortableApps\WinPython\python-2.7.10\python.exe ''' Define authentication and other basic functions for Twitter interaction ''' import twitter, json, os CONSUMER_KEY = "" CONSUMER_SECRET = "" ACCESS_TOKEN = "" ACCESS_SECRET = "" def t_auth(consumer_key, consumer_secret, access_token,...
996,875
1362a720abe444302c291ca65723fee7189fd0be
import gdata.youtube import gdata.youtube.service from urlparse import parse_qs, urlsplit from sciencecombinator.settings import YOUTUBE_SECRET_KEY from science_combinator.models import AcceptedCategory class YoutubeService(object): def _is_valid_video(self, video, categories): cat = video.media.catego...
996,876
8e0af4d27d8355f231a4029ec90694e86405c0d5
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Tests for LLVM benchmark handling.""" import re import subprocess import tempfile from pathlib import Path import gym import pytest from c...
996,877
0daeed2ec34474a3e16f8ba2d1dedb98bfc0abfb
from flask import Flask, render_template, flash, redirect, request, url_for from flask_mqtt import Mqtt from flask_socketio import SocketIO import ssl import subprocess import atexit import time import json from config import * # Activate python enviroment: # source venv/bin/activate # Deactivate python enviroment: #...
996,878
5ea4f36b0bdd255c3b0b2cb41468d0c8f7ce269f
#!/usr/bin/python3 import linecache import ovirtsdk4 as sdk import argparse import threading import time cracked = False def ovirt_login_wrapper(url, username, password): return sdk.Connection(url=url, username=username, password=password, ...
996,879
4155a5365df16ba7608d1cf669befaca6d7b1b57
def powerof2(n): # base cases # '1' is the only odd number # which is a power of 2(2^0) if n == 1: return True # all other odd numbers are not powers of 2 elif n%2 != 0 or n == 0: return False #recursive function call return powerof2(n/2) # Driver Code...
996,880
69f054f4823c62780e974cb7b2ef786e80d8db85
import mxnet as mx import cv2 from collections import namedtuple from os.path import join from mxnet import nd import numpy as np import pdb import matplotlib.pyplot as plt import sys ##from dataset_loader import DatasetLoader def format_image(image): '''Detecte face (using OpenCV cascade classifier) from given fr...
996,881
21c9d83241175693af3598597a21bb1a8e3623ab
import numpy as np import pandas as pd from pandas import DataFrame, Series import praw import re import time rscotch = pd.read_csv('rscotch.csv') new_cols = rscotch.columns.values new_cols[1] = 'name' new_cols[3] = 'link' new_cols[2] = 'user' for i in range(len(new_cols)): new_cols[i] = new_cols[i].lower() rscot...
996,882
c3e00c28f488cda379c3168cd09f0d1295da33ba
#!/bin/env dls-python from pkg_resources import require require("mock") require("cothread") import unittest import sys import weakref import os import cothread import logging #logging.basicConfig(level=logging.DEBUG) # Module import sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..")) from malcolm.core....
996,883
a0d2b29b5baac76ca6fb50dd4097121fb44b457a
# Generated by Django 2.0.1 on 2018-01-31 01:05 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('main', '0012_auto_20180130_1922'), ] operations = [ migrations.AlterField( model_name='event', name='maps_url', ...
996,884
f42c5c9dcec1e8d01deb1c54aecc9df5392c26b7
from colors import PICO_DARKGRAY, PICO_PINK, PICO_WHITE from v2 import V2 from animrotsprite import AnimRotSprite import random import math import particle import bullet import helper from healthy import Healthy FLEET_RADIUS = 15 TARGET_POWER = 4 FLEET_HEADING_POWER = 1 FLEET_SEPARATION_POWER = 1 FLEET_SEPARATION_DEG...
996,885
8ebe10b35e358eb2dcef80d741d69d3bf59ed6da
#!/usr/bin/env python # -*- coding: utf-8 -*- """Set de funciones para normalización de textos. Created on Wed Aug 20 2014 Modified by analysis on Thu Aug 28 2014 Finish on (esto espera a que termine el experimento 14) .. version: 0.2 .. release: 0.2-RC1 .. author: Abel Meneses abad """ import re, os import string L...
996,886
6777a215f3284cdb9e7d206295c53516661467bf
import inspect import os import shutil import luigi projdir_struct = { 'bin':None, 'conf':None, 'doc' : { 'paper': None }, 'experiments' : { '2000-01-01-example' : { 'audit':None, 'bin':None, 'conf':None, 'data':None, ...
996,887
436d6b72eb2b0623fe5d9eb5cbd83a97e438a3ad
import math import numpy as np import matplotlib.pyplot as plt def graph(formula, first, last): x = np.linspace(first,last,100) y = eval(formula) plt.plot(x, y) plt.show() common = 0 degree = 0 data = [] numofnums = input("How many numbers are there? ") for x in range(numofnums):...
996,888
d29de7d1b69180ec93bfb1e67a02f3a91f753ebe
#!/usr/bin/python3 """number_guess.py, an implementation of the number guess task""" __author__ = "Steve McGuire" __contact__ = "s.mcguire@hud.ac.uk" import random secret_number = random.randint(0, 101) print(secret_number) counter = 1 while True: try: response = int(input("Please guess a number")) ...
996,889
b2d378bdcae8d24e60401dd27093d96219dc6e8f
# Jesse Nayak # jdn4ae # 2/22/15 # helper.py def greeting(msg): print(msg)
996,890
fe3b209f3f56de522c51dc7dbeab03f834ee370d
from models import Balances, Member, Charity, Team, TeamMemberList, Invite from django.core.exceptions import ObjectDoesNotExist #Gets every balance associated with the user def getAllBalance(user): member = Member.objects.get(user=user) #get member from current user balances = None try: balances =...
996,891
527a91169240bb5d7ba72a2dc4a4b0458f020a84
# this is a 1 line comment """This is a multiple line comment""" print("Hello World") name = "John Doe" _age = "20 years old" grade = 100 # _age = 30 location = "I'm from Philippines" location2 = 'I\'m from Japan' message = "My name is " + name add = 100 + 200 print(add) print(message) print(name) print(_age) print(...
996,892
aa708eb91cdda73c6c19d3bc2da8be172620cc5c
# Author: Charse '''支持向量机(回归) ''' import numpy from sklearn.datasets import load_boston from sklearn.model_selection import train_test_split from sklearn.svm import SVR from sklearn.preprocessing import StandardScaler from sklearn.metrics import mean_squared_error, mean_absolute_error # 从读取房价数据村粗在变量中 boston = load_b...
996,893
3de5ab8587f884634a8d19943c28a3fcbe450a65
import pygame from chess.constants import WIDTH, HEIGHT, CELL_SIZE, BLACK, button_font, RED, GREEN from chess.board import Board import sys pygame.init() FPS = 60 WIN = pygame.display.set_mode((WIDTH, HEIGHT)) pygame.display.set_caption("Chess") clock = pygame.time.Clock() clock.tick(FPS) events = None def text...
996,894
9940e52581635e4f85e53b25ea91e382f387e7de
# -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incor...
996,895
00b45fa4b6d754bbea965ca74279bdd935c661ac
#8.14 def game_info(tytuł, gatunek, **cechy): """Pokazuje informacje o grze.""" gra = {} gra['Tytuł'] = tytuł gra['Gatunek'] = gatunek for k, v in cechy.items(): gra[k] = v return gra gra = game_info('LoL', 'MOBA', Wydawca='Riot Games') print(gra)
996,896
9cf98933a0f86babe4a6647f1298b11114f55019
############################################################################### # # # Dense.py # # J. Steiner ...
996,897
4747c7f5f3f776e3e8067d685efd973ad3285e7d
import ctypes from ctypes import wintypes import time user32 = ctypes.WinDLL('user32', use_last_error=True) INPUT_MOUSE = 0 INPUT_KEYBOARD = 1 INPUT_HARDWARE = 2 KEYEVENTF_EXTENDEDKEY = 0x0001 KEYEVENTF_KEYUP = 0x0002 KEYEVENTF_UNICODE = 0x0004 KEYEVENTF_SCANCODE = 0x0008 MAPVK_VK_TO_VSC = 0 # msdn...
996,898
42c3c5b61ab1bdf9dfb0a2747ed3530b2ce49a66
# # Copyright (c) 2015 Conrad Dueck # # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list...
996,899
a085bb994bc0eaafe69f307ce5a78d0cb2bd1bae
#!/usr/bin/env python import sys import string #takes a list of pdbs with characters of the chains you want to keep # example 1uad.pdb A,C if __name__ == '__main__': pdbchainlist = open(sys.argv[1]) for eachline in pdbchainlist: if len(eachline) < 2: print "Line is empty. Moving on..." ...