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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
21e446b89e2f81ddd35a47b4d3c76f1cefbb5aad | Python | nikhiilll/Data-Structures-and-Algorithms-Prep | /Dynamic Programming/LeetCode/HouseRobber_198.py | UTF-8 | 251 | 3.046875 | 3 | [] | no_license | """
TC: O(n)
SC: O(n)
"""
def rob(nums):
robbery = [0 for _ in range(len(nums) + 1)]
robbery[1] = nums[0]
for i in range(2, len(nums) + 1):
robbery[i] = max(robbery[i - 1], robbery[i - 2] + nums[i - 1])
return robbery[-1]
| true |
40ff80179c194eedc3082e1331b0e511e2c7d35c | Python | pzombie/dqn_atari | /memory.py | UTF-8 | 3,073 | 2.859375 | 3 | [] | no_license | import numpy as np
class replay_buffer:
"""Circular buffer for storing experiences for experience replay"""
def __init__(self, size):
self._observation_buffer = []
self._experience_buffer = []
self._max_size = size
self._next_idx = 0
def __len__(self):
return(le... | true |
0fe9c97172ae89cd87797a704907c384fb28c801 | Python | partrita/biopython | /Section2/004.py | UTF-8 | 109 | 3.671875 | 4 | [] | no_license | #004.py
num1 = 3
if num1 % 2 == 1:
print(num1, "은 홀수다.")
else:
print(num1, "은 짝수다.")
| true |
2d3fa1705a90e02f720e117e7348e321594c2252 | Python | bayespy/bayespy | /bayespy/inference/vmp/nodes/poisson.py | UTF-8 | 3,982 | 3.015625 | 3 | [
"MIT",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-unknown-license-reference",
"AFL-3.0",
"GPL-1.0-or-later",
"BSD-3-Clause",
"Apache-2.0"
] | permissive | ################################################################################
# Copyright (C) 2014 Jaakko Luttinen
#
# This file is licensed under the MIT License.
################################################################################
"""
Module for the Poisson distribution node.
"""
import numpy as np
... | true |
555b4011da444db670731e588b4ab84f9b3471fa | Python | BIAOXYZ/variousCodes | /_CodeTopics/LeetCode_contest/biweekly/biweekly2020/23/WA--23_3.py | UTF-8 | 897 | 2.984375 | 3 | [] | no_license | class Solution(object):
def checkOverlap(self, radius, x_center, y_center, x1, y1, x2, y2):
"""
:type radius: int
:type x_center: int
:type y_center: int
:type x1: int
:type y1: int
:type x2: int
:type y2: int
:rtype: bool
"""
... | true |
7b488c08e9d67d5b145d38b245db11f12d33a74b | Python | jamarFraction/Transitive-Closure-Project | /transitiveClosure.py | UTF-8 | 3,898 | 3.296875 | 3 | [] | no_license | # Jamar Fraction
# CPTS 350
import pyeda.inter as pyeda
def edgeToBooleanFormula(i, j):
index = 0
xFormula = ""
yFormula = ""
xBin = '{0:05b}'.format(i)
yBin = '{0:05b}'.format(j)
# iterate over the bits in binary i to create xFormula
# produces "x[i] & ".. to match pyEDA style expressio... | true |
baf35eecd7cb71370f80bc81ebf8ea9eeeab633f | Python | halmichchristina/MC_LSTM_Pendulum | /models/normalisers.py | UTF-8 | 1,121 | 3.078125 | 3 | [] | no_license | import torch
from torch import nn
class NormalisedSigmoid(nn.Module):
""" Normalised logistic sigmoid function. """
def __init__(self, p: float = 1, dim: int = -1):
super().__init__()
self.p = p
self.dim = dim
def forward(self, s: torch.Tensor) -> torch.Tensor:
a = torch.... | true |
af5bd9bc51a688e5ef6f3e54120be9e237972130 | Python | brunopontes90/Cursos | /Python/Mundo 1/aula 9/aula09.py | UTF-8 | 178 | 2.984375 | 3 | [] | no_license | frase = 'Curso em Video Python'
frase = frase.replace('Python', 'Android')
print('Curso' in frase)
print(frase.find('video'))
dividido = frase.split()
print(dividido[0]) | true |
40013a8b0e1ec444e8b43f3f72362f7ba9c220b4 | Python | laurelkeys/machine-learning | /assignment-2/preassignment/nene.py | UTF-8 | 17,558 | 3.34375 | 3 | [] | no_license | import numpy as np
from time import time
# RANDOM_SEED = 886
class ActivationFunction:
''' An ActivationFunction is applied to Z to get the output A,
but its derivative expects the value A, not Z (!):
A == __call__(Z) and derivative(A) == derivative(__call__(Z)),
calling derivative(Z) ... | true |
ca6ba663d228bae96f656bc0fb4e56a1d50bdb6c | Python | buhuipao/LeetCode | /2017/sort/merge_intervals.py | UTF-8 | 1,195 | 3.53125 | 4 | [] | no_license | # _*_ coding: utf-8 _*_
'''
Given a collection of intervals, merge all overlapping intervals.
For example,
Given [1,3],[2,6],[8,10],[15,18],
return [1,6],[8,10],[15,18].
'''
class Interval(object):
def __init__(self, s=0, e=0):
self.start = s
self.end = e
class Solution(object):
def merge(... | true |
bd076f2757bc8e0a66b432d07424057cc04a87f9 | Python | shyam28598/iudx-python-sdk | /iudx/common/HTTPResponse.py | UTF-8 | 968 | 3.125 | 3 | [
"MIT"
] | permissive | """Module doc string. Leave empty for now.
HTTPEntity.py
"""
from requests import Response
from typing import TypeVar, Dict
HTTPResponse = TypeVar('T')
class HTTPResponse():
"""Abstract class for Response. Helps to create a modular interface
for the API Response in Python.
"""
def __init__(self... | true |
b576b10d07f9b4ec05755b4f38537f2d121a870b | Python | jodiberdis/ASTR575 | /q26/q26.py | UTF-8 | 2,701 | 2.828125 | 3 | [] | no_license | #For a specified total number of stars, and a specifed faint magnitude limit, make a realizations of the Hess diagram, using Poisson random deviates to populate each bin. Process: given section of HR diagram, calculate total number of stars which, from the isochrones, is with some normalization factor; scale this numbe... | true |
3e4042ffbc67c22548b2735be3dd21a854155fdb | Python | dreamercv/convert_labels | /tmp/cvatxml2_txtandjson.py | UTF-8 | 4,437 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | # encoding utf-8
"""
@author: Binge.Van
@input:
#outut:
@desc:
生成yolo的txt标签,同时生成json格式的标签,然后用脚本将json格式的转成ocr格式的标签
"""
import os
import cv2
import argparse
import shutil
import numpy as np
from lxml import etree
from tqdm import tqdm
import xml.etree.ElementTree as ET
import json
import... | true |
8bea41467f35d7667ecc0c3339af21a7f86ae64c | Python | Vilin97/DataMiningProject1 | /kmeans.py | UTF-8 | 8,855 | 3.0625 | 3 | [] | no_license | # to run do:
# exec(open("kmeans.py").read())
import pandas as pd
import sys
from sklearn.preprocessing import OneHotEncoder
from sklearn.decomposition import PCA
from sklearn.impute import SimpleImputer
import numpy as np
import random
import matplotlib.pyplot as plt
epsilon = 0.01
def transform(dataframe,features,... | true |
5c1bc14cd42bbff19fc9fcdeeb1df56a69decf43 | Python | messyoxd/Learning-NN | /xor_problem.py | UTF-8 | 627 | 3.078125 | 3 | [] | no_license | from NeuralNetwork import *
import random
training_data = [
[
[0,1],
[1]
],
[
[1,0],
[1]
],
[
[0,0],
[0]
],
[
[1,1],
[0]
]
]
sigmoid = lambda x: 1/(1+math.exp(-x))
dsigmoid = lambda y: y * (1-y)
if __name__ == "__main__... | true |
7f60b22daaa27361712baa0403566b57be968106 | Python | RoardFruit/leetcode | /levelOrder.py | UTF-8 | 690 | 3.296875 | 3 | [] | no_license | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def levelOrder(self, root):
"""
:type root: TreeNode
:rtype: List[List[int]]
... | true |
17bba8f96aa1123d7bb85f93b93fecd2c8a44d16 | Python | jrderuiter/pyim | /src/pyim/main/pyim_bed.py | UTF-8 | 1,938 | 2.859375 | 3 | [
"MIT"
] | permissive | """Script for the pyim-bed command.
Converts an insertion dataframe to the BED file format."""
import argparse
from collections import OrderedDict
from pathlib import Path
import numpy as np
import pandas as pd
from pyim.model import Insertion
RED = '255,0,0'
BLUE = '0,0,255'
GRAY = '60,60,60'
def main():
""... | true |
18654b79a0a17d9468753db9350fe2f3e9af38ee | Python | PauloRicardoPegoraroNunes/Python | /Listas[array].py | UTF-8 | 267 | 3.28125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri May 18 16:37:17 2018
@author: paulo
"""
#simples
lista = ['baixo','violão','bateria']
print(lista)
#tuplas não podem ser alteradas
tupla = ('a','b','c','d','e','f','g','h','i')
print(tupla)
| true |
683a9214085b037d39c08401d14237fbe1acc56b | Python | jing-jin-mc/Pandas-in-the-industry | /functions.py | UTF-8 | 13,790 | 2.921875 | 3 | [] | no_license |
######## Libraries ###############
import pandas as pd
import numpy as np
import time
from datetime import datetime, timedelta
import glob
#### Global Variables ################
#### The percentile threshold
trust_worthy_p_thresh = 50
avg_rating_p_thresh = 50
#### Add time columns to the dataframe from the csv file... | true |
34f43df0a66332ddad15c336e73d7ac4ee58fe07 | Python | carolynemilgo/100daysofpython | /term_frequency.py | UTF-8 | 242 | 3.875 | 4 | [] | no_license | # Return frequency of term in lst.
def frequency(lst, search_term):
return lst.count(search_term)
print(frequency(["apple", "pear", "banana", "pear"], "banana")) # 1
print(frequency(["apple", "pear", "banana", "pear"], "pear")) # 2
| true |
050ec22f4947aee014410bb5ad2acf4ee82eb7bd | Python | lfny2580832/iOS-Ipa-Analyse | /ios_ipa_analyse.py | UTF-8 | 10,666 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | # coding: utf8
# author: Lawrence
# mail: coderlawrence@163.com
import sys
import os
# 解析 link map 文件,并且保存到map
def link_map_file_parser(link_map_file_tmp):
reach_files = 0
reach_sections = 0
reach_symbols = 0
size_map = {}
while 1:
line = link_map_file_tmp.readline()
if not line:
... | true |
876b34d93bbdeaad2d2ec61185575e6f49681eb3 | Python | mmmarchetti/cev_python | /exercises/exe034.py | UTF-8 | 223 | 3.828125 | 4 | [
"MIT"
] | permissive | sal = int(input('Digite o seu salário: R$'))
if sal > 1200:
print(f'O seu salário após o reajuste será de: R${(sal * 0.05) + sal}')
else:
print(f'O seu salário após o reajuste será de: R${(sal * 0.1) + sal}') | true |
a8fb3c1ce5e900a3a1aa8f7caaaed70686d884bd | Python | ajfrierson/Data-Structures | /heap/max_heap.py | UTF-8 | 1,838 | 3.671875 | 4 | [] | no_license | class Heap:
def __init__(self):
self.storage = []
def insert(self, value):
self.storage.append(value)
self._bubble_up(len(self.storage)-1)
def delete(self):
if len(self.storage) == 0:
return None
elif len(self.storage) == 1:
return self.storage.pop()
else:
deleted ... | true |
b39034897b1568495c569c543b9c321123df7da6 | Python | gistable/gistable | /all-gists/1195723/snippet.py | UTF-8 | 1,077 | 2.640625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import plistlib
import json
import tkFileDialog
import re
import sys
file_to_open = tkFileDialog.askopenfilename(message="Select an existing plist or json file to convert.")
converted = None
if file_to_open.endswith('json'):
converted = "plist"
converted_dict = json.load(open(file_to_op... | true |
82b3795281b6154523916ccb918a05c82e9cfb4c | Python | grg909/LCtrip | /Yama2020/LintCode.162.Set_Matrix_Zeroes.py | UTF-8 | 748 | 3 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
# @Date : 2020/1/18
# @Author : WANG JINGE
# @Email : wang.j.au@m.titech.ac.jp
# @Language: python 3.7
"""
"""
class Solution:
"""
@param matrix: A lsit of lists of integers
@return: nothing
"""
def setZeroes(self, matrix):
if not matrix:
return... | true |
b3d3cd545e4c101525c017f2cc6f2c6b0c866f8f | Python | williamswkx/xgboost_retail | /lib/result_process.py | UTF-8 | 2,329 | 2.53125 | 3 | [] | no_license | from global_sources.file_operation import read_goods,read_predicts,read_stock,read_goods_list
import pandas as pd
from datetime import datetime, timedelta, date
from definitions import ROOT_DIR
from global_sources import file_operation
def day_shift(dt, gap):
tmp = datetime.strptime(dt, "%Y-%m-%d")
n_time = tm... | true |
8613a432a8653329ff56d388882c59ae9b8a523d | Python | nekapoor7/Python-and-Django | /PYTHON PROGRAMS/Simple_Program/Grade.py | UTF-8 | 396 | 4.09375 | 4 | [] | no_license | #Python Program to Take in the Marks of 5 Subjects and Display the Grade
marks = list(map(int, input("Enter the numbers in a Given List").split()))
print(marks)
sum = 0
avg = 0
for i in marks:
sum += i
avg = sum/i
if sum > 95:
print("A+ Grade")
elif sum > 85:
print("B+ Grade")
elif sum > 75:
pri... | true |
2abdeb48330e85fb9e75705c23b5e1dcd159c846 | Python | tonayw/POSCAR-Reader | /bonds analysis.py | UTF-8 | 5,130 | 3.078125 | 3 | [] | no_license | import numpy as np
import matplotlib
import sys
import matplotlib.pyplot as plt
'''This returns a list that contains all information from the POSCAR file
The list is of the following form:
[scaling factor,[first axis,second axis, third axis](multiplied by scaling factor),
[[first element, number of atoms],[sec... | true |
29765e0cc5d65d9006e41ed2e7093ed93449d536 | Python | zytMatrix/MBEsolutions | /p2/project2.py | UTF-8 | 6,730 | 2.671875 | 3 | [] | no_license | import ctypes
import sys
from pwn import *
import mycrypto
p = process(["./rpisec_nuke"], env={"LD_PRELOAD": "./usleep.so ./libc.so.6"})
log.info(util.proc.pidof(p))
# Get session ID (e.g. buf)
p.recvuntil("LAUNCH SESSION ")
p.recv(16)
buf = p.recv(10)
buf_addr = int(buf)
log.info("Got buf address/session id {:#x}... | true |
a6a1591f50790be0c7e39dcd6737098b0516ccc7 | Python | yamabook37/atcoder | /ABC_problems/abc129_a.py | UTF-8 | 114 | 2.71875 | 3 | [] | no_license | P,Q,R=map(int,input().split())
ans=[]
ans.append(P)
ans.append(Q)
ans.append(R)
sorted(ans)
print(P+Q+R-max(ans)) | true |
b6364c4f087b085edbb8c07e6f59043cc5b0f93f | Python | davidAmezquita/Virus-Attack | /Enemy.py | UTF-8 | 2,292 | 3.4375 | 3 | [] | no_license | import pygame, os
WIDTH = 900
HEIGHT = 720
class Enemy:
def __init__(self, x, y, width=64, height=64):
self.x = x
self.y = y
self.width = width
self.height = height
self.health = 300
self.images = [pygame.image.load(os.path.join("assets", "Virus.png"))... | true |
46c714cfb73bcc775a7ec2a9dcdb48439ce2e38e | Python | afanxia/analyzer | /tests/unit/test_trading_engine.py | UTF-8 | 2,893 | 2.515625 | 3 | [] | no_license | import unittest
from analyzer.ufConfig.pyConfig import PyConfig
from analyzer.backtest.constant import (
CONF_ANALYZER_SECTION,
CONF_STRATEGY_NAME
)
from analyzer.backtest.tick_subscriber.strategies.strategy_factory import StrategyFactory
from analyzer.backtest.trading_engine import TradingEngine
class Test... | true |
aab96a96d73e8d4acb436fde987a81e24518c574 | Python | hyulab/ECLAIR | /ECLAIR.py | UTF-8 | 19,363 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
import pandas as pd
import time, sys
import itertools
from collections import defaultdict
from sklearn import cross_validation
from sklearn.metrics import roc_auc_score
from hyperopt import fmin, tpe, hp, STATUS_OK, Trials
#--------------------------------------------------------------------------... | true |
067c9c18838538958b18868a32757bb6183e4cdf | Python | shduttacheezit/Interview-Cake | /product_of_3.py | UTF-8 | 726 | 3.5625 | 4 | [] | no_license | def highest_prod(nums):
"""
highest product of 3 integers from given list of ints
>>> highest_prod([-10, -10, 1, 3, 2])
300
>>> highest_prod([1, 10, -5, 1, -100])
5000
>>> highest_prod([1, 10, 5, 1, 100])
5000
"""
nums.sort()
# ACCOUNT FOR NEGATI... | true |
fde9c5f1f981739f44fe93bebee2cc83fe06c22c | Python | creativequotient/Rosalind | /Bioinformatics_Stronghold/PRTM_Calculating_protein_mass.py | UTF-8 | 1,010 | 3.171875 | 3 | [] | no_license | def getProteinMass(protein_sequence):
protein_mass = 0
# Table to convert amino acid to mass
massTable = {
"A": 71.03711,
"C": 103.00919,
"D": 115.02694,
"E": 129.04259,
"F": 147.06841,
"G": 57.02146,
"H": 137.05891,
"I": 113.08406,
"... | true |
0b78d15e598cc9c50ab4ca164a04db1a91d43f25 | Python | canwaykalburim/School-Code | /PythonAlgorithm/theMinionGame/main.py | UTF-8 | 321 | 3.890625 | 4 | [] | no_license | Str = input()
stringLen = len(Str)
stuart = 0
kevin = 0
for i in range(stringLen):
if Str[i] in ('A', 'E', 'I', 'O', 'U'):
kevin += stringLen - i
else:
stuart += stringLen - i
if kevin > stuart:
print('Kevin', kevin)
elif stuart > kevin:
print('Stuart', stuart)
else:
print('Draw')... | true |
3eea33eb399a72acd378bf1b417709fd76bf8a22 | Python | XSilverBullet/blog | /algorithms/topologic_sort.py | UTF-8 | 1,044 | 3.234375 | 3 | [] | no_license | import collections
import sys
# record topologic sort result
res = []
'''
N: Number of graph
prerequisites: list<int, int>
'''
def canFinish(prerequisites):
graph = collections.defaultdict(list)
indegrees = collections.defaultdict(int)
for u, v in prerequisites:
graph[v].append(u)
indegr... | true |
3e071b6eba762d1bd179c432d2375a741e4e9dfc | Python | Avoracity/Programming-2017-2018 | /Python/twoHex.py | UTF-8 | 182 | 3.515625 | 4 | [] | no_license | #Name : Michael Alvarez
#Date : 10.18.17
#Two Digit Numbers for hex color
numbers = "0123456789ABCDEF"
for i in numbers:
for j in numbers:
x = str(i) + str(j)
print(x)
| true |
65bbbd9936904e9baf030f210e7def749133a34b | Python | a283910020/algorithms-sedgewick-python | /chapter_1/module_1_4.py | UTF-8 | 4,723 | 4.03125 | 4 | [] | no_license | #!/usr/bin/env python
# -*- encoding:UTF-8 -*-
from module_1_1 import binary_search
import doctest
def two_sum_fast(lst):
"""
Count the number of pair of numbers add up to zero. first sort the list,
then use binary_search the get the other number which could add up to zero,
if in the list, then incr... | true |
d4eaa0e570be81097fd892a87c5cdf73b7241145 | Python | ZioCroccante/modifica_disegni | /docx_to_xml.py | UTF-8 | 3,118 | 3.015625 | 3 | [] | no_license | import os
import shutil
import xml.etree.ElementTree as et
import zipfile
class ModificaDocx(object):
scheme = '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}'
def __init__(self, path):
self.path = path
self.filename = os.path.basename(path)
def get_docx_xml(self):
... | true |
6d16fb0a84cabcd0881101b3f9ba071b0bbbfd3e | Python | mehmettaha/Practice | /guess.py | UTF-8 | 611 | 4.1875 | 4 | [] | no_license | def guess(high, low):
return int((high+low)/2)
def game():
low = 0
high = 100
answer = ""
prev = []
while True:
x = guess(low, high)
if x in prev:
print("Cheater!")
break
answer = input("Is the number %d? Answer ... | true |
e03bbd291b37f0e87e8cc385867f612a26e2b55b | Python | OnHoliday/Text_Mining | /summarizor_2.py | UTF-8 | 15,511 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 5 13:20:43 2019
@author: Konrad
"""
from combined_utils_4 import *
import gensim
import pandas as pd
from gensim.models import KeyedVectors
#model = KeyedVectors.load_word2vec_format(r'D:\word2vec_model\GoogleNews-vectors-negative300.bin', binary=True)
model ... | true |
981701d0e4b34d3bfc79e167532c3da78468706b | Python | Aasthaengg/IBMdataset | /Python_codes/p03998/s710184394.py | UTF-8 | 453 | 2.828125 | 3 | [] | no_license | sa = input()
sb = input()
sc = input()
a = [sa[i] for i in range(len(sa))]
b = [sb[i] for i in range(len(sb))]
c = [sc[i] for i in range(len(sc))]
n = 'a'
while True:
if n == 'a':
if len(a) == 0:
print('A')
exit()
else:
n = a.pop(0)
elif n == 'b':
if len(b) == 0:
print('B')
... | true |
bfe426e8abfb31218c0b8695978d43aed0712a99 | Python | halon1989/gitstudy | /project1/app.py | UTF-8 | 208 | 2.59375 | 3 | [
"MIT"
] | permissive | from flask import Flask
app = Flask(__name__)
num1 = 100
num2 = 200
num3 = 300
num4 = 400
num5 = 500
@app.route('/')
def hello_world():
return 'Hello World!'
if __name__ == '__main__':
app.run()
| true |
65cae4db4c0b34290b8f9f9058d959351b7e017a | Python | MrHamdulay/csc3-capstone | /examples/data/Assignment_5/btcnav001/question2.py | UTF-8 | 989 | 3.8125 | 4 | [] | no_license | """Naveet Baitchu
Change programme
17/04/14"""
def main():
a=0
Dollar=0
Quarter=0
TenC=0
FiveC=0
OneC=0
x=eval(input("Enter the cost (in cents): \n"))
while a<x:
y=eval(input("Deposit a coin or note (in cents): \n"))
a=a+y
z=a-x #z=change
... | true |
947ed9f4b29a7e9b17109372e59da6e0f356f399 | Python | HavocMonkey1/Computing-Networking-Uni-Project | /Server/DatabaseInterface.py | UTF-8 | 862 | 3.078125 | 3 | [] | no_license | import mysql.connector#a library designed to interface with mysql databases (Such as the database that I have set up for the backend
dbConnection = mysql.connector.connect(#the login details for talking to the database
host="localhost",
user="Queries",
passwd="Queries123",
database="note_taking_databas... | true |
91312516e4d85e5d6dd1e728e783807e9d3cfe87 | Python | SAP/project-kb | /prospector/service/api/dependencies.py | UTF-8 | 2,177 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | from typing import Optional
from fastapi import Depends, HTTPException, status
from fastapi.security import OAuth2PasswordBearer
from pydantic import BaseModel
# ======================================
# AUTH STUFF
# The following is taken from https://fastapi.tiangolo.com/tutorial/security/first-steps/
# with slight ... | true |
8fa2cbd1c57d8a923a1f0f265ac7ebffbe15e410 | Python | mevers303/bothoven | /src/midi_handlers/FullStepMidiArrayBuilder.py | UTF-8 | 2,135 | 2.65625 | 3 | [] | no_license | from collections import defaultdict
import numpy as np
import mido
import scipy.sparse
from bothoven_globals import NUM_FEATURES, NUM_STEPS
class FullStepMidiArrayBuilder:
def __init__(self, filename):
self.filename = filename
self.tracks = []
def mid_to_array(self):
mid = mido.M... | true |
31a36655bb88d98a876175df2e362935789a4640 | Python | EvaLappski/Python-Flask | /fileIO.py | UTF-8 | 1,688 | 3.734375 | 4 | [] | no_license | import os
# Count the number of lines in the document
counter = 0
thefile = open("dom.js", "r")
for lines in thefile:
counter += 1
print(counter)
# print(file.read())
# Count total number of characters
space = 0
line = 0
charc = 0
thefile = open("dom.js", "r")
text = thefile.read()
for i in text: # readi... | true |
687b278566c3102a2ba93f813934a91bdf939d70 | Python | patell11/DataStructuresAndAlgorithms_SanDiego | /Practice/Coursera_Problems/maximum_number_of_prizes.py | UTF-8 | 670 | 3.90625 | 4 | [] | no_license |
def maximum_num_prizes_naive(n):
summands = []
for i in range(1, n+1):
summands.append(i)
remaining = n - sum(summands)
if sum(summands) > n or (remaining in summands):
summands.pop()
return summands
def maximum_num_prizes(n):
summands = []
num = n
l = 1
... | true |
4a18abde02b0819ea0e90b1ac8550c4268625730 | Python | RE-N-Y/MultimodalMeme | /dataloader.py | UTF-8 | 13,486 | 2.625 | 3 | [] | no_license | import pandas as pd
import random
from ast import literal_eval
from typing import List
from PIL import Image
import torch
import torch.nn as nn
import torchvision.transforms as T
from torch.utils.data import Dataset, DataLoader
from pathlib import Path
from collections import Counter
class MemeDataset(Dataset):
d... | true |
f5efeef4e337d6eade71e02b61b7a3d352ef2d76 | Python | miru-pirvulescu/trail | /grid_builder.py | UTF-8 | 232 | 3.15625 | 3 | [] | no_license | import json
grid = json.loads(open('grid.json').read())
def print_grid():
for line in grid:
cc = ""
for cell in line:
cc += " {:1} ".format(cell)
print(cc)
print_grid()
| true |
705cf0fc2deebfc96e31441665c4be66ce1a75d0 | Python | Aasthaengg/IBMdataset | /Python_codes/p03786/s034367711.py | UTF-8 | 387 | 2.6875 | 3 | [] | no_license | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)
N = int(input())
As = [0]+list(mapint())
As.sort()
from itertools import accumulate
cAs = list(accumulate(As))
cAs.sort(reverse=True)
As.sort(reverse=True)
ans = 1
for i in range(1, ... | true |
27ade520312813ab3569a72098e30b11caa0e8ac | Python | depromeet/algorithm-6th | /study-1st/team1/Search/dongkun/search-4.py | UTF-8 | 288 | 2.65625 | 3 | [] | no_license | # 주어진 숫자의 부분집합 각각의 Permutation을 모두 소수 검사를 하면 될 것 같습니다.
# 하지만 파이썬에서 제공하는 permutation 함수를 쓰지 않고 구현하려니 어려움이 있습니다.
def solution(numbers):
answer = 0
return answer | true |
ece2fecefc78166182ba0df6b5f471ea56ce8867 | Python | TheTrappist/Cluster-analysis | /imagej_scripts/simple_frap.py | UTF-8 | 4,060 | 2.75 | 3 | [
"MIT"
] | permissive | """
Adapted from code written at the Image Processing School Pilsen 2009
(accessed online at http://imagej.net/Analyze_FRAP_movies_with_a_Jython_script)
by Vladislav Belyy (UCSF)
"""
import java.awt.Color as Color
from ij import WindowManager as WindowManager
from ij.plugin.frame import RoiManager as RoiManager
f... | true |
24aa15b0d4dfa0c17e9010be7f23b5c1f2d52e74 | Python | charfweh/python | /listcompre.py | UTF-8 | 1,792 | 3.640625 | 4 | [] | no_license | # odd = [x for x in range(1,10) if x%2!=0]
# print(odd)
#list comprehension
# a=1
# b=1
# c=1
# n = 2
# li = [a,b,c]
# combo = [[i,j,k] for i in range(0,li[0]+1) for j in range(0,li[1]+1) for k in range(0,li[2]+1) if i+j+k != n]
# print(combo)
#runner up challenge
# n = int(input())
# arr = list(map(int,input().spli... | true |
5ea190555719e00a84506e6784186a9e6a67107b | Python | SkiMsyk/AtCoder | /BeginnerContest_A/213.py | UTF-8 | 65 | 2.984375 | 3 | [] | no_license | A,B=map(int,input().split())
ans = bin(A ^ B)
print(int(ans, 2)) | true |
9bf5419c4b7a9f790d432ea3178ce11c1899affa | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_43/33.py | UTF-8 | 730 | 3.265625 | 3 | [] | no_license | import sys
def solve(input):
chars = {}
num = 0
for c in input:
if not c in chars:
if num == 0:
n = 1
elif num == 1:
n = 0
else:
n = num
num += 1
chars[c] = n
if num < 2:
... | true |
33b687de78570f101cf4c8874388562ec42f5c24 | Python | berdoezt/TOKI | /Training/dasar/fungsi/teman.py | UTF-8 | 941 | 3.296875 | 3 | [] | no_license | #!/usr/bin/python3
ND = input().split()
N = int(ND[0])
D = int(ND[1])
temp = []
for i in range(N):
XY = input().split()
temp.append(XY)
min = None
max = None
for i in range(len(temp) - 1):
for j in range(i+1, len(temp)):
if min == None and max == None:
min = pow(abs(int(temp[i][0]) - int(temp[j][0])), D) +... | true |
2ab89281158f2dc8c98134f25f00788f30cace6a | Python | zihuaweng/leetcode-solutions | /leetcode_python/1438.Longest_Continuous_Subarray_With_Absolute_Diff_Less_Than_or_Equal_to_Limit.py | UTF-8 | 1,370 | 3.546875 | 4 | [] | no_license | class Solution:
def longestSubarray(self, nums: List[int], limit: int) -> int:
"""
[8,2,4,7]
when we have a fixed left pointer i, we move right pointer j to the right to find the max valid window.
then we can move the left pointer i to right to search for new window that sta... | true |
16693dbede9126dad05e21f9ed30fd6be4050cdb | Python | henrik-dreyer/GaussianCircuits | /Code/differentiable_covariance.py | UTF-8 | 5,373 | 3 | 3 | [] | no_license | from jax._src.numpy.linalg import eig
import jax.numpy as jnp
import jax
from jax import grad, jit, vmap
from jax.scipy.linalg import expm
import numpy as np
"""
Produces layer of \Gammas of XX Paulis
Parameters
----------
ts: (List of Real numbers of size L-1) The times/angles. Set all equal for pseudo-translational... | true |
6ae860991f7c67bc93a9cea197c57dcded4b9371 | Python | sina-ehsani/NaiveBayes_SNLI | /project.py | UTF-8 | 6,166 | 2.5625 | 3 | [] | no_license |
from data_utils import readfile
import numpy as np
import sklearn
from sklearn.feature_extraction.text import TfidfVectorizer , HashingVectorizer , CountVectorizer
from scipy import sparse
from sklearn.feature_selection import mutual_info_classif
from sklearn.model_selection import KFold , cross_val_score
from sklearn... | true |
412104dd50bab7a3adf7bb8cc889be227f162ed4 | Python | destinysam/Python | /map function.py | UTF-8 | 530 | 3.828125 | 4 | [] | no_license | # CODED BY SAM@SAMEER
# EMAIL:SAMS44802@GAMIL.COM
# DATE:11/09/2019
# PROGRAM: CONVERTING OF LIST NUMBERS INTO NEGATIVE NUMBERS
def negative(numbers, rang):
return_list = []
temp = 0
counter = 0
for j in range(rang):
counter = int(numbers[j])
temp = counter * -1
return_list... | true |
c4487ba72d4924eefbefe3c7c5a0f925dfcc1e23 | Python | jongjunpark/TIL | /Public/problem/D3/5549.홀수일까짝수일까.py | UTF-8 | 161 | 3.71875 | 4 | [] | no_license | T = int(input())
for t in range(1, T+1):
N = int(input())
if N % 2 == 0:
print('#{} Even'.format(t))
else:
print('#{} Odd'.format(t)) | true |
1c04fa30426cf8ea88b8f80abc7ca1109c09f3c8 | Python | myaa2913/filmjunk_genre_analysis | /filmjunk_scrape.py | UTF-8 | 2,900 | 3.171875 | 3 | [] | no_license | from bs4 import BeautifulSoup
from time import sleep
import csv, os, re, requests
from rating_clean import rating_clean
import pandas as pd
#set directory
os.chdir("C:/Users/Matt/Dropbox/github/scrapes/temp/")
#create dictionary to hold movie ratings by host
dict = {}
webpages = ['http://filmjunk.com/podcast/',
... | true |
7a151b472daad7f932a68045b673eeff01d5511c | Python | faisalarafat/python_hands_on_practice | /function_in_python/custom_generator.py | UTF-8 | 119 | 3.34375 | 3 | [] | no_license | def customgen(x,y):
while x<y:
yield x
x+=1
result = customgen(20,45)
for i in result:print(i) | true |
a851aa7251e1f78bd0724dbc5f44b83bf8cb93f3 | Python | jabbalaci/Bash-Utils | /tocb.py | UTF-8 | 1,209 | 3.328125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
"""
Website: https://pythonadventures.wordpress.com/2011/03/05/copy-string-to-x-clipboards/
Laszlo Szathmary, 2011--2012 (jabba.laci@gmail.com)
Copy the text from the standard input to ALL clipboards. Thus, you can use
any paste method to insert your text (middle mouse button or Shift+Insert).
... | true |
49b6bd17443902763e04e6598e1f8f4debfd3658 | Python | dpilger26/NumCpp | /test/pytest/test_coordinates.py | UTF-8 | 46,505 | 2.90625 | 3 | [
"MIT"
] | permissive | import numpy as np
from astropy.coordinates import SkyCoord
from astropy.coordinates import Latitude, Longitude # Angles
import astropy.units as u
import pymap3d
import NumCppPy as NumCpp # noqa E402
np.random.seed(666)
####################################################################################
def test_... | true |
94e16884ddb5472d804cd1bade6e1732178e3c9d | Python | Dilshada798/list | /multiply.py | UTF-8 | 78 | 2.953125 | 3 | [] | no_license | # def multiply(a,b):
# c=a*b
# print('multiply=',c)
# multiply(12,4)
| true |
067bfb9b2dadc6d85914f772fb5f24703903294e | Python | NathanSusser/Natural-Language-Processing | /Bigrams_practice.py | UTF-8 | 967 | 3.765625 | 4 | [] | no_license | def build_successors_table(tokens):
dict={}
prev=tokens[-1]
for i in tokens:
if prev in dict:
dict[prev].append(i)
else:
dict[prev]=[i]
prev=i
return dict
text = ['We', 'came', 'to', 'code', ',', 'to',
'have', 'fun', ',', 'and', 'to', 'eat', 'pie', '.']
import random
def construct_sent(word, table):... | true |
41d29f9be09fb2fcbe5ff848009c3c7f40c46010 | Python | ChristianLastova/IR-Political-Bias | /bias_detector/tune_classifier.py | UTF-8 | 1,672 | 2.578125 | 3 | [] | no_license | from sklearn.pipeline import Pipeline
from sklearn.model_selection import GridSearchCV
from sklearn.externals import joblib
from random import shuffle
import numpy as np
from sklearn.externals import joblib
#read in data
print("Reading articles")
data = []
#kaggle - all the news
for i in range(1,4):
for line in op... | true |
bf699f7bad8bad89fd29e3e6d0c63ed3bb1abe9d | Python | CFOnHeart/Douban_spider_and_ChineseText_analyse | /test.py | UTF-8 | 1,820 | 2.6875 | 3 | [] | no_license | # coding=utf-8
from spider import douban_book_spider as dbspider
from text import text_presolve
from text import participal
from text import my_word2vec as mywv
import pymongo
if __name__ == "__main__":
client = pymongo.MongoClient('localhost', 27017)
database = client['douban'] #数据库名
collection = database... | true |
febc3b7a957efb6ccc8280a1feec9a7cdf21a2b2 | Python | plastr/extrasolar-game | /lib/utils.py | UTF-8 | 20,072 | 3.234375 | 3 | [
"MIT"
] | permissive | # Copyright (c) 2010-2011 Lazy 8 Studios, LLC.
# All rights reserved.
# Contains useful standalone utilities. Please doctest all functions.
from datetime import datetime, timedelta
import calendar
import math
import zlib
def tr(msg):
""" This function is a placeholder for real i18n translation code, acting as an
... | true |
1d7e58fba638c8b7b49a6821584ed6d5132c6a12 | Python | evgenii-zaikin/2021_Zaikin_infa | /lab2/ex13.py | UTF-8 | 138 | 3.765625 | 4 | [] | no_license | import turtle
turtle.shape('turtle')
n = 1
m = 9
while n < m + 1:
turtle.forward(90)
turtle.left(180-180/m)
n = n + 1
input() | true |
a7f3bef31126bafb71c04eb765d1263344e88624 | Python | e2nIEE/pandapower | /pandapower/toolbox/element_selection.py | UTF-8 | 27,832 | 2.734375 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
# Copyright (c) 2016-2023 by University of Kassel and Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel. All rights reserved.
import gc
import warnings
import numpy as np
import pandas as pd
from packaging.version import Version
import pandapower as pp
f... | true |
43d52c958891fca10041a14661b25620d7e790d3 | Python | TomhitsJerry/rosalindlearning | /DNA/LCSQ.py | UTF-8 | 719 | 2.625 | 3 | [] | no_license |
with open ('/home/cyagen1/Downloads/rosalind_lcsq.txt','r')as f:
w=f.read()
s=''.join(w.split('>')[1].split('\n')[1:])
t=''.join(w.split('>')[2].split('\n')[1:])
lengths = [[0 for j in range(len(t) + 1)] for i in range(len(s) + 1)]
for i, x in enumerate(s):
for j, y in enumerate(t):
if x == y:
... | true |
9c548a647f993c702418d5fef3be4b35cbabbc1d | Python | fabiano-teichmann/app_twitter | /monitoring_twitter/core/api_twitter.py | UTF-8 | 1,426 | 2.765625 | 3 | [] | no_license | from datetime import timedelta
import tweepy
class ApiTwitter:
def __init__(self, credential):
self.consumer_key = credential.get('consumer_key')
self.consumer_secret = credential.get('consumer_secret')
self.access_token_secret = credential.get('access_token_secret')
self.access_to... | true |
32e719ad221f53176906c01e481d13687fe65285 | Python | zfy1989lee/MachineLearning | /04Building Machine Learning System with Python/ch8Recomendations/i5all_correlations.py | UTF-8 | 1,453 | 3.234375 | 3 | [] | no_license | import numpy as np
def all_correlations(y, X):
from scipy import spatial
y = np.atleast_2d(y)
# print('y=', y)
sp = spatial.distance.cdist(X, y, 'correlation')
# print('sp=', sp)
# The "correlation distance" is 1 - corr(x,y); so we invert that to obtain the correlation
return 1 - sp.ravel(... | true |
3d0de830bbccf7b1d30810a1a6b3dd1ce1ce9914 | Python | fangyue6/MyPythonCode | /pythonCode/workspace/Study/src/yue/29.py | UTF-8 | 824 | 2.875 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: UTF-8 -*-
'''
Created on 2015年4月9日
@author: fangyue
'''
import re
r1=r'csvt.net'
print re.findall(r1, 'csvt.net')
print re.findall(r1, 'csvtonet')
print re.findall(r1, 'csvtxnet')
print re.findall(r1, 'csvt\nnet',re.S)#使.匹配包括换行在内的所有字符
s="""
hello csvt
hello python
hello fan... | true |
4c0e45d15b0f4b15e62f6ff56b1f252b2026edff | Python | taroserigano/The-Modern-Python-3-Bootcamp-1 | /S10 Looping in Python/test_ex13-ranges.py | UTF-8 | 294 | 3.078125 | 3 | [] | no_license | import pytest
from ex13ranges import oddFromTenToTwentyInclusive, sumOfList
def test_oddFromTenToTwentyInclusive():
assert oddFromTenToTwentyInclusive() == [11, 13, 15, 17, 19]
def test_sumOfList():
assert sumOfList([1, 2, 3]) == 6
assert sumOfList([11, 22, 33]) == 66
| true |
e819102b4f712c34109282c31de9f3100a9db048 | Python | Aysyluu/OTIB_Labs | /Lab4/clasterize.py | UTF-8 | 1,783 | 2.765625 | 3 | [] | no_license | import json
AO_names = ["szao", "sao", "svao", "vao", "uvao", "uao", "uzao", "zao", "cao", "new-msk"]
output_data = \
{
"szao" : [],
"sao" : [],
"svao" : [],
"vao" : [],
"uvao" : [],
"uao" : [],
"uzao": [],
"zao" : [],
"cao" : [],
"ne... | true |
270d32c26ecf280ba3931973dacc150ec0c6e337 | Python | zhouyswo/tf-neural-network | /base/tfNolinearRegression.py | UTF-8 | 1,443 | 3.171875 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
# 随机生成200个点
# 在-0.5~0.5之间随机取200个点 并增加维度 200行1列
x_data=np.linspace(-0.5,0.5,200)[:,np.newaxis]
# 生成随机噪点
noice = np.random.normal(0,0.02,x_data.shape)
y_dara = np.square(x_data)+noice
# 创建占位符
x = tf.placeholder(tf.float32,[None,1]) # 1列 不限行
y = ... | true |
dd63b6a0db666e4e1517bee5633c59912f14657d | Python | abulka/pynsource | /src/tests/test_coords.py | UTF-8 | 8,361 | 3 | 3 | [] | no_license | import os
import unittest
from gui.settings import PRO_EDITION, LOCAL_OGL
if "TRAVIS" not in os.environ:
if PRO_EDITION:
# import ogl
from ogl2 import Shape, RectangleShape, LineShape
from ogl2 import OGLInitialize
from ogl2 import line_control_points_to_xy_points
else:
... | true |
ef0076c42eb5bd8c373b09ee24b2d2f4609ca700 | Python | APandher/ProjectEuler | /Problem 1.py | UTF-8 | 288 | 3.4375 | 3 | [] | no_license | import math
def main():
total = 0
end_limit = 1000
for number in range(1,end_limit):
if number%3== 0 or number%5 ==0:
total += number
return total
#Find the multiples of 3 below 1000
#Find the multiples of 5 below 1000
#Remove duplicates and add the remaining multiples
| true |
3fa3f468f762092a7e64af3230a2c0f1c111b5ea | Python | dalematt/MLBlog | /words.py | UTF-8 | 30,053 | 2.765625 | 3 | [] | no_license | # The MIT License (MIT)
# Copyright (c) 2015 Thoughtly, Corp
#
# 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 without limitation the rights
# to use, copy, mod... | true |
fd3b064392278c877b3476af4fc8ebf0babb621e | Python | valerioformato/pybatch | /parser.py | UTF-8 | 947 | 2.984375 | 3 | [] | no_license | import os, re
import yaml
class YamlParser():
def __init__(self):
self.yaml = None
def ImportFile(self, filename):
with open(filename, "r") as inputfile:
self.yaml = yaml.load(inputfile, Loader=yaml.FullLoader)
# print self.yaml
# print self.yaml['task']
def... | true |
0436db3792555357df7b8903eff25d57b63e4e10 | Python | hariPakala/FInLab | /MI.py | UTF-8 | 982 | 2.6875 | 3 | [] | no_license | '''
Created on Jun 7, 2018
@author: hari
'''
from pandas_datareader import data
import pandas as pd
from bokeh.plotting import figure, output_file, show
from datetime import datetime
class MI:
'''
classdocs
'''
def __init__(self):
'''
Constructor
'''
def getMI_... | true |
22ae21af0ffe07c82ce55d135002232f999cd026 | Python | nkim500/dogrates_tweet_engineering | /twitter_api.py | UTF-8 | 3,158 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
import os
import json
from tqdm import tqdm
from twitter_api_key import key
import tweepy
import pandas as pd
################################################################################
# Twitter API keys
consumer_key = key["consumer_key"]
consumer_secret = key["consumer_... | true |
e99bb2e8b75b9456de9a5c0ac198d48f8fd06855 | Python | ActiveZ/cnam-python | /partie1/intro.py | UTF-8 | 850 | 4 | 4 | [] | no_license | def test1():
a = 5
if a > 0:
# Si a est supérieur à 0
print("a est supérieur à 0.")
def print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint.
def bisex():
try:
annee = int(input("année... | true |
84c8a8f2782caf6c60a5a0a9a3993f9d68c84c01 | Python | Linzertorte/linzertorte.github.io | /nce3/a.py | UTF-8 | 168 | 2.65625 | 3 | [
"MIT"
] | permissive | N = 60
import os
al = xrange(301,301+N)
for i in al:
print ''' <tr>
<td><a href="%d.html">Lesson %02d</a><td>
</tr>'''%(i,i-300)
| true |
fbb257a076fd888019a03823aa97e3057650360b | Python | OGurel24/workshop | /Twitter-POM/pages/pages.py | UTF-8 | 1,695 | 2.609375 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.common.by import By
class MainPage:
REGISTER_BUTTON = (By.CLASS_NAME, "StaticLoggedOutHomePage-buttonSignup")
LOGIN_BUTTON = (By.CLASS... | true |
5c2ba017ce844014244fbb3dc6eac8752fadddaf | Python | rapid7/insightappsec-api-examples | /samples/python/get_vulnerability/script.py | UTF-8 | 901 | 2.875 | 3 | [] | no_license | import requests
# Setup standard parameters
region = "us"
api_url = f"https://{region}.api.insight.rapid7.com/ias/v1/"
api_key = "your-api-key-here"
api_path = "vulnerabilities/"
vuln_id = "00000000-0000-0000-0000-000000000000"
full_url = api_url + api_path + vuln_id
headers = {"X-Api-Key": api_key}
# Output from en... | true |
a241e0a79ed3b478797b385b15c34936d3ae41f4 | Python | mecha2k/mygo | /examples/naive/human_v_bot.py | UTF-8 | 1,327 | 2.703125 | 3 | [] | no_license | from __future__ import print_function
from dlgo import agent
from dlgo import goboard_slow as goboard
from dlgo import gotypes
from dlgo.utils import print_board, print_move, point_from_coords
def main():
board_size = 7
game = goboard.GameState.new_game(board_size)
bot = agent.RandomBot()
# while no... | true |
10a7a68f13795c94373554c3fe2016764ef3686c | Python | smzztx/roslearn | /beginner_tutorials/scripts/tcp_socket_server.py | UTF-8 | 1,845 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python
import rospy
import socket
import time
import threading
from std_msgs.msg import String
class tcp_socket_server(object):
def __init__(self):
rospy.init_node('tcp_socket_server', anonymous=False)
self.nodename = rospy.get_name()
rospy.loginfo("%s started" % self.nodena... | true |
260b35ef96afbaa09bcfd1bc8cc155b810ece7cd | Python | neelamy/Algorithm | /DP/Max_Sum_Contiguous_Subarray.py | UTF-8 | 934 | 3.625 | 4 | [] | no_license | # Source : https://www.interviewbit.com/problems/max-sum-contiguous-subarray/
# print the max sum as well as the array element for the max sum
# Algo/DS : DP
# Complexity :O(n)
class Solution:
def maxSubArray(self, A):
result = A[:]
ind = [0] * len(A)
for i in r... | true |
1658c5e9870be3cad8515eea2f027c00a621b98f | Python | amaj8/Deep_Learning_Project1 | /main.py | UTF-8 | 1,576 | 2.578125 | 3 | [] | no_license | import torch
import sys
from torch import nn
import torch.nn.functional as F
#from dl_assignment.py import Network
print("Aalo Majumdar\nM.Tech R, CSA, IISc\nSR#: 16116")
testfile = sys.argv[2]
input_file = open(testfile,"r")
output_file1 = open("Software1.txt","w")
output_file2 = open("Software2.txt","w")
PATH = "m... | true |
a4b4b5de8abafa8e217490379c7a6707ea77de58 | Python | ArnabBasak/PythonRepository | /python programs/MilkAndCokkies.py | UTF-8 | 501 | 3.390625 | 3 | [] | no_license | t = int(input("enter the number of test cases"))
while t!=0:
n = int(input("enter the number of min limak spend"))
while(n!=0):
food = input("limak had")
if food == "cookies" and food == "milk":
boolean = True
elif food == "cookies" and food == "cookies":
boolean = False
elif food == "mi... | true |
fd3d71449b32bdff715832e1f53f1ab0321e4a20 | Python | davidwagnerkc/TensorMONK | /pggan_cifar10.py | UTF-8 | 7,101 | 2.546875 | 3 | [
"MIT"
] | permissive | """ TensorMONK's :: Progressing growth of GANs on CIFAR10 """
from __future__ import print_function, division
import os
import sys
import timeit
import argparse
import numpy as np
import core
import torch
from core.NeuralEssentials import DataSets, MakeModel, VisPlots, SaveModel,\
MakeGIF
from to... | true |
0034868b7ce799f41c1579fd2cec085b00cf83ae | Python | codingsince8/numbers_to_english | /num_to_english/views.py | UTF-8 | 1,158 | 2.578125 | 3 | [] | no_license | from django.shortcuts import render
from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from num_to_english.numbers_to_english import NumberToWords
import json
from django.http import HttpResponse
@api_view(['GET'])
def num_to_english_view(requ... | true |
4f9673fb52109f458370504cee70c277771b77df | Python | Yuchen-Yan/UNSW_2017_s2_COMP9021_principle_of_programming | /labs/lab_4/my_answer/plane_encoding.py | UTF-8 | 2,525 | 3.03125 | 3 | [] | no_license | #This is written by Yuchen Yan for comp9021 lab4
'''
encode and decode
'''
def right(a,b):
a += 1
b = b
return [a,b]
def up(a,b):
a = a
b += 1
return [a,b]
def left(a,b):
a -= 1
b = b
return [a,b]
def down(a,b):
a = a
b -= 1
return[a,b]
def encode(a,b):
increm... | true |