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 |
|---|---|---|---|---|---|---|---|---|---|---|
b3c14cbb62f8e1e80042468a13ae780304bab33f | RawitSHIE/Algorithms-Training-Python | /python/Bishop r.py | UTF-8 | 307 | 3.140625 | 3 | [] | no_license | """bishop"""
def main():
"""chess """
pos1 = input()
hor1 = pos1[0].upper()
ver1 = pos1[1]
pos2 = input()
hor2 = pos2[0].upper()
ver2 = pos2[1]
if abs(int(ord(hor1))-int(ord(hor2))) == abs(int(ver1) - int(ver2)):
print("True")
else:
print("False")
main()
| true |
1e0fc2640f9f330f58e44577b19477d4ce57351d | zannew/algorithm-team-notes | /implementation/question_3.py | UTF-8 | 1,577 | 3.953125 | 4 | [] | no_license | '''
[문제] 왕실의 나이트
- 왕실 정원은 체스판과 같은 8 * 8 좌표 평면이다. 왕실 정원의 특정한 한 칸에 나이트가 서있다.
- 나이트는 말을 타고 있기 때문에 이동을 할 때는 L자 형태로만 이동할 수 있으며, 정원 밖으로는 나갈 수 없다.
- 나이트는 특정 위치에서 다음과 같은 2가지 경우로 이동할 수 있다.
1. 수평으로 두 칸 이동한 뒤에 수직으로 한 칸 이동하기
2. 수직으로 두 칸 이동한 뒤에 수평으로 한 칸 이동하기
- 이처럼 8 * 8 좌표 평면상에서 나이트의 위치가 주어졌을 때 나이트가 이동할 수 있는 경우의 수를 출력하는 프로그... | true |
c13711ec32f240533603decf51ca330b2ce3c5fd | fengjiaxin/prepare_work | /leetcode_tag/LinkedList/142.环形链表 II.py | UTF-8 | 1,134 | 3.8125 | 4 | [] | no_license | # 给定一个链表,返回链表开始入环的第一个节点。 如果链表无环,则返回 null。
#
# 为了表示给定链表中的环,我们使用整数 pos 来表示链表尾连接到链表中的位置(索引从 0 开始)。 如果 pos 是 -1,则在该链表中没有环。注意,pos 仅仅是用于标识环的情况,并不会作为参数传递到函数中。
#
# 说明:不允许修改给定的链表
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:... | true |
770e025f19b276b24900915f4e25378f33959b22 | msmithsm/rce | /solver/factory.py | UTF-8 | 1,564 | 3.078125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Solver Factory to generate Solver objects.
Created on Fri Nov 18 09:51:33 2016
@author: maxwell
"""
class SolverFactory(object):
"""
Factory specifications for Solver type objects
"""
#import defined classes here. Should be at same package level as ... | true |
fbef2dbe87759063fb17795ff1c89697d08a3864 | rottendoom001/PYTHON_TF | /TF_R_N_TEST_1.py | UTF-8 | 1,420 | 2.84375 | 3 | [] | no_license | import tensorflow as tf
def my_network(input):
W_1 = tf.Variable(tf.random_uniform([784, 100], -1, 1),
name="W_1")
b_1 = tf.Variable(tf.zeros([100]), name="biases_1")
output_1 = tf.matmul(input, W_1) + b_1
W_2 = tf.Variable(tf.random_uniform([100, 50], -1, 1),
... | true |
e8c8f4fc3ba7ebfb86a390df737e16530546df51 | melissaaccorso/yelpelite | /AnalysisI_Elite_yelpprocessing.py | UTF-8 | 8,478 | 2.828125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 19 19:17:35 2015
@author: jeppley
"""
import json
import pandas as pd
import numpy as np
import sqlite3
from glob import glob
import re
import os
import pylab as pl
import statsmodels.api as sm
import matplotlib.pyplot as plt
from patsy import dmatrices
from sklearn.line... | true |
5fc3201f76bd606a7aff8cd4d6e13f4ff63f6381 | HideBa/soccer_scrapying | /soccer_proj/success_rate_pd.py | UTF-8 | 6,711 | 2.53125 | 3 | [] | no_license | import pandas as pd
import numpy as np
class GetSuccessRatio:
def get_u18_url_nums(self):
df_u18_all = pd.read_csv('results_all/all_year_u18_2.csv')
no_url_nums = df_u18_all['results_home'] == 'None'
no_url_nums = no_url_nums.sum()
print('u18_no url nums ====== ' + str(no_url_nums... | true |
dbd57a2b0baf72edbebfbd7f2b8032084842b1ac | yekang/DM- | /DM作业-2/SVD.py | UTF-8 | 3,645 | 3.109375 | 3 | [] | no_license | from numpy import *
def file2matrix(filename): #读入文档并对文档进行处理
datalist=[]
datalabel=[]
datalistex=[]
f=open(filename,'r',encoding='utf-8')
fi1=f.readlines()
for fi in fi1:
fi=fi.strip()
filist=fi.split(',')
datalistex=[]
for x in range(len(filist)-1):
datalistex.append(float(filist[x]))
datalist.ap... | true |
f63d19a3fd97cff76928bd5a4d018f14ab74a5fe | yanhualei/about_python | /python_learning/python_base/re正则表达式/利用正则抓取网络图片.py | UTF-8 | 940 | 3.046875 | 3 | [] | no_license | import urllib.request
import gevent
import re
from gevent import monkey
# 打补丁
monkey.patch_all()
def download(img_name, img_url):
# 读取图片内容并记录 网址
req = urllib.request.urlopen(img_url)
data = req.read()
# 写入记录的图片内容信息
with open(img_name, "wb") as f:
f.write(data)
def main():
... | true |
38e3fb1fad6a109d55e5f0d47e81aceda9c38428 | robotter/avarix | /mk/templatize.py | UTF-8 | 2,680 | 2.671875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import sys
import os
import re
import time # used by templates
def templatize(template, output, loc):
"""Process a template file
'#pragma avarix_tpl CODE' and '$$avarix:CODE$$' sequences are replaced.
CODE is Python code evaluated with eval() whose result (converted to a string)
is us... | true |
ac6e0b976b07cd92b0b5c46839c9496b0783075e | CodeReclaimers/neat-python | /neat/genes.py | UTF-8 | 4,478 | 3.03125 | 3 | [
"BSD-3-Clause"
] | permissive | """Handles node and connection genes."""
import warnings
from random import random
from neat.attributes import FloatAttribute, BoolAttribute, StringAttribute
# TODO: There is probably a lot of room for simplification of these classes using metaprogramming.
# TODO: Evaluate using __slots__ for performance/memory usag... | true |
6cea8932c91d8035833811e46d1b2e1b6ed36327 | programmer290399/pustakkosh.com-scrapper | /scrapping-forever.py | UTF-8 | 5,480 | 2.515625 | 3 | [] | no_license | from bs4 import BeautifulSoup
import json
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
import time
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import StaleElementReferenceException
from sele... | true |
43fc46690e7833c3b7c601cb7d3cbffd5ddf7f11 | totalhack/tlbx | /tlbx/iterable_utils.py | UTF-8 | 1,421 | 3.28125 | 3 | [
"MIT"
] | permissive | from functools import reduce
from itertools import chain, combinations
from operator import or_
from ordered_set import OrderedSet
def powerset(iterable):
"""powerset([1,2,3]) --> () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)"""
s = list(iterable)
return chain.from_iterable(combinations(s, r) for r in rang... | true |
a29762f92f35d7b322b71bac6aa6c058023827a8 | shreya-singh-tech/yelp-scrapping | /Split_csv.py | UTF-8 | 821 | 3.25 | 3 | [] | no_license | import pandas as pd
#csv file name to be read in
in_csv = 'combined_reviews_info.csv'
#get the number of lines of the csv file to be read
number_lines = sum(1 for row in (open(in_csv,encoding='utf-8-sig')))
#size of rows of data to write to the csv,
#you can change the row size according to yo... | true |
47e7e1a3caf87963f0eff98705eaceb2136fae25 | PabloNabil/PMR3412-Entrega2 | /Back_End.py | UTF-8 | 2,458 | 2.515625 | 3 | [] | no_license | import asyncio
import json
import websockets
clients={}
async def userslist():
users = []
for key in clients.keys():
users.append(key)
users_message = json.dumps({
'type': 'users',
'message': users
})
print("Broadcasting:", users_message)
await broadcast_msg(users_message)
as... | true |
b3fd058dd2ce585b2c4549b8a7514cfd16e54a70 | Maoyun/Azure_Line | /test/test6.py | UTF-8 | 720 | 3.140625 | 3 | [] | no_license | # !/usr/bin/env python
# -*-coding:utf-8 -*-
# author:Dra Date:2018/4/27
#coding=utf-8
#
# '''
# 多线程
#
#
# 进程 pid 唯一标示符
# 使用kill 杀死进程
#
#
# 主线程 创造一个进程的时候,会创造一个线程,这个线程被称为主线程
# 一个进程里只有一个主线程
#
#
# python里的多线程,不是真正意义上的多线程。
#
# 全局锁
#
# 在任意的指定时间里,有且只有一个线程在运行
#
# a b c
# '''
import threading
import time
def test(p):
t... | true |
11c94c22ff0ea1f1ff75c592a418c23998b678d9 | Pluto13579/Python3-cookbook | /cha1数据结构和算法/1.1解压序列赋值给多个变量.py | UTF-8 | 551 | 4.03125 | 4 | [] | no_license | #任意的序列(或者是可迭代对象)可以通过一个简单的赋值语句解压并赋值给多个变量。
#唯一的前提就是变量的数量必须跟序列元素的数量是一样的。
#包括字符串,文件对象,迭代器和生成器。
#解压一部分时可以使用任意变量名占位,到时候丢掉即可。
p = (4,5)
x, y = p
print(x, y) #x=4, y=5
data = ['ACME', 50, 91.1, (2018, 12, 11)]
name, shares, price, (year, mon, day) = data
print(name, price, year, mon, day) #name=ACME, price=91.1, year=2018, mo... | true |
20db726576b1b32b36c12983fcdd047dc6ca8641 | Devendra0110/practicePython | /Exercise 8 Rock Paper Scissors.py | UTF-8 | 942 | 3.859375 | 4 | [] | no_license | print("Let's play Rock Paper Scissors")
choices = ["Rock", "Paper", "Scissors"]
play = True
p1Wins = "Player 1 wins"
while(play):
p1Answer = input("P1 Choose between Rock Paper Scissors")
p2Answer = input("P2 Choose between Rock Paper Scissors")
if p1Answer in choices and p2Answer in choices:
... | true |
5c5ad347c98e8b80eadc3f5f0ed75bd40975698b | JSNavas/CursoPython2.7 | /23. exepciones.py | UTF-8 | 190 | 3.9375 | 4 | [
"MIT"
] | permissive | try:
edad = raw_input("Intruduce tu edad: ")
edad = int (edad)
except:
print "El valor es incorrecto."
finally:
print "Esto se ejecuta siempre"
else:
print "Tu edad es: %d" % (edad)
| true |
935fdea33d8dc8a6b23055d4d876bf1c9ea38c02 | zhan-ge/CodePy | /ExampleOfPythonCookBook/ex_1_6.py | UTF-8 | 519 | 2.9375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Project: 在字典中将键映射到多个值上
Purpose: 实现 一键多值字典
Version:
Author: ZG
Date: 15/6/8
"""
from collections import defaultdict
if __name__ == '__main__':
dict_set = defaultdict(set) # 值为set类型的字典
dict_list = defaultdict(list) # 值为list类型的字典
dict_tuple... | true |
5fb81465dcb976eb177f5b5977178290b03e2295 | loser-io/wertheimer | /try-mic.py | UTF-8 | 1,726 | 2.78125 | 3 | [] | no_license | import pyaudio
import wave
import time
import pyaudio
p = pyaudio.PyAudio()
for ii in range(p.get_device_count()):
print(f"{ii} - {p.get_device_info_by_index(ii).get('name')}")
form_1 = pyaudio.paInt16 # 16-bit resolution
chans = 1 # 1 channel
samp_rate = 44100 # 44.1kHz sampling rate
chunk = 4096 # 2^12 samples f... | true |
967d070827a6fcf69291b39ff6d57e77243bf12d | mrzepka/basic_edge_detection | /detect_edge.py | UTF-8 | 920 | 2.578125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import sys
#https://scikit-image.org/docs/stable/api/api.html
from skimage import filters
from skimage import img_as_ubyte
from skimage.io import imread, imsave
from skimage.color import rgb2gray
from skimage.util import compare_images, invert
filename = sys.argv[1]
... | true |
51a7d4a10f67c270a2b2db69fd9913075bc4c151 | ConnorDieck/bogly | /app.py | UTF-8 | 6,886 | 2.53125 | 3 | [] | no_license | """Blogly application."""
from flask import Flask, request, redirect, render_template, flash
from models import db, connect_db, User, Post, Tag, PostTag
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql:///blogly'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config['SQLALCHEMY_ECHO... | true |
73b6ffd8431fd87b0d440dde0c406e4506429443 | guydav/minerva | /cs110/maximum_subarray.py | UTF-8 | 4,712 | 3.109375 | 3 | [] | no_license | from profilehooks import profile
from numpy import random
@profile(sort='calls', immediate=False)
def brute_force(price_list):
buy_index = 0
sell_index = 0
max_profit = 0
length = len(price_list)
for i in xrange(length - 1):
for j in xrange(i + 1, length):
profit = price_list... | true |
62db876959a04f3d477c29fbf726e9952b280c1e | nhsvnu-python/learning-python | /faker/faker1.py | UTF-8 | 117 | 2.734375 | 3 | [] | no_license | from faker import Faker
fake = Faker()
for _ in range(10):
print(f"{fake.name()},{fake.job()},{fake.company()}") | true |
c826e5b0d76043951d057ab0668c78804b01e491 | antoniorcn/fatec-2019-2s | /djd-prog2/teste-viewport/teste-viewport1.py | UTF-8 | 9,517 | 3.03125 | 3 | [] | no_license | import pygame
import random
AMARELO = (255, 255, 0)
PRETO = (0, 0, 0)
AZUL = (0, 0, 255)
VERMELHO = (255, 0, 0)
ROSA = (238, 174, 238)
LARANJA = (255, 147, 51)
VELOCIDADE_BOCA = 0.3
ACIMA = 0
ABAIXO = 2
ESQUERDA = 3
DIREITA = 1
pygame.init()
screen = pygame.display.set_mode((800, 600), 0)
tamanho = int(600 / 30) * 2... | true |
fbd497bc70f08a11bea89aee93af265fa6159333 | FellowshipOfTheGame/Chocolate-Jack | /src/utils.py | UTF-8 | 269 | 2.5625 | 3 | [] | no_license | __author__ = 'iury'
'''
Module that contains utils functions
'''
def safe_load(function, *args):
import sys
if 'linux' in sys.platform:
args = args[0].replace('\\','/')
else:
args = args[0].replace('/','\\')
return function(args)
| true |
f294ef6833956b0a87791ca16b815124fa5b61f5 | cancel-zen/bubble_sort | /bubble_sort.py | UTF-8 | 313 | 4.09375 | 4 | [] | no_license | def bubble_sort(array=[]):
for i in range(len(array)-1): #进行n-1轮排序,i由0开始
for j in range(len(array)-1-i):#每一轮比较前面n-i个
if array[j]>array[j+1]:
array[j],array[j+1]=array[j+1],array[j]
my_array=[]
bubble_sort(my_array)
print(my_array)
| true |
ef3605f126003daf6eda8ed5831dc2cbc45436cb | ilzxc/metaknobtwiddler | /parameter_search.py | UTF-8 | 1,420 | 2.515625 | 3 | [] | no_license | #!/usr/bin/python
"""Performs bayesian parameter optimization using parameters described in
params.py file and data in inputted csv file"""
from __future__ import division
import os
import argparse
import numpy as np
import neural_networks
import bayesian_parameter_optimization as bpo
from params import nnet_params, hy... | true |
310b6543f5e7cf7fd3d7210598234188b160c9d6 | SovanCSE/practice_python_packages | /app/os_module/practice3.py | UTF-8 | 452 | 2.796875 | 3 | [] | no_license | import os
if __name__ == '__main__':
#This function gives you the name of the operating system dependent module imported
print(os.name)
#Get current working directory full path from which directory, you are executing your script.
print(os.getcwd())
print(os.path.abspath('.'))
#get working sc... | true |
2ccf4349ae7aa98642db803597d228dae056c3c8 | lowgiant/py_data_structure_and_algorithms | /01-Data_structure/01-23_if/01-23_19_exception.py | UTF-8 | 560 | 3.109375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
def ConnectToNexPort(self, minimum):
"""사용 가능한 다음 포트에 연결한다. 새 minimum 포트를 반환한다."""
if minimum <= 1024:
raise ValueError('1025 이상의 포트를 입력해야 합니다.')
port = self._FindNextOpenPort(minimum)
if not port:
raise ConnectionError('%d 포트에 연결할 수 없습니다. '% (minimum,))
as... | true |
3a27c47187f583a1e95b69a745b053fd80769c46 | ArmaniL/ExtendedEssayInvestigation | /ImperativeMergeSort.py | UTF-8 | 2,038 | 2.796875 | 3 | [] | no_license | import ListUtilFunctions as W
import time
def merge(left, right):
arr = []
leftid, rightid = 0, 0
while leftid < len(left) and rightid < len(right):
if left[leftid] <= right[rightid]:
arr.append(left[leftid])
leftid += 1
else:
arr.append(righ... | true |
469eebbb5e74f25e8c3d1f3cc15fd5925fce427a | limonpudding/psu-trrp-lab3 | /soap-client/client.py | UTF-8 | 1,806 | 3.25 | 3 | [] | no_license | from soap import soap_request
from params import Params
import yaml
def load_wsdl_url():
with open("config.yaml", 'r') as stream:
try:
data = yaml.safe_load(stream)
print('Загружен файл конфигурации.')
print(f"Ссылка на сервис: {data['soap.wsdl.url']}.")
ret... | true |
8b186d99ceeb4d3085ebe3d82dc73fe5f5171be1 | legendronyang/python-exercise | /20160412_HappyNumber.py | UTF-8 | 1,774 | 3.890625 | 4 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
'''
202. Happy Number https://leetcode.com/problems/happy-number/
Write an algorithm to determine if a number is "happy".
A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its dig... | true |
a9e3d65105356b9b2352279ab45c34ab6056b513 | 0xcabrex/Rexbot | /cogs/Support.py | UTF-8 | 4,574 | 2.546875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import discord
from discord.ext import commands
from discord.ext.commands import cooldown,BucketType
class SupportCog(commands.Cog):
def __init__(self, bot):
self.bot = bot
# Bug reporting
@commands.command(name='bugs', aliases=['bug'])
@cooldown(1, 10, BucketType.guild)
async def bug_report(self, ctx, *, m... | true |
bd7fb55b4f6bdbaa65096dc625d1e2677ec0db2f | AnDa-creator/Python-games-and-projects | /genexamplE/challengeprime.py | UTF-8 | 706 | 3.46875 | 3 | [] | no_license | def prime_nums():
current = 2
count = 0
while True:
yield current
while True:
current += 1
for val in range(1, current):
print(val)
if current % val == 0:
count += 1
if count == 1:
break
... | true |
6427c5c3d4d01a8afafd6a55bc25fa3435a92a22 | Jon-Ting/UH-DA-with-PY-summer-2019 | /part06-e05_plant_clustering/ans.py | UTF-8 | 849 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python3
import scipy
from sklearn.datasets import load_iris
from sklearn import cluster
import sklearn
def find_permutation(n_clusters, real_labels, labels):
permutation=[]
for i in range(n_clusters):
idx = labels == i
# Choose the most common label among data points in the ... | true |
e42fb4feabbf21b40c59bb8985d72b579e9365d2 | hmsls/ML_AI | /PandasDesc.py | UTF-8 | 22,597 | 3.640625 | 4 | [] | no_license | #coding: utf-8
"""
Pandas:数据分析处理库,封装了Numpy,一般用这个
"""
import pandas as pd
import numpy as np
import datetime
import matplotlib.pyplot as plt
if __name__ == '__main__':
#**********************************************************Pandas概述**********************************************
#从csv中读取数据
df_file = pd.rea... | true |
0d1e3d9b986a983a372a75fe7be4b3c5c719aa0a | ifumagalli/tesimagistrale | /mybin/bin_no_back_tracking/optimization.py | UTF-8 | 5,404 | 3.25 | 3 | [] | no_license | """ Classes implementing optimization methods.
??? Per ora GradientMethod eredita da OptimizationMethod, ma essendo una policy forse sara' meglio cambiare il legame tra le due classi
"""
from dolfin import *
from math import *
from functions import *
from numpy import *
import copy
#=====================
class O... | true |
418a628a9d32777ec909a0a9dc96c08207e95f95 | guojia60180/guo.github-io | /爬虫实例/MongoDB存储学习2.py | UTF-8 | 1,446 | 2.96875 | 3 | [] | no_license | #Author guo
import pymongo
client=pymongo.MongoClient(host="127.0.0.1",port=27017)
db=client.test
collection=db.students
results=collection.find()
for result in results:
print(result)
count=collection.find().count()
print(count)#统计符合条件的条数
results=collection.find().sort('age',pymongo.ASCENDING)#根据年龄的升序排列
print([r... | true |
ac7fb3697a55da0535ddea3d40468bbde99e1cbb | beathan/django-facebookgraphapi-pages | /facebookapi/views.py | UTF-8 | 4,286 | 2.6875 | 3 | [] | no_license | """
Using the Graph API requires that we perform OAuth authorization and store
the access token for API requests. The Facebook user logging in MUST have
admin access to all Facebook Pages we're interested in, or empty data responses
will be returned by Facebook.
The OAuth flow works as follows:
1. Request access
http... | true |
7f3db1c9d3910cd8ca85ec71328bf604334b5db9 | black-swan-rational/sci-logger | /app/sci-loger.py | UTF-8 | 4,037 | 2.765625 | 3 | [] | no_license | from logic import *
import sys, os
import getopt
import argparse
#global todo
"""
rozhodit do viac suborov,
porobit csv nacitavanie
rozumnejsie handlovanie argumentov
poriadny man
menej vypisov
functions:
loading old codes/experiments with given parameters file
"""
def man():
#urobit zoznam prikazov a tomu len n... | true |
280e2c1b6c7aea0274c6e24cbb097a3c65c57f61 | tenten0113/python_practice | /python_test/mypy/example.py | UTF-8 | 223 | 3.609375 | 4 | [] | no_license | class Person:
def __init__(self, firstname, lastname):
self.firstname = firstname
self.lastname = lastname
def show(self):
print(f'私の名前は{self.lastname}{self.firstname}です! ')
| true |
99e0716b84cf63733d14dd64826b2cff619ac0e5 | bergscott/scanning-dat-cleanup | /cleaner.py | UTF-8 | 18,475 | 3.0625 | 3 | [] | no_license | import datetime
FILENAME = 'vbextrct.dat'
NAME_START = 40
NAME_END = 58
NAME_LEN = NAME_END - NAME_START + 1
FIRST_NAME_START = 59
FIRST_NAME_END = 64
FIRST_NAME_LEN = FIRST_NAME_END - FIRST_NAME_START + 1
ANSWERS_START = 90
ANSWERS_END = 289
ANSWERS_LEN = ANSWERS_END - ANSWERS_START + 1
NUMQ_START = 76
NUMQ_END = 78
... | true |
0fd85f6894797d5a15bde143e61a5e6111f0df78 | imaaduddin/Everything-Python | /variable_scope.py | UTF-8 | 392 | 3.875 | 4 | [] | no_license | # scope = the region that a variable is recognized
# a varibale is only available from inside the region it is created
# a global and locally scoped versions of a variable can be created
name = "Levi" # this is a global scope (avilable inside and outside functions)
def display_name():
name = "Eren" # this is loc... | true |
b1826d6c8717a362d713c4907bee8fab8c03df50 | shixuekai08/alltools | /release/LOG.py | UTF-8 | 688 | 2.640625 | 3 | [] | no_license | __author__ = 'shixuekai'
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject, Qt
class LOG(QObject):
infoChanged = pyqtSignal(str, arguments = ["msg"],name="infoChanged")
warningChanged = pyqtSignal(str, arguments = ["msg"],name="warningChanged")
errorChanged = pyqtSignal(str, arguments = ["msg"],name=... | true |
cd27d98fd661bd5b2629e630f64949f4ccf625a4 | mairml/Network-Analysis | /matrix-to-network.py | UTF-8 | 2,782 | 3.578125 | 4 | [] | no_license | ####Reads csv matrix and filters data based on user-based P-value or R score threshold. Outputs to network csv file.
def matrix_filter(infile, value, operand, outfile):
outfile = open(outfile, 'w')
removal = []
#Open input csv document
with open(infile, 'r') as file1:
#Fill in columnList values
... | true |
5ba0d662c09bc161fc88d1dcf1f9daa9f3477b92 | OrvizarHub/TkinterApp | /pomodoro.py | UTF-8 | 5,300 | 2.859375 | 3 | [
"MIT"
] | permissive | import threading
import time
import datetime
import sqlite3
import os
import tkinter as tk
from tkinter import messagebox as msg
class CountingThread(threading.Thread):
def __init__(self, master, start_time , end_time):
super().__init__()
self.master = master
self.start_time = start_time
... | true |
aca8d859b45e87b05b68881ef777c45cd58f6a40 | toirl/pynunzen | /tests/test_ledger.py | UTF-8 | 6,485 | 2.515625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_ledger
----------------------------------
Tests for `ledger` package.
"""
import pytest
import datetime
from pynunzen.helpers import utcts
from pynunzen.ledger.blockchain import (
Blockchain,
validate_block,
generate_genesis_block,
generate_new_... | true |
2d64e6d627679aa3974f2f230bfdae09bd83bd98 | aywong/ece2524-1 | /examples/greet.py | UTF-8 | 753 | 3.734375 | 4 | [] | no_license | #! /usr/bin/env python2
import sys
def foo_funct(arg):
print "Hello {}, nice to meet you!".format(arg)
def bar_funct(arg):
print "Goodbye {}!".format(arg)
try:
prog,action,name = sys.argv
except ValueError as e:
sys.stderr.write("Usage: {} <action> NAME\n".format(sys.argv[0]))
sys.stderr... | true |
2d7e9f015852faaed561a9ba08fab49371322253 | SowmyaGayam/PYTHONPRACTISE | /TwentyFour.py | UTF-8 | 159 | 3.65625 | 4 | [] | no_license | year=int(input("Enter a year"))
if((year%4==0 and year%100!=0) or (year%400==0)):
print(f"{year} is LEAP YEAR...")
else:
print(f"{year} is COMMON YEAR....")
| true |
d40739b59e713885762e2b02663bbec3f9784bf3 | arkocal/tetai | /utils.py | UTF-8 | 1,660 | 2.703125 | 3 | [] | no_license | import itertools
import os
from ai_players import RandomAIPlayer, SklearnMLPAIPlayer, TorchAIPlayer
def print_field(field, active_cos=None, clear=False):
if clear:
os.system("clear")
if active_cos == None:
active_cos = []
width = len(field)
height = len(field[0])
for y in range(hei... | true |
0cc21be43830056f42ac95fe6fafb486bbe4635f | Sai-Ram-Adidela/hackerrank | /challenges/regex and parsing/detecting_floating_point_number.py | UTF-8 | 386 | 3.34375 | 3 | [] | no_license | """
Title : Detecting Floating Point Number
Subdomain : HackerRank/Python3/Challenges/Regex and Parsing
Domain : Python3
Author : Sai Ram Adidela
Created : 23 Sep 2019
"""
import re
def verify_float(no):
print(bool(re.match(r'^[-+]?[0-9]*\.[0-9]+$', no)))
if __name__ == '__main__':
cas = int(input... | true |
f7bed8d8f5d10e834340fa47b8dba7b5824e8de6 | dhairay-thakur/stock-bot | /App.py | UTF-8 | 1,855 | 2.703125 | 3 | [] | no_license | import matplotlib
import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
import yfinance as yf
def update_daily_company(company_name):
df = yf.download(f'{company_name.upper()}.BO', period='1d', progress=False)
return df
async def hourly_updates(company_name='RELIANCE', duration='... | true |
37b95fbe296cec00a4188739e6d3091f38caac76 | detkartik/mysites | /events/models.py | UTF-8 | 553 | 2.609375 | 3 | [] | no_license | from django.db import models
# Create your models here.
class Event(models.Model):
name = models.CharField(max_length=150, null=True, blank=True)
day = models.DateField(u'Day of the event', help_text=u'Day of the event')
start_time = models.TimeField(u'Starting time', help_text=u'Starting time')
end_... | true |
969b115416869f39a1d568c910e32fefa438362c | sandeepsuri/trec_search | /Sandeep_Rank/trec_car/read_files.py | UTF-8 | 6,040 | 2.65625 | 3 | [] | no_license |
import read_data
import format_runs
import mmap
import re
import nltk
import sys
import math
import random
import collections
import pandas as pd
import cbor
import itertools
import typing
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
from collections import defaultdict
intro_msg = "He... | true |
b0ce97b352c387023409046a627957459b00c2a5 | PiyuGandhi/NLP_Challenges | /flipkart_query.py | UTF-8 | 3,079 | 3.640625 | 4 | [] | no_license | # Importing Libraries
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.pipeline import Pipeline
from sklearn.svm import LinearSVC
import re
import numpy as np
x_train = []
y_train = []
def words(text):
"""Get Words out of a string.
Arguments:
text {str} -- Text
Returns:... | true |
67693b25a698df62a91880e1890a8d0ef54d2e90 | nguyntony/class | /medium_exercises/medium_sequences/4.py | UTF-8 | 283 | 3.265625 | 3 | [] | no_license | list1 = [1, 2, "hi", "bye", 1, 2, "hi", "bye", 3, "hibye"]
# list2 = [1, 2, "hi", "bye", 3, "hibye"]
# list3 = list1 + list2
dedupe_list = list(dict.fromkeys(list1))
print(dedupe_list)
no_dupe = []
for i in list1:
if i not in no_dupe:
no_dupe.append(i)
print(no_dupe)
| true |
d02e45f890ad9d8c85e5fdc7ba3ef66244a45726 | danielzengqx/Python-practise | /CC150 5th/CH11/11.2.py | UTF-8 | 522 | 3.796875 | 4 | [] | no_license | #Write a method to sort an array of strings so that all the anagrams are next to each other.
#hastable, total time cost -> O(nlog(n))
def anagram(list1):
dic = {}
for elem in list1:
key = ''.join(sorted(elem))
#print key
if key in dic:
dic[key] = dic[key] + [elem]
else:
dic[key] = [elem]
ans = []
fo... | true |
37d66dd006567fee756e0b3fd37afe53a2525642 | cmcconomy/adventofcode | /2017/day9/day9.py | UTF-8 | 3,371 | 3.1875 | 3 | [] | no_license | import unittest;
import re;
problem_num='9'
inputfile='input.txt'
#########
# Setup
#########
with open(inputfile) as f:
file_input_text = f.read()
#########
# Funcs
#########
def basic_split(input_text):
return [line for line in input_text.split('\n') if len(line)>0]
def parse(stream):
in_garbage=False
... | true |
727ae1731b29f2363b23e220beb33b7d0c07a7f4 | Aasthaengg/IBMdataset | /Python_codes/p03126/s379369297.py | UTF-8 | 218 | 2.53125 | 3 | [] | no_license | n,m=map(int,input().split())
d=[0 for i in range(m)]
for i in range(n):
k=list(map(int,input().split()))
for i in range(len(k)-1):
d[k[i+1]-1]+=1
ans=0
for i in d:
if i==n:
ans+=1
print(ans) | true |
831ee68f4d7ffba2e78434834f054fb3044791d7 | kingking888/CommNewsExtractor | /NewsExtractors/tools/automatic_detect.py | UTF-8 | 258 | 2.65625 | 3 | [
"MIT"
] | permissive | import chardet # 字符集检测
import urllib.request
# 自动获取网站解码方式
def automatic_detect(url):
content = urllib.request.urlopen(url).read()
result = chardet.detect(content)
encoding = result['encoding']
return encoding
| true |
a34cbc3683faf1b19cb2e0e13687f981d076fd18 | SSJKiDo/PythonTests | /atm solution/atm.py | UTF-8 | 1,781 | 3.703125 | 4 | [] | no_license | class ATM:
def __init__(self, balance, bank_name):
self.balance = balance
self.bank_name = bank_name
self.withdrawals_list = []
self.withdrawal_time = []
def withdraw(self, requested_money, available_currency = [100,50,10,5,1]):
import datetime
print "Welcome to... | true |
da59de8ac5a659c6bfcfc7f7e7dc345ef554e026 | Amli/py27hash | /test/python/test/testset.py | UTF-8 | 2,328 | 2.875 | 3 | [
"MIT"
] | permissive | # pylint: disable = C0111,W0622,E0401
import pickle
import os
import unittest
from py27hash.hash import hash27
from py27hash.set import Set
class TestSet(unittest.TestCase):
def test_small(self):
d = Set()
for x in range(15):
d.add(str(x))
self.assertEqual(hash27("".join(d))... | true |
fae844ddee164c85a4e71a7e01c386cf67cc2233 | zhaoxuyan/LeetCode_Python | /136_Single_Number.py | UTF-8 | 921 | 4.03125 | 4 | [] | no_license | # 给定一个非空整数数组,除了某个元素只出现一次以外,其余每个元素均出现两次。找出那个只出现了一次的元素。
# 说明:
# 你的算法应该具有线性时间复杂度。 你可以不使用额外空间来实现吗?
#
# 示例 1:
# 输入: [2,2,1]
# 输出: 1
# 示例 2:
# 输入: [4,1,2,1,2]
# 输出: 4
# 4. 找出非成对的数
# 一大串数,成双成对,只有一个落单.如果快速揪出来?
# 根据性质1,异或所有数,所有成双成对的都挂掉了.我们就可以在一大串数中找到落单的.
# A^B^C^D^C^B^A=D.被揪出来了.
class Solution(object):
def singleNum... | true |
a7d24615c171f7e67741dfa23e42bdab4bc655c2 | fredless/headshotTools | /update_wxteams_avatar.py | UTF-8 | 5,571 | 2.59375 | 3 | [] | no_license | # Copyright (C) 2019 Frederick W. Nielsen
#
# This file is part of headshotTools.
#
# headshotTools is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any la... | true |
e103a2be07bca42579cb335b22cd428afe578c53 | benslawski/adaptly-timecard | /DBInterface.py | UTF-8 | 1,390 | 2.515625 | 3 | [] | no_license | ## python modules
from storm.locals import *
from time import *
def getDBhandle():
dbname = 'postgres://zsvwepxgwlatsi:ds7mjUOpoc7cmF9yq6CYT2Rg4_@ec2-54-227-255-156.compute-1.amazonaws.com:5432/d29g35ktn19ke2'
store = None
while not store:
try:
database = create_database(dbname)
... | true |
977e9bde3d9cca03134cdf4dfa28b2dad0d9c0ed | dersonf/aulaemvideo | /aulas/aula07a.py | UTF-8 | 304 | 4.21875 | 4 | [] | no_license | #!/usr/bin/python36
n1 = int(input('Digite um valor: '))
n2 = int(input('Digite outro valor:'))
print('A soma é {}'.format(n1 + n2), end=' ')
print('A subtração é {}'.format(n1 - n2))
print('A multiplicação é {:.3f}\n A divisão é {:.3f}, a potência é {}'.format (n1 * n2, n1 / n2, n1 ** n2))
| true |
89474a502bfd27d98d7432bab297253b5c141087 | EspadaSer/BBSaveScum | /V1/BBSaveScum.py | UTF-8 | 2,586 | 2.671875 | 3 | [] | no_license | import glob
import os
import time
import datetime
# Change the path of your folders with \\ as separator
savegame_path = "D:\\Users\\Admin\\Documents\\Battle Brothers\\savegames"
savescum_path = "D:\\Users\\Admin\\Documents\\Battle Brothers\\SaveScum Backups"
# Savegame file extension. Usually its sav
ext = "sav"
# S... | true |
a483949dd3f1cad1e1c13171f8a6174409282cc8 | zma9216/Histogram_Operations | /A1_submission.py | UTF-8 | 8,662 | 3.15625 | 3 | [] | no_license | from skimage import io, img_as_ubyte
import skimage.exposure as exp
import numpy as np
import matplotlib.pyplot as plt
import os
os.chdir(os.path.dirname(__file__))
def read_image(filename, gray):
"""
Function for reading images using scikit-image
Reads image as grayscale and converts to
unsigned by... | true |
83b39a2d8bad1b453eb284cba83657e46795f773 | Cuigroup/i9x8 | /make_x8 | UTF-8 | 1,512 | 2.578125 | 3 | [
"CC-BY-4.0"
] | permissive | #!/usr/bin/python
import pybel
import copy
import numpy as np
from sys import argv
def calc_com(mol):
mol_mass = 0.0
com = np.zeros(3)
for atom in mol.atoms:
mol_mass += atom.atomicmass
com += np.array(atom.coords) * atom.atomicmass
com /= mol_mass
return com
c_xyz = argv[1]... | true |
2f06aa3b58839d6317af3817ad1edd44ac31e172 | ruifengli-cs/leetcode | /DP/1. Matrix DP/120. Triangle.py | UTF-8 | 3,806 | 3.6875 | 4 | [] | no_license | class Solution:
# APP1: Recursion definition: p(i,j): minimum path sum from i, j to the bottom
# p(i, j) = min(p(i + 1, j) + p(i + 1, j + 1)) + t[i][j]
# Time: O(2^n) space: O(1) where n = len(t) Runtime: TLE
def minimumTotal(self, triangle: List[List[int]]) -> int:
if not triangle or not triang... | true |
2af7ed92e0ee91b1d0f12cb5ebb24c319d7a4ba2 | zhangrui184/k_means | /point.py | UTF-8 | 301 | 3.46875 | 3 | [] | no_license | import math
class Point:
def __init__(self, latit_, longit_):
self.latit = latit_
self.longit = longit_
def euclidean_distance(self, another_point):
return math.sqrt(math.pow(self.latit - another_point.latit, 2.0) + math.pow(self.longit - another_point.longit, 2.0))
| true |
5e1007743cf3f23e5469ec80d4f6e2f7f085ca9b | Debjit337/Problem-code | /1.Calculator.py | UTF-8 | 2,975 | 3.859375 | 4 | [] | no_license | '''
Sir code toh erroe nehi hai par string value dene ke baad message se bahar nikal deh raha hai.
Bas yehi problem hai matlab uske baad message phir se call nehi ho raha hai.kya karu?
'''
# again choice
def again_choice():
# user se option ke liye condtion
message = '''
---------------------------------
... | true |
c44d07f83c87c75e9cb3b02d961dacf85fd686b3 | Nora-Wang/Leetcode_python3 | /Dynamic Programming/516. Longest Palindromic Subsequence.py | UTF-8 | 1,223 | 3.71875 | 4 | [] | no_license | Given a string s, find the longest palindromic subsequence's length in s. You may assume that the maximum length of s is 1000.
Example 1:
Input:
"bbbab"
Output:
4
One possible longest palindromic subsequence is "bbbb".
Example 2:
Input:
"cbbd"
Output:
2
One possible longest palindromic subsequence is "bb".
Con... | true |
9bc077e66ea7826cc5a4692eb682ba396dd70ccb | PsycheShot/assignment3 | /2.py | UTF-8 | 2,367 | 3.125 | 3 | [] | no_license | import csv
with open('coursedata.csv', mode='r') as csv_file:
csv_reader = csv.DictReader(csv_file)
lst = [row for row in csv_reader]
uQuali = input("Enter a qualification: ")
count = 0
for i in range(0,len(lst)):
if lst[i]["Qualification"]==uQuali:
print(lst[i]["Name"]... | true |
9e2e949b65492cc798c35cbd7fbad527af1cd95a | ministryofjustice/autodata-formula | /autodata/files/auto-resize-data-fs | UTF-8 | 8,370 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python
#
# Opinionated script to automatically manage the size of a single LV
# with a known filesystem type.
#
# Designed with the intention that all data will be stored in this LV, mounted
# under /data (though this is not prescribed here)
#
# If new storage is added to the machine as an 'sd' device, i... | true |
55c71a9f003b30e149eb90f25ea5d9e625097632 | AmeyaVir/Robot | /robopkg/scripts/arm_core.py | UTF-8 | 11,725 | 2.734375 | 3 | [] | no_license | import sys
import time
import rospy
import pyuarm
# Import messages type
from std_msgs.msg import String
from std_msgs.msg import Float32
from std_msgs.msg import UInt8
from std_msgs.msg import Int32
from robopkg.msg import Angles
from robopkg.msg import Coords
from robopkg.msg import CoordsWithTime
from robopkg.msg i... | true |
843c4c46a736f8d1b1d31d31860baa5181de568f | Shubham20091999/Problems | /HackerRank/Validating Credit Card Numbers.py | UTF-8 | 1,664 | 3.734375 | 4 | [] | no_license | # https://www.hackerrank.com/challenges/validating-credit-card-number/problem
def isValid(s: str):
if(s[0] == '4' or s[0] == '5' or s[0] == '6'): # Checking if first number is 4,5 or 6
if(len(s) == 19): # Checking if number is '-' seperated
if(s[4] == s[9] == s[14] == '-'):#Checking if '-' oc... | true |
47a25c28bd3ea13ba00b39d69167ac7dbde0fe6f | Sudhakaran7/Patching_array | /patch.py | UTF-8 | 521 | 2.875 | 3 | [] | no_license | class Solution(object):
def minPatches(self, nums, n):
"""
:type nums: List[int]
:type n: int
:rtype: int
"""
patch, miss, i = 0, 1, 0
while miss <= n:
if i < len(nums) and nums[i] <= miss:
miss += nums[i]
i += 1
... | true |
d13c9f8061956bca6f2dbab4022c32c7674110e8 | CalebCov/Caleb-Repository-CIS2348 | /Homework1/5.19.py | UTF-8 | 2,186 | 3.71875 | 4 | [] | no_license | #Caleb Covington
print("""Davy's auto shop services
Oil change -- $35
Tire rotation -- $19
Car wash -- $7
Car wax -- $12
""")
select_first = input("Select first service:\n")
select_second = input("Select second service:\n")
first_service_cost = int(0)
second_service_cost = int(0)
print("\nDavy's auto shop invoice\n... | true |
45f585581696c419dee29a66c3ed0aee9ab6ad2d | jmgc/pyston | /microbenchmarks/polymorphism.py | UTF-8 | 1,702 | 3.90625 | 4 | [
"Python-2.0",
"Apache-2.0",
"BSD-2-Clause"
] | permissive | # This microbenchmark is inspired by the ICBD type checker, which has a "scoring" phase at
# the end of the analysis.
# I'm not sure how representative this file is of the type checker, or even if
# this is really a polymorphism test or maybe just a tree test, or some cross of the two.
class Union(object):
def __i... | true |
47b802c2b33d110f0dc758da5ff83dfc91fba9b9 | YaoYinYing/Yi_Ge_Ding_Lia | /lia.py | UTF-8 | 4,445 | 2.59375 | 3 | [
"MIT"
] | permissive | import json
import random
import re
idiom_file = "./chinese-xinhua-master/data/idiom.json"
replace_char_dict_extract = {"āáǎà": 'a', "ōóǒò": 'o', "ēéěèê": 'e', "īíǐì": 'i', "ūúǔù": 'u', "ǖǘǚǜ": 'v'}
replace_char_dict_bootstrap = {'a': "āáǎà", 'o': "ōóǒò", 'e': "ēéěèê", 'i': "īíǐì", 'u': "ūúǔù", 'v': "ǖǘǚǜ"}
... | true |
ec64559c8f17fabd5982d5c65353c94ef358fedb | jasonshih/SchematicChecker | /schematicAnalyzer/Analyzer.py | UTF-8 | 4,783 | 2.65625 | 3 | [] | no_license | from .SchemComponent import *
from collections import defaultdict
class PathAnalyzer(SpecialSymbols, SpecialNets):
def __init__(self):
self.logger = logging.getLogger(__name__)
SpecialSymbols.__init__(self)
SpecialNets.__init__(self)
self.path_reference = []
self.path_und... | true |
4558ae27f2bc2f32457eea1b7d4303044be14b99 | larry1101/Socketest | /client_tkinter.py | UTF-8 | 5,443 | 2.671875 | 3 | [] | no_license | import datetime
import json
import socket
import threading
import traceback
from tkinter import Tk, Label, StringVar, Entry, Button, Frame, TOP, X, EW, NSEW, Listbox, BOTH, RIGHT, LEFT, END, \
BOTTOM
class MyClient:
def __init__(self):
self.__ini_data()
print('Data prepared...')
self._... | true |
a3bbe6b669d4a975bbbb513054b78bff0cb0d91c | noreallyimfine/lambdata | /lambdata_noreallyimfine/df_helper_class.py | UTF-8 | 1,819 | 3.703125 | 4 | [
"MIT"
] | permissive | import random
import pandas as pd
class Helper:
""" DataFrame Helper Class - some useful tools for working with
Pandas DataFrames """
def __init__(self, df):
self.df = df
self.length = len(df)
self.shape = df.shape
self.cols = [col for col in df.columns]
def more_rows(... | true |
4309a808d346c34165c595606ef97f26f594235f | AK-1121/code_extraction | /python/python_2960.py | UTF-8 | 94 | 3.25 | 3 | [] | no_license | # Generator in if-statement in python
if any(s.lower() == "foo" for s in list): print "found"
| true |
415aa201dc14a5433f4397a8308cfd84048ca7f9 | annazof/LCbasic2021 | /Baisc Track/how_to_think/HelloWorld.py | UTF-8 | 200 | 3.171875 | 3 | [] | no_license | print("Hello World!")
#1. Incorrect syntax stenence: i cook dinner
## Semantic error I have an angry jacket.
#2.
1+2
4*3 #multiplication
4**4 #exponentiate
print("hello")
"hello"
6+4*9
print("6+4*9") | true |
2c52daed68517b15973a71e1835972f73dd8dd66 | pdinkins/cookbook | /terminal_app_login.py | UTF-8 | 5,008 | 3.09375 | 3 | [] | no_license | from time import sleep
import os
login = False
run = True
titlestat = [0]
if login == False:
titlestat.clear()
titlestat.append(2)
#### Classes
class Admin:
def __init__(self, username, password):
self.username = username
self.password = password
class DateTime():
def dt(self):
... | true |
d42118a77a138377c721a3247c099c610bc865ca | achen6159/turtles | /turtles/turtle_demo.py | UTF-8 | 2,486 | 3.328125 | 3 | [] | no_license | from turtle import *
import math
radius=int(input("What is the radius of the flower? "))
petals=int(input("How many petals do you want? "))
import turtle
bob = turtle.Turtle()
bob.speed(100)
bob.shape("turtle")
bob.color("gold")
def draw_arc(b,r):
c = 2*math.pi*r
ca = c/(360/60)
n =... | true |
eca3a215e1675536735083fbb43b88a7574a880c | Silentsoul04/PythonCode | /OpenCL/demo3D.py | UTF-8 | 2,244 | 3 | 3 | [] | no_license | import pyopencl as cl
import numpy as np
"""
OpenCL demo:
"""
source = """
__kernel void test(__global const float *a, __global const float *b, __global float *c)
{
int i = get_global_id(0);
int j = get_global_id(1);
int k = get_global_id(2);
int m = get_global_size(0);
int n = get_global... | true |
9def4c9d758bfad0407276860f8a87f06389078f | kunalghosh/BECS-114.1100-Computational-Science | /exercise5/problem2.py | UTF-8 | 4,500 | 2.78125 | 3 | [
"BSD-2-Clause"
] | permissive | from __future__ import division
from scipy.linalg import hilbert
import numpy as np
from pprint import pprint
import pylab as pl
def new_solve(A,b):
A = np.asarray(A, np.float)
b = np.asarray(b, np.float)
# Create the scale vector max(abs(ri)) of each row ri in A
S = np.zeros(A.shape[0], np.float)
... | true |
7483cb752d8ae0fccbe87bca3c6c98c331f6769e | mounika6699/Python | /DurgaSoft-Programs/Python Fundamentals/Type Casting_complex.py | UTF-8 | 591 | 4.15625 | 4 | [] | no_license | #Converting different Data Types into Complex
a=10
b=complex(10)
c=complex(10.5)
d=complex(True)
e=complex(False)
f=complex("10")
g=complex("10.5")
print("The complex form of integer",a,"is :",b)
print("The complex form of float number 10.5",b)
print("The complex form boolean type True and False is:",d,"and",e)
print('... | true |
5af7e5137fd71b778c91ba203868f2b4bfed3c12 | jaum1234/primeiros-passsos-com-python | /adivinhacao.py | UTF-8 | 1,220 | 4.34375 | 4 | [] | no_license | print("*********************************\n")
print("Bem vindo ao jogo de adivinhaçao!");
print("\n*********************************\n")
numero_secreto = 42;
tentativa = 1;
total_tentativas = 3;
while (tentativa <= total_tentativas):
print("Tentativa ", tentativa, " de ", total_tentativas, end="\n\n");
# A ... | true |
caff0d80aa314cf46a5dcb661d08339ce9ed517e | dzkcoming/py_learn | /jichu/cycle.py | UTF-8 | 322 | 3.578125 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# cycyle
classmate = ['douzhk', 'libang', 'zhengli']
for name in classmate:
print (name)
sum = 0
for i in range(101):
sum += i
print ("sum : ", sum)
# while cycle
sum = 0
i = 0
while True:
sum += i
i += 1
if (i == 101):
break
print ("sum : ", sum... | true |
cb679b208ead32b49334c709473cd695cb95326c | fubst0318/webscrapy_practice | /chapter3/crawlWikipedia.py | UTF-8 | 945 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
from urllib.request import urlopen
from bs4 import BeautifulSoup
import re
pages = set()
def getLinks(pageUrl):
global pages
html = urlopen('https://en.wikipedia.org/' + str(pageUrl))
bsObj = BeautifulSoup(html)
try:
print(bsObj.h1.get_text())
... | true |
d8ec30b4cfd48cc38fb65a1ba9b0ab929c03cbe3 | Tigenzero/Deep-RL-Course-1 | /Cartpole - Policy Gradient/cartpole_trainer/trainer.py | UTF-8 | 6,331 | 2.640625 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import logging
from reward_processing.reward_processing import RewardProcessing
class Trainer(object):
def __init__(self, model_path, episode_save_num=100):
self.episode_states = []
self.episode_actions = []
self.episode_rewards = []
self.... | true |
3518e72ab365795b2c3f2b788bce9ed011f5c106 | DLHub-Argonne/dlhub_cli | /dlhub_cli/commands/run.py | UTF-8 | 1,618 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | import json
import click
from dlhub_cli.config import get_dlhub_client
from dlhub_cli.printing import format_output
from dlhub_cli.parsing import dlhub_cmd
# @click.option('--servable-uuid',
# default=None, show_default=True, required=False,
# help='The uuid of the servable to invoke.')
# ... | true |
a8b082d12fb466471a5a294de7d75bf66173b600 | Shridhik/Python-Projects | /asgn6/in class 1.py | UTF-8 | 336 | 3.53125 | 4 | [] | no_license | def count_words(L):
d = dict() # d is the dictionary into which we'll put the histogram
for word in L:
d[word] = d.get (word, 0) + 1
return (d)
result = count_words ("the quick brown fox runs over the lazy dog".split())
print (result)
for word in sorted(result.keys()):
print (word,... | true |
3dbfeb139d6f879742b0edd120ba1f38ffae81c2 | john-zcliu/SDP-Project | /electroMagnet.py | UTF-8 | 178 | 2.859375 | 3 | [] | no_license | from motors import Motors
from time import time, sleep
em = Motors()
magnet1 = 4
magnet2 = 5
def runMagnet():
em.move_motor(magnet2, 100)
def stopMagnet():
em.stop_motors()
| true |