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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
caad3fa7da38aa9bcc752eb320380ff56c15f7a9 | Python | hsinhoyeh/leecode | /kth-largest-element-in-an-array/solution.py | UTF-8 | 1,184 | 3.59375 | 4 | [] | no_license | class Solution(object):
def findKthLargest(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: int
"""
return self.find_k_th(nums, k)
def find_k_th(self, nums, k):
if len(nums) ==1:
return nums[0]
pivot = nums[-1] # use the... | true |
bbd82c13f1e7c81d1b0435b5ee32ec63ee0dcfbc | Python | tiffany70072/explainable-Seq2Seq | /src_March/utils.py | UTF-8 | 16,931 | 2.515625 | 3 | [] | no_license | import numpy as np
import tensorflow as tf
import keras.backend as K
import read_data
def write_results(results, output_file):
print('output filename =', output_file)
fout = open(output_file, 'w')
for i in range(len(results)):
fout.write(" ".join(results[i]))
fout.write("\n")
def masked_perplexity_loss(y_true... | true |
2ff777dcb8aef3600fb431e2a80b725b6f45eebc | Python | bpRsh/a4b_jedicolor_args | /myranges.py | UTF-8 | 537 | 2.828125 | 3 | [] | no_license | #!/usr/local/bin/env python3
# -*- coding: utf-8 -*-
#
# Author : Bhishan Poudel, Physics PhD Student, Ohio University
# Date : Jul 06, 2017 Thu
# Last update :
def main():
"""Main Module."""
# Imports
import numpy as np
import pandas as pd
import time
laml = np.linspace(2208,2764... | true |
e8434ddf36c7f479880eeb924591bff6a4d5b59c | Python | HDree/Python | /Stock price Predict.py | UTF-8 | 1,176 | 2.828125 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from google.colab import files
uploaded = files.upload()
#read the file
df = pd.read_csv('A2M.AX1.csv')
df = df.set_index(pd.DatetimeIndex(df['Date'].values))
#print the head
df
def EMA(data, period=20, column='Close'):
return data[column].ewm(... | true |
08336363fd81dfedb247a43ac0da0a3cbb589f8f | Python | Malikanhar/Pose-Detection | /src/run_webcam.py | UTF-8 | 4,525 | 2.515625 | 3 | [
"MIT"
] | permissive | import argparse
import logging
import time
from keras.models import load_model
from keras.layers import Activation
import cv2
import numpy as np
from estimator import TfPoseEstimator
from networks import get_graph_path, model_wh
logger = logging.getLogger('TfPoseEstimator-WebCam')
logger.setLevel(logging.DEBUG)
ch ... | true |
122caeb6cb85e6e5dc7b91eb83f5981a068b9b23 | Python | csadrian/wae | /utils.py | UTF-8 | 2,333 | 2.703125 | 3 | [
"BSD-3-Clause"
] | permissive | # Copyright 2017 Max Planck Society
# Distributed under the BSD-3 Software license,
# (See accompanying file ./LICENSE.txt or copy at
# https://opensource.org/licenses/BSD-3-Clause)
"""Various utilities.
"""
import tensorflow as tf
import os
import sys
import copy
import numpy as np
import logging
import matplotlib
m... | true |
8e9fe85c2ed5ac61190dba74e2c92d9dd9c1d0e5 | Python | rmlz/cqw2calibtool | /cqw2_calibrate/epiphyton_rates_constants.py | UTF-8 | 6,810 | 2.5625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Thu Sep 5 16:30:52 2019
@author: Ramon Barros
CE-QUAL-W2 Calibration Tool v0.0.1
MODEL EPIPHYTON GROUPS RATES & CONSTANTS
paramcontrol(name, calibrate, value, low, high, guess)
name = Parameter or setting name,
calibrate = boolean, True if the parameter must be calibrated (val... | true |
ac720d5c61ecaa14f0ce41d0128c46a64684853b | Python | codinghappiness-web/python-project | /dice game.py | UTF-8 | 264 | 3.640625 | 4 | [] | no_license | import random
min = 1
max = 6
roll_again = "y"
while roll_again is "y":
print("rolling the dices...")
print("the values are")
print(random.randint(min,max))
print(random.randint(1,6))
roll_again = input("roll the dices again? ")
| true |
50cd81f1741f6ee1e5ac520e89547f9317ed236c | Python | pochtalexa/netology_home_works | /data_fomats/data_formats.py | UTF-8 | 2,301 | 3.1875 | 3 | [] | no_license | import json
import jmespath
import pandas as pd
import xml.etree.ElementTree as ET
from pprint import pprint
# -------------------------------------------------------------------------------------------------------
def read_json(file_name):
with open(file_name, encoding='utf-8') as f:
data = json.load(f)... | true |
471d6c40a29b8c42f369aac1925dd78d1861e366 | Python | LifeBringer/LinearAlgebra | /line.py | UTF-8 | 4,935 | 3.234375 | 3 | [
"MIT"
] | permissive | from decimal import Decimal, getcontext
from vector import Vector
getcontext().prec = 30
class Line(object):
NO_NONZERO_ELTS_FOUND_MSG = 'No nonzero elements found'
def __init__(self, normal_vector=None, constant_term=None):
self.dimension = 2
if not normal_vector:
... | true |
c6f242972e92a8e144c472c2d312d36b1b31fa6b | Python | irfan87/python_tutorial | /dictionaries/favorite_languages.py | UTF-8 | 1,694 | 3.328125 | 3 | [] | no_license | favorite_languages = {
'jen': 'python',
'edward': 'ruby',
'phil': 'python',
'sarah': 'c',
'jamal': 'java',
'james': 'java',
'hassan': 'php'
}
print("\nProgrammer with their favorite language polls")
for programmer_name, favorite_language in favorite_languages.items():
if favorite_langua... | true |
d683175e48af3c3706acb8845ba97d979488bdc2 | Python | cloudtrends/harrychinese | /python/DbRowFactory/pyDbRowFactory.py | UTF-8 | 8,690 | 2.796875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
'''
#@summary: DbRowFactory is one common row factory for any database
module conformed to Python Database API Specification
v2.0. e.g. cx_Oracle, zxJDBC
#@note: DbRowFactory will create one row instance based on row class binding,
and try to assign all fie... | true |
9c7d45f954ac8edfeaff633435564b713afffc19 | Python | yuwtsri/tcga-script | /Plot/KM_plot.py | UTF-8 | 1,631 | 2.90625 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#import seaborn as sns
from lifelines import KaplanMeierFitter
file = "X:\\Su Lab\\TCGA\\Data\\Matrix\\TCGA-BRCA-total-matrix.csv"
matrix = pd.read_csv(file, sep = '\t')
def is_number(s):
if pd.isnull(s):
return False
else:
try:... | true |
65bd101ce1315d1b8f768fdae0603767cf62ad39 | Python | arnold8968/lab1 | /Project1/Code/NYC_Parking/Question_d/mapper.py | UTF-8 | 716 | 2.921875 | 3 | [] | no_license | #!/usr/bin/python
# --*-- coding:utf-8 --*--
import re
import sys
for line in sys.stdin:
valueString = str(line) # input comes from STDIN(Standard input)
SingleParkingData = valueString.split(',') # split csv document into different columns
if len(SingleParkingData[34]) > 0: # cleaning the empty co... | true |
f5cfecee1481ce28ec64ef626a5282c9ff5a2fb6 | Python | a3r0d7n4m1k/YACS | /courses/encoder.py | UTF-8 | 5,531 | 2.53125 | 3 | [
"MIT"
] | permissive | """ Handles the encoding of model objects for templates.
"""
from django.db.models import Model
from courses import models
def get_fields(model):
return model._meta.fields
def get_fk_fields(model):
return [f for f in get_fields(model) if f.rel]
def get_normal_fields(model):
return [f for f in get_fie... | true |
0923f6d9b46b9d358584edbdc32bc7d2ccea0b25 | Python | ttund21/LearningPython | /Extras/Faculdade/Prova/questao2.py | UTF-8 | 711 | 3.703125 | 4 | [] | no_license | def notaAbaixo(notas):
reg = []
for i in notas:
if i < 7:
reg.append(str(i))
print(f"\nNotas Abaixo de 7: {' ,'.join(reg)}")
def parImpar(notas):
impar = []
par = []
for i in notas:
if i%2 == 0:
par.append(str(i))
else:
impar.append(st... | true |
8a9b430f031c001168b9642ef511d74efcca5840 | Python | TheCyberAtom/LeetCode_Python | /How Many Numbers Are Smaller Than the Current Number.py | UTF-8 | 305 | 3.046875 | 3 | [] | no_license | class Solution:
def smallerNumbersThanCurrent(self, nums: List[int]) -> List[int]:
lst = sorted(nums)
res = []
for i in nums:
for j in range(len(lst)):
if i == lst[j]:
res.append(j)
break
return res
| true |
8417a9c14e62f54bfb5336eb132084eec5b38da5 | Python | HSIYJND/Hyperspectral-Image-Learning | /HSI Classification/Using SOM/SOM_v1.py | UTF-8 | 1,719 | 2.625 | 3 | [] | no_license | #Import the library
import SimpSOM as sps
import os
from spectral import *
import scipy.io as sio
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
script_dir = os.path.dirname(__file__) #<-- absolute dir the script is in
rel_path = "data/92AV3C.lan"
abs_file_path = os.path.join(sc... | true |
b1d11cddd9daa50dc768516446a56d4a9d5b1307 | Python | Kungbib/ocrqc | /ocrqtapp.py | UTF-8 | 1,729 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
from __future__ import print_function
from flask import Flask, request, session, g, redirect, url_for, abort, render_template, flash
import editdistance
import diff_match_patch as dmp_module
app = Flask(__name__)
app.config.from_object(__name__)
@app.route("/", methods=['POST', 'GET'])
def in... | true |
308fe8b2cea8d964b4e418b48b1f0e5d4c2c3406 | Python | a87150/learnpy | /coroutine_selectors.py | UTF-8 | 1,475 | 2.796875 | 3 | [] | no_license | import socket
import sys
import time
from selectors import DefaultSelector, EVENT_READ, EVENT_WRITE
sel = DefaultSelector()
times = 10
class Furture():
def __init__(self):
self.coro = None
def add_coro(self, coro):
self.coro = coro
def resume(self):
global times
try:
... | true |
ec551fbfad0269d4ac59940bec9d35ea401e3505 | Python | rafaelaraujobsb/URI-CodeForces | /Python/round3B.py | UTF-8 | 215 | 3.703125 | 4 | [] | no_license | while True:
n = int(input())
if n == 0:
break
i=1
p=1
for t in range(1,n+1):
if t == 1:
print("1", end="")
i += 2
p += i
if p > n:
break
else:
print(" {}".format(p), end="")
print("")
| true |
685d117dcc5fe65cf8128f6615e3e4677e57ee46 | Python | OnyiegoAyub/SENDIT-API | /app/api/v1/models/parcel_order_models.py | UTF-8 | 949 | 2.90625 | 3 | [] | no_license | class Parcel:
parcels = []
users = []
def create(self, origin, destination, weight, status):
parcel = {
"parcel_id": len(Parcel.parcels) + 1,
"user_id": len(Parcel.parcels) + 1,
"origin": origin,
"destination": destination,
"weight": weight,
"status": s... | true |
c40b0b751294a4e1f99ad1a8018bc5ec9f91a001 | Python | ravisrhyme/CTCI | /chapter9/staircase.py | UTF-8 | 628 | 3.90625 | 4 | [] | no_license | """
A child is running up in a staircase with n steps, and can hop either 1 step,
2steps or 3 steps at a time. Implement a method to count how many possible ways
the child can run up the stairs
Time Complexity = O(n)
space Complexity = O(n)
"""
__author__ = "Ravi Kiran Chadalawada"
__email__ = "rchadala@usc.edu"
... | true |
9cd94eaa5e7b48b9ab6da9476fa85d92efac4b95 | Python | danpianji/python3.7 | /lgp/highlevel/8JSON.py | UTF-8 | 895 | 4 | 4 | [] | no_license | # -*- coding: UTF-8 -*-
import json
print "你好"
"""
json.dumps 将 Python 对象编码成 JSON 字符串
json.loads 将已编码的 JSON 字符串解码为 Python 对象
python 原始类型向 json 类型的转化对照表:
Python JSON
dict object
list, tuple array
str, unicode string
int, long, float number
True true
False false
None null
json 类型转换到 python 的类型对照表:
JSON Pyt... | true |
cd4f21aecc1e84f63d4d05b1b8df7ac74f7a0285 | Python | vegadodo/project-euler-python | /p001.py | UTF-8 | 293 | 4.03125 | 4 | [
"MIT"
] | permissive | """
Problem 1.
Multiples of 3 and 5
https://projecteuler.net/problem=1
"""
# Pretty self-exlanatory code.
# Check if given number is dividable by 3 or 5.
# Rinse and repeat for 1 to 1000.
answer = 0
for i in range(1000):
if i % 3 == 0 or i % 5 == 0:
answer += i
print(answer)
| true |
bb41fc74c02f92080ace7b1ec9c81783b7e94c8d | Python | jinglinzhao/Python_codes | /0404-ksiboo/Calendar-BJD.py | UTF-8 | 327 | 2.546875 | 3 | [] | no_license | # run with python2.7
import numpy as np
from DateTime import DateTime
Date = np.genfromtxt('ksiboo_date_sqrt_p.dat', dtype = None)
Date_new = [ Date[i][0] + ' ' + Date[i][1] for i in range(len(Date))]
BJD = [DateTime(Date_new[i]).timeTime()/(24.*3600) for i in range(len(Date))]
np.savetxt('ksiboo_BJD_sqrt_p.dat... | true |
c0a9c198ca1ed20a4e61919b81bac10327b7a6ea | Python | suvoganguli/DeepLearning | /Part6_ReinforcedLearning/Project-Quadcopter/2018-07-06/main.py | UTF-8 | 2,521 | 2.828125 | 3 | [] | no_license | import numpy as np
import agents.agent as agent
from task import Task
import matplotlib.pyplot as plt
import sys
# Task: take-off and hover
init_pose = [0.0, 0.0, 100.0, 0.0, 0.0, 0.0]
init_velocities = [0.0, 0.0, 0.0]
init_angle_velocities = [0.0, 0.0, 0.0]
run_time = 10
target_pos = [0.0, 0.0, 100.0]
num_episodes =... | true |
da15e3c94c211fc6b6e3c28072f02008b952a74c | Python | jlinkemeyer/MLinPractice | /code/preprocessing/stemmer.py | UTF-8 | 1,426 | 3.40625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Create the word stems of the individual words of the tweet.
Created on Wed Oct 6 16:32:45 2021
@author: laura
"""
from code.preprocessing.preprocessor import Preprocessor
from code.util import TOKEN_DELIMITER
from nltk.stem import PorterStemmer
class Stemmer(Prepr... | true |
0663695a4af4d05cbd49542519b7569da069a22d | Python | spotty-cloud/spotty | /spotty/providers/aws/resources/snapshot.py | UTF-8 | 1,585 | 2.6875 | 3 | [
"MIT"
] | permissive | import time
class Snapshot(object):
def __init__(self, ec2, snapshot_info):
self._ec2 = ec2
self._snapshot_info = snapshot_info
@staticmethod
def get_by_name(ec2, snapshot_name: str):
"""Returns a snapshot by its name."""
res = ec2.describe_snapshots(Filters=[
... | true |
34a05755ce62d5ef71570834f02779b7aef16601 | Python | slopezv2/CompetitiveProgramming | /talkingp.py | UTF-8 | 231 | 3.328125 | 3 | [] | no_license | vowels = ["a", "e", "i", "o", "u"]
cases = int(input())
phrases = []
newPhrases = []
for i in range(cases):
phrases.append(input())
for p in phrases:
for v in vowels:
p = p.replace(v, v + "p" + v)
print(p)
| true |
56de67e1446f4c8da009ef12aa9920555da41c0f | Python | jlandy99/TrafficSignClassification | /run.py | UTF-8 | 1,582 | 2.8125 | 3 | [] | no_license | from preprocess import preprocess, rebalance
from Net import Net, printModel
from TrafficSignDataset import TrafficSignDataset, dataLoader
from train import train_model
from plot import plot
import torch
from helper import cal_accuracy
# Use this function if using GPU to run code
def setupGPU():
"""Make sure we ... | true |
f246b6e69e7e3455011f0dbb669c2b86cdc2cfdb | Python | TillSchlemmermeier/l3d-controller-software | /generators/g_cube.py | UTF-8 | 1,453 | 3.0625 | 3 | [] | no_license | # modules
import numpy as np
class g_cube():
'''
Generator: cube
a cube in the cube
Parameters:
- size
- sides y/n : just the edges or also the sides of the cube?
'''
def __init__(self):
self.size = 4
self.sides = False
def control(self, size, sides, blub1):
... | true |
49d70733fbd6a4e45768cbf7fee8cec3b4bf6762 | Python | greyshell/ds_algorithm | /heap/k_largest_elements_array.py | UTF-8 | 667 | 3.59375 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# author: greyshell
from snowowl import Heap, HeapType
def get_k_largest_elements_array(array: list, k: int) -> list:
"""
time complexity: O(n*log(k))
space complexity: O(k)
"""
min_heap = Heap([])
for num in array:
min_heap.insert(num)
if len(min_heap... | true |
c060ea614666b3ffeeddaa5eb880c0c6a7e90642 | Python | Kunal352000/python_adv | /21_datatime1.py | UTF-8 | 110 | 2.71875 | 3 | [] | no_license | import datetime
x=datetime.datetime.now()
print(x)
"""
output:
-------
2021-07-21 16:53:56.507188
"""
| true |
cec6a0575b81086a708af27e4c7bac6b6f9878c7 | Python | ecwolf/Programming | /Python/MSoumen_reverse.py | UTF-8 | 283 | 3.796875 | 4 | [] | no_license | from func import get_digits
def reverse(num:int):
s=""
for i in map(str, get_digits(num)):
s += i
return int(s)
# Main Starts from here
a_number = int(input("Enter Your Number : "))
print("Reversed :", reverse(a_number))
print("Happy Programming.") | true |
497a4c2a676f38d3010bebb4bdcc4588efb3da93 | Python | slyt/KitChat | /kitchat_client.py | UTF-8 | 5,952 | 2.578125 | 3 | [] | no_license | # KitChat client
import socket
import sys
import select
import time
try:
import pygame
except ImportError:
print "\n\n-------------------------------------------------------------------"
print 'For sounds, please install pygame with "sudo apt-get install python-pygame"'
print "if you\'re Kit and love... | true |
a960a3a8d9e7afea6fcfdbd0e0d1c72bb72d7395 | Python | skypanther/robovision | /tests/test_robovision.py | UTF-8 | 1,494 | 2.734375 | 3 | [
"MIT"
] | permissive | """
pylint tests, run from main robovision directory with `pytest`
"""
import cv2
import numpy as np
import sys
from os import path
from unittest.mock import MagicMock
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
from robovision import robovision as rv
kitten = cv2.imread('tests/kitten.jpg')
h, ... | true |
0f9e669a1a84869711a8043f888dea444445f3cd | Python | artemetr-study/iut-cs | /lab-1/socket/server.py | UTF-8 | 961 | 2.703125 | 3 | [] | no_license | import re
import socket
HOST = '127.0.0.1'
PORT = 65432
if __name__ == '__main__':
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.bind((HOST, PORT))
s.listen(1)
while True:
conn, addr = s.accept()
with conn:
while True:
... | true |
df394e2acf07b931b5eb590285f6b399f22a05b7 | Python | h4m24/vault-download-cert | /run.py | UTF-8 | 5,997 | 2.515625 | 3 | [] | no_license | import argparse
import os
import logging
import hvac
import requests
import datetime
def vault_is_up(address, cafile):
logging.info("checking Health of vault: " + address)
vault_url = address + "/v1/sys/health"
try:
status = requests.get(vault_url, verify=cafile)
except Exception as e:
... | true |
5428744be13b8532294cb973fe3af0ec7c73fd9c | Python | Frank3000fr/FOA | /FOA.py | UTF-8 | 141 | 3.09375 | 3 | [] | no_license |
name = input('請輸入姓名: ')
print('Hi', name)
print('Hi', name)
print('Hi', name)
print('Hi', name)
| true |
686d9de4362f306f284fac005586bcfec261ad26 | Python | lyse0000/Leecode2021 | /62.63.64.980. Unique Paths I II III.py | UTF-8 | 3,207 | 3.34375 | 3 | [] | no_license | # 62. Unique Paths
class Solution:
def uniquePaths(self, m: int, n: int) -> int:
dp = [1]*n
for i in range(1, m):
for j in range(1, n):
dp[j] += dp[j-1]
return dp[n-1]
# ===================================================================================... | true |
2378afae87cd75657a78dc1d9c193fe9d31203cc | Python | ricoping/keras | /neural.py | UTF-8 | 3,010 | 2.78125 | 3 | [] | no_license | import numpy as np
from keras import models
from keras import layers
import matplotlib.pyplot as plt
from keras.datasets import reuters
from keras.utils.np_utils import to_categorical
class Neural():
def __init__(self, epochs=20, batch_size=512, verbose=1, validation_size=1000):
self.epochs = epochs
s... | true |
3c351a5edee7acdd99fb7926bac6af63bb8cdd59 | Python | 98mcveigh/Mc_Labor_RD | /McLaborScraper/Excel.py | UTF-8 | 3,367 | 2.78125 | 3 | [] | no_license | import xlsxwriter
import McLaborScraper.Scraper as Scraper
import time
from datetime import date
def formatNewWorkbook(workbook,worksheet,query):
sheet = {"workbook":workbook,"worksheet":worksheet,"badSites":[],"index":3,"statusIndex":1,
"dateCol":0,"compNameCol":1,"locCol":2,"townCol":3,"stateCol":4,"zipCol":... | true |
0ad7b98c455d8205178587951ac3729ec3cfd3e8 | Python | hoangphand/UU691-Project | /clustering/clustering_product_categories_find_best_k.py | UTF-8 | 4,749 | 2.59375 | 3 | [] | no_license | from __future__ import print_function
from __future__ import division
import sys
from pyspark.sql import Row
from pyspark.sql import SparkSession
from pyspark.sql.functions import udf
import random
import copy
import math
# from random import *
random_seed = 1992
# random_seed = randint(1, 10000)
random.seed(random_se... | true |
1b4a9ef66d623b73ce332660c6cb27f97ebc7176 | Python | jfmam/algorithm | /taeho/baekjoon/python/1920.py | UTF-8 | 373 | 2.59375 | 3 | [] | no_license | # N, arr1, M, arr2 = (int(input()), input().split(), int(input()), input().split())
# arr1 = set(arr1)
# for i in arr2:
# if i in arr1:
# print(1)
# else:
# print(0)
N, arr1, M, arr2 = (int(input()), {i: 1 for i in map(int, input().split())}, int(input()), input().split())
for i in l... | true |
003a31990921313fdbeb97e91f42783287638265 | Python | heonmono/JustDoIT | /Programming/Algorithm/FastCampus/Recursive Call.py | UTF-8 | 1,773 | 4.125 | 4 | [] | no_license | # 재귀 호출
''' 고급 정렬에서 사용하므로, 미리 익히기
1. 재귀 용법 - 함소 안에서 동일 함수 호출, 익해져야함
2. 재귀 용법 이해'''
# 예제 1. factorial
a = 5
def factorial(n) :
if n == 1 :
return 1
return n * factorial(n-1)
def factorial(num) :
if num > 1 :
return num * factorial(num-1)
else :
return num
fa... | true |
6d390ec433e7fdd38a149df6ce8c3283da16e1d1 | Python | APietrzak99/IT_412_apietrza | /week1assignments/week1modularizingassignment/classesassignment/classes/person.py | UTF-8 | 332 | 2.71875 | 3 | [] | no_license | college_records = []
class Person():
"""a simple class meant to represent a person"""
def __init__(self,passed_id,passed_name,passed_email):
"""initialize name, email, id variables and attributes """
self.passed_id = passed_id
self.passed_name = passed_name
self.passed_email = p... | true |
f4e4734032b47bf51927f7f9ef6b92538b9ce3a4 | Python | lauren0914/baekjoon | /국영수.py | UTF-8 | 427 | 3.65625 | 4 | [] | no_license | '''
1. 국어 점수 내림차순
2. 영어 점수 오름차순
3. 수학 점수 내림차순
4. 이름 오름차순
'''
import sys
N = int(sys.stdin.readline())
score = []
for _ in range(N):
name, kor, eng, math = map(str, sys.stdin.readline().split())
score.append([name, int(kor), int(eng), int(math)])
score.sort(key=lambda x: (-x[1], x[2], -x[3], x[0]))
# x[1]이 같다면... | true |
d47872709cf1418026bb4adac47cff62b28ffcd3 | Python | zgcgreat/2017-cvr-tencent | /2017-cvr-tencent-final/src/data_analysis/test_analysis.py | UTF-8 | 993 | 2.78125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
data_path = '../../data/'
out_path = '../../output/data_analysis/'
cnt = []
for i in range(24):
cnt.append(0)
fi_te = open(data_path + 'test.csv', 'r')
next(fi_te)
for line in fi_te:
s = line.replace('\n', '').split(',')
label = s[0]
date = int(s[1]... | true |
31d09a3b4450aaefe92460a9ca0fa8684acdc6c5 | Python | oknashar/interview-preparation | /top75LeetCode/Arrays/53.maxSubArray.py | UTF-8 | 1,053 | 3.609375 | 4 | [] | no_license | '''
Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.
Example:
Input: [-2,1,-3,4,-1,2,1,-5,4],
Output: 6
Explanation: [4,-1,2,1] has the largest sum = 6.
Follow up:
If you have figured out the O(n) solution, try coding a... | true |
737a1185d9a8a7a6fab54c08be211da0fab4bb84 | Python | xingjiepan/ss_generator | /ss_generator/BetaSheetSkeleton.py | UTF-8 | 13,131 | 2.984375 | 3 | [
"BSD-3-Clause"
] | permissive | import numpy as np
from . import geometry
from . import basic
from . import beta_sheet
def f_equal(f1, f2, cut_off=0.001):
'''Return true if two float values are equal.'''
return np.absolute(f1 - f2) < cut_off
def angle_2d(p1, p2, p3):
'''Return the angle rotating the vector p2p1 to p2p3.
The points... | true |
779755631289b77d8b3e9671501b378fefdbb8b0 | Python | aravindsairam/PolishCoinDetection | /main.py | UTF-8 | 6,585 | 3.015625 | 3 | [] | no_license | """
Importing all necessary packages
"""
import os
import cv2
import glob
import argparse
import numpy as np
import tensorflow as tf
from sklearn.model_selection import train_test_split
from data_processing import preprocess, mask_image, hist_eq, edge
def load_data(img, size):
"""
Return the image in grayscal... | true |
ec0b3c8bb65ecb205e104be302676e88418ceb17 | Python | KosteRico/fractal-analysis-labs | /lab1/main.py | UTF-8 | 1,048 | 2.5625 | 3 | [] | no_license | from os import listdir
import cv2
import numpy as np
from skimage.filters import threshold_otsu
def boxcount(bin_img, k):
S = np.add.reduceat(
np.add.reduceat(bin_img, np.arange(0, bin_img.shape[0], k), axis=0),
np.arange(0, bin_img.shape[1], k), axis=1)
return len(np.where((S > 0) & (S < k ... | true |
c3ffdabf2d86a81249097402dd8675ebea79e033 | Python | mayankj1995/Sentiment_Analysis | /preprocessing/get_articles.py | UTF-8 | 2,371 | 3.140625 | 3 | [] | no_license | import requests
from math import ceil
from time import sleep
import csv
import pandas as pd
from itertools import chain
def get_nyt_articles(api_key, query, begin_date, end_date, page):
"""
Make a basic call to the NYT articles API
`begin_date` and `end_date` are in YYYYMMDD format
returns a... | true |
51613408fecce78595edc87d36924efedda52a89 | Python | dvs-shashank/Testing_repository | /cspp1-practice/m22/assignment3/tokenize.py | UTF-8 | 623 | 4.25 | 4 | [] | no_license | '''
Write a function to tokenize a given string and return a dictionary with the frequency of
each word
'''
def tokenize(string):
'''
tokenise method
'''
token_dict = {}
string_list = string.split(" ")
#print(string_list)
for each_val in string_list:
if each_val not in token_dict:
... | true |
325a39b60ff8dd7cd8cecbd3eeb34c0a95e0a554 | Python | JulienDavat/sage-backends-experiments | /scripts/query_sage.py | UTF-8 | 2,851 | 2.609375 | 3 | [] | no_license | #!/usr/bin/python3
import logging
import coloredlogs
import click
import requests
from time import time
from json import dumps
from statistics import mean
from utils import list_files, basename
coloredlogs.install(level='INFO', fmt='%(asctime)s - %(levelname)s %(message)s')
logger = logging.getLogger(__name__)
@cl... | true |
81110d3ae2b6e680af1465b1a20ee7f49b52f2e0 | Python | swapnilvishwakarma/100_Days_of_Coding_Challenge | /42.Reorder_List.py | UTF-8 | 869 | 3.921875 | 4 | [] | no_license | # Given a singly linked list L: L0→L1→…→Ln-1→Ln,
# reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…
# You may not modify the values in the list's nodes, only nodes itself may be changed.
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next... | true |
da46e31be70615b91652554ec076cc8a8ea5025e | Python | sayakbanerjee1999/TARP-Pesticide-Segregator | /model.py | UTF-8 | 4,021 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Apr 6 20:56:22 2021
@author: Sayak, Ritayan, Itsav
"""
# res_map = {'Potato___Early_blight': 0, 'Potato___Late_blight': 1, 'Potato___healthy': 2}
# Importing the required keraas library and Viz Libraries
from keras.models import Sequential
from keras.layers ... | true |
dfdb7e9092d9dce4b5513c76747b749ec8cd53a5 | Python | chunjiw/leetcode | /solve.py | UTF-8 | 2,314 | 3.9375 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# 130. Surrounded Regions
# Given a 2D board containing 'X' and 'O' (the letter O), capture all regions surrounded by 'X'.
# A region is captured by flipping all 'O's into 'X's in that surrounded region.
# Example:
# X X X X
# X O O X
# X X O X
# X O X X
# After runnin... | true |
6392b62e2883064e059e5ebc2eeb2dc06566ad24 | Python | Vlad12344/RoboDKToPulsePostprocessor | /postprocessor/converter/programParser.py | UTF-8 | 1,938 | 3.046875 | 3 | [
"MIT"
] | permissive | import re
def read_file(file_path):
"""Read initial program"""
with open(file_path, 'r') as program:
program = open(file_path, "r")
program = str(program.read())
return program.split('\n')
def find_numbers(data: str):
"""Finds all numbers in single line"""
diction = re.findall(... | true |
11d2a6b1de4c8d52b89ba66f79e90e0e4505f8d1 | Python | kimjieun6307/itwill | /itwill/Python_1/chap04_RegExText/exams/exam01.py | UTF-8 | 1,038 | 4.03125 | 4 | [] | no_license | '''
문1) 다음 emp '입사년도이름급여'순으로 사원의 정보가 기록된 데이터 있다.
이 벡터 데이터를 이용하여 사원의 이름만 추출하시오.
# <출력 결과>
names = ['홍길동', '이순신', '유관순']
'''
from re import findall
# <Vector data>
emp = ["2014홍길동220", "2002이순신300", "2010유관순260"]
# print(findall('[가-힣]{3,}',emp)) --- error
year = [findall(r'^\d{2,}', i)[0] for i in emp]
prin... | true |
0068a09e23162b4dcd2520ffab23eb96794dad93 | Python | mjsmyth/abiquo-wiki-scripts | /release/getConfluencePageContentRestRelease.py | UTF-8 | 7,074 | 2.71875 | 3 | [] | no_license | # Python script: getConfluencePageContent
# ---------------------------------------
# Friendly warning: This script is provided "as is" and without any guarantees.
# I developed it to solve a specific problem.
# I'm sharing it because I hope it will be useful to others too.
# If you have any improvements to share, plea... | true |
6ac270e92232a05764b4edcb739c4f1f9265be62 | Python | nvieira-mcgill/rad-transient | /line_scattering.py | UTF-8 | 1,763 | 3.421875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 11 23:13:04 2020
@author: Nicholas Vieira
@line_scattering.py
Scatter a photon packet on a known atomic line. A crude model for an atomic
line which invokes the Sobolev approximation. Based on the work of:
--> Kasen et al. 2006, ApJ 651, 366-380
"... | true |
0c3f82ff58068142f6695d8877cc01759412b78d | Python | LiveAlone/pythonDemo | /2.7-libs/multiple_process/process_map_run.py | UTF-8 | 883 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'yaoqijun'
__mail__ = 'yaoqijunmail@foxmail.com'
'''
description: 通过线程池方式, 进行任务分配, 多任务的执行方式, 通过阻塞队列方式, 进行多任务的分发操作。
'''
import os
from multiprocessing import Pool
from multiprocessing import Queue
import time
import random
from collections import Iterable, ... | true |
5af36178573f7027fea7ca7fb821a478fb98e69e | Python | natarajan1993/Text-Classification | /Category Classifier.py | UTF-8 | 14,549 | 3.09375 | 3 | [] | no_license | """This was a machine learning project for text analytics and classification. The objective was to find the most important keywords
associated with whether a protection agreement was sold to the customer or not during the sale of appliances. The data is chats between
sales representatives and customers online. I achi... | true |
50cf56fba5dbfadae9e3ddd5810643e6d321e835 | Python | ToqYang/holbertonschool-higher_level_programming | /0x0C-python-almost_a_circle/models/rectangle.py | UTF-8 | 4,962 | 3.875 | 4 | [] | no_license | #!/usr/bin/python3
""" Module that Use the class base for make a Rectangle """
from models.base import Base
class Rectangle(Base):
""" Make the base class of a Rectangle """
def __init__(self, width, height, x=0, y=0, id=None):
""" __init__ Constructor of the class Rectangle
Args:
... | true |
b8899e6e16f2c6dbab3c5ce50d99be5484f413f2 | Python | wj1224/algorithm_solve | /programmers/python/programmers_hash_2.py | UTF-8 | 163 | 2.921875 | 3 | [] | no_license | def solution(phone_book):
answer = True
phone_book.sort()
for i, v in enumerate(phone_book[:-1]):
if v in phone_book[i + 1]:
answer = False
return answer
| true |
4a3cafa34d964bef959a531723c2c7ac233d5c92 | Python | gbrown9/Week-Nine-Assignment | /index.py | UTF-8 | 311 | 2.90625 | 3 | [
"MIT"
] | permissive | #CIS 125
#Gabe Brown and Daniel McMurray
sortedWords = ""
myWords = []
quiz = open("quizwords.txt", "r")
wordList = open("wordLists.txt", "r")
myQuiz = quiz.read()
quiz = quiz.replace(",", "")
myWords = myQuiz.split()
myWords = list(myWords)
def sortedWord(myWords):
def main()
quiz.close()
wordList.clo... | true |
87ced915670d0703bd9db149df74bbb863fa7bc1 | Python | g-morishita/intro-ML-python | /ch4/one_hot/binning.py | UTF-8 | 1,015 | 2.90625 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
from sklearn.tree import DecisionTreeRegressor
from sklearn.preprocessing import OneHotEncoder
from mglearn.datasets import make_wave
X, y = make_wave(n_samples=100)
line = np.linspace(-3, 3, 1000, ... | true |
e584671a0594904020f78c7a3fd8238a67a02b43 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_199/2806.py | UTF-8 | 804 | 3.265625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
def pancake(s, k):
count = 0
for i in range(len(s) - k + 1):
if s[i] == "-":
count += 1
s = swap(s, i, k)
if '-' in s:
return "IMPOSSIBLE"
else:
return count
def swap(s, i, k):
# print("swa... | true |
56c0cc55d4d1e5c3dddc60356a14f1d33d916005 | Python | bopopescu/Py_projects | /BreakingPoint/RestApi/Python/RestApi_v2/SampleScripts/createSuperFlowStrikeList.py | UTF-8 | 3,650 | 2.578125 | 3 | [
"MIT"
] | permissive | """
createSuperFlowStrikeList.py
Description:
Create a Test Model from scratch.
What this script does:
- Login to BPS box
- Create a new superflow from scratch
- Add flow and actions to the new created superflow
- Save the superflow
- Edit parameters inside an action
- Remove action
- Create a... | true |
7ce08fa9c2cee801d5e7e9aa35dde64c2a844db7 | Python | Yashvir-Rana/dailyvscode | /tricks/kidsprojects/hexspiral.py | UTF-8 | 224 | 3.625 | 4 | [] | no_license | import turtle as tur
colors = ['red', 'purple', 'blue', 'green', 'yellow', 'orange']
t = tur.Pen()
tur.bgcolor('black')
for x in range(90):
t.pencolor(colors[x%6])
t.width(x/100+1)
t.forward(x)
t.left(59)
| true |
736e77087a8e83e830ce9e8f41c26368b7b7056d | Python | e2innovation/rul-wrs | /src/test/util/row.py | UTF-8 | 332 | 2.984375 | 3 | [] | no_license | """
Esta clase nos sirve para mockear el resultado de pyodbc.row
"""
class Row(object):
def __init__(self, dict):
self.__dict__ = dict
def __iter__(self): # iterate over all keys
for value in self.__dict__.values():
yield value
def __len__(self):
return len(self.__dict... | true |
b84db1082296a15e2a2b06fa485ddfe645ec71ed | Python | Caioseal/Python | /Exercícios/ex81.py | UTF-8 | 519 | 4.125 | 4 | [] | no_license | lista = []
while True:
lista.append(int(input('Digite um valor: ')))
print('Valor adicionado com sucesso')
resposta = str(input('Quer continuar: [S/N] ')).strip()
if resposta in 'Nn':
break
print('-=' * 30)
print(f'Foram digitados {len(lista)} números.')
lista.sort(reverse=True) #revers... | true |
a0699c7e17999182d3814f1573c71c21f0a0cd07 | Python | sforrester23/python_prime_numbers | /functions.py | UTF-8 | 1,677 | 4.28125 | 4 | [] | no_license | # function for determining if the argument parsed number is prime or not
def is_prime_number(number):
# make it an integer
number = int(number)
# start the count
index = 1
# make an empty list of the number's factors
list_of_factors = []
# for the whole time the count is below or equal to th... | true |
c49fc0445003ca88c479334ede88be107a98b1d5 | Python | CaptCorpMURICA/TrainingClasses | /Udemy/TimBuchalka/CompletePythonMasterclass/FileIO/writingTextFiles.py | UTF-8 | 1,056 | 3.671875 | 4 | [] | no_license | """
Author: CaptCorpMURICA
File: writingTextFiles.py
Creation Date: 10/5/2018, 11:08 AM
Description: Writing Text Files
"""
cities = ["Adelaide", "Alice Springs", "Darwin", "Melbourne", "Sydney"]
with open("cities.txt", 'w') as city_file:
for city in cities:
print(cit... | true |
14088870c4b943b4fade96151798e46d91fe2993 | Python | Zebralt/carambar | /carambar/termset.py | UTF-8 | 2,149 | 3.109375 | 3 | [] | no_license | import os
from contextlib import contextmanager
from functools import partial
from typing import Optional, Union, Callable, TextIO
from . import seq
"""
Compilation of terminal operations.
"""
def hide_cursor(file: TextIO):
"""Hide terminal cursor."""
file.write(seq.Cursor.HIDE)
def show_cursor(file: Tex... | true |
46e7cba6ee6f4bf3205b271ee5b2de425d7bad3b | Python | daumhch/bit_seoul_project | /test/test5.py | UTF-8 | 1,228 | 2.75 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
test_wav_filename = np.load('./test/data/test_wav_filename.npy')
test_wav_data = np.load('./test/data/test_wav_data.npy')
test_wav_target = np.load('./test/data/test_wav_target.npy')
print("test_wav_data.shape:", test_wav_data.shape)
print("test_wav_target.shape:", t... | true |
4205ccc8ab4faf75c2d0278b50b548f2dbc4dafa | Python | ilyashusterman/GmailClassifier | /tagger_machine/server.py | UTF-8 | 1,068 | 2.515625 | 3 | [] | no_license | import os
import tornado.ioloop
import tornado.web
CLIENT_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__),
'web_client'))
CLIENT_STATIC = os.path.abspath(os.path.join(os.path.dirname(__file__),
'web_client/static_file... | true |
a946243156f69d83b48a89c6bb621881face5dd9 | Python | redclazz2/LogicaDeProgramacion | /Talleres/Taller30Abril/Punto29.py | UTF-8 | 96 | 3.546875 | 4 | [] | no_license | numero = float(input("Ingrese el número: "))
print("El número decimal es: {0}".format(numero)) | true |
c20de440f28e06ab66e858c2c52ba06a1e4f542e | Python | tamycova/Week-Projects | /Zombies/threads/helicoptero.py | UTF-8 | 3,458 | 2.59375 | 3 | [] | no_license | from PyQt4 import QtCore, QtGui
from random import randint
from math import sqrt
import time
class Helicoptero(QtCore.QThread):
trigger = QtCore.pyqtSignal(object)
def __init__(self, arena, main):
super().__init__()
self.trigger.connect(self.insertar_regalitos)
self.pausa = False
... | true |
f39a843fbd13fdf5db46996555ef6408795c5f35 | Python | init-13/codevita | /codevita2020/mock2020/A.py | UTF-8 | 93 | 2.921875 | 3 | [] | no_license | import math
for _ in range(int(input())):
print(math.ceil(math.log2(int(input())+1)))
| true |
06bcc8b57b84c54345d00365b571ccb0e3c190c3 | Python | Python-Programming-Boot-Camp/JonathanKarr | /Week 1/hello_variable.py | UTF-8 | 40 | 2.875 | 3 | [] | no_license | name = "Jonathan"
print("Hello " + name) | true |
574eef63e6632ba399c29b012b096b0d9d439745 | Python | Resolt/ML_Bootcamp | /DataVisualization/PandasBuiltInVisulizationExercises.py | UTF-8 | 675 | 2.890625 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
dir = 'Bootcamp/DataVisualization/'
df3 = pd.read_csv(dir + 'df3')
print(df3.info())
print(df3.head())
sns.set_style('darkgrid')
df3.plot.scatter(x='a', y='b', s=3, color='red', figsize=(12, 3), xlim=(-.2, 1.2), ylim=(-.2,1... | true |
c2845761d15d5b163fe415129b491eb56c3db772 | Python | Abuelodelanada/calidad | /Abc.py | UTF-8 | 2,405 | 3.1875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import csv
import json
from operator import itemgetter
class Abc():
TOTALES_ABC = {}
TOTALES_ABC_ACUM_JSON = []
TOTALES = ''
TOTAL = 0
grupos = {}
codigo_monto = {}
def __init__(self, ):
"""
"""
self.TOTALES_ABC = {}
def __exit__(self... | true |
1c42879379726c4c92f89dba541cf8906bae060e | Python | bchow1/Utils | /examples/StackOverflow/Csv_c2r.py | UTF-8 | 209 | 2.984375 | 3 | [] | no_license | import csv
x = []
y = []
with (open('E:\\TEMP\\xy.csv','r')) as egFile:
plots=csv.reader(egFile,delimiter=',')
for row in plots:
x.append(int(row[0]))
y.append(int(row[1]))
print x
print y
| true |
61abf819fa0aea5cb5ece21699f1abc3723fda14 | Python | tanc7/UdemyClassResources | /egghunters/old/kstetPOC3.py | UTF-8 | 1,852 | 2.671875 | 3 | [] | no_license | # Author: Uday Mittal
# Company: Yaksas CSC
# Contact: csc@yaksas.in | twitter.com/yaksas443
import sys
import socket
#Aa0Aa1Aa2Aa3Aa4Aa5Aa6Aa7Aa8Aa9Ab0Ab1Ab2Ab3Ab4Ab5Ab6Ab7Ab8Ab9Ac0Ac1Ac2Ac3Ac4Ac5Ac6Ac7Ac8Ac9Ad0Ad1Ad2Ad3Ad4Ad5Ad6Ad7Ad8Ad9Ae0Ae1Ae2Ae3Ae4Ae5Ae6Ae7Ae8Ae9Af0Af1Af2Af3Af4Af5Af6Af7Af8Af9Ag0Ag1Ag2Ag3Ag4Ag5A... | true |
011afc4eb7f06543a0eefe92e367b49279f16eb5 | Python | guidooswaldDB/DatabricksGitIntegration | /secondNotebook.py | UTF-8 | 568 | 2.515625 | 3 | [] | no_license | # Databricks notebook source
path = "/databricks-datasets/nyctaxi/tripdata/yellow/yellow_tripdata_2009-01.csv.gz"
logDF = (spark
.read
.option("header", True)
.csv(path)
)
display(logDF)
# COMMAND ----------
# MAGIC %scala
# MAGIC val path = "/databricks-datasets/nyctaxi/tripdata/yellow/yellow_tripdata_2009-0... | true |
7e65b8389a34a0a930c625f793f64c329091207f | Python | dpaneda/code | /jams/euler/53.py | UTF-8 | 267 | 3.546875 | 4 | [] | no_license | #!/usr/bin/env python3
from math import factorial
def combinations(n, r):
return factorial(n) / (factorial(r) * factorial(n-r))
exceeds = 0
for n in range(1, 101):
for r in range(1, n):
if combinations(n, r) > 1000000:
exceeds += 1
print(exceeds)
| true |
5379bd0c0172f8934e8081ae13524e3d602136ef | Python | mstryjek/VAEs | /window.py | UTF-8 | 3,252 | 3.234375 | 3 | [] | no_license | """
VAE visualization app definition utilizing tkinter.
"""
import numpy as np
from PIL import ImageTk
from PIL import Image as Img ## conflict with tkinter.Image class
from tkinter import *
class VAE_window():
"""
Simple class for visualizing the working of a Variational Autodecoder. \\
Params: \\
... | true |
bb1333b602293d05782d8fadb3adc33222846d92 | Python | sombriyo/Leetcode-_questions | /random/Maximum Product Difference Between Two Pairs.py | UTF-8 | 331 | 3.40625 | 3 | [] | no_license | '''
Find the maximum difference of the product
Runtime: 156 ms, faster than 97.41% of Python3
Memory : 15.4 MB, less than 53.06% of Python3
TC: O(nlogn)
SC : O(n)
'''
def maxProductDifference(self, nums: List[int]) -> int:
nums.sort()
diff = nums[len(nums)-1] * nums[len(nums)-2] - nums[0]*nums[1]
r... | true |
0e9a81d61dde221ab17a54b4fa1ebad9986af5d1 | Python | qzsiniong/python-life | /DateUtils.py | UTF-8 | 1,335 | 3.296875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
import time
import datetime
def timestamp_datetime(value):
format = '%Y-%m-%d %H:%M:%S'
# value为传入的值为时间戳(整形),如:1332888820
value = time.localtime(value)
## 经过localtime转换后变成
## time.struct_time(tm_year=2012, tm_mon=3, tm_mday=28, tm_hour=6, tm_min=5... | true |
83fe430be752dd0063593f4149712ba6da0ee6d6 | Python | supab/Game | /main.py | UTF-8 | 4,440 | 2.921875 | 3 | [] | no_license | import pygame
from pygame.locals import *
from gamelib import SimpleGame
from elements import Player, Meteor, Bullet, Life,EnemyBullet
import random
class MeteorGame(SimpleGame):
BLACK = pygame.Color('black')
WHITE = pygame.Color('white')
COLOR = [pygame.Color('red'), pygame.Color('green'), pygame.Color('blue'), py... | true |
c2d1a1ec62e34eece9054956be38417db6489752 | Python | CatarinaBrendel/Lernen | /curso_em_video/Module 2/exer049.py | UTF-8 | 268 | 3.953125 | 4 | [] | no_license | print "{:-^45}".format(' \033[31mTabuada\033[m ')
num = int(raw_input("Digite aqui um numero inteiro a ser multiplicado: > "))
num2 = int(raw_input("Digite aqui o valor da tabuada: > "))
for n in range(1, num2+1):
print "{:3} x {:3} = {:3}".format(num, n, num * n) | true |
b3cd1c56baedb7696594fb0f0f625e88e99df8d8 | Python | agnosticdev/AutomationScripts | /latency_test.py | UTF-8 | 4,005 | 3.546875 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# The purpose of this script is to simply make anonymous GET requests to test latency
# These requests do not contain authentication or headers
# The only things that are asked from the user is the URL and the times they wish to run the URL
#
from __future__ import print_... | true |
98d374667a0422a8501f5be9790f8c22db721afe | Python | kovrichard/tweetshot | /tweetshot/take_screenshot.py | UTF-8 | 8,277 | 2.765625 | 3 | [
"MIT"
] | permissive | from pathlib import Path
from PIL import Image
from io import BytesIO
import base64
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from tweetshot.webdrivers.set_webdriver import get_driver
class Twee... | true |
bc257eb2361d9528c9d5b08765df2822aca3b46e | Python | Alex-Boiko/Vacanator2k | /sandbox.py | UTF-8 | 335 | 3.09375 | 3 | [] | no_license | from datetime import date
def diff_month(d1, d2):
return (d1.year - d2.year)*12 + d1.month - d2.month
print abs(diff_month(date(2010,10,1), date(2011,3,1)))
assert diff_month(date(2010,10,1), date(2009,10,1)) == 12
assert diff_month(date(2010,10,1), date(2009,11,1)) == 11
assert diff_month(date(2010,10,1), date(2... | true |
a3ccee7ac2a1806558d5f355f9f1525466e79701 | Python | shawnLeeZX/solution_to_intro_to_datascience_UW_coursera | /assignment1/tweet_sentiment.py | UTF-8 | 1,347 | 3.21875 | 3 | [] | no_license | # encoding: utf-8
import sys
import json
def main():
sent_file = open(sys.argv[1])
tweet_file = open(sys.argv[2])
# Get sentiment dictionary for words.
sent_dict = {}
for line in sent_file:
term, sent_score = line.split('\t')
sent_score = int(sent_score)
sent_dict[term] = ... | true |
6d53e7117bf8082eb7d0267d229ef94467548dea | Python | hellodevopsgit/PDS | /CSV-HORUS.py | UTF-8 | 771 | 2.578125 | 3 | [] | no_license | import pandas as pd
sInputFileName='C:/VKHCG/01-Vermeulen/00-RawData/Country_Code.csv'
InputData=pd.read_csv(sInputFileName,encoding="latin-1")
print(InputData)
ProcessData=InputData
ProcessData.drop('ISO-2-CODE', axis=1,inplace=True)
ProcessData.drop('ISO-3-Code', axis=1,inplace=True)
ProcessData.rename(columns... | true |
b40595364a95969e4964cefa12f9d400e89cc84f | Python | sandykrishdaswani/sandy2 | /18.py | UTF-8 | 197 | 2.9375 | 3 | [] | no_license | number=int(input())
sandy=0
aa=[]
bb=['a','a','b','i','k','l']
for i in range(0,number):
aa.append(list(input()))
for i in aa:
s=sorted(i)
if(bb==s):
sandy=sandy+1
print(sandy)
| true |