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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
0aeb4c0f3c5d7bce7dfd338337afb5ed89f67e14 | Python | adilsonLuz/OficinaPython | /O2-Ex-027.py | UTF-8 | 203 | 3.1875 | 3 | [] | no_license | lista = [ "b", "d", "c", "a", "z", "f", "x", "a", "a"]
print("\n lista ")
print(lista)
print("\n quantidade de a: ")
print(lista.count("a"))
print("\n quantidade de z: ")
print(lista.count("z"))
| true |
ea408204a993c32cae3bdbfb5ae3687e9a77f7e6 | Python | YanisAhdjoudj/Regression_Lineaire_Scratch | /1_Programs/1_linear_regression_main.py | UTF-8 | 2,351 | 2.671875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Nov 14 22:04:19 2021
@author: yanis
"""
import os
from datetime import date
from datetime import datetime
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from scipy import stats
from scipy.special import ndtri
# Main class : Li... | true |
be611f2c6b48375e50441995aadf1d37be4bc778 | Python | AndreaPicasso/NLFF | /model/benchmark/rule_classifier.py | UTF-8 | 6,660 | 2.5625 | 3 | [] | no_license |
import pandas as pd
import numpy as np
import tensorflow as tf
import math
from datetime import datetime, timedelta
from sklearn import preprocessing
from sklearn.metrics import confusion_matrix
from math import sqrt
import matplotlib.pyplot as plt
#tf.logging.set_verbosity(tf.logging.INFO)
skip_vector_dim = 7
n_y... | true |
bad4cb76164639622428588b9e0f90b6566b7de7 | Python | RasmusSpangsberg/TankGame | /TankGame.py | UTF-8 | 4,768 | 3.5625 | 4 | [] | no_license | import pygame
from math import pi, sqrt
pygame.init()
display_width = 800
display_height = 600
game_display = pygame.display.set_mode((display_width, display_height))
clock = pygame.time.Clock()
class Tank:
def __init__(self, pos_x, pos_y, width, height, color, is_enemy=False):
self.pos_x = pos_x
self.pos_y = po... | true |
52aeb42fe1d034e8bc6db2f7ea134aad44ce451f | Python | bradywatkinson/2041ass1 | /myTests/sub3.py | UTF-8 | 855 | 3.78125 | 4 | [] | no_license | #!/bin/usr/python -w
import sys
# Finding squares
x = 2
print "Squares between 4 and 256"
while x < 101:
x = x ** 2
print x
for i in range(2): print i
#print a checker board thing
print
print "Checkers!"
sys.stdout.write("Enter a number plz: ")
s = int(int(int(sys.stdin.readline())))
for x in range(s):
... | true |
6fdbbe35bbb281dd95d6bd1fc86c37d7c3c01e8a | Python | sebaslherrera/algorithmic-toolbox | /week3_greedy_algorithms/7_maximum_salary/largest_number.py | UTF-8 | 564 | 4 | 4 | [
"MIT"
] | permissive | #Uses python3
def isGreaterOrEqual(a, b):
"""Compare the two options and choose best permutation"""
ab = str(a) + str(b)
ba = str(b) + str(a)
if ab > ba:
return a
else:
return b
def largest_number(a):
ans = ''
while a:
maxDigit = 0
for digit in a:
... | true |
7ad5d8573273b71b40b29cc67555c1e08a5a2d9a | Python | Doreen162/Python-Exercises | /Import math.py | UTF-8 | 140 | 3.578125 | 4 | [] | no_license | # Variables to be use
a = 8
b = 2
c = 1
d = 4
# Equation to solve x
x = math.sqrt(a - 3) / (b * b + c * c + d * d)
# Answer to x
print(x) | true |
62da70ddf65942fed3274efd34af62c200119d41 | Python | FrostyX/fedora-infra-ansible | /roles/modernpaste/files/paste-info.py | UTF-8 | 458 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python
import sys
sys.path.append('/usr/share/modern-paste/app')
import modern_paste
from util.cryptography import get_decid
from database.paste import get_paste_by_id
paste_id = get_decid(sys.argv[1])
paste = get_paste_by_id(paste_id)
print('Decrypted ID: ' + str(paste_id))
print('Title : ' + pa... | true |
9ecfc948dad462445bf740f4a2ba63b249a17e14 | Python | ongaaron96/kattis-solutions | /python3/1_4-apaxiaaans.py | UTF-8 | 147 | 3.8125 | 4 | [] | no_license | name = input()
prev_char = result = ''
for char in name:
if char == prev_char:
continue
result += char
prev_char = char
print(result)
| true |
c841fab634b2bafa92c00ab19dec4838feb99c33 | Python | NEWPLAN/mars_torch | /Network/critic.py | UTF-8 | 1,081 | 2.78125 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.nn.functional as F
class Critic(nn.Module):
def __init__(self, input_size, hidden_size, output_size):
super(Critic, self).__init__()
self.linear1 = nn.Linear(input_size, hidden_size)
self.linear2 = nn.Linear(hidden_size, hidden_size)
... | true |
1afd3222471e9553b92214e4a0b31701cdb91b8d | Python | estroud1991/Python-Examples | /guassianFilterGenerator 2.py | UTF-8 | 1,820 | 3.171875 | 3 | [] | no_license | import math
import numpy as np
import cv2
def generateGuass():
sigma = float(input("Please enter your sigma/variance: "))
size = int(input("Please enter the size of the guassian filter, must be odd: "))
x = int((size-1)/2)
valueList = []
for i in range(-x,x+1,1):
for j in range(-x,x... | true |
54cc45c52157b696ca2598e53160c60c892e34ea | Python | dionvargas/TCCII | /Software Pi/util.py | UTF-8 | 6,404 | 2.671875 | 3 | [] | no_license | import cv2
import numpy as np
import json
import os
from PIL import Image, ImageTk
def removeReflexos(frame):
image_in = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) # Load the glared image
h, s, v = cv2.split(cv2.cvtColor(image_in, cv2.COLOR_RGB2HSV)) # split into HSV components
ret, th = cv2.th... | true |
16c9b3c13109619e80fb37eea9d02583a5ae963f | Python | clean-exe/coctail-monaco | /main.py | UTF-8 | 5,024 | 3.75 | 4 | [
"MIT"
] | permissive | #!/usr/bin/python3
import random
""" This is a simple program that simulate a coctail monaco game.
Enter a list of players, and the program will get 1 out per time. """
# global person_id
class Person:
"""Simple person class with First and Second name."""
def __init__(self, uid, first_name, family_name):
... | true |
a3d47f333bb0f79164b2df4c670ccdfc5480d6e5 | Python | Iceman1590/AT-TVectorAirgig | /Project Files/Basic Navigation/Distance2.py | UTF-8 | 691 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | import anki_vector
from anki_vector.util import degrees, distance_mm, speed_mmps
import time
args = anki_vector.util.parse_command_args()
with anki_vector.Robot() as robot:
for _ in range(10):
if robot.proximity.last_sensor_reading:
distance = robot.proximity.last_sensor_reading.distance
prox = dista... | true |
4b55ba88e94c14aada58799d9ea2e6db07c59836 | Python | pixelsomatic/python-notes | /teste_operador.py | UTF-8 | 618 | 4.46875 | 4 | [] | no_license | import math
# Anterior e Sucessor
num = int(input('Digita um número aí: '))
ant = num - 1
suc = num + 1
print('O número antes de {} é {} e o depois dele é {}'.format(num, ant, suc))
# Dobro, Triplo e Raiz quadrada
n = int(input('Manda um número: '))
d = n * 2
t = n * 3
r = math.sqrt(n)
# print('O dobro de {} é {}'... | true |
1bbf880bcd02e5634b53fe4ef7952cca15022580 | Python | recepsirin/djforeingkeys | /src/cars/models.py | UTF-8 | 1,799 | 2.53125 | 3 | [] | no_license | from django.conf import settings
from django.contrib.auth import get_user_model
from django.db import models
# Create your models here.
User = settings.AUTH_USER_MODEL # 'auth.User'
def set_delete_user():
user_inner = get_user_model()
return user_inner.objects.get_or_create(username='deleted')[0] # get_or... | true |
54656694fcf829a734f32fc3d6b81c60dddb2647 | Python | gscho74/ImageProcessing | /중간고사/Ex3.py | UTF-8 | 1,995 | 2.828125 | 3 | [] | no_license | import numpy as np
from scipy import signal, misc
import matplotlib.pyplot as plt
from scipy import ndimage
from mpl_toolkits.mplot3d import Axes3D
sigma = 30
x=np.arange(-128,127,1.0)
y=np.arange(-128,127,1.0)
X,Y=np.meshgrid(x,y)
s=1/(np.pi*pow(sigma,4))
a=-(pow(X,2)+pow(Y,2))/(2*pow(sigma,2))
g=-s*(1+a)*np.exp(a)... | true |
1f1e90bfc00e17f42c9ad4a4e6b88ff6ea6b0a19 | Python | sauln/pyjanitor | /tests/io/test_read_csvs.py | UTF-8 | 3,953 | 3.109375 | 3 | [
"MIT"
] | permissive | import glob
import os
import pandas as pd
import pytest
from janitor import io
CSV_FILE_PATH = "my_test_csv_for_read_csvs_{}.csv"
def create_csv_file(number_of_files, col_names=None):
for i in range(number_of_files):
filename = CSV_FILE_PATH.format(i)
df = pd.DataFrame([[1, 2, 3], [1, 2, 3], [1... | true |
833c5c511902809b809cd9e409968122089f8171 | Python | danielobmann/desyre | /imports/util.py | UTF-8 | 3,215 | 2.78125 | 3 | [] | no_license | import os
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1.inset_locator import *
class Util:
def __init__(self):
pass
@staticmethod
def cosine_decay(epoch, total, initial=1e-3):
return initial / 2. * (1 + np.cos(np.pi * epoch / tota... | true |
e8e361978849a99143b5fec93063b920de2ba0f5 | Python | andrezzadede/Curso_Python_Guanabara_Mundo_1 | /Exercicios/1Exercicio.py | UTF-8 | 244 | 3.390625 | 3 | [
"MIT"
] | permissive | print ('Script Aula 1 - Desafio 1')
print ('Crie um script python que leia o nome de uma pessoa e mostra uma mensagemde boas vindas de acordo com o valor digitado')
nome = input ('Qual seu nome?')
print ('Seja bem vindo gafanhoto', nome)
| true |
6a2e32d90d8c3127007d8bbd935e043ddca0ef06 | Python | JoaoPedroBarros/exercicios-antigos-de-python | /Exercícios/Exercícios Mundo 1/ex009.py | UTF-8 | 488 | 3.46875 | 3 | [
"MIT"
] | permissive | i = int(input('Digite um número:'))
print('A tabuada de {} é a seguinte:'.format(i))
print('\033[1;40m{}\033[m'.format(i*1))
print('\033[1;41m{}\033[m'.format(i*2))
print('\033[1;42m{}\033[m'.format(i*3))
print('\033[1;43m{}\033[m'.format(i*4))
print('\033[1;44m{}\033[m'.format(i*5))
print('\033[1;45m{}\033[m'.format(i... | true |
0693d7d9c6d8cefafed41398c30c25afbef91a8a | Python | sophiepopow/ASD-AGH | /Graphs/TopologicalSorting.py | UTF-8 | 635 | 3.859375 | 4 | [] | no_license | #Algorytm z wykorzystaniem DFS
def topologicalDFS(graph, vertex,visited, sortedNodesStack):
visited[vertex] = True
for neighbour in graph[vertex]:
if not visited[neighbour]:
topologicalDFS(graph,neighbour, visited, sortedNodesStack)
sortedNodesStack.insert(0,vertex)
def topologicalS... | true |
507f9fbc65f16fc67fd844fde94824b571dca09b | Python | hyoseok-bang/leetcode | /215_kth_largest_element_in_an_array.py | UTF-8 | 801 | 3.4375 | 3 | [] | no_license | class Solution(object):
def findklargest_push(self, nums, k):
# Use heappush
heap = []
for n in nums:
heapq.heappush(heap, -n)
for _ in range(1,k):
heapq.heappop(heap)
return -heapq.heappop(heap)
def findklargest_heapify(sel... | true |
219360782b0d3e3910a10f7739c1249858025b7d | Python | jiravani/PythonProjects | /Project/driverscanner/Volume.py | UTF-8 | 708 | 3.078125 | 3 | [] | no_license | class Volume:
total_volumes = 0
file_system = ""
def __init__(self, name, volume_name):
self.name = name
self.volume_name = volume_name
Volume.total_volumes += 1
print self.name + " " + "{:>10}".format(volume_name)
def get_volume_name(self):
print self.volume_... | true |
c9749a5159200f24aefcdc763978539476a4fddd | Python | torebre/essentia_test | /python/MicrophoneInput.py | UTF-8 | 827 | 2.546875 | 3 | [] | no_license | import pyaudio
import wave
CHUNK = 256
FORMAT = pyaudio.paInt16
CHANNELS = 2
RATE = 44100
RECORD_SECONDS = 10
WAVE_OUTPUT_FILENAME = 'output3.wav'
p = pyaudio.PyAudio()
print("Default input: ", p.get_default_input_device_info())
stream = p.open(format=FORMAT,
channels=CHANNELS,
rat... | true |
da87090e80b9157e9de7272813d053a5049715d2 | Python | meera-ramesh19/codewars | /homework/pycaptestanswers/pycaptest.py | UTF-8 | 1,169 | 4.3125 | 4 | [] | no_license | print(2 ** 3 ** 2 ** 1)
a = 0
b = a ** 0
if b < a + 1:
c = 1
elif b == 1:
c = 2
else:
c = 3
print(a + b + c)
for i in range(1, 4, 2):
print("*")
# Example 2
for i in range(1, 4, 2):
print("*", end="")
for i in range(1, 4, 2):
print("*", end="**")
print("\n")
for i in range(1, 4, 2):
print... | true |
0820faa61dad8e69bb8e390ed1c38aae10641949 | Python | nthiery/sage-semigroups | /sage_semigroups/monoids/free_partially_commutative_left_regular_band.py | UTF-8 | 13,659 | 2.6875 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | r"""
Free partially commutative left regular band
EXAMPLES::
sage: import sage_semigroups
Loading sage-semigroups and patching its features into Sage's library: ...
"""
from functools import reduce
from sage.structure.unique_representation import UniqueRepresentation
from sage.structure.parent import Parent... | true |
6e453f8488772fb30e002a5ba1e321c5c874d470 | Python | hyunjun/practice | /python/problem-string/determine_if_string_halves_are_alike.py | UTF-8 | 1,237 | 3.953125 | 4 | [] | no_license | # https://leetcode.com/problems/determine-if-string-halves-are-alike
class Solution:
# runtime: 36 ms, 65.55%
# memory: 14.3 MB, 68.01%
def halvesAreAlike0(self, s: str) -> bool:
m, s, vowels, c = len(s) // 2, s.lower(), set(['a', 'e', 'i', 'o', 'u']), 0
for i in range(m):
... | true |
b8b5345bea1566f1420fecca0ba76c194ac9ba3b | Python | fox-io/udemy-100-days-of-python | /day_018.py | UTF-8 | 1,999 | 3.734375 | 4 | [] | no_license | """
-----
Day 18 Project: Turtle
-----
(c)2021 John Mann <gitlab.fox-io@foxdata.io>
"""
from turtle import Turtle, Screen
import random
# Shapes with 3-10 sides, random colors
# def main():
# t = Turtle()
# for sides in range(3, 11):
# t.color((random.random(), random.random(), random.random()))
# ... | true |
601683f955403de094466e36cbd659e9e15a09a3 | Python | mahagony/Pi-DigiAMP | /iqmute.py | UTF-8 | 1,153 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python3
import sys, os
import argparse
import pigpio
class IQaudIO:
def __init__(self):
self.port = 22
self.pi = pigpio.pi()
self.pi.set_mode(self.port, pigpio.OUTPUT)
def output(self, value):
self.pi.write(self.port, value)
def mute(self):
self.outp... | true |
be86b8c745f240cba43fd5306935b6573cb58b9f | Python | awesomepotato2016/applied-cs | /Lab03.py | UTF-8 | 1,887 | 3.421875 | 3 | [] | no_license | #Name: Karthik and Vivian
#Date: 10/04/2019
from random import random
inp = int(raw_input("Enter 1 or 2: "))
# 1 gives the percent of Trials where First Step matches Final Direction
# 2 gives the percent of Trials where First Edge matches Final Direction
if inp == 1:
matchnum = []
... | true |
c551cb75cf1efb226c4570332abb6293a331ddea | Python | sjlee4108/robot-deliverer | /scripts/deleted.py | UTF-8 | 3,141 | 3 | 3 | [] | no_license | # IGNORE: deleted files
# updates robot packages and weight accordingly
def add_package(self, package):
# adds package to robot and adds to robot weight
self.robot_packages.add(package)
self.robot_weight += self.package2weight[package]
def remove_package(self, p... | true |
1465d4630d106f306cf54fb7958fc7cbada3fd15 | Python | tnyng/dnn | /sheet1/layers.py | UTF-8 | 738 | 3.109375 | 3 | [] | no_license | import numpy
class Sequential:
def __init__(self,layers): self.layers = layers
def forward(self,Q):
for l in self.layers: Q = l.forward(Q)
return Q
def backward(self,DQ):
for l in self.layers[::-1]: DQ = l.backward(DQ)
return DQ
class Linear:
de... | true |
4f861ef88bd341e90107ee10438395d4d0620548 | Python | sebbacon/bbc-radio-schedules | /bbcradio/cli.py | UTF-8 | 2,415 | 3.0625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# encoding: utf-8
"""
bbcradio.cli
------------
This module implements a CLI using the unofficial bbcradio API.
Copyright (c) 2021 Steven Maude
Licensed under the MIT License, see LICENSE.
"""
import argparse
import sys
import bbcradio
import requests
def list_stations():
"""Retrieves a l... | true |
fc39cfc2ced142c49d507c0608f794e035a50215 | Python | haohaiwei/hhw | /code/python/pygame/game_functions.py | UTF-8 | 1,785 | 2.984375 | 3 | [] | no_license | import sys
import pygame
from bullet import Bullet
'''def check_events():
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()'''
'''def check_events(ship):
for event in pygame.event.get():
if pygame.KEYDOWN==event.type:
if event.key == pygame.K_RIG... | true |
f2dbcd98c9e4a15391c836cb89422e6b7e7108f7 | Python | franciscoquinones/Python | /clase4/clase/main.py | UTF-8 | 492 | 2.875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Dec 17 16:52:09 2016
@author: Josue
"""
#Importar archivos py nos permite,emplear o reutilizar
#las posibles funciones o clases
import texto
import saludo
import primo
#Instanciamos del modulo texto la clase saludo
juan=texto.saludo()
#condicion que nos permit... | true |
2917236c53af22dd621316f71d969a1af9f8ab25 | Python | skylin008/uPython-switch-control | /relay.py | UTF-8 | 1,109 | 2.75 | 3 | [
"MIT"
] | permissive | # Micropython PIR Switch Control
# Erni Tron ernitron@gmail.com
# Copyright (c) 2016
import time
from machine import Pin
# The Relay Switch Class
class Relay():
# D8 GPIO15 Pin(15)
# D5 GPIO14 Pin(14)
# D0 GPIO0 Pin(0)
def __init__(self, p=14, sensor='relay', place='nowhere', server=''):
self... | true |
a3de0405b680edc6c64ee56b8945e0253681d762 | Python | alisonkozol/CellProfiler | /cellprofiler/modules/loaddata.py | UTF-8 | 67,790 | 3.3125 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | '''<b>Load Data</b> loads text or numerical data to be associated with images, and
can also load images specified by file names.
<hr>
This module loads a file that supplies text or numerical data associated with
the images to be processed, e.g., sample names, plate names, well
identifiers, or even a list of image file... | true |
9d2a97330a0eca83f1a863dc9cd560042391433e | Python | Erik0x42/Netscape-Bookmarks-File-Parser | /NetscapeBookmarksFileParser/__init__.py | UTF-8 | 5,577 | 3.078125 | 3 | [
"MIT"
] | permissive | from dataclasses import dataclass
non_parsed = dict() # lines not parsed
@dataclass
class BookmarkItem:
"""
Represents an item in the bookmarks. An item can be a folder
or an shortcut (can be feed or web slice too, but it's rare nowadays).
"""
num: int = 0 # the position of the item in the fold... | true |
5d281540d41f3f9f3a073db55f0bb2441f363951 | Python | yongtal/CS6381 | /project/Top_method/mr_mapworker.py | UTF-8 | 5,565 | 3.140625 | 3 | [] | no_license | #!/usr/bin/python
#
# Vanderbilt University, Computer Science
# CS4287-5287: Principles of Cloud Computing
# Author: Aniruddha Gokhale
# Created: Nov 2016
#
#
# Purpose:
# This code runs the wordcount map task. It runs inside the worker process. Since the
# worker gets commands from a master and sends result back to t... | true |
5a44cf718a1037c61af7ff6d7c178ceed4c87c18 | Python | XuShaoming/CompVision_ImageProc | /project1/code/mycv.py | UTF-8 | 487 | 3.53125 | 4 | [] | no_license | def resize_shrink(matrix, fx, fy):
"""
Purpose:
shrink a matrix given fx and fy.
Input:
fx: resize on column
fy: resize on row
Output:
shrink matrix list
"""
fx_inv = int(1 / fx)
fy_inv = int(1 / fy)
res = []
for i in range(0, len(matrix), fy... | true |
f4de79a5d92973ae9c2985a277467e12681e1e17 | Python | arwaahmedf/tasks | /mass.py | UTF-8 | 613 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[5]:
from pyopenms import *
seq = AASequence.fromString("VAKA")
V_weight=seq.getMonoWeight()
A_weight=seq.getMonoWeight()
K_weight=seq.getMonoWeight()
A_weight=seq.getMonoWeight()
print("Monoisotopic mass of peptide [V] is ",V_weight)
print("Monoisotopic mass of peptide [A]... | true |
4b49ae86aec50a383ed20bb3ba56bb5107f58f90 | Python | 18bcs6526/Python | /fbbonaci.py | UTF-8 | 113 | 3.546875 | 4 | [] | no_license | a=0
b=1
x=int (input("enter the number"))
print('0')
for i in range (0,x):
c=a+b
a=b
b=c
print(c) | true |
93a5205b2167481c4725605629813b2c04fa2821 | Python | realpython/materials | /python-311/units.py | UTF-8 | 714 | 3.015625 | 3 | [
"MIT"
] | permissive | import pathlib
import tomllib
with pathlib.Path("units.toml").open(mode="rb") as file:
base_units = tomllib.load(file)
units = {}
for unit, unit_info in base_units.items():
units[unit] = unit_info
for alias in unit_info["aliases"]:
units[alias] = unit_info
def to_baseunit(value, from_unit):
... | true |
de4cd82d9d1402b819fe0bbfa234f1ebc62d3e60 | Python | Fredy/UCSP-Bioinspirada | /lab_3/lab_3.py | UTF-8 | 5,823 | 2.984375 | 3 | [
"MIT"
] | permissive | """Lab 3: Genetic Algorithms"""
from random import random, randrange, sample, choice
from sys import argv
from copy import deepcopy
from math import sin, sqrt
import numpy as np
from fitness import calc_fitnesses, linear_normalization
from operators import crossovers, mutation
from selection import selections, elitism
... | true |
7ba8324637b222baa4334489f68834cfc5e13076 | Python | alejandrosd/Ejercicio-Fibonacci | /fibonacci.py | UTF-8 | 805 | 3.609375 | 4 | [] | no_license | #-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: Estudiantes
#
# Created: 13/10/2017
# Copyright: (c) Estudiantes 2017
# Licence: <your licence>
#-------------------------------------------------------------------------------
... | true |
37a4e03e010ad6ecdc7f3442300e84abd9b77cd4 | Python | Thelordofdream/Deep-Learning | /mnist in Attensive Reader/application.py | UTF-8 | 1,856 | 2.515625 | 3 | [] | no_license | # coding=utf-8
import os
os.chdir("../")
import tensorflow as tf
import model
import matplotlib.pyplot as plt
import numpy as np
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data", one_hot=True)
def predict(model, pred_num, sess):
saver = tf.train.Saver()
... | true |
7f3f3f4e692bb307bdda07260475f8581e4946c6 | Python | byAbaddon/Book-Introduction-to-Programming-with----JavaScript____and____Python | /Pyrhon - Introduction to Programming/8.2. Exam Preparation - Part II/06. Letters Combinations.py | UTF-8 | 362 | 3.25 | 3 | [] | no_license | n1, n2, n3 = [ord(input()) for _ in range(3)]
res = ''
count = 0
for i in range(n1, n2 + 1):
for j in range(n1,n2 + 1):
for k in range(n1,n2 + 1):
if i != n3 and j != n3 and k != n3:
res += chr(i) + chr(j) +chr(k) + ' '
count+= 1
print(f'{res}{count}')
'''
a
c... | true |
27a1a22845aeedddb72639fd27c3af0fc662def0 | Python | chriskaravel/Python_Machine_Learning_Flight_Delay_Prediction | /test.py | UTF-8 | 2,981 | 3.15625 | 3 | [] | no_license | import pandas as pd
import numpy as np
import sklearn
from sklearn import linear_model
from sklearn.utils import shuffle
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn import metrics
import matplotlib.pyplot as plt
from matplotlib import style
impor... | true |
019be973d4ab6a70b82605be50b437ff701425df | Python | Nom0ri/Pyton_snake_game | /pyton.py | UTF-8 | 3,714 | 3.3125 | 3 | [] | no_license | import pygame
import time
import random
pygame.init()
white = (255, 255, 255)
black = (0, 0, 0)
red = (255, 0, 0)
#window size
win_y = 600
win_x = 800
window=pygame.display.set_mode((win_x,win_y))
pygame.display.update()
pygame.display.set_caption('Pyton by Nomori')
snek_size = 10
clock = pyga... | true |
6aa7f2a8eafa6415c6bf5b86d62bf55d4360388f | Python | Masum-Osman/pythonista | /ZKM/ds2/tree.py | UTF-8 | 188 | 3 | 3 | [] | no_license | class TreeNode:
def __init__(self, val):
self.left = None
self.right = None
self.val = val
class BinaryTree:
def __init__(self):
super().__init__() | true |
f5705678ce0a8401ab438f1a49c68e1d4ec79ff3 | Python | AdamJozwiak/PBL_Endless_Project | /Executable/convert-unity.py | UTF-8 | 2,084 | 2.859375 | 3 | [] | no_license | # Imports
import sys
import pathlib
# Read program arguments
arguments = None
if len(sys.argv) == 1:
arguments = ["."]
else:
arguments = sys.argv[1:]
# Transform arguments into paths
input_paths = [pathlib.Path(argument) for argument in arguments]
# Make a list of all files to convert
filenames = []
for inpu... | true |
38402d4c2a9a8605fba48e9049aed69a5f7b14ee | Python | serban-hartular/OnlineParser | /cgi-bin/gram/rule_builder.py | UTF-8 | 5,768 | 2.703125 | 3 | [] | no_license |
# format:
# "VP[mod=Ind head=verb] -> subj:NP[nr=@ pers=@ case=N] , verb:V"
import re
from constraints import Constraint, OverwriteConstraint
from nodes import Monomial
from rules import *
DEFAULT_ERROR_SCORE = 1.0
EQUALS = '='
OVERWRITE = '~'
NONE_NOT_OK = '=='
def constraint_from_string(string : str, l_deprel:s... | true |
1b9f2a27b6962d0fd61d0037e0e87abef01ef3b2 | Python | sevenhe716/LeetCode | /HashTable/q049_group_anagrams.py | UTF-8 | 2,069 | 3.609375 | 4 | [] | no_license | # Time: O(n)
# Space: O(1)
# 解题思路:
# 一种思路是利用位置无关的特性,如sum,利用hash做初选,然后再用Counter再次分类
# 另一种思路则是利用hash一步到位,但是需要5*26个bit的大整型,且每个字母个数不能大于32个
# 优化思路:其实无需生成hash,字符串本身可以作为key,利用map来分组
class Solution:
def groupAnagrams(self, strs):
"""
:type strs: List[str]
:rtype: List[List[str]]
"""
... | true |
8875eb68f04d67372b4e7956d6826fcbab4e6c25 | Python | ymink716/PS | /BOJ/BaaarkingDog/0x11_그리디/2847.py | UTF-8 | 462 | 3.296875 | 3 | [] | no_license | # 게임을 만든 동준이
# https://www.acmicpc.net/problem/2847
n = int(input())
scores = []
for _ in range(n):
scores.append(int(input()))
answer = 0
# 뒤에서 부터 순회
for i in range(n - 1, 0, -1):
# i -1 점수 >= i 점수
if scores[i - 1] >= scores[i]:
cnt = scores[i - 1] - scores[i] + 1 # 이 구간에서 감소 횟수
scores[... | true |
60f37cbb20cb76ef905068fa06d64ce8d6b7870c | Python | Aasthaengg/IBMdataset | /Python_codes/p03096/s312768742.py | UTF-8 | 455 | 2.703125 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding:utf-8 -*-
def main():
MAX = 10**9 + 7
n = int(input())
lc = [int(input()) for _ in range(n)]
dp = [0] * (n)
last_is = [-1]*(2*10**5+1)
dp[0] = 1
last_is[lc[0]] = 0
for i,c in enumerate(lc[1:], 1):
last_i = last_is[c]
dp[i] = dp[i-1]
if last_i != -1 and ... | true |
c902b835a7454f4aed41e0312545d9517f603c22 | Python | axxsxbxx/SSAFY5-Algorithm | /week2_3_23/BOJ_2212_수빈.py | UTF-8 | 1,841 | 3.46875 | 3 | [] | no_license | '''
2212. 센서
한국도로공사는 고속도로의 유비쿼터스화를 위해 고속도로 위에 N개의 센서를 설치하였다.
문제는 이 센서들이 수집한 자료들을 모으고 분석할 몇 개의 집중국을 세우는 일인데, 예산상의 문제로, 고속도로 위에 최대 K개의 집중국을 세울 수 있다고 한다.
각 집중국은 센서의 수신 가능 영역을 조절할 수 있다. 집중국의 수신 가능 영역은 고속도로 상에서 연결된 구간으로 나타나게 된다.
N개의 센서가 적어도 하나의 집중국과는 통신이 가능해야 하며, 집중국의 유지비 문제로 인해 각 집중국의 수신 가능 영역의 길이의 합을 최소화해야 한다.
편의를 위해... | true |
fa0e09eac4d6132f18ad7a0081ba5e5e1638c099 | Python | pythoncpp/Python01 | /day_16/page9.py | UTF-8 | 302 | 2.5625 | 3 | [] | no_license | import pandas as pd
df = pd.read_csv('/Volumes/Data/Sunbeam/2019/August/workshops/Python01/day_16/temp.csv')
print(df.describe())
print()
print(df.info())
print()
df['expected'] = df.high + 10
print(df.info())
df.to_csv('/Volumes/Data/Sunbeam/2019/August/workshops/Python01/day_16/temp_modified.csv')
| true |
448c31c7098f97ae049fa600938578b69f0a148c | Python | shwang0416/Jungle_week03 | /basic/BFS/BOJ2589_보물섬.py | UTF-8 | 1,331 | 3.140625 | 3 | [] | no_license | # [백준] https://www.acmicpc.net/problem/2589 보물섬
# L과 다른 L사이의 최단거리중 가장 먼 거리 찾기
# BFS로 풀기
import sys
# input
sys.stdin = open('BOJ2589.txt')
row, col = list(map(int, sys.stdin.readline().split()))
visited = [[0]*col for _ in range(row)]
board = [] #0으로 초기화 된 row ,col 모두 N까지 존재하는 이차원 리스트
cnt = 0
max_value = 0
dx = ... | true |
846221564fb045b2dcd32c13dc7e854e6175d6ce | Python | Aasthaengg/IBMdataset | /Python_codes/p03101/s270242628.py | UTF-8 | 502 | 2.625 | 3 | [] | no_license | # 2019-11-12 22:11:12(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import n... | true |
71dd56564d52c8db6fd528314ed89a72e7d262bb | Python | WEgeophysics/watex | /examples/view/plot_phase_tensor_2d.py | UTF-8 | 818 | 3.015625 | 3 | [
"BSD-3-Clause"
] | permissive | """
================================================
Plot two dimensional phase tensors
================================================
gives a quick visualization of phase tensors at the
component 'yx'
"""
# Author: L.Kouadio
# Licence: BSD-3-clause
#%%
from watex.view.plot import TPlot
from watex.... | true |
2f9a3b9601fb412d48077089653c820f2327cbd2 | Python | michaelwozniak/web_scraping | /project_selenium/justjoinit_scraper.py | UTF-8 | 14,543 | 2.90625 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.keys import Keys #selenium features for keys from keyboard
from selenium.webdriver import ActionChains #selenium features for mouse movements
from selenium.webdriver.common.by import By #selenium features By
from selenium.webdriver.support.ui import WebDrive... | true |
bd4fb09616d5b2f891e555952362f8cbc9bfbfc0 | Python | MarinaFirefly/Python_homeworks | /6/homework6/lists_max.py | UTF-8 | 1,246 | 4.40625 | 4 | [] | no_license | #function find_max_dif finds the maximal difference between elements of 2 lists and returns its length and which elements have the maximal difference.
#list should have same length. In other way function zip will take the shortest list as a basis
list1 = [12,34,565]
list2 = [123123,67,78,12444]
str1 = "Is this the r... | true |
b7ed99236f1c1295efa83737369ee5ca156a9e95 | Python | ChristoffenOSWorks/PandaCat | /cairo_coordinates.py | UTF-8 | 652 | 3.296875 | 3 | [] | no_license | number_of_times = int(raw_input("Please enter the number of pairs you want drawn"))
time_current = 0
while (time_current < number_of_times):
print " Please enter X value of the first pair"
point_x1 = float(raw_input(" >> "))
print " Please enter Y value of the first pair"
point_y1 = float(raw... | true |
17c3962d6d0e8688d9f700acc2f436612548ccd1 | Python | CaioOliveiraOFC/Sockets-em-python | /TCPServer.py | UTF-8 | 2,213 | 3.46875 | 3 | [] | no_license | #!/usr/bin/env python3.9
#Importando o módulo socket e o módulo time
from socket import *
from time import sleep
#Atribuir a porta ao servidor e criar o socket
serverPort = 12000
print('Esse servidor usará a porta {} para conexão'.format(serverPort))
sleep(5)
print('Criando o socket que utilizarei para essa aplicação... | true |
80f46d0a286a5bdf17869a03588d9af89a7840f4 | Python | MudretsovaSV/Python | /footbolGurls10to12.py | WINDOWS-1251 | 328 | 4.125 | 4 | [] | no_license | gender=raw_input(" - m f? (m-, f-) ")
if gender=="m":
print " ."
elif gender=="f":
age=float(raw_input(" ? "))
if 10<=age<=12:
print " "
else: print " "
| true |
cd8de4d800845e6fccbd1315dd01c51fe672f42b | Python | parthjalan37/Timetable-Generation | /main_gui.py | UTF-8 | 3,752 | 2.796875 | 3 | [
"MIT"
] | permissive | from tkinter import *
from new_main import semaphore_algo
window = Tk()
window.title("Timetable Generation OS Project")
class ProvideException(object):
def __init__(self, func):
self._func = func
def __call__(self, *args):
try:
return self._func(*args)
except ValueError:
... | true |
8a49e0a6498a8fc3b7b5b968e06e16e63e3ecef9 | Python | Skillz619/CS-180 | /Python/Roman-decimal.py | UTF-8 | 646 | 4.0625 | 4 | [] | no_license | #This program converts roman numerals to decimal integers
# using python dictonaries
x ={"I":1,"V":5,"X":10,"L":50,"C":100,"D":500,"M":1000}
value = input("Enter a roman numberal: ")
value = value.upper()
total= int
total=0
try:
for i in range(len(value)):
if i+1<len(value):
if( ... | true |
cb0403875926fa9d7ca383eb6f74cb94d4703d3a | Python | stanpython/Python-Scripts | /SSP_createAppendix.py | UTF-8 | 3,368 | 2.78125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 27 15:36:17 2020
@author: stanleyhuang2
"""
import pandas as pd
import numpy as np
import datetime as dt
import tkinter as tk
from tkinter import filedialog
root= tk.Tk()
canvas1 = tk.Canvas(root, width = 200, height = 200, bg = 'lightblue1')
canvas1.pack()
def getExc... | true |
33457d93ff9148c9cbb56b2b172de14f2ad05398 | Python | gspetillo/pythagorean-calculator-api | /main.py | UTF-8 | 2,939 | 2.90625 | 3 | [
"MIT"
] | permissive | from flask import Flask, request
from flask_restful import Resource , Api
import math
app = Flask(__name__)
api = Api(app)
class Hypotenuse(Resource):
def get(self):
args = request.args
if('sideA' in args and 'sideB' in args):
sideA = float(args['sideA'])
sideB = float(args... | true |
cf5f6732ae47ffcbe551c023de903ee45b152439 | Python | RPGroup-PBoC/human_impacts | /code/figures/barnyard_number/cattle_production.py | UTF-8 | 2,584 | 2.9375 | 3 | [
"MIT",
"CC-BY-4.0"
] | permissive | #%%
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import anthro.io
import anthro.viz
colors = anthro.viz.plotting_style()
# Load the FAO data
data = pd.read_csv('../../../data/agriculture/FAOSTAT_livestock_product_produced/processed/FAOSTAT_livestock_and_product.csv')
cattle = data[data['ca... | true |
088c777c0bdf812d69fb45b3f08a37a932a5622a | Python | sdvillal/happysad | /happysad.py | UTF-8 | 13,389 | 2.921875 | 3 | [
"BSD-3-Clause"
] | permissive | # coding=utf-8
"""
Black magic metaprogramming to redefine descriptors in python instances.
You should never lie, avoid to use this if possible.
When using it, you should really understand what you are doing.
You will probably also need paracetamol.
These patched objects have two personalities, or more concretely, two... | true |
f3b355274d540c8887235e4fad86109dfe6885d0 | Python | robotics-4-all/tektrain-robot-sw | /tests/test_mc23x17.py | UTF-8 | 838 | 2.578125 | 3 | [
"MIT"
] | permissive | import unittest
import time
from pidevices.mcp23x17 import MCP23x17
class TestMCP23x17(unittest.TestCase):
def test_get_chunk(self):
device = MCP23x17()
address, number = device._get_chunk_number("A_2")
self.assertEqual(address, "A", "It should be A")
self.assertEqual(number, 2, ... | true |
bf795532c68fb7fac905aff571fa2314e110cda6 | Python | Code-Wen/LeetCode_Notes | /179.largest-number.py | UTF-8 | 1,031 | 3.203125 | 3 | [] | no_license | #
# @lc app=leetcode id=179 lang=python3
#
# [179] Largest Number
#
# https://leetcode.com/problems/largest-number/description/
#
# algorithms
# Medium (29.09%)
# Likes: 2333
# Dislikes: 260
# Total Accepted: 205.8K
# Total Submissions: 698.5K
# Testcase Example: '[10,2]'
#
# Given a list of non negative integer... | true |
ba5eacc413a99891ff57c20905da7d7b780910a8 | Python | nick0121/python_practice | /Part_2/practice_game/rocket.py | UTF-8 | 1,733 | 2.953125 | 3 | [] | no_license | import sys
import pygame as pg
from setting import Settings
from ship import Ship
class Rocket:
def __init__(self):
pg.init()
self.settings = Settings()
self.screen = pg.display.set_mode((1200, 800))
self.screen_width = self.screen.get_rect().width
self.screen_height = ... | true |
06497822c9674420ce2d8344c4dc6d1d8a004db7 | Python | GJAI-School/GJAI-Algorithm | /queue.py | UTF-8 | 924 | 3.265625 | 3 | [] | no_license | # import sys
# input = sys.stdin.readline
def process_queue(queue_list, f_idx, r_idx, command):
cmd = command[0]
if cmd == "push":
queue_list[r_idx] = command[1]
r_idx += 1
elif cmd == "pop":
if f_idx == r_idx:
print(-1)
else:
print(queue_list[f_idx])... | true |
37cb2b15dbd6fc6aaf55c4ebe741234df2db895b | Python | JosephLevinthal/Research-projects | /5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/223/users/4178/codes/1644_1055.py | UTF-8 | 197 | 3.3125 | 3 | [] | no_license | from math import *
v = float(input("Velocidade inicial: "))
a = float(input("Angulo do vetor: "))
g = float(input("Aceleracao da gravidade: "))
xx= radians(a)
r = (v)**2 * (sin(2*a))/g
print(r)
| true |
18a1542e93eada0c053812c564b227b3adc27e2f | Python | mohsr/scribe | /scribe | UTF-8 | 1,117 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python3
import datetime
import os
import sys
# Write a message to a given filepath and a backup path
def scribe(text, path, backup_path):
# Gather formatted time string
time = datetime.datetime.now().strftime("%I:%M%p on %A, %B %d, %Y")
text = "-----\n" + time + ":\n" + text.strip() + "\n"... | true |
9c16315b47e948422470420209c0cb3d885ddad8 | Python | asishraz/banka_sir_notes | /ch_3/44.py | UTF-8 | 745 | 4.4375 | 4 | [] | no_license | #wap to print the perfect numbers between A and B
# A = int(input("enter the number: "))
# B = int(input("enter the number: "))
# N = int(input("enter the range: "))
'''
6 => 1+2+3 = 6(sum of factors equals the number)
'''
# fact = 0
# for i in range(1,N):
# if N%i == 0:
# fact += i
# if fact... | true |
67aa63d55fff88acaaf853e654ed8eda1923bf05 | Python | kmad1729/python_notes | /gen_progs/are_anagram.py | UTF-8 | 432 | 3.53125 | 4 | [
"Unlicense"
] | permissive | #!/usr/bin/env python3
from collections import Counter
def are_anagrams(*args):
'return True if args are anagrams'
if len(args) < 2:
raise TypeError("expected 2 or more arguments")
c = Counter(args[0])
return all(c == Counter(a) for a in args[1:])
arg1 = "appel apple aplep leapp".split()
#pri... | true |
20e62a735a45f7765cfff19b8b6329875edd8616 | Python | kansald006/GoogleSearch | /CSVSeabrn.py | UTF-8 | 798 | 2.984375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
df=pd.read_csv("Fulldata.csv")
# print(df)
# print(df.head(5))
#
# plt.figure(figsize=(30,20))
# # plt.savefig("")
#
# sns.countplot(y=df.Nationality, palette="Set2")
# plt.show()
#
# plt.figure(figsize=(30, 20))
# sns.countp... | true |
0ff8a8c9c4b7a51c42534985a91581b58cb55fe7 | Python | damanraaj/SummerGeeks2020SDE | /summergeeks2020assignment/way2smsApiCreateSenderId.py | UTF-8 | 740 | 2.8125 | 3 | [
"MIT"
] | permissive | import requests
import json
URL = 'https://www.way2sms.com/api/v1/createSenderId'
# post request
def sendPostRequest(reqUrl, apiKey, secretKey, useType, senderId):
req_params = {
'apikey':apiKey,
'secret':secretKey,
'usetype':useType,
'senderid':senderId
}
return requests.post(reqUrl, req_p... | true |
3b072685303cecf675253495f3881b7ab391c10b | Python | Mestway/falx-artifact | /artifact/output/plot_script_1.py | UTF-8 | 3,456 | 2.921875 | 3 | [
"BSD-2-Clause"
] | permissive | import argparse
import json
import os
import pandas as pd
from pprint import pprint
import numpy as np
import sys
# default directories
OUTPUT_DIR = os.path.join(".")
MAX_TIME = 600
def parse_log_content(exp_id, data_id, lines):
"""parse a log file"""
status = {
"exp_id": exp_id,
"data_id": da... | true |
36f489aceeb26414dadc7591b9b3fc4c39af5e1c | Python | LoganW94/Text-Adventure | /player.py | UTF-8 | 480 | 3.4375 | 3 | [] | no_license |
class Player:
__inventory = {"picture":
"In the Picture there is a Boy and a Girl. They are sitting on a park bench on a sunny fall day",
"sword":
"A cheap sword. Probably a toy"
}
__credits = 0
__name = ""
__location = 0
def __init__(self):
self.__name = "Default"
def printInventory(self):
... | true |
aff5f763746e306b276398d72dd19d1d1eecc5f2 | Python | ppilcher22/PythonBeginnerProjects | /__pycache__/OOP-_Tutorials/OOP_Tut_1.py | UTF-8 | 389 | 3.8125 | 4 | [] | no_license | class Person(object):
def __init__(self, name, age):
self.name = name
self.age = age
class Child(Person):
def __init__(self, name, age, mother, father):
super().__init__(name, age)
self.mother = mother
self.father = father
pers1 = Person('Homer', 33)
kid = Child('Charl... | true |
7e5b49671f642e0e55dec89347259790c02d9895 | Python | lookfiresu123/Interacive_python | /dollors_cents.py | UTF-8 | 1,565 | 3.890625 | 4 | [] | no_license | """
# string literals
s1 = "chensu's funny"
s2 = 'chensu"s funny'
# print s1
# print s2
# print s1 + s2
print s1[0]
print len(s1)
# [0th, 7th), just like [0th, 6th]
print s1[0:7]
print s1[:10]
s1 = "0123456789"
il = int(s1[:10])
print il + 1000000
"""
# import module
import simpleguitk as simplegui
# initialize gl... | true |
6e09253ba6d311233470a1bbd07d5ebe8c1547e8 | Python | Recursing/SlidingPuzzleSolver | /klotski.py | UTF-8 | 4,599 | 2.96875 | 3 | [] | no_license | from sliding_game import SlidingGame
import board_utils
class Klotski(SlidingGame):
def __init__(
self,
width=4,
height=5,
start_board=(2, 6, 6, 2, 3, 6, 6, 3, 2, 4, 5, 2, 3, 1, 1, 3, 1, 0, 0, 1),
goals=(17, 18),
):
super().__init__(width, height, start_board)
... | true |
494e06ffde26eb30016899083aa4a3101f69fbe7 | Python | egyptai/Python | /calculation20210531.py | UTF-8 | 202 | 3.265625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon May 31 22:53:46 2021
@author: dms10
"""
print("7+4 = ", 7+4)
print("7*4 = ", 7*4)
print("7/4 = ", 7/4)
print("2**3 = ", 2**3)
print("5%3 = ", 5%3) | true |
998ad791113fc9afb6256ae1ee8eccc59c2884da | Python | bhuynh1103/breakout | /ball.py | UTF-8 | 1,712 | 3.125 | 3 | [] | no_license | from pygame.draw import *
from constants import *
from random import uniform
class Ball:
def __init__(self):
self.w = screenSize * .02
self.x = screenSize // 2 - self.w // 2
self.y = self.x + GUISize
self.speed = 7.5
self.xspeed = 0
self.yspeed = -1
self.rel... | true |
614cdf6267889af4860b8dd5201743c1ad92dbb5 | Python | K-Phoen/runner | /scripts/runner-edit | UTF-8 | 1,090 | 2.6875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import argparse
from runner import dump_to_file, parse_from_file, TimeEditor
def configure_common_args(parser):
parser.add_argument(
'-i', '--input', type=str, required=True,
help='File to read from.',
)
parser.add_argument(
'-o', '--output', type=str, require... | true |
44f23ea333e54c7dd788deb063a2a3d380180972 | Python | mariuscmorar/AutomationScripts | /IP_Processing/validateIP.py | UTF-8 | 192 | 2.953125 | 3 | [] | no_license | import socket
original_list = [ip.strip() for ip in open('ip_list.csv', 'r').readlines()]
i=0
for a in original_list:
i+=1
try:
socket.inet_aton(a)
except socket.error:
print(i," ",a)
| true |
e168de7292c77ac1acaf49d219555613f8fe7188 | Python | SushilPudke/PythonTest | /demopattern.py | UTF-8 | 95 | 2.828125 | 3 | [] | no_license | # demo pattern
for r in range(6) :
for c in range(r):
print(r,end=" ")
print()
| true |
9e05a85e6fcd808ed99bb3b9ff30e71ef4741191 | Python | thc2125/csclassifier | /test/test_utils.py | UTF-8 | 3,122 | 2.765625 | 3 | [] | no_license | #!/usr/bin/python3
import unittest
import csv
import numpy as np
import random
import utils
from collections import defaultdict
from collections import Counter
from pathlib import Path
word_col = 1
dl = ','
class UtilsTestCase(unittest.TestCase):
def setUp(self):
self.corpora_filenames = ['Corpus_corpu... | true |
fffbd0a25b0fa49b398b67ad3d9b820afcb4ad22 | Python | cfc424/NGS | /binTranscriptome.py | UTF-8 | 4,295 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#from __future__ import division, with_statement
'''
Copyright 2013, 陈同 (chentong_biology@163.com).
===========================================================
'''
__author__ = 'chentong & ct586[9]'
__author_email__ = 'chentong_biology@163.com'
#==========================... | true |
75af6f3bc0a69a6276ed0148b693d992758a7d5c | Python | sm7eca/dmr-dreambox | /eim-service/docker/eim-core/src/db/mongodb.py | UTF-8 | 8,681 | 2.578125 | 3 | [] | no_license | import os
import sys
import re
from urllib.parse import quote_plus
from pymongo import MongoClient
from pymongo.database import Database
from pymongo.errors import ConnectionFailure
from pymongo.collection import Collection
from common.logger import get_logger
from common.definitions import Repeater, RepeaterItem, Dm... | true |
7474799f69aaf16b33205db0333b97449d294140 | Python | lianxiaolei/Ginormica | /tech/algo/arrays/image_rotation.py | UTF-8 | 535 | 3.046875 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
def image_rotation(a):
n = len(a)
for i in range(n - 1):
for j in range(i + 1, n):
tmp = a[i, j]
a[i, j] = a[j, i]
a[j, i] = tmp
for i in range(n):
for j in range(n / 2):
tmp = a[i, j]
a[i... | true |
9d6d6073e3abfcb9887cbb2d0c6fa138aa0057ad | Python | justinorjt/bnb-blog-flask | /scrapeKitCollections.py | UTF-8 | 1,144 | 2.609375 | 3 | [] | no_license | # Pull in Kit Collections
from bs4 import BeautifulSoup as bsoup
from html.parser import HTMLParser
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import selen... | true |
f5ec3c3722f5b8869b42a41613ebbcb2bd0001d6 | Python | abcapo/um-programacion-i-2020 | /58089-CAPO-AGUSTINA/TP1/8.py | UTF-8 | 545 | 3.84375 | 4 | [] | no_license | class Curso():
def __init__(self):
self.materias = ["Matemáticas", "Física", "Química", "Historia", "Lengua"]
self.notas = []
def ingreso(self):
for i in range(5):
print("Ingrese la nota de "+self.materias[i]+":")
self.notas.append(input())
return(self.... | true |
74403ae7661fe5f815f6209a4fd6a4763b7331c5 | Python | guidolingip1/Project-Euler | /4.py | UTF-8 | 476 | 3.671875 | 4 | [] | no_license | #Find the largest palindrome made from the product of two 3-digit numbers.
def reverte(numero):
revertido = 0
while (numero > 0):
resto = numero % 10
revertido = (revertido * 10) + resto
numero = numero // 10
return revertido
maior = 0
for i in range (999,1,-1):
for j in ra... | true |
218574330e73907e99908832de3b3e37cad9424f | Python | Nam-Seung-Woo/tensorflow_practice | /준표문제.py | UTF-8 | 520 | 2.9375 | 3 | [] | no_license | import tensorflow as tf
x_value=[1,2,3,4,5,6,7,8,9,10]
y_value=[3,5,7,9,11,13,15,17,19,21]
W=tf.Variable(tf.random_normal([1]))
b=tf.Variable(tf.random_normal([1]))
hypothesis=x_value*W+b
cost=tf.reduce_mean(tf.square(hypothesis-y_value))
optimizer=tf.train.GradientDescentOptimizer(learning_rate=0.01)
train=optimiz... | true |