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
1fd63ac653e827651f90ec864e2499acff8b18dd
Python
Skrilltrax/DS
/grokking-python/two_pointer/three_sum.py
UTF-8
1,033
3.515625
4
[]
no_license
from typing import List def three_sum(self, nums: List[int]) -> List[List[int]]: length: int = len(nums) triplets: List[List[int]] = [] # sort the array nums.sort() for i in range(length): if i > 0 and nums[i] == nums[i - 1]: continue else: find_triplets_f...
true
4449cb49e7785146f2b0f42d1f85ffa36e6760dc
Python
Hermes777/sparse_class_rbm
/ClassRBMPy/loading_model.py
UTF-8
1,674
2.6875
3
[]
no_license
import os import pdb import rbm import numpy def matrix_load(path): fobj = open(path, 'r') line = fobj.readline() line = line.strip() row = int(line.split("\t")[0]) col = int(line.split("\t")[1]) matrix = [] for i in range(0, row): line = fobj.readline() line = line.strip()...
true
e2932240f611b70d20b0c549717eba4d3109352b
Python
Twangist/prelogging
/examples/use_library.py
UTF-8
2,493
2.796875
3
[ "MIT" ]
permissive
#!/usr/bin/env python __author__ = 'brianoneill' import library import logging try: import prelogging except ImportError: import sys sys.path[0:0] = ['..'] # , '../..' from prelogging import LCDict def logging_config(): d = LCDict(attach_handlers_to_root=True) # LCDict default: =False ...
true
db8c0ee56196a5d3de5f1aa70a30ab9c1afad660
Python
qq851185223/IDDLncLoc
/lncloc/feature_extracting/CTD/feamodule/fickett.py
UTF-8
3,862
3.046875
3
[]
no_license
#!/usr/bin/env python '''the python script is downloaded from https://sourceforge.net/projects/rna-cpat/files/v1.2.2/''' '''calculate coding potential''' # Fickett TESTCODE data # NAR 10(17) 5303-531 position_prob = { 'A': [0.94, 0.68, 0.84, 0.93, 0.58, 0.68, 0.45, 0.34, 0.20, 0.22], 'C': [0.80, 0.70, 0.70, 0....
true
a8b60a0f27843a84dcd5a3d54c6033a4e38dc8fe
Python
tradermichael/Python_Based
/project-2c-tradermichael/change.py
UTF-8
388
3.625
4
[]
no_license
cents = int(input("Please enter an amount in cents less than a dollar.\n")) quarters=cents//25 leftover=cents leftover=(cents%25) dimes = leftover//10 leftover=(leftover%10) nickels = leftover//5 leftover = (leftover%5) pennies = leftover print("Your change will be:") print("Q: "+str(quarters)) print("D: "+s...
true
afea459e0ba5590c1bc49daa582c10fcdb6a9b18
Python
erjan/coding_exercises
/bold_words_in_string.py
UTF-8
1,092
3.484375
3
[ "Apache-2.0" ]
permissive
''' Given an array of keywords words and a string s, make all appearances of all keywords words[i] in s bold. Any letters between <b> and </b> tags become bold. Return s after adding the bold tags. The returned string should use the least number of tags possible, and the tags should form a valid combination. ''' ...
true
a15ac89f6e744bea7bea79c3e165325239d3e15b
Python
Molo-M/Polygon-Area-Calculator
/Polygon Area Calculator.py
UTF-8
2,113
3.703125
4
[]
no_license
class Rectangle: def __init__(self, width, height): self.width = width self.height = height self.area = 0 def set_width(self, width): self.width = width def set_height(self, height): self.height = height def get_area(self): self.area = self.width * self...
true
41a66a3f39416f186426126c00ba816d8ab6202b
Python
adeak/AoC2018
/day09.py
UTF-8
1,073
3.484375
3
[]
no_license
from itertools import cycle from collections import deque class Marbles(deque): def moveclock(self, n=1): self.rotate(-n) def movecounter(self, n=1): self.rotate(n) def insertright(self, val): self.moveclock() self.appendleft(val) def remove(self): sel...
true
3092a3d2c738c60acb8193d4ab4ccf8b82278a63
Python
Rudya93/Python1
/10.py
UTF-8
690
3.203125
3
[]
no_license
# a = list() # c =[] a = input("Please input string: ") # for i in (len(a)): # b = input() # b = (int(b)) # c.append(b) b = a.count('a') c = a.count('b') d = a.count('c') e = a.count('d') f = a.count('e') g = a.count('f') l = a.count('g') h = a.count('h') m = a.count('l') n = a.count('m') o = a.count('n') ...
true
f47bf4a9c0302bb8638ced921e6006a4241d2226
Python
ttppggnnss/CodingNote
/2004/0410/boj 2661-2.py
UTF-8
482
2.796875
3
[]
no_license
import sys sys.stdin=open('../input.txt','r') L=['1','2','3'] def f(n,c='',k=0): global p if p: return if k==n: p=c print(p) return else: for i in L: d=c+i if g(d): f(n,d,k+1) else: continue def ...
true
bfa629bcaf747f22f6d301080912d8ffae1ecc22
Python
bsammor/machine-learning
/preprocess.py
UTF-8
7,256
3.234375
3
[]
no_license
#------------------------------------------------------------------------------- # This code is to preprocess the dataset from the below link: # https://archive.ics.uci.edu/ml/datasets/Beijing+Multi-Site+Air-Quality+Data # # Before running this code, keep the downloaded dataset in a zip file # in the same directo...
true
f6d59a9d7bdef00ee744d5792e07163bbbd9b234
Python
butteredcorn/agile-assignment-1
/database.py
UTF-8
6,186
3.015625
3
[]
no_license
import pickle import importlib import itertools from operator import itemgetter reminders = importlib.import_module('reminders') constant = { 'empty_string': 0, 'first_id': 0, 'offset': 1, 'none': 0, 'increment': 1 } # print(constant['empty_string']) # print(constant['first_id']) # print(constant...
true
d56cdf365e00f1c2cd94d996fd155f22f6a94476
Python
itomi/algorithms
/graphs/connected_components/connected.py
UTF-8
1,334
3.140625
3
[]
no_license
import sys class Graph: def __init__(self): self.nodes = set() self.edges = set() self.properties = [] def __repr__(self): str = "nodes: "+repr(self.nodes)+"\n" str += "edges: "+repr(self.edges)+"\n" str += repr(self.properties) return str def connected_components_set(graph): collections = set() mar...
true
4d21a80ca730c9db13c15559fb94d2101d9ca1ea
Python
ovbystrova/Infosearch
/Final project/preprocess.py
UTF-8
731
2.90625
3
[]
no_license
import re import pymorphy2 as pm from nltk.tokenize import RegexpTokenizer from nltk.corpus import stopwords stopWords = set(stopwords.words('russian')) morph = pm.MorphAnalyzer() def preprocess(text): """Функция на вход получает текст и возвращает список нормализованных слов, без знаков пунктуации, без ...
true
9814b0233d0960f9f4796e0ba2681a26ebc4460b
Python
ds-ga-1007/assignment7
/hz1411/functions.py
UTF-8
2,719
3.6875
4
[]
no_license
from exceptions import * from interval import * def isOverlapping(int1, int2): ''' check if 2 intervals are overlapping/adjacent so they can be merged ''' if int1.upper+1 == int2.lower and int1.bound_upper==']' and int2.bound_lower=='[': return True elif int2.upper+1 == int2.lower and int2.bound_u...
true
fc031552672fe0d163a5272b5df1744f29b8cd89
Python
masinogns/boj
/algorithm/2.Data_Structure_1/BOJ_basic_19.py
UTF-8
2,155
4.125
4
[]
no_license
""" BOJ_basic_19 : 에디터 : BOJ 1406 https://www.acmicpc.net/board/view/11623 참고 자료. 스택을 2개로 구현하여 커서를 기준으로 왼쪽은 왼쪽 스택, 오른쪽은 오른쪽 스택으로 칭하여 푼다. 커서의 이동 시, 삭제 시 그리고 추가 시 행위는 각 스택의 pop과 push로 이루어진다. 이 때, 각 pop된 요소들은 push 요소로 들어갈 수도 있음을 명심하자. print("".join(stackL.stack) + "".join(stackR.stack)) http://mwultong.blogspo...
true
a3c1ea99c8fd6dc1d89b165a8e84df1a07536004
Python
andva/advent
/2020/3/a.py
UTF-8
401
2.734375
3
[]
no_license
import math import numpy as np def main(): f = open("input.txt") i = 0 nHit = 0 for line in f: nCols = len(line) modL = list(line) if line[i] == '#': nHit += 1 modL[i] = "X" else: modL[i] = "0" print("".join(modL)) i = ...
true
3a0f042c06ef181633b962807331c4cad4a6a146
Python
vral-parmar/Basic-Python-Programming
/Configuration_using_python/test.py
UTF-8
473
2.75
3
[]
no_license
#import class from configparser import ConfigParser # create an instance of ConfigParser class. parser = ConfigParser() # read and parse the configuration file. parser.read('Configuration_using_python/conf.ini') ['Configuration_using_python/conf.ini'] # get option value in specified section. mysql_conn_host = parser.ge...
true
8c2ca5692c6f57ea6822fda857c18b5ff1616cc3
Python
jpinedaa/Box-Office-Prediction
/KNN_model.py
UTF-8
2,306
2.84375
3
[]
no_license
import matplotlib.pyplot as plt import pandas as pd import numpy as np import itertools from sklearn.model_selection import train_test_split from sklearn.neighbors import KNeighborsRegressor from sklearn.metrics import mean_squared_error, r2_score from sklearn import decomposition from sklearn.model_selection i...
true
6ec27a508c449122976f0b6eb6620ff92e527223
Python
StephenWasntAvailable/CompSim18_19
/Ising Project/Ising2018Alternate.py
UTF-8
1,557
2.859375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Oct 31 21:22:36 2018 @author: Stephen """ import numpy as np import matplotlib.pyplot as plt import scipy import random class IsingPointSimple: """Class representing each individual lattice point for the case of nearest neighbour interactions and colinear spins, i...
true
6887b0ef8101db348540c1a9afd1bbdbae83341d
Python
rgtjf/Semantic-Texual-Similarity-Toolkits
/stst/libs/kernel/tree.py
UTF-8
18,695
3.40625
3
[ "MIT" ]
permissive
# coding: utf8 """ A set of Classes to handle trees and compute kernel functions on them """ from __future__ import print_function import random import bisect class TreeNode: # A simple class for handling tree nodes def __init__(self, val=None, chs=[]): self.val = val # node label self.chs = ...
true
0d6764e7f042d4c24df7201cf03d613ca76f0c33
Python
AfiqAmmar/Operating-System-Lab
/Lab 7/Sequential.py
UTF-8
1,483
3.59375
4
[]
no_license
filelength = 50 files = [0]*filelength for x in range(files.__len__()): files[x] = 0 flag = 1 while flag == 1: start = int(input("Please enter the starting block:")) while (start<=0 or start>filelength): if start<=0: print("Please enter a positive number!") if start>50: ...
true
0ad25aad0dec558adc06f80596d2304f6cdd71e9
Python
uni51/python_tutorial
/pyq/25_container/fast_data_dict/py3.py
UTF-8
471
4.1875
4
[]
no_license
# イテラブルを返すメソッド d = {'art': 1, 'box': 2, 'cup': 3} # keys() : キーを要素とするイテラブルを返します。 print('keys:') for k in d.keys(): print(k) print() # values() : 値を要素とするイテラブルを返します。 print('values:') for v in d.values(): print(v) print() # itms() : キーと値のタプルを要素とするイテラブルを返します。 print('items:') for k, v in d.items(): print(k, ...
true
4e1d3034629934d1dd4d477ed81f342465db6bf7
Python
KJSui/leetcode-2020
/expressionAddOperations.py
UTF-8
1,055
3
3
[]
no_license
class Solution: def addOperators(self, num, target): self.res = [] self.dfs(0, 0, 0, 0, []) return self.res def dfs(self, num, target, idx, prev, curr, value, string): if idx == len(num): if value == target and curr == 0: self.res.append("".join(string...
true
d052cbb994497d25f90d44df289a24b5777ac972
Python
pulakanamnikitha/nikki
/37.py
UTF-8
77
2.6875
3
[]
no_license
x,y=map(int,raw_input().split()) n1=int(x) n2=int(y) n1,n2=n2,n1 print n1,n2
true
8499c977f689e781c9716c2edcd965a684378c70
Python
AlimiG/Euler
/609_pi_sequence.py
UTF-8
494
3.3125
3
[]
no_license
def sieve(n): is_prime = [True]*n is_prime[0] = False is_prime[1] = False for i in range(2,int(n**0.5) +1): index = i*2 while index < n: is_prime[index] = False index = index + i prime = [] for i in range(n): if is_prime[i] == True: pri...
true
894c3cff96caa1612132bd10913b31d5cdd3b3f9
Python
hisyatokaku/Competition
/ABC/110/C.py
UTF-8
504
3.0625
3
[]
no_license
S = input() T = input() c2pos=dict() s_c2pos = dict() for ix, c in enumerate(S): if s_c2pos.get(c) == None: s_c2pos[c] = [ix] else: s_c2pos[c].append(ix) for ix, c in enumerate(T): if c2pos.get(c) == None: c2pos[c] = [ix] else: c2pos[c].append(ix) res = "Yes" for k, v...
true
2c74253f08f6f1c1af1bbb46bf5c87991b2856a6
Python
kimgs20/PyTorch
/torch_expand.py
UTF-8
748
3.625
4
[]
no_license
''' torch.repeat(*sizes) copy tensor torch.expand(*sizes) same as repeat but can use only 1-dimension ''' import torch ''' # torch.repeat(*sizes) x = torch.tensor([1, 2, 3]) x_42 = x.repeat(4, 2) # 4row 2column print(x_42) print(x_42.size()) # [4, 6] x_421 = x.repeat(4, 2, 1) print(x_421) print(x_421.size()) # [4...
true
bccc63db7d06a54bc5efb30cf4f4ccc3ae6301a8
Python
NIU-Data-Science/CNN-exercise
/CNN_trainer.py
UTF-8
3,279
3.25
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Aug 30 10:30:02 2018 @author: Dr. Mark M. Bailey | National Intelligence University """ """ Usage notes: This training script requires a file hierarchy as follows, which exists in the SAME directory as this script: training_set La...
true
d11826f08424d9e45609674452a36426bb5eaa8a
Python
Kwangwoo94/pythonsource-vscode-
/beautifulsoup/clien2.py
UTF-8
834
3.03125
3
[]
no_license
import requests from bs4 import BeautifulSoup import xlsx_write as excel # clien 사이트의 팁과 강좌 게시판의 1 페이지 타이틀 크롤링 # https://www.clien.net/service/board/lecture response = requests.get("https://www.clien.net/service/board/lecture") soup = BeautifulSoup(response.content,'html.parser') # 타이틀 찾기 titles = soup.select("spa...
true
f32836b6e401c3ae84fb17e37bb925e82d382cfc
Python
AlexGumash/Big-Data-and-IKhiIAS
/lab2/stripes/formatOutput.py
UTF-8
746
2.890625
3
[]
no_license
#!/usr/bin/python2 import pyhdfs import ast, json word = str(input("Your word: ")) count = int(input("Count: ")) fs = pyhdfs.HdfsClient(hosts='localhost:50070', user_name='bsbo228') output = fs.open('/user/bsbo228/lab2/output/part-00000') for line in output: striped = line.strip().split("\t") key = striped[0...
true
b41e6282657cf98a17b8a2938b53f872cb2f88b9
Python
diego-go/taller_python_PROTECO
/1er semana/paquetes/ConwayCPU-0.5/bin/ConwayCPU.py
UTF-8
7,505
3.234375
3
[ "MIT" ]
permissive
#!/usr/bin/env python """Conway's Game of Life, drawn to the terminal care of the Blessings lib A board is represented like this:: {(x, y): state, ...} ...where ``state`` is an int from 0..2 representing a color. """ from contextlib import nested from itertools import chain from random import randint from ...
true
f15483ab74e3c6abc5dab5787f532b9addf5a139
Python
CyberAmiAsaf/Control-Conquer
/controlled/Conquested.py
UTF-8
5,708
2.921875
3
[]
no_license
__author__ = 'Cyber-01' import socket import time from PIL import ImageGrab import multiprocessing import win32api,win32con import sys SCREEN_PORT = 2346 MOUSE_PORT = 3456 KEYBOARD_PORT = 5678 SCREEN_DELAY_TIME = 0.05 SCREENSHOT_NAME = "scrn.png" def screen(): """ A function that takes screenshots through...
true
261360b0c34e8b35583efb61e742c2c0415bb50e
Python
BrutalWinter/TF_tutorial
/2 Text generation with an RNN.py
UTF-8
6,226
3.71875
4
[]
no_license
import tensorflow as tf import numpy as np import os import time path_to_file = tf.keras.utils.get_file('shakespeare.txt', 'https://storage.googleapis.com/download.tensorflow.org/data/shakespeare.txt') # First, look in the text: Read, then decode for py2 compat. text = open(path_to_file, 'rb').read().decode(encoding...
true
3f77bb134a0b7c9fa8c02eac1254afab089a0e93
Python
nrkn/SimpleRL
/python/SimpleRL.py
UTF-8
1,370
3.296875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import curses MAP = [ '#### ####', '# #### #', '# #', '## ##', ' # # ', ' # # ', '## ##', '# #', '# #### #', '#### ####', ] KEY_QUIT = ord('q') DIRECTIONS = { curses.KEY_UP: (0, -1), ...
true
c14dedc7a122dfed2206bf21ada4b16c14ff6ce3
Python
Caatu/RASP-SERVER
/main.py
UTF-8
3,815
2.640625
3
[]
no_license
#!/usr/bin/python3 import json, time, os, sys import paho.mqtt.client as mqtt import getpass from dotenv import load_dotenv from callbacks import * from getsensors import * from alerts import * from time import sleep def initializeConnection(username, password, client_id, broker, port): """ Create client ...
true
5f2c258d6410016ffd1ed4092a9e99ef77b09db7
Python
williamd4112/simple-svm
/plot.py
UTF-8
1,038
3.078125
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np def plot_decision_boundary(func, x_, t_, xo_, to_, xt_, tt_, h): x_min = x_[:, 0].min() x_max = x_[:, 0].max() y_min = x_[:, 1].min() y_max = x_[:, 1].max() xx, yy = np.meshgrid(np.arange(x_min, x_max, h), np.arange(y_min, y_max, h)) #Z = fun...
true
c2515e376f5dec51ac5e3e80a65dbea30ffb81ef
Python
hotoku/samples
/python/asyncio/9.py
UTF-8
404
3.4375
3
[]
no_license
""" asyncではない関数を並列実行するには、loop.run_in_executorを使う。 https://docs.python.org/ja/3/library/asyncio-eventloop.html """ import asyncio from time import sleep def f(n): print(n) sleep(1) async def main(): loop = asyncio.get_event_loop() await asyncio.gather(*[ loop.run_in_executor(None, f, i) for ...
true
f6b19c8c329cd11f96082aabc0470bb4c2af2be2
Python
Sandy4321/DigitalCircuits
/LogicExpression.py
UTF-8
8,734
3.390625
3
[]
no_license
__author__ = 'multiangle' class LogicExpression(): def __init__(self,expression): """ :param expression: :return: 规定几种运算符号: 或运算 + 与运算 *或者没有 非运算 [] 异或运算 # ATTENTION:不区分大小写,统一按大...
true
8137eae40cade66d01b751000dd8a4f4c87d3303
Python
wsanchez/sample-klein-app
/src/sample_klein_app/application/test/unittest.py
UTF-8
1,385
2.71875
3
[]
no_license
""" Extensions to :mod:`twisted.trial.unittest` """ from twisted.internet.defer import Deferred, ensureDeferred from twisted.trial import unittest __all__ = ( "TestCase", ) class TestCase(unittest.SynchronousTestCase): """ A unit test. The atom of the unit testing universe. This class extends :cla...
true
248bbe17a6ed4ec00b97c83db17c1d4b5986bc9c
Python
somyungsub/kosta-pythonbasic
/day01/day01_6_1.py
UTF-8
223
3.8125
4
[]
no_license
# split a = 'a-b-c-d-e-f-g' print(a.split("-")) # 리스트로 print(",".join(a.split("-"))) # 리스트 -> 문자열로 합치기 print("".join(a.split("-"))) # 리스트 -> 문자열로 합치기 print(a)
true
1cb94fe022a06b11504abe6c7d16151c2c2687d6
Python
M-Bentley/Lab8
/lab8.py
UTF-8
1,968
3.953125
4
[]
no_license
import random damageByMonster = random.randint(1,35) personHealth = 100 monsterHealth = 100 punchDmg = 5 swordDmg = 10 fireball = 30 print 'A monster approaches! Prepare to fight!' print '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' print 'You have 100 health' print 'The monster has 100 health' print '~~~~~~~~~~~~~~~~~~...
true
cc9dbf8c013a092e6fe1b9c9bb481b576c5441df
Python
bguest/house-of-enlightenment
/python/effects/debugging_effects.py
UTF-8
1,833
2.515625
3
[]
no_license
from hoe import color_utils from hoe.animation_framework import Scene from hoe.animation_framework import Effect from hoe.state import STATE class PrintOSC(Effect): """A effect layer that just prints OSC info when it changes""" def next_frame(self, pixels, t, collaboration_state, osc_data): if osc_da...
true
2e29009d27298db662ab1143772b0e7371274863
Python
akhilgeorge005/thesis
/lig_input_data.py
UTF-8
6,220
2.84375
3
[]
no_license
from sklearn.ensemble import RandomForestRegressor def input_data(): # DEFINE CUSTOM MODEL TO INSERT INTO MODEL SELECTION LIST ######################################################### # rfr = RandomForestRegressor(n_estimators = 750, verbose = 2) #################################...
true
35f370f03ed2d29aafb460a23c101b5ab02c52b0
Python
sainihimanshu1999/Leetcode---Top-100-Liked-Questions
/mergeIntervals.py
UTF-8
326
2.75
3
[]
no_license
def mergeintervals(self,intervals): intervals = sorted(intervals, key= lambda x : x[0]) while i<len(intervals)-1: if intervals[i][-1]>=intervals[i+1][0]: intervals[i][-1] = max(intervals[i][-1],intervals[i+1][-1]) del intervals[i+1] else: i+=1 return int...
true
c0386b438bfd84e69a9d3ede759ed42cf6464df8
Python
paulinho-16/MIEIC-FPRO
/REs/RE11/OrdenarPorFunção/sort_by_f.py
UTF-8
82
3.078125
3
[]
no_license
def sort_by_f(l): l = sorted(l,key = lambda x: x if x<5 else 5-x) return l
true
998fff57bd5514a5db242896d7c32919db328bcb
Python
pjm0/slopefield
/slopefield.py
UTF-8
5,360
2.78125
3
[]
no_license
#import pygame from math import * from random import choice from time import sleep import colors ##from screen import * ##screen_x, screen_y = screen.get_width(), screen.get_height() from geometry import * from agent import Agent from avoid_border import avoid_border SCALE = 15 opponent = choice(range(150, 774)), c...
true
0a8b083a895514289a7142ea06ac1098f6237224
Python
pjcv89/Python
/Notas/05-Módulos y paquetes/archivo1.py
UTF-8
102
3.015625
3
[]
no_license
def mi_funcion(x): return [numero for numero in range(x) if numero%2==0] lista_1 = mi_funcion(11)
true
a9b5780b5ceb7073ddbe6f32ee5f7590740a8ef3
Python
BartoszSlesar/Python_Morsles_Exercises
/is_perfect_square/perfect_square.py
UTF-8
348
2.828125
3
[]
no_license
import cmath from decimal import * def check_complex(val): comp = cmath.sqrt(val) return comp.real.is_integer() and comp.imag.is_integer() def is_perfect_square(val,*,complex=False): if complex: return check_complex(val) if val<0: return False b = Decimal(val).sqrt() return Decim...
true
b1468fb32de29471fafed8ac44effaf42f27ee7b
Python
artykbayevk/AdvancedAI
/train/train_LSTM_Twitter.py
UTF-8
1,922
2.75
3
[]
no_license
# In[1] import numpy as np import pandas as pd import pickle as pkl from keras.models import Model from keras.layers.embeddings import Embedding from keras.preprocessing import sequence, text from sklearn.preprocessing import OneHotEncoder from keras.layers import Dense, Input, Dropout, LSTM, Bidirectional # In[2] tr...
true
3e1238f02b6a9c90d1e0cb0cc16cf0043e320433
Python
Kittyuzu1207/Leecode
/LCCI/0925M堆盘子.py
UTF-8
1,690
4.375
4
[]
no_license
#堆盘子。设想有一堆盘子,堆太高可能会倒下来。因此,在现实生活中,盘子堆到一定高度时,我们就会另外堆一堆盘子。 #请实现数据结构SetOfStacks,模拟这种行为。SetOfStacks应该由多个栈组成,并且在前一个栈填满时新建一个栈。 #此外,SetOfStacks.push()和SetOfStacks.pop()应该与普通栈的操作方法相同(也就是说,pop()返回的值,应该跟只有一个栈时的情况一样)。 #进阶:实现一个popAt(int index)方法,根据指定的子栈,执行pop操作。 #当某个栈为空时,应当删除该栈。当栈中没有元素或不存在该栈时,pop,popAt 应返回 -1. #用二维数组解决 class St...
true
191f7a686dd6db458a4c02e6c2b63df0c0c81ff0
Python
avflorea/openfda
/openfda-3/programa-server.py
UTF-8
3,821
2.890625
3
[]
no_license
import socket import http.client import json # Configuramos el servidor: IP, Puerto IP = "127.0.0.1" PORT = 8088 # Determinamos el maximo de peticiones que puede realizar el cliente MAX_OPEN_REQUESTS = 5 headers = {'User-Agent': 'http-client'} # Hacemos que el cliente se conecte con el servidor conn = http.client.HTTP...
true
64c706a212b431281af1c1a81cd04433adf8c340
Python
AbdurRafay01/OS-Programming
/rough.py
UTF-8
631
3.078125
3
[]
no_license
list2 = [2,5, 11 , 15] # target = 6 target = 17 prev_value = dict() index = 0 for i in range(len(list2)): num = list2[i] needval = target - num if needval in prev_value: print(prev_value[needval] , i) prev_value[num] = i #just checking git from atom def twoSumHashing(num_arr, pair_sum): h...
true
8990725cf86a231af03fb774fac4e4ac0d88abfe
Python
ashjambhulkar/objectoriented
/LeetCodePremium/1031.maximum-sum-of-two-non-overlapping-subarrays.py
UTF-8
278
2.546875
3
[]
no_license
# # @lc app=leetcode id=1031 lang=python3 # # [1031] Maximum Sum of Two Non-Overlapping Subarrays # # @lc code=start class Solution: def maxSumTwoNoOverlap(self, A, L, M): # Solution().maxSumTwoNoOverlap([0, 6, 5, 2, 2, 5, 1, 9, 4],1,2) # @lc code=end
true
204a0e5720dfc79884d4414647ebabfe64d77156
Python
vishwesh5/HackerRank_Python
/Numpy_Challenges/mean_var_std.py
UTF-8
311
3.25
3
[]
no_license
# mean_var_std.py # Link: https://www.hackerrank.com/challenges/np-mean-var-and-std/problem import numpy as np A=[] for i in range([int(i) for i in (input()).split(' ')][0]): A.append([int(i) for i in (input()).split(' ')]) A = np.array(A) print(np.mean(A,axis=1)) print(np.var(A,axis=0)) print(np.std(A))
true
bee0faabbe3ec0320a9f2d7616937e4fd6acff68
Python
dzambranob/Proyecto-Discretas
/Generador_de_claves.py
UTF-8
1,505
4.28125
4
[]
no_license
#Generador de claves #Función para saber si el número es primo def es_primo(n): if (n==1): return False elif (n==2): return True else: tope = int(n/2)+1 for i in range(2,tope): if n%i == 0: return False return True #Función para hallar M.C.D. def mcd(a, b): residuo = 0 while(...
true
8b8001e2d1c7c3bb2d215a7569337a564e48b363
Python
Guedelho/snake-ai
/constants.py
UTF-8
157
2.625
3
[ "MIT" ]
permissive
# Directions UP = 'UP' DOWN = 'DOWN' LEFT = 'LEFT' RIGHT = 'RIGHT' # Colors RED = (255, 0, 0) BLACK = (0, 0, 0) GREEN = (0, 255, 0) WHITE = (255, 255, 255)
true
a994e1d1b356eab9dd7cabb0af9821fdb0435dc0
Python
mitchelloliveira/python-pdti
/Aula04_06082020/aula04_exe10.py
UTF-8
570
4.0625
4
[]
no_license
# Curso de Python - PDTI-SENAC/RN # Profº Weskley Bezerra # Mitchell Oliveira # 06/08/2020 # -------------------------------------------------------------- # Faça um Programa que leia dois vetores com 10 elementos cada. Gere um terceiro vetor de 20 elementos, # cujos valores deverão ser compostos pelos elementos interc...
true
09a3e61d0b170f31542f74cd2d5e50658028f309
Python
wizDaia/backendschool2021
/tests/orders_validator_tests.py
UTF-8
4,843
2.53125
3
[ "MIT" ]
permissive
import unittest from datetime import datetime from unittest.mock import MagicMock from jsonschema import ValidationError from parameterized import parameterized from application.data_validator import DataValidator from tests.test_utils import read_data class OrdersValidatorTests(unittest.TestCase): @classmethod...
true
5d58b47f708d132af358b6abfd0b121e506f4cfb
Python
rgrishigajra/Competitive-Problems
/Coding interview course/Two Pointers/Minimum Window Sort (medium).py
UTF-8
794
3.359375
3
[]
no_license
import math as math def shortest_window_sort(arr): low = 0 print(arr) while low < len(arr)-1 and arr[low+1] > arr[low]: low += 1 if low == len(arr)-1: return 0 high = len(arr)-1 while high > 0 and arr[high] > arr[high-1]: high -= 1 mini = math.inf maxi = -math.inf...
true
63bc38d850ccfc4c017f4fe41ce8ae081df56989
Python
mathvfx/Notebooks
/Python/data_structures/stack_and_queue/ADT_PriorityQueue.py
UTF-8
5,826
3.640625
4
[]
no_license
#!env python3 # # Alex Lim. 2020. https://mathvfx.github.io # This Python code is intended as my own learning and programming exercises. # # REFERENCES and CREDITS: # Goodrich et al, DATA STRUCTURES AND ALGORITHMS IN PYTHON (2013), Wiley from abstract_base.PriorityQueue import PQBase from ADT_ArrayBinaryTree impo...
true
e68d8821329b22bbf54ae16c3206bddd17ac8c7b
Python
pyboost/poost-containers
/tests/test_turbolist.py
UTF-8
2,050
3.171875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # # CONTRIBUTORS (sorted by surname) # LUO, Pengkui <pengkui.luo@gmail.com> # # # UPDATED ON # 2013: 04/20, 04/21, 06/11 # """ Unit tests """ print('Executing %s' % __file__) import unittest from containers import TurboList class Test_TurboList (unittest.TestCase): ...
true
3afa36e597e1f0024ac3b7ee0c8fcefe67c9dd10
Python
Hagai-Mozes/University-Python
/ex2.py
UTF-8
2,935
4.0625
4
[]
no_license
""" Exercise #2. Python for Engineers.""" ######################################### # Question 1 - do not delete this comment ######################################### a = 8 # Replace the assignment with a positive integer to test your code. A = [12,4,0,8] # Replace the assignment with other lists to test your code...
true
d1c955ed6dfd6926c64ef662062986d7603578b4
Python
stevenhorsman/advent-of-code-2019
/day-05/sunny_with_asteroids.py
UTF-8
617
3.515625
4
[]
no_license
import sys from ship_computer import ShipComputer input_file = 'day-05/input.txt' def part1(memory, input = 1): memory = memory.split(",").copy() ship_computer = ShipComputer(memory, input) ship_computer.execute() return ship_computer.get_output() def part2(input): pass for noun in range(1, 1...
true
e959db41a5647bdf3ec5d130be5896f61581f396
Python
vaioco/sys2syz
/core/utils.py
UTF-8
3,418
2.703125
3
[ "MIT", "Apache-2.0" ]
permissive
# Module : Utils.py # Description : Contains basic utility functions required for all modules import os import subprocess import logging import shutil class Utils(object): ENV_NONE = 0 def __init__(self, cwd): self.cwd = cwd @staticmethod def file_exists(path, exit=False): if os.path....
true
837f52eeeaf098923d406bc43cb783dc47236099
Python
VladislavBannikov/py-adv_1.4.Decorators
/main.py
UTF-8
135
2.546875
3
[]
no_license
from time_logger import logger_decorator_factory @logger_decorator_factory('log.txt') def add(a,b): return a+b print(add(4,5))
true
90568aa6d149e2e691f6ee7070bdc0d4ef6c47e9
Python
regbrown99/PackingListGenerator
/PackingListGenerator/getWeather.py
UTF-8
5,827
3.4375
3
[]
no_license
#! /usr/bin/python3 # getWeather.py - Prints the weather for a location from the command line. def getWeather(zip_code, city, country): """This function retrieves weather from OpenWeatherMap.org's API for a given city or zip code. This can be set up to retrieve current weather and/or a weather forecast.""" ...
true
4f574b66e9310fe514cd554f1c3c7db444808249
Python
py1-10-2017/rgero215_PY1-10-2017
/Store/store.py
UTF-8
3,127
3.328125
3
[ "MIT-0" ]
permissive
class Store(object): """docstring for Store.""" def __init__(self, location, owner): super(Store, self).__init__() self.Product = [] self.location = location self.owner = owner def inventory(self): count = 0 for product in self.Product: count += ...
true
f093853b72e1566842b6a1935b4b91aa09560e59
Python
JARS29/RST_psychopy
/RST.py
UTF-8
2,823
3.03125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import time from trials import * experiment_session = 2 text_instructions = "Bem-vindo ao experimento\nA seguir, você vai encontar uma série de frases apresentadas em sequências de 2, 3, 4, 5, 6 sentenças (em ordem aleatória).\n" \ "Sua tarefa vai ser...
true
54c98511504bebcd81766a448d2afbe7a2a9080a
Python
stehrenberg/HomeAutomation
/python_examples/python/demo_function.py
UTF-8
2,632
4.59375
5
[]
no_license
# python function # see also http://www.tutorialspoint.com/python/python_functions.htm from __future__ import print_function, division def SayHello(p_name): """This is the documentation string of the function. The function prints 'Hello p_name!' There is no return value.""" print("Hello ", p_na...
true
2d9050a02ec16a8ef1066e5ac46424a881196c6c
Python
vais-ral/CCPi-Framework
/Wrappers/Python/cil/optimisation/algorithms/FISTA.py
UTF-8
4,048
2.90625
3
[ "GPL-3.0-only", "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- # This work is part of the Core Imaging Library (CIL) developed by CCPi # (Collaborative Computational Project in Tomographic Imaging), with # substantial contributions by UKRI-STFC and University of Manchester. # Licensed under the Apache License, Version 2.0 (the "License"); # you...
true
254ada402b28d66fa13cde3e59209e464232714e
Python
Mulan-94/pyrewind
/pyrewind/pyrewind.py
UTF-8
5,764
2.828125
3
[ "MIT" ]
permissive
#/usr/bin/python3 # Author: L. A. L. Andati # Find infos at: https://wiki.python.org/moin/PyPIJSON import logging import requests import sys from argparse import ArgumentParser from datetime import datetime def get_release_dates(package): # the pypi url including the dates url = f"https://pypi.org/pypi/{pa...
true
8e21b2511268c967bded8bfb81270be38a290556
Python
kiraplenkin/Stepik_python
/1.5-Введение в классы-9.py
UTF-8
461
3.515625
4
[]
no_license
class Buffer: def __init__(self): self.buf = [] def add(self, *a): i = 0 while i < len(a): self.buf.append(a[i]) if len(self.buf) >= 5: self.sum = 0 for n in range(len(self.buf)): self.sum += self.buf[n] ...
true
6905a454932f60a0a1ba54a2c58c813a785ca1e5
Python
Anmol6/DNGO-BO
/models/model_basis.py
UTF-8
2,618
2.671875
3
[]
no_license
import tensorflow as tf import numpy as np ''' Specifies model used as basis function for linear input-output mapping ''' class BasisModel(): ''' initializes model specified here ''' def __init__(self,dim_in,train_mode = True ): self._dim_input = dim_in dim_output = 1 ...
true
6da6d17b173138a4143282fc90b852d25972990b
Python
PavlovStanislav/Pytnon
/Lab_5.py
UTF-8
1,087
3.859375
4
[]
no_license
from random import randint import time def dice_throw(): plr1_pts=0 plr2_pts=0 a = str(input("Input player 1 name: ")) b = str(input("Input player 2 name: ")) plr1=a[:] plr2=b[:] print(a) print(b) for i in range(1,6): print("Next run, number: ", i) ...
true
b22b59a28a68a7a78d5b8f42bccf12d75b3692d1
Python
BNUCNL/FreeROI
/froi/widgets/clusterstatsdialog.py
UTF-8
4,118
2.53125
3
[ "BSD-3-Clause" ]
permissive
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: from PyQt4.QtCore import * from PyQt4.QtGui import * from ..interface import csv class ClusterStatsDialog(QDialog): """A dialog for reporting cluster stats.""" def __init__(self, cluster_info, p...
true
860abafbb77f08350559386668cf69827ac1f6ff
Python
K4liber/Parralel
/lab1/problem5.py
UTF-8
1,216
2.828125
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np import pandas as pd from mpl_toolkits.mplot3d import Axes3D # Run: python3 problem5.py df = pd.read_csv('problem5.csv', names = [ "size", "time" ] ) df2 = pd.read_csv('problem4.csv', names = [ "size", "time" ] ) df3 = pd.read_csv('pr...
true
e21720bcbaa2eafc4da36d4ab789cbe38ca40122
Python
itaditya/Python
/Practise/p1.py
UTF-8
213
3.40625
3
[]
no_license
#!/usr/bin/env python3.4 def post_name(name): name+=' Ghada' return name print('This program will assign some cool name to you') name=input('\nEnter Your First Name\n') name=post_name(name) print('\n',name)
true
f6146e1988b9074a2d84fc6d2a83aa9187efabef
Python
JonathanSpiller/simpleajax
/home/views.py
UTF-8
364
2.515625
3
[]
no_license
from django.shortcuts import render from django.contrib.auth.decorators import login_required from django.http import HttpResponse from time import sleep @login_required def home(request): return render(request, 'home/home.html') def get_data(request): sleep(1) #fetch something from the database car ...
true
fb5c74851bfc4ef41f067823b8d31aafc6a4e1a5
Python
anacampesan/typoglycemia_py
/typoglycemia.py
UTF-8
641
3.78125
4
[]
no_license
import random # in case you want the user to be able to enter his/her own text # test = input() text = "The mind's ability to decipher a mis-spelled word if the first and last letters of the word are correct." def typoglycemia(text): words = text.split() result = [] for word in words: if len(word...
true
ae6ff8d73a4b517a425097454ec7cc9256c188a5
Python
mattkim8/CSI
/Lab11.py
UTF-8
548
2.953125
3
[]
no_license
#Lab 5 def read_file(x): restaurants = dict() try: file_handle = open('restaurant.txt','r') for line in file_handle: stripped_line = line.rstrip() split_line = stripped_line.split(',') restaurants[split_line[2]] = (split_line[0],split_line[1],spli...
true
0eaafaa406c08f0cc8a0f6435a6dfb0dbdd28608
Python
22pilarskil/ImageRecognition
/vectorizedNetwork.py
UTF-8
9,298
2.84375
3
[]
no_license
import numpy as np import random import codecs import matplotlib.pyplot as plt import json def displayImage(pixels, label = None): figure = plt.gcf() figure.canvas.set_window_title("Number display") if label != None: plt.title("Label: \"{label}\"".format(label = label)) else: plt.title("No label") plt.ims...
true
7a00393af784af624b25405468c18d4d8bc57ccb
Python
sheric98/minimax_player
/chessWeb/util.py
UTF-8
2,007
2.671875
3
[]
no_license
import math import random import time from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.support import expected_conditions as EC def sleep_random(start, end): sleep_ti...
true
96c20f030fabe6b36699c5d266b0a85a1752431f
Python
gugi200/project2021-UoB-ad20781
/finding_resitance.py
UTF-8
936
3.296875
3
[]
no_license
import math res_value_1 = [100, 180, 270, 390, 680, 1000] res_value_2 = res_value_1 res = [] res1 = [] ind = [] ''' ((1/res_value_1)+1/res_value_2))**-1 resistance for all combinations in parallel ''' r=0 for X in res_value_1: c=0 for Y in res_value_2: res.append(((1/X)+(1/Y))**-1) index = (r, ...
true
309e1b47612cd93678c9815352340f002ed0bcf0
Python
amirgraily7/PDFMetadataExtractor
/py/box_phrase_candidate_finder.py
UTF-8
4,064
2.890625
3
[]
no_license
from candidate import CandidateFinder, Candidate import re MAX_LENGTH = 10000 class BoxPhraseCandidateFinder(CandidateFinder): """Find candidates by presence of certain phrases in their box.""" def __init__(self, field, fid, phrases, candidate_lines, bbox=None, min_height=0, max_height=MAX_LE...
true
00e933ca78733095c4667986c19defe47fef890e
Python
anyeljm/ml_framework
/src/categorical_features.py
UTF-8
1,208
3.359375
3
[]
no_license
import pandas as pd from sklearn import preprocessing class CategoricalFeatures(): """ df: pandas DataFrame categorical_features: list of columns to encode encoding_type: str -> 'label' or 'ohe' """ def __init__(self, df, categorical_features, encoding_type): self.df = df self....
true
3c03c1d7ab2693f3cdc9b4cb2c17c0bfeaf0a2ba
Python
skang6283/algorithm_daily
/Programmers/이중우선순위큐.py
UTF-8
1,364
2.875
3
[]
no_license
from heapq import * def solution(operations): deleted = set() maxheap = [] minheap = [] for op in operations: cmd, num = op.split(' ') num = int(num) if cmd == 'D': if num == 1: while True: if maxheap: a =...
true
041c7cecb4f11bafd6833dc6f57185974d29b522
Python
Aradhya910/numberguesser
/numberguesser.py
UTF-8
868
4.4375
4
[]
no_license
import random number = random.randint(1, 10) player_name = input('What is your name? ') number_of_guesses = 0 print('''Hello! ''' + player_name + " Let's start the game, Press W for instructions. " ) instructions = input('') if instructions.upper() == 'W': print(''' You have to guess a random number be...
true
3c2853dbdcb212742d5e19304b6ff909a70a3507
Python
guoshan45/guoshan-pyschool
/For Loops/03.py
UTF-8
137
3.03125
3
[]
no_license
def generateNumber(start,end,step): if step>0: return range(start,end+1,step) else: return range(start,end,step)
true
b582cac348c496d522347c9389bb77a8e735cb20
Python
thesubquery/advent_of_code
/aoc.py
UTF-8
3,685
3.21875
3
[ "Apache-2.0" ]
permissive
# Python Standard Library import argparse import os import sys from collections import Counter # pypi # local modules def get_input(file): with open(file, 'r') as f: data = f.readlines() data = [d.strip() for d in data] return data if __name__ == "__main__": # Command line options ...
true
b622cc6ebe4ae25eeb062ce015b711cea2d62871
Python
zkatemor/thesaurus
/total_statistic.py
UTF-8
1,770
3.125
3
[]
no_license
import json def get_union(dict_first, dict_second): union = [] for words_first in dict_first: for words_second in dict_second: if words_first == words_second: if words_second not in union: union.append(words_second) elif words_first not ...
true
6a0e2624aa02bf97922a7a1448c0665661affa95
Python
tildesarecool/ReallyHadtoPython
/automate boring stuff/lesson 30 chapter 8 filenames and paths.py
UTF-8
6,923
3.4375
3
[]
no_license
# filenames and absolute/relative file paths # lesson 30 / chapter 8 # pages ?? # # summmary # ? = says group matches zero or one times # * = zero or more times # + = one or more times # { } = match specific number of times # { } w/ some number matches minimum and max number of times # leaving out first or seond nu...
true
879110f3e0fc99a0b3ed0f2c52621efe1bf0560f
Python
javenonly/stock
/src/old/GetTodayAll_N4.py
UTF-8
5,918
2.890625
3
[]
no_license
#!/usr/bin/python #coding:utf-8 import socket import urllib import tushare as ts import pandas as pd from time import sleep import datetime import tkinter import tkinter.messagebox #这个是消息框,对话框的关键 #日期作为文件夹名字 var_date = '20180627' #成交量的上涨比率 volume_up_rate = 1 #成交量的上涨比率开关 # volume_up_rate_lock = False #最...
true
f782ba01781cd158c663990d7e2a70f4e57affa9
Python
Aasthaengg/IBMdataset
/Python_codes/p02682/s024029716.py
UTF-8
188
2.984375
3
[]
no_license
import sys readline = sys.stdin.buffer.readline a,b,c,k =list(map(int,readline().rstrip().split())) if k <= a: print(k) elif k > a and k <= a + b: print(a) else: print(a -(k-(a+b)))
true
47419c023908c84574eef3512fed0cead95ff0ac
Python
rvrsh3ll/X-Commander
/x-commander.py
UTF-8
3,146
2.71875
3
[ "BSD-3-Clause" ]
permissive
import mysqlx import argparse def Brute(target,targetport,user,password,passwordfile,stop,verbose): with open(passwordfile, "r") as f: # Set passwords variable passwords = f.readlines() # For each password, try to connect with these settings for pwd in passwords: try: ...
true
5c64a4abfbd216eb89c925c392e4f7534b4487b3
Python
207772389/my_tp_shop
/page/page_add_pd.py
UTF-8
7,613
2.640625
3
[]
no_license
# -*- coding: utf-8 -*- """ @Time : 2021/8/5 16:31 @Auth : cainiao @File :page_add_pd.py @IDE :PyCharm @Motto:ABC(Always Be Coding) """ import page from base.web_base import WebBase from time import sleep from tools.get_log import GetLog log = GetLog.get_logger() class PageAddPd(WebBase): # 点击 新建 def addp...
true
8f1faad7bde758452ef4d2a9d41f7ca9f9c97b66
Python
uzzal71/python-fundamentals
/HelloWorld3.py
UTF-8
79
2.65625
3
[ "MIT" ]
permissive
print('Hello World!') print('Hello Human, What is your name?') name = input()
true
ba84820b6fff6ab739a4482f03f2f7168e5b2b43
Python
tamasCsontos/poker-player-game-on
/tests/test_game.py
UTF-8
2,138
2.53125
3
[ "MIT" ]
permissive
import game GAME_STATE_JSON = { 'tournament_id':'550d1d68cd7bd10003000003', 'game_id':'550da1cb2d909006e90004b1', 'round': 0, 'bet_index': 0, 'small_blind': 10, 'current_buy_in': 320, 'pot': 400, 'minimum_raise': 240, 'dealer': 1, 'orbits': 7, 'in_action': 1, 'players': [ { ...
true
fb9d9e291dafd71cf2d08844016ed6956e9d36f1
Python
ofekashery/Ovl-Python
/ovl/helpers/get_defined_functions.py
UTF-8
739
3.09375
3
[ "Apache-2.0" ]
permissive
from inspect import getmembers, isfunction def get_defined_methods(): """ Returns a list of all available functions within the current_vision scope :return: list of function object that are callable """ function_list = [] for module, module_object in globals().items(): for sub_object_...
true
bffcd38ecdb78f19f9bce41c68f514358a200e5d
Python
jclarke100/PythonMapping
/ImportGPX.py
UTF-8
1,925
2.984375
3
[]
no_license
""" Script to import all GPX tracks from a folder into a line feature class in a file geodatabase. New line feature for each GPX file. Generate linear density map of those lines to show where most tracks go. Parameters: 1 - Path to source folder of GPX files 2 - Target feature class to which data is appended ...
true