index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
989,300
c10ed0ee80fcc7b056890ee41d789618a96ea91a
""" Secret Tasks are a special kind of Prefect Task used to represent the retrieval of sensitive data. The base implementation uses Prefect Cloud secrets, but users are encouraged to subclass the `Secret` task class for interacting with other secret providers. Secrets always use a special kind of result handler that p...
989,301
045fa3b5dd35f001adf6c035868a6f4ec9fd43bf
#calss header class _CABARETS(): def __init__(self,): self.name = "CABARETS" self.definitions = cabaret self.parents = [] self.childen = [] self.properties = [] self.jsondata = {} self.basic = ['cabaret']
989,302
5dc6cb5fe394f94c29b5793890cec1b75ca51fa4
# coding=utf-8 """内控易校内项目自动审批""" import json import time from service.logger import Log import pymysql import requests service = [ {"service": "demo4.neikongyi.com", "round": "14936", "password": "nga+eNSuUrhHx/K9W1C/a/qtWqsV30AHQjjm0tWToik=,1ihNzkC+zh+TKlMqP4Jz2jjyq6xf35sX,otJ+EuH/6L3TW51gTEKaLULuik2L+Kbvrun...
989,303
41a5f13026b54f9fda7f8ccb5d4ac92f4ebd6bbe
import RPi.GPIO as gpio gpio.setmode(gpio.BCM) MAG_PIN = 9 class IRListener(object): def __init__(self, pin=MAG_PIN): self.pin = pin gpio.setup(MAG_PIN, gpio.IN) def __del__(self): gpio.cleanup(self.pin) def is_ir_present(self): if gpio.input(self.pin) == 1: r...
989,304
6b57b84456366b547a4ccd9fea25cdf914835a84
Python solution using set (36ms) https://leetcode.com/problems/missing-ranges/discuss/50623 * Lang: python3 * Author: LordCHTsai * Votes: 3 class Solution(object): def findMissingRanges(self, nums, lower, upper): """ :type nums: List[int] :type lower: int ...
989,305
96421681dbcbb5d8481630d0f16e8c301d285efa
a=[-30, 8, 23 ,6 ,10, 9, 31, 7, 19, 20, 1, 33, 21, 27, 28, 3, 25, 26] n=len(a) print(n) c=0 x=86 a.sort() for i in range(n-2): l=i+1 r=n-1 while(l<n): if l<r: su=a[i]+a[l]+a[r] if su <x: print(a[i],a[l],a[r]) ...
989,306
473de0be48df9b9ee672737b3c08476691ef4186
class Phone(object): def __init__(self, carrier, change_left = 50): # There are attributes that a phone has # There should all be relevant to our program self.screen = True self.camera = 2 self.mircophone = True self.carrier = carrier self.battery_left = chang...
989,307
6ded825d190093395bab1a63867b9219fe8f4557
"""dropbox quota fields Revision ID: 4d4ffe9376ad Revises: 509229b69f0a Create Date: 2013-09-22 14:15:53.636905 """ # revision identifiers, used by Alembic. revision = '4d4ffe9376ad' down_revision = '509229b69f0a' from alembic import op import sqlalchemy as sa def upgrade(): op.add_column('users', sa.Column('...
989,308
96270028ee376e1a91cde0a17a8f572286c6801a
######################################### #Download and unzip US EPA Fuel economy data from fueleconomy.gov ######################################### import urllib.request import urllib.parse import io import os import zipfile #import shutil import datetime ##################################### # downloadAndExtract -...
989,309
8d463ac1fb23db71370526f6598782f9221e8e92
#!/bin/python xmax = 2.115 # max length of the car ymax = 0.912 # max y width without mirrors zmax = 1.431 # max height wcrearz = 0.313 # z value of the rear wheelbase center / SLR cPillary = 0.624 # y position of the c-pillar/flaps cPillarz = 1.150 # z position of the c-pillar/flaps wakeClosure = 2.88 # closing...
989,310
de937259129b4e0345c86dd6f7d8fa3b8087894b
from operator import itemgetter import sys total_count=0 cword=None for line in sys.stdin: line=line.strip() word,count = line.split('\t',1) try: count=int(count) if cword==word: total_count +=count else: if cword: print(cword, "\t" ,str(total_count)) total_count=count cword=word except Val...
989,311
9fe5abce3d2b302986c7522e527399f2d72f2c1e
#!/bin/env python from DIRAC.Core.Base import Script from DIRAC import S_OK, S_ERROR, exit as dexit import pprint, types class Params(object): def __init__(self): self.file = "" self.prodid = 0 def setFile(self, opt): self.file = opt return S_OK() def setProdID(self, opt): try: s...
989,312
083c2416f7fc38a3253523f08f602af882f25f62
from os.path import dirname, basename, isfile import glob modules = glob.glob(dirname(__file__)+"/*.py") __all__ = [ basename(f)[:-3] for f in modules if isfile(f) and 'dedupe' not in f] #__all__ = ['gui','passchats','sparklog','users','utils','hgfix', # 'dbsearch','domain']
989,313
a7d77275ea7a7f23c14cc9b661bc2195673f05f4
from django.contrib import admin from sms.models import Message, Template, Config, SavedMessage, DelayedCommand admin.site.register(Message) admin.site.register(SavedMessage) admin.site.register(Template) admin.site.register(Config) admin.site.register(DelayedCommand)
989,314
edfd686291bc72c9f00dd5c7c4d2c1ec27560d2c
from rest_framework import serializers, viewsets from ..core.models import Furniture class FurnitureSerializer(serializers.ModelSerializer): room = serializers.StringRelatedField() class Meta: model = Furniture fields = '__all__' class FurnitureViewSet(viewsets.ModelViewSet): serializer...
989,315
e9629a1899541d462d50aa45d5eead21fa095db0
n = int(input()) A = list(map(int,input().split())) B = list(map(int,input().split())) need1 = 0 need2 = 0 for i in range(n): s = B[i]-A[i] if s < 0: need1 -= s else: need2 += s//2 if need1 > need2: print("No") else: print("Yes")
989,316
be6aa7d11ac4c9eac6ebf134ca1f7c21d65f63de
""" Module for iterator implementation """ import re class SentenceIterator: """Iterator for Sentence""" def __init__(self, words): self.words = words self.counter = 0 self.end = len(self.words) def __iter__(self): return self def __next__(self): if self.coun...
989,317
047800bb98fd87439df2c9ebcd0c669377d0bcd1
from app import app, db import os import sys from flask import render_template import flask from app.models import User @app.route('/') @app.route('/index') def index(): return render_template('index.html', title='Flask Tutorial', flask_version=flask.__version__, flask_app=os.environ['FLASK_APP'], db_connection=a...
989,318
3a21c213fc0844a912e07b72b26bdbcfd8461904
import random class Vector: def __init__(self, x, y): self.x = x self.y = y def __add__(self, other): return Vector(self.x+other.x, self.y+other.y) def __eq__(self, other): return self.x == other.x and self.y == other.y def __hash__(self): ...
989,319
5f1d24ace98f9c2b5cc91ac39bf8513827b74ff7
{'_data': [[u'Unknown', [['Immune system', u'Systemisk allergisk reaktion'], ['Psychiatric', u'Oro, s\xf6mnl\xf6shet'], ['Nervous system', u'Huvudv\xe4rk, yrsel'], ['Eye', u'\xd6verg\xe5ende synst\xf6rningar'], ['Cardiac', u'Hj\xe4rtklappning'], ...
989,320
fb2e554d0667c00d16cacf2f75c8c724a365d25a
#Création des listes contenant les mots unites = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen'] dizaines = ['twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety'...
989,321
5431876f465bb405c36c03bd5742c0940b6c72aa
# Display various stats about the charger on the PYBOARD-UNO-R3 board # from unoextra import * from time import sleep ch = Charger() CHARGING_TEXT = { CHARGING_NOT_CHARGING : "Not charging", CHARGING_PRE_CHARGE : "< V BATLOWV", CHARGING_FAST_CHARGE : "Fast Charging", CHARGING_DONE : "Char...
989,322
f8a040ba5ae7c1f9754ad300e9298198681fe272
strRepeats = nuke.getInput('Enter number of copies:', '10') intRepeats = int(strRepeats) bFirstLoop = True #nukescripts.misc.clear_selection_recursive() nRecGroup = nuke.nodes.Group() nRecGroup.begin() kX_Trans = nuke.Double_Knob('x_trans', 'Translate X:') kX_Trans.setRange(-50., 50.) kX_Trans.setValue(20.) nRecGrou...
989,323
453dfc772ebd91eb20521fb50f9dfa9dfa0f1ccb
import os import regex # ------------------------------------------------------------------------------ # def collapse_ranges (ranges): """ Given be a set of ranges (as a set of pairs of floats [start, end] with 'start <= end'. This algorithm will then collapse that set into the smallest possible s...
989,324
d294907f2b61cefabd9ce804e2de72659c678473
def mysolve(vals): print vals print "Len is :" , len(vals) mylist = [] for i in range(10): mylist.append(vals[i]) print "mylist is : " , mylist return mylist
989,325
f33cb807c33acf4ea7b5bc9c9d4b3f6e48d7ead8
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='KDaily', fields=[ ('id', models.AutoField(verbo...
989,326
32fe7427463bbee03a7d66046c45636583cae666
x = 9 y = 7 if x == y: print 'equal' else: if x > y: print x, 'is greater than', y else: print x, 'is less than', y
989,327
3b5167b0fafaabb1356185b432e905df20503cf5
from collections import deque def reverseString(stringToReverse): if not isinstance(stringToReverse, str) or len(stringToReverse) < 2: return False reversedString = deque() for letter in stringToReverse: reversedString.appendleft(letter) print (reversedString) return ''.join(reversedString) def reverseString...
989,328
45c0f3ca6e3be465866ab8ee873549f56ea44a61
# Dictionary dict1 = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25} dict2 = {0: 'a', 1: 'b', 2: 'c', 3: '...
989,329
08a49d8456b50031e74a075c8e172813766956d6
# Generated by Django 3.2.5 on 2021-07-31 21:54 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('main', '0010_remove_recu...
989,330
7169618326bc8acaa8cd96f3165b9c8423a04728
#!/usr/bin/env python # -*- coding:utf-8 -*- #字典练习题 dic = { "k1":"v1","k2":"v2","k3":"v3" } #1.循环遍历出所有的key for key in dic.keys(): print(key) #2.循环遍历出所有的value for value in dic.values(): print(value) #3.循环遍历出所有的key和value for k,v in dic.items(): print(k,v) #4.在字典中添加"k4":"v4",并输出添加后的字典 dic["k4"] = "v4" pri...
989,331
333e76df2aff8105a45f3ddb43968e8339148e30
# -*- coding: utf-8 -*- """ Created on Fri Sep 6 12:43:00 2019 @author: FWass """ import numpy as np import os from functions.fg_norm import fg_norm def write_data_lex(blade_name, data): data_keys = [] check = False counter = 0 eigen = {} for key in data.keys(): data_k...
989,332
69c9f055310e3d0c54bc9c4797e58e9939108a1d
# # @lc app=leetcode.cn id=821 lang=python # # [821] 字符的最短距离 # # @lc code=start class Solution(object): def shortestToChar(self, S, C): """ :type S: str :type C: str :rtype: List[int] """ # @lc code=end
989,333
c00a255906e7011dd007c801774c3dad2faa9c8e
#!/usr/bin/env python3 #----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory # of this distribution and at: # https://confluence.slac.stanford.edu...
989,334
02ec48d0a34dc5c2a8900e7be68161dbcd6a8ba0
""" Crawler de Informacion academica. Detecta las siguientes irregularidades: - Materias obligatorias que no se dictan en el cuatrimestre. - Materias del mismo cuatrimestre (segun programa) que no tienen horarios compatibles entre si. - Materias que no tienen horarios compatibles con jornada laboral. ...
989,335
dbee80e6d74633d873b96726fac160260fb0e17c
import poly class GameMap(object): def __init__( self, width, height, color_dark_wall, color_dark_ground, color_light_wall, color_light_ground, color_bg, room_max_size=10, room_min_size=6, max_rooms=30, ): self.wid...
989,336
8b45e373e2729117ebb407c99453a555711eeec4
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2018-06-22 18:44 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('bunker', '0001_initial'), ] operations = [ migrations.AddField( m...
989,337
92efe1406506a6d294645429661b3db85a57b88b
'''Autogenerated by xml_generate script, do not edit!''' from OpenGL import platform as _p from OpenGL.constant import Constant as _C # Code generation uses this # End users want this... from OpenGL.raw.GL import _errors _EXTENSION_NAME = 'GL_ARB_texture_float' def _f(function): return _p.createFunction(function...
989,338
659e7c482020505613b0f4fd899fec51b6f622e5
# -*- coding: utf-8 -*- ''' This is a simple resolution of given Sudoku. Some Sudoku would have multiple resolutions, but we'll just figure out one of them. You may be interested in the process how this program solve these, then make sure that the variable DEBUG == True. ''' ''' TODO: - [Done] Check the 3*3 cuber. ...
989,339
602e4ba606868fb5837a7643626b36c1c54bd565
from __future__ import unicode_literals, print_function from jinja2 import FileSystemLoader, StrictUndefined from jinja2.environment import Environment #env = Environment(undefined=StrictUndefined) env = Environment() env.loader = FileSystemLoader([".", "./templates/"]) vrf_var = { "vrf_name" : "blue", "Route...
989,340
2c81741209aaa002d533f83d8bb93ffa2afff038
import psycopg2 from sql_queries import create_table_queries, drop_table_queries def create_database(): """ Connects to the database, generates a cursor, drops existing db, creates a new db, disconnects, reconnects and generates a new cursor. Arguments: None Returns: cur=cursor object, conn=connection obje...
989,341
b393c462723c91b99a04993c04166041e3113baa
# set QT_API environment variable import os os.environ["QT_API"] = "pyqt5" import qtpy # qt libraries from qtpy.QtCore import * from qtpy.QtWidgets import * from qtpy.QtGui import * import control.utils as utils from control._def import * import control.tracking as tracking from queue import Queue from threading im...
989,342
7a7d9828d65a44e2ecdfa865879cc833f8d6f34a
# -*- coding: UTF-8 -*- # 作者:hao.ren3 # 时间:2020/9/22 17:44 # IDE:PyCharm from flask import Blueprint bp = Blueprint('main', __name__) from app.main.routes import index
989,343
18e47b55e18fa638317f41c70037a4b14c158ef5
import os import requests from clint.textui import progress class IsoDownloader(object): def start(self, jobs, path_format): total_jobs = len(jobs) job_number = 1 for job in jobs: path = job.get_path(path_format) os.makedirs(os.path.dirname(path), exist_ok=True) ...
989,344
e20e39bdb32936788f6e1908d73ecca9f5fee053
#!/usr/bin/env python3 import math import time import json import random import yfinance as yf import pandas as pd import sys import random from datetime import date, timedelta from pandas_datareader import data as pdr # override yfinance with pandas – seems to be a common step def ectract_data(): yf.pdr_overrid...
989,345
c3f52e68417e6a4ae4effae7f4ac8735cc86e2c2
import sys import easy_alert.util.util from datetime import datetime, timedelta if sys.version_info < (2, 7): import unittest2 as unittest else: import unittest class TestUtil(unittest.TestCase): def test_with_retry(self): self.assertEqual(easy_alert.util.util.with_retry(3, 1)(lambda: 123), 123) ...
989,346
823947f0f1d95ffa6f521a3837144759fe85fbdf
#program to check a number is prime or not num=int(input("enter a number")) flg=0 for i in range(2,num): if(num%i==0): flg=1 break else: flg=0 if(flg>0): print("not prime") else: print("prime")
989,347
4849bccef0784879457189e798a32f8114301303
import quandl, math import numpy as np import pandas as pd from sklearn import preprocessing, cross_validation, svm from sklearn.linear_model import LinearRegression import matplotlib.pyplot as plt from matplotlib import style import datetime import pickle style.use('ggplot') #Get Acxiom stock data df = quandl.get("...
989,348
35ab4b024bd64dd6b4f91f1394ab206caf67a25d
import logging import requests from Test_api.BASE_API.member import Member class Test_api(): def setup_class(self): self.member = Member() def test_get(self): logging.info('开始执行获取成员信息用例') r = self.member.test_get() logging.info('断言返回码') assert r.json().get('errcode...
989,349
473dfda760e67107893f254f080254c9264b4c3a
import cv2 import numpy as np from scipy import ndimage from scipy.misc import imresize from PIL import Image, ImageStat from imageio import imread, imsave def detect_color_image(file, thumb_size=40, MSE_cutoff=22, adjust_color_bias=True): pil_img = Image.open(file) bands = pil_img.getbands() if(bands == (...
989,350
a7c7ea42cb1f5ee5e8ba09dec5d86eb1a53d28db
# -*- coding:utf-8 -*- import sys import json listStr = [{"city": "北京"}, {"name": "大刘"}] json.dump(listStr, open("listStr.json", "w"), ensure_ascii=False) dictStr = {"city": "北京", "name": "大刘"} json.dump(dictStr, open("dictStr.json", "w"), ensure_ascii=False) # json_load.py import json strList = json.load(open("li...
989,351
017b7bde18931e35cd3199605009d110fe909614
from app.models import db, User, Note, Power, Role def initializer_database(): tables = [ User, Note, Power, Role ] try: db.drop_tables(models=tables) db.create_tables(models=tables) except Exception as e: raise e if __name__ == '__main__': ...
989,352
e5529dc1bdee3637cf9f1f111a1523c479bd2f0e
import numpy as np import collections import matplotlib.pyplot as plt import argparse import sys import os #data:(nboxes,channel,width,height) def vis_square(data,title): data_box=data[0] #box0:(channel,height,width) #normalize data for display data_box=(data_box-data_box.min())/(data_box.max(...
989,353
04466b351a94d0d2035eb2fc19596c0523b793c5
import os import functools import itertools import pytest import rlp from ethereum import blocks from web3.utils.encoding import ( decode_hex, ) from alarm_client.contracts.transaction_request import TransactionRequestFactory from testrpc import testrpc NULL_ADDRESS = '0x0000000000000000000000000000000000000...
989,354
931e41317fa74e2dd1cac32a2e14ac3148890880
from .base import (Drug, ObservationalStudy, PharmaCompany, # noqa PaymentRecipient, PharmaPayment) # noqa from .zerodocs import ZeroDoctor, ZeroDocSubmission # noqa
989,355
977fecfadde758549d6bd1c8963ef769273562d0
# Copyright (c) 2018, Palo Alto Networks # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS...
989,356
e60da5ed1c4294bf548a7b5d2bbc8def04f9bc46
class Solution: def romanToInt(self, s): dict = {'I':1,'V':5,'X':10,'L':50,'C':100,'D':500,'M':1000} int = 0 for i in range(len(s)-1): if dict[s[i]] >= dict[s[i+1]]: int += dict[s[i]] else: int -= dict[s[i]] int += dict[s[-1]] ...
989,357
d8e8c15645ed18202c3e40a1d930e0dfa8944101
import os INPUT_PATH = os.path.realpath("{0}/../input".format(__loader__.path)) def exists(expenses, expense): try: return expenses.index(expense) and True except: return False def get_complement_product(expenses, expected_sum): for expense in expenses: complemen...
989,358
42ea3c848e26ca013823d6067f926319c1bd06a9
import debug_toolbar from django.conf.urls import include, url from django.urls import path from django.contrib import admin from rest_framework.routers import DefaultRouter from brands.views import BrandViewSet from elements.views import ElementViewSet from projects.views import ProjectViewSet from account.views impo...
989,359
84bffb71c1fa0d7664d3e8734b76b8f30e9674e7
from django import forms class LoginForm(forms.Form): user = forms.CharField( required=True, widget= forms.TextInput( attrs={'class': 'input', 'placeholder': 'enter name', 'name': 'user' }) ) password = forms.CharField( required=True, widget=forms.PasswordInput(...
989,360
3c9a21161561f6781c4f29f15bcea0ef7fc84399
def updateHand(hand,word): newHand = hand.copy() for l in word: if l in newHand: newHand[l] = newHand[l]-1 for k, v in newHand.items(): if v == 0: del newHand[k] return newHand updateHand({'a': 1, 'r': 1, 'e': 3, 'd': 2},'red')
989,361
60420fae630717bfc43dde84feaa96bdf6f105e2
import sys import time import os import re import shutil import time import json import html wpull_hook = globals().get('wpull_hook') # silence code checkers counter = 0 firsturl = '' ia_metadata = {'identifier': '', 'files': [], 'title': '', 'description': '', 'mediatype': 'movies', 'collection': 'archiveteam_video...
989,362
9bd80ba5cefbe133fcaee14ae556f63434f637e7
import numpy as np def task1_1(position): return position[0]**2 + position[1]**2 + 1 def task1_3(n_particles, particle_position_vector): velocity_vector = ([np.array([0, 0]) for _ in range(n_particles)]) iteration = 0 while iteration < n_iterations: for i in range(n_particles): fit...
989,363
47c124bdc57cb05d910187f9eb6e9bafbf711173
# -*- coding: utf-8 -*- # @Author: liusongwei # @Date: 2019-05-16 13:54:38 # @Last Modified by: liusongwei # @Last Modified time: 2019-05-18 14:24:35 import numpy as np import tensorflow as tf # with tf.Graph().as_default() as g1: # base64_str = tf.placeholder(tf.string, name='input_string') # input_str = tf....
989,364
91d4c2dfcdcd9c24faed4dca8b482e34fe76472d
from rest_framework import serializers, viewsets, pagination from images.models import Image class ImagesSerializer(serializers.ModelSerializer): class Meta: model = Image fields = ('id', 'image', 'width', 'height')
989,365
61281760144b056e25119030ad9cd95e6be9e031
from smoothies import smoothie_ingredients from soupingredientsstandard import soup_ingredients from saladtoppings import salad_ingredients from dangerdanger import danger_ingredients from random import choice, randint food_type_databases = [smoothie_ingredients, soup_ingredients, salad_ingredients] class DangerFactor...
989,366
a0b406f88ad24bddecb633441a605649f0602771
import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.linear_model import LinearRegression data = pd.read_csv('data_linear.csv').values x = data[:, 0].reshape(-1, 1) y = data[:, 1].reshape(-1, 1) plt.scatter(x, y) plt.xlabel('mét vuông') plt.ylabel('giá') lrg = LinearRegression() # Train ...
989,367
3929a8383c75d132a6dba889cd6c4e004261375d
import MySQLdb import struct, os db=MySQLdb.connect(host="localhost",user="root", passwd="root",db="unweb_iub") cursor=db.cursor() sql_ses="""select DISTINCT SES_ID FROM hde""" cursor.execute(sql_ses) ses_rows=cursor.fetchall() for srows in ses_rows: print srows[0] sid=input("PICK A SESSION ID FROM THE LIST: ") sql...
989,368
59ece7605884a0f0ef8bd57fc154d03c30971d33
import boto3 INSTANCEID = '' ec2 = boto3.resource('ec2') instance = ec2.Instance(INSTANCEID) print(instance.volumes.all())
989,369
67ba2c99e1dd6edb40f62bb088c74fb30aba1868
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import pms.supplier.models.category class Migration(migrations.Migration): dependencies = [ ('supplier', '0019_add_field_salecategory_cid'), ] operations = [ migrations.AlterField( ...
989,370
e014f9879692335d0236fb446187318cd1b58d1d
# ============================================================================= # MIT License # # Copyright (c) 2021 luckytyphlosion # # 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 withou...
989,371
3cf11133c33b84d9d802ab37962ed0a48db0047b
import pytest from pytest_lazyfixture import lazy_fixture from .hexagonal import * # noqa # Fixtures need to be visible for lazy_fixture() calls. from .honeycomb import * # noqa from .kagome import * # noqa from .linkerless_honeycomb import * # noqa from .periodic_hexagonal import * # noqa from .periodic_honeyco...
989,372
a86194d923edab80a6edac6d074c02b20389cb6e
def solution(brown, yellow): answer = list() for i in range(3, brown-2): find = False for j in range(3, brown-2): if i < j: break if ((2 * i) + (2 * j)) - 4 == brown and (i-2)*(j-2) == yellow: answer = [i, j] find = True break if find: break return answer ''' 제곱근을 이용해 둘레 확인 -> 속도차 발...
989,373
81e6c05f8bdc9246eedbd2b3176ed781bf45dcb2
""" This file demonstrates writing tests using the unittest module. These will pass when you run "manage.py test". Replace this with more appropriate tests for your application. """ from decimal import Decimal from django.core.urlresolvers import reverse from django.db.models.loading import get_model from django.test...
989,374
28c00c6b7f56572f690b06864e871c39eca95b42
import math def fuel_until_zero(mass, sum): fuel = math.floor(mass / 3) - 2 if fuel <= 0: return sum else: sum += fuel return fuel_until_zero(fuel, sum) f = open("inputp2.txt", "r") lines = f.readlines() sum = 0 for line in lines: sum += fuel_until_zero(int(line), 0) print(...
989,375
0216dfca668d112b2fed6213a45a82cc8438bbaa
#!/usr/bin/env python3 import argparse import os import glob import csv import sys import re from shutil import which import datetime def is_tool(name): return which(name) is not None def check_path(path): paths = glob.glob(path) if len(paths) == 0: exit("file not found: %s" % path) if len(pa...
989,376
a743bac43902af5309937415a26151e28d84367e
''' Thermodynamic Parameter Routines ''' from __future__ import division import numpy as np import numpy.ma as ma from sharppy.sharptab import interp, utils, thermo, winds from sharppy.sharptab.constants import * ''' This file contains various functions to perform the calculation of various convection indices. ...
989,377
afa5b1c76f155900b8834a2ad6c4903c6ed7479f
number = input( "Enter a number, and I'll tell you if it is a multiple of ten or not: ") number = int(number) if number % 10 == 0: print("The number " + str(number) + " is a multiple of ten.") else: print("The number " + str(number) + " is not a multiple of ten.")
989,378
00a6c0387f98bd2a806e8953fd8387f18ecad504
import json context_path = "/metabolights/ws" class TestIsaStudy(object): def test_get_study_contacts_01(self, flask_app, sensitive_data): study_id = "MTBLS1" with flask_app.test_client() as c: headers = {"user_token": sensitive_data.super_user_token_001} result = c.get(...
989,379
7d4b477ff1e7e3b7f1b2bd1e6427f1682393abdc
#!/usr/bin/env python # -*- coding: utf-8 -*- # Import built-in packages import argparse, os, pickle, time # Import external packages import numpy as np import matplotlib.pyplot as plt import PIL.Image as Image def generate_area_crop(img): """ args: img : PIL.Image return: crop_area : tuple, of length = 4 ...
989,380
f187ee11e1f91100d8faaf9706e58f6f2130c2a0
import numpy as np def binary_classifications(predictions: np.ndarray) -> np.ndarray: assert predictions.shape[1] == 2, \ f'Predictions are not binary, {predictions.shape=}' return (predictions[:, 1] > 0.5).astype(int) def classifications(predictions: np.ndarray) -> np.ndarray: return np.argmax(...
989,381
7eee9db0aab66a0270527a8e34c60cc4378a41ef
import xml.etree.ElementTree as ET import os oname = ['person', 'car', 'bicycle', 'motorbike', 'dog'] def parse_rec(filename): tree = ET.parse(filename) root = tree.getroot() rmId = [] for i, obj in enumerate(tree.findall('object')): if obj.find('name').text not in oname: rmId.append(i) a = len(rmId)-1 whil...
989,382
e9161e807dee353ee302711d4eda79f7b6862ed2
# -*- coding: utf-8 -*- """ Created on Sat May 30 22:31:10 2020 @author: Mouiad """ import numpy as np import matplotlib.pyplot as plt import matplotlib.image as mpimg import os import re import getLane # Code to generate lane coordinates from probablity maps. # Experiment name exp = "vgg_SCNN_DULR_w9" # Data root ...
989,383
fcc3327637da097f1d7e19c2ea685b5c4e39ff48
# -*- coding: utf-8 -*- # @Author: LC # @Date: 2016-04-08 15:02:26 # @Last modified by: LC # @Last Modified time: 2016-04-10 16:22:30 # @Email: liangchaowu5@gmail.com # 找到与target相同的数,从这个位置往左右递归找 class Solution(object): def searchRange(self, nums, target): """ :type nums: List[int] :ty...
989,384
7fb9ef06d147de2a718e78ebaf0f66666fd0493a
# Installing Python Packages # Get Package Import Manager "pip": # http://pip.readthedocs.io/en/stable/installing/#installing-with-get-pip-py # Upgrade pip # python -m pip install -U pip # Install some packages # pip3 install numpy # pip3 install pandas # First NumPy Array # Create list baseball baseball = [180, 21...
989,385
e0481a81f8aab91275d5f005d3c8b59712fe261c
#!/usr/bin/python3 # -*- coding: UTF-8 -*- import pandas as pd import os class CsvFile(): path = '' reader = None def __init__(self,path): self.path = path self.reader = pd.read_table(self.getListFiles(path)[0], sep=',', chunksize=1) def getListFiles(self): path = self.path ...
989,386
e1643a273e238ad3fa61e43af774185ce702c43d
import os import matplotlib.pyplot as plt from keras.models import load_model from keras import backend as K import numpy as np import pandas as pd def load_data(): x_train = [] temp = pd.read_csv("train.csv", skiprows = 0) y_train = np.array(temp.ix[:, 0]) for i in range(temp.shape[0]): x_train.appe...
989,387
b90dea0ddc8cc2da632fbc9bd3f037de71b2a91f
from django.apps import AppConfig class MencrepairlogConfig(AppConfig): name = 'mencrepairlog'
989,388
c11b4c1c535c54c9d7e8bd0956e2168b2d70c75f
def exchange(a, b): temp = a a = b b = temp return a, b a = 10 b = 20 a, b = exchange(a, b) print(a, b) a, b = b, a print(a, b)
989,389
04d17dbfafd817027a4fe9e64f10b529b58d7dc4
VENV_FOLDER = '~/.virtualenvs' VENV_NAME = 'cms' APT_GET_DELAY = 24*60*60 # in seconds package_info = [ ('apt-get-update', { 'exists': [ ('[ $(($(date +%s) - $(stat -c %Y /var/lib/apt/periodic/update-success-stamp) - {})) -le 0 ]'.format(APT_GET_DELAY), 0), ], 'ins...
989,390
2ba2f3a6cdd5ec29a261c599691150e8d4532b0c
#!/usr/bin/env python from json_base import json_base from tools.user_management import user_pack class invalidation(json_base): _json_base__status = ['new', "hold", 'announced', 'acknowledged'] _json_base__schema = { '_id': '', 'prepid': '', 'object': '', 'status': '', ...
989,391
7062241f343e8ea2495894f7fc245c5a6d66dc21
import json import os def get_data(path=None): """ get config data from file Args: path(string): path to config file Return: dict {"login":value", "password":value} """ # use default path if not path: path = os.path.relpath("config.json") try: wit...
989,392
85c5507aa7f00b862e447d3440d1ffe51f258c99
from ForwardAnalysis.Utilities.etaMinCandViewSelector_cfi import etaMinCandViewSelector as etaMinPFCands etaMinPFCands.src = "particleFlow"
989,393
08d99fa97a58cb5115aeb04265ab5f97367818e4
from flask import Blueprint, request, jsonify http_methods = Blueprint("http_methods", __name__) # getting data from different type requests @http_methods.route("/", methods=["GET"]) def get_method(**request_variables): return jsonify({ "request_method": request.method, "request_variables"...
989,394
34fc556dc40f3a84e04620fd858332f64050a502
if __name__ == "__main__": fp = open('hello.txt','rt',encoding='utf-8') line = fp.readline() print(line.strip()) line = fp.readline() print(line.strip()) line = fp.readline() print(line.strip()) fp.close()
989,395
8fc1812550898d9ae6d156ce3a75ef86d41c6eba
"""initiate strain advisor app""" from app import create_app APP = create_app()
989,396
90cf841f5af6fccd7150892bb76bae9cdac48edc
class JointProbabilityTable: def __init__(self, columns, data): self._columns = columns self._probability_index = len(columns) self._data = self._normalize(data) def _normalize(self, data): probability_sum = 0 for row in data: probability_sum += row[-1] for row in data: if probability_sum != 0: ...
989,397
844aa040e6f099c42330543d6555d49f3e6e49d3
''' You are given a string of length 5 called time, representing the current time on a digital clock in the format "hh:mm". The earliest possible time is "00:00" and the latest possible time is "23:59". In the string time, the digits represented by the ? symbol are unknown, and must be replaced with a digit from 0 to ...
989,398
d1e21490055489024d5371eb25eef2e5f5b415d1
from itertools import permutations from src.bst import Bst import pytest THREE_NODE_TREE = list(map(list, permutations(range(3)))) FOUR_NODE_TREE = list(map(list, permutations(range(4)))) FIVE_NODE_TREE = list(map(list, permutations(range(5)))) SIX_NODE_TREE = list(map(list, permutations(range(6)))) SEVEN_NODE_TREE =...
989,399
84daa781023ce420144cee4d18aaa8e09c737d49
#Gear Selection for Max Acceleration on a Bicycle import numpy import matplotlib.pyplot as plt import math #Bicycle Parameters M = 70 #[kg] It = 0.2 #[kg*m^2] Rt = 0.4 #[m] grats = [32/53, 20/53, 11/53] #Defined as R2/R1 (same as cars) thetapdot = numpy.linspace(0,250,501) #[rpm] thetapdot2 = thetapdot*2*math.pi/60 ...