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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ccf94911c41d7933b2faa53461cd5488031d87b9 | Python | felipesfpaula/ufrgs2017 | /data/tocsv.py | UTF-8 | 922 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import pickle
import csv
testing = open('testing_dataset.pickle', 'rb')
training = open('training_dataset.pickle', 'rb')
test = pickle.load(testing)
train = pickle.load(training)
def toCSV(file_name,data_pickle):
with open('%s.csv' % file_name,'w') as testingcsv:
... | true |
7631fa16b852b4dc89bc74a3dc68addfa9dbc2ec | Python | DariaMachado/Algoritmos_Python | /combustivel.py | UTF-8 | 515 | 3.84375 | 4 | [
"MIT"
] | permissive | alcool: int; gasolina: int; diesel: int; codigo: int
codigo = int(input("Informe um codigo (1, 2, 3) ou 4 para parar: "))
alcool = 0
gasolina = 0
diesel = 0
while codigo != 4:
if codigo == 1:
alcool = alcool + 1
elif codigo == 2:
gasolina = gasolina + 1
elif codigo == 3:
diesel = ... | true |
244493f8cbf25b91d09c4f8dad93ec9fd4d3b721 | Python | devansh-299/AUGSD-Course-Management | /augsdapp/models.py | UTF-8 | 1,806 | 2.5625 | 3 | [] | no_license | from django.db import models
from django.conf import settings
from django.contrib.auth.models import User
class Course(models.Model):
courseCode = models.CharField(max_length=10, unique=True)
courseName = models.CharField(max_length=100)
midsemDateTime = models.DateTimeField(unique=True)
compreDateTim... | true |
128789bd2e9999c595a84e45d7a71f504e75ca16 | Python | whoiszyc/SDCWorks | /src/simulator/operations.py | UTF-8 | 367 | 3.5625 | 4 | [] | no_license | class Operations(dict):
def __init__(self, op_list):
for op in op_list:
op = Operation(*op)
self[op.name] = op
class Operation:
def __init__(self, name, duration):
self.name = name
self.duration = duration
def __str__(self):
s = "Operation: (%s, %d)"... | true |
9ce8342711b9fddfe8741f934423d5a5f75d29de | Python | Leeviiii/Leetcode | /sourcecode/MedianofTwoSortedArrays.py | UTF-8 | 862 | 3.21875 | 3 | [] | no_license | #! usr/bin/python
#coding=utf-8
class Solution(object):
def findMedianSortedArrays(self, nums1, nums2):
k = len(nums1) + len(nums2)
if k%2== 1:
m = self.binaryseach(nums1,nums2,k/2 + 1)
else:
b = self.binaryseach(nums1,nums2,k/2)
s = self.binaryseach(nums1,nums2,k/2+1)
m = (b+s)/2.0
return m
def ... | true |
136457c0ae8d405340652357aef06b2bc6119b5f | Python | 13U1U/URI_PROBLEMS | /1010_Cálculo_Simples.py | UTF-8 | 173 | 3.21875 | 3 | [] | no_license | a1, b1, c1 = map(float, input().split())
a2, b2, c2 = map(float, input().split())
pag = float((b1*c1)+(b2*c2))
print(f"VALOR A PAGAR: R$ {pag:.2f}")
#0.039 / 27.05.2021 / 1
| true |
21f118fc46fbeeabe4f3335f9c45cc1b05bbf089 | Python | lesanpi/daft-punk-python | /main.py | UTF-8 | 6,617 | 2.921875 | 3 | [] | no_license | from __future__ import print_function, unicode_literals
from discografia_daft_punk import *
# Para intalar las librerias de colores y titulos cools
import subprocess
import sys
def install(package):
subprocess.check_call([sys.executable, "-m", "pip", "install", package])
# Instalacion
install("clint") # Colore... | true |
9578fd11bfc9bab910fdcd1b70ede37901283d86 | Python | nadavofir/IGVC2013 | /filters/src/LowPassFilter.py | UTF-8 | 255 | 2.828125 | 3 | [] | no_license | class LowPassFilter:
def __init__(self, alpha=.5, initval=0.0):
self.alpha = alpha
self.val = initval
def update(self, newval):
res = self.alpha*newval + (1 - self.alpha)*self.val
self.val = res
return res
| true |
a1296caf2a750a600d1ccdf8a012bb2b498933d6 | Python | lucas4dev/first-repository | /URI/URI1009.py | UTF-8 | 179 | 3.484375 | 3 | [] | no_license | nome = input()
salariomensal = float(input())
vendas = float(input())
bonus = vendas * (15/100)
salariototal = salariomensal + bonus
print(f'TOTAL = R$ {salariototal:.2f}') | true |
7003e46988826e54a392c0f0b97e09a7211dd815 | Python | ggroshansii/100-Python-Projects | /TipCalculator/2-TipCalculator.py | UTF-8 | 581 | 4.5 | 4 | [] | no_license | #Tip calculator that accepts a bill total, adds tip, then divides based on group size
total = float(input("What was the total bill? "))
group_size = int(input("How many people to split the bill? "))
tip = float(input("What percentage tip would you like to give? 15, 20 or 25? "))
if tip == 15:
final_amount = total... | true |
c9e61f174359c801a34667b0fe2a6c2b8c83f895 | Python | frclasso/python-dev-27 | /biblioteca-padrao/zip.py | UTF-8 | 455 | 3.609375 | 4 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
""" Gravando texto em um arquivo compactado"""
import zipfile
texto = """
*********************************************************
Esse texto sera compactado e guardado em um arquivo zip.
*********************************************************
"""
#cria um nov arquivo zi... | true |
4a1a03116d5dcb8cc589864fd03fdd3367d6cf02 | Python | VinuthnaGummadi/Python | /PhytonProject/Assignment3/Source/tupleSort.py | UTF-8 | 494 | 4.28125 | 4 | [] | no_license | # This program sorts tuple in increasing order
import operator
new_list = [(1, 6), (1, 7), (4, 5), (2, 2), (1, 3)]
#function to validate if input is list
def validate(lst):
if isinstance(lst,list):
return True
else:
return False
if(validate(new_list)):
#sorting using lambda
print(sorte... | true |
e209867c563a595bccdf6c63749f2a0d6eb45cda | Python | kaichogami/wavenet | /train.py | UTF-8 | 2,678 | 2.890625 | 3 | [
"MIT"
] | permissive | """This model uses floyd cloud computers to train. Works only on the dataset
available in http://opihi.cs.uvic.ca/sound/genres.tar.gz
To run this module using floyd
* first extract the contents of the data set and store it in /output/music by
running a extracting tarball script.
```floyd run "download_extract... | true |
062b2becdf3ac215566a5b0602da93424c906a47 | Python | messa/ow2 | /http_check_agent/overwatch_http_check_agent/util/logging.py | UTF-8 | 1,609 | 2.609375 | 3 | [
"MIT"
] | permissive | from contextlib import contextmanager
from contextvars import ContextVar
from logging import Formatter
from logging import getLogger as _getLogger
default_format = '%(asctime)s [%(process)d] %(name)-20s %(levelname)5s: %(message)s'
log_context = ContextVar('log_context', default='')
@contextmanager
def add_log_con... | true |
77803192eb489aba121862fdf7f8cf91883d7df9 | Python | MinhTamPhan/ml-coursera-python-assignments | /Exercise1/exercise_muti.py | UTF-8 | 7,162 | 3.765625 | 4 | [] | no_license | # used for manipulating directory paths
import os
# Scientific and vector computation for python
import numpy as np
# Plotting library
from matplotlib import pyplot
# Load data
data = np.loadtxt(os.path.join('Data', 'ex1data2.txt'), delimiter=',')
X = data[:, :2] # X1 = house sizes, X2 = number of bedrooms
y = dat... | true |
3c879cd0c2009f44979be5076bec9c944685a6d1 | Python | chw177/Computational-Stat-Mech | /Chapter 4/canonic-recursion.py | UTF-8 | 222 | 2.78125 | 3 | [
"MIT"
] | permissive | import math
def z(k, Beta): return (1/(1-math.exp(-k*Beta)))**3
def canonic_recursion(N, Beta):
Z=[1]+[0]*N
for M in range(1, N+1): Z[M]=sum([z(k, Beta)*Z[M-k] for k in range(1, M+1)])/M
return Z[-1]
| true |
2e98356df6db52fadb611f953236ef3dd29e0872 | Python | Furetur/audio-editor | /app/joinwindow.py | UTF-8 | 344 | 2.703125 | 3 | [] | no_license | from actionwindow import ActionWindow
from track import Track, JoinedTrack
class JoinWindow(ActionWindow):
def __init__(self, master):
super().__init__(master, 2)
def calculate_result(self) -> Track:
track1 = self.selected_tracks[0]
track2 = self.selected_tracks[1]
return Join... | true |
2c7205bb89ecf062587f7337fa82a777fbc51f72 | Python | alexDorni/Web-Content-Classifier | /crawler_exe.py | UTF-8 | 850 | 3.109375 | 3 | [] | no_license | import argparse
from crawler.crawler import *
def main(args):
try:
with open(args.links_file, 'r') as f:
lines = f.read().splitlines()
for line in lines:
crawler = Crawler(home_page=line,
nr_threads=args.nr_threads)
crawler.create_... | true |
487a3a35c7da922a22857a3221523eca4b6f61ee | Python | FrogBomb/SpaceGame | /Tom Branch/Game/augmentFunctions.py | UTF-8 | 4,443 | 3.71875 | 4 | [
"Apache-2.0"
] | permissive | ##The augment functions work by a decorator patern.
##augmentFunction is a blank augment function
class augmentFunction:
def __init__(self, value=0):
self._value = value
self._prevVals = None
def effectFighter(self, fighter):
return
def rmEffect(self, fighter):
return
##The c... | true |
5299bfb2a49b88eb71d414665858ca2cbce55812 | Python | serialoman2k17/CTF | /Di in num.py | UTF-8 | 126 | 3.53125 | 4 | [] | no_license | def Digit_in_number(n, a):
c = n.count(a)
print(c)
Digit_in_number(input("Enter number: "), input("Enter digit: "))
| true |
794b8dd163a1be058e613a491c0020a18b288ded | Python | Leap-Tribe-I/backend | /src/DataCleaningEncoding.py | UTF-8 | 1,438 | 3.078125 | 3 | [] | no_license | # importing modules
from sklearn import preprocessing
def dce(data):
DataCleaning(data)
DataEncoding(data)
return data
def DataCleaning(data):
# data Cleaning
# total = data.isnull().sum()
# precentage = (total/len(data))*100
# missing_data = pd.concat([total, precentage], axis=1, keys=['T... | true |
62980f4bdd4366cfcc709f29d761dc83aeedfbdf | Python | Cloud-Atlas-BR/CloudAtlas | /CloudAtlas/DadosAbertos.py | UTF-8 | 1,895 | 2.890625 | 3 | [
"MIT"
] | permissive | import json
import requests
import xmltodict
def create_query(parameters):
args = dict((k, v) for k, v in parameters.items() if v is not None)
query = '&'.join("%s=%s" % (str(k), str(v)) for (k, v) in args.items())
return query
class CamaraFederal():
def __init__(self):
self.version = "v2"
... | true |
ba0b2653180a7badc1a6d8735955f5490528189e | Python | sxjscience/autogluon | /examples/tabular/distill/example_distill_multiclass.py | UTF-8 | 3,436 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | """ Example: distilling AutoGluon's ensemble-predictor into a single model for multiclass classification.
NOTE: To distill CatBoost models in multiclass classification, you need to first run: pip install catboost-dev
"""
import os
from autogluon.tabular import TabularPrediction as task
from autogluon.tabular.utils ... | true |
2d35f0b1c1c1f49ab56a5544b564fe9df34d185a | Python | acids-ircam/lottery_generative | /code/model.py | UTF-8 | 31,322 | 2.625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
####################
# Models definition
# Defines basic models and how wrappers should behave
# author : Philippe Esling
<esling@ircam.fr>
####################
"""
import torch
import torch.nn as nn
import numpy as np
import mir_eval
from models.vae.ae import AE
from ... | true |
f7c8cffc1cf387d5ef86ba984f0b8b233520d6d0 | Python | pokhym/python-course-udemy | /Section6_ProgramFlowControlInPython/30_challenge_if_else.py | UTF-8 | 583 | 4.15625 | 4 | [] | no_license | # write a small program to ask for a name and an age
# wen both values have been entered, check if the person
# is the right age to go on an 18-30 holidya (they must be over 18 and under 31).
# if they are welcome them to the holidy, otherwise print a polite message refusing them entry
# get input
name=input("Enter y... | true |
4d3e686c5ca14502d6846d0f592efae1aaece76b | Python | calgagi/leetcode | /0309/my_understanding_ans.py | UTF-8 | 446 | 3 | 3 | [] | no_license | class Solution:
def maxProfit(self, prices: List[int]) -> int:
if len(prices) < 2:
return 0
buy, sell, rest = [-prices[0]], [0], [0]
for i in range(1, len(prices)):
buy.append(max(buy[i-1], rest[i-1]-prices[i]))
sell.append(max(sell[i-1], buy[i-1]+prices[i... | true |
ebb63244c32e0c951c55891309db8094582df19c | Python | huileizhan227/untitled | /learn/study_logging/test_logging.py | UTF-8 | 791 | 2.6875 | 3 | [] | no_license | #!/user/bin/env pythone2.7
#! -*- coding:utf-8 -*-
#! @Time : 2018/11/2 16:52
#! @Auther : Yu Kunjiang
#! @File : test_logging.py
import logging
import logging.config
'''
日志文件保存所有 debug 及其以上级别的日志,每条日志中要有打印日志的时间,日志的级别和日志的内容
'''
# # 方法一:利用logging.basicConfig来配置
# logging.basicConfig(
# level= logging.DEBUG,
# form... | true |
ebda6ad003dfdb2d218fcc5733dfd5cbb6c94cd6 | Python | 5l1v3r1/HackingVarietyTools | /LDAP injection.py | UTF-8 | 511 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | import requests
url = 'http://178.128.35.180:30729/login'
flag =[]
def brutePsw():
startChar, endChar = 40, 125
while startChar <= endChar:
password = ''.join(flag)
creds = {'username':'reese','password':password + chr(startChar)+'*'}
login = requests.post(url=url, data=creds)
if... | true |
5879e7e980409ef01f35f576928c6ba2c2c70331 | Python | rogers228/Learn_python | /note/module/07_pandas_資料結構/dataframe_to_recoeds(list fo jinja2).py | UTF-8 | 1,673 | 2.515625 | 3 | [] | no_license | dataframe_to_recoeds(list fo jinja2)
print(df)
'''
wk01 wk02 wk03 wk04 wk05
0 1 液壓機械 Hydraulic Mechanical 液壓机械 10
1 2 液壓站 Power unit 液壓箱 20
2 7 工具機選配 Machine tool equipment 工具机選配 25
3 3 油壓泵浦 Hydraulic Pump 泵浦 30
4 ... | true |
bf2608c6b23dd60c8194487769276c95fb4a44dd | Python | laowantong/paroxython | /examples/idioms/programs/122.1453-declare-enumeration.py | UTF-8 | 398 | 2.5625 | 3 | [
"MIT"
] | permissive | """Declare enumeration.
Create an enumerated type _Suit with 4 possible values _SPADES, _HEARTS, _DIAMONDS, _CLUBS.
Source: programming-idioms.org
"""
# Implementation author: TinyFawks
# Created on 2016-02-18T16:58:03.828361Z
# Last modified on 2016-02-18T16:58:03.828361Z
# Version 1
# Fake enum, works with any ve... | true |
174b582dc5f0f98157880193572d2c01450377aa | Python | llotz/ipdeny_downloader | /ipdeny_download.py | UTF-8 | 441 | 2.5625 | 3 | [] | no_license | import requests
f = open('countries.txt', 'r')
ips = "";
for country in f:
code = country.replace('\n', '')
url = 'https://www.ipdeny.com/ipblocks/data/countries/'+code+'.zone'
print('downloading '+ code + ': ' + url)
x = requests.get(url)
print('downloaded '+str(len(x.text.split('\n')))+' ips')
ips += x.text
... | true |
2ddd380c854529f75cd8432ed12ab89afe4034dd | Python | awesome-liuxiao/leetcodesolution | /1108_defangingIP.py | UTF-8 | 323 | 2.96875 | 3 | [] | no_license | class Solution:
def defangIPaddr(self, address: str) -> str:
if address == "":
return address
address = address.replace(".", "[.]")
# print(address)
return address
x = Solution()
address = "1.1.1.1"
x.defangIPaddr(address)
address = "255.100.50.0"
x.defangIPaddr(addre... | true |
798cea9db3b065fb3e5d3c2f4123ef3ce45ac23a | Python | eriac/SRS002_library | /GuiModule.py | UTF-8 | 3,707 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf8 -*-
## @package GuiModule
# class for GUI
# @date 2016/9/15
# @version 0.1
import sys
import Tkinter
import math
import time
import threading
## Class for GUI
# @code{.py}
#link0=SerialLink()
#gui.mainloop()
#sys.exit()
# @endcode
class GuiModule:
def __init__(self):
se... | true |
df58b6d3741a0a111ec6257f277edb3d605c3781 | Python | Mrzhou93/BlockChain | /BlockChain.py | UTF-8 | 2,408 | 3.25 | 3 | [] | no_license | # -*- encoding=utf-8 -*-
# -*- Author:Bill_zzq -*-
# -*- Environment: python 2.7 -*-
# -*- Sofeware: PyCharm -*-
# -*- Data: 2018/01/08
import hashlib
import uuid
import time
class Block(object):
def __init__(self, timestamp=time.time(), data=None, previousHash=None, nonce=0):
# 生成一个唯一的ID
self.in... | true |
1396ed21e8c086e77c57ac7c7061f0981caf4b52 | Python | zeynaloruccodeacademy/evtapsirigi-11-13-2021 | /duzbucaqli sahe proqrami.py | UTF-8 | 180 | 2.65625 | 3 | [] | no_license | a=int(input("Duzbucaqlinin enini daxil edin:"))
b=int(input("Duzbucaqlinin uzunlughunu daxil edin:"))
perimetr=2*a+2*b
sahe=a*b
print('Perimetr:',perimetr,"Sahe:",sahe)
#Zeynal Mansimov Al Hanafi
| true |
35fbc73ba8728f4076974f9c692df853e838069a | Python | ljm516/python-repo | /cobweb/charpter3/urllibLibrary.py | UTF-8 | 281 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | import urllib.error
try:
import urllib.request
urllib.request.urlopen('http://blog.csdn.net.ccc')
except urllib.error.HTTPError as e:
print('HTTPError')
print(e.code)
print(e.reason)
except urllib.error.URLError as e:
print('URLError')
print(e.reason)
| true |
ebff0d93056ab5e01c007a669f9fe7c77d5658f7 | Python | LoinJi/Multifunctional-beauty-software | /Multifunctional beauty software/data/repair_h.py | UTF-8 | 1,662 | 2.65625 | 3 | [] | no_license | import cv2
import numpy as np
def do_remove(img, h_start, h_end, w_start, w_end):
# 开始操作
copy_img = img[h_start:h_end, w_start:w_end]
num = 0
for i in copy_img:
if [255, 255, 255] in i:
num = num+1
if num < 0:
return img
thresh = cv2.inRange(copy_im... | true |
5a30634e58c5488acacaacc1f050ba6fca7d74d7 | Python | pycogent/pycogent | /tests/test_maths/test_stats/test_alpha_diversity.py | UTF-8 | 10,726 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python
#file test_alpha_diversity.py
from __future__ import division
from numpy import array, log, sqrt, exp
from math import e
from cogent.util.unit_test import TestCase, main
from cogent.maths.stats.alpha_diversity import expand_counts, counts, observed_species, singles, \
doubles, osd, margalef, m... | true |
e2b2d2fc5b5659b7482cf89f4c8ee6461c1d90ea | Python | wefner/slacksound | /slacksound/spotifyclient.py | UTF-8 | 8,771 | 2.59375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: spotifyclient.py
#
# Copyright 2017 Oriol Fabregas
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including wit... | true |
4018daaecda64527353b4a27767dbb14e7eb6e07 | Python | Anthys/Polytechnike | /2021/pizza/c.py | UTF-8 | 433 | 2.59375 | 3 | [] | no_license | def generate_arbre(registre):
if len(registre) == 2:
tree1 = AMB(None, H(transaction2txt(registre[0])), None)
tree2 = AMB(None, H(transaction2txt(registre[1])), None)
else:
r1 = registre[:len(registre)//2]
r2 = registre[:len(registre)//2+1]
tree1 = generate_arbre(r1)
... | true |
190fd041d1f0d6049420e3f94fc8104a32cb9e1f | Python | anfinogenov/hostcheker_bot | /telegram_bot.py | UTF-8 | 2,082 | 2.8125 | 3 | [
"MIT"
] | permissive | import json
import time
import util
import requests
class TelegramBot:
VERSION = "0.2d"
CONNECTION_LOST_TIMEOUT = 60
def __init__(self, token, proxies=None):
print("Telegram Bot API-class {}. © Maxim Anfinogenov, 2017-2018".format(self.VERSION))
self.token = token
self.url = "http... | true |
8e5b2c87abb506b00b39b90408dd1d9f1ece1acf | Python | SuperOmario/exercises | /classExercise1.py | UTF-8 | 1,898 | 5.15625 | 5 | [] | no_license | # strings
str()
# intergers
int()
# floats
float()
# print function, this prints hallo world
print('hello world')
# variables
hello = 'hello'
world = 'world'
print(hello, world)
print('I am printing ', hello, world, '!')
# or
# use placeholders
# this might look more complicated then it actually is but when stri... | true |
ea0a21fd54f413362c8a6cc85aed09221e2fd09c | Python | hoyeongkwak/workspace | /python/pythonCoding/day2/04_숫자찾기.py | UTF-8 | 658 | 3.40625 | 3 | [] | no_license | '''
입력
7
2 4 9 10 14 23 32
3
6 23 9
출력
0
6
3
'''
import sys
def Input_Data():
readl = sys.stdin.readline
N = int(readl())
data = [0] + list(map(int,readl().split()))
T = int(readl())
num = list(map(int,readl().split()))
return N, data, T, num
def BS(list_data, s, e, d):
while s <= e:
... | true |
c92e5c4754e772f654ead929bac11cdc92c5af03 | Python | ThaoNguyen15/AIND-Recognizer | /parse_lm_data.py | UTF-8 | 1,727 | 2.5625 | 3 | [] | no_license | from os.path import join
import json
def parse():
with open(join('data', 'ukn.3.lm'), 'r') as f:
while True:
l = f.readline()
if not l:
break
if l.strip() == "\data\\":
# read the next 3 lines
ngram_counts = []
... | true |
ab723601823c660ecf517940310c969999cd84ae | Python | IsadoraRochaB/lp2.4 | /a1b2/Quest4.py | UTF-8 | 1,764 | 2.671875 | 3 | [] | no_license | dic = {'UUU':'Fenil-alanina', 'UUC':'Fenil-alanina',
'UUA':'Leucina', 'UUG':'Leucina','CUU':'Leucina', 'CUC':'Leucina','CUA':'Leucina', 'CUG':'Leucina',
'AUU':'Isoleucina', 'AUC':'Isoleucina','AUA':'Isoleucina','AUG':'metionina - start codon',
'GUU':'Valina', 'GUG':'Valina','GUA':'Valina', 'GUC':'Valina',
'UCU':'Se... | true |
f225bea66bbb1d576c54056eb852c801e04908cc | Python | chris3will/Python-Javascript | /floyd算法.py | UTF-8 | 1,248 | 3.125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Apr 20 12:53:45 2019
@author: Chris
"""
import sys
import numpy as np
#输入权矩阵
#计算每个位置权值的变化
#n维矩阵n词迭代后dij即为所求
'''
a=np.array([
[0,20,100000,100000,15,100000],
[20,0,20,60,25,100000],
[100000,20,0,30,18,100000],
[100000,60,30,0,1... | true |
7bf8692181f12dc6dcb881a84a5b3c03bb9caae0 | Python | hamzamunir745/python_pptx_interface | /pptx_tools/templates.py | UTF-8 | 5,396 | 2.875 | 3 | [
"MIT"
] | permissive | """
This file contains variables with names of important pptx template master_slide shapes
"""
from datetime import datetime
import pkg_resources
# from pptx.enum.text import MSO_AUTO_SIZE
from pptx import Presentation
from pptx_tools.better_abc import ABCMeta, abstract_attribute
from pptx_tools.utils import change_p... | true |
0d845971d1e8ae07cf60404dc6a922f2e60754e1 | Python | elenavoinu/Python-Projects | /792_voinu.py | UTF-8 | 726 | 4.1875 | 4 | [] | no_license | #Elena Voinu
#Write multiple if statements. If car_year is 1969 or earlier, print "Few safety features.".
#If 1970 or later, print "Probably has seat belts.".
#If 1990 or later, print "Probably has antilock brakes.".
#If 2000 or later, print "Probably has airbags."
#End each phrase with a period and a newline.
#Ex... | true |
85f58a8ca5f827f8fe878b760e64aa656c26e5ac | Python | raunakchowdhury/stuy-ai | /assignments/day07/ratio.py | UTF-8 | 3,656 | 3.609375 | 4 | [] | no_license | import matplotlib.pyplot as plt
all_words = set()
# Gets all of the words that are the same length as those in the input file
f = open("dictall.txt","r")
for line in f:
all_words.add(line[:-1])
f.close()
def vowel_const_ratio(word, y_enabled=False):
# Takes in a word and returns the number of vowels divided ... | true |
f8bd6fc2e40f0e69e268179ed5422b969c12ee7f | Python | Manocaio23/Sistema-Python | /Sistema.py | UTF-8 | 681 | 3.015625 | 3 | [] | no_license | from lib.interface import *
from lib.arquivo import*
from time import sleep
arq='Manocaio.txt'
if not arquivoExiste(arq):
criarArquivo(arq)
while True:
resposta=menu(['Ver Pessoas cadastradas','Cadastrar nova pessoa','sair'])
if resposta==1:
#Opção para lsitar o conteúdo
lerArquivo(arq)... | true |
fd84cca5d156bfaa0c7fa0d1d1d4dce6a9fc2981 | Python | geeekpi/rpico | /Pico_PWM_demo_main.py | UTF-8 | 482 | 2.8125 | 3 | [
"MIT"
] | permissive | import time
from machine import Pin, PWM
from random import randint
pwm = PWM(Pin(1))
pwm.freq(1000)
duty = 0
direct = 1
notes = [262, 294, 330, 349, 392, 440, 494]
while True:
freq = notes[randint(0, 6)]
pwm.freq(freq)
for _ in range(8*256):
duty += direct
if duty > 255:
... | true |
f55f42ff97864dffcea9244941ddfbeb6cec53c6 | Python | joehowells/critical-keep | /src/ecs/components/combatcomponent.py | UTF-8 | 492 | 2.6875 | 3 | [
"MIT"
] | permissive | class CombatComponent:
def __init__(self, max_hp, attack_stat, defend_stat, hit_stat, critical_stat):
self.max_hp = max_hp
self.cur_hp = max_hp
self.attack_stat = attack_stat
self.defend_stat = defend_stat
self.hit_stat = hit_stat
self.critical_stat = critical_stat
... | true |
4f1a651f9698ca785d705f5755ff7e986c2c7666 | Python | dblotsky/stringfuzz_website | /bin/make_date.py | UTF-8 | 597 | 3.015625 | 3 | [] | no_license | import sys
import re
date_pattern = r'(?P<year>\d\d\d\d)-(?P<month>\d\d)-(?P<day>\d\d)'
time_pattern = (
r'from-' +
r'(?P<from_hour>\d\d)h(?P<from_minute>\d\d)m(?P<from_second>\d\d)s' +
r'-to-' +
r'(?P<to_hour>\d\d)h(?P<to_minute>\d\d)m(?P<to_second>\d\d)s'
)
name_pattern = r'.*' + date_pattern + r'-' ... | true |
3fd068e92b0593b1cb67cce3f196188142ced4e5 | Python | kasia-jablonski/Data-Visualization-with-Bokeh | /stage1_2.py | UTF-8 | 250 | 2.75 | 3 | [] | no_license | from bokeh.io import output_file, show
from bokeh.plotting import figure
output_file('test.html')
plot = figure(plot_width=600, plot_height=600, tools='pan, box_zoom, reset')
plot.square(x=[1, 2, 4, 8, 10], y=[6, 2, 18, 4, 9], size=20)
show(plot) | true |
74598b045a9854c639b8739aa7dcc7e59090cf3f | Python | waitingFat/pythonNotes | /recursivelyDir.py | UTF-8 | 724 | 3.109375 | 3 | [] | no_license | import os
from stat import S_ISDIR, S_ISREG
import sys
def dirTree(top, callback):
if not os.path.exists(top):
print "---isexist-----"
return
else:
listdir = os.listdir(top)
for f in listdir:
mode = os.stat(os.path.join(top, f)).st_mode
... | true |
12c5f08cf22869b3fdc7db36c1bd0801e2d36814 | Python | hanameee/Algorithm | /KUCC_Algorithm_Study/week1/2473.py | UTF-8 | 791 | 3.203125 | 3 | [] | no_license | import sys
input = sys.stdin.readline
n = int(input())
data = list(map(int, input().split()))
data.sort()
min_combination = []
min_sum = 5e9
def compare(cur_v, old_v):
if abs(cur_v) < abs(old_v):
return True
else:
return False
for i in range(0, n-2):
j = i+1
k = n-1
while j < k... | true |
0a1fbed740691e6e66c7e1da11e932749a3082b9 | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2651/60661/236185.py | UTF-8 | 473 | 2.8125 | 3 | [] | no_license |
t = int(input())
for i in range(t):
n=int(input())
b='0'+str(bin(n)[2:])
length=len(b)
changed=False
for i in range(length):
if b[length-i-1]=='1' and changed==False:
if (i+1)%2==1:
b=b[:length-i-2]+b[length-i-1]+b[length-i-2]+b[length-i:]
else:
... | true |
a9910be776600c0444155ae515866fe1ae26d48d | Python | bowen903/python_study | /python_study_084.py | UTF-8 | 698 | 3.375 | 3 | [] | no_license | # -*- coding:utf-8 -*-
"""
@author:Xiaoping
@file:python_study_084.py
@time:2017/8/22 17:23
"""
# 动态规划算法解决 最长公共子串
def main(s1, s2):
m = [[0 for i in range(len(s2) + 1)] for j in range(len(s1) + 1)]
# 生成0矩阵,为方便后续计算,比字符串长度多了一列
res = 0
for i in range(len(s1)):
for j in range(len(s2)):
... | true |
db359ed5f11423a96482f947f91fdd85f632f66d | Python | UzakbaevRauan/python | /Python Booleans Ex 4.py | UTF-8 | 55 | 3.171875 | 3 | [] | no_license | x = "Hello"
y = 15
print(bool(x))
print(bool(y))
| true |
22af15de24b1de19860416179d3b7d1ededaea99 | Python | nhoening/battery-heuristics | /tests/astreet.py | UTF-8 | 2,027 | 2.75 | 3 | [] | no_license | from __future__ import division
import unittest
import sys
sys.path.append('..')
from street import Street
class StreetTest(unittest.TestCase):
def setUp(self):
pass
def test_f(self):
'''
'''
cases = {}
# Each case: t, N, Dmax, Smax, c_h, adaptive, slope, placement... | true |
ec720d0c1be04c1fb883deb88d22995bbd3b1b2b | Python | dp1608/python | /PythonGIS/Python空间数据处理期中作业/Qizhong0413.py | UTF-8 | 3,513 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @StartTime : 2017/4/13 16:17
# @EndTime : 2017/4/15 13:30
# @Author : Andy
# @File : Qizhong0413.py
# @Software : PyCharm
# 1. 请写一个程序,利用第二章的stations.shp点文件生成一个TIN三角网,并存为Shape文件。目的:巩固OGR矢量文件读写知识,自学scipy.spatial模块的Delaunay类。
# 提交要求:Python源码、Matplotlib生成的结果图片。
from osgeo import ogr
f... | true |
2b98ebd4fbbba3edf122828606b6e823d2a18726 | Python | zh-wang/leetcode | /solutions/0131_Palindrome_Partitioning/dfs_with_memo.py | UTF-8 | 785 | 2.953125 | 3 | [] | no_license | class Solution:
def partition(self, s: str) -> List[List[str]]:
n = len(s)
if n == 0:
return [[]]
self.ret = []
memo = [[False for _ in range(n)] for _ in range(n)]
self.dfs(s, memo, 0, [])
return self.ret
def dfs(self, s, memo, i, par):
if i ... | true |
0a789920adf635bedc76c767d605babb979bb8f0 | Python | malikabr/-Naive | /normalization-and-sentence tokenization.py | UTF-8 | 1,323 | 3.265625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#this file does sentence tokenize
from hazm import sent_tokenize
from hazm import Normalizer
def readData(fileName):
file = open(fileName, 'r')
data = file.read().split(u".")
sample_set = []
for sample in data:
if sample.__len__() >... | true |
04366e1bd953acce717f5f729caf33d3ec8e6d4e | Python | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/gigasecond/9a5eb200eee54feb8e8fe283401566c8.py | UTF-8 | 315 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
# coding=utf-8
"""
Gigasecond coding exercism exercise
"""
from datetime import timedelta
def add_gigasecond(begin_date):
"""
Under Construction
@param begin_date:
@return:
"""
return begin_date + timedelta(seconds=1000000000)
if __name__ == '__main__':
pass
| true |
3c0e29c7f9cb879f7106208b8dd59db1e552c51d | Python | yinkn/iam_plus | /NNServer/src/util.py | UTF-8 | 346 | 3.03125 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-public-domain"
] | permissive |
import time
def str_to_dict(str):
pass
def dict_to_str(key_value={}):
kv_str = ""
for k in key_value.keys():
kv_str = "{0}={1},".format(k,key_value[k])
return kv_str.strip(",")
def time_to_str(secs=None):
"Exapmle: 2017-12-02 08:05:39 UTC"
return time.strftime("%Y-%m-%d %H:%M:%S... | true |
4eb191bb0dbc3235198ed3e58f4c1c4ba0a9528b | Python | Sinha-Ujjawal/LeetCode-Solutions | /StudyPlans/Data Structures/Data Structures 2/merge_intervals.py | UTF-8 | 829 | 3.375 | 3 | [
"MIT"
] | permissive | from typing import List, Optional, Tuple
Interval = Tuple[int, int]
def merge_interval(intx: Interval, inty: Interval) -> Optional[Interval]:
xs, xe = intx
ys, ye = inty
if xs <= ye and ys <= xe:
return min(xs, ys), max(xe, ye)
class Solution:
def merge(self, intervals: List[Interval]) -> L... | true |
40850f8f5d95b89c2aa07a650ddf6d08d2d4828d | Python | chromium/chromium | /native_client_sdk/src/build_tools/find_chrome.py | UTF-8 | 3,396 | 2.765625 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
# Copyright 2013 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A script to find a recently-built Chrome, in the likely places.
This script is used for automated testing, don't trust it for anything more
than that!"""
... | true |
96e9b4d1cf746707dde70cd44e18c0a4fdd5e1a5 | Python | YuZhaoQL/testtest | /work.py | UTF-8 | 1,506 | 2.671875 | 3 | [] | no_license | import pandas as pd
import numpy as np
import os
title=['name','ks','kq','zy','sy','ps']
dat1=pd.read_excel('2ks.xlsx')
dat2=pd.read_excel('2kq.xlsx')
dat3=pd.read_excel('2zy.xlsx')
dat4=pd.read_excel('2sy.xlsx')
# print(dat1.shape)
# print(dat2.shape)
# print(dat3.shape)
# print(dat4.shape)
print(dat1.columns.valu... | true |
436f5edd2ddaa3f13488838e8c37c4fb7414d6a4 | Python | slamavl/QChemTool | /QChemTool/QuantumChem/Classes/structure.py | UTF-8 | 81,694 | 2.609375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Wed Jul 20 15:12:49 2016
@author: uzivatel
"""
from copy import deepcopy
from scipy.spatial import cKDTree
import scipy
import numpy as np
import networkx as nx
from os import path
import matplotlib.pyplot as plt
from ..read_mine import read_xyz, read_VMD_pdb, ... | true |
a0c3d277d4e5f8f4c5fb1b3ddfb0720b38c7a221 | Python | paulross/pprune-calc | /A340-SBKP/analysis/plot_events.py | UTF-8 | 6,903 | 2.53125 | 3 | [
"MIT"
] | permissive | import collections
import typing
import numpy as np
from analysis import video_analysis
from analysis import video_data
from analysis import video_utils
from analysis.plot_common import get_gs_fits_corrected
from analysis.plot_svg import EVENTS_TIMED
def create_event_table_header() -> typing.List[str]:
return [... | true |
f1a11f72f60d9cb785dc27de293e2162308309a6 | Python | SofieneEnnaoui/tariffengineapi | /app/memory/__init__.py | UTF-8 | 1,823 | 3.34375 | 3 | [] | no_license | import abc
import redis
import pickle
import datetime
class MemoryInterface(metaclass=abc.ABCMeta):
"""
Memory Interface to support multiple data sources
Data structure has to be an equivalent of a dict {str -> str}
"""
@abc.abstractmethod
def set(self, key, value):
""" ... | true |
6a2d6b3545797fe26c74e8fb9d5ccb8af93b5033 | Python | kristiansantos11/datastructure-and-algorithms | /algorithms part 1/quick_union/WQUPC_canonical_element.py | UTF-8 | 2,131 | 3.21875 | 3 | [] | no_license | class QuickUnionUF:
def __init__(self, N):
self.N = N
self.node_id = [x for x in range(0, self.N)]
self.large = [x for x in range(0, self.N)]
self.sz = [x//self.N+1 for x in range(0, self.N)]
def root(self, i):
while (i != self.node_id[i]):
self.node... | true |
e8d1e4c21a13059bcec2d1b45f3acc686c403b50 | Python | Marius-Juston/Tensorflow_Tutorial | /Tensorflow components and Linear Regression/Tensors.py | UTF-8 | 385 | 3.25 | 3 | [] | no_license | # coding=utf-8
tensor0 = 3 # a rank 0 tensor; this is a scalar with shape []
tensor1 = [1., 2., 3.] # a rank 1 tensor; this is a vector with shape [3]; 1 dimensional array
tensor2 = [[1., 2., 3.], [4., 5., 6.]] # a rank 2 tensor; a matrix with shape [2, 3]; 2 dimensional array
tensor3 = [[[1., 2., 3.]], [[7., 8., 9.... | true |
dd2a9e5400e6ca8f3a99c974fe189b9f326d4651 | Python | HIPS/Kayak | /kayak/losses.py | UTF-8 | 1,892 | 2.625 | 3 | [
"MIT"
] | permissive | # Authors: Harvard Intelligent Probabilistic Systems (HIPS) Group
# http://hips.seas.harvard.edu
# Ryan Adams, David Duvenaud, Scott Linderman,
# Dougal Maclaurin, Jasper Snoek, and others
# Copyright 2014, The President and Fellows of Harvard University
# Distributed under an MIT license. Se... | true |
5d86e619a5e483a90eec6e49878c18ee40ac892e | Python | brow-joe/quotation-scraping | /src/main/python/br/com/jonathan/infrastructure/configuration/Configuration.py | UTF-8 | 1,171 | 2.515625 | 3 | [] | no_license | import yaml
import logging
from infrastructure.data.property.MongoDBProperty import MongoDBProperty
YML_PROPERTIES = 'src/main/resources/application.yml'
class AppConfiguration():
def __init__(self):
self.configure()
def __new__(cls, *args, **kwargs):
if not hasattr(cls, '_instance'):
... | true |
72f11bbbcf5f1c9ae4b20e672c8b4e4b23455c38 | Python | sreejithev/pythoncodes | /day4/classes/inheritance/5.py | UTF-8 | 480 | 3.515625 | 4 | [] | no_license | class account:
def __init__(self, balance = 0):
self.balance = balance
def deposit(self, amt):
self.balance += amt
def withdraw(self, amt):
self.balance += amt
def check_balance(self):
return self.balance
class limitedaccount(account):
def withdraw(self, amt):
if (self.balance - amt) < 0:
print 'balan... | true |
54a534a1ea33d6b24cf9a8e3ec36a2666d3d8a73 | Python | lsm4446/study_python | /Kwonhee/파이썬 데이터 분석 입문/csv/pandas_concat_rows_from_multiple_files.py | UTF-8 | 600 | 2.515625 | 3 | [
"BSD-2-Clause"
] | permissive | #!/usr/bin/env python3
import pandas as pd
import glob
import os
import sys
input_path = r"D:\OneDrive\Github\study_python\Kwonhee\파이썬 데이터 분석 입문\csv"
output_file = r"D:\OneDrive\Github\study_python\Kwonhee\파이썬 데이터 분석 입문\csv\pandas_output.csv"
all_files = glob.glob(os.path.join(input_path,'sales_*'))
all_data_frames ... | true |
e379b4300453f5ada345c71613eaafd6a4ab85d4 | Python | Gemma-Rate/clay | /gui_loading.py | UTF-8 | 903 | 3.109375 | 3 | [
"MIT"
] | permissive | import tkinter as tk
import log
import functools
class LoadScreen(tk.Tk):
"""
Loading screen for a function.
"""
def __init__(self, parent):
tk.Tk.__init__(self, parent)
self.parent = parent
"""
Set up label and image objects in the grid.
"""
self.maste... | true |
0c1709ff0e505ebd6463e004b133772742cde0c1 | Python | VINAY-KUMAR-MADDHESIA/DNA-to-mRNA | /test_4.py | UTF-8 | 1,648 | 2.578125 | 3 | [] | no_license | import pymysql
conn = pymysql.connect(host='localhost', user='root', passwd='', db='ecoli_database')
mycurser = conn.cursor()
mycurser.execute("""create table final_db (seq_num int,gen_desc varchar(50),atgc_length int,a_length int ,t_length int ,g_length int ,c_length int ,gc_per double,strand varchar(50),length int,pi... | true |
3141451e6b97a826b320f031509a447603a8ffe1 | Python | bmendez0428/Python-and-SQLite | /lab3Mendez.py | UTF-8 | 1,752 | 3.4375 | 3 | [] | no_license | #Brandon Mendez
#Lab 3
#Date 10/22/2018
#Due 11/5/2018
# Create an SQL table using data read from keyboard
from urllib.request import urlopen
import sqlite3
import sys
#reads/gets the currency exchange rates
target_currency = input("Enter target currency: ")
url = "http://facweb.cdm.depaul.edu/sjost/it212/rates.txt"
... | true |
22dee273c38895e49bf8ed5f491704b9e5faf510 | Python | ThomasRanvier/othello_bot | /python/move.py | UTF-8 | 1,100 | 4.1875 | 4 | [
"MIT"
] | permissive | class Move(object):
"""
This class represents a move in a game.
The move is simply represented by two integers: the x and the y where the player puts the marker and a
boolean to mark if it is a pass move or not.
In addition, the Move has a field where the estimated value of the move can be s... | true |
cc6af19af631fea4cf80586fcd5ba9f54052c41d | Python | woodward4422/InterviewPrep | /yelpprep/list_comprehensions.py | UTF-8 | 426 | 3.6875 | 4 | [] | no_license | # This is a practice for list comprehensions on HackerRank
# Given values for the dimension of a cuboid X,Y,Z find all the values of the vertexes such that x + y + z != N, which is another number inputted
import sys
a = int(sys.argv[1])
b = int(sys.argv[2])
c = int(sys.argv[3])
n = int(sys.argv[4])
coordinates = [[... | true |
298f0b84b0022b504fb8773bbe5850066d13507e | Python | nielslerches/sample | /utilities.py | UTF-8 | 2,757 | 3.375 | 3 | [] | no_license | """
utilities.py - Unisport Sample webservice
In general, the se utilities are made with functional programming in mind.
I emphasize the functional programming part, because it provides a streamlined
way of bringing reproducibility which is good in general for any product,
and for unit testing.
The pydoc styl... | true |
8c8e58081afe39acb1baa4b48e2822168c1e7857 | Python | dhiegobroetto/trab1-ia | /genetic.py | UTF-8 | 8,888 | 3.109375 | 3 | [] | no_license | # ----- Dhiego Santos Broetto ----- #
# ---------- 2016204404 ----------- #
from random import shuffle
import math
import random
import timeit
from csv import DictWriter
from collections import defaultdict
def getValueState(VT, states) :
total_value = 0
for i in range(0, len(states)) :
total_value += ... | true |
5b1851aa96bd40647a299aa949922ed758941d6b | Python | AlexeyVatolin/lightning-flash | /flash/core/data/datapipeline.py | UTF-8 | 3,292 | 2.890625 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-proprietary-license"
] | permissive | # Copyright The PyTorch Lightning team.
#
# 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 i... | true |
7527e77cb15f5cce96cf9b5183f5d310295840c1 | Python | hackerDEpandas/HackerrankAlgos | /warmups/digDif.py | UTF-8 | 569 | 3.734375 | 4 | [] | no_license | N = input() # defines a NxN matrix
num = 0 # initialize num to 0
digOne = [] # create an empty array for the first diagonal
digTwo = [] # create an empty array for the second diagonal
for i in range(N):
row = map(int, raw_input().split()) # ith row of matrix stored
digOne.append(row[num - N]) # desired integer store... | true |
52f2f89d8c79f2dd3968a6b2d1a54b6f02909e63 | Python | Coolcooo/ArtezioHomework | /Lesson1/hometask_one.py | UTF-8 | 4,480 | 3.71875 | 4 | [] | no_license | """Модуль функций для первой домашней работы"""
def task_one(original_row):
"""Возвращает строку, где каждое слово, если это возможно,
начинается с заглавной буквы """
print("Задание №1")
list_str = original_row.split()
for i, stroke in enumerate(list_str):
if stroke[0].islower():... | true |
0239ae34233d3891eb15b16dc30d90d19525ec6b | Python | HactarCE/ElevatorSim | /generators.py | UTF-8 | 490 | 2.734375 | 3 | [
"MIT"
] | permissive | import random
from elevator import Elevator, Person, Platform
ELEVATOR_CAPACITY = 3
FLOORS = 8
PEOPLE_PER_FLOOR = 7
def random_elevator():
e = Elevator(
[
Platform(floor, [
Person(random.randrange(FLOORS))
for _ in range(PEOPLE_PER_FLOOR)
])
... | true |
6a5aa7a753b632bab63240ffbff2835b6ca2667b | Python | Vasilii-Redinskii/ps-pb-hw4 | /Simple1.py | UTF-8 | 2,882 | 3.46875 | 3 | [] | no_license | GENDER_MALE = 'm'
GENDER_FEMALE = 'f'
# Список пользователей
user_list = [{'name': 'Иван', 'gender': GENDER_MALE},
{'name': 'Петр', 'gender': GENDER_MALE},
{'name': 'Марья', 'gender': GENDER_FEMALE},
{'name': 'Дарья', 'gender': GENDER_FEMALE},
{'name': 'Юлия', 'gend... | true |
fd89eb3fccaa5322eab2509e81182d1216696e07 | Python | hmkim/workflow | /nextflow/iFinder/scripts/orientation.py | UTF-8 | 5,564 | 2.734375 | 3 | [] | no_license | """
given a BAM file of chimeric alignments both primary and secondary, call
a) the insertion site on the human genome
b) the orienation of the HIV sequence (attached to 3' or 5' end)
"""
from argparse import ArgumentParser
import pysam
import toolz as tz
import re
CIGAR_SOFT_CLIP = 4
CIGAR_HARD_CLIP = 5
def get_vi... | true |
bd397ac0490d340b756c3b14e4e8721a2212741e | Python | Samarthnehe/LeetCode | /accepted_codes/LinkedList-cycle2.py | UTF-8 | 405 | 3.171875 | 3 | [] | no_license | class Solution:
def detectCycle(self, head: ListNode) -> ListNode:
temp=head
curr=head
it=head
while(temp and curr and temp.next):
curr=curr.next
temp=temp.next.next
if(curr==temp):
while(it!=curr):
it=it.next
... | true |
db24ee9290a6f266ff615b071da3549b379585b5 | Python | cah835/Intermediate-Programming-1384 | /Lab 2/word(2).py | UTF-8 | 3,227 | 4.0625 | 4 | [] | no_license | import urllib.request
import random
class Word:
#Initializes the dictionary for all possible words of the correct lenght
def __init__(self, number_of_letters):
if type(number_of_letters) is not int:
raise TypeError ("Words need a length that is an integer data type.")
... | true |
f77a68a8da31bbfbb2f733432295de4fa1e9f464 | Python | BigShow1949/Python100- | /25.py | UTF-8 | 869 | 3.953125 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 题目:求1+2!+3!+...+20!的和。
# 程序分析:此程序只是把累加变成了累乘。
n = 0
s = 0
t = 1
for n in range(1,21):
t *= n
s += t
print '1! + 2! + 3! + ... + 20! = %d' % s
print '=================== method2 ==========================='
s = 0
l = range(1,21)
def op(x):
r = 1
for ... | true |
fc5ddfe5c2bfe4dc9279439935a2f2fe1760f1b2 | Python | tmu-nlp/100knock2017 | /vincentzlt/chapter01/knock05.py | UTF-8 | 273 | 3.40625 | 3 | [] | no_license |
# coding: utf-8
# In[27]:
def n_gram(string,n):
return list(zip(*[string[i:] for i in range(n)]))
# In[28]:
if __name__=='__main__':
string='I am an NLPer'
print(n_gram(string.strip().split(),2))
print(n_gram(string.replace(' ','_'),2))
# In[ ]:
| true |
a1df7e45cef5764526ef89aaf595f68bcd2773db | Python | martin0925/pacman2 | /pacman.py | UTF-8 | 9,672 | 3.0625 | 3 | [] | no_license | """Pacman 2018
Martin Janecek & Terezie Hrubanova"""
import pygame, random, sys, time
from pygame.locals import *
FPS = 5
WINDOWWIDTH = 960
WINDOWHEIGHT = 720
CELLSIZE = 30
assert WINDOWWIDTH % CELLSIZE == 0, 'Window width must be a multiple of cell size.'
assert WINDOWHEIGHT % CELLSIZE == 0, 'Window height must be a... | true |
b7c89bdd9f4f1fccc9d92531fc7d378bdba4615f | Python | wjoelmendoza/IA1_proyecto2 | /neural/Util/utils.py | UTF-8 | 9,012 | 2.703125 | 3 | [] | no_license | import datetime
import pandas as pd
from math import radians, cos, sin, asin, sqrt
from numpy import genfromtxt
import codecs, json
def load_file1():
return pd.read_csv(
'temporales/Dataset.csv',
dtype= {'Estado':'object','Genero':'object','Edad':'int64','Anio':'int64','cod_depto':'int64','cod_mun... | true |
b73ea1808cf2f4a7b347e0f6f6c454c11eb0f872 | Python | henne90gen/graphics_playground | /scripts/generate_coding_train.py | UTF-8 | 2,146 | 2.984375 | 3 | [] | no_license | from typing import List
from dataclasses import dataclass
BASE_PATH = "src/app/scenes/fourier_transform"
@dataclass
class Vec:
x: float
y: float
def clean_up_lines(line: str) -> bool:
if "// " in line:
return False
if "let drawing" in line:
return False
if line.strip() == "":
... | true |
320658bfcc873394bf6486339d8d9353cb453702 | Python | jimzer/6clop | /experiments/film.py | UTF-8 | 5,315 | 2.609375 | 3 | [] | no_license | import sobol_seq
import numpy as np
import itertools as it
import random as rnd
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
from tqdm import tqdm
from multiprocessing import Process, Queue
import time
class Image:
def __init__(self, n_pixels_x, n_pixels_y):
self.radiance = np... | true |
f7ebbceb8a2d618a6b681a6436c0a4ecbc7c5dbf | Python | Aasthaengg/IBMdataset | /Python_codes/p02763/s789671506.py | UTF-8 | 1,443 | 2.8125 | 3 | [] | no_license | N = int(input())
S = list(input())
Q = int(input())
'''
'init(a)': 配列aで初期化。O(N)
'update(k,x)': a[k]をxに変更 O(logN)
'query(p,q)': [p,q)について "segfunc" したものを返す O(logN)
'ide_ele' : 単位元。
'''
#####segfunc######
def segfunc(x, y):
return x | y
def init(init_val):
# set_val
for i in range(N):
seg[i+num-... | true |
8a3e0fdeeff15c3c9a224d55d91b2e65dc1c6f0c | Python | LookParOff/GameBreakBricks | /Tests/test_Structures.py | UTF-8 | 7,434 | 3.46875 | 3 | [] | no_license | from unittest import TestCase
from Structures import Tree2D
class TestTree2D(TestCase):
def __create_test_tree1__(self):
tree = Tree2D()
tree.insert(10, 10)
tree.insert(6, 30)
tree.insert(12, 10)
tree.insert(1, 1)
tree.insert(5, 40)
tree.insert(15, 6)
... | true |