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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
e463121c5da4de503d90faa72a80afd4510c80e0 | Python | quicksloth/source-code-recommendation-server | /src/Models/DTO/Client/CodeDTO.py | UTF-8 | 700 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | import os
import requests
from flask import json
class CodeDTO(object):
"""
Object to transfer code with score
and all complementary data to client
"""
def __init__(self, code=None, score=None, source_link=None):
self.code = code if code else ''
self.score = score if score... | true |
0db612336b54f81e31c7eb55ce5a7c704bf6ea60 | Python | juancsosap/pythontraining | /training/c18_pandas/e01-reading-data.py | UTF-8 | 1,165 | 2.75 | 3 | [] | no_license | import pandas as pd
import os
#import xlrd
basedir = __file__[:__file__.rfind('/')+1]
if basedir != '': os.chdir(basedir)
os.chdir('..')
# Reading tabular data from URL (Good Default Formated)
url = 'data/chiporders.data' #'http://bit.ly/chiporders'
data = pd.read_table(url) # Deprecated
print(data.head(), end='\n\... | true |
8ce8ddee6e06e07438ea71211f1b9b8604b8663e | Python | a2975667/circle_2017 | /week_8-machine_learing/simple_lr_2.py | UTF-8 | 261 | 2.609375 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
data = pd.read_csv('http://www-bcf.usc.edu/~gareth/ISL/Advertising.csv', index_col=0)
X = data.ix[:,:1] #[['TV']]
y = data.ix[:,3:4]
y_list = y['Sales'].values.tolist()
plt.hist(y_list)
plt.show()
| true |
acdaf0e447d23adc30b6763a1287b7e9e87c880d | Python | AnkyBistt/Python | /Python classes/class without function.py | UTF-8 | 524 | 3.640625 | 4 | [] | no_license | class Student:
studentName = ""
studentAddress = ""
def __init__(self, studentName, studentAddress): #its how a constructor is defined in python inside a class
print("Halo YOu are in class")
self.studentName = studentName
self.studentAddress = studentAddress
pri... | true |
b36d4fb82b0807dfdb008eb0ee22e67f8efd0887 | Python | maheshbingi/ReadALoud-NoSQL | /mongodb/populate_mongo.py | UTF-8 | 2,662 | 2.84375 | 3 | [] | no_license | import os, sys
import csv, time
from pymongo import MongoClient
from random import randint
RECORD_COUNT = 10
file = "E:/Semester II/CMPE226/Project 2/data/Books.csv"
path = "E:/Semester II/CMPE226/Project 2/data/test"
connection = MongoClient("mongodb://localhost:27017")
genreList = ["Autobiography","Ad... | true |
827ab7deb45a53778bcb9b5b1c87ab4bea4d5399 | Python | laigen-unam/tf-properties-summarizer | /summarizer/transforming.py | UTF-8 | 5,714 | 2.71875 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
import re
from optparse import OptionParser
import os
import sys
from time import time
__author__ = 'CMendezC'
#Modified by Blanchet | Regular expression for SSA tag identification
# Objective: Transforming BIOLemmatized files:
# 1) Transformed files
# 2) Text files to extract aspects
# ... | true |
caadf07ae6ec57e2d873cc3aad976ddf3a13c142 | Python | macukadam/TwitterApiWebApp | /Twaster/TweetUtils/tests.py | UTF-8 | 1,082 | 2.671875 | 3 | [] | no_license | from django.test import TestCase
from datetime import datetime
d = datetime.strptime('Thu Apr 23 13:38:19 +0000 2009','%a %b %d %H:%M:%S %z %Y')
print(d.strftime('%Y-%m-%d'))
print(d.strftime('%H:%M:%S'))
# def newlocs():
# global tm
# global flag
# for i in range(tm):
# location_predicter(41,28.97... | true |
a62b28925e909240aa99e0f7708dda1c79e54a90 | Python | yjyoo3312/MC_GAN | /Model1/MyTransform.py | UTF-8 | 2,934 | 3.34375 | 3 | [] | no_license | import numpy as np
import torch
import random
from PIL import Image
class Rescale(object):
"""Rescale the image in a sample to a given size.
Args:
output_size (tuple or int): Desired output size. If tuple, output is
matched to output_size. If int, smaller of image edges is matched
... | true |
c1830ccafef50d637ace2ceb7133172486733dd9 | Python | farseer810/vicky-practice | /000.py | UTF-8 | 548 | 4.375 | 4 | [] | no_license | #-*- coding: utf-8 -*-
"""
给整数a, b,计算两数的和与积
输入:共一行,两个数字以空格隔开
输出:第一行输出a+b的和,第二行输出a*b
输入样例1:
1 2
输出样例1:
3
2
"""
if __name__ == "__main__":
"""
line = input() # 读一行字符串
a, b = line.split(' ') # 以空格分离一行字符串
a, b = int(a), int(b) # 转换成整数类型
"""
a, b = input().split(' ') # 读取一行字符串并以空格分开
a, b = int(... | true |
03dd86345be3f770bd9b03a8798209c7ada14ec1 | Python | ThinkRORBOT/pressureUi | /pressure_test.py | UTF-8 | 764 | 2.71875 | 3 | [] | no_license | import unittest
import receive_data
class MyTest(unittest.TestCase):
def test_data_leak(self):
data_1 = [0.1, 0.15, 0.14, 0.16, 0.29, 0.3, 4, 5, 6, 7, 8 , 8, 9.6, 13, 13.2, 13.3, 13.6, 13.2, 13.1, 13.0, 12.9, 12.8, 12.9, 13.0, 12.7, 12.6, 12.4, 12.6, 12.4, 12.3, 12.2, 12, 11.9, 12.1, 11.8, 11.7]
te... | true |
428385368d7082122838d3f03dbf9714ee234f1e | Python | zimonitrome/simple-general-image-classifier-pytorch | /eval.py | UTF-8 | 5,585 | 2.609375 | 3 | [
"MIT"
] | permissive | import types
import argparse
from pathlib import Path
import inspect
import numpy as np
from tqdm import tqdm
import torch
from torch import nn
from torch.utils.data.dataloader import DataLoader
from torchvision import models, transforms
from torchvision.datasets import VisionDataset
from PIL import Image
from shutil i... | true |
6f185b8b5b9f451b9efbb4cf9fe263f230814b7f | Python | quaxsze/flask-file-system | /tests/test_backend_mixin.py | UTF-8 | 6,696 | 3.140625 | 3 | [
"MIT"
] | permissive | import hashlib
from datetime import datetime
class BackendTestCase:
def b(self, content):
if isinstance(content, str):
content = content.encode('utf-8')
return content
def put_file(self, filename, content):
raise NotImplementedError('You must implement this method')
... | true |
8b8e69c691fc5ff193c27a674190a406256ddad9 | Python | deepaksabat/PythonPrograms | /even.py | UTF-8 | 113 | 3.515625 | 4 | [] | no_license | n=input("enter a number:")
if n%2==0:
print n,"is a even number"
else:
print n,"is a odd number"
| true |
95605463f21e5d1534d6faf669d9db3c1a5ae0b6 | Python | JT4life/DailyCodingChallenges | /sorted.py | UTF-8 | 203 | 3.65625 | 4 | [] | no_license | def filter_sort(items):
lst = []
for item in items:
if isinstance(item, str):
lst.append(item)
return lst.sort()
items = [1,2,'a','c','a']
print(filter_sort(items)) | true |
179fbc24e7438286adab259903a26dc03b321cb7 | Python | tmlife485/useful_tools | /ParkMyCloudAPIExamples/PMC-override_list_of_instances.py | UTF-8 | 2,549 | 2.90625 | 3 | [
"MIT"
] | permissive | import os
import requests
# Get the PMC API key from the OS environment variable
pmc_username = os.environ.get('PMC_USERNAME')
pmc_password = os.environ.get('PMC_PASSWORD')
pmc_api = os.environ.get('PMC_API_TOKEN')
base_url = "https://console.parkmycloud.com"
# Define the instances you want to override
override_these... | true |
b8e0333788aa3365bd6cb1b6240665aa80611795 | Python | whanke/MSc | /Demos/genim_word2vec.py | UTF-8 | 2,089 | 2.84375 | 3 | [] | no_license | """
https://github.com/RaRe-Technologies/gensim/blob/develop/docs/notebooks/Corpora_and_Vector_Spaces.ipynb
"""
import logging
# loggin.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
import os
import tempfile
TEMP_FOLDER = tempfile.gettempdir()
print('Folder "{}" will be used to s... | true |
e26068b03e14e29e6b6fd317058aac0cfbec3acb | Python | AbimaelSB/ZerinhoOuUmSocket | /ServidorUDP.py | UTF-8 | 3,220 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 5 17:05:30 2018
@author: abimaelsb
"""
import socket
lista = []
players = []
zero = []
um = []
venc = "empate"
palp = "empate"
HOST = 'localhost'
PORT = 15000
n = 0
j = 0
aux = 0
S_udp = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
end = (HO... | true |
b4aad71d0c53fc0e8feaec556b0bf46546348a93 | Python | mulberry11/python | /PythonSpider/spider/bs4WangYiYun.py | UTF-8 | 1,388 | 2.796875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 13 12:53:20 2018
@author: Administrator
"""
# 爬取网易云音乐的爬虫
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import urllib.request
import urllib
#获取网页
def gethtml(url, headers={}):
req = urllib.request.Request(url, headers=headers)
response = urllib.request.ur... | true |
bc8c15ab8d4d220b60d9e423d24bdf453b0ebbf7 | Python | dwkang707/BOJ | /python3/(2953)BOJ.py | UTF-8 | 290 | 2.9375 | 3 | [] | no_license | # https://www.acmicpc.net/problem/2953
max = 0
player = 0
scores = []
for i in range(5):
total = 0
scores.append(list(map(int, input().split())))
for j in range(4):
total += scores[i][j]
if max < total:
max = total
player = i + 1
print(player, max)
| true |
266b09ebfeed2997c2e19998e7169205708396b4 | Python | SSL-Roots/CON-SAI | /decision_making/scripts/plays/play_book.py | UTF-8 | 1,628 | 2.53125 | 3 | [
"MIT"
] | permissive |
from play_halt import PlayHalt
from play_outside import PlayOutside
from play_stop import PlayStop
from play_our_pre_kickoff import PlayOurPreKickoff
from play_our_kickoff_start import PlayOurKickoffStart
from play_our_pre_penalty import PlayOurPrePenalty
from play_our_penalty_start import PlayOurPenaltyStart
from pla... | true |
82300e4302cc6bc1ae405ee903bf079266cab04a | Python | ashish3x3/competitive-programming-python | /Hackerrank/Maths/sum_of_nC0_to_nCN.py | UTF-8 | 310 | 3.140625 | 3 | [] | no_license | # https://www.hackerrank.com/challenges/diwali-lights
'''
For n >= 1, derive the identity
nC0 + nC1 + nC2 + ... + nCn = 2^n
[Hint: Let a = b = 1 in the binomial theorem]
nCn = 1 and nC0 = 1.
nCr = nC(n - r)
'''
T = int(raw_input())
for _ in xrange(T):
N = int(raw_input())
print (2**N -1)%100000
| true |
1a1e27c03bd266b576df56789270186e66ac1205 | Python | yafeile/Simple_Study | /Simple_Python/standard/fnmatch/fnmatch_3.py | UTF-8 | 219 | 2.578125 | 3 | [] | no_license | import fnmatch
import os
import pprint
pattern="fnmatch_*.py"
files=os.listdir(".")
print
print "Files:"
pprint.pprint(files)
print "-"*20
print "Matches:"
pprint.pprint(fnmatch.filter(files,pattern))
| true |
d8480575855b89a2740da6ed5ec52a784848b168 | Python | Minecraftschurli/myWebsite | /libs/face_detection.py | UTF-8 | 2,013 | 2.796875 | 3 | [] | no_license | import platform
from cv2 import cv2
COLOR = {'WHITE': [255, 255, 255], 'BLUE': [255, 0, 0], 'GREEN': [0, 255, 0], 'RED': [0, 0, 255], 'BLACK': [0, 0, 0]}
if platform.system() == 'Linux':
directory = "/home/pi/webapp/libs"
else:
directory = "C:/Users/georg/PycharmProjects/website/libs"
modelFile = directory... | true |
bfd61ea6cd9db1cb8f986623c4fb79b8380fa1db | Python | uosmandy/CP3_Krit-Nawaritloha | /Exercise4_Krit_N.py | UTF-8 | 285 | 2.96875 | 3 | [] | no_license | FE = 60.5
GB = 80.4
IC = 25.0
CP = 60.2
print("---------------")
print("Score System")
print("---------------")
print("--Your Score--")
print("Foudation English :", FE)
print("General Business :", GB)
print("Introduction to Computer Systems :", IC)
print("Computer Programming :", CP) | true |
c441386d3c69dad754b3e719c10ab536f9e5a8e4 | Python | ukonline/CodeExamples | /python/PythonOptimisation/chapter2/itertools-module.py | UTF-8 | 520 | 3.4375 | 3 | [] | no_license | # Computing a cartesian product itertools.product
# Auteur : Sébastien Combéfis
# Version : October 11, 2020
from itertools import product
import timeit
REPEATS = 100
def pairs_1(a, b):
return [(i, j) for i in a for j in b]
def pairs_2(a, b):
return list(product(a, b))
def measure_time(name, params):
t... | true |
d7fe3b8968cf3e02733747eebd4c6abfe741478c | Python | Kcpf/DesignSoftware | /Bairro_mais_custoso.py | UTF-8 | 1,439 | 3.90625 | 4 | [] | no_license | """
Sua empresa possui filiais em diversas regiões da cidade e você precisa fazer uma análise simples dos gastos com infraestrutura em cada bairro. Os gastos com infraestrutura nos últimos 12 meses para cada bairro estão disponíveis em um dicionário como o apresentado a seguir (atenção, este é somente um exemplo):
{
... | true |
c623d6a077576b1b3c008538535265086c90e6b0 | Python | webdev3211/News-Reader-App | /main.py | UTF-8 | 3,341 | 2.84375 | 3 | [
"MIT"
] | permissive |
from bs4 import BeautifulSoup
import requests
import nltk
from nltk import corpus
import re
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
import os
import cv2
def exact_url(url):
index = url.find(".html")
index = index + 5
current_url = ""
current_url = url[:index]
... | true |
53832364ac44487765e854fe54cbbc4e0130c6bf | Python | Nittilina/uu-aspp2020-python-project | /render.py | UTF-8 | 1,470 | 3.078125 | 3 | [] | no_license | from models import ExcitedState, Transition
from terminaltables import SingleTable
from typing import List
def render_excited_states(states):
"""
Accepts a list of excited states with associated data and prints it in the terminal as a table.
"""
#titles = ["State", "E (eV)", "f", "Sym", "Orbitals", " ... | true |
6ba880850d6944e2504cc65b4405119f6d009218 | Python | elcomcot/CRUD-Application | /Assignment4/Readit.py | UTF-8 | 7,893 | 3.125 | 3 | [] | no_license | '''
Filename: Assignment 4.
Author: Tejveer Singh
Course Name: Programming Language Research Project
Course Number: CST8333
Lab Sec #: 351
Exercise Number: 3
Professors Name: Stanley Pieda.
'''
import dataBase
import threading
from tkinter import *
import tkinter.messagebox
d = dataBase.dataBaseClass
count = 1
try:
... | true |
fd77fc1057a189e6409cfacc7eb3099fc4d87c0c | Python | fvesp18/AirBnB_clone | /console.py | UTF-8 | 7,563 | 2.84375 | 3 | [] | no_license | #!/usr/bin/python3
# Displays prompt to take in user input
import cmd
import sys
from models.base_model import BaseModel
from models.__init__ import storage
from models.user import User
from models.place import Place
from models.city import City
from models.review import Review
from models.state import State
from mod... | true |
8fd7de96837c08c993fb2b8c6a1fa1894ba1e5ee | Python | keshav2/RKB | /print hello n.py | UTF-8 | 80 | 3.6875 | 4 | [] | no_license | n=int(input("Input:"))
i=0
print("Output:")
while i<n:
print("Hello")
i=i+1
| true |
f7aab600ea36ff6a52b6f9b098eae24f1ffda22c | Python | Zopek/bladder | /show/split_pos_neg_sizes_periods.py | UTF-8 | 2,805 | 2.5625 | 3 | [] | no_license | import os
import csv
def main():
record_path = '/DB/rhome/qyzheng/Desktop/Link to renji_data/labels/bladder_tags_period.csv'
record_path1 = '/DB/rhome/qyzheng/Desktop/qyzheng/source/renji_data/process/dwi_t2w_t2wfs/all_sizes.csv'
save_path = '/DB/rhome/qyzheng/Desktop/qyzheng/source/renji_data/process/dwi... | true |
d260b71e8dff0dae1c829d8affe1240feea0363d | Python | eduardonp1/Prolux | /Concurso1/B.py | UTF-8 | 454 | 3.28125 | 3 | [] | no_license | estaciones = []
cantidadPersonas = int(input(" "))
estacion = int(input(" "))
estaciones.append(estacion)
i = 0
while i < cantidadPersonas-1:
estacion = input(" ")
estacion = int(estacion)
estaciones.append(estacion)
i += 1
comparador = estaciones
numero = 0
#Puerta trasera
for z in estaciones:
f... | true |
c4762ca2c625714c0e64fbe6f2a77a393e4a971f | Python | shubh24/MfoPaper | /code/bat knapsack/bat.py | UTF-8 | 1,682 | 2.640625 | 3 | [] | no_license | import math
import numpy as np
import matplotlib.pyplot as plt
from pylab import plot, legend, subplot, grid, xlabel, ylabel, show, title
import random
def func(u):
z = u**2
return sum(z)
def simplebounds(s,lb,ub):
d = np.shape(s)[0]
for i in range(d - 1):
if (s[i] - lb[i] < 0):
s... | true |
d1300c4612705e7dfd572f33c84c62e829a5ddd7 | Python | arpithaupd/Automatic-Covid-19-Classification-and-Segmentation | /Files/model_resnet.py | UTF-8 | 4,034 | 2.734375 | 3 | [
"MIT"
] | permissive | import numpy as np
import os
import skimage.io as io
import skimage.transform as trans
from keras.models import *
from keras.layers import *
from keras.optimizers import *
from keras.callbacks import ModelCheckpoint, LearningRateScheduler
from keras import backend as keras
from keras.backend import int_shape
from keras... | true |
b11621e6d4a5107361e6485149e88bf002a07864 | Python | franz6ko/intro-ai | /Clase 5/GradientDescent.py | UTF-8 | 1,899 | 3.03125 | 3 | [] | no_license | import numpy as np
from sklearn.preprocessing import PolynomialFeatures, StandardScaler
class GradientDescent:
def __init__(self, alpha, n_epochs, poly=None, lbd=0):
self.alpha = alpha
self.n_epochs = n_epochs
self.model = None
self.lbd = lbd
if poly is not None:
... | true |
09d0f12fbf4b8f62ebd03962ce789699a940eeea | Python | aman-aman/Python_tkInter | /gui4.py | UTF-8 | 684 | 2.75 | 3 | [] | no_license | from tkinter import *
root=Tk()
#topFrame=Frame(root)
#topFrame.pack()
#bottomFrame=Frame(root)
#bottomFrame.pack(side=BOTTOM)
button1=Button(root,text="button 1",fg="red")
button2=Button(root,text="button 2",fg="blue")
button3=Button(root,text="button 3",fg="green")
button4=Button(root,text="button 4",fg="p... | true |
3efd1f696fe681996e1e1f2fa9c4120b7d566845 | Python | tarekmehrez/recomendation_engine | /lib/tbont_text_engine/vector_space/lsi.py | UTF-8 | 3,806 | 2.921875 | 3 | [] | no_license | """Contains the LSIModel class."""
from collections import OrderedDict
from gensim import models, matutils
from corpus import Corpus
from tbont_text_engine.utils import io
class LSIModel(object):
"""Train LSIModel using gensim's API."""
def __init__(self):
"""Init LSIModel instance."""
sel... | true |
7a0c7a47251f282cbb4e4ccf504f3a1e7d4046d5 | Python | yanita-d/Bioinformatics2020 | /Martin Georgiev/Homework/problem3.py | UTF-8 | 740 | 3.34375 | 3 | [] | no_license | from Bio import SeqIO
from collections import Counter
#reading fasta format file and returning the sequence
def readSeqFromFastaFile(filename):
inputFileData = SeqIO.read(filename, "fasta")
return inputFileData.seq
dnaSeq = readSeqFromFastaFile("data/fasta_seq_1.fa")
#first way
def myFrequencyTable(dnaSeq):
... | true |
8875d11d29889f5f3f2e6d49a49b709aaebc2fb5 | Python | Joscho2/PTS_DU3 | /gamewrapper.py | UTF-8 | 2,382 | 3.328125 | 3 | [] | no_license | import final
class GameWrapper(object):
"""Stará sa o správu hry. Oznamuje jednotlivým kvalifikáciam
posun na nový deň, spracováva postupujúce tími a posúva na nový deň
aj samotné majstrovstvá."""
def __init__(self, q_list, simulator, history):
self.q_list = q_list
self.qual_is_playing... | true |
a8bec1d14a22ca001585d9d47f48d915853e281c | Python | jisoo-ho/Python_R_study | /20200420/20200420-2.py | UTF-8 | 1,890 | 3.375 | 3 | [] | no_license | # 2)아이콘 넣기
import sys
from PyQt5.QtWidgets import QApplication, QWidget
from PyQt5.QtGui import QIcon
class MyApp(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.setWindowTitle('Icon')
self.setWindo... | true |
64b73bd1146c482c6df19ef8ab87be6fb391fd3e | Python | gabrielbaldao/robotica | /teste.py | UTF-8 | 703 | 3.125 | 3 | [] | no_license | import RPi.GPIO as gpio
import time
#Configuring don’t show warnings
gpio.setwarnings(False)
#Configuring GPIO
gpio.setmode(gpio.BOARD)
gpio.setup(17,gpio.OUT)
gpio.setup(18,gpio.OUT)
#Configure the pwm objects and initialize its value
pwmBlue = gpio.PWM(17,100)
pwmBlue.start(0)
pwmRed = gpio.PWM(18,100)
pwmRed.st... | true |
99888cbdeec893d781548f2c6993cd0a395f8b45 | Python | ChiPT318/PhamThucChi-Labs-C4E16 | /Web module/Session01/app.py | UTF-8 | 858 | 2.828125 | 3 | [] | no_license | from flask import Flask, render_template
app = Flask(__name__)
@app.route('/') #mo trang chu
def index(): #khi vao trang chu kia thi chay function index luon
posts = [
{
"title" : "Tho con coc",
"content" : "nekrnk kenjk kejn kenrj kernvw nwin",
"author" : "Chi",
"gender" : 0
},
{
... | true |
fc7aad6891276f1f8f187dbd674e5f3bc5d5295d | Python | schuderer/bprl | /tests/gym_fin/test_pension_env.py | UTF-8 | 14,787 | 2.578125 | 3 | [
"MIT"
] | permissive | """Tests for the gym_fin.envs.pension_env module"""
# Stdlib imports
import logging
from math import floor
from unittest import mock
# Third-party imports
from gym.utils import seeding
import pytest
# Application level imports
from gym_fin.envs import pension_env
class MockEnv:
def __init__(self):
self... | true |
db5c2b9b451c0d849a4e91247318728672b455e8 | Python | iamFIREcracker/project-euler | /python/52.py | UTF-8 | 440 | 3.578125 | 4 | [] | no_license | """Find the smallest positive integer, x, such that 2x, 3x, 4x, 5x, and 6x,
contain the same digits.
"""
def IntToSeq(n):
s = []
while n:
n, r = divmod(n, 10)
s.append(r)
return s
for d in range(1, 10):
for x in xrange(10**(d - 1), (10**d)//6):
s = set(IntToSeq(x))
for m in range(2, 7):
s... | true |
e482329d8ac5b58b8a02f18f13404e4130697eab | Python | sbowles22/CS550 | /HW2/C-to-F-Conversion.py | UTF-8 | 482 | 3.703125 | 4 | [] | no_license | import sys
try:
if sys.argv[1].lower() == 'f':
temp = float(sys.argv[2]) * (9/5) + 32.0
elif sys.argv[1].lower() == 'c':
temp = (float(sys.argv[2]) - 32.0) * (5/9)
else:
print('ERROR: Please input C or F as argument 1')
quit()
temp = round(temp)
print(f'{temp}°{sys.... | true |
1e849da0076a8ea5f654af5bf45f7dac09ab3f5c | Python | dinobobo/thesis_plots | /BigCoilPair.py | UTF-8 | 4,671 | 2.828125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Model of big 6x6 winding coil on octagon chamber as built in 2016
"""
from __future__ import division
from numpy import linspace, array, polyfit, poly1d
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from quagmire.magnetics.wire import WireSquareTube
from quagm... | true |
a16be770561e50839d2edf891b893ad76f5fd8c8 | Python | leovasc5/python | /aula28/aula28.py | UTF-8 | 189 | 3.109375 | 3 | [] | no_license | jogadores = ["Cristiano Ronaldo", "Messi", "Neymar", "De Bruyne"]
itJogadores = iter(jogadores)
print(next(itJogadores))
print(next(itJogadores))
# for jogador in jogadores:
# print(jogador) | true |
d0d609159e66cd451bffcf0c520a39b3ef2f9d23 | Python | HKKKD/leetcode | /136singleNumber.py | UTF-8 | 275 | 3.140625 | 3 | [] | no_license | def singleNumber(nums):
s = set(nums)
d = dict()
for x in nums:
if x in s:
if x in d:
d[x] += 1
else:
d[x] = 1
for key,value in d.iteritems():
if value == 1:
return key
print singleNumber([17,12,5,-6,12,4,17,-5,2,-3,2,4,5,16,-3,-4,15,15,-4,-5,-6])
| true |
d11161a7acf8ab6019a482c074b170119ce51539 | Python | bir0bin/isp-exam | /itermagic/itermagic.py | UTF-8 | 983 | 3.28125 | 3 | [] | no_license | from Queue import Queue
def niter(s_iter, n=2):
it = iter(s_iter)
underlying_qs = [Queue() for _ in xrange(n)]
def underlying_gen(q):
while True:
if q.empty():
val = next(it)
for it_q in underlying_qs:
it_q.put(val)
yield... | true |
e2530e0149a554d87708650b5f9e011abcfe4251 | Python | jinurajan/Datastructures | /LeetCode/contests/number_of_restricted_paths_from_first_to_last_node.py | UTF-8 | 1,609 | 3.09375 | 3 | [] | no_license | """
"""
from typing import List
from collections import defaultdict
from heapq import heappop, heappush
class Solution:
def countRestrictedPaths(self, n: int, edges: List[List[int]]) -> int:
if not edges or n == 1:
return 0
adj_map = defaultdict(dict)
for x, y, weight in edges:... | true |
d9d6bd0e22adc46859d103139ad44a06e26343f1 | Python | ttocsneb/an_Adventure | /an_adventure/schemas/__init__.py | UTF-8 | 3,681 | 2.640625 | 3 | [] | no_license | from marshmallow import fields, Schema, post_load, pre_dump, post_dump, ValidationError
import adventurelib
from pymaybe import maybe
from . import objects
def getErrorString(errors):
def to_str(obj):
if isinstance(obj, dict):
return ', '.join(f'{v}' for k, v in obj.items())
return ',... | true |
b8581021d89d28e44486d5cee0d5f31a015d76de | Python | PatrickRWells/keckcode | /keckcode/spectra/skysub.py | UTF-8 | 2,678 | 2.65625 | 3 | [
"MIT"
] | permissive | import scipy,special_functions
from scipy import ndimage,interpolate
WIDE = 100
def skysub(x,y,z,scale):
# Find sources by determining which pixels are slightly high
height = int(y.max()-y.min())
width = int(x.max()-x.min())
midpt = y.mean()
# Very wide slits need special attention. Here we fit a first order
... | true |
2afac159a6dbc7ed21f1edb21d2986154fc4ceff | Python | coldmax88/PyGUI | /GUI/Generic/GViewBases.py | UTF-8 | 3,294 | 3.171875 | 3 | [
"MIT"
] | permissive | #
# Python GUI - View Base - Generic
#
from GUI.Properties import overridable_property
class ViewBase(object):
"""ViewBase is an abstract base class for user-defined views.
It provides facilities for handling mouse and keyboard events
and associating the view with one or more models, and default
behaviour for re... | true |
3e1f77e21bfaddc199f7c7fa62035d37513ec94d | Python | 51616/CU_Makhos | /ThaiCheckers/preprocessing.py | UTF-8 | 1,306 | 2.921875 | 3 | [] | no_license | import numpy as np
def preprocess_state(board):
tensor = board.reshape(1, 1, 8, 8)
return tensor
def flatten_idx(position, size, needhalf=True):
(x, y) = position
if needhalf:
return x * size + y//2
else:
return x * size + y
def unflatten_idx(idx, size):
start = idx // size
end = idx % size
return start... | true |
f1584206360d12a0467fb4148cb51ed140a2b353 | Python | kdbanman/sandbox | /primefac.py | UTF-8 | 766 | 3.359375 | 3 | [] | no_license | import primes
import sys
def primefac(n,prints=False,cumul=[]):
for p in primes.primes(n):
if n%p == 0:
if prints:
print p
cumul.append(p)
if n/p == 1:
return cumul
else:
return primefac(n/p, prints, cumul)
if... | true |
de28b3893283d8862f623b2e8d99d994881f7b2b | Python | MilenaFilippova/programming_language_practice | /task1_big_area.py | UTF-8 | 1,126 | 3.03125 | 3 | [] | no_license | #На изображении (task1.png) найти объект с самой большой внутренней площадью(т.е. площадь без
#учета точек периметра).
import matplotlib.pyplot as plt
import numpy as np
from skimage import filters
from skimage.filters import threshold_isodata, threshold_otsu
from skimage.measure import label, regionprops
from skima... | true |
4c418217888394a52f8920db5f2adf617fb5c775 | Python | jdidion/atropos | /atropos/util/__init__.py | UTF-8 | 22,369 | 3.0625 | 3 | [
"CC0-1.0",
"MIT",
"LicenseRef-scancode-public-domain"
] | permissive | """Widely useful utility methods.
"""
from collections import OrderedDict
from collections.abc import Iterable, Sequence
from datetime import datetime
import errno
import functools
import logging
import math
from numbers import Number
import time
from atropos import AtroposError
# TODO: the nucleotide table should be ... | true |
e5b5417d6cbf579f2ab6bcc9ae9fbb3c217112dc | Python | gugugu625/fslnavdatatokml | /main.py | UTF-8 | 5,170 | 2.640625 | 3 | [] | no_license | import sqlite3
import math
import re
conn = sqlite3.connect('rom')
c = conn.cursor()
def getDegree(latA, lonA, latB, lonB):
radLatA = math.radians(latA)
radLonA = math.radians(lonA)
radLatB = math.radians(latB)
radLonB = math.radians(lonB)
dLon = radLonB - radLonA
y = math.sin(dLon) * math... | true |
11bc86085f90e5af5b3038f990389ee3b5ca5f25 | Python | PyCQA/redbaron | /tests/test_redbaron.py | UTF-8 | 996 | 2.984375 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding:Utf-8 -*-
""" Main redbaron test module """
from redbaron import RedBaron, truncate
def test_other_name_assignment():
red = RedBaron("a = b")
assert red.assign is red[0]
def test_index():
red = RedBaron("a = [1, 2, 3]")
assert red[0].value.value[2].index_on_parent ==... | true |
63cab8c6c0b8db5c884fe7c15f5c2a7b40797791 | Python | EricaHD/SemiSupervisedLearning | /archived/resnet.py | UTF-8 | 2,502 | 2.609375 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import models
from load import get_train_loader, get_test_loader
torch.manual_seed(1)
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
train_loader = get_train_loader('/scratch/ehd255... | true |
3a434e79a0390362e7f78015fcc723aa77d29dfa | Python | shivanichauhan18/files_questions | /p.py | UTF-8 | 182 | 3.125 | 3 | [] | no_license | number_list=[[1,2.3],
[2,1,3],
[3,2,1]]
i=0
j=0
new_list=[]
sum=0
while i<len(number_list):
new_list.append(number_list[i][j])
sum=sum+new_list[i]
j=j+1
i=i+1
print sum | true |
96cdbd1ea9b66cb896e1c00bf8bed983c9c30bb4 | Python | standthis/ml | /practical/demo/10_Keras_CNN_MNIST.py | UTF-8 | 4,554 | 3.203125 | 3 | [] | no_license | #!/usr/bin/env python
# ---------------------------------------------------------------------------------------------------------------
# Training a shallow vs deep (Convolutional Layer) Neural Net to Classify Handwritten Digits Using Keras
import numpy
from keras.datasets import mnist
from keras.models import Sequen... | true |
70cb25496ad6f4df9bcfee788eb59be62c405100 | Python | sarah/sorts | /quicksort/quicksort.py | UTF-8 | 1,406 | 3.796875 | 4 | [] | no_license | import unittest
def quicksort(A):
"""
API function that calls internal function _quicksort with initial args
"""
_quicksort(A,0,len(A)-1)
def _quicksort(A, start, last):
"""
:A array
:start Int
:last Int
"""
if (last - start) > 0:
pIndex = partition(A,start,last)
... | true |
40c23f62486fcb181f48e1452829453236da222a | Python | jedrekw-git/aftermarket-python | /pages/appraisal_list.py | UTF-8 | 1,801 | 2.546875 | 3 | [] | no_license | # coding=utf-8
from selenium.webdriver.common.by import By
from pages.base import BasePage
from utils.utils import *
from random import randint
from time import sleep
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions ... | true |
e6a5ed2ffc5d2e6ab51b90806d35ff42c0567fb3 | Python | mj596/FermiTools | /modules/exceptions/exceptions.py | UTF-8 | 340 | 2.515625 | 3 | [] | no_license | class SourceNotFound( Exception ):
def __init__( self, _source_name ):
self.source_name = _source_name
class ModuleNotFound( Exception ):
def __init__( self, _module_name ):
self.module_name = _module_name
class RangeError( Exception ):
def __init__( self, _error_name ):
self.error... | true |
1e568caaa04b4fb692e415b894c23d10ce358a21 | Python | SajjadDaneshmand/BahmanRbt | /src/main.py | UTF-8 | 4,734 | 2.546875 | 3 | [] | no_license | # internal
import settings
from data_catcher import Cars
# standard
import time
# selenium
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support i... | true |
874c5c8bed5c0bd41df7d5e2e0e24c72682d4f69 | Python | paulineml/sdmxthon | /sdmxthon/parsers/status_message.py | UTF-8 | 3,650 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | """Status messages file withholds some extra MessageTypes for specific
purposes """
from sdmxthon.model.base import LocalisedString, InternationalString
from sdmxthon.parsers.data_parser import DataParser
from sdmxthon.utils.xml_base import find_attr_value_
class StatusMessageType(DataParser):
"""StatusMessageTy... | true |
9519faacb3ecb70bd836a80d62f9e049282d07cc | Python | luishpmendes/zdt | /plotter_pareto.py | UTF-8 | 3,476 | 2.71875 | 3 | [] | no_license | import csv
import matplotlib.pyplot as plt
import os
import seaborn as sns
from plotter_definitions import *
dirname = os.path.dirname(__file__)
for zdt in zdts:
for version in versions:
min_ys = []
max_ys = []
for i in range(2):
min_ys.append(-1)
max_ys.append(-1)
... | true |
dc2d2b090bef9e1567c07f8c08c6d3e10f8935ef | Python | deboramelinda94/KGConstructionFromTextbook | /constructKG_FromTOC/TableOfContent_EntityExtraction.py | UTF-8 | 2,719 | 2.90625 | 3 | [] | no_license | from nltk import pos_tag
from nltk.tokenize import word_tokenize
def createTermGlossary(fileName): #related to selected dataset (e.g. python syntax that may is listed in the TOC)
TermGlossary = []
f = open(fileName, "r")
content = f.readlines()
for item in content:
item = item.rstrip("\n")
... | true |
e09b84fd7cce01ebed319ae4342540f919df1c0e | Python | sgammon/yapa-moments | /moments/driver.py | UTF-8 | 7,785 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
'''
yapa moments demo: ffmpeg driver
'''
# stdlib
import os
import sys
import shutil
import tempfile
import traceback
import subprocess
# local
from . import base
class FFmpeg(base.MomentBase):
''' Class that wraps and properly handles calls to FFmpeg, related
to generating :py... | true |
f764d72a16198a2dacf1782ae4d7a9e76332d921 | Python | rongDang/Search_engine_spider | /main.py | UTF-8 | 3,690 | 3.28125 | 3 | [] | no_license | # -*- encoding:utf8 -*-
import os
import sys
from scrapy.cmdline import execute
# 调用scrapy的函数execute进行运行测试
# sys.path.append(os.path.dirname(os.path.abspath(__file__)))
# scrapy crawl douban
execute(["scrapy", "crawl", "douban"])
# one = set()
# words = {"tokens":[{"token":"sadasd"}, {"token":"45"}, {"... | true |
d5d757b73622d8a571f886a510678dd53d55536a | Python | LPLhock/huobi_swap | /matploat/ema_pic.py | UTF-8 | 3,427 | 2.59375 | 3 | [] | no_license | import pandas as pd
from api.huobi.huobi_request import HuobiRequest
import asyncio
import matplotlib as mpl
from matplotlib import pyplot as plt
# 图形参数控制
import pylab as pl
import numpy as np
from utils import fileutil
from datetime import datetime
import talib
from collections import deque
from utils import sigle_lin... | true |
5fbace1b8d83491554e4ea5aa89e79b6e4dbb44c | Python | luckyparkwood/khal | /chris.python/projects/project.do_she_love_me.py | UTF-8 | 464 | 3.546875 | 4 | [] | no_license | import random
she_love_me = random.choice([True, False])
she_hate_me = random.choice([True, False])
if she_love_me and she_hate_me:
print("She love you and she hate you bro. Sounds tricky.")
elif she_love_me and not(she_hate_me):
print("She love you my dude, go get her!")
elif not(she_love_me) and sh... | true |
467f7f0539ef91e338a83c0dbb0e1279825fe6ce | Python | inksci/tcp-py | /client.py | UTF-8 | 310 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 28 22:40:41 2016
@author: zhanghc
"""
import socket
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect(('172.17.0.1',12001))
print s.recv(1024)
for data in ['zhang','liu','wang']:
s.send(data)
print s.recv(1024)
s.send('exit')
s.close()
| true |
f06f4125754d05922755e9832ded74ce32192e76 | Python | JonKPowers/horses | /db_functions.py | UTF-8 | 6,463 | 2.78125 | 3 | [] | no_license | import pymysql.cursors
import re
import logging
class DbHandler:
def __init__(self, db='horses_test', username='codelou', password='ABCabc123!', initialize_db=False):
self.db = db
self.user = username
self.password = password
self.connection = None
if initialize_db == True:
... | true |
50c2dcc71149914dfeec31b3a79745f275c15e49 | Python | gtcaps/OLC1_Proyecto1_201700312 | /AnalizadorLexicoHTML/AnalizadorLexico.py | UTF-8 | 13,445 | 2.984375 | 3 | [] | no_license | from AnalizadorLexicoHTML.Token import *
import os, re, pathlib
class AnalizadorLexicoHTML:
def __init__(self):
self.listaTokens = []
self.listaErrores = []
self.entradaLimpia = ""
self.estado = 0
self.lexema = ""
self.linea = 1
self.columna = 1
self.... | true |
a6f4efdabc59c342aa041e7702db81d737ee2c41 | Python | taglio/reti-P2P | /directory_distribuita/menu_gnutella.py | UTF-8 | 5,500 | 2.625 | 3 | [] | no_license | import socket,sys,time
from gnutella import PEER
#imports needed for the GUI
from Tkinter import *
import thread_gnutella
#TODO bisogna fare una specie di login che permetta di far partire la socket in ascolto
peer=PEER()
class Menu_Login:
def __init__(self,master):
"""
This method cre... | true |
74decb788597750bbc4caa81336fcde8ebca2e82 | Python | chenhuiyeh/python-scripts | /consonantCount.py | UTF-8 | 506 | 3.40625 | 3 | [] | no_license | import re, pprint
message = 'It was a bright cold day in April, and the clocks were striking thirteen.'
# counts number of consonants in a string message
def consonantCount(message):
consonantRegex = re.compile(r'[^aeiouAEIOU\s,.]')
consonantList = consonantRegex.findall(message)
count = {}
for i in... | true |
9e375a1135162c5ecb95614376aa158805f896a2 | Python | jadoona81/RL_Experiments | /Benchmark/testScript.py | UTF-8 | 2,640 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Thu Feb 11 08:46:17 2021
@author: HG19230
"""
import sys
sys.path.append("..\..\DQNLibrary")
sys.path.append("..\..\DQNLibrary\MobilityPatterns")
import numpy as np
from gridAStar import AStarGridPathPlanning
from TSP_greedy import TSP_greedy
import math
import random
def man... | true |
01c4df3e339e17f5ae7e9f9814a9497e74f2b78f | Python | amfl/opencv-go | /game_tree.py | UTF-8 | 2,747 | 3.234375 | 3 | [] | no_license | from sgfmill import sgf
import numpy as np
class GameNode:
def __init__(self):
self.state = None
self.parent = None
self.sgf_node = None
def difference_from_parent(self):
try:
diff = self.state - self.parent.state
except AttributeError:
# There ... | true |
41582606c5fc2378a17ea1e134f0a1149ad0fd1c | Python | roman-89/advent_of_code | /2019/4.py | UTF-8 | 940 | 3.25 | 3 | [] | no_license |
def is_valid_password(i):
s = str(i)
adjacent = False
previous = int(s[0])
for c in s[1:]:
c = int(c)
if not adjacent and c == previous:
adjacent = True
if c < previous:
return False
previous = c
return adjacent
print(sum( is_valid_pass... | true |
8949e70615a08b4721b69df85691db236ca58b38 | Python | nianweijie/webScrapyBase | /firstselenium.py | UTF-8 | 735 | 2.96875 | 3 | [] | no_license | from selenium import webdriver
import time
driver = webdriver.Firefox()
driver.get("http://www.santostang.com/2018/07/04/hello-world/")
# 因为评论在iframe中,所以要用.frame对iframe进行解析
driver.switch_to.frame(driver.find_element_by_css_selector("iframe[title='livere']"))
for x in range(1,4):
# 再通过find elements by css selec... | true |
e482f1c4d813dce16bdb4a36acbc53afe6c08623 | Python | liubrandon/pod_6 | /gregg/todoproject/todo/views.py | UTF-8 | 2,738 | 2.625 | 3 | [] | no_license | from django.shortcuts import render
from .models import *
from .forms import *
from django.http import HttpResponseRedirect
from django.urls import reverse
# todo list homepage
def todo(request):
if request.method == 'GET':
#tasks not completed
tasks_pending = Todo.objects.filter(completed=False).o... | true |
877a50a49332216eacf25400b7eb97f66bc5761b | Python | ggradias/real-python-test | /tkinterexamp2.py | UTF-8 | 358 | 3.359375 | 3 | [] | no_license | from tkinter import *
# define the GUI application
window = Tk()
window.geometry("300x200")
button1 = Button(window, text="I'm at offset (50,60)")
button2 = Button(window, text="I'm at offset (0,0)")
button1.pack()
button2.pack()
button1.place(height=200, width=200, x=50, y=65)
button2.place(height=150, width=... | true |
cffd1209920369dbf899b5fbe2fa0558eb39f419 | Python | ImEagle/codemetrics | /tests/test_scm.py | UTF-8 | 4,514 | 2.65625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `codemetrics.scm`"""
import unittest
import datetime as dt
import textwrap
import typing
import unittest.mock as mock
import pandas as pd
import codemetrics.core as core
import codemetrics.scm as scm
import tests.utils as utils
class TestLogEntriesToDataF... | true |
00cb1e8b9912a546f949f43a51f93b8038456c14 | Python | kruthvik007/BlockChainCryptoTransaction | /blockchain_currency.py | UTF-8 | 6,490 | 3.03125 | 3 | [] | no_license | from hashlib import sha256
import json
import pprint
# function to hash the data sent (transaction)
def calculate_hash(previous_hash, data, nonce):
data = str(previous_hash) + str(data) + str(nonce)
data = data.encode()
hashing = sha256(data)
return hashing.hexdigest()
# class to create... | true |
c95767d7e93bd7654829681e1431fdb84a3b3b4b | Python | gcallah/utils | /html_checker.py | UTF-8 | 5,665 | 2.671875 | 3 | [] | no_license | #!/usr/bin/python3
"""
Checks html syntax.
"""
from html.parser import HTMLParser
from html_content_spec import content_spec, _ANY_CONTENT, _NO_CONTENT
import re
import argparse
try:
from typing import List, Set, Dict # noqa F401
except ImportError:
print("WARNING: Typing module is not found.")
DEV_FEATURE_O... | true |
85d3c6ad4f09f78cb8790dbaaf1fcb73c7dedd41 | Python | JoaquinRodriguez2006/Roboliga_2021 | /Funciones/Avanzar_retroceder_girar.py | UTF-8 | 595 | 3.109375 | 3 | [] | no_license | from controller import Robot
timeStep = 32
max_velocity = 6.28
robot = Robot()
# Definimos las ruedas
wheel1 = robot.getDevice("wheel1 motor") # Create an object to control the left wheel
wheel2 = robot.getDevice("wheel2 motor") # Create an object to control the right wheel
# Definimos su movimiento infinito
wheel... | true |
b9efc213ff01fcb3fd3eb6e59720ec7e37dc01f7 | Python | csernazs/misc | /euler/p024.py | UTF-8 | 143 | 3.03125 | 3 | [] | no_license |
from itertools import permutations, islice
for i in islice(permutations("0123456789", 10), 999999, 1000000):
print "".join(map(str, i))
| true |
80df997c24ba14a2cea7f09faa48e9507d011c46 | Python | meryzu/faults | /src/MainFaults.py | UTF-8 | 5,109 | 2.578125 | 3 | [] | no_license | import pandas as pd
from Process import Prepare
from Scenaries import Scene
extention=5 #Number of time steps to be taken
df=pd.read_csv('../data/FallasJunioNew.csv') #read data from csv file
data=Prepare.prepare(df,16,20,24,28) #posicion de la falla en el array de fallas (failureCode)
#Incluir con data las dos tabl... | true |
5df9207fc175340aeadc1ef747430b9a7a02e7cd | Python | learnitmyway/tictactoe_ml | /test_train_ai.py | UTF-8 | 811 | 2.875 | 3 | [] | no_license | from train_ai import update_ai
from ai import AI
from game import Game, get_winner, X, O, EMPTY
class TestTrainAI:
def test_update_ai(self):
game = Game()
previous_board = [
[X, X, EMPTY],
[O, O, EMPTY],
[EMPTY, EMPTY, EMPTY]
]
board = [
... | true |
ad53dd3d441dff4168ba50bf1141c32a923fdb18 | Python | venugopalkadamba/Programming-Data-Structures-and-Algorithms-using-Python | /GeeksForGeeks_Placement_Course_Problems/Linked List/pairwise_swap.py | UTF-8 | 631 | 3.96875 | 4 | [] | no_license | class Node:
def __init__(self, data):
self.data = data
self.next = None
def pairwise_swap(head):
temp = head
while temp != None and temp.next!=None:
temp.data, temp.next.data = temp.next.data, temp.data
temp = temp.next.next
return head
def printLinkedList(head):
... | true |
95a9e00b62d2e6bddf443b2abb6cfd7f32378d29 | Python | BlackDragonN001/BZCLauncher | /application/exceptions.py | UTF-8 | 576 | 2.625 | 3 | [
"MIT"
] | permissive | """
exceptions.py
Python source file defining launcher specific exception types.
This software is licensed under the MIT license. Refer to LICENSE.txt for more
information.
"""
class LauncherException(exception):
"""
An exception type representing the most generic type of launcher... | true |
5e8817ef4e3dfe0d50da0f37c7718d1675919fcb | Python | ChistEgor/botweather | /BotWeather.py | UTF-8 | 2,587 | 3.203125 | 3 | [] | no_license | import requests
import json
from time import sleep
telegram_token = '1146634987:AAHhhmXXUCWbnF3RPNM-rUBEaQV_s4tV2Xs'
telegram_link = 'https://api.telegram.org/bot' + telegram_token + '/'
open_weather_api = 'db71095002de213ae977f3d6cd10ed4f'
open_weather_link = 'https://api.openweathermap.org/data/2.5/weather'... | true |
18437414e18a3ce0160d5a21c4543fd5352fb317 | Python | SnapCapCo/SnapCapCo.github.io | /cs121/model/createImages.py | UTF-8 | 1,113 | 2.640625 | 3 | [] | no_license | import csv
import numpy as np
#import pandas as pd
import cv2
w,h = 48,48
with open('fer2013.csv') as csvfile:
csv_reader = csv.reader(csvfile, delimiter=',')
line_count = 0
for row in csv_reader:
if line_count == 0:
print(row)
line_count +=1
else:
emot... | true |
ffd84f194fd4cc4a7f57fa730c20385d03f7b95b | Python | manokel/SW-Capstone-Flux | /client4.py | UTF-8 | 681 | 2.890625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Nov 24 19:12:34 2017
@author: summer
"""
import socket
import sys
def read(port):
s = socket.socket()
host = '192.168.0.14' #(IP address of PC (server))
s.connect((host,port))
try:
msg = s.recv(1024)
s.close()
except socket.error as msg:
... | true |
be4f4132a7aa0279713bfdcd0ee51a5c3ac224cb | Python | gregoryvit/hack.moscow_terryfoldflaps_round_2 | /server/api/app/api/v1/rating.py | UTF-8 | 319 | 2.546875 | 3 | [] | no_license | import json
from flask import abort, request
from . import api
@api.route("/rating", methods=['POST'])
def rating():
data = request.data
data_dict = json.loads(data)
product_id = data_dict['product_id']
new_rating = data_dict['rating']
print(product_id)
print(new_rating)
return "OK"
| true |
4844679bab6d06f644e121385365c28871083903 | Python | goodboyycb/python_samples | /python_3_排序.py | UTF-8 | 379 | 3.875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Nov 30 15:54:40 2018
@author: goodboyycb
"""
##排序排序
l=[]##这是一个 列表
print("说明:每次输入一个数,输入三次,从小到大进行排序")
for i in range(3): ##range(3),包含0,1,2
x=int(input('integer:\n'))
l.append(x) # 使用列表的 添加因素。对就是添加因素。
l.sort()
print (l)
| true |
1e5a96a6761fdd00e95fc536d7ecb7e791a27d1e | Python | pronob1010/Codeforces_Solve | /cf_697_a.py | UTF-8 | 437 | 2.8125 | 3 | [] | no_license | a,b,c = list(map(int,input().split()))
p=a
r =a
i = 1
while True:
if (c == p) or ( c == r):
print("YES",i)
break
if r > c or p>c :
print("No")
break
p = a + i * b
r = a + i * b + 1
i+=1
# def find(p,q,c):
# if (c == p) or (c == r):
# return 1
# if ... | true |