blob_id large_string | language 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d907d58d96d89dae7c7aed5d1b6018504a7c8906 | Python | MaEvGoR/datamining_project | /Spectrum.py | UTF-8 | 13,129 | 2.765625 | 3 | [] | no_license | import math
import numpy as np
class Spectrum:
def __init__(self, price_step):
self.price_step = price_step
self.buy_bins = []
self.all_buy_bins = []
self.all_buy_volumes = []
self.all_sell_bins = []
self.all_sell_volumes = []
self.sell_bins = []
sel... | true |
0bfc3a6dedfd160096540ca46b1ab7c7f55db3a5 | Python | SandaruwanWije/cryptography | /ceasar_cipher/ceasar_cipher.py | UTF-8 | 2,180 | 3.1875 | 3 | [] | no_license | import sys
def help():
print("python3 ceasar_cipher.py -e -m \"Enter Mesage Here\" -k 3")
print("python3 ceasar_cipher.py -d -c \"ciper text\" -k 3")
print("-k should me 0 26")
def encrypt(msg, key):
cipher = ""
for letter in msg:
int_ltr = ord(letter)
if int_ltr > 64 and int_ltr < ... | true |
4e95a9a726881c765106344fca263a5f0118729e | Python | ifebuche/2NYP-DS-Project | /onboard.py | UTF-8 | 2,991 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Oct 30 2020 11:13:37
Updated on Sat Oct 31, 2020 11:14:29
@author: Fesh
"""
###################################################################################
##1. This Script finds and assembles all Excel files sent over by streamers which are products of meating.py
##2. Th... | true |
ae7ecfd0f92e3e8ab0323f456b5f4cb4513172e0 | Python | lipug/misc | /tinkering/background_tasks.py | UTF-8 | 5,594 | 3.234375 | 3 | [] | no_license | import asyncio, socket
def schedule_coroutine(target, *, loop=None):
"""Schedules target coroutine in the given event loop
If not given, *loop* defaults to the current thread's event loop
Returns the scheduled task.
"""
if asyncio.iscoroutine(target):
return asyncio.ensure_future(target, ... | true |
ec0d764500c36af6b6dfbad031c0470922b8d7a0 | Python | jtsw1990/oop_vending_machine | /main.py | UTF-8 | 2,066 | 2.515625 | 3 | [
"MIT"
] | permissive | from vending_machine.vending_machine import DataReader, VendingMachine
from vending_machine.customer_simulation import CustomerArrival, CustomerChoice
import time
import datetime
import csv
from datetime import datetime
import os
import json
with open("config.json") as f:
config = json.load(f)
PERIOD_IN_HOURS =... | true |
581934820e5e49bec35507639f3ffda488b1f4f9 | Python | GazzolaLab/PyElastica | /examples/RigidBodyCases/RodRigidBodyContact/post_processing.py | UTF-8 | 28,770 | 2.59375 | 3 | [
"MIT"
] | permissive | import numpy as np
from matplotlib import pyplot as plt
from matplotlib import cm
from typing import Dict, Sequence
from tqdm import tqdm
def make_data_for_cylinder_along_y(cstart, cradius, cheight):
center_x, center_z = cstart[0], cstart[1]
y = np.linspace(0, cheight, 5)
theta = np.linspace(0, 2 * np.pi,... | true |
81119c5abb6f84b2f51c1e3a9b5ac9837cb0bcd3 | Python | YuRiTan/rsgeo | /rsgeo-py/tests/test_rsgeo.py | UTF-8 | 391 | 2.515625 | 3 | [
"MIT"
] | permissive | import numpy as np
from rsgeo import contains, distance # noqa
def test_contains(polygon_coords, xs, ys):
result = contains(polygon_coords, xs, ys)
np.testing.assert_array_equal(result, [False, False, False, True])
def test_distance(polygon_coords, xs, ys):
result = distance(polygon_coords, xs, ys)
... | true |
825fc032cadd4974322b076d5c7a57a28d65eee5 | Python | yanghun-park/PowerShell-Token-Analyzer | /PSDecode.py | UTF-8 | 2,930 | 3.234375 | 3 | [] | no_license | import subprocess, locale
# -----------------------------------------------------------------------------------------------
# 1. PSDecode (File): Decryption module using PSDecode
# Return value (String): 0 - When decryption fails / [String] - When decryption
# Translation : 2021/04/29
# -------------------------... | true |
1a20789533f1e35f8e68120eaf8044c959a5f969 | Python | Aasthaengg/IBMdataset | /Python_codes/p03416/s073236091.py | UTF-8 | 154 | 3.078125 | 3 | [] | no_license | a,b = map(int, input().split())
ans = 0
for i in range(a,b+1):
s = str(i)
hl = len(s)//2
if s[:hl]== s[-1:-1-hl:-1]:
ans+=1
print(ans) | true |
e1081ee92a93c1c0d02369a5484c5e8604108619 | Python | kmilewczyk96/zadania_dodatkowe | /closest_power.py | UTF-8 | 427 | 3.109375 | 3 | [] | no_license | def closest_power(base, num):
result = 0
powered = 0
while powered < num:
powered = base ** result
result = result + 1
if ((base ** (result - 2)) + powered) / 2 >= num:
return result - 2
return result - 1
if __name__ == '__main__':
assert closest_power(3, 6) == 1
... | true |
db2e0abdeb0f39a35fe7afc3799610322806a52a | Python | totomz/docker-tasker | /tasker/examples/SimpleSum.py | UTF-8 | 1,166 | 3.09375 | 3 | [
"MIT"
] | permissive | import logging
import sys
import os
from tasker.master.Master import Master
from dotenv import load_dotenv
load_dotenv()
logging.basicConfig(level=logging.INFO, handlers=[logging.StreamHandler(sys.stdout)])
def supply():
n = 1
while n <= 10:
task = {
"id": "test-{}".format(n),
... | true |
db9ad58d9f0b19396c6d9d75c7004698881c20ff | Python | YangForever/COP514Group | /guifinal/cwgui/gui_readpic.py | UTF-8 | 423 | 2.78125 | 3 | [] | no_license | from PIL import Image
import numpy as np
def readPic(filename):
im = Image.open(str(filename))
# im.show()
pix = im.load()
x = im.size[0]
y = im.size[1]
temp = []
for i in range(x):
for j in range(y):
temp.append(pix[j,i])
return ''.join(s for s in str(temp).split(', '))
# temp = np.asarray... | true |
2a8395863917a8f6771b5bfec569e2f10ab3f5e7 | Python | rds504/AoC-2020 | /solutions/day16.py | UTF-8 | 3,105 | 3.109375 | 3 | [
"MIT"
] | permissive | import re
from functools import reduce
from operator import mul
from tools.general import load_input
class ValidValues:
def __init__(self, bounds):
self._lo1, self._hi1, self._lo2, self._hi2 = [int(bound) for bound in bounds]
def __contains__(self, value):
return self._lo1 <= value <= self._h... | true |
2102505bbbe24a5cd7136c4b066da59739f9889f | Python | indahwlnlstr/apd | /postest2.py | UTF-8 | 1,052 | 3.859375 | 4 | [] | no_license | #operasi aritmatika
print("Hello,""Selamat Datang")
def print_menu():
print(30 * "-", "MENU", 30*"-")
print("1. Menghitung Luas Balok")
print("2. Menghitung Konversi Suhu")
print("3. Menghitung Volume Kerucut")
print_menu()
pilihan = int(input("Masukkan Pilihan: "))
if pilihan == 1:
p ... | true |
8d9976b103e8fd867701953efaba9446eaad818c | Python | JHWu92/public-safety-baltimore | /src/vis/map.py | UTF-8 | 4,248 | 2.796875 | 3 | [] | no_license | # coding=utf-8
import folium
from folium.plugins import MarkerCluster, FastMarkerCluster
def add_common_tiles(m):
folium.TileLayer('Stamen Terrain').add_to(m)
folium.TileLayer('Stamen Toner').add_to(m)
folium.TileLayer('Stamen Watercolor').add_to(m)
folium.TileLayer('CartoDB dark_matter').add_to(m)
... | true |
38e0294a57e9ff531cedc73ddaa99920b20372a1 | Python | renzildourado/Capstone_Project | /building_model.py | UTF-8 | 4,390 | 2.671875 | 3 | [] | no_license | import pandas as pd
import scipy
from sklearn import tree
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from sklearn.metrics import confusion_matrix
from sklearn.ensemble import RandomForestClassifier
from sklearn.neighbors import KNeighborsClassifier
from sklearn.naive... | true |
8717be7555a09846b66b0284714f50ca3294d655 | Python | uuuChen/PLAYGROUND-Seq2SeqTranslation | /data_loader.py | UTF-8 | 6,436 | 2.828125 | 3 | [] | no_license | import random
import torch
from torch.autograd import Variable
class Vocabulary:
def __init__(self, text_file_path):
# initialize parameter
self.word2idx = dict()
self.sequences = list()
self.indices = list() # corresponding indices of sequences
self.max_length = 0
... | true |
216dcf1594bf48a9315420124c36b351ea78237a | Python | AbhiniveshP/CodeBreakersCode | /10 - DP/CoinChangeMinCoins.py | UTF-8 | 1,322 | 2.84375 | 3 | [] | no_license | class Solution:
def coinChange(self, coins: List[int], amount: int) -> int:
# edge cases
if (amount == 0):
return 0
if (coins == None or len(coins) == 0):
return -1
# if not possible => inf coins required => initialize with +inf
... | true |
a31fe550eefbc862b2219827d9a900a613448182 | Python | nlp-study/zhihu_competition | /tools/word_freq_2_doc.py | UTF-8 | 3,242 | 2.8125 | 3 | [] | no_license | '''
Created on 2016年5月5日
@author: Zhang Xiulong
'''
import codecs
from tools.list_operation import *
def trans_word_freq_2_doc(input_path,output_path):
word_freq_map = {}
processed_word_freq_map = {}
generated_str = []
max_value = 0
min_value = 0
read_file = codecs.open(input_path,'r','utf-8')... | true |
e94a5b20a17e8083c212340ee91f5f6863edea4a | Python | CSI-Woo-Lab/gym-rock-paper-scissors | /gym_rock_paper_scissors/envs/rock_paper_scissors.py | UTF-8 | 5,213 | 2.65625 | 3 | [] | no_license | import gym
import numpy as np
from gym import spaces
ROCK = 0
PAPER = 1
SCISSORS = 2
NULL_ACTION = 3
RENDER_MAP = {0: "@", 1: "#", 2: "%"}
class RockPaperScissorsBaseEnv(gym.Env):
optimal_winning_rate = None
def __init__(self) -> None:
self.action_space = spaces.Discrete(3)
self.observation_... | true |
b67a4655ff598645cfa41ae7e3249cb26b42d682 | Python | haavardtysland/IDATT2502 | /1/b/MultipleLinearRegressionModel.py | UTF-8 | 540 | 2.75 | 3 | [] | no_license | import torch as to
class MultipleLinearRegressionModel:
def __init__(self):
self.W_1 = to.tensor([[0.0]], requires_grad=True)
self.W_2 = to.tensor([[0.0]], requires_grad=True)
self.b = to.tensor([[0.0]], requires_grad=True)
def f(self, length, weight):
return (length @ self.W_1) + (weight @ self... | true |
928ed1df7c5e78bb955bd7bdaa47def63f27043f | Python | shivamnegi1705/Competitive-Programming | /Leetcode/Weekly Contest 210/1614. Maximum Nesting Depth of the Parentheses.py | UTF-8 | 685 | 3.484375 | 3 | [] | no_license | # Question Link:- https://leetcode.com/problems/maximum-nesting-depth-of-the-parentheses/
class Solution:
def maxDepth(self, s: str) -> int:
# stack to push (
st = []
# number of ( in stack
n = 0
# ans --> to store max depth
ans = 0
... | true |
3eccbf6381055b09e523d2a7c56ab1beb1c872b2 | Python | bgoesswe/openeo-repeatability | /backend/openshift-old/services/user/service/api/api_validation.py | UTF-8 | 1,435 | 3.109375 | 3 | [
"Apache-2.0"
] | permissive | ''' API Payload Validation '''
from re import match
from service.api.api_exceptions import ValidationError
def validate_user(payload):
''' Ensures that the structure of a process spec is correct. '''
if "username" not in payload:
raise ValidationError("'username' is missing.")
if not match(r"^\w... | true |
d267d2e400aff73d994bfc735f341074084a514c | Python | shimech/instance-builder | /instance_builder/setter.py | UTF-8 | 1,019 | 3.453125 | 3 | [
"MIT"
] | permissive | from typing import Callable, TypeVar
from .lib import find_attributes
T = TypeVar("T")
def setter(Class: type) -> type:
"""Setter method generator
Setter methods are generated by decorating class with this function.
Args:
Class (type): Class which you want to generate setter methods.
Retu... | true |
a125d8674dec2e56ae8ace77b634713bf6062a71 | Python | paulrschrater/design2align-scanner | /kicd/validation.py | UTF-8 | 8,217 | 2.796875 | 3 | [
"MIT"
] | permissive | ##################################################
# MIT License
#
# Copyright (c) 2019 Learning Equality
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including with... | true |
093cd0197d1e74a0ee20f4c6bead6b84fcce7c13 | Python | tylergallen/fantasyfootballapp | /classes/team_class.py | UTF-8 | 342 | 3.453125 | 3 | [] | no_license | class Team:
number_of_teams = 0
def __init__(self, code, fullName, shortName):
self.code = code
self.fullName = fullName
self.shortName = shortName
Team.number_of_teams += 1
def add_bye_week(self, byeWeek):
self.byeWeek = byeWeek
def display_number_of_teams():
print (f'Total number of teams in the NF... | true |
1eabf5cf7f4781d061ce1deb14aa95a55734f12e | Python | kurff/pytorch | /third_party/ideep/python/ideep4py/tests/mm/test_mdarray3_mm.py | UTF-8 | 1,422 | 2.671875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause",
"LicenseRef-scancode-generic-cla",
"Apache-2.0",
"BSD-2-Clause"
] | permissive | import numpy
import ideep4py
import testing
import unittest
@testing.parameterize(*testing.product({
'dtype': [numpy.float32],
'shape': [(3, 16, 2, 4), (2, 7, 1, 1),
(2, 7, 3, 2), (2, 2, 2, 2), (3, 4), (1, 1)],
}))
class TestMdarray3(unittest.TestCase):
def setUp(self):
self.x = nump... | true |
23cd688ed052680d79596f915b9e68fbb4b4f74b | Python | puyamirkarimi/quantum-walks | /Max2SAT_graphs/inf_time_probability_histograms.py | UTF-8 | 3,035 | 2.890625 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
import numpy as np
def average_data(data):
num_repeats = len(data[:, 0])
num_x_vals = len(data[0, :])
y_av = np.zeros(num_x_vals)
y_std_error = np.zeros(num_x_vals)
for x in range(num_x_vals):
y_av[x] = np.mean(data[:, x])
y_std_error[x] = np.std(da... | true |
fbebd785339375c43040c0fd62be57b743812be0 | Python | sourabhshete99/HackerRank-Programs | /diagonaldiff.py | UTF-8 | 890 | 3.546875 | 4 | [] | no_license | #!/bin/python3. Given a matrix, calc the difference between the diagonal elements
import math
import os
import random
import re
import sys
#
# Complete the 'diagonalDifference' function below.
#
# The function is expected to return an INTEGER.
# The function accepts 2D_INTEGER_ARRAY arr as parameter.
#
... | true |
10dd56e6b966545c6f3945c5364ef45367de1f98 | Python | Duisus/allure-python | /allure-pytest-bdd/test/links_tests/conftest.py | UTF-8 | 711 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | from pytest_bdd import then, parsers
@then(parsers.parse(
"report has link type of {type_name} with url:\n{url}"))
def check_link(type_name, url, allure_report):
links = _get_links(allure_report)
desired_link = {"type": type_name, "url": url, "name": url}
assert desired_link in links
@then(parsers.... | true |
5627a94057edcba6eec371ec516b19b20a7949a9 | Python | raviraju/recommender_system | /binary_recommender/recommender/rec_popularity_based.py | UTF-8 | 8,659 | 2.734375 | 3 | [] | no_license | """Module for Popularity Based Recommender"""
import os
import sys
import logging
from timeit import default_timer
from pprint import pprint
import joblib
import pandas as pd
logging.basicConfig(level=logging.DEBUG)
LOGGER = logging.getLogger(__name__)
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(... | true |
919a7b0f89a1ebab1c204204af6ec5fef083ce88 | Python | basharSaid/Python | /While-Schleife.py | UTF-8 | 251 | 3.21875 | 3 | [] | no_license | #zufallsgenerator
import random
random.seed()
# Initialisirung
summe = 0
# Whlie-Schliefe
while summe < 30 :
zzahl = random.randint(1, 10)
summe = summe + zzahl
print("zahl:", zzahl, "Zwischensumme", summe)
# Ende
print("Ende")
| true |
31f370dfecd34ce28ab7d63681dc76f2808e7af8 | Python | xiaoyaoshuai/- | /作业/7.17/038idcard.py | UTF-8 | 641 | 4.09375 | 4 | [] | no_license | '''
创建一个名称为idcard.py的文件,然后在该文件中定义3个字符串变量,分别记录两个程序员说话,再从程序员甲说的身份证号码中截取出生日日期,并组合成"YYYY年MM月DD日"格式的字符串将两个字符串拼接到一起,并且在中间拼接一个转义字符(换行符),最后输出,输出截取到的出生日期
'''
c = '程序员甲说:你知道我的生日么?'
b = '程序员乙说:输入你的身份证号'
print(c)
print(b)
a = input('程序员甲说:')
print('你的出生日期是%s年%s月%s日,所以你的生日是%s月%s日'%(a[6:10],a[10:12],a[12:14],a[10:12],a[12:14]))
| true |
15e83d3c89b98172846bc716a814f2b510695797 | Python | eridanletalis/Python | /stepik/base_course_1/file_reading/school_data/school_data.py | UTF-8 | 710 | 3.25 | 3 | [] | no_license | s = []
d = {}
with open('in.txt', 'r') as file_reader:
for line in file_reader:
for i in line.strip().lower().split(';'):
s.append(i)
for i in range(len(s)):
if i == 0:
d[s[i]] = []
else:
d[s[0]].append(int(s[i]))
s.clear()
... | true |
96c6a1824bb4cd7d6cb752aa14b442e121dcef0b | Python | m1ghtfr3e/Competitive-Programming | /Leetcode/Python/April-30-day-Challenge/moveZero_2.py | UTF-8 | 325 | 3.3125 | 3 | [] | no_license |
def moveZero(nums):
x = 0 # we use it as a pointer
for i in nums:
if i != 0:
nums[x] = i
x += 1
for i in range(x, len(nums)):
nums[i] = 0
return nums
if __name__ == '__main__':
print(moveZero([0,1,0,3,12]))
print(moveZero([0,0,... | true |
57f3a8a792694f098cac5c9d838d457690e4f58a | Python | Danucas/holbertonschool-higher_level_programming | /0x07-python-test_driven_development/2-matrix_divided.py | UTF-8 | 1,128 | 3.921875 | 4 | [] | no_license | #!/usr/bin/python3
"""Divides a matrix"""
def matrix_divided(matrix, div):
"""matrix division
Arguments:
arg1 (matrix): the matrix to divide
arg2 (div): number to divide by
"""
if type(div) != int and type(div) != float:
raise TypeError("div must be a number")
if div == 0:
... | true |
794094ca26a13fa89a3dc766a2cf49c2e06e8a3e | Python | dradosevich/SwimScripts | /divegenstate.py | UTF-8 | 2,619 | 3.03125 | 3 | [] | no_license | #Danny Radosevich
#Dive XML Generator
import subprocess as sp
import os
import re
toOpen = input("Enter the file to read from:\n") #prompt user for input
readFrom = open(toOpen) #open file
readFrom = readFrom.read() #read in
readFrom = readFrom.split("\n") #get each individual line
lineNum = 1 #control variable
writeO... | true |
1fb5ea2fed2ee0c5e83c89ab199b0700c8683304 | Python | zxteloiv/AdaNSP | /src/models/transformer/adaptive_computing.py | UTF-8 | 2,996 | 2.828125 | 3 | [] | no_license | from typing import List, Tuple, Dict, Mapping, Optional
import torch
class AdaptiveComputing(torch.nn.Module):
def __init__(self,
halting_fn: torch.nn.Module,
max_computing_time: int = 10,
epsilon: float = 0.1,
mode: str = "basic"
... | true |
c879c4be55fa646b6f909bb49e0cae2873efde91 | Python | KristallWang/LMS8001-PLL-Sim | /src/vco.py | UTF-8 | 14,152 | 2.6875 | 3 | [
"Apache-2.0",
"CC-BY-3.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | from header import *
from plot_funcs import searchF
import pandas as pnd
class vco(object):
"""Represents ideal VCO. F is frequency of oscillation in Hz, and KVCO is tuning sensistivity in Hz/V"""
def __init__(self, name='VCO', F=1.0e9, KVCO=20.0e6, fc=200.0e3, (pn,fpn)=(-121, 1.0e6), noise_floor=-165.0):
self.na... | true |
0a320278c301f722dfbc51a8ef33108428545692 | Python | FlaviaGarcia/Content-Based-Artist-Classifier-using-CNN | /01-Development_code/CV_CNN1_.py | UTF-8 | 11,342 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat May 19 18:54:54 2018
@author: flaviagv
In this script, the training, validation, and test accuracy of a CNN with different inputs has been made. This was in order to compare
what input performs better with this CNN. This CNN is composed by the followi... | true |
786893c4c73aa1b6c103db42df28d7cc07a3dbb5 | Python | qubvel/ttach | /ttach/transforms.py | UTF-8 | 7,977 | 2.796875 | 3 | [
"MIT"
] | permissive | from functools import partial
from typing import Optional, List, Union, Tuple
from . import functional as F
from .base import DualTransform, ImageOnlyTransform
class HorizontalFlip(DualTransform):
"""Flip images horizontally (left->right)"""
identity_param = False
def __init__(self):
super().__i... | true |
47877a9c168037a3c44e1a70a4af0abee53a1a62 | Python | jiaoyasen/interview-witn-X.Wang | /data_generator.py | UTF-8 | 163 | 2.625 | 3 | [] | no_license | import random
import collections
def data_generator(n):#生成随机数list,list长度为n
data= [random.randint(-100,101) for j in range(n)]
return data | true |
48703e2c0e492df310cfd9d8ac79c49d7a2ce511 | Python | Success2014/Leetcode | /multipleStrings_2.py | UTF-8 | 741 | 3.53125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Aug 06 16:26:14 2015
@author: Neo
"""
class Solution:
# @param {string} num1
# @param {string} num2
# @return {string}
def multiply(self, num1, num2):
num1 = num1[::-1]
num2 = num2[::-1]
prodt = [0 for i in range(len(num1)+len... | true |
7351306f117daf1a8ddef75b5ce9007be56829e4 | Python | yochaiz/SmartHome | /Visualization/Microphone.py | UTF-8 | 1,669 | 2.859375 | 3 | [] | no_license | from Device import Device
from datetime import datetime
from Plot import Plot
class Microphone(Device):
keys = {'RmsVolume': 'go', 'MaxVolume': 'bo'}
nullValue = "null"
def __init__(self, filename):
super(Microphone, self).__init__(filename)
def collectData(self, startDate, lambdaFunc):
... | true |
cd4c9a5f4f9dc49140a0f41cf39eea29cb051247 | Python | BenjaminGaymay/trade_2017 | /test_client/data.py | UTF-8 | 2,668 | 3.421875 | 3 | [] | no_license | #!/usr/bin/env python3
##
## EPITECH PROJECT, 2018
## Sans titre(Espace de travail)
## File description:
## data
##
"""
Data class
hold datas
"""
class Data:
"""Class that holds different data"""
def __init__(self):
self.avg = {
'crypto': -1,
'forex': -1,
'stock... | true |
d8d69f8a833bab54478c510940ab1739298a0835 | Python | pombredanne/poodle-lex | /Test/TestLexicalAnalyzer.py | UTF-8 | 6,724 | 2.59375 | 3 | [
"MIT"
] | permissive | # coding=utf8
import sys
sys.path.append("..")
import unittest
from Generator import Automata
from Generator.CoverageSet import CoverageSet
from Generator.RulesFile import AST, NonDeterministicIR, DeterministicIR
def hash_ids(*ids):
rules = set()
for id in ids:
rules.add(hash((id.lower(), ... | true |
3674aa4be7d0d603aaf493259ee7fda75f04295a | Python | kishandongare/genetic-algorithm-tsp | /genetic algorithm tsp.py | UTF-8 | 407 | 3.609375 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[7]:
import random
# # Travelling Salesman problem
#
# # for any sample dataset,implement order encoding for TSP
# In[8]:
def tsp(n):
p = random.sample(range(n),n)
random.shuffle(p)
return p
n_cities = int(input('No. of cities '))
p1 = tsp(n_c... | true |
d5ff7adbacdae1d6e361a37ab34129fae0e064da | Python | fabiovpcaumo/curso-de-python | /semana04/aula02/tests_exercicio_12.py | UTF-8 | 583 | 2.921875 | 3 | [] | no_license | from unittest import TestCase
from exercicio_12 import ContaInvestimento
class TestContaInvestimento(TestCase):
def setUp(self):
self.c = ContaInvestimento(100, 10)
def tearDown(self):
del(self.c)
def test_adicionar_juros_deve_retornar_121_com_100_reais_e_5_meses_e_taxa_10(self):
... | true |
adf323d03d5ec4996f1f492dec2cbfb2cb5469db | Python | Gawesomer/cTest | /run_tests.py | UTF-8 | 3,468 | 3.25 | 3 | [] | no_license | #!/usr/bin/env python3
import argparse
import os
"""
Get command line arguments
params:
none
returns:
taget_file: filename
valgrind: boolean to indicate whether Valgrind should be used
"""
def get_args():
help_text = "Run tests"
parser = argparse.ArgumentParser(description=help_text)
parser.a... | true |
b1fb74f1f33b019e8bebed6f49ea803a1897d273 | Python | MLDL/uninas | /uninas/optimization/metrics/nas/by_value.py | UTF-8 | 3,732 | 2.671875 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
from uninas.optimization.metrics.nas.abstract import AbstractNasMetric
from uninas.register import Register
class ByXNasMetric(AbstractNasMetric):
"""
Calculate metrics based on predicted/true network performance values,
how much the network quality impro... | true |
885f99a98201a27283f39380895a936f8b1622f3 | Python | krish7891/pylearn | /numpy/arr_numeric_range/logspace.py | UTF-8 | 87 | 2.796875 | 3 | [] | no_license | import numpy as np
# default base is 10
a = np.logspace(1.0, 2.0, num = 10)
print a
| true |
89e4b09db4162f7f3fed05adf68062ef72a7e863 | Python | pallaviibhat/hacktoberfest2021 | /Python program/quick_number_exponentiation.py | UTF-8 | 725 | 3.78125 | 4 | [] | no_license | import math
# Get_power: Returns "val" raised to the power of "power" with modulo "mod"
# Does that in O(logN), where N is power to raise number by
def Get_power(val, power, mod):
power = int(power)
val = int(val)
mod = int(mod)
powers = [ 0 for i in range(__next_power_of_2_power(power)) ]
powers[0] = val
for... | true |
8031e53cb481fdf3381c3167c6a3ea2c4713dc0b | Python | 00void00/DSA | /List/reverse.py | UTF-8 | 73 | 3.328125 | 3 | [] | no_license | L = [1,2,4,2,6,5]
print(L)
print("after reversing")
L.reverse()
print(L) | true |
eab468209a68401bd61bb9e41de177fd3cb092cc | Python | timcurrell/dev | /python/IdeaProjects/MyWork/Identifiers.py | UTF-8 | 557 | 3.546875 | 4 | [] | no_license | # Python Identifiers
# Python identifiers must start with an alpha character
# or an underscore. They are case-sensitive. Numerals
# are allowed in the identifier, but no special chars
Tim = 1
tIm = 2
tiM = 3
_tim = 4
_TIM = 5
t_1_m = 6
print(Tim, tIm, tiM, _tim, _TIM, t_1_m)
# By convention, class names start with... | true |
375af0779b68906e41910b67d47763eb4484f311 | Python | Keonhong/IT_Education_Center | /Jumptopy/Jump_to_python/Chapter4/149.py | UTF-8 | 81 | 3.46875 | 3 | [] | no_license | def sum_and_mul(a,b):
return a+b,a*b
result = sum_and_mul(3,4)
print(result) | true |
64ec52fbfe03645548d725d097b18fcc992c5187 | Python | ideoforms/pylive | /live/exceptions.py | UTF-8 | 422 | 2.515625 | 3 | [] | no_license | class LiveException(Exception):
"""
Base class for all Live-related errors
"""
pass
class LiveConnectionError(LiveException):
"""
Error establishing a connection to AbletonOSC.
"""
pass
class LiveIOError(LiveException):
"""
Error accessing a file descriptor.
"""
pass
c... | true |
fced4fb55f654502b328f79d2972911a8a78c1a3 | Python | otakbeku/elixir-bnf | /Contoh_Symbols.py | UTF-8 | 3,654 | 3.359375 | 3 | [] | no_license | contoh3_code = """
defmodule Contoh3 do
def find_fibonacci(nth) do
list = [1, 1]
fib(list, nth)
end
def fib(list, 2) do
Enum.reverse(list)
end
def fib(list, n) do
[first_elem, second_elem | _] = list
fib([first_elem + second_elem | list], n - 1)
end
end
IO.puts(inspect(Contoh3.find_fi... | true |
2e337c5857c3a002e07d10c8b54b66a48d6eef47 | Python | eric93/scheduler | /poc/solver.py | UTF-8 | 2,415 | 2.78125 | 3 | [] | no_license | #!/bin/env python2
from z3 import *
num = 0
def genSym():
global num
num += 1
return 'x-' + str(num)
def getSolver(nodes, edges):
s = z3.Solver()
for node_num in nodes:
n = Int('n' + str(node_num))
s.add(n == node_num)
dependency = Function('depends-on',IntSort(),IntSort(),Bo... | true |
da779c99d8df716b6fc8ee95451b486092f99a41 | Python | cooper-mj/tabbycat | /tabbycat/venues/allocator.py | UTF-8 | 7,998 | 2.84375 | 3 | [] | no_license | import itertools
import logging
import random
from .models import VenueConstraint
logger = logging.getLogger(__name__)
def allocate_venues(round, debates=None):
allocator = VenueAllocator()
allocator.allocate(round, debates)
class VenueAllocator:
"""Allocates venues in a draw to satisfy, as best it ca... | true |
06c02822974aa71928c08132b989967b5733c154 | Python | Leedokyeong95/PythonWorks | /Ch09/9_2_Selector.py | UTF-8 | 931 | 3.359375 | 3 | [] | no_license | """
날짜 : 2021/03/08
이름 : 이도경
내용 : 파이썬 크롤링 선택자 실습하기
"""
import requests as req
from bs4 import BeautifulSoup as bs
# 페이지 요청
resp = req.get('http://chhak.kr/py/test1.html')
resp.encoding = 'utf-8' # 한글이 깨질때
print(resp.text)
# 파싱
dom = bs(resp.text, 'html.parser') # dom 문서 객체 document object model
tag_tit = dom.html.b... | true |
cd8f92dfe25384ecae34f96c43463b590244115d | Python | BuLiHanjie/Ml_Gugu | /ml_model/sequence_cv_model.py | UTF-8 | 1,455 | 2.65625 | 3 | [] | no_license | from ml_model.cv_model import CvModel
class SequenceCvModel:
def __init__(self, model_classes, params, train_x, train_y):
self.model_classes = model_classes
self.params = params
self.dtrain = (train_x, train_y)
self.models = None
pass
def train(self, train_params, metr... | true |
b9b3ce7939eb1db7ae02e1aff50dfe7db527ff53 | Python | liuiuge/LeetCodeSummary | /242.ValidAnagram.py | UTF-8 | 648 | 3.40625 | 3 | [] | no_license | # -*- coding:utf8 -*-
class Solution:
def isAnagram(self, s: str, t: str) -> bool:
if len(s) == len(t):
if s == t:
return True
dicts, dictt = {}, {}
for x in s:
dicts[x] = dicts.get(x, 0) + 1
for y in t:
... | true |
0624c8ab2eb8ae31588096f88a9ba35c05dbf07d | Python | likaiguo/job-salary-prediction | /src/main/python/jobutil.py | UTF-8 | 2,922 | 2.59375 | 3 | [] | no_license | from __future__ import print_function
import math
import random
from pymongo import MongoClient
from scipy.sparse import csr_matrix
from sklearn.linear_model import Lasso, LassoLars
from features import create_sparse_features
class MongoSalaryDB(object):
def __init__(self):
connection = MongoClient()
self.sa... | true |
d49734d2e00443c23c40b523be33a784e6ce32b0 | Python | RobertNeuzil/python-data-structures | /decorators.py | UTF-8 | 249 | 3.828125 | 4 | [] | no_license | def mydecorater(f):
def wrapper():
print ("Inside of the decorator before calling the function")
f()
print("Inside of the decorator after calling the function")
return wrapper
@mydecorater
def print_name():
print ("Robert")
print_name() | true |
f958e1f2f99966f41d0368f7e741ceeb8c3dadd9 | Python | lucasgameiroborges/Python-lista-1---CES22 | /item6.py | UTF-8 | 767 | 3.578125 | 4 | [] | no_license | import sys
import math
def teste_unitario(passou):
linha = sys._getframe(1).f_lineno
if passou:
msg = "linha {0} funciona".format(linha)
else:
msg = "erro na linha {0}".format(linha)
print(msg)
def testes():
teste_unitario(is_prime(2))
teste_unitario(is_prime(3... | true |
f12403dd791e99b1ae38667b649f775ebb7bdf60 | Python | tedisfree/python | /compress-every-directory-into-each/compress-every-directory-into-each.py | UTF-8 | 769 | 2.640625 | 3 | [] | no_license | import sys
import os
import shutil
def main():
if len(sys.argv) < 3:
print('argument error')
exit(1)
root = sys.argv[-2]
hierarchy = sys.argv[-1].split(',')
if os.path.exists('tmp'):
shutil.rmtree('tmp')
os.mkdir('tmp')
cur = os.path.join('tmp')
for h in hierarch... | true |
0d82aec6c5e359408bce0c00b4024f09ae992f44 | Python | NigrumAquila/py_checkio | /storage/mind_switcher.py | UTF-8 | 754 | 2.859375 | 3 | [
"MIT"
] | permissive | def mind_switcher(journal):
NIKOLA, SOPHIA = "nikola", "sophia"
mind, log = {}, []
def swap(a, b, add_to_log=True):
mind[a], mind[b] = mind.get(b, b), mind.get(a, a)
if add_to_log:
log.append({a, b})
for a, b in journal:
swap(a, b, add_to_log=False)
... | true |
034dacb085d972648fe8605d4bacd3c037e4997a | Python | m-mcdougall/Traffic-TimeSeries-DATS6450 | /Data Preprocessing.py | UTF-8 | 3,241 | 2.96875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#To be run first.
import pandas as pd
import os
import numpy as np
import matplotlib.pyplot as plt
import datetime
#Set working directory
wd=os.path.abspath('C://Users//Mariko//Documents//GitHub//Traffic-TimeSeries-DATS6450//Data//')
os.chdir(wd)
pd.set_option('display.max_columns', None... | true |
b0e0afe3ac87be5272f43053ef327b0fd2e629b5 | Python | TorgaMnaj/collected_snipets | /multiprocessing+logging/multiprocessing_example.py | UTF-8 | 2,651 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# main.py
#
# Copyright 2016 rob <rob@dellix>
#
#
#
import time
import random
import os
# these imports differ between 'threading' and 'multiprocessing' gist
from Queue import Empty
from multiprocessing import Process, Lock, JoinableQueue
def worker_job(q, process,... | true |
dc0248a99ca20c45a14edbef272648bcd7f907e9 | Python | Parassharmaa/machine-vision-challenge | /baggage-fitness-index/modules/deep_vision.py | UTF-8 | 4,321 | 2.75 | 3 | [] | no_license | import cv2 as cv
import numpy as np
import json
from scipy.spatial import distance as dist
class DeepVision:
def __init__(self, model_path, model_config, classes_path, config_file, image):
with open(classes_path, 'r') as f:
self.classes = [line.strip() for line in f.readlines()]
self.c... | true |
b6d089dd75a52e2cc2d4be98f97b8b18ce7379a9 | Python | alyssapyon/SingHealth-SeleniumTesting | /monkey_loggedin_RUN.py | UTF-8 | 1,642 | 2.765625 | 3 | [] | no_license | import os
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
import random
from CONSTANTS import *
# set wait ti... | true |
496bc660814daa2b3e1a54351bab00d7adfb9afe | Python | peterJbates/euler | /148/pascals.py | UTF-8 | 356 | 3.578125 | 4 | [] | no_license | #Solution using Lucas's Theorem
total = 1
def numberToBase(n, b):
if n == 0:
return [0]
digits = []
while n:
digits.append(int(n % b)+1)
n //= b
return digits[::-1]
for n in range(1, 10**9):
product = 1
string = numberToBase(n, 7)
for digit in string:
product *= digi... | true |
22ff17bb33fae8a2194481849523ded66d1b5a76 | Python | phobson/wqio | /wqio/samples.py | UTF-8 | 8,494 | 2.65625 | 3 | [
"BSD-3-Clause"
] | permissive | from matplotlib import pyplot
import seaborn
import pandas
from wqio import utils
from pandas.plotting import register_matplotlib_converters
register_matplotlib_converters()
class Parameter(object):
def __init__(self, name, units, usingTex=False):
""" Class representing a single analytical parameter (p... | true |
48d5227ccf22fbfd5f3261c97713c49a604f37e3 | Python | carines/openclassroom_python | /3_poo_dev/autres/test.py | UTF-8 | 269 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python
# Coding: utf-8
from ClassTest import *
francis = Personne("Dupond", "Francis", 18, "Londres")
print(francis.lieu_residence)
fabien = Personne("Huitelec", "Fabien", 21)
print(fabien.lieu_residence)
help(Personne)
fabien.bla()
fabien.interne()
| true |
39051058fc5da92c41c40a2537eca93487b9d058 | Python | OpenGov/grid_walker | /gridwalker/grids.py | UTF-8 | 21,392 | 2.9375 | 3 | [
"BSD-3-Clause"
] | permissive | import collections
import numpy as np
import sys
from datawrap import listwrap
class Grid(collections.MutableMapping):
DimensionParam = collections.namedtuple('DimensionParam', ['first', 'last', 'step'])
def __init__(self, grid_type, *dimensions):
'''
Args:
grid_type: De... | true |
018723d06f0feae38f1124b1fe71ecd35ebec4f5 | Python | AHowardC/python101 | /cChallegeP.py | UTF-8 | 503 | 3.796875 | 4 | [] | no_license | #is prime
def is_prime(num):
if num < 2:
return False;
else:
for i in range(2, int(num**0.5 )+ 1):
if (num % i == 0):
return False;
return True;
#nthPrime number
def nthPrime(n):
numberofPrimes = 0; #this keeps track of the postion
prime =1; #this k... | true |
39599e13627386153eb5207d19f8dac43ba77b52 | Python | jamilemerlin/exercicios_python | /CursoemVideo/e088.py | UTF-8 | 676 | 3.734375 | 4 | [] | no_license | from random import randint
from time import sleep
print('-*-' *15)
print(' JOGO DA MEGA SENA')
print('-*-' *15)
lista = list()
jogo = int(input('Quantos jogos você quer que eu sorteie? '))
iniciador = 0
jogos = list()
while iniciador < jogo:
contador = 0
while True:
escolhas = randint(1, 60... | true |
55ab9f35f18b8dc7aa5493931bfb5d5c0ff8fc44 | Python | Zernach/ML_Flask_Explainer | /app.py | UTF-8 | 1,241 | 2.578125 | 3 | [] | no_license | from flask import Flask, render_template
from data import origin_dict, dest_dict, miles_dict
from joblib import load
import pandas as pd
app = Flask(__name__)
trained_machine_learning_model = load('static/assets/pipeline_w_miles.joblib')
@app.route('/')
def home():
return render_template('index.html')
# 4/2/40/1... | true |
fc1b06fdc64e426a4e414f6c6c1303ccb4f824a4 | Python | MJohnHBerry/Python-MUD | /PythonApplication1/PythonApplication1/PythonApplication1.py | UTF-8 | 5,305 | 3.640625 | 4 | [] | no_license | import time, random
#---------------------------------------------------------------#
# Classes
#---------------------------------------------------------------#
class Entity:
def __init__ (self, name, attack, defense, speed, hp, max_hp, is_human, first_strike... | true |
ce42c965200ba298556e2dfba4b1a99077cc6059 | Python | vkumar19/kaggle | /bike_rentals/bike_rental_rforest_2.py | UTF-8 | 4,507 | 2.875 | 3 | [] | no_license | import pandas as pd
import numpy as np
def weekend(x):
if x.weekday() == 5 or x.weekday() == 6:
return 1
else:
return 0
def year_2011(x):
if x.year == 2011:
return 1
else:
return 0
rental_df = pd.read_csv("train.csv", parse_dates = True)
test_df = pd.read_csv("test.csv", parse_dates = True)... | true |
ba30cdb6983c83f3c4724079ffd66119dc49a6b4 | Python | WHJR-G8/G8-C8_SA_1.1_Pair_Template | /Template_Pair.py | UTF-8 | 950 | 4.1875 | 4 | [] | no_license | import turtle
def position(x,y,c):
turtle.penup()
turtle.goto(x,y)
turtle.pendown()
turtle.fillcolor(c)
turtle.begin_fill()
def draw_rect(s1,s2):
for i in range(2):
turtle.forward(s1)
turtle.right(90)
turtle.forward(s2)
turtle.right(90)
turtle.end_f... | true |
5cfaceb7659503dd6ad2b746df883e4716634d0b | Python | ldhonorato/PPGEC_PDI_2019.2 | /Lista06/imagem01.py | UTF-8 | 1,278 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 1 09:54:34 2019
@author: timevisao-mk2
"""
import morfologia
import numpy as np
#mport PIL.Image as pil
import cv2
path_original = ["images/image_1a.png", "images/image_1b.png", "images/image_1c.png",
"images/image_1d.png", "imag... | true |
57b0a47a737e25dcb1d3604b8fea448307a66669 | Python | kukusiik/tour_seller | /places/models.py | UTF-8 | 848 | 2.796875 | 3 | [] | no_license | from django.core.validators import MinValueValidator, MaxValueValidator
from django.db import models
class Country(models.Model):
name = models.CharField(max_length=50)
class Meta:
verbose_name_plural = 'countries'
def __str__(self):
return self.name
class City(models.Model):
name ... | true |
1dae3865fa37f3ffce3e106ea3fde6b577cf970e | Python | OneCircle1/MengProgram2 | /LPA/nwxlpa.py | UTF-8 | 728 | 2.796875 | 3 | [] | no_license | import networkx as nx
import csv
import matplotlib.pyplot as plt
from networkx.algorithms import community
import random
G = nx.Graph()
with open('/Users/cxy/Downloads/tgh/MengProgram2/pagerank/20180321.csv', 'r') as input_file:
lines = csv.reader(input_file)
for line in lines:
G.add_edge(int(line[0])... | true |
f959f6ac061054b1c95d88f9f1ea1c9ee840f0bf | Python | MachLearn-PlayGround/ml-scikit | /basics.py | UTF-8 | 1,618 | 3.875 | 4 | [] | no_license | """
This file is a custom implementation of the Introduction to Machine Learning
using Scikit-Learn
Scikit data:
classification:
iris
digits
regression:
boston house dataset
"""
from sklearn import datasets, svm
def load_data():
"""Use iris and digits standard datasets provided by scikit"""
iris =... | true |
b6e16861608e4aae255a10bde7cde28d511ca091 | Python | cash2one/xai | /xai/brain/wordbase/nouns/_roller.py | UTF-8 | 572 | 2.5625 | 3 | [
"MIT"
] | permissive |
#calss header
class _ROLLER():
def __init__(self,):
self.name = "ROLLER"
self.definitions = [u'a tube-shaped object in a machine that turns over and over in order to carry things along or press them down or together: ', u'a tube-shaped device, often heated, that women use to curl their hair: ', u'a heavy machin... | true |
dab729c58960a61926b9a64c4122057ca1b899e9 | Python | liwenok/ipaynow_pay_python | /ipaynowPythonSdk/ipaynow/md5Faced.py | UTF-8 | 774 | 2.671875 | 3 | [] | no_license | # -*- coding: utf-8; mode: python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=python:et:sw=4:ts=4:sts=4
from ipaynowPythonSdk.ipaynow import utils
__all__ = ['md5calc']
try:
import hashlib
except ImportError:
hashlib = None
if not hashlib:
raise ImportError(
"ip... | true |
f0485f73589376b7c36d5fbced0880368205d8ea | Python | storytimeworks/backend | /tests/users/test_update_user.py | UTF-8 | 5,070 | 2.625 | 3 | [] | no_license | from app import configure_test_client
from flask import Flask, session
import json, pytest, os, uuid
@pytest.fixture
def app():
application = Flask(__name__)
return configure_test_client(application)
def test_set_settings(app):
# Be a normal user for this test
with app.session_transaction() as session... | true |
77a5c872c62edea7877a36f330b41c3d3a5ad18e | Python | RedHenDev/python | /ursina dev/python minecraft/meshcraft current/building_system_PREP.py | UTF-8 | 1,407 | 2.734375 | 3 | [] | no_license | """
Our building system :) 2022
Happy New Year!
"""
from ursina import Vec3, floor
# *** Place this here, to avoid lazy import.
from config import six_cube_dirs
def checkBuild(_bsite,_td,_camF,_pos,_bp):
# def checkBuild(_td,_bp):
# Adjust build site, since build-tool-entity (bte) offset.
# _bsite += Vec3(0,-... | true |
ba94129cdc544cb9970245da5f7414fe81b495ba | Python | ISPritchin/Olympiad | /800/Оформлено/Место в таблице.py | UTF-8 | 200 | 2.96875 | 3 | [] | no_license | n = int(input())
ss = []
for _ in range(n):
s = sum(map(int, input().split()))
ss.append(s)
if _ == 0:
t = s
r = 1
for i in range(1, n):
if ss[i] > t:
r += 1
print(r)
| true |
e9e785c1e0404420aa8117faea8ef5f425fb70dc | Python | Damage-group/Max-Damage | /py/prob2.py | UTF-8 | 7,901 | 2.859375 | 3 | [] | no_license | import sys
from input import *
from algorithms import *
from measures import *
import numpy
import sequences
def print_help(argv):
print '''
TROLOLOGGER X9000 - HYPER EDITION v3.2
Usage: %s [args]
Example: %s data=./data.txt meta=./meta.txt t=0.2 c=0.3
You can either edit settings.py to handle algorithms va... | true |
4a81bbaf4124bc2aa83608251ae36bf8a886800d | Python | amilkh/haircolorGAN | /data/hair_testmode_dataset.py | UTF-8 | 2,515 | 2.921875 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | import os.path
from data.base_dataset import BaseDataset, get_params, get_transform
from data.image_folder import make_dataset
from PIL import Image
import torch
class HairTestModeDataset(BaseDataset):
"""A dataset class for dataset of pairs {portrait image, target hair color}.
It assumes that the directory '... | true |
8d2ae4ab4efed2c72672327390fe912c63efae41 | Python | irish3725/Korby | /ui.py | UTF-8 | 757 | 3.0625 | 3 | [] | no_license |
import os
import final_game as game
class ui:
## @param cal - calendar object that will be interated with
def __init__(self, player):
self.p = player
## main ui loop
def run(self):
# value to read input into
val = ''
while val != 'q' and val != 'quit' and val != ... | true |
0087d82819e5502e0d1a966508eededa72650752 | Python | jingong171/jingong-homework | /马一舒/第一次作业/第一次作业 金工17-1 2017310417 马一舒/第一题.py | UTF-8 | 376 | 2.78125 | 3 | [] | no_license | Python 3.5.3 (v3.5.3:1880cb95a742, Jan 16 2017, 15:51:26) [MSC v.1900 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> w=52
>>> h=1.68
>>> t=w/h**2
>>> t
18.42403628117914
>>> if t<18:
print ("低体重.")
elif t<=25:
print ("正常体重.")
elif t<=27:
print("超重体重.")
elif t>27:
print... | true |
59debff4975793203d908fe982e84f57856143a0 | Python | xiaoch2004/mandarin_tone_tracker | /plotresults.py | UTF-8 | 4,276 | 2.78125 | 3 | [] | no_license | import os
import matplotlib.pyplot as plt
import numpy as np
import crepe
from scipy.io.wavfile import read
import base64
INT16_FAC = (2**15)-1
INT32_FAC = (2**31)-1
INT64_FAC = (2**63)-1
norm_fact = {'int16': INT16_FAC, 'int32': INT32_FAC,
'int64': INT64_FAC, 'float32': 1.0, 'float64': 1.0}
def wavread... | true |
d2f40281ad2e5d3dbcf60e2b656ac0a5ed19cf34 | Python | MRannala/Tab-removal | /Remove_Tabs.py | UTF-8 | 1,162 | 3.5 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Dec 20 11:32:57 2016
This script will allow input of a file. It then creates a secondfile where tabs have been replaced with single
spaces. The new filename will be the same as the initial but with a '+' appended.
@author: Magnus Rannala
"""
import os
import sys
... | true |
6e5192545016a992d2525f9baae53d513629524b | Python | tripathyas/Online-Hackathon | /form_group.py | UTF-8 | 499 | 3.34375 | 3 | [] | no_license | def solution(A):
# write your code in Python 2.7
group = []
temp = A[0]
for i in range(1, len(A)):
if A[i] > A[i - 1]:
group.append((A[i - 1], temp))
temp = A[i]
group.append((A[-1], temp))
group.sort()
print(group)
for j in range(1, len(group)):
... | true |
50a253a3200dd5c16f0ad68df5784cc0bf180dac | Python | michaeltnguyen/Pokedex | /database/scripts/create_pokedex_sql.py | UTF-8 | 14,584 | 2.8125 | 3 | [] | no_license | import json
import csv
import sqlite3
import os
# output database
path = '../../app/src/main/assets/databases/pokedex.db'
def create_gens(cursor):
# create generations table
cursor.execute('create table if not exists gens('
'id integer primary key, '
'name text not null... | true |
a6421d6ebfa6010fabc8ecf6bd673012b9dcac24 | Python | Dhanooja/SentimentalAnalysis | /CheckingSentiment.py | UTF-8 | 191 | 2.875 | 3 | [] | no_license | from textblob import TextBlob
lst=[]
with open('Adverb.txt','r') as f:
for i in f.readlines():
word=i.strip('\n')
text=TextBlob(word)
print(word,text.sentiment.polarity) | true |
2af2f46a9f90e62b1be609136089f322b84c1f6e | Python | louis172000/PYTHON_2 | /TP11/ex4.py | UTF-8 | 943 | 3.921875 | 4 | [] | no_license | class duree:
def __init__(self, heure, minute, seconde):
self.__heure = heure
self.__minute = minute
self.__seconde = seconde
def __str__(self):
return str(self.__heure)+"h"+str(self.__minute)+"m"+str(self.__seconde)+"s"
def __add__(self, autre):
if isinst... | true |