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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ad029b1943f6557d71e71433a487da03433a7b4a | Python | QiGe57/-Python-Multi-software-file-conversion-in-material-simulation-calculation | /change_incar_JGtoTX.py | UTF-8 | 3,733 | 2.828125 | 3 | [] | no_license | # -*- coding=utf-8 -*-
# author : wangfan 2018-11-08
#计算计算弹性常数时,从将第一步的结构弛豫中的INCAR复制的相应的文件夹并修改相应的参数
import os
import shutil
#复制文件
def mycopyfile(srcfile, dstfile):
if not os.path.isfile(srcfile):
print("%s not exist!" % (srcfile))
else:
fpath, fname = os.path.split(dstfile) # 分离文件... | true |
a254c5edbb07816c63d692333385914910ea6331 | Python | medford-group/Prospects-and-Challenges-for-Solar-Fertilizers | /Figures/VCR_colorbar.py | UTF-8 | 1,023 | 3.15625 | 3 | [] | no_license | import matplotlib.pyplot as plt
import matplotlib.cm as cm
from matplotlib.collections import LineCollection as lc
import numpy as np
def myplot(ax,xs,ys,zs, cmap):
plot = lc([zip(x,y) for (x,y) in zip(xs,ys)], cmap = cmap)
plot.set_array(np.array(zs))
x0,x1 = np.amin(xs),np.amax(xs)
y0,y1 = np.ami... | true |
f3e8d3aee08b48c1819c97ae0b25b5a60f741b47 | Python | Smudge-Studios/smudge | /tasks/bans.py | UTF-8 | 1,367 | 2.5625 | 3 | [] | no_license | import discord
from discord.ext import tasks, commands
from core.ModCore import Mod
mod = Mod()
class AutoUnban(commands.Cog):
def __init__(self, bot):
self.index = 0
self.bot = bot
self.unban.start()
def cog_unload(self):
self.unban.cancel()
@tasks.loop(seconds=60.0)
... | true |
039082072a77a609384f5d01c2f63f089f9a8732 | Python | leeiopd/algorithm | /before2021/python/day1_array1_study/Counting.py | UTF-8 | 301 | 2.875 | 3 | [] | no_license | nums = list(map(int,input()))
print(nums)
c = [0] * len(nums)
result = [0]*len(nums)
for n in nums:
c[n] += 1
for i in range(1,len(c)):
c[i] += c[i-1]
print(c)
for num in range(len(nums)-1, -1, -1):
result[c[nums[num]]-1] = nums[num]
c[nums[num]] -= 1
print(result)
| true |
91d0da8a1f2dfce29bb9a70c145cca0916cbe0a5 | Python | Spacerat/Yelp-OSM | /server.py | UTF-8 | 1,737 | 2.609375 | 3 | [] | no_license | import gevent
from gevent import monkey
monkey.patch_all()
from gevent.wsgi import WSGIServer
from flask import Flask, jsonify, request
from flask_caching import Cache
import logging
from gzipped import gzipped
import openstreetmap
import yelp
app = Flask(__name__)
cache = Cache(app,config={'CACHE_TYPE': 'simple'})
... | true |
e8c38a6c8aa119b95315044e592e31efe9a730a4 | Python | signalwolf/Leetcode_by_type | /MS Leetcode喜提/店面准备MS/一次做出来/2. Add Two Numbers.py | UTF-8 | 836 | 3.34375 | 3 | [] | no_license | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def addTwoNumbers(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
"""
head ... | true |
b88f43d673b2ebf0e87c9ff2eb7d12808c5e77f8 | Python | yehongyu/acode | /2019/dynamic_programming/largest_divisible_subset_368.py | UTF-8 | 908 | 3.015625 | 3 | [] | no_license | class Solution(object):
def largestDivisibleSubset(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
n = len(nums)
if n <= 1: return nums
nums = sorted(nums)
dp = [1] * n
path = [i for i in range(n)]
max_len = 1; max_end = 0
... | true |
2d8cc18d53fa12f2c54a247c36602b88a294ac8e | Python | Rexinazor/Telegram_Scraper_Adder | /setup.py | UTF-8 | 1,324 | 2.796875 | 3 | [
"MIT"
] | permissive | #!/bin/env python3
# code by : Termux Professor
"""
you can re run setup.py
if you have added some wrong value
"""
import os, sys
import configparser
re="\033[1;31m"
gr="\033[1;32m"
cy="\033[1;36m"
def banner():
os.system('clear')
print(f"""
{re}╔═╗{cy}┌─┐┌┬┐┬ ┬┌─┐
{re}╚═╗{cy}├┤ │ │ │├─┘
{r... | true |
a81dae5f21f74ef117e343f7b3ce4884f7ad2331 | Python | houseind/robothon | /GlyphProofer/dist/GlyphProofer.app/Contents/Resources/lib/python2.6/numpy/core/tests/test_ufunc.py | UTF-8 | 9,375 | 2.6875 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | import numpy as np
from numpy.testing import *
class TestUfunc(TestCase):
def test_reduceat_shifting_sum(self) :
L = 6
x = np.arange(L)
idx = np.array(zip(np.arange(L-2), np.arange(L-2)+2)).ravel()
assert_array_equal(np.add.reduceat(x,idx)[::2], [1,3,5,7])
def test_generic_loop... | true |
d4c1f6853a95fca412b7b45d10df1fe6f012fd1f | Python | Wizmann/ACM-ICPC | /Leetcode/Algorithm/python/2000/01567-Maximum Length of Subarray With Positive Product.py | UTF-8 | 664 | 2.890625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | from typing import *
INF = 10 ** 10
class Solution:
def getMaxLen(self, nums: List[int]) -> int:
minp = -1
minn = INF
n = len(nums)
cur = 1
res = 0
for i in range(n):
cur *= nums[i]
if cur > 0:
cur = 1
elif cur < 0... | true |
60c9b4b23172d95baad8f852135f94d8e0979eaa | Python | protocol7/euler.py | /euler/57.py | UTF-8 | 425 | 3 | 3 | [] | no_license | #!/usr/bin/env python3
from itertools import islice
from shared import ilen
def fit(n, d):
return len(str(n)) > len(str(d))
def sqrt2():
pn, pd = 1, 1
n, d = 3, 2
yield n, d
while True:
n, pn = n*2 + pn, n
d, pd = d*2 + pd, d
yield n, d
assert [(3,2), (7,5), (17,12)] =... | true |
f11ef1835c9f72ad9968f15565c3ea61e595c1d5 | Python | TheUltiOne/Limitless | /cogs/pre/examplecog.py | UTF-8 | 581 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | from discord.ext import commands
from cogs.pre.utils import checks # You can make your own utils, or use the pre-made utils we have.
class examplecog(commands.Cog):
def __init__(self, bot):
self.bot = bot
# An example command called examplecog. It's really simple. When run, a message will be sent... | true |
0d799050c7048ea913d756344fd27127bc17f5c0 | Python | mnachmia31/Python-Scripts | /jira_connection.py | UTF-8 | 1,533 | 2.84375 | 3 | [] | no_license | # This script is used to make a connection to a JIRA server to make updates
# to JIRA issues. This script takes three command line arguments:
# jira_server - JIRA Server URL
# jira_user - JIRA user
# jira_password - JIRA user's password
__author__ = 'michaelnachmias'
from jira.client import JIRA
import sys
import log... | true |
b8c52aabeb7597c305fbb924562ee7922afc895b | Python | Nickel-eye/yelpwriter | /crawler.py | UTF-8 | 2,141 | 2.578125 | 3 | [] | no_license | from bs4 import BeautifulSoup
from urllib.parse import urljoin
import urllib
import argparse
import math
import re
import markovify
def crawl(restname):
get_yelp_page = \
lambda restname, page_num: \
'http://www.yelp.com/biz/{0}' \
'?start={1}'.format(restname, page_num)
page_url = get_yelp_page(restname,0)... | true |
8252240b008e85a0a81c3459846f974efdb7bd5b | Python | weak-head/leetcode | /leetcode/p0503_next_greater_element_ii.py | UTF-8 | 434 | 3.546875 | 4 | [] | no_license | from typing import List
def nextGreaterElements(nums: List[int]) -> List[int]:
"""
Monotonic stack
Time: O(n)
Space: O(n)
"""
n = len(nums)
s = []
r = [None] * n
for i in range(2 * (n - 1), -1, -1):
while s and nums[s[-1] % n] <= nums[i % n]:
s.pop()
... | true |
e601106d147ff2b585d306171ad5e97ba56ae8aa | Python | VahidGh/ChannelWorm | /channelworm/ion_channel/adapters.py | UTF-8 | 6,499 | 2.734375 | 3 | [
"MIT"
] | permissive | # configure django to use default settings
# note that this can also be done using an environment variable
import sys
sys.path.append('..')
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
if hasattr(settings, 'DEBUG'):
# settings are configured already
pass
else:
# ... | true |
a55bc40d57833c1e120070e20ebea2a3916e0041 | Python | joleneyu/Python-Beginner | /acronyms.py | UTF-8 | 430 | 3.453125 | 3 | [] | no_license | acronyms = ['LOL', 'IDK', 'SMH', 'TBH']
print (acronyms[0])
acronyms.append('BFN')
acronyms.append('IMHO')
print(acronyms)
acronyms.remove('BFN')
print(acronyms)
del acronyms[4]
print(acronyms)
if "LOL" in acronyms:
print('True')
else:
print('False')
word = 'BFN'
if word in acronyms:
print(word + ' is ... | true |
e54f4586978379cbe88b958c23b1b3eee27365f4 | Python | vaibhavmathur91/GeeksForGeeks | /Arrays/1_longest-span-sum-two-binary-arrays.py | UTF-8 | 1,910 | 4.25 | 4 | [] | no_license | """
Longest Span with same Sum in two Binary arrays
Given two binary arrays arr1[] and arr2[] of same size n.
Find length of the longest common span (i, j) where j >= i
such that arr1[i] + arr1[i+1] + …. + arr1[j] = arr2[i] + arr2[i+1] + …. + arr2[j].
Note: Expected time complexity is Θ(n).
Examples :
Input: ... | true |
fa74fb5314c63958af6f4bea74b8ab03749edb13 | Python | ermahoney18/python_class | /hangman.py | UTF-8 | 3,873 | 3.8125 | 4 | [] | no_license |
import random #for the random.choice function
from re import sub
import numpy as np
import os
hangman_graphics=['''
-----------
|
|
|
|
|
|
======''','''
... | true |
b957cd4a3c6b6e7e4b90fd31ecc87f0fb27ff032 | Python | valemore/leaf-disease | /leaf/inference.py | UTF-8 | 4,078 | 2.53125 | 3 | [] | no_license | import pandas as pd
import numpy as np
from tqdm import tqdm
import torch
from leaf.model import LeafModel, softmax
def predict(leaf_model: LeafModel, data_loader):
ensemble_patches = data_loader.max_samples_per_image > 1
leaf_model.model.eval()
with torch.no_grad():
logits_all = torch.zeros((data_... | true |
11d55695a9d54f9429c2c691b69289a79e01c90e | Python | MLGNateDog/Capstone-Mini-Projects | /Mini Projects/rangeDemo.py | UTF-8 | 386 | 3.84375 | 4 | [] | no_license | """ rangeDemo.py
demonstrates how range object creates automatic lists of numbers
17 Jan, 2021"""
print("range(3)")
print(range(3))
print()
print("range(1, 3)")
print(range(1, 3))
print()
print("range(2, 5)")
print(range(2, 5))
print()
print("range(0, 55, 5)")
print(range(0, 55, 5))
print(... | true |
17ce87e9ed9d1efdc5a33761a04d6d112424b492 | Python | sunshinewxz/leetcode | /eggDrop.py | UTF-8 | 392 | 2.9375 | 3 | [] | no_license | import sys
# n eggs; k floors
def eggDrop(n, k):
max_size = sys.maxsize()
dp = [[max_size] * (k+1) for i in range(n+1)]
for i in range(1, n+1):
dp[i][0] = 0
dp[i][1] = 1
for j in range(1, k+1):
dp[1][j] = j
for i in range(2, n+1):
for j in range(2, k+1):
for x in range(1, j+1):
res = 1 + max(dp[i... | true |
ebdb7b4c67856fb6bfb9a6f8803d4af86a5a834d | Python | meganchen/twitter-comp | /scraper.py | UTF-8 | 935 | 2.90625 | 3 | [] | no_license | import urllib2, datetime
from bs4 import BeautifulSoup
donaldTrump = 'realDonaldTrump'
hillaryClinton = 'HillaryClinton'
username = [donaldTrump, hillaryClinton]
#un - Twitter handle
def getTweet(un):
link = urllib2.urlopen('https://twitter.com/' + un)
html = link.read()
soup = BeautifulSoup(html, 'ht... | true |
854134a82ea8c42a2f715da40d99eb8cb3b0f369 | Python | naveenramees/python-pro | /palindrome.py | UTF-8 | 192 | 3.53125 | 4 | [] | no_license | num = int(input("Enter the number: "))
f = num
rev = 0
while(num > 0):
Rem = num %10
rev = (rev*10) + Rem
num = num // 10
c = int(rev)
if c == f:
print "yes"
else:
print "no"
| true |
8d8a1e11299652e5028853e98ecd520df0f97242 | Python | RealThadeous/cse210-student-mastermind | /mastermind/game/director.py | UTF-8 | 5,034 | 3.4375 | 3 | [] | no_license | from game.board import Board
from game.console import Console
from game.player import Player
from game.roster import Roster
from game.check import Check
from game.clear_screen import ClearScreen
from game.intro_info import Intro
import os
file_path = os.path.dirname(os.path.abspath(__file__))
os.chdir(file_path)
cl... | true |
c71cc7d9b24e2a57c3fd9b8ac6584394f972b3c8 | Python | ssskming/pys | /leetcode/lengthOfLonge.py | UTF-8 | 819 | 3.359375 | 3 | [] | no_license | class Solution:
def lengthOfLongestSubstring(self,s:str) -> int:
"""
:type s: str
:rtype: int
"""
max_number = 0
number = 0
test = ''
for i in s:
if i not in test:
test += i
number += 1
else:
... | true |
86f2ee4ab4197be4246bc35a3ca4bdff98b25be1 | Python | fbourke/elecanisms | /whack/miniAccelPlot/accelPlot.py | UTF-8 | 2,343 | 2.890625 | 3 | [] | no_license | import sys, serial, argparse
import mputest
import numpy as np
from time import sleep
from collections import deque
import matplotlib.pyplot as plt
import matplotlib.animation as animation
# plot class
class AnalogPlot:
# constr
def __init__(self, maxLen, mpu):
# open serial port
# self.ser = serial.Seri... | true |
7be75d2fc4101b94858381e09f90186109251cb6 | Python | HelloBoy2016/python-demo | /python-demo/ListDemo.py | UTF-8 | 1,083 | 3.90625 | 4 | [] | no_license | # !/usr/bin/python
# -*- coding: UTF-8 -*-
# 使用下标索引来访问列表中的值,同样你也可以使用方括号的形式截取字符
list = ['hello','xiaoming',25,'65kg']
print list[0]
print list[0:4]
# 对列表的数据项进行修改或更新,你也可以使用append()方法来添加列表项
name = ['xiaoming','xiaoqiang','xiaohua']
print 'name[1]',name[1]
name[1] = 'xiaoqiang_new'
print 'name[1]',name[1]
# 在列表末尾添加新对象
na... | true |
92aecb81e2349228f59a31ede44537db72200a5a | Python | WTFox/exercism | /python/meetup/meetup.py | UTF-8 | 907 | 3.046875 | 3 | [] | no_license | # exercism.io meetup challenge
from datetime import datetime, timedelta
class MeetupDayException(Exception):
pass
def meetup_day(intYear, intMonth, strDay, strDesc):
dayString = {
1: 'Monday',
2: 'Tuesday',
3: 'Wednesday',
4: 'Thursday',
5: 'Friday',
6: 'Saturday',
7: 'Sunday'
}
dayRanges = {
't... | true |
6fda9a662b0361bf3bc2c7200d8514a9a648de38 | Python | liangyy/haplotype-po | /scripts/framingham_detour/infer_ho_from_tuple/child_parent_correlation.py | UTF-8 | 4,087 | 2.75 | 3 | [
"MIT"
] | permissive | import argparse
parser = argparse.ArgumentParser(prog='child_parent_correlation.py', description='''
Compute correlation between child haplotypes and parent genotypes.
Also, father genotype and mother genotype.
''')
parser.add_argument('--h1', help='''
haplotype 1
''')
parser.add_argument('--h2', default=... | true |
2b475e319fdc8e7a8964bb0f78a7ee5f3bb3ef44 | Python | Sandy4321/RL | /final/tests/simplified_model/1Link_sac_from_tutorial/main_sac.py | UTF-8 | 2,817 | 2.6875 | 3 | [] | no_license | import pybullet_envs
import gym
import numpy as np
from sac_torch import Agent
from utils import plot_learning_curve
from gym import wrappers
from statePredictor import statePredictor
import torch
if __name__ == '__main__':
agent = Agent(n_actions=3)
numTrials = 5000
dt = 0.01 # was 0.5
numSteps = 1 #... | true |
fb6880673704d4baedcc6d8fe5a88321ad5ef20b | Python | KoustavDey95/learning101 | /reversing_word_in_senetnce.py | UTF-8 | 344 | 3.5625 | 4 | [] | no_license | def myReverse(sentence):
words = sentence.split()
for i in range(0,len(words)):
words[i] = words[i][::-1]
return (" ".join(words))
#Test
_input = "today is saturday"
expectedOutput = "yadot si yadrutas"
observedOutput = myReverse(_input)
result = "PASS" if expectedOutput == observedOutput el... | true |
e596ccf20bdb9b44a45a37904dc722667206727c | Python | jingong171/jingong-homework | /曾程/2017310414第五次作业-金工171-曾程/2017310414第五次作业-金工171-曾程/10-11/10-11(1).py | UTF-8 | 171 | 3.203125 | 3 | [] | no_license | import json
filename='favorite_number.json'
favorite_number=input("What's your favorite number? ")
with open(filename,'w') as f_obj:
json.dump(favorite_number,f_obj)
| true |
f3886a7ba61fd85a335247acbbff48809b30c09a | Python | Aasthaengg/IBMdataset | /Python_codes/p03260/s599311360.py | UTF-8 | 137 | 3.328125 | 3 | [] | no_license | a,b=map(int,input().split())
x=0
for i in range(3):
if (a*b*(i+1))%2!=0:
x+=1
if x>=1:
print("Yes")
else:
print("No") | true |
43a18a1e3ada4e0255dd5375bf83728c32f93a61 | Python | dat-adi/image-processing | /image_classification/mnist_demo.py | UTF-8 | 2,271 | 3.03125 | 3 | [] | no_license | from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
from sklearn.metrics import classification_report
from sklearn import datasets
from skimage import exposure
import numpy as np
import imutils
import cv2
import random
mnist = datasets.load_digits()
(trainData, testD... | true |
89b72f43d9f1694ea997774684df187a622551fa | Python | Suhaiz/first | /list/newlesscomplex.py | UTF-8 | 479 | 3.546875 | 4 | [] | no_license | lst=[1,2,3,4,5,6,7,8]
lst=sorted(lst)
print(lst)
lower=0
upper=len(lst)
mid=(upper+lower)//2
length=len(lst)
element=int(input("\nenter the element whose sum pair should be found\t"))
flag=0
for i in range(0,len(lst)-1):
for j in range(0,len(lst)-2):
if(lst[i]+lst[j+1]==element):
print("the... | true |
9367e618fdab537a064c65a4b653089f3aa11a35 | Python | BAGPALLAB7/HackerRank-Solutions-Python3 | /HackerRank - Problem Solving/cutTheSticks_hackerrank.py | UTF-8 | 384 | 3.40625 | 3 | [] | no_license | def cutTheSticks(arr):
res=[]
while(len(arr)):
temp=[]
res.append(len(arr))
cut=min(arr)
for i in range(len(arr)):
arr[i]=arr[i]-cut
for j in range(len(arr)):
if arr[j]!=0:
temp.append(arr[j])
arr=temp
retu... | true |
37271437000bdbdc1e817aff403cfbed6306bd01 | Python | eford/swarm | /scripts/swarmOutputCompare.py | UTF-8 | 1,829 | 3.46875 | 3 | [] | no_license | #!/usr/bin/python
import os, sys
def removeEmpty(s):
while(s.count('') > 0):
s.remove('')
def removeLine(arr, line):
while (arr.count(line) > 0):
arr.remove(line)
if (len(sys.argv) < 3):
print "Usage: swarmOutputCompare.py output_file reference_file"
print "Returns 0 if files are same other than floa... | true |
8f7e691bdf4a30df7f9868cab8969e25bbe0ec00 | Python | dev-area/Python | /Examples/ex2.py | UTF-8 | 439 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Jan 15 22:59:09 2015
@author: liran
"""
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
def rgb2gray(rgb):
return np.dot(rgb, [0.299, 0.587, 0.144, 0])
img = mpimg.imread('/Users/liran/hires.png')
gray =... | true |
88964f08e02e65f181b8a7ed5468bbd2e8a545c3 | Python | H-Cong/LeetCode | /209_MinimumSizeSubarraySum/209_MinimumSizeSubarraySum.py | UTF-8 | 473 | 3.234375 | 3 | [] | no_license | class Solution:
def minSubArrayLen(self, s: int, nums: List[int]) -> int:
'''
Two Pointer
'''
sum_, left = 0, 0
ans = len(nums) + 1
for right, n in enumerate(nums):
sum_ += n
while sum_ >= s:
ans = min(ans, right - left + 1)
... | true |
6b6e49513df088e25cbaaa46a97de9f23069c551 | Python | spencermcghin/EldritchMUSH | /eldritchmush/commands/inventory_helper.py | UTF-8 | 1,480 | 3.03125 | 3 | [] | no_license | class Inventory:
"""
A helper class used to ease readability and flow of combat functions
Should be rewritten ultimately to use properties/getters/setters
"""
def __init__(self, parent, caller):
self.caller = caller
self.parent = parent
def getWeapon(self):
right_hand =... | true |
68bd925b462476815d0a5ac5a622201ae6a5dce1 | Python | panghyuk/21-1_study | /구현(완전탐색)/왕실의 나이트.py | UTF-8 | 445 | 3.546875 | 4 | [] | no_license | data = input()
row = int(data[1])
#아스키 코드 'a' = 97
column = int(ord(data[0])) - int(ord('a')) + 1
# 나이트가 이동할 수 있는 8가지 방향
steps = [(-2,-1),(-1,-2),(1,-2),(2,-1),(2,1),(1,2),(-1,2),(-2,1)]
count = 0
for step in steps:
# 이동하고자 하는 위치
next_row = row + step[0]
next_column = column +step[1]
if (1 <= next_ro... | true |
c5d5825c25b70f80ce2519587700c641f5389c41 | Python | Anand-Thakur07/The_Snake_Game | /F1.py | UTF-8 | 5,053 | 3.328125 | 3 | [] | no_license | #DEVELOPED BY ANAND
import random
import pygame
pygame.init()
import os
pygame.mixer.init()
#Colors
white = (255,255,255)
red = (255,0,0)
blue = (0,0,255)
green = (0,255,0)
black = (0,0,0)
#Game window
game_window = pygame.display.set_mode((600,350))
pygame.display.set_caption("PLAY SNAKE")
pygame.display.update()
... | true |
e430c6636836cbd007a9f9c1c6a601cbba7af2f5 | Python | Aasthaengg/IBMdataset | /Python_codes/p02641/s060546923.py | UTF-8 | 404 | 2.765625 | 3 | [] | no_license | import sys
x,n=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
if n==0:
print(x)
sys.exit()
if x not in p:
print(x)
sys.exit()
q=list(i for i in range(p[0]-1,p[-1]+2))
for i in p:
q.remove(i)
ans=[]
c=x+n
for i in q:
if c>abs(x-i):
c=abs(x-i)
ans.clea... | true |
a03eea7ce55573bf3a37fef686333b6a7f3ad389 | Python | ChiaraMazzucchelli/BPeople | /hair_color_extractor.py | UTF-8 | 1,851 | 2.921875 | 3 | [] | no_license | import PIL.Image
import cv2
import numpy as np
import keras
from utils import cropping_images
from utils import dominant_color
def predict(image, model, color='BGR', height=224, width=224):
if color == 'BGR':
im = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) # conversione in RGB
else:
im = image... | true |
376a79be0493d232fe53fae6226487e87913c1a1 | Python | FlavitoAdr/Python | /ProjectEuler57.py | UTF-8 | 212 | 3.421875 | 3 | [] | no_license | #Desafio 57#
import math
a = 3
b = 2
max = 1000
contagem = 0
for i in range(1, max+1):
b = a + b
a = 2 * b - a
if int(math.log10(a)) > int(math.log10(b)):
contagem += 1
print(contagem)
#Resultado 153
| true |
87eb5814944799353ecace73b50eb19540ff9990 | Python | massey-high-school/2020-91896-7-assessment-zzthomaszzz | /06_num_check_01.py | UTF-8 | 1,246 | 3.578125 | 4 | [] | no_license | # not_blank_01
def not_blank(subject, error, num):
loop = True
while loop:
fail = False
response = input(subject)
if response == "":
print(error)
continue
else:
if not num:
for letter in response:
if letter.i... | true |
6e62a834acc45b0c7e8e95beb1c45b81c7d555a7 | Python | gazellexo/python-challenge | /PyBank/main.py | UTF-8 | 1,339 | 3.375 | 3 | [] | no_license | import csv
file_to_load = "Resources/budget_data2.csv"
total_months = 0
total_revenue = 0
prev_revenue = 0
revenue_change = 0
max_i = ["", 0]
min_d = ["", 9999999999999999999999]
revenue_changes = []
with open(file_to_load) as revenue_data:
reader = csv.DictReader(revenue_data)
for row in reader:
... | true |
9eacd7cb38a12645078ade9db53dc941337d608a | Python | MiS27/record-device-classifier | /main.py | UTF-8 | 3,288 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python
from __future__ import print_function
import time
import numpy as np
from sklearn.model_selection import KFold
from data_util import DataUtil
from model import Model
debug = True
def main(num_epochs=100, n_splits=5):
data_util = DataUtil('data', 'spectrogram_data')
X, y = data_util.... | true |
e1065387f702814d2f27ba1ffe25c7da1b666088 | Python | whyjz/CARST | /extra/unused/distanceFromUTM.py | UTF-8 | 937 | 3.03125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# distanceFromUTM.py
# Author: Andrew Kenneth Melkonian (akm26@cornell.edu)
# All rights reserved
import subprocess;
import sys;
def distanceFromUTM(track_path, out_path):
prev_x = "";
prev_y = "";
distance = 0.0;
diff_x = 0.0;
diff_y = 0.0;
track_file = open(track_path, "r");
ou... | true |
4187699612a6a8dd45b3a3a824eef0b438fa9763 | Python | Alasdair-Roddick/Image-Pixel-Encription | /Encription.py | UTF-8 | 604 | 2.90625 | 3 | [] | no_license | from PIL import Image
import random
from random import randint
size = input()
message = []
for o in size:
message.append(size)
for p in message:
encript = [ord(c) for c in p]
column = []
img = Image.new( 'RGB', (len(encript), len(encript)), "black")
pixels = img.load()
listofColours = []
... | true |
64a56eb4b3002582da543f68a3858f193f5aec46 | Python | fandreuz/parametric-propeller-mesh | /src/read_spatial_info.py | UTF-8 | 1,310 | 2.734375 | 3 | [] | no_license | from smithers.io.stlhandler import STLHandler
from smithers.io.obj import ObjHandler
import numpy as np
class DataWrapper:
def __init__(self, path):
extension = path.split(".")[-1]
if extension == "stl":
self._points = np.asarray(STLHandler.read(path)["points"])
elif extension ... | true |
2439c2bc9787050bc36e36e3d05e5808a375dbb2 | Python | gblageov/Learn_python | /Test python/01_Beginers/if exercise.py | UTF-8 | 256 | 3.625 | 4 | [] | no_license | x = True
y = False
if x or y:
print("Това е примерно за 'OR' ")
print("Едно от двете е вярно 'True'")
else:
print("Това е примерно за 'OR' ")
print("И двете са грешни'False'")
| true |
3bbe5cb5211825b299f8e1930aca3ad6070fbc7f | Python | Hoan96/EXAMPLE_PYTHON | /Pandas/pan.py | UTF-8 | 1,003 | 3.28125 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
mydata = {
'cats':["BMW","VOLVO","FORD"],
'passing':[3,7,2]}
myvar = pd.DataFrame(mydata,index=["ONE","TWO","THREE"])
#print(myvar)
excel = pd.read_csv('fie.csv')
#myx = pd.DataFrame(excel)
#print(excel.tail()) #Lấy 5 mảng sau cùng
#print(excel.head()) #Mặc định l... | true |
4590fcebc7b61f5bb869610a5583254726b65133 | Python | naveenmurugesan/facty.py | /sentence.py | UTF-8 | 224 | 2.796875 | 3 | [] | no_license | a=input().split()
m="abcdefghijklmnopqrstuvwxyz"
x=a[0]
c = 0
for i in range(1,len(a)):
x=x+a[i]
y=x.lower()
y=[*y]
y=list(set(y))
for i in y:
if i in m:
c+=1
if c==26:
print("yes")
else:
print("no")
| true |
b4c17f85634aabfa030db53ca43188165ed8b727 | Python | tack1/Casam | /Code/casam_django/addVTK.py | UTF-8 | 1,442 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
class WinRegStub(object):
def __init__(self):
self.HKEY_CURRENT_USER = "HKEY_CURRENT_USER"
self.KEY_WRITE = "KEY_WRITE"
self.REG_SZ = "REG_SZ"
def OpenKey(self, *args):
pass
def OpenKey(self, *args):
pass
def SetValueEx(self, *args):
pass
def CloseKey(self, *args):
pass
def Co... | true |
9530899f229d98d586e0c3481d11f6c26dd6e4a1 | Python | kses1010/algorithm | /programmers/level1/string_n_sort.py | UTF-8 | 290 | 3.84375 | 4 | [] | no_license | # 문자열 내 마음대로 정렬하기
def solution(strings, n: int):
answer = sorted(strings, key=lambda x: (x[n], x))
return answer
strings1, n1 = ["sun", "bed", "car"], 1
strings2, n2 = ["abcd", "abce", "cdx"], 2
print(solution(strings1, n1))
print(solution(strings2, n2))
| true |
90f35cf1d242b0ac9fbad1530192b81cb73b59ec | Python | arpit0891/project-euler-1 | /123.py | UTF-8 | 632 | 3.5 | 4 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
#Let pn be the nth prime: 2, 3, 5, 7, 11, ..., and let r be the remainder when (pn−1)n + (pn+1)n is divided by pn2.
#For example, when n = 3, p3 = 5, and 43 + 63 = 280 ≡ 5 mod 25.
#The least value of n for which the remainder first exceeds 109 is 7037.
#Find the least value... | true |
0e29723d6797f46b02160aeab2974334a388330d | Python | mike4192/mikesPersonalRepo | /spot_micro_project_notes/kinematics/transformations.py | UTF-8 | 1,304 | 3.34375 | 3 | [] | no_license | #!/usr/bin/env python
import numpy as np
import math as m
def rotx(a):
"""Creates a numpy rotaion matrix about the x axis
Args:
a: angle for rotation in radians
Returns:
The rotation matrix about the x axis
"""
rotxMatrix = np.array(
[[1, 0, ... | true |
86fe4955d2cb48ac2e22eda7580aeec3815ac77c | Python | Styfjion/-offer | /exam_record/test2.py | UTF-8 | 568 | 3.140625 | 3 | [] | no_license |
import sys
if __name__ == "__main__":
line = sys.stdin.readline().strip()
a = list(map(int, line.split()))
m = a[0]
n = a[1]
result = []
for i in range(m,n+1):
if i == 370:
a = 1
target = i
gewei = i%10
i = int(i/10)
shiwei = i... | true |
a482ff8f703dd60a6716e076625e2874f0445470 | Python | OlgaVSova/Python_studying | /src/Task2_64.py | UTF-8 | 1,932 | 3.4375 | 3 | [] | no_license | #элемент равен сумме соседей сверху, снизу, справа и слева
m = []
while True:
n = [i for i in input().split()]
if 'end' not in n:
for j in range(0, len(n)):
n[j] = int(n[j])
m.append(n)
if 'end' in n:
break
#создать пустой массив такой же размерности и писать в него
cl = ... | true |
f14b1e2c522d80a048ddf9ac8fdb07529d2560d0 | Python | shaukhk01/project01 | /ex95.py | UTF-8 | 245 | 3.015625 | 3 | [] | no_license | def main():
city = input('Enter a city name.')
_strip = city.lstrip()
if _strip =='Hyderabad':
print('Amerpeet')
elif _strip =='Chennai':
print('TG')
elif _strip =='kerala':
print('trivandram')
main()
| true |
7be33f894105f346378560df30f1cbba47ed7dad | Python | Aasthaengg/IBMdataset | /Python_codes/p03624/s686557257.py | UTF-8 | 275 | 3.1875 | 3 | [] | no_license | alp = "abcdefghijklmnopqrstuvwxyz"
ans = [False for _ in range(26)]
S = list(input())
for i in S:
for p in range(26):
if i == alp[p]:
ans[p] = True
for i in range(26):
if ans[i] == False:
print(alp[i])
break
else:
print("None") | true |
8cd9426c2525ef50726c81496053d49cdc0fdb1d | Python | jaredasch/Softdev-Spring2019 | /16_listcomp/comps.py | UTF-8 | 1,151 | 3.40625 | 3 | [] | no_license | def passwordThreshold(password):
nums = [1 for c in password if '0' <= c <= '9']
upps = [1 for c in password if 'A' <= c <= 'Z']
lows = [1 for c in password if 'a' <= c <= 'z']
return len(upps) > 0 and len(lows) > 0 and len(nums) > 0
print("Does 'jaredasch' pass the threshold? " + str(passwordTh... | true |
9826037258a57407abfd9f8314a9c82348d6ef80 | Python | daejin-choi/spellit-server | /spellit/user.py | UTF-8 | 2,232 | 2.859375 | 3 | [] | no_license | from google.appengine.ext import db
import rsa
from .word import Word
class User(db.Model):
db_public_key = db.ByteStringProperty(name='public_key', required=True)
db_private_key = db.ByteStringProperty(name='private_key', required=True)
name = db.StringProperty(required=True)
def __init__(self, *ar... | true |
5ef89ed37c88325437ec2f0987e056e9368e3690 | Python | pranshu798/Python-programs | /Data Types/Lists/Adding elements using insert() methods.py | UTF-8 | 305 | 4.5625 | 5 | [] | no_license | #Python program to demonstrate addition of elements in a List
#Creating a List
List = [1,2,3,4]
print("Initial List: ")
print(List)
#Addition of Elements at specific Position
#(using Insert Method)
List.insert(3,12)
List.insert(0,'Pranshu')
print("\nList after performing Insert Operation: ")
print(List) | true |
9bca5eae1cea2fcd562d2850b72c9c5bf7b3f638 | Python | YorkFish/git_study | /CodingInterviews/python/46_last_remaining_2.py | UTF-8 | 764 | 3.5 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# coding:utf-8
class Solution:
def LastRemaining_Solution(self, n, m):
"""
f(n) = (f(n-1) + m) % (n-1 peoples) # n 个人的情况,获胜者的索引
n: 0, 1, ..., m-2, [m-1], m, m+1, ..., (winner), ..., n-1
n-1: m, m+1, ..., (winner), ..., n-1, 0, 1, ..., m-2
... | true |
448a3b47e4db68e8b951dc2af050daaba2168141 | Python | Celoka/challenge | /pre_process.py | UTF-8 | 14,630 | 2.890625 | 3 | [] | no_license | from collections import deque
import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler
from sklearn.experimental import enable_iterative_imputer
from sklearn.impute import IterativeImputer
from helper import *
pd.options.mode.chained_assignment = None
def main():
health_facility... | true |
44c8d9d2439ba1dd7be61608df811cb4bb840a97 | Python | stillingpb/imooc_crawler | /crawler/crawler_manager.py | UTF-8 | 1,213 | 2.875 | 3 | [] | no_license | # coding=utf-8
import url_manager
import url_downloader
import html_parser
import data_outputer
class Crawler_Main:
def __init__(self):
self.urls = url_manager.Url_Mananger()
self.downloader = url_downloader.Url_Downloader()
self.parser = html_parser.Html_Parser()
self.outputer = d... | true |
a2c75b4606a28934e4fffda56193119b2467d2a3 | Python | immrz/NewSemantic | /ClimbPit/before_reduction.py | UTF-8 | 3,780 | 2.609375 | 3 | [] | no_license | import ChineseList
from reduce_dim import read_sparse_matrix
from sklearn.metrics.pairwise import cosine_similarity
from scipy.stats import spearmanr
from functools import partial
import os
import multiprocessing as mp
from collections import defaultdict
def similarity(mat, vocab, fname):
rank = []
with open... | true |
b15f9c6d65bc789ffc6e02a8f283dc06d4facb01 | Python | Black-Eagle-1/password-retry | /password_retry.py | UTF-8 | 345 | 3.84375 | 4 | [] | no_license |
remaining_times = 3
tr_password = "12345b"
while True:
password = input("請輸入密碼: ")
if password == tr_password:
print("登入成功")
break
else:
remaining_times = remaining_times -1
if remaining_times == 0:
print("你已無法登入")
break
print("請再試一次! 你還有", remaining_times, "次機會")
| true |
5548cd8d98bfbd2397d9d07128053ca9b8b3ff09 | Python | Lakshmii3/kot | /backend/game/cards/discard_cards/multi_manipulation_cards/jet_fighters.py | UTF-8 | 413 | 3.125 | 3 | [] | no_license | from game.cards.discard_card import DiscardCard
from game.cards.card import Card
class JetFighters(DiscardCard):
def __init__(self):
Card.__init__(self, "Jet Fighters", 5, "+ 5[star] - 4[health]", "")
def immediate_effect(self, player_that_bought_the_card, other_players):
player_that_bought_t... | true |
bf13474a75d7772c3e06eafc3f658710c93d6c42 | Python | alejandroruizgtz/progAvanzada | /ejercicio52.py | UTF-8 | 649 | 4 | 4 | [] | no_license | #Exercise 52: Grade Points to Letter Grade
correcto = int(input('ngrese la cantidad de problemas que obtuvo correctamente:'))
if correcto > 0 :
print ('Entendido!')
total = int(input('Ingrese el número total de problemas en la prueba:'))
if correcto > 0 :
print ('Entendido!')
porciento = correcto / tot... | true |
26dde939814aa3453d6285c6b972e10b682dd9a9 | Python | fengzhanying/scTIM | /Package/sc_tim/PreProcess.py | UTF-8 | 790 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Oct 22 19:44:58 2018
@author: Zhanying Feng
"""
import numpy as np
def PreProcess(inputFile,logornot='y'):
f = open(inputFile,'r');
data = f.readlines(); f.close();
del data[0]
GeneSet = []
for i in range(len(data)-1,-1,-1):
data[i] = data[i].stri... | true |
33e7f9508c73755a48526f2ff0be39297d8b96f4 | Python | palayutm/paParser | /src/atcoder_parser.py | UTF-8 | 838 | 2.640625 | 3 | [] | no_license | import re
from bs4 import BeautifulSoup
class AtCoderParser:
def __init__(self):
pass
def parse(self, url, page):
content = {'url': url}
page = BeautifulSoup(page, 'lxml')
content['contest_name'] = page.find('a', attrs={'class': 'contest-title'}).text
content['file_na... | true |
1fc407ced3b74deaba3ac380eb7db3f5d7b2d5fa | Python | deeksha-punachithaya/SLlab-2019 | /ScriptingLangLab-master/assignment2.py | UTF-8 | 635 | 3.71875 | 4 | [] | no_license | class Student:
def __init__(self,name,age,marks):
self.name = name
self.age = age
self.marks = marks
def disp(self):
print("Name " + self.name)
print("Age " + str(self.age))
print("Marks ",self.marks)
def accept(self):
self.name = input('Enter name of person ')
self.age = input('Enter age ')
def lis... | true |
efe5478691ebcd6ec9e312cf4db14309288b0681 | Python | antenna-fast/dynamics | /01.spring.py | UTF-8 | 2,524 | 3.109375 | 3 | [] | no_license | # sys
import time
# 计算
import numpy as np
# 可视化
import cv2
import matplotlib.pyplot as plt
"""
框架:
利用能量守恒,
根据弹簧弹力与重力,计算实时加速度,有了速度就会产生阻力,也会影响力 初始化一个速度即可
总之,就是要计算对合力,规定好正方向
"""
if __name__ == "__main__":
print("物理仿真...")
p_max = 400 # 最大位移
img = np.zeros((p_max, 200, 3)) # h w
img[1, 1] = [1, 1, ... | true |
ae79f096e94616ba0c7fb0fac642d4b7dce58984 | Python | oscartse/MachineLearninginFX | /GA_CODE/algotrader.py | UTF-8 | 7,667 | 2.53125 | 3 | [] | no_license | from pyalgotrade import strategy
from pyalgotrade.technical import ma
from pyalgotrade.technical import rsi
from pyalgotrade.technical import macd
from pyalgotrade.technical import atr
from pyalgotrade.barfeed import csvfeed
from pyalgotrade.technical import cross
from sklearn.externals import joblib
from pyalgotrade.t... | true |
384a09f9a2cfe46c278bfcb45ee534d03f63b2c2 | Python | QuickLearner171998/Competitive-Programming | /Leetcode/MUST DO MED/763. Partition Labels.py | UTF-8 | 385 | 2.84375 | 3 | [] | no_license | class Solution:
def partitionLabels(self, S: str) -> List[int]:
last_occ = {s:i for i, s in enumerate(S)}
ans = []
partition = 0
l = 0
for i in range(len(S)):
partition = max(partition, last_occ[S[i]])
l+=1
if i == partition:
... | true |
ca57ef92ff5fc0bb7d2b60e3ebd22aa524fa2dba | Python | rafaelperazzo/programacao-web | /moodledata/vpl_data/101/usersdata/160/49663/submittedfiles/av1_m3.py | UTF-8 | 181 | 3.15625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import math
m=int(input('Digite a quantidade de termos:'))
i=1
soma=0
denominador=0
while i<=m:
if i%2==1:
soma=soma+
print('%.6f'%soma)
| true |
f0a4aff56746251a9881ea86804c685f5e439071 | Python | smalltide/learning_python3 | /C8Script2.py | UTF-8 | 1,433 | 3.75 | 4 | [] | no_license | import random, string
vowels = 'aeiouy'
consonants = 'bcdfghjklmnpqrstvwxz'
letters = string.ascii_lowercase
lecture_input_1 = input("What letter do you want? Enter 'v' for vowels, 'c' for consonants, 'l' for any letter: ")
lecture_input_2 = input("What letter do you want? Enter 'v' for vowels, 'c' for consonants, 'l... | true |
a3f24764782747a93d71e18e615b2622eb692529 | Python | jerahmie/voxelmod | /examples/run_voxelmod.py | UTF-8 | 3,035 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env python
"""
Test voxelmod
"""
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import sys, os.path, ntpath
import re
import voxelmod
import matplotlib.pyplot as plt
def isDuke(fileName):
"""
Determines if we the model used is Duke.
... | true |
eb7e7a797db9c3d0a95410fc72c54aeb9d2d69e2 | Python | Soohee410/Algorithm-in-Python | /BOJ/Silver/1780.py | UTF-8 | 1,372 | 3.390625 | 3 | [] | no_license | # Solution1
# 373800KB / 3988ms
from itertools import product
from collections import Counter
def TripleTree(n, arr, x, y):
if n == 1:
return arr[x][y]
n = n//3
cp = [0] * 9
for k,i in enumerate(list(product([0,1,2], repeat=2))):
cp[k] = TripleTree(n, arr, x+n*i[0], y+n*i[1])
if le... | true |
0fb3db360a88c5ef77c59245e51a8a5cd4906b9b | Python | FZJ-IEK3-VSA/tsam | /tsam/representations.py | UTF-8 | 6,966 | 2.78125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import numpy as np
from sklearn.metrics.pairwise import euclidean_distances
from tsam.utils.durationRepresentation import durationRepresentation
def representations(
candidates,
clusterOrder,
default,
representationMethod=None,
representationDict=None,
distributionPeri... | true |
abf85670e9d165adc8be61127f56f4e14be88a18 | Python | Christian2702/werservice | /py/werreport/test_werreader.py | UTF-8 | 488 | 2.578125 | 3 | [] | no_license | import unittest
from werreader import werreader
class Testwerreader(unittest.TestCase):
def test_Object_create(self):
try:
a = werreader()
except:
self.fail("Konnte Objekt nicht erstellen.")
def test_werreader_read(self):
a = werreader()
try:
... | true |
d68690adc9a21c31c4b9aeb2775b36e6a1519d1a | Python | karmel/glasslab | /glasslab/dataanalysis/mlnumpy/reduction.py | UTF-8 | 973 | 3.171875 | 3 | [] | no_license | '''
Created on Jun 10, 2011
@author: karmel
'''
from time import time
from scikits.learn.decomposition.pca import RandomizedPCA
class GlassPCA(object):
'''
Reduce dimensionality of passed data set to speed up any subsequent
classification or regression.
'''
pca = None
number = 2
def get_pca... | true |
6668f4ccdbc33e0d21da34d24f577fd9d09f75a7 | Python | ke0m/scaas | /oway/imagechunkr.py | UTF-8 | 9,212 | 2.671875 | 3 | [] | no_license | """
Chunks imaging inputs and parameters
for distribution across multiple machines
@author: Joseph Jennings
@version: 2020.08.18
"""
import numpy as np
from oway.utils import fft1, interp_vel
from server.utils import splitnum
class imagechunkr:
def __init__(self,nchnks,
nx,dx,ny,dy,nz,dz,
... | true |
8ecfdc46970ed88c921cbbc2913b4e9d46f9ec6d | Python | VadimGrishin/python1 | /hw04_hard.py | UTF-8 | 3,259 | 3.625 | 4 | [] | no_license | # Задание-1:
# Матрицы в питоне реализуются в виде вложенных списков:
# Пример. Дано:
matrix = [[1, 0, 8],
[3, 4, 1],
[0, 4, 2]]
# Выполнить поворот (транспонирование) матрицы
# Пример. Результат:
# matrix_rotate = [[1, 3, 0],
# [0, 4, 4],
# [8, 1, 2]]
# Суть сло... | true |
94f965b2a9f104735a1f8858d38c334f51655a61 | Python | palomaYPR/OOP-and-Algorithms-with-Python | /alg_busqueda_ordenacion/bubblesort.py | UTF-8 | 472 | 3.78125 | 4 | [] | no_license | import random
def bubblesort(lista):
n = len(lista)
for i in range(n):
for j in range(0, n - i - 1):
if lista[j] > lista[j + 1]:
lista[j], lista[j + 1] = lista[j + 1], lista[j]
return lista
def run():
tam = int(input('Tamaño de la lista: '))
lista = [random... | true |
2704ab77b7a2b0791e07a2b5ba55ada61c668fe9 | Python | JPL13/Statistical-Programming | /HW7/HW7_XGBoost.py | UTF-8 | 4,763 | 3.09375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Stat 202A 2019 Fall - Homework 07
Author:
Date :
INSTRUCTIONS: Please fill in the corresponding function. Do not change function names,
function inputs or outputs. Do not write anything outside the function.
"""
import numpy as np
from sklearn.datasets import load_b... | true |
3645cdb6fa3264260637b977df2fef1cfad3518c | Python | marcosvlt/Python | /Algorithms/MsToKmH.py | UTF-8 | 182 | 3.625 | 4 | [
"Apache-2.0"
] | permissive | """
Meters per seconds to Kilometres per hour
K = M * 3.6
"""
M = float(input(f'Please insert the Metre per seconds (m/h)\n'))
K = M * 3.6
print(f'{M} m/s is {round(K, 2)} Km/h')
| true |
55239c52a265cbd2730ff106c298b50a0c8450d3 | Python | j12138/Pokemon-Know | /source/DB_Proc.py | UTF-8 | 674 | 2.578125 | 3 | [] | no_license | import os, sys, json
class DB_Proc :
def __init__(self) :
return
def create_empty(self, url) :
f = open(url, 'w')
f.write('{}')
f.close()
return
def add_attr(self, name, attr, val, p) :
url = '../data/' + name + '.json'
if not os.path.exists(url) :
self.create_empty(url)
f = open(url, 'r')
... | true |
438fbd59f59843a163a5bd36e0405f81246a76b8 | Python | skysunwei/pyworks | /readLog/keep/liucun.py | UTF-8 | 4,245 | 2.671875 | 3 | [] | no_license | # coding: utf-8
import csv
# source_files = ['buyer',
# 'buyer_tel',
# 'buyer_saler_841',
# 'buyer_saler_237',
# 'buyer_saler_typical',
# 'buyer_tel_saler_typical']
def month_to_year_str_format(i):
start_year_num = 2016
month_of... | true |
aa1be06602b90eef139c13bfc6cbd5f135a10269 | Python | ticcky/nn_intro | /utils.py | UTF-8 | 1,089 | 2.65625 | 3 | [] | no_license | import matplotlib.pyplot as plt
import seaborn
seaborn.set()
def vis2d(data):
y = data[:, 0]
x1 = data[:, 1]
x2 = data[:, 2]
plt.plot(x1[y == 0], x2[y == 0], 'o', label='Class 0', markersize=3, color='red')
plt.plot(x1[y == 1], x2[y == 1], 'o', label='Class 1', markersize=3, color='green')
pl... | true |
03956a8e423df8c2458b5294d1ee58dd5f93793d | Python | matteocannaviccio/ner-dl | /nerdl/evaluation/entity/evaluation_entities_files.py | UTF-8 | 5,511 | 2.609375 | 3 | [] | no_license | from __future__ import division
from settings import settings
class EvaluatorEntitiesFiles:
def __init__(self, sentence_iterator_correct, sentence_iterator_predict, correct_s2e, predict_s2e):
self.class_list = settings.EVALUATION_CLASS_LIST
self.si_correct = sentence_iterator_correct
sel... | true |
39a0c598dd7f173cf1fe00f312f942bb41649a39 | Python | takanory/slides | /slides/20170921hikalab/unittest/test_fizzbuzz.py | UTF-8 | 451 | 3.234375 | 3 | [
"MIT"
] | permissive | import unittest
from fizzbuzz_ng import fizzbuzz
class TestFizzbuzz(unittest.TestCase):
def test_num(self): # 普通の数字を返す
self.assertEqual(fizzbuzz(7), '7')
def test_fizz(self): # 3の倍数
self.assertEqual(fizzbuzz(99), 'Fizz')
def test_buzz(self): # 5の倍数
self.assertEqual(fizzbuzz(25), ... | true |
33f202460f023bd998e0327ad9efe320c3ac1b15 | Python | wan-catherine/Leetcode | /problems/N1456_Maximum_Number_Of_Vowels_In_A_Substring_Of_Given_Length.py | UTF-8 | 629 | 3.359375 | 3 | [] | no_license | class Solution(object):
def maxVowels(self, s, k):
"""
:type s: str
:type k: int
:rtype: int
"""
length = len(s)
start, end = 0, 0
res = 0
temp = 0
vowel = 'aeiou'
while end < length:
if s[end] in vowel:
... | true |
70d798d772554792c5e807b42d05765205147b10 | Python | tonytan4ever/db-admin-scripts | /ssl_scripts/get_san_dns.py | UTF-8 | 1,831 | 2.828125 | 3 | [] | no_license | import ssl
import sys
from OpenSSL import crypto
# Python 3 does not have ssl.PROTOCOL_SSLv2
try: # pragma: no cover
extra_versions = [ssl.PROTOCOL_SSLv2] # pragma: no cover
except AttributeError: # pragma: no cover
extra_versions = [ssl.PROTOCOL_T... | true |
b78d24b20a73020998b314a7fa0beea382c0f24d | Python | SoDAVi/twitter | /Analysis/combined.py | UTF-8 | 6,250 | 2.96875 | 3 | [] | no_license | #!/usr/bin/python
import os.path
from collections import Counter
import nltk
import ast
from datetime import datetime
import tzlocal
import pandas as pd
import csv
import sys
import json
from nltk.sentiment.vader import SentimentIntensityAnalyzer
def main():
filePath = sys.argv[1] # Takes filePath(Initial CSV) as an... | true |
a5dd87317d9157bb0aa09a78302705552a68ea7d | Python | gistable/gistable | /all-gists/ee765f0abc8f1de6934c/snippet.py | UTF-8 | 2,614 | 2.6875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""Small app to read nrf uart RX port"""
#sudo gatttool -b F3:5F:71:83:EE:2D -t random --char-write-req -a 0x000c -n 0100 --listen
import subprocess
import time
import sys
import signal
import os
import re
from ctypes.util import find_library
from datetime import datetime
class BleUartScanner:... | true |