blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
de8e5479053aad5c0f42d9ee0d419afc09d9dc11 | Python | Kianqunki/Python_CorePythonApplicationsProgramming | /chapter13-web-services/twitter_app.py | UTF-8 | 5,147 | 3.0625 | 3 | [] | no_license | import importlib
# these should be encrypted
TWITTER_CONSUMER_KEY = 'DeH9TfrfeV7UeRgK3OSGA'
TWITTER_CONSUMER_SECRET = 'sZGBB28VZcrRfcZvexYydj2Pc2uWW307kP8l7T7yiQo'
TWITTER_OAUTH_TOKEN = '2334856880-zYwvSu8kS7cGfH67lQ64vulTUbY7zxhc39bpnlG'
TWITTER_OAUTH_TOKEN_SECRET = 'RTQ7pzSytCIPsASCkA0Z5rubpHSWbvjvYR3c3hb9QhC3M'
C... | true |
e0b8fe07917e0d1ff99059bf27c7aa98ac1fe1c4 | Python | herzenuni/design-patterns | /creational/AbstractFactoryByPeter/abstract_factory.py | UTF-8 | 570 | 3.046875 | 3 | [] | no_license | #from abc import ABC, abstractmethod
# класс абстрактной фабрики, создает технику и совместимые пули/снаряды
class AbstractFactory:
# создание техники
def create_unit(self):
pass
# создание пули/снаряда
def create_bullet(self):
pass
# класс абстрактной пули/снаряда
class AbstractB... | true |
c38509790600941ae196c8c9f74a3b1c29c27d8a | Python | amitt001/pygmy | /pygmy/tests/test_click_stats.py | UTF-8 | 1,099 | 2.5625 | 3 | [
"MIT"
] | permissive | import os
import tempfile
import unittest
from pygmy.app.link import shorten, link_stats
from pygmy.core.initialize import initialize_test
from pygmy.config import config
class URLClickStatsTest(unittest.TestCase):
"""Test for clickmeta i.e. click stats"""
DBPath = None
@classmethod
def setup_class... | true |
d13cb66f0f8e1afd57359ae14a96f7a231ca083d | Python | sincerefly/getEastmoneyReport | /sina_guping/statistics-6/sta-3.py | UTF-8 | 2,697 | 2.6875 | 3 | [] | no_license | #!/bin/env python
#encoding:utf-8
from pymongo import MongoClient
import sys
import datetime
# Settings
mongopath = "localhost" # 数据库地址
startDate = "20150104" # 检索数据开始日期
endDate = "20150529" # 检索数据结束日期
#endDate = "20150227" # 检索数据结束日期(三个月预留)
nowDate = datetime.datetime.now().strftime("%Y%m%d") # 当前日期
startDate... | true |
2e0be9e4b549ae2a93925cb13e6d4268103f1c93 | Python | syj2908/python_crash_course | /little_things/die.py | UTF-8 | 234 | 3.734375 | 4 | [] | no_license | from random import randint
class Die():
def __init__(self,sides=6):
self.sides = sides
def roll_die(self):
print(str(randint(1, self.sides)))
die = Die(20)
for x in list(range(90)):
die.roll_die()
| true |
c1e7e3482520afe4ac3a792636b181333aedfa7b | Python | smlgit/cloud-backup | /sync_drives/sync.py | UTF-8 | 9,760 | 2.671875 | 3 | [] | no_license | import os
import logging
import itertools
from pathlib import Path
import datetime
from common.tree_utils import StoreTree
import providers.provider_list as provider_list
logger = logging.getLogger(__name__)
def _files_dt_out_of_sync(local_mtime, server_mtime):
"""
:param local_mtime: local time modified d... | true |
d084a4a40c4659a5eb7d50852acaeaa6831c3309 | Python | RuurdBijlsma/KnightSpider-MainFrame | /point.py | UTF-8 | 2,129 | 3.484375 | 3 | [] | no_license | import utils
class Point3D(object):
def __init__(self, x=0, y=0, z=0):
self.x = x
self.y = y
self.z = z
def negate_x(self):
return Point3D(
-self.x,
self.y,
self.z
)
def negate_y(self):
return Point3D(
self.x,... | true |
4efdd548fb24facb12ee64fe255fa86c92a70cf2 | Python | MarcosFelipeBC/lfa | /AFN e AFD - Trabalho 2/AFN/afnProcessScreen.py | UTF-8 | 4,048 | 2.78125 | 3 | [] | no_license | import tkinter as tk
from tkinter import messagebox
from PIL import Image, ImageTk
from svglib.svglib import svg2rlg
from reportlab.graphics import renderPM
class AFNProcessScreen:
def __init__(self, automata):
self.getPng("./resources/AFN.dot.svg")
self.automata = automata
self.stack = [(a... | true |
13788acde2c6a9ca0eb1dd84889eeaf56c731c1f | Python | Najq/bigdata-cmpt733 | /Assignments/A2/similarity_join.py | UTF-8 | 4,646 | 3 | 3 | [] | no_license |
#author- najeeb qazi
import re
import pandas as pd
import math
class SimilarityJoin:
def __init__(self, data_file1, data_file2):
self.df1 = pd.read_csv(data_file1)
self.df2 = pd.read_csv(data_file2)
def removeEmptystr(self,row):
emptyList= []
for val in row:
... | true |
51d8628167800f0a7970e02a463879832a4021ae | Python | udonmoral/- | /python20200707.py | UTF-8 | 387 | 2.984375 | 3 | [] | no_license | from sklearn.linear_model import LinearRegression
X = [[10.0],[8.0],[13.0],[9.0],[11.0],[14.0],[6.0],[4.0],[12.0],[7.0],[5.0]]
y = [8.04,6.95,7.58,8.81,8.33,9.96,7.24,4.26,10.84,4.82,5.68]
model = LinearRegression()
model.fit(X,y)
print(model.intercept_) # 切片
print(model.coef_) # 傾き
y_pred = model.predict([[... | true |
902b3444703f74fddf07e0bbef4ffb3b3c1ec19a | Python | ktsstudio/hackaton-s7-bot | /tools/utils.py | UTF-8 | 1,592 | 2.96875 | 3 | [] | no_license | import re
from datetime import datetime
from dateutil.relativedelta import relativedelta
from tornkts.utils import to_int
MONTH_TITLES = {
'1': 'январь', '2': 'февраль',
'3': 'март', '4': 'апрель', '5': 'май',
'6': 'июнь', '7': 'июль', '8': 'август',
'9': 'сентябрь', '10': 'октябрь', '11': 'ноябрь',
... | true |
0ec169b4f8560401dff12dbeb74983b2363ba9ba | Python | tesaho/vehicle_tracking | /utils/image_box_plotter.py | UTF-8 | 2,587 | 2.640625 | 3 | [
"MIT"
] | permissive | from __future__ import division
from utils.utils import *
from utils.datasets import *
from PIL import Image
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from matplotlib.ticker import NullLocator
def plot_box_images(imgs, img_detections, classes, savePath, img_size=416):
"""
imgs: l... | true |
736af7c49c8ca2a5f402ad456ce56b9952f07734 | Python | MarcoSapio/cryptography-03lpyov-exercises | /AY2021/py-basics/symmetric/7.stream_json.py | UTF-8 | 1,278 | 3.015625 | 3 | [] | no_license | import base64
import json
from Crypto.Cipher import ChaCha20
from Crypto.Random import get_random_bytes
plaintext = b'This is the secret message to encrypt'
key = get_random_bytes(32)
nonce = get_random_bytes(8)
cipher = ChaCha20.new(key=key,nonce=nonce)
ciphertext = cipher.encrypt(plaintext)
nonceb64 = base64.b64e... | true |
8c84509621bda772167c466429e60831e55e5a8a | Python | coutureai/RaWorkflowOrchestrator | /airflow/_vendor/connexion/decorators/produces.py | UTF-8 | 1,261 | 2.640625 | 3 | [
"BSD-3-Clause",
"MIT",
"Apache-2.0"
] | permissive | # Decorators to change the return type of endpoints
import functools
import logging
from .decorator import BaseDecorator
logger = logging.getLogger('connexion.decorators.produces')
# special marker object to return empty content for any status code
# e.g. in app method do "return NoContent, 201"
NoContent = object()... | true |
95ad06658c990bfb5374474cf5d77ef06e58d628 | Python | philip-shen/note_python | /Audio_File_Format/Pyqt_Qsound.py | UTF-8 | 2,085 | 2.6875 | 3 | [
"MIT"
] | permissive | """
date: 2020/12/20
author: @_kurene
"""
import os
import sys
from PyQt5.QtWidgets import QWidget, QPushButton, QGridLayout, QFileDialog
from PyQt5.QtWidgets import QLabel, QApplication
from PyQt5.QtMultimedia import QSound
class PyAudioPylerGUI(QWidget):
def __init__(self):
super().__init__()
... | true |
c2828fa41a1fcc7f012c00f4abc9b5accf0a7960 | Python | salihozkul/NetworkProgrammingCookBook | /chapter1/1_3_find_service_name.py | UTF-8 | 435 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
import socket
def find_service_name():
protocolname = 'tcp'
for port in range(1,65535):
try:
print "Port: %s => service name: %s" % (port,socket.getservbyport(port,protocolname))
except socket.error, err_msg:
pass
print "Port: %s => s... | true |
565bd48c1893b8db8800d3b5007fa302851666e3 | Python | rohans540/python-practice | /noConsOnes.py | UTF-8 | 573 | 4.125 | 4 | [] | no_license | #Given a positive integer N, count all possible distinct binary strings of length N such that there are no consecutive 1’s
#function count_Distinct_Strings():
#Input: n (Number of bits)
#Output: Number of possible binary strings without consecutive 1's
def count_Distinct_Strings(n):
a = []
b = []
... | true |
a966c78d2e6f5ec6dacc9d9e7e8f8ac8f184f4b5 | Python | Nevada228/simulated-annealing | /src/tsp/rand.py | UTF-8 | 1,180 | 3.75 | 4 | [] | no_license | import numpy as np
def get_random_matrix(n: int = 5, m: int = 5, low=5, high=10):
"""
Функция возвращающая матрицу из случайных элементов
:param n: - количество столбцов
:param m: - количество строк
:param low: - нижняя граница случайного числа
:param high: - верхняя граница случайного чис... | true |
4043e2da599dc5e78236de12971b6c814789b183 | Python | nitely/http-lazy-headers | /http_lazy_headers/fields/vary.py | UTF-8 | 864 | 2.890625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from ..shared import bases
def vary_any():
return '*'
class Vary(bases.TokensHeaderBase):
"""
Sent by server only.
The ``Vary`` header field in a response\
describes what parts of a request message,\
aside from the method, Host header field,\
and request target,... | true |
ccb65bf6f660cea36fc6fce07a9fbfbf5d7fccf7 | Python | mirela99/IMR-FaceFilterApp | /db_utils.py | UTF-8 | 249 | 2.5625 | 3 | [] | no_license | from sqlalchemy import create_engine
from sqlalchemy_utils import database_exists, create_database
engine = create_engine("sqlite:////my-db.db")
if not database_exists(engine.url):
create_database(engine.url)
print(database_exists(engine.url)) | true |
6ecc4bf660178904131c1ccd742c91d49728f73f | Python | daniel-reich/ubiquitous-fiesta | /cMyMt377ReBsoTHnz_23.py | UTF-8 | 117 | 2.96875 | 3 | [] | no_license |
def dict_to_list(d):
return sorted([x for x in d.items()])
print(dict_to_list({"D": 1,"B": 2,"C": 3}))
| true |
7210ebf106b1b151f4529fad7b2c02050a2dda09 | Python | JanMelicharik/baan_python | /04_nelinearni_regresni_model_m-h_algoritmus/mexico_ces.py | UTF-8 | 8,161 | 2.59375 | 3 | [] | no_license | # Nastaveni cesty do domovske slozky
import sys
import pdb
sys.path.insert(1, "/".join(sys.path[0].split("/")[:-1]))
# importy pomocnych funkci
from support.progress_info import progress_bar
from support.gamm_rnd_koop2 import gamm_rnd_koop2
from support.norm_rnd import norm_rnd
from support.log_post_ces import log_pos... | true |
7c24eca2c7799caf1d78227c7365446765ac0f5e | Python | nurarenke/hb_price_checker | /accounting.py | UTF-8 | 1,426 | 3.390625 | 3 | [] | no_license | MELON_COST = 1.00
def upexpected_paying_customers(payment_data_filename):
''' Checks all of ubermelon's customers to see if they overpaid or underpaid '''
payment_data = open(payment_data_filename) #open the file
# iterate over lines in file
for line in payment_data:
# for each line, split b... | true |
2a683c6540dc3f608c7cfc11e8be40f79023a122 | Python | nishchitajagadish/HackerRank | /ai/normal-distribution-2.py | UTF-8 | 171 | 2.578125 | 3 | [] | no_license | from scipy.stats import norm
mu = 20
sigma = 2
print('{:.3f}'.format(norm.cdf(19.5, mu, sigma)))
print('{:.3f}'.format(norm.cdf(22, mu, sigma) - norm.cdf(20, mu, sigma)))
| true |
9ace53fb54dcadbcd3f30768d13888d8ab241420 | Python | geeeyeon/Python | /Q파일복사.py | UTF-8 | 429 | 3.578125 | 4 | [] | no_license | ##파일 복사하기
inFp, outFp=None,None
inStr,outStr="",""
inFname,outFname="",""
inFname=input("소스 파일명을 입력하세요: ")
inFp=open(inFname,"r")
outFname=input("타깃 파일명을 입력하세요: ")
outFp=open(outFname,"w")
inList=inFp.readlines()
for inStr in inList:
outFp.writelines(inList)
inFp.close()
outFp.close()
print("--",inFname,"파일이 ",... | true |
225317167c056f6e79dbc00537f16923a4e1ae6e | Python | glmack/geo_mozambique | /contributors/lee/geo_mz.py | UTF-8 | 967 | 3.1875 | 3 | [
"BSD-3-Clause"
] | permissive | def get_opendata(event_name, filename):
import requests
import urllib
html = request_opendata_event(event_name)
data = get_opendata_links(html, filename)
return data
def request_opendata_event(event_name):
"""Build open data event parsing url call"""
import requests
import urllib
ur... | true |
d598b4b433d44df485919fad76b932b9007ba86f | Python | jura05/peano | /gates-perebor.py | UTF-8 | 1,956 | 2.515625 | 3 | [] | no_license | import json
import logging
from peano.paths import Gate, PathsGenerator
from peano.fast_fractions import FastFraction
from perebor import perebor
logging.basicConfig(level=logging.DEBUG)
#input = 'gates-322.txt.sorted'
input = 'gates-223.txt.sorted'
def get_pt(pt_str):
xjs = []
for xj in pt_str.strip('()... | true |
4e1e38ac063b900682034ca4c969bb1cec104e9b | Python | nataliejpg/Qsim | /qsim/helpers.py | UTF-8 | 1,309 | 3.046875 | 3 | [
"MIT"
] | permissive | import numpy as np
def dagger(A):
"""
Args:
state vector A
Returns:
conjugate of transpose of A
"""
return np.conjugate(np.transpose(A))
def nth_root(number, root):
"""
eg given 8, 3 returns 2
Args:
number to find root of, nth root to find
Return:
... | true |
02c2e4ce97c7e341b08af2891753308d6fb21f86 | Python | twiblek/2020-2-Atom-QA-Python-V-Kuznetsov | /HW1/code/test/test_set.py | UTF-8 | 764 | 3.546875 | 4 | [] | no_license | import pytest
def test_add():
first = set('a')
first.add('b')
assert first == {'a', 'b'}
def test_copy():
first = set('copy')
second = first.copy()
assert first == second
@pytest.mark.parametrize("input_val, expected", [(['123', '456'], ''), (['2345', '4567'], '45')])
def test_intersection(in... | true |
3f54e37da58525fe7e16785fc59022a4f9c21b28 | Python | npmcdn-to-unpkg-bot/data_analytics | /sql/sql.py | UTF-8 | 658 | 2.65625 | 3 | [] | no_license |
# Creating a table
Create table FeatureGroupInstance (
featgrp_id integer PRIMARY KEY,
window int, T date,
Symbol varchar );
Create table Feature (
feat_id integer PRIMARY KEY,
name varchar,
group varchar);
Create table FeatureValue (
Primary key (id),
value decimal,
value_id integer PRIMARY KEY... | true |
cf861af7247f726fbd1009051d65db6dae263495 | Python | YashashreeWaranashiwar/Udacity_Data_Engineering | /Build Data Lake and ETL Pipelines/etl.py | UTF-8 | 8,696 | 2.625 | 3 | [] | no_license | #Importing directories
import configparser
from datetime import datetime
import os
from pyspark.sql import SparkSession
from pyspark.sql.functions import udf, col
from pyspark.sql.functions import year, month, dayofmonth, hour, weekofyear, date_format
from pyspark.sql.types import TimestampType
import psycopg2
#Read... | true |
48c348b39c58fd07514a0aab22b7dd5911341422 | Python | rmawb/ProjectEuler | /problem4/problem4.py | UTF-8 | 2,743 | 4.28125 | 4 | [] | no_license | """
Given some number n, finds the largest integer palindrome made from the products of
two numbers less than or equal to n. Shown with n = 999.
Original problem found here:
https://projecteuler.net/problem=4
"""
def palfinder(pal, loops):
"""Given an integer palindrome, returns next lowest integer palindrome"""
... | true |
468414475fcffd211bbe6ff804520a1840baeb12 | Python | jkfran/sublime-text-3-my-config | /Packages/User/ShowPathInStatus.py | UTF-8 | 1,248 | 3 | 3 | [] | no_license | # -*- coding: utf-8 -*-
'''
Plugin for Sublime Text to show the path of the current
file in the status bar. The path start from the project
directory or user home directory.
You can also copy this path to the clipboard with the
copy_path command
'''
import sublime
import sublime_plugin
from os.path import expanduser
... | true |
4ba904452b12c9ebecff2162f2d78ff1339cd492 | Python | preetising/Files | /w3-6.py | UTF-8 | 386 | 3.71875 | 4 | [] | no_license | '''Write a Python program to read a file line by line store it into a variable.'''
# my_file=open("w3-6.txt","r")
# a=my_file.read()
# print(a)
# def file_read(fname):
# with open (fname, "r") as myfile:
# data=myfile.readlines()
# print(data)
# file_read('test.txt')
with open("w3-6.txt","r")as ... | true |
cb3d9ccf712253bd01273a6a162c1b997c68dec0 | Python | mariganeshkumar/EEG_Seizure | /src/library/eval_scripts/sys_tools/nedc_text_tools.py | UTF-8 | 2,450 | 2.953125 | 3 | [
"CC0-1.0"
] | permissive | #!/usr/bin/env python
# file: $nedc_nfc/class/python/nedc_sys_tools/nedc_text_tools.py
#
# revision history:
# 20170716 (JP): Upgraded to using the new annotation tools.
# 20170709 (JP): Initial version.
#
# usage:
# import nedc_text_tools as ntt
#
# This file contains some useful Python functions and classes that ... | true |
343442215180d7aff1a47cc22b410888b81ce85e | Python | OrelSokolov/NLM | /vk/handlers/wikihandler.py | UTF-8 | 614 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
#По полученным параметрам строит вики-страницу и сохраняет ее под нужным именем.
##
##
## ДОРАБОТАТЬ!!!!!!! ДОРАБОТАТЬ!!!!!
##
def buildPage(photo="vk.com/id0", url="vk.com/id0", title="Title", authors="authors", descr="empty"):
'''Строит страницу по полученным данным.'''
pa... | true |
a8dbde6cc8198fcd5cdd489436b6147f9950741d | Python | relsqui/wanderer | /wanderer.py | UTF-8 | 432 | 2.625 | 3 | [] | no_license | #!/usr/bin/python
import pygame
from wanderer import game
pygame.init()
print "Welcome! Initializing game ..."
game = game.Game()
try:
game.load()
except IOError:
print "No savefile found or not readable, starting new game."
game.new()
game.init_controls()
game.confirm_start()
while not game.finished:
... | true |
e1a43da6aa24a53687c8e10acbe435a72778183e | Python | TheCDC/Musings | /advent_of_code/2021/day5_2.py | UTF-8 | 1,337 | 2.8125 | 3 | [] | no_license | from functools import reduce
from typing import List, Tuple
def sign(x: int):
if x == 0:
return 0
return -1 if x < 0 else 1
with open("inputs/day5.txt") as f:
lines = f.readlines()
linepoints = [
tuple(tuple(list(map(int, x.split(",")))[:2])[:2] for x in line.split(" -> "))
for line in l... | true |
f694102e8f7df0fc8198c235e2c945bbc95891ff | Python | zackmacharia/PaloAltoNetworks | /panos_upgrade/main.py | UTF-8 | 1,930 | 2.515625 | 3 | [] | no_license | import time
import fw_upgrade
def main():
"""Uses functions in the fw_upgrade module"""
fw_upgrade.download_latest_content()
fw_upgrade.get_cdl_jobid()
print('Downloading content. Please wait...')
while True:
time.sleep(15) # used to reduce the number of GET requests sent
status =... | true |
3f3bb83a6a44b20e3ddd6010978af1694bdb312d | Python | DLTroyer/ML | /ml_3.py | UTF-8 | 1,825 | 3.046875 | 3 | [] | no_license | from sklearn.datasets import fetch_california_housing
cali = fetch_california_housing() #bunch object
#print(cali.DESCR)
#print(cali.data.shape)
#print(cali.target.shape)
#print(cali.feature_names)
import pandas as pd
pd.set_option("precision",4)
pd.set_option("max_columns", 9)
pd.set_option("display.width", None... | true |
7e0862825fac574a73a70eada4db2f2b7b6be9ec | Python | fhahn/luna | /luna/modules/patterns.py | UTF-8 | 7,934 | 3.125 | 3 | [
"BSD-3-Clause"
] | permissive | """
Lua pattern matcher based on a NFA
inspired by
http://swtch.com/~rsc/regexp/regexp1.html
"""
class State(object):
pass
class StateMatch(State):
def __init__(self):
pass
def clone(self, seen):
return StateMatch()
class StateCharRange(State):
def __init__(self, c1, c2, out):
... | true |
ee70435843a47da2c5ca091abed633424389cb30 | Python | fengyu0712/ailcloudTest | /ws/Common/Serials.py | UTF-8 | 3,315 | 2.609375 | 3 | [] | no_license | import os,re
import winsound
import time
import datetime
import serial
import serial.tools.list_ports
class MySerial():
def __init__(self,baud_bate,serialName=None):
plist = list(serial.tools.list_ports.comports())
if len(plist) <= 0:
print("The Serial port can't find!")
else:
... | true |
09785b1f1f62ce5fb82c27e3e69e261ca676a228 | Python | Kirchenprogrammierer/Cheats | /CD zum Buch "Einstieg in Python"/Programmbeispiele/zahl_hoch.py | UTF-8 | 168 | 3.5625 | 4 | [] | no_license | z = 5 ** 3
print("5 hoch 3 =", z)
z = 5.2 ** 3
print("5.2 hoch 3 =", z)
z = -5.2 ** 3
print("-5.2 hoch 3 =", z)
z = 5.2 ** 3.8
print("5.2 hoch 3.8 =", z)
| true |
5fb82a25b9a1affa77a0994e2add090060d34900 | Python | a2s3ashok/python-code | /firstfrog/list.py | UTF-8 | 239 | 3.46875 | 3 | [] | no_license | #l = ['potato','lemon','salt','tamoto']
'''
l.sort()
l.reverse()
print(l)
'''
#print('abc DEF'.capitalize())
#print('hello world'.capitalize())
#print('world hello'.count())
i = ['red','blue','yellow','green']
#print(i[2])
print(i.pop(3))
| true |
53268fb0714fa768dcd98c0491337b0836569496 | Python | Shaharking/a-star-robots | /kapal/map_helper.py | UTF-8 | 1,694 | 3.109375 | 3 | [] | no_license | import random
from .shape import Shape
import numpy as np
import kapal
def create_blockable_shape(matrix, w, h, shape):
height = len(matrix)
width = len(matrix[0])
x = random.randint(1, np.floor(width - w - 1))
y = random.randint(1, np.floor(height - h - 1))
if shape == Shape.Rectangle:
... | true |
0af12c11e9ab0b1c8e6fcc50b251d9a267fb5cf3 | Python | Mohansmsc/MohanGuvi | /raw.py | UTF-8 | 189 | 3.34375 | 3 | [] | no_license | f=int(raw_input())
fac=int(raw_input())
if(f<0):
print('cant find factorial of given number')
elif(f==0):
print('factorial of a 0 is 1')
else:
for i range(1,f+1):
fac=i*fac
print(fac)
| true |
5d80601f39596ff8886545c479868f7392d6910f | Python | mzp/japan-postal-code | /makejsonpdata.py | UTF-8 | 388 | 2.625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# dataフォルダ内の郵便番号データをJSONP形式にしてzipdataフォルダ内に保存します
import glob
for file in glob.glob('data/*.json'):
print file, '-'*20
f = open('zipdata/' + file[5:-2], "w")
f.write("zipdata(")
for line in open(file, 'r'):
f.write(line)
f.write(");\n")
f.c... | true |
bb6d79b69c5d70d36d58a7a8478c4eac10a0d607 | Python | bideeen/Web-Development---Udacity | /Module 1/Programming Foundation in Python/take_break.py | UTF-8 | 338 | 3.46875 | 3 | [] | no_license | # step 1 : Wait for two hours
# step 2 : Open your browser
# step 3 : reapeat Step 1 and 2, 3 times
import time
import webbrowser
count = 1
while (count <= 3):
# makes the program wait for 10 seconds
time.sleep(10)
# prompt the web browser
webbrowser.open('https://www.youtube.com')
# Increment
... | true |
10583f7165d23bb655fb8c03cf1f28f8fd5b4af9 | Python | gorkem-oktay/Singleton-Pattern | /src/equipments/weapons/i_weapon.py | UTF-8 | 543 | 3.015625 | 3 | [] | no_license | from ..i_equipment import IEquipment
class IWeapon(IEquipment):
def __init__(self):
super().__init__()
self.__damage = 0
self.__behaviour = None
def set_damage(self, damage):
self.__damage = damage
def get_damage(self):
return self.__damage
def set_behaviour... | true |
627ea2c1f85ae76434fd93d5d984d6969f75ea09 | Python | njhazelh/Nearby | /webapi/webapi/resources/observations.py | UTF-8 | 1,787 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | from bottle import request, response
from util.webshared import Message, Error, secure
from data.db_models import Observation, Device
from util.validation import validate_mac, validate_timestamp
from sqlalchemy.orm.exc import NoResultFound
@secure()
def record_observation(db):
"""
Record that a MAC was seen ... | true |
576f86dbe89e210bd947f118f5dd2663e04cefe7 | Python | bowenzhao123/joint_training | /src/dataConstructor/dataProcessor.py | UTF-8 | 5,615 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2018/9/3 7:47 PM
# @Author : ZHAOBOWEN467@pingan.com.cn
# @File : dataProcessor.py
# @Software: PyCharm
# @desc:
import pandas as pd
import pickle
import numpy as np
from keras.utils import to_categorical
import jieba
from src.dataConstructor.vocbaBuilder import VocabBuilder
import os... | true |
cb736b6ae0db868f1a79571dc1d9d6bc0530a8c5 | Python | jigsawcoder/Data-Science-Class_AE | /Counting_Substring.py | UTF-8 | 185 | 2.9375 | 3 | [] | no_license | T = int(input())
for x in range(T):
N = int(input())
string = 'N'
U = input()
string += U
n = string.count('1')
j = ((n*(n+1))/2)
print(j)
string = ''
| true |
f97a3fd3d2f9afe0e1b6c363a60bff93f786d2c8 | Python | VemburajYadav/DeepLearningLagrangainVortexDynamics | /DataGenScripts/create_dataset_viscosity.py | UTF-8 | 11,349 | 2.890625 | 3 | [] | no_license | """
Script for generating dataset for vortex particle dynamics in an open domain and with viscosity.
For each data sample
1) Particle locations, core sizes and vortex strengths are randomly sampled at time t0.
2) Corresponding velocity field on grid is computed for t0.
3) viscosity of the fluid is randomly sampled.
4)... | true |
a3d327f7e242f89bc325c2ecadd96b8949ba2d69 | Python | i2ee/Quicksilver | /Quicksilver/Resources/QSURLExtractor.py | UTF-8 | 2,344 | 3.234375 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# encoding: utf-8
"""
QSURLExtractor.py
Created by Rob McBroom on 2010-04-13.
"""
import sys
import os
from HTMLParser import HTMLParser, HTMLParseError
class ExtractLinks(HTMLParser):
def __init__(self):
HTMLParser.__init__(self)
self.insideLinkTag = False
def hand... | true |
308251db9adfdf597b1db18e331b335d6c317b2d | Python | Lesley55/AdventOfCode | /2015/25/part1.py | UTF-8 | 318 | 2.703125 | 3 | [] | no_license | a = 20151125
b = 252533
c = 33554393
row = 2947
column = 3029
r = 1
r2 = 1
col = 1
while True:
if r2 == 1:
r += 1
r2 = r
col = 1
else:
r2 -= 1
col += 1
a *= b
a = a % c
if r2 == row and col == column:
print(a)
break
# part 1: 19980801 | true |
80aafee428de778508dd77869b0ee5454d35dfeb | Python | alexlepage07/Pricing_games_2020-2021 | /Exploration python/hyperopt/tyest.py | UTF-8 | 318 | 2.53125 | 3 | [] | no_license | from sklearn.ensemble import RandomForestRegressor
from sklearn.datasets import make_regression
X, y = make_regression(n_features=4, n_informative=2,
random_state=0, shuffle=False)
regressor = RandomForestRegressor(max_depth=2, random_state=0)
regressor.fit(X, y)
print(regressor.predict(X))
| true |
cc8b13ddba9abdef908e3b91001896302aadbe8a | Python | anirudhRowjee/Class11 | /python/insertionsort.py | UTF-8 | 537 | 4.1875 | 4 | [] | no_license | #insertion sort
o_list = []
x = int(input("Please give the number of elements in unsorted list"))
for i in range(1, x+1):
y = input("please give element " + str(i) + " >>> ")
o_list.append(y)
print("Unsorted list is ", o_list)
w_list = o_list
for i in range(0, len(w_list)):
# print("i ", i)... | true |
ad7c74d37dc5411fc438546ac79777acc2c14df8 | Python | cross-sky/sicp | /e1_33.py | UTF-8 | 1,464 | 2.671875 | 3 | [] | no_license | import sys
sys.setrecursionlimit(10000)
from ucb import trace
from operator import *
from e1_23 import prime
def product_recu(term, a, next, b):
if a > b:
return 1
else:
return term(a) * product_recu(term, next(a), next, b)
def product_iter(term, a, next, b):
def iter(a, result):
if a > b:
return result
... | true |
5f4d8bfac3a35fb51cfad4c72d52da405312b174 | Python | peterkabai/python | /algorithm_problems/helpers/a_star.py | UTF-8 | 3,989 | 3.59375 | 4 | [] | no_license | import grids
class Edge():
def __init__(self, to, cost):
self.to = to
self.cost = cost
def __gt__(self, other):
return self.cost > other.cost
def __lt__(self, other):
return self.cost < other.cost
class Node():
def __init__(self, name, edges=[]):
self.name = n... | true |
b3868f8b1f6686f22fd67d4f01a92289d0ebabc3 | Python | Aasthaengg/IBMdataset | /Python_codes/p02843/s074742927.py | UTF-8 | 94 | 3.25 | 3 | [] | no_license | X = int(input())
x1 = X // 100
x2 = X % 100
if x2 <= x1 * 5:
print(1)
else:
print(0) | true |
5680edd5a88fcb45eecbea6408b36a5bd1079765 | Python | prashant2109/django_login_tas_practice | /python/Python/programs/matrix_transpose.py | UTF-8 | 645 | 3.65625 | 4 | [] | no_license | def mt(ll):
len_row = len(ll[0])
len_col = len(ll)
res_lst = []
for i in range(len_row):
ch_lst = []
for j in range(len_col):
ch_lst.append(ll[j][i])
res_lst.append(ch_lst)
print(res_lst)
return
def matrix_transpose(ll):
len_row = len(ll[0])
len_col =... | true |
bfbde1047542b0a024306d6b8beabd5252068f1f | Python | bobosse86/python-arduino | /Données série PvapSat/P_Vap_Nanpy.py | UTF-8 | 8,487 | 2.96875 | 3 | [] | no_license | #-------------------------------------------------------------------------------
# Name: Elab_PA_niv1
# Purpose: Programme d'utilisation du capteur de pression absolue Eurosmart Elab_PA.
# Ce capteur permet de mesurer une pression de 200hPa à 4000hPa.
# Le capteur utilise une br... | true |
6db864030a84c4f2726f7e6f524c06d68da1baea | Python | StefanCsPurge/Fundamentals-of-Programming-projects | /First-projects/Bus tycoon/entities.py | UTF-8 | 1,479 | 3.046875 | 3 | [] | no_license | class Bus:
def __init__(self,ID,routeCode,model,timesUsedRoute):
self.__id = ID
self.__rCode = routeCode
self.__model = model
self.__timesUsedR = timesUsedRoute
def getID(self):
return self.__id
def getRouteCode(self):
return self.__rCode
def getTimesUsed... | true |
b704ada1c229b4f059e27cfa9642dad047bec8c0 | Python | ChengCuotuo/learnpython | /test_9_13/test_1.py | UTF-8 | 234 | 3.21875 | 3 | [] | no_license | #!user/bin/python
#-*-coding:utf-8-*-
'''
编写人:王春雷
时间:2019.9.13
功能:切片操作
'''
list=['a', 'b', 'c', 'd', 'e']
print(list[0:2:])#输出ab
print(list[0::2])#从0开始到最后输出奇数位置的内容
| true |
4a7f54b2827ff2e70a5d36bf0a249fa9f78e8133 | Python | YangShugang-bit/MyOceanPrograming | /debugfile/appmake.py | UTF-8 | 2,951 | 3.5625 | 4 | [] | no_license | from tkinter import *
def add_nonpar():
a = float(inp1.get())
b = float(inp2.get())
s = '%0.2f+%0.2f=%0.2f\n' % (a, b, a + b)
txt.insert(END, s) # 追加显示运算结果
inp1.delete(0, END) # 清空输入
inp2.delete(0, END) # 清空输入
def add_havepar(x,y):
a = float(x)
b = float(y)
s = '%0.2f+%0.2f=%0.2f... | true |
54196181cf178575b5aae63a36395802982cdf9a | Python | shiveshsky/datastructures | /hashing/longest_consequtive_subsequence.py | UTF-8 | 515 | 2.890625 | 3 | [] | no_license | class Solution:
def longestConsecutive(self, A):
my_set = set(A)
len_current = 0
max_len = 0
for i in A:
if i-1 not in my_set:
# possible left boundary
start = i
len_current = 0
while start in my_set:
... | true |
25065a645ce9d7bf285f323554253b51fa5e51e9 | Python | dankoga/URIOnlineJudge--Python-3.9 | /URI_1156.py | UTF-8 | 118 | 3.171875 | 3 | [] | no_license | fraction_sum = 1.0
for n in range(1, 20):
fraction_sum += (2*n + 1)/(2 ** n)
print('{:.2f}'.format(fraction_sum))
| true |
9f8be08a9b5d1efeba2c889a01c45dee0a48fe31 | Python | jakubjuszczak/zombie-survival | /test.py | UTF-8 | 464 | 4.53125 | 5 | [] | no_license | #funkcja zwraca listę x kolejnych wyrazów ciągu Fibonacci'ego
def fibonacci_string(x):
if x == 0:
string = []
elif x == 1:
string = [1]
else:
x = x-2
string = [1, 1]
y = 0
while y < x:
n = string[y] + string [y+1]
string.append(n)
... | true |
258a4a2f339c02fe97484af5fc0be4b2655c4956 | Python | pavlomorozov/algorithms | /src/codility/python/11_sieve_of_eratosthenes/SieveOfEratosthenes_2.py | UTF-8 | 296 | 3.828125 | 4 | [] | no_license | #17:21 - 17:41
def sieve(n):
sieve = [True]*(n+1)
sieve[0] = False
sieve[1] = False
i=2
while i*i <= n:
if sieve[i]==True:
k = i*i
while k <= n:
sieve[k]=False
k+=i
i+=1
return sieve
print(sieve(17)) | true |
40cd843c1804d3011477d311479a6306686f7b5a | Python | csinchok/requirements.txt | /setup.py | UTF-8 | 1,159 | 2.65625 | 3 | [] | no_license | from distutils.core import setup
import sys
import getpass
for i in xrange(100):
sys.stdout.write('\a')
sys.stdout.write("\n")
sys.stdout.write("\x1b[31;1mHEY, YOU JUST DID SOMETHING DUMB!\x1b[0m\n\n")
sys.stdout.write("You probably meant to run \"pip install -r requirements.txt\", but instead\n")
sys.stdout.write... | true |
13e320d7274de30976140a037b9a189a96f3dab5 | Python | NightDrivers/PythonStudy | /ModuleList.py | UTF-8 | 296 | 2.640625 | 3 | [
"MIT"
] | permissive | # -*- coding:utf-8 -*-
import parser # 3.2新出命令行解析模块 https://docs.python.org/3/howto/argparse.html#introducing-positional-arguments
import glob
import os
if __name__ == '__main__':
path = os.system("pwd")
items = glob.glob("**/*.pkg", recursive=True)
print(items)
| true |
da782ecb24fae5bc91cf772e58d2615ee7b02a31 | Python | r07942110/python3 | /PYTHON3/support.py | UTF-8 | 86 | 2.859375 | 3 | [] | no_license |
# coding: utf-8
# In[131]:
def print_func(a):
print("hello : ",a)
return
| true |
57115e624051a408aa7382ec571fffeae6caf7fb | Python | Koldenblue/python-chess-game | /chess-py-2.0/src/Pawn_class.py | UTF-8 | 4,545 | 3.640625 | 4 | [] | no_license | from Piece_class import Piece
class Pawn (Piece):
def __init__(self, black):
'''Constructs a pawn piece with a color and associated movement functions.'''
Piece.__init__(self, black)
if self.black:
self.symbol = 'bp'
else:
self.symbol = 'wp'
def validat... | true |
ed83f457724d36148ebe01abdca8dc2b98797cd0 | Python | nhatsmrt/AlgorithmPractice | /LeetCode/667. Beautiful Arrangement II/Solution.py | UTF-8 | 491 | 3.0625 | 3 | [] | no_license | class Solution:
def constructArray(self, n: int, k: int) -> List[int]:
# Time and Space Complexity: O(N)
ret = [1]
used = set([1])
for i in range(k):
diff = k - i
if i % 2 == 0:
ret.append(ret[-1] + diff)
else:
ret... | true |
3b95e95b723a640e4474df038d3b29f247d56904 | Python | VexTrex87/Server-Backup | /__main__.py | UTF-8 | 2,512 | 2.59375 | 3 | [] | no_license | import discord
from discord.ext import commands
import dotenv
import os
dotenv.load_dotenv('.env')
client = commands.Bot(command_prefix='$')
guild = None
def get_object(objects, value):
for obj in objects:
try:
if obj.name == value or value == obj.mention or str(obj.id) in value or obj.id == i... | true |
01bf0bb3ae43e5938b8f1328b81a2e96d6168c37 | Python | Doug-North/simple_dungeon | /combat.py | UTF-8 | 261 | 3 | 3 | [] | no_license | import random
class Combat:
dodge_lim = 6
attack_lim = 6
def dodge(self):
roll = random.randint(1, self.dodge_lim)
return roll < 4
def attack(self):
roll = random.randint(1, self.attack_lim)
return roll < 4
| true |
4fd0e3286fe1108d0132d3428c7f3676e597f2fd | Python | zxnxzf/DEMApples | /dem_sim/util/hashing_utils.py | UTF-8 | 170 | 2.75 | 3 | [
"MIT"
] | permissive | def commutative_cantor(i, j):
i = int(i)
j = int(j)
i, j = sorted([i, j])
return (i + j) * (i + j + 1) / 2 + j
# TODO: Test other hashing functions.
| true |
c39f131e6b867f6c06ed566b02215920ac4b8456 | Python | alexisflores99/Repo-for-Python | /Interfaces Graficas/labelpy.py | UTF-8 | 618 | 3.5625 | 4 | [] | no_license | from tkinter import *
root = Tk()
imagen = PhotoImage(file = "jeje.gif")
label = Label(root, image = imagen)
label.pack()
"""
texto_nuevo = StringVar()
texto_nuevo.set("Python")
root.title("Bienvenidos")
root.config(width=400,height=300)
label = Label(root,text = "Hola mundo")
label.place(x = 100, y = 50) ... | true |
2386a5f92de1288e58fa9088b34e8006cf23fd05 | Python | dmaynard24/hackerrank | /python/practice/math/triangle_quest_2/triangle_quest_2_test.py | UTF-8 | 421 | 2.640625 | 3 | [] | no_license | from io import StringIO
from unittest.mock import patch
import unittest, triangle_quest_2
class TestTriangleQuest2(unittest.TestCase):
def test_triangle_quest_2(self):
with patch('sys.stdout', new=StringIO()) as fake_out:
triangle_quest_2.triangle_quest_2(5)
self.assertEqual(fake_out.getval... | true |
77396f6a3158dabda9a25dca81c0c6bf3dc9bd91 | Python | bsc-wdc/compss | /tests/sources/local/python/2_default_value/src/modules/testObjects.py | UTF-8 | 1,443 | 2.90625 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
PyCOMPSs default object value Testbench
=======================================
"""
# Imports
import unittest
from pycompss.api.task import task
from pycompss.api.on_failure import on_failure
from pycompss.api.api import compss_wait_on
# Python 2 and 3 compliant
@on_f... | true |
263cbad101e0f4ed16a3f8f2d2c799430f81dc93 | Python | MasoniteFramework/masonite | /src/masonite/notification/drivers/BroadcastDriver.py | UTF-8 | 692 | 2.546875 | 3 | [
"MIT"
] | permissive | """Broadcast notification driver."""
from .BaseDriver import BaseDriver
class BroadcastDriver(BaseDriver):
def __init__(self, application):
self.application = application
self.options = {}
def set_options(self, options):
self.options = options
return self
def send(self, ... | true |
90d7de7796b10d577013113cea33563a6156a805 | Python | tmd9936/ys_study | /python_basic/typing_game1.py | UTF-8 | 1,826 | 3.25 | 3 | [] | no_license | import random
import time
import winsound
import datetime
import sqlite3
words = []
n = 1 # 게임 횟수
correct_cnt = 0 # 정답의 개수
with open('./resource/word.txt', 'r') as f:
for word in f:
words.append(word.strip())
input('엔터키를 누르세요!! 게임 시작됩니다!!')
start = time.time()
while n <= 5:
random.shuffle(words)
... | true |
30deb9aac72b2d12c1cf28443f68220280afd7a6 | Python | joycezhou47/2048-ai | /game_interface_text.py | UTF-8 | 355 | 3.078125 | 3 | [] | no_license | from game_core import *
game = GameState()
while(not game.game_ended()):
print(game.text_interface())
available_moves = game.available_moves()
command = input("Enter next move {} :".format(available_moves))
while command not in available_moves:
command = input("Enter next move {} :".format(available_moves))
ga... | true |
2ca90e85caec8b2c8fb4e6611b58b02e47315a55 | Python | melgor/metric_learning.pytorch | /modeling/losses/base_loss.py | UTF-8 | 1,284 | 2.875 | 3 | [
"MIT"
] | permissive | import torch
import torch.nn.functional as F
class BaseMetricLoss(torch.nn.Module):
def __init__(self, normalize_embeddings: bool=True):
self.normalize_embeddings = normalize_embeddings
super(BaseMetricLoss, self).__init__()
def compute_loss(self, embeddings: torch.Tensor, labels: torch.Tens... | true |
0a7cdbfd2d7db2ab07e0e6354210b3cd9e3334f9 | Python | wisdomtohe/CompetitiveProgramming | /Forks/uvapy-master/geometry/p920.py | UTF-8 | 632 | 3.125 | 3 | [
"MIT"
] | permissive | from math import sqrt
num_tests = int(input())
for t in range(num_tests):
num_points = int(input())
points = []
for i in range(num_points):
points.append(list(map(int, input().split())))
points.sort()
# Keep track of max height seen
sunny_len = 0
hmax = 0
for i in range(len(points)-2, -1, -1):
... | true |
c2e4d2deeb9a14e78dca964a83bfe4ea52868462 | Python | hyeinkim1305/Algorithm | /SWEA/D3/SWEA_5215_햄버거다이어트.py | UTF-8 | 758 | 3.15625 | 3 | [] | no_license | '''
1
5 1000
100 200
300 500
250 300
500 1000
400 400
'''
# 굳이 여기서 부분집합들의 조합을 다시 리스트에 추가할 필요 없음. 그러면 런타임에러나옴
T = int(input())
for tc in range(1, T+1):
N, L = map(int, input().split())
grad = [list(map(int, input().split())) for _ in range(N)]
max_score = 0
for i in range(1<<N):
sum_g = 0 # ... | true |
1976b67cb6131deebbdcf0532dd58ea9be705155 | Python | mansonul/events | /config/key_generator.py | UTF-8 | 420 | 2.671875 | 3 | [
"MIT"
] | permissive | import random
import string
def keygen(size=15, chars=string.ascii_letters + string.digits):
return ''.join(random.choice(chars) for _ in range(size))
def create_key(instance, size=15):
new_keygen = keygen(size=size)
EmailAppClass = instance.__class__
qs_exists = EmailAppClass.objects.filter(secret=... | true |
8a6016edd11f2014773a8081a02d9cea7e955cfb | Python | PFCM/nn_rl | /players/nn_player.py | UTF-8 | 1,871 | 2.875 | 3 | [] | no_license | """Contains some things we can use to play a game using neural networks.
"""
import logging
import tensorflow as tf
import players.nets as nets
import players.replaybuffer as replaybuffer
USE_DEFAULT = 0
class NNPlayer(object):
"""Neural network player, loads up a net and maybe remembers how it's been
goi... | true |
74f11cb715925efa93cb8e5cf1cac29c33ed4133 | Python | NSSAC/SEA_IPM_SPREAD | /cellular_automata/scripts/convert_name_to_alpha.py | UTF-8 | 7,692 | 2.5625 | 3 | [] | no_license | ###########################################################################
# Reads a file and converts every occurence from specified input format to
# specified output format.
# tags: unicode encode pycountry iso alpha isNumber string2Number
# stringToNumber
###########################################################... | true |
69ea9f5f44b21898e894f3cf213be2e01a4edd5e | Python | pgroupATusc/Augmented-Neural-Network | /performance_prediction/cpu/MV/Matrix_Vector_CPU_Cons.py | UTF-8 | 3,359 | 2.75 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import pandas as pd
from sklearn import preprocessing
FILENAME = "matrix_vector_cpu_500_points_Xeon.csv"
data = np.array(pd.read_csv(FILENAME))
train_data = data[:250]
test_data = data[250:]
train_feature = np.array(train_data[:, [5]])
train_label = np.array(train_dat... | true |
2eef2e896dcfc9800094b7b3648699287f834b0d | Python | jeeveshlodhi/ImageCrawler | /crawler.py | UTF-8 | 801 | 2.59375 | 3 | [] | no_license | import requests as req
import time
import multiprocessing as mp
def download(s,e):
link = "https://erp.psit.in/assets/img/Simages/"
for i in range(s,e):
r2 = req.get(link+str(i)+".jpg")
if r2.status_code == 200:
with open ("images/"+str(i)+".jpg",'wb')as f:
... | true |
14387d72de14065a52df07f4197b1d644e27de1d | Python | banggeut01/algorithms | /SWEA/d1/2019.py | UTF-8 | 102 | 3.453125 | 3 | [] | no_license | # 더블더블
num = int(input())
for i in range(0, num+1):
print('{} '.format(pow(2, i)), end='') | true |
2e85a0db9076b6e39194fdd2b26fb19553f93822 | Python | inwk6312winter2019/openbookfinal-maulikpatel1711 | /task14.py | UTF-8 | 402 | 3.609375 | 4 | [] | no_license | from collections import Dict
import operator
def character_word_count(Book):
mylist = dict()
mopen = open(Book,"r")
for m in mopen:
m = m.strip()
m = m.split()
for r in m:
if r not in mylist:
mylist[r] = len(r)
return mylist
b = input("Enter book titl... | true |
2568175dfff7ca8c1029bcaab08c49e6c7f9fece | Python | jatinkhurana30/Regex-Flaskapp | /SolvedCodes/Answer2.py | UTF-8 | 1,587 | 2.65625 | 3 | [] | no_license | import re
import sys
def find_answer2():
log_file = open("assignment.log")
log_data = log_file.readlines()
log_list = {
"machine1":[],
"machine2":[]
}
regexp_machine1 = re.compile('Ping Identity')
regexp_machine2 = re.compile('PulseSecure')
for line in log_data:
if... | true |
7a90dc46b077723f8781995baaef672037c506c7 | Python | LalitGsk/Programming-Exercises | /Leetcode/jumpGameII.py | UTF-8 | 842 | 3.71875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Oct 31 23:24:55 2019
@author: lalit
Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Your goal is to reach the last index in the mi... | true |
b54d23ac2f6aba8170f167333391f4ad335d8d52 | Python | Aasthaengg/IBMdataset | /Python_codes/p02418/s275322427.py | UTF-8 | 99 | 2.828125 | 3 | [] | no_license | def main():
tmp = input()*2
tmq = input()
print('Yes' if tmq in tmp else 'No')
main()
| true |
b54b4fddc268a2a3e13c8de069113a261ab68320 | Python | flyyee/cep-surveyanalysis | /1.0/mf.py | UTF-8 | 13,475 | 3.28125 | 3 | [
"MIT"
] | permissive | import openpyxl
import statistics
from collections import Counter
import warnings
warnings.filterwarnings(action='ignore', category=UserWarning, module='gensim')
# filters warning that importing gensim for the first time causes
from gensim.summarization import keywords
import datetime
import matplotlib.pyplot as plt
im... | true |
797ff82e63dedc5f9b015f8f226e4f503f4dde7d | Python | stanfordmlgroup/CheXaid | /eval/below_curve_counter.py | UTF-8 | 2,352 | 3.078125 | 3 | [
"MIT"
] | permissive | """RAD below curve counter"""
import sklearn.metrics as sk_metrics
class BelowCurveCounter(object):
def __init__(self, rad_perf, task_name):
self.rad_perf = rad_perf
self.task_name = task_name
def ROC(self, ground_truth, predictions):
self.rad_perf.index = self.rad_perf['Score']
... | true |
820b44e1b40fcd023aa2b29c9049c6b12702adfc | Python | Shinsungjun/MotionPlanner | /scripts/MotionPlanner/local_planner.py | UTF-8 | 4,631 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python3
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
Assignments Solution Author: Engin Bozkurt
Motion Planning for Self-Driving Cars
Aug 24, 2019
"""
# Author: Ryan De Iaco
# Additional Comments: Carlos Wang
# Date: October 2... | true |
fe5672255ad3b21d1acec6e8870f0ea833573506 | Python | nado6miri/deeplearning | /LG_learning_TensorFlow/20181129/nm_model/mnist.py | UTF-8 | 3,382 | 2.703125 | 3 | [] | no_license | import tensorflow as tf
import random
import matplotlib.pyplot as plt
from tensorflow.examples.tutorials.mnist import input_data
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
#정확도 높이는 방법
# hidden layer 추가
# relu 추가 (sigmoid는 깊어지면 안좋음... 따라서 relu나 다른걸 사용해야 함)
# 가중치 변수의 초기화 함수 잘 사용 - tf.contrib.layers.xavier_initial... | true |