blob_id
large_string
repo_name
large_string
path
large_string
src_encoding
large_string
length_bytes
int64
score
float64
int_score
int64
detected_licenses
large list
license_type
large_string
text
string
download_success
bool
83eec9d72e90b9e6303d958d65a2381d498e7316
cafaray/atco.de-fights
/isCoolTeam.py
UTF-8
4,092
3.109375
3
[]
no_license
class Team(object): def __init__(self, names): self.names = names def createPath(self): firsts, lasts = dict(), dict() nodes = [] inout = 0 for i in self.names: il, jl = i[0].lower(), i[-1].lower() if il in firsts: firsts[il] += [i...
true
f137274b88bdf27bf62686f0729ed3ef96566591
elliotc12/dynein_walk
/scripts/dynein/draw/cartoon.py
UTF-8
2,903
2.84375
3
[]
no_license
import matplotlib.pyplot as plt import matplotlib.patches as patches import numpy as np import dynein.draw.motor_domain as md import dynein.draw.tail as tail physical_stalk_length = 22.1 # nm def draw(ax, x_coords, y_coords, alpha=1): dyneinPolygon(x_coords[0], y_coords[0], x_coords[1], y_coords[1], x_coords[2], ...
true
2539c018752d8b4081f2980a60f0cae0e6f022a6
dcw3/sushi_go_bot
/bot.py
UTF-8
13,688
2.65625
3
[]
no_license
import random from collections import Counter, deque import copy import numpy as np from itertools import combinations import nash import networkx as nx import ast from game import * class State: def __init__(self, h, k, s, p): self.hands = h self.kept_cards = k self.scores = s self...
true
a574b5b2f1c9042793989d4ad0513ee563449e45
onepoint19/spicymelon
/lc_695_max_area_if_island.py
UTF-8
1,017
3.046875
3
[]
no_license
class Solution(object): def maxAreaOfIsland(self, grid): """ :type grid: List[List[int]] :rtype: int """ maxarea = 0 if grid == None or grid == []: return maxarea area = 0 def countIsland (i,j, area): if grid[i][j] == 0: ...
true
e817f62a7caf24674367924a17d851c7303e2e77
gaozikang/WCSP-2018-code
/demo-script-auto2.py
UTF-8
1,664
2.765625
3
[]
no_license
#!/usr/bin/python3 import amcgen import amctest import amcout import amcmethod modulation_type = ['2psk','4psk','4qam','16qam'] for modulation in modulation_type: print("Testing Signal:", amcout.nameconvert(modulation)) for snr in range(-4,-3): channel = amcgen.Channel(['awgn'], snr, (2, 4), 0, 0) ...
true
27439ef49323363fe4c3571c796febf60fd93a34
hiway/twicide
/twicide.py
UTF-8
2,968
2.546875
3
[]
no_license
# Copyright (c) 2012, Harshad Sharma. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # - Redistributions of source code must retain the above copyright notice, # this list of conditions a...
true
053876113f89890ada15d7d6011be7983daa236d
jmkemp20/MininetRestConfAPI
/api.py
UTF-8
1,265
2.65625
3
[]
no_license
import BaseHTTPServer import SocketServer from netconfig import NetworkConfigurator from get import getJSON from urlParser import get_parser init_file = 'initial_network.json' cur_file = 'current_network.json' netConfigurator = None class MyRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): def...
true
4c698e04b8e175970ff5a3cfcdcd97013f8d20a8
sprintbiz/logan
/invoice/val2text.py
UTF-8
2,846
3.421875
3
[]
no_license
# -*- coding: utf-8 -*- import math class val2text: """Translate numeric value into text""" i = {} i[1] = "jeden" i[2] = "dwa" i[3] = "trzy" i[4] = "cztery" i[5] = "pięć" i[6] = "sześć" i[7] = "siedem" i[8] = "osiem" i[9] = "dziewięc" i[10] = "dziesięć" i[11] = "jede...
true
ed3f613959427376ce586c1a1024c62729e4e327
YArane/ECSE-428-Book-Swap
/database/models.py
UTF-8
992
2.765625
3
[]
no_license
import datetime from flask.ext.mongoengine import MongoEngine db = MongoEngine() ''' This file will contain all the models used by the database. You can think of the User model below as a table with 3 columns: email, password, and a boolean activated. Eventually we will need models for BookPosts, and many others. '''...
true
9da4bb1c36a9d2ffed023beea479827104b294a0
WhelanB/ScalableComputing
/manager.py
UTF-8
3,502
3.0625
3
[]
no_license
import os import logging import json class InfernoManager(): # TO-DO: # Take inferno level as parameter to aid naming conventions # Replace hardcoded hash strings by enum def __init__(self, filename, level_num): self.dir = os.path.dirname(__file__) self.level_num = level_num ...
true
bbd5cdcc1311b8cd4e31f8d9eeaaa732ccfe7f9e
Mahadev0317/Codekata
/check k in n numbers.py
UTF-8
112
2.859375
3
[]
no_license
n,m=map(int,input().split()) lis=list(map(int,input().split())) if m in lis: print("yes") else: print("no")
true
b2e936e49b9590964555b5ffc6a9999d247954e3
bailabs/tailorder-server
/tailorder/escpos.py
UTF-8
4,581
2.796875
3
[]
no_license
import time from flask.json import loads, dumps from escpos.printer import File, Usb # Line Width QTY_WIDTH = 6 ITEM_WIDTH = 26 def write_void(table_no, lines, usb_printer=None, print_item_code=True): p = usb_printer if usb_printer else File("/dev/usb/lp0") p.text('Table Number: {0}\n'.format(table_no)) ...
true
047ef6b1b534549deb5eb41b716b54623e4593a4
henrylin2008/Coding_Problems
/DailyCoding/longest_substring_with_k_distinct_characters.py
UTF-8
2,288
4.34375
4
[]
no_license
# Daily Coding Problem #13 # Problem # This problem was asked by Amazon. # # Given an integer k and a string s, find the length of the longest substring that contains at most k distinct characters. # # For example, given s = "abcba" and k = 2, the longest substring with k distinct characters is "bcb". # # Solution # Th...
true
d4ea0b70e674201f425290e43c0a37ae4665b985
kajdreef/MESA
/backend/recommendation/RecommendationResource.py
UTF-8
1,157
2.90625
3
[]
no_license
"""Public interface to machine learning recommendation modules.""" from recommendation import model import numpy as np import logging logger = logging.getLogger(__name__) CLASSIFIER = None def initModel() -> model.MLClassifier: """ Trains model based on training data. If model has already been trained, ...
true
7b3108ca3a4c870c30c0212e372b3a66cb52a8b0
MattBrooks95/Andiamo
/FOP/proj_types.py
UTF-8
906
2.671875
3
[]
no_license
class neutron: def __init__(self): self.a = 1 self.z = 0 def __str__(self): return "A:"+str(self.a)+" Z:"+str(self.z) class proton: def __init__(self): self.a = 1 self.z = 1 def __str__(self): return "A:"+str(self.a)+" Z:"+str(self.z) class deuteron: ...
true
3c066d2325bc13322fab2310dafe8cd53390d976
PanJinquan/torch-image-classification-pipeline
/utils/image_processing.py
UTF-8
51,274
2.5625
3
[]
no_license
# -*-coding: utf-8 -*- """ @Project: IntelligentManufacture @File : image_processing.py @Author : panjq @E-mail : pan_jinquan@163.com @Date : 2019-02-14 15:34:50 """ import os import copy import re import cv2 import numpy as np import matplotlib.pyplot as plt import requests import matplotlib i...
true
94da4a11c4ac9d03a192d286cd1d6879aa0a85a3
xenten9/small-projects
/rootfinder/root_finder.py
UTF-8
2,798
3.953125
4
[ "Unlicense" ]
permissive
class Polynomial: def __init__(self, terms: list[float]): self.terms: list[float] = terms self._terms_prime: list[float] = [] self.get_derivative() def __str__(self) -> str: out: list[str] = [] # Get each term for i in range(len(self.terms)): out.app...
true
5ee559e97c609640f538b50a7055f416668cf2d2
InsectRobotics/insectvision
/compoundeye/utils.py
UTF-8
1,686
2.984375
3
[ "MIT" ]
permissive
import numpy as np RNG = np.random.RandomState(2018) def get_microvilli_angle(epsilon, alpha, theta=np.pi/6, phi=np.pi/18, n=.1): """ Returns the orientation of the microvilli associated to each ommatidium. :param epsilon: elevation of ommatidia :type epsilon: np.ndarray :param alpha: azimuth of ...
true
6c5bfb3b7ab2ee5353f58b2a86d46d6d204b9b8e
clintreyes/num_model
/crossing_2_graph.py
UTF-8
209
3.34375
3
[]
no_license
import numpy as np N = input("Number of points, N: ") e = input("tolerance, e: ") N = float(N) e = float(e) x = -4.0 n = 0.0 while n < 2: while abs(x-x**2) > e: x += 8/N n += 1 print(x)
true
f30a64b1ab6a2321db93cf57042a5fa616734c91
JianFengY/PythonCrashCourse
/chapter02_variables_and_simple_data_types/numbers.py
UTF-8
573
4.5625
5
[]
no_license
# -*- coding: utf-8 -*- ''' Created on 2018年1月18日 @author: Jeff Yang ''' print(2 ** 3) # 2的3次方,python使用**表示乘方运算 print(0.2 + 0.1) # 二进制和十进制的转换会造成小数位数不确定的问题 age = 23 message = "Happy " + str(age) + "rd Birthday!" # 使用函数str()让非字符串数值表示为字符串,否则会报类型错误 print(message) print(3 / 2) # python3结果为1.5,而python...
true
0c11de08687c2a8d842372de59220f88458e884b
fblw/course-assignments
/assignments/algorithms/dijkstra.py
UTF-8
2,589
3.96875
4
[ "MIT" ]
permissive
# ==== Dijkstra ===== def minDistance(dist, q): min_node = q[0] # Annahme, dass erstes Element das kleinste ist for node in q: # Vergleich und ggf. Aktualisieren des min. Wertes if dist[node] != -1 and (dist[node] < dist[min_node] or dist[min_node] == -1): min_node = node return min_n...
true
62031367e103171adb91a4131c89335acaa2cb00
aweller/tsb_projects
/ionoxford/TSB_Tools/CompareGeneLists/CompareGeneLists.py
UTF-8
1,079
2.609375
3
[]
no_license
''' Created on 20 Apr 2012 @author: wooda1 ''' from config import genelist_config import csv import logging def main(): #configure logging logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s', datefm...
true
83ed7abfaebe1932eb5b5191dbc47eba9adbe673
tsushiy/competitive-programming-submissions
/Codeforces/cf561/cf561c.py
UTF-8
191
3.03125
3
[]
no_license
n = int(input()) a = list(map(abs, map(int, input().split()))) a.sort() from bisect import bisect_left ans = 0 for i, e in enumerate(a): x = bisect_left(a, (e+1)//2) ans += i-x print(ans)
true
224e5e7c677aada6d313c7615b50df1306f92d8a
arvin580/SIBS
/cc_mcc_seq/16sTranslocation/1.permutation.test/2.permutation.py
UTF-8
587
2.828125
3
[]
no_license
import sys inFile = open(sys.argv[1]) row = 0 bs = 0 L = [] for line in inFile: row += 1 line = line.strip() fields = line.split('\t') repeat = int(fields[0]) notrepeat = int(fields[1]) if row == 1: #repeat_notrepeat = float(repeat + 1)/float(notrepeat + 1) repeat_notrepeat = fl...
true
3d20dafb1ba38100b9a5e62c7bb075c6a0112623
sayyuf-shaik/test_automate_tool
/helpers/parser.py
UTF-8
1,205
3.09375
3
[]
no_license
import re import logging LOG = logging.getLogger(__name__) class Parser(object): """ class which will parse the output of the runltp and gets the test case pass/fail count """ LOG.info('In Parser class') def __init__(self): pass @staticmethod def get_count(output): ...
true
38d90e5e383c930544dd04cb34e7c2b9d7708a6b
KuboBahyl/coding-interviews
/Algo topics/Paradigms/DynFibonacciMem.py
UTF-8
373
3.6875
4
[]
no_license
# Fibonacci - memoization technique def fibonacci_mem(num): def recursion(num): if mem[num] is None: if num <= 1: val = num else: val = recursion(num - 2) + recursion(num - 1) mem[num] = val return mem[num] mem = [None] * (n...
true
c18a38f0635658fee25d809c0f7e50b467ec98b4
watermelon-lee/leetcode
/code/64.最小路径和.py
UTF-8
1,731
3.015625
3
[]
no_license
""" @File : 64.最小路径和.py @Time : 2019-09-21 08:49 @Author : Wade @Software: PyCharm """ import copy class Solution: # rumtime error # dirction = [[1, 0], [0, 1]] # min=10000 # def minPathSum(self,grid): # self.grid = 0 # startx, starty = 0, 0 # map=[[0 for i in range(len(gr...
true
98bc651ef0973be2215c2e2ed8258eb9d3ee7bf3
ylin1992/VR_flare_calculator
/flare/flare_helper.py
UTF-8
298
2.765625
3
[]
no_license
import numpy as np def sort_images(images_array): images_array = sorted(images_array, key=np.mean) return __to_dict(images_array) def __to_dict(images_array): return { 'white_1x': images_array[1], 'white_8x': images_array[2], 'black_1x': images_array[0] }
true
9fe7bc6ef20979234c22221b083ea0c46de88554
stanman71/Python_Basics
/Machine Learning/Daten verarbeiten/Daten visualisieren.py
UTF-8
1,154
3.203125
3
[ "MIT" ]
permissive
""" Beispiel für die Visualisierung eines Datenpakets """ ## ########################## ## Teil 0: Einlesen der Daten ## ########################## import pandas as pd df = pd.read_csv("./Python_Training/Machine Learning/Daten verarbeiten/CSV/train.csv.bz2") X = df.drop("subject", axis = 1).drop("Ac...
true
608bd8f4a119aec2b7d9f805810e280506ce2cf1
Dggz/pybook
/algs.py
UTF-8
810
3.234375
3
[]
no_license
def read_file(): with open('alginput') as alginp: lines = alginp.readlines() return lines def is_prime(num): if num % 2 == 0 and num != 2 or num <= 1: return False for i in range(3, int(num // 2) + 1, 2): if num % i == 0: return False return True def r1_1(): ...
true
fda95d6db51adeec0a30a7a8c72938a62d04843e
hdt-modeling/hdt-forecast
/hdt_util/hdt_util/metrics.py
UTF-8
2,784
3
3
[ "MIT" ]
permissive
import numpy as np import math from scipy.stats import wasserstein_distance import tensorflow as tf from tensorflow.keras.layers import Conv1D def Mean_Absolute_Error(y_true, y_pred): if isinstance(y_true, list): y_true = np.array(y_true).reshape(-1) if isinstance(y_pred, list): y_pred = np.ar...
true
2a0f80630978bcb89a251e228eaa9e44bc08a504
f1ed/LeetCode
/py/Array/299-Bulls_and_Cows.py
UTF-8
608
3.3125
3
[]
no_license
class Solution: def getHint(self, secret: str, guess: str) -> str: # 0-9 cnt for guess (expect the same digit) cnt = [0] * 10 bulls = cows = 0 g = lambda a: ord(a) - ord('0') for si, gi in zip(secret, guess): if si == gi: bulls += 1 el...
true
9e0a7db95da641d0375e238b48a0c5a220dfa293
guillaumehuet/AdventOfCode
/2020/17_2/solve.py
UTF-8
7,537
3.109375
3
[]
no_license
from collections import defaultdict def readInput(file): state = defaultdict(lambda: False) x = 0 y = 0 z = 0 w = 0 for line in open(file).read().splitlines(): x = 0 for c in line: if c == '#': state[(x, y, z, w)] = True x += 1 y += 1 return {'state' : state, 'lowBound'...
true
1781bb1daeca59154c5f064248ee9dd6992c078d
jimimao/Basic-algorithm
/SortingAlgorithm/InsertionSort.py
UTF-8
790
3.796875
4
[]
no_license
class InsertionSort(): """ 从小到大 直接插入排序 1. 空间O(1) 2. 时间最差 O(n**2),最好O(n) 3. 排序是稳定排序 """ def __init__(self,listA:list): self.listA = listA def InsertionSort(self): n = len(self.listA) for j in range(1,n): key = self.listA[j] i = j-1 ...
true
6277807bab5604e85ac942ea405ea56f702a4c0b
michael1999wang/Tic-Tac-Toe
/Driver.py
UTF-8
634
3.890625
4
[]
no_license
from Board import Board b = Board() turn = True while (not b.win()): if (turn): print("Player 1: Enter the row for your X:") x = input() print("Player 1: Enter the column for your X:") y = input() b.mark_X(int(x) - 1, int(y) - 1) if (b.win()): print("Pla...
true
a5c9c17b669a469fbfa4fbf2f691b4b1ee96d36b
wulei2018/AI4K
/VDSR_Pytorch/test.py
UTF-8
3,803
2.625
3
[]
no_license
import torch from torch.autograd import Variable import numpy as np from PIL import Image from torchvision.transforms import ToTensor from VDSR_Pytorch.model import VDSR import matplotlib.pyplot as plt def calc_psnr(img1, img2): return 10. * torch.log10(1. / torch.mean((img1 - img2) ** 2)) def test_one(): sca...
true
ac2db3c1e409a53ca4f4ee18829be9555cdc03a2
gastonginestet/ayudAR
/app/db.py
UTF-8
747
2.515625
3
[]
no_license
import pymysql from flask import cli from flask_sqlalchemy import SQLAlchemy base = SQLAlchemy() def connection(current_app): """Genera la conexión a la base de datos.""" db_url = "mysql+pymysql://{username}:{password}@{host}/{database}".format( username=current_app.config["DB_USER"], passwo...
true
60ed5ba6c5398935ed3b5d971fb24cd4e132ea2b
hatchways/team-acorn
/server/resources/review_get.py
UTF-8
1,758
2.515625
3
[]
no_license
from extensions import Resource, reqparse, jwt_required, get_jwt_identity, json from models.review_model import ReviewModel from models.user_model import UserModel class ReviewGet(Resource): # Get reviews that you are reviewing of others @jwt_required def post(self): parser = reqparse.RequestPars...
true
3298a8ce6c7d4cad242c0f5af7361019240546dc
vasanthkumar7/DATASTRUCTURES-MASTERED
/sort_an_linkedlist.py
UTF-8
1,361
3.484375
3
[]
no_license
class Node: def __init__(self,data): self.data=data self.next=None def insert_linkedlist(d,head,root): if head==None: head=Node(d) head.next=None root=head else: n=Node(d) n.next=None root.next=n root=n return head,root def print_l...
true
f861c2f38e4c09738615535d999a20b63be8cc99
mohankrishna225/DataPipeline
/run_python_code.py
UTF-8
687
2.859375
3
[]
no_license
import boto3 import xlrd s3 = boto3.resource('s3',) loc = input("Enter filename(test.xlsx)") or "test.xlsx" wb = xlrd.open_workbook(loc) sheet = wb.sheet_by_index(0) sheet.cell_value(0, 0) sourcebucket =(sheet.cell_value(1, 0)) print(sourcebucket) destinationbucket = (sheet.cell_value(1, 1)) print(destinationbucket) ...
true
2e01a27b5d4d1ae4dd43d3509468acb6eec8b92b
reyoung/MITHackthonDetectionDemo
/main.py
UTF-8
1,617
2.796875
3
[ "MIT" ]
permissive
import collections import cv2 import numpy as np import requests from PIL import Image BACKEND_URL = "http://127.0.0.1:8000" THRESHOLD = 0.3 img = Image.open("test.jpg") # Resize or crop to 300 x 300 img = img.resize((300, 300), Image.ANTIALIAS) img.save("img2.jpg") input_img = cv2.imread("img2.jpg") mean = np.arr...
true
451df1a6498d652e48d37e085e1797558529e8d2
kyeongwoong/Scipy
/test.py
UTF-8
319
4.375
4
[]
no_license
class Person: def __init__(self, name): #생성자 : 클래스를 초기화하는 메소드 self.name = name print("생성자 호출") def hello(self): print("하이!! " + self.name + "!") def goodbye(self): print("Good-bye " + self.name + "!") p1 = Person("kim") p1.hello() p1.goodbye()
true
60c1de5af8fba02c6086de081c7d71b8dee20953
youngsheep7/datastructure_algorithm_for_python
/programmer_algorithm_interview/prj/production_codes/array_seekdup.py
UTF-8
526
4.0625
4
[ "Apache-2.0" ]
permissive
""" seek duplicate element in an array """ class Array(object): def __init__(self, *args): self.elms = args self.xor_val = self.xor() def xor(self): """calculate the xor result of array""" r = 0 for elm in self.elms: r ^= elm return r def main(): ...
true
2b77c40ecb5552e44c1a82526900663d3c627d1e
Meet200/-Algorithms-in-python
/BFS.py
UTF-8
455
3.671875
4
[]
no_license
# BFS import collections def bfs(graph,root): visited,queue=set(),collections.deque([root]) visited.add(root) while queue: vertex = queue.popleft() print(vertex) for neighbour in graph[vertex]: if neighbour not in visited: queue.append(neighbou...
true
726a60ddf2cdf4e726033ad27c5064ed822d9a8e
DannyGsGit/SciOps_Beanstalker
/Code/Flask_Beanstalk_Sample/application.py
UTF-8
2,296
3.015625
3
[]
no_license
#~~~~~~~~~~~~~~~~~~~~~~~~ #### Import packages #### #~~~~~~~~~~~~~~~~~~~~~~~~ ## ML Dependencies from sklearn.ensemble import RandomForestRegressor import numpy as np import pandas as pd import boto, pickle # Web service dependencies from flask import Flask, request, abort, jsonify #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
true
fd9652f4996f2e88c17bb580c62e25fbeba08fcd
CZH-HW/Python
/web_spider/SpiderModles/taobao_search/search_taobao_goods.py
UTF-8
1,581
3.265625
3
[]
no_license
import requests import re def get_html_text(url, i): # 获取url的文本信息 try: headers = { "User-Agent":"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"} r = requests.get(url, headers = headers, timeout = 30) r.rais...
true
c9ff6ba1872e78675258142b03240742321f46a4
herbertguoqi/PAT
/1011.py
UTF-8
381
3.125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Sep 19 16:40:09 2017 @author: dell """ if __name__ == '__main__': a = int(input()) num=[] for i in range(1,a+1): num.append(input().split()) for n in range(1,len(num)+1): b =[int(i) for i in num[n-1]] s = 'Case #'+repr(n)+': '+repr(b[...
true
84144da0b36cee714845b934ab4604a83018b35c
kasai-mitsuru/my_web_server
/views/ParametersView.py
UTF-8
819
2.5625
3
[]
no_license
from my_http.Request import Request from my_http.Response import Response, HTTP_STATUS from views.BaseView import BaseView class ParametersView(BaseView): def get(self, request: Request) -> Response: """ リクエストメソッドがGETだった時の処理 """ body = f"""\ <html> <body> ...
true
411a5c91eff581cc393217fe851d2b23d0f6dbde
JindaPeter/Pycharm-battle-game
/a2/a2_playstyle.py
UTF-8
17,552
3.65625
4
[]
no_license
""" The Playstyle classes for A2. Docstring examples are not required for Playstyles. You are responsible for implementing the get_state_score function, as well as creating classes for both Iterative Minimax and Recursive Minimax. """ from typing import Any, List, Union import random class Playstyle: """ The...
true
5102500d5885d3a0d787213a294ab9353d728c97
rarescosma/der-py
/src/der_py/obsidian/auto_alias.py
UTF-8
959
2.90625
3
[ "MIT" ]
permissive
"""Infer an alias from the filename and write it as YAML front matter.""" from typing import Iterable, List from . import Args, Line def process_line(line: Line, aliases: List[str]) -> Iterable[str]: """Yield frontmatter + the rest of the file unchanged.""" aliases_line = f"aliases: [{', '.join(map(_wrap_ali...
true
a57c622e331105204be7729139f0d174ff49efac
mx1001/animation_nodes
/nodes/text/text_sequence_output.py
UTF-8
2,922
2.578125
3
[]
no_license
import bpy from bpy.props import * from ... utils.layout import writeText from ... base_types.node import AnimationNode class TextSequenceOutputNode(bpy.types.Node, AnimationNode): bl_idname = "an_TextSequenceOutputNode" bl_label = "Text Sequence Output" errorMessage = StringProperty() def create(sel...
true
289b08155cd5083516ebe55f9f67bb9355be1a82
alonzoc1/Inheritance-Simulation
/special.py
UTF-8
3,347
3.046875
3
[]
no_license
#This special class is actually comprised of two types of "Hunters": A 'Mothership' and #it's 'Parasites'. The mothership moves very slowly (2 pix per update) in a straight line, but if a #prey reaches its vision (200), it will fire out a parasite, which is like a Hunter #that does not shrink/grow. After the parasite e...
true
adb2c0a7988d4fb6e1aaa8e551e69fd37f08a30e
xneby/kolstat
/kolstatapp/utils/tdf/convert.py
UTF-8
456
2.640625
3
[]
no_license
#!/usr/bin/env python2 import sys import yaml from pprint import pprint from datetime import date def convert_file(filename): with open(filename) as f: data = f.read() y = yaml.load(data) y['operations'][0]['mode'] = 'interval' y['operations'][0]['from'] = date(2013, 4, 26) y['operations'][0]['to'] = date(20...
true
7486a5c8156827d4e703e915978f9cdc02cf7970
VitoUnderwood/satk
/satk/satk/news_classifier/utils/data.py
UTF-8
2,672
2.65625
3
[ "MIT" ]
permissive
# -*- coding:utf-8 -*- from torch.utils.data import DataLoader, Dataset from ..models.bert_news_cls import BertConfig from tqdm import tqdm import torch class NewsDataset(Dataset): def __init__(self, data_path, tokenizer, max_length): # load data self.contents = [] self.labels = [] ...
true
2dc57428493ffc05b4c17f9dd691a3632a98cbdb
ITA-ftuyama/appBD
/main.py
UTF-8
6,386
2.96875
3
[]
no_license
# -*- coding: utf-8 -*- # !/usr/bin/env python u"""Aplicação GUI em alto nível.""" # Professor: Ricardo # Disciplina: CES-30 # Autor: Felipe Tuyama from database import Database from Tkinter import * import tkMessageBox class Application: u"""Aplicação principal.""" def __init__(self, master=None): u...
true
13fc7eacc5617ccb3176c9b2c7076b9454c97940
jackymail/python_practise
/memcached/cache.py
UTF-8
514
2.71875
3
[]
no_license
MEM_SERVER = '127.0.0.1' MEM_PORT = '11211' MEM_TIMEOUT = 30 import memcache,hashlib mem = memcache.Client(['%s:%s' % (MEM_SERVER,MEM_PORT)]) def get_result(query): if query: hash = hashlib.md5(query).hexdigest() result = mem.get(hash) if result: return result else: ...
true
6be43b4fbeb0eedc726c3909da4a9004d6d27290
liweiwei1419/Machine-Learning-is-Fun
/Association-Analysis/FP-growth.py
UTF-8
8,171
3.421875
3
[]
no_license
# 参考资料:使用 Apriori 算法和 FP-growth 算法进行关联分析 # https://www.cnblogs.com/qwertWZ/p/4510857.html # 代码还是基于《机器学习实战》,只不过没有封装 # FP树的数据结构 class TreeNode: def __init__(self, name, count, parent_node): # 接下来的 4 个属性是在 FP 树中才用到的 self.name = name self.count = count self.parent = parent_node ...
true
2ca0ae6e13e6565a19a1b12269e82d393584c22e
arthurtomas/Codes_git
/desafio054.py
UTF-8
313
3.953125
4
[]
no_license
#Maior de idade ou não count = 0 for c in range(0, 7): birth = int(input('{}. Digite o ano de nascimento: '.format(c+1))) age = 2019 - birth if age >= 18: count = count + 1 print('Levando em consideração os anos digitados, temos {} maiores de idade e {} menores.'.format(count, 7 - count))
true
65c53a8af379cb8d3f6c7a0493fffa0249a3eabf
starwarstwobillion/starting-out-with-python-3rd
/chap.6/05. Sum of Numbers.py
UTF-8
264
3.90625
4
[]
no_license
# Chapter.6 # 05. Sum of Numbers def count(): object_file = open('numbers.txt', 'r') total = 0 for i in object_file: i = int(i.rstrip('\n')) total += i print(i) print('The total is', total) object_file.close() count()
true
9f2f43079387c3bf1ed7eb5a64f8635545c1c32e
Competitive-Programmers-Community/LeetCode
/557. Reverse Words in a String III/main.py
UTF-8
232
3.171875
3
[]
permissive
class Solution: def reverseWords(self, s): """ :type s: str :rtype: str """ words=[] for word in s.split(" "): words.append(word[::-1]) return " ".join(words)
true
922d358ca25faf1fcae7aa1aba11af6515aff993
gauravkdm/PythonInterviewbasics-
/test37.py
UTF-8
327
2.9375
3
[]
no_license
from matplotlib import pyplot as plt from matplotlib import style style.use('ggplot') x=[10,12,13] y=[8,16,6] x2=[8,15,11] y2=[6,15,7] plt.plot(x,y,'b',label='lineone',linewidth=5) plt.plot(x2,y2,'r',label='linetwo',linewidth=5) plt.title('Epic Info') # fig=plt.figure() plt.xlabel('X-axis') plt.ylabel('Y-axis') plt...
true
3261f5d4c42894d4881c7f8045a7bdf2b4ab50a2
JulieLenzer/nlp_assignments
/assignment4/assignment4.py
UTF-8
6,178
3.390625
3
[ "MIT" ]
permissive
import sys import numpy as np import argparse # Import functions from other assignments from assignment4_fns import * # Convenient for debugging but feel free to comment out from traceback_with_variables import activate_by_import ####################################################################################...
true
b760abec77e12fc63d10eef1c7c132e9ca5107c4
dblackrun/pbpstats
/pbpstats/data_loader/stats_nba/scoreboard/loader.py
UTF-8
1,776
3.40625
3
[ "MIT" ]
permissive
""" ``StatsNbaScoreboardLoader`` loads all games for a date and creates :obj:`~pbpstats.resources.games.stats_nba_game_item.StatsNbaGameItem` objects for each game The following code will load data for 02/03/2020 .. code-block:: python from pbpstats.data_loader import StatsNbaScoreboardFileLoader, StatsNbaScoreb...
true
e8fdfae43ec6c7cf3864e3ea1fd73aebc57e0a1d
Wangjingfang/tensorflow_learning
/Python_code/301_simple_classification.py
UTF-8
1,742
3.203125
3
[]
no_license
""" Dependencies tensorflow: 1.1.6 matplotlib numpy """ import tensorflow as tf import matplotlib as plt import numpy as np tf.set_random_seed(1) np.random.seed(1) # fake data n_data = np.ones((100,2)) x0 = np.random.normal(2*n_data,1) # # class0 x shape = (100,2) # 从mean为2,标准差为1的正态分布随机选取数值填充到shape中各个元素位置 y0 = np....
true
32409396f56b905f88124c55d1880cc650a6a743
rishitha957/RCI_python
/unittest_data.py
UTF-8
2,023
3.421875
3
[]
no_license
import unittest import data class TestData(unittest.TestCase): def test_nonhexinput(self): print("\nTesting non hexadecimal input case!") self.inc = input("Enter any non hexadecimal input to test: ") self.obj = data.Data(self.inc) self.list1 = self.obj.generation() self.assertEqual(50,len(self....
true
920eb8bc5fbfec9174396424cfef07fabda2c21b
gajdusep/kp-anonymity
/src/k_anonymity.py
UTF-8
15,689
2.703125
3
[]
no_license
import math import time import numpy as np import random from itertools import combinations from typing import Tuple, List from group import Group, create_empty_group from verbose import verbose def compute_ncp(rows: np.ndarray, min_max_diff: np.ndarray) -> float: """ rows: e.g. np.array([[1,2,5,2],[3,2,5,...
true
5c07a153b4ecf8b27e626d35acdae7cc5f92f921
earmingol/cell2cell
/cell2cell/plotting/circular_plot.py
UTF-8
22,567
2.796875
3
[ "BSD-3-Clause" ]
permissive
# -*- coding: utf-8 -*- import matplotlib.pyplot as plt import matplotlib.patches as patches from matplotlib.patches import Arc from matplotlib.path import Path import networkx as nx import numpy as np import pandas as pd from cell2cell.plotting.aesthetics import get_colors_from_labels, generate_legend def circos_...
true
2cd15f807830cac71a9c8415b89e32b86c87660d
astromsshin/astromsshin.github.io
/science/code/sdss_photo_check.py
UTF-8
1,318
2.765625
3
[]
no_license
#!/usr/bin/env python # Written by Min-Su Shin in Princeton astrophysics # Feel free use or revise the code. # puporse : to search the SDSS PhotoObjAll in a command-line mode import sqlcl import sys import string import time import getopt if (len(sys.argv) == 1 or len(sys.argv) != 3): print "It checks the SDSS Phot...
true
f516dfab4aed6c7b63279ecfc6f57e9f02bfa837
fandi-peng/Project_Euler
/code/euler50.py
UTF-8
522
3.171875
3
[]
no_license
import pyprimes all_primes = list(pyprimes.primes_below(1 * 10 ** 6)) def find_consec(): l = 0 for pos1, i in enumerate(all_primes): for pos2, j in enumerate(all_primes): if pos2 <= pos1: continue s = sum(all_primes[pos1:pos2]) if s > 1 * 10 ** 6:...
true
bc47425d636e5b3a82c6b0b8d9b45fe8a2d26a0c
VR-Scott/practice_team_08
/ticket.py
UTF-8
3,500
3.03125
3
[]
no_license
import datetime import time import os # global var time_difference_capture = datetime.datetime.today() # time_difference_capture # create a new ticket def logout(): expired_ticket = "2020-11-16 15:40:32.045747" ticket = open("app_data/ticket.txt", "a+") ticket.write(f"{expired_ticket}\n") ticket.clos...
true
deb2364e427c579a170f50f0154198420317059b
zlj-7/codewars_python_solution
/5kyu/Product of consecutive Fib numbers.py
UTF-8
113
3.21875
3
[]
no_license
def productFib(prod): a, b = 1, 1 while a*b < prod: a, b = b, a+b return [a, b , a*b == prod]
true
04c2f69f476e52b0058ace968f41e0841052f9d1
smyousuf14/Getting-Started-With-Python-
/Inheritance.py
UTF-8
340
3.890625
4
[]
no_license
class Animal: age = None def __init__(self, age): self.age = age def toString(self): print("Age: " + str(self.age)) class Cat(Animal): def __init__(self, age, colour): super().__init__(age) self.colour = colour don = Animal(10) Joe = Cat(12, "blue") don.toStri...
true
881fa5c8e91c36eb05ff31d0a2535df9ba5659f4
TavorB/ProjectEuler
/prob16.py
UTF-8
151
3.09375
3
[]
no_license
def prob16(): k = str(2 ** 1000) numarr = list(k) currsum = 0 for i in range(len(numarr)): currsum += int(numarr[i]) print(currsum) prob16()
true
4a4069b41937252a3cde757b5fa37f92b73549ad
Sobhagya12/Brandy-the-AI
/Listener.py
UTF-8
1,064
2.890625
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[19]: def listen(): import speech_recognition as sr sample_rate = 48000 chunk_size = 2048 r = sr.Recognizer() mic_name = 'Microphone (Realtek(R) Audio)' mic_list = sr.Microphone.list_microphone_names() for i, microphone_name in enumerate(mic_lis...
true
dda4c03f3e858d46eb7410fa77b10c53237ac942
lalacat/crawler
/twisted_test/defer/defer-13-cooperation.py
UTF-8
2,060
2.796875
3
[]
no_license
import time from twisted.internet import task, defer, reactor from test.framework.https.request import Request def parallel(iterable, count, callable, *args, **named): """ 实现同时控制处理,多个defer的功能 Cooperator是实现Cooperative task的,这是一个能够迭代的iterator,能够提供一个最基本的实现work。当处于yield状态的时候, Cooperator能够决定下个执行的task是哪个,...
true
0bb82d7462c211e0eac5472bfc7de0803732bae6
byungju0624/Python-Study
/movie.py
UTF-8
315
2.921875
3
[]
no_license
from bs4 import BeautifulSoup import urllib.request as req code = req.urlopen("http://www.cgv.co.kr/movies/") #print(code.read()) soup = BeautifulSoup(code, "html.parser") #print(soup) #내가 원하는 요소 가져오기 title = soup.select_one("strong.title") #요소내용 가져오기 print(title.string)
true
0c82a357c5c5363999938512f309882cb0c9e2ed
Topspin26/SiburChallenge2020
/translit.py
UTF-8
1,924
2.953125
3
[]
no_license
translitMapRuEn = { "инк": ["inc"], "ай": ["i"], "аш": ["ussi", "h"], "дж": ["g", "j"], "кс": ["x", "ks", "cs"], "а": ["a"], "б": ["b"], "в": ["v", "w"], "г": ["g"], "д": ["d"], "е": ["e"], "ё": ["e", "eu"], "ж": ["zh"], "з": ["z"], "и": ["i", "e"], "й": [...
true
9bbf2d82683ec0bdfa11a0f931f8f1898787a79f
xvanov/brilliant
/quant/coin_sim.py
UTF-8
1,117
3.34375
3
[]
no_license
import random class Coin(): def __init__(self, pT=0.5): self.pT = pT def flip(self): pT = self.pT i = random.random() if i >= pT: return 'H' else: return 'T' class Coins(): def __init__(self, N, T): self.allTosses = [] for i ...
true
4e353a8cbee0988da2442084d000e39125550763
luobaozhu/githubtest
/branchCheck.py
UTF-8
1,407
2.640625
3
[]
no_license
# -*- coding: utf-8 -*- import hashlib import os import socket import pandas as pd def getFileMd5(path): fd = open(path, "r") fcont = fd.read() fd.close() fmd5 = hashlib.md5(fcont).hexdigest() return fmd5 #add_test def getMd5DataFrame(directoryType): directory = "/data/deployments/%s/spark...
true
ab17ddf149aaeca42cbe4c4d68f07d8830344d20
jackmerlinbruce/ChessViz
/KingSquarer.py
UTF-8
1,539
3.28125
3
[]
no_license
''' Creates the heatmaps for the parsed pgn files <<<CURENTLY UNFINISHED>>> ''' def create_dataframe(): check_df = pd.DataFrame(SQUARE_NAMES,columns=['king_square_name']) check_df.index = check_df['king_square_name'] check_df['frequency'] = 0 stale_df = pd.DataFrame(SQUARE_NAMES,columns=['king_square_...
true
a194f0f6cb95ac5187a558444780cca65a9fc62d
Ashimar/crawler_demo
/qiushibaiku_test.py
UTF-8
6,278
3.15625
3
[]
no_license
# coding:utf-8 """ import urllib2 import urllib import re page = 1 url = 'https://www.qiushibaike.com/hot/page/' + str(page) + '/' user_agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6)" headers = {"User-Agent": user_agent} try: request = urllib2.Request(url, headers=headers) response = urllib2.urlopen(...
true
6cabdd2437647eb82d4fe244760bc308279a6ac9
cocoa-dev-1/coding-class
/영화감독-숌.py
UTF-8
188
3.53125
4
[]
no_license
n = int(input()) i = 666 count = 1 while True: if str(i).find('666') != -1: print(count, n, i) if count == n: break count += 1 i += 1 print(i)
true
d1ee72470007607db5fa51d4b17b81daa49ca0c0
ForLuna1998/Group-6-Animal-Hospital-System
/demo draft for windows/blogapp/routes.py
UTF-8
2,999
2.59375
3
[]
no_license
from flask import render_template, flash, redirect, url_for, session, request, jsonify from werkzeug.security import generate_password_hash, check_password_hash from blogapp import app, db from blogapp.forms import LoginForm, SignupForm from blogapp.models import User from blogapp.config import Config import os @app....
true
9a325d81f4410000892b67a444ebae603979cce0
Hamzamusameh/TwitterAPI
/TwitterAPI.py
UTF-8
878
2.6875
3
[]
no_license
from TweepyHelper import TweepyHelper def main(): consumerKey = input('Enter a consumer key: ') while not consumerKey: consumerKey = input('Enter a consumer key: ') consumerSecret = input('Enter a consumer secret: ') while not consumerSecret: consumerSecret = input('Enter a consumer sec...
true
b8b482185e81326be98750a53387d568568b6505
BDMC786/WeatherApp2
/WeatherApp2/my_modules.py
UTF-8
13,728
3.203125
3
[]
no_license
def fixnyc(city): nycAlts = ["new york" , "new york, ny" , "new york city" "new york, new york" , "new york ny" , "new york new york"] if city.lower() in nycAlts: city = "manhattan" if city.lower() == "bayonne": city = "Bayonne, NJ" return city def getlocation(city): ...
true
fa861852068e81c59b90389b06848c209fc69fe3
trungdaoww/bai_tap
/4.7.py
UTF-8
140
3.234375
3
[]
no_license
s=input('nhập chuỗi: ') l=[] for i in s: if i.isnumeric() : continue l.append(i) h=' '.join(l) print(l) print(h)
true
46ba1c63362663bf75ee8a9acc8b16e5160d8a35
jichunwei/MyGitHub-1
/saigon/rat/RuckusAutoTest/tests/zd/ZD_DynamicIPConfiguration.py
UTF-8
3,984
2.59375
3
[]
no_license
# Copyright (C) 2008 Ruckus Wireless, Inc. All rights reserved. # Please make sure the following class docstring is accurate since it will be used in report generation. """ Description: ZD_DynamicIPConfiguration class verifies if the Zone Director can get Address from the DHCP Server. Because of the fact that changin...
true
0fda09aacc7fde436bdd7f0af8b09416b1d9077e
ABiar/Python-Projects-School
/sommeChiffre.py
UTF-8
491
3.984375
4
[]
no_license
maxdem = int(input("Entrez le nombre de chiffres que vous voulez additionner\n")) def sommeChiffre(max) : somme1 = 0 for i in range(0,max ): somme1 = somme1 + i print(somme1) def sommePair(max): somme2 = 0 for i in range(0,max): if(i%2 == 0): somme2 = somme2 + i print(somme2) def somme...
true
df15fff8a907e47a466a405e46923b25abc2cde8
ari-thakur/homey
/Pi_Interface/auth.py
UTF-8
2,025
2.84375
3
[ "MIT" ]
permissive
import json import tokens ''' USER FORMAT user = { 'user':'user-name', 'pass':'password' } ''' class Authorization: def __init__(self): print('Entered into authorization') ''' Return --> bool True -- if signed up False -- exception occured or user already exists ''' # function to sign up th...
true
a8903be0341e84c9b64ba3b4c123ce2f57f3cca1
gschen/sctu-ds-2020
/1906101095-王凯/0324/zy.py
UTF-8
239
2.921875
3
[]
no_license
class Find: def middleNode(self, head): cur=cur=head while cur and cur.next: if cur.next.next==None: return cur.next cur=cur.next cur=cur.next.next return cur
true
53e8a4e8b87c7d109f9205bc9865dcb36fecddc1
altlnt/id_modele_reel
/x_RNN_plot.py
UTF-8
945
2.703125
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Sep 13 10:29:09 2021 @author: alex """ import json import os import matplotlib.pyplot as plt import numpy as np path_hist=os.path.join(os.getcwd(),"tmp") hist_dir={} bpath=os.path.join(os.getcwd(),"tmp") flist=sorted([i for i in os.listdir(bpath) if...
true
ebd5638c7136970af8f0dd11c1c46ce8f17c805b
alexxxeyyanchenk0/labs
/lab3/punk.py
UTF-8
4,156
3.046875
3
[]
no_license
import pygame from pygame.draw import * import math pygame.init() FPS = 30 screen = pygame.display.set_mode((1100, 500)) skin_color = (255,223,196) punk_pos1 = (400,300) def draw_head(head_size, head_location, eye_color): circle(screen,skin_color, head_location,int(head_size)) circle(screen...
true
c65c059f14aa167e479aa32a4ef07902a51493c6
rsbrum/NordVPN-python-cli
/vpn/vpn.py
UTF-8
4,217
2.828125
3
[]
no_license
import subprocess, os, time, logging, psutil logger = logging.getLogger('root') class Vpn(object): """ Interfaces with OpenVPN through bash scripts and manages its connection """ def __init__(self): self.status = False self.pid = 0 def start(self,server_address): ...
true
886f5314ee19362a4975c26de9302fb2227b331e
akaihola/darker
/src/darker/tests/test_difflib.py
UTF-8
1,625
2.8125
3
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
"""Some tests for `difflib` to ensure and illustrate its logic""" from difflib import SequenceMatcher from darker.tests.git_diff_example_output import ( BLANK_SEP_CHANGED, BLANK_SEP_ORIGINAL, BLANK_SEP_SANDWICH_CHANGED, BLANK_SEP_SANDWICH_ORIGINAL, CHANGED, ORIGINAL, ) def test_sequencematch...
true
dfbb893220920ab78728c81aed7781673a965f49
buidinhan/spc
/utils/capability_indices.py
UTF-8
3,362
2.671875
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
import pandas as pd import numpy as np from scipy import stats # CAPABILITY INDICES def Cp(series, LSL, USL): mean = np.mean(series) std = np.std(series, ddof=1) return np.abs(USL-LSL) / (6*std) def Cpk(series, LSL, USL): mean = np.mean(series) std = np.std(series, ddof=1) return m...
true
ebcefbc6cbd7a7e5e9d9cb30cc925a12803fe1cb
eltgm/AlgoLabs
/lab5/ex2.py
UTF-8
535
3.515625
4
[]
no_license
import csv def get_students(file_name): students = [] with open(file_name, encoding='utf8') as students_file: students_reader = csv.reader(students_file, delimiter=';') header = next(students_reader) print(header) for student_line in students_reader: students.appen...
true
ad2a9953b1aa72c69774822c85c1186ffa436352
Cours-a-Ynov/Cours-Python
/Exo4.2.py
UTF-8
631
3.90625
4
[]
no_license
from math import * from point import Point class Circle: def __init__(self, origin, radius): self.origin = origin self.radius = radius def perimeter(self): return pi * self.radius * 2 def area(self): return pi * self.radius**2 def dist(self, another_circle): o1 =...
true
555dcc70e3c98a172ea7f66c1f327b66f9c87d7d
Iturriaga10/TC1028-Python
/Clase9/ej2.py
UTF-8
347
3.5
4
[]
no_license
''' Ejercicio 2 Escribir un programa que almacene las asignaturas de un curso (por ejemplo Matemáticas, Física, Química, Historia y Lengua) en una lista y la muestre por pantalla el mensaje Yo estudio <asignatura>, donde <asignatura> es cada una de las asignaturas de la lista. ''' for materia in materias: print(...
true
f76df73b7d84069d4544d2c7d26b5e1098069da4
JWiryo/LearnAlgorithms
/Backtracking/CombinationSumII.py
UTF-8
1,266
3.4375
3
[]
no_license
class CombinationSumII: # Backtracking Solution # Time Complexity: O(NLogN + 2^N) -> O(2^N) # Space Complexity: O(N) def combinationSum2(self, candidates: [int], target: int) -> [[int]]: # Initiate result result = [] # Sort Candidates candidates.sort() ...
true
a6281f4403f67355f766053edec68851f62f320d
solita/ml-engineer
/mle4/train.py
UTF-8
2,701
2.59375
3
[]
no_license
import boto3 import zipfile import sys import os from ctypes import cdll # ** Start of ML Runtime ** # Don't edit :) native_libs = { "sklearn-scipy-numpy": ["libquadmath.so.0", "libgfortran.so.3", "libatlas.so.3", "libptcblas.so.3", "libptf77blas.so.3", "libf77blas.so.3", "libcbla...
true