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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
4028d29f14cd52d9f94b9df71d3d27edf0d6a8a3 | Python | LucasLima337/CEV_Python_Exercises | /exercicios/ex102.py | UTF-8 | 951 | 4.75 | 5 | [
"MIT"
] | permissive | # Função para Fatorial
def fatorial(num=1, show=False):
'''
* Função que calcula o fatorial de um número
* Parâmetros:
> num --> número inteiro
> show (opcional) --> valor lógico (True ou False)
** Caso True: Retorna a operação completa
** Caso False (padrão): Reto... | true |
4e0071b68d292f32477a6c3944f94fb9bcfd17ce | Python | 15779235038/mypaper | /jarden_center/main_code/single-multiple-source/baseon_setCover/test/Some_Example/plot3method.py | UTF-8 | 1,326 | 2.578125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
def plotform():
x = range(2, 6)
#facebook
# dynamic_age = [2.3,2.5,4.3,4.7,5.1]
# K_center = [2.5,2.5,2.4,2.6,3.2]
# Our_method=[1.4,1.5,1.8,2.3,2.7]
#GA-Gq
dynamic_age = [1.6,2.7,2.9,3.1,3.7]
K_center = [2.0,2.7,2.7,2.9,3.1]
Ou... | true |
801f1c977c717f084266621a6787eda48e99f56d | Python | HCDigitalScholarship/handwriting | /BidirectionalRNN.py | UTF-8 | 3,777 | 2.953125 | 3 | [] | no_license |
# import TestDataGenerator class from TestData.py
from TestData import TestDataGenerator
import numpy as np
from keras.models import Sequential
from keras.layers import Dense, Input, LSTM, Bidirectional, Reshape, Flatten
from keras import backend as K
from copy import copy
# SETTINGS
##############################... | true |
38b9f2b22cae7744b21731376e328c8ae4477b0c | Python | azikoDron/MultiParsing | /Multiprocessing_Parsing.py | UTF-8 | 1,654 | 2.8125 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import csv
from multiprocessing import Pool
# https://coinmarketcap.com/all/views/all/
import cx_Oracle # sample
def get_html(url):
r = requests.get(url) # return response object
return r.text # return html object
def get_all_links(html... | true |
d8d403932f999f7e1c771c0b9d8d312698c3c6ca | Python | samzer/playground | /machine-learning/support_vector_machine/base.py | UTF-8 | 1,113 | 2.84375 | 3 | [] | no_license | import numpy as np
from cvxopt import matrix as cvxopt_matrix
from cvxopt import solvers as cvxopt_solvers
class SupportVectorMachine:
def __init__(self, C=10):
self.C = 10
self.w = None
self.b = None
def fit(self, X, y):
X = np.array(X)
y = np.array(y)
m,n = ... | true |
faba12f084ab0fd1c809ac62cf668f8efe5b2128 | Python | rokihi/PoseEstimationCNN | /test_with_robot.py | UTF-8 | 4,705 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python
#! -*- coding: utf-8 -*-
import sys
import numpy as np
import tensorflow as tf
import cv2
import tf.transformations as tr
import urx
from urx.robotiq_two_finger_gripper import Robotiq_Two_Finger_Gripper
NUM_CLASSES = 6
IMAGE_SIZE = 28
IMAGE_PIXELS = IMAGE_SIZE * IMAGE_SIZE * 3
sys.path.append("... | true |
2d926871e50c720d6af1eac2e07adad030decb5a | Python | kayshcache/note-taker | /textandfile_handler.py | UTF-8 | 1,491 | 3.484375 | 3 | [] | no_license | import json, os
'''
Written by the team at CSB2019
contains function which takes text and appends it to a file
'''
def file_was_created(filename):
'''
Checks if a file was created.
'''
return os.path.exists(filename)
def file_to_text(filename):
'''
Returns text from a file named `filename`.
... | true |
1aca9ef382b6137e06acefee065f2c3cc9a58e88 | Python | Ermoshka/spam_classification | /dataset.py | UTF-8 | 2,001 | 3.296875 | 3 | [] | no_license | import numpy as np
import re
class Dataset:
def __init__(self, X, y):
self._x = X # сообщения
self._y = y # метки ["spam", "ham"]
self.train = None # кортеж из (X_train, y_train)
self.val = None # кортеж из (X_val, y_val)
self.test = None # кортеж из (X_test, y_test)
... | true |
df41ee6bfab8e4a25584b3e72b3b6d4673962fe7 | Python | bryanras/FBIStats | /plotit.py | UTF-8 | 2,525 | 2.96875 | 3 | [] | no_license |
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import glob
__doc__="""Plotter for UCR crime stats.
Data at
https://www.ucrdatatool.gov/Search/Crime/State/TrendsInOneVar.cfm
"""
default_file = 'violent_total.csv'
summary_columns = set(['ViolentCrimeRate'])
class Plotter:
def __in... | true |
b0d33d4698afa3b67854262fa6d20715e7465c19 | Python | Garinmckayl/arttron | /nft.py | UTF-8 | 2,820 | 2.59375 | 3 | [] | no_license | import os
import pandas as pd
from web3 import Web3
import streamlit as st
import requests, json
st.set_page_config(layout="wide")
st.image(os.path.join('Images','banner.png'), use_column_width = True)
st.markdown("<h1 style='text-align: center; color: white;'>ERC721 API Explorer</h1>", unsafe_allow_html=True)
with ... | true |
c7917217baa51ea8a2e234a63cdc23ced1769139 | Python | parikhkunj/Implementing-Bisecting-K-means-Algorithm- | /src/models/train_model_v2.py | UTF-8 | 6,504 | 2.765625 | 3 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
import scipy.sparse as sp
from numpy.linalg import norm
from collections import Counter, defaultdict
import matplotlib.pyplot as plt
from scipy.sparse import csr_matrix, find
from sklearn.metrics import calinski_harabaz_score
from scipy.spatial.distance import euclidean
from sklea... | true |
7b913740a9b0cb59a138934903d21ab43045a7c1 | Python | robonetphy/Retraniable_GAN-s | /visualization.py | UTF-8 | 753 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 25 02:11:02 2019
@author: DELL
"""
import matplotlib.pyplot as plt
import os
import pickle
G_losses = []
D_losses = []
def loss_load():
if os.path.isfile('loss/G_list.loss') and os.path.isfile('loss/D_list.loss'):
with open("./loss/G_list.loss", "rb") as... | true |
9a265704f6ad4c32552a90bdb788e1f85bb81b22 | Python | czarny25/PayrollProject | /FitPythonProject/PayrollApp/payApp4.py | UTF-8 | 2,916 | 2.921875 | 3 | [] | no_license | '''
Created on 7 Jun 2020
@author: czarn
'''
from fpdf import FPDF
import datetime
import os
employeeName = input();
weekNum = input();
destination = os.getcwd() + "\\EmploeePayslips\\"+ employeeName+"\\"
class payslipPDF(FPDF):
def header(self):
self.set_font('Arial', 'BU', 15)
... | true |
54c95849dbc269e043a577872cb8406e198ceb62 | Python | gomotopia/mggg-tooling | /tools/tiger.py | UTF-8 | 8,734 | 3.140625 | 3 | [] | no_license | """
This module downloads state block group shapefiles from the 2019 Census
for use in that year's ACS.
Examples
--------
This module has two functions that can be used separately.
We can check if a proper 2019 Tiger Shapefile exists and download it
if desired. If we wanted to check simply if a correct file e... | true |
d07261986f136415b6c9a106a18370607323d3c2 | Python | shedoesthewoods/ImageProcessingProject1 | /ip_project1_GUI.py | UTF-8 | 10,096 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Oct 28 18:15:48 2019
@author: Melike Mat
"""
from tkinter import Tk, Menu, filedialog, Canvas, NW, Scrollbar, Frame
from ip_project1_classes import Filter, Exposure, Transform, Morphology
from PIL import Image, ImageTk
glb_img = Image.Image()
class FileOperati... | true |
ea4814de8079249a5574ba4aee1d83726bb868a6 | Python | ps2809/Python-Examples | /class ex.py | UTF-8 | 3,143 | 3.953125 | 4 | [
"MIT"
] | permissive | class example:
schoolname='M.D.Shah' #this is class level or staic variable
''' This is an example of class''' #optional
def __init__(self): #self is ref var for current object
#constructor
example.grade='High School' #definiing static var inside constructor
self.name=input('enter nam... | true |
d253d7be8016ba23a0c6906a182736a68cffc262 | Python | felipesantoss/Curso_Formacao_Cientista_de_Dados_com_R_e_Python | /src/Python/Amostragem_I/amostragem_estratificada.py | UTF-8 | 1,281 | 3.171875 | 3 | [] | no_license | #coding: utf-8
#import Pandas
#pip install pandas
import pandas as pd
#import Sklearn
#pip install -U scikit-learn scipy matplotlib
from sklearn.model_selection import train_test_split
#Import Numpy
import numpy as np
#Lendo o iris.csv
base = pd.read_csv('../../Dados/iris.csv')
#Imprimindo a quantidade de linhas e... | true |
04cac1680a9261d2c9ecb130b46f7aa02544f30b | Python | jothivarshini/A-Z_Pythonpractice | /Dictionaries/test12.py | UTF-8 | 87 | 2.859375 | 3 | [] | no_license | keys=['a', 'b', 'c']
values=[1,2,3]
thisdict = dict(zip(keys,values))
print (thisdict)
| true |
d4b6fae565247521c109b95d885370e0d2a0fe1d | Python | vivekgidmare/python | /file_rename.py | UTF-8 | 540 | 3.046875 | 3 | [] | no_license | import os
def rename_files():
print("called rename files function");
file_directory=os.listdir(r"/Users/vivek/Data/Code/Python/python_scripts/fileRename")
print(file_directory)
current_directory=os.getcwd()
print(current_directory)
os.chdir(r"/Users/vivek/Data/Code/Python/fileRename")
print... | true |
97431baaded19a1a8afc5d20c251757b0afde1c0 | Python | jiwoo0212/ALL-GO | /2. 구현/[이코테]왕실의나이트.py | UTF-8 | 286 | 3.1875 | 3 | [] | no_license | dx = [1, -1, 1, -1, -2, -2, 2, 2]
dy = [-2, -2, 2, 2, 1, -1, 1, -1]
start = input()
x = int(start[1])-1
y = (ord(start[0])-97)
cnt = 0
for i in range(8):
nx = x + dx[i]
ny = y + dy[i]
if nx<0 or nx>7 or ny<0 or ny>7:
continue
else:
cnt += 1
print(cnt) | true |
1c2833a03ece4990ada022105f2c07337f681e39 | Python | Diego-Losada/Interview_Preparation | /Cracking Code Interview Solutions/Ch1_Arrays&Strings/2_Check_Permutation.py | UTF-8 | 1,101 | 3.625 | 4 | [] | no_license | import unittest
#O(n log(n)) Solution
def check_Permutation(s1, s2):
if len(s1) != len(s2) and s1 == s2:
return False
s1, s2 = sorted(s1), sorted(s2)
for i in range (len(s1)):
if(s1[i] != s2[i]):
return False
return True
#O(n^2) Solution
def check_Permutation2(strin... | true |
8581f105a1f365c1967065d216e19f18d6aef2fc | Python | dph119/st_ca | /cache_working_set/src/derive_working_set.py | UTF-8 | 4,051 | 3.0625 | 3 | [] | no_license | #!/usr/bin/python
import sys
import matplotlib
matplotlib.use('agg')
import pylab as plt
#################################
#
# Parse address trace
# and figure out working
# set over time.
# Written to parse the output of
# "pinatrace" Pin tool.
#
#################################
INSTRUCTION_WINDOW = 10000
BLOCK_SI... | true |
60dc30b2a61a30e9adaf0ae68ef73b286934cfb2 | Python | Jehi7/Python-conditionals | /LoanJR.py | UTF-8 | 443 | 4.34375 | 4 | [] | no_license | # Getting the data from the user
value = float(input("Type here the loans value (only the number): "))
installments = float(input("Type here the amount of installments the loan will be divided: "))
salary = float(input("Type here your salary: "))
# Processing data
dividedValue = value/installments
print(dividedValue)... | true |
fa58801db8af03147ce0b5507e4274736ae4e969 | Python | luoxiaojun1992/python-learning | /machine_learning/grad/sqrt.py | UTF-8 | 120 | 3.171875 | 3 | [] | no_license | #!/usr/bin/env python
step = 0.0001
y = 9
x = y
while x ** 2 - y > 0.23:
x = x - step * 2 * x
print x
print x
| true |
99372baacb3425ce323204b995571c4ddcb94f8b | Python | schneefux/gerangel | /matchmake/serializers.py | UTF-8 | 1,962 | 2.6875 | 3 | [] | no_license | import itertools
import math
from rest_framework import serializers
from trueskill import TrueSkill
from matchlog.serializers import PlayerSerializer
def win_probability(env, team1, team2):
'''
@return win probability for team 1
'''
delta_mu = sum(r.mu for r in team1) - sum(r.mu for r in team2)
s... | true |
94f2379c33db5031bd191878a9056fbf3a0991cb | Python | victoriaostankova/Snake | /test.py | UTF-8 | 1,189 | 2.921875 | 3 | [] | no_license | from Snake import Segment, Snake, World, movement_map
from unittest.mock import MagicMock
from tkinter import Canvas
def test_moving_off_the_world():
canvas_mocked = MagicMock(spec=Canvas)
segments = [Segment(1, 0, 1, canvas_mocked)]
snake = Snake(canvas_mocked, segments)
world = World(canvas... | true |
9fbeb3ec59574f7d1f4fafd88de2b6be7d20975c | Python | AnTznimalz/python_prepro | /dec.py | UTF-8 | 386 | 3.703125 | 4 | [] | no_license | """Run Length Decoding"""
def change(word):
"""Func. change for changing number to alphabet"""
text = "" #for keeping alphabets
num = "" #for keeping numbers
for i in word:
if i.isnumeric():
num += i
elif i.isalpha():
text += i
print(int(num)*text, e... | true |
dfcb1b671cb66a89d2127434fa720fbd3c5329b9 | Python | MOOSUNGPARK/source | /PythonClass/DEEP_LEARNING/2.perceptron.py | UTF-8 | 1,094 | 3.59375 | 4 | [] | no_license | import numpy as np
### 가중치 반영 전 ###
def AND(x1, x2):
w1, w2, theta = 0.5, 0.5, 0.7
res = w1*x1 + w2*x2
if res >= theta:
return 1
else:
return 0
x = np.array([0, 1])
w = np.array([0.5, 0.5])
b = -0.7
print('AND',np.sum(w*x) + b)
### 가중치와 편향 반영 후 ###
def AND2(x1, x2):
x = np.array([... | true |
11267f25882dade1bf67f0983fbe82320daab6a2 | Python | Bochkar/domashka | /Kol_vo_simvol.py | UTF-8 | 334 | 4.1875 | 4 | [] | no_license | print('Введите текст:')
str = str(input(': \n'))
print(str)
print('Введите нужный символ: ')
c = input()
s=0
for b in str:
if b==c:
s=s+1
if (s) > 0:
print('количество символов в тексте', (s) ,'раз ')
else:
print('Нет такого символа!')
| true |
f92f5f7d68716d321fb4b2c90c320b82186af7bd | Python | sepidhk/3d_neural_net | /src/manipulators/data_augmenter.py | UTF-8 | 912 | 2.984375 | 3 | [] | no_license | import random
import tensorflow as tf
from scipy import ndimage
@tf.function
def rotate(volume):
"""Rotate the volume by a few degrees"""
def scipy_rotate(volume):
# define some rotation angles
angles = [-20, -10, -5, 5, 10, 20]
# pick angles at random
angle = random.choice(angles)
# rotate volume
volum... | true |
03d210a69ab6decc32b4d442adff1af67f1661b5 | Python | rajesh1804/Detection-of-Phishing-in-Websites | /confusionMatrix.py | UTF-8 | 705 | 2.953125 | 3 | [] | no_license | #rajesh m
import ast
with open('phishing5.txt', 'r') as f:
mylist = ast.literal_eval(f.read())
#print (mylist)
# Python script for confusion matrix creation.
from sklearn.metrics import confusion_matrix
from sklearn.metrics import accuracy_score
from sklearn.metrics import classification_report
wit... | true |
02041dea1be6478b1e0bb6b29766e55b09a539ac | Python | pwithnall/namesworth | /strategies/concatenation.py | UTF-8 | 985 | 3.578125 | 4 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4
import random
"""
Name generation strategy concatenating individual words from the corpus.
"""
class ConcatenationStrategy:
def __init__(self, corpus):
self.corpus = corpus
self.words = []
"""
Train the strategy by spl... | true |
e8c5efe39bee806b49b8dd4d6a0853ae3adafce1 | Python | gabemcarvalho/coursework | /2B/PHYS 270 - Astronomical Observations/phy270_assmt1_parallax_GabrielCarvalho.py | UTF-8 | 5,551 | 3.40625 | 3 | [] | no_license | from numpy import loadtxt, cos, pi, linspace, sqrt
import matplotlib.pyplot as plt
"""
Parallax Curve Fitting Program
by Gabriel Carvalho
2019-05-17
Input: [ Days, RA offset (mas), Dec offset (mas) ]
Output:
- graphs of data with individual components and extrapolated curves
- parallax radius
- proper motion in comp... | true |
f2c15aaaa77025881810482990dbd291a2de162c | Python | juancruzsosa/torchero | /torchero/utils/text/transforms/compose.py | UTF-8 | 2,172 | 2.84375 | 3 | [
"MIT"
] | permissive | import logging
from collections import namedtuple
from itertools import chain
from multiprocessing import Pool
logger = logging.getLogger('compose')
class Compose(object):
""" Composes several transforms for Text togheter
"""
@classmethod
def from_dict(cls, transforms):
return cls(**transforms... | true |
8981a733f5caaf16b05d5e9dc3da800712f72a26 | Python | bkiac/ELTE.computer-networks | /gy7/sender.py | UTF-8 | 681 | 2.5625 | 3 | [] | no_license | import socket
import struct
import sys
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.settimeout(3)
ttl = struct.pack('b', 1) # time to live / "hop count"
sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, ttl)
multicast_group_address = ('224.3.29.71', 10000)
try:
sock.sendto('Hello clie... | true |
e9b5d7bde378b076fcc08e105c78f4ef02a9532d | Python | jmoshfegh/Video-Advertisement-Classification | /NN.py | UTF-8 | 1,888 | 2.75 | 3 | [] | no_license | # NN.py module
import numpy as np
from sklearn.model_selection import cross_validate
from sklearn.model_selection import GridSearchCV
from sklearn.neural_network import MLPRegressor
import kaggle
from sklearn.metrics.scorer import make_scorer
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing i... | true |
306f57f2e9a489e2179a3cf53cf4d03a454ec512 | Python | RMSD/Admiral-at-Bot | /bot_logic/bot_core.py | UTF-8 | 1,244 | 2.921875 | 3 | [
"Apache-2.0"
] | permissive | """
Code Discord bot module.
"""
import discord
import collections
from discord.ext import commands
description = '''An example bot to showcase the discord.ext.commands extension
module.
There are a number of utility commands being showcased here.'''
bot = commands.Bot(command_prefix='?', description=description)
... | true |
aa20d487b3f1360ced91dd46866bf805864218b0 | Python | aminsalmani91/introduction-to-python-programming | /ex2/prog2.py | UTF-8 | 252 | 3.234375 | 3 | [] | no_license | import random
a=int(input("enter a number -> a = "))
b=int(input("enter a number -> b = "))
if a%2==0:
a+=1
d=[]
f=(b-a)/2
while len(d)<=f-1:
i=random.randrange(a,b)
if i%2==0 and i not in d:
d.append(i)
print(d)
| true |
797ff82ebbcff2bb1817bf527a81d1a28e6d7f27 | Python | RyanBae/tf_pyCharm_1 | /bmi_calc/bmi.py | UTF-8 | 568 | 2.921875 | 3 | [] | no_license | class Bmi:
def __init__(self, name, w, h):
self.w = w
self.h = h
self.name = name
def get_bmi(self):
bmi = self.w/((self.h*self.h)/10000)
if bmi >= 40.0:
result = "고도비만"
elif bmi >= 35.0:
result = "중등도비만"
elif bmi >= 30.0:
... | true |
bcecd81c0203fb942f5c856e1c91fd57c98fdbc8 | Python | AusWise/zmpo4-python | /geneticalgorithm/Individual.py | UTF-8 | 590 | 3.390625 | 3 | [] | no_license | class Individual:
def __init__(self, m, v):
self.m = m
self.v = v
self.fitness = None
self.chromosome = []
for i in range(m):
self.chromosome.append(-1)
def __setitem__(self, i, gene):
if(gene>=self.v):
raise AssertionError()
se... | true |
73cfe0b70d8491fb34d26d11afa1d7878cb5508c | Python | Abr1l/Curso-python-eduvolucion | /paises.py | UTF-8 | 1,819 | 4.375 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
''' Cobertura Telefónica
En este proyecto estarán creando un programa que se encargará de controlar la cobertura telefónica de una empresa que provee
servicios de llamadas internacionales.
Para lograrlo, seguirán las siguientes instrucciones:
• Crearán un diccionario que al... | true |
74d3cc15e9495dc3971ef7c4b112311e75f6ee10 | Python | knowingchaos/galaxy | /tools/BMI.IME/ionMP_split.py | UTF-8 | 1,890 | 2.671875 | 3 | [
"CC-BY-2.5",
"AFL-2.1",
"AFL-3.0",
"CC-BY-3.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import sys
import os
inname=sys.argv[1]
outname=sys.argv[2]
f=open(inname,'r')
g1=open(outname+'_1_temp.fastq','w')
g2=open(outname+'_2.fastq','w')
g3=open(outname+'_se.fastq','w')
switch_1 = 0
switch_2 = 0
write_buffer=[]
count = 0
for each in f:
if (count == 0) & ('/1\n' in each) :
switch_1 = 1
... | true |
48e970154449a8e434ce77033c0cca0bc41f6ab3 | Python | BlazejKrzyzanek/TicTacToeRec | /src/board.py | UTF-8 | 2,777 | 2.59375 | 3 | [] | no_license | import cv2
import numpy as np
import skimage as ski
import skimage.morphology as mp
from skimage.filters.rank import mean_bilateral
from scipy import ndimage as ndi
from skimage import io
def show_boards(boards):
for board in boards:
io.imshow(board)
io.show()
def transform_src_pts(src_pts):
... | true |
827ae5a4c8c416e90de7d90a1fc6edf35ddd6322 | Python | Toolanto/handbrowser | /handdetection.py | UTF-8 | 3,122 | 2.796875 | 3 | [] | no_license | import cv
import time
import Image
class HandDetection:
def __init__(self,namew,width=None,height=None):
cv.NamedWindow(namew, 1)
self.capture = cv.CreateCameraCapture(0)
self.width = width
self.height = height
if width is None:
self.width = int(cv.GetCaptureProperty(self.capture, cv.CV_C... | true |
adbf224181cc01e4a38183368954d0be46f5e270 | Python | liautaud/boldr-py | /qir/tuples.py | UTF-8 | 2,008 | 3.25 | 3 | [] | no_license | from . import base
from . import values
class TupleConstr(base.Expression):
"""
A QIR expression representing a tuple constructor.
Note that tuples in the QIR data model are actually just linked lists of
(key, value) pairs, so the implementation of List and Tuple is similar.
This class is abstra... | true |
4793db2f161e4739067fda96dc84aed4455e11c7 | Python | hewaele/leetcode | /搜狗秋招/q3.py | UTF-8 | 756 | 3.5625 | 4 | [] | no_license | """
1 2
3 0 1 2
2 1 3
"""
k, rows = map(int, input().strip().split())
#输入rows行
tree = []
for i in range(rows):
tree.append(list(map(int, input().strip().split())))
#先找到根节点
def find(root):
for index, t in enumerate(tree):
if t[1] == root:
return index
#没有,则不存在叶子结点 返回-1
return -1
#... | true |
083c0698de09486f7e0d61c8cd77fba0edb84e59 | Python | nrajamani3/fMRI-preprocessing-pipelines | /spatialSmooth.py | UTF-8 | 3,751 | 3.03125 | 3 | [] | no_license | #!/usr/bin/python
import nibabel as nib
import numpy as np
from matplotlib import pyplot as plt
import sys
from scipy import ndimage
from scipy.fftpack import fft,ifft
from mpl_toolkits import mplot3d
input_img_path = sys.argv[1]
input_img = nib.load(input_img_path)
input_img_data = input_img.get_data()
fwhm = floa... | true |
926d695dbeed554249509bf59b18fed342a671af | Python | afifilianti/Python-Project---Chapter-7 | /Latihan/latihan 3.py | UTF-8 | 555 | 3.625 | 4 | [] | no_license | #Latihan 3
n = 0
sum = 0
print('--------------------------------------')
print(' *** PROGRAM HITUNG RATA - RATA *** ')
print('--------------------------------------')
while True:
try:
bil = int(input('Masukkan bilangan bulat : '))
n += 1
sum = sum + bil
lagi = input('Lagi (y/n)? ... | true |
bda6b24a159e3dc04938f7153440113b1fb438d1 | Python | will-zegers/Robotics291 | /speedydug_servers/scripts/machine.py | UTF-8 | 18,746 | 2.578125 | 3 | [] | no_license | #! /usr/bin/env python
import roslib
import rospy
# Brings in the SimpleActionClient
import actionlib
# Brings in the messages used by the fibonacci action, including the
# goal message and the result message.
import speedydug_servers.msg
from std_msgs.msg import Int32
import serial
import sys
import thread
import ... | true |
fcd5c5b055f633e61c3f3667b541452419dcb076 | Python | rkwagner/dp109intPython | /pal.py | UTF-8 | 822 | 3.84375 | 4 | [] | no_license | '''
Author: Ryan Wagner
rkwagner@ucsd.edu
http://github.com/rkwagner
Date: August 26, 2014
Description: Given two input integer ranges, determines any palindromes
formed by the multiplication of two integers in those
ranges.
Input: Integer Range 1, Integer range 2
Output: List if valid palindrome combinatio... | true |
0d928f607e9afac4780ac7f354b71d044ffb68d0 | Python | cwayfinder/python_course | /lecture2/6-inspect.py | UTF-8 | 719 | 3.515625 | 4 | [] | no_license | import functools
def inspect(func):
def format_arguments(args, kwargs):
delimiter = ', '
positioned = delimiter.join([str(i) for i in args])
named = delimiter.join([str(kwargs[i]) for i in kwargs])
return delimiter.join([i for i in (positioned, named) if i])
@functools.wraps(f... | true |
f2a724e807d3f1148b73164c8ad227f0f95e7dd2 | Python | kartikadur/infoVizProject | /LDA/test3.py | UTF-8 | 4,362 | 3.046875 | 3 | [] | no_license | # encoding : utf8
import csv
import nltk
from nltk.tokenize import RegexpTokenizer
from nltk.corpus import stopwords
from nltk.stem import PorterStemmer
import re
from gensim import corpora, models
# FileHandling setup
filePath = ['../Data']
fileName = ['goodEatsData.csv']
fileHandler = csv.reader(open('/'.join([file... | true |
ba0508d528e1bb63ade0cd9fa987ec657db16d81 | Python | chalitgubkb/python | /ฝึกทำในหนังสือ/Quiz4/5.py | UTF-8 | 106 | 3.4375 | 3 | [] | no_license | s = []
a = 5
for i in range(a):
n = int(input('Enter Your Num : '))
s.append(n)
print((sum(s))/a)
| true |
08914c721b8e55a96a495f434e0c8033241102b6 | Python | arturgoms/Motomco | /main/arquivos/curvasHandler.py | UTF-8 | 14,339 | 2.90625 | 3 | [] | no_license | import configparser
import logging
logger = logging.getLogger('log')
# Diretorio dos arquivos
curvaDir = 'main/arquivos/curva.txt'
topDir = 'main/arquivos/top.txt'
confDir = 'main/conf.ini'
def file_len(fname): #Conta o numero de linhas no arquivo
with open(fname) as f:
for i, l in enumerate(f):
... | true |
404f099a326b09d6e52ba6fd9c66203d1b615b76 | Python | RaamRaam/bayes_nn | /bayes_nn/mc_methods.py | UTF-8 | 4,632 | 2.625 | 3 | [
"MIT"
] | permissive | import time
import torch
from torch.autograd import Variable
from os.path import join
import os
from bayes_nn.util.util import calc_risk, to_tensor, maybe_make_dir
from bayes_nn.training import test
from bayes_nn.model.model_definition import Net
from bayes_nn import conf
from bayes_nn.util.mutilation import * # Impo... | true |
92bd6abb5a8bea9c59a3b74324d4968c1e426c13 | Python | raulsanika015/python | /formattedprint.py | UTF-8 | 99 | 3.796875 | 4 | [] | no_license | s=input("Enter name:")
age=int(input("Enter age:"))
print("Welcome %s, Your age is %d"%(s,age))
| true |
7b6179586b9ec13d7ea32748dba4cb38784e3c12 | Python | servers09/python-basics | /basic_operators.py | UTF-8 | 775 | 3.546875 | 4 | [] | no_license | def int_Add(x,y):
result = x+y
return result
def int_Sub(x,y):
result = x-y
return result
def int_Multiply(x,y):
result = x*y
return result
def int_Divide(x,y):
result = x/y
return result
def int_Floor(x,y):
result = x//y
return result
def int_Exponent(x,y):
result = x**y
return result
def int_Modulo(... | true |
5c22d99fd6ac004704b9d11470bfaaba2c429add | Python | Mohammed414/LuayTheDuck | /app.py | UTF-8 | 2,881 | 2.625 | 3 | [] | no_license | import os
import mysql.connector
from flask import Flask, render_template, request, url_for, flash, redirect
from werkzeug.utils import secure_filename
UPLOAD_FOLDER = 'static\images'
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg'}
# Configure application
app = Flask(__name__)
# Ensure templates are auto-reloaded
app.co... | true |
916da07e3aa58aa711b49cc1befe195ddbf84143 | Python | JCohner/rrt_algo | /rrt.py | UTF-8 | 5,173 | 3 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import math
import pdb
from pprint import pprint
import os
import obstacle
NODE = 0
CHILD_LIST = 1
PARENT = 2
#plt.ion() #enable this during debugging to see real time
class rrt():
def __init__(self):
fig, self.ax = plt.subplots()
plt.plot()
plt.xlim((0,100... | true |
65f3f0ba68dfc638ddc91487bb5dd7a657c715ff | Python | baxterdemers/CS4300_Flask_template | /init_db.py | UTF-8 | 3,554 | 2.671875 | 3 | [] | no_license | import json
import requests
import psycopg2
import nltk
from collections import defaultdict
from nltk.corpus import stopwords
import pickle
import parser
hostname = '35.236.208.84'
username = 'postgres'
password = 'dnmSWIMS!'
database = 'postgres'
doc_id = 1
pageSize = 100
pages = 5
good_types_II = defaultdict(list)... | true |
c3c86b4440f67ee262e66495de4cf99a8fff691a | Python | jessicariccial/Hangaroo_Game1 | /1P4.py | UTF-8 | 1,371 | 4.5 | 4 | [] | no_license | def Hangaroo(secretWord):
print('WELCOME TO HANGAROO!')
print('I know a word that is', len(secretWord), "letters long. Can you find out what is it?")
mistakesMade = 0
lettersGuessed = []
while 8 - mistakesMade > 0:
if isWordGuessed(secretWord, lettersGuessed) == True:
... | true |
2106abeccafeee1c42d5a0c44531648bd334c92b | Python | gargarpan/database | /db q5.py | UTF-8 | 891 | 2.875 | 3 | [] | no_license | import pymysql as pm
try:
con = pm.connect(host='localhost', database='acadviewdb',\
user='root', password='root')
cursor = con.cursor()
query = 'create table authortitle(authortitleid int(5) primary key, \
authorid int(10), titleid int(4)'
cursor.exec... | true |
35ed9c3baf43851e7df245767bf6e011c70689e5 | Python | hp396/Leetcode | /Python Solutions/35 Search Insert Position/35 Search Insert Position.py | UTF-8 | 275 | 3.046875 | 3 | [] | no_license | class Solution:
def searchInsert(self, nums: List[int], target: int) -> int:
for num in nums:
if num == target:
return nums.index(num)
elif num > target:
return nums.index(num)
return int(len(nums))
| true |
6715f4bada445b2043a393954b1de8aebb07e4ef | Python | arynas/sentiment | /data/vlsp2018/preprocess.py | UTF-8 | 2,961 | 2.546875 | 3 | [] | no_license | from os.path import dirname, join
import re
from languageflow.util.file_io import read
import pandas as pd
import re
def transform(s):
sentence = {}
sentence["text"] = s.split("\n")[1]
sentiments = s.split("\n")[2]
sentiments_ = re.split("}, +{", sentiments)
sentiments__ = [re.sub(r"[{}]", "", ite... | true |
b88afe45eb481bba4992354f1fe38913debbf348 | Python | Nephalen/ECE542_project4 | /part1/src/assign.py | UTF-8 | 6,201 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: assgin.py
# Author: Qian Ge <geqian1001@gmail.com>
import numpy as np
def assign_weight_count_all_0_case_1(cell, in_dim, out_dim):
""" Parameters for counting all the '0' in the squence
Input node only receives digit '0' and all the gates are
always o... | true |
83680a2ff5fef16abb5723f79153ed3fe960c435 | Python | ulat/udacity_intro_to_machine_learning | /svm/svm_author_id.py | UTF-8 | 1,779 | 3.234375 | 3 | [] | no_license | #!/usr/bin/python
"""
This is the code to accompany the Lesson 2 (SVM) mini-project.
Use a SVM to identify emails from the Enron corpus by their authors:
Sara has label 0
Chris has label 1
"""
import sys
from sklearn.metrics import precision_recall_fscore_support, accuracy_score
sys.path.append("../t... | true |
662b5944cab3123ddc86bded7163398881498624 | Python | sissixu00/2017A2CS | /Cha 27/27.07.py | UTF-8 | 2,480 | 2.875 | 3 | [] | no_license | # Sissi Xu S3C2
import datetime
class TBorrower:
def __init__(self, n, e, i):
self.__BorrowerName = n
self.__EmailAddress = e
self.__BorrowerID = i
self.__ItemsOnLoan = 0
def getBorrowerName(self):
return(self.__BorrowerName)
def getEmailAddress(self):
return... | true |
21a753f7618ea727e86ec00876de2eaefafe04ad | Python | mrgrit/ml_from_scratch | /1_86_nn_basic.py | UTF-8 | 2,749 | 3.234375 | 3 | [] | no_license | import numpy as np
def sigmoid(x):
# np.exp : just used for matrix input
return 1/(1+np.exp(-x))
def relu(x):
return np.maximum(0,x)
def identity_function(x):
return x
def test(test_no):
if test_no == 1:
# implement neural network
x = np.array([1.0,0.5])
w1 = np.array([... | true |
dc488732e361059eb5e8d5afbe344302d677bc08 | Python | ocipap/algorithm | /baekjoon/1978.py | UTF-8 | 305 | 3.171875 | 3 | [] | no_license | arr = [2]
count = 0
for i in range(3, 1001):
flag = True
for el in arr:
if i % el == 0 :
flag = False
break
if flag :
arr.append(i)
num = int(input())
nums = map(int, input().split())
for el in nums :
if el in arr :
count += 1
print(count) | true |
bba870361e66e913a6fe26a2c08cac6923dc9f05 | Python | richnakasato/fc | /3.rotate_linear_array.0.py | UTF-8 | 327 | 3.390625 | 3 | [] | no_license | def rotate_left(list_numbers, k):
if not len(list_numbers):
return list_numbers
for times in range(k):
temp = list_numbers[0]
for idx in range(1, len(list_numbers)):
list_numbers[idx - 1] = list_numbers[idx]
list_numbers[len(list_numbers) - 1] = temp
return list_n... | true |
6b933f5890ba8549c967aa7e3bc4e1f336a2f7ba | Python | JohnTheodore/city_comparison | /merging_code/normalize_elections.py | UTF-8 | 4,139 | 3.0625 | 3 | [] | no_license | #!/usr/bin/env python3
"""Normalize 2020 elections data.
Source: https://github.com/kjhealy/us_elections_2020_csv/
id: Variable length character. Codes are as follows:
For President, Governor, and Senate Races. ONE OF:
(a) "0", if the row refers to results for a whole state. Identify states
using fips_cha... | true |
8d81f5e6b68f92450e319d99bf723c3bee0842ff | Python | hyperledger/aries-cloudagent-python | /aries_cloudagent/messaging/base_handler.py | UTF-8 | 782 | 2.53125 | 3 | [
"LicenseRef-scancode-dco-1.1",
"Apache-2.0"
] | permissive | """A Base handler class for all message handlers."""
from abc import ABC, abstractmethod
import logging
from ..core.error import BaseError
from .responder import BaseResponder
from .request_context import RequestContext
class HandlerException(BaseError):
"""Exception base class for generic handler errors."""
... | true |
fc1933ef30b8ae9a2b86825c80236977b1c8e760 | Python | staguchi0703/prob_boot_camp_difficult | /ARC080D/resolve.py | UTF-8 | 512 | 2.765625 | 3 | [
"MIT"
] | permissive | def resolve():
'''
code here
'''
H, W = [int(item) for item in input().split()]
N = int(input())
As = [int(item) for item in input().split()]
line = []
for i, val in enumerate(As):
line += val * [i+1]
grid = [[] for _ in range(H)]
for i in range(H):
if i % 2 ==... | true |
a2194774844e36b16bc1001e068776569265c9ec | Python | macknilan/Cuaderno | /Python/ejemplos_ejercicios/funcion_decoradora.py | UTF-8 | 532 | 3.96875 | 4 | [] | no_license | """
Ejemplo de una función que actua como decorador
"""
def funcion_decoradora(funcion_pararametro):
"""Función que actua como decorador"""
def funcion_anterior():
# ACCIONES ADICIONALES QUE DECORAN
print("Se va a realizar un calculo")
funcion_pararametro()
# ACCIONES ADICION... | true |
16db95d5e107f214a44d55334bd425485cb18927 | Python | LucyWang2014/2016Spring_BigData_FinalProject | /MapReduce/TipByDayPassengerCountWeather/reduce.py | UTF-8 | 2,013 | 2.75 | 3 | [] | no_license | #!/usr/bin/python
import sys
import collections
total_condition = collections.Counter()
for line in sys.stdin:
day_payment_passCount, values = line.strip().split('\t', 1)
day, payment_type, passenger_count = day_payment_passCount.strip().split('|',2)
count, revenue, tip_amount, tip_percent, weekday,... | true |
aaa82f24d56bdeb2025db704156436b06a718b81 | Python | DinaShaim/Python_basics | /HomeWork_2/les_2_task_3.py | UTF-8 | 906 | 4.25 | 4 | [] | no_license | # Пользователь вводит месяц в виде целого числа от 1 до 12. Сообщить к какому времени года
# относится месяц (зима, весна, лето, осень). Напишите решения через list и через dict.
print('Введите месяц в виде целого числа от 1 до 12')
number = int(input())
seasons_dict = {'зима': (1, 2, 12),
'вес... | true |
fbbd343a70adfc3422bba91c2bc9eb03e9f04cdd | Python | dixitk13/python-scripts | /MVC/webapp/cgi-bin/athlelist.py | UTF-8 | 3,611 | 3.140625 | 3 | [] | no_license | __author__ = 'Dixit_Patel'
NAME = "NAME"
DOB = "DOB"
LSTTIME = "LSTTIME"
class AthleteList(list):
def __init__(self, a_name = "", a_dob = "", a_times = []):
list.__init__([])
self.name = a_name
self.dob = a_dob
self.times = a_times
self.extend(a_times)
@property
d... | true |
156108dc07b2f8f07e66ed5e3691ab03e563dce7 | Python | andrebmds/Kaggle | /main.py | UTF-8 | 1,118 | 2.59375 | 3 | [] | no_license | import pandas as pd
from sklearn.svm import LinearSVC
from sklearn.datasets import make_classification
import pickle
import numpy as np
choiseTrain = False
testArry = False
if choiseTrain:
train = pd.read_csv('train.csv')
print(train.head())
X = train.drop(['label'],axis=1)
y = train['label']
print('1')
clf = L... | true |
b5ac85d5e16d9b507852f6c312123224e90e2d30 | Python | bhup99/shiny-octo-bear | /Python Programs/ass01/jolly_jumper.py | UTF-8 | 842 | 4 | 4 | [] | no_license | # A sequence of n > 0 integers is called a jolly jumper if the
# absolute values of the differences between successive elements take
# on all possible values 1 through n - 1. For instance, 1 4 2 3 is a
# jolly jumper, because the absolute differences are 3, 2, and 1,
# respectively. The definition implies that any sequ... | true |
32473ce4b860ef70b8f2dbe13ea545b7fc7983f9 | Python | caront/face_expression | /sources/utils/face.py | UTF-8 | 648 | 2.640625 | 3 | [] | no_license | import cv2
import os
class FaceDetection():
__instance = None
@staticmethod
def getInstance():
if FaceDetection.__instance == None:
FaceDetection()
return FaceDetection.__instance
def __init__(self):
# if FaceDetection.__instance != None:
# raise Except... | true |
625d126281e3d1c2419744620ed8ee780ee13f01 | Python | zuigehulu/AID1811 | /pyNet/day03/code/http_server1.py | UTF-8 | 907 | 2.84375 | 3 | [] | no_license | from socket import *
def http_data(conn):
data = conn.recv(4096).decode()
http_head = data.splitlines()
for x in http_head:
print(x)
# http_fanhui ='''HTTP/1.1 200 OK
# <h1>hello word </h1>
# <p>python</p>
# '''
try:
f = open('index1.html')
except IOError:
h... | true |
e31b449f972a36b3cde4cb99530b3fedc2080122 | Python | abhiiitcse/HackerRank | /worldCodeSprint11/simpleFileCmd.py | UTF-8 | 2,311 | 2.953125 | 3 | [] | no_license | #!/usr/bin/python
trie = dict()
def createFile(filename):
ls = list(filename)
new_dict = trie
ret_val = filename
for j in range(len(ls)):
if ls[j] in new_dict:
new_dict = new_dict[ls[j]]
if j==len(ls)-1:
new_name = new_dict['next']
if new_... | true |
b1b4cd7d8bd51b5b7c0a2c16874cd3a420e9b334 | Python | dy27/mtrx5700-blackjack-robot | /blackjack_dealer_robot/scripts/main_game.py | UTF-8 | 591 | 2.609375 | 3 | [] | no_license | """
MTRX5700 - Experimental Robotics
Major Project - Blackjack Robot
Year: 2021
Group 5 - Curry Shop
File:
Info:
.
"""
# Imports
from blackjack_classes.BlackjackDeck import BlackjackDeck
from blackjack_classes.BlackjackGame import BlackjackGame
from blackjack_classes.BlackjackPlayer import BlackjackPlayer
from blackj... | true |
dc5c4d761b03e2cf91777703c6c130026cae0eec | Python | ehdgua01/Algorithms | /data_structures/hash_table/linked_list_hash_table.py | UTF-8 | 1,216 | 3.703125 | 4 | [] | no_license | class Node(object):
def __init__(self, key, value) -> None:
self.next = None
self.key = key
self.value = value
class LinkedListHashTable(object):
def __init__(self, initial_size: int) -> None:
self._size = initial_size
self._data = [Node(None, None)] * self._size
d... | true |
7ab98282a5ca91d6777653f75899b86cb56eb292 | Python | python101ldn/exercises | /Session_4/4b_input_solution.py | UTF-8 | 365 | 4.46875 | 4 | [] | no_license | # Get the below code to run in a while loop until the user enters 'EXIT'
# users_name = input('What is your name? ')
# print('Hello, ' + users_name + '!')
loop = True
while loop:
users_name = input('What is your name? ')
if users_name.upper() != 'EXIT':
print('Hello, ' + users_name + '!')
else:
... | true |
c9611c5024b6b291702bfa986a857e6a8984118a | Python | p3ll1n0r3/palindrome | /palindrome.py | UTF-8 | 1,670 | 4.15625 | 4 | [] | no_license | #!/usr/bin/env python
# palindrome.py - takes any number serie : start_num and end_number and with a maximum of iterations
# for every number, add itself and it's reverse until it reach a palindrome.
# it runs until the max_iter value has been reached.
# some numbers doe... | true |
dc2df771f2d17418fe2c919668cd044fec4d18d4 | Python | nmliedtke/CS534_ArtificialIntelligence | /HW1/Question2.py | UTF-8 | 6,274 | 2.921875 | 3 | [] | no_license | performanceMeasure = [0,0,0,0,0,0,0,0]
expectedPerformance = -999
#first array is location, clean/dirty for sqaure A and second array is square B
percept = ["null", "null"]
environmentState = ["null", "null"]
def resetAgent():
expectedPerformance = -999
environmentState = ["null", "null"]
def initialPercept(e... | true |
357afea4406fea52eb25498e24d7d6593146502b | Python | Yanl05/LeetCode | /forty-eight.py | UTF-8 | 1,311 | 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.
"""
self.diag = len(matrix[0])
# step 1:
for i in range(self.diag):
for j in range(i, self.diag):
... | true |
22c8024834b488a7649273f4dd212c11e2cd893f | Python | Insper/robot21.1 | /ros/exemplos211/scripts/follower_p.py | UTF-8 | 4,045 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
# exemplo adaptado do livro:
#
# Programming Robots with ROS.
# A Practical Introduction to the Robot Operating System
# Example 12-5. follower_p.py pag265
#
# Referendia PD:https://github.com/martinohanlon/RobotPID/blob/master/mock/mock_robot_pd.py
import ro... | true |
b6a63b9018929bd6966f7e9ced2bc2d0d4f4258f | Python | ludi1001/ContestCode | /InterviewStreet/billboards2.py | UTF-8 | 2,645 | 3.765625 | 4 | [] | no_license | """
Billboards(20 points)
ADZEN is a very popular advertising firm in your city. In every road you can see their advertising billboards. Recently they are facing a serious challenge , MG Road the most used and beautiful road in your city has been almost filled by the billboards and this is having a negative effect on ... | true |
6530074e9db7b07dee9d01166c79371df4cf6628 | Python | makeevrserg/Notificator | /server/data.py | UTF-8 | 1,187 | 2.765625 | 3 | [] | no_license | from yaml import load, dump
from yaml import CLoader as Loader, CDumper as Dumper
import os
#Все конфиги из config.yml
global config
#Сохранение файла
def saveConfig():
global config
with open('config.yml', 'w') as file:
dump(config,file)
#Создание файла если его нет
def create_file():
with open('... | true |
886f24879f680f7532392d8683241f8df0299b2f | Python | MichiganLabs/flask-pbkdf2 | /test_pbkdf2.py | UTF-8 | 827 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python
import pytest
import flask
from flask_pbkdf2 import Pbkdf2
@pytest.fixture
def pbkdf2():
app = flask.Flask(__name__)
app.config['ITERATIONS'] = 1000
pbkdf2 = Pbkdf2(app)
return pbkdf2
class TestPbkdf2:
def test_check_password(self, pbkdf2):
encoded = 'pbkdf2_sha256... | true |
72dddd0c62d31cb5ed929475d3c02bd009257068 | Python | rehe2013/PHPTravel | /testcases/TestCreateCustomerPage.py | UTF-8 | 4,692 | 2.703125 | 3 | [] | no_license | import unittest
from selenium import webdriver
from page_objects import LoginPage
from page_objects import AdminDashboardPage
from page_objects import CreateCustomerPage
class TestCreateCustomerPage(unittest.TestCase):
def setUp(self):
base_url = 'http://phptravels.net/'
admin_url ="admin"
... | true |
0008b3567dbb4301c230efa7e9ac2050a368f4c8 | Python | merc-devel/merc | /merc/capability.py | UTF-8 | 308 | 2.6875 | 3 | [
"MIT"
] | permissive | class Capability(object):
def __init__(self, user):
self.user = user
def get(self):
return self.NAME in self.user.capabilities
def set(self):
self.user.capabilities.add(self.NAME)
def unset(self):
try:
self.user.capabilities.remove(self.NAME)
except KeyError:
pass
| true |
a3f2ee3993e0cd3353636b9b5b22369dde728c10 | Python | AdrianoLM/TrashProjectPygame | /Menu_teste.py | UTF-8 | 2,512 | 3.296875 | 3 | [] | no_license | import pygame
import time
import random
pygame.init()
x=800
y=600
size = (x, y)
screen = pygame.display.set_mode(size)
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
GREEN = (0, 255, 0)
RED = (255, 0, 0)
pygame.display.set_caption("Restoring The World")
clock = pygame.time.Clock()
#Background Image... | true |
d90eb164bcafa6accafc580973b83b6bc516e7b6 | Python | LandReagan/Grafcet | /src/grafcet_error.py | UTF-8 | 252 | 2.5625 | 3 | [] | no_license | from logger import logE
class GrafcetError(Exception):
def __init__(self, message):
assert isinstance(message, str)
logE(message)
self._message = message
@property
def message(self):
return self._message
| true |
c28c0eb9d1f220438041d3c8fc65568dc74bab84 | Python | nearestneighbour/apiwallet | /app/accounts/eos_account.py | UTF-8 | 3,777 | 2.609375 | 3 | [
"MIT"
] | permissive | import requests
from time import sleep
from .. import Account, Updatable
corebalances = ['EOS','liquid','staked_CPU','staked_NET','delegated','refunding']
class eos_account(Account):
def __init__(self, **kwargs):
# kwargs: account (required)
self.account = kwargs.pop('account')
super().__... | true |
bdb7d820d0186174ea84cad8655152e48b645416 | Python | Htermotto/advent_of_code_2020 | /day9/solution.py | UTF-8 | 843 | 3.203125 | 3 | [] | no_license | from collections import deque
lines = [int(l.strip()) for l in open('input.txt')]
def exists_sum(dq, r):
s = set(dq)
for n in s:
if r - n in s:
return True
return False
# ----------- PART 1 -------------
dq = deque(lines[:25])
for num in lines[25:]:
if not exists_sum(dq, num):
... | true |
4447f2a673d6c409175bd14538ee4d09a0cf508f | Python | BDague/nslookup-service | /nslookup.py | UTF-8 | 768 | 3.140625 | 3 | [] | no_license | import dns.resolver
def nameserverlookup(domain_name):
"""Runs nslookup for domain_name
:domain_name: Give a hostname, as a string
:returns: information about as domain, as dict
"""
domain_info = {}
resolver = dns.resolver.Resolver()
domain_info['nameservers'] = ",".join(resolver.nam... | true |
bd77dba8f869a8f57e6518a62d422331ed8e672c | Python | okomarov/aoc | /2019/day20.py | UTF-8 | 3,099 | 3.03125 | 3 | [
"MIT"
] | permissive | import sys
from collections import deque
from collections import namedtuple
with open('data/day20.txt') as f:
data = f.read().splitlines()
DR = [-1,0,1,0]
DC = [0,1,0,-1]
R = len(data)
C = len(data[0])
def in_bounds(r, c):
return 0 <= r < R and 0 <= c < C
def get_portals():
portals = {}
for r in ra... | true |