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 |
|---|---|---|---|---|---|---|---|---|---|---|
66b1e6ab76e35bf014c116b7917c417130c63fb4 | m-bojenko/cs102 | /magic_december/venv/echo_bot.py | UTF-8 | 7,207 | 3.046875 | 3 | [] | no_license | import telebot
from datetime import date
import calendar
from typing import List, Tuple
access_token = '1469858290:AAHpCC6exxgDwV-MZA-uVs9K4UrSUE97gNk'
# Создание бота с указанным токеном доступа
bot = telebot.TeleBot(access_token)
keyboard1 = telebot.types.ReplyKeyboardMarkup(True, True)
keyboard1.row('a... | true |
aa4d0d77b8ae8df1df435bcc696ffab4b6cc3ef9 | jonahthelion/Physics-191 | /ESR/analysis/dpph.py | UTF-8 | 1,456 | 2.765625 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
import matplotlib.patches as mpatches
# Matplotlib settings
plt.style.use('ggplot')
plt.rcParams['font.serif'] = 'Ubuntu'
plt.rcParams.update({'font.size': 18})
plt.ion()
def slope_func(x, m):
return m*x
... | true |
585f5c8b4d9b30a6d94b62cd12bb16799e21bd4c | coblan/py2 | /try/dot_dict.py | UTF-8 | 698 | 3.140625 | 3 | [] | no_license | class DotDict(dict):
def __init__(self,*args,**kws):
super(DotDict,self).__init__(*args,**kws)
self.__dict__=self
def __setattr__(self,name,value):
if name=='__dict__':
super(DotDict,self).__setattr__(name,value)
else:
self[name]=value
class DotO... | true |
80ff1c318e09fda54e492a53eed201b9824bdfe5 | enihsyou/Python-Learning-Exercises | /161129第七次Python/future_year.py | UTF-8 | 1,011 | 3.640625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
import datetime
day_to_chinese = {
0: "一",
1: "二",
2: "三",
3: "四",
4: "五",
5: "六",
6: "日",
}
format_pattern = "%Y-%m-%d"
if __name__ == '__main__':
input_date = input("输入年-月-日(2016-12-06):")
try:
input_date_parsed = datetime.datetime... | true |
94223899eb6a697c7f64d78d4260f5743b0865da | JustBeYou/ctfs | /de1ctf2019/inter.py | UTF-8 | 7,425 | 2.640625 | 3 | [] | no_license | from struct import *
def load():
with open('bytecode.txt', 'rb') as f:
data = f.read()
return [ord(x) for x in data]
def byten(x, n): return (x >> (n * 0x8)) & 0xff
def byte0(x): return x & 0xff
def byte1(x): return byten(x, 1)
def byte2(x): return byten(x, 2)
def byte3(x): return byten(x, 3)
def byte... | true |
1da891ccd3d3e54fc4e595ac9bdcc126f2a81019 | MrzvUz/Python | /Python_Entry/dict.py | UTF-8 | 4,027 | 3.921875 | 4 | [] | no_license | # friend_ages = {
# "Rolf": 24,
# "Anne": 18,
# "Jen": 20
# }
# print(friend_ages["Anne"]) # to get value of Anne.
# friend_ages["Bob"] = 26 # to add Bob to friend_ages dict.
# print(friend_ages)
# print()
# friends = (
# {"name": "Rolf Smith", "age": 24},
# {"name": "Adam Wool", "age": 30},
... | true |
9062d995c838df7794e77f621e2682caebf3b92c | Deepak-gupta98/MACHINE-LEARNING | /restaurant_review.py | UTF-8 | 1,528 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Sat Oct 10 22:36:05 2020
@author: Deepak
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
dataset=pd.read_csv(r"C:\Users\Deepak\.spyder-py3\Restaurant_Reviews.tsv",delimiter='/t')
import re
import nltk
nltk.download('stopwords')... | true |
7268c5b5287b50b032b192e71176fe824d3e6a6f | NikhilSuresh24/PCA-Facial-Recognition | /PCA.py | UTF-8 | 6,497 | 2.890625 | 3 | [] | no_license | import numpy as np
import os
from PIL import Image
from tqdm import tqdm
import matplotlib.pyplot as plt
from matplotlib.image import imread
class PCA:
def __init__(self, target_names, K=100, max_images_per_person=50):
self.K = K
self.faces = []
self.eigenvectors = []
self.avg_fac... | true |
4915e37384e91e1a5220d3bc82b977d8b5eb3458 | nilankh/LeetCodeProblems | /September30days/cowsandbulls#299.py | UTF-8 | 1,340 | 3.125 | 3 | [] | no_license | #299
#page 99
##import collections
##def getHint(secret, guess):
## bulls = cows = 0
## for idx, num in enumerate(guess):
## if secret[idx] == num:
## bulls += 1
## else:
## continue
## count_secret = collections.ChainMapCounter(secret)
## for num in gues... | true |
4a1a5f754e587924cabdc06f68534375f9ff2dfd | RIverlLand/ComputerVision | /GaussianBlur/Gaussianblur.py | UTF-8 | 1,355 | 3.375 | 3 | [] | no_license | import cv2
# import numpy as np
image = cv2.imread('image/Computer.jpg')
r = (5, 5)
sigma1 = 1
sigma2 = 2
sigma3 = 3
sigma4 = 4
def main():
# while(True):
cv2.imshow("Result of sigma=%d " %sigma1, Gaussianblur(r, sigma1)) #printing stuff will be feeding params to the %d by the % instead of putting a comma behind... | true |
9e525eccbf10a710d6f37c903370cc10f7d2c62b | PandoraLS/CodingInterview | /AlgorithmsDataStructure_python/binary_search_tree.py | UTF-8 | 2,179 | 3.703125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# Author:sen
# Date:2020/4/2 14:15
class TreeNode:
def __init__(self, val):
self.val = val
self.left = None
self.right = None
def find(root, val):
if not root:
return None
if val < root.val:
return find(root.left, val)
elif val > root.va... | true |
a5c6becde2b02f6f5ebc5dedfbe7286ac0339fde | sunilkumarc/LearnPython | /2019/day2.py | UTF-8 | 1,347 | 4.46875 | 4 | [] | no_license | # Numbers
# - Addition
# - Subtraction
# - Multiplication
# - Division (diff between python2 and python 3)
# - Modulo
# - Parantheses for precedence
# - storing in variables and using in calculation
# - math library
# - pow
# - ceil
# - floor
# Strings
# - sequence of characters
# - ind... | true |
fbe684c406f60f6588537f486ba3a5e6c820afe0 | aponcedeleonch/Aalto-AMDM-Graph-Partioning | /clusterings.py | UTF-8 | 14,801 | 2.59375 | 3 | [] | no_license | from sklearn.cluster import KMeans, AgglomerativeClustering
from sklearn.mixture import GaussianMixture
import numpy as np
import itertools
from scipy.spatial.distance import pdist, cdist, euclidean, squareform
from resources import score_function, correct_cluster_labels
def get_nodes_to_merge(k_eig, cluster_centers,... | true |
7f1d9573755d8d9aa76f5c052c37c02d1149ee96 | arp97-njit/435-Project-1 | /q3b.py | UTF-8 | 151 | 3.15625 | 3 | [] | no_license |
#assuming positive numbers only
def getSortedArray(n):
rtnArray = []
for x in range(n,0,-1):
rtnArray.append(x)
return rtnArray
| true |
9ccdf2cd84ef99cbb8a9a684030558dd17dc11c4 | Jammy2211/PyAutoGalaxy | /autogalaxy/profiles/light/shapelets/abstract.py | UTF-8 | 1,202 | 2.796875 | 3 | [
"MIT"
] | permissive | from typing import Tuple
from autogalaxy.profiles.light.linear.abstract import LightProfileLinear
class AbstractShapelet(LightProfileLinear):
def __init__(
self,
centre: Tuple[float, float] = (0.0, 0.0),
ell_comps: Tuple[float, float] = (0.0, 0.0),
beta: float = 1.0,
... | true |
d137cadd7c14265a888d762b065b9f5d3d13b58f | satya-arjunan/spatiocyte-models | /2005.nishinari.prl/kinesinDiffusionAndMTbindEstimate/plot1000nM.py | UTF-8 | 1,101 | 2.578125 | 3 | [] | no_license | import numpy
import csv
import math
from matplotlib import rc
from pylab import *
from matplotlib.ticker import MaxNLocator
labelFontSize = 14
tickFontSize = 14
legendFontSize = 14
lineFontSize = 14
fileNames = ["actual1000nM.csv", "estimate1000nM.csv"]
legendTitles = ['actual', 'estimate']
speciesList = ['E']
lines ... | true |
6f961d4c9ea387cb0c61d9137172cca476571244 | mrx80/titanic | /paramd_titanic_1hotcat.py | UTF-8 | 8,365 | 2.75 | 3 | [] | no_license | import numpy as np
import pandas as pd
import math
from sklearn.preprocessing import StandardScaler
from sklearn.cross_validation import train_test_split
from time import time
from datetime import datetime
import tensorflow as tf
from tensorflow.python.ops.variables import global_variables_initializer
def mungecat(in... | true |
1092ee17f1dcfaffb6a21176dda08ba838e7629a | LBU-TeamHSBC/update-service-py | /src/adapters/lbuAdapter.py | UTF-8 | 472 | 2.59375 | 3 | [] | no_license | from adapters import Adapter
from config import config
import requests
class LbuAdapter(Adapter):
BASE_URL = config['lbu']['base_url']
def getData(self):
data = []
r = requests.get(LbuAdapter.BASE_URL + '/course/' + str(self.user_id))
courses = r.json()
for course in c... | true |
85280b95961a2fbaa06cd0b64b4389d04b195da4 | MMeunierSide/buck | /python-dsl/buck_parser/glob_watchman.py | UTF-8 | 4,577 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | """Glob implementation using watchman queries."""
from util import Diagnostic, memoized
import re
import os.path
import pywatchman
COLLAPSE_SLASHES = re.compile(r'/+')
class SyncCookieState(object):
"""Process-wide state used to enable Watchman sync cookies only on the
first query issued.
"""
def _... | true |
751d96ed3754c761da2b8c9ab37637220039c198 | olyakotelok/Protocols | /pop3 task/main.py | UTF-8 | 963 | 2.734375 | 3 | [] | no_license | import socket
import ssl
import select
HOST = "pop.yandex.ru"
PORT = 995
#почта и пароль, откуда читаем письма. Yandex
USERNAME = ""
PASS = ""
def send_cmd(cmd, sock):
sock.send((cmd + '\r\n').encode())
return read_responce(sock, 1)
def read_responce(sock, timeout):
responce = ' '
while True:
... | true |
5f24a7f779bbe91e216022618d5012561379e849 | SajadAzami/Data-Mining-Training | /DM17-AUT/HW2/Kaggle House Prediction/main.py | UTF-8 | 6,726 | 2.9375 | 3 | [] | no_license | """Kaggle House Prediction, 3/10/17, Sajad Azami"""
import math
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from sklearn import preprocessing
from sklearn.cross_validation import StratifiedKFold
from sklearn.cross_validation import cross_val_score
from sklearn.ensemble... | true |
de3d59a33d59fd9f6c21e502bce15f6a675e84ce | adrijanik/notebooks-cardiac | /mrinet/utils/crop_heart.py | UTF-8 | 4,764 | 2.984375 | 3 | [] | no_license | from skimage.filters import threshold_otsu
from skimage.morphology import binary_dilation, binary_erosion, binary_opening, binary_closing, disk
import numpy as np
def thresh_segmentation(patient_img):
"""Returns matrix
Segmententation of patient_img with k-means
"""
#Z = np.float32(np.ravel(patient_img... | true |
5a87f3460cf0d59216b44929784563103144e5d2 | Mandeep101/BoardBots-Server | /PlayerData.py | UTF-8 | 1,939 | 3.09375 | 3 | [] | no_license | import sqlite3
import datetime
conn = sqlite3.connect("PlayerDataB.dbf")
cr = conn.cursor()
try:
cr.execute("""CREATE TABLE PlayerData (
playerID CHAR(40) PRIMARY KEY,
joinDate DATE,
gamesPlayed INTEGER,
cardsPlayed INTEGER,
forwardsPlayed INTEGER,
leftsPlayed INTEGER,
rightsPlayed INTEGER,
hacksPlayed INT... | true |
842e6ae8964dd9a8037ac40f27651732e77586a5 | ManojKrishnaAK/python-codes | /MODULES/randex1.py | UTF-8 | 99 | 2.8125 | 3 | [] | no_license | #randex1.py
from random import randint
print(randint(0,9)) # possible random random numbers 0,1...9 | true |
cc36cd6a906a2da556b57393a6b8c5c7323bdcf8 | pytorch/examples | /fx/native_interpreter/use_interpreter.py | UTF-8 | 5,134 | 3 | 3 | [
"BSD-3-Clause"
] | permissive | import torch
import torch.fx
import operator
# Does this path not exist? Check that you've done the following:
# 1) Read README.md and follow the instructions to build libinterpreter.
# 2) If this file still does not exist after you've followed those instructions,
# check if it is under a different extension (e.g. ... | true |
7d61d1c872ece3920d462d73eccb16c19d9fba02 | Olamyy/ayo_olopon | /ayo/player.py | UTF-8 | 3,608 | 3.34375 | 3 | [
"MIT"
] | permissive | from settings import BoardConfig
from board import Board
import random
import math
class Player(object):
""" A game player """
def __init__(self, name, pits, store, points=0):
self.name = name
self.id = self.generate_id()
self.points = points
self.pits = pits
self.stor... | true |
a8d0199604b41115cc150eb155610573ab92096c | TeaCoffeeBreak/TF-Programs-for-Practice | /TF_NLP/imdb_review_lstm.py | UTF-8 | 2,786 | 2.5625 | 3 | [] | no_license | import tensorflow_datasets as tfds
import tensorflow as tf
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.preprocessing.sequence import pad_sequences
import numpy as np
import matplotlib.pyplot as plt
vocab_size = 10000
embedding_dim = 16
max_length = 120
trunc_type='post'
oov_token="<... | true |
03b39ac00e75b0b1a7c77ba3bf2ded80b53e9eff | aishsharma/DataStructures | /src/Tree/BinarySearchTree.py | UTF-8 | 1,314 | 3.78125 | 4 | [
"MIT"
] | permissive | """
Author: Aishwarya Sharma
"""
from typing import Any
class Node:
key = None
value = None
left_child = None
right_child = None
def __init__(self, key: Any, value: Any):
self.key = key
self.value = value
class BinarySearchTree:
root = None
def insert(self, root: Node, key: Any, value: Any) -> Node:
... | true |
69e2287117e42548709895c5b6d226ce100ad94d | pythonprogsnscripts/geekttrustproblems | /test/test_main.py | UTF-8 | 556 | 2.53125 | 3 | [
"Unlicense"
] | permissive | '''
This is test file for main program
Though it is not easy to test the argprase function,
have tried to test the main file
'''
import sys
import os
sys.path.append(os.path.dirname(__file__)+"/../")
from unittest import TestCase
from src.traffic_problem_1 import create_parser
class CommandLineTestCase(TestCase):
... | true |
4e1fbc905c746a4d5410b44d1271d44b77909adc | gizmoy/PySecurityCameras | /main.py | UTF-8 | 901 | 2.78125 | 3 | [] | no_license | import json
from optparse import OptionParser
from metaheuristics.simulated_annealing.simulated_annealing import SimulatedAnnealing
from domain.problem import Problem
if __name__ == '__main__':
# create parser & parse args
parser = OptionParser()
parser.add_option('-F', '--file', action='store', dest='fil... | true |
f953b8ede6d9d08c73552e233a2a5055aab47555 | kantal/WPC | /ISSUE-31/SOLUTION-11/rlecmp.py | UTF-8 | 483 | 2.9375 | 3 | [] | no_license | #!/bin/python
# don't forget to chmod +x
# cat banana.txt | ./rlecmp.py | hexdump -C
# cat banana.txt | ./rlecmp.py > banana.rle
import sys
from itertools import groupby
for k, g in groupby(sys.stdin.read()):
n = len(list(g))
# be careful: integer in Python is arbitrary length
while n > 255:
sys.st... | true |
62fc489b2b8bfd518369ee4779b098d27c0db76f | TalhaAbid/MWPToolkit | /mwptoolkit/loss/cross_entropy_loss.py | UTF-8 | 1,469 | 2.734375 | 3 | [
"MIT"
] | permissive | # -*- encoding: utf-8 -*-
# @Author: Yihuai Lan
# @Time: 2021/08/18 18:53:39
# @File: cross_entropy_loss.py
import torch
from torch import nn
from torch.nn import functional as F
from mwptoolkit.loss.abstract_loss import AbstractLoss
class CrossEntropyLoss(AbstractLoss):
_Name="cross entropy loss"
def __init... | true |
0d4eee81a6abea05f9ab3ffe3b32399b1b62c2d0 | PrzemoPoz/p1 | /zjazd1/kolekcje/zad1.py | UTF-8 | 238 | 3.3125 | 3 | [] | no_license | #zebranie liczb (nie więcej niż 10)
#obliczenie średniej
lista=[]
i=0
while len(lista)<10:
lista.append(int(input("Podaj kolejną liczbę do przetwarzania: ")))
print(lista)
print("Średnia wynosi", round(sum(lista)/len(lista),2))
| true |
e04a5730a48c11d374f59fe2b9498eb6638e0a57 | kurtisharms/libaisgpsd | /Boat.py | UTF-8 | 844 | 2.953125 | 3 | [] | no_license | __author__ = 'Kurtis Harms'
import datetime
from PositionReport import PositionReport
class Boat:
def __init__(self, boat_id):
self.boat_id = boat_id
self.position_reports = []
self.is_accurate = False
def get_id(self):
return self.boat_id
def get_position_reports(self):
... | true |
33a07d795727c36be6c345af274f7b3760fcac0e | wangyahong423/CoursePPT | /大一上/计算机导论/Python例子/python练习.py | UTF-8 | 146 | 2.984375 | 3 | [] | no_license | def f(a):
s=0
for i in a:
if i<=0:
continue
else:
s+=1
return(s)
a=[15,9,-9,8,-1]
print(f(a))
| true |
10dc2a6d3c8f8ac26efd38a1020324e4f7f49a94 | Sowmyareddy18/19A91A0564_Practice-Programs-Python- | /string1.py | UTF-8 | 375 | 4 | 4 | [] | no_license | name='Python'
print(name)
name='Python programming'
print(name[1:6:2])
print(name[-1])
print(name[-2])
#slicing using negative indexing
print(name[-5:-2])
#capitalizing
S='devi priya'
print(S.capitalize())
print(S.upper())
print(S.lower())
print(S.isupper())
print(S.islower())
#output
Python
yhn
g
n
... | true |
cdfdeefdb4dcc0c296634fa051aa9b49e2c12652 | willsouza04/AlienInvasion | /bullet.py | UTF-8 | 1,197 | 3.578125 | 4 | [] | no_license | import pygame
from pygame.sprite import Sprite
class Bullet(Sprite):
"""Classe que gerencia os projéteis atirados pela espaçonave."""
def __init__(self, ai_settings, screen, ship):
"""Cria um porjétil a partir da mesma posição da aeronave."""
super(Bullet, self).__init__()
self.screen ... | true |
89d45130235c22e36401f3cb64730bb20e6a412f | ortolanph/maze_game | /core/maze/GameMaze.py | UTF-8 | 1,603 | 2.890625 | 3 | [] | no_license | from random import randrange, getrandbits
from maze_api.room import symbol_from
from core.elements.Obstacles import OBSTACLES_ARRAY, ObstacleFactory
from core.elements.Wall import WallBuilder
from core.items.Item import Coin
from core.maze.GameRoom import GameRoom
class GameMaze:
__maze = dict()
skin_manage... | true |
04f52f69559255cc8c2803de6860d2aa5a9cc1ae | pyvista/pyvista | /pyvista/plotting/actor_properties.py | UTF-8 | 4,208 | 2.921875 | 3 | [
"MIT"
] | permissive | """Module containing pyvista implementation of vtkProperty."""
from . import _vtk
from .opts import InterpolationType, RepresentationType
class ActorProperties:
"""Properties wrapper for ``vtkProperty``.
Contains the surface properties of the object.
Parameters
----------
properties : vtk.vtkPro... | true |
a1fe06bf6c52795a21b841b84f939338687ccb13 | mortenjc/lang | /python/thinkpython/test/test.py | UTF-8 | 642 | 2.90625 | 3 | [] | no_license | import unittest
import helper
class SimpleTest(unittest.TestCase):
def setUp(self):
self.h = helper.TestHelper()
self.assertNotEqual(None, self.h.driver)
def test_randomtest1(self):
print "Testing...\n"
try:
self.h.getUrl("http://www.google.com")
assert "oogle" in self... | true |
b634cfdf552ffee4040e826754907a6c4bbec32f | hyunjun/practice | /python/problem-BST/serialize_and_deserialize_bst.py | UTF-8 | 2,096 | 3.265625 | 3 | [] | no_license | # https://leetcode.com/problems/serialize-and-deserialize-bst
from TreeNode import TreeNode
# 2.89%
class Codec0:
def serialize(self, root):
if root is None:
return ''
res, queue = [], [(root, 0)]
while queue:
cur, idx = queue[0]
del queue[0]
... | true |
7904cca05b354fb53a27c29e5826e35c653c41ba | zdyxry/LeetCode | /greedy/1094_car_pooling/1094_car_pooling.py | UTF-8 | 444 | 3.25 | 3 | [] | no_license |
class Solution(object):
def carPooling(self, trips, capacity):
dcap = [0] * 1001
for p, start, end in trips:
dcap[start] -= p
dcap[end] += p
for delta in dcap:
capacity += delta
if capacity < 0:
return False
... | true |
2dc1b30c38712b4cb1b3f29bf0d35389827fed53 | NativeInstruments/newrelic-cli | /newrelic_cli/model.py | UTF-8 | 3,342 | 2.59375 | 3 | [
"MIT"
] | permissive | class ConfigFileError(Exception):
pass
class ConfigFieldMissingError(ConfigFileError):
pass
class ScriptFile():
def __init__(self, dictionary):
try:
self.name = dictionary['name']
except (KeyError, TypeError):
raise ConfigFieldMissingError("Missing name for the sc... | true |
255b81e1d493024aea193809518de6128bf64e0b | Nagendra6231/jenkin | /webapplicagion1.py | UTF-8 | 586 | 2.515625 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
driver = webdriver.Chrome(executable_path="C:\webdriver\chromedriver_win32\chromedriver.exe")
driver.implicitly_wait(5)
driver.maximize_window()
driver.get("https://www.google.com/")
time.sleep(5)
driver.find_element_by_xpath("//... | true |
dde93b22e51e9ec502cc0242a82ee12f7581bb16 | tonymendolia/Cube | /GUI/CardImageWidget.py | UTF-8 | 4,511 | 2.875 | 3 | [] | no_license | """CardImageWindow class module."""
import threading
import urllib
import time
from PyQt5.QtGui import QPixmap
from PyQt5 import QtGui, QtCore, QtWidgets
################################################################################
class CardImageWidget(QtWidgets.QLabel):
"""A window for showing a card image... | true |
1c8f539c29ada5302942f50a007dcb6ee6a602c2 | meizhoul/meiduo | /meiduo/meiduo_mall/meiduo_mall/meiduo_mall/utils/fastdfs/fdfs_storage.py | UTF-8 | 849 | 2.796875 | 3 | [] | no_license | from django.core.files.storage import Storage
class FastDFSStorage(Storage):
"""自定义文件存储类"""
def _open(self, name, mode='rb'):
"""
当要打开某个文件时来调用此方法
:param name: 要打开的文件名
:param mode: 打开的文件模式
"""
pass
def _save(self, name,content):
"""
当要上传图片时... | true |
3cbc28548ec57a7e30733f1d1ed808a9617c8749 | TonyHong15/Leetcode-Practice | /Permutations.py | UTF-8 | 494 | 2.84375 | 3 | [] | no_license | from typing import List
class Solution:
def permute(self, nums: List[int]) -> List[List[int]]:
if len(nums) == 0 or len(nums) == 1:
return [nums]
else:
permlist = []
for i in range(len(nums)):
permutations = self.permute(nums[:i] + nums... | true |
09957bc498e1e07bc7037e96fa03fb65fb82d7cd | bluhb/AdventOfCode2020 | /day8/main.py | UTF-8 | 1,852 | 3.109375 | 3 | [] | no_license | import FileRead
import re
f = FileRead.ReadInput(input("Filename:\n"))
def parseInput(f):
opcodes = []
search = re.compile("^(.+) (.+)")
for l in f:
instruct = re.findall(search, l) # find instruction + argument number
instruct = [y for x in instruct for y in x] #convert the nested tuple t... | true |
7bae00ac3041ff0c132af4f7a0216256ebb7a341 | henrybear327/Sandbox | /Google/CodeJam/2020/1C/gen.py | UTF-8 | 140 | 3.203125 | 3 | [] | no_license | import random
print(1)
n = 5
c = random.randint(1, 5)
print(n, c)
for i in range(n):
print(random.randint(1, 10), end = ' ')
print('')
| true |
ee08481ed2a0f111bd2b12833811e220c61a9561 | EDAII/Lista2_2018-02-Allan_Filipe | /TrabalhosEDA2/Trabalho02/views.py | UTF-8 | 4,970 | 3.0625 | 3 | [] | no_license | from django.shortcuts import render
import time
def home(request):
if request.method == 'POST' and request.FILES['myfile']:
myfile = request.FILES['myfile']
byte_str = myfile.file.read()
# Convert to a "unicode" object
text_obj = byte_str.decode('UTF-8')
columns_description... | true |
d1ed1349034a401e38ccfcf1b87a56074911960b | renjieliu/leetcode | /2500-2999/2549.py | UTF-8 | 149 | 2.59375 | 3 | [] | no_license | class Solution:
def distinctIntegers(self, n: int) -> int: # O( 1 | 1 )
return n - (n!=1) # if n == 1 then return 0 else return n-1
| true |
8377d58b91fba34100739aa3bd449515b94ee53f | MosabAboidrees/VFPred | /codes/helper_function.py | UTF-8 | 496 | 3.453125 | 3 | [] | no_license | """
Helper functions
"""
from scipy.spatial import distance
import numpy as np
def cosineSimilarity(sig1,sig2):
'''
Computes cosine similarity of two signals
Arguments:
sig1 {list} -- signal 1
sig2 {list} -- signal 2
Returns:
[float] -- cosine similarity value
'''
if(abs(np.sum(sig1)-0.0)<1e-5 or a... | true |
aabd3039debeb23000e56b00572d80aa08af55a8 | hongyong3/TIL | /Algorithm/Swea/D2_1945.py | UTF-8 | 424 | 3.03125 | 3 | [] | no_license | import sys
sys.stdin = open("D2_1945_input.txt", "r")
T = int(input())
num = [2, 3, 5, 7, 11]
for test_case in range(T):
N = int(input())
mat = [0, 0, 0, 0, 0]
j = 4
for i in range(N):
while j >= 0:
if N % num[j] == 0:
N = int(N / num[j])
mat[j] += 1
... | true |
dd4b7b7c7f6d5d0c133c190cf38f87b70d3eedcd | minuso/leetcode | /0206/reverseList.py | UTF-8 | 192 | 2.96875 | 3 | [] | no_license | def reverseList(self, head: ListNode) -> ListNode:
cur, pre = head, None
while cur:
nxt_head = cur.next
cur.next, pre = pre, cur
cur = nxt_head
return pre | true |
39560b37e5d812132b7c823bfc840ddd4241d7f6 | Braiiin/client | /client/libs/base.py | UTF-8 | 4,826 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | import datetime
import json
from client.exceptions import LogicException, ClientException
from flask import current_app
from client import logger
import requests
class Logic:
"""Handles communication with logic tier and auth"""
access_token = None
response = None
version = 'v1'
def __init__(self... | true |
1d9805d49b812d8c40d1a7517a70f8be2f12ab2c | aryan68125/python-GUI-programs | /image.py | UTF-8 | 607 | 3.25 | 3 | [] | no_license | from tkinter import *
#if the import of ImageTk does't work then
#type in terminal :- for python3.5 and above--> sudo apt-get install python3-pil python3-pil.imagetk
from PIL import ImageTk,Image
window = Tk()
window.title("Learn how to use icon, Images and Exit buttons")
#how to put an exit button on the window
Butt... | true |
54fdb56a30b19ac4f73120d73e2d3179eada780d | HoYoung1/backjoon-Level | /backjoon_level_python/17485.py | UTF-8 | 958 | 2.71875 | 3 | [] | no_license | import sys
def solve(N, M, matrix):
dp = [[[sys.maxsize] * 3 for _ in range(M)] for _ in range(N)]
# init
for idx, cost in enumerate(matrix[0]):
dp[0][idx][0] = cost
dp[0][idx][1] = cost
dp[0][idx][2] = cost
dp[0][0][0] = sys.maxsize
dp[0][-1][2] = sys.maxsize
for i ... | true |
968b84eb07ee8acdc3eede0691a8f4d6801324f2 | tomasbm07/IPRP---FCTUC | /3/3_16.py | UTF-8 | 151 | 3.46875 | 3 | [] | no_license | frase = input('Digite uma frase: ')
total = ''
frase = frase[::-1]
for i in range(len(frase)):
print(frase[i] + total)
total = frase[i] + total | true |
c6275d69e517cccb5ee4982bbcc5147fefe16c09 | kidaa1/Movie-revenue-prediction-with-hierarchical-model | /pre_process.py | UTF-8 | 1,327 | 3.03125 | 3 | [] | no_license | from util import *
import mysql.connector
import pandas as pd
import csv
import ast
class KnowledgeGraph():
def __init__(self):
self.edge_list = []
def Movie_genre(self):
data = pd.read_csv(movie_path)
df = pd.DataFrame(data)
columns = df.columns
for row in df[['... | true |
62a88151bc45039dee77fb243696a28aebf942b5 | jacobL/urinfo | /python/iDAP_DailyProcess/NikkeiCrawling.py | UTF-8 | 2,948 | 2.515625 | 3 | [] | no_license | import pymysql
from datetime import datetime, timedelta
from bs4 import BeautifulSoup
import requests
import re
import dbconfig
def WebCrawling():
web = "nikkei" #"日經中文網"
days = 5
try:
conn = pymysql.connect(host=dbconfig.host, port=dbconfig.port, user=dbconfig.user, passwd=dbconfig.passwd, db=dbcon... | true |
fe403ad863fcf1b8417b5bf5a325f0773641f8cf | dezcalimese/nucamp-bootcamp | /1-Fundamentals/weeks1-2/composite_data_types.py | UTF-8 | 572 | 4.03125 | 4 | [] | no_license | """
Composite Data Types
"""
# Storing a List
nucamp_locations = ["Seattle", "Tacoma", "Bellevue"]
# Storing a Dictionary
Bob_Info = {"name": "Bob", "age": 35, "cash": 100.25, "retired": False}
# Storing a Tuple
my_tuple = ("apple", "banana", "cherry")
# Storing a Set
my_set = {"cats", "dogs", "birds"}
print("Data Ty... | true |
f998b6d2c7807354915f604951dd0cd84d4e47b6 | newface7/Retos | /Reto1.py | UTF-8 | 462 | 3.359375 | 3 | [] | no_license | def factura_energia(numeroDeSuscriptor: str, cargoBasico: int, kwSubsidiados: int, cargoPorkwExtra: int, kwConsumidos: int) -> str:
totalFactura = (cargoBasico + (kwConsumidos-kwSubsidiados)*cargoPorkwExtra)*1.19
totalFactura = round(totalFactura, 1)
return f"El cliente {numeroDeSuscriptor} debe canc... | true |
11c710dd74272f8113656c64e85e4f5ffd7172e4 | jgsimard/pgm-pytorch | /datasets/em_gaussian.py | UTF-8 | 688 | 2.8125 | 3 | [] | no_license | import os
import numpy as np
from torch.utils.data import Dataset
import torch
class EMGaussianDataset(Dataset):
def __init__(self, data_root, train=True):
file = "train.txt" if train else "test.txt"
root = os.path.join(data_root, file)
if os.path.isfile(root):
data = np.loadtx... | true |
abc79aba5d808b1f04c291d0c2bdf766479791ca | theroadninja/Python3SatGenerator | /satlib/clause.py | UTF-8 | 3,637 | 3.59375 | 4 | [] | no_license | from lit import Lit
class Clause:
'''
Normally this would be immutable, but a "feature" of python is that you cant protect anything in a class,
so instead we will just pretend this shit is immutable.
'''
def __init__(self, *literals):
if literals is None:
raise ValueError("")
... | true |
f23ed88fe7ceb81424bc339dc133c076ca20a603 | RXBXX/Python | /const.py | UTF-8 | 194 | 3.0625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
PI = 3.14
def main():
print "PI:", PI
print(u"第一次调用")
main()
if __name__ == '__main__':
print(u"第二次调用")
main() | true |
fc43f73b62fec865e641ea218425ebf5a9f35b2b | shubham-debug/Python-Programs | /hexi.py | UTF-8 | 1,088 | 3.40625 | 3 | [] | no_license | #hexadecimal numbers
import math
def gcd2(x,y):
ans=0
n=min(x,y)
if(x==y!=1):
return True
for i in range(2,n+1):
if(x%i==0 and y%i==0):
return True
return False
def gcd1(x,y):
a=min(x,y)
b=max(x,y)
while(a):
c=b
b=a
... | true |
a1f29acc7b2f005be0d1cd704354cdd3e0d9e0d9 | JTrillo/NuclearInspections | /code/acquisitor.py | UTF-8 | 5,192 | 2.671875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3
import threading
import time
import requests
import json
import random
import firebase_admin
from firebase_admin import credentials
from firebase_admin import storage
import hashlib
import os
import datetime
class Acquisitor(threading.Thread):
def __init__(self, thread_id, acq_name, times, beg... | true |
429d020e75b3f68abd79d6bfc84c5b738446b980 | elani0/leetcode-python-solutions | /208 Trie.py | UTF-8 | 254 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Mar 31 16:39:00 2017
@author: Elani
"""
#208. Implement Trie (Prefix Tree)
#Implement a trie with insert, search, and startsWith methods.
#构建字典树,实现插入,搜索,和指定位置节点访问
| true |
673d6b2ec7a399fd5d2e2abdc40d9362a9b86213 | rlarlgnszx/backjun | /자료구조/10828.py | UTF-8 | 895 | 3.53125 | 4 | [] | no_license | class stack:
stacklist=[]
def __init__(self):
self.n = int(input())
for i in range(self.n):
a = input()
if "push" in a:
self.push(a[-1])
elif "pop" in a:
self.pop()
elif "size" in a:
self.size()
... | true |
837c80e5a931f4375ec37ed3602cc4d3f60715bf | miblazej/pie | /siewing.py | UTF-8 | 282 | 3.203125 | 3 | [] | no_license | def sew(n):
pierwsze = []
sito = [False, False] + [True] * (n - 1)
for p in range(2, n + 1):
if sito[p]:
pierwsze.append(p)
for i in range(p, n + 1, p):
sito[i] = False
return pierwsze
A = sew(132)
print(A)
| true |
8998baea9584bb67acf2da4de01c0f893dc0bdd2 | ali225/Python-Examples-Source-Codes-With-Raspberry-PI-project | /testone.py | UTF-8 | 317 | 3.0625 | 3 | [] | no_license | import time
import RPi.GPIO as GPIO
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.OUT)
while True:
GPIO.output(11,0)
print "Led on now pin off zero volt "
time.sleep(.80)
GPIO.output(11,1)
print "Led on now pin on 3.3 volt "
time.sleep(.80)
| true |
34feebd5efa5b2421187ea652ad8d2296c7f4266 | Arosebine/PythonJobs | /day1/chapter2/ifelse.py | UTF-8 | 94 | 3.53125 | 4 | [] | no_license | a = 5
b = 13
if a > b:
print('a is greater than b')
else:
print("Code couldn't run")
| true |
4e86c48f236e4f3cc10912c1d0cedf67ddde1685 | 18810326862/Python_study_120191080516 | /homework/HomeWork7/work1.py | UTF-8 | 3,221 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
#-*- coding:utf-8 -*-
# file:work1.py
# author:dell
# datetime:2021/5/24 21:36
# software: PyCharm
'''
this is functiondescription
'''
# import module your need
'''
1 给定一个文件,请用正则表达式,逐行匹配提取其中的URL链接信息,并保存到另外一个文件中;
提示,文件有10000行,注意控制每次读取的行数;
'''
import re
from threading import Lock
from concurre... | true |
b69112e090bcfadbcf3facedf5c5064892a4439c | DDDlyk/learningpython | /进程/08-多任务文件夹拷贝.py | UTF-8 | 495 | 3.234375 | 3 | [] | no_license | import os
def main():
# 1.获取用户要copy的文件夹的名字
old_floader_name = input("请输入要copy的文件夹的名字:")
# 2.创建一个新的文件夹
os.mkdir(old_floader_name + "复件")
# 3.获取文件夹中待copy的文件名字 os.listdir()
file_names = os.listdir(old_floader_name)
print(file_names)
# 4.创建进程池
# 复制原文件夹中的文件,到新文件夹中的文件去
if __name... | true |
c0541aa231fe6f0f2ee34e78797c3f5fdd73cd1e | easyopsapis/easyops-api-python | /cmdb_extend_sdk/utils/http_util.py | UTF-8 | 3,948 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# stdlib
import base64
import urllib
import urllib2
import json
import logging
class EasyException(Exception):
def __init__(self, code, code_explain, error, data):
"""
easyops的错误异常
:param code: 返回码
:param code_explain: 详细定位问题用的错误字符串解释
... | true |
5bbf117b8df20e07160b5a5cdbc4bf598efacd4c | Iwan-Zotow/runEGS | /XcMath/point2d.py | UTF-8 | 902 | 3.53125 | 4 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
import numpy as np
class point2d(object):
"""
2D point of two floats
"""
def __init__(self, x = np.float32(0.0), y = np.float32(0.0)):
"""
Constructor. Build point from x and y
Parameters
----------
x: float
... | true |
cdc91790fbc650c1f29f6110f434a13c932e763d | priyapriyam/list_questions | /avg_even_odd_list.py | UTF-8 | 390 | 3.046875 | 3 | [] | no_license | elements=[23,14,56,12,19,9,15,31,42,43]
i=0
j=0
new=[]
new1=[]
sum=0
sum1=0
while i<len(elements):
if (elements[i])%2==0:
new.append(elements[i])
sum=sum+(elements[i])
else:
new1.append(elements[i])
sum1=sum1+(elements[i])
i=i+1
print len(new)
print len(new1)
print sum
pr... | true |
a2236315c88c187725717792ef4601fce69940ec | zeroam/TIL | /python/concurrency/concurrency_futures/utils.py | UTF-8 | 345 | 3.34375 | 3 | [
"MIT"
] | permissive | import time
from functools import wraps
def timeit(func):
@wraps(func)
def wrapper(*args, **kwargs):
start_time = time.time()
result = func(*args, **kwargs)
end_time = time.time()
print(f"{func.__name__} => {(end_time - start_time) * 1000} ms")
return resul... | true |
6a1be3df996e63509fa2ab172672cb156ff6a44d | haiiliin/pyabaqus | /src/abaqus/Material/Plastic/Creep/Creep.py | UTF-8 | 3,769 | 2.90625 | 3 | [
"MIT"
] | permissive | from abaqusConstants import *
from ..Metal.ORNL.Ornl import Ornl
from ..Potential import Potential
class Creep:
"""The Creep object defines a creep law.
Notes
-----
This object can be accessed by:
.. code-block:: python
import material
mdb.models[name].materials[name].creep
... | true |
16ad198481d77e9b29c2faa6c66b98dbfe387345 | nickcorona/exercism | /python/pythagorean-triplet/pythagorean_triplet.py | UTF-8 | 905 | 3.9375 | 4 | [] | no_license | def triplets_with_sum(sum_of_triplet):
triplets = triplets_in_range(1, sum_of_triplet)
triplets_equal_to_sum = []
for triplet in triplets:
if sum(triplet) == sum_of_triplet:
triplets_equal_to_sum.append(triplet)
return set(triplets_equal_to_sum)
def triplets_in_range(range_start, r... | true |
e06601a6c22576f16d78a15a0df2d21c43548f87 | mwakaba2/big_data | /hadoop_mapreduce/code/studentTimes/mapper.py | UTF-8 | 441 | 2.765625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
import csv
from datetime import datetime
import sys
reader = csv.reader(sys.stdin, delimiter='\t')
writer = csv.writer(sys.stdout, delimiter='\t', quotechar='"', quoting=csv.QUOTE_ALL)
next(reader)
for line in reader:
student_id, timestamp = line[3], line[8]
timestamp = timestamp.replace(... | true |
2b1d6edf8d7d5061fd066d17d1e2dd455ddf6dcc | nicholas-bower/Stealth | /Nick_systematics.py | UTF-8 | 786 | 2.53125 | 3 | [] | no_license | import numpy as np
from scipy.integrate import quad
params = []
p0_fits = []
p1_fits = []
p1err_fits = []
with open('fit_choice_params.dat','r') as f:
for ijt in f:
params = ijt.strip('\n').split(' ')
p0_fits.append(np.float32(params[0]))
p1_fits.append(np.float32(params[1]))
p1err_fits.append(np.floa... | true |
391a75ddceac91d80a92ef78f86ecfef46cc2c0e | Johannyjm/c-pro | /AtCoder/othercontests/yvc001/e.py | UTF-8 | 779 | 2.78125 | 3 | [] | no_license | def main():
n = int(input())
a = list(map(int, input().split()))
count = {}
for e in a:
if e in count : count[e] += 1
else: count[e] = 1
flg = True
if n % 2 == 0:
# odd num * 2 to n-1
for i in range(1, n, 2):
if i not in count or count[i] != 2:
... | true |
35a0f07b7a40fa8bbc993f61c2d14ab9b32a5169 | DaHuO/Supergraph | /codes/CodeJamCrawler/16_0_1/zehir/prog.py | UTF-8 | 188 | 3.359375 | 3 | [] | no_license | def f(s):
res = ""
for c in s:
res = max(res + c, c + res)
return res
t = int(input())
for i in range(1, t + 1):
s = input()
print("Case #{}: {}".format(i, f(s)))
| true |
b50b3e77e503d966c3bf61df570d37aa9cc90a4d | mmcgrath424/practice | /race.py | UTF-8 | 1,318 | 3.109375 | 3 | [] | no_license | import os
import random
class race():
def __init__(self,num_racers=4, num_gates=4):
self.num_racers = num_racers
self.num_gates = num_gates
self.gates = [{} for x in range(0,self.num_gates+1)]
for x in range(1,self.num_racers+1):
self.gates[0].update({'r'+str(x):0})
... | true |
f676889d88e3ba43a10945faf533af41d16f398a | aver1001/github-practice | /solve/섹션 3/8. 곳감/solve.py | UTF-8 | 2,237 | 3.359375 | 3 | [] | no_license | '''
현수는 곳감을 만들기 위해 감을 깍아 마당에 말리고 있습니다.
현수의 마당은 N*N 격자판으 로 이루어져 있으며,
현수는 각 격자단위로 말리는 감의 수를 정합니다.
그런데 해의 위치에 따라 특정위치의 감은 잘 마르지 않습니다.
그래서 현수는 격자의 행을 기준으로
왼쪽, 또는 오른쪽으로 회전시켜 위치를 변경해 모든 감이 잘 마르게 합니다.
만약 회전명령 정보가 2 0 3이면
2번째 행을 왼쪽으로 3만큼 회전시키는 명령 입니다.
M개의 회전명령을 실행하고 난 후 마당의 모래시계 모양의 영역에는
감 이 총 몇 개가 있는지 출력하는 프로그램을 작성하세요.
'''
i... | true |
d7ae55dde8f981e2889c4d048337eadcf04ba93c | jhonalexis-parra/learning-python | /python_basics/adivina_el_numero.py | UTF-8 | 486 | 4.1875 | 4 | [] | no_license | import random
def run():
numero_aleatorio = random.randint(1,100)
numero_elegido = 0
while (numero_aleatorio != numero_elegido):
numero_elegido = int(input("Elige un numero de 1 a 100: "))
if numero_elegido == numero_aleatorio:
break
elif numero_elegido > numero_aleato... | true |
045a0738428ef44d25c32d5302a67aa2d3a7e3ea | ksarmentrout/mm_scheduling_bot | /scheduling_bot/daily_notice.py | UTF-8 | 3,396 | 2.625 | 3 | [] | no_license | import os
import time
import traceback
import gcal_scheduler
import directories as dr
import variables as vrs
import email_sender
import utils
def main(team=None, send_today=False, specific_day=None, send_emails=True, create_calendar_events=False):
# Make Google API object
sheets_api = utils.google_sheets_lo... | true |
17037a5226aef55cf04421b4941b85b36d5f2f05 | ByeongjunCho/Algorithm-TIL | /Stack1/1210_Ladder1.py | UTF-8 | 3,116 | 3.375 | 3 | [] | no_license | # 1210. [S/W 문제해결 기본] 2일차 - Ladder1
import sys
sys.stdin = open('1210_input.txt', 'r')
# 두 개의 조건
# 왼쪽길 등장 : 왼쪽으로
# 오른쪽 등장 : 오른쪽으로
# 양쪽에 길이 없으면 : 위로
# for _ in range(1, 11):
# T = input()
# arr = []
# for _ in range(100):
# arr.append(list(map(int, input().split())))
# row = 99
# idx = ... | true |
477884f1d452233d65ea3d11cc3e23b0f209da29 | jgc92/algebra_lineal_numerica_2018A | /power.py | UTF-8 | 563 | 2.78125 | 3 | [] | no_license | import numpy as np
def power_iteration(A, num_simulations):
b_k = np.random.rand(A.shape[0])
for _ in range(num_simulations):
b_k1 = np.dot(A, b_k)
b_k1_norm = np.linalg.norm(b_k1,np.inf)
b_k = b_k1 / b_k1_norm
val = np.linalg.norm(np.dot(A,b_k), n... | true |
242462aa8a05220987b62b6f2fe368df403f6b62 | Adamantios/Style-Transfer | /core/loss_calculator.py | UTF-8 | 5,684 | 2.953125 | 3 | [] | no_license | from tensorflow import SparseTensor
import tensorflow.contrib.keras.api.keras.backend as K
class InvalidDimensionsError(Exception):
pass
class LossCalculator(object):
def __init__(self, combination_image: SparseTensor, img_nrows: float, img_ncols: float,
content_features_layer, style_featur... | true |
aee91c19f11a0992bfe7123fc13eefd938faf616 | christianns/Curso-Python | /06_Programacion_de_funciones/03_Envio_de_valores.py | UTF-8 | 336 | 4.03125 | 4 | [] | no_license | '''
Envío de valores
Para comunicarse con el exterior las funciones no sólo pueden
devolver valores, también pueden recibir información:
'''
# Ejemplo de envio y retorno de valores.
def suma(a, b):
r = a + b # tambien se puede definir de la siguiente manera return a + b
return r
resultado = suma(34, 8)
print... | true |
ea9221123339f41f0373d89d4d58563f48956efb | adykumar/DangerWager | /Swad/039-1023-LC-med-CamelcaseMatching.py | UTF-8 | 2,134 | 3.609375 | 4 | [] | no_license | """
1023. Camelcase Matching
Medium
A query word matches a given pattern if we can insert lowercase letters to the pattern word so that it equals the query.
(We may insert each character at any position, and may insert 0 characters.)
Given a list of queries, and a pattern, return an answer list of booleans, where answ... | true |
d072d644477017a25e1f9c5d5333c6b920159958 | Shristi19/GeeksforGeeks-Solved-Question | /alice and bob.py | UTF-8 | 430 | 3.328125 | 3 | [] | no_license | import itertools
a=1
b=3
c=1
list=list(itertools.product('abc',repeat=a+b+c))
for i in range(len(list)):
list[i]=''.join(list[i])
print(list)
flag=0
out=''
for i in list:
if i.count('a')==a and i.count('b')==b and i.count('c')==c:
if 'aaa'not in i and 'bbb' not in i and 'ccc' not in i:
pr... | true |
51e99435cddbd4534539f71eac2da8210bfc0807 | redhairedcelt/college_football_analysis | /scraper.py | UTF-8 | 3,068 | 3.265625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[25]:
import pandas as pd
import time
import json #for parsing the return from the Google API
import urllib #for passing info to the Google API
import requests
from bs4 import BeautifulSoup
# In[5]:
year = 2017
website = 'https://www.sports-reference.com/cfb/years/{}-sch... | true |
f421a9fe01c87addd69add8b2b03f56d4cec197a | BangLeCao/Object_Detection_SSD300 | /dataset.py | UTF-8 | 3,162 | 2.671875 | 3 | [] | no_license | from lib import *
from make_datapath import make_datapath_list
from extract_inform_annotation import Anno_xml
from transform import DataTransform
class MyDataset(data.Dataset):
def __init__(self, img_list, anno_list, phase, transform, anno_xml):
self.img_list = img_list
self.anno_list = anno_list
... | true |
973331f6c7bee64a8254083253c520f9820c1004 | JelleAalbers/plunc | /plunc/intervals/base.py | UTF-8 | 13,686 | 2.640625 | 3 | [
"MIT"
] | permissive | import numpy as np
import logging
from plunc.common import round_to_digits
from plunc.exceptions import SearchFailedException, InsufficientPrecisionError, OutsideDomainError
from plunc.WaryInterpolator import WaryInterpolator
class IntervalChoice(object):
"""Base interval choice method class
"""
method = ... | true |
987a1d4c735197a8a37b0f757cf4f510082f66ce | Akaito/ZeroToBoto | /assets/hangman-2.py | UTF-8 | 2,219 | 4.8125 | 5 | [
"Zlib"
] | permissive | # hangman-2.py
def get_letter_guess():
"""Prompts the user for input until they give us something valid.
Returns the user's valid letter guess.
"""
# just keep looping forever; only break or return will get us out
while True:
# even though the variable's called "letter", the user could
... | true |
430daf7a847cdbe6d6a47b1d1f7bedad5aa971ab | rsmzxp/tools | /about_mysql.py | UTF-8 | 4,432 | 2.6875 | 3 | [] | no_license | import pymysql
import csv
def read_data():
data=[]
k=0
csv_file=csv.reader(open('indexdata-v2.csv','r'))
for line in csv_file:
if '..' in line[4]:
b_e_37=line[4].split('..')
b_37=int(b_e_37[0])
e_37=int(b_e_37[1])
b_e_39 = line[5].split('..')
... | true |
8b80837db266764141466776166c9a63b92c9508 | inesucrvenom/mathfun | /test/factorial/test_lambda_factorial_recursive.py | UTF-8 | 763 | 2.875 | 3 | [
"MIT"
] | permissive | import unittest
from test.run_lambda import invoke_lambda
import test.factorial.basetests_factorial as BT
def call_function(val: int) -> int:
return invoke_lambda("lambda_factorial_recursive", {"n": val})
class Test_ValidInput(unittest.TestCase, BT.ValidInput):
def base_function(self, val):
return c... | true |