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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
77ea704382fd2fa85224e2e4d9d40134081b368f | Python | tsarg88/python_code_challenges | /search.py | UTF-8 | 448 | 4.5625 | 5 | [] | no_license | # Create a function that searches for the index of a given item in a list. If the item is present, it should return the index, otherwise, it should return -1.
# Example:
# search([1, 2, 3, 4], 3) ➞ 2
# search([2, 4, 6, 8, 10], 8) ➞ 3
# search([1, 3, 5, 7, 9], 11) ➞ -1
def search(lst, item):
return lst.index(item) if ... | true |
bab280cccbb0c981bf5025fb0f628881e541648d | Python | cctbx/cctbx_project | /xfel/clustering/cluster.py | UTF-8 | 40,855 | 2.859375 | 3 | [
"BSD-3-Clause-LBNL"
] | permissive | """ This module is designed to provide tools to deal with groups of serial
crystallography images.
The class Cluster allows the creation, storage and manipulation of these sets
of frames. Methods exist to create sub-clusters (new cluster objects) or to act
on an existing cluster, e.g. to plot the unit cell distributio... | true |
3cc74523ad3f94c2840837641ab8c29ecbfe1cda | Python | tkieft/adventofcode-2019 | /day07/day07.py | UTF-8 | 2,111 | 3.140625 | 3 | [] | no_license | import copy
import itertools
import sys
def run(program):
pc = 0
input = None
output = None
def parameter(index):
return program[pc + index] \
if program[pc] // (10 ** (index + 1)) % 10 \
else program[program[pc + index]]
while True:
opcode = program[pc] % ... | true |
52d10d5f9bdd6ddf521a80ef4827ccc5df0c8466 | Python | Aasthaengg/IBMdataset | /Python_codes/p03559/s722568114.py | UTF-8 | 319 | 2.890625 | 3 | [] | no_license | import bisect
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
ans = 0
i = 0
j = 0
for b in B:
while i < N and A[i] < b:
i += 1
while j < N and C[j] <= b:
j += 1
ans += i * (N-j)
print(ans) | true |
4a8b86bc5ea0a3aa366abf782200f0c541158387 | Python | walkowskis/CosIng_database_finder | /update.py | UTF-8 | 2,700 | 2.6875 | 3 | [] | no_license | import sqlite3
import csv
import urllib.request
import os
from datetime import date
from tkinter import *
today = str(date.today())
class Updating:
def __init__(self, db):
self.conn = sqlite3.connect(db)
self.cur = self.conn.cursor()
def update(self):
# Download CSV file
url... | true |
ace627739ae7cbfe4e5bc6722948127e5bcb7338 | Python | fomightez/sequencework | /Extract_from_FASTA/extract_subsequence_from_FASTA.py | UTF-8 | 16,943 | 3.34375 | 3 | [] | no_license | #!/usr/bin/env python
# extract_subsequence_from_FASTA.py
__author__ = "Wayne Decatur" #fomightez on GitHub
__license__ = "MIT"
__version__ = "0.1.0"
# extract_subsequence_from_FASTA.py by
# Wayne Decatur
# ver 0.1
#
#*******************************************************************************
# Verified compatib... | true |
9c306819fce72093165a361ce25203f516d973dc | Python | pollomarzo/learNN | /teo/tf_fakenews/src/cnn_blstm.py | UTF-8 | 3,560 | 2.875 | 3 | [] | no_license | """
Implements a BLSTM convolutional neural network.
Based on modelwrapper to avoid unnecessary confusion, only overrides build method
_________________________________________________________________
Layer (type) Output Shape Param #
===================================================... | true |
c7744f5650ba958bd05c12213222555e49e22a40 | Python | avadhutthakar/HackITVI | /Main.py | UTF-8 | 905 | 2.546875 | 3 | [] | no_license | import os, sys
# We'll render HTML templates and access data sent by POST
# using the request object from flask. Redirect and url_for
# will be used to redirect the user once the upload is done
# and send_from_directory will help us to send/show on the
# browser the file that the user just uploaded
from flask import Fl... | true |
ed8ca56d489251411e2bdf1ff734ee61b07fa5ac | Python | Gandalav/Cloud | /Cloud_Extra/Wikipedia Analysis/1.1-Sequential Analysis/filterdata.py | UTF-8 | 1,339 | 3.046875 | 3 | [] | no_license | #Python program to filter unwanted lines
#author: Sparshith Puttaswamy Gowda
f = open("pagecounts-20140701-000000", "r")
w = open("output.txt", "w")
#create lists with filtering string conditions
bp = ["404_error/", "Main_Page", "Hypertext_Transfer_Protocol", "Favicon.ico", "Search"]
ext = [".jpg", ".gif", ".... | true |
61cfb0313524688c0dd94f4d362ed0ed8005b584 | Python | marc22alain/G-code-repositories | /option_queries/OptionQuery_class.py | UTF-8 | 440 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
import abc
class OptionQuery:
__metaclass__ = abc.ABCMeta
def __init__(self):
pass
def getHint(self):
return self.hint
def getValue(self):
return self.value
def setValue(self, value):
assert type(value) == self.variable_type, 'Query value m... | true |
72d60ac489bf4e150fe4b10c859df0e5031ed6d3 | Python | fabsnimitti/induction_machine_model | /codes/SC_RF.py | UTF-8 | 1,843 | 2.65625 | 3 | [] | no_license | from sympy import *
import math
import matplotlib.pyplot as plt
pi=math.pi
N=2
Rs=.8467
Rr=.5176
Lm=66.0391/(2*pi*60)
Lls=2.1750/(2*pi*60)
Llr=2.5067/(2*pi*60)
Ls = Lls+Lm
Lr = Llr+Lm
J=0.0698
Bn = 0.015
P=2
sigma=1-(Lm**2)/(Ls*Lr)
neta=Rr/Lr
beta=Lm/(sigma*Ls*Lr)
gama=Rs/(sigma*Ls)+beta*neta*Lm
... | true |
d55faf652d8f6ade104ccb8bc92c319398cc685f | Python | astralking-infinity/pusoy_dos | /main.py | UTF-8 | 6,319 | 3.484375 | 3 | [] | no_license | #!/usr/bin/python3.6
"""pusoy_dos.py
Pusoy Dos or Filipino Poker
"""
import sys
from functools import partial
from pprint import pprint
import card
from validation import verify_combination, is_higher
from player import Player, ActivePlayer
# Pusoy dos (Filipino Poker)
# Rules:
# -> Suits ranking (from highest t... | true |
b65b75200080e49c5f6aadbbd874a740acb3a218 | Python | acaciooneto/cursoemvideo | /ex_videos/ex-002.py | UTF-8 | 103 | 3.46875 | 3 | [] | no_license | nome = input('Olá, digite aqui o seu nome: ')
print('É um prazer te receber aqui, {}!'.format(nome))
| true |
ede5f0f7c964bd5fc8d6fb34a40e64e967d0cbda | Python | adrianosantospb/unifacisa-visao-computacional | /modulo2/5-publicacao/5.1-cliente/cliente/cliente.py | UTF-8 | 1,937 | 2.6875 | 3 | [
"MIT"
] | permissive | from __future__ import print_function
import requests
import json
import cv2
import jsonpickle
from datetime import datetime
import argparse
# TODO: Refactor this code
server_address = 'http://localhost:8081'
test_url = server_address + '/api/predict'
color = (0,255,0)
parser = argparse.ArgumentParser()
opt = parse... | true |
96b56297ca934c7bc8e6fd786a33380ecbe76413 | Python | cetusmira/totally_easy_python | /9장 프로젝트 소스/project_6-4.py | UTF-8 | 569 | 3.265625 | 3 | [] | no_license | #project_6-4.py
import matplotlib.pyplot as plt
from matplotlib import font_manager, rc
from pylab import axis
import numpy as np
kr_font = font_manager.FontProperties(fname="c:/Windows/Fonts/malgun.ttf").get_name()
rc('font', family=kr_font)
x = np.arange(-5, 5, 0.01)
def f(x):
'''y 좌표(이차함수 y = x**2 + 3*x + 1) ... | true |
dc1a3026161654d8ba4e97a61c12e10dd06ed97c | Python | jasnanaz/pythonbasics | /palindrome.py | UTF-8 | 38 | 3.234375 | 3 | [] | no_license | a=input("enter a string")
rev=a[::-1]
| true |
01aa6b847812f2e95029b15fa22497dc476ac191 | Python | jamiejamiebobamie/CS-2.2-Advanced-Recursion-and-Graphs | /challenges/challenge4/part1.py | UTF-8 | 1,925 | 4.09375 | 4 | [
"MIT"
] | permissive | def driver_function(W , wt , val , n):
"""The driver function for possible memoization dictionary storage.
DID NOT IMPLEMENT MEMOIZATION FOR THIS FUNCTION.
"""
def knapsack(W , wt , val , n):
""" Code copied from:
https://www.geeksforgeeks.org/0-1-knapsack-problem-dp-10/
... | true |
723bb8afeb01771a0420fd543c8185df848738f9 | Python | natalka1122/glpi-telegram-bot | /bot/app/quote_generator.py | UTF-8 | 588 | 3.40625 | 3 | [] | no_license | """Genetate random quote
"""
import json
import typing
import requests
def get_quote() -> str:
"""Get random quote from https://forismatic.com
Returns:
str: random quote
"""
url: str = "http://api.forismatic.com/api/1.0/?method=getQuote&format=json&lang=ru"
response: typing.Dict = json.lo... | true |
6b9c64d411f180081aa804099e9b5647ed051457 | Python | evennia/evennia | /evennia/contrib/base_systems/components/__init__.py | UTF-8 | 952 | 2.765625 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | """
Components - ChrisLR 2022
This is a basic Component System.
It allows you to use components on typeclasses using a simple syntax.
This helps writing isolated code and reusing it over multiple objects.
See the docs for more information.
"""
from evennia.contrib.base_systems.components.component import Component
f... | true |
9ebf0fdfa254b3dae19c16bccade8c006da2a6cf | Python | dalonsoa/gooey_example | /src/main.py | UTF-8 | 612 | 3.1875 | 3 | [
"MIT"
] | permissive | import argparse
from gooey import Gooey
@Gooey
def main():
parser = argparse.ArgumentParser(description="Process some integers.")
parser.add_argument(
"integers",
metavar="N",
type=int,
nargs="+",
help="integer values for the accumulator",
)
parser.add_argument(... | true |
bd7ef3281a570e45c023bb95565f94d2b6752825 | Python | XRarach/bollinger | /portfolio-value.py | UTF-8 | 1,375 | 3.546875 | 4 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
def get_data(symbol):
df = pd.read_csv('./{}.csv'.format(symbol), index_col='Date',parse_dates=True,
usecols=['Date', 'Close'], na_values=['nan'])
df = df.rename(columns={'Close': symbol})
return df
def daily_re... | true |
84ac73bce75275dd2fd17ca5b0aab722e8f1c2ff | Python | wp-19971028/l_python | /网络基础/线程/it_06_多线程-共享全局变量.py | UTF-8 | 467 | 3.34375 | 3 | [] | no_license | import threading
import time
g_num = 100
def work1():
global g_num
for i in range(3):
g_num += 1
print("----in work1, g_num is %d---" % g_num)
def work2():
global g_num
print("----in work2, g_num is %d---" % g_num)
print("---线程创建之前g_num is %d---" % g_num)
t1 = threading.Thread(ta... | true |
852302108a38a82d499dcfc7fa5cfd1a351bee1f | Python | C4RoCKeT/thememapper.core | /thememapper/core/model/theme.py | UTF-8 | 4,501 | 2.578125 | 3 | [] | no_license | import os
class _ThemeModel:
def __init__(self,settings):
self.settings = settings
def get_themes(self,root_dir=None):
if root_dir is None:
root_dir = self.settings['themes_dir']
themes = []
for dirname, dirnames, filenames in os.walk(root_dir):
... | true |
d30e6ce0e2e54e414f8727d7a230d153c6e0ddb4 | Python | namhoang1999/personal-rep | /approximation_test.py | UTF-8 | 10,267 | 3.0625 | 3 | [] | no_license | import numpy as np
def generate_approximation(sbox_):
"""generate full bias from S-box"""
approx = np.zeros((16,16))
for x in range(16):
for y in range(16):
count = 0
for i in range(16):
a = i&x ^ sbox_[i]&y
f = 0
while a > 0:... | true |
449f0606c212afa8bd8e90cca1338c2c0542719f | Python | hdwhite/advent-of-code-2020 | /day23/part1.py | UTF-8 | 379 | 3.421875 | 3 | [] | no_license | def mod9(i):
if i == 1: return 9
else: return i-1
cups = [5, 3, 8, 9, 1, 4, 7, 6, 2]
for i in range(100):
print(cups)
destination = mod9(cups[0])
while destination in cups[1:4]: destination = mod9(destination)
for j in range(3):
num = cups.pop(1)
cups.insert(cups.index(destinati... | true |
657f7d0b09038b57f03b9c572b06f7147134a7b6 | Python | cash2one/xai | /xai/brain/wordbase/verbs/_string.py | UTF-8 | 422 | 2.53125 | 3 | [
"MIT"
] | permissive |
#calss header
class _STRING():
def __init__(self,):
self.name = "STRING"
self.definitions = [u'to put strings on a musical instrument: ', u'to put new strings onto a racket used in sport: ', u'to put a string through a number of objects: ']
self.parents = []
self.childen = []
self.properties = []
self.... | true |
716dbeb30135c54186e2a21ac73223920e000a2a | Python | ToFgetU/Python3 | /Day06/继承.py | UTF-8 | 556 | 3.359375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author: PanFei Liu
class F1:
def __init__(self):
print('F1')
def a1(self):
print('F1a1')
def a2(self):
print('F1a2')
class F2(F1):
def __init__(self):
print('F2')
def a1(self):
self.a2()
print('F2a... | true |
469153744a05dc1c49ff02e80a46fbbc7d495120 | Python | GE0001/fileOrganiser | /confLogger.py | UTF-8 | 3,190 | 2.859375 | 3 | [] | no_license | import os
#import os.path
# This code is buggy and needs to be looked into.
# The functions are disabled pending review.
# in the meantime the following needs to be in place ( by hand ) for the program to work:
# 1) a file in /etc/logrotate.d/moveRec
# with the following configuration:
#
# ... | true |
afedc16726f95988b0a5f9a4be88126346500b60 | Python | kentandogit/dodgeball | /app.py | UTF-8 | 3,498 | 3.078125 | 3 | [] | no_license | import pygame
from player import Player
from enemy import Enemy
from random import randint, choice, randrange
from button import Button
from sprite import *
pygame.init()
winWidth = 800
winHeight = 600
playerSize = 16
enemySize = 64
bgY = 0
bgY2 = 0
win = pygame.display.set_mode((winWidth, winHeight))
... | true |
daff776c44c373cc2620993cc7be94d9a4edfaa0 | Python | shengyu7697/learn-python | /PyQt5_tutorial/dropcsv.py | UTF-8 | 5,123 | 2.609375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import sys
import os
from PyQt5.QtCore import pyqtSignal, QMimeData, Qt
from PyQt5.QtGui import QPalette, QPixmap
from PyQt5.QtWidgets import (QAbstractItemView, QApplication, QDialogButtonBox,
QFrame, QLabel, QPushButton, QTableWidget, QTableWidgetItem,
QVBoxLayout, QWidget, QHe... | true |
eeb92dcbd37a2d6f3f1ab022e0634a90cf7547f1 | Python | TaeYeon-kim-ai/STUDY_1.py | /dacon/sun/sun_light_model3_LSTM.py | UTF-8 | 7,504 | 2.890625 | 3 | [] | no_license | #자르기 - 2일 골라내기 - 예측 /// 7일될때마다 2개씩 골라내기
import numpy as np
import pandas as pd
from tensorflow.keras.models import Sequential, Model, load_model
from tensorflow.keras.layers import Dense, LSTM, Input, Dropout, Conv1D, MaxPooling1D, Flatten, concatenate, Reshape
from sklearn.preprocessing import MinMaxScaler
import ma... | true |
b704201907377d243aa8301a3c3847231460ca6a | Python | NuXareon/CDI | /L218-Millas.py | UTF-8 | 52 | 2.53125 | 3 | [] | no_license | from math import pi
L = len("Albert Millas Roura")
print(pi**L) | true |
f16c7688c11169fe5aafd565dc3bcefa0b6ee654 | Python | Kimuda/Phillip_Python | /while_loops/loops11.py | UTF-8 | 124 | 3.515625 | 4 | [] | no_license | names=input('enter a list of names')
counter=0
while names!="":#while data is not a space
if names=="":
break
| true |
fa130e77dd3f16ef4703156ff7238b24c5b1e99b | Python | BinghaiYan/Phonopy-Spectroscopy | /SpectroscoPy/Interfaces/VASP.py | UTF-8 | 13,929 | 2.984375 | 3 | [
"MIT"
] | permissive | # SpectroscoPy/Interfaces/VASP.py
# ---------
# Docstring
# ---------
""" Routines for interfacing with the Vienna Ab-initio Simulation Package (VASP) code. """
# -------
# Imports
# -------
import math;
import re;
import numpy as np;
# ------------
# POSCAR Files
# ------------
""" Default title line for POS... | true |
be5d529e8edb2cb9459c8d9b0a26b885329230db | Python | RomainGehrig/AdventOfCode | /2015/day9/travel.py | UTF-8 | 957 | 3.390625 | 3 | [] | no_license | import re
from itertools import permutations
f = open("input.txt", "r")
lines = f.readlines()
dist = re.compile("([A-Za-z]+) to ([A-Za-z]+) = (\d+)")
distances = {}
places = set()
def add_distances(place1, place2, dist):
k = sorted([place1, place2])
places.add(place1)
places.add(place2)
distances[tu... | true |
1900f1076f38a8a58c6e09f3c7d5fb8e0d13d52f | Python | lexxpino/math260 | /hw8/hw8.py | UTF-8 | 5,777 | 3.390625 | 3 | [] | no_license | import numpy as np
from numpy.random import uniform, rand
from scipy import sparse
import matplotlib.pyplot as plt
def stationary(pt, alpha=0.9):
"""Power method to find stationary distribution.
"""
x = rand(pt.shape[0]) # random initial vector
x /= sum(x)
pt = alpha * pt
for it in range(1000... | true |
d066cf48f2a6a6ac84bcad95500ee1390c0db6ec | Python | Deliwu/djangouse | /sites/polla/templatetags/mytags.py | UTF-8 | 438 | 2.59375 | 3 | [] | no_license | from django import template
register = template.Library()
@register.filter(name='Lower') # 注册一个过滤器,名字为Lower
def lower(text):
return text.lower()
@register.filter
def question_choice_count(question): # 这里过滤器没有,则函数名就是过滤器的名字
return question.choices.count()
@register.filter
def question_choice_add(questio... | true |
d4b71df835af1c7be652b278a3a9df392f9ee5f9 | Python | aquafilly/operation-code-examples | /python-camera/02-hsv.py | UTF-8 | 293 | 2.578125 | 3 | [] | no_license | from cam import stream
from window import show_horizontal_stack_images
import cv2
def convert_from_rgb_to_hsv(img):
#convert to HSV
hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
#show window
show_horizontal_stack_images('RGB -> HSV', [img, hsv])
stream(convert_from_rgb_to_hsv)
| true |
7a531f77559cf79e3d39e38d43bfdabf61efc9c4 | Python | Aasthaengg/IBMdataset | /Python_codes/p02608/s927184255.py | UTF-8 | 227 | 3.34375 | 3 | [] | no_license | #C
n = int(input())
f = [0 for _ in range(10**5)]
for i in range(1,105):
for j in range(1,105):
for k in range(1,105):
f[i**2 + j**2 + k**2 + i*j + j*k + k*i] += 1
for l in range(n):
print(f[l+1]) | true |
d6cd5840857c937f39fd2db9ed99051b9d457443 | Python | jabhij/DAT208x_Python_DataScience | /MATPLOTLIB/LAB2/L4.py | UTF-8 | 213 | 2.96875 | 3 | [] | no_license | You're a professor teaching Data Science with Python, and you want to visually assess if the grades on your exam follow a normal
distribution. Which plot do you use?
Line plot
Scatter plot
Histogram (CORRECT)
| true |
4376e977df9a66e8cd7b1ff2e4d00d0101c434b4 | Python | behnazsheikhi/MachineLearningCodes_Python | /sampleCodes/preprocessin_dataset.py | UTF-8 | 3,782 | 3.390625 | 3 | [] | no_license | # F lesson
# preprocessing پیش پردازش اطلاعات
# اطلاعات را آماده میکنیم تا برای پردازش استفاده کنیمتا به استفاده از الگوریتم های ماشین لرنینگ از آنها استفاده می کنیم به مرحله آماده سازی داده ها preprocessing میگویند
# scikit learn این پکیجی هست که الگوریتم های machine learning هم در آن قرار دارد
# simple and effi... | true |
4a3f604756b2d99469cc11b647dfded680010241 | Python | syuuenn/hispython | /2019/longwork/201963/work4.py | UTF-8 | 272 | 3.84375 | 4 | [] | no_license | # 一个整数,它加上100后是一个完全平方数,再加上268又是一个完全平方数,请问该数是多少?
import math
for i in range(10000):
x=int(math.sqrt(i+100))
y=int(math.sqrt(i+268))
if (x**2==i+100)and(y**2==i+268):
print(i)
| true |
9b0f23165f4a3ff037f58c4cb81f5a511f4d0f8b | Python | CvetanovicNikola/RainyNightTextAdventure | /frontend.py | UTF-8 | 4,011 | 3.125 | 3 | [] | no_license |
from tkinter import *
from PIL import ImageTk
import PIL.Image
import whGame
import time
from io import StringIO
import os
import sys
def play():
window.destroy()
whGame.start_screen()
def help():
content = """\nWelcome to the Rainiy night,
this is a textual adventure game
... | true |
f9f78eb119fb78a2b84054f0de150048f78481d8 | Python | TheAlgorithms/Python | /graphs/page_rank.py | UTF-8 | 1,477 | 3.71875 | 4 | [
"MIT"
] | permissive | """
Author: https://github.com/bhushan-borole
"""
"""
The input graph for the algorithm is:
A B C
A 0 1 1
B 0 0 1
C 1 0 0
"""
graph = [[0, 1, 1], [0, 0, 1], [1, 0, 0]]
class Node:
def __init__(self, name):
self.name = name
self.inbound = []
self.outbound = []
def add_inbound(self... | true |
7947dd9adfc39e73e897bfccfc706cb063de3b0d | Python | MVG8/parsing | /homework_5.py | UTF-8 | 6,312 | 2.953125 | 3 | [] | no_license | """
1) Написать программу, которая собирает входящие письма из своего или тестового почтового ящика
и сложить данные о письмах в базу данных (от кого, дата отправки, тема письма, текст письма полный)
Логин тестового ящика: study.ai_172@mail.ru
Пароль тестового ящика: NextPassword172!?
"""
from selenium import web... | true |
94094f47121660bca255cb2212576c1cbe47a174 | Python | ShowLo/LeetCode_code | /python/problem67.py | UTF-8 | 1,415 | 3.453125 | 3 | [] | no_license | class Solution(object):
def addBinary(self, a, b):
"""
:type a: str
:type b: str
:rtype: str
"""
aLen = len(a)
bLen = len(b)
carry = 0
result = []
for i in range(min(aLen, bLen)):
aDigit = a[aLen - 1 - i]
bDigit... | true |
bf89e0fe0656dbb0a622689463cbc6e7521463d0 | Python | mofostopheles/dev | /python/minecraft/hp4.py | UTF-8 | 2,033 | 2.59375 | 3 | [] | no_license | from mcpi import minecraft
import math
import random
mc = minecraft.Minecraft.create()
mc.postToChat('mindcraft')
x, y, z = mc.player.getPos()
stone = 1
grass = 2
fence = 85
air = 0
glowstone = 89
netherack = 87
gridwidth = 15
newz=0
newx = 0
##make a road...
for x1 in range(0, 200):
mc.setBlock(x+x1, y,... | true |
8a2f6d756ea3adcccc2538beb958599056ce537e | Python | beagleboard/cloud9-examples | /BeagleBone/Green/Grove/Software/Python/Grove_dht.py | UTF-8 | 3,400 | 2.953125 | 3 | [
"MIT"
] | permissive | import time
import Adafruit_BBIO.GPIO as GPIO
Debug = True
class DHT():
global Debug
def __init__(self, pin, type = "DHT22", count = 6):
self._pin = pin
self._type = type
self._count = count
self.firstreading = True
self.MAXTIMINGS = 85
self._lastreadtime = int(... | true |
c79a8afb933339c1c5da6fcf88cbf2bd3824ea71 | Python | griffs37/CA_318 | /python/8314.sol.py | UTF-8 | 725 | 3.734375 | 4 | [] | no_license | #
# In this exercise, find the smallest number of coins to make up the specified amount
# using dynamic programming.
#
# return the memo that you create as a result
#
import math
def dp_make_change(amount, coins):
assert amount >= 0
# Initialise memo to be infinity for each of amount + 1 values
memo = ... | true |
e496acf294005540bb7a802cad39537ec1c88ed7 | Python | alibaba/footmark | /footmark/resultset.py | UTF-8 | 491 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | """
Exception classes - Subclassing allows you to check for specific errors
"""
StandardError = Exception
class ResultSet(object):
"""
General Footmark Client error (error accessing Aliyun)
"""
def __repr__(self):
return 'ResultSet:%s' % self.id
def __getattr__(self, name):
if n... | true |
6c7d667b12327f2902e4b969ad050ef649087bd4 | Python | MagicCubeProject/MagicCubeLib | /tests/test_mcube.py | UTF-8 | 340 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | import unittest
from rcube.MagicCube import MCubeState
from rcube.MagicCubeFlags import MCubeSide
class MCubeStateTest(unittest.TestCase):
def test_mcube_init(self):
mc = MCubeState()
print(mc)
if __name__=="__main__":
mc = MCubeState()
print(mc)
nmc = mc.get_rotated_state(MCubeSide.FR... | true |
cf3459293407d7fcdf3f12fe210b31797907482c | Python | Dumitrescu-Alexandru/Reinforcement-learning | /rl_ex3/pdf/final/qlearning_lunar.py | UTF-8 | 3,217 | 2.59375 | 3 | [] | no_license | import gym
import numpy as np
from matplotlib import pyplot as plt
np.random.seed(123)
env = gym.make('LunarLander-v2')
env.seed(321)
episodes = 20000
test_episodes = 10
num_of_actions = 4
# Reasonable values for Cartpole discretization
discr = 16
x_min, x_max = -2.4, 2.4
v_min, v_max = -3, 3
th_min, th_max = -0.3,... | true |
46322ef0a90683649ebac0d55c4547443c93e280 | Python | Arnukk/BioInformatics | /Lab 3/Dunn.py | UTF-8 | 2,017 | 2.921875 | 3 | [] | no_license | __author__ = 'akarapetyan'
from scipy.cluster.hierarchy import linkage, dendrogram
from scipy.spatial.distance import squareform
import matplotlib.pyplot as plt
import numpy as np
def clusterDistances(cluster1, cluster2, DM):
return DM[cluster1][:, cluster2].mean()
def Dunn(clustering, DM):
clusters = len(c... | true |
1ec0c5985dd0e58a82502581d6f6f6e0160f91ae | Python | im-Lily/EV_Project | /Development_Source/evProject/frontApp/getApi/geocodeApi.py | UTF-8 | 1,497 | 3.078125 | 3 | [] | no_license | import requests # 서버접속
from urllib.parse import urlparse # 한글 처리
#
# url = "https://naveropenapi.apigw.ntruss.com/map-geocode/v2/geocode?"
#
# keyword="query=강동구"
# url_fin = url+keyword
#
#
# # print(keyword)
# # print(url_fin)
# # get()안에 url과 headers를 포함 할 수 있음
# result = requests.get(urlparse(url_fin).geturl()... | true |
4a2e0bd8272d14f2d1b92d668ee5f2d98f8592c4 | Python | prositen/advent-of-code | /python/src/y2018/dec20.py | UTF-8 | 1,651 | 3.28125 | 3 | [] | no_license | from collections import defaultdict, deque
from python.src.common import Day
class Dec20(Day):
DIRS = {
'N': (-1, 0),
'E': (0, 1),
'S': (1, 0),
'W': (0, -1)
}
def __init__(self, instructions=None, filename=None):
super().__init__(2018, 20, instructions, filename)
... | true |
9d0f44d6b629dd585ad4925cf93af0883c5dbd89 | Python | solitone/tic-tac-toe | /tic_tac_toe/HumanPlayer.py | UTF-8 | 2,462 | 3.828125 | 4 | [] | permissive | #######################################################################
# Copyright (C) #
# 2020 solitone (https://github.com/solitone) #
# 2018 Carsten Friedrich (Carsten.Friedrich@gmail.com). #
# ... | true |
f738f96decca5755f8bd909727f46ff92989f3ae | Python | HaniaArif/BCI_Project | /Step_3_feature_engineering/TemporalAbstraction.py | UTF-8 | 2,442 | 3.1875 | 3 | [] | no_license | import numpy as np
import pandas as pd
import scipy.stats as stats
from warnings import simplefilter
# Class to abstract a history of numerical values we can use as an attribute.
class NumericalAbstraction:
# pandas concat method doesn't work proerply yet so supress warning (see https://github.com/twopirllc/pandas... | true |
3c82affc429c0f333e50b902e48db398bfc6b271 | Python | hliuliu/smooth_optimization | /tests/poly_matrix_test.py | UTF-8 | 1,512 | 2.6875 | 3 | [] | no_license |
import os,sys
sys.path.append(
os.path.join(
os.path.dirname(__file__),
os.pardir
)
)
import poly_array as parr
import polynomial as ply
import numpy as np
poly = ply.Polynomial
pmatrix = parr.PolynomialMatrix
pvec = parr.PolynomialVector
ply.Polynomial.AUTO_SORT_VARIABLES = True
... | true |
71d43cd67d5de8b8a3af496446bd9559f32dfb18 | Python | Giselii/Exercicios_Python | /004_TestandoTiposeOutros.py | UTF-8 | 1,097 | 4.375 | 4 | [
"MIT"
] | permissive | #Faça um programa que leia algo pelo teclado e mostre na tela o seu tipo
# primitivo e todas as informaões possíveis sobre ele
#Usar os métodos .is
#OBSERVAÇÃO: Nos casos abaixo o 'a1' é um OBJETO e
#os ".is..." são os métodos.
a1 = input('Digite algo: ')
print('O tipo primitivo de {} é:'.format(a1), type(a1))
#prin... | true |
f6b139000a661098df6797ffd43e9804e5f635f7 | Python | giovanig/ros-redis | /rospackages/fisch_core/p1hc_fault_detector/scripts/get_act_udp_from_h3.py | UTF-8 | 2,149 | 2.671875 | 3 | [] | no_license | # https://docs.python.org/3/library/struct.html
# http://www.binarytides.com/programming-udp-sockets-in-python/
# https://stackoverflow.com/questions/27521637/python-ctypes-structure-wrong-byte-size
# https://stackoverflow.com/questions/4110378/python-struct-size-changed-by-alignment
import time
import socket
import... | true |
592af84cfbaea7b8fb5cb181b6d2e9bdf4291b0a | Python | lucasbflopes/codewars-solutions | /6-kyu/ideal-electron-distribution/python/solution.py | UTF-8 | 257 | 3.234375 | 3 | [] | no_license | def atomic_number(e):
f = lambda x: 2*x**2
shells = []
n = 1
while e > 0:
if e > f(n):
shells.append(f(n))
e -= f(n)
else:
shells.append(e)
e = 0
n+=1
return shells | true |
c9fbef486f1e88dfc3a29b1ec4c82c0715bcb5c7 | Python | nicolass03/networks-dev-project | /ball.py | UTF-8 | 1,732 | 3.3125 | 3 | [] | no_license | import pygame
POWER = 20
class Ball:
def __init__(self, x, y, radius, color, display_height, display_width):
self.x = x
self.y = y
self.radius = radius
self.rect = pygame.Rect(self.x, self.y, self.radius, self.radius)
self.center = (self.x, self.y)
self.color = colo... | true |
466b2899f593e39c61014f4b676fdeb6092de942 | Python | scouvreur/hackerrank | /problem_solving/algorithms/implementation/kaprekar.py | UTF-8 | 847 | 3.8125 | 4 | [
"MIT"
] | permissive | def is_kaprekar(number):
digits = len(str(number))
squared = number ** 2
digit_sum = 0
for digit in str(squared):
digit_sum += int(digit)
left_digits = str(squared)[0 : len(str(squared)) - digits]
left = int(left_digits) if left_digits != "" else 0
right_digits = str(squared)[-dig... | true |
15c029ebfc2a57929d4e29a0d193a8154c148d62 | Python | blind-eye-brainy-brain/unstructured | /atlas_ti/atlas_ti_export.py | UTF-8 | 8,851 | 2.78125 | 3 | [] | no_license | # !/usr/bin/env python
# -*- coding: utf-8 -*-
from collections import defaultdict
from scipy.stats.stats import pearsonr
# prefix_code_by_primary_doc(quotations, primary_docs, 'result/book_PD.txt', 'M-PB-Book-')
def prefix_code_by_primary_doc(data, primary_doc_names, output, prefix):
"""frequency matrix : prefi... | true |
44cf409565d5ce08be559334e8cb49650787e49b | Python | IsHYuhi/Introduction_of_Python3 | /chapter6/method.py | UTF-8 | 4,546 | 4.28125 | 4 | [] | no_license | '''
メソッドのタイプ
メソッドの第一引数がselfであればインスタンスメソッドである。普通書くタイプのメソッド
@classmethodというでコレータを入れるとその次の関数はクラスメソッドになる。
また、メソッドの第一引数は、クラス自体になり、伝統的その引数を 'cls'と呼ぶ
classが予約語で使えないため
'''
class A:
count =0
def __init__(self):
A.count +=1 #ここがselfではなくAなのでクラスそのものの数をカウントしている
def exclaim(self):
print("I'm an A!")
... | true |
a48d7260bac9436c0c776d27380cbca0cf97edde | Python | Daniela-Villanueva/1684742-MatComp | /fila_2.py | UTF-8 | 762 | 3.125 | 3 | [] | no_license | Python 3.6.2 (v3.6.2:5fd33b5, Jul 8 2017, 04:14:34) [MSC v.1900 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> class fila:
def __init__(self):
self.fila = []
def obtener(self):
return self.fila.pop()
def meter(self,e):
self.fila.insert(0,e)
return len(... | true |
55b3358ba97ca50e9f0b0b0fe5da9409d38fe21b | Python | naru380/AtCoder | /ABC/158/D/source.py | UTF-8 | 616 | 2.75 | 3 | [] | no_license | from collections import deque
S = input()
q = int(input())
is_s0_head = True
tail = len(S)-1
queue = deque(S)
for _ in range(q):
# print(queue)
Q = list(input().split())
if Q[0] == "1":
is_s0_head = not is_s0_head
else:
if Q[1] == "1":
if is_s0_head:
queue... | true |
c3059c6892d7f49c58846ad41e472bb810bcfc9a | Python | qasimahsan77/peoplehr | /PeoplehrWeb/app/views.py | UTF-8 | 7,656 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | """
Definition of views.
"""
from django.shortcuts import render
from django.http import HttpRequest
from django.template import RequestContext
from datetime import datetime
import requests,time
class Employee():
def __init__(self, **kwargs):
return super().__init__(**kwargs)
def basicdata(self):
... | true |
fe1f8649c477e61bbd6b3ade0f597ea89112aade | Python | lsjroberts/Ludum-Dare-24-Evolution | /app/Enemy.py | UTF-8 | 8,031 | 2.75 | 3 | [] | no_license | # -------- Enemy.py --------
# Handles all logic relating to the enemies
# ---------------------------
# Imports
import random, pygame.mixer
import Config, Vector2D
from Sprite import StaticSprite, AnimatedSprite, MovingSprite
from Event import EventListener, Event
# Load sounds
pygame.mixer.init( )
sound... | true |
862dc0d4c58ba41a95323e3d1b455f5709e2e1ee | Python | ziolkowskid06/Python_Crash_Course | /ch04 - Working with Lists/4-10. Slices.py | UTF-8 | 410 | 4.40625 | 4 | [] | no_license | """
Create a list of names and slice it in different places.
"""
names = ['rachel', 'alexis', 'anne', 'kendra', 'samantha', 'julia', 'kim', 'emma']
# The first three names
print(f"First three names from the list are : {names[:3]}")
# Three names from the middle
print(f"Three names from the list are: {names[4:7... | true |
37be76f01d7635c46ff3330ebf3e9a480c262a3b | Python | slin-j/ProjectEuler | /p2.py | UTF-8 | 723 | 4.3125 | 4 | [] | no_license | """
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
Lö... | true |
a1ab47e82be269ba3a6eb870e8bc790d3e091335 | Python | varadhodiyil/vision_pipeline | /cartype_classifier.py | UTF-8 | 1,195 | 2.828125 | 3 | [
"MIT"
] | permissive | from keras.models import model_from_json
import numpy as np
import cv2
from keras.preprocessing import image
class CarTypeClassifier:
def __init__(self):
json_file = open('mobile_net/model.json', 'r')
loaded_model_json = json_file.read()
json_file.close()
self.loaded_model = model_f... | true |
a3c635444527826447c61e7f476623e91f540ebb | Python | stevegocoding/leetcode_py | /intersection_two_list.py | UTF-8 | 798 | 3.421875 | 3 | [] | no_license | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# @param two ListNodes
# @return the intersected ListNode
def getIntersectionNode(self, headA, headB):
pa, pb = headA, headB
len_a, len_b = 0... | true |
e8019b78baa318cc93b2fde7bf6e8c2182d026a3 | Python | weapp/mrcards | /library/modimage.py | UTF-8 | 620 | 2.734375 | 3 | [] | no_license | from images import getImage
import module
import pygame
class ModuleImage (module.Module):
def __init__(self,surface,image="None",position=(0,0)):
module.Module.__init__(self)
self.player=getImage(image)
self.surface=surface
self.position = self.player.get_rect().move(*position)
... | true |
7cc5eb9b4af99aa1130d8b367d688ccc1e710abb | Python | Coder-B/Algo | /leet/1048_longestStrChain.py | UTF-8 | 1,957 | 3.328125 | 3 | [] | no_license | # https://leetcode.com/problems/longest-string-chain/
from typing import List
class Solution:
# Runtime: 2328 ms, faster than 5.15% of Python3 online submissions for Longest String Chain.
def longestStrChain0(self, words: List[str]) -> int:
if len(words)<=1:
return len(words)
result ... | true |
3ef77b01d4e126f4ed078d6c9f0380ddb867dd82 | Python | bupt-renpei/webdnn | /src/graph_transpiler/webdnn/graph/operators/rsqrt.py | UTF-8 | 416 | 2.984375 | 3 | [
"Zlib",
"MIT"
] | permissive | from webdnn.graph.operators.elementwise import Elementwise
class Rsqrt(Elementwise):
"""Rsqrt(name)
Reciprocal of square root operator.
.. math::
f(x) = 1 / sqrt(x)
Args:
name (str): Operator name.
Signature
.. code::
y, = op(x0)
- **x0** - Input ... | true |
d8df7531fa3ac173b83bb095c831cc1a063929b4 | Python | zyyxydwl/Python-Learning | /pythonExercise/two.py | UTF-8 | 1,032 | 3.890625 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#@Time :2017/11/30 0:19
#@Author :zhouyuyao
#@File :two.py
# 题目:企业发放的奖金根据利润提成。利润(I)低于或等于10万元时,奖金可提10%;利润高于10万元,低于20万元时,低于10万元的部分按10%提成,高于10万元的部分,可可提成7.5%;20万到40万之间时,高于20万元的部分,可提成5%;40万到60万之间时高于40万元的部分,可提成3%;60万到100万之间时,高于60万元的部分,可提成1.5%,高于100万元时,超过100万元的部分按1%... | true |
ad4971d9cd92feac3fdbb01e36ec260d8e47fe85 | Python | InfoTech-Academy/Python_Week7 | /onur/regex_2.py | UTF-8 | 1,451 | 3.59375 | 4 | [] | no_license | # Find words that are 8 letter long on this text ;
text = """Without, the night was cold and wet, but in the small parlour of Laburnum villa the blinds were drawn
and the fire burned brightly. Father and son were at chess; the former, who possessed ideas about the
game involving radical chances, putting his king... | true |
d91f9705e04f8c6b0d66f926bbd8cac1ee491383 | Python | nyounes/kaggle | /jigsaw/pytorch_models/bi_gru.py | UTF-8 | 2,677 | 2.65625 | 3 | [] | no_license | from collections import OrderedDict
import torch
from torch import nn
class SpatialDropout(nn.Dropout2d):
def forward(self, x):
x = x.unsqueeze(2) # (N, T, 1, K)
x = x.permute(0, 3, 2, 1) # (N, K, 1, T)
x = super(SpatialDropout, self).forward(x) # (N, K, 1, T), some features are maske... | true |
4a9ee55e0d18e78788f9dd64d312565b6a1a03c3 | Python | tdworowy/PythonPlayground | /Playground/Algorithms/page_rank/page_rank.py | UTF-8 | 1,080 | 3.203125 | 3 | [] | no_license | import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
def create_page_rank(graph: nx.DiGraph) -> tuple:
nodes_set = len(graph)
m = nx.to_numpy_matrix(graph)
outwards = np.squeeze(np.asarray(np.sum(m, axis=1)))
prob_outwards = np.array(
[
1.0 / count if count > 0 ... | true |
00bfaf6cd037506f4f54af4793e9cc8ca43895a1 | Python | dasosjt/Simulation | /proyecto4/totito3d.py | UTF-8 | 5,072 | 3.078125 | 3 | [] | no_license | import numpy as np
import copy
board = [
[
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0]
],
[
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0]
],
[
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0]
],
[
[0, 0, 0, 0],
[0, 0, 0, 0]... | true |
a946e3c9fb4f86895ac2372c617c28d3a047fd0c | Python | hyperskill/hs-test-python | /tests/outcomes/plot/line/pandas/main.py | UTF-8 | 375 | 2.828125 | 3 | [] | no_license | def plot():
try:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
except ModuleNotFoundError:
return
s = pd.Series([1, 3, 2])
s.plot.line()
s.plot(kind='line')
df = pd.DataFrame({
'a': [1, 3, 2],
'b': [1, 3, 2]
}, index=... | true |
1d5968707e7f8c20f1550121944adb7646c60215 | Python | rcy17/InputMethod | /src/utils/compress.py | UTF-8 | 278 | 2.515625 | 3 | [] | no_license | from sys import argv
from zipfile import ZipFile, ZIP_LZMA
def compress(files, output):
target = ZipFile(output, 'w')
for file in files:
target.write(file, compress_type=ZIP_LZMA)
target.close()
if __name__ == '__main__':
compress(argv[2:], argv[1])
| true |
94ab08b5422e4738b715bdbda03f60b2183f1e7d | Python | nikalmus/trypy | /foodb/write.py | UTF-8 | 2,757 | 2.734375 | 3 | [] | no_license | import os, sys
import psycopg2
from psycopg2.extensions import AsIs
import yaml
# drop existing db with and re-create it before running this. See dropdb.py and createdb.py
with open('config.yml', 'r') as file:
config = yaml.load(file)
USER = config['db']['user']
PASS = config['db']['password']
HOST = config['db']... | true |
623396e2d7f8bc01236ee0a8c5d45150641d67a1 | Python | nurulle/basicPython | /course 2/week 1/read.py | UTF-8 | 336 | 3.34375 | 3 | [] | no_license | with open("a.txt") as file:
for line in file:
print(line.upper())
#
with open("a.txt") as file:
for line in file:
print(line.strip().upper())
with open("a.txt") as text:
for line in text:
print(line.strip())
#
file = open("a.txt")
lines = file.readline()
file.close()
lines.sor... | true |
74c021d9ada1bf9a46a954ae8acd7e2f9cf767f0 | Python | perhansson/alignment | /readSurvey.py | UTF-8 | 1,730 | 2.609375 | 3 | [] | no_license | import sys,string
class survey:
def __init__(self,desc):
self.desc = desc
def add(self,words):
self.origin = words[:3]
self.x = words[3:6]
self.y = words[6:9]
self.z = words[9:12]
def getxml(self):
s = '<SurveyVolume name="" desc=\"' + self.desc + '\">\n'
... | true |
d50f29979bf3f939b82e8c9e46102a13e91d82be | Python | NotAlwaysRignt/Personal_Study | /Note and Code/编程/python/flask/源码解读/blueprint解读.py | UTF-8 | 1,554 | 2.671875 | 3 | [] | no_license | #coding:utf-8
'''
先看看blueprint是如何注册的
设在app/main/__init__.py文件中,有:
from flask import Blueprints
blue = Blueprint('main',__name__)
则该蓝本对应的视图函数可以这样定义
@blue.route('/...')
def ... #视图函数
则可用 app.register_blueprint(blue) 注册这个蓝本
'''
先看Blueprint这个类,在flask 的 blueprints.py文件中
详细的就不展开了,会发现Blueprint这个类的很多方法与Flask类中的方法名称相同作用相似
... | true |
9b641858e37637c43d94b0ebb8e63e49bc648dc6 | Python | Aasthaengg/IBMdataset | /Python_codes/p03696/s745229163.py | UTF-8 | 228 | 3.28125 | 3 | [] | no_license | n = int(input())
s = input()
l_cnt = 0
r_cnt = 0
l_ans = 0
for i in s:
if i == ')':
if l_cnt:
l_cnt -= 1
else:
l_ans += 1
else:
l_cnt += 1
print(l_ans*'(' + s + l_cnt*')') | true |
9446dae29a007545245dc9364cf295ed0dbdaa15 | Python | stet-stet/kickgen | /utils/sort_dataset.py | UTF-8 | 1,427 | 2.921875 | 3 | [] | no_license | import os
import sys
from hashlib import md5
# generates a .sh script that can be executed to move datasets.
# new names for the wav files will be a md5 hash.
# for unlucky hash collisions we will append _1, _2... to each file in collision.
def get_file_hash(full_filename):
with open(full_filename,'rb') as file:
... | true |
8b6c1ebb74e6576931e9c7f503844ab950b51075 | Python | Learning-In-The-Machine/Weight-Sharing | /Custom/augmentation.py | UTF-8 | 3,967 | 2.6875 | 3 | [] | no_license | import numpy as np
from copy import deepcopy
from keras.preprocessing.image import ImageDataGenerator
def swap_generator(x_train, y_train, batch_size=64):
while True:
for i in range(0, len(x_train), batch_size):
# get batch of data
x, y = x_train[i:i + batch_size], y_train[i:i + ba... | true |
8a64b088d691fbeb969dff5f385bd82e8f9c1aa1 | Python | dm02111978/SpecialistPython1 | /Module6/home_work/02_hw_file.py | UTF-8 | 338 | 2.9375 | 3 | [] | no_license | # Дан файл data/info.txt, в каждой строке которого содержится строка или целое число
# Найдите сумму всех чисел, пропуская все строки содержащие не числовые значения
with open("data/info.txt", "r") as f:
pass
| true |
5c825fc1ce404f4399b1aef2d115f7cf9d5178b5 | Python | nguyenkims/projecteuler-python | /src/p71.py | UTF-8 | 102 | 2.921875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
limit= 10 ** 6
b = 5
while b < limit:
b+=7
a = (3*(b -7) - 1 )/7
print a,b-7
| true |
685b60583915ca4e5f815897b0c8bc700c382ba8 | Python | alfinoc/listening_patterns | /back/cache.py | UTF-8 | 512 | 2.890625 | 3 | [] | no_license | from json import dumps, loads
import redis
HOST = 'localhost'
PORT = '6379'
def toDBKey(components):
return ':'.join(components)
class RedisWrapper:
def __init__(self):
try:
self.store = redis.Redis(HOST, port=PORT)
except redis.ConnectionError:
raise IOError
def set(self, key... | true |
e6a67a27465f6ec9eb82e5696f0f7bab26b909b1 | Python | rhps/ProjectEuler.net | /Problem20-FactorialDigitSum.py | UTF-8 | 211 | 3.453125 | 3 | [] | no_license | def factorial(num):
sumasi = 1
for x in xrange(1, num+1):
sumasi = sumasi * x
return sumasi
fact = factorial(100)
fact = list(str(fact))
sumasi = 0
for x in fact:
sumasi = sumasi + int(x)
print(sumasi) | true |
d3ee3af8b29f0e6593cedf8e21daa90f8f061bbf | Python | PeterSansan/GDLnotes | /src/short_codes/soft_max.py | UTF-8 | 484 | 3.21875 | 3 | [] | no_license | """Softmax."""
import numpy as np
import matplotlib
matplotlib.use('Agg')
from matplotlib.pyplot import plot,savefig,show
#scores = [3.0, 1.0, 0.2]
scores = np.array([[1,2,3,6],[2,4,5,7],[3,9,3,6]])
def softmax(x):
return np.exp(x) / np.sum(np.exp(x), axis=0)
print(softmax(scores))
# Plot softmax curves
x = ... | true |
e65f475a8d4a3548414801ec1d05fd374a3eeb74 | Python | RqlSamr/Python-codes | /returns_the_day_of_the_year.py | UTF-8 | 1,265 | 3.875 | 4 | [] | no_license | # Your task is to write and test a function which takes three arguments
# (a year, a month, and a day of the month)
# and returns the corresponding day of the year,
# or returns None if any of the arguments is invalid.
def isYearLeap(year):
if year%4!=0 and year%400!=0:
return False
elif year%100!=0... | true |
4910151e1e063e2c0bc5661e4228cee62a2e5146 | Python | eleanormark/React-TopoJson-D3 | /app/www/models.py | UTF-8 | 981 | 2.640625 | 3 | [] | no_license | """Database models"""
from sqlalchemy import Column, Integer, String, create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy.pool import SingletonThreadPool
Base = declarative_base()
class Physicians(Base):
__tablename__ = 'physicians'
... | true |
b605b6c3a13fc6070c5ea273e2a9397dcccec655 | Python | raghuprasadks/MLInfidataIntern-B1July | /programs/python/loopsnconditionstatements.py | UTF-8 | 693 | 3.828125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Jul 22 13:26:50 2020
@author: lenovo
"""
'''
loops in python
while loop
'''
start = 1
end = 10
while (start <=end):
print(start)
start = start + 1
'''
for loop
'''
for i in range (1,11):
print(i)
for i in range (2,21,2):
print(i)
students=['ravi','r... | true |
93accd151405293d9de1b81f79a402b8d0313b7e | Python | firesoules/anti-stealing-link | /mzpic.py | UTF-8 | 2,165 | 2.5625 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import urllib.request
import requests
import time
import os
import shutil
from lxml import html
def getPage():
'''
Get the link of beauty picture in the home page.
'''
fres=open('res.txt','w')
htm=urllib.request.urlopen('http://www.mzitu.com/')
out=htm.read()
... | true |
a8c3bd7fe009caf80abc3a07fcb7c1ac353534d6 | Python | Vaziria/vazutils | /spyone_proxy.py | UTF-8 | 2,841 | 2.84375 | 3 | [] | no_license | import re
from uuid import uuid4
import random
import requests
class SpyOne:
proxies = []
key_port = {}
def get(self, jum = 1):
url = "http://spys.one/en/http-proxy-list/"
token = str(uuid4()).replace('-', '')
payload = {
'xx0': token,
'xpp': jum,
'xf1': 4,
'xf2': 0,
'xf4': 0... | true |