index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
9,800
38bd9e5b2147838b6061925d72b989c83343f1c2
from csv import reader, writer from collections import OrderedDict as OrdDic import sqlite3 from jsmin import jsmin from glob import glob from csscompressor import compress from threading import Timer from glob import glob import os import shutil import logging import json class MinifyFilesPre: def __init__(self, ...
9,801
7d138a0ad7e4d8f7047dd73ae503bdc7ae5aa065
print("rap.sweeps.data_management level init")
9,802
f268dc4c2ae2c17e7d0d3921d29e6b952fc63c7d
# encoding=utf8 import json import time from util import http_util available = 1 disable = 0 # 交易所域名 REST_URL = "https://api.bithumb.com" PAYMENT_CURRENCY_BTC = "BTC" PAYMENT_CURRENCY_KRW = "KRW" # 成功码 SUCCESS_CODE = "0000" # 没有交易对的错误码 NO_SYMBOL_CODE = ["5600", "5500"] # bithumb提现的最小值,获取地址:https://apidocs.bithumb...
9,803
8be3a3d32da208e2f45aad61813bc6f5ea513f01
import p01 as p stu = p.Student() stu.say() p.sayHello()
9,804
46696ee9576d74c087ae435bfd304c8346530ab2
""" CP1404 - Practical Code that produces a random number between 1 and 100 inclusive Rhys Simpson """ # 1. # smallest number 5; largest number 20 # 2. # smallest number 3; largest number 9 # no it can only produce 3, 5, 7, 9 # 3. # smallest number 2.5000000000000000; largest number 5.5000000000000000 import random...
9,805
bac3cee5e6d129fcf345d92000cb2a257c303dd5
import random a = input('Nome do primeiro aluno: ') b = input('Nome do segundo aluno: ') c = input('Nome do terceiro aluno: ') d = input('Nome do quarto aluno: ') names = [a, b, c, d] print('O aluno escolhido é {}.'.format(random.choice(names)))
9,806
266add60be2b6c2de5d53504cbabf754aa62d1b0
import unittest from unittest.mock import ANY, MagicMock, call from streamlink import Streamlink from streamlink.plugins.funimationnow import FunimationNow from tests.plugins import PluginCanHandleUrl class TestPluginCanHandleUrlFunimationNow(PluginCanHandleUrl): __plugin__ = FunimationNow should_match = [ ...
9,807
987f8ce668f2002b731822fa5f3de143a80aaafe
from src.config import Config mock = { "entities": { "foo": [ "bar", "foobar" ] }, "synonimous": { "fizz": [ "fizzfuzz", "fuzz"] }, "templates": [ { "text": "{synonimous.fizz} and {entities.foo}", "intention": "fizzfoo" } ] } def test_sho...
9,808
2caea9e7bbef99b19ba917995513413385c7abdf
#!/usr/bin/env python import pygame import pygame.mixer as mixer def pre_init(): mixer.pre_init(22050, -16, 2, 2048) def init(): mixer.init() pygame.mixer.set_num_channels(16) def deinit(): mixer.quit() class Music (object): our_music_volume = 0.8 our_current_music = None def __in...
9,809
bf7319996043a41b7d0ef4e6098c3609e5db101e
from . import chequeador_camion from . import chequeador_camion_modelo from . import chequeador_destino_tipo from . import chequeador_destino from . import chequeador_origen from . import chequeador_minerales
9,810
94d992ef4b9015aa8f42071bb1409703d509c313
from . import * from module import * from transfer import * from dataset import *
9,811
bc5b368a710b8dfc4492b996c42c46638e1f538c
date = input() if date == ("DEC 25") or date == ("OCT 31"): print("yup") else: print("nope")
9,812
d91dc850c293cf085e1be04b6e13e0a62cb0bcb1
# e.g. 8-34 from tkinter import * from PP4E.launchmodes import PortableLauncher import os, sys demoModules = ['demoDlg', 'demoRadio', 'demoCheck', 'demoScale'] for demo in demoModules: pid = os.fork() filepath = './' + demo + '.py' if pid == 0: os.execvp('python3.5', (filepath, )) root = Tk() r...
9,813
22ddae977afd2a1b0a729cf0d56783eaaca3b0a0
#!/usr/bin/python2 import requests ,optparse def get_link(): parser=optparse.OptionParser() parser.add_option("-l","--link",dest="url",help="direct link of file to download .pdf") (url,argument)=parser.parse_args() return url def download(url): try: get_request=requests.get(url) ...
9,814
be64c981e7ea70dfcbd840988a633b4a71a43783
from random import randint in_file = open("vocabulary.txt", "r") voca_dic = {} for line in in_file: data = line.strip().split(": ") eng_word = data[0] kor_word = data[1] voca_dic[eng_word] = kor_word while True: keys = list(voca_dic.keys()) index = randint(1, len(keys) - 1) input_val ...
9,815
588f6f78908e47e0b3f1bc42fffabad34766eede
import numpy as np import tensorflow as tf from arg_parser import args from model_object import UnetModel def main(args): np.random.seed(args.random_seed) tf.random.set_seed(args.random_seed) unet_model = UnetModel(args) unet_model.prepare_data(args) unet_model.create_model(args) une...
9,816
1a7363736076620b7704d7264b2f0bb24514165c
from mbc import MBC import random import sys from typing import Dict from interface import Interface from reg import Register, HandlerProxy # I/O Registers IE = 0xFFFF DIV = 0xFF04 TIMA= 0xFF05 TMA = 0xFF06 TAC = 0xFF07 IF = 0xFF0F LY = 0xFF44 class MMU(): #0000 3FFF 16KB ROM bank 00 From cartridge, usual...
9,817
c466c7e05608b1fbba5eea5bec16d301cee3688f
default_app_config = 'teacher.apps.A1Config'
9,818
c7e5851a41e1cdb33cd0daa103fbf702da6e5ff7
# -*- coding: utf-8 -*- """ Created on Tue Aug 10 17:48:19 2021 @author: LESLY """ from PICO_PLACA_class import PICO_PLACA """ Main program of "Pico y Placa" predictor""" def main(): print("Predictor") placa = input("Enter the license of your vehicle in the following format AAA-###...
9,819
a7d7408808f28343a51ff6522c5e14747c8c6e43
# Generated by Django 3.0.6 on 2020-07-06 17:10 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('s1app', '0004_auto_20200706_0753'), ] operations = [ migrations.AlterField( model_name='gall', name='date', ...
9,820
9f4cd9ed8aea03f5908aef4a154d964f0810619b
#!/usr/bin/env python __author__ = "Maxime Beauchamp" __version__ = "0.1" __date__ = "2020-12-10" __email__ = "maxime.beauchamp@imt-atantique.fr" from graphics_OSSE import * # function to create recursive paths def mk_dir_recursive(dir_path): if os.path.isdir(dir_path): return h, t = os.path.split(di...
9,821
0ff398775fd13fb5fbd23bf2359bb31dff6bd38c
n, x = map(int, input().split()) m = [int(input()) for _ in range(n)] m.sort() x -= sum(m) print(n + x // m[0])
9,822
307e7a059f9b0b1131f8a57d0f55cf0ee05173e8
#!/usr/bin/env python """ Use version of DriverSlave that has pixmap and pixheights """ import threading # import base classes and driver from bibliopixel import LEDStrip, LEDMatrix # from bibliopixel.drivers.LPD8806 import DriverLPD8806, ChannelOrder from bibliopixel.drivers.visualizer import DriverVisualizer, Channel...
9,823
38363316cc9a8419a528bb78b9ad03682e24172d
# 数组的每个索引作为一个阶梯,第 i个阶梯对应着一个非负数的体力花费值 cost[i](索引从0开始)。 # # 每当你爬上一个阶梯你都要花费对应的体力花费值,然后你可以选择继续爬一个阶梯或者爬两个阶梯。 # # 您需要找到达到楼层顶部的最低花费。在开始时,你可以选择从索引为 0 或 1 的元素作为初始阶梯。 # # 示例 1: # # 输入: cost = [10, 15, 20] # 输出: 15 # 解释: 最低花费是从cost[1]开始,然后走两步即可到阶梯顶,一共花费15。 # # # 示例 2: # # 输入: cost = [1, 100, 1, 1, 1, 100, 1, 1, 100, 1] # 输出...
9,824
fc273a286a462cb673edaa2de2ecc6b9ca631004
def dot_product(a,b): ans = 0 for i in range(len(a)): ans += a[i]* b[i] return ans n = int(input()) a = sorted(list(map(int,input().split()))) b = sorted(list(map(int,input().split()))) print(dot_product(a, b))
9,825
a4d5064decdc9963dae1712c7c6918b3e5902bf2
#!/usr/bin/env python import socket import datetime as dt import matplotlib.pyplot as plt import matplotlib.animation as animation from matplotlib.animation import FuncAnimation from matplotlib import style import pickle # Create figure for plotting time_list = [] gain_list = [] HOST = '127.0.0.1' # Standard loopba...
9,826
8dd864f1313f1e6f131ee11d4db99fbc46519126
import unittest from unittest.mock import patch from redis import Redis from rq.job import JobStatus from rq.maintenance import clean_intermediate_queue from rq.queue import Queue from rq.utils import get_version from rq.worker import Worker from tests import RQTestCase from tests.fixtures import say_hello class Ma...
9,827
672add6aa05e21d3605c05a23ff86281ffc3b17c
from typing import List class LanguageDefinition: """Language definition containing general constants and methods.""" @staticmethod def get_translated_file_name(filename: str): """ :returns: Translated file name. """ return filename @staticmethod def create_proje...
9,828
e296a5bea5465c2b84e37c7d83922adb01feab70
# Generated by Django 2.2.14 on 2020-08-25 17:00 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('blog', '0004_auto_20200825_1318'), ] operations = [ migrations.RenameField( model_name='cv', old_name='additionalskills_tex...
9,829
1aa49bc9a3ea12dffff907d17bd40b4425f28e13
#!/usr/bin/python import time from daemon import runner import graphitesend from pywatts import get_data class App(): def __init__(self): self.stdin_path = '/dev/null' self.stdout_path = '/dev/tty' self.stderr_path = '/dev/tty' self.pidfile_path = '/tmp/currentcost_daemon.pid' self.pidfile_timeout = 5 ...
9,830
226bb323597100b57ef83eb0d5e4a9b894b77fd2
import sys character_dict = {} f = open(sys.argv[1], 'r') while True: pinyin = f.readline().strip() character = f.readline().strip() if not character: break character_dict[pinyin] = character import time fout = open(sys.argv[1][:-3] + "_guess_char.out", 'w') fout.write("-----------------------------") fout.write(...
9,831
c0d8f2542f9cf9a5097011c61c90073c031d2708
from z3 import * import re dna = re.compile("dna_(\d+)") opt = Optimize() opt.from_file("../benchmarks/bench.smt2") set_option("sat.random_seed",23) def get_soft(soft): return [f.arg(0) for f in soft.children()] def free_vars(fs): seen = set([]) vars = set([]) def fv(seen, vars, f): if f in...
9,832
63e28e6a1ea5db1d1c41bbc755b9c33905e066bb
#!/usr/bin/env python3 ''' towerdev - Ansible Tower Testing Framework MIT License Copyright © 2021 falcon78921 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including wit...
9,833
f9b48c1b6489d8981e192838cf1c734e2296ab15
#사각형의 면적을 구하는 프로그램을 작성하시오, #사각형의 면적 = 높이*밑변 height=int(input('높이 입력: ')) base=int(input('밑변 입력: ')) area=height*base print('높이는',height,' 밑변은',base,'사각형의 면적은',area,'입니다.')
9,834
29eb1a1642d38160c138733e269bb3ba0c5d4bba
def primo(num): if num < 1: print(f"El numero {num} no es primo") return None else: if num == 2: print(f"El numero {num} es primo") return None else: for i in range(2, num): if num % i == 0: print(f"El numer...
9,835
e018d28cbacb568596eb9a5134581db960111e14
from django import forms from . import models from .validators import validate_metadata class ServiceProviderForm(forms.ModelForm): xml = forms.CharField(label='SAML Metadata XML', widget=forms.Textarea, validators=[validate_metadata]) class Meta: ...
9,836
b11869076c2c8d6207df861cd1d0b0434b3f9477
from peewee import BlobField class BytesField(BlobField): """This is a BlobField adapted to our needs Default BlobField returns memoryview when getting data from the db. We want bytes. """ def adapt(self, value): if value and isinstance(value, memoryview): return value.tobytes() ...
9,837
697f4dd640ddba0411eb6eb68e7ce079a6330670
from typing import Any from jinja2.environment import Environment MAX_RANGE = ... # type: int UNSAFE_FUNCTION_ATTRIBUTES = ... # type: Any UNSAFE_METHOD_ATTRIBUTES = ... # type: Any UNSAFE_GENERATOR_ATTRIBUTES = ... # type: Any def safe_range(*args): ... def unsafe(f): ... def is_internal_attribute(obj, attr): .....
9,838
5c5cfcd240c8b05970dc8dff57bfbbdc98f1d100
# Time: O(|V| + |E|) # Space: O(|V|) class Solution(object): def eventualSafeNodes(self, graph): """ :type graph: List[List[int]] :rtype: List[int] """ WHITE, GRAY, BLACK = range(3) def dfs(graph, node, lookup): if lookup[node] != WHITE: ...
9,839
da5a366d1cc4f192a220dc38c7a74aeb3fba7cdb
# # @lc app=leetcode.cn id=909 lang=python3 # # [909] 蛇梯棋 # # @lc code=start from typing import List class Solution: def snakesAndLadders(self, board: List[List[int]]) -> int: N = len(board) def get_pos(num): r = (num-1) // N c = (num-1) % N c = c if ((r+1) & 1)...
9,840
7c2a59f698b75d0de89a16310d97a01506c99cb3
#!/usr/bin/python3 # -*- coding:utf-8 -*- import socket import select import time """=====================Head Define=====================""" UDP_RECEIVE_TIMEOUT = 1 LOOP_DELAY = 1 """=====================Class=====================""" class UDP_packet: def __init__(self,board_info, board_add, state): se...
9,841
e5bf57e7a171f7e42928b78d09dda7593a231cf9
""" Every block element test will be automatically wrapped inside `<p></p>\n`. Thats why every block test should include this wrapper tag. """ from io import BytesIO from unittest import TestCase from unittest.mock import patch, Mock import pytest from django.core.files import File from django_dynamic_fixture import ...
9,842
f23bfef2daf8fda4249435821dbc2e0b1846e3d6
def towers_of_hanoi(n, src, dest, temp,res): if n==1: s = 'disk 1 from ',src,'->',dest res.append(s) return towers_of_hanoi(n-1, src, temp, dest, res) s = 'disk ',n, ' from ',src,'->',dest res.append(s) towers_of_hanoi(n-1, temp, dest, src, res) return res def steps...
9,843
917241482dc1f234d5fae9c107a5f21b018fe6d4
def getmin(a, b, c): if a <= b and a <= c: print(a) elif b <= a and b <= c: print(b) else: print(c) def filtername(name): if len(name) > 3: return name[:3] elif len(name) < 3: return name + " " * (3 - len(name)) return name def filternames(names): ...
9,844
0f94537fa64066bb29c5e9e97836b0a8ac01ac19
from django.shortcuts import render from django.shortcuts import redirect from block.models import Block from .models import Article from .forms import ArticleForm from django.core.paginator import Paginator from django.contrib.auth.decorators import login_required def article_list(request, block_id): block_id = ...
9,845
f471062573a5ec8cfeb194168edfba3d2700cac6
from models import Sensor import mysql.connector as mariadb ## CREATE A DB WITH MARIADB ## mariadb_connection = mariadb.connect(user='web', password='raspberry', database='PlantHubDB') cursor = mariadb_connection.cursor() def closeConnection(): cursor.close() mariadb_connection.close() return def getTask...
9,846
23099b29fb5898c2556d1612690e33860662ca35
from pyspark.sql.types import StructType, StructField, StringType, TimestampType, IntegerType from main.config.spark_config import SparkConfiguration import main.config.constants as Constants from main.connectors.kafka_connector import KafkaConnector, extract_json_data def main(): # Configure Spark Session co...
9,847
10d5eef304a3d293441169ebde1f7859537c4b6e
import os from googleapiclient.discovery import build import httplib2 from oauth2client import gce from oauth2client.appengine import AppAssertionCredentials from oauth2client.file import Storage __author__ = 'ekampf' import json import logging import apiclient.errors from apiclient import http as apiclient_request...
9,848
cfe5d013c968afdbf1fc80e3c8c3233a3678450b
# -*- coding: utf-8 -*- """ Created on Mon Mar 5 14:23:28 2018 @author: emily """ import pipeline import numpy as np import matplotlib.pyplot as plt import pstats import cProfile pr = cProfile.Profile() pr.enable() #def try_running(): max_it=200000 rnd_sd = 1 deps = np.concatenate((np.arange(0,10,0.2), np.aran...
9,849
6868a8b5d36403f1417301acdca5f5dc9e45c682
from __future__ import division import re import sys import six from six.moves import queue import os import io from google.cloud import language from google.cloud.language import enums from google.cloud.language import types from google.cloud import speech as speech1 from google.cloud.speech import enums as enums2 fr...
9,850
f4b704a1416bfd6524340a68a20981957abf4340
# 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 u...
9,851
8ff7ace102b781b35fff0671e2c606bf662e2767
# Generated by Django 2.0.7 on 2018-09-27 13:40 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('education', '0005_auto_20180927_1041'), ] operations = [ migrations.RemoveField( model_name='educationgroup', name='...
9,852
6f583fde0eeab84984629b795e428300503a49c9
from adb_local_installer.connection import ADBConnection with ADBConnection("a95x01", domain="dohmens.local") as conn: print(conn.conn)
9,853
6f1bb9fde9ed9667ab81baa9e8ec965d711a0556
#! /usr/bin/env python3 import os import requests # import json external_ip = "xx" data_path = "/data/feedback/" url = "http://{}/feedback/".format(external_ip) def read(): # read file file_list = os.listdir(data_path) result_list = [] for file in file_list: with open(data_path + file) as f:...
9,854
e982fd5bed540b836fd4e2caaec033d8cbfb0e4f
from django.shortcuts import render from django.shortcuts import redirect from django.http import HttpResponse from .models import * from django.contrib.auth import logout, authenticate, login from django.contrib.auth.decorators import login_required from django.template.loader import get_template from django.template ...
9,855
8c86c0969c47a59db5bd147d3e051a29118d6bf2
#!/usr/bin/env python # -*- coding: utf-8 -*- # # looping.py # # Copyright 2012 Jelle Smet <development@smetj.net> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of ...
9,856
890d50c741ffd576312c63dc450e274b4517bf12
from sklearn.preprocessing import StandardScaler from sklearn.preprocessing import PowerTransformer from sklearn.preprocessing import RobustScaler from sklearn.preprocessing import Normalizer from sklearn.preprocessing import MinMaxScaler import pandas as pd import numpy as np def preprocess_transformers(y_train, tra...
9,857
30405a6f20a44b2252b6894ef6d0e818861702f8
import sys sys.path.append('preprocess') import matplotlib matplotlib.use("TkAgg") import matplotlib.pyplot as plt from matplotlib.pyplot import savefig import numpy as np import refit_cfg import os import random from sklearn.model_selection import train_test_split name = ['WashingMachine', 'Kettle', 'Microwave', 'Fr...
9,858
5ae4f489da7b4f0913c9b16c86cc60537cc51234
import plotly.figure_factory as ff import pandas as pd import csv df=pd.read_csv("phone.csv") fig=ff.create_distplot([df["Avg Rating"].tolist()],["Samsung"],show_hist=False) fig.show()
9,859
d76c1507594bb0c1ed7a83e6c5961097c7fbf54a
from django.urls import path from django.contrib.auth import views as auth_views from . views import register, channel urlpatterns = [ path('register/', register, name="register"), path('channel/', channel, name="channel"), path('login/', auth_views.LoginView.as_view(template_name='user/login.html'), name...
9,860
6fa0e1dabd178507c32c62146b404bb42f8445d4
import pandas as pd import numpy as np #from ctaFunction import std_normalized def barStdNormal(bars, timeperiod=5): '''Std Normal ''' close = bars['close'] result = close.rolling(timeperiod).apply(std_normalized) return result
9,861
1077efaa4379ff0e114a0b8d4d3b7156758e070f
# coding: utf-8 from korean.morphophonemics.phonology import Syllable from notes.old_morphology import Noun, Verb class Case (object): pass class Nominative (Case): def apply(self, noun): if noun.has_tail(): noun.syllables.append(Syllable(u'이')) else: noun.syl...
9,862
19c1a50cf19f04a9e0d0163a9383cb900bca1d38
#!/usr/bin/env python3 import click @click.command() @click.option("--name", prompt = "Your name") def hello(name): print("hello", name) if __name__ == '__main__': hello()
9,863
a8197a4f0bb84e734696bf43fa976c76732d75b8
from django.contrib import admin from trips.models import Post admin.site.register(Post)
9,864
fb258521fdfded0062cbe30651268bf5410d3384
# coding=utf-8 # pylint: disable=too-many-lines # -------------------------------------------------------------------------- # 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) AutoRe...
9,865
d2049b20e00b45df9fb0772d9a654a58a00191c5
def decorate(a): def inner(f): def decorated(*args, **kwargs): return f(a, *args, **kwargs) return decorated return inner @decorate(3) def func(a, b, c): print a, b, c func(1, 2)
9,866
1c222f42c5c0178f97391f1bdc60bba110f3d118
from django.urls import path, re_path from .views import * app_name = 'articles' urlpatterns = [ path('',articles_list,name='list'), path('create', create_article, name='create'), path('<slug:slug>', article_detail,name='detail'), ]
9,867
441d224c37e0eae531c17db0e903b3344c570516
from django.http import HttpResponse from django.shortcuts import render_to_response from django.template import Context from books.models import book,Author def index(request): book_list=book.objects.all() c=Context({"book_list":book_list}) return render_to_response("index.html",c)
9,868
4f2017632d905c80c35fbaead83ecb7e1ac95760
from page_parsing import get_item_info_from,url_list,item_info,get_links_from # ================================================= < <链接去重 > > ===================================================== # 设计思路: # 1.分两个数据库,第一个用于只用于存放抓取下来的 url (ulr_list);第二个则储存 url 对应的物品详情信息(item_info) # 2.在抓取过程中在第二个数据库中写...
9,869
e5fd0fc13a39444a934eea3bd24056073d28eff2
#!/usr/bin/env python from __future__ import division import sys import math logs = sys.stderr from collections import defaultdict import time from mytime import Mytime import gflags as flags FLAGS=flags.FLAGS flags.DEFINE_string("weights", None, "weights file (feature instances and weights)", short_name="w") flag...
9,870
3ec162070f79ae38d6ae3ceb858c15b6e39f7027
#the method of same name present in any class, it is call by anywhere #object of different type is responds to same methods class pycharm: def execute(self): print("COde check") print("compile") class MyEditor: def execute(self): print("Spell Cheack") print("Auto COmpile") ...
9,871
1ddec426e4ad50f1d0e8a57ed841fbdf8c51b00f
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2011 Eficent (<http://www.eficent.com/>) # Jordi Ballester Alomar <jordi.ballester@eficent.com> # # This program is free software: you can redistribute it and/or modify # it und...
9,872
409e0fc0b1c1d86c5526d33ba271a8387eecf748
# -*- coding: cp1251 -*- import arcpy as a from arcpy import AddMessage as msg, AddWarning as warning, AddError as error from os import mkdir, walk from os.path import join, dirname, basename, splitext from glob import glob as get_files from shutil import copy from collections import OrderedDict input_folder = a.GetP...
9,873
01852f6dbeb78df3098b14d2f0538ad9193ea511
__version__ = '3.13.7'
9,874
504d4afc4b3e708d43110a2d85676fb745f1aba8
from django.shortcuts import render from django.http import Http404 from thermometer.models import Therm def index(request): therms = Therm.objects.all() return render(request, 'thermometer/index.html', { 'therms': therms, }) def fetchsquare(request, id): try: therm = Therm.objects.get(id=id) except Therm.D...
9,875
a77fb90cdc6e7f9b70f9feeefc2b7f8e93a2d8c5
# wilfred.py # Authors # Stuart C. Larsen (SCL) # Daryl W. Bennet (DWB) # Set up three main modules (command, control, reconnaissance), # and then enter main event loop. # # Command: # Gather mission priorities and objectives, such as turn left, turn right # goto GPS 45, 65, land, take off. # # Control: # Fl...
9,876
31f91e67d0adde0a984a6d162ea5607f06e9208e
#!/usr/local/autopkg/python """ JamfExtensionAttributeUploader processor for uploading extension attributes to Jamf Pro using AutoPkg by G Pugh """ import os import sys from time import sleep from xml.sax.saxutils import escape from autopkglib import ProcessorError # pylint: disable=import-error # to use a base...
9,877
78123c806e5a8c0cc7511a5024769f8c61621efa
from math import * import math import re import numpy as np class atom: aid=0 atype='' x=0.0 y=0.0 z=0.0 rid=0 rtype='' model=[] chainid='' def getlen(atm1,atm2): dist=sqrt(pow(atm1.x-atm2.x,2)+pow(atm1.y-atm2.y,2)+pow(atm1.z-atm2.z,2)) return dist def ...
9,878
74b38599dd793282612a468a760f6301b9f039d6
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. # Copyright (c) 2008 JAILLET Simon - CrysaLEAD - www.crysalead.fr from . import models from . import wizards from odoo import api, SUPERUSER_ID from odoo.addons.account.models.chart_template import preserve_existing_tag...
9,879
71ac7240287b83be6ec1f2d98e3ee531a8a219e0
import os.path import bcolz import numpy as np import zmq context = zmq.Context() socket = context.socket(zmq.REP) socket.bind("tcp://*:5555") if not os.path.exists('db'): print("db not found, creating") ct = bcolz.ctable([np.empty(0, dtype="i8")], names=['data'], ...
9,880
e14319e705a3c1cdf85e0a2fe77c211e2afa9baa
# ------------------------------------------- # MODULES # ------------------------------------------- import sys import platform if(platform.system()== "Windows"): dir_sep = "\\" else: dir_sep = "/" import time import os import numpy as np import subprocess import math from mathutils import Vector try: from CifFi...
9,881
40b94a3be27ebb0d8e3e67fddabe1dc68646169c
from firstfuncs_1618 import * figdir='/home/isabela/Documents/projects/OSNAP/figures_OSNAPwide/Freshwater/Linear/' figdir_paper='/home/isabela/Documents/projects/OSNAP/figures_OSNAPwide/Freshwater/paperfigs' ######################################################################################################## #####...
9,882
11952e60ab95bc1896fd899a5ced126dcafec63a
from django.shortcuts import render from django.contrib import messages from django.views.generic import View from django.views.decorators.http import require_GET, require_POST from django.shortcuts import render, get_object_or_404 from django.http import HttpResponse,HttpResponsePermanentRedirect,HttpResponseRedirect ...
9,883
a8a2d672369f61c6412229380cc6097d152ba126
# -*- coding: utf-8 -*- """ Created on Mon Feb 20 17:13:46 2017 @author: pmonnot """ import blpapi import datetime # Create a Session session = blpapi.Session() # Start a Session if not session.start(): print "Failed to start session." if not session.openService("//blp/refdata"): print "Faile...
9,884
a6670d0d09f02b674bc31b770f42d4d8a01a4a4e
# This file was automatically generated by SWIG (http://www.swig.org). # Version 2.0.12 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. from sys import version_info if version_info >= (2,6,0): def swig_import_helper(): from os.path impo...
9,885
237a93ff73cb98fd9d4006f14d3cadbdc09259a4
import scrapy import time import os.path from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.common.exceptions import TimeoutException from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC from tempfile import mkstem...
9,886
a8506420b1bc558fa953f0cec3f8c16beaf44909
import cv2 import os """ 视频场景拼接 """ stich_path="stichImage\\" def read_video(filename): ''' 将视频每秒的内容提取出来 :param filename: 视频文件路径 :return: 视频文件名,用来拼接 ''' cap=cv2.VideoCapture(filename) rate = cap.get(cv2.CAP_PROP_FPS) count=0 success, frame = cap.read() imageCount=0 while suc...
9,887
58ddf496245741498177a67b7ce692b97bbd476a
/usr/share/pyshared/screenlets/plugins/SizeConverter.py
9,888
4db93bdab2d73e7226dcad61827f5faea8513767
# These are instance types to make available to all AWS EC2 systems, except the . # PostgreSQL server, until the auto tuning playbook can tune for systems that # small. AWSGlobalInstanceChoices = [ 't2.nano', 't2.micro', 't3.nano', 't3.micro', 't3a.nano', 't3a.micro', ] class SpecValidator: ...
9,889
841e859feff2151667d70e7bf1829129d1f92cf7
from flask import Flask, Blueprint, render_template, request, redirect from repositories import manufacturer_repository, product_repository from models.manufacturer import Manufacturer from models.product import Product manufacturers_blueprint = Blueprint("manufacturers", __name__) @manufacturers_blueprint.route("/ma...
9,890
a028661f9bcaa6dfe5389cb57f31b07d7e981487
from time import sleep import sys def cmdline(): available_commands = ['help', 'quit', 'echo', 'pbar', 'joke'] keepgoing = True while (keepgoing): typed = input("Type something. (Type 'help' for options)") words = [w for w in typed.split(" ")] command = words[0].lower() argu...
9,891
09ce2aeccfd1f3f4f130fd79001db47485cc95c2
#!/usr/bin/env python # -*- coding: utf-8 -*- from nose.tools import * from json import json def test_json_basestring(): assert_equals(json("Hello World"), '"Hello World"') def test_json_integer(): assert_equals(json(9), "9") def test_json_float(): assert_equals(json(1.234), "1.234") def test_json...
9,892
ad079876476f6f291ad52aece8d0d5afdd5a8bcf
import os from distutils.core import Extension REPROJECT_ROOT = os.path.relpath(os.path.dirname(__file__)) def get_extensions(): libraries = [] sources = [] sources.append(os.path.join(REPROJECT_ROOT, "_overlap.c")) sources.append(os.path.join(REPROJECT_ROOT, "overlapArea.c")) sources.append(os...
9,893
f29bc0263f8bb1d59ab2442347727d9d3233ec77
import tkinter as tk import random from tkinter import messagebox as mb n = 16 class Application(tk.Frame): playButtons = [0] * n def __init__(self, master=None): tk.Frame.__init__(self, master) self.grid(sticky='NEWS') self.createWidgets() def show_win(self): msg = "YOU ...
9,894
adb6e33dc665f88c82fcc399688a8dbd67b1e3e3
""" Author: C.M. Gosmeyer Date: Mar 2018 References: "Introduction to Statistical Problem Solving in Geography", J.C. McGrew, Jr., A.J. Lembo, Jr., C.B. Monroe To Do: Should tables interpolate? y = y1 + ((x - x1) / (x2 - x1)) * (y2 - y1) """ import numpy as np import pandas as p...
9,895
796a13de72c2879956c5f9c9c9bdef7253760c9d
from matplotlib import pyplot as plt dev_x = [25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35] dev_y = [4000, 45000, 50000, 55000, 60000, 56000, 62316, 64928, 67317, 68748, 73752] plt.plot(dev_x, dev_y, label='All Devs') #dev_x and dev_y are respectively x-axis and y-axis # Median Python Developer Salari...
9,896
ba5171d3de87ec01770a7174d9783d5058b0fced
import os import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy import stats # prevent numpy exponential # notation on print, default False np.set_printoptions(suppress=True) y_cord_df = pd.DataFrame(data=None, columns=['Time', 'Orien']) list_no = np.arange(0.0, 108000.0, 1.0) y_cord_df['...
9,897
a210a015284130f23bfec99898f2f21163a33a67
import itertools n = int(input()) a = [list(map(int, input().split(" "))) for i in range(n)] ans = 0 for [ix,iy], [jx, jy] in itertools.combinations(a, 2): ans += ((jx-ix)**2+(jy-iy)**2)**0.5*2 print(ans/n)
9,898
cce1b6f8e4b3f78adfa2243fe49b4994d35c5a38
#!/usr/bin/env python # encoding: utf-8 ''' 1D2DCNN抽取特征,LSTM后提取特征,最后将提取的特征进行拼接,CNN与LSTM是交叉在一起的 ''' # 导入相关的包 import keras # 导入相关层的结构 from keras.models import Sequential from keras.layers import Conv1D, Conv2D, MaxPooling1D, MaxPooling2D, Flatten, Dense, Dropout,LSTM,Reshape from keras import Model # 可视化神经网络 from ...
9,899
c55b768466309d2e655c9222e0674a6bc2a958b3
import json import os from subprocess import PIPE, Popen as popen from unittest import TestCase from substra.commands import Config objective = [[{ 'descriptionStorageAddress': 'http://chunantes.substrabac:8001/objective/d5002e1cd50bd5de5341df8a7b7d11b6437154b3b08f531c9b8f93889855c66f/description/', 'key': 'd...