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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
cad85b882653adfdaf47a087e80b1e3203d9b877 | Python | a-rydzak/codingProjects | /Python Using Django With User Login/apps/Belt_2_app/models.py | UTF-8 | 4,486 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
from time import gmtime, strftime
from datetime import date
from django.db import models
from django import forms
import datetime
import re
import bcrypt
# MIGRATION STEPS
# python manage.py makemigrations
# python manage.py mig... | true |
7c0d34c5e61edb93b1c3a88d3ae2365396120dd8 | Python | nepomnyashchii/TestGit | /old/old08092019/pandas/017.py | UTF-8 | 280 | 3.140625 | 3 | [] | no_license | import pandas as pd
df = pd.read_csv('zillow.csv', index_col=0, skipinitialspace=True)
# print(type(df))
"""to read the data for the columns we need to skip initialspace"""
"""This way is to get a number"""
data = df[(df['Beds'] == 3) | (df['Baths'] == 4)].head()
print(data) | true |
eebd0d50ab6219a782f86a96d5703eefb2f46573 | Python | scottkeller/driverreport | /driverreport-pkg/driverreport/core/driver.py | UTF-8 | 1,859 | 4 | 4 | [] | no_license | """
MODULE: core.driver
DESCRIPTION: Creates and stores driver information and any related trips and statistics
CLASSES:
Driver
"""
from .trip import Trip
class Driver(object):
"""
Driver object to store name and trip information
PROPERTIES:
name
trips
total_distance
tot... | true |
130f38b1728ed80163a46272c4e6fd8834ac8539 | Python | ThomyRa/MisionTic2022 | /semana3/taller2/taller2.py | UTF-8 | 3,010 | 4.28125 | 4 | [] | no_license | """ Programa calculadora artimética super amigable#
Realiza las 4 operaciones (+,-,* /)
dada como entrada una cadena de caracteres
incorpora al modulo calculadora_aritmetica.py
Thomas Ramirez Rozo
Mayo 3-2021 """
# ---------------- Zona librerias------------
import calculadora_aritmetica as calc
#... | true |
29cb00870cf18cd7578958e97b62b38cf32de292 | Python | raquel-github/ivd | /seq2seq/Models/DecoderAttn.py | UTF-8 | 2,267 | 2.609375 | 3 | [] | no_license | import torch
import torch.autograd as autograd
import torch.nn as nn
import torch.nn.functional as F
use_cuda = torch.cuda.is_available()
class DecoderAttn(nn.Module):
def __init__(self, hidden_encoder_dim, hidden_decoder_dim, vocab_size, word_embedding_dim, max_length):
"""
Parameters
hi... | true |
7e93e891de7467ce8686b524a4c259390c4185d6 | Python | Vincenttainan/drawing | /draw3.py | UTF-8 | 394 | 3.828125 | 4 | [] | no_license | import turtle
from itertools import cycle
color=cycle(['red','orange','yellow','green','light blue','blue','purple'])
def draw_circle(size,angle,shift):
turtle.pencolor(next (color))
turtle.circle(size)
turtle.right(angle)
turtle.forward(shift)
draw_circle(size+1,shift+1,angle+1)
turtle.bgcolo... | true |
6aad0ce846790cf50edd09a47972c15dcd33f6b5 | Python | ryanreadbooks/Npnn | /datasets/base.py | UTF-8 | 3,450 | 3.15625 | 3 | [] | no_license | from os.path import dirname
import csv
import numpy as np
import pickle
class DataCollector:
r"""
Data Collector
Attributes:
data: data itself(numpy array)
feature_name:
target:
target_name:
"""
def __init__(self, **kwargs):
self.data = None
self.feature_name = None
self.target = None
self.t... | true |
019c7268a5d825870cc2dcdc5c01cd280608a914 | Python | Rabona17/Data_Structure_and_Algorithm | /Stack_and_Queue_Python/Queue.py | UTF-8 | 5,441 | 3.65625 | 4 | [] | no_license | import numpy as np
class Queue:
"""
A queue, dequeues from front and enqueues at rear
>>> a=Queue()
>>> a.enqueue(1)
>>> a.enqueue(2)
>>> a.enqueue(3)
>>> a.enqueue(4)
>>> a.enqueue(5)
>>> a.front
0
>>> a.rear
5
>>> a.data
array([1, 2, 3, 4, 5, None], dtype=objec... | true |
5f34114a88ebc55d29ae8a081ff1974ad233df28 | Python | LouisPython217/vkbottle | /vkbottle/framework/framework/branch/dict_branch.py | UTF-8 | 4,453 | 2.5625 | 3 | [
"GPL-3.0-only",
"MIT"
] | permissive | import typing, asyncio
import inspect
from .cls import CoroutineBranch, AbstractBranch
from .abc import AbstractBranchGenerator, GeneratorType
from .standart_branch import ImmutableBranchData
from vkbottle.utils.exceptions import BranchError
class DictBranch(AbstractBranchGenerator):
def __init__(self):
... | true |
e9fda65e528514cb749251379b6731c4150d7f36 | Python | made-ml-in-prod-2021/mikhail.gashkov | /ml_project/maincode/run.py | UTF-8 | 2,937 | 2.515625 | 3 | [
"MIT"
] | permissive | import logging
from pathlib import Path
import numpy as np
import pandas as pd
import typer
from sklearn.model_selection import train_test_split
from .load_config import (
DATA_CONFIG_FILE,
PREDICT_CONFIG_FILE,
TRAIN_CONFIG_FILE,
load_config,
)
from .model_pipeline.classifier import Classifier
from .m... | true |
918bbfb7fdc053117aacac31c78e3ab8148692ce | Python | davidliii/Sound-Sample-Classifier-AI | /Notebooks/plot_manage.py | UTF-8 | 3,792 | 2.765625 | 3 | [] | no_license | from feature_extraction import *
from file_manage import *
from tqdm import tqdm
import matplotlib.pyplot as plt
def plotFeatures(featureObjs):
numCols = len(featureObjs) # show these along the horizontal (columns)
numRows = 4 # Time domain, FFT, frequency banks, MFCC
fig, ax = plt.subplots(nrows=numRows,... | true |
beb5450331552523556ae15d22c27edc4bc196f6 | Python | mayank05942/Graphs | /Basics/DFS using Adjacency Matrix.py | UTF-8 | 1,779 | 3.8125 | 4 | [] | no_license | # Concept: https://www.youtube.com/watch?v=0XYSdIVY6Ks
# https://www.youtube.com/watch?v=3kkiRfMWBIc&list=PLpO3gASfJEIJ6cYs4kAY3SnH2kpohSTZI&index=5&t=0s
# In DFS once we start exploring an vertex we keep exploring it until we cannot got further
# once we cannot go further using visited array we backtrack an... | true |
56143675cd8b35dcd6f721a498d56867bab92037 | Python | seanhu24/python101 | /csv/csv_dict_reader.py | UTF-8 | 340 | 3.234375 | 3 | [] | no_license | import csv
def csv_dict_reader(file_obj):
"""
read a csv file as dict
:param file_obj:
:return:
"""
reader=csv.DictReader(file_obj, delimiter=",")
for line in reader:
print(line['first_name'],line['last_name'])
if __name__=="__main__":
with open('data.csv') as csv_f:
cs... | true |
83d3b857939649ed7cb1b12d87cef3a63eaeb39d | Python | devilhtc/leetcode-solutions | /0x0329_809.Expressive_Words/solution.py | UTF-8 | 973 | 3.453125 | 3 | [] | no_license | class Solution(object):
def expressiveWords(self, S, words):
"""
:type S: str
:type words: List[str]
:rtype: int
"""
sig = self.gensig(S)
out = 0
for w in words:
if self.isstretchy(self.gensig(w), sig):
out += 1
retu... | true |
278ba165da1bd432ef635ea93e07d52ac48faae7 | Python | andrehmiguel/treinamento | /exercicioLista03/ex15.py | UTF-8 | 426 | 4.46875 | 4 | [] | no_license | #15. Faça um programa que peça 10 números inteiros, calcule e mostre a quantidade de
# números pares e a quantidade de números ímpares.
lista = []
for x in range(1,11):
lista.append(int(input(f'Insira o número {x}: ')))
par = 0
impar = 0
for x in lista:
if x % 2 == 0:
par = par + 1
else:
... | true |
d85b6749b6b0a77915966b27ea854f62af453f53 | Python | gbmhunter/blog | /content/programming/languages/python/pandas/main.py | UTF-8 | 1,262 | 3.71875 | 4 | [] | no_license | import pandas as pd
# The DataFrame
df = pd.DataFrame({
'Name': [ 'John', 'Geoff', 'Brett' ],
'Age': [ 45, 23, 30 ],
'Height': [ 1.23, 4.56, 7.89 ],
})
print(df)
# Name Age Height
# 0 John 45 1.23
# 1 Geoff 23 4.56
# 2 Brett 30 7.89
print(df[['Name', 'Height']])
# Name Height
# 0... | true |
4943dfc5d4fe5899e3a94d81c668731327a9c763 | Python | prabhus489/Practice-Python_Basics | /Boolean/Boolean_logic.py | UTF-8 | 152 | 2.6875 | 3 | [] | no_license | username = "prabhu"
password = "admin"
if username == "ADMIN" or password == "admin":
print("valid user")
else:
print("Invalid user")
| true |
05cf4b3d0187d40283e8422e8b4b85b96ab50a53 | Python | 1MT3J45/pyprog | /marks1.py | UTF-8 | 191 | 3.375 | 3 | [] | no_license | data = open("marks.txt")
rows = data.readlines()
top = 0
for row in rows:
if float(row.split()[1]) > top:
top = float(row.split()[1])
name = row.split()[0]
else:
print "Topper: ", name
| true |
de6adf5acfbe4746f5b115d698397b9b2e380948 | Python | Krishika28/PRO-130 | /Clean_data.py | UTF-8 | 304 | 2.71875 | 3 | [] | no_license | import pandas as pd
df = pd.read_csv("merged_data.csv")
print(df[0:5])
print(df.columns)
df.drop(["Unnamed: 0", "Star_name.1", "Luminosity","Distance.1", "Radius.1", "Mass.1" ], axis=1, inplace=True)
df = df.dropna()
df.to_csv("main.csv")
data = pd.read_csv("main.csv")
print(df[0:5]) | true |
2597cc3c610a1e1f4bc490a126d8369e01ade932 | Python | byungjur96/Algorithm | /2460.py | UTF-8 | 237 | 3.1875 | 3 | [] | no_license | total = 0
max_val = 0
for i in range(10):
a, b = input().split()
a = int(a)
b = int(b)
total -= a
total += b
if total > 10000:
total = 10000
if total > max_val:
max_val = total
print(max_val)
| true |
544b3818abd8726735bde210aac669095acd750d | Python | Pohjois-Tapiolan-lukio/raspberry_pi-projects | /examples/ultraani/ultraaani.py | UTF-8 | 1,426 | 2.921875 | 3 | [] | no_license | # VCC an Pin 2 (VCC)
# GND an Pin 6 (GND)
# TRIG an Pin 12 (GPIO18)
# ECHO 330 ohm vastuskytkenta (GPIO24) ja GND
# Tuodaan kirjastot kayttoon
import RPi.GPIO as GPIO
import time
# GPIO tila (BOARD / BCM)
GPIO.setmode(GPIO.BCM)
# GPIO kaytettavat pinnit
GPIO_TRIGGER = 18
GPIO_ECHO = 24
# GPIO-Pinnien toimintasuun... | true |
43c0914fb1ebe33994379b014b6f9dfbdf741621 | Python | huyuu/SimpleZeroConsumptionPlane | /Utilities/GaussianProcessRegressorInterpolatorClass.py | UTF-8 | 2,945 | 2.671875 | 3 | [] | no_license | import numpy as nu
import pandas as pd
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.gaussian_process.kernels import RBF, WhiteKernel
from Spot4DClass import Spot4D
# https://scikit-learn.org/stable/auto_examples/gaussian_process/plot_gpr_co2.html
class GaussianProcessRegressorInterpolat... | true |
9597b55bc1294b8aecd0588997eb393bb7ee4d2b | Python | cabustillo13/Aprender-numeracion-maya | /maya_v1.py | UTF-8 | 5,234 | 3.84375 | 4 | [
"MIT"
] | permissive | import math
import cv2
import numpy as np
import matplotlib.pyplot as plt
# El sistema de numeracion maya tiene cuatro niveles.
# Funcion para definir los niveles para escribir grandes cantidades.
def getNiveles(valor):
if valor != 0:
exponente = math.log(valor,20) #Base 20
return (int(expone... | true |
28e065c4b43043a24627d17b3dcea6caf01ab0ed | Python | marocolojr/SEO-Projects | /Google-Search-Console/GSC_to_CSV_All_keywords.py | UTF-8 | 7,775 | 2.5625 | 3 | [] | no_license | import pandas as pd
import datetime
from datetime import date, timedelta
import httplib2
from googleapiclient.discovery import build
from oauth2client.client import OAuth2WebServerFlow
from collections import defaultdict
from dateutil import relativedelta
import argparse
from oauth2client import client
from oauth2clien... | true |
d5c8ebbeec515125330aa649c77215727758bf22 | Python | huntrar/python-clubhouse-lib | /api_generator/api_builder.py | UTF-8 | 6,399 | 3 | 3 | [
"MIT"
] | permissive | """Counterpart to the API slurper; takes description files generated by the API slurper and builds Python code to pop into the client object."""
import json
import os
from typing import List
from api_slurper import DocParameter, Documentation
class APIFunc:
"""Represents a clubhouse API function, sorted by categ... | true |
17155ba4270cd8c8f5c46e10f0209c3e1bc42797 | Python | Danielhp95/Regym | /regym/util/profiling.py | UTF-8 | 932 | 3.203125 | 3 | [
"MIT"
] | permissive | import cProfile
import pstats
def profile(filename: str = ''):
'''
A decorator that uses cProfile to profile a function.
If :param: filename is used, a pstats.Stats object will
be stored in a file under the same name. Otherwise the
profiling will be printed to standard output.
NOTE: A function... | true |
dd0802807f792b89dc1f1bb675483b28b16a8ec7 | Python | Hashah1/Leetcode-Practice | /easy/merge_two_sorted_lists_recur.py | UTF-8 | 1,721 | 3.859375 | 4 | [] | no_license | # Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def __init__(self):
self.res = None # Resulting linked list
self.tail = None
def mergeTwoLists(self, l1, l2):
"""
:type ... | true |
551b1d9aab8e4164f4ecd6861ef259a7b0ef1495 | Python | YoofiBP/nlp-2018-yoofibp | /Topic Modelling and Question & Answering Using NLP/Topic Modelling/NaiveBayesModel.py | UTF-8 | 6,346 | 2.78125 | 3 | [] | no_license |
# coding: utf-8
# In[86]:
from sklearn.naive_bayes import GaussianNB
from sklearn.naive_bayes import MultinomialNB
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.model_selection import train_test_split
from sklearn.metrics import... | true |
2789c6a146b905e7aa9f0ff9a253ed667d2cf4b8 | Python | EldelPelo/Modelos2 | /Ejercicios recursividad/Multiplicacion.py | UTF-8 | 166 | 2.734375 | 3 | [] | no_license | '''
Created on 9/02/2017
@author: ElDelPelo
'''
def multiplicacion(m,n):
if m==0 or n==0:
return 0;
else:
return m + multiplicacion(m, n-1)
| true |
9a043032de1d01ef3a8dabaff0c32671fc837797 | Python | cjaganmohan/XAI-Tool | /ImageSegmentation/BEN.py | UTF-8 | 675 | 2.65625 | 3 | [] | no_license | import os
import subprocess
from subprocess import Popen, PIPE, STDOUT
# reference - pass value for interactive jar file in shell script
# -- https://unix.stackexchange.com/questions/440897/how-to-pass-value-for-interactive-jar-file-in-shell-script
#subprocess.call(['java', '-jar', './BEN.jar'])
# reference --... | true |
ac2ac9808592c3f588d45eb64566812024004262 | Python | mahesh4555/python_scripts | /zip_extract.py | UTF-8 | 451 | 3.046875 | 3 | [] | no_license | from zipfile import ZipFile
# specifying the zip filepath
filepath = "/home/Documents/new_scripts/main15.zip"
def zip_extract(filepath):
print("zip_extracting : ", filepath)
filedir, filename = os.path.split(filepath)
# print(filedir)
# print(filename)
with ZipFile(filepath, 'r') as zip:
... | true |
058e9b14fdb86a925d760830dc0b2646c57b6f73 | Python | BenCradick/cs3130Project1 | /CRAB1B/CRAB1B.py | UTF-8 | 1,514 | 3.625 | 4 | [] | no_license | def fibonacci_iterative(k) :
penultimate = 0
last = 0
current = 1
while( k > 1 ):
penultimate = last
#Calculate next fibonacci number in sequence F(n-2)+F(n-1)
last = current
##Temporary numbers
current = last + penultimate
##Assign F(n) to F(n-1)
... | true |
9ecfdd584ccf46cfd0182a9bf23c0e8d394848a6 | Python | minzdeflaz/BigOCodingBlue | /Sort/Chores.py | UTF-8 | 183 | 2.9375 | 3 | [] | no_license | #Source:https://codeforces.com/problemset/problem/169/A
n, a, b = tuple(map(int,input().split()))
chores = list(map(int,input().split()))
chores.sort()
print(chores[b] - chores[b-1])
| true |
8f4c8bf90392719191caf0c8346afd223c00665f | Python | Vd1299/Air_quality_prediction_model | /algo.py | UTF-8 | 2,713 | 3.046875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Apr 6 22:31:39 2020
@author: vishvesh
"""
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
df = pd.read_excel('Data/Real-Data/real_combine.xlsx')
sns.heatmap(df.isnull(),yticklabels=False, cbar=True, cmap='viridis'... | true |
1202914a856a9639c19d7a42cc73e807bff3eb32 | Python | donkeywrong/camphyr | /controllers/default.py | UTF-8 | 20,463 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# -------------------------------------------------------------------------
# This is a sample controller
# this file is released under public domain and you can use without limitations
# -------------------------------------------------------------------------
# ---- INSERTED FUNCTION FOR FORM ... | true |
a3023c914fe65f3a1400c3ba119f216975bf6c29 | Python | damiati-a/CURSO-DE-PYTHON | /Mundo 1/ex029.py | UTF-8 | 415 | 3.984375 | 4 | [] | no_license | # Radar Eletrônico
# Caso o carro ultrapasse 80 km/h será multado em R$ 7,00 a cada km
velocidade = float(input('Qaula a velocidade atual do carro? '))
if velocidade > 80:
print('Multado, você excedeu o limite permitido que é de 80 KM/h')
multa = (velocidade - 80) * 7
print('Você deverá pagar uma ... | true |
7276f280e3305c96902a419684800be5e43ee21b | Python | thefireblade/Gym-Grocery-Problem | /src/functions.py | UTF-8 | 7,550 | 2.84375 | 3 | [] | no_license | import math
import random
import classes
import copy
import json
import numpy as np
from scipy.sparse.csgraph import connected_components
import networkx as nx
import geocoder
###### GLOBALS ############
ties = 0
my_geo = geocoder.ip('me')
###### CONSTANTS ##########
geolocation_range = 0.25
###### Geo Locations ###... | true |
60c0f9f1e9fe30635a3151639d06fd4481dbda15 | Python | damirivaleev/reinforcement-learning | /windy_gridworld.py | UTF-8 | 5,437 | 2.71875 | 3 | [] | no_license | import numpy as np
import time
import matplotlib.pyplot as plt
import copy
import os
import pandas as pd
GRID = [[0, 0, 0, 1, 1, 1, 2, 2, 1, 0],
[0, 0, 0, 1, 1, 1, 2, 2, 1, 0],
[0, 0, 0, 1, 1, 1, 2, 2, 1, 0],
['S', 0, 0, 1, 1, 1, 2, 'G', 1, 0],
[0, 0, 0, 1, 1, 1, 2, 2, 1, 0],... | true |
f90a087f22db8d5adac5ae6ff8cbc10b2c0365c8 | Python | aleexnl/aws-python | /UF1/Nieto_Alejandro_Gomez_Alejandro_PT12/ej7.py | UTF-8 | 422 | 3.734375 | 4 | [] | no_license | # Creamos una lista con diferentes palabras
lista=["hola","ADIOS","mañana","Futbol"]
# Decimos que I vaya dando vueltas hasta la lonigitud de la lista
for i in range(len(lista)):
# Y diremos que en la posicion de la lista que sea el numero de la vuelta (I) que en esa cadena se combiertan todas las letras a minuscul... | true |
72de04962c24a2f997216f92b0fda2ff71390f39 | Python | tdriscoll/WhammyBammy | /WhammyBammy/tests/test_framework/scenes/scene1.py | UTF-8 | 978 | 3.15625 | 3 | [] | no_license | from preproduction.scene import Scene
from common.lazy_property import LazyProperty
from cast.casting import Casting
from common.coordinate import Coordinate
class Scene1(object):
@LazyProperty
def protagonist(self):
return Casting.create_protagonist(Coordinate(0, 0, 0))
@LazyProperty
de... | true |
2f812371ba96fe067524c5ad3f8a0864a5fe0ede | Python | wang1540/ece364 | /Prelab04/test.py | UTF-8 | 1,618 | 2.546875 | 3 | [] | no_license | #! /usr/bin/env python3.4
import glob
import re
import os
from pprint import pprint as pp
def getPurchaseReport():
report={}
for file in fu:
with open(file,'r') as f:
i=0
summ=0
for l in f:
i=i+1
if (i>2):
item=l.s... | true |
9532ad19663f874613a7f96660c6666283de4924 | Python | juliamoraiss/python-CursoEmVideo | /Exercícios/ex045.py | UTF-8 | 1,311 | 3.5625 | 4 | [] | no_license | from random import randint
from time import sleep
print('\033[33m-='*22)
print('\033[36mVamos brincar de PEDRA, PAPEL E TESOURA? =D\033[m')
print('\033[33m-='*22)
print('\033[m')
print('''\033[34mEscolha uma opção:
[0] PEDRA
[1] PAPEL
[2] TESOURA\033[m\n''')
opcao = int(input('\033[36mQual é sua jogada? : \033[m'))
sl... | true |
3cc0de0959f651f71cca53e72be34a4bd77b4683 | Python | p-gonzo/flappy_bird_neuroevolution | /bird.py | UTF-8 | 1,814 | 3 | 3 | [] | no_license | from bird_brain import BirdBrain
from constants import *
import random
# Helper function to map values before input into the NeuralNet
def transpose(value, leftMin, leftMax, rightMin, rightMax):
leftSpan = leftMax - leftMin
rightSpan = rightMax - rightMin
valueScaled = float(value - leftMin) / float(leftSp... | true |
479306648d543cd064bb6c06d9bef69891f11464 | Python | Shahrukh-Chishti/time-domain-synchrony | /legacy.py | UTF-8 | 4,529 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Nov 2 16:59:03 2019
@author: Amrita Punnavajhala
"""
import numpy
import numpy as np
from numpy.random import random,rand
from scipy.integrate import odeint
import sys
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import plotly.offline as py
import... | true |
87f575accfce94d4273f9f5dddf45a7e78a9096e | Python | BasalGanglia/BiblioScraper | /introSelenium.py | UTF-8 | 635 | 2.703125 | 3 | [] | no_license | from selenium import webdriver
from time import sleep
from bs4 import BeautifulSoup
driver = webdriver.Chrome('F:\\code\\test\\chromedriver_win32\\chromedriver')
driver.get('https://www.instagram.com')
login_button = driver.find_element_by_xpath()
# sleep(3)
# login_button = driver.find_element_by_link_text('Log in... | true |
4b775becd1365a66667e653e68f72c719f62d12f | Python | qmnguyenw/python_py4e | /geeksforgeeks/python/python_all/37_15.py | UTF-8 | 2,442 | 4.125 | 4 | [] | no_license | Python – Skew Nested Tuple Summation
Given a Tuple, nesting at 2nd position, return summation of 1st elements.
> **Input** : test_tup = (5, (6, (1, (9, None))))
> **Output** : 21
> **Explanation** : 9 + 6 + 5 + 1 = 21.
>
> **Input** : test_tup = (5, (6, (1, None)))
> **Output** : 12
> **Ex... | true |
4b838676992c4e0406914cbc789b28b3dc7362c1 | Python | ouyi/stob | /lob.py | UTF-8 | 1,462 | 3.0625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import argparse, logging, sys, random, string
def randstr(length):
return ''.join(random.choice(string.ascii_letters + string.digits) for i in xrange(length))
def obfuscate(fields, indexes = None):
result = []
if not indexes:
result.extend([randstr(len(f)) for f in fields])
... | true |
97bcbe03e951b6e1f400f20ceb7bfac3f5e98fc1 | Python | programmingkids/python-event-level1 | /chapter11complete/data.py | UTF-8 | 2,865 | 2.8125 | 3 | [] | no_license | from tkinter import PhotoImage
from chapter11complete.monster import Monster
def get_map_images():
map_images = [
PhotoImage(file="../images/map01.png"), # 0
PhotoImage(file="../images/map02.png"), # 1
PhotoImage(file="../images/map04.png"), # 2
PhotoImage(file="../images/map05.... | true |
ce1965a8d27c1d1d642c346b8b90d1bde65937bc | Python | Jacob-Brink/game | /lib/modules/game/bomb.py | UTF-8 | 3,361 | 3.1875 | 3 | [] | no_license | from lib.modules.gui.rectangle import Rectangle, Point
from lib.modules.physics.rigid_body import RigidBody
from lib.modules.gui.image import Image
from lib.modules.game.timer import Timer
class Bomb(RigidBody):
def __init__(self, initial_velocity, bomb_type):
'''Models an exploding bomb'''
# set ... | true |
47d33c198afbd434046ef7dc1fe417481df14260 | Python | aleksiheikkila/HackerRank_Python_Problems | /Angry_Professor.py | UTF-8 | 1,131 | 3.296875 | 3 | [] | no_license | '''
HackerRank problem
Domain : Python
Author : Aleksi Heikkilä
Created : Aug 2019
Problem : https://www.hackerrank.com/challenges/designer-pdf-viewer/problem
'''
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the angryProfessor function below.
def angryProfessor(k, a):
... | true |
280d1e979df5bb192f45f875f601dcc30655ee32 | Python | micromanchg/pachong | /mzitu.py | UTF-8 | 1,364 | 2.609375 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import os
###第一个爬虫
headers = {'User-Agent':"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1"}##浏览器请求头(大部分网站没有这个请求头会报错、请务必加上哦)
all_url="http://mzitu.com/all"
start_html=requests.get(all_url,headers=headers)
#print(s... | true |
63a80effe45267a063739461898dc6a523a9de08 | Python | AXErunners/axerunner | /lib/pycoin/pycoin/services/chain.py | UTF-8 | 1,238 | 2.5625 | 3 | [
"MIT"
] | permissive | import json
try:
from urllib2 import urlopen
except ImportError:
from urllib.request import urlopen
from pycoin.serialize import h2b
from pycoin.tx import Spendable
class ChainProvider(object):
def __init__(self, key_id, netcode="BTC"):
NETWORK_PATHS = {
"BTC" : "bitcoin",
... | true |
aa2a7f2bce48f83d2a1a93e12cc0e5403333db19 | Python | comprobo20/comprobo20.github.io | /scripts/fix_links.py | UTF-8 | 378 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
import re
if len(sys.argv) < 2:
print("USAGE: ./fix_links.py file_to_fix")
sys.exit(1)
file_to_fix = sys.argv[1]
data = None
with open(file_to_fix, "r") as myfile:
data= myfile.readlines()
if data is None:
sys.exit(2)
for l in data:
print(re.sub(r"\[([^\]]*)\]\(... | true |
08f22c335efba80842a8fdcc8d3efc43993e0e5a | Python | JulianCabreraS/thecompletepythoncourse | /ObjectOriented/GarageDemo.py | UTF-8 | 393 | 3.796875 | 4 | [] | no_license | class Garage:
# Dunder methods Dunder means double underscore
def __init__(self):
self.cars = []
def __len__(self):
return len(self.cars)
def __getitem__(self, item):
return self.cars[item]
def __str__(self):
return f'garage with {len(self)} cars'
ford = Garage... | true |
6ab14ab0f97d67b14f75eececf7598301b9a224f | Python | k-bigboss99/Python-AI | /wordgame.py | UTF-8 | 970 | 3.890625 | 4 | [] | no_license | import random
WORDS = ("python", "jumble", "easy", "difficult", "answer", "continue", "phone", "position", "game")
# 開始遊戲
print(
"""
welcome to wordgame
please spell the right word
""")
iscontinue = "y"
while iscontinue=="y" or iscontinue=="Y":
word = random.choice(WORDS)
correct = word
jum... | true |
98698cceb3bbb33796e70a66a8765f88cb813d1e | Python | sharonzidi/object-detection | /Sharon_Client_test1_failure.py | UTF-8 | 2,438 | 2.765625 | 3 | [] | no_license | #MQTT Demo
# Monitor two MQTT topics for data
from sense_hat import SenseHat
import paho.mqtt.client as mqtt
from sense_hat import SenseHat
#define instances of Sense Hat and MQTT library
sense = SenseHat()
client = mqtt.Client()
# Callback for when client received connection from server
def on_connect(client, userdat... | true |
3ecf8e76a99905e7c1809ff6f357cd88e62b0cc8 | Python | chenjiancong/code | /stu_python/about_python_class/test.py | UTF-8 | 667 | 4.15625 | 4 | [
"Apache-2.0",
"MIT"
] | permissive | #!/usr/bin/env python
# encoding: utf-8
# 类的封装
class Foo(object):
def __init__(self, name, age, gender):
self.name = name
self.age = age
self.gender = gender
def kanchai(self):
print('{0},{1},{2}, 上山去砍柴' .format(self.name,self.age,self.gender))
xiaoming = Foo('小明', 10, '男')
... | true |
e5e6c5054323a540cbcd52e40a550ac77fa088f5 | Python | Akami-Slayer/Tools | /scanner.py | UTF-8 | 926 | 2.984375 | 3 | [] | no_license | #!/bin/python
import sys
import socket
from datetime import datetime
#Define our Target
if len(sys.argv) == 2:
target = socket.gethostbyname(sys.argv[1]) #translate hostname to IPv4
else:
print ("Invalid amount of arguments")
print ("Syntax: python3 scanner.py <IP>")
#Banner
print ('-' * 50)
print ("Scanning Tar... | true |
c83467d830cfe3ebfef5a878ef0c3f9ceb99d071 | Python | prasertcbs/python_tutorial | /src/dec_to_bin.py | UTF-8 | 331 | 3.296875 | 3 | [] | no_license | def dec_to_bin(n):
# ref: http://www.purplemath.com/modules/numbbase.htm
x = n
s = ""
base = 2
while x > 0:
s += str(x % base)
x = x // base
# print(s)
# print(s[::-1])
return s[::-1]
print(dec_to_bin(357)) # postfix completion
print("{0} {0:b} {0:o}".f... | true |
dcdcb09913ff17a8d28d99a1e54bf1e6a58986df | Python | tedski999/python-scripts | /NumberTyper.py | UTF-8 | 707 | 3.140625 | 3 | [] | no_license | from pynput import keyboard
import time
isRunning = True
currentNumber = 616
def on_press(key):
if key == keyboard.Key.esc:
global isRunning
isRunning = False
print("Quitting...")
def press_key(key):
keyboardController.press(key)
time.sleep(0.1)
keyboardController.release(key)
keyboardCon... | true |
a8fbf83c5fc8f04737680c27b38be813391cf500 | Python | kinetickansra/algorithms-in-C-Cplusplus-Java-Python-JavaScript | /Algorithms/searching/Python/linearSearch.py | UTF-8 | 94 | 3.46875 | 3 | [
"MIT"
] | permissive | def linsearch(arr, n):
for i in range(len(arr)):
if (arr[i]==n):
return i
return -1 | true |
a49902bd4fc1846383d529c4c56fb5f78431ab23 | Python | Isaac-Lee/BOJ-Algorithm | /Python_Solutions/2667.py | UTF-8 | 874 | 3.5625 | 4 | [] | no_license | def dfs(house, x, y, n, count):
house[x][y] = 0
destination = [[-1, 0], [0, -1], [1, 0], [0, 1]]
for i in range(4):
addX = destination[i][0]
addY = destination[i][1]
newX = x + addX
newY = y + addY
if 0 <= newX <= n - 1 and 0 <= newY <= n - 1:
if house[new... | true |
0832bf33830cd9bc2afb19b9ea5f2437a0a085f0 | Python | stonek4/hwbot | /hwbot.py | UTF-8 | 7,428 | 3.171875 | 3 | [
"MIT"
] | permissive | '''
HWBOT
v1.0
Organizing and creating hw has never been so easy!
Kevin Stoner
'''
### IMPORTS ###
from math import *
import os
import sys
import logging
import argparse
from md_compile import Compiler
from creator import Creator
### GLOBALS ###
### CONSTANTS ###
### FUNCTIONS ###
def setup_log... | true |
4894bf2f91c21361709eafbe84a93f869d7f6eb9 | Python | athdsantos/Basic-Python | /python-in-out-file/entradasaidaarquivos.py | UTF-8 | 290 | 3.09375 | 3 | [] | no_license | arquivo = open('your_path', 'r+')
try:
file.read()
except:
file.write()
for row in file:
if row == 'python':
for c in range(3):
name = input('Name: ')
age = input('Age: ')
file.write(name)
file.write('\t\t\t')
file.write(age)
file.write('\n')'''
| true |
b17bf41bd585c7f3d2c0e958dd62f98bd81ef7d9 | Python | sathya-sai/Python | /Algorithm/anagram.py | UTF-8 | 223 | 3.25 | 3 | [] | no_license | str1 = str(input('enter the sting1'))
str2 = str(input('enter the sting2'))
if(sorted(str1)== sorted(str2)):
print('two strins are anagram of each other')
else:
print('the strings are not the anagram of each other') | true |
dd972bf66fd5e0eba87bff10280967af29b68272 | Python | strongio/strong-glm | /strong_glm/utils/simulate_data.py | UTF-8 | 1,645 | 3.078125 | 3 | [
"MIT"
] | permissive | import numpy as np
def random_multivariate_normal(num_rows: int, num_dims: int) -> np.ndarray:
"""
Random draws from a multivariate normal with a randomly chosen (unit) covariance matrix.
"""
# generate random covariance:
L = np.clip(np.random.laplace(size=(num_dims, num_dims)), -1.5, 1.5)
L[r... | true |
0874beaa6526c4fd4b0906854bcf1158eff31a22 | Python | titovanton/bicycle-core | /templatetags/dict.py | UTF-8 | 342 | 2.75 | 3 | [] | no_license | # coding: UTF-8
from django import template
register = template.Library()
@register.filter
def get(deect, key):
"""
Return value of dict if it does exists, else return empty string
Usage:
{{ dict|get:"key" }}
With default value:
{{ dict|get:"key"|default:"value" }}
"""
retu... | true |
66990101bbd2d0ecb82a21ec57d2223fc3166166 | Python | eliseuv/econophysics | /btc/regression_btc.py | UTF-8 | 1,371 | 3.171875 | 3 | [] | no_license | import os
os.system('clear')
print('Importing Libraries:')
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
print('Simulating...')
print('')
################################################
## LE ARQUIVO #
################################################
# ... | true |
e94063f07a8a2a795676ff4c99edfbff99d4cd75 | Python | Akshaysharma0697/Machine-learning-A-Z-Notes | /Part 9 - Dimensionality Reduction/Section 45 - Kernel PCA/kernel_pca_lecture_notes.py | UTF-8 | 4,259 | 3.515625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 3 20:33:11 2019
@author: Akshay
"""
"""kernel_pca works on non linear problem where the data is non linearly separable
- in this where we map the data to a higher dimension using kernel trick and then we extact some new components
"""
#importing the libraries
... | true |
3fa9fb4b0857b8760969e2356a6dcc32d5bb4210 | Python | jgibson5/Olin | /vectorCalc/weeklyProblem7.py | UTF-8 | 937 | 3.171875 | 3 | [] | no_license | import matplotlib.pyplot as pyplot
import mpl_toolkits.mplot3d as p3d
import math
c = 1
a = 1
def x_func(u, v):
return (1 + .5 * v * math.cos(u / 2)) * math.cos(u)
def y_func(u, v):
return (1 + .5 * v * math.cos(u / 2)) * math.sin(u)
def z_func(u, v):
return .5 * v * math.sin(u / 2)
def tra... | true |
9374b277e7723cf3d0e960652bd2f99673ec8e40 | Python | dengpris/calgaryhacks2021 | /pyxel-master/pyxel/endcard.py | UTF-8 | 957 | 3.328125 | 3 | [
"MIT"
] | permissive | import pyxel
import time
class Option:
def __init__(self, x, y, side, color):
self.x = x
self.y = y
self.side = side
self.color = color
class App:
def __init__(self):
pyxel.init(256, 256, caption="Title", fullscreen=True)
pyxel.image(1).load(0, 0, "assets/endcar... | true |
3b60dc35f728f033f1b48c6df60a35f5bc13ff19 | Python | nsushkov/AIST | /test/libraries/DBClients.py | UTF-8 | 3,620 | 3.0625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import random
import string
import sqlite3
class DBClients:
"""Класс для работы с базой данных тестируемого приложения """
name_len = 6
default_balance = 5
def __init__(self, db_path):
self.db_path = db_path
def get_client_balance(self, client_id):
"""
... | true |
5ae7b49603d06ecfb97bdb73c2ea2957efd339ec | Python | Guilherme26/life-checker | /connection.py | UTF-8 | 427 | 2.609375 | 3 | [] | no_license | import poplib
from credentials import credentials
class Connection():
def __init__(self):
self.connection = self.get_connection()
def get_connection(self):
connection = poplib.POP3_SSL('pop.gmail.com')
connection.user(credentials['username'])
connection.pass_(credentials['... | true |
fa0365eabdc9f021ec593dae34b91493ab308a5b | Python | krisbredemeier/AirBnB_clone1 | /api/app/models/city.py | UTF-8 | 691 | 2.5625 | 3 | [] | no_license | import peewee
from app.models.base import BaseModel
from app.models.state import State
class City(BaseModel):
name = peewee.CharField(128, null=False)
state = peewee.ForeignKeyField(State, related_name='cities', on_delete = "CASCADE")
def __init__(self, *args, **kwargs):
super(BaseModel, self).__... | true |
85825a240addbcc9878d42e0b1f1f9f10ddf8703 | Python | JerinPaulS/Python-Programs | /Palindrome.py | UTF-8 | 1,011 | 4.125 | 4 | [] | no_license | '''
Given an integer x, return true if x is palindrome integer.
An integer is a palindrome when it reads the same backward as forward. For example, 121 is palindrome while 123 is not.
Example 1:
Input: x = 121
Output: true
Example 2:
Input: x = -121
Output: false
Explanation: From left to right, it reads -121. F... | true |
dbf82d03444468d38f70b026f3fd925263243b50 | Python | rodgerdohm/rodgerdohm.github.io | /my_website/files/High_School_GPA.py | UTF-8 | 1,576 | 4.03125 | 4 | [] | no_license | '''HIGH SCHOOL UNWEIGHTED GPA CALCULATOR'''
from __future__ import print_function
'''Calculating the letter grade.'''
def convert(grade):
grade = grade.upper() # converts all of the characters to uppercase
points = 0.0
if grade[0] == 'A':
points = 4.0
elif grade[0] == 'B':
... | true |
0f7e9ce3495788a6a532c1248686bed37185473d | Python | 649704331/CPM | /test/test_cpm.py | UTF-8 | 3,093 | 2.828125 | 3 | [] | no_license | import numpy as np
import cv2
import torch
import torchvision.transforms.functional as F
from preprocess.gen_data import gaussian_kernel
def get_key_points(heatmap6, height, width):
"""
Get all key points from heatmap6.
:param heatmap6: The heatmap6 of CPM cpm.
:param height: The height of original image.
:param... | true |
d358b8e2f97134306d57382bac92477a08c4ca58 | Python | hellohr11/musclex | /musclex/utils/file_manager.py | UTF-8 | 15,909 | 2.640625 | 3 | [
"MIT"
] | permissive | """
Copyright 1999 Illinois Institute of Technology
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, including
without limitation the rights to use, copy, modify, merge, publis... | true |
2991f47752da944ec5879b17f377c099faf88a14 | Python | YxiangJ/Python | /Checkiolearn/Electronic Station/reverse_roman_numerals.py | UTF-8 | 952 | 3.796875 | 4 | [] | no_license | def reverse_roman(roman_string):
# replace this for solution
ROMANS = (('M', 1000),
('CM', 900),
('D', 500),
('CD', 400),
('C', 100),
('XC', 90),
('L', 50),
('XL', 40),
('X', 10),
('IX'... | true |
45e11880e6856b1963a99ecba5222b3999706a2a | Python | bbulkow/micro | /micro.py3 | UTF-8 | 1,618 | 3.5 | 4 | [] | no_license | import time;
def f1():
start = float(time.clock())
x = 10
for i in range(100000):
x = ( 2 * x ) + x + 1;
# print "t1 answer %d time %f" % (x, float(time.clock()) - start)
print("f1 time %f seconds" % ( float(time.clock()) - start))
# Create nStrings strings.
# the first string just has the character 'a', the ... | true |
02031931c75f21aa9048a8ef2c1daac0194527da | Python | microsoft/qlib | /qlib/rl/utils/env_wrapper.py | UTF-8 | 9,844 | 2.640625 | 3 | [
"LicenseRef-scancode-generic-cla",
"MIT"
] | permissive | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from __future__ import annotations
import weakref
from typing import Any, Callable, cast, Dict, Generic, Iterable, Iterator, Optional, Tuple
import gym
from gym import Space
from qlib.rl.aux_info import AuxiliaryInfoCollector
from qlib.rl.inte... | true |
35a87466ae966c9fdf76c6ed4033c1ce9f865794 | Python | valer-whylabs/whylogs | /src/whylogs/cli/cli_text.py | UTF-8 | 3,012 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | INTRO_MESSAGE = """
██╗ ██╗██╗ ██╗██╗ ██╗██╗ ██████╗ ██████╗ ███████╗
██║ ██║██║ ██║╚██╗ ██╔╝██║ ██╔═══██╗██╔════╝ ██╔════╝
██║ █╗ ██║███████║ ╚████╔╝ ██║ ██║ ██║██║ ███╗███████╗
██║███╗██║██╔══██║ ╚██╔╝ ██║ ██║ ██║██║ ██║╚════██║
╚███╔███╔╝██║ ██║ ██║ ███████╗╚██████╔╝╚██████╔... | true |
5ed7aca6d756f1649cad897bf02df6387d497a2e | Python | chamara96/Handwritten-Digits-Recognizer-using-CNN-AlexNet- | /Our Application/bank_slip_reader.py | UTF-8 | 2,463 | 2.578125 | 3 | [] | no_license | # import the necessary packages
import numpy as np
import cv2
import tensorflow as tf
# from test import show_output
y_Predicted = []
def show_output(predicted_arr):
image = cv2.imread('Data/bank_slip_croped.jpg')
grey = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
grey_3_channel = cv2.cvtColor(grey, cv2.C... | true |
1c82239a89f5674e28581a63a77d195eb35f4ad6 | Python | fafhrd91/memphis-dev | /memphis.schema/memphis/schema/richtext/plaintext.py | UTF-8 | 1,012 | 2.8125 | 3 | [] | no_license | """ Plain Text Renderer """
import cgi
from zope import interface
from memphis import config
from interfaces import _, IRenderer
class PlainTextRenderer(object):
"""
>>> renderer = PlainTextRenderer()
>>> print renderer.render('Test text1\\n test text2\\n test text3 ')
Test text1<br />
... | true |
b250a7c6ce470da453418d9a8354cddc30a8e977 | Python | kzhang12/Video-Game-Design | /Source/Projectile.py | UTF-8 | 8,562 | 2.859375 | 3 | [] | no_license | import os as OS
import sys as SYS
import pygame as PY
import pygame.display as PD
import pygame.event as PE
import pygame.image as PI
import pygame.sprite as PS
import pygame.mixer as PX
import Setup
from Screen import Globals
from Character import BaseClass
from smooth import Entity
import Player
Dir = OS.getcwd()
PRO... | true |
4c3b47385c8cf6ab70902cb313b090399d0b5e2d | Python | JenBe/PythonExercises | /Exercise17.py | UTF-8 | 153 | 3.8125 | 4 | [] | no_license | '''
Exercise 17: Dictionary Items Sum Up
Calculate the sum of the values of keys a and b .
'''
d = {"a": 1, "b": 2, "c": 3}
print(d['a']+d['b'])
| true |
47342dc45c4bbc4e7bb3c0073116de3e433a7b16 | Python | Keeady/daily-coding-challenge | /tests/test_remove_dup_sorted_list.py | UTF-8 | 1,426 | 2.921875 | 3 | [] | no_license | from List import remove_dup_sorted_list
def test_remove_no_dup():
one = remove_dup_sorted_list.LinkedListNode(1)
two = remove_dup_sorted_list.LinkedListNode(2)
three = remove_dup_sorted_list.LinkedListNode(3)
four = remove_dup_sorted_list.LinkedListNode(4)
one.next = two
two.next = three
t... | true |
8e365b47a83731cd01f8faf650a1425dc0bd1369 | Python | CS329EProject0/Project1 | /sortRoommates.py | UTF-8 | 12,131 | 3.140625 | 3 | [] | no_license | import math
import unittest
import operator
import tkinter
# this class represents each person's traits and preferences
class Person ():
def __init__(self, id, firstName, lastName, wakingTime, bedtime, smoker, drinker, \
studyLoc, studyHrs, tvHrs, allNight, gender, preferredRoommateGender, cleanliness, guestComfor... | true |
c83c3a3d88ff39c33657d45a76df07e813a6e56d | Python | AxelOrdonez98/Universidad_Proyectos_All | /Archivos_Python/Game/Pinguino.py | UTF-8 | 1,333 | 3.25 | 3 | [] | no_license | import pygame
from pygame.locals import *
import sys
import os
#constantes
SCREEN_WIDTH = 640
SCREEN_HEIGHT = 480
#clases y funciones
#funcion principal del juego
def main():
pygame.init()
#crear ventana y titulo
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
pygame.display.set_caption(... | true |
d5a469741a365ef3299343c3c629623ccdad4592 | Python | jbfenton/python_snippets | /test_snippets/test_divide_and_conquer_iterable/__init__.py | UTF-8 | 3,162 | 3.734375 | 4 | [
"MIT"
] | permissive | """
Divide and conquer iterable unit tests.
"""
from typing import NoReturn, Iterable
from unittest import TestCase
from snippets.divide_and_conquer_iterable import divide_and_conquer_iterable
def dummy_logic(iterable: Iterable) -> NoReturn:
"""
Mock function to raise an exception when a particular value is... | true |
40792bd8356688e4c222ebe8af97dbe5a53afadf | Python | aiiselo/HSE-software-engineering | /2nd course/Python/lab_sentimentanalysis/task6.py | UTF-8 | 2,898 | 2.96875 | 3 | [] | no_license | import datetime
import main
import task4 as t4
import matplotlib.pyplot as plt
import pylab
main.tweets.reverse()
main.tweets_time.reverse()
t4.tweets_score.reverse()
current_time = 0
exit = 0
step = 0
window = 30
prev_pos = 0
prev_neut = 0
prev_neg = 0
prev_amount = 0
fraction_pos = []
fraction_neg = []
fraction_neu... | true |
b67f7cafe9bf9a884353bc1293601bf05d50ab3c | Python | noway2pay/NFCMiTM | /nfc_ctypes.py | UTF-8 | 48,395 | 2.53125 | 3 | [] | no_license | '''Wrapper for nfc-emulation.h
Generated with:
ctypesgen.py -lnfc ./_nfc/nfc-emulation.h ./_nfc/nfc.h ./_nfc/nfc-types.h -o ./_nfc/nfc_ctypes.py
Do not modify this file.
'''
__docformat__ = 'restructuredtext'
# Begin preamble
import ctypes, os, sys
from ctypes import *
_int_types = (c_int16, c_int32)
if hasattr(c... | true |
94b95ce285ebd4349a0d59891101c21289e118b5 | Python | windyer/saohuijia_scrapy | /mysql_conf/fomat_content.py | UTF-8 | 1,142 | 2.6875 | 3 | [] | no_license | class FormatContent():
def format_content(self,content):
html_1 = "<html><head><style type='text/css'>div{" \
"width : 100%;" \
"}" \
"p{" \
" text-indent: 2em;" \
" font-family: 'Merriweather Sans',Open Sans,Helvetica,Arial,sans-serif;" \
... | true |
166920dba61bec95e8bd706b06940da8b9bd1451 | Python | sukritkapil2/DSIR-System | /store_document_tokens_list.py | UTF-8 | 1,840 | 2.6875 | 3 | [
"MIT"
] | permissive | from math import log
import nltk
from nltk import word_tokenize
from nltk import FreqDist
import sys
import math
import os
from nltk.stem.snowball import SnowballStemmer
from collections import defaultdict
import pickle
import json
nltk.download('punkt')
nltk.download('stopwords')
vocabulary = {}
vocabulary_idf = {}
... | true |
25b185c7c263e05fa9223b536ea15ada35d1d029 | Python | Vages/python_algorithms | /chapter04/maxPerm.py | UTF-8 | 580 | 3.34375 | 3 | [] | no_license | def naive_max_perm(M, A=None): #Listing 4-5
if A is None:
A = set(range(len(M)))
if len(A) == 1: return A
B = set(M[i] for i in A)
C = A - B
if C:
A.remove(C.pop())
return naive_max_perm(M, A)
return A
def max_perm(M):
n = len(M)
A = set(range(n))
count = [0]*n
for i in M:
count[i] += 1
Q = [i for i... | true |
c5c924e1f2fa7bda7f5ed3b397de369aeaaf1c48 | Python | vk-yahoo/DS_training_2 | /tests/test_lesson_8.py | UTF-8 | 2,025 | 2.875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
def test_admin_add_product(app):
"""
Сделайте сценарий, который проверяет, что ссылки на странице редактирования страны открываются в новом окне.
Сценарий должен состоять из следующих частей:
1) зайти в админку
2) открыть пункт меню Countries (или страницу http://localhost... | true |
94c096d0483482ad27eedde7d656390ab79e001c | Python | gogolB/EE144 | /Lab_1/turtlebot_move.py | UTF-8 | 1,432 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python
import rospy
from geometry_msgs.msg import Twist
class turtlebot_move():
def __init__(self):
rospy.init_node('turtlebot_move', anonymous=False)
rospy.loginfo("Press CTRL + C to terminate")
rospy.on_shutdown(self.shutdown)
self.set_velocity = rospy.Publish... | true |
18420a4a802806f88a044350ca20d92c0b21aceb | Python | tannercyost/cs23 | /as08.py | UTF-8 | 3,587 | 3.78125 | 4 | [] | no_license | # as08.py
def is_reflexive(Set, Relation):
"""
A relation 'Relation' on a set 'Set' is called reflexive when:
∀ a ∈ Set, (a,a) ∈ Relation
https://en.wikipedia.org/wiki/Reflexive_relation
Args:
Set: A set of comparable values.
Relation: A set of 2-tuples of comparable values.
Returns:
A ... | true |
cfb4a5784f72b12b01914e52383d92262440fbd0 | Python | fastscape-lem/fastscape | /fastscape/processes/initial.py | UTF-8 | 3,217 | 2.875 | 3 | [
"BSD-3-Clause"
] | permissive | import numpy as np
import xsimlab as xs
from .erosion import TotalErosion
from .grid import UniformRectilinearGrid2D
from .main import Bedrock, SurfaceTopography
@xs.process
class FlatSurface:
"""Initialize surface topography as a flat surface at sea-level with
random perturbations (white noise).
"""
... | true |
68f2b804f98a84d0f1fd8e4da8c982e9c572f1a0 | Python | zain1612/University | /CM1202 FULL FINAL - Copy/ExtendedTest.py | UTF-8 | 5,447 | 2.90625 | 3 | [] | no_license | from Tkinter import *
import MainPage
import tkMessageBox
#Daniel
result_label=""
class Logic (Frame):
# GUI Setup
def __init__(self, master):
# Initiate Questionnaire Class
Frame.__init__(self, master)
self.questions()
self.grid()
self.centre_window()
master.protocol('WM_DELETE_WINDOW... | true |