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
911ee00602ee009a5e848976af8fc8d642d673c0
Python
menhuan/notes
/code/python/python_study/six/iterated.py
UTF-8
159
3.171875
3
[ "Apache-2.0" ]
permissive
result = map(lambda x:x*2,[1,2,3,4,5]) print(result) print(list(result)) result = map(lambda x,y:x*y,[1,2,3,4,5],[2,3,4,5]) print(result) print(list(result))
true
ed7a3213009cb968346bbcefced23cfeacb92aef
Python
ahua010/Restrooms-Finder
/Google.py
UTF-8
3,118
2.796875
3
[]
no_license
import urllib, urllib2, webbrowser, json import os import logging from _dbus_bindings import String ### Utility functions you may want to use def pretty(obj): return json.dumps(obj, sort_keys=True, indent=2) def safeGet(url): try: return urllib2.urlopen(url) except urllib2.HTTPError, e: ...
true
49a3c0f1764a014a067521c74d71a27b492123dd
Python
Connor-Harkness/Kiara
/cogs/selfmanage.py
UTF-8
8,351
2.53125
3
[]
no_license
import asyncio import traceback import discord from discord.ext import commands from cogs.utils.cooldowns import basic_cooldown def get_color_role(member): for role in member.roles: if role.color == member.color: return role GUILD_ID = 215424443005009920 base_colors = [ ("Red", 424579...
true
bdef305829ed5339b1a78d4f649b3d773527072f
Python
nabazar/obstacle-avoidance
/depth.py
UTF-8
1,341
2.796875
3
[ "MIT" ]
permissive
import cv2 import numpy as np import math from threading import Thread from time import time from utils import debug class DepthCalcThread(Thread): def __init__(self, matches, name, config): super(DepthCalcThread, self).__init__(name=name) self.pts_1 = matches['pts_1'] self.pts_2 = matche...
true
073f46fe685389a314c03dbf87e3f9f64ecf0673
Python
oskin1/torch_practice
/torch_grad.py
UTF-8
128
2.53125
3
[]
no_license
import torch x = torch.ones(2, 2, requires_grad=True) y = x + 2 z = y ** 2 * 3 out = z.mean() out.backward() print(x.grad)
true
bf16942c3068d69d05a1e77fbb9499f4c63f95d9
Python
hyejinHong0602/BOJ
/silver/[WEEK8] 1475 - 방 번호.PY
UTF-8
335
3.5625
4
[]
no_license
n = input() sixnine=0 others=0 for i in range(len(n)): if n[i]=='6' or n[i]=='9': sixnine+=1 else: if others < n.count(n[i]): others = n.count(n[i]) if sixnine%2==1: sixnine=sixnine//2+1 elif sixnine%2==0: sixnine=sixnine//2 if sixnine < others: print(others) else: ...
true
df39c041d79fd25bc6c06018ffde7cf3a0803a1f
Python
AnthonyHadfield/Neural-Networks
/reconstitute_data.py
UTF-8
663
3.421875
3
[]
no_license
import numpy as np from decimal import * data = np.array([[1, 5], [2, 6], [3, 7], [4, 8], [1.1, 5.5], [2.2, 6.6], [3.3, 7.7], [4.4, 8.8]], dtype=float) def Reconstitute_DataSets(): X = []; y = [] print('') for i in range(0, 8): index_0 = data[i, 0] index_1 = data[i, 1] ...
true
f494000e5f8df0a19dd379f77613cd085f859197
Python
antoinemadec/vim-verilog-instance
/plugin/verilog_instance.py
UTF-8
4,394
2.546875
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 """this script is a basic script for doing verilog editing it parses the variables from stdin and generate a verilog name instantiation of the variables""" import re import sys skip_last_coma = 0 keep_comment = 1 keep_empty_line = 1 if len(sys.argv) > 1: skip_last_coma = int(sys.argv[1]) ...
true
5020e492327f41d892ea7ccf03ccc19aef5b928d
Python
Introspectibles/tobe-misc
/processing/python_sinus_generator.py
UTF-8
3,306
2.703125
3
[]
no_license
import numpy # Sinus generator from OpenViBE tutorial, here we can set the frequency of the mother wave (1st channel), the frequency of others will be a multiple (by 2, 3, and so on). # values between 0 and 1 class MyOVBox(OVBox): def __init__(self): OVBox.__init__(self) self.channelCount = 0 s...
true
5f8629edfadd12f25f9f6dc8f2706cfb9ab3a4d6
Python
LugonesM/FisicaPy
/FuerzayPresion/volumenHierroVsCorcho.py
UTF-8
1,816
4.21875
4
[]
no_license
import sys import math #Ejercicio del libro: #¿Cuantos centimetros cubicos de corcho pesan lo mismo que 200cm³ de hierro? #peso especifico del hierro es 7,85 g/cm³ #peso especifico corcho 0,22 g/cm³ PEH = 7.85 #peso especifico del hierro en g/cm³ PEC = 0.22 #peso especifico del corcho en g/cm³ def check( value ) :...
true
b8ae4004e78674f63228da4a5d3f6a60ea478eab
Python
KarchinLab/CHASMplus
/scripts/snvbox/update_uniprot_ppi.py
UTF-8
3,626
2.671875
3
[]
no_license
""" File: update_exon_feat.py Author: Collin Tokheim Email: ctokheim@jhu.edu Github: ctokheim Description: Add ppi feature to uniprot_features table """ import MySQLdb import csv import argparse def parse_arguments(): info = 'Add uniprot features to Exon_Features table' parser = argparse.ArgumentParser(descri...
true
1220d06e7db3e96590c7f82832dd2f98cffd477e
Python
sheena-fernandez/sdr
/sortin/merge.py
UTF-8
672
3.390625
3
[]
no_license
#!/usr/bin/env python3 import random n = random.randint(5, 20) lista = [ random.randint(0, n * 2) for x in range(0, n) ] print(lista) def mergesort(lista): if len(lista) <= 1: return lista h = len(lista) // 2 # Ordena cada metade a = mergesort(lista[0:h]) b = mergesort(lista[h:]) # Mescla as metades em orde...
true
cc529ce9a5c1acde4d34e05eff54c2d29fa0d8dd
Python
Ufuk-a/Space-invaders
/space_invaders/lib/human_ship.py
UTF-8
1,731
3.140625
3
[]
no_license
from space_invaders.lib.bullet import Bullet from space_invaders.res.glob import * player_image = pygame.image.load("space_invaders\\res\\images\\human_ship.png") class HumanShip(pygame.sprite.Sprite): def __init__(self, hp): pygame.sprite.Sprite.__init__(self) self.image = player_im...
true
c7c619f402ad2ec9380fcd0a040bb04d8a0b7bbd
Python
TannhauserGate42/pandas
/pandas/core/layout.py
UTF-8
5,311
3.671875
4
[ "BSD-3-Clause" ]
permissive
""" Implements ArrayLayout copy factory to change memory layout of `numpy.ndarrays`. Depending on the use case, operations on DataFrames can be much faster if the appropriate memory layout is set and preserved. The implementation allows for changing the desired layout. Changes apply when copies or new objects are crea...
true
c9e9d8b1b05149e3cd3d392ec9b70e3c6183316b
Python
HansZimmer5000/LensComparison
/webcrawler/tests/crawledlenstestsuite.py
UTF-8
3,404
2.59375
3
[ "Apache-2.0" ]
permissive
import unittest from webcrawler.tests.testdata import generalexamples from webcrawler.lenses.crawledlens import CrawledLens class CrawledLensTestsuite(unittest.TestCase): #\\\\\\\\\\\\ # setUp & tearDown #//////////// def setUp(self): self.__class__.CRAWLED_LENS1_LENS_DICT = generale...
true
a9b8f73258619c3bcb61faa60c4691cf8c380b65
Python
morepath/morepath
/morepath/request.py
UTF-8
11,760
2.671875
3
[]
permissive
"""Morepath request implementation. Entirely documented in :class:`morepath.Request` and :class:`morepath.Response` in the public API. """ from webob import BaseRequest, Response as BaseResponse from dectate import Sentinel from .reify import reify from .traject import create_path, parse_path from .error import Link...
true
8de5900f692194fe6f6741fb02cced1fe2243e21
Python
Aasthaengg/IBMdataset
/Python_codes/p03046/s847893958.py
UTF-8
530
2.78125
3
[]
no_license
def main(): m,k=map(int,input().split()) if 2**m<=k: print(-1) elif m==0: if k==0: print(0,0) else: print(-1) elif m==1: if k==0: print(1,0,0,1) else: print(-1) else: ans=[] for i in range(2**m-1,...
true
66e112ccaf17b8d3038b446bad54495a74a7301c
Python
Metallicow/wxPythonDemos
/SplashScreen.py
UTF-8
1,922
2.859375
3
[]
no_license
#!/usr/bin/env python2.4 # I Always specify the python version in the #! line, it makes it much # easier to have multiple versions on your system import wxversion wxversion.select("2.6") ## Note: it may well work with other versions, but it's been tested on 2.6. import wx import os, time class MySplashScreen(wx.Spla...
true
41502d04d0d2433a41ea2740f492d30882c52b12
Python
cybersaksham/Python-Tutorials
/24_recursion.py
UTF-8
795
4.6875
5
[]
no_license
""" Recursion is just calling a function in itself. But if we not declare some base values to end the recursion, then it would calling the function infinite times & will give error. Recursion is not a good technique because it process in reverse manner hence line of code increase rapidly. """ def fac_itr(n): # This ...
true
7e601e8a69d95cef4ef233b44d04bf75b1e83e1c
Python
stjordanis/autogluon
/core/tests/unittests/scheduler/test_seq_scheduler.py
UTF-8
4,599
2.515625
3
[ "Apache-2.0" ]
permissive
import pytest from autogluon.common import space from autogluon.core.scheduler.seq_scheduler import LocalSequentialScheduler cls = LocalSequentialScheduler def test_get_average_trial_time_(): running_time = cls.get_average_trial_time_(0, avg_trial_run_time=None, trial_start_time=100, time_end=102) assert ru...
true
f2821f0ed33bdc448d0a7e46e6eec447f9eeab87
Python
benjamincorcoran/SASDocumentation
/SASDocumentation/SASObjects/SASDataObjectParser.py
UTF-8
1,768
3.078125
3
[ "MIT" ]
permissive
import re from .SASBaseObject import SASBaseObject from .SASDataObject import SASDataObject class SASDataObjectParser(SASBaseObject): ''' SAS Data Object Parser Class Factory for creating DataObjects from text string ''' def __init__(self): SASBaseObject.__init__(self) def parseDat...
true
a2945a82c36cb5157a364979aba9d6671c9be41c
Python
daylightPL/Instrumenty_Finansowe
/Modelgui.py
UTF-8
3,858
3.484375
3
[]
no_license
from sklearn.linear_model import LinearRegression import numpy import time import pandas import datetime import dateutil.relativedelta def Prediction (data_xy, date_for_prediction): #Obrobka dat (Lista X) train_list_x = data_xy[0] train_list_y = data_xy[1] for i in range(0, len(train_list_x)): ...
true
d4bd3413f804236ad7706ccb09bbebf52f4f0316
Python
nagyist/mapd-core
/QueryEngine/scripts/generate_TableFunctionsFactory_init.py
UTF-8
21,916
2.65625
3
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
permissive
"""Given a list of input files, scan for lines containing UDTF specification statements in the following form: UDTF: function_name(<arguments>) -> <output column types> (, <template type specifications>)? where <arguments> is a comma-separated list of argument types. The argument types specifications are: - scalar...
true
d69c703aa9727f00104d864902f92555a7bca525
Python
feng-li/Distributed-Statistical-Computing
/book-examples/16-recommendation-systems/mapper2.py
UTF-8
676
3.46875
3
[]
no_license
#!/usr/bin/python3 from itertools import combinations import sys while True: try: line=sys.stdin.readline()9. if not line: break line=line.strip() values=line.split('|') #combinations(values,2) get all the combinations of 2 films for item1, item2 in combinations(va...
true
0abec71f386b206a72983a6a5015a937ac1ffadd
Python
H-E-L-P/dmu_products
/dmu12/Q0_calc.py
UTF-8
3,614
2.671875
3
[ "MIT" ]
permissive
import numpy as np from astropy.table import Table from astropy import units as u from astropy.coordinates import SkyCoord, search_around_sky from IPython.display import clear_output from pymoc import MOC from pymoc.util.catalog import catalog_to_moc from mltier import Field, Q_0, parallel_process, describe, gen_ran...
true
49a7bb1d3539e8deb963f751178c7861f79b15fc
Python
danabaxia/stockAnalysis
/stockAnalysis/indicators.py
UTF-8
11,135
3
3
[ "MIT" ]
permissive
import robin_stocks as r import trading_algorithms as m import financial as f import pandas as pd import matplotlib.pyplot as plt import numpy as np import stockstats import time from datetime import datetime import csv import itertools #import talib ######################### #stock tikers grabbing #download da...
true
c2e8770c869d9071e73cf71b9fd3fadbc5a03e14
Python
jiguifang904/DSSM
/layers/activation.py
UTF-8
1,045
2.84375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Sep 30 14:34:53 2021 @author: jiguifang """ # 激活函数 import torch.nn as nn class Identity(nn.Module): def __init__(self, **kwargs): super(Identity, self).__init__() def forword(self, X): return X def activatio...
true
3c2c4fc5bad7f323eb70e01656e0bb6eec30166a
Python
PanMaster13/Python-Programming
/Week 9/Sample Files/Sample 7.py
UTF-8
158
2.796875
3
[]
no_license
#Sample7.py import random def randomLine(fname): lines = open(fname).read().splitlines() return random.choice(lines) print(randomLine("write.txt"))
true
9e8e1dbd634accbe01259d72c25664cfee8ad9db
Python
Vladislav29/neural-lab
/Lab2/neural.py
UTF-8
1,055
3.09375
3
[]
no_license
import math class neural: n = 1 def __init__(self): self.w = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] def point(self, a, b): x = [] l = (float(abs(b)) + float(abs(2 * b - a))) / float(40) e = float(2 * b - a) while float(b) < e: b...
true
95a336838d5e38dd59cfdb6a416e7362d634a6c4
Python
w3cp/coding
/python/python-3.5.1/5-data-structures/6-del.py
UTF-8
129
3.109375
3
[]
no_license
a = [-1, 1, 66.25, 333, 333, 1234.5] del a[0] a del a[2:4] a del a[:] a # del can also be used to delete entire variables: del a
true
f44f3012420dcb13edd1a979d6ceccf58e9fdd90
Python
clovisdanielcosta/python-dio
/aula3_if_elif_else.py
UTF-8
533
4.4375
4
[ "MIT" ]
permissive
a = int(input('Primeiro valor: ')) b = int(input('Segundo valor: ')) if a > b: print('O maior valor é: {}'.format(a)) else: print('O maior valor é: {}'.format(b)) print('Fim do programa') #Usando Elif (Else If) a = int(input('Primeiro valor: ')) b = int(input('Segundo valor: ')) c = int(input('Terceiro valor:...
true
36f9d0c0b52b40115bb870c3fc56b4b7a10f70fc
Python
ryankupyn/eulerprobs
/euler12/main.py
UTF-8
333
3.34375
3
[]
no_license
triangnum = 0 adder = 1 divisors = 0 while divisors < 500: divisors = 0 triangnum += adder adder += 1 for divider in range(1, triangnum/2): if triangnum % divider == 0: divisors += 1 divisors += 1 if divisors > 250: print(triangnum) if divisors >= 500: pri...
true
62596ab283b592cccb1b4b9f5a91d74bd02ad365
Python
Nilanshrajput/SyferText
/syfertext/pointers/span_pointer.py
UTF-8
2,660
2.75
3
[ "Apache-2.0" ]
permissive
from syft.generic.pointers.object_pointer import ObjectPointer from syft.workers.base import BaseWorker import syft as sy from typing import List from typing import Union class SpanPointer(ObjectPointer): """An Object Pointer that points to the Span Object at remote location""" def __init__( self, ...
true
33b6c6f27bcc2cea48c3537844e64223486a258d
Python
XyK0907/for_work
/LeetCode/Stack/20_Stack_valid_parentheses.py
UTF-8
1,928
3.171875
3
[]
no_license
from pythonds.basic import Stack class Solution(object): def isValid_stack(self, s): #导入栈模块 """ :type s: str :rtype: bool """ opens = '([{' closes = ')]}' parstack = Stack() balance = True for each in s: if each in '([{': ...
true
c6ca73895fcc0314d19c3713f2b02fcdbb29dfe1
Python
JiahongHe/WeCare
/Pulse.py
UTF-8
876
2.921875
3
[]
no_license
import mraa import time import math #Initialization led_pin_number=6 led = mraa.Gpio(led_pin_number) led.dir(mraa.DIR_OUT) last_signal = [0] current_signal = [0] last_time = [0] current_time = [0] BPM = [0] #Set heart rate test function def test_pulse(): #Read raw data from pulse sensor Pulse = float(PulSensor...
true
7a2e8e0aca37985458dc15e106d25b56cc4af93f
Python
ykumards/Algorithms
/arrays/ZeroMatrix.py
UTF-8
738
3.921875
4
[ "WTFPL" ]
permissive
def clearZeros(Mat, row, col): """ Given a matrix and the row and column index This will clear out all the elements in the row and column. Returns the matrix in the end """ M = len(Mat) N = len(Mat[0]) Mat[row][:] = [0 for _ in xrange(N)] for i in xrange(M): Mat[i][col] = 0 ...
true
22db792793b36e0fa61ba1f92ea32ab8d69f0ea3
Python
abhishektayal/casebook
/parse2.py
UTF-8
4,261
2.5625
3
[]
no_license
import cass import re import time from threading import Thread from Queue import Queue from urllib import urlopen q = Queue() workers = [] dict_photo_url={} def user_frnd_post(name): #print "in function" file = open('file.txt', 'r') for line in file: #print "line is:",line match = line...
true
ebed81e100b25012e1c6808b886763d9fc26c525
Python
wmpg/WesternMeteorPyLib
/wmpl/Utils/OptimizePointingsFOV.py
UTF-8
15,219
2.734375
3
[ "MIT" ]
permissive
""" Given the locations and pointings of camera, optimize their pointings so they have a maximum overlap at the given range of heights. """ from __future__ import print_function, division, absolute_import import copy import datetime import multiprocessing import numpy as np import matplotlib.pyplot as plt impor...
true
58312fc909e172788f4cfcfeccb8177b8994dcd6
Python
MReneBrown/Python-Course
/Sorted_Function.py
UTF-8
516
3.484375
3
[]
no_license
sales_prices = [ 100, 83, 220, 40, 100, 400, 10, 1, 3 ] # sales_prices.sort() # print(sales_prices) # [1, 3, 10, 40, 83, 100, 100, 220, 400] # sorted_list = sales_prices.sort() # print(sorted_list) # None # sorted_list = sorted(sales_prices) # print(sorted_list) # print(sales_pric...
true
6f9a6d82248fb0522753330c9ce7c7bc9ceb3412
Python
rlawjdghks7/HistoDram
/utils/Logger.py
UTF-8
2,770
2.515625
3
[]
no_license
""" Implements Logger class for tensorflow experiments. """ import tensorflow as tf import os class Logger(object): def __init__(self, log_dir='/home/aamomeni/research/momena/tests/experiments', sess=None, summary_ops={}, var_list=[], global_step=None, eval_ops={}, n_verbose=10): ...
true
51b504e622b5f91b5997b887108e9e8e3972fddb
Python
yuliasimanenko/Python
/lab5/functions.py
UTF-8
1,109
3.0625
3
[]
no_license
import requests import random from lxml import html def get_names(count): try: with open('names/names.txt', 'r', encoding="utf-8") as file_open: list_of_words = file_open.read().split("\n") random.shuffle(list_of_words) return list_of_words[:count] except FileNotFoundEr...
true
f20813a0df43b91d2b8479b961e8ebbccbff5a59
Python
ZoltanMG/holbertonschool-higher_level_programming
/0x0A-python-inheritance/1-my_list.py
UTF-8
283
3.921875
4
[]
no_license
#!/usr/bin/python3 """ class MyList that inherits from list """ class MyList(list): """ My subclass """ def print_sorted(self): """ Print sorted """ new_list = MyList() for i in self: new_list.append(i) print(sorted(new_list))
true
dcf5afae43e6ebfa72c15f3eee329d56952ceb4c
Python
nish235/PythonPrograms
/Nov09/02String1st2Last2.py
UTF-8
123
3.171875
3
[]
no_license
def string(st1): if len(st1) < 2: return '' return st1[0:2] + st1[-2:] print(string('Nishant'))
true
49d1f591fd2ca2620b019497bcce9b5fb3eaa42f
Python
ECMora/SoundLab
/sound_lab_core/Segmentation/SegmentManager.py
UTF-8
15,477
2.609375
3
[]
no_license
from PyQt4.QtCore import QObject, pyqtSignal import numpy as np from duetto.audio_signals import AudioSignal from sound_lab_core.Segmentation.Adapters import ManualDetectorAdapter from sound_lab_core.Clasification.Adapters import ManualClassifierAdapter from sound_lab_core.Elements.OneDimensionalElements.OneDimensional...
true
45ca50a9e95e0b5580d163057a430ceedcf59eb0
Python
netogalindo/blog
/tests/unit/post_test.py
UTF-8
1,326
3.578125
4
[]
no_license
from unittest import TestCase from post import Post class PostTest(TestCase): def test_create_post(self): p = Post("Test Title", "Test content.") self.assertEqual("Test Title", p.title, "The title is not valid for the test") # self is TestCase # This is checking if the defined title is eq...
true
30951416f39c023c0911ea0fb1ef2df1c804a652
Python
mkristien/trading_playground
/src/predictor/exponential_mean.py
UTF-8
1,534
3.359375
3
[]
no_license
from predictor.model_interface import AbstractPredictor class ExponentialMeanParametric(AbstractPredictor): """ Compute running exponential mean as: mean = mean * L + new_value * (1-L) for alpha parameter L being 0 < L < 0 The alpha parameter determines how fast should the mean adapt to ...
true
f3d23c09228bc453b79af482ee1e86cbe0642f5d
Python
DorDob/rest-api-training-v
/test_greeting.py
UTF-8
634
3.3125
3
[]
no_license
import requests import pytest NAME = "Doroa" # stała def test_greeting(): r = requests.get(pytest.HOST +'/greeting') assert r.status_code == 200 # sprawdza czy otrzymamy rzeczywiście 200, assert r.json()['content'] == 'Hello, Stranger!' def test_greeting_by_name(): ...
true
13248f1c6b4b232f1520b5e7a07b47bd9ec24a1c
Python
sebastienliu/leetcode_puzzles
/217_contain_duplicates.py
UTF-8
210
2.75
3
[]
no_license
class Solution: def containsDuplicate(self, nums): d_nums = set() for val in nums: if val in d_nums: return True d_nums.add(val) return False
true
97548bd46fcde818fc78affa77171d9fdd86218b
Python
J-Gottschalk-NZ/FRC_Panda
/06_round_up.py
UTF-8
350
4.09375
4
[]
no_license
import math # rounding function def round_up(amount, round_to): # rounds amount UP to the specified amount (round_to) return int(round_to * round(math.ceil(amount) / round_to)) # Main Routine starts here to_round = [2.75, 2.25, 2] for item in to_round: rounded = round_up(item, 1) print("${:.2f} --> ${:....
true
218e80dd74fbd67c992a9245fc936116349cf64d
Python
TheWewokaChronicle/downstream-node
/tests/test_utils.py
UTF-8
5,160
3
3
[ "MIT" ]
permissive
import unittest from downstream_node import utils class TestDistribution(unittest.TestCase): def setUp(self): self.list0 = [10, 10, 20, 20, 30, 30] self.list1 = [20, 30] self.list2 = [10, 10, 20, 30] self.list3 = [10, 10, 20, 20, 20, 30, 30, 30] self.dist0 = utils.Distribu...
true
63276a2186d7195fd89f64846d25bc5b435260ce
Python
k-harada/AtCoder
/ABC/ABC101-150/ABC139/A.py
UTF-8
226
3.046875
3
[]
no_license
def main(): s = list(input()) t = list(input()) assert len(s) == len(t) res = 0 for i, ss in enumerate(s): if ss == t[i]: res += 1 print(res) if __name__ == "__main__": main()
true
71bbe30c6f5c82448da4e0da711819f30a3df535
Python
GanatheVyshnavi/Vyshnavi
/7th.py
UTF-8
74
3.53125
4
[]
no_license
s=float(input('enter value of s')) a=4*s print("perimeter of square is",a)
true
92f6026283faf20d4496a71234b3ef1ff81a2ab0
Python
sebastianedholme/DevOps18
/programmering_systemering/egna_ovningar/rate_calc.py
UTF-8
202
3.609375
4
[]
no_license
print('Enter hours: ', end="") hours = int(input()) print('Enter hours: ', end="") rate = int(input()) #print(type(hours)) #print(type(rate)) pay = hours * rate print("\nYour pay is: {}".format(pay))
true
5375e70b4946efec1214f9e7d33c3c0e17f0a61a
Python
pengfeiyan/fluent_python
/three/3.5.py
UTF-8
976
3.953125
4
[]
no_license
# -*- coding: utf-8 -*- # @Author : yanpengfei # @time : 2018/11/20 下午5:03 # @File : 3.5.py # 字典的变种 from collections import OrderedDict ''' python3.6以后dict都是保持顺序的,但使用OrderedDict能返回最开始或者最后添加的元素。dict默认没有这两个方法 OrderedDict中popitem()默认删除并返回最后一个添加的元素,popitem(last=False)默认删除并返回第一个添加的元素 ''' d = OrderedDict(dict(zip(['one...
true
3e718163297a3f2a2b072943fd0a4e58a838dedc
Python
vonzhou/Core-Python-Programming
/chapter8/For.py
UTF-8
295
3.515625
4
[]
no_license
#P195 for eachLetter in 'vonzhou': print 'current letter:', eachLetter nameList = ['vonzhou', 'luyna', 'Yet', 'chown'] for name in nameList: print name, 'is right' for nameIndex in range(len(nameList)): print 'By index:', nameList[nameIndex] print len(nameList) print range(len(nameList))
true
4064169bb318d893e445ccd78dfe47d4d1985ad1
Python
Anand191/Thesis-Results
/Scripts/ch_plot.py
UTF-8
799
2.75
3
[]
no_license
import matplotlib.pyplot as plt from matplotlib.patches import Ellipse import numpy as np width = [8.5, 6, 4, 2.2] height = [6.0, 4.5, 3.0, 1.5] xy = (0,0) ch = ['recursively enumerable', 'context-sensitive', 'context-free', 'regular'] h_offset = [0.35,0.35,0.35,0.5] w_offset = [-1.72, -1.4, -1.01, -0.45] ells = [Elli...
true
d4845241475eacc80f47ef6794528d184bf26db4
Python
SleepwalkerCh/Leetcode-
/45_2.py
UTF-8
1,483
3.375
3
[]
no_license
#45. Jump Game II #简单的贪心递归,将之前那一版的递归改成了递推就过了 #好像是BFS来着,其实改进的地方可以直接把前面数据初始化给删了 class Solution: def jump(self, nums: List[int]) -> int: ''' record=[] if len(nums)==1: return 0 for i in range(len(nums)): if nums[i]+i>len(nums)-1: target=len(nums)-...
true
8ca8e675bfce7c69ece866e888c06ddde2758139
Python
nilanjanchakraborty87/py-learn
/introduction/functions.py
UTF-8
583
3.796875
4
[]
no_license
def greet(*args, **kwargs): """ docstring this function takes a message and greets you """ print("Hello ", args[0], args[1], args[2]) print("Kwargs ", kwargs["message"]) # greet("Cts", "Macy", "IBM", message = "Nilanjan") print(greet.__doc__) # lambda # multipler_3 = """ def random11111(...
true
010ffe7aec1fc164d3541d4d927feceffdc06b40
Python
bjellesma/chatchord
/models/models.py
UTF-8
1,825
2.65625
3
[]
no_license
# NOTE importing the mongobase alone is enough to initiate the connection import models.mongobase from mongoengine import Document from mongoengine.fields import ( StringField, ListField, BooleanField ) from mongoengine.errors import DoesNotExist #Error Handling from flask_login import UserMixin # user logins from ...
true
a6c4fb1f05dfb53112d7a71084fe91271b684cad
Python
theRemix/linkchecker
/linkchecker.py
UTF-8
1,368
2.96875
3
[]
no_license
#!/usr/bin/env python import sys import requests from bs4 import BeautifulSoup from texttable import Texttable domain = sys.argv[-1] omit = {'/','#'} links = {} colors = { 'reset': '\033[0m', 'red': '\033[31m' } def color(text, c): return "{c}{text}{r}".format(c=colors[c], text=text, r=colors['reset']) ...
true
1611dac3d06f949c48d55002dd7c66fa06f45eba
Python
gfbenatto/Simple-tests-in-Python
/files2.py
UTF-8
99
3.265625
3
[]
no_license
file = open('numeros.txt', 'r') for line in file.readlines(): print(line.rstrip()) file.close()
true
fd5814bbc5bff9db236736b2ca2cc02b36591dc4
Python
lucocozz/Labyrinthe_python
/ft/game.py
UTF-8
1,407
3.40625
3
[]
no_license
from ft.display import * from ft.file import * from classe.map import * def roboc(map): """Lance le jeu""" end = False while end is False: clear() print(map) entry = get_input() end = do_entry(map, entry) save_game(map) def get_input(): """recupere l'input""" ...
true
739a51a645f0e63d521480bf23f40e082a6f9044
Python
redX1/vaanah_back
/vaana_app/orders/utils.py
UTF-8
400
2.734375
3
[]
no_license
import random import string from .models import Order class Util: def getOrderNumber(): letters = string.ascii_uppercase digits = string.digits strn = 'OR' + str(len(Order.objects.all()) + 1) rand_nb = ''.join(random.choice(digits) for i in range(2)) rand_str = ''.join(rando...
true
94fb12248c44e70d7df664147cc35343f9577387
Python
throwawwwwway/haptiq
/app/view.py
UTF-8
9,076
2.6875
3
[]
no_license
import tkinter as tk import app.logconfig as lc from tkinter import Canvas, Menu from app.device import Point from functools import partial from app.network import Network def motion(event, device): x, y = event.x, event.y device.position = Point(x, y) # def update_pressed_key(event, listener): # liste...
true
416c95ee8abf504bd181f8e7ec8c8ecc3dbf66ec
Python
doguhanyeke/leetcode-sol
/Sort/k-closest-points-to-origin.py
UTF-8
437
3.234375
3
[]
no_license
import math from typing import List import heapq class Solution: def kClosest(self, points: List[List[int]], K: int) -> List[List[int]]: return sorted(points, key=lambda x: math.pow(x[0], 2) + math.pow(x[1], 2))[:K] class Solution2: def kClosest(self, points: List[List[int]], K: int) -> List[List[int...
true
7f66064302a48ef735480d00011ea63769bdde62
Python
IrekKarimov/11419
/Lab_04.py
UTF-8
914
4.5
4
[]
no_license
# 4. Пользователь вводит две буквы. # Определить, на каких местах алфавита они стоят, и сколько между ними находится букв. print("====================================================") print("Определение места буквы в английском алфавите") print("====================================================") s1 = input("Введ...
true
56bb3a7aacad88dff2488c7825c24c00c9c7ab76
Python
gotutiyan/nlp100_knock
/source/chapter1/004.py
UTF-8
787
3.671875
4
[]
no_license
#"Hi He Lied Because Boron Could Not Oxidize Fluorine. New Nations Might Also Sign Peace Security Clause. Arthur King Can."という文を単語に分解し, # 1, 5, 6, 7, 8, 9, 15, 16, 19番目の単語は先頭の1文字,それ以外の単語は先頭に2文字を取り出し, # 取り出した文字列から単語の位置(先頭から何番目の単語か)への連想配列(辞書型もしくはマップ型)を作成せよ. sentence = "Hi He Lied Because Boron Could Not Oxidize Fluorine....
true
72feb95a9fe6f0e1e5a022883b8883cc2759cb86
Python
jmichalicek/django-fractions
/djfractions/__init__.py
UTF-8
8,666
3.25
3
[]
permissive
__version__ = "5.0.0" import fractions import re from decimal import Decimal from typing import Any, Union from djfractions.exceptions import InvalidFractionString, NoHtmlUnicodeEntity __all__ = [ "quantity_to_decimal", "is_number", "is_fraction", "get_fraction_parts", "get_fraction_unicode_entit...
true
49975842383b40aab822968740f504d1b8f04db0
Python
aleksartamonov/BPL_Stats
/parser/parser.py
UTF-8
1,597
2.859375
3
[]
no_license
from service.match import FootballMatch __author__ = 'aleksart' from bs4 import BeautifulSoup def parse_document(filename): f = open(filename) content = f.read() f.close() soup = BeautifulSoup(content) tour_results = parse_tour_results(soup) tour_num = 1 matches_html = [] all_matches...
true
126013d2c3d77eb7375fe7e415ed297c4953dd9d
Python
the-argus/pyweek31
/core/GameResource.py
UTF-8
7,592
2.578125
3
[]
no_license
import math import os import random import arcade from constants.camera import FOLLOW, IDLE, LERP_MARGIN, LERP_SPEED from constants.enemies import SPAWN_RADIUS from constants.game import ( GRID_SIZE, PLAYER_DEFAULT_START, ROOM_HEIGHT, ROOM_WIDTH, SCREEN_HEIGHT, SCREEN_WIDTH, SPRITE_SCALING...
true
3839139f280e45332db2003202258f6352272e6a
Python
D0ub1ePieR/Leetcode
/solutions/202-Happy_Number-快乐数/Happy Number.py
UTF-8
860
3.34375
3
[]
no_license
# python3 # simple # 哈希表 数学 # 48ms 31.73% # 13.4MB 15.50% class Solution: def isHappy(self, n: int) -> bool: record = [] while 1: s = sum([int(x)**2 for x in str(n)]) if s == 1: return True if s in record: return False ...
true
d38fb236c68608ba7aafc16328c24c59fe86c423
Python
Tansiya/tansiya-training-prgm
/sample_question/class_divisible.py
UTF-8
440
4.0625
4
[]
no_license
"""define a class generate which can iterate the number,which divisible by 7,range between 0 and n""" #assign a function class string_handling(): def putNumbers(n): divi = [] for i in range(1, n+1): if i%7==0: divi.append(i) return divi def st_rev(n): s = str(n)[::-1] return s n = int(input())...
true
cc0a0a448c1050b959c7917d6e79d354c67e17bf
Python
sanyamc/Courses
/Python/Company/minWindowSubstring.py
UTF-8
4,404
3.65625
4
[]
no_license
""" Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). For example, S = "ADOBECODEBANC" T = "ABC" Minimum window is "BANC". Note: If there is no such window in S that covers all characters in T, return the empty string "". If there are multipl...
true
fb81f8b21c2b749e959d2bca3ec8a909415c146d
Python
aroproduction/School_Programs_Class12
/Binary File Programs/updating_binary_02.py
UTF-8
775
3.03125
3
[]
no_license
# Updating name in existing binary file import pickle stu = {} found = False fin = open('../Resources/Stu.dat', "rb+") try: while True: rpos = fin.tell() stu = pickle.load(fin) if stu['Rollno'] == 5: stu['Name'] = 'Gurnam' fin.seek(rpos) pickle.dump(stu, ...
true
33f8b828b4d65e6520c6695cdb04eac9957eeec5
Python
fedepacher/Wazuh-Test
/Task_4/Fixture/Module/test_student.py
UTF-8
774
2.90625
3
[ "MIT" ]
permissive
from student import StudentDB import pytest @pytest.fixture(scope='module') def db(): print('----------------Setup method----------------') db = StudentDB() db.connect('students.json') yield db print('----------------Teardown method---------------') db.close() ''' Test for student called Scot...
true
d749db8f4defc9101d35c4cf96da5fa8e352e6c5
Python
Vahid-Esmaeelzadeh/CTCI-Python
/educative/08 Tree DFS/04 Path With Given Sequence (medium).py
UTF-8
1,013
4.28125
4
[]
no_license
''' Path With Given Sequence Given a binary tree and a number sequence, find if the sequence is present as a root-to-leaf path in the given tree. ''' class TreeNode: def __init__(self, value, left=None, right=None): self.value = value self.left, self.right = left, right def has_path_with_given_...
true
4c30efcbe8896e73ee5549edcaf16c70dd3e4b4c
Python
drewrutt/Image-To-Dice
/editor.py
UTF-8
3,035
3.6875
4
[]
no_license
from PIL import Image, ImageFilter import math import os dirname = os.path.dirname(__file__) def open_image(path): newImage = Image.open(path).convert('LA') return newImage # Save Image def save_image(image, path): image.save(path, 'png') # Create a new image with the given size def create_image(i, j): imag...
true
34abc24dc07fb23f142b90ccd10ecff719b39e1a
Python
dhermes/project-euler
/python/complete/no303.py
UTF-8
1,958
3.53125
4
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python # We begin with a sorted list of values to choose from. # If the value is not found, we log our biggest value and # save the number of digits. We then start with 10**d # and 2*(10**d), the next biggest values with only digits # less than 3. We wish to find some x*(10**d) + y, where # both x and y...
true
90fa9a1cadcb369433eb6be5222001532e76dcd7
Python
Chad-Mowbray/iamb-classifier
/ipclassifier/token_processors/spelling_syllabify.py
UTF-8
8,370
2.859375
3
[ "MIT" ]
permissive
import re from copy import deepcopy from nltk import pos_tag class SpellingSyllabifier: """ A last resort if a word token cannot be found elsewhere Syllabifies a word based only on its spelling Ridiculously expandable """ VOWELS = "aeiouy" DUMMY_STRESSED = "AH1" DUMMY_UNSTRESSED = "A...
true
6923cb61c5715437746f44e20c14ec82cfa5988e
Python
houking-can/GenDataset
/acl.py
UTF-8
962
2.65625
3
[]
no_license
import os import shutil import json import re def iter_files(path): """Walk through all files located under a root path.""" if os.path.isfile(path): yield path elif os.path.isdir(path): for dirpath, _, filenames in os.walk(path): for f in filenames: yield os.path....
true
65ea0e92549e393489d39287a1439826736fdea8
Python
AHKerrigan/Think-Python
/exercise11_1.py
UTF-8
834
3.90625
4
[]
no_license
""" This is a solution to an exercise from Think Python, 2nd Edition by Allen Downey http://thinkpython2.com Copyright 2015 Allen Downey License: http://creativecommons.org/licenses/by/4.0/ Exercise 11-1 Write a function that reads the words in words.txt and stores them as keys in a dic‐ tionary. It doesn’t matter ...
true
f124cdbb85b04a3a09bc9252dddf7d6633df03bb
Python
afauth/mudecay
/MuonDecay/.old/analysis/mainFile.py
UTF-8
19,225
3.234375
3
[]
no_license
#Imports import pandas as pd import seaborn as sns import numpy as np import matplotlib.pyplot as plt from scipy.signal import find_peaks from scipy.integrate import simps, trapz from scipy.optimize import curve_fit from scipy.stats import chisquare ###########################################################...
true
3e472c5972d90ad0848cc8a6b5409d6b5cc4effa
Python
BuysDB/SingleCellMultiOmics
/singlecellmultiomics/barcodeFileParser/barcodeFileParser.py
UTF-8
10,138
3.015625
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import glob import logging from colorama import Fore from colorama import Back from colorama import Style import os import collections import itertools import gzip #logging.basicConfig(level=logging.DEBUG) # http://codereview.stackexchange.com/questions/88912...
true
585391d23f82681d69728d4afc2f2c389f75e4d5
Python
VadimChorrny/DEV-HUB
/_XSperions/add_cog.py
UTF-8
1,649
2.796875
3
[]
no_license
#----------------------------------------------+ # Enter Cog name | #----------------------------------------------+ COG_NAME = "captcha" #----------------------------------------------+ # Cog template | #----------------------------------------------+ cog_...
true
9b1e909df6bf98b472594f0ca584d679142bc9a0
Python
samparkewolfe/LSTM_Synth
/train_model.py
UTF-8
4,767
3
3
[]
no_license
#This python script handles training the models. #Import the needed libraries import os, sys import numpy as np import h5py import keras from keras.models import Sequential, load_model from keras.callbacks import ModelCheckpoint #Declare the variables of the inputs model_name = '' dataset_name = '' nb_epoch = '' it_...
true
1f51aa621b523ed5465b6ad5674b3ec47e6aa7ad
Python
AashishMehtoliya/Diabetes
/diabetes.py
UTF-8
663
2.9375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue May 28 16:37:18 2019 @author: Aashish Mehtoliya """ from numpy import loadtxt from xgboost import XGBClassifier from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score df = loadtxt('pima-indians-diabetes.csv', delimiter=",...
true
18ab555bd279c090344e88f1c0b15ce4741dc7be
Python
kokliangchng/Sandbox
/week3/exceptionsToComplete.py
UTF-8
235
3.796875
4
[]
no_license
finished=False result=0 while not finished: try: result = int(input("Enter a number")) finished=True pass except ValueError: print("Please enter a valid number") print("Valid result is :",result)
true
d327760f9bca8983ca03c002ae2a6d39de8a5bb6
Python
DDKinger/FlowFly
/code/data_process_0.py
UTF-8
6,283
2.71875
3
[]
no_license
import scipy.io as sio import abc from functools import partial # MAXIMUM_FLOW = 1500 NUM_TRAIN = 14400 class AbstractDataset(abc.ABC): def __init__(self, x): self.x = x @property def x(self): return self.x @abc.abstractmethod def fmap(self, f): pass def __len__(sel...
true
186aabe5e70b2cde29c28640dac7664dffcade52
Python
elektrik-elektronik-muhendisligi/Esp8266Examples
/10_Socket_TCP/socket_TCP_02_server_simple.py
UTF-8
1,500
2.953125
3
[]
no_license
''' https://www.binarytides.com/python-socket-programming-tutorial/ prvni priklad ''' import socket import sys HOST = '' # Symbolic name meaning all available interfaces PORT = 8888 # Arbitrary non-privileged port s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) print('Socket created') try: s.bind((HOST,...
true
8065345665443f799494064174b97370d8aa88af
Python
AxentiAndrei2004/Introducere_Afi-are_-alcule
/Problema 10.py
UTF-8
236
2.90625
3
[]
no_license
n=int(input('Introdu numarul=')) print(n,'*1=',n*1) print(n,'*2=',n*2) print(n,'*3=',n*3) print(n,'*4=',n*4) print(n,'*5=',n*5) print(n,'*6=',n*6) print(n,'*7=',n*7) print(n,'*8=',n*8) print(n,'*9=',n*9) print(n,'*10=',n*10)
true
8031f8419eb69c9529f291b4b399b1239db5a19f
Python
elemel/drillion
/drillion/health_component.py
UTF-8
2,672
2.96875
3
[ "MIT" ]
permissive
from drillion.component import Component from drillion.maths import clamp class HealthComponent(Component): def __init__(self, update_phase, health=1.0, min_health=0.0, max_health=1.0, regeneration=0.0, epsilon=0.001): self._update_phase = update_phase self._health = health ...
true
442ee784f506e195ce9fd3f7191eb7aa61f7ce25
Python
mrusinowski/pp1
/04-Subroutines/z31.py
UTF-8
167
3.921875
4
[]
no_license
def reverse(t): t.reverse() return t tab = [2,5,4,1,8,7,4,0,9] print(f'Tablica: {tab}') print(f'Tablica z elementami w odwrotnej kolejności: {reverse(tab)}')
true
41e2e6d891224efec4265c9e844e738f24a1e329
Python
qingbol/BullyDetection
/predict.py
UTF-8
5,175
2.515625
3
[]
no_license
import tensorflow as tf import numpy as np import os,glob,cv2 import sys,argparse from PIL import Image import matplotlib matplotlib.use("TkAgg") import matplotlib.pyplot as plt # from loaddata import load_dataset from tensorflow.python.platform import flags def main(_): #Load labels label_lst=[] rs = os...
true
25a2ee4b86e4c1b883e8d1c48f5fc487c2ce91a2
Python
luoguanghao/bioinfo_algo_script
/M3_Week5_2BreakOnGenomeGraph.py
UTF-8
574
2.6875
3
[]
no_license
if __name__ == '__main__': from os.path import dirname dataset = open(dirname(__file__)+'dataset.txt').read().strip().split('\n') edges = dataset[0].strip('(').strip(')').split('), (') bp = list(map(int,dataset[1].split(', '))) edges = [list(map(int,i.split(', '))) for i in edges] #print(edges) try: i1=ed...
true
52dc52c762b28f4fc9e302b246a25ad0eda58426
Python
Adashian/goit-python
/module_8/hw_8.py
UTF-8
1,584
3.265625
3
[]
no_license
from datetime import date, datetime, timedelta from collections import defaultdict def congratulate(users): day_names = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] this_week = date.today().isocalendar().week # От этой даты совершается проверка ДР на следующей недели res...
true
4037482df9a31dcf09c875b1563e40312584b8b5
Python
pfhayes/euler
/solved/Euler105.py
UTF-8
571
2.953125
3
[]
no_license
# Find the number of lines in Euler105.txt that obey the special sumset property from useful import powerset total = 0 for line in open("Euler105.txt") : s = map(int, line.split(",")) print s,"", bad = False for subs in powerset(s)[1:-1] : g = set(subs) comp = list(set(s) - g) for altSet in powerset(comp)[1...
true
fbfc2f969525e6f290b2268e4de3ff52bc073d50
Python
JjVera96/chat_sockets
/server.py
UTF-8
6,177
2.59375
3
[]
no_license
# -*- coding: utf-8 -*- import socket import select from pymongo import MongoClient import sys import json class Servidor(): def __init__(self, ip, port): self.client = MongoClient('10.253.130.254', 27017) self.db = self.client.distribuidos self.users = self.db.users self.host = ip self.port = port self.s...
true
d004913c3cf60e9500800475b29a70eff866235e
Python
ulf1/torch-tweaks
/torch_tweaks/idseqs_to_mask.py
UTF-8
3,096
3.171875
3
[ "Apache-2.0" ]
permissive
import torch.sparse import itertools from typing import List, Optional, Union Number = Union[bool, int, float] def idseqs_to_mask(idseqs: List[List[int]], n_seqlen: Optional[int] = None, n_vocab_sz: Optional[int] = None, ignore: Optional[List[int]] = [], ...
true
ca220d267b0171d7a8ea926f638cf3dcbebca414
Python
Animenosekai/jsConsole
/jsConsole/internal/javascript/execute_js.py
UTF-8
1,989
2.71875
3
[ "MIT" ]
permissive
""" Executing JavaScript on the browser. © Anime no Sekai - 2020 """ from ..browser import browser from .. import config from ..exceptions import BrowserError import threading import asyncio async def evaluate_on_pyppeteer(command): result = await browser.evaluate(command) return result def evaluate(comma...
true
ff3eaad880cfa2f2264d6d6f19a9193f3d04eb19
Python
bretthop/projectchooser
/app/services/DomainService.py
UTF-8
777
2.609375
3
[]
no_license
from app.data.model.Domain import Domain class DomainService: def createDomain(self, domain): """ :type domain: Domain """ domain.put() return domain def updateDomain(self, domainId, domainTitle, domainDescription, domainStatus): _domain = Domain....
true