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 |
|---|---|---|---|---|---|---|---|---|---|---|
14bf553bdace848fc008e78ebb7fc713bcefc949 | wheelerlaw/renty | /webapp/models.py | UTF-8 | 2,019 | 2.9375 | 3 | [
"MIT"
] | permissive | from django.db import models
import calendar
from datetime import date
class Utility(models.Model):
name = models.CharField(max_length=1024)
def __str__(self):
return str(self.name)
class Bill(models.Model):
utility = models.ForeignKey(Utility, on_delete=models.CASCADE)
charge = models.Deci... | true |
795620a42b479c7a136119db81f91a1df6f520f1 | lch129444/Python_coding_Practice | /for_replace.py | UTF-8 | 132 | 3.484375 | 3 | [] | no_license | names = ["Joey Tribbiani", "Monica Geller"]
usernames = []
for name in names:
usernames.append(name.lower().replace(" ","-"))
print(usernames)
| true |
ccc9c5ab457b881da75159c2e6cd8fee4f3d4e62 | fanzeyi/MIPS.docset | /convert.py | UTF-8 | 1,900 | 2.671875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import sqlite3
class Instruction(object):
def __init__(self, name, params, desc=''):
self.name = name
self.params = params
self.desc = desc
def to_rst(self):
return """
.. mips:instructions:: {name} {params}
{desc}
{params_list}
""".format(name=se... | true |
5ba0a2da900943643f2d681af0ddf33c1343a9c1 | ivihernandez/staff-allocation | /ParameterReader.py | UTF-8 | 943 | 3.125 | 3 | [] | no_license | '''
Created on May 15, 2013
@author: ivihernandez
'''
#standard imports
#third-party imports
#my own imports
class ParameterReader:
def __init__(self, experimentFilePath):
"""
@param experimentFolderPath: folder containing a list of files.
Each file contains the parameters ne... | true |
44f3a8c3cd54548c2a03a55f2059f2336a79fa72 | zhenguo96/test1 | /Python基础笔记/17/代码/4.进程间不能共享变量.py | UTF-8 | 679 | 2.734375 | 3 | [] | no_license | import multiprocessing as mp
import os
import random
import time
list1 = [10,20,30,40]
# 进程内存空间独立,对于共享的变量,会产生一个副本
def worker():
global list1
# current_process() 获取当前进程对象
print("子进程{}开始".format(mp.current_process().name))
list1[0] = -10
print("子进程:",list1)
print("{}子进程结束".format(mp.... | true |
8e0250248578495419bb94e073306d0e5b849fff | klehman-rally/kingfisher | /prover.py | UTF-8 | 939 | 2.984375 | 3 | [
"BSD-3-Clause"
] | permissive | import itertools
OCM_DATA = "data/ocm-messages.dat"
def getOCMItems(source_file):
OCM_SEPARATOR = "-" * 80 + "\n"
with open(source_file, 'r') as ocmf:
ocm_blob = ocmf.read()
return ocm_blob.split(OCM_SEPARATOR)
ocms = getOCMItems(OCM_DATA)
count = 0
for raw_ocm in itertools.cycle(ocms):
... | true |
623ec25d956e3bbc9f3732ce409a3a8203327084 | estephenson/ai-mental-health | /Clustering.py | UTF-8 | 4,731 | 2.84375 | 3 | [] | no_license | import numpy as np
import pandas as pd
import nltk
from nltk.corpus import stopwords
from nltk.stem.snowball import SnowballStemmer
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
import re
from sklearn.cluster import KMeans
from sklearn.externals impor... | true |
0fec21f05c0da39e67c920383d3d3f17bdafb70e | stjordanis/artificial_intelligence | /sentiment_analysis/vanilla_ensemble_model/nlp_classifier.py | UTF-8 | 2,483 | 2.921875 | 3 | [] | no_license | import nltk
from nltk.tokenize import word_tokenize
from nltk.corpus import movie_reviews
from nltk.classify import ClassifierI
from nltk.classify.scikitlearn import SklearnClassifier
from sklearn.naive_bayes import MultinomialNB,BernoulliNB
from statistics import mode
import random
import pickle
from statistics import... | true |
e1d3af40f690efa9e4854a320b7f9185cdc0739b | Geophysics-OpenSource/gimli | /python/pygimli/physics/em/io.py | UTF-8 | 3,326 | 2.890625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Import functions for several Em data formats (to be extended)."""
import numpy as np
def readusffile(filename, data=None):
"""Read data from single USF (universal sounding file) file.
data = readusffile( filename )
data = readusffile( filename, data ) will... | true |
a8ce94bbeba19fc3763a2bfee2bfd472fecdd98f | babelag/Unittests | /Test 3 printing/third_project.py | UTF-8 | 280 | 3.140625 | 3 | [] | no_license |
class Profile:
def __init__(self, name, age, job):
self.job = job
self.age = age
self.name = name
def print_name(self):
print(self.name)
def print_age(self):
print(self.age)
def print_job(self):
print(self.job)
| true |
f0b4e18341891014e8e77dd0a83b7ba9c6920664 | PuneethKpati/sorting_algorithms | /insertionSort.py | UTF-8 | 657 | 4.0625 | 4 | [] | no_license | from algorithm import Algorithm
class InsertionSort(Algorithm):
def __init__(self):
super().__init__('O(n^2)', 'O(1)', 'Insertion Sort')
def sort(self, array):
# End function if no array is passed
if not array:
return None
# only consider first 'index' number of elements and sort them
... | true |
4cd00749e113eb1f9a9c13ea673e50b076d91a2d | Shafran-ku/python_training | /Application_for_contact.py | UTF-8 | 2,533 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | from selenium import webdriver
class Application_for_contact:
def __init__(self):
self.wd = webdriver.Firefox()
self.wd.implicitly_wait(30)
def open_home_page(self):
# open home page
wd = self.wd
wd.get("http://localhost/addressbook/")
def login(self, username, pas... | true |
2acb9f28aa9ff0e9185721c8c729734c2abc09fa | ForritunarkeppniFramhaldsskolanna/Keppnir | /2017/problems/orokrett/submissions/accepted/solution.py | UTF-8 | 345 | 3.0625 | 3 | [] | no_license | import sys
found = False
for clause in sys.stdin.readline().strip().split(' EDA '):
t = set()
f = set()
for v in clause.strip('()').split(' OG '):
if v[0] == '!':
f.add(v[1:])
else:
t.add(v)
if len(t & f) == 0:
found = True
if found:
print('Jebb')
e... | true |
054c0436b54e68d869542d266434eb3569276326 | Lee-W/decli | /tests/examples.py | UTF-8 | 5,537 | 3.09375 | 3 | [
"MIT"
] | permissive | import argparse
import textwrap
from decli import cli
def main_example():
"""https://docs.python.org/3/library/argparse.html#example"""
data = {
"description": "Process some integers.",
"arguments": [
{
"name": "integers",
"metavar": "N",
... | true |
022b63b7fd1627a200e65a5f3b347219ac3983f6 | gmiesch/BioinformaticsClustering | /webapp/clusteringapp/dataclustering/clustering_code/clusteringBACKUP.py | UTF-8 | 2,093 | 2.765625 | 3 | [] | no_license | #TESTING GIT
import sys
import testObjects.py
distances = []
distances.append([ 0, 1075, 671, 2684, 2631, 1616])
distances.append([1075, 0, 1329, 3273, 2687, 2037])
distances.append([ 671, 1329, 0, 2013, 2054, 996])
distances.append([2684, 3273, 2013, 0, 808, 1307])
distances.append([2631, 2687, 2054, 808,... | true |
72af3ec359ab58c8dd6a868b2a9449ddd9c9e7c5 | neptunedays9/text-analysis-py | /process.py | UTF-8 | 1,956 | 3 | 3 | [] | no_license | from frequency import freq_words
from stopwords import remove_stopwords
from data import read_raw_data, \
write_data_token_frequency, \
read_dict_token, \
read_dict_textarray, \
write_data_text_array
from display import show_data
from topic import build_topic_model_dict, show_lda_html, show_wordclou... | true |
902acb4e96f5d23a85bdbf293fd4eec0654afa03 | Benzsoft/Python-Stuff | /Advanced Topics/Higher_Order_Decorators.py | UTF-8 | 879 | 3.828125 | 4 | [
"MIT"
] | permissive | from time import time
def timer(func):
# Wrapper
def f(*args, **kwargs):
before = time()
rv = func(*args, **kwargs)
after = time()
print('Elapsed is: ', after - before)
return rv
return f
# Higher Order Decorator
def n_times(n):
def inner(func):
def wr... | true |
00f179d643cdb5ca9164cf57655d695094ce7501 | lamalamalana/SmartNinjaHW-pythonProject01 | /mood-checker.py | UTF-8 | 390 | 3.78125 | 4 | [] | no_license | mood = input("How're you feeling? ").lower()
if mood == "happy":
print("It's great to see you happy!")
elif mood == "nervous":
print("Take a deep breath 3 times.")
elif mood == "sad":
print("Don't be sad, be awesome instead!")
elif mood == "excited":
print("That's awesome!")
elif mood == "relaxed":
... | true |
012f2d203f2b18d4bffc0e099db55655cd73f4a5 | slxiao/DeepJTT_MSR | /baseline_DL-DBN_JIT/LR.py | UTF-8 | 667 | 2.71875 | 3 | [
"MIT"
] | permissive | import torch
import torch.nn as nn
class LR(nn.Module):
def __init__(self, input_size, num_classes):
super(LR, self).__init__()
# self.fc = nn.Linear(input_size, 128)
# self.fc1 = nn.Linear(128, 256)
# self.fc2 = nn.Linear(256, 64)
# self.fc3 = nn.Linear(64, num_classes)
... | true |
26242fb11b71c9e376aeaa90adfde0e8840db6a0 | zegkljan/septajici-lesy | /generation.py | UTF-8 | 17,427 | 2.828125 | 3 | [] | no_license | import typing
import matplotlib
import networkx as nx
import random
import time
import numpy as np
import matplotlib.pyplot as plt
from utils import Seq, SolvedSeq, NodeKind, seq2str, save_sequences
T = typing.TypeVar('T')
U = typing.TypeVar('U')
class PathMetrics(typing.NamedTuple):
nones_count: int
frac... | true |
1ac0a530121359929d0f84dcfb6ce2fdf9bc4cf7 | codeByVaibhav/py_anim | /lib/math/constants.py | UTF-8 | 63 | 2.53125 | 3 | [] | no_license | import numpy as np
PI = np.pi
TAU = 2 * PI
DEGREE = TAU / 360
| true |
3fb22a988994250dcfe7d0fceaf186c517b9b7ad | rpetrenko/examples | /regression/main.py | UTF-8 | 2,560 | 3.375 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
from __future__ import print_function
from itertools import count
import torch
import torch.autograd
import torch.nn.functional as F
from torch.autograd import Variable
POLY_DEGREE = 4
W_target = torch.randn(POLY_DEGREE, 1) * 5 # Tensor size 4x1
b_target = torch.randn(1) * 5 # Tensor size 1
de... | true |
93bdd3c5981281d39c76dbb561381f3d3aa3aaba | georgysavva/oauth2 | /oauth2_server/inmem_storage/applications.py | UTF-8 | 813 | 2.546875 | 3 | [] | no_license | from models import models
from typing import Dict, Optional
# In the real world service we would use a database to store applications e.g: PostgreSQL, MongoDB.
# And we should encrypt "client_secret" field to improve security of the system.
# But for now we will go with the simplest implementation.
class InMemApplica... | true |
852ac06775a257f5c7362d6b1eef7d77eca71a3e | prakhar33/Sentiment-Analysis-Using-Flask | /app1.py | UTF-8 | 2,112 | 2.609375 | 3 | [] | no_license | import numpy as np
from flask import Flask , request , jsonify , render_template
import re
import tensorflow as tf
from keras_preprocessing.text import tokenizer_from_json
from tensorflow.keras.models import model_from_json
from keras.preprocessing.sequence import pad_sequences
import json
from tensorflow.comp... | true |
f9f140e9a278541372321c5f515d9817cb40986c | Launchpad5682/problem_solving | /strings/day-1/generate-document.py | UTF-8 | 817 | 3.671875 | 4 | [] | no_license | def genearateDocument(characters, document):
count_characters = [0]*256 # all the characters
for i in characters:
count_characters[ord(i)] += 1
count_document = [0]*256
for i in document:
count_document[ord(i)] += 1
for i in range(0, 256):
# if the characters are not avai... | true |
b8ae9a28926f6cf15899d000515cd51965037c8e | donhwi94/NomadCoders_WebScrapper_with_Python | /Code_Challenge/Day Thirteen and Fourteen Blueprint/so.py | UTF-8 | 1,333 | 2.96875 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
def extract_job(results):
jobs = []
for result in results:
title = result.find('a', {"class":"s-link"})
if title:
title = title.string
company = result.find('h3').find('span')
if company:
company = company.get_text().strip()
url = "http... | true |
4b522fcc087453e107fbb358ff75943c67e5b526 | oiu850714/Algo_HW | /HW2/test.py | UTF-8 | 341 | 3.25 | 3 | [] | no_license | f = open("test.txt", "w")
f.write("1000000\n")
for i in range(500000):
f.write("1 ")
for i in range(500000):
f.write("0 ")
f.write("\n")
for i in range(500000):
f.write("0 ")
for i in range(500000):
f.write("1 ")
f.write("\n")
for i in range(1, 1000000):
f.write(str(i) + " " + s... | true |
1c10f8980d76dedd6b27cdec38b76b43f90682e4 | tricky-investments/dap-collect-property | /src/property/tasks/helpers/calculator.py | UTF-8 | 3,594 | 2.875 | 3 | [] | no_license | def traditionals(data):
# Initialize KPI store
kpis = {}
# Initial Property Costs
purchase_price = data.pop('purchase_price')
downpayment = data.pop('downpayment')
closing_cost = data.pop('closing_cost')
# Monthly Income
rent = data.pop('rent')
# Monthly Expenses
mortgage = d... | true |
07c78f4e556b23f4603574d90dc992b645f3eea4 | annie1227/Python200803 | /day1-1.py | UTF-8 | 75 | 2.828125 | 3 | [] | no_license | print("I'm Eric")
print('He is"cool"')
print("I'm Eric \nHe is \"cool\"") | true |
72749cc9ce9b2692149e765323fa56b40fecfc85 | openmaker-eu/dsp-explorer | /dspexplorer/site_helpers.py | UTF-8 | 307 | 2.515625 | 3 | [] | no_license |
class User:
@classmethod
def authorization(self, request):
authorization = \
1000 if request.user.is_superuser else \
100 if False else \
20 if False else \
10 if request.user.is_authenticated \
else 0
return authorization | true |
957814249c4b7e13e561f41186c69945f6c7f40a | huny77/employment | /baek/이분 탐색/1764듣보잡/1764.py | UTF-8 | 693 | 3.140625 | 3 | [] | no_license | import sys
sys.stdin = open('input.txt')
def binary_search(left:int, right:int, target:str) -> str:
while left<=right:
mid = left + (right-left)//2
if data2[mid] == target:
return target
elif data2[mid]>target:
right= mid-1
else:
left = mid+1
... | true |
b957cfa49daba89ef0efbf8e02d7aaefa68d4869 | amusecode/amuse | /examples/simple/stellar_mass_loss.py | UTF-8 | 2,442 | 2.875 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | # -*- coding: ascii -*-
"""
Set an artificial mass loss rate at a specific point
in the stellar evolution using MESA
and calculate the effect this has on the stellar radius.
"""
from __future__ import print_function
# import numpy
from amuse.units import units
from amuse.datamodel import Particle
from amus... | true |
1efb760141691b188a4cfa6a736962c3ae3f75c3 | cmontalvo251/Python | /instrumentation/book_problems/first_order_problem_10.py | UTF-8 | 1,097 | 3.359375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import scipy.integrate as sci
###Experimental Data
time = np.array([0.1,0.5,1,2,3])
temp = np.array([16.7,8.1,3.3,0.6,0.1])
plt.plot(time,temp,'b*',label='Experimental Data')
##Settling Time Guess
###Using the 98% value
tsettle = 2.0
tau = tsettle/4.0
#Tsettle (sec)... | true |
2676548ee7b282c6f028b2414ad37332e8f4ceef | 2226171237/Weakly-Supervised-Dense-Video-Captioning | /load_data.py | UTF-8 | 2,558 | 2.859375 | 3 | [] | no_license | import json
from nltk.corpus import stopwords
import joblib as ib
import pickle
def preProBuildWordVocab(sentence_iterator, word_count_threshold=5):
# borrowed this function from NeuralTalk
print ('preprocessing word counts and creating vocab based on word count threshold %d' % (word_count_threshold))
word_... | true |
bf8d331b6335cf0a6f1fbce3b30281f4d2a3ffed | ivn-svn/python-advanced-1 | /03-multidimentional-lists/diagonal_difference.py | UTF-8 | 628 | 3.65625 | 4 | [] | no_license | def calculate_sum_of_main_diagonal(n, mat):
primary_diagonal = [mat[i][i] for i in range(n)]
return sum(primary_diagonal)
def calculate_sum_of_secondary_diagonal(n, mat):
secondary_diagonal = [mat[i][n-i-1] for i in range(n)]
return sum(secondary_diagonal)
num = int(input())
matrix = []
... | true |
f060e205374c21d2663c0b72944f3fbd617c7fe9 | liuziping/My-Script | /devops3/one/test/config1.py | UTF-8 | 509 | 3.015625 | 3 | [] | no_license | #coding:utf-8
import ConfigParser
def getconfig(filename,section=''):
cf = ConfigParser.ConfigParser()
cf.read(filename)
cf_items = dict(cf.items(section)) if cf.has_section(section) else {} # 判断section是否存在,存在则把数据存入字典
return cf_items
#if __name__ == '__main__':
# conf = getconfig('test.conf','... | true |
1dd65c51052cbb271b41d127a2bc6a326fc3d758 | chien-wei/LeetCode | /0337_House_Robber_III.py | UTF-8 | 1,930 | 3.40625 | 3 | [] | no_license | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
# optimal structure
# This will get TLE
class Solution:
def rob(self, root):
"""
:type root: TreeNode
:rtype: int
"""
... | true |
7bb6d6148c384dafa0435daaf49be352e5b35b63 | Cream-test/demo_unitest | /test_case3.py | UTF-8 | 2,063 | 3.28125 | 3 | [] | no_license | import unittest
# 使用TestCase
from login import get_username, get_password
version = 2.0
class TestLogin(unittest.TestCase):
#类的初始化方法
@classmethod
def setUpClass(cls) -> None:
print("SetUpClass::执行类之前调用一次")
#类的清空方法
@classmethod
def tearDownClass(cls) -> None:
print("tearDow... | true |
61905456a52d9dfc88a1375f0d4083caceeee6ef | MushR00m/PYIEC60870-104 | /DoubleCommandFactory.py | UTF-8 | 2,549 | 2.765625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 08 10:41:44 2015
clsIECDoubleCommandFactory
Class that creates double command telegrams (only On/Off)
@author: Martin Baldinger / martin.baldinger@gmail.com
"""
from CommandFactory import CommandFactory
from myfunctions import int_to_hex_bytes
class CDou... | true |
1af839311493d449a2ef34b1782142c014e72245 | AAQ6291/PYCATCH | /source code/code/ch1119.py | UTF-8 | 598 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# 載入ftplib模組
import ftplib
# 建立FTP連線與FTP instance
ftp = ftplib.FTP("ftp.freebsd.org")
# 暱名登入(account:anonymous, password:email@...)
print ftp.login()
# 取得歡迎訊息
print ftp.getwelcome()
# 列出目前的檔案與目錄列表
ftp.retrlines("LIST")
# 切換目錄到 pub/FreeBSD
ftp.cwd("pub/FreeBSD")
# 列出目... | true |
8562f04eb737cc3e9514c8c7a9bb41329128c67a | zuqqhi2/my-leetcode-answers | /122-Best-Time-to-Buy-and-Sell-Stock-II-2nd.py | UTF-8 | 829 | 3.265625 | 3 | [] | no_license | class Solution:
def maxProfit(self, prices: List[int]) -> int:
if len(prices) <= 1:
return 0
profit = 0
stock_price = -1
cur_idx = 1
while cur_idx < len(prices):
while cur_idx < len(prices) and prices[cur_idx] - prices[
cur_idx - 1] <=... | true |
d930b050b9a6ececa84057aba9d39882c3087c65 | nkbaba/hackerRankSolutions | /30Days/Arrays2d.py | UTF-8 | 400 | 3.109375 | 3 | [] | no_license | #!/bin/python3
import sys
arr = []
for arr_i in range(6):
arr_t = [int(arr_temp) for arr_temp in input().strip().split(' ')]
arr.append(arr_t)
max = -100000000
for i in range(4):
for j in range(4):
temp = arr[i][j]+arr[i][j+1]+arr[i][j+2]+arr[i+1][j+1]+arr[i+2][j]+arr[i+2][j+1]+arr[i+... | true |
ded5e4e47253c2b05774342f09a170ad9c460a20 | aqd14/online-airlines-reservation | /web/instance/db_create.py | UTF-8 | 5,724 | 2.765625 | 3 | [
"MIT"
] | permissive | '''
#--------------------------------------#
Generate sample database for the web app
#--------------------------------------#
'''
from app.models import *
from app.common.util import generate_random_ticket, generate_random_flight_dates
import datetime
import random
# create the database table and make-up data
# LOC... | true |
d0aefc901e795436ca3782eb679d5bd2fff77e6b | lukaschoebel/bed | /raspi/button.py | UTF-8 | 2,910 | 3.15625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
import time
import random
import threading
import firebase_admin
import RPi.GPIO as GPIO
from firebase_admin import credentials, firestore
cred = credentials.Certificate("secrets/firestore-creds.json")
firebase_admin.initialize_app(cred)
db = firestore.client()
# reference to the firestore document
... | true |
e9d20766b0a6894af1f8ffc75e49b3699b4faae2 | PaccMann/paccmann_predictor_tf | /paccmann/learning.py | UTF-8 | 3,872 | 2.5625 | 3 | [
"MIT"
] | permissive | """Tensorflow learning utilities."""
import tensorflow as tf
from .datasets import (
generate_dataset, feature_name_to_placeholder, validate_feature_names,
record_parser
)
def train_input_fn(params):
"""
Train function given params for paccmann.
Args:
- params: train parameters (<dict>).
... | true |
53b12a9cb89f33ceaa1eaecc469736a1eb51f118 | ChinatsuKawakami/GUIPython | /gui.py | UTF-8 | 2,466 | 3.546875 | 4 | [] | no_license | import tkinter as tk
from tkinter import ttk
from tkinter import scrolledtext
win = tk.Tk()
win.title("Python GUI")
#win.resizable(0,0)
#Modify adding a Label
aLabel = ttk.Label(win,text="A Label")
aLabel.grid(column=0,row=0)
#Button Click Event Function
#ttk.Label(win,text="A Label").grid(column=0,row=0)
#win.mainlo... | true |
741b1188c98b5d3e963b70e1f804fef832681547 | bnm91/FantasyScraperAPI | /FantasyScraperAPI/MatchupDetails.py | UTF-8 | 6,255 | 2.625 | 3 | [] | no_license | from bs4 import BeautifulSoup
import lxml
import requests
import os, csv
import json
from fantasyScraperUtils import utils
HEADER_ROW = {'Owner': 'Owner', 'Player': 'Player', 'Week':'Week', 'Season':'Season', 'Player_Opponent':'Player_Opponent', 'Player_Home':'Player_Home', 'Points':'Points', 'Roster_Slot':'Roster_Slo... | true |
d090a96e4f7be0d19e080dcc0b5f5dcf231e0e36 | moon4869/Data_visualization_course_design | /tableau/json_to_csv.py | UTF-8 | 253 | 2.5625 | 3 | [
"MIT"
] | permissive | import json
with open('maoyan.json', 'r', encoding='utf-8') as f:
data = json.load(f)
ctry = data['score']
with open('score.csv', 'a', encoding='utf-8') as f1:
for k, v in ctry.items():
f1.write(k + ',' + str(v) + '\n')
| true |
d43cef42ebdce7488d79baaf463513d6f74d7a46 | MarquisVIP/data-structures-and-algorithms-in-python | /Reference/progs/bintree.py | UTF-8 | 4,580 | 3.46875 | 3 | [
"MIT"
] | permissive | """ 二叉树结点类和二叉树相关函数,二叉树类等
"""
class BinTreeNodeError(ValueError):
pass
class BinTNode:
def __init__(self, dat, left=None, right=None):
self.data = dat
self.left = left
self.right = right
# end of class
def count_BinTNodes(t):
if t is None:
return 0
... | true |
cb4227ea76c357a3281551c31fd15b29a3b2f108 | Xornet-Euphoria/xctf | /src/xcrypto/finitefield.py | UTF-8 | 2,313 | 3.34375 | 3 | [
"MIT"
] | permissive | class FiniteField:
def __init__(self, p):
self.p = p
def __eq__(self, fp):
return self.p == fp.p
def __ne__(self, fp):
return self.p != fp.p
# for util (no need creating FiniteField instance)
def inv(self, x):
return pow(x, -1, self.p)
class Element:
def __i... | true |
e83ab0df15873283abc8a5bc1033acedd31f0cd2 | william19-meet/self-project | /Ball.py | UTF-8 | 1,659 | 3.640625 | 4 | [] | no_license | import turtle
from turtle import *
turtle.hideturtle()
turtle.penup()
##border = turtle.clone()
##border.penup()
##border.goto(400/2,-400/2)
##border.pendown()
##border.goto(400/2,400/2)
##border.goto(-400/2,400/2)
##border.goto(-400/2,-400/2)
##border.goto(400/2,-400/2)
##border.hideturtle()
class Ball(Turtle):
... | true |
5efa935557751f048091d3b2cde20aafe2faeb38 | autotest2017/suntest | /ReadTxt.py | UTF-8 | 301 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
class ReadAndWrite():
@classmethod
def read_file(self):
hfile=open('data.txt','r')
for i in hfile.readlines():
print i.strip().decode('gbk')
hfile.close()
if __name__=='__main__':
ReadAndWrite.read_file() | true |
011dd9598b875aeb7f23265191def32c9f88ee0c | here0009/LeetCode | /Python/1647_MinimumDeletionstoMakeCharacterFrequenciesUnique.py | UTF-8 | 1,729 | 4.1875 | 4 | [] | no_license | """
A string s is called good if there are no two different characters in s that have the same frequency.
Given a string s, return the minimum number of characters you need to delete to make s good.
The frequency of a character in a string is the number of times it appears in the string. For example, in the string "a... | true |
6894c08b2da437e9ac627ef08c5249c49877ef41 | yyeunggg/Leetcode-Practice | /DP/646. Maximum Length of Pair Chain.py | UTF-8 | 1,901 | 3.546875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 9 12:09:21 2020
@author: steve
"""
"""
646. Maximum Length of Pair Chain
https://leetcode.com/problems/maximum-length-of-pair-chain/
"""
# Can use DP in this problem
"""
Runtime: 2240 ms, faster than 39.90% of Python3 online submissions for Maximum Length... | true |
7cefac9c38e6b8f582eb5ca88d625cec7186cae8 | Owais144/Python-Assignments | /py assingment # 5.py | UTF-8 | 1,570 | 4.15625 | 4 | [] | no_license | #Q1
"""
def fact():
num=int(input("Enter number:"))
factorial = 1
if num < 0:
print("Factorial not possible")
elif num == 0:
print("The Factorial for 0 is 1")
else:
for i in range(1,num+1):
factorial=factorial*i
print("The factorial for {} is {... | true |
39d9407b55cef0fd949d761c3de637c952fc5898 | grozauf/Python_2_Homeworks | /hw_lesson_05/client/__main__.py | UTF-8 | 1,620 | 2.5625 | 3 | [] | no_license | from argparse import ArgumentParser
import socket
import datetime
import logging
import jim
import settings
def get_presence_msg():
time = datetime.datetime.now()
msg = {
"action": "echo",
"time": time.isoformat(),
"user": {
"account_name": "anonim",
"s... | true |
04aa33db6afa4a875d9a2c81fa64be1e75742c02 | yeonjungmo/p1_201411490 | /w5RSP.py | UTF-8 | 829 | 3.328125 | 3 | [] | no_license | user=raw_input("User Choice!(S=1,R=2,P=3):")
Computer=raw_input("Computer Choice!(S=1,R=2,P=3):")
def Rsp():
if user=='1':
if Computer=='1':
print "Same"
if Computer=='2':
print "computer win"
if Computer=='3':
... | true |
45b26c632de742e4d0c4999ef05914a2b8e4267b | Sendhub/sh_util | /text/format_string_to_fit_in_n_chars.py | UTF-8 | 4,016 | 3.5 | 4 | [] | no_license | # encoding: utf-8
"""
Textual helpers.
"""
__author__ = 'Jay Taylor [@jtaylor]'
import math
def squeeze_sms_message(string, *args):
"""Squeezes a message to fit inside 160 characters."""
maxLength = 160
try:
import settings
maxLength = settings.MAX_SMS_MESSAGE_LENGTH
except (Impor... | true |
68ed31d918ee00e169f0b7ee9d001087ce2d4397 | p-terman/Pulse_chopping | /Stable_Releases/DataProcessingStableReleases/v2.0/DataProcessing/DataProcessingFramework/Utilities/LUXDatabaseSQLPyMod.py | UTF-8 | 2,307 | 2.765625 | 3 | [] | no_license | """
LUXDatabaseSQLPyMod.py
This file contains the MySQL database query tools.
OSX MySQLdb installation instructions:
1) Install MySQL: https://www.mysql.com/downloads/mysql/
2) Download MySQL-python: http://dl.dropbox.com/u/3414815/MySQL_python-1.2.3-py2.7-macosx-10.7-intel.egg
(this egg is in the SVN)... | true |
c6f4cb3a5b2084b434ba7f6ec5b1892501e14a60 | mili7522/Hierarchical-GCNN | /src/runNewFeaturesSA1.py | UTF-8 | 2,755 | 2.53125 | 3 | [
"MIT"
] | permissive | import ggcnn.experiment as experiment
import numpy as np
import sys
import pandas as pd
from sklearn.model_selection import KFold
from sklearn.decomposition import PCA
def load_dataset():
keys = []
features = []
labels = []
with open('Data/2018-08-24-NSW-SA1Input-Normalised.csv', 'r') as file:
... | true |
c71ce742fe3c46a80287ffe19d4735f1f0d681d3 | jayhenry/rlpyt | /third_party/rl_example/ch2/2_4.py | UTF-8 | 1,327 | 3.40625 | 3 | [
"MIT"
] | permissive | import numpy as np
import math
import matplotlib.pyplot as plt
def gaussian(x, u, sigma):
return math.exp(-(x - u) ** 2 / (2 * sigma * sigma)) / math.sqrt(2 * math.pi * sigma * sigma)
def importance_sampling_test(ori_sigma, sample_sigma):
origin = []
for n in range(10):
sum = 0
for i in ra... | true |
d0394d512f0a4ddce92a7e365bc4a51076ae95a3 | Washirican/pcc_2e | /chapter_09/importing_classes/electric_car.py | UTF-8 | 1,227 | 3.5 | 4 | [] | no_license | # --------------------------------------------------------------------------- #
# D. Rodriguez, 2020-05-13
# --------------------------------------------------------------------------- #
from car import Car
class Battery:
"""A simple attempt to model a battery for an electric car."""
def __init__(self, batt... | true |
3636835297f10e3ab1d0327f48b6ef78f976d4e5 | jinchen-hu/AStar-Mtl-crime | /src/run.py | UTF-8 | 7,742 | 3.375 | 3 | [] | no_license | # -----------------------------------------------------
# Assignment 1
# Written by Jinchen Hu - 40080398
# For COMP 472 Section ABIX - Summer 2020
# -----------------------------------------------------
import readMap as rm
import numpy as np
import aStar
import signal
# Define a timeout exception
class TimeOutExce... | true |
41ffd6845921b9c0a5ca288b20b852d06953cf3f | Wlgls/MovieRecommender | /MovieRecommend/login/views.py | UTF-8 | 4,693 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Time : 2020/05/13 20:24
@Author : 彭友
@Version1.0 : 实现了整个网站的较完善的验证用户登录状态逻辑
@Version2.0 : 主要实现了高可靠的密码保护(加密存储)以及数据有效性的验证
@Version3.0 :改变了登录页面的url,去除了多余的前缀,适应发布在云服务器上的要求
@File : views.py
@Software: PyCharm
@Contact : peeeyiii@163.com
"""
from dja... | true |
41cfb579491d5941aeae6b269b4c13091789dc40 | jrluecke95/python-mapping | /letter_histogram.py | UTF-8 | 265 | 3.65625 | 4 | [] | no_license | string = input("what word(s) would you like me to count for you today?")
word_count = {}
for letter in string:
if letter not in word_count:
word_count[letter] = 1
elif letter in word_count:
word_count[letter] += 1
print(word_count)
| true |
44dd6a05fbeab3e6c126cc185c592c2e08256e34 | Abhinandhan2000/Python-programs | /func1.py | UTF-8 | 529 | 4.03125 | 4 | [] | no_license | #Function without parameter
def fun():
print("LOL")
fun()
#Function with parmeter
def fun1(a):
b=a+1
print(b)
fun1(3)
#Function with parameters
def fun2(a,b,c):
h=a+b
print(a)
print(b)
print(h)
print(c)
fun2(5,3,"HAHA")
#Function with default parameter.
def fun3(a=5,b="nah"):
print(a)
a=a+6
print(a)
prin... | true |
b089deaa2fd86f0a0f3d58385a0ea1fef8113c7d | lianxiaolei/lse-model | /plot.py | UTF-8 | 633 | 2.96875 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
from matplotlib import pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = Axes3D(fig)
X1 = np.arange(0.01, 0.99, 0.01).reshape(1, -1)
X2 = np.arange(0.01, 0.99, 0.01).reshape(1, -1)
Y = np.random.randn(X1.shape[0], X1.shape[1])
Y[... | true |
c10eb123a1e181f5e402080556fafc5c29587a1c | AndyLaBorde/python_nov_2017 | /Andy_LaBorde/Dic_Basics/dicBasics.py | UTF-8 | 150 | 3.46875 | 3 | [] | no_license | myDict ={'name':'Andy', 'age':'24', 'country of birth':'Texas', 'favorite language':'Spanish'}
for x,y in myDict.iteritems():
print 'My '+x+' is '+y | true |
6c3fb402bdbcaebedfb9650274315f0ebd056f02 | xtanmaygarg/HackerRankSolutions | /Python/Regex & Parsing/Group(), Groups() & Groupdict().py | UTF-8 | 104 | 2.78125 | 3 | [] | no_license | import re
S = input()
X = re.findall(r'([a-zA-Z0-9])\1+', S)
if X:
print(X[0])
else:
print(-1)
| true |
e8d4dffd1b975c7dddbe491e557a700a4aff58d6 | rothman857/chronometer | /src/chronometer/tools/cal.py | UTF-8 | 2,962 | 2.609375 | 3 | [
"MIT"
] | permissive | from datetime import datetime
from chronometer.tools import timeutil, abbr
from itertools import accumulate
def julian_date(date: datetime, reduced: bool = False) -> float:
a = (14 - date.month) // 12
y = date.year + 4800 - a
m = date.month + 12 * a - 3
jdn = date.day + (153 * m + 2) // 5 + y... | true |
220df3d73f079f665b0bae6692042336fd986cba | bonkstok/python | /flask/udemy/first-rest.py | UTF-8 | 653 | 3.25 | 3 | [] | no_license | from flask import Flask
app = Flask(__name__) #special python variable, give each file a unique name.
#which requests does this app need to serve / understand
@app.route("/first")
@app.route("/also") #localhost/first, in programming this is called a 'route'
def first(): # name does not matter, only the route
def... | true |
dc98510f10b748e3475827c28350d001cd98dfb0 | Tvrr28/Stock-Price-Prediction-Amazon | /app.py | UTF-8 | 3,562 | 3 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun August 1 10:30:00 2021
@author: TVR Raviteja
"""
import pickle
import nltk
import numpy as np
import pandas as pd
import streamlit as st
nltk.download('stopwords')
from nltk.corpus import stopwords
from scipy import stats
nltk.download('vader_lexicon')
... | true |
017fb3c4e8541c33f4a19affc4b875018954e336 | estomagordo/flask-url-shortener | /main.py | UTF-8 | 3,927 | 3.09375 | 3 | [] | no_license | from base64 import b64encode
from hashlib import blake2b
import random
import re
from flask import Flask, abort, jsonify, redirect, request
app = Flask(__name__)
def url_valid(url):
"""Validates a url by parsing it with a regular expression.
Parameters:
url - string representing a url to be validated.
... | true |
8ea487bbcc8575150d31bac81d2672951ce44f42 | PoojaA14/Weather-deatils-using-Python | /main.py | UTF-8 | 342 | 3.0625 | 3 | [] | no_license | import json
from urllib.request import urlopen
city = input("Enter City Name: ")
mykey = "e0f598fa1262a8b47cf92e164b16256b"
url = "https://openweathermap.org/"
url = url+"data/2.5/weather?appid="
url = url+mykey+f"&q={city}"
response = urlopen(url)
decoded = response.read().decode('utf-8')
data = json.loads(decoded)
fo... | true |
eaaf48240adb865c9fd491b845f1257a788cd91a | cuiboautotest/jianzhioffer | /面试题51 数组中的逆序对.py | UTF-8 | 1,745 | 3.640625 | 4 | [] | no_license | '''
题目描述
在数组中的两个数字,如果前面一个数字大于后面的数字,则这两个数字组成一个逆序对。
输入一个数组,求出这个数组中的逆序对的总数P。并将P对1000000007取模的结果输出。 即输出P%1000000007
'''
import sys
sys.setrecursionlimit(1000000)
class Solution:
def InversePairs(self, data):
if not data :
return 0
Copy = [i for i in data]
count = self.InversePairsCor... | true |
25fbd7d753f23fc95ed8dfbc19de7ad5e4cb56eb | AlexanderMinakov/Summer20 | /2.HomeTask2.Part2.py | UTF-8 | 6,446 | 2.625 | 3 | [] | no_license | import cv2
import numpy as np
import os
import time
def TemplateMatching():
filename = 'plan.png'
img = cv2.imread(filename)
img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
img_resized = cv2.resize(img_gray, None, fx = 1/6, fy=1/6)
# cv2.imshow('img', img_resized)
# cv2.waitKey(0)
# inde... | true |
dbd512e27d6e9c41944f9c7fd27ce372ec492a20 | linruohan/my_study | /GUI/eric/guagame/Mypygame.py | UTF-8 | 1,610 | 3.296875 | 3 | [] | no_license | import pygame # 导入pygame库
from pygame.locals import * # 导入pygame库中的一些常量
from sys import exit # 导入sys库中的exit函数
# 有些模块可能在某些平台上不存在,你可以用None来测试一下。
if pygame.font is None:
print("The font module is not available!")
exit()
# 定义窗口的分辨率
SCREEN_WIDTH = 480
SCREEN_HEIGHT = 640
# 初始化游戏
pygame.init() # 初始化pygame
scree... | true |
5cbd27ab9f53ebdd32432433a8cf855ce708df4e | UWrc/cloud-pfs | /benches/calculateIOPs.py | UTF-8 | 1,890 | 3.109375 | 3 | [] | no_license | #!/usr/bin/env python3
# This script calculates and displays minimum, maximum, and average 4K IOPS for all of the files in its directory.
# Each file should be named in the format gpfs-iozone-$THREADCOUNTthreads.out where $THREADCOUNT is the number of threads used.
# Each file should contain a bunch of IOzone tests ra... | true |
29e9a2d3a74ae0617ff3451a66802b9c6d4255cf | luoken/Shoe-detector | /example.py | UTF-8 | 533 | 2.71875 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
#my url
url = 'https://www.shopwss.com/mens-shoes/all-mens-shoes.htm?sort=S#pageSize=144'
#getting the page with the url
page = requests.get(url)
#beautiful soup will grab everything
soup = BeautifulSoup('wsspg1.txt', 'html.parser')
a_tags_pi = soup.find_all('a', class... | true |
54cfddc54080084d54044870a98306221edeb60b | mrmoore6/Module-1-Py-2 | /Input_Functions.py | UTF-8 | 1,156 | 3.546875 | 4 | [] | no_license | from statistics import mean
def user(number = 0):
bad_input = False
my_list = []
user_num = input("Enter Number of Intergers")
if user_num.isdigit():
user_num = int(user_num)
else:
bad_input = True
try:
while bad_input == True:
user_num = int(input... | true |
d15be1e38448536a736be49ab25c75865202f2a6 | merimus/coding-bootcamp | /euler/merimus/42/42.py | UTF-8 | 455 | 3.765625 | 4 | [] | no_license |
f = open('words.txt', 'r')
file = f.read()
f.close()
base = ord('A') - 1
def value(word):
# 19 11 25
sum = 0
for char in list(word):
sum += ord(char) - base
return sum
triangles = set()
for i in range(1, 100):
triangles.add((i * (i + 1)) / 2)
number = 0
words = file.replace('"', '').spli... | true |
c231e79b1fe8123d80ffe16b30ba56f5bdc5aa48 | TdotA/Python_for_CS1 | /MyScripts/disemvowling.py | UTF-8 | 1,107 | 3.59375 | 4 | [] | no_license | def disemvoweling (text) :
vowels = ''
txt = ''
i = 0
while i < len(text) :
if text[i] in 'aeiouAEIOU' :
vowels = vowels + text[i]
else:
txt = txt + text[i]
i = i + 1
return (txt + vowels)
#print (disemvoweling("Banana is good!"))
def f... | true |
03195068c1420bc6220256b5bacb60d9c7039368 | Aasthaengg/IBMdataset | /Python_codes/p03049/s526636844.py | UTF-8 | 714 | 2.9375 | 3 | [] | no_license | MOD = 10 ** 9 + 7
INF = 10 ** 11
import sys
sys.setrecursionlimit(100000000)
def main():
N = int(input())
S = [input() for _ in range(N)]
cnt = 0
ba = 0
a = 0
b = 0
for s in S:
for i in range(len(s) - 1):
if s[i] == 'A' and s[i + 1] == 'B':
cnt += 1
... | true |
0bd1b93a0176815ad57f1a93736fd7fa6aa74423 | cstoner/adventofcode | /2015/day3.py | UTF-8 | 1,177 | 3.703125 | 4 | [] | no_license | #!/usr/bin/python
with open("day3_data.txt") as f_hdl:
data = f_hdl.read()
def get_plot(data):
curr_x = 0
curr_y = 0
plot = {}
plot[(0, 0)] = 1
for c in data:
if c == '>':
curr_x += 1
elif c == '<':
curr_x -= 1
elif c == '^':
curr_y +... | true |
fb1119f2f7e66df8ed4d4a9649720da44977d8b3 | fanninnypeom/tp | /model/gru.py | UTF-8 | 2,671 | 2.515625 | 3 | [] | no_license | import torch
import torch.nn as nn
#device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
class EncoderGRU_GAT(nn.Module):
def __init__(self, device, hidden_size = 128, embedding_size = 64, output_size = 1, batch_size = 100):
super(EncoderGRU, self).__init__()
self.device = device
# self.gr... | true |
b17ca48e0a11ee1f6d33fc2f10242536fb603afb | magasaniganeshkumar/PythonLibraries | /Numpy/one_dim_numpy_array.py | UTF-8 | 426 | 4.28125 | 4 | [] | no_license | # Write a Python program to convert a list of numeric value into a one-dimensional NumPy array
# importing the numpy library and change the numpy as a np
import numpy as np
# define one list of elements
list1 = [12.23, 13.32, 100, 36.32]
# printing the list of elements
print("Original List:", list1)
# converting list1... | true |
92b5df1653bc580e081f8d6e94232f8ccbcbbe4c | justDabuK/HeatSense | /temp_led_mail.py | UTF-8 | 1,380 | 2.796875 | 3 | [] | no_license | from Adafruit_BME280 import *
from strandtest import *
from neopixel import *
from send_email import sendemail
def main():
sensor = BME280(t_mode=BME280_OSAMPLE_8, p_mode=BME280_OSAMPLE_8, h_mode=BME280_OSAMPLE_8)
print "Initialized sensor"
strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DM... | true |
68bdec5036db34efe2f5b589a7bafbcfacb1529f | GregoryMu/M-NCPPC-Planning-Department | /calcPhone.py | UTF-8 | 1,006 | 2.890625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# calcPhone.py
# Created on: 2018-06-08 10:01:41.00000
# (generated by ArcGIS/ModelBuilder)
# Description: This script will convernt a Telephone of a shapefile from
# xxx-xxx-xxxx format to +1-xxx-... | true |
a6f594fd7076ff1d20544c8805808112ea67d48a | eth-cscs/PythonHPC | /f2py/distance-f90-pythonized/test_edm.py | UTF-8 | 826 | 3.34375 | 3 | [
"BSD-3-Clause"
] | permissive | import time
import numpy as np
from metrics.edm import euclidean_distance_matrix
def euclidean_numpy(x, y):
"""Euclidean square distance matrix.
Inputs:
x: (N,) numpy array
y: (N,) numpy array
Ouput:
(N, N) Euclidean square distance matrix:
r_ij = (x_ij - y_ij)^2
"""
x2 = np.ein... | true |
1938a87af8e065a37ff8fdebbfe0f696f194bb8d | PamelinaDu/Pico_Y_Placa_Predictor | /functions/validation_functions.py | UTF-8 | 2,555 | 3.390625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu May 6 01:03:43 2021
@author: Pamela Dután
"""
import datetime
import calendar
def is_valid_license(license_plate_str):
if not len(license_plate_str) in range(7, 9): # Valid string size
return False
else:
license_groups = license_plate_str.split("... | true |
bf8034a30a4e5a28a114e801c2427dd6bab56eb9 | linuxcumt/OutlierGenerator | /scripts/transplant_poses.py | UTF-8 | 1,021 | 2.84375 | 3 | [] | no_license | #!/usr/bin/python
from __future__ import print_function
import argparse
import sys
from utils import DefaultHelpParser
if __name__ == "__main__":
parser = DefaultHelpParser(description='Transplant vertex poses from one g2o file to another.')
parser.add_argument("input", type=argparse.FileType('r'), help = "g2o f... | true |
2014dbdbcecca39c0b4f114df88ee8a13f3c66e0 | umcamaleao/finance | /cortar_gastos.py | UTF-8 | 773 | 3.265625 | 3 | [] | no_license | from itertools import accumulate
def patrimonio_anual(anos, inicial, corte_por_ano, juros):
renda_anual = [inicial] + [corte_por_ano for _ in range(anos)]
return list(accumulate(renda_anual, lambda total, anual: total*juros + anual))
def cozinhar(anos, inicial=1000, corte_por_ano=1820):
return patrimonio_anual(ano... | true |
d6b9f98d6c7fa03f1378010c4fedcd35aeca1ba1 | Yuvv/LeetCode | /1101-1200/1185-day-of-the-week.py | UTF-8 | 2,405 | 3.6875 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @File : 1185-day-of-the-week.py
# @Date : 2019/10/19
# @Author : Yuvv <yuvv_th@outlook.com>
class Solution:
DAYS_CUM = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]
WEEKDAYS = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Sa... | true |
1870d5d3d52b45bcdf737b5dfadb6e8a3792fe00 | shafali731/SoftDev2 | /20_anon-reduce/book.py | UTF-8 | 940 | 3.28125 | 3 | [] | no_license | #Team Jellyfish -- Shafali Gupta & Matthew Ming
#SoftDev02Pd08
#K20 -- Reductio ad Absurdum
#2019-04-17
from functools import reduce
file = open("16.txt",'r')
a=[j for x in file.readlines()for j in x.split()]
##print(a)
def freq_single(n):
b=[x for x in a if x==n]
return len(b)
print(freq_single("the"))#Expec... | true |
30bf7129477dac688446a2707d288ad7235a0561 | lukeoluoch/urpython | /Superheroes Sales Data Analysis.py | UTF-8 | 28,882 | 3.796875 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# The Statistics of Superheroes
# ====
# CHE 116: Numerical Methods and Statistics
#
#
# *Luke Oluoch*
#
# ## Overview
# In recent years, it seems as though media has gone through a superhero renaissance. During the 1990s, which had Marvel Comics filing for bankruptcy and DC C... | true |
2cb0988bca4c75d47179ce5d0625613468701acb | af-inet/misc | /pyaudiotemplate/main.py | UTF-8 | 2,101 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python
#
import collections
import threading
import time
import pyaudio
import array
import time
# https://docs.python.org/2/library/array.html
# type code | c type
# 'c' char
# 'b' signed char
# 'B' unsigned char
# 'u' Py_UNICODE
# 'h' signed short
# 'H' unsigned short
# 'i' signed int
# 'I' un... | true |
382dd8cd00fecaa864da107d6c50fd89c3752a42 | Deblisus/-SDB-Final-Rotar-Rafael | /ui.py | UTF-8 | 2,703 | 3.75 | 4 | [] | no_license | from service import Service
from entities import Book
class UI():
def __init__(self, service):
''' Constructor
service: serviciul pentru aplicatie
'''
self.__service = service
def __add_book(self):
print("\n")
title = input("Introduceti titlul cart... | true |
fa23dda437da2a90c612e13c9682f1c9a060e62d | gabriellaec/desoft-analise-exercicios | /backup/user_144/ch117_2020_03_23_19_34_57_261220.py | UTF-8 | 161 | 2.71875 | 3 | [] | no_license | from math import sin, asin, radians
def snell_descartes(n1,n2,θ1):
teta = radians((sin(θ1)) * n1) / n2
teta2 = radians(asin(teta))
return teta2
| true |
d772c1882fdfcf70fb671aa75fc0a4a7e4075848 | JiangHuYiXiao/Web-Autotest-Python | /第七章-测试框架之数据驱动应用/数据驱动_mysql08/test_mysql_ddt.py | UTF-8 | 778 | 2.5625 | 3 | [] | no_license | # -*- coding:utf-8 -*-
# @Author : 江湖一笑
# @Time : 2020/6/26 9:11
# @Software : Web-Autotest-Python
# @Python_verison : 3.7
'''
使用ddt+unittest读取mysql数据
'''
import unittest, ddt
import pymysql
from mysql_data import MysqlData
from mysql_init import MysqlInit
def get_mysql_data():
MD = MysqlDat... | true |
050e3de36f70778b37feda2d423565860e3eb4c9 | akrherz/DEV | /usda/corn.py | UTF-8 | 2,796 | 2.59375 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | # VT 1135
# R2 1660
import datetime
import iemdb
import mx.DateTime
import numpy as np
from scipy import stats
COOP = iemdb.connect("coop", bypass=True)
ccursor = COOP.cursor()
years = []
yields = []
for line in open("/home/akrherz/Downloads/corn.csv"):
tokens = line.split(",")
years.append(float(tokens[0]))... | true |