index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
996,400
30105423a5646175f94f5a48e52fb7c2549d0c67
from django.apps import AppConfig class ForignrelationshipConfig(AppConfig): name = 'ForignRelationShip'
996,401
bf0f0e1a7a9e8bfa71ceee0956621e3a3e615d1d
from glob import glob import cv2 def get_imgs(path): """ - returns a dictionary of all files having key => value as objectname => image path - returns total number of files. """ imlist = {} for each in glob(path + "*"): word = each.split("/")[-1] imlist[word] = [] ...
996,402
40421d8fc79cfb13bbb8fcdaec1fa230ba3efd63
# String a = "Python Programming" # # Slice Constructor # sub = slice(0, 6, 2) # # Using indexing sequence # print(a[-5 : -2 : 2]) l = [10, 20 , 30 , 40, 50] # sub = slice(-3, -1, 2) # # Using indexing sequence # print(l[-3]) t = (10, 20, 30, 40, 50) # Slice Constructor sub = slice(-4, -1) # Using indexing s...
996,403
4186c7f45f59f354a34cf1462c0c61d6512c6a39
from django.urls import reverse from django.contrib.auth import get_user_model from rest_framework import status from rest_framework.test import APITestCase from orders.models import Order, Customer, Device, DeviceType, Manufacturer User = get_user_model() class OrdersList(APITestCase): def setUp(self): ...
996,404
9a4412f438398c959e78429d432c060692c47eac
#=======INPUT Parameter===================================================================================== #---n1=ref index Core, n2=ref index cladding kiri, n3=ref index cladding kanan--------------------------- from scipy import* n1=1.55e0 n2=1.545e0 n3=1.545e0 wle=1.55e-6 nmoda=4 rentang=4000 lim=(n1)-0.0...
996,405
987c1309ff4f33d0bce6d4210a4a38cc521d4bce
/home/gurpreet/anaconda3/lib/python3.6/re.py
996,406
0ede0ad1c7dd99be3ec569a16e45bba4510495a5
from flask.ext.script import Manager from clapperboard import app manager = Manager(app)
996,407
a4597a73fac258c42d3a5a9a3c5e102d32182401
print "import numpy" import numpy as np #from numpy.lib.recfunctions import stack_arrays #from root_numpy import root2array, root2rec #import glob print "import keras stuff" from keras.layers import Dense, Input, Activation from keras.models import Model from keras.utils import plot_model from keras.callbacks import Mo...
996,408
f5992ee510b8088d0662303e0b1cbe07298f2c91
# encoding: utf8 from rest_framework import serializers from rest_framework.serializers import ValidationError from .models import Employee, Daily def md5(string): import hashlib m = hashlib.md5() m.update(string) return m.hexdigest() class LoginSerializer(serializers.HyperlinkedModelSerializer): ...
996,409
2e649c7d588da3a35dbcad6ae0d53c8d6235fed7
# -*- coding: utf-8 -*- #__author__ = 'basearch' import os import sys import xlrd import pyutil.common.sys_utf8 as sys_utf8 import pyconf.db.manna as manna import pyutil.db.mellow as mellow eng_name_map = { "enum_company_online_status" : "eng_status", "enum_device_online_status" : "eng_status", "enum_user...
996,410
6ed65d10eb348dcd9a3f7c18081da6ca0cf22da7
# coding=utf-8 import yaml def yaml_parser(file): with open(file, 'r') as stream: try: print(yaml.load(stream)) except yaml.YAMLError as ye: print(ye) if __name__ == '__main__': yaml_parser('./test.yml')
996,411
feb4d51a34966e168dc060d7d717f9e9e11e8e36
#!/usr/bin/python done = False sum = 0 print("Please enter a number (999 to Quit)") while not done: value = eval(input()) if value < 0: print("Value Entered", value, "is a Negative Number") continue if value != 999: print("The Value goes on here: ") sum += value else: done = (value == 999); print("Sum i...
996,412
b6f326810dd2975896befbd1cf3b7ac63082d94f
import sys import operator import load_data import random import itertools import structures import numpy as np import matplotlib.pyplot as plt import pickle from sklearn.linear_model import LogisticRegression from sklearn.externals import joblib from sklearn.model_selection import train_test_split from sklearn.mo...
996,413
db977a8f128c741f29d22cb8663a91a2efddac49
#!/usr/bin/env python import feedparser from cgi import FieldStorage, escape from time import ctime ENTRY_TEMPLATE = ''' <a href="%(link)s" onmouseover="$('#%(eid)s').show();" onmouseout="$('#%(eid)s').hide();" target="_new" > %(title)s </a> <br /> <div class="summary" id="%(eid)s"> %(summary)s </div> ''' def mai...
996,414
5e4dd44923100278cae8e3580495706a1dba69e3
name = raw_input("Enter file:") if len(name) < 1 : name = "mbox-short.txt" handle = open(name) dic = dict() for x in handle: if x .startswith("From") and len (x.split()) > 2: list = x.split() if not dic.has.key(1[5][:2]) dic[1[5][:2]]=1 else: dic[1[5][:2]]+=1 key = sorted(dic) f...
996,415
584d8cd860dc3f50227af8989ff11418374d53c9
from nabl.nabladmin.models import * from django.contrib import admin admin.site.register(Members, MembersAdmin) admin.site.register(Teams, TeamsAdmin) admin.site.register(Leagues, LeaguesAdmin) admin.site.register(Divisions, DivisionsAdmin) admin.site.register(Transactions, TransactionsAdmin) admin.site.register(Playe...
996,416
3e26ad73eea8e54bef2ca074a48a439f2251b9f9
for i in range (0,15 , 2): print(i) if i == 6: break i = 0 while True: print(i) i = i + 1 if i == 5: break
996,417
633bc6122d515ebb82e96799fab0813a4fed953e
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Feb 9 13:58:55 2022 @author: jtm545 """ import pandas as pd from pysilsub.devices import StimulationDevice from pysilsub.observers import _Observer # Choose device # sd = StimulationDevice.from_json("../data/STLAB_1_York.json") # sd = StimulationDevi...
996,418
68b12cb7a9ba6316e07e70d3487aaca5e4c1c612
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2018-04-25 18:14:59 # @Author : guangqiang_xu (981886190@qq.com) # @Version : $Id$ import requests from hashlib import sha1 # import http.cookiejar as cookielib import time import hmac import json import re from lxml import etree from retrying import retry i...
996,419
ed4eb0bcfc0bae64639a6bec0c52ce12cadc8aa9
class WordDictionary: def __init__(self): """ Initialize your data structure here. """ self.kids = dict() self.val = None self.isWord = False def addWord(self, word): """ Adds a word into the data structure. :type word: str :rtype...
996,420
4c505a5340f5d5fd6e7089be972eb84d4effb948
from random import randint from time import sleep # # Made by Filiph Wallsten 2019-09-19 # i = 0 k = 0 total_wins = 0 dice_numbers = { 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, } running = True rounds = int(input('How many games do you want to play? (20 is max) ')) while running: dice_r...
996,421
ef06fd154cbb230502b3789f6120c537d30fb773
import setuptools long_description = "Functions to estimate the expected best-out-of-n (Boon) result from a set of validation and " \ "test results for a machine learning architecture. The measure is fully described in the paper" \ "Bajgar, O., Kadlec, R., and Kleindienst, J. A Bo...
996,422
60e89c916d6a09eaca23c3d36cce0213c0833019
from django.urls import path # from apps.users.api.api import UserAPIView # Aqui se esta importando la clase que sirve como ruta para el JSON from apps.users.api.api import user_api_view # Metodo con decorador para el JSON from apps.users.api.api import user_detail_view # Metodo para realizar la actualizacion """ E...
996,423
77ad1af86a304a68460ba6dbc8ce457e0eebc952
""" Created on 25 Aug, 2021 @author : Sai Vikhyath """ """ This code must be refactored Refactored code in PythonRefactoredCode.py """ import time def main(): print(' ______') print(' / \\') print('/ \\') print('\ /') print(' \_______/') print() print('\ /') print(' \______/') ...
996,424
f604f04ca839e2575f48ccbe58bf5409bc1e6e99
# -*- coding: utf-8 -*- # @Author: xiweibo # @Date: 2018-08-29 14:25:37 # @Last Modified by: Clarence # @Last Modified time: 2018-08-29 23:53:10 """ python2 实现xml解析 python3实现模块相同,与示例代码相同(除了print) Python使用SAX解析xml SAX是一种基于事件驱动的API 利用SAX解析XML文档牵涉到两部分:解析器和事件处理器 解析器负责读取XML文档,并向事件处理器发送事件,如元素开始跟元素结束事件 而事件处理器则负责对事件作出响应,对...
996,425
99b878e579a053c917e75baebf9d0cc854d6b077
from django import forms from .models import Snap,Profile from django.db import models from django.contrib.auth.models import User class PostForm(forms.ModelForm): class Meta: model = Snap exclude = ['editor', 'pub_date'] widgets = { 'tags': forms.CheckboxSelectMultiple(), ...
996,426
bb0f37b1ab12ad03f0366b8d9b3fe687690b8786
''' Created on Thu Jan 30 2020 @author: https://blog.floydhub.com/gentle-introduction-to-text-summarization-in-machine-learning/ ''' # importing libraries from nltk.tokenize import sent_tokenize from src.text_processing.preprocess_word import stem, lower, stop from src.text_processing.preprocess_phrase import tokeniz...
996,427
9905baba0a25251b774bef786a8268764a837673
from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains from time import sleep driver=webdriver.Chrome (executable_path="C:\\Users\\Sanket\\Desktop\\sele_python\\webdriver\\chromedriver.exe") driver.get("https://jqueryui.com/") driver.maximize_window() sortable_link=driver.find_e...
996,428
be9f3d503ec86b21a5a6d5b535871338969410c1
""" https://leetcode.com/problems/contains-duplicate Related: - lt_219_contains-duplicate-ii - lt_220_contains-duplicate-iii """ """ Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false ...
996,429
73a23c024b4e1057b383d09a40d4de9730547b26
# # Copyright (c) 2017 Sebastian Muniz # # This code is part of point source decompiler # import abc from traceback import format_exc from output_media.output_media_base import OutputMediaBase, \ OutputMediaBaseException try: import idaapi except ImportError, err: raise OutputMediaBaseException("TextOut...
996,430
67d945eb5ec50584393a8926eba8276ed5d29a68
#!/usr/bin/env python # -*- coding: utf-8 -*- import pytest from datetime import datetime from datetime import timedelta from trader.collector import GCollector @pytest.fixture def collector(): return GCollector() def test_get_error_historical_quote(collector): c = collector hist_data = c.get_histrical...
996,431
0195b59c69466274c33ac795864b3ddf7c141617
import random import sys size = int(sys.argv[1]) arr = [] f = open("./in.txt",'w') items = 0 for i in range(size): operation = random.randint(1,3) if operation == 1: #insert data = random.randint(1,20) loc = random.randint(0,items+5) items += 1 if operation == 2: da...
996,432
46b7dcd7d71af55be676097874345e77a32ca712
### LAB 9 GROUP WORK ### PROBLEM 2 class Robot(object): """this is a blueprint for a program that models virtual fighting robots""" robot_list = [] @staticmethod def contenders(): if len(Robot.robot_list) == 0: print("There are 0 robots.") else: print("T...
996,433
ed5bafa16aad4eba449ce2436fbb6b4ad490efa7
from .HistoryBuffer import HistoryBuffer from .OperationEngineException import OperationEngineException from .factory import factory from .Operation import Operation class Queue(HistoryBuffer): """docstring for Queue""" def __init__(self, log): HistoryBuffer.__init__(self) self.log = log ...
996,434
f4c664eaa2a7846c63d2f15d3b879ca1e82adbda
# a ideia é cirar um cronometro, q ao apertar no butao a contagem se inicia, e no outro finaliza. e depois ir deixando mais complexo. # descobrir o pq o visual nao esta lendo a biblioteca; import pygame import tkinter pygame.init() janela = pygame.display.set_mode((800,400))# assim eu crio uma janela e começo a...
996,435
6a1ec8455545820bdd74d4205c7658b0787ada9b
from dlrobot.common.remote_call import TRemoteDlrobotCallList from dlrobot.common.dl_robot_round import TDeclarationRounds from source_doc_http.source_doc_client import TSourceDocClient from common.logging_wrapper import setup_logging import argparse import plotly.express as px import pandas as pd import datetime impo...
996,436
c7cdeb7933626b7a7a8cf0e41f0d0b070682f56b
''' Laboratorium 6 (kalkulator po telnet) Na podstawie kalkulatora RPN opracuj serwer dostępny dla jednego użytkownika zapewniający dostęp przez protokół telnet na wybranym porcie. ''' import socket HEADERSIZE = 10 HOST = '127.0.0.1' PORT = 9990 ENTER = b'\r\n' SPACE = b' ' BACKSPACE = b'\x08' import operator ops = ...
996,437
451c377dad2a27a8a3c3b7641760f951067c092a
n = int(input()) for i in range(n): linha = input() for j in range(len(linha)): c = "" if (linha[j] >= "A" and linha[j]<="Z"): linha[j] =
996,438
8c10526cf7d0303cdc78ab21b366668a66fee1f8
""" Created by Danny on 2018/12/11 """ from app.models.base import db, Base from app.libs.helper import get_current_date __author__ = 'Danny' class MemberCart(Base): __tablename__ = 'member_cart' id = db.Column(db.Integer, primary_key=True) member_id = db.Column(db.BigInteger, nullable=False, index=True...
996,439
6fdaebb0c00244241d8026fff729ce6cf606e61e
from queue import Queue from threading import Thread q_result = Queue() str_list=['222','444','333','666','888'] def str_to_int(arg, queue): result = int(arg) queue.put({arg: result}) def main(): thread_list=[] for s in str_list: t=Thread(target=str_to_int,args=(s,q_result)) t.start()...
996,440
2b77419539b4dbd3c410df1ada1be72e9baa0701
class EstadoRepartidor: INACTIVO = 'INACTIVO' ACTIVO = 'ACTIVO' OCUPADO = 'OCUPADO'
996,441
7b1630f4ac189657919cc7e8d3648dc56b672baa
# coding: utf-8 from django.http import HttpResponse from django.template.loader import get_template from django.utils.six.moves.urllib.parse import parse_qsl, urlparse, urlunparse from django.utils.cache import patch_cache_control from django.views.decorators.csrf import csrf_exempt import urllib.request, time, base...
996,442
20e633ef8b8f7fbb8854d0cadeb6fa4ec1357526
import franka_interface import rospy import itertools import pickle import pyrealsense2 as rs import numpy as np import cv2 from cv2 import aruco import os from std_msgs.msg import String import tf2_ros import geometry_msgs.msg from tf2_geometry_msgs import PoseStamped import pb_robot import numpy from rotation_util im...
996,443
61d5b0bda1cf4ad71b2fce4566fa2dd75c04d03b
ba1107.pngMap = [ '11111111111111111111111111111111111111111111111111111100111111111100111111111111111111111111111111111111111111111111111111111111', '11111111111111111111111111111111111111111111111111111100111111111100111111111111111111111111111111111111111111111111111111111111', '1111111111111111111111111111111111111...
996,444
76456f04d141f1e18b50d948d872ffec3cb10683
#coding:utf-8 import sys import festival print("talking") festival.execCommand("(voice_el_diphone)") string = unicode("Hola mundo, esta es una prueba del criticon, con una canción", "ascii") festival.sayText(string)
996,445
91d64f1150ec00e308b809209ccb7ff465787131
# -*- coding: utf-8 -*- import scrapy from scraper.items import AllNewsItem from all_news.models import Category, News class JaijaidinSpider(scrapy.Spider): category = '' name = 'jaijaidin' allowed_domains = ['jaijaidinbd.com'] start_urls = [ 'http://www.jaijaidinbd.com/todays-paper/sport...
996,446
d74f2b88ba0b2df5456d075426790feff9c7930c
import hashlib import json from app.main import db from app.main.location.models import Location class JsonModel(object): def as_dict(self): return {c.name: getattr(self, c.name) for c in self.__table__.columns} class Person(db.Model, JsonModel): """ Person Model for storing user related details """ ...
996,447
ef7d04c24040e6aaed950f80fd6358dc91e0bfca
#!/usr/bin/env python # coding: utf-8 # In[23]: help("reduce") # In[ ]: """ 1.1 Write a Python Program to implement your own myreduce() function which works exactly like Python's built-in function reduce() """ # In[106]: def My_reduce(func,b): a=b[0] # store first index value from list i...
996,448
9b2e4530df1993457c33b8df202580e1526846b2
''' Created on 9.4.2012 @author: xaralis ''' from django import template from django.conf import settings from django.templatetags.static import static from versioned_static.conf import ASSETS, USE_MINIFIED, USE_VERSIONING register = template.Library() @register.inclusion_tag('versioned_static/render_asset.html') ...
996,449
e0d353c64381eee404eb4d86264ab55142b6f26c
from timeit import Timer def test1(): dict1 = {"a":1, "b":2} dict2 = dict1.copy() def test2(): dict1 = {"a":1, "b":2} a = dict1.get('a') def test3(): dict1 = {"a":1, "b":2} dict1['a'] = 3 def test4(): dict1 = {"a":1, "b":2} del di...
996,450
ffceb0accb6f828a84f30ccf8cf801b1f92832fd
#!/usr/bin/env python import sys, os, time from optparse import OptionParser from contextlib import closing from seqtools import solid, fastq from seqtools.io import xopen # Process the DGE data. # This duplicates functionality in clean-dge-fastq, but uses lots less # memory # # This funciontality requires that the...
996,451
0adc52856d0f86f30610d5dc31112752efe02e54
#! /usr/bin/env python # ## Begin copyright ## ## /home/jrf/Documents/books/Books20/Tools/python/aabooks/lib/isbn.py ## ## Part of the Books20 Project ## ## Copyright 2021 James R. Fowler ## ## All rights reserved. No part of this publication may be ## reproduced, stored in a retrival system, or transmitted ##...
996,452
2ec8713c105612ba4b628282997c54babb667578
#Morgan Baughman #12/6/17 #fileDemo.py - how to read a file dictionary = open('engmix.txt') longest = 0 word = '' for words in dictionary: length = len(word) if length > longest: lenght = longest words = word print('The longest word is', word)
996,453
98537429586c2a9e294d03d734b71072f05be235
from onegov.api.models import ApiEndpoint from onegov.api.models import ApiEndpointCollection from onegov.api.models import ApiEndpointItem from onegov.api.models import ApiException, ApiInvalidParamException from onegov.core.utils import Bunch def test_api_exceptions(): exception = ApiException() assert exce...
996,454
1fe1b0d754768e407a92a7acd1832aa2863b1c30
#!/usr/bin/env python # coding: utf-8 ''' This is a simple arithmetic expression interpreter very much inspired by Peter Norvig's lis.py [1]. It implements the arithmetic expression subset of the language described in Chapter 1 of Samuel Kamin's book Programming Languages book [2]. [1] http://norvig.com/lispy.html [2...
996,455
8f92f40e89419ebb9c3de5c1cdd492d06ffd08d4
import databases import sqlalchemy from fastapi_users.db import OrmarBaseUserModel, OrmarUserDatabase from User.schemas import UserDB DATABASE_URL = "sqlite:///sqlite2.db" metadata = sqlalchemy.MetaData() database = databases.Database(DATABASE_URL) class UserModel(OrmarBaseUserModel): class Meta: tablen...
996,456
9a1319df4aee90eb1676d95a514c796aaa0d05eb
import json import urllib2 from collections import namedtuple def _json_object_hook(d): return namedtuple('X', d.keys())(*d.values()) def json2obj(data): return json.loads(data, object_hook=_json_object_hook) def getJsonResponse(substr, page): contents = urllib2.urlopen("https://jsonmock.hackerrank.com/api/movies...
996,457
f635d055c4febe42a130fc485493369a3a24a773
/home/mohammed/anaconda3/lib/python3.7/rlcompleter.py
996,458
2f4f16d577e41d4c9823496f5e8c6ef73224f26c
import logging, numpy, openravepy, time, math from openravepy.databases import inversereachability from openravepy import IkFilterOptions #from openravepy.databases import inversereachability class GraspPlanner(object): def __init__(self, robot, base_planner, arm_planner): self.robot = robot self...
996,459
3100b8d145292509c26dca3093853b3442ff815d
# -*- coding: utf-8 -*- """ Created on Wed Apr 18 13:30:03 2018 @author: hsseo """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from batch import * from Network_D import * # pylint: disable=missing-docstring import argparse import os.path import os i...
996,460
35c413fabce495d1e4e2450c6a3805895dadd4eb
from flask import render_template, request from ui import webapp @webapp.route("/login") def login_register(): return render_template("login.html") @webapp.route('/login', methods=['POST']) def login_attempt(): username = request.form.get("username") password = request.form.get("password") # TODO ...
996,461
9b4eb876e4dbb27afc3fa40393fc227f77d1f5bb
# -*- coding: utf-8 -*- from __future__ import unicode_literals, print_function, division import unicodedata from nltk import word_tokenize import sys, re import pandas as pd import numpy as np import json import argparse import json import torch ''' Change of this file. 1. simplify the preprocessing process 2. genera...
996,462
fb981aea379bca73f7dcf5f23ff75c964f8e49c0
#!/usr/bin/env python # coding=utf-8 import pytesseract from PIL import Image image=Image.open('./image.jpg') vcode =pytesseract.image_to_string(image) print (vcode)
996,463
d0d65d2717f6ffeee17c6588f461b2fcf6798823
MAX = 10006 _data = [0] * MAX pos = 0 def push(val): global pos if pos >= MAX: return _data[pos] = val pos += 1 def pop(): global pos if pos <= 0: return -1 pos -= 1 val = _data[pos] return val def size(): return pos def top(): if pos <= 0: ...
996,464
e32d7d60bdc5328090431478a62b73211aed4d00
import os from PIL import Image, ImageDraw, ImageFont WATERMARK_POSITION = ( "top left", "top right", "center", "bottom left", "bottom right", ) class CustomImage: """The CustomImage class implements the image watermark operation. Attributes: **image** *(Image)*: The image obje...
996,465
6becc2073be8b0e8b40080f1d21d12a3159583a8
import os import numpy as np import pickle import matplotlib.pyplot as plt import matplotlib def zero_pad(a, length): z = np.zeros(length) offset = len(z)//2 - len(a)//2 if offset < 0: offset = 0 z[offset:offset+len(a)] = a return z def cached(cachefile): """ A function that ...
996,466
b35564543de5a9afcb9b650a03bb42d0e97a2cd1
# -*- coding: utf-8 -*- # Copyright 2023 Cohesity Inc. class ProtectedObjectsByEnv(object): """Implementation of the 'ProtectedObjectsByEnv' model. Number of Protected Objects by Type. Attributes: env_type (string): Environment Type. protected_count (int): Number of Protected Objects. ...
996,467
074441104bddc0bfd06538fc0ea004af9ddba05d
from matplotlib import cm, rcParams import matplotlib.pyplot as plt from matplotlib.ticker import FormatStrFormatter import numpy as np import math as math import random as rand import os import csv rcParams.update({'figure.autolayout': True}) # Button palette c = ['#aa3863', '#d97020', '#ef9f07', '#449775', '#3b7d86...
996,468
c6c7b4e5ffc7955ad1ceb77f6c6e9be268af66b9
import logging import pytest from kale.evaluate.uncertainty_metrics import evaluate_bounds, evaluate_jaccard from kale.prepdata.tabular_transform import generate_struct_for_qbin # from kale.utils.download import download_file_by_url from kale.utils.seed import set_seed # import os LOGGER = logging.getLogger(__name_...
996,469
ca08a5357cd71b0a045c3abcce418950c921aa62
# Functions for co-reference resolution # Called by create_narrative_turtle.py import uuid import re from typing import Union import word2number as w2n from dna.create_noun_turtle import create_noun_ttl from dna.database import query_database from dna.get_ontology_mapping import get_agent_or_loc_class, get_noun_mappi...
996,470
b78520ac7a60efc06f5b38a47f7449df544b109e
import os Import('env lib') # boost libraries may be named differently BOOST_LIBS = ['boost_system','boost_date_time','boost_program_options','boost_filesystem'] if hasattr(os,'uname') and os.uname()[0] == 'Darwin': BOOST_LIBS = [x + "-mt" for x in BOOST_LIBS] # clone environment and add libraries for modules men...
996,471
c02da3824e59a4e3b6590e0150e83cade351b2d8
''' desispec.image ============== Lightweight wrapper class for preprocessed image data. ''' import copy import numpy as np from desispec.maskbits import ccdmask from desispec import util class Image(object): def __init__(self, pix, ivar, mask=None, readnoise=0.0, camera='unknown', meta=None): """...
996,472
d8e412371adb810ddc618ecefac431303ea629a4
# -*- coding: utf-8 -*- """ Created on Mon Apr 27 21:35:05 2020 @author: VICTOR """ import numpy as np from numpy import * import matplotlib.pyplot as plt from scipy import stats import pandas as pd from pandas import DataFrame, Series import seaborn as sns; sns.set() from numpy import random df = random.rand(1000)...
996,473
063f977797be18455cb3cebeb060eeea8182ba74
from __future__ import absolute_import from celery import Celery from converter.corelib import YoutubeConverter,DownloadAudioInfoDTO from converter.coreconfig import CONFIG from celery import shared_task # TODO : nofify that youtube conversion is success or fail to client @shared_task def convert_youtube_video(vid...
996,474
8502ea2c4c640f1455ee1edd6be4acb3b5bb222c
#! /usr/bin/env python import pymesh, argparse import numpy as np import fix_mesh as FM from circ_helix import create_helix def parse_args(): parser = argparse.ArgumentParser(description='Create a sphere with circular-section helix') parser.add_argument('--out', help='output file name', type=str, required=Tr...
996,475
311e6600189e4e01a9418cd830629d8aa2cc3634
import sys import time import datetime import exceptions from mongosync.config import Config from mongosync.logger import Logger from mongosync.mongo_utils import get_optime, gen_namespace from mongosync.optime_logger import OptimeLogger try: import gevent except ImportError: pass log = Logger.get() class S...
996,476
b5099c8b63fd47b996313000a01ac833522fe0a6
from django import forms from .models import project, teams from pagedown.widgets import PagedownWidget class projectForm(forms.ModelForm): project_description = forms.CharField(widget=PagedownWidget) class Meta: model = project fields = [ 'team_name', 'project_title', ...
996,477
1fdef670b7f8ddd4f0cc48e88018855c1f4c3a48
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None #iterative class Solution: def preorderTraversal(self, root: TreeNode) -> List[int]: stack=[root, ] res=[] while stac...
996,478
536ff6e0e97fc690bcaf3a9a411f32a72900f129
""" @Project :data_visualization @File :mpl_squares.py @Description:绘制简单的折线图 @Author :Life @Date :2021/4/18 14:43 """ import matplotlib.pyplot as plt input_values = [1, 2, 3, 4, 5] squares = [1, 4, 9, 16, 25] print(squares[-1]) # 同时传入横纵坐标 plt.plot(input_values, squares, linewidth=3) # 设置图像的标签和横纵坐...
996,479
6eaf399ac2fe9461dea1aa94eb80556918a7ec34
#!/usr/bin/python3.5 from shapedetector import ShapeDetector import argparse import imutils import numpy as np import cv2 import matplotlib.pyplot as plt from time import sleep def auto_canny(image, sigma=0.95): # compute the median of the single channel pixel intensities v = np.median(image) # apply automatic ...
996,480
7d5b2788c4546ea8b198cbdd50d9eef279dcca25
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
996,481
bb0c5155111e0c6ad0be0dcc95af68e9fde7e24b
from django.test import TestCase from django.urls import reverse from .models import State STATES = ['AK','AL','AR','AZ','BI','CA','CO','CT','DC','DE','FL','GA','HI','IA','ID','IL','IN','KS','KY','LA','MA','MD','ME','MI','MN','MO','MS','MT','NC','ND','NE','NH','NJ','NM','NV','NY','OH','OK','OR','PA','RI','SC','SD','T...
996,482
f613ae5862e264c80d6a86ffa0a06ff92edbc026
# -*- coding: utf-8 -*- # Generated by Django 1.11.6 on 2017-11-12 03:33 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('critical_list', '0001_initial'), ] operations = [ migrations.Al...
996,483
9e9157c287c6543bdd00982b4e7a09231034ebd8
import functools from typing import ( Callable, TypeVar, ) from asks import Session from p2p import trio_utils from trinity.components.builtin.metrics.service.base import BaseMetricsService T = TypeVar('T') # temporary workaround to support decorator typing until we can use # @functools.cached_property w...
996,484
f00c703b8c207d63395937f3c6b0b12e498bf6c7
#!/usr/bin/env python import findgtk import gtk class ClickCountGUI: CLICK_COUNT = "Click count: %d" def __init__(self): "Set up the window and the button within" self.window = gtk.Window() self.button = gtk.Button(self.CLICK_COUNT %0) self.button.timesClicked = 0 self.window.add(self.button) self.b...
996,485
00237701cf15d706b5677935a2f6c7ae2c797d8d
def modify(k): k.append(39) print("K =", k)
996,486
3536c8ca8aa4a27e086f804e0c9e0d8ab039d113
# -*- coding: utf-8 -*- # Copyright 2020 Huawei Technologies Co., Ltd # # 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 ap...
996,487
768d2fe0beaf356c7d334f7cbbb6354f954c7c19
#Written for Python 3.4.2 data = [line.rstrip('\n') for line in open("input.txt")] totalpaper = 0 totalribbon = 0 for present in data: dimensions = sorted([int(x) for x in present.split('x')]) f1 = dimensions[0]*dimensions[1] f2 = dimensions[1]*dimensions[2] f3 = dimensions[2]*dimensions[0] extra ...
996,488
aff505c770117474282db460dc67f75620b11136
from redis import StrictRedis from sqlalchemy.orm import Session, scoped_session, Query from m2core.utils.decorators import classproperty from m2core.utils.error import M2Error class SessionMixin: __abstract__ = True @classmethod def set_db_session(cls, session) -> scoped_session or Session: """ ...
996,489
3f03f657184fd651d438487d59f60979dc1d7ece
__author__ = 'jsuit' import Corpus import numpy as np from numpy import matlib import json #set up Corpus corpus = Corpus.Corpus() corpus.get_articles() corpus.vectorize_articles() bow = corpus.get_vect_articles() n_docs = corpus.get_num_articles() corpus.calc_num_terms() n_terms = corpus.get_num_terms() #pick number...
996,490
caa724a8c0b8659ea2e360d92af59d1ebab5e293
'''Tests figures.settings These are currently just simple tests that make sure the basics are working. They could use elaboration to make sure that the individual settings within each of the Figures entries to ``WEBPACK_LOADER`` and ``CELERYBEAT_SCHEDULE`` are correctly assigned ''' import mock import pytest from fi...
996,491
0d99bd7861ddf980e568fd9f37a05900dea559d5
STATIC_ROOT_DIR = "/home/banban" class Application(object): def __call__(self, env, start_response): path = env.get("PATH") # if path.startswith("/static"): # path_way = path[7:] file_name = STATIC_ROOT_DIR + path print(file_name) try: file = open(file_name, "rb") except: status = "404 CANT FOUND...
996,492
3f0e2599577e098a0b913943fb14eaa4ac4d91d1
import sys def main(): n = int(sys.stdin.readline().strip()) A,B = [0 for i in xrange(101)], [0 for i in xrange(101)] for line in sys.stdin: a,b = [int(i) for i in line.split()] A[a] += 1 B[b] += 1 a,b = 100, 1 ca, cb = 0, 0 curr_ans = 0 while True: while a>0 and A[a] == 0: ...
996,493
c16c56d95e1d1bbf1feb89f5416ea8ff93ddc683
def countdown(n): if n > 0: print(n) countdown(n-1) n = int(input("Insira n ")) countdown(n)
996,494
8ea27274a45664cebe6bc18db2e0ac8024941c17
#!/usr/bin/python3 """ Datetime example """ import datetime import pytz if __name__=="__main__": fmt = "%Y %m %d %H:%M" current_time = datetime.datetime(2017, 1, 5, 9, 35, 44) timezone = pytz.timezone('US/Pacific') localized_time = timezone.localize(current_time) print(localized_time.astimezone(pytz.timezone...
996,495
86834805bc6abed63d64497ac74202dfb982fab7
# -*- coding:utf-8 -*- # @Author: clark # @Time: 2021/5/26 5:53 下午 # @File: demo_1.py # @project demand: import requests headers = { 'Proxy-Connection': 'keep-alive', 'Accept': 'application/json, text/javascript, */*; q=0.01', 'X-Requested-With': 'XMLHttpRequest', 'User-Agent': 'Mozilla/5.0 (Macintosh;...
996,496
7d00546eca2ce0dc2eb5cd6cb56ba09d044bc49f
#-----------------------------------------------------------------------------# #projection.py # #NPS Night Skies Program # #Last updated: 2021/02/22 # #This script plots the fits images in fisheye and Hammer projections. # #Input: # (1) reading in the mask to get the x,y center and the fisheye view radius # (2) al...
996,497
e59f29d53f9820350705693e96d1671f7514336d
import os import codecs import ntpath import logging import numpy import logging import cPickle import theano.tensor as tensor import theano from blocks.extensions import SimpleExtension from blocks.extensions.monitoring import DataStreamMonitoring from blocks.monitoring.evaluators import DatasetEvaluator from blocks.t...
996,498
3dd394c59838e2e8dca2bc077b5a2cc6d366327c
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: demo.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflecti...
996,499
d5632c715716c891565a52dbdae58f41f494c855
import io import re import requests def get_props_split_by_60_chars(prop): prop = prop.replace('\n', '') prop = prop.replace('"', '.') prop = prop.replace('“', '.') prop = prop.replace('”', '.') prop = prop.replace('\'', '') prop = prop.replace(':', '.') prop = prop.replace(',', '.') l...