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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
6adbde1f54ba3fbe832e4a27019d4fd616a2507d | Python | john-mai-2605/computer-vision | /Lab 2 - Deep Learning (GAN)/Q5/emb.py | UTF-8 | 5,122 | 2.5625 | 3 | [] | no_license | from __future__ import division, print_function
import time
import matplotlib.pyplot as plt
import numpy as np
from numpy import asarray
from numpy import expand_dims
from numpy import log
from numpy import mean
from numpy import exp
from numpy import std
from math import floor
import os
import keras
from keras.models ... | true |
9c50ee4c635fdd6d1d9f76b7a53358ff71342cd6 | Python | runefriborg/pycsp | /pycsp/greenlets/guard.py | UTF-8 | 2,618 | 2.578125 | 3 | [
"MIT"
] | permissive | """
Adds Skip and Timeout guards
Copyright (c) 2009 John Markus Bjoerndalen <jmb@cs.uit.no>,
Brian Vinter <vinter@nbi.dk>, Rune M. Friborg <rune.m.friborg@gmail.com>.
See LICENSE.txt for licensing details (MIT License).
"""
# Imports
from pycsp.greenlets.scheduling import Scheduler
from pycsp.greenlets.channel... | true |
9ce7fe0063a59d4c4e430ceea6850d31a252b805 | Python | gaddeprasanna/general | /Python3/project_euler/0001-0050.py | UTF-8 | 7,832 | 2.8125 | 3 | [
"MIT"
] | permissive | __author__ = 'Aseem'
__name__ = '0001-0050'
#Most of these are in functions directory
import calendar
import combinatorics
import common
import files
import lcm
import math
import primes
import series
import sys
import utils_ab
from numbers_ab import *
from fractions import Fraction
from itertools import count, islic... | true |
8b474f07560898913e4d57d8d660d42532f0a16c | Python | ahmed-gharib89/ud120-projects | /validation/validate_poi.py | UTF-8 | 1,778 | 3.21875 | 3 | [] | no_license | #!/usr/bin/python
"""
Starter code for the validation mini-project.
The first step toward building your POI identifier!
Start by loading/formatting the data
After that, it's not our code anymore--it's yours!
"""
import pickle
import sys
sys.path.append("../tools/")
from feature_format import featur... | true |
3d703ea32a64aaff66b7fa4f91a2f229c975eabf | Python | EverydayQA/prima | /pytools/other/fsample/np1.py | UTF-8 | 704 | 3.40625 | 3 | [] | no_license | import numpy as np
x = np.linspace(-2,2,100)
y = np.cos(x)
theta = np.random.random((3,1))
m = len(y)
for i in range(10000):
#Calculate my y_hat
y_hat = np.array([(theta[0]*(a**2) + theta[1]*a + theta[2]) for a in x])
#Calculate my cost based off y_hat and y
cost = np.sum((y_hat - y) ** 2) * (1/m)
... | true |
6f74e60393c4e38d1105cee7d8d1153ba07c6362 | Python | qingant/redis-py | /redis/common/utils.py | UTF-8 | 1,683 | 3.015625 | 3 | [] | no_license | from .exceptions import CommandError, ClientQuitError
from .objects import RedisObject
def abort(errtype='ERR', message=''):
raise CommandError(errtype, message)
def close_connection():
raise ClientQuitError()
def nargs_greater_than(argnum):
def nargs_func(nargs):
return True if nargs > argnum... | true |
aed35b090b947daac150afaa670415d45b40884f | Python | TOM-SKYNET/AL_NIELIT | /ML/Day5_Nov14/q5.py | UTF-8 | 1,586 | 3.515625 | 4 | [] | no_license | """
5). Predicting rock facies (classes of rocks) from well log data
Well log data is recorded either during drilling operations or after the drilling via
tools either on the drill string or wireline tools descended into the well.
Typically, geoscientists would take the logs and make correlations by hand. They
wou... | true |
6703234db921503cfcfecf8168eced158c88d9b7 | Python | zholdak/fonts4py | /u8gfont_repack.py | UTF-8 | 6,283 | 2.828125 | 3 | [] | no_license | #
# --charset 0123456789-.°C
#
import argparse
import os
import sys
from u8g.font import U8GFont
from u8g.glyph import U8GGlyph
from utils.bytewriter import ByteAsBytearrayWriter
def char_info(char_enc: int):
return "0x{0:02x} ({0:d}) '{1}'".format(char_enc, chr(char_enc))
def repack_and_write(stream, font_da... | true |
5241bc9c8b2c8c3f162d6701f2a5bdc38b7cbdde | Python | liucheng2912/py | /100例/27需重写递归.py | UTF-8 | 253 | 4 | 4 | [] | no_license | """
利用递归函数调用方式,将所输入的5个字符,以相反顺序打印出来。
思路:
结束条件 循环条件
长度为0
"""
def f(n, l):
if l == 0:
return
print(n[l - 1])
f(n, l - 1)
s='12345'
l=len(s)
f(s,l) | true |
c5d6428affb4d577cf9d25bc6ad67256f54b59e5 | Python | AlogyStudy/pydemos | /friendsHeadStitch/main.py | UTF-8 | 2,405 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive |
import itchat
import math
import os
import PIL.Image as Image
import sys
import re
'''
获取微信用户性别
'''
def get_firend_sex(friend):
# 初始化计数器
male = female = other = 0
# friend[0]是自己的信息,所以要从friends[1]开始
for i in friend[1:]:
sex = i["Sex"]
if sex == 1:
male += 1
elif sex ... | true |
fe59d8ca248974cac9ec7371bbfa6685732abbe9 | Python | jaumecolomhernandez/simple-net | /neural_network/activation.py | UTF-8 | 525 | 2.9375 | 3 | [] | no_license | import numpy as np
class tanh:
@staticmethod
def calc(v):
return np.tanh(v)
@staticmethod
def calc_d(v):
return 1 - np.tanh(v)**2
class logistic:
@staticmethod
def calc(v):
return 1/(1+np.exp(-v))
@staticmethod
def calc_d(v):
return calc(v) * (1 -... | true |
45af5671fb182466eab067bc2f82e00a732457ad | Python | iitwebdev/lectures_wsgi_example | /8.session/1.session.delete.py | UTF-8 | 661 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from pprint import pprint
from common import get_session
if '__main__' in __name__:
"""Test if the data is actually persistent across requests"""
session = get_session()
session['Suomi'] = 'Kimi Räikkönen'
session['Great Britain'] = 'Jenson Button'
session['Deutchland'] = 'S... | true |
a11fee02126562ec8a43a63f01006eb1eb4b22bd | Python | AndreeaParlica/Codewars-Python-Fundamentals-Kata-Solutions | /square every digit.py | UTF-8 | 481 | 4.59375 | 5 | [] | no_license | # Welcome. In this kata, you are asked to square every digit of a number and concatenate them.
#
# For example, if we run 9119 through the function, 811181 will come out, because 92 is 81 and 12 is 1.
#
# Note: The function accepts an integer and returns an integer
def square_digits(num):
nume=[int(i)**2 for i in... | true |
97581798b0feaee77d89400fb2d60b4abd2064aa | Python | schebruch/ML_Projects | /PCA_Generic/main.py | UTF-8 | 628 | 3.109375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon May 20 16:12:50 2019
@author: scheb
"""
from pca import *
from sklearn import datasets
#we will obtain the variance, old data's shape, and new data's shape from the digits dataset
if __name__ == "__main__":
X = (datasets.load_digits().data).T
pca = PCA(X)
pr... | true |
e10c3ecc4d182a0137a2c13fc378591c3115f88e | Python | tierney12/VisionDataManagement | /visiondatamanagement_v2_21/visiondatamanagement/processing.py | UTF-8 | 13,055 | 2.515625 | 3 | [] | no_license | """
This module contains miscellaneous controller functions that have been
abstracted away from the main controller file. This module mostly contains I/O operations for
loading and storing the RetinaImageVector objects in a variety of file types.
Author: Sean P. Tierney
Date: April 2019
"""
import sys
imp... | true |
522f437cfdbe982989bb10481bafce532d80cc51 | Python | ankitaMandal/ASAP-AES-workbench | /asap_essay_scoring/learners.py | UTF-8 | 2,830 | 2.578125 | 3 | [
"MIT"
] | permissive | import copy
from abc import ABC, abstractmethod
import numpy as np
import pdb
import lightgbm as lgb
from sklearn.ensemble import RandomForestRegressor
from .data import get_domain1_ranges
class AbstractLearner(ABC):
def __init__(self, params = None):
self.params = self.default_params()
if params... | true |
a449929bbe43f0d93214acc6a97e63832db9a9d7 | Python | martinbudden/cadquery-plugins | /plugins/apply_to_each_face/apply_to_each_face.py | UTF-8 | 6,289 | 3.125 | 3 | [
"Apache-2.0"
] | permissive | from typing import Callable, List, TypeVar
import cadquery as cq
def applyToEachFace(
wp: cq.Workplane,
f_workplane_selector: Callable[[cq.Face], cq.Workplane],
f_draw: Callable[[cq.Workplane, cq.Face], cq.Workplane],
) -> cq.Workplane:
"""
Basically equivalent to `Workplane.each(..)` but
app... | true |
1c2dd9d196d1bb7b504ff0355c9ae9c0d48606cd | Python | Djennet85/pythonProject2 | /exercise_1.py | UTF-8 | 397 | 3.15625 | 3 | [] | no_license | #Задание №1 Поработать с переменными, создать несколько, вывести на экран.
import tkinter
import PIL
print("Привет, меня зовут Djennet")
name = input("Как вас зовут?: ")
print("Привет", name, "!")
surname = input("Как ваша фамилия?: ")
age = int(input("Сколько вам лет?: "))
| true |
71e3d970de7d092373501eaef36aadd14219e4a0 | Python | jgmjgm/networkx | /networkx/algorithms/centrality/katz.py | UTF-8 | 7,897 | 3.53125 | 4 | [
"BSD-3-Clause"
] | permissive | """
Katz centrality.
"""
# Copyright (C) 2004-2011 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
import networkx as nx
__author__ = "\n".join(['Aric Hagberg (hagberg@lanl.gov)',
'... | true |
00553ee40a7f22b4303d46958f18f24435c83aa3 | Python | OneLimeStudio/Covid_19- | /covid_19.py | UTF-8 | 1,043 | 2.5625 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
from tkinter import *
import time
import logiced
root = Tk()
root.geometry('400x400')
root.resizable(0,0)
root.title("Coronavirus updates")
root.configure(background='#adc2db')
#adc2db
result = requests.get("https://www.worldometers.info/coronavirus/")
#background_im... | true |
c4bb99d7c43a946571bab6dcb9205ed89fb9b689 | Python | godprobe/PyNet | /Week_2/b_Week2_Exercise2.py | UTF-8 | 1,066 | 3.6875 | 4 | [] | no_license | #!/usr/bin/env python
from __future__ import print_function, unicode_literals
# Make a list of five IP addresses
IP_addresses = ['192.168.2.1','255.255.255.1','1.1.1.1','127.0.0.1','192.168.1.1']
# Use the .append() method to add an IP address onto the end
IP_addresses.append('42.11.38.123')
# Use the .extend() met... | true |
248bc6d7e50e37050bfebd26b9973b9cac6414a3 | Python | adamziel/django_translate | /django_translate/extractors/django_template.py | UTF-8 | 2,819 | 2.59375 | 3 | [
"MIT",
"CC-BY-4.0",
"CC-BY-SA-3.0"
] | permissive | # -*- coding: utf-8 -*-
import re
import os
from django.template.base import Lexer, TOKEN_TEXT, TOKEN_VAR, TOKEN_BLOCK
from python_translate.extractors.base import Translation, TransVar, ExtensionBasedExtractor
val = '''(?:[^"' ]+)|(?:"[^"]*?")|(?:'[^']*?')'''
id_re = re.compile(r"^tranz(?:choice)?\s*({0})".format(v... | true |
73ff06f2116fcc5809b0c353bb15c22c41708ee1 | Python | caroltreacy/pands-problems-2020 | /secondstring.py | UTF-8 | 312 | 2.765625 | 3 | [
"MIT"
] | permissive | # the quick brown fox jumps over the lazy dog.
# back wards, every second letter
sentence = "The quick brown fox jumps over the lazy dog."
s = ".god yzal eht revo spmuj xof nworb kciuq eht"
# result = sentence[::-2]
# sentence2 = "the reverse of 'sentence'"
print(s[0:44:2])
| true |
e8f84a3b14e56a7aba5184ecfdfc6ecf62e2509d | Python | szymongretka/NTwI | /core/granulation/granule.py | UTF-8 | 1,959 | 3.09375 | 3 | [] | no_license | from typing import List, Generator
from abc import ABC, abstractmethod
from core.tokenization.word_token import WordToken
from core.filter.filter_stop_words import filter_stop_word_tokens
from nltk.stem import WordNetLemmatizer
class Granule(ABC):
@abstractmethod
def to_string(self) -> str:
pass
... | true |
c93731b2b67e0ed655f7846a1999120e74e4b1fa | Python | crazy-heng/study | /module1/hw2.py | UTF-8 | 3,349 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
menu = {
'北京':{
'海淀':{
'五道口':{
'soho':{},
'网易':{},
'google':{}
},
'中关村':{
'爱奇艺':{},
'汽车之家':{},
'youku':{},
},
... | true |
e0334f0a833a35c494dd8f8c24566103685940dd | Python | yonglehou/redis-search-py-1 | /base.py | UTF-8 | 776 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
from xpinyin import Pinyin
pinyin = Pinyin()
def mk_sets_key(instance_type,key):
return "%s:%s" % (instance_type,key)
def mk_score_key(instance_type,instance_id):
return "%s:_score_:%s" % (instance_type,instance_id)
def mk_condition_key(instance_type,field,value... | true |
c83f84e2ca5ca27646812d5f684aaeabe1c0a77e | Python | leafhmy/yiban_spider | /YiBan.py | UTF-8 | 5,863 | 2.703125 | 3 | [] | no_license | import json
import requests
import xlwt
import re
import datetime
import os
class YiBan:
def __init__(self):
with open('./config.json', 'r') as f:
config = json.load(f)
self.headers = config['headers']
self.form_data = config['form_data']
self.data_need = ... | true |
f0e292c353b62d9d6001e79562aab833dad5b410 | Python | mlenzen/lenzm_utils | /tests/test_flask_url_for_obj.py | UTF-8 | 1,574 | 2.515625 | 3 | [
"MIT"
] | permissive | import flask
import flask_sqlalchemy
import pytest
from lenzm_utils.flask import url_for_obj
app = flask.Flask(__name__)
app.config.update({
'SERVER_NAME': 'localhost',
'TESTING': True,
'DEBUG': True,
})
db = flask_sqlalchemy.SQLAlchemy(app)
blueprint = flask.Blueprint('blueprint', __name__)
app.register_blueprin... | true |
9eea94a18b5c03e4fe0ce2c59f447263113826ec | Python | mrtakata/session-recommender | /algorithms/knn/stanknn.py | UTF-8 | 6,989 | 2.875 | 3 | [] | no_license | from math import sqrt
import random
import time
import numpy as np
import pandas as pd
from .cknn import ContextKNN as sknn
from .helpers import similarities
from .helpers.contexts import *
from math import exp
class STANContextKNN(sknn):
"""
STANContextKNN(k, sample_size=500, sampling='recent',
... | true |
ad0176ed74a87ef2269696fdfcd368dd45455f82 | Python | ChristianMarca/ACME_Python | /src/payment.py | UTF-8 | 2,884 | 3.265625 | 3 | [] | no_license | from src.time_utils import TimeUtils
from src.constants import CONSTRAINS
class PaymentUtils:
def __init__(self):
self.timeUtils = TimeUtils()
@staticmethod
def __get_constrain(value_by_date, iteration):
if iteration == 2:
start_hour_shift_next = value_by_date[0]["start"]
... | true |
824ac9874b76af50e4f3a4925e07c200e877bda4 | Python | BellPeppers/Tracking-the-Flu-EOH2016- | /tweetAnalysis.py | UTF-8 | 1,166 | 3.171875 | 3 | [] | no_license | import json
import nltk
#nltk.download()
from nltk.corpus import treebank
from itertools import islice
from nltk.grammar import PCFG, induce_pcfg, toy_pcfg1, toy_pcfg2
from nltk.tokenize import sent_tokenize, word_tokenize
def analysis(tweet_list):
symptoms = ['cough', 'fever','sick'] # need a better way to do th... | true |
d41c95b3eb46c0412b1a7992613f3be5aa0e497f | Python | ZpmPower/pythonDyp | /plotCategoryCount.py | UTF-8 | 1,170 | 3.046875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
def drawCategoryCountPlot(categories,cat_count):
fig, ax = plt.subplots(figsize =(16, 9))
ax.barh(categories, cat_count)
for s in ['top', 'bottom', 'left', 'right']:
ax.spines[s].set_visible(False)
# Remove x, y Ticks
ax.xaxis.set_tic... | true |
a30db79abc9937e70e612af0c874fbaa458c34a5 | Python | GoLP-IST/nata | /tests/plugins/streak_test.py | UTF-8 | 1,003 | 2.71875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import numpy as np
import pytest
from nata.containers import Axis
from nata.containers import GridArray
from nata.containers import GridDataset
def test_streak_type():
grid = GridDataset.from_array(np.arange(12).reshape((4, 3)))
assert isinstance(grid.streak(), GridArray)
def test_... | true |
bff2d3072ce0f8b1bd991d88994339a4bad7a621 | Python | saubhik/leetcode | /tests/test_flipping_an_image.py | UTF-8 | 532 | 3 | 3 | [] | no_license | from unittest import TestCase
from problems.filpping_an_image import Solution
class TestFlippingAnImage(TestCase):
def test_example_1(self):
assert Solution().flipAndInvertImage(A=[[1, 1, 0], [1, 0, 1], [0, 0, 0]]) == [
[1, 0, 0],
[0, 1, 0],
[1, 1, 1],
]
d... | true |
851f2b686b9843f0725d780399d9942ca24a1317 | Python | r0hansharma/pYth0n | /largest of the three num.py | UTF-8 | 315 | 3.765625 | 4 | [] | no_license | a=float(input('enter first value\t'))
b=float(input('enter first value\t'))
c=float(input('enter first value\t'))
if ((a>=b) and (a>=c)):
print(a,'is largest number among',a,b,c)
elif ((b>=a) and (b>=c)):
print(b,'is largest number among',a,b,c)
else:
print(c,'is largest number among',a,b,c) | true |
4cdee43b310fd28e85e5aa91cf296d3e31c7a539 | Python | devmadhuu/Python | /assignment_01/digits_letters_count.py | UTF-8 | 443 | 4.25 | 4 | [] | no_license | ## Count the number of digits & letter in a string:
userinput = input ('Enter string to check digits and letters:')
num_digits = 0
num_letters = 0
index_pos = 0
while index_pos < len(userinput):
if userinput[index_pos].isdigit():
num_digits+=1
else:
num_letters+=1
index_pos+=1
print("Number ... | true |
d25a65477f8fda3e4a69bd5acbb96a373b82c56d | Python | sanskritilakhmani/Natural-Language-Processing | /TF-IDF.py | UTF-8 | 3,695 | 3.25 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 23 20:17:12 2021
@author: sansk
"""
# TF-IDF Term frequency -Inverse Document Frequency
import nltk
paragraph = """At present India is one of the best countries to live in. India is one of the best tourist attractions in the world. It has 29 states and every sta... | true |
3942c7105574492c13fc154c9344cd21fb8ce0a2 | Python | ksturner/ShipItSquirrel | /creds.py | UTF-8 | 599 | 2.53125 | 3 | [
"MIT"
] | permissive |
# You'll need to replace all of these values with the values that correspond
# to the tokens associated with the screen name you want to connect to. Getting
# these tokens REQUIRES that you register your program with Twitter's developer
# program so that you can get the tokens.
credentials = dict(
screen_name = '... | true |
8b7b672b4c8de3cb56531c22d8ac8f9faa4232a7 | Python | majordoobie/hackerrank | /saving_princess.py | UTF-8 | 1,289 | 3.890625 | 4 | [] | no_license | import random
x = int(input('Input for x: '))
y = int(input('Inpur for y: '))
mark = '-'
#initialize the matrix
matrix = [[mark for j in range(0,x)]for n in range(0,y)]
for row in matrix:
print(' '.join(row))
#randomly place p and m
ranx_m = random.randrange(0,x)
rany_m = random.randrange(0,y)
ranx_... | true |
2a532ae9df306fd51add43d5755d985da2ce0740 | Python | wriazati/interviewPrep | /src/dataStructures/LinkedList.py | UTF-8 | 3,282 | 4.28125 | 4 | [] | no_license | from dataStructures.Node import Node
class LinkedList:
def __init__(self):
"""
Initialize your data structure here.
"""
self.size = 0
self.head = None
self.tail = None
def __repr__(self):
return self.__str__(self)
def __str__(self):
builder = "Head-> "
curr = self.head
while curr:
builde... | true |
2f1eb6b3ec7dd86a2ef10dfaaf01957251958267 | Python | Aasthaengg/IBMdataset | /Python_codes/p02781/s041786793.py | UTF-8 | 1,456 | 2.890625 | 3 | [] | no_license | import sys
# input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7
N = list(input())
n = len(N)
K = int(input())
dp1 = [[0] * (K + 1) for _ in range(n + 1)] #N以下が確定していて、0以外の数をk個使ったとき
dp2 = [0] * (n + 1) #N以下が確定していないときの0以外の数の個数
for i in range(n):
a = int(N[i])
if a != 0:
dp2[i +... | true |
b9aec59e21502b70abd8006c65f34aa8e325517d | Python | liziniu/SuperMario | /common/her_sample.py | UTF-8 | 4,687 | 2.84375 | 3 | [] | no_license | import numpy as np
from copy import deepcopy
def make_sample_her_transitions(replay_strategy, replay_k, replay_t=None):
"""Creates a sample function that can be used for HER experience replay.
Args:
replay_strategy (in ['future', 'none']): the HER replay strategy; if set to 'none',
regula... | true |
dc43687cd50d6418332939ffdef596c40db6e854 | Python | HeBeePlu/FHSens | /docker_trans/transformer.py | UTF-8 | 1,826 | 2.890625 | 3 | [] | no_license | # Datenverarbeitung als Durchgangststion zwischen diversen Containern
#
# nimmt eingehende Daten an und gibt sie auf anderem topic wieder aus
#
#
import paho.mqtt.client as mqtt
import json
import ipadress
from datetime import datetime
broker_adress = "192.168.178.45" #ip des geraetes, auf dem der mqtt brocker laeuft... | true |
d62fde41816755429674b9a5400094168887f18a | Python | gychant/CSKMTermDefn | /ckbc_bilinear/demo_bilinear.py | UTF-8 | 3,810 | 2.546875 | 3 | [
"MIT"
] | permissive | """
Adapted from the ckbc-demo at http://ttic.uchicago.edu/~kgimpel/commonsense.html
"""
# arg1 is term1
# arg2 is term2
# arg3 is the way to get the score, valid input including
# all, max, topfive, sum
# [SymbolOf, CreatedBy, MadeOf, PartOf, HasLastSubevent, HasFirstSubevent, Desires, CausesDesire,
# DefinedAs, Ha... | true |
942e89648a7613961401ff1df7f9b88c590630b3 | Python | realRichard/-offer | /chapterFive/timeEfficiency/digitAtIndex/1.1.py | UTF-8 | 856 | 4.1875 | 4 | [] | no_license | '''
题目:
数字以0123456789101112131415……的格式序列化到一个字符串序列中。
在这个序列中,第5位(从0开始计数)是5,第13位是1,第19位是4,等等。
请写一个函数,求任意第n位对应的数字。
'''
def count_bit(n):
count = 0
while n > 0:
count += 1
n //= 10
return count
def digit_bit(num, index):
count = count_bit(num)
b = count - index
while b... | true |
ea143f43ce14aadf46f0cab63c9e74524a5a8937 | Python | alvinhizra9/RemedianModul1_JCDS_PurwadhikaBDG | /Remedian_1_jcds_02.py | UTF-8 | 2,041 | 3.6875 | 4 | [] | no_license | # Soal 1
# def Find_short(text):
# list_text = text.split(' ')
# list_jumlah_huruf = []
# for item in list_text:
# if item !='':
# angka = item.count('')-1
# list_jumlah_huruf.append(angka)
# list_jumlah_huruf.sort()
# print(list_jumlah_huruf[0])
# Find_short("Many p... | true |
7a936565c238636511a04cc7f33ff7ca83803bd6 | Python | ekourkchi/GalaxyGroups | /test1.py | UTF-8 | 1,123 | 3.734375 | 4 | [] | no_license | #Import Tkinter
from Tkinter import *
#Main Frame
class Application(Frame):
def __init__(self, master): #initialize the grid and widgets
Frame.__init__(self,master)
self.grid()
self.redFUN() #initialize the red frame's Function
self.greenFUN() #initialize the green frame's Function... | true |
244b0b75c40b44b0c83d55f3ceee0539964f3af3 | Python | laurentb/fabtools | /fabtools/tests/test_postgres.py | UTF-8 | 804 | 2.515625 | 3 | [
"BSD-2-Clause"
] | permissive | import mock
import unittest
class PostgresTestCase(unittest.TestCase):
@mock.patch('fabtools.require.postgres.create_database')
@mock.patch('fabtools.require.postgres.database_exists')
def test_params_respected(self, database_exists, create_database):
""" If require.database is called, ensure tha... | true |
2303e36a01197b3d3f3a9db6322101beb0500eef | Python | onfsdn/DELTA | /host-agent-verify/util.py | UTF-8 | 3,267 | 2.703125 | 3 | [] | no_license | '''This file contain all utility procedures that will be used to execute an attack'''
import random
from scapy.all import srp, Ether, ARP
import sys
import yaml
import pexpect
import Queue as queue
config_data = None
# Reading YAML config file
with open("config.yaml") as fp:
try:
config_data = yaml.load(f... | true |
d78ba5c9b0703e86d15ef17bb30632e9a1e790df | Python | atefehkhoshnood/Similarity | /similarity.py | UTF-8 | 2,395 | 3.25 | 3 | [] | no_license | # content intelligence: document classification
# Atefeh Khoshnood
# January 2020
###############################################
from collections import defaultdict
import numpy as np
class SimilarityError(Exception):
pass
class Similarity:
def __init__(self, cats, data):
self.cats = cats
... | true |
310e0358da90018e07ebdea7824d2c0bdc6344cd | Python | Christian-Prather/Python_Sensor_Systems | /Midterm.py | UTF-8 | 3,995 | 3.828125 | 4 | [] | no_license | # Import libraries for use plotting, gpio, arrays, time
import RPi.GPIO as GPIO
import numpy as np
import matplotlib.pyplot as plt
import time
# Pin declaration
buzzerPin = 25
switchPin = 27
ledPin = 21
# Declaration of global lists for plotting
duration= []
pitch=[]
order=[]
# Bool variable for graphing and singi... | true |
eef2534742e1a368393468f4d606ffe3931645da | Python | yjp12/FEEL | /DRL.py | UTF-8 | 5,220 | 2.703125 | 3 | [] | no_license | from torch import nn
import torch
import numpy as np
import torch.nn.functional as F
import time
class ANet(nn.Module):
def __init__(self, s_dim, a_dim, a_bound):
super(ANet, self).__init__()
self.a_bound = a_bound
self.fc1 = nn.Linear(s_dim, 64)
# self.fc1.weight.data.... | true |
cbcb61d9320650cc42883d6eef73d6d124b21b01 | Python | Leester337/NovelMarks | /Classes/Test/renderertest.py | UTF-8 | 1,576 | 3.046875 | 3 | [] | no_license | #!/usr/bin/python
import sys
from datetime import date
sys.path.append('../Manager')
from renderer import *
if __name__ == "__main__":
renderer = Renderer()
# Testing drawing of absolute nodes
#root_drawable_children = [
# NodeDrawable('classes', 'date', 10, 'green', 20, Point(290, 260), []),
... | true |
8af15f15895e52236031de08f537bb00d3d4f6b0 | Python | lt393/pythonlearning | /s7_python_functions/argument.py | UTF-8 | 353 | 3.609375 | 4 | [
"Apache-2.0"
] | permissive |
# required argument, the arguments passed to the function in correct positional order.
def func(a, **b):
print(b)
print(b['d'])
func(a=1, b=2, c=3, d=4)
# Variable-length arguments: This used when you need to process unspecified additional arguments.
# An asterisk (*) is placed before the variable name ... | true |
bbbb95519e1f58642b25b4642b7ef20bc0bbbf05 | Python | neoguo0601/DeepLearning_Python | /Python_basic/python_basic/python_basic_1.py | UTF-8 | 2,066 | 4.375 | 4 | [] | no_license | days = 365
print(days)
days = 366
print(days)
#Data Types
#When we assign a value an integer value to a variable, we say that the variable is an instance of the integer class
#The two most common numerical types in Python are integer and float
#The most common non-numerical type is a string
str_test = "China"
int_tes... | true |
24e666d8ad9b519c46ae709d652f787620a88443 | Python | jjfeng/bayesian_model_revision | /modelers.py | UTF-8 | 5,100 | 2.6875 | 3 | [] | no_license | from typing import List
import numpy as np
import pandas as pd
from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier
from dataset import Dataset
class LockedModeler:
def __init__(self, dat: Dataset, n_estimators: int=200, max_depth: int = 3):
self.dat = dat
self.curr_mode... | true |
e8cec219f8f3357390cd65ca80021a810f7f4b84 | Python | y56/leetcode | /711. Number of Distinct Islands II.py | UTF-8 | 2,744 | 2.8125 | 3 | [] | no_license | class Solution:
def numDistinctIslands2(self, grid: List[List[int]]) -> int:
if not grid or not grid[0]: return 0
M,N=len(grid),len(grid[0])
seen=set()
def dfs_explore(r,c,li_of_island_coord):
if ( 0 <= r < M
and 0 <= c < N
and grid[r]... | true |
983e9a6983207b09237f04a7830fd2c1552bff2d | Python | jancajthaml-openbank/e2e | /perf/parallel/pool.py | UTF-8 | 2,002 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import subprocess
from queue import Queue
from threading import Thread, Event
from time import sleep
_NPROCESSORS_ONLN = int(subprocess.check_output(["getconf", "_NPROCESSORS_ONLN"]).strip()) # * 100
class Worker(Thread):
def __init__(self, name, queue, abort, idle)... | true |
ccb0717371ead2452b9bfa76949ea7cd0aea2281 | Python | chriscargill/MazeBuilder | /mazeBuilder.py | UTF-8 | 10,458 | 3.1875 | 3 | [] | no_license | """
Processes an image and stores the values along with the lua text in a file.
This file can then be added to the Roblox plugin for the plugin to create the image in a 3D space
"""
from PIL import Image
import sys
import time
args = sys.argv
image_name = args[1]
img_url = f"./{image_name}"
img = Image.open(img_url)
... | true |
ee4cb2d96fc3bf5c4806fa0087e663c93d85118f | Python | SriRamanujam/bot-modules | /dbHandler.py | UTF-8 | 14,388 | 2.984375 | 3 | [] | no_license | import sqlite3
import logging
log = logging.getLogger("dbHandler")
# log.setLevel(20) # suppress debug output
CLOAK_LIST = ["users.quakenet.org", "user/"]
class dbHandler(object):
"""handles database connections for modules."""
def __init__(self, db_path):
self.db_path = db_path
self.db_conn... | true |
6ab79a454e12aa5909df4862435e6c484eb591d5 | Python | git2358/picotracker-api | /picotracker/games/management/commands/update_games.py | UTF-8 | 2,952 | 2.546875 | 3 | [] | no_license | import json
import math
from datetime import datetime
from django.core.management.base import BaseCommand
from django.utils import timezone
from pyquery import PyQuery
from picotracker.games.models import Developer
from picotracker.games.models import Game
BBS_URL = 'https://www.lexaloffle.com/bbs/lister.php?use_hurl... | true |
1c55aca0667b4c14ddfadf37cdfd82df9e2dde7c | Python | bdewilde/toolbox | /box_office_mojo_scraper.py | UTF-8 | 1,641 | 2.796875 | 3 | [] | no_license | import bs4
import csv
import re
import requests
USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11'
BASE_URL = 'http://www.boxofficemojo.com/movies'
def get_film_weekly_box_office(film_id) :
url = BASE_URL + '/?page=weekly&id=' + fi... | true |
16568b0b47e2092f34d31efce2c4f1c1a5d439c5 | Python | meowoodie/my-hadoop-streaming-jobs | /word_url_relevance_q/local_script/statistics.py | UTF-8 | 960 | 2.96875 | 3 | [] | no_license | import sys
matrix = []
for line in sys.stdin:
matrix.append(line.strip().split("\t"))
# Average
average_q = 0
for row in matrix:
average_q += float(row[10])
average_q /= len(matrix)
print "Average Q of all records is %s." % average_q
classes = [
["comment1", "types when score is 0", 4],
["mark", "score", 9]
]
... | true |
1cfdf7a89041161565f80a7ee0f9c817b81b9e7d | Python | terokode/bittiripari2020 | /craft.py | UTF-8 | 1,548 | 3.78125 | 4 | [] | no_license | import pygame
from bullet import Bullet
class Craft:
# Direction constants
HALT = "HALT"
LEFT = "LEFT",
RIGHT = "RIGHT"
def __init__(self, x = 0, y = 0, speed = 1):
# Craft position on screen (coordinates)
self.x = x
self.y = y
self.speed = speed # Move px
... | true |
e5f7415bf8aa5bd75cda8db388375f42d617d2d3 | Python | giovannidoni/cextend | /tests/test_myext.py | UTF-8 | 232 | 2.6875 | 3 | [] | no_license | import numpy as np
from cex import myext
def test_mycfunc():
# given:
x = np.array([1,2], dtype=float)
# when:
result = myext.mycfunc(x)
# then:
np.testing.assert_array_equal(result, np.array([2., 3.]))
| true |
f7a97d8867cc90c77ade4a57765ef375444bcc92 | Python | vreinharz/project_euler | /50/test.py | UTF-8 | 573 | 3.328125 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | import time
def primes():
nb = 2
yield nb
primes = [nb]
while True:
nb += 1
if all(nb % x != 0 for x in primes):
yield nb
primes.append(nb)
def slice_sub_equal(nb, to_slice):
for i,j in ((x,y) for x in range(len(to_slice))
for y in rang... | true |
c46f1e17c6592f1d0fe0c7c79141a2ba1103886f | Python | FASLADODO/Lecture-Multicampus | /인공지능-자연어처리(NLP)-기반-기업-데이터-분석/조성현 강사님/01. ML/ML 실습/20200618/ML-NB-iris.py | UTF-8 | 797 | 3.046875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Jun 18 14:27:25 2020
@author: sir95
"""
# module import
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import GaussianNB
# load data
iris = load_iris()
# split data
X_train, X_test, y... | true |
81d92ea9fe4d91357b45eee08189c562248f5340 | Python | grecoe/CliSkin | /cliutils/configuration.py | UTF-8 | 491 | 3.046875 | 3 | [
"MIT"
] | permissive | import os
import json
class Configuration:
def __init__(self, config_path: str):
if not os.path.exists(config_path):
raise Exception("Config file not found: ", config_path)
config = None
with open(config_path, "r") as input:
config = input.readlines()
co... | true |
87fe00a6c13880d96c55296b72b0c6367230e183 | Python | anulrajeev/Monte-Carlo-Simulations | /Lab 7/180123021.py | UTF-8 | 1,929 | 3.328125 | 3 | [] | no_license | import pandas as pd
import numpy as np
def readData():
data = pd.read_csv('SBIN.NS.csv',usecols=['Date','Adj Close'])
prices = []
dates = []
for ind in data.index:
dates.append(data['Date'][ind])
prices.append(data['Adj Close'][ind])
return dates,prices
def computeMuSigma(s):
u... | true |
c3681df51184da73392e3420b3ca2cb719499bfd | Python | kobe1916/PY_ | /Data Analysis/Numpy/Numpy数据处理.py | UTF-8 | 1,449 | 3.375 | 3 | [] | no_license | '''
问题 来自英国和美国各一千多视频 的点击 喜欢 不喜欢 评论数量
'''
'''
import numpy as np
us_file_path ="...."
uk_file_path="..."
t1 = np.loadtxt(us_file_path,delimiter=",",dtype="int",unpack=True)
t2 = np.loadtxt(uk_file_path,delimiter=",",dtype="int")
print(t1)
print("*"*10)
print(t2)
'''
import numpy as np
#us_file_path ="...."
u... | true |
8fdc7648b2afc4f10fe2f31351fac554254c5d63 | Python | jasonxiaohan/DataStructure | /LinkedListStack.py | UTF-8 | 787 | 3.78125 | 4 | [] | no_license | # -*- coding:utf-8 -*-
from DataStructure.Stack import Stack
from DataStructure.LinkedList import LinkedList
class LinkedListStack(Stack):
__list = [];
def __init__(self):
self.__list = LinkedList()
def getSize(self):
return self.__list.getSize()
def isEmpty(self):
return self... | true |
506a4da5b5bf6bd3a6163a03441b02a6843baa2f | Python | edmanf/Cryptopals | /tests/test_xor.py | UTF-8 | 680 | 2.84375 | 3 | [] | no_license | import unittest
from src.cryptopals import xor
class TestXor(unittest.TestCase):
def test_unequal_fixed_xor(self):
with self.assertRaises(ValueError, msg = "Lengths must be equal."):
xor.fixed_length_xor(bytearray(), b"1")
def test_fixed_length_xor(self):
self.assertEq... | true |
7c86c03d9dbec22f93f3d042cc0b9bc859272b94 | Python | mimagiera/poland-covid-vaccine | /mongo_import.py | UTF-8 | 2,263 | 2.59375 | 3 | [] | no_license | import ast
import glob
import json
from os import walk
import pymongo
from pymongo import bulk
from pymongo.errors import DuplicateKeyError
from consts import *
is_conversation_downloaded = True
is_covid_topic = False
def import_old_data():
mongo_client = pymongo.MongoClient(DB_CONN_STRING)
database_name =... | true |
70ae55b15449af9cbcd7e89059c3014cf72983ca | Python | Jerbuck/content-playground | /tests/test_xml_reader.py | UTF-8 | 1,336 | 2.90625 | 3 | [
"MIT"
] | permissive | import unittest
import os
import sys
currentdir = os.path.dirname(os.path.realpath(__file__))
parentdir = os.path.dirname(currentdir)
sys.path.append(parentdir)
from custom_object import CustomObject
from readers.xml_reader import XmlReader
class Test_XmlReader(unittest.TestCase):
def test_custom_object_load_wi... | true |
82f559e674521a19da6d4e6663598b257b5d16c9 | Python | gusenov/examples-tkinter | /widget-menu-file/Tkinter Menubar.py | UTF-8 | 1,416 | 3.25 | 3 | [
"MIT"
] | permissive | import tkinter as tk
from tkinter import filedialog
def on_open():
print(filedialog.askopenfilename(initialdir="/",
title="Open file",
filetypes=(("Python files", "*.py;*.pyw"), ("All files", "*.*"))))
def on_save():
print(filedialog.... | true |
84085608d5e6405240364735078d39cc4b94f980 | Python | adhilali/adhil | /add.py | UTF-8 | 182 | 3.0625 | 3 | [] | no_license | def add2(n1,n2):
s=n1+n2
return s
def add3(n1,n2,n3):
s=n1+n2+n3
return s
def add4(n1,n2,n3,n4):
s=n1+n2+n3+n4
return s
print add2(3,4)
print add3(1,2,3)
print add4(1,2,3,4)
| true |
449e5c5819c8168a805ca36766b0efa549b46be4 | Python | CJX3M/PythonLearning | /sum.py | UTF-8 | 233 | 4.15625 | 4 | [] | no_license | print("Enter the first number")
firstNumber = int(input())
print("Enter the second number")
secondNumber = int(input())
print("The sum of " + str(firstNumber) + " plus " + str(secondNumber) + " is " + str(firstNumber + secondNumber)) | true |
34b2ed6aa7eea8ec02c944e81ab24013899a8c4b | Python | pawrol/tests_learning | /page_object_patern/tests/test_hotels_search.py | UTF-8 | 1,650 | 2.75 | 3 | [] | no_license | import pytest
import allure
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from page_object_patern.pages.result_search_hotel import ResultSearchHotel
from page_object_patern.pages.search_hotel import SearchHotelPage
from page_object_patern.utils.read_excel import Excel... | true |
04af1e68971d976dd29ef8da6a45317071bc1106 | Python | Elvin-Arrow/numerical-computing | /Assignment-5/assignment-5.py | UTF-8 | 678 | 3.359375 | 3 | [] | no_license | from tabulate import tabulate
def f(x):
return 0.2 + (25 * x) - (200 * x * x) + (675 * x * x * x) - \
(900 * x * x * x * x) + (400 * x * x * x * x * x)
def trapm(h, n):
temp = a
sum = 0
for i in range(1, n):
temp += h
sum = sum + f(temp)
i = (b - a) * (f(a) + (2 * sum) ... | true |
60e41201f80c23473194615cf19d534db4dabd78 | Python | tapioka324/atcoder | /ABC/030/b.py | UTF-8 | 113 | 2.5625 | 3 | [] | no_license | n, m = map(int, input().split())
ans = abs(n % 12 * 30 + m * 0.5 - m * 6)
print(360 - ans if ans > 180 else ans)
| true |
b1501a989b9206ee90a64b14c318822133403481 | Python | scality/metalk8s | /salt/_states/metalk8s_etcd.py | UTF-8 | 1,547 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
import logging
log = logging.getLogger(__name__)
__virtualname__ = "metalk8s_etcd"
def __virtual__():
if "metalk8s_etcd.add_etcd_node" not in __salt__:
return False, "`metalk8s_etcd.add_etcd_node` not available"
else:
return __virtualname__
def member_present(name,... | true |
b244de8eb4fad488c218d03404d51959aebd1159 | Python | smok-serwis/build | /docker-only/strip-docs.py | UTF-8 | 1,889 | 3.125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# coding=UTF-8
"""
Strip comments and docstrings from a file.
"""
import io
import sys
import token
import tokenize
import os
def do_file(fname):
""" Run on just one file.
"""
mod = io.BytesIO()
with open(fname, "r") as source:
prev_toktype = token.INDENT
first_line... | true |
a851c2cc696699ca6cf2c98d4aee888b6435bdb0 | Python | kystyn/sigproc_big | /src/obj_search.py | UTF-8 | 3,267 | 2.96875 | 3 | [] | no_license | from math import fabs, sqrt, inf
def dist(dot1, dot2):
return sqrt((dot1[0] - dot2[0]) ** 2 + (dot1[1] - dot2[1]) ** 2)
# may be different directions of found edges
def dist_top_leg(tabletop_corner, tableleg):
return min(
dist(tabletop_corner, tableleg[0]),
dist(tabletop_corner, tableleg[1]))
... | true |
e2ef135f9d02fc73d47d77767ad82cc2581b325c | Python | kromdeniz/Pong-Game | /ball.py | UTF-8 | 1,805 | 3.25 | 3 | [] | no_license | from turtle import Turtle
import random
FIELDWIDTH = 1100
FIELDHEIGHT = 650
BALLSPEED = 2
class Ball(Turtle):
def __init__(self):
super().__init__()
self.penup()
self.shape("circle")
self.color("white")
self.speed("slowest")
self.going_left = False
... | true |
6993691a9e1773574f28bea4634da25acca8c9af | Python | KayanSilva/ReservePython | /OOinPython2/treinando.py | UTF-8 | 258 | 2.65625 | 3 | [] | no_license | # Abstract base classes
from collections.abc import MutableSequence
from numbers import Complex
class Numero(Complex):
def __getitem__(self, item):
super().__getitem__(self, item)
class Playlist(MutableSequence):
pass
filmes = Playlist() | true |
45d247773d7a7b72cc32944eefb81825cb47acaf | Python | gabrielfrimodig/Python-2--Add-view | /main.py | UTF-8 | 2,536 | 3.1875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
@author: gabriel
"""
option_inloggad = {"a":"Add item", "l":"List items", "q":"Log out"}
option_retry = {"r":"Try again", "q":"Quit"}
def main():
users = {"nisse":"apa", "stina":"t-rex", "bosse":"ko"}
data = {"nisse":["luva", "vante"], "stina":[], "bosse":["gräs", "mjöl... | true |
0adfbd2c7af2bafe841fabde1155e0dbe80d5051 | Python | young2141/PS_Codes | /solved/kakao_friends4block.py | UTF-8 | 1,208 | 2.921875 | 3 | [] | no_license | # kakao_friends_4_block
def shift(m, n, w):
for j in range(n):
col = []
for i in range(m):
if w[i][j] != ' ':
col.append(w[i][j])
for i in range(m-len(col)):
col.insert(0, ' ')
for i in range(m):
w[i][j] = col[i]
def solution(m,... | true |
890a2ca74ed8931c63fa8eaa15fec633fabd0c07 | Python | DabenW/OBDDetect | /OBD_project-master/OBD_GUI/Calibration2.py | UTF-8 | 15,043 | 2.953125 | 3 | [] | no_license | from graphics import *
import time
import pymysql
import pymysql.cursors
from numpy import *
import math
def connectDB():
connection = pymysql.connect(host='localhost',
user='root',
password='obd1234',
db='DRIVINGDB... | true |
65e4483b138fd80b5071a78bb85451e8498b82c0 | Python | RaulGnzlzAlvrd/clase-python3 | /clase03/tarea03_Ej03.py | UTF-8 | 541 | 3.4375 | 3 | [] | no_license | def do_twice(f, v):
f(v)
f(v)
def do_four(f, v):
do_twice(f, v)
do_twice(f, v)
def draw_line(symbol, separator, times):
line = ((symbol + separator * 4) * times) + symbol
print(line)
def do_top(times):
draw_line('+', '-', times)
def do_body_part(times):
draw_line('|', ' ', times)
de... | true |
8fdeb380513da77ef10aeea2b6d1eb7664ba6f28 | Python | karstendick/project-euler | /euler049/euler049.py | UTF-8 | 1,133 | 3.15625 | 3 | [] | no_license | #PE #49
from itertools import combinations
def primes_less_than(N):
primes = [x for x in (2,3,5,7,11,13) if x < N]
if N<=17: return primes
candidates = [x for x in xrange((N-2)|1,15,-2)
if x%3 and x%5 and x%7 and x%11 and x%13]
top=int(N**0.5)
while(top+1)*(top+1) <= N:
... | true |
dc2bd19617faad07d6bfd1e88fb2b09092f18bcc | Python | jakkso/carSearch | /tests.py | UTF-8 | 7,199 | 2.515625 | 3 | [
"MIT"
] | permissive | from os import listdir, remove, path
import unittest
import classes
DATABASE = path.join(path.dirname(__file__), 'test.db')
DICT_FILE = path.join(path.dirname(__file__), 'test_dict.p')
URL = 'https://denver.craigslist.org/search/cta?format=rss&bundleDuplicates=1&' \
'searchNearby=1&min_auto_year=2015&max_auto_m... | true |
4ff33df199a1e2fcfd7613c261dfbd2572c3300d | Python | lion5411/algorithm_study | /Hash/HashExample2.py | UTF-8 | 360 | 3.5625 | 4 | [] | no_license | def solution(phone_book):
answer = True
phone_book.sort(reverse=True)
while answer and len(phone_book) > 0:
item = phone_book.pop()
for p in phone_book:
if p.startswith(item):
answer = False
break
return answer
phone_book = ["11", "1"]
answ... | true |
085b8794998e76d2d8b46ce0e607b555c12f7360 | Python | juanpablos/mal-scraper | /src/run_scraper.py | UTF-8 | 2,207 | 2.53125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import csv
import time
from mal_scraper import anime
def get_values(dictionary, key_arr):
w = []
for key in key_arr:
w.append(dictionary[key])
return w
results = 'results/remaining/'
debug = 'debug/'
num = '1'
anime_file = results + 'csv_anime_' + num + '.csv'
charact... | true |
739a89afe4e22c96d22956907376e08a63282ad1 | Python | sounaksinha1998/Convolutional-Neural-Network | /Image Classifier.py | UTF-8 | 3,031 | 2.5625 | 3 | [] | no_license | import numpy as np
import cv2
import random
import keras
from keras.models import Sequential
from keras.layers import Conv2D, MaxPooling2D, Flatten, Dense, Dropout, Activation
label = {"dog":np.array([1,0],np.float32),"cat":np.array([0,1],np.float32)}
n_classes = 2
def image_resize(path):
img = cv2.imread(path)
... | true |
9ae314456a8fb66b4384c5491aea6288e7003235 | Python | rodolfoksveiga/hacker_rank | /mutations.py | UTF-8 | 318 | 3.640625 | 4 | [] | no_license | def split(s):
return [char for char in s]
def mutate_string(string, position, character):
string = split(string)
string[position] = character
string = ''.join(string)
return string
if __name__ == '__main__':
s = input()
i, c = input().split()
s_new = mutate_string(s, int(i), c)
print(s_new)
| true |
f1aa23b0607b0eeba69f78ba2e200a1736cace10 | Python | Julialiuu/KEX | /regression/models/decision_tree.py | UTF-8 | 1,584 | 2.953125 | 3 | [] | no_license |
print(__doc__)
# Import the necessary modules and libraries
import numpy as np
from sklearn.tree import DecisionTreeRegressor
import matplotlib.pyplot as plt
import pandas as pd
from sklearn import datasets, linear_model
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import train_tes... | true |
4f1e7cb1155ab61f107ca67c539771d7296395e7 | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2752/60594/295565.py | UTF-8 | 875 | 2.625 | 3 | [] | no_license | def huilu(matrix,n,i,step,oc):
matrix[i]=0
quanwei0=True
for j in matrix:
if j!=0:
quanwei0=False
break
if quanwei0:
oc.append(step)
return
find=False
go=[1,-1,n,-n]
for j in go:
if matrix[i+j]!=0:
find=True
zc=m... | true |
b8178439f3a7e329c0ec98f199ec9f6ffcbb7951 | Python | frclasso/turma1_Python3_2018 | /cap10/exercicio_10_08.py | UTF-8 | 1,245 | 3.59375 | 4 | [] | no_license | #!/usr/bin/env python3
# -*-coding:utf-8 -*-
class Cliente:
def __init__(self, nome, telefone):
self.nome = nome
self.telefone = telefone
class Conta:
def __init__(self, clientes, numero, saldo=0):
self.saldo = 0
self.clientes = clientes
self.numero = numero
... | true |
2630f746b27f02c1c98873634ccd54811d4902fc | Python | mikanyman/var_django-legacy | /coref/dbxml/test2.py | UTF-8 | 1,180 | 3.578125 | 4 | [] | no_license | """
* helloWorld is the simplest possible Berkeley DB XML program
* that does something.
* This program demonstrates initialization, container creation,
* document insertion and document retrieval by name.
*
* To run the example:
* python helloWorld.py
"""
from dbxml import *
def helloWorld():
... | true |
ef12a0d78048c37710720939d057660951fabf7d | Python | HassanAbouelela/Advent-Of-Code | /utils.py | UTF-8 | 6,160 | 2.90625 | 3 | [
"MIT"
] | permissive | # -------------------------------------------------------------------------------
# MIT License
#
# Copyright (c) 2019 Scaleios
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restr... | true |