index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
15,100 | df0756c94a20f5655f10a76de68f4cc7d3269d23 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import sys
import logging
sys.path.append(".")
from tests import parser_tests, ruby_tests
from lib import test_runner
# Suppress log messages on stderr
logging.basicConfig(level = logging.CRITICAL)
# Define test instances: ex:
# log_load = Log_tests.Tes... |
15,101 | 9fab3b83436cbdaffdd48a9e22747d12035da70c |
import os
import argparse
import csv
import urllib
import urllib.request
import logging
import time
import traceback
import random #0 1 2 3 4 5 6 7 8 9 10 11 12
ColorList = ["银", "黑", "绿", "橙", "白", "灰", "红", "蓝", "紫", "黄", "金", "棕", "咖啡"]
DirectList = ['侧前45度车头向右水平', '侧前4... |
15,102 | feccdb8846e921b0e841c0b3cca9e8927e773ef0 | from okcomputer import aiEngine
import os, time, sys
from random import randint
import msvcrt
os.system('mode con: cols=35 lines=15')
def delay(float):
time.sleep(float)
def clearScreen():
os.system('cls' if os.name == 'nt' else 'clear')
def robeFace():
while True:
clearScreen()
print '''... |
15,103 | d22a0204e4357d774b645b2b4175d4ce0242f31d | # import os, shutil
#
# for i in range(4, 13):
# if os.path.exists("./" + str(i)):
# print "%d folder exist!" % i
# else:
# os.mkdir("./" + str(i))
#
# if os.path.exists("./%d.py" % i):
# shutil.move("./%d.py" % i, "./%d/" % i);
# else:
# print "%d.py not exist" % i |
15,104 | 170a73ed985d2098ea61d79adee676b3ed43b5e8 | from detectron2.data.samplers import RepeatFactorTrainingSampler
from detectron2.data.common import DatasetFromList
from detectron2.data.build import get_detection_dataset_dicts
from numpy.core.fromnumeric import repeat
class RepeatfactorSampler(RepeatFactorTrainingSampler):
"""
Similar to TrainingSampler, but a sam... |
15,105 | 787216a272c816c71c9e08a086ff040b31419f43 | from nornir import InitNornir
from nornir.core import Nornir
from flasnir.definitions import PROJECT_ROOT
HOSTS = PROJECT_ROOT / "config" / "inventory" / "hosts.yaml"
DEFAULTS = PROJECT_ROOT / "config" / "inventory" / "defaults.yaml"
def init_nornir() -> Nornir:
return InitNornir(
runner={
"pl... |
15,106 | af062d3c56362abfe4b8ededdde4dcf64fe33f32 | import argparse
import logging
from logger.mylogger import setup_logging
from pdf_scraper import Scraper
parser = argparse.ArgumentParser()
parser.add_argument("site", help="the site to scrape")
parser.add_argument("pdf_server")
parser.add_argument("output_folder", help="output base folder for generated pdfs")
if _... |
15,107 | a43b290dcc49da9de05c338d1aefcb56d02c1922 | import numpy as np
from functions import compute_s_w, compute_s_b, compute_avg_face
from pca import calc_eig_pca_small
def calc_eig_fld(train_image=None, train_label=None, k=None, sw = [], sb = [], k_eigvecs = []):
if sw == [] or sb == [] or k_eigvecs == []:
m, N = train_image.shape
eigvals, eigvec... |
15,108 | 52e2d5f51a9c5082d00108fa5ab51601984e427d | #!/usr/bin/env python
import rospy
import sys, signal
import os
from math import pi
from std_msgs.msg import Float64
from ros_pololu_servo.msg import MotorState as MS
from ros_pololu_servo.msg import MotorStateList as MSL
from ros_pololu_servo.msg import MotorCommand as MC
PUBTHRESH = 0.01 # don't bother publishing ... |
15,109 | 1c15449cddef3b4296c28fc6e3d72970383b187c | from tictactoe.players import RandomPlayer
from tictactoe.game import Board
def test_answer():
assert True == True
assert False == False
def test_move():
board = Board()
random = RandomPlayer()
random.marker = 'X'
board[0, 1] = random.marker
board[0, 2] = random.marker
board[1, 1] = ra... |
15,110 | 17ee96f7555cb7ec219117fcf041d468688b1618 | """"
Copyright 2021 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
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dis... |
15,111 | 2ab8eeb7f1fc8f77782767f45e05c3613a19ea22 | # Generated by Django 2.2 on 2020-02-26 05:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('loginsys', '0006_products_quantity'),
]
operations = [
migrations.AlterField(
model_name='products',
name='quantity',
... |
15,112 | a5567cd11b81ec24e8dcdc12c6a2793517fadda4 | from enum import Enum
class ChatMessageImportance(str, Enum):
Normal = "normal",
High = "high",
Urgent = "urgent",
UnknownFutureValue = "unknownFutureValue",
|
15,113 | 639236dedd8d821c1b32c5ffcf3d1328a85efc89 | import csv
impoort cell.py
class pack:
cellsInParallel = 0
cellsInSeries = 0
energyRequired = 0
voltageRequired = 0
powerRequired = 0
additionalCapacity = 30
cell = cell(0,0)
cellList[]
def __init__(self):
self.cellsInParallel = 0
s... |
15,114 | 559aed159896c98fb4a2876875b3abc24e455d8b | import sys
from pathlib import Path
basedir = Path(__file__).absolute().resolve().parent
sys.path.insert(0, str(basedir))
from app import create_app
application = create_app()
|
15,115 | 4e9764507402a17d138703878c2279eecf2c002e | # Chapter-2: Fundamentals-2
# Star-Art
# Write 3 functions:
# Write function "drawLeftStars(num)" that accepts a number and prints that many 'stars'
# Write function "drawRightStars(num)" that accepts a number and prints 75 characters in total with that many 'stars' from the right side. The last 'num' characters of the... |
15,116 | 2f59f994c351926c90d03bbc98b873bb6509b2ca | from django.urls import path
from . import views
urlpatterns = [
path('', views.update_profile_page, name='update_profile_page'),
path('register/', views.register_page, name='register_page'),
path('login/', views.login_page, name='login_page'),
path('logout/', views.logout_page, name='logout_page'),
... |
15,117 | 7f582482264dbb39550b1bebbcf40e68b7b934b6 | from models.shared_rnn import RNN
from models.shared_cnn import CNN
from models.controller import Controller
from models.cnn_controller import CNNMicroController
|
15,118 | cc6fad9e146ad1997260eb9cb563804d66e75db7 | print("please enter a string")
a=input()
print("pls enter a string ")
b=input()
c=(b in a)
print(c)
|
15,119 | 9cbeccf0ec116003583e3e8749690215e3fa352c | import http
from unittest.mock import call, patch, Mock
import urllib
from directory_constants import choices, urls
from directory_api_client.client import api_client
import requests
import pytest
from django.urls import reverse
from company import forms, views, validators
from core.tests.helpers import create_respo... |
15,120 | cc4f8ae28425cf2e1469bea62fec559e615d0403 | from unittest.mock import Mock
from graphql import graphql
from ariadne import make_executable_schema, resolve_to
def test_query_root_type_default_resolver():
type_defs = """
type Query {
test: String
}
"""
resolvers = {"Query": {"test": lambda *_: "success"}}
schema = ... |
15,121 | 26a302aaa964964b1aaed0b449ca18f559e60a82 | ###############################################################################
#
# Copyright (c) 2011-2017 Ruslan Spivak
# Copyright (c) 2020 Steven Fernandez <steve@lonetwin.net>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the... |
15,122 | 8c4c03066fe896c721ca84d123dc2512616fe55c | import logging
import gym
from gym import error, spaces, utils
from gym.utils import seeding
import numpy as np
logger = logging.getLogger(__name__)
class TomitaE(gym.Env):
"""
Tomita Grammer : even number of 0's and even number of 1s
Alphabet : {0,1}
"""
metadata = {'render.modes': ['hum... |
15,123 | 3f26a4f6f584b1ee8e69e248d03b44840c47968f | s1 = {1, 2, 3, 4}
print(s1)
item = 2
if item in s1:
s1.remove(item)
print(s1)
s1.discard(10)
print(s1)
|
15,124 | bc1034e482149a49f768c30eec8b0dc4f41ab0fc | import copy
from cereal import car
VisualAlert = car.CarControl.HUDControl.VisualAlert
def create_steering_control(packer, apply_steer, frame, steer_step):
idx = (frame / steer_step) % 16
values = {
"Counter": idx,
"LKAS_Output": apply_steer,
"LKAS_Request": 1 if apply_steer != 0 else 0,
"SET_1"... |
15,125 | 4a69780f15ac017905a292691ff4a39559bc9e13 | from flask import Flask, render_template, request
import urllib
import json
from PIL import Image
import numpy as np
app = Flask(__name__)
TOKEN = '4b25cd19-cfa6-46b0-9c16-67745a6ca844'
@app.route('/likes', methods=['GET'])
def likes():
token = TOKEN if request.args.get(
'token') is None else request.arg... |
15,126 | f1abd07653d5b9722f8018f48bc5e5a00dbcd47d | def fn():
l,m,n = map(int,input().strip().split())
a = list(map(int,input().strip().split()))
b = list(map(int,input().strip().split()))
c = list(map(int,input().strip().split()))
a1 = set(a)
b1 = set(b)
c1 = set(c)
out1 = {}
out2 = {}
out1 = a1.intersection(b1)
ou... |
15,127 | 3085d80835e0cb3ce9c5816d36a3eea56e3f7b28 | from __future__ import absolute_import
import os
from six.moves import shlex_quote
import subprocess
import sys
import click
import pandas
from mlflow.pyfunc import load_pyfunc, scoring_server, _load_model_env
from mlflow.tracking.utils import _get_model_log_dir
from mlflow.utils import cli_args
from mlflow.utils.l... |
15,128 | 24518ca38cdc12eb6ce019345983e1cd04702b26 | #Embedded file name: C:\ProgramData\Ableton\Live 9 Suite\Resources\MIDI Remote Scripts\Maschine_Mk1\MaschineChannelStripComponent.py
import Live
from _Framework.ChannelStripComponent import ChannelStripComponent
from _Framework.ButtonElement import ButtonElement
from _Framework.InputControlElement import *
from MIDI_Ma... |
15,129 | 4c4caca505d434495e03231b83b651f6e8978751 |
def fun(x,y,op) :
if x and y !=0 and op !=None :
if op == '+':
return x+y
elif op == '+':
return x-y
elif op == '+':
return x*y
else:
return x/y
print(fun(10,15,'+')) |
15,130 | af01ef154f8845436c9b79896006a2477a5e6a25 | """asd"""
class World():
"""Contains details about the physics of a worl"""
name = 'Unknown planet'
acceleration = {}
resistance = {}
propulsors = {}
def __init__(self, name, acceleration, resistance, propulsors):
self.name = name
self.acceleration = acceleration
self.... |
15,131 | a6160186ddf8d26cf679f60d5073d8051343bc79 | import requests
import json
from tabulate import *
import urllib3
version = "v1"
def get_NetworkHostInventory(api_url, ticket):
api_url = api_url + "/api/"+version+"/host"
headers = {
"content-type": "application/json",
"X-Auth-Token": ticket
}
resp = requests.get(api_url, headers=h... |
15,132 | 48bb2ce954839904f5785d7304d56c806fa545f1 | import bluesky.preprocessors as bpp
from bluesky.plan_stubs import sleep, abs_set
import bluesky
from bluesky.plans import rel_spiral_square, rel_spiral_fermat, rel_spiral
from ophyd import EpicsScaler, EpicsSignal
xstart = EpicsSignal(read_pv='HXN{2DStage}XStart-RB', write_pv='HXN{2DStage}XStart')
xstop = EpicsSign... |
15,133 | a8de204ea32edd8cfc76ed459535a17d59790bf7 | import json
env_file = "env.json"
info = {"music_home": ""}
def save(file, environment):
f = open(file, 'w')
f.write(json.dumps(environment))
f.close()
def load_json(file):
with open(file) as json_file:
try:
json_data = json.load(json_file)
except ValueError:
... |
15,134 | 60b50c98682b065b531597e0b1057d78dafeb8cc | elif text == "INV /":
self.__model.invDiv()
|
15,135 | e0c61dc6a475c50570affacc6f5bb0314af8cd33 | # -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
import torch
import torch.nn.functional as F
from torch.autograd import Function
from torch.distributions.binomial import Binomial
def where(con... |
15,136 | 82a40cc491c81f1d52bb2fbca1acc6489eb2fde4 | from util import save_wav
import sound_recorder
WAVE_OUTPUT_FILENAME = "output.wav"
def main():
sound_recorder.live_amplitude_spectrum()
# data = sound_recorder.record(25)
# save_wav(data, filename=WAVE_OUTPUT_FILENAME, channels=sound_recorder.CHANNELS)
if __name__ == '__main__':
main()
|
15,137 | 818a98045c3973746a7a4763e2e0692d68dfd35b | BLUEPRINTS = {
'flask': {
'__init__': {
'db': (
"import os"
"\nfrom flask import Flask"
"\nfrom flask_sqlalchemy import SQLAlchemy"
"\nfrom flask_migrate import Migrate\n"
"\napp = Flask(__name__)"
"\... |
15,138 | 0a3443baec4070da460944f51bbcf06d175e6434 | class Solution:
def findComplement(self, num: int) -> int:
bin_string = bin(num)[2:]
ch = ['0','b']
for c in bin_string:
if c=='0':
ch.append('1')
else:
ch.append('0')
return int(''.join(ch), 2)
|
15,139 | aa97397a5dcd5354488ef5f6e2384b8ed3093ef2 | from armulator.armv6.opcodes.abstract_opcodes.str_immediate_thumb import StrImmediateThumb
from armulator.armv6.opcodes.opcode import Opcode
from armulator.armv6.bits_ops import zero_extend
from armulator.armv6.arm_exceptions import UndefinedInstructionException
class StrImmediateThumbT4(StrImmediateThumb, Opcode):
... |
15,140 | 34145b6c9e7ccb41d5ff761885522b5aeb4a4b0b | #-*- coding: UTF-8 -*-
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import requests
#중요 태그 : div, li
driver = webdriver.Chrome('C:/Users/Heain/Desktop/2018_FastCampus/Python/Intermediate/chromedriver.exe')
#windows에서 실행할 경우 실행파일의 모든 경로를 작성해야함
my_query = '인공지능'
try... |
15,141 | 4e9e75ae7a7283767eb3159ab80829ef221704e3 | import pygame
from pygame.locals import *
from OpenGL.GL import *
from OpenGL.GLU import *
vertices = (
(1,-1,-1),
(1,1,-1),
(-1,1,-1),
(-1,-1,-1),
(1,-1,1),
(1,1,1),
(-1,-1,1),
(-1,1,1) )
edges = (
(0,1),
(0,3),
(0,4),
(2,1),
(2,3),
(2,7),
(6,3),
(6,4),
(6,7),
(5,1),
(5,4),
(5,7)
)
s... |
15,142 | d97dd7345c1522f2e10ba314525e478e7422edaa | #!python3
"""
##### Task 1
Ask the user to enter an integer.
Print the multiplication tables up to 12 for that number
using a for loop instead of a while loop.
(2 points)
inputs:
int number
outputs:
multiples of that number
example:
Enter number:4
4 8 12 16 20 24 28 32 36 40 44 48
"""
number = input("Enter number... |
15,143 | 63afc72dad731d0df390427467ea0fdb997da5ab | #!/usr/bin/env python
import os
import pickle
import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
tf_bijs = tfp.bijectors
tf_dist = tfp.distributions
tf_mean_field = tfp.layers.default_mean_field_normal_fn
#==============================================================
class... |
15,144 | e47330768491b72c9bf43337c706d03d635ca720 | ################################################################################
# Experiment No. 11
#
# Generating weekly heatmaps for stations
#
#
|
15,145 | 976d468cd39493e7410ca9ce30e217b1345b6a25 | import os
import pandas as pd
import torch
import torch.nn as nn
from torchvision import datasets,models,transforms
from torch.utils.tensorboard import SummaryWriter
import time, os, copy
image_transforms = {
'train': transforms.Compose([
transforms.RandomResizedCrop(size=256, scale=(0.8, 1.0)),
t... |
15,146 | a4fdb3c5a3f9aec5d8956862dc01bd170ca6823b | from django.contrib import admin
from .models import Bucketlist, Item
class BucketlistAdmin(admin.ModelAdmin):
pass
admin.site.register(Bucketlist, BucketlistAdmin)
class ItemAdmin(admin.ModelAdmin):
pass
admin.site.register(Item, ItemAdmin)
|
15,147 | c767bfa22d100e4e5054519bbcef220d010726b4 | import matplotlib.pyplot as plt
from IPython import display
from torch.utils import data
import torch
import os
import hashlib
import requests
import collections
import re
import random
import numpy as np
import torch.nn as nn
import time
import math
from torch.nn import functional as F
import zipfile
def use_svg_di... |
15,148 | dfbe89c2de7569e495b4c535430c4d0f5f743bca | #!flask/bin/python
from locLib import *
def concept2Indexes(concepts, vocabulary, maxConceptCount):
'''
concept2Indexes - Функция создание индексов концептов
вход:
concepts - концепты
vocabulary - словарь концептов
maxConceptCount - максимальное количество всех концепто... |
15,149 | 47af12290701dfa4c90a605d4a9557bce238626a | import logging
import requests
from flask import Flask, render_template, request
app = Flask(__name__)
# api-endpoint
url = "https://maps.googleapis.com/maps/api/geocode/json?key=AIzaSyA_wOxjHNfPhmKu2zBo8N5HXsEpewgIQF0"
# [START form]
@app.route('/')
def index():
return render_template('form.html')
# [END fo... |
15,150 | 479ed5be2d1194d0f89d0f1cd76ab7fb21c7ef26 | # Copyright 2019 Jan Feitsma (Falcons)
# SPDX-License-Identifier: Apache-2.0
from robotScenarioBase import *
def testRobotInterface():
"""
A series of tests to check if all functionality provided by robotInterface works.
"""
print
print "TEST: simulation environment"
print "isSimulated =", ro... |
15,151 | 89e9426b373a008045a8874c7447083be1f08959 | import hashlib
import subprocess
import os
from WMCore.Services.SiteDB.SiteDB import SiteDBJSON
from WMCore.Credential.Proxy import Proxy
__version__ = '1.0.3'
def getHashLfn(lfn):
"""
Provide a hashed lfn from an lfn.
"""
return hashlib.sha224(lfn).hexdigest()
def getFTServer(site, view, db, log):
... |
15,152 | e82c825211875573ee33e9dc19cee1d5480b1103 | import json
from LocalDir import *
import pickle
from os import listdir
from os.path import isfile, join
# list of json files, in case of folders with multiple files
onlyFiles = [f for f in listdir(sourceDir) if isfile(join(sourceDir, f))]
print(sourceDir)
print(onlyFiles)
allTweets = {}
failedRegex = 0
for file in o... |
15,153 | 8c8279fd5577c9e59d007a018a5d6c50e1d7f5e9 | from django.urls import path
from . import views
urlpatterns = [
path('',views.home,name='home'),
path('sign-up/',views.register,name='register'),
path('sign-in/',views.login,name='login'),
path('logout/',views.logout,name='logout'),
path('user-details/',views.details,name='user-details'),
path... |
15,154 | ab51a2be99aace11e4d6b79f22efcdd2c1bdd6ee |
import argparse
import os
import sys
##############################################
parser = argparse.ArgumentParser()
parser.add_argument('--epochs', type=int, default=100)
parser.add_argument('--batch_size', type=int, default=128)
parser.add_argument('--lr', type=float, default=1e-2)
parser.add_argument('--eps', t... |
15,155 | 207b6b661734fa8be28bbaf42a5b37236d81e284 | # Rest Framework
from rest_framework import status
from rest_framework.test import APITestCase
# Project
from apps.shared.utils import reverse
from apps.shared import messages as msg
from .base import AuthTestCase, TEST_USER1, CURRENT_PASSWORD
NEW_PASSWORD = 'abc0987654321'
INVALID_PASSWORD = '123'
class ChangePass... |
15,156 | 3708a5505d5037abb923f09cef5242c769b78939 | count=0
for i in range(0, len(s)):
if s[i] == "a" or s[i] == "e" or s[i] == "i" or s[i] == "o" or s[i] == "u":
count += 1
print(count)
|
15,157 | 02336752fb2d603cc8abfe2a8a97a9fb22480e95 | from bson import ObjectId
from utility_functions import *
from bindings import database
from business_methods import User
def clean_id(x):
if '_id' in x.keys():
x['id'] = str(x['_id'])
del x['_id']
elif x['id'] is not None:
x['id'] = str(x['id'])
return x
def preprocess(x, requeste... |
15,158 | 9a4993632acd916a59889e2a2d7cf1959e1ad3c9 | import argparse
import datetime
import os
import random
import sys
from collections import defaultdict
PROJECT_PATH = os.sep.join(os.path.realpath(__file__).split(os.sep)[:-2])
sys.path.append(PROJECT_PATH)
os.environ['DJANGO_SETTINGS_MODULE'] = 'fufufuu.settings'
from django.utils import timezone
from django.contrib... |
15,159 | a955a0b2de55d04673dcfeedaff98c535ff3a2c9 | _, prize_num = map(int, input().split())
scores = list(map(int, input().split()))
print(sorted(scores, reverse=True)[prize_num-1]) |
15,160 | a3219bce4c41288077776d06609aa9e1ead36aeb | # -*- coding: utf-8 -*-
import os
from os.path import join as opj
import logging
import sys
import rasterio
import warnings
from rasterio.errors import NotGeoreferencedWarning
from ost.helpers import utils as h
from ost.settings import SNAP_S1_RESAMPLING_METHODS, OST_ROOT
logger = logging.getLogger(__name__)
def _... |
15,161 | 885b2532998ee2091f0e3a410eebd4cffa24df89 |
import MySQLdb
import MySQLdb.cursors
import sys
from time import *
# DB connection information
# DB host
host = 'localhost'
# DB user
user = 'dbuser'
# DB password
passwd = 'password'
# Name of used DB
dbName = 'deu_mixed_2011'
# config
# every word id less or equal this value will be ignored
wordIdBoundary = 87839... |
15,162 | d31722f4a31ba90395b10285e90bc2b99cee70e1 | # -*- coding: utf-8 -*-
from lxml import etree
import argparse
import os
import re
import sys
from reader import chunker
import languages
langs = re.compile('\{\{etyl.+?(?:lang=)?(\w+)\}\}', re.I)
def consolidate_iso(iso):
return languages.name2iso[languages.iso2name[iso]]
def parse_page(page):
'''
Ret... |
15,163 | 90bc4dac85d52035dc619b042ef3d00296294932 | import SignIn
import Signup
from Handler import Handler
def valid_login_cookie(cookie):
username = cookie.split('|')[0]
return cookie == SignIn.make_secure(username) and Signup.User.get_user_by_name(username)
class Welcome(Handler):
page_title = "Welcome"
def get(self):
login_cookie = self.... |
15,164 | 13d2da65726c81d838a77b17c801a43814754bd8 | import os
import cv2
import numpy as np
from random import shuffle
from skimage import transform
from constants import random_transform_args
from constants import face_coverage
def get_transpose_axes(n):
if n % 2 == 0:
y_axes = list(range(1, n - 1, 2))
x_axes = list(range(0, n - 1, 2))
else:
... |
15,165 | 306a08ebc719484c8a43af6a14304dbd1a8f9521 | #-*- encoding: utf-8 -*-
from django.shortcuts import render_to_response, get_object_or_404
from django.http import HttpResponse
from django.template import RequestContext
from multa.controleUsuario.models import Usuario
from multa.controleUsuario.models import Multa
from multa.controleUsuario.forms import FormCadastr... |
15,166 | 04ab4ac69071fa18bf94726989689284bf15f1ae | coin=("adzcoin", "auroracoin-qubit", "bitcoin", "bitcoin-cash", "bitcoin-gold", "dash", "digibyte-groestl",
"digibyte-qubit", "digibyte-skein", "electroneum", "ethereum", "ethereum-classic", "expanse", "feathercoin",
"gamecredits", "geocoin", "globalboosty", "groestlcoin", "litecoin","maxcoin", "monacoin","mo... |
15,167 | 516f36f7bd685cec34f425a49b8f3804f6745fb7 | # -*- coding: utf-8 -*-
"""
@author: lennin
Vista Base para heredar.
El objetivo es minimizar la programacion de la impresion de menus en cli
la vista que herede debe agregar una variable llamada menu
que debe ser un diccionario con el siguiente formato:
menu = {
<id de la opcion del menu> : ("<Nombre de la opci... |
15,168 | da7616c6806299f2f0542af6bb056f9b0e8275dc | from ..helpers import eos
from ..helpers import alfaFunctions
from ..helpers.eosHelpers import A_fun, B_fun, getCubicCoefficients, getMixFugacity,getMixFugacityCoef, dAdT_fun
from ..solvers.cubicSolver import cubic_solver
from ..helpers import temperatureCorrelations as tempCorr
from ..helpers import mixing_rules
from... |
15,169 | c75c77d5731d41f6ceac442470954406928e0986 | #!/bin/python3
import numpy as np
import random
import os
import matplotlib.pyplot as plt
from scipy.stats import norm
from copy import deepcopy
import tensorflow as tf
np.set_printoptions(precision=4, edgeitems=6, linewidth=100, suppress=True)
from vae import ConvVAE, reset_graph
DATA_DIR = '/N/u/mhaghir/Carbonate... |
15,170 | ba5d83903aa587a0e1b0e5bb7b6e40035185c551 | import sqlite3
from time import time
def PrepareIndex(db):
c = db.cursor()
for t in "I R days O F text_index".split():
try:
c.execute('drop table %s' % t)
except:
pass
try:
c.execute('drop index I_%s' % t)
except:
pass
#
... |
15,171 | ea756c99f83a9ffbac914c9cf312b32231382162 | import random
import pickle
import unittest
from btree import *
class BTreeTests(unittest.TestCase):
def test_additions(self):
bt = BTree(20)
l = list(range(2000))
for i, item in enumerate(l):
bt.insert(item)
self.assertEqual(list(bt), l[:i + 1])
def test_bulkl... |
15,172 | 6f25350b1f18fe2bbd2a1a6f5b6c6c2465ec73a0 | import socket
import time
import base64
from sys import argv
import struct
canary = struct.pack('<L', int(argv[1], base=16))
ret_addr = struct.pack('<L', int(argv[2], base=16) - int("0x2d437", base=16))
# chech_auth + 0x2d437 = system
string_pointer = struct.pack('<L', int(argv[3], base=16) - int("0x90", base=16))
# ... |
15,173 | 478c3b9c9d374bdcf9b9ca6302aff42ba3cfe555 |
import numpy as np
import matplotlib.pyplot as plt
r = np.arange(0, 6.0, 0.01)
################################################
def function(r):
theta = 4 * np.pi * r
return theta
###################################################
ax = plt.subplot(111, pola... |
15,174 | fb5b39f543a8fb442c7fef22abe66941e3b25385 | from mara_db import config, views, cli
MARA_CONFIG_MODULES = [config]
MARA_NAVIGATION_ENTRY_FNS = [views.navigation_entry]
MARA_ACL_RESOURCES = [views.acl_resource]
MARA_FLASK_BLUEPRINTS = [views.blueprint]
MARA_CLICK_COMMANDS = [cli.migrate]
|
15,175 | ada61061be2d7270b7b4107d04053f21859417df | #
# read Titanic data
#
import numpy as np
from sklearn import cross_validation
from sklearn import tree
from sklearn import ensemble
import pandas as pd
print("+++ Start of pandas' datahandling +++\n")
# df here is a "dataframe":
df = pd.read_csv('titanic5.csv', header=0) # read the file w/header row #0
# drop co... |
15,176 | 9318a2d090d26afab3aef101b2915b62e18fe7a1 | '''
Created on 18 Oct 2019
@author: mdonze
'''
import logging
import os
import yaml
import logging.config
from minitel_server import constant
from minitel_server.tcp_server import TCPServer
from minitel_server.configuration import Configuration
logger = logging.getLogger('main')
def setup_logging(default_path='log... |
15,177 | 48396c4c61583d896880aa9e263c08f19b208f21 | import random
class Heap():
def __init__(self, tamanio):
self.tamanio = 0
self.vector = [None]*tamanio
def agregar(heap, dato):
'''Agrega elemento y flota hasta ordenar heap'''
heap.vector[heap.tamanio] = dato
flotar(heap, heap.tamanio)
heap.tamanio += 1
def quitar(heap):
'... |
15,178 | dfb0a54c21b002d0b1d027cf6ae4b40f740e94c3 | from tkinter import *
from tkinter.ttk import *
root = Tk()
tree = Treeview(root,selectmode="extended",columns=("A","B"))
tree.pack(expand=YES, fill=BOTH)
tree.heading("#0", text="C/C++ compiler")
tree.column("#0",minwidth=80,width=100, stretch=NO)
tree.heading("A", text="A")
tree.column("A",minwidth... |
15,179 | ff1909126fcef5aa6479e0b4bd3f43c5b103d4fd | class UserType:
id = 0
description = ""
def __int__(self):
pass
def __init__(self, id, description):
self.id = id
self.description = description |
15,180 | f49260a7ebd6bc275401fbd5f85451f60a0166ef | import csv
import geocoder
f1 = open('../dataset/geocoded_locations_blanks.csv', 'r')
f2 = open('../dataset/geocoded_locations_blanks_coded1.csv', 'a')
csvreader = csv.reader(f1, delimiter=",", quotechar='"')
csvwriter = csv.writer(f2, delimiter=",", quotechar='"', quoting = csv.QUOTE_MINIMAL)
for i, row in enume... |
15,181 | 7ed966af4b81c43fa6980a449a421d947ebad60b |
# Copyright Qwilt, 2012
#
# The code contained in this file may not be used by any other entities without explicit written permission from Qwilt.
#
# Author: naamas
from a.infra.misc.enum_with_value import EnumWithValue
from a.infra.basic.return_codes import ReturnCodes
from a.infra.misc.init_guard import InitGua... |
15,182 | 4e306e9710c605d03320a465a8a6a3d77f510295 | import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import confusion_matrix
from sklearn.metrics import classification_report
# Define sample labels
true_labels = [2, 0, 0, 2, 4, 4, 1, 0, 3, 3, 3]
pred_labels = [2, 1, 0, 2, 4, 3, 1, 0, 1, 3, 3]
# Create confusion matrix
confusion_mat = confusion_m... |
15,183 | 253437a16ef4d460ac7e9e7134cf1c78afd47f6f | """
Integration Tests
"""
from unittest import TestCase
from unittest.mock import MagicMock
from inventory_management.inventory import Inventory
from inventory_management.furniture import Furniture
from inventory_management.electric_appliances import ElectricAppliances
from inventory_management.market_prices import g... |
15,184 | f9199ba008630a84d7204dff9a657597a05626ae | from collections import defaultdict, deque, Counter
import sys
from decimal import *
from heapq import heapify, heappop, heappush
import math
import random
import string
from copy import deepcopy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce,... |
15,185 | f529029625ce29f7217ca13cdc133b071b25f20d | import requests
import numpy as np
from io import BytesIO
class Dataset(object):
def __init__(self, mvshlf_api, project_id):
self.mvshlf_api = mvshlf_api
self.project_id = project_id
def load_data(self, url = None):
if url is None:
dataset = self.mvshlf_api.getProjectDatas... |
15,186 | fc98eb8a48022b79fea79e4a4f98ba78b9b93a8f | import sp_cal_bandwidth
import sp_cal_betweenness
import sp_cal_coverage
import sp_cal_dij_delay
def get_parameters(path):
"""Get the parameters of mega-constellations
:param path: str, configuration file path of mega-constellations
:return parameter: two-dimensional list about parameter of constellations... |
15,187 | ae50437a62e872cc54f9b3b0d80b0ade528f8496 | """
PACKNET - c0mplh4cks
UDP
.---.--------------.
| 7 | Application |
|---|--------------|
| 6 | Presentation |
|---|--------------|
| 5 | Session |
#===#==============#
# 4 # Transport #
#===#==============#
| 3 | Network |
|---|--------------... |
15,188 | f0db1e4b6b1c6b35d6e9ae1a348a9de55dd122d5 | #----------------------------------------------------------------------------
#
# Copyright (c) 2013-14, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in /LICENSE.txt and may be redistributed only
# under the conditions described... |
15,189 | de308153762869c271eb0b07f30cf012592f58d7 | __author__ = 'am004929'
|
15,190 | c1301d84f1cc43350872c182bde6440e5bc35a68 | import re, urllib, urllib2, json
def jsonloads(string):
if dir(json).__contains__('loads'):
return json.loads(string)
return json.read(string)
def jsondumps(dict):
if dir(json).__contains__('dumps'):
return json.dumps(dict)
return json.write(dict)
def date_format(date):
date = re.... |
15,191 | af43b4731f5e08208832be1bb1f6ee7f7ce6a0b1 | # -*- coding: utf-8 -*-
"""
Created on
@author: luolei
"""
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import copy
class Cell(object):
"""
定义元胞
"""
def __init__(self, center = np.array([0, 0]), state = 'dead'):
"""
初始化
:param center: 该元胞中心
... |
15,192 | cef2ab5c13f31d6f8278d04fa96a018fa16bf3b0 | ####################################################################################
###
### Program to find eigenenergies of the infinite square well.
###
####################################################################################
# Importing useful stuff
from numpy import *
from matplotlib.pyplot import *... |
15,193 | 3c353924ea97480994f92eb71a614205c1703e48 | # -*- coding: utf-8 -*-
"""
Created on Sun Nov 18 11:27:23 2018
@author: Saverio
"""
import re
testString = "Questo è un esempio di #tag che voglio #individuare per assegnare ad @ale cosa fare come @compito"
def parseHastags(intext):
# create a regex to match a hashtag followed by any number of chars
... |
15,194 | 959dd85e4090579ea181b9325fa83d7bf81ce5ed | from django.db import models
from django.contrib.auth.models import User
DEFAULT_TITLE = 'Teksti'
class Word(models.Model):
"""Word with its translation and some linguistic properties"""
# Gender choices
FEMININE = 'f'
MASCULINE = 'm'
NEUTER = 'n'
# Part-of-speech tags as in spacy.io.annotati... |
15,195 | 43a97eaf4c3a6ff9eb451b901fb281d051874cdf | from marshmallow_jsonapi.flask import Schema
from marshmallow_jsonapi import fields
class SchemaAirState(Schema):
class Meta:
type_ = 'air_state'
self_view = 'air_state_detail'
self_view_kwargs = {'id': '<id>'}
self_view_many = 'air_state_list'
# id = fields.Integer(as_string=... |
15,196 | be35b04d005fec53f002d455681474780de1dcf0 | # -*- coding: utf-8 -*-
import logging
from odoo import http
from odoo.http import request
from odoo.addons.website.controllers.main import Website
import requests
logger = logging.getLogger(__name__)
class WebsiteReload(Website):
@http.route('/server-not-found', type='http', auth="public", website=True)
d... |
15,197 | 7ef9402cc6759b5659d4df466df31d858f530d7b | # Written by *** and Eric Martin for COMP9021
'''
Prompts the user for two strictly positive integers, numerator and denominator.
Determines whether the decimal expansion of numerator / denominator is finite or infinite.
Then computes integral_part, sigma and tau such that numerator / denominator is of the form
int... |
15,198 | 80b8d696ddc5f3e19eb3525937228eacba5a59c6 | from collections import defaultdict
"""
DEPRECATED. Using NLTK libraries now.
See pseudo_parser, stmt_parser and stmt_classifier.
"""
class Lexicon:
'''Simple default implementation of a lexicon, which scores word,
tag pairs with a smoothed estimate of P(tag|word)/P(tag).'''
# Builds a lexicon from the observed t... |
15,199 | a380b9726afdb86864a3b1b8afe96086928ce7f0 | import time
from selenium.webdriver.common.by import By
from base_page_object import BasePage
from nose.tools import assert_equal, assert_true
class CreateTaskPage(BasePage):
locator_dictionary = {
"create_task_header": (By.XPATH, "//span[.='Set a task']"),
"task_name_field": (By.XPATH, "//input[@... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.