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 |
|---|---|---|---|---|---|---|---|---|---|---|
3667f83793f59f598771170383f17a72ffde2e9f | Seriont/study-1543 | /common/functions.py | UTF-8 | 1,525 | 2.875 | 3 | [] | no_license | # -*-coding: utf-8 -*-
import os
from exceptions import IdError
from models.models import Road, Pocket
def route_path():
current_dir = os.path.abspath(os.curdir)
route = current_dir[:current_dir.rfind('\\')]
return route
def latest_launching_id():
launching_id = 0
route = route_path()
whil... | true |
cd0136d896f8f4132ca3c128ed32646a00f88573 | firasgany77/Deep_Learning | /Deep_Learning_A_Z/Volume 1 - Supervised Deep Learning/Part 3 - Recurrent Neural Networks (RNN)/Section 10 - Part 3 - RNN/rnn.py | UTF-8 | 316 | 2.734375 | 3 | [] | no_license | # Recurrent Neural Network
# Part 1 - Data Preprocessing
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the training set
dataset_train = pd.read_csv('Google_Stock_Price_Train.csv')
training_set = dataset_train.iloc[:, 1:2].values
# Feature Scaling | true |
e40f47fb1bbaf76904cf2fa11af9f0952f7cfc01 | imldresden/mcv-displaywall | /map_views/views/point_visuals/colored_circle_view.py | UTF-8 | 3,891 | 2.6875 | 3 | [
"MIT"
] | permissive | from libavg import avg
from utils.canvas_manager import CanvasManager
import configs.visual_data as config_visual
import configs.config_app as config_app
class ColoredCircleView(avg.DivNode):
def __init__(self, point_model, parent=None, **kwargs):
super(ColoredCircleView, self).__init__(**kwargs)
... | true |
64b4fed5bb5e746a365da86a69123dcdb307a75b | albertwcheng/SplidarSplicingProcessingScript | /Splidar.Splicing.matchEventToTranscript.py | UTF-8 | 5,531 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python
from sys import *
from os import system,unlink
from tempfile import *
def getTempFileName():
f=NamedTemporaryFile(delete=False)
fileName=f.name
f.close()
return fileName
def deleteTempFile(fileName):
unlink(fileName)
def matchEvent_bestBounds(ev1bounds,ev2bounds):
#if len(ev1bounds)!=l... | true |
22e0463422b89a30a9b72e3c38120f4646a5c0b9 | petarcurcin/ORIOP2020-2021 | /vezbe3/proizvod_objektno.py | UTF-8 | 2,269 | 3.59375 | 4 | [] | no_license | class Proizvod:
@property
def sifra(self):
return self.__sifra
@sifra.setter
def sifra(self, sifra):
self.__sifra = sifra
@property
def naziv(self):
return self.__naziv
@naziv.setter
def naziv(self, naziv):
self.__naziv = naziv
@property
def c... | true |
3b62d6f4d1943f09857c9daa5c8a39f6900db05b | IP-Algorithmics/Udacity | /Course/Data structures and algorithms/2.Data structures/2.3.Recursion/2.Recursion.py | UTF-8 | 8,573 | 4.65625 | 5 | [
"MIT"
] | permissive | import time
import statistics
import matplotlib.pyplot as plt
'''
Recursion
Introduction
Recursion is a technique for solving problems where the solution to a particular problem depends on the solution to a smaller instance of the same problem.
Consider the problem of calculating 𝟸𝟻 . Let's assume to calculate this... | true |
c8fb694fc5b0bd6f265b834ed35582448eaed3a7 | Loganphx/ProgrammingFundamentalsI | /Lab 4/logan_ingram_lab4b.py | UTF-8 | 146 | 4.15625 | 4 | [] | no_license | #Loops through the array and creates an inverse triangle
array = [10,9,8,7,6,5,4,3,2,1]
for value in array:
star = '*'
print(star * value) | true |
b3d235ade42e0cdfc22949186d485e5cc020a854 | dyng9409/ai3202 | /Assignment7/calc.py | UTF-8 | 6,139 | 3.0625 | 3 | [] | no_license | import re
import random
class Node(object):
def __init__(self, name):
self.name = name
self.prior = None
self.CPT = None
f = open('data.txt')
final = ''
for line in f:
x = re.sub('\n', '', line)
x = re.sub('\[', '', x)
x = re.sub('\]', '', x)
final = final+' '+x
f.close()
... | true |
4114109fd9ceb33b89affbc855f0571fe0b95c3e | hackacat707/pythonWebScanner | /python_GUI_scanner.py | UTF-8 | 3,419 | 3.3125 | 3 | [] | no_license | import PySimpleGUI as Gui
import pythonScannerCMD
# The gui for this application is done using the PySimpleGUI module.
# This is a free template from the PySimpleGUI site
# that I modified so that I can have multiple windows at one time.
# This is so multiple pages can be scanned and shown in the report page
# instea... | true |
1a951795d6867060467c7b8f35bd7eca5c36e747 | RK900/cs170-project | /fix_output.py | UTF-8 | 2,091 | 3.15625 | 3 | [] | no_license | """
Implementation of Hierholzer's algorithm to calculate eulerian path given a dfs
traversal.
This stitches the closed parts of the loops together
"""
from output_validator import validate_output
def run_hierholzer(input_file_name, validate=False,full_path=False, output_folder="phase2_outputs", log_folder="phase2_... | true |
e94916dd93919c7d3030be889bc120c3641d493b | jbmarcos/Python-Curso-em-video-Mundo-1-2-3- | /ex052 # dizer se o número é primo if else colors .py | UTF-8 | 476 | 4.375 | 4 | [
"MIT"
] | permissive | #Dizer se o número é primo if else colors
print(' ')
num = int(input('Digite um númro: '))
total = 0
print(' ')
for c in range(1, num + 1):
if num % c == 0:
print('\033[33m', end=' ')
total += 1
else:
print('\033[31m', end=' ')
print('{}'.format(c), end='')
print('\033[m O número ... | true |
131bd1c450a860f25ceb9c1623fd047f5e41cef1 | Tubbz-alt/lc2-hdf5-110 | /questions/vds_unlimited/driver.py | UTF-8 | 1,246 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | import h5py
import numpy as np
import os
import sys
import time
def run_command(command):
t0 = time.time()
print("-----------")
print(command)
res = os.system(command)
print(" -- finished in %.2f sec" % (time.time()-t0,))
assert res == 0, "command failed"
if __name__ == '__main__':
assert ... | true |
40fe57706421fbaa72cc558aed35833edf25b8bb | finewink/programmers_python | /hash/BestAlbum.py | UTF-8 | 750 | 3.296875 | 3 | [] | no_license |
def solution(genres, plays):
answer = []
map = {}
for i in range(len(genres)) :
if not map.get(genres[i]) or map.get(genres[i]) == None:
map[genres[i]]= {'total' : 0, 'list' : list()}
map[genres[i]]['total'] = map[genres[i]]['total'] + plays[i]
map[genres[i]]['list... | true |
cb89feb91bc9827e18b8d3de7ef8ccd7f80aa8c3 | pratiksachaniya/Python-Program | /Syllbus/Unit2/5.py | UTF-8 | 219 | 3.609375 | 4 | [] | no_license | from array import array
lst = [int(i) for i in input().split()]
ar = array('i',lst)
no = int(input("Enter Element To Find"))
if ar.count(no) > 0:
print("Found At ",ar.index(no))
else:
print("Not Found")
| true |
472da89d39c806002e383672ed1b61b1e782e65c | bublique/nvdbase | /parseaset2.py | UTF-8 | 2,877 | 2.515625 | 3 | [] | no_license | #!/usr/bin/python3
import xml.etree.ElementTree as ET
import sys
import re
from xml.dom import minidom
import xlsxwriter
def newfunc:
pass
def namespaceResolve(xmldoc, nspace):
nvd = xmldoc.getElementsByTagName('nvd')[0]
return nvd.getAttribute('xmlns:' + nspace)
def iterate_children(parent):
child ... | true |
80c536063c330739e17ed62854e0bdcbea87a24d | Kantuiris/iris | /kantu.py | UTF-8 | 616 | 4.15625 | 4 | [] | no_license | # name="iris"
# age=18
# print(name, age)
# grade=70
# if grade>=60:
# print("passing grade")
# grade=60
# if grade>=65:
# print("passing grade")
# else:
# print("failing grade")
# grade=60
# if grade>=85:
# print("A")
# elif grade>=70:
# print("B")
# elif grade>=65:
# print("C")
# else:
# ... | true |
ebb6596cf0ab59b63c020fa81fe71a3279f2064d | Lizonghang/Neural-Network | /PCA/run_PCA.py | UTF-8 | 4,179 | 2.734375 | 3 | [] | no_license | # coding=utf-8
import random
import numpy as np
import matplotlib.pyplot as plt
from compiler.ast import flatten
from types import NoneType
def load_data(filename, start=0, end=None, label=None):
data = []
labels = []
with open(filename, 'r') as fp:
lines = fp.readlines()
for line in lines... | true |
ac2c84ca02c54a6e48d3e4ffdb471381b93e7e75 | manavkaushik/model-comparison-for-best-price-Forecast-of-Bitcoin | /Code_File.py | UTF-8 | 18,459 | 3.15625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# # Importing all Libraries
# In[591]:
import warnings
warnings.filterwarnings("ignore")
import numpy as np
import pandas as pd
import statsmodels.api as sm
from scipy import stats
from sklearn.metrics import mean_squared_error
from math import sqrt
from random import randint
... | true |
a6bcbddb23f253da29452456bbca58485c093569 | skojaku/core-periphery-detection | /cpnet/Lip.py | UTF-8 | 2,481 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | import numba
import numpy as np
from . import utils
from .CPAlgorithm import CPAlgorithm
@numba.jit(nopython=True, cache=True)
def _score_(A_indptr, A_indices, A_data, num_nodes, x):
Q = 0.0
mcc = 0
mpp = 0
ncc = 0
for i in range(num_nodes):
neighbors = A_indices[A_indptr[i] : A_indptr[i ... | true |
ba6c14ec194f00fc226dee60a1f4bddef0d0aca7 | ruzhaa/Programming101-Python | /not_ready/week03/test_bank_account.py | UTF-8 | 816 | 3.40625 | 3 | [] | no_license | import unittest
from bank_account import BankAccount
class Test(unittest.TestCase):
def setUp(self):
self.rado = BankAccount("Rado", 1000, "$")
def test_bank_account_deposit(self):
self.assertEqual(self.rado.deposit(1000), 2000)
def test_balance(self):
self.assertEqual(self.rado... | true |
698c74967d5e959b7904bc34b8a2e64c88bff43a | suspectpart/id3vx | /src/id3vx/binary.py | UTF-8 | 451 | 3.265625 | 3 | [
"MIT"
] | permissive | # Ported from https://en.wikipedia.org/wiki/Synchsafe
def synchsafe(integer):
out = 0
mask = 0x7F
while mask ^ 0x7FFFFFFF:
out = integer & ~mask
out <<= 1
out |= integer & mask
mask = ((mask + 1) << 8) - 1
integer = out
return out
def unsynchsafe(integer):
... | true |
5a96607f0cf1b0d9b7e1fa36d90fa0dbeee0e546 | ibraheem82/python_1 | /python scripts/pythonclass/mainCGPA.py | UTF-8 | 7,407 | 3.078125 | 3 | [] | no_license | from tkinter import *
import tkinter.font as tkFont
root = Tk()
root.title('SEMESTER GPA CALCULATOR')
# root.configure(background = "hotpink")
root.geometry('570x350')
# -------------------------------------------------------------------------------------------
# Heading Size Setting
HeadingSize = tkFont.Fo... | true |
5b3a9ecdb7d27aa26af4eecaa6e4e3613e090d5e | jesus-figueroa/codewars-solutions | /solutions/7-kyu/the-first-non-repeated-character-in-a-string/python/solution.py | UTF-8 | 278 | 3.21875 | 3 | [] | no_license | def first_non_repeated(s):
letters = {}
for i in s:
keys = letters.keys()
if i in keys:
letters[i] += 1
else:
letters[i] = 1
for l in s:
if l in letters and 1 == letters[l]:
return l
return None | true |
8b7014b693ff8c2f417cd8d2536820c335387879 | Matheus-Pontes/Curso-Python-3 | /aula_20/ex100.py | UTF-8 | 484 | 4 | 4 | [
"MIT"
] | permissive | from random import randint
from time import sleep
def sortear(lista):
print('Sorteando 5 valores:', end= " ")
for c in range(0, 5):
n = randint(0, 10)
lista.append(n)
print(f"{n}", end=" ", flush=True)
sleep(0.3)
def somapar(lista):
soma = 0
for n in numeros:
i... | true |
345d415f2deb14fa062755503033ea6c725d6f4b | Hither1/fair-name-ordering | /RandPiper/grandpiper/ed25519/fe.py | UTF-8 | 1,319 | 3.078125 | 3 | [
"MIT"
] | permissive | # somewhat slow functions for computations mod 2**255 + 19
# used for testing and debuging
# heavily based on ed25519_ref
# field modulus
p = 2 ** 255 - 19
# group order
q = 2 ** 252 + 27742317777372353535851937790883648493
def add(x, y):
return (x + y) % p
def sub(x, y):
return (x - y) % p
def mul(x, ... | true |
f10dd51bd329aa2c6302244f245c4c0726d0967c | coldJune/machineLearning | /MachineLearningInAction/adaboost/adaboost.py | UTF-8 | 7,823 | 2.984375 | 3 | [] | no_license | #! /usr/sbin/python3
# -*- coding:utf-8 -*-
import numpy as np
def load_simple_data():
"""添加一个简单数据集
:return:
"""
data_mat = np.matrix([[1., 2.1],
[2., 1.1],
[1.3, 1.],
[1., 1.],
[2., 1.... | true |
99f4757e2140e58571e53c77b29a20a9753196b7 | hamstache/PythonScripts | /12-remove_adjacent.py | UTF-8 | 381 | 3.328125 | 3 | [] | no_license | def remove_adjacent(nums):
if len(nums)>1:
if nums[0] != nums[1]:
return [nums[0]] + remove_adjacent(nums[1:])
del nums[1]
return remove_adjacent(nums)
else:
return nums
if __name__ == '__main__':
print('remove_adjacent')
print(remove_adjacent([1, 2, 2, 3]), [1, 2, 3])
print(remove_adjacent(... | true |
d61b54231368935f39e4597589090c39cf09ff79 | heatheness/python_course | /homework_7/KdigNbase.py | UTF-8 | 835 | 3.078125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""Ввести через запятую K и N (1<N<17), вывести в столбик все K-значные N-ричные числа в порядке возрастания (латинские
буквы для цифр — большие, незначащие нули или пробелы не считаются)."""
__author__ = 'nyash myash'
from itertools import product
base = {
0: '0',
1: '1',
2: '2',... | true |
cd5cbb517e0b29cbbec113beabf6806de3ec7bb9 | gahvs/pylineartools | /main.py | UTF-8 | 114 | 2.625 | 3 | [
"MIT"
] | permissive | from pylineartools import *
m = Matrix.toMatrix(Vector([1, 2, 3, 4, 5]))
for line in m.values():
print(line) | true |
7f0fb66d184627d68771058146e6377c18b1ef6f | Amritpal-001/100-days-of-code | /EulerProject-solvedExamples/Problem 23 (copy).py | UTF-8 | 1,389 | 3.609375 | 4 | [] | no_license | #Euler 23
def SumOfDivisors(n):
z = 0
for i in range(1, n):
if n%i == 0:
z = z + i
#print(z)
return(z)
print(SumOfDivisors(28))
def abundantnumber(n):
if SumOfDivisors(n) > n:
#print(n ,"is a abundant number")
return(True)
abundantnumber(12)
d... | true |
56293edb08513d2d450fbde8e778116b07a8283c | beatarudzka/python-learning | /task3.py | UTF-8 | 175 | 3.9375 | 4 | [] | no_license | # Print elements less than 5
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
new_list = []
for nums in a:
if nums < 5:
new_list.append(nums)
print(new_list)
| true |
33af2c64a680b7ea28430d7b6fa55cc67ebc32fc | FiniteCode/Python-Challenges | /Rock, Papers Or Scissors.py | UTF-8 | 1,650 | 3.46875 | 3 | [] | no_license | score_player = 0
score_cpu = 0
hand = 0
cpu_hand = 0
from random import randint
while 2 > 0:
print ("===================================")
print ("Rock, Paper or Scissors?")
print ("===================================")
hand = input("[You] ")
cpu_hand = randint(1,3)
if cpu_hand == 1:
... | true |
55146912ab71b7ecd56205e63ff3a6474135b8c4 | DriedSponge/DriedBot | /commands/Moderation.py | UTF-8 | 6,480 | 2.671875 | 3 | [] | no_license | import discord
import random
import index
from discord.ext import commands
class ModCog(commands.Cog, name='Moderation'):
"""All things moderation!"""
def __init__(self, client):
self.client = client
# Ban
@commands.command()
@commands.has_permissions(ban_members=True)
@commands.guild... | true |
fe3598ea1da951a8b3a313aba2a5fd65ef303ab2 | Yarenborta/Quadcopter_multi | /Simulation/potentialField.py | UTF-8 | 3,301 | 2.6875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 18 13:40:20 2020
@author: tjards
This module implements potential fields for obstacle avoidance
based on the technique @ ref: https://arxiv.org/pdf/1704.04672.pdf
"""
import numpy as np
class potentialField:
def __init__(self, traj, Po, ga... | true |
7096ea5665a2f4e7cdcc1fb3c01c2a836add921e | Tiedye/CCC | /2011S1.py | UTF-8 | 357 | 3.375 | 3 | [] | no_license | __author__ = 'Daniel'
from collections import Counter
file = open('2011/s1/s1.1.in')
string = ''
for line in file.readlines():
string += line.strip().lower()
chars = Counter(string)
del chars[' ']
if 't' not in chars:
chars['t'] = 0
if 's' not in chars:
chars['s'] = 0
if chars['t'] > chars['s']:
print... | true |
5252b73826c467b172451e1c69952ce2bcf10e56 | iqra-javed/Django-RPG | /queries.py | UTF-8 | 1,093 | 3.140625 | 3 | [] | no_license | ''' How many total Characters are there? '''
from charactercreator.models import Character
characters = Character.objects.all()
len(characters)
''' How many of each specific subclass? '''
from charactercreator.models import Fighter, Mage, Cleric, Thief, Necromancer
fighters = Fighter.objects.count()
mages = Mage.obje... | true |
130e0257fd281bbbb361ea546ff5f5f28009932b | flyingdan/dailyprogrammer | /321easy.py | UTF-8 | 815 | 3.25 | 3 | [] | no_license | import inflect, fileinput
'''
Sample input:
00:00
01:30
12:05
14:01
20:29
21:00
Sample output:
It's twelve am
It's one thirty am
It's twelve oh five pm
It's two oh one pm
It's eight twenty nine pm
It's nine pm
'''
p = inflect.engine()
hr_corner_cases = {'00':'twelve'}
min_corner_cases = {'00':''}
ampm = 'am'
for t in ... | true |
8569755ed0ffe6ed3a479b5f5613a6f2d0ca2644 | Chrisluo266/DL_Parctise | /Threading/Threading-2 join.py | UTF-8 | 851 | 2.96875 | 3 | [] | no_license | import threading as td
import time
def job(num):
print("Thread[{}] start. num = {}".format(td.current_thread(),num))
for i in range(num):
time.sleep(0.1)
print("Thread[{}] End.".format(td.current_thread()))
def jod2():
print("Thread[{}] start.".format(td.current_thread()))
print("Thread[... | true |
a9e1bf759473e0b10481b5b17d37b6e3feab2f03 | pamiro/pydynamics | /pydynamics/visualization.py | UTF-8 | 8,763 | 2.75 | 3 | [] | no_license | # Copyright (c) 2011, PyDynamics Authors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice... | true |
984b1bf88e324583df2eaa79e751912217756838 | joshnygaard/Python-Performance-Tests | /longest_name.py | UTF-8 | 1,229 | 3.375 | 3 | [] | no_license | from itertools import product, repeat, starmap
from tqdm import tqdm
import time
from functools import partial
def _hello(x, y):
return 'Hello {} and {}'.format(x, y)
people = ['Josh', 'Sandi', 'Rachel', 'Emily',
'Alex H', 'Molly', 'Alex S', 'Mandi', 'Anna']
iterations = 100
show_result = False
def... | true |
80818801ab9756397f1d838432ce95c585c8d866 | tayala2019/CIS104 | /H7.py | UTF-8 | 837 | 3.25 | 3 | [] | no_license | #Tamishia Ayala
#04/08/2019
import MusicDB
MusicDB.DisplayMenu()
while(True):
choice = input("Enter your choice: ") # taking a choice
if choice == 'add':
MusicDB.AddSong()
continue
elif choice == 'list':
MusicDB.SongList()
continue
elif choi... | true |
a3f199a8e8d8ee9c067816bfdeffce0cdc589af4 | tukeJonny/python_patterns | /src/adapter/main.py | UTF-8 | 460 | 2.859375 | 3 | [
"MIT"
] | permissive | #-*- coding: utf-8 -*-
import requests
import adapter
def get_google_page(logger):
if not isinstance(logger, adapter.Logger):
raise TypeError("Expected object of type Logger. got {0}"\
.format(type(logger)))
url = "https://google.co.jp/"
res = requests.get(url)
if res.status_code == 200:
logger.success_l... | true |
cfd9f5a9851126ed9eab0e738ac0488be001f442 | Ocnarf2070/DataStructure | /Heap/MaxHeapList.py | UTF-8 | 1,614 | 3.640625 | 4 | [] | no_license | class MaxHeap:
def __init__(self, items=[]):
super().__init__()
self.heap = []
for item in items:
self.heap.append(item)
self.__float_up(self.size() - 1)
def size(self):
return len(self.heap)
def is_empty(self):
return self.size() == 0
d... | true |
1fe5ff08554a215208fe5279a39cbdb34d42a810 | MrHamdulay/csc3-capstone | /examples/data/Assignment_5/ndxren013/question2.py | UTF-8 | 819 | 3.9375 | 4 | [] | no_license |
n = eval(input('Enter the cost (in cents):\n'))#input
paid = 0
while paid < n:
paid += eval(input('Deposit a coin or note (in cents):\n'))#evaluating cost
change = paid - n
if change > 0:
print('Your change is:')
coins = 0
while change >= 100: #working out change
change -= 100
coi... | true |
90e79dd80540febfc3dcc17ebc7c8e6757959fd1 | HuyaneMatsu/hata | /hata/discord/oauth2/connection/tests/test__parse_friend_sync.py | UTF-8 | 414 | 2.59375 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | import vampytest
from ..fields import parse_friend_sync
def test__parse_friend_sync():
"""
Tests whether ``parse_friend_sync`` works as intended.
"""
for input_data, expected_output in (
({}, False),
({'friend_sync': False}, False),
({'friend_sync': True}, True),
):
... | true |
e8614d0d0ae84dc5763500e4aefb2203e85c2544 | Peiffap/lingi2263-homework | /homework1/q4.py | UTF-8 | 3,194 | 3 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from q1 import build_lexicon
from q2 import count_ngrams
from q3 import calculate_perplexity_from_ngrams_model, predict_word_ngrams
def n1grams(old, n):
new = {}
for ngram in old:
if len(ngram) != n:
if ngram in new:
new[ngram]... | true |
d7d28036fda166f9e4f8955ea6eb7873da3a816f | Hijiki38/reconstruction | /main.py | UTF-8 | 652 | 2.625 | 3 | [] | no_license | import sys
import os
import FBP
import ART
if __name__ == '__main__':
print("### Reconstruction ###")
args = sys.argv
mode = 0
if len(args) < 2:
inpath = "."
else:
inpath = args[1]
while True:
mode = input("Operation mode(0:FBP, 1:ART, 2:IR)")
if int(mode) =... | true |
9875670977236bbaa682f56df4ad9d588974c75a | PauliusZaicev/pz_pbd | /CA5/calculator.py | UTF-8 | 1,397 | 3.546875 | 4 | [] | no_license | '''C5 b)'''
import os
os.chdir('D://DBS//5.Programming_for_big_data//github//pz_pbd//CA5')
class Calculator(object):
#addition function
def add (self, first, second):
return map(lambda x,y:x+y, first,second)
#subtract function
def subtract(self, first, second):
return map(lam... | true |
0ae37ec1a64ba3ab3258df55e3cc41738d7bda73 | reedhop24/python-labs | /linked_list_reverse/index.py | UTF-8 | 929 | 3.96875 | 4 | [] | no_license | class Node:
def __init__(self, data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
self.head = None
def append(self, data):
new_node = Node(data)
if self.head == None:
self.head = new_node
else:
pointer = se... | true |
abdeef75dac5980a33ea87dece979b97d8b8cb06 | wy1433/dcdb | /sql/kv/kv.py | UTF-8 | 9,557 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python
# -*-coding:utf-8 -*-
from enum import IntEnum
class Retriever():
'''Retriever is the interface wraps the basic Get and Seek methods.'''
def Get(self, k):
'''
# Get gets the value for key k from kv store.
# If corresponding kv pair does not exist, it returns nil... | true |
fd3ed05de1e04ecd3ee9a93bf5fe5984fcaec1c3 | illiaKavalevich/bdr-tweet | /filter_new.py | UTF-8 | 7,360 | 3.25 | 3 | [] | no_license |
from nltk.tokenize import TweetTokenizer
from nltk.stem.porter import PorterStemmer
import HTMLParser
def break_tag(tag):
broken_tag = []
word = ""
for letter in tag:
if letter.isupper():
if word:
broken_tag.append(word)
word = letter[:]
else:
... | true |
d15b3a3d07b3e8c73e764c76d651e34c7c85776b | ftucl/geolinkage | /utils/SummaryInfo.py | UTF-8 | 5,865 | 3.015625 | 3 | [] | no_license | import ui
from utils.Utils import UtilMisc
from utils.Config import ConfigApp
from utils.Errors import ErrorManager
class SummaryInfo:
"""
Clase utilitaria cuyo proposito es mostrar los resultados finales de la ejecucion del nucleo de procesamiento.
Dividiendo la informacion en: parametros de ent... | true |
c0f2da34f216afbc1b08fc2d7f5ebd41e9f37717 | bhumijaapandey248/Python-Programs-Assignments | /assignment17.2.py | UTF-8 | 1,151 | 4.28125 | 4 | [] | no_license | ##2. Write a function which will display all such numbers between 1000 and 3000 (both included) such that each digit of a number is an even. Call this function in the main function. The numbers obtained should be printed in a comma-separated sequence on a single line.
def even_num(n):
flag=1
temp=n
wh... | true |
143b8730b86509607bcac3938089b2824fed060b | A1rPun/GameOfLife | /gameoflife.py | UTF-8 | 2,284 | 2.984375 | 3 | [] | no_license | import curses
import sys
import time
from drawille import Canvas, getTerminalSize
def getGrid(w, h):
return [[0 for x in range(w)] for y in range(h)]
def countNeighbors(grid, x, y, w, h):
sum = 0
for i in range(-1, 2):
for j in range(-1, 2):
col = (x + j + w) % w
row = (y... | true |
06527b33c03d751d7ff34afa224695b9ef6055ab | kamyu104/LeetCode-Solutions | /Python/design-hashmap.py | UTF-8 | 2,225 | 3.71875 | 4 | [
"MIT"
] | permissive | # Time: O(1)
# Space: O(n)
class ListNode(object):
def __init__(self, key, val):
self.val = val
self.key = key
self.next = None
self.prev = None
class LinkedList(object):
def __init__(self):
self.head = None
self.tail = None
def insert(self, node):
... | true |
f004482e9b93c78d733684e6f62a8a08b449c995 | alanbchristie/microbit-mc-pegmon-buzzer | /main.py | UTF-8 | 3,976 | 3.34375 | 3 | [] | no_license | """
MAIN
An audible buzzer, expected to paired with a Raspberry Pi "pegmon" alarm system.
Here we enable the bluetooth UART service (it's disabled by default) and set some control variables.
"""
"""
A function to clear the display, used when the device starts and after an alarm has been cleared. Just keep one LED ... | true |
84da62fe4289bf13f44f73e0243b855c6923b8d8 | coreyrop/SMIP | /lessons/Submission.py | UTF-8 | 3,409 | 2.890625 | 3 | [] | no_license | try:
from pyspim import Spim
except ImportError:
from pyspim.pyspim import Spim
from gui.Utilities import get_path
from openpyxl import Workbook
from openpyxl.styles import PatternFill
from multiprocessing.pool import ThreadPool
from multiprocessing import cpu_count
def run_MIPS(filename):
sp = Spim(debug... | true |
a66d9d9a27c908de28a0dc177310dd90e9c1b21e | gustcnn/WebFrame | /com/decorate/decorate_without_param_return.py | UTF-8 | 577 | 3.3125 | 3 | [] | no_license | #--*--coding:utf-8
#Author:cnn
#对无参无返回值的函数进行装饰
def set_func(func):
def call_func():
print("---权限验证1---")
print("---权限验证2---")
func()
return call_func
#无参无返回值test1()
@set_func
def test1():
print("----test1----")
# #a指向call_func
# a=set_func(test1)
# #调用call_func(),执行里面的代码,里面会调用test1
... | true |
892c404fe2e8d63f75de88946cfcf37a3dee33d0 | jedbrown/approxposterior | /approxposterior/bp.py | UTF-8 | 15,701 | 2.765625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Bayesian Posterior estimation routines, written in pure python, leveraging
Dan Forman-Mackey's Gaussian Process implementation, george, and his
Metropolis-Hastings MCMC implementation, emcee. We include hybrid
implementations of both Wang & Li (2017) and Kandasamy et al. (2015). If you
use... | true |
eae095eb086d145abff757aa203bbcc517315223 | emanueljg/course-planner | /lib.py | UTF-8 | 5,164 | 3.796875 | 4 | [
"MIT"
] | permissive | import os.path
from datetime import date, timedelta
def grouped(itr, n):
itr = iter(itr)
end = object()
while True:
vals = tuple(next(itr, end) for _ in range(n))
if vals[-1] is end:
return
yield vals
def days(n):
"""Return a timedelta object of n days"""
return... | true |
633b25e6464172a815750b80b57ee83bcd73b8a1 | ezpinsky/word-spot | /app/models/user.py | UTF-8 | 1,956 | 2.625 | 3 | [] | no_license | from .db import db
from werkzeug.security import generate_password_hash, check_password_hash
from flask_login import UserMixin # This extends User to implement is_authenticated() and other propeties
from sqlalchemy.orm import relationship
from alembic import op
from datetime import datetime
friends = db.Table('friend... | true |
007a30f4f195bb1e30177d06dbf3e94b5d83bc1e | AmberPark/TIL | /algorithms/백준알고리즘/class1/Boj_2920_음계.py | UTF-8 | 332 | 3.328125 | 3 | [] | no_license | numbers = list(map(int, input().split(' ')))
cnt1 = 0
cnt2 = 0
for i in range(len(numbers)-1):
if numbers[i] < numbers[i+1]:
cnt1 += 1
elif numbers[i] > numbers[i + 1]:
cnt2 += 1
if cnt1 == len(numbers)-1:
print('ascending')
elif cnt2 == len(numbers)-1:
print('descending')
else:
pri... | true |
4dc4e74fbcc2e4d6c52800cca9bb7e314e09c101 | IlyaGerasimov/RSASecAnalyzer | /wiener.py | UTF-8 | 976 | 2.921875 | 3 | [] | no_license | def solve(a, b, c):
d = b ** 2 - 4 * a * c
if d > 0:
return [(- b + d ** 0.5) / (2 * a), (- b - d ** 0.5) / (2 * a)]
elif d == 0:
return [-b / (2 * a), -b / (2 * a)]
return None
def check_frac(k, d, e, n):
phi_n = (e * d - 1)/k
solution = solve(1, - ((n - phi_n) + 1), n)
if... | true |
37e5252ed921074c25c80e21595963e18692a4c6 | palakgupta889/ML-Algorithms | /Unsupervised Learning/Flat Clustering- K Means/k_means_scratch.py | UTF-8 | 2,092 | 3.203125 | 3 | [] | no_license | import matplotlib.pyplot as plt
from matplotlib import style
style.use('ggplot')
import numpy as np
X = np.array([[1,2],[1.5,1.8],[1.5,1.8],[5,8],[8,8],[1,0.6],[9,11]])
# plt.scatter(X[:,0],X[:,1],s=150)
# plt.show()
colors=10*["g","r","c","b","k"]
class KMeans:
def __init__(self, k=2, tol=0.001, max_iter=300):
s... | true |
d22623fbc8c6abe7b5d66c4778adf36d90f4d7a9 | YuzhouPeng/distribute-file-lock-dict | /fileService.py | UTF-8 | 3,459 | 2.90625 | 3 | [] | no_license |
import socket
import os
import re
import sys
import base64
import connect
from connect import Connect
class FileServer(Connect):
File_location = os.path.join(os.getcwd(), "DirectoryServerFiles")
def __init__(self, port_use=None):
Connect.__init__(self, port_use, self.handler)
self.File_locat... | true |
9675e6bc88899ca0c7d8a9d2134efd612b591676 | gbourniq/lambda-restapi | /sam-application/lambda_restapi/api/dependencies/common.py | UTF-8 | 1,241 | 2.515625 | 3 | [
"MIT"
] | permissive | """
This module defines common dependencies such as common query parameters
"""
from enum import Enum
from typing import NoReturn, Optional
from fastapi import Header
from pydantic import BaseModel, Field
from lambda_restapi.core.config import SECRET_KEY_HEADER
from lambda_restapi.helpers.exceptions import MyCustomE... | true |
925bd3d1fdac9da33350366a3abc81adbbbfa18d | seendsouza/teaching | /Python/3-Loops/timer.py | UTF-8 | 386 | 3.671875 | 4 | [] | no_license | import time
run = input("Start? > ")
mins = 0
# Only run if the user types in "start"
if run == "start":
# Loop until we reach 20 minutes running
while mins != 1:
print(">>>>>>>>>>>>>>>>>>>>>", mins)
# Sleep for a minute
time.sleep(60)
# Increment the minute total
mins +=... | true |
fe726295cae484d8f926f40f9b28dfd2ca36a3f7 | doggy33/DeepLearning-with-TF | /TOPK/top_k.py | UTF-8 | 1,091 | 2.734375 | 3 | [] | no_license | import tensorflow as tf
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"
tf.random.set_seed(1234)
def accuracy(output, target, top_k = (1.)):
maxk = max(top_k)
batch_size = target.shape[0]
pred = tf.math.top_k(output, maxk).indices
pred = tf.transpose(pred , perm = [1,0])
target_ = tf.broadcas... | true |
a690ecf909e92e558168292a787dcc8be3e2fe3e | Jinsaeng/CS-Python | /al4995_Hw_01_q5.py | UTF-8 | 206 | 3.234375 | 3 | [] | no_license | #5
def fibs(n):
curr = 1
curr2 = 1
yield curr
yield curr2
for x in range(n-2):
num = curr + curr2
yield num
curr = curr2
curr2 = num
| true |
5793e5e040d1e0a6890a3969309e346b530f3556 | z0x010/medusa | /medusacode/sqlalchemy_demo/sqlalchemy_demo.py | UTF-8 | 7,032 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python
# coding:utf-8
DATABASE = 'postgresql://postgres:postgres@192.168.100.100:5432/sqlalchemy'
print '----------------------------------------------------------------------------------------------------'
"""
Connecting
"""
from sqlalchemy import create_engine
engine = create_engine(
DATABASE,... | true |
9df48db4e884193dc15933ab3c7817f1afe89ec9 | christabella/competitive-programming | /round1/max_flow_bfs_adj_matrix.py | UTF-8 | 2,263 | 3.53125 | 4 | [] | no_license | #!/usr/bin/env python
from collections import defaultdict, deque
def bfs_path(neighbors, matrix, source, target):
n = target
queue, visited = deque([source]), set([])
parent_map = [None] * (n + 1)
while queue:
node = queue.popleft()
visited.add(node)
for child in neighbors[nod... | true |
6fe7c622e038f19d7587d22bc6e79adcd9f75279 | vitalfadeev/merge-sqls | /to_wp.py | UTF-8 | 3,917 | 2.625 | 3 | [] | no_license | #!/bin/python
# -*- coding: utf-8 -*-
import os
import sys
import codecs
import re
from os import listdir
from os.path import isfile, join
from wordpress_xmlrpc import Client, WordPressPost
from wordpress_xmlrpc.methods.posts import GetPosts, NewPost
from wordpress_xmlrpc.methods.users import GetUserI... | true |
9a5f80316acb03bde937970ebd3afbfa4afeb4a7 | include-dcc/fhir-ingest-htp | /include_transform/patient.py | UTF-8 | 8,749 | 2.546875 | 3 | [] | no_license |
"""Help format the patient data to be ready to load into fhir
We are also capturing the condition strings in conditions_present and
conditions_absent arrays in order to populate the input for the basic
condition objects
"""
from ncpi_fhir_plugin.common import CONCEPT, constants, GENDERFICATION
from cmg_transform im... | true |
5e3bd250f07f563339a4433502d81fadc9a19c29 | dhandy2013/dh-dev-scripts | /start_ssh_agent_by_domain.py | UTF-8 | 8,268 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
"""
Script that starts the SSH agent for a connection based on the domain.
If the agent is already running, it won't start another.
Put something like this in your ~/.ssh/config file:
Match exec ~/bin/start_ssh_agent_by_domain.py --domain=mydomain.com \\
--control=~/.ssh/agent-my... | true |
e3e612f0e3c6313aa2e8f3cbe55012a8c84431d4 | CPVazquez/CS6343 | /Workflows/WF2/Components/C1/src/order-verifier.py | UTF-8 | 16,475 | 2.703125 | 3 | [] | no_license | """Order Verifier Component
Upon receiving a Pizza Order, this component validates the order and checks the store's stock.
If sufficient stock exists, Order Verifier decrements the store's stock and creates the order.
Otherwise, Order Verifier requests a restock before decrementing stock and creating the order.
"""
... | true |
8e29d84e3d7c19b6a8ffead4937ecd9381cce394 | H-P-U/PythonUygulamalar | /Pythonda Hatalar ve Hata Yonetimi/errors-demo.py | UTF-8 | 1,364 | 4.125 | 4 | [] | no_license | #liste=["1","2","5a","10b","abc"]
#1: liste elemanları içerisindeki sayısal elemanları bulunuz.
"""for x in liste:
try:
result= int(x)
print(result)
except ValueError:
continue"""
#2: Kullanıcı q değeri girmedikçe aldığınız her inputun sayısal değerinin olduğundan emin olunuz
# aksi tak... | true |
fafa3de2a3840c5fbc0b366bea08a53c75b7ae15 | LiquidityC/aoc | /2019/day_08/imageparser.py | UTF-8 | 1,196 | 3.359375 | 3 | [] | no_license | import sys
def part1(data, width=25, height=6) :
layers = []
layer = []
count = 0
for c in data:
layer.append(int(c))
count += 1
if count == 25 * 6:
count = 0
layers.append(layer)
layer = []
minZeros = 450000
zeroLayer = []
for l... | true |
4a3dbaf1e84363ce4c5ee3d74fbef88a816eb330 | LanceVan/Coursera | /algo-008/question3/kargerMinCut.py | UTF-8 | 1,937 | 3.1875 | 3 | [] | no_license | import copy
import random
def openFile(filename):
with open(filename) as infile:
adjList = [[0], ]
for line in infile.readlines():
tmpList = []
elements = line.split('\t')
elements.pop()
tmpList = [int(element) for element in elements]
tmp... | true |
971e13a5bbc532b9319006150f97fd49af3bb7f7 | swharden/pyABF | /dev/python/2018-07-04 atfReader.py | UTF-8 | 846 | 2.578125 | 3 | [
"MIT"
] | permissive | from imports import *
if __name__ == "__main__":
sweep = 0
channel = 0
# load ABF data with pyABF
abf = pyabf.ABF(PATH_DATA+"/model_vc_step.abf")
abf.setSweep(sweep, channel)
# load ABF data which was converted to ATF
atfFname = abf.abfFilePath.replace(".abf",".atf")
assert (os.path.... | true |
14386da7401b7d51e938f23085ed1e94808724b1 | XiongQiuQiu/leetcode-slove | /Algorithms/645-Set-Mismatch.py | UTF-8 | 964 | 3.578125 | 4 | [] | no_license | '''
The set S originally contains numbers from 1 to n. But unfortunately, due to the data error, one of the numbers in the set got duplicated to another number in the set, which results in repetition of one number and loss of another number.
Given an array nums representing the data status of this set after the error.... | true |
9e0b6812f0deff7ac7a4ae3c48e5aa7b6c118626 | rmcgibbo/charm22starvalidation | /lib/tempdir.py | UTF-8 | 385 | 2.859375 | 3 | [
"BSD-3-Clause"
] | permissive | import os
import tempfile
import shutil
import contextlib
@contextlib.contextmanager
def temporary_directory():
"""A context manager which changes the working directory to a
temporary directory, then cleans it up and cds back
"""
prev_cwd = os.getcwd()
tempdir = tempfile.mkdtemp()
os.chdir(temp... | true |
b354249654564594c4604fe6d44cabe3bf3d8ad4 | presmerats/GNN-MThesis | /src/girvan-newman/TFM_node_betweenness_training.py | UTF-8 | 47,197 | 2.578125 | 3 | [] | no_license | import os
import importlib
import time
import pickle
import traceback
import math
from datetime import datetime
import json
from IPython.display import display, HTML
import pandas as pd
import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import gridspec
import torch
import torch.... | true |
20eda4b0aea7b98ae9f363a047c01764b557e90e | romaaraujo/Urna-Eletronica | /urn4.py | UTF-8 | 9,179 | 2.515625 | 3 | [] | no_license | #--------------------------------------------------#
from PyQt5 import QtWidgets, uic, QtCore, QtGui
import sys, time
#--------------------------------------------------#
#
# URNA ELETRÔNICA
# PROJETO: INTRODUÇÃO À PROGRAMAÇÃO
# ALUNOS: ROMÁRIO ARAÚJO E ALESSON ALVES
#
#-----------... | true |
7f12e9373cc8e5d94aa0a5a354125b2e68e32194 | Rayraegah/warui | /src/warui.py | UTF-8 | 1,069 | 3.171875 | 3 | [
"BSD-3-Clause"
] | permissive | # coding: utf-8
import sys
import automata
from matcher import Matcher, get_words
if sys.version_info[0] >= 3:
unicode = str
def warui(lang, term, k=1):
"""Find bad words that matches input
Args:
lang: Language code such as en, es, fr, jp
term: Input word
k: Maximum edit distance
Y... | true |
17bee753ff6542c7ad6c3e4bbb77965a951f0789 | DanZanoria/python-challenge | /PyBank/main.py | UTF-8 | 1,335 | 3.34375 | 3 | [] | no_license | #allows us to to go through the files without issues
import os
#will be needed to calculate the mean easier
# import pandas as pd
#allow us to work with the csv file with budget_data
import csv
budgetcsv = os.path.join('Resources', 'budget_data.csv')
#defining the data in budget_data.csv
monthcounter = 0
incomesu... | true |
a56721636a884395b05edbafa77f6ec2096c2bdd | jagielski/PEulerCode | /p039.py | UTF-8 | 614 | 3.359375 | 3 | [] | no_license | def euclidean(a,b):
if a*b==0:
return a+b
elif a<b:
return euclidean(b,a)
else:
c = a%b
return euclidean(b,c)
print(euclidean(4,1))
triplects = [0]*1001
n=1
while n*n<250:
m = n+1
while m*(m+n)<=500:
print(m,n)
if euclidean(m,n)==1 and (m-n)%2==1:
... | true |
a60ab2d83df9ef72b5df47b87e10eb05ff2fe385 | jopotochny/SURE | /BasicCNN.py | UTF-8 | 5,295 | 2.515625 | 3 | [] | no_license | from builtins import range
from ple.games.pong import Pong
from ple import PLE
import os
import argparse
import random
from collections import namedtuple
import pygame
import math
import sys
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from pygame import surfarray, key, event, display, time, ... | true |
8112a59106b68b3e19d54c02af73b6ac4d17c419 | yiranyyu/Phrase-Grounding | /util/argparse.py | UTF-8 | 2,218 | 2.640625 | 3 | [] | no_license | import argparse
import re
from util.config import Config
class ConfigAction(argparse.Action):
def __call__(self, parser, args, path, **kwargs):
"""
Parse and combine command line options with a configuration file if specified.
:param **kwargs:
:param parser:
:param args:
... | true |
26984db0bed839f7a78c4696b933ef79caa5e275 | Uranium2/Predimmo | /src/web/django/mysqlcon.py | UTF-8 | 2,162 | 2.515625 | 3 | [] | no_license | import pymysql
def get_conn():
""" Get a connection to the RDS database
Returns:
pymysql.connect: Connection to the RDS database
"""
return pymysql.connect(
host='predimodbinstance.cbiog1ld7y5x.eu-west-1.rds.amazonaws.com',
db='predimmo',
user='admin',
password=... | true |
b902c2256294bd332eb9f60809a9da85acf40501 | ludwig-ai/ludwig | /tests/ludwig/modules/test_normalization_modules.py | UTF-8 | 2,079 | 2.734375 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | from typing import Optional
import pytest
import torch
from ludwig.modules.normalization_modules import GhostBatchNormalization
BATCH_SIZE = 16
OUTPUT_SIZE = 8
@pytest.mark.parametrize("virtual_batch_size", [None, BATCH_SIZE // 2, BATCH_SIZE - 14, BATCH_SIZE - 10])
@pytest.mark.parametrize("mode", [True, False]) ... | true |
e5f05f86b82752a346db8855ec4183c2c63a4d70 | Xiafang001/Stocktest | /stock/login/views.py | UTF-8 | 3,494 | 2.53125 | 3 | [] | no_license | '''Login.views Supports all the user authentication and login and registering process'''
from django.shortcuts import render_to_response, render, redirect
# Takes care of all the basic login, authenticizing and login process for tokenization
from django.contrib.auth import login, logout, authenticate
# The in-built dja... | true |
028ba4ac63e2783bba430c433031ca5a77df11db | matematikaadit/happybite | /python/p016.py | UTF-8 | 131 | 3.515625 | 4 | [
"MIT"
] | permissive | # Power digit sum
#
# What is the sum of the digits of the number 2^1000
print(sum(int(n) for n in str(2**1000)))
# output: 1366
| true |
13a1da13e2ce4d346eaec8e50b5f4ee2ab2e61c2 | DavidMendoza5/saving-files | /ProgramingBasics/test.py | UTF-8 | 1,448 | 4.4375 | 4 | [] | no_license | print("Hello world") #Hello world
print("Don't do that") #Don't do that
print('She said "I want this"') #She said "I want this"
print("She said 'I want this'") #She said 'I want this'
print('She said "Don\'t do that"') #She said "Don't do that"
print("Hello, " + "David") #Hello, David
print("This costs " + str(6) + " b... | true |
7bc8ed90292c8321ba4ff28ade9291649fa3bd61 | sudharshanbv/LPHW | /exe21.py | UTF-8 | 556 | 4.40625 | 4 | [] | no_license |
def add(a, b):
print(f"Adding {a} and {b}")
return a+b
def sub(a, b):
print(f"Subtracting {b} from {a}")
return a - b
def mul(a, b):
print(f"Multiplying {a} and {b}")
return a * b
def div(a, b):
print(f"Dividing {a} by {b}")
return a / b
age = add(30, 5)
hei... | true |
e10ff127f92058dcbc0471ad394c1e780611d843 | gabriellaec/desoft-analise-exercicios | /backup/user_216/ch46_2020_09_23_20_45_12_015567.py | UTF-8 | 157 | 3.171875 | 3 | [] | no_license |
def numero_no_indice(lista):
nova_lista = []
for e,i in enumerate(lista):
if e == i:
nova_lista.append(i)
return nova_lista
| true |
028087be9b56445fc8ffbc0c38f099af49b53f27 | boonchu/python3lab | /dicts/filter_sender.py | UTF-8 | 559 | 2.6875 | 3 | [] | no_license | #! /usr/bin/env python
fname = raw_input("Enter file name: ")
if len(fname) < 1 : fname = "mbox-short.txt"
fh = open(fname)
count = 0
senders = dict()
for line in fh:
line = line.rstrip()
if not line.startswith('From ') : continue
words = line.split()
sender = words[1].rstrip()
senders[sender] =... | true |
43bb3d4809f25b9d02da701d7a584725180ee6b3 | b4rryw4ng/AI_Go_Bang | /insert.py | UTF-8 | 144 | 3.140625 | 3 | [] | no_license | a = [1,5,9,10,14,65,85,95,105]
ID = 99
for index, i in enumerate(a):
if i > ID:
a.insert(index, ID)
break
print (a) | true |
08674ac2829e87dd51a5c491aaec24e77507025b | artfin/wave_prop | /DIATOM/other/test.py | UTF-8 | 373 | 2.96875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
NPoints = 100
T = 2250 # sampling time
x = np.linspace( 0, NPoints * T, NPoints )
#print(x)
signal = np.sin( x )
#print(signal)
signal_f = abs(np.fft.fft(signal))**2
print(signal_f)
freqs = 2 * np.pi * np.linspace( 0.0, 1.0 / (2.0 * T), NPoints/2 )
#print(freqs)
... | true |
3ba22809be9346d5523ba9fca00302d7ca7e74d6 | VukGlisovic/gcp | /bigquery/client.py | UTF-8 | 5,517 | 2.9375 | 3 | [] | no_license | import logging
from google.cloud import bigquery
from google.api_core.exceptions import Conflict, BadRequest
logging.basicConfig(level=logging.INFO)
class Bigquery(object):
def __init__(self, project_id, location, dataset_id):
"""Will instantiate a Bigquery class with which you can create datasets,
... | true |
fa0ed45610c27fc9165cc474f322baa28bac06b5 | jpbburns/Wi2018-Classroom | /students/jim/Lesson12/toy_closure.py | UTF-8 | 202 | 3.09375 | 3 | [] | no_license | import functools
def closure(message_one):
def inner_function(num):
for i in range(num):
print(i)
return inner_function
foo = closure("hi there")
bar = closure("snoo")
| true |