index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
987,500 | 89d1d5eb04b4ea9c053ab62307fddeefaefb140b | #
# PySNMP MIB module ALCATEL-IND1-DOT1Q-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALCATEL-IND1-DOT1Q-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:17:20 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... |
987,501 | c04a7d9c9a4b9405630423b43b3f19c380e7829b | import redis
from django.conf import settings
from django.core.management.base import BaseCommand
from pin.search_indexes import PostIndex
from pin.models import Post
class Command(BaseCommand):
def handle(self, *args, **options):
r_server = redis.Redis(settings.REDIS_DB, db=settings.REDIS_DB_NUMBER)
... |
987,502 | a927a8cc5be4e0f82ce4d8c54ef8341b14da80fe | #!/usr/bin/env python
# -*- coding: utf-8 -*-s
from time import sleep
from Prototipo.intManager import Irq
class Cpu:
def __init__(self, mmu, intManager):
self._pc = (-1)
self._ir = None
self._mmu = mmu
self._intManager = intManager
... |
987,503 | 60773bad2ce85530b5075dd54e0e20d2253f1523 | import os
import cupy as cp
BLOCKSIZE = 1024
module = cp.RawModule(path = os.path.dirname(__file__) + '/kernels.cubin', backend = 'nvcc')
ker_cubic = module.get_function('cubic')
def cubic(b, c, d):
x = cp.empty_like(b)
ker_cubic(((x.size- 1) // BLOCKSIZE + 1, ), \
(BLOCKSIZE, ), \
... |
987,504 | 8b8d7c43daa4ea5512a7c0d606d37c8906ddb20e | """
@BY: Reem Alghamdi
@DATE: 17-09-2020
"""
def de_bruijn_graph_fromkmer(kmers):
"""
:param kmers: array of kmers
:return adjacency list of prefix/suffix
"""
adj_list = {}
for edge in kmers:
from_prefix = edge[:-1]
to_suffix = edge[1:]
if adj_list.get(from_prefix):
... |
987,505 | c8686756af6800082abf2d933bfbbc9932ea1f98 | import os
import random
import networkx as nx
import pandas as pd
delimiter = '\t'
def generate_graph(graph_func, params):
# set seed
seed = 93
# generate graph based on passed function and params
graph = graph_func(**params, seed=seed)
return graph
def load_dataset_to_graph(dataset_dir, node_l... |
987,506 | a03188760fce49616ef4603e97cd20b0d6437f2e | #!/usr/bin/env python3
# An example of how to use a custom message in a publisher.
#
# custom_publisher.py
#
# Bill Smart
#
# This shows how to use a custom message type with more than one data field.
import rospy
import sys
# Import the message definition
from rob599_basic.msg import Rectangle
from random import... |
987,507 | 0639cb0ddc7cf942325972da1278caebea22aa40 | class Solution:
def maximumWealth(self, a: List[List[int]]) -> int:
sumi = 0
for i in a:
sumi = max(sumi, sum(i))
return sumi
|
987,508 | 264525d93a310d19f9dc1e36625abd7e03014851 | # -*- coding: utf-8 -*-
# PlatoonTools plugin for BigBrotherBot(B3)
# Copyright (c) 2014 Harry Gabriel <rootdesign@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 ... |
987,509 | 3fea1c84129f7ef3ae6f6ef9f76054e6e27e871e | # The number 3797 has an interesting property. Being prime itself, it is
# possible to continuously remove digits from left to right, and remain prime
# at each stage: 3797, 797, 97, and 7. Similarly we can work from right to
# left: 3797, 379, 37, and 3.
#
# Find the sum of the only eleven primes that are both tru... |
987,510 | 4b06c73d51fb662691580f1d27c621647b947b15 | # from django.db.models.signals import post_save,pre_save,post_delete,pre_delete
# from django.dispatch import receiver
# from .models import Book,ISBN,User
# @receiver(post_save, sender = Book)
# def after_book_addition(sender,instance,created,*args, **kwargs):
# if created:
# isbn_instance = ISBN.objec... |
987,511 | adc9447ea0444bcf0ff6e0e01c7f988456a18af6 | from random import randint
from sqlalchemy.exc import IntegrityError
from faker import Faker
from . import db
from .models import User, Post
def users(count=100):
faker = Faker()
i = 0
while i < count:
u = User(email=faker.email(), username=faker.user_name(),
password='password',
... |
987,512 | d206f286ef133efef45bd57a7ccb54928f2a2ea8 | '''
-Medium-
Given a binary tree, imagine yourself standing on the right side of it, return the values of
the nodes you can see ordered from top to bottom.
Example:
Input: [1,2,3,null,5,null,4]
Output: [1, 3, 4]
Explanation:
1 <---
/ \
2 3 <---
\ \
5 4 <---
'''
# De... |
987,513 | 61cd2b418bdc2fbe93b3c97dfe99b9938f3ce8c7 | #使用while-else和列表实现1~9的平方
list1=[1,2,3,4,5,6,7,8,9]
total=len(list1)
i=0
print("计算1-9的平方:")
while i<total:
square=list1[i] * list1[i]
print(i+1,"的平方是:",square)
i+=1
else:
print("循环正常结束!")
'''
#while-else有break练习
i=0
while i<5:
print("第%d次循环"%i)
if i==3:
break
i+=1
else:
print("... |
987,514 | 758bfadb9493f24596827c70c9f0bce4d0e0fcf4 | import programs.schema.table_building.tablebuilder as tablebuilder
from programs.schema.schemas.schemamaker import SchemaMaker
from constants import CC
import numpy as np
import pandas as pd
import das_utils
import programs.cenrace as cenrace
def getTableDict():
tabledict = {
##############################... |
987,515 | c1c4b75a7c2b6c46fbdf4402a50a4d5a3b68bbba | from django.shortcuts import render
from rest_framework.response import Response
from rest_framework.decorators import api_view
from rest_framework import status
from .models import Team, Game
from .serializers import *
from datetime import datetime
import json
@api_view(['GET'])
def teams(request):
data = Team... |
987,516 | 5dccd30c116e98893cc36fc2df0a62843fac21c2 | from pathlib import Path
import logging
import torch
from torch.autograd import Variable
from gammago.model import BaseModel, TorchModel
from gammago.commands import argument
# Arguments can be added using the "argument" annotation
# whose parameters follow the argpase.ArgumentParser.add_argument
@argument("--hidde... |
987,517 | 9d6de4ef6d93ba53e72b2acdb4b751171b47e6b2 | from translate import Translator
translator = Translator(to_lang="ja")
try:
with open('./test.txt', mode='r') as my_file:
text = my_file.read()
translation = translator.translate(text)
with open('./test=py.txt', mode="w") as my_file_ja:
my_file_ja.write(translation)
except File... |
987,518 | 525564c2b98178c0021db13c1621b37de88910cb | n=int (input())
a,b=(input().split())
a,b= [int(a),int(b)]
if((n>a)and(n<b)):
print('yes')
else:
print('no')
|
987,519 | 417560f6e78ada58f1ca5b26fbce6fec22546c06 | from datetime import datetime
class Patient(object):
num_pat = 0
def __init__(self,pat_name, pat_allergies,):
self.id = Patient.num_pat
self.pat_name = pat_name
self.pat_allergies = pat_allergies
self.pat_bed = 0
Patient.num_pat += 1
def display(self):
print ... |
987,520 | fcb1bce973b60c6ac64674a510718ffe058f2374 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: protocol/Proto/Platform.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import descriptor_pb2
# @@protoc_insertion_... |
987,521 | c4f26820ff3d3a279a53e0e8be94dc8b40f591fe |
# 银行操作
# 开户,查询,存款,取款,转账,改密,锁卡,解锁,补卡,销户
from cards import Card
from users import User
import random
import pickle
import os
class Bank:
def __init__(self):
pass
self.users = [] # 当前银行系统的所有用户
self.file_path = 'users.txt' # 本地文件路径
# 启动银行系统后,立刻获取user.txt文件中保存的所有用户
self.__get_... |
987,522 | ae0ecdaad6f3f9cf9701aa14dd39cdf162d49465 | import urllib
from time import sleep
from ConnectMongoDB import MyMongoDB
from ConnectToElasticSearch import ConnectToElasticSearch
import requests
from bs4 import BeautifulSoup
class BaiduSpider(object):
def __init__(self, keyword):
self.keyword = keyword
self.connection = ConnectToElasticSearch(... |
987,523 | b7aa5bb093eecd4115575b3c1cb600cca620fd02 | # -*- coding: utf-8 -*-
"""Hate Speech Detection Task - BERTweet.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1njB3qP4fB79EDY9QUajmbfPlAcPCkIAF
# Fine-Tuning BERTweet on the Hate Speech Detection Task
## Loading Libraries and Dataset
Install... |
987,524 | 0d2d258e74f2c6dce63cffcf897ec46e178e0dc0 | Product Id : 45660022
Max Video Resolution : 3840x2160 resolution
Image Sensor : 8 megapixels
Video Modes : 4k, 1080p, 720p
Video Features : Auto Track and Zoom, HDR, H.264 and H.265 Encoding
Lens Field of View : 180 degree diagonal
Sensor Size : 1/2"
Spotlight : 6500K, 42Lux @1M
Motion Detection : Dual Motion Detec... |
987,525 | 8db06ee4a310879971de2a802b73db993297b816 | from . import g2p |
987,526 | 456374e87a0b790a8b0323e2e595a5a8999685c5 | import socket
from time import time
sock = socket.socket()
sock.connect(('localhost',8080))
t0 = time()
for _ in range(1000):
sock.send(bytes('test msg',encoding='utf-8'))
sock.recv(99)
print('time cost',time()-t0)
sock.close() |
987,527 | 33856452dba93b24a208e3d3677795915ba661c8 | '''
4.
다중상속을 이용하여 카드사의 클래스를 만들고
영화카드는 20% 할인
마트카드는 10% 할인
교통은 10%할인을 받는 카드 class를 구현하시오
테스트코드
<입력>
multi_card=Multi_card()
multi_card.charge(20000)
multi_card.consume(5000,'마트')
multi_card.consume(10000,'영화관')
multi_card.consume(2000,'교통')
multi_card.print()
<출력>
카드가 발급 되었습니다.
20000이 충전되었습니다.
마트에... |
987,528 | e760c40c14b8ab3a3581249c81592d4d146bffd1 | # __slots__
# class Student:
# __slots__ = ('name', 'age')
# st = Student()
# st.name = 'mzw'
# print(st.name) # mzw
# st.age = 21
# print(st.age) # 21
# st.score = 100 # 'Student' object has no attribute 'score'
# print(st.score)
# @property
# class Student:
# def __init__(self):
# self._name = 'no name'
# ... |
987,529 | 3535433ed53d1bc79a7f050c2b28557e101ae6b2 |
# can be used by all
cellLines = ["BT20", "MCF7", "UACC812", "BT549"]
ligands = ["EGF", "HGF", "FGF1", "IGF1", "Insulin", "NRG1", "PBS", "Serum"]
metadata = {
'sc1a': {"true_synapse_id": "syn1971278"},
'sc1b': {},
'sc2a': {},
'sc2b': {},
}
import commons
import scoring
from scoring import ... |
987,530 | 593cdd52ae28a40521065df7d014d8e55ef86f55 | import sys
import string
def wordcount():
#file = open("pg600.txt")
# Try to open the file.
file = open(str(sys.argv[1]))
total_number_of_words = 0
words_dict = {}
for line in file:
wordlist = line.split()
for word in wordlist:
clean_word = word.translate(None, string.punctuation).lower()
to... |
987,531 | 4c532ff793842f347f7959dd6078a41465f7bd1d | # 두개의 수를 입력받아 사칙 연산 출력하는 함수
def calc():
a, b = input().split(' ')
a = float(a)
b = float(b)
print(int(a+b))
print(int(a-b))
print(int(a*b))
print(int(a//b))
print(int(a % b))
print(round(a/b, 2))
calc()
|
987,532 | 3b3a71133deba892fb5ef205c6f5be6e8504f5eb | # coding: utf-8
import sys
import time
try:
x = input('Input :')
print(float(x))
except:
print("Error! This application has stopped.")
sys.exit()
y = input('keep calcurating → 0 , exit → 1:')
while y == 0:
try:
x = input('Input :')
print(float(x))
except:
print("Error! Th... |
987,533 | 68a7390daa3a3d5858ac052b567f9c8e035f75d8 | # -*- coding: utf-8 -*-
'''
Author: Andre Pacheco
E-mail: pacheco.comp@gmail.com
This class implements the Kernel Extreme Learning Machine (ELM) according to:
[1] Huang, Guang-Bin, et al. "Extreme learning machine for regression and multiclass
classification." IEEE Transactions on Systems, Man, and Cybernetics,
Part... |
987,534 | 0721bf78e960e16d455b14f0b715f12a320ca003 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from n0ted0wn.Block.Parser.Base import Base
from n0ted0wn.Block.Parser.StdEnv import StdEnv
class UnorderedList(Base):
"""
Implements parsing for the following block format.
* Item 1
* Item 2
* Item 3
"""
def __init__(self, raw, parsed_blocks_list, style_... |
987,535 | 25f2022ee7f617b26b566c34b608bb9e8c41bc04 | import pandas as pd
from tqdm.auto import tqdm
zipcode_interconnector = pd.read_csv('zipcode_interconnector_connection.csv' , header = 0, index_col = 0, sep = ',')
zipcode_coordinates = pd.read_csv('filtered_storageSystems_mapped.csv', header = 0 ,index_col = None, sep = ',')
interconnector_coordinates = pd.read_... |
987,536 | 046af17d428a6e09ddc9851ba3e4a420046b2557 | expr = exp(pi*I*2*(x+y))
assumption = Q.integer(x) & Q.integer(y)
expr = refine(expr, assumption) |
987,537 | 13ea20f101be689345bf7f8a3d4d2061b2a4f737 | import uvicorn
from app.main import app
if __name__ == "__main__":
uvicorn.run(app, host="127.0.0.1", port=8000)
|
987,538 | ba5d7cdbe5c106ec7cf739f2c0de624e5864a382 | #!/usr/bin/env python
'''
temperature from planck's equation to RGB values
'''
from math import log, e
import matplotlib.pyplot as plt
from scipy.constants import c,h, k
def planck(wavelenght, T):
wvl=wavelenght*1e-9
B=2*h*(c**2)/((wvl**5)*(e**(h*c/(wvl*k*T))-1))
return B #if B*1e-12 units kW·str-1·m-2·nm-1 else ... |
987,539 | ebe5e264b5721a7d49758ff109378b2e8e16b95e | #! /usr/local/bin/python3.4
f = open("report 69069-29232.txt",'r')
#cont = f.read()
#print cont
c = 0
for lines in f:
if c == 0 or c==1:
c = c+1
continue
else:
#print lines
cnt = lines.split()
print cnt
print cnt[0]
print cnt[1]
print cnt[2]
... |
987,540 | 44c0c352058fd901d42b802a6287108de5922257 | import pygame
import os
from pygame import *
import pyganim
import blocks
import player
WIN_WIDTH = 1280
WIN_HEIGHT = 720
DISPLAY = (WIN_WIDTH, WIN_HEIGHT)
BACKGROUND_COLOR = "#00a693"
PLATFORM_WIDTH = 64
PLATFORM_HEIGHT = 64
COIN1 = COIN2 = COIN3 = COIN4 = COIN5 = COIN6 = COIN7 = COIN8 = COIN9 = None
COINS = 0
BUTT... |
987,541 | 71beb5c923039915964c8fea2ed360ebf445aedd | from calculator import add
def test_add():
# BDD
# Given
a = 5
b = 6
# When
result = add(a, b)
# Then
assert result == 11
def test_add_simple():
assert add(5, 6) == 11
|
987,542 | 643f3ab701e1566d10d6893dcf90b87ba7b3fc5e | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^interim_intentions$', views.InterimIntentionsView.as_view(), name='interim_intentions'),
url(r'^interim_intentions_admin$', views.InterimIntentionsAdminView.as_view(), name='interim_intentions_admin'),
url(r'^ta_view$', views.InterimInte... |
987,543 | a7435ee9133286a20f49302de7e02ed887396a25 | from django.urls import path
from .views import UrlList, UrlCreate, UrlRedirect
from scripts.remove_urls import remove_url
urlpatterns = [
path("url/", UrlList.as_view(), name="list"),
path("url/create/", UrlCreate.as_view(), name="create"),
path("url/<name>/", UrlRedirect.as_view(), name="retrive"),
]
re... |
987,544 | 1a4c018b1360b051be3544827cc7f01984d0ec61 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from collections import namedtuple
INITIAL_START_TIME = '0001-01-01T00:00:00Z'
STATE_ABSENT = 'absent' # Does not exist.
STATE_PRESENT = 'present' # Exists but is not running.
STATE_RUNNING = 'running' # Exists and is running.
STATE_FLAG_INITI... |
987,545 | b7bb2a579af72cb19047e53cb83e580c5fba03cb | class Connection:
"""Contains the details required to connect to a RMQ broker: the amqp uri and the exchange"""
def __init__(self, amqp_uri: str, exchange: str, exchange_type: str = "direct", is_durable: bool = False, connect_timeout: int = 30, heartbeat: int = 30) -> None:
self._amqp_uri = amqp_uri
... |
987,546 | 7077dca18599aad7cc4beb3cec2e57a6c0dc5f5e | __author__ = 'PyBeaner'
from random import sample
coefficients = sample(range(10), 2)
# O(n)
def horner_rule(x):
y = 0
for i in range(len(coefficients) - 1):
y = coefficients[i + 1] * x + coefficients[i]
return y
# O(n^2)
def normal(x):
y = 0
for i in range(len(coefficients)):
y... |
987,547 | 52e9a15f60f9db70970bfa7a24e13f8b48502869 | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 15 21:54:13 2016
@author: Rohan Koodli
"""
def encoding_test(sequence):
encoded = []
for i in sequence: #turns base pairs into numbers
if i == 'A':
encoded.append('1')
if i == 'T':
encoded.append('2')
if i == 'G':
... |
987,548 | b4c62150a57967ffcfcf362cfccd757236f153c9 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import tensorflow as tf
tf.compat.v1.enable_eager_execution()
import numpy as np
from ray.rllib.examples.env.rock_paper_scissors import RockPaperScissors
from ray.rllib.agents.ppo import PPOTrainer
from ray.tune.logger import pretty_print
from ray.rllib.agents.ppo.ppo_t... |
987,549 | de49c24276c353da0830d407113ade79ddc251db | # MongoDB Writer module
from pymongo import MongoClient
from bson.objectid import ObjectId
from nltk_ext.pipelines.pipeline_module import PipelineModule
# Item pipeline to write the item to a MongoDB store
class MongoWriter(PipelineModule):
"""
Initialize a MongoWriter object for a pipeline
If the operatio... |
987,550 | 1e4ba614cfcf2f28d554fec5f642de81f1552a7c | from django.shortcuts import render
from django.shortcuts import redirect
from django.shortcuts import HttpResponse
from app01 import models
# Create your views here.
from django.views import View
from day04 import settings
import os,sys
import zipfile
DOWN=os.path.join(settings.BASE_DIR,"down")
file_name=os.path.join... |
987,551 | 6f965100bdad157a90cb98f16e86d0dc460048e4 | #!/usr/bin/env python
"""
fusion_report_referrals.py
Author: Seemu Ali
Created: 10.06.2020
Version: 0.0.2
"""
import numpy as np
import pandas as pd
import sys
import os
sample_dir=sys.argv[1]
panel_dir=sys.argv[2]
sampleId=sys.argv[3]
tool_output =[ "StarFusion", "Arriba", "ArribaDiscarded", ]
referrals = ["Ly... |
987,552 | 63d353d98a8ebba0b80ef2a93f2c00bd6b3b4489 | from django.contrib import admin
from . import models
@admin.register(models.Post)
class AuthorAdmin(admin.ModelAdmin):
list_display = ('place', 'id', 'author')
@admin.register(models.Review)
class AuthorAdmin(admin.ModelAdmin):
list_display = ('guide', 'id', 'author')
admin.site.register(models.Contact)
|
987,553 | 0902c76ca45e34f22d5db3a4b38bc2caf08f74cd | """__init__.py
Localizer package initializer
"""
from .ekf_slam import EKF_SLAM
from .ekf_slam import * |
987,554 | 1176c7ab66f080302bb7aa8225fa56c7ea8f568e | from tkinter import *
from os import walk
window = Tk()
window.geometry("875x500")
class ItemClass:
def __init__(self, name, cost):
self.name = name
self.cost = int(float(cost))
self.quantity = Entry(window)
self.quantity.place(x=X_loc + 550, y=Y_loc + 35)
def printItem(self)... |
987,555 | f4597c8a34543f96eb5140b0605383c25b472fb5 | import turtle
mario = turtle.Turtle()
luigi = turtle.Turtle()
koopa = turtle.Turtle()
khide = koopa.color("snow4")
def spire(i):
for i in range (i):
mario.forward(i)
mario.right(270)
mario.forward(i+50)
mario.right(270)
mario.forward(i)
mario.right(270)
... |
987,556 | 5a2ca57d8b5fa48a5c28349fec53b41a095e809d | # coding:utf-8
from __future__ import absolute_import, unicode_literals
from celery import Celery
from django.conf import settings
import os
# 获取当前文件夹名,即为该Django的项目名
project_name = os.path.split(os.path.abspath('.'))[-1]
project_settings = '%s.settings' % project_name
# 设置环境变量
os.environ.setdefault('DJANGO_SETTINGS_... |
987,557 | 5353efb6ce3889645bc8d8bdc69e3d371b2656ad | '''Дані про температуру води на Чорноморському узбережжі за декаду
вересня зберігаються в масиві. Визначити, скільки за цей час було днів, придатних для
купання.
Bиконал Пахомов Олександр 122-А'''
import numpy as np
a=np.zeros(10, dtype= int)
c=0
for i in range(10):
a[i]= int(input('temperatura:'))
if ... |
987,558 | 6be69fa0234ab46aac1077846de11650d97ac683 | a=1000
print("hello")
print("dfsdf")
b=2000
print(a+b)
|
987,559 | b469c3f77e20ac19a61914de18c84fe08dde5646 | # Generated by Django 2.2.6 on 2019-10-28 18:23
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('company_service', '0041_availability_state'),
]
operations = [
migrations.RemoveField(
model_name='productionline',
name='tu... |
987,560 | ace90aedfa398eb4c5f261d1e775461cdab3fa69 | #!/usr/bin/env python
''' The Census Transform
Scan an 8 bit greyscale image with a 3x3 window
At each scan position create an 8 bit number by comparing the value
of the centre pixel in the 3x3 window with that of its 8 neighbours.
The bit is set to 1 if the outer pixel >= the ... |
987,561 | aa166dfc3ff65b4bc10fe385e0e33d40a28a6f78 | import ast
import pandas as pd
import requests
import json
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
from . models import NerSample
def create_ner_samples_from_csv(file, text_col='text', ent_col='entities'):
df = pd.read_csv(file)
df['di... |
987,562 | cba8573373a316245d6daf9f26f44418ef7bd056 | __author__ = 'magic'
from model.contact import Contact
import random
import string, re
import os.path
import jsonpickle
import getopt, sys
try:
opts, args = getopt.getopt(sys.argv[1:], "n:f:", ["number of contacts", "file"])
except getopt.GetoptError as err:
getopt.usage()
sys.exit(2)
n = 5
f = "data/cont... |
987,563 | 1afc875fc7b6b976cb484b33fbb0b5db8644631f | import pickle
import matplotlib.pyplot as plt
import numpy as np
import os
import cv2
import keras
from PIL import Image
from keras.models import load_model
def get_label_dict():
f = open('./b_label', 'rb')
label_dict = pickle.load(f)
f.close()
return label_dict
lang_chars = get_lab... |
987,564 | 6b7cc4f22bf1a013d85e4768dc9e7437cf03bdfc | from tkinter import *
import networkx as nwx, matplotlib.pyplot as plt
import Create_matrix
def created_graph(event):
graf1 = nwx.Graph()
edges = []
for i in Create_matrix.value:
edges.append(i[:2])
for i in edges:
graf1.add_nodes_from(i)
for i in edges:
graf1.... |
987,565 | ea410523bae8e3750b0cbbcbebd7f2f4589bfed9 |
def cara_coroa(resultado):
john = 0
mary = 0
for e in resultado:
if e == '1':
john += 1
elif e == '0':
mary += 1
return "Mary won %d times and John won %d times" %(mary,john)
while True:
jogadas = int(raw_input())
if jogadas == 0:
break
... |
987,566 | d77bd82db1dc7984117c90310398c089420da274 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
##Librerias necesarias para usar PyQt
from PyQt5.QtWidgets import QWidget, QFileDialog,QFileDialog,QMessageBox,QMainWindow, QApplication, QWidget, QAction, QTableWidget,QTableWidgetItem,QVBoxLayout, QPushButton,QHBoxLayout,QDialog
from PyQt5 import uic
from PyQt5.QtGui i... |
987,567 | 3839390505f7ce50f55db0066b798ba3f6007f35 | """
Auto-generated File
Create Time: 2019-12-27 02:33:27
"""
from .ROMEnum_Autogen import *
from renix_py_api.renix_common_api import *
from renix_py_api import rom_manager
from .ROMObject_Autogen import ROMObject
@rom_manager.rom
class HttpResponse(ROMObject):
def __init__(self, Code=None, Reason=None, Mime=Non... |
987,568 | 8558e45bb0beebbc56463f07060cf6c229a8cd8b | def rotate_left(s, n):
return s[n:] + s[:n]
def rotate_right(s, n):
return s[-n:] + s[:-n]
if __name__ == '__main__':
assert rotate_left(['a', 'b', 'c', 'd'], 2) == ['c', 'd', 'a', 'b']
assert rotate_left(['a', 'b', 'c', 'd'], 3) == ['d', 'a', 'b', 'c'] |
987,569 | a78f1d9bbaa2393f009ea0741391f52ba9f68a6d | # coding: utf-8
from django.shortcuts import render
from django.http import HttpResponse
from .forms import AddForm
# Create your views here.
def index(request):
if request.method == 'POST':
form = AddForm(request.POST)
if form.is_valid():
a = form.cleaned_data['a']
b = form... |
987,570 | 47be75b5cbd9b3131f6a1816ba8cef0c4b8946ea | import os
from rest_framework import serializers
from gestion.models.category import Category
from gestion.serializers.subCategorySerializer import SubCategorySerializer
class CategorySerializer(serializers.ModelSerializer):
subCategories = SubCategorySerializer(many=True, required=False)
class Me... |
987,571 | 541f17d1fc1be63a45b756156a93be43c1190f83 | from datetime import date
corrente = date.today().year
nascimento = int(input('Ano de nascimento: '))
idade = corrente - nascimento
print('Quem nasceu em {} tem {} anos em {}.'.format(nascimento, idade, corrente))
if idade > 18:
saldo = idade - 18
print('Você já deveria ter se alistado há {} anos, pois seu al... |
987,572 | d918b70397a31c5defe1f758e47b79737218c679 | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 27 19:23:41 2018
@author: alber
"""
import os
import glob
import pandas as pd
import re
import numpy as np
import pickle
from nltk.corpus import stopwords
from nltk.stem import SnowballStemmer
from sklearn.preprocessing import LabelEncoder, OneHotEncoder
from sklearn.u... |
987,573 | 06a900a0d910c4a30645f94f7b87c74cd2869b2d | class Vehicle:
def __init__(self, make, model, year, color):
self.make = make
self.model = model
self.year = year
self.color = color
def __str__(self):
return "Make: %s, Model: %s, Year: %d, Color: %s" % (self.make, self.model, self.year, self.color)
def wheels(self... |
987,574 | abc2221e62410c0a319dace738e08150202c5bfd | from keras.models import Sequential
from keras.layers import Dense, Dropout
from sklearn.feature_extraction import DictVectorizer
import numpy
import pandas as pd
from pandas import DataFrame
from sklearn.utils import shuffle
import numpy as np
from functools import *
from itertools import chain
from keras import optim... |
987,575 | a0675277abff7cd9b34878a07001a44832d884c0 | """
pyFF is a SAML metadata aggregator.
"""
import sys
import getopt
import pkg_resources
from pyff.mdrepo import MDRepository
from pyff.pipes import plumbing
import traceback
import logging
__version__ = pkg_resources.require("pyFF")[0].version
def main():
"""
The main entrypoint for the pyFF cmdline tool.... |
987,576 | c159cd27b6a49df4cbc0f11ab1e3d7507b37a19b | #!/usr/bin/python
import docker
import sys
def runContainerById2(name,ip):
client=docker.from_env()
print(str(client))
container=client.containers.run(name,detach=True)
# myNet=client.networks.get('8cc234f12ebe')
# myNet.connect(container.short_id,ipv4_address=ip)
# print('ceshi')
def restartContai... |
987,577 | b8483392df4d0b1b24a71f5037160b2f5e6dedaa | import io
import os
import re
import sys
from setuptools import find_packages, setup
here = os.path.abspath(os.path.dirname(__file__))
def read(*parts):
with io.open(os.path.join(here, *parts), encoding="utf-8") as fp:
return fp.read()
def find_version(*file_paths):
version_file = read(*file_paths... |
987,578 | 5ae6d17993ff63b8514dbfa9e7a70b7ca1c0e642 | n= int(input('Enter the number you would like to know the factors for...'))
#n = int(input())
a=0
for z in range (0, n):
a=a+1
if n % a == 0:
c= int(n / a)
print(a, 'times', c, 'equals', n)
continue
else:
continue
# trying for prime factorization
x= a
y= c
... |
987,579 | f69583d1c3fc06038aa1a3852fd7599e8c5597c7 | #!/usr/bin/env python3
#
# Author: Coleman Kane <ckane@colemankane.org>
# This module will run "exiftool" against an artifact and will
# write results into a file named exiftool_output.csv
#
import sqlite3
import os
from subprocess import Popen, DEVNULL, PIPE
from ztasks.base_zooqdb_task import base_zooqdb_task
class... |
987,580 | 7a0fbf68746211e6b1de51d01566a6cc44d058f5 | # Python Program for recursive binary search.
# Returns index of x in arr if present, else -1
def binarySearch(arr, l, r, x):
# Check base case
if r >= l:
mid = l + (r - l) // 2
# If element is present at the middle itself
if arr[mid] == x:
return mid
# If ele... |
987,581 | 72856e26e8211d05c3a9ffd9eb80c469b8ec9eef | ,intensity,wavelength
0,1501.0,339.0737609863281
1,1501.0,339.52578573642876
2,1498.0,339.9778577243427
3,1501.0,340.42997693034937
4,1502.0,340.8821433347282
5,1503.0,341.3343569177587
6,1495.0,341.78661765972026
7,1499.0,342.2389255408923
8,1502.0,342.6912805415543
9,1500.0,343.14368264198566
10,1501.0,343... |
987,582 | 745075872567b5920841dc2c6a3da8b66f367988 | ### Boas Pucker ###
### bpucker@cebitec.uni-bielefeld.de ###
### v0.15 ###
### based on https://doi.org/10.1371/journal.pone.0164321 ###
__usage__ = """
python genome_wide_variants.py
--vcf <FULL_PATH_TO_INPUT_VCF>
--out <FULL_PATH_TO_OUTPUT_DIR>
optional:
--res <INT, RESOLUTION>[100000... |
987,583 | d95bfd14c65bda57d4bf74a18120f7e943dcb3c0 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-04-12 21:21
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('solicitudes', '0026_auto_20170412_1530'),
]
operations = [
migrations.Remov... |
987,584 | 2cd2febd4b9cf0ec993bf0b6e88940efefb5aca3 | from django.test import TestCase, Client
from models import CatModel
class CatModelTest(TestCase):
def setUp(self):
self.cat_a = CatModel(
name="A",
length=10,
width=20,
height=30
)
self.cat_a.save()
def test_get_volume(self):
... |
987,585 | 064ef4db62144b66246d4a0ce649152a182f4334 | """
Django settings for DjangoProject project.
Generated by 'django-admin startproject' using Django 1.8.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Buil... |
987,586 | ee82d336b3a006d273beded0782517483b0e2043 | from flax import linen as nn
from functools import partial
from survae.transforms.surjective import Surjective
from survae.distributions import *
from typing import Any
import jax.numpy as jnp
from jax import random
import numpy as np
class VariationalDequantization(nn.Module,Surjective):
"""
Note: it is very ... |
987,587 | 92ff7b1b5634a778cda99f72e4cfdc7df32fe65d | from __future__ import print_function
from twitchstream.outputvideo import TwitchOutputStreamRepeater
from twitchstream.chat import TwitchChatStream
import argparse
import time
import numpy as np
if __name__ == "__main__":
parser = argparse.ArgumentParser(description=__doc__)
required = parser.add_argument_gro... |
987,588 | 37ce2c4de619e64523a032d2ee76c82779fcd4a7 | import db
async def validate_form(conn, form):
name = form['name']
city = form['city']
age = form['age']
if not name:
return 'name is required'
if not city:
return 'city is required'
if not age:
return 'age is required'
else:
return None
return 'error' |
987,589 | 5bda98a4a3109dcf5c01777620616251309a36b0 | try:
rf = open(r'D:\Viknesh Ramm\Python Programs\Assignments\Day-6\readfile.txt','r')
wr = open(r'D:\Viknesh Ramm\Python Programs\Assignments\Day-6\writefile.txt','w')
wline = []
lno = 1
for line in rf:
li = str(lno)+":"+line.strip()+"\n"
print li
wr.write(li)
lno += ... |
987,590 | 60aa8f2ca9cb24c42eeacb8d12c179e80dd32bc2 | import pandas as pandas
idlist = pd.read_excel("DataFile.xlsx", 'json_clean', index = False)
info = pd.read_excel("DataFile.xlsx", 'csv_clean', index = False)
all_data_st = pd.merge(idlist, info, how='left')
all_data_st.to_excel('DataFile.xlsx', sheet_name='processed', index = False)
print("Finished!")
|
987,591 | 032a962c414d0f41311dddf4f7d6aa095abf8d25 | import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from typing import List
sender = "ecinemaBookingWebsite@gmail.com"
password = "4050Project"
def send_email(email: str, sub: str, message: str):
receivers = email
subject = sub
msg = MIMEMultipart()
msg... |
987,592 | 7098055c33dff0b20d1694ec4bdc5713ba875a83 | from rest_framework import viewsets, generics
from django.contrib.auth.models import User
from .models import Comment
from django.shortcuts import get_object_or_404
from .serializers import CommentSerializer
class CommentList(generics.ListCreateAPIView):
queryset = Comment.objects.all()
serializer_class = Com... |
987,593 | deb03fed74e27d3746319d369cb0149fd8706c10 | # -*- coding: utf-8 -*-
import inspect
import datetime
import time
from qgis.PyQt import QtCore
from PyQt5.QtWidgets import QTableView, QHeaderView, QApplication
from PyQt5.QtCore import Qt , QAbstractTableModel
from psCom.PsCom import log
from abc import abstractmethod
from PyQt5.Qt import QBrush
from psModel.PsC... |
987,594 | 6b11134523d80de2fbed7898196fce038f47beb8 |
<!DOCTYPE html>
<html id="Stencil" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=0"/>
<meta name="format-detection" content="telephone=no">
<meta name="referrer" content="origin-when-cross-origin">
... |
987,595 | 294f195dee6475c50db20c4b4416afc75b407663 | '''
Created on Aug 27, 2017
@author: arnon
'''
import concepts.sshtypes as sshtypes
import pickle
import sys
import struct
import os
import logging
logger = logging.getLogger(__name__)
while True:
logger.debug("Trying to read stdin.")
try:
msgsize_raw = sys.stdin.buffer.read(4)
msgsize = str... |
987,596 | 7c18b54b0428cc53697285a479d80a8b961db673 | # Generated by Django 2.1.7 on 2019-04-15 17:34
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('codemg', '0007_auto_20190415_1457'),
]
operations = [
migrations.AddField(
model_name='code',
name='... |
987,597 | 9dc6c0c92aab4a931722fc8b8252dada9bf4b9b7 | import re
import HTMLParser
import NLPlib
import sys
import csv
def elimate_ord(s):
if ord(s) < 128:
return s
else:
return ''
def twtt1(s):
return re.sub(r'<.*?>', '', s)
def twtt2(s):
'''
http://stackoverflow.com/questions/275174/how-do-i-perform-html-decoding-encoding-using-python-django
http://stackov... |
987,598 | e31283c7c95d187ecda89d2533516b36b4de45a2 | import requests
import json
r=requests.get("http://www.baidu.com")
print(r.status_code)
print(r.url)
print(r.text)
r1=json.loads(r.text)
print(r.content)
print(r.cookies)
I = ['iplaypython', [1, 2, 3], {'name':'xiaoming'}]
encoded_json = json.dumps(I)
print (type(encoded_json))
print (repr(I))
print (json.dumps(encode... |
987,599 | d28c4ae064850dd277a2ed0bcb58da11a202035c | from typing import Tuple
from flasgger import swag_from
from flask import jsonify, request
from flask.wrappers import Response
from app.extensions.swagger.builder import doc_build
from app.http.api import api
from app.http.api.v1 import version_prefix
from app.http.responses import build_response
from app.http.respon... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.