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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
771ce6325e64ea100ff34adde558e40b300985e0 | Python | yay203/cmpt-317 | /cmpt317/a1/invarith.py | UTF-8 | 8,470 | 4 | 4 | [] | no_license | # CMPT 317.201809: Assignment 1 Question 1
# Given a target integer T, and a list of positive integers L
# Construct an expression using elements of L and
# integer operators + * // -
# so that the expression evaluates to T
# This implementation is pretty tricksy. Several tricks are used to conserve memory and save t... | true |
f8908e4e248ff9a40735ab0f85003a1079b84b90 | Python | leohowell/leetcode-python | /round-01-2017/103.Binary_Tree_Zigzag_Level_Order_Traversal.py | UTF-8 | 761 | 3.421875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from tools.binary_tree import TreeNode, get_linked_list
def level_order(root, level, res):
if not root:
return
if len(res) < level + 1:
res.append([])
res[level].append(root.val)
level_order(root.left, level+1, res)
level_order(root.right, level+1, res)
... | true |
6d5a924c90e485fff64dcc74e2169296b3776c27 | Python | Bornunique911/Auto_Wordlists | /scripts/ghdb_scraper/ghdb_scraper.py | UTF-8 | 7,044 | 2.78125 | 3 | [] | no_license | #!/usr/bin/python3
# Standard Python libraries.
import argparse
import json
import time
import re
import validators
# Third party Python libraries.
import requests
from bs4 import BeautifulSoup # noqa
# Custom Python libraries.
"""
Dork dictionary example:
{
"id": "2",
"date": "2003-06-24",
"url_titl... | true |
04cb8863eed0c23cec26d0ac3308b4a0d3f205da | Python | yujiadeng/ITRSimulation | /ITRSimEng_py/x5t2y1_dichotomous_linear1.py | UTF-8 | 3,107 | 3 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
This is an implecation of the simulation setting of "Convergence in observational studies" of
"Estimating optimal treatment regimes via sbugroup identification in randomized contro trials and observational studies"
tunning parameter: b, i in a_func
theta in y_func
@auth... | true |
d7ceb720ac139c78d5f53b2d3b2ed9a98f92c04f | Python | jonasrothfuss/ProMP | /meta_policy_search/policies/distributions/base.py | UTF-8 | 4,069 | 3.21875 | 3 | [
"MIT"
] | permissive | class Distribution(object):
"""
General methods for a generic distribution
"""
@property
def dim(self):
raise NotImplementedError
def kl_sym(self, old_dist_info_vars, new_dist_info_vars):
"""
Symbolic KL divergence of two distributions
Args:
old_dis... | true |
45146d2b978d5a349f015b112284bcbf955f5d6e | Python | dbbudd/Python-Experiments | /EmuBot/EmuBot USB2AX 2017/Working-Code-CCGS/RoboCup_Client2017 Others/guiClient.py | UTF-8 | 1,563 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
import time
# import sys
def start_pos():
defarm = [200, 200, 512]
moveJoint(7,512,100)
moveJoint(6,200,100)
moveJoint(5,200,100)
thread1.position = 200
defarm = [200, 200, 512]
# Create a socket(SOCK_STREAM means a TCP socket)
from lib_threading1 import *
def forward():
... | true |
6d084216ec2d9e3ec22fc0d0fb0bfb5d574e8ad6 | Python | lucventurini/pydigree | /pydigree/paths.py | UTF-8 | 6,982 | 3.5625 | 4 | [
"Apache-2.0"
] | permissive | "Functions for finding paths through pedigrees and genealogies"
from pydigree.common import table
def common_ancestors(ind1, ind2):
"""
Common ancestors of ind1 and ind2.
Recursively searches ancestors for both individuals, and
then performs a set intersection on on each set of ancestors
:p... | true |
fa50c32cba421db634a22ae7d478a7d33cfd194a | Python | werewolves-devs/Werewolf_Bot | /management/general.py | UTF-8 | 3,868 | 2.875 | 3 | [] | no_license | import sqlite3
import random
from config import general_database
from management.position import positionof
from management.db import db_set
conn = sqlite3.connect(general_database)
c = conn.cursor()
def add_activity(user_id,user_name):
"""Increase the activity score of a player."""
c.execute("SELECT * FROM '... | true |
9fd6c4051351a48c4a3c1cf9be99c60aab23c4db | Python | limitmhw/tcnlstm | /TCNLSTM.py | UTF-8 | 799 | 2.546875 | 3 | [] | no_license | import torch
import torch.nn as nn
from TCN import TCNBlock
class TCNLSTM(nn.Module):
def __init__(self, n_features, n_filters, filter_size, dropout_rate=0.1):
super().__init__()
self.tcn = TCNBlock(n_features=n_features, n_filters=n_filters, filter_size=filter_size)
self.dropout ... | true |
d8191a3f844abc289f3f4aa210361afd4761f6bb | Python | Cbeale2020/CaseWesternReserveProjects | /WebScraping_Project/Missions_to_Mars/scrape_mars.py | UTF-8 | 2,397 | 2.609375 | 3 | [] | no_license | from bs4 import BeautifulSoup
from splinter import Browser
from pprint import pprint
import pymongo
import pandas as pd
import requests
from flask import Flask, render_template
import time
import numpy as np
import json
from selenium import webdriver
def init_browser():
executable_path = {'executable_path': 'chrom... | true |
4816af9b3833626b375299552bf1b99641991733 | Python | Kareemah-codes/HouseClass | /main.py | UTF-8 | 941 | 3.6875 | 4 | [] | no_license |
class House():
"""A class to model a house that is for sale"""
def __init__(self,style,sq_footage, year_built, price):
"""Initialize attributes"""
self.style = style
self.sq_footage = sq_footage
self.year_built = year_built
self.price = price
self.sold = False
self.weeks_on_mrke... | true |
343e656f57cefee822c9df3e9ef86006603ba4ff | Python | 621Alice/Oasis | /Sentiment_Classifier/preprocessing/preprocessing_data_4labels.py | UTF-8 | 1,577 | 2.796875 | 3 | [] | no_license | from functions import *
from sklearn.model_selection import train_test_split
token_num_words=40000
#read CSV file
texts=[]
sentiments=[]
with open(p+"/Data/data.csv", encoding='utf-8') as file:
data=csv.reader(file, delimiter=",")
for row in data:
texts.append(data_cleaning(row[0]))
sentime... | true |
df99ed44a28be35040287cbdb614d7f49c3425fc | Python | MiracleWong/PythonBasic | /geekbang/PythonCoreAndAction/tuple_and_array.py | UTF-8 | 974 | 4.34375 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Python的列表和元组功能
import sys
l = [1, 2, 'hello', 'world']
tup = ('jason', 22)
new_tup = tup + (5, )
print(l)
print(tup)
print(new_tup)
l.append(5)
print(l)
# 支持切片,左开右闭[)
print(l[1:3])
print(new_tup[1:3])
# 可以随意嵌套:
l = [[1, 2, 3], [4, 5]] # 列表的每一个元素也是一个列表
tup = ((1, 2, ... | true |
71cb1769542cfb0109e3deaeb2a3db1ba79d3aac | Python | jnombela/TFM | /Utilidades/generador_npy.py | UTF-8 | 4,785 | 3.109375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 1 14:02:32 2018
@author: justo
"""
import argparse
import random
from tensorflow.python.lib.io import file_io
import numpy as np
from keras.preprocessing.image import img_to_array
from keras.utils import to_categorical
import io
import PIL
from g... | true |
cb00f94e0b31ccd75b5cf2527958e6d90557030a | Python | JettChenT/nonogram | /pprint.py | UTF-8 | 124 | 3.359375 | 3 | [] | no_license | def pprint(mtrx):
for i in range(len(mtrx)):
for j in range(len(mtrx[i])):
print(f"{mtrx[i][j]}",end=' ')
print() | true |
5c1714474fb7ce2f773dea5bd0cb3000c07caa3c | Python | GuHuY/Thesis_Open_Source | /preprocessing_RV/LeetCode.py | UTF-8 | 1,213 | 3.109375 | 3 | [] | no_license | class Solution:
def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:
len1, len2 = len(nums1), len(nums2)
if len1 and len2:
list_sum = []
a, b = 0, 0
min1, min2 = nums1[a], nums2[b]
while True:
if min1 < min2:
... | true |
3898f16db46969ee33e080623e4966593f91dafd | Python | atomextranova/leetcode-python | /High_Frequency/Collection of unique problems/Sparse_Matrix/matrix.py | UTF-8 | 2,220 | 3.5 | 4 | [] | no_license | class Solution:
"""
@param A: a sparse matrix
@param B: a sparse matrix
@return: the result of A * B
"""
def multiply(self, A, B):
# write your code here
# A l*m
# B m*n
l = len(A)
m = len(A[0])
n = len(B[0])
C = [[0] * n for _ in range(l)... | true |
cc1f9a1d56373b6d24538206348247573a9b7cd4 | Python | superpanther/python_assignment | /assignment_only_code.py | UTF-8 | 6,203 | 4.4375 | 4 | [] | no_license | # Q1) Write a program which should return the list on a single line containing the cubes of the first
# 6 Fibonacci numbers. HINT: Use Lambda function.
# cubes=map(lambda num: num**3,[1,1,2,3,5,8])
# print(cubes)
# Q2) Write a program to take input from the user in following formats and also check their t... | true |
e64ce95cdb61c13e37d267ce07c0de41a2ecaf64 | Python | VishnuPulipaka/aLgoToolkit | /gcd.py | UTF-8 | 166 | 3.0625 | 3 | [] | no_license | def gcd(a,b):
if b==0:
return a;
else:
a1=a%b
return gcd(b,a1)
tok=[int(i) for i in input().split()]
print(gcd(max(tok),min(tok)))
| true |
b7fb6ac30d588c3c69aaf1678da13f7143a84251 | Python | AK-1121/code_extraction | /python/python_15830.py | UTF-8 | 236 | 2.65625 | 3 | [] | no_license | # Calculating a half vector from eye/camera vector and surface normal
light_vect = light_position - face_center_position
cam_vect = cam_position - face_center_position
halfangle_vect = (light_vect.normal() + cam_vect.normal()).normal()
| true |
6cea50f0ee2460eb6ad781f91a7a20aa5e8fb6f6 | Python | ilyarudyak/coursera | /foundations-of-deep-learning/09-reinforcement-learning/memory.py | UTF-8 | 502 | 3 | 3 | [] | no_license | from collections import deque
import config
import random
class Memory():
def __init__(self):
self.examples = deque(maxlen = config.MEMORY_LEN)
def add_example(self, example):
self.examples.append(example)
def training_batch(self):
examples = random.sample(
self.exampl... | true |
21cc3fad024d439bec04d00fa7cd2260950648c5 | Python | naivicious/Visualization | /app.py | UTF-8 | 6,058 | 2.515625 | 3 | [] | no_license | from flask import Flask,jsonify
from flask import render_template,request
import config
import utils
import requests
import json
app = Flask(__name__)
@app.route('/')
def index():
return render_template("base.html")
@app.route('/city')
def city():
return render_template("city.html")
@app.route('/district')... | true |
30bf2082e308605faf890b47957dbc82d1be3c05 | Python | akshatk16/EulerProject | /Problem058.py | UTF-8 | 2,090 | 3.609375 | 4 | [] | no_license | # Starting with 1 and spiralling anticlockwise in the following way,
# a square spiral with side length 7 is formed.
#
# 37 36 35 34 33 32 31
# 38 17 16 15 14 13 30
# 39 18 5 4 3 12 29
# 40 19 6 1 2 11 28
# 41 20 7 8 9 10 27
# 42 21 22 23 24 25 26
# 43 44 45 46 47 48 49
#
# It is interesting to note that the o... | true |
f8bbfa9242e1aff8bebfbeb8f9bc535a6adcba92 | Python | skywall34/PythonProjects | /spaceGame.py | UTF-8 | 10,880 | 2.71875 | 3 | [] | no_license | import pygame
from pygame.locals import *
import sys
import random
class SpaceInvaders:
def __init__(self): #fundamentals of the game
self.score = 0
self.lives = 2
pygame.font.init()
self.font = pygame.font.Font(None, 15) #assets/space_inaders.ttf
self.barrierDesign = [[],[... | true |
7b96c32086c461fe6601520006f224f19315bdf8 | Python | ksy1231/Linear_Algebra_in_Computer_Science | /Assignments/Assignment-4/KelvinSung-AS4.py | UTF-8 | 3,748 | 3.203125 | 3 | [] | no_license | from svg_draw import *
import math
from math import sin
width = 1200
height = 800 # define a 400x400 area, with (0,0) at the center
create_plot(width, height, True) # last parameter says draw axis/bound or not
"""
draw_point([0, 0], 20, "(255, 0, 0)")
draw_point([-width/2, 0], 10, "(0, 0, 255)... | true |
b52b80c1ef9bad3a706f6fbba47094d387f72eb7 | Python | VariSingh/deepMNIST_tflearn | /mnist.py | UTF-8 | 749 | 2.578125 | 3 | [] | no_license | import tflearn
#load data
import tflearn.datasets.mnist as mnist
X, Y, testX, testY = mnist.load_data(one_hot=True)
#neural network
input = tflearn.input_data(shape=[None,784])
input = tflearn.fully_connected(input,100,activation='relu')
layer1 = tflearn.fully_connected(input,100,activation='relu')
layer2 = tflearn.f... | true |
b8a64d88e6ea1cc2a5d1d3a8caa40530ed6ae034 | Python | code-lgtm/Problem-Solving | /python/algs/tests/testlazyprim.py | UTF-8 | 996 | 3.015625 | 3 | [
"MIT"
] | permissive | import unittest
from ds.edgeweightedgraph import EdgeWeightedGraph
from ds.edge import Edge
from greedy.mstprimlazy import MSTPrimLazy
class TestLaztPrim(unittest.TestCase):
def testlazyprim(self):
g = EdgeWeightedGraph(8)
g.add_edge(Edge(4, 5, 0.35))
g.add_edge(Edge(4, 7, 0.37))
g... | true |
859f2ecbfdb6e4c4f5fe7dca08f81f6cc0097c65 | Python | nimanp/Project-Euler | /205.py | UTF-8 | 745 | 3.59375 | 4 | [] | no_license | def diceGame():
peter = []
colin = []
for i in range(1, 5):
for j in range(1, 5):
for k in range(1, 5):
for l in range(1, 5):
for m in range(1, 5):
for n in range(1, 5):
for o in range(1, 5):
for p in range(1, 5):
for q in range(1, 5):
peter.append(i+j+k+l+m+n+... | true |
9e578fc07800c3131eab4e4d47e784cd4b8e4b06 | Python | yangpuhai/geospatial-information-extraction | /extract geospatial information from web/download_street_name.py | UTF-8 | 5,031 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Nov 22 11:18:09 2017
@author: yangpuhai
"""
import os
import requests
from bs4 import BeautifulSoup
Houston_box='houston,-95.41870,29.71465,-95.41464,29.71930'
Chicago_box='Chicago,-87.65490,41.88257,-87.64660,41.88615'
box=[Houston_box,Chicago_box]
error_response='You requ... | true |
c1347fe64ce7c280a00ae1c7471de4f7adc0ec0b | Python | dgriff03/form_test | /app.py | UTF-8 | 6,048 | 2.703125 | 3 | [
"MIT"
] | permissive | import datetime
import json
import os
from flask import Flask, render_template, request, redirect, url_for
from flask_sqlalchemy import SQLAlchemy
# TODO(Daniel): SWITCH ALL prints to logging.
app = Flask(__name__)
DATABASE_URL = os.environ.get('DATABASE_URL', 'sqlite:////tmp/flask_app.db')
app.config['SQLALCHEMY... | true |
85322a26b1d34ef6e0003fe5b8e4127ccaa19ea5 | Python | FRodrigues42/search-portfolio | /analysis.py | UTF-8 | 2,375 | 2.890625 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from utils import Factor
import dataio as dio
import europeanize as euz
pd.set_option('display.max_rows', None)
pd.set_option('display.max_columns', None)
pd.set_option('display.width', None)
pd.set_option('display.max_colwidth', None)
def make_... | true |
551abdec657ad8dc2c3f108645e6d1ff5842a0d1 | Python | yogendratamang48/AudioPythonSimpleTest | /sound_test.py | UTF-8 | 1,017 | 3.453125 | 3 | [] | no_license | # Import Libraries
import matplotlib.pyplot as plt
from scipy.io import wavfile
from pylab import *
#Read Audio File
samplingFrequency, sound=wavfile.read('440_sine.wav')
numberOfSamples=sound.shape[0]
#Single Channel
sound1=sound[:,0]
# Show Length
print("Length of Audio file:", (numberOfSamples/samplingFrequency)*... | true |
ca7a1d2f7b05baeb38d7815fdd7c5f4cd3f9cecc | Python | R151791/lab_programs | /freqdelay.py | UTF-8 | 975 | 3.109375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import cmath as cm
def dtft(x):
j=cm.sqrt(-1)
y=[ ]
N=10000
n=len(x)
p=np.linspace(0,2*np.pi,N)
for i in range(0,N):
w=p[i]
sum=0
for k in range(0,n):
sum=sum+(x[k]*np.exp(-j*w*k))
y.append(abs(sum))
return y
def dtftfd... | true |
a284e3a126015c467b9046e00c6fe8b5a4ff6109 | Python | Aryan-kinge/School-code | /REad and write files.py | UTF-8 | 172 | 3 | 3 | [] | no_license | outFile = open("sometext.txt", "wt")
outFile.write("Hello world")
outFile.close()
outFile = open("sometext.txt", "r")
print(outFile.readline())
outFile.close()
| true |
a88aaa602b193ccb1250e2b525e4a1e16cb4b16f | Python | monkeydunkey/DataStructureImplementation | /python/Algorithms/binaryKnapsack.py | UTF-8 | 760 | 3.59375 | 4 | [] | no_license | # This implementation consider that there is a limited supply of items
def calMaxVal(items, weight):
# each element in items is a dict of the form {'weight':x, 'value':y}
arr = [[0 for x in xrange(len(items) + 1)] for y in xrange(weight + 1)]
for i in xrange(weight):
for j in xrange(len(items)):
... | true |
60e49d3207c6c4e4c9fa12ab49d0a8dc8d58e54b | Python | KeaneRowan/Nano_Data_DL | /v1/1-1 nome and 1 me/19207014.py | UTF-8 | 2,323 | 2.546875 | 3 | [] | no_license |
import sys
print('Python: {}'.format(sys.version))
import pyabf
import numpy as np
import matplotlib.pyplot as plt
from xlwt import Workbook
filename = r'C:\Users\Elijah\Documents\NanoporeData\abfRaw\filtered_bessel8pole_500hz_19207014.abf'
abf = pyabf.ABF(filename)
print(abf)
# abf.headerLaunch() # ... | true |
ca3d0fe7fefab738f4e906d2495b6a44fa5d415a | Python | achan021/FYP_codes_federated_learning | /Federated_learning_case/server/server_main.py | UTF-8 | 3,258 | 2.703125 | 3 | [] | no_license | from model_scripts import keras_lenet_model, pytorch_lenet_model,pytorch_inception_model,pytorch_mobilenetv2_model
import os
def main(library_sel,mode):
if library_sel == 0:
#run pytorch loading and model creation
# load input dataset
classes, trainset, testset = pytorch_lenet_model.load_d... | true |
2ca31da0b67672315d94e98288d0fd88b1616480 | Python | peytonblake/WOTDHangman | /wotd.py | UTF-8 | 1,123 | 3.09375 | 3 | [] | no_license | from requests import get
from requests.exceptions import RequestException
from contextlib import closing
from bs4 import BeautifulSoup
import os
def simple_get(url):
try:
with closing(get(url, stream=True)) as resp:
if is_good_response(resp):
return resp.content
els... | true |
7b29804c60a64d44060f3acadeddd09e476a5aef | Python | Bilibotter/LeetCode | /leetcode20旋转图像.py | UTF-8 | 316 | 3.4375 | 3 | [] | no_license | class Solution:
def rotate(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: void Do not return anything, modify matrix in-place instead.
"""
matrix[::] = zip(*matrix[::-1])
print(matrix[::-1])
s = Solution()
s.rotate([[1,2,3],[4,5,6],[7,8,9]]) | true |
067dacbff0eaf3bd11666374f736969dbf5b373c | Python | JamesDoane/practical_python_practice | /sumexpense.py | UTF-8 | 226 | 3.796875 | 4 | [] | no_license | expenses = []
total = sum(expenses)
# for x in expenses:
# sum += x
for i in range(7):
expenses.append(input("how much did you spend on lunch on each day"))
print("you spent $", total, " on lunch this week", sep='') | true |
37e55a7b0d17989200b7c041b6bfbf43f8e2d74b | Python | edevrim/metoomaas | /vol_2/tc_v2.py | UTF-8 | 8,356 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 13 21:03:40 2019
@author: salihemredevrim
"""
#data sources:
#safecity
#safecity previous study:
#https://github.com/swkarlekar/safecity
#https://www.kaggle.com/utathya/imdb-review-dataset#imdb_master.csv
#http://archive.ics.uci.edu/ml/datasets... | true |
ce03019bcfd267fcf9de73b905e5e7c9e550d14a | Python | 0913788/Project-2 | /Player.py | UTF-8 | 3,814 | 2.8125 | 3 | [] | no_license | import pygame
global screen, offset, camera1, player1, player2, player3, player4, Board, canvas
class Player:
def __init__(self, naam, kleur, locatie, texture, fightTexture, face_text):
self.Naam = naam
self.Kleur = kleur
self.Levenspunten = 100
self.Conditie = 15
self.Lo... | true |
617231153bc3bc4121e8b5974a8a883d66d5d59c | Python | teng-pongsakorn/Text-Generator | /text_generator.py | UTF-8 | 1,477 | 3.34375 | 3 | [] | no_license | from collections import defaultdict
from collections import Counter
import random
def get_corpus(path):
with open(path, 'r', encoding='utf-8') as f:
tokens = tokenize(f.read())
return tokens
def tokenize(text):
return text.split()
def ngram_generator(tokens, n=2):
for i in range(len(tokens... | true |
9043011d7e0f3f0ab0bbce2cb41dad47c5f088bc | Python | johan-eriksson/advent-of-code-2019 | /src/day10.py | UTF-8 | 3,002 | 3.140625 | 3 | [
"MIT"
] | permissive | import math
def solvepart1():
chart = []
with open('inputs/day10.txt') as f:
for line in f:
chart.append(list(line.strip()))
#chart[y][x]=='#' means asteroid at (x,y)
best_mapscore = 0
best_x, best_y = 0,0
for y in range(len(chart)):
for x in range(len(chart[y])):
if chart[y][x] == '#':
mapscore =... | true |
308e76e156171120bb15e890fd0ede49475121b3 | Python | CircularWorld/Python_exercise | /month_01/test_03/test_1.py | UTF-8 | 1,151 | 4.34375 | 4 | [] | no_license | """
创建函数,生成指定行数的杨辉三角。
杨辉三角:
每行端点与结尾的数为1,每个数是它左上方和右上方的数的和
输入:6
输出:
[
[1],
[1, 1],
[1, 2, 1],
[1, 3, 3, 1],
[1, 4, 6, 4, 1],
[1, 5, 10, 10, 5, 1]
]
杨辉三角的两个腰边的数都是 1,其它位置的数都是上顶上两个数之和。这就是我们用C语言写杨辉三角的关键之一
print("|","Ursula".cent... | true |
3b4616c5010764a6443379a0b55bd300898a8372 | Python | artemikk/calculator_cash_calories | /main.py | UTF-8 | 2,280 | 3.484375 | 3 | [] | no_license | import datetime as dt
class Calculator:
def __init__(self, limit):
self.records = []
self.limit = limit
def add_record(self, record):
self.records.append(record)
def get_today_stats(self):
today = dt.date.today()
today_stats = sum(record.amount for record in self.... | true |
42ff34d4998652260836d418f19a114c951a9492 | Python | abhilashaop/Computer-Vision | /lane_detection.py | UTF-8 | 986 | 3.109375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import cv2 as cv
import numpy as np
img = cv.imread('road.jgp')
#img = cv.cvtColor(img3, cv.COLOR_BGR2RGB)
h = img.shape[0]
w = img.shape[1]
roi = [
(0, h),
(w/2,h/2),
(w,h)
]
# the fucntion below will mask evry thing other than our region of interest
def region_of_interest(i... | true |
a49589bad851987489a53f337a5fe17996d18446 | Python | owidi-001/Inventory-Dataset | /main.py | UTF-8 | 3,960 | 3.09375 | 3 | [] | no_license | import csv
from datetime import date
def full_inventory(inventory_list):
with open('FullInventory.csv', 'w', newline='') as fullinventory:
fieldnames = ['ID', 'manufacturer_name', 'item_type', 'price', 'service_date', 'is_damaged']
fullinventory = csv.DictWriter(fullinventory, fieldnames=fieldname... | true |
a79a69a778987ee4fca782054572240bf6baec42 | Python | sriharsha-y/ml-dl | /NumPy/dtype.py | UTF-8 | 1,338 | 3.546875 | 4 | [] | no_license | import numpy as np
# using array-scalar type
dt = np.dtype(np.int16)
print('Scalar data type int16: ',dt)
# int8, int16, int32, int64 can be replaced by equivalent string 'i1', 'i2','i4', etc
dt = np.dtype('i4')
print('Scalar data type int32: ', dt)
# using little endian or big endian notation > is big endian, < is ... | true |
03e1dc04d3a31ec4815b4ee56e4abb1378b45aa0 | Python | cybelewang/leetcode-python | /code944DeleteColumnsToMakeSorted.py | UTF-8 | 1,829 | 4.25 | 4 | [] | no_license | """
944 Delete Columns to Make Sorted
We are given an array A of N lowercase letter strings, all of the same length.
Now, we may choose any set of deletion indices, and for each string, we delete all the characters in those indices.
For example, if we have an array A = ["abcdef","uvwxyz"] and deletion indices... | true |
e2e32aa9504a67215471984b658a9581b4ac78b9 | Python | Dekuben/PonyHunter | /look.py | UTF-8 | 642 | 2.921875 | 3 | [] | no_license | import game
def look(room):
if room == 1:
print """
You are standing in a room painted
to look like a cartoon forest.
Your feet sink into the emerald
astro turf.
To your south a door dominated by a giant
number 2, blocks your escape.
The smug corpse ... | true |
3d06e0892efeed65fcef35300c028097af9e002e | Python | demul/auto_colorization_project | /colorful_image_colorization/util.py | UTF-8 | 8,067 | 2.96875 | 3 | [] | no_license | import numpy as np
import cv2
# import matplotlib.pyplot as plt
def save_gamut(quantization_grid):
#################################################
# I get CIE-Lab space from uint8-type RGB space
# Because opencv transform float32-type RGB space to CIE-Lab space in range :
# 0.0 <= L <= 100.0
# -... | true |
46cd279276da8fb51c3e2f747def18f87d5b2637 | Python | hoakhongmau98/HNC_Claw_data | /Renamefile.py | UTF-8 | 1,865 | 2.703125 | 3 | [] | no_license | from os import rename, listdir
# ****************************************
# old file
# ****************************************
# Test on Test_folder
# print(f"old folder: {listdir('Tets_folder/')}")
# rename(r'Tets_folder/category_tableHDD.csv', r'Tets_folder/new_name.csv')
# print(f"new folder: {listdir('Tets_fol... | true |
d4f0d11f6ec6f5e0e5144bdfcad9afef867c35c2 | Python | LongNgd/Jaden-AI | /Jaden.py | UTF-8 | 4,830 | 3.125 | 3 | [] | no_license | import speech_recognition
import pyttsx3
import requests
from datetime import date, datetime
import os
import webbrowser
robot_mouth = pyttsx3.init()
robot_ear = speech_recognition.Recognizer()
robot_brain = ""
def weather(city_name):
api_key = "04417d4ed9c27909c9b1a2304004920a"
base_ulr = "http://api.openwe... | true |
3d5f31c68ea756ef821c0a35afd4bb426abd4952 | Python | evantarrell/AdventOfCode | /2020/Day 5/day5.py | UTF-8 | 810 | 3.765625 | 4 | [] | no_license | def splitList(list, direction):
length = int(len(list) / 2)
if direction == 'lower':
halfList = list[:length]
else:
halfList = list[length:]
return halfList
foundSeats = []
with open('input.txt', 'r') as file:
for line in file:
rows = list(range(0, 128))
cols = list(range(0, 8))
for char in line:
... | true |
d4348d07bdbee1e56d971dd7d9328703f0908604 | Python | BCCheungGit/QRgenerator | /qrcoder.py | UTF-8 | 2,117 | 2.859375 | 3 | [] | no_license | # import modules
import qrcode
from PIL import Image
import sqlalchemy.pool as pool
import psycopg2
# taking image which user wants
# in the QR code center
Logo_link = 'ocm-clear.png'
logo = Image.open(Logo_link)
# taking base width
basewidth = 100
# adjust image size
wpercent = (basewidth/float(logo.... | true |
28e86248880239f1a19ba1d4d64daceefc62e71c | Python | Kerwen-L/ACM-Leetcode | /Leetcode/1122.数组的相对排序.py | UTF-8 | 397 | 2.96875 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=1122 lang=python3
#
# [1122] 数组的相对排序
#
# @lc code=start
class Solution:
def relativeSortArray(self, arr1: List[int], arr2: List[int]) -> List[int]:
rank = {x:i for i,x in enumerate(arr2)}
def CMP(x):
return rank[x] if x in arr2 else x+1000
arr... | true |
26003c0363ef59d0a28dbc9e3ba40b835c803f09 | Python | D4r7h-V4d3R/Ornekler | /class1,__init__,self.py | UTF-8 | 1,115 | 3.484375 | 3 | [] | no_license | #normal OOP Programmlama tarzı (basit programlama)
#uninit un self
class work:
pass
emplo1 = work()
emplo1.ad = "Hasan"
emplo1.soyad = "Kılıc"
emplo1.maas = "3100"
emplo2 = work()
emplo2.ad = "Kemal"
emplo2.soyad = "Ok"
emplo2.maas = "2300"
print(emplo1)
print(emplo1.ad,emplo1.soyad)
#With init,... | true |
64f79631e49790c96f19649f7c8d4362df00bb59 | Python | GaTechBrownLab/pa_genomics | /parseExtracyOGs.py | UTF-8 | 3,905 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python
'''
@name: parseExtracyOGs.py
@author: Juan C. Castro <jccastrog at gatech dot edu>
@update: 05-Jan-2018
@version: 1.0
@license: GNU General Public License v3.0.
please type "./parseExtracyOGs.py -h" for usage help
'''
'''===== 1.0 Import modules, define functions, and initialize variables ====='... | true |
715e338d61fae702416b199c6a82e58cb45edc75 | Python | zhang3125/drbd9-tests | /tests/diskless | UTF-8 | 5,367 | 2.515625 | 3 | [] | no_license | #! /usr/bin/env python3
# Pass this script a list of host names to use as the test nodes.
from python import drbdtest
from python.drbdtest import log
from subprocess import CalledProcessError
resource = drbdtest.setup(min_nodes=3, max_nodes=5)
diskful_nodes = resource.nodes[1:]
resource.add_disk('10M', diskful_node... | true |
d070d7ac316d59c043e209434ecc4cd6fd5a2cbd | Python | singhva/biomarkers | /application/src/access/auth.py | UTF-8 | 5,804 | 2.53125 | 3 | [] | no_license | '''
Created on May 27, 2014
@author: varun
'''
import md5
import os
from os.path import dirname
import urllib
from user import User
import cherrypy
from mako.lookup import TemplateLookup
from config import get_cache_connection
SESSION_KEY = '_cp_username'
current_dir = dirname(os.path.abspath(__file__))
applicatio... | true |
ba335ca996f7eb87341f1126ec8100f56535b18a | Python | andrewguy/CCARL | /Scripts/generate_new_glycan_array_version.py | UTF-8 | 1,473 | 3 | 3 | [
"MIT"
] | permissive | import pandas as pd
from ccarl.glycan_parsers.cfg_array_versions import clean_glycan_string
from ccarl.glycan_parsers.cfg_parser import CFGGlycanParser
"""
This is an example script for adding new glycan array versions to the CCARL tool.
"""
if __name__ == "__main__":
# Add your path to cfg data in csv format he... | true |
197b45279dc7266a53b07564d14dce7fb1bca418 | Python | ningyumo/Class-based-views | /Class_based_views_stydy/date_views.py | UTF-8 | 44,471 | 2.65625 | 3 | [] | no_license | # 下面的所有视图都假定定义了Article模型。
from django.db import models
from django.urls import reverse
class Article(models.Model):
title = models.CharField(max_length=200)
pub_date = models.DateField()
def get_absolute_url(self):
return reverse("article-detail", kwargs={"pk": self.pk})
# —————————————————————... | true |
7196a92c0d6e965734e74f0a8e5e4e4b538709ed | Python | SpacePirateRyoku/Pi-Game | /NewQuest/tada.py | UTF-8 | 160 | 4.625 | 5 | [] | no_license | number = int(input("What number would you like to square?"))
sqr = number * number
print(“The square of “+ str(number) +“ is “+ str(sqr) + “.”)
| true |
64e78e1b7fd13f509338235b9f5ddbaaccca132f | Python | matkiller333/PE_ML_detection | /main.py | UTF-8 | 822 | 2.921875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from network import *
# Loads images from the fashion mnist dataset
fashion_mnist = tf.keras.datasets.fashion_mnist
(train_images, train_labels), (test_images, test_labels) = fashion_mnist.load_data()
# Defines the possible outputs
class_names = ['T-shirt/top', 'Trous... | true |
c456040375ba0de9700333b1e6e2dbcf15cc46ba | Python | UHH2/ZprimeSemiLeptonic | /macros/CrossSectionHelperSignals.py | UTF-8 | 221,242 | 2.859375 | 3 | [] | no_license | from collections import namedtuple,Mapping
def namedtuple_with_defaults(typename, field_names, default_values=()):
T = namedtuple(typename, field_names)
T.__new__.__defaults__ = (None,) * len(T._fields)
if isinstance(default_values, Mapping):
prototype = T(**default_values)
else:
protot... | true |
0f1b80b51acc173ccf33e0795f6181a6c247e8a7 | Python | linshaoxin-maker/myproject | /knowledge graphy/lib/entity/nre/breds/test/test_vector.py | UTF-8 | 3,946 | 2.625 | 3 | [] | no_license | # 测试词向量 tf_idf model 后期改成其它词向量模式
# TfidfModel 无需训练
from breds.VectorSpaceModel import VectorSpaceModel
from os.path import join
from breds.tokens import word_tokenize
import pickle
from gensim.matutils import cossim
from breds.sentence import Sentence
from breds.config import Config
from breds.tuples impor... | true |
a7bce6a9353f2982cedd0e0e8cfbf3cd726b79b5 | Python | caadxyz/evo_floorplans | /floor_plans/graph_util.py | UTF-8 | 843 | 2.953125 | 3 | [] | no_license | from collection import defaultdict
class Graph(object):
"""docstring for Graph"""
def __init__(self, genome):
self.arg = arg
nodes = list(genome.node_genes.keys())
edges = defaultdict(list)
for conn in genome.conn_genes:
edges[conn.in_node_id].append(conn.out_node_i... | true |
f9c578a75a9cc2e00f62063e3df033f0a702ca28 | Python | PermutaTriangle/TheShading | /the_shading_algorithm/src/tsa5_knowledge.py | UTF-8 | 29,236 | 2.609375 | 3 | [] | no_license | from permuta import *
from permuta.misc import *
from misc import *
# To try to prove that mesh patterns m1 and m2 are coincident, run tsa5_coincident(m1, m2, D), where D is a suitable depth.
# Note that permuta [1] has to be installed.
# [1]: https://github.com/PermutaTriangle/Permuta
STR_ADJ = ["right-most","highes... | true |
f16663cf536126fb5cd427a7c8d55457b98c1e26 | Python | bo198214/hyperops | /series.py | IBM852 | 1,782 | 3.4375 | 3 | [] | no_license | # coding=latin-1
"""
Title: HyperSage - a Sage library for tetration and hyper operations.
Creator: Andrew Robbins
Date: 2008-04-22
Description:
hyperops/polynomial.py contains basic polynomials.
a_poly(x) makes an arbitrary polynomial function,
and h_poly(x) and p_poly(x) make hyperbolic and parabolic
... | true |
6184e2f88bcc811c4138819b0b855635bc033ff8 | Python | JetBrains/intellij-community | /python/helpers/typeshed/stubs/zxcvbn/zxcvbn/time_estimates.pyi | UTF-8 | 909 | 2.765625 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | from decimal import Decimal
from typing_extensions import Literal, TypedDict
class _TimeEstimate(TypedDict):
crack_times_seconds: _CrackTimeSeconds
crack_times_display: _CrackTimesDisplay
score: Literal[0, 1, 2, 3, 4]
class _CrackTimeSeconds(TypedDict):
online_throttling_100_per_hour: Decimal
onli... | true |
91ab967d340d88fd771ad6e1192c3567941add9d | Python | franckbrl/stat_comb_model | /functions.py | UTF-8 | 5,485 | 3 | 3 | [] | no_license | #!/usr/bin/python2
# -*- coding: utf-8 -*-
from __future__ import division, unicode_literals
from collections import defaultdict
import operator, math, sys, argparse, re, pickle
def get_stem_regex(stems, aff_is_prefix):
"""
Store the stems in a regex.
"""
# If the stems contain special characters, de... | true |
98a07802f9109e580b3608244423ee3a60a4061a | Python | jjerphan/joml | /joml/functions.py | UTF-8 | 1,974 | 3.328125 | 3 | [
"MIT"
] | permissive | import numpy as np
class ActivationFunction:
"""
`ActivationFunction` are used in `Layer` to perform a non-linear mapping.
`ActivationFunction` define the value they return based on a input.
They also define the value of their derivative.
"""
def __init__(self, value, derivative):
sel... | true |
004e511a9637fa6ea04658f1682eca5524adb7ff | Python | ricpelo/pro-clases | /vampiro/mapeado.py | UTF-8 | 476 | 2.84375 | 3 | [] | no_license | import parser as d
vestibulo = (
'VESTÍBULO',
'Estás en el vestíbulo del castillo...'
)
pasillo = (
'PASILLO',
'Te encuentras en medio del pasillo principal...'
)
cocina = (
'COCINA',
'Estás en la cocina del castillo...'
)
biblioteca = (
'BIBLIOTECA',
'Te hallas en la biblioteca del ... | true |
d22fbc36c516880b4d265183a7073cff9565a558 | Python | mek97/reoptimization-algorithms | /src/reoptimization_algorithms/utils/graph/vertex.py | UTF-8 | 5,245 | 3.609375 | 4 | [
"MIT"
] | permissive | """
Vertex class
"""
from typing import Dict
from reoptimization_algorithms.utils.graph.edge import Edge
class Vertex:
"""
Vertex class having key, weight and adjacency dictionary of neighbours
Default weight as :py:attr:`Vertex.DEFAULT_VERTEX_WEIGHT`
:param key: Key
:type key: str
:param ... | true |
3e82d697a6a49353387e006a9a71f13156eb7cac | Python | hayato-hashimoto/MHLW-discussions-corpus | /get_text_from_kaiken.py | UTF-8 | 363 | 2.8125 | 3 | [] | no_license | import lxml.html
import sys
html = lxml.html.parse(sys.argv[1])
print("<doc>")
nodes = html.xpath('//dl[contains(@class, "Interview")]/*')
for node in nodes:
t = node.xpath('./self::dt/text()')
if len(t) > 0:
print("<turn>", end=' ')
print(t[0][:-1], end=' ')
t = node.xpath('./self::dd/text(... | true |
ad2f23d8d9fc5f5f8eeb26e9a51f4e97029a81cc | Python | r259c280/CS101 | /program2.4.py | UTF-8 | 2,573 | 3.9375 | 4 | [] | no_license | import random
while 1:
pot = 0
wager = 0
guessNo = 0
# asking the pot money in loop
# til user enters valid pot value
while 1:
try:
pot = int(input("Enter the amount for your pot : "))
if pot <= 0:
print(" Enter a positive number! ")
... | true |
9579e8d34ca119ea9e6a4d2991df4b2c19ac5d95 | Python | Ayu-99/python2 | /session13(a).py | UTF-8 | 3,370 | 3.1875 | 3 | [] | no_license | from tkinter import *
import firebase_admin
from firebase_admin import credentials
from firebase_admin import firestore
# Use a service account
cred = credentials.Certificate("serviceKey.json")
firebase_admin.initialize_app(cred)
db = firestore.client()
class Customer:
def __init__(self, name, phone, email):
... | true |
34a9622e9aca0ce563e08a0d37a41862ff2010d4 | Python | reallyhui/resource | /pythonstudy/激活码保存到mysql/0002.py | UTF-8 | 1,007 | 2.84375 | 3 | [] | no_license | # -*- coding: utf8 -*-
import pymysql
import random, string
code = string.digits + string.ascii_letters
# 随机生成,n表示生成验证码n组,生成m组码
def to_code(m, n):
a = ""
for i in range(m):
for j in range(n):
b = "".join(random.sample(code, 5))
if j == n - 1:
a = a ... | true |
1ac7a11ea8ca7ee6a61c0767e3e0936882511864 | Python | rafaelperazzo/programacao-web | /moodledata/vpl_data/77/usersdata/165/41253/submittedfiles/exercicio24.py | UTF-8 | 407 | 3.15625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import math
a=int(input('digite um valor para a:'))
b=int(input('digite um valor para b:'))
c=0
mdc=0
if a<b:
b=a
c=b
a=c
for i in range (1,a+1,1):
if a%i==0 and b%i==0:
mdc=i
print(mdc)
else:
for i in range (1,a+1,1):
if a... | true |
72c468f87d1c00de249ecf44bc150ae97bdd5524 | Python | hducati/machine-learning-tests | /regressao_logistica_risco_credito.py | UTF-8 | 952 | 3.015625 | 3 | [] | no_license | import pandas as pd
base = pd.read_csv('risco-credito2.csv')
previsores = base.iloc[:, 0:4].values
classe = base.iloc[:, 4].values
from sklearn.preprocessing import LabelEncoder
encoder = LabelEncoder()
previsores[:, 0] = encoder.fit_transform(previsores[:, 0])
previsores[:, 1] = encoder.fit_transform(previsores[:, ... | true |
7a3c4210dd2af47fb35f96af35c05eccb58a1316 | Python | MrRedstoner/rp2019 | /task5/mark1.py | UTF-8 | 106 | 2.96875 | 3 | [] | no_license | def mark1(n):
if n <= 1:
x = 1
else:
x = mark1(n - 1) + mark1(n - 2)
return x
| true |
458b3ec86079fd5e0a8bf15f5fe3fd8dfa609fdc | Python | cclough715/Gist | /GistReviewSummarization/getreview.py | UTF-8 | 3,677 | 2.578125 | 3 | [] | no_license | import hashlib
import logging
from google.appengine.api import memcache
from google.appengine.ext import ndb
from google.appengine.datastore.datastore_query import Cursor
class Review(ndb.Model):
"""A model containing keypoints and relevent attributes for a review.
args:
product_name: string
... | true |
55d804c2f9400d345166c0444a50a472ff774c21 | Python | UN0wen/Argenta-v2 | /cogs/embeds/nightwave.py | UTF-8 | 1,671 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
# Import
from discord import Embed
from datetime import datetime, timezone, timedelta
import dateutil.parser
class NightwaveEmbed(Embed):
def __init__(self, nw, daily=False):
color = int("0x10C4BC", 0)
if not daily:
mission_str = "Weekly Challenges"
else:... | true |
44134f8b6aa740f3fdf0e31ab4f19788fed30ced | Python | camohe90/mision_tic_G6 | /s13/13.6_factorial.py | UTF-8 | 243 | 4.53125 | 5 | [] | no_license | factorial = 1
numero_factorial = int(input("Digites el numero que desea conecer el factorial: "))
for numero in range(1,numero_factorial+1):
factorial = factorial * numero
print(f"El factorial de {numero_factorial} es {factorial}") | true |
2bc8c669cb8a4c704c7d017642e3a86a49282ed4 | Python | thegreatshasha/atari_ai | /games/video_encoder.py | UTF-8 | 1,233 | 2.640625 | 3 | [] | no_license | #!/usr/bin/python
import subprocess
import numpy as np
def getIfromRGB(rgb):
rgb = rgb.astype('int32')
red = rgb[:,:,0]
green = rgb[:,:,1]
blue = rgb[:,:,2]
print red, green, blue
RGBint = (red<<16) + (green<<8) + blue
return RGBint
class VideoSink(object) :
def __init__( self, size, fi... | true |
2f0a14761a869206d6539689d79044cd04e75048 | Python | VNOpenAI/Algorithm | /day6/cau_truc_dl.py | UTF-8 | 125 | 3.125 | 3 | [] | no_license | class A:
def __init__(self,a,b):
self.a=a
self.b=b
x=[]
for i in range(5):
a=A(0,1)
x.append(a) | true |
0dddaa2a6a86b85eb0515d0d9afe19952345489e | Python | chenweijundada/django | /douban_scrapy/douban_scrapy/spiders/douban_spider2.py | UTF-8 | 2,757 | 2.71875 | 3 | [] | no_license | import scrapy
from scrapy import Selector, Request
from scrapy.linkextractors import LinkExtractor
from scrapy.spider import Rule, CrawlSpider
from douban_scrapy.items import DoubanScrapyItem
class DoubanSpider2(CrawlSpider):
name = 'Douban2'
start_urls = [
'https://movie.douban.com/top250'
]
... | true |
512c7fcb1b5fe4547e63004eaeccee07c6b8227b | Python | leoneldp/Python | /CashRegister1.py | UTF-8 | 4,381 | 3.625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
import unittest
class Ticket(object):
def __init__(self):
self.lista_productos = []
def agregar_producto(self, codigo, nombre, precio):
item_a_agregar = Producto(codigo, nombre, precio)
self.lista_productos.append([item_a_agregar.codigo, item_a_agregar.... | true |
f8eef239bf06adb4ed494ae369568fa6acecfa54 | Python | VArtem/ml-2013 | /andrew.shulayev/cancer_svm/svm.py | UTF-8 | 1,427 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from cvxopt import matrix
from cvxopt.blas import dotu
from cvxopt.solvers import qp
import numpy as np
def scale(xs, c):
return [x * c for x in xs]
def base_vector(i, n):
return [1.0 if j == i else 0.0 for j in range(n)]
def transpose(ls):
return list(map(... | true |
4185c920bb6f9c78c8931b006851f698e593d8f7 | Python | mahimadubey/leetcode-python | /symmetric_tree/solution.py | UTF-8 | 1,182 | 4.125 | 4 | [
"BSD-2-Clause"
] | permissive | """
Given a binary tree, check whether it is a mirror of itself (ie, symmetric
around its center).
For example, this binary tree is symmetric:
1
/ \
2 2
/ \ / \
3 4 4 3
But the following is not:
1
/ \
2 2
\ \
3 3
"""
# Definition for a binary tree node.
# class TreeNode(object):
#... | true |
a9b3b17db24f8cf826b98cfc798141b572cf49e7 | Python | rumen-scholar/kosmo41_KimCheolEon | /Python/04Application/1search_for_items_write_found.py | UTF-8 | 2,299 | 3.046875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Dec 13 09:33:46 2018
@author: kosmo
"""
#!/usr/bin/env python3
import csv
import glob
import os
import sys
#item_numbers_file = sys.argv[1]
#path_to_folder = sys.argv[2]
#output_file = sys.argv[3]
item_numbers_file = "./Data/item_numbers_to_find.csv"
path_to_folder = "./Dat... | true |
f1639da25936f03f2900765db7c379effec7d1fa | Python | praveena2mca/pravimca | /repeatmax.py | UTF-8 | 335 | 3.296875 | 3 | [] | no_license | def max( a, size):
for i in range(size):
if a[abs(a[i])-1] > 0:
a[abs(a[i])-1] = -a[abs(a[i])-1]
else:
print("repeating number",abs(a[i]))
for i in range(size):
if a[i]>0:
print(" missing number ",i+1)
a = [6, 2, 3, 4, 4, 5, 2]
n = len(a)... | true |
69b0c207d0a29c84837d83fcef21a3e5959c8ea1 | Python | AutomatedTestingChiefSoftwareArchitect/AutomationPlatform | /DjangoRESTFramework/RestFrameworkUser/Analyze.py | UTF-8 | 2,001 | 3.046875 | 3 | [] | no_license | import jsonpath
class AnalyzeDatas(object):
def dict_getValue(self, targetDict, serchKey, default=None):
"""
通过参数key,在jsons中进行递归匹配并输出{key:value}
:param targetDict: 需要解析的json串
:param serchKey: 需要查找的key
:param default: :查不到符合的serchKey,就返回默认值None
:return: true is dict... | true |
a13e176b662e5dfcc3a0fc286d64455c46d47823 | Python | PaulWooZJU/ECE-143-Project | /notebooks/data_clean.py | UTF-8 | 2,614 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
import pandas as pd
import json
path = "C:/Users/brand/desktop/events/events_England.json"
with open(path) as f:
data = json.load(f)
train = pd.DataFrame(data)
path2 = "C:/Users/brand/desktop/players.json"
with open(path2) as f:
play = json.load(f)
players = pd.DataFr... | true |
9cb8419f3f8ae35d9686e11e8f42d838044eb515 | Python | allayarovnael/ferien_project | /ferien.py | UTF-8 | 4,659 | 3.078125 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup as bs
import pandas as pd
import itertools
from datetime import date, timedelta
from dateutil.relativedelta import relativedelta
FERIEN_NAMES = {
'Winterferien': 'WF',
'Osterferien': 'OF',
'Pfingstferien': 'PF',
'Sommerferien': 'SF',
'Herbstferien':... | true |
5608ec106b376b33c4745140a4ca43b1690362ac | Python | felana/Projet_Vasarely | /src/vasarely.py | UTF-8 | 5,095 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 20 16:17:18 2020
@author: Felana Rakotovao Andriamahefa
Projet de Vasarely
"""
import turtle
from math import cos,sin,pi
from deformation import deformation # Etape 2:appel de la module deformation
def hexagone(point,longueur,col,centre,rayon):#E... | true |
0ed4ddd472e5a2a516c645658b3950b3c06b2741 | Python | hayoung917/StudyPython | /GPIOTest.py | UTF-8 | 427 | 2.71875 | 3 | [] | no_license | import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(21, GPIO.OUT) #GREEN
GPIO.setup(20, GPIO.OUT) #RED
try:
while True:
GPIO.output(20,True) #RED ON
GPIO.output(21,False) #GREEN OFF
time.sleep(1)
GPIO.output(20,False) #RED OFF
GPIO.output(21... | true |
b245fd337da364fbfb057fb09c9d02b8eac84150 | Python | mozahid1/Youtube-Video-Downloader | /Youtube Video Downloader.py | UTF-8 | 1,004 | 2.984375 | 3 | [] | no_license | from pytube import YouTube
import os
from tkinter import *
root=Tk()
# Create Output Background Size
root.geometry('330x200')
root.title('Youtube Video Downloader')
# Create First Output Line
Label1=Label(root,text="Youtube Video Link", font=("bold",20))
Label1.place(x=43,y=20)
# Create Second Output Li... | true |
35615b7e1ba8fd22ed214f1245cfffd266195221 | Python | cjqian/cjqian.github.io | /projects/steam_rec/data/make_results.py | UTF-8 | 9,303 | 2.734375 | 3 | [] | no_license | #gets data from a user"s top ten favorite games
import sys
import re
reload(sys)
sys.setdefaultencoding('utf-8')
import string
import json
import requests
import HTMLParser
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(("localhost", 8080))
s.listen(1)
html_parser = HTMLParser.HTMLParser(... | true |