index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
997,400 | c46ed962ad51bb04d572ecd7b21d0ea41c9b40a4 | # Does it appear that our data might be coming iid from some distribution?
# Plot the appearance of new things vs. bootstrapped iid samples
import numpy as np
import re
import matplotlib.pyplot as plt
def iidPlots(fileName, numReps, fileDesc):
# Read file
f = open(fileName, "r")
data = f.read()
dataLi... |
997,401 | 2e86513e5a07a84f6851c7bbb305071074214e8e | """
The setting of Superb IC
Authors
* Wei-Cheng Tseng 2021
* Leo 2021
* Leo 2022
"""
import logging
import pickle
from pathlib import Path
import pandas as pd
import torch
from omegaconf import MISSING
from torch.utils.data import Dataset
from s3prl.dataio.corpus.fluent_speech_commands import FluentSpeechCom... |
997,402 | ef266bdc14e1f210f042b9d9d4c8b937cca49c2a | import idom
@idom.component
def AndGate():
input_1, toggle_1 = use_toggle()
input_2, toggle_2 = use_toggle()
return idom.html.div(
idom.html.input({"type": "checkbox", "onClick": lambda event: toggle_1()}),
idom.html.input({"type": "checkbox", "onClick": lambda event: toggle_2()}),
... |
997,403 | b4aa976c054cf33c1425980ff324ca2e155e8771 | from django.conf.urls import url
from . import views
from django.conf.urls.static import static
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
url(r'^$',views.index,name='index' ),
url(r'^category/(?P<category_id>[\w\-]+)', views.category,name='category'),
url(r'... |
997,404 | 516e7904a5330c90c8137dc88195fe54a6d91c78 | __version__ = "0.1.1f"
|
997,405 | cfd2f476c43918dcbe2320191e3fcb2cb0eb45f6 | from django.contrib import admin
from ennarroot.models import Admin_list,Products
# Register your models here.
admin.site.register(Admin_list)
admin.site.register(Products)
|
997,406 | cd38449c208cc547988e49a67887a52d527a8e52 | def vatcalculate(totalPrice):
result = totalPrice+(totalPrice*7/100)
return result
totle = int(input("ราคาสินค้า : "))
print(vatcalculate(totle)) |
997,407 | ba3cde87b297e5cfacc6156579fd9516cca560ec | """ the omdb module """
from .exceptions import (
OMDBException,
OMDBLimitReached,
OMDBNoResults,
OMDBTooManyResults,
)
from .omdb import OMDB
__author__ = "Tyler Barrus"
__maintainer__ = "Tyler Barrus"
__email__ = "barrust@gmail.com"
__license__ = "MIT"
__version__ = "0.2.1"
__url__ = "https://github... |
997,408 | ff9b49bfcf0d98c7a8cfeab4decb837615589392 | from encryptor import Encryptor
if __name__ == '__main__':
key = b'\xa2\x8a\x84\xd4\xe6\xb4\x7f\x13\xbc\x01\x04\x83\xf5N\x0bg'
enc = Encryptor(key)
enc.encrypt_file('plain_video.mp4')
# enc.decrypt_file('plain_video.mp4.enc') |
997,409 | 1a1ca666b15d388180bcf8399f32632e81c797ff | #-*- coding: utf-8 -*-
from odoo import models, fields, api
class MeetingsTask(models.Model):
_name = 'meetings'
_inherit = ['meetings','mail.thread']
user_id = fields.Many2one('res.users', 'Organizador')
date_deadline = fields.Date('Fecha Reunion')
participantes_estimados = fields.Integer('Cupo de ... |
997,410 | 970fdd6f8141a5a9429009554637914247782310 |
# coding: utf-8
# In[2]:
#import pakeage
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
import matplotlib
get_ipython().run_line_magic('matplotlib', 'inline')
matplotlib.style.use('ggplot')
import seaborn as sns
# In[3]:
data = pd.read_csv('character-deaths.csv')
... |
997,411 | ec941cd3dcacbaceebc88b578550c912b327a338 | import unittest
from pybinson.binson_bytes import BinsonBytes
from pybinson.binson_integer import BinsonInteger
class TestBinsonBytes(unittest.TestCase):
def test_sanity(self):
bytes_rep = bytearray(b'\x18\x01\x01')
bytes_val, consumed = BinsonBytes.from_bytes(bytes_rep, 0)
self.assertEq... |
997,412 | 49879e99bf95c0344e84aa4885fc806fda64cfee | from twisted.cred import portal, checkers, credentials
from nevow import inevow, guard
from axiom import userbase
from axiom import dependency
from zope.interface import implements
class AdminRealm(object):
"""Returns the admin login page for anonymous users, or the admin main page for logged in users"""
imple... |
997,413 | 54093d1069cdf11b5417d26ecc5baeeef2da0aa4 | import numpy as np
import matplotlib.pyplot as plt
# skapar funktionen f(x) = x^2
def f(x):
return x**2
x = np.linspace(-1,1)
plt.plot(x, f(x)) # ritar kurvan
plt.show() |
997,414 | 8a8e02f64853305594d9d76707d756cb201ac89b | import glob
import json
import os
import pprint
science_goals = glob.glob("science_goal*")
all_flag_info = {}
for sg in science_goals:
# walk only the science goals: walking other directories can be extremely
# inefficient
for dirpath, dirnames, filenames in os.walk(sg):
if dirpath.count(os.path.... |
997,415 | e282175c37e6ca15da042b2671a5f38230f6fd13 | # -*- coding: utf-8 -*-
import os
from zipfile import ZipFile
from tempfile import TemporaryDirectory
from typing import Tuple, List, Callable, Sequence
import pickle
import dawg
import numpy as np
def _lazy_property(fn):
'''Decorator that makes a property lazy-evaluated.
'''
attr_name = '_lazy_' + fn._... |
997,416 | 21c18ccfedec6b27d9d23a1282fc14c3f265031b | # # Import numpy and set seed
# import numpy as np
# np.random.seed(123)
# # Use randint() to simulate a dice
# np.random.randint(1,7)
# # Use randint() again
# np.random.randint(1,7)
# #######################################################################################################
# # Numpy is i... |
997,417 | e30007f03aa5c043225c4ab86e51e9348adbf562 | import nltk
from nltk.tokenize import word_tokenize
from nltk.corpus import stopwords
from nltk.tokenize import RegexpTokenizer
from nltk.probability import FreqDist
print ("********************************************************************")
print ("* ... |
997,418 | 41071f6f9bb8c6d5a5dba810f85672e2e34d2861 | import os
from unittest.mock import patch
from pytest import fixture, mark
from ..bitbucket import BitbucketOAuthenticator
from .mocks import setup_oauth_mock
def user_model(username):
"""Return a user model"""
return {
'username': username,
}
@fixture
def bitbucket_client(client):
setup_o... |
997,419 | b77c94ac6d5265fc0f6c7d8722a15682d39f20fc | # This script is copyright 2018 Jordan LeDoux and may not be used or distributed without permission
import praw
import settings
import calendar
import SlackWebHook
import sys
from datetime import datetime
from datetime import timedelta
from datetime import timezone
reddit = praw.Reddit(client_id=settings.REDDIT_CLIE... |
997,420 | c3a094945ab42ac3b7bb580a444c20feb14bc0ed | # from video_app.constants import VIDEOS
# from elasticsearch_dsl.connections import connections
# from elasticsearch_dsl import Document, Text, Date
# from elasticsearch_dsl.field import Integer
# from elasticsearch.helpers import bulk
# from elasticsearch import Elasticsearch
# from . import models
# connections.cre... |
997,421 | 7038e70b1f47de910b1939abaf275cddb4ecbcc9 | from collections import Counter
from datetime import datetime
from datetime import timedelta
from datetime import date
import pytz
import github3
from github_project_management import constants as GPMC
from github_project_management import get_server
from github_project_management import list_issues
from github_proje... |
997,422 | c5f89ef75c670988498dbeb7002d24f2037855e5 | import matplotlib.pyplot as plt
list1 = [4793,10776,15302,6373]
list2 = [0,1]
for i in list1:
plt.plot([0,16],[i,i],linewidth=1,c='grey')
for i in range(0,16):
plt.plot([i,i],[0,16000],linewidth=1,c='grey')
li = [
[0,1],
[0,list1[0]]
]
for i in range(1,8):
lia = list(li)
lia[0][1]=i
lia[1][1... |
997,423 | 581a81c79abe9df51473f2b73ac1c145b997be47 | from sqlalchemy.engine import create_engine
from sqlalchemy.inspection import inspect
from sqlalchemy.sql.expression import select, desc, and_
from sqlalchemy.sql.functions import func
from sqlalchemy.sql.schema import MetaData, Table
from cybertrap.dbconst import *
import pandas as pd
from pandas import DataFrame
f... |
997,424 | 2e8de9a68e16ea59ec04d126f7c2dd5ab264997c | class ApplicationSummary(models.AbstractModel):
_name = "report.housemaid.app_sum_rep"
_description = "Application Supmmary"
@api.model
def _get_report_values(self, docids, data=None):
if data['from_date'] and data['from_date']:
domain = [
('tran_date', '>=', data['... |
997,425 | d52f0e917307fe84ead015b34dd428d4e06b73ea | import numpy as np
import cv2
def click_event(event, x, y, flags, param):
if event == cv2.EVENT_LBUTTONDOWN:
blue= img[x,y,0]
green= img[x,y,1]
red= img[x,y,2]
cv2.circle(img, (x,y),3,(0,0,255),-1)
mycolorImage=np.zeros((512,512,3),np.uint8)
mycolorImage[:]... |
997,426 | f6f870437c00db076765e60db97b0fa82b5fdc5b | # imports
from flask import Flask, redirect, url_for
app = Flask(__name__)
# user redirect
@app.route('/user/<name>')
def user_page(name):
if name == "nahum":
return redirect(url_for('admin_page', name=name))
else:
return redirect(url_for('guest_page', name=name))
# admin page
@app.route('/... |
997,427 | e68f083b2b65359e0ed3fd0794ef6bf7f5df9676 | # coding: utf-8
from openerp import api, fields, models, tools, _
from openerp.exceptions import Warning
from io import open
import base64
import os
import re
import time
try:
import pysftp
except ImportError:
raise ImportError(
'This module needs pysftp to write files through SFTP. Please install pysf... |
997,428 | 28698afdaae82536271675d26d97263abadeffa8 | from tkinter import *
from Controller import GemController
class BoardView:
"""
The class responsible for the graphical representation of the playing field.
Visualizes the menu in the game.
"""
_BACKGROUND_MENU_COLOR = "#DADEEB"
_MENU_BUTTON_SIZE = 12
def __init__(self, root... |
997,429 | cb9bd939fe334e215b0c3697427718d83c96b278 | #!/usr/bin/env python3
"""
Script language: Python3
Talks to:
- Vega wallet (REST)
- Vega node (gRPC)
Apps/Libraries:
- REST (wallet): Vega-API-client (https://pypi.org/project/Vega-API-client/)
- gRPC (node): Vega-API-client (https://pypi.org/project/Vega-API-client/)
"""
# Note: this file uses special tags in com... |
997,430 | f2451700fe0caf954f22ef4006b77c1495eee381 | from importlib import import_module
from .nlp import print_tree
from .parser_en import ParserEN
from .text import edge_text
def create_parser(lang=None, parser_class=None, lemmas=False, corefs=False,
beta='repair', normalize=True, post_process=True):
"""Creates and returns a parser (as an insta... |
997,431 | af0fbb26cb0742800630c7245cc306384ed74bb8 | import csv
import pandas as pd
faculty = pd.read_csv('faculty.csv')
#print faculty
namesFL = faculty.name
faculty1 = pd.read_csv('faculty.csv')
dte = faculty[[' degree', ' title',' email']]
def get_col(filename, col_num):
files = csv.reader(open(filename,"rb"),delimiter=',')
next(files)
degree = []
for row in... |
997,432 | 9404b787cc50bdfecb9a9b7c69a4d3d2c644fc2d | # NEED this to be sourced before
#voms-proxy-init -voms cms
#export X509_USER_PROXY=$(voms-proxy-info --path)
#export PYTHONPATH=/afs/cern.ch/cms/PPD/PdmV/tools/wmcontrol:${PYTHONPATH}
#export PATH=/afs/cern.ch/cms/PPD/PdmV/tools/wmcontrol:${PATH}
# source /afs/cern.ch/cms/PPD/PdmV/tools/wmclient/current/etc/wmclient.s... |
997,433 | 905510db1d49c5f0e090aca87d91cd6af1eb012e | '''
Created on 16.04.2014
@author: martin
'''
from numpy import *
from uncertainties import ufloat
def make_LaTeX_table(data,header, flip= 'false', onedim = 'false'):
output = '\\begin{table}\n\\centering\n\\begin{tabular}{'
#Get dimensions
if(onedim == 'true'):
if(flip == 'false'):
... |
997,434 | 9f515ef80e2a08949d119da87a4010a13f07ded3 | from django.db import models
class description(models.Model):
book_name=models.CharField(max_length=50)
book_price=models.IntegerField(default=0)
book_author=models.CharField(max_length=60)
def __str__(self):
return self.book_name
|
997,435 | e32021746ebdaf697d194ee515c6902354706ed3 | def reverse_bits(n):
res = 0
for i in range(32):
res <<= 1
res += n % 2
print res
n >>= 1
return res
if __name__ == '__main__':
n = 43261596
print reverse_bits(n)
|
997,436 | edc6f289550a7b4efc8aab9e494480b779a13047 | from django.shortcuts import render
from rest_framework.views import APIView
from rest_framework.parsers import MultiPartParser, FormParser
from rest_framework.response import Response
from rest_framework import status
from .serializers import RegisterSerializer
from .models import User
# Create your views here.
cla... |
997,437 | 87e0a54dcfe617cd608359f3f2d0bff2e85e9441 | def set_fv_geom(mlat,nlon):
# Sets the geometric factors used in FV core for the lat-lon grid
# This is based on fv_pack.f90 in the AM2 source code, initially
# edited by Andrew Shao (andrew.shao@noaa.gov)
import numpy as np
pi = 4.*np.arctan(1.)
# Set aliases for trignometric functions
lonb = np.zeros(nl... |
997,438 | 81daa486f04bc4764f268bfe0cc959535eee4bec | from download import download
import MeCab
import pickle
download("http://www.cl.ecei.tohoku.ac.jp/nlp100/data/neko.txt", "neko.txt")
with open("neko.txt", mode="r") as f:
neko = f.read()
mt = MeCab.Tagger("-d /usr/lib/x86_64-linux-gnu/mecab/dic/mecab-ipadic-neologd/")
parsed = mt.parse(neko)
with open("neko.tx... |
997,439 | da50d9582ac24397462e7a43c10f22243c51bd66 | import torch
import torch.nn as nn
from torch2trt.torch2trt import *
from torch2trt.module_test import add_module_test
import numpy as np
import ctypes
try:
ctypes.CDLL('libtorch2trt_plugins.so')
def create_example_plugin(scale):
registry = trt.get_plugin_registry()
creator = registry.get_pl... |
997,440 | dc32b9242679a36d19562121ca9a143a4a4ca083 | # Copyright 2021 Garena Online Private Limited
#
# 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 or agr... |
997,441 | 4611991674b5109db5b7b18a95cce0087f3f2304 | #!/usr/bin/env python
import rospy
import random
from hri_api.entities import Person, World, Saliency
from zoidstein_hri.zoidstein import Zoidstein, Expression, ZoidGestureData
from hri_api.query import Query
import time
# Initialize objects
world = World()
robot = Zoidstein()
people = [Person(1), Person(2), Person(3)... |
997,442 | 989eaa12ae4078a6faa49077b380981b10d2d13c | import os, json
def parse_opt(opt_path):
with open(opt_path, 'r') as f:
opt = json.load(f)
# export CUDA_VISIBLE_DEVICES
if opt['use_gpu']:
gpu_list = ','.join(str(x) for x in opt['gpu_ids'])
os.environ['CUDA_VISIBLE_DEVICES'] = gpu_list
print('===> Export CUDA_VISIBLE_DEVI... |
997,443 | 60e4b802281cdf66f43af2e02edd210f3dc39a5f | from django.shortcuts import render
# Create your views here.
from django.contrib.auth.decorators import login_required
from .models import Prescription
@login_required(login_url='/login/')
def eprescription(request, template_name='pages/eprescription.html'):
ctx = {}
hadm_id = request.user.hadm_id
prescription ... |
997,444 | f7b61278acceab4e03121f66d4244d781d2a01c7 | # Deep Knowledge Tracing (Plus)
#
# Paper: Chun-Kit Yeung, Dit-Yan Yeung
# Addressing Two Problems in Deep Knowledge Tracing via Prediction-Consistent Regularization
# arXiv:1806.02180v1 [cs.AI] 6 Jun 2018
#
#
# For further reference:
#
# 1. Paper: Chris Piech, Jonathan Spencer, Jonathan Huang, et al.
# D... |
997,445 | d514938370232370a63b213b374f2de288b22f23 | import math
def evenarray(*args, **kwargs):
if len(args) == 2:
lower = 0
upper = args[0]
length = args[1]
elif len(args) == 3:
lower = args[0]
upper = args[1]
length = args[2]
else:
raise ValueError("Evenarray takes 2 or 3 args.")
include_lower = kwargs.get('include_lower', True)
include_upper... |
997,446 | 221baf93ac6bb3b763c64e3dec4f20b677dc6dfb | # To add a new cell, type '# %%'
# To add a new markdown cell, type '# %% [markdown]'
# %%
import bitalino # pylint: disable=E0401
import time
import BITalino
import numpy # pylint: disable=E0401
import requests # pylint: disable=E0401
# %%
# Set variables
srate = 1000
channels = [0]
nframes = 100
threshold = 5
#... |
997,447 | cd8d88113b239409b3d23b92381b31822481d453 | #All variables from Fokker 100 Data sheet
#Everything defined as meter, Newton, or deg
C_a = 0.505 # [m]
l_a = 1.611 # [m]
x_1 = 0.125 # [m]
x_2 = 0.498 # [m]
x_3 = 1.494 # [m]
x_a = 0.245 # [m]
h = 0.161 # [m]
t_sk = 0.0011 # [m]
t_sp = 0.0024 # [m]
t_st = 0.0012 # [m]
h_st = 0.012 # [m]
w_st = 0.017 # [m] ... |
997,448 | 45a4aa24961cd5a486e86ac316330f5b34745c13 | #!/usr/bin/env python
import hashlib, os, sys, stat, time, gdbm
# TODO exclude and include filters
# CONSTANTS:
# This list represents files that may linger in directories
# preventing this algorithm from recognizing them as empty.
# we market them as deletable, even if we do NOT have other
# copies available:
del... |
997,449 | 5482664e5ec937137344333aa3a4965387e71d64 | from mdp_util import print_policy,generate_small_mdp,print_action
import mdptoolbox.example
import matplotlib.pyplot as plt
import numpy as np
def small_value_iteration(P,R):
epsilon_list=[0.01,0.001,0.0001,0.00001]
x_ticks=np.array([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])
num_iter_list=[]
... |
997,450 | 243fa4787ef4d1ed1d703b60c139f29d923bfd30 | T = open("sample.txt", "r")
d = dict()
for line in T:
line = line.strip()
line = line.lower()
words = line.split(" ")
for word in words:
if word in d:
d[word] = d[word] + 1
else:
d[word] = 1
for k ... |
997,451 | e910992988c808631d27d162d278fb0f3cd87e58 | # encoding: utf-8
import boto3
from config import auth_config
from config import config
class AthenaConnector(object):
"""
"""
def __init__(self):
self.region_name = config.region_name
self.aws_access_key_id = auth_config.aws_access_key_id
self.aws_secret_access_key = auth_con... |
997,452 | ba9bcf4d584ad1c421efa6edfbfc9dd26884fe74 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/10/27 上午 11:27
# @Author : Aaron Chou
# @Site : https://github.com/InsaneLife
import numpy as np
out_path = "./vocab/google_in_vocab_embedding.npy"
ss = np.load(out_path)
new = []
for each in ss:
new.append(np.array(each))
new = np.array(new)
out... |
997,453 | 43d6569a45f6ada64a1d82440d2e6a857448b055 | class Node(object):
def __init__(self, value):
self.value = value
self.next = None
def swap_nodes(head, left_index, right_index):
# Values to swap
node = head
position = 0
while position <= right_index:
if position == left_index:
left_data = node.value
if position == r... |
997,454 | b3ee57ace00237ca7612ea2ccf643e72ef9e32db | TEMPLATE_p1="""
/* ****** ****** ****** ****** ****** ****** ****** ****** ****** ******
MBMC - Tracer POST-HOOK (C) CMU SEI 2013: Will Casey, Jeff Gennari,
Jose Morales, Evan Wright, Jono Spring.
Michael Appel
N... |
997,455 | 58520ac8720c356479893658cf37b5346012d55b | # Licensed under the MIT license
# Copyright (c) 2016 Yves Van Belle (yvanbelle@brother.be)
import os
import sys
import glob
import socket
import cherrypy
from xml.dom.minidom import parseString
from mail_pdf_att import mail_with_pdf
import tesseract_ocr
import barcode2pdfs
import move_files
HTTP_PORT = 9999
IP_ADDR... |
997,456 | 5ffacf3d7790994c5b448d8daff876c5f70ac079 | n = int(input())
arr = [list(map(int,input().split())) for _ in range(n)]
lst = sorted(arr,key = lambda x : x[2])
lst.insert(0,[0,0,0])
dp = [0] * (n+1)
dp[1] = lst[1][1]
res = 0
for i in range(1,len(lst)) :
max = 0
for j in range(i-1,0,-1) :
if lst[i][0] > lst[j][0] and dp[j] >= max :
max =... |
997,457 | 41dbb951d060e77e89067e8c641d6fe413d52dfe |
import numpy as np
import theano
from theano import tensor
from blocks.bricks import MLP, Rectifier, Softmax
from blocks.initialization import Constant, IsotropicGaussian
from blocks.bricks.cost import CategoricalCrossEntropy, BinaryCrossEntropy
from blocks.graph import ComputationGraph
from blocks.filter import Va... |
997,458 | b4647b69e1d30269870ab9da2109343cece36936 | # coding=utf-8
import requests
import dateutil
import dateutil.parser
import logging
from plugins.packagetracker.provider import Package
__author__ = "tigge"
class PostnordPackage(Package):
API_URL = "https://api2.postnord.com"
FIND_IDENTIFIER = (
API_URL
+ "/rest/shipment/v1/trackandtrace/... |
997,459 | 7a55bf87fa5f5efc8c2286f5f31d5937b6abe35c | import numpy as np
def gaussianGen(num_k, num_v, means, covs):
num = np.sum(num_v)
data = np.zeros(shape = (num, 3), dtype = np.float)
counter = 0
for i in range(num_k):
data[counter:counter+num_v[i], 0:2] = np.random.multivariate_normal(means[i], covs[i], num_v[i])
data[counter:counter+... |
997,460 | a709e83fcdf2e209b0eb2b9a0b6fc7acee42ea9a | import sys
import scipy.io
import numpy as np
#Load Data
#Do download the mnist_data.mat for label 7 and 8 (Handwritten Digits)
data = scipy.io.loadmat('mnist_data.mat')
#Understanding Labels and Data
#7 = 0
#8 = 1
label_index = {"7":0, "8":1}
#Categorising into corresponding values
trX = data['tr... |
997,461 | cf341a89700ee156b49f98f43d56385fdd780977 | # -*- coding: utf-8 -*-
"""
Created on Thu Jul 30 10:59:29 2020
@author: appedu
"""
from mcpi.minecraft import Minecraft
import random
mc = Minecraft.create()
x,y,z = mc.player.getPos()
for i in range(500):
r = random.randrange(1,5)
if r==1:
mc.setBlocks(x,y,z,x,y,z+5,1)
z=z+5
... |
997,462 | e183099efedc4dec417813a0a9fba4a4d3fa7416 | class Solution:
def minStartValue(self, nums: List[int]) -> int:
s= 0
m= 0
for i in nums:
s += i
m = min(m,s)
return 1-m |
997,463 | eeafea3ee221ab1d4940054107d58ce8b4ddb667 | from cargo import Cargo
cargo = Cargo(id='pipe',
type_name='string(STR_CARGO_NAME_PIPE)',
unit_name='string(STR_CARGO_NAME_PIPE)',
type_abbreviation='string(STR_CID_PIPE)',
sprite='NEW_CARGO_SPRITE',
weight='1.0',
cargo_payment_list_co... |
997,464 | f6fe122e63dee664a7fb1f37a3eae6eae406c0ff | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: tasdik
# @Contributers : Branden (Github: @bardlean86)
# @Date: 2016-01-17
# @Email: prodicus@outlook.com Github: @tasdikrahman
# @Last Modified by: tasdik
# @Last Modified by: Branden
# @Last Modified by: Dic3
# @Last Modified time: 2016-10-16
# MIT Li... |
997,465 | 9df725ba6c5e5d18e2072e95bbc0629e21c8a10b | import configparser
import os
class Controller(object):
"""A controller class for getting and setting key/value pairs in the config file
"""
section_default = 'BunqAPI'
def __init__(self):
"""Create an instance of a config controller for getting and setting information
:param section... |
997,466 | 13056696553c7c873432fb0c66f55fdbdc2aa774 | ###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Crossbar.io Technologies GmbH
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in ... |
997,467 | 240bf606c9825580221d33615c6835c0bf421d89 | # coding=utf-8
import collections
from django.db.models import Q
from applications.activity.share import expert
from applications.common.services import area_name
from applications.user.models import Area
from applications.work.models import Work
from applications.work.share import struct_work
from utils.co... |
997,468 | ec5e897cc76cd89fb47961fe67954ebfc81b0b02 | def mutate_string(string, position, character):
# As described in the question we can solve it in two ways.
# We will comment out one way i.e. using substring.
str_list = list(string)
str_list[position] = character
list_str = "".join(str_list)
# or the second way
# list_str = string[:positi... |
997,469 | 6ea5361d3ab57570520f3c36a3d150349a78c892 | import io
import unittest
import yaml
from backup_tool.pipeline import BackupPipeline
class PipelineTest(unittest.TestCase):
def setUp(self):
with open('pipeline.yaml') as f:
self.pipeline_data = yaml.load(f)
def test_load(self):
pipeline = BackupPipeline(self.pipeline_data['pipeline'], {})
def... |
997,470 | f105914d918fd5dd51930bc192935540a81edf3f | from django.contrib import admin
from users.models import Follow, UserCustom
@admin.register(Follow)
class FollowUsers(admin.ModelAdmin):
list_display = ('id', 'follower', 'author', )
list_display_links = ('id', 'follower', )
list_filter = ('follower', 'author', )
@admin.register(UserCustom)
class Custo... |
997,471 | e7e68fa17f5842a6691bf34bda96d7465e3c80fd | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 14 01:53:05 2019
@author: b18007
"""
#importing libraries
import numpy as np
ss=[]
l=0
#N=50
for i in range(100000):
birthday=list(np.random.randint(1,366,23))
#applying algorithm
#take elements from set of birthday..
#calculate no.... |
997,472 | 461c84781c32ef846f658e12a6958cfd47a1261c | import argparse
import yaml
import torch.backends.cudnn as cudnn
import torch
from PIL import Image
import numpy as np
import os
from sklearn import metrics
import matplotlib.pyplot as plt
from tqdm import tqdm
import ast
from itertools import product
from numpy.linalg import norm
from util import trainer_util, metric... |
997,473 | a67724a21e144a6024c6d8dfe7bce677ce5afa2b | # To change this template, choose Tools | Templates
# and open the template in the editor.
__author__="Tim Sobolewski (TJSO)"
__date__ ="$Sep 1, 2010 11:34:13 AM$"
__version__="2.1"
# Last addition: added writepidfile()
import os.path
import datetime
import os
debug = False
class Filewriter:
"A simple class f... |
997,474 | 9cd3a38d09b5ab44285615916a464eaea7720573 | """
Name: PatternDNA
Coder: HaoLing ZHANG (BGI-Research)[V1]
Current Version: 1
Functions:
(1) Initiate Pattern DNA from a DNA single strand or a protein;
(2) Get Information of the created Pattern DNA.
"""
import copy
from methods.inherent import *
# noinspection PyMethodMayBeStatic
class Patter... |
997,475 | fac3e8439eb2c5868833217539bc1f6c04e049f6 | from .models import person , Message , roomName
from rest_framework import serializers
class person_serializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = person
fields = ['image' , 'username' , 'password']
class Message_serializer(serializers.HyperlinkedModelSerializer):
clas... |
997,476 | 4f0fff11fd04aaf174d3bc7074205845edbcbaaa | """Custom briefy.alexandria events for model Collection."""
from briefy.alexandria import logger
from briefy.ws.resources import events
class CollectionCreatedEvent(events.ObjectCreatedEvent):
"""Event to notify collection creation."""
event_name = 'collection.created'
logger = logger
class CollectionU... |
997,477 | 88b8606b06f375ef3e8ba70201571a39a09ae4b8 | '''
Generates recommendation for the user based on
bmi, smoking, tobacco usage, alcohol consumption, exercise
travel time, sleep time, job type.
'''
import csv, re
featureWeights_dict={}
healthy_bmi = 0
moderate_travel = 1
excess_travel = 2
low_sleep = 0
moderate_sleep = 1
no_exercise = 0
moderate_exercise = 1
... |
997,478 | b4ec87589b5a5dc6e6a9f8ceaea0a3868dadf0af | class osztaly():
def __init__(self, *args, **kwargs):
super(osztaly, self).__init__(*args, **kwargs)
initial = kwargs.pop('initial')
self.valtozo = initial['valtozo']
#instance = osztaly(initial={"valtozo": "ertek"})
#print (instance.valtozo)
'''
def test(*args, **kwargs):
initial = kwar... |
997,479 | 3545f0e6995ed0570d1cbf22b6203ad1c5c63c9f | import featuretools as ft
import categorical_encoding as ce
from featuretools.tests.testing_utils import make_ecommerce_entityset
def create_feature_matrix():
es = make_ecommerce_entityset()
f1 = ft.Feature(es["log"]["product_id"])
f2 = ft.Feature(es["log"]["value"])
features = [f1, f2]
ids = [0, ... |
997,480 | 18faaa9298baa632efbfdd1c593673d878ecf7a8 | import os
import sys
import yaml
config_file = "config/certman-sample.conf"
def load_config(config_file):
if os.path.isfile(config_file):
with open(config_file) as config_file:
config = yaml.load(config_file, Loader=yaml.FullLoader)
return config
else:
print('Config fil... |
997,481 | 9881374f9704dca54d8eea42fba44477d89d15f3 | # Enter your code here. Read input from STDIN. Print output to STDOUT
for _ in range(int(input())):
ip = input().split()
try:
a, b = int(ip[0]), int(ip[1])
result = a/b
print(result)
except ValueError as e:
print("Error Code:", e)
# print("Error Code:", e)
except ... |
997,482 | 4031384487e30db3258e6aff25516c3f96a809aa | #BaseNet contain basic functions exists in alny other classes. Nothing fancy. For example, get parameters, init weights
import torch as t
import torchvision as tv
import torch.nn.utils.parametrizations
import numpy as np
import math
import lib
class BaseNet(t.nn.Module):
def __init__(self):
super(BaseNe... |
997,483 | bcbacacc17842d6199846cb82699268915eda0f5 | n = int(input())
a = n // 11
b = n - a * 11
if (b == 0):
ans = a * 2
elif (b <= 6):
ans = 1 + (a * 2)
else:
ans = 2 + (a * 2)
print(ans) |
997,484 | 37248372cbba905157fd3f9d5ecc1c193881b72c | # from VideoInfo import Mp4Url
# mp4 = Mp4Url('http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4')
# mp4.getAll()
# print(mp4)
from temp.jpeg import Jpeg
j = Jpeg.from_file(
r"C:\\Users\\kentxxq\Desktop\\a01de1df06bbc2563316d5e579cb9b79_1200x500.jpg"
)
print(j.segments)
|
997,485 | 444176091686e5189f43e2c4931c724fa587df42 | # -*- coding: utf-8 -*-
# file: tests.py
# author: JinTian
# time: 17/04/2017 2:40 PM
# Copyright 2017 JinTian. 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
#
# ht... |
997,486 | 19b522684bc575dd531e0e07291bfe0938c762c7 | # -*- coding=utf-8 -*-
import os
import cv2
from tqdm import tqdm
import subprocess
img_size = (3840, 2160)
img_det_dir = '../../mmsr_dest/'
assert os.path.exists(img_det_dir), "出错, 路径{}不存在。。。 ".format(img_det_dir)
# img_size = (960, 540)
# img_det_dir = '../../SDR_540p_jpg/'
dest_vids = '../../mmsr_dest_vids/'
if ... |
997,487 | 2f5c9a8a56b5d8a9cecfb49c82d123603327f236 | """ Helper functions for uploading image to Flickr """
import flickr_api
from django.conf import settings
from django.core.files.storage import FileSystemStorage
def handle_uploaded_file(uploaded_file, duck_id, duck_name, comments):
""" Upload duck location image to flickr """
title = 'Duck #' + str(duck_id) +... |
997,488 | a899e8df0199c4e409010c38b83f65f7e1a786f2 | """
You are given a non-empty list of words.
Write a function that returns the *k* most frequent elements.
The list that you return should be sorted by frequency from highest to lowest.
If two words have the same frequency, then the word with the lower alphabetical
order should come first.
Example 1:
```plaintext
I... |
997,489 | ab056435854a00949989a287be6b0719922227d5 | # Generated by Django 3.1.5 on 2021-06-24 02:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('utiles', '0008_cedula'),
]
operations = [
migrations.CreateModel(
name='Ruc',
fields=[
('id', models... |
997,490 | ff67c5845973edb64bd30487823a1ebbaf7bc27b | from flask import Flask, render_template, request, jsonify
import pyodbc
import redis
from flask import request
import time
import os
from datetime import datetime
import json
from datetime import timedelta
import random
import pandas as pd
import matplotlib.pyplot as plt
#port = int(os.getenv("VCAP_APP_PORT"))
port ... |
997,491 | 4c1d8e7e46e0a19ff5e2801cf00ffd792451c622 | # -*- coding: utf-8 -*-
"""
Created on Wed Oct 26 11:56:17 2016
@author: calum
"""
import numpy as np
import kcorrect
import math
array = np.load('/home/calum/Documents/MPhysProj/mgs_sample/mgs_kcorrect_array.npy')
# set things up
#kcorrect.load_templates()
#kcorrect.load_filters()
#Note that the conversion to the... |
997,492 | 2188e7cc63f366e8c9beaaa7e48625a1dbe94936 | __author__ = 'loic'
from sklearn.linear_model import LogisticRegression
from sklearn import preprocessing
class machine(object):
def __init__(self):
self.scaler = None
self.model = None
def train(self, X, Y):
"""
:param X: training sample X
:param Y: training sample c... |
997,493 | ff7b8d8bcf5e7ae8843e5cc646d9e6c8af1a079d | import pandas as pd
import numpy as np
from numpy.random import randn
np.random.seed(100)
data = randn(5,4) # 5행 4열
print(data)
df = pd.DataFrame(data, index='A B C D E'.split(), columns='가 나 다 라'.split())
print(df)
data2 = [[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16],[17,18,19,20]] # 5,4
df2 = pd... |
997,494 | fb7e36210bd6ea197b90fec898cccc655972b13a | #!/usr/bin/env python
import json
import os
def main():
python_interp = os.popen('which python').read().rstrip()
java_home = os.popen('/usr/libexec/java_home').read().rstrip()
google_ime = os.popen('which gskkserv').read().rstrip()
print(json.dumps({
'localhost': {
'hosts': [
... |
997,495 | 34c2245689b7772332747e62c28deddc9a6c992a | """
A set of tools which allow specifying a model consisting of sheets
organized in levels, and projections connecting these sheets. The
sheets have an attribute matchconditions allowing to specify which
other (incoming) sheets a sheet should connect to.
Instances of the LabelDecorator decorator are offered for settin... |
997,496 | 0ce1015c1c11924b58a06c69cc7c59e31ecfe116 | survey_obs = {
"resourceType": "Observation",
"id": "id",
"meta": {
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/instance-name",
"valueString": "Prapare Example [loinc]"
},
{
"url": "http://hl7.or... |
997,497 | 94c15b4c05bc1667ef75dd35bde697c1cd6c99d8 | import sqlalchemy
# The Postgres and SQLite driver has different syntax for parameterized SQL. SQLAlchemy handles that with the text()
# wrapper and gives us a driver neutral way of creating a new connection.
from sqlalchemy.sql.expression import text
import argparse
parser = argparse.ArgumentParser(description='Copy ... |
997,498 | b871f966b363fa825b376068cdb819c7debdd7bf | import os
import unittest
from carbon.hashing import ConsistentHashRing
class HashIntegrityTest(unittest.TestCase):
def test_2_node_positional_itegrity(self):
"""Make a cluster, verify we don't have positional collisions"""
ring = ConsistentHashRing([])
for n in range(2):
ring.... |
997,499 | 12cadc1e66718b5790fdbd342b9b11ae12210590 | import dataset
import xlrd
import math
import numpy as np
import matplotlib.pyplot as plt
# BOARDNAME = '04A3E2BD29' # name of the board
# CHEMICAL = 'NO2' # chemical (either IRR, IAQ, SO2, H2S, OZO, NO2, or CMO)
# INSTANTTEMP = 26.0 # the temperature at the moment of measurement
# INSTANTCURRENT = 2492 # the current ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.