index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
14,300 | 9f890442735b41559fb7d60792070073857eda23 | # open("aniket.txt")
f = open("aniket.txt")
print(f.readlines())
#print(f.readline())
# content = f.read()
# f.read()
# for line in f:
# print(line , end="")
#print(content)
f.close() # you should always close file |
14,301 | 3d47ce1678ddca391bd2d771714154a9ac486888 |
from scrapy.mail import MailSender
mail = MailSender(
) |
14,302 | 01e0718b5e991c4e62d47ec058260b7ced37f830 | """ 23. Write a Python program to check a list is empty or not."""
print("Question 23")
l1 = []
l2 = ['ram', 'sita', 'hari', 'ram', 'sita', 'gita']
def check_list(l):
if not l:
print("LIST EMPTY")
else:
print("LIST NOT EMPTY")
print(check_list(l1))
|
14,303 | a977b875647aed4d2105bae159f96b73b1ac11d5 | import numpy as np
import sys
import os
import sys
sys.path.append('src')
from scipy.constants import c, pi
from joblib import Parallel, delayed
from mpi4py.futures import MPIPoolExecutor
from mpi4py import MPI
from scipy.fftpack import fftshift, fft
import os
import time as timeit
os.system('export FONTCONFIG_PATH=/et... |
14,304 | bf0ca858106411ec25275f6b53817521cf100b7b | import copy
import autoarray as aa
from typing import Tuple
class SettingsImagingCI(aa.SettingsImaging):
def __init__(
self,
parallel_pixels: Tuple[int, int] = None,
serial_pixels: Tuple[int, int] = None,
):
super().__init__()
self.parallel_pixels = pa... |
14,305 | 39888403c0b9d00eca6b87fd02f5e860c4a20223 | class ExcelReadError(BaseException):
pass
|
14,306 | 4a095ee119e28347f1bf95207a0346db95545a7a | import os
import copy
import time
import numpy
from PyRED.files import read_behaviour
from PyRED.tasks.generic import TaskLoader
class QuestionnaireLoader(TaskLoader):
"""Class to process files from the RED questionnaires.
"""
def __init__(self, data_dir, output_path=None, task_name="Q1_Questi... |
14,307 | e6444c10192ebc71a809213bcff0e045c63632d6 | #!/usr/bin/env python
'''
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import pyglet
import input
devices = input.get_devices()
show_all = True
window = pyglet.window.Window(1024, 768)
batch = pyglet.graphics.Batch()
class TrackedElement(object):
def __init__(self, element):
self.elem... |
14,308 | 4ca6119a243a3727d9582fc650eaf7f8067b9079 | # Copyright 2016 Google Inc. 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 required by applicable law or ag... |
14,309 | 38e4c0ec6c162fb0f006421c9546eec7bb54d269 | '''
You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1's elements in the corresponding places of nums2.
The Next Greater Number of a number x in nums1 is the first greater number to its right in nums2. If it does not exi... |
14,310 | 168895b37206e2e37b2372ce933e6156df6472c5 | # License: BSD 3 clause
import unittest
from itertools import product
import numpy as np
from tick.base.inference import InferenceTest
from tick.linear_model import SimuPoisReg, PoissonRegression
from tick.simulation import weights_sparse_gauss
class Test(InferenceTest):
def setUp(self):
self.float_1 =... |
14,311 | 8ff04450d415e796640a38ad7f7f207bb5a40b01 | import random
def stunned():
messa = ["Did You See Those Stars?","Whhhhaaaaaa!!!!",
"Why Is There Two Of Em Now!?!","Check Please.",
"Eeny, Meeny, Miny, Whoaaa!!","Is There Doctor In The House!"
]
print(random.choice(messa))
hit=0
return hit
stat_switch={
... |
14,312 | 2340eb3fdacc3b40d416d34d5ccb8f1176407254 | # -*- coding:utf-8 -*-
# author yuzuo.yz 2017/7/26 20:38
# dict 字典map构建函数
jsonObj = dict(name="kaka", age=10, title="player")
# 类似json赋值的方式构建dict对象
dict2 = {
'name': 'messi',
'age': 22
}
print jsonObj
print dict2
print type(jsonObj)
print dir(jsonObj)
print type(dict2)
print dir(dict2)
a = dict()
a["a"] = "... |
14,313 | 82dc8b6ac8a28e505a9f3265bdf91db39c4bffdb | from __future__ import print_function
import os
import yaml
import FWCore.ParameterSet.Config as cms
import FWCore.ParameterSet.VarParsing as VarParsing
def parser(yml_file=None):
cmssw_base = os.getenv("CMSSW_BASE")
# command line options parsing
options = VarParsing.VarParsing()
options.register('... |
14,314 | 3b7e06a5382f2b67cd961ac716943a0b2f1a6ee8 | #!/usr/bin/env python3
from problems import *
from vectors import *
import sys, os
vector_content = ''
with open(sys.argv[1]) as file:
vector_content = Vectors(file.readlines(), sys.argv[6], sys.argv[5])
for access in os.listdir(sys.argv[2]):
if access.endswith('.txt'):
print(access)
with open... |
14,315 | c2730f3a1460be9ab9758eb34a0bb0427daf0d8f | import sys
from collections import deque
n = int(sys.stdin.readline())
d = deque()
for i in range(n):
d.append(i+1)
while len(d) > 1:
d.popleft()
d.append(d.popleft())
print(d.pop())
|
14,316 | 560a45acb8f20b8221f151582949bbd89c384adb | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Palestra',
fields=[
... |
14,317 | 91aa366b108031148a292ee33859733bdf332582 | """Base functionality for parsers."""
from abc import ABC, abstractmethod
from typing import Any
class Parser(ABC):
"""Base parser class."""
@abstractmethod
def __call__(self, config: Any):
raise NotImplementedError()
class ChainParser(Parser):
"""A parser that applies parsers sequentially... |
14,318 | adbe6cf635a0ec97b1620334c62e9f8381b3581d | import numpy as np
import os
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
from spikesorting_tsne.spikesorting_tsne import constants as ct
import pandas as pd
def _get_relevant_channels_with_threshold(threshold, template):
amplitude = np.nanmax(template) - np.nanmin(template)
points... |
14,319 | 66f6070b1cbf5a2715a175cc17eebb1aaf4c772e | import nltk
import codecs
from num2words import num2words
from nltk.stem.snowball import PortugueseStemmer
import string
import pickle
import numpy
import re
import json
from gensim.models import KeyedVectors
from nltk.stem import WordNetLemmatizer
import pandas as pd
import math
import wordnet
_stemmer = PortugueseSt... |
14,320 | d6f44df6cd7cf8adc02bb50f92e03b57b84f3ed9 | #sum of fibnocci sequence in a given range using for loop
def fibnocci_sum(n):
a=0
b=1
s=a+b
for i in range(2,n):
c=a+b
s+=c
a=b
b=c
return s
n=int(input())
print(fibnocci_sum(n))
#sum of fibnocci sequence in a given range using while loop
def fibnoc... |
14,321 | 716909da20865f8f42ecd388262c941ebda84a9c | """Derived / analysis assets that aren't simple to construct.
This is really too large & generic of a category. Should we have an asset group for each
set of related analyses? E.g.
* mcoe_assets
* service_territory_assets
* heat_rate_assets
* state_demand_assets
* depreciation_assets
* plant_parts_eia_assets
* ferc1_... |
14,322 | a6f0e9220b7fc6b428d0dd58d39c7748b9926bb1 | from __future__ import absolute_import
from __future__ import unicode_literals
from datetime import date
import hashlib
from dateutil.relativedelta import relativedelta
from corehq.apps.locations.models import SQLLocation
from corehq.apps.userreports.models import StaticDataSourceConfiguration, get_datasource_config
... |
14,323 | c63d9281e8fd8b1e6b62974083010d809ac4b505 | import unittest
import os
import time
import requests as bare_requests
from utils.requests import RequestsWrapper
from utils.metrics import timer
from copy import deepcopy
from unittest.mock import patch
HTTPBIN_URL = os.getenv('HTTPBIN_URL', "http://localhost:8000")
requests = RequestsWrapper()
def test_wrapper(fu... |
14,324 | 8f1f1a04e60bc5c21a8bd6d15acd21d6b2c1a2b1 | from itertools import groupby
from operator import itemgetter
from django.forms import BaseInlineFormSet
from core.models import RepeatingScrumEntry, JournalEntryTemplate
class ScrumEntryInlineFormSet(BaseInlineFormSet):
def __init__(self, *args, **kwargs):
if kwargs['instance'].pk is None:
... |
14,325 | d9dccd0406eec674f27e80d92eee244a1dcb3359 | def string_bits(str):
x=len(str)
l=""
i=0
while i<x :
l=l+str[i]
i=i+2
return l
print(string_bits('Hello') )
print(string_bits('Hi') )
print(string_bits('Heeololeo'))
|
14,326 | a11478d86fed5658c00a0cddaf146f3cd64dbfe4 | import sys,re,json,operator
from os import listdir
from os.path import isfile, join
docs={}
actors={}
def readMetadata(nameFile):
global docs, actors
file=open(nameFile)
for line in file:
cols=line.rstrip().lower().split("\t")
if len(cols) > 12:
id=cols[0]
fbid=cols[10]
actor=cols[12]
name=cols[3]
... |
14,327 | 1bd038809feab8db26ff641e1ef94337d038cadb | def SortColors(nums):
zeros = 0
ones = 0
twos = len(nums)-1
while ones <= twos:
if nums[ones] == 1:
ones += 1
elif nums[ones] == 0:
nums[zeros], nums[ones] = nums[ones], nums[zeros]
zeros, ones = zero... |
14,328 | 8387ef8e7803792aacd562748ae6217b8e2707bd | from flask_mail import Mail, Message
from flask import Flask,render_template,request
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://root:@localhost/bugtracking'
db = SQLAlchemy(app)
class userid(db.Model):
'''
sno, name phone_num, msg, date, ema... |
14,329 | 47decb45d173846eb77af2e8161dd6d08aee85df | import sys
sys.path.append("../model")
sys.path.append("../data")
import numpy as np
import model_params, load_data
# params
params = model_params.BAI_PARAMS
def generate_test_data(dataset, inp_lang, targ_lang):
# init data and dict
# print("<start> id:", inp_lang.word2idx['<start>'])
# print("<end> id:"... |
14,330 | 97a53d24bf4c7a4a36354d4169c7a2a1845c499b | import numpy as np
def gcd(a,b):
if a % b == 0:
return b
return gcd(b, a%b)
N, X = map(int, input().split())
x = list(map(int, input().split()))
s = np.array(x)
s = abs(s-X)
if len(s) == 1:
print(s[0])
exit()
for i in range(1, len(s)):
if i == 1:
D = gcd(s[i],s[i-1])
D = gc... |
14,331 | bbcc481f6bcd4b99b151ef24426c60fa9ef9d43f | def level_order(root: int):
# 队列
q = [root]
res = []
while len(q) != 0:
for node in q:
res.append(nodes[node])
length = len(q)
for l in range(length):
# 将同层节点依次出队
node = q.pop(0)
for next_node in graph[node]:
if node... |
14,332 | 51c9e995a87a3deaa4a311515a8ee59b99635370 | __author__ = 'hi_melnikov'
import tornado.web
import tornado.httpserver
import web_game
import web_site
import os
class MainHandler(tornado.web.RequestHandler):
def get(self):
web_site.get_MainHandler(self)
def post(self):
web_site.post_MainHandler(self)
class LoginHandler(tornado.w... |
14,333 | 3b9c43f4840ccecd40e152ecf90daec157d7cc9a | import unittest
from unittest import mock
import cherry
class ApiTest(unittest.TestCase):
def setUp(self):
self.model = 'foo'
self.text = 'random string'
@mock.patch('cherry.api.Classify')
def test_classify_api(self, mock_classify):
cherry.classify(model=self.model, text=self.tex... |
14,334 | 6e05ef1f1e1322e8c31cbf9ce9d1e071338c357c | import datetime
from fHDHR.exceptions import EPGSetupError
class Plugin_OBJ():
def __init__(self, channels, plugin_utils):
self.plugin_utils = plugin_utils
self.channels = channels
@property
def postalcode(self):
if self.plugin_utils.config.dict["tvtv"]["postalcode"]:
... |
14,335 | 7112b26d11109f8063757df724c06da8d2357ab6 | ################################################################################
# NAME: Tyler Quayle #
# ASSIGNMENT: 2 #
# PART: Files, Masks and plotting ... |
14,336 | a7c8a503ec48be071ea6d2e87d53b7e103278fa3 | n = int(input("Enter number to get factorial: "))
f = 1
for i in range(1, n+1):
f *= i
x = 1
y = 1
print("Factorial ",n," equils ",f)
is_factorial = int(input("Check if a number is a factorial of any number.\nEnter number for check: "))
while True:
if is_factorial%x == 0:
x += 1
y *= x
... |
14,337 | 6e59651bec1d8d8cd15a4b0adac85870885bd53e | import unittest
from project.tests.base import BaseTestCase
from project.models import *
class TestMessageDatabase(BaseTestCase):
def test_is_test_running(self):
self.assertEqual(0, 0)
def add_user(self, username, password):
u = User(username=username,password=password)
db.session.ad... |
14,338 | fdd89be2e66d72d345291fb8f04dd119ba740a8a | f = open("01.txt", "r")
past = 150 # using this as base case since first number on file is 150 (prevent dec or inc count from chaning)
dec = 0
inc = 0
for i in f.read().splitlines():
if i > past:
inc += 1
elif i < past:
dec += 1
past = i
print(inc)
|
14,339 | b2f9387801d5d9a70d9b83af101366772d5f28e9 | from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
GENDERS = (
(u'F', u'Female'),
(u'M', u'Male'),
)
class UserProfile(models.Model):
user = models.OneToOneField(User, unique=True)
gender = models.CharField(max_length=1, choices=GEND... |
14,340 | 3e357218abed9776d9ef20e296ab3f774932d30b | import glob
import os
import constants
class RequestGenerator:
def __init__ (self, traceFileDirectory):
self.traceFileDirectory = traceFileDirectory
def readTraceFile(self):
'''
Collects all the files in the trace directory
'''
files = glob.glob(self.traceFileDirectory + '*')
for file in files:
if o... |
14,341 | 628097e20ca4bdb6d546f118945a54cdd61c97fe | from django.contrib import admin
from .models import TreeType,Tree
# Register your models here.
admin.site.register(TreeType)
admin.site.register(Tree) |
14,342 | 5a4e7c7c8f6b08c86529a05c2f91edffeffeacc8 | from sparks.blob_reader import BlobReader
from sparks.blob_saver import BlobSaver
from multiprocessing import JoinableQueue, Process, Event
from sparks import utils
from tempfile import NamedTemporaryFile
import time
import os
import sys
import subprocess
IN_ACC = "camelyon16data"
IN_KEY = "5juqtl5oUnYS3W7CRX3qNfCnYp5... |
14,343 | fa6e1942160a6d6032914c3cb301e37f615c03c0 | #import nester
import pickle
man = []
other = []
try:
data = open('sketch.txt')
for each_line in data:
try:
(role, line_spoken) = each_line.split(':', 1)
line_spoken = line_spoken.strip()
if (role == 'Man'):
man.append(line_spoken)
elif ... |
14,344 | 0569fead0a10c32235f4d66b355c781302967b4c | '''
大华 NVR 接口
'''
from _ctypes import Structure, byref
from ctypes import c_ubyte, c_int, c_char_p, c_bool
from video.NvrBase import NvrBase
from video.RealPlayer import RealPlayerForm, PtzDir
# 登录用的返回结构体
class NET_DEVICEINFO_Ex(Structure):
_fields_ = [
('sSerialNumber', c_ubyte * 48),
('nAlarmIn... |
14,345 | ba75b7db928d71757b89c9390e392b9f81c292d7 | from flask import jsonify
from microcosm_flask.formatting.base import BaseFormatter
class JSONFormatter(BaseFormatter):
CONTENT_TYPE = "application/json"
@property
def content_type(self):
return JSONFormatter.CONTENT_TYPE
def build_response(self, response_data):
return jsonify(resp... |
14,346 | 36c17836ee0685f4076fe0702f667eb989e02c85 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-03-21 19:09
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import djangocms_text_ckeditor.fields
import filer.fields.image
class Migration(migrations.Migration):
dependencies = [
... |
14,347 | 0e2cbc0f1cfa7bcd7c40c53b3f9fde696111efa3 | from django.urls import path
from yellowbird import views
from rest_framework_simplejwt import views as jwt_views
urlpatterns = [
path('user/', views.UserView.as_view()),
path('user/login/', jwt_views.TokenObtainPairView.as_view(),
name='token_obtain_pair'),
path('user/login/refresh/', jwt_view... |
14,348 | fda20e3b54a1fd3542450011bad8dc23b189a403 | from collections import namedtuple, UserList, Iterable
# from jakdojade.utils import fuzzy_search, resolve_class, dotted_lowercase_get
from jakdojade import utils
class TransitList(UserList):
def search(self, value):
return utils.fuzzy_search(self.data, value)
def __repr__(self):
return '{}... |
14,349 | 5e6918b39de1c72294dcf8ce0e65ca5cf01a0911 | #-*-coding=UTF-8 -*-
'''
Created on 2017年3月15日
@author: HP
'''
from selenium import webdriver
import unittest,time
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.common.by import By
from time import sleep
from warnings import... |
14,350 | 920d6b10d535d91130851073c940d1dc8445d689 | from lark import Transformer
from lark.lexer import Token
class JSONTransformer(Transformer): # pragma: no cover
def __init__(self, compact=False):
self.compact = compact
super().__init__()
def __default__(self, data, children, meta):
items = []
for c in children:
... |
14,351 | 0cd9095300e98aeff4e48f0d373470f4bed43a7a | from collections import Counter
my_list = [10,10,10,10,20,20,20,20,40,40,50,50,30]
print(my_list)
# zliczanie
count_my_list = Counter(my_list)
print(count_my_list) |
14,352 | 67dd6583829909bc34af509c3a8c3484dbbf8ca7 | # Module refract.py
import math
def refdry(nu, T, Pdry, Pvap):
# From Miriad: Determine the complex refractivity of the dry components
# of the atmosphere.
#
# Input:
# nu = observing frequency (Hz)
# T = temperature (K)
# Pdry = partial pressure of dry components (Pa)
# Pvap = part... |
14,353 | 379fff24b1f249d1c716537cb70fb3b6769b6a46 | # -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
auto_data = pd.read_csv("Detail_Cars.csv")
auto_data = auto_data.replace('?', np.nan)
col_object = auto_data.select_dtypes(include=['object'])
auto_data['price'] = pd.to_numeric(auto_data['price'], errors = 'coerce')
auto_data['bore'] = pd.to_numeric(aut... |
14,354 | 8287c5097867389aabe804478ba26810c0561d90 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# info.py
#
# This file is part of the RoboEarth Cloud Engine test.
#
# This file was originally created for RoboEearth
# http://www.roboearth.org/
#
# The research leading to these results has received funding from
# the Europe... |
14,355 | eb88e2a36634b446b1a569c380522b8eb1805233 | #!/usr/bin/python
import reader
import analyzer
analyzer.analyze(reader.parser()) |
14,356 | 9f0ed48bc73d2480a55877fc286e257a80f495e3 | """Ejercicio 38.- Llenar una tabla de 10 posiciones con números enteros comprendidos entre el 1 y el
99. Ordenar dicha tabla de menor a mayor y visualizarla por pantalla de la forma
siguiente: """
from tabulate import tabulate
import random
numero = []
for i in range(10):
n = random.randrange(1, 99)
numero... |
14,357 | cb556e1731546dd151c2d62e771b976f3151e4da | import os
import re
import codecs
import hashlib
import hmac
import random
import string
import webapp2
import jinja2
from users import *
from google.appengine.ext import ndb
def portfolio_key(name = 'default'):
"""Assigns a key to BlogPost"""
return ndb.Key('portfolio', name)
class Project(ndb.Model):
... |
14,358 | 76760ec69dc470198a4bfd15e380541e01e44b77 | import sys
import pygame
from letter import Letter
def letter_generator(stats, az_settings, screen, letters):
if stats.lives_left > 0:
new_letter = Letter(az_settings, screen)
letters.add(new_letter)
else:
letters.empty()
stats.game_active = False
pygame.mouse.set_visib... |
14,359 | 785187f00dcef4e2c340e87f3448bc9914ecd616 | from will.plugin import WillPlugin
from will.decorators import respond_to, periodic, hear, randomly, route, rendered_template, require_settings
class SnickerdoodlesPlugin(WillPlugin):
@hear("cookies", include_me=False)
def will_likes_cookies(self, message):
self.say(rendered_template("cookies.html", ... |
14,360 | 740f73a79f4ceaff73164b75eaed37fee0b44617 | #!/usr/bin/python
import sys
import string
#map payment_type, count(1) for each positive tip
for line in sys.stdin:
try:
items = line.strip().split(",")
if items[0] == 'medallion':
continue
key = items[4].upper()
if float(items[8]) > 0:
values = 1
else:
values = 0
print '%s,%s' %(key, values)
e... |
14,361 | 13395e5d55d7496a98b59374469a9eaa6d95c728 | from clients.models import Client
from addresses.models import Address
from mediguest_admin.site import mediguest_admin_site
from people.models import Person
from django.contrib import admin
from foreignkeysearch.widgets import ForeignKeySearchForm
from foreignkeysearch.handler import BaseHandler
from keywork.mod.key... |
14,362 | 847a648d37f04d83708da7c6b06852153c214d31 | l = []
s = input("Enter the string: ")
k = int(input("enter the length of substring"))
l = [s[i:i + k] for i in range(0, len(s), k)]
print(l)
for i in l:
for j in range(len(i)):
res = [i[:-1] for i in l if l[i][-1] == ' ']
else:
continue
print(res)
|
14,363 | 9ac94e2c9c664971434f7cf80c1faaebd13cbb3b | # -*- coding: utf-8 -*-
# Scrapy settings for realtySpiders project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs.org/en/... |
14,364 | 01c41cc89b1190ae24b6ee02903c4c5d39f58169 | # Generated by Django 2.1.4 on 2019-01-02 09:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("stock_maintain", "0005_newsimage_image_type"),
]
operations = [
migrations.AddField(
model_name="news",
name="is_mai... |
14,365 | e8e3eb13e5c948d84e6e31502b0e21ae1e87ab0c | import argparse
import logging
import os
import os.path as osp
import re
import sys
from karabo_data import RunDirectory
from karabo_data.components import AGIPD1M, LPD1M
from karabo_data.exceptions import SourceNameError
log = logging.getLogger(__name__)
def _get_detector(data, min_modules):
for cls in (AGIPD1... |
14,366 | bfd6c65d778be337e3c1bdf3d0b59d1ba591de0a | from datetime import datetime, timedelta
def check_date(date):
next_date = datetime.strptime(date.replace('-', ''), "%Y%m%d").date()
if next_date > datetime.now().date():
return True
return False
|
14,367 | b1baf064e0ae8aca950113409272a4f779b41c17 | from django.db import models
from .managers import CustomUserManager
from django.contrib.auth.models import AbstractUser, BaseUserManager
from Accounts.profiles.models import PI_Profile, Grads_Profile, Undergrad_Profile
from .profiles.models import PI_Profile, Grads_Profile, Undergrad_Profile
# Create your models here.... |
14,368 | ef7c2ba33e48044a15688d4eb6e27866f30ee7ec | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-04-07 03:44
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0005_auto_20170404_0409'),
]
operations = [
migrations.AlterField(
... |
14,369 | a32405de1b1fa08ca6d00794f5e012ebca0494f1 | #!/usr/bin/env python
"""
Global status of basinboa.
reference: http://code.google.com/p/bogboa/source/browse/trunk/mudlib/gvar.py
"""
#------------------------------------------------------------------------------
# ASCII
#------------------------------------------------------------------------------
ASCII_ART ... |
14,370 | 110a84e89140e914ce40e0bab8be205f477353cc |
import math
from panda3d.core import TransparencyAttrib, Texture, Vec2, NodePath
from panda3d.core import Mat4, CSYupRight, TransformState, CSZupRight, LVecBase2i
from direct.gui.OnscreenImage import OnscreenImage
from direct.gui.DirectGui import DirectFrame
from LightManager import LightManager
from RenderTarget i... |
14,371 | 5dd863e45f35315d1b2f345c808e38bd3be0db41 | from django.db import models
from django.db.models.signals import post_save
from django.contrib.auth.models import User
class UserProfile(models.Model):
user = models.ForeignKey(User)
access_token = models.CharField(max_length=255, blank=True, null=True, editable=False)
profile_image_url = models.URLField... |
14,372 | 0dfda0975201ed87d72b27cde9ac43f8d5a5afd5 | _author_ = "Jaiden Woods"
|
14,373 | 29a7453dab7606dab60cef1f9b5fb3d7a22cf219 | """ Entry point for the Application """
import os
import sys
import click
from flask_migrate import Migrate
from app import create_app
from api.models import db, Role, User
app = create_app(environment=os.environ.get('APP_SETTINGS', 'Development'))
migrate = Migrate(app, db)
@app.shell_context_processor
def make_s... |
14,374 | f4fdb21205bff2264b746cbdab6aac7aa5bc405c | class Nint(int):
def __radd__(self, other):
return int.__sub__(self,other)
a = Nint(5)
b = Nint(3)
print a + b
# 8
print 1 + b
#2
|
14,375 | f53fb1ad2c6dd487467c053d37706fb7e352120a | import pickle
import numpy as np
import os
from munch import munchify
from numpynet.utils import onehot
def read_data_sets(path='./dataset/cifar-10', one_hot=True):
X_train = []
y_train = []
for k in range(5):
X, y = load_data_batch(path, k + 1)
X_train.append(X)
y_train.append(y)... |
14,376 | bab33b900ec276268ea42b56787390fd89378f0f | """
Single Bubble Model: Bubble simulations
========================================
Use the ``TAMOC`` `single_bubble_model` to simulate the trajectory of a
natural gas bubble rising through the water column. This script demonstrates
the typical steps involved in running the single bubble model.
It uses the ambien... |
14,377 | dcbf481a31f5ace0bab95895d014a520c8e15cc3 | #!/usr/bin/python3
import ledgerhelpers.legacy
from ledgerhelpers import diffing
CHAR_ENTER = "\n"
CHAR_COMMENT = ";#"
CHAR_NUMBER = "1234567890"
CHAR_TAB = "\t"
CHAR_WHITESPACE = " \t"
CHAR_CLEARED = "*"
CHAR_PENDING = "!"
STATE_CLEARED = CHAR_CLEARED
STATE_PENDING = CHAR_PENDING
STATE_UNCLEARED = None
def pos_w... |
14,378 | 2cccc226675e1298212396af07a7926ada6c8f56 | from flask import Flask, request, Response, jsonify
app = Flask(__name__)
global abc
abc={}
@app.route('/', methods=['GET'])
def home():
return "Hello World!"
@app.route('/users', methods=['POST'])
def post():
abc['id'] = 1
abc['name'] = request.form["name"]
#name = request.form["name"]
#line= ("... |
14,379 | b37e79522207b4d4946ae9c6aa5af942f11ea896 | from message_sender import MessageSender
class EmailMessageSender(MessageSender):
def send_message(self, message):
print("EmailMessageSender: Sending email message...")
|
14,380 | ed27d1e544cf693b2775424c1cc6a5c274a05203 | def pattern(n):
# for loop for rows
for i in range(1,n+1):
# conditional operator
if(i % 2 != 0):
k =i + 1
else:
i
# for loop for printing spaces
for g in range(k,n):
if g>=k:
print(end=" ")
... |
14,381 | 51ea1890072846ce6f31fc2e0d689fe9d84c517d | # NOTE: Keeping this commented out fixes our memory issue!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# import time
# print("HELLO WORLD %sms" % (time.monotonic() / 1000)) # memory issue might be due to using %sms instead of {} and format FYI.
print("HELLO WORLD")
|
14,382 | fcc4d1df2d9c976a575560f5980657f3e2a3ab4a | """
Source Code:
https://pytorch.org/tutorials/beginner/nlp/advanced_tutorial.html
"""
import torch
import torch.nn as nn
from torch import Tensor
NOT_POSSIBLE_TRANSITION = -1e8
def log_sum_exp(x: Tensor):
max_score, _ = x.max(dim=-1)
return max_score + (x - max_score.unsqueeze(-1)).exp().sum(-1).log()
... |
14,383 | b2b161978c101da3a33f5cbf9d561696a747c080 | nam = raw_input('Who are you?')
print 'Welcome',nam
hrs = raw_input("Enter Hours:")
rate = raw_input("Enter Rate:")
hrs = float(hrs)
rate = float(rate)
grosspay = hrs * rate
print 'Gross pay is',grosspay |
14,384 | a5ab72f175cdee773d01d2776ad3c60fa130fdff | import argparse
import sys
from config import *
# from data_utils.extract_pe_features import *
from data_utils.bin_to_img import *
# from data_utils.extract_opcode import *
from data_utils.misc import *
from data_utils.data_loaders import *
from pathlib import Path
def main():
max_files = 0 # set 0 to process al... |
14,385 | 4a5c5a7b31ebb9652ee8024b994f603e1c243c56 | class RandomizedCollection:
def __init__(self):
"""
Initialize your data structure here.
"""
def insert(self, val: int) -> bool:
"""
Inserts a value to the collection. Returns true if the collection did not already contain the specified element.
"""
... |
14,386 | 52315e3f85eb499dd1acbd44cc653c253f3a814a |
print(chr(ord('生') & ord('死')))
|
14,387 | 0160b2df83ec9ae1faca1181eed5015225c66ae8 | #!/usr/bin/env python
import sys
def parse( filename ) :
clauses = []
for line in open( filename ) :
if line.startswith( 'c' ) : continue
if line.startswith( 'p' ) : continue
clause = [ int(x) for x in line[:-2].split() ]
clauses.append( clause )
return clauses
def bcp( formula, unit ) :
modified = []
f... |
14,388 | 2dd63ac11491f19820e3332c0347d3e23705341a | def Healt_calc(age, apples, cig):
health = (100-age) + apples*2 - (cig*2.8)
print(health)
Healt_calc(22,5,7)
venkat_data = [22,5,7]
Healt_calc(venkat_data[0],venkat_data[1],venkat_data[2])
Healt_calc(*venkat_data) # UNPACKING ARGUMENT |
14,389 | 7c8f06dfd55bc362e2eed1fed4bbeaad30fbe8c3 | #!/usr/bin/python
#-*- coding: utf-8 -*-
from oled.serial import i2c, spi
from oled.device import sh1106, ssd1306
from oled.render import canvas
import sys, subprocess, os
import requests
import time
import datetime
from PIL import ImageFont
import fonts
import thread
reload(sys)
sys.setdefaultencoding( 'utf-8' )
n... |
14,390 | 9f7d6f869c5e0ef27c77099770e8f5b57bfd7661 | x=y=0
ans=1
for _ in range (int(input())):
a,b=map(int,input().split())
ans+=max(0,min(a,b)-max(x,y)+(x!=y))
x,y=a,b
print(ans) |
14,391 | aa009dc9f6f58521b00af83637cb2958d9f2d8c1 | #!/usr/bin/env python
#Copyright 2017 Martin Cooney
#This file is subject to the terms and conditions defined in file 'Readme.md', which is part of this source code package.
import cv2
import numpy as np
import sys
basename = '../../data/objects/objects1'
if len(sys.argv) > 1:
basename = sys.argv[1]
t... |
14,392 | 31d289009ef9956845343afe2a48825c5cf7d1e0 | import numpy as np
import os
import modeling.motion_model.motion_model as motion
import shutil
import math
import modeling.measurement_update as measurement
import modeling.resampling as resample
import config.set_parameters as sp
import utils.data_process as data_process
from utils.visualize import *
#from utils.visua... |
14,393 | c51fa3c07c81abf9ffe23af77f8505425d62fa22 | coloring_script = '''
state = Calc.getState()
var item;
for (item = 0; item < colors_array.length; item++) {
state["expressions"]["list"][item].color = colors_array[item]
}
Calc.setState(state)
''' |
14,394 | 190e8aef5922de0824232e9046094696a68c9211 | """
Gather F5 LTM Node Information
@author: David Petzel
@date: 11/15/2011
"""
from Products.DataCollector.plugins.CollectorPlugin import SnmpPlugin, GetTableMap, GetMap
from Products.DataCollector.plugins.DataMaps import ObjectMap
import re
from ZenPacks.community.f5.lib.BigIpUtils import unpack_address_to_string
f... |
14,395 | 0867ff00827365fe0cde59b3f26653494f6d4ba5 | #!/usr/bin/env python
'''
@author Luke Campbell
@file flask_mvc/view.py
@license Apache 2.0
'''
class FlaskView(object):
pass
|
14,396 | 87816aeef1acc9c84e9e80aa020dbf6595822dad | import numpy as np
import pytest
from cortexpy.edge_set import EdgeSet
class TestIsEdge(object):
def test_with_all_true(self):
es = EdgeSet(np.ones(8))
for letter in 'acgtACGT':
assert es.is_edge(letter)
def test_with_none_true(self):
es = EdgeSet(np.zeros(8))
for... |
14,397 | 23362a18e726371576598d83eb2528cc10bb0c6a | for i, j in zip(range(3), range(3)):
print(i, j)
|
14,398 | 4cf557244be414b8cb84d163cc5d895f64708057 | # -*- coding: UTF-8 -*-
from .. import mylog
from ..myexception import SpiderOneUserException
from ..myexception import RequestException
from ..myexception import GetBookNumberException
from ..myexception import GetBookPageException
import requests
from string import Template
from bs4 import BeautifulSoup
from time im... |
14,399 | 66d96c42c8b814fcf38f8fd18215e6e29efbc810 | """
Class: Stat232C
Project 3: Goal Inference
Name:Mingjia Yao
Date: May, 2020
"""
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
import copy
import math
class ValueIteration(object):
def __init__(self, transitionTable, rewardTable, valueTable, convergenceTolerance, g... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.