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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
3402741a91881c6ab6095dbd0cdb5d7441122078 | Python | DavidGilkeson/python-basics | /read_files.py | UTF-8 | 1,729 | 4.21875 | 4 | [] | no_license | # Open a File on the Server
# Assume we have the following file, located in the same folder as Python:
# demofile.txt
# Hello! Welcome to demofile.txt
# This file is for testing purposes.
# Good Luck!
# To open the file, use the built-in open() function.
# The open() function returns a file object, which has a read(... | true |
3d5ca66ee5438a55bdb460611db2e466348b6038 | Python | openthings/iclient-python | /iclientpy/test/jupyter/test_units.py | UTF-8 | 1,364 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | from unittest import TestCase
import pandas as pd
from iclientpy.jupyter import load_geojson_data, get_geojson_data, convert_data_frame_to_dataset
class TestUnits(TestCase):
def test_get_privince_geojson(self):
geojsondata = load_geojson_data()
privName = '天津'
feature = get_geojso... | true |
f588b2ff3d49eb45ea5d7c410c6f04f39da1d7bc | Python | dymbow10/python-faculdade | /programas/prova 1/exercicio 17.py | UTF-8 | 169 | 3.234375 | 3 | [] | no_license | Divine=Limit=0
while Limit<4:
soma=0
Divine+=1
for i in range(1,Divine):
if Divine % i == 0:
soma+=i
if Divine == soma:
Limit+=1
print Divine
| true |
cf554abbcc36c895cc1959e5fb046a13556499d9 | Python | PaulinaSzy/hearthbreaker | /hearthbreaker/agents/test_agent.py | UTF-8 | 1,026 | 2.90625 | 3 | [
"MIT"
] | permissive | from hearthbreaker.agents.basic_agents import PredictableAgent
class TalkativeAgent(PredictableAgent):
def __init__(self):
print('Initialising...')
print()
super().__init__()
def do_card_check(self, cards):
print('Checking cards')
print(cards)
print()
r... | true |
55535bdf7c197408b2f4d413e793aa7ba2c928d2 | Python | Kori3a/M-PT1-38-21 | /Tasks/DmitryKozhemyachenok/hmwk3/2.py | UTF-8 | 1,311 | 3.34375 | 3 | [] | no_license | def sep(text, maxlen):
text_new = ''
count = 0
for i in text.split():
count += len(i)
if count > (int(maxlen)-1):
text_new += '\n'
count = len(i)
elif text_new != '':
text_new += ' '
count += 1
text_new += i ... | true |
d569e705da475a0a1c3256d26c5f95c0a8cb4ef4 | Python | kenson2998/old_boy_study | /0626_自定義異常_classExcept.py | UTF-8 | 402 | 3.703125 | 4 | [] | no_license | # 自定義異常
class leonException(Exception):
def __init__(self, msg):
self.message = msg
self.sss = msg + "234"
def __str__(self): # __str__ 用於定義返回的值為什麼格式
return self.message
# return '我是異常例外喔'
try:
raise leonException('我的異常') # raise (瑞斯) 觸發的意思
except leonException as e:
... | true |
a5803d9449ef3377e6a9dd186d27904a3a797b28 | Python | mattrobenolt/python-mineshaft | /mineshaft.py | UTF-8 | 2,605 | 3.046875 | 3 | [
"BSD-3-Clause"
] | permissive | """
mineshaft
~~~~~~~~~
:copyright: (c) 2014 by Matt Robenolt.
:license: BSD, see LICENSE for more details.
"""
from time import time
from operator import attrgetter
import requests
__all__ = ('Mineshaft', 'Node', 'LeafNode', 'BranchNode')
getkey = attrgetter('key')
HINTS = {'*', '[', '{', '?'}
def needs_resolved... | true |
e7f1efacf0e4073df14f5ea5893f4a95634fff57 | Python | kohillyang/AlDefect-detection | /data/aluminum_material.py | UTF-8 | 2,080 | 2.515625 | 3 | [] | no_license | # encoding=utf-8
import json
import os
import pprint
import numpy as np
from PIL import Image
from sklearn.model_selection import train_test_split
from utils.common import lsdir
from utils.plot_bbox import plot_bbox
from .bbox_dataset import DetectionDataset
class AluminumDet(DetectionDataset):
def __init__(se... | true |
c6aa65aba8df91a6ece9bdcd2cb0cc05b84f3b7a | Python | ZeroILumi/PROJETO_INDICIUM- | /code-challenge/projeto_para_indicium/Criador_de_Arquivos_sql.py | UTF-8 | 2,968 | 2.890625 | 3 | [] | no_license | from Leitor_de_Arquivos_CSV import *
from datetime import *
import os
def criar_banco_de_dados_projeto_para_indicium_e_utilizalo():
caminho = 'C:/Users/Usuario/Desktop/Organização da Area de Trabalho Zero ILumi' \
'/Teste pratico indicium/code-challenge/data/Tabelas' \
'/Comando_para... | true |
32e315344c614315a0d9aadd5c038a96a32880eb | Python | Pongsaky/Attendance_faceRecognition | /service/attendance/attendance.py | UTF-8 | 1,118 | 2.765625 | 3 | [] | no_license | from datetime import datetime
import os
def markAttendance(name):
with open('Attendance.csv','r+') as f:
myDataList = f.readlines()
nameList = []
for line in myDataList:
entry = line.split(',')
nameList.append(entry[0])
if name not in nameList:
... | true |
0783866380b6cee08f9d73321c4c9e6c4ae91a80 | Python | abdalrhmanyasser/Abdalrhman_Rep | /Python/School/C6/excersize 7.py | UTF-8 | 75 | 3.71875 | 4 | [
"CC0-1.0"
] | permissive | s=input('Enter your Name: ')
for i in range(0,len(s)):
print(s[0:i+1]) | true |
27b39a62e978fa3fbde007b75f972e3eca5cf948 | Python | BenMichiel/angular-bokeh | /python/services/backbonelogger.py | UTF-8 | 4,104 | 3.40625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
backbonelogger
--------------
.. module:: backbonelogger
:platform: Unix, Windows
:synopsis: provides logging
log levels:
======== ===========
ERROR 'ERROR'
WARNING 'WARNING'
INFO 'INFO'
DEBUG 'DEBUG'
======== ===========
Created 2016/2017
@author: oliver, joh... | true |
81afc28f9430cf1ac5e2f86d0a7d5f98fff1153c | Python | yvson18/Clone-PhiloBot | /imageGenerator.py | UTF-8 | 2,486 | 2.703125 | 3 | [] | no_license | from PIL import Image, ImageFont,ImageDraw
import textwrap , sqlite3, io
from fastapi.responses import StreamingResponse
#------------------------------------------------ Consultando o banco---------------------------------------------------------------
def geraImg(frase):
banco = sqlite3.connect("data/image_da... | true |
199e4abfee0f357e36e973c0f2b50fe6d338cc75 | Python | nikhilganta/BEE-Image-and-Audio-Classification-Using-ANNs | /net_tester.py | UTF-8 | 8,773 | 2.65625 | 3 | [] | no_license | import cv2
from scipy.io import wavfile
import tflearn
import numpy as np
from tflearn.layers.core import input_data, fully_connected
from tflearn.layers.estimator import regression
# For loading BEE1 ANN Model
def load_image_ann_bee1(path):
input_layer = input_data(shape=[None,32,32,1])
fc_layer_1 = fully_con... | true |
1d418749c3ff5fa3686492052930062848e191f4 | Python | Karthik23K/dailycodingproblem | /Amazon/Problem#157.py | UTF-8 | 443 | 3.796875 | 4 | [] | no_license | """
Given a string, determine whether any permutation of it is a palindrome.
For example, carrace should return true, since it can be rearranged to form racecar, which is a palindrome.
daily should return false, since there's no rearrangement that can form a palindrome.
"""
def isPalindrome(s):
temp = set()
f... | true |
a006b4416e7a9b59788b8d4e76b9b0dc28971f77 | Python | sunkest/Algorithm | /Programmers/sum_two.py | UTF-8 | 250 | 3.078125 | 3 | [] | no_license | from itertools import combinations
def solution(numbers):
result = set()
comb = combinations(numbers, 2)
for a, b in comb:
result.add(a + b)
answer = sorted(list(result))
return answer
print(solution([2, 1, 3, 4, 1]))
| true |
c5b5757750016ac21570ef7c90d28ce23cdecd91 | Python | neerajkc/edgeCV | /recognition.py | UTF-8 | 2,911 | 2.5625 | 3 | [] | no_license | import cv2
import numpy as np
import face_recognition
from pathlib import Path
import pickle
import os
import base64
font = cv2.FONT_HERSHEY_DUPLEX
def load_weights(encoding_file):
if Path(encoding_file).is_file():
f = open(encoding_file, "rb")
known_face_names = pickle.load(f)
known_fac... | true |
fe787555d47bea75d674bf12c6c128d8c427b61a | Python | bashiralam185/PythonPracticeQuestions | /ChallengingQuestions1/the_little_book.py | UTF-8 | 21,525 | 4.03125 | 4 | [] | no_license | # challenge 1
# print a joke to the user
# def main():
# print("once upon a time there was a man! his name was ....")
# enter=input("Do you want to read more? Y/N")
# if enter=='Y' or enter=='y' or enter=="":
# print("he was with his family")
# else:
# print("thank you!")
# m... | true |
061adb9bb0a82f0f8409bc2ff7948ab5b7005aed | Python | lazurastv/Monopoly_Simulation | /gamecode/control/tile_manager.py | UTF-8 | 1,826 | 3.546875 | 4 | [] | no_license | class NotPropertyError(Exception):
def __init__(self):
super().__init__("Tile is not a property!")
class NotImprovableError(Exception):
def __init__(self):
super().__init__("Tile is not an improvable tile!")
class TileManager:
def __init__(self, game):
self.game = game
def i... | true |
779ec6a9356ef1c65424163a42ad8cbd6806b2d9 | Python | eugenesamozdran/lits-homework | /200_line_homework.py | UTF-8 | 9,580 | 3.78125 | 4 | [] | no_license | import random
#defining the order
def player_order(p1,p2):
global order
print("Player 1 rolled ", p1)
print("Player 2 rolled ", p2)
if p1 == "rock" and p2 == "scissors":
print("Player 1 goes first!")
order = 1
elif p1 == "rock" and p2 == "paper":
print... | true |
ae976ada34934f408edc54ca8781807205b630a9 | Python | rj172/calculator | /calcu.py | UTF-8 | 1,922 | 3 | 3 | [] | no_license | from __future__ import division
from Tkinter import*
def iCalc(source,side):
storeObj = Frame(source,borderwidth=1,bd=4,bg="powder blue")
storeObj.pack(side=side,expand=YES,fill=BOTH)
return storeObj
def button(source , side ,text,command=None):
storeObj = Button(source , text=text , comman... | true |
fd1e94f5d3b1bc12bbd860681e30aa82418b462e | Python | pfrodedelaforet/NLP-Project-Cyberthreat-Detection | /architectures/word2vec.py | UTF-8 | 1,455 | 2.84375 | 3 | [] | no_license | import nltk
from nltk.tokenize import word_tokenize, sent_tokenize
import gensim
from gensim.models import Word2Vec
from time import time
from megasplittor2000 import split_into_lists_of_words
import multiprocessing
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
import numpy as np
"""Sc... | true |
b598cc8cd78455a7a5e5c7542b749a58f7a84e6a | Python | nilsso/math538-project | /src/melody.py | UTF-8 | 3,845 | 3.34375 | 3 | [] | no_license | import numpy as np
import re
# NOTE: Currently not handling dotted rhythms
LY_PATTERN = re.compile(r"([a-z])(es|is)?([,'])*(\d*)")
DEGREE_MAP = {
'c' : 0, 'd' : 2, 'e' : 4,
'f' : 5, 'g' : 7, 'a' : 9, 'b' : 11 }
DEGREE_MAP_INV = {
0: 'C', 1: 'C#', 2: 'D', 3: 'D#',
4: 'E', 5: 'F', ... | true |
b4914a4841fc757b121e6a96f93f0f26a5160d5c | Python | Dharani-Arumugam/Capstone | /etl .py | UTF-8 | 9,460 | 2.578125 | 3 | [] | no_license | import re
import os
import configparser
from datetime import timedelta, datetime
from pyspark.sql import SparkSession
from pyspark.sql.functions import udf, col
from pyspark.sql.types import StructField, StructType, IntegerType, DoubleType
config = configparser.ConfigParser()
config.read_file(open('dl.cfg'))
os.envi... | true |
330162557bb0b759fb0509162254a834d1f9ce2a | Python | JunYe1993/Python-Starter | /Python3/LeetCode/0204-Count_Primes/Solution.py | UTF-8 | 1,320 | 3.828125 | 4 | [] | no_license | class Solution:
def countPrimes(self, n: int) -> int:
# Based on the Sieve of Eratosthenes
# We can easily elimiate the non-prime number
if n < 3: return 0
primes = [1]*n
primes[0] = primes[1] = 0
num = 2
while num*num < n:
if primes[n... | true |
521973d4ca9f5fd4c6dffdbfa3d34a9ab64144ad | Python | jacktnp/PSIT60 | /Week 14/6-RockPaperScissor.py | UTF-8 | 700 | 3.671875 | 4 | [] | no_license | """ PSIT Week 14
Wiput Pootong (60070090)
RockPaperScissor
"""
def main():
""" Count score """
activity = input()
score_a = 0
score_b = 0
for i in range(0, len(activity), 2):
# Draw
if activity[i:i+2] in ["SS", "RR", "PP"]:
continue
# A Win
if activity[... | true |
714d9d666c13f4fe2acde4922744843413c171d9 | Python | xavialex/TF-Object-Detection-Use-Cases | /object_detection_from_webcam.py | UTF-8 | 4,366 | 2.546875 | 3 | [
"MIT"
] | permissive | import os
import cv2
import time
import numpy as np
import tensorflow as tf
from utils import FPS, WebcamVideoStream
from object_detection.utils import label_map_util
from object_detection.utils import visualization_utils as vis_util
CWD_PATH = os.getcwd()
TF_MODELS_PATH = os.path.join(CWD_PATH, '..', 'Ten... | true |
7f89c976d2d7a4de3278bb6341e750474188012a | Python | LasTAD/VAST-2017-MC-1 | /SOM.py | UTF-8 | 26,102 | 3.09375 | 3 | [
"MIT"
] | permissive | import pickle
from multiprocessing import cpu_count, Process, Queue
import matplotlib.patches as mptchs
import matplotlib.pyplot as plt
import numpy as np
from scipy.spatial.distance import cdist
from sklearn.decomposition import PCA
def man_dist_pbc(m, vector, shape=(10, 10)):
""" Manhattan distance calculation... | true |
1dd12e17b3e33f53f40393497ee2fb50bf29ee65 | Python | yuanshaohui/python-learn | /自动化办公/test2.py | UTF-8 | 109 | 3.03125 | 3 | [] | no_license | a = 1
b = 2
def p(a, b):
d = print(s(a, b))
return d
def s(a, b):
d = a + b
return d
p(a, b) | true |
82163e07c14241427e274c789b50fa755ccf29ce | Python | fenderfan7/FiveInARow | /FiveInARowFunctions.py | UTF-8 | 3,588 | 3.234375 | 3 | [] | no_license | from random import randint
def initialise_board(rows, columns):
return [[0 for i in range(columns)] for i in range(rows)]
def print_board(board):
rows = len(board)
cols = len(board[0])
line = ' '
for i in range(cols):
# if i == 10:
# line += ' '
if i < 10:
line += str(i) + ' '
else:
line += st... | true |
5c90f9e7411c25177e75a122ed60f9b0b0ed7ff6 | Python | jose7602/Josesfirstdemo | /FiberCare.py | UTF-8 | 756 | 3.640625 | 4 | [] | no_license | ##Jose Mestre
type_of_car = "Van"
company = "FiberCare"
primary_van_color = "White"
secondary_van_color = "Green"
van_text = "FIBERCARE"
person = input("Enter your name: ")
print ("Hello new employee!", person)
test_van = input("Would you like to give the FiberCare van a test drive? ")
if test_van.lower() == "ye... | true |
49180d42c8fdcb43ee7f9b1a0ae64d8ea46e221c | Python | sofiabergman/live_freq_analysis | /main.py | UTF-8 | 2,184 | 2.875 | 3 | [] | no_license | from scipy.io import wavfile
from scipy.fftpack import fft
from scipy.fftpack import fftfreq
from matplotlib.animation import FuncAnimation
import numpy as n
import matplotlib.pyplot as plt
import time
fs, data = wavfile.read('./test.wav')
T_s = 1.0/float(fs)
window = 2000
window_T = window*T_s
overl... | true |
db3d3090215766bb2dfde40588092ec531f6daf0 | Python | ShumilinDmA/Articles_implementation | /Fault detection in industrial/fault_detector.py | UTF-8 | 8,144 | 3.234375 | 3 | [] | no_license | """
Student number: 0589870
Student name: Dmitrii Shumilin
"""
import numpy as np
import pandas as pd
from scipy import stats
from sklearn.decomposition import PCA
class FaultDetector:
"""
Needed to be imported Numpy and Pandas
Class to perform fault detection over dataset of time-series da... | true |
df2e28c9bc38f48f190ac2e2cbaed3b79acf83e2 | Python | soonler/Python000-class01 | /Week_01/G20200389010202/week01_G20200389010202_httpbin_v1.py | UTF-8 | 513 | 2.953125 | 3 | [] | no_license | import requests
import json
url_get = "http://httpbin.org/get"
url_post = "http://httpbin.org/post"
response_get = requests.get(url_get)
# print(response_get.text)
response_post = requests.post(url_post).text
print(response_post)
# type(response_post)
response_post_json = "[" + response_post.strip('\n') + "]"
print... | true |
f7cf1455205ccf5dccff27aff648ba3efee35698 | Python | Coni63/CG_repo | /training/medium/telephone-numbers.py | UTF-8 | 358 | 3.125 | 3 | [] | no_license | import sys
import math
tree = {}
n = int(input())
listing = [input() for _ in range(n)]
for each_word in listing:
for i in range(1,len(each_word)+1):
if each_word[:i] not in tree.keys():
tree[each_word[:i]] = 1
print(len(tree.keys()))
# Write an action using print
# To debug: print(... | true |
bfc32f296ef824bb481cdab3d099afb266514558 | Python | h3hound/TechAssessment2021 | /MIROJobSkilz.1.1.py | UTF-8 | 3,798 | 2.671875 | 3 | [] | no_license | '''
Created on Jan 17, 2021
@author: h3usr
MIRO Tech test
list all jobs with a given job requirement skill
required skill: 'engineering and technology'
'''
# import required libs
import requests
import json
import datetime
import logging
import sys
# constant for destination
RBIN_URL='http://requestbin.net/r/1fna7l31... | true |
5337cf933c608dd34876a70d486b73f85bc5fe1e | Python | webee/pay | /api_site/src/api_x/utils/ds.py | UTF-8 | 4,942 | 3.15625 | 3 | [] | no_license | # coding=utf-8
from __future__ import unicode_literals
class TypeValue(object):
def __init__(self, value):
self.value = value
def __eq__(self, other):
if isinstance(other, TypeValue):
return isinstance(other, TypeValue) and other.value == self.value
return self.value == ot... | true |
990e8ea477c699effa33cdf4fa8cfaf2e89f9bff | Python | wfgiles/P3FE | /Week 10 Ch 8/Book exercises2.py | UTF-8 | 275 | 3.65625 | 4 | [] | no_license | total = 0
count = 0
while ( True ):
inp = raw_input('Enter a number:')
if inp =='done': break
value = float(inp)
total = total + value
count = count + 1
average = total/count
print 'Average',average
print 'Total',total
print 'Count',count
| true |
fc2785b94dd80cb034f6ac0013e1165f7c57832b | Python | ShaunZh/LeetCode | /sort/insert_sort.py | UTF-8 | 379 | 3.09375 | 3 | [] | no_license | def insert_sort2(collection):
length = len(collection)
for i in range(1, length):
for j in range(i, 0, -1):
if collection[j] < collection[j - 1]:
collection[j], collection[j - 1] = collection[j - 1], collection[j]
return collection
if __name__ ==... | true |
7b589c91e6fe2119a345ba89c1e4a4e3dc3e68a2 | Python | DarkStarSword/junk | /arduino/remote/remote.py | UTF-8 | 1,365 | 2.71875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# vi:ts=4:sw=4:noexpandtab
import serial
prefix = '00100'
remote_id = '00000000' # Pressing the new code button increments this 8-bit value by one
arduino = '/dev/ttyACM0' # FIXME: Add udev rule to make this constant, or parse sysfs from here, as in:
# /sys/bus/usb/devices/XXX/product = 'Arduino... | true |
e816fe87bbcd82524a1ce132e8775d6f1434f607 | Python | orest-d/liquer | /liquer/tools.py | UTF-8 | 660 | 2.5625 | 3 | [
"MIT"
] | permissive | """Convenience functions for Liquer"""
from liquer.parser import *
from liquer.store import get_store, KeyNotFoundStoreException, set_store
from liquer.cache import get_cache
def get_stored_metadata(query):
"""Get metadata for a query - if it is stored in cache or a store."""
if not isinstance(query, Query):
... | true |
ab723eb11ac05184e244717bdad58d49f8392b10 | Python | djeanne/codewars-by-jo | /python/first_unique.py | UTF-8 | 429 | 3.4375 | 3 | [] | no_license | def first_non_repeating_letter(string):
new = string.lower()
sort_s = []
count = {}
for letter in new:
if letter in count:
count[letter] += 1
else:
count[letter] = 1
sort_s.append(letter)
for letter in sort_s:
if count[letter] == 1:
for i, (a, b) in enumerate(zip(string, new)):
if new[i] ==... | true |
3437c5807a9b6da42ff4a3f4d98c21397471bc26 | Python | szrlee/rlberry | /rlberry/experiment/generator.py | UTF-8 | 1,673 | 2.828125 | 3 | [
"MIT"
] | permissive | """Run experiments.
Usage:
run.py <experiment_path> [--writer] [--n_fit=<nf>] [--output_dir=<dir>] [--parallelization=<par>]
run.py (-h | --help)
Options:
-h --help Show this screen.
--writer Use a tensorboard writer.
--n_fit=<nf> Number of times each agent is fit [default: 4].
--output_dir=<dir... | true |
5724d9519fe3a7bb0616801569313ee7bc52a6ab | Python | Adamage/neural-nets-tutorials | /tensorflow-tutorials/natural-language/oxford-course-practical1/part5_wiki_tsne.py | UTF-8 | 2,024 | 2.65625 | 3 | [] | no_license | from utils import preprocessing_utils, gensim_utils
import os
from collections import Counter
from sklearn.manifold import TSNE
from bokeh.plotting import figure, ColumnDataSource, show
from bokeh.models.annotations import LabelSet
if __name__ == "__main__":
serialized_wiki = 'wiki_sentences.json'
wiki_sentenc... | true |
8c23e11cd050771f5cc04f9344711d5b74db23ee | Python | TheVexedGerman/Pouty-Bot-Discord | /cogs/distort.py | UTF-8 | 8,019 | 2.609375 | 3 | [
"MIT"
] | permissive | from discord import File, PartialEmoji, Member
from discord.ext import commands
from typing import Optional, Union
import aiohttp
import asyncio
import io
import uuid
import os
import sys
import uuid
class Distort(commands.Cog):
def __init__(self, bot: commands.Bot):
self.bot = bot
self.session = a... | true |
d0a35993f9c5bd93cbfea6768cbd0a2fe8b16b68 | Python | danresende/ud120-projects | /evaluation/evaluate_poi_identifier.py | UTF-8 | 2,096 | 3.171875 | 3 | [] | no_license | #!/usr/bin/python
"""
Starter code for the evaluation mini-project.
Start by copying your trained/tested POI identifier from
that which you built in the validation mini-project.
This is the second step toward building your POI identifier!
Start by loading/formatting the data...
"""
import pickl... | true |
6eea84258cd54a273ffa483c7b7a56ae47a5eb72 | Python | Keeeweee/adventOfCode-2019 | /day-07/src/Instructions/Instruction.py | UTF-8 | 309 | 2.796875 | 3 | [] | no_license | from typing import List
class Instruction:
arity = None
def __init__(self, args):
if len(args) != self.arity:
raise ValueError
def run(self, code: List[int], pointer: int) -> (int, int):
pass
@classmethod
def getArity(cls) -> int:
return cls.arity
| true |
7e11a119aeed4c0fe35b31c757483f0434cda08a | Python | elubow/dcos_monitor | /dcos_monitor/cmds/cmd_role_data.py | UTF-8 | 13,270 | 2.71875 | 3 | [
"MIT"
] | permissive | import click
import copy
import json
from dcos_monitor.cli import get_json, pass_context
from dcos_monitor.util import print_separator
#
# Formatting constants
#
# cluster level
RESOURCE_STRING = " {resource:<12}:{allocated:>12.2f} / {total:<12.2f} {unit:<8} {percentage:>6.2f} %"
# role level
ROLE_HEADER = " Ro... | true |
aa9997f36e00114be6437cb080df9101f38827a7 | Python | InesdeSantiago/splitFasta | /split_Fasta_.py | UTF-8 | 420 | 2.640625 | 3 | [] | no_license | import sys, os
input_fa = sys.argv[1]
output_dir = sys.argv[2]
#!/usr/bin/env python
f=open(input_fa,"r");
opened = False
for line in f :
if(line[0] == ">") :
if(opened) :
of.close()
opened = True
chrname = line[1:].split(" ")[0].rstrip()
outname = os.path.join(output_d... | true |
dc83cde8cd931dd0c89080c11910b8b67b0f618d | Python | hypothesis/h | /h/models/document/_uri.py | UTF-8 | 4,437 | 2.640625 | 3 | [
"BSD-2-Clause",
"BSD-3-Clause",
"BSD-2-Clause-Views"
] | permissive | import logging
import sqlalchemy as sa
from sqlalchemy.ext.hybrid import hybrid_property
from h.db import Base, mixins
from h.models.document._exceptions import ConcurrentUpdateError
from h.util.uri import normalize as uri_normalize
log = logging.getLogger(__name__)
class DocumentURI(Base, mixins.Timestamps):
... | true |
15a2bf6a4ac8fa7dea4f6f0d4e3f8dd7901031ac | Python | jha-hitesh/pysql | /pysql/examples/mysql/tables.py | UTF-8 | 1,335 | 2.625 | 3 | [
"MIT"
] | permissive | from orm.mysql.tables import MysqlTable
from orm.mysql.columns import FloatColumn, IntColumn
from orm.mysql.constraints import MySQLConstraint
from orm.mysql.connections import ConnectionPool, MysqlQueryManager
class Employee(MysqlTable):
"""Employee."""
_table_name_ = "employee"
id = IntColumn(NOT_NULL=T... | true |
8299b6db0b6659b095a963560fc110ee1915690e | Python | santealtamura97/Radicioni-LAB1_Concept_Similarity_and_WSD | /functions.py | UTF-8 | 6,411 | 3.125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 16 16:01:55 2021
@author: santealtamura
"""
import nltk
from nltk.corpus import wordnet as wn
import random
from nltk.tokenize import word_tokenize
from nltk.stem.wordnet import WordNetLemmatizer
import re
from random import randrange
"""Word sens... | true |
5c136ee95a7569fff1859c9dc6fb8b7eaf4e2336 | Python | YoungjooGim/SSULab1_Smart_GUI_Textbook | /스마트_GUI_교과서/스마트_GUI_교과서.py | UTF-8 | 24,536 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | import tkinter.ttk as ttk
from tkinter import *
root = Tk()
root.title("열혈파이썬 기초편 연습문제")
#root.resizable(False, False)
# 다음 버튼 / btn_combobox_chapters
def practices():
if combobox_chapters.get() == "Chapter1":
combobox_practices['values'] = ["연습문제01-1", "연습문제01-2", "연습문제01-3"]
combobox_practice... | true |
5db191b97b250d2576dedc9b5c8de8fe5dd56027 | Python | yandexdataschool/QuantileTransformerTF | /quantile_transformer_tf/quantile_transform_tf.py | UTF-8 | 7,127 | 3 | 3 | [
"Apache-2.0"
] | permissive | import tensorflow as tf
import numpy as np
from collections import namedtuple
from .interpolate_tf import InterpolatorTF, nonzero
InterpolatorsTuple = namedtuple(
"InterpolatorsTuple",
[
"quantiles_to_references_forward",
"quantiles_to_references_backward",
"references_to_quantiles",
... | true |
e0eb9f21e26cf232591bb3c22deebc7cb814282c | Python | LBHB/nems_db | /nems_lbhb/OLP_epochs_get.py | UTF-8 | 2,451 | 2.78125 | 3 | [] | no_license | def get_rec_epochs(parmfile, fs=100):
'''Takes a parmfile and outputs a dataframe containing every epoch that was played in the recording,
with columns giving you the concurrent epoch name, BG and FG alone, and then what synthetic
and binaural condition the epoch'''
from nems_lbhb.baphy_experiment impor... | true |
de41833214d64b4c80f7133cc4be15e161195583 | Python | rajan9519/WEB | /Book Review/import.py | UTF-8 | 1,797 | 2.9375 | 3 | [] | no_license | import csv
import os
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
engine = create_engine(os.getenv("DATABASE_URL"))
db = scoped_session(sessionmaker(bind=engine))
engine.execute("DROP TABLE users CASCADE")
engine.execute("DROP TABLE books CASCADE")
engine.execute("DROP... | true |
5481446e1ac3237f5133ca3b02a970f1d9b3fd1b | Python | zuobing1995/tiantianguoyuan | /第一阶段/day19/code/mynumber2.py | UTF-8 | 478 | 4.1875 | 4 | [] | no_license | # mynumber.py
# 此示例示意对象转字符串函数的重写方法
class MyNumber:
def __init__(self, val):
self.data = val
# def __str__(self):
# # print("__str__方法被调用")
# return "自定义数字: %d" % self.data
def __repr__(self):
'''此方法返回来的字符串一定是能表示self对象的表达式字符串'''
return "MyNumber(%d)" % self.data
... | true |
ce065ab02286a3ab42e0935254e26388470a6c9b | Python | kmcmanus/deck_games | /api/data/games.py | UTF-8 | 154 | 2.640625 | 3 | [] | no_license | games = {}
def save_game(game):
games[game.token] = game
def get_game(token):
return games.get(token)
def get_game_codes():
return games.keys()
| true |
1d96559b1a7db67932a1b8c937cec70e85bdbb62 | Python | SimonPavlin68/python | /pygame/opengl/cube-light.py | UTF-8 | 2,465 | 2.875 | 3 | [] | no_license | import pygame
from pygame.locals import *
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
WIDTH = 800
HEIGHT = 600
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
WHITE = (255, 255, 255)
vertices = (
(1, -1, -1),
(1, 1, -1),
(-1, 1, -1),
(-1, -1,... | true |
38f35173cabaf322975031ed861690ac5c702cfe | Python | ManasveeMittal/dropbox | /DataStructures/DataStructureAndAlgorithmicThinkingWithPython-master/chapter03linkedlists/DLL_test.py | UTF-8 | 1,447 | 3.109375 | 3 | [
"MIT"
] | permissive | import random
import unittest
from DLL import DoubleLinkedList
class TestSequenceFunctions(unittest.TestCase):
def test_insert(self):
dll = DoubleLinkedList()
dll.insert("alice")
self.assertEqual(dll.getNode(0).get_data(), "alice")
dll.insert("bob")
dll.insert("charlie")
... | true |
5a619591cf67e8d578821eec511ef3e1a6a4989c | Python | adang1345/Project_Euler | /15 Lattice Paths.py | UTF-8 | 190 | 3.1875 | 3 | [] | no_license | """Find the number of paths from top left corner of 20x20 grid to bottom right corner, moving only right or down"""
from math import factorial
print(factorial(20+20) // (factorial(20))**2)
| true |
917a0418432eee0a22de25bf75c11477a1db95c7 | Python | pgr-me/PRasmussenLab4 | /lab4/sorts/heap_sort.py | UTF-8 | 4,545 | 3.890625 | 4 | [
"MIT"
] | permissive | """Peter Rasmussen, Lab 4, sorts/heap_sort.py
This module implements a recursive version of the heapify and heap sort methods.
The heapify and sort methods are adapted from the implementation cited below.
Kumra, Mohit. "HeapSort". GeeksforGeeks, https://www.geeksforgeeks.org/heap-sort/.
Accessed 23 April 2021.
"""
... | true |
0cfa90c7310e97fe60e9820be2aeea9b5f236aac | Python | fazer1929/100DaysOfCode_Python | /Day22_Turtle_Cross/scoreboard.py | UTF-8 | 838 | 3.9375 | 4 | [] | no_license | from turtle import Turtle
class Scoreboard(Turtle):
def __init__(self):
super().__init__()
self.hideturtle()
self.color("white")
self.level = 1
self.penup()
self.show()
def show(self):
self.clear()
self.goto(-300,260)
self.write(f"Level :... | true |
a0ad414c98dd2305acb8c09abec6e25c567495c8 | Python | yoonju4095/python | /week12/Tk_Frame.py | UTF-8 | 452 | 3.40625 | 3 | [] | no_license | # 여러 배치 관리자 혼용하기
from tkinter import *
window = Tk()
f = Frame(window)
b1 = Button(f, text="박스 #1", bg="red", fg="white")
b2 = Button(f, text="박스 #2", bg="green", fg="black")
b3 = Button(f, text="박스 #3", bg="orange", fg="white")
b1.pack(side=LEFT)
b2.pack(side=LEFT)
b3.pack(side=LEFT)
l = Label(window, ... | true |
b55347bb998e99b59f2d6fffd2522260d1fe5351 | Python | Frankie010201/Sokoban | /推箱子.py | UTF-8 | 4,891 | 3.765625 | 4 | [] | no_license | '''
推箱子
Author: Frank
Created: 08/27/2017
'''
def Maze():
#list0-6 and Boxlayout for layout (x 为 纵坐标,y 为横坐标)
list0=['#','#','#','#','#','#','#','#','#','#']
list1=['#','#',' ',' ',' ',' ',' ','#','#','#']
list2=['#','#','O','#','#','#',' ',' ',' ','#']
list3=['#',' ','S',' ','O',' ',' ','O... | true |
260530aa23f39200046f6212048035df737f52b1 | Python | shaofeijanio/celery-events | /celery_events/backends.py | UTF-8 | 6,055 | 2.5625 | 3 | [] | no_license | class Backend:
def __init__(self, registry):
self.registry = registry
self.local_task_namespaces = set(self.get_local_namespaces())
self.local_events = set(self.registry.local_events)
self.remote_events = set(self.registry.remote_events)
def _find_event(self, event, events):
... | true |
c99949d31700f7ad79fcf8b838f3e2aad51dc347 | Python | shrinivasshah/Binance_selenium_automation | /test2.py | UTF-8 | 1,374 | 3.390625 | 3 | [] | no_license | import time
import threading
import requests
flag = 0
USDT_INR = float(input('usdt_inr'))
OFFSET = float(input('enter offset'))
def apiCall():
global flag
global USDT_INR
global OFFSET
while flag == 0 and (USDT_INR, OFFSET):
result = requests.get(
'https://api.binance.com/api/v3/ti... | true |
4c8838a8fb5f4e55d8807fee1f377cd627f6bf6e | Python | thomkav/building_segmentation_cv | /pipeline/gcloud.py | UTF-8 | 1,796 | 3.125 | 3 | [] | no_license | # Imports the Google Cloud client library
from google.cloud import storage
def upload_blob(bucket_name, source_file_name, destination_blob_name=None):
"""
Uploads a file to the bucket.
Upload to source file name by default if destination is not specified.
"""
# bucket_name = "your-bucket-name... | true |
6eb7d8742d4ebcd92859193dd25fcd6d74eb7057 | Python | Charlie-lusie/codes | /test.py | UTF-8 | 1,130 | 3.5625 | 4 | [] | no_license | class ListNode:
def __init__(self, x):
self.val = x
self.next = None
def ReverseList(pHead):
# write code here
if (pHead is None):
return pHead
if (pHead.next is None):
return pHead
p1, p2, p3 = pHead, pHead.next, pHead.next.next
if (p3 is None):
p2.n... | true |
7584eef5059827015dd0cdb7d6f13b6550a21e93 | Python | thallkeer/xoma163site | /apps/API_VK/command/commands/Weather.py | UTF-8 | 1,355 | 2.71875 | 3 | [] | no_license | from apps.API_VK.command.CommonCommand import CommonCommand
from apps.service.models import City
class Weather(CommonCommand):
def __init__(self):
names = ["погода"]
help_text = "Погода - прогноз погоды"
detail_help_text = "Погода [N] - прогноз погоды в городе N, доступны Самара, Питер, Сы... | true |
b9c39a3bac97fa1129344001bd2509d8ac7ac74f | Python | alexandraback/datacollection | /solutions_2464487_1/Python/BudAlNik/a.py | UTF-8 | 598 | 3.0625 | 3 | [] | no_license | import math
inp = open("input.txt", "r")
outp = open("output.txt", "w")
n = int(inp.readline().strip())
for i in xrange(n):
s = inp.readline().strip().split()
r, t = map(int, s)
#print(t)
L, R = 0, r + t
while(R - L > 1):
m = (R + L) / 2
#print(m, ((2 * ... | true |
5d5a7c3ce0a7a57d5f6fad869fd6ed6b9e96af3a | Python | pawelruminkiewicz/Processing_of_Massive_Datasets | /task_2/main.py | UTF-8 | 3,542 | 3.015625 | 3 | [] | no_license | from numpy import random
import numpy as np
import math
N = 10000 #number of people
P = 0.1 #probability
N_H = 100 #number of hotels
N_D = 100 #number of days
SIMULATIONS_COUNT = 1 #number of simulations
#permutation function
def permutation(value):
return math.factorial(value) / (math.factorial(2) * (math.factor... | true |
c0f627cb83a8485ac4b806cb55faf0fd03d72285 | Python | fabiommendes/toy_model | /tests/test_solvers.py | UTF-8 | 1,203 | 2.953125 | 3 | [
"MIT"
] | permissive | import numpy as np
import pytest
from numpy.testing import assert_almost_equal
from toy.solvers import Euler, RK2, RK4
class TestSteppedSolvers:
@pytest.fixture
def euler(self):
return Euler(lambda t, y: y, [1.0])
def test_euler_solver_step_function(self, euler):
assert euler.y == 1.0
... | true |
f7eb1129daff348e01c35185ae4fb7c503d6fbb4 | Python | mgrzechocinski/commit-message-verifier | /validate.py | UTF-8 | 1,111 | 2.84375 | 3 | [] | no_license | import argparse
import sys
from commit_msg_validator import validate
def read_in():
lines = sys.stdin.readlines()
return ''.join(lines)
def main():
parser = argparse.ArgumentParser(description="Validates commit message based on STDIN value",
usage="git show --format... | true |
1e22dc5c3583942e027ec7e103f5f82a0ac6e809 | Python | jabbalaci/django-hello_project | /hello_project/hello/graph_models.py | UTF-8 | 430 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
import os
import sys
def graph(args):
cmd = "python manage.py graph_models {apps} | dot -Tpng -o graph.png".format(apps=" ".join(args))
# print cmd
os.system(cmd)
cmd = "eog graph.png"
# print cmd
os.system(cmd)
if __name__ == "__main__":
if len(sys.argv) == 1:
... | true |
ef59abe00b8b3e56558de161944cd8a9aec9dae9 | Python | sherlock391/github.com | /2-Approximation.py | UTF-8 | 1,214 | 3.75 | 4 | [] | no_license | import networkx as nx
import math
# This function takes as input a graph g.
# The graph is complete (i.e., each pair of distinct vertices is connected by an edge),
# undirected (i.e., the edge from u to v has the same weight as the edge from v to u),
# and has no self-loops (i.e., there are no edges from i to i).
#
# T... | true |
25b29593047304f8ddfc1ad62abe4f91b67be138 | Python | debasishdebs/parameterTesting | /Git/streaming_hs_trees.py | UTF-8 | 10,299 | 2.9375 | 3 | [] | no_license | from __future__ import division
import random
import csv
import math
import matplotlib.pyplot as plt
maxDepth = 15
sizeLimit = 20
lambdA = 10
tau = 5
def initializeWorkingSpace(Dmin,Dmax):
'''
Redefine the range of each dimension in the feature space s.t. each
dimension has a new range.
Input:... | true |
bc2575e601c6cffa2de38e9a32cbfa54dd5e43c1 | Python | roechi/knowledge_representation | /Beleg1/search/uniformCostSearch.py | UTF-8 | 776 | 2.875 | 3 | [] | no_license | import Node
def uniformCostSearch(problem, fringe):
solution = []
closed = []
root = Node.Node()
root.state = problem.getStartState()
fringe.push(root, root.pathcost)
while (not fringe.isEmpty()):
node = fringe.pop()
if problem.isGoalState(node.state):
curre... | true |
ae8418e9505a0bcef706eb708b828f8469faeef4 | Python | Mors-morsa-morsem-pogania/STM-MTS | /calls.py | UTF-8 | 6,817 | 2.8125 | 3 | [
"MIT"
] | permissive | from STM import get_word, text_to_binary_morse, use_dictation
from MTS import audio_to_text, speech_to_text, load_dane, morse_to_audio, binary_Morse_to_text, morse_to_text
from micro_input import record_sound_on_key, WAVE_OUTPUT_FILENAME
import winsound
import time
from tts.call_synthesize import call_synthesize
... | true |
7bbc4bd3fbf540e0d5c3682408486b3d7ceb850e | Python | vikramcommods/DataScience | /Strings.py | UTF-8 | 891 | 3.890625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue May 28 21:06:36 2019
@author: reddy
"""
print("This is a practice workbook for code learned so far")
#First we begin by doing basic math
my_age = 41
my_first_name = "vikram"
my_last_name = "reddy"
my_monthly_brokerage = 150000
my_broker_cut = 0.60
my_tax... | true |
919ea763a6506707734527d1858215e4db810402 | Python | TheDataNomad/Data-Structure-Algorithms- | /Find_closest_Binary_search.py | UTF-8 | 1,612 | 4.0625 | 4 | [] | no_license |
data = [2,4,8,9,12,14,17,19,22,25,27,28,33,37,39,41,44,45,65,74,123,154,161,612,765,866,543,1212]
target = 34
#find the closest the integer to the target from the data using binary search algorithm
def Binary_search_iterative_closest(data,target):
# This is to stop the function from reading out of index v... | true |
a6f6c4e86db99732fd8d7cefd1b2cef26c898c32 | Python | adamgpol/MNIST-distance | /src/classifier.py | UTF-8 | 1,286 | 2.59375 | 3 | [] | no_license | from tensorflow.keras.datasets import mnist
from tensorflow.keras.layers import Dense, Input, Flatten,Reshape, Conv2D
from tensorflow.keras.models import Model
import tensorflow as tf
import numpy as np
def build_model():
input_layer=Input((28,28),name='encoder_input')
reshape_layer=Reshape((28,28,1),name='enc... | true |
8b71bfe2605c9b07a8aeb32c061538a4a1e0fee9 | Python | RandyRomero/photoGPSbot | /photogpsbot/__main__.py | UTF-8 | 27,168 | 3.09375 | 3 | [
"MIT"
] | permissive | """
Small bot for Telegram that receives your photo and returns you a map with
location where the photo was taken.
Written by Aleksandr Mikheev.
https://github.com/RandyRomero/photogpsbot
This specific module contains methods to respond us"er messages, to make
interactive menus, to handle user language, to process use... | true |
e43392fe0aed351140c26e48820578b58c4c5d38 | Python | susanacorrea/Unidad-III | /conexion con el servidor postgesql/insert_data.py | UTF-8 | 2,567 | 3 | 3 | [] | no_license | """
Autor: Susy
"""
#Importamos la librería psycopg2 y config (el archivo que hemos generado)
import psycopg2
from config import config
def insert_vendor(vendor_name):
"""Inserta un vendor dentro de la tabla de los vendores"""
sql = """INSERT INTO vendors(vendor_name) VALUES(%s) RETURNING vendor_id;""... | true |
3d0f701e0fd86f760e204ef2cf9a8e731f945a68 | Python | ShreyasBhise/SearchAndDestroy | /Cell.py | UTF-8 | 848 | 3.234375 | 3 | [] | no_license | from random import random
class Cell:
def __init__(self, x, y, p):
self.x = x
self.y = y
if p < 0.25:
self.terrain_type = 0.1 #FLAT
elif p < 0.5:
self.terrain_type = 0.3 #HILL
elif p < 0.75:
self.terrain_type = 0.7 #FOREST
else... | true |
5af30a7a87f2604788ea961c902c3f242c8e73d7 | Python | lcs100/experiment_about_paper | /overlap.py | UTF-8 | 8,037 | 2.875 | 3 | [] | no_license | import os
import random
import re
import threading
import time
node_count = 4096
shard_count = 16
MAX_VALUE = -1
class Node:
def __init__(self, index, num, shard_index_1, shard_index_2):
self._id = index
self.router = num
self.shard_index_1 = shard_index_1
self.shard_index_2 = sha... | true |
6a0707585bcf9f412918b244cced011bee5b4c77 | Python | PolySlug/polyslug | /lib/angle.py | UTF-8 | 385 | 3.390625 | 3 | [
"MIT"
] | permissive | #-*- coding: utf-8 -*-
import math
'''
angleVecteurs
@param {tup} v1
@param {tup} v2
@return {float} angle entre les deux vecteurs en degrés
'''
def angleVecteurs (v1, v2) :
x1, y1 = v1
x2, y2 = v2
proj = x1*x2 + y1*y2
hypo = math.hypot(x2, y2)
if hypo == 0 :
t = 0
else :... | true |
650518a6ec69c7afbf08cafed1a3d36ae5252605 | Python | jasmin19/TeachingUnit.Functions_Arguments_returnValues | /ex1_poly.py | UTF-8 | 114 | 3.515625 | 4 | [] | no_license | def poly(x):
y = 3*x**3+4*x**2-10*x+3
return y
print poly(-2)
print poly(0)
print poly(2)
print poly(4)
| true |
5372f2e38f4da943e4ccea2b8ac9686f8329a296 | Python | sevendollar/python | /deck_of_card.py | UTF-8 | 1,133 | 3.421875 | 3 | [] | no_license | class DeckOfCard:
def __init__(self):
self.nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'jack', 'queen', 'king']
self.suits = ['clubs', 'diamonds', 'heats', 'spades']
self.doc = []
for suit in self.suits:
for num in self.nums:
self.doc.append... | true |
ef5f2f23854aaf8c9f88616f0244fcf4e7b4ec9c | Python | m4t30m3i3r/oc20 | /Projets perso/Bails/Test Py/test.py | UTF-8 | 2,714 | 3.140625 | 3 | [] | no_license | import pygame
import random
pygame.init()
#variables couleurs
White = (255, 255, 255)
Red = (255, 0 , 0)
Green = (0, 255, 0)
Blue = (0, 0, 255)
Black = (0, 0, 0)
#crée l'écran
screenX = 800
screenY = 600
HW = screenX/2
HH = screenY/2
screenY = 600
screen = pygame.display.set_mode([screenX, screenY])
#Titre et icone... | true |
8eb3d6f9726e4e2a58681a9fcb3d9eebab19796a | Python | 670428704/FinanceAnalysis | /KLineAnalysis/GetDate.py | UTF-8 | 3,756 | 3.078125 | 3 | [] | no_license |
#这个库里的文件,为了获取股票期货等的信息,例如上市时间,退市时间,价格信息等
import tushare as ts
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as dates
import mpl_finance as mpf
from matplotlib.pylab import date2num
import datetime
from matplotlib.ticker import Formatter
#获取所有股票的代码和名字
def GetAllShareC... | true |
5ca101bf9ee18a8bb45e4f8abb510a1068847d88 | Python | lemonlxn/Spider | /spider_all.py | UTF-8 | 641 | 2.6875 | 3 | [] | no_license | # /usr/bin/env python
# -*- coding:utf-8 -*-
# @Time : 2018/7/5 20:41
# @Author : lemon
from lib.is_key_or_isbn import is_key_or_isbn
from .spider import Spider, Spider_keyword
def spider_all(keyword):
keyword = keyword.strip()
key_or_isbn = is_key_or_isbn(keyword)
spider_isbn = Spider()
spid... | true |
a991a54ce0b60cbb1f25a94fa8822e45c2bd28c9 | Python | BryanT05/Machine-Learning-Bootcamp | /Mini Project/ML/Answer/Python Basic/q7.py | UTF-8 | 157 | 3.5625 | 4 | [] | no_license | def sumDigits(num):
num = str(num)
ans = 0
for x in num:
ans += int(x)
return ans
for i in range(int(input())):
print(sumDigits(int(input()))) | true |
acdd99622596779cf9fb7bb7af370a64c820a6ba | Python | johndpope/ExploringTensorFlow | /train.py | UTF-8 | 1,215 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
import tensorflow as tf
import tflearn
import string
import re
from tflearn.data_utils import load_csv
max_document_length = 20
min_word_freq = 20
def word_to_vocab(message):
return np.array(list(vp.fit_transform([message])))
def clean_text(text_string):
text_string = re.sub(r'([^\s\w]|_|[0-... | true |
ded166fd982a64a4d69b9a53f0ffadda88ebad8c | Python | DChandlerP/two_sum | /two_sum.test.py | UTF-8 | 259 | 2.609375 | 3 | [] | no_license | import two_sum
class Test_Two_sum_TwoSum:
def test_twoSum_1(self):
result = two_sum.twoSum([0, 1, 2, 8, 22], 10)
assert result == [2, 3]
def test_twoSum_2(self):
result = two_sum.twoSum([0, 0], 3)
assert result == []
| true |
317caadc7e14257847fc8cef18f11c04cbabecc0 | Python | muffinangel/midi_to_image | /GAN_network/simple_gan.py | UTF-8 | 3,067 | 2.640625 | 3 | [] | no_license | # In[1]:
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
import numpy as np
import os
from import_data import DataProvider
from data_info import path_to_data
# load data
dp = DataProvider(path_to_data)
dp.load_data()
# In[2]:
X = tf.placeholder(tf.float32, shape=[No... | true |
e669ed60b6ee87a2ae479fca062a33e211baef99 | Python | dMedinaO/dmakitWeb | /dmakitModel/modulesProject/linear_regression/multiTaskLasso.py | UTF-8 | 479 | 2.59375 | 3 | [] | no_license | from sklearn import linear_model
class multiTaskLasso(object):
def __init__(self, dataset, target):
self.dataset=dataset
self.target=target
def trainingMethod(self):
self.model= linear_model.MultiTaskLasso()
self.multiTaskLassoModel =self.model.fit(self.dataset,self.target)... | true |
74b4f1cabb02b68b9fae97bac00308d99661b476 | Python | tedsta/kenny_server | /motor/motor.py | UTF-8 | 1,247 | 3.234375 | 3 | [] | no_license | import RPIO as rpio
from pwm import Pwm
# GLOBAL CONSTANTS
MOTOR_A_PIN1 = 4
MOTOR_A_PIN2 = 17
MOTOR_B_PIN1 = 6
MOTOR_B_PIN2 = 23
MOTOR_A = 0
MOTOR_B = 1
CLOCKWISE = 0
COUNTER_CLOCKWISE = 1
class Motor:
def __init__(self, pwm_pin):
self.pwm = Pwm(pwm_pin, 50)
self.direction = 0
self.posit... | true |
977858fe88333178cb2b66a691a1b42936111b4d | Python | Constancellc/Demand-Model | /JLR-fleet/JLRfleetExtractData.py | UTF-8 | 2,106 | 2.734375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import datetime
import csv
startDates = {}
newData = []
with open('../../Documents/JLRCompanyCars/JLRdata.csv','rU') as csvfile:
reader = csv.reader(csvfile)
#next(reader)
for row in reader:
print(row)
userID = row[14]
if userID... | true |
9b926bce9a069bdb494ec1f002b46434d138cd13 | Python | iyohan/Python200ForBeginners | /137.py | UTF-8 | 78 | 2.640625 | 3 | [] | no_license | f = open('./sources/stockcode.txt', 'r')
data = f.read()
print(data)
f.close() | true |