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 |
|---|---|---|---|---|---|---|---|---|---|---|
50ed4802e52c89b8ad33f6636b30af466f7f77c6 | ab2501/gb-ap | /les2_ex_2.py | UTF-8 | 485 | 2.875 | 3 | [] | no_license |
import json
import datetime
def write_order_to_json(item, quantity, price, buyer, date):
order = {
"item": item,
"quantity": quantity,
"price": price,
"buyer": buyer,
"date": str(date)
}
root = {"orders": [order]}
with open('materials/orders.json', encoding='u... | true |
7be87302bb4692283e9f704962db0c13a915e336 | AoiKuiyuyou/AoikPythonJSONStudy | /src/Lib/json/decoder.py | UTF-8 | 24,067 | 3.0625 | 3 | [
"Python-2.0"
] | permissive | """Implementation of JSONDecoder
"""
import re
from json import scanner
try:
from _json import scanstring as c_scanstring
except ImportError:
c_scanstring = None
__all__ = ['JSONDecoder', 'JSONDecodeError']
# Regular expression flags to match multiple lines and enable verbose mode
FLAGS = re.VERBOSE | re.MU... | true |
271d17c77e1ee802e763da1422a337a1d6554f9f | pawelzar/python-snippets | /snippets/correct_city_names/solution.py | UTF-8 | 746 | 3.84375 | 4 | [] | no_license | def correct_names(correct, incorrect):
"""
Correct wrongly written names according to provided list of correct names.
:param correct: list of names that are written correctly
:param incorrect: list of names that are written incorrectly
:return: list of corrected names
"""
normalized = {norm... | true |
26aff4783292dde44f50c355fa12c2ffe41352e5 | Juliaj/udacity-deep-rl | /p1_navigation/ddqn_agent.py | UTF-8 | 5,340 | 3.328125 | 3 | [] | no_license | """
Agent based on DQN and DDQN training.
- Adopted baseline code from Udacity Deep RL course.
"""
import numpy as np
import random
from model import QNetwork
from replay_buffer import ReplayBuffer
import torch
import torch.nn.functional as F
import torch.optim as optim
BUFFER_SIZE = int(1e5) # replay buffer s... | true |
6c8ccc99ee9ced464a03b2e1bfa9f1e9174dc919 | 1n01raymond/SoraBot | /main.py | UTF-8 | 1,138 | 2.828125 | 3 | [] | no_license | import time
import random
from slackclient import SlackClient
SLACK_BOT_TOKEN = 'xoxb-244461179202-4JMGwXTUHv87QyocC6D2yQLt'
BOT_NAME = 'sora'
SORA = '소라고둥님'
SORA_ANSWER = ['응', '아니야', '응 아니야', '그래', '카레', '하지마', '해', '고양이 조아']
READ_DELAY = 1
slack_client = SlackClient(SLACK_BOT_TOKEN)
def parse(slack_rtm_output):... | true |
75a0637ec7e0c4ebf17c1075256434a0cb2d2bfe | BassP97/CTCI | /Med/buySellStockCooldown.py | UTF-8 | 1,098 | 3.84375 | 4 | [] | no_license | """
Say you have an array for which the ith element is the price of a given stock on day i.
Design an algorithm to find the maximum profit. You may complete as many transactions
as you like (ie, buy one and sell one share of the stock multiple times) with the
following restrictions:
You may not engage in multiple t... | true |
b9bab4a768b49c08aa5c2afedc05349e8578ba88 | JosephLevinthal/Research-projects | /5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/222/users/4057/codes/1601_2043.py | UTF-8 | 254 | 3.53125 | 4 | [] | no_license | n1= float(input("digite a primeira nota: "))
n2= float(input("digite a segunda nota: "))
n3= float(input("digite a terceira nota: "))
n4= float(input("digite a quarta nota: "))
m = (n1*1)+(n2*2)+(n3*3)+(n4*4)
p = 1+2+3+4
media= round(m/p, 2)
print(media) | true |
50ee70e14b2981d92cd806d918ea4642c6cf03fe | vrrohan/Topcoder | /easy/day9/srm698/initials.py | UTF-8 | 1,678 | 4.46875 | 4 | [] | no_license | """
Problem Statement for Initials
Problem Statement
When dealing with long names and phrases, we sometimes use the initial letters of words to form its acronym. For example, we use "JFK" instead of "John Fitzgerald Kennedy", "lgtm" instead of "looks good to me", and so on.
You are given a String name. This Stri... | true |
0786dfb6301f7da02fdd8547e41922cd7ec59e53 | esteban8998/MLOPS_EDC | /assingment.py | UTF-8 | 5,943 | 2.65625 | 3 | [] | no_license | from IPython.core.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>")) # Increase cell width
display(HTML("<style>.rendered_html { font-size: 16px; }</style>")) # Increase font size
# Matplotlib conf
import matplotlib.pyplot as plt
from matplotlib import interactive
%matpl... | true |
05d97846f1479d49f55c7f63ca25774dd06fe71b | acardona/scripts | /python/imagej/tests/test_reactive_GenericDialog_scheduled_executor_service.py | UTF-8 | 4,409 | 3.078125 | 3 | [] | no_license | # A reactive generic dialog that updates previews in the background
from ij.gui import GenericDialog
from ij import WindowManager as WM
from java.awt.event import AdjustmentListener, ItemListener
from java.util.concurrent import Executors, TimeUnit
from java.lang import Runnable
from javax.swing import SwingUtilities
... | true |
93dfc5dfa66a4a05748ddfd0c96977700dba6ebb | masterlinc/PyStudy20190205 | /eight/c2.py | UTF-8 | 335 | 3.578125 | 4 | [] | no_license | # coding=UTF-8
# import sys
def add(x, y):
result = x+y
return result
# 形式参数,简称形参
def print1(code):
print(code) # 不返回任何值,这时候默认就是None
a = add(1,1000)
# 实际参数,实参
b = print1('Python hello')
print(a,b) #
# print1('python')
#####
# Python hello
#(1001,None)
| true |
7089c7a228c4359e4718f0eeb7784619ac8a1412 | christianmtanes/git-branch | /dist/main.py | UTF-8 | 1,065 | 3 | 3 | [] | no_license | import collections
import numpy as np
field_size = 1000
def parse_line(line):
line_list = line.split()
line_id = line_list[0].strip("#")
coords = line_list[2].strip(":").split(",")
dim = line_list[3].split("x")
return line_id, coords, dim
if __name__ == "__main__":
field = np.zeros(shape=(... | true |
47e8142b01c669873cdfefc4e4d9efdf037bb11b | rkbeatss/object-oriented-python | /fundamentals/polymorphism.py | UTF-8 | 1,198 | 3.9375 | 4 | [] | no_license | from abc import ABC, abstractmethod
class Shape(ABC):
def __init__(self, x, y):
self.x = x
self.y = y
@abstractmethod
def draw(self):
pass
@abstractmethod
def get_area(self):
pass
class Triangle(Shape):
def __init__(self, x, y):
super().__init__(x=x,... | true |
e8c25b4fba88908bfad08ca12f376f3abad077f5 | Joon-Kim-Lang/AlgorithmPractice | /그래프 이론/[10-3]커리큘럼.py | UTF-8 | 686 | 2.890625 | 3 | [] | no_license | from collections import deque
import copy
n = int(input())
indegree = [0] * (n+1)
graph = [[] for _ in range(n+1)]
time = [0] * (n+1)
for i in range(n):
data = list(map(int,input().split()))
time[i+1] = data[0]
for j in data[1:]:
if j == -1:
break
else:
graph[j].append(i+1)
indegree... | true |
0f2f3a5965961872ac46d65be794f6d18adad6c3 | frystacky/intro-to-python | /scope.py | UTF-8 | 213 | 3.203125 | 3 | [] | no_license | a = 250
c = [1,2,3]
def f1():
b = a + 10
c[0] = 5
print(b)
print(c)
def f2():
a = 10
print(a)
def f3():
global a
a = 100
print(a)
f1()
f2()
print(a)
f3()
print(a)
print(c)
| true |
5a7fc16db082540eae6651cf5e04a3ba7416b5ae | rshch1/freelance-arena | /api/validators.py | UTF-8 | 318 | 2.5625 | 3 | [
"MIT"
] | permissive | from freelance_arena.users.models import User
def user_validate(object):
if len(object.get('password')) > 6:
if "@" in object.get('email'):
try:
User.objects.get(username=object.get('username'))
except User.DoesNotExist:
return True
return False | true |
8a9437e6e40a52fe6675c90bb1dca919c64179e4 | longshuicui/leetcode-learning | /08.数据结构/哈希表(字典)/1.Two Sum (Easy).py | UTF-8 | 1,147 | 4.21875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
@author: longshuicui
@date : 2021/2/7
@function:
1. Two Sum (Easy)
https://leetcode.com/problems/two-sum/
题目描述
给定一个整数数组,已知 有且只有 两个数的和等于给定值,求这两个数的位置。
输入输出样例
输入一个一维整数数组和一个目标值,输出是一个大小为 2 的一维数组,表示满足条件的两
个数字的位置。
Input: nums = [2, 7, 11, 15], target = 9
Output: [0, 1]
... | true |
ac30048777a71713f0e51b7d6b6c0608e92e9a2d | kkuba91/uModbus | /old/uModBus.py | UTF-8 | 17,338 | 2.6875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import socket
import math
# Description:
help = "\nExample of use as Master:\n" \
"mb1 = uModBus()\n" \
"mb1.UnitID = 21\n" \
"mb1.TCPinit(127.0.0.1) # test on local\n" \
"\n" \
"Now build a request - Function 3 - Read 6 Holding Registers \n"\
... | true |
d05b64f1f0cd7e5ea01f69d99f51878f7e9fef3e | phillin2082/real_vs_autodraft_team | /utils/base_utils.py | UTF-8 | 2,597 | 3.375 | 3 | [] | no_license | from requests import get
import json
import csv
import re
#%% BaseUtils
class BaseUtils():
"""A class for getting player information"""
def __init__(self, nba_year):
"""Initialize name and age attributes."""
self.nba_year = nba_year
def get_json (self, uri):
"""get a uri and ... | true |
1a642bceadce7b053df3c009586c9ff79ab11eea | mattriemer/RoutingNetworks | /PytorchRouting/DecisionLayers/ReinforcementLearning/QLearning.py | UTF-8 | 1,302 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | """
This file defines class REINFORCE.
@author: Clemens Rosenbaum :: cgbr@cs.umass.edu
@created: 6/7/18
"""
import torch
import torch.nn.functional as F
from ..Decision import Decision
class QLearning(Decision):
"""
QLearning (state-action value function) based decision making.
"""
def _loss(self, s... | true |
a0575d9a8f165cf87af421a6a3e0588068e2049e | perseas/Pyrseas | /tests/dbobject/test_cast.py | UTF-8 | 7,710 | 2.78125 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
"""Test casts"""
import pytest
from pyrseas.testutils import DatabaseToMapTestCase
from pyrseas.testutils import InputMapToSqlTestCase, fix_indent
SOURCE = "SELECT CAST($1::int AS boolean)"
CREATE_FUNC = "CREATE FUNCTION int2_bool(smallint) RETURNS boolean " \
"LANGUAGE sql IMMUTABLE AS $... | true |
8aeab03623165b995a70aa72948fcf0e1ca622c0 | metinsuloglu/CA-Flow-from-Shape | /deepsphere_model/deepsphere/models/spherical_unet/utils.py | UTF-8 | 2,467 | 3.078125 | 3 | [
"MIT"
] | permissive | """
Layers used in both Encoder and Decoder.
"""
import torch.nn.functional as F
from torch import nn
from layers.chebyshev import SphericalChebConv
class SphericalChebBN(nn.Module):
"""
Building Block with a Chebyshev Convolution, Batchnormalization, and ReLu activation.
"""
def __init__(self, in_c... | true |
12f70763ada4fad3eeae6010301dfa275b71b981 | jasongros619/Project-Euler | /51 - 60/Euler 059 XOR decryption.py | UTF-8 | 3,771 | 4.4375 | 4 | [] | no_license | """
Each character on a computer is assigned a unique code and
the preferred standard is ASCII (American Standard Code for
Information Interchange). For example, uppercase A = 65,
asterisk (*) = 42, and lowercase k = 107.
A modern encryption method is to take a text file, convert
the bytes to ASCII, then XOR each byte... | true |
9d90d82196a59df7781c9a6c8d4402eaca423ea4 | yinhaiquan/python_django | /python_web/python_web/common/httpclient.py | UTF-8 | 932 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
# urllib2模拟httpclient请求,还有urllib 、httplib等资源包实现post get请求
import json
import urllib2
class HttpClientUtils(object):
""" http get请求 """
def sendHttpGet(self):
rs = urllib2.urlopen("http://blog.csdn.net/allen_hdh/article/details/33713923")
data = r... | true |
baad4d7c929133fc4984c6fcc8e62d9057c01f53 | karlstratos/iaan | /core/test_common_architecture.py | UTF-8 | 5,751 | 2.78125 | 3 | [
"MIT"
] | permissive | import dynet as dy
import unittest
from model import Model
from common_architecture import CommonArchitecture
class TestCommonArchitecture(unittest.TestCase):
def setUp(self):
self.m = dy.ParameterCollection()
self.lstm1 = dy.LSTMBuilder(1, 1, 1, self.m)
self.lstm2 = dy.LSTMBuilder(1, 1, ... | true |
b73004d481a74b263f5693472c31bfa7e2b969cb | sunny1901/python | /python_math/01hello.py | UTF-8 | 516 | 3.109375 | 3 | [] | no_license | # coding=utf-8
# 本福特定律
# py2
import matplotlib.pyplot as plt
def first_digital( x ):
while x >= 10:
x /=10
return x
if __name__ == "__main__" :
n = 1
frequency = [0] * 9
arr = range( 1 , 1000)
print arr
for i in arr :
n *= i
m = first_digital( n ) - 1
# pri... | true |
2e1e89b78e04b1e464f82079949524b44ad1857d | bigeast/ProjectEuler | /(#45)TriPentHex.py | UTF-8 | 742 | 3.921875 | 4 | [] | no_license | #Finds the first haxagonal, triangle, and pentagonal number over 40755
def createTriangle():
i=1
Triarray=[]
while i<100000:
Triarray.append((i*(i+1))/2)
i=i+1
return Triarray
def isHexagonal():
i=1
Hexarray=[]
while i<100000:
Hexarray.append(i*(2*i-1))
i=i+1... | true |
2e3c244990fd468a3ff574cea7634ce51102b09f | huiseom/3dcnn | /videoSegmentation.py | UTF-8 | 1,372 | 2.75 | 3 | [] | no_license | import cv2
import numpy as np
import os
'''
video segmentation
'''
def segVideo(filePath, isViolence):
videoIn = cv2.VideoCapture(filePath)
if (videoIn.isOpened() == False):
print("file open error")
# constants
frate = videoIn.get(cv2.CAP_PROP_FPS) # frame rate
TOTAL_FRAME = int(videoIn.... | true |
5848569fe0f68d653f0d792c42dc8269ff21f352 | parejkoj/gPhoton | /gPhoton/analysis/gtool_find.py | UTF-8 | 7,276 | 2.640625 | 3 | [] | no_license | __version__ = '1.0'
"""
.. module:: gtool_find
:synopsis: Given a gTarget state file, will execute gFind to
determine the exposure time information for the given target. Serves
as a wrapper to gFind itself. Also does some additional calculations
to convert reported GALEX times into JD and Gregorian dat... | true |
d5282dc823bbdb390ccd5044cd088259733bb2c4 | maniyar1/ManiVision | /Vision.py | UTF-8 | 4,162 | 2.921875 | 3 | [] | no_license | import VisionTables
import cv2
import csv
import numpy as np
def nothing(x):
pass
cap = cv2.VideoCapture(0)
cap.set(3,360)
cap.set(4,240)
cv2.namedWindow('sliders')
cv2.createTrackbar('hL', 'sliders', 0, 255, nothing)
cv2.createTrackbar('sL', 'sliders', 0, 255, nothing)
cv2.createTrackbar('vL', 'sliders', 0, 25... | true |
7196a46ee54e4d29fde0e5108bed647b0859a633 | davidrueda12/Ejercicios_Python_Cisco | /ejercicios_basicos_listas.py | UTF-8 | 1,440 | 4.65625 | 5 | [] | no_license | #Ejercicio para ingresar el numero de elementos a una lista y ordenas esos
# elementos segun su valor en forma de codigo:
miLista = []
swapped = True
num = int (input("¿Cuántos elementos deseas ordenar?:"))
for i in range(num):
val = float(input("Introduce un elemento de la lista:"))
miLista.append(val)
whil... | true |
faf4e0ec0428d0865dd15827b72a0e9222005a64 | schlogl2017/ProtGauss | /biovec/biovec.py | UTF-8 | 794 | 2.828125 | 3 | [] | no_license | import argparse
from biovec.models import ProtVec
def argument_parser():
"""
Parses the argument to run the model.
Returns
-------
model parameters: ArgumentParser Namespace
The ArgumentParser Namespace that contains the model parameters.
"""
parser = argparse.ArgumentParser(descrip... | true |
824f396ff1a621f250b0236fff18dbecf405c648 | gzhang01/cs182FinalProject | /blackjack/constants.py | UTF-8 | 283 | 2.53125 | 3 | [] | no_license | ####
# actions.py
#
# Actions that user can take
#
# CS182 - Artificial Intelligence
# Fall 2016
# Final Project
##
blackjack = "BLACKJACK"
actions = {
0: "bust",
1: "hit",
2: "stand",
3: "double"
}
betValue = 10
startingMoney = 1000
noPrint = False
bustPenalty = -50 | true |
14596eff746dfdeb813ebe99917ba4cd15437dcf | Lapis-Hong/PageFlow | /examples/example.py | UTF-8 | 1,358 | 2.75 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# coding: utf-8
# @Author: lapis-hong
# @Date : 2019/5/8
"""A simple example of extracting search result from web pages.
"""
from __future__ import unicode_literals
from pageflow import PageFlow
query = "python"
pages = 1 # search results total pages
# PROXIES = [{
# 'http': 'http://192.... | true |
907d9e5a9266ae7604c553bccb8ee0ca5272257b | edusanketdk/interview-practice | /intersecting linkedlists/solution.py | UTF-8 | 489 | 3.265625 | 3 | [] | no_license | def intersetPoint(head1, head2):
# save into lists
ll1, ll2 = [], []
tmp = head1
while tmp:
ll1.append(tmp.data)
tmp = tmp.next
tmp = head2
while tmp:
ll2.append(tmp.data)
tmp = tmp.next
# reverse the lists
ll1.reverse()
ll2.reverse()
# find wh... | true |
6d380cdb0e0c405c952d17abc74a8c0cd5de632f | amurphy89/phone_mast_processor | /phone_mast_processor/cli.py | UTF-8 | 1,109 | 2.8125 | 3 | [] | no_license | import sys
import click
from .phone_mast_info import PhoneMastInfo
@click.command()
@click.option("--section", "-s", default=None, help="Choose a single section to run.")
@click.argument("file")
def cli(section, file):
"""
This application processes phone mast data and outputs it to the console.
The nam... | true |
8f36f2880c61c95c38bca2df58617b57e9fe01e0 | ggopher/Python_GetStarted | /Lesson3/task3.py | UTF-8 | 514 | 4.28125 | 4 | [] | no_license | def sum_max(a: int, b: int, c: int)-> int:
"""
Сумма наибольших двух элементов. помещаем все в список, сортируем его и выдаем сумму.
:param a: int
:param b: int
:param c: int
:return: int
"""
sum = [a, b, c]
sum.sort()
return int(sum[1]) + int(sum[2])
sum = input("Введите три ч... | true |
0e39c9ee55d03e5f25e17a46761a96b5339f1c49 | ConallChen/dslming.github.com | /opencv/src-python/distanceTransform/findCenter.py | UTF-8 | 1,055 | 2.75 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import cv2 as cv
import numpy as np
'''
查找物体质心
'''
# 预处理
src = cv.imread(
"/Users/dushi/Documents/1097364388.github.com/opencv/src-python/distanceTransform/findCenter.png"
)
gray = cv.cvtColor(src, cv.COLOR_BGR2GRAY)
blurred = cv.GaussianBlur(gray, (5, 5), 2)
cv.imshow("gray", blurred)
# 二值... | true |
e2d4d3409f989408b0c0f3d531eb7e13ed8736f9 | srvmodak656/AutoTut_Regression_mac | /Python/runRegression.py | UTF-8 | 3,056 | 2.984375 | 3 | [] | no_license | """ This is a program which will manage the regression operation which will test if the
last build pushed to the repository is perfectly fine to be into final build of that version
AUTHOR:- SOURAV MODAK
30 June 2020
India
"""
import os
import threading
import time
from writeTut import runProgramRegression
stop_thre... | true |
870c2b6f40c282d33bfa29ba4444659e097ef630 | shankar7791/MI-10-DevOps | /Personel/Yash/Python/March23_ClassObject/prog2.py | UTF-8 | 441 | 4.59375 | 5 | [] | no_license | # Program 2 : Write a Python class which has two methods get_String and print_String. get_String
# accept a string from the user and print_String print the string in upper case.
class UpperCase :
def __init__(self):
self.str = ""
def get_String(self) :
self.str = input("Enter the string : ")... | true |
00925dae0348e55e3a365c1036701d9e11235f94 | Yfke/AoC2019 | /01/day1a.py | UTF-8 | 245 | 3.21875 | 3 | [] | no_license | def fuelConsumption(mass):
return (mass // 3) - 2
def main():
input = [int(mass) for mass in open("input.txt", "r").read().splitlines()]
print(sum([fuelConsumption(mass) for mass in input]))
if __name__ == "__main__":
main()
| true |
f2edb91d43ccaba1b70b02fcd7d4c498420bf9cf | txhsl/DataMining | /1552703_hw3/1/e/源码文件/code.py | UTF-8 | 9,132 | 3.15625 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from lshash import LSHash
from math import radians, cos, sin, asin, sqrt
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import recall_score
from sklearn.metrics import precision_score
from sklearn.metrics import f1_score
fr... | true |
58f34d7a3cc5e7809649cbf6391927c771c16ca6 | chiheblahouli/holbertonschool-higher_level_programming | /0x02-python-import_modules/2-args.py | UTF-8 | 425 | 3.359375 | 3 | [] | no_license | #!/usr/bin/python3
if __name__ == "__main__":
import sys
list = sys.argv
cross = len(list) - 1
if cross == 0:
print("{:d} arguments.".format(cross))
elif cross == 1:
print("{:d} argument:".format(cross))
else:
print("{:d} arguments:".format(cross))
if cross > 0:
... | true |
ec8c6fc751b40ae05ca623b064b19308622055b4 | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/difference-of-squares/2e38e3f2900449be8ff17c55de81dd69.py | UTF-8 | 260 | 3.734375 | 4 | [] | no_license | def square_of_sum(n):
sum = 0
for i in range(n+1):
sum += i
return sum ** 2
def sum_of_squares(n):
sum = 0
for i in range(n+1):
sum += i ** 2
return sum
def difference(n):
return square_of_sum(n) - sum_of_squares(n)
| true |
291e9ab601a3668a7328ef40787c25bf082190c5 | StevenFu06/EarningsTrader_RevC | /library/stock/stock.py | UTF-8 | 13,621 | 2.984375 | 3 | [] | no_license | from library.stock import fetch
import datetime as dt
import pandas as pd
import warnings
import json
from bson import ObjectId
import os
"""Main stock module
Interacts with erryting basically, a life saver, one stop shop for all stock data
"""
class Stock:
"""stock api with shit loads of data
Note:
... | true |
d5d34fa22dbaa2f3527f28e1635b54ccb62c1e1c | tszssong/caffe | /examples/s4cls/image_argument.py | UTF-8 | 6,927 | 2.53125 | 3 | [
"LicenseRef-scancode-generic-cla",
"BSD-2-Clause"
] | permissive | import numpy as np
import copy
import re
import cv2
import os
import json
import math
import random
from time import gmtime, strftime
def ColorJitterAug(image, brightness=0, contrast=0, saturation=0):
if brightness > 0:
alpha = 1.0 + random.uniform(-brightness, brightness)
image = imag... | true |
9a496a4fa13c2a18c2b18c2b61863d482b4e44ef | duicul/scy | /filematching/FileData.py | UTF-8 | 3,685 | 2.578125 | 3 | [] | no_license | '''
Created on Jul 31, 2020
@author: duicul
'''
import os
import traceback
from moviepy.video.io.VideoFileClip import VideoFileClip
#import concurrent.futures
import time
import json
from DataGatherThread import DataGatherThread
from FileMatchingThread import FileMatchingThread
class FileData:
def __init_... | true |
f0bfc1b8460359a47bfd6fef0e6a8b1733b7a43b | workerqin/file_rsync | /python_test/producer_consumer.py | UTF-8 | 2,711 | 3.671875 | 4 | [] | no_license | #!/usr/bin/python
#-*-coding:utf-8-*-
from threading import Thread, Condition
import time
import random
from Queue import Queue
#queue = []
#MAX_SIZE = 10
#condition = Condition()
#
#class ProducerThread(Thread):
# def run(self):
# nums = range(5)
# global queue
# while True:
# con... | true |
32772bd603fd98fce4531d9b710b2722115a3732 | Illyism/instaghent-old | /instaghent/i18n.py | UTF-8 | 5,196 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
def parseAcceptLanguage(acceptLanguage):
languages = acceptLanguage.split(",")
locale_q_pairs = []
for language in languages:
if language.split(";")[0] == language:
# no q => q = 1
locale_q_pairs.append((language.strip(), "1"))
else:
locale = language.split(";")[0].... | true |
8d71ed0a2f35123b2dc5ca2997278ab11242eaef | taylorhatchett/pololitics | /Test Files/Untitled.py | UTF-8 | 504 | 2.65625 | 3 | [] | no_license | from nltk.tokenize import sent_tokenize
import spacy
import xlsxwriter
workbook = xlsxwriter.Workbook('Jokes - xlsx.xlsx')
worksheet = workbook.add_worksheet()
row=0
col=0
nlp = spacy.load('en_core_web_sm')
f=open("cdata.txt").read()
s=sent_tokenize(f)
for sent in sent_tokenize(f):
worksheet.write(row, col, sent)
... | true |
d18aac9a9053c16bb2f5903939b7747cc337b7ac | precious-adeyinka/udacity | /FullStack/Foundations/movies/entertainment_center.py | UTF-8 | 1,582 | 3.109375 | 3 | [] | no_license | import media
import fresh_tomatoes
toy_story = media.Movie("Toy Story",
"A story about a boy and his toys that come to life.",
"https://upload.wikimedia.org/wikipedia/en/1/13/Toy_Story.jpg",
"https://www.youtube.com/watch?v=KYz2wyBy3kc")
avatar = media.Movie("Avatar",
"A marine is tasked with getting resources... | true |
6e3b49ad4252df65a825d7e6bed49bf3aa63fd8c | simida0755/heying | /app/forms/movie.py | UTF-8 | 1,419 | 2.578125 | 3 | [] | no_license | # _*_ coding: utf-8 _*_
from wtforms import Form, StringField, RadioField, BooleanField
from wtforms.fields import core
from wtforms.validators import DataRequired, Length, Regexp, ValidationError
__author__ = 'john'
class SearchForm(Form):
q = StringField(validators=[DataRequired(), Length(min=1, max=30)])
cla... | true |
f6cbabd7df47e78b8302d3b25dc828f55284a89f | jurjendejong/klimaatbestendige_netwerken | /klimaatbestendige_netwerken/TimeSeriesAnalyses.py | UTF-8 | 8,915 | 3.015625 | 3 | [
"MIT"
] | permissive | """
This script includes combines a couple of functions for time-series analysis.
All script require Pandas Series or DataFrames as input
Developed for usage in Klimaat Bestendige Netwerken, Rijkswaterstaat.
Jurjen de Jong, Deltares, 17-10-2019
"""
import pandas as pd
from pandas.core.frame import DataFrame
import n... | true |
a40ad3a7eb00c57b2fbf1b8d296db643b32fab11 | nigdevelop/python | /coursera/memory/memory.py | UTF-8 | 2,116 | 3.625 | 4 | [] | no_license | # implementation of card game - Memory
import simplegui
import random
numbers =[]
display=[]
RECTANGLE_WIDTH=50
state = 0
turns = 0
click1 = -1
click2 = -1
# helper function to initialize globals
def new_game():
global numbers, display, turns, label
turns = 0
array1 = range(0,8)
a... | true |
54e3a73a7edabeed7ab2561f0c74eac3b3dd6eb0 | knschuckmann/pet_project | /DSL/module.py | UTF-8 | 84 | 3.0625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
def add(a,b):
print(int(a) + int(b)) | true |
720902a86a4ea788b09e5deb804a353db9d27de9 | haasa-swara/Coursera-Python-Assignments | /extracting_data_from_xml.py | UTF-8 | 458 | 3.4375 | 3 | [] | no_license | ##Assignment-Week 5-Extracting Data from XML
##Counting numbers from website and finding the sum
import urllib.request
from bs4 import BeautifulSoup
total=0
url = 'http://py4e-data.dr-chuck.net/comments_360047.xml'
data=urllib.request.urlopen(url).read()
tree = BeautifulSoup(data,'html.parser')
counts = tree.find_all(... | true |
23e3576ef084bb4f124d4a659ce247bf739aa9ae | CHUANQIFENG/TreeClassification | /Models/Luhu_park/64_rgb_finetune/Scripts/DataLoader.py | UTF-8 | 3,261 | 2.515625 | 3 | [] | no_license | import glob
import random
import os.path
import scipy.io
import numpy as np
from PIL import Image
from Augmentations import *
class DataLoader(object):
def __init__(self, source_dir, batch_size, target_size_w, target_size_h, stage,augmentations):
self.batch_size = batch_size
self.target_size_w = ... | true |
7ad0e2a9f863111bd0ece3bb79355a98279773a8 | weisisheng/pm-timeline-generator | /main/main.py | UTF-8 | 4,076 | 2.734375 | 3 | [
"MIT"
] | permissive | import re
import time
from datetime import datetime
from functools import lru_cache
import html
import os
import logging
import slack
BOT_TOKEN = os.environ["BOT_TOKEN"]
SLACK_TOKEN = os.environ["SLACK_TOKEN"]
def get_channel_history(client, channel_id, latest=None):
if latest is None:
latest = str(tim... | true |
e761b4a404664ed9b674b28c5c85cdd2423ef930 | Farheen2302/ds_algo | /data_structures/linear/stack.py | UTF-8 | 481 | 3.78125 | 4 | [] | no_license | from linked_list import UOLinkedList
class Stack:
def __init__(self, first=None):
self.list = UOLinkedList(first)
def push(self, item):
self.list.add(item)
def pop(self):
self.list.delete(0)
def size(self):
return self.list.getSize()
def peek(self):
return self.list.head.getValue()
#Test Cases
s... | true |
34572a1f4a9f724538dd63b5e060f0dec9ee7341 | famargar/Dematic-master | /dematic/dematic_test.py | UTF-8 | 1,082 | 2.625 | 3 | [] | no_license | import unittest
import os
from gen_data_simple import makedata
from check_data_DB import send_notif
from check_data_DB import check_data
class makedataTest(unittest.TestCase):
def testmakedata(self):
f1,f2,f3,findx = makedata()
self.assertIsNotNone(f1)
self.assertIsNotNone(f2)
self... | true |
6a9d025a8ad73c1592facb21e57385cc2404f5a4 | Vasilic-Maxim/LeetCode-Problems | /problems/27. Remove Element/3 - Just Replace.py | UTF-8 | 487 | 3.234375 | 3 | [] | no_license | class Solution:
"""
Even though this solution fits LeetCode expectations we should
aks interviewer if we still can store all the elements in list.
If not then the second approach is the best.
Time: O(n)
Space: O(1)
"""
def removeElement(self, nums: list, val: int) -> int:
p1 = ... | true |
3cb8e30b8166345dc38c606b13fa94f5d5f66c38 | peterschutt/sqlalchemy | /test/ext/mypy/plain_files/hybrid_one.py | UTF-8 | 1,547 | 2.875 | 3 | [
"MIT"
] | permissive | from __future__ import annotations
import typing
from sqlalchemy.ext.hybrid import hybrid_method
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy.orm import DeclarativeBase
from sqlalchemy.orm import Mapped
from sqlalchemy.orm import mapped_column
class Base(DeclarativeBase):
pass
class Inter... | true |
c85eff0da3a676967fff9fba650cca85e81276bd | MashaPo/class_works | /training/16.11.24_regexp_group.py | UTF-8 | 233 | 3.140625 | 3 | [] | no_license | import re
regexp = '(б[аяиеэоуыё])'
f = open('1.txt','r',encoding = 'utf-8')
s = f.read()
words = s.split()
for word in words:
if re.search(regexp,word):
res = re.search(regexp,word)
print(res.group(1))
| true |
a6ebb86f4a992975733fe01aa86ea213973120e4 | Hanpeng-Chen/python-learning | /13-迭代器/iter_demo.py | UTF-8 | 283 | 3.578125 | 4 | [] | no_license | list = [1, 2, 3, 4]
it = iter(list)
print(next(it))
print(next(it))
list = [1, 2, 3, 4]
it = iter(list)
for x in it:
print(x, end=",\n")
import sys
list = [1, 2, 3, 4]
it = iter(list)
while True:
try:
print(next(it))
except StopIteration:
sys.exit() | true |
741cb21b959ea222d9cc9947f9389beb20b1a759 | smead6/Pythonlearning | /Mead_Samuel_5.py | UTF-8 | 5,663 | 3.109375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 24 14:01:50 2020
@author: Samuel
"""
def setup():
import os
import json
nltk.download() # if already done just comment out or exit the downloader when it pops up
os.mkdir('mead_py_5')
os.chdir('mead_py_5')
results = open('results.json... | true |
5f59c7fc98103c2af960796faa72b42adbc17a17 | millerJK/pythonTest | /列表生成器.py | UTF-8 | 454 | 4.25 | 4 | [] | no_license | #使用range便捷创建列表
list(range(5))
print(list(range(5)))
print(list(range(1,6)))
#---------------------------------------
L=[];
for x in range(5):
L.append(x*x)
print(L)
L = [x * x for x in range(5)] #简写方式
print(L)
#----------------------------------------
L = [x * x for x in range(0, 11) if x % 2 ... | true |
a079f8e55b0724c76e7da4473b402c8c1627e500 | PohSayKeong/python | /practical3/q2_display_pattern.py | UTF-8 | 154 | 3.96875 | 4 | [] | no_license | n = int(input("please input integer: "))
for i in range (n):
line = ''
for x in range (i+1):
line = line + " " + str(x+1)
print(line)
| true |
318dfb81f4ab9c5e7564cb05f5582b0b4e70e45e | dobleub/myExperiments | /gameLife.py | UTF-8 | 6,053 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# gameLife.py
# Generated by Geany 1.22
#
# Author: Edward Osorio S.
# Date: 2015-12-22
# Version: 1.0
# Mail: osorio.edd@gmail.com
#
# Copyright 2015
#
# El juego de la vida
# Si un cuadrado esta rodeado por 3 celulas vecinas, entonces se crea vida, agregan... | true |
233515f452e322aa0b5e6fda6b373b6cc52408be | jimwalter/python-ed | /intro_to_python/python_basics/variables.py | UTF-8 | 1,867 | 4.875 | 5 | [] | no_license | x = "some string"
print(type(x)) # -> str
'''
x is assigned to some... thing using the assingment operator, =
'''
# Simple variable assignment
x = 7
# Now you can refer to the integer value '7' using the name 'x'
print(x)
# Assign the result of an expression to a variable
y = 521 / 74 + 7**(1/8)
print(y)
# ... | true |
66c081b591362de1128a59656f6cbc6bbe98edfd | actuarial-tools/PythonStuff | /ML/DDPG_numpy_only-master/critic_net.py | UTF-8 | 17,266 | 3.53125 | 4 | [] | no_license | #!/usr/bin/env python3
import numpy as np
class CriticNet(object):
"""
A Four-layer fully-connected neural network for critic network.
-The net has an input dimension of (N, S), with S being the cardinality of
the state space.
- The net also has an input dimension of (N, A), where A is the cardinality of
... | true |
e99e492056ef43da06fabe42ff3cbe1b432bb6df | sahilmishra0012/OpenCV-Tutorials | /5.mouseevent.py | UTF-8 | 722 | 2.5625 | 3 | [] | no_license | import numpy as np
import cv2
def click_event(event,x,y,flags,param):
if event==cv2.EVENT_LBUTTONDOWN:
print(x," ",y)
font=cv2.FONT_HERSHEY_SIMPLEX
strXY=str(x)+" "+str(y)
cv2.putText(img,strXY,(x,y),font,0.25,(255,255,0),1)
cv2.imshow('image',img)
if event==cv2.EVENT_... | true |
a91ef098dbeab2e7489d3ae0a486b8676cdeeb61 | xkoma001/leetcode | /algorithm/0115Distinct_Subsequences.py | UTF-8 | 682 | 3.234375 | 3 | [] | no_license | class Solution(object):
def numDistinct(self, s, t):
"""
:type s: str
:type t: str
:rtype: int
"""
m, n = len(s), len(t)
if m < n:
return 0
rel = [[0] * n for _ in range(m)]
for j in range(n):
for i in range(j, m):
... | true |
a62e0eac71111afdaae91bd1790522eaa382b8b0 | chennian-dev/interfaceTest | /common/study.py | UTF-8 | 2,929 | 3.46875 | 3 | [] | no_license | #coding:utf-8\
import os
class eqlfun:
# 对象判断:1、值相等 2、类型一样 3、身份一样,引用同一个对象
def __init__(self):
self.a = 5
self._msg =''
def eqlTrue(self,a,b):
if a == b:
return True
elif type(a) == type(b):
return False
elif a is b :
return False... | true |
eca613212fbd130639c8c1b431973c0acfc9c9dc | AlfredJoseph1998/BibleVerses | /VerseSelect.py | UTF-8 | 742 | 3.453125 | 3 | [] | no_license | import random
from random import choice
import json
# example array of bible verses - replace with actual file/database
cache = []
TextList = ["This is one", "This is two", "Today is Saturday", "Today is Monday", "What a great day!"]
#f = open("VerseTest.txt", "r")
#ImportedText = f.read()
#f.close()
#TextList = list(... | true |
a8627837d0ac71ce0b8334b69577659394799a5a | RobertDurfee/Flights | /Radar/collect_radar.py | UTF-8 | 2,297 | 2.765625 | 3 | [
"MIT"
] | permissive | import requests
from datetime import datetime
from google.cloud import storage
import mysql.connector
def fetch(state):
response = requests.get('http://sirocco.accuweather.com/nx_mosaic_640x480_public/sir/inmsir' + state + '_.gif', stream=True)
map_gif = b'' # the 'b' prefix lets Python know the string is bina... | true |
c663914833454f339a2dcb3bb960f6c783da5ac2 | Aasthaengg/IBMdataset | /Python_codes/p02725/s380029000.py | UTF-8 | 198 | 2.8125 | 3 | [] | no_license | K, N = map(int, input().split())
A = [int(x) for x in input().split()]
mx = A[0] + K - A[-1]
for i in range(len(A) - 1):
dis = A[i + 1] - A[i]
if dis > mx:
mx = dis
print(K - mx)
| true |
417ee053cb8c07d1750de0185b21ebeb72ad8342 | benmier/Python | /Odd Even.py | UTF-8 | 161 | 3.765625 | 4 | [] | no_license | for i in range(1,2001):
if i%2==0:
print "Number is " + str(i) + ". This is an even number."
else:
print "Number is " + str(i) + ". This is an odd number." | true |
619a23848742d409bc704df4df326c981f638e23 | bc5g15/AoC_Solutions | /2018/10/pattern.py | UTF-8 | 2,626 | 3.171875 | 3 | [] | no_license | import parse
def read_input(fname):
lines = []
with open(fname, 'r') as f:
lines = f.readlines()
lines = [l.strip() for l in lines if len(l.strip())>0]
out = []
for l in lines:
r = parse.parse("position=<{x},{:s}{y:d}> velocity=<{i},{:s}{j:d}>", l)
out.append((int(r["x"... | true |
40811c7c55285a6f6812dc3c217d808439000fa7 | wangyum/Anaconda | /lib/python2.7/site-packages/dynd/tests/test_nd_groupby.py | UTF-8 | 1,411 | 2.5625 | 3 | [
"Python-2.0",
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-unknown"
] | permissive | import sys
import unittest
from dynd import nd, ndt
"""
Todo: Fix this
class TestGroupBy(unittest.TestCase):
def test_immutable(self):
a = nd.array([
('x', 0),
('y', 1),
('x', 2),
('x', 3),
('y', 4)],
dtype='{A:... | true |
6b7ee596c99428bf911e38cab30a6efff3ed82d6 | IBM-Cloud/service-discovery-client-python | /bluemix_service_discovery/exceptions.py | UTF-8 | 2,899 | 3.046875 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | """
Global exception registry
"""
class APIException(Exception):
"""
Generic Exception wrapper
"""
status_code = 500
def __init__(self, message, user_details=None, internal_details=None):
"""
Create a new APIException
:param message: General exception messag... | true |
3d6c926219e74b403c7c85384e8407979c8a88df | figosoar/pi | /examples/16_analog_hall_switch/python/16_analog_hall_switch.py | UTF-8 | 1,793 | 3.21875 | 3 | [] | no_license | #/usr/bin/env python3
# ----湖南创乐博智能科技有限公司----
# 文件名:16_analog_hall_switch.py
# 版本:V2.0
# author: zhulin
# 说明:模拟霍尔传感器实验
#####################################################
import RPi.GPIO as GPIO
import PCF8591 as ADC
import time
# 模块地址设置
def makerobo_setup():
ADC.setup(0x48) # 设置PCF8591模块地址
# 打印出磁场的信息
def maker... | true |
31a6504c2b7a3450009ca245b5032a0b25ff82a1 | ronyfsw/xer-to-csv-converter | /xer2csv/XerToCsvConverter.py | UTF-8 | 1,436 | 2.890625 | 3 | [
"MIT"
] | permissive | import os
import pandas as pd
class XerToCsvConverter:
def __init__(self):
self.tables = []
def read_xer(self, file_path):
with open(file_path, encoding="utf8", errors='ignore') as f:
content = f.read()
tables = content.split('%T')
self.tables =... | true |
47654307ba9d9b954140871b168d017bd8818bc8 | codengers/python | /two_to_ten_table.py | UTF-8 | 312 | 3.375 | 3 | [] | no_license | #2 to 10 table matrix
def print_table():
for i in range(2, 11):
if i == 11:
return("11 is not in count")
for j in range(1, 11):
q = i*j
print("{} X {} = {}".format(i,j,q))
if j==10:
print("\n")
print_table()
| true |
40a4df10b65181132cef92030ecd2b039eba99f3 | nicefuu/leetCode-python3 | /1016.py | UTF-8 | 1,040 | 3.484375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/4/30 15:22
# @Author : Fhh
# @File : 1016.py
# Good good study,day day up!
"""给定一个二进制字符串 S(一个仅由若干 '0' 和 '1' 构成的字符串)和一个正整数 N,如果对于从 1 到 N 的每个整数 X,其二进制表示都是 S 的子串,就返回 true,否则返回 false。
示例 1:
输入:S = "0110", N = 3
输出:true
示例 2:
输入:S = "0110", N = 4
输出:f... | true |
65903506ef4ae14d7522d4ee6851594785620926 | wentaocui/transductiveRR | /tim/src/visdom_logger/logger.py | UTF-8 | 2,486 | 2.96875 | 3 | [] | no_license | import visdom
import torch
from collections import defaultdict
import pickle
from enum import Enum
class ChartTypes(Enum):
scalar = 1,
scalars = 2,
image = 3
class ChartData:
def __init__(self):
self.window = None
self.type = None
self.x_list = []
self.y_list = []
... | true |
ecfd94d3145c10dc5eccdaf2a9e42893d60bf1d7 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_211/305.py | UTF-8 | 433 | 2.59375 | 3 | [] | no_license | t = input()
for idx in xrange(1, t+ 1):
n, k = map(int, raw_input().split())
u = float(raw_input())
probs =map(float, raw_input().split())
probs.sort(reverse=True)
max_ = -1
for i in xrange(0, n):
arr = probs[i:]
s = sum(arr)
x = (u + s)/float((n-i))
if x >= probs[i]:
ss = 1
for j in xrange(0, ... | true |
54ecb29f06607a33c874ba9c94e4e620988c22a3 | Datera/datera-automation-toolkit | /qalib/qabase/context.py | UTF-8 | 768 | 3.40625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
Common context manager libraries
"""
import time
import logging
logger = logging.getLogger(__name__)
if not logger.handlers:
logger.addHandler(logging.NullHandler())
class TimeIt(object):
""" Measure the elapse time inside the context
Eg.
with TimeIt() as t
... | true |
c4a134b1dc903a38552cf367ed5994190edf70c7 | kocedric/mes-programmes-python | /Programme_Python/historique.py | UTF-8 | 316 | 2.875 | 3 | [] | no_license | import sys
import pathlib
try:
dossier_de_profile = pathlib.Path(sys.argv[1])
except IndexError:
sys.exit("Vous devez passer un dossier de profile en paramètre")
historique = dossier_de_profile / "places.sqlite"
if not historique.is_file():
sys.exit(f"Impossible de trouver ce fichier: {historique}") | true |
cdc9fff15742f1716ce4e27b44a4c2d5c52e3d69 | eunjongyeop/CNNAlgorithm | /AlexNet/preprocessing.py | UTF-8 | 3,996 | 2.84375 | 3 | [] | no_license | import numpy as np
import cv2
import os
from json import dump, load
def concat_path(*paths, dash='/'):
if len(paths) == 1:
return paths
return dash.join(paths)
def print_process(size, complete, content):
"""
:param size: int
현재 진행 중인 프로세스의 길이
:param complete: int
완료된 프로세스
... | true |
f93757524d55b302488264d0dbd77feeae1cd645 | VDoring/Grade-Management | /x.py | UTF-8 | 707 | 4.1875 | 4 | [] | no_license | print('학점처리 프로그램')
print('이름을 입력해주세요\n')
name = input("")
kor = int(input("국어점수: "))
eng = int(input("영어점수: "))
math = int(input("수학점수: "))
sum = kor + eng + math
print("%s님의 성적입니다." % name)
print("%s님의 총점은 %d점입니다." % name, sum)
avg = sum / 3
print("%s님의 평균은 %.1f점입니다." % avg)
if avg >= 90:
print... | true |
0e98af1f78aa56a764cc5b219c3b5a767c5ef7e5 | epochiero/coloreando | /coloreando/dashboard.py | UTF-8 | 2,533 | 2.640625 | 3 | [
"MIT"
] | permissive | import json
import random
import requests
from django.core.urlresolvers import reverse
from utils import redis_connection
from coloreando.settings import prod as settings
import logging
logger = logging.getLogger(__name__)
class Buddy(object):
"""
Main Buddy object.
"""
def __init__(self, username,... | true |
5d2fd079549738cf39457ce790ab40b2f4eae6e2 | Neckmus/itea_python_basics_3 | /_medviediev_oleksandr/02/03_shopping_list.py | UTF-8 | 456 | 4.1875 | 4 | [] | no_license | shopping_list = []
while True:
new_element = input('What do you want to buy? ')
shopping_list.append(new_element)
one_more = input('One more? (y/n)')
if one_more != 'y':
break
print(shopping_list)
answer = input('Do you want to change something? (y/n)')
if answer == 'y':
index_to_cha... | true |
42b4e97de56f8e766b010466ef49b2d0a349919d | higorrluiz/LabJogos-Shrek | /jogador.py | UTF-8 | 8,940 | 2.640625 | 3 | [] | no_license | from PPlay.window import*
from PPlay.gameimage import *
from PPlay.sprite import *
from PPlay.collision import *
from PPlay.keyboard import *
import globais
class Jogador(object):
def __init__(self,window):
self.window = window
self.teclado = Keyboard()
self.fiona = [Sprite("./Imagens/Fiona/... | true |
8db95e0c56192d6f902949377666230bf3ecca9b | IRS-PM/IRS-PM-2020-01-18-IS02PT-GRP11-TripAtUs | /System Code/Service_Scripts/GriddingAreas.py | UTF-8 | 5,916 | 2.9375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 19 08:14:13 2020
@author: vidis
"""
from qgis.core import *
from qgis.PyQt.QtCore import QVariant
"""
Code to divide polygons into square-grid systems
--> In the eventuality that we were to use TSP to grid our search space
"""
def cut_polygon_into_windows(p, window_he... | true |
a44e31bedeace65072e0511822e023c0227b2de8 | varerysan/python_start_lessons | /some_ideas/data_sizeof.py | UTF-8 | 304 | 3.15625 | 3 | [] | no_license | # Sizeof data
# Author: Valery Mosyagin
import sys
d1 = [ x/10.0 for x in range(10000) ]
print("d1 ( 10000 )size=", sys.getsizeof(d1))
d2 = [ x/10.0 for x in range(100000) ]
print("d2 ( 100000 )size=", sys.getsizeof(d2))
d3 = [ x/10.0 for x in range(1000000) ]
print("d3 ( 1000000 )size=", sys.getsizeof(d3))
| true |
bdf258b2b0a587129701958e8dbea4949c5755ad | twisted/ldaptor | /ldaptor/generate_password.py | UTF-8 | 1,942 | 2.609375 | 3 | [
"MIT"
] | permissive | from twisted.internet import process, protocol, defer
from twisted.python import failure
class PwgenException(Exception):
pass
class ReadPassword(protocol.ProcessProtocol):
def __init__(self, deferred, count=1):
self.deferred = deferred
self.count = count
self.stdout = ""
sel... | true |
d7059eec5832da0ce7549e1b9ad06b51202f0e3b | IndiaCFG3/team-53 | /email_notification.py | UTF-8 | 2,543 | 2.546875 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | import os
import sys
import json
import requests
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
import smtplib
## Fetching Email Data
# url=''
# r=requests.get(url)
# mail_data=r.json()
mail_... | true |
de9d7a77ee81eea526253b13ccdc252ffef26b5f | DmitryGulitsky/python_study | /lesson2_functional_programming_and_data/and-or-operators.py | UTF-8 | 314 | 3.5 | 4 | [] | no_license | a = 16
b = 42
print('and or operators')
print('a > 0 and b > 0 == ', a > 0 and b > 0)
print('a > 0 and b > 0 == ', a > 0 and b > 0)
print('a > 0 and b < 0 == ', a > 0 and b < 0)
print('a > 0 or b > 0 == ', a > 0 or b > 0)
print('a > 0 or b < 0 == ', a > 0 or b < 0)
print('-------------------------------------') | true |
20c77e465e3ae92d85062261fc9b4b2ba594615f | bmoretz/Python-Playground | /src/Classes/MSDS400/Module 8/workers.py | UTF-8 | 701 | 3.84375 | 4 | [
"MIT"
] | permissive | # A manufacturing firm finds that 60% of its new hires turn out to be good workers and 40 % become poor workers.
# All current workers are given a reasoning test.
#
# Of the good workers, 90% pass it; 30% of the poor workers pass it.
# Assume that these figures will hold true in the future.
#
# If the compan... | true |
c67098723e6af2d80a5b043d266a3c9f6a35f59c | mzhou23/Project_Zero | /block.py | UTF-8 | 3,065 | 2.59375 | 3 | [] | no_license | #Phuong Nguyen Ngoc, Elliot Zhou, Zixuan Wang, Eduardo Sosa, Katie Andre, Izzy Hurley
#CS269
from common_setting import *
import pygame as pg
import random
class Block(pg.sprite.Sprite):
def __init__(self, x, y, health, indestructable = False, bonus = 0 ):
pg.sprite.Sprite.__init__(self)
self.image = self.imag... | true |