blob_id large_string | language large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|---|
fcb5bd699cb25fa8a147e10cbc0b67eeac3d521c | Python | hannahapuan/droste-effect | /DrosteEffect/CreateDroste2.py | UTF-8 | 940 | 2.921875 | 3 | [] | no_license | # Load the image
library(png)
library(RCurl)
d <- readPNG( getBinaryURL( "http://i.stack.imgur.com/rMR3C.png" ) )
image(d, col=gray(0:255/255))
# Origin for the polar coordinates
x0 <- ncol(d)/2
y0 <- nrow(d)/2
# The value of pixel (i,j) in the final image
# comes from the pixel, in the original image,
# with polar... | true |
b00569445a8adfad0e4ac593e1757f5e6a1788aa | Python | falafel72/project-drive-2020 | /vehicle_control/src/keyboard.py | UTF-8 | 1,277 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env python
import rospy
from project_drive_msgs.msg import CarParams # import the custom message
import curses
forward = 0;
left = 0;
if __name__ == '__main__':
stdscr = curses.initscr()
curses.cbreak()
stdscr.keypad(1)
rospy.init_node('keyboard_control', anonymous=True)
pub = rospy.Pu... | true |
6d8645cec17d4ba3492c5de9766fec1d09c9ad8e | Python | loretoparisi/BERT-tensorflow | /make_vocab.py | UTF-8 | 1,150 | 2.8125 | 3 | [] | no_license | f = open("data/next_sentence",encoding="utf-8",mode="r")
lines = f.readlines()
vocab_set = set()
def clean_word(word):
word = word.lower()
word = word.replace(".", "")
word = word.replace("\n","")
word = word.replace('"', '')
word = word.replace("#", "")
word = word.replace("&", "")
... | true |
f4cdc1a7591147c8ccc474e72f0c938b0f79459c | Python | RupanjanDas/pythontutorials | /color_circle_game.py | UTF-8 | 1,496 | 2.96875 | 3 | [] | no_license | from turtle import *
from random import shuffle
colors = ["green","blue","red","yellow","pink","orange","purple","brown"]
shuffle(colors)
pu()
goto(0,50)
def draw_circle (r):
nos = (2 * (22 / 7)) * r
ats = 360 / nos
for circle in range(nos):
fd(1)
rt(ats)
def setup():
goto(0,340)
col... | true |
62c0fa31032e662c83b36b6ed5fb18d7c3437ff2 | Python | fiso0/MxPython | /TCPClient/TCP_Client.py | UTF-8 | 1,217 | 3.265625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
# 2021-9-16实测TCP_Client.py:ok
"""
建立TCP client,然后新建2个线程分别用于接收和发送数据
"""
from socket import *
import threading
HOST = '139.196.252.69'
PORT = 333
BUF_SIZE = 2048
def create_socket(host, port):
"""
建立TCP client
:param host:
:param port:
:re... | true |
19f2ea68e59df0375e9ca99afde866d96708038e | Python | plewto/Llia | /llia/performance.py | UTF-8 | 10,162 | 2.6875 | 3 | [] | no_license | # llia.performance
# 2016.03.19
from __future__ import print_function
import json
from zlib import crc32
from llia.generic import is_performance, dump, clone, is_list, hash_
from llia.source_mapper import SourceMapper
from llia.ccmapper import CCMapper
class Performance(object):
'''
A Performance defines pa... | true |
a4935040a1dc140419031e4dcecc0ebfc4d45c3f | Python | mjvakili/ccppabc | /scripts/1D_Gaussian_with_unknown_variance/test_normal.py | UTF-8 | 1,646 | 2.65625 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
plt.switch_backend("Agg")
import seaborn as sns
import scipy.stats
import sys
sys.path.insert(0, '../../ccppabc/')
from pmc_abc import ABC
class ABC_class(object):
def __init__(self , ndata , mu , mean , sigma):
self.ndata = ndata
self.mu = mu ... | true |
9d9b3e9c63f41848790fe9256ce2ee5df3985f46 | Python | rembutquaglet/forum-sweats | /bot/commands/gulag.py | UTF-8 | 821 | 2.96875 | 3 | [
"MIT"
] | permissive | from ..betterbot import Time
from ..discordbot import mute_user
import time
import db
name = 'gulag'
async def run(message, length: Time = 60):
'Mutes you for one minute'
mute_remaining = int((await db.get_mute_end(message.author.id)) - time.time())
if mute_remaining > 0:
return await message.send('You are alr... | true |
54ae30bc45bbf9ed80ae2ebc643708badcbe277a | Python | tuobaye0711/hfPython | /tri.py | UTF-8 | 266 | 3.515625 | 4 | [] | no_license | def print_blank(number):
for n in range(number):
print(' ', end='')
start = 0
end = 65
while start <= end:
for num in range(end-start):
print('*', end='')
print()
print_blank(start+1)
start = start+1
end = end-1 | true |
fbe32d3858085070277dbf336378bc0fc6339ee2 | Python | anqi0428/AQ_InsightD_CodingChallenge-master | /insight_testsuite/tests/test-1-AQ/src/antif_1st_final_ver.py | UTF-8 | 2,901 | 3.296875 | 3 | [] | no_license |
'''
File_Name: antif_1st_final_ver.py
Created on 11/13/2016
@author: Qi An
Features:
This is designed to avoid fraud transactions in real life.
Import data from csv files and use these data to build a network.
Functions built are to justify whether there's 1st degree friendship between the users before they transfe... | true |
50dfaf01143a8f653f84b5c632cae143e0ebd106 | Python | ramankala/cp468-a1 | /puzzle.py | UTF-8 | 9,753 | 3.234375 | 3 | [] | no_license | import copy
import random
import numpy as np
import math
import collections
def goalState(size):
"""
depending on the size, the goal state is longer/shorter
"""
if size == 8:
goalState = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 0]
]
elif size == 15:
... | true |
6d5fef2667593443c8aa567f1d56932e64bc2049 | Python | Tigerinbkk/python | /list.py | UTF-8 | 361 | 3.15625 | 3 | [] | no_license | number = [1, 2, 3, 4, 5]
name = ['ประสพชัย', 'สิงห์น้อย']
mix = [10, 1.2, 'mee']
print(number[4])
print(name[1])
print("สมาชิกมีทั้งหมด ", len(number))
data = []
data.append(1)
data.append(2)
print(data)
data[1] = 12
print(data)
sum=0
for num in number:
sum += num
print(int (sum))
| true |
d3c5ce6fd500d2079004e22f1eab81330424f707 | Python | atdog/adbg | /adbg/commands/config.py | UTF-8 | 1,028 | 2.59375 | 3 | [] | no_license | import inspect
import sys
import adbg
import adbg.modules.config as GDBConfig
import adbg.modules.color as color
from adbg.commands import GDBCommand
def dump_config():
i = 0
for k in GDBConfig.member.keys():
scope = getattr(GDBConfig, k)
print(color.title(k))
for n in GDBConfig.member... | true |
b09cc66e8a0bcad0cd9493c83d99cbfe5f6dd971 | Python | angang0123/BQuant_Getting_Started | /BQL_Quick_Reference_Guide/Mathematical_Operators.py | UTF-8 | 1,028 | 3.859375 | 4 | [] | no_license | '''
Syntax
String Interface
get((field1-field2)) for (['ticker'])
Object Model
field1 = bq.data.field1
field2 = bq.data.field2
spread = field1 - field2
'''
#String Interface Example
# Import the BQL library
import bql
# Instantiate an object to interface with th BQL service
bq = bql.Service()
# Define the reques... | true |
f1c500f757916aa576c0652c9044db445b32fc1a | Python | verilogtester/pyalgo_love | /generateRandomNo.py | UTF-8 | 205 | 3.28125 | 3 | [] | no_license | # Random number generation between 1 to 50
import random
randintl = []
while (len(randintl)) != 50:
rnum = random.randint(1,50)
if rnum not in randintl:
randintl.append(rnum)
print (randintl)
| true |
1c2dafbab8a157ee16b09ebe75f04561b5b77289 | Python | sebst/async-helper | /src/async_helper/helper.py | UTF-8 | 2,328 | 2.984375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import asyncio
__all__ = ['first_sequential_result', 'first_parallel_result']
def first_sequential_result(functions, satisfied=lambda _: True):
"""
Runs a list of functions sequentially and returns
the result of the function which terminated first
with... | true |
c77983e493d886f601827b78d05d4ba2ec5c2079 | Python | DuyguIltuzer/python__app2 | /python2/app2.py | UTF-8 | 653 | 2.9375 | 3 | [] | no_license |
##import our libraries
from flask import Flask, render_template
#instantiating the app object
app2 = Flask(__name__)
pet_1 =[{
"Name": "Spotty",
"Breed": "Cat",
"Age" : 3,
"Type": "Sokoke"
}]
Pets = [ "Spotty", "Milton", "Ted"]
pet_list= [{
"Name": "Spotty",
"Breed": "Cat",
"Age" : 3,... | true |
c00850187e48f1d294f40812db3e2cf5dfec5fe5 | Python | manasawasthi272/TorrentWebsite | /backend/env/lib/python3.9/site-packages/requests_cache/backends/redis.py | UTF-8 | 3,552 | 2.734375 | 3 | [] | no_license | """
.. image::
../_static/redis.png
`Redis <https://redis.io>`_ is an in-memory data store with on-disk persistence. It offers a
high-performace cache that scales exceptionally well, making it an ideal choice for larger
applications.
Persistence
^^^^^^^^^^^
Redis operates on data in memory, and by default also pe... | true |
ce660589dd46c384da65a490b9b61b9d5f4dce54 | Python | rkumarmore/nn-web-app | /Regression.py | UTF-8 | 937 | 2.828125 | 3 | [] | no_license | import pandas as pd
import numpy as np
import seaborn as sns
from sklearn.model_selection import train_test_split
import tensorflow
class Regression:
def __init__(self):
self.model = tensorflow.keras.models.Sequential()
self.model.add(tensorflow.keras.layers.BatchNormalization(input_shape=(11,)))
... | true |
179b5c924bafc5c6ca2208e0234dde4d675ff8ac | Python | njsgaynor/AutoHEC | /src/SplitBasins/hecElements/BasinSchema_class.py | UTF-8 | 386 | 2.625 | 3 | [] | no_license | from Element_class import Element
class BasinSchema(Element):
def __init__(self):
super(BasinSchema, self).__init__('Basin Schematic Properties', None)
@classmethod
def readBasinSchema(cls, currentLine, basinsrc, basinsink):
b = BasinSchema()
super(BasinSchema, b).deserialize(curre... | true |
a9ccf3d1cea490324c79c8b192003ea59929350d | Python | ppasupat/plastic-case | /yournamehere/data/demo.py | UTF-8 | 6,493 | 2.765625 | 3 | [
"LicenseRef-scancode-unknown",
"Unlicense"
] | permissive | from __future__ import (absolute_import, division, print_function)
from collections import Counter
import numpy as np
from yournamehere.data.base import Dataset
from yournamehere.utils import batch_iter, PAD, UNK, UNK_INDEX, BOS, EOS
class DemoExample(object):
"""
A simple text classification example.
"... | true |
cacc6dc2d92fe08700082468732d243c345ecf3e | Python | tushar2708/eBookReader | /Summarize.py | UTF-8 | 10,844 | 3.328125 | 3 | [] | no_license | # coding=UTF-8
from __future__ import division
import re
import sys
import difflib
import collections
# This is a naive text summarization algorithm
# Created by Shlomi Babluki
# April, 2013
class SummaryTool(object):
# Naive method for splitting a text into sentences
def split_content_to_sentences_on_newlin... | true |
656728206f1117a87fdc45c1d81246718df1c26a | Python | flip-in/CS6.00 | /array test | UTF-8 | 306 | 3.21875 | 3 | [] | no_license | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 18 14:32:57 2017
@author: apple
"""
import pylab
x = [1,2,3]
y = [4,5,6]
x1 = pylab.array(x)
y1 = pylab.array(y)
try:
print x*y1
except TypeError:
print "can't multiply %s and %s" %(type(x),type(y))
print 2*y1
print x1*y1
| true |
824133f3c60199ba34ffd420620380f2381c9fef | Python | mmoth-kurtis/MMotH-Vent | /source_code/dependencies/cell_ion_module/three_state_calcium.py | UTF-8 | 1,461 | 2.921875 | 3 | [] | no_license | import numpy as np
## Uses the calcium transient from the three state paper
def init(params):
model_class = three_state_ca(params)
return model_class
class three_state_ca():
def __init__(self,params):
# Hard coding, have established this transient
# these could be set in params if need... | true |
e3c6e1cc09eea07b2c34136648976dbf1eacabf9 | Python | juzhong180236/NewPython | /APP_utils/Algorithm/Bayesian Filter/Unscented_Kalman_filter.py | UTF-8 | 865 | 3.40625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
"""
很多变量,很多行向量,很多列向量
plus +
minus -
hat
"""
# 生成100个信号
# 时间序列
time = np.arange(0.01, 1, 0.01)
time = np.insert(time, len(time), 1)
length = len(time)
# 真实值x和观测值z
x = np.zeros(shape=(2, length))
z = np.zeros(shape=(2, length))
x[0, 0] = 0.2
x[1, 0] = 0.2
# 非线性的预测方程... | true |
7d7575fbe5dd57952f1b67ec376967fbdaa0e2c9 | Python | Brightdan100/python-codes | /SQL.py | UTF-8 | 4,630 | 2.65625 | 3 | [] | no_license | import mysql.connector
'''mydb = mysql.connector.connect(
host="localhost",
user="",
passwd="",
database="protonMail"
)
myCursor = mydb.cursor()
myCursor.execute("SELECT BlobStorageID FROM BlobStorage")
myResult = myCursor.fetchall()
myCursor.execute("SELECT NumReferences FROM BlobStorage")
myResult2 = myCur... | true |
7df3e9b5fc04b86f1dd6d57f420999af7f3bdc31 | Python | bohanxyz/fsdl-project | /tools/randgen.py | UTF-8 | 4,426 | 2.703125 | 3 | [] | no_license | import random
from collections import namedtuple
from itertools import chain
import csv
#
# Random query generator
#
# Input
# a set of relations
# a set of FK constraints
FK = namedtuple('FK', 'rel, k1, k2')
relation_joins = {
'customer': [
FK(rel='nation', k1='c_nationkey', k2='n_nationkey'),
],
'lin... | true |
14f5732f84d648472a6311d804743215565db015 | Python | nsbgit/IIT-S21-CS-484 | /Old Materials/Additional Github/vigneshkrv/CS-584-Machine-Learning/ML/assign 4/Assignment-4-Q1.py | UTF-8 | 8,645 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[39]:
import pandas as pd
import numpy as np
import sympy
import scipy
import sklearn.metrics as metrics
import statsmodels.api as sm
data = pd.read_csv('Purchase_Likelihood.csv')
# In[40]:
data.head()
# In[41]:
def create_interaction (inDF1, inDF2):
name1 = inD... | true |
f7fa2502dade0e4fa61ede7e756991855a386a1d | Python | ShivaBansfore-JGEC/DataStructureAndAlgo-Python | /recursion/shuffle.py | UTF-8 | 463 | 3.109375 | 3 | [] | no_license | import sys
sys.stdout = open('recursion/output.txt', 'w')
sys.stdin = open('recursion/input.txt', 'r')
li=0
def suffle(arr,si,n,ans):
global li
if si==n:
return ans
suffle(arr,si+1,n,ans)
if li<si:
ans.append(arr[si])
ans.append(arr[(n//2)-li-1])
li+=1
return ans... | true |
a00ac644a3e0491c86f9af390d55d1ae38c3684a | Python | pinnurisatish/Sentiment-Analysis | /Stimulus_Check_SentimentAnalysis.py | UTF-8 | 9,759 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import pandas as pd
import GetOldTweets3 as got
from nltk.tokenize import TweetTokenizer
import nltk
from nltk.corpus import stopwords
import re, string
from wordcloud import WordCloud, STOPWORDS
import matplotlib.pyplot as plt
import re # importing regex
import strin... | true |
6b8cf926510d6cb66c41e7f033c138f13f84c190 | Python | Wenhaocui/EE559_HW | /HW5/hw5.py | UTF-8 | 2,954 | 2.640625 | 3 | [] | no_license | import numpy as np
import math
import random
import plotDecBoundaries4
training1 = np.loadtxt('synthetic1_train.csv',delimiter =',')
training2 = np.loadtxt('synthetic2_train.csv',delimiter =',')
training3_t = np.loadtxt('feature_train.csv',delimiter =',')
training3_l = np.loadtxt('label_train.csv',delimiter =',')
X... | true |
749015973ec210e33a1897460d0955de2ad8c278 | Python | soqutto/homography | /findHomographyGUI.py | UTF-8 | 51,796 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
findHomographyGUI.py
detect keypoints and their matches and homography transform in Qt GUI
based on getparseGUI.py
"""
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import numpy as np
import cv2
from module_core.Image import *
from module_core.Matcher import *... | true |
f8fb5d45010e072a39f48942768e58812c369d4e | Python | schirrecker/Codewars | /ListSquared.py | UTF-8 | 540 | 3.65625 | 4 | [] | no_license | import math
def squared_divisors(n):
sum = 0
for i in range(1, int(n/2)+1):
if n % i == 0:
sum += i*i
sum += n*n
return sum
def is_square(integer):
root = math.sqrt(integer)
if int(root + 0.5) ** 2 == integer:
return True
else:
return False... | true |
400eb39899e5bfa643fe5164e4aad70dde196ca5 | Python | marcosptf/fedora | /python/flask-ipdb/manage.py | UTF-8 | 534 | 2.8125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
sistema de pontos
Esta aplicacao exemplo Flask, eh um simulador de sistema de espera.
Flask and sqlite3.
"""
from flask import Flask
app = Flask(__name__)
def funcao_um():
return "funcao um "
def funcao_dois():
return 'funcao dois'
@app.route('/')
def index():
i... | true |
ff7eb6546756a03a009c0cf60438476851d6c993 | Python | shashankmalik/Python_Learning | /Week_2/Defining_Functions.py | UTF-8 | 107 | 3.25 | 3 | [] | no_license | def print_seconds(hours, minutes, seconds):
print(hours*3600+minutes*60+seconds)
print_seconds(1,2,3)
| true |
fa7b12ddb2a7a24780bad88a0cefd75b377b5780 | Python | menghaoshen/python | /07.元组字典的使用/02.字典的使用.py | UTF-8 | 685 | 3.78125 | 4 | [] | no_license | #列表可以存储任意数据类型,但是一般情况下,我们都存储单一的数据
#列表只能存储值,但是无法对值进行描述
names = ['zhangsan','lisi','wangwu']
scores = [100,98,99,97]
#字典不仅可以保存值,还可以对值进行描述
# 使用大括号来表示一个字典,不仅有值value ,还有值的描述key
#字典里面的数据都是以键值对key-value的形式保存的
#key和value之间使用冒号,来链接
#多个键值对之间使用逗号分割,
person = {'name':'zhangsan',
'age':18,
'math':98,
... | true |
54ecfc5c998e216b89108eedfe6c8ec9c4288e76 | Python | LMascher/mitel-scrape | /scraper.py | UTF-8 | 830 | 2.53125 | 3 | [] | no_license | from requests_html import HTMLSession
from bs4 import BeautifulSoup
import csv
session = HTMLSession()
r = session.get("https://www.mitel.com/find-a-partner?loc=04330&dist=300")
r.html.render(wait=3.0, keep_page=True)
soup = BeautifulSoup(r.html.find("#mitel-results-section")[0].raw_html, "html.parser")
details ... | true |
e029414dc19d93bda271c381f1fc0fddac1f53c3 | Python | cognosphere/intro-to-python | /Class 8 - While and for loops/while_loops.py | UTF-8 | 1,980 | 4.1875 | 4 | [] | no_license | #Note: This code is not meant to be run altogether, as it is a teaching tool during our live classes. These are a series of programs taught invidually throughout a lesson. Feel free to still run the programs, though. Sign up for classes at our website, www.cognosphere.tech
active = True
#must define above
while(acti... | true |
3eb35bdb0ee2418cf7bdfdc6970ddbaf05137a1b | Python | berkcangumusisik/CourseBuddiesPython101 | /Pratik Problemler/12 - Dictionaries Seviye2/08 - wordCountTracker.py | UTF-8 | 375 | 3.515625 | 4 | [] | no_license | """Kelime Sayımı İzleyici
Bir metin dizesi verildiğinde, dizede count her kelimenin kaç kez göründüğünü izleyen bir sözlük döndürün.
"""
def word_count(text):
my_string = text.split()
count = {}
for item in my_string:
if item in count:
count[item] += 1
else:
count[i... | true |
ea5fc2bc6d0a15148028d6b270a6051696bb8fb3 | Python | arpankotecha/superlists | /functional_tests/test_layout_and_styling.py | UTF-8 | 796 | 2.65625 | 3 | [] | no_license | from .base import FunctionalTest
class LayoutAndStylingTest(FunctionalTest):
def test_layout_and_styling(self):
# Edith goes to the homepage
self.browser.get(self.server_url)
self.browser.set_window_size(1024, 768)
# She notices that the input box is nicely centered
inputbox = self.browser.find_... | true |
90bbee36089d950df3ca2d578469cfbcf64d4f67 | Python | HIT-jixiyang/offer | /网易1.py | UTF-8 | 747 | 2.90625 | 3 | [] | no_license |
def gcd(num):
gcdl = []
for i in range(1, sorted(num)[0] + 1):
for index, j in enumerate(num):
if j % i == 0:
if (index + 1) == len(num):
gcdl.append(i)
break
continue
else:
break
if not ... | true |
8d0743f0262547916ba9bfeff5d58ea22bc80e87 | Python | LudvikGalois/patrick-stewart | /features/steps/square.py | UTF-8 | 856 | 3.515625 | 4 | [] | no_license | from behave import *
from othello import Square, Piece, OccupiedSquare
@given("a square")
def step_impl(context):
context.square = Square()
context.was_occupied = False
@when("I put a piece into it")
def step_impl(context):
try:
context.piece = Piece()
context.square.place(context.piece)... | true |
ae3301a3a5a7deca6674c53852618349af40b14f | Python | Marm00taa/Treco | /LISTA 3/EXERC_E_(Equação 2 grau).py | UTF-8 | 389 | 3.75 | 4 | [] | no_license | import math
a=0;b=0;c=0
a=float(input('Digite o valor de A:'))
b=float(input('Digite o valor de B:'))
c=float(input('Digite o valor de C:'))
delta= (b**2) - 4*a*c
if(a==0):
print('O valor de A deve ser diferente de 0')
elif delta<0:
print('Sem raizes reais')
else:
x1= (-b+math.sqrt(delta)) / 2*a
x2= (... | true |
5d1da416566dfecc79c97337ff2521736662f699 | Python | DamanTakhar/ICS2O0A | /Modules B - Programming Skills/Python Worksheets/Worksheet-II-answers/Worksheet-II-answers/wk-II-part-III- q1e.py | UTF-8 | 497 | 2.765625 | 3 | [] | no_license | import turtle
myPen = turtle.Pen()
myPen.forward(100)
myPen.left(140)
myPen.forward(100)
myPen.right(80)
myPen.forward(100)
myPen.left(140)
myPen.forward(100)
myPen.right(80)
myPen.forward(100)
myPen.left(140)
myPen.forward(100)
myPen.right(80)
myPen.forward(100)
myPen.left(140)
myPen.forward(10... | true |
d3d7dcf590cf8ced9fe8759cb0f161be2fc32f96 | Python | mike03052000/python | /Training/2014-0110-training/Exercises_python/Solutions/class_static_method.py | UTF-8 | 678 | 4.0625 | 4 | [
"MIT"
] | permissive | import time
class TestClass(object):
"""A class that tests (1) a class variable, (2) a class method,
and (3) a static method.
"""
class_description = "A test for class methods and static methods"
@classmethod
def show_description(cls):
print('description: %s' % cls.class_description)
... | true |
2c5bba9fceaa43987935462df3bb79967060ae40 | Python | pooja-naik21/emory-covid19 | /build/data/rawdata/preprocess_misc.py | UTF-8 | 684 | 2.625 | 3 | [] | no_license | import csv
import json
import pandas as pd
import numpy as np
from pprint import pprint
from collections import defaultdict, Counter
from dateutil.parser import *
def fips2county(fn="all-geocodes-v2017.csv"):
fips2county = {}
with open(fn, "r", encoding='latin-1') as fp:
reader = csv.reader(fp)
... | true |
3eb18b689d1361806f70e91d4450ebb934bce3d1 | Python | chimnanishankar4/Logic-Building | /Day-10/13.py | UTF-8 | 154 | 3.453125 | 3 | [] | no_license | #13.Write a NumPy program to generate a random number between 0 and 1.
import numpy as np
array_a=np.random.normal(0,1,1)
print("Random number:",array_a)
| true |
026d0dbe120fba4641f96d98218a8fbe0e885e86 | Python | PandaGuy58/DataBases-and-SQL | /MainFile.py.py | UTF-8 | 3,895 | 3.390625 | 3 | [] | no_license | import sqlite3
def create_table("coffee_shop.db",table_name,sql):
with sqlite3.connect(db_name) as db:
cursor = db.cursor()
cursor.execute("select name from sqlite_master where name=?",(table_name,))
result = cursor.fetchall()
keep_table = True
if len(result) == 1:
... | true |
2ed7e53976cb53e828d8c784ce347a8a3f3e1753 | Python | junkwhinger/book_deep_learning_from_scratch | /chapter_3/activation_function.py | UTF-8 | 374 | 3.578125 | 4 | [] | no_license | # Chapter 3. Neural Network
## 3.2
import numpy as np
import matplotlib.pylab as plt
def step_function(x):
y = x > 0
return y.astype(np.int)
def sigmoid(x):
y = 1 / (1 + np.exp(-x))
return y
def relu(x):
return np.maximum(0, x)
def display(x, func):
y = func(x)
plt.plot(x, y)
# plt.ylim(-0.1, 1.1)
plt.sh... | true |
3020d630f7021daee1385abb428491bf9b4fbb32 | Python | aenfield/SilentVictory | /patrol_test.py | UTF-8 | 1,249 | 3.078125 | 3 | [] | no_license | # KEEP until I remember: to run all tests in the dir: 'nosetests' (after installing nose w/ conda install nose)
import unittest
import patrol
import encounter
a_port_and_date = 'Pearl Harbor - 1941'
class PatrolAssignment(unittest.TestCase):
def test_can_get_list_of_ports_and_dates(self):
p = patrol.Pa... | true |
4d22abc775b67f265b07bcbcb1f8ad830b9184bb | Python | lilachtech/lilachtech | /cheating.py | UTF-8 | 7,550 | 2.796875 | 3 | [] | no_license | import random
import csv
import pandas as pd
# Empty lists
trail_num_list, trails_total_payoff, trails_adding_points, trails_omitted_points, trails_type, conditions_list,\
trails_type_list, enforcement_list, player_choice_list, p_inspection_list, fine_size_list, \
true_side_list, block_num_list, game_num_list = ([] fo... | true |
997c3b111060e12cb6ca9338006eff4fb4b6f0c9 | Python | rux616/os-fuse-project | /MyFuse.py | UTF-8 | 13,315 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
#-*- coding: utf-8 -*-
# encode/decode w/ utf-8: full-range of unicode chars, w/o addressing endian issues
import errno # makes available errno system calls
import stat # constants/functions for interpreting results of os.stat()
import os # needed for os interfaces
import ... | true |
1cb716ba20840086a78312c75845ca2aa0ef9377 | Python | SJeliazkova/SoftUni | /Programming-Basic-Python/Exercises-and-Labs/Conditional_statements_advanced_ex/06.Journey.py | UTF-8 | 949 | 3.6875 | 4 | [] | no_license | budget = float(input())
season = input()
destination = ""
type_of_journey = ""
sum = 0
#1 определяне на дестинацията спрямо бюджета
#2 определяне на типа почивка спрямо сезона
#3 определяне на бюджета според сезона
if budget <= 100:
destination = "Bulgaria"
if season == "summer":
type_of_journey = "C... | true |
6a14d36918407dac38604a0735615c1a2ebd99d5 | Python | javokhirbek1999/CodeSignal | /Arcade/Intro/Island-Of-Knowledge/boxBlur.py | UTF-8 | 883 | 3.421875 | 3 | [] | no_license | def boxBlur(image):
def square_matrix(square):
total_sum = 0
for i in range(3):
for j in range(3):
total_sum += square[i][j]
return total_sum//9
square = []
square_row = []
blur_row = []
blur_img = []
n_rows = len(image)
... | true |
f9700932a0b1a822eb09a0be9749bf7cbe85df82 | Python | ok5168/baomijiancha | /bmjc1-2019-12.py | UTF-8 | 2,041 | 3.125 | 3 | [] | no_license |
'''
保密检查文件批量修改程序
要需要修改的文件统一放到一个目录里
要改三个地方的日期和日间
2019-11-19 v1.3
2019-09-12 v1.2
目录名自动改/,文件名中的时间和文本内时间也同步
2018-11-21 V1.1
更新:时间随机生成
'''
import re
import os, sys
import random
#每次执行,改下面两个变量就可以
#文件所在目录,这里使用win目,最后不加/
# path=r"Z:/各科室及个人/电教室/信息化相关工作/保密相关/2018-11"
path=r"6/" #要替换的目录 手工改
riqi='2018-06-12' #要替换成的日... | true |
212b239f94a8d8a41c0868bbae08bac707d776c0 | Python | ptro-development/trader | /trader/libs/utils.py | UTF-8 | 6,496 | 3.125 | 3 | [
"MIT"
] | permissive | import time
import random
from scipy.spatial import distance
def portions(x, y):
return x, float(x)/(x+y), y, float(y)/(x+y)
def get_window_size(data_size, percentage=0.10):
""" To get size of window based on required percentage. """
result = None
part = data_size * percentage
if part < 1:
... | true |
2919e7c861ad5ae30f0b3b932ac2502a9626d1e6 | Python | AhsanulIslam/Python-For-Everyone-Exercise | /4point6.py | UTF-8 | 226 | 3.28125 | 3 | [] | no_license | def computepay(h,r):
h = float(h)
r = float(r)
if h>40:
p = 40*r + ((h-40)*1.5*r)
return p
hrs = input("Enter Hours:")
rate = input("Enter rate per hour:")
p = computepay(hrs,rate)
print("Pay",p)
| true |
c36f1b5f823a0a5c757cc7e4fb38f5345631eeb6 | Python | ixime/antares3 | /madmex/overlay/extractions.py | UTF-8 | 3,964 | 2.921875 | 3 | [] | no_license | '''
Created on Jan 31, 2018
@author: agutierrez
'''
from importlib import import_module
import logging
from collections import OrderedDict
import gc
import numpy as np
import xarray as xr
from madmex.overlay.conversions import rasterize_xarray
from madmex.util import chunk
logger = logging.getLogger(__name__)
def ... | true |
b71311aff1bbef00a2d272eb5324bf6c0a420acf | Python | Aasthaengg/IBMdataset | /Python_codes/p02918/s344474678.py | UTF-8 | 189 | 2.84375 | 3 | [] | no_license | n, k = map(int, input().split())
s = input()
cnt = 0
prev = ''
for i in range(len(s)):
if s[i] == prev:
cnt += 1
else:
prev = s[i]
print(min(cnt + 2 * k, n - 1))
| true |
122a3c4c27d28f444fb81cb0e487428f5047a442 | Python | nulinspiratie/Qcodes | /qcodes/tests/test_combined_par.py | UTF-8 | 5,602 | 2.515625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | from collections import OrderedDict
import unittest
from unittest.mock import patch
from unittest.mock import call
from hypothesis import given
import hypothesis.strategies as hst
import numpy as np
from qcodes.instrument.parameter import combine
from qcodes.utils.metadata import Metadatable
from qcodes.utils.helpe... | true |
146179ecacb51591054664042108eea61c443752 | Python | chriseskow/lll | /lll/tokenizer.py | UTF-8 | 1,891 | 3.265625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | from collections import namedtuple
from re import compile, sub
# TODO: move elsewhere?
class Source:
def __init__(self, filename, code):
self.filename = filename
self.code = code
Token = namedtuple('Token', ('type', 'value'))
class Tokenizer:
REGEXES = [
('SPACE', compile(r'\s+|;.*'... | true |
5643498a8adadffa1b9eaf3d7005155ba688a1cd | Python | Taoge123/OptimizedLeetcode | /LeetcodeNew/Tree/LC_094_Binary_Tree_Inorder_Traversal.py | UTF-8 | 2,327 | 4.28125 | 4 | [] | no_license | """
Given a binary tree, return the inorder traversal of its nodes' values.
Example:
Input: [1,null,2,3]
1
\
2
/
3
Output: [1,3,2]
Follow up: Recursive solution is trivial, could you do it iteratively?
Usually when we do DFS, we pop a node from stack and push back its left
and right child. But ... | true |
165a00df72f400349a334e3e259d6f3e8b2fc964 | Python | melvinkcx/graphql-utilities | /graphql_utilities/decorators.py | UTF-8 | 1,247 | 3 | 3 | [
"MIT",
"BSD-3-Clause"
] | permissive | def run_only_once(resolve_func):
"""
Make sure middleware is run only once,
this is done by setting a flag in the `context` of `ResolverInfo`
Example:
class AuthenticationMiddleware:
@run_only_once
def resolve(self, next, root, info, *args, **kwargs):
pas... | true |
14d82c0c017024272e5bcf0a736349604beabf5c | Python | studioph/midi-nn | /integrate.py | UTF-8 | 2,826 | 2.5625 | 3 | [] | no_license | from note_seq import midi_file_to_note_sequence, sequence_proto_to_midi_file
import torch, os
from midi_nn import utils
import numpy as np
from note_seq.protobuf.music_pb2 import NoteSequence
"""
Functions to run one or more MIDI files through the LSTM model and integrate the output for playback
"""
def integrate_out... | true |
5128788c30108574059af430af4ebc844d60e2ab | Python | deimelperez/HackerRank | /Problem Solving/October circuit.py | UTF-8 | 565 | 2.734375 | 3 | [] | no_license | # n = input()
# s = input()
# x = set(s)
# count = []
# for c in x:
# count.append(s.count(c))
# print(max(count))
import numpy as np
zeros = np.zeros(1000001, dtype=int)
n = int(input())
for _ in range(n):
l = list(map(int, input().rstrip().split()))
if l[0] >= 1:
r, ranges = l[0], l[1:]
... | true |
a5fdcbe614c23261424d8fd19735b7f55adbc70c | Python | ryu19-1/atcoder_python | /asakatsu/20210119.py | UTF-8 | 423 | 2.921875 | 3 | [] | no_license | T1, T2 = map(int, input().split())
A1, A2 = map(int, input().split())
B1, B2 = map(int, input().split())
C1 = A1 - B1
C2 = A2 - B2
if C1 < 0:
C1 = -C1
C2 = -C2
if T1 * C1 + T2 * C2 == 0:
print('infinity')
elif T1 * C1 + T2 * C2 > 0:
print(0)
else:
diff = abs(T2 * C2 + T1 * C1)
res = abs(T1 * C1... | true |
f0fe885a2d0c7ac68e5b8f17bc51d45f4ed07ff2 | Python | v0vK/cpp_lab1 | /Lab1__15.py | UTF-8 | 240 | 3.375 | 3 | [] | no_license | import re
while (True):
try:
x = str(raw_input(u"Введите предложение:\n"))
except:
print u"Ошибка!\n"
else:
break
result = re.findall(r'[A-Z][A-Za-z]*\d\d\b', x)
print result
| true |
57144acfc7040602da9e6499dcf5825528f4e602 | Python | ekiuled/pairwise-similarities | /helpers/similarity_generator.py | UTF-8 | 4,394 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | from similarities.lcs import LCSSimilarity
from similarities.cos import COSSimilarity
from similarities.lev import LEVSimilarity
from similarities.lsh import LSHSimilarity
from similarities.wmd import WMDSimilarity
from similarities.wmdk import WMDKSimilarity
from similarities.siam import SiameseSimilarity
from similar... | true |
3603ea2e55247bda69af5dba82ced28271f3c777 | Python | mbirkegaard/supreme-rotary-phone | /graphql_api/__init__.py | UTF-8 | 2,526 | 2.609375 | 3 | [] | no_license | import graphene
from document_manager import DocumentManager
# from spacy.tokens import doc
# from spacy.tokens import span
# from spacy.tokens import token
class Token(graphene.ObjectType):
orth = graphene.String()
@graphene.resolve_only_args
def resolve_orth(self):
return self.orth_
class Spa... | true |
90572f2ca6f919a73ce4325a4fe9a3cfb503f341 | Python | xrvvvvm/Owlgram | /Mouse.py | UTF-8 | 9,662 | 3.296875 | 3 | [] | no_license | from Observer import Observer
import Decorator
import GameController
from Owl import Owl
class Mouse(Observer):
def __init__(self, name, age, avatar, password):
self.name = name
self.age = age
self.avatar = avatar
self.password = password
self.subscriptions = []
se... | true |
3bcaf741f95a31857f326b581141a5d48a0bb5f3 | Python | PlaybackSwede/advent-of-code-2020 | /day2/password_policy.py | UTF-8 | 340 | 3.125 | 3 | [] | no_license |
file = open('input.txt', 'r')
lines = file.readlines()
range_count_pairs = [
[int(arr[0].split('-')[0]),
int(arr[0].split('-')[1]),
arr[2].count(arr[1][0])]
for arr in [line.strip().split(' ') for line in lines]
]
print(sum(count <= ub and count >= lb for [lb,ub,count] in... | true |
44be6fb20367d056bd3c34cea580c07ec2e39c75 | Python | metamaden/recountmethylation_flexible-blood-analysis_manuscript | /methods/analysis-sexdmp_make-fh10k-table.py | UTF-8 | 4,108 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python3
"""
Authors: Sean Maden, Abhinav Nellore
Get hashed features from some tabular data.
"""
import mmh3
import numpy as np
import pandas as pd
import hnswlib, sys, os, re, pickle, random
from time import time
import faulthandler
faulthandler.enable()
def feature_hash(arr, target_dim=10000):
... | true |
f12e0ba17d9ad76e3025c291fc32bc2e944ea729 | Python | mydevgh/KeystrokeAttack | /online_profiling/cdf_draw.py | UTF-8 | 1,102 | 2.8125 | 3 | [] | no_license | import pandas as pd
from matplotlib import pyplot as plt
def plotCdf(data, labels, outfile="out.png"):
fig, ax = plt.subplots()
plt.xlabel("Number of guesses");
plt.ylabel("CDF");
#plt.xlim(-3000,3000);
ax.set_ylim(0, 1.05);
ax.set_xlim(1, 100000000000000);
for i in range(len(data)):
results = list... | true |
cd375bcb21209f0a7938fa3fbf2d5c66b6ff3874 | Python | rephamarchio/classificadorDeImagens | /filtering.py | UTF-8 | 1,161 | 2.96875 | 3 | [
"MIT"
] | permissive | import cv2
import numpy as np
import math
from matplotlib import pyplot as plt
img = cv2.imread('f1.jpg',0) #colocar caminho
fourier = np.fft.fft2(img)
fourier_shifted = np.fft.fftshift(fourier)
magnitude_spectrum = 20*np.log(np.abs(fourier_shifted))
#Contruindo Filtro Gaussiano
h,w = fourier_shifted.shape[0:2]
... | true |
4c4d100db8fc65f6ed34b64e3e78db5b7122f549 | Python | DUcepticons/Bangla-Handwriting | /Approach 2 - Letter 11 classes and Quality 4 classes/CNN(Riad) - letter.py | UTF-8 | 3,317 | 2.78125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 11 22:59:36 2020
@author: Riad
"""
import cv2
import os
import numpy as np
from random import shuffle
from tqdm import tqdm
import tensorflow as tf
from tensorflow.keras import layers,Sequential,optimizers
'''Setting up the env'''
TRAIN_DIR = 'D:\Github Projects\... | true |
ec0714b0bd2991cc23ca54808ef907fee5bba7e7 | Python | vinus322/Algorithm-study | /Bae/bitmask/GRADUATION.py | UTF-8 | 3,012 | 2.796875 | 3 | [] | no_license | import sys
from typing import List
sys.stdin = open('resource/input.in', 'r')
sys.stdout = open('resource/output.out', 'w')
# C : test case (<= 50)
# N : 전공 과목의 수 (1 <= N <= 12)
# K : 들어야 할 과목 수 (0 <= K <= N)
# M : 학기의 수 (1 <= M <= 10)
# L : 한 학기에 최대로 들을 수 있는 과목 수 (1 <= L <= 10)
def cntBit(n):
return n % 2 + cn... | true |
e57104043b038d6a9b801049593317d70144afa1 | Python | npmcdn-to-unpkg-bot/uav_simulation | /UseCaseInterface/World.py | UTF-8 | 3,808 | 2.859375 | 3 | [] | no_license | from simulation_core.agent_uav import Uav
from simulation_core.agent_obstacle import StaticObject, ChargingStation, Wind
import logging
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
'Class for sharing objects between Use Case and Core'
class World:
'Needs an Simulat... | true |
d3c9140471438d754e014d314b63a3d84e0685d9 | Python | SpiggieCode/AngryDogs | /main.py | UTF-8 | 9,642 | 2.96875 | 3 | [] | no_license | import pygame
import math
import time
from random import randint
pygame.init()
pygame.mixer.init()
# Resolution
width, height = 1080, 720
screen = pygame.display.set_mode((width, height))
background = pygame.image.load('assets/background/city-over-water-at-sunset-background.jpg').convert()
level_song = ... | true |
e2820aa1d6e045af0e00572050d2db42bfbb6425 | Python | b-it-bots/mas_common_robotics | /mcr_controllers/mcr_twist_limiter/ros/src/mcr_twist_limiter_ros/simulated_twist_gui.py | UTF-8 | 2,045 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
"""
This module contains a component that publishes a simulated
twist.
"""
#-*- encoding: utf-8 -*-
__author__ = 'jsanch'
import rospy
import geometry_msgs.msg
import Tkinter
RESOLUTION = 0.005 # in meters
MAX_VELOCITY = 0.2 # in meters/second
MIN_VELOCITY = -0.2 # in meters/second
twi... | true |
39f606bc99b1cc37359eb6b3439e82f5b6f7595f | Python | sabbirDIU-222/Learb-Python-with-Sabbu | /Map Function.py | UTF-8 | 1,562 | 4.125 | 4 | [] | no_license | '''
The map() function executes a specified function for each item in an iterable
The item is sent to the function as a parameter
i learn that things in also filter function
so filter function do the same things
map( function , iterable )
map takes two perametre and a function ... | true |
26a227f94d2737523d692eac15e96df124ad483b | Python | ruoyunruyan/selenium | /selenium基本操作/13鼠标拖拽.py | UTF-8 | 1,166 | 3 | 3 | [
"MIT"
] | permissive | # Time: 2019/9/25 15:03
# Author jzh
# File 13鼠标拖拽.py
import time
import numpy
import random
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
driver = webdriver.Chrome()
driver.get(r'E:\PyCharmProject\测试selenium\source\drag.html')
action = ActionChai... | true |
45be53940c5c55e73d559517bf91146d09df65ce | Python | telescopeuser/AI_playground | /src/text/bag_of_words/okapi_bm25_search.py | UTF-8 | 2,621 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | import numpy
import pandas
import scipy.sparse
class OkapiBM25Searcher:
def __init__(self,
tf_matrix: scipy.sparse.csr_matrix,
idf_vector: numpy.array):
self.tf_matrix = tf_matrix
self.idf_vector = idf_vector
document_lengths = self.tf_matrix.sum(axis=1)
... | true |
c8502beb1a9b255c6423b3c50a0f92bb41691ae9 | Python | lv-zheng/acm_2016summer | /20160728/hfuck.py | UTF-8 | 358 | 2.96875 | 3 | [] | no_license | import random
T = 100
print T
def pa():
N = random.randint(2, 5)
M = random.randint(N, 30)
K = random.randint(0, M - 1)
r = range(2, M)
random.shuffle(r)
r = r[:K]
r.sort()
print N, M
print K,
for i in r:
print i,
print
for i in range(N):
for j in range(M):
print float(random.randint(0, 10)) / ... | true |
048e22205ae26acc072b0589b1db63aed95fb17b | Python | AndrewDMackay/py_karaoke_bar_g27 | /tests/song_test.py | UTF-8 | 703 | 3.265625 | 3 | [] | no_license | import unittest
from src.song import Song
class TestSong(unittest.TestCase):
def setUp(self):
self.song = Song("Lady In Red", "Chris De Burgh")
# Test a song has a title..
def test_song_has_title(self):
self.assertEqual("Lady In Red", self.song.title)
# Test a song has an artist..
def ... | true |
b3f7bfddc8defe5f923e2d105e79fbee9d4a8a0a | Python | Aasthaengg/IBMdataset | /Python_codes/p03806/s783508033.py | UTF-8 | 885 | 2.796875 | 3 | [] | no_license | N, Ma, Mb = map(int, input().split())
sum_a = 0
sum_b = 0
A = []
B = []
C = []
for _ in range(N):
a, b, c = map(int, input().split())
sum_a += a
sum_b += b
A.append(a)
B.append(b)
C.append(c)
inf = 10 ** 9 + 7
# 3次元dpを考える
dp = [[[inf] * (sum_b + 1) for _ in range(sum_a + 1)] for _ in range(N +... | true |
a3d9769c6224db18fecaf6f5c83d7cbf83fede6b | Python | Atik4/beta24_LazyLeaves | /location.py | UTF-8 | 4,515 | 2.6875 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup as soup
from urllib.request import urlopen as uReq
query = "I am currently standing on Mata Mandir Bhopal get directions to DB Mall Bhopal"
query_response_analyser = requests.post("http://api.intellexer.com/analyzeText?apiKey=25e240b9-cb35-47ec-9a80-25172c04e228",
... | true |
814301edb3bc93ad33f712d2a9825816700c251a | Python | YangNV/nginx_docker | /get_container_info.py | UTF-8 | 494 | 2.640625 | 3 | [] | no_license | #! /usr/bin/python3
import os
def get_container_info() -> list:
ls = os.popen(
r"docker inspect --format='{{.Name}} {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -q)")
ip_list = []
for line in ls.readlines():
name, ip = line.strip().split(" ")
# if name == "... | true |
13f5e83356a2870fa15829596b669199aafa64ee | Python | dariusf/csvq | /csvq/cli.py | UTF-8 | 5,731 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python
import subprocess
import os
import sys
import argparse
import csv
import re
import math
import shutil
import tempfile
def parse_args():
parser = argparse.ArgumentParser(prog='csvq')
parser.add_argument('file', type=str, nargs='+', help='one or more .csv files')
parser.add_argument('-q', '... | true |
6f1e69b6799ebf831bf6a4f945e454f904f3c313 | Python | X4Zero/sis-recomendacion-peliculas | /recursos.py | UTF-8 | 1,731 | 3.03125 | 3 | [] | no_license | import pandas as pd
import numpy as np
import os
from ast import literal_eval
# Import CountVectorizer and create the count matrix
from sklearn.feature_extraction.text import CountVectorizer
# Compute the Cosine Similarity matrix based on the count_matrix
from sklearn.metrics.pairwise import cosine_similarity
def Obt... | true |
381ac2d1ecdf50cb65b97719d12a60b2481a6a7a | Python | eglrp/tensorflow_book | /code/Chapter2/2_1.py | UTF-8 | 151 | 2.78125 | 3 | [] | no_license | import tensorflow as tf
node1 = tf.constant(3.0, dtype=tf.float32)
node2 = tf.constant(4.0) # 默认数据类型为tf.float32
print(node1)
print(node2) | true |
ab505875635af908a9efc00dd70cb6b1e6f16f91 | Python | summershaaa/Data_Structures-and-Algorithms | /剑指Offer/剑指3_数组中重复的数字.py | UTF-8 | 5,431 | 4.21875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Apr 25 18:34:46 2019
@author: WinJX
"""
#剑指3 : 数组中重复的数字
"""
题目1
在一个长度为n的数组里的所有数字都在0到n-1的范围内。
数组中某些数字是重复的,但不知道有几个数字是重复的。
也不知道每个数字重复几次。请找出数组中任意一个重复的数字。
例如,如果输入长度为7的数组{2,3,1,0,2,5,3},
那么对应的输出是重复的数字2或3。
"""
class Solution:
# 这里要特别注意~找到任... | true |
6afcd7520edeeb5f8edcfc7ee0b2b95309145808 | Python | jasonliuxyz/learning_python | /python_work/game_5.py | UTF-8 | 318 | 3.53125 | 4 | [] | no_license | #print(%)字符串格式化输出
from random import randint
num=randint(1, 100)
tag=True
while tag:
answer=int(input('pleas input your guess num:'))
if answer > num:
print('%d is too big' %answer)
if answer < num:
print('%d is too small' %answer)
if answer == num:
print('%d is equal' %answer)
tag=False | true |
bcc92c4b5bafc8c76c8b73d517098a641b7f26d9 | Python | pkulwj1994/mog_score_matching | /score_matching.py | UTF-8 | 2,124 | 2.84375 | 3 | [] | no_license | from tqdm import tqdm
import visdom
import torch
from torch import nn
from torch import optim
# From what I understand, grad(grad_x.sum(), x) would sum dx_i * dx_j terms
# which is different than the trace of the hessian (dx_i * dx_i partials)
def score_matching_loss(x, energy, lambada=0.00001):
grad_x = torch.a... | true |
0c22acd43d7d3f1a104396a9c7368f02922bcbc7 | Python | avivcaspi/MachineLearning | /hw2/SFS.py | UTF-8 | 2,745 | 2.96875 | 3 | [] | no_license | import pandas as pd
import numpy as np
from sklearn import metrics
from sklearn.base import clone
from sklearn.ensemble import RandomForestClassifier
from sklearn.neighbors import KNeighborsClassifier
from data_preperation import split_label_from_data
# Returns the features selected
def SFS(model, x_train: pd.DataFra... | true |
a83fb6f30dfc31a087fdfffc3f67b6312bba146f | Python | egalli64/pythonesque | /ce/c017_test.py | UTF-8 | 907 | 3.109375 | 3 | [] | no_license | """
CodeEval Sum of integers
author: Manny egalli64@gmail.com
info: http://thisthread.blogspot.com/2017/03/codeeval-sum-of-integers.html
https://www.codeeval.com/open_challenges/17/
"""
import unittest
from c017 import solution
class TestCodeEval(unittest.TestCase):
def test_provided_1(self):
self.... | true |
8bad7fab9da8a57682a6ee999b0a8b49c0bdc540 | Python | webbhm/NerdFarm | /MVP/python/EC.py | UTF-8 | 1,422 | 3.390625 | 3 | [] | no_license | '''
# Get elecrical conductivity (moisture probe) from ADC
# The analog moisture probe is hooked to pin1 of the analog to digital converter
# The ADC is running on the I2C bus
# Howard Webb
# 2019/08/16
Out of water reads about 30000
Just touching is about 28000 or lower
The deeper it is submerged, the lower the va... | true |
2be30ee50ce3c14483bad83e82d1b0b94d573d54 | Python | ValIlya/KB | /scripts/data_split_by_state.py | UTF-8 | 2,615 | 2.90625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Preprocessing for data
Created on Sun Jul 16
@author: ilya
"""
from __future__ import print_function
from __future__ import division
import numpy as np
import pandas as pd
import re
import os
import unicodedata
import codecs
import datetime
def working_dir():
if 'ilya' in os.getcwd()... | true |
d708f2468644c8d2428285d8ce410d5aec205892 | Python | snckmykek/game | /pc/main.py | UTF-8 | 682 | 2.65625 | 3 | [] | no_license | from kivy.uix.modalview import ModalView
from kivy.lang import Builder
from kivy.animation import Animation
from kivy.clock import Clock
Builder.load_file('pc/main.kv')
class Computer(ModalView):
def __init__(self, **kwargs):
super(Computer, self).__init__(**kwargs)
self.opacity = 0
def on_... | true |
53491fdca0a945e10ca2da12c965177872076eb6 | Python | xy008areshsu/Leetcode_complete | /python_version/longest_palindrome_substr.py | UTF-8 | 1,336 | 3.84375 | 4 | [] | no_license | """
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.
"""
#idea: for each location i in s until to the location of len(s) - 1, expand two candidates of palindromes, one from center of i, the oth... | true |
445c0361ca7c87cdfdbf2d2ba96ae76d1810a71f | Python | CBarreiro96/AirBnB_clone_v2 | /models/engine/db_storage.py | UTF-8 | 2,703 | 2.53125 | 3 | [] | no_license | #!/usr/bin/python3
"""."""
from os import getenv
from models.base_model import Base, BaseModel
from models.amenity import Amenity
from models.city import City
from models.place import Place
from models.review import Review
from models.state import State
from models.user import User
from sqlalchemy import ... | true |