blob_id
large_string
repo_name
large_string
path
large_string
src_encoding
large_string
length_bytes
int64
score
float64
int_score
int64
detected_licenses
large list
license_type
large_string
text
string
download_success
bool
f1954b7606e7681096770bd8f2ff284500226b81
ankul-kumar/covid-symptoms
/covidos.py
UTF-8
1,410
3.34375
3
[]
no_license
def logo(): print("####################################################################################") print("# check weather you have corona virus #") print("####################################################################################") def que...
true
67f879a5ce5f761a1566e1178ed2683f891f4337
turtlejenny/project
/autocomplete me/randomcheck.py
UTF-8
975
3
3
[]
no_license
#!usr/bin/python import random # generate a random subset from the original text file def randomsubset(filename, textname): with open(filename, 'r') as f: alllines = f.readlines() lines = random.sample(alllines[1:], 50) with open(textname,'w') as f: for line in lines: strline= str(line) f.write(strline...
true
14d2906b5cb12bfda47eadb6454570e546da7a82
anguyen216/IntelRealsense-D435i-custom-GUI
/utils.py
UTF-8
975
2.734375
3
[]
no_license
#!/usr/bin/env python3 # GUI utility functions import numpy as np import pyrealsense2 as rs def get_serial(): """ Get serial number of connected intel camera """ context = rs.context() sn = context.devices[0].get_info(rs.camera_info.serial_number) return sn def get_preset(preset...
true
7dc6a972f0d14006e5ba04e5f4e435d8a0842e04
2yan/Dynet
/test_Brain.py
UTF-8
761
3.09375
3
[]
no_license
from Brain import Brain from Nerve import Nerve def test_init(): brain = Brain() assert brain.inputs == [] assert brain.outputs == [] return brain def test_basic(): brain = Brain() #Ability to add outputs outs = Nerve() brain.add_outs(outs) #Ability to add input...
true
b21e00eed4015893398d57c38ae10dd9e7e669dc
saurabh1002/Project-Euler
/61.py
UTF-8
2,562
3.921875
4
[]
no_license
# Find the sum of the only ordered set of six cyclic 4-digit numbers for which each polygonal type: triangle, square, pentagonal, hexagonal, heptagonal, and octagonal, is represented by a different number in the set. def tri_num(n): num = n * (n + 1) * 0.5 return num def sqr_num(n): num = n * n return...
true
d70eb9bfcfca7debd07a08f9034579997f3e2529
venkatram64/python_ml
/mlwork/regression/pca_iris_15.py
UTF-8
1,397
3.25
3
[]
no_license
from sklearn.datasets import load_iris from sklearn.decomposition import PCA import pylab as pl from itertools import cycle """ PCA is a dimensionality reduction technique; it lets you distill multi-dimensional data down to fewer dimensions, selecting new dimensions that preserve variance in the data as best it can...
true
952e71d088fd9c0b15f44bff6c2531936ef0e83a
csalguer/MayaNet
/visualize.py
UTF-8
681
2.8125
3
[]
no_license
from datetime import datetime import visdom class Visualizations: def __init__(self, env_name=None): if env_name is None: env_name = str(datetime.now().strftime("%d-%m %Hh%M")) self.env_name = env_name self.vis = visdom.Visdom(env=self.env_name) self.loss_win = None ...
true
ffef9e1c195f79281224109c431038dd340a1abf
aicam/affine-gap-sequence-alignment
/fasta_parser.py
UTF-8
295
2.734375
3
[]
no_license
def read_fasta(fp): name, seq = None, [] for line in fp: line = line.rstrip() if line.startswith(">"): if name: yield (name, ''.join(seq)) name, seq = line, [] else: seq.append(line) if name: yield (name, ''.join(seq))
true
e255b86093eebf26cf0c90be4b89c8826c1aea2b
HuichuanLI/alogritme-interview
/考试/iqi.py
UTF-8
228
3.046875
3
[]
no_license
import sys line_length = int(sys.stdin.readline().strip()) line = "" nums_words = 0 while 1: cur = sys.stdin.readline().strip() nums_words = len(cur.split()) if cur: line.append(cur) else: break
true
6d2117ab55351c04b0da42850ccf58a094049c11
CMUChimpsLab/urban_analytics
/analyze/user/build_user_collection.py
UTF-8
6,711
3.21875
3
[]
no_license
#!/usr/bin/env python # Builds up the "user" collection. # Adds: # - most common neighborhood # - centroid (by averaging lat and lon) # - 50% radius (half their tweets are inside this circle) # - 90% radius (90% of their tweets are inside this circle) import geojson, shapely.geometry, collections, cProfile, json impo...
true
0ec98bee24d1039ba1cf8906b2e4642dca0dfca5
Typhoidfever/Python-basic
/Применения цикла for при работе со словарями.py
UTF-8
2,341
4.34375
4
[]
no_license
# Цикл for не может применятся со словарями на прямую. Для его применения необходимо проводить определённые # преобразования # Получение всех значений по всем ключам с помощью цикла for церез создание списка ключей b_dict = {"cat": "chat", "dog": "chien", "horse": "cheval"} words = ['cat', 'lion', 'horse'] for word ...
true
ad44484564a58b9947aafb77d506107d44d3f0da
NickRuiz/lattice-align
/ibm.py
UTF-8
7,790
2.78125
3
[]
no_license
from collections import defaultdict, Counter from itertools import chain def IBM1(src, trg, iterations, iterfile = None): # Adds the `#NULL` token to the target sentence. # Convert into docstream. src = [i.split() for i in src.split('\n')] trg = [list(["#NULL"]+ i.split()) for i in trg.split('\n')] ...
true
c6af61527c5f24abaacdd8709146750b78250eb6
EnriqueSoria/python-utils
/utils/collections.py
UTF-8
3,067
3.046875
3
[]
no_license
from collections import UserDict from enum import Enum from typing import Any, List, Type from utils.constants import NOT_SET from utils.exceptions import MissingKeys class Mapping(UserDict): """ Dictionary that allows you to specify a default value. If valid_keys is specified, it will only return the d...
true
93cd7a12ca573f09f67a74797a088f086099f9ba
dcampanini/Introduction-to-Programming-uchile
/C2/Code_listas/c2-2018-2-p1.py
UTF-8
439
3.03125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Sep 6 13:02:50 2019 @author: Diego Campanini """ #%% from lista import * l0=listaVacia l1=crearLista(20,l0) l2=crearLista(40,l1) lnum=crearLista(30,l2) # parte a def eliminar(lnum,n,c=1): if c==n: return cola(lnum) else: c=c+1 return crearLis...
true
2fb4a6aa86df7e14bf1f96999433f23c98c9b996
adamrodger/eulerproblems
/prob031.py
UTF-8
714
4.15625
4
[]
no_license
""" In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation: 1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p). It is possible to make £2 in the following way: 1x£1 + 1x50p + 2x20p + 1x5p + 1x2p + 3x1p How many different ways can £2 be made using any...
true
e2e82d4b888a1b2ce82a4b2e359456881e2ff9ee
sanghun8/Wishlist
/apps/loginreg_app/models.py
UTF-8
2,439
2.765625
3
[]
no_license
from django.db import models from datetime import datetime import bcrypt datetime.now() class UserManager(models.Manager): def validateRegistration(self, postData): now = datetime.now() response = { 'status' : False, 'errors' : [], } if len(postData['name']) ...
true
348783e318b7826be525230c71b5eebd74a1912c
fugitiveinkc/Data_Science
/Comparison Between Intimate and Non-Intimate Partner Violence (World)/plot.py
UTF-8
1,864
3.828125
4
[]
no_license
''' Title: Comparison Between Intimate and Non-Intimate Partner Violence (World) Purpose: Using WHO data regarding sexual violence against women, this program will plot both intimate and non-intimate partner violence rates in the world to see how they compare. Visual effect choice: Have two bars side by side for eac...
true
0d525073a7c788a5fc3de028f62e0ce020c41e2c
Birkhoff001/selenium_test
/test_case/test_login_none.py
UTF-8
237
2.546875
3
[]
no_license
#-*- coding: utf-8 -*- def test_login_none(self): try: self.browser.find_element_by_class_name('login_none').click() print "click login button." except NoSuchElementException: print "element not finded yet." time.sleep(2)
true
8be4bdc1fdbe61d76081dc496ac2357c40cc8968
MacHu-GWU/learn_pyforms-project
/example/format_fullname.py
UTF-8
932
2.734375
3
[ "MIT" ]
permissive
from pyforms.basewidget import BaseWidget from pyforms.controls import ControlText from pyforms.controls import ControlButton class AppFormatFullname(BaseWidget): def __init__(self): super(AppFormatFullname, self).__init__('Format Fullname') # Definition of the forms fields self._firstna...
true
ca5b358fbb9da60027c42b7335b653cc279aea6c
jmarbet/intro-to-neural-networks
/Code/NeuralNetworkUsingTensorFlowKeras.py
UTF-8
1,235
3.421875
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense from tensorflow.keras import optimizers # Generate the training data sampleSize = 100 xMin = -1.0 xMax = 1.0 inputs = xMin + (xMax-xMin) * np.random.random((sampleSize,1)) outputs...
true
57ad93b527f68f749a80b79f0f1d874295696eb0
Naveen7437/datastructures-algorithms
/height_balanced.py
UTF-8
865
4
4
[]
no_license
class Node: def __init__(self, data): self.data = data self.left = None self.right = None def height(root): if not root: return 0 return max(height(root.left), height(root.right)) + 1 def checkHeightBalanced(root): if not root: return True lh = hei...
true
cf72b14ea23f42b8527a3811d51f408ed4c843c8
rgrupe/projassigns
/test/projassigns_test.py
UTF-8
776
2.59375
3
[ "MIT" ]
permissive
""" Test module for projectassigns.py version: 2017-11-24 author: Robert Grupe """ import unittest import projassigns.py class TestCase00(unittest.TestCase): """Tests for `ProjectTasks.py`.""" # preparing to test def setUp(self): """ Setting up for the test """ print("TestCase00:setUp_:be...
true
9abeb5275fabfc810c16f4e8d2c6eabc247edde4
manojsudharsan/Python
/CountStarting.py
UTF-8
137
2.796875
3
[]
no_license
X=int(input()) L=list(map(str,input().split()))[:X] V=input() c=0 for i in range(0,len(L)): if(L[i].startswith(V)): c=c+1 print(c)
true
7127ac8d41e32dff34e20cc5f776cbd75de5a377
vbelis/triple_e
/src/triple_e/entanglement_capability.py
UTF-8
3,390
3.203125
3
[ "Apache-2.0" ]
permissive
# Computes entanglement capability of circuits # based on: https://arxiv.org/abs/1905.10876 import numpy as np from qiskit.quantum_info import DensityMatrix, Statevector def entanglement_capability( circuit_simulator, n_params, n_shots=1000, data=None, seed=None ): """Computes entanglement capability for a c...
true
04ff1ada1c3ecdbc707550aa215e4c5d4794d885
gaurav172/Assignment
/DIP/Assignment1/src/bit_plane.py
UTF-8
447
3.046875
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np import sys from PIL import Image def BitQuantizeImage(fg): # Get the dimensions of background image im = np.array(fg) fig = plt.figure() k = 128 while k > 0: plt.imshow(255*(im//k)) plt.axis('off') plt.show() im = im - k*(im//k) k = k//2 if __name...
true
e43dc1aa99a02aba89dec58cd5b74e7575f0802c
PerLundmark/clarity-ext
/clarity_ext/dilution_strategies.py
UTF-8
5,465
3
3
[]
no_license
# These values, residing in SingleTransfer objects, are calculated in # the these strategy classes (except FixedVolumeCalc) # # Variables to be used in driver file and udf update calculations: # sample_volume, # the volume in ul taken from the source sample into the destination # # buffer_volume, # the volume i...
true
c24d4ea8a22b1b58268ca3835254abdba77109aa
Loveskyrim/insta_recommend
/langdetection.py
UTF-8
1,701
2.59375
3
[]
no_license
import csv, os, sys from langdetect import detect, detect_langs from langdetect import DetectorFactory import emoji DetectorFactory.seed = 0 path = sys.argv[1] # reg = re.compile('[^a-zA-Z ]') def extract_emojis(str): return ''.join(c for c in str if c not in emoji.UNICODE_EMOJI) def add_language(path): items...
true
8113500914ae6feb1d27da30081932ca88111500
AveryEMcG/DispatchService
/server.py
UTF-8
3,004
3.125
3
[]
no_license
"""Server This module runs an HTTPserver, listening for user events to pass down the queues. The data is not verified or validated, but functions have been put in place for that to happen in the future HTTPserver is not considered secure - so it's not good for production. I chose it for the scope of prompt as it's s...
true
d53978c175099a31e51d0881c7ef13bc4d587457
honyacho/leetcode_excercise
/0103.py
UTF-8
793
3.3125
3
[]
no_license
from collections import deque # Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def zigzagLevelOrder(self, root: TreeNode) -> list: result = [] if not ...
true
da04d181d9e84238ca2e8a8494df52f705e9865b
jdduser/abount_graduation
/demo/readfile.py
UTF-8
570
3.09375
3
[]
no_license
# coding: utf-8 import os ls=os.linesep fwrite=open('./text/text1.parse.txt','w') fread = open("./text/text1.txt") # 返回一个文件对象 line = fread.readline() # 调用文件的 readline()方法 while line: if('):' in line): #提取该集里面说过话的人及说过的话的第一句 print line # 后面跟 ',' 将忽略换行符 ...
true
7a1bca066dfba606be86c23c1c2103412cf7dbee
Omkar-M/Coffee-Machine
/Problems/FizzBuzz/task.py
UTF-8
140
3.65625
4
[]
no_license
for x in range(1, 101): a = (x % 3 == 0) b = (x % 5 == 0) print("FizzBuzz" if a and b else "Fizz" if a else "Buzz" if b else x)
true
2bd4fe3ad0478fb515284b169b67fc66552545ad
terragord7/sharknado2
/vggnet_bbregression_predict.py
UTF-8
1,448
2.640625
3
[]
no_license
from tensorflow.keras.preprocessing.image import img_to_array from tensorflow.keras.preprocessing.image import load_img from tensorflow.keras.models import load_model import numpy as np import cv2 import os # build path to test dataset test = os.path.join(os.getcwd(),'test') # load trained bounding box regressor from...
true
13f803494775e7e3dea31b5e3466839b84582772
frrad/eopi
/twelve/two_nieoh.py
UTF-8
382
3.125
3
[ "MIT" ]
permissive
def anon(mag, letter): d = {} if len(letter) > len(mag): return False for l in letter: if l == ' ': continue if l in d: d[l] += 1 else: d[l] = 1 for m in mag: if m in d: d[m] -= 1 for val in d.values():...
true
6882850507c36746f280d5ce530a3692aea69f08
apcrumbleton/Openstack_exercises
/os_create_instance_TEST.py
UTF-8
967
3.015625
3
[]
no_license
#!/usr/bin/env python3 """Create an openstack cloud instance using a provided flavor and image Then print out the new instance Then remove it! (Cloud resources cost money!!)""" from shade import * from os_connector import * # Get a connection object from the os_connector: conn = os_cc_conn() # Define variab...
true
b98e3f26da625aeab1d964a952ecaf9076e54975
riyama46/tubes-daa-2020
/heapsort.py
UTF-8
837
3.71875
4
[]
no_license
import time start = time.time() def heapify(array, j, k): max = k left = 2 * k + 1 right = 2 * k + 2 if left < j and array[max] < array[left]: max = left if right < j and array[max] < array[right]: max = right if max != k: array[k], array[m...
true
3855a3bde66a7303a502a0bca8b4c7ee059971b6
kyriekevin/Computer_Network
/src/QR_code.py
UTF-8
8,878
2.796875
3
[ "MIT" ]
permissive
# -*- codeing = utf-8 -*- # @Time : 2021/3/21 12:41 # @Author : zyz # @File : QR_code.py # @Software : PyCharm import cv2 import numpy as np import random import string # 编码 def encode(data): return ' '.join([bin(ord(ch)).replace('0b', '') for ch in data]) # 解码 def decode(data): return '...
true
d008cdded7ff7296240ba076f04ba2dc85f7074a
PRHLT/htr-contests-exps
/ICFHR2016-HTR-Experiment/bin/filter-ext.py
UTF-8
2,850
2.8125
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys, os, argparse import unicodedata as ud #pname = str(sys.argv[0]) #pos = int(str(sys.argv[1]))-1 def rmdiacritics(char): ''' Return the base character of char, by "removing" any diacritics like accents or curls and strokes and the like. ''' ...
true
e771d2696052f6e1e67f138fca11026ba7029b59
sunrain0707/python_exercise_100
/ex33.py
UTF-8
104
4.0625
4
[]
no_license
#33.按逗号分隔列表。 l = [1,2,3] for i in l[0:len(l)-1]: print(i,end=',') print(i+1)
true
7d00f4fc8b94c2a50e99e54b6f5db43f9fd1b102
Lazysisphus/Zen-Thought-on-LeetCode
/动态规划/0647回文子串.py
UTF-8
831
3.046875
3
[]
no_license
class Solution: def countSubstrings(self, s: str) -> int: # dp # dp[i][j]表示从i开始到j结束的闭区间是否是回文串 # 如果是回文串,dp[i][j] == True,反之为False if not s: return 0 n = len(s) dp = [[False for _ in range(n)] for _ in range(n)] ans = n for i in range(n): ...
true
5802f6df07240e16a615af92dabd8ae205d15b13
radulescupetru/Machine_Learning
/data_preprocessing_template.py
UTF-8
963
3.09375
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import pandas as pd #library to manage and import data sets def preprocess(path,xn,dep_index,tsize): #Importing data sets dataset=pd.read_csv(path) #print("Rows:",dataset.shape[0],"Columns:",dataset.shape[1]) #separating out independent variable X=dataset.iloc...
true
77c4f6e7d2fa51f3347c82694ea7404bd55ba86f
LawrenceScroggs/School_Python
/printTest.py
UTF-8
566
4.03125
4
[]
no_license
print("Hello, world!") print("Hello,\n\nworld!") print(3) print(2,5) print(2+5) print('The number is',4) print('The number is', str(4)) print('Monday\tTuesday\tWednesday') print(16,17,18) print('16\t17\t18') print(1.234567899874889589604865) print('What\s your name?') print('What\s your name?') print('I sa...
true
3fa819942ed3f7a9a9b9e28c5ca06c9027c0bcba
KasperSHenriksen/neural_network_from_scratch
/Mine/MyNeuralNetwork/neuralnetwork.py
UTF-8
2,685
3.515625
4
[]
no_license
import numpy as np class Neuron: def __init__(self,bias,weights,value): self.bias = bias self.weights = weights self.value = value class Layer: def __init__(self,input_size,output_size,activation): self.neurons = [] self.input_size = input_size self.output_size...
true
93ee0058f9b5a99b0b1859b51d6eb06b3315388b
karpal1/Liczenie-pola-trojkata-i-prostokata
/Skrypt.py
UTF-8
3,007
4.25
4
[]
no_license
import math zmienna='t' while zmienna!='n': figura= input('Podaj jedną figurę prostokąt[P] lub trójkąt[T], z której chcesz obliczyć obwód i pole \n') if figura=='P': wzór= input('Na podstawie jakich danych chcesz obliczyć pole i obwód prostokąta?: \n[A]Długosci boków a i b \n[B]Długosci jednego boku i prz...
true
5daf38ef3dfeb9898e9327c59d743672fc379ac8
Goel-Akshit/Consolidator
/main.py
UTF-8
3,996
2.71875
3
[]
no_license
from tkinter import filedialog from tkinter import messagebox from tkinter import * import os from datetime import date def BrowseFilesPath(window): global filesPath temp = filedialog.askdirectory() LabelBox = Label(window, text=temp, font=("Arial", 11),padx=5).grid(row=0,column=3) filesPat...
true
339a466a1cad124e2cd57e0718c124c3b7630704
wxiea/Lab5
/main.py
UTF-8
671
3.609375
4
[]
no_license
from Heap import Heap def getnumber(filename): number= [] with open(filename)as file: for line in file: values = line.split(",") for i in range(len(values)): number.append(values[i]) return number def sort(NumberOfList): Newheap = Heap() s...
true
8feaabf44cda44616bc980b97d93eff548337191
pe-ge/aoc2018
/7/7a.py
UTF-8
1,204
2.71875
3
[]
no_license
from pprint import pprint data = [] nodes = set() counts = {} with open('7.txt') as f: # with open('7-example.txt') as f: for line in f.readlines(): splitted = line.split(' ') first = splitted[1] second = splitted[7] nodes.add(first) nodes.add(second) if first not in ...
true
5aba4ad857175692b025050b12b49490bbac37f3
vladimercury/rnn
/draw-stat.py
UTF-8
1,635
2.59375
3
[]
no_license
import matplotlib.pyplot as pt import csv # AAALSTM = "models/AAA0371/lstm-stat.csv" # AAAGRU = "models/AAA0371/gru-stat.csv" # AAARNN = "models/AAA0371/rnn-stat.csv" # CGMLSTM = "models/CGM0994/lstm-stat.csv" # CGMGRU = "models/CGM0994/gru-stat.csv" # KEELSTM = "models/KEE0997/lstm-stat.csv" # # INPUT_FILES = [ # ...
true
9bf45c599d22127485182d62f07250dceb1e83b5
TinoLiu7/PyCharm_Course
/Py27Lab/step11_matplotlib/lab80_plot3.py
UTF-8
278
2.6875
3
[]
no_license
import numpy as np import pandas as pd import matplotlib.pyplot as plt randomSequences = pd.DataFrame(np.random.normal(1.0, 0.07, (100, 8))) print randomSequences.head() # 3rd 1*2*3 accumulates = randomSequences.cumprod() print accumulates.head() accumulates.plot() plt.show()
true
f5d299a654ae240fee0457c3b3072531f3a75e4d
nguyen-fs90/ML-Scikit-Learn
/scikit-1/xor-train.py
UTF-8
602
3.46875
3
[]
no_license
from sklearn import svm # Tập dữ liệu xor_data = [ # P, Q, Result [0, 0, 0], [0, 1, 1], [1, 0, 1], [1, 1, 0] ] # Phân loại data & label data = [] label = [] for row in xor_data: p = row[0] q = row[1] r = row[2] data.append([p, q]) label.append(r) # Training clf = svm.SVC() cl...
true
ffefda00cc151f32adeb4d36273d0302ac075d71
Belonger/Deep_Learning_Study_Notes
/blog4.1.py
UTF-8
1,539
3.421875
3
[]
no_license
import random import torch # 我们就用y = wx 来理解 def synthetic_data(w, num_examples): X = torch.normal(0, 1, (num_examples, len(w))) y = torch.matmul(X, w) return X, y.reshape((-1, 1)) def data_iter(batch_size, features, labels): num_examples = len(features) indices = list(range(num_examples)) ran...
true
724760ded54d8e0b8afe3d259a8fdf3db98e3330
Currycomb/Machine-Learning-WuEnda
/homework/ex6/test.py
UTF-8
687
2.65625
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import pandas as pd from pprint import pprint import scipy.io as sio import scipy.optimize as opt from sklearn import svm from sklearn.model_selection import train_test_split data = pd.DataFrame({'x1': [i for i in range(10)], 'x2': [i**2 for i in range(10)], ...
true
f1a51b7a0edeb4c8072fefc2256e5823891bf199
bbenshab/yamlpath
/yamlpath/wrappers/nodecoords.py
UTF-8
2,161
3.78125
4
[ "ISC" ]
permissive
"""Wrap a node along with its relative coordinates within its DOM.""" from typing import Any from yamlpath import YAMLPath class NodeCoords: """ Initialize a new NodeCoords. A node's coordinates track these properties: 1. Reference-to-the-Node-Itself, 2. Immediate-Parent-Node-of-the-Node, 3. ...
true
21d767fa0995cde5c15b17671e183c8e4e2e17c6
mistakenot/hackmcr2018
/sentiment-analysis/sentiment.py
UTF-8
642
2.703125
3
[]
no_license
import os import requests import time endpoint = "https://westcentralus.api.cognitive.microsoft.com/text/analytics/v2.0/sentiment" subscription_key = os.environ['AZURE_TEXT_KEY'] def get_sentiment(text): documents = {'documents' : [ {'id': '1', 'language': 'en', 'text': text} ]} headers = {"Ocp-...
true
1668411abf76baea8be5ac32c218ed08524e95bf
proehr/CoMa
/PA04.py
UTF-8
216
2.75
3
[]
no_license
def f(n): a=0 b=1 for i in range(n): a,b=b,a+b return a def goldener_schnitt(praezision): l=2 while praezision >= f(2*l-3)*f(2*l-2): l+=1 l-=1 plist=[l,(f(2*l),f(2*l-1)),(f(2*l+1),f(2*l))] return plist
true
c83ae2320ae805d628fbd16ea60ee7ab12eed6d7
pataraco/scripts
/learning/python/oop/car.py
UTF-8
304
3.546875
4
[ "MIT" ]
permissive
from vehicle import Vehicle class Car(Vehicle): def brag(self): print(f"My car is awesome!") car1 = Car() car2 = Car(200) car1.warnings.append("low oil") print(car1.__dict__) print(car2.__dict__) print(car1) car2.increase_mileage(1000) print(f"mileage: {car2.get_mileage()}") car1.brag()
true
b3da1783ff39d3bd82e96871a9655af3126008e1
5l1v3r1/rpi-l298n-motor-driver
/test_keyboard.py
UTF-8
779
3.078125
3
[]
no_license
import curses import sys import os def main(stdscr): # do not wait for input when calling getch stdscr.nodelay(1) # fix stdout ( @see http://stackoverflow.com/questions/3657103/python-print-not-functioning-correctly-after-using-curses ) sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) while Tru...
true
89abe9cefa294f9c270e32ad69f95d77a93e2dda
Franferrreras/HLC
/Python/Tuplas/U1T4_Tuplas_Ex4.py
UTF-8
410
4.46875
4
[]
no_license
# Ejercicio 4 # Descomprime la siguiente tupla en 4 variables # tupla = (10, 20, 30, 40) # Resultado: # tupla = (10, 20, 30, 40) # # Tu codigo # print (a) # debería imprimir 10 # print (b) # debería imprimir 20 # print (c) # debería imprimir 30 # print (d) # debería imprimir 40 tupla = (10, 20, 30, 40) a = tupla[0...
true
4575133087ee95a9301b32f2a83ecb9f4b124ade
mk60991/DeepLearning-with-keras
/example/keras-regresssion3.py
UTF-8
1,672
3.21875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Aug 14 11:51:36 2019 @author: Manish """ #regression using keras import pandas as pd import numpy as np # Import required libraries import pandas as pd import numpy as np import matplotlib.pyplot as plt import sklearn # Import necessary modules from sklear...
true
33672c3dc9dcbaa89175c9997826ef8972d3db11
vincent-kangzhou/Leetcode_Easy
/804_Unique Morse Code Words.py
UTF-8
551
3.296875
3
[]
no_license
class Solution(object): def uniqueMorseRepresentations(self, words): """ :type words: List[str] :rtype: int """ ans=[] morse=[".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",...
true
9f3e4168d54a335c618810c0417fd226962396a0
veean/6_password_strength
/password_strength.py
UTF-8
2,194
3.125
3
[]
no_license
import getpass import requests import re import sys import os DEFAULT_PASSWORDS_LIST_URL = 'https://wiki.skullsecurity.org/images/c/ca/500-worst-passwords.txt' def check_bad_passwords_online(password_to_check): passwords_list = requests.get(DEFAULT_PASSWORDS_LIST_URL).text.splitlines() return passwo...
true
04d66705e488ee5650c079a9e55ed7a07afe5e43
daniel-reich/ubiquitous-fiesta
/p8iNsRCtj3AdJsYjS_9.py
UTF-8
99
3.28125
3
[]
no_license
def title_to_number(s): return sum((ord(i) - 64) * 26**idx for idx, i in enumerate(s[::-1]))
true
28ce6f2fe6b3cf2ab97813173fba3436a352fad0
LaiMo2020/more2offer
/app.py
UTF-8
4,909
2.625
3
[]
no_license
import os from flask import ( Flask, flash, render_template, redirect, request, session, url_for) from flask_pymongo import PyMongo from bson.objectid import ObjectId from werkzeug.security import generate_password_hash, check_password_hash if os.path.exists("env.py"): import env app = Flask(__name__) app.config...
true
870f9c1b3d2a8c2b9d00e34043bde34ee6cf6db8
zhangxf2020/jeee
/pyQT/Qwidget/QLineEdit-单行文本框/QLineEdit-单行文本框.py
UTF-8
5,612
2.84375
3
[]
no_license
from PyQt5.Qt import * class Storage(): @staticmethod def storage(): account_pwd={'123':'321','456':'654','789':'987'} # account_pwd[account]=pwd return account_pwd class AccountTool: ACCOUNT_ERROR = 1 PWD_ERROR=2 SUCCESS=3 @staticmethod def check_login(account,pwd)...
true
0a85908eab263ac035cbab8dac16c3e3db0fec30
TammyLaforest/ed2go_python_work
/intro_to_python_exercises/pizza_slices.py
UTF-8
825
4.34375
4
[]
no_license
import math def total_slices(people, slices_per_person): return people * slices_per_person def num_whole_pizza(slices, slices_per_pie): return math.ceil(slices / slices_per_pie) def rem_slices(whole_pizza, slices_per_pie, slices): return math.floor(whole_pizza * slices_per_pie - slices) def main(): ...
true
72aed289de5496d65a74d9aeed6f4413b7d9eb1b
krishna-y-tummala/LinearRegression
/LinearRegression.py
UTF-8
3,798
3.46875
3
[]
no_license
#BEGIN #IMPORTS import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns sns.set_style('whitegrid') #READ DATA customers = pd.read_csv('C:\\Users\\User\\Documents\\Ecommerce Customers.csv') #Change Working Directory if required import os os.getcwd() os.chdir('C:\\Us...
true
1a3fd588fadf602adfc53b50b4bb6acf28e8e2c5
arsamigullin/problem_solving_python
/leet/facebook/trees_and_graphs/course_schedule.py
UTF-8
2,117
3.8125
4
[]
no_license
#https://leetcode.com/problems/course-schedule/submissions/ # to solve this we use DFS # The problem boils down to find the cycles in graph # Algo # 1. build a graph # Note: all the nodes are in numCourses range # 2. We also maintain states # 3. Each vertes has three states: # 0 - unvisited # 1 - visiting ...
true
c56e6978a07dee13192985498188499e5870b91e
daniel-dinu/rational-python
/test_rational/test_rational.py
UTF-8
32,463
3.078125
3
[ "MIT" ]
permissive
import unittest2 from unittest2 import TestCase from rational.rational import gcd from rational.rational import Rational __author__ = 'Daniel Dinu' class TestRational(TestCase): def setUp(self): self.known_values = [(1, 2, 1, 2), (-1, 2, -1, 2), ...
true
a87b621540263572ec7685c20604231e67ec5b8e
ARISE-Handong/museumplus
/scripts/integrate_muts_in_stmt.py
UTF-8
3,010
2.734375
3
[]
no_license
#!/usr/bin/python2.7 import argparse import csv def classname_to_filename(classname): classname = classname[:classname.find('.java')] return classname.replace('/', '.') def stmt_to_line(stmt): classname, lineno = stmt.rsplit('#') return '{}#{}'.format(classname_to_filename(classname), lineno) assert classna...
true
50c69a7b29be9ae0475da73233a6fe1dab68fb8e
huning2009/Quantitative-Analysis-of-Financial-Markets-Projects
/DataCleansing.py
UTF-8
8,997
2.578125
3
[]
no_license
# -*- coding: utf-8 -*- """ Data Cleansing """ import numpy as np import pandas as pd import datetime def timeit(method): def timed(*args, **kw): start = datetime.datetime.now() result = method(*args, **kw) end = datetime.datetime.now() print(method.__name__,'took ',e...
true
de5ed204bb1ec4e52bf79b0477b9eec9d5917ac0
nadeal/Cnki-Spider
/cnki_spider/step3_cnki_csv_excel.py
UTF-8
1,079
2.953125
3
[]
no_license
import csv from cnki_spider.spiderLog import SpiderLog import pandas as pd class CnkiCsvExcel: def __init__(self): self.log = SpiderLog() self.title = ['序号', '关键字1', '关键词2', '关键字3', '正文标题', '副标题', '正文快照', '报纸日期', '版名', '版号', '分类号', '报纸名', '报纸所在地', '报纸所在地...
true
d1d224b210573e6ec9318da44bbbe310c9fe5602
howard36/TensorFlowGameAI
/Game.py
UTF-8
4,709
3.09375
3
[]
no_license
import copy import numpy as np OthN = 6 def startStateTTT(): return np.zeros(9) def startStateC4(): return np.zeros(42) def startStateOth(): return np.zeros((OthN, OthN)) def validMovesTTT(state): return state == 0 def validMovesC4(state): return state[-7:] == 0 # def validMovesOth(state):...
true
7eda545a45a2868283b419c8c347220565ce51cc
xijunke/handheld_svbrdf_geometry
/code/utils/logging.py
UTF-8
2,003
2.515625
3
[ "MIT" ]
permissive
""" Copyright (c) 2020 Autonomous Vision Group (AVG), Max Planck Institute for Intelligent Systems, Tuebingen, Germany Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, includin...
true
75b865a704b5d725c784ebac33b683cf7f5fe05a
DianaLuca/Algorithms
/CLRS_Cormen/DataStructuresIII/BinarySearchTree/SuccessorAndPredecessorOfBST.py
UTF-8
1,802
4.125
4
[]
no_license
""" Input: root node, key output: predecessor node, successor node 1. If root is NULL then return 2. if key is found then a. If its left subtree is not null Then predecessor will be the right most child of left subtree or left child itself. b. If its right subtree is not null The...
true
67126306d2c2c17d3e74dc38cecec70292d76151
dmaulikr/NearBuy
/server/integrations/subway_time.py
UTF-8
1,124
2.734375
3
[]
no_license
import requests import json from datetime import datetime import operator from station_dict import STATION_DICT def find_subway_time(station): """ Given a NYC subway station Google Places result, returns the number of minutes until the next train comes """ name = station.get('name') if name not in STATION_DICT....
true
1e4ff7fe815daa725e20b30930f7c2fff205cf96
colombo0718/FM628A_SpaceProject
/lab02.py
UTF-8
108
2.546875
3
[]
no_license
import time from machine import ADC, Pin adc = ADC(0) while True: print(adc.read()) time.sleep(.05)
true
6b1c132aa1094274bd3bc298fe942e9dfb0fbc07
wangyuhu/Pattern-recognition-homework
/5th_hw/q1.py
UTF-8
2,446
2.90625
3
[]
no_license
#coding:utf-8 import numpy as np import random import matplotlib.pyplot as plt import scipy.io as scio from utils import K_means import matplotlib.patches as mpatches if __name__ == '__main__': #载入数据 data_path = 'Kmeans_data.mat' data_array = scio.loadmat(data_path)['Kdata'] mu_realarray = scio.loadmat...
true
2492518e173daee4a24b4bfbcd928f36f1d63203
shostakovichs-spacecraft-factory/cansat-2018-2019
/research/Light system/main.py
UTF-8
1,075
2.515625
3
[ "MIT" ]
permissive
from math import pi, radians import socket import struct import find_sun import test_light_system as ls VIEWER_ADDR ('172.16.164.208', 43521) class Servo: def __init__(self, pin=18, minval=520, maxval=2240, wincount=8): self.pi = pigpio.pi() self.pin = pin self.minval = minval self.maxval = maxval self.wi...
true
93afda9bec9bfb1d9f72a863c6b422e5d53e0e71
tulibraries/cob_datapipeline
/cob_datapipeline/operators/batch_s3_to_sftp_operator.py
UTF-8
2,711
2.515625
3
[]
no_license
from airflow.providers.amazon.aws.transfers.s3_to_sftp import S3ToSFTPOperator class BatchS3ToSFTPOperator(S3ToSFTPOperator): """ This operator enables the transferring a batch of files from Amazon S3 a SFTP server. It expects a previous task to push the list of files to be transferred to XCOM. :param ...
true
9466bb2efef8115ce01b38e4dd6029d914afa2c4
FAenX/codingame-puzzle
/Python/code-golf/power_of_thor.py
UTF-8
271
2.890625
3
[]
no_license
x,y,j,k=[int(i) for i in raw_input().split()] d={(-1,1):'SW',(0,1):'S',(1,1):'SE',(-1,0):'W',(0,0):None,(1,0):'E',(-1,-1):'NW',(0,-1):'N',(1,-1):'NE'} while j!=x or k!=y: l,m=map(lambda a:(a[0]>a[1])-(a[0]<a[1]),((x,j),(y,k))) j+=l k+=m print d.get((l,m))
true
5d11a0d9fca75096e39df0571cb2746e27dba04e
alexisBoutet/madi
/function.py
UTF-8
3,696
2.6875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Dec 5 13:11:32 2018 @author: 3415104 """ import random from grille import * import numpy as np def gamma(): return 0.9 def alpha(i): return 1/(i+1) def showQ(dungeon, k, t=False): s = [] for j in range(len(dungeon.states)): ...
true
1fed34f3e4bc5b288b05a2736eaedccef09f979d
raktimgg/Probabilistic-Graphical-Model
/HW0/HW0.py
UTF-8
1,262
2.921875
3
[]
no_license
import numpy as np from scipy.ndimage import imread import matplotlib.pyplot as plt def si1(xl,xr,a,b,ds): ################# psi(Xs) sigma = 1 res = np.exp((-1./(2*sigma**2))*(xl[i][j]-xr[i][j+ds])**2) return res def si2(ds,dt): ################## psi(Xs,Xt) gama = 1 delta = 1 res = np.exp((-1./(...
true
650337c4a4f812081e24da29fd23b509551a4660
Aden-Q/LeetCode
/code/1031.Maximum-Sum-of-Two-Non-Overlapping-Subarrays.py
UTF-8
1,143
3.15625
3
[ "MIT" ]
permissive
class Solution: def maxSumTwoNoOverlap(self, nums: List[int], firstLen: int, secondLen: int) -> int: # Two pointers, two run n = len(nums) res = 0 # First prefix sum # prefixSum[i+1] = nums[0] + nums[1] + ... + nums[i] prefixSum = [0] * (n + 1) for i in range(...
true
6aea021da88f212b4a4693109f6f1e8496df9ae6
AgusEchaniz/Juegos
/ahorcadoConFuncionesNuevo.py
UTF-8
2,759
3.84375
4
[]
no_license
import random import time def esperar(tiempo): time.sleep(tiempo) def eleccion(palabras): tema = int(input('Elige un tema:\n 1: animales\n 2: colores\n 3: comidas\n '))#Pido que el jugador elija un tema while(tema>len(palabras)): tema = int(input('Elige un tema:\n 1: animales\n 2: colores\n 3: comidas\...
true
b148a7e48d8ebf4e8d3299332687e1a93d679ffa
Nihal2409/Python-programs
/discard_remove.py
UTF-8
299
3.1875
3
[]
no_license
n = int(input()) s = set(map(int, input().split())) for _ in range(int(input())): name, *num = input().split() if name=='remove': s.remove(int(*num)) elif name=='discard': s.discard(int(*num)) else: s.pop() sum=0 for i in s: sum+=i print(sum)
true
a355023ab2131459b2af66b2c7b524caf2198bba
fruittree/SwitchPhase-Magnitude
/PhaseAndMagnitude.py
UTF-8
2,358
2.859375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Feb 8 19:33:09 2015 @author: bxiao Here is a new comment """ from scipy import misc import matplotlib.pyplot as plt import numpy as np # read in an image using mis. img = misc.imread('cheetah.png',flatten=1) f = np.fft.fft2(img) fshift = np.fft.fftshift(f) # compute magnit...
true
c1f950d330e8e33b8ab80bd7ce4180f0ce577824
Prithu-Nagar/My-Codechef-Solution
/EQUINOX.py
UTF-8
520
3
3
[]
no_license
import sys from sys import stdin try: test=int(input()) for z in range(test): n,a,b=map(int,input().split()) w=0 r=0 for i in range(n): s=input() if(s[0]=='E'or s[0]=='I' or s[0]=='N' or s[0]=='O' or s[0]=='Q' or s[0]=='U' or s[0]=='X'): w+...
true
a7b01e8bceda8b9b48706d594d72909175f81456
zanachka/proxy-service-dashboard
/app/views/dashboard.py
UTF-8
16,437
2.578125
3
[]
no_license
""" Dashboard views - Targets - Proxies - Types - Locations - Providers - Stats """ from flask import Blueprint from flask import render_template from flask import request from flask import url_for from flask import redirect from flask_login import login_required from app import psdash from app.contrib.api import ...
true
3cb82147a1e70c2f04d0f5580cdc4e4635e3df8e
tfpf/PRML_project
/knn.py
UTF-8
3,561
3.203125
3
[]
no_license
import numpy as np import csv import random import math import operator # Load Data Set and Split Function def loadDataset(filename): with open(filename, 'r') as f: lines = csv.reader(f) #for row in lines: # print(lines) Set = [] dataset = list(lines) for x in...
true
b4671a5a8462a29a8ed4ba2fc045e20f42207676
thekrisharmon/Open-Street-Map-SQL-Project
/mapparser.py
UTF-8
831
3.4375
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Your task is to use the iterative parsing to process the map file and find out not only what tags are there, but also how many, to get the feeling on how much of which data you can expect to have in the map. The output should be a dictionary with the tag name as t...
true
c3c85dfd62175962635f942c27532d48c6f4aeff
Alexanderklau/Algorithm
/Everyday_alg/2021/03/2021_03_04/all-nodes-distance-k-in-binary-tree.py
UTF-8
619
3.625
4
[]
no_license
# coding: utf-8 __author__ = "lau.wenbo" """ 给定一个二叉树(具有根结点 root), 一个目标结点 target ,和一个整数值 K 。 返回到目标结点 target 距离为 K 的所有结点的值的列表。 答案可以以任何顺序返回。   示例 1: 输入:root = [3,5,1,6,2,0,8,null,null,7,4], target = 5, K = 2 输出:[7,4,1] 解释: 所求结点为与目标结点(值为 5)距离为 2 的结点, 值分别为 7,4,以及 1 注意,输入的 "root" 和 "target" 实际上是树上的结点。 上面的输入仅仅是对这些对象进行了...
true
de460c5160046307e7d7c8726be2d5866900e283
rahulphysicsmishra/My-Notes
/OOPS/destructors.py
UTF-8
836
4.625
5
[]
no_license
"""Destructors are called when an object gets destroyed. In python, destructors are not needed as much needed in C++ because Python has a garbage collector that handles memory management automatically. Syntax def __del__(self): # body of destructor Note: A reference to objects is also deleted when the object goes...
true
07ae9494f295940a9aea316e8dc043fa5b4511dc
Clark-Chen-Coder/file-of-clark
/test2.py
UTF-8
2,075
3.75
4
[]
no_license
'''a=[1,2,3,4,"hello","世界"]#索引列表形式 print(type(a)) print(a[4]) a[1]='keyon' print(a) print(a[0:5])#切片和逆向切片 a.insert(3,'earth') print(a) del a[2:3] print(a) a.pop(0) print(a) print(len(a))''' '''k={'name':"张三","age":14,"hobby":'打球'} print(k["age"])''' '''a={1,2,3,4,5,'上山打老虎'} b=set([1,2,3,4,...
true
db338a5c3527625ffc6d47b6f7f4e111d4bde47b
xuelang201201/PythonCrashCourse
/08-函数/动手试一试/large_shirts.py
UTF-8
545
4
4
[]
no_license
""" 大号T恤:修改函数 make_shirt(),使其在默认情况下制作一件印有字样 “I love Python” 的大号T恤。调用这个函数来制作如下T恤: 一件印有默认字样的大号T恤、一件印有默认字样的中号T恤和一件印有其他字样的T恤(尺码无关紧要)。 """ def make_shirt(size='large', message='I love Python!'): print("I'm going to make a %s t-shirt." % size) print('It will say, "%s".' % message) make_shirt() make_shirt(size='me...
true
e3bb6d3dd48f7a13dc1b0e7240a9071739d61385
eric-chase/Spring-2019-Research
/dstar_lite/main.py
UTF-8
9,092
3.125
3
[]
no_license
import pygame import random from grid import SquareGrid from dstarlite import DStarLite # Define some colors BLACK = (0, 0, 0) WHITE = (255, 255, 255) GREEN = (0, 255, 0) RED = (255, 0, 0) GRAY = (77, 77, 51) BLUE = (0, 0, 80) # Define a robot color dictionary r_colors = { 0: GREEN, 1: RED, 2: (255, 192, ...
true
8265c18a5344c85d76ca67601d613501cd660841
alessandraburckhalter/Exercises
/ex-07-land-control.py
UTF-8
498
4.90625
5
[ "MIT" ]
permissive
# Task: Make a program that has a function that takes the dimensions of a rectangular land (width and length) and shows the land area. print("--" * 20) print(" LAND CONTROL ") print("--" * 20) # Create a function to calculate the land area def landArea(width, length): times = width * length prin...
true
6334bdd56e541d7b49f7c77280404c4064be4c3e
zkstewart/Various_scripts
/popgen/VCF/filtering/filter_vcf.py
UTF-8
13,912
2.59375
3
[]
no_license
#! python3 # filter_vcf.py # Simple filtration options that aren't easily accessible # through things like vcftools import os, sys, argparse sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))) from Function_packages import ZS_VCFIO # Define functions def val...
true
c79a12bc2b77ee1a9c27781ae2bb39e8940467e1
gdtrice/Reunion
/tools/info_parse.py
UTF-8
406
3.046875
3
[]
no_license
import csv with open('pbhsStudentInfo.csv', 'rU') as csvfile: reader = csv.reader(csvfile, delimiter=',') html = "<table><tr><th>First Name</th><th>Last Name</th><th>Email Address</th></tr>" for row in reader: html = html + "<tr><td>" + row[0] + "</td>" + "<td>" + row[1] + "</td>" + "<td>" + row[2...
true
b08046c188127e42dc3b09ca8c2a7069c4b74358
sourabhk19/CodeFunDo-Disaster-Management-System
/python_code/word_cloud.py
UTF-8
1,439
2.96875
3
[]
no_license
from wordcloud import WordCloud import pandas as pd import numpy as np import re from nltk.stem.porter import PorterStemmer import matplotlib.pyplot as plt def wordcloud(): train = pd.read_csv("E:\\Deep Learning\Azure\\disaster_tweets.csv") train.head() def remove_pattern(input_txt, pattern): ...
true
e14e5616c9b6ee90ce0a2ecce2cd527f76e9963f
yachmeneva/hello-world
/functions.py
UTF-8
1,049
3.453125
3
[]
no_license
#encoding: utf-8 def favorite_book(name): print("One of my favorite book is '" + name.title() + "'.") favorite_book('dracula') def print_ref_info(name, age, passport="no date"): print("\nName is: "+ name) print("Age is: " + str(age)) print("Passport number is: " + passport) print_ref_info("OY", "52", "7698 763425...
true
a51d5d08b758abc0b383bee2bfdcfd6e40a5c769
bernarduwineza/ee245_project1
/phase2/function_planning.py
UTF-8
6,066
3.21875
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D class Node(): """A node class for A* Pathfinding""" def __init__(self, parent=None, position=None): self.parent = parent self.position = position self.g = 0 self.h = 0 self.f = 0...
true