blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
3b231574235a6e6febee5449627cd6459922adcb | Python | jolealdoneto/datamining-list1 | /cap10q2d.py | UTF-8 | 1,974 | 3.015625 | 3 | [] | no_license | seq_db = [ "ACGTCACG", "TCGA", "GACTGCA", "CAGTC", "AGCT", "TGCAGCTC", "AGTCAG" ]
alf = [ "A", "C", "G", "T" ]
def is_present(seq, phrase, last):
for l in seq:
spot = phrase.find(l, last)
if spot == -1:
return -1
last = spot+1
return last
def get_pos(seq, phrase, last):
... | true |
8aaba8b62384211843f6c7e34fb027a1ef93c3be | Python | hyurii/python | /Workshop01/Grupa03/adam_kuzmiak/cwiczenia02.py | UTF-8 | 1,450 | 3.75 | 4 | [] | no_license | """Listy"""
import collections
# indeksowanie od 0 jak pan bog przykazal
listaA =[1,3,"ala"]
print listaA[2]
# sortowanie ze zmiana
#listaA.sort()
#sortowanie bez zmian
print sorted(listaA)
# dodawanie do listy. nie mozna w prost. trzeba urzysac dodatliwych komend
#kasowanei
# ## del listaA
#
print len(listaA)
... | true |
8cb515f2d73ad46d68946bb14bcea808bb5ba9f3 | Python | SSL-Roots/CON-SAI | /decision_making/scripts/constants.py | UTF-8 | 1,072 | 2.609375 | 3 | [
"MIT"
] | permissive | from geometry_msgs.msg import Point
FieldX = 9.0
FieldY = 6.0
PenaltyX = 3.3
PenaltyY = 1.2
FieldHalfX = FieldX * 0.5
FieldHalfY = FieldY * 0.5
DefenceHalfStreach = 0.25
DefenceLength = 1.0
GoalSize = 1.0
GoalHalfSize = GoalSize * 0.5
RobotRadius = 0.09
BallRadius = 0.0215
poses = {
'CONST_OUR_GOAL' : Po... | true |
daaee769bcafb4e4d3945e64ef2e984de17f01ac | Python | MilesPerGallon8/UltimateDungeonMaster | /Registers/EntityRegister/__init__.py | UTF-8 | 1,160 | 3.265625 | 3 | [] | no_license | class EntityRegister:
def __init__(self):
self.cnt = 0
self.registry = []
# Note: player(s) will be added to the registry first and will not be removed (unless in multiplier mode and a
# player leaves or joins)
def registerEntity(self, entity):
# If the entity's info is ... | true |
5f0647b38a97468da35a810f97baef414a742cf4 | Python | Justin-Tan/particle2seq | /adversary.py | UTF-8 | 4,712 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | """ Adversarial training for robustness against systematic error """
import tensorflow as tf
import numpy as np
import glob, time, os
from utils import Utils
import functools
from config import directories
class Adversary(object):
def __init__(self, config, classifier_logits, labels, pivots, pivot_labels, args, t... | true |
9945f8ad887c628ffc3e311de81552be63299a82 | Python | chirateep/algorithm-coursera-course1 | /week6_dynamic_programming2/1_maximum_amount_of_gold/knapsack.py | UTF-8 | 921 | 3.328125 | 3 | [] | no_license | # Uses python3
import sys
def optimal_weight(W, w):
# write your code here
value_array = list()
for i in range(len(w) + 1):
init_list = [float("-inf")] * (W + 1)
value_array.append(init_list)
for i in range(len(w) + 1):
value_array[i][0] = 0
for j in range(W + 1):
... | true |
e41a9b6fd06db4cb6bb2baf59463fa0dfa71f150 | Python | Jual6332/OTheRS_IP | /Archive/Current_Software_Modules/R&D/RETIRED_StitchAPI/main.py | UTF-8 | 3,884 | 2.9375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
################################################################################
################################################################################
### "main.py" ##################################################################
######################################################... | true |
213fd5ce7397becfab77b209ecb050be404b1bd4 | Python | vikramlance/Python-Programming | /InterviewQuestions/KnuthShuffle.py | UTF-8 | 194 | 2.734375 | 3 | [] | no_license | import random
i=map (int, (raw_input().strip().split(' ')))
print i
j=len(i)
print j
if j < 2:
print i
else:
for a in range(j):
b=random.randint(0,j-a)
i[b], i[a] = i[a], i[b]
print i
| true |
4270c26947c9f7435c3fe0c83726e2faf4d3ec16 | Python | dragonSwords98/pathfinder | /pathfinder.py | UTF-8 | 11,051 | 3.71875 | 4 | [
"MIT"
] | permissive | # PathFinder.py
#
# Bryan Ling, courtesy of Receptiviti
#
# 2019-05-01
from typing import List
from collections import defaultdict, deque
import math
""" We wont use this exception but it's here
for an example where an error can be handled
# class NotationError(Exception):
# pass
"""
class Edge:
"""Assume ... | true |
5870e84cbbb54fa7a5b692f82d05b1374ab30cce | Python | david-a-joy/organoid-shape-tools | /organoid_shape_tools/plotting/utils.py | UTF-8 | 22,959 | 3.09375 | 3 | [
"BSD-3-Clause"
] | permissive | """ Plotting utilities
* :py:func:`~get_layout`: Calculate useful grid layouts
* :py:func:`~bootstrap_ci`: Calculate bootstrap confidence intervals for line plots
Compound plotting functions:
* :py:func:`~add_colorbar`: Add a colorbar to an axis
* :py:func:`~add_histogram`: Add a histogram with kernel and model fits... | true |
8ab56987f07901507107f4aef7f0399ff775aeb7 | Python | yzheng51/log-template | /main.py | UTF-8 | 2,019 | 2.734375 | 3 | [] | no_license | import logging
from logging.handlers import TimedRotatingFileHandler
import module.submodule.core
import module.utils
LOG_FILE = "example.log"
def getLogger(file_name):
FORMAT = r'%(asctime)s %(levelname)-8s %(name)s[line:%(lineno)d] - %(message)s'
# create logger with 'module'
logger = logging.getLogger... | true |
fbc474a2d7c1000d699455028f6a91be35b2d3ec | Python | LiXiaofeng-712/- | /Tedu/python/day02/login2.py | UTF-8 | 855 | 3.8125 | 4 | [] | no_license | '''
#测试用户的输入正确显示登陆成功,否则登陆失败
user=input('请输入用户名:')
passwd=input('请输入密码:')
if user == '' or passwd == '':
print('请输入正确的用户和密码!')
exit
elif user == 'bob' and passwd == '123456':
print('Login successful')
else:
print('Login inorrect')
'''
'''
#判断成绩的小测试
grade = int(input('请输入成绩:'))
if grade > 90:
print('... | true |
b1fc9ab82821ad4a03f597ba943d2ee455b0855e | Python | longhao54/leetcode | /easy/66.py | UTF-8 | 1,542 | 3.421875 | 3 | [] | no_license | class Solution:
def plusOne(self, digits):
"""
:type digits: List[int]
:rtype: List[int]
"""
# 这么做的问题是 有可能会超出 int 的长度
# num = 0
# for i in digits:
# num = num * 10 + i
# digits = num
# digits += 1
# ans = []
# while... | true |
65079902ef33f800b412a6977ee5e320b0f0be97 | Python | amritpandey007/Codetantra-Lab | /Python Lab/LAB - 5/stringTest19.py | UTF-8 | 203 | 4.25 | 4 | [] | no_license | s=input("Enter a string: ")
l=len(s)
l1=int(l/2)
if l%2==0:
print("First half string of given even length string is: "+s[:l1])
else:
print("Second half string of given odd length string is: "+s[l1+1:]) | true |
f1337838af3d2dafe14302b84ac07870d7409029 | Python | magnuskonrad98/max_int | /FORRIT/timaverkefni/27.08.19/prime_number.py | UTF-8 | 341 | 4.03125 | 4 | [] | no_license | n = int(input("Input a natural number: ")) # Do not change this line
# Fill in the missing code below
divisor = 2
while divisor < n:
if n % divisor == 0:
prime = False
break
else:
divisor += 1
else:
prime = True
# Do not changes the lines below
if prime:
print("Prime")
else:
... | true |
caea56973112eba0b57efb5543ef69a01edddaeb | Python | MohammadSorkhian/sRANs | /Lu_Dataset/Program_FinalModel.py | UTF-8 | 3,419 | 2.59375 | 3 | [] | no_license | import os
import pandas as pd
import numpy as np
import sklearn
import glob
from sklearn.model_selection import GridSearchCV
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import precision_recall_curve,auc
from sklearn.metrics import precision_recall_curve,auc
import matplotlib.pyplot as plt
... | true |
d07f5af321a863f7b75b59198e369c31a9df5f20 | Python | johndevera/sample_code | /python/1queue2stacks.py | UTF-8 | 313 | 3.5625 | 4 | [] | no_license |
class queue:
def __init__(self):
self.inStack = stack()
self.outStack = stack()
def enqueue(self, value):
self.inStack.push(value)
def dequeue(self):
if (self.outStack.isEmpty()):
while(!self.inStack.isEmpty):
temp = self.inStack.pop()
self.outStack.push()
return self.outStack.pop() | true |
cab01146a3f833c52c0bf9a465908b990b1756ed | Python | dcontant/checkio | /amsco_cipher.py | UTF-8 | 2,887 | 3.515625 | 4 | [] | no_license | from math import ceil
'''
The Amsco Cipher is a transpostion cipher. Choose a number of columns, then write the plaintext ( no whitespace)
into the columns going from left to right, alternating between writing one or two plaintext letters into each
adjacent column and rows . Number the columns with a key consisting o... | true |
b93bb9c3ad3faa12a3c59d9a91b9921ff2c7e3ab | Python | zloutek1/MasarykBOT | /bot/utils/logging.py | UTF-8 | 2,099 | 2.625 | 3 | [
"MIT"
] | permissive | import logging
import os
from logging import FileHandler, Formatter
from logging.handlers import TimedRotatingFileHandler
from pathlib import Path
from rich.logging import RichHandler
def my_namer(default_name: str) -> str:
# This will be called when doing the log rotation
# default_name is the default filen... | true |
700c6910d5844fd572855020f507cb606492f4f5 | Python | creativepark-js/jupyter | /동아리 1주차/동아리2번.py | UTF-8 | 176 | 3.65625 | 4 | [] | no_license | ##2번문제
korean , math , english = map(int,input().split('/'))
print("국어,수학,영어의 평균 점수는 " ,int(((korean+math+english)/3)), "점입니다",sep='')
| true |
735d3edb647be4b89ac99ff9b689767c535f35f4 | Python | Runek00/myTools | /loginTools.py | UTF-8 | 671 | 2.59375 | 3 | [] | no_license | import pyautogui
from time import sleep
import configReader as cr
from typing import Optional
from tkinter import Event
def mainLogin(key: str) -> None:
login, password = cr.getLogin(key)
sleep(cr.delay)
pyautogui.click()
pyautogui.typewrite(login)
sleep(cr.getWaitTime(key))
pyautog... | true |
affb9f2df666928742fb99fae67a15df05a78f37 | Python | kurhula/cloudcafe | /cloudcafe/compute/extensions/security_groups_api/models/security_group.py | UTF-8 | 5,294 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | """
Copyright 2013 Rackspace
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dist... | true |
0b3da5794ec041f6357ea2a50c5f9fb5fc82ed27 | Python | ABoringPerson359/github_practice | /suijishu.py | UTF-8 | 434 | 3.9375 | 4 | [] | no_license | from random import randint
class Die():
def __init__(self):
self.sides=6
def setlength(self,length):
self.sides=length
def roll_die(self):
a=randint(1,self.sides)
print('在1和你设置的长度之间的一个随机数为:'+str(a))
die=Die()
for b in range(1,11):
die.roll_die... | true |
55179c1f2cdebbb80c8c4c807f75f6d87dfde126 | Python | summukhe/TemporalGraph | /temporal_graph/network_analysis/graph_algorithms.py | UTF-8 | 9,123 | 2.546875 | 3 | [] | no_license | import logging
import numpy as np
import pandas as pd
from .graph import *
from .graph_adapter import *
__all__ = ['diameter', 'betweenness', 'edge_betweenness',
'shortest_path', 'get_all_shortest_paths',
'between_groups_centrality', 'gomory_hu_cuts',
'maxflow', 'weight_inversion', 'i... | true |
cdda42f3963ce65705befbbaad65b53a762caff5 | Python | cernozby/BIPYT | /comps/templatetags/comps_filters.py | UTF-8 | 523 | 2.578125 | 3 | [] | no_license | from django import template
from django.template.defaultfilters import stringfilter
register = template.Library()
@register.filter
def get_item(dictionary, key):
if key is None:
return '-'
return dictionary.get(int(key))
@register.filter
def get_item_string_key(dictionary, key):
if key is None:... | true |
5cd59e79a921f1b3a7e147bfe1cdec96e2be9e42 | Python | jiaojiner/Python_Pygame | /game_stats.py | UTF-8 | 822 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- encoding = utf-8 -*-
# 该代码由本人学习时编写,仅供自娱自乐!
# 本人QQ:1945962391
# 欢迎留言讨论,共同学习进步!
class GameStats():
"""跟踪游戏的统计信息"""
def __init__(self, settings):
"""初始化统计信息"""
self.ai_settings = settings
self.reset_stats()
# # 游戏刚启动时处于活动状态
# self.game_activ... | true |
eb7461ce8c77abca17ca8667005fa01d9a370b44 | Python | LyfeOnEdge/appstore-py | /webhandler/webhandler.py | UTF-8 | 1,261 | 2.546875 | 3 | [] | no_license | import os, sys, shutil
from .etags import accessETaggedFile
#web handling
import urllib.request
opener = urllib.request.build_opener()
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
urllib.request.install_opener(opener)
#Variable to map previously downloaded jsons to minimize repeated downloads
filedi... | true |
e3478ecc383965d556aca65cb53e1bf9efca92f8 | Python | chrishuan9/codecademy | /python/14Loops-10.py | UTF-8 | 178 | 3.484375 | 3 | [] | no_license | def main():
hobbies = []
# Add your code below!
for i in range(3):
hobby = raw_input("Please enter a hobby:")
hobbies.append(hobby)
if __name__ == "__main__":
main() | true |
b66cea10a74a492d71644033f08b38f9c7895f31 | Python | augmentedfabricationlab/ur_fabrication_control | /src/ur_fabrication_control/direct_control/fabrication_process/fabrication.py | UTF-8 | 5,863 | 2.546875 | 3 | [
"MIT"
] | permissive | import sys
from threading import Thread
from ..communication import TCPFeedbackServer
if sys.version_info[0] == 3:
from queue import Queue
else:
from Queue import Queue
__all__ = ["FabricationFeedbackServer",
"Fabrication"]
class FabricationFeedbackServer(TCPFeedbackServer):
def listen(self, s... | true |
3d2b88ce9c03e7f5b8bc82d1cb4406ad44d4e296 | Python | lioreldar/SingleAgentCombat | /Arena/constants.py | UTF-8 | 2,549 | 2.5625 | 3 | [] | no_license | from enum import IntEnum
import numpy as np
from os import path
WITH_LOS = True
PRINT_TILES_IN_LOS = True
USE_BRESENHAM_LINE = False
SIZE_X = 15
SIZE_Y = 15
MOVE_PENALTY = 5
WIN_REWARD = 250 #will be change to be reward for reaching controling point
LOST_PENALTY = 250
TIE = 0
MAX_STEPS_PER_EPISODE = 250
NUMBER_O... | true |
6b777ad7213e7022f51c51fc4382af3d4aac46a3 | Python | justinhsg/AdventOfCode2016 | /19/elves.py | UTF-8 | 781 | 3.046875 | 3 | [] | no_license | with open("input.txt", "r") as infile:
comm = int(infile.read())
elves = []
nRemoved = 0
position = 0
pointer = []
for i in range(comm):
pointer.append((i+1)%comm)
while(nRemoved<(comm-1)):
removedElf = pointer[position]
nextElf = pointer[removedElf]
pointer[removedElf] = -1
pointer[position] ... | true |
7fa7cd8f377e7a0851b8f62e0e76eaf8ef4d6417 | Python | jeffchiudev/100-days-of-python-code-day-1-practice | /band-name-generator/band-name-generator.py | UTF-8 | 219 | 4 | 4 | [] | no_license | print("Welcome to the band name generator")
city = input("What was the name of the city you grew up in?\n")
pet = input("What was the name of your first pet?\n")
print("Your new band name is: " + city + " " + pet + "!") | true |
7b64b7e7d08d0da242e05cffa576a42e80a4df4a | Python | PavelSamosin/PythonLessonScCode | /ReturningFunctions.py | UTF-8 | 227 | 4.125 | 4 | [] | no_license |
def return_name(firstName, lastName):
return print("FirstName: " + firstName + "\nLastName: " + lastName)
first = input("What is your first name?")
last = input ("What is your last name?")
return_name(first, last) | true |
eb05d7eda8ba3f79f9e07553fcae25efe50ce6b0 | Python | gabriellaec/desoft-analise-exercicios | /backup/user_092/ch121_2020_03_30_20_05_35_942854.py | UTF-8 | 160 | 2.671875 | 3 | [] | no_license | lista0 = []
i = 0
def subtracao_de_listas(lista1,lista2):
while(i < len(lista1))
if lista1[i] in lista2:
lista0.append(lista1[i])
i += 1 | true |
6a2a32c78f8ac519d7b46a502400f7744f05f6f9 | Python | umjembersoft/MI20151-Keamanan-Komputer | /Kriptografi/1400631008_Muhammad Mahrus ali/new3.py | UTF-8 | 262 | 2.75 | 3 | [] | no_license | import os
from Crypto.Hash import MD5
def get_file_checksum(filename) :
h = MD5.new()
chunk_size = 8192
with open (filename, 'rb') as f:
while True:
chunk = f.read(chunk_size)
if len (chunk) == 0:
break
h.update(chunk)
return h.hexdigest()
| true |
81a7cd6f5faab6b0c28c0e1691ca3346cd7aee85 | Python | nadiahyder/FacialLandmarkDetection | /networks.py | UTF-8 | 3,126 | 2.640625 | 3 | [] | no_license | import torch.nn as nn
import torch.nn.functional as F
from torchvision import datasets, models, transforms
import matplotlib.pyplot as plt
import numpy as np
class Net1(nn.Module):
def __init__(self):
super(Net1, self).__init__()
self.conv1 = nn.Conv2d(1, 15, 5)
self.conv2 = nn.Conv2d(15, 2... | true |
5876a61dd7ea5aef6cd73fcdea2e15eee9cea156 | Python | ctralie/GSPLib | /DGMTools.py | UTF-8 | 9,314 | 3.171875 | 3 | [
"Apache-2.0"
] | permissive | """
Author: Chris Tralie
Description: Contains methods to plot and compare persistence diagrams
Comparison algorithms include grabbing/sorting, persistence landscapes,
the "multiscale heat kernel" (CVPR 2015), and "persistence images" (Adams et al.)
"""
import numpy as np
import matplotlib.... | true |
b9c165cd7872e962de6051ad5f628718b04a790a | Python | omsirvi/title | /lamsub.py | UTF-8 | 100 | 3.21875 | 3 | [] | no_license | # subtract two number
sub = lambda a,b: a-b
sub = sub(5,3)
print("subtract two number %s")%(sub)
| true |
bfd542777adc9aa186150c504bd4ac93c36cdad0 | Python | Sapphire64/AJPmanager | /ajpmanager/core/DBConnector.py | UTF-8 | 351 | 2.90625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | import redis
class DBConnection(object):
def __init__(self, host='localhost', port=6379, db=0):
#from time import time
#t1 = time()
self._connection = redis.StrictRedis(host=host, port=port, db=db)
#print ('Redis initialized: ' + str(time() - t1))
@property
def io(self):
... | true |
e59273bafb41273c6095b7eef1a01e3edcf0e393 | Python | max-collider/codeacademy | /censor_dispenser/censor_dispenser.py | UTF-8 | 1,293 | 3.6875 | 4 | [] | no_license | # These are the emails you will be censoring. The open() function is opening the text file that the emails are contained in and the .read() method is allowing us to save their contexts to the following variables:
email_one = open("email_one.txt", "r").read()
email_two = open("email_two.txt", "r").read()
email_three = o... | true |
a9b0a188cc80879a6d59be084679ecada521ace4 | Python | mikedh/trimesh | /tests/test_points.py | UTF-8 | 11,426 | 3.078125 | 3 | [
"MIT"
] | permissive | try:
from . import generic as g
except BaseException:
import generic as g
class PointsTest(g.unittest.TestCase):
def test_pointcloud(self):
"""
Test PointCloud object
"""
shape = (100, 3)
# random points
points = g.random(shape)
# make sure randomne... | true |
ae42dad42e994f4b437c49848509fbd87fd727cf | Python | ecajandig/robotFramework | /ROBOT/InternalLibraries/ExcelRead.py | UTF-8 | 2,474 | 2.5625 | 3 | [] | no_license | '''
Created on 23-Sep-2015
@author:
'''
import openpyxl
import xlrd
import xlwt
from xlutils.copy import copy
import os.path
from xlrd import open_workbook
def Excel(filepath,Sheetname,uniq):
wrkbook = open_workbook(filepath)
sheet = wrkbook.sheet_by_name(Sheetname)
rows = sheet.nrows
cols = she... | true |
951bbac47dd658cb73b761ea4dd06aa87d340c85 | Python | cyndichin/DSANano | /Data Structures/Recursion/Checking Palindrome.py | UTF-8 | 1,295 | 4.09375 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# # Palindrome
# A **palindrome** is a word that is the reverse of itself—that is, it is the same word when read forwards and backwards.
#
# For example:
# * "madam" is a palindrome
# * "abba" is a palindrome
# * "cat" is not
# * "a" is a trivial case of a palindrome
#
# The... | true |
49e5f4cb99b330959173f60046ae895d0b8295ff | Python | peymanbey/wordEmbedding | /src_tfEmbedding.py | UTF-8 | 6,658 | 3.09375 | 3 | [] | no_license | """
Vector representation of Words
Neural Probablistic Approach
Skip-Gram Model
Github : peymanbey
"""
from __future__ import division
from helper import download, read_data, build_dataset, gen_batch
#import collections
from math import sqrt
import cPickle as pickle
#import os
#import random
#import zipfile
import n... | true |
b02e5a69b356e966f0f9b229cedd7607ece24fbf | Python | Hakyon/inteligencia_computacional | /trabalho1/mochila.py | UTF-8 | 4,298 | 2.859375 | 3 | [] | no_license | import random
from deap import base
from deap import creator
from deap import tools
from deap import algorithms
from pprint import pprint
import numpy
TAM_CROMOSSOMO = 12
TAM_POPULACAO = 100
ITENS_MOCHILA = [
['bug repellent', 12, 2],
['camp stove', 5, 4],
['canteen (full)', 10, 7],
['clothes', 11, ... | true |
bf2f5c96f37fb304628306b6da420f1a07c1a23f | Python | PRD0507/Python | /doubly_linked_list.py | UTF-8 | 2,676 | 4.0625 | 4 | [] | no_license | class Node:
def __init__(self, data = None, next = None, prev = None):
self.data = data
self.next = next
self.prev = prev
class Doubly_linked_list:
def __init__(self):
self.head = None
def insert_at_beginning(self,data):
if self.head == None :
... | true |
b95465865a31701a98cc3b1de9a31c47d1b28544 | Python | gilbertosg/hadoop-platform-and-application-framework | /spark/advanced-join-assignment/split_show_views.py | UTF-8 | 152 | 3.03125 | 3 | [] | no_license | def split_show_views(line):
show_views = line.split(",")
show = show_views[0]
views = show_views[1]
return (show, views) | true |
dd56cd83770d9cb05154b8faf0dcf022bb2ef327 | Python | AMFagan/MDFDatabase | /TestProject/sorting.py | UTF-8 | 1,564 | 3.078125 | 3 | [] | no_license | import random
import time
def qsort(l):
# print(l)
if not l:
return l
pivot = l[0]
left, right = [], []
for o in l[1:]:
if o < pivot:
left += [o]
else:
right += [o]
# print('%s : %s : %s' % (left, pivot, right))
return qsort(left) + [pivot] +... | true |
abd6d37da74fa8f4a7fdd32fd59fc35e93903ef5 | Python | kevald1963/milestone-4-walkabout | /product/models.py | UTF-8 | 2,071 | 2.625 | 3 | [] | no_license | from django.db import models
# Create your models here.
class Product(models.Model):
"""
NOTES:
If a product is marked as a single use product then it means that it can only be combined with a
non-single use product. Two or more different subscriptions types cannot be combined as it would be
diffi... | true |
44b551e97078aa029420aa4fbebb7e19cb37de38 | Python | nmessa/Python-2020 | /Lab Exercise 12.16.2020/problem3.py | UTF-8 | 311 | 3.96875 | 4 | [] | no_license | ## Lab Exercise 12/16/2020 Problem 3
## Author:
## This function returns a list that contains a running total of another list
def cumlativeSum(numbers):
#Add code here
#Code to test function
numbers = [4,3,6,2,7,12]
print(numbers)
print (cumlativeSum(numbers)) #[4, 7, 13, 15, 22, 34]
| true |
a27caa7b4d8ce745713b0739cf18f2f1750a8203 | Python | clemencegoh/SUTD_Networks_50.012 | /lab/project/Remote Server.py | UTF-8 | 2,390 | 2.609375 | 3 | [] | no_license |
# coding: utf-8
import time
import socket
import config
from Encryption import RsaKey, AesKey
s = socket.socket()
s.bind((config.serverHost,config.serverPort))
msg = ""
remKeys = RsaKey()
IpToAesDic = {}
# Listen for connection
while True:
s.listen(1)
c, addr = s.accept()
if config.isTest:
addr... | true |
50f2720d8ef71a80c940a8efa079526174a8adca | Python | opendr-eu/opendr | /src/opendr/engine/example_learner.py | UTF-8 | 3,923 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2020-2023 OpenDR European Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | true |
4bf5f729c88ef017251cac1713543d8e99586b7f | Python | Chirag-Bansal/StudentLife-Dataset | /XGBoost.py | UTF-8 | 711 | 3.15625 | 3 | [] | no_license | import pandas as pd
from sklearn.metrics import mean_absolute_error
import warnings
from xgboost import XGBRegressor
warnings.filterwarnings('ignore')
training_data = pd.read_csv("final.csv")
training_data_x = training_data[['Day','Hour','Activity']]
training_data_y = training_data[['Duration']]
testing_data = pd.... | true |
892f23ccef3df8a04e427b44a43bcef009f9527e | Python | Wankd/Pyproject1 | /mingyihui/yyys_doctor.py | UTF-8 | 4,409 | 2.734375 | 3 | [] | no_license | #coding:utf-8
import re
from bs4 import BeautifulSoup
def get_doctor_name(soup):
'''
获取医师姓名
:param sopu:
:type soup:BeautifulSoup
:return :'zc':职称,'sf':身份,'pm':排名','doctor_name':姓名
'''
Dict={'doctor_name':'','zc': '', 'sf': '', 'pm': ''}
class_str=soup.select('.doctorName')[0].get_text... | true |
4c12d2ff3e01dc509d708e0d418be931e0b18ac1 | Python | pitonpiton/prometheus | /job-7-2.py | UTF-8 | 4,881 | 3.359375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Розробити класс Student для представлення відомостей про успішність слухача курсу Prometheus.
Об'єкт класу має містити поля для збереження імені студента та балів,
отриманих ним за виконання практичних завдань і фінального екзамена.
Забезпечити наступні методи класу:... | true |
6023be0d97c13e678d4bc22b7bcb23d3dcd04df9 | Python | madeibao/PythonAlgorithm | /PartC/Py重新的排列数组.py | UTF-8 | 373 | 3.671875 | 4 | [] | no_license |
from typing import List
class Solution:
def shuffle(self, nums: List[int], n: int) -> List[int]:
res = []
i = 0, j = n
while i < n and j < len(nums):
res.append(nums[i])
res.append(nums[j])
i+=1
j+=1
return res
if __name__ == "__main__":
s = Solution()
nums = [1... | true |
066009fa0708d80575d96b8dc7128b8538e62b44 | Python | emwkempen/web_scraper | /email_script.py | UTF-8 | 718 | 2.71875 | 3 | [] | no_license | import smtplib, ssl
port = 465 # For SSL
smtp_server = "smtp.gmail.com"
sender_email = 'nc894fienjcvqieopwv@gmail.com'
password = '+zYS2gz/]e^L=UD@'
receiver_email = 'emwkempen@gmail.com'\
, 'sietskevliet@gmail.com'
test_elem1 = 'first line'
test_elem2 = 'second line'
subject = 'New Listing'
message = f'{test_e... | true |
24caa093531e92724a1616a3027b420200f612f8 | Python | pomadka/Learn_basics_of_Python | /variables_and_types/Numbers.py | UTF-8 | 56 | 3.03125 | 3 | [] | no_license | myint = 23
print (myint)
myfloat = 23.2
print (myfloat) | true |
73e1a262aeb75a9424b227b6eb744e371a25a8f1 | Python | pconerly/Go-Analyzer | /extracode.py | UTF-8 | 2,559 | 2.65625 | 3 | [] | no_license | class var:
def __init__(self):
self.jdstring = ''
def jdict():
f = open(r"C:\Python26\go_analyzer\KJD_example1.sgf", 'r')
#f = open(r"C:\Python26\go_analyzer\KJD_clean2.sgf", 'r')
#jdstring = ''
for line in f:
jdstring = jdstring + line.strip()
jt = tree.jtree()
#imp... | true |
96dbf8debc5ee2e66919b1b405961a3f9adcb076 | Python | kiran1906/python | /hackerrank/testing.py | UTF-8 | 275 | 3.984375 | 4 | [] | no_license | scores = [45, 45]
grade = sum(scores) / len(scores)
if 90 <= grade <= 100:
print('O')
elif 80 <= grade < 90:
print('E')
elif 70 <= grade < 80:
print('A')
elif 55 <= grade < 70:
print('P')
elif 40 <= grade < 50:
print('D')
elif grade < 40:
print('T') | true |
7ad59324dd72bbdce5343590349f15b25938bac0 | Python | checalov/AliBot | /motd.py | UTF-8 | 1,403 | 2.84375 | 3 | [] | no_license | #!/usr/bin/python3
import urllib.request
import urllib.parse
import json
import random
ASCII_API = 'http://artii.herokuapp.com/make'
QUOTES = 'http://loremricksum.com/api/?paragraphs=1"es=1'
random.seed()
# Other font are here
# http://artii.herokuapp.com/fonts_list
FONTS = [
'kban',
'letters',
'madrid',
... | true |
4d70cb2730daf0676409ce35c1d04b1c216f3f60 | Python | nuria/study | /EPI/sudoku.py | UTF-8 | 2,690 | 3.53125 | 4 | [] | no_license | #!usr/local/bin
def print_board(b):
print "-----"
for i in range(0 , len(b)):
print " ". join(b[i])
print "----"
def sudoku_solve(board):
# print_board(board)
M = board
numbers= ['1', '2', '3', '4', '5','6', '7', '8','9']
EMPTY = '.'
def get_current_square(row_index, column_i... | true |
ef49e91f01e5328e059d527acaaf6e3a7e371618 | Python | idriss1998/WFA-image | /imageToWFA.py | UTF-8 | 3,756 | 2.625 | 3 | [] | no_license | import numpy
import string
from PIL import Image
import math
import sys
import re
import SVD
from WFA import WFA
from fileHandler import writeWFAInFile
def imageToWFA(img,Maxerror):
Maxerror = Maxerror/10
img = img.convert('LA')
img_array = numpy.array(img)
n = 1
currentState = n - 1
images = [img_array]
I = [1]... | true |
6d5d6ee2a35b0f31ff949b0860b623b6328d1b44 | Python | gabybosc/MPB | /alfven.py | UTF-8 | 9,244 | 2.640625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Cursor
from funciones import donde, fechas
from funciones_plot import onpick1
from importar_datos import importar_mag_1s, importar_swia
np.set_printoptions(precision=4)
"""
Ex densidades.py
Calcula el giroradio térmico y la long inercia... | true |
809fbe34e8f801b3ae675fe6bf8ff788d6514212 | Python | dychen/cryptopals | /set2/challenge14.py | UTF-8 | 9,189 | 3.625 | 4 | [] | no_license | """
Byte-at-a-time ECB decryption (Harder)
--------------------------------------
Take your oracle function from #12. Now generate a random count of random bytes
and prepend this string to every plaintext. You are now doing:
AES-128-ECB(random-prefix || attacker-controlled || target-bytes, random-key)
Same goal: decr... | true |
5e73de0990a08ef44a923f87fd3d542fc80d0afb | Python | WalsalihiOSC/2021_assessment_project-Jun-CSC3 | /start_window.py | UTF-8 | 647 | 2.796875 | 3 | [] | no_license | import tkinter as tk
class start_window(tk.Frame):
def __init__(self, *args, **kwargs):
Frame = tk.Frame.__init__(self)
Frame.__init__(self)
title_frame = tk.Frame()
title = tk.Label(text="Welcome to MathLearn",font=("Arial",30))
title.pack(fill="none")
header = tk.L... | true |
cd3736689356676f9f575df456eb9266e60a4805 | Python | blankazucenalg/CodeExercises | /python/number_of_pairs.py | UTF-8 | 1,168 | 3.90625 | 4 | [] | no_license | """
arr = [1,2,3,4]
k = 5
result = 2
"""
import unittest
def number_of_pairs(arr, k):
result = 0
while len(arr) > 0:
x = arr.pop()
y = k - x
tmp = [a for a in arr if a == y]
result += len(tmp)
print(result)
return result
def number_of_pairs_2(arr, k):
d = {}
r... | true |
bd1fd0bac4f42d4e1a2b293a98edc99a8ae722f0 | Python | sienmonika/Airport-schedule-py | /runscheduling.py | UTF-8 | 2,929 | 2.890625 | 3 | [] | no_license | from gurobipy import *
import numpy as np
import math
import readIn
def solve(full_path_instance):
n, r, b, d, g, h, s = readIn.readFile(full_path_instance)
# indexshifting so that i lands at 1 instead of 0, as demanded in the exercise
n=n+1
#-Define model variables----------------... | true |
f2fd6864599d7c85a7ae8ac1414aef08e088797b | Python | ljzc/FoundationOfDataScience_Assignment | /project/crawler/src/util/html_constructor.py | UTF-8 | 2,084 | 2.78125 | 3 | [] | no_license | from bs4 import BeautifulSoup
_HTML = "html"
_BODY = "body"
_H1 = "h1"
_H2 = "h2"
_H3 = "h3"
_DIV = "div"
_P = "p"
_A = "a"
_BR = "br"
_HR = "hr"
_LI = "li"
_STRONG = "strong"
class Tag:
def __init__(self, tag, text="", **kwargs):
self.tag = tag
self.kwargs = kwargs
self.text = text
... | true |
649ec25202553c93a864e75fee587e2dbef1cc48 | Python | SteenJennings/Life-Generator | /csv_logic.py | UTF-8 | 3,258 | 3.390625 | 3 | [] | no_license | # Name: Steinar Jennings
# Course: CS 361
# Description: Life Generator - Processing Functions for handling csv database and creation
import csv
import sys
import pandas as pd
import os.path
from os import path
# searches the CSV (locally for the file)
def search_database(input_item_type, user_category, num_to_genera... | true |
3f6eaaa8d4a1747a33d2bb5c0d797c496f531120 | Python | gqxjones/MyprojectHogwarts | /app/test_touchaction.py | UTF-8 | 3,473 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import pytest
from appium import webdriver
from appium.webdriver.common.mobileby import MobileBy
from appium.webdriver.common.touch_action import TouchAction
from hamcrest import assert_that, equal_to, close_to, contains_string
from selenium.webdriver.support import expecte... | true |
3589eeebd7f4545b1743f4e20203741a2d0e0397 | Python | EM1697/PrototipoAutomatizacion | /Main.py | UTF-8 | 1,784 | 2.875 | 3 | [] | no_license | import os, glob, time, datetime
import RPi.GPIO as gpio
from gpiozero import LED, Button
gpio.setmode(gpio.BCM)
gpio.setwarnings(False)
# Pagina de Sensor de Temp = http://www.innovadomotics.com/mn-tuto/mn-mod/mn-rp/11-raspberry-pi-ds18b20.html
os.system('modprobe w1-gpio')
os.system('modprobe w1-therm')
_direccion ... | true |
504eb107509989babab5222798258c04a173378a | Python | Romuruotsalainen/Warhammer-40-k-Hit-and-wound-calculator | /weapon.py | UTF-8 | 639 | 2.734375 | 3 | [
"MIT"
] | permissive | class weapon(object):
def __init__(self, name, Range, Type, S, AP, D, Abilities):
self.name = name
self.Range = Range
self.Type = Type
self.S = S
self.AP = AP
self.D = D
self.D = Abilities
def print_name(self):
return self.name
d... | true |
a16aeea790c59b233f78e2c2f34dd602c14b2f25 | Python | daniel-reich/ubiquitous-fiesta | /8cJnRPxtjNP64k5fq_7.py | UTF-8 | 638 | 3.078125 | 3 | [] | no_license |
def dance(lst,parameter):
if parameter == 'men':
length = len(lst)
if length%2 == 0:
for i in range(0,length//2):
lst[i][1],lst[-(i+1)][1] = lst[-(i+1)][1],lst[i][1]
return lst
else:
for i in range(0,length//2):
lst[i][1],lst[-(i+1)][1] = lst[-(i+1)][1],lst[i][1]
r... | true |
8bce8200a21168f6304803556c770a20134998c2 | Python | matasuke/stylenet-pytorch | /test/stylenet/test_modules.py | UTF-8 | 3,576 | 2.609375 | 3 | [] | no_license | import torch
from stylenet.modules import FactoredLSTM, EncoderCNN
def test_encoder():
feature_dim = 256
batch_size = 5
channel_size = 3
img_size = 256
encoder = EncoderCNN(feature_dim)
images = torch.randn(batch_size, channel_size, img_size, img_size)
features = encoder(images)
ass... | true |
e4812ecc75be5ed3fd831640595a104940d70cb6 | Python | vtemian/interviews-prep | /cracking-the-code-interview/stacks/04-queue-via-stacks.py | UTF-8 | 1,764 | 3.609375 | 4 | [
"Apache-2.0"
] | permissive | from typing import Union
class Stack:
def __init__(self, size: int = 100):
self.size = size
self.store = []
def pop(self) -> Union[int, None]:
if self.is_empty:
return None
return self.store.pop()
def peek(self) -> Union[int, None]:
if self.is_empty:
... | true |
a068d82b9bf99fc97a785a80af115b48601815cd | Python | jagin/datascience-notebooks | /notebooks/Python/scripts/predict.py | UTF-8 | 3,182 | 2.65625 | 3 | [
"MIT"
] | permissive | import torch
from torch.autograd import Variable
import torchvision.transforms as transforms
import numpy as np
from PIL import Image
from train import build_model
import json
def process_image(image_path):
''' Scales, crops, and normalizes a PIL image for a PyTorch model,
returns an Numpy array
'''
... | true |
b50f6196b4b5d2fbe5378645f1a888cf7acecd01 | Python | shaversj/exercism | /python/robot-simulator/robot_simulator.py | UTF-8 | 1,442 | 3.859375 | 4 | [] | no_license | # Globals for the bearings
# Change the values as you see fit
EAST = "EAST"
NORTH = "NORTH"
WEST = "WEST"
SOUTH = "SOUTH"
class Robot(object):
directions = ["NORTH", "EAST", "SOUTH", "WEST"]
def __init__(self, bearing=NORTH, x=0, y=0):
self.bearing = bearing
self.x = x
self.y = y
... | true |
0fe7efc51112a673078ddaa5b790b7d7d3763f89 | Python | davdevor/AIHW2 | /src/AIHW2/AIHW2/AIHW2.py | UTF-8 | 3,091 | 3.203125 | 3 | [] | no_license | import sys
class HW2:
n=0
matrix = []
matrixCopy = []
sumRows = []
sumColumns = []
sumDiagonals = []
freeSpaces = []
def __init__(self, **kwargs):
self.readData(kwargs['fileName'])
return super().__init__()
def readData(self,fileName):
file = open(str(fileNam... | true |
3cfabd08b4bd7d46996db183c2d3a7194e529d03 | Python | bmoretz/Daily-Coding-Problem | /py/illuminated/09_scheduling.py | UTF-8 | 2,878 | 4.03125 | 4 | [
"MIT"
] | permissive | '''
In this programming problem and the next you'll code up the greedy algorithms from lecture for minimizing the weighted sum of completion times...
This file describes a set of jobs with positive and integral weights and lengths. It has the format
[number_of_jobs]
[job_1_weight] [job_1_length]
[job_2_weight] [job... | true |
0759284d0e6dd593f28a7334b5fb7e2da913f368 | Python | utoooo/math_puzzle | /q01.py | UTF-8 | 231 | 3.140625 | 3 | [] | no_license | #!/usr/bin/env python
"""
Q01
"""
N = 11
while True:
dec_s, oct_s, bin_s = f'{N}', f'{N:o}', f'{N:b}'
if dec_s == dec_s[::-1] and oct_s == oct_s[::-1] and bin_s == bin_s[::-1]:
print(N)
break
N += 2
| true |
2ab576c4f4ec03d104950785ed94cad99e4d621a | Python | udemirezen/PICANNs | /Draw_Graphs_Supp.py | UTF-8 | 4,276 | 2.96875 | 3 | [
"BSD-2-Clause"
] | permissive | '''
Copyright 2020 Amanpreet Singh,
Martin Bauer,
Sarang Joshi
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this lis... | true |
16035b1fe1927ae0e953fc5cfca923c0f82e67de | Python | keides2/android-yolo-v2 | /scripts/labelImg/filecheck.py | UTF-8 | 1,308 | 3.296875 | 3 | [
"WTFPL"
] | permissive | # -*- coding: utf-8 -*-
#
# Usage: $ Python filecheck.py image_folder
#
import sys
import glob
import os
# メイン
def main():
# 引数1から画像フォルダ名取得
args = sys.argv
if (len(args) != 2):
print("Usage: $ python" + args[0] + " folder name")
quit()
folder_name = args[1]
# print("Folder name (a... | true |
a269e9d94d79737d65c1acb94ad463ea5c825b09 | Python | syurskyi/Algorithms_and_Data_Structure | /_algorithms_challenges/leetcode/LeetcodePythonProject/leetcode_0351_0400/LeetCode357_CountNumbersWithUniqueDigits.py | UTF-8 | 423 | 2.828125 | 3 | [] | no_license | '''
Created on Mar 23, 2017
@author: MT
'''
class Solution(object):
def countNumbersWithUniqueDigits(self, n):
if n == 0: return 1
res = 10
uniqueDigits = 9
availableNumbers = 9
while n > 1 and availableNumbers > 0:
uniqueDigits = uniqueDigits*availableNumbers
... | true |
e2e9ae8ab4f01d96f98aeb929bbc94fe9c1767b2 | Python | SavannahN/DBL-HTI-group-33 | /AllPlots_bokeh.py | UTF-8 | 3,043 | 2.609375 | 3 | [] | no_license | # import libraries
import matplotlib.pyplot as plt
import gc
import numpy as np
from PIL import Image
from bokeh.layouts import gridplot
from bokeh.embed import components
# 'library' created by the team to help with he processing of the data
from HelperFunctions import get_x_fixation
from Data_bokeh import draw_dataf... | true |
8330ee0087644025b351bf16a78c52dad9294164 | Python | moosenahmad/Dist | /client.py | UTF-8 | 318 | 2.90625 | 3 | [] | no_license | import socket
ip = raw_input("Enter server ip: ")
host = ip
port = 8080
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host,port))
print("You are connected to the server\n")
while 1:
data = s.recv(1024).decode('utf-8')
print('Server: ' + data)
if(data == "cmdclose"):
break
| true |
5f1df8c75b203f7ae3cb39e1b7855d4653b78f93 | Python | 664743503/code_share | /python/hm_python/05_高级数据类型/my_04_列表遍历.py | UTF-8 | 130 | 3.265625 | 3 | [] | no_license | name_list = ["萧炎", "林动", "牧尘", "周元"]
for name in name_list:
print("我的名字叫 %s" % name)
# P272
| true |
38af84f4d80368509f3c5a8d77c88a23a3a50696 | Python | shun-lin/Shun_Hackerrank_Solutions | /Cracking the Coding Interview/Data Structures/Strings Making Anagrams.py | UTF-8 | 496 | 3.625 | 4 | [] | no_license | def number_needed(a, b):
if not a:
if not b:
return 0;
else:
return len(b);
else:
a_list = list(a);
b_list = list(b);
repeat = 0;
a_length = len(a);
b_length = len(b);
for ele in a_list:
if ele in b_list:
... | true |
0d118ccf0a60b6616ed609a25ca38542946039d0 | Python | luisebenkert/ask-your-repository-api | /application/evaluation/evaluation_view.py | UTF-8 | 1,240 | 2.65625 | 3 | [] | no_license | """
Handles all logic of the evaluation api
"""
from flask_apispec.views import MethodResource
from flask import request
import json
import datetime
class EvaluationView(MethodResource): # pylint:disable=too-few-public-methods
"""Defines Routes on collection"""
def post(self, **params):
"""Logic for updati... | true |
3f55c9ef89cdf2144e21d9500f71e1f1824e69d0 | Python | dertuncay/Generation-of-non-stationary-accelerograms | /sabetta.py | UTF-8 | 3,757 | 2.578125 | 3 | [] | no_license | def sabetta(Mw,Re,Re1,isito,isig,dt,nacc,tot_dur,scale):
import numpy as np
nacc = int(nacc)
'''=======================================================================
function for the generation of non-stationary accelerograms
adapted from original fortran program of Sabetta F. and Pugliese A. (1995)
=========... | true |
e84e528cfe134601afd029dafeb30957f34c8fc8 | Python | max747/fgojunks | /material_simulator/genservantdata.py | UTF-8 | 2,008 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python3
import argparse
import csv
import json
import sys
def get_target_skill_level(current: int, threshold: int) -> int:
if current <= threshold:
return threshold
else:
return current
def main(args):
reader = csv.reader(args.source, delimiter=args.delimiter)
items =... | true |
7dd5f6cc07a01af7b48d8f6524efbbed48de8456 | Python | jowj/cryptopals | /challenge4-rewrite.py | UTF-8 | 2,426 | 3.515625 | 4 | [] | no_license | import requests
from binascii import unhexlify
# convert that to int, since we're gonna be xoring it
def hexToIntConversion(hexString):
'''use like "hexToIntConversion(given)"
'''
converedBytes = unhexlify(hexString)
return converedBytes
# xor new int with all possible ascii codes
def xorIntAgainstA... | true |
056e7f713e04515cbefe9ffa21df2f29d1d96844 | Python | Shirmyyy/CS313E | /TestLinkedList.py | UTF-8 | 11,337 | 3.75 | 4 | [] | no_license | # File: TestLinkedList.py
# Description: Assignment14
# Student Name: Shimin Zhang
# Student UT EID: sz6939
# Course Name: CS 313E
# Unique Number: 51350
# Date Created: 11/3/2018
# Date Last Modified: 11/5/2018
class Link (object):
def __init__ (self, data, next = None):
self.da... | true |
6daba8fb3f989fab879c000f65022d371698f42b | Python | abhi472/Pluralsight | /Python2Lambdas/lambds.py | UTF-8 | 210 | 3.0625 | 3 | [] | no_license | scientist = ['mariecurie', 'pierrecurie', 'issacasimov', 'nikoltesla', 'johnnash']
print(sorted(scientist, key=lambda name: name.split()[-1]))
key = lambda name : name.split()[-1]
print(key("nikola tesla")) | true |
953d54d4b97944df1b5a54c570f53a2b5fc526e7 | Python | howardfk/gravity_sim | /gravity_sim.py | UTF-8 | 2,692 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python
import matplotlib.pylab as plt
import numpy as np
import matplotlib.animation as ani
class Force(object):
def __init__(self,p1, p2):
#self.force=np.array([0,0,0])
self.update(p1,p2)
def update(self, p1,p2):
#Force on p1 from p2
sep = p1.pos - p2.pos
... | true |
b0f3ee6ce576feb9f16a54884382ad265834d38c | Python | ferrier1/CIS_210 | /Project_1/pin-converter.py | UTF-8 | 1,580 | 3.546875 | 4 | [] | no_license | import argparse
import numpy
## Constants used by this program
CONSONANTS = "bcdfghjklmnpqrstvwyz"
VOWELS = "aeiou"
def alphacode(pin):
letters = []
while pin > 0:
x = pin % 100
vowel = VOWELS[x % 5]
cons = CONSONANTS[x // 5]
pin = pin // 100
letters.extend((vowel, co... | true |
3a972ff963cecd0c8c40ed4a37d41c5295ef0bf9 | Python | gafurulkazi98/4x4-puzzle-solver | /ai_project1.py | UTF-8 | 13,465 | 3.25 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created By Gafurul (Rafi) Islam Kazi
For any recruiters looking through this,
please note that this version is neither finished nor optimized.
"""
import sys
"""
Currently considering using LinkedLists instead of normal lists to improve efficiency
"""
#class LinkedList():
# class No... | true |
91fe87319a2b4f56422c4b3737c15054a88d14f1 | Python | yinjoyin/AIS-Kalman-Filter | /test/calculate_test.py | UTF-8 | 579 | 3.21875 | 3 | [] | no_license | import unittest
import numpy as np
from matplotlib import pyplot as plt
from calculate import angle_between, rotate_vector
class TestCalculateMethods(unittest.TestCase):
def setUp(self):
pass
def test_angle_between(self):
v1 = np.array([0,1])
v2 = np.array([1,0])
assert(angl... | true |
df01dcde79cfadbdea0589ab9d9a2a0145687163 | Python | Aasthaengg/IBMdataset | /Python_codes/p03062/s282522343.py | UTF-8 | 283 | 3.234375 | 3 | [] | no_license | n = int(input())
alst = list(map(int, input().split()))
minus = 0
for num in alst:
if num < 0:
minus += 1
blst = [abs(num) for num in alst]
blst.sort()
if 0 in alst:
print(sum(blst))
elif minus % 2 == 0:
print(sum(blst))
else:
print(sum(blst[1:]) - blst[0]) | true |
a38a6f59467481385a11ff92549fc5160f74aa89 | Python | IlyaLaska/Branch-Bound-for-Term-Deviation-Minimisation | /Branch&Bound.py | UTF-8 | 5,933 | 2.984375 | 3 | [] | no_license | #DONE#implement test (> task)
#DONE#implement cut off (same pasth, diff weight)
#Read from file maybe
import sys
import math
import json
sampleTasks = [ {'l':5, 'D':30, 'a':8, 'b':2},
{'l':13, 'D':19, 'a':3, 'b':2},
{'l':17, 'D':11, 'a':10, 'b':4},
{'l':3, 'D':27, '... | true |