index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
995,900
5474e7af7febf01d0d04168e25ecab1342619a83
#!/bin/python3 # Link to the problem: https://www.hackerrank.com/challenges/apple-and-orange import sys def appleAndOrange(s, t, a, b, apple, orange): # Complete this function apple_count = 0 orange_count = 0 for app in apple: if(app+a >= s and app+a <= t): apple_count += 1 f...
995,901
e30bdffeacd5ea6bcb1b475d35b3c6f9efd2a3ba
import sys import random import pygame def create_player_cards(): # 创建卡片信息,player _card = [x for x in range(13)] cards = [] player = [[], [], [], []] # 单副牌(除去大小王) for x in range(4): color = list(map(lambda n: (n, x), _card)) cards = cards + color # 再加一副牌 ca...
995,902
cf65af326097c48720cd89c6423b46b4881d72fb
from __future__ import absolute_import from __future__ import division from __future__ import print_function import time import logging import numpy as np from six.moves import xrange # pylint: disable=redefined-builtin import tensorflow as tf from tensorflow.python.ops import variable_scope as vs from evaluate imp...
995,903
f95f95686cff196c12bbb62ea2379a4b4d20f565
# we will keep all of the constants here inputDir = "../wc_input/" outputDir = "../wc_output/" wcOutputFile = outputDir + "wc_result.txt" medOutputFile = outputDir + "med_result.txt"
995,904
50581849d498934f78a1278caae314b3259f444d
import os import pygame class Car: __cars_img = { (100, 50): '1.png', (150, 50): '2.png', (50, 100): '3.png', (50, 150): '4.png' } __SPEED_LIMIT = 50 cars = [] def __init__(self, x, y, width, height): if y == 100 and height == 50: self.is_ma...
995,905
1e7bac4371653e35242c53f2c558298184934801
# -*- coding:utf-8 -*- # Author:lpw # Time: 2019/2/28 22:31 # -*- coding:utf-8 -*- # Author:lpw # Time: 2019/2/28 22:04 import pymysql from pymysql.cursors import DictCursor conn = None try: conn = pymysql.connect('120.25.160.52','root','111111','test') with conn as cursor: #with conn 返回一个connections对象,这个对象的__...
995,906
af62c96d014240d1aef23698d11438105613e06f
 from numpy import matrix from numpy import linalg A = matrix( [[1,2,3],[11,12,13],[21,22,23]]) steplengthR = 0.5 steplengthL = 0.4 steplength_matrix = ([steplengthR, steplengthL]) print A print steplength_matrix a=[[1,1],[2,1],[3,1]] b=[[1,2],[2,2],[3,2]] print a[2][0] print a c =a[2][0] + a[1][0] print c globa...
995,907
73a78fc94175cd5c6941672b86f68f2cfe36efad
# coding: utf-8 from rq import Queue from redis import Redis from workers import ( fast_worker, lazy_worker ) rdb = Redis() fast_queue = Queue('fast', connection=rdb) lazy_queue = Queue('lazy', connection=rdb) if __name__ == "__main__": short_tasks = [1, 3, 2, 5, 6, 7, 8] long_tasks = [20, 12, 34, ...
995,908
838c7fb1896ef8b559f96f12c717729463700c4a
from base_handler import BaseHandler class handler(BaseHandler): def do_POST(self): self.handle_POST("./lib/ite-personal-scores")
995,909
da7b0e3fc0d79142383e734aeacd62d44d81ae76
from threading import Thread def add(a, b): print(a + b) # START thr = Thread(target=add, args=(1, 2), daemon=True) thr.start() # END thr.join()
995,910
f208c1ef300ace68aaa6778d9b36c60a9f04f36a
#!/usr/bin/env python3 from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor import time import random # def run(i): # time.sleep(1) # print("%s is running" % i) # # # if __name__ == '__main__': # p = ThreadPoolExecutor(5) # # for i in range(20): # # p.submit(run, i) # p.ma...
995,911
06480bff93c8dbe61b614f1c73061fa25ffc0bbe
"""this module servers the purpose of declaring app as a package and also as an application factory""" import os from flask import Flask, Response, json # from flask_jwt_extended import JWTManager from flask_swagger_ui import get_swaggerui_blueprint from flask_cors import CORS from app.views.redflag_view import redfl...
995,912
8bbeaefffd7853473102e9eddd3364d5cd233375
################################################################################# # WaterTAP Copyright (c) 2020-2023, The Regents of the University of California, # through Lawrence Berkeley National Laboratory, Oak Ridge National Laboratory, # National Renewable Energy Laboratory, and National Energy Technology # Labo...
995,913
5aa4ed665753c7bafda767d18225aa4c686be8ce
import os import sys from extractor import files, registry def usage(): print "Usage: " + sys.argv[0] + " <directory>" sys.exit(1) def main(): if len(sys.argv) != 2: usage() if os.environ.get("EXTRACTOR_DEBUG") == "1": print "DEBUG" registry.DEBUG = 1 if os.environ.get(...
995,914
e3a967e5434546872dcdd6de19cdeba41e06af8b
from collections import defaultdict import math import torch import torch.nn as nn from torchvision import models from mlx.od.fcos.decoder import decode_batch_output from mlx.od.fcos.loss import fcos_batch_loss class FPN(nn.Module): """Feature Pyramid Network backbone. See https://arxiv.org/abs/1612.03144 ...
995,915
c81229498f6d97591968f92267dea2674a5d9d91
# Generated by Django 3.2.8 on 2021-10-15 23:12 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Conta', fields=[ ('id', models.BigAutoField...
995,916
929697543aab869b1e2c577e3126b81e4f0a9411
from airflow.hooks.postgres_hook import PostgresHook from airflow.models import BaseOperator from airflow.utils.decorators import apply_defaults class LoadDimensionOperator(BaseOperator): create_user_sql = """CREATE TABLE IF NOT EXISTS public.users ( userid int4 NOT NULL, first_name varchar(256), last_nam...
995,917
aa757926c7509dfd8bc81a7f1503777e09fa944b
from bs4 import BeautifulSoup import urllib2 import re from collections import Counter page = urllib2.urlopen("http://localhost") soup = BeautifulSoup(page, features="html.parser") text = soup.get_text() lst = re.findall(r'\w+',text) count = Counter(str(x) for x in lst) result = count.most_common(1)[0] word = result[0...
995,918
56587f1432bcb31e1cac8f9fd46fbd64d096470c
import sys import re from itertools import chain def countUniqueWords(filename): f = open(filename, 'r') return len(set(chain(*(line.split() for line in f if line)))) f.close() def bag(filename, N): f = open(filename, 'r'); content = f.readlines() #Create output matrix of length 12*...
995,919
1ae8df8b4fefc632992b27f806fc594289e727e6
import glob import os def listDir(): print('listDir function: list all the files in the current directory') print('list files use glob: it is a list type') fileList = glob.glob('*.csv') print(fileList) def readFile(fileStr): print('readFile function') print('read all the content') inFile = open(fileStr,'r') ...
995,920
80acdbec4302ce1a16b6ab75e33cb78532a0df89
# Copyright Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompan...
995,921
0a2cb6f14727dc85a909f5d97a65f433452215ba
import os import shutil import requests import time import re from pathlib import Path from github import Github from git import Repo from pydriller import RepositoryMining from comment_parser import comment_parser as c from comment_parser.parsers import common ENV = "" MIME_MAP = { ".js" : 'application/javas...
995,922
bf84b1b66c2dd63ba049f028d39cf1299d7ea3db
# flake8: noqa from .create_pets import CreatePetsResolver from .update_pets import UpdatePetsResolver from .delete_pets import DeletePetsResolver from .list_pets import ListPetResolver from .fetch_pets import FetchPetResolver
995,923
52fc6a9b8daf04de993447278e2d2eac234449cb
"""We use this file as an example for some module.""" from __future__ import annotations from typing import Callable, cast import numpy as np from baynet import DAG __all__ = ["generate_dag"] def _shuffle(positive: int, total: int, padding: int) -> np.ndarray: positive = np.min([positive, total]) result = ...
995,924
06818e8dd86f25e2dbabf5e38a8f3717c80831ed
import numpy as np import tensorflow as tf from scipy import special as sp #cubic_model = tf.pow((1 - t), [3]) * cp0 + tres * tf.pow(1 - t, [2]) * t * cp1 + tres * (1 - t) * tf.pow(t, [2]) * cp2 + tf.pow(t, [3]) * cp3 def izOne(x, y): if x == 1: return 1 if y == 1: return 1 else: return x * y de...
995,925
d4be745ba2fab13eb1397ae9e09593a90dd7b8a0
import pandas as pd #Ques_1 info=pd.read_csv("Assignment_20(Ques_1).csv") data=pd.DataFrame(info) print(data,"\n") #Ques_2 Weather=pd.read_csv("Assignment_20(Ques_2).csv") data_1=pd.DataFrame(Weather) print("\nFirst 5 rows:\n",data_1.head(5)) #Prints first 5 rows of data_1 print("\nFirst 10 rows: \n",dat...
995,926
10d3a7c7f76d1b888eee2d58313d7f0c4c0636f1
print("caseStudy: 학점 계산 - 반복 중첩 조건문 8단계 - 여러 점수 계산") print("m3_1_forIfElifElseMultiTest_001_02") print("1. score, score1 변수 선언") print(' score = [100,95,90,85,80,75,70,65,60,55]') print(' score1 = []') score = [100,95,90,85,80,75,70,65,60,55] score1 = [] print() print("2. 여러 조건에 따라 실행하는 반복문: ") print(' for i in ...
995,927
b5bcca355dc595b99d5c206f48bec17224cdbf1f
import socket import logging from twisted.internet.protocol import DatagramProtocol from . import stun from .agent import Message from .authentication import CredentialMechanism from . import attributes logger = logging.getLogger(__name__) class StunUdpProtocol(DatagramProtocol): def __init__(self, reactor, inte...
995,928
6a433c79e27af9e6e686f6419bc9bfe73c4b82e1
# -*- coding: utf-8 -*- # Generated by Django 1.11.1 on 2017-06-03 21:49 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): initial = True dependencies = [ ] operation...
995,929
570f3c9c047f8aac88e9287d1f4754497bfadbf6
import cv2 import imutils as imutils import numpy as np import random import sys from os import path import matplotlib.pyplot as plt import matplotlib.colors import scipy def readFileAndResize(): srcImage = cv2.imread("imagehh.jpg") srcImage = cv2.resize(srcImage, (1080, 1080))# default image img = np.ui...
995,930
d640a5dc752ff04b92058f610e5a61d8e953710d
def say_hello(): print ('this is a function') #end of function #calling a function say_hello()
995,931
f2be85880479a80740a995ed0736016b2ccb3e44
#!/usr/bin/env python from tornado.web import authenticated from knimin.handlers.base import BaseHandler from knimin import db class AGUpdateGeocodeHandler(BaseHandler): @authenticated def get(self): stats = db.getGeocodeStats() self.render("ag_update_geocode.html", stats=stats, ...
995,932
a6022192d4c78b8c89ede55bba0f0fa109d6a977
#------------------------------------- # function to write condor scripts import os import os.path import sys def write_scripts(dataset, fileno, jobid, gensubmitdir, submitdir, submithost, uid, copyfiles, outdir, command, projectbase_RHEL7, project_RHEL7, fdag, username) : outbase = "%s_%s" % (dataset, file...
995,933
e1a6cfb12c5848b0f63f3a083239f9de46517f22
#!/usr/bin/env python from google.cloud import bigquery client = bigquery.Client() jobs = client.list_jobs(max_results=50, state_filter='DONE') failed_jobs = (job for job in jobs if job.job_type == 'query' and job.errors is not None) for job in failed_jobs: print("Query: " + job.query) print("Error: " + job....
995,934
c53276405fe6d82e27d6091ea0adde533f12a372
def twoStrings(s1, s2): flag = False a = {} b = {} for element in s1: if element not in a.keys(): a[element] = 0 a[element] += 1 for element in s2: if element not in b.keys(): b[element] = 0 b[element] += 1 for key in a.keys(): if ...
995,935
2ed44b1610b6c923800c6cc590185d8f5d5c1305
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
995,936
55aac2dc3336f9072f9c86e03e27cc265951b17e
"""Test suite. Copyright 2010-2015 Brandon Rhodes. Licensed as free software under the Apache License, Version 2.0 as detailed in the accompanying README.txt. """ from unittest import TestCase from adventure import load_advent_dat from adventure.game import Game class CommandTest(TestCase): def setUp(self): ...
995,937
34ba9624e3d34c6620a711928d79db5359d6d871
from device import * from google.appengine.ext import webapp from google.appengine.ext.db import stats class AddDevice(webapp.RequestHandler): def post(self): device = Device() device.name = self.request.get('deviceName') device.deviceID = self.request.get('deviceID') query = Device...
995,938
49f43d43df6b084e20aa7b440f54541cbcc7a051
from skateboardapp.models import Skateboard from skateboardapp.serializers import SkateboardSerializer from rest_framework.views import APIView from rest_framework.response import Response from rest_framework import status class SkateboardList(APIView): def get(self, request, format=None): skateboard = Ska...
995,939
f41f9852dc75963e03a0e16753fe45b0dc48c925
#!/usr/bin/env python import unittest import mortimer.web class TestRouter(unittest.TestCase): def setUp(self): self.router = mortimer.web.Router() def test_invalid_route(self): route = self.router.find_route('/') self.assertEqual(route, None) def test_add_route(self): s...
995,940
e8493ebcc4ffdf3dbe6ef3b0af9ee47a9e6f6ce5
from odoo import api, fields, models, _ class GoldFixingPositionReport(models.Model): _name = 'gold.fixing.position.report' name = fields.Char(string='Doc. No.') date = fields.Date(string='Doc. Date') quantity_in = fields.Float(string='In') quantity_out = fields.Float(string='Out') rate_kilo ...
995,941
50d09eeef2c6bfc6eb0a7c77f3f37c5dc992226f
from django.contrib import admin from ultimate.index.models import * class StaticContentAdmin(admin.ModelAdmin): list_display = ('url', 'title',) list_display_links = ('url',) save_as = True save_on_top = True admin.site.register(StaticContent, StaticContentAdmin) class StaticMenuItemsAdmin(admin.ModelAdmin): ...
995,942
e6ea22580369c23dafdcbb10e5c5e23a0105cd73
import random import unittest import src.uriHandler as uhandler class TestUriHandler(unittest.TestCase): def setUp(self): self.uriHandler = uhandler.UriHandler() def test_getSchemeSeparator(self): scheme = self.uriHandler.getSchemeSeparator('http://') self.assertEqual(scheme, "://") ...
995,943
1111397b523e22fb6087f7dac5829717db2f1acb
l = 10 def test1(): l = 5 print(l) # 5 def test2(): print(l) # 10 def test3(): try: l = l + 10 print(l) # local variable 'l' referenced before assignment except Exception as e: print(e) def test4(): global l l = l + 10 print(l) # 20 test1() test2() t...
995,944
83f8b4b039f2d75966fc6a00c23227be87fde215
import sys import random def Minesweeper(columns, rows, difficulty): outcome = 0 field = [[] for x in range(0,rows+2)] facade = [[] for x in range(0,rows+2)] revealed = [[] for x in range(0,rows+2)] for x in range(0,rows+2): field[x] = [0]*(columns+2) for x in range(0,rows+2): facade[x] = ["⏹️"]*(columns+2) ...
995,945
fca1c02fc48c366b2d27ed105fdb379cf19e004b
#========================================================================= # # Python Source File -- Created with SAPIEN Technologies PrimalScript 4.1 # # NAME: problem 84 # # AUTHOR:hbf # DATE :14 sep 2007 # # COMMENT: # #========================================================================= n=4 or 6 def add_row(r...
995,946
ddee2062cd83ff742e64f69400b9c664230a7514
#!/usr/bin/python val1=40 val2=val1 val3=[val2] del val1 print val3
995,947
b7e0ea5cb2fa04a97d033c41725ed792536a781a
from abc import ABC, abstractmethod class Pessoa(ABC): """Representa uma pessoa. atributos: nome, cpf. """ @abstractmethod def __init__(self, nome: str, cpf: int): self.__nome = nome self.__cpf = cpf @property def nome(self): return self.__nome @nome.setter ...
995,948
7fcddf1a7de4ff2e9878b300c5047818e2253be0
from django.conf import settings from django.contrib.auth import get_user_model, authenticate, login, logout from django.urls import reverse_lazy from django.http import HttpResponseRedirect from django.shortcuts import render from django.views.generic.base import TemplateView from gamesight.apps.accounts.models impor...
995,949
ee92cb6c23cef031aab88512e8a53c9550276e52
""" Vasya implemented nonoptimal Enum classes. Remove duplications in variables declarations using metaclasses. from enum import Enum class ColorsEnum(Enum): RED = "RED" BLUE = "BLUE" ORANGE = "ORANGE" BLACK = "BLACK" class SizesEnum(Enum): XL = "XL" L = "L" M = "M" S = "S" XS =...
995,950
75c89122df91b70afa5ea237489ec736a3ffdd07
/Users/gesteves/anaconda/lib/python2.7/sre_parse.py
995,951
1f2db516b3868334639f29ccfa3dc2221de735e7
class MemoryAccessError(IndexError): pass class MemoryReadError(MemoryAccessError): pass class MemoryWriteError(MemoryAccessError): pass
995,952
1f0cff42650faa60fe4464baf61660dc05f52f2d
from unittest import TestCase class AuthHelperTestCase(TestCase): """ Implement some custom tests functions """ def assertAnyIn(self, needles, haystack): """ Asserts wether any of needles exists in haystack :param list needles: Collection what we are searching for :par...
995,953
9c291a963204aa774caa51a83be4ef2ea9322290
def findTheAccessCodes(l): #Checking each item in the list for multiples will be taxing for large lists #Instead I will create a dictionary for each index, of all the indexes which #contain values that are divisible by the key index's value. #For example l = [2,4,8,10,16] #Map of l = {0:[1,2,3,4],...
995,954
2905874604a73587b16ddbea10741c4a42c91b87
import web3 import base64 from web3 import Web3, HTTPProvider from web3.middleware import geth_poa_middleware # TESTED WITH python 3.6 # Fill these in to test, ex. remove @RPC_ENDPOINT@ USER = "@USER@" PASS = "@PASS@" RPC_ENDPOINT = "@RPC_ENDPOINT@" # Encode the username and password from the app creds into USER:PA...
995,955
d2843e247e4b0a38e15a36ffdb8dd85f1f234244
from shapes import * square() pentagon() hexagon() octogon() star() circ() mainloop()
995,956
0bef7cbd37c7bcdca64f39493088deabfbfdf8b4
import requests class Network: def __init__(self, baseUrl): self._baseUrl = baseUrl def request(self): req = requests.get(self._baseUrl) statusCode = req.status_code content = req.content return statusCode, content
995,957
53cf44be5aa0fc2fc219ca00654f3d72dff9f59c
class C: def method(self, a, b): pass _inst: C = C() func = _inst.method
995,958
c69b2527759f2e4830344d2f146c0e60f006eacc
"""Public URL configuration.""" from django.conf.urls import patterns, include, url from .views import HomeTemplateView, AboutTemplateView urlpatterns = patterns('', url(r'^$', HomeTemplateView.as_view(), name='home'), url(r'^about$', AboutTemplateView.as_view(), name='about'), # authentication url(...
995,959
b587da1b8d79b124b660cabcf6bc9eded0bbe946
import pytest from sqlalchemy import create_engine from sqlalchemy.engine.url import URL TEST_DB_NAME = 'PALJE_TEST' def pytest_addoption(parser): parser.addoption( '--mssql_host', action='store', dest='mssql_host', help='SQL Server hostname used for tests.' ) parser.addop...
995,960
8a1b026260fe6ecf36e55fff9d36eeae09db0cca
# Dataset Story # Online Retail II # The data set named is the data set of a UK-based online store. # Includes sales between 01/12/2009 and 09/12/2011. # The product catalog of this company includes souvenirs. They can also be considered as promotional items. # There is also information that most of its customers ...
995,961
960f8095714ec651cb51c641bee107c58017d142
#!/usr/bin/env python from diagnostic_msgs.msg import DiagnosticArray, DiagnosticStatus, KeyValue from math import sqrt import rospy from sensor_msgs.msg import TimeReference import socket CLOCK_REALTIME = 0 class Node: def __init__(self, **kwargs): self.system_name = socket.gethostname() rospy.i...
995,962
f7ee2c667f9f949af7cf9f301d3fe8e1585bad59
class APIMixin(object): pass
995,963
0b17ceecb9517c0a37a6916864fd2763a8829a41
#!/usr/bin/python # Copyright (c) 2009 Las Cumbres Observatory (www.lcogt.net) # # 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 without limitation the rights #...
995,964
6d1e9cc085db3a4eba0976b4671c25a3230d45f7
import cv2 import sys # src = cv2.imread(sys.argv[1]) # dst_gray, dst_color = cv2.pencilSketch(src, sigma_s=60, sigma_r=0.07, shade_factor=0.05) # cv2.imwrite('./testout/pencil_1.jpg',dst_gray) for i in range(0,int(sys.argv[3])): src = cv2.imread(sys.argv[1]+'/frame'+str(i)+'.jpg') dst_gray, dst_color = cv2.pe...
995,965
4979724f8d01107fa49f14ebf1d38b72be77f902
__author__ = 'sam.royston' from mta.turnstile_synch import UpdateManager from transport import transit update_manager = UpdateManager(start_yr=15) update_manager.clean_empties() update_manager.synch_turnstiles() update_manager.synch_locations() update_manager.synch_gtfs() transit.run_opts()
995,966
ed1a700cad9f033bfeb2676ccaef25f793f4d9c5
""" 给定两个单词 word1 和 word2,计算出将 word1 转换成 word2 所使用的最少操作数 。 你可以对一个单词进行如下三种操作: 插入一个字符 删除一个字符 替换一个字符 示例 1: 输入: word1 = "horse", word2 = "ros" 输出: 3 解释: horse -> rorse (将 'h' 替换为 'r') rorse -> rose (删除 'r') rose -> ros (删除 'e') 示例 2: 输入: word1 = "intention", word2 = "execution" 输出: 5 解释: intention -> inention (删除 't')...
995,967
24e7fc74cea021217a593cf9cbac34a33d7dc68e
#!/usr/bin python3 # -*- coding: utf-8 -*- import json def get_fans_url(user_id, page_num): url = 'http://www.tianya.cn/api/tw?method=follower.ice.select&params.userId=' \ + user_id + '&params.pageNo=' + str(page_num) + '&params.pageSize=28' return url def get_friends_url(user_id, page_num): ...
995,968
b1f487fd8a1b904e1c5d8fc054b3d74bd093127c
from manimlib.imports import * #### SUGERENCIA: SIEMPRE QUE CAMBIESLOS VECTORES A VISUALIZAR ### ### CONDISERA QUE EL PLNO ES DE [-7,7]x[-4,4] #### #### Propiedades de la definición de un espacio vectorial #### class Grid(VGroup): CONFIG = { "height": 6.0, "width": 6.0, } def __init__(s...
995,969
ffc5e1b4f15f3e6ce62701ec7558e80d6087b73c
# Generated by Django 2.1.7 on 2019-03-26 13:01 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('core', '0003_auto_20190326_1223'), ] operations = [ migrations.RemoveField( model_name='new', name='brief_description', ...
995,970
0906f4aa56a75a4aa1f603f03bc45c66314846bf
from dsutil import NbExecuter from dsutil.common import *
995,971
b0bf92fabd6bbc56fbf7fc66114558aac1b9e3bf
from app import * ven1 = Venue(name = 'The Musical Hop', genres = ["Jazz", "Reggae", "Swing", "Classical", "Folk"], address = '1015 Folsom Street', city = 'San Francisco', state = 'CA', phone = '123-123-1234', website = 'https://www.themusic...
995,972
830407e09552cfb2cb0473e85960160bfe3aa607
import os import json import datetime as dt from django import forms from django.db import models from django.core import exceptions from django.utils.translation import ugettext_lazy as _ from .mediaPIL import MediaPIL from .widgets import ImagePILWidget class ImagePILField(models.TextField): description = "Ima...
995,973
5cc4f6d32dcc17a5198c712bd446651e8b4b547f
# coding=utf-8 import os, sys import time import qrcode # generate the qrcode and save it definition usage = """ Usage: python qrCodeGen.py <output file name> <data to put in the qrcode> """ def gen_qrcode(dataList, path): # generate the qrcode qr = qrcode.QRCode(5, error_correction=qrcode.constants.ERR...
995,974
f831c7dae183042d0619a63210f7a1916dd06a50
from typing import Any, Awaitable, Callable, Iterable, List, NoReturn, Optional, TypeVar from expression.collections import seq from expression.core import ( MailboxProcessor, Option, TailCall, TailCallResult, aiotools, compose, match, pipe, tailrec_async, ) from expression.system.d...
995,975
9d4da43063aa287ff2f935ea4d6083419c57bac4
from sklearn.neighbors import LocalOutlierFactor from pyod.models.iforest import IForest from pyod.models.hbos import HBOS from pyod.models.loda import LODA from pyod.models.copod import COPOD from tqdm import tqdm import numpy as np import pandas as pd import os import ast import eval.evaluation_utils as utils from sk...
995,976
6adb5729a13d8d47b3bc043fc17cd7f6c446034b
#!/usr/bin/env python ###Startup and commandline file from services import service, simple_network, Topology_Service, map_reduce, cfs ##import all current services import node import hash_util #import utility functions #python2.7 builtins import random import time import Queue import os import threading import sys...
995,977
23219ca71e6e79a65c478fc63117c93f8c765c4a
# Copyright (c) 2021-2023, NVIDIA CORPORATION. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
995,978
a09598fb7c6b14cdde79c00c5234c90387efd98e
# /usr/bin/env python3.8 # -*- mode: python -*- # ============================================================================= # @@-COPYRIGHT-START-@@ # # Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification,...
995,979
d24df7d81dd72023f4a20a3d99788dd3af698021
from sys import stdin, argv import matplotlib.pyplot as plt import json """Show matplotlib plot for single metric (e.g. avg_return). Used by visualize_metric script. """ x = [] y = [] for line in stdin: datapoint = json.loads(line) x.append(datapoint["step"]) y.append(datapoint["value"]) plt.plot(x, y, "...
995,980
88f3d280fae93bde375ed3dfa3cfe9abb36ddd92
/Users/Roge/anaconda/lib/python3.5/random.py
995,981
bc98941850572696e593a78c15b9a3cc6b27e4ef
print(f"I am apple module with __name__ of {__name__}. I run once when loaded") print(f"I am apple module and am about to import banana") import banana print(f"I am apple module and I imported {banana.module_name}") if __name__ == "__main__": print( f"I am apple module with __name__ of {__name__} and on...
995,982
d52b57cb3046466d4772d358427bdb2fe452cbc4
#encoding=utf-8 __author__ = 'reason' from lib.bottle import template,Bottle,request,view from lib.cachewrap import cache from dbsetting import dbsetting as db import sys,hashlib from setting import SITE_DOMAIN reload(sys) sys.setdefaultencoding('utf-8') app = Bottle() @app.route('/getnotice') @view...
995,983
e2b1e1233bf94cbc34e233f4df781c86d3e0de16
#TODO: utilize multiple stream processors for high throughput. # Stream Management # Streams allow concurrency of execution on a single device within a given context. Queued work items in the same stream execute sequentially, but work items in different streams may execute concurrently. Most operations involving a CUDA...
995,984
93c5fe74c6eb555a21c04c280e943cf7f6f9fe49
''' --------------------------------------------------------------------------- Tool: RepairDetailedBrokenLinks (4) Script: 4_DataSourceRepairX.py Toolbox: CheckAndFixLinks.tbx Purpose: Fix "broken source links" from input .csv NOTE: run from the machine and user that will use the mxd --------------------------...
995,985
4e2e9539db03c7ea073f7aee416dddae77644b00
import os from typing import List from setuptools import setup with open("README.md") as f: readme = f.read() def find_stub_files(name: str) -> List[str]: """ It seems setuptools does not support recursive patterns. This function is stolen from django-stubs project :) """ result = [] fo...
995,986
1136b5b5a560926b3014d730f17e0b4280edf58d
#!/usr/bin/env python3 import asyncio from aioconsole import ainput from mavsdk import System from mavsdk.camera import (CameraError, Mode, Option, Setting) usage_str = """ Usage: p print current (changeable) camera settings m change camera mode s change a setting """ camera_mode = Mode.UNKNOWN cur...
995,987
3ffea30ef642df77cbbf8be4e2f234919f1152e7
import cv2 import numpy as np img = cv2.imread('lena.jpg') lr1 = cv2.pyrDown(img) lr2 = cv2.pyrDown(lr1) lr3 = cv2.pyrDown(lr2) hr1 = cv2.pyrUp(img) hr2 = cv2.pyrUp(hr1) hr3 = cv2.pyrUp(hr2) cv2.imshow('image', img) cv2.imshow('LR1', lr1) cv2.imshow('LR2', lr2) cv2.imshow('LR3', lr3) cv2.imshow('UR...
995,988
f8638e5166843999b95f4beca7988ae3b8e4f180
import datetime ano = int(input('\033[1;34mDigite O \033[m\033[1mAno\033[m\033[1;34m em Que Você Nasceu:\033[m ')) opc = str(input('\033[1;34mVocê Já Se Alistou:\033[m[S/N]')).lower() idade = int(datetime.date.today().year) - ano if idade == 18 and opc == 'n': print('\n\033[1;34mVocê Deve Se Alistar Este Ano')...
995,989
19e56b5c7ff17111e34e3a807f5d566af0b2078a
from turtle import * def iso_trape(pen, f_color, dofill): pencolor(pen) fillcolor(f_color) if dofill: begin_fill() left(60) forward(159) right(60) forward(115) right(60) forward(159) right(120) forward(255) if dofill: end_fill() def inverse_iso_trape(pen,...
995,990
af0c6d1d6e8164d2c2cc531d42e3fe597dd33b83
from pangtreebuild.mafgraph.sorter import sort_mafblocks from pangtreebuild.pangenome import DAGMaf from pangtreebuild.pangenome.parameters import msa from pangtreebuild.tools import logprocess global_logger = logprocess.get_global_logger() def get_dagmaf(maf: msa.Maf) -> DAGMaf.DAGMaf: """Converts MAF to DagMaf...
995,991
dc79705a3fd7ce0e4c808bb03d68674d2e4e09c3
from django.urls import path from register import views app_name="register" urlpatterns = [ path("", views.register_form, name="form"), path("user", views.register_user, name="user") ]
995,992
9f5235b7d50f535becd029b98be832b5b04fa404
''' 比较两个文件夹里的文件,如果有不同的文件,拷贝出来到第三个文件夹 ''' import sys, os,shutil from os.path import walk,join,normpath PathA = 'D:\\BaiduYunDownload\\中谷教育Python\\' PathB = 'D:\\BaiduYunDownload\\Python\\中谷\\中谷教育Python\\' PathC= 'D:\\中谷Goal\\' def visit(arg,dirname,names): print dirname dir = dirname.replace(PathA,"") dir...
995,993
1076587e0d584238a1840884259cc335b7815a45
#27. 利用递归函数调用方式,将所输入的5个字符,以相反顺序打印出来。 def output(s,l): if l==0: return print (s[l-1]) output(s,l-1) s = input('Input a string:') l = len(s) output(s,l)
995,994
b8170c6b3f7c815288716ff1773c5051ca7e93e8
import pandas as pd import pydot from IPython.display import Image from sklearn.ensemble import ExtraTreesClassifier from sklearn.externals.six import StringIO from sklearn.tree import export_graphviz from copy import deepcopy ## classification importance with and ExtraTreesClassifier def classification_feature...
995,995
f097eaf4b49262650c0dce9de5640602413bb00f
import os import pyximport import numpy as np import pandas as pd from array import array klib_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'klib')) paq9a_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'paq9a')) pyximport.install(setup_args={'include_dirs': [np.get_include(), klib_dir, ...
995,996
c92c375c597a33a85ca96d103ab3c88b84692909
""" TODO Validation scripts that check that the genotype of each mouse meshes with the parents Auto-determine needed action for each litter (and breeding cage?) Auto-id litters Slug the mouse name from the litter name and toe num? """ from __future__ import unicode_literals from django.db import models import dateti...
995,997
636615b33b4c6d1d7538377771ad69811644a21e
# Copyright 2019 The TensorFlow Authors. 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 applica...
995,998
b261a045fc319da9c96d1553de81a809a84f39d3
import os import sqlite3 from sqlite3.dbapi2 import Connection from telegram_manager import TelegramManager from config import (name_db, value_limit, folder_config, entrance_bot_usage, name_loc_default, name_join_default...
995,999
b7d2203979cdac83b003060f38e9b6b6755a9ad1
import pandas as pd import quandl import numpy as np import math import datetime from sklearn import preprocessing, cross_validation, svm from sklearn.linear_model import LinearRegression import matplotlib.pyplot as plt from matplotlib import style import pickle style.use('ggplot') df = quandl.get('WIKI/GOOGL') ...