blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
133
path
stringlengths
2
333
src_encoding
stringclasses
30 values
length_bytes
int64
18
5.47M
score
float64
2.52
5.81
int_score
int64
3
5
detected_licenses
listlengths
0
67
license_type
stringclasses
2 values
text
stringlengths
12
5.47M
download_success
bool
1 class
99ac1505151b9857634058505a4bca272348f18a
Python
antonioam82/3D-Interactive
/demo6.py
UTF-8
3,334
2.65625
3
[]
no_license
import pygame from pygame.locals import * from OpenGL.GL import * from OpenGL.GLU import * def verts(): global verticies verticies = [ [0, 1, 0],#top [1, 0, -1],#del der [-1, 0, -1],#del iz [1, 0, 1],#tras der [-1, 0, 1],#tras iz [0, -1, 0]#bottom ] edges =( (0,1), (0,2...
true
e88028972bf1e2733b861147d5f4adcc1e0bc1b2
Python
gtarsia/py2html
/src/html/__init__.py
UTF-8
1,809
2.75
3
[ "BSD-3-Clause" ]
permissive
from comparators import RegexComparator class GrammarNode(object): comparator = None @classmethod def try_create(cls, str): cls.comparator.match(str) class HtmlParagraph(GrammarNode): comparator = RegexComparator('paragraph(.*)') def __init__(self): class HtmlParser(): ...
true
92af18a9328e0219aa173093f1b8ed01ab8d6d80
Python
raj13aug/Python-learning
/Course/5-Data-Structure/general-expressions.py
UTF-8
560
3.671875
4
[]
no_license
from sys import getsizeof values = [x * 2 for x in range(10)] print(values) for x in values: print(x) # generator object are iterable, so unlike list, they don't store all value and memory, they generator new value in each iteration. values = (x * 2 for x in range(10)) print(values) # sizeof values = (x * 2 for ...
true
a7b0e8d53085d1cc292477cec65659fc1dbc48df
Python
Jill1627/lc-notes
/levelOrder.py
UTF-8
1,275
4.0625
4
[]
no_license
""" 题目:levelOrder输出树值 思路:BFS用Queue 1. 如果root存在,加入queue 2. while queue不为空时:建立level=[] 3. 遍历for此时queue中所有树节,这些树节必定属于同层 4. 逐个树节,先取出当前子节(pop from queue),将其数值加入levelOrder 5. 若左右子节存在,加入queue,先左后右 6. 出for后,也就是本层以结束,将level加入res """ # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # ...
true
48e10de35dd8d30ecaa72d77ca31f57e4b07a53a
Python
Allison001/developer_test
/.history/Test002/demo_20201202105036.py
UTF-8
120
2.640625
3
[]
no_license
# a=10 # print(a) # #id可以打印变量的内存地址 # print(id(a)) # A= 1 # a =2 # print(a,A) a =1 b = 0.2 c=
true
9e62fd20a2e8cc7baf5079d2a56309475ad97cc4
Python
BaoZhongtian/Summarization-NEO
/Run/Exp_CheckRouge.py
UTF-8
945
2.515625
3
[]
no_license
import tqdm from DataLoader import loader_raw from Tools import rouge_1_calculation, rouge_2_calculation, rouge_long_calculation if __name__ == '__main__': train_data, val_data, test_data = loader_raw(appoint_part=['test']) max_rouge_score = 0.0 counter = 0 for treat_sample in tqdm.tqdm(test_data): ...
true
6536edbbe450c783bdd19857c2aed37a673499b2
Python
YevgeniyaKim/Web
/Desktop/КБТУ/Web/week8/informatics/part4/67.py
UTF-8
263
3.359375
3
[]
no_license
n = int(input()) a = [] for i in range(0, n): x = int(input()) a.append(x) for i in range(1, n): while i <= n: if (a[i] > 0 and a[i-1] > 0) or (a[i] < 0 and a[i - 1] < 0): print("YES") exit() i += 1 print("NO")
true
6eb8cc642b0558877cfac81e286aaf3d145975be
Python
news21/news21-national
/news21national/utils/partial_decorator.py
UTF-8
248
2.59375
3
[]
no_license
def partial_template(template): """ Wrap the result of a function in a `tag` HTML tag. """ def _dec(func): def _new_func(*args, **kwargs): return "<%s>%s</%s>" % (template, func(*args, **kwargs), template) return _new_func return _dec
true
377ae45ff5bc39b88089435fa4f92c4248bebb8a
Python
indraastra/puzzles
/euler/prob005.py
UTF-8
179
2.984375
3
[]
no_license
import functools import math import util n = functools.reduce(lambda x,y: x*y, util.primes(20), 1) for i in range(2, 20): if n % i != 0: n *= i // math.gcd(i, n) print(n)
true
01f6c9f258621f39ce3a3c3f96d3621d770e00cd
Python
FightForDobro/itea_python_basics
/Alexey Kahanovskyi/HW03/Kahanovskyi_map_3_2.py
UTF-8
793
3.90625
4
[]
no_license
def alex_map(a, b): """ This function performs actions of a given function on each element of the collection and returns a new collection :param_a: a given function :param_b: agiven collection :type_a: function :type_b: list :return: new list with changes made by the specifi...
true
b5229c14d43d0b64b0172a18417e73608747c148
Python
casssie-zhang/LeetcodeNotes
/backtrack/39.CombinationSum.py
UTF-8
660
3
3
[]
no_license
class Solution(object): def combinationSum(self, candidates, target): """ :type candidates: List[int] :type target: int :rtype: List[List[int]] """ res = [] def dfs(path, diff, begin): if diff == 0: res.append(path) ...
true
b208871c84652d8041a5ba0522851a3d876af037
Python
ogrudko/leetcode_problems
/tests/test_missing_number.py
UTF-8
539
3.125
3
[]
no_license
''' set of parametrized test cases to verify functional correctnes of missing_number.py solution ''' import pytest from easy.missing_number import Solution cases = [ ([3,0,1], 2), ([0,1], 2), ([9,6,4,2,3,5,7,0,1], 8), ([0], 1), ([1], 0), ([1, 2], 0) ] @pytest.mark.parametrize('nums, result', c...
true
c607ac111c2d3a4bda9ed20b3daa75e12a51c3fd
Python
StombieIT/Flask-MVT
/blueprints/example/forms.py
UTF-8
1,029
3.09375
3
[]
no_license
''' This file serves for Flask-WTF, you should create your forms there. ''' from flask_wtf import FlaskForm # Use only 'FlaskForm' instead of 'Form' because it will be removed in future versions from wtforms import StringField, SubmitField from wtforms.validators import DataRequired, Length, Regexp # Use only 'D...
true
37f20168af5b61fa5e5c1212b1513284948ee73e
Python
Lukiticas/Validacao_de_dados
/PB_Validacao_Dados/CEP/cep.py
UTF-8
887
3.234375
3
[]
no_license
import requests, json class BuscaEndereco: def __init__(self, cep): cep = str(cep) if self.cep_valido(cep): self.cep = cep else: raise ValueError("CEP Inválido") def cep_valido(self, cep): if len(cep) == 8: return True else...
true
1380f486e3c4abad403e0c138cbe9e634e424d31
Python
AdamZhouSE/pythonHomework
/Code/CodeRecords/2520/60695/292811.py
UTF-8
255
2.828125
3
[]
no_license
R = int(input()) C = int(input()) r0 = int(input()) c0 = int(input()) res = [] for i in range(R): for j in range(C): res.append(([i, j], abs(r0 - i) + abs(c0 - j))) res = sorted(res, key=lambda res: res[1]) res = [v[0] for v in res] print(res)
true
b77768bc18e7226741d23502a66cacf632280be9
Python
AldoMaine/Solutions
/scripts/tsp/tsp_naive.py
UTF-8
1,601
3.4375
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ Created on Mon Apr 4 13:21:19 2022 @author: aldon """ # traveling salesman # problem using naive approach. from sys import maxsize from itertools import permutations import pandas as pd # implementation of traveling Salesman Problem def travellingSalesmanProblem(graph, s): # store a...
true
5a233382d932371e9b7738af248bc796933b2e3c
Python
chenanming/hogwarts
/appium_po/page/xueqiu_page.py
UTF-8
3,404
2.515625
3
[]
no_license
#!/usr/bin/python3 # -*- coding=utf-8 -*- import logging import pytest from appium import webdriver from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.wait import WebDriverWait from appium_po.page.optional_page import OptionalPage from appium_po.page.search_page import Sea...
true
80d553d6a1ad51059c63ef65221d0b8595abb69d
Python
fromjwy/Algo
/Graph/bj2606.py
UTF-8
736
3.21875
3
[]
no_license
from collections import deque com = int(input()) N = int(input()) adj = [[] for _ in range(com+1)] visited = [False for _ in range(com+1)] cnt = 0 for _ in range(N): c1, c2 = map(int, input().split()) adj[c1].append(c2) adj[c2].append(c1) ''' def DFS(v): global cnt cnt += 1 visited[v] = True ...
true
3cc460ef4f2ab50b8055f0da2e422a90eb8a5d42
Python
edw1n94/algorithm
/topology.py
UTF-8
145
2.703125
3
[]
no_license
def solution(skills, total_sp): return total_sp = 121 skills = [[1, 2], [1, 3], [3, 6], [3, 4], [3, 5]] print(solution(skills, total_sp))
true
89aa87d4019516d4f49b1f0f486e2fb16686cb1c
Python
Pratik-Sanghani/Python-Tutorial
/Decision Making/if.py
UTF-8
459
4.3125
4
[]
no_license
'''Decision making is anticipation of conditions occurring while execution of the program and specifying actions taken according to the conditions.''' '''Decision structures evaluate multiple expressions which produce TRUE or FALSE as outcome. You need to determine which action to take and which statements to exe...
true
bff7bffc2ca8b5f68b8bff0fd23d8373058a7370
Python
Galit1321/neuroevolution
/googleCol.py
UTF-8
6,109
2.6875
3
[]
no_license
from keras.datasets import mnist from keras import backend as K import numpy as np def softmax(x): e_x = np.exp(x - np.max(x)) return e_x / e_x.sum() def forward(weights, x, y, activation_fun): # Follows procedure given in notes w1, b1, w2, b2, w3, b3 = [weights[key] for key in ('W1', 'b1', 'W2',...
true
64e31b69afcae973a2222fde97c065e080f0bfdb
Python
Ashu00001/programs
/factorial using recursion.py
UTF-8
182
3.6875
4
[]
no_license
a=eval(input("enter a number : ")) result=0 def fact(a): if(a==1): return 1 else: result=a*fact(a-1) return result res=fact(a) print("fact : ",res)
true
c5a15ca25d0e59f9bdccec5cd4b203bb3ab9f831
Python
2226171237/Algorithmpractice
/chapter04_array/t4.19.py
UTF-8
763
3.953125
4
[]
no_license
# -*-coding=utf-8 -*- ''' 如何按照要求构造新的数组? 给定一个数组a[N],希望构造一个新的数组b[N],其中 b[i]=a[0]*a[1]*...*a[N-1]/a[i]。 在构造数组过程中,有如下几点要求: 1:不允许使用除法; 2:要求O(1)空间复杂度和O(N)时间复杂度; 3:除遍历计数器与a[N],b[N]外,不可以使用新的变量(包含栈临时变量,堆空间和全局静态变量等) 4:请用程序实现并简单描述。 ''' def getArr(a): b=[1] n=len(a) i=1 while i<n: b.append(b[i-1]*a[i-1]) ...
true
8610f9132e8d144044c3af5abff5fa1708c50234
Python
MariaGabrielaReis/multistack-ediaristas-api
/services/city_attendance_service.py
UTF-8
1,003
2.75
3
[ "MIT" ]
permissive
from painel_administrativo.services import cep_service from painel_administrativo.models import Housekeeper from rest_framework import serializers import json def to_list_housekeepers_city(cep): # pega o código do IBGE daquele CEP codigo_ibge = get_city_cep(cep)['ibge'] try: # busca todas as diar...
true
d58adbcce6b5a1c4d5ad294822796896742ac573
Python
clb1/CreateCGDB
/src/TSS.py
UTF-8
2,531
2.75
3
[ "MIT" ]
permissive
class TSS: def __init__(self, source_db, source_label, tss_label, chromosome, start, stop, strand): """Expects start and stop to be in 1-based coordinates.""" self.src_db = source_db self.src_label = source_label self.ID = tss_label self.chromosome = chromosome self.s...
true
6a4da2156025b4f8b079bf2a922c338967c0c499
Python
tanvipenumudy/Competitive-Programming-Solutions
/HackerRank/Problem-Solving/halloween_sale.py
UTF-8
2,647
4.21875
4
[ "MIT" ]
permissive
# You wish to buy video games from the famous online video game store Mist. # Usually, all games are sold at the same price, p dollars. However, they are planning to have the seasonal # Halloween Sale next month in which you can buy games at a cheaper price. Specifically, the first game you # buy during the sale wil...
true
60e49763077ab0ca0813a9e40eb105abe83f3bf0
Python
SeokLii/Algorithm
/DFS/DFS-바이러스.py
UTF-8
563
2.96875
3
[]
no_license
import sys computer = int(sys.stdin.readline()) network = int(sys.stdin.readline()) link = [list(map(int, sys.stdin.readline().split())) for _ in range(network)] visited = [0 for _ in range(computer+1)] stack = [] stack.append(1) visited[1] = 1 result = 0 print(link) while stack: X = stack.pop() print('stac...
true
d950a2650a6d1a6e81e4bfbb5b47c9ec844a25d1
Python
NOAA-ORR-ERD/OilLibrary
/oil_library/oil_props.py
UTF-8
14,697
2.53125
3
[ "Unlicense" ]
permissive
''' OilProps class which serves as a wrapper around gnome.db.oil_library.models.Oil class It also contains a dict containing a small number of sample_oils if user does not wish to query database to use an _r_oil. It contains a function that takes a string for 'name' and returns and Oil object used to initialize and O...
true
3021e14cf8b57eea4bafd35a4a6b6f20bbedf5e6
Python
sheitm/codewars-python
/get_the_loop/test_loop_size.py
UTF-8
460
3.265625
3
[]
no_license
from unittest import TestCase from solution import Node from solution import loop_size class TestLoop_size(TestCase): def test_loop_size_small(self): node1 = Node() node2 = Node() node3 = Node() node4 = Node() node1.next = node2 node2.next = node3 node3.next...
true
08fe1c638fa59e3760d3d43be5565493b4c24db6
Python
rohithdesikan/ashrae-kaggle
/model_xgboost.py
UTF-8
1,560
2.5625
3
[]
no_license
# %% from sklearn.model_selection import train_test_split import xgboost as xgb import numpy as np import pandas as pd import os import time import pyarrow as pa import pyarrow.parquet as pq def localpath(fn): datadir = os.path.join(os.getcwd(), 'datasets', fn) return datadir def rmsle(y_pre...
true
d0848b7bd3f8132d82171140c365b61622d816de
Python
DavidPeleg6/ExperiMate
/files/InoFile.py
UTF-8
9,013
3.125
3
[]
no_license
import json # a list containing all needed values as viewed in examples.ino and location of print segment_names = {"libraries": [], "pins : digital": [], "pins : analog": [], "frequency": [], "global": [], "setup": [], "sleep for 1 sec": [], "loop start": [], "print statement": [], "loop end": [], "he...
true
99a8b9391a54eb4c64efbc7ecf9f8cbf4742d70c
Python
bisalgt/flask_0
/practice/query_db.py
UTF-8
292
2.546875
3
[]
no_license
from flask import Flask from mysql_connection import connection app = Flask(__name__) @app.route('/') def users(): c, conn = connection() c.execute('SELECT * FROM my_user') counts = c.rowcount u1 = c.fetchone() u2 = c.fetchall() return f'{counts}----{u1}---{u2}'
true
7e718658d9ace1bb746feed8cf59e72727e1520c
Python
tariqrahiman/pyComPro
/leetcode/google/phone-interview-prep/i341.py
UTF-8
1,071
3.078125
3
[]
no_license
class Solution(object): def trap(self, height, verbose=False): """ :type height: List[int] :rtype: int """ start, end, res = 0, len(height) - 1, 0 if height: ml, mr = height[start], height[end] while end > start: if ml <= mr: start ...
true
b5cefe9a0fa6aebd618b44df0bb6730f65363371
Python
Rajpreet16/data_mining_project
/first_line.py
UTF-8
153
2.6875
3
[]
no_license
import csv import sys f = open(sys.argv[1]) #thankyou @jjm csv_f = csv.reader(f) l = [] for row in csv_f: l.append(row) output = l[0] print(output)
true
8eab843198bd1036275b00480868163b3bdb20fe
Python
barretobrock/slacktools
/slacktools/block_kit/compositions.py
UTF-8
2,660
2.8125
3
[ "MIT" ]
permissive
import enum from typing import ( List, Tuple, ) from slacktools.block_kit.base import BaseBlock from slacktools.block_kit.types import ( ConfirmationDialogType, DispatchActionType, OptionGroupType, OptionType, ) class DispatchActions(enum.Enum): on_enter_pressed = 0 on_character_enter...
true
d517c9647d38624005040d521383710bf5eda2d9
Python
rileyL6122428/data-science-from-scratch-notes
/24-exercises-dbs/not-quite-a-base.py
UTF-8
862
3.375
3
[]
no_license
class Table: def __init__(self, name, columns): self.name = name self.columns = columns self.rows = [] def __repr__(self): return ( self.name + ' TABLE' + '\n' + str(self.columns) + '\n' + '\n'.join(map(str, self.rows)) ) ...
true
5be6f6f3ae9850497cc0afcb23aee0823215f5b7
Python
YDK18/flying_car-lecture_exercise
/motion_planning-master/graph_search.py
UTF-8
2,342
3.03125
3
[]
no_license
# OK this might look a little ugly but... # Just waiting on eng to install these in the backend! import pkg_resources #pkg_resources.require("networkx==2.0") import networkx as nx from planning_utils import a_star_graph, distance import numpy as np import matplotlib.pyplot as plt from grid import create_grid_and_edge...
true
f10ff35804e17658be428569bbe985e5c4db97c9
Python
mitrapiya25/python-challenge
/pyboss/main.py
UTF-8
2,276
2.796875
3
[]
no_license
import csv import os import sys import operator import datetime if len(sys.argv) == 1: print("Enter the number of files to be processed as an argument") sys.exit() NumOfFiles = int(sys.argv[1]) Boss=[] changedBoss=[] us_state_abbrev = {'Alabama': 'AL','Alaska': 'AK','Arizona': 'AZ','Arkansas': 'AR','Califo...
true
da7d4f80d16dd57ff8931115329c3175d6e0b89f
Python
atomicjets/AdSellers
/functions/helpers.py
UTF-8
620
3.65625
4
[ "MIT" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- import os def chunks(list_size, list_chunk_size): # For item i in a range that is a length of l, for i in range(0, len(list_size), list_chunk_size): # Create an index range for l of n items: yield list_size[i:i + list_chunk_size] def touch(path):...
true
b5c16db8f405c26a7450dd095195cd36576f1ac7
Python
BackupTheBerlios/websane-svn
/branch/Release-1.0.0/src/filehandler.py
UTF-8
2,396
2.59375
3
[]
no_license
#!/usr/bin/python # -*- coding: UTF8 -*- # Copyright (C) 2005: Mikko Virkkilä (mvirkkil@cc.hut.fi) # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at you...
true
bdc8d32b21a53163c37423084450f74e8c2b371a
Python
jiguangzhong/Rockfish
/rockfish/sorting/trace_sorting.py
UTF-8
1,316
3.109375
3
[]
no_license
class SEGYSorting(object): """ Convience class for trace sorting functions. """ def sort_traces(self, *keys, **kwargs): """ In place sorting of SEG-Y traces by trace-header attributes. :param traces: List of :class:SEGYTrace objects to sort. :param *keys: List of trac...
true
669e95ec50e5bb8489d2cba99dfb160939cf2cee
Python
pawelbielski/dask-sql
/tests/integration/test_sort.py
UTF-8
3,803
2.65625
3
[ "MIT" ]
permissive
from tests.integration.fixtures import long_table import pytest from pandas.testing import assert_frame_equal import pandas as pd import dask.dataframe as dd def test_sort(c, user_table_1, df): df_result = c.sql( """ SELECT * FROM user_table_1 ORDER BY b, user_id DESC """ ) ...
true
ed67e7b8625e82e53a0dec81220d4c2b9a4473aa
Python
Python3pkg/Ping_Sweep
/ping_sweep/ping_sweep.py
UTF-8
13,506
2.734375
3
[ "BSD-2-Clause-Views" ]
permissive
#!/usr/bin/env python # # Copyright 2011 Pierre V. Villeneuve # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Thi...
true
8779dcc2935d253dc9e29050760ce049af5a4a00
Python
bjtrost/MSSNG-paper-2022
/misc_figures/make_table_cohort_information.py
UTF-8
3,033
2.515625
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 ##################################################### # make a table summarizing the individuals in MSSNG # ##################################################### import argparse import docx import docx_lib import pandas from collections import defaultdict import docx_lib ######################...
true
f1c63078c165cd7d0c8891684cdec884204a62b0
Python
SaiManognya/Python-Assignments
/assignment 1/program 3.py
UTF-8
140
2.640625
3
[]
no_license
print("ba"+"na"*2) # use appropriate operator to print banana print(r"C:\naresh\raju\abhi") # correct the code to print C:\naresh\raju\abhi
true
2cc24f72e95b74afc8266755574f7a4f0a9868f9
Python
palfeng/xinfeng-xu
/src/HashingNetEmbed.py
UTF-8
10,602
2.578125
3
[]
no_license
from layers import HashEmbedding, ReduceSum from keras.layers import Input, Dense, Activation, Embedding, BatchNormalization from keras.models import Model import hashlib import nltk import keras import numpy as np from keras.callbacks import EarlyStopping from sklearn.datasets import fetch_20newsgroups import...
true
75e107ca07245792aa0e3112e283d913b1c2530b
Python
joein/telegram_marvel_bot
/handlers/entity_handlers/characters.py
UTF-8
2,409
2.625
3
[]
no_license
from telegram import Update from telegram.ext import CallbackContext from text import Text from fetcher import Route from states import States from visualization.custom_keyboard import CustomKeyboard from handlers.entity_handlers.base_handler import BaseHandler class CharactersHandler(BaseHandler): @classmethod ...
true
80c694d115ee50ad7e4884c51e68dcbcb6c08292
Python
Sofista23/Aula1_Python
/Aulas/Exercícios-Mundo3/Aula020/Ex097.py
UTF-8
278
3.84375
4
[ "MIT" ]
permissive
def escreva(txt): print("~"*len(txt)) print(txt) print("~"*len(txt)) while True: print("-="*25) t=input("Escreva uma frase qualquer:") escreva(t) print("-="*25) esc=input("Continua[s/n]").strip().upper()[0] if esc=="N": break
true
9a00fd3b6b796ddb55d52cc51e1c0da107287a11
Python
mswdwk/code_test_records
/test/testngpp-1.1/scripts/testngppgen/LogicalLine.py
UTF-8
477
3.390625
3
[ "GPL-3.0-or-later", "LGPL-3.0-only", "MIT" ]
permissive
#!/usr/bin/python class LogicalLine: def __init__(self, first_phys_line, line_number): self.line_number = line_number self.content = "" self.add_line(first_phys_line) def add_line(self, phys_line): self.content += phys_line if len(self.content) > 0: if self.content[-1] == "\\...
true
a3b6a062d2f138c778d9be57663ef511ce459864
Python
antonzaharia/algorithms
/Python/car_game.py
UTF-8
705
3.625
4
[]
no_license
command = "" is_car_on = False while True: command = input("> ").lower() if command == 'start': if is_car_on: print('Car is already started.') else: print('Car starting...') print('Done. Ready to go!') is_car_on = True elif command == 'stop': ...
true
037f77119904dca96c363f02434cf458fccc71cd
Python
alexanderaboutanos/18.2.20
/21_extract_full_name/extract_full_name.py
UTF-8
733
4.0625
4
[]
no_license
def extract_full_names(people): """Return list of names, extracting from first+last keys in people dicts. - people: list of dictionaries, each with 'first' and 'last' keys for first and last names Returns list of space-separated first and last names. >>> names = [ ... {'...
true
e472db08dfa339bf309ede41a733e0732cfe8b26
Python
WinChua/Arithmetic-coding
/ssbm.py
UTF-8
921
2.640625
3
[]
no_license
from __future__ import division import random charset = {'a','t'} l = list(charset) testString = ''.join([random.choice(l) for i in range(4)]) length = len(charset) initDiv = (0,1) currentPro = [1.0/length for i in l] medianPro = map(lambda x: x*(initDiv[1]-initDiv[0]), currentPro) currentDiv = reduce(lambda x, y:x...
true
553dcec217c5b0d6ed889f37b723a2bca6ab24ea
Python
affinitic/affinitic.ldap
/affinitic/ldap/utils.py
UTF-8
2,841
2.53125
3
[]
no_license
# -*- coding: utf-8 -*- """ gites.ldapimport Licensed under the GPL license, see LICENCE.txt for more details. Copyright by Affinitic sprl $Id$ """ import string from random import choice from affinitic.ldap import SSHA import base64 import md5 import sha import random import crypt mapping_latin_chars = {138: 's', 1...
true
ed84b844e71f2a002931c148cd7662cd34827580
Python
icsolution/Honest_Calculator
/code.py
UTF-8
3,542
3.890625
4
[]
no_license
class Calculator: def __init__(self): self.equation = self.result = self.memory = '0' def run(self): self.get_equation() self.calculate() print(self.result) self.save() def get_equation(self): print('Enter an equation') self.equation = input().split(...
true
ca8e3f8d4ab4723f4e3ad02c682c7a60279cfc3a
Python
ramouerj/Arkad3
/Pong/Score.py
UTF-8
2,482
2.734375
3
[]
no_license
#!/usr/bin python import pygame from pygame.locals import * import Modules.Database import Menu class ViewUpdate: def run(self): while True: pygame.time.Clock().tick(35) self.screen.fill((0, 0, 0)) for event in pygame.event.get(): if event.type == QUIT: break keys = pygame.key.get_pressed(...
true
e703d5181889fdbb842177e6119e7ea02f83bdd6
Python
taoranzhishang/Python_codes_for_learning
/study_code/Day_10/12dict基本定义.py
UTF-8
629
4.3125
4
[]
no_license
''' mydict={} print(type(mydict)) ''' mydict = {"abcdefg": 10, "123456": 36, "123456": 136} # "abcdef"为key不可重复重复被覆盖,10为次数 print(mydict) # key重复,次数少的会被多的覆盖,{'abcdef': 10, '123456': 136} print(mydict["abcdefg"]) # 根据key取出value for key in mydict.items(): # 组合,每一个key和value映射,返回元组 print(key, type(key)) ''' ...
true
852123f977f38639a6a7ae0d124dc6493b2a5699
Python
amnet04/ALECMAPREADER1
/mapa.py
UTF-8
1,016
2.515625
3
[ "MIT" ]
permissive
import numpy as np import pandas import cv2 import departamento import georef import funcionesCV_recurrentes as cvr import textdetector class mapa(object): ''' Clase para manejar y manipular los mapas del alec ''' def __init__(self, image): ''' Inicia el objeto mapa cargando una imagen...
true
47db51280f8ea2142ac1db698d37a6bff558f093
Python
induraj2020/DeepEnsemble
/DeepEnsemble/DeepEnsemble.py
UTF-8
7,136
2.78125
3
[ "MIT" ]
permissive
import tensorflow as tf import numpy as np from sklearn.metrics import * from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import train_test_split, RandomizedSearchCV metrics_list = ["cohen_kappa_score", "roc_auc_score", "top_k_accuracy_score","accuracy_score","balanced_accuracy", ...
true
dc71d8dab03a9c2c4b9b3f71c6758a60328b3eb6
Python
jby4/IntroToProg-Python
/Assigment05_Answer.py
UTF-8
5,131
3.859375
4
[]
no_license
#-------------------------------------------------# # Title: Working with Dictionaries # Dev: Jean-Baptiste # Update Date: 09/07/2018 #https://www.tutorialspoint.com/python/python_dictionary.htm #---------- #-- Data --# # declare variables and constants # objFile = An object that represents a file # strData = ...
true
83d7dfa29983c56224d82a25aefc2943b20d292a
Python
oskomorokhov/python
/study/checkio/Dropbox/unlucky_days.py
UTF-8
893
3.421875
3
[]
no_license
#!/usr/bin/env checkio --domain=py run unlucky-days # https://py.checkio.org/mission/unlucky-days/ # Friday 13th or Black Friday is considered as unlucky day. Calculate how many unlucky days are in the given year. # # Find the number of Friday 13th in the given year. # # Input:Year as an integer. # # Output:Number of...
true
1c808e65f000a40d63b7d868f6cb4b524e547526
Python
mmarano25/121-spacetime-crawler-project
/applications/search/crawler_frame.py
UTF-8
7,034
2.546875
3
[]
no_license
import logging from bs4 import BeautifulSoup from collections import Counter from datamodel.search.MmaranoBhtruon1_datamodel import MmaranoBhtruon1Link, OneMmaranoBhtruon1UnProcessedLink from spacetime.client.IApplication import IApplication from spacetime.client.declarations import Producer, GetterSetter, Getter from ...
true
8d9b88a97b6280226f550aa03013a3b691c85fee
Python
helito01/brioa_port
/brioa_port/schedule_parser.py
UTF-8
1,325
3.328125
3
[]
no_license
import pandas as pd SCHEDULE_DATE_COLUMNS = ['Abertura do Gate', 'Deadline', 'ETA', 'ATA', 'ETB', 'ATB', 'ETS', 'ATS'] def parse_dates(orig_df: pd.DataFrame) -> pd.DataFrame: """ Parses the date format that the schedule spreadsheet uses into proper datetime objects. Returns: A new data frame...
true
866ce5ad244fc22d1ce53a58fbbe3ec69536920c
Python
Thaiph1308/LeetCode_Solutions
/Easy/62. Unique Paths.py
UTF-8
478
3.421875
3
[]
no_license
import itertools m = 7 n = 3 def print_info(s): flag = True print(s) print(len(s)) print(type(s)) for i in s: print(i) if flag: print(type(i)) flag=False pass def uniquePaths(m,n): e = ['D']*(m-1) f = ['R']*(n-1) e = 'DDDDDD' f = 'RR' ...
true
72609ce613f14bcd7c234431b7f3f26bc7fd0270
Python
Julian21A/30-Days-of-Code-Python-
/Day 7.py
UTF-8
171
3.21875
3
[]
no_license
#Day 7: Arrays if __name__ == '__main__': n = int(input().strip()) for i in reversed(list(map(int, input().rstrip().split()))): print (i,end=" ")
true
9558fe1543e23efd0c9bb088c7c95b43352f3db1
Python
yzl232/code_training
/mianJing111111/Google/explain and write algorithm that implements and infinite binary counter, where add() takes O(1) time complexity.py
UTF-8
1,443
3.75
4
[]
no_license
# encoding=utf-8 ''' explain and write algorithm that implements and infinite binary counter, where add() takes O(1) time complexity ''' ''' we keep an aggregation on consecutive 1 or 0. meaning 111000111 is <3,1> <3,0> <3,1> 1) if the first bulk is of 1's. it turns to bulk of 0`s and turn the very next 0 to 1. we ...
true
f834103e871b3756eee48a2bdc0b383110863a87
Python
sotte/nphelper
/test/test_block.py
UTF-8
2,772
2.90625
3
[ "MIT" ]
permissive
from __future__ import division, absolute_import, print_function import numpy as np from numpy.testing import TestCase, assert_almost_equal from nphelper import block class TestBlock(TestCase): def test_block_row_wise(self): A = np.ones((2, 2)) B = 2 * A assert_almost_equal(block([A, B])...
true
81d1ed3e275e78e47eacac467a4f8f89b0c22a10
Python
L1nwatch/leetcode-python
/14.最长公共前缀/solve.py
UTF-8
631
3
3
[]
no_license
#!/bin/env python3 # -*- coding: utf-8 -*- # version: Python3.X """ """ import re __author__ = '__L1n__w@tch' class Solution: def longestCommonPrefix(self, strs: list) -> str: result = str() if len(strs) <= 0: return result length_list = [len(x) for x in strs] min_len...
true
541efe200dabc25aef8243972335ea8676aae084
Python
xc1111/untitled2
/hk_homework1_10/demo6.py
UTF-8
483
3.703125
4
[]
no_license
# 定义基类 class Base: # 定义init方法和次数为空 def __init__(self,number=None): # 如果次数为空 if number is None: # 打印内容 print("吃好,喝好,养精蓄锐,守米待鼠") # 否则 else: # 次数定义给自己 self.number=number # 打印内容 print("主动出击,不发现老鼠就不休") ...
true
54fb974059233b9752646febf0c842deede7fd94
Python
Nue1711/practice_git
/key-vending-copy1/app/utils/write_log.py
UTF-8
1,213
2.65625
3
[]
no_license
import datetime import traceback import time from constant.path import Path import logging file_name = Path.PATH_FOLDER + '/logs/log-' + str(datetime.datetime.now().date()) + '.txt' logging.basicConfig(filename=str(file_name), filemode='a', format='%(asctime)s %(levelname)s %(me...
true
21e462682e11c5aabf90411d818a470596ccad84
Python
SiddharthChakraborty1/django_assignment
/assignment/projects/models.py
UTF-8
3,475
2.59375
3
[]
no_license
from collections import defaultdict from django.db import models from django.contrib.auth.models import BaseUserManager, AbstractBaseUser from datetime import date # The following function will return the project Resource Pool for default value def get_default_project(): if Project.objects.filter(name = 'Resourc...
true
630500fcd100dc04f2cdbba06998a7d5f5fe7599
Python
FinancialSentimentAnalysis-team/Finanical-annual-reports-analysis-code
/wangyi/wk4/count_weighted_Harvard.py
UTF-8
799
2.5625
3
[ "Apache-2.0" ]
permissive
# coding: utf-8 # In[2]: from Count import * if __name__ == '__main__': root_path = '/usr/yyy/self testing/txt_weighted/' result_path = '/usr/yyy/wk4/Count_Weighted_Harvard/' dictionary_path = '/usr/yyy/dictionaries/Harvard IV-4 converted/' if not os.path.exists(result_path): os.mkdir(resul...
true
b3c407cd0796a4289d38dd844a072ab1066ce2e5
Python
RainieroPV/Product_Development-pycharm
/first_app.py
UTF-8
1,832
3.796875
4
[]
no_license
from itertools import product import streamlit as st import numpy as np import pandas as pd st.title("This is my first streamlit app, for Galileo Master!") x = 4 st.write(x, 'square is', x*x) x, 'square is', x*x st.write('Now using Dataframes...') """ ## Data Frames """ df = pd.DataFrame({ ...
true
dbfb5b4e87f418f5f7c22d365f13d024b742fc25
Python
alexshenyuefei/python-
/python/文件打开保存/python3中解决换行符问题.py
UTF-8
1,771
3.359375
3
[]
no_license
# with open('阿瓦隆1.txt','w') as f: # f.write('遗世独立的理想乡') # f.write('\r\n') # f.write('亚瑟王') # with open('阿瓦隆1.txt','rU') as f: # print(f.read().__repr__()) """ python3d读取不推荐rU模式 """ # f = open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True) """ 在Python 3,可以通过open函数的n...
true
5df219b5edaca9d7faac19e4b9174a1535a3d171
Python
mkrasnitski/neural-network
/accuracy.py
UTF-8
760
2.609375
3
[]
no_license
from network import Network import pickle import numpy as np import sys from multiprocessing.dummy import Pool as ThreadPool def read_file(path): image, label = None, None with open(path, 'rb') as f: image = pickle.load(f) label = pickle.load(f) labels = [1 if i == label else 0 for i in range(10)] return imag...
true
4d9fe31284e9edf989a68187a5de0e35572b14ab
Python
Baig-Amin/python-assignment-w3e
/9-class_with_instance.py
UTF-8
199
3.640625
4
[]
no_license
class Vehicle: def __init__(self, max_speed, mileage): self.max_speed = max_speed self.mileage = mileage car = Vehicle(250, 18) print(car.max_speed, car.mileage)
true
9524acd45c6a51bc850b2c7d3f319b9244bfb98b
Python
EdgarTeixeira/Money
/money/utils.py
UTF-8
5,209
2.734375
3
[ "MIT" ]
permissive
from collections import defaultdict from datetime import datetime from math import exp, log from typing import Any, Dict, List import requests import yahoofinancials as yf from dateutil.relativedelta import relativedelta # https://pt.stackoverflow.com/questions/188910/api-banco-central-ipca-e-selic # FIXME: relatived...
true
e74f25256e3ac11df084ad6e1be6d1349242c95f
Python
jlamontagne/prawler
/prawler/utils/misc.py
UTF-8
439
2.890625
3
[ "MIT" ]
permissive
import re from bs4 import NavigableString def decompose_all(s): for tag in s: if isinstance(tag, NavigableString): tag.replace_with('') else: tag.decompose() def text(x): if isinstance(x, NavigableString): x = unicode(x) elif not isinstance(x, basestring): ...
true
82180060386a3d0745d3bf41368992aca20b0c8c
Python
nguyentran0212/IoTSE-prototypes
/component_services_refactored/reading_collector_service_refactor/IoTSE_framework/cs_kernel/entity_base.py
UTF-8
461
2.859375
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Apr 11 16:51:41 2018 @author: nguyentran Base Entity class allows defining concrete types of entities """ from abc import ABC, abstractmethod class Entity(ABC): def __init__(self): pass def to_dict(self): return self.__dic...
true
902ca5d71c047192c9d9764a20f0252fdeac1a39
Python
wmarchewka/ClassTest
/polling.py
UTF-8
273
2.578125
3
[]
no_license
class Polling(object): def __init__(self, mainwin, hardware): self.value1=88 self.mainwin = mainwin self.hardware = hardware print(mainwin) self.mainwin.print("Polling") print("polling hardware:{}".format(self.hardware))
true
cc50ae4e92a592ceb780eb552154f3ba044ee7da
Python
BhatiaPriya/Regularization
/L1RegularizationEx.py
UTF-8
895
3.515625
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Dec 20 12:23:07 2018 @author: abhik """ # TODO: Add import statements import pandas as pd # Lasso (least absolute shrinkage and selection operator) is a # regression analysis method that performs both variable selection # and regularization in order to enhance the predicti...
true
bcef900e606315f5facfd733b0216f15ee206371
Python
IsabelDing00/django9hours
/day1/wsgi_web_server_withURLs.py
UTF-8
1,672
2.90625
3
[]
no_license
# -*- coding:utf-8 -*- # Learn from Alex Li # create by Isabel Ding # https://blog.csdn.net/laughing2333/article/details/51288660 # Notice: be aware if the localhost has been opened before, remember to close the code you ran before, and then run this from wsgiref.simple_server import make_server def book(environ, star...
true
ed652314989243b2c04d9a84f717a6738e28f169
Python
yku-unimelb/Tmor-Da-AbM-GAMA-Macro1
/statistics/plot_p2.py
UTF-8
2,900
2.671875
3
[ "MIT" ]
permissive
import os import csv import matplotlib.patches as mpatches import matplotlib.lines as mlines import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm from matplotlib.ticker import LinearLocator, FormatStrFormatter import numpy as np import scipy.interpolate as interp results = ...
true
2b4bf159bda2abf75cafe10d34744fea63d01e5b
Python
Premalilly/seleniumPython
/test_prog.py
UTF-8
824
3.46875
3
[]
no_license
#!usr/local/bin/python class TestProg: #Sort a given list def sort_list(self): l1 = [10,1,45,6,9,-35,0] t = len(l1) #print sorted(l1) for i in range(t): for j in range(t-i-1): if l1[j] > l1[j+1]: temp = l1[j+1] ...
true
ecd8e3e658442ea27e8fd2dfd3affb4df732a6af
Python
RonnyPfannschmidt-Attic/dependencies
/dicm/__init__.py
UTF-8
2,512
2.671875
3
[]
no_license
from collections import Mapping import weakref from .utils import SimpleDelegate import pytest from _pytest.python import getfuncargnames class ScopeDict(dict): def __init__(self, name): self.name = name self.cleanups = [] def run_cleanups(self): while self.cleanups: clean...
true
d81804a44bea9ee08a8389f5a0fdb93556f2e6e5
Python
hetavpabari/1BM17CS056
/pwd.py
UTF-8
125
3.203125
3
[]
no_license
import string from random import randint str1 = string.printable for i in range(6): print(str1[randint(0,100)]," ")
true
d65915635611fdfc382035d2b8c40bd87b04343d
Python
mille535/learnpython
/week3/wk3ex3.py
UTF-8
1,148
3.390625
3
[]
no_license
#!/usr/bin/env python ''' Read the 'show_lldp_neighbors_detail.txt' file. Loop over the lines of this file. Keep reading the lines until you have encountered the remote "System Name" and remote "Port id". Save these two items into variables and print them to the screen. You should extract only the system name and port ...
true
d05e7632f40b096c80a18a6abb0123eea1340fce
Python
KoreSamuel/note
/python/handle_img.py
UTF-8
415
2.875
3
[ "MIT" ]
permissive
'''programming deal image use pil''' # !/usr/bin/env python3 # -*- coding: utf-8 -*- from PIL import Image, ImageFilter im = Image.open('timg.jpg') w, h = im.size print('image size %sx%s' % (w, h)) #image size 246x263 im.thumbnail((w//2, h//2)) im.save('thumbnail.jpg', 'jpeg') w, h = im.size print('image size %sx%s'...
true
a8fdfd8b141f4dbdb140d92a7e6220add3ad1c1f
Python
uk-gov-mirror/ONSdigital.ips_common
/ips_common/config/configuration.py
UTF-8
815
2.671875
3
[ "MIT" ]
permissive
import os import re import yaml from pkg_resources import resource_string class Configuration: path_matcher = re.compile(r'\$\{([^}^{]+)\}') def __init__(self, package=None, yaml_file=None): yaml.add_implicit_resolver('!path', self.path_matcher, None, yaml.SafeLoader) yaml.add_constructor('!...
true
63a29de1de7b632db43abc814d7bd9eeb5d476c1
Python
tiagosabbioni/Exercises
/primenumber.py
UTF-8
307
3.703125
4
[]
no_license
def primo(): flag = 0 while(flag == 0): n = int(input("Insert the number to be verified:\n")) if(n <= 9223372036854775807): flag = 1 divisors = 0 for i in range(1, n+1): if(n % i == 0): divisors += 1 print(f'Divisors: {divisors}') primo()
true
612f514e720c193df79fb25787a1e27b3f18f2eb
Python
kavithachandra/edx-load-tests
/helpers/markers.py
UTF-8
3,590
3.03125
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
""" This module causes logging of test start/stop and other critical events. The locust logging format is not necessarily stable, so we use the event hooks API to implement our own "stable" logging for later programmatic reference. Enable this feature in a load test by including the following lines in some form, near...
true
90f0351655a6ba14a20c5c9da77e659490c417a6
Python
hiqhan/project-euler
/pe37.py
UTF-8
642
3.34375
3
[]
no_license
#! /usr/bin/python2.7 # -*- coding: utf-8 -*- from common import isPrime def isTruncPrime(n): s = str(n) pre = ['1', '9'] if s[0] in pre or s[-1] in pre: return False for i in range(1, len(s)): if not isPrime(int(s[:i])) or not isPrime(int(s[i:])): return False return T...
true
d3afb737c2cb591f8cb7d1ca60cc1f2946a4b0df
Python
JOHNKYON/kaggle_HCDS
/preprocess/preprocessor.py
UTF-8
447
2.65625
3
[ "MIT" ]
permissive
"""This module is the data preprocessor""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import pandas as pd import numpy as np class Preprocessor: """This is a class contains functions of data preprocess""" def read_data(self, file_name): ...
true
7ab428a602740221fb1a28b67af2e9c78ae966d1
Python
Python-lab-cycle/AISWARYA-PYTHON
/GCD.py
UTF-8
201
4.09375
4
[]
no_license
a = int(input("Enter first number: ")) b = int(input("Enter second number: ")) for i in range(1, min(a, b)+1): if (a%i==0 and b%i==0): gcd = i print("GCD of", a, "and", b, "is", gcd)
true
13ac2d754641fce7acd7221edbcdfd5ddefe6260
Python
docyx/computer-parts-and-accessories
/get_total.py
UTF-8
289
3.203125
3
[ "MIT" ]
permissive
""" Get the total amount of items in the `data` folder. """ import os import json total = 0 for data_file in os.listdir("./data"): path = os.path.join("./data", data_file) with open(path, "r") as f: data = json.loads(f.read()) total += len(data) print(total)
true
cff511d2cb81b489bf041f37180b97f6cf52d26f
Python
ander265/48to1
/my_app/48-1_app.py
UTF-8
1,698
2.515625
3
[ "MIT" ]
permissive
import sys sys.path.append('..') from collections import Counter from flask import Flask, request, render_template, jsonify import pickle import numpy as np import numpy as np import pandas as pd from watson_personality_functions import all_personality_info_to_df from watson_tone_analyzer_functions import text_to_sente...
true
533b220c6a1fdd68c03cfe1f93a4ae95fb432904
Python
slieer/py
/py-dev-study/src/simple/built_in_map.py
UTF-8
1,213
3.515625
4
[]
no_license
''' Created on Apr 17, 2014 @author: root ''' def simple(): def add100(x): return x + 100 hh = [11, 22, 33] print(('hello not map, ', [add100(i) for i in hh])) print(('hello 1st, ', list(map(add100, hh)))) simple() def sec(): def abc(a, b, c): return a * ...
true
bf28dcb0e18123e68605db3ff9a338e69c632a37
Python
robertatakenaka/balaio
/balaio/notifier.py
UTF-8
3,834
2.734375
3
[ "BSD-2-Clause" ]
permissive
# coding: utf-8 import ConfigParser import urllib2 import urllib from .utils import SingletonMixin, Configuration config = Configuration.from_env() CHECKIN_MESSAGE_FIELDS = ('checkin_id', 'collection_uri', 'article_title', 'journal_title', 'issue_label', 'pkgmeta_filename', 'pkgmeta_md5', 'pkgmeta_filesize...
true
2625171e414f38d9e702cb8ec92d935a92a65d15
Python
Zoltarr777/RoguelikeRPG_1.15
/components/status.py
UTF-8
1,312
3.0625
3
[]
no_license
import tcod as libtcod from game_messages import Message from entity import Entity class Burn: def __init__(self, damage, turns, owner): self.damage = damage self.turns = turns self.owner = owner def update(self): results = [] if self.turns == 0: self.owner.fighter.status = None results.append({'m...
true
ff4af50d5b9504de542beb36333f938febded8c7
Python
rpm1995/Codeforces
/935A_Fafa and his Company.py
UTF-8
193
3.3125
3
[]
no_license
n = int(input()) ans = 0 if n == 2: print(1) else: for leader in range(1, n): employees = n - leader if employees % leader == 0: ans += 1 print(ans)
true
f462ceef1786a0bd92ca06e53513bd61f69bd222
Python
KevKode/HealthNet
/HealthApps/forms.py
UTF-8
27,549
2.578125
3
[]
no_license
""" file: forms.py description: model and regular forms for all register and update related components """ from django.contrib.auth import authenticate from django.db.models.fields import BLANK_CHOICE_DASH from django import forms from django.core.validators import * from .views.log_item import CreateLogItem from .mo...
true