blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
e96d20b23237dd5ccef05aadcd70e3e818857b7d | Python | dprestsde/Web_explorator | /Explorator/ip_address.py | UTF-8 | 424 | 2.828125 | 3 | [] | no_license | import os
def get_ip_address(url):
command = "host " + url
process = os.popen(command)
results = str(process.read())
marker = results.find('has address') + 12
print("IP Address completed!")
# return results[marker:].splitlines()[0]
return results[marker:].splitlines()[1]
... | true |
5db0e10299c91d18658dda3d99e6331effaf55ef | Python | alexcrichton/wasmtime-py | /tests/test_instance.py | UTF-8 | 5,853 | 2.890625 | 3 | [
"LLVM-exception",
"Apache-2.0"
] | permissive | import unittest
from wasmtime import *
class TestInstance(unittest.TestCase):
def test_smoke(self):
module = Module(Store(), '(module)')
Instance(module, [])
def test_export_func(self):
module = Module(Store(), '(module (func (export "")))')
instance = Instance(module, [])
... | true |
4ae2ecddcbf38f33676ddb1041bff527a1699b29 | Python | fsbr/unh-startracker | /analysisAndPlots/astro/image/centerPixelCircle.py | UTF-8 | 281 | 2.84375 | 3 | [] | no_license | #
from PIL import Image, ImageDraw
image = Image.open('figimage.jpg')
draw = ImageDraw.Draw(image)
# change this when the calibration vs. when you're making hte thesis figure
r = 1450/2
x = 1936
y = 1296
draw.ellipse((x-r, y-r, x+r, y+r))
image.save('maxradius.png')
image.show()
| true |
dfd6eec37a34258a95609a6b976a423d3cbf6fe4 | Python | AmiteshMagar/Physics-Dept._PyTut-2 | /p10.py | UTF-8 | 388 | 3.59375 | 4 | [] | no_license | def subRout10(n,Lx,Ly):
LyPrime = []
#this for us to compute the last value
Lx.append(Lx[0])
Ly.append(Ly[0])
for i in range(n):
calc= (Ly[i+1] - Ly[i])/(Lx[i+1] - Lx[i])
LyPrime.append(calc)
Ly.pop(len(Ly)-1)
return LyPrime
#testing subRout10 -- works perfectly!
... | true |
dceafb36fc330bcce81fd8147b2d52d61ab1da9c | Python | jes5918/TIL | /Algorithm/SWEA/알고리즘응용/1251_하나로_kruskal.py | UTF-8 | 4,755 | 3.140625 | 3 | [] | no_license | # 처음엔 다익스트라로 풀라고 생각했지만
# 다익스트라는 모든 경로를안가고 출발지부터 목적지까지 최단거리로 갈 수 있는 경우를 찾는 것이기 때문에
#
# 최소신장트리 방법 사용
# 그래프의 속성을 가지고 있으며 간선에 가중치를 추가 한 그래프의 하위 개념인 트리
# 최소한의 비용으로 모든 도시를 연결하는 도로를 설계하는 문제를 풀기 적합한 알고리즘
# 간선의 가중치를 기준으로 사이클을 제거하여 필요한 정보만 가지는 방식
# 가장 작은 가중치를 가지는 트리를 만드는 알고리즘
# - 프림(Prim) 알고리즘 : 정점에 연결 된 간선의 가중치 중 가장 작은 가중치의 간선... | true |
799b832ff22714e93afe16514f5b6de81a0a203e | Python | kball/ambry | /ambry/geo/colormap.py | UTF-8 | 6,555 | 2.84375 | 3 | [
"BSD-2-Clause"
] | permissive | '''
Created on Mar 17, 2013
@author: eric
'''
def _load_maps():
import os.path
import ambry.support
import csv
def cmap_line(row):
return {
'num': int(row['ColorNum'].strip()),
'letter': row['ColorLetter'].strip(),
'R': int(row['R'].strip())... | true |
8bc9965eae87df32297b30167570ac4585911834 | Python | komo-fr/pep_map_site | /pep_map/acquirer/pep_acquirer.py | UTF-8 | 9,585 | 2.890625 | 3 | [] | no_license | import collections
from datetime import datetime
import os
from pathlib import Path
import re
from bs4 import BeautifulSoup
import pandas as pd
import numpy as np
from .acquirer import Acquirer
class PepAcquirer(Acquirer):
def __init__(self,
should_save_raw_data: bool= False,
r... | true |
0680b00f24ecfc9ffeaa6be09e939ef62e90f70d | Python | saxenamahima/8085-emulator | /funcyions.py | UTF-8 | 10,550 | 2.53125 | 3 | [] | no_license | import extras
import registers
import set_flags
import validate
#####################################################
# ARITHMETICS #
#####################################################
def ADD(register):
if not validate.validate_reg(register):
print "I... | true |
ac466a13bde1493b85def1f039a1e52ea90ee003 | Python | shguan10/webcam-touchscreen | /collect_data.py | UTF-8 | 1,513 | 2.5625 | 3 | [] | no_license | import cv2
import numpy as np
import pdb
import common
def prompted():
cap = cv2.VideoCapture(0)
cap.set(cv2.CAP_PROP_FRAME_WIDTH, common.MAXCOLS)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, common.MAXROWS)
finger_pixels = common.sample_finger(cap)
background = common.sample_background(cap)
circle_position = c... | true |
bb1e469fcbcaccd1563f0d93862b7b0d11214b75 | Python | seven320/powarun | /main/src/powarun.py | UTF-8 | 3,094 | 2.9375 | 3 | [] | no_license | # encoding utf-8
import os, sys
import datetime as dt
from dotenv import load_dotenv
import tweepy
import get_weather
class Powarun():
def __init__(self):
load_dotenv(".env")
auth = tweepy.OAuthHandler(
consumer_key = os.environ.get("CONSUMER_KEY"),
consumer_secret = os.env... | true |
5394e3658e9b0f0394b4d7b9a2be0a957520ed0f | Python | User9000/100python | /ex20.py | UTF-8 | 90 | 3.25 | 3 | [] | no_license | d = {"a": 1, "b": 2,"c":3}
sum=0
for keys,val in d.items():
sum= sum + val
print(sum) | true |
064223e30861e49d030af3fe91c06e82a8a2db6a | Python | ericjenny3623/15-112 | /random/approximations.py | UTF-8 | 1,037 | 3.46875 | 3 | [] | no_license |
# sum = 0
# n = 8
# a = 0
# b = 2
# delta = (b-a)/n
# precision = 6
# def f(x):
# return 1 / (1 + x**6)
# def printf(x):
# print(round(x, precision))
# for i in range(n):
# x = delta*(i+0.5) + a
# y = f(x)
# sum += y
# printf(y)
# printf(sum)
# printf(sum*delta)
# print("+++++++++++++++++... | true |
ca5e3faa1e511279bfeae6bf512616f14548099f | Python | ciabo/BinaryTrees | /RB.py | UTF-8 | 4,383 | 3.265625 | 3 | [] | no_license | import ABR
class RBNode(ABR.Node):
def __init__(self,key,nil):
super().__init__(key,nil)
self.color = "black"
def getColor(self):
return self.color
def setColor(self,color):
self.color=color
class RBTree(ABR.Tree):
def __init__(self):
self.nil=RBNode(None,None... | true |
0a1efdeba5d99a2462d1a5b268e3196c60ba954f | Python | tnakaicode/jburkardt-python | /sftpack/r8vec_sct.py | UTF-8 | 3,756 | 2.71875 | 3 | [] | no_license | #! /usr/bin/env python3
#
import numpy as np
import matplotlib.pyplot as plt
import platform
import time
import sys
import os
import math
from mpl_toolkits.mplot3d import Axes3D
from sys import exit
sys.path.append(os.path.join("../"))
from base import plot2d, plotocc
from timestamp.timestamp import timestamp
from i... | true |
cc4df2d28ace53ef4f14ef2828e92ed061210496 | Python | amomin/proje | /python/p88/solution.py | UTF-8 | 1,075 | 2.9375 | 3 | [] | no_license | import math, sys, time
import MillerTest
isPrime = MillerTest.MillerRabin
tic = time.clock()
MIN = 2
MAX = 12201
COUNTMAX=12000
def getDivSums(n,min=2):
solns = [[n,1,[n]]]
if isPrime(n):
return solns
for i in range(min,n/2+1):
if n%i==0:
res = getDivSums(n/i,i)
for x in res:
_l=x[2]+[i]
new_sol... | true |
7a31d67203b5102fb8e968b5a97d360cd0b6b376 | Python | letouch/SDCNL | /web-scraper.py | UTF-8 | 4,146 | 2.78125 | 3 | [] | no_license | # Web-Scraper for Reddit Data
# Data used for paper and results were last scraped in September 2020.
# Adapted from (https://github.com/hesamuel/goodbye_world/blob/master/code/01_Data_Collection.ipynb
# data analysis imports
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt... | true |
17b69c73c6374633fcd6ef0b68efef0fbc0f21f1 | Python | sumajali/Learning-Python- | /Interview_Programs/positive_number_or_negative_number.py | UTF-8 | 544 | 4.1875 | 4 | [] | no_license | # Positive number or Negative number
num = int(input("Enter a number to check positive or Negative:- "))
if num < 0:
print("It is a Negative number")
elif num == 0:
print("0 is a positive number")
else:
print(f'{num} number is positive number')
# positive or negative number using functi... | true |
efcfdbe3777fd2c7b86363df48f7fa643a3c8dee | Python | box-key/pyspark-project | /tests/test_dict_lookup.py | UTF-8 | 5,739 | 2.828125 | 3 | [] | no_license | import pytest
from pyspark import SparkContext
from pyspark.sql import SparkSession
from collections import defaultdict
import csv
import os
import datetime as dt
import re
sc = SparkContext()
NYC_CSCL_PATH = 'nyc_cscl.csv'
root = 'data'
violation_records = [os.path.join(root, 'violation_small1.csv'),
... | true |
fd815447808cee8d5734076189f7b3ca0989475a | Python | gulinmerve/Ptyhon-InterviewQuestions | /1.microsoft.py | UTF-8 | 1,474 | 3.4375 | 3 | [] | no_license | given array = 3, 10, 2, 1, 20
Output: 3
The longest increasing subsequence is 3, 10, 20
given array = 3, 2
Output: 1
The longest increasing subsequences are {3} and {2}
given array = 50, 3, 10, 7, 40, 80
Output: 4
The longest increasing subsequence is {3, 7, 40, 80}
given array = [0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 1... | true |
b0639e9c0dc867c91e65a39b5b8e5e05da8172ea | Python | roxel/pydiary | /manage.py | UTF-8 | 1,479 | 2.53125 | 3 | [
"MIT"
] | permissive | from app import create_app
from app.database import db
from flask import url_for
from flask_script import Manager, Command
from flask_migrate import Migrate, MigrateCommand
# Creates new app compatible with production environment (built for heroku)
app = create_app('config.ProductionConfig')
migrate = Migrate(app, db)... | true |
0c46cc00ffdb22290a3331c08470718ad988b991 | Python | claraocarroll/plasmodiumscripts | /bamgraphing2.py | UTF-8 | 2,546 | 3.4375 | 3 | [] | no_license | '''
Created on 10 Jun 2020
@author: Clara
'''
#import the module - from '/Users/Clara/anaconda2/lib/python2.7/site-packages'
import pysam
#import the graphing software
import matplotlib
matplotlib.use('Agg') #this tells matplotlib we may not necessarily have access to a screen
from matplotlib import pyplot as plt #thi... | true |
e012fa17f16a5d4f110465e965809bb358139d9d | Python | JosuePoz/PyGamePrueba | /prueba5.py | UTF-8 | 1,057 | 3.125 | 3 | [] | no_license | import pygame, sys, random
pygame.init()
size = (800, 500)
# Crear ventana
screen = pygame.display.set_mode(size)
#Reloj
clock = pygame.time.Clock()
#Colores
Black = ( 0, 0, 0 )
White = ( 255, 255, 255 )
Red = ( 255, 0, 0 )
Green = ( 0, 255, ... | true |
5318542fb281d6a0f2b1d4479714020b318c3f59 | Python | Amulya0506/Python_CS5590 | /Assignments/Lab Assignment-3/Logistic_Regression.py | UTF-8 | 4,021 | 2.96875 | 3 | [] | no_license | import numpy as np
import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
import tensorflow as tf
iris = pd.read_csv('dataset.csv')
iris.Species = iris.Species.replace(to_replace=['Iris-setosa', 'Iris-versicolor'], value=[0, 1])
X = iris.drop(labels=['Id', 'Species'], axis=1).values
y = iris.Specie... | true |
f5f272c5cc1a9c410e1668fe187fab5e315ed933 | Python | adri-romsor/iterative_inference_segm | /models/fcn_resunet_blocks.py | UTF-8 | 7,175 | 2.65625 | 3 | [] | no_license | from keras.layers import (Activation,
merge,
Dropout,
Lambda)
from keras.layers.normalization import BatchNormalization
from keras.layers.convolutional import (Convolution2D,
MaxPooling2D,
... | true |
49eb2924a4cd6751e242e7f2dbb40673b9504410 | Python | BigBlackBug/csi_task | /test.py | UTF-8 | 1,327 | 2.546875 | 3 | [] | no_license | import os
import pickle
from aiohttp.test_utils import AioHTTPTestCase, unittest_run_loop
import constants
from predictor import predictor
from predictor.routes import routes
from web import app
class MainTestCase(AioHTTPTestCase):
async def get_application(self):
return app.init(routes=routes, loop=sel... | true |
84ba9ddb4d6b54e48006846d41f095dba1f17838 | Python | kazi0/random | /random.py | UTF-8 | 521 | 4.40625 | 4 | [] | no_license | import random
print("Welcome to the Number gussing game!!")
number = random.randint(1, 9)
chance = 0
print("Guess a number from 1 to 9")
while chance < 5:
guess = int(input("Enter your guess:- "))
if(guess == number):
print("You did find the number!!!")
break
elif(guess... | true |
d1558b9588c0892a229a78fd2c95d27d1793464e | Python | soaibsafi/project-euler-python | /023.py | UTF-8 | 1,992 | 4.0625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Oct 3 16:20:15 2020
@author: Soaib
"""
""""
Problem:
A perfect number is a number for which the sum of its proper divisors is exactly equal to the number.
For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28,
which means that 28 is a perfect ... | true |
6e6e253afa849dd314f277a7b9dad6e4db070fba | Python | fcdmoraes/aulas_FitPart | /aula9.py | UTF-8 | 1,989 | 3.640625 | 4 | [] | no_license | class Cavalo(object):
numero = 0
def __init__(self, npatas, cor, peso):
self.npatas = npatas
self.cor = cor
self.peso = peso
# print(self)
Cavalo.numero += 1
def engorda(self, dieta):
print("peso antigo:", self.peso)
self.peso += dieta
print("peso atual:", self.peso)
def __repr__(sel... | true |
38af4389fb481fe8cf9f9afb3c981f57fac9a92a | Python | Panda4817/Advent-of-Code-2018 | /24.py | UTF-8 | 11,563 | 3.0625 | 3 | [] | no_license | from copy import deepcopy
from math import floor
class Group:
def __init__(
self,
id,
amount,
hit_points,
attack_damage,
attack_type,
initiative,
weaknesses=[],
immunities=[],
):
self.id = id
self.amount = amount
s... | true |
4e9e9a151287159092d645752a07205f5be9076e | Python | SR2k/leetcode | /first-round/536.从字符串生成二叉树.py | UTF-8 | 2,060 | 3.46875 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=536 lang=python3
#
# [536] 从字符串生成二叉树
#
# https://leetcode-cn.com/problems/construct-binary-tree-from-string/description/
#
# algorithms
# Medium (53.68%)
# Likes: 61
# Dislikes: 0
# Total Accepted: 2.7K
# Total Submissions: 5K
# Testcase Example: '"4(2(3)(1))(6(5))"'
#
# 你需要从一个包括括号和整数的... | true |
e5dff5217f52d3350574152a9d6a53e5cf9f8b29 | Python | mavharsha/Learn-Python-The-Hard-Way | /ex3.py | UTF-8 | 392 | 4.0625 | 4 | [] | no_license | print "I will now count my chickens:"
print "Hens", 25 +30/6
print "Roosters", 100 - 25 *3 %4
print "Now I will count the eggs:"
print 3+2+1-5+4%2-1/4+6
print "Is it true that 3+2 < 5-7 ? ", 3+2 < 5-7
print "What is 3+2", 3+2
print "What is 5-7", 5-7
print "How about some more."
print "Is it greater?", 5>-2
pr... | true |
d4b463a892fa2b68371dcbc766470263d795dba4 | Python | Success2014/Leetcode | /anagrams_2.py | UTF-8 | 612 | 3.40625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 01 16:30:11 2015
@author: Neo
"""
class Solution:
# @param {string[]} strs
# @return {string[]}
def anagrams(self, strs):
res = []
d = {}
for word in strs:
word_st = ''.join(sorted(word))
if word_st in d:
... | true |
29559ebae1ab5672ccbe06a3fa4e84f04e97b968 | Python | shomin/dynopt_hw4 | /python/ros_drc_wrapper/src/process.py | UTF-8 | 2,573 | 2.953125 | 3 | [] | no_license | #!/usr/bin/python
import os
import signal
from subprocess import Popen, PIPE
import time
import threading
import Queue
class Process(object):
def __init__(self, cmd, stdin=False, stdout=False, stderr=False):
self._stdin = self._stderr = self._stdout = None
if stdin:
stdin=PIPE
... | true |
5b9fa6589f3a9d92a8c74af08a0f715b89f9b9c1 | Python | gcpreston/aoc-2020 | /day15.py | UTF-8 | 1,376 | 3.796875 | 4 | [] | no_license | from typing import Optional, List
with open('input/day15.txt') as f:
starting_nums = [int(n) for n in f.read().strip().split(',')]
def last_time_spoken(nums: List[int], n: int) -> Optional[int]:
""" Figure out the last time n appeared in nums. """
i = len(nums) - 1
for checking in reversed(nums):
if chec... | true |
52e2e64331f8f3c1db6ba9cc2ccf4bdef5ab238a | Python | poojasgada/HackProj | /visualizeds/BinarySearchTree/BinarySearchTreePy.py | UTF-8 | 1,926 | 4.34375 | 4 | [] | no_license | '''
Binary Search Tree Library in Python
Binary Search Tree functions supported
- Search for val
- Print: Preorder, Postorder, Inorder
- Insert
- Delete
- IsBST
- Size
- Minimum value
- Maximum value
'''
class Node:
def __init__(self, val):
self.val = val
self.left = None
self.right = None
#BST = Binary S... | true |
4bef8c24fefd36e272819f8bb0cf6df40ddc6670 | Python | phc260/leetcode | /Python/merge-intervals.py | UTF-8 | 678 | 3.3125 | 3 | [] | no_license | # Definition for an interval.
# class Interval:
# def __init__(self, s=0, e=0):
# self.start = s
# self.end = e
class Solution:
# @param intervals, a list of Interval
# @return a list of Interval
def merge(self, intervals):
intervals.sort(key = lambda x:x.start)
... | true |
63ab59a533b94846a123a75c8bedb2bc46ae7af9 | Python | misaka-10032/leetcode | /coding/00231-power-of-two/solution.py | UTF-8 | 327 | 2.59375 | 3 | [] | no_license | # encoding: utf-8
"""
Created by misaka-10032 (longqic@andrew.cmu.edu).
TODO: purpose
"""
class Solution(object):
def isPowerOfTwo(self, n):
"""
:type n: int
:rtype: bool
"""
p = 1
while p <= n:
if p == n:
return True
p <<= 1... | true |
69ade7d45d014e2819a77ba6ccee2d699290dc75 | Python | adas-eye/RosADAS | /src/lanedet/Ultra-Fast-Lane-Detection/lane_tracker.py | UTF-8 | 2,739 | 2.671875 | 3 | [
"MIT"
] | permissive | import numpy as np
from lane_obj import Lane
import configs.testconfig
CFG = configs.testconfig.cfg
class LaneTracker:
def __init__(self):
self.leftlane = Lane('left')
self.rightlane = Lane('right')
self.detectedLeftLane = np.zeros([12,2], dtype = int)
self.detectedRightLane = np.... | true |
95338952c7b73794be637ead6058c1f472bfc92a | Python | adafruit/circuitpython | /tests/basics/string_fstring.py | UTF-8 | 1,318 | 3.640625 | 4 | [
"MIT",
"GPL-1.0-or-later"
] | permissive | def f():
return 4
def g(_):
return 5
def h():
return 6
print(f'no interpolation')
print(f"no interpolation")
print(f"""no interpolation""")
x, y = 1, 2
print(f'{x}')
print(f'{x:08x}')
print(f'a {x} b {y} c')
print(f'a {x:08x} b {y} c')
print(f'a {"hello"} b')
print(f'a {f() + g("foo") + h()} b')
def foo... | true |
7cd67c76c28bb9e52d5431ab13993574ac0d43ba | Python | Lyly81/InstaIRobotLinks | /getLinks.py | UTF-8 | 2,466 | 2.546875 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.by import By
import time
import random
from datetime import date
import dat... | true |
ce14a0159d8158afb44b4fd4f61dd58a34c3494c | Python | marcelogarro/challenges | /Algorithms/merge_sort.py | UTF-8 | 697 | 3.71875 | 4 | [
"ISC",
"BSD-2-Clause"
] | permissive | import unittest
def merge_sort(array):
if len(array) < 2:
return array
pivot = round(len(array)/2)
left = array[:pivot]
right = array[pivot:]
return merge(merge_sort(left), merge_sort(right))
def merge(left, right):
result = []
while left and right:
if left[0] > right[... | true |
97b3e3660f20efa9910721c1f8ea6e3be500dfc7 | Python | AdamYF/Learning-Pygame-Coding | /Chapter 7/chapter basic knowledge.py | UTF-8 | 1,388 | 3.421875 | 3 | [] | no_license | import pygame
# 使用pygame.sprite模块(主要是其中的Sprite类)对位图实现动画
# Sprite精灵包含一幅图像image和一个位置rect
# 我们必须使用自己的类来扩展,从而提供一个功能完备的游戏精灵类
# 精灵序列图,包含了“贴图”或“帧”组成的行和列
# 其中的每一个都是动画序列的一帧
# 行和列的标签都是从0开始的
# 精灵族会自动调用update()方法,类似于调用draw()方法
# 我们可以自己编写独有的update()方法,但是draw()方法不会被取代
# 它向上传递到了父方法pygame.sprite.Sprite.draw()
# 我们要确保的是pygame.sprite.... | true |
23c58744fd4f0bca4f247437f85cd4205de4b60b | Python | Mi-Przystupa/NormalizingFlowsNMT | /araNorm.py | UTF-8 | 4,687 | 3.609375 | 4 | [
"MIT"
] | permissive | # encoding: utf-8
'''--------------------------------------------------------------------------------
Script: Normalization class
Authors: Abdel-Rahim Elmadany and Muhammad Abdul-Mageed
Creation date: Novamber, 2018
Last update: Jan, 2019
input: text
output: normalized text
---------------------------------------------... | true |
5f6f6f973514478a12e0f85391ccdcfc6592163f | Python | BenLHedgepeth/django_user_profile | /accounts/validate.py | UTF-8 | 1,342 | 3.109375 | 3 | [] | no_license | import re
from string import punctuation
from django.core.exceptions import ValidationError
def validate_bio(value):
if len(value) < 10:
raise ValidationError("Add more detail to your bio.")
def validate_date(value):
pattern = r'(\d{2}/d{2}/d{4})|(\d{4}-\d{2}-\d{2})|(\d{2}/d{2}/d{2})'
result = ... | true |
7c1c8527265cf308360b1256d906b3e76dcc6236 | Python | uchicago-sg/caravel | /vendor/dominate/util.py | UTF-8 | 3,923 | 2.71875 | 3 | [
"MIT"
] | permissive | '''
Utility classes for creating dynamic html documents
'''
__license__ = '''
This file is part of Dominate.
Dominate is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (a... | true |
77f788e0037ff73335a4f0f25181da0001a64f63 | Python | feiyanshiren/myAcm | /leetcode/t000561.py | UTF-8 | 466 | 3.484375 | 3 | [] | no_license | from typing import List
class Solution:
def arrayPairSum(self, nums: List[int]) -> int:
nums.sort()
return sum([nums[i] for i in range(0, len(nums), 2)])
s = Solution()
import time
t = time.time()
for i in range(1000):
print(s.arrayPairSum([1, 4, 3, 2]))
print(s.arrayPairSum([1... | true |
937506de774b0f25a11db9f1d4c6c29ec00a861e | Python | SampathDontharaju/CloudComputing | /Hadoop-MapReduce/Twitter 5th solution/reduce2.py | UTF-8 | 247 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
import sys
import string
max=0
screenName= ''
for line in sys.stdin:
data = line.strip('\n').split('\t')
if int(data[0])> max:
max= int(data[0])
screenName = data[1]
print '%s\t%s' % (max,screenName)
| true |
72819b5773afc90f26f3a7dd019290cf95bd8c16 | Python | lotcarnage/macbook_photo_organizer | /delete_duplicated_files.py | UTF-8 | 3,351 | 2.53125 | 3 | [
"MIT"
] | permissive | import os
from datetime import datetime
from tqdm import tqdm
import PIL.Image
import PIL.ExifTags
import argparse
def __is_jpeg(file_path):
ext = os.path.splitext(file_path)[1].lower()
return ext in [".jpg", ".jpeg"]
def __is_mov(file_path):
ext = os.path.splitext(file_path)[1].lower()
return ext in ... | true |
796b9ff999d977583bb193e10c2d093bfccfd498 | Python | wally-wally/TIL | /02_algorithm/baekjoon/problem/1000~9999/2638.치즈/2638.py | UTF-8 | 1,462 | 2.75 | 3 | [] | no_license | import sys
sys.stdin = open('input_2638.txt', 'r')
def BFS():
melting_idx = []
queue = [[0, 0]]
visited = [[False] * M for _ in range(N)]
while queue:
pop_elem = queue.pop()
for i in range(4):
new_row, new_col = pop_elem[0] + dx[i], pop_elem[1] + dy[i]
if 0 <= ne... | true |
d6649c2a947ba87b5c69004135faa2dd0ac3cd7f | Python | mrvollger/SDA | /scripts/coverageByEnds.py | UTF-8 | 1,997 | 2.734375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import argparse
import os
import sys
import re
import numpy as np
import intervaltree
import pandas as pd
parser = argparse.ArgumentParser(description="")
parser.add_argument("-a", "--reads", nargs="+", help="bed file(s) with read start and end locations" )
parser.add_argument("-b", "--regions", ... | true |
14186998277f4d64e214e1169a3e64ad7f0705ab | Python | mds2/mazegen | /ProduceMazeBook.py | UTF-8 | 644 | 3.15625 | 3 | [
"MIT"
] | permissive | # Generates a booklet of mazes
#
# Run as ProduceMazeBook.py width height pages > output_file
# e.g.
# python ProduceMazeBook.py 18 24 10 > booklet.ps
#
# Prints to standard out
import MazeGen
import sys
if __name__ == "__main__":
try:
(w, h) = [int(x) for x in sys.argv[1:][:2]]
except:
(w, h)... | true |
f19a08351bc73ca0d5903bf17e164488610c47db | Python | fengyihuai/Learn_Python | /class3/turtle_hist.py | UTF-8 | 523 | 3.625 | 4 | [] | no_license | # -*- coding: UTF-8 -*-
import turtle
# myTurtle = turtle.Turtle()
from turtle import *
def doBar(height, clr):
begin_fill()
color(clr)
setheading(90)
forward(height)
right(90)
forward(40)
right(90)
forward(height)
end_fill()
values = [49, 118, 201, 241, 168, 266, 221, 65, 231]
colo... | true |
7a566aa70fb1e74c54bf270beb52b0a6e7ae2697 | Python | vcrawford/DeviceCaching | /ContactGraph/VisualizeContactGraph.py | UTF-8 | 1,744 | 2.859375 | 3 | [] | no_license | # Take a contact graph file and output dot file visualizing it
# Call like python VisualizeContact.py contact_graph.txt output_graph.dot ...
# output_graph.eps 0.01 cache_nodes.txt
import sys
import subprocess
import xml.etree.ElementTree as et
contact_data = sys.argv[1]
output_file = sys.argv[2]
output_file_im = sys... | true |
5e914d55371d3c8c2feec2e49ee45afa1ccb519d | Python | jacobwaller/beer-bot | /code/bot/controller_ws/src/controller/controller/controller_node.py | UTF-8 | 4,046 | 2.53125 | 3 | [
"MIT"
] | permissive | from typing import final
import rclpy
import time
from rclpy.node import Node
from rclpy.duration import Duration
from controller.robot_navigator import BasicNavigator, NavigationResult
# Msgs
from std_msgs.msg import String
from std_msgs.msg import Empty
from geometry_msgs.msg import PoseStamped
from geometry_msgs.m... | true |
f9eaab083081c90eefdfa33a68e58ce1ed62e748 | Python | mrelich/GalacticPlot | /tools.py | UTF-8 | 3,906 | 3.0625 | 3 | [] | no_license |
from math import pi
#import ephem
import numpy as np
import matplotlib.pyplot as plt
#------------------------------------#
# Plot Galactic Coordinates
#------------------------------------#
def galPlot(lat, lon, origin=0, title="Galactic",projection="mollweide"):
# The latitude needs to be shifted into the ... | true |
5841d3d1544855d9aa47eebe74fd72b0eb8064dd | Python | bj1570saber/muke_Python_July | /cha_9_class/9_15_super.py | UTF-8 | 525 | 3.828125 | 4 | [] | no_license | from human_class import Human
class Student(Human):
def __init__(self,school,name,age):
self.school = school
#Human.__init__(self,name, age)# should use super.
super(Student, self).__init__(name,age)
# function overriding
def do_homework(self):
super(Student, self).d... | true |
8ae742fe459d70217a921226e371e4d0551bbbc1 | Python | Woohoo82/bullshit_generator | /goodidea.py | UTF-8 | 993 | 2.921875 | 3 | [] | no_license | #!/usr/bin/python3
import random
ragok = ["-ébe", "-ében", "-éből", "-én", "-ére", "-éről", "-énél", "-éhez", "-étől", "-éig", "-ének", "-ért", "-ként"]
igek = list(open('dic_verb.txt'))
mnevek = list(open('dic_adj.txt' ))
igenevek=list(open('dic_mi.txt' ))
fonevek= list(open('dic_noun.txt'))
def gen_alany():
... | true |
675b991dcba92eb76256f03b6ea92b7602e5c7bf | Python | ahmeeed-mohamed/myCS427project | /client2.py | UTF-8 | 1,135 | 3.171875 | 3 | [] | no_license | import socket
from cryptography.fernet import Fernet
def client_program():
host = socket.gethostname() # as both code is running on same pc
port = 5003 # socket server port number
client_socket = socket.socket() # instantiate
client_socket.connect((host, port)) # connect to the server
file = ... | true |
715e31ab09eca0ce5a4881646c757a158631adec | Python | Honeyfy/semi-supervised-text-classification | /src/models/applying_trained_model.py | UTF-8 | 908 | 2.78125 | 3 | [
"BSD-3-Clause"
] | permissive | import pandas as pd
from src.models.text_classifier import TextClassifier
def apply_trained_model(model_id, data_filename):
# a function applying a trained model to a new csv file and returning a dataframe with predicted label and confidence.
model_path = r'C:\develop\code\semi-supervised-text-classification\d... | true |
7ae48291d8798ffd8b9c5b57ce72008a8c77b6e4 | Python | Zumbalamambo/variational-autoencoder-benchmark | /model/base.py | UTF-8 | 652 | 2.96875 | 3 | [
"MIT"
] | permissive | from abc import abstractmethod, ABC
from sklearn.metrics import log_loss, mean_squared_error
class Encoder(ABC):
@abstractmethod
def encode(self, x):
pass
@abstractmethod
def decode(self, encoded_x):
pass
def recon_error(self, x, metric='cross_entropy'):
encoded_x = self.e... | true |
7ddd0463ff8cbbcdc7fb0b8022fd4d31efb1a2a1 | Python | LauYuLoong/python_study | /deepcopy.py | UTF-8 | 197 | 2.609375 | 3 | [] | no_license | # -*- encoding = gbk -*-
from copy import deepcopy
if __name__ == '__main__':
d = {'names':['Alfred','Bertrand']}
c = d.copy()
dc = deepcopy(d)
d['names'].append('Clive')
print c
print dc | true |
54f45f4912f2d6139ae505285b88422d98ba5cf5 | Python | Aijeyomah/Budget-App | /index.py | UTF-8 | 1,518 | 3.9375 | 4 | [] | no_license | # Budget App
# Create a Budget class that can instantiate objects based on different budget categories like food, clothing, and entertainment. These objects should allow for
# 1. Depositing funds to each of the categories
# 2. Withdrawing funds from each category
# 3. Computing category balances
# 4. Transferring b... | true |
b1379ddd05f23aa8a45390c2059c48898b360550 | Python | mangei-ux/30DaysOfPython | /Day 11/day11.py | UTF-8 | 990 | 2.6875 | 3 | [] | no_license | from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import smtplib
host = "smtp.gmail.com"
port = 587
username = "wsadevv@gmail.com"
password = "$sec#wsabsi630"
sender = username
to_list = "williansantana.angola@gmail.com"
# it dont render hrml
email_conn = smtplib.SMTP(host, port)
e... | true |
857d0ffa220787f163fdb17ab70b381c7ce03362 | Python | rayruchira/Autoencoders-miniprojects | /CFRecSys.py | UTF-8 | 4,250 | 2.953125 | 3 | [] | no_license | #import required libraries
import tensorflow as tf
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import os
#getting required files
r_df = pd.read_csv('/home/ray/Projects/datasets/train_100k.csv', delimiter = ',')
r=np.array(r_df, dtype=int)[:,1:]
r_t_df = pd.read_csv('/home/ray/Projects/data... | true |
26b854f9ddd0312933fcc18ee81aca7b456d35ab | Python | hchrist2010/CS-331-Introduction-to-Artificial-Intelligence | /assignment2/Players.py | UTF-8 | 3,451 | 3.203125 | 3 | [] | no_license | '''
Erich Kramer - April 2017
Apache License
If using this code please cite creator.
'''
class Player:
def __init__(self, symbol):
self.symbol = symbol
# PYTHON: use obj.symbol instead
def get_symbol(self):
return self.symbol
# parent get_move should not be called
de... | true |
905167551ab4c53420926b8b36d34804da1ca380 | Python | Aasthaengg/IBMdataset | /Python_codes/p03598/s209015805.py | UTF-8 | 139 | 2.953125 | 3 | [] | no_license | n = int(input())
k = int(input())
array = list(map(int,input().split()))
count = 0
for i in array:
count += min([i,k-i])
print(count*2) | true |
1ee2f219d0d16e59b7ea1ae1fdc49c51cf195110 | Python | kpiyush16/learning_sequence_encoders | /utils.py | UTF-8 | 2,564 | 2.734375 | 3 | [] | no_license | import numpy as np
import calendar
def JulianDate_to_MMDDYYY(y,jd):
month = 1
day = 0
while jd - calendar.monthrange(y,month)[1] > 0 and month <= 12:
jd = jd - calendar.monthrange(y,month)[1]
month = month + 1
d = jd
if jd//10 == 0:
d = '0'+str(jd)
return ([x... | true |
a3e7370b45c893471d4addadca462fc9179181b1 | Python | johnruiz24/covid-tracker | /data/data.py | UTF-8 | 7,758 | 2.515625 | 3 | [] | no_license | import os
import re
import wget
import glob
import requests
import numpy as np
import pandas as pd
from bs4 import BeautifulSoup
from datetime import datetime, timedelta
urls = ['https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_... | true |
96b52d1170699c9e694f99a7b1633e5048fb7106 | Python | INBNETWORK/crowd | /submodules/poa-token-market-net-ico/ico/sign.py | UTF-8 | 2,894 | 2.734375 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | """Sign data with Ethereum private key."""
import binascii
import bitcoin
from ethereum import utils
from ethereum.utils import big_endian_to_int, sha3
from secp256k1 import PrivateKey
def get_ethereum_address_from_private_key(private_key_seed_ascii: str) -> str:
"""Generate Ethereum address from a private key.
... | true |
2b3648cc073fcf61cb83f0fe0c62d88a6e8fb48a | Python | kavanchen/Python000-class01 | /Week_03/G20200389010196/second assignment/pmap.py | UTF-8 | 1,641 | 3.203125 | 3 | [] | no_license | #扫描给定网络中存活的主机(通过ping来测试,有响应则说明主机存活)
import sys
import subprocess
import time
import socket
from threading import Thread
def ping1(ip, n):
command="ping %s -n %d"%(ip, int(n))
print(ip,("通","不通")[subprocess.call(command,stdout=open("nul","w"))])
def ping(ip, n=4):
ipx = ip.split('-')
ip2num = la... | true |
c03e53f3cb1cc55501f0ccabbca90dcfc111f613 | Python | MaratAG/HackerRankPy | /HR_PY_Basic_Data_Types_4.py | UTF-8 | 873 | 3.953125 | 4 | [] | no_license | # HackerRank Basic Data Types 4 Finding the percentage
def problem_solution(students_and_grades):
# Task function
name_of_students = input().strip()
if name_of_students in students_and_grades.keys():
grades_of_students = students_and_grades[name_of_students]
average_mark_of_student = \
... | true |
c96fd7d7620272e20cbb35fd5b10b1f3335b3409 | Python | bartlomiejlu/Python--Volcanoes-in-the-USA | /volcanoes.py | UTF-8 | 1,096 | 2.796875 | 3 | [] | no_license | import folium
import pandas
data = pandas.read_csv("Volcanoes_USA.txt")
lat = list(data["LAT"])
lon = list(data["LON"])
elev = list(data["ELEV"])
def color_producer(elevation):
if elevation < 1000:
return 'green'
elif 1000 <= elevation < 3000:
return 'blue'
else:
retu... | true |
da07b090bba20917eb5e855283f514995b67b90c | Python | gkqha/leetcode_python | /codewar/4kyu/ Human readable duration format.py | UTF-8 | 1,342 | 3.375 | 3 | [] | no_license | def format_duration(seconds):
if seconds==0:
return "now"
year = seconds // 31536000
yearDay = seconds % 31536000
day = yearDay // 86400
dayHour = yearDay % 86400
hour = dayHour // 3600
hourMinute = dayHour % 3600
minute = hourMinute // 60
second = hourMinute % 60
res = [... | true |
ead0c0cc3d34b062ef3b4a13cb5c671f03047d2f | Python | Alwaysproblem/simplecode | /COPInterview/sum_subarray.py | UTF-8 | 1,229 | 2.859375 | 3 | [] | no_license | #!/bin/python3
import math
import os
import random
import re
import sys
# def subarraySum(a):
# import bisect
# mm,pr=0,0
# a1=[]
# for i in a:
# pr=(pr+i)%m
# mm=max(mm,pr)
# ind=bisect.bisect_left(a1,pr+1)
# if(ind<len(a1)):
# mm=max(mm,pr-a1[ind]+m)
# ... | true |
4839463635566a8143f0a073c02d650943a31910 | Python | JRLi/untitled | /GDC/aaa.py | UTF-8 | 2,528 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python
import pandas as pd
import numpy as np
import os
''''a = {}
b = set()
print(type(a), type(b))
a = {1, 3, 4}
b = {1, 4 ,5}
print(type(a))
print(a.union(b))
d = a.intersection(b)
print(a)
a.update(b)
print(a)
a = [1, 2, 3]
a.append('5')
print(a)
print(b) # return None to b
print('xxxxx')
a = 'a... | true |
6e563a3912819d5be887d1306f636ccf86ed05d9 | Python | ddelgadoJS/KenKen | /kenken.py | UTF-8 | 223,254 | 2.515625 | 3 | [
"MIT"
] | permissive | #José Daniel Delgado Segura
#2015001500
#21-05-2015
#Programa 2 - Pasatiempo Aritmético KenKen
#————————————————————————————————————————————————————————————————————————centrar————————————————————————————————————————————————————————————————————————#
def centrar(ventana): #Centra la ventana que se abre. Todas las... | true |
3d7e2e3b0c9dabec4bb6de66d9d63f35ab1698d4 | Python | marcoguastalli/my_python | /001_input-validation/file_check_test.py | UTF-8 | 1,966 | 3.03125 | 3 | [
"MIT"
] | permissive | """
Test for the main program
"""
import errno
import unittest
from file_check import FileCheck
# Test Suite in order to organize our tests by groups of functionality
class FileCheckTest(unittest.TestSuite):
class ParsingTests(unittest.TestCase):
def test_ArgumentModelCreationOK(self):
# giv... | true |
6464a46e199a8cdb00ef1ff0c08ad818b7a7d2ce | Python | codecando-x/hands | /HierarchyAndStructure.py | UTF-8 | 4,757 | 3.21875 | 3 | [] | no_license | import types
import json
class HierarchyAndStructure:
__data = None
__generated_object = None
__quick_access_data = {}
__py_code_access_keys = {}
__separator = '.'
__index_identifier = 'i'
__type_list = [dict, list, tuple, set]
__empties = {dict:'{}', list:'[]', tuple:'()', set:'{}'}
... | true |
b49ee7b28fbf3c6a707251a6f278009017cc7f29 | Python | DominikVincent/eventbasedcameras | /scripts/NPtoAedat/npToAedat.py | UTF-8 | 9,742 | 2.96875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
This module contains classes, functions and an example (main) for handling AER vision data.
"""
import glob
#import cv2
import numpy as np
import matplotlib.pyplot as plt
#from win32api import GetSystemMetrics
#import timer
import os
class Events(object):
"""
Temporal Difference eve... | true |
e6ed78af3b750ab9c78aea5680ad5008705e4686 | Python | chakri1804/OpenCV_practice | /My Haarcascades/haarcascade_making.py | UTF-8 | 2,043 | 2.734375 | 3 | [] | no_license | import cv2
import numpy as np
import os
############## Making POS samples into grayscale and
############## resizing given a sample data folder
list1 = os.listdir('pos')
for x in list1:
print(x)
gray = cv2.imread('pos/arduino.png',0)
resized_image = cv2.resize(gray, (46,34))
cv2.imwrite('pos/0001.png'... | true |
a6af19c982fcfd8d6165b4ca2c515fa9c826a893 | Python | Kylin0827/Selenium_work | /homework/task1/f2.py | UTF-8 | 1,149 | 3.21875 | 3 | [] | no_license | from selenium import webdriver
driver = webdriver.Chrome(r"d:\tools\webdrivers\chromedriver.exe")
driver.get('http://www.weather.com.cn/html/province/jiangsu.shtml')
ele = driver.find_element_by_id("forecastID")
print(ele.text)
# 再从 forecastID 元素获取所有子元素dl
dls = ele.find_elements_by_tag_name('dl')
# 将城市和气温信息保存到列表c... | true |
0a2e47ea25839128b2c390fd2129574da86fef4f | Python | jonasfsilva/jaeger-between-microservices-example | /phoenix/app/models.py | UTF-8 | 1,043 | 2.765625 | 3 | [] | no_license | import re
from flask_restplus import Namespace, fields
def validate_payload(payload):
pattern_int = re.compile(r"(0|-?[1-9][0-9]*)")
telefone = payload.get('telefone')
if not telefone.isdigit():
return {
"message": "The phone number is not a integer"
}, 400
class UserMode... | true |
e63e13d6888a93999ad0c8b625f9972a445c29c2 | Python | iccank05/Facjrul-Ichsan_praktikum-kelas-dan-objek | /luasdankelilinglingkaran.py | UTF-8 | 1,319 | 3.640625 | 4 | [] | no_license | class KelilingLingkaran(object) :
def __init__ (self, r, p) :
self.jarijari = r
self.phi = p
def hitungKeliling (self) :
return 2 * self.phi * self.jarijari
def cetakData (self) :
print ("jari-jari\t: ", self.jarijari)
print ("phi\t: ", self.phi)
def cetakKeliling (self) :
print ("Keliling\ t=... | true |
674c75815f9880671e0a2d096d392985eb2d77f9 | Python | jiffy1065/crh | /car_battery_charge.py | UTF-8 | 2,372 | 4.28125 | 4 | [] | no_license | # NEW!为子类添加新的属性和方法
class Car():
def __init__(self, year, brand, type):
self.year = year
self.brand = brand
self.type = type
self.mile = 1000
self.petro = 80
def car_name(self):
car_name = 'My car is ' + str(self.year) + ' ' + self.brand + ' ' + self.typ... | true |
78a689c6ad5d4fe63e55549303d075d32873e5f4 | Python | daniel-reich/ubiquitous-fiesta | /N7zMhraJLCEMsmeTW_9.py | UTF-8 | 167 | 2.828125 | 3 | [] | no_license |
def min_swaps(st):
l = len(st)
t1, t2 = '01', '10'
s = sum(st[x]!= t1[x%2] for x in range(l))
s2 = sum(st[x]!= t2[x%2] for x in range(l))
return min(s,s2)
| true |
e9e63c91e78a468ea3e0245d4a2bac2de0f2425e | Python | zemiret/AGHtochess | /mechanics/model/UnitFactory.py | UTF-8 | 642 | 2.8125 | 3 | [] | no_license | from statistics import mean
from typing import Any, Dict
from model.Param import Param
from model.Unit import Unit
class UnitFactory:
params: Dict[str, Any]
def __init__(self, **params: Any):
self.params = params
def create(self, *, round: int) -> Unit:
attrs = {}
uniforms = []
... | true |
c63249b87c69114089c1ea02eafbd19d3606bfea | Python | Rollingkeyboard/pyscripts | /csvTovcf.py | UTF-8 | 1,053 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python
csvFile = input('please input csv file:')
vcfTemp = input('please input the place you want to store vcf file.e.g /path/to/filename.vcf:')
vcfFile = open(vcfTemp,'w')
t = open(csvFile,'r')
csvTitle = t.readline().split(',')
vcfTitle = []
n = 0
for i in csvTitle:
vcfTitle.append(input('please i... | true |
4a9c302d2070e0cce9b944ec72c6ad2485cd6bfe | Python | venelink/lxmls-toolkit | /lxmls/deep_learning/utils.py | UTF-8 | 4,534 | 2.90625 | 3 | [
"MIT"
] | permissive | import numpy as np
#
# UTILITIES
#
def logsumexp(a, axis=None, keepdims=False):
"""
This is an improvement over the original logsumexp of
scipy/maxentropy/maxentutils.py that allows specifying an axis to sum
It also allows keepdims=True.
"""
if axis is None:
a = np.asarray(a)
... | true |
f76ecf851ebe91a867dd62da7f0f386f874a6a04 | Python | jhfwb/Web-spiders | /clientScrapySystem/webScrapySystem/GYS_pySpiders/check/single_check.py | UTF-8 | 3,470 | 2.609375 | 3 | [] | no_license | import re
import requests
import os.path
from bs4 import BeautifulSoup
class WebPageCheck:
def __init__(self,
start_url_selector='',
start_url_re_rule='',
cacheDirPath='',
header={
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, li... | true |
0882b5a16a0a73678b9716fc43127bd55ab41aa4 | Python | Severoth/pygame-qix | /Enemy.py | UTF-8 | 325 | 2.5625 | 3 | [] | no_license | from utils import reach_wall
import pygame
# Constants
SCREEN_HEIGHT = 380
SCREEN_WIDTH = 400
SIZE = 5
RED = (255, 0, 0)
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
GREEN = (0, 255, 0)
class Enemy(pygame.sprite.Sprite):
def __init__(self):
self.width = SIZE
self.height = SIZE
self.cell = (0... | true |
f3b0beb523fbb5b9bfea7274b22164a111eea2e2 | Python | TaoHuang13/DeepRL | /02.DDQN/Train.py | UTF-8 | 1,574 | 2.734375 | 3 | [
"MIT"
] | permissive | import gym
import matplotlib.pyplot as plt
import argparse
import copy
import Agent
def reward_func(env, x, x_dot, theta, theta_dot):
r1 = (env.x_threshold - abs(x))/env.x_threshold - 0.5
r2 = (env.theta_threshold_radians - abs(theta)) / env.theta_threshold_radians - 0.5
reward = r1 + r2
return reward
... | true |
678b87da777df7605a9df92e865aaacd28a917f2 | Python | dhealy05/TimeStamp | /scripts/analyze_volatility.py | UTF-8 | 3,886 | 2.859375 | 3 | [] | no_license |
# # # # # # # # # # #
# I M P O R T S #
# # # # # # # # # # #
from __future__ import division
import sys # for command line arguments
import os # for manipulating files and folders
import argparse # for command line arguments
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
###... | true |
91405c6f19115562cc87e6d82986825b28d95fcf | Python | KuroKousuii/Codeforces | /Python/800 - III/1191A.py | UTF-8 | 165 | 3.359375 | 3 | [] | no_license | x = int(input())
check = x % 4
if check == 0:
print(f'{1} A')
elif check == 1:
print(f'{0} A')
elif check == 2:
print(f'{1} B')
else:
print(f'{2} A') | true |
fe1308c7b19fb0c88d15cc3b194eee7c69e48b7b | Python | thitimon171143/MyPython | /midterm 2562-1/important02.py | UTF-8 | 155 | 3.34375 | 3 | [] | no_license | s = 0
n = 0
t = float(input())
while t >= 0 :
t = float(input())
s += t
n += 1
if n == 0 :
print('No Data')
else:
print('avg =',(s/n)) | true |
d726e7a6d51432d517babaa0a80161763e97e968 | Python | MuSaCN/PythonLearning | /Learning_Quant/python金融大数据挖掘与分析全流程详解/第14章源代码汇总/14.4.1 xlwings库的基本用法.py | UTF-8 | 1,045 | 3.46875 | 3 | [] | no_license | # =============================================================================
# 14.4.1 Python创建Excel基础 by 王宇韬
# =============================================================================
import xlwings as xw
import matplotlib.pyplot as plt
import pandas as pd
# 新建一个Excel文件,并设置为不可见
app = xw.App(visible=True,add_bo... | true |
9726c8e61f6d02bd046b6145979bdbaff878608c | Python | jdgreen/Project-Euler | /solutions/src/python/euler018.py | UTF-8 | 919 | 3.140625 | 3 | [] | no_license | #dynamic program to find highest path through a tree data file
def best_path1(file):
i = 0
#read in data points
for line in reversed(list(open(file))):
row = map(int,line.rstrip().split(" "))
#print row
m = 0
for element in range(len(row)):
if i == 0:
i = 1
break
elif sum[element] > sum[eleme... | true |
fe6946a7118db2ecff88c19f18712f18a0217f1e | Python | jankidepala/machine-learning-IOT | /Tensor-flow/HelloWorld.py | UTF-8 | 329 | 2.75 | 3 | [] | no_license | import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
tf.contrib.data.Dataset.from_tensor_slices
dataset1 = tf.contrib.data.Dataset.from_tensor_slices(tf.random_uniform([4, 20]))
print(dataset1.output_types) # ==> "tf.float32"
print(dataset1.output_shapes) # ==> "(10,)"
sess = tf.Session()
print(sess.ru... | true |
bfe7b44337e9990395f818dd50824fe7c9e8c1a5 | Python | mpettersson/PythonReview | /questions/math/is_prime.py | UTF-8 | 1,374 | 4.125 | 4 | [] | no_license | """
IS PRIME (CHECK FOR PRIMALITY)
Is a number prime?
Remember:
A prime number is a natural number greater than 1 that is not a product of two smaller natural numbers.
A natural number greater than 1 that is NOT prime is called a composite number.
"""
import math
# Naive Solution: Check ... | true |
c81a0e0a8a92a34d4813c4309e41be694927f379 | Python | srinivas1746/Object-Trackers | /people_counter.py | UTF-8 | 1,179 | 2.84375 | 3 | [] | no_license | import cv2
import imutils
from time import sleep
# Initializing the HOG person
# detector
hog = cv2.HOGDescriptor()
hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector())
# Reading the Image
# image = cv2.imread('/home/srinu/Desktop/test.jpeg')
cam = cv2.VideoCapture("/home/srinu/Downloads/People counting.m... | true |
18c9c74ae072d802940f2a35cb7181e032dabe64 | Python | SoundaryaAdaikkalavan/Guvi-Beginners | /insert_max.py | UTF-8 | 298 | 2.828125 | 3 | [] | no_license | n,m=map(int,input().split())#input
c=list(map(int,input().split()))#list1
a=list(map(int,input().split()))#list2
b=list(map(int,input().split()))#list3
d=0
for i in range(0,len(b)):
a.append(b[i])
if d==0:
print(max(a),end="")
d+=1
else:
print("",max(a),end="")
| true |