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
7eb2536e25c95beda1b1bc391207963b8850f9d4
ashwin2rai/no_more_backlogs
/project_workdir/autoclassifier/utils.py
UTF-8
1,400
3.484375
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- from .config import preproc_dir_var def create_dir_link(data_path=preproc_dir_var, filename='text.csv'): """ Used to create a str that contains path to file using a Path object. Parameters ---------- data_path: Path object, optional Path to ...
true
3c3597624315e07e0f28e5cb968715cbc9316d5a
amoghnayak07/Batman1
/25prob.py
UTF-8
316
3.515625
4
[]
no_license
key = list(input("Enter keys: ").split()) value = list(input("Enter values: ").split()) n = 0 dic = {} for i in key: x = value[n] a = {i:x} dic.update(a) n += 1 search_element = input("Enter element to be searched: ") for i in key: if dic[i] == search_element: print("Key of searched value is ", i)
true
e4085071b94bd3d9051a5cd875c93c66c2ff9020
mikemalinowski/crab
/crab/plugins/behaviours/follicles.py
UTF-8
3,202
2.5625
3
[ "MIT" ]
permissive
import crab import pymel.core as pm # ------------------------------------------------------------------------------ class AddFollicleBehaviour(crab.Behaviour): identifier = 'Add Follicle' version = 1 tooltips = dict( parent='The node to parent the follicle under', surface='The name of th...
true
5855acca6dba444513f5105c3ec3c40d57ceb7e0
adrielklein/freelancer-site
/run.py
UTF-8
930
2.609375
3
[ "MIT" ]
permissive
import os from flask import Flask from flask import render_template from flask import request from postmark import PMMail PORT = 5000 app = Flask(__name__) @app.route("/") def home_page(): return render_template('index.html') @app.route('/contact', methods=['POST']) def contact(): msg = """Congrats me! I ...
true
aabe0b8b9217b5355892b5dd9697ee50a6864b98
lucasborges08/simple-transfer-case
/app/repositories/user_respository.py
UTF-8
2,365
2.640625
3
[]
no_license
from app.domain.user import User from app.infrastructure.database import get_conn from app.infrastructure.password_helper import PasswordHelper from app.domain.exceptions.validation_exception import ValidationException from uuid import UUID from psycopg2.errors import lookup class UserRepository: def __init__(sel...
true
4db81bd3aa4625767551ef51c054ac0f829c83ee
juliafealves/tst-lp1
/unidade-3/classico/classico.py
UTF-8
386
3.765625
4
[]
no_license
# coding: utf-8 # Programação 1 - 2017.2 UFCG # Aluna: Júlia Fernandes Alves (117211383) # Atividade: Clássico - Unidade 3 # Entradas dos gols Campinense e Treze. gols_campinense = int(raw_input()) gols_treze = int(raw_input()) # Verifica quem ganhou o clásico. if gols_campinense > gols_treze: print "Campinense" ...
true
45c51f4a1d1e603e81199ce49aeb67406a0a7527
G-nap/data-structure
/idontneed0_Exam2/14.py
UTF-8
319
3.421875
3
[]
no_license
def lookBack(s): if s.index(max(s)) > 0: for i in range(s.index(max(s))-1,-1,-1): if s[i] <= max(s): s.pop(i) inp = input("Enter : ").split(',') s = [] for e in inp: txt = e.split() typ = txt[0] if typ == 'A': s.append(int(txt[1])) elif typ == 'B': lookBack(s) print(s)
true
9defe0c3611eec783eb7f9abfeb14161e912cd26
TheSundar/euler
/problem1.py
UTF-8
470
2.609375
3
[]
no_license
import cProfile def do_cprofile(func): def profiled_func(*args, **kwargs): profile = cProfile.Profile() try: profile.enable() result = func(*args, **kwargs) profile.disable() return result finally: profile.print_stats() return ...
true
65c20e5cdb130cdbe83d28b91fe5f02504e31e82
Elton86/ExerciciosPython
/EstruturaDeRepeticao/Exe01.py
UTF-8
401
4.40625
4
[]
no_license
"""Faça um programa que peça uma nota, entre zero e dez. Mostre uma mensagem caso o valor seja inválido e continue pedindo até que o usuário informe um valor válido.""" while True: nota = float(input("Digite a nota: ")) if nota in range(0, 11): break else: print("Nota invalida! (Digite uma ...
true
0eeea5feeaeaeb13ceacc58b0550e70470217ee5
guiyom-e/python_utils
/tools/helpers/models/types_models.py
UTF-8
4,618
3.265625
3
[]
no_license
# -*- coding: utf-8 -*- # open source project """ Various model classes and functions linked to them. """ import functools class Reference: """Reference class""" pass class Wildcard: """Class to define wildcard objects""" def __repr__(self): return "<Wildcard object>" class Property(object...
true
afa27f8088c864be0af8d4583bf5a1348950b87e
globus-labs/ParaOpt
/paropt/storage/local_file.py
UTF-8
363
2.546875
3
[]
no_license
from .storage_base import StorageBase class LocalFile(): def __init__(self, file_path): self.file_path = file_path def getTrials(self, experiment_id): with open(self.file_path, 'r') as f: return f.readlines() def saveResult(self, config, result): with open(self.file_path, 'a') as f: ...
true
bd7e71d19ce8ce0a9597e5c39a437ddebfd7f30f
ogvilla67/ProyectoCDIN_Eq8
/mylib.py
UTF-8
1,274
2.859375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Jan 22 10:34:22 2020 @author: oscar """ class mylib: def dqr(data): import pandas as pd columns = pd.DataFrame(list(data.columns.values),columns=['Nombres'],index=list(data.columns.values)) data_types = pd.DataFrame(data.dtypes,...
true
fb6a7c78a5ab10474c834a11a51c23839f7d4730
oneyoung/toy-python
/markdown/md.py
UTF-8
2,769
2.734375
3
[]
no_license
#!/usr/bin/env python2 import markdown import os import codecs from jinja2 import Template class MdBase(): def __init__(self, **kwargs): self.extension = kwargs.pop("extension", ['fenced_code']) self.md = markdown.Markdown(extensions=self.extension) tpl = kwargs.pop("tpl", None) s...
true
f3e5886199db938a61a3859bdee96dfd3b9a14ca
Scaleframe/defi_credit_score
/02-credit-scoring.py
UTF-8
2,964
2.71875
3
[]
no_license
import os import json import lightgbm import random import pandas as pd import numpy as np import importlib from sklearn.metrics import roc_auc_score # same as "from 01-feature-engineering import get_features_and_label" get_features_and_label = importlib.import_module('01-feature-engineering').get_features_and_label ...
true
491e47bb014bbaf6e0ac30e02426f6b27d2b4980
veronicaerick/coding-challenges
/longest_word_from_otherwords.py
UTF-8
820
3.40625
3
[]
no_license
def longest_word(words): words.sort(key=len, reverse = True) w_set = set(words) for w in words: for i in range(1, len(words)): left = w[:i] right = w [i:] if left in w_set and right in w_set: return w def is_rotation(s1, s2): for i in range(...
true
ae345788b38530eec323c8268a0c294a9c3dc20f
Ford-z/LeetCode
/剑指 Offer 57 和为s的两个数字.py
UTF-8
531
3.515625
4
[]
no_license
#输入一个递增排序的数组和一个数字s,在数组中查找两个数,使得它们的和正好是s。如果有多对数字的和等于s,则输出任意一对即可。 class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: n=len(nums) l,r=0,n-1 while l<r: temp=nums[l]+nums[r] if temp==target: return [nums[l],nums[r]] eli...
true
ea0a22821fff048128d033198e843778584b63e4
CoryJia/CrackingAlgorithmsWithPythonIn2020
/bfs/752. Open the Lock.py
UTF-8
1,201
3.359375
3
[]
no_license
import collections from typing import List class Solution: def convert(self, node): res = [] for i, ch in enumerate(node): num = int(ch) res.append(node[:i] + str((num - 1) % 10) + node[i + 1:]) res.append(node[:i] + str((num + 1) % 10) + node[i + 1:]) r...
true
41390fe02dfb5f0ae55fda53e85b74c074f57f37
Dennis-E/Project-Euler
/Euler 14.py
UTF-8
219
3.25
3
[]
no_license
max=0 for i in range(1000000,0,-1): count=0 n=i while n!=1: if n%2==0: n=1/2*n else: n=3*n+1 count+=1 if count>max: max=count starting_figure=i print(max) print(starting_figure)
true
b70928b7377e1554e188859346aee97117df0dba
shirish93/WordEmbeddingAutoencoder
/tyrion/backprop.py
UTF-8
1,939
3.265625
3
[ "JSON" ]
permissive
''' Re-implementation of Word Embedding in theano ''' import numpy as np import theano from theano import tensor as T from compatibility import range, pickle rng = np.random class TrainModel(object): def __init__(self, maxnum, reduced_dims, learnrate=0.4): self.threshold = 1e-2 # Input variable ...
true
eead2b9238ec8f1ec202880897b5ccd405d3a342
csy1993/PythonPractice
/alien_invasion/alien_invasion.py
UTF-8
1,418
2.84375
3
[ "Apache-2.0" ]
permissive
''' * @Author: csy * @Date: 2019-05-06 14:09:01 * @Last Modified by: csy * @Last Modified time: 2019-05-06 14:09:01 ''' from game_stats import GameStats from pygame.sprite import Group from settings import Settings from ship import Ship import game_functions as gf import pygame def run_game(): '''初始化游戏并创建一个屏...
true
e499e28444974d563a78b3a8d9ae9d76b7d95432
ginajoerger/Data-Structures
/Assignment 5 - Stacks and Queues/Problem2_BoostQueue.py
UTF-8
2,305
3.796875
4
[]
no_license
from queue import Full from queue import Empty class BoostQueue(): DEFAULT_CAPACITY = 5 # moderate capacity for all new queues def __init__(self): self._data = [None] * BoostQueue.DEFAULT_CAPACITY self._size = 0 self._front = 0 def boost(self, k): # O(k) ''' ...
true
f1bcc0aad594024ab57003d9c95b9fd33f15510b
ShreyaDhananjay/FakeNewsNLP
/fakenews/prediction.py
UTF-8
3,352
2.921875
3
[ "MIT" ]
permissive
import pandas as pd from sklearn.model_selection import train_test_split from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.naive_bayes import MultinomialNB from sklearn import metrics def predict(example, choice): df = pd.read_csv("f...
true
9735f3b9d50577035aa6fe8743e5d3c88d5459bf
yangbo1/leetcode
/25_reverseKGroup.py
UTF-8
1,056
3.59375
4
[]
no_license
class ListNode: def __init__(self, x): self.val = x self.next = None def show(l): while l.next is not None: print(l.val, end = '->') l = l.next print(l.val) class Solution: def reverseKGroup(self, head, k): """ :type head: ListNode :type k: int ...
true
028b47aa023ed4729dd7042de833bc02799fadb4
Michaelcr79/python
/sample_1.py
UTF-8
210
3.671875
4
[]
no_license
name="mICHAEL rOBINSON" name=name.swapcase() print(name) J=300 K=10 result=J/K print("Result of J/K is:"+ str(result)) if J > K: print("J is greater than K") # Casting information: # str() # int() # float()
true
f012167db88b3db02a870aed6f1846703f939e4c
leemur12/Navigreat
/test.py
UTF-8
4,715
2.6875
3
[]
no_license
import os import display import qmaze as q import model import tensorflow as tf import time import pandas as pd import random from keras.models import load_model import pygame def nn_test(visuals=False): total_wins = 0 with writer.as_default(): for epoch in range(len(file_list)): file_nam...
true
35a2edd290abf18725c590326710e60cd33b8198
annsara95/Stock_Market_Prediction-using-LSTM
/BDIA Project/flaskapp.py
UTF-8
3,807
2.734375
3
[]
no_license
from flask import Flask, render_template, request from werkzeug import secure_filename from flask_cors import CORS from flask import jsonify import os import numpy as np import pandas as pd from flask_restful import Resource, Api import json from sklearn.preprocessing import MinMaxScaler from keras.models import load_...
true
768626be5593e9403c92c2a493cee6953ce4a02b
jingt06/LeetCode
/LinkedList/reverseLinkedListPython/answer.py
UTF-8
464
3.796875
4
[]
no_license
class Node: def __init__(self, val=None, next=None): self.val = val self.next = next def __str__(self): return str(self.val) def print(self): print(self) if(self.next): self.next.print() def reverse(node): if node.next is None: return node curr = node next = node.next end = None while curr is ...
true
6469662bb489f8e0585003763a50aae2b604d91c
yousefswailem/forpython
/python_stack/flask/flask_fundamentals/Playground/Playground.py
UTF-8
476
2.796875
3
[]
no_license
from flask import Flask, render_template app = Flask(__name__) @app.route('/play') def level1(): return render_template("index.html", num_square=3,color ="blue") @app.route('/play/<num>') def level2(num): return render_template('index.html', num_square=int(num),color ="blue") @app.route('/play/<num>/<colo...
true
b339a200e830ef848be714269f1662009858cdc7
adesoye/DES
/EncryptionSystemModule.py
UTF-8
6,736
3.203125
3
[]
no_license
__author__ = "Michael Oduah\n Babatunde Adesoye" __date__ = "10/8/2016" class EncryptionSystem: """ Encryption System. This system is a subsystem of the DES system. The Encryption system is made up of a class "EncryptionSystem" and seven functions. Altogether, this system produces 16 keys. These ke...
true
098d9f13a7eb8df14c127109fcdbdcade8c7af39
Jeepee-Liu/playground
/python/main.py
UTF-8
214
2.921875
3
[]
no_license
import math def dH(a1, d1, a2, d2, h2): """ a1 : attack of figure1 d1: defense """ return math.floor((a1 - d2) / h2) * (a2 - d1) def main(): pass if __name__ == '__main__': main()
true
c2a71e6af6878811e1c5203a32c60152bef29430
paiv/oop_study
/python/vendor1/vendor.py
UTF-8
683
2.765625
3
[]
no_license
from soup import Vendor, DeviceA, DeviceB class Vendor1(Vendor): class Vendor1DeviceA(DeviceA): def __init__(self, index): self.x = index def op1(self, param): self.x = param def op2(self, param): self.x += 1 return self.x class Vendo...
true
f6845cfc581cc38fb4031f2e0ea916886ad29d6f
jondeaton/HumanProteinAtlas
/cell_clustering/split_radon_files.py
UTF-8
3,157
2.515625
3
[]
no_license
#!/usr/bin/env python """ File: cluster Date: 11/16/18 Author: Robert Neff (rneff@stanford.edu) """ import os import sys import argparse import logging import datetime import pickle from enum import Enum import numpy as np from HumanProteinAtlas import Dataset, Sample from partitions import Split, partitions from pr...
true
780e01148c3446283008f3d1e59ec33a1df584fe
OstapHEP/ostap
/ostap/utils/cidict.py
UTF-8
5,595
3.25
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- # ============================================================================= ## @file ostap/utils/cidict.py # Case insensitive dictionary # @author Vanya BELYAEV Ivan.Belyaev@itep.ru # @date 2019-07-03 # ==============================================================...
true
a1645276fee89103dbbf033983da0e09a379c2e9
sugiboo/python_game
/chapter6/chapter6_6.py
UTF-8
1,499
3.71875
4
[]
no_license
# 図形の表示 import tkinter # ウィンドウを描く window = tkinter.Tk() window.title("図形を描くよ") # ウィンドウのタイトル window.geometry("800x450") # ウィンドウのサイズ # キャンバスの表示 canvas = tkinter.Canvas(window, width=700, height=350, bg="lightskyblue") # キャンバスのサイズ、色の指定 canvas.pack() # キャンバスの表示 # キャンバスに文字を表示 canvas.create_text(150, 50, text=...
true
8519cf0d730a1e2c25bd9723b44bada13a064095
pyeprog/source_hunter
/source_hunter/finder.py
UTF-8
3,096
2.890625
3
[ "MIT" ]
permissive
import os from abc import ABC, abstractmethod from collections import defaultdict from source_hunter.utils.path_utils import PathUtils class BaseFinder(ABC): @abstractmethod def fnode_by_import(self, import_content, cur_dir): raise NotImplementedError("This method is not implemented") class PythonF...
true
d0c006b76283e08e00b77d9e94bda3fc053a6d43
npchien751/Data-Structures
/Linked_List.py
UTF-8
6,840
3.375
3
[]
no_license
class Linked_List: class _Node: def __init__(self, val): # declare and initialize the private attributes # for objects of the Node class.cd self._value = val self._next = None self._previous = None #have to use self._Node() instead of _Node() def __init__(self): ...
true
bbd62ee8915f4d58d8d99db96f90432a0b741887
nwpuIT/vocab-builder
/vocab_builder/vocab.py
UTF-8
2,378
2.8125
3
[ "Apache-2.0" ]
permissive
import pickle from collections import Counter from .base import TorchVocab from tqdm import tqdm class Vocab(TorchVocab): def __init__(self, texts, max_size=None, min_freq=1): self.pad_index = 0 self.unk_index = 1 self.eos_index = 2 self.sos_index = 3 self.mask_index = 4 ...
true
7602a619d5f9c3f16c886f59c1c70fdd134f2de3
sonofmun/FK-python-course
/pyhum/pig_latin.py
UTF-8
891
4.0625
4
[]
no_license
#! /usr/bin/env python3 # -*- coding: utf8 -*- VOWELS = 'aeiouAEIOU' def starts_with_vowel(word): "Does the word start with a vowel?" return word[0] in VOWELS def add_ay(word): "Add 'ay' at the end of the word." return word + 'ay' def convert_word(word): "Convert a word to latin (recursive styl...
true
5afc079993c9a0281eed24b43c16801f215b5966
jetnew/complex-systems
/game-of-life/main.py
UTF-8
479
2.921875
3
[]
no_license
from classes import * from builders import * game = Game(size=(250, 250)) # Glider # glider = [Agent((0,0)), # Agent((1,1)), # Agent((2,1)), # Agent((0,2)), # Agent((1,2))] # # for a in glider: # game.add_agent(a) import random for i in range(250): for...
true
07fd9db51ff680584b5aea44a8be57310f73d86c
WOODchen7/XNAS
/xnas/core/utils.py
UTF-8
422
2.859375
3
[ "MIT" ]
permissive
import random import string import time import numpy as np def random_time_string(stringLength=8): letters = string.ascii_lowercase return str(time.time()).join(random.choice(letters) for i in range(stringLength)) def one_hot_to_index(one_hot_matrix): return np.array([np.where(r == 1)[0][0] for r in one...
true
96234c0be618bc5c8ab4709892e850ad1db9b3db
theFool32/AT-Framework
/datasets/random_sampler.py
UTF-8
2,825
3.109375
3
[]
no_license
from typing import Iterator, Optional, Sequence, List, TypeVar, Generic, Sized import torch class RandomSampler: r"""Samples elements randomly. If without replacement, then sample from a shuffled dataset. If with replacement, then user can specify :attr:`num_samples` to draw. Args: data_source (Dat...
true
61b3e7a17306762e507f9e86b9c6aa532edc2b7c
tatianaportsova/Lambdata_12
/my_lambdata/college_oop.py
UTF-8
1,732
3.84375
4
[ "MIT" ]
permissive
import pandas # colleges (OOP) class College(): def __init__(self, name=None, city=None, state=None, funding=None): self.name = name self.city = city self.state = state self.funding = funding def __str__(self): return f"<College {self.city} {self.name}>" def __re...
true
15d06c45d93c3fda1bfb741847c1617ff66f10c2
kwlk/Movies-Library
/Functionalities/Functions.py
UTF-8
2,702
2.671875
3
[]
no_license
import pymongo from bson.objectid import ObjectId client = pymongo.MongoClient("mongodb://localhost:27017") db = client["movies_library"] movies_col = db["movies"] reviews_col = db["reviews"] users_col = db["users"] def show_all_objects(collection): return collection.find() def get_id_of_object(name, collectio...
true
5ee94b749505ef2ce4e838ee909b294884f285df
jsh2333/pyml
/day3/3-1_yaml-io.py
UTF-8
573
3.75
4
[]
no_license
import yaml # 파이썬 데이터를 YAML 데이터로 출력하기 customer = [ { "name": "InSeong", "age": "24", "gender": "man" }, { "name": "Akatsuki", "age": "22", "gender": "woman" }, { "name": "Harin", "age": "23", "gender": "man" }, { "name": "Yuu", "age": "31", "gender": "woman" } ] # 파이썬 데이터를 YAML 데이터로 변환하기 yaml_str = yaml...
true
ce729fd10816d1381c2f7d895d5b8a9a95c2dd4f
kuriadn/pli_ke
/src/pli_ke/point.py
UTF-8
218
2.546875
3
[ "MIT" ]
permissive
from inventory.models import * from django.db import connection class Point(): def __init__(self, x, y): self.x = x self.y = y def toString(self): return '{0} {1}'.format(self.x, self.y)
true
0a798e2b518148b5bc27787fdac9dfa7f19d3809
flame0409/DNN_Classcify
/data_introduction.py
UTF-8
1,036
2.609375
3
[]
no_license
import tensorflow as tf #utf-8 import _pickle as cPickel import os import numpy import matplotlib.pyplot as plt #3.0用_pickel替换cPickle #cifar10文件保存路径:D:\BSWJ\DataSet\cifar-10-batches-py cifar_dir = "D:\BSWJ\DataSet\cifar-10-batches-py" #print(os.listdir(cifar_dir)) #简单看一下cifar内部的文件格式 with open(os.path.join(cifar_dir,...
true
dd57671094dcca2052c4b9a5167ce2190acec5d1
Q3333/TIL
/Python/Day12(폼처리)/django_form/subway/forms.py
UTF-8
1,760
2.515625
3
[]
no_license
from django import forms from .models import Subway # 메뉴 구성을 위한 값 미리 설정. MENU =[ ('햄', "햄"), ('치킨데리야키', '치킨데리야키'), ('터키', '터키'), ('로스트 치킨', '로스트 치킨'), ('스파이시 이탈리안', '스파이시 이탈리안') ] BREAD = [ ('위트', '위트'), ('허니오트','허니오트'), ('하티','하티'), ('파마산 오레가노','파마산 오레가노'), ] SAUCE = [ ('마요네즈...
true
874b5a5d1b5955c08e9bfcdb049766e7f103a887
Little-Pancake/Mnist-Recognition
/RNN-Lstm.py
UTF-8
4,466
2.578125
3
[]
no_license
# -*- coding: UTF-8 -*- # https://www.cnblogs.com/xiaoxuebiye/p/7468732.html print(__doc__) # Code source: Jaques Grobler # License: BSD 3 clause import sys #import matplotlib.pyplot as plt import numpy as np from sklearn import datasets, linear_model from sklearn.neural_network import MLPRegressor from keras.mo...
true
2a5098a0500f2d04e0dc76aec1ab808f071d28fe
arjunsatheesan/youtube-tag-recommender
/Recommendation_Algo_Modular.py
UTF-8
8,467
2.84375
3
[]
no_license
# coding: utf-8 # In[46]: import pandas as pd import json import numpy as np import nltk from nltk.corpus import stopwords import re import gensim import math # In[47]: global AVG_TAGS_PER_VIDEO, US_CA_GB_TOKEN_CORPUS, US_VIDEOS_DF, US_FINAL_DF global CA_VIDEOS_DF, CA_FINAL_DF, GB_VIDEOS_DF, GB_FINAL_DF, US_CA_...
true
7eae6bf648051152da16fe1e15f496b1632ab05c
JinXiejie/TencentLookalike
/extract_feature.py
UTF-8
1,345
2.578125
3
[]
no_license
import pandas as pd import numpy as np import math train = pd.read_csv('D:/TencentAds/TencentLookalike/MetaData/train.csv') adFeature = pd.read_csv('D:/TencentAds/TencentLookalike/MetaData/adFeature.csv') userFeature = pd.read_csv('D:/TencentAds/TencentLookalike/MetaData/userFeature.csv') train = pd.merge(train, adFe...
true
722ef8dd231fada8f619ec192ab06df960e325e7
lrmcfarland/Coordinates
/Python/Boost/test_datetime.py
UTF-8
12,680
3.109375
3
[ "MIT" ]
permissive
"""Unit tests for coords objects.""" import copy import math import random import time import unittest import coords class TestDateTime(unittest.TestCase): def setUp(self): """Set up test parameters.""" self.places = 7 # precision return # ------------------------ # ----- c...
true
37943c3bba855e74afe283c6867b2161e593bc0f
Coderash1998/LeetCode
/1399/1399.py
UTF-8
408
3.015625
3
[]
no_license
class Solution: def countLargestGroup(self, n: int) -> int: d={} c=0 for i in range(1,n+1): s=0 for j in str(i): s+=int(j) if s in d: d[s]+=1 else: d[s]=1 m=max(d.values()) ...
true
9a430351038bd6d1275120eb148c5ded3aa599c8
CongWei-z/PY
/class_leijiahanshu.py
UTF-8
4,415
4.40625
4
[]
no_license
##格式 类就是模板,包含属性和方法 ##class xx: ## def __init__(self,xx,xx): ####class Dog (): ##class类,Dog 类名字(自己定义名称,类名首字母大写) #### ## __init__ 表示类里有多少变量 #########初始化方法 把self当做自身 #### def __init__(self,name,age,color): ##必须类里的函数第一个参数是“self” #### self.name = name ##使用self.name添加name到类Dog中,名字赋值给...
true
571e5b9bca2c6d1daa7c6d9f3ca4403334d2b192
mozilla/gecko-dev
/third_party/python/python-hglib/hglib/context.py
UTF-8
6,895
2.515625
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
import hglib.client # Circular dependency. from hglib import util, templates from hglib.error import CommandError from hglib.util import b, strtobytes, integertypes _nullcset = [b('-1'), b('0000000000000000000000000000000000000000'), b(''), b(''), b(''), b(''), b('')] class changectx(object): """A c...
true
c51af340fa9530d2e5faa3fd26d97f7b0393826b
andrewjjhuh/goldenglobes
/SpacyPlayground.py
UTF-8
391
2.640625
3
[]
no_license
import json import spacy def find_award_names(): f = open('gg2013.json') data = json.load(f) # texts = [] # textfile = open("spacy.txt", "w") nlp = spacy.load("en_core_web_sm") text = "Ben Affleck won $20 for his work in Argo" doc = nlp(text) for entity in doc.ents: print(en...
true
61d1f69a7a4da2e195b7f328a17c6c5a72ddf639
probstlukas/shakespeare_rnn
/shakespeare.py
UTF-8
5,732
2.703125
3
[]
no_license
import tensorflow as tf from tensorflow.keras.layers.experimental import preprocessing import numpy as np import os import time # Fetch text path_to_file = tf.keras.utils.get_file('shakespeare.txt', 'https://storage.googleapis.com/download.tensorflow.org/data/shakespeare.txt') # Preprocess text by reading and then d...
true
edc06ec93ac02507396205e9ec29c263ffc28ef8
Aquaware/MarketAlertWithXM
/common/CandlePlot.py
UTF-8
11,020
2.796875
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- import os import sys #sys.path.append(os.path.join(os.path.dirname(__file__), '../XM')) import numpy as np import matplotlib.pyplot as plt import matplotlib.colors as mcolors from matplotlib.lines import Line2D from matplotlib.patches import Rectangle from matplotlib.transforms import Affine2D ...
true
7a8d2c131f9cfd52776d97feb35c938d2948cf09
matttodd/Jam
/Code Jam 2020/Round 1/B/problem_a/solution.py
UTF-8
1,058
3.515625
4
[]
no_license
def main(): t = int(input()) # read a line with a single integer for i in range(1, t + 1): x, y = list(map(int, input().split())) print("Case #{}: {}".format(i, solve_problem(x, y, ""))) def solve_problem(x, y, acc): if x == 0 and y == 0: return acc if (abs(x) + abs(y)) % 2...
true
139e06b8943df6ee8847bb348e86a0323b79cca2
Subhagatoadak/Excel-Binary
/excel_binary.py
UTF-8
2,067
3.109375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Apr 7 13:04:34 2019 This code is written to read and export excel binary files using python. @author: Subhagato Adak (Code help from stackoverflow) """ import pandas as pd from pyxlsb import open_workbook as open_xlsb class xlsb : def __init__(self,inputfile...
true
54e5d5306a918f53b61c7bc1bddfe226780610ae
brwoods/encryption
/unbreakable_encryption.py
UTF-8
923
3.421875
3
[]
no_license
# purpose: Learn python, use Git # date: 28-JUN-2020 # author: David Kopec - "Classic Computer Science Problems in Python" - Manning from secrets import token_bytes from typing import Tuple def random_key(length: int) -> int: # generate random sequence of bytes of specified length tb: bytes = token_by...
true
0328df34c210b3f20bfae6ac72ef041f9de9a553
brettpilch/leetcode
/p14.py
UTF-8
505
2.828125
3
[]
no_license
class Solution: def longestCommonPrefix(self, strs): """ :type strs: List[str] :rtype: str """ result = '' i = 0 while True: try: letter = [string[i] for string in strs] except: break else: ...
true
3ae7fb7a483b93c3bcadedf9f723f1bdfa9456ab
sol20-meet/sub2p
/Labs_1-7/Lab_7/Problem_3.py
UTF-8
432
4.4375
4
[]
no_license
# Write a simple class that defines a person # with attributes of first_name, last_name # and has a method signature of "speak" which # prints the object as "Jefferson, Thomas". class Person: def __init__(self, name, family): self.first_name = name self.last_name = family def speak(self): print("My name...
true
ec59f105093719440e1d66d6875ee9ada7655aab
pattypmx/def
/11.交换变量的值.py
UTF-8
278
3.84375
4
[]
no_license
# 第1种方式 a = 4 b = 5 c = 0 c = a a = b b = c print(a) print(b) print(c) print("-"*9) # 第2种方式 a = 4 b = 5 a = a+b # a=9, b=5 b = a-b # a=9, b=4 a = a-b # a=5, b=4 print(a) print(b) print("-"*9) # 第3种方式 a, b = 4, 5 a, b = b, a print(a) print(b)
true
bcfb861fbe2a5599412c1e43933b8924078a45a7
oscargreinke/mooBot
/mooBot.py
UTF-8
10,919
2.59375
3
[]
no_license
import discord import time import logging import random from bs4 import BeautifulSoup from discord.utils import get import urllib.request import asyncio logging.basicConfig(level=logging.INFO) TOKEN = '' client = discord.Client() delimiter = ' ' def parse(string, delim): try: quoteString = string.spli...
true
35755e7b3c1bfbad6c852c4f3f2e555b746cff6e
zjgpf/assembler
/src/SymbolTable.py
UTF-8
641
2.53125
3
[]
no_license
class SymbolTable: def __init__(self): self.table = {} self.predefined() def addEntry(self,symbol,address): self.table[symbol] = address def contains(self,symbol): return symbol in self.table def getAddress(self,symbol): return self.table[symbol] def pred...
true
7078ca01fc5b6988160a19342c998f9b719eaf66
stellalberto/Broadbalk-Binder-Example
/textToCsv.py
UTF-8
648
2.53125
3
[]
no_license
''' Created on 8 Mar 2019 @author: stellaa ''' import csv import configparser def convertToCsv(): with open(srcdocs, 'r') as in_file: stripped = (line.strip() for line in in_file) lines = (line.split("|") for line in stripped if line) # with open(outfile, 'w') as out_file: writer ...
true
196b28ec2517384167ab3265c89d0fa79d18e9da
maneeshsistla8/NNFL-Implementations
/Assignment2/q5.py
UTF-8
5,500
2.875
3
[]
no_license
import numpy as np import scipy.io def sigmoid(s, deriv=False): if (deriv == True): return s * (1 - s) return 1/(1 + np.exp(-s)) def tanh(x): return np.tanh(x) class NeuralNetwork(object): def __init__(self, sizes): self.num_layers = len(sizes) self.sizes ...
true
b77b1f0b7136366da67278597af23f32b3520a1b
YoungsAppWorkshop/codewars
/r1/adding_words_part_1.py
UTF-8
1,522
4.5625
5
[]
no_license
#!/usr/bin/env python3 """ Adding words - Part I This is the first part of this kata series. Second part is here and third part is here Add two English words together! Implement a class Arith (struct struct Arith{value : &'static str,} in Rust) such that //javascript var k = new ...
true
908a37c905a40288ab0d14422bf6fd610882b1a0
faxocr/kocr
/learning/make_emnist_images.py
UTF-8
3,059
2.75
3
[]
no_license
import cv2 import numpy as np import os import tensorflow_datasets as tfds # EMNIST labels letter_table = {0: '_', 1: 'a', 2: 'b', 3: 'c', 4: 'd', 5: 'e', 6: 'f', 7: 'g', 8: 'h', 9: 'i', 10: 'j', 11: 'k', 12: 'l', 13: 'm', 14: 'n', 15: 'o', 16: 'p', 17: 'q', 18: 'r', 19: 's', 20: 't', 21: 'u', 22: 'v', 23: 'w'...
true
e721f1aa1bf5ecccb73236e223a8ad8eeeafec3b
AKHACKER-program4hack/searcher
/searcher/forsearch.py
UTF-8
160
2.8125
3
[]
no_license
""" Searcher module """ class Searcher(): def __init__(self): self.user = 4 def printuser(self): print(self.user)
true
7e1500340a3a98e07283f1e106f50f206a6d08e7
gerardobeltranmx/Bioinformatica
/python/prog-32.py
UTF-8
265
3.109375
3
[]
no_license
cadena = "##ATGCAAATTGTGTGTGCATAATTTATATAGG$CTAGAATAGAATC$G$CTA##" seg = "GC" cadena = cadena.strip("#") cadena = cadena.replace("$", "") num = cadena.count("GC") tam = len(cadena) / 2 porcentaje = num / tam *100 print("El porcentaje es %.2f" % porcentaje)
true
d6a589393be7620b7c6b54c6a3787035468319d3
guo326/Study-Python
/exercise/chapter04/41_class_04_02.py
UTF-8
287
3.875
4
[]
no_license
class HouseGuin: lastname = "Guin" def __init__(self, name): self.fullname = self.lastname + name def travel(self, where): print("%s, %s로 여행을 가다" % (self.fullname, where)) guin = HouseGuin("bun") print(type(guin)) print(guin.travel("London"))
true
88017985346df740993d4958eef3a81cf172dd00
yensaiFM/PFM_Kschool
/PFM_films/theMovieDB.py
UTF-8
2,850
2.703125
3
[]
no_license
import tmdbsimple as tmdb from datetime import datetime from datetime import timedelta import os import re tmdb.API_KEY = 'XXXX' dir = os.path.dirname(__file__) # Save list films with format hastag by filter later in twitter call def createHastags(twitter_hashtags): d = datetime.today() filenow = "%i-%02d-%02...
true
7237ba7ca6af6d2a84c7bc100f5e6ddbbd5ef056
wangzheng62/pythonlesson
/homework3/funcation_3.py
GB18030
188
2.921875
3
[]
no_license
#Ķ #def name # statement def new_line(): print("\n") #ûԱprintӡһpython2 def three_lines(): new_line() new_line() new_line()
true
e39fbefa02a5fdd8addbe8edd3db6509551dbedc
jp-nguyen/tutor-database
/TutorDatabase.py
UTF-8
21,575
2.734375
3
[]
no_license
import sqlite3 import datetime commands = {} def user_interface(): response = input("New or old: ").strip().lower() while response not in ['new', 'old']: response = input("New or old: ").strip().lower() db = commands[response]() handle_commands(db) print('Thank you for using the tutoring ...
true
69ec28aa3126788f169fd4e6169bb261a035b623
itsalljustdata/find-duplicate-files
/find_duplicate_files.py
UTF-8
7,262
3.203125
3
[ "MIT" ]
permissive
#!/usr/bin/env python3.6 import os import sys import hashlib import logging import argparse import math from collections import defaultdict def generate_hash(file_path, chunk_size=1024, seek_file_at=0): ''' Generates md5 hash for file chunk Args: file_path(st...
true
a533b236dce8b317ee55fdaa68e5fec384407a94
fdanny/python
/CheckSum/main.py
UTF-8
328
2.609375
3
[]
no_license
''' Created on 2013/12/11 @author: Robert ''' import random import sys checksum = 0 f = open(r'D:\checksum.txt',"w") for idx in range(int(sys.argv[1])): data = random.randint(16,255) checksum = checksum + data f.write("%02X," % data) checksum = ((~(checksum &0xFF))+0x01)&0xFF f.write("%02X" % checksum) f...
true
01772c1101c8375a9217bd1c125f69cbd6a0bb7c
ctchristensen/maze_generator
/maze_t_2.py
UTF-8
2,404
3.671875
4
[]
no_license
from random import shuffle size = 1 width = 9 height = width cells = [] initialWalls = [] finalWalls = [] #Build a list of cells, and another list of walls based on the dimensions of the maze. for x in range(width): for y in range(height): #Make one cell for each x,y combination. The coordinates...
true
9336c50f4bb1b292669aa2f65e259d92dd0c6abf
tinaba96/coding
/acode/arc112/a2.py
UTF-8
1,025
2.84375
3
[]
no_license
import math dict = {} T = int(input()) flag = False for t in range(T): L, R = list(map(int, input().split())) if(L == 0 and R == 0): print('1') continue elif(L == R): print('0') continue else: cnt = 0 gap = R-L+1 #for g in range(L,gap): ...
true
401127b3c5d0c1213e39d5a320c4f0030fa6e546
sahilsehgal81/python3
/alternatedivision.py
UTF-8
343
4.1875
4
[]
no_license
#!/usr/bin/python divident, divisor = eval(input('Enter a Divisor and Divident Value: ')) if divisor != 0: quotient = divident/divisor print('Here Divisor is', divident, '. Divident is', divisor, '. And Quotient is ', quotient) print('\nOr in other words\n'); print(divident, '/', divisor, '=', quotient,'\n') prin...
true
20abdbd1f5e5d144fe1484c0b0a603ea463efaab
mordowiciel/cps
/noise_generator.py
UTF-8
1,327
3.03125
3
[]
no_license
import numpy as np import scipy.stats as stats from cpssignal import CPSSignal def uniform(name, A, t1, d, sampling_freq): sampling_step = 1.0 / sampling_freq t = np.arange(t1, t1 + d + sampling_step, sampling_step) y = np.random.uniform(-A, A, len(t)) return CPSSignal(name, t1, t1 + d, sampling_fre...
true
9b61aeb274fdf2602cc1908d1cbbb4c62e8eaf52
DarrenoGrant/LabAssignmentOne
/Lab1Q3.py
UTF-8
343
3.515625
4
[]
no_license
#Darren Grant Rocket Number 01479255 #Display a runners avergage speed in miles per hour x = (45.5 / 60) #This is the time taken to run changed to hours from minutes. y = (14 / 1.6) #This is the distance changed from kilometers to miles #Speed is equal to distance / time. print ( y / x ) #This is the ru...
true
3ff325fa1fe978ffefdb9b3f4faae92624799e62
Kevin520122/easy-pygame
/game.py
UTF-8
4,467
3.03125
3
[]
no_license
import pygame import os import player import enemy import projectile #Init game pygame.init() #Set the game window game_win = pygame.display.set_mode((500, 480)) pygame.display.set_caption("First game") #Load background picture bg = pygame.image.load(os.path.join('Game_Characters', 'bg.jpg')) stay = pygame.image.loa...
true
8ebc96cd61a1c854b89226d5de9aaed022587937
NmBoyd/Mastering-The-Coding-Interview
/Python/hash_table_from_scratch.py
UTF-8
3,198
4.3125
4
[]
no_license
class HashTable(object): def __init__(self, length=4): # initiate our array with empty values self.array = [None]*length def hash(self, key): """Get the index of our array for a specific string key""" return hash(key) % len(self.array) def add(self, key, value): """Add a value to our arra...
true
7b20350ba1da8d308ccec72b47fde6058488962b
qiubinbin/alien_invasion
/alien_invasion.py
UTF-8
1,555
2.546875
3
[]
no_license
import pygame from pygame.sprite import Group # 测试push from all_settings import AllSettings from ship import Ship import game_functions as gf from game_stats import Gamestats from button import Button from scoreboard import Scoreboard from shield import Shield def run_game(): # 初始化游戏并创建一个屏幕对象 all_setting = AllSetti...
true
825d06778298a1d2c8c467ca8d1b5181380a93c6
jeplerucsc/astr-119-session-5
/demo_numpy_continued.py
UTF-8
604
4.1875
4
[ "MIT" ]
permissive
import numpy as np x = 1.0 #define a float y = 2.0 #define another float #exponents and logarithms print(np.exp(x)) #e^x(x) print(np.log(x)) #ln x print(np.log10(x)) #log_10 x print(np.log2(x)) #log_2 x #min/max/misc print(np.fabs(x)) #absolute val as a float print(np.fmin(x,y)) #min of x and y print(np.fmax(x,y)) #m...
true
b2536dfdf9f2fc83147ccd5c57a8e0c8492ce547
icesupawan/fitandfirm
/project.py
UTF-8
10,664
2.890625
3
[]
no_license
import sys from Tkinter import * from PIL import ImageTk, Image import tkMessageBox import tkFont import ttk class Apps: def __init__(self, master): self.v = IntVar() #Logo Image self.photo = PhotoImage(file = "logo.gif") self.label = Label(image = self.photo, bg="#a8cf38...
true
46028ad430d002e63c621378371a4ec258c2778d
Silvia-man/test-
/python习题/仅菜鸟上的/99.py
UTF-8
498
3.5625
4
[]
no_license
#题目:有两个磁盘文件A和B,各存放一行字母,要求把这两个文件中的信息合并(按字母顺序排列), 输出到一个新文件C中。 # 学习... ... if __name__ == '__main__': import string fp = open('test1.txt') a = fp.read() fp.close() fp = open('test2.txt') b = fp.read() fp.close() fp = open('test3.txt','w') d = list(a + b) #special * d.sort() ...
true
64dda7007363aee21257bda1ae6a2bcd597c3d80
EcoGamer18/Advent_of_Code2020
/Day_1/day_1.py
UTF-8
891
3.71875
4
[]
no_license
# first puzzle advent of code def problem1(list): for i in range(len(list) - 1): for j in range(i + 1, len(list)): if list[i]+list[j]==2020 : return list[i] * list[j] return -1 def problem2(list): for i in range(len(list) - 2): for j in range(i + 1, len(list) -...
true
0d6f38b867bbe000104e24fd1448eaeca6cbc326
earthcube2022/ec22_ji_etal
/utils/pil_detection.py
UTF-8
13,929
2.625
3
[]
no_license
import sys sys.path.append('../utils') from utils.ts_processing import ts_processing from utils.region_detection import pos_neg_detection import os import numpy as np import pandas as pd from skimage import feature from skimage.morphology import erosion, dilation, opening, closing, white_tophat from skimage.morphology...
true
7a011a1493decef5a64c3a5627192753cb135a0e
Introduction-to-Programming-OSOWSKI/1-0-woof-Emilypipp22
/main.py
UTF-8
102
3.265625
3
[]
no_license
#define function def woof(): #return woof return "Woof" #print function print(woof())
true
0539367cebf09079c874e6e4bdc408d4825db2d4
davidcolton/bitesofpy
/72/belt.py
UTF-8
764
3.34375
3
[]
no_license
from collections import OrderedDict scores = [10, 50, 100, 175, 250, 400, 600, 800, 1000] belts = "white yellow orange green blue brown black paneled red".split() HONORS = OrderedDict(zip(scores, belts)) MIN_SCORE, MAX_SCORE = min(scores), max(scores) def _get_belt_recursion(score, scores_to_check): # G...
true
6cecdbe74a1db5b6e55e5a877c3458a25dfc8fc5
CStanKonrad/SimpleRL
/src/tf2_model.py
UTF-8
562
2.59375
3
[ "MIT" ]
permissive
import tensorflow as tf def model_fit(model, inp, out): model.fit(inp, out, batch_size=max(out.shape[0]//5, 1)) def save_model(model, filepath): json_data = model.to_json() with open(filepath + '.json', 'w') as json_file: json_file.write(json_data) model.save_weights(filepath + '.h5') def ...
true
c309d6ae70254c5690531abcc5deb605e23a34fe
UgreninovaAlena/ChatBotForVK
/MyLibs/ForLogs/Logger.py
UTF-8
561
2.78125
3
[]
no_license
def get_log_to_file(filename): def get_log_to (function): def create_recording(*args, **kwargs): result = function(*args, **kwargs) string_for_log = result.result_to_str() with open(filename, 'a', encoding='utf-8') as f: f.write(f'{string_for_log[0]}'+ '...
true
396ba0158cdf61ba7bfd4d2f64debedad3683769
luislew/advent-of-code-2020
/day_15/__init__.py
UTF-8
854
3.34375
3
[]
no_license
import os __location__ = os.path.realpath( os.path.join(os.getcwd(), os.path.dirname(__file__))) def get_data_from_input(): with open(os.path.join(__location__, "input.txt")) as f: return [int(i) for i in f.read().strip().split(",")] def get_nth_number(starting_numbers, n): spoken_numbers = {} ...
true
f78f9f378203e09715d54763286a6fe2e1530976
kliner/leetcode
/156.py
UTF-8
970
3.5625
4
[]
no_license
# Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def upsideDownBinaryTree(self, root): """ :type root: TreeNode :rtype: TreeNode """ if not ...
true
0d583905fc5e0971f4f5485aac8dd2fc63859060
maartenweyn/kerstpuzzel
/scramble.py
UTF-8
5,393
2.828125
3
[ "Apache-2.0" ]
permissive
import argparse import sys import hunspell import itertools import multiprocessing from multiprocessing import Pool import re import operator from collections import Counter from math import factorial dict = hunspell.HunSpell('Spelling/nl_NL.dic', 'Spelling/nl_NL.aff') import time from functools import partial chop...
true
e272813164b34f9c6ff54374eaf62a8eeff2bc2b
weidler/RLaSpa
/src/gym_custom_tasks/envs/race.py
UTF-8
2,933
2.671875
3
[ "MIT" ]
permissive
import gym import torch import numpy import platform if 'rwth' in platform.uname().node.lower(): import matplotlib matplotlib.use('Agg') # Force matplotlib to not use any Xwindows backend. import matplotlib.pyplot as plt import src.gym_custom_tasks # from gym import spaces import src.gym_custom_tasks class Ra...
true
4e190a3462d996e12c058a4a0fc7df0f8be9554d
lianilychee/SoftwareDesign
/inClass09/dictionary_test.py
UTF-8
167
3.5625
4
[ "MIT" ]
permissive
d = {} # initialize an empty dictionary d = {1: 2, 'a': 7.0} # create a dictionary where key 1 maps to 2 and string 'a' maps to float 7.0 d[1] = 'hello' print 1 in d
true
225e614f7f8920abb54b1c18853733dbe116920f
Hynchus/Hive
/feedback.py
UTF-8
889
2.671875
3
[]
no_license
from decorators import threaded from utilities import aprint import enum import random import cerebrate_config as cc class Response(enum.Enum): GREETING = enum.auto() AFFIRMATIVE = enum.auto() NEGATIVE = enum.auto() FAREWELL = enum.auto() _responses = { Response.GREETING: ["Hey", "Hi!", "What's...
true