index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
996,100 | b3a71432e52c46031eb92b0ce55955d09b59b760 | import argparse
import string
from pyfasta import Fasta
from odetta.gff.feature import Feature
from odetta.gff.tree import build_tree
parser = argparse.ArgumentParser(description='TODO')
parser.add_argument('genome', help='TODO')
parser.add_argument('gff')
complements = string.maketrans('ATCGN', 'TAGCN')
def rev... |
996,101 | 6e1acaa13b9cb88015a3ca9ed7e47fa4653f49fa | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun May 7 16:49:32 2017
@author: hxr
"""
from pyspark import SparkContext
import re
# remove any non-words and split lines into separate words
# finally, convert all words to lowercase
def splitter(line):
line = re.sub(r'^\W+|\W+$', '', line)
ret... |
996,102 | 19b8bc2291df76bf22ac7b25d21bdba1c08aa0a2 | from django.contrib.auth.decorators import login_required,user_passes_test,permission_required
from forms import *
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.shortcuts import render_to_response,redirect,get_object_or_404
from django.template import RequestContext
from django.co... |
996,103 | 4f8d19cf6629c6b33875a0d9a1ded9cb7eb94bca | import plotly.graph_objects as go
fig = go.Figure(
go.Waterfall(
name="2018",
orientation="h",
measure=[
"relative",
"relative",
"relative",
"relative",
"relative",
"relative",
"relative",
],
... |
996,104 | e005a42e0a66c4b1421a009fc0c8f8ac6a1e846d | import atexit
import ssl
import json
import requests
from pyVim import connect
from pyVmomi import vim, vmodl
from argparse import ArgumentParser
import os
from com.vmware.vapi.std_client import DynamicID
from vmware.vapi.vsphere.client import create_vsphere_client
class HostList:
def __init__(self, output_fil... |
996,105 | bd51b057e248b5ee6fd9d4c0b3185e703e341b7a | import torch.nn as nn
import torch.nn.functional as F
import torch
import numpy as np
from enum import IntEnum
class Action(IntEnum):
BUY = 0
SELL = 1
HOLD = 2
# You need to include any network definitions
class TraderNetwork(nn.Module):
def __init__(self, row_size):
super(Trader... |
996,106 | 6cf2fc79e7287ab6aa2ebf9f27c58381ac90f129 | # GENERATED BY KOMAND SDK - DO NOT EDIT
import insightconnect_plugin_runtime
import json
class Component:
DESCRIPTION = "Shows when a domain, IP or URL was given attribution of a particular security categorization or threat type (indicators of compromise)"
class Input:
NAME = "name"
class Output:
... |
996,107 | 0c4ed9168ea21210e069b7cc6be4068f57830339 |
f=open("registrationnumber")
fout=open("validregnum","w")
regnum=set()
for numbers in f:
regnum.add(numbers.rstrip("\n"))
from re import *
rule='KL\d{2}[A-Z]{1,2}\d{1,4}'
for vehiclenum in regnum:
matcher=fullmatch(rule,vehiclenum)
if matcher!=None:
fout.write(vehiclenum+"\n")
else:
... |
996,108 | 3d9f522b3ca7de476dcc4c1eb99257a80d433f92 | class Solution:
def longestSubsequence(self, num: List[int], diff: int) -> int:
ans = {}
for i in num:
ans[i] = ans.get(i - diff, 0) + 1
return max(ans.values())
|
996,109 | dd510799959e92cca747645259e1926cd0387ca7 | """
This module implements an TunnelController
Set encap/decap rules for ipv4/bier
"""
from libs.core.Log import Log
from libs.core.CLI import CLI
from libs.controller.BierController import BierComputation
from libs.GroupManager import GroupManager
from libs.core.Event import Event
from operator import ior
from libs.co... |
996,110 | 811866bb1a46c055559fe2ff3dec4ec01329d00f | # -*- coding: utf-8 -*-
# Django
from django.views import View
from django.shortcuts import render
# Third Parties
from rest_framework import viewsets
# Project
from entbook.companies.models import Company
from entbook.companies.serializers import CompanySerializer
class CompanyViewSet(viewsets.ModelViewSet):
qu... |
996,111 | 0af97e2f05394e685a8d2127479c913694d02c51 | from __future__ import unicode_literals
from django.db import models
from db.paranoia import ParanoidModel
class Post(ParanoidModel):
title = models.CharField(max_length=255)
description = models.CharField(max_length=500)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateT... |
996,112 | 25e1f9e98edf446090014b2cb7f633089b653f82 | '''
Collection of functions to test the stats functions
'''
from app.stats import ptest
from numpy.random import normal, uniform
import numpy as np
np.random.seed(42)
def _test_normality():
'''
Method to test the _check_normality function
'''
size = 100
dist = normal(loc = 0, scale = 1, size = s... |
996,113 | 9971bf3ae9c3307af31d7174703dea5dfd54e23c | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2019 EMBL - European Bioinformatics Institute
#
# 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/LICEN... |
996,114 | 0a39e3547f1ef16c32e7cabc44781ef6b833b258 | from keras.utils import to_categorical
import numpy as np
import os
import h5py
from matplotlib import pyplot as plt
from sklearn.preprocessing import MinMaxScaler
class Dataset_MedData:
def __init__(self, config):
self.config = config
self.create_data()
def create_data(self):
... |
996,115 | 9a4f6fbdbad7dc21852a890f7606c733fc693281 | #!/usr/bin/env python3
# a class that
import rospy
from my_robot_tutorial.srv import TurnCamera, TurnCameraResponse
import numpy as np
import os
import cv2
from cv_bridge import CvBridge
class TurnCameraClass:
"""TurnCameraClass ummary.
Attributes
----------
available_angles : type
Descriptio... |
996,116 | 4c07828e476bc9a8a5d40a0d822692acea37d451 | '''
Tweet_Collector
Collects tweets from the Twitter API using the StreamListener of the Tweepy library
Collected tweets are written to mongoDB
DB and API credentials are read from ./config.py people to follow are stored in ./infos.py
'''
import config
import infos
import pymongo
from tweepy import OAuthHandler, Stre... |
996,117 | 275ded3385a1bc619d5e60e92b974d7a7e2243ce | def add_tags(tag,word):
print("<%s>%s</%s>" %(tag, word, tag))
add_tags('i','Python')
add_tags('b','Python Tutorial') |
996,118 | bba7f9c03596d028c894871a0095ae942d2565b0 | """ SeismiPro is a library for seismic data processing. """
from setuptools import setup, find_packages
import re
with open('seismicpro/__init__.py', 'r') as f:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE).group(1)
setup(
name='SeismicPro',
packages=find_packages... |
996,119 | b2382ae9b0c8e9482f8a6d026108f29b58fd8524 | from django.http import HttpResponse,HttpResponseRedirect
from django.core.context_processors import csrf
from django.template import Context, loader
from django.shortcuts import render_to_response,render
from .forms import *
from .models import *
from django.contrib.auth import authenticate, login
from django.contrib.... |
996,120 | e6e77998d74fc5f60e65407436515d16b2b5a8a5 | import tensorflow as tf
if __name__ =='__main__':
a = tf.placeholder(tf.float32)
b = tf.placeholder(tf.float32)
adder_node = a + b
sess = tf.Session()
print(sess.run(adder_node, feed_dict = {a:3,b:4.5}))
print(sess.run(adder_node, feed_dict = {a:[1,3],b:[2,4]}))
|
996,121 | 87dbd162533d8b8971dd2f7b0606ce3d46cd64e4 | import bs4
from bs4 import BeautifulSoup
import requests
# this url does not work due to react
# URL = "https://www.empireonline.com/movies/features/best-movies-2/"
URL = "http://web.archive.org/web/20200322005914/https://www.empireonline.com/movies/features/best-movies-2/"
INPUT_FILENAME = "movies.html"
OUTPUT_FILENA... |
996,122 | 2aef7c34293d2dae222ef84c42510a55425544e8 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
996,123 | b9610f2720661f9717356596bc9bcbcffe3e98e7 | from shellcode import shellcode
from struct import pack
# EBP = 0xbffef238
ret_address = 0xbffef23c # EBP + 4
buf_address = 0xbffeea28
# 0x08048ef8 <+24>: lea -0x810(%ebp),%eax
# so buf_address: EBP - 0x810 = 0xbffeea28
# my_sc_code = '\x31\xc0' + '\xb0\x66' + '\x31\xdb' + '\xb3\x01' + '\x31\xc9' + \
# '\x51' +... |
996,124 | c64e4331650ff452777c2ba851a695fbc237a1a9 | num,lim=[int(x) for x in input().split()]
for val in range(num+1,lim):
if(val%2==0):
print(val)
|
996,125 | d2e1533850e3a7016f8a34a8e5cfbf1896446020 | from rest_framework import generics
from rest_framework.filters import SearchFilter
from service.serializers import MagazineDetailSerializer, MagazineListSerializer
from service.utils import MagazineMixin
class MagazineCreateView(MagazineMixin, generics.CreateAPIView):
serializer_class = MagazineDetailSerializer
... |
996,126 | 806354c669b65d85dbf14940974865663d570c4c | import requests, json
from application import app
def getWeChatInfoByCode(code):
url = "https://api.weixin.qq.com/sns/jscode2session?appid={0}&secret={1}&js_code={2}&grant_type=authorization_code" \
.format(app.config['MINA_APP']['appid'], app.config['MINA_APP']['appkey'], code)
r = requests.get(url)
... |
996,127 | 3ebf46a2af0fc212f5a223e080ae9d634b9ef8fd | '''
给定两个整数 n 和 k,返回 1 ... n 中所有可能的 k 个数的组合。
示例:
输入: n = 4, k = 2
输出:
[
[2,4],
[3,4],
[2,3],
[1,2],
[1,3],
[1,4],
]
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/combinations
'''
from itertools import combinations
class Solution:
def combine(self, n: int, k: int) -> List[List[int]]:
retu... |
996,128 | 04b54a3c6660b5e4659bd1dac8a9b534e052eb76 | def gen(l):
for li in l:
if type(li) == type('a'):
yield 'string'
elif type(li) == type(1):
yield 'numeric'
else:
yield 'uh..'
mylist = ['a', 1, 'b' ,12]
for li in gen(mylist):
print li
|
996,129 | d7fc92de8d08c84b36d5a2fc5f47240af29e213c | # -*- coding:utf-8 -*-
# Author: Golion
# Date: 2016.2
import sys
import web
web.config.debug = False
urls = (
'/(.*)', 'controller.Controller'
)
app = web.application(urls, globals(), autoreload=False)
application = app.wsgifunc()
|
996,130 | 8296e3bd015718ccda489d233735fa240d7bd62a | #!/usr/bin/python3
import urllib.request as urllib
import re
frm = "abcdefghijklmnopqrstuvwxyz"
to = "cdefghijklmnopqrstuvwxyzab"
trans_table = str.maketrans(frm,to)
useUrl = "http://www.pythonchallenge.com/pc/def/map.html"
data = urllib.urlopen(useUrl)
codec = data.info().get_param("charset","utf-8")
text = data.rea... |
996,131 | 9a336a0a88caf6b94548c0d0483e2d7d4b83717a | # -*- coding:utf-8 -*-
import datetime
from util.mysqlHelper import MysqlHelper
from config import config
from report import generate_report
db = MysqlHelper(config.db_ip, config.db_user, config.db_password, config.database, config.db_port)
class Model:
def __init__(self, table, amount, range_count, range_perc... |
996,132 | 0113680ddf4435c1e7f592de2813d457b19493f5 | # Generated by Django 2.1 on 2019-04-28 18:23
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
class Migration(migrations.Migration):
dependencies = [
('members', '0011_auto_20190427_0128'),
... |
996,133 | 8ff266731816df820a6a5b9821adc3c01cf79916 | import torch
import torch.nn as nn
class Generator(nn.Module):
def __init__(self, nz, ngf, nc, dropout_rate):
super(Generator, self).__init__()
self.main = nn.Sequential(
# input is Z, going into a convolution
nn.ConvTranspose2d(nz, ngf * 32, kernel_size=4, stride=1, paddin... |
996,134 | adc98f82256214a01e7232618700e837426585b5 | MMSEQS2 = config.get('MMSEQS2', 'mmseqs')
mmseqs2_base_all = expand('reports/{sample}.mmseqs2.{{db}}.tsv', sample=samples_all)
MMSEQS2_ALL = expand(mmseqs2_base_all, db=['nr', 'refseqc'])
rule mmseqs2_all:
input: MMSEQS2_ALL
MMSEQS2_FASTA_ALL = expand('reports/{sample}.mmseqs2.{db}.tsv', sample=samples_fasta, db... |
996,135 | 64f254d13d39f8c587cc82e7ad06198b4361a0a4 | ####################################################################
# #
# THIS FILE IS PART OF THE PyCollada LIBRARY SOURCE CODE. #
# USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS #
# GOVERNED BY A BSD-STYLE SOURCE LICENSE INC... |
996,136 | 3c98eab30e8eea90dbcc6fec12d34d558805983e | # import hashlib
#
# str_start = '123546'
# print(str_start.isdigit())
#
# import re
#
# start = 'av123456'
# print(re.search(r'^av(\d+)/*', start).group(1))
#
# title = '"U::::u/\ib?\\di*."<>|'
# print(re.sub(r'[\/\\:*?"<>|.]', '', title))
#
# entropy = 'rbMCKn@KuamXWlPMoJGsKcbiJKUfkPF_8dABscJntvqhRSETg'
# appkey, sec... |
996,137 | 43f5df5fea4dcda79c9ae33bb7212b6216786900 | from __future__ import print_function
from .common import IsolatedTestCase
from .. import (
ECentroidDoesNotExist,
ECentroidAlreadyExists
)
class TestCentroidCrud(IsolatedTestCase):
def test_centroid_creation_1(self):
self.client.create_centroid('centroid-1')
centroids = self.client.list_a... |
996,138 | 2e70ae92c432285dfd7cd3bdfc2f01e6498c64a0 | from random import choice
again = 1
total_guesses = 0
correct_guesses = 0
while int(again) > 0:
inpt = input("Input your prediction for the face of the dice\n")
otpt = choice(['1','2','3','4','5','6'])
print(otpt)
if (inpt == otpt):
print("You Guessed it Correctly")
total_guesses += 1
... |
996,139 | 9cecea3e1f4afb37ffc1efff6bb1ce3462e51942 | #!/usr/local/bin/python3
"""
Analyze PKZIP file contents
* scan entire file for PKxy headers
* do quick scan by locating EOF header
* can operate on .zip files from a http://URL
(C) 2016 Willem Hengeveld <itsme@xs4all.nl>
"""
from __future__ import division, print_function, absolute_import, unicode_literals
impo... |
996,140 | 632d44d0b4624b42f61953d1c08a7adcb74968cf | import threading
class H2O(object):
sema_h = threading.Semaphore
sema_o = threading.Semaphore
lock = threading.Lock
def __init__(self):
self.sema_h = threading.Semaphore(2)
self.sema_o = threading.Semaphore(0)
self.lock = threading.Lock()
def hydrogen(self, releaseHydrogen):
... |
996,141 | 1f12700b1abc97218bed3171ec9708c5d284243f | # Sprite classes for platform game
import pygame as pg
from settings import *
import random
vec = pg.math.Vector2
class Player(pg.sprite.Sprite):
def __init__(self, game, bird_sprites):
pg.sprite.Sprite.__init__(self)
self.game = game
self.bird_sprites = bird_sprites
... |
996,142 | 6d2fd7374e663bd98ba39ec80118f5c6fd96928e | '''
Created on 2016-08-11
@author: Sun Tianchen
'''
from PyQt4 import QtCore, QtGui
class ColorWidegt(QtGui.QWidget):
"""docstring for ColorWidegt"""
def __init__(self, parent=None):
'''
default values:
Pen:
Size:
Tense:
'''
QtGui.QWidget.__init__(self, parent=parent)
self.buttons = {}
self.gridLa... |
996,143 | 96c4ae9fe1ea9dc34a76fb5ed0c4b22c3446f54f | #!/usr/bin/env python3
import re
import csv
import operator
error_message={}
user_statistics={}
pattern_error=r"ERROR ([\w ]+)"
pattern_username=r"\(([\w.]+)\)"
with open("syslog.log") as f:
for line in f:
result_user=re.search(pattern_username,line)
result_user=str(result_user.group(1)).strip()
if "ERROR... |
996,144 | 8fc8aa0e1c56212f3c1fbfead75e11c7d663ab15 | # Written by Christian Abdelmassih, Alexandra Runhem
class Atom():
def __init__(self, name, weight):
self.name = name
self.weight = weight
class Hashtabell():
def __init__(self, length):
self.length=length*2
self.hash_table=[]
self.used_indexes = []
for i in range (0,self.length): #Hashtabell måste h... |
996,145 | 501eade2ad1dfc20040256e715a7db11e45632e2 | #coding:utf-8
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import urllib2
import psycopg2
# url = 'http://stock.finance.sina.com.cn/fundInfo/api/openapi.php/CaihuiFundInfoService.getNav?symbol=003803&page=2'
conn = psycopg2.connect("dbname=postgres user=postgres")
cur = conn.cursor()
cur.execute("CREATE TAB... |
996,146 | 2a834482daf86456d368a8470646fb2f9cce5d92 | l1=[5,20,15,20,25,50,20]
l2=[]
l3=[]
for i in range(len(l1)):
if(l1[i]!=20):
l2.append(l1[i])
print(l2)
''' else:
l3.append(l1[i])'''
|
996,147 | 1b2f78a6e0985a5f41eb8e6b1640c0f864be0133 | # -*- coding: utf-8 -*-
import random
import base64
import time,urllib,json
from redis import Redis
#from settings import PROXIES
class RandomUserAgent(object):
"""Randomly rotate user agents based on a list of predefined ones"""
def __init__(self, agents):
self.agents = agents
@classmethod
def from_cr... |
996,148 | 599be2b22dce3cc8dcc8962020b8dbd1645f6660 | from flask import Flask
from config import app_config
from flask_jwt_extended import JWTManager
from .db import create_tables
def create_app(config_name):
""" creates a flask instance according to config passed """
app = Flask(__name__)
app.config.from_object(app_config[config_name])
# versions of api... |
996,149 | 08f60e7c32d4ebf478eea0faebdd09007809a2d4 | from django.db import models
import datetime
from django.utils import timezone
# Create your models here.
class Category(models.Model):
category_name = models.CharField(max_length=20)
def __str__(self):
return self.category_name
class Shop(models.Model):
category = models.ForeignKey(Ca... |
996,150 | 50cf72c894426fa63405649aa0801bb2db91e60a | from flask import render_template, Flask
from util import findroot
import os
RPATH = findroot()
SPATH = os.path.join( RPATH, 'static' )
TPATH = os.path.join( RPATH, 'app', 'invre', 'templates' )
print( RPATH )
print( SPATH )
print( TPATH )
Wine = Flask(
__name__,
template_folder = TPATH,
static_folder ... |
996,151 | 8399f58f6fe4a128f89bc18c3eec6877d7731851 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 27 12:44:45 2020
@author: corkep
"""
#matplotlib inline
# line.set_data()
# text.set_position()
# quiver.set_offsets(), quiver.set_UVC()
# FancyArrow.set_xy()
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib ... |
996,152 | e6bed97d9f564056675d78a45f07c180c05cdcf5 | import re
import json
from openpyxl.styles import Font, colors, Alignment
import sys
import os
sys.path.append(os.getcwd() + '\\PortCommons')
import reg_class
''''
本class完成:
调用请求类发送请求并接受响应
根据响应结果进行判断是否正确
把执行结果保存到excel
'''
class InterfaceTest:
def interface_test(self, num, interface_name, method, form, full_url, d... |
996,153 | 7510172ab9dd4ef2448dc37287797abc96297741 | import netbox_agent.dmidecode as dmidecode
from netbox_agent.config import config
from netbox_agent.logging import logging # NOQA
from netbox_agent.vendors.dell import DellHost
from netbox_agent.vendors.generic import GenericHost
from netbox_agent.vendors.hp import HPHost
from netbox_agent.vendors.qct import QCTHost
f... |
996,154 | 4ef161653006fec18b3db89e0c988e6fa18d362a | import logging
logging.basicConfig(level=logging.DEBUG)
import sqlite3
from sqlite3 import Error
import datetime
import secrets
import bcrypt
idLength = 8
def dbConnect(dbFileName):
db = sqlite3.connect(dbFileName)
db.row_factory = sqlite3.Row
return db
def authenticate(dbFileName, channels):
db =... |
996,155 | d35bf22b54da5c4a84e533b429d196145548e76f | print("Hello from Jozef Marusak")
|
996,156 | 74bb97d972536ae193d7553fcd53654ed27a0c43 | # -*- coding: cp1252 -*-
import random
import copy
import itertools
import profile
materialType = ("Naked", "Woven Lint", "Hair", "Wax", "Cotton", "Wool", "Paper", "Egg Carton", "Cardboard",
"Soft Plastic", "Rodent Pelt", "Deer Pelt", "Snake Hide", "Wolf Pelt", "Buffalo Pelt", "Leather",
... |
996,157 | 50eae9bae36fa7af616c1f0bc161d5552204bc9b | # some future comment
from line_bot_app.constants import AcceptedUserTextMessages
import random
def get_quote_flex_message(quotesAndAuthors="", imageUrl="", quoteText="", quoteAuthor=""):
randomEntryInResponse = random.choice(quotesAndAuthors)
quoteText, quoteAuthor = randomEntryInResponse.get("text", ""), ... |
996,158 | 9eb704115981ed9d4b3cc829125d3721786c7c20 | #
# A simple webserver MEANT FOR TESTING based off of http.server.
#
import http.server
import socketserver
import os
from multiprocessing import Process
import generate
import yaml
from threading import Timer
# Credit: http://stackoverflow.com/a/13151299/6388442
class RepeatedTimer(object):
def __init__(self, in... |
996,159 | 84c8b818d48c3bc26af113552ba465ff53813035 | import random
print(f'0 <= r < 1 사이의 랜덤 실수: {random.random()}')
print(f'0~9까지 랜덤 정수: {int(random.random() * 10)}')
print(f'0~10까지 랜덤 정수: {int(random.random() * 10)+1}')
print(f'0~2까지 랜덤 정수: {int(random.random() * 10)%3}')
print(f'시작 <= r < 끝 랜덤 실수: {random.uniform(2.5 , 10.0)}')
print(f'0~9까지 랜덤 정수: {random.randrang... |
996,160 | 5c2d9e93686756b1dd62fdea6bc1c09c8c9dd908 | import os
import numpy as np
import pandas as pd
import scipy.sparse as sp
from scipy.interpolate import interp1d
import scipy.signal as signal
import multiprocess as mp
import cooler
import cooltools.snipping as snipping
from cooltools.lib.numutils import logbins
import bioframe
from mirnylib.numutils import zoomArr... |
996,161 | 2d2a164adb548781b4f27aa3e7e41d96e70e50f6 | from django.shortcuts import get_object_or_404
from rest_framework.generics import (
ListCreateAPIView, ListAPIView, DestroyAPIView
)
from rest_framework.permissions import IsAuthenticated
from accounts.models import User
from .models import Follow
from .serializers import FolloweeSerializer, FollowSerializer
c... |
996,162 | 5be9b3f252dbfe8d7deedcb5c04d6a746c93a9d0 | class Songs(object):
def __init__(self, lyrics):
self.lyrics = lyrics
def sing_a_song(self):
for line in self.lyrics:
print(line)
alphaand = Songs(["Reach into the nothingness",
"Consuming your sight"])
alphaand.sing_a_song()
mechanobiology = ["... |
996,163 | 8f9fcd0dc60ca40e69e708c66ee06267dbb3ebc9 |
import torchvision.transforms as transforms
class Augmentation:
def __init__(self):
self.transform = transforms.Compose([transforms.RandomHorizontalFlip(), transforms.ToTensor(), transforms.Normalize((0.4914, 0.4822, 0.4465), (0.247, 0.243, 0.261))])
def getTransform(self):
return self.transform |
996,164 | 83197baefd0261892befe9ee293a5bdbce4a68ce | # THIS IS FILE-1
def add(a,b,c):
return a+b+c
def subtract(a,b):
return a-b
#Multiply function deleted here
def remainder(a,b):
return a%b
def greater(a,b):
return a if a>b else b
|
996,165 | c020cbc99483f8207d9666810658c4c94d27a0bc | __version__ = "1.1.0"
default_app_config = "modoboa_demo.apps.DemoConfig"
|
996,166 | f52dc64e28679d82c144b8fbff34a63e71e70f74 | from django.apps import AppConfig
class QueryintentionConfig(AppConfig):
name = 'queryIntention'
|
996,167 | 4f29d707ddd0eee1bf8749f3a6d9b3dfa4d0a818 | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# 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... |
996,168 | f8a28ff6f6d74a7b778008d5354ef7c28c38e691 | # Keywords
# and: logical operator
# or: logical operator
# not: logical operator
# del: deletes an object
# import: allows you import a module
# from: import specific parts of a module
# while: begins the while loops
# as: creates an alias when importing
# global: declare a global variable
# with: used to simplify e... |
996,169 | dfbc69fe736e4891ff33bb7d053d54eae0a927e9 | from django.db import models
# Create your models here.
class Prestamo(models.Model):
codigo = models.AutoField(primary_key=True)
fechaSalida = models.CharField(max_length=50)
fechaRegreso = models.CharField(max_length=50)
def cuota():
pass
def __str__(self):
return str(self.cod... |
996,170 | c5e250228a5bc3a39468c1725d660e33398c092c |
'''
Author: lanyongliang
Email: lanyongliang@xdf.cn
Date: 2021-07-15 00:12:02
LastEditors: Please set LastEditors
LastEditTime: 2021-07-15 01:21:58
FilePath: \BinarySearch\binary_search.py
'''
import random
class BinarySearch(object):
"""
1、二分查找必须是有序类表
2、选好起始查找位置,中间开始,减少一半的查找元素
3、时间复杂度为 ${log_2 10}$... |
996,171 | 8616a9e3edc17018eaa50d861a8b56930bcc2b92 | import json
from sys import argv
basic = {}
model = {}
te = ['economist.json','economist_basic.json','economist_model.json']
cet46 = ['cet46.json','cet46_basic.json','cet46_model.json']
script,dic = argv
if dic == 'te':
dicc = te
else:
dicc = cet46
print(dicc)
with open(dicc[0],'r')as fo:
adic = json.loa... |
996,172 | 938080bb0fcd67611824436d8578cc2e955fd039 | from azure.cosmosdb.sql.models import (
Database,
Collection,
)
from azure.cosmosdb.sql.documentservice import DocumentService |
996,173 | 531dc7a3ec909f0d7f90caef9804e0da1712d14d | # RazviOverflow
# Python3
'''
import requests
url = "http://192.46.227.32/"
functions = ["get_called_class","get_parent_class","get_included_files","get_required_files","get_class_vars","get_object_vars","get_class_methods","get_declared_classes","get_declared_traits","get_declared_interfaces","get_defined_functions"... |
996,174 | af0b4af6fe93da2f51a0b1b153010546a499f296 | from django.contrib import admin
from .models import Place, Trend, Placetype, Layer, Clusters, Word, TrendWord
class PlaceAdmin(admin.ModelAdmin):
search_fields = ('name', 'another_name')
class PlaceElement(admin.TabularInline):
model = Place
class TrendAdmin(admin.ModelAdmin):
search_fields = ('name',)
class C... |
996,175 | 4f85e7e8086fbabe669a0209867984b52af3a65f | from django.contrib.auth.mixins import UserPassesTestMixin
from rest_framework import parsers, permissions, status
from rest_framework.exceptions import PermissionDenied
from rest_framework.generics import get_object_or_404
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_... |
996,176 | 7801e8f182c7d2270836007ed69c859169927296 | import base64
import boto3
import botocore
import json
import os
import requests
import time
# Function - Get token
def get_token():
response = requests.get('http://169.254.169.254/computeMetadata/v1/instance/service-accounts/default/token', headers={"Metadata-Flavor":"Google"})
return response.json().get('ac... |
996,177 | d5cab69de54048e40940ed232e10222a54e3a1a9 | from secret import flag, key
f = open('ciphertext.txt', 'w')
p = 1044388881413152506679602719846529545831269060992135009022588756444338172022322690710444046669809783930111585737890362691860127079270495454517218673016928427459146001866885779762982229321192368303346235204368051010309155674155697460347176946394076535157... |
996,178 | 7f832976a6a837ea754024c0d6da1966c4120e43 | """Take header file and runcc file and make the job files"""
import os, sys
head = sys.argv[1]
job = sys.argv[2]
with open(head) as h:
header = h.readlines()
n = 0
with open(job) as j:
for line in j:
out_name = 'job' + str(n) + '.sh'
out = open(out_name, 'w')
for h in header:
out.write(... |
996,179 | 3795030922832334defa0b242fbd602bb65c49c1 | import os, sys
BASE_DIR = os.getcwd()
sys.path.append(BASE_DIR)
from app_porcess.dbUtls import MysqlPool
import json
import time
if __name__ == '__main__':
pool = MysqlPool(host="10.144.15.187", port=3815, username='spider', passwd='QAZwsxEDC', db='spider')
jstr = '{"test":1}'
jobj = json.dumps(jstr, ensu... |
996,180 | b023b76b8a8fabca315b91a249254236b8c29a9c | import bottle
import json
import os
from client import Robot, get_commands, write_read
class Controller(object):
def __init__(self, robot, path=os.getcwd()):
self.robot = robot
self.bottle = bottle
self.commands = self.robot.commands
@self.bottle.route('/command_tree')
def command_tree(self... |
996,181 | 030dddf4c921e4acf888a31d7373a8e1cf217696 | from artifacts.models import Artifact
from data_info import *
try:
for i in items:
try:
temp_art = Artifact.objects.get(title=i.title, price=i.price, description=i.description)
except Artifact.DoesNotExist:
print "Adding " + i.title + " to database"
i.save()
except:
##that's an error
pr... |
996,182 | 0bc665ff8d792a9622f71dcfca0afd8c4c4bd18c | import argparse
import json
import matplotlib
matplotlib.use('Agg')
import matplotlib.pylab as plt
import seaborn as sns
import pandas as pd
parser = argparse.ArgumentParser()
parser.add_argument('--json-result')
args = parser.parse_args()
results = json.load(open(args.json_result))
tab_results = []
for r in results:... |
996,183 | 31192e7cdbfcd51cf38e3c7e5656041e8e4f8155 | version https://git-lfs.github.com/spec/v1
oid sha256:5314b6d0e1f855390d3aa87682038d21b2343d5010df8c367d7c707a8c7fa3cf
size 10210
|
996,184 | 961cd4781cbd4c35f1c9354f6a57eb2e0ab28d7c | #
# This computer program is the confidential information and proprietary trade
# secret of Anuta Networks, Inc. Possessions and use of this program must
# conform strictly to the license agreement between the user and
# Anuta Networks, Inc., and receipt or possession does not convey any rights
# to divulge, reproduce,... |
996,185 | a32e2bc38e2dbc8090041c90e1a19dad1c1e0eff | import time
import os
import sys
sys.path.append(os.environ["SWAGGER_CLIENT_PATH"])
from swagger_client.rest import ApiException
import swagger_client.models
from pprint import pprint
admin_user = "admin"
admin_pwd = "Harbor12345"
harbor_server = os.environ["HARBOR_HOST"]
#CLIENT=dict(endpoint="https://"+harbor_serv... |
996,186 | d05737653713752f45977ee2dd98e023e8f1cbb5 | # empty list # my_list = []
# list of integers # my_list = [1, 2, 3]
# list with mixed data types # my_list = [1, "Hello", 3.4]
# nested list # my_list = ["mouse", [8, 4, 6], ['a']]
# Defining list
list1 = list([1, 3, 5])
print('... |
996,187 | aed574f25b363b9613b4c595a8001055fded6eef | """
#ch11_26 遞迴式函數設計
#特色:每次呼叫自己時,都會使範圍越來越小;必須要有一個終止條件來結束遞迴函數
def factorial(n):
#計算n的階乘,n必須為整數
if n == 1:
return 1
else:
return (n * factorial(n-1)) #5*後,開啟一個4的factorial程式,得出4*....直到輸出1,5*4*3*2*factorial(1)
value = 3
print(value, "的階乘結果是 =", factorial(value))
value = 5
print(value, "的階乘結果是 =", factorial(va... |
996,188 | 40a682dbbba03e4ee23ca45db37a49f198bfd2c8 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import json,os,sys
from flask import request, g, jsonify
from . import Resource
from .. import schemas
class Dentists(Resource):
def get(self):
with open(sys.path[0]+'/v1/api/dentists.json') as json_data:
d = json... |
996,189 | f588ae7733dbb3d9cee36b10985504d5af4dd485 | import onnx
from onnx_tf.backend import prepare
onnx_model = onnx.load('dbface.onnx')
tf_rep = prepare(onnx_model)
tf_rep.export_graph('dbface_tf.pb') |
996,190 | f03948898f21e3900fd5898fef6639bb0b0665d4 | class Node:
def __init__(self, value=None):
self.value = value
self.next = None
def __str__(self):
return str(self.value)
class LinkedList:
def __init__(self):
self.head = None
self.tail = None
class Queue:
def __init__(self):
self.linkedList = ... |
996,191 | ede13f3694b5534c0d002b5613c15af9d37e9dc2 | valor = float(raw_input())
if valor >= 0.00 and valor <= 2000.00:
print "Isento"
elif valor >= 2000.01 and valor <= 3000.00:
extraum = 2000 - abs(valor)
taxaum = extraum * 8/100
print "R$ %.2f" %(abs(taxaum))
elif valor > 3000 and valor <= 4500.00:
extradois = valor - 3000
taxaextra = extradois * 18/100
... |
996,192 | dea4610b38cd6d4e1959e0c1c12d0a1076370ee9 | #code written by John Andrews
#last updated on Dec 5 2018
#This file contains code for determining properties about a DFA.
import queue
def determine_empty(input_dfa):
finals = input_dfa.get_finals()
#is the start state is a final, then the language is certainly not empty due to epsilon
if 0 in finals:
return ... |
996,193 | 1456afb4c31cd010fc385ae9e2f0fb95a0669925 | import datetime
last_id = 0
# deifne a note
class Note:
def __init__(self, memo, tags=''):
self.memo = memo
self.tags = tags
self.creationDate = datetime.date.today()
global last_id
last_id += 1
self.__id = last_id
def getId(self):
return self.__id |
996,194 | b37fdeb1e59c7e7fa7e566bb44b1d58aa364ee71 | # -*- coding: utf-8 -*-
"""Tests using pytest_resilient_circuits"""
import pytest
from json import dumps
from mock import patch
from fn_microsoft_security_graph.lib.ms_graph_helper import MSGraphHelper
from resilient_circuits.util import get_config_data, get_function_definition
from resilient_circuits import SubmitTes... |
996,195 | 3c9676d9c012c9f1e2cc2b4e095044188a6eaeb1 | from flask_restful import Resource
from flask import request
from models.schema.user import UserSchema
from models.user import UserModel
user_schema = UserSchema(many=False)
def get_param():
data = request.get_json(force=False)
if data is None:
data = request.form
return data
class UserResource... |
996,196 | 311d8783ae77b7b191ade3c4d0cd113779b63b7f | from peewee import CharField, DateTimeField, BooleanField, SmallIntegerField, DeferredForeignKey
from .base_model import BaseModel
from datetime import datetime
class Todo(BaseModel):
note = DeferredForeignKey("Note", null=False, on_delete='cascade', backref='todos', column_name="note_id")
title = CharField(d... |
996,197 | 1ad11c444e4f3c003b7132e0551b7650e3b6ba54 | ##### E-Commerce Website Clone
##### Mason Brewer
##### April 5th, 2019
from django.shortcuts import render, redirect
from time import gmtime, strftime
import random, datetime, bcrypt
from .models import *
from django.contrib import messages
from decimal import Decimal
from apps.UIApp.models import User, Order
# GET... |
996,198 | 0b56d8186a412c96ebe75713cde18bf5e89a3de4 | import os
from datetime import datetime
import time
import json
import numpy as np
import tensorflow as tf
from tensorflow import keras
from netTrain.ResNet.net_model import ResNet50V2, ResNet50V2_fc
# from argoPrepare.load_tfrecord_argo import input_fn
from argoData.load_tfrecord_argo import input_fn
# from utils_cust... |
996,199 | e5d80ef4e2fb311239260aad86a51ba018e2886e | from flask import Flask, render_template
import requests
import subprocess
app = Flask(__name__)
@app.route('/')
def root():
name = "Hello World"
return render_template('root.html', title='Home')
@app.route('/volume/vol_up')
def vol_up():
subprocess.Popen('SetVol.exe +10', shell=True)
return render... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.