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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
37468aa39b27a90cb4e0370348c33e722140fafe | Python | lascardua/applied_EA_book | /operators_rep/selection/selection_tournament.py | UTF-8 | 1,439 | 3.375 | 3 | [] | no_license | # -----------------------------------------------------------
# Selection by Tournament
# -----------------------------------------------------------
# Inputs:
# pop_chrom - population of individuals
# pop_fit - fitness value of each individual
# Outputs:
# p1_chrom - chromosome ... | true |
3f542740d593e931dc937dd26617242a25bb61b0 | Python | NickolayVasilishin/repository | /python/ml/pandas/less10.py | UTF-8 | 655 | 3.234375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 15 17:56:06 2016
@author: Nikolay_Vasilishin
From DataFrame to Excel
From Excel to DataFrame
From DataFrame to JSON
From JSON to DataFrame
"""
import pandas as pd
import sys
# Create DataFrame
d = [1,2,3,4,5,6,7,8,9]
df = pd.DataFrame(d, columns = ['Number'])
# Export... | true |
ece36c3b4fa8669945a1afb8c5d75b74b3de104b | Python | isaacdchan/CSS343 | /Huffman.py | UTF-8 | 2,263 | 3.421875 | 3 | [] | no_license | from collections import defaultdict
import sys
class Node:
def __init__(self, count, val=None):
self.left = None
self.right = None
self.count = count
self.val = val
class Tree:
def __init__(self, counts):
self.counts = sorted(counts, key=lambda Node: Node.count)
... | true |
075a599daa05d808f0b90c3f0dce95e77d8d10f3 | Python | Mbank8/DojoAssignments | /Python/Fundamentals/funWithFunctions.py | UTF-8 | 604 | 3.796875 | 4 | [] | no_license |
# def odd_even (a):
# while a < 2001:
# if a % 2 != 0:
# print "Number is %d. This is an odd number." % (a)
# a += 1
# else:
# print "Number is %d. This is an even number." % (a)
# a+= 1
# return(a)
# odd_even(1)
# def multiply(arr,num):
# fo... | true |
59b1f263ef6fe8b5ac65010c44d96f1420b7d59c | Python | stevenwalton/CompMethods | /Python_Notes/Games/hangman.py | UTF-8 | 6,481 | 4.03125 | 4 | [] | no_license | # Hangman game
import random as r
import csv
import os
# First thing we need to do is create the drawings that will be used. Time to employ your ascii art skills.
# You can get more creative and import pictures, but I will leave that for the student to solve. We will
# probably go over pictures and graphs later. Bu... | true |
12e5b250b785817e2a7f6a5154a5b37779da6049 | Python | MasterRoshan/flask-cas-ng | /flask_cas/routing.py | UTF-8 | 5,347 | 2.625 | 3 | [
"BSD-3-Clause"
] | permissive | import flask
from xmltodict import parse
from flask import current_app
from .cas_urls import create_cas_login_url
from .cas_urls import create_cas_logout_url
from .cas_urls import create_cas_validate_url
try:
from urllib import urlopen
except ImportError:
from urllib.request import urlopen
blueprint = flask.... | true |
4a2e24ee1975818d98f2f4bd9ffcdb241cb44808 | Python | xmonader/js-ng | /jumpscale/clients/gedis/gedis.py | UTF-8 | 4,921 | 2.75 | 3 | [] | no_license | from jumpscale.clients.base import Client
from jumpscale.core.base import fields
from jumpscale.god import j
from functools import partial
import json
from typing import List
class ActorProxy:
def __init__(self, actor_name, actor_info, gedis_client):
"""ActorProxy to remote actor on the server side
... | true |
b2f63e1eb2d1da0b21e2bf4173b030511c7155f3 | Python | Leahxuliu/Data-Structure-And-Algorithm | /Python/巨硬/A1链表深拷贝.py | UTF-8 | 1,919 | 3.734375 | 4 | [] | no_license | '''
链表深copy,可能有环,也可能没有环
'''
'''
是否有重复数?
若无重复数,用一个visited来记录访问点的值 行不通!因为没法curr.next = cycle beginer
1. 判断是否有环
2. 若有环,找环交点,记录环交点
3. 构建新链表
'''
class Node:
def __init__(self, val):
self.val = val
self.next = None
def copy_node(head):
'''
deep copy NodeList
return new root
'''
... | true |
d66c55d189f72d1d3be558982695ab1fd47b7178 | Python | pi408637535/Algorithm | /com/study/algorithm/daily/51. N-Queens.py | UTF-8 | 1,338 | 3.203125 | 3 | [] | no_license | class Solution(object):
def solveNQueens(self, n):
"""
:type n: int
:rtype: List[List[str]]
"""
if n < 1: return []
self.res = [] # res结构[[],[],...],每个元素的res[i]代表着一个解。每个解res[i],每一个元素代表着一个col
self.cols = set()
self.pie = set()
self.na = set()
... | true |
4361eecfcb4b58122b29383805981b1fa04c42f8 | Python | michelbauer/pypet | /pypet/utils/comparisons.py | UTF-8 | 5,434 | 2.90625 | 3 | [
"BSD-3-Clause"
] | permissive | """Module containing utility functions to compare parameters and results"""
__author__ = 'Robert Meyer'
from collections import Sequence, Mapping, Set
try:
from future_builtins import zip
except ImportError: # not 2.6+ or is 3.x
try:
from itertools import izip as zip # < 2.5 or 3.x
except Impor... | true |
d0499d282f7f17e4276beaf093da21f21105f355 | Python | snsk/_sandbox | /check_deck_reservement/main.py | UTF-8 | 1,041 | 2.78125 | 3 | [] | no_license | from get_chrome_driver import GetChromeDriver
from selenium import webdriver
import sys
get_driver = GetChromeDriver()
get_driver.install()
def driver_init():
options = webdriver.ChromeOptions()
options.add_argument('--headless')
options.add_argument('--log-level=3')
return webdriver.Chrome(options=op... | true |
b9258881ed7b43d83f4ac5cbab61e820b8e11db2 | Python | jaychsu/algorithm | /lintcode/647_substring_anagrams.py | UTF-8 | 931 | 3.421875 | 3 | [] | no_license | """
REF: https://leetcode.com/problems/find-all-anagrams-in-a-string/discuss/92007/
"""
class Solution:
def findAnagrams(self, s, t):
"""
:type s: str
:type t: str
:rtype: List[int]
"""
ans = []
if not s or not t or len(t) > len(s):
return ans
... | true |
35cb7c85f468f2e552d927c7a95d8fbff3c39939 | Python | kimgwanghoon/openbigdata | /01_jumptopy/chap05/ex/ex03.py | UTF-8 | 297 | 3.453125 | 3 | [] | no_license | while True:
input_su=int(input("양수를 입력하세요 (종료-1): "))
if input_su!=-1:
if input_su%10==0:
print("입력한 숫자는 10의 배수입니다.")
else:
print("입력한 숫자는 10의 배수가 아닙니다")
else:
break | true |
09ea6bc63e9d7f7257cb5786c4045909d957cc97 | Python | duracell/challenges | /cstutoringcenter.com/crypto/15/15.py | UTF-8 | 190 | 3.171875 | 3 | [] | no_license | #!/usr/bin/env python
def main():
secret_num = 7
char_list = [71, 72, 77, 25, 79, 62, 75, 82, 25, 76, 62, 60, 78, 75, 62]
for char in char_list:
print chr(char + secret_num),
main()
| true |
9e5b6c0ad7465073f5b2a0e304003aaf011bfbde | Python | mangelajo/neutrontool | /neutrontool/colors.py | UTF-8 | 413 | 2.78125 | 3 | [] | no_license | class Colors:
HEADER = '\033[95m'
BLUE = '\033[94m'
GREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
color_mat = {'header':HEADER ,'blue':BLUE, 'green':GREEN ,
'warning':WARNING ,'fail':FAIL}
@staticmethod
def color(color, string):
... | true |
8591273ed1ea38ea4937a4cfba36562e154ff4b0 | Python | AutomatedTester/rogoto-py | /test/test_parser.py | UTF-8 | 2,426 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | from rogoto import RogotoParser
from rogoto import RogotoParserException
def test_invalid_syntax():
parser = RogotoParser()
try:
parser.parse('goblydegoop')
raise AssertionError('Should have thrown a RogotoParserException')
except RogotoParserException:
pass
def test_pendown():
... | true |
b82dd2de1c9e536f67e2765b79442e1683f0389a | Python | NguyenHan123-Aston/cp1404practicals | /prac_01/broken_score.py | UTF-8 | 538 | 3.671875 | 4 | [] | no_license | """
CP1404 3rd practical
Pseudo code for score calculating
Nguyen Hoang Ba Han - 13587248
"""
SCORE = (float(input("Enter score: ")))
print(SCORE)
# Using if-else format to find the result for each score input
if SCORE < 0 or SCORE > 100:
print("Invalid score. Please try again")
else:
if SCORE >= 90:
p... | true |
8c6075bb2fb1ea284f1efdf08feaa70768fb5a35 | Python | AbdurNawaz/Policy-Gradient | /reinforce.py | UTF-8 | 2,181 | 2.765625 | 3 | [] | no_license | import numpy as np
import gym
import time
import Policy
import matplotlib.pyplot as plt
from collections import deque
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Categorical
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
env = gym.make('... | true |
e9171fdbb1b7088609290dedb5e0f4dc620b64bb | Python | mirastroie/Formal_Languages_and_Automata_Theory | /Conversion_NFA_DFA/Code.py | UTF-8 | 6,382 | 2.890625 | 3 | [] | no_license | f = open("tests.in")
def dict_index(positions,value):
for cheie, val in positions.items():
if value == val:
return cheie
def conversion():
global q0, matrix,n,m
# Step 1
# ne luam o coada in care vom avea initial doar starea initiala
Q=[q0]
# cream transition_matrix - un... | true |
074f2f8361c5319b107d69f7a42a8d09549f4003 | Python | Qingyan1218/GAN | /wgan.py | UTF-8 | 4,414 | 2.75 | 3 | [] | no_license | import argparse
import os
import numpy as np
import torchvision.transforms as transforms
from torchvision.utils import save_image
from torch.utils.data import DataLoader
from torchvision import datasets
import torch
from generator import Generator
from discriminator import Discriminator
os.makedirs(... | true |
371c9fb4e475f8d10ce36dd0df61e953acfcb83f | Python | Introduction-to-Programming-OSOWSKI/2-5-comparisons-ReidBarbeln2022 | /main.py | UTF-8 | 606 | 4 | 4 | [] | no_license | def greaterThan(x, y):
if x > y :
return True
else:
return False
print (greaterThan(3, 4))
def lessThan(x, y):
if x < y :
return True
else:
return False
print (lessThan(2, 3))
def equalTo(x, y):
if x == y :
return True
else:
ret... | true |
f1bb4966551c3367449db77a436736af29016060 | Python | vincent-wong21/attendance-system | /FaceRecognition.py | UTF-8 | 2,071 | 2.703125 | 3 | [] | no_license | from face_recognition.face_detection_cli import image_files_in_folder
import face_recognition_knn
import cv2
import os
import attendance_window
import overlay
def face_detection(img):
cascade_path = "haarcascade_frontalface_default.xml"
face_cascade = cv2.CascadeClassifier(cascade_path)
img_gra... | true |
6acec7ad921bcb7472587f7975c8907520287c34 | Python | hirajanwin/LeetCode-5 | /1536. Minimum Swaps to Arrange a Binary Grid/main.py | UTF-8 | 703 | 2.734375 | 3 | [
"MIT"
] | permissive | class Solution:
def minSwaps(self, grid: List[List[int]]) -> int:
m, n = len(grid), len(grid[0])
d = collections.defaultdict(int)
z = [0] * m
for i in range(m):
for j in range(n-1, -1, -1):
if grid[i][j] == 0:
z[i] += 1
... | true |
2e01451943fe32a3b26b29a05f64bac6ce8e2715 | Python | MariaMedvede/coursera | /week3/QuadraticEquation-1.py | UTF-8 | 245 | 3.4375 | 3 | [] | no_license | import math
a = float(input())
b = float(input())
c = float(input())
d = b**2-4*a*c
if d > 0:
result = ((-b - math.sqrt(d))/(2*a), (-b + math.sqrt(d))/(2*a))
print(min(result), max(result))
elif d == 0:
print(-b/(2*a))
| true |
e884cea40a8a5c36b0545ba724c1b9f2bc645f8b | Python | eazapata/python | /Ejercicios python/PE7/PE7E10.py | UTF-8 | 465 | 4.34375 | 4 | [] | no_license | #Escribe un programa que te pida una palabra o número,
#pase por parámetro estos datos a una función, y ésta te
#diga si es o no palíndroma o capicúa. El programa
#principal imprimirá el resultado de la función:
resul=""
def capicua(x):
if (x==x[::-1]):
resultado=print(x,"es capicúa o palíndroma")
else:... | true |
6e0e5037e170b527b46ff4a017bcc92073c3efb1 | Python | arnavg115/nlp-api | /app.py | UTF-8 | 427 | 2.515625 | 3 | [] | no_license |
from flask import Flask, request, jsonify
import transformers
summarizer = transformers.pipeline("summarization")
app = Flask(__name__)
@app.route("/", methods=["POST"])
def main():
json:dict = request.get_json(force=True)
text = json.get("text")
res = summarizer(text,min_length=30,max_length=100) if t... | true |
ae52e526c8ea1a983b7a7a6755b9f17c3db16f0c | Python | bunshue/vcs | /_4.python/__code/科班出身的AI人必修課:OpenCV影像處理/chapter22/例22.1.py | UTF-8 | 1,015 | 2.90625 | 3 | [] | no_license | import numpy as np
import cv2
from matplotlib import pyplot as plt
#随机生成两组数组
#生成60粒直径大小在[0,50]之间的xiaoMI
xiaoMI = np.random.randint(0,50,60)
#生成60粒直径大小在[200,250]之间的daMI
daMI = np.random.randint(200,250,60)
#将xiaoMI和daMI组合为MI
MI = np.hstack((xiaoMI,daMI))
#使用reshape函数将其转换为(120,1)
MI = MI.reshape((120,1))
#将MI的数据类型转换为flo... | true |
2fa04ff9179530e435b3447518a84d0a5149307a | Python | BrianPugh/pugh_torch | /pugh_torch/tests/datasets/test_base.py | UTF-8 | 1,078 | 2.625 | 3 | [
"MIT"
] | permissive | import pytest
from pugh_torch.datasets import Dataset
class DummyDataset(Dataset):
def __init__(self, *args, **kwargs):
pass
@pytest.fixture
def dummy(mocker, tmp_path):
mocker.patch("pugh_torch.datasets.base.ROOT_DATASET_PATH", tmp_path)
return DummyDataset()
def test_path(dummy, tmp_path):
... | true |
39aae7cb203358013e08fc3cc9e0a50794862c7e | Python | Shantalai/HTTP-DNS-Client-and-Server | /HTTP/httpserver.py | UTF-8 | 3,337 | 2.890625 | 3 | [] | no_license | #! /usr/bin/env python3
# HTTP Server
# Anastasia Kaliakova ak983
# Reference
import sys
import socket
import datetime, time
import os.path
# Read server IP address and port from command-line arguments
serverIP = sys.argv[1]
serverPort = int(sys.argv[2])
dataLen = 1000000
# Create server socket TCP
serverSocket =... | true |
b2e782f665ad3a7c1e1d553fedf085f00ceaa078 | Python | wlowry88/ml_side_project | /scripts/load_albums.py | UTF-8 | 823 | 2.640625 | 3 | [] | no_license | import sys, os
from os.path import realpath, join, dirname
import pandas as pd
sys.path.insert(0, join(dirname(realpath(__file__)),'../'))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ml_project.settings")
import django
django.setup()
from reviews.models import Album
def save_album_from_row(album_row):
al... | true |
a50176e3b2c3f4255dbb63fcf2580ee52c5ca150 | Python | NSLS-II-BMM/BMM-beamline-configuration | /wiki-backup/backup.py | UTF-8 | 2,529 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python3
import re, requests, os
def download_file(url):
local_filename = url.split('/')[-1]
# NOTE the stream=True parameter below
with requests.get(url, stream=True) as r:
r.raise_for_status()
with open(local_filename, 'wb') as f:
for chunk in r.iter_content(ch... | true |
94aa6f67a9bdb8e5a15aa11fb582d88056dfbfd9 | Python | BToss/LanguageAcquisitionApp | /formant_finder.py | UTF-8 | 1,887 | 2.84375 | 3 | [] | no_license | #TODO: translate from python to java
#Step 1 Person produces vowel as input and is passed into Kiss FFT
#Step 2 is utilizing the c library Kiss FFT
#go here to get it: https://github.com/itdaniher/kissfft
#FT takes input and produces values
# AudioAnalyzer/app/src/main/jni/AudioAnalyzerHelperJNI.cpp
# The path above... | true |
9a98a30b6dc92c9f2d4754eed1fcfc81470b9f85 | Python | sebhoerl/map-matching | /06_analysis.py | UTF-8 | 1,965 | 2.8125 | 3 | [] | no_license | import numpy as np
import pickle
import matplotlib.pyplot as plt
from tqdm import tqdm
def analyze(matching, osm_data, tomtom_data, threshold, aggregator, aggregator_name):
plt.figure()
aggregated = {}
n = 0
for tomtom_id, osm_id in tqdm(matching.items()):
osm_speed = osm_data[osm_id][3]
... | true |
53e0bb6842119c698bd384dfc26d0123d20a7558 | Python | vishrutkmr7/DailyPracticeProblemsDIP | /2023/01 January/db01272023.py | UTF-8 | 614 | 4.09375 | 4 | [
"MIT"
] | permissive | """
Given an integer array, nums, return the total number of integers within nums that have an even number of digits.
Ex: Given the following nums…
nums = [1, 12, 123], return 1 (12 is the only integer with an even number of digits).
Ex: Given the following nums…
nums = [1, 32, 3492, 23], return 3.
"""
class Solu... | true |
2b3415ebe769894d19195d47c3c47f85b38a4be3 | Python | xldrx/text.mirror | /iPhone_Backup/location.py | UTF-8 | 1,662 | 2.515625 | 3 | [] | no_license | #! /usr/bin/env python -u
# coding=utf-8
from datetime import datetime
import dateutil.parser
import pytz
__author__ = 'xl'
import xml.etree.ElementTree as ET
namespaces = {
'': "http://www.opengis.net/kml/2.2",
'gx': "http://www.google.com/kml/ext/2.2",
'kml': "http://www.opengis.net/kml/2.2",
'atom... | true |
7d170d3bb9f4ff8efceccc8e5639784fef55d749 | Python | billiecn/ABCNN | /src/setup.py | UTF-8 | 15,304 | 2.609375 | 3 | [] | no_license | # coding=utf-8
import numpy as np
import os
import pandas as pd
import re
import torch
import torch.nn as nn
import yaml
from gensim.models import KeyedVectors
from gensim.models import FastText
from nltk.corpus import stopwords
from tqdm import tqdm
from model.attention.abcnn1 import ABCNN1Attention
from model.atten... | true |
a567a30ec426443d0f1467432af35094b65873e1 | Python | Reena-Kumari20/Nested_function | /hey.py | UTF-8 | 136 | 2.953125 | 3 | [] | no_license | def outerFunction(text):
def innerFunction():
print(text)
innerFunction()
text="Hey!"
outerFunction(text) | true |
1eaf7444da8cd36660c8d18025e42c612a439cad | Python | a-lchen/bluetoothLE | /beacons.py | UTF-8 | 1,861 | 2.90625 | 3 | [] | no_license | from bluetooth.ble import BeaconService
import triangulate
import pygame
from time import sleep
class Beacon(object):
def __init__(self, data, address):
self._uuid = data[0]
self._major = data[1]
self._minor = data[2]
self._power = data[3]
self._rssi = data[4]
s... | true |
f395e40c8b3cb67eb79fdce23b7ee76f528c37a7 | Python | shiyuli/LibTorchDemo | /Python/tutorials/regression.py | UTF-8 | 1,494 | 3.28125 | 3 | [
"MIT"
] | permissive | # encoding: utf-8
# using Python 3.7
import torch
from torch.autograd import Variable
import torch.nn.functional as F
import matplotlib.pyplot as plt
# torch.unsqueeze
x = torch.unsqueeze(torch.linspace(-1, 1, 100), dim=1) # x data (tensor), shape=(100, 1)
y = x.pow(2) + 0.2 * torch.rand(x.size()) # noisy y data (ten... | true |
c400bfbae61d270014f8c788652f062952098a0e | Python | paulemms/Easy21Silver | /plots.py | UTF-8 | 4,745 | 2.84375 | 3 | [] | no_license | import pdb
import sys
import numpy as np
import matplotlib.pyplot as pyplot
from mpl_toolkits.axes_grid1 import make_axes_locatable
import matplotlib.cm as cm
import mc
import td
import fa
import environment as env
def standard_plots(num_episodes=100000):
"""Plots of the value function and optimal policy for each... | true |
f65598b25c1834869e7cdba471dd52bd39069465 | Python | vucalur/ICE-Sample | /client.py | UTF-8 | 3,592 | 2.71875 | 3 | [] | no_license | #!/usr/bin/python
import sys, traceback, Ice
Ice.loadSlice("./slice/MiddlewareTestbed.ice")
import MiddlewareTestbed
from MiddlewareTestbed import *
owned = {}
def performCustomItemOperation(item):
if item.ice_isA("::MiddlewareTestbed::ItemA"):
# void actionA(float a, out long b);
item = MiddlewareTestbed.Ite... | true |
b9bd672dd4337852c0a1982d64791eed40571269 | Python | Viktoria-payture/Geekbrains | /Lesson03/Task01.py | UTF-8 | 683 | 4.28125 | 4 | [] | no_license | """
Реализовать функцию, принимающую два числа (позиционные аргументы) и выполняющую их деление.
Числа запрашивать у пользователя, предусмотреть обработку ситуации деления на ноль.
"""
def splitting(a, b):
try:
return a / b
except ZeroDivisionError:
return "Нельзя делить на ноль!"
... | true |
352210e470d673a16ae8c33a28d4742d106ba25f | Python | sinemsahn/pythondepo | /blackhat/9_fun_with_internet_explorer/mitb.py | UTF-8 | 4,717 | 2.578125 | 3 | [] | no_license | import win32com.client
import time
import urlparse
import urllib
data_receiver = "http://localhost:8080/" # kimlik bilgilerini hedef sitelerimizden alacak web sunucusu olarak tanimliyoruz
target_sites = {} # hedef isteler sozlugu
target_sites["www.facebook.com"] = {"logout_url" : None, # bir kullaniciyi oturumu kapat... | true |
4804e6b49aab943ed10217e3ce963adcbbca8f44 | Python | dvill03/final-project-fourdudebros | /frontend/Sarcix/scripts/test_print_a_run.py | UTF-8 | 557 | 3.34375 | 3 | [] | no_license | # Program extracting all columns, row names and scores in Python script.
# All this does is read each row/column pair and the related score.
# This will be integrated into loading the database.
import xlrd
loc = ("[insert path to this file]/analysis_530_firstpage.xlsx")
wb = xlrd.open_workbook(loc)
sheet = wb.sheet... | true |
ca039de2e871db354e606c84ff05f2ac63507047 | Python | SamIAm10/Bulk-Email-Sender | /src/emailer.py | UTF-8 | 861 | 3.015625 | 3 | [] | no_license | import yagmail
# enter the Gmail you are sending from
sender_email = "testemail6213@gmail.com"
# enter the names and emails you are sending to
recipients = [
('Name1', 'testemail6213@gmail.com', 'Position1')
('Name2', 'testemail5354@gmail.com', 'Position2')
]
# enter the filepaths of the files you wa... | true |
bd7ce1443ffd8e2ae60faaa3d36bc91d954bc5c5 | Python | ArsenPetrosyanAPK/Homework.GitHub | /Lesson7.py | UTF-8 | 1,617 | 3.6875 | 4 | [] | no_license | #a = input('Please enter firt number: ')
#b = input('(+), (-), (*), (/): ')
#c = input('Please enter second number')
#if b == ('+'):
# print(int(a) + int(c))
#if b == ('-'):
# print(int(a) - int(c))
#if b == ('*'):
# print(int(a) * int(c))
#if b == ('/'):
# print(int(a) / int(c))
#import sys
#x = (5)
#print(sys.g... | true |
4637c3f8ce8acbb576ec0410d151c59be01cfca6 | Python | InsaneLoafer/HogwartsLG4_ZT | /assignments/python_practice/first_practice/fight_game/game_fun.py | UTF-8 | 1,195 | 4.0625 | 4 | [] | no_license | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time : 2020/10/21 10:52
# @Author : ZhangTao
# @File : game_fun.py
import random
def game_fight(enemy_hp, enemy_power):
# 定义4个变量,分别为玩家血量/攻击力,敌人血量/攻击力
my_hp = 1000
my_power = 200
# 打印敌人的血量及攻击力
print(f'敌人的血量为{enemy_hp},敌人的攻击力为{enemy_power}')
... | true |
a84638c76bef54c5247b6690162681942490c739 | Python | dtbinh/Mocad-1 | /SCI/Simulateur/particles/Particle.py | UTF-8 | 1,373 | 2.671875 | 3 | [] | no_license | import random
from Simulateur.core.Agent import Agent
colors = ['black','red','blue','green','cyan', 'yellow', 'magenta']
colorIndex = 0
class Particle(Agent):
def __init__(self, _env, _sma):
global colors
global colorIndex
newColor = colors[colorIndex]
colorIndex += 1
if colorIndex >= len(colors)... | true |
d93b4f14e57a0c69cb9b4f6775057a7e34812671 | Python | yashwanth033/competitive_Programming | /competitive programming/Week1/Day1/HighestProductOfThree.py | UTF-8 | 906 | 3.375 | 3 | [] | no_license | def highest_product_of_3(input_ints):
if len(input_ints) < 3:
raise ValueError('Not enough numbers in list')
high = max(input_ints[0], input_ints[1])
low = min(input_ints[0], input_ints[1])
hp_of_2 = input_ints[0] * input_ints[1]
lp_of_2 = input_ints[0] * input_ints[1]
hp_of_3 = input_i... | true |
601b9d49def3b0501fc8fce5437eb562c074f139 | Python | raoshashank/Navigation-using-DQN | /other_files/SumTree.py | UTF-8 | 3,258 | 3.328125 | 3 | [] | no_license | '''
This Sum Tree implementation is from Simonini Thomas's Deep RL course: https://github.com/simoninithomas/Deep_reinforcement_learning_Course/blob/master/Dueling%20Double%20DQN%20with%20PER%20and%20fixed-q%20targets/Dueling%20Deep%20Q%20Learning%20with%20Doom%20%28%2B%20double%20DQNs%20and%20Prioritized%20Experience%... | true |
ceea2367345bf57bbf2860185546a40789b96490 | Python | thegraycoder/rectangles | /main.py | UTF-8 | 473 | 3.828125 | 4 | [] | no_license | from models import Point, Rectangle
if __name__ == '__main__':
# Point p1 and p2 create left to right diagonal of rectangle r1
p1 = Point(0, 4)
p2 = Point(4, 0)
r1 = Rectangle(p1, p2)
# Point p3 and p4 create left to right diagonal of rectangle r2
p3 = Point(1, 3)
p4 = Point(3, 1)
r2 =... | true |
b3110c8ea279ebd09f7fd45c442e47450e2370bd | Python | adaveniprashanth/MyData | /Python_training/INTEL_data/Dumped_from VNC/excel_extract.py | UTF-8 | 6,862 | 2.59375 | 3 | [] | no_license | import pandas as pd
import numpy as np
from openpyxl import load_workbook,Workbook
from openpyxl.styles import PatternFill,Alignment
import sys
from datetime import date
print("you have to install the below packages to run")
print("pandas,numpy,openpyxl and xlrd")
print("pip install pandas\npip install numpy\npip inst... | true |
e07006f91c412b1d99d3609152e3f0a758e98d9b | Python | hadisamadzad/queraml | /problems/Key Compression/main.py | UTF-8 | 585 | 3.234375 | 3 | [] | no_license | from filereader import read
from filereader import readAndSplitLines
# functions
def encode(text):
words = input.replace('.','').replace(',','').replace('\'', '').replace('-', '').split()
dict = {}
numbers = []
wordCounter = 0
for word in words:
isNewWord = dict.get(word, 'Yes')
if... | true |
f3c5b2deca8e963e01351dfa95d4302011c004f6 | Python | standardgalactic/R-GAP | /models/FCN3.py | UTF-8 | 983 | 2.578125 | 3 | [] | no_license | import torch.nn as nn
from collections import OrderedDict
class FCN3(nn.Module):
def __init__(self):
super(FCN3, self).__init__()
act = nn.LeakyReLU(negative_slope=0.2)
self.body = nn.ModuleList([
nn.Sequential(OrderedDict([
('layer', nn.Linear(784, 1000, bias=F... | true |
35a2839727637152390f27f1c176df63b0c5a6c3 | Python | kr-colab/msUtils | /splitMsOutputIntoWindows.py | UTF-8 | 4,620 | 2.671875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import sys, gzip
msFile,numWins,winFilePrefix = sys.argv[1:]
numWins = int(numWins)
def getSnpWindowAssignments(positions,numWins):
delta = 1.0/numWins
if numWins > 10000:
sys.exit("Let's not get carried away with the number of windows . . .\n")
winStart = 0.0
winEnd = 0+... | true |
2f563e7cfffcd371dfcfe43f56a70c50a57dcd44 | Python | tartiflette/tartiflette | /tartiflette/language/validators/query/input_object_field_uniqueness.py | UTF-8 | 1,495 | 2.625 | 3 | [
"MIT"
] | permissive | from tartiflette.language.validators.query.rule import (
June2018ReleaseValidationRule,
)
from tartiflette.language.validators.query.utils import find_nodes_by_name
from tartiflette.utils.errors import graphql_error_from_nodes
class InputObjectFieldUniqueness(June2018ReleaseValidationRule):
"""
This valid... | true |
26488993607ffd74570b7136a8833ec753a41720 | Python | Kawser-nerd/CLCDSA | /Source Codes/AtCoder/abc033/C/4793930.py | UTF-8 | 107 | 3.296875 | 3 | [] | no_license | s = input()
arr = s.split("+")
cnt = 0
for x in arr:
if "0" not in x:
cnt+=1
print(cnt) | true |
e8a0f9624380e0ea7b74febeb0a873a7c2e3f5bf | Python | cameronkelahan/AstroResearch | /kerasHeatMaps.py | UTF-8 | 3,739 | 2.90625 | 3 | [] | no_license | import numpy as np
from keras.models import load_model
from sklearn import metrics
import matplotlib.pyplot as plt
# Plot heat map for given model; pass title and saveName
def plot(model, title, saveName):
# Create the x and y axis values (0 - 1 stepping by .1)
# xAxis = np.linspace(0, 1, num=11)
# yAxis =... | true |
65e5b9f9ee0b127134aceea181db1a7bdae36122 | Python | Branch321/Throwing_Ds | /player.py | UTF-8 | 2,003 | 3.203125 | 3 | [] | no_license | # This module will contain a "player" class that will hold all statuses/attributes
import configparser
import datetime
class player:
"""
# Purpose: This class will hold all the player stats and statuses
# Variables: last_roll - holds the player's last roll
# benny_counter - # of bennies pla... | true |
38dd257514bc4cf2c403ea1f96ec0ab9b1be1727 | Python | gescobedo/ddpg-hgru4rec | /modules/evaluate.py | UTF-8 | 4,653 | 2.921875 | 3 | [
"MIT"
] | permissive | import torch
from scipy.special.cython_special import logit
def get_recall(indices, targets, batch_wise=False):
""" Calculates the recall score for the given predictions and targets
Args:
indices (Bxk): torch.LongTensor. top-k indices predicted by the model.
targets (B): torch.LongTensor. act... | true |
7189c092484ed1c3c9599ee85ca70db82951dc7b | Python | xingyuyinxin/AI | /Resnet.py | UTF-8 | 2,727 | 2.71875 | 3 | [] | no_license | import keras
from keras.layers import Dense, Conv2D, BatchNormalization, Activation
from keras.layers import AveragePooling2D, Input, Flatten
from keras.optimizers import Adam
from keras.models import Model
from keras.datasets import cifar10
import numpy as np
import os
from keras.regularizers import l2
(x_train, y_tr... | true |
2292b1e8c5080fbb1169f40cd158e8b33d976f2a | Python | mounikamoparthi/DjangoQuotes | /apps/app_quotes/models.py | UTF-8 | 1,901 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from ..app_login.models import User
from django.db import models
# Create your models here.
class QuoteManager(models.Manager):
def addquotes(request,postData,sessiondata):
print postData
results = {'status': True, 'errors': []}
... | true |
f303ce5967f09daedb58a6fb85907fdb6bd17b1c | Python | junwanghust/PythonCrashCourse-Exercises | /8/def_8_6.py | UTF-8 | 465 | 4.4375 | 4 | [] | no_license | # 编写一个名为city_country()的函数,它接受城市的名称及其所属的国家。
# 这个函数应返回一个格式类似于下面这样的字符串:"Santiago, Chile"
# 至少使用三个城市-国家对调用这个函数,并打印它返回的值。
def city_country(city, country):
return city + ', ' + country
print(city_country('Qing dao', 'China'))
print(city_country('Shang hai', 'China'))
print(city_country('New york', 'America'))
| true |
4329f32404377bd19629ec25558361899175a577 | Python | NateWeiler/Resources | /Python/Lexicon/Lexicon-2/lexicon/__init__.py | UTF-8 | 924 | 2.890625 | 3 | [] | no_license | def scan(sentence):
north = ('direction', 'north')
south = ('direction', 'south')
east = ('direction', 'east')
west = ('direction', 'west')
go = ('verb', 'go')
walk = ('verb', 'walk')
run = ('verb', 'run')
kill = ('verb', 'kill')
eat = ('verb', 'eat')
the = ('stop', 'the')
in_ = ('stop', 'in')
of = ('stop... | true |
ba94f1528e8695d3869e85c297c3a5a8cf28860b | Python | Lokeshwarrobo/Data-Structures | /Circular_Linked_List.py | UTF-8 | 3,338 | 3.703125 | 4 | [] | no_license | class Node:
def __init__(self, data):
self.data = data
self.next = None
class Circular_Linked_List:
def __init__(self):
self.head = None
def append(self, data):
if self.head is None:
self.head = Node(data)
self.head.next = self.head
else:... | true |
fc262adc7e1c8b7fff39b2443a91dabe91ef6cdc | Python | li199773/Web-Crawler | /6 WebSpider基础知识讲解/03 parse的使用和介绍.py | UTF-8 | 1,754 | 3.578125 | 4 | [] | no_license | """
url 只能由特定的字符组成,字母,数字,下划线
如果出现其他的,比如¥ 空格 中文等,就要对其进行编码
url.parse
.quote:解码函数,将中文转换成%xxx
.unquote:编码函数,将%xxx转化成指定的字符
.unlencode:给一个字典,将字典拼接成query_string,并且实现自动编码的功能,(有些网址中不能出现非法的字符 )
"""
import urllib.parse
# image_url = 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fi.serengeseba.com%2Fuploads%2Fi_... | true |
6fc01bd7a0854658f68d5f0877755c566518d2ba | Python | Pedroh097/Mi-Primer-Programa | /vocales_y_consonantes.py | UTF-8 | 441 | 3.984375 | 4 | [] | no_license |
texto_del_usuario = input("Dime una texto:")
puntos = "."
comas = ","
espacios = " "
n_puntos = 0
n_comas = 0
n_espacios = 0
for signo in texto_del_usuario:
if signo in puntos:
n_puntos += 1
if signo in comas:
n_comas += 1
if signo in espacios:
n_espacios += 1
print("Los pu... | true |
214dbf422df8090499308cf1d7345136568935eb | Python | ViniciusLima94/PythonInformationTheoryModule | /infoPy/utils/tools.py | UTF-8 | 2,100 | 3.421875 | 3 | [] | no_license | import numpy as np
def silverman(Nvar, Nobs):
return (Nobs * (Nvar + 2) / 4.)**(-1. / (Nvar + 4))
def normalize_data(x):
#####################################################################################################
# Description: Normalize each column of the data matrix X
# > Inputs:
# x: Data matrix m... | true |
9461ffece7f8a30b2496a1239cb5fc32c6e6f6c5 | Python | varunchodanker/ThreeAnimators | /tools/font_centering_pos.py | UTF-8 | 723 | 2.96875 | 3 | [
"MIT"
] | permissive | from manim import *
""" Contains dictionaries adjusting the position of letters of a particular
font, as ``Text(letter, font=...)`` centered with reference to a circle with
attr ``radius=0.5``
"""
FUTURA_CENTERING_POS = {
"A": 0.04 * UP, "B": 0.03 * RIGHT, "C": 0.04 * LEFT, "D": 0.04 * RIGHT,
"E": 0.01 * DOWN... | true |
4e0d7e59f2f91d56c4f0fb77df6e827ec896e319 | Python | FelixSchwarz/smartconstants | /smart_constants_test.py | UTF-8 | 6,701 | 2.859375 | 3 | [
"MIT"
] | permissive | # -*- coding: UTF-8 -*-
# Copyright 2010-2013, 2017, 2019 Felix Schwarz
# The source code in this file is licensed under the MIT license.
from __future__ import absolute_import, print_function, unicode_literals
from pythonic_testcase import *
from smart_constants import attrs, BaseConstantsClass
class DummyConstan... | true |
79d806f7bfdac9865d287d05b58ceb9d936167aa | Python | taanh99ams/taanh-fundamental-c4e15 | /SS01/SS01 Asignment/multicircle.py | UTF-8 | 126 | 3.375 | 3 | [] | no_license | from turtle import *
color("green")
shape("turtle")
speed(500)
for i in range (6):
circle(100)
left(60)
mainloop()
| true |
b6d0537a4427212e55b349016eebbf3130c7c698 | Python | eomjinyoung/bigdata3 | /bit-python01/src08/calculator.py | UTF-8 | 172 | 3.484375 | 3 | [] | no_license | # 계산 모듈
def plus(a, b):
return a + b
def minus(a, b):
return a - b
def multiple(a, b):
return a * b
def divide(a, b):
return a / b
| true |
4569eb905a0b84c9f9d133f26764454154c5bf9c | Python | ushham/MScFireSpreadModel | /Fire_Locations/ConvexHull.py | UTF-8 | 1,412 | 2.8125 | 3 | [
"MIT"
] | permissive | import pandas as pd
import numpy as np
from scipy.interpolate import griddata
from Mapping_Tools import RasterConvert as rc
def CreateSurface(fileloc, filename, dumploc, coord1, coord2, sizex, sizey, boolian):
#Opens file, or expected df to be passed, and returns a sursafe of expected fire based on FRP
#Saves ... | true |
45a6447dce9074212586d308f84bb677550882e9 | Python | rose317/miniweb | /demo_装饰器.py | UTF-8 | 323 | 3.140625 | 3 | [] | no_license | import time
def set_func(func):
def call_func():
start_time = time.time()
func()
stop_time = time.time()
print("函数总共运行时间%f" % (stop_time-start_time))
return call_func
@set_func
def test1():
print("这是test1")
for i in range(100000):
pass
test1() | true |
b1a97d28f4bf4184c57b1eb3dbfabd5e3b0beac1 | Python | xy990/bigdata | /boros/man0616.py | UTF-8 | 1,166 | 3.03125 | 3 | [] | no_license | #!/usr/bin/env python
import csv
import sys
reader = csv.reader(sys.stdin)
# Skip first row
next(reader, None)
brooklyn = {'2006':0,'2007':0,'2008':0,'2009':0,'2010':0,'2011':0,'2012':0,'2013':0,'2014':0,'2015':0,'2016':0}
for entry in reader:
BORO_NM = str(entry[13])
year = str(entry[1])
if BORO_NM == 'M... | true |
1b14761c7a13ab3459e98462bee52802dcf4f123 | Python | quimey/itchallenge-2018 | /china/unshuffle4.py | UTF-8 | 744 | 2.578125 | 3 | [] | no_license | from PIL import Image
import os
import random
images = []
img = []
N = 200
for filename in os.listdir('sarasas'):
if len(images) >= N:
break
if filename[-3:] == 'pgm':
continue
try:
im = Image.open(os.path.join('sarasas', filename))
img.append(im)
images.append(im.lo... | true |
e5ca0fc360330ef766c6cb85e5262aa270f1fe8c | Python | tonyfresher/graph-algo | /net_shortest_path/main.py | UTF-8 | 3,122 | 3.40625 | 3 | [] | no_license | from collections import deque
class Net:
@classmethod
def from_lists(self, lists):
net = self()
net.topology, net.weights = self._convert_lists_to_topology(lists)
return net
@staticmethod
def _convert_lists_to_topology(lists):
vertex_count = len(lists)
topolo... | true |
9a06d6372a0ac36597afefb34be9d6bc6ee014f9 | Python | axelfahy/rhinopics | /rhinopics/__main__.py | UTF-8 | 2,134 | 2.984375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""Entry point of the rhinopics cli."""
import os
import pathlib
import click
import click_pathlib
from tqdm import tqdm
from .rhinobuilder import RhinoBuilder
@click.command()
@click.argument('keyword', type=str, default=str(os.path.basename(os.getcwd())))
@click.option('--directory', '-d',
... | true |
ac28649a8bd8a01bf8fbd00cca71dda227a3edab | Python | Babnik21/Euler | /Euler 28.py | UTF-8 | 197 | 2.84375 | 3 | [
"MIT"
] | permissive | i = 2
stevilo = 1
vsota = 1
counter = 0
while stevilo < 1001*1001:
while counter < 4:
counter += 1
stevilo += i
vsota += stevilo
i += 2
counter = 0
print(vsota) | true |
d6c5da921684b727a04fa3e4c21c591bfe1cbbe2 | Python | jabulenc/CSProj-AtmBankSecurity | /p3/task4/Task4.py | UTF-8 | 1,881 | 2.640625 | 3 | [] | no_license | #!/usr/bin/python
import sys
import Queue
import threading
import time
import multiprocessing
import hashlib
import base64
exitFlag = 0
class myThread (threading.Thread):
def __init__(self, threadID, q):
threading.Thread.__init__(self)
self.threadID = threadID
self.q = q
def run(self):... | true |
e6a19cb795f3aed10f2f535a73f1521125433268 | Python | wangyu33/LeetCode | /LeetCode1854.py | UTF-8 | 628 | 3.25 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# File : LeetCode1854.py
# Author: WangYu
# Date : 2021/5/10
from typing import List
from collections import defaultdict
class Solution:
def maximumPopulation(self, logs: List[List[int]]) -> int:
d = defaultdict(int)
for b, death in logs:
... | true |
d03e356f6e4c11a3fe90272c106610017428ec77 | Python | lekhakpadmanabh/mlpy | /matching-book-abstract.py | UTF-8 | 1,205 | 2.671875 | 3 | [] | no_license | import nltk.stem
import numpy as np
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
import scipy as sp
def grab_input():
titles = []
descrs = []
N = int(raw_input())
for i in xrange(N):
titles.append(raw_input())
breaker =... | true |
9ee5ae25c5b9f77e7efcf2c36b0b88f9ad4adcad | Python | akitanak/try-fastapi | /try_fastapi/applications/tasks.py | UTF-8 | 883 | 2.71875 | 3 | [] | no_license | from typing import Dict, List
from try_fastapi.domains.entities.tasks import Priority, Task
class TaskService:
def add(self, task_dict: Dict) -> Task:
task = Task(
task_name=task_dict["task_name"],
due_date=task_dict.get("due_date"),
priority=task_dict.get("priority"),... | true |
278039337016badc4915725b5d0c0a56c6fe9819 | Python | Minyus/utility_python_scripts | /print_progress.py | UTF-8 | 1,259 | 3.28125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import sys
import time
def print_progress(iteration, total_iterations, update_interval_sec = 1.0):
global _time_started, _time_updated
t = time.time()
i = iteration
if i==0:
_time_started = _time_updated = t
elif ((t - _time_updated) > update_interv... | true |
a588c904eaac17ac3c71cd3a056ab2cd87ecfb46 | Python | bcmi220/d2gpo | /examples/d2gpo/scripts/generate_d2gpo_distribution.py | UTF-8 | 3,400 | 2.609375 | 3 | [
"MIT"
] | permissive | import scipy.stats as stats
import sys
import numpy as np
import tqdm
from sklearn.utils.extmath import softmax
import h5py
import argparse
def scatter(a, dim, index, b): # a inplace
expanded_index = tuple([index if dim==i else np.arange(a.shape[i]).reshape([-1 if i==j else 1 for j in range(a.ndim)]) for i in rang... | true |
164984416f3fd61a9d539f138bd76dc553dcac23 | Python | Bleak-bleak/CSE101 | /trifid.py | UTF-8 | 4,065 | 3.453125 | 3 | [] | no_license | # Your name:Xingtong Zhou
#
# Trifid Cipher (Homework 1-2) starter code
# CSE 101, Fall 2018
import string
# DO NOT MODIFY THIS HELPER FUNCTION!!!
def invert(source):
t = {}
for k in source:
t[source[k]] = k
return t
# COMPLETE THE FUNCTIONS BELOW FOR THIS ASSIGNMENT
def buildEncipheringTable(k... | true |
a14ca55e4a2a2208fd010e3ff30caa0b20e96cba | Python | samdavies1906/Learn2python | /RockPaperScissors.py | UTF-8 | 1,920 | 4.28125 | 4 | [] | no_license | # A rock paper scissors, lizard, spock game using dictionaries dictionaries
import os
import random
# Clear console each run
os.system('cls||clear')
# Dictionary of what moves beat what
winningMoves = {1 : [3,4], #Rock crushes scissors and lizard
2 : [1, 5], #Paper covers rock and disproves spock
... | true |
ba8798ae9a8b339a9ad5b6f5eb77ba38e6e52873 | Python | billylu815/test_code | /code3/parsewebdata.py | UTF-8 | 842 | 2.640625 | 3 | [] | no_license | import urllib.request, urllib.parse, urllib.error
import xml.etree.ElementTree as ET
import ssl
# Ignore SSL certificate errors
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
url = 'http://py4e-data.dr-chuck.net/comments_1173076.xml'
print('Retrieving', url)
uh = urll... | true |
2c3cb110720082190edcf6ea0e4731757350d805 | Python | oonisim/python-programs | /lib/util_python/function.py | UTF-8 | 2,634 | 3.390625 | 3 | [] | no_license | """Module for Python function utilities"""
from functools import (
wraps
)
import logging
import random
import time
from typing import (
Callable
)
from util_logging import (
get_logger
)
# --------------------------------------------------------------------------------
# Logging
# -----------------------... | true |
444c692686a5b946293c82214365504f62d99e7f | Python | YimRegister/VGD | /popup_permanent.py | UTF-8 | 402 | 2.625 | 3 | [] | no_license | import pygame
pygame.init()
from vgd import wait_until_quit
screen_width = 800
screen_height = 600
black = (0,0,0)
main_surface = pygame.display.set_mode((screen_width, screen_height))
pygame.display.set_caption("Title goes here")
main_surface.fill((255,255,100))
pygame.draw.rect(main_surface, black, (screen_width... | true |
bb1e6feb5ddf0ae8be689f6c482a9d27bf573ca1 | Python | NayantaraPrem/EthereumPricePrediction | /data_collection_tools.py | UTF-8 | 7,338 | 3.03125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 19 23:46:38 2019
@author: Tara Prem
This module contains helper functions for collecting data for the project
"""
import pytrends.dailydata as dd
import matplotlib.pyplot as plt
from datetime import datetime
import pandas as pd
import requests
from bs4 import BeautifulS... | true |
68295bab3f9be6a82669c77ecaea4b4e32e81662 | Python | manlan2/xndian | /deploy/api/printer_api.py | UTF-8 | 5,094 | 2.84375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib
import urllib2
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
sys.path.append("..")
# 说明:
# 1.把注释的方法打开,即可测试
# 2.PRINTER_SN打印机编号9位,查看飞鹅打印机底部贴纸上面的打印机编号
# 3.KEY,去飞鹅打印机官方网站 www.feieyun.com 注册帐号,添加打印机编号,自动生成KEY
def print_order(order_cont... | true |
ac46a0aac127f1a293c8336c8a025a0174fc9c6e | Python | charmguitar/djangoapp | /scalendar/views.py | UTF-8 | 6,557 | 3.375 | 3 | [] | no_license | import calendar
from collections import deque
import datetime
from .models import Schedule
#ここで、カレンダーについて定義
class BaseCalendarMixin:
#カレンダー関連の、基底クラス
first_weekday = 0 # 0は月曜から、1は火曜から。6なら日曜日からになります。お望みなら、継承したビューで指定してください。
week_names = ['月', '火', '水', '木', '金', '土', '日'] # これは、月曜日から書くことを想定します。
def... | true |
32234486b9190af85d7f2e1f41e6f92ee87c414f | Python | nathanbreitsch/Columns-And-Buckets | /data/parser.py | UTF-8 | 2,692 | 2.875 | 3 | [] | no_license | import json
def make_csv():
file = open("transcript.txt","r")
text = file.read()
file.close()
#get rid of double newlines
#while "\n\n" in text:
# text = text.replace("\n\n", "\n")
text = text.replace("\n", ' ')
#remove all commas
for undesirable in [',','.',';','?', '-']:
... | true |
ee33627ed678769e59fd85db4de7aedb06d3e06b | Python | renataeva/python-basics | /lists/moving.py | UTF-8 | 147 | 3.21875 | 3 | [
"Apache-2.0"
] | permissive | def move(seq):
seq = [*seq[2:], *seq[0:2]]
return seq
numbers = [1, 2, 3, 4, 5]
r = move(numbers)
print(r)
assert r == [3, 4, 5, 1, 2]
| true |
3318356046423595707edeb292f2f9fe6623ee27 | Python | Riksi/Emov | /movies/cofi.py | UTF-8 | 3,396 | 2.65625 | 3 | [] | no_license | import numpy as np
class Cofi:
def __init__(self,
Y,
R,
num_features,
num_recms = 10,
lmd = 10,
alpha=0.001,
num_iters = 500,
user = None,
debug = False,
... | true |
d2770ed3fc138a972f754dfb32fab49d52f4e193 | Python | Aasthaengg/IBMdataset | /Python_codes/p03761/s091827333.py | UTF-8 | 131 | 3 | 3 | [] | no_license | n = int(input())
S = [input() for _ in range(n)]
for c in map(chr, range(97+123)):
print(c*min(s.count(c) for s in S), end='')
| true |
44eaf107d0a29ac9791045ce3f62bb52789fc6f3 | Python | harshit98/Retail-Updates-Streamer | /es_request_handler.py | UTF-8 | 1,237 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | import asyncio
import time
from datastore.main import ElasticsearchRequestHandler
es = ElasticsearchRequestHandler()
async def main():
# get single document
product_id = 10
print(f"product having id {product_id}: {await es.get(product_id)}")
# get multiple documents having stock greater than 0
q... | true |
bfff4f70a9878de559700b5b455ab4217cdd590b | Python | fehbrize/what-to-wear | /main.py | UTF-8 | 934 | 3.140625 | 3 | [] | no_license | import json
import requests;
def retrieve_coordinates(zipcode):
req = requests.request('GET', 'http://api.openweathermap.org/geo/1.0/zip?zip=' + zipcode + ',US&appid=ce3cc47717e5e'
'239c048e33936caa91e')
return jso... | true |
e667561355f9635fa9f59700d7ea5b0c3d360cf2 | Python | nyu-cds/asn264_assignment3 | /nbody_opt.py | UTF-8 | 4,152 | 2.78125 | 3 | [] | no_license | """
N-body simulation.
Aditi Nair (asn264)
Feb 10 2016
In this script, I combine all of the optimizations from earlier experiments.
TIME: 38.4250359535 SECONDS
RELATIVE SPEEDUP = 146.724272966/38.4250359535 ~= 3.8
"""
BODIES = {
'sun': ([0.0, 0.0, 0.0], [0.0, 0.0, 0.0], 39.47841760435743),
'jupiter': ([4... | true |