index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
990,800 | 7015ce59d0cb65c1395c05f6b6f1b93f886ba29a | import statistics
import abc
from typing import Iterable, Sequence, Dict, List, Tuple, Union
from classify_text_plz.dataing import MyTextData, DataSplit, MyTextDataSplit
from classify_text_plz.modeling import TextModelTrained, Prediction
from classify_text_plz.typehelpers import CLASS_LABEL_TYPE
class PlzTextMetric(a... |
990,801 | be77b0ab0edba64121d0689ec2b50924a8bb0e2a | def gcd(a, b):
if a == 0:
return b
return gcd(b%a, a)
def slv():
[n, l] = list(map(int, input().split()))
a = list(map(int, input().split()))
v = [0] * (l+1)
ref = -1
for i in range(l-1):
if a[i] != a[i+1]:
v[i+1] = gcd(a[i], a[i+1])
ref = i+1
break
for i in range(ref-1, -1, -1):
v[i] = a[i] // ... |
990,802 | 59fa6784dda8927332d5905ecc1823f5e22a597f | from sklearn.datasets import load_iris
import pandas as pd
##data = load_iris()
##data = list(data
##print(data)
url = "https://raw.githubusercontent.com/jbrownlee/Datasets/master/iris.csv"
names = ['sepal-length', 'sepal-width', 'petal-length', 'petal-width', 'class']
dataset = pd.read_csv(url, names=names)
df = pd.D... |
990,803 | 4f6808e960c662aefae4a374e1f13d48d7572117 | '''
Created on Oct 11, 2015
@author: Kris Stanton
'''
import os
import zipfile
import sys
import datetime
import json
import CHIRPS.utils.configuration.parameters as params
import CHIRPS.utils.locallog.locallogging as llog
import CHIRPS.utils.db.bddbprocessing as bdp
# Utils
# Set of functions that when used toget... |
990,804 | 974497ae23b6618efde2c88817297a3d8030c76b | # encoding : UTF-8
from .input_actions import *
from .input_presets import *
from .general_settings import *
from .input_identifiers import *
|
990,805 | 9364ac4b44ad23fb815aeeb4e834794ab4203dd7 | import pygame
from random import *
class Character:
def __init__(self, location_x = 0, location_y = 0, color = [255, 255, 255], size_x = 10, size_y = 10, keys = [False, False, False, False], character = pygame.image.load("img/blue.png"), dead = False, deadticks = 0, speed = 0, car = False, invticks = 0, me... |
990,806 | addf619d0f755678d49b824ec2d159cdd3857028 | import streamlit as st
import pandas as pd
import pickle
import scipy.sparse
from sklearn.neighbors import NearestNeighbors
st.title("BOOK TALK")
books= pickle.load(open('booknew.pkl','rb'))
cosine_sim = pickle.load(open('simnew.pkl','rb'))
rating_pivot = pickle.load(open('rating_pivot2.pkl','rb'))
rating_matrix = sc... |
990,807 | a317ec4b947ce08da3874335832edc92f63acc4e | import sys
print "hello"
try:
sys.exit(1)
except SystemExit:
print "exception in try catch"
# will be print
print "there" |
990,808 | 9b522e2b406c44e2fba4e7979ce0835b5024f067 | import cv2
from keras.models import model_from_json
import json
import numpy as np
import config
size = config.vehicle_classifier_input_size
model_arch = config.vehicle_model_json
model_weight = config.vehicle_model_weight
label_path = config.vehicle_car_label
def load_model():
with open(model_arch, 'r') as file... |
990,809 | 9c12e1ddc9d8cc9673af9554d2efe05b344494c3 | from docutils import nodes
from docutils import statemachine
from sphinx.util.compat import Directive
class AttrDict(dict):
def __init__(self, *args, **kwargs):
super(AttrDict, self).__init__(*args, **kwargs)
self.__dict__ = self
def split_content(l):
parts = []
part = []
language = ... |
990,810 | 44ce17abe001ad5aefef5142083acdebd44820e7 | import re
import glob
import os
import mimetypes
import subprocess
class Video(object):
"""
"""
def __init__(self, filepath, name=None):
self.filepath = filepath
self.name = name
@property
def output_path(self):
return os.path.join(os.path.splitext(self.filepath)[0], "outp... |
990,811 | 656b0ed94ebae8850435b692619c59a841f9776f | #!/bin/python3
string=input('Put string: ');
key_len=input('Key length: ');
counter=0;
len_counter=1;
while len_counter <= int(key_len):
print('Key letter '+ str(len_counter) + ': ');
len_max=len_counter;
final_string='';
for n in string:
if n != ' ':
counter+=1;
if cou... |
990,812 | 81d1d56b90b4ccc9eec14db8ba7dd2ccc8534e98 | # -*- coding: utf-8 -*-
"""
Created on Thu May 22 14:2:21 2021
@author: e399410
"""
import time
import json
import re
import numpy as np
import scipy as sp
#matplotlib inline
import matplotlib.pyplot as plt
from collections import defaultdict
from sklearn.cluster import KMeans
from sklearn.preprocessing import Standar... |
990,813 | 30d49e59044546ce3b754e7a201dcf135f29a495 | # -*- coding: utf-8 -*-
"""serializers for api."""
from rest_framework import serializers
from .models import Task
class TaskSerializer(serializers.ModelSerializer):
"""Serializer class for Task model."""
state_display = serializers.SerializerMethodField()
class Meta:
"""Meta for TaskSerializer... |
990,814 | 27b04466e9879bccde444b471196d75e7970515b | from fractions import gcd
def read_num():
s = long(raw_input())
integer_pair = []
while s != 0:
pair = raw_input().split(' ')
integer_pair.append((long(pair[0]), long(pair[1])))
s -= 1
return integer_pair
def find_max(numbers):
numbers = sorted(numbers)
x, ... |
990,815 | 9b65876b438135bb26cae0b7fdf762fff241fd65 | import json
from abb import Robot
class ServerRobot(Robot):
def __init__(self):
Robot.__init__(self)
def connect(self, ip):
#self.robot.init_ant('172.20.0.32')
self.connect_motion((ip, 5000))
self.set_units('millimeters', 'degrees')
self.set_tool()
self.set_wor... |
990,816 | d5754c91a1ac613adbd3d324ee4980126d3d1faa | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from Base.application import db
"""
v_iterative,需要转换的查询结果
table_name,对应转换的字典表
column_name,对应转换的字典列
"""
def resultProxy_to_list_dicts(v_iterative, table_name, column_name):
li = []
sql = 'select * from set_dictionary where 1 = 1'
if table_name is not None and ... |
990,817 | 4e380cc042767143ac96f6a81af11030f2e5b7b2 | #Программа Игра окончена
#Самая первая программа
print ("Game Over")
input ("\n\nНажмите Enter, чтобы выйти.")
|
990,818 | dd03c23f0093af71fe767cae506726f365280d01 | # .-------------------------------------------------------------------------.
# | |
# | U T I L I T I E S |
# | |
# '... |
990,819 | 2d59fcd66ffde8dc8137c49d1a59e0abc50eb796 | from django.shortcuts import render
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
import traceback
import json
import datetime as dt
import requests
import os
import subprocess
def current_time():
return dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
indentation = " ... |
990,820 | 6567ae76b2e71a19fa57375077e9e8e50a9e0ce2 | """
SPT_AGN_Prelim_Sci_Mass_Plots.py
Author: Benjamin Floyd
This script generates the preliminary Mass trend science plots for the SPT AGN study.
"""
from __future__ import print_function, division
from itertools import product
import astropy.units as u
import matplotlib
import numpy as np
from astropy.cosmology im... |
990,821 | d3c46c262656f6ba1e5ac876fd6a249e966206c6 | # -*- coding: utf-8 -*-
import random
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from parser import parse
def gnormsort(n):
a = list(range(1, n + 1))
random.shuffle(a)
fig = plt.figure()
left = range(1, n + 1)
ims = []
g = 1
while g < n:
if a[g - 1] >=... |
990,822 | e24816da6a608287e7194ed2ec60c396ef5b3e86 | import csv
import math
import os
import time
import re
import sys
from re import match
from urllib.request import Request, urlopen
import pandas as pd
import numpy as np
import logging
import keyring
import pywin32_system32
import traceback
from timeit import default_timer as timer
from datetime import timedelta
from... |
990,823 | 8bf4b5300ab85ff79120f0cd61693445c6871584 | from fastapi import APIRouter, Depends, HTTPException, Body, Request
from sqlalchemy.orm import Session
from database.crmbdd import get_db, DbParams
from typing import List
from . import schemas
from . import models
from . import crud
from login.schemas import User
router = APIRouter()
""" @router.get("/api/rcarga... |
990,824 | d07388f62c5d045d17bda8793774c468d8a328a8 | import numpy as np
import pandas as pd
import sys
import matplotlib.pyplot as plt
def find_boarder(t):
b = []
for i in range(1, len(t)):
if np.any(t[i, :] - t[i-1, :]):
b.append(i)
return b
def plot(axarra, b, c1, c2, c3, variable):
bins = np.linspace(b[0], b[1], 10)
axarra.se... |
990,825 | b60ab85549cd8de46597586b0189b1b5169509f1 | import json
from datetime import datetime
class SafeJsonClass:
# ************************************************************
def dumps(self, obj):
return json.dumps(obj, default = custom_converted)
# ************************************************************
def loads(self, ob... |
990,826 | f365dc62052a0e995ea9a343486e451ca348c02f | #!/usr/bin/env python
import wx
# wx.App is the application object in wx
app = wx.App(False)
# wx.Frame(parent, id, title) is a top-level window
frame = wx.Frame(None, wx.ID_ANY, "Hello, World!")
# make the frame visible
frame.Show(True)
# start the event loop
app.MainLoop()
|
990,827 | 56696e0f8ef2878f5b4cf8eb08a65e01e8bdaa69 | '''
Copyright 2015 University of Auckland
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 agre... |
990,828 | 7df0b7136e11b300447a578b53efcb2191a65b5f | # Programa para calcular a média aritmética de uma lista de números (que podem ser ints ou floats).
numbers = [2, 7, 3, 9, 13]
def getMean(numbers):
return sum(numbers) / len(numbers) if numbers else None
out = getMean(numbers)
print(out) |
990,829 | 205b31cbdd06a0e164a1fcb75ff779701b029b0c | from .uploader import InterproUploader, InterproProteinUploader
from .dumper import InterproDumper |
990,830 | d2cbe778090a0cc8feefbc37398bd7e6e775e885 | """
121 / 121 test cases passed.
Runtime: 32 ms
Memory Usage: 14.9 MB
"""
class Solution:
def countHillValley(self, nums: List[int]) -> int:
stk = [nums[0], nums[1]]
ans = 0
for num in nums[2:]:
if num == stk[-1]:
continue
if stk[-2] < stk[-1] and stk[... |
990,831 | 3849fa063828e119efb497488224cffe097cbcda | file = open("ad1.txt", "r")
lista = []
x = file.read()
x = x.split("\n") #converting .txt into a list
ilosc_hasel = 0
for i in x:
i = i.split(" ")
szukana = i[1][0]
ilosc = i[0]
ilosc = ilosc.split("-")
a = int(ilosc[0])
b = int(ilosc[1])
hop = 0
if i[2][a-1] == szukana and i[2][b-1] !... |
990,832 | 169ce5191250415526ee086d046d5b75d3d6ec60 | #Jacob Pawlak
#February 15th, 2017
#Ladder
#https://open.kattis.com/problems/ladder
from math import *
def main():
building = input()
building_list = building.split()
height = int(building_list[0])
degrees = int(building_list[1])
rads = radians(degrees)
ladder = int(ceil(height / sin(rads)))
print(ladder)
ma... |
990,833 | fbaf055e31659587fc2f76110a789fee7d81328d | def check_user_upload_file_format(f):
if not f:
return False
header = f.readline().split(",")
if header[0].lower() != "time":
return False# it has to be time
if header[1].lower() != "biomass":
return False
length = len(header)
current = -1.0
for lines in f:
tr... |
990,834 | 8acba4395d89f24ca15466cf54ee060ce0e493b6 | # Generated by Django 3.1.4 on 2021-01-12 17:53
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('catalog', '0... |
990,835 | 481b1de6de8e2f3cdbacdad5a72764fa812d76f5 | #!/usr/bin/python
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
import codecs
import os, re, sys
here_doc_re = re.compile(r'.*\s<<[-]?(\w+)$')
func_start_re = re.compile(r'^[-\w]+\s*\(\)\s*$')
func_end_re = re.compile(r'^\}$')
var_assign_re = re.com... |
990,836 | 48cbadd3c806f855266bf3543c8775a44090ba05 | # dataset settings
dataset_type = 'S3DISDataset'
data_root = './data/s3dis/'
class_names = ('table', 'chair', 'sofa', 'bookcase', 'board')
train_area = [1, 2, 3, 4, 6]
test_area = 5
train_pipeline = [
dict(
type='LoadPointsFromFile',
coord_type='DEPTH',
shift_height=True,
load_dim=6... |
990,837 | 56aadad1598d29e927df4e5d25d60cc692bdf73b | # Generated by Django 3.2 on 2021-04-27 14:21
from django.core import validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('homepage', '0007_auto_alter_review_field'),
]
operations = [
migrations.AlterField(
model_name=... |
990,838 | d33d2b507331f3f0e3039c36e35e9cf037461832 | # Keep a dictionary ordered
# Can use an OrderedDict:
from collections import OrderedDict
d = OrderedDict()
d['foo'] = 1
d['bar'] = 2
d['spam'] = 3
d['grok'] = 4
for key in d:
print(key, d[key])
# Best used to precisely control the order of fields appearing in a JSON encoding:
import json
json.dumps(d)
|
990,839 | 2396840270c5885119a71b5e693c06de8cadad47 | import math
#NOTE: All computations done involving the y-coordinate here and in the simulator in
# general must be inverted since it is designed to be compatible with pygame.
# i.e. in pygame (0,0) is in the top left of the screen. Thus increasing y sends
# the point down the screen, and decreasing it ... |
990,840 | 829b93d21c0f7f1dee7ca2f3664854a0ebabd57f | from __future__ import print_function
import sys
hf, wf, n = [int(s) for s in sys.stdin.readline().split()]
outfield = [[0] * wf for _ in range(hf)]
for i in range(1, n+1):
h, w, r, c = [int(s) for s in sys.stdin.readline().split()]
if r == 0 and h < hf and w <= wf:
for y, x in [(y, x) for y in range(1... |
990,841 | 500ad33e88fbe4953424c7095ce55ad25b32f32e | '''
convert between formats, or interfaces of input and output
Author - Chaoren Liu
Date - Jan 25, 2016
'''
from PyQuante.Molecule import Molecule
from numpy import *
from elements import elements as elementsdict
def gjf2Molecule(filename):
gjf = open(filename, 'r').readlines()
moleculeQueue = []
filel... |
990,842 | d974b9ec3d2329e0db0c05d3f306613fa88bc04a | # This code takes a name from the user and
# prints out "Hello name!"
name = raw_input("Enter Your name! \n")
print "Hello", name
|
990,843 | 78d2a27c5f65c90e445710e0fc2241671988c97c | import copy
class YoungTableau(list):
def __init__(self, m, n):
self.row = m
self.col = n
def __len__(self):
return self.row * self.col
def insert(self, i, j, value):
list.insert(self, i*self.col + j, value)
def last(self):
index = self.row * self.col - 1
... |
990,844 | d290ae5e53c707f06df5ad60fc6ab35226b3bc42 | # Generated by Django 3.1.3 on 2021-04-08 13:16
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('ecommerce', '... |
990,845 | 4667d8e3cff1cd65f72659324a57e840e81e5ab8 | import unittest
from ...fileio import FileIO as psopen
from .... import examples as pysal_examples
from ..arcgis_dbf import ArcGISDbfIO
import tempfile
import os
import warnings
class test_ArcGISDbfIO(unittest.TestCase):
def setUp(self):
self.test_file = test_file = pysal_examples.get_path('arcgis_ohio.db... |
990,846 | f96e627da26eb84ca91efb23f9283b714c98edb6 | def mergeSort(A):
if len(A) > 1:
mid = len(A)//2
left = A[:mid]
right = A[mid:]
mergeSort(left)
mergeSort(right)
merge(left, right, A)
def merge(left, right, A):
i = j = k = 0
while i < len(left) and j < len(right):
if left[i] <= right[j]:
... |
990,847 | b25a2b64c9735f1e956d780a4e58a3a14f55fff9 | __author__ = 'liushuman'
import theano.tensor as T
from collections import OrderedDict
from numpy import *
from theano import *
cs = 3 # word window context size 4 RNN steps & 4*20 di vector
ne = 3 # number of emb & input
nh = 2 # number of hidden
de = 2 # dimensi... |
990,848 | 4137db1f6fbf4a82fa3b0c554f526e4502994bcb |
class Smoothie:
prices = {"Strawberries": 1.5, "Banana": .5, "Mango": 2.5, "Blueberries": 1, "Raspberries":1, "Apple": 1.75, "Pineapple": 3.5}
def __init__(self,ingr=list):
self.ingredients = ingr
self.tag = "Fusion" if len(ingr) > 1 else "Smoothie"
self.cost = sum(self.prices.get(fruit) for fruit i... |
990,849 | 02c1198c6184749e1fefecad684ade6d9fa189ce | import csv
import datetime
from app.models import *
from app import db
def create_publish_date(month_string, year_string):
try:
year = int(year_string)
month = int(month_string)
except:
return
if year_string and month_string:
if month > 12 or month < 1:
month = ... |
990,850 | cbea741394cbec706944924d4a41c19544fdc277 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2017-08-19 13:48
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('schedule', '0004_auto_20170721_0002'),
]
operations = [
migrations.AddField... |
990,851 | 11e202a4fb1a7f7590d13ca0b2b7b27e5e93801a | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
## Carlos Martín, Tran Tu
from math import exp, sin, pi
import numpy as np
import matplotlib.pyplot as plt
import scipy.integrate
from itertools import islice, imap
def nth(seq, n):
return seq[n]
def first(seq):
return nth(seq, 0)
def second(seq):
return ... |
990,852 | 8f30bf06978fc743c60ec28138c8fff13384571f | class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
pos = [-1 for i in range(0, 256)]
longest, left = 0, 0
for right in range(0, len(s)):
curr = ord(s[right])
if pos[curr] < left:
longest = max(longest, right - left + 1)
else:
left = pos[curr] + 1
pos[curr] = right;
return... |
990,853 | 7f844c2e0716fae8a0037fbf1a5d0bf6a3389207 | from ethereum import tester as t
from ethereum.tester import keys, accounts, TransactionFailed, ABIContract
from ethereum import _solidity
from ethereum.abi import ContractTranslator
# standard libraries
from unittest import TestCase
import os
import string
OWN_DIR = os.path.dirname(os.path.realpath(__file__))
class ... |
990,854 | b0383a99fd696247663d959107c27cb99b7763cf | from shutil import copyfile
import os
import numpy as np
import piezas as ps
import PIL.Image
import scipy.misc
from argparse import ArgumentParser
import logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s %(message)s');
PATHDATASET = 'db';
NAMEANOTATION = 'anotation'
NAMEDATASET = 'v001'
PATHOUTPU... |
990,855 | a793c4127d343e533fc45652c32365fe87cc17bf | import math
import random
import operator
from amp import Amp
from amp.descriptor.gaussian import Gaussian
from amp.model.neuralnetwork import NeuralNetwork
from ase import Atoms
from ase.calculators.emt import EMT
from ase import units
from ase.md.velocitydistribution import MaxwellBoltzmannDistribution
from ase.md i... |
990,856 | caedf4796ba6e51a7c29de79b3a8f610cc504248 | __author__ = 'pma'
from selenium.webdriver.common.by import By
from BaseComponent import BaseComponent
class SearchBar(BaseComponent):
selectors = {
'self': (By.ID, 'text'),
'input': (By.ID, 'text'),
'submit': (By.CLASS_NAME, 'suggest2-form__button'),
... |
990,857 | 51b0d6339026f540ce6aa437f3398dacee06fd6c | #!/usr/bin/env python3
#
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2018 IBM Corp.
import argparse
import sh
import os
import maintainers
from pprint import pprint
import requests
import json
from typing import List, Dict, Union, cast, Iterator
import sys
import itertools
git = sh.git.bake()
mailmap = {
... |
990,858 | ad42304b38d3ef16ae89f1acb1de9d535a359d9c | #!/usr/bin/env python
#
# Copyright (c) 2016 In-Q-Tel, Inc, 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
#... |
990,859 | cd00d99da676731f6e2cb6dc2f784eb65cd51e37 | # =============================================================================
# The class GmshIO provides basic IO basic functionalities for Gmsh
# using meshio and fenics.
#
# =============================================================================
import meshio
import os
import numpy as np
class GmshIO:
... |
990,860 | 6a2034d751995d4afb3e8cf42f51ab2bf969213d | class Solution:
# Time Complexity: O(n * log(sum of the array))
# Space Complexity: O(n)
def splitArray(self, nums: List[int], m: int) -> int:
"""
apply greedy with binary search
The range sum will be within min(arr) <-> sum(arr)
Therefore, we can choose a value between them ... |
990,861 | 2a8a9d387471ae7ad1a787533c89e0ff2e1bd667 | # Python 2.7
import pygame
from pygame.locals import * # importar para poder usar QUIT, keyUp, ...
import sys
import random
import time
pygame.init() # Para inicializar
fpsClock = pygame.time.Clock() # Para inicializar un reloj
sWidth = 1200
sHeight = 600
surface = pygame.display.set_mode((sWidth, sHe... |
990,862 | 50b642414a39c0a05c0455729f808b0b1a77cb6e | from libs.DataCollector import Collector
from libs.DataAnalyzer import DataAnalyzer |
990,863 | 758d9f9091462dedeec5f08926fad3503b585073 | #!/usr/bin/env python3
"""Time It Please: Easy command line timer.
"""
import sys
import os.path
from datetime import datetime, timedelta
FORMAT = '%Y-%m-%d %H:%M'
FILENAME = os.path.expanduser('~/.tip')
DAY_HOURS = 8 # Target hours for the day
class TimeFile(object):
"""A file containing time information... |
990,864 | a776ad2eacc0dba8b2944235979331dd0e506866 | print("broccolis are green, doesn't mean it's money!")
# if anyone asks, Nuhash said so.
|
990,865 | 2eb43aa8699613e09d58efe91b9102309662867b | from config import *
from dataloader_MNIST import DataLoader
from models import MLP
from activation_functions import ReLU
from optimizers import SGD,Momentum
def one_batch_overfit():
dl_train = DataLoader(
cfg.train_data_path,
cfg.nrof_classes,
cfg.dataset_type,
cfg.shuffle,
... |
990,866 | 7d00074703950374b785457909e46402b60c8991 | import config
from models import *
import json
import os
con = config.Config()
con.set_in_path("./benchmarks/WN18RR/")
con.set_work_threads(8)
con.set_train_times(40000)
con.set_nbatches(10)
con.set_alpha(0.1)
con.set_bern(1)
con.set_dimension(100)
con.set_lmbda(0.1)
con.set_lmbda_two(0.01)
con.set_margin(1.0)
con.se... |
990,867 | bb9ba43ba8abd65b3c4c566fe30a27cb507acdc3 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from base_data import root_path
from utils.util import latest_report
import importlib
import inspect
from iters.base_case import ApiIter
class Run:
def __init__(self, start_dir = root_path+'/test_case', pattern='test*.py'):
needed_excute_list = list(fil... |
990,868 | bf469523a5079f84786fcbceaa006c08fba750d3 | # coding: utf-8
# Laboratório de Programação 1 - 2017.2 UFCG
# Aluna: Júlia Fernandes Alves (117211383)
# Atividade: Ordem Alfabética - Unidade 4
# Recebe o quantitativo de palavras chaves.
quantidade_palavras = int(raw_input())
palavras = []
# Recebe e guarda as palavras informadas.
for n in range(quantidade_palavr... |
990,869 | a7004ca1f324052bc2a5b660544292c915953052 | from keras.models import Sequential
from keras.layers import Dense
from keras.models import model_from_json
from keras.preprocessing import image
import numpy as np
import cv2
json_file = open('model.json', 'r')
loaded_model_json = json_file.read()
json_file.close()
loaded_model = model_from_json(loaded_model_json)
#... |
990,870 | e20815a45ed7e56a443eeaa11bd14f6455f9e99f | """
operations on samples
"""
# this is temporary code that should be intergrated with the sampling and
# model building code from Presemt
import logging
import cPickle
import codecs
import collections
log = logging.getLogger(__name__)
import h5py
import numpy as np
import scipy.sparse as sp
from sklearn.utils im... |
990,871 | f75e4e7e5f0a378e7dd57acf04e8c51842219670 | from django.shortcuts import render
# Create your views here.
from django.urls import reverse_lazy
from django.views.generic import ListView, UpdateView, CreateView, DeleteView
from apps.cliente.models import Cliente
class ClienteListView (ListView):
model = Cliente
class ClienteUpdateView(UpdateView):
mod... |
990,872 | 1a187e87a742a0cb812a85b0df3de9364e20d5c2 | from .base import AppFiguresObject
from .base import AppFiguresGroupBy
class RevenueGroupBy(AppFiguresGroupBy):
def __init__(self, json, group_by):
super(RevenueGroupBy, self).__init__(json, group_by)
def _transform(self, data):
return RevenueObject.from_json(data)
class RevenueObject(AppFi... |
990,873 | 7f43a56e630fbdeb66a283d3e69ecf1524479b49 | w=str(input())
n=list(w)
w=int(w)
x=0
ans=""
for i in range(len(n)):
x+=int(n[i])
#print(x)
if x%9!=0:
ans+=str(x%9)
x=x-x%9
for i in range(x//9):
ans+=str(9)
#print (int(ans),w)
if w==int(ans):
#print("DFGH")
if len(ans)==1:
print(1,end="")
print(int(ans)-1)
elif len(ans)==2:... |
990,874 | f671034286208b3c806dcd4995086fd45be64512 | # __author__ = Vishu Kamble
"""
A python program to implement basic doublylinkedlist
"""
class doublyLinkedList(object):
def __init__(self, data):
self.value = data
self.nextnode = None
self.prevnode = None
a = doublyLinkedList(1)
b = doublyLinkedList(2)
c = doublyLinkedList(3)
a.nextnod... |
990,875 | f9ce34b886e0a9a1d319724b29137bb30233fe87 | from .nodeDimension import NodeDimension
class NodeQueryResult(object):
def __init__(self, **kargs):
self.node = kargs['node'] if 'node' in kargs else None
self.dims = list(map(lambda item: NodeDimension(**item), kargs['dims'])) if 'dims' in kargs else []
self.rows = list(map(lambda item: ... |
990,876 | 4f18196adf5e367cab26f0c814876b895a83ebbd | import time
import numpy as np
import tidy3d as td
from omegaconf import OmegaConf
import gdsfactory as gf
from gdsfactory.config import logger
from gdsfactory.serialization import clean_value_json
from gdsfactory.simulation import port_symmetries
from gdsfactory.simulation.get_sparameters_path import (
get_spara... |
990,877 | 4a1007a4f044c9965fe030fa8c36ea667d63c44d | from django.contrib import admin
from .models import *
list_tables = [com_1968, com_1975, com_1982, com_1990, com_1999, com_2006, com_2011, com_2016]
for table in list_tables:
admin.site.register(table) |
990,878 | a0a71f7141be8617cd32c968ed4e1c758f1f5d6f |
def binary_search(arr, target, start, end):
# Your code here
#Find the center of the array
middle = (start + end) // 2
#check to ensure no out of bounds issues
if start >= end:
return -1
#check to see if middle item is the target
if arr[middle] == target:
indx = middle
... |
990,879 | 8f4f440d8bc863f4d2c0762fc2a34c96c4c6e5a7 | #!/usr/bin/env python
import os
import sys
import re
import gzip
max_N = 20000
#max_N = 100
filename_fa = sys.argv[1]
f_fa = open(filename_fa,'r')
if( filename_fa.endswith('.gz') ):
f_fa = gzip.open(filename_fa,'rb')
sys.stderr.write('Read %s ... '%filename_fa)
seq_h = ''
seq_list = dict()
for line in f_fa:
... |
990,880 | 4ab33f2b51f5a8c0fb31c6cfcc11240f5c245a68 | import unittest
import os
import pprint
import json
import requests
import requests_mock
from raintale.storytellers.twitter import TwitterStoryTeller
testdir = os.path.dirname(os.path.realpath(__file__))
class TestFileTemplate(unittest.TestCase):
def test_generate_story(self):
mementoembed_api... |
990,881 | 2cad5a4cedc0072c0069e377648b1fff27707272 | from django.shortcuts import render
from django.http import HttpResponse
from .models import Users
# Create your views here.
def user_list(request):
all_users = Users.objects.all()
context = {
"all_users": all_users,
}
return render(request, "home.html", context) |
990,882 | 9cc2aae4b3193f40b07a7a5895dbc1c3bad8fbd5 | # 鏈結串列 -- 加入、刪除、修改及輸出
# File Name: SingleList.py
# Version
import sys
class Student:
def __init__(self):
self.name = ''
self.score = 0
self.next = None
current = None
prev = None
head = Student()
head.next = None
def loadFile_f(): # 讀取檔案
try:
inputFromFile = open('data.... |
990,883 | 507a4d91178326841ac4562c3b07d0d3abdf7731 | from typing import List, Dict, Union
def match_required_params(params: Union[Dict, List], required_params: List):
params = list(params if isinstance(params, list) else params.keys())
for i in required_params:
if i not in params:
return False
return True
|
990,884 | c908e534892b7c76b19f74cb754e50a293470d12 | # -*- coding: utf-8 -*-
import webapp2
#追加
from google.appengine.ext.webapp import template
def hello(request):
# return webapp2.Response("hello")
return webapp2.Response(template.render("index.html", None))
app = webapp2.WSGIApplication([('/', hello)]) |
990,885 | 1d429d70aa31e36462a31a6269f26e68f2b03885 | usrInput=int(input("Enter any number : "))
if usrInput > 0:
print("Number is > 0.")
elif usrInput < 0:
print("Number is < 0")
else:
print("Number is 0")
|
990,886 | 4ba6989f6d83aa844ec475ef302981f5b748c8b7 | import unittest
from microbits import MicroBits_27c4096 as MicroBits
class TestMicrobits(unittest.TestCase):
def test_microbit_construction(self):
mb = MicroBits(1)
self.assertEqual(mb.getLeftByteValue(), 32768)
self.assertEqual(mb.getRightByteValue(), 0)
mb = MicroBits(11)
... |
990,887 | 387a8b87b29c4c3312047de6604fb315898f936e | #!/usr/bin/python
title="Lokesh Vishwakarma"
|
990,888 | a251202eced1d7531b0fdac9f1efaef4db93872b | # -*- coding:utf-8 -*-
from httpUtil import gethtml
from httpUtil import parseHtmlBybs4
import locale
s = gethtml("http://www.sohu.com.cn")
print(s)
# # print(locale.getdefaultlocale())
# print(s)
# # print(isinstance(s, 'unicode'))
# s1 = s.decode('UTF-8', 'ignore')
#
# s2 = s1.encode('GBK', 'ignore')
# s3 = s2.deco... |
990,889 | bc4aff480a59eefd1d197a537ae8f8fe18868cdd | """
filename: analyze_extended_2d_scans.py
This script is meant to analyze data originating from four 2d scans of the magnetic field,
where the current configurations are (111), (100), (010) and (001) up to an overall factor.
Before each scan, the coils have to be demagnetized, such that the resulting field lies on
a... |
990,890 | 4332a10ca0d318a2874a5d614ee8c4a6752bba33 | import discord
import main
import ball
from main import ranks
def truncate(n, decimals=0):
multiplier = 10 ** decimals
return int(n * multiplier) / multiplier
client = discord.Client()
statslink = 'https://docs.google.com/spreadsheets/d/1fp0PyB2qnfwi9qT0g5Bbr_O0StlnQML-u7OF9iMWSj8/edit?usp=sharing'
... |
990,891 | 18130bd0e35173031d17f8c9eafb76fab4069661 | # This program may be used, executed, copied, modified and distributed
# without royalty for the purpose of developing, using, marketing, or distributing.
#
# defaultElasticityPoliciesHV - creates default Elasticity Polices
# @author - mcgillq
# Date Created: 4/12/2011
#
# Updated to handle VSYS.NEXT environment -... |
990,892 | c2c2db88024eb66738b48437ba698784aca9b45a | #coding: UTF-8
#time module
import time
current_time = time.time()
print(current_time)
current_struct_time = time.gmtime(current_time) #Convert time.time() to be readable
print(current_struct_time)
current_year = current_struct_time.tm_year #extract year from current_struct_time
current_month = current_struct_time.tm_... |
990,893 | d1449de4e3a1bb88a1f2418775f3b18e6767987c | def bounding_box(coords):
"""finds edges of bounding box"""
min_x = min(coords, key = lambda p: p[0])[0]
min_y = min(coords, key = lambda p: p[1])[1]
max_x = max(coords, key = lambda p: p[0])[0]
max_y = max(coords, key = lambda p: p[1])[1]
print(min_x)
print(min_y)
print(max_x)
print... |
990,894 | c7b1436aeb1fcd4d248087a5e1d8423cd554b2aa | import thinkstats2
pmf = thinkstats2.Pmf([1, 2, 2, 3, 5])
print(pmf) |
990,895 | e8e50588d181b211e1b0a7a23959686deb1ac8d9 | # ======================================================================
# Function: Data Access Object of PlayerInfo
# Author: Elvis Jia
# Date: 2016.5.30
# ======================================================================
from database.dao.base_dao import BaseDao
from info.player_info import PlayerInfo
class P... |
990,896 | 0ec6b7ef4e4feefac1524e6114e0c2560a16ac86 | import pygame, os, random, time, requests
from bs4 import BeautifulSoup
#getting random words from out sources
r = requests.get("https://www.hangmanwords.com/words")
soup = BeautifulSoup(r.text, "html.parser")
ul = soup.find("ul", {"class":"list-cols"})
lis = ul.findAll("li")
words = []
for li in lis:
wo... |
990,897 | 3f2a3b73eb0b061c1875e0278aecd16f5001ea01 | from flask import Response, request, redirect, session
import urllib.parse
import json
class Route_List():
endpoints = ["/api/routes"]
endpoint_name = "api_routes"
endpoint_methods = ["GET", "POST"]
def __init__(self, fhdhr):
self.fhdhr = fhdhr
def __call__(self, *args):
return s... |
990,898 | 9d3da8a8f7435c95121588b15d588ce51258f208 | from search.general import char_compare
class StringIterator:
def __init__(self, string):
self.index = 0
self.string = string
def cur(self):
return self.string[self.index]
def has_next(self):
return self.index < len(self.string) - 1
def has_next_uniq(self):
l... |
990,899 | 527650bafd49743da8234034ac536148ebac8f3e | from selenium import webdriver
from time import sleep
# import xlrd
import random
import os
import time
import sys
sys.path.append("..")
# import email_imap as imap
# import json
import re
# from urllib import request, parse
from selenium.webdriver.support.ui import Select
# import base64
import Chrome_driver
import em... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.