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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
c83bb83b25dd98fd27a863ed16f6b0387d13c540 | Python | chainsofhabit/Python | /python_stage1/day07字典和集合/03字典相关的运算.py | UTF-8 | 1,933 | 4.625 | 5 | [] | no_license |
#1.字典是不支持'+'和'*'
#2.in 和 not in :是判断key是否存在
# computer = {'brand':'联想','color':'black'}
# print('color' in computer)
#3.len()
# print(len(computer))
#字典.clear()
#删除字典中所有的元素(键值对)
# computer.clear()
# print(computer)
#5.字典.copy()
#拷贝字典中所有的元素,放到一个新的字典中
# dict1 = {'a':1,'b':2}
# dict2 = dict1 #将dict1中的地址赋给dict2,两个变量... | true |
74fbf06089eec8c5a883b9b6dd81309345142090 | Python | Connor-R/NSBL | /ad_hoc/NSBL_old_rosters.py | UTF-8 | 8,642 | 2.59375 | 3 | [
"MIT"
] | permissive | import xlrd
from py_db import db
import argparse
import NSBL_helpers as helper
import datetime
db = db('NSBL')
def process():
for szn, deets in {2008: [5, 'xls', 0, 1]
, 2009: [5, 'xls', 0, 1]
, 2010: [4, 'xls', 0, 1]
, 2011: [4, 'xls', 0, 1]
, 2012: [4, 'xls', 0, 1]
, 20... | true |
08bb101dcda87674e8db2ba19cbb93fbec5dc0fa | Python | HUSS41N/PythonFLaskSocialMediaBLogPostAPP | /tntblog/blog_posts/views.py | UTF-8 | 2,366 | 2.65625 | 3 | [] | no_license | from flask import render_template,url_for,request,Blueprint,flash,redirect
from flask_login import current_user,login_required
from werkzeug.exceptions import abort
from tntblog import db
from tntblog.blog_posts.forms import BlogPostForm
from tntblog.models import BlogPost
#registering a blueprint
blog_posts = Bluepri... | true |
362fbc0ccea6c2ac516e08aa3239efcd3138cc5b | Python | BridgesUNCC/BridgesUNCC.github.io | /tutorials/testing/python/tut_bst_p2.py | UTF-8 | 2,505 | 3.84375 | 4 | [] | no_license | from bridges.bridges import *
from bridges.bst_element import *
import sys
def main():
# Part 2 of this tutorial will illustrate the use of the BRIDGES in styling
# nodes and links of binary search trees. For instance you might want to
# illustrate the nodes and links that were visited during an insertion... | true |
7aac0a09ee0e7d039ff42f07863c5e14a0e156a3 | Python | AndreasArne/treeviz | /treevizer/builders/trie.py | UTF-8 | 1,911 | 3.53125 | 4 | [
"MIT"
] | permissive | """
Trie builder
"""
import html
from treevizer.builders.base_graph import Graph
class Trie(Graph):
"""
Builder for Trie structure
"""
def _add_node_to_graph(self, node, word=""): # pylint: disable=arguments-differ
"""
Recutsivly add tree node to the graph.
"""
value ... | true |
4e5528cf3ce51d5b569c34c8852bd73b05489eb8 | Python | kinjo-icolle/programming-term2 | /src/algo-p5/0822/q17/player.py | UTF-8 | 5,528 | 3.859375 | 4 | [] | no_license | import field_map
# TODO:sysパッケージをimportしてください。
class Player:
def __init__(self, name):
"""
コンストラクタ
Parameters
----------
name : str
プレイヤーの名前
Returns
-------
自分自身のインスタンス
"""
self.name = name
self.cur_pos = 0
... | true |
471c2f5624d3035c85bed6def502097df75f25db | Python | Wynjones1/pycompiler | /src/tac.py | UTF-8 | 7,265 | 3.078125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python2.7
import os
from parse import *
import syntax_tree as ast
from graph import Graph
class TempVar(object):
def __init__(self, value):
self.value = value
def __str__(self):
return "_t{}".format(self.value)
def __eq__(self, other):
if isinstance(other, TempVar):... | true |
acaff4f3a1285844739a67cab9ba1ba9c30543cd | Python | akajuvonen/tf-layers-mnist-analysis | /analysis.py | UTF-8 | 4,652 | 2.984375 | 3 | [
"MIT"
] | permissive | import numpy as np
import tensorflow as tf
from sklearn.metrics import confusion_matrix
def cnn_model(features, labels, mode):
"""CNN model function.
Arguments:
features -- Batch features from input function
labels -- Batch labels from input function
mode -- train, eval, predict, instance of tf.es... | true |
4871f70ce2ec0f0ae2711914d0499ee2b2514d51 | Python | a954710805/python | /壁纸自动切换/壁纸自动切换.py | UTF-8 | 3,422 | 2.765625 | 3 | [] | no_license | import ctypes
import time
import requests
import os
from threading import Thread
from tkinter import Tk, Label, Button,Entry,StringVar,messagebox
# r'C:\Users\86156\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup'
# '放到AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup下把本文件后缀设为pyw 就会开机自启... | true |
f3db860f2c6cc7d1ba8e73609a48446b7bc3e92c | Python | fuverdred/Advent_2019 | /day_4.py | UTF-8 | 985 | 3.5625 | 4 | [] | no_license | range_lower = 265275
range_upper = 781584
def possible_password(password):
'''Returns true if it's a possible password'''
digits = [i for i in str(password)]
if not len(digits) > len(set(digits)):
return False # Does not have a repeat digit
if not ''.join(sorted(digits)) == str(password):
... | true |
1e8e5d00076d2ac5078378a732bbb5415a602840 | Python | SS1031/kaggle-ncaa2019 | /src/kernels/BasicLogisticRegressionWithCrossValidation.py | UTF-8 | 6,844 | 2.65625 | 3 | [] | no_license | # Revision History
# Version 7: Fixed regular season stat bug
# Version 6: Added submission code
# This kernel creates basic logistic regression models and provides a
# mechanism to select attributes and check results against tournaments since 2013
import numpy as np # linear algebra
import pandas as pd # data proc... | true |
d33902f2acbeba1fd6b9d0340afe03c2d98c344e | Python | kim-taewoo/TIL_PUBLIC | /Algorithm/swexpert/1983_조교의_성적_매기기.py | UTF-8 | 607 | 3.234375 | 3 | [] | no_license | T = int(input())
for t in range(1, T+1):
n, k = map(int, input().split())
scores = []
for i in range(n):
mid, final, homework = map(int, input().split())
total = 0.35 * mid + 0.45 * final + 0.2 * homework
scores.append(total)
if i == k-1:
target = total
... | true |
ba9899a5cb0fd8e04f995756505199e1b5dc74dc | Python | jennystarr/GWCProjects | /pooh.py | UTF-8 | 2,580 | 3.6875 | 4 | [] | no_license |
# Update this text to match your story.
start = '''
One day Christopher Robina and Pooh were bored.
They had to make a decision to go to the park or a tea party.
'''
print(start)
print("Type 'park' to go to the park or 'tea party' to go a tea party.") # Update to match your story.
user_input = input()
if user_input ... | true |
5151772699011b9b161a12b922cb7f0d0d2afe67 | Python | leonardopetrini/jamming_neural_nets | /alice.py | UTF-8 | 5,741 | 2.703125 | 3 | [] | no_license | import os
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.style
import matplotlib as mpl
mpl.style.use('seaborn-muted') # muted
import torch
from torch import nn
from torch.nn import functional as F
from tqdm import tqdm
import pickle
import sklearn.manif... | true |
e0f0f607aae7883c5041a6a0e75c0fda3f12ab65 | Python | rishav4101/basicEDAs | /Day 2/day2.py | UTF-8 | 695 | 4.1875 | 4 | [] | no_license | my_dict = {"a":1,"b":2}
##task1: Iterate over all items in this dict
for key,value in my_dict.items():
print("Key is:",key,"Value is:",value)
my_string = "Hello World"
## Output
##Num of UpperCase Letters: 2
##Num of LowerCase Letters: 8
count1 = 0
count2 = 0
for char in my_string:
if char.isupper(... | true |
bf7e0d94d1fdb3ea87ca14b96e5f967b8008014f | Python | Amerens8/Dataprocessing | /Homework/Week_3/python_helper_functions/cleaninghapp.py | UTF-8 | 1,132 | 3.40625 | 3 | [] | no_license | # cleaninghapp.py
#
# Amerens Jongsma
#
# specific function to clean up and select only necessary data from csv file
# in the end the output only contains data of the Happiness score of
# countries in Southeast Asia
import csv
import json
import sys
def cleaninghapp(csvfile, clean_csvfile):
data = []
southea... | true |
a09db6a4e8510904fde65a2dafcfc8c55f0e0b3a | Python | artemnesterenko/nli | /plugins/WordAnalyzers/POSFrequencyAnalyzer.py | UTF-8 | 723 | 2.53125 | 3 | [] | no_license | from plugins.base import BaseAnalyzer
from nltk.probability import FreqDist
from itertools import combinations
class POSFrequencyAnalyzer:#(BaseAnalyzer):
"""Не используется. Сделало всех слишком похожими."""
def __init__(self):
self.pos_freq = FreqDist()
def get_info(self):
return self.... | true |
2bbd3c95cf654768ef7c8d5da760ac5e259cafa0 | Python | aigo-group1/face-recognition | /facial_landmarks/headpose.py | UTF-8 | 2,753 | 2.5625 | 3 | [
"MIT"
] | permissive | from imutils import face_utils
import dlib
import cv2
import numpy as np
import os
# initialize dlib's face detector (HOG-based) and then create
# the facial landmark predictor
p = os.path.join(os.path.join(os.getcwd(),'facial_landmarks'),"shape_predictor_68_face_landmarks.dat")
predictor = dlib.shape_predictor(p)
k =... | true |
f4602c94a40fdc92bddc0dbd9ebb73183557fa3b | Python | rstar000/fb2epub | /parsing/utils.py | UTF-8 | 565 | 2.765625 | 3 | [] | no_license | import io
from functools import wraps
from PIL import Image
def remove_prefix(s, p):
if not s.startswith(p):
return s
return s[len(p):]
def bytes_to_image(data):
try:
img = Image.open(io.BytesIO(data))
except IOError:
return None
return img
def maybe(nothing=None):
... | true |
95af32af8ff59b1eda85a760ac59cee5624aeeb4 | Python | khaledabdelfatah/simple_marketsite | /templates/getData.py | UTF-8 | 586 | 2.5625 | 3 | [] | no_license | # from flask import Flask, render_template, request, flash
# import mysql.connector
# mydb=mysql.connector.connect(
# host="localhost",
# user="root",
# passwd="",
# database="mydb"
# )
# # if request.method=="POST":
# # username=request.form("name")
# # print(username)
# mycursor ... | true |
0ffb826c7f8149c8f31e0c30b0be3d5db17b5c9d | Python | lilpolymath/Python-Codes | /bracket_seth.py | UTF-8 | 451 | 4.25 | 4 | [] | no_license | import time
open_bracket, close_bracket = ["(", "{", "[", "<"], [")", "}", "]", ">"]
print(" I'm going to examine if your brackets are closed")
examine = input("Enter any set of characters within any form of brackets: ")
length = len(examine) - 1
position = open_bracket.index(examine[0])
if examine[length] == close_bra... | true |
28af7d9b1ce1c90a507003ed4f0ba49fc53c8e8a | Python | swaroop9ai9/Optimization-Search-Algorithms | /Hill Climbing Algorithms/Simple Heuristic Search.py | UTF-8 | 1,354 | 3.625 | 4 | [
"MIT"
] | permissive | import string
import random
def randomGen(goalList):
characters = string.ascii_lowercase+" "
randString =""
for i in range(len(goalList)):
randString = randString+characters[random.randrange(len(characters))]
randList = [randString[i] for i in range(len(randString))]
return randList
def sc... | true |
c119a3296f429ce3edc1550e91e5980967329b47 | Python | nicodigiovanni/SmallSideProjects | /PlasticWasteCalculator/PlasticCalculator.py | UTF-8 | 1,690 | 3.34375 | 3 | [] | no_license | import tkinter as tk
x = 0
label = 'According to the US National Ocean Service, it is estimated that 8 million metric tons of plastic entered the ' \
'ocean in 2010 (507.4 pounds per second). \n Unfortunately, this problem is only continuing to grow. \n ' \
'Unlike other kinds of waste, plastic does n... | true |
a7752e6775cd780177e6d177861011e53560af1e | Python | carlosjoset/intro_fund_python | /calculadora.py | UTF-8 | 128 | 3.765625 | 4 | [] | no_license | a = int(input())
b = int(input())
print("a + b es :{}".format(a+b))
print("a * b es :{}".format(a*b))
print((10 - 4) / 2 + 1)
| true |
bc1db8757b0850d0f65ef7e7a895401f7dcd45c3 | Python | keeeeeeeeeeta/MySandbox | /python3/list_test.py | UTF-8 | 484 | 3.640625 | 4 | [] | no_license | fruit = list()
print("fruit list is...")
print(fruit)
#new_list = ["a", "b", "c", "d"]
new_list = "abcde"
# not itterable obj to list method
#new_list = 123456
fruit = list(new_list)
print("fruit new list is...")
print(fruit)
#fruit = []
#fruit = ["Apple", "Orange", "Pear"]
#fruit
colors = ["purple", "orange", "green"... | true |
6312f185957dee570695efc3e3577cc413fef1b7 | Python | KenKaneki704/Text-Encoder-Decoder | /main.py | UTF-8 | 256 | 3.421875 | 3 | [
"MIT"
] | permissive | import string
# Text Encoder
text = input("Text: ")
text_encoded = text.encode("utf_16")
print(f"Encoded Text: {text_encoded}")
# Text Decoder
text = input("Text: ")
text_decoded = text_encoded.decode("utf_16")
print(f"Encoded Text: {text_decoded}")
| true |
a9e1d580338d848f778ea67b61bed95d549aeded | Python | chrishuskey/CS32_Graphs_GP | /adj_list.py | UTF-8 | 6,155 | 4.15625 | 4 | [] | no_license | # Import libraries, packages, modules, classes/functions:
from queue import Queue
from stack import Stack
# Class for a graph object represented as an adjacency list:
class Graph:
"""Represent a graph as a dictionary of vertices mapping labels to edges (an adjacency list)."""
def __init__(self):
# Ini... | true |
242f5749f5dfc540055063643e091e87781d410d | Python | Muff2n/connect4 | /oinkoink/scripts/view_games.py | UTF-8 | 427 | 2.515625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | from oinkoink.board import Board
from oinkoink.neural.storage import game_str
import pickle
import sys
if __name__ == "__main__":
print(sys.argv[1])
with open(sys.argv[1], 'rb') as f:
games = pickle.load(f)
print('{} games loaded'.format(len(games)))
game = games[int(sys.argv[2])]
... | true |
eda650a61806a11fb3460dabab845be594ec682f | Python | n4cl/atcoder | /ABC/081/A.py | UTF-8 | 105 | 3.171875 | 3 | [] | no_license | # coding: utf-8
n = raw_input()
count = 0
for i in n:
if i == "1":
count += 1
print count
| true |
893aef57f8a1fb1be7cfbf9fef4472470d88f423 | Python | shambhand/pythontraining | /material/code/advanced_oop_and_python_topics/10_MetaClasses/Part1/MetaClassMotivation1.py | UTF-8 | 347 | 3.578125 | 4 | [] | no_license | # Adding methods to class via inheritance.
# This is too static.
class Extras:
def extra(self, args): # Normal inheritance: too static
...
class Client1(Extras): ... # Clients inherit extra methods
class Client2(Extras): ...
class Client3(Extras): ...
X = Client1() # Make an instance
X.extra() ... | true |
3e21e2660151912b10dbbb0e07333fd65b35a6a2 | Python | windy-lf/AirTicketPredicting | /Regression/RegressionKNN.py | UTF-8 | 2,223 | 3.0625 | 3 | [] | no_license | # system library
import numpy as np
# user-library
import RegressionBase
# third-party library
from sklearn import neighbors
from sklearn.grid_search import GridSearchCV
from sklearn.metrics import mean_squared_error
class RegressionKNN(RegressionBase.RegressionBase):
def __init__(self, isTrain):
supe... | true |
db5145990e975dd8d0f2e3988bda69605d9f4da9 | Python | worasit/python-learning | /mastering/decorators/decorating_functions_00.py | UTF-8 | 1,099 | 4.03125 | 4 | [] | no_license | """
To be defined
Use cases:
- Debugging
- printing input/output
"""
import functools
def eggs(function):
"""
To make the syntax esiser to use, Python has a special syntax for this case.
So, instead of adding a line such as the following example
spam = eggs(spam)
you can simply dec... | true |
084bca081546b73db5df31c0c8b6bdaebbc1e289 | Python | pypeaday/aoc-2020 | /src/day9/main.py | UTF-8 | 2,648 | 3.484375 | 3 | [] | no_license | import itertools
from more_itertools import windowed
def get_data(filepath: str = "./data/raw/day9_sample.txt"):
data = []
with open(filepath, "r") as f:
lines = f.readlines()
for line in lines:
data.append(int(line))
return data
def is_valid(num_to_check: int, values: list, ... | true |
a603b34af87215667b445ca3f882cd48bb5a9ebd | Python | ogzgl/twitter-gender-classification | /genderclassification.py | UTF-8 | 8,914 | 2.546875 | 3 | [] | no_license | # below import lines are for necessary libraries.
# csv library is imported for storing the processed data.
# I've used ElementTree for parsing XML files to reach the tweets.
# I've used tqdm for showing the process of parsing tweets.
# I've used nltk for part of speech tagging. in nltk I've used TweetTokenizer method ... | true |
519a4f052bc7fcf3150cc4bffd70bae633fddac7 | Python | python-diamond/Diamond | /src/collectors/files/files.py | UTF-8 | 1,995 | 2.671875 | 3 | [
"MIT"
] | permissive | # coding=utf-8
"""
This class collects data from plain text files
#### Dependencies
"""
import diamond.collector
import os
import re
_RE = re.compile(r'([A-Za-z0-9._-]+)[\s=:]+(-?[0-9]+)(\.?\d*)')
class FilesCollector(diamond.collector.Collector):
def get_default_config_help(self):
config_help = sup... | true |
90e85dfbcb5587e70d308f6592a38ce4d3de78be | Python | jfswitzer/898-terracoin | /6.s898/teng.py | UTF-8 | 3,186 | 2.515625 | 3 | [] | no_license | #!/usr/bin/python
from time import sleep
from random import randint
import json
import threading
import shutil
import time
import utils as tu
import hashlib
TRANSACTIONS = {}
TID = 0
TRANSACTIONS['transactions'] = []
SOLVED = []
def publish_transaction():
global TID
global TRANSACTIONS
#mimics a real system... | true |
d5ab41fb22ad165dae8654ee9e190a6372f53969 | Python | drboog/FPK | /image_generation/core/mmd.py | UTF-8 | 30,550 | 2.609375 | 3 | [
"MIT"
] | permissive | '''
MMD functions implemented in tensorflow.
'''
from __future__ import division
import tensorflow as tf
import numpy as np
from .ops import dot, sq_sum, _eps, squared_norm_jacobian
slim = tf.contrib.slim
import math
mysqrt = lambda x: tf.sqrt(tf.maximum(x + _eps, 0.))
from core.snops import linear, lrelu
###########... | true |
91ed4081588a47129de758fd0494389d683e0a49 | Python | wanga7/simple-bft | /node.py | UTF-8 | 4,679 | 2.75 | 3 | [] | no_license | # Anjie Wang
# node.py
import zmq
import time
import sys
import threading
import config
from treelib import Node,Tree
# lieutenant don't start sending msg until they receive general's cmd (flag=True)
flag=False
# tree for storing received msg
tree=Tree()
cur_sum=0
cur_round=0
list=[]
# identity of actor
identity=""
l... | true |
0fc204fc584ddd5338b65cddf5c27e022f77857b | Python | VlachosGroup/Structure-Optimization | /OML/LSC_cat.py | UTF-8 | 11,633 | 2.671875 | 3 | [
"MIT"
] | permissive | import numpy as np
import copy
from ase.neighborlist import NeighborList
import networkx as nx
import networkx.algorithms.isomorphism as iso
from OML.dynamic_cat import dynamic_cat
from zacros_wrapper.Lattice import Lattice as lat
import time
class LSC_cat(dynamic_cat):
'''
Catalyst with a very simple ... | true |
0668b153daeab4828bb18e6b748418bd81efbdae | Python | jan-golda/PW-FuzzyController | /tests/fuzzy_logic/test_expression.py | UTF-8 | 2,100 | 3.125 | 3 | [] | no_license | """ Unit tests of the expression system. """
import pytest as pytest
import fuzzy_logic as fl
@pytest.mark.parametrize('a', [0.0, 0.4, 1.0])
def test_not(a):
term_a = fl.Term('a', 'A', fl.TriangularMembership(0, 1, 2))
exp = ~term_a
val_a = term_a(a=a)
val_exp = exp(a=a)
assert isinstance(exp,... | true |
d91d973e66008e39a5dd34cd2ece55ffa143b1a1 | Python | rifqirosyidi/tkinter-mediate | /03_function_binding.py | UTF-8 | 528 | 3.421875 | 3 | [] | no_license | from tkinter import *
def get_the_sum(event):
num1 = int(num_1.get())
num2 = int(num_2.get())
sum = num1 + num2
total_sum.delete(0, "end")
total_sum.insert(0, sum)
root = Tk()
num_1 = Entry(root)
num_1.pack(side=LEFT)
Label(root, text="+").pack(side=LEFT)
print(num_1)
num_2 = Entry(root)
nu... | true |
3b4d3810a47ce26a6cbeced2af519e702ab148f8 | Python | asatav/Python-All-Example | /Iterators/Iteration.py | UTF-8 | 185 | 3.171875 | 3 | [] | no_license | my_list=[4,7,0,3]
my_iter=iter(my_list)
print(next(my_iter))
print(next(my_iter))
print(my_iter.__next__())
print(my_iter.__next__())
#next(my_iter)
for item in my_list:
print(item) | true |
0a04fbaa195646f48f2a283f5a8caea0153f0122 | Python | srikanthpragada/22_JAN_2018_PYTHON | /ex/random_demo.py | UTF-8 | 225 | 3.5625 | 4 | [] | no_license |
import random # import random module
nums = []
for i in range(1,11):
nums.append(random.randint(100,200))
for n in nums:
print(n)
squares = [ v * v for v in range(1,11) if v % 2 == 0 ]
print(squares)
| true |
32c02dbb474727ce2be24f452d9d6edc8c518398 | Python | john-klingner/Calvin | /src/cscience/components/c_calibration.py | UTF-8 | 2,517 | 3.015625 | 3 | [] | no_license | import itertools
import cscience.components
from cscience.components import datastructures
#TODO: it appears that the "correct" way of doing this is to run a probabilistic
#model over the calibration set to get the best possible result
class SimpleIntCalCalibrator(cscience.components.BaseComponent):
visible_name ... | true |
db06c0547c944a57a063fa8f6fb8585f6ca69ce3 | Python | radical-collaboration/facts | /modules/extremesealevel/pointsoverthreshold/extremesealevel_pointsoverthreshold_project.py | UTF-8 | 14,628 | 2.640625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" project_esl.py
This script runs the projecting task for extreme sea-level analysis. This tasks
generates samples of local msl change and GPD parameters. From those samples it
calculates historical and future return curves at user defined return periods.
The return curv... | true |
475157af7b73019dc2a8c6faeb1c41ed898fe49a | Python | bakunobu/exercise | /1400_basic_tasks/chap_11/ex_11_179.py | UTF-8 | 286 | 3.328125 | 3 | [] | no_license | def manual_sort(results:list) -> list:
i = 0
result = results.pop(0)
while i < len(results) - 1:
if result > results[i]:
i += 1
else:
results.insert(i, result)
return(results)
results.append(result)
return(results) | true |
a1b31aa74380e4dd9125416fe6fa94d33c2b34ee | Python | asal1995/python-practice-w4 | /abba.py | UTF-8 | 812 | 3.609375 | 4 | [] | no_license | n=int(input('enter a number:')) #number of teast case
ab=0
ba=0
while n>0:
s=str(input('enter your string:'))
d=[]
ab=0
ba=0
for i in s: #loop of list input
d+=[i]
#else:
for i in range(len(s)):
try:
if d[i]=="a":
if ... | true |
ea74c04c9e3787968798fc2d69d2a11ae471434c | Python | guoziqingbupt/Lintcode-Answer | /palindrome number ii.py | UTF-8 | 762 | 3.65625 | 4 | [] | no_license | class Solution:
"""
@param n: non-negative integer n.
@return: return whether a binary representation of a non-negative integer n is a palindrome.
"""
def isPalindrome(self, n):
temp = self.binaryTrans(n)
left, right = 0, len(temp) - 1
while left <= right:
if tem... | true |
04eb87ad5446d96ec0c79525748491b5630685dc | Python | sraisty/track-meet-simplicity | /DOCUMENTS/SQLAlchemyTests.py | UTF-8 | 1,251 | 2.859375 | 3 | [] | no_license | """ testing out some SQLAlchemy Stuff """
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import Enum
from util import info
db = SQLAlchemy()
genders = ('M', 'F')
grades = ('5', '6', '7', '8')
adult_child = ('adult', 'child')
divname_dict = {"child": {"M": "Boys", "F": "Girls"},
"adult": {"... | true |
57a46c95d174013053176023f628b1d5f176aeb6 | Python | skywhat/leetcode | /Python/261.py | UTF-8 | 2,596 | 3.328125 | 3 | [] | no_license | #DFS using stack
class Solution(object):
def validTree(self, n, edges):
"""
:type n: int
:type edges: List[List[int]]
:rtype: bool
"""
adjList = [[] for _ in range(n)]
stack = [0]
seen = set([0])
parent = {}
for e in edges:
... | true |
0b8da368b81ed65bbdb24972a0ba1327eea7b9d6 | Python | yangtao0304/hands-on-programming-exercise | /jianzhi-offer/12.py | UTF-8 | 766 | 2.890625 | 3 | [] | no_license | class Solution:
def exist(self, board: List[List[str]], word: str) -> bool:
def dfs(r, c, n):
if n == len(word)-1:
return board[r][c] == word[-1]
if board[r][c] == word[n]:
visited[r][c] = True
for nr, nc in ((r+1, c), (r-1, c), (r, c+... | true |
dc19258c43ec026ae2b3a3217247e6f8fcf1de32 | Python | morihladko/zsl | /zsl/db/helpers/nested.py | UTF-8 | 1,096 | 3.171875 | 3 | [
"MIT"
] | permissive | """
:mod:`zsl.db.helpers.nested`
----------------------------
.. moduleauthor:: peter
"""
from __future__ import unicode_literals
def nested_model(model, nested_fields):
"""
Return app_model with nested models attached. ``nested_fields`` can
be a simple list as model fields, or it can be a tree definitio... | true |
8444f3ced968212f564bef203cb840cd79c4c83f | Python | rshanker779/cellular-automata | /tests/conway/conway_test.py | UTF-8 | 1,186 | 2.890625 | 3 | [
"MIT"
] | permissive | import unittest
from conway.conway import get_next_generation_state
from collections import Counter
class ConwayTest(unittest.TestCase):
"""Test class"""
def test_next_generation_case(self):
"""Tests the function that applies base Conway logic"""
state_1 = get_next_generation_state(True, Coun... | true |
b9d293b40c4788c17a1a0df455c936064545fe8a | Python | scripting-drafts/Midi-Arpeggios | /rtmidi-arp.py | UTF-8 | 1,667 | 2.640625 | 3 | [] | no_license | import rtmidi
from time import sleep
import random
midiout = rtmidi.MidiOut()
available_ports = midiout.get_ports()
if available_ports:
midiout.open_port(0)
print('opened port')
else:
midiout.open_virtual_port("My virtual output")
print('opened virtual port')
# Midi ranges for A
# 21, 46
# 33, 58
# ... | true |
65c420ab03d5c9a137a51bb799a579d90d70ac23 | Python | KacperBukowiec/University | /Python Rozszerzony/Lista_10_11_ROZ/main.py | UTF-8 | 8,677 | 2.71875 | 3 | [] | no_license | from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, relationship
import tkinter as tk
from tkinter import ttk
'''
engine = create_engine('sqlite:///census.sqlite')
#connection = engine.connect()
metadata = MetaData()
#census = Table('census',metadat... | true |
d9fa744f11eb1e599568c4ec5fa09c4b798af172 | Python | stevepomp/LeetCode | /python/024. Swap Nodes in Pairs/swapPairs.py | UTF-8 | 516 | 3.28125 | 3 | [] | no_license | '''
Given 1->2->3->4, you should return the list as 2->1->4->3.
'''
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def swapPairs(self, head):
"""
:type head: ListNode
:rtype: ListNode
... | true |
5adf3b69f65dfa0fea2a4730b6c8d594736e73b0 | Python | mattspitz/markovtools | /modelgen/buildmodel.py | UTF-8 | 2,152 | 3.15625 | 3 | [] | no_license | ##
# Reads from stdin, builds a Markov model and saves it to disk. Expected format from stdin is lines of sentences.
##
import argparse
import collections
from markovgen import common
import logging
import sys
def parse_args():
parser = argparse.ArgumentParser(description="Generates a Markov model from stdin and ... | true |
c87e1d6cdb6fd6e3f757c6952c8c4b98cbd0d8c7 | Python | sergioamorim/TASIAp | /tasiap/handlers/reiniciar.py | UTF-8 | 1,424 | 2.640625 | 3 | [
"MIT"
] | permissive | from telegram import InlineKeyboardButton, InlineKeyboardMarkup, ParseMode
from tasiap.common.bot_common import is_user_authorized
from tasiap.common.string_common import is_onu_id_valid
from tasiap.logger import log_update, get_logger
logger = get_logger(__name__)
def reiniciar(update, context):
log_update(updat... | true |
ebef9961cf1e0a30ea692184db15d36733387af4 | Python | PhilipKazmeier/github-vuln-scraper | /conf/patterns.py | UTF-8 | 4,599 | 2.640625 | 3 | [] | no_license | #
# This file holds all configurations for the crawler and their corresponding regex patterns.
#
import re
'''
Template for new config:
config = {
"name": "language-attack",
"description": "Describe your config",
# String tuples with a single element must always have a trailing comma or they are interpret... | true |
5b5db0a307343e170e68a4bd782c9fde3f3b40ea | Python | mfkiwl/star_simulator | /star_filtering.py | UTF-8 | 626 | 3.171875 | 3 | [
"MIT"
] | permissive | import pandas as pd
#Reading in Pandas Dataframe and Cleaning Data
excel_catalogue = pd.read_excel('SAO.xlsx')
tidy_catalogue = excel_catalogue.rename(columns = {'Unnamed: 0': 'Star ID', 'Unnamed: 1': 'RA', 'Unnamed: 2': 'DE', 'Unnamed: 3': "Magnitude"}, inplace=False)
#Filtering Magnitude
magnitude_filter = float(in... | true |
5a49a91f897e6aa8b550f05fa38ec94029745987 | Python | Fyefee/PSIT-Ejudge | /46 Sequence VI.py | UTF-8 | 192 | 3.59375 | 4 | [] | no_license | """Sequence VI"""
def main(num):
"""Sequence VI"""
for i in range(1, num+1):
for j in range(1, i+1):
print(j, end=" ")
print()
main(int(input()))
| true |
994f6129a2b162f4ab5009133e87eae1a94498ef | Python | Panda3D-public-projects-archive/sfsu-multiplayer-game-dev-2011 | /branches/hunvilbranch/src/main/MainLobby/World/Avatars/Stats.py | UTF-8 | 5,365 | 2.578125 | 3 | [] | no_license |
from common.Constants import Constants
from common.DirectBasicButton import DirectBasicButton
from common.DirectControls import DirectControls
from common.DirectWindow import DirectWindow
from direct.gui.DirectFrame import DirectFrame
from direct.gui.DirectGui import DGG
from direct.gui.DirectLabel import DirectLabel
... | true |
d9defe5ad47eb503e1e8834bad3974c9f76ea1ae | Python | greenmac/python-morvan-numpy-pandas | /108numpy-copy-deepcopy.py | UTF-8 | 602 | 3.5 | 4 | [] | no_license | # https://morvanzhou.github.io/tutorials/data-manipulation/np-pd/2-8-np-copy/
import numpy as np
# a = np.arange(4)
# b = a
# c = a
# d = b
# a[0] = 11
# print(a)
# print(b)
# print(c)
# print(d)
# print(b is a)
# print(d is a)
# a = np.arange(4)
# b = a
# c = a
# d = b
# a[0] = 11
# d[1:3] = [22, 33]
# print(a)
# pr... | true |
ec7ed22c029fb98678e0c7fd6ac2e590584bfc26 | Python | GabrielSuzuki/Daily-Interview-Question | /2020-12-29-Interview.py | UTF-8 | 1,063 | 4.625 | 5 | [] | no_license | #Hi, here's your problem today. This problem was recently asked by Facebook:
#You are given the root of a binary search tree. Return true if it is a valid binary search tree, and false otherwise. Recall that a binary search tree has the property that
#all values in the left subtree are less than or equal to the root,... | true |
69c440158cee8c09953c8bae33f2da308b6941f8 | Python | ricardoBpinheiro/PythonExercises | /Desafios/desafio079.py | UTF-8 | 342 | 3.65625 | 4 | [] | no_license | i = 0
lista = []
aux = 0
while True:
num = int(input('Digite um valor: '))
if num not in lista:
lista.append(num)
else:
print('Valor duplicado! Não adicionado.')
opcao = str(input('Quer continuar? [S/N] ')).upper()
if opcao == 'N':
break
lista.sort()
print(f'Voce digitou ... | true |
5d1996820889c8196d58338d8d0b97d55a1ab788 | Python | Aasthaengg/IBMdataset | /Python_codes/p02420/s375611400.py | UTF-8 | 228 | 2.8125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import sys
lines = sys.stdin.readlines()
l = 0
while not ("-" in lines[l]):
s = lines[l].replace('\n','')
n = int(lines[l+1])
l += 2
t = sum(map(int, lines[l:l+n])) % len(s)
print s[t:]+s[:t]
l += n | true |
ac516544ff41a0f2902ed5811cdc8b2eaca64a57 | Python | VanessaCapuzzi/mackenzie_algoritmosI | /app_conhecimento_aula2.py | UTF-8 | 579 | 4.25 | 4 | [] | no_license | # Faça um programa em Python que receba o custo (valor em reais) de um espetáculo teatral e o preço do convite (valor em reais) desse espetáculo. Esse programa deve calcular e mostrar:
# a) A quantidade de convites que devem ser vendidos para que, pelo menos, o custo do espetáculo seja alcançado.
# b) A quantidade de... | true |
746e87af759fe8b65f38eccf49e4da850ea19672 | Python | nick-ragan-resume/web-scraper | /url_scrape.py | UTF-8 | 28,745 | 2.53125 | 3 | [] | no_license | #!/usr/bin/python3
import sys
import os
from os.path import expanduser
import json
from bs4 import BeautifulSoup
import requests
from tkinter import Tk, Text, Label, BooleanVar, E, W, S, N, Toplevel, RAISED, LEFT, filedialog
import tkinter.font as font
import tkinter.ttk as ttk
from PIL import Image, ImageTk
import shu... | true |
bb14f9e2275e13c111dc6e8616ed0ceffe740f04 | Python | determined-ai/determined | /examples/computer_vision/byol_pytorch/utils.py | UTF-8 | 968 | 3.109375 | 3 | [
"Apache-2.0"
] | permissive | from typing import Any, Callable, Dict, TypeVar
import torch.nn as nn
A = TypeVar("A")
B = TypeVar("B")
def merge_dicts(d1: Dict[A, B], d2: Dict[A, B], f: Callable[[B, B], B]) -> Dict[A, B]:
"""
Merges dictionaries with a custom merge function.
E.g. if k in d1 and k in d2, result[k] == f(d1[k], d2[k]).
... | true |
b61084083c97614ad72787ea6e919827166d5ffc | Python | browlm13/nlp_project | /src/metrics/keyword_relavance_functions.py | UTF-8 | 1,327 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
"""
Keyword selection function performance
Scorring
"""
# version 1
def similarity_score(a,b):
""" combine all similarity measures into single score """
jsc_scaler = 15
ocs_scaler = 5
tcss_scaler = 0.05
jaccard_similarity_coefficient_score = jsc_scaler * jaccard_similarity_coefficient(a... | true |
f941db833819c697966a4b792151d2b83d8f239c | Python | TK0431/AutoDo | /pic.py | UTF-8 | 823 | 2.5625 | 3 | [] | no_license | from PIL import ImageGrab
from PyQt5.QtWidgets import QApplication
from PyQt5.QtGui import *
import sys
def get_pic_byte(x, y, w, h):
return ImageGrab.grab(bbox=(x, y, w, h))
def save_pic(x, y, w, h, path):
pic = get_pic_byte(x, y, w, h)
pic.save(path)
def get_pic(hwnd):
app = QApplication(sys.argv)... | true |
2fdee7df8054833820b46d4fffd88c1d5aeee044 | Python | evanthebouncy/dota_hero_semantic_embedding | /scrape_games.py | UTF-8 | 642 | 2.609375 | 3 | [] | no_license | import requests
import json
import time
teams = []
seen = set()
for i in range(1000):
try:
time.sleep(0.5)
print i, len(seen)
url = 'https://api.opendota.com/api/publicMatches'
if len(seen) > 0:
url += '?less_than_match_id={}'.format(min(seen))
r = requests.get(url)
# print url
for... | true |
c07bd433c8c0998825ef550c6b2e8989f8f72251 | Python | dubliyu/AI_pawn_game | /console.py | UTF-8 | 5,021 | 3.59375 | 4 | [] | no_license | # Carlos Leon, Mary Wilson
# This file contains functions for input/output
def print_world(world):
print("\n A B C ")
print(" +---------+")
index = 1
row_s = ""
for row in world.board:
row_s = str(index) + "| "
for i in row:
# Add character
if i == 'e': row_s += ' '
if i == 'b': row... | true |
c5e3a7afa52ba20ed8025fa5b83e6874b5c797ef | Python | Labs-Apps-exemples/Wikisearch | /OLD VERSIONS (use at your own risk)/wikisearch_v4.py | UTF-8 | 1,157 | 3.375 | 3 | [] | no_license | import wikipedia
# Used for splitting text into sentences, I didn't want to reinvent the wheel. #
import re
# Written by Robbie Barrat, 2014-2015 #
def findarticle(subject, keyword):
page = wikipedia.page(subject)
pagecontent = page.content
breakinto(pagecontent, keyword)
def breakinto(pagecontent, keyword... | true |
df1618829e11bdf8358c52f39475073e9c5824a5 | Python | dvishwajith/shortnoteCPP | /languages/python/functions/function_example.py | UTF-8 | 864 | 4.03125 | 4 | [] | no_license | #!/usr/bin/env python3
def func(a,b):
a = 4
b = 5
def func_str(str):
# str[0] = 'a' This cannot be done
str = "bla bla" # This will only chang on local fnction copy. Python is pass by label anyway
a = 7
b = 8
func(a,b)
print(a,b) # you can see that variables does not change
c_str = "test"
func_s... | true |
ff2b521f1d90d71fa9705c902a09497456c0fd05 | Python | codeaudit/style-transfer | /v1_embedding/iterative_policy.py | UTF-8 | 1,542 | 2.71875 | 3 | [] | no_license | import tensorflow as tf
class IterativePolicy:
def __init__(self, start_training_generator, generator_steps=100, discriminator_steps=100):
self.train_generator = tf.Variable(start_training_generator, trainable=False, dtype=tf.bool)
self.counter = tf.Variable(0, trainable=False, dtype=tf.int32)
... | true |
a106de3d98d52d0b18a1ce12779652c5968375b4 | Python | uhr-eh/cob_driver_sandbox | /cob_hwmonitor/python/setOff_Channel_6.py | UTF-8 | 505 | 2.71875 | 3 | [] | no_license | #!/usr/bin/python
from serial import *
s = Serial(port="/dev/ttyUSB0",baudrate=230400, bytesize=EIGHTBITS, parity=PARITY_NONE, stopbits=STOPBITS_ONE, timeout=3)
print "Set Switch OFF"
s.open()
print "Disable Channel 1"
send_buff_array=[0x85,0x0A,0x00,0x00]#sending
message = ""
for i in send_buff_array:
message +=... | true |
7d84622e7afc08b4266445ed4ebdd2bd793cfe18 | Python | pete-may/tetris-cube | /knuth/algo-x.py | UTF-8 | 883 | 2.75 | 3 | [] | no_license | from dancing_links import DLX
from cuboid import Cuboid
import numpy as np
from os import path
filename = "/Users/petermay/Documents/Processing/Tetris/shared-state"
import sys
boardSize=4
blockNum = 12
X = set()
S = []
for x in range(blockNum):
X.add(x+1)
for x in range(boardSize):
for y in range(boardSize):... | true |
f917ac66dfec34430aa1914725ac41df4f92d426 | Python | btruck552/100DaysPython | /Module1/Day05/module1_day05_strFormat.py | UTF-8 | 2,768 | 4.3125 | 4 | [
"MIT"
] | permissive | """
Author: CaptCorpMURICA
Project: 100DaysPython
File: module1_day05_strFormat.py
Creation Date: 6/2/2019, 8:55 AM
Description: Learn the basics of formatting strings in python.
"""
# Python contains built in methods to modify strings.
cheers = "where everybody knows Y... | true |
a4124468f270f4d227b4fe2b7929f334c7fa77d4 | Python | willbelucky/SocialMediaAnalytics | /assignment_2/lda/lda_sample.py | UTF-8 | 2,129 | 3.125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
:Author: Jaekyoung Kim
:Date: 2018. 2. 12.
"""
import re
import gensim
from gensim import corpora
from nltk.stem.porter import PorterStemmer
from nltk.tokenize import RegexpTokenizer
from stop_words import get_stop_words
from assignment_2.data.data_reader import get_speeches
from assignment... | true |
bb167aa95a1596413b15fd41765c061a371abfca | Python | Deanwinger/python_project | /python_fundemental/195_hand_out_cookies.py | UTF-8 | 542 | 3.4375 | 3 | [] | no_license | # leetcode 455
# 极其简单, pass
class Solution:
def findContentChildren(self, s, g) -> int:
s = sorted(s)
g = sorted(g)
counter = 0
i = j = 0
print(s)
print(g)
while i< len(s) and j < len(g):
if g[j] >= s[i]:
counter += 1
... | true |
50ac4c873c35f472d9b794cbb61c4425486371bd | Python | kali-kb/actions-test | /pyfile.py | UTF-8 | 109 | 2.765625 | 3 | [] | no_license | def sum(lst):
result = 0
for i in lst:
result += i
return result
if name == "__main__":
sum() | true |
b5652eb62a69847d37ea0af8064b305e2ee05fe8 | Python | s6mon/fixPicture | /src/lib/expe.py | UTF-8 | 2,901 | 2.703125 | 3 | [] | no_license |
import sys
import math
import numpy
import datetime
from . import drawExpe
center0 = [0, 0, 0]
nbTargets = 9
def isInTarget(thetaCible, thetaRotation, distance, rayonCible, pdp):
"""True ou False selon si x y est dans la cible"""
def radius_InitToTarget (radius):
"""calcule le rayon entre c1 et c5
Fonction uni... | true |
707757f98be69fd981561b608e32148931a2f8f5 | Python | dmntlr/predictiveproject | /Desktop/Studium/5. Semester/Predictive Analytics/Gruppenarbeit/WZ2 ProjectDB.py | UTF-8 | 5,188 | 3.28125 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
from operator import itemgetter
import numpy as np
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
import re
from sklearn.preprocessing import PolynomialFeatures
... | true |
6ba64e4c77b81e197c500f53e3d07f63062cd43c | Python | qingli411/gotmtool | /gotm_env_init.py | UTF-8 | 5,859 | 2.734375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
#
# Initialize GOTM environment
#
# Qing Li, 20200423
import os
from ruamel.yaml import YAML
from gotmtool.utils import *
def main():
"""Set up GOTM environment variables
"""
# print some instructions
print_help()
# inquire GOTM environment file
while True:
envf... | true |
e03c77dc2e49232ea0ca9fb7b6681b8230dddbcd | Python | marin123/adventOfCode | /aoc2018/src/day_8_1.py | UTF-8 | 907 | 2.875 | 3 | [] | no_license | def parse_input(input_data, metadata_total):
if len(input_data) > 0:
child_no = int(input_data[0])
metadata_no = int(input_data[1])
if child_no > 0:
if metadata_no > 0:
metadata = input_data[-metadata_no:]
metadata_total = metadata_total + sum(meta... | true |
6c9bfce63680b4b94993da9ef76f40c9663cba66 | Python | chiraag-kakar/scholarscraper | /script.py | UTF-8 | 1,518 | 2.546875 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup as bs
queries = ['Role for migratory wild birds in the global spread of avian influenza H5N8',
'Uncoupling conformational states from activity in an allosteric enzyme',
'Technological Analysis of the World’s Earliest Shamanic Costume: A Multi-Scalar, Expe... | true |
7f9658c6fb80c08086fecb21c7cf9321025b00f0 | Python | Pancho-mk/scraping_news | /kurir_mk.py | UTF-8 | 902 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python
# Scraping news from a website and writing the headlines and the links in a csv file.
# Opens that file for reading
import requests
from bs4 import BeautifulSoup
import csv
import os
from subprocess import Popen, PIPE
r = requests.get('https://www.kurir.mk')
#print(type(res))
soup = BeautifulSou... | true |
11b8e85a26181bd5fbf25cd0f7510d99ed5b5a11 | Python | wulu473/paparse | /tests/test_predicates.py | UTF-8 | 158 | 2.515625 | 3 | [] | no_license | from paparse.predicates import issubclassof
def test_issubclassof():
assert issubclassof(int)(int) is True
assert issubclassof(object)(int) is True
| true |
e449fcbf63768cc2ef10224b770baf8adc2c1da0 | Python | icanneverwin/scriptsRepo | /courses/MIT/problemset2/p1.py | UTF-8 | 952 | 3.625 | 4 | [] | no_license | #def cardbalance(balance: int, annualInterestRate: int, monthlyPaymentRate: int, monthCount: int) -> int:
def cardbalance(balance: int, annualInterestRate: int, monthlyPaymentRate: int) -> int:
'''
balance: user's current balance
annualInterestRate: bank's annual rate
monthlyPaymentRate: us... | true |
af19c95e0a900cb6d5bc981570a80f38cecd1597 | Python | peteshadbolt/lab_code | /Calibration/calibrate_and_fit.py | UTF-8 | 6,477 | 2.59375 | 3 | [] | no_license | #### Code that sweeps a fringe on a chosen heater, whilst holding the voltage on other heaters constant.
#### Then fits to this data and stores the fitted parameters to disk.
import math
import numpy as np
from numpy import pi
from matplotlib import pyplot as plt
from scipy.optimize import fmin
import qy
import qy.se... | true |
a20157c4e151b38ccd0e0a1be5ca6e34683a423b | Python | StanleyAlbayeros/MCV_M5_VR_G04 | /W4/src/read_txt_as_table.py | UTF-8 | 2,546 | 2.515625 | 3 | [] | no_license | import os
import re
from collections import OrderedDict
import numpy as np
from numpy import nan
import csv
# This string is slightly different from your sample which had an extra bracket
RESULTS_PATH="../outputs/task_b/txt_results/COCO_KITTI_MOTSC/"
def read_file(file):
f = open(os.path.join(RESULTS_PATH, file),... | true |
f0dcd3f94440f16674e144558a65625d103507f3 | Python | axelinternet/madmom-scripts | /complex_run.py | UTF-8 | 6,614 | 2.546875 | 3 | [] | no_license | import subprocess
import argparse
import csv
import os
from tqdm import tqdm
from clips_list import clips
from mixdown_list import mixdown_clips
from madmom.evaluation.onsets import OnsetEvaluation
"""
This is a quick testrun that better utilizes the pre-built
sample scripts that run different methods. We s... | true |
a03be3a672760f070b7770b4e6ea86e4efe61381 | Python | kapil780/Algorithms | /Recursion/Count_consonant_recursion.py | UTF-8 | 719 | 4.125 | 4 | [] | no_license | # Given a string, count the number of consonants.
# Note a consonant is a letter that is not a vowel
# i.e. a letter that is not a,e,i,o,u.
input_str_1 = "abc_de"
input_str_2 = "LuCiDProGrAMiNG"
vowels = "aeiou"
def iterative_const_count(str_val):
count = 0
for i in str_val:
if i.lower() not in vowels ... | true |
2065cf2b111a5012aa5a88273bfd9ee07877feea | Python | croaxmodulos/StochasticEvolutionaryOptimizer | /Helpers/mappers.py | UTF-8 | 735 | 3.796875 | 4 | [] | no_license | import numpy as np
def map_linearly_from_to(values, from_range, to_ranges):
"""Given the array of values [x_1, ..., x_i, ..., x_n],
where x_i is defined in the range [from_range[0], from_range[1]],
map all x_i linearly to another set of ranges [to_ranges[i][0], to_ranges[i][1]]
Transformation is line... | true |
bf193143079e20f4d1a0a373136d27d04ec3276c | Python | matmarczak/pynapitime | /src/browser.py | UTF-8 | 7,990 | 2.71875 | 3 | [] | no_license | from typing import List, Dict, Union
import requests
from bs4 import BeautifulSoup
import re
import difflib
from src.common import parser_request
from src.exceptions import PyNapiTimeException
Movie = Dict[str, Union[str, int]]
def time_to_ms(timestr):
extracted = re.search(r'(\d{2}):(\d{2}):(\d{2}).(\d*)', ti... | true |
c8a9025d9340c32f32d3f042b0efa2d2557f075d | Python | djohnkang/iot | /time_test3.py | UTF-8 | 372 | 3.125 | 3 | [] | no_license | import time
from time import localtime
from datetime import datetime
t1 = time.time()
print(t1)
n1 = datetime.now()
print(n1)
time.sleep(0.3)
t2 = time.time()
print(t2)
n2 = datetime.now()
print(n2)
print(t2-t1)
elapsed = (n2-n1)
print(elapsed.total_seconds() )
tt = localtime(t1)
print(tt)
tt = datetime.strptim... | true |
979baa8b12014fd7153f20d44dda458faccef2fb | Python | leoheyns/gamejam2021 | /main.py | UTF-8 | 7,596 | 2.859375 | 3 | [] | no_license | from Player import Player
import pygame
pygame.mixer.init()
from Player import Player
from World import World, items
from Timer import Timer
from global_constants import *
import copy
from moviepy.editor import *
import moviepy
FPS = 60
WIN = pygame.display.set_mode((WIDTH * SCALE, HEIGHT * SCALE))
pygame.display.se... | true |
f6bab63100ebea96071e16caf80d61b27c35f7f4 | Python | Abbodavi/programming_davide_abbondandolo | /midterm_16012020/script/Davide_Abbondandolo.py | UTF-8 | 1,507 | 2.6875 | 3 | [
"MIT"
] | permissive | PAM=open("./PAM250.txt","r")
BLOSUM=open("./BLOSUM62.txt","r")
FASTA=open("./alignments.fasta","r")
def sub_mat(input_matrix):
pair_value={}
flag=False
a=0
for line in input_matrix:
if flag==False:
AA=line.split()
AA=AA[6]
else:
values=line.split()
for i in range(len(values)):
pair=AA[i]+AA[a]
... | true |
66d25755c9d365e557ce0520afd9cff5a5805fec | Python | SyedTanzimAlam/Machine_Learning_with_scikit_learn | /save_model_joblib.py | UTF-8 | 890 | 3.1875 | 3 | [] | no_license | """@author: Tanzim"""
# Save Model Using joblib
import pandas as pd
filename = "PUT THE .csv file"
colnames = ['Column names in quotes seperated by comma']
dataset = pd.read_csv(filename, names=colnames).values
# separate array into input and output components
X = dataset[:,0:8] # rows:columns
Y = dataset[:,8]
from skl... | true |