index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
985,900 | 6e86db5bc2ef7b7af07fe7a7c7dfb4ecebfc7a00 | def balance_for_positive_class(positives_table, metrics, maximum_acceptable_difference):
satisfies_balance_for_positive_class = True
groups_amount = len(positives_table)
probabilities_values = positives_table[0].keys()
expected_values = [0] * groups_amount
for i in range(groups_amount):
for ... |
985,901 | 7d4c8ed4513c8b9ca8066bcd14bac329e15dc039 | from rest_framework import serializers
from django.contrib.auth import authenticate
from django.contrib.auth.hashers import make_password
from django.contrib.auth.models import User
from rest_framework import exceptions
from Kameteeapp.models import *
# user register
class RegisterSerializer(serializers.Serializer):... |
985,902 | 7882735e9a32934a080b9a4d1f9921f87807fbbe | # ==============================================================================================
# Plivo Assignment
# Author :: Jitender Singh Rana
# mail id :: jeet841991@gmail.com
# Date :: 03-Dec-2018
# ===============================================================================================
... |
985,903 | 16867a2a55c9496fc364b7f89ef3023fbb23d262 | #!/usr/bin/env python3
from configparser import ConfigParser
import phishfry
import unittest
config = ConfigParser()
config.read("/opt/phishfry/config.ini")
user = config["test"]["user"]
password = config["test"]["pass"]
account = phishfry.Account(user, password)
class TestPhishfry(unittest.TestCase):
def test_re... |
985,904 | 6755f0c4cba6736e83f0b1dcf7673ccf5d3dc33c | import requests
class Snap:
def __init__(self, userName, passWord, loginWithMobile):
''' Initialize
Initializes the class.
'''
self.api_url = 'https://mobileapi.snapdeal.com/service/'
self.header = {'Content-Type': 'application/json; charset=utf-8'}
self.s... |
985,905 | 0d8adc94890c2566288fda9324051b7649b0fa12 | import applescript
script = applescript.AppleScript("""
on readcell(x, y)
tell application "Numbers"
tell document "Untitled"
tell sheet "Sheet 3"
tell table "Table 1"
set a to value of cell y of column x
end tell
end tell
end tell
end tell
end
"""... |
985,906 | 9acd675959fe390d95123f364745c161756302d6 | import datetime
import logging
def days_from_leg(leg):
result = []
date = leg['dates']['start']
while date <= leg['dates']['end']:
result.append(date)
date = date + datetime.timedelta(days=1)
return result
def season_for_day(day, seasons):
cmpday = datetime.datetime(day.year, day.... |
985,907 | e4ee47f53cc11dbfa7ce4f0116cdeca136b386a7 | # Copyright 2018 Jetperch LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
985,908 | f1210816537a5cbf83afdcc39bf83fdffaf2812a | import sys
from botocore.exceptions import ClientError
import boto3
ec2 = boto3.client('ec2')
instance_id = sys.argv[1].split(',')
#instance_id = sys.argv[1]
#print(type(instance_id))
#print(instance_id)
action = sys.argv[2].lower()
if action == "start":
try:
res = ec2.start_instances(InstanceIds=instance_id,Dr... |
985,909 | 7ba74e9adf27649f61b7a7f242166a48df22eb53 | import json
from botocore.vendored import requests
import os
import random
def lambda_handler(event, context):
ua_samples = ['Mozilla/5.0 CK={} (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko',
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0... |
985,910 | 36a6de86f74bb5af7e56f083f35daf6486719660 | import unittest
import mock
from mock import MagicMock,patch
import os.path
import logging
import sys,os
from MockData import *
import sys
import sys, os
sys.path.append(os.path.abspath(os.path.join('..', 'extensions/')))
import extensions
sys.path.append(os.path.abspath(os.path.join('..', 'LoggingDatabase/')))
import... |
985,911 | 6f5e614f8a27ddc24a539f65aac92b199ddb02e3 | from typing import List
class Permutation:
def permute(self, nums):
if not nums:
return [[]]
res, temp = [], []
visited = [False for _ in range(len(nums))]
self.dfs(res, temp, nums, visited)
return res
def dfs(self, res, temp, nums, visited):
if len(t... |
985,912 | 5022aa4a5687090c1acc2309969dd09854bbee37 | from flask import Flask
from flask import render_template, request
from textblob import Word
import json
import main
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/get_end_predictions', methods=['post'])
def get_prediction_eos():
try:
input_text... |
985,913 | d3711bfd38c5047088b088de69dead96d5daa4b1 | import pytest
@pytest.fixture()
def AnsibleDefaults(Ansible):
return Ansible("include_vars", "defaults/main.yml")["ansible_facts"]
@pytest.fixture()
def Hostname(TestinfraBackend):
return TestinfraBackend.get_hostname()
def test_gor_template_user(User, Group, AnsibleDefaults):
assert Group(AnsibleDefa... |
985,914 | ffd516959a2cf5c07cacd07b22e955b518c7f789 |
def rj_parse_mosflm_cr_log(mosflm_cr_log):
# get the cell constants (&c.) from the mosflm log output...
cell = None
mosaic = None
for record in mosflm_cr_log:
if 'Refined cell' in record:
if not 'parameters' in record:
cell = tuple(map(float, record.split()[-6:]))
... |
985,915 | 3097c1a8ee8f0f29d78f002c626746d01831f25f | #!/usr/bin/env python
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import scipy as sp
import tables
import os
import sys
from icecube.umdtools import cache, misc
from scipy import optimize as opt
from icecube import icetray, dataclasses, histlite, astro
from skylab.psLLH_stack import Poin... |
985,916 | 687a46fdf47c2a0b4ddd5c7cea2b227c4d497d24 | import h2o
from tests import pyunit_utils
from h2o.estimators.kmeans import H2OKMeansEstimator
import random
def random_attack():
def attack(train, x):
kwargs = {}
# randomly select parameters and their corresponding values
kwargs['k'] = random.randint(1, 20)
if random.randint(0... |
985,917 | 037e8237dc20606a998368cb54d1791f1813c649 | # ---------------------------------------------------------------------
# inv.inv application
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# Python modu... |
985,918 | 42c2f4779802a3042df265337cd6602800545394 | """ addBinary
Given two binary strings, return their sum (also a binary string).
For example,
a = "11"
b = "1"
Return "100".
"""
class Solution:
def addBinary(self, a, b):
"""
:type a: str
:type b: str
:rtype: str
"""
return bin(int(a,2) + int(b,2))[2:]
print(Solu... |
985,919 | 7cc3483a4a4f652f10819d15c3487bd9a6f6b253 | #mostrar la serie fibonaci
n=0
num=1
ultimo=0
antesUltimo=0
while(n<=15):
print(n,"=",num)
antesUltimo=ultimo
ultimo=num
num=antesUltimo+ultimo
n=n+1 |
985,920 | 075f4ae91efa7098b39d1f4dc96ddccf1eaae352 | # To run this, first, run source .bashrc & source .bash_profile to load up neuron library in python
from neuron import hoc,h
from netpyne import specs,sim
netParams_d1 = specs.NetParams() # object of class NetParams to store the network parameters
netParams_d2 = specs.NetParams() # object of class NetParams to st... |
985,921 | a7baa4e1d3f44d686631aa064220f3f8499e625d | #Write a program mydoc.py to implement the functionality of pydoc. The program should take the module name as argument and print documentation for the module and each of the functions defined in that module.
import sys
__import__(sys.argv[1])
print 'Help on module',sys.argv[1]
print '\n\n\nDESCRIPTION\n\n\n'
print __im... |
985,922 | eef7cc28a297de07510f216c1986cee00bbe5bf2 | from textwrap import dedent
import os
import subprocess
import numpy
import pandas
from wqio.tests import helpers
from wqio.utils import numutils
def _sig_figs(x):
""" Wrapper around `utils.sigFig` (n=3, tex=True) requiring only
argument for the purpose of easily "apply"-ing it to a pandas
dataframe.
... |
985,923 | 523a6f61c70ec8efec2d623a45be4d2cd0f5997a | print("""6°). Escrever um programa que coleta a senha do usuário (previamente ajustada)
armazena a senha digitada em uma lista e retorna a quantidade de vezes que o
usuário precisou para digitar a senha correta.""")
lista = []
h = input("\nqual a senha: ")
lista.append(h)
while h != "senha correta":
h = input("ten... |
985,924 | b231991bb14b7e7eb537ff49b6bd860829a6ef97 | """
高级函数方法
1。因为python是一种动态语音,可以给对象动态的绑定参数和方法,可以使用——slots——指定对象可以
绑定的方法
2。python可以使用@Property 声明一个属性的get,set方法。在操作属性的时候 会直接调用它的get,set方法
注意提供的方法名要和属性名一致
3.注意一点的是 @property方法内部的参数不能和方法名一样,否则出现递归无限调用。
要先调用set方法才能再调用 get方法,否则self 并没有和你声明的对象进行绑定。
"""
class SlotsObj(object):
##声明属性score的get方法
@property
def wid... |
985,925 | ecfa0894c9f8d7b0aba71437fdecac5589ccca08 | # -*- coding: utf-8 -*-
"""
Created on Fri Feb 22 14:09:11 2019
@author: user
"""
import random
import numpy as np
import matplotlib.pyplot as plt
N=100
Potential=np.zeros((N,N))
print(Potential)
for i in range(N):
for j in range(N):
if j==0 or i==0 or i==N-1 or j==N-1:
pass
els... |
985,926 | 0be8c85ba6890820ed04b025c32417a25c58b868 | from socket import *
OPEN = bytes([0x02, 0x00, 0x2c, 0xff, 0x01, 0x00, 0x00, 0xD0, 0x03])
CLOSE = bytes([0x02, 0x00, 0x5e, 0xff, 0x01, 0x00, 0x00, 0xD2, 0x03])
HB = bytes([0x02, 0x00, 0x56, 0xff, 0x01, 0x02, 0x00, 0x1f, 0x96, 0x21, 0x03])
ALERT = bytes([0x02, 0x00, 0x18, 0xff, 0x01, 0x02, 0x00, 0x00, 0x00, 0xE6, 0x03... |
985,927 | 5bec65825e0c8f7f404bbd94b95c99b0793bca94 | #!/usr/bin/env python
# --------------------
# Project Euler - Problem 3
#
# Title: Largest prime factor
#
# Description: The prime factors of 13195 are 5, 7, 13 and 29.
# What is the largest prime factor of the number 600851475143 ?
# Our number from above
number = 600851475143
# Divisor - starts at 2
divisor = 2
#... |
985,928 | 11e81aa6da6c5ca74e6ba15f965704f35658f2d9 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 22 17:05:11 2021
@author: Gilly
"""
import numpy as np
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
class Clean():
def __init__(self, data, none_cols = []):
'''
Parameters
----------
data : p... |
985,929 | 29083ea76681b0c72a17c17e2555c21000e6a99e | #!/usr/bin/env python3
# Reads a VCF or GZipped VCF and reformats it into
# Chromosome position, alleles, allele frequences and sample names
# Output is printed to stdout
# E.g.
#Chrom:Pos Alleles Freq 430-ZLIU 431-ZLIU 432-ZLIU 433-ZLIU 434-ZLIU ...
#1:11232 C,A,T 0.958,0.027,0.015 0/0 ... |
985,930 | 4184fba622055ffbdf0e4b1abf83be589fc1c9f6 | """Framework for compatible simulations under the /simulation directory"""
import random
import time
import logging
import os
import scipy.io
import pybullet as p
import pybullet_data
import abc
from arm_pytorch_utilities import rand
logger = logging.getLogger(__name__)
class Mode:
DIRECT = 0
GUI = 1
clas... |
985,931 | df29cfbda8fb3166e9571d810f328b9ee74c27ab | from flask import Blueprint, jsonify
from server.db.models import Person, Organization, Trip, TripSurvey
v1 = Blueprint('v1', __name__, url_prefix='/v1')
@v1.route("/organizations")
def list_organizations():
organizations = Organization.objects
return jsonify(list(map(lambda organization: organization.serial... |
985,932 | 32ad3d44b5c6e36fb2e010f973b41e9013bd0775 | import torch
import numpy as np
import torch.nn as nn
import matplotlib.pyplot as plt
import SinGAN.customFuncs as customFuncs
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('--input_dir', help='input image dir', default='Input/Images3D/')
parser.add_argument('--input_name', help='in... |
985,933 | 1adc7affedd15b30596efa3bfb21fbbde4e529c7 | import sys
from PySide2 import QtWidgets, QtGui
from PySide2 import QtWidgets, QtGui, QtCore
from strukture_dock import StructureDock
from workspace import WorkspaceWidget
'""Brisanje taba u app'''
def delete_tab(index):
central_widget.removeTab(index)
""'Otvaranje fajla Struck docka u terminalu""'
# d... |
985,934 | 1e8df6fa46d16d0085cd76b57dd7e12dcdc0a61d | import numpy as np
print ("Numpy => Numerical Python")
print(np.__version__)
arr = np.array([1, 2, 3, 4, 5])
print(arr)
|
985,935 | 91365f4f759a8cde0412965a137b3407aa83f58b | import numpy as np
class Main:
def __init__(self):
self.n, self.m = map(int, input().split())
self.arr = np.array([input().split() for i in range(self.n)], int)
def output(self):
print(np.mean(self.arr, axis=1), np.var(self.arr, axis=0), np.std(self.arr), sep='\n')
if ... |
985,936 | 6ac8644c24f7d8222f5002cdbf8dcb6e65afbb7c |
def remix(txt, lst):
txt_list = [i for i in txt]
new_dict = dict(zip(lst, txt_list))
return ''.join(list(new_dict.values()))
|
985,937 | ae961f6d96417e48fc1858ee738cbcf51b9974c2 | import sys
import json
import traceback
import scheduler
def main():
std_input = sys.stdin.read()
input_json = json.loads(std_input)
course_catalog = input_json['catalog']
required_courses = input_json['required_courses']
completed_courses = input_json['completed_courses']
max_courses_per_qu... |
985,938 | 2d6c6ca49e75f339a7e94fe497f327305f790e4d | """Restricted Sum
Our new calculator is censored and as such it does not accept certain words.
You should try to trick by writing a program to calculate the sum of numbers.
Given a list of numbers, you should find the sum of these numbers.
Your solution should not contain any of the banned words,
even as a part of an... |
985,939 | d29bf45f55f47fcb52b205c9e22a90d86f64bec6 | import numpy as np
np.set_printoptions(suppress=True, precision=4)
import sys
import matplotlib.pyplot as plt
import sklearn.decomposition as decomp
import sklearn.linear_model as linear_model
import sklearn.datasets as sk_data
from sklearn.preprocessing import StandardScaler
import numpy.linalg as nla
import sklearn.... |
985,940 | 5fd73af7dacf2007621524cf4b02371036c591f3 |
#calss header
class _OFFENDED():
def __init__(self,):
self.name = "OFFENDED"
self.definitions = offend
self.parents = []
self.childen = []
self.properties = []
self.jsondata = {}
self.basic = ['offend']
|
985,941 | a059477ad7869782d79be042871a1d391c80cb06 | import discord
from discord.ext.commands import check
from lifesaver.bot.context import LifesaverContext
def is_nsfw_or_dm():
def _check(context: LifesaverContext):
return (not context.guild) or (isinstance(context.channel, discord.TextChannel) and context.channel.nsfw)
return check(_check)
|
985,942 | 0a9219c9c68bc767f7048e24a49ed2d57492136b | import os
import csv
import tensorflow as tf
BUFFER_SIZE=10000
def load_dataset(datapath, vocab, dimesion=0, splits=["split_1", "split_2", "split_4", "split_8", "split_16"]):
dataset = []
data = csv.DictReader(open(datapath, "r"))
midi_paths = []
for row in data:
filepath, valence, arousal =... |
985,943 | d60c5eeca9ad2ff650f9e1e48ce29d700d426d50 | import numpy as np
from DynamicVariable import DynamicVariable
#TODO override all operation methods to return random element
class UniformDistributedVariable(DynamicVariable):
def __init__(self,min,max):
self.min=min
self.max=max
self.value=np.random.uniform(low=min,high=max)
def ass... |
985,944 | d7e91d87e7b66f0eacee7726aef6c9ce96b4ea57 | import numpy as np
from loss import *
class Activation:
def __init__(self):
self.inputs = None
self.output = None
self.gradient_inputs = None
class Activation_softmax(Activation):
def forward(self, inputs, training):
self.inputs = inputs
exp_values = np.exp(inputs - n... |
985,945 | 2594dae6ba45623b9cd9cf4cc18f4c7648bedc7b | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from perm_equivariant_seq2seq.symmetry_groups import LanguageInvariance
class Language:
"""Object to keep track of languages to be translated.
Args:
name: (string) Name of language being used
"""
def __init__(self, name):
... |
985,946 | 42a5431ad68da6003324b7994377f256bc1e3124 |
def hardmod(divident, divisor):
quotient = divident
modulus = 0
# replicating division behavior
while quotient >= divisor:
quotient -= divisor
# finding modulus
if quotient < divisor:
modulus = quotient
return modulus
divident = float(input("Enter a divident: "... |
985,947 | deda4af87ee61b2bc4fefc8dbb0fa04a5429111d | import json
import os
class WrkConfig(object):
def __init__(self, node_url, seconds, collections, threads, timeout, script_dir):
self.__node_url = node_url
self.__seconds = seconds
self.__collections = collections
self.__threads = threads
self.__timeout = timeout
sel... |
985,948 | 2071c8f689e6b7c854f3700ed04bcd5d20e904bd | filename = "files/tempfile.txt"
try:
with open(filename) as f:
content = f.read()
except FileNotFoundError as error:
print("I am done reading a file",error.filename) |
985,949 | 534ecedbbbf5699e8e50fe6ce6fc1bb565d6f29f | from ext.debugger.elt.database import DatabaseClient
c = DatabaseClient(connect=False)
c.reconnect()
if c.connected:
c.close()
|
985,950 | 841896b1e2e97daa078623f82390cb1ef07ae7cc | #https://www.codewars.com/kata/57d814e4950d8489720008db/train/python
import math
def index(array, n):
if len(array) <= n:
return -1
else:
return math.pow(array[n], n)
def index(array, n):
return array[n]**n if n < len(array) else -1 |
985,951 | a0f741a5cbdc1525694c85f60dfc84498dd5528e | from ShifterFactory import Creator, CircularShifterCreator
from Input import Input
from SorterFactory import SorterCreator, AscendingSortCreator
from Output import Output
def client_code(creator: Creator, entrada, sorter: SorterCreator) -> str:
print("Client: I'm not aware of the creator's class, but it still work... |
985,952 | b25bef5066a6e6a6784b8262fa34a9d3e765254b | # -*- coding:utf-8 -*-
import sys
"""解説
K = 6
4 3 1 1 2 2 1 1 1 2
という数列を考える。
4 3 1 1 2 2 1 1 1 2
|_|
4
4 3 1 1 2 2 1 1 1 2
|___|
12
Kを超えたので、左端の4で割ったあと、左端の位置を1すすめる
4 3 1 1 2 2 1 1 1 2
|_|
3
4 3 1 1 2 2 1 1 1 2
|_______|
6
4 3 1 1 2 2 1 1 1 2
|_________|
12
Kを超えたので、左端の3で割ったあと、左端の位置を1... |
985,953 | 00edd67456619c4317a2ccf89cc16cbcf9116c7c | import os
from datetime import datetime, date, time
import re
import json
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib import messages
from django.db import transaction
from django.db.models impo... |
985,954 | 9562095d03196eeee4fa0e810bc45cd25079e2b6 | from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.common.by import By
import time
# from selenium.webdriver.support.ui import Select
list1,list2 = [],[]
driver = webdriver.Chrome()
# driver.impli... |
985,955 | 52906429b379cb3fcfefc578746f21784f8bfcd5 | import time
import paho.mqtt.client as client
import ssl
import random
IoT_protocol = "x-amzn-mqtt-ca"
aws_end_point = "amwmnb948lrc8-ats.iot.ap-south-1.amazonaws.com"
ca = "./AmazonRootCA1.pem"
cert = "./69311293f0-certificate.pem.crt"
private = "./69311293f0-private.pem.key"
ssl_context = ssl.create_default_contex... |
985,956 | c1e870c28d88f99f448127ee8bd94b751021d876 | # Expresiones regulares
# Secuencia especial de caracteres que ayuda a encontrar otras cadenas o conjuntos de cadenas utlizando una sintaxis mantenida en un patron.
# Modulo en python para regex: re
# Funciones en re
# match(patron, cadena, banderas), si hace match regresa un objeto de tipo match y si no regresa N... |
985,957 | 8f120f82a6c45c839f6403e735f9b15f4d363bd8 | import rx
l = ['Hola', 'Adiós']
rx.from_(l).subscribe(
on_next=lambda v: print(f'Recibido: {v}'),
on_completed=lambda: print('Done!')
)
|
985,958 | 302e9c6fd69258555653790b7fa2d01c571dc634 | from ffindex.content import FFIndexContent
import mmap
try:
isinstance("", basestring)
def _is_string(s):
return isinstance(s, basestring)
except NameError:
def _is_string(s):
return isinstance(s, str)
def _to_file(fn, mode="rb"):
if _is_string(fn):
return open(fn, mode)
... |
985,959 | 19ffb3a60c03f13456564a65ba73625e3173c405 | from abc import ABC, abstractmethod
from numpy.linalg import inv
import numpy as np
class MAB(ABC):
@abstractmethod
def play(self, tround, context):
# Current round of t (for my implementations average mean reward array
# at round t is passed to this function instead of tround itself)
... |
985,960 | d23b8a957c66f2944566bdb9759f97585b1a783d | f = open("a.in")
f.readline()
for case, line in enumerate(f):
people = line.split()[1]
standing = 0
res = 0
for shyness, count in enumerate(people):
count = int(count)
if (shyness <= standing):
standing += count
else:
res += shyness - standing
... |
985,961 | 4ae14c184a3fc5069cd5d8647997272059cd9519 | from .enums import Instance_options
from .model import Model, Pair
"""Functions to deal with File input."""
def _get_simple_pref_list_and_ranks(pref_list):
"""Creates integer list preference list and rank list.
For the preference list "4 5 (1 2) 3", the output will be:
simp_pref_list = [4 5 1 2 3], simp... |
985,962 | 796cfb0f8f85a9737f07598bfad1b348807af030 | S = list(input())
# print(S)
ListS = []
# print(S)
for i in range(len(S)):
ListS.append(S)
tem = S
S = S[1:len(S)]
S.append(tem[0])
ListS.sort()
# print(ListS)
for s in ListS[0]:
print(s, end="")
print("")
for s in ListS[-1]:
print(s, end="")
print("")
|
985,963 | e8de9a71c0b0dbad56043418677979ae02c59d96 | import numpy as np
# import matlab.engine
#
# eng = matlab.engine.start_matlab()
def loss_cp(m, s):
cw = 0.25 # cost function width
b = 0.0 # exploration parameter
state_dim = m.shape[0]
D0 = state_dim # state dimension
D1 = state_dim + 2 # state dimension with cos/sin
M = np.zeros([D1,... |
985,964 | e6433cc0f85c14fa6875fd32aa53c0d7e72f5b13 | from data import DataAPI
from backtesting import Backtesting
from Visualization import Visualize
import pandas as pd
import matplotlib.pyplot as plt
user1 = DataAPI("IEX", IEX_token)
# path_aapl2y = r'D:\K\HU\HU - Courses\CISC 695 Research Methodology and Writing\Assignments\sample_data\aapl2y.csv'
# df... |
985,965 | 11052f7e56c5aa71f0ca5294ffa740a99db3e464 | from clarity_ext.unit_conversion import UnitConversion
from clarity_ext.clarity import ClaritySession
|
985,966 | 86889d06dc52126f6eb5642f8aa54d209a091f88 | import sounddevice as sd
import soundfile as sf
import tkinter
def recording():
fs = 48000
duration = 10
my_recording = sd.rec(frames=int(fs * duration) , samplerate=fs, channels=2)
sd.wait()
return sf.write('My_recording.flac', my_recording, samplerate=fs)
master = tkinter.Tk()
... |
985,967 | 31b0ee49957871af3f6181e99c99190e3667cbb4 | # coding: utf-8
"""
Relias API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unitte... |
985,968 | 0364525b2ffb7c88ad3c06f9f6f4ec37e0629b77 | # coding=utf-8
"""
Since 2020 Apr, BOCHK revised its cash report format, holding report not affected.
This module handles the new format here. For each currency, then
1) use cash activity report balance (day end balance);
2) if not, use cash report (real time balance)
"""
from functools import partial, reduce
fro... |
985,969 | efdfe13b4d8eafedae98c46031bea17c4806c9a4 |
from datetime import datetime as dt
import xml.etree.ElementTree as XML
import json
import system
# Summary: Class object for the current state of all FW
# Mostly, it's a container for all the systems
_facIDs = {
"Caldari State" : 500001,
"Minmatar Republic" : 500002,
"Amarr Empire" : 500003... |
985,970 | f78c1e9e61482029355ba3cc00e91204f709ef5f | from pyspark.sql import DataFrame, functions as F
def lowercase_all_column_names(df:DataFrame)->DataFrame:
"""
Convert all column names to lower case.
"""
for col in df.columns:
df = df.withColumnRenamed(col, col.lower())
return df
def uppercase_all_column_names(df:DataFrame)->DataFrame:... |
985,971 | 42cd488011debaf5f251d464b5e5f4db2ec33661 | __author__ = 'hzliyong'
__metalass__ = type
class Rectangele:
def __init__(self):
self.width = 0
self.height = 0
def __setattr__(self, name, value):
if name == 'size':
self.width, self.height = value
else:
self.__dict__[name] = value
def __getattr... |
985,972 | b7a311e63659b5fa986b2833ae147ee14c2ae93a | import os
from flask import Flask, request
import requests
import requests_cache
from dotenv import load_dotenv, find_dotenv
load_dotenv(find_dotenv())
OPENROUTESERVICE_API_KEY = os.environ.get("ORS_API_KEY")
requests_cache.install_cache(allowable_methods=["GET", "POST"])
app = Flask(__name__, static_url_path="/stat... |
985,973 | 9618149da53c1cb13ab45c140a1ff3b40040568f |
def search_reference(dic_values, dic_mask, row, col, band_name):
"""
Search and return the most recent cloud-free value of the time series and its date before the current date.
Extract all dates previous to the date of the current analysed image by accessing the keys from the masked
dictionary. For th... |
985,974 | b2406a408a2c49a73e24172c29cb69cb2948dc56 | from litex.gen import *
from litex.soc.interconnect import dfi, lasmi_bus
from litex.soc.cores.sdram.lasmicon.refresher import *
from litex.soc.cores.sdram.lasmicon.bankmachine import *
from litex.soc.cores.sdram.lasmicon.multiplexer import *
class ControllerSettings:
def __init__(self, req_queue_size=8, read_ti... |
985,975 | 1d22ed010fd258884c8a2895530ac390e2e69782 | from django.db import models
from django.db import models
class Empleado(models.Model):
# Campo para la relación one-to-many
nombre = models.CharField(max_length=40)
apellido = models.CharField(max_length=50, null=True)
dni = models.CharField(max_length=40, null=True)
telefono = models.IntegerFi... |
985,976 | bed2b989d422b0b899beda1c10958f230498447c | # Dependencies
import praw
import sys
import time
from datetime import datetime, timedelta
import datahandler
from config import config
from bot_login import bot_login
from log_it import log_it, getFileName
from timeout import timeout
import matchthread
import flair
import mentions
import curl
# Get logfile for this... |
985,977 | 82ffedde1a0204a29f677cdcfab636b0bf1506ca | def countingSort(arr):
n = len(arr)
count_arr = [0] * n
for i in range(n):
count_arr[arr[i]] += 1
return count_arr
if __name__ == '__main__':
arr = list(map(int, '63 25 73 1 98 73 56 84 86 57 16 83 8 25 81 56 9 53 98 67 99 12 83 89 80 91 39 86 76 85 74 39 25 90 59 10 94 32 44 3 89 30 27 79 46 96 27 32 18 21 ... |
985,978 | ff56f5855845fb8333387e461f2f1b165786dd48 |
# coding: utf-8
# In[1]:
km = int(input("digite a quantidade de km percorridos: "))
dias = int(input("digite a quantidade de dias em que o veículo ficou alugado: "))
preco = (0.15*km) + (60*dias)
print("o valor a ser pago é %.2f" % preco)
|
985,979 | 018a905ae5468df00b2f12d93974f33cccc046ea | """An openScope airspace object."""
import json
from .utilities.converters import fromPolygon, toPolygon
class AirspaceModel:
"""An openScope airspace object."""
airspaceClass = None
ceiling = None
floor = None
name = None
poly = []
def __init__(self, value):
self.airspaceClas... |
985,980 | 3c2d50378759baf0bb9c24d97bb1297736cc55d8 | # TIME ESTAMTES GENERATING
config_elapsed_time_b60 = 42817.5 # seconds
time_per_config_generation = config_elapsed_time_b60 / 1000.0
# TIME ESTIMATES FLOWING
flow_elapsed_time_b60 = (1*24*60*60 + 13*60*60 + 14*60)
NFlows_B60 = 1000
NFlows_B61 = 500
NFlows_B62 = 500
NFlows_B645 = 250
flow_cfg_time_b60 = float(flow_ela... |
985,981 | ee7e02ac9e26dbd216e1ab053f785a94a560710b | # -*- coding: utf-8 -*-
from blog.models.book import Book
from blog.models.article import Article
|
985,982 | d2fe0d60d189b6241605c6edcef085fead1d1e1b | import copy
import sys
import os.path
sys.path.insert( 0, os.path.normpath(os.path.join( os.path.dirname( __file__ ), '..') ))
from aql_tests import skip, AqlTestCase, runLocalTests
from aql.options import OptionType, BoolOptionType, EnumOptionType, RangeOptionType, ListOptionType, \
OptionVa... |
985,983 | 98a3dfc2963330600ded8ca7d338ff285c981872 | from django.shortcuts import render
# Create your views here.
from django.shortcuts import render
def loadPage(request):
title = "Temperature Sensor"
message = "The list of temperatures is shown below in Degree Celsius.<p>Date Time | Temperature"
return render(request, 'webclient_app.html', {... |
985,984 | 36cfc78585be00e85bb53e0100324c85b336f69c | version https://git-lfs.github.com/spec/v1
oid sha256:e094636ca77a7e06ff19a86e005ff1af939a962bf8330053c7f76fc49ac45ff4
size 159430
|
985,985 | d7c2f2b09a1dc01467f16f5e2fa82e3d1c26a8f6 | # -*- coding:utf-8 -*-
import xlrd
import xlwt
import os
import json
import re
from xlutils.copy import copy
'''
批量修改格式为:item_id:is_bind:num 物品/物品列表的物品id
'''
# 获取path路径下的后缀为postfix文件名列表
def getPostfixFileList(path, postfix):
return [file for file in os.listdir(path) if os.path.isfile(path + '/' + file) and ... |
985,986 | 24ea8e3a223d9718d414ceb3608b1fc05b4b733d | #!/usr/bin/env python
import re
def isvalid(email):
"""chech email for validity"""
pattern = re.compile(r"^([a-zA-Z0-9_\-]+)@([a-zA-Z0-9]+)\.\w{,3}$")
return bool(pattern.match(email))
if __name__ == '__main__':
n = int(input())
emails = (input().strip() for _ in range(n))
valid_emails = ... |
985,987 | 94de3e04603fe434c6482da361e7077281a9387e | from tortoise.exceptions import NoValuesFetched
from tortoise.models import Model
from tortoise import fields
from typing import List
from schemas.student import PStudentBase
from schemas.course import PCourseBase
class Student(Model):
id = fields.IntField(pk=True, generated=True, index=True)
first_name = fi... |
985,988 | 236948b483754fb45e5761d4074502b48945ffca | from django.core.urlresolvers import reverse
from django.test import TestCase
from model_mommy import mommy
from chemicals import models, admin
from chemicals.tests.utils import TestUsers
class ChemicalAdminTest(TestCase):
"Test custom admin functions"
def SetUp(self):
users = TestUsers()
sel... |
985,989 | ba5d8bf4ba2bc61e1c22973d13b1d45766c63ef5 | import os
import base64
from datetime import datetime
from google.cloud import storage
def uploadPost(b64image, user_id):
# Upload a file to the bucket
storage_client = storage.Client()
bucket = storage_client.get_bucket('yorimichi_posts')
destination_blob_name = make_dest_name(user_id)
blob = bucket.blob(de... |
985,990 | b1e8865a88fa2296c467c5b6b68656ffce64da1e | import matplotlib.pyplot as plt
from binaryclassifier.statistics.quantiles import (
get_bins, get_quantiles_from_bins)
def plot_quantiles(
y_true, scores, q=10, figsize=(8,5),
title='Quantile Bar Graph', color=None):
if q==10:
quant_type = 'Decile'
elif q==20:
quant_type ... |
985,991 | 96939baaf57b464064d5572192706d9e2fe6d4e3 | """
训练LR分类器
"""
import sys ;sys.path.append('../')
from sklearn import metrics
import F_TrainModel.GenDataTool as GDTool
import DataLinkSet as DLSet
import joblib
import time
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection impo... |
985,992 | 21aa5ed20ba78cbd6b3e10699a7bdbeb9c4ce145 | from segmentor import make_cuter
from utils import *
import tqdm
tqdm.tqdm.pandas(ncols=75)
import pandas as pd
def cut_word(df, cuter, cleaner, par=True):
title_words = df.title.progress_apply(lambda j: cleaner(cuter(j)))
global co
co = 0
def f(j):
global co
co += 1
if co % ... |
985,993 | 74ac540fd27474b68de051455e63d52758a05688 | ## Python implementation of MBMA (Van den Bosch & Daelemans 1999)
## Copyright (C) 2011 Institute for Dutch Lexicology (INL)
## Author: Folgert Karsdorp, INL
## E-mail: <servicedesk@inl.nl>
## URL: <http://www.inl.nl/>
## For licence information, see LICENCE.TXT
"""
Commandline interface to mbmp.
"""
import argparse... |
985,994 | 21c75ee5eb440cad21729437ce9be95ddb089e35 | import numpy as np
import cv2
import functions as fcns
path = 'center_2016_12_01_13_30_48_287.jpg'
img = cv2.imread(path)
cv2.imshow('image',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
img_flipped = np.fliplr(img)
cv2.imshow('image',img_flipped)
cv2.waitKey(0)
cv2.destroyAllWindows()
path_save = 'center_2016_12_01_... |
985,995 | cc05a5e3b24e5648c375fbb56450990b9cecc114 | from plotting import OutputModule
from plotting.PlotStyle import setupAxes
from ROOT import Double,TGraphErrors,TLegend,vector,TMath,gPad,TPad
from plotting.RootFileHandler import commandLine
from array import array
import math
import math
from numpy import nan, dtype
import numpy as np
commandLine = OutputModule.C... |
985,996 | b968f17c056f6eaba1884e5f886b4a9ab054c6ab | # coding=utf-8
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
class Course(models.Model):
name = models.CharField(max_length=40)
short_summary = models.TextField(max_length=200)
description = models.TextField()
organisation = mod... |
985,997 | 6a8f34038f9b182e54e03175f7b93da38a867406 | import requests
import progressbar as pb
import os
def download_file(url, file_name, dest_dir):
if not os.path.exists(dest_dir):
os.makedirs(dest_dir)
full_path_to_file = dest_dir + os.path.sep + file_name
if os.path.exists(dest_dir + os.path.sep + file_name):
return full_path_to_file
... |
985,998 | ca713201f48ac8fa5eff2883c4326e994763c692 | #!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
985,999 | 0e86e694f1d48268023231e5858848b032e175fb | # Necessary imports. Provides library functions to ease writing tests.
from lib import prebuild, testcase, SUBMITTY_INSTALL_DIR
import subprocess
import os
import glob
import shutil
import traceback
############################################################################
# COPY THE ASSIGNMENT FROM THE SAMPLE ASSI... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.