blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
b1721bfabcf63a88e0fd9fa41d651fb6e684754e | Python | joshkol1/Project-Euler | /Completed/051-100/problem061.py | UTF-8 | 2,259 | 3.5 | 4 | [] | no_license | import itertools
triangle = []
square = []
pentagonal = []
hexagonal = []
heptagonal = []
octagonal = []
all_numbers = [
triangle, square, pentagonal, hexagonal, heptagonal, octagonal
]
for i in range(0, 1000):
if 1000 <= i*(i+1)/2 <= 9999:
triangle.append(int(i*(i+1)/2))
if i*(i+1)/2 > 9999:
break
for i in ran... | true |
034ad10557ecf0933f3c6228bb5a2f149a000016 | Python | Cediba/Learning_Python | /test.py | UTF-8 | 127 | 3.0625 | 3 | [] | no_license |
l = []
for i in range(1, 10):
l.append(i)
m = []
for j in range(2, 10):
m.append(j * 2)
o = []
print(l)
print(m)
| true |
ae7cdb723a7b0fddbc8a883b704ec809c06c402d | Python | Tylerflx/coding_practice | /leetcode/valid_anagram.py | UTF-8 | 415 | 3.484375 | 3 | [] | no_license | """
Success
Details
Runtime: 48 ms, faster than 68.07% of Python3 online submissions for Valid Anagram.
Memory Usage: 14.9 MB, less than 27.35% of Python3 online submissions for Valid Anagram.
"""
#O(1)
class Solution:
def isAnagram(self, s: str, t: str) -> bool:
#anagram should be word that have ... | true |
a51436e0dab6c78af942b3d9d8a7184773c6bb46 | Python | mitll/ActT | /active_tester/label_estimation/methods.py | UTF-8 | 7,766 | 3.0625 | 3 | [
"BSD-3-Clause"
] | permissive | import numpy as np
from sklearn.metrics import confusion_matrix
from sklearn.linear_model import LogisticRegression
import unittest
from statswag.estimators import MLEOneParameterPerLabeler
def create_expert_probabilities(true, predicted, num_classes):
"""
Create a smoothed matrix of confusion matrix probabil... | true |
53364ad22f185c36ee6a8a46b90722033bb2a175 | Python | ballon3/BodyBack | /bim360/Forge_services/DataManagment/V1/projects.py | UTF-8 | 2,623 | 2.609375 | 3 | [] | no_license | import os, requests, textwrap
import json
verbose = False
token = ''
url_authenticate = 'https://developer.api.autodesk.com/authentication/v1/authenticate'
url_hubs = 'https://developer.api.autodesk.com/oss/v2/buckets'
#////////////////////////////////////////////////////////////////////
# Get Forge token
#... | true |
d7e2f455454037e81cf0b05dcf1a2a0ac52ed412 | Python | xiaoqin00/passCoding | /passcoding/ATbash.py | UTF-8 | 395 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python
#-*- coding: UTF-8 -*-
def myAtbash(encode_str):
if not encode_str :
return ''
L = []
for c in list(encode_str):
if ord(c) == 32:
L.append(c)
elif ord(c)>= 65 and ord(c) <=90:
c = chr( 155-ord(c) )
L.append(c)
elif ord(c) >= 97 and ord(c) <= 122:
c = chr( 219-ord(c) )
L... | true |
8784b6d17f8cbce89defcd149a19c1a5d2ceaf79 | Python | goldensky/Create-dict-from-generators | /generators.py | UTF-8 | 985 | 2.96875 | 3 | [] | no_license | import time
import functools
A_INIT = 0
B_INIT = 3
D_INIT = 6
QUANTITY = 5
src_a = ({str(i): i} for i in range(A_INIT, A_INIT + QUANTITY))
src_b = ({str(i): i} for i in range(B_INIT, B_INIT + QUANTITY))
src_c = ({str(i): i} for i in range(D_INIT, D_INIT + QUANTITY))
def count_time(func):
@functools.wraps(func)
d... | true |
c2e69fc50ef9a186023c7d454c9fe86644e2beda | Python | hsinghan/BIOS-NOTE | /Update_Release_Package.py | UTF-8 | 3,366 | 2.90625 | 3 | [] | no_license | import shutil
import os
from tkinter import *
import tkinter as tk
from tkinter import ttk
from tkinter import filedialog
Project_Code = "" # Ex : S91
New_Version_Num = "" # Ex : 000200
Old_Version_Num = "" # Ex : 000100
def Copy_all_files(src_path, des_path):
File_list = os.listdir(src_path)
... | true |
ac22c19746b78f8c49b994981d5fb23571ae77a9 | Python | abdurrahman003/PYTHON | /graph.py | UTF-8 | 111 | 3.03125 | 3 | [] | no_license | import matplotlib.pyplot as plt
x=[1,1.5,2,2.5,3,3.5]
y=[3,5,7,10,11,14]
plt.bar(x,y,color="black")
plt.show() | true |
c4006e2d69f745bc0d94b37b6ac50a30848ec4f4 | Python | michalurbanski/PythonLearning | /Exercises/chapter5.py | UTF-8 | 3,175 | 4.34375 | 4 | [
"MIT"
] | permissive | # Exercises for chapter 5 of the book
# 1. Write a function which adds two arguments
def do_plus(first, second):
return first+second
first = 3
second = 5
print(do_plus(first, second))
# 2. Add type checking to verify if type is integer or string
def do_plus(first, second):
isCorrectFirstType = type(first) == in... | true |
3ec85fc1b7fe69ecb1b3c496b03917c192aca177 | Python | danielfeloiola/tweet-deleter | /delete.py | UTF-8 | 1,196 | 2.8125 | 3 | [] | no_license | ##############################################################
# Deletando velharias do Twitter
# Deleting old junk from twitter
#
# Deleta tweets com base no arquivo tweets.js
# Delete tweets using the tweets.js file
# https://twitter.com/settings/your_twitter_data
#####################################################... | true |
309ce9ec616953ba6731c3c0b5d1750e2a452c89 | Python | tmu-nlp/NLPtutorial2019 | /wanghongfei/tutorial01/test_unigram.py | UTF-8 | 734 | 2.546875 | 3 | [] | no_license | import math
lamda1 = 0.95
lamda_unk = 0.05
V = 1000000
W = 0
H = 0
unk_num = 0
prob_dict = {}
model_file = open('./model_file.txt').readlines()
for line in model_file:
prob_list = line.strip("\n").split(" ")
prob_dict[prob_list[0]] = prob_list[1]
test_file = open("/Users/hongfeiwang/desktop/nlptutorial-master/t... | true |
1e28d85f49eccf5137023d88d3befe75a8df76b4 | Python | edward-stan/python- | /前20项和.py | UTF-8 | 97 | 3.328125 | 3 | [] | no_license | a=0
x=1
n=1
while True:
a+=x
x*=2
n+=1
if n>20:
break
print(a)
| true |
635f96e252151c57f24b0350246aade6c5e7eda6 | Python | Aasthaengg/IBMdataset | /Python_codes/p03013/s985621667.py | UTF-8 | 383 | 2.6875 | 3 | [] | no_license | N, M = map(int, input().split())
dp = [0 for _ in range(N+1)]
skip = {}
for _ in range(M):
skip[int(input())] = 1
dp[1] = 1
if N >= 2:
dp[2] = 2
if 1 in skip:
dp[1] = 0
if N >= 2:
dp[2] = 1
if 2 in skip:
if N >= 2:
dp[2] = 0
for i in range(3, N+1):
if i in skip:
conti... | true |
45f38da8b7407cfb94885ddfc4f843e945167bf8 | Python | 666sempron999/Abramyan-tasks- | /Series(40)/18.py | UTF-8 | 717 | 3.828125 | 4 | [] | no_license | """
Series18. Дано целое число N и набор из N целых чисел, упорядоченный
по возрастанию. Данный набор может содержать одинаковые элементы.
Вывести в том же порядке все различные элементы данного набора.
"""
import random
resultList = list()
N = int(input("Введите число элементов - "))
for x in range(0,N... | true |
0b69efb72e972588cc94d4da03d0a036c978ca2e | Python | jain-avi/Faster-RCNN | /keras_frcnn/faster_rcnn_classifier.py | UTF-8 | 6,599 | 2.828125 | 3 | [] | no_license | """
Author : Avineil Jain
This file contains the code for the classifier module
Some of the functions are inspired from https://github.com/yhenon/keras-frcnn because of the difficulty and time constraints-
calc_classifier_ground_truth()
The functions which are inspired from the code are used and edited as per req... | true |
d8a966abe59a1101e1b0fb7ebeccf641d2ae0f91 | Python | sstupUp/Machine_Learning | /Pytorch/nn_module/gabor.py | UTF-8 | 569 | 3.03125 | 3 | [] | no_license | import torch
import numpy as np
import matplotlib.pyplot as plt
ks = 100
theta = np.pi/2
sigma_x = 30
sigma_y = 30
frequency = np.pi/4
offset = np.pi/2
w = ks // 2
grid_val = torch.arange(-w, w+1, dtype=torch.float)
x, y = torch.meshgrid(grid_val, grid_val)
rotx = x * np.cos(theta) + y * np.sin(theta)
roty = -x * np.... | true |
d49a578bc55725d935ca07eb092efca14ad08b64 | Python | Ibtihel-ouni/HackerRank_Submissions | /30 Days of Code/D28 RegEx, Patterns, and Intro to Databases.py | UTF-8 | 396 | 2.609375 | 3 | [] | no_license | #!/bin/python3
import math
import os
import random
import re
import sys
if __name__ == '__main__':
N = int(input())
names = []
for N_itr in range(N):
firstNameEmailID = input().split()
emailID = firstNameEmailID[1]
if '@gmail' in emailID:
names.append(firstNameEmailID[0]... | true |
837591928e777038c0052e7ac2a0edb6fc3aea85 | Python | ALMTC/Logica-de-programacao | /TD/06.py | UTF-8 | 244 | 3.734375 | 4 | [] | no_license | print 'Digite o salario'
a = input()
print 'Digite a primeira conta'
b = input()
print 'Digite a segunda conta'
c = input()
b = b + (b * 2) / 100.0
c = c + (c * 2) / 100.0
r = a - b - c
print 'Sobram ' + str(r) + 'R$ do salario minimo' | true |
6cdb4280ac79284a70b168ee93ebdf4f5c13842e | Python | hustfc/Interview-questions | /多行输入.py | UTF-8 | 186 | 2.90625 | 3 | [] | no_license | import sys
try:
while True:
line1 = sys.stdin.readline().strip()
if line1 == '':
break
a, b = line1.split()
print(a, b)
except:
pass
| true |
0afd5363ceb83802892e750324377135e005e85d | Python | saive/c2ccode-backend-common | /pyapi/common/decode.py | UTF-8 | 1,914 | 2.546875 | 3 | [] | no_license | import os
import sys
from ctypes import *
import base64
import struct
key = (0x331A, 0x1289, 0x4512, 0x1355)
def encipher(v, k):
y = c_uint16(v[0])
z = c_uint16(v[1])
sum = c_uint16(0)
delta = 0x9e37
n = 16
w = [0,0]
while(n>0):
sum.value += delta
y.value += ( z.value << 4... | true |
9607ffe93f89f97b4acaac6e4de5ee70e5c5281d | Python | hungry4therock/my-python | /ch04/chapter04.lecture.step04_set.py | UTF-8 | 1,381 | 4 | 4 | [] | no_license | #p96
# (1) 중복불가
s = {1,3,5,3,1}
print(len(s))
print(s)
# (2) 요소 반복
for d in s:
print(d,end='')
print()
# (3) 집합관련 함수
s2 = {3,6}
print(s. union(s2))
print(s. difference(s2))
print(s.intersection(s2))
# (4) 추가,삭제 함수
s3 = {1,3,5}
print(s3)
s3.add(7)
print(s3)
s3.discard(3)
print(s3)
#p98
#중복 원소를 갖는 리스트
gender = ... | true |
0248ce5202a54edb50afcd547f8b4f9dad2ad01d | Python | diana-bablumyan/My-Homework-2 | /HW 4.2.py | UTF-8 | 785 | 3.734375 | 4 | [] | no_license | class Cube:
def __init__(self, height, width, length):
self.height = height
self.width = width
self.length = length
def sorted_list(self):
dim_tuple = (self.height, self.width, self.length)
dim_list = list(dim_tuple).copy()
dim_list.sort()
return dim_list
def __le__(self, other):
self_dim = s... | true |
d2cec737490ac177824de0dc909df9db52f0aa9d | Python | aravindanath/rio_de_janeiro | /Day9/WriteXlsx.py | UTF-8 | 372 | 2.953125 | 3 | [] | no_license | import openpyxl
# opnepyxl is the lib to read and write xlsx files..
path ="./TestData.xlsx"
op = openpyxl.load_workbook(path)
vk = op.sheetnames
print("No of sheets present in the workbook",vk)
# Wite to sheet
sh = op["DemoSheet"]
# Cell address is A1 --> 1st cell in the worksheet
sh["A1"]="Welcome to pyexl class"... | true |
a88b85c4d32c73ce025c28935025e94facd93e06 | Python | ElizabethDuncan/comprobo_mobilerobotics | /scripts/mouseClickTest.py | UTF-8 | 2,275 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
from Tkinter import *
from tkFileDialog import askopenfilename
import Image, ImageTk
import numpy as np
import scipy.misc.pilutil as smp
import pickle
import rospy
from map_manipulation import *
from astar import *
if __name__ == "__main__":
root = Tk()
#setting up a tkinter canvas ((((w... | true |
e73106326c17553369aa2b231f5ce024ba3ace6e | Python | niomictomi/shannon_entropy | /entropy_checker.py | UTF-8 | 289 | 3.359375 | 3 | [] | no_license | import math
import random
def shannon_entropy(sentence):
entropy = 0
for character_i in range(256):
Px = sentence.count(chr(character_i))/len(sentence)
if Px > 0:
entropy += - Px * math.log(Px, 2)
return entropy
print(shannon_entropy("google.com"))
| true |
11db233b682fb44169986194729f16351084c5dc | Python | gal-star/translationese | /translationese/positional_token_frequency.py | UTF-8 | 760 | 2.71875 | 3 | [] | no_license | import translationese
from translationese.utils import sparse_dict_increment
POSITION_NAMES = {
"first": 0,
"second": 1,
"antepenultimate":-4,
"penultimate":-3,
"last":-2 # -1 is the period
}
def quantify(analy... | true |
9947407110014d9406dcbd4f853d2d6ffe73f9d0 | Python | averak/physical-computing-exercise2 | /src/key/vector.py | UTF-8 | 1,354 | 2.828125 | 3 | [] | no_license | import copy
import numpy as np
from . import DEFAULT_DIM
class KeyVector:
def __init__(self, dim=DEFAULT_DIM, vector=None):
if vector is None:
self._dim = dim
self._vector = []
self.reset()
else:
self._dim = len(vector)
self._vector = li... | true |
c51f5bf2a9088056d8d7158b18cd5e0f3134125a | Python | CPUDoHyeong/Python | /step11/step11_2751.py | UTF-8 | 329 | 3.390625 | 3 | [] | no_license | # 백준 알고리즘 - 2751
'''
수 정렬하기2
파이썬의 sroted 이용-> O(nlog(n))이기 때문에.
그리고 sys를 이용해서 더빠른 입력 출력 가능
'''
import sys
n = int(input())
arr = []
for i in range(n) :
arr.append(int(sys.stdin.readline()))
for i in sorted(arr) :
sys.stdout.write(str(i)+'\n') | true |
daba1332200d1176388eaafb0f6ebee0f147e6c9 | Python | IamGianluca/sleepmind | /tests/test_categorical_imputer.py | UTF-8 | 1,202 | 3 | 3 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
import pytest
from sleepmind.preprocessing import CategoricalImputer
from pandas.util.testing import assert_frame_equal
@pytest.mark.parametrize(
"df,missing,strategy,expected",
[
(
pd.DataFrame(
{"a": ["hi", np.NaN, "hi"], "b": [np.N... | true |
56254672e136f7676bdc3189ffa3e4647d2bf26c | Python | sjunhongshen/NNAC | /MuJoCo/basic_agents/replay_buffer.py | UTF-8 | 1,845 | 2.609375 | 3 | [] | no_license | import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
from tensorboardX import SummaryWriter
class ReplayBuffer(object):
def __init__(self, state_dim, action_dim, max_size=int(1e6), change_done=True):
self.max_size = max_size
self.... | true |
df16e66a02dfe500de197a959dddb136ced73b31 | Python | cloud-np/Task-Scheduling | /classes/Machine.py | UTF-8 | 4,223 | 2.765625 | 3 | [] | no_license | from colorama import Fore, Back, Style
from random import randint
from typing import List
from math import floor, ceil
NETWORK_KBPS = 12000
CORE_SPEED = 1200
class Machine:
def __init__(self, id_, name, n_cpu=None, speed=None, network_speed=None, memory=None, cpti=None):
self.schedule_len = 0
se... | true |
63ab28c1a9c67243569cb17307399cbf1edab838 | Python | iHaveBecomeDeath/kattis-practice | /Problems/r2.py | UTF-8 | 80 | 2.609375 | 3 | [
"Unlicense"
] | permissive | r1s = list(map(int, input().split()))
print(sum(r1s) - ((r1s[0] * 2) - r1s[1]))
| true |
dddb2fb155780939f8c03c3264eca06659d93390 | Python | karishma3397/forskDaily | /day19/karishma_56.py | UTF-8 | 2,083 | 3.203125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 5 12:16:55 2018
@author: KARIS
"""
#importing data
import pandas as pd
df = pd.read_csv("Auto_mpg.txt", delim_whitespace = True ,header = None )
#naming columns
df.columns = ['mpg','cylinders','displacement','horsepower','weight','acceleration','model year','origin','c... | true |
7d2dd55de6b0e00f2c9d39fb743b945f52a758e7 | Python | yadavkajal/Python-Basics | /PythonDemo.py | UTF-8 | 11,761 | 3.546875 | 4 | [] | no_license | from array import *
vals=[1,2,3,4,5,6,7,8,9]
counter=0
#player Second
def secondPlayer():
counter=0
while True:
try:
pos1=int(input("Player 2 Enter Position of your choice\n"))
if(pos1>9 or pos1<=0):
print("Invalid Input")
elif(pos1<=9 and... | true |
12ea34b45fae62c5d70d915ea6f9ec2c6d4ed7db | Python | gregzer/P2P-Project | /Code/ServiceListener.py | UTF-8 | 1,862 | 2.765625 | 3 | [] | no_license | import json
import Data
import socket
#Listening to all the UDP in the network in order to detect new users
def run_listener():
print(Data.get_time() +"[ServiceListener] Turning ON and listening on port: "+str(Data.UDP_ListenPort))
UDP_host = ""
s = socket.socket(socket.AF_INET, socket.SOCK_DGR... | true |
0056cc6a41ad988ca5a55f5e50f1e82a7a94907e | Python | Keekay-OD/Twitterbot | /config.py | UTF-8 | 430 | 2.578125 | 3 | [] | no_license | # Edit this confif file as you like
# This is hastag which Twitter bot will search and retweet. You can edit this with any hastag .For example : '#javascript'
QUERY = '#EXAMPLE_HASHTAG_TO_LIKE'
# Twitter bot setting for liking Tweets
LIKE = True
# Twitter bot setting for following user who tweeted
FOLLOW = False
... | true |
60f8b1f1f68ca3e7efc95608db3bf3881f80f6ff | Python | mattli001/mediaplat | /src/plugin_base.py | UTF-8 | 1,633 | 2.8125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import os
from log import log
class InvalidPluginType(Exception):
""" Plugin type is not suitable """
class MissingPluginInfo(Exception):
""" Some Plugin information is not provided """
class MediaPlugin(object):
"""
The simple interface to be inherited when creating a plug... | true |
a8ccc97adc9bdc3b8359878b8e56359dffa9b8f2 | Python | inyong37/Study | /V. Algorithm/ii. Site/A. Hacker Rank/30 Days of Code/Python/25_RunningTimeAndComplexity_Normal_Ver2.py | UTF-8 | 1,923 | 3.8125 | 4 | [] | no_license | # Author : inyong1020@gmail.com
# Date : 2020-06-27-Sat.
# Description : Hacker Rank; 30 Days of code; Day 25: Running Time and Complexity.
# State : Passed.
# Environment : -
# Input : -
# Output : -
# Reference : https://www.hackerrank.com/challenges/30-running-time-and-complexity/forum... | true |
2203897797eb91018cf503e436543005b6305c32 | Python | ncerovec/opencv-python-project | /ParkingDetectionBgSubModelGUI.py | UTF-8 | 2,052 | 2.953125 | 3 | [] | no_license | import cv2
import os
from ParkingDetection import ParkingDetection
class BgSubModelParkingDetection(ParkingDetection):
def detectParking(self, imgPath, emptyFolderPath):
# Load image and edit path of empty folder
emptyFolder = emptyFolderPath + '/'
img = cv2.imread(imgPath, 1)
#... | true |
3e0d67be1a3152409f6f22454d8cf3bc7a5e5015 | Python | who-a-m-i/py-code | /Py3/Mycacu.py | UTF-8 | 393 | 3.421875 | 3 | [] | no_license | #-*- coding: utf-8 -*-
'''
Created on 2018年4月30日
@author: LSH8880
'''
class Point:
def __init__(self,x,y):
self.x = x
self.y = y
def __add__(self,oth):
return Point(self.x + oth.x,self.y + oth.y)
def info(self):
print(self.x,self.y)
if __name__ == '__main__':
... | true |
661ef0bdea931091542ea73daefd531c1ca4308f | Python | KongYun-Mrs/practice | /priactice_test/test2/M2CryptoWin64-0.21.1-3/M2Crypto/PGP/PublicKey.py | UTF-8 | 1,614 | 2.609375 | 3 | [
"MIT"
] | permissive | """M2Crypto PGP2.
Copyright (c) 1999-2003 Ng Pheng Siong. All rights reserved."""
from packet import *
import RSA
class PublicKey:
def __init__(self, pubkey_pkt):
import warnings
warnings.warn('Deprecated. No maintainer for PGP. If you use this, please inform M2Crypto maintainer.', DeprecationWar... | true |
47c32e5ee1e714bac87012dc0319af734e29821d | Python | agimenezpy/wrftools | /wrftools/tools.py | UTF-8 | 8,800 | 2.828125 | 3 | [
"MIT"
] | permissive | #-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: slha
#
# Created: 15/08/2012
# Copyright: (c) slha 2012
# Licence: <your licence>
#-------------------------------------------------------------------------------
#!/usr/bin/env ... | true |
b5a777acb9b15522a2f591e3c85b26a94f214f89 | Python | chengchengXCC/interview_questions | /LintCode/1st_round_fail/93.py | UTF-8 | 931 | 2.96875 | 3 | [] | no_license | #!/usr/bin/python
import requests
import pdb
import sys
class Solution:
def absOfDiff(self, a, b):
if a >= b:
return a - b
else:
return b - a
'''
# Sol1
def isBalanced(self, root):
if root == None:
return True
lH = self.maxDepth(root.left)
rH = self.maxDepth(root.right)
... | true |
c1b335ea59f3d90bac4eab13efd095796cbf62c1 | Python | palladius/appengine | /externals/appengine_csv/encoding.py | UTF-8 | 1,797 | 3.265625 | 3 | [] | no_license | import codecs
import cStringIO
import csv
# shameful copyn'paste from python stdlib doco
class UnicodeWriter:
"""
A CSV writer which will write rows to CSV file "f",
which is encoded in the given encoding.
"""
def __init__(self, f, encoding="utf-8", **kwds):
# Redirect output to a queue
... | true |
a2f815b9f7f2313d029a1fdf51cc1df82460ef5d | Python | trytercept/schemaless | /schemaless/orm/converters.py | UTF-8 | 645 | 2.859375 | 3 | [
"ISC"
] | permissive | import time
import datetime
class Converter(object):
@classmethod
def to_db(cls, obj):
raise NotImplementedError
@classmethod
def from_db(cls, val):
raise NotImplementedError
class DateTimeConverter(Converter):
@classmethod
def to_db(cls, obj):
return time.mktime(obj... | true |
502ddca477315874a0506f36978b1b4fa4cdc320 | Python | rafaelperazzo/programacao-web | /moodledata/vpl_data/486/usersdata/295/114120/submittedfiles/AvF_Parte2.py | UTF-8 | 544 | 3.25 | 3 | [] | no_license | # -*- coding: utf-8 -*-
n = 0
matriz = []
m = int(input("Digite sua idade: "))
while m<18:
m = int(input("Digite sua idade: "))
n = int(input("Digite sua altura: "))
while n<0:
n = int(input("Digite sua altura: "))
for i in range(1,n+100):
linha=[]
for i in range(1,n+100):
x = int... | true |
00d83ea94e601609aaad2f243ce2da4ef0ee4656 | Python | kanade9/kyopro | /AtCoder/practice/VC1117/M.py | UTF-8 | 572 | 2.71875 | 3 | [] | no_license | # https://atcoder.jp/contests/code-festival-2016-qualc/tasks/codefestival_2016_qualC_b
from collections import Counter
k, t = map(int, input().split())
a = map(int, input().split())
C = Counter(a)
# print(C.most_common()[0])
before_select = -1
ans = 0
for i in range(k):
select_index, select_value = C.most_common... | true |
0db71393e5ae69aab636a14641f7beef53c61e54 | Python | QMIND-Team/SmartHome | /matchThetreTemp.py | UTF-8 | 1,736 | 3.21875 | 3 | [] | no_license | def readTheatreData(fileName):
with open(fileName) as theatreData:
firstLine = True
myDict = {}
for line in theatreData:
if(firstLine):
firstLine = False
continue
if(line == '\n'):
continue
line = line.spli... | true |
abbc717974d214f89897e85953ab1951e29d9674 | Python | AcezukyRockon/VerilogHDL_UIT | /Group Project/AlgorithmVerification.py | UTF-8 | 690 | 4.25 | 4 | [] | no_license | # This script verify Newton's algorithm in approxiating
# the square root of a number
import math
def SquareRoot(n):
x = n
root = 0.0
for i in range(12):
root = 0.5 * (x + (n / x))
x = root
return root
# Main script
num = 0.0
NumOfCase = 0
AverageError = 0
for i in range(1000000):
... | true |
26f7607dbb28cfa704e847737d613ac74c461c0c | Python | luninez/SGE2018 | /Python/Ejercicios/Boletin5/Ejercicio5-sistema.py | UTF-8 | 3,549 | 3.140625 | 3 | [] | no_license | class Asteroide():
def __init__(self, masa, diametro, per_rotacion, per_traslación, distancia, excentricidad):
self.__masa = masa
self.__diametro = diametro
self.__per_rotacion = per_rotacion
self.__per_traslacion = per_traslación
self.__distancia = distancia
self.__e... | true |
3c1d3a11e6415b2598ceb67fa8af02f53facaadd | Python | nbgao/Python-Project | /Tensorflow/TensorFlow 实战Google学习框架/U3-TensorFlow入门/test03_BPNN_1.py | UTF-8 | 547 | 3.140625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import tensorflow as tf
# 声明w1、w2两个变量 通过seed参数设定了随机种子
w1 = tf.Variable(tf.random_normal([2, 3], stddev=1, seed=1))
w2 = tf.Variable(tf.random_normal([3, 1], stddev=1, seed=1))
# 暂时将输入的特征向量定义为一个常量
x = tf.constant([[0.7, 0.9]])
# 通过前向传播算法获得神经网络的输出
a = tf.matmul(x, w1)
y = tf.matmul(a, w2)
sess... | true |
77459be9cb2f8806a3836fb43d6d098881fd937d | Python | wabu/zeroflo | /zeroflo/top/container.py | UTF-8 | 5,718 | 3.359375 | 3 | [
"MIT"
] | permissive | from functools import reduce
from collections import defaultdict
class Ref(tuple):
def __new__(cls, name, id):
return super().__new__(cls, (name,id))
@property
def name(self):
return self[0]
@property
def id(self):
return self[1]
def __str__(self):
return
cla... | true |
6b8fdbe0334ae7f9fc682b1744036fb2e59e62a8 | Python | pranjal2018201094/Statistical-Methods-in-Artificial-Intelligence | /assignment 1/src/q-1-1.py | UTF-8 | 6,192 | 2.796875 | 3 | [] | no_license |
#get_ipython().run_line_magic('matplotlib', 'inline')
import math
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import random
import operator
import pprint
df=pd.read_csv("train.csv")
def train_validate_split(df,test_size):
if isinstance(test_size,float):
test_size = round(tes... | true |
78d09f31b6c72673df4bed539b2373ce993c632a | Python | digitronik/widgetastic.patternfly4 | /testing/test_menu.py | UTF-8 | 1,516 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | import pytest
from widgetastic.widget import View
from widgetastic_patternfly4 import Menu
from widgetastic_patternfly4 import MenuItemNotFound
TESTING_PAGE_URL = "https://patternfly-react.surge.sh/components/menu"
@pytest.fixture
def menu(browser):
class TestView(View):
ROOT = ".//div[@id='ws-react-c-m... | true |
54539d57b1d6f5e809361c52a7029f93a0f1ea0f | Python | a-r-i/tokyo_in_wifi_website | /tokyo_in_map/tests/test_services.py | UTF-8 | 882 | 3.015625 | 3 | [] | no_license | from django.test import TestCase
from ..services import search_spots, culc_distance
class TestSearchSpots(TestCase):
def setUp(self):
# 新宿駅の緯度と経度
self.latitude = 35.6895924
self.longitude = 139.7004131
self.count = 100
def test_spots_is_instance_list(self):
spots = se... | true |
b8be964b51f524a8ac8680d886cbdb1544aca9cd | Python | MoonSangJin/CodingTest | /Programmers/(카카오)괄호변환.py | UTF-8 | 866 | 2.953125 | 3 | [
"MIT"
] | permissive | def partition_index(p):
cnt=0
for i in range(len(p)):
if p[i]=='(':
cnt+=1
else:
cnt-=1
if cnt==0:
return i
def check_proper(p):
cnt=0
for i in p:
if i=='(':
cnt+=1
else:
if cnt==0:
return... | true |
03ae15c7fca0f22666f4abc151ab2c13223f9d90 | Python | yrmss0204/nw | /basic.py | UTF-8 | 3,029 | 3.21875 | 3 | [] | no_license | # -*- coding: utf8 -*-
# 문자 출력
print "python"
#변수 선언
msg = "hello python"
print msg
# 문자열 슬라이싱
print msg[1:3]
print msg[-3:]
print msg[:-2]
print msg[::-1]
#리스트
data = []
#리스트 자료 입력
data.append("hi")
data.append(123)
data.append(1.2)
#리스트 출력
print data
#리스트 데이터 제거
data.pop()
print data
data.pop()
print data
#리스트 요소 인... | true |
4512601b8e3a9e6eda64340ca1da2cf043bf8a46 | Python | hannahnvc/CPSC322-Final-Project | /flask_app.py | UTF-8 | 5,544 | 2.90625 | 3 | [] | no_license | # we are going to use a micro web framework called Flask
# to create our web app (for running an API service)
import os
from flask import Flask, jsonify, request
import mysklearn.myclassifiers
from mysklearn.myclassifiers import MyNaiveBayesClassifier
import mysklearn.myevaluation
import mysklearn.myevaluation as mye... | true |
852b9643a1862e98f69ffd21b655a0fb462b2df8 | Python | mfbx9da4/mfbx9da4.github.io | /algorithms/codeforces/array_sharpening/main.py | UTF-8 | 326 | 3.109375 | 3 | [] | no_license | """
1
248618
3
12 10 8
6
100 11 15 9 7 8
4
0 1 1 0
2
0 0
"""
def solve(array):
k = get_rightmost_k()
_k = get_leftmost_k()
if k >= _k:
return 'YES'
return 'NO'
T = int(input())
for i in range(T):
size_array = int(input())
array = list(map(int, input().split(' ')))
print(solve(ar... | true |
f1ed2c92b7accc4fd61d6ec0f58521ccf086beba | Python | Siilbon/herbert | /herbert_app/data/herb.py | UTF-8 | 533 | 2.609375 | 3 | [] | no_license | from herbert_app import db
from herbert_app.data.source import Source
class Herb(db.Model):
'''key, name, chinese_name, source'''
__tablename__ = 'herb'
key = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String)
chinese_name = db.Column(db.String)
source = db.Column(db.Int... | true |
1b39fc48744b8151e354934ef2dd26c9b6d64466 | Python | svinkapeppa/MIPT_ALGEBRA_ALGO | /task_4/lup.py | UTF-8 | 7,818 | 3.09375 | 3 | [] | no_license | from math import ceil, log2
def calculate_degree(size):
return 2 ** int(ceil(log2(size)))
def get_padded_matrix(size):
matrix = []
for _ in range(size):
zeros = [0] * size
matrix.append(zeros)
for i in range(size):
matrix[i][i] = 1
return matrix
def get_matrix(size):... | true |
6488437d215b42244e34d846f60c973c6c58c5c6 | Python | pathiec92/SmartTruck | /client-raspberry/play/rd.py | UTF-8 | 647 | 2.734375 | 3 | [] | no_license |
from datetime import datetime
# initialize the flags for fridge open and notification sent
class state
isRecording = False
isNotificationSent = False
isPrevRecording = False
startTime = datetime.now()
def recordIt(frame, conf):
print(conf)
timeDiff = (datetime.now() - startTime).seconds
if isRecording an... | true |
e2af125760f21be850a0d9adfedd579f59842e4a | Python | mohammad1238/My-code-py-python | /مجلد جديد/programm accept 2 num.py | UTF-8 | 485 | 4.125 | 4 | [] | no_license | num1=eval(input("please enter first number: "))
num2=eval(input("please rnter second number: "))
process=input("enter the process(product ‘*’ or sum ‘+’ or subtract ‘-‘or division ’/’): ")
if process=="*":
print("the product is: ",num1*num2)
elif process=="+":
print("the sum is: ",num1+num2)
elif process... | true |
31caf3005093a0ae90404d624ca3d7b7bd3013fd | Python | HKang42/cs-sprint-challenge-hash-tables | /hashtables/ex2/ex2.py | UTF-8 | 1,056 | 3.859375 | 4 | [] | no_license | # Hint: You may not need all of these. Remove the unused functions.
class Ticket:
def __init__(self, source, destination):
self.source = source
self.destination = destination
# use a dictionary with source as key and destination as value
# loop through it, the first key is None
# while the desti... | true |
2de2b97d4427214b62c5e25e6cd31a2cac3ff9ca | Python | almoratalla/mimo-python-projects | /functions/calculator.py | UTF-8 | 273 | 4.28125 | 4 | [
"MIT"
] | permissive | def calculator(num_1, num_2, op):
result = 0
if op == "+":
result = num_1 + num_2
elif op == "-":
result = num_1 - num_2
elif op == "*":
result = num_1 * num_2
print(f"{num_1} {op} {num_2} = {result}")
calculator(5, 10, "*") | true |
9293dce889b0992fd86c4039c829bd267e73b2dc | Python | GargNishant/AL-DS | /sorting/insertion_sort.py | UTF-8 | 818 | 3.46875 | 3 | [] | no_license | import random
def sort(arr):
for i in range(1,len(arr)):
# c_e = arr[i]
if arr[i] < arr[i-1]:
for j in range(i-1,-1,-1):
if arr[j] < arr[j+1]:
break
arr[j], arr[j+1] = arr[j+1], arr[j]
def recursive_sort(arr, index=1):
if index =... | true |
350bae844a2e5adba6e71e6685b5f630578a5dd4 | Python | kedarkhetia/Gdrive_terminal | /example/example_download.py | UTF-8 | 193 | 2.765625 | 3 | [] | no_license | from drive import drive
obj = drive.gdrive()
list_of_files = obj.retrieve_all_files()
obj.print_all_files(list_of_files)
file=raw_input("Enter name of file to download : ")
obj.download(file)
| true |
102826b8c1a98fd0aeb91ec331efa1bd082f64db | Python | chenwi/py-work | /merge/merg_en_re.py | UTF-8 | 1,647 | 2.5625 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import numpy as np
'''
merge relation and entity
'''
#C:\Users\Administrator\Desktop\chemical\motify
# print(entity) 二维数据
entity = np.loadtxt(open('C:\\Users\\Administrator\\Desktop\\chemical\\motify\\chemprot_training_entities.tsv',encoding='latin-1'),
delimiter='\t',dt... | true |
8983359d4e137ec1fa1181e1cfd3f9b7126a0ea3 | Python | yoook/filterRSS | /filterHeise.py | UTF-8 | 564 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python3
import filterRSS
def filter_item(item_string, criteria):
link_target = filterRSS.get_tag_attribute(item_string, "link", "href")
filters = {}
filters["techstage"] = lambda link: (link.startswith("https://www.techstage.de/"))
filters["notechstage"] = lambda link: not (link.startswith("http... | true |
cee685b9b9b472f405f7c72455f1889a188c5fe1 | Python | rinocloud/rinobot | /app/test/templates/rinobot-plugin-normalize/index.py | UTF-8 | 663 | 2.625 | 3 | [] | no_license | import sys
import os
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('filepath', type=str)
parser.add_argument('--prefix', type=str)
args, unknown = parser.parse_known_args()
filepath = args.filepath
filename_without_ext = os.path.splitext(fil... | true |
57cc3e44101b642a7e5a9b454a8b0d75b510fd7c | Python | cameron-stewart/simphys1 | /sim1/src/cannonball.py | UTF-8 | 782 | 3.546875 | 4 | [] | no_license | # Simulate a cannonball
import numpy as np
import matplotlib.pyplot as plt
# Constants
m = 2.0
g = 9.81
dt = 0.1
# Define functions
def compute_forces(x):
f = np.array([0.0, -m*g])
return f
def step_euler(x, v, dt):
f = compute_forces(x)
x += v*dt
v += f*dt/m
return x, v
# Initialize var... | true |
dfa357a593a8ba4e377b3eb86ff624b883efe25b | Python | vijaygopal1/SonarQube-integration | /Python Script/addno's.py | UTF-8 | 209 | 4.09375 | 4 | [] | no_license |
#Assiging 1st No
x=input("Enter 1st No?:")
#Assiging 2nd No
y=input("Enter 2nd No?:")
#Result declaration & 0/0
result= float(x) + float(y)
print("The result of {0} and {1} is {2}".format(x,y,result))
| true |
a7fc42c7a456fcce6956f12330fae39f141db0ab | Python | NessimTarchoun/Master | /event_parser/helpers.py | UTF-8 | 551 | 2.59375 | 3 | [] | no_license | import os, sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),os.path.pardir)))
import json
class Event:
def __init__(self, class_of_operation, operation, t, data):
self.c = class_of_operation
self.o = operation
self.t = t
self.data = data
def... | true |
f37c60a89fcd7c5f3933f3ad1100695cc1e09007 | Python | AlexTaran/Experimental | /crawler/get_letters.py | UTF-8 | 546 | 3.125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
# This file contains code for fetching letters list from a domain
import urllib2
import constants
import re
# fetches list of letters
def get_letters():
data = urllib2.urlopen("http://"+constants.DOMAIN_NAME).read()
letter_regexp = re.compile('<a class="purple" href... | true |
de59a199c3dcfd173c0be602a0d57b759591e653 | Python | akrherz/iem | /scripts/iemre/db_to_netcdf.py | UTF-8 | 1,147 | 2.65625 | 3 | [
"MIT"
] | permissive | """Copy database grids to netcdf.
Example: python db_to_netcdf.py <year> <month> <day> <utchour>
If hour and minute are omitted, this is a daily copy, otherwise hourly.
see: akrherz/iem#199
"""
import datetime
import sys
import numpy as np
from pyiem import iemre
from pyiem.util import logger, ncopen, utc
LOG ... | true |
7d0c3462e6ac6795ea5b9958f599df8364065221 | Python | cavestruz/L500analysis | /fitting/ICM_profiles/training_io/parse_config.py | UTF-8 | 1,196 | 3.109375 | 3 | [
"MIT"
] | permissive | '''
Load and parse the ini file to determine how and what models to build.
'''
import ConfigParser
from collections import defaultdict
class MyConfigParser :
def __init__(self, inifile) :
'''Returns a dictionary of config parameters'''
self.cp = ConfigParser.ConfigParser()
self.cp.read(i... | true |
e27d8dea829f1e31d4a7ee370137a9da07772914 | Python | AsadHasan/BulkTest | /pages/PageHelper.py | UTF-8 | 662 | 2.859375 | 3 | [] | no_license | from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
class PageHelper:
def __init__(self, driver):
self.driver = driver
self.wait = WebDriverWait(self.driver, 5)
def wait_to... | true |
246bed40a99481614ea9cc62dd050764f6297f79 | Python | wull566/tensorflow_demo | /tutorials/5_scraping/source_code/4-2-asyncio.py | UTF-8 | 2,120 | 2.84375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
异步爬虫
asyncio: Python官方框架异步IO
? 先asyncio,再多进程,速度慢
应该先多进程,再asyncio
"""
import aiohttp
import asyncio
import time
from bs4 import BeautifulSoup
from urllib.request import urljoin
import re
import multiprocessing as mp
base_url = "https://morvanzhou.github.io/"
# bas... | true |
71945975506b7ea43163cd81e0403f267d25abb5 | Python | ilija1/logtron | /logtron/util/merge_dict.py | UTF-8 | 464 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | import sys
if sys.version_info > (3, 0):
from collections.abc import Mapping
def _get_iterator(d):
return d.items()
else:
from collections import Mapping
def _get_iterator(d):
return d.iteritems()
def merge(d, u):
if not isinstance(d, Mapping):
return d
for k, v in... | true |
884a2d1a1524a99c2281ca635b7429862c25e9ba | Python | kmmate/Budapest-smog-alert- | /imputation.py | UTF-8 | 11,641 | 2.65625 | 3 | [] | no_license | # (I): Print statistics on missing number of data on a day
# (II): Plot distance and correlation matrices
# (III): Impute the PM10 missing values based on t, in all Training, Testing, Evaluation periods
savefigure_mode=False #if True, script saves figures but not display them, if False no saving but showing
... | true |
53a56bc7d1f6f06bc6c79737ac533cd1c76c4ec7 | Python | arahansa/st_python | /05_함수와모듈/07_내장함수.py | UTF-8 | 286 | 3.890625 | 4 | [] | no_license | print("== 절대값 == ")
print(abs(-3))
print("== 유니코드 == ")
print(chr(97))
print("== enumerate == ")
for i, stock in enumerate(['Naver', 'KAKAO', 'SK']):
print(i, stock)
print("== 리스트 == ")
print(list((1,2,3)))
print("== 소트 == ")
print(sorted((4,3,1,0))) | true |
1e8db9cf6bebc7faae9faf77a2e340d25b766170 | Python | Phyisis/Problems | /src/101-200/P191.py | UTF-8 | 392 | 2.5625 | 3 | [] | no_license | from helpers import analytics
analytics.monitor()
from functools import lru_cache
# 0,1,2 = O, A < 3 consecutive, L < 2
@lru_cache
def T(r,n):
if n==r: return 2**n - 1
if n < r: return 2**n
return sum(T(r,n-i) for i in range(1,r+1))
def main(limit):
return T(3,limit) + sum(T(3,i)*T(3,limit-(i+1)) for ... | true |
51f78b6925771064a489392ed5d5f3a0533e842c | Python | westplainsdev/quotes-on-demand-python | /api/crud.py | UTF-8 | 973 | 3.296875 | 3 | [
"MIT"
] | permissive | import json
with open('data.json') as json_file:
data = json.load(json_file)
def get():
return json.dumps(data)
def get_by_id(id):
for item in data:
if item['id'] == int(id):
print('The object found is: ', item)
return json.dumps(item)
def create(quote):
max_item =... | true |
d9b56bff84d3186cb6cd02d18f76330997164ee0 | Python | XiangyiKong/cs373-idb | /tests.py | UTF-8 | 6,020 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python3
# -------
# imports
# -------
import unittest
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from models import (Base, Characters, Comics, Creators, Events, Series,
Stories, Images)
# -----------
# TestModels
# -----------
class TestModels (TestCase) :
... | true |
513be32d0144f9cbe2d264223139f7c95812c453 | Python | iFengZhao/Algorithms-1 | /剑指Offer/21-调整数组顺序使奇数位于偶数前面.py | UTF-8 | 734 | 3.84375 | 4 | [
"Apache-2.0"
] | permissive | '''
题目:
输入一个整数数组,实现一个函数来调整该数组中数字的顺序,使得所有奇数位于数组的前半部分,所有偶数位于数组的后半部分。
'''
class Solution:
"""
@param: nums: an array of integers
@return: nothing
"""
def reorder_odd_even(self, nums):
if not isinstance(nums, list) or len(nums) == 0:
return
begin = 0
end = len(nums) -... | true |
27a037070d50dd599d612a3b2f4633a48a8b3a95 | Python | thanoskoutr/Reverse-Shell | /reverse_persistent.py | UTF-8 | 1,405 | 3.140625 | 3 | [] | no_license | #!/usr/bin/python3
import argparse
import os
import socket
import subprocess
import time
# Create CLI interface with arguments
parser = argparse.ArgumentParser(description="""Simple Reverse Shell script in
Python that tries indefinitely to connect to a remote machine.""")
parser.add_argument('ip', metavar='I... | true |
3728badfe2bffc28dfbdd7d2fb33facc5942747d | Python | szymkosz/AILIENS | /MP3_Pattern_Recognition/perceptron.py | UTF-8 | 16,424 | 3.609375 | 4 | [] | no_license | # Import the necessary libraries
import numpy as np
import helper
import matplotlib.pyplot as plt
"""
This is the driver function for training a perceptron with particular parameters
on the training data and then classifying the test data.
"""
def run_perceptron(training_data_tuple, test_data_tuple, isDifferentiable,... | true |
cd2856130ed67d1a301d13ef56ab4b84821025f2 | Python | Triton3D/vr-shell | /wx_changemode.py | UTF-8 | 337 | 2.75 | 3 | [] | no_license | import wx
CurrDisplay=wx.Display
OldMode=wx.DefaultVideoMode
ListVideoModes=CurrDisplay.GetModes(CurrDisplay())
NewMode=ListVideoModes[len(ListVideoModes)-35]
MaxWidth=NewMode.GetWidth()
MaxHeight=NewMode.GetHeight()
print(str(MaxWidth)+'x'+str(MaxHeight))
CurrDisplay.ChangeMode(CurrDisplay(),NewMode)
input("H... | true |
a6827ea0f308530af6a33d0508e2665cc5f9d322 | Python | ericocsrodrigues/Python_Exercicios | /Mundo 03/ex088.py | UTF-8 | 632 | 4.28125 | 4 | [] | no_license | """
Exercício Python 088: Faça um programa que ajude um jogador da MEGA SENA a criar palpites.O programa vai perguntar quantos jogos serão gerados e vai sortear 6 números entre 1 e 60 para cada jogo, cadastrando tudo em uma lista composta.
"""
from random import randint
apostas = list()
dados = list()
jogos = int(inpu... | true |
14a265449ef52ac223db5397beffe31341111587 | Python | odnaks/Codeforces | /another/2.py | UTF-8 | 920 | 3.421875 | 3 | [] | no_license | # возвращает индекс i, где ns[i] <= x <= ns[i+1]
def mini_bin_search(ns, x):
begin = 0
end = len(ns)
i = len(ns) // 2
while begin != end:
if ns[i] <= x:
begin = i + 1
i = (end - begin) // 2 + begin
else:
end = i
i = (end - begin) // 2 + be... | true |
92abadcd68b5346eaf237ec558db16d1a88a0799 | Python | 11911474/Python-Project | /PCW/PCW/flip.py | UTF-8 | 1,737 | 3 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import pandas as pd
import PriceApp
data = {"products": [], "prices": [], "ratings": []}
url = "https://www.flipkart.com/search?q="
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/... | true |
a24a4e6402308942703d2ce4674fd9c4c1451a66 | Python | davidharvey1986/timeDelay | /quickTestOfSIS.py | UTF-8 | 6,224 | 2.75 | 3 | [] | no_license |
import numpy as np
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import ipdb as pdb
import pickle as pkl
from cosmolopy import distance as dist
import os
class lens:
def __init__( self, position, resolution = 1000 ):
'''
The lens set up, epslion 0 is for an SIS
... | true |
29eb3bfab6532e6a86ed6b5756c73b5ac1fd5346 | Python | Jonathan-aguilar/DAS_Sistemas | /Ago-Dic-2019/NoemiEstherFloresPardo/Practica1/SummingAMillion.py | UTF-8 | 359 | 4.40625 | 4 | [
"MIT"
] | permissive | """4-5. Summing a Million: Make a list of the numbers from one to one million,
and then use min() and max() to make sure your list actually starts at one and
ends at one million. Also, use the sum() function to see how quickly Python can
add a million numbers."""
numeros = list(range(1, 1000001))
print(min(numeros))
... | true |
11061605c25188253aeb499ca8541ab610082810 | Python | quynhvi98/teky-course | /level1/lesson4/hw/liem/hw_6.py | UTF-8 | 202 | 3.265625 | 3 | [] | no_license | input('Moi cac ban nhap mot so nguyen bat ki:')
a=input
odd=1
while a>0:
if a%2==0:
print(odd)
odd+=2
elif a%2==1:
print(odd)
odd+=2
if odd>a:
break | true |
f5fba9578750bd65692625dc47a8bbc12bae0b65 | Python | theredpea/pele | /html/Element.py | UTF-8 | 10,073 | 3.171875 | 3 | [] | no_license | #Node
from ..Node import Node
from ..Text import Text
from ..Fragment import Fragment
from ..IRenderable import IRenderable
#Builtin
import re
import itertools
class Element(IRenderable, Node):
#HTML DOM distinctions
_hasRef = False
_selfClosing = False
_bl... | true |
a20d060eb720ee28974d3711afcf8d50c188f5ed | Python | jgomezdans/GDAY | /build/lib/gday/nmineralisation.py | UTF-8 | 5,355 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python
""" Nitrogen mineralisation rate is given by the excess of N out over N in """
import constants as const
from utilities import float_eq, float_lt, float_gt, Bunch
__author__ = "Martin De Kauwe"
__version__ = "1.0 (25.02.2011)"
__email__ = "mdekauwe@gmail.com"
class Mineralisation():
""... | true |
00342a16daa62cfe4f9a978de4d0b44f89750973 | Python | avaldeon/mapqonverter | /modules/functions.py | UTF-8 | 2,028 | 3.203125 | 3 | [
"MIT"
] | permissive | import _ctypes
import arcpy
def is_close(float1, float2, relative_tolerance=1e-9, absolute_tolerance=0.0):
""" This is a comparison for floats and taken from Python 3.5
:param float1: Float - Value 1
:param float2: Float - Value 1
:param relative_tolerance: the relative tolerance in nano
:param a... | true |
ea6bb0a905d78cfe50e7c6879035c1d477208dc0 | Python | GithuJeevaSavy/Artificial-Intelligence | /Backtracking.py | UTF-8 | 2,954 | 4.3125 | 4 | [] | no_license | # Python3 program to solve Knight Tour problem using Backtracking
import datetime
import time
# Chessboard Size
totalRows = 8
totalCols = 8
startRow = 2
startCol = 2
possibleMoves = [[2, 1], [1, 2], [-1, 2],
[-2, 1], [-2, -1], [-1, -2], [1, -2], [2, -1]]
# Function to validate if next move is possi... | true |
5e9d4907948379bd996a660e0b48a9de33e49d6b | Python | ipekgoktan/SHINE_Ipek-Mena | /src/kuri_mi/src/kuri_move.py | UTF-8 | 1,512 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
import rospy
import sys
import termios, tty, os, time
from geometry_msgs.msg import Twist
from std_msgs.msg import String
def run():
pub = rospy.Publisher('/mobile_base/commands/velocity', Twist, queue_size = 10)
rospy.init_node('kuri_move')
rate = rospy.Rate(10)
m = Twist()
... | true |