blob_id large_string | language large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|---|
f093f05a9903def3a5760f3cfa30b11ed524ba3a | Python | Diorski/CP164 | /dann4440_l05/src/t04.py | UTF-8 | 369 | 2.609375 | 3 | [] | no_license | """
-------------------------------------------------------
[program description]
-------------------------------------------------------
Author: Max Dann
ID: 190274440
Email: dann4440@mylaurier.ca
__updated__ = "2020-02-11"
-------------------------------------------------------
"""
from functions im... | true |
2a128310a67a5a6ab662942fdcb2df828ea90282 | Python | santosh-code/lasso_ridge | /toyota.py | UTF-8 | 1,362 | 2.9375 | 3 | [] | no_license | import pandas as pd
import matplotlib.pylab as plt
import numpy as np
toyota=pd.read_csv('C:/Users/USER/Desktop/ToyotaCorolla.csv',encoding= 'unicode_escape')
toyota1=toyota.iloc[:,[2,3,6,8,12,13,14,15,16,17]]
x=toyota1.iloc[:,1:]
y=toyota1.iloc[:,0]
from sklearn.linear_model import Lasso
lasso=Lasso(alpha=1,no... | true |
faf5f44e6baa25e137621ea5a4644f5f5d022090 | Python | resgroup/mini-wake | /demo.py | UTF-8 | 1,376 | 2.546875 | 3 | [
"MIT"
] | permissive | from miniwake import SingleWake
from miniwake.turbine import Turbine
from miniwake.turbine import FixedThrustCurve
import numpy as np
import matplotlib.pyplot as plt
upwind_turbine = Turbine(name="T1",
x=0.0,
y=0.0,
hub_height=80.0,
... | true |
91a3e6aa19daa1b647413a8a5a0fa5e8b51552e9 | Python | milesmackenzie/dataquest | /step_3/command_line_beginner/Guided Project_ Working With Data Downloads/exploration.py | UTF-8 | 630 | 3.109375 | 3 | [] | no_license | # Reading in data and using Series.value_counts() to count
# JJ (Juvenile justice facility) and SCH_STATUS_MAGNET (magnet school).
# Generating pivot tables for total enrollment by gender for a JJ facility and
# magnet school
import pandas as pd
if __name__ == "__main__":
data = pd.read_csv("data/CRDC2013_14.csv"... | true |
858bb2e258474bacb210ca30acf3659ec99d978a | Python | Jhonattanln/Ibov-vs-SPX | /Ibov vs SPX/Ibov_vs_SPX.py | UTF-8 | 1,167 | 3.109375 | 3 | [
"MIT"
] | permissive | #### Importando bibliotecas
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
##### Manipulando dados
df = pd.read_excel(r'C:\Users\Jhona\OneDrive - Grupo Marista\Clube de Finanças\Clube\Dados\SPX.xlsx', index_col=0, parse_dates=True)
df = df.rename(columns={'S&P 500': 'SP_500'})
dados = df[... | true |
22ff94800140870122a401c7047e2e8caeabaa09 | Python | daunjeong824/Practice_Algorithm | /Binary_Search/10816.py | UTF-8 | 481 | 3.0625 | 3 | [] | no_license | # https://infinitt.tistory.com/288
# 이분 탐색 => 단일 target일 경우 효율이 좋음! 여러 원소가 존재하고 중복이 있다면 dict 쓰는게 훨씬 효율적!!
n = int(input())
cards = list(map(int, input().split()))
m = int(input())
find_ = list(map(int, input().split()))
dic = dict()
for i in cards:
try:
dic[i] += 1
except:
dic[i] = 1
for j ... | true |
50955bd03fd509420960d9f422f31d2f49a3b84d | Python | palisadoes/pattoo | /pattoo/db/table/user.py | UTF-8 | 2,353 | 2.703125 | 3 | [
"GPL-3.0-only"
] | permissive | #!/usr/bin/env python3
"""Pattoo classes querying the User table."""
# Import project libraries
from pattoo_shared.constants import MAX_KEYPAIR_LENGTH
from pattoo_shared import log
from pattoo.db import db
from pattoo.db.models import User
from pattoo.constants import DbRowUser
def idx_exists(idx):
"""Determine ... | true |
105da253cd151fa220131a182695ff2bac94b740 | Python | Librechain/subcrawl | /crawler/storage/console_storage.py | UTF-8 | 1,655 | 2.578125 | 3 | [
"MIT"
] | permissive | # © Copyright 2021 HP Development Company, L.P.
import json
import pprint
from re import subn
from utils import SubCrawlColors
from .default_storage import DefaultStorage
class ConsoleStorage(DefaultStorage):
cfg = None
logger = None
def __init__(self, config, logger):
self.cfg = config
... | true |
c262b1c11bfc781fe05ba3d1f1f277d8a7493d53 | Python | ashishlamsal/cryptopals | /set1/challenge5.py | UTF-8 | 320 | 3.03125 | 3 | [] | no_license | def repeating_key_xor(key : bytes, input: bytes) -> bytes:
return bytes(input[i] ^ key[i % len(key)] for i in range(len(input)))
if __name__=='__main__':
data = b'''Burning 'em, if you ain't quick and nimble
I go crazy when I hear a cymbal'''
key = b"ICE"
print(repeating_key_xor(key,data).hex())
| true |
592316ea2b0400a3ac9b83b0d2ddac47e5548366 | Python | sohamghosh121/natural-parameter-networks | /npn.py | UTF-8 | 5,139 | 2.953125 | 3 | [] | no_license | """
Defines implementation for NPNs
"""
import torch
import numpy as np
import torch.nn as nn
import torch.optim as O
import torch.autograd as autograd
import torch.nn.functional as F
PI = float(np.pi)
ETA_SQ = float(np.pi / 8.0)
# for sigmoid
ALPHA = float(4.0 - 2.0 * np.sqrt(2))
ALPHA_SQ = float(ALPHA ** 2.0)
B... | true |
835273419d0836695073cbaba40829ae08fd54c9 | Python | Colaplusice/algorithm_and_data_structure | /LeetCode/week_40/111_二叉树的最小深度栈实现.py | UTF-8 | 1,090 | 3.734375 | 4 | [] | no_license | # Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def minDepth(self, root):
"""
:type root: TreeNode
:rtype: int
"""
if not root:
return 0
... | true |
76b0198b7dbb04f530f0a98de4490175c9d93d0b | Python | Vsevolod-IT/python_projects | /algorithms_and_data_structure/lesson_2/task_8.py | UTF-8 | 1,034 | 3.90625 | 4 | [] | no_license | '''Посчитать, сколько раз встречается определенная цифра в
введенной последовательности чисел. Количество вводимых чисел
и цифра, которую необходимо посчитать, задаются вводом с клавиатуры.'''
def sep(data):
m = int(data)
num = str(m // 10 ** 0 % 10)
data = str(m // 10)
return num, data
def func(dat... | true |
bd9a858111819c240ef71070bf0106a32dda9a2a | Python | kjford/tapmapper | /tapmapper/helpers/similaritymat.py | UTF-8 | 4,668 | 2.96875 | 3 | [] | no_license | """
Compute cosine similarity between regions from TFIDF scores across beers
"""
from tapmapper.database import session_scope
from tapmapper import models as m
import pandas as pd
import numpy as np
def read_tfidf():
# import data from database
# to do: this should really be stashed
with session_scope() a... | true |
25f0f9904777dc72515c3bd070e3bf37d9230584 | Python | mtn/rcade-falldown | /main.py | UTF-8 | 10,341 | 2.671875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #!/usr/bin/env python3
"""The RCade Ball Game!"""
import sys
import sdl2
import sdl2.ext
import random
import math
BACKGROUND = sdl2.ext.Color(0, 0, 0)
RC_GREEN = sdl2.ext.Color(61, 192, 108)
WHITE = sdl2.ext.Color(255, 255, 255)
P_HEIGHT = 10
W_HEIGHT = 750
W_WIDTH = 600
G_HEIGHT = 300
G_WIDTH = 400
width_shift = ... | true |
0e070aab480b345618e3d77d9187bbf0fb14fc7d | Python | NITRO-AI/NitroFE | /NitroFE/time_based_features/moving_average_features/moving_average_features.py | UTF-8 | 28,234 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | import pandas as pd
import numpy as np
from typing import Union, Callable
from NitroFE.time_based_features.weighted_window_features.weighted_window_features import (
weighted_window_features,
)
from NitroFE.time_based_features.weighted_window_features.weighted_windows import (
_equal_window,
_iden... | true |
2bdfe25e344caa4e7dcbf525a23c99ce96b651a9 | Python | nikrdc/outsider | /models.py | UTF-8 | 3,603 | 2.671875 | 3 | [] | no_license | from flask_login import UserMixin
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.ext.hybrid import hybrid_method
prices = ['Below $5', '$5 to $13', '$13 to $19', '$19 to $27', 'Over $27']
db = SQLAlchemy()
class User(UserMixin, db.Model):
__tablename__ = 'users'
__searchable__ = ['name', 'username'... | true |
b1566fda7f3aaa1bd656001bc64230daef596746 | Python | kbalasub78/Python-CS1 | /checkpoint2/monkey_trouble.py | UTF-8 | 1,906 | 4.6875 | 5 | [] | no_license | ## monkey_trouble.py
## We have two monkeys, a and b. Accept the input telling if each is smiling.
## We are in trouble if they are both smiling or if neither of them is smiling.
## Return True if we are in trouble.
## import sys module for graceful data input handling
import sys
def monkey_trouble(monkeyA_smile, mon... | true |
86fe2b14e40c4c9915d0c64ee59fe4ced8b6fb73 | Python | thomaswebster/neural-net-wargame | /ann.py | UTF-8 | 1,791 | 3.421875 | 3 | [] | no_license | '''Neural network class, only supporting feed forward networks however any activation function is supported'''
from random import random
import numpy as np
class Neuron(object):
def __init__(self, weights, bias, activation_func):
self.weights = weights
self.bias = bias
self.activation_func... | true |
809c913e64aa66fb46175421d95f883d6ce5e571 | Python | AbdullahUK/BugImpactRequirements | /main.py | UTF-8 | 4,462 | 2.796875 | 3 | [] | no_license | """Authors:Abdullah Alsaeedi and Sultan Almaghdhui
Copyright (c) 2021 TU-CS Software Engineering Research Group (SERG),
Date: 22/03/2021
Name: Software Bug Severity using Machine Learning and Deep Learning
Version: 1.1
"""
# Import required libraries
from sklearn.feature_extraction.text import TfidfVectorizer
from skl... | true |
4e8f7e83bb32b1a1c6109e0c732e27b337873786 | Python | YuriCat/test | /pytorch/repeat.py | UTF-8 | 195 | 2.703125 | 3 | [] | no_license | import numpy as np
import torch
a = np.array([[1, 2], [3, 4]])
b = np.tile(np.reshape(a, [2, 1, 2]), [1, 3, 1])
print(b)
c = torch.FloatTensor(a)
d = c.view(2, 1, 2).repeat(1, 3, 1)
print(d)
| true |
d6c788b641eb2bbd5b8f6d75ac82031dc9dd74d8 | Python | mycicle/yamlval | /yamlval/BaseType.py | UTF-8 | 537 | 2.71875 | 3 | [
"MIT"
] | permissive | from abc import ABCMeta, abstractmethod
from typing import Any, Tuple, List, Optional
class BaseType(metaclass=ABCMeta):
"""
In retrospect this class may not even be necesarry, but
I will leave it in case there is a use for it
"""
def __init__(self):
pass
@abstractmethod
def matc... | true |
dcaa45067b6625296902f26adaeb74a4ce2ed61d | Python | joeyshi12/totally-accurate-physics | /Main.py | UTF-8 | 1,519 | 3.234375 | 3 | [] | no_license | import pygame
from PendulumMass import *
pygame.init()
clock = pygame.time.Clock()
display_width = 800
display_height = 500
display = pygame.display.set_mode((display_width, display_height))
m1 = PendulumMass(2, 0, (int(display_width / 2), int(display_height / 2)), 100)
m2 = PendulumMass(-1, 0, m1.get_pos(), 100)
d... | true |
6975d749655ab6448c4b5c2605c49d4a718e2d61 | Python | doa-elizabeth-roys/CP1404_practicals | /prac_3/broken_score.py | UTF-8 | 691 | 3.96875 | 4 | [] | no_license | import random
def main():
score = float(input("Enter score: "))
print(level_of_score(score))
def level_of_score(score):
"""Determine level of score"""
if 0<= score< 50:
return "Bad score"
elif 50<= score <90:
return "Passable"
elif 90<= score <=100:
return "Excellent"
else:
return "Invalid... | true |
9cc6f48958c2b4b23543f61b5fd173561b45d388 | Python | guanguanboy/TestPytorch | /repeat_demo2.py | UTF-8 | 850 | 3.4375 | 3 | [] | no_license | import torch
def get_noise(n_samples, input_dim, device='cpu'):
'''
Function for creating noise vectors: Given the dimensions (n_samples, input_dim)
creates a tensor of that shape filled with random numbers from the normal distribution.
Parameters:
n_samples: the number of samples to gen... | true |
35a9083d81856950316399afe308c1ba9a915fb8 | Python | PCloherty/project_eular | /problem6/sum_square_diff.py | UTF-8 | 1,621 | 4.8125 | 5 | [] | no_license | #The sum of the squares of the first ten natural numbers is,
#1²+2²+...+10²=385
#The square of the sum of the first ten natural numbers is,
#(1+2+...+10)²=55²=3025
#Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is .
#3025-385=2640
... | true |
9475a15873b8133b9df3c1c27e8bae9906f3dec7 | Python | simonwu53/Class-attendance-solution | /voice_recog/funcs_voice.py | UTF-8 | 3,769 | 3.015625 | 3 | [] | no_license | """
25.05.2018 version 2
abandon function play_sound
"""
# import
import os
import pyaudio
import numpy as np
import librosa
import wave
# static variables
FORMAT = pyaudio.paInt16
CHANNELS = 2
RATE = 44100
CHUNK = 1024
# static funcs
def wav_file_in_folder(path):
"""
make a list of wave file in the folder
... | true |
eec41fc6f89d0fdf5e8fe2841ff938fd16a70f9d | Python | BrianHicks/elasticsearch-py | /test_elasticsearch/test_serializer.py | UTF-8 | 1,238 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
import sys
from datetime import datetime
from decimal import Decimal
from elasticsearch.serializer import JSONSerializer
from elasticsearch.exceptions import SerializationError
from .test_cases import TestCase, SkipTest
class TestJSONSerializer(TestCase):
def test_datetime_serialization(... | true |
1c85225943990a8c046ce1c4a0532f149653f79d | Python | mazdanoff/joblooker | /runner/context_object.py | UTF-8 | 282 | 2.609375 | 3 | [] | no_license | class ContextObject:
def __init__(self):
self.driver = None
self.url = ''
self.offers = set()
@property
def offer_list(self):
return [", ".join(offer) for offer in self.offers]
def offer_list_data(self):
return self.offers
| true |
c3d1b3994cd5eb002c1a686cc42c30871d54e72c | Python | wlady2906/WLDE-Phyton-Exercises | /String Length/String length.py | UTF-8 | 295 | 3.6875 | 4 | [] | no_license | print ('By not using the reserved function len(). Declare a function (def) that execute the same logic')
def longitud(adv):
cont = 0
for i in adv:
cont +=1
return cont
'''acum the range from the for loop'''
string = input("Write a string --> ")
print(longitud(string))
| true |
de3a9512ec9c7a2e2d9a8a4eb878ee27f36ea044 | Python | caioalmeida97/Project-Euler | /Python/Problem024.py | UTF-8 | 165 | 3.46875 | 3 | [] | no_license | from itertools import *
def comb(nums):
for a in combinations(nums, 3): # Tentando fazer a combinatória dos números 1, 2 e 3
print a
comb([1, 2, 3])
| true |
856a95ff91cfc3b3a37da939255e096b41a42db5 | Python | JennyLawrance/IgniteDemos | /twitterapp/application.py | UTF-8 | 3,076 | 2.890625 | 3 | [] | no_license | import json
import re
import operator
from collections import Counter
import nltk
nltk.download('stopwords')
from nltk.corpus import stopwords
import string
from nltk import bigrams
emoticons_str = r"""
(?:
[:=;] # Eyes
[oO\-]? # Nose (optional)
[D\)\]\(\]/\\OpP] # Mouth
)"""
... | true |
f553a09c61a3cd24b1b3142eff304ac90287b511 | Python | Arnabsaha6/Snakify | /Reversethefragment.py | UTF-8 | 127 | 3.34375 | 3 | [
"MIT"
] | permissive | Code:
s = input()
a = s[:s.find('h')]
b = s[s.find('h'):s.rfind('h') + 1]
c = s[s.rfind('h') + 1:]
s = a + b[::-1] + c
print(s) | true |
43c3fe76665abb6975153726a71538bad41914b5 | Python | ChangxingJiang/LeetCode | /0901-1000/0968/0968_Python_2.py | UTF-8 | 2,171 | 3.46875 | 3 | [] | no_license | from toolkit import TreeNode
from toolkit import build_TreeNode
class Solution:
def __init__(self):
self.root = None
self.ans = 0
def dfs(self, node):
# 贪心算法:每个节点在选择装监控的方案时,都尽可能让装的监控更靠近根节点
# 返回值:1. 当前节点下安装监控的最小数量
# 2. 当前节点的父节点是否必须安装监控:1=距离最近监控为1个单位距离;2=距离当前最近监控为... | true |
9a343cb982a96c3ba4129e293476e671fda5a0d4 | Python | lucasgsa/pygame-tutorial | /aula2.py | UTF-8 | 2,155 | 2.75 | 3 | [] | no_license | # coding: utf-8
# AULA 1 - PYGAME
# LUCAS KPNZ
import pygame
from pygame.locals import *
pygame.init()
pygame.font.init()
cor_preta = (0,0,0)
tela = pygame.display.set_mode((1280,720))
pygame.display.set_caption("Teste")
player1_x = 100
player1_y = 100
player1_velocidade = 10
player2_x = 1180
player2_y = 100
play... | true |
a271beab807d0b8c04d3c76261b3c1a9e6d55b3b | Python | pythoncanarias/eoi | /10-iot/A04b_salida_entrada-analogica/main.py | UTF-8 | 1,488 | 3.234375 | 3 | [] | no_license | import machine
import utime
# Creado por Daniel Alvarez (danidask@gmail.com) para curso de Python de EOI (eoi.es)
# Ampliado por Victor Suarez (suarez.garcia.victor@gmail.com) para curso de Python EOI (eoi.es)
# Para ESP32 usar los GPIO disponibles
# Para ATomLite usar GPIO33
# Para Raspberry Pi usar GPIO28 por ejempl... | true |
b9e522bfab40f9374761bd753109aea245b99a37 | Python | MiguelTeixeiraUFPB/PythonM2 | /algoritmos/PythonM2/viagem43.py | UTF-8 | 641 | 3.265625 | 3 | [
"MIT"
] | permissive | buenosairesdia=220
santiagodia=307
montevideodia=280.6
viagembuenosaires=810
viagemsantiago=900.50
viagemmontevideo=780
dias=int(input('quantidade de dias:'))
lugar=(input('qual lugar deseja ir:')).upper()
if lugar=='BUENOS AIRES':
print('o valor a ser pago pela hospedagem é {}R$ e a passagem é {}R$'.format(buen... | true |
72968fce1db8b3bed512579b4212c72a39adf61d | Python | anton-khimich/HashTables | /hash_tasks.py | UTF-8 | 1,580 | 3.21875 | 3 | [] | no_license | from hash_table import *
from linked_list import *
from records import *
def default_reader(list, hashtable):
"""default_reader(list, HashTable) --> None
A function that takes a list and inserts each key(str) as Records into the
given HashTable."""
for i in list:
if hashtable.retrieve(i) == Non... | true |
d39a6391e28507d50f6233d55536c28606c8819e | Python | hungry-me/Project-Euler | /Prog6.py | UTF-8 | 253 | 3.46875 | 3 | [] | no_license | def getSum(n):
res=0;
for i in range(1,n+1):
res+=i*i;
return res;
def getSumSq(n):
res=(n*(n+1))//2;
return res*res;
def sumSquare():
s1=getSum(100);
s2=getSumSq(100);
print(s2-s1);
sumSquare(); | true |
9c8ed4cb1f8aefe14265becb4be63c3c022a9a5d | Python | egemen-candir/github-test | /Toronto Clustering and Segmenting.py | UTF-8 | 3,678 | 3.25 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# # Clustering and Segmenting the Neighborhoods in Toronto
# In[1]:
get_ipython().system('conda install -c conda-forge geopy --yes')
get_ipython().system('conda install -c conda-forge folium=0.5.0 --yes')
# In[2]:
conda install -c anaconda beautifulsoup4
# In[16]:
impo... | true |
4bcb50b8124d5a78cd24ac047cf3e03017118626 | Python | gomsvicky/PythonAssignmentCaseStudy1 | /Program5.py | UTF-8 | 394 | 2.890625 | 3 | [] | no_license | import sys
print(sys.argv)
print("length of arguments ", len(sys.argv))
for i in sys.argv:
print("arugment is ", i)
if sys.argv[3] > sys.argv[1] and sys.argv[3] > sys.argv[2]:
print("biggest number is ", sys.argv[3])
elif sys.argv[2] > sys.argv[1] and sys.argv[2] > sys.argv[3]:
print("biggest number... | true |
fc68933b95f3b6088cd7552af8c016537854850f | Python | rfhits/Data-Structure-BUAA | /0-OnlineJudge/00-热身练习题/2-打印对角矩阵.py | UTF-8 | 477 | 4.3125 | 4 | [] | no_license | # 现在请你打印一个n阶单位矩阵。
# 【输入形式】
# 一行整数n (0 < n <= 10)
# 【输出形式】
# 输出该n阶单位矩阵,每个元素之间用空格分隔
# 【样例输入】
# 3
# 【样例输出】
# 1 0 0
# 0 1 0
# 0 0 1
s = int(input())
def prilin(s, j):
for i in range(s):
if i == j:
print('1', end=' ')
else:
print('0', end=' ')
print('')
return
for... | true |
0784e018e0b7fed4318dffa7255781232a596c63 | Python | NVIDIA/DeepLearningExamples | /PyTorch/SpeechSynthesis/HiFiGAN/common/text/cleaners.py | UTF-8 | 2,894 | 3.171875 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | """ adapted from https://github.com/keithito/tacotron """
'''
Cleaners are transformations that run over the input text at both training and eval time.
Cleaners can be selected by passing a comma-delimited list of cleaner names as the "cleaners"
hyperparameter. Some cleaners are English-specific. You'll typically wan... | true |
fe9ebda7c08715c0c86e9b8deb99219c387309ab | Python | fine-structure/fine-structure | /fine_structure/language_models/models.py | UTF-8 | 1,450 | 2.578125 | 3 | [] | no_license | from tensorflow.keras import optimizers
from tensorflow.keras.layers import (GRU, LSTM, Dense, Embedding, Input,
SpatialDropout1D, TimeDistributed)
from tensorflow.keras.models import Model
def rnn_lm(input_len, vocab_size, rnn_type='GRU',
embedding_size=None, num_rnn_l... | true |
f4df74e598e6910f9433d1a2d265ccd4e49c72c3 | Python | dzakub77/my-first-blog | /blog/forms.py | UTF-8 | 453 | 2.546875 | 3 | [] | no_license | from django import forms
from .models import Post
class PostForm(forms.ModelForm): #nazwa naszego formularza, i informujermy ze ten formularz
#jest formularzem module "ModelForm"
class Meta: # tutaj przekazujemy informacje o tym jaki model powinien byc wykorzystany do
# stworzzenia tego formularza (... | true |
0a6c265a46d6aa9df3442bb79f878a087100c013 | Python | Go-Maun/COMP_1510_labs | /Lab06/sparse_vector.py | UTF-8 | 1,562 | 3.734375 | 4 | [] | no_license | import doctest
"""
The reason we cannot get the length of a sparse vector is because they can have a
large amount of 0's padding the size by a large amount. I need to ask them if storing those sparse vectors
in dictionaries will work for the way they are implementing their code.
"""
def sparse_add(dictionary_one, dic... | true |
ade159980337c30b61cf662106bcca38c7926993 | Python | itsdddaniel/POO | /II Parcial/main2.py | UTF-8 | 176 | 3.296875 | 3 | [] | no_license | #-*- coding: utf-8 -*-
import rep
number = input("")
number = re.sub(r"\D+","",number)
if len(number)==0: number=1
else: number = int(number)
print("Hola Mundo\n"*number) | true |
8eba28c725a89cde39711814cd0905fef38cdacb | Python | cn5036518/xq_py | /python16/day1-21/day012 生成器/01 pdf要点总结/03 生成器表达式.py | UTF-8 | 584 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python
#-*- coding:utf-8 -*-
#@time: 2019/10/7 16:17
#@author:wangtongpei
''''''
'''
1、生成器表达式:(结果 for循环 if条件)
2、惰性机制(类比:弹夹没子弹了,不能将同一个值,生成2次)
生成器是记录在内存中的一段代码,产生的时候,没有执行
生成器表达式和列表推导式的区别类比:
1、买100个鸡蛋,列表推导式:是一次性把100个鸡蛋买回来,需要地方存储
2、 生成器表达式:是买一只母鸡,需要鸡蛋就给下蛋
'''
| true |
675dbdb0b82d7a5cd681df3a47f1b47686ee2e35 | Python | Aasthaengg/IBMdataset | /Python_codes/p02886/s982311385.py | UTF-8 | 212 | 3.09375 | 3 | [] | no_license | n = int(input())
d = list(map(int, input().split()))
recover = 0
for i in range(n):
for j in range(n):
if i==j:
pass
else:
recover += d[i]*d[j]
print(int(recover/2)) | true |
7733d1b8fe40c26dd6b36ce60153ee06aae5e180 | Python | mattarroz/megamodesty | /core/dummy.py | UTF-8 | 145 | 2.59375 | 3 | [] | no_license | import time
def dummyAnalysis():
print "Hallo Welt"
print "---"
print "Starte DummyAnalyse..."
time.sleep(5)
print "Ergebnis: 42"
return 42
| true |
fd6dbeff49cff83f7b5e8595f7d813e1592e822e | Python | UKParlDataSheets/UKParlDataSheets-Scripts | /tests.py | UTF-8 | 18,960 | 2.625 | 3 | [] | permissive | import unittest
from funcs import *
#
# License 3 clause BSD
# https://github.com/UKParlDataSheets/UKParlDataSheets-Scripts
#
class TestTwitter(unittest.TestCase):
def test_no_crash_on_none_1(self):
"""If person has an empty adddress record, test no crashes."""
person = ModelBase()
add... | true |
9f0853658af5264a07fb83877601417581d3c35a | Python | bac1986/botTenderRevising | /python_serial_test.py | UTF-8 | 1,644 | 2.6875 | 3 | [] | no_license | import time
import serial
arduino = serial.Serial()
arduino.port = 'COM5'
arduino.baudrate = 9600
arduino.timeout = 0.1
arduino.setRTS(False)
arduino.open()
arduino.flush()
#outgoing = "Hi\n"
#arduino.write(outgoing.encode())
#print(outgoing)
#arduino.flush()
#while True:
# print("Hello from Raspberry Pi!")
# ... | true |
77bfc2c8df6145ef8116e9a6f0334788ed7ebc26 | Python | prathamtandon/g4gproblems | /Sorting and Searching/min_length_unsorted_subarray.py | UTF-8 | 2,085 | 4.84375 | 5 | [
"MIT"
] | permissive | import unittest
"""
Given an unsorted array arr[0...n-1] of size n, find the minimum length subarray arr[s...e] such that
sorting this subarray makes the whole array sorted.
Input: 10 12 20 30 25 40 32 31 35 50 60
Output: subarray starting index 3 and ending index 8.
"""
"""
Approach:
1. Scan from left to right and fi... | true |
365560be63d63dc05df0c4cf2067cf8e0b0cd58c | Python | mikebwin/Android-RPi-Wifi | /raspberry-pi-code/lock.py | UTF-8 | 299 | 3.09375 | 3 | [] | no_license | import RPi.GPIO as GPIO
import time
servoPIN = 23
GPIO.setmode(GPIO.BCM)
GPIO.setup(servoPIN, GPIO.OUT)
p = GPIO.PWM(servoPIN, 50) # GPIO 23 for PWM with 50Hz
p.start(7.5) # Initialization
time.sleep(0.5)
# 90 degrees
p.ChangeDutyCycle(2.5)
print(2.5)
time.sleep(2)
p.stop()
GPIO.cleanup()
| true |
536fb3944bb8bae179345705336a19f47b3130b7 | Python | yoongi0428/dmlab_torch_tutorial | /3. Recommender System/utils/data_utils.py | UTF-8 | 1,780 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
import torch
def load_data(data_path, implicit=False, train_ratio=0.8, shuffle=True):
# x = np.loadtxt(data_path, skiprows=0, delimiter=',')
raw = [s.split(',') for s in open(data_path, 'rt', encoding='utf-8').read().strip().split('\n')]
columns = raw[0]
data = raw[1:]
process_f... | true |
b0d34face58703d8bb8bfe3d0b5a5b7021bdaf8c | Python | Taylor-Yang1992/Algorithm | /leetcode/Palindrome Number.py | UTF-8 | 262 | 3.046875 | 3 | [] | no_license |
class Solution:
def isPalindrome(self,x):
if x == 0:
return True
elif x < 0 or x% 10 == 0:
return False
t = 0
while t <= x:
if t == x or t == int(x / 10):
return True
mode = x % 10
t = t * 10 + mode
x = int(x / 10)
return False
| true |
5ecf0341c9e174f17b0fc91cd7f6aa7742b6fb6d | Python | yurimalheiros/IP-2019-2 | /lista3/ighor/questao4.py | UTF-8 | 173 | 3.640625 | 4 | [] | no_license | numero = int(input("Digite um número"))
acumulador = 0
while numero != 0:
acumulador += numero
numero = int(input("Digite um número"))
print(acumulador)
| true |
ef9ce2e4367ab569093e2397dfbdce93e3960618 | Python | richnakasato/ctci-py | /min_coins.py | UTF-8 | 1,174 | 3.453125 | 3 | [] | no_license | import random
def min_coins(coins, val):
memo = dict()
for coin in coins:
memo[coin] = 1
memo[0] = 0
return min_coins_helper(coins, val, memo)
def min_coins_helper(coins, val, memo):
if val in memo:
return memo[val]
else:
min_count = float('inf')
for coin in coi... | true |
7dd4299c6020b8e2b1913181a0f32f0cad561b2f | Python | ZubritskiyAlex/Python-Tasks | /HW_10/task 10_02.py | UTF-8 | 1,348 | 3.65625 | 4 | [] | no_license | """Создать csv файл с данными о ежедневной погоде. Структура: Дата,
Место, Градусы, Скорость ветра. Найти среднюю погоду(скорость ветра и
градусы) для Минск за последние 7 дней."""
import csv
list_of_speed = []
list_of_degr = []
def print_csv_file(filename):
with open(f"{filename}.csv") as my_file:
for l... | true |
147d9c6c42cdd9b9cca333f3cd78612f6e80f075 | Python | dimitrovs/comp598 | /load_training_data.py | UTF-8 | 832 | 3.03125 | 3 | [] | no_license | import numpy as np
import csv
# Load all training inputs to a python list
train_inputs = []
with open('train_inputs.csv', 'rb') as csvfile:
reader = csv.reader(csvfile, delimiter=',')
next(reader, None) # skip the header
for train_input in reader:
train_input_no_id = []
for pixel in train... | true |
8b391e0b4674cee2a408fe4c82eef90aa9cb6585 | Python | roy19-meet/meet2017y1lab6 | /funturtle.py | UTF-8 | 511 | 3.65625 | 4 | [
"MIT"
] | permissive | import turtle
turtle.shape('turtle')
square=turtle.clone()
square.shape('square')
square.goto(0,100)
square.goto(100,100)
square.goto(100,0)
square.goto(0,0)
triangle=turtle.clone()
triangle.shape('classic')
triangle.penup()
triangle.goto(100,200)
triangle.pendown()
triangle.goto(0,200)
triangle.goto(50,250)
triangle.g... | true |
d3a993be69bcab653c25858d2f6894d4fd864aa2 | Python | Marcin-Szadkowski/JFTT-kompilator | /AST/identifiers/array_pid.py | UTF-8 | 2,203 | 2.953125 | 3 | [] | no_license | from AST.declarations.array import Array
from compiler.asm import Asm
from compiler.memory import Memory
from compiler.reg_manager import RegManager
from compiler.exceptions import IsAnArrayError
class ArrayPid:
def __init__(self, pid, pid2, line=0):
self.pid = pid
self.pid2 = pid2
self.li... | true |
cea04b60a5dc29cf97da4782a4d227fbbad780ba | Python | noaavi94/tdh20 | /utils.py | UTF-8 | 2,146 | 3.046875 | 3 | [] | no_license | import functools
import math
import operator
import re
import time
from collections import Counter
from nltk.corpus import names
labeled_names = ([(name, 'male') for name in names.words('male.txt')] +
[(name, 'female') for name in names.words('female.txt')])
def counter_wrapper(c, key):
if c.get(key) is None... | true |
f48ce8309a97654705b4d4a85e5ecb7521d650ed | Python | hugovk/pescador | /tests/test_core.py | UTF-8 | 8,647 | 2.640625 | 3 | [
"ISC"
] | permissive | #!/usr/bin/env python
'''Test the streamer object for reusable iterators'''
from __future__ import print_function
import copy
import pytest
import warnings
warnings.simplefilter('always')
import pescador.core
import test_utils as T
def test_streamer_iterable():
n_items = 10
expected = list(range(n_items))
... | true |
01de874c5539a2c86fc506cb4effa829d43b5599 | Python | tfhartmann/moc-public | /python-mocutils/mocutils/db_controls.py | UTF-8 | 11,435 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/pyton
import sys, os, sqlite3, re, itertools
import switch_controls
class DB_Controller:
def __init__(self, db):
# Check if the db already exists
new = not os.path.exists(db)
# Build the connection to the db
self.conn = sqlite3.connect(db)
if new:
self._create_tabl... | true |
033497a2c0513410efbe8701b624e725b5b1f3ee | Python | borko81/basic_python_solvess | /nasted_loops/lucky_numbers.py | UTF-8 | 278 | 3.0625 | 3 | [] | no_license | n = int(input())
for i in range(1111, 10000):
test = str(i)
if str(0) in test:
continue
if sum(int(i) for i in test[:2]) == sum(int(i) for i in test[2:]) and \
n % (sum(int(i) for i in test[:2])) == 0:
print(int(test), end=' ') | true |
36c5607c25083ed5e463cdadd75e311c5acd2e20 | Python | HaukurPall/basic_prob | /week2/word_counter.py | UTF-8 | 1,895 | 3.890625 | 4 | [] | no_license | import collections
from operator import itemgetter
c = collections.Counter()
#file_path = input("Complete file-path, please: ")
file_path = "war_and_peace.txt"
with open(file_path) as input_file:
for line in input_file:
c.update(line.lower().split())
number_unique_words = len(c.most_common())
command = ""... | true |
ff0bac4f50b3de66d6ea74ef9e393dec3299eb4f | Python | ry05/personal-attack-classification | /code/src/feature_selection.py | UTF-8 | 1,438 | 3.40625 | 3 | [] | no_license | """
Feature selection script
------------------------
Contains elements to aid in feature selection
"""
from sklearn.feature_selection import chi2, f_classif, mutual_info_classif
from sklearn.feature_selection import SelectKBest
from sklearn.feature_selection import SelectPercentile
class UnivariateFeatureSelection... | true |
ca3a344c1088e964484008b9b56f5a921f618e6a | Python | prawnrao/rsd-exam-prep | /Exam/python_language/tlf_bikes.py | UTF-8 | 5,642 | 3.421875 | 3 | [] | no_license | import json
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import cm
def unpack_data(filename):
""" Function to extract data from a json file
and convert it to a python dictionary.
Parameters:
str filename
Returns:
dict data
... | true |
0dfdebb7b331a9f0754a0c660862bb5d0d88f919 | Python | zangzelin/Correlation-Analysis-between-Consumer-Price-Index-and-Service-Price-Index | /t.py | UTF-8 | 477 | 3.078125 | 3 | [] | no_license | import matplotlib as mpl
from matplotlib import pyplot as plt
mpl.rcParams[u'font.sans-serif'] = ['simhei']
mpl.rcParams['axes.unicode_minus'] = False
years = [1950, 1960, 1970, 1980, 1990, 2000, 2010]
gdp = [300.2, 543.3, 1075.9, 2862.5, 5979.6, 10289.7, 14958.3]
#创建一副线图,x轴是年份,y轴是gdp
plt.plot(years, gdp, color='green'... | true |
245eb33822dd024a844c128865aa16bb8efce519 | Python | raferalston/PcKoteykaPro | /Homework/12Lesson2.py | UTF-8 | 484 | 3.78125 | 4 | [] | no_license | class Player:
def attack(self):
print(f'{self.name} attacks!')
class Mage(Player):
def __init__(self):
self.name = 'mage'
class Barb(Player):
def __init__(self):
self.name = 'barbarian'
m = Mage()
b = Barb()
while 1:
q = input('Кого атакуем? - ')
if q == 'mage':
... | true |
868acb74d857937a5c95fcbd0589200a6c0df5db | Python | ricardowiest/Python_CURSO | /Ex058.py | UTF-8 | 588 | 4.03125 | 4 | [] | no_license | import random
n=0
print('\033[1:32mAdivinhe que número estou pensando...\033[m')
e=random.randint(1,100)
tot=0
acertou= False
while not acertou:
n=int(input('Escolha um número de 1 até 100: '))
tot+=1
if n==e:
acertou=True
else:
if n<e:
print('\033[1:31mO número ... | true |
5d510f572ccfe2294cf850f54aacd79f12706736 | Python | alvations/sugali | /universalcorpus/crawlandclean/udhr.py | UTF-8 | 4,926 | 2.78125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Access modules from parent dir, see http://goo.gl/dZ5HVk
import os, sys
parentddir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir))
sys.path.append(parentddir)
import codecs, os, zipfile, urllib, urllib2, tempfile, shutil, re, io
from unicodize import is_utf8, what... | true |
355f57ee9cb4e2a1b3575c4b95616fd32be22113 | Python | zldobbs/TwittoMe | /main.py | UTF-8 | 9,688 | 3.265625 | 3 | [] | no_license | # TwittoMe
# A final project for CS4830 developed using Flask. Works with the
# Twitter and GroupMe APIs to create a cohesive bot that polls for new
# tweets from user specified accounts.
# Developed by Zachary Dobbs and Austin Sizemore
# --------------- INITIALIZATION AND CONFIG ----
# imports and initiatilization
fr... | true |
97adb462a1fe6768bc946a579681f66a5e87f623 | Python | Wenmingxing/Reinforcement-Learning | /Double_DQN/RL_brain.py | UTF-8 | 5,985 | 2.578125 | 3 | [] | no_license | #! usr/bin/env python
'''
Coded by Luke Wen on 11th Oct 2017 referece :https://github.com/MorvanZhou/Reinforcement-learning-with-tensorflow/blob/master/contents/5.1_Double_DQN/RL_brain.py
It's aiming to build the double DQN for the cartpolr Env in the gym.
The Double DQN is to overcome the overestimation problem exs... | true |
f258f8f93493694157332e4e41d396d1f73c77ec | Python | Hossain-Shah/Project | /AI & ML/Fake news detection.py | UTF-8 | 1,006 | 2.78125 | 3 | [] | no_license | import numpy as np
import pandas as pd
import itertools
from sklearn.model_selection import train_test_split
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import PassiveAggressiveClassifier
from sklearn.metrics import accuracy_score, confusion_matrix
df=pd.read_csv('C:/Use... | true |
dae073a3c5832be431afe89dbf94386129fe6161 | Python | WangXichang/somescriptsrecordforgetlater | /py2ee_seg0906.py | UTF-8 | 4,938 | 3.109375 | 3 | [] | no_license | # -*- utf-8 -*-
import pandas as pd
import numpy as np
# example for SegTable
def exp_segtable():
df = pd.DataFrame({'a': [x % 100 for x in range(10000)],
'b': [min(max(int(np.random.randn()*10+50), 0), 100) for x in range(10000)]})
seg = SegTable()
seg.inputdf = df
seg.segsort ... | true |
9ea1c571cd66c8e7d6ce71e251cfbaed57eefb7d | Python | shengchaohua/leetcode-solution | /leetcode solution in python/PowerfulIntegers.py | UTF-8 | 927 | 3.53125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Jan 6 10:59:58 2019
@problem: leetcode 970. Powerful Integers
@author: shengchaohua
"""
class Solution:
def powerfulIntegers(self, x, y, bound):
"""
:type x: int
:type y: int
:type bound: int
:rtype: List[int]
"""
... | true |
ee7b75d5b16e1bff0d7428b04528a849cba0d487 | Python | anhtv26062000/vietocr | /vietocr/model/seqmodel/convseq2seq.py | UTF-8 | 11,634 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
class Encoder(nn.Module):
def __init__(self,
emb_dim,
hid_dim,
n_layers,
kernel_size,
dropout,
device,
... | true |
45583209c2b2ebc98237dc955cb83efb77f50bf1 | Python | yosifnandrov/softuni-stuff | /fundamentals 01/Balanced Brackets.py | UTF-8 | 392 | 3.609375 | 4 | [] | no_license | n = int(input())
counter = 0
counter_two = 0
for i in range(1, n + 1):
symbol = input()
if symbol == "(":
counter += 1
elif symbol == ")":
counter_two += 1
if counter == 0 and counter_two == 0:
print("BALANCED")
elif counter % 2 == 0 and counter_two == 0:
print("BALANCED")
elif count... | true |
1a0929b9bc28ccaa8f3f416fc83a472a0352e90c | Python | myFinTechPL/Complete-Python-3-Bootcamp | /08-Milestone Project - 2/test_cap.py | UTF-8 | 478 | 3.171875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Dec 7 20:45:05 2019
@author: ktzaj
"""
import unittest
import cap
class TestCap(unittest.TestCase):
def test_one_word(self):
text = 'python'
result = cap.cap_text(text)
self.assertEqual(result, 'Python')
def test_multiple_words(self):
... | true |
b50a3b54afd648f0349b42b7eca5428f4d35a9b6 | Python | prakharguptaz/Adv_gen_dialogue | /adversarial_creation/mask-and-fill-ilm/ilm/mask/custom.py | UTF-8 | 1,745 | 2.59375 | 3 | [] | no_license | from enum import Enum
import random
from .base import MaskFn
class MaskPunctuationType(Enum):
SENTENCE_TERMINAL = 0
OTHER = 1
class MaskPunctuation(MaskFn):
def __init__(self, p=0.5):
self.p = p
@classmethod
def mask_types(cls):
return list(MaskPunctuationType)
@classmethod
def mask_type_seri... | true |
613cbffa89356efaa460f726addb4224ae03d16e | Python | kavyasreesg/Datastructures_Algorithms | /Binary_Search_Tree.py | UTF-8 | 2,258 | 4.03125 | 4 | [] | no_license | class Tree:
def __init__(self, data, left=None, right=None):
self.data = data
self.left = left
self.right = right
def insert(self, data):
if self.data == data:
return False # Eliminating duplicate nodes
elif data < self.data:
if self.le... | true |
bec4a96b9dd4f4870f7c33a41a03b8f6add278fc | Python | wseungjin/codingTest | /naver/chihoon/1.py | UTF-8 | 798 | 3.359375 | 3 | [] | no_license | from functools import reduce
def getSumDigit(number):
sumValue = 0
while number != 0:
sumValue += number % 10
number = number // 10
return sumValue
def solution(A):
A = sorted(A)
result = {}
for element in A:
sumValue = getSumDigit(element)
try:
... | true |
4a52c264213a41b47c339f0217ad133409a00b7f | Python | OfriHarlev/ConnectK | /pyshell.py | UTF-8 | 2,610 | 3.140625 | 3 | [] | no_license | #Author: Toluwanimi Salako
import sys
from student_ai import StudentAI
sys.path.append(r'\ConnectKSource_python')
import ConnectKSource_python.board_model as boardmodel
is_first_player = False
deadline = 0
def make_ai_shell_from_input():
global is_first_player
ai_shell = None
begin = "makeMoveWith... | true |
76d492d2503ce7581c3e328dbfa08ca687ab11f1 | Python | shingasia/DataCrawling | /Popular_Destination.py | UTF-8 | 1,766 | 2.984375 | 3 | [] | no_license | import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import time
#1203 부터 1212까지
df1203=pd.read_csv('1203Departure.csv', encoding='euc-kr')
df1204=pd.read_csv('1204Departure.csv', encoding='euc-kr')
df1205=pd.read_csv('1205Departure.csv', encoding='euc-kr')
df1206=pd.read_csv('1206Departure... | true |
a72b2e8ad935cbe48ba33b13fdccd0ec2dd91438 | Python | Finalcheat/qiushibaike_scrapy | /qiushibaike/spiders/qiushibaike_spider.py | UTF-8 | 1,173 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import scrapy
import re
from qiushibaike.items import QiushibaikeItem
class QiushibaikeSpider(scrapy.Spider):
"""
糗事百科spider
"""
name = "qiushibaike"
allowed_domains = ["qiushibaike.com"]
start_urls = [
"http://www.qiushibaike.com/text/",... | true |
9b452a645d1dc53a7f9fe2428439352bc8113ca2 | Python | Naumov89/python_metiz | /11/test_name_function.py | UTF-8 | 768 | 3.671875 | 4 | [] | no_license |
import unittest
from name_function import get_formated_name
class NamesTestCase(unittest.TestCase):
"""Тесты для 'name_function.py'"""
def test_first_last_name(self):
"""Имена вида 'Jenis Joplin' работают, правильно!"""
formatted_name = get_formated_name('jenis', 'joplin')
self.assert... | true |
a55b4cf0dba959e4906e5acb27938581d7232d5d | Python | Kit55/Python-test | /.старое/2fix/2.4.py | UTF-8 | 837 | 2.765625 | 3 | [] | no_license |
def addit(_add):
def hidden(_hid):
return(_add+_hid)
return hidden
def add_range(_start,_finish):
for i in range (_start,_finish):
globals()['add%d' %i] = addit(i)
add_range(0, 10)
def map2(*_ars):
"""
>>> map2([add0,add1],[1,2])
[1, 2, 2, 3]
"""
l0=list()
l1=list... | true |
31b6209db268bed01c10e05d3646b1a556b52c76 | Python | AjinkyaTaranekar/AlgorithmX | /Codeforces/617/A.py | UTF-8 | 261 | 3.5625 | 4 | [] | no_license | n = int(input())
count=0
while n-5 >= 0:
n-=5
count+=1
while n-4 >= 0:
n-=4
count+=1
while n-3 >= 0:
n-=3
count+=1
while n-2 >= 0:
n-=2
count+=1
while n-1 >= 0:
n-=1
count+=1
print(count) | true |
8eab390dad7396ca05f1dc40dfa42de1a2adf5fc | Python | pratikkarad/unipune-practicals | /mini_scoa/fuzzy_ac.py | UTF-8 | 6,531 | 3.046875 | 3 | [] | no_license | import numpy as np
import skfuzzy as fuzz
from skfuzzy import control as ctrl
from statistics import mean, stdev
'''Declaring the Antecedents'''
roomtemp = ctrl.Antecedent(np.arange(0, 50, 1), "Room Temperature \u00b0C")
roomtemp.automf(names=['Low', 'Normal', 'High', 'Very High'])
humidity = ctrl.Antecedent(np.arang... | true |
4cf628c354733739fc0b2474bbc8f4b04d525f57 | Python | scmsqhn/zhihu_spider | /panAnaly.py | UTF-8 | 696 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python
#coding=utf-8
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import pandas
from to_csv import mongo_to_csv
import matplotlib.pyplot as mplt
if __name__=='__main__':
#将数据库中的数据转化成csv格式
mongo_to_csv()
#使用pandas模块进行条形图的绘制;TODO 更加详细的分析
target=pandas.read_csv('zhihu_user_da... | true |
ebef8db975b0b3d400eae3fe047f21f8d812b55c | Python | Functional-Brain-Mapping-Laboratory/PyCartool | /pycartool/lf/leadfield.py | UTF-8 | 940 | 2.796875 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
# Authors: Victor Férat <victor.ferat@live.fr>
#
# License: BSD (3-clause)
import struct
import numpy as np
def read_lf(filename):
"""Read Cartool leadfield (``.lf``) file.
Parameters
----------
filename : str or file-like
The leadfield file (``.lf``) to read.
Re... | true |
92b9a4f13629546bd5178778a0f9119556d02e76 | Python | arianepaola/tg2jython | /sqlalchemy60/lib/sqlalchemy/dialects/mssql/base.py | UTF-8 | 53,649 | 3.015625 | 3 | [
"MIT"
] | permissive | # mssql.py
"""Support for the Microsoft SQL Server database.
Driver
------
The MSSQL dialect will work with three different available drivers:
* *pyodbc* - http://pyodbc.sourceforge.net/. This is the recommeded
driver.
* *pymssql* - http://pymssql.sourceforge.net/
* *adodbapi* - http://adodbapi.sourceforge.net/... | true |
e3c5377d32dc3edf1fb243a4a6830cecd7ed7a68 | Python | aSafarpoor/tafsir-swe2-prj | /Backend/raw_certificate_maker_should_be_embeded/certificate.py | UTF-8 | 2,806 | 2.734375 | 3 | [] | no_license | from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
import numpy as np
# install: pip install --upgrade arabic-reshaper
import arabic_reshaper
# install: pip install python-bidi
from bidi.algorithm import get_display
# install: pip install Pillow
from PIL import ImageFont
from PIL import Image... | true |
68c4da92a3468949eb01789f7997d25d6a9d7e58 | Python | ipenn/python-process | /demo3.py | UTF-8 | 651 | 2.578125 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import win32com.client
def check_exsit(process_name):
WMI = win32com.client.GetObject('winmgmts:')
processCodeCov = WMI.ExecQuery('select * from Win32_Process where Name="%s"' % process_name)
if len(processCodeCov) > 0:
print '%s is exists' % process_name
else... | true |
1e07741968f1db8b79f28fed4f4ff1d6d85c3249 | Python | MilaNedic/programiranje-1 | /vaje/korita.py | UTF-8 | 271 | 2.84375 | 3 | [] | no_license | from functools import lru_cache
def korita(n, m, l):
if n == 0:
return 0
if l > n:
return 0
counter = 0
if m * (l + 1) <= n:
counter += 1 + korita(n - m, m - 1, l)
return counter
print(korita(9, 3, 2)) | true |
a191018a5f06836999967c3c575612f8e9ed3cf8 | Python | dsor-isr/isr-flying-arena | /5. Tools/3. Real Time Monitoring/1. real_time_monitor.py | UTF-8 | 32,066 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python3
"""
Software program that enables the user to monitor the state of the vehicles during experiments.
This tool is important for the developed testing framework because it complements and improves the monitoring setup available in the QGroundControl software, in which the user has to monitor the c... | true |
8f618392ef24da1173ef6617ec00d2beaa3bc447 | Python | t9s9/BeeMeter | /streaming/watching.py | UTF-8 | 653 | 2.671875 | 3 | [
"MIT"
] | permissive | import threading
import cv2
import numpy as np
import time
class Watcher(threading.Thread):
def __init__(self, q, fps=24):
super(Watcher, self).__init__()
self.running = True
self.fps = fps
self.q = q
def run(self):
while self.running:
if not self.q.empty()... | true |
46e9fee74e5ad131978ca36f22b4d2c071e98559 | Python | jerrywindtwow/twow | /py_excercise/separator.py | UTF-8 | 1,888 | 2.671875 | 3 | [] | no_license | import math
import pandas as pd
def separate_to_groups(par_df_first, par_col_name, par_group_num):
par_df = par_df_first
cols = par_df_first.columns
grouped = pd.DataFrame(index=[], columns=cols)
str_where = 'group==' + str(par_group_num)
for group_id in range(1, par_group_num):
par_df = ... | true |
7393dabbc2847b52376b1f020e35c25247d79a9f | Python | sakethraogandra/python1 | /5.py | UTF-8 | 127 | 3 | 3 | [] | no_license | x=28
g=0
inc=0.01
aprox=0.01
count=0
while (g**2-x)<aprox and (g**2-x)<0:
g+=inc
count+=1
print("guess:"+str(g))
| true |