blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
b58b7acdd167c1f1f9668f049b17e8cf45f737ae | deliangyang/uploader | /uploader/worker/counter.py | UTF-8 | 649 | 3.609375 | 4 | [] | no_license | import threading
import time
import logging
class Counter(object):
def __init__(self, start=0):
self.value = start
self.lock = threading.Lock()
def increment(self, i):
self.lock.acquire()
try:
if self.value <= 8:
time.sleep(2)
self.valu... | true |
78a00054e894c12feb9d7df1d5dad753fb4e5adb | DtjiAppDev/Python-Loops-Tutorial | /decimal_product_of_list.py | UTF-8 | 1,030 | 4.5 | 4 | [] | no_license | # Calculating the Decimal product of elements in a list which will work for any types of list
from decimal import Decimal # importing necessary library
# Checking whether a string is a number or not
def is_number(string: str) -> bool:
try:
Decimal(string)
return True
except:
return False
def de... | true |
0b1b62e0206e595030eabde5580b46e18d842157 | cornellius-gp/gpytorch | /gpytorch/likelihoods/softmax_likelihood.py | UTF-8 | 3,888 | 2.796875 | 3 | [
"MIT",
"Python-2.0"
] | permissive | #!/usr/bin/env python3
import warnings
from typing import Any, Optional, Union
import torch
from torch import Tensor
from torch.distributions import Categorical, Distribution
from ..distributions import base_distributions, MultitaskMultivariateNormal
from ..priors import Prior
from .likelihood import Likelihood
cl... | true |
c615e75e3c7d8409f4a777c16921d4b765b3f313 | chevEldrid/karn-sorter | /cam_setup.py | UTF-8 | 1,377 | 3.203125 | 3 | [] | no_license | from PIL import Image
from picamera import PiCamera
import sys
import time
camera = PiCamera()
rotation_angle = 4
alignment_time = 2
area = (325, 550, 700, 650)
adjs_x = (-20, -10, 10, 20, 30, 0, 0, 0, 0, 0)
adjs_y = (0, 0, 0, 0, 0, -20, -10, 10, 20, 0)
def camera_setup(camera):
camera.color_effects = (128, 128)
... | true |
3628ad9977626361ef4d38cab05bf15d15ecd94b | d-baker/bots | /everycolor/everyshadeofgray/tweeter.py | UTF-8 | 1,443 | 2.609375 | 3 | [] | no_license | import tweepy
#from resources.testconfig import CONSUMER_KEY, CONSUMER_SECRET, TOKEN, SECRET
from resources.config import CONSUMER_KEY, CONSUMER_SECRET, TOKEN, SECRET
from datetime import datetime, date
import random
def authorize():
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_tok... | true |
281cdf2d4b08dc2504c3b000493b0f45741ed009 | code4tots/github | /math/mod.py | UTF-8 | 341 | 3.78125 | 4 | [] | no_license | # some modular arithmetic stuff
# 3.4.2012
# Left Hand Side
def LHS(m):
return ( (m ** 6) - ( 3 * (m ** 3) ) + 3 )
# Right Hand Side
def RHS(p):
return (p ** 3)
'''
for m in range(1000):
for p in range(1000):
if LHS(m) == RHS(p):
print( "m:%d=>%d, p:%d=>%d" % (m,LHS(m),p,RHS(p)) )
'''
m = 1
print (m ** ... | true |
0ca2cdb3ea7905d97ce380134ff892d90ef38554 | IMUK23/WEB-CRAWLER- | /general.py | UTF-8 | 1,525 | 3.28125 | 3 | [] | no_license | import os
#For Every Crawling or Scraping A separate Folder will be created
def create_folder(directory):
if not os.path.exists(directory):
print("Creating Project"+directory)
os.makedirs(directory)
# Create Queue and Crawled File(if not created )
# Queue are those that are yet to be c... | true |
6b90fbdfa66e6032b3dc44afc8d896c65ec88c23 | RitchieLab/utility | /personal/alex/proxymodels.py | UTF-8 | 1,092 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python
import collections
import sys
args = sys.argv
only = label = False
for a in xrange(3,len(args)):
if args[a].lower() == 'only':
only = True
elif args[a].lower() == 'label':
label = True
else:
args = list()
break
if len(args) < 3:
print "usage: %s proxyfile modelfile [only] [label] > o... | true |
ff0dba9e05c724ffa54eb4320ba908220b39c14f | py1-10-2017/ElvaC-p1-10-2017 | /Strlists.py | UTF-8 | 447 | 3.890625 | 4 | [] | no_license | # words = "It's thanksgiving day. It's my birthday, too!"
# print words.find('day')
# print words.replace("day", "month")
#min
# x = [2,54,-2,7,12,98]
# print min(x)
#max
# x = [2,54,-2,7,12,98]
# print max(x)
#First and Last
# x = ["hello",2,54,-2,7,12,98,"world"]
# print x[0], x[-1]
#New List
x2 = [19,2,54,-2,7,1... | true |
13461cc21ceb96963981dce61c34209ef32323f6 | AsadullahFarooqi/data_structures_and_algorithms_with_python | /06_Heapsort.py | UTF-8 | 2,740 | 3.859375 | 4 | [] | no_license | """
#################################################################
########################## Heap Sort ###########################
#################################################################
"""
# def parent(i_index):
# return i_index // 2
# def left_child(i_index):
# return 2 * i_index
# def righ... | true |
a231fd7b2a2fb77f4fce49fd089d72e25cdc5185 | Aasthaengg/IBMdataset | /Python_codes/p03353/s087772576.py | UTF-8 | 323 | 2.78125 | 3 | [] | no_license | S = input().rstrip()
N = len(S)
K = int(input())
A = []
for i in range(N):
A.append(S[i:])
A.sort()
B = set()
flg = False
for i in range(len(A)):
for j in range(1,len(A[i])+1):
B.add(A[i][:j])
if len(B)==K:
flg = True
break
if flg: break
B = list(B)
B.sort()
print(B[-... | true |
705e135854b8317e4c9e603cea734f65d5e63603 | bakunobu/exercise | /1400_basic_tasks/chap_7/7_82.py | UTF-8 | 1,231 | 3.4375 | 3 | [] | no_license | from main_funcs import get_input
# a
def calc_base_pairs(n:int) -> int:
pairs = 0
a_i = get_input('Введите число', False)
for _ in range(n):
a = get_input('Введите число', False)
if a_i == a:
pairs += 1
else:
a_i = a
return(pairs)
# b
def calc_zero_pai... | true |
54c0728ec5643464dae81af6a266ced776afa3ef | ilaydadastan/python-exercises | /extracting_data_from_json_file_3.py | UTF-8 | 232 | 2.625 | 3 | [] | no_license | import json
with open('/Users/ilaydadastan/Downloads/accounts.json') as f:
data = json.load(f)
print (data['accounts'][2]['collectionName'])
""" The location of the object in the json file is taken to call the field in it. """
| true |
9f9fd17e34118e432481599a8c24c7b87d9019e4 | CalderWhite/chromecast-yt | /gui.py | UTF-8 | 603 | 2.5625 | 3 | [] | no_license | import subprocess
CHROMECAST_IP = "192.168.1.148"
def play_video(youtube_url):
print("Finding CDN url...")
proc = subprocess.run(["youtube-dl", "--get-url", "-f", "22", youtube_url],
capture_output=True)
cdn_url = proc.stdout.decode('utf-8').strip()
print(cdn_url)
print... | true |
e4de3e8e542d1b15fbf453731b926efeec360ad1 | DASARIVAMSHI/emailverification | /venv/Lib/site-packages/random_number/random_number.py | UTF-8 | 442 | 3.421875 | 3 | [] | no_license | from random import randint
class random_number:
def __init__(self, start: int, end: int):
self.start = start
self.end = end
def get_start(self):
return self.start
def get_end(self):
return self.end
def set_start(self, start: int):
self.start = start
def ... | true |
4430a78bfd882f0f7b3e52bd7c8ed5cad85eccd4 | ErikBorra/whoisxmlapi | /whoisxmlapi.py | UTF-8 | 1,885 | 2.671875 | 3 | [] | no_license | '''
whoisxmlapi interface
@author: Erik Borra
@email: borra@uva.nl
'''
csv_file = '' # one domain per line
cache_dir = '' # where to store json files
api_key = '' # api key, get yours at https://user.whoisxmlapi.com/products
api_endpoint = "https://www.whoisxmlapi.com/whoisserver/WhoisService"
api_balance = "https... | true |
49e3b36b2c510af9af0f2349c78572fa83b7159a | simdac/GatedUnitsInRNN | /datasets.py | UTF-8 | 1,260 | 2.6875 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import torch
import torch.nn.functional as F
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import MinMaxScaler
def get_data(data_file, sequence_len=12, test_size=0.4):
data = pd.read_csv(data_file, header=0).d... | true |
a358c6c4d204abf2a9091ccf59acf4b53579f02b | MPARASHA/CMPUT-412-Competition-2 | /competition2/src/detectSign.py | UTF-8 | 2,576 | 2.90625 | 3 | [
"MIT"
] | permissive | #! /usr/bin/python
# Copyright (c) 2015, Rethink Robotics, Inc.
# Using this CvBridge Tutorial for converting
# ROS images to OpenCV2 images
# http://wiki.ros.org/cv_bridge/Tutorials/ConvertingBetweenROSImagesAndOpenCVImagesPython
# Using this OpenCV2 tutorial for saving Images:
# http://opencv-python-tutroals.readth... | true |
8e36750e1e6ea09c1af53e093c8696ca6bb14145 | lguerdan/L310_Project | /flow/examples/exp_configs/non_rl/exp_figure_eight.py | UTF-8 | 3,038 | 2.546875 | 3 | [
"MIT"
] | permissive | """Example of a figure 8 network with human-driven vehicles.
Right-of-way dynamics near the intersection causes vehicles to queue up on
either side of the intersection, leading to a significant reduction in the
average speed of vehicles in the network.
"""
from flow.controllers import IDMController, StaticLaneChanger,... | true |
cd6c58b4756e3d6f2421f5bc0a9df18e6112781c | susmitasett/pypulsar | /bin/pbdot.py | UTF-8 | 3,747 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python
"""
pbdot.py
A script to determine when Pb-dot should be detectable given binary system paramters
and the current uncertainty on Pb.
Uses equation 8.52 from Lorimer and Kramer's Pulsar Handbook.
Patrick Lazarus
July 5, 2012
"""
import numpy as np
import matplotlib.pyplot as plt
import matplot... | true |
538ac5e9ac8e31a837cebb290e97130089058468 | ziyixi/seisflow | /seisflow/scripts/shared/get_stations_adjoint.py | UTF-8 | 1,488 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | """
get_stations_adjoint.py: get STATIONS_ADJOINT file used for the kernel simulation.
"""
from glob import glob
from os.path import basename, join
import numpy as np
from ...utils.load_files import load_pickle
# * test is passed for this script on 01/07/2020
def load_stations(stations_path):
return np.loadtxt... | true |
a120a3a81c531031512ac076073682fed3edbd4d | agnmce/task | /test.py | UTF-8 | 4,504 | 3.140625 | 3 | [] | no_license | import os,os.path,time
import igraph
from igraph import *
import sqlite3
g = Graph()
baseDir = '/home/agnieszka' #base/considered directory
fileName ='pro' #part of a searched file name
#class responsible for graph creation
class dirTree():
def __init__(self, graph):
... | true |
2f9337ed3ca4ca9045f0c1a2c83e08191d6a66ec | olegJF/Checkio | /Home/Home_Pearls in the box.py | UTF-8 | 1,777 | 2.984375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
def change( color_before, line):
color_after = {'w':'b', 'b':'w'}
for i, marble in enumerate(line):
if marble == color_before:
line = line[:i]+color_after[marble]+line[i+1:]
break
return line
def checkio(marbles, step):
all_steps = [[1,marbles]]... | true |
7a47e69050e0c17bd42a9a68d164b91801769e6d | pybind/pybind11_abseil | /pybind11_abseil/tests/status_example_test.py | UTF-8 | 13,449 | 2.765625 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-generic-cla"
] | permissive | from absl.testing import absltest
from absl.testing import parameterized
from pybind11_abseil import status
from pybind11_abseil.tests import status_example
def docstring_signature(f):
"""Returns the first line from a docstring - the signature for a function."""
return f.__doc__.split('\n')[0]
class AbslStatusC... | true |
13ebb4391418436ba69f55c11f2d9e524622aa5d | Ha-Young/algorithm | /기초알고리즘/다이나믹프로그래밍/타일 채우기.py | UTF-8 | 409 | 3.28125 | 3 | [] | no_license | # 타일 채우기 2133
d = [0] * 31
def dp(n):
if n % 2 != 0:
return 0
if n == 0:
return 1
elif n == 1:
return 0
elif n == 2:
return 3
elif d[n] != 0:
return d[n]
else:
d[n] = 3 * dp(n-2)
m = n
while m >= 4 and m % 2 == 0:
d[n]... | true |
dd153be667a528ca8b09aec0b389d6562373c8d7 | qqxx6661/Trajectory-prediction | /soc-client.py | UTF-8 | 1,734 | 2.921875 | 3 | [
"Apache-2.0"
] | permissive | import socket
import os
import hashlib
import struct
import time
HOST = '54.149.245.21'
PORT = 8000
BUFFER_SIZE = 1024
HEAD_STRUCT = '128sIq32s'
def cal_md5(file_path):
with open(file_path, 'rb') as fr:
md5 = hashlib.md5()
md5.update(fr.read())
md5 = md5.hexdigest()
return md5
d... | true |
b05e052b01ceb5c7c6c251ab2d1bfdfcce04c4cc | AlexanderWinkelmeier/explains | /sample_code/ep027/rev02/t.py | UTF-8 | 398 | 3.296875 | 3 | [] | no_license | import pytest
def square(n: int) -> int:
return n * n
@pytest.mark.parametrize(
('input_x', 'expected'),
(
(1, 1),
pytest.param(-1, 1),
pytest.param(-1, 1, id='negative trivial case'),
pytest.param(-1, 1, id='negative_trivial_case'),
(2, 4),
(-2, 4),
)... | true |
cbfb2df914f253e39dc5af60da472da7125a4e94 | nickyeolk/info_retrieve | /src/model.py | UTF-8 | 33,698 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | import tensorflow as tf
# import tensorflow_addons as tfa
import tensorflow_hub as hub
import pandas as pd
import numpy as np
import datetime
# import tensorflow_text
import pyodbc
from .utils import split_txt, read_txt, clean_txt, read_kb_csv
from sklearn.metrics.pairwise import cosine_similarity
from tensorflow.keras... | true |
6e64c8a1dff0cd23c14c6a4687356d4ff470cf8a | lroolle/CodingInPython | /leetcode/343_integer_break.py | UTF-8 | 1,461 | 4.03125 | 4 | [] | no_license | #!usr/bin/env python3
"""LeetCode 343. Integer Break
> Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum product you can get.
For example, given n = 2, return 1 (2 = 1 + 1); given n = 10, return 36 (10 = 3 + 3 + 4).
No... | true |
6f418dca1a8d2097b0c04e4da6499cc4d11364fa | barsuk2/python_first_level | /OOP/прегрузка операторов/_radd_iadd.py | UTF-8 | 697 | 3.328125 | 3 | [] | no_license | class A:
"""Метод add обрабатывает счложение справа
мето radd обрабатывает + слева"""
def __init__(self, val=1):
self.val = val
def __add__(self, other):
return self.val + other
def __radd__(self, other):
return other+self.val
class Iadd:
"""поддержку комбинированной опе... | true |
3e5620a40ec56166cbab50979f3753cf4e66e288 | Zerocrossing/PytinentGen | /perlin.py | UTF-8 | 2,632 | 3.125 | 3 | [] | no_license | import numpy as np
#Evil Globals
permutation = None
gradients = None
#----- PUBLIC PERLIN MAP FUNCTIONS -----
def perlin_map(x_size,y_size,scale,as_list=False,normalize = False):
"""Returns a perlin map of size x * y. Scale will adjust fineness of noise"""
linx = np.linspace(0,scale,x_size)
liny =... | true |
5860ead16b105f3216702fa2ecf0ec896b25f030 | sprax/1337 | /python3/test_l0156_binary_tree_upside_down.py | UTF-8 | 622 | 2.609375 | 3 | [] | no_license | import unittest
import common
from l0156_binary_tree_upside_down import Solution
class Test(unittest.TestCase):
def test_solution(self):
self.assertEqual(
[4, 5, 2, None, None, 3, 1],
common.convert_binary_tree_to_list(
Solution().upsideDownBinaryTree(
... | true |
3821f1ea17209dbcf0b03fbb6727ecaafc7dfe3e | vladn90/Data_Structures | /heaps/max_heap_func.py | UTF-8 | 3,211 | 4.5 | 4 | [] | no_license | """ Implementing Max Binary Heap without classes, inspiration is drawn from
Python builtin heapq module. All procedures take O(1) space and no more than
O(lg(n)) time, where n is a number of elements in heap.
Max Heap has the following funtionality:
h = [] # initialize an empty heap, just like initializing a list(arr... | true |
ad14c771996c7e314ab0e8cd5c839ace2090ae6c | bye-code/flask-jwt-course | /src/models/users_model.py | UTF-8 | 605 | 2.71875 | 3 | [] | no_license | from src.database import db
class User(db.Model):
__tablename__ = "Users"
uid = db.Column(db.Integer(), primary_key=True, nullable=False)
email = db.Column(db.String(80), unique=True, nullable=False)
password = db.Column(db.String(400), nullable=False)
name = db.Column(db.String(40), nullable=False... | true |
7a9878deda71e4c538db7624a7c5095245189ba8 | makennamartin97/python-algorithms | /emotifysentence.py | UTF-8 | 483 | 3.96875 | 4 | [] | no_license | # Create a function that changes specific words into emoticons.
# Given a sentence as a string, replace the words smile, grin,
# sad and mad with their corresponding emoticons.
# emotify("Make me smile") ➞ "Make me :D"
# emotify("Make me grin") ➞ "Make me :)"
# emotify("Make me sad") ➞ "Make me :("
def emotify(tx... | true |
42b48f450bdabd69649845c04386a9b077a1f928 | ukanf/TCC | /handle_data/clean.py | UTF-8 | 16,450 | 3.40625 | 3 | [] | no_license | # --- general imports
import datetime as DT
import matplotlib as plt
import numpy as np
import os
import pandas as pd
import utils.utils as utils
# TODO: functions with calc_daily mean and stuff.. are all almost the same.. generalize.
# TODO: need to remove outliers before calculating mean.
pd.set_option('display.max... | true |
01699be7e89f65e96d807bf6ac524d73f1053b7c | CaseyJames669/Adv_Python | /play.py | UTF-8 | 602 | 3.390625 | 3 | [] | no_license |
# Test with a variety of values ... but best to keep it <= 8, since we're not doing anything about errors.
N_QZ = 4
# Construct your function definition, here
stu_qz = ['11', '12.3', '13', '14', '15', '', '17', '18']
qz = ['15','15','15','15','20','20','20','20']
print(stu_qz)
print(qz)
#Convert quizes to percentages... | true |
3f7eb92c2a6cd9ba73ab5dd3c9692528ce9e5316 | kamit17/Python | /Think_Python/Chp13/Examples/read_whole_file.py | UTF-8 | 434 | 3.84375 | 4 | [] | no_license | """Another way of working with text files is to read the complete contents of the file into a string, and then to use our string-processing skills to work with the contents."""
# A simple example to count the number of words in a file
f = open("/Users/maverick/GitHub/Python/Think_Python/Chp13/Examples/friends.txt")
c... | true |
83f7ddeb4d4d6e1e764ad3f8b37a3fe7d7ac0e83 | thakurchandan007/python-7am | /basic/If.py | UTF-8 | 1,915 | 3.53125 | 4 | [] | no_license | # # if
# a = 5
# b = 10
# c = 30
#
# if a == b:
# print("yes")
# else:
# print("No")
# a = 5
# b = 4
# c = 30
# if a > b and a > c:
# print("A")
# elif b > a and b > c:
# print("B")
# else:
# print("c")
# if a > b:-Nested statement
# if a > c:
# print("A")
# else:
# print(... | true |
50220e1b8de84c2257edcfec6744a5f6843d9b74 | ncnynl/master_multirobot | /master_analysis/analysis_lib/transformation2d.py | UTF-8 | 1,254 | 2.671875 | 3 | [
"MIT"
] | permissive | import math
import numpy as np
class trans2d:
def __init__(self, pre_points, tar_points):
self.pre_points = pre_points
self.tar_points = tar_points
if (self.pre_points.shape[0] != 2 or self.tar_points.shape[0] != 2):
print('error dimension input')
def transform_2d(self)... | true |
a4ac37bce0e8db055b45f53a636fbae23c881dad | arunk2/Vision-and-AI-Experiments | /logo-stitching-in-video/logo_stitch.py | UTF-8 | 2,897 | 2.796875 | 3 | [] | no_license | # import the necessary packages
import argparse
import datetime
import imutils
import time
import cv2
def display_overlay(threshold, img_logo, frame):
# Load two images
# threshold = cv2.imread('arun/threshold.png')
# img_logo = cv2.imread('arun/75-logo-new.png', -1)
# Now create a mask of logo and create its i... | true |
17dcd6ad1ca37fb593869cd5f42f7c6daf203e85 | Akashnkumar1/Live_Currency_Convertor | /main.py | UTF-8 | 2,059 | 3.5625 | 4 | [] | no_license | import requests
params = {'access_key': '855f177bb3e58718e9f6d64168aa674f', 'currencies': 'USD,EUR,INR,CAD', 'format': 1}
taking_response = requests.get('http://apilayer.net/api/live', params = params)
live_data = taking_response.json()
def live_currency():
"Welcome to Live Currency Convetor"
user_input = i... | true |
a44bc73656c581c2650d36ca72f69d1498a96171 | kawain/algo | /draft_design_pattern/singleton.py | UTF-8 | 689 | 3.53125 | 4 | [] | no_license | # singletonパターンは、あるクラスのオブジェクトが常に1つだけ作成されることを保証します
# https://techacademy.jp/magazine/31657
class Singleton:
__instance = None
@staticmethod
def getInstance():
if Singleton.__instance is None:
Singleton()
return Singleton.__instance
def __init__(self):
i... | true |
79d7a0f344ff94d5eac84565e672429e8f4635aa | CaoLocBK/CaoXuanLoc-fundamental-C4E23 | /ses04/Ex5.py | UTF-8 | 760 | 3.796875 | 4 | [] | no_license | vla = [35,36,40,44]
pre = [1,2,3,4]
ans = 0
print("If x=8, then what is the value of 4(x+3) ?")
for index, v in enumerate(vla):
print(pre[index], v, sep=". ")
x = int(input("Your choice: "))
if 4*(8+3) != vla[x-1]:
print("Bingo")
ans+=1
else:
print(":(")
aws = {
'1':"About 55",
'2':"About 65",
... | true |
2a70c022f6ac1d1cd46514f0b5caee8fb054bbb3 | afcarl/edapy | /tests/test_csv_describe.py | UTF-8 | 683 | 3 | 3 | [
"MIT"
] | permissive | # core modules
import unittest
# 3rd party
import pandas as pd
from datetime import datetime
# internal modules
import edapy.csv
class CsvDescribeTest(unittest.TestCase):
def test_make_path_absolute(self):
df = pd.DataFrame({'a': [1, 2, 3],
'b': [1.0, 2.0, 3.0],
... | true |
42d30b7f8b29e2e0854ad9df04a2b7deb159bee5 | openspace42/Spartan-Shell-Ux | /Spartan/Property/Foreground/ForegroundColor8bit.py | UTF-8 | 839 | 2.75 | 3 | [] | no_license | from .ForegroundInterface import ForegroundInterface
from Spartan.Shell import SRG
class ForegroundColor8bit(ForegroundInterface):
def __init__(self, num):
ForegroundInterface.__init__(self)
if num < 0 or num > 255:
raise Exception("ForegroundColor8bit can support color only between 0 ... | true |
cb7da6eec23ceeb2c932eb5132c05fbe07284930 | rifkiirawan/Pemrograman_Jaringan_E | /progjar2/praktikum_udp1/serverudp.py | UTF-8 | 263 | 2.859375 | 3 | [] | no_license | import socket
SERVER_IP = '192.168.122.220'
SERVER_PORT = 5003
sck = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sck.bind((SERVER_IP, SERVER_PORT))
while True:
data, addr = sck.recvfrom(1024)
print("Recieved ", data)
print("Sent by : " , addr) | true |
6a3db00f94ac0ddbdf1c7459d62a58850010ad80 | wt128/algo1 | /a1/a01.py | UTF-8 | 352 | 3.296875 | 3 | [] | no_license | def insert(a,n):
for i in range(1,n):
key=a[i]
j=i-1
print(*a)
while j>=0 and key < a[j]:
a[j+1]=a[j]
j-=1
a[j+1]=key
#print(*a)
n=int(input())
a = list(map(int,input().split()))
insert(a,n)
print(*a)
... | true |
587d56550771a205e33cb0287ab747ca7bd4e1e6 | Henri-Hoyez/Posture_identification_using_AI | /Allures/part_3_2.py | UTF-8 | 4,299 | 2.84375 | 3 | [] | no_license | from keras.models import Sequential
from keras.layers import LSTM, Dense
import numpy as np
import os
import pandas as pd
from tqdm import tqdm
import matplotlib.pyplot as plt
from sklearn.metrics import confusion_matrix
def plot_confusion_matrix(y_true, y_pred, classes,
normalize=False,
... | true |
0896f0e63bec37ccb405478a915d3baabf2ff4b4 | Camera-zpf/python-pratice | /Dictionary_List_Tuple_String Operations/Dictionary_Iteration.py | UTF-8 | 257 | 3.53125 | 4 | [] | no_license | xiaoming_dic = {"name": "小明",
"age": "18",
"height": "185",
"weight": "155"}
# 在迭代遍历中 info获取的是键值对的key
for info in xiaoming_dic:
print("%s: %s" % (info, xiaoming_dic[info])) | true |
60edebc88a590cba44ec06913d6b1c24ca43d7a3 | JannaKim/PS | /etc/14468_소길이2숏코딩.py | UTF-8 | 428 | 2.734375 | 3 | [] | no_license | def solve(string) :
idx = [ord(c)-0x41 for c in string]
print(idx)
v = [0 for i in range(26)]
cnt = 0
for i in range(len(idx)) :
v[idx[i]] ^= 1 # 1 0 바꾸기
if v[idx[i]] == 0 :
j = i-1
while idx[j] != idx[i] :
cnt += v[idx[j]]
j -=... | true |
8eca441129cdff99c8f3938b4f36e4c0cb0ed477 | FNSdev/statistics | /lab3.py | UTF-8 | 1,958 | 3.0625 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import chi2
import random
import math
n = 200
A = -5
B = 7
X = []
Y = []
def generate(n):
X.clear()
Y.clear()
for i in range(n):
x = random.uniform(A, B)
X.append(x)
Y.append(x ** 2)
def F(x):
if x < 0:
... | true |
e047328052989755ce8df682603eea411c6fa4fc | dolphin-in-a-coma/python-course | /11_Standart_library/task_11_02_02_Collect_the_amount/code/game.py | UTF-8 | 7,578 | 3.34375 | 3 | [] | no_license | import sys
from card_table import CardTable
from player import Player
from messages import \
MSG_GAME_TITLE, \
MSG_CHECK_VALUES_AND_TRY_AGAIN, \
MSG_CARD_AND_PLAYER_COUNT, \
MSG_PLAYER_NUMBER, \
MSG_CURRENT_SCORE, \
MSG_GAME_BEGAN, ... | true |
5eb7891fb6135550b9e5a3606edd84c2f2d5c578 | Lizoes/MyCode | /spider/spider_post.py | UTF-8 | 542 | 2.5625 | 3 | [] | no_license | import requests
url = "http://httpbin.org/post"
url = "https://www.baidu.com"
h = {"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36"}
# 准备代理,类型为键,url:port为值
# proxies = {"http": "http://218.60.8.99:3129"}
proxies = {"https": "https://39.1... | true |
e2688f2a058b1dcd91e2eb5341bed349d0d68e49 | ckclark/CheckiO | /Ice-Base/convex-hull.py | UTF-8 | 1,474 | 3.375 | 3 | [] | no_license | def cross_product(a, b, c, d):
return a * d - b * c
def checkio(data):
left = data[0][0]
bottom = data[0][1]
start = 0
for i, p in enumerate(data):
if p[0] < left:
left = p[0]
bottom = p[1]
start = i
elif p[0] == left and p[1] < bottom:
... | true |
7d65be2534b1e41911ec8a19641b6af105bee122 | khakamora/pythonLearning | /lab3/lab3/lab4/lab4_1.py | UTF-8 | 439 | 3.515625 | 4 | [] | no_license | '''
Created on 15 жовт. 2018 р.
@author: F
'''
print("Enter N:")
n = int(input())
a = [[0] * n for i in range(n)]
for i in range(n):
for j in range(0, i):
a[i][j] = 2
a[i][i] = 1
for j in range(i + 1, n):
a[i][j] = 0
for row in a:
print(' '.join([str(elem) for elem in row]))
k = 0
i =... | true |
e6c7682fd53fdc26c8b44583f9bbf200cb43831d | spitfire21/transfer-learning-svm | /visual.py | UTF-8 | 2,614 | 2.515625 | 3 | [] | no_license | from svm_project import SVM, kernel_linear
from PIL import Image, ImageFilter, ImageFont, ImageDraw
from math import exp
import numpy as np
import os
import random
import pickle
import tensorflow as tf
import tensorflow.python.platform
from tensorflow.python.platform import gfile
from Tkinter import Tk, Label, Button... | true |
38240c1e00039f2a6ae1ad041ce4d1ec450d3350 | 1tux/project_euler | /problem010.py | UTF-8 | 247 | 3.234375 | 3 | [] | no_license | def sieve(n):
nums = range(2, n)
primes = []
for i in nums:
if i != 0:
primes.append(i)
for j in xrange(2, ((len(nums)+1) / i) + 1):
nums[i*j - 2] = 0
return primes
from math import log
N = 2 * 10 ** 6
p = sieve(N)
print sum(p)
| true |
d8142c51e0b340f5d760fb6221cf3d1e197f6e09 | Nachocisss/Simulando-sistema-distribuido-docker | /parte2/servidor/servidor.py | UTF-8 | 12,847 | 3.109375 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
import socket
import sys
import random
import struct
import threading
import time
def principal():
#------------------------- CONECTAR CLIENTE -------------------------------
time.sleep(1) #margen para verificar nodos
# Creando el socket TCP/IP
sock = socke... | true |
1536be50c4961d2f0d9b5c3e3534022999e38372 | kmactavish/tmuxp | /tmuxp/testsuite/helpers.py | UTF-8 | 6,003 | 2.609375 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
"""Helper methods for tmuxp unittests."""
from __future__ import absolute_import, division, print_function, \
with_statement, unicode_literals
import contextlib
import logging
try:
import unittest2 as unittest
except ImportError: # Python 2.7
import unittest
from random import r... | true |
3caef088375121733cb92e39646cea23138f6caf | BastosPedro/metodosnumericos | /lagrange/benchmark.py | UTF-8 | 1,951 | 3.234375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 29 10:09:24 2019
@author: pedro
"""
from lagrange import lagrange as pyLagrange
from quadrilateral_quadratico import quadrilateralQuadratico as quadLat
from scipy.interpolate import lagrange as spLagrange
from time import time
import numpy as np
... | true |
062722178d2e93726c484c9d6766715be652389f | chunguyenduc/ml-implementation | /linear_regression/linear_regression.py | UTF-8 | 2,447 | 3.765625 | 4 | [] | no_license | import numpy as np
import pandas as pd
import sklearn
from sklearn.model_selection import train_test_split
from sklearn import linear_model
import matplotlib.pyplot as plt
class LinearRegression():
"""
Parameters:
-----------
n_iterations: The number of training iterations the algorithm wil... | true |
df2f1d2ffb6571d6629d198dc6dc3f3a39e7489c | DmitryBagirov/MazeGenerator | /Main.py | UTF-8 | 251 | 2.5625 | 3 | [] | no_license | from MazeGenerator import MazeGenerator
from tkinter import *
from PIL import Image, ImageTk
root = Tk(None, None, 'Maze')
maz = MazeGenerator()
maz.save('maze')
image = ImageTk.PhotoImage(maz.solved)
Label(root, image=image).pack()
root.mainloop()
| true |
d40749f76cfd184e8fbb51166ffebdbcef0f770f | AgatsumaaPS/IP-Tracker | /main.py | UTF-8 | 2,754 | 2.9375 | 3 | [
"MIT"
] | permissive | import re
import os
import sys
import subprocess
import socket
# Input file argument
ips_file = sys.argv[1]
# The regular expression for validating an IP-address
... | true |
eedb9aca0ae268a8a9b7b0c562b1e485c97b3149 | YL-python/yl_python_code | /python_code/多任务/进程/day_04多任务完成文件拷贝.py | UTF-8 | 1,561 | 3.21875 | 3 | [] | no_license | # 获取某个路径下所有文件夹名称
# import os
# print(os.listdir(r'E:\pycharm\多任务\text'))
import os
import multiprocessing
def copy_fill(q,fill_name,old_fill_path,new_fill_path):
# print("正在复制%s---->%s " % (old_fill_path+fill_name,new_fill_path+fill_name))
old_f = open(old_fill_path + '\\' + fill_name,'rb')
new_f = open(n... | true |
c6279acd221e894d1480c28530196e2c52df160e | sunzhiyan/Python | /homework2/10.py | UTF-8 | 503 | 3.703125 | 4 | [] | no_license | # -*- encoding: utf-8 -*-
'''
@File : 10.py
@Time : 2020/03/10 23:26:05
@Author : xdbcb8
@Version : 1.0
@Contact : xdbcb8@qq.com
@WebSite : www.xdbcb8.com
'''
# here put the import lib
def cacluate(x,y) :
print("两数之和是:",x+y)
print("两数之差是:",x-y)
print("两数之积是:",x*y)
if y!=0:
prin... | true |
51277934fc253eaebe45833a1d91fa61f920f8b4 | oliviastats/sandbox_github | /python_coding_problems/bernoulli_matrix.py | UTF-8 | 316 | 2.96875 | 3 | [] | no_license | import numpy as np
def create_bernoulli_matrix(dim_n: int, dim_m: int, p: float):
bernoulli_matrix = np.empty((dim_n, dim_m))
for n in range(dim_n):
for m in range(dim_m):
value = 1 if np.random.random() <= p else 0
bernoulli_matrix[n][m] = value
return bernoulli_matrix
| true |
914e2a374a0b677b9862aa8e0ac3a405a2ad0401 | kcantosh/PDielec | /Python/GenericOutputReader.py | UTF-8 | 10,727 | 2.546875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
#
# Copyright 2015 John Kendrick
#
# This file is part of PDielec
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied w... | true |
9dea164c37ae49b2bc104c0c48e91570a444cdc3 | angelaregine/Angela-Regine-M-I0320009-Abyan-Tugas4 | /I0320009_soal3_tugas4.py | UTF-8 | 257 | 3.421875 | 3 | [] | no_license | berat_bagasi = float(input('Masukkan berat koper(kg): '))
berat_bagasi = berat_bagasi * 2.2
y = berat_bagasi <= 50
if y == True:
print(True, ': diperbolehkan masuk ke dalam pesawat')
else:
print(False, ': tidak diperbolehkan masuk ke dalam pesawat') | true |
4537e261056c61ce44fd364156eb278284836c89 | DavidLeBlanc0/Soundboard | /soundplayer.py | UTF-8 | 1,403 | 3.15625 | 3 | [] | no_license | """
FILE: soundPlayer.py
AUTHOR: John Marcoux
DATE: 2019/11/19
VERSION:1.1
PURPOSE:File for playing and overlaying sounds
"""
# Imports of all the libs we need
import time
import os
import simpleaudio as sa
import _thread
# Might need to add a method for converting mp3's to wavs
# Probably gonna use ffmpeg via ... | true |
bb2a310e46c6410eb330362007cf24e869c3beca | ochurlaud/MSc_Thesis-TeX | /scripts/kick.py | UTF-8 | 713 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import search_kicks.core as skcore
sns.set_style("ticks")
kick_t = 16.74
x, t = skcore.build_sine(kick_t, 6.4, [1, 4])
kick_x = x[np.argmin(abs(t-kick_t))]
fig = plt.figure()
ax = fig.add_subplo... | true |
c807ccd1cfce1d215b5adb346cede21814871042 | ant31/mlservefast | /mlservefast/config.py | UTF-8 | 3,393 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | """
Acquire runtime configuration from environment variables (etc).
"""
import os
import yaml
def logfile_path(jsonfmt=False, debug=False):
"""
Returns the a logfileconf path following this rules:
- conf/logging_debug_json.conf # jsonfmt=true, debug=true
- conf/logging_json.conf # jsonfmt=... | true |
9ca2a1689a37e49e49fd124412c18881dd80e859 | RealSong88/KW | /2020.08/.py/jump/ex2.py | UTF-8 | 543 | 3.28125 | 3 | [] | no_license | import random
from random import randint
car = 0
car = random.randrange(1, 11)
winner = []
while True:
temp = random.randrange(1,11)
dupl = False
if len(winner) == 5 :
break
# if car == temp:
# continue
for i in winner:
if i == temp:
dupl = True
if dupl:
... | true |
c3f3113e3680372ebde5d3e53867a840e7a57bf5 | guoweifeng216/python | /liyong_python_jingxing_shujufenxi/python_basic/chapter3/3excel_parsing_and_write_keep_dates.py | UTF-8 | 1,245 | 3 | 3 | [] | no_license | #!/usr/bin/env python
# coding=utf-8
"""
@athor:weifeng.guo
@data:2019/1/7 14:16
@filename:3excel_parsing_and_write_keep_dates
"""
import sys
from datetime import date
from xlrd import open_workbook, xldate_as_tuple
from xlwt import Workbook
input_file = sys.argv[1]
output_file = sys.argv[2]
output_workbook = Workbo... | true |
f8503595066620d7662450966de59188fb7a18b9 | deathlyhallows010/Interview-Bit-Python | /Math/Palindrome Integer.py | UTF-8 | 395 | 3.625 | 4 | [
"MIT"
] | permissive | # https://www.interviewbit.com/problems/palindrome-integer/
# Palindrome Integer
# Determine whether an integer is a palindrome. Do this without extra space.
class Solution:
# @param A : integer
# @return an integer
def isPalindrome(self, n):
n = str(n)
for i in range(int(len(n)/2)):
... | true |
48208c890863e80aa78c91e91267235c60320bf7 | NapsterLong/competition | /df-ke_match/utils/file_util.py | UTF-8 | 832 | 2.78125 | 3 | [] | no_license | from hashlib import sha256
import requests
def url_to_filename(url, etag=None):
url_bytes = url.encode("utf-8")
url_hash = sha256(url_bytes)
filename = url_hash.hexdigest()
if etag:
etag_bytes = etag.encode("utf-8")
etag_hash = sha256(etag_bytes)
filename += "." + etag_hash.he... | true |
9708a66b5eb4887a0d5ab0944de280789b6e6731 | crumblecoder/projecteuler.net | /Problem4/Problem4.py | UTF-8 | 424 | 3.984375 | 4 | [] | no_license | #A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
#Find the largest palindrome made from the product of two 3-digit numbers.
def Ispalindromic(cadena):
return cadena[::-1]
for i in range (999,700,-1):
for j in range (999,700,... | true |
30d67d097a3555fdd746bb0b9eb1c1ec3815936a | ericosur/ericosur-snippet | /python3/omc/threex3coins.py | UTF-8 | 1,178 | 3.4375 | 3 | [] | no_license | #!/usr/bin/env python3
# coding: utf-8
'''
3 5-cent coins
3 1-dime coins
3 5-dime coins
'''
import itertools as it
import operator
class Solution():
''' solution '''
coins = [3, 3, 3]
values = [50, 10, 5]
def __init__(self):
self.answers = []
def is_valid(self, p, q, r):
''' is ... | true |
d51d1b711f24d38a664723ed0dc2702b7161082b | satyateja536/Python | /Banking.py | UTF-8 | 4,322 | 4.1875 | 4 | [] | no_license | import random
class Bank:
bankDB = {} #Declaring dictionary to hold key=account number and value = list of name and balance
def __intit__(self):
self.bankDB = {} #dictionary would look like {25200:['Customer1',500],34500:['Customer2',400]}
def check_account(self,name,account_no): # To validate ... | true |
01f41ada7cc15fb1a23dd13db85c6daad26b0bbd | Weiwei93/Airline_Cancellation | /to_num.py | UTF-8 | 808 | 3.171875 | 3 | [] | no_license | # Data Preprocessing
# modify all data containing characters to numbers
def str_to_numstr(ss):
new_ss=""
for c in ss:
new_ss = new_ss+ str(ord(c)-ord('A')+1).zfill(2)
return new_ss
def mixstr_to_numstr(ss):
summ = 0
for c in ss:
summ = summ+ord(c)
return str(summ)
fout = open("tr... | true |
04dd21c687850e3d2c187b2de72a780de2567dec | mmmfarrell/me431-whirly | /whirlybird_ws/src/whirlybird_calibration/scripts/param.py | UTF-8 | 1,256 | 2.578125 | 3 | [] | no_license | import numpy as np
# System Parameters
g = 9.81 # Gravity, m/s**2
l1 = 0.85 # Distance between fulcrum and the head , m
l2 = 0.3048 # Distance between the fulcrum and end of Whirlybird's tail, m
m1 = 0.891 # Mass of whirlybird head, kg
m2 = 1 # Mas... | true |
b9a4ad2c61331678ae8bb2ff0b0b4d1a816d01e0 | tyday/garden_flask_server | /tempchart.py | UTF-8 | 1,679 | 2.5625 | 3 | [] | no_license | import pandas as pd
import numpy as np
import datetime
import plotly.offline as pyo
import plotly.graph_objs as go
def convert_to_f(temp):
return temp * 1.8 + 32
# Reading in CSV files. Use the read_csv command.
# More options: https://pandas.pydata.org/pandas-docs/stable/io.html
df = pd.read_csv('SensorReading.... | true |
06d206ef487d358f2c4b3ef8df973d01dae9a46c | tmistelbauer/poets4SATIDA | /poets/image/hdf5.py | UTF-8 | 4,357 | 2.734375 | 3 | [] | no_license | # Copyright (c) 2014, Vienna University of Technology (TU Wien), Department
# of Geodesy and Geoinformation (GEO).
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source co... | true |
03065b4d1fb94ab02263546507044ae1d7ebf6a1 | imapex/gbos_kiosk | /main.py | UTF-8 | 1,605 | 2.71875 | 3 | [] | no_license | import logging
import os
from flask import Flask, render_template, request, flash, redirect
from forms import Register
import requests
import os
# Flask initialization
app = Flask(__name__)
app.secret_key = os.getenv("SECRET_KEY")
# Logging configuration
logger = logging.getLogger('KIOSK')
logger.setLevel(logging.DEB... | true |
6e91c0184c1a640654eb8a04cc5d2e723cd9cc78 | AshleyTong/MachineLearningExperiment | /实验报告1/AddData.py | UTF-8 | 2,243 | 3.546875 | 4 | [] | no_license | """
功能:将<一.数据源1.xlsx>表格导入到MySQL数据库
"""
import xlrd
import MySQLdb
# Open the workbook and define the worksheet
book = xlrd.open_workbook("./resources/一.数据源1.xlsx")
sheet = book.sheet_by_name("Sheet1")
# 建立一个MySQL连接
database = MySQLdb.connect(host="localhost", user="root", passwd="root", db="testdb")
# 获得游标对象, 用于逐行遍... | true |
a930168e9f482c3d4c65fe11729160dd8c10ec06 | Aasthaengg/IBMdataset | /Python_codes/p03651/s912514465.py | UTF-8 | 392 | 2.796875 | 3 | [] | no_license | def main():
n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
x = a[0]
for v in a:
if v % x == 0:
continue
x = v % x
f = False
for v in a:
if k <= v and (v-k)%x == 0:
f = True
if f:
print("POSSIBLE")
... | true |
4115159895de52a29bcc3a3f88318bb4b67e4563 | BryanSWong/Python | /ex07/ex07sd1.py | UTF-8 | 779 | 3.6875 | 4 | [] | no_license | # print display
print "Mary had a little lamb."
# print display with a formatter
print "Its fleece was white as %s." % 'snow'
# print display
print "And everywhere Mary went."
# print '.' 10 times
print "." * 10
# create var
end1 = "C"
# create var
end2 = "h"
# create var
end3 = "e"
# create var
end4 = "e"
# create v... | true |
b38d3642ac0c6f8e4b15fbc0d26a82e3954f67d8 | liujianhuiouc/python_exercise | /coruntine_test/task.py | UTF-8 | 8,646 | 2.671875 | 3 | [] | no_license | # !/usr/bin/env python
# -*- coding:utf-8 -*-
import time
import types
import threading
from Queue import Queue
class ForkJoinPool(object):
def __init__(self, worker_size=1):
self._queue = Queue()
self._worker_size = worker_size
self.create_worker()
def create_worker(self):
... | true |
e5f630b023428afba8753da018eeecedaf330352 | osp/osp.work.maisons-phenix.www | /aawiki/utils/timecodes.py | UTF-8 | 1,847 | 3.140625 | 3 | [] | no_license | #https://github.com/louissobel/srt.py/blob/master/srt.py
#https://github.com/riobard/srt.py
import re
def tc2ms(tc):
'''
converts timecode to millisecond
>>> tc2ms('12:34:56,789')
>>> tc2ms('01:02:03,004')
>>> tc2ms('1:2:3,4')
>>> tc2ms(',4')
>>> tc2ms('3')
>>> tc2ms('3,4')
>>> ... | true |
707e21842b1bb97c7e05def2d53e23ef733dc01e | Kawser-nerd/CLCDSA | /Source Codes/AtCoder/arc009/B/3961942.py | UTF-8 | 338 | 3.375 | 3 | [] | no_license | rule = {}
for index, item in enumerate(input().split()):
rule[str(item)] = str(index)
N = int(input())
inputs = [str(input()) for _ in range(N)]
ans = []
for item in inputs:
cast = ''
for string in item:
cast += rule[string]
ans.append((item, int(cast)))
for item in sorted(ans, key=lambda x:x[1])... | true |
b7cec9c966f00b6c2aaf1d79f16eb7a5b9fef167 | BillyCussen/CodingPractice | /Python/Software Development Module - Python/Revision/Exam2014/Animals/Cat.py | UTF-8 | 180 | 2.953125 | 3 | [] | no_license | """
Cat.py
Billy Cussen
26/10/2020
"""
import Animal
class myCat(Animal.myAnimal):
def __init__(self):
self.speak = "Meow"
def getSpeak(self):
return self.speak | true |
fb7208596b1088371770b31372134b0ad886c08f | vnkama/car-chase | /Camera.py | UTF-8 | 1,926 | 2.9375 | 3 | [] | no_license | import pygame as pg
# from config import *
# from functions import *
#
#
#
class Camera:
def __init__(self, camera_size_w, camera_size_h,map_size_w,map_size_h):
self.position = pg.Rect(0, 0, camera_size_w, camera_size_h)
self.width = camera_size_w
self.height = camera_size_h
self.... | true |
96ada75e87eb0dda6591deb1f0725505f45fae67 | cmundt88/PythonLearning | /ex33.py | UTF-8 | 548 | 4.09375 | 4 | [] | no_license | low = int(raw_input("Input your low number: "))
high = int(raw_input("Input your high number: "))
change = int(raw_input("Input how much you want to increment: "))
def incrementor(bottom, ceiling, increment):
numbers = []
for bottom in range(bottom, ceiling + 1, increment):
print "At the top, your number is %r" ... | true |
4c03365ab7c587eb9c43e68e7d3fb8e17925d82e | KarencomK/TopicosEspeciaisEmEngenhariaDeComputacaoI | /bateria/conexao.py | UTF-8 | 215 | 2.59375 | 3 | [] | no_license | import mysql.connector
def criar_conexao(host, usuario, senha, banco):
return mysql.connector.connect(host=host, user=usuario,password=senha, database=banco)
def fechar_conexao(con):
return con.close() | true |
2b15de1a6a6d9600f7578b2387dc2f73991cf95b | kimkm0828/day0411 | /oneHotUtil.py | UTF-8 | 1,964 | 2.875 | 3 | [] | no_license | import pandas as pd
import numpy as np
from sklearn import linear_model,model_selection
def getDomain():
names = ['age', 'workclass', 'fnlwgt', 'education', 'education-num', 'marital-status', 'occupation',
'relationship', 'race', 'sex', 'capital-gain', 'capital-loss', 'hours-per-week', 'native-country... | true |
fd69595875e74c66ae0aee4c428b3b2b4d5c7f80 | Emelynegdu/hackinscience | /exercises/080/solution.py | UTF-8 | 114 | 3.25 | 3 | [] | no_license | orage = "abcdefghijklmnopqrstuvwxyz"
for i in orage:
for j in orage:
if i < j:
print(i+j)
| true |
d50f9462604c53f25a342f2df0e60e142be44e86 | is44c/Calico | /examples/python/Processing/Week 9/bounce5.py | UTF-8 | 2,113 | 3.84375 | 4 | [] | no_license | # bounce5
# Demonstrating the use of objects
from Processing import *
# Declare a Ball class that encapsulates all attributes and methods of a Ball
class Ball:
ay = 0.2 # y acceleration (gravity)
sx = 0.0 # x position
sy = 0.0 # y position
vx = 0.0 # x velocity
vy = 0.0... | true |
e643c485047ea76c15779ce872b6943c6c67fa7e | TheLabbingProject/pylabber | /research/tests/models/test_event.py | UTF-8 | 618 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | from django.test import TestCase
from django.urls import reverse
from ..factories import EventFactory
class EventModelTestCase(TestCase):
def setUp(self):
self.test_event = EventFactory()
self.test_event.save()
def test_get_absolute_url(self):
expected = reverse(
"researc... | true |
1cf361de0f65d6651d86e7e30c0d8cc3f9dcf14d | iamraprap/DataScience | /python/Data__StackOverflow/nltk_StackOverflow_Preprocessing.py | UTF-8 | 2,716 | 3.28125 | 3 | [] | no_license | import nltk
from nltk.corpus import stopwords
import pandas as pd
import numpy as np
from ast import literal_eval
from nltk.tokenize import word_tokenize
def read_data(filename):
data = pd.read_csv(filename, sep='\t')
data['tags'] = data['tags'].apply(literal_eval)
return data
train = read_data('train.tsv... | true |
d440e21d15b589fe1a2e80c1388dd1bfa4e9c3d9 | cichutkiii/grouptask | /main.py | UTF-8 | 2,174 | 3.359375 | 3 | [] | no_license | import file_ops
import stat_var
import data_ops
pick = 0
data_file = ""
while True:
print(stat_var.menuOptions)
try:
pick = int(input(stat_var.yourChoice))
except ValueError:
print("Podana wartość nie jest liczbą")
if pick == 1:
file_ops.download_file()
# 1. Pobierz pli... | true |