index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
999,000 | c3f22c9cd8f7ef0325ed7d1e9f13f403ccc38d7a | '''
Created by auto_sdk on 2014-09-08 16:48:02
'''
from top.api.base import RestApi
class AitaobaoItemsBuyConvertRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.buy_now = None
self._from = None
self.open_iid = None
self.pid = None
self.quant... |
999,001 | c27536eaeffeaf5050ef556269aac47f4c7ef6a2 | # Copyright (c) 2016, Frederik Hermans, Liam McNamara
#
# This file is part of FOCUS and is licensed under the 3-clause BSD license.
# The full license can be found in the file COPYING.
import inspect
import click
import focus
import focus.simpletxrx
def _nop():
pass
def _get_type(default):
if type(defau... |
999,002 | f44f6b8b71205883755f2eab3b1a236c49d94bc3 | import torch
import json
import sys
from src.models.optim.autoencoder_trainer import AutoEncoderTrainer
from src.models.optim.DeepSAD_trainer import DeepSADTrainer
class DeepSAD:
"""
Define a DeepSAD instance (inspired form the work of Lukas Ruff et al. (2019))
and utility method to train, pretrain and te... |
999,003 | a0c5d05676f3e0011bfa96f9117a1b6921f04ed5 | weighItems = ['Cheese', 'Apple', 'Orange', 'Beef', 'Cocaine', 'Potato', 'Tomato', 'Pork', 'Carrot', 'Ham']
pieceItems = ['Bread', 'Roll', 'Crisps', 'Coke', 'Vinegar', 'Vodka', 'Ciggarettes', 'Beer', 'Pen', 'Pinapple'] |
999,004 | 142ef6a52abfa8253990cffc5d0bc6c932038ed3 | a = [[1,1],[2,3]]
print(a)
a = a[:]
print(a)
b = ['sunny', 'overcast']
b1 = [n for n in b if n != 'sunny']
print(b)
print(b1) |
999,005 | 6e0fa5c7f1362c8bb0eb51217b9067901c875fc7 | import urllib.request as ul
from selenium import webdriver
from PIL import Image
import pytesseract as pt
from bs4 import BeautifulSoup
browser = webdriver.Chrome(
'/home/aryandosaj/Desktop/Flask_Web_Hook/chromedriver')
browser.get('https://erp.bitmesra.ac.in')
image = browser.find_elements_by_tag_name('img')
lis... |
999,006 | 1d64adf2cfde17d644f23925a5611d5a6d4fe5af | # 1006 - Media 2
# Entrada
a, b, c = map(float, input().split())
# Pesos
a *= 2
b *= 3
c *= 5
# Media
media = (a + b + c) / 10
# Saida
print('MEDIA = %.1f' % media)
|
999,007 | e05d5121cf19cfdd6199d9e31ae8a9215c972843 | from rest_framework.serializers import ModelSerializer
from ..Models.attendance import Attendance
from ..Serializers.employee_serializer import EmployeeSerializerForOtherModels
from ..Serializers.production_attendence_type_serializer import ProductionAttendanceTypeListSerializer
from ..Serializers.unit_serializer imp... |
999,008 | 8d676877fa3f126f04b9e3057cbf6c10f0d9e04e | import asyncio
from pyppeteer import launch
import time
from twilio.rest import Client
from aip import AipOcr
import os
def screen_size():
"""使用tkinter获取屏幕大小"""
import tkinter
tk = tkinter.Tk()
width = tk.winfo_screenwidth()
height = tk.winfo_screenheight()
tk.quit()
return wi... |
999,009 | 48c8ab0cb7e241626ac770b456108dcaf248dd12 | #coding=utf-8
sex = input('请问你的性别是?')
if sex=='男':
print('你可以留胡子')
elif sex=='女':
print('你可以留长头发')
else:
print('你想怎样都可以')
|
999,010 | 58c38bd5b4038e5603d16f954805a3e8fad6f240 | import string
class Stuff:
def __init__(self):
self.clear()
def clear(self):
self.polymer = ''
def read_instructions(self, file_name):
input = open(file_name, 'r')
for instruction in input:
self.polymer = str(instruction.strip('\n'))
input.close()
def testStuffOne(self):
sel... |
999,011 | a7bc89682849150e72e7961173da1514c6d93dbe | import imageio
import numpy as np
import matplotlib.pyplot as plt
import os.path
import sys
# color-based constants
WHITE = 255
HAND_CUTOFF = 30
# video segment lengths, in frames
MIN_SEGMENT_LENGTH = 25
MAX_SEGMENT_LENGTH = 150
# image width/height, bounding box placement
X0 = 220
X1 = X0 + 256
Y0 = 120
Y1 = Y0 + 2... |
999,012 | e9976883a7ac28fc3ef5d8afadad3cc2ade27037 | # -*- coding:utf-8 -*-
import os
import sqlite3
from functools import wraps
import copy
"""
待优化:
1、字符串拼接时保留引号
劣法:参数填充时字符串值使用单双引号两层包裹
最优:
values = [str(tuple(item)) for item in values]
values = ",".join(values)
较优:对需要保留引号的字符串检出并更改为"'xxx'"形式,怎么实现呢?
def str_convert(s)... |
999,013 | 183df834b838b855a043cd8042b0ba434b0ffeb9 | # Cannibals and Missionary Problem
# Describes state which includes the cannibals, missionaries, if the transition is valid.
class State():
def __init__(self, cannibalLeft, missionaryLeft, side, cannibalRight, missionaryRight):
self.cannibalLeft = cannibalLeft
self.missionaryLeft = missionar... |
999,014 | 573fec0d1cb7b7ab2141997cea70ae8363682e37 | import random
import string
def generate_id(size=9):
return ''.join(random.SystemRandom().choice(string.ascii_uppercase + string.digits) for _ in range(size)) |
999,015 | 2084117da1b424ae479ad7c2523b95fc701af3d4 | import numpy as np
import sys
print("filename: %s"%( sys.argv[1]))
fp = open(sys.argv[1],'r')
fp_z=open('Zs.dat','w')
nz=61
start=2
if(len(sys.argv)>2):
start = int(sys.argv[2])
if(len(sys.argv)>3):
nz= int(sys.argv[3])
if(len(sys.argv)>4):
center= bool(sys.argv[4])
names=['N','P','G','C','D','W','T']
N=... |
999,016 | f36d0de89a3312d9a99c71e5f6bc2169e14f7766 | # Generated by Django 2.0 on 2019-01-01 08:58
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('blog', '0004_like'),
]
operations = [
migrations.RemoveField(
model_name='like',
name='post',
),
migrations.De... |
999,017 | d8169abbd8e7614e70d40b17718da99349743580 | import itertools
import math
import bisect
import re
from collections import Counter, defaultdict
from functools import lru_cache
from typing import List, Union, Dict, Tuple, Collection, Callable
import numpy as np
from graphviz import Digraph, Graph
from scipy.special import comb
from aug.data.fasta import fasta_fil... |
999,018 | 61ad9eaaba6c55fc5a263eef1d0d8ae890de6286 | """Consolidate all environment setup functionality (sys.path changes,
monkeypatches, etc.) in here."""
import os, sys
# Add our external dependencies to sys.path
extlibs = ('jinja2', 'tweepy', 'python-simplejson', 'appengine-search')
for lib in extlibs:
sys.path.insert(0, os.path.join('ext', lib))
|
999,019 | 22693c44ffa287006ea20d866dc07768311befc3 | import networkx as nx
import pandas as pd
df=pd.read_csv("AAAI.csv")
graph=nx.from_pandas_edgelist(df, source='Topics', target='High-Level Keyword(s)', edge_attr=True)
a=nx.edge_betweenness_centrality(graph)
d={}
while(1):
b=max(a.values())
for key, value in a.items():
if(value... |
999,020 | 1f4554949a0a1d6431963069e7f95daaaecb1605 | import os
def package_dir():
return os.path.dirname(__file__) + os.sep
|
999,021 | c32e77ab7be76f10200e2e3552823c49c5dfd6d5 | # -*- coding: utf-8 -*-
"""
Accelerometer Plugin
Copyright (C) 2015 Olaf Lüke <olaf@tinkerforge.com>
Copyright (C) 2015 Matthias Bolte <matthias@tinkerforge.com>
accelerometer.py: Accelerometer Plugin Implementation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU G... |
999,022 | b13f0ea9a687f3d8b319de1475be7fbe925de60f | # Generated by Django 3.0.8 on 2020-10-01 02:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('projects', '0002_auto_20200924_0604'),
]
operations = [
migrations.AddField(
model_name='shelter',
name='species',
... |
999,023 | 6344262b18e4c83b54a54f8a6e708d60581d66bb | # coding:utf-8
import unittest
import os
import report.HTMLTestRunner
# python2.7要是报编码问题,就加这三行,python3不用加
# import sys
# reload(sys)
# sys.setdefaultencoding('utf8')
# 用例路径
case_path = os.path.join(os.getcwd(), "testcase")
# 报告存放路径
report_path = os.path.join(os.getcwd(), "report")
def all_case():
#pattern:匹配的测试... |
999,024 | 141c77680a7ff2015e53f8e12a6243b8739c657b | # Generated by Django 3.0.4 on 2020-03-23 21:28
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='order',
n... |
999,025 | 97a3198bd9de766b39fb5e2e2fefe526478d8f64 | from unittest import TestCase
from yahtzee import calculate_small_straight_score
class TestCalculateSmallStraightScore(TestCase):
def test_calculate_small_straight_score_small_straight(self):
score_choice = "10 - Small Straight"
held_dice = [1, 2, 3, 4, 6]
expected = 30
... |
999,026 | 4743710e9b7ad872a44e9f38c53f272b2f2bfa55 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 21 18:14:38 2018
@author: girish
"""
"""Face Detection"""
#%%Training
import numpy as np
import cv2
from matplotlib import pyplot as plt
def disp_img(im,r,c,d):
img=np.reshape(im,(r,c,d)).astype(np.uint8)
cv2.namedWindow('image',cv2.WINDOW... |
999,027 | d5ec578829503bfcabe867f7ef2690dfac8bee1b | from django.shortcuts import render
from django.shortcuts import redirect
from django.http import HttpResponse
from portfolio.settings import EMAIL_HOST_USER
from django.core.mail import send_mail
from .forms import MessageForm
def index(request):
return render(request, 'base/index.html')
def aboutme(request):
... |
999,028 | 75a282fe7ad33ad22df1cb690c40774b037cd937 | #!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# 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 o... |
999,029 | f2f434fd23998b4b423d2f7baed9a13175ba9c7c | """empty message
Revision ID: 467eb3f93699
Revises: a0c296fb5401
Create Date: 2021-05-08 13:50:35.935521
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '467eb3f93699'
down_revision = 'a0c296fb5401'
branch_labels = None
depends_on = None
def upgrade():
# ... |
999,030 | 8fc2ff6c6952c32bed927431caceb655006cabe5 | #!/usr/bin/env python
### BEGIN CONFIGURATION SECTION ###
# which RESOLUTION?
RESOLUTION = (1024,768)
# which SIZE of the visible area?
SIZE = (600,600)
# how many TRIALS per round (MINimum)
MINTRIALS = 20
# LENGTH of STimulus presentation in seconds
ST_LENGTH = 0.5
# LENGTH of Break between Trials in seconds
TB_L... |
999,031 | 94a47ec8dbb5cb93c6275e6896a88deb298ebe4c | from typing import Dict, List
import numpy as np
import tensorflow as tf
from typeguard import check_argument_types
from neuralmonkey.runners.base_runner import BaseRunner
from neuralmonkey.decoders.ctc_decoder import CTCDecoder
from neuralmonkey.decorators import tensor
class CTCDebugRunner(BaseRunner[CTCDecoder])... |
999,032 | 31a636513075f4470dc7b92cced09bda9a6ec2a7 | from abc import ABC, abstractmethod
import os
import importlib
from PIL import Image
import numpy as np
import torch
from .catalog import PathManager, LABEL_MAP_CATALOG
from ..elements import *
__all__ = ["Detectron2LayoutModel"]
class BaseLayoutModel(ABC):
@abstractmethod
def detect(self):
pass
... |
999,033 | c8e05ce3828bea3e91a3019556ce5762b8ddac96 | #-*- coding:utf-8 -*-
from openerp import models, fields, api
class setting_moveprocess_receivemailid(models.Model):
_name = 'setting.moveprocess.receivemailid'
billrecivnum = fields.Boolean('結算收件編號')
temporpaynum = fields.Boolean('暫繳收件編號')
billtempor = fields.Boolean('結算及暫繳收件編號')
earndistratio = ... |
999,034 | 5b04404f08f962983914ac43a6f5a6220e67f0e6 | #! /usr/bin/env python
#encoding=utf-8
'''
Created on 2010-10-21
@author: jiugao
'''
from client.Authentication import Authentication
from common.Config import Config
from common.exception.ConnectionException import ConnectionException
from common.exception.SessionClosedException import SessionClosedException
from com... |
999,035 | 24bcabf8e8d54fee37b69c45f04a25b1661d9d0d | from tuyaha.devices.climate import TuyaClimate
from tuyaha.devices.cover import TuyaCover
from tuyaha.devices.fan import TuyaFanDevice
from tuyaha.devices.light import TuyaLight
from tuyaha.devices.lock import TuyaLock
from tuyaha.devices.scene import TuyaScene
from tuyaha.devices.switch import TuyaSwitch
def get_tuy... |
999,036 | c436c9fd8dc9acf9cd45dd8a65de4e8e8b564c4e | # import time
# from selenium import webdriver
# from selenium.common.exceptions import NoSuchElementException
#
# browser = webdriver.Chrome()
# url = 'http://www.runoob.com/try/try.php?filename=jqueryui-api-droppable'
# browser.get(url)
# browser.switch_to.frame('iframeResult')
# try:
# logo = browser.find_elemen... |
999,037 | 74d0ac76ec6411c6efec86b2cd9d9eea9f6cb4cd | from bs4 import BeautifulSoup
import re, sys, urllib
import glob
def googleUPC( upc ):
reg = "[1-9][0-9]+"
nzupc = re.findall( reg, upc )[0]
return '0'*(14-len(nzupc)) + nzupc
def mkGoogleSUUrls( urls ):
base_url = 'http://www.google.com/%s/online?q=%s'
reg_url = '/(shopping/product/[0-9]+)?'
... |
999,038 | ca4f9507519b0b44bcbe861685578d33ea5d1bf0 | import pandas as pd
from sklearn.model_selection import train_test_split
# Read the data
X_full = pd.read_csv('home-data-for-ml-course/train.csv')
X_test_full = pd.read_csv('home-data-for-ml-course/test.csv')
# Remove rows with missing SalePrice target
X_full.dropna(axis=0, subset=['SalePrice'], inplace=True)
# separ... |
999,039 | 5ad6097331075544d3381681699b33a7daca6c5b | from django.core.management.base import BaseCommand
from django.db.models import Q
from ...models import Harbor
class Command(BaseCommand):
def handle(self, **options):
updated_harbors = 0
missing_images = []
for harbor in Harbor.objects.exclude(
Q(servicemap_id=None) | Q(ser... |
999,040 | ce7337866e548119bf9d38e9c4752df5de7425c0 | # -*- coding: utf-8 -*-
'''
Slightly resembles an install script, but actually there is not much
to install.
'''
import os
import sys
from distutils.core import setup
sys.path.append("src")
from pynal.models import Config
setup(name=Config.appname.lower(), version=Config.version,
url=Config.homepage, license=... |
999,041 | 9486c699aa276fae050863203eeec9639c2561f5 | #coding:utf8
'''
Created on 2011-4-1
@author: sean_lan
'''
from app.share.dbopear import dbMail
from app.game.component.Component import Component
from app.game.component.mail.Mail import Mail
import math
class CharacterMailListComponent(Component):
'''角色邮件列表组件'''
def __init__(self,owner,mailList = []):... |
999,042 | cc2bc69bd29e8e78a5366203bd866a25af0ab5f8 | from django.contrib import admin
class PermissionAdmin(admin.ModelAdmin):
"""Push this to intercept .queryset() calls from OwnableAdmin
"""
def queryset(self, request):
"""Return items based on request
"""
qs = self.model._default_manager.get_query_set()
ordering = self.g... |
999,043 | fb9e055381143a667e36d0194e98451c1cf7d587 | import csv
import keras
import Controller
from keras.models import Sequential, Model
from keras.layers import Dense
from keras.layers import Input
from keras.layers import concatenate
from keras.optimizers import Adam
import numpy as np
from keras import optimizers
from keras.callbacks import ModelCheckpoint
from keras... |
999,044 | 257de79de6e45c9f9ce9f1f634ed152ac5d3f091 | import numpy as np
from mytree import DecisionTreeClassifier as mytreeclf
class ADT():
def __init__(self, criterion, max_depth, random_state=None):
self.criterion = criterion
self.max_depth = max_depth
self.random_state = random_state
def fit(self, X, y):
self.clf =... |
999,045 | 4cfc0123137e37198a150b4a536e1d7d2963f94e | from models import conv2d_model, dense_model
import numpy as np
from geometries import square_geometry
from hamiltonians import AFH
model = dense_model
epochs = 100000
epoch_size = 1000
n_minibatches = 5
num_nm_rhs = 1000 # required for <H> estimation
num_n_samples = 100000 # required for -\log <psi>^2 estimation
ra... |
999,046 | 6497eb5e5b26c12a8110b2f9f89ea39180af30c9 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
描述:三数之和 (难度:中等)
给定一个包含 n 个整数的数组 nums,判断 nums 中是否存在三个元素 a,b,c ,使得 a + b + c = 0 ?找出所有满足条件且不重复的三元组。
注意:答案中不可以包含重复的三元组。
示例:
给定数组 nums = [-1, 0, 1, 2, -1, -4],
满足要求的三元组集合为:
[
[-1, 0, 1],
[-1, -1, 2]
]
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/3sum
著作权归领... |
999,047 | ea72eb9fdd09bfac59bc91c99ce3628de34d3a80 | from django.conf.urls import url, include
from rest_framework import routers
from todos import views
from rest_auth.registration.views import VerifyEmailView
app_name = 'todos'
router = routers.SimpleRouter()
router.register(r'todolists', views.ToDoListViewSet)
router.register(r'task', views.TaskViewSet)
router.reg... |
999,048 | e1934e46dadd3b9734ad8477681bc05cc748b412 | import re
from pandas import read_csv, DataFrame, concat, Series
from functools import singledispatch, reduce
from tqdm import tqdm
from transformers import PreTrainedTokenizerBase
import numpy as np
import pandas as pd
from torch.utils.data import Dataset
import torch
#================================================... |
999,049 | e1004fbcd7451ecbdc9dbce65a1afad7478a7dff | # 提取http://lab.scrapyd.cn中的五条名言
# 相同作者的名言保存在一个文件中,采用追加的方式写入
import scrapy
# 定义一个spider类,继承Spider父类
class ListSpider(scrapy.Spider):
# 定义蜘蛛名
name = 'ListSpider'
start_urls = ['http://lab.scrapyd.cn']
def parse(self, response):
# 提取页面中的所有的名言
mingyanPage1 = response.css('div.quote')
... |
999,050 | 28d6e9f9b9783907daae7afefd8b6b531f2a0e07 | # test github copilot
# พิมพ์ตรงนี้
# function to encrypt text with a random key
# โผล่ตรงนั้น ------------------------------------------>
def encrypt(text, key):
encrypted_text = ""
# loop through all characters in plain text
for i in range(len(text)):
# get ASCII value of character
... |
999,051 | dfbf885083467e19c1ca4b5cbd9830273a8f0787 | import requests
import config
import json
import time
import tele_config
from boltiot import Bolt,Sms
thresh_per=70
mybolt=Bolt(config.API_KEY,config.DEVICE_ID)
sms=Sms(config.SID,config.AUTH_TOKEN,config.To_num,config.From_num)
def sensor_value(pin):
try:
response=mybolt.analogRead(pin)
data... |
999,052 | 068c477c3b2bf1f464d6a4951588bbae7d1e6057 | from constants import teams, var_view_map
from nba_py.team import TeamGameLogs
import numpy as np
from datetime import datetime
from sqlalchemy import *
all_stats = list(var_view_map.values())
def _color(value):
if value['WL'] == 'W':
return 'orange'
else:
return 'grey'
def _alpha(value):
... |
999,053 | fffd4c683d484654ee0288a991235534521b3ac6 | import os
from .base import *
WAGTAILADMIN_BASE_URL = "http://testserver"
SECRET_KEY = "TEST_KEY"
WAGTAILSEARCH_BACKENDS = {
'default': {
'BACKEND': 'search.backend',
'URLS': [os.getenv('ELASTIC_SEARCH_URL')],
'INDEX': 'test',
'TIMEOUT': 1500,
'INDEX_SETTINGS': {
... |
999,054 | 8a2574db275f443b35bed8a29dcdc62c50a74a24 | from time import sleep
print('\n')
print('\033[33m—'*32)
print('\033[36m PERGUNTE AO PEIXE v0.2Alpha')
print('\033[33m—'*32, '\033[m\n')
x = str(input('Digite uma palavra: ')).strip().upper()
y = str(input('Digite outra palavra: ')).strip().upper()
print('\n\033[32mPensando...\033[m\n')
sleep(2)
points = 0 #Positivo =... |
999,055 | 7100b81f5dd349f12e987dcfadb2220c875e1e50 | import statistics
from fastapi import FastAPI
import requests
from bs4 import BeautifulSoup
from typing import List
from lib_viagens import entrada_dados_viagem,dados_viagem,otimizar,buscarmenor,dic_datas,i_produtos,peso_tempo,lista_cidades,peso_atraso,TravellingSalesmanProblem
from collections import defaultdict... |
999,056 | 3b1ae977cb2610f08f46bf404f70391d700954de | import pandas as pd
import numpy as np
def create_submission(pred_sub, name_of_the_file='submission'):
"""
Writes the submission in a csv file
INPUT:
pred_sub - The list of predictions
name_of_the_file - (optional): the path of the file
"""
df_sub = pd.DataFrame(... |
999,057 | 4512c7ec4ac5b7a919345caffa1768697d3ff92c | import socket
import threading
import time
import random
from load_common import *
import sys
node_set_localhost = ["127.0.0.1"]
node_set_8 = ["192.168.0.200",
"192.168.0.201",
"192.168.0.202",
"192.168.0.203",
"192.168.0.204",
"192.168.0.205",
... |
999,058 | f1c5970742510d393ef9a789f9f7d4f6252838f6 | #Metric-Oriented Sequence Typer (MOST) software is a modified version of SRST version 1 script (http://sourceforge.net/projects/srst/files/?source=navbar),
#modification made by Anthony.Underwood@phe.gov.uk and Rediat.Tewolde@phe.gov.uk.
import os
import os.path
import sys
import pickle
import re
from collecti... |
999,059 | ad817f60883057ad287af959a81299b92f6f89e3 | import os
import os.path
import torch
import sys
from torchvision import models
from collections import namedtuple
class saveData():
def __init__(self, args):
self.args = args
self.save_dir = os.path.join(args.save_dir, args.load)
if not os.path.exists(self.save_dir):
... |
999,060 | d4ecd8805a01403cf5678d43294fa22aa3fa6692 |
from __future__ import with_statement
__all__ = ["register_cookbook_path", "load_cookbook"]
import imp
import os
import sys
import yaml
import kokki
from kokki.environment import env as global_env
class CookbookTemplate(object):
def __init__(self, name, path):
self.name = name
self.path = path
... |
999,061 | f71738cf19d4ca29a62000db45b8151ec5e6f860 | from flask import Flask, request
from datetime import datetime, date
from app.models import db, Candidate
from flask_marshmallow import Marshmallow
ma = Marshmallow()
from app.api import api
from app.api.namespaces.candidates.schemas import CandidateEmploymentHistorySchema
def create_app():
app = Flask(__name_... |
999,062 | 08228b28c265efd1d2a6aa2755559f50619f3e27 | #!/usr/bin/env python
from __future__ import print_function
from github import Github
from os.path import expanduser
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument("-r", "--repository", dest="repo", help="Github Repositoy name e.g cms-sw/cms-bot",type=str)
parser.add_argument("-b", "... |
999,063 | 84f22687df107437e7e78f6055f9a113b47a4a99 | max_realizations = 1000000000
|
999,064 | 6e0a7d3f509b04f46626b8350e8407dca3fec9c8 | """
Utilty functions that interact with ArcGIS Feature Servers
NOTE: Intents that query FeatureServers may fail because AWS will
kill any computation that takes longer than 3 secs.
"""
from arcgis.gis import *
from arcgis.features import FeatureLayer
from arcgis.geocoding import geocode
import logging
logger = logg... |
999,065 | d7efff7a1687f1744dadd6d3e0de33dc8cda0e60 | '''
QUICK FIND : Tells whether two nodes of a graph are connected
UF ADT:
UF(n): initialize n nodes (with list of integers 0 to n-1)
union(p,q): connects nodes p and q (makes nodes entries same)
find(p): component identifier for p(0 to n-1)
connected(p,q): returns True if p and q are in same component ... |
999,066 | cf5acd41b8d9bea4db3d296b08d3cc153dd8ee53 | import pymongo
import pandas as pd
import pprint
import random
myclient = pymongo.MongoClient("mongodb+srv://admin:admin@cluster1.ajaye.mongodb.net/")
# print(myclient.list_database_names())
mydb = myclient["public"]
mycol = mydb["completeride"]
# print(mydb.list_collection_names())
def isKAnonymized(df, k):
f... |
999,067 | 2650a7be313a1a2a6e59dd53c35a77ae221407d6 | """PytSite Facebook Plugin Event Handlers.
"""
__author__ = 'Alexander Shepetko'
__email__ = 'a@shepetko.com'
__license__ = 'MIT'
from pytsite import metatag as _metatag, lang as _lang, router as _router
from plugins import auth as _auth
from . import _api, _error
def router_dispatch():
"""'pytsite.router.dispat... |
999,068 | 054ad813d68f387364d325486636a649e57f5dca | import numpy as np
import cPickle as pk
import gzip as gz
from IPython import embed
import glob
from pylab import *
from astropy.visualization import hist
from scipy import stats
from cosmojo.universe import Cosmo
def GetDls(spectra_folder):
patches_files = sorted(glob.glob('%s/*.pkl.gz' %(spectra_folder)))
dls = []... |
999,069 | 051b94f0951aaae2d7acb06ecf4c604bb56fa570 |
"""
need to check out
https://github.com/VRGhost/vbox
"""
import re
import os
from subprocess import CalledProcessError
from .shellcommand import ShellCommand
from . import utils
re_sctl = r'(?P<sctl>.{0,}?)\s*\((?P<device>\d+),\s*(?P<port>\d+)\)\s*:'
re_vmdk = r'\s*(?P<vmdkfile>.{0,}?)\s*'
re_uuid = r'\(UUID:\s*(?P... |
999,070 | bacbd6fc47b37b9ec03044c242073a4b4c8100f1 | # from __future__ import absolute_import
import os
import sys
import time
import datetime
import shutil
from stat import S_ISREG, S_ISDIR, ST_CTIME, ST_MODE
import flask
import pickle
import werkzeug
import celery
import celery.exceptions
import logging
# import batches
import flask_restful
# import tasks
import config... |
999,071 | a9db5a82ea63c5d18440a8c36a875bd5f3236371 | from django.db import models
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from usuarios.models import User, NombreField
# Create your models here.
###############################################################################################################################... |
999,072 | 3a50834eb84e6b4235b5f0537495f29877d036e2 | import logging
from .formatter import CustomFormatter
import os
def get_logger(name="LPBv2", log_to_file=False):
logger = logging.getLogger(name)
logger.setLevel(logging.DEBUG)
# Removing duplicate handlers when instanciating the logger in multiple files
if logger.hasHandlers():
logger.handle... |
999,073 | a4042cfb24813e2fd7ed1d961dc244808c0e76b0 | import numpy as np
import os
import math
import pandas as pd
from statsmodels.stats.proportion import proportion_confint
from sklearn.tree import DecisionTreeClassifier
from sklearn.base import ClassifierMixin
def safe_division(dividend, divisor, epsilon):
if divisor == 0:
return dividend / epsilon
... |
999,074 | 22b3f1cc3e81ecbbf5309c54b3f772019e1af398 | #!/usr/bin/env python3
import sys
import mechanicalsoup
# connect to duckduckgo
browser = mechanicalsoup.StatefulBrowser()
browser.open("https://google.com/")
# fill in search form
browser.select_form('form[action="/search"]')
browser["q"] = sys.argv[1]
browser.submit_selected(btnName="btnI")
# display results
print... |
999,075 | 5c77d17247e98f5d709576c97b18cda8b4269a4b | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from accounts.admin import admin_site
from publication.models import Publication
# Register your models here.
admin_site.register(Publication)
|
999,076 | cec67716adb32cbaf1b43d32631e5aa540bc9593 | ii = [('CoolWHM2.py', 1), ('GodwWSL2.py', 2)] |
999,077 | 414399f72a04ffcc948afc110eb040b0245530e5 | #!/usr/bin/python
import os
import sys
import csv
import datetime
import time
import tweepy
def speedtest():
#Demarage de speedtest-cli
print 'Demarage du test'
a = os.popen("python /usr/local/bin/speedtest --simple").read()
print 'ran'
#Separation du resultat en 3 lignes (pin... |
999,078 | dd8082dec8dc1e9e3990be9b06e20c465e7b8d56 | from ai import AI
# play
class Player(object):
def __init__(self, color):
self.color = color
# think
def think(self, board):
pass
# place discs
def move(self, board, action):
flipped_pos = board._move(action, self.color)
return flipped_pos
# un... |
999,079 | 61fb41476eee5d21cd2d4324d6fb5da2204c937a | #!/usr/bin/python3
from BPNN import *
from random import choice, randint, sample
from time import sleep
from collections import Counter
from multiprocessing import process
from copy import deepcopy
#CREATE 100 In Sample EXAMPLES
examples=[]
for i in range(100):
value = randint(1,1000)
ip = [float(s) for s in '{:01... |
999,080 | 7db5df504d33f9f1478d5e884d2345730c13944b | # Generated by Django 2.2.5 on 2019-12-31 09:22
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('CN171_operation', '0007_auto_20191227_1153'),
]
operations = [
migrations.RenameField(
model_name='oprfinance',
old_name='op... |
999,081 | 4f06cbc6c77758178bbe4dfe8700f9edb869962e | from .meteo_station import MeteoStation
|
999,082 | e855d8a10f960acb22b13c56e7545aec65af4ae5 | #passing two arguments and printing
def add_sub(x,y):
z = x + y
d = x - y
return z,d
result1,result2 = add_sub(1,2)
print(result1,result2) |
999,083 | a9341a299d0fdc21444a22784ccf1f9ed5b7abaa | import os
import subprocess
import shutil
# This script does the build, replacement and copying of the antlr generated files
buildCommand = 'java -jar "antlr-4.7.2-complete.jar" -Dlanguage=JavaScript "Thyme.g4" -o "./generated" -visitor';
def normalizePath (path):
return path.replace ("\\", os.sep)
def executeComa... |
999,084 | 2754c8cea19a5214f8b69f763cf6cb9559e3f5e7 | import sys
import csv
import string
from collections import defaultdict
if __name__ == '__main__':
# intialize core variables
if len(sys.argv) == 5:
trainingFile = str(sys.argv[1])
transFile = str(sys.argv[2])
emmisionsFile = str(sys.argv[3])
laplaceFile = str(sys.argv[4])
e... |
999,085 | b35cc5f39e0c02293b46cb4c78c4589e56ce73b1 | from std_msgs.msg import Int64
import rospy
time = 0
def clockCallback(clock):
print(dir(clock))
return
if __name__ == '__main__':
rospy.init_node('clock_tester')
clock_topic = "/clock"
clock = rospy.Subscriber(clock_topic, Int64, clockCallback)
# print(rospy.time)
rospy.Rate(5)
rospy.spin... |
999,086 | ddabe588d36491f8a387136ea71ff93fe574627a | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 10 21:57:37 2019
@author: Nataly
"""
#from readimg import read_img
import cv2
import numpy as np
import glob
from yolovoc import yolo2voc
from readboxes import read_boxes
from matplotlib import pyplot as plt
from rOI import ROI
from skimage.feature import greycomatrix, g... |
999,087 | de966c61ffea5d644b97c02570e7d0eaeb673751 | from auditlog.models import LogEntry
from rest_framework import viewsets
from restapi.models import FavoriteThing, Category, Metadata, Enum
from restapi.serializers import FavoriteThingSerializer, CategorySerializer, MetadataSerializer, EnumSerializer, LogEntrySerializer
class CategoryViewSet(viewsets.ModelViewSet):
... |
999,088 | f2e181f1c543ce2f79aca64fc1c9f4d8f2d7b642 | num2 = int(input('Digite um valor'))
print('O resultado das operações com o número {}:'.format(num2))
print('dobro = {}\nTriplo = {}\nRaiz quadrada = {:.2f}:'.format((2*num2), (3*num2), (num2**(1/2)))) |
999,089 | a9071f3f5d08a2bf7ca7be8316b098a3a67685db | def magic_sum(mylist):
return sum([x//2 if x%2==0 else x*2 for x in mylist ])
|
999,090 | 53cba0138ce937268af51873590d0a61d5d14375 |
# coding: utf-8
# In[1]:
import numpy as np
# In[10]:
a= np.array([1, 2, 3, 4, 5])
b= np.array([10, 20 , 30, 40, 50])
# In[11]:
a+b
# In[12]:
a+1
# In[13]:
a*b
# In[15]:
c=np.arange(11.)
c
# In[19]:
y=np.sin(c)
y
# In[20]:
import matplotlib.pyplot as plt
# In[21]:
plt.plot(c, y)
# In[23]:
... |
999,091 | e37d44f03969ee7ab034b6553710d5920b4b4e99 | '''
A dynadag-ish graph layout calculator...
'''
import visgraph.layouts as vg_layout
import visgraph.drawing.bezier as vg_bezier
zero_zero = (0,0)
def revenumerate(l):
return list(zip(range(len(l)-1, -1, -1), reversed(l)))
SCOOCH_LEFT = 0
SCOOCH_RIGHT = 1
class DynadagLayout(vg_layout.GraphLayout):
... |
999,092 | 2926dc639542e2118d9b76000e62b3e57b3e2b43 | # Автор: А.Н. Носкин
with open("24-s1.txt") as F:
k = 0 # счетчик строк
while True:
s = F.readline() # прочитать строку
if not s: break
if s.count("J") > s.count("E"):
k +=1
print(k)
|
999,093 | 96c75e0f00d0248426c4fd8b9af9250bd6935a3e | from django.db.models.signals import post_save
from django.dispatch import receiver
from .models import Project, ImageAlbum
@receiver(post_save, sender=Project)
def create_album(sender, instance: Project, created, **kwargs):
if created and instance.album == None:
defaultName = f"Album: {instance.title}"
defa... |
999,094 | 54225b1a22373b8a86212e063ac393e5946b953b | import sys
file = sys.argv[1]
with open(file, 'r', encoding='iso-8859-1') as infile:
for line in infile:
if line[:5] == '1;94;' :
line = line[:-1]
print(line)
|
999,095 | 1ba68cc2d15fc62b6c54629fdd9a712030621a9d | #from tkinter import *
#root = Tk()
#frame = Frame(root)
#frame.pack()
#bottomframe = Frame(root)
#bottomframe.pack( side = BOTTOM )
#redbutton = Button(frame, text = 'Red', fg ='red')
#redbutton.pack( side = LEFT)
#greenbutton = Button(frame, text = 'Brown', fg='brown')
#greenbutton.pack( side = LEFT )
#bl... |
999,096 | 5a19386d4df7e669fb20026689c5d4ea6b87c795 | from flask import (render_template, url_for, flash,
redirect, request, abort, Blueprint)
from flask_login import current_user, login_required
from rabadiom import db, login_manager, bcrypt
from rabadiom.models import Post, User, Ehr, Keys, Blockchain, SignedEhr
from rabadiom.posts.forms import PostFo... |
999,097 | 44658e2a602362326e7369dbe5ce016cb5b5f0b4 | #!/usr/bin/env python
import random, math
SVG_HEADER = """<svg height="38" width="38">"""
SVG_FOOTER = """</svg>"""
CIRCLE_PATTERN="""\
<circle r="%(r)d" stroke="#000" cx="%(cx)f" cy="%(cy)f" stroke-width="%(sw)f" fill="%(fill_color)s"/> \
"""
def circle(f, r, cx, cy, stroke_width):
fill_color = 0
for i in r... |
999,098 | 7f5dc973e13137eaa9d478b72f73ce192ba63115 | from django.conf.urls import patterns, include, url
urlpatterns = patterns('project.views',
url(r'^(?P<project_id>\d+)/$', 'project_detail', name='project-detail'),
url(r'^$', 'index'),
)
|
999,099 | 09ccc973fae55f999aae14e58c38115d2395b870 | import json
import itertools
import logging
import os
import random
import string
import sys
import traceback
import typing as ty
from azure.identity import DefaultAzureCredential
from azure.identity import ManagedIdentityCredential
from azure.mgmt.keyvault import KeyVaultManagementClient
from azure.mgmt.keyvault.mode... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.