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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d787ce4f0f9b811a3e34d491d5a2612fde73ec72 | Python | wit543/wsp-lab1 | /convert.py | UTF-8 | 138 | 2.53125 | 3 | [] | no_license |
doc = open('all rounte')
a = []
for line in doc:
split_line = line.split(">",1)
a.append(split_line[1].split(" ",1)[0])
print(a)
| true |
5f67a8093a7b9a381f829dd1e991bf9e7c900ef9 | Python | owfm/reqs | /services/users/project/tests/utils.py | UTF-8 | 11,454 | 2.59375 | 3 | [] | no_license | # services/users/project/tests/utils.py
from project import db
from project.api.models import User, Req, School, Room, Classgroup, Lesson,\
Site
from project.api.excel import extract_users, extract_lessons
from project.api.constants import TEACHER, TECHNICIAN, DATETIME_FORMAT,\
TIME_FORMAT, HalfTerm
from proje... | true |
89cd04d87dca351696793eeb4775e043e41f19c4 | Python | iCorv/one_octave_resnet | /pop_utility.py | UTF-8 | 6,532 | 2.890625 | 3 | [] | no_license | """Utility methods used in the project
"""
import numpy as np
def find_onset_frame(onset_in_sec, hop_size, sample_rate):
"""Computes the frame were the onset is nearest to the start of the frame."""
frame_onset_in_samples = onset_in_sec * sample_rate
onset_in_frame = frame_onset_in_samples / hop_size
... | true |
57c0664618bebabcedabad541138b6b07533366c | Python | MichaelDelaney/PokerBot | /src/database.py | UTF-8 | 2,998 | 2.625 | 3 | [] | no_license | import sqlite3
db = sqlite3.connect('pokerbot.db')
db.execute('CREATE TABLE actions (id integer NOT NULL PRIMARY KEY AUTOINCREMENT, "action" varchar(255) NOT NULL);')
db.execute('CREATE TABLE board_ranks (id integer NOT NULL PRIMARY KEY AUTOINCREMENT, cards integer NOT NULL);')
db.execute('CREATE TABLE hand_ranks (id ... | true |
43dc11a8dd7c5fa07bca0100e66e7371e83ec78c | Python | rz1993/sumzero | /scraper/news_api_crawler.py | UTF-8 | 1,387 | 2.859375 | 3 | [] | no_license | # News API crawler to retrieve news article meta data from sources
import requests
from datetime import datetime, timedelta
NEWS_ENDPOINT = "https://newsapi.org/v2/everything"
def get_news(sources, api_key, from_date=None, to_date=None, language="en", sort_by="publishedAt", pages="all"):
if from_date is None:
... | true |
4e19b5f8d631bbcf5c4cd0a048f0ad0c53d8f25a | Python | Thauks/storage-room | /webcam.py | UTF-8 | 453 | 2.625 | 3 | [] | no_license | import cv2
import time
cap = cv2.VideoCapture(0)
out = cv2.VideoWriter('outpy.avi',cv2.VideoWriter_fourcc('M','J','P','G'), 25, (int(cap.get(3)),int(cap.get(4))))
while True:
l, frame = cap.read()
cv2.imshow('test', frame)
out.write(frame)
key = cv2.waitKey(1)
fps = cap.get(cv... | true |
0e46c4af496bb3c679586972abdc29ee4f83ba26 | Python | developyoun/AlgorithmSolve | /solved/2805.py | UTF-8 | 325 | 3.21875 | 3 | [] | no_license | N, goal = map(int, input().split())
numbers = list(map(int, input().split()))
left, right = 1, max(numbers)
while left <= right:
mid = (left + right)//2
cnt = 0
for num in numbers:
if num > mid: cnt += num - mid
if cnt >= goal:
left = mid+1
else:
right = mid-1
print(r... | true |
c442f50015b808110bc6ed0af870df1ea1d81d33 | Python | amitks815/pycode | /python/inheritance.py | UTF-8 | 750 | 3.40625 | 3 | [] | no_license | class vehical:
def general_usage(self):
print('general use : transportation')
class car(vehical):
def __init__(self,wheel):
self.wheel=wheel
self.has_roof='true'
def specific_usage(self):
print('used for work transport')
class bike(vehical):
def __init__(self, wh... | true |
3694d5c59214e20c4bc08881ac509911c4b9da12 | Python | ja-odur/Book-A-Meal_api | /app/v1/models/menu.py | UTF-8 | 3,906 | 2.828125 | 3 | [] | no_license | from app.v1.models.db_connection import DB, IntegrityError, UnmappedInstanceError
from app.v1.models.meal import Meal
from app.v1.models.caterer import Caterer
class Menu(DB.Model):
"""
This class stores information about the menu of the day created by registered caterers.
"""
__tablename__ = 'men... | true |
f72265236c52b582310af83b28fe2bdfa28b9630 | Python | judepereira/arcus.ml | /tests/test_images_conversion.py | UTF-8 | 1,480 | 2.703125 | 3 | [
"MIT"
] | permissive | import sys
import os
import pytest
import pandas as pd
import arcus.ml.images.io as ami
import arcus.ml.images.conversion as conv
import logging
import numpy as np
image_path = 'tests/resources/images/lungs'
def test_black_white_conversion():
image_list = ami.load_images(image_path)
ls = conv.to_blackwhite(... | true |
339e76b2d1180a1b0506a40e215513f9f26a9c90 | Python | Aasthaengg/IBMdataset | /Python_codes/p03387/s788191257.py | UTF-8 | 238 | 3.359375 | 3 | [] | no_license | A = list(map(int, input().split()))
A.sort()
ans = 0
tmp = A[2] - A[1]
ans += tmp
A[0] += tmp
if (A[2] - A[0]) % 2 == 0:
tmp = (A[2] - A[0]) / 2
ans += tmp
else:
tmp = (A[2] - A[0] + 1) / 2 + 1
ans += tmp
print(int(ans)) | true |
1291674fb75db14d0cbe4c455f562bc645915ebd | Python | Super10veBug/rrfa-pfch-2019 | /wip_extents_and_more_rrfa02.py | UTF-8 | 2,578 | 2.609375 | 3 | [
"MIT"
] | permissive | import xml.etree.ElementTree as etree
import re
import csv
ElementTree = etree.parse('RRFA.02.TEST_ead.xml')
root = ElementTree.getroot()
# print(root)
# for a in root:
# print(a)
# for b in a:
# print(b)
# for c in b:
# print(c)
# for d in c:
# print(d)
# for e in d:
# print(e)
result_lis... | true |
c10d1c944249eda5eb8a6c97f9f58da23504740d | Python | Zen-CODE/zenplayer | /zenplayer/components/playlist.py | UTF-8 | 6,868 | 3.21875 | 3 | [
"MIT"
] | permissive | from kivy.event import EventDispatcher
from os import sep, path, listdir
from os.path import exists
from kivy.properties import ( # pylint: disable=no-name-in-module
NumericProperty, ListProperty)
from components.filedrop import FileDrop
from components.filesystemextractor import FileSystemExtractor
class Playli... | true |
1d86223205fbc0b98ede056bf5a53242a2914d84 | Python | Praveeeenn/Supernova | /models/user.py | UTF-8 | 1,375 | 2.8125 | 3 | [] | no_license | from helpers import utils
from helpers.db import MongoDB
def get_collection():
mongo_db = MongoDB("master_db")
return mongo_db.db["user"]
class User:
def __init__(self, **kwargs):
pass
@staticmethod
def create(**kwargs):
# validations
if User.get_user_by_email(kwargs["e... | true |
e3e8cced59d501c973eae7d695338ed4f96f9dbb | Python | ipcoo43/algorithm | /lesson123.py | UTF-8 | 133 | 3.3125 | 3 | [] | no_license | prime=[]
for i in range(2,101):
cnt = 0
for j in range(1,i):
if i%j == 0:
cnt += 1
if cnt < 2:
prime.append(i)
print(prime) | true |
cf811e6fdd4daaac44e7949bd57c27b31a06fafa | Python | TomFinley-scratch/Astronomical | /body.py | UTF-8 | 45,797 | 3.5625 | 4 | [] | no_license | """
Typically, all arguments of time are in terms of day numbers, a float
indicating the number of solar days since the start of the J2000
epoch. For convenience sake, a convenience function
Convert.date2day_number is provided.
All angular arguments are typically in units of A rather irritating
situation in astronom... | true |
5c9d3d79c59ac4e3a7fbfb2affd2fb9ffccaec73 | Python | Ikeda-Togo/DPmatching_python | /dpm.py | UTF-8 | 2,288 | 2.75 | 3 | [] | no_license | import numpy as np
import math
#import matplotlib.pyplot as plt
#np.set_printoptions(precision=10)
#データの選択
temp=12
samp=22
sam=0.0
count=0
#テンプレート読み込み
for i in range(100):
number01=i+1
data01=np.loadtxt("./city0{0}/city0{0}_{1:03d}.txt".format(temp,number01),skiprows=3)
frame01=data01.shape[0]
dim01=data01.shape[... | true |
8395df9cf03b2cf5799c575d8bb97d864b50f656 | Python | azozello/swe | /graphs_related/coloring.py | UTF-8 | 4,130 | 3.171875 | 3 | [] | no_license | import networkx as nx
from time import time
import matplotlib.pyplot as plt
from enum import Enum
class Color(Enum):
BLUE = "b"
GREEN = "g"
RED = "r"
CYAN = "c"
MAGENTA = "m"
YELLOW = "y"
BLACK = "k"
WHITE = "w"
class Node:
def __init__(self, color=None, value=0, neighbours=None... | true |
7814dae89a717d4bedc193d039520f5f908ff62b | Python | keyi/Leetcode_Solutions | /Algorithms/Python/Word-Search.py | UTF-8 | 1,401 | 3.203125 | 3 | [] | no_license | class Solution(object):
def exist(self, board, word):
"""
:type board: List[List[str]]
:type word: str
:rtype: bool
"""
def isValid(board, i, j, target):
if i < 0 or i >= len(board) or j < 0 or j >= len(board[0]) or board[i][j] == '#' or board[i][j] != ta... | true |
4b0ad40ceefb1425d98c5e0ac50b234632ca1a05 | Python | blakexcosta/hackatticunpack | /unpackme.py | UTF-8 | 1,861 | 3.171875 | 3 | [] | no_license | import base64
import json
from pprint import pprint
def createJSON():
return "hell0:"
"""
Takes in a converted base64 string and returns:
signed int, unsigned int, short, float, double, and another double in big endian.
In that order. Separated by a '_'. Uses 4 bytes ints in 32 bits
"""
def manipulate(data):
... | true |
5cc3fcf06597623876b43026ee6cf40dc4da74d7 | Python | JosephLevinthal/Research-projects | /5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/224/users/4446/codes/1734_2505.py | UTF-8 | 240 | 3.140625 | 3 | [] | no_license | from math import*
ang= eval(input("digite o angulo x: "))
k= int(input("numeros de termos: "))
soma=0
b=1
i=0
while (i<k):
sinal= (-1)**i
sen= sinal * ((ang**b)/factorial(b))
soma= soma + sen
b= b + 2
i= i + 1
print(round(soma, 10))
| true |
55b2cd0ec4da4b4d25033109c4f94b7ae9dcd1be | Python | Aasthaengg/IBMdataset | /Python_codes/p02727/s036084960.py | UTF-8 | 592 | 2.765625 | 3 | [] | no_license | import heapq
X,Y,A,B,C = map(int, input().split())
p_list = sorted([(-v, 'p') for v in map(int, input().split())])
q_list = sorted([(-v, 'q') for v in map(int, input().split())])
r_list = sorted([(-v, 'r') for v in map(int, input().split())])
res = 0
r_cnt = 0
for v, k in heapq.merge(p_list, q_list, r_list):
v = ... | true |
1cb6dc450620012a082891b980801bb558363c46 | Python | IKKO-Ohta/contest | /ABC10[C].py | UTF-8 | 454 | 2.859375 | 3 | [] | no_license | import numpy as np
nums = [int(x) for x in input().split()]
sx,sy = nums[0],nums[1]
gx,gy = nums[2],nums[3]
V,T = nums[4],nums[5]
N = int(input())
for i in range(N):
her = [int(x) for x in input().split()]
alpha = np.asarray([her[0] - sx, her[1] - sy])
beta = np.asarray([gx - her[0], gy - her[1]])
i... | true |
72bbb8bc521aa294086c48fe907f602cdff31f34 | Python | wimpywarlord/hacker_earth_and_hacker_rank_solutions | /queens-attack-2.py | UTF-8 | 2,487 | 2.609375 | 3 | [] | no_license | n,k=map(int,input().split())
obs=[]
queen=list(map(int,input().split()))
queen[0]=n-queen[0]+1
queen[1]=queen[1]-1+1
#print(queen)
for i in range(0,k):
z=list(map(int,input().split()))
obs.append(z)
#print(obs)
mat=[]
for i in range(0,n):
mat.append([])
for j in range(0,n):
mat[i].append(1)
mat.... | true |
e6e7630b392600a80cb908035bcdaefc2eea39d5 | Python | abderrahmaneMustapha/machine-learning-practice | /DataSet Classification/first.py | UTF-8 | 1,363 | 2.78125 | 3 | [] | no_license | import pandas as pd
from pandas.plotting import scatter_matrix
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
data = pd.read_csv('Train_v2.csv')
data = data.drop(columns="uniqueid")
#separate bank_account
data_bank = data['bank_account']
data = data.drop(columns="bank_account")
#conve... | true |
158c0f3da629ea842950d49288006eef78806f7d | Python | mental32/ep | /ep/config.py | UTF-8 | 2,521 | 2.78125 | 3 | [] | no_license | from pathlib import Path
from typing import Dict, Union, Any
from toml import loads as toml_loads
__all__ = ("RAW_DEFAULT", "Config", "ConfigValue")
RAW_DEFAULT: str = """
# "ep" is the main configuration loading point, it's form is standardised.
[ep]
# When a "cogpath" is specified ep will attempt to import python ... | true |
1fd9c26d6324d1abf311d1b2fbd93293a359d7e7 | Python | lizzz0523/algorithm | /python/deprecated/test/test_search.py | UTF-8 | 1,185 | 3.3125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
from unittest import TestCase
from search.full_permutation import full_permutation
from search.dfs_short_path import dfs_short_path
from search.bfs_short_path import bfs_short_path
class SearchTest(TestCase):
def test_full_permutation(self):
n = 3
self.assert... | true |
3c099402f0d6b3deaf90ba583f0f071c1db79aec | Python | fanwen390922198/ceph_pressure_test | /base_lib/ChartDirector/pythondemo_cgi/background.py | UTF-8 | 1,366 | 2.9375 | 3 | [
"IJG"
] | permissive | #!/usr/bin/python
from pychartdir import *
import cgi, sys, os
# Get HTTP query parameters
query = cgi.FieldStorage()
# This script can draw different charts depending on the chartIndex
chartIndex = int(query["img"].value)
# The data for the chart
data = [85, 156, 179.5, 211, 123]
labels = ["Mon", "Tue", "Wed", "Thu... | true |
717b670dea96d974d7a4e6e31c6bf2523a943a48 | Python | Viach/YLS | /bs4/bowl.py | UTF-8 | 4,734 | 3.015625 | 3 | [] | no_license | import requests
import csv
from bs4 import BeautifulSoup
class Soup:
""" Class Soup - scrapper for site """
def __init__(self, args):
self.args = args
self.args.setdefault('--limit-pages', 1)
self.args.setdefault('--price-range', '10000:20000')
if self.args['--price-range']:
... | true |
a7e2319bb19feebd8edf76ec9372fb697b8c2480 | Python | Aasthaengg/IBMdataset | /Python_codes/p02555/s499061652.py | UTF-8 | 488 | 2.96875 | 3 | [] | no_license | def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]
mod = 10**9+7
import math
s = I()
t = 0
ans = 0
for i in range(1,s+1):##iは数列の項の数
if s - 3*i <0:
continue
else:
t = s-3... | true |
cff08c0254a0c6b1347dc21c06525f0cac4e2fb8 | Python | k201zzang/ComputationalPhysics | /10.12.py | UTF-8 | 412 | 2.8125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Aug 23 11:03:25 2013
@author: akels
"""
from __future__ import division, print_function
from pylab import *
from numpy.random import random
N = 500
z1 = random(N)
z2 = random(N)
teta = arccos(1 - 2*z1)
fi = 2*pi*z2
x = sin(teta)*cos(fi)
y = sin(teta)*sin(fi)
z = cos(teta)
... | true |
df9db7427cb571568cdef36a8d5ed555a7931f0a | Python | kevindelord/picturemyworld-server | /setup.py | UTF-8 | 1,301 | 2.625 | 3 | [] | no_license | #!/usr/bin/python
import argparse
import os
parser = argparse.ArgumentParser(description='Initialize the NodeJS server for PictureMyWorld')
parser.add_argument('-e','--env', help='Configure the deployment environment.', required=True, default=None)
parser.add_argument('-i','--install', help='Install all node dependenc... | true |
b64b39408a119bcce867684edfc45b71dc279c15 | Python | abrightmoore/TrigonometryBot | /Gen_InterferenceImageIterated.py | UTF-8 | 175 | 2.5625 | 3 | [] | no_license | from random import randint
import Gen_InterferenceImage
def draw(img):
iters = randint(2,4)
for i in xrange(0,iters):
Gen_InterferenceImage.draw(img)
return img | true |
7743b4d4cc461e33088100660e5809d04aae96e7 | Python | architus/architus | /api/stress_test.py | UTF-8 | 1,281 | 3.046875 | 3 | [
"MIT"
] | permissive | from threading import Thread
from collections import Counter
import requests
from datetime import datetime
import time
results = []
def get(url):
global results
now = datetime.now()
r = requests.get(url)
results.append((r, (datetime.now() - now).total_seconds(), now))
if __name__ == '__main__':
... | true |
1d93c1ec505254c899d1b2bcc2c00bc4c449b890 | Python | mikekiwa/python_FileMovement_exercises | /python_FileMover_drill_py2.py | UTF-8 | 768 | 3.8125 | 4 | [] | no_license | #Scenario: Your employer wants a program to move all his .txt files from
#one folder to another On your desktop make 2 new folders. Call one Folder A &
#the second Folder B. Create 4 random .txt files & put them in Folder A.
#- Move the files from Folder A to Folder B.
#- Print out each file path that got moved onto th... | true |
b887e8f54465ed3ebb897444b00ca8edd754f3f2 | Python | viratsardana/sudoku-solver | /spuzzle.py | UTF-8 | 825 | 3.1875 | 3 | [] | no_license | """this file includes the sudoko puzzle given to us to be solved"""
puzzle=[]
n=9
for i in range(0,n+1):
temp=[0 for j in range(0,n+1)]
puzzle.append(temp)
"""equate puzzle values based on sudoko problem"""
puzzle[1][2]=8
puzzle[1][3]=1
puzzle[1][4]=7
puzzle[1][5]=9
puzzle[1][7]=3
puzzle[1][9]=4
puzzle[2][5]... | true |
14d3107ad6a980f22a10d8779ce99c1e46001caa | Python | banana6742/machinelearning | /webscrape.py | UTF-8 | 1,225 | 2.6875 | 3 | [] | no_license | # import the required lib
print('_'*50)
#0. import bs4 BS url.request urlopen
from bs4 import BeautifulSoup
from urllib.request import urlopen
url='https://simplilearn.com/resources'
webpage = urlopen(url)
#1. soup parser
sl_soup = BeautifulSoup(webpage,'html.parser')
webpage.close()
# print(sl_soup.contents)
# p... | true |
feb9bbe7c538f2273659b086a43315a0c875e60f | Python | 2020-ASW/kwoneyng-Park | /2월 4주차/궁금한 민호.py | UTF-8 | 600 | 2.84375 | 3 | [] | no_license | n = int(input())
arr = [list(map(int,input().split())) for _ in range(n)]
bridge = [[1]*n for _ in range(n)]
ans = 0
for k in range(n):
for x in range(n):
for y in range(x,n):
if x == k or y == k or x == y:
continue
if arr[x][y] == arr[x][k] + arr[k][y]:
... | true |
9c11f0f563937dda01e99d360b8066f69a5165e8 | Python | edmontdants/autoencoder_based_image_compression | /svhn/vae/VariationalAutoencoder.py | UTF-8 | 53,255 | 3.28125 | 3 | [] | no_license | """A library that defines the class `VariationalAutoencoder`."""
import numpy
import os
import warnings
import tools.tools as tls
class VariationalAutoencoder(object):
"""Variational autoencoder class.
All of its attributes are conventionally private.
"""
def __init__(self, nb_visible... | true |
8a77ba700d619a9f1df22ed737eba2a6475b94fa | Python | KeeMeng/hkoi | /01007.py | UTF-8 | 248 | 2.890625 | 3 | [] | no_license | l = [None] * int(input())
while True:
packet = input()[3:]
serial = int(packet[0:2])
check = int(packet[2:6])
data = packet[6:]
if sum(map(ord, data)) == check: l[serial-1] = data
if None not in l: break
print("".join(l))
| true |
2e307e19fcc3f43e07a8a295ee78b28b22a410a4 | Python | amock25/NodeMCU-Python | /5_PWM.py | UTF-8 | 623 | 3.375 | 3 | [] | no_license | #####################################################################
Shreejicharan Electronics
#####################################################################
import machine,time, math #import machine, time & math module from firmware
led = machine.PWM(machine.Pin(2), freq=1000) #creat ... | true |
4684b4df459755cc478abdfce0dc9f588b574ddb | Python | AK-1121/code_extraction | /python/python_19646.py | UTF-8 | 110 | 2.578125 | 3 | [] | no_license | # Get the difference between two list?
diffEx = [(myEx - opEx) for myEx,opEx in zip(myExeptPack,opExeptPack)]
| true |
e71f95db82aa66d2c931b1ad895aec6f75dcd18a | Python | charles01pd2018/crypto-stats | /load.py | UTF-8 | 1,297 | 3.359375 | 3 | [] | no_license | # Reads csv data
# helper libraries
from pathlib import Path
from os import getcwd
# data libraries
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
# objects
from objects.parameters import COLS
# globals
data_path = Path( getcwd() , 'data/kraken')
file_name = 'COMPUSD.cs... | true |
ec880cd707dff02df37359079960bc3442aa059a | Python | beforeuwait/myLintCode | /LinkedList/sortList.py | UTF-8 | 2,531 | 3.78125 | 4 | [
"MIT"
] | permissive | # coding=utf-8
"""
链表排序
虽说是中等,但是我觉得还是有点难
刚刚才去做了一遍快排
思路和快排类似
找到 pivot 分成3块 左边 右边分别排序
最后组装起来
"""
"""
Definition of ListNode
class ListNode(object):
def __init__(self, val, next=None):
self.val = val
self.next = next
"""
class Solution:
"""
@param head: The first node of the linked list.
... | true |
092dc50669a02fc7948f7c09aeedfca9bfdbfe11 | Python | martintb/typyDB | /typyDB.py | UTF-8 | 15,286 | 3.140625 | 3 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
import pathlib
import operator
class typyDB(object):
''' A database for storing simulation data
Attributes
----------
trial_index: pd.DataFrame, size (ntrials,ntlabels)
Table of trials and parameters describing trials. The index of this
DataFrame ... | true |
c52b5a6852896a4ba8ab8cdd25b50a67db73a7c9 | Python | n3n/CP2014 | /CodePython/pythonDuke/t1.py | UTF-8 | 129 | 3.453125 | 3 | [] | no_license | input_i=input()
ai=input_i-1
ia=input_i-2
if input_i==1:
print '1'
elif input_i == 2:
print '11'
else:
print '1'*ai+'1'*ia
| true |
57d3f4e466236a970ef361bbe137dc28ffeccf88 | Python | egriffith/AWS-Instance-Connector | /iconnect.py | UTF-8 | 4,511 | 2.71875 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env python3
import argparse
import sys
import time
import os
try:
import boto3
import botocore
except ImportError:
print("The boto3 SDK for python3 is not available. Please install it.")
sys.exit(1)
def buildArgParser(argv):
parser = argparse.ArgumentParser(description="Update a Route... | true |
9de02a8bb67ee11d03298df09caebc5d3f2f8ecd | Python | chixinn/ClassNotes4S2021 | /web编程/searchWebFinal/datasets/ReduFenxi.py | UTF-8 | 3,085 | 3.046875 | 3 | [] | no_license | # 要添加一个新单元,输入 '# %%'
# 要添加一个新的标记单元,输入 '# %% [markdown]'
# %%
import pandas as pd
import re
import jieba
from datetime import datetime
df=pd.DataFrame(pd.read_excel('fets.xls'))
# %%
df.sample()
# %%
df.info()
# %%
def remove_punctuation(line):
rule = re.compile(u"[^a-zA-Z0-9\u4e00-\u9fa5]")
line = rule.sub(''... | true |
19a77729957bdd69a91f8a46985a534273beeec8 | Python | Kaedenn/b3sim | /utility.py | UTF-8 | 13,203 | 2.609375 | 3 | [
"BSD-2-Clause"
] | permissive | #!/usr/bin/env python
"""
Utility functions that don't really belong anywhere else
Axes:
+X is east
-X is west
+Y is south
-Y is north
+Z is up
-Z is down
Possible Vector128 dtype:
d = np.dtype((np.float128, np.dtype({"names": list("xyzw"), "formats": [np.float32]*4})))
a = np.array([0], dtype=d)
a[0] = ... | true |
96a4d246525695033691537f0c125e3b7e89c8a9 | Python | cabbageNoob/input_corrector | /Pinyin2Hanzi/pinyincut.py | UTF-8 | 3,937 | 3.296875 | 3 | [] | no_license | #!/usr/bin/env python3
# coding: utf-8
# File: pinyin_cut.py
# Author: cjh<492795090@qq.com>
# Date: 19-11-25
import pickle
import sys
from Pinyin2Hanzi import config
#定义trie字典树节点
class TrieNode:
def __init__(self):
self.value = None
self.children = {}
#遍历树
class SearchIndex:
def __init__(self, ... | true |
d469a68e2e5f0aab38bf9950887e56526e24619a | Python | lchb000/LicensePlateRecognition | /DataBase.py | UTF-8 | 4,645 | 3.046875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import pymysql
# 数据库类,使用前要先建立database:LPRDB 和用户LPRadmin,密码123456,拥有LPRDB中所有权限
'''
第一次使用前建议先在数据库端root权限下输入以下语句建立相关数据库
drop database if exists LPRDB;
create database LPRDB;
create user 'LPRadmin'@'localhost' identified by '123456';
grant all on LPRDB.* to 'LRPadmin'@'localhost';
use LPRDB;
dro... | true |
cc71cc7686f20fac2593b9b46e4321811e0dd80e | Python | Abdellatifx/Sorting-Techniques | /quickSort.py | UTF-8 | 757 | 2.890625 | 3 | [] | no_license | import sys
import ParentClass
sys.setrecursionlimit(100000000)
def partition(array, start, end):
pivot = start
index = start + 1
while index <= end:
if array[index] < array[start]:
pivot += 1
array[index], array[pivot] = array[pivot], array[index]
index += 1
a... | true |
a115c59920dde6843f82f94f3c18668aa9b9b30e | Python | nachosca/python-practice | /session20_func.py | UTF-8 | 482 | 4.0625 | 4 | [] | no_license | # - code reuse
# - modularity
# s = "Python,HTML,CSS"
# print(s.index("HTML"))
# func call
# fun def
def value_reverses(value):
if type(value)==list or type(value)==str:
reverse = value[::-1]
else:
temp = str(value)
reverse = temp[::-1]
return reverse
s = "Python"
result = value_reverses(s)
print(result... | true |
16eaedd5f237e7d8322727f9456b113eac8a3eee | Python | pandas-dev/pandas | /pandas/tests/dtypes/cast/test_promote.py | UTF-8 | 20,699 | 2.6875 | 3 | [
"BSD-3-Clause"
] | permissive | """
These test the method maybe_promote from core/dtypes/cast.py
"""
import datetime
from decimal import Decimal
import numpy as np
import pytest
from pandas._libs.tslibs import NaT
from pandas.core.dtypes.cast import maybe_promote
from pandas.core.dtypes.common import is_scalar
from pandas.core.dtypes.dtypes impor... | true |
f2b096e8f6546e02be16448fe10c0d392de88ba5 | Python | bdxb/discord-markov-bot | /markovbot/commands.py | UTF-8 | 886 | 2.890625 | 3 | [] | no_license | from discord.ext.commands import Context
from markovbot import markovbot, markov
from markovbot.seeder import seeder
@markovbot.command(pass_context=True, help='Generate a sentence based of a Markov Chain')
async def say(ctx: Context):
try:
sentence = markov.make_sentence(ctx.guild)
await ctx.chan... | true |
0121beda771869ac309f116c181d315db8b8224c | Python | irhee/CMPT353-BigProject | /Part1_Financial_Data_Parsing_By_Date.py | UTF-8 | 17,736 | 2.78125 | 3 | [] | no_license | import pandas as pd
from pandas.tseries.holiday import USFederalHolidayCalendar
from pandas.tseries.offsets import CustomBusinessDay
import numpy as np
pd.set_option('display.max_rows', None)
pd.set_option('display.max_columns', None)
pd.set_option('display.max_colwidth', 100)
pd.set_option('display.float_format', '{:... | true |
a84a5fa1f91969c776c81905859e2ec76374bf21 | Python | zeroam/TIL | /python/fastcampus/chapter03_01.py | UTF-8 | 877 | 3.96875 | 4 | [
"MIT"
] | permissive | import array
"""List Comprehension"""
chars = "!@#$%^&*()_+"
# create list
l1 = [ord(char) for char in chars]
# create list + filter
l2 = [ord(char) for char in chars if ord(char) > 40]
# create generator
l3 = (ord(char) for char in chars)
print(l1)
print(l2)
print(l3)
print()
"""Array"""
arr = array.array("I", (or... | true |
7cc5afbb2b00dc7cbab7cbeeb5a66e087e92ff88 | Python | AsadullahGalib007/Python-Playground | /8. OOP/oop2.py | UTF-8 | 343 | 3.9375 | 4 | [] | no_license | #Constructor
class partyAnimal:
x = 0
name = ""
def __init__(self, z):
self.name = z
print(self.name, "Created")
def party(self):
self.x = self.x +1
print(self.name,"party count", self.x)
s = partyAnimal("Galib")
# s.party()
# j = partyAnimal("Nobody")
# j.party()
#Remember: self is the defined class ... | true |
0fa6362ab5a220949cb91b93be999e3882dcaa90 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_96/1171.py | UTF-8 | 1,689 | 2.8125 | 3 | [] | no_license | '''Apr 14, 2012 Autor: Artur'''
# -*- coding: utf-8 -*-
file_in = open("B-large.in", "r")
file_out = open("B-large.out", "w")
def hinded(skoor):
x = skoor//3
erinevus = skoor%3
if erinevus == 0:
return([x, x, x])
elif erinevus == 1:
return([x, x, x+1])
else:
ret... | true |
be138f6c6a0588465a248649f7d4677fc0fb359f | Python | jadesym/interview | /leetcode/929.unique-email-addresses/solution.py | UTF-8 | 911 | 3.484375 | 3 | [] | no_license | class Solution:
def numUniqueEmails(self, emails):
"""
:type emails: List[str]
:rtype: int
"""
uniques = set()
for email in emails:
unique_email = self.getUniqueEmail(email)
uniques.add(unique_email)
return len(uniques)
def... | true |
3c9cc8df76f232fe814600ff865e44f5178e2eb4 | Python | Jasonluo666/Nowcoder-Solution | /数字颠倒.py | UTF-8 | 204 | 3.6875 | 4 | [] | no_license | input_int = list(input())
for index in range(int(len(input_int) / 2)):
temp = input_int[index]
input_int[index] = input_int[-index - 1]
input_int[-index - 1] = temp
print(''.join(input_int)) | true |
f6597c5b899b1b63aa34ec89894396e26bf7a56f | Python | skatenerd/Python-Euler | /problem2/problem2.py | UTF-8 | 163 | 3.0625 | 3 | [] | no_license | import fibo
def isEven(x):
return x%2==0
fiboList = fibo.fib(4000000)
evenFibs = filter(isEven, fiboList)
evenFibsSum = sum(evenFibs)
print(evenFibsSum)
| true |
9c228050f3c2eac8341357b81f1682af667db144 | Python | alm2263/project1 | /backend/db/models.py | UTF-8 | 1,437 | 2.578125 | 3 | [] | no_license | from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, ForeignKey, PrimaryKeyConstraint
from sqlalchemy import (
Integer, String, DateTime, Text, Float, Boolean)
from sqlalchemy.orm import relationship
DeclarativeBase = declarative_base()
class Business(DeclarativeBase):
__tab... | true |
9bd11828a0b8e41003f03f87a0792ddb26fea227 | Python | romanets-s/cisco_rest_api | /rush00/moviemon/moviemon/model/Player.py | UTF-8 | 191 | 2.53125 | 3 | [] | no_license | class Player:
def __init__(self, x, y, power=0):
self.x = x
self.y = y
self.power = power
self.boll = 1
self.lucky = 5
self.allMonsters = 0
self.bollHere = 0
self.enemy = {}
| true |
ee5ebaeddc3be8d212dc44e021be5cbd1b89dee8 | Python | sudhanshu-shukla-git/rl-cab-driver-max-profit | /rl-cab-driver/Env.py | UTF-8 | 7,303 | 3.265625 | 3 | [] | no_license | # Import routines
import numpy as np
import math
import random
# Defining hyperparameters
m = 5 # number of cities, ranges from 1 ..... m
t = 24 # number of hours, ranges from 0 .... t-1
d = 7 # number of days, ranges from 0 ... d-1
C = 5 # Per hour fuel and other costs
R = 9 # per hour revenue from a passenger
#lo... | true |
babf6aa893872ab3a89ac115a51f84c196185782 | Python | ddddfang/my-exercise | /python/celery/multithread_learn.py | UTF-8 | 1,150 | 3.078125 | 3 | [] | no_license | import threading
import queue
import time
import os
import random
# task_list is indepent if we use multiprocess!
# we should use multithread!
task_list = [
'a',
'b',
'c',
'd',
'e',
'f',
'g',
'h',
'i'
]
threads_list = [
'thread-001',
'thread-002',
'thread-003',
]
class myThread(threading.Thread):
def _... | true |
fb350a9d2a8d74bfa61b33b35d248e648ac62a8b | Python | ornlneutronimaging/iMars3D | /tests/unit/backend/corrections/test_intensity_fluctuation_correction.py | UTF-8 | 3,742 | 2.5625 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python3
from functools import cache
import numpy as np
import pytest
import tomopy
from imars3d.backend.corrections.intensity_fluctuation_correction import (
intensity_fluctuation_correction,
normalize_roi,
)
np.random.seed(0)
@cache
def generate_fake_projections(
n_projections: int = 1440... | true |
34f0d91af6b7ebc7b6746d59c6c26367576530d5 | Python | pasinit/LegalCrawler | /crawlers/download_uk_legislation.py | UTF-8 | 2,042 | 2.609375 | 3 | [] | no_license | import os
import sys
import requests
from multiprocessing import cpu_count, Pool
from data import DATA_DIR
from bs4 import BeautifulSoup
from crawlers.helpers import clean_text
sys.setrecursionlimit(100000)
dir_root = os.path.join(DATA_DIR, 'uk')
if not os.path.exists(DATA_DIR):
os.mkdir(DATA_DIR)
def get_file_... | true |
e841164c1081ea2706361ff90fa2a6e40d31b0df | Python | Singlelogic/questionnaire | /questionnaire_api/tests/test_models.py | UTF-8 | 1,750 | 2.671875 | 3 | [] | no_license | from django.test import TestCase
from questionnaire_api.models import Questionnaire
class QuestionnaireModelTest(TestCase):
"""
Test class for Questionnaire
"""
@classmethod
def setUpTestData(cls):
Questionnaire.objects.create(
title='Weather',
description='What ki... | true |
0b4a4ea67994d9a35dfe4d3a2013eee7ff154fdc | Python | alexandrelff/mundo2 | /ex042.py | UTF-8 | 738 | 4.375 | 4 | [] | no_license | #Refaça o DESAFIO 035 dos triângulos, acrescentando o recurso de mostrar que tipo de triângulo será formado:
#- Equilátero: todos os lados iguais
#- Isósceles: dois lados iguais
#- Escaleno: todos os lados diferentes
r1 = int(input('Digite o valor da reta 1: '))
r2 = int(input('Digite o valor da reta 2: '))
r3 = int(i... | true |
acc5eb08e8e2a9f7bebaaca91b58a3b8f15d7c09 | Python | DevinSmoot/Learning-python | /rps_example.py | UTF-8 | 715 | 3.53125 | 4 | [] | no_license | #Import required packages
import random
#Define variables needed (NOTE:inline; this section not relevant)
#User input for userChoice
while True:
try:
userChoice = int(inpu\t("Enter a choice (1 = Rock 2 = Paper 3 = Scissors): "))
except ValueError:
print("Sorry, please enter a number between 1 ... | true |
0f88a80fbf55ea4e6636a59262267c545d61e933 | Python | stfbnc/TrovaEscapeBackEnd | /rooms/E8_R2.py | UTF-8 | 663 | 2.625 | 3 | [
"MIT"
] | permissive | import Room
import Constants as c
class E8_R2(Room.Room):
def __init__(self):
super().__init__('Freddy è tornato!', 'http://www.escaperoomrealgame.it/room/freddy/', 'E8_R2')
def get_prices(self):
p = ['2 giocatori : €25,00 a persona',
'3 giocatori : €20,00 a persona',
... | true |
e0d9199005ff95435421a61d27e993aab9a1407e | Python | SecretFr/openCV | /ConvexHull_3.py | UTF-8 | 1,005 | 2.96875 | 3 | [] | no_license | import numpy as np
import cv2
def convex():
img = cv2.imread('images/lightning.png')
imgray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
rows, cols = img.shape[:2]
ret, thr = cv2.threshold(imgray, 127, 255, 0)
_, contours, _ = cv2.findContours(thr, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
cnt = co... | true |
18715ca32fbc01a85a18b5e8b9fb9a12f337dc40 | Python | DeanHe/Practice | /LeetCodePython/SimilarStringGroups.py | UTF-8 | 2,500 | 4.125 | 4 | [] | no_license | """
Two strings X and Y are similar if we can swap two letters (in different positions) of X, so that it equals Y. Also two strings X and Y are similar if they are equal.
For example, "tars" and "rats" are similar (swapping at positions 0 and 2), and "rats" and "arts" are similar, but "star" is not similar to "tars", ... | true |
b1fe3d8204abf85f8e78dceef1a54ee00db980e1 | Python | rmarino72/PyLibs | /RMLibs/util/ByteUtils.py | UTF-8 | 4,091 | 3.328125 | 3 | [] | no_license | import struct
from base64 import b64decode
class ByteUtils:
"""
A set of utilities for bytes and byte arrays
"""
SIZEOF_INT_16 = 2
SIZEOF_INT_32 = 4
SIZEOF_INT_64 = 8
SIZEOF_FLOAT = 4
SIZEOF_DOUBLE = 8
def __init__(self):
pass
@staticmethod
def bytes_to_hex_string... | true |
ba88eaa398facb8409d54da4ded50385b3198c16 | Python | TheNeuralBit/project-euler | /solutions/035/script.py | UTF-8 | 874 | 3.78125 | 4 | [] | no_license | #! /usr/bin/env python
from math import sqrt
def rotate(x):
l = len(str(x)) - 1
firstDigit = nthDigit(x, l)
return int((x-firstDigit*(10**l))*10 + firstDigit)
def nthDigit(x , n):
return ((x-x%10**n)/(10**n))%10
size = 1000000
primes = [True]*size
print("Calculating Primes....")
for i in range(2, int(sqrt... | true |
0ef2438bd8d67cd0f41cf30dd5b8d42074f3e1c2 | Python | sachinyar/machine-learning-in-spark-with-pyspark | /linear_regression/set-up.py | UTF-8 | 535 | 3.03125 | 3 | [] | no_license | # Create Spark Session
from pyspark.sql import SparkSession
spark=SparkSession.builder.appName('lin_reg').getOrCreate()
#import Linear Regression from spark's MLlib
from pyspark.ml.regression import LinearRegression
#Load the dataset
df=spark.read.csv('/FileStore/tables/Linear_regression_dataset.csv',inferSchema=True... | true |
d4efcaebefe5e4983f197f1edb9302a48295d3a4 | Python | jdswinbank/Comet | /comet/plugins/eventprinter.py | UTF-8 | 914 | 2.90625 | 3 | [
"BSD-2-Clause"
] | permissive | # Comet VOEvent Broker.
# Example event handler: print an event.
import lxml.etree as ElementTree
from zope.interface import implementer
from twisted.plugin import IPlugin
from comet.icomet import IHandler
# Event handlers must implement IPlugin and IHandler.
@implementer(IPlugin, IHandler)
class EventPrinter(object... | true |
fc1be5483eca3a4e12691bd4761a6da05c24303d | Python | ErliCai/Chatbot | /Chatbot/GetName.py | UTF-8 | 688 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 27 13:57:57 2020
@author: cai
"""
import spacy
import numpy as np
nlp = spacy.load('en_core_web_md')
include_entities = ['PERSON']
# Define extract_entities()
def extract_name(message):
# Create a dict to hold the entities
ents = dict.fr... | true |
43531b286e93df1dadb5f54538d395a3d2f0ad16 | Python | xxf1110409046/py | /demo/fist_demo_case.py | UTF-8 | 3,226 | 2.609375 | 3 | [] | no_license | # coding: utf-8
#导入能操作Excel的包
import xlrd
import requests
import os
import json
from utils.log import LOG
from utils.reader_excel import readerExcel
from request.request import *
#获取当前excel文件路径
filePath = os.getcwd() + "\\test_excel_data\\data.xlsx"
LOG.info("excel文件路径 " + filePath)
#利用文件路径读取Excel文件,生成数组
list,listUr... | true |
a8cd073268522e3a58505fca1b850939e4dc56e9 | Python | Ocnarf2070/DataStructure | /Queue_2/Queue_2.py | UTF-8 | 638 | 3.703125 | 4 | [] | no_license | from collections import deque
class Queue:
def __init__(self):
self.queue = deque()
self.size = 0
def __str__(self):
return str(self.queue)
def is_empty(self):
return self.size == 0
def enqueue(self, item):
self.queue.append(item)
self.size += 1
... | true |
559d9c42a0b36ac2bdf5eac096ca26669d46282f | Python | shalx99/Krone | /bl_games_sql.py | UTF-8 | 2,727 | 2.765625 | 3 | [] | no_license |
import sqlite3
from bl_data_loader import csv_to_list, data_files
from bl_teams_sql import team_id
def all_games(verbose=False):
games = list()
files = data_files()
if verbose:
print(len(files))
print(" \n".join(files))
for file in files:
season = csv_to_list(file)
... | true |
1c10f1e1d443ef9bc0383a6e2fa473e53fb9ff66 | Python | SavvasStephanides/dispensing-api | /content/modules/mapper/XmlToJsonMapper.py | UTF-8 | 1,474 | 2.96875 | 3 | [] | no_license | class XmlToJsonMapper:
def __init__(self, xml_tree):
self.root = xml_tree.getroot()
def map_xml_tree_to_mapper(self):
timestamp = self.get_timestamp()
dispensations = self.get_dispensations()
details = {
"timestamp": timestamp,
"dispensations": dispensa... | true |
1dbdfad6b1af6236ce4e03562bb6661a04a9fbdc | Python | hnegus1/UWE_DSP | /django/dsp/restocking/tests/test_stock_levels.py | UTF-8 | 5,416 | 2.78125 | 3 | [] | no_license | """
Tests for creating shop floor data
"""
import os
import random
import json
from django.test import TestCase
from restocking.models import *
class TestStockLevels(TestCase):
"""
Tests for creating shop floor data
"""
def setUp(self):
_colour_pop_chance = 50
_fitting_pop_chance = 75
... | true |
bd694a5aec1cdd2e776038bf3448d4a7a5a486f2 | Python | thusodangersimon/lomb_scargle | /numpy_imp.py | UTF-8 | 2,279 | 3.328125 | 3 | [
"MIT"
] | permissive | import numpy as np
import numexpr as ne
'''Numpy implimantation of lomb-scargle periodgram'''
def lombscargle_num(x, y, freqs):
# Check input sizes
if x.shape[0] != y.shape[0]:
raise ValueError("Input arrays do not have the same size.")
# Create empty array for output periodogram
pgram =... | true |
81dbb00ce08e36827b7eb5893d763bc36b9b59a1 | Python | jandress94/cs221_pras_jim | /scraper/lichess_scraper.py | UTF-8 | 1,935 | 2.546875 | 3 | [] | no_license | from bs4 import BeautifulSoup
import re
import urllib
import requests
numPages = 1000
out_file = 'data/antichess_games_3.txt'
def main():
url = 'https://en.lichess.org/games/search'
params = { 'page': '1', 'perf': '13', 'status': '60', 'sort.field': 'd', 'sort.order': 'desc' }
# params = { 'page': '1', 'p... | true |
bfcb53946e5cc8bfa2af9eb497982d8ecfc119e5 | Python | tv-vicomtech/adaptationModel | /config-app/combinatorial.py | UTF-8 | 667 | 2.765625 | 3 | [] | no_license | from flask import Flask, request #import main Flask class and request object
import itertools
from flask import jsonify
from flask_cors import CORS
app = Flask(__name__)
CORS(app)
@app.route('/combinations',methods = ['POST', 'GET'])
def make_sets():
data=request.get_json()
items=data["items"]
num_of_boxes=data... | true |
796a8547886e4c1422f6e286f18d8829e974da79 | Python | takionExMachina/REFRACTA | /recognize_face.py | UTF-8 | 760 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import numpy
import cv2
from read_images import read_images
from process_faces import align_images
def RecognizeFaces():
path_train = './imagenes/data/at/mg/'
path_img = './imagenes/captured.pgm'
images = read_images(path_train) # [X, y, c] [imagen, label, contador]
model = ... | true |
284113f4aad5b2ffe3891fae1ac7414e30f72df4 | Python | Anseik/algorithm | /0910_tree_실습/subtree_solution.py | UTF-8 | 814 | 3.015625 | 3 | [] | no_license | import sys
sys.stdin = open('subtree.txt')
T = int(input())
for tc in range(1, T + 1):
E, N = map(int, input().split()) # E : 간선수, 정점수 : E + 1
# 정점 번호 : 1 ~ E + 1
L = [0] * (E + 2)
R = [0] * (E + 2)
P = [0] * (E + 2)
arr = list(map(int, input().split()))
for i in range(0, E * 2, 2): # arr[... | true |
d53b9fb5620c17d94b9f957242154e2c25ea4499 | Python | WZQ233/LEA-Net | /utils.py | UTF-8 | 2,626 | 2.71875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import os
import cv2
import numpy as np
import matplotlib.pyplot as plt
from skimage import img_as_ubyte
from skimage.color import deltaE_ciede2000
def get_data(Imgs, img_size=256, BW=False):
X = []
for img in Imgs:
x = cv2.imread(img)
x = cv2.resize(x, (img_size,img_size))
if BW:
... | true |
f42e6bd998703ad0072b0fdc095a259e93c3278d | Python | zhangkaili1/pythondemo | /day4/readCsv2.py | UTF-8 | 2,051 | 3.625 | 4 | [] | no_license | #1、之前的readcsv不能被其他测试用例调用,所以应该给这段代码封装到一个方法里
#2、每个测试用例的路径不同,所以path应该作为参数传入到这个方法中
#4、我们打开了一个文件,但是并没有关闭,最终可能会造成内存泄露
import csv
import os
def read(file_name):
#所有重复代码的出现,都是程序设计的不合理
#重复的代码都应该封装到一个方法里
current_file_path = os.path.dirname(__file__)
path = current_file_path.replace("day4", "data/" + file_name)
... | true |
ba0f2189f6b6c2bbdcf6f5e89ce013c10c1a81ad | Python | pratik8064/Distributed-Databases | /range_point.py | UTF-8 | 5,088 | 2.71875 | 3 | [] | no_license | #!/usr/bin/python2.7
#
# Assignment2 Interface
#
# name: Pratik Suryawanshi
# asu id : 1213231238
import psycopg2
import os
import sys
RANGE_METADATA = 'rangeratingsmetadata'
ROUND_ROBIN_METADATA = 'roundrobinratingsmetadata'
RANGE_PREFIX = 'rangeratingspart'
ROUND_ROBIN_PREFIX = 'roundrobinratingspart'
RANGE_OUTP... | true |
a3f23eda3bc07acf595f204a4879282c9df6d2e7 | Python | francisconeves97/pri | /2/ex4.py | UTF-8 | 211 | 3.34375 | 3 | [] | no_license | import operator
from ex3 import dot_product
print("Enter query: ")
terms = input().split(' ')
scores = dot_product(terms)
sorted_by_value = sorted(scores.items(), key=lambda kv: kv[1])
print(sorted_by_value) | true |
6159fab428604a9664aa89b07043bf501d1d40f6 | Python | Demi-hero/Programming_Exercises | /ex03.py | UTF-8 | 3,977 | 3.65625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Spyder Editor
TODO:
Get rid of Global Variables?
"""
GRID_SIZE = 8
GRID = []
COUNT = 0
def grid_generator(n):
global GRID
GRID = ["."] * n
for i in range(n):
GRID[i] = ['.'] * n
grid_generator(GRID_SIZE)
# function to print a nice grid of inditerminate siz... | true |
5e30e84f3bb3694ef50f51b8d64aff5e7d1db3d5 | Python | lusmoura/WebScraping-workshop | /requests_letras.py | UTF-8 | 3,872 | 3.078125 | 3 | [] | no_license | import re
import requests
from lxml import html
from bs4 import BeautifulSoup
from unidecode import unidecode
def print_words(words, max_words=20):
''' Print first max_words according to the num of occurences '''
count_words = {k: v for k, v in sorted(words.items(), key=lambda item: item[1], reverse=True)} ... | true |
ea9c6e245ba730d4cf67608e38dca759b18a55a0 | Python | rahulpacharya/PythonLearn | /test/Testing_Pytest_basics.py | UTF-8 | 1,648 | 2.921875 | 3 | [] | no_license | import pytest
# PYTEST
################
# Pytest is another third party python library, used for unit testing.
def test_sample_pytest_test():
assert 'HELLO' == 'hello'.upper()
# python -m pytest Testing_Pytest_basics.py
# py.test Testing_Pytest_basics.py
def add2num(x, y):
return x + y
class Testadd2... | true |
d2d20044155e640486dc696e0a0c0aaed62d0ba5 | Python | ibeninc/command_base | /resources/command.py | UTF-8 | 4,564 | 2.828125 | 3 | [] | no_license | from flask_restful import Resource, reqparse
from flask_jwt_extended import (
jwt_required,
get_jwt_claims,
jwt_optional,
get_jwt_identity,
fresh_jwt_required
)
from models.command import CommandModel
class Command(Resource):
@jwt_required
def get(self, title): # this method f... | true |
41ed89ba4227658e67ec93835ef44499c344afac | Python | ws3109/Leetcode | /Python/54. Spiral Matrix/spiral.py | UTF-8 | 1,124 | 3.1875 | 3 | [] | no_license | class Solution(object):
def spiralOrder(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: List[int]
"""
if not matrix:
return []
up, left, down, right = 0, 0, len(matrix) - 1, len(matrix[0]) - 1
direct = 0 # 0: go right 1: go down 2: go ... | true |
bc14aa5cdfb91f245808c814644a2f55e41018b2 | Python | alesiong/dpass-pc-backend | /app/utils/ethereum_utils.py | UTF-8 | 6,931 | 2.71875 | 3 | [
"MIT"
] | permissive | import hashlib
import time
from functools import partial
from typing import Callable, Optional
from web3 import Web3
from web3.contract import Contract
from web3.eth import Eth
from web3.miner import Miner
from web3.personal import Personal
from app.utils.decorators import set_state, check_state, check_and_unset_stat... | true |
5f49212bfe67056999e8e7d4d9e5e72a0f76ef88 | Python | PriyanshiPanchal/python | /Python Programs/P4-Dist_of_List.py | UTF-8 | 220 | 3.484375 | 3 | [] | no_license | myDict = {}
# Adding list as value
myDict["key1"] = [1, 2]
myDict["key2"] = ["Geeks", "For", "Geeks"]
list=['Hello','World']
myDict["key1"].append(list)
#myDist["key1"].append(list)
print(myDict) | true |