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 |
|---|---|---|---|---|---|---|---|---|---|---|
d4e148efe7252859cba3312fe15ac8f779e93f1a | ckelly/pyomniar | /pyomniar/parsers.py | UTF-8 | 1,440 | 2.765625 | 3 | [
"MIT"
] | permissive |
from pyomniar.utils import import_simplejson
from pyomniar.error import OmniarError
class Parser(object):
def parse(self, method, payload):
"""
Parse the response payload and return the result.
Returns a tuple that contains the result data and the cursors
(or None if not present).... | true |
26508b49ab39af88f6e9da6d3af515e3c745843b | zzkigzz48/BaiTap | /Bai1.py | UTF-8 | 2,664 | 2.9375 | 3 | [] | no_license | import numpy as np
D_train = np.array([[1, 4, 5, 0, 3],
[5, 1, 0, 5, 2],
[4, 1, 2, 5, 0],
[0, 3, 4, 0, 4]
])
def sort_sim(val):
return val[1]
def sim_cosine(D_train, u0, u1):
U = len(D_train[0])
sumproduct = ... | true |
30f453d3b9cf109f7d87ee23c9eccfef06ff18e5 | alexnro/Codewars-Katas | /Python/6kyu/toCamelCase.py | UTF-8 | 719 | 3.75 | 4 | [] | no_license | def to_camel_case(text):
result = ''
for character in text:
if character == '_' or character == '-':
text = text.replace(character, ' ')
if (' ') in text:
firstSpace = text.find(' ')
firstWord = text[:firstSpace]
titleString = text[firstSpace:]
ti... | true |
89acd05ae2e6bc5eff1d99aa3d8c9831cbdd6e3f | stuhlmueller/i3 | /tests/test_uai_import.py | UTF-8 | 3,732 | 2.625 | 3 | [] | no_license | """Test import of UAI Bayes net files."""
import numpy as np
from i3 import random_world
from i3 import uai_import
from i3 import utils
from i3.networks import triangle_net
NETWORK_STRING_A = """BAYES
3
2 2 3
3
1 0
2 0 1
2 1 2
2
0.436 0.564
4
0.128 0.872
0.920 0.080
6
0.210 0.333 0.457
0.811 0.000 0.189"""
... | true |
0b8d5ec7bba38342d0bf255b2a569778aaa327d5 | Chygos/RosalindBioinformatics | /DNAtranscription.py | UTF-8 | 396 | 2.953125 | 3 | [] | no_license | try:
with open('genefiles/rosalind_rna1.txt', 'r') as dna_files:
bases = dna_files.read()
rnas = bases.replace('T', 'U')
#writing into a file
with open('outputs/rna.txt', mode='w+', encoding='utf-8') as output:
output.write(rnas)
output.write('\nGene Length: '+ str(len(rnas)... | true |
ef0abb5dc8b40611ab51ef22edadbfecc0fc1961 | dongyang2/hello-world | /interview_q/leet_code/最后一个单词的长度.py | UTF-8 | 1,813 | 4.0625 | 4 | [] | no_license | # https://leetcode-cn.com/problems/length-of-last-word/
# coding: utf-8
# Python 3
# 输入一个字符串。每一个单词由空格分开。且指定单词只由字母组成。不存在最后一个单词的情况返回0.
#
# 思路:因为Python自带字符串的各种操作,所以分为两个版本,一个是py版,一个是普通版。
# 边界条件:最后一个子串里有非字母。空字符串输入。空格在最后。
def get_last_word_length(s):
"""普通版,遍历字符串的同时维护一个变量last_one"""
if s == "":
return 0
... | true |
09608a5f56d4d1a0f3a5b5aa582b7dfa2aed6562 | perebalsach/autorig | /builder/createLinks.py | UTF-8 | 1,406 | 2.8125 | 3 | [] | no_license | import pymel.core as pm
class Create(object):
def __init__(self, source='', target='', name=''):
"""
Create a visual link between the source and the target rigHelpers to further connect the rig joints
:param source: PyNode object
:param target: PyNode object
:param name: str - Name of the curve ... | true |
d39e5dd5aa9d2c83fae73a63b3fa4a627872f871 | soumitra9/DFS-1 | /01_matrix_BFS.py | UTF-8 | 1,632 | 3.421875 | 3 | [] | no_license | # Time Complexity : Add - O(m*n)
# Space Complexity :O(m*n)
# Did this code successfully run on Leetcode : Yes
# Any problem you faced while coding this : No
'''
1. Initially all the 0's are pushed on to the queue as they are independent
2. The 1's replaced with -1, to make sure they are not revsiited when BFS is perfo... | true |
d64fe467cb15400032da039c4a14965fba15f9aa | L-win-6/one | /0903/list.py | UTF-8 | 400 | 4 | 4 | [] | no_license | #定义一个列表
# name1=['张三','李四','王五']
# age1=[18,19,20]
# height=[170,180,190]
# weight=[50,60,70]
# print('姓名:',name1,'\n','年龄:',age1,'\n','身高:',height,'\n','体重:',weight)
# l1=['a','b','c','d'',e','f','g',]
# l2=['abcdefg']
# for i in l1:
# print(i)
# for i in l2:
# print(i)
lst=[1,2,3,4,5]
a,b,c,*d=lst
print(a,b,... | true |
bd643ea339f01ac2d0bf89300e8b81cfa30e457a | ALabInTheLab/AutoEssayGrading | /Xinyi/tutorial_2.py | UTF-8 | 7,517 | 2.734375 | 3 | [] | no_license | import numpy as np
import pandas as pd
import tensorflow as tf
import utils as utl
from collections import Counter
# Preprocess Data
# read data from csv file
data = pd.read_csv("data/StockTwits_SPY_Sentiment_2017.gz",
encoding="utf-8",
compression="gzip",
... | true |
6fd4a2bcf3fd62d6254bc6c2d2aad2f2225e9e42 | vellaichamy/machine-learning | /learning/classes/model_selection/detecting_overfitting_underfitting.py | UTF-8 | 1,420 | 3.234375 | 3 | [] | no_license | # Import, read, and split data
import pandas as pd
data = pd.read_csv('data.csv')
import numpy as np
X = np.array(data[['x1', 'x2']])
y = np.array(data['y'])
# Fix random seed
np.random.seed(55)
### Imports
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import GradientBoostingClassifier
fro... | true |
f633cf00f0afb8d89f3415e81d58403b3036f9cc | allenai/swag-evaluator | /evaluate.py | UTF-8 | 2,055 | 3.046875 | 3 | [
"Apache-2.0"
] | permissive | """Evaluate a submission for the SWAG dataset."""
import json
import logging
import click
import pandas as pd
logger = logging.getLogger(__name__)
@click.command()
@click.argument(
'predictions_path', metavar='PREDICTIONS',
type=click.Path(exists=True, file_okay=True, dir_okay=False))
@click.argument(
... | true |
d34a17933ad0a6ffdc7b4a9b90eb299ba765a9e2 | espotin/Python-full-course | /Step1-Python-Fundamentals/16-Project(List Sorting)/insertionSort.py | UTF-8 | 447 | 3.34375 | 3 | [] | no_license | my_list = [10, 12, 13, 20, 1, 5, 8, 3, 32, 30, 21, 120, 221, 1, 2, 9, 4, 3, 5, 8]
for i in range(1, len(my_list)):
if(my_list[i]<my_list[i-1]):
j = i
if(j == 0):
my_list[j], my_list[j-1] = my_list[j-1], my_list[j]
else:
while(my_list[j]<my_list[j-... | true |
689db62a9ffc472f72691a147d11727b166cf1e3 | jimbopants/Metagenomics_assembly | /python_scripts/bin_mver.py | UTF-8 | 1,362 | 2.90625 | 3 | [] | no_license | """
Move high quality bins into a new annotations folder
"""
__author__ = "Jim Griffin"
__author_email__ = "jimbogrif@gmail.com"
import os
import sys
import shutil
def main():
# Hard code for now cuz doing in 10 minutes
root = '/projects/b1042/Wells/Jim/Wells01/binning/'
bins = [root+'annotations/maxbin... | true |
de3dd193c361d4eadf98b9a2965f6efa76fc7dcb | michael-mackenzie/Algorithms | /Lab1-MichaelMacKenzie.py | UTF-8 | 5,534 | 3.75 | 4 | [] | no_license | # Code Written by: Michael MacKenzie
# Student Number: 10178040
# Course: CMPE 365
#######################################################################################################################
import matplotlib.pyplot as plt
################################################################################... | true |
b17504abc23f3f779e4198b39c40e61ed4ea2e4a | rusyasoft/TrainEnergyServer | /SensorNode.py | UTF-8 | 2,904 | 2.828125 | 3 | [] | no_license | import Sensor
import json
class SensorNode(object):
def __init__(self, sensornid=-1, sensornodename=None, isalive=False, jsonPayload = None):
self.sensorNodeId = sensornid
self.sensors = dict()
self.sensorNodeName = sensornodename
self.is_alive = isalive
if jsonPayload != None:
... | true |
e006791db2481def82ec3f4ead4fe91b91fb6ee4 | theloracle/laurel-code-foo | /licenseplates.py | UTF-8 | 2,037 | 4.46875 | 4 | [] | no_license | def take_pop():
# Function will interact with the user to learn the population
# In: nothing
# Out: Float of population
while True:
pop = raw_input("Please type the population: ")
#Test user input
try:
pop = float(pop)
if pop <= 0:
... | true |
ac7e23b87fbf8b572297584fde3e3df20daa6091 | ganeshjawahar/interpretNode | /feature_computation/papercitation/countDegree.py | UTF-8 | 2,703 | 2.515625 | 3 | [] | no_license | import sys
import random
import itertools
import math
random.seed(123)
from scipy import stats
def create_quantiles(arr, num_bins):
probs = [ (float(i)/num_bins) for i in range(1, num_bins+1)]
bin_edges = stats.mstats.mquantiles(sorted(arr), probs)
return bin_edges
def get_class(num, bin_edges):
i = 0
for b... | true |
72a7ac420ab0377822f393258128c1e7033881c4 | luisdemarchi/BOB404 | /backup/color_backup.py | UTF-8 | 16,359 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
#-*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals,with_statement
from sys import path
from os.path import dirname,abspath
curPath = dirname( abspath( __file__ ) )
path.append(curPath)
__author__ = 'Danilo Mitrovic, <adewdda@gmail.co... | true |
c0ee18f9c8d833957db31cdbeabfbc46ec5ebea7 | MasalaDosa/DCGAN | /gan.py | UTF-8 | 10,542 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python3
#pip install numpy
#pip install tensorflow
#pip install keras
#pip install matplotlib
import os, sys, getopt
import numpy as np
import matplotlib.pyplot as plt
from keras.layers import Dense, Reshape, BatchNormalization, Flatten, UpSampling2D, Conv2D, Dropout
from keras.layers.advanced_activati... | true |
d1382c008a89a74b904010f4d83ab07c1ba96a6b | heecer/old | /作业/day3/三级菜单升级版/三级菜单升级版.py | UTF-8 | 2,262 | 3.296875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author:Haccer
import json
info = {}
def write_info(dict):
'''写入json文件'''
info = json.dumps(dict,ensure_ascii=False)
with open('city','w',encoding='utf-8')as f:
f.write(info)
def open_info():
'''打开json文件'''
f = open('city','r',encoding='utf-8')
... | true |
8c32d66dacc46ea6899f51329677244e4170fde2 | SatyamJindal/Competitive-Programming | /CodeChef/Workers.py | UTF-8 | 337 | 2.96875 | 3 | [] | no_license | n=int(input())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
min_1=99999999
min_2=99999999
min_3=99999999
for i in range(len(b)):
if(b[i]==1):
min_1 = min(a[i],min_1)
elif(b[i]==2):
min_2 = min(a[i],min_2)
elif(b[i]==3):
min_3 = min(a[i],min_3)
print(min(min... | true |
032b876245f749fb2f2a5f2b49fb9835581c4186 | Aaron-Zhao123/network_analysis | /read_fb_data.py | UTF-8 | 564 | 2.546875 | 3 | [] | no_license | def read_fb():
file_name = 'facebook/0.edges'
raw_in = []
node_hash = {}
with open(file_name, 'r') as f:
for line in f:
val = [int(item) for item in line.split(' ')]
if (val[0] in node_hash):
node_hash[val[0]].append(val[1])
else:
... | true |
b0eb84c045798518a62833e15ed02cceb150dc93 | ziloukd/hogwarts_lwy | /homework_pytest1/test_pytest/tests/test_calc.py | UTF-8 | 1,865 | 2.796875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name: test_calc
Description :
Author : mi
date: 2020/12/18
-------------------------------------------------
Change Activity:
2020/12/18:
----------------------------------------------... | true |
ddf9d127ff468b5f6a2d54a127f13a3c1ef28a33 | vicaranq/CrackingTheCodingInterview | /Array&Strings/1-3_URLify.py | UTF-8 | 1,519 | 4.375 | 4 | [] | no_license | '''
Question:
Write a method to replace all spaces in a string with '%20'. You may assume that the string has sufficient space at the
to hold the additional characters, and that you are given the "true" length of the string.
Example:
Input: 'Mr John Smith ', 13
Output: 'Mr%20John%20Smith
Written by:
Victo... | true |
58e4c1f3db3078a38a2d9efe510c5b0823540af0 | DaHuO/Supergraph | /codes/CodeJamCrawler/16_4_1_neat/16_4_1_linguo_a.py | UTF-8 | 979 | 2.875 | 3 | [] | no_license | def f(N,R,P,S):
# Can't doitif more than half are anything
if (N == 1):
return ("P" * P) + ("R" * R) + ("S" * S)
if 2 * max(R,P,S) > N:
return "IMPOSSIBLE"
a = (R + S - P) / 2
b = (R + P - S) / 2
c = (P + S - R) / 2
# R = a + b
# S = a + c
# P = b + c
sub = f(N/2,... | true |
790749987cd3e88e4cff858918a1b2ccb6164ac7 | taiyunkim/PAD2 | /src/stclass/models.py | UTF-8 | 1,304 | 2.703125 | 3 | [] | no_license | from __future__ import unicode_literals
from django.db import models
class Signal_db(models.Model):
"""
The Signal_db class defines the meta-data of the signalfiles in the database.
**File_ID** - ID of a file.
**Filename** - Name of the (original) file.
"""
fileID = models.CharField(max_length... | true |
99ec3db850d95f47ccf9c7eadf0e5f889991d85c | timokoola/randomtwittersnippets | /split_to_json.py | UTF-8 | 2,011 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | import codecs
import sys
import json
import re
lines = {}
def split_line_parser(line):
s = line
splitters = ".!?:"
lesser_splitters = " |"
cands = sorted(map(lambda x: (x,abs(len(s)/2.-x[0])),filter(lambda x: x[1] in splitters,zip(xrange(len(s)),s))), key=lambda x: x[1])
if len(cands) == 0:
cands = sorted(map(... | true |
602038d4675596acbe7921b23a7d49e8633df52b | simednba/NLP_project1 | /skipGram.py | UTF-8 | 9,445 | 2.90625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Feb 14 15:33:40 2020
@author: simed
"""
#%%
from __future__ import division
import argparse
import pandas as pd
import re
import os
import pickle as pkl
import spacy
import numpy as np
from stopwords import stop_words
__authors__ = ['Hammouch Ouassim','El ... | true |
05b4366198cb9b1dd5376e24bd5170b03ba40a73 | KonstantinSKY/skybot | /databases.py | UTF-8 | 3,387 | 3.171875 | 3 | [] | no_license | import sqlite3
from decorators import try_decor
from say import Say
from abc import ABC, abstractmethod
from logger import Logger
log = Logger(__name__)
# class ConnectDB(sqlite3.Connection): # The class expands the possibilities of working with the database
# count = 0
#
# def __init__(self, db_file):
# ... | true |
51bdc99d884928d65f08f27e87f01258686483c3 | diego-aquino/competitive-programming | /Practicing/2sum.py | UTF-8 | 428 | 3.34375 | 3 | [] | no_license | def main():
k = int(input())
array = list(map(lambda x: int(x), input().split()))
n = len(array)
array.sort()
left, right = 0, n - 1
while left < right:
total = array[left] + array[right]
if total > k:
right -= 1
elif total < k:
left += 1
... | true |
878f031af7986b8f36729158e969d23c99b36527 | tomkinsalex/py_video_converter | /util/content_api_util.py | UTF-8 | 841 | 2.59375 | 3 | [] | no_license | import json
import urllib.request
from util import conf
from util.log_it import get_logger
logger = get_logger(__name__)
def is_new_content(path):
body = { 'path': path }
return bool(send_request(conf.API_IS_NEW_URL, body))
def post_new_video(path):
body = { 'path': path }
return send_request(conf.A... | true |
9e392cd4eb1d6919f1df7a70ff24130d242af150 | asatsi/python-ml-test | /Titanic/kaggled/titanic-svm-class-age.0.78947.py | UTF-8 | 3,195 | 3.140625 | 3 | [] | no_license | import pandas as pd
import numpy as np
from sklearn.naive_bayes import GaussianNB
filename="train.csv"
def generate_dataframe(dataframe1,csvtype):
print("dataframe1 training:\n",dataframe1.head(10))
#set Sex as female = 0 and male = 1
dataframe1.replace("female",0,inplace=True)
dataframe1.replace("male",1,inplac... | true |
64ec8dfad31afc9f9f6ec7f11f3e89759146b6fd | Bill-Fujimoto/Intro-to-Scripting--Data-Visualization | /04.03_Practice_Project_Visualizing_Cancer-risk_Data_on_the_USA_Map.py | UTF-8 | 3,342 | 3.734375 | 4 | [] | no_license | """
Week 4 practice project solution for Python Data Visualization
Load a county-level PNG map of the USA and plot cancer-risk data at county centers
"""
import matplotlib.pyplot as plt
import matplotlib as mpl
import math
import csv
USA_SVG_SIZE = [555, 352]
USA_SVG_SIZE_X = USA_SVG_SIZE[0]
USA_SVG_SIZE_Y = USA_SV... | true |
8b1195f243dfb33bc54bfbe853734f5f70b42de8 | devesh-tewari/PCA-Clustering-Logistic | /q-2.py | UTF-8 | 7,141 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# # Question 2
#
# # Part 1
# ## Logistion Regression
# In[11]:
import pandas as pd
import numpy as np
import sys
csv_path = 'AdmissionDataset/data.csv'#raw_input("Enter path to input CSV file: ")
dataset = pd.read_csv(csv_path)
dataset.drop(dataset.columns[[0]], axis=1, inp... | true |
d054a8b144af37a9685e1ac9f3189728b05f09d6 | maverick623/hackerearth | /Jadoo Hates Numbers.py | UTF-8 | 293 | 3.171875 | 3 | [] | no_license | '''Jadoo hates numbers, but he requires to print a special number "420" to recharge the equation of life.
He asks your help to print the number but Since he hates numbers, he asks you to write the program such that
there would not be any number in the code.'''
print(ord('F')*len('abcdef'))
| true |
044add05da4b84e7b7f04b2d8ecbf863b376a789 | RingBDStack/KPGNN | /KPGNN/layers.py | UTF-8 | 11,182 | 2.515625 | 3 | [] | no_license | from itertools import combinations
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class GATLayer(nn.Module):
def __init__(self, in_dim, out_dim, use_residual=False):
super(GATLayer, self).__init__()
# equation (1) reference: https://docs.dgl.ai/en... | true |
ab5bb488402472866a537ce0449469ca6bf368e0 | Abdifatah206/python_practice | /userinput.py | UTF-8 | 92 | 3.390625 | 3 | [] | no_license | x = input('Enter 1st number:')
y = input('Enter 2nd number:')
x = 8
y = 9
z = x + y
print(z) | true |
5b4f4a0cdc3eacf2cf6e8424203fc7641f12ab20 | takashi-osako/tales | /windy_tales/windy_tales/database/collections/generic_collection.py | UTF-8 | 1,604 | 2.640625 | 3 | [] | no_license | '''
Created on Apr 7, 2013
@author: dorisip
'''
from cloudy_tales.database.collections.base import BaseCollection
import datetime
from uuid import uuid4
from windy_tales.exceptions.exceptions import GenericCollectionException
class GenericCollection(BaseCollection):
def __init__(self, connection, template):
... | true |
be58fa9ce20f2fee6b31fdcce0cb6dc5427a6ca2 | ShuyaoLim/Test2 | /python1.3/13_通用装饰器.py | UTF-8 | 2,450 | 3.5625 | 4 | [] | no_license | #装饰器雏形
# def wrapper(fn):
# def inner():
# print("开挂")
# fn()
# print("关闭外挂")
# return inner
# @wrapper
# def dnf():
# print("我要玩dnf")
# dnf()
#如果被装饰的函数有参数
# def wrapper(fn):
# def inner(*args,**kwargs):#任意的参数都能接受
# print("开挂")
# fn(*args,**kwargs) #这里才是真正的目标函数
# ... | true |
47e7d8b485c7f54c2e28f35c2b1797a4d8d85677 | FilipposVlahos/FlexSanitise | /src/app.py | UTF-8 | 2,664 | 2.9375 | 3 | [] | no_license | from flask import Flask, jsonify, abort, request, make_response, url_for
from flask_cors import CORS
import re
from regex_sanitisations import RegexSanitisation
from qa_sanitiser import QASanitiser
from ner import NamedEntityRecogniser
app = Flask(__name__)
cors = CORS(app)
regex_sanitiser = RegexSanitisation()
qa_s... | true |
52bc1865a012afe3258c640c4a6458fb388f34ca | n-silva/python-data | /sentimentAnalysis.py | UTF-8 | 9,069 | 2.515625 | 3 | [] | no_license | import json
import re
import csv
import string
from sklearn import linear_model, metrics
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
from sklearn.model_selection import train_test_split
from sklearn.svm import LinearSVC
from sklearn.metrics import accuracy_score
from nltk import TweetT... | true |
2a4fb5c22f871562e335b8dbbe387b031e2ca5bf | Mopolino8/CVFES | /MKL.py | UTF-8 | 3,614 | 2.53125 | 3 | [] | no_license | import numpy as np
import scipy.sparse as sparse
#from scipy.sparse import csr_matrix
from ctypes import POINTER,c_void_p,c_int,c_char,c_double,byref,cdll
from timeit import default_timer as timer
class MKL:
def __init__(self):
self.mkl = cdll.LoadLibrary("libmkl_rt.so")
self.timeConsuming = 0.0
... | true |
5681dbf633b10450bf4523adfb78c990e8b2c520 | ishandutta2007/hwkim94.github.io | /Algorithm/python/b1463.py | UTF-8 | 423 | 3.34375 | 3 | [
"MIT"
] | permissive | import sys
def counting(val) :
dic = {1:0}
for num in range(2, val+1) :
dic[num] = dic[num-1] + 1
if num % 3 == 0 and dic[num] > dic[num//3]:
dic[num] = dic[num//3] + 1
if num % 2 == 0 and dic[num] > dic[num//2]:
dic[num] = ... | true |
fe644343d97ca12e0d3bd33564cdeefe96d6abc2 | cromox1/KodPerang_kata | /4kyu_nesting_structure_comparison.py | UTF-8 | 1,873 | 3.46875 | 3 | [] | no_license | def same_structure_as(original,other):
if type(original) == list and type(other) == list:
for x in ['[',']']:
if x in original:
original.remove(x)
if x in other:
other.remove(x)
asalstr = str(original).replace(' ', '')
asallist = [[x fo... | true |
eef7d87b4b7e08e14dad2a6bf4e225eba9239d91 | C1240055602/Appium1 | /ddt_test/ddt_demo.py | UTF-8 | 1,223 | 3.5625 | 4 | [] | no_license | # 实现4组测试用例执行
# 1、导入包,ddt,unittest
import ddt
import unittest
# 2、创建类,ddt.ddt
@ddt.ddt
class MyTestDdt(unittest.TestCase):
# 3、测试用例方法,@data参数化
# 数值
@ddt.data(2, 4, 6, 8)
@unittest.skip("先不运行")
def test_1(self, value):
print(f"参数内容是:{value}")
# 字符串
@ddt.data('code=200', "success", '... | true |
bb5fa79c60d2c1fce910a929b33f7c4cb6a357b7 | vikineema/MappingPaddyRice | /Evaluation.py | UTF-8 | 1,483 | 2.90625 | 3 | [] | no_license | import os
import numpy
folderDir = 'F:/DaiHoc/2016-2017 ki 1/Advanced Topics in Computer Science/Images'
def makeFileName(prefix, suffix, ext = "tif"):
return prefix + '_' + suffix + '.' + ext
def readPosLabelForYear(year):
filename = os.path.join(folderDir, makeFileName('NDVI', 'Pos_' + str(year), 'txt'))
... | true |
ac3ed220f658de9f0e7e7e4095dabd0a14e061ab | JohnLu04/cscircles-loesungen | /03_kommentare/01_second_guessing.py | UTF-8 | 305 | 3.171875 | 3 | [] | no_license | # Ziel: gib die Zahl der Sekunden in einer Woche an
SekundenProMinute = 60
SekundenProStunde = SekundenProMinute * 60 # todo: überprüfe dies!
SekundenProTag = SekundenProStunde * 24
TageProWoche = 5
TageProWoche = TageProWoche + 2 # Sind die Wochenenden deaktiviert?
print(SekundenProTag * TageProWoche) | true |
2227d2d076f41f09baf7318464e1e38d0ecc27b0 | bradleyrp/omni-single | /codes/binding.py | UTF-8 | 2,489 | 2.59375 | 3 | [] | no_license | #!/usr/bin/python
from joblib import Parallel,delayed
# from joblib.pool import has_shareable_memory
from numpy import *
import scipy
import scipy.spatial
from scipy.optimize import curve_fit
from scipy.misc import factorial
def ontorus(pts1,pts2,vecs):
"""
Compute distances under periodic boundary conditions with... | true |
0fa08db108d0152bed630fe02e024420b49475d1 | Wrthlor/cs50x | /pset7/houses/import.py | UTF-8 | 1,014 | 3.25 | 3 | [] | no_license | from cs50 import SQL
from sys import argv
import string
import csv
# Checks for correct number of command-line arguments
if len(argv) != 2:
print("Usage error: import.py characters.csv")
exit()
# Creates database
db = SQL("sqlite:///students.db")
# Opens CSV file
with open(argv[1], "r") as csv_file:
char... | true |
46904024195af3996c50809a7c6486987084e200 | Socca98/Mobile_Books-App | /Server_Flask/src/server.py | UTF-8 | 1,245 | 2.53125 | 3 | [] | no_license | # FLASK_APP=server.py flask run --host=0.0.0.0
from src.book_repository import BookRepository
from flask import Flask
from flask import request
from flask import jsonify
import sys
app = Flask(__name__)
bookRepo = BookRepository()
bookRepo.add({'title': 'Poezii', 'author': 'Mihai Eminescu'})
bookRepo.add({'title':... | true |
2938d09d123cdde8b61a4c0968b8b7c85f307f21 | ketkikinkar/HackerRank-Python | /Day25-Integers_Come_In_All_Sizes.py | UTF-8 | 731 | 3.984375 | 4 | [] | no_license | '''Integers in Python can be as big as the bytes in your machine's memory. There is no limit in size as there is: (c++ int) or (C++ long long int).
As we know, the result of grows really fast with increasing .
Let's do some calculations on very large integers.
Task
Read four numbers, , , , and , and print the res... | true |
f31d187ee4991197b01079dd1df89066f5d8fa7e | pflun/advancedAlgorithms | /floodFill.py | UTF-8 | 885 | 3.625 | 4 | [] | no_license | class Solution(object):
def floodFill(self, image, sr, sc, newColor):
if len(image) == 0 or sr > len(image) - 1 or sc > len(image[0]) - 1:
return []
elif not newColor or image[sr][sc] == newColor:
return image
def fill(image, x, y, newColor, oldColor):
if... | true |
9ac3265b7be8c8c1167d33c347ecdea690445e19 | ronny-souza/Lista-Entrega-04-Python | /Exercicio02.py | UTF-8 | 1,050 | 4.3125 | 4 | [] | no_license | # QUESTÃO 02 - Escreva um programa que leia inteiros do usuário até que seja inserida uma linha em branco.
# Uma vez que todos os inteiros tenham sido lidos seu programa deve exibir todos os números negativos, seguidos
# de todos os zeros, seguidos de todos os números positivos. Os elementos de cada um destes três gr... | true |
3f304098db7aed14f9d6945330b070271146c141 | mrmyothet/ipnd | /ProgrammingBasicWithPython-KCL/Chapter-2/Fibonacci.py | UTF-8 | 236 | 3.59375 | 4 | [
"MIT"
] | permissive | x = input("Total number : ")
try :
x = int(x)
f = 0
s = 1;
for k in range(x):
print(s,end=" ")
t = s
s = f + s
f = t
print("")
except ValueError:
print("Please enter number only")
| true |
bcaa4cba53f23ebabcc72e7887ed17ab91bab07b | oushiff/553_hw2_python | /fan_fei_clustering.py | UTF-8 | 5,547 | 2.984375 | 3 | [] | no_license | import math
import sys
PARANUM = 6
def getBuyingInt(string):
return {
"vhigh" : 3.0,
"high": 2.0,
"med" : 1.0,
"low" : 0.0,
}[string]
def getMaintInt(string):
return {
"vhigh" : 3.0,
"high": 2.0,
"med" : 1.0,
"low" : 0.0,
}[string]
def ... | true |
9d7da6298042053349d5404e2ce12e53a6d9ba02 | NB-DQN/q_place_cell | /environment.py | UTF-8 | 4,058 | 3.21875 | 3 | [] | no_license | import math
import numpy as np
import maze_generator
import maze
class Environment:
def __init__(self, size, goal_location):
self.size = size
self.goal = goal_location
self.maze = maze.Maze(self.size, self.goal)
self.current_coordinate = (0, 0)
self.move_count = 0
se... | true |
518b08c98121f24b14f316870038043e841e9c39 | liuperson/knowledge | /part4/Spider/实例/day02/test_douban.py | UTF-8 | 3,496 | 2.671875 | 3 | [] | no_license | import json
import requests
import re
from lxml import etree
# 取页面HTML
def get_page(url):
# url = "https://www.douban.com/group/explore"
headers = {
"User-Agent": "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; 360SE)"
}
response = requests.get(url, headers=headers)
if response.status... | true |
a07f179c071ab57b1b387685090c5a437244bebd | maestrano/mno-py | /lib/mno-py/src/sso/MnoSsoBaseUser.py | UTF-8 | 6,285 | 2.625 | 3 | [] | no_license | from datetime import datetime
import dateutil.parser
import json
import sys
import random
# Properly format a User received from Maestrano
# SAML IDP
class MnoSsoBaseUser(object, ):
# Session Object
session = None
# User UID
uid = ''
# User email
email = ''
# User name
n... | true |
d605b4a62300b4092f4be77d5b1c96fe6114d8ee | Strandtasche/AdventOfCode2020 | /day19/day19.py | UTF-8 | 1,132 | 2.984375 | 3 | [
"MIT"
] | permissive | import collections
import math
import re
import sys
with open('./data/input19.txt') as f:
rules, strings = [l.rstrip('\n') for l in f.read().split('\n\n')]
rules = dict([rule.split(': ', 1) for rule in rules.split('\n')])
def genRegex(number: str) -> str:
if number == '8':
return genRegex('42') + '+'... | true |
e3caccb0e7b2f70e72de66ff4b493892fc1ea268 | 5l1v3r1/EE | /pierce.py | UTF-8 | 2,036 | 3.34375 | 3 | [] | no_license | #!/usr/bin/env python
# Caculates approximate Pierce oscillator operating parameters.
import sys
import math
class PierceXtal(object):
def __init__(self, f, Co, C1, C2, R1=60):
self.Co = self.pf2f(Co)
self.C1 = self.pf2f(C1)
self.C2 = self.pf2f(C2)
self.CL = (self.C1 * self.C2) / ... | true |
e070197c8962532134484c38de3d9ad9f78eb3f5 | UMN-LATIS/LinearStitch | /stitcher.py | UTF-8 | 11,493 | 2.640625 | 3 | [] | no_license | from __future__ import print_function
import numpy as np
import cv2
import os
import platform
import pyopencl as cl
import ctypes
import ctypes.util
if (ctypes.util.find_library('libvips-42') or ctypes.util.find_library('libvips')):
import pyvips
CONFIG={}
CONFIG['max_features'] = 500
CONFIG['scale_factor'] = 0.5... | true |
10a7db4276ec2d37bf276c59847f3d260dea7155 | Josephine-Chen/KattisSolutions | /ladder.py | UTF-8 | 99 | 2.84375 | 3 | [] | no_license | import math
h, v = map(int, input().split())
v = math.radians(v)
print(math.ceil(h/(math.sin(v))))
| true |
f93e26117e051d226a5ad905be2ec52425e2ca03 | fujish4/npl100 | /chapter1/07.py | UTF-8 | 333 | 3.71875 | 4 | [] | no_license | from string import Template
def format_string(x, y, z):
return '{}時の{}は{}'.format(x, y, z)
def format_string_template(x, y, z):
t = Template('$hour時の$targetは$value')
return t.substitute(hour=x, target=y, value=z)
print(format_string(12, '気温', 22.4))
print(format_string_template(18, '湿度', 60.4)) | true |
16d598e9fce929d1b8a6565dcb0b18c4d3a97834 | NaveendraKularatne/python-zero-to-hero | /4_chapter4_shapesAndTexts.py | UTF-8 | 978 | 3.328125 | 3 | [] | no_license | import cv2
import numpy as np
BlackImage = np.zeros((512, 512))
coloredImage = np.zeros((512, 512, 3), np.uint8)
""" This a gray image, we can check that by printing the shape.
it will print only the shape, without any channel. if we want to create an image with a channel. we have to do it like below """
ImgWithChann... | true |
778a117d49ee4917370d02aced4e28ae3b8bce29 | rishabhng/arbie | /tests/unit/Variables/trade_test.py | UTF-8 | 816 | 2.796875 | 3 | [
"MIT"
] | permissive | """Unittest for Trade."""
import pytest
from Arbie.Variables import Pool, Trade
@pytest.fixture
def tokens(dai, eth):
return dai, eth
class TestTrade(object):
@pytest.fixture
def trade(self, tokens, eth, dai): # noqa: WPS442
pool1 = Pool(tokens, [400, 1], [0.5, 0.5])
pool2 = Pool(token... | true |
5117b12b93f648a9e55045e68dc8f73daf8cf9a2 | xqbptt/leaf-classification | /Similarity Detection/neem_similar.py | UTF-8 | 2,811 | 2.890625 | 3 | [] | no_license | import cv2
import numpy as np
yellow_lower = np.array([20, 100, 100]) #lower limit for yellow color in hsv
yellow_upper = np.array([30, 255, 255]) #upper limit for yellow color in hsv
green_lower = np.array([36,0,0]) # lower for green in hsv as well
green_upper = np.array([86,255,255]) # upper for green in hsv of cour... | true |
4c63c487d4cb1ca44b1631e52d1e584c0d9ec30d | thisudre/projetoIntegrador3 | /roleta.py | UTF-8 | 1,643 | 3.0625 | 3 | [] | no_license | import numpy as np
import random as rand
roulette_wheel = np.array((0))
slot_count = 0
def init_roul_wheel(value_array):
slot_count = 0
i = 0
arrsize = value_array.size
while i < arrsize/2:
slot_count = slot_count + value_array[2*i+1]
i = i + 1
roulette_wheel = np.zeros((slot_count... | true |
7ee84f2415482b83e6080fa8c6a13430c93ab3a9 | zunayedhassan/log_monitor_for_linux | /LogMonitor/OptionFrame.py | UTF-8 | 6,541 | 2.578125 | 3 | [] | no_license | __author__ = 'zunayed-hassan'
#!/usr/bin/python
# -*- coding: utf-8 -*-
import tkMessageBox
from Tkinter import *
from ttk import *
from Settings import *
from SettingsManager import *
from LogMonitor import *
from LogFile import *
"""
CLASS NAME: OptionFrame
PURPOSE: Show GUI of OptionFrame tab ... | true |
1bbb1ce0ee994ddac342a5211d663a860a32898d | ag3nt3154/saber_strongest | /box.py | UTF-8 | 4,870 | 2.78125 | 3 | [] | no_license | import pygame
import numpy as np
import time
import os
import misc_fn
dir_path = os.path.dirname(os.path.realpath(__file__))
# pygame.mixer.pre_init(44100, 16, 2, 4096) #frequency, size, channels, buffersize
pygame.mixer.init() #turn all of pygame on.
# Colour setting
black = (0, 0, 0)
white = (255, 255, 255)
red =... | true |
dac9edd851a9828c8cf49e84e74b5de374f31f26 | RamishaRaniK/YouTube-Comment-Analysis-Using-Natural-Language-Processing | /6.1_Topic_modelling_NONMATRICs.py | UTF-8 | 1,846 | 3.1875 | 3 | [] | no_license | "Importing necessary Files"
import pandas as pd
import os
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.decomposition import NMF
"Changing working directory where file is stored"
os.chdir('D:\\Ramisha_Practice\\NonMixed_Language(Eng)\\5.Most_Comment_greater50_NML')
"Saving all csv... | true |
29099d2608c59311aa6520d5e11e03ec42151d1a | Partha177/python | /dictionary.py | UTF-8 | 176 | 3.21875 | 3 | [] | no_license | dictionary={'banana': ' a fruit','ladies finger': ' a vegetable', 'peacock':' a bird'}
print(dictionary)
print(dictionary['banana'])
for v,k in dictionary.items():
print(v+k)
| true |
e9b17f633a951bd0de27045b84c49f7aad19adf0 | patrickbeeson/python-classes | /python_2/homework/GUI_Layout_Homework/src/GUI_layout.py | UTF-8 | 896 | 3.25 | 3 | [] | no_license | from tkinter import *
class Application(Frame):
def __init__(self, master=None):
Frame.__init__(self, master)
self.grid()
self.master.title("Grid layout")
for r in range(6):
self.master.rowconfigure(r, weight=1)
for c in range(1, 6):
... | true |
985bc8536852fd926ffe1ec55718b844218f59b8 | gransburyia/Gransbury-MATH361 | /IntroToProgramming/PartialSum_Gransbury.py | UTF-8 | 1,378 | 3.40625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Feb 8 12:29:28 2019
@author: grans
"""
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import math as m
import numpy as np
import matplotlib.pyplot as plt
stopNum = int(input("Enter a number that corresponds to the total number of terms in t... | true |
2a075924a66535f34ecf01f2e61696b452e5ce41 | lucasoliveiraprofissional/Cursos-Python | /Ignorancia Zero/aula011.py | UTF-8 | 1,172 | 4.34375 | 4 | [] | no_license | '''Pedir para o usuário digitar um valor de 1 a 7
são respectivos aos dias da semana
se o valor não for desses, o resultado é um print:
Entrada inválida
Ensinando If e elses aninhados
A variável que verifica se o dia é válido, fica verdadeira
a cada entrada certa feita.
'''
'''
Do primeiro modo:
dia= int(input('Dig... | true |
1e3476f3f52b235bc7da2fdf96a47bac4fe2a900 | kecoli/PCRM | /demo/FedInterestRateSlopeExperiments.py | UTF-8 | 1,778 | 2.84375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import pandas as pd, numpy as np, datetime
from scipy import stats
inFile = 'C:/Users/tkpme/OneDrive/Documents/GSoC projects/Textbook/Chapter 18/Volatility and IR of Treasury Nominal yield curve.xlsx'
def main():
IRdaily = pd.read_excel(inFile, sheet_name='Interest Rates for P... | true |
de98c590bc87b67dcb8bd981bac2d8affd9826df | animate-object/friend-simulator | /src/core/components/cond.py | UTF-8 | 3,847 | 3.125 | 3 | [] | no_license | from collections import Collection
from random import choice
from enum import Enum
class Duration(Enum):
BATTLE=1 # lasts until battle is over
DEATH=2 # lasts until your health drops to 0
INDEFINITE=3 # lasts until cured by specific means
class Condition():
def __init__(
... | true |
445de512bc62e0823594a4082263c8911705a3d9 | Aasthaengg/IBMdataset | /Python_codes/p03227/s015523970.py | UTF-8 | 83 | 3.4375 | 3 | [] | no_license | a = input()
n = len(a)
if n == 2:
ans = a
else:
ans = a[::-1]
print(ans)
| true |
4ca290331e8ed6bec5b7a7788f380bf724079a43 | lazybing/algorithm | /python/leetcode136_single_number/solution.py | UTF-8 | 517 | 2.828125 | 3 | [] | no_license | class Solution:
def singleNumber(self, nums:List[int])->int:
ret = 0
for i in range(len(nums)):
ret ^= nums[i]
return ret
class Solution:
def singleNumber(self, nums:List[int])->int:
hash_tab = defaultdict(int)
for i in nums:
hash_tab[i] += 1
... | true |
672a367c964b1e2a22131ff132105705f0bf4dcc | WNoxchi/Aersu | /GLOC/utils/temp_utils.py | UTF-8 | 4,383 | 2.8125 | 3 | [] | no_license | import shutil
import os
import numpy as np
import time
def count_files(path, verbose=False):
count = 0
for folder in path.iterdir():
count += len(list(folder.glob('*')))
if verbose: print(f'{folder}: {len(list(folder.glob("*")))}')
return count
def clear_cpu_dir(cpu_path, verbose=False):
... | true |
a5ecbf466afa169f6edb4eff2c79fc6683daa052 | XiuzeZhou/NeuRank | /pNeuRank.py | UTF-8 | 14,660 | 2.625 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import math
from pylab import *
from data import *
from sklearn.model_selection import KFold
from sklearn.metrics import auc,roc_auc_score,precision_recall_curve
import argparse
#################### Arguments ####################
def parse_args():
parser = argparse.Argum... | true |
6c7b0bd604e8f5b69eb38b8b980b9c7a27f7f871 | agrawal-git/csce670 | /oauth.py | UTF-8 | 470 | 2.65625 | 3 | [] | no_license | from twitter import *
'''
OAuth module. Call to authenticate to Twitter.
Access OAuth.api to get an API object.
'''
class Auth:
'''OAuth handling'''
consumer_key = 'f2MEow3T5KceQdSXfqA'
consumer_secret = 'iiy7WdQdSKbqhRCxSwwivSUidioGyOf4aQpqg7czWo'
access_token = '143602582-ViRwhkTAnlbtUPMc2A... | true |
967c1c4dc6ac4757f5be20a53e37bc93036f659d | iandioch/hashcode_practice | /candy_noah.py | UTF-8 | 6,350 | 3.109375 | 3 | [] | no_license | import copy
import sys
from queue import Queue
class Cord:
def __init__(self, x, y):
self.x = x
self.y = y
def pair(self):
return self.x, self.y
class Buffer:
def __init__(self, width):
self.cols = [[] for _ in range(width)]
def push_line(self, line):
for i, v... | true |
6ef54354bddc71bee21fa77ab05382ec08f64075 | akshayrampuria/BeverageClassifier | /SeamlessDataReader.py | UTF-8 | 7,223 | 3.078125 | 3 | [] | no_license | import csv
from SimilarityFinder import edit_distance_dynamic, edit_distance_naive
# from python-Levenshtein import distance
import requests, time, pickle
from xgoogle.search import GoogleSearch, SearchError
from collections import defaultdict
import wikipedia
class DataReader:
def __init__(self):
self.numBev = ... | true |
d9e41acc26983705509eebf338c3c281feca669a | k-harada/AtCoder | /other_contests/PAST2019/G.py | UTF-8 | 957 | 3.171875 | 3 | [] | no_license | from itertools import product
def solve(n, a_array):
res = -100000000
for p in product([0, 1, 2], repeat=n):
res_temp = 0
for i in range(n):
for j in range(n):
if p[i] == p[j]:
res_temp += a_array[i][j]
res = max(res, res_temp)
ret... | true |
503fb4c23a5ce3d0976cc5c20d195595e6d31def | simvisage/bmcs | /ibvpy/mats/mats2D/mats2D_explorer_bcond.py | UTF-8 | 3,361 | 2.65625 | 3 | [] | no_license | #-------------------------------------------------------------------------
#
# Copyright (c) 2009, IMB, RWTH Aachen.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in simvisage/LICENSE.txt and may be redistributed only
# under the conditions described... | true |
3fad5e1dcd49059b03fb0df408f0ec4e0563cfd5 | krazybean/PyPostBin | /pypostbin/postbin.py | UTF-8 | 1,476 | 2.90625 | 3 | [
"MIT"
] | permissive | import requests
from urllib.parse import urlparse, urljoin
POSTBIN_URL = 'http://postb.in'
class PostBin(object):
def __init__(self):
self.api = urljoin(POSTBIN_URL, '/api/bin')
self.bin_id = self.get_id()
self.bins = Bin(self.bin_id)
self.request = Request(self.bin_id)
def... | true |
5852a8896edb2c885f4a31988f7132cda50451e6 | JEONJinah/Shin | /mnist_softmax.py | UTF-8 | 2,972 | 3.09375 | 3 | [] | no_license | import torch
# torchvision.dataset : 배포되어 있는 open dataset 다운로드 가능
# torchvision: 이미 잘 알려진 모델 다운로드 및 실행이 가능, 이미지 전처리 등 여러 패키지들이 포함함
import torchvision.datasets as dsets
import torchvision.transforms as transforms # 데이터들을 텐서로 일괄 변경
from torch.utils.data import DataLoader # DataLoader를 사용해서 shuffle, batch size 등을 셋... | true |
f57bb845ba9aebd7f91d329b0b2927cb3f2952cf | yangyang0910/Python | /模块一/day01/ejz.py | UTF-8 | 184 | 2.875 | 3 | [] | no_license | # -*- coding:utf-8 -*-
# AUTHER @ Alvin
# count = 0
# while count < 1000000:
# count+=1
# print(bin(count))
print(int('11110100001001000000',2))
print("Hello C很有") | true |
372d3c1ca84d4822ccacc9426838f39c0bc0ca3a | LucasNoga/Workspace-Python | /Battle Dev/Battle_dev_2015/poker.py | UTF-8 | 1,272 | 4 | 4 | [] | no_license | Enoncé
Dans ce challenge, l'objectif est de déterminer la somme qu'a un joueur à la fin d'une partie de poker. Le joueur dispose d'une somme initiale. À chaque tour, le joueur mise un montant X. Puis il gagne un montant Y pouvant être positif ou nul. Le bilan pour chaque tour est donc -X+Y.
Votre code doit renvoy... | true |
1c9ac3dd867c821b0b846bcd3d166e1d0f125d13 | sharathk91/Python-2018 | /ICP4/EmployeeDetails.py | UTF-8 | 1,615 | 4.125 | 4 | [] | no_license | class Employee: #define the employee class
#initialize the empcount,totalsaland avgsal to 0
empcount=0
totalsal=0
avgsal=0
#define constructor and map the values
def __init__(self,name,family,sal,dept): #constructor
self.name = name
self.family = family
self.salary = s... | true |
0b7d76fbcd2a80dd592571fc4aa60a0bdb3b2c60 | shi-cong/PYSTUDY | /PYSTUDY/middleware/mongolib.py | UTF-8 | 499 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | """
mongo模块
"""
import pymongo
import sys
if sys.version.startswith('2.7'):
from urllib import quote_plus
else:
# TODO python3 for quote_plus
from urllib.parse import quote_plus
class MongoPool(object):
def __init__(self, host, username, password):
uri = "mongodb://%s:%s@%s" % (quote_plus(use... | true |
9b15741fefb1f7ce58333b1bd83ded84bc11ace4 | Gowt859/player | /p20.py | UTF-8 | 133 | 2.921875 | 3 | [] | no_license | s1 = input()
L1 = []
for c in s1 :
k = ord(c) + 3
if k > ord('Z') : k -= 26
L1.append(chr(k))
s2 = ''.join(L1)
print(s2)
| true |
acb3ee23c450b715d71ae87f5f722d516a276df8 | fagan2888/robupy | /robupy/sandbox.py | UTF-8 | 1,803 | 3.078125 | 3 | [
"MIT"
] | permissive | """This module contains functions that are not yet ready for prime time due to the need to add
further flexibility and further testing."""
from statsmodels.sandbox.distributions.extras import mvnormcdf
import numpy as np
def get_normal_probabilities(num_bins, mean, cov):
"""This function returns a grid of binned... | true |
45edf1c92ca12288679bad4151e822a230154c51 | aladoy/YPLLG-Geneva | /src/YPLLGgeneva-AddInfoGIREC.py | UTF-8 | 5,740 | 3.25 | 3 | [] | no_license | '''
Assign median neighborhood income and neighborhood median age to GIREC polygons.
'''
#LIBRARIES
import pandas as pd
import geopandas as gpd
import numpy as np
import os
import statistics
import itertools
#IMPORT DATASET
#ANNUAL MEDIAN INCOME FOR MARRIED PEOPLE PER STATISTICAL SUB-SECTOR (GIREC)
income=pd.read_ex... | true |
4e6ccfd7c48455d66d4c357d7fe26a976f7a2cbd | interviewpre/HeartDiseaseClassification | /rnn.py | UTF-8 | 841 | 2.734375 | 3 | [] | no_license | from keras.models import Sequential
from keras.layers import Dense,LSTM
import pickle
import numpy as np
data = pickle.load(open('data/processed_data/cleveland.pickle'))
Y = []
for line in data:
l = [0,0,0,0,0]
l[int(line[13])]=1
Y.append(l)
X = [ line[:-1] for line in data]
print len(X)
print len(Y)
X_... | true |
906405fe91c1ce8db10319b395e94fe1264df61a | jiarong/SSUsearch | /scripts/count-min.py | UTF-8 | 905 | 2.9375 | 3 | [
"BSD-3-Clause"
] | permissive | #! /usr/bin/env python
# get minimum seq number in a dir
"""
Get minimum seq number among sequence files in a directory
% python count-min.py <seqdir>
"""
import sys
import os
import glob
import screed
def main():
# Usage: python <thisfile> <seqdir>
if len(sys.argv) != 2:
mes = 'python {} <seqdir>'... | true |
1abf8d634b699e2d567493d674c2b038bd74a6c3 | guillaumekln/CTranslate2 | /python/ctranslate2/specs/model_spec.py | UTF-8 | 10,445 | 2.890625 | 3 | [
"MIT"
] | permissive | """Specifications declare the expected variables layout of CTranslate2 models
that do not load a computation graph. The model converter should make sure that
each required variable of the specification is set.
"""
import os
import shutil
import struct
import numpy as np
OPTIONAL = "optional"
def _join_scope(scope, ... | true |
ddbaa54ead267b6585e3856cb25c7c3291707ed4 | Bluefoux/Sortering_algoritmer | /heapsort.py | UTF-8 | 1,094 | 3.296875 | 3 | [] | no_license | import random
import time
from datetime import timedelta
start_time = time.time()
def heapcount(lst, num, i):
largest = i
num_1 = (2*i)+1
num_2 = (2*i)+2
if num_1 < num and lst[i] < lst[num_1]:
largest = num_1
if num_2 < num and lst[largest] < lst[num_2]:
largest = num... | true |
3d21770808003c8848a4b42c7a7aa8d0c461fb05 | JEZIKdata/Coffee-Machine | /main.py | UTF-8 | 665 | 3.140625 | 3 | [] | no_license | from menu import Menu, MenuItem
from coffee_maker import CoffeeMaker
from money_machine import MoneyMachine
my_money_machine = MoneyMachine()
my_coffee_maker = CoffeeMaker()
my_menu = Menu()
turn_off = False
while not turn_off:
options = my_menu.get_items()
order = input(f"What would you like to drink? {option... | true |