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
80a88e92ce996beaa197c93ce49262aa36275de5
ganjiron/ganpython
/DBProject/TeamProject1/Hall.py
UTF-8
337
3.078125
3
[]
no_license
# 1. 공연장 # - 공연장 ID: ID: ID: 정수 # - 이름 : 문자열 (최대 200 자) # - 위치 : 문자열 (최대 200 자) # - 정원 : 정수 (1 (1 (1 이상의 이상의 값) class Hall(): def __init__(self): self.h_id self.h_name self.h_loc self.h_cap if __name__ == '__main__': pass
true
35a678911e341e45cfcc6a8f61afd1be8e169434
CompanyBook/api-examples
/python/news.py
UTF-8
1,739
2.921875
3
[]
no_license
from authority import API_KEY from companybook import API_ENDPOINT_BASE from json import loads from logging import info, error from requests import get from sys import argv HEADERS = { 'Accept': 'application/json', 'x-api-key': API_KEY } class NewsService: COMPANY_RELATION_URL = "{}/{}".format(API_ENDPOI...
true
27ff5129e9093becaea3fa0ad32fcb8323b45264
404-html/IN4325-NLP-Project
/metric_labeling.py
UTF-8
2,413
3.078125
3
[]
no_license
# Defines the metric labeling function. from scipy import spatial from sklearn.neighbors import NearestNeighbors # Metric used for labels. # Note that we can also use different ones, but the paper assumes this metric. def d(x, y): return abs(x - y) # Trivial f definition, which is a monotonically increasing fu...
true
62333ace00356acfce8f83a054a417f482c8bb56
wally-wally/TIL
/02_algorithm/sw_expert_academy/code_problem/D2/2001.파리퇴치/2001.py
UTF-8
639
2.8125
3
[]
no_license
import sys sys.stdin = open('sample_input.txt', 'r') T = int(input()) for i in range(T): line, fly_catcher = list(map(int, input().split())) arr = [] for a in range(line): element = list(map(int, input().split())) arr.append(element) max_fly_count = 0 for j in range(line-fly_catche...
true
e8fb721ff72d2a41b2295c24ddaf38a1ccd1e19f
pyecharts/pyecharts
/pyecharts/charts/basic_charts/sunburst.py
UTF-8
1,628
2.765625
3
[ "MIT", "Apache-2.0" ]
permissive
from ... import options as opts from ... import types from ...charts.chart import Chart from ...globals import ChartType class Sunburst(Chart): """ <<< Sunburst >> Sunburst graphs are composed of multiple layers of ring graphs. In terms of data structure, inner circle is the parent node of outer circ...
true
38c0981161ee8277425ade159a33232d9e7cc6a5
yeoeunhwang/python-works
/leetcode_problem/reverse_words.py
UTF-8
238
3.484375
3
[]
no_license
def reverse_words(s): origin_words = [] reversed_words = [] origin_words += s.split() for w in origin_words: reversed_words += w[::-1] rws = ' '.join(reversed_words) return rws reverse_words()
true
0c8bfc5e1c6e2c8916eda4e318ec72f1d2ec87b2
nishiwakki/atCoder
/abc043/a.py
UTF-8
81
3.234375
3
[]
no_license
# -*- coding: UTF-8 -*- # 入力 N = int(input()) # 出力 print((N+1) * N // 2)
true
e6a41d7522fc0c77732296223ba691c1155cec67
sumith-018/ML-Lab_Tasks
/Tutorial 5/tut5.py
UTF-8
3,409
3.046875
3
[]
no_license
# ML Tutorial 5 import numpy as np import matplotlib.pyplot as plt import scipy.stats as stats import math import random import seaborn as sns from scipy.stats import multivariate_normal from numpy.linalg import inv from random import uniform def generate_n_test_points(n): x_coordinates=[] for i i...
true
4ff01ac779fcf17de9c6cdbb6485b4b9a5a4e221
ki1556ki/MJUOpenSource
/peframe/modules/apiantidbg.py
UTF-8
781
2.671875
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- # get함수, pe, strings_match를 파라미터로 가지며 array를 리스트로만들어 정렬한다음 리턴 def get(pe, strings_match): # antidbgs에 딕셔너리형식인strigns_match의 키값인 antidbg의 value값을 찾아서 넣어줌 antidbgs = strings_match['antidbg'] array = [] # pe에 DIRECTORY_ENTRY_IMPORT변수가 있다면 참 없다면 거짓을 판별하여 DEI에 넣어줌 DEI = hasattr(pe, 'DIR...
true
ceb8084cad9892bd6f7f0623d3e1e7cec6b8dd02
rayt579/leetcode
/premium/google/recursion/strobogrammatic_number_2.py
UTF-8
1,051
3.5625
4
[]
no_license
''' https://leetcode.com/explore/interview/card/google/62/recursion-4/399/ ''' class Solution: def findStrobogrammatic(self, n): """ :type n: int :rtype: List[str] """ def find_strobogrammatic(n, m): if n == 0: return [''] if n == 1: ...
true
7c39e8bd4d9e1dfbd3f4fad57e554e4d7da29742
PeterWurmsdobler/volumio-vfd
/src/volumio_vfd/volumio_client.py
UTF-8
3,415
2.65625
3
[ "MIT" ]
permissive
from __future__ import unicode_literals import logging import queue import threading from typing import Any, Optional from socketIO_client import SocketIO from volumio_vfd.player_status import PlayerState, PlayerStatus log = logging.getLogger(__name__) def on_GetState_response(*args: Any) -> None: log.debug("...
true
5f7207e456e262ef24389691d342674d415d4a64
hsrky/pythoninfo
/pythoninfo/lib/file_uploader/base.py
UTF-8
813
2.609375
3
[ "MIT" ]
permissive
import logging logging.basicConfig() class Base(object): ''' Base class for uploader ''' configs = dict() def __del__(self): # destructor, clean up resources: close connection, etc pass def set_configs(self, configs): # set connection configurations self.co...
true
5a2e91d81893b35b97c072dfe018a3d0d1f46f7b
Shirley-Xie/pyhton_demos
/test1.py
UTF-8
1,597
3.203125
3
[]
no_license
class Kls: no_inst = 0 def __init__(self): Kls.no_inst = Kls.no_inst + 1 @classmethod def get_no_of_instance(cls_obj): return cls_obj.no_inst ik1 = Kls() ik2 = Kls() ik1.get_no_of_instance() Kls.get_no_of_instance() def iget_no_of_instance(ins_obj): return ins_obj.__class__.no_inst...
true
50555befe9ab2d6a3e58c931429db81a11c54736
tnakaicode/jburkardt-python
/rnglib/r8_uni_01.py
UTF-8
2,187
2.71875
3
[]
no_license
#! /usr/bin/env python # def r8_uni_01 ( ): #*****************************************************************************80 # ## R8_UNI_01 returns a uniform random real number in [0,1]. # # Discussion: # # This procedure returns a random floating point number from a uniform # distribution over (0,1), not inclu...
true
45f9be6ac4427253e18815a52cb9b4ccf3f0941b
fenfeibani/pixelworld
/pixelworld/envs/pixelworld/library/world/aliens_sprites.py
UTF-8
3,182
2.625
3
[ "MIT" ]
permissive
import copy import pixelworld.envs.pixelworld as pw import pixelworld.envs.pixelworld.object_attributes as oa from ..helpers import h, L height = 100 width = 200 render_size = (200, 400) class UnknownEnemyState(Exception): pass class AlienMarchingStateObjectAttribute(pw.core.StateMachineObjectAttribute): ...
true
2f1ba2636ab090ac7d610dce545539726950535b
pynbody/pynbody
/pynbody/dependencytracker.py
UTF-8
1,736
3.046875
3
[]
no_license
import threading class DependencyError(RuntimeError): pass class DependencyContext: def __init__(self, tracker, name): self.tracker = tracker self.name = name def __enter__(self): self.tracker._calculation_lock.__enter__() if self.name in self.tracker._current_calculation...
true
4a4ee8dbf62a1138028ab17afd26d2596c4a6db8
zinking/acmcatchups
/uva/10062.freq.easy.py
UTF-8
365
2.9375
3
[]
no_license
import sys from collections import Counter if __name__ == '__main__': lines = sys.stdin.readlines() n = len(lines) for i in range(n): line = lines[i][:-1] c = Counter(line) sc = sorted(c.items(), key=lambda x:(x[1],x[0])) for ch,n in sc: print ord(ch),n #for ch,n in...
true
0c2732656addd98e5cb9f91e92d0306892569eef
ndulue/githubot
/create.py
UTF-8
1,105
2.578125
3
[]
no_license
import sys import os from selenium import webdriver from selenium.webdriver.common.key import keys path = "xampp/python/git/" class Gitbot: def _init_(self, username, password): self.username = username self.password = password self.bot = webdriver.Firefox() def createRepo(self): ...
true
c1772520bfc1e58130712c7c1fdcf7765f2b5323
SimonXu666j/pycode_learning
/实用编程技巧/数据结构相关话题/test01.py
UTF-8
736
3.75
4
[]
no_license
#1.如何在列表,字典,集合中根据条件筛选数据? ''' 常规方法:迭代(筛选后append到一个新的列表) 高级方法: filter函数 filter(lambda x:x>=0,data),返回一个filter对象 列表解析 [x for x in data if x>=0],返回一个列表 效率更高 字典解析 {k:v for k,v in d.iteritems() if v>90} 集合解析 {x for x in s if x%3==0} ''' from random import randint from timeit import timeit data=[randint(-1...
true
e79def7ae0a55608da4f620ad4847a0c6038f928
altamiranoErica/simulador_SO
/simulador_SO/src/paging.py
UTF-8
4,285
2.734375
3
[]
no_license
import memoryManager from memoryFrames import * class Paging(memoryManager.MemoryManager): def __init__(self, memory, pSize, disk): self.memoryF = MemoryFrames(memory, pSize) self.pageSize = pSize self.disk = disk self.pagesTable = [] def verifyMemorySpace(self, si...
true
5b0d831397a714f761ca880ce3af7146bfe1ddf4
fabianvf/BenchmarkDB
/mongodb/main.py
UTF-8
1,768
2.984375
3
[]
no_license
""" DB Benchmarking Application =========================== Mongo_db.py This file handles all interactions with MongoDB during the benchmarking process. """ from pymongo import MongoClient from local import * from benchmark_template import BenchmarkDatabase class Benchmark(BenchmarkDatabase): def __init__(s...
true
168ef05f67473e371bf76772e57473f696f0282e
rs-malik/nl2type
/nl2type/nl_utils.py
UTF-8
2,578
3.4375
3
[ "MIT" ]
permissive
import re from typing import List from nltk import pos_tag, WordNetLemmatizer from nltk.corpus import wordnet, stopwords def lemmatize_sentence(sentence: str) -> str: """ Lemmatizes words in a sentence. Lemmatizes on the sentence level because position of words is important. :param sentence: the sent...
true
fd2ec9ade705504d80c74bdf08f793b511b475cc
hunterluok/Security
/pythoncode/42_sums.py
UTF-8
645
3.453125
3
[]
no_license
class Solution: def __init__(self): pass def find(self, data): if len(data) < 1: return None lens = len(data) max_sum = -float("inf") temp_sum = 0 print(max_sum, '__') for i in range(0, lens): temp_sum += data[i] if ...
true
b9616033710d63f346c16986784058c73b0b1426
ayushchd/fb-hacker-cup-qualification-round
/findamin.py
UTF-8
778
2.53125
3
[]
no_license
import sys record = 1 inp = [] for line in sys.stdin: inp.append(line) t = int(inp[0]) case = 1 def func_next(li, el): while li[el] > 0: el += 1 return el while (t) : n, k = map(int, inp[record].split(" ")) a, b, c, r = map(int, inp[record+1].split(" ")) m = [0] * ((2*k)+1) m[0] = a l = [0] * (k+1) if m[0]...
true
e33336b152c467b4f79624439250a43cdc94bfed
thibaultmartin/242Analytics
/HW2/google.py
UTF-8
4,057
2.828125
3
[]
no_license
from bs4 import BeautifulSoup import re # Open file and load it in BeautifulSoup with open('google10k.html', 'r') as file: raw = file.read() soup = BeautifulSoup(raw, "html.parser") file.close() links_to_section = {'balance_sheets':'s6664394A37BCC94C11C8A63581ED820F', 'statements_income': 's5C85DE759405741EE2E0A6...
true
8ca971608c3f19ac648d261b7009767649bfc310
PerovaKate/exercise_six
/exercise_six.py
UTF-8
116
3.1875
3
[]
no_license
print((str('Hello Python')[6]) + str('a') + (str('Hello Python')[8:10])) bee = 'z' print(bee*7) print(bee.upper()*7)
true
4a88154bc629cef6bac175738ba9f2de609e01cd
florianCombarel/projet-graphes
/Graphe.py
UTF-8
301
2.734375
3
[]
no_license
class Sommet : """ - nomStation - ... """ def __init__(self): self.nomStation = "default" class Arc : """ - sommet1 - sommet2 """ def __init__(self, sommet1, sommet2): self.sommet1 = sommet1 self.sommet2 = sommet2
true
69fd64a6ce037e208559bab5eea26e58f1acc585
atomicateam/atomica
/atomica/optimization.py
UTF-8
79,464
2.859375
3
[ "MIT" ]
permissive
""" Implements various Optimizations in Atomica This module implements the :class:`Optimization` class, which contains the information required to perform an optimization in Atomica. An Optimization effectively serves as a mapping from one set of program instructions to another. """ import logging import pickle from...
true
e33b3597fd68df8d6ad7128af0dc038e4c6e244b
safetiesoff/cs161-project2
/p1_client.py
UTF-8
3,874
2.796875
3
[]
no_license
"""Secure client implementation This is a skeleton file for you to build your secure file store client. Fill in the methods for the class Client per the project specification. You may add additional functions and classes as desired, as long as your Client class conforms to the specification. Be sure to test against ...
true
c33f7a20c2cdae890ef28ef66e9e532a4513f0ca
vocky1995/LanguageProcessing100
/chap1/pro05.py
UTF-8
255
3.546875
4
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- def ngram(input,n=2): L = [] end = len(input)-n+1 for i in range(end): L.append(input[i:i+n]) return L if __name__ == "__main__": string = "I am an NLPer" print ngram(string,2)
true
92aa0fec610132bd05d46da0c3a1d36ec2f7ac41
jbylund/code_eval
/moderate/stack_implementation.py
UTF-8
846
3.515625
4
[]
no_license
#!/usr/bin/python import sys class stack: def __init__(self): self.data = list() return def push(self,value): self.data.append(value) def pop(self): if (self.is_empty()): return "" return self.data.pop() def is_empty(self): return(0 == len(...
true
b88fdf8e80fd8b5856f789240524aa2cfb8863fb
nicolassnider/python_39
/absoluteBeginners/07 - test coding skills.py
UTF-8
683
2.96875
3
[]
no_license
class AnonnymousSurvey(): """ Collects Annonymous answers to a question """ def __init__(self,question): """ init """ self.question = question self.responses = [] pass def show_questions(self): """ docstring """ print (...
true
8b8bb7c91d0ce42fa4a8fab7aa389c3edc4458ac
thirihsumyataung/Python_Tutorials
/for_loop_Python.py
UTF-8
201
3.390625
3
[]
no_license
numbers = [ 7, 5, 3, 2 , 1] for x_count in numbers: output = '' for count in range(x_count): # zero up to x_count , first is 5 output += 'x' print(output) #print('x' * x_count)
true
024c3fcf465a1295e596739640d6d622ec0eb4be
JadinTredup/NVTK
/NVTK/Sensors/EEG.py
UTF-8
2,733
2.578125
3
[]
no_license
import sys import timeit import time from openbci import cyton as bci from NVTK.utils.EEGUtils import parse_eeg_data STD_PORT = '/dev/ttyUSB0' BAUD_RATE = 115200 class EEGMonitor(object): """ This is a high-level wrapper for the OpenBCI Cyton object. This is meant to shorten many of the initialization ...
true
f4797bf15b4f55239c7a4297d4395c0c384c8349
ajuavinett/BIPN145
/AuditoryOddball_BIPN145.py
UTF-8
1,470
3.140625
3
[]
no_license
# IMPORT LIBRARIES # from IPython import get_ipython # get_ipython().magic('reset -sf') import numpy as np import time import winsound import serial # ESTABLISH COMMUNICATION WITH ARDUINO # Talk to the Arduino. This COM port will depend on where your Arduino is plugged in. # If your com port was different in...
true
e9d0a57d27450a507ac76932294ef26b8413fe03
namuan/dev-rider
/app/tools/tool_plugin.py
UTF-8
930
2.59375
3
[ "MIT" ]
permissive
from typing import Dict class ToolPlugin: _name: str = None _widget_class: str = None _view = None def __init__(self, name, widget_class): self._name = name self._widget_class = widget_class def init_view(self, view): self._view = view self.bind_events() def ...
true
f34ee142515fda40601a08d6396d17a2e75b4d9b
dainv1989/misc
/python/cam_client.py
UTF-8
1,055
2.765625
3
[]
no_license
""" measure delay of sending webcam data in multiprocess context using ZeroMQ ref: https://stackoverflow.com/questions/53049141/how-to-send-both-imagendarray-and-string-data-in-single-zmq-send-request """ import cv2 import zmq import numpy as np import time def recv_array_and_str(socket, flags=0, copy=True, track=Fals...
true
0dae7b37f3e7ed5267de26407d14c36088d7f14f
wuyuyu1024/Add-alpha-shape-on-ternary-plot
/ternary_alphashape.py
UTF-8
1,358
3
3
[]
no_license
import ternary import alphashape import matplotlib.pyplot as plt from descartes import PolygonPatch def to_t_points(points, permutation=None): """ Transfer the points to the points which can be plot correctly on a ternary ax :param points: A list of 3-tuples that (i, j, k) requires i + j + k = scale :...
true
5f04dfad835560d0378150fede153e340416ed59
hanno22/SpinHallEffectThesis
/models/SpinHallDataSet.py
UTF-8
8,733
2.671875
3
[]
no_license
import numpy as np import cv2 as cv import glob import os import re class SpinHallDataSet: def __init__(self, data_path, center, max_radius, k_0_NA, r_NA): self.center = center self.max_radius = max_radius self.__k_0_NA = k_0_NA self.__r_NA = r_NA def get_angle_from_file_...
true
d10d7477d9475b19787ce25130a46cd7839cedb7
TonyX19/mathematics
/limit.py
UTF-8
651
3.484375
3
[]
no_license
import math from sympy import * ########################## #limit f = (x+1)**2 + 1 # x = a - 1 limit(f, x, a-1) #a**2 + 1 #lim(x->0) sinx/x f = sin(x)/x limit(f, x, 0) #1 #limit(f, x, 0) print(limit(f, x, 0, dir='-')) #1 #ƒ(x) = cos(x);limit(Δx->0) [ƒ(x) - ƒ(a-Δx)]/Δx f = cos(x) dx = Symbol('dx') #dx ~ Δx print(l...
true
0ee5f992af1df48d2d08c33cf579a9302f22db5d
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_74/1057.py
UTF-8
1,738
3.046875
3
[]
no_license
import sys class BotTrust(object): def __init__(self, sequence): self.seq = sequence self.robots = {'O':1, 'B':1} self.chunks = [] self.moves = 0 self.discount = 0 def do_chunk(self, chunk): cost = 0 robot = chunk[0][0] d = max(0, abs(ch...
true
812625ec64388ce47b0e2e7c091fc506ed93bd9e
SCRFsecond/PyNoddyInversion
/code/MakeSearchMap.py
UTF-8
3,838
2.578125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Feb 20 16:00:49 2019 @author: ahinoamp """ import matplotlib.pyplot as plt import numpy as np from matplotlib.patches import Patch from matplotlib.lines import Line2D from matplotlib.collections import LineCollection def MakeSearchMap(n_threads, AllNumberRunsVals, AllAccepte...
true
aa53fc16cb2554d44a9f5f6f4a044f71f5e26b18
BJV-git/leetcode
/binary_search/peak_index.py
UTF-8
161
3.109375
3
[]
no_license
# return the peak fo the index def peak(A): flag = 0 la=len(A) for i in range(la-1): if A[i] > A[i+1]: return i return la-1
true
109f757979d8dc534b1b1956addf6169e0a15acb
PankeshGupta/pysyntax
/sysargv.py
UTF-8
336
3
3
[]
no_license
import sys # sys is a system module it has many low level functinalities # command line arguments, if the no. of command line argument is 2 then i will print the econd one because teh firt will be the name of the progam if len(sys.argv)==2: print("hello, {}".format(sys.argv[1])) else: print("bhai galat argument...
true
da1d7370f00a063b909889b260ff8146829817f6
zcyzhuangzhou/APILink
/script/html_text_preprocessor.py
UTF-8
5,434
2.796875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- """ ----------------------------------------- @Author: zhaocy @Email: 19110240027@fudan.edu.cn @Created: 2019/12/19 ------------------------------------------ @Modify: 2019/12/19 ------------------------------------------ @Description: """ import re import string import gen...
true
ffd30b45ae42189c0c50f51f7e35878824571632
doremifasollasi/CV_OlenaLiakhovych_form_flask
/MY_CV/my_CV.py
UTF-8
2,600
2.875
3
[]
no_license
# from flask import Flask # # from markupsafe import escape # # from flask import redirect # from flask import render_template # from flask import request from flask import escape, url_for ############################################### # Import some packages # ###############################...
true
54cca283b82cfa466e9fdcb5b1aa019552241570
zhangwang0537/LeetCode-Notebook
/source/All_Solutions/1047.删除字符串中的所有相邻重复项/1047-删除字符串中的所有相邻重复项.py
WINDOWS-1252
405
3.34375
3
[ "MIT" ]
permissive
class Solution(object): def removeDuplicates(self, S): """ :type S: str :rtype: str """ # ʼջ stack = [] # ջԪ for e in S: if stack and stack[-1] == e: stack.pop() else: stack.append(e)...
true
a498ddd7ba52949578558fa20fc1c6df7043bef0
6ka/totally_balanced_structures
/tbs/diss/__init__.py
UTF-8
907
2.71875
3
[]
no_license
""" Dissimilarity module. .. currentmodule:: tbs.diss Data described by a :class:`Diss` can be real (real numbers), intervals (values are subset), or whatever suits the application. Glossary -------- .. glossary:: dissimilarity Given a set X, a *dissimilarity* d is symmetric function from XxX to ...
true
034dd680d9581fd6783463f2def33dbca2940ba9
m987/pycode-
/choinka2.py
UTF-8
264
3.203125
3
[]
no_license
a=int(input('podaj wielkość choinki ')) def choinka (x): for b in range (1, x+1, 2): print ((b * '*').center(a)) for i in range (3, a+1,2): choinka (a) # a=int(input('podaj wielkość choinki ')) # for b in range (1, a+1, 2): # print ((b * '*').center(a))
true
ab5a4cc734622447dfce77188957e84c524044bb
azmikamis/pymontecarlomethod
/pi.py
UTF-8
906
4.03125
4
[]
no_license
import random import matplotlib.pyplot as plt NUM_POINTS = 10000 # Randomly generate points (x[i], y[i]) such that -1 <= x[i] = 1 and -1 <= y[i] <= 1. x = [random.uniform(-1,1) for i in xrange(NUM_POINTS)] y = [random.uniform(-1,1) for i in xrange(NUM_POINTS)] circle_x = [] circle_y = [] outsiders_x = [] outsiders_y...
true
c245a7699afe0158ed372f3a7286926b00143aa9
erkang123/python14
/day4/json系列化.py
UTF-8
295
2.75
3
[]
no_license
#Author:Erkang import json #系列化:把内存里的数据存储在硬盘 info = { 'name':'erkang', 'age':22, 'sex':'nan' } # with open('test.text','w') as f: # info= str(info) # f.write(info) with open('test.text','w') as f: data=json.dumps(info) f.write(data)
true
e866f95aa1bae727a11166e8fa9b2f78b4d21c10
Yuhuaihy/DataMining
/bonus/comprehessionKmeans.py
UTF-8
5,616
2.515625
3
[]
no_license
import pandas as pd import numpy as np import random def centroid_init(init, n_clusters, X): m,n = X.shape if init == 'random': c_index = random.sample(range(m), n_clusters) centroids = X[c_index] pass elif init == 'k-means++': c_index = [] first = random.randint(0,m-...
true
63c460becff24acc2a4822f5ef07b5754e591682
PMiskew/Coding_Activities_Python
/Technical_Skills/SkillsConstants.py
UTF-8
332
2.984375
3
[]
no_license
#- Constants are vairables whose values cannot be changed #- Best practice is to capitalize constants. This indicates to programmer # what it is #- Store constnats in a separate file that can accessed regularly. import constants import math PI = 3.1 ADDRESS = "451 Ripply Street" print(PI) print(constants.PI) pri...
true
8165c74a4fbfb33b912bfc11628d4e864ae081ca
JoyceYF/Build-Dialogue-System-By-Yourself
/src_code/chap06/Movie-KBQA/src/query_template.py
UTF-8
504
2.8125
3
[]
no_license
#!/usr/bin/env python # _*_ coding:utf-8 _*_ from question_template import QuestionTemplate # 根据问题模板的具体类容,构造cql语句,并查询 def query_template(text_pos,question_template_id_str): # 调用问题模板类中的获取答案的方法 try: questiontemplate = QuestionTemplate() answer = questiontemplate.get_question_answer(text_pos,quest...
true
d807d60c578022d00df73d9eeff39f76bf2737c3
superheltenroy/HPTCG
/tests.py
UTF-8
3,136
3.25
3
[]
no_license
import main from Rules import board from Rules import rules class Test(): def __init__(self): self.game = main.Game() def test_deckbuilding(self): try: hei = board.Deck() #print (hei.cards) hei.create_deck() #print (hei.cards) if hei.cards[59].name == 59: print "Deckbuilding successful" exc...
true
fe5dfca72dc3929a5ca4dd6d52dbc972837ac08c
Mahadev0317/Codekata
/count of longest vow\cons sequence.py
UTF-8
277
3
3
[]
no_license
s=list(input()) v=["a","e","i","o","u"] li=['v' if i in v else 'c' for i in s] c=1 lis=[] for i in range(len(li)-1): if li[i]=="v" and li[i+1]=="c" or li[i]=="c" and li[i+1]=="v": c+=1 else: lis.append(c) c=1 lis.append(c) print(0 if max(lis)==1 else max(lis))
true
6db253f8b26f09b22932586e6b998e6818eaf025
SETIatHCRO/ATA-Utils
/NbeamAnalysis/fscrunch.py
UTF-8
10,447
2.671875
3
[]
no_license
'''This program takes a filterbank or h5 file and bins the frequencies based on time resolution up to a maximum drift rate in Hz/s calculated from the frequencies in the file. It produces a set of "scrunched" files, each of which can be run through turboSETI to search for hits.''' # Import p...
true
0895eeba0896d79a3fbd4abb80dde0fb5c194db0
dantclee/how-to-think-like-a-computer-scientist
/11.2.6_3.py
UTF-8
915
4.3125
4
[]
no_license
class Point: """ Create a new Point, at coordinates x, y """ def __init__(self, x=0, y=0): """ Create a new point at x, y """ self.x = x self.y = y def __str__(self): return "({0}, {1})".format(self.x, self.y) class Rectangle: """ A class to manufacture rectangle objec...
true
888c66e0485d309c6d0e3275e4c8f94d4afba4ad
finalelement/imdb_movie_revenue_predictor
/subqueries.py
UTF-8
3,067
3.09375
3
[]
no_license
from database import DB DB_name = 'imdb_nmz' ''' The queries below all act as subqueries for the aggregate matrix query which will be fed to ML. 1.)Distinct count of movies by titles 2.)Distinct count of total genres present for movies 3.)Distinct count of total countries where movies were released 4.)Distinct c...
true
28732a69e871e1967dff05f6b9999481bb10d3ff
manavshah123/QR-Code-Generator
/QR-code-generator.py
UTF-8
4,605
2.78125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Dec 31 18:21:16 2020 @author: Riya """ from tkinter import * import qrcode from PIL import Image,ImageTk from resizeimage import resizeimage class qr_code: def __init__(self,root): self.root=root self.root.geometry("900x500+200+50") ...
true
411ac5447cce6c92af3d46003f7ca5637a0dcd9a
paulaCrismaru/fii
/python/homework1_paula.py
UTF-8
3,523
3.40625
3
[]
no_license
from random import randint __author__ = 'Paula' class AbstractBook(object): def __init__(self, title, author): self.title = title self.author = author def __str__(self): return "%s, %s" % (self.title, self.author) class Book(AbstractBook): def __init__(self, title, author, isb...
true
0ebe53d28b1c88ca3f6d611815c6b917494bb0d5
ds-ga-1007/assignment7
/ak6179/interval/interval.py
UTF-8
6,103
3.6875
4
[]
no_license
from . import interval_utils class Interval(object): """Interval class for integers Throws exception in the constructor if the interval string input is invalid. """ @property def opening_bracket(self): return self._opening_bracket @property def closing_bracket(self): retu...
true
476b14db1e8f80b0af7f86b98939776847e49544
ross-fisher/cryptolytics
/cryptolytic/model/lstm_framework.py
UTF-8
9,742
2.671875
3
[ "MIT" ]
permissive
# Perform imports # Internal Imports import cryptolytic.util as util import cryptolytic.start as start import cryptolytic.viz.plot as plot import cryptolytic.data.sql as sql import cryptolytic.data as d from cryptolytic.util import * import cryptolytic.data.historical as h import cryptolytic.model as m # External gen...
true
35c15f45ec5b71f1764aeec0294ba775eaf6d75a
chrislattman/HackerRank
/Interview Preparation Kit/String Manipulation/ValidString.py
UTF-8
1,539
3.328125
3
[]
no_license
#!/bin/python3 # https://www.hackerrank.com/challenges/sherlock-and-valid-string/problem import math import os import random import re import sys # Complete the isValid function below. def isValid(s): s_len = len(s) if s_len < 2: return "YES" hashtable = {} for i in range(s_len): curr...
true
f3fd8aefef70c3f0494fcb2ad6f7b31452200a39
Fellsmarch/COSC367
/Lab 10/neighbours.py
UTF-8
1,369
4.59375
5
[]
no_license
import itertools def neighbours(assignment): """Takes an assignment of the n-queens problem and yields a neighbour of that assignment (a neighbour having only two numbers swapped)""" for index_1, index_2 in itertools.combinations(range(len(assignment)), 2): new_assign = list(assignment) ...
true
11aa8a46936c3cb3aec71eba61476c0e8e3ae874
Sindbag/LamportMutex
/rpc/message.py
UTF-8
1,008
2.90625
3
[]
no_license
import json class Message: REQUEST = 'l' RELEASE = 'u' REPLY = 'a' def __init__(self, type=None, from_=None, to=None, time=None): self.from_ = from_ self.to = to self.type = type self.time = time @classmethod def from_data(cls, data): instance = cls() ...
true
8f657c43b8c8473d1002dbd5c4c8e596b17923e0
RoseTeam/Futurakart
/tools/transform_angles.py
UTF-8
1,181
3.53125
4
[ "MIT" ]
permissive
### Script to transform Euler's Roll/Pitch/Yaw angles in degrees to Quaternions # Python import sys import math # ROS from tf.transformations import quaternion_from_euler, euler_from_quaternion def transform(roll, pitch, yaw): q = quaternion_from_euler(roll, pitch, yaw) return q def inverse_transform(q0, ...
true
7ee011546bddc5f5f7c9a286ae86c5285853d5f3
filozyu/leetcode-journey
/src/greedy/max_subarray.py
UTF-8
2,735
3.828125
4
[]
no_license
def maxSubArray(nums): """ Brute force (Time Limit Exceeded) Time: O(n) Space: O(1) """ n = len(nums) max_val = nums[0] for i in range(n): for j in range(i + 1, n + 1): curr_sum = sum(nums[i:j]) if curr_sum > max_val: max_val = curr_sum ...
true
3f0f28c63b8a6ce28d54a79d28b9d4ee4d7781a2
chenqi008/Crawler
/mean_var.py
UTF-8
2,786
2.921875
3
[]
no_license
from PIL import Image, ImageStat # define by myself import snakes_category if __name__ == '__main__': # extract the files' name under FindPath FindPath = './bing2_resize/' FileNames = snakes_category.get_fileNames(FindPath) # # calculate total value of pixel of all images ordering by 'RGB' # to...
true
78178923b9c40f062a0eeeea7766bd7eded8e254
ejk6218/PyFusion
/Step_3_Diffusion_Equation_in_1-D.py
UTF-8
1,035
3.484375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Feb 25 20:00:18 2017 @author: Elise """ import numpy #loading our favorite library from matplotlib import pyplot #and the useful plotting library #%matplotlib inline nx = 41 dx = 2 / (nx - 1) nt = 20 #the number of timesteps we want to cal...
true
e5a73039263feb5864ed9160a220507a8b133a3a
FernandotapiaCalua/T07-TapiaCalua
/TAPIA/para3.py
UTF-8
101
2.84375
3
[]
no_license
import os i=0 z=int(os.sys.argv[1]) while i<=z: if(i%2==0): print(i) i+=1 print("excelente")
true
166cf03a57467e478c09c3af36e731a439293d29
jinwon-ai/core
/test.py
UTF-8
1,411
2.9375
3
[]
no_license
# -*- coding: utf-8 -*- import tree import pymysql def my_callback(node): print("[{0:<7}]".format(node['id']), end=' ') print("[{0:<8}]".format(node['tag']), end=' ') print(node['text']) if __name__ == "__main__": info = {'host': 'dshareai.cafe24.com', 'port': 3306, 'user': 'dshareai', 'passwd': 'ad...
true
2468095ed937b7a76b714dcf5c95e57795e227e1
Rayane-K/Artificial-Intelligence-in-Python
/Line.py
UTF-8
1,479
3.265625
3
[]
no_license
class Player: HUMAN = 1 COMPUTER = 2 NONE = 3 class Position: TOP = 1 RIGHT = 2 BOTTOM = 3 LEFT = 4 #Représente une ligne d'un carré, un carré possède 4 lignes. class Line: def __init__(self,box,position): self.__player = Player.NONE self.__hovered = False self...
true
92d5c159a814e91e4c2d314dcabc63a464f205f2
shouyuantianxia/Algorithmic-Game-Theory-Application-on-Multi-agent-Combat-and-Verification-Platform-Design
/算法代码/nash_recurrence_2_2.py
UTF-8
12,444
3.046875
3
[]
no_license
import copy import time import os import math from LH import LH_zero from shoot_env import sigmoid_accuracy #存储某个子博弈状态的纳什均衡解,包括A、B策略和A的期望损益值 class NashMessage(): def __init__(self,A_strategy=[],B_strategy=[],A_profit=0): self.A_strategy = A_strategy self.B_strategy = B_strategy self.A_profi...
true
d027c6f8f2f4beb5871e6ca8b50b98cbc6a902ae
seongjaelee/ProjectEuler
/problem006.py
UTF-8
324
3.34375
3
[]
no_license
import problem class Problem(problem.Problem): def __init__(self): number = 6 question = 'What is the difference between the sum of the squares and the square of the sums?' problem.Problem.__init__(self, number, question) def getAnswer(self): n = 100 return n * n * (n+1) * (n+1) / 4 - n * (n+1) * (2*n+1) ...
true
fcbd8abbe5c2cd83cd6f5e934b217c773a144899
shay-halimi/CatanAI
/Log.py
UTF-8
7,202
2.671875
3
[]
no_license
from Time import Time import json from random import uniform class Log: def __init__(self, players, time: Time): self.time = time self.players = players self.turn_log = {'turn': 0, 'actions': []} self.round_log = {'round': 0, 'turns': []} self.game_log = {'number of player...
true
5c69ed2a566e76ab5d7776cfd64fa022969eb9c9
yanismiraoui/PoP_student_submissions
/exercise_03/Harry-icl/shape/circle.py
UTF-8
383
3.46875
3
[]
no_license
from numbers import Number from math import sqrt class Circle: def __init__(self, centre: tuple, radius: Number): self.centre = centre self.radius = radius def __contains__(self, point: tuple): if sqrt((point[0] - self.centre[0])**2 + (point[1] - self.centre[1])**2) <= self.radius:...
true
3302bf91ae66e260b0a759ebfdbf47c752fedb1b
tmokhtar/AMLSassignment-
/amls_project.py
UTF-8
5,964
2.640625
3
[]
no_license
''' Author: Tarek Mokhtar Date: 6/1/19 ''' import sys import os import numpy as np import random from collections import Counter import sklearn import amls_helper as helper from sklearn.metrics import classification_report, accuracy_score from sklearn.svm import SVC from sklearn.ensemble import RandomForestClassifie...
true
69763d33a23b1da6305191ec61e6e79e9e467d50
CalvinNeo/LeetCode
/python/leetcode.1079.py
UTF-8
2,654
3.140625
3
[]
no_license
#coding: utf8 from collections import Counter import string class Solution(object): def numTilePossibilitiesTLE(self, tiles): """ :type tiles: str :rtype: int """ ans = 0 c_tot = dict(Counter(tiles)) cs = set(tiles) def new_tile(s): c_cu...
true
dc531f4519d22db8f1ac9f030fb563effbd3754b
belleyork/hw3
/BusCompany.py
UTF-8
930
3.203125
3
[]
no_license
class Towns: def __init__(self, town1='none', town2='none'): self.town1 = town1 self.town2 = town2 class Buses: def busCount(self, busNum=0): self.busNum = busNum return busNum def bus1(self, seating=4): self.seating = seating return seating def bus2(...
true
910014fc37d51e096dfc43c3cf6833c04ff55539
MrHamdulay/csc3-capstone
/examples/data/Assignment_3/nksvuy001/question4.py
UTF-8
657
4.21875
4
[]
no_license
#program to find all palindramic primes between two integers #vuyolwethu nkosi #26 march 2014 def palindromic_prime(): starting=eval(input("Enter the starting point N:\n")) ending=eval(input("Enter the ending point M:\n")) print("The palindromic primes are:") for i in range(starting+1,ending): ...
true
d582577b3f1cb222e2429f1ad3c156628e440919
nicklambson/pcap
/labs/anagrams.py
UTF-8
603
4.3125
4
[]
no_license
def prepare_string(text: str) -> str: text = text.upper() text = text.replace(" ", "") text = list(text) text = sorted(text) text = "".join(text) return text def are_anagrams(text_1: str, text_2: str) -> bool: if prepare_string(text_1) == prepare_string(text_2): print(f"{text_1} and...
true
495f3882b880bbf0328cdb824ef3e87b7125b0b5
Nikhil-Fulzele/Swag
/src/utils/validator.py
UTF-8
835
2.578125
3
[]
no_license
FITTER = 0 PREDICTOR = 1 MEASURE = 2 MODEL = 3 OPTIMIZER = 4 VALID_METHODS = { "sklearn": { "fit": FITTER, "predict": PREDICTOR, "predict_prob": PREDICTOR, "mean_squared_error": MEASURE, "r2_score": MEASURE, "mean_absolute_error": MEASURE, "GridSearchCV": OPT...
true
a0d26987597bd72c30370f28cd314b281048c21b
zQuantz/zMarketMaker
/lag_1_cooccurrence.py
UTF-8
595
2.546875
3
[]
no_license
from const import TICK_LIMIT import pandas as pd df = pd.read_csv("data/ibm_t.csv") cov = pd.DataFrame() cov['v1'] = df.change cov['v2'] = df.change.shift() cov = cov.iloc[1:, :].astype(int) vals = [i-TICK_LIMIT for i in range(0, 2 * TICK_LIMIT + 1)] coocc = pd.DataFrame(columns = vals, index = vals) coocc.loc[:, :]...
true
a189f91fd5455174c249e9d2e125c08614effc0d
AntonButyrin/SBhomeworks
/lesson_012/03_volatility_with_processes.py
UTF-8
3,641
3.28125
3
[]
no_license
# -*- coding: utf-8 -*- # Задача: вычислить 3 тикера с максимальной и 3 тикера с минимальной волатильностью в МНОГОПРОЦЕССНОМ стиле # # Бумаги с нулевой волатильностью вывести отдельно. # Результаты вывести на консоль в виде: # Максимальная волатильность: # ТИКЕР1 - ХХХ.ХХ % # ТИКЕР2 - ХХХ.ХХ %...
true
f7d7291cfc1dcf3702ae03c9dccfcf96e9315ff9
cms-sw/cms-bot
/parse_workflow_time.py
UTF-8
749
2.65625
3
[]
no_license
#!/bin/env python from datetime import datetime import re , json from argparse import ArgumentParser parser = ArgumentParser() parser.add_argument("-i", "--input") parser.add_argument("-o", "--output") args = parser.parse_args() fd_read = open(args.input,'r') dict_store = {} for line in fd_read: workflow = line.spl...
true
8bb5b79c0155424f3b37a98aa87164ff7c54d07a
abhisheks-12/hackerrank-python
/014_strings.py
UTF-8
419
3.78125
4
[]
no_license
# string = "abracadabra" # # string = list(string) # # string[5] = "k" # # x = "".join(string) # # print(type(x)) # # print(x) # # another approach # print(string[:5] + "k" + string[6:]) def mutate_string(s,i,c): return s[:i] + c + s[i+1:] if __name__ == '__main__': s = input("Enter: ") i,...
true
d064aab3fe00075b268a13c8ed270b69c8bad92c
YunaQiu/jianzhi
/[8]旋转数组的最小数字.py
UTF-8
2,934
4.25
4
[]
no_license
# -*- coding: utf-8 -*- ''' 把一个数组最开始的若干个元素搬到数组的末尾,我们称之为数组的旋转。 输入一个非减排序的数组的一个旋转,输出旋转数组的最小元素。 例如数组{3,4,5,1,2}为{1,2,3,4,5}的一个旋转,该数组的最小值为1。 NOTE:给出的所有元素都大于0,若数组大小为0,请返回0。 ''' class Solution: def minNumberInRotateArray(self, rotateArray): if len(rotateArray)==0: return 0 if len(rotateArray)...
true
4a7fb06d38e530ebd860a9b02ef1c15df8a4b575
christoforou/intro_to_pandas_lab
/cus615_utils/cus615_utils.py
UTF-8
2,309
3.171875
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import pylab as pl import itertools def showDecisionBoundary2D(clf): x_min = -2.0; x_max = 2.0 y_min = -2.0; y_max = 2.0 # Plot the decision boundary. For that, we will assign a color to each # point in the mesh [x_min, m_max]x[y_min, y_max]. ...
true
32bafd722dcc09605ff96e81a2b2ca3a15a351c4
xheory/weighted-edit-distance
/src/run_program.py
UTF-8
7,580
2.75
3
[]
no_license
from cost_model import CostModel from models.name_pairs import FirstNamePair, LastNamePair from os import makedirs, listdir, sep from os.path import isdir, isfile, join from files.csv_processor import CsvProcessor from files.timestamp import generate_timestamp from pickle import dump, load import sys from operations im...
true
78993bea8f1ac98d8ed3324b07022403672b041b
amitabhyadav/QHT.QPR
/Hough Transform/hough_plot/hough.py
UTF-8
5,234
3.09375
3
[ "MIT" ]
permissive
__author__ = 'mikhail91' import numpy class Hough(object): def __init__(self, n_theta_bins=100, n_radius_bins=100, min_radius=1., min_hits=4): """ Track pattern recognition for one event based on Hough Transform. Parameters ---------- n_theta_bins : int Numbe...
true
fb2ebf8944985cb5e2c098bc1a7f2380a67ab6d7
BoobooWei/booboo_hadoop
/python_scripts/booboo_pagerank.py
UTF-8
2,895
3.015625
3
[]
no_license
# -*- coding:utf8 -*- """ Created on: @author: BoobooWei Email: rgweiyaping@hotmail.com Version: V.18.09.12.0 Description: 学习pagerank时的计算辅助 Help: """ import math class PageRank(): def __init__(self, S_dict): self.N = len(S_dict) self.page = S_dict.values() self.S_dict = S_dict sel...
true
5fc7e1805dd0a5131d55847693b456a016deee8a
gpitton/reflexives3_chain
/scripts/utils.py
UTF-8
1,743
2.90625
3
[]
no_license
from collections import defaultdict, UserDict from functools import reduce from operator import xor def process_magma_output(bstdout): """ Builds the graph implied from magma's output. """ stdout = bstdout.decode("utf-8") magout = stdout.rstrip("\r\n").split("\n") lines = [magout[0]] # Check if we...
true
78f8f3e3f9fae02a42d5d1cb828d5d4ef5407d50
CNGaoWenbo/text-mined-synthesis_public
/ParagraphClassification/classification/synthesis/production.py
UTF-8
4,176
2.515625
3
[]
no_license
import json import collections from chemdataextractor.nlp import ChemSentenceTokenizer from synthesis_project_ceder.classification.synthesis import SynthesisClassifier from synthesis_project_ceder.topic import LightLDAInference class SynthesisClassificationWorker(object): def __init__(self, classification_model_...
true
cb10a3cbcbf3c3a4dd12234b73ba39beb842ce8d
neetmehta/Autonomous-turning-of-vehicle-and-overtaking-in-CARLA
/agents/navigation/local_planner.py
UTF-8
12,360
2.90625
3
[ "MIT" ]
permissive
#!/usr/bin/env python from enum import Enum from collections import deque import random from matplotlib import pyplot as plt import carla from agents.navigation.pid_controller import VehiclePIDController from agents.navigation.MPC import MPC from agents.tools.misc import distance_vehicle, draw_waypoints class RoadO...
true
943137b78b6cc17b894b68f65b6517a242d8068e
TouailabIlyass/truc
/linuxold/python/func.py
UTF-8
94
2.84375
3
[]
no_license
x=123 def main(): print("hello world\n") print(x+"in func") x="hello" main() print(x)
true
4f3a2d2c99af5aa1b21e29c9d4fef7f62ae3f132
wfwf1990/learn
/Python基础/12丶飞机大战/创建窗口.py
UTF-8
688
3.1875
3
[]
no_license
#coding=utf-8 import pygame from pygame.locals import * import time def main(): #1丶创建一个窗口,用来显示内容 screen = pygame.display.set_mode((480,852)) #2丶创建一个和窗口大小的图片,用来充当图片 background = pygame.image.load(r"C:\Users\admin.龙港的阿飞-PC\PycharmProjects\learn\Python基础\12丶飞机大战\feiji\background.png") #3丶把背景图片放在窗口显示...
true
2645768c9ed8fc7650fa7a813b020fb41469ba07
nlscng/ubiquitous-octo-robot
/p100/problem-129/SquareRoot.py
UTF-8
633
4.53125
5
[]
no_license
# Given a real number n, find the square root of n. For example, given n = 9, return 3. """ This is a classic search problem with a known range, so binary search it is """ def in_range(f: float, k: float) -> bool: tolerance = 0.001 return f - tolerance <= k <= f + tolerance def sqrt(n: float) -> float: ...
true
5c616a727cedc00a5880ffb4476faf785a0bfcef
20016145/test1
/task/LuBin_Wan_week_5.py
UTF-8
1,067
3.15625
3
[]
no_license
NATO={"A":"Alpha","B":"Bravo","C":"Charlie","D":"Delta", "E":"Echo","F":"Foxtro","G":"Golf","H":"Hotel", "I":"India","J":"Juliet","K":"Kilo","L":"Lima", "M":"Mike","N":"November","O":"Oscar","P":"Papa", "Q":"Quebec","R":"Romeo","S":"Sierra","T":"Tango", "U":"Uniform","V":"Victor","W":"Whisky","X":"X-Ray", "Y":"Yankee",...
true
b6e118dd68076f55e196db4a4547d935a7939c5b
jishnuchander/ActRecognition.ai
/New_Formalism/SpatialOrientation.py
UTF-8
11,360
2.90625
3
[]
no_license
import math import numpy as np def create_file(filename1, filename2): old_filename1 = '/home/jishnu/Desktop/BTP/New_Formalism/ME/' + filename1 old_filename2 = '/home/jishnu/Desktop/BTP/New_Formalism/ME_New/' + filename2 new_filename = '/home/jishnu/Desktop/BTP/New_Formalism/ME_New/' + \ filename1[...
true