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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
e2658e24942980f0679f67c515ec7c6ce134aff3 | Python | syiswell/python-recommender-system | /main.py | UTF-8 | 2,678 | 2.984375 | 3 | [
"MIT"
] | permissive | import pandas as pd
from Lib.ExecEval import Timing
from Dataset import DatasetLoader
from Experiments import ExperimentsResult
from Algorithms.UserKNN import UserKNN
from Algorithms.ItemKNN import ItemKNN
from Algorithms.Averaging.GlobalAverage import GlobalAverage
from Algorithms.Averaging.UserItemAverage import User... | true |
5c361a95706ced4266a1fc6c21c982d55d938850 | Python | apryor6/flaskerize | /flaskerize/utils_test.py | UTF-8 | 1,900 | 2.828125 | 3 | [
"BSD-3-Clause"
] | permissive | from os import path
import pytest
from flaskerize import utils
def test_split_file_factory():
root, app = utils.split_file_factory("wsgi:app")
assert root == "wsgi"
assert app == "app"
def test_split_file_factory_with_other_delim():
root, app = utils.split_file_factory("wsgi::app", delim="::")
... | true |
5318d677e8ff27a6c1dfeb6b6c877274abb65df1 | Python | aplassard/Compiler | /source/TypeChecker/TypeChecker.py | UTF-8 | 653 | 2.96875 | 3 | [] | no_license | from DeclerationAnalyzer import DeclerationAnalyzer
class TypeChecker(object):
def __init__(self,ast):
self.ast = ast
def run(self):
print '------------------------------'
print '---Starting Lexial Analysis---'
print '------------------------------'
print
print ... | true |
94a1e9589c2ffccaa79867e1e39a11df9e4dc855 | Python | gab-guimaraes/python | /applicationsPy/python-POO/3-Spotify/Program.py | UTF-8 | 690 | 2.6875 | 3 | [] | no_license | import mysql.connector
from Artist import Artist
from Music import Music
a = Artist("3 Doors Down", "EUA")
b = Artist("Blink182", "EUA")
c = Artist("HIM", "Finland")
m = Music("Here without u", a, 3.18)
m2 = Music("Kriptonite", a, 4.10)
m3 = Music("Always", b, 3.00)
m4 = Music("Wickd Game", c, 4.53)
listOfMusic = ... | true |
f1c4c3b47b219e23234b61c9fa515a4d8e8a7f54 | Python | ne9een/Movie-Trailer-Website | /media.py | UTF-8 | 626 | 3.203125 | 3 | [
"Unlicense"
] | permissive | import webbrowser
class Movie():
"""This program is a web page represent my
favorite movies I watched recently. you also
are able to watch the trailer of each by
clicking on poster image"""
def __init__(self, movie_title, movie_storyline,
poster_image, trailer_youtube):
se... | true |
25b245469bd5e8bbab86ac345da960409c6316de | Python | xiongchenyan/cxPyLib | /IndriRelate/CtfLoader.py | UTF-8 | 2,241 | 2.8125 | 3 | [] | no_license | '''
Created on Dec 5, 2013
load ctf from a file
file is made by c++ calling IndriAPI in query enviroment
will load and keep in class, output as service
@author: cx
'''
import math
class TermCtfC(object):
def __init__(self,InName = ""):
self.Init()
if "" != InName:
self.Load(InName)... | true |
4331bd7c4c1352c128b765802754ec4ba297cea6 | Python | MaterialsDiscovery/PyChemia | /pychemia/analysis/surface.py | UTF-8 | 14,660 | 2.671875 | 3 | [
"MIT"
] | permissive |
import numpy as np
import pychemia
import itertools
import scipy.spatial
from scipy.spatial import qhull
from pychemia.utils.periodic import covalent_radius
# return [x, y, d], that ax + by = d, d = gcd(a, b)
def ext_gcd(a, b):
v1 = [1, 0, a]
v2 = [0, 1, b]
if a > b:
a, b = b, a
while v1[2] ... | true |
6aed8030729478f2a1690d5c7941991300cca5fe | Python | ddoyen/premierlangage | /server/serverpl/qa/mixins.py | UTF-8 | 1,106 | 2.78125 | 3 | [] | no_license | # encoding: utf-8
import datetime
from django.utils import timezone
class DateMixin:
"""Provide a method indicating how much time ago something was created according to pub_date
field."""
@staticmethod
def verbose_date(date):
now = timezone.now()
delta = now - date
seco... | true |
b29bf4309bc4b0096a5ce53633d96e73697a5ee6 | Python | elsuavila/Python3 | /Ejercicios Elsy Avila/Ejer8.py | UTF-8 | 932 | 3.734375 | 4 | [] | no_license | # Escriba un algoritmo que da la cnatidad de monedas de 5-10-12,5-25-50 cent y
#1 Bolivar,diga la cntidad de dinero que se tiene en total
print("Bienvedido al Programa".center(50,"-"))
monedas1 = 0
monedas2 = 0
monedas3 = 0
monedas4 = 0
monedas5 = 0
monedas6 = 0
total1 = 0
total2 = 0
total3 = 0
total4 = 0
total5 = 0... | true |
92ff74d84d205bc003e00079264e95f87f74441f | Python | TsunamiBlue/MDP-SSP-Reinforcement-Learning | /material/test_18.py | UTF-8 | 657 | 2.5625 | 3 | [] | no_license | import unittest
from example1 import example_1
from rtdp import RTDP
class Test(unittest.TestCase):
def test(self):
domain = example_1()
rtdp = RTDP(domain, 0.9)
rtdp.run_n_simulations(50, 500)
policy = rtdp.policy()
self.assertEqual(policy[domain.state("NoFork")], domain.... | true |
0274f17f07102ef353c06349496f28fe00c243a8 | Python | ldarrick/Research-Scripts | /Microscopy/CellProfiler_track_cells.py | UTF-8 | 13,329 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
#
# Last modified: 8 June 2016
# Author: Dhananjay Bhaskar <dbhaskar92@gmail.com>
# Requires package: pip install sortedcontainers
#
import sys
import csv
import math
import collections
from scipy.misc import imread
from sortedcontainers import SortedSet
from matplotlib import collections as MC
... | true |
ca6cf69755faf2367be5e11c57c54454351f6473 | Python | kenkainkane/imgpro2020 | /spatial_filtering/noiseRemoval.py | UTF-8 | 578 | 2.828125 | 3 | [] | no_license | import cv2
import numpy as np
img_sp = cv2.imread('../img/saltAndPepper.jpg')
img_gs = cv2.imread('../img/gaussian.jpg')
# smoothing image using average filter
avg_blur_sp = cv2.blur(img_sp, (7, 7))
avg_blur_gs = cv2.blur(img_gs, (7, 7))
# smoothing image using median filter
med_blur_sp = cv2.medianBlur(img_sp, 5)
m... | true |
faf68ae9afcd3082aafd28b06ae8bf2d914fde3c | Python | newcanopies/facial-feature-tracking | /helper.py | UTF-8 | 1,010 | 2.96875 | 3 | [] | no_license | '''
File name: helper.py
Author:
Date created:
'''
'''
File clarification:
Include any helper function you want for this project such as the
video frame extraction, video generation, drawing bounding box and so on.
'''
import cv2
import numpy as np
from scipy import signal
def drawBox(img, bbox):
imgwb... | true |
f38125d5e1e07958ad5126fe4ec150d761043692 | Python | kbrzust/GuessTheNumber | /GuessTheNumber.py | UTF-8 | 467 | 4.21875 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
def guess(x):
random_number = random.randint(1, x)
number = 0
while random_number != number:
number = int(input("Wprowadz liczbe: "))
if number > random_number:
print("Sprobuj ponownie, liczba jest za wysoka. ")
... | true |
459ca95d196290fecd1b0d17f729b7fd42437b95 | Python | SebastianCalle/holbertonschool-higher_level_programming | /0x05-python-exceptions/6-raise_exception_msg.py | UTF-8 | 142 | 2.703125 | 3 | [] | no_license | #!/usr/bin/python3
# function that raises a name exception whit a message
def raise_exception_msg(message=""):
raise NameError(message)
| true |
3b2c0ba3d9ca994e32450a1fd32711d6132b6e71 | Python | tmathai/spine | /common/layers/losses.py | UTF-8 | 3,616 | 3.21875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Feb 17 18:40:39 2019
@author: Tejas
"""
import tensorflow as tf
EPS = 0.0000001
def dice(labels, prediction):
with tf.variable_scope('dice'):
## input --> [batch_size (None), height, width, num_classes]
## output --> [batch_size, num_classes]
... | true |
527814b97b3bad6a0445677d7a5b00c6d373c3f5 | Python | Wessrow/packetpusher | /main.py | UTF-8 | 976 | 2.71875 | 3 | [] | no_license | #!/usr/bin/python3
"""
Code written by Gustav Larsson
Generating IP traffic with Scapy
"""
from logging_handler import logger
from scapy.all import *
def format_logs(level, message_type, message):
"""
Helper function to format error messages
"""
info = {"type": message_type,
"message... | true |
2f5998d9c450b2be7b72f27c3ecb38401205fc34 | Python | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/gigasecond/aea97a3ac80244c4b02a94a4fcd4a908.py | UTF-8 | 114 | 2.671875 | 3 | [] | no_license | from datetime import timedelta
GIGA = 10**9
def add_gigasecond(base):
return base + timedelta(seconds=GIGA)
| true |
754609d0ab4d31384c578a88e2149eee26d1929f | Python | alanoudalbattah/Fyyur | /starter_code/models.py | UTF-8 | 3,320 | 2.703125 | 3 | [] | no_license | from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy() #*remember: to avoid circular import
# many to many relationship, linked by an intermediary table.
#" When using the relationship.backref parameter instead of relationship.back_populates,
# the backref will automatically use the same relationship.secondary ar... | true |
77ee8bf96b9cd6f18166ebc09dd73f877abc21e3 | Python | srikanthpragada/PYTHON_12_JULY_2021 | /demo/oop/ex_demo.py | UTF-8 | 399 | 3.8125 | 4 | [] | no_license | prices = [100, 200, 300]
try:
count = int(input("Enter a number :"))
r = 10 // count
print(prices[r])
except ValueError:
print("Sorry! Invalid number. Please enter a valid number!")
except ZeroDivisionError:
print("Sorry! Zero is not valid!")
except Exception as ex:
print('Stopped program due ... | true |
3f0b27c99499256d3bf1b0afa7f2159f22ef108b | Python | Hourout/linora | /linora/data/_utils.py | UTF-8 | 1,941 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | import requests
from linora import gfile
from linora.utils._progbar import Progbar
__all__ = ['get_file']
def assert_dirs(root, root_dir=None, delete=True, make_root_dir=True):
if root is None:
root = './'
assert gfile.isdir(root), '{} should be directory.'.format(root)
if root_dir is not None:
... | true |
a613ece30131cb34c1b41ab7d77a1e60e8ced9f2 | Python | ITihiy/gb_algo_solutions | /lesson_01_slyusar_roman/01. task 1.py | UTF-8 | 877 | 4.40625 | 4 | [] | no_license | """
1. Найти сумму и произведение цифр трехзначного числа, которое вводит пользователь.
"""
three_digit_number = int(input("Введите трехзначное число: "))
# Можно и математическими операциями наити единица, десятки и сотни, но так проще
srt_three_digit_number = str(three_digit_number)
if len(srt_three_digit_number) ... | true |
b1e5420b2379fae1d60da24005875fbb6093767b | Python | eagle750/PySc | /youtube downloader/youtubedownloader.py | UTF-8 | 415 | 3.125 | 3 | [] | no_license | import pytube
print("Enter the video link")
link = input()
yt = pytube.YouTube(link)
stream = yt.streams.first()
#videos = yt.get_videos()
#s=1
#for v in videos:
# print(str(s)+". "+str(v))
# s += 1
#print("Enter the number of videos: ")
#n = int(input())
#vid = videos[n-1]
print("Enter the location:")
des... | true |
bf93aa0e2694eea5870d0d4a007a790629726532 | Python | samir711/webdriverpythonappium | /PythonAppiumProject/PythonTraining/Day4/Assignment/Day4Assignment4Q3.py | UTF-8 | 529 | 3.28125 | 3 | [] | no_license | # Q3. Find out the pypi module available which can be used to perform the following activity -
#
# a. read and write excel file
# b. generate logs.
# Excel packages packages such as pandas, openpyxl, xlrd, xlutils and pyexcel.
# https://www.geeksforgeeks.org/reading-excel-file-using-python/
import xlrd # a. read an... | true |
48285dd8d9304573ac9bf75f8ee60f57c09ee60f | Python | woshiZS/Snake-Python-tutorial- | /Chapter8/admin.py | UTF-8 | 551 | 2.984375 | 3 | [] | no_license | from users import User
class Privilege:
def __init__(self):
self.privileges=['can add post','can delete post','can ban user']
def show_privileges(self):
for privilege in self.privileges:
print(privilege)
class Admin(User):
def __init__(self, first_name, last_name, **user_info... | true |
eba3b447858f0402fe4b04d81dec4d38e506d2ff | Python | yugalk14/Web-Scraper | /first_web_scrape.py | UTF-8 | 1,328 | 2.921875 | 3 | [] | no_license | from urllib.request import urlopen as uReq
from bs4 import BeautifulSoup as soup
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
def scraper(max_pages):
for i in range(1,max_pages):
my_url='https://www.monster.com/jobs/search/?q=Software-Engineer&where=USA&intcid=skr_navigation_nhpso_... | true |
3e7c6c2059f182019a0cb34b13f008a7988bcaef | Python | ym7979/dict | /dict_db.py | UTF-8 | 2,081 | 3.25 | 3 | [] | no_license | import hashlib # 加密
import pymysql
def change_passwd(passwd):
hash = hashlib.md5() # 使用md5对象加密
hash.update(passwd.encode()) # 加密(只可用字节串)
return hash.hexdigest()
class Database:
def __init__(self):
# 连接数据库
self.db = pymysql.connect(host='localhost',
... | true |
10fb3674d148f601f3661276891f273186193dda | Python | sspenst/synacor-challenge | /teleporter.py | UTF-8 | 1,270 | 3.53125 | 4 | [] | no_license | """
Runs an optimized version of the function at address 6027 to find
the input that will allow the teleporter to reach the second location.
"""
import sys
mod = 32768
def check_r7_val(r7):
"""
Checks if a specific value of reg7 would result in a successful
outcome for the function call at addr... | true |
9692bf180d2d945299e7a5a0b422964b754750d4 | Python | OhDakyeong/p2_201611084 | /w3Main_temperature.py | UTF-8 | 211 | 3.859375 | 4 | [] | no_license | temp=raw_input("user input temperature: ")
sel=raw_input("F or C: ")
temp=int(temp)
if(sel=="F"):
print ((temp-32)/1.8),"C"
elif(sel=="C"):
print ((temp*1.8)+32),"F"
else:
print "Input Error"
| true |
de9a346685829488f5ba04c7307b5c4b15a35040 | Python | xylong/python | /object/generator.py | UTF-8 | 634 | 3.6875 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2017-09-11 13:31:27
# @Author : xyl (416319808@qq.com)
# @Link : https://github.com/xylong
# @Version : 1.1
class Libs(object):
"""斐波拉契数列"""
def __init__(self, n):
self.n = n
self.a = 0
self.b = 1
def __iter__(self):
return self
def __next__(... | true |
adc7f444ae488b7e01df483c08780eae86b47241 | Python | Alexander-Nalbandyan/learning-python | /ch-01/for_tests.py | UTF-8 | 696 | 4.9375 | 5 | [] | no_license | # iterates over given list and on each iteration assigns next value from list to the i variable.
for i in [1, 2, 3, 6, 9, 10]:
print(i)
# iterates over characters of the string on each iteration assigning next character of the string to the variable i.
# This works because strings in Python are sequences which are... | true |
19ea7a395562c873e3b4b3dc49cbbad865d93b85 | Python | daniel-reich/ubiquitous-fiesta | /djJpmZPPBx3JaAqcK_10.py | UTF-8 | 293 | 3.109375 | 3 | [] | no_license |
def maya_number(n):
return [to_maya(k) for k in reversed(base20(n))]
def to_maya(n):
nlines, ndots = divmod(n,5)
return 'o'*ndots + '-'*nlines if n else '@'
def base20(n):
n20 = []
while n:
n,r = divmod(n,20)
n20.append(r)
return n20 or [0]
| true |
0d5083961207903c2e0c3fbd93ca25ff08982380 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_46/50.py | UTF-8 | 992 | 3 | 3 | [] | no_license | with open("A.in") as infile:
with open("A.out",mode="wt") as outfile:
cases = int(infile.readline())
for ncase in range(cases):
# Perform all nessesary calculation
size = int(infile.readline())
row = [0] * size
for i in range(size):
... | true |
f292252aeb3c681dab1a4f1f193f6b4bc667ef04 | Python | DylanClarkOffical/CodeWars-Python | /Challenges-Beginner/multiplicationTable.py | UTF-8 | 140 | 3.46875 | 3 | [] | no_license | def multiplication_table(size):
return [[x * y for y in range(1, size + 1)] for x in range(1, size + 1)]
print(multiplication_table(3)) | true |
892ad1fae4154f591a922fd0026f1de575a2215b | Python | noahlove/manim-intro | /shape_trace/shape_trace.py | UTF-8 | 637 | 2.84375 | 3 | [] | no_license | from manim import *
class PointWithTrace(Scene):
def construct(self):
path = VMobject()
dot = Dot()
path.set_points_as_corners([dot.get_center(), dot.get_center()])
def update_path(path):
previous_path = path.copy()
previous_path.add_points_as_corners([dot.ge... | true |
d59326882f94c43dd3484a73e120b9fd3d7b92aa | Python | anderson89marques/Santos | /santos/example.py | UTF-8 | 1,003 | 2.84375 | 3 | [
"MIT"
] | permissive | __author__ = 'anderson'
# -*- coding: utf-8 -*-
from santos import ThreadSchedule
import time
def f(schedule, job_name):
time.sleep(10)
schedule.pause_job(job_name)
print("//a//")
def f1(schedule, job_name):
time.sleep(20)
schedule.resume_job(job_name)
print("//b//")
def f2(schedule, job_... | true |
e6c312af118ac0392bcb18f302a31b9f16616c08 | Python | 1Moiz/Python-Basics | /lab2.py | UTF-8 | 4,329 | 3.953125 | 4 | [] | no_license | #Assignment # 2
#Chapter # 02
#Q no 1
username = 'Moiz Ahmed'
print(username)
#Q no 2
message = 'Hello World'
print(message)
#Q no 3
age = '21'
certified = 'Certified in Python Language'
print(username + "his age is " ... | true |
0a550375eb69aaf960cc7f73bdbf16779898d95f | Python | sparisi/tensorl | /common/plotting.py | UTF-8 | 1,580 | 3.046875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import matplotlib
from matplotlib import cm
from mpl_toolkits.mplot3d import Axes3D
plt.ion()
#matplotlib.use('TKagg')
import numpy as np
class RT3DPlot:
'''
It creates a new figure with two subfigures (surf and contourf + colorbar)
and allows to update them in real time wi... | true |
907096426d7b4f9f92a24317997b4be0cd35083c | Python | jorgediazjr/dials-dev20191018 | /base/lib/python2.7/site-packages/wx-3.0-gtk2/wx/lib/pdfviewer/__init__.py | UTF-8 | 2,690 | 2.59375 | 3 | [
"LicenseRef-scancode-python-cwi",
"GPL-1.0-or-later",
"LicenseRef-scancode-other-copyleft",
"LicenseRef-scancode-free-unknown",
"Python-2.0",
"BSD-3-Clause"
] | permissive | # Name: __init__.py
# Package: wx.lib.pdfviewer
#
# Purpose: A PDF file viewer
#
# Author: David Hughes dfh@forestfield.co.uk
# Copyright: Forestfield Software Ltd
# Licence: Same as wxPython host
# History: Created 17 Aug 2009
#
#----------------------------------------------... | true |
59353c35e175fde37bbe9a190980d1e3e75ddaaf | Python | OlgaBrozhe/PythonProject | /check_db_connection.py | UTF-8 | 412 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | import pymysql.cursors
# DB API 2.0
connection = pymysql.connect(host="127.0.0.1", database="addressbook", user="root", password="")
try:
# Point to the data stored in the database
cursor = connection.cursor()
# Query the data from the DB and print row by row
cursor.execute("select * from address_in_g... | true |
525a43560f05706f3401773fa7269aeca920f235 | Python | vinoddiwan/HackerRank-Solutions- | /2D Array - DS/hourglassSum.py | UTF-8 | 377 | 3.453125 | 3 | [] | no_license | def hourglassSum(arr):
maxGlass = float('-inf') # select minimum number
for i in range(len(arr)-2): # only two more values needed
for j in range(len(arr)-2): # same for below
currSum = arr[i][j] + arr[i][j+1] + arr[i][j+2] + arr[i+1][j+1] + arr[i+2][j] + arr[i+2][j+1] + arr[i+2][j+2]
maxGlas... | true |
fb81f924f2ce8422b4ebd3c8dbe3bf4e8dad84d5 | Python | modalsoul0226/LeetcodeRepo | /easy/Largest Subarray.py | UTF-8 | 1,610 | 3.296875 | 3 | [] | no_license | # O(n) solution
class Solution:
def maxSubArray(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
res = -(2 ** 32)
temp = 0
for i in nums:
if temp < 0:
temp = i
else:
temp += i
... | true |
b522d6675a8901bb50c944cb1302e9e868bc865a | Python | fdermer/mg2 | /recipe/management/commands/count_recipes_with_photos.py | UTF-8 | 452 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from recipe.models import Recipe
import os
root_dir = "/Users/Fred/www/mg2/mg2/recipe/static/"
count = 0
for recipe in Recipe.objects.all():
if recipe.image_slug and recipe.image_name:
if os.path.exists(os.path.join(root_dir, recipe.get_image_url())):
... | true |
ea3f709d4461cf29dbd93dd74d6ef947f97bc12d | Python | wolfela/SecondYear | /coolbeans/app/views/quiz.py | UTF-8 | 6,679 | 2.59375 | 3 | [
"BSD-2-Clause"
] | permissive | from django.views import View
from coolbeans.app.forms import QuizForm
from coolbeans.app.models.quiz import QuizModel
from coolbeans.app.models.question import MultipleChoiceModel, WordScrambleQuestionModel, WordMatchingModel, GapFillQuestionModel, CrosswordQuestionModel, BaseQuestionModel
from django.shortcuts import... | true |
5f3c98e5f40ef4d56868e435322c196ab02889b2 | Python | szyymek/Python | /String_transformer.py | UTF-8 | 347 | 3.734375 | 4 | [] | no_license | def string_transformer(s):
s = s.split(" ")
s = s[::-1]
print(s)
s = " ".join(s)
print(s)
result = ""
for letter in s:
if letter.islower():
result += letter.upper()
elif letter.isupper():
result += letter.lower()
else:
result +=let... | true |
4bcfd700b7ff817ecc8b2ec935daac0499b0d69d | Python | PacktPublishing/Software-Architecture-with-Python | /Chapter08/eventlet_chat_server.py | UTF-8 | 1,626 | 2.921875 | 3 | [
"MIT"
] | permissive | # Code Listing #8
"""
Multiuser chat server using eventlet
"""
import eventlet
from eventlet.green import socket
participants = set()
def new_chat_channel(conn):
""" New chat channel for a given connection """
data = conn.recv(1024)
user = ''
while data:
print("Chat:", data.strip... | true |
b165e73cf199a927015b1759d3d502ca19719b28 | Python | chungyang/CS514 | /HW4/heavyHitter.py | UTF-8 | 2,999 | 3.59375 | 4 | [] | no_license | import numpy as np
import math
class hash_function:
def __init__(self, w):
self.w = w
self.a, self.b = np.random.randint(0, w, 2)
def hash(self, n):
"""
:param n: value to hash
:return: a hash_value
"""
hash_value = (self.a * n + self.b) % self.w
... | true |
53368ebf7d59407040e16b5520fd7f48cb68c513 | Python | ursg/analysator | /pyCalculations/pitchangle.py | UTF-8 | 2,487 | 2.921875 | 3 | [] | no_license | import numpy as np
import pylab as pl
def pitch_angles( vlsvReader, cellid, cosine=True, plasmaframe=False ):
''' Calculates the pitch angle distribution for a given cell
:param vlsvReader: Some VlsvReader class with a file open
:type vlsvReader: :class:`vlsvfile.VlsvReader`
:pa... | true |
98699779792566ebfaece37e789e95b5a0e3456d | Python | aog11/python-training | /scripts/countdown.py | UTF-8 | 369 | 3.421875 | 3 | [] | no_license | # Chapter 15
# Simple Countdown Program Project
#! python3
# Importing the needed modules
import time, os, subprocess
timeLeft = 60
while timeLeft > 0:
print(timeLeft, end='')
time.sleep(1)
timeLeft-= 1
# Going to the location of alarm.wav
os.chdir('')
# At the end of the countdown, play a sound file
s... | true |
eadce458aff15f2755ba7a955815c7f191343606 | Python | ThomasR75/python_work | /Euler51with strings.py | UTF-8 | 1,392 | 3.671875 | 4 | [] | no_license | #Euler51 Prime Digit replacements
# replace 2 digits in a number with same numbers and find smallest that is 8 number sequence prime
#create primes
from time import time
from collections import Counter
begin = time()
primemax = 1000000
marked = [0] * primemax
primes = [2, ]
value = 3
while value < primemax:
if ma... | true |
d9fc4e8243e5cda6e58f006d8b8293f475d54ed9 | Python | pasbahar/python-practice | /Remaining_str.py | UTF-8 | 1,251 | 4.1875 | 4 | [] | no_license | '''Given a string without spaces, a character, and a count, the task is to print the string after the specified character has occurred count number of times.
Print “Empty string” incase of any unsatisfying conditions.
(Given character is not present, or present but less than given count, or given count completes on las... | true |
df3ed79b74df3e598854915509f9a7173b5548e8 | Python | guzmananthony37/Homework-3 | /11.22.py | UTF-8 | 208 | 3.0625 | 3 | [] | no_license | #Anthony Guzman 11.22 CIS 2348 1503239
input_list = input()
list = input_list.split()
for word in list:
frequency=list.count(word)
print(word,frequency) | true |
0bc7d4694eac5e14a508e09fb86fba895ed58594 | Python | Ceruleanacg/Crack-Interview | /LeetCode/Array and Strings/66. Plus One/solution.py | UTF-8 | 558 | 3.375 | 3 | [
"MIT"
] | permissive | class Solution:
def plusOne(self, digits: list):
"""
:type digits: List[int]
:rtype: List[int]
"""
carry = 0
digits[-1] += 1
for i in reversed(range(0, len(digits))):
num = digits[i]
num += carry
carry = 0
if n... | true |
2335e9c9b4bd5453e7ba6ed05eae3ee83d08e190 | Python | Code0N/PythonKPLab2 | /01.py | UTF-8 | 940 | 3.484375 | 3 | [] | no_license | from sys import argv
from os.path import exists
if len(argv) == 1:
print('Укажите файл для обработки')
exit()
if exists(argv[1]) == False:
print('Файл не существует')
exit()
try:
file = open(argv[1], 'rt', 512, 'utf-8')
except:
print('Эксепшн')
finally:
file.close()
alltextfiltered = ''
for line in file:
fo... | true |
835dccc91ea460cdcf9f0388f8678776aba5c428 | Python | WinstonChenn/trolly-sim | /src/sim_utils.py | UTF-8 | 8,856 | 2.84375 | 3 | [
"MIT"
] | permissive | """
Winston Chen
5/3/2021
Utilities for trolly problem simulation enviorment setup
"""
import random
from enum import Enum
import numpy as np
class LossType(Enum):
TELE = "teleology"
DEON = "deontology"
class Simulator:
def __init__(self, n, full_info, seed, track_max=5, pass_max=5):
"""
... | true |
a7be6acb923de11d700e5052cc71bc9d5fb8dd47 | Python | SagarPatel-O1/Python-Sem-3-Practicals- | /Python Prac/practical 7/Inherex.py | UTF-8 | 2,752 | 4.25 | 4 | [] | no_license | class Parent():
def first(self):
print('first function')
class Child(Parent):
def second(self):
print('second function')
ob = Child()
ob.first()
ob.second()
#subclass
class Parent:
def __init__(self , fname, fage):
self.firstname = fname
s... | true |
cfc0438d3560d779e960efdae32d83126b107f67 | Python | hyanwya/scaled | /scaled.py | UTF-8 | 186 | 2.921875 | 3 | [] | no_license | def scaled(r):
sum = 0
for char in r:
sum += ord(char.lower()) - 96
finished = abs(sum) % 10
if finished == 0:
return 10
else:
return finished | true |
abe606867ecfe493e6e9a3fcf536c6f7450a91d6 | Python | netsus/Rosalind | /DAG.py | UTF-8 | 1,042 | 3.53125 | 4 | [] | no_license | # coding: utf-8
"""
난이도 : 6.5
문제 : 처음에 그래프 개수(k)가 주어지고,
한줄 띄고, 정점 개수(v)와 간선 개수(e)가 주어지고, 다음줄에 시작 정점과 도착 정점 (방향 그래프)이 주어진다. -> 이렇게 그래프 개수만큼 주어진다.
주어진 방향 그래프에 대해 사이클이 있으면(cyclic) -1, 사이클이 없으면(acylcic) 1을 출력.
알고리즘 :
"""
import networkx as nx
from IPython.core.display import Image
from networkx.drawing.nx_pydot import... | true |
e5a5d4c50172452a9cd4315f12552a663febf9a8 | Python | d-sanchez/Game-Engine-Architecture | /as05/selectionMgr.py | UTF-8 | 1,380 | 2.734375 | 3 | [] | no_license | import ogre.io.OIS as OIS
class SelectionMgr:
def __init__(self, engine):
self.engine = engine
def init(self):
self.keyboard = self.engine.inputMgr.keyboard
self.toggle = 0.1
def tick(self, dt):
if self.toggle >=0:
self.toggle -= dt
selectedEntInde... | true |
fefda8c7ede3336c44efee5612a7ee0cf75f1b00 | Python | ArmanHome24/ArmanRepo | /Udemy_Advance_Python/App-4-Photo-Searcher/main.py | UTF-8 | 1,095 | 2.859375 | 3 | [] | no_license | import requests
import wikipedia
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import Screen, ScreenManager
Builder.load_file('frontend.kv')
class Wiki:
def find_image_url(self, query):
page = wikipedia.page(query)
return page.images[0]
class Download:
d... | true |
cc10ec942bcbeea28e82a5a11a0116faae77af8e | Python | AlJamilSuvo/LeetCode | /code23.py | UTF-8 | 1,644 | 3.4375 | 3 | [] | no_license | from queue import PriorityQueue
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
def __str__(self):
st=str(self.val)+'->'
if self.next !=None:
st+=str(self.next)
return st
class Solution(object):
def mergeKLists(sel... | true |
09872d7051d70d2b46824db62f0a53cce16e2b8e | Python | huangshunliang/DLCV2018spring | /final/relation_network/utils/utils.py | UTF-8 | 803 | 2.859375 | 3 | [] | no_license | from scipy.misc import imread, imsave
import os
def listdir(directory, key=None):
if key:
return sorted(os.listdir(directory), key=key)
else:
return sorted(os.listdir(directory), key=lambda x: int(os.path.splitext(x)[0]))
def mkdir(directory):
if not os.path.exists(directory):
os... | true |
c3f221259f8a43ff05da323a0e9616ad1e4901d3 | Python | mykespb/edu | /homeinf/closest.py | UTF-8 | 2,199 | 3.875 | 4 | [] | no_license | #!/usr/bin/env python
# Mikhail Kolodin
# 2022-04-22 2022-04-22 v.1.1
# ~ Дан список случайных натуральных чисел.
# ~ Найти пару ближайших чисел.
# ~ (Если их несколько, показать все).
from random import randint as ri
# параметры
MAX = 100 # макс. нат. число
LEN = 10 # длина списка
# формируем случайный с... | true |
1648df4b8b344126c6a08980c63eb57a12342275 | Python | pboechler/TwitchMIDI | /TwitchMIDI.py | UTF-8 | 1,564 | 3.078125 | 3 | [] | no_license | """
TwitchMIDI
The following script requires you to have a Twitch account.
A channel which you're gather chat stream data from does not need to be joined.
v1.0 - 05/19/20
"""
server = 'irc.chat.twitch.tv'
port = 6667
nickname = #Enter your Twitch username
token = #Enter your Twitch authorization token "oauth:XXXXXX..."... | true |
de3d62c3827235fd0d793848f3a43978dd534279 | Python | wwlee94/idus-product-list-crawling | /crawling_Idus.py | UTF-8 | 3,460 | 2.71875 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import requests
import bs4
from bs4 import BeautifulSoup
import io
import csv
import re
index = 0
wf = io.open('idus_item_list.csv', 'wb')
writer = csv.writer(wf)
writer.writerow([index, 'thumbnail_520', 'thumbnail_720', 'thumbnail_list_320', 'title', 'seller', 'cost', 'discount_cost', 'discoun... | true |
bea59256f48993381788090d7ee7ef8969731dd6 | Python | JacProsser/college | /Assignment 1 - Procedural Programming/Python Challenges (1-30)/Challenge 8.py | UTF-8 | 1,101 | 4.09375 | 4 | [] | no_license | #importing packages
import colorama
from colorama import Fore
import os
#clears the console screen
os.system("cls")
def process():
#clears the console screen
os.system("cls")
#printing "welcome message" saying what the program is and who it is made by
print("ASCII values in", Fore.YELLOW+"python.", For... | true |
422a571fd7e048009cb2d6f6d5edc487ad534185 | Python | Aasthaengg/IBMdataset | /Python_codes/p02580/s342547913.py | UTF-8 | 1,213 | 2.96875 | 3 | [] | no_license | def main():
H, W, M = map(int, input().split())
# H, W, M = (3 * 10 ** 5, 3 * 10 ** 5, 3 * 10 ** 5)
row = [0] * (H + 1)
row_set = [set() for _ in range(H+1)]
column = [0] * (W + 1)
column_set = [set() for _ in range(W+1)]
# import random
ms = []
positions = set()
for m in range(... | true |
d31903bdac4b1bdd1f8631f8edee12e488de899a | Python | movingpictures83/Statistics | /StatisticsPlugin.py | UTF-8 | 1,173 | 2.828125 | 3 | [
"MIT"
] | permissive | import sys
import numpy
#import PyPluMA
class StatisticsPlugin:
def input(self, filename):
self.myfile = filename
def run(self):
filestuff = open(self.myfile, 'r')
firstline = filestuff.readline()
self.bacteria = firstline.split(',')
if (self.bacteria.count('\"\"') != 0):
... | true |
8ba00400bafcc24e2ec80b756981c83962d7b405 | Python | arata15/create_sql | /create_sql.py | UTF-8 | 1,960 | 3 | 3 | [] | no_license | import pandas as pd
import openpyxl as px
import re
import json
import requests as rq
#行の値,ファイルの番号
count = file_count = 1
#ループの条件
end_flg = False
#EXCELファイル内のワークブック読み込み
work_book = px.load_workbook("任意のディレクトリ/Excelファイル名")
#シートの情報読み込み
sheet = work_book.active
sheet = work_book.get_sheet_by_name("Excelシート名... | true |
85cf526875c01371753f0e9f9e466bfe6011d362 | Python | huangliu0909/Pinyin-Chinese-character-conversion | /main_trie.py | UTF-8 | 749 | 2.640625 | 3 | [] | no_license | from PinyinDict import pinyinDict
from PinyinDict import is_Chinese
from learn import learn
from pypinyin import lazy_pinyin
from Ngram import get2grams
import numpy as np
# 拼音切割的实例
pinyinString = "maixiangchongmanxiwangdexinshiji"
filename = 'data_trie'
f = open(filename, 'r', encoding='UTF-8').read()
res = ... | true |
bb8b3c66ba72be1dbb3e06e4b6c812376fb4c953 | Python | PinkShnack/ETF_Portfolio_Manager | /portfolio/etf.py | UTF-8 | 5,570 | 3.265625 | 3 | [] | no_license |
import matplotlib.pyplot as plt
import portfolio.io as port_io
import portfolio.setup_data as setup_data
class ETF:
def __init__(self, ticker, country, dummy_data=False):
'''
ETF class allows users to interact with single ETFs, and can be
imagined as a subset of the Portfoli... | true |
44680cd5366e0c3c7ea31be050d4cf656d29a0ee | Python | duubyPlz/prOve_it | /.name/scrape.py | UTF-8 | 350 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python3
import urllib.request
import sys
if (len(sys.argv) != 2):
str = ''
for arg in sys.argv:
str += arg + ' '
raise ValueError('Usage: ./scrape.py <url>, current command: ' + str);
url = sys.argv[1]
# print(" > url: " + url + "\n\n\n\n")
page = urllib.request.urlopen(url)
... | true |
90f8489c3a060ce558ecc11f9c55890913ac1bf0 | Python | Wu-zpeng/PythonLearn | /day11/动态传参.py | UTF-8 | 136 | 2.859375 | 3 | [] | no_license | # def func(**kwargs):
# print(kwargs)
#
# func(a=1, b=2, c=3)
def fun(**kwargs):
print(kwargs)
dic = {'a':1,'b':2}
fun(**dic)
| true |
440a375a0729c705f0afb7dd17f2da7d802e6046 | Python | KeYunYun/studens_python | /基础编程/TCP服务器.py | UTF-8 | 563 | 2.765625 | 3 | [] | no_license | from socket import *
HOST=''
PROT=8000
BUFSIZE=1024
ADDR=(HOST,PROT)
tcpSocketSer=socket(AF_INET,SOCK_STREAM)
tcpSocketSer.bind(ADDR)
tcpSocketSer.listen(5)
while True:
clientSocket,clientInfo=tcpSocketSer.accept()
print('链接成功,客户端的ip为和端口为%s'%str(clientInfo))
while True:
recvDate=clientSocket.r... | true |
df5fac789d8944d5eb0ff923fa17a84df604162b | Python | josephduarte104/data-science-exercises | /py4e/assignment7_1.py | UTF-8 | 166 | 3.53125 | 4 | [] | no_license | # Use words.txt as the file name
fname = input("Enter file name: ")
fh = open(fname)
for line in fh:
fz = line.strip()
fy = fz.upper()
print(fy)
| true |
9c9d94b247364b83aed15e2bc863a5a1d64cdcef | Python | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/kindergarten-garden/0b1a939ff6974472b62b59d972032092.py | UTF-8 | 1,039 | 3.296875 | 3 | [] | no_license | import re
class Garden:
Students = []
Line1 = ""
Line2 = ""
def __init__(self,GardenRaw, students = ''):
Garden = re.sub(r'\W+', '',GardenRaw)
self.Line1, self.Line2 = Garden[:len(Garden)/2], Garden[len(Garden)/2:]
if students != '':
for student in students:
self.Students.append(student.lower()[0])
... | true |
f34a9ca7eeed630ecfadbc575573153d0dc29e9a | Python | johnstsai/Codecademy_practice | /Python/count.py | UTF-8 | 807 | 4.96875 | 5 | [] | no_license | #count
#Great work so far. Let's finish up by practicing with a few functions that take lists as arguments.
#1.Define a function called count that has two arguments called sequence and item.
#Return the number of times the item occurs in the list.
#For example: count([1, 2, 1, 1], 1) should return 3 (because 1 appear... | true |
98611d62f43329744f097852a60e7e55347b1231 | Python | puneethprog9/Python | /multithreading.py | UTF-8 | 454 | 3.609375 | 4 | [] | no_license | #!/usr/bin/python
import time
import threading
def fn_sqrt(numbers):
for n in numbers:
time.sleep(0.2)
print("square",n*n)
def fn_cube(numbers):
for n in numbers:
time.sleep(0.2)
print("cube",n*n*n)
arr=[2,3,4,5]
t=time.time()
t1=threading.Thread(target=fn_sqrt,args=(arr... | true |
da879370f1cd0a1e8eb26b3500a6f1785947f78a | Python | jzhuo/blackjack-gambling-model | /blackjack.py | UTF-8 | 15,628 | 4.0625 | 4 | [] | no_license | from deck import Deck
class Blackjack():
"""
Represents the game and state of Blackjack for two players.
"""
def __init__(self):
self.deck = Deck(5)
self.playerHand = list() # player
self.dealerHand = list() # dealer
self.confidence = .5 # player hits if probability of... | true |
694e6c76d2dfec8d92fa4155efd6097ff3865096 | Python | peter-dinh/cryptography | /public key/mod.py | UTF-8 | 335 | 3.359375 | 3 | [
"Apache-2.0"
] | permissive | def power(x, b, n):
a = x
y = 1
while b > 0:
if b % 2 != 0:
y = (y * a) %n
b = b >> 1
a = (a * a) % n
return y
if __name__ == '__main__':
x = power(7, 21, 100)
for m in range(30, 2000):
if power(100, 293, m) == 21:
print(m)
brea... | true |
09961fd82fe02e0cc9960972ae821e3c53b4b20c | Python | drmrgd/matchbox_api_utils | /bin/map_msn_psn.py | UTF-8 | 6,105 | 2.515625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# TODO: We'll need to configure this for other MATCHBox systems once we get
# the all worked out. For now, just take the MATCHBox arg as a
# "placeholder", and use it for live connections. But later, need it to
# figure out which JSON file to load.
""... | true |
c142619f0a40fcac6db1f557cfcd215bae16e2cf | Python | Eustaceyi/Leetcode | /120. Triangle.py | UTF-8 | 826 | 3.125 | 3 | [] | no_license | class Solution:
def minimumTotal(self, triangle: List[List[int]]) -> int:
'''
Modify original
'''
if not triangle:
return 0
for i in range(1, len(triangle)):
for j in range(1,i):
triangle[i][j] += min(triangle[i-1][j], triangle[i-1][j-1... | true |
9852fa95bd7468b8aef5662c33cee827829d03ed | Python | IntroTextMining-GU/Reuters | /COSC586.py | UTF-8 | 6,887 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
"""
Imports
"""
import numpy
import pandas
import sklearn
import nltk
import sklearn
import matplotlib.pyplot as pyplot
# nltk.download()
from nltk.corpus import reuters
from nltk.corpus import stopwords
#from nltk import word_tokenizer
... | true |
4d1bdaf8f451837725a78f9a34f543c96a0ae3f4 | Python | ariadn3/Athena | /Medium puzzles/marsLanderEp2.py | UTF-8 | 2,356 | 3.609375 | 4 | [] | no_license | import sys
surface_n = int(input()) # the number of points used to draw the surface of Mars.
surfaceNodeList = []
flatSurface = (-1, -1)
for i in range(surface_n):
# land_x: X coordinate of a surface point. (0 to 6999)
# land_y: Y coordinate of a surface point. By linking all the points together in a sequenti... | true |
970c91e5772ac2cdf1fff4ba19f0ee7c8af6caa3 | Python | Codestined/sledge | /scripts/main/escentity/_entity.py | UTF-8 | 1,707 | 3.15625 | 3 | [
"MIT"
] | permissive | # Copyright 2019 Frame Studios. All rights reserved.
# Frame v1.0 python implementation by some Pane-in-the-Frame developers.
# pyFrame v1.0
# Project Manager: Caleb Adepitan
# The Frame specifications that govern this implementation can be found at:
# https://frame.github.io/spec/v1/
# Developers Indulgent Program (DI... | true |
c027d37ecd58a21903428862199f02a1c014807f | Python | cdelahousse/Kindle-Display-And-Server | /server/server.py | UTF-8 | 897 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python3
from http.server import HTTPServer, BaseHTTPRequestHandler
from gen_image import gen_png_byte_stream
from config import PORT
import re
class KindleDisplayRequestHandler(BaseHTTPRequestHandler):
def do_GET(client):
path = client.path
m = re.search(r'\d+$', path)
if p... | true |
d5a9590fd248e748071d25d5067e519b2813b794 | Python | stricoff92/freecodecamp-challenges | /python/Basic-Algorith-Scripting/sliceAndSplice.py | UTF-8 | 432 | 4 | 4 | [
"MIT"
] | permissive | '''
You are given two arrays and an index.
Use the array methods slice and splice to copy each element of the first array into the second array, in order.
Begin inserting elements at index n of the second array.
Return the resulting array. The input arrays should remain the same after the function runs.
'''
def ... | true |
fbef012b038412f46dc5c69a97c1d2dddc6ad631 | Python | alexshank/capstone-dsp | /Initial_DSP_Analysis/Tuner.py | UTF-8 | 3,106 | 2.78125 | 3 | [] | no_license | # needed libraries
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
from math import log10, inf
import Helpers as h
# controllable sampling parameters
human_resolution = 3.6 # humans can notice 3.6 Hz differences
N = 512 # N = M (no zero paddi... | true |
1994a8cddec109493e1038a035a74f40991dddb8 | Python | gistable/gistable | /all-gists/2244911/snippet.py | UTF-8 | 4,681 | 3.1875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
#
# Copyright (c) 2012 Dave Pifke.
#
# 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 restriction, including without limitation the
# rights to use, copy, modify, mer... | true |
860d133a7e6662436b6359e45963c4e41e7505d2 | Python | DiegoC386/Algoritmos_Diego | /Taller Estructuras de Control Selectivas/Ejercicio_2.py | UTF-8 | 477 | 4.3125 | 4 | [
"MIT"
] | permissive | """
Escriba un algoritmo, que dado como dato el sueldo de un trabajador,
le aplique un aumento del 15% si su salario bruto
es inferior a $900.000 COP y 12% en caso contrario.
Imprima el nuevo sueldo del trabajador.
Entradas
salariobruto-->float--sb
Salidas
Salarioneto-->float--sn
"""
sb=float(input("Digite salario br... | true |
ad20d3ef3deccd13f6f7b1c45263c0cd3db3a98d | Python | P4SSER8Y/ProjectEuler | /pr038/pr038.py | UTF-8 | 441 | 2.953125 | 3 | [] | no_license | def pr038():
def push(s):
if len(s) > 9:
return None
if sum(1 for c in '123456789' if c in s) == 9:
ret.append(int(s))
ret = []
for x in range(1, 10000):
s = ''
i = 1
while len(s) < 9:
s += str(x * i)
i += 1
push... | true |
9a7fee7558d929916ee0867bb9b9b4c79a9f2d9b | Python | crlesage/cs373-collatz | /SphereCollatz.py | UTF-8 | 3,734 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python3
# ------------------------------
# projects/collatz/SphereCollatz.py
# Copyright (C) 2015
# Glenn P. Downing
# ------------------------------
# -------
# imports
# -------
import sys
# combined Collatz.py and RunCollatz.py
# from Collatz import collatz_solve
# ---
# Global Cache
# ---
"""
C... | true |
21942087a838d1f55b4e613d7a4d4eb8fbec6720 | Python | nansencenter/django-geo-spaas-argo-floats | /argo_floats/management/commands/ingest_argo.py | UTF-8 | 1,318 | 2.5625 | 3 | [] | no_license | from django.core.management.base import BaseCommand, CommandError
from argo_floats.utils import crawl
class Command(BaseCommand):
args = '<url> <select>'
help = '''
Add Argo float to archive.
Args:
<url>: the url to the thredds server
<select>: You can select d... | true |
76599733ca332184e175186a502a057e2e69d4e9 | Python | dongweiming/mp | /2016-12-03/pipe.py | UTF-8 | 217 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | from multiprocessing import Process, Pipe
def f(conn):
conn.send(Pipe())
conn.close()
parent_conn, child_conn = Pipe()
p = Process(target=f, args=(child_conn,))
p.start()
print parent_conn.recv()
p.join()
| true |
00f910cc01d8c54f2baae14d59f378ca3c553fbf | Python | MaxCoder360/tensorboi | /regularizers.py | UTF-8 | 1,936 | 2.859375 | 3 | [] | no_license | from layers import Module
import numpy as np
class Dropout(Module):
__slots__ = 'p', 'mask', '_train', 'grad_input'
def __init__(self, p=0.5):
super().__init__()
self.p = p
self.mask = None
def forward(self, input):
if self._train:
self.mask = np.random.binom... | true |
47e29f7fd618e5a8d68724c7e19a5e998ccff9d9 | Python | amotzkau/docker | /MPDAutoQueue/autoqueue.py | UTF-8 | 4,499 | 2.546875 | 3 | [] | no_license | #! /usr/bin/python3
import musicpd
import argparse, time, socket, random
parser = argparse.ArgumentParser(description="Automatically add songs to the MPD queue", add_help=False)
parser.add_argument("--help", help="show this help message and exit", action="help")
parser.add_argument("-h", "--host", help="MPD host name... | true |
1631295b9aaf6cecc893551b8161df117d0d4c29 | Python | code440/translate_pptx | /translate_pptx.py | UTF-8 | 1,163 | 2.890625 | 3 | [] | no_license | '''
Created on 2018/09/22
@author: 440
'''
import requests
from pptx import Presentation
from time import sleep
# my api key
api_key=""
def translate(str_in, source="ja", target="en"):
url = "https://script.google.com/macros/s/"
url += api_key
url += "/exec?text=" + str_in
url += "&... | true |
9ea2f22622717eeb193c8f874df87e6875f2430c | Python | n0t-a-b0t/packet-sniffer | /sniffer_v2.py | UTF-8 | 5,614 | 2.640625 | 3 | [] | no_license | import socket
import struct
import binascii
def printer(data):
file_obj = open('trace_file.txt', 'a')
file_obj.write(data)
file_obj.close()
return
def tcp(data):
sniff = struct.unpack('!2H2I4H', data[:20])
data = data[20:]
printer("==================TCP Header=================\n")
pr... | true |
fa7ea9f91c145ebd863cd61e0956e22fdb525807 | Python | tdev131287/PythonCode | /mysqlconnect_Final.py | UTF-8 | 1,523 | 2.734375 | 3 | [] | no_license | ##!/usr/bin/python
#import MySQLdb
#
## Connect
#db = MySQLdb.connect(host="172.22.0.16",
# user="root",
# passwd="Sc@1234",
# db="sma")
#
#cursor = db.cursor()
#
## Execute SQL select statement
#cursor.execute("select NAICS_Titles,NAICS from Ship... | true |
825046a27cec6206fd1c290bb14d8f1733c346c0 | Python | felipeserna/holbertonschool-machine_learning | /pipeline/0x01-apis/2-user_location.py | UTF-8 | 833 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python3
"""
GitHub API
Script that prints the location of a specific user.
Your code should not be executed when the file is imported.
"""
import requests
import sys
import time
if __name__ == '__main__':
url = sys.argv[1]
# https://api.github.com/users/holbertonschool
my_status = request... | true |