blob_id large_string | language 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
0a28199e21e6e8edde83df8963dff7bb8ea72e9c | Python | testingforAI-vnuuet/AdvGeneration | /src/attacker/l_bfgs.py | UTF-8 | 3,484 | 2.6875 | 3 | [] | no_license | from __future__ import absolute_import
import tensorflow as tf
from tensorflow import keras
from attacker.constants import *
from data_preprocessing.mnist import MnistPreprocessing
from utility.filters.filter_advs import *
from utility.statistics import *
logger = MyLogger.getLog()
class L_BFGS:
def __init__(s... | true |
865c240fe2cca68aec2c864e56f63c0d64959cb5 | Python | 0xqq/NLP-project | /bert/predict.py | UTF-8 | 1,695 | 2.71875 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: UTF-8 -*-
#Author zhang
import tensorflow as tf
import time
from tensorflow.keras.models import model_from_json
from importlib import import_module
from utils import build_dataset, get_time_dif, build_net_data
import argparse
parser = argparse.ArgumentParser(description='C... | true |
01249d9362f18c753a4c237aa30c29f0c76fa2e5 | Python | TheKermitFrog/Homiefy | /main/models.py | UTF-8 | 3,768 | 2.703125 | 3 | [] | no_license | from django.db import models
from register.models import User, Partner
import datetime
from pytz import timezone
# Create your models here.
class Service(models.Model):
"""
This model contains information about the service being provided.
PK: Business Partner, Service Type.
A business partner can provi... | true |
92341c8acfddf22b4dde2e5adfd08a4b7a990e97 | Python | ylc015/interview_boggle_h | /solution.py | UTF-8 | 9,756 | 3.109375 | 3 | [] | no_license |
#author Yik Lun Chan
# 2/5/2016
import sys
#used by build_tries to see if a word exists
FIN = 'fin'
TOP = 'top'
L_TOP = 'left_top'
L_BOT = 'left_bottom'
BOT = 'bottom'
R_TOP = 'right_top'
R_BOT = 'right_bottom'
NO_EDGE = 'no_edge'
#customized queue class
class Queue(object):
def __init__(self):
self.q = []
def... | true |
1153836ab3b446370fd909c13cbd68416387b192 | Python | JohnyLi/UEMSystem | /util/Time.py | UTF-8 | 1,129 | 3.21875 | 3 | [] | no_license | # coding=utf-8
import time
# 输出本地时间 从年到秒 举例 "2018-07-20 20:00:00"
def from_year_to_second():
return time.strftime("%Y-%m-%d %H:%M:%S",time.localtime())
# 输出本地时间 从年到秒 举例 "2018-07-20_20:00:00"
def from_year_to_second_secure():
return time.strftime("%Y-%m-%d_%H:%M:%S",time.localtime())
# 输出本地时间 从年到分 举例 "2018-07... | true |
b203606b9141338e7cf841125f920fc41483de0f | Python | dhruvshah0208/EE-214-Digital-Lab | /Expt2/code/test_generation.py | UTF-8 | 290 | 2.609375 | 3 | [] | no_license | in_len = 8
out_len = 8
f = open('TRACEFILE.txt', 'w')
for i in range(2**in_len):
in_vec = "{:b}".format(i).zfill(8)
A = int(in_vec[:4], 2)
B = int(in_vec[4:], 2)
out_vec = "{:b}".format(A*B).zfill(8)
stri = in_vec + ' ' + out_vec + ' ' + '11111111'
f.write(stri + '\n')
f.close()
| true |
2483a47799e9010b7f9bca92964f724672551476 | Python | c235gsy/Sustech_AI_B | /weeks7-8/prac4_Pacman/ghostAgents.py | UTF-8 | 6,072 | 2.9375 | 3 | [] | no_license | # ghostAgents.py
# --------------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to http://ai.berkeley.e... | true |
5ffd9ff793d3d97ed724b90ff7fc38f6d2d3c938 | Python | sonqdinh/WB_week1 | /Week1/isPowerOfTwo.py | UTF-8 | 264 | 2.84375 | 3 | [] | no_license | class Solution:
def isPowerOfTwo(self, n: int) -> bool:
# All power of two has binary forms:
# 10000000 so clear the MSB of power of two will return 0
if n == 0:
return False
else:
return n & (n - 1) == 0 | true |
5f611c0e23293bcb077ac2a976177e1d4cec3fe4 | Python | BloodWorkXGaming/WarframeRelicReader | /warframe/image_cleanser.py | UTF-8 | 779 | 2.84375 | 3 | [] | no_license | import numpy as np
from PIL import Image
r_text = 189
g_text = 169
b_text = 102
black = np.array([0, 0, 0], dtype=np.uint8)
white = np.array([255, 255, 255], dtype=np.uint8)
def cleanse_numpy(img: Image) -> Image:
def test(v):
# print(v)
if abs(r_text - v[0]) < 70 and abs(g_text - v[1]) < 70 and... | true |
20b20dfecab9a24519213d9e085551d210d3e11d | Python | jacekzema/Simple_HJ_Method | /HJ_Method.py | UTF-8 | 4,142 | 3.234375 | 3 | [] | no_license | import time
start = time.clock()
t=5 #dlugosc kroku
b=0.1 #wspolczynnik korygujacy
s=0.001 #dokladnosc obliczen
d=1 #kierunek
x1=-8 # punkty poczatkowe
x2=-89
x1p=x1
x2p=x2
def funkcja(x1,x2):
global y
y=(2*(x1-25.4)**2)+(4*(x2-7.5)**4)
retu... | true |
a1821e37b696ce3f364ee0ea51565e5b2b7d5ca5 | Python | T0X1C-B15H0P/battle_script | /main.py | UTF-8 | 5,662 | 3.296875 | 3 | [] | no_license | import random
from Classes.game import person, bcolors
from Classes.magic import Spell
from Classes.Inventory import Items
# Create Black Magic
Fire = Spell("Fire", 10, 100, "Black")
Thunder = Spell("Thunder", 10, 100, "Black")
Blizzard = Spell("Blizzard", 10, 100, "Black")
Meteor = Spell("Meteor", 20, 200, "Black")... | true |
dbb37bc8c80eab1355d949f4c94f59fe48c0c93d | Python | lesclaz/curso-qt-pyside-udemy | /Proyectos/Proyecto 05/programa_final.py | UTF-8 | 4,185 | 3.21875 | 3 | [] | no_license | from PySide6.QtWidgets import (
QApplication, QWidget, QGridLayout, QLCDNumber, QPushButton)
from functools import partial
from helpers import *
# https://doc.qt.io/qt-6/qlcdnumber.html
# https://docs.python.org/3/library/functools.html#functools.partial
class Calculadora(QLCDNumber):
def __init__(self):
... | true |
2ba39c2ab6e1cefea23261c990e4eeffd9c179c7 | Python | dazzyddos/pycodes | /reverse_ip.py | UTF-8 | 367 | 2.78125 | 3 | [] | no_license | # Usage: ./reverse_ip.py <site>
# Example: ./reverse_ip.py facebook.com
import requests
import socket
import sys
site = "http://api.hackertarget.com/reverseiplookup"
if len(sys.argv) != 2:
print "Usage: reverse_ip.py <site>\n"
sys.exit(0)
url = sys.argv[1]
ip = socket.gethostbyname(url)
data = {'q':ip}
resp = re... | true |
f453e96c05bb51ab7ff5db530e69795e79465dd7 | Python | nguyennam9696/Learn_Python_The_Hard_Way | /ex5.py | UTF-8 | 246 | 3.625 | 4 | [
"MIT"
] | permissive | # Difference between format strings %r vs %s.
# %r is used for debugging to see the actual raw data. %s is used to display to users.
print "I said: %r" % "There are %d types of people" % 10
print "I said: %s" % "There are %d types of people" % 10 | true |
5fbe1a6de15e1cedde449f5c7326294124acedca | Python | sers88/FF_Cheker | /FF_Checker.py | UTF-8 | 2,086 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | import re
import requests
from faker import Faker
fake = Faker()
headers = {'user-agent':fake.user_agent()}
check_lists = list()
proxies = {'http':'http://176.74.140.5:57476'}
separ_newline = '\n'
with open('bookmarks.html', 'r', encoding='utf8') as file:
in_file = file.read()
links_list = list(in_file.split(separ... | true |
bb19545ca6ab1cb1a3b6f7451f0a47d71f594cab | Python | aa4334574/test | /my_email_test/my_first.py | UTF-8 | 3,427 | 3.40625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from numpy import *
from sklearn.datasets import load_iris
from sklearn.linear_model import LogisticRegression
iris = load_iris()
trainX = iris.data
trainY = iris.target
#测试
clf = LogisticRegression(penalty='l2', dual=False, tol=1e-4, C=1.0,
fit_intercept=True, in... | true |
6b60c7baaac15b87828fc04abcb6bb86dc9df4ef | Python | godseey/kgc-rec | /data_utils.py | UTF-8 | 7,620 | 2.671875 | 3 | [] | no_license | import pickle as pkl
import numpy as np
from sklearn.metrics import ndcg_score
np.random.seed(0)
def evaluate(pred_rating_matrix, training_matrix, ground_truth_matrix, user_specific=False, for_csv=False):
"""
Prepare negative item indices to sample 99 items for each positive in testing
For each ... | true |
e74ec54d8b9ccb4b13eaeecac280ee9c6265d47c | Python | alleri91/Python | /Pole.py | UTF-8 | 205 | 3.421875 | 3 | [] | no_license |
dlugosc = int(input('Wprowadz dlugosc \n'))
szerokosc = int(input ('Wprowadz szerokosc \n'))
pole_powierzchni = dlugosc * szerokosc
print('Pole powierzchni wynosi :{} '.format(pole_powierzchni))
| true |
93adb1dabe39b1e5f02d0c9bc0efc2fab3f8c161 | Python | horace1024/ble | /run_obs.py | UTF-8 | 1,789 | 2.890625 | 3 | [] | no_license | # Creates a basic BLE Observer
# Check the Observer.py class for more info
import sys
import time
import signal
from datetime import datetime, timedelta
from Observer import Observer
# Create pretty hex string from bytearray
def bytes2Str(byteArray):
return(''.join("{0:02X}".format(x) for x in byteArray))
# O... | true |
4a51cb9e0f73e4c67a04a2049c5afbf6b16c875f | Python | willzyz/nn_pred | /dev/python/readTrack.py | UTF-8 | 705 | 2.65625 | 3 | [] | no_license | from pylab import *
file = '/home/wzou/apc/track/cpu_track_2012-08-15T00:48:55.284500.txt';
#file = '/home/wzou/apc/track/mem_track_2012-08-14T23:40:20.554979.txt';
f = open(file, 'r');
title = f.readline();title=title.split('\n')[0];
s1=[]; s2=[];
t =f.readline();
count = 1;
while 1:
t = f.readline();... | true |
1d93b30ad7cd07686447e3e9475c609b443e6b22 | Python | Manasi0801/Game | /Guess.py | UTF-8 | 908 | 3.703125 | 4 | [] | no_license | import random
import time
Plangs = ("python", "php", "javascript", "perl","java", "ruby"
, "cobol", "fortran", "pascal", "basic", "swift")
answer = random.choice(Plangs)
correct = answer
rumble = ""
print("\nLet's play")
while answer:
position = random.randrange(len(answer))
rumb... | true |
48e0a03ba0c7b4d603fed4e982eae8acfad1705b | Python | vjuranek/jenkins-disk-usage | /lib/python/tex_top_jobs.py | UTF-8 | 786 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import db_queries as db
import utils as u
def generate(file_path, limit):
CAPTION = "Top %i disk consumers"%limit
jobs = db.top_jobs(limit)
ft = open(file_path,"w")
ft.write("\\begin{table}[h!]\n")
ft.write("\\centering\n")
ft.write("\\begin{tabular}{|c|c|}\n... | true |
6930e6f9257daedea07cfd86ea5d53f359d0a88e | Python | ajcrosbie/Pong | /Objects.py | UTF-8 | 2,660 | 3.15625 | 3 | [] | no_license | import random
import pygame
class paddle():
def __init__(self, pos, player, size, side=0):
self.colour = 255, 255, 255
self.pos = pos
self.player = player
self.speed = 0
self.size = size
def move(self, keys, speed):
for event in pygame.event.get():
... | true |
408652d31c204481541d9df2f77ebf75af07a2db | Python | jingong171/jingong-homework | /夏丽平/10-6-10-7.py | UTF-8 | 991 | 4.1875 | 4 | [] | no_license | print("Give me two number,and I will add them")
print("enter 'q' to quit")
##10-6
##number1=input("\nenter the first number:")
##try:
## number1=int(number1)
##except ValueError:
## print("sorry,you didn't enter a number")
##number2=input("\nenter the second number:")
##try:
## number2=int(number... | true |
3734d57efd30475b4cbadafc77b8782cc27f21c1 | Python | jbpaduan/MB-Mapping | /mysite/mbdb/views.py | UTF-8 | 2,162 | 2.5625 | 3 | [] | no_license | from django.http import HttpResponse
from django.shortcuts import get_object_or_404, render
from django.template import loader
from .models import Expedition, Mission
# Create your views here.
#---------------
# 1. index view
## using a shortcut: render(), tutorial #3
def index(request):
latest_expedition_list = ... | true |
89a1947ff87ef527dacb1afee25203ebf24d4d70 | Python | zhenyakeg/contest5 | /J.py | UTF-8 | 385 | 3.125 | 3 | [] | no_license | n = int(input())
A = list(map(int,input().split()))
num5 = A.count(5)
num10 = A.count(10)
num50 = A.count(50)
num100 = A.count(100)
num_cur,num_min = 0,0
for i in range (n):
if A[i] == 5:
num_cur+=1
else:
if A[i]//5-1 >= num_cur:
num_min += A[i]//5 - 1 - num_cur
num_cur =... | true |
456e53ca4aa49ca27b6f6599a8647803a761e7d5 | Python | DigoShane/Python | /Basic/ReturnStatement.py | UTF-8 | 463 | 4.21875 | 4 | [] | no_license | # The return statement is useful to return something from the calculation
# of the function back to the main function.
## A function to fid the power of a no. and return it
def powwow(num1,num2):
return num1**num2
print ("Code")
#Note that the return function transfer the flow of the program
#back to the main... | true |
d54f64e09da921befad5cdc4b562cdf07e308762 | Python | Cloema/Polar_plotter | /main.py | UTF-8 | 1,656 | 3.5 | 4 | [] | no_license | # -*- coding: utf-8 -*-
#main.py
#author: Drawbot team CRI - Marion Ficher
#date : october 2019
#version : V1.0
import serial
from drawbot import Drawbot
def ask_function():
try:
choice = int(input("Enter 1 for a line, 2 for a square "))
except ValueError:
print ("Not a digit")
... | true |
fd31a884cbcbb384693e763994c5e58764e8af23 | Python | csuchite/sqlalchemy-challenge | /app.py | UTF-8 | 2,386 | 2.8125 | 3 | [] | no_license | #1. import Flask
import numpy as np
import pandas as pd
import datetime as dt
import sqlalchemy
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import create_engine, func, desc
from flask import Flask, jsonify
engine = create_engine('sqlite:///hawaii.sqli... | true |
ca3f218cfb015fefd852bfeabf9afb63ff514a36 | Python | Muhammad-Ibrahiem-Abdelhameed/Python-for-distributed-systems | /client_rest_api.py | UTF-8 | 434 | 2.515625 | 3 | [] | no_license | import sys
import json
import requests
import fileinput
res = requests.get('http://127.0.0.1:5000/')
print(res.content)
print("===================")
student = requests.get('http://127.0.0.1:5000/student').json()
print(student)
print("===================")
res_file = requests.get('http://127.0.0.1:5000/fil... | true |
abd6edb0fdcd8c6ab9bfd7bd4e83881b631ad438 | Python | natgrimm/mammothSim | /game.py | UTF-8 | 5,952 | 3.984375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Nov 13 12:32:07 2019
@author: richardg71
"""
"""
Course: CS101
File: Game
Project: project04
Author: Mac Allen
Description:
<What does your project/program do?>
"""
"""
Instructions:
Here's your chance to be creative. Write a program that will allow the user... | true |
61ee1819baf172ccb79356b756f6895854cda006 | Python | nackwon/Python_Algorithm | /BOJ_Step03/BOJ_11721.py | UTF-8 | 97 | 3.171875 | 3 | [] | no_license |
str1 = input()
result = '\n'.join(str1[i:i+10] for i in range(0, len(str1), 10))
print(result) | true |
9d8d92fc2e55c20249dd984394faac14af74064e | Python | TusharKanjariya/python-practicles | /8.py | UTF-8 | 252 | 4.25 | 4 | [] | no_license | str1 = input("enter string")
str2 = input("enter string")
if len(str1) != len(str2):
print("Length Not Equal")
print(tuple(zip(str1, str2)))
for x, y in zip(str1, str2):
if x != y:
print("Not Equal")
else:
print("Equal")
| true |
dfad8e905470a5c5d8f6431bee8417763e3756f5 | Python | ameyaditya/SudokuSolver | /Development files/test6.0.py | UTF-8 | 3,890 | 2.546875 | 3 | [] | no_license | from imutils.perspective import four_point_transform
from imutils import contours
import imutils
import numpy as np
import cv2
i = 0
image = cv2.imread("sudoku.jpg")
'''
ratio = image[0]/300.0
print(ratio)
orig = image.copy()
image = imutils.resize(image,height=300)
'''
#blurred = cv2.pyrMeanShiftFiltering(image,31,91)... | true |
2b62d8ee912b14db20266b9628c7a285daf62d36 | Python | JeffersonLab/HDEventStore | /src/EventStoreToolkit/gen_util.py | UTF-8 | 2,222 | 3.140625 | 3 | [] | no_license | #!/usr/bin/env python
#
# Ported to GlueX by Sean Dobbs (s-dobbs@northwestern.edu), 2014
#
# Copyright 2004 Cornell University, Ithaca, NY 14853. All rights reserved.
#
# Author: Valentin Kuznetsov, 2004
#
"""A set of usefull utilities independent from EventStore"""
import os, sys, string, time
def dayAhead():
"... | true |
73939a9874de858e7c02ac59c6bfce96a4fd2f0e | Python | yuukidach/The-Python-Challenge | /level9.py | UTF-8 | 532 | 2.71875 | 3 | [] | no_license | #! /usr/bin/env python3
# -*- coding: utf-8 -8-
__author__ = 'Yuuki_Dach'
import requests
import re
from PIL import Image, ImageDraw
webUrl = 'http://www.pythonchallenge.com/pc/return/good.html'
webContent = requests.get(webUrl, auth=('huge','file')).text
print(webContent)
pattern = re.compile(r"(\d{2,3})")
nums = re... | true |
e2b2b01e5f580bdcf1bb83ba233250bd871c02bc | Python | joacolerer/fiuba | /Algo 2/Trabajos Practicos/tp3/BibliotecaGrafos.py | UTF-8 | 2,724 | 3.46875 | 3 | [] | no_license | from grafo import Grafo
from cola import Cola
# Recibe un grafo y una lista de vertices, si existe una relacion de precedencia entre los vertices
# devuelve una lista ordenada de estos segun corresponda, o None en caso de que se encuentren ciclos o no existan dichos vertices.
def orden_topologico_subgrafo(grafo,lista)... | true |
b50d04b440b66e25847d8456674c63280c090da8 | Python | chunwei0831/porcupine | /binding/python/porcupine.py | UTF-8 | 6,002 | 2.59375 | 3 | [
"LicenseRef-scancode-proprietary-license",
"Apache-2.0"
] | permissive | #
# Copyright 2018-2020 Picovoice Inc.
#
# You may not use this file except in compliance with the license. A copy of the license is located in the "LICENSE"
# file accompanying this source.
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
# an "AS ... | true |
37d0d74d6de529708d2a0c6181bea16ae58a7d88 | Python | daniel-amos/T-201-GSKI-Vor-2020 | /(ADT)Trees/General_Tree.py | UTF-8 | 3,364 | 4.1875 | 4 | [] | no_license | class GeneralTreeNode:
def __init__(self, data = None):
self.data = data
self.children = []
class GeneralTree:
def __init__(self):
''' Need to know what node is the begning'''
self.root = None
def _populate_tree_recur(self, level = 0):
''' A Recursive way to inp... | true |
bca0c7ce48c9220050588b95963e99888bdd8291 | Python | PythonIntec/python.basico | /variables_tipos_de_datos.py | UTF-8 | 1,415 | 4.28125 | 4 | [
"MIT"
] | permissive | #coding: utf-8
print "Saludos aprendiz, a continuación una variable"
variable = "Soy una variable"
print variable
print "Las variables pueden tener cualquier nombre"
aguacate = "Soy un aguacate"
print aguacate
print "Los nombres pueden tener cualquier longitud"
print "Cuando el nombre incluye más de un sustantivo, se... | true |
5bcbc9e6bd9b0d3a742a142cd83e5808d5fe6b39 | Python | harip/python_visualizations | /min_max.py | UTF-8 | 5,372 | 3.40625 | 3 | [] | no_license | """Coursera data science course"""
import calendar as cl
import matplotlib.pyplot as plt
import pandas as pd
DATA_URL = "https://res.cloudinary.com/harip/raw/upload/v1521364790/site/python/minmax.csv"
XLIM = [1, 365]
YLIM = [-40, 50]
def prep_initial_data():
"""Drop unused column and group by columns"... | true |
311489115c91ae710a9969c29991e24946387d47 | Python | AjinkyaTaranekar/AlgorithmX | /Codeforces/266/B.py | UTF-8 | 98 | 2.75 | 3 | [] | no_license | n, t = input().split()
s = input()
for i in range(int(t)):
s = s.replace("BG", "GB")
print(s)
| true |
a02fdfc68bc813032e884deed848327efc842c4d | Python | gavanderlinden/IntroToFlask | /example2/blueprints.py | UTF-8 | 667 | 2.671875 | 3 | [] | no_license | from flask import Blueprint, render_template_string, abort
templates = {
"index": """
<title>flask intro</title>
<p>flask app using blueprints</p>
<a href="./hello">hello</a>
""",
"hello": """
<title>hello page</title>
<p>Hello! Welcome to this Flask introduction</p>
<a href="./">return to index</a>
""",
... | true |
8698e53f043b5577b6c398ca9baf43a1dc3c368b | Python | kzagorulko/client-server | /03/server.py | UTF-8 | 2,380 | 2.796875 | 3 | [] | no_license | import re
from flask import Flask, render_template, request
app = Flask(__name__, template_folder='templates/')
app.config['student_id'] = 0
RE_INT = re.compile(r'^[-+]?[0-9]+$')
RE_FLOAT = re.compile(r'\d+\.\d+|(?<=angle\s)\d+')
students = []
@app.route('/', methods=['GET'])
def index():
return render_templat... | true |
aa18f6f51fcced2bd4d79d1b7b9d14f6073a8d49 | Python | mcv-m6-video/mcv-m6-2021-team5 | /detectron2_tools/io.py | UTF-8 | 7,513 | 2.578125 | 3 | [] | no_license | from detectron2.structures import BoxMode
from detectron2.structures import Instances, Boxes
import xml.etree.ElementTree as ET
import torch
import os
import math
from utils.bb import BB
import random
import numpy as np
class detectronReader():
def __init__(self, xmlfile):
# Parse XML file
tree = E... | true |
02fcd57ae510ae3aea5f551e58f18ef16dfb2c67 | Python | zwzwtao/Deep-Learning | /Tensorflow1.x/NLP/Penn Treebank Dataset(PTB)/vocabulary_generation.py | UTF-8 | 1,485 | 2.796875 | 3 | [] | no_license | import codecs
import collections
from operator import itemgetter
# set MODE to "PTB" or "TRANSLATE_EN" or "TRANSLATE_ZH"
MODE = "PTB"
if MODE == "PTB":
RAW_DATA = "PTB_data/ptb.train.txt"
VOCAB_OUTPUT = "ptb.vocab"
elif MODE == "TRANSLATE_ZH":
RAW_DATA = "TED_data/train.txt.zh"
VOCAB_OUTPUT = "zh.voca... | true |
c7302b96b7c4596929f44ef7bb187d9c82b2deb8 | Python | massadraza/Python-Learning | /multiple_key_sort.py | UTF-8 | 576 | 3.515625 | 4 | [] | no_license | from operator import itemgetter
Stock = [
{"fname" : 'Amanda', 'lname': "Roberts"},
{"fname" : 'Bobby', 'lname' : "Williams"},
{"fname" : 'John', 'lname' : "Allen"},
{"fname" : 'Elon', 'lname' : "Williams"},
{"fname" : 'Don', 'lname' : "Jones"},
{"fname" : 'Bobby', 'lna... | true |
6dc3ff16853d5e4f7ce31274625885994dbc0836 | Python | timoButtenbruck/microRay | /gui/graphicItems/symbols/derivativeFunction.py | UTF-8 | 1,441 | 2.59375 | 3 | [] | no_license | # -*- encoding: utf-8 -*-
from PyQt4 import QtGui, QtCore
class DerivativeFunctionBlock(QtGui.QGraphicsItem):
def __init__(self, parent=None):
super(DerivativeFunctionBlock, self).__init__(parent)
self.boundingRectPath = QtGui.QPainterPath()
self.boundingRectPath.addRect(0, 0, 50, 50)
... | true |
5ae892d0dc560a294ec7ce6a81b3a0267171bf2e | Python | gahakuzhang/PythonCrashCourse-LearningNotes | /7.user input and while loops/7.2.3 using a flag.py | UTF-8 | 324 | 3.8125 | 4 | [] | no_license | #7.2.3 using a flag 标志
# 注意True和False首字母要大写
prompt="\nTell me something, and I will repeat it back to u: "
prompt+="\nEnter 'quit' to end of this program. "
active=True
while active:
message = input(prompt)
if message=='quit':
active=False
else:
print(message)
| true |
40ef4231c25cff57f47fa72f91dc6af96d25cd71 | Python | jiivan/crypto-tax | /crypto_tax/parse_nbp.py | UTF-8 | 2,253 | 2.984375 | 3 | [
"MIT"
] | permissive | #/usr/bin/env python3
import csv
import datetime
import decimal
import itertools
from crypto_tax import db
from crypto_tax import models
def import_path(p):
state = 'header'
data = []
currency_names = []
amounts = []
with open(p, newline='', encoding='cp1250') as f:
reader = csv.reader(f... | true |
81988727f22b111a8a834dea104264af6aa72828 | Python | MTN111/AWO121-Full | /LinkedinScraper/demographics.py | UTF-8 | 3,205 | 2.59375 | 3 | [] | no_license | import requests
import json
import datetime
import codes
from linkedin_hist_data import db_settings
# Linkedin page credentials
LINKEDIN_KEY='77v2ofy2by41vh'
LINKEDIN_SECRET='763AeuKRTgaq6rjN'
LINKEDIN_PAGE_ID=5005117
API_URL = 'https://api.linkedin.com/v1/companies/{0}/company-statistics'
API_FOLLOWS_URL = 'https:/... | true |
b0de7065eec0f5f1902dc3a584bc4518d33413af | Python | Aasthaengg/IBMdataset | /Python_codes/p02995/s019692508.py | UTF-8 | 194 | 2.828125 | 3 | [] | no_license | from math import gcd
A, B, C, D = map(int, input().split())
E = C*D//gcd(C, D)
c1 = (B//C)-((A+C-1)//C)+1
c2 = (B//D)-((A+D-1)//D)+1
c3 = (B//E)-((A+E-1)//E)+1
ans = B-A+1-c1-c2+c3
print(ans)
| true |
9e581e556d2c37ab99ad36b92703c8394d3b7621 | Python | jflaboe/Project-Euler | /Euler9.py | UTF-8 | 125 | 3.15625 | 3 | [] | no_license | for a in range(1,500):
for b in range(1,500):
if a**2 + b**2 == (1000-a-b)**2:
print(a*b*(1000-a-b)); | true |
e0411f97356b9f4cc79da26acb71b915e55bedae | Python | gchetrick/honeyports | /honeyports-0.5.py | UTF-8 | 6,319 | 2.796875 | 3 | [] | no_license | #!/usr/bin/python
# Author: Paul Asadoorian, PaulDotCom/Black Hills Information Security
# Contributors: Benjamin Donnelly, BHIS;Greg Hetrick, PaulDotCom
# Date: 7/28/13
# Description: This script listens on a port. When a full connection is made to that port
# Honeyports will create a firewall rule block... | true |
49e2bb6b7ccb96d47b732dbcd2ebc9bb1d38adcb | Python | DerHabicht/RedROVOR | /redrovor/frameTypes.py | UTF-8 | 3,207 | 2.9375 | 3 | [] | no_license | #!/usr/bin/python
import pyfits
import sys
import os
import os.path
from collections import defaultdict
import obsDB
from fitsHeader import isFits, getFrameType, getObjectName, splitByHeader
def getFrameLists(fileList):
'''given an iterator of filenames, go through each one,
get the the type of the frame and ad... | true |
5cc1c9c3d78dea04741925056f98ce47e6743f5d | Python | JamesBondOOO7/Competitive-Programming | /B/BurglarAndMatches.py | UTF-8 | 304 | 2.859375 | 3 | [] | no_license | n,m = [int(i) for i in input().split()]
match = []
for i in range(m):
match.append([int(j) for j in input().split()])
match.sort(key=lambda a : a[1], reverse=True)
ans = 0
idx = 0
while idx<m and n>0:
ans += match[idx][1]*(min(n, match[idx][0]))
n -= match[idx][0]
idx += 1
print(ans) | true |
16555a00e36ada6a3b84021ae9d6869b87e72807 | Python | gideon59a/Game-G4InRow | /PlayClient.py | UTF-8 | 4,089 | 2.609375 | 3 | [] | no_license | '''
Created on Oct 2017, started with old "PlayerMain.py" @author: Gideonmessage sent
This is a branch test1111
'''
import socket
import sys
import queue
sys.path.append('../') #this has been added so can be found in cmd window
TCP_PORT=50002
from G4InRow.gls import gameover
import G4InRow.gls as gls
import G4InRow.... | true |
1eea8cc474561fe900cdea14bf7163c395e3501d | Python | gabrieltseng/datascience-projects | /natural_language_processing/machine_translation/translate/model/seq2seq.py | UTF-8 | 6,771 | 2.765625 | 3 | [] | no_license | import torch
from torch import nn
import random
from ..data import BOS_TOKEN, EOS_TOKEN
class Attention(nn.Module):
def __init__(self, rnn_hidden_size):
super().__init__()
self.hidden_linear = nn.Linear(in_features=rnn_hidden_size, out_features=rnn_hidden_size)
self.total_linear = nn.Lin... | true |
9e28e02485e75cf0dc76d395c64624129a9e5cb6 | Python | CatarinaBrendel/Lernen | /curso_em_video/Module 2/exer041.py | UTF-8 | 586 | 3.390625 | 3 | [] | no_license | from datetime import date
print "\033[1;32m-=\033[m" * 20
print" Bem-Vindo a Federacao de Natacao"
print "\033[1;32m-=\033[m" * 20
print' '
print"Deixe-me selecionar sua categoria"
idade = int(raw_input("Diga-me o ano em que nasceu: > "))
idadea = date.today().year - idade
print "Voce agora tem {} anos".format(id... | true |
d30263b573979ff0c5fea820afe5dc5542edf124 | Python | hardy-12/hardik-panchal | /all_tasks/day_4_tasks/function_multirtn.py | UTF-8 | 136 | 2.890625 | 3 | [] | no_license | def getFullname():
fName = "Hardik"
lName = "Panchal"
return fName, lName
fName, lName = getFullname()
print(fName, lName)
| true |
51bb18ee5547b00ee5ef9301d453e4ad286e3f5b | Python | BomDia12/EstruturasDeDados | /Questionario4/01.py | UTF-8 | 227 | 2.546875 | 3 | [] | no_license | def altura(raiz):
def recursive(raiz):
if raiz is None:
return -1
return max(recursive(raiz.esq), recursive(raiz.dir)) + 1
result = recursive(raiz)
return result if result > 0 else 0
| true |
4ad28239ab977793215b41bbfce578d7a5e52ba1 | Python | michalzielinski913/PhysicsLab | /MonteCarlo/wykresy.py | UTF-8 | 1,430 | 3.0625 | 3 | [] | no_license | import numpy as np
import plotly.express as px
from sklearn.linear_model import LinearRegression
import plotly.graph_objects as go
#Circumference
x1 = np.array([7.4, 7.52, 8, 5.3, 4.86, 5.14, 25.84, 22.72, 46.08, 21.3])
#Diameter
y1 = np.array([2.28, 2.52, 2.62, 1.68, 1.56, 1.52, 8.12, 7.16, 14.62, 6.52])
ex = [0.061,
... | true |
e66e6f642e2359edda2edfd471cc67af7c6454d0 | Python | vishantbhat/myfiles | /cats_with_hats.py | UTF-8 | 384 | 3.859375 | 4 | [] | no_license | ## Cats with Hats
# 100 cats with hats ON
cats = {}
for i in range(1, 101):
cats['cat' + str(i)] = "OFF"
for round in range(1, 101):
for cat in range(1, 101):
if cat % round == 0:
if cats['cat' + str(cat)] == "OFF":
cats['cat' + str(cat)] = "ON"
else:
cats['cat' + str(cat)] = "OFF"
for c, hats ... | true |
8b5da4de8a819cf64a24c6e616a3842ac80315dc | Python | xstrengthofonex/social-networking-kata | /social_network/posts/use_cases/create_post.py | UTF-8 | 1,652 | 2.5625 | 3 | [] | no_license | from dataclasses import dataclass
from datetime import datetime
from social_network.common import boundary
from social_network.posts import post
from social_network.posts import posts
from social_network.users import user
from social_network.users import users
@dataclass(frozen=True)
class Request(boundary.Request):... | true |
303d546ff6dbfb324d5fcb2716aff9fb05510116 | Python | Joyer0099/Leetcode | /Medium/Python/SortingAndSearching/SearchRange.py | UTF-8 | 372 | 3.09375 | 3 | [] | no_license | class Solution(object):
def searchRange(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
try:
left = nums.index(target)
right = len(nums) - 1 - nums[::-1].index(target)
except:
... | true |
56ddb0e8e493abae54ab1be6c0ecfc6f5f211d44 | Python | taariksiers/udemy-complete-python-bootcamp | /Section19_Python2_Material/Lecture140_LambdaExpressions.py | UTF-8 | 1,241 | 4.4375 | 4 | [] | no_license | # create anonymous / ad-hoc function - for simple functionss
# start off with standard def and refine
def square(num):
result = num**2
return result
print 'square(2)={n}' . format(n=square(2))
def square2(num):
return num**2
print 'square2(2)={n}' . format(n=square2(2))
def square3(num): return num**2
... | true |
46c08fbd10f6ade1477e337927d46289cdb49fc7 | Python | winni2k/abeona | /tests/test_acceptance/test_subgraphs.py | UTF-8 | 1,904 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | import collections
from hypothesis import given, strategies as strat
from abeona.test.drivers import SubgraphTestDriver
SeqTup = collections.namedtuple('SeqTup', ['seq', 'kmers'])
@given(strat.sets(
strat.sampled_from([
SeqTup('AAAT', ('AAA', 'AAT')),
SeqTup('ATCC', ('ATC', 'GGA')),
Seq... | true |
1942847fb4feb2be0337b477304bcccef659103a | Python | jgsimard/COMP767 | /hw2/function_approximation.py | UTF-8 | 3,826 | 2.90625 | 3 | [] | no_license | import numpy as np
import gym
class ApproximationFunction:
#feature vector
def get_state_feature_vector(self, s):
pass
def get_state_action_feature_vector(self, s):
pass
#value
def get_state_value(self, s, w):
pass
def get_state_action_value(self, s, a, w):
p... | true |
8da62ed4156f9e3c8807089d65e300c89fc86bdf | Python | daniel-reich/ubiquitous-fiesta | /Z8REdTE5P57f4q7dK_17.py | UTF-8 | 237 | 3.140625 | 3 | [] | no_license |
def collatz(n):
collatz_lst = []
while(n > 1):
if n%2 == 0:
n = n//2
collatz_lst.append(n)
else:
n = 3*n+ 1
collatz_lst.append(n)
collatz_lst.append(1)
return (len(collatz_lst),max(collatz_lst))
| true |
02ed4e9c842f2a3926521e9c7fd38c4f45056be8 | Python | monoidic/cryptopals-solutions | /part1/task05.py | UTF-8 | 407 | 3.328125 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
from mystuff import repeating_key_xor
# in:
# "Burning 'em, if you ain't quick and nimble"$'\n'"I go crazy when I hear a cymbal"
# 'ICE'
# out:
# 0b3637272a2b2e63622c2e69692a23693a2a3c6324202d623d63343c2a26226324272765272a282b2f20430a652e2c652a3124333a653e2b2027630c692b2028316528632... | true |
eec0d5b16cc50a9d4d8e3afe434e9c22d5e603a1 | Python | aliceeli/Python_TTA | /Week 3/numbers write.py | UTF-8 | 453 | 4 | 4 | [] | no_license | # Write program input 4 numbers and stores then
# create txt file called numbers
# input the numbers
# write numbers to numbers.txt
#close file
num_1 = input("Please enter your first number: ")
num_2 = input("Please enter your second number: ")
num_3 = input("Please enter your third number: ")
num_4 = input("Please ... | true |
190558685a97b211d457f8fe7f338d86f8352d95 | Python | mk-dir/python | /Python/dictionary.py | UTF-8 | 415 | 2.8125 | 3 | [] | no_license |
userDetails={
"Name":"Alex Hunter",
"age": 16,
"Languages":["Kisw","Eng","Meru","python"],
"school":{
"pri":"ABC",
"Seco":"123",
"uni":"dy/dx"
},
"parents":{
"father":{
"fName":"Papa",
"lName":"Duck",
},
"mother":{
... | true |
dc42f9b84f73f20f9756bd3692c77c59a222bed8 | Python | tsnaomi/chinese-mt | /code/ngram.py | UTF-8 | 4,651 | 3.3125 | 3 | [] | no_license | import math
import nltk
from _ngrams import unigrams, bigrams, trigrams, total
CORPUS = nltk.corpus.brown.sents(categories=nltk.corpus.brown.categories())
class Train:
def __init__(self, corpus=CORPUS):
self.unigrams = {'UNK': 0, }
self.bigrams = {('UNK', 'UNK'): 0, }
self.trigrams = {... | true |
ec13f5fe96eac7e84d36162336ba4e1f277caec8 | Python | juanPabloCesarini/cursoPYTHON2021 | /Seccion 9/metodos_especiales.py | UTF-8 | 566 | 3.765625 | 4 | [] | no_license | class Auto:
def __init__(self, marca, km , modelo): #---> metodo constructor
self.marca = marca
self.km = km
self.modelo = modelo
print("Se creó el objeto Auto", self.marca)
def __del__(self): #---> metodo destructor
print("Se destruyó objeto auto", self.marca)
... | true |
0858bea5581a8526dafbaf206f050bfa9ee2ae4c | Python | jmh9876/p1804_jmh | /1804/git/2-第二个月高级python/1/5-游标位置.py | UTF-8 | 1,021 | 3.4375 | 3 | [] | no_license | f=open('5.txt','w')
f.write('红豆生南国\n')
f.write('春来发几枝\n')
f.write('愿君多采霞\n')
f.write('此物最相思\n')
f.close()
f=open('5.txt','r')
c=f.readline()
p=f.tell()
print('读取第一行的内容是:%s'%c)
print('读取第一行的游标位置是:%d'%p)
c=f.readline()
p=f.tell()
print('读取第二行的内容是:%s'%c)
print('读取第二行的游标位置是:%d'%p)
c=f.readline()
p=f.tell()
print('读取第三行的内容... | true |
49bc9a884b49cb047ebbcab0e04970497b9dce55 | Python | LKWBrando/CP1404 | /practical2/exceptionExample.py | UTF-8 | 566 | 3.953125 | 4 | [] | no_license | try:
numerator = int(input("Enter the numerator: "))
denominator = int(input("Enter the denominator: "))
fraction = numerator / denominator
except ValueError:
print("Numerator and denominator must be valid numbers!")
except ZeroDivisionError:
print("Cannot divide by zero!")
print("Finished.")
#1. V... | true |
a613d3d89e104c5691e681c1cb42e0442fd4f7f3 | Python | Aasthaengg/IBMdataset | /Python_codes/p03168/s137579656.py | UTF-8 | 469 | 2.796875 | 3 | [] | no_license | import sys
stdin = sys.stdin
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))
def naa(N): return [na() for _ in range(N)]
def ns(): return stdin.readline().rstrip() # ignore trailing spaces
N = ni()
p_array = list(map(float, stdin.readline().split()))
dp = [0] * (N+1)
d... | true |
7de2ee9efdc4d7953904299f0450ce78886ba226 | Python | nekohor/pondo2 | /pondo2/tables/generate_tables.py | UTF-8 | 1,978 | 2.6875 | 3 | [] | no_license | import pandas as pd
import numpy as np
import json
# generate partTable
df = pd.read_excel("partTable.xlsx")
part_dict = {}
part_dict["partTable"] = []
line_list = df["LINE"].unique()
for i, line in enumerate(line_list):
part_dict["partTable"].append({})
part_dict["partTable"][i]["line"] = int(line)
part... | true |
0731d9ce50233fb80b3964c4e2c6d84099f885e8 | Python | okada1220/100knock | /100knock_chapter4/100knock_chapter4_38.py | UTF-8 | 918 | 2.828125 | 3 | [] | no_license | import re
import pprint
import collections
import matplotlib.pyplot as plt
import seaborn as sns
morph = []
with open('neko.txt.mecab', 'r', encoding='utf-8') as f:
for line in f:
if not line == 'EOS\n':
info = re.split(r'\t|,', line)
key_list = {}
key_list['surface'] = ... | true |
d5eb3f6ca955c1c348dc8b04ec37fddebd6f8b30 | Python | heejung-choi/python | /public/public_mask.py | UTF-8 | 894 | 2.890625 | 3 | [] | no_license | # pip install requests
import requests
from pprint import pprint
# 깔끔하게 보이기 위해 pprint
def mask(address, n=10):
URL='https://8oi9s0nnth.apigw.ntruss.com/corona19-masks/v1/storesByAddr/json'
params = f'?address={address}'
response = requests.get(URL+params)
#print(response.content)
stores = respons... | true |
0ded6ce44cde7c316c6e82525ffa1034f6e01557 | Python | adarsh415/Yelp-Sentiment-Analysis-TensorFlow | /word2vec_embed.py | UTF-8 | 3,594 | 2.640625 | 3 | [] | no_license |
import tensorflow as tf
import numpy as np
from process_data import process_data
import os
vocabulary_size=50000 # size of vocabulary
embedding_size=300 # size of embedding
batch_size=64 # batch size
skip_window=1 # How many words to consider left and right
num_skip=2 # How many time to reuse imput to genera... | true |
093383522e4594ddd6178a60184145aec698bd2d | Python | tiandiyijian/CTCI-6th-Edition | /03.06.py | UTF-8 | 1,122 | 3.65625 | 4 | [] | no_license | import collections
class AnimalShelf:
def __init__(self):
self._dog = collections.deque()
self._cat = collections.deque()
def enqueue(self, animal: List[int]) -> None:
if animal[1] == 0:
self._cat.append(animal)
else:
self._dog.append(animal)
def ... | true |
d145a8c29dce076b26780eb4bc12e5f69b1b817e | Python | jedgar74/GAKMC | /Estacion.py | UTF-8 | 10,570 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 8 11:41:13 2021
@author: tauger
"""
from Vehiculo import *
import statistics
class Estacion(object):
def __init__(self, name, id_est=None, nv=0):
self.nv = nv
self.id_est = id_est
self.name = name
self.em... | true |
c0a48f105522c6e29784e0150af917aab4ee3dff | Python | kapitsa2811/homographynet | /predict.py | UTF-8 | 2,734 | 2.515625 | 3 | [] | no_license | '''
Author: Richard Guinto
Project: DeepHomography
Dependencies: keras
Usage: python <this file>
'''
import os.path
#import glob
import numpy as np
from keras.models import load_model
#from keras.layers import Activation, Dense, Dropout, Conv2D, MaxPooling2D, Flatten, BatchNormalization, InputLayer
from keras import... | true |
e0d57587a32d2e7c36357b58592736a08a10b842 | Python | junwei-wang/project-euler | /001-100/20/20.py | UTF-8 | 130 | 2.625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
from math import log
v = reduce(lambda x, y: x*y, [i for i in range(1, 101)])
print sum(map(int, str(v)))
| true |
4d5c4c1f6976e524440b9c66584303578ab3dbb8 | Python | AK-1121/code_extraction | /python/python_18467.py | UTF-8 | 88 | 2.640625 | 3 | [] | no_license | # Python "in" operator speed
list - Average: O(n)
set/dict - Average: O(1), Worst: O(n)
| true |
b9abeeef757047eb589064cb9d367715c6882acf | Python | daniel-reich/ubiquitous-fiesta | /hzs9hZXpgYdGM3iwB_19.py | UTF-8 | 280 | 3.125 | 3 | [] | no_license |
def alternating_caps(txt):
i, lst = 0, []
for x in txt.split():
s = ''
for ch in x:
if not i%2:
s+=ch.upper()
else:
s+=ch.lower()
i+=1
lst.append(s)
return ' '.join(lst)
| true |
60f235b7114d7b354c60731579380b419b5716bf | Python | Mark-Na/My_Code | /Python_Course/boolean_conditionallogic.py | UTF-8 | 1,023 | 4.40625 | 4 | [] | no_license | # if condition is True:
#do something
#elif some other condition is True:
# do something
#else:
#do something
name = "Jon Snow"
if name == "Arya Stark":
print("Valar Morghulis")
elif name == "Jon Snow":
print("You know nothing")
else:
print("Carry on")
# x=1
# x is 1 #True, truthy
# x is 0 #Fal... | true |
f81c05be3f8e9e6cde171098a314786b6e406565 | Python | yichaogan/LPR | /models/svm/char_recognition.py | UTF-8 | 4,230 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
import os
import random
from PIL import Image
import string
# from sklearn import svm
import time
# from sklearn.externals import joblib
classfies = []
def get_labels():
dict_labels = {}
list_labels = []
for i in range(10):
dict_labels[i] = i
for word in string.ascii_upperca... | true |
98d9dca9e7b963185358ce73494625a122e66527 | Python | koliveiraba/TheInternetAutomationChallenge | /scroll_infinito.py | UTF-8 | 494 | 2.8125 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
def find_the_end(browser: webdriver):
page_loaded = browser.execute_script("return document.readyState")
if page_loaded == "complete":
body = browser.find_element_by_css_selector('body')
body.send_keys(Keys.PAGE_DOW... | true |
1fe9e44c63a0d3469a07831f3bbd8b3b7d77617f | Python | mikegordo/lottery-checker-py | /freqa.py | UTF-8 | 1,030 | 3.0625 | 3 | [] | no_license | class FrequencyAnalyser(object):
def analyse(self, data):
numbers = [[0 for __ in range(0, 6)] for __ in range(0, 76)]
mballs = [0 for __ in range(0, 16)]
for item in data:
for pos, num in enumerate(item['numbers']):
numbers[num][pos+1] += 1
mballs[i... | true |
c2b550695a95542d3e001c47e13033cdfe64c799 | Python | ryhanahmedtamim/pattern_recognition | /lab3/yest_plot.py | UTF-8 | 1,778 | 3.078125 | 3 | [] | no_license | from scipy.io import arff
from operator import itemgetter
import math
import statistics
import matplotlib.pyplot as plt
allK = [1, 5, 10, 20, 30]
data = arff.loadarff("yeast_train" + '.arff')
global data_frame
data_frame = data[0]
global instances
def knn(k):
instances = 0
correct = 0
train_data_frame... | true |
2f7360396d9a3623e5eab1034829fe9db79fab3a | Python | KaluEmeKalu/cracking_the_coding_interview_python_solutions | /ch1_arrays_and_strings/q1_is_permutation.py | UTF-8 | 914 | 3.5 | 4 | [] | no_license | import unittest
class isPerm():
def run1(self, word1, word2):
sorted_word1 = sorted(word1)
sorted_word2 = sorted(word2)
if sorted_word1 == sorted_word2:
return True
return False
def run2(self, word1, word2):
def make_arr(word):
arr = [0] * 128... | true |
619dd8a1e28146866beee738dff55a628a912bab | Python | jtharris85/CCI_Baseline.py | /CCI_Baseline/CCI_Baseline.py | UTF-8 | 8,065 | 2.65625 | 3 | [] | no_license | import pandas as pd
import numpy as np
from google.cloud import bigquery
from .constants import *
version = '1.0.0'
class QueryRuns:
def __init__(self, project, query):
self.query = query
self.client = bigquery.Client(project=project)
def run_query(self):
query_job = self.client.quer... | true |
5cf4a7e80ea6e8d81290b4e80bda636b1a3d32fa | Python | kopok2/CodeforcesSolutionsPython | /src/682A/test_cdf_682A.py | UTF-8 | 2,371 | 2.59375 | 3 | [
"MIT"
] | permissive | import unittest
from unittest.mock import patch
from cdf_682A import CodeforcesTask682ASolution
class TestCDF682A(unittest.TestCase):
def test_682A_acceptance_1(self):
mock_input = ['6 12']
expected = '14'
with patch('builtins.input', side_effect=mock_input):
Solution = Codefo... | true |
fe2a7fc265c83a7347481f8fa004f21140421c64 | Python | Neeky/chanceClient | /chanceClient/spiders/chinaclear.py | UTF-8 | 865 | 2.671875 | 3 | [] | no_license | import scrapy
from datetime import datetime
now =datetime.now()
class InvestorOverviewItem(scrapy.Item):
newlyAddInvestors=scrapy.Field()
endInvestors =scrapy.Field()
pushDate =scrapy.Field()
def convert(self):
datas=dict(self)
res ={}
assert len(datas['newly... | true |
bdfff961d5d5d3890acf21addd0254a32775e2ca | Python | deepio/pybagit | /examples/newbag.py | UTF-8 | 3,464 | 2.78125 | 3 | [
"CC-BY-4.0",
"MIT",
"CC-BY-3.0"
] | permissive | # The MIT License
#
# 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, publish, distribute, sublicense... | true |
1664cc7654af7c04e4ba8006ef313e17b5d62f03 | Python | yizhongw/tf-qanet | /src/vocab.py | UTF-8 | 4,515 | 2.734375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: yizhong
# created_at: 17-5-2 下午3:47
import h5py
import json
import numpy as np
class Vocab(object):
def __init__(self, filename=None, lower=False):
self.id2token = {}
self.token2id = {}
self.token_cnt = {}
self.use_lowercase =... | true |
7c4cd5f280f413a5c9eb8442b7c6910999fcf79f | Python | jakehoare/leetcode | /python_1_to_1000/650_2_Keys_Keyboard.py | UTF-8 | 1,271 | 3.71875 | 4 | [] | no_license | _author_ = 'jake'
_project_ = 'leetcode'
# https://leetcode.com/problems/2-keys-keyboard/
# Initially on a notepad only one character 'A' is present. You can perform two operations on this notepad for each step:
# Copy All: You can copy all the characters present on the notepad (partial copy is not allowed).
# Paste... | true |
b1b7856bcf1143416443e0f9143fde31c5cd0feb | Python | ankit-119/acadview-assignements | /important methods/ques1.py | UTF-8 | 151 | 3.59375 | 4 | [] | no_license | lst1=[]
n=int(input("enter the no of elements"))
for i in range(0,n):
x=input("enter the elements")
lst1.append(x)
lst1.reverse()
print(lst1)
| true |