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 |
|---|---|---|---|---|---|---|---|---|---|---|
509b13cb3f3521dd9419dce5ec519106dd542d6f | GabrielScalici/calculo-numerico-SME0300 | /Bisseccao_Newton_Secantes/newton.py | UTF-8 | 3,704 | 3.96875 | 4 | [] | no_license |
# Metodo de Newton
# para k = 1, ... , MAXITER
# 1. calcular Xk = Xk-1 - f(Xk-1)/f'(Xk-1)
# 2. se suficientemente proximo, retornar o valor
# se não, voltar para o passo 1
class Newton:
# Constructor
def __init__(self, inf, sup, e, MAXITER, root):
self.lastX... | true |
a52df1f500b56f43d22e7192df231dd6a3233bcf | AMReX-Astro/Castro | /Exec/science/Detonation/nse_runs/nse_plot.py | UTF-8 | 1,805 | 2.53125 | 3 | [
"BSD-3-Clause-LBNL",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
strang = "strang/det_x_plt00741.slice"
strang_cfl025 = "strang_cfl025/det_x_plt01774.slice"
strang_cfl0083 = "strang_cfl0083/det_x_plt05262.slice"
sdc = "SDC/det_x_plt00634.slice"
sdc_cfl025 = "SDC_cfl025/det_x_plt01768.slice"
sdc_cfl0083 = "SDC_cfl0083/det_x_plt0527... | true |
a87d15b4256ce780218894d45596a139523ef045 | daniel-reich/ubiquitous-fiesta | /q7rHnH9Jhf35NqSjG_5.py | UTF-8 | 72 | 3.046875 | 3 | [] | no_license |
def trailing_zeros(n):
c=0
while n:
n//=5
c+=n
return c
| true |
71dee421919529ac1b0b00ccf52c351bb8d57849 | Gelivabilities/Data-structure-and-algorithms | /剑指offer/二叉树/是否二叉搜索树后序序列/is_back_of_BST.py | UTF-8 | 926 | 3.28125 | 3 | [] | no_license | class Solution:
def VerifySquenceOfBST(self, sequence):
n=len(sequence)
if n==0:return False
if n<=2:return True
last=sequence[n-1]#最后一个元素为根结点
#看看左子树(如果有)是否合法
p=n-2
while p>=0:
if sequence[p]<last:break
p-=1
if p>=0:#左子树居然有比根结点大... | true |
691cace324a9d89f8e51be449ba040b8ddee86fb | mocmeo/algorithms | /3sum-closest.py | UTF-8 | 480 | 3.328125 | 3 | [] | no_license | def threeSumClosest(nums, target):
nums.sort()
max_diff = float('inf')
res = 0
for k in range(len(nums)-1, 1, -1):
i = 0
j = k - 1
while i < j:
cur_sum = nums[i] + nums[j] + nums[k]
if cur_sum > target:
j -= 1
elif cur_sum < target:
i += 1
else:
return target
if abs(cur_sum - targe... | true |
c0972baeda0f75b98522362b193f6d10f3290ec4 | shach934/leetcode | /leet538.py | UTF-8 | 1,124 | 4.09375 | 4 | [] | no_license | 538. Convert BST to Greater Tree
Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original
BST is changed to the original key plus sum of all keys greater than the original key in BST.
Example:
Input: The root of a Binary Search Tree like this:
5
... | true |
23775aaf2b39805f3a859f4fb41697e700e4ec9d | billc2021/DojoAssignments | /02Python/01PythonFundamentals/07Stars/stars.py | UTF-8 | 244 | 3.78125 | 4 | [] | no_license | def draw_stars(list):
for num in list:
if type(num) == int:
print "*" * num
else:
print num[0].lower() * len(num)
x = [4, 6, 1, 3, 5, 7, 25]
x = [4, "Tom", 1, "Michael", 5, 7, "Jimmy Smith"]
draw_stars(x) | true |
9a9cf10e775cb97e2787e4861aec583bcb6c63d7 | Yhug-Z/http_server | /http_server/http_server.py | UTF-8 | 2,689 | 3 | 3 | [] | no_license | """
httpserver v3.0
获取http请求
解析http请求
将请求发送给WebFrame
从WebFrame接收反馈数据
将数据组织为Response格式发送给客户端
"""
import json
import re
import sys
from socket import *
from threading import Thread
class HTTPServer:
def __init__(self, host, port, frame_ip, frame_port, debug):
self.__host = host
self.__port = port
... | true |
a7c71bb24074e9017b615e17e5cef657095f33e1 | kickscar/deep-learning-practices | /01.python-basics/06/scope.py | UTF-8 | 296 | 3.28125 | 3 | [] | no_license | # scope test
def func(a):
return a * x
def func2(a):
x = 2
return a * x
def func3(a):
global g
g = 3
return a * g
x = 1
g = 1
print(func(10))
print(func2(10))
print(func3(10))
print(g)
# 내장 영역 (Built-In Scope)
print(dir())
print(dir('__builtins__'))
| true |
71891b49a53a196728ae01b4183416889e78cc31 | berdanakyurek/codeforces-solutions | /1362A.py | UTF-8 | 745 | 3.4375 | 3 | [] | no_license | def is2pow(n):
i = 0
while True:
if 2 ** i == n:
return True
elif 2 ** i > n:
return False
i += 1
def compute(f, s):
if f == s:
return 0
if f > s:
temp = s
s = f
f = temp
if not s % f == 0:
retu... | true |
38c649bd2da6e07cfd273282a5137b2fa8b164c4 | sigk218/algorithm_100 | /2020/1010/2007년.py | UTF-8 | 210 | 3.078125 | 3 | [] | no_license | import sys
sys.stdin = open('input.txt', 'r')
import datetime
x, y = map(int, input().split())
d = datetime.datetime(2007, x, y)
day = ['MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN']
print(day[d.weekday()]) | true |
9318c1c9d358880729ce747acd26e0fd9344f3ab | LucasAsil/Pyquestions | /ex031.py | UTF-8 | 506 | 4.28125 | 4 | [] | no_license | #Cost Travel
"""Desenvolva um programa que pergunte a distância de uma viagem em Km.
Calculeo preço da passagem, cobrando R$0,50 por Km para viagens até 200Km e R$0,45
para viagens mais longas"""
dviagem = float(input('Qual a distancia da viagem que deseja fazer?').strip())
price_curto = dviagem * 0.50
price_... | true |
37e5767e0211136220fbf87e2fa53eff15c5b4b5 | borko81/python_scripts | /internet/found_wifi_password.py | UTF-8 | 1,623 | 3.078125 | 3 | [] | no_license | """
use subprocess to invoke nets command,
found wifi name's and return his password
"""
import subprocess
import re
import threading
command = 'netsh wlan show profile'.split()
match_name = re.compile(r"All User Profile\s+:\s(.*)\r")
def generate_list_with_networks():
"""
Use to return list with na... | true |
227a20b7957de5cce733b1fa6a580baee8f2fd3d | yennanliu/CS_basics | /leetcode_python/Bit_Manipulation/power-of-four.py | UTF-8 | 2,415 | 3.671875 | 4 | [] | no_license | # https://leetcode.com/problems/power-of-four/description/
# Time: O(1)
# Space: O(1)
# Given an integer (signed 32 bits), write a function to check whether it is a power of 4.
#
# Example:
# Given num = 16, return true. Given num = 5, return false.
#
# Follow up: Could you solve it without loops/recursion?
# V0
# V... | true |
3776414d86cc096eeedb30880938a7acc688e71c | yuuuzzzin/Jump-to-Python | /5장 연습문제 풀이/ch05-9.py | UTF-8 | 89 | 3.09375 | 3 | [] | no_license | import sys
nums = sys.argv[1:]
sum = 0
for num in nums:
sum += int(num)
print(sum) | true |
03df8e5ffaeb1509b615c76ad347d037c2660dc5 | wandora58/Argorism | /String/find_non_repeating.py | UTF-8 | 719 | 4.28125 | 4 | [] | no_license |
# 文字列が与えられると、最初に反復していない文字を見つけます
# 文字列が与えられたら、その中の最初の非反復文字を見つけます。
# たとえば、入力文字列が「GeeksforGeeks」の場合、出力は「f」であり、入力文字列が「GeeksQuiz」の場合、出力は「G」です。
# ないなら「-1」をし出力
def find_non_repeating(string):
count = [0] * 256
for i in string:
count[ord(i)] += 1
index = -1
k = 0
for i in string:
if cou... | true |
128603f61e6f04cc2c1c8348e194997803c9107f | mattrasband/advent_of_code_2020 | /01/day01.py | UTF-8 | 468 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python3
import itertools
import math
def solve(lines, count=2, match=2020):
for combo in itertools.combinations(lines, r=count):
if sum(combo) == match:
return math.prod(combo)
print("part1 (test):", solve([1721, 979, 366, 299, 675, 1456]))
with open("./input.txt") as f:
p... | true |
45b6781f509b29d8d7323db4e99a299f6bc73eb2 | harshit5200/Library-Management-System | /Student.py | UTF-8 | 9,839 | 3.25 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import pickle,sys,datetime
class Student:
def saveStudentData(self,name,year_of_admn,branch,sem,admn_id_no,dateOfIssue = [],returnDate = [],bookIssued = [],fineAmount = 0):
self.name = name
self.branch = branch
self.sem = sem
self.yea... | true |
2c8cc3bb59abbfe50fc33629fdd03de7e5e32382 | presian/HackBulgaria | /Programming0-1/Week_5/3-Beer-and-Fries/beers_and_fries.py | UTF-8 | 326 | 3.140625 | 3 | [] | no_license | def max_score(beers, fries):
b = sorted(beers, reverse=True)
f = sorted(fries, reverse=True)
score = 0
for i in range(0, len(b)):
score += b[i] * f[i]
return score
print(max_score([10, 11], [1, 5]))
print(max_score([5], [5]))
print(max_score([1000, 1010, 1020, 1030, 1040], [834, 500, -1, 0, ... | true |
74f07e53d412c5164d38feec9e46abb8cadddcee | drylikov/methods_comparison-1 | /app/core/resolve_methods.py | UTF-8 | 1,110 | 3.4375 | 3 | [] | no_license | """
Methods for solving TSP
"""
from itertools import permutations
def brute_force(matrix, task_type='min', first_city=None):
res_func = {'max': max, 'min': min}[task_type]
res = {'max': -1, 'min': 99999999999}[task_type]
if first_city:
first_city -= 1
perms = (permutation for permutation ... | true |
5b3a138aa125dc9177dbe3957673e169e96e1765 | Aasthaengg/IBMdataset | /Python_codes/p03448/s343452141.py | UTF-8 | 238 | 2.859375 | 3 | [] | no_license | a,b,c,x = int(input()),int(input()),int(input()),int(input())
ans = 0
for i in range(min(a+1,41)):
for j in range(min(b+1,201)):
k = x-500*i-100*j
if k >= 0 and k%50 == 0 and k//50 <= c:
ans += 1
print(ans) | true |
0003b492f40bc638ae0368d786cd3f27aed7b8ef | giannipele/pytet | /pytet/functions.py | UTF-8 | 1,965 | 2.796875 | 3 | [
"MIT"
] | permissive | from abc import abstractmethod
import autograd.numpy as np
class Logistic():
def __init__(self, params):
self.params = np.array(params)
def __str__(self):
return "Logistic, {}".format(self.params)
def forward(self, params, x):
output = params[0] + np.sum([np.sum([params[i+1] * x[i... | true |
72d5858c67c0eb7aeeff0a3f80d77a6ec51e4a2d | viperassassin/SpyChat | /spychat.py | UTF-8 | 913 | 3.5 | 4 | [] | no_license | from details import spy_name, spy_age , spy_review
print('name of spy:' + spy_name)
print('age:' + str(spy_age))
print('review of spy:' + str(spy_review))
spy_age = 0
spy_review = 0.0
spy_initial=raw_input("Enter whether are you Mr. and Ms.:")
print('Initial of Spy:' + spy_initial)
name = spy_initial + spy_name
print('... | true |
cb2c803e60d3467f629c19b0596a3865970faa99 | harpreets652/genetic-algorithms | /assignment3/visualize.py | UTF-8 | 2,507 | 3.015625 | 3 | [] | no_license | import glob
import subprocess
import random
import numpy as np
import matplotlib.pyplot as plt
def plotdata(filename, title, figText, ylabel):
data = np.loadtxt(filename)
gen, min_val, avg_val, max_val = data[:, 0], data[:, 1], data[:, 2], data[:, 3]
plt.plot(gen, max_val, 'r-', label="max", linewidth=2.... | true |
8fb7ad47dff87ba018eb4dd2386770630a8a2fc1 | stefkalad/B3B33ALP | /USEFULCODE/GRAPHS/graphINPUT.py | UTF-8 | 1,626 | 3.296875 | 3 | [] | no_license | import sys
class Edge:
def __init__(self, PV, KV, weight):
self.PV = PV
self.KV = KV
self.weight = weight
def __gt__(self, other):
return True if self.weight > other.weight else False
def __lt__(self, other):
return True if self.weight < other.weight else False
d... | true |
4301acf5378868e145a759db600487eb1f2fed25 | LucasZatta/ColorScheme | /Color.py | UTF-8 | 969 | 2.765625 | 3 | [] | no_license |
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt
import cv2
from PIL import Image
import numpy as np
from datetime import date
path = "/path/Sample.jpeg"
outputfile = path.split('.')[0] + "Palette.png"
img = Image.open(path)
width,height = img.size
steps = 500
step = int(width*height//steps)
tota... | true |
c4d00b9b3163af8e6a430d6e7510c5c740b14126 | justjsit/python_pachong | /test_bs4.py | UTF-8 | 974 | 3.546875 | 4 | [] | no_license |
from bs4 import BeautifulSoup
import re
html_doc = """
<html><head><title>The Dormouse's story</title></head>
<p class="title"><b>The Dormouse's story</b></p>
<p class="story">Once upon a time there were three little sisters; and their names were
<a href="http://example.com/elsie" class="sister" id="link1">... | true |
0ea85f3ca832d4c74151995168cb47ec5e934c3b | scipp/scipp | /src/scipp/core/unary.py | UTF-8 | 2,056 | 3.203125 | 3 | [
"BSD-3-Clause"
] | permissive | # SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2023 Scipp contributors (https://github.com/scipp)
# @author Matthew Andrew
from typing import Union as _Union
from .._scipp import core as _cpp
from ._cpp_wrapper_util import call_func as _call_cpp_func
def isnan(x: _cpp.Variable) -> _cpp.Variable:
"""Elem... | true |
b0e1f9f8c3bb8f6c2355defe6cce4b29980e695f | ana-mariatambur/Liste | /pr.2.py | UTF-8 | 527 | 3.53125 | 4 | [] | no_license | with open('input.txt','r')as f:
lista1=list(eval(f.read()))
print("lista initiala:",lista1)
lista2=sorted(lista1)
print("lista sortata in ordine crescatoare:",lista2)
lista3=sorted(lista1,reverse=True)
print( "lista in ordine descrescatoare:",lista3)
print("numarul de elemente din lista:",len(lista1))
print... | true |
752d1fa7559ba39d564ee7dfcd1f83d16856d085 | Aasthaengg/IBMdataset | /Python_codes/p03502/s267483126.py | UTF-8 | 103 | 3.203125 | 3 | [] | no_license | n = input()
num = int(n)
s = sum(map(int, list(n)))
if num % s == 0:
print("Yes")
else:
print("No") | true |
da3472ebb952270750720aedfac343e6bf525ff1 | Bmac1896/Brick-w-Computer-Vision | /Vision.py | UTF-8 | 6,693 | 2.6875 | 3 | [] | no_license |
import cv2
import numpy as np
import matplotlib as plt
import sys
import argparse #flags and stuff
class Vision:
##############################################################################
def setArgs(self):
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--debug', action ... | true |
a16a000870a0dc36462e9f4fe97f05a6fe69a459 | GitContainer/alarm-limit | /organized_plotting.py | UTF-8 | 17,617 | 2.84375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Dec 28 10:34:22 2018
@author: Ravi Tiwari
"""
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
def plot_ts(i, df, ax, col = 'b'):
try:
levels = df.index.levels[0]
for level in levels:
x = df.loc[leve... | true |
a06b7d3f65cfd52de14c87a537df8178c19e91ae | TheCDC/arcade | /arcade/utils.py | UTF-8 | 2,252 | 3.6875 | 4 | [
"MIT"
] | permissive | import math
import random
from pymunk import Vec2d
def lerp(v1: float, v2: float, u: float) -> float:
"""linearly interpolate between two values"""
return v1 + ((v2 - v1) * u)
def vec_lerp(v1: Vec2d, v2: Vec2d, u: float) -> Vec2d:
return Vec2d(
lerp(v1.x, v2.x, u),
lerp(v1.y, v2.y, u)
... | true |
880377091351012e46051c750ae3667fcda64d5b | TobiasDummschat/5E-Mob-Damage-Calculator | /backend.py | UTF-8 | 3,475 | 3.859375 | 4 | [] | no_license | from random import randint
def calculate(number_of_attacks, ac, to_hit, damage_per_hit=None, advantage=False, disadvantage=False, dmg_mode=False):
""" Simulates attacks to figure out how many hit and, if damage per hit is given, what damage was dealt.
If in DMG mode, the table provided in the Dungeon Mast... | true |
d085cc3f55c1650eed5347069bad273e0931e26f | teki97/KL-TFD | /KL-TFD/tftb.py | UTF-8 | 14,629 | 2.75 | 3 | [] | no_license | import numpy as np
import scipy.io as io
import random
from matplotlib import pyplot as plt
import math
import time
EPS = 1e-8
"""
WIGNER-VILLE DISTRIBUTION
"""
def tfrwv(x):
x_row = x.shape[0]
t = np.arange(0, x_row)
N = x_row
t_row = t.shape[0]
# 这里一定要设置为复数,要不然后面求出来复数,赋值给tfr,也只能得到实部
tfr =... | true |
1ae88be42f3caf6bcaa77c3c3bbdb4e8533f64b4 | lopesmarcela/Questoes-URI | /Python/1079.py | UTF-8 | 162 | 3.640625 | 4 | [
"MIT"
] | permissive | n = int(input())
for i in range(1 , n + 1 ):
x = input().split()
a,b,c = x
print('{:.1f}'.format((float(a) * 2 + float(b) * 3 + float(c) * 5) / 10))
| true |
de31981786f782d92940eab27a2247721cee702f | Bieneath/LeetCode_training | /Week_04/486.py | UTF-8 | 1,733 | 3.6875 | 4 | [] | no_license | class Solution:
def PredictTheWinner(self, nums: List[int]) -> bool:
l = len(nums)
dp = [[-1] * l for _ in range(l)]
# print(dp[1][1])
# 基于博弈论的递归求法;
# dp[le][ri]的意义为在[le, ri]这段数字中先手能获得的最大分数
def dfs(le, ri): # 整个dfs的作用就是填写dp表
if dp[le][ri] != -1: return dp[... | true |
c23b0a8d6fd7e390019e0b581ac262cc803fcaba | serin-delaunay/pronounify | /from_tumblr_com.py | UTF-8 | 1,427 | 2.875 | 3 | [
"MIT"
] | permissive |
# coding: utf-8
# In[1]:
import re
from get_content import get_content, get_html_plaintext
# In[2]:
def extract(text):
#accept only exactly 5 words separated by 4 slashes.
#reject forms with 6 words to avoid getting slavic language 6-case pronouns
r = "(?<![/\w()])([^\s/(),]+/){4}([^\s/(),]+)(?![/\w()... | true |
069a207236e676d5f95bde3c347520769f2e178f | gtalarico/ironpython-stubs | /release/stubs.min/Autodesk/Revit/DB/__init___parts/TransactionGroup.py | UTF-8 | 4,438 | 2.578125 | 3 | [
"MIT"
] | permissive | class TransactionGroup(object,IDisposable):
"""
Transaction groups aggregate a number of transactions.
TransactionGroup(document: Document,transGroupName: str)
TransactionGroup(document: Document)
"""
def Assimilate(self):
"""
Assimilate(self: TransactionGroup) -> TransactionStatus
... | true |
99085bf46c974746f86dea92a18cb03ac66ef78d | niksm7/Data-Structures-Implementation | /Queues/PriorityQueue.py | UTF-8 | 1,099 | 4.3125 | 4 | [] | no_license | # This Queue is similar to the normal Queue except that-
# We need to delete the number with maximum priority first (here max priority is the maximum number)
# If there are two numbers with equal priority then we take the one which comes first from left i.e FIFO
class PriorityQueue():
def __init__(self):
... | true |
fc31c991459c2cafc741437d377db8ca64009e77 | alecmeade/grid_planner | /robot.py | UTF-8 | 4,438 | 3.234375 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
import matplotlib.patches as patches
import math
import numpy as np
import utils
from shapely import affinity, geometry
class Robot():
def __init__(self, x: float, y: float, radius: float, yaw: float, sensor_range: float, sensor_view_angle: float):
self.x = x
self.... | true |
4f6ae2187c580f8534c9193c570f26c2faa62d09 | jiwookseo/problem-solving | /SWEA/sol/5201.py | UTF-8 | 511 | 3.109375 | 3 | [] | no_license | # 5201. [파이썬 S/W 문제해결 구현] 3일차 - 컨테이너 운반 D3
for TC in range(1, int(input()) + 1):
cn = int(input().split()[0])
cs = list(map(int, input().split()))
ts = list(map(int, input().split()))
cs.sort(reverse=True)
result = 0
for limit in ts:
i = 0
while cs[i] > limit:
i += 1
... | true |
cbf0b51144c135fb574da170901bc2acf8e71095 | ThrallOtaku/python3Test | /base/day2/14stradd.py | UTF-8 | 152 | 2.515625 | 3 | [] | no_license | import os
mystr1="note"
mystr2="pad"
mystr3="C:\\Users\\Tsinghua-yincheng\\Desktop\\"+str(1)+".txt"
os.system(mystr1+mystr2+" "+mystr3) #字符串加法 | true |
79ebfa7852fd9d7d6d2ca94496ee4362d02035a7 | Jinsaeng/CS-Python | /al4995_Hw_01_q2a.py | UTF-8 | 75 | 3.03125 | 3 | [] | no_license | #2
#a)
def shift(lst, k):
lst = lst[k:] + lst[0:k]
return lst
| true |
396e02982087930d332f59f318281e2fb3bae9c6 | vrushankjani/aws-soe-ami-end-to-end-automation | /publishing/stack/app/src/manage_role/manage_role_function.py | UTF-8 | 5,102 | 2.5625 | 3 | [] | no_license | '''
This module creates/manages an IAM role used by service owners for access to SSM parameter store to retrieve the SOE AMI ID.
'''
import json
import os
from datetime import datetime
import boto3
import botocore
print('Loading function ' + datetime.now().time().isoformat())
### Environment variables ###
# Gener... | true |
1cc1b2e38859d13184bc03ee166e3e7784017b55 | theproudswan/27-number-ege | /Кол-во пар, сумм равн 4, произв нечётн.py | UTF-8 | 296 | 3.5 | 4 | [] | no_license | n = int(input('Введите число'))
buf = 10 * [0]
sum_number = 0
for _ in range(n):
x = int(input())
if x % 2 != 0:
buf[x % 10] += 1
print(buf)
for i in range(0, buf[7]):
sum_number += i
sum_number += buf[1] * buf[3]
sum_number += buf[5] * buf[9]
print(sum_number)
| true |
76d690f605a00cea8acd3540f282bbb94963de3f | mpjim2/MineRL_project | /BlockDetection/data_preparation.py | UTF-8 | 4,084 | 2.703125 | 3 | [] | no_license | import torchvision.models as models
import torch
import torch.nn as nn
import torchvision.transforms as transforms
import torchvision
from torch.utils.data import Dataset, DataLoader
import torch.optim as optim
import pickle
import numpy as np
import minerl
import matplotlib.pyplot as plt
from tqdm import tqdm
import ... | true |
4b46f8b99a2b73acd0bdde3efb252f9f96cef203 | LitingLin/ubiquitous-happiness | /models/TransT/loss/loss_compose/composer.py | UTF-8 | 3,902 | 2.671875 | 3 | [] | no_license | import torch
from miscellanies.torch.distributed import is_dist_available_and_initialized
from miscellanies.torch.distributed.reduce_mean import reduce_mean_
class LinearWeightScheduler:
def __init__(self, init_weight, ultimate_weight, begin_step, end_step, per_iter):
self.init_weight = init_weight
... | true |
4743ee1a7e33a302f05de41f8bac4c9739d426df | ErikGoto/OpenCV-Youtube | /Chapter 6.py | UTF-8 | 268 | 2.59375 | 3 | [] | no_license | import cv2
import numpy as np
img = cv2.imread("urso.png")
imgResize = cv2.resize(img, (300, 150))
imgHor = np.hstack((imgResize, imgResize))
imgVert = np.vstack((imgResize, imgResize))
cv2.imshow("Horizontal", imgHor)
cv2.imshow("Vertical", imgVert)
cv2.waitKey(0) | true |
ebcc77bb4e8ded5ef74d55f711dd8a9f2ca77e3b | pyadav1989/Test | /project.py | UTF-8 | 785 | 2.59375 | 3 | [] | no_license | import pandas as pd
from pandas import DataFrame
import matplotlib.pyplot as plt
from matplotlib import style
import numpy as np
style.use('ggplot')
df=pd.read_csv("/home/prashant/Desktop/Py4E/MyAllProjectWork/stocks_sentdex/newpart.csv")
df['time']=pd.to_datetime(df['time'],unit='s')
df=df.set_index('time')
del df['i... | true |
ee4b16f455809ef33692a12193da07a23688a53c | davenewman/PDFConcat | /bin/PDFConcat.py | UTF-8 | 4,674 | 3.421875 | 3 | [] | no_license | #!/usr/bin/python3
import sys
import os
import PyPDF2
import re
def main(argv):
# main() is responsible for parsing the command line
method = argv[0]
args = argv[1:]
if method == '-c':
# This method involves combination concatenation and rotation of PDFs
# Failure modes with which to ... | true |
de2f4442342ac324f32a0a63b8bf9d86b51d94fa | ivan570/code | /python/itertools.combinations.py | UTF-8 | 218 | 3.015625 | 3 | [] | no_license | from itertools import combinations as com
a, b = input().split(" ")
a = sorted(a)
a = "".join(a)
b = int(b)
for i in range(1, b + 1):
a_list = sorted(list(com(a, i)))
for k in a_list:
print("".join(k))
| true |
7784111cbad871a38ae03644fc4ff8aa97f33444 | jaconstantin/python_lut_processing | /table_to_column.py | UTF-8 | 668 | 3.546875 | 4 | [] | no_license | #converts a table in a csv into a single column
#each column is stacked after the preceding columns
import csv
with open('lut_input.csv', 'rb') as csvfile:
lut_reader = csv.reader(csvfile, delimiter=',')
table_buffer = []
for row in lut_reader:
table_buffer.append(row)
... | true |
e67bde8caf3e67a1d17ad47fc28abfe61e3152dd | Liberty3000/neurpy | /neurpy/noise/pyramid.py | UTF-8 | 611 | 2.796875 | 3 | [] | no_license | import math, torch as th
def random_pyramid(shape, octaves=5, decay=1.):
n, c, h, w = shape
noise = th.zeros([n, c, 1, 1])
max_octaves = int(min(math.log(h)/math.log(2), math.log(w)/math.log(2)))
if octaves is not None and 0 < octaves:
max_octaves = min(octaves, max_octaves)
for i in reversed... | true |
3d333b95d7ead8b064beecbae50bb5a2bd154db1 | Scotchy/face_cls | /models/lightnet.py | UTF-8 | 1,697 | 2.828125 | 3 | [] | no_license |
import torch.nn as nn
import torch
class LightNet(nn.Module):
def __init__(self, im_size=(3, 56, 56)):
super(LightNet, self).__init__()
self.conv1 = nn.Conv2d(3, 32, kernel_size=(3, 3))
self.conv2 = nn.Conv2d(32, 64, kernel_size=(3, 3), stride=2)
self.conv3 = nn.Conv2d(64, 128,... | true |
b593a3a5dc4c944a420e1fbd9a811dfedee8abd1 | soderwall/aoc | /2020/1/main.py | UTF-8 | 524 | 2.96875 | 3 | [] | no_license | import sys
with open(sys.argv[1]) as f:
lines = [ int(i) for i in f ]
def main():
part1()
part2()
def part1():
goal = 2020
for num in lines:
for num2 in lines:
if (num+num2 == goal):
res = num * num2
print res
def part2():
goal = 2020
for num in li... | true |
c44854f1a9e6d6abffce0e0c06fdb86cb0678228 | JiniousChoi/encyclopedia-in-code | /languages/python/promise/thread_no_callbacks.py | UTF-8 | 1,639 | 3.171875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python2.7
import urllib2 as u
import json
import time
import threading as t
import random
def get_data(post_id,data):
def __get_data():
site= "http://jsonplaceholder.typicode.com/posts/" + str(post_id)
hdr = {'User-Agent': 'Mozilla/5.0'}
req = u.Request(site,headers=hdr)
... | true |
617983ebb3d0fb3364450492188f65517482971c | AmirHoseinSafari/stock_prediction | /model/random_forest.py | UTF-8 | 1,708 | 2.84375 | 3 | [] | no_license | from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from data_processing.process_for_model import data_preprocess
from numpy import mean
from numpy import std
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import RepeatedStratifiedKFold
from ... | true |
26785ace313aa6152e3fba1f5562d6bc6b222400 | wh0930/A-Code-Assistant | /Python/Python选修课/第二次作业/rectangle area.py | UTF-8 | 62 | 2.875 | 3 | [] | no_license | l=input()
w=input()
l=float(l)
w=float(w)
print("%.2f"%(l*w))
| true |
e6a95c0db751709f6800e4155703c5852ae83daf | jenyaTopol/lambda-python | /lamdba.py | UTF-8 | 1,248 | 3.640625 | 4 | [] | no_license | # מה זה lambda?
# זו בעצם הדרך שלי לשים פונקציה או קטע קוד בתוך משתנה.
# כדאי לי לעשות זאת בגלל שאפשר לשלוף אותו במהירות ולא צריך לכתוב אותו כל פעם, רק את המשתנה.
#labda
code_execute_print_with_hello = lambda: print('hello world')
code_execute_print_with_hello()
def my_filters(x):
return True ... | true |
cec0ac5836b482481ad305d1477dc79680e6c64d | LaurenCurtis/Homework | /coursenumber.py | UTF-8 | 489 | 3.453125 | 3 | [] | no_license | room = {'CS101': 3004, 'CS102': 4501, 'CS103': 6755, 'NT110': 1244, "CM241": 1411}
instructor = {'CS101': 'Haynes', 'CS102': 'Alvarado', 'CS103': 'Rich', 'NT110': 'Burke', "CM241": 'Lee'}
time = {'CS101': "8:00 am", 'CS102': "9:00 am", 'CS103': "10:00 am", 'NT110': "11:00 am", "CM241": "1:00 pm"}
course_num = inp... | true |
4aa3833f32ba127092705d6a84afe205eefeaf1e | enollabressanim/rascunhos | /criar-tabela.py | UTF-8 | 694 | 3.046875 | 3 | [] | no_license | # 02_create_schema.py
import sqlite3
# conectando...
conn = sqlite3.connect('clientes.db')
# definindo um cursor
cursor = conn.cursor()
# criando a tabela (schema)
cursor.execute("""
CREATE TABLE clientes (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
nome TEXT NOT NULL,
CPF VAR... | true |
2d5b61c49af08d2322d035e484ba2735c3d38c47 | rg4sun/SongTransferer | /songs2appleMusic.py | UTF-8 | 4,309 | 2.625 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains # 模拟鼠标行为用的,不过这里没用到
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from bs4 import BeautifulSoup
import o... | true |
2d1a15ef397aeea351adda069b49571ecbc04bbe | diveshjain-phy/LyaCosmoParams | /lya_likelihood/py/full_theory.py | UTF-8 | 11,089 | 2.53125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import camb_cosmo
import mean_flux_model
import thermal_model
import pressure_model
import linear_emulator
import CAMB_model
class FullTheory(object):
"""Translator between the likelihood object and the emulator. This object
will map from a set of CAMB paramet... | true |
e431bcaee62915acd8236768675188353ef8b083 | rdagger/micropython-ads1220 | /ads1220.py | UTF-8 | 21,173 | 2.71875 | 3 | [
"MIT"
] | permissive | """MicroPython ADS1220 driver."""
from micropython import const # type: ignore
from machine import Pin # type: ignore
from time import sleep_ms
class ADC(object):
"""SPI interface for ADS1220 24 bit analog to digital converter."""
# ADS1220 command constants
POWER_DOWN = const(0x02)
RESET = const(0... | true |
2123b71514e0fc4bc9fda12cac2ff9b4a5a0fb48 | MHLUNATIC/Python | /study/demo6/javascript.py | UTF-8 | 465 | 3.046875 | 3 | [
"MIT"
] | permissive | 字符串转化成数字类型失效时出现NaN,NaN是number的一个类型
NaN参与的所有的运算都是false,,除了不等于(NaN != 0)时
Math是一个内置对象,拿来就用,不需要new一下
将a标签自身功能阉割(不发生跳转和href=‘#’功能相似) <a href ="javascript:void()" onclick=func1(this)>d</a>
this 指向方法的调用者,在当前例子中了a标签(在页面中点击“d”就会获得a标签)
window.onload | true |
1c73054cd00158660d528118abfe8b3a61e76447 | YancarloOjeda/WPI-S-001 | /Waldenpy/OUT.py | UTF-8 | 1,964 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 7 23:46:46 2020
@author: yan
"""
"""
Walden Modular Equipment SAS
WPI_For_Output
2020
"""
#%%-----------LIBRARIES--------------------------------------------------------
import Walden as w
from tkinter import Scrollbar, Text, Tk, TOP, X, Y, Fra... | true |
4d6df9052577b3940294be3121c7be7ccbe37ec6 | technowell-org/tracker-scripts | /scripts/generate_users_arcade_expression.py | UTF-8 | 2,166 | 3.0625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | """
Copyright 2020 Esri
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, sof... | true |
3e02138fc1cadb240de3e12143a712aaad647637 | masato-sso/AtCoderProblems | /ABC101_200/ABC182/B.py | UTF-8 | 265 | 2.734375 | 3 | [] | no_license | import numpy as np
N=int(input())
A=np.array(input().split(" "),dtype=np.int64)
max_gcd=0
ans_k=2
for k in range(2,max(A)+1):
gcd=0
for n in A:
if(n%k==0):
gcd+=1
if(max_gcd<=gcd):
max_gcd=gcd
ans_k=k
print(ans_k) | true |
6a20ac261191a454a0a64030babee5b1782c0275 | strin/curriculum-deep-RL | /pyrl/dqn.py | UTF-8 | 7,115 | 2.671875 | 3 | [] | no_license | import random
import numpy as np
import numpy.random as npr
import theano
import theano.tensor as T
from IPython.display import Image
# from theano.printing import pydotprint
import layers
import optimizers
import cPickle as pickle
from util import unit_vec
from agent import OnlineAgent
import arch
DEFAULT_PARAMS = di... | true |
e056989a3469b9deac413b22c74a2eb3a778ac6e | tatsuya4649/asyncio-connection | /epoll.py | UTF-8 | 2,215 | 2.546875 | 3 | [] | no_license |
import socket
import time
from selectors import DefaultSelector,EVENT_WRITE,EVENT_READ
from elapse import elapse
import const
class Crawler:
global stopped
global paths_todo
global selector
def __init__(self,path,site,port):
self.path = path
self.site = site
self.port = port
self.sock = None
self.respon... | true |
2c2138ffac94bcb29da9e8f8cc3d3aef297127aa | Djheffeson/Python3-Curso-em-Video | /Exercícios/ex075.py | UTF-8 | 549 | 4.3125 | 4 | [] | no_license | números = (int(input('Digite um número: ')),
int(input('Digite outro número: ')),
int(input('Digite mais um número: ')),
int(input('Digite o último número: ')))
print(f'Você digitou os valores {números}')
print(f'O valor 9 apareceu {números.count(9)} vezes')
if 3 in números:
print(f... | true |
c61da5502b16bf6016d828dac8c390f6c86f2e3b | prashdash112/Project-Euler-solutions | /problem2.py | UTF-8 | 675 | 4.34375 | 4 | [
"Apache-2.0"
] | permissive | """Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms
will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms."""... | true |
a130baa27748ae1fb83ebcfed401ffbf0f1cadca | choovybi/2019MCM-ICM | /part1_3.py | UTF-8 | 1,566 | 2.5625 | 3 | [] | no_license | from pandas import DataFrame
from sklearn import linear_model
from sklearn.model_selection import GridSearchCV
from sklearn.ensemble import RandomForestRegressor
import pandas as pd
import numpy as np
df = pd.read_csv('trains_first.csv', header=None , sep=',')
df = df.drop(0, axis=1)
df = df.drop(0, axis=0)
df.columns... | true |
ec9afa2c783cf824767e390fd299023fe20ff46d | HonkyMan/YaTbot-translater | /YandexTranslateBot/aaed.py | UTF-8 | 378 | 2.953125 | 3 | [] | no_license | matrix = ''
def set_matrix(message):
global matrix
matrix = message
matrix = matrix.split(';')
print(type(matrix))
buf = matrix
matrix = list()
for i in buf:
i = i.replace('[','')
i = i.replace(']', '')
i = i.split(',')
matrix.append(i)
print(matrix)
a = '... | true |
f0cd652eaf89b53207d8a5f95fba9e15f55248bd | gio-shara-code/console_apps | /python/login_system/theme.py | UTF-8 | 589 | 2.734375 | 3 | [
"MIT"
] | permissive | from termcolor import colored
def input(text: str):
return colored(f'{text}', "cyan")
def option(text: str):
return colored(f'{text}', "magenta", attrs=['bold'])
def headline(text: str):
return colored(f'{text}', 'blue', attrs=['bold'])
def red_bold(text: str):
return colored(f'{text}', 'red', a... | true |
65dc3a9d0a268aa2e7a78de75601f238bdf4f791 | Pari17/LeetCode-Dump | /valid-anagram/anagram.py | UTF-8 | 607 | 3.875 | 4 | [] | no_license | class Solution(object):
def isAnagram(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
if len(s) != len(t):
print("False")
return 0
s = sorted(s)
t = sorted(t)
for i in range(0, len(s)):
... | true |
4557d28f0a6978863d931510a1fae170f07435d9 | Hansirr/multimodal | /sheila/ClassificatorSVM.py | UTF-8 | 2,150 | 3.125 | 3 | [] | no_license | import numpy as np
from sklearn import svm
from utils import Utils
class ClassificatorSVM():
def classify(self, lstFeaturesTraining, lstClassNumbersTraining, lstFeaturesTesting, lstClassNumbersTesting):
print('========= Training the Classifier SVM ========')
Utils.printMatrixInformation(lstFeatu... | true |
81b9501f068a1034586a1cd6e4fcfc1a0efd260b | caicaiqin/options-analysis | /Implied-vol-using-root-finding-methods/volusingroots.py | UTF-8 | 3,925 | 3.1875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Feb 18 13:36:39 2017
@author: Krishna Govind
"""
import pandas as pd
import math as m
import numpy as np
from datetime import datetime
from scipy.stats import norm as n
import matplotlib.pyplot as plt
#Function to calculate the Option price using BSM
def BSMOption(S,K,t,r,... | true |
9e7aa8cad34fc48f8fe3cbf8332e82edfa4ba8a9 | ceciliamarciel31/LaboratoriosBioinformatica | /pdb_info.py | UTF-8 | 1,227 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 19 22:33:14 2016
@author: jfsco
"""
from Bio.PDB import PDBList, PDBParser
#Apenas foi encontrada uma proteina com registo na base de dados PDB
#para fazer par multiplas proteinas bastava fazer um loop com os ids da pdb das proteinas
p = PDBParser(PERMISSIVE... | true |
7e1a4711127eb88aa96b0271b29f9000ac0e2cdb | mishakrengauz/prog_Krengauz | /bettercannon.py | UTF-8 | 4,636 | 3.109375 | 3 | [] | no_license | from tkinter import *
from random import randrange as rnd, choice
import math
import time
root = Tk()
fr = Frame(root)
root.geometry('800x600')
canv = Canvas(root, bg='cyan')
canv.pack(fill=BOTH, expand=1)
class Ball:
def __init__(self, x=40, y=450):
self.x = x
self.y = y
self.r = 1
... | true |
b8bd1c87523932cfe891b4d9d000c1677ca3043b | jjchan121/python-trading | /algotrader/technical/roc.py | UTF-8 | 928 | 2.828125 | 3 | [] | no_license | import numpy as np
from algotrader.technical import Indicator
def roc(prev_value, curr_value):
if prev_value != 0.0:
return (curr_value - prev_value) / prev_value
return np.nan
class ROC(Indicator):
__slots__ = (
'length',
)
def __init__(self, input=None, input_key=None, length... | true |
6f39b27ee6d4f42e3c32c10a325cad4f5a2f3bde | mrc-ide/Brazil_COVID19_distributions | /outputs_processing/sensitivity_right_censoring.py | UTF-8 | 3,706 | 2.828125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jul 10 16:22:47 2020
@author: iwona
"""
import pandas as pd
import pystan
import numpy as np
import scipy
import matplotlib.pyplot as plt
import seaborn as sns
import time
sns.set()
DATA_PATH = '../data/'
SEED = 4321
ITER = 2000
CHAINS = 4
MAX_VAL = 133
MIN_VAL = 1
#####... | true |
f6ff5e808f0be989a5bf8aa9a50ab41787ddc9d9 | Aries000004/test | /requests方法/taobao/siper.py | UTF-8 | 3,571 | 3.65625 | 4 | [] | no_license | '''
爬取淘宝搜索手机首页
抓取手机的基本信息(排行,名称,价格)
数据持久化写入本地文件
序号 价格 名字
1 9981 华为 MATE RS保时捷版
'''
import requests
import re
from urllib.parse import urlencode
def get_one_pafe(url):
'''访问网页获得网页文本信息'''
try:
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
... | true |
c3e7ba97f6d9a3988cef99a34bc23c40057c819e | acatapano/CS104-01 | /ForLoop.py | UTF-8 | 97 | 3.25 | 3 | [] | no_license | x = 1
total = 0
for x in range (10):
total = total + x
x = x + 1
print (total)
| true |
5fe0cd453ef86ad821f94deefae65bf0ac73122d | mufarosimbisayi/python-showcase | /07_wizard_battle/actors.py | UTF-8 | 1,479 | 3.828125 | 4 | [] | no_license | import random
class Creature:
def __init__(self, name, level):
self.name = name
self.level = level
def muster_defense_or_attack(self):
return random.randint(1, 12) * self.level
class Dragon(Creature):
def __init__(self, name, level, scaliness=15, breathes_fire=True):
super().__init__(name, level)
self.... | true |
87e95b4282288a54f117c33f81e514c0d3e352c5 | GanjelaMJ98/rcontrol_bot | /bot/plugins/SMART_plugin.py | UTF-8 | 3,933 | 2.890625 | 3 | [] | no_license | from .Plugin import Property, Plugin
import time as t
import os
import sys
from pySMART import Device
class SMART(Plugin):
def __init__(self,name):
self.name = name
self.properties = []
self.information = dict()
self.add_property("smart_check", self.smart_check)
self.add_property("health_check", self.health... | true |
0db3e7a3f69789d5989dcdc904c583ff0240c0ce | adreena/MyStudyCorner | /LeetCode/codes/125.py | UTF-8 | 573 | 3.578125 | 4 | [] | no_license | # time O(N)
# space: O(1)
class Solution:
def isPalindrome(self, s: str) -> bool:
i = 0
j = len(s)-1
while i<=j:
skip = False
if not s[i].isalpha() and not s[i].isdigit():
i+=1
skip=True
if not s[j].isalpha() and not s[j].is... | true |
0f4cf43b13159bf6e6a80fb06aab2e35af8ddca8 | Microstrong0305/Screenshot-to-Code | /Data Structure and Algorithm/剑指offer代码/34. 第一个只出现一次的字符位置/FirstNotRepeatingChar.py | UTF-8 | 425 | 3.59375 | 4 | [] | no_license | class Solution:
def FirstNotRepeatingChar(self, s):
if s is None or len(s) == 0:
return -1
for i in range(len(s)):
num = s.count(s[i])
if num == 1:
return s.index(s[i])
elif i >= len(s):
return -1
if __name__ == "__m... | true |
d3163ff6b42ef47712fa64b10d138e68d93169f5 | watinya/zerojudge | /python/b884.py | UTF-8 | 441 | 3.359375 | 3 | [] | no_license | import sys
n = sys.stdin.readline()
for i in range(int(n)):
xy = sys.stdin.readline()
xy = xy.replace("\r","").replace("\n","")
xy = xy.split()
x = int(xy[0])
y = int(xy[1])
yee = 100 - (x + y)
if(yee > 0 and yee <= 30):
print("sad!")
elif(yee > 30 and yee <= 60):
... | true |
f0d19ce4f816013d7a8bf8065e44cdf37b5b5637 | miroslavmasaryk3221/DevOps_Project | /IMS_check.py | UTF-8 | 2,854 | 2.859375 | 3 | [] | no_license | import tkinter as tk
import time
import re
from PIL import ImageTk
Tstat = "True"
Fstat = "False"
###############################
# This script is made for Administrators in order to to save amount of time by checking individual folders if a transfer problem appears
# This is a second check for IMS
# Made by Mirosl... | true |
a01ba22a9a1f693787225c06b94b45b99fe80948 | wallshock/wdi | /nww.py | UTF-8 | 243 | 3.171875 | 3 | [] | no_license | def nwd(a,b):
while b > 0:
r = a%b
a = b
b = r
return a
def NWD(a,b,c):
return nwd(a,nwd(b,c))
def nww(a,b):
return (a*b)//nwd(a,b)
def NWW(a,b,c):
return nww(a,nww(b,c))
print(NWW(25,85,150))
| true |
f19a8d0149f642109de5c9654a5aaa96455e4bb3 | dhchenx/MMGD | /GANs/cGAN_medical/uGAN_graymed/cgan_graymed/step5_cGAN_evaluate_summary.py | UTF-8 | 2,829 | 2.765625 | 3 | [] | no_license | # example of loading the generator model and generating images
import numpy as np
from numpy import asarray
from numpy.random import randn
from numpy.random import randint
from tensorflow.keras.models import load_model
from matplotlib import pyplot
import tensorflow as tf
from keras.preprocessing import image
import gl... | true |
07d0ccd0d0bf77ed9f5b028ebd7f86c8a35f7aa6 | bansicloud/anot8 | /src/server/common.py | UTF-8 | 3,200 | 2.765625 | 3 | [] | no_license | import csv
import json
import os
import re
import sys
dir_path = os.path.dirname(os.path.realpath(__file__))
config_dir_path = dir_path + "/../../config/"
project_root_dir_path = dir_path + "/../../"
regexp_data_file_name_from_annotations_file = re.compile(r"(.+\.pdf)(?:\.([a-z0-9_]+))?\.annotations$")
def annot... | true |
105ca5129630d0b54f20af2ea62cc9c03705cb42 | joshsimon-bit/python | /phonebookdict.py | UTF-8 | 728 | 3.671875 | 4 | [] | no_license | user_input = input("Hello, I am the classroom phonebook. Let's get started by asking your name? ")
print(" Thanks " + user_input + " would you like to add your name into our log? ")
Y = True
user_answer = input("Please enter Y for Yes or N for No. ")
if user_answer == True:
print("Great! ")
user_number = in... | true |
cbbc7ccce6fa769db3614b593f08192d40e1506b | OlexandrGamchuk1/Homework-4 | /Exercise 1.py | UTF-8 | 242 | 3.671875 | 4 | [] | no_license | a = input('Enter a four-digit ticket number ')
b = len(a)
if b % 4:
print('There is no such ticket.')
else:
if int(a[0]) + int(a[1]) == int(a[2]) + int(a[3]):
print('Happy ticket')
else:
print('Not a lucky ticket') | true |
04405f28e7b3cc2668b203c37abedb12f575b5b1 | bhagyashrishitole/coding-challenges | /LeetCode31DaysChallenge/Week1/first_unique_char.py | UTF-8 | 1,224 | 4.03125 | 4 | [] | no_license | """
Problem Statement
First Unique Character in a String
Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1.
Examples:
s = "leetcode"
return 0.
s = "loveleetcode",
return 2.
Note: You may assume the string contain only lowercase letters.
"""
class Solu... | true |
62bd0e03d2789fe20643c38dabac506c871d3e78 | kayburns/perls2 | /examples/simple_reach/simple_reach_env.py | UTF-8 | 6,701 | 2.875 | 3 | [] | no_license | """ Class for Pybullet Sawyer environments performing a reach task.
"""
from __future__ import division
import time
import math
import numpy as np
from perls2.utils.yaml_config import YamlConfig
from perls2.envs.env import Env
import gym.spaces as spaces
import logging
class SimpleReachEnv(Env):
"""The class for... | true |
de7636576df2e77ab5b59d565ef67f252ea82cff | mfienup/Python-Topic-Modeling-Scripts | /Pre-processing/Preprocessing_Scripts/processChatCSV_onlyQuestions.py | UTF-8 | 10,307 | 3.421875 | 3 | [] | no_license | """ File: processChatCSV_onlyQuestions.py
Description: Takes as input raw chat data .csv file and each chat is analyzed to extract
only the initial question of each chat. The original chat data (.csv) from the LibChat
module of UNI's library SpringShare platform contained a "Initial Question" column ... | true |
7b5a9932b6578e21529748d9325711fb45666c21 | Naveenramkumar/DataAnalysisUsingPython | /MidTerm/MidTermPython.py | UTF-8 | 5,563 | 2.6875 | 3 | [] | no_license |
# coding: utf-8
# In[ ]:
import requests
import json
import sys
from operator import itemgetter
searchTerm=""
if len(sys.argv) < 2:
print("Invalid Call to the Script/n")
print("Usage: python <script_name> <search_term1> <search_term2>")
sys.exit(2)
if len(sys.argv) > 5:
print("Invalid Call to... | true |