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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
b173291f470766a5ebc4fa4b22553f5b3016fa64 | Python | sateodoro/AI604_Team19 | /metric.py | UTF-8 | 1,109 | 2.53125 | 3 | [] | no_license | import numpy
import math
from math import log10
from skimage.measure import compare_ssim as ssim
def to_numpy_array(image):
image = image.cpu()
image = image.data.squeeze(0)
mean = [0.5, 0.5, 0.5]
std = [0.5, 0.5, 0.5]
for t, m, s in zip(image, mean, std):
t.mul_(s).add_(m)
image = imag... | true |
79610af390d985f1c1cbf1d5b450f9d5ef10e4e2 | Python | luiscarlosgph/dash-template | /src/whatever/views/dashboard.py | UTF-8 | 2,390 | 2.84375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | #!/usr/bin/python
#
# @brief View classes for displaying information on the website.
# @author Luis Carlos Garcia-Peraza Herrera (luiscarlos.gph@gmail.com).
# @date 20 Jan 2020.
import dash_bootstrap_components as dbc
import dash_html_components as html
# My imports
import wat.views.base
class DashboardView(wat... | true |
73ed1fcc9f3c37028ee56a3c6e1fdbcc22ffe237 | Python | ankitjain87/polymath | /utils.py | UTF-8 | 2,272 | 2.921875 | 3 | [] | no_license | import os
import requests
import sqlite3
import config
def is_db_exists():
return True if os.path.isfile(config.DB_NAME) else False
def connect_db():
try:
con = sqlite3.connect(config.DB_NAME)
return con
except Exception as ex:
print("Connection Error", ex)
def is_table_exists(t... | true |
1461efc23c4ab267d1b524f341976ee1041058f2 | Python | Zhangzhuzhefu/exercism | /python/hamming/hamming.py | UTF-8 | 170 | 3.328125 | 3 | [] | no_license | def distance(strand_a, strand_b):
if len(strand_a) != len(strand_b):
raise ValueError("ValueError")
return sum([a!=b for a,b in zip(strand_a, strand_b)])
| true |
9a680721170fdd780b5169ce077e3a4041afc510 | Python | smurching/virtualitics-2 | /scrape_fed_salaries.py | UTF-8 | 4,104 | 2.6875 | 3 | [] | no_license | from jinja2 import Template
import psycopg2
import os
import time
import json
import requests
from requests.exceptions import ConnectionError
import logging
import logging.handlers
#logging.basicConfig(level=logging.DEBUG)
logging.basicConfig(level=logging.ERROR)
LOG_FILENAME = "log/fed_salary_log.log"
num_display = 2... | true |
2c54bdd73366cef05e908225230c306f2d287453 | Python | ShuoyuanZhang418/Atificial-Intelligence | /Project-3-LaserTank MDP/GridWorld_VI.py | UTF-8 | 34,360 | 2.984375 | 3 | [] | no_license | import copy
import numpy as np
import random
import time
# Directions
from laser_tank import LaserTankMap
UP = 0
DOWN = 1
LEFT = 2
RIGHT = 3
def get_action_name(action):
if action == UP:
return "U"
if action == DOWN:
return "D"
if action == LEFT:
return "L"
if action == RIGHT:... | true |
b0629ca7ba24cee6c36c50e1c2be2f21002639e7 | Python | Di-ayy-go/fact-ai | /python/distributions.py | UTF-8 | 5,110 | 3.234375 | 3 | [] | no_license | import numpy as np
from random_handler import RandomHandler
import scipy.stats as sc
class UniformDistribution(sc.distributions.rv_frozen):
"""
Wrapper for Scipy uniform distribution.
Contains additional methods needed to reproduce results of paper.
args:
loc (int): mean of distribution
... | true |
811b3d3882263967f51f24773cee0de80640277d | Python | haowen-xu/tfsnippet | /tfsnippet/utils/scope.py | UTF-8 | 2,845 | 2.703125 | 3 | [
"MIT"
] | permissive | from contextlib import contextmanager
import six
import tensorflow as tf
from tensorflow.python.ops import variable_scope as variable_scope_ops
__all__ = [
'get_default_scope_name',
'reopen_variable_scope',
'root_variable_scope',
]
def get_default_scope_name(name, cls_or_instance=None):
"""
Gene... | true |
b6ee58e733d445d03d8552cbd81ac2e96bbc4b41 | Python | lorenzoFerri95/LaboratoryOfDataScience | /LDS_Part1_Group5/02_dimensions.py | UTF-8 | 1,369 | 2.53125 | 3 | [] | no_license | # Load dimensions' tables to SQL Server
import pyodbc
from csv import reader
# Connection to SQL Server
server = 'tcp:apa.di.unipi.it'
database = 'Group5HWMart'
username = 'group5'
password = 'w9hez'
connectionString = 'DRIVER={ODBC Driver 17 for SQL Server};\
SERVER='+server+';DATABASE='+databas... | true |
c417270ec87317f69d57fe0de3529ae54aebb6b6 | Python | hemant6488/stepup-algos | /arrays/2019_9h_2d_hourglass_maximum_sum.py | UTF-8 | 473 | 3.46875 | 3 | [] | no_license | def hourglassSum(arr):
sums = []
for i in range(len(arr) - 2):
for j in range(len(arr[i]) - 2):
hourglassSum = arr[i][j] + arr[i][j+1] + arr[i][j+2] + arr[i+1][j+1] + arr[i+2][j] + arr[i+2][j+1] + arr[i+2][j+2]
sums.append(hourglassSum)
return max(sums)
if __name__ == '__ma... | true |
6cf58b387997756a86104cbc54fdda159d8b7edc | Python | huuhoa020899/Neural | /KTSNT.py | UTF-8 | 275 | 3.046875 | 3 | [] | no_license | def KTSNT():
x=int(input ("enter x:"))
dem =0
for i in range(1,x+1):
if x % int( i) == 0:
dem=dem+1;
if dem>2:
break
if dem==2:
print("N la so nguyen to")
else:
print (" N k la so nguyen to")
KTSNT() | true |
a9918c9031d924435d179d3cbbefaa49b253ef97 | Python | brnmsmith/rhinoUnfolder | /rhino_unwrapper/Map.py | UTF-8 | 1,422 | 2.578125 | 3 | [] | no_license | #Map
from rhino_helpers import getTVertsForEdge
class Map(object):
"""Map:a class for keeping track of the relation between the net and the mesh"""
def __init__(self,mesh):
#super(Map, self).__init__()
self.meshVerts = {}
self.meshEdges = {}
self.meshFaces = {}
for i in xrange(mesh.TopologyVerti... | true |
27b8df86ce8286bc6b712041ca0042fd8f7d44ac | Python | mccurrymitchell3/ems_simulation | /incidents.py | UTF-8 | 1,788 | 2.765625 | 3 | [] | no_license | import callcenter
import globals
import random
import datetime
class Incidents:
# generates incidents at 15 minute intervals
def __init__(self):
#self.callRate = 1 #this will eventually be a curve
self.intervalMax = 15
# generates a random number of events for the interval and generates ... | true |
08be1931eaf581c4f37174532c6b6415834207c6 | Python | flacout/algorithm-bucket | /NP_reduce_2-SAT.py | UTF-8 | 1,809 | 3.265625 | 3 | [] | no_license | # python3
# Reduction to SAT
# the file output is to use with my minisat solver
# for which the format is a little different from the grader
n, m = map(int, input().split())
edges = [ list(map(int, input().split())) for i in range(m) ]
#f = open('cl.txt', 'w')
# This solution prints a simple satisfiable formula
# and... | true |
d822e321e50c4c036bc65bfb16ee9b211cb934d6 | Python | 6igsm0ke/Introduction-to-Programming-Using-Python-Liang-1st-edtion | /CH06/EX6.11.py | UTF-8 | 598 | 3.9375 | 4 | [] | no_license | # 6.11 (Financial application: compute commissions) Write a function that computes
# the commission, using the scheme in Exercise 5.39. The header of the function is:
# def computeCommission(salesAmount):
# Write a test program that displays the following table:
# Sales Amount Commission
# 10000 900.0
# 15000 1500.0
# ... | true |
66268d5bf7c98bc3de93f61bb3d83f1ff31ddff4 | Python | luukhoai/zipairline-sample | /zipairline/serializers.py | UTF-8 | 2,292 | 2.703125 | 3 | [] | no_license | from rest_framework import serializers
from rest_framework.serializers import ModelSerializer
from .models import ZipAirplane, ZipAirline
class ZipAirplaneSerializer(ModelSerializer):
class Meta:
model = ZipAirplane
fields = ('airplane_id', 'passenger_numb', 'airline')
def validate_airplane_... | true |
f5521afc0d0abd048b0ec68fb124c5684d2b8019 | Python | JinyongYoon/Python-for-everyone | /py4e3 - Access Web Data/exercise/exercise ch11~12.py | UTF-8 | 1,341 | 3.015625 | 3 | [] | no_license | # # Exercise (Regular Expressions)
# import re
# handle = open("/Users/jinyong/py4e/actual.txt")
# total = 0
# x = list()
# for line in handle:
# y = re.findall('[0-9]+', line)
# if len(y) == 0:
# continue
# for num in range(0, len(y)):
# total = total + int(y[num])
# print(total)
# # Ex... | true |
822ea3d61fde908f65540fcea8cd98cbacca57b5 | Python | mubasheerusain/Python-programs | /min_unique.py | UTF-8 | 536 | 3.140625 | 3 | [] | no_license | def check(s):
b =[]
for i in s:
b.append(i)
b.sort()
print(b)
c =[]
for i in range(0,len(b)):
if i<len(b)-1:
if b[i]!=b[i+1] and b[i]!=b[i-1] :
c.append(b[i])
l = len(s)
if b[l-1] != b[l-2]:
c.append(b[l-1])
print(c)
... | true |
6ea3519ad455054757993295cdaa18f7267c8c1c | Python | Eliogeno/Space-Game | /my_space_game.py | UTF-8 | 8,890 | 2.78125 | 3 | [] | no_license | # Intro to GameDev - main game file
import pgzrun
import random
WIDTH = 1000
HEIGHT = 600
SCOREBOX_HEIGHT = 60
#keep track of score
score = 0
junk_collect = 0
level = 0
level_screen = 0
lvl2_LIMIT = 5
lvl3_LIMIT = 10
#sprite speeds
JUNK_SPEED = 5
SATELLITE_SPEED = 3
DEBRIS_SPEED = 3
LASER_SPEED = -5 # lasers are m... | true |
fa23a3c47e4f8134123a8175f234dd2239bfc60b | Python | saeeds255/bfx-python | /SellOrderSL.py | UTF-8 | 1,031 | 3 | 3 | [] | no_license |
from Bitfinex import Bitfinex
import json
import time
import sys
BFX = Bitfinex('API_KEY', 'API_SECRET', 'https://api.bitfinex.com/v1')
def startit():
slprice = 2365.5
myorder = BFX.positions()
possymbol = str(myorder[0]['symbol'])
posamount = float(myorder[0]['amount'])
print... | true |
1ed7225e54643574a34a9d2d6e00174166532ac5 | Python | Benyamin-creator/simple-payload-generator | /spg.py | UTF-8 | 11,761 | 2.671875 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/python
#-*- coding: utf-8 -*-
################################################################################
# #
# SPG #
# Simp... | true |
fb1a75f9e7d590fd20bec1889ea127ce5c9b3292 | Python | tdengg/pylastic | /.local/lib/python2.7/site-packages/pylastic/get_DFTdata.py | UTF-8 | 2,335 | 2.90625 | 3 | [] | no_license | """Get data from DFT calculations.
"""
import lxml.etree as et
class VASP(object):
"""VASP interface for collecting energies from vasprun.xml.
"""
def __init__(self):
self.__vfile = None
self.__cellsize = 1
self.__ERange = (-3000.,-1000.)
##
def set_outfile(self, vfile)... | true |
a00c206ec5552c48fc5fd01f5ce34f471f4f89ee | Python | db3124/bigdata_maestro | /Python/myPyCode/chap06/write1.py | UTF-8 | 518 | 3.546875 | 4 | [] | no_license | import os
# 운영체제 관련 기능 제공하는 모듈
# get current working directory
os.getcwd()
# try 영역에서 오류가 발생할 때만 except 영역이 실행됨.
try:
fileName = input('파일명을 입력하세요: ')
f = open(fileName, 'rt') # 'wt'
except:
f = open('myFile.txt', 'a')
# 텍스트 파일로 기록할 때 한 줄이 끝났을 때 반드시 개행을 하라!!!
str1 = 'This is my third file.\n'
f.write(str... | true |
dc69614edac2e183377a10ba9cafa05ee3316049 | Python | Pduhard/mlp_42 | /protodeep/Protodeep/initializers/HeNormal.py | UTF-8 | 312 | 2.5625 | 3 | [] | no_license | import numpy as np
from Protodeep.initializers.Initializer import Initializer
class HeNormal(Initializer):
"""
He Normal initializer
[0 - sqrt(2 / nout)]
"""
def initialize(self, shape, dtype=None, *args, **kwargs):
return np.random.randn(*shape) * np.sqrt(2 / shape[-1])
| true |
09f9fe0dc39786f45638775ac23c38b84db59161 | Python | ivovtin/workMTD | /scripts/example/read_write_single_register.py | UTF-8 | 1,868 | 2.96875 | 3 | [] | no_license | #!/bin/env python
import random # For randint
import sys # For sys.argv and sys.exit
import uhal
if __name__ == '__main__':
# PART 1: Argument parsing
if len(sys.argv) != 4:
print "Incorrect usage!"
print "usage: read_write_single_register.py <path_to_connection_file> <connection_id> <regist... | true |
1c355979c4cc1542d15514ea780e3f101b928f46 | Python | tientheshy/leetcode-solutions | /src/221.maximal-square.py | UTF-8 | 945 | 3.25 | 3 | [] | no_license | #
# @lc app=leetcode id=221 lang=python3
#
# [221] Maximal Square
#
# @lc code=start
# TAGS: Array, Dynamic Programming
# REVIEWME: similar to 1277
class Solution:
# 184 ms, 97.47%. O(M*N) Similar to best solution.
# The idea is very simple, it is a greedy approach by calculating the tail based on the cells i... | true |
5425e1aaf8bc7d4e48785da568cb5cbd43e0e552 | Python | viva0330/APS | /IM_study/0415/5201.py | UTF-8 | 2,138 | 3.453125 | 3 | [] | no_license | """
화물이 실려있는 N개의 컨테이너를 M대의 트럭으로 A도시에서 B도시로 운반.
트럭당 한개의 컨테이너 운반. 적재용량 초과 컨테이너 운반 불가.
A->B 최대 M개의 트럭이 편도로 한 번 만 운행한다고 한다.
총 증량이 최대가 되도록 컨테이너를 옮겼다면 옮겨진 화물의 전체 무게가 얼마인지,,?
화물을 싣지 못한 트럭이나 남는화물이 있을 수 있다. 컨테이너를 하나도 옮길 수 없는 경우
0 을 출력한다.
"""
"""
1. 적재 용량이 큰 트럭순으로 배열
2. 무거운 컨테이너 순으로 배열
3. 최선의 방법을 찾ㅇ는다.
3-1, 현재 기준으로 가장 무거운 컨... | true |
9339637c0b6a04d28162faf78740fb5d6a1c2f23 | Python | NaomiBis/Python-week-3 | /bankstatement.py | UTF-8 | 1,356 | 4.09375 | 4 | [] | no_license | #A employee bank statement
#ask for user details
name=input("please enter name \n")
surname=input("please enter surname\n")
#ask for account number
acc_number= int(input("please enter account number \n"))
#ask for salary
salary=int(input("Enter your salary (R) \n"))
#variables to hold the tax, pension a... | true |
9dcc9c96cdfc9759e41ca965648743dfbfe11276 | Python | ccena/Learning-Basic-Python | /Chapter 2 Introduction to Numpy/2.8.3 More Advanced Compound Types.py | UTF-8 | 692 | 4.21875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
It is possible to define even more advanced compound types. For example,
you can create a type where each element contains an array or matrix of values.
"""
import numpy as np
# Here, we’ll create a data type with a mat component consisting of a
# 3×3 floating-point matrix:
... | true |
a0382171874c8167a54298ac554d88786f74a88f | Python | gokulsgr/virtual-drums | /main.py | UTF-8 | 7,747 | 2.6875 | 3 | [] | no_license | import cv2
import pygame
import numpy as np
from random import randint
class drum:
def __init__(self):
self.bpx, self.bpy = 0,0
self.rpx, self.rpy = 0,0
self.bnx, self.bny = 0,0
self.rnx, self.rny = 0,0
self.bip = False
self.rip= False
self.bi = Fa... | true |
35ad92a65f05ab61128dcd068ddcfa949da38e9d | Python | gpleiss/ciq_experiments | /bayesopt/ciq_bo/utils.py | UTF-8 | 1,152 | 3.234375 | 3 | [
"Apache-2.0"
] | permissive | import torch
def to_unit_cube(x, lb, ub):
"""Project to [0, 1]^d from hypercube with bounds lb and ub"""
assert torch.all(lb < ub) and lb.ndim == 1 and ub.ndim == 1 and x.ndim == 2
xx = (x - lb) / (ub - lb)
return xx
def from_unit_cube(x, lb, ub):
"""Project from [0, 1]^d to hypercube with bound... | true |
cb4fc5a01d679d3142de24aa136aec4d5c106a49 | Python | philipmeneghini/Group_Optimization | /Group Optimization Code.py | UTF-8 | 6,361 | 2.734375 | 3 | [] | no_license | import gurobipy as gp
from gurobipy import GRB
import numpy as np
import pandas as pd
##initialize all data
names = ["Alex M.","Alex R.","Arjun","Brendan","Elisabeth","Emma","Erica","Evan","Hanna","Kalju","Khai","Lorene","Matthew","Maura",
"Maxwell","Nathan","Parker","Philip","Samuel","Sarah","Sejal","Yongzhi... | true |
e2383486ce007ea0d84aa1aca8fadd58cc994ef5 | Python | mamemilk/acrc | /凡人が緑になるための精選50問_佐野/src/33.py | UTF-8 | 2,588 | 3.28125 | 3 | [] | no_license | # https://atcoder.jp/contests/abc177/tasks/abc177_d
#
# かなり苦労した.
#
# 友達グループA 1 2 3 4
# B 5 6
# C 7 8 9
# この場合,同じグループに友達が居ないグループの分け方は,4グループ.
# 最大のグループの要素数が答えになる.
# friendsをsetでもつ以下実装で,TLE 2件,WA 9件.TLEはわかるが,WAがなんでかがわかってない.
'''
N, M = map(int, input().split())
friends_set_by_id = list(range(N... | true |
38044289ca5ade4e7637ce4d7efdc7b4a96a38f3 | Python | DiksonSantos/Curso_Do_Guanabara | /Aula_16_Exercicios_.py | UTF-8 | 1,433 | 3.828125 | 4 | [] | no_license | #Exercicio 072:
'''
#print("Digite Quit Para Sair")
Num_Strings = ('Zero', "Um", "Dois", "Três", 'Quatro',
"Cinco", 'Seis', 'Sete', 'Oito', 'Nove', 'Dez')
while True:
Numero = int(input("Digite Numero: ")) # Aqui precisa ser INT para ele usar de Indice.
#O bloco a baixo é p/ o prog... | true |
832f04862aaa2b2417ed323e46bd900c193af480 | Python | dkratzert/DSR | /src/dsr_shelx/networkx/algorithms/polynomials.py | UTF-8 | 10,714 | 3.859375 | 4 | [] | no_license | """Provides algorithms supporting the computation of graph polynomials.
Graph polynomials are polynomial-valued graph invariants that encode a wide
variety of structural information. Examples include the Tutte polynomial,
chromatic polynomial, characteristic polynomial, and matching polynomial. An
extensive treatment ... | true |
db3483a411de0a6022d67adedde8b344d3f39754 | Python | D3Rnatch/TestPhabricator | /Sources/Tests/Scanner laser/test_algo.py | UTF-8 | 2,135 | 3.03125 | 3 | [] | no_license | # Import some lib
import cv2
import numpy as np
# Load base image
image = cv2.imread('200cm.jpg')
# cv2.imshow('base_image', image)
# cv2.waitKey(0)
# turn to hsv value
# hsv_image = cv2.cvtColor(image, cv2.COLOR_BGR2HSV)
lower_red = np.array([0, 0, 100])
upper_red = np.array([255, 255, 255])
# get hue
b, g, r = cv... | true |
71a3935f00c2470a072926fa1f9e58c29ae524d5 | Python | manojmpg114/Python | /Python Statements/list_comprehensions.py | UTF-8 | 1,724 | 4.15625 | 4 | [] | no_license | mystring = "Hello"
mylist = []
for letter in mystring:
mylist.append(letter)
print(mylist)
# format of list comphresension means we can do this in a single line / with less fluff
mylist = [letter for letter in mystring]
print(mylist)
mylist = [x for x in 'word'] #as long as the x is the same object name it ... | true |
2e7ea796e9ea60244e4e5e4e374a1be57a392c74 | Python | Reader6/WebRead | /Novelspider/Novels/Novelspider/Novelspider/pipelines.py | UTF-8 | 1,890 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
# import json
# class NovelspiderPipeline(object):
# def __init__(self):
# self.f = open("novel.json", "w")
#
# ... | true |
a02b6eeee7869206a4ded3c2fa2221dfefb6d084 | Python | aditshinde/python-training | /day-1-handson/armstrong.py | UTF-8 | 226 | 3.859375 | 4 | [
"Apache-2.0"
] | permissive | ## TODO: Do for all numbers.
a = 153
n = len(str(a))
addn = 0
for i in list(str(a)): # ['1', '5', '3']
addn = addn + int(i)**n;
if addn == a:
print(a, " is Armstrong number")
else:
print(a, " is not Armstrong number") | true |
fd9ef283d4462106764aac750a7b7121f18308d6 | Python | AcisAce/My-Python-Projects | /Python Projects/Predprey/Beta.py | UTF-8 | 2,591 | 3.21875 | 3 | [] | no_license | #Author=AcisAce
import pygame
import math
import random
## Welcome to the predprey simulation program
(width,height)=(800,400) #Window properties
screen=pygame.display.set_mode((width,height)) #Display Settings
screen.fill((255,255,255))
sizePred=20 #Sizes in pixels
sizePrey=10
velPred=1
velPrey=0.01
colorRan... | true |
81757e027c0c9e9a67b6f083754967a1900b8bfb | Python | luguannan/Artificial-Intelligence | /HW3/BayesNet.py | UTF-8 | 17,380 | 3.0625 | 3 | [] | no_license |
class ProbDist:
def __init__(self, varname, freqs=None):
self.prob = {}
self.varname = varname
self.values = []
if freqs:
for (v, p) in freqs.items():
self[v] = p
self.normalize()
def __getitem__(self, val):
"Given a value, return... | true |
5e6191c36648e965461581c30ea7797b20ad6c9a | Python | RishikaMachina/DP-3 | /Problem_2.py | UTF-8 | 704 | 3.015625 | 3 | [] | no_license | # Runs on Leetcode
# Runtime - O(m*n)
# Space - O(n) where m is # of rows and n is # of cols
class Solution:
def minFallingPathSum(self, A: List[List[int]]) -> int:
if not A:
return 0
rows = len(A)
cols = len(A[0])
dp = A[0]
for... | true |
2728ce51d2d13b84df90c05fd282b8035cfd9767 | Python | seungwookim/LivyClientPython | /livy_hive_client.py | UTF-8 | 9,413 | 2.515625 | 3 | [] | no_license | import json, requests, textwrap, time, random
# json object hooker class
class JsonObject:
def __init__(self, d):
self.__dict__ = d
#json_data = json.loads(data, object_hook=JsonObject)
#requests.get('http://httpbin.org', hooks=dict(response=print_url))
#list(filter(lambda x:x=='idle' ,self.alive_sess_obj))
cl... | true |
3374cd30315d99b0b31d5236c252d3db7a912435 | Python | nacho1415/Toy_Blockchain | /OneDrive/바탕 화면/알고리즘/1000~2000/1871.py | UTF-8 | 204 | 3.609375 | 4 | [] | no_license | sum = 0
for i in range(int(input())):
item_a, item_b = input().split("-")
for i in range(len(item_a)):
sum = sum + ord(item_a[i])*(26**(2-i))
print(sum)
print(sum)
sum = 0
| true |
4ee9acc8bbc45cb37c1210f315c00cdd08a771b2 | Python | FlyingUnicorn/.emacs.d | /scripts/getSrcHdr.py | UTF-8 | 1,744 | 2.71875 | 3 | [] | no_license | import os
import sys
lst_ext_src = ['c', 'cpp', 'cc']
lst_ext_hdr = ['h']
lst_dir_src = ['src', 'Src', 'source', 'Source', 'sources', 'Sources']
lst_dir_hdr = ['inc', 'Inc', 'include', 'Include', 'includes', 'Includes']
def assemble_path(f_base, f_dir, f_name, f_ext):
f_target = '{}/{}/{}.{}'.format(f_base, f_di... | true |
e49285ef8841d5b178ded0a2d30c457eba1c0e10 | Python | ANazaret/Santa20-Local-Contest | /app/management/commands/run_games.py | UTF-8 | 4,693 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
from kaggle_environments import make
from django.utils import timezone
from django.core.management.base import BaseCommand
from app.models import Game, Agent, GameStatus, GameResult
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument(
"-n", "--n... | true |
2b3a7d0c28d1bf7d4400b0e5558b0527a96af781 | Python | NQMTri/NumberTheory | /RationalReconstruction.py | UTF-8 | 1,950 | 3.359375 | 3 | [] | no_license | import sys
import math
from random import randrange
from utilities import *
from EffectiveThueLemma import *
def getZ(value):
s = str(value)
p10 = 1
if s[0] != '0':
p10 = 10
for i in range(1, len(s)):
if s[i] == '.':
break
p10 *= 10
z = []
first = int(s[0] == '0')
for i in range(first, len(s)):
if s... | true |
4a4e41b2c0f58302319c1b02333c01aacd4fe59f | Python | littleyellowfishes/2018-python | /2048.py | UTF-8 | 6,901 | 3.109375 | 3 | [] | no_license | import random
import sys
from numpy import *
c = 0
r = 0
m = [[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0]]
highscore = 0
def g():
global y
y = int(input("number:"))
while y <= 1:
print("Invaild input, you can only input between 2 and 10")
y = int(... | true |
8c84de171e957ddde3d67235e4de0e0e47e9eb5b | Python | MayukhSobo/ML | /KNN/preprocess.py | UTF-8 | 6,384 | 3.28125 | 3 | [
"MIT"
] | permissive | from abc import ABC, abstractmethod
from math import ceil
from warnings import warn
import numpy as np
import pandas as pd # For all data processing
class Gather(ABC):
"""
Gather module collects all the
data passed through its constructor
and performs the following operations.
1. Head (n = 5... | true |
b7e42971319ee8c86fb9607419eb70b815de7484 | Python | MuLx10/DL3 | /DL3.py | UTF-8 | 9,267 | 3.4375 | 3 | [] | no_license |
# coding: utf-8
# ### Importing libraries
# In[10]:
import numpy as np
import pandas as pd
#import seaborn as sns
#import matplotlib.pyplot as plt
from sklearn.datasets import load_files
from glob import glob
#get_ipython().magic(u'matplotlib inline')
# ### Data Exploration
# In[11]:
# Reading the train and t... | true |
a60ad21c6c1e4e5996e8f2d46dc6f365f2942ab2 | Python | danoc93/auctioneer | /worker/auction/complete_bids.py | UTF-8 | 1,489 | 2.6875 | 3 | [] | no_license | import time
from django.db.models import Max
from django.utils import timezone
from auctions.models.Auction import Auction
from auctions.models.AuctionStatus import AuctionStatusOption, AuctionStatus
from auctions.models.Bid import Bid
"""
This worker fulfills expired auctions and declares winner bids.
"""
def com... | true |
757ef75b06d8738f21402d8f7fdfad06b0f83fe2 | Python | rcsraymer/Project_Euler | /001.py | UTF-8 | 517 | 4.4375 | 4 | [] | no_license | # Question
# If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
# Find the sum of all the multiples of 3 or 5 below 1000.
# Solution
# Use the modulus operator to find where i in range of 1000 has no remainder when divisible by 3 or 5
... | true |
029b3e03fec3863fa9165a04b0817df2922a7e85 | Python | Aayushs1602/memes | /table of 69.py | UTF-8 | 38 | 2.953125 | 3 | [] | no_license | for i in range(1,11):
print(69 * i)
| true |
2387eb6a5b9fa886b6f764da99bd24c0290f1684 | Python | Git-Clarusway/CaseStudy | /CS-8/ValidateCS.py | UTF-8 | 1,473 | 3.671875 | 4 | [] | no_license | # Customer should be checked for customer's name,
# customer's username, and customer's birthday.
# users database - a particular index corresponds to a specific user
# users database - a particular index corresponds to a specific user
names = ["James", "John", "Emma"]
surnames = ["Oliver", "Smith", "Brown"]
birth_da... | true |
97cbd1756c3dd4f62cc10a1bf09aa2fff5a09b4b | Python | decoejz/cFProj2 | /DTMF/recebe.py | UTF-8 | 2,323 | 3 | 3 | [] | no_license | from signalTeste import *
import numpy as np
import sounddevice as sd
import matplotlib.pyplot as plt
#import wave
import time
#import pickle
import peakutils
from peakutils.plot import plot as pplot
#frequências possíveis
freq1 = 1209
freq2 = 1336
freq3 = 1477
freq4 = 697
freq5 = 770
freq6 = 852
freq7 = 941
#soma d... | true |
a63b5ee8331de090c005be527ea0bb46b91c755e | Python | JavierLopatin/Python-Remote-Sensing-Scripts | /Rasterize.py | UTF-8 | 1,122 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
C
Rasterize all shapefile columns into a multiband raster
reated on Sat Dec 5 11:44:50 2020
@author: Javier Lopatin
"""
import geopandas as gpd
from geocube.api.core import make_geocube
import argparse
# create the arguments for the algorithm
parser = argparse.Arg... | true |
5c06bab21cdd98108e5d574f700f84d6fc3fd028 | Python | nex3z/think-bayes-playground | /c2/Monty.py | UTF-8 | 385 | 2.5625 | 3 | [] | no_license | from common.Pmf import Pmf
class Monty(Pmf):
def likelihood(self, data, hypo):
if hypo == data:
return 0
elif hypo == 'A':
return 0.5
else:
return 1
def update(self, data):
for hypo in self.values():
like = self.likelihood(data, ... | true |
4cb236b2b80a8d0f83219bbdd5d70e9b373d365b | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2973/59140/290174.py | UTF-8 | 546 | 3.015625 | 3 | [] | no_license | def permutation(s_list, start, last):
if start >= last:
sets.append("".join(s_list))
else:
for i in range(start, last):
s_list[i], s_list[start] = s_list[start], s_list[i]
permutation(s_list, start + 1, last)
s_list[i], s_list[start] = s_list[start], s_list[i]... | true |
c153f86643770d306279ac1a30efa287124eda0b | Python | vinismarques/codigos-python | /gerenciamento_bancario.py | UTF-8 | 890 | 3.875 | 4 | [] | no_license | class Cliente:
def __init__(self, nome, cpf, idade):
self.nome = nome
self.cpf = cpf
self.idade = idade
def __str__(self):
return f'Nome: {self.nome}, CPF: {self.cpf}, Idade: {self.idade}'
class Conta():
def __init__(self, cliente, saldo):
self.cliente = cliente
... | true |
63b0df9ad4eb2705c1d69f5a5c2ac7d35e12e83f | Python | aoeuidht/homework | /leetcode/palindrome_number.py | UTF-8 | 722 | 3.546875 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
"""Determine whether an integer is a palindrome. Do this without extra space.
"""
class Solution:
# @return a boolean
def isPalindrome(self, x):
if x < 0:
return False
i = 0
_x = x
while _x > 0:
_x... | true |
a7110115a79554d22d3e20dbe44f8ad466bef608 | Python | filhit/dsoulstest_server_modpack | /dumpnodes/avgcolors.py | UTF-8 | 670 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
from math import sqrt
from PIL import Image
if len(sys.argv) < 2:
print("Prints average color (RGB) of input image")
print("Usage: %s <input>" % sys.argv[0])
exit(1)
inp = Image.open(sys.argv[1].split()[0]).convert('RGBA')
ind = inp.load()
cl = ([], [], [])
for x in range(inp.siz... | true |
73da54e401643de521bd4314b566aefd71062d11 | Python | litvinchuck/python-workout | /ftp.py | UTF-8 | 5,795 | 3.09375 | 3 | [
"MIT"
] | permissive | """A minimalistic FTP util. A shell client for Python ftplib
getwelcome - Return the welcome message sent by the server in reply to the initial connection. (This message sometimes
contains disclaimers or help information that may be relevant to the user.)
connect [host=''] [port=0] [timeout=None] - Connect to the giv... | true |
7ac59e6226556a4896f2695c2efdfe84ab408af2 | Python | sherry-roar/Roar | /mysvm.py | UTF-8 | 6,619 | 2.78125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding:utf-8 -*-
__author__ = 'Mr.R'
import numpy as np
from sklearn import svm
from sklearn.model_selection import KFold
# import sklearn
import matplotlib.pyplot as plt
# import pylab as pl
import time
np.random.seed(1)
sample_num=1000
t='nonlinear'
k=5
c=[1e... | true |
a4f6108cef791f6cd7b064673023e5873ba84fba | Python | ASCIT/donut | /donut/modules/core/helpers.py | UTF-8 | 5,794 | 3 | 3 | [
"MIT"
] | permissive | import flask
import pymysql.cursors
def get_member_data(user_id, fields=None):
"""
Queries the database and returns member data for the specified user_id
or list of user_id's.
Arguments:
user_id: The member (or list of members) to look up
fields: The fields to return. If None specif... | true |
e37606936965b0d63c1f4c82850e0b2f26d01186 | Python | shakthi-sambas/x9115SNN | /hw/code/3/Birthday.py | UTF-8 | 1,256 | 3.59375 | 4 | [] | no_license | __author__ = 'Nakul'
"""This module contains code from
Think Python by Allen B. Downey
http://thinkpython.com
Copyright 2012 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
import random
print ("####################")
print ("Solution for Exercise 10.8")
print ("####################")
... | true |
cfedc0c8ee0c4281cab88cf59743d0b58abacfb4 | Python | csdorman/My-Code-Learning | /AdventOfCode/2019/day3.py | UTF-8 | 2,157 | 3.515625 | 4 | [] | no_license |
# Using "taxicab geometry" (grid): https://en.wikipedia.org/wiki/Taxicab_geometry
# Reddit hints for day 3: https://www.reddit.com/r/adventofcode/comments/e5bz2w/2019_day_3_solutions/
# Walkthrough (in php) is here for thought process: https://hwright.com/advent-of-code-hints-2019
# test 1
# wire 1: R8,U5,L5,D3
# wir... | true |
fb1d752668c79008646b64563f84bf6cdb8e8eb6 | Python | amithreddytadwai/Image-Classification-of-Abnormal-Red-Blood-Cells-Using-Decision-Tree-Algorithm | /final.py | UTF-8 | 7,675 | 2.71875 | 3 | [] | no_license | import tkinter
from tkinter import messagebox
from tkinter import simpledialog
from tkinter import filedialog
from tkinter.filedialog import askopenfilename
from tkinter import *
import numpy as np
import pandas as pd
from sklearn.metrics import classification_report,confusion_matrix,accuracy_score
fro... | true |
54dc1f2709f7fa41f1bd9f9ba46da62ad0a8f9b3 | Python | Thatsgaurav/niet-Python-Lab | /Problem Solving using Python Lab. Index/50.largest_of_three_numbers.py | UTF-8 | 468 | 4.4375 | 4 | [] | no_license | # WAP to find the largest of three numbers using user defined function
def find_largest(): #function definition
if(num1>=num2) and (num1>=num2):
largest=num1
elif(num2>=num1) and (num2>=num3):
largest=num2
else:
largest=num3
print("Largest number is",largest)
num1 =... | true |
58e604bbfb35444bf497e9845077a1565bed8147 | Python | tom99763/U-GAT-IT-implement | /model.py | UTF-8 | 10,675 | 2.515625 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.nn.functional as F
class ResBlock(nn.Module):
def __init__(self,channels):
super().__init__()
self.conv=nn.Sequential(
nn.ReflectionPad2d(1),
nn.Conv2d(in_channels=channels, out_channels=channels,
... | true |
3eda0cf33e5df0f6203f00e0722414db838b749c | Python | Madrant/leetcode | /python/204.Count-primes/test.py | UTF-8 | 2,363 | 3.09375 | 3 | [] | no_license | #!/usr/bin/python3
import unittest
from run import NaiveSolution, FastSolution, FastestSolution
class SolutionTest(unittest.TestCase):
def setUp(self):
self.solution = None
def test_2_countPrimes(self):
if not self.solution:
return
self.assertEqual(self.solution.countPr... | true |
82fc3589e63cd6c6586bd609babbbcd9cb405345 | Python | polpol0820/NLP100problems | /ch3/src/23.py | UTF-8 | 519 | 3.265625 | 3 | [] | no_license | #23. セクション構造
import json
import re
"""
reは正規表現
正規表現についてはもっと知る必要がありそう。。。
結構メンドクサイの塊
"""
json_open = open("./../jawiki-country.json","r")
for row in json_open:
row = json.loads(row)
if row["title"] == "イギリス":
txt_uk = row["text"]
break
pattern = r'^(\={2,})\s*(.+?)\s*(\={2,}).*$'
result ='\n'... | true |
564ccf80dc78f575f27cc6d4317e4fa2eb902e90 | Python | ADGEfficiency/nem-data | /nemdata/nemde.py | UTF-8 | 4,108 | 2.609375 | 3 | [] | no_license | import datetime
import pathlib
import typing
import warnings
import numpy as np
import pandas as pd
import pydantic
import requests
from rich import print
from nemdata import utils
from nemdata.config import DEFAULT_BASE_DIRECTORY
from nemdata.constants import constants
class NEMDETable(pydantic.BaseModel):
fre... | true |
413891bda1d7e24a47a95404f3f50fd849d80f94 | Python | kanav-raina/Automation-with-Selenium | /actions_demo.py | UTF-8 | 434 | 2.75 | 3 | [] | no_license | import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver=webdriver.Chrome("/home/kanav/Downloads/automation/chromedriver")
driver.get("https://google.com")
#Locate the search box element
search_box=driver.find_element_by_name("q")
time.sleep(5)
#type in your search query into... | true |
f3e151af1fc6f3109cca18fd9fb07d435e2700ca | Python | heman-oliver/chess | /pawn.py | UTF-8 | 2,046 | 3.5 | 4 | [] | no_license | import pygame
from constants import SQUARE_SIZE
from color import Color
class Pawn(object):
def __init__(self, row , col, board) -> None:
self.row = row
self.col = col
self.side = board.chess_board[row][col][0]
self.board = board
def draw_valid_moves(self, screen, valid_moves):... | true |
11bc1605e648110fca52ee65c4baf85255337c9b | Python | kongtianyi/cabbird | /leetcode/linked_list_cycle_II.py | UTF-8 | 490 | 2.921875 | 3 | [] | no_license | from structure.listnode import *
def detectCycle(head):
fast_p=slow_p=head
while fast_p and fast_p.next and fast_p.next.next:
fast_p=fast_p.next.next
slow_p=slow_p.next
if fast_p == slow_p:
fast_p=head
while slow_p != fast_p:
slow_p=slow_p.next
... | true |
cef574c4eaeb3c9675d569097ce3b1942f9f427d | Python | meyer-lab/ps-growth-model | /grmodel/pymcGrowth.py | UTF-8 | 8,880 | 2.796875 | 3 | [
"MIT"
] | permissive | """
This module handles experimental data, by fitting a growth and death rate for each condition separately.
"""
from os.path import join, dirname, abspath
import pandas
import numpy as np
import pymc3 as pm
import theano.tensor as T
fitKwargs = {"tune": 3000, "progressbar": False, "target_accept": 0.9}
def theanoC... | true |
f1faf4010a554b17696fe9aaa28c217c5fe3847a | Python | blackwings001/algorithm | /leetcode/51-100/_54_spiralOrder.py | UTF-8 | 1,681 | 3.625 | 4 | [] | no_license | class Solution(object):
def spiralOrder(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: List[int]
"""
result = []
if matrix == []:
return result
i = 0 # 第几圈,每圈的起点是matrix[i][i]
cur_row = len(matrix) # 第i圈的行数
cur_col = len(... | true |
11335239bcd4b5345e640e3a131202c1cf589972 | Python | teejaytanmay/Road-Accident-Severity | /Road_Accident_Severity.py | UTF-8 | 6,387 | 2.625 | 3 | [
"MIT"
] | permissive |
# coding: utf-8
# In[70]:
import numpy as np
import pandas as pd
#Visualisation Libraries
import matplotlib.pyplot as plt
get_ipython().magic(u'matplotlib inline')
import warnings
warnings.filterwarnings('ignore')
import seaborn as sns
from pandas.plotting import scatter_matrix
#Training and Preprocessing Librari... | true |
c6373d839c57dbdcc4efb916873f7ce6ff6372d0 | Python | JiaweiD/DecisionTree | /trees.py | UTF-8 | 7,366 | 3.09375 | 3 | [] | no_license | import operator
from math import log
#calculate Shannon Entrophy of a dataset
def calcShannonEnt(dataSet):
numEntries = len(dataSet)
labelCounts = {}
for featVec in dataSet:
currentLabel = featVec[-1]
if currentLabel not in labelCounts.keys():
labelCounts[currentLabel] = 0
... | true |
da7413af6b68f35a9f45552c7ecfc5262d0c8476 | Python | riverxieh/ariadne | /ariadne/matchers/visual_matchers.py | UTF-8 | 11,746 | 2.796875 | 3 | [] | no_license | import math
import numpy as np
import skimage.color
from scipy.stats import multivariate_normal
from scipy.stats import norm
import cv2
class VisualMatcher(object):
def __init__(self, ariadne):
self.ariadne = ariadne
def computeCost(self, n1, n2):
return 0.0
class SimpleColorMatcher(VisualM... | true |
b6154c000cb05d61825daddaa92f8794518fee21 | Python | SandyTaillan/projet-liens-web | /gestlien.py | UTF-8 | 2,448 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#
import requests
import urllib3
class Gestionlienweb:
"""Cette classe regroupe toute la gestion des liens valides ou non."""
def veriflien(self, monurl, mondepre):
"""Vérification de la validité du lien."""
# déclaration des variables
# variable declarat... | true |
a21df85e0b695dc1714301a1f088f27c1adc6ef3 | Python | Homyakin/FlaskLab | /database/database.py | UTF-8 | 1,303 | 2.96875 | 3 | [] | no_license | import sqlite3
from sqlite3 import Error
def create_connection():
""" create a database connection to the SQLite database
specified by db_file
:return: Connection object or None
"""
conn = None
try:
conn = sqlite3.connect('app/data/data.db')
except Error as e:
print(e)
... | true |
a05ed819105a92ab482f3496765f236012e0f945 | Python | drkiettran/mapreduce-py | /test/WordCountMapper_test.py | UTF-8 | 807 | 3.015625 | 3 | [] | no_license | import unittest
from app.WordCountMapper import WordCountMapper
from test.IOUtil import StringIO
import sys
class TestWordCountMapper(unittest.TestCase):
def setUp(self):
self.mapper = WordCountMapper()
self.captured_output = StringIO()
sys.stdout = self.captured_output
def tearDown(s... | true |
81a260a480f85da67d8f8b3459571313471f6d41 | Python | zaidhassanch/PointerNetworks | /T007_gen_words_spacy_vectors/main.py | UTF-8 | 1,805 | 2.703125 | 3 | [] | no_license | import torch.optim as optim
from generateData import batch
import config
import time
from pointerNetwork import PointerNetwork
import torch
import torch.nn as nn
import time
BATCH_SIZE = 32
EPOCHS = 10
STEPS_PER_EPOCH = 100
def train(pNet, optimizer, epoch, clip=1.):
"""Train single epoch"""
print('Epoch [{}] -- ... | true |
6dcb109eabb3126a94c0a153562ebd879cb47ba2 | Python | VELA-CLARA-software/Software | /Apps/AlignOnBPMs/SimulationFramework/Modules/read_gdf_file.py | UTF-8 | 9,798 | 2.515625 | 3 | [] | no_license | """Reads in files from General Particle Tracer .gdf files
"""
from __future__ import division
# from pylab import *
import time
import struct
import os
import sys
import numpy as np
#Constants
GDFNAMELEN = 16; #Length of the ascii-names
GDFID = 94325877; #ID for GDF
#Data types
t_ascii ... | true |
8bb17a007730f2c60b3965c171cd3b68637af165 | Python | hengyuan-hu/dqn-hw | /model.py | UTF-8 | 9,654 | 2.828125 | 3 | [] | no_license | """Implement the Q network as a torch.nn Module"""
import torch
import torch.nn as nn
from torch.autograd import Variable
import utils
class QNetwork(nn.Module):
def __init__(self, num_frames, frame_size, num_actions, optim_args, net_file):
"""
num_frames: i.e. num of channels of input
fra... | true |
99616e51b80c7512c707ba78aae9965995e040c5 | Python | bunkov/informatics | /2.Work24/Caesar.py | UTF-8 | 1,305 | 3.359375 | 3 | [] | no_license | class Caesar:
alphabet = "абвгдеёжзийклмнопрстуфхцчшщъыьэюя"
def __init__(self, key):
lowercase_code = {self.alphabet[i]:self.alphabet[(i+key)%len(self.alphabet)] for i in range(len(self.alphabet))}
uppercase_code = {self.alphabet[i].upper():self.alphabet[(i+key)%len(self.alphabet)].upper() for i in range(len(se... | true |
e1f3fb677bcd9fc0d7ab6f00d41ac7dd87a8668c | Python | dww100/bac | /common/test_pdb_io.py | UTF-8 | 1,124 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | # This Test opens a simple pdb file (data/init_pdbs/pr/1mui_wat.pdb)
# It then attempts to manipulate this file using MDAnalyis.
from pdb_io import *
from operator import itemgetter, attrgetter
from nose.tools import assert_equals
data_dir = "../data"
def test_load_pdb_file():
load_pdb("%s/init_pdbs/pr/1mui_wat.p... | true |
a3d7aefc9aeb825a4e97248bcf8cc1c1eb9c5937 | Python | feizhihui/Coursera-Python-Repo | /lecture_4/pandas_plot.py | UTF-8 | 204 | 2.953125 | 3 | [] | no_license | # encoding=utf-8
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
x = np.linspace(0, 1)
y = np.sin(4 * np.pi * x) * np.exp(-5 * x)
t = pd.DataFrame(y, index=x)
t.plot()
plt.show()
| true |
f0b3abc16201d520f5b4383dc8aef1f0384903c8 | Python | olchowik/d_repo | /typeii/typeii/enzymes/models_old.py | UTF-8 | 5,173 | 2.671875 | 3 | [] | no_license | from django.db import models
class Genome(models.Model):
#genome name
name = models.CharField(unique=True, max_length=70)
#This is what gets printed when we call this objects
def __unicode__(self):
return 'Genome of: ' + self.name
class DNAPiece(models.Model):
#Reference to the... | true |
4403d5fd6eb14684c13678dd48677274caaddf53 | Python | AdelkaPa/pytest_travis_demo | /test_fizzbuzz.py | UTF-8 | 888 | 3.125 | 3 | [] | no_license | from fizzbuzz import fizzbuzz
import pytest
def test_fb_is_callable():
fizzbuzz(1)
def test_fb_returns_str():
assert isinstance(fizzbuzz(1), str)
@pytest.mark.parametrize('num', [1, 2, 4])
def test_fb_regular_is_self(num):
assert int(fizzbuzz(num)) == num
@pytest.mark.parametrize('num', [3, 6, 9])... | true |
15c294f43db9d19ed2a2176ab1c504042112c06a | Python | 15cs026priyanka/yuvankrish123 | /index2.py | UTF-8 | 284 | 3.546875 | 4 | [] | no_license | a=int(input("enter the number ")):
while (1)
while (i < n) && ((i+arr[i]) % 2 == 0)
i++
while (0 <= j) && ((j+arr[j]) % 2 == 0)
j++
if j <= i
break
swap(arr[i], arr[j])
print(" display the sorted number in index")
| true |
cda8ef9e8c58850232ec3faa99884e7bc7c21380 | Python | dvir88/finewoodworking-datascience-python | /datasetHandler.py | UTF-8 | 4,270 | 3.34375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import os
import seaborn as sns
"""
Pandas
"""
def save_post_dataset(data):
df = pd.DataFrame.from_dict(data)
if not os.path.exists('./finewood_articles.csv'):
df.to_csv('finewood_articles.csv', mode='w', index=False, header=True)
... | true |
8bcd6b7bc7029b05079f30f490dcad9b6f00ba55 | Python | begibeggineta/Gso_Git | /git_gso.py | UTF-8 | 328 | 3.046875 | 3 | [] | no_license | #Bergþór Ingi Birgirsson
#GSÖ2
#25.1.2017
Text = input("veldu hvað txt skjalið á að heita")
F = open(Text+".txt","w+")
F.write("Hello my honey Hello my baby hello my night time gaaal")
F.close()
F = open(Text+".txt","+w")
innhald = input("Hvað viltu skrifa inn í texta skjalið")
for i in range(0,3):
F.write(innhald... | true |
e5b500b79a6a44bb7e4d9673246e6db83248f962 | Python | 1082sqnatc/missionspacelab2019 | /testdaynight.py | UTF-8 | 676 | 2.546875 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-proprietary-license"
] | permissive | #!/usr/bin/python3
import time
from os import listdir
from src.dayornight import isDay
#def take_picture():
# print("pic taken")
# TODO main executable file, pulls in cadets' libraries from lib fold
def main():
files = listdir ("../Sample_Data/")
for fname in files:
print (str("Processing" + fname)... | true |
7f094780c5e0c8b9beb3a899f5e611ec8177a987 | Python | fengpenghui/proj01 | /qytang/news.py | UTF-8 | 186 | 2.671875 | 3 | [] | no_license | #! /usr/bin/env python3
# coding: utf-8
# github: https://github.com/fengpenghui
# 码云: https://gitee.com/fengpenghui0923
yuyan=input()
new= yuyan[1:]+'-'+yuyan[0]+'y'
print(new)
| true |
a148cb061a71cd74fa737e79d0a0895c9b3c34a3 | Python | ShuNayak/LeetCode | /ZombieSearch.py | UTF-8 | 1,045 | 3.28125 | 3 | [] | no_license | from typing import List
import collections
class Solution:
def makeZombie(self, grid: List[List])->int:
if grid is None or len(grid)==0:
return -1
human = 0
zombie = collections.deque()
for i in range(len(grid)):
for j in range(len(grid[0])):
... | true |
90ce6a9a8c37c442ad56f8d72fbfe8f32193c890 | Python | zszzlmt/leetcode | /solutions/46.py | UTF-8 | 815 | 3.1875 | 3 | [] | no_license | class Solution(object):
res = []
def generate(self, l, travel, left):
if left == 0:
self.res.append(l)
return
for idx in range(len(travel)):
if travel[idx] == 0:
travel[idx] = 1
self.generate(l + [self.nums[idx]], travel, left ... | true |
0023b26f212248f811f16a21a6bb6c05d7b2e8d9 | Python | no7dw/py-practice | /property/h.py | UTF-8 | 135 | 3.265625 | 3 | [] | no_license | class Human():
def __init__(self):
pass
@property
def name(self):
return "Wade"
h = Human()
print(h.name)
| true |
53333bfa5759e8064c2b86d7cb435679502efdc4 | Python | ShiinaMashiro1314/Project-Euler | /Python/301.py | UTF-8 | 71 | 3.109375 | 3 | [] | no_license | a = 2
b = 3
for i in xrange(29):
temp = a
a = b
b = a+temp
print a | true |