blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
a29186014a3fd6239d9784df48eb8a01057b0ebd | dharm18/100daysofcode-mlproject | /datacamp-statistical-thinking-in-python-part-1/code.py | UTF-8 | 471 | 3.09375 | 3 | [] | no_license | # Plotting a histogram of iris data
# Import plotting modules
import matplotlib.pyplot as plt
import seaborn as sns
# Set default Seaborn style
sns.set()
# Plot histogram of versicolor petal lengths
plt.hist(versicolor_petal_length)
# Show histogram
plt.show()
# Axis labels!
# Plot histogram of versicolor petal l... | true |
19a2104e3a42d10037998b5469126f47f663ebaa | aifighter/leetcode | /1-100/83.py | UTF-8 | 605 | 3.234375 | 3 | [] | no_license | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def deleteDuplicates(self, head: ListNode) -> ListNode:
tmp = head
val = None
current = None
while tmp:
if not current:
... | true |
d70bcf4c0d722b1a25c88832b2658366bb081d42 | https-seyhan/BugAI | /LSTM/BugAI_LSTM_oneclass.py | UTF-8 | 6,859 | 2.640625 | 3 | [] | no_license | import numpy as np
import datetime
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from keras.models import Sequential
from keras.layers import Dense, Activation, Dropout, Flatten, Embedding, LSTM
from sklearn.model_selection import cross_val_predict
from sklearn.metrics import confusion_matrix,... | true |
47d516a62c5097b3cbb9d96cc65fc49c5a38cbd2 | bubblelone/myblog | /blog/cases/debugtalk.py | UTF-8 | 824 | 2.640625 | 3 | [] | no_license | import requests
import os
host = "http://127.0.0.1:8000/"
def token(user='guolong', pwd='admin123456'):
login_url= host + "api/v1/logintoken/"
headers = {
"Content-Type": "application/json"
}
body = {
"username": user,
"password": pwd
}
r = requests.post(login_url, head... | true |
9953f263a2fce7bd4389d71a4a012b815a7b75e4 | bringsyrup/SoftwareDesign | /day4/randFloat.py | UTF-8 | 168 | 2.890625 | 3 | [
"MIT"
] | permissive | #! /bin/env python
from random import random
def random_float(rnge):
return random()*(rnge[-1]-rnge[0])
if __name__=="__main__":
print random_float([1,9])
| true |
b7b343518cccdabc49f14b91bddae5e6e2e0a20c | hqyu/DL_GAN | /CGAN_traditonal.py | UTF-8 | 6,804 | 2.625 | 3 | [] | no_license |
import torch
from torchvision import transforms, datasets
import torch.nn as nn
from torch import optim as optim
from matplotlib import pyplot as plt
from torchvision.utils import save_image
import numpy as np
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
training_parameters = {
"n_epochs"... | true |
42c17056a324c5c47e923f3f94b2590781bccd1c | OrangeBaoWang/distant_speech_recognition | /btk20_src/lib/plot.py | UTF-8 | 3,370 | 3.171875 | 3 | [
"MIT"
] | permissive | #
# Beamforming Toolkit
# (btk)
#
# Module: btk.plot
# Purpose: Plotting of signals and spectra.
# Author: Fabian Jakobs
import Gnuplot
from Numeric import *
def plotData(data, cfrom=0, cto=-1, title=None):
"""
This plots the contents of the NumPy... | true |
da6bf06eb2094c2f88becfda4cc042e1904db7e8 | zhangjun007/mypython | /Week3/递归.py | UTF-8 | 366 | 3.609375 | 4 | [] | no_license | #!/usr/bin/python3
#Name:zhangjun
#Email:aceg452161724@qq.com
#Time:2018/8/23 15:07
#递归的特性:
#1.必须要有一个结束条件;
#2.递归过程中传进去的值必须是层层减少;
#3.递归层次过多会造成栈溢出,应该减少递归的使用;
def icon(n):
print(n)
if int(n/2)>0:
return icon(int(n/2))
print("---->",n)
icon(100) | true |
9e7b75316796fda7392d3a543cd4784b9229cce5 | edlayton1/juego-monop-cu | /Lugares.py | UTF-8 | 486 | 2.984375 | 3 | [] | no_license | # Module: Tablero
class Lugar:
""" Clase de tipo Lugar"""
def __init__(self,nombre,descripcion,costo,renta,status):
self.nombre = nombre
self.desc = descripcion
self.costo= costo
self.renta = renta
self.status = status
DescMetro = "La estacion de metro en ciudad Univers... | true |
c8c6c8d741fb50cdad83a15b7c25f1bf1f117b56 | psaurav/bopy | /src/bopy/spectra/checks.py | UTF-8 | 2,320 | 2.78125 | 3 | [] | no_license | import os
import numpy as np
import bopy as bp
def read_namedrowstable(filename, skip=0):
f = open(filename, 'r')
rname = []
c = 0
for l in f:
c = c + 1
if c <= skip:
continue
a = l.split()
n = a.pop(0)
val = np.array([float(v) for v in a])
... | true |
840796c0fda134b6ed4a9e54fa5aebdab259b272 | cyberbikepunk/spiders | /crawler/scraper/spiders/bruegelmann.py | UTF-8 | 3,931 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
""" The spiders for Bruegelmann (www.bruegelmann.de). """
# SCRAPING NOTES:
# ===============
#
# The retailer Bruegelmann lists products on a single page with infinite scrolling.
# Once the first batch of product urls is collected, we send additional json requests
# to collect the rest of them... | true |
43e034ad39e715fd230ac5d0d2962ba13c235c43 | Dezvi/Chessboard-creator | /chessboard_creator.py | UTF-8 | 1,382 | 3.421875 | 3 | [] | no_license | from PIL import Image
import numpy as np
import cv2
# How much padding
free_space = 200
# Size of the whole image
size_1 = 1200
size_2 = 1000
# Number of squares in each axis
n_squares_1 = 10
n_squares_2 = 8
array = [True, False, True, False, True, False, True, False, True, False]
img = Image.new("RGB", (size_2,si... | true |
e5435a30bb4036d67dc83f3558f09874b597d6a6 | PokerFace1992/keyword_driven-ING-201910 | /util/dir_operation.py | UTF-8 | 1,526 | 2.515625 | 3 | [] | no_license | #encoding=utf-8
import os
from util.calendar import *
from util.log import *
from proj_var.var import *
def make_dir(dir_path):
if not os.path.exists(dir_path):
try:
os.mkdir(dir_path)
except Exception as e:
# print("创建%s目录失败" % dir_path)
error("创建%s目录失败" % dir_p... | true |
2553ae34dffcf8ad31d7e178dd5eeb27a598e29c | RafaelSterzinger/CIL-Recommender-Systems | /movie_clustering.py | UTF-8 | 1,978 | 2.59375 | 3 | [] | no_license | import os
import matplotlib.pyplot as plt
import numpy as np
from sklearn.cluster import KMeans
import lib.models as models
from lib.utils import utils
from lib.utils.config import config
from lib.utils.loader import extract_users_items_predictions, read_data
from movie_distances import get_embeddings
def perform_k... | true |
afd6e6167471b291979a997a3f75db3ed950e8a6 | julzhk/romannumerals | /romcalc.py | UTF-8 | 2,070 | 3.328125 | 3 | [] | no_license | r2i = {
'I': 1,
'V': 5,
'X': 10,
'L': 50,
'C': 100,
'D': 500,
'M': 1000
}
thousands_looktable= {
0: ('', '', ''),
1: ('I', 'X', 'C'),
2: ('II', 'XX', 'CC'),
3: ('III','XXX','CCC' ),
4: ('IV', 'XL', 'CD'),
5: ('V', 'L', 'D'),
6:... | true |
68e93824f1602c3f95c6487d29db1d64d6a6f3e3 | lucascortes96/Rosalind_Solutions- | /07. Mendel's_First_Law.py | UTF-8 | 1,016 | 3.671875 | 4 | [] | no_license | ## This one was a little bit tough for me to get my head around again, essentially you have to follow the leaf-tree diagram and multiply the probabilities of each outcome. I struggled
## most with understanding that you needed to take into account the fact that you are removing individuals from the population, and you ... | true |
3d68d6321e5881a84ae1020edf950a51fb75e9a3 | AndresR15/Capstone---RTSD-System | /Code/Misc/models.py | UTF-8 | 2,436 | 2.765625 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import tensorflow as tf
from keras.models import Sequential, Model, load_model
from keras.layers.core import Dense, Activation
from keras.layers import LSTM, Concatenate
from sklearn.preprocessing import label_binarize
from textblob import TextBlo... | true |
9df06936e5cf7d901f592df496ebf6356bf760ff | khushboo1510/leetcode-solutions | /30-Day LeetCoding Challenge/October/Medium/849. Maximize Distance to Closest Person.py | UTF-8 | 904 | 3.78125 | 4 | [] | no_license | # https://leetcode.com/problems/maximize-distance-to-closest-person/
# You are given an array representing a row of seats where seats[i] = 1 represents a person sitting in the ith seat, and seats[i] = 0 represents that the ith seat is empty (0-indexed).
# There is at least one empty seat, and at least one person ... | true |
54ca8a8576c100d04c02f23b09dad59a49bf0171 | pkusnail/semantix | /matrix_maker.py | UTF-8 | 8,844 | 3.234375 | 3 | [
"MIT"
] | permissive | import re
from numpy import save as npsave
from numpy import log as numpy_log
from nltk.probability import FreqDist
from scipy.sparse import lil_matrix
'''
Here is long, sort of obtuse script I wrote. If you define these paths at the beginning, you'll end up with
1. A matrix of PPMI values (word-context co-occurrences... | true |
4788acc041738a04bbdd8ed686778916bc66fb67 | kleok/dinosar | /dinosar/isce/__init__.py | UTF-8 | 6,718 | 2.6875 | 3 | [
"MIT"
] | permissive | """Functions for ISCE software.
This module has functions that facilitate running `ISCE software` (v2.1.0).
Currently extensively uses external calls to GDAL command line scripts. Some
functions borrow from example applications distributed with ISCE.
.. _`ISCE software`: https://winsar.unavco.org/software/isce
"""
... | true |
6cd2abfbccb655f3d500fa607ecf57a65b3f6fe4 | hdonato/Python | /exercicio_09.py | UTF-8 | 296 | 4.53125 | 5 | [] | no_license | # Faça um Programa que peça a temperatura em graus Farenheit,
# transforme e mostre a temperatura em graus Celsius.
# C = (5 * (F-32) / 9).
tempF = input('Digite a temperatura em graus Farenheit: ')
tempC = (5 * (int(tempF) - 32) / 9)
print('Temperatura em graus Celsius: ' + str(tempC)) | true |
de6a03c780e0881bc384b5629f2dcdba51da1c67 | nhaddad/pydtk | /pydtk/ptc/ptc.py | UTF-8 | 49,110 | 2.96875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat May 12 15:28:54 2018
@author: nhaddad
"""
import numpy as np
from numpy import ma
from pydtk import Image
from scipy import stats
import matplotlib.pyplot as plt
from pydtk.utils.utilsfunc import subwindowcoor
from pydtk.utils.utils import medianstack
f... | true |
1d59d1cf26624e6fc52fc2254363caa7d74d1c20 | Hilldrupca/LeetCode | /python/Top Interview Questions - Medium/Backtracking/permutations.py | UTF-8 | 1,027 | 3.65625 | 4 | [] | no_license | from typing import List
from itertools import permutations
class Solution:
def permute(self, nums: List[int]) -> List[List[int]]:
'''
Returns all possible permutations of a list.
Example:
permute([1,2,3]) -> [(1,2,3),
(1,3,2),
... | true |
30604943101f908f6b10c900741dc7d9d16f2983 | cs3243-project-group-18/poker-ai | /pypokerengine/engine/action_checker.py | UTF-8 | 3,702 | 2.78125 | 3 | [] | no_license | from functools import reduce
class ActionChecker:
@classmethod
def correct_action(self, players, player_pos, sb_amount, action, amount=None):
if self.is_allin(players[player_pos], action, amount):
amount = players[player_pos].stack + players[player_pos].paid_sum()
elif self.__is_illegal(players, pla... | true |
943b3813b6e60658786fdef3c7f3f078c0b978a9 | 06wagon/LightningFuturesExchange | /server/transactional_data_structures/dictionary_dictionary_array_version.py | UTF-8 | 8,576 | 2.640625 | 3 | [] | no_license | from transactional import Transactional
from versioned_ordered_array import VersionedOrderedArray
class DictionaryDictionaryArrayVersion(Transactional):
def __init__(self, dic, comparer, key_name_1, key_name_2, key_1_resolver=None, key_2_resolver=None, is_in_list=None, model_name=None, events=None, update_db=Fals... | true |
5a3adfcdb4ff6111d6b66c8abd27022bdbd7c82e | asyre/bachelor_degree | /executor/scheduler.py | UTF-8 | 1,860 | 2.828125 | 3 | [
"MIT"
] | permissive | import itertools
from abc import ABCMeta, abstractmethod
from typing import List, Dict
from enum import IntEnum, auto
from executor.test_case import TestCase
class SchedulerType(IntEnum):
Parallel = auto()
Priority = auto()
class Scheduler(metaclass=ABCMeta):
@abstractmethod
def schedule(self, tes... | true |
68095f4ae908efff011e76053d7f1ea4d2265593 | LastochkinD/ArgoTelegramBot1 | /main.py | UTF-8 | 1,980 | 2.515625 | 3 | [] | no_license | import telebot
import settings
import os
from classes import UserData
from data_provider import DataProvider
users_data = []
def find_user_data(user_id):
for user in users_data:
if user.user_id == user_id:
return user
bot = telebot.TeleBot('1666463831:AAFLoOhsJH0JLuLbdf63NuWrfZTTNW7j_0k')
... | true |
9f826b7059c39c6ff2706ae47332261057bbce23 | louteranas/VisualisationScientifique | /Tp/runMe.py | UTF-8 | 4,502 | 3.453125 | 3 | [] | no_license | #!/usr/bin/env python3
from polygone import Polygone
import numpy as np
import random as rd
import matplotlib.pyplot as plt
import sys
import math
def parsingInput():
points = []
with open(sys.argv[1], 'r') as argument:
texte = argument.read()
points_str = texte.split("\n")
for point_s... | true |
9a7d9bcdee91bb5dbfde28f26d56cb5c0ff5522b | Cheriofp/python-excise | /7.11宁波19楼(一级页面+存入数据库).py | UTF-8 | 2,788 | 2.75 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import re
import csv
import requests
from lxml import etree
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import time
import pymysql #(from pymysql import *)
class Ning:
def __init__(self):
self.url = 'https://ningbo.19lou.com/thread/category/structure/search/result?fid=1996... | true |
3f78c7cbf1607e9d09964384a844a5226fc956cb | Badg/nodepandas | /core/core.py | UTF-8 | 11,182 | 3.0625 | 3 | [] | no_license | import pandas as pd
import numpy as np
from scipy.stats import gmean
import random as rand
import math
_basename = "nodecoord_"
_connect_col = "_connections"
_coord_row = "_coord"
_units_row = "_units"
"""
Goal is to extend pandas dataframes to nodes, providing direct support for
n-dim coordinates, as well as connec... | true |
1de95e71326da6ce2fc69c14d57e7f8b224a1690 | PratyakshMathur/LexicalAnalyzer | /la.py | UTF-8 | 1,902 | 3.328125 | 3 | [
"Unlicense"
] | permissive | import re
f = open('pratyaksh.txt', 'r')
operators = {'=': 'Assignment Operator', '+': 'Additon Operator', '-': 'Substraction Operator', '/': 'Division Operator', '*': 'Multiplication Operator', '++': 'increment Operator', '--': 'Decrement Operator'}
optr_keys = operators.keys()
comments = {r'//': 'Single Line Commen... | true |
4d8450a2f6c2ee293fc77b35189d9e4bf960cfc3 | BonomiC/NumberClassifier | /test.py | UTF-8 | 3,015 | 2.921875 | 3 | [] | no_license | import numpy as np
from PIL import ImageTk, Image, ImageDraw
import PIL
from tkinter import *
# ******************************************
from create_model import create_model
import tensorflow as tf
model = create_model()
model.load_weights('./checkpoint/saved_weights')
# ****************************************... | true |
4ab4b14559987f9ba5bcf0b2b43e968205cb86f0 | dororich/AtCoder | /AtCoder Beginner Contest 154/B_I miss you.py | UTF-8 | 104 | 3.578125 | 4 | [] | no_license | import re
# 入力
s = input()
# 正規表現で置き換え
ans = re.sub(r'[a-z]', 'x', s)
print(ans)
| true |
664813a423b404e67d6a613612067425417377e9 | rishikeshpuri/Algorithms-and-Data-Structure | /linked_list/single linked list- insertion.py | UTF-8 | 1,230 | 4.125 | 4 | [] | no_license | class Node:
def __init__(self, data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
self.head = None
def print(self):
current_node = self.head
while current_node != None:
print(current_node.data)
current_node = curre... | true |
e0c87eaf1f5d6718096c369917517d21d8670fd1 | Xbolanos/PruebaSimMachines | /Opcion 1/opcion1-2.py | UTF-8 | 1,430 | 3.09375 | 3 | [] | no_license | import numpy as np
import pandas as pd
from sklearn.cross_validation import train_test_split
from sklearn.tree import DecisionTreeClassifier
from sklearn.metrics import accuracy_score
from sklearn import tree
# Define Colums name
column_name=["id","area","bedrooms","month_sold","year_sold","sale_price"]
# Read train.c... | true |
cb1b20524b187ebcc1eb122e3d57f95046574561 | jlgpereira/20060705-Projeto-PW-DjangoP2 | /website/migrations/0002_auto_20210704_0022.py | UTF-8 | 2,379 | 2.5625 | 3 | [] | no_license | # Generated by Django 3.2.4 on 2021-07-03 23:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('website', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='quiz',
name='p1',
... | true |
870a4f9f3b5ad8f5b78b97df957638e675f313da | DnAp/chatbot | /PyModels/preparation/prepare_entities_dataset.py | UTF-8 | 3,337 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Подготовка датасета для тренировки entity extraction моделей
"""
from __future__ import division # for python2 compatibility
from __future__ import print_function
import gc
import itertools
import json
import os
import gensim
import numpy as np
import io
import argparse
import random
impo... | true |
12089a6323c8220b02ed865980af7bdc5fc6611d | zelvor/cse-ppl | /Week2 - Lexer/Tut1/initial/src/test/LexerSuite.py | UTF-8 | 1,211 | 3.125 | 3 | [] | no_license | import unittest
from TestUtils import TestLexer
class LexerSuite(unittest.TestCase):
def test_identifier1(self):
"""test identifiers"""
self.assertTrue(TestLexer.checkLexeme("ab","",101))
def test_identifier2(self):
self.assertTrue(TestLexer.checkLexeme("1","",102))
def tes... | true |
a89a3a6a1d6091f68aa65b8137d0d5ff4f7a82c4 | mathxs/ProjetoPLN | /Projeto/Auxiliar/NBClassifier.py | UTF-8 | 7,666 | 2.921875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import sys
import re
import math
import re
from nltk import word_tokenize, pos_tag, ne_chunk
regex = r"[-'a-zA-ZÀ-ÖØ-öø-ÿ]+"
at_nltk = False
class NBClassifier:
def __init__(self, training_file=None,at_nltk=False):
self.Data = []
self.Classes = dict([])
... | true |
07365251ddce03c4d0c9b8ae452cf4806ee1b6fe | jty-cu/LeetCode | /Algorithms/063-不同路径2.py | UTF-8 | 1,312 | 3.140625 | 3 | [] | no_license | ## 遇到障碍直接跳过
class Solution:
def uniquePathsWithObstacles(self, obstacleGrid: List[List[int]]) -> int:
m, n = len(obstacleGrid), len(obstacleGrid[0])
dp = [[0]*(n+1) for _ in range(m+1)]
## base case
dp[1][1] = 1 if obstacleGrid[0][0]==0 else 0
for i in range(1, m+1):
... | true |
7c4ff1fe04e37918a7ba271f96784f13d50657ab | sasankyadavalli/leetcode | /nthUglyNumber_264.py | UTF-8 | 443 | 3.34375 | 3 | [] | no_license | class Solution:
def nthUglyNumber(self, n: int) -> int:
ugly = [1]
i ,j, k = 0, 0, 0
while n > 1:
u1, u2, u3 = ugly[i]*2, ugly[j]*3, ugly[k]*5
minN = min(u1, u2, u3)
if minN == u1:
i += 1
if minN == u2:
j += 1
... | true |
021132edfb929a194ebe1db0d51062ec581c14ab | harrinry/conjur-api-python3 | /conjur/data_object/policy_data.py | UTF-8 | 929 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
PolicyData module
This module represents the DTO that holds the params the user passes in.
We use this DTO to build the policy request
"""
# pylint: disable=too-few-public-methods
class PolicyData:
"""
Used for organizing the the params the user passed in to execute the policy com... | true |
c1f8a50cbbb3e2124eb61b9be92b1f3076b8c659 | vamshivarsa/tikinter_project | /billtable.py | UTF-8 | 1,438 | 2.84375 | 3 | [] | no_license | from tkinter import *
import psycopg2
def submit():
conn=psycopg2.connect(dbname="vamshi",user="postgres",password="davs",host="localhost",port="5432")
cur = conn.cursor()
name1 = namebox.get()
status1=statusbox.get()
amount1=amountbox.get()
paid_on1=paidbox.get()
query='''insert into bill(... | true |
a032aeb5915263366183ac5348f7ca3d1f4c86cd | ECE-Engineer/Electrohydrodynamic-Graphing-Analysis-Tool | /ehdgraph/test-program.py | UTF-8 | 2,656 | 2.703125 | 3 | [] | no_license | from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
import pyqtgraph as pg
import serial
import string
import sys
import subprocess
import os
import time
import math
#THIS INITIALIZES THE GRAPHICAL USER INTERFACE (GUI)
app = QtGui.QApplication([])
win = pg.GraphicsWindow(title="Electro-Hydro-Dynamic... | true |
0ed1c8346a37f042a340396b8853d8d010380452 | tonyhuang124/CSC411---Machine-Learning | /A2/q2_1.py | UTF-8 | 5,128 | 3.5625 | 4 | [] | no_license | '''
Question 2.1 Skeleton Code
Here you should implement and evaluate the k-NN classifier.
'''
import data
import numpy as np
from sklearn.model_selection import KFold
# Import pyplot - plt.imshow is useful!
import matplotlib.pyplot as plt
class KNearestNeighbor(object):
'''
K Nearest Neighbor classifier
... | true |
41b8c6da5698a9730d00a5fc0614e711043661b3 | tonydelanuez/python-ds-algos | /probs/single-number.py | UTF-8 | 302 | 3.234375 | 3 | [] | no_license | class Solution(object):
def singleNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
the_num = 0
for val in nums:
the_num = the_num ^ val
print(the_num)
print(the_num)
return(the_num)
test = Solution()
numbers = [1,1,2,2,3,3,4,5,5,6,6,7,7]
test.singleNumber(numbers) | true |
13992d049092e76fd0d7806bd28ba99251690f21 | sekihiro/ImageProcessing | /_seki/16_frame_diff.py | UTF-8 | 2,421 | 3.0625 | 3 | [] | no_license | #!/usr/bin/env python
#-*- coding:utf-8 -*-
import os
import cv2
import pprint
import numpy as np
# ---------- フレーム間差分法 ----------
# 移動物体を撮影した異なる時間の3枚の画像を用いて移動物体領域を取り出すことができる
# なお、3枚の画像において、背景は変化がないものとする
# 3枚の画像をABCとする
# AとB、BとCの差分画像を作成し、しきい値処理を施し2値画像ABとBCを得る
# つぎに、2値画像ABとBCのAND処理を行い、ABとBCの共通領域を取り出すことで、画... | true |
365df863525f7b26cceecf712343dfb70d8b93b2 | MNgremmadji/Parallele-Computing-CUDA | /Code/pi_cuda.py | UTF-8 | 828 | 2.53125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: Mohamed NIANG
"""
import time
import numpy as np
import pycuda.driver as cuda
import pycuda.autoinit
from pycuda.compiler import SourceModule
nb_tirage=10000
BLOCKDIM=512
NB_BLOCK=12800
N=BLOCKDIM*NB_BLOCK
res=np.empty(N).astype(np.int32)
f = open("pi_kerne... | true |
8310dc02b44a106d9c76ee2a4759f2106814b760 | DmitriChe/client-server-with-JIM | /server/protocol.py | UTF-8 | 966 | 2.828125 | 3 | [] | no_license | # Утилитарный модуль для утилитарных, вспомогательных функци, позволяющих производить валидацию
# и регламентировать взаимодействие клиента и сервера
from datetime import datetime
# Валидация объекта запроса клиента на предмет наличия необходимых полей action и time
def validate_request(request):
if 'action' in r... | true |
2b73ccbea6292c2f98826eac6f877465de8a4616 | zihao12/ebpmf_demo | /data/10xgenomics/cd14_monocytes/filtered_matrices_mex/hg19/prepare_mtx.py | UTF-8 | 686 | 2.609375 | 3 | [] | no_license | ## Input: Y.csv, Yhat.csv
## output: train.mtx, test.mtx, validation.mtx
from scipy import sparse, io
import numpy as np
import os
np.random.seed(123)
Y = np.genfromtxt("Y.csv",delimiter = ",")
Yhat = np.genfromtxt("Yhat.csv",delimiter = ",")
n_val = min(500, int(0.1*Y.shape[0]))
idx = np.random.randint(Y.shape[0], ... | true |
1de516101fd195344ec3777a0985b1e7fc611975 | yywzgh/ServerInspection | /mysql_check.py | UTF-8 | 1,034 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
# coding=utf-8
# ----------------------------------------------------------
# Name: MySQL巡检脚本
# Purpose: 监控多台Web服务器状态,一旦出现问题就发送邮件
# Version: 1.0
# Author: nick
# BLOG: http://yywzgh.com
# EMAIL: yywzgh@gmail.com
# Created: 2018-06-01
# Copyright: (c) LEO 2013
# Python: 3.6
# ----------... | true |
d09aff13b635db27d2ff88145cbb666e5953d834 | Raniac/NEURO-LEARN | /env/lib/python3.6/site-packages/nibabel/openers.py | UTF-8 | 9,177 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | # emacs: -*- mode: python-mode; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the NiBabel package for the
# copyright and license terms.
#
### ### ### #... | true |
1c0ee40ba3fd1089f5e140d394398b01e6988028 | Aasthaengg/IBMdataset | /Python_codes/p02401/s447387752.py | UTF-8 | 275 | 3.625 | 4 | [] | no_license | a = []
while True:
m,n,o = input().split()
m=int(m)
o=int(o)
if n == "?":
break
if n=="+":
a.append(m+o)
elif n=="-":
a.append(m-o)
elif n=="*":
a.append(m*o)
elif n=="/":
a.append(int(m/o))
for i in a:
print(i) | true |
5ba088122b5f3290902606f3d145e030fc5ae60c | shettyprithvi/Twitter-sentiment-analysis | /Twitter sentiment analysis.py | UTF-8 | 2,274 | 3.109375 | 3 | [] | no_license |
# coding: utf-8
# In[1]:
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import scipy as sp
get_ipython().run_line_magic('matplotlib', 'inline')
# In[2]:
get_ipython().system('pip install tweepy')
# In[3]:
get_ipython().system('pip install textblob')
# In[10]:
import tweepy
# In... | true |
da577861d8c003ef784258f46d8bdcb319bd443c | andress5990/09_Programas_para_analisis_de_imagenes_en_general | /IFP_histo.py | UTF-8 | 2,029 | 3 | 3 | [] | no_license | import numpy
from PIL import Image
import matplotlib.pyplot as plt
import itertools
import matplotlib.mlab as mlab
from scipy.stats import norm
import pdb
def luminosity( l, k):
r, g, b=pixel_values[l][k]
lum=0.299*r +0.587*g+0.114*b
return lum
L=[] #Matrix
im=Image.open('Color.jpg') #Ley... | true |
88b96e876587668a9483917d4e1ef4c20d9d423b | andyjung2104/BOJ-source-codes | /1195.py | UTF-8 | 491 | 3.203125 | 3 | [] | no_license | #1195
a=input().strip()
s1=a[:]
b=input().strip()
s2=b[:]
def isokay(list1,list2):
for i in range(min(len(list1),len(list2))):
if int(list1[i])+int(list2[i])>=4:return False
return True
minlen=len(s1+s2)
for i in range(len(s2)+1):
if isokay(s1,s2):
minlen=min(minlen,max(len... | true |
fe8f095c5093fcedf8a3c93909c231ea5e2a90d9 | johntmyers/py-project-template | /proj/base.py | UTF-8 | 870 | 3.640625 | 4 | [] | no_license | """
Base Main Class
"""
import logging
LOGGER = logging.getLogger(__name__)
LOGGER.setLevel(logging.INFO)
logging.basicConfig()
class Main(object):
"""A class and some docs
Attributes:
- my_string (str): Some string
- my_int (int): Some int
"""
def __init__(self, arg1, arg2):
... | true |
414208c74084fbd402bfe0db3e3cf21b02472be4 | migueljabugo/CursoPython | /Curso-python/Ejercicios/VideoJuego.py | UTF-8 | 420 | 3.015625 | 3 | [] | no_license | import random
class VideoJuego:
def __init__(self, nombre, publisher, fecha):
self.nombre = nombre
self.publisher = publisher
self.fecha = fecha
self.jugado = False
def valorarlo(self):
return random.randint(0, 10)
def jugar(self):
self.jugado = True
def __str__(self):
return "Nombre: "+ self.nom... | true |
54b3137bbb394b9274dbb6c382860116e6c59515 | Ramtej4444/Book-Shop-Automation-Software | /Class/NotInCollection.py | UTF-8 | 1,320 | 2.671875 | 3 | [] | no_license | # self class contains "requests" for books that are not sold in the shop
class NotInCollection:
def __init__(self, noOfRequests=1, requestId=None, bookTitle=None, authorName=None, publisherName=None,
ISBNCode=None):
self.noOfRequests = noOfRequests
self.requestId = requestId
... | true |
5a1d6b21c52e655d6c0c5a775748190ac75cde86 | KuTaeHun/WordFrequency | /setting_crawling.py | UTF-8 | 16,608 | 2.921875 | 3 | [] | no_license | # 사용자 설정에 맞는 크롤링을 하기 위해서 만든 클래스 모음
import main_screen
import main
import make_result_crawling
import copy
try:
from tkinter import filedialog
from tkinter import messagebox
import tkinter.font
import tkinter as tk
except:
import Tkinter as tk
import Tkinter.font
from tkinter import filedial... | true |
769910e9b4f83fcd096faecd6c534b324907bcbd | matthigg/leetcode | /blank/Palindromic-Substrings.py | UTF-8 | 1,434 | 3.765625 | 4 | [] | no_license | # Given a string, your task is to count how many palindromic substrings in this
# string.
#
# The substrings with different start indexes or end indexes are counted as
# different substrings even they consist of same characters.
#
# Example 1:
#
# Input: "abc"
# Output: 3
# Explanation: Three palindromic strings: "a"... | true |
7f594cf818e1d597ad41eed83a125672c3ce4ab5 | ygzmdmdlsnldxtm/Python | /ex1_02.py | UTF-8 | 411 | 4 | 4 | [] | no_license | """
斐波那契数列
"""
def f(n):
if n == 1 or n == 0:
return 1
else:
return f(n-2)+f(n-1)
for i in range(0,6):
print(f(i))
s = 'abc'
print(len(str(hash(s)))*4, hash(s))#第一个参数固定长度
print(len(s))
#打印三角形
n = int(input("请输入三角形宽度:"))
for i in range(0,n):
for j in range(2*i+1):
... | true |
10191d8af84818571c853d4dc510ace81758bf83 | chrislevn/Coding-Challenges | /Orange/Mid_term/The_Sultan_Successors.py | UTF-8 | 1,430 | 3.28125 | 3 | [] | no_license | n = 8
board = [[0] * n for i in range(n)]
def print_solution():
for i in range(n):
for j in range(n):
print(board[i][j], end=' ')
print()
print()
def calculate_sum(actual_board, temp_board):
sum_value = 0
for i in range(n):
for j in range(n):
if tem... | true |
b854f12812104f89670ffb8e4cdefc8d8ce4409c | Zylophone/practice | /task_scheduler.py | UTF-8 | 1,045 | 3.234375 | 3 | [] | no_license | import collections
class Solution(object):
'''
def leastInterval(self, tasks, n):
"""
:type tasks: List[str]
:type n: int
:rtype: int
"""
cnt = collections.Counter(tasks)
time = 0
while True:
top_n = cnt.most_common(n + 1)
... | true |
3e3bc7b5e2b9d423d941dcc013cff813653571c3 | marchoy/fantasy-auto-set | /set-lineup.py | UTF-8 | 1,741 | 2.8125 | 3 | [] | no_license | import time
import getpass
from datetime import date
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
def start_active_players():
"""
Places active players in your lineup for Yahoo! Fantasy Hockey.
username: your Yahoo! username
password: your Yahoo! password
days: the number of da... | true |
993df9d575a834a75dc685ec01f496225ab05f6a | tangentstorm/tangentlabs | /python/nonlocal.py | UTF-8 | 398 | 3.265625 | 3 | [] | no_license |
def make_counter(start:int=0)->int:
count = start
def counter()->int:
nonlocal count
result = count
count += 1
return result
return counter
c = make_counter()
assert c() == 0
assert c() == 1
class foo: x = 1
def make_zero():
def foo():
return foo.x
foo.x... | true |
8409d54bcc474c6bad0896f5c89939f59923a60d | phittawatch/6230401945-oop-labs | /Phittawat_6230401945-lab11/Excercise3.py | UTF-8 | 1,768 | 2.890625 | 3 | [] | no_license | import sys
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
class CheckDemo(QWidget):
def __init__(self, parent = None):
super(CheckDemo, self).__init__(parent)
self.init_ui()
def init_ui(self):
fbox = QFormLayout()
layout = QHBoxLayout()
label_n... | true |
065d60f5dd373a7a0e186397f25189e1bf34d7e0 | daw202/PHYS202-S14 | /SciPy/Electrostatics.py | UTF-8 | 707 | 3.328125 | 3 | [] | no_license |
import numpy as np
def pointPotential(x, y, q, Xc, Yc):
'''
Return the electric potential for a point charge q at (Xc, Yc)
Units returned are [Volts] if input units are [meters] and [Coulombs]
'''
k = 8.987551787997912e9 #units (Nm^2/C^2)
Vxy = k*q/np.sqrt(((x - Xc)**2 + (y - Yc)**2)... | true |
e024ff1297f3baef275d0199b7a01722b74b7fd6 | Leonavr/Small_projects | /HTML/mp3.py | UTF-8 | 753 | 2.921875 | 3 | [] | no_license | import os
path = input('Введите путь к папке: ')
files = os.listdir(path)
files_mp3 = [i for i in files if i.endswith('.mp3')]
def create_playlist(playlist_path, files):
with open(playlist_path, 'w', encoding='utf-8') as p:
for f in files_mp3:
print(f, file=p)
'''name = path.split('\\')[-1]
artist = name.split('... | true |
4b9e5b1f3b360fece736f9c7d3e9d6a45d80294d | JCLancho/ADAT | /Examen1911/Ejercicio2.py | UTF-8 | 2,050 | 3.671875 | 4 | [] | no_license | import mysql.connector
from mysql.connector import Error, cursor
class Ejercicio2:
"""Clase para el ejercicio 2"""
# selecciono el alumno al que quiero cambiar el nombre, solo uno
selectQuery = """select alumnos.APENOM
from alumnos
where alumnos.DNI = %s"""
# actualizo el nombre del alumno encontrad... | true |
d16d0dadb8bed12129607529794a3b407ed4d699 | prabhu113/TEAM-TRI-MULTI-LEVEL-1.0.3 | /TEAM-TRI-MULTI-LEVEL-1.0.3/src/player.py | UTF-8 | 10,507 | 3 | 3 | [] | no_license | """
This module is used to hold the Player class. The Player represents the user-
controlled sprite on the screen.
"""
import pygame
from src import utils
from src import constants
from src.simple_bullet import SimpleBullet
from src.level_manager import *
from src.level import Level
#from platforms import MovingPlatfo... | true |
0faa44683ffe4d83da3bca78f2e09a50b9adc8b6 | dizballanze/blazing-fast-django-tests-example | /bar/blog/tests/tests_articles_list.py | UTF-8 | 1,658 | 2.625 | 3 | [] | no_license | from django.urls import reverse
from blog.tests.base_test_case import BaseBlogTestCase
class ArticlesListTestCase(BaseBlogTestCase):
def test_foo_bar(self):
self.assertEqual(1+1, 2)
def test_url_resolving(self):
self.assertEqual(reverse('articles_list'), '/blog/')
class ArticlesListPagina... | true |
1bcc5697a853e4798364f080b062bd7666c9adea | RaniaMahmoud/SW_D_Python | /Sheet1/S1/P12.py | UTF-8 | 152 | 3.515625 | 4 | [] | no_license | #P12:
print ("P12:\n")
import math as m
#V=4/3πr^3
r = int(input("Enter Radius: "))
v = (4/3.0)* m.pi*(r**3)
print ("volume of a sphere :",v,"\n")
| true |
5cf96a151c518f84b595d4c9d7c8bbf1b5dde84f | gryffindorito/April | /aprilMarkVI/medicine_alert.py | UTF-8 | 1,441 | 2.65625 | 3 | [] | no_license | import socket
import time
import speech_recognition as sr
import sys
import time
from time import ctime
import pygame
import os
import alsaaudio
import sqlite3 as sql
def day_time():
text=list(time.ctime().split(' '))
#print text
if text[2]!='':
year=text[4]
date=text[2]
ti=list(text[3].split(':'))
#pr... | true |
5004ce50917c348007f06d0f11f8ead579066d8d | pymanopt/pymanopt | /src/pymanopt/manifolds/sphere.py | UTF-8 | 6,938 | 3.015625 | 3 | [
"BSD-3-Clause"
] | permissive | import warnings
import numpy as np
from pymanopt.manifolds.manifold import RiemannianSubmanifold
from pymanopt.tools import extend_docstring
class _SphereBase(RiemannianSubmanifold):
def __init__(self, *shape, name, dimension):
if len(shape) == 0:
raise TypeError("Need at least one dimension... | true |
033003cd83bb4b1cd524341398a33ef1f70686cd | EbubekirKocadag/HackYourCity-8 | /app/form.py | UTF-8 | 738 | 2.625 | 3 | [] | no_license | from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField
from wtforms.validators import DataRequired, Length
class RegistrationForm(FlaskForm):
username = StringField('Username', validators=[DataRequired(), Length(min=2, max=20)])
password = PasswordField('Password', validat... | true |
92d8fd84739b5802389e8eeb870ca976bcd7b325 | dipesh-commits/ML_Materials | /Face Attendance/data_preparation.py | UTF-8 | 1,773 | 2.6875 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
import cv2
import os
from PIL import Image
from mtcnn.mtcnn import MTCNN
train_dir = 'data/train'
valid_dir = 'data/val'
face_detector = MTCNN()
# for i in os.listdir(train_dir):
# print(i)
# my_img = 'data/train/madonna/httpiamediaimdbcomimagesMMVBMTANDQNTAxN... | true |
de4a8a80e2cafd67bd9b7c7c241de099b1802ada | chartaccent/chartaccent-deployment-analysis | /analysis/dump_directory.py | UTF-8 | 757 | 2.53125 | 3 | [] | no_license | import os
import json
from utils import readJSONFile
class DumpDirectory:
def __init__(self, root):
self.root = root
def sessions(self):
for root, dirs, files in os.walk(os.path.join(self.root, "sessions")):
for file in files:
if not file.endswith(".json"): continu... | true |
5d58565f7afedef11e701e7b9a6747760add6334 | ejreymond-christensen/Python-MovieSite | /entertainment_center.py | UTF-8 | 2,877 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import media
import fresh_tomatoes
arrival = media.Movie("Arrival",
"When twelve mysterious spacecraft appear around the world, linguistics professor Louise Banks is tasked with interpreting the language of the apparent alien visitors.",
"https://imag... | true |
1fca7bed07621811dbbeaa9ba791b7593e6d9329 | alexandraback/datacollection | /solutions_2463486_1/Python/airhuff/sol3.py | UTF-8 | 546 | 3.4375 | 3 | [] | no_license | from math import sqrt
def numreverse(num):
return int(str(num)[::-1])
def ispalindrome(num):
if numreverse(num)==num:
return True
return False
inp = open("file1.txt").read().splitlines()
outp = open("out1.txt","w")
vec = []
for i in range(1,10000001):
if ispalindrome(i) and ispalindrome(i**2):
vec.append(i... | true |
7125c98c1328bb88b0edea2015fb897fb1459881 | gomonuk/polytech | /opengl_example/src/torus_and_cube.py | UTF-8 | 1,567 | 3 | 3 | [] | no_license | from OpenGL.GLUT import *
from OpenGL.GL import *
from src.base_settings import BaseSettings
# Изобразить тор и куб. Одна вершина куба совпадает с центром тора.
# Промасштабировать тор с коэффициентом 0.3.
# glPushMatrix сдвигает текущий стек матрицы на единицу, дублируя текущую матрицу.
# То есть после вызова glPu... | true |
e49293da92db769e59ae78d2228bf5feefa4fd1c | cb678/met4ene | /optwrf/optwrf/wrfparams.py | UTF-8 | 16,939 | 3.265625 | 3 | [
"BSD-3-Clause"
] | permissive | """
Generates sets of WRF physics parameters, finds corresponding numeric identifies,
and writes the numeric paramter options to a CSV.
Known Issues/Wishlist:
- It would be better if I could read in the parameters from the in_yaml
file only once, but I'm not sure how variables across different
functions in the same m... | true |
8c253b35010e836efb46c121596d4b6f5df12e92 | jakubbrodzinski/aoc-2020 | /day5/runner.py | UTF-8 | 702 | 3.28125 | 3 | [] | no_license | from day5.BinaryBoarding import BinaryBoardingParser
from utils.file_utils import read_file_lines
def run_part_one():
max_seat_id = 0
for line in read_file_lines('input/input-data'):
seat_id = BinaryBoardingParser.parse(line)
if seat_id > max_seat_id:
max_seat_id = seat_id
retu... | true |
abba824cbc38865acdbb2ad4fd71e8b46336d846 | zht13003/leetcode-PersonalNote | /DFS/419. 甲板上的战舰.py | UTF-8 | 1,253 | 3.90625 | 4 | [] | no_license | """
https://leetcode-cn.com/problems/battleships-in-a-board/
"""
from typing import List
# 搜索战舰头,它的左边和上面必定为空
def countBattleships(board: List[List[str]]) -> int:
count = 0
for i in range(len(board)):
for j in range(len(board[0])):
if board[i][j] == 'X' and (i == 0 or board[i - 1][j] == '.')... | true |
3519e20d082ad2dd183ca148650dd5fa1c08b86d | danfairs/django-db-utils | /dbutils/helpers.py | UTF-8 | 3,302 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | from collections import defaultdict
def queryset_to_dict(qs, key='pk', singular=True):
"""
Given a queryset will transform it into a dictionary based on ``key``.
"""
if singular:
result = {}
for u in qs:
result.setdefault(getattr(u, key), u)
else:
result = defaul... | true |
129016317c423775b10bec4b0b33d4cca6bb9f6d | 329114429/home | /double_ball/test.py | UTF-8 | 372 | 2.953125 | 3 | [] | no_license | import pandas as pd
import collections
import numpy as np
def test1():
num = [[1, 2], [2, 3], [3, 4]]
num1, num2 = max(num, key=lambda x: x[0])
print(num1, num2)
def test2():
list2 = [[1, 2, 3], [2, 3, 4], [3, 4, 5]]
a = np.array(list2)
a_counter = collections.Counter(a.flatten())
print(... | true |
ae4b588a5bc6b778312d3dddd7a89273d725da61 | HeQiang-IOS/python- | /爬虫/CookieDemo.py | UTF-8 | 3,975 | 2.515625 | 3 | [] | no_license | # coding=utf-8
import urllib.request
import http.cookiejar
import urllib.error
"""
Cookie名字(Name)
Cookie的值(Value)
Cookie的过期时间(Expires/Max-Age)
Cookie作用路径(Path)
Cookie所在域名(Domain),
使用Cookie进行安全连接(Secure)。
前两个参数是Cookie应用的必要条件,另外,还包括Cookie大小(Size,不同浏览器对Cookie个数及大小限制是有差异的)。
"""
def test1():
# 1. 构建一个已经登录过的用户的header... | true |
ecea8792b9e129477d48db072a7a49ecae80bfde | marque-antoine/Art-of-War | /Ponthieu:Danner/AutreGroupe:8_12_17/Royaume.py | ISO-8859-1 | 964 | 3.140625 | 3 | [] | no_license |
#Royaume
#Cree un royaume au joueur
#Joueur -> royaume
def creer_Royaume(Joueur):
return []
#Recupere le royaume du joueur passe en parametre
#Joueur -> royaume
def getRoyaume(Joueur):
return 0
#retourne vrai si le royaume est vide, faux le cas chant
#Royaume -> bool
def royaumeVide(Royaume):
... | true |
af6e7be9b266b3a848943bb7fa91bd3397bbc449 | reinsch82/myHomeRaspi | /http_server.py | UTF-8 | 2,105 | 2.609375 | 3 | [] | no_license | #! /usr/bin/python
# -*- coding: utf-8 -*-
# simple http server for raspberry
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
import SimpleHTTPServer
import urlparse
from threading import Timer
import pifacedigitalio as pf
piFace = pf.PiFaceDigital()
def switchOff(*args):
print "switch off pins "... | true |
cef1e9289ebbff7cfb84dc11a585042190c013da | dwagon/pydominion | /dominion/cards/Card_BandOfMisfits.py | UTF-8 | 2,092 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
""" http://wiki.dominionstrategy.com/index.php/Band_of_misfits"""
import unittest
from dominion import Card, Game, Piles
###############################################################################
class Card_BandOfMisfits(Card.Card):
"""Band of Misfits"""
def __init__(self):
... | true |
e329585edccf17a455ab3a93070d6055748a9321 | exbbrat/PhytonGames | /tic_tak_toe_v_01.py | UTF-8 | 6,083 | 4.3125 | 4 | [] | no_license | #Wellcome tictactoe
import random
def drawBoard(board):
# This function prints out the board that it was passed.
# "board" - is a list of 10 strings representing the board (ingnore index 0)
print(board[7] + ' | '+ board[8] + ' | ' + board[9])
print('-+-+-+-')
print(board[4] + ' | '+ b... | true |
c60b90b074441a5083f02e1720d11ecc3e8dd4e5 | dongshukai/Python-Exercise | /Exercise/test_003/test_3009.py | UTF-8 | 200 | 3.015625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
def a(num, result=[]):
id = num
for k in [1, 2]:
result.append((k, id))
while id:
id -= 1
a(id)
return result
print a(2)
| true |
0f32f315baddc00bfe32e7aefc4f5cfff755a2cf | nasa/fprime | /Autocoders/Python/src/fprime_ac/models/PortFactory.py | UTF-8 | 4,723 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
# ===============================================================================
# NAME: PortFactory.py
#
# DESCRIPTION: This is a factory class for instancing the Port (interface type)
# and building up the Port and Arg configuration required.
#
# AUTHOR: reder
# EMAIL: reder@jpl.... | true |
0b08ba43272a054e6b3b833ec9b371b17e68c7c5 | Likelion-Algorithm/AlgoStudy | /티어 별 문제/실버2/차이를 최대로/주현.py | UTF-8 | 324 | 3.09375 | 3 | [] | no_license | from itertools import permutations
N = int(input())
array = list(map(int,input().split()))
def cuscal(A,n):
total = 0
for i in range(0,n-1):
total += abs(A[i]-A[i+1])
return total
answer = permutations(array,N)
temp = 0
for i in answer:
if temp < cuscal(i,N):
temp = cuscal(i,N)
print(t... | true |
02cdd186f01e431c7a2725af11a56dd5f320fc73 | Ashritha28/Hospital-Home | /python/tfidf.py | UTF-8 | 4,059 | 2.609375 | 3 | [] | no_license | import mysql.connector
from nltk.corpus import stopwords
import re
from math import log
conn1=mysql.connector.connect(user='root', password='1234',database='hospitalHome')
conn2=mysql.connector.connect(user='root', password='1234',database='hospitalHome')
stop = stopwords.words('english')
def term_freq(disease_id, s... | true |
6c3f1a6a719e403c78c28aeca148450203575b46 | KubanLink/Python | /cis832-hw2-CorbinYoung.py | UTF-8 | 1,334 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue May 26 14:58:42 2020
@author: corbinyoung
"""
'Import matplotlib'
import matplotlib.pyplot as plt
'Import numbpy'
import numpy as np
'create an outline shape'
r=-1
q= -0.5
t=np.linspace(0,2*np.pi,1000)
d=np.linspace(0,2*np.pi,1000)
'create pupils'
e=... | true |
0f3d1a911017632cdad8d9121358c65893fbb9ea | JasonShadle/TwitterBot | /run_requests.py | UTF-8 | 481 | 2.703125 | 3 | [] | no_license | import requests, json, config
from requests_oauthlib import OAuth1
url = 'https://stream.twitter.com/1.1/statuses/sample.json'
auth = OAuth1(config.consumerKey, config.consumerSecret, config.accessToken, config.accessSecret)
file = open('tweets.txt', 'w')
r = requests.get(url, auth=auth, stream=True)
for line in r.it... | true |
7659b3a4caad02d174d698d14a5c99f2f6db93f9 | HomingHamster/PyJ | /main.py | UTF-8 | 7,456 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
#PyJ authors Andy Cooper and Felix Farquharson
import re
from Tkinter import *
class GUI(Tk):
def __init__(self):
Tk.__init__(self)
self.geometry("%dx%d+100+100" % (self.winfo_screenwidth()-350, self.winfo_screenheight()-450))
self.minsize(600, 300)
self.create... | true |
78a7edd6482832cd247f28beec74d99425df76c6 | BryanSaxon/exercism | /python/armstrong-numbers/armstrong_numbers.py | UTF-8 | 132 | 3.078125 | 3 | [] | no_license | def is_armstrong_number(number):
digits = str(number)
return number == sum(int(digit) ** len(digits) for digit in digits)
| true |
77cec36117c8434d08545fe320058c1facb08a31 | mf-111111/mf-homework | /Homework_Lesson05/action.py | UTF-8 | 1,441 | 3.375 | 3 | [] | no_license | import pandas as pd
from wordcloud import WordCloud
from nltk.tokenize import word_tokenize
import matplotlib.pyplot as plt
# 数据加载
data = pd.read_csv("Market_Basket_Optimisation.csv",header=None)
# print(data)
# 将数据存放操transactions中
transactions = []
# 存储字典key:value
item_count = {}
for i in range(data.s... | true |