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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
77ff9339b3dc4ae2f998087301703b615aa3d0a7 | Python | JACKEY22/Ref_Image_Processing_Basic | /2.3.bilinearInterpolation.py | UTF-8 | 1,029 | 3.9375 | 4 | [] | no_license | import numpy as np
def bilinear1d(x, y, ratio):
return (1-ratio)*x + ratio*y
def bilinear2d(point_4, x_ratio, y_ratio):
return (1-x_ratio)*(1-y_ratio)*point_4[0][0] + x_ratio*(1-y_ratio)*point_4[1][0] + (1-x_ratio)*y_ratio*point_4[0][1] + x_ratio*y_ratio*point_4[1][1]
def bilinear_interpolation(point_4, x_r... | true |
7b2134b50aee1ec0b3a0f41fe254aa5e41231370 | Python | bellalee01/leetcode | /offer20.py | UTF-8 | 667 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python
# coding=utf-8
'''
Date: 2021-01-15 09:39:44
Github: https://github.com/bellalee01
LastEditors: lixuefei
LastEditTime: 2021-01-15 09:40:03
FilePath: /leetcode/offer20.py
Description:
请实现一个函数用来判断字符串是否表示数值(包括整数和小数)。
例如,字符串"+100"、"5e2"、"-123"、"3.1416"、"-1E-16"、"0123"都表示数值,
但"12e"、"1a3.14"、"1.2.3"、"+... | true |
6a21dacbf2be85e7d78c015ba990c5aa14c16f98 | Python | ColinKennedy/USD-Cookbook | /concepts/variant_set_in_stronger_layer/python/variant_set.py | UTF-8 | 2,184 | 3.09375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""A module that shows how to author Variant Sets from stronger USD Layers.
Important:
All of the Stages here are created in-memory to avoid writing to
disk. Because of that, we use identifiers to refer to those Stages.
In production code, these identifiers sh... | true |
93dba1eacff304d5a7717d907f0ce73573e10c34 | Python | sunshot/LeetCode | /22. Generate Parentheses/solution1.py | UTF-8 | 756 | 3.6875 | 4 | [
"MIT"
] | permissive | from typing import List
class Solution:
def generateParenthesis(self, n: int) -> List[str]:
if n == 0:
return ['']
if n == 1:
return ['()']
if n == 2:
result = []
result.append('()()')
result.append('(())')
return result... | true |
c1f7ad1d43472755edca748e023ab860df61350c | Python | Kmerck88/100DaysofCode | /100Days/Day5/mad_libs.py | UTF-8 | 832 | 4.03125 | 4 | [] | no_license | adjective1 = input("Enter an adjective1").lower()
game = input("Enter the name of an outdoor game").lower()
adjective2 = input("Enter another adjective1").lower()
friend = input("Enter the name of a friend").capitalize()
verb = input("Enter a verb ending in ing: ").lower()
adjective3 = input("Enter one more adject... | true |
a5872fe7f9a6c8fe6d10a502206ec46007cb8ba7 | Python | MicaelSousa15/Exercicios | /69.py | UTF-8 | 133 | 3.125 | 3 | [] | no_license | >>> idade = 18
>>> # Comparações com números
>>> idade > 15
True
>>> idade < 28
True
>>> idade >= 12
True
>>> idade <= 24
True
>>> | true |
c8bfb43e89e7e351487d20e115b2d8bf3efff515 | Python | FrankZhaoYX/mobileanalyticslogging | /util/file_util.py | UTF-8 | 3,538 | 2.59375 | 3 | [] | no_license | import csv
import os
import re
import uuid
import pandas as pd
from pathlib import Path
from util import shell_util
def get_project_name_list(csv_path):
column_names = ['Keyword', 'Layout', 'LoggingLibrary', 'ProjectInfo', 'SearchResult']
csv_data = pd.read_csv(csv_path, names=column_names)
project_info_... | true |
e8b7b7c5ae80acba160c89210b9727441c52440c | Python | sakost/expiring_object | /expiring_object/expiring_object.py | UTF-8 | 1,518 | 3.15625 | 3 | [
"MIT"
] | permissive | from __future__ import print_function, with_statement
import time
import weakref
from threading import Thread
from collections import deque
class Dispatcher(Thread):
"""delete elements in thread in given expiring time
"""
def __init__(self, expiring_time, maxlen=None):
"""
:param expirin... | true |
c2ae6aea8228b7346a8b633665b85d4626272609 | Python | piyushgoyal1620/Python | /SumOfDigits.py | UTF-8 | 464 | 3.640625 | 4 | [] | no_license | '''
You're given an integer N. Write a program to calculate the sum of all the digits of N.
Input
The first line contains an integer T, total number of testcases. Then follow T lines, each line contains an integer N.
Output
Calculate the sum of digits of N.
Constraints
1 ≤ T ≤ 1000
1 ≤ N ≤ 1000000
Example
Input
3
1... | true |
45ffe9fddaac5045abd8e5a418b237865d3f3fb0 | Python | MarcelinoChagas/Python | /Android-IOS/012_EstruturaDados/iterandoLista.py | UTF-8 | 589 | 4.21875 | 4 | [] | no_license | # Não realiza a soma
# lista_numeros = [100,200,300,400]
# for item in lista_numeros:
# item += 1000
# print(lista_numeros)
# Codigo com Range
# lista_numeros = [100,200,300,400,2]
# for item in range(len(lista_numeros)):
# lista_numeros[item] += 1000
# print(lista_numeros)
print(range(0,4))
print(list(range(... | true |
07c1b685ec6569a696598db068c5fb519ac4f05d | Python | zhaola/583DataCollection | /extractionpass/build_cfgs.py | UTF-8 | 1,724 | 2.546875 | 3 | [] | no_license | import json
import sys
import os
import errno
def try_mkdir(dirname):
try:
os.mkdir(dirname)
except OSError as exc:
if exc.errno != errno.EEXIST:
raise
def build_cfgs(data_file, bb_dir):
with open(data_file, 'r') as infile:
for line in infile:
try:
... | true |
c8c79525e86cd6e950c05782012eb33cdf161746 | Python | Leodyfang/git_py | /IEMS 5703 NetworkCodingAndSystemDesign/week#7/cp_server.py | UTF-8 | 1,468 | 2.828125 | 3 | [] | no_license | import asyncio
import websockets
async def consumer_handler(websocket):
while True:
message = await websocket.recv()
# For each message received, pass it to the consumer coroutine
await consumer(message)
# Producer handler
async def producer_handler(websocket):
while True:
# Wa... | true |
9e51cc04d5583f9c1ebcf58320c6dda5a8790745 | Python | kim-hwi/Python | /해시/나는야포켓몬마스터이다솜.py | UTF-8 | 316 | 2.640625 | 3 | [] | no_license | D,Q = input().split()
dogamnum = {}
dogamstr = {}
for i in range(int(D)):
name = input()
dogamstr[name] = i+1
dogamnum[i+1] = name
for i in range(int(Q)):
qu = input()
try:
qu=int(qu)
print(dogamnum[qu])
except:
print(dogamstr[qu])
# print(dogamstr)
# print(dogamnum)
| true |
f6212e709038a9bf0d563f3468cf8b1693f3b7cc | Python | jayednahain/Essential-Functionality-Python | /ord_function.py | UTF-8 | 165 | 2.984375 | 3 | [] | no_license | """ord() function helps to find the unicode of character"""
print("unicode of B is",ord('B'))
print("unicode of b is",ord('b'))
print("unicode of C is",ord('C'))
| true |
7d4d03a3ea8d41b34802acf633d0ece9e3d05acb | Python | neuropheno-org/DeepNMA | /utils_DL.py | UTF-8 | 3,110 | 2.546875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 2 09:03:31 2020
@author: adonay
"""
import numpy as np
import math
from matplotlib import pyplot as plt
from tensorflow.keras.models import Sequential, Model
from tensorflow.keras.layers import (Dense, Flatten, Dropout, Conv1D,
... | true |
d0f2552ea6e9f690750e0c163a4b2d4910dd5b1f | Python | mohit-iitb/sagar | /IIT Guwahati _Python_DataScience/day3/194161013/194161013_q3a.py | UTF-8 | 834 | 3.109375 | 3 | [] | no_license | #fw=open('q3atextfile.txt','w+')
import tweepy
consumer_key = "deU56q5KBq6zogXd4W9U88LD6"
consumer_secret = "1X0o2gbMcZ6jYuVL0ns1gsGGlRvlDLmq0p1xmzZCsEPjZ3jg54"
access_token = "2894833632-CKKOP0j1odN2NfBUOgmuUSWNyTBlqivSBT0brjI"
access_token_secret = "rjbh9cRC1TuRkHUQdIwdnXcqizbvhfqUjofU5T4oncqKb"
# Creating the ... | true |
f63d2c53c12ce69b1331248efd5553588f2c0268 | Python | AttilaAV/szkriptnyelvek | /nyegyedik_o/dia.py | UTF-8 | 673 | 3.484375 | 3 | [] | no_license | #!/usr/bin/env python3
def diamond(szam):
if (szam % 2) != 1:
print("Kérlek, páratlan számot adj meg!")
else:
gyemantfel = int(szam/2)+1
sorcsillag = 1
for i in range(gyemantfel):
csillag =sorcsillag*"*"
sorcsillag += 2
print(csilla... | true |
9df2e343dcd5f697027d5a5c1a796a3d72aa4e15 | Python | slougn/PythonWF | /PythonCrashCourse/ch3/ex3.py | UTF-8 | 133 | 3.1875 | 3 | [] | no_license | names = ['xiaoming','xiaohong','dalei','hanmeimei']
print(names)
print(names[0])
print(names[3])
print(names[0].title()+" ,welcom!") | true |
334c2555361979cb2d87df2894660b00d2820f71 | Python | doosea/god_like | /myDataStructuresAndAlgorithms/BinarySearch/leetcode000.py | UTF-8 | 386 | 3.765625 | 4 | [] | no_license | """
二分查找升序数组
"""
def binary_search(nums, target):
l = 0
r = len(nums) - 1
while l <= r:
m = (l + r) // 2
if nums[m] == target:
return m
if nums[m] < target:
l = m + 1
else:
r = m - 1
return -1
if __name__ == '__main__':
nums = [... | true |
c951aceeba4c5f64a37578a7bde5bc7c9f804945 | Python | Orb-H/nojam | /source/nojam/2740.py | UTF-8 | 380 | 2.53125 | 3 | [] | no_license | n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]
m, k = map(int, input().split())
b = [list(map(int, input().split())) for _ in range(m)]
r = [[0] * k for _ in range(n)]
for i in range(n):
for j in range(k):
for h in range(m):
r[i][j] += a[i][h] * b[h][j]
... | true |
e99111ecad1255d285887610d9c2722e01b62ced | Python | drewblount/2014-2015 | /thesis/code/numpy_dace/ego.py | UTF-8 | 15,344 | 3.046875 | 3 | [] | no_license | ## an object-oriented EGO algorithm machine
from math import exp, pi, sqrt
import numpy as np
from scipy import linalg as la
from scipy.optimize import minimize
from scipy.stats import norm
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider
from operator import add, sub
import logging
log = loggi... | true |
417710346fdc87291d351916d46a53ab2a550b7e | Python | DiegoHeer/sec_web_scraping | /cik_ticker_mapping.py | UTF-8 | 659 | 3.34375 | 3 | [] | no_license | import requests
def get_cik_from_ticker(ticker):
# Official SEC url that contains all the CIK x Ticker data
base_url = 'https://www.sec.gov/include/ticker.txt'
txt_content = requests.get(base_url).text
mapping_dict = dict()
for mapping in txt_content.split('\n'):
company_ticker = mapping... | true |
a8f4727744387f7b550c35830b20eee737a46334 | Python | python-provy/provy | /provy/more/debian/users/ssh.py | UTF-8 | 2,712 | 2.875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Roles in this namespace are meant to provide SSH keygen utilities for Debian distributions.
'''
from os.path import join
from Crypto.PublicKey import RSA
from provy.core import Role
class SSHRole(Role):
'''
This role provides SSH keygen utilities for Debian di... | true |
88432a33f4595c75c106fd12bfcbc9a40861e152 | Python | mdxys/library-feature-generation | /tests/transformation/gym/test_gym_create_data.py | UTF-8 | 2,671 | 2.75 | 3 | [] | no_license | import numpy as np
import pytest
from alphai_feature_generation.transformation import GymDataTransformation
from tests.transformation.gym.helpers import load_preset_config, gym_data_fixtures
@pytest.mark.parametrize("index", [0, 1, 2])
def test_create_data(index):
expected_n_samples = 49
expected_n_time_dict... | true |
e20ac63bb4a6254ee018535ec79331beb88b63e0 | Python | esther-soyoung/Coding-Challenge | /KakaoBlind2020/lock.py | UTF-8 | 3,092 | 3.390625 | 3 | [] | no_license | def solution(key, lock):
M = len(key)
N = len(lock)
# Get the coordinates of holes in lock
holes = []
for i in range(N):
for j in range(N):
if lock[i][j] == 0:
holes.append((i, j))
# Get the coordinates of bumps in key
bumps = []
for i in range(M):
... | true |
f9fc1da173dce4b537448b8ffc3fab195a689a19 | Python | OSHistory/wikidata2geojson | /wikifetcher.py | UTF-8 | 845 | 2.921875 | 3 | [
"MIT"
] | permissive |
import json
import urllib.request as request
class WikiFetcher():
def __init__(self):
self.id_query_templ = "https://www.wikidata.org/w/api.php?action=wbgetentities&ids={idlist}&format=json&languages=en"
pass
def get_json_resp(self, url):
req = request.urlopen(url)
cont = r... | true |
06555616862865657e87f45bc9b9e7c07555c391 | Python | chenQ1114/HR-BiLSTM | /deploy/server.py | UTF-8 | 3,025 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python3
"""
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
import logging
import numpy as np
from keras.models import Model
import sys
import os
from io import BytesIO
import simplejson
sys.path.appen... | true |
97fa38228ec387b0a8d4d604b76926052dd0c244 | Python | hermanwongkm/AlgoPratice | /Permutations/subetII.py | UTF-8 | 1,147 | 3.578125 | 4 | [] | no_license | # Given an integer array nums that may contain duplicates, return all possible subsets (the power set).
# The solution set must not contain duplicate subsets. Return the solution in any order.
# Example 1:
# Input: nums = [1,2,2]
# Output: [[],[1],[1,2],[1,2,2],[2],[2,2]]
# Example 2:
# Input: nums = [0]
# Outp... | true |
6d19163bc3d439584363cc58170f28af2d460f1f | Python | bayoishola20/Python-All | /Random/CartographicSoftwareAdaptationExercises/HW_1.py | UTF-8 | 2,573 | 4.6875 | 5 | [] | no_license | ##### Topic 1: Working with standard Python lists
''' Create a random list
Create a nested list of 60 elements arranged in 10 sub-lists of 6 entries each to be filled with randomly distributed integer values between 0 and 15 '''
import random
# using list comprehension
print "Nested list (list comprehension): ", [... | true |
88fa3acd27055cf95e0717de5ab6766d31c5d258 | Python | caiohrgm/Projeto-PIBIC-UFCG-2019-2020---Machine-Learning-e-Apostas-Esportivas | /baseFunctions_NaiveBayes.py | UTF-8 | 4,909 | 3.28125 | 3 | [] | no_license | import pandas as pd
import xlrd
def createDataFrame():
colunas = ['x1', 'x2', 'x3', 'x4', 'x5', 'x6', 'x7', 'x8', 'x9', 'x10', 'x11',
'x12', 'x13', 'x14', 'x15', 'x16', 'x17', 'x18', 'x19', 'x20']
df = pd.DataFrame(columns=colunas)
return df
def treinaIndiceMandante(rodadas,dataSet):
li... | true |
1ac165c269ec578bd71d53b1e3f08aa8e6989133 | Python | kunyuan/ParquetMC | /utility/angle.py | UTF-8 | 2,879 | 3.140625 | 3 | [] | no_license | from scipy.special import eval_legendre
from scipy import integrate
import sys
import os
import numpy as np
import unittest
def mult_along_axis(A, B, axis):
"""
return A[..., i, ...]*B[i],
where B[i] is broad casted to all elements of A[..., i, ...]
"""
A = np.array(A)
B = np.array(B)
# ... | true |
630c398193967fe06d8b9eedc1c418e8df879e32 | Python | ahviplc/pythonLCDemo | /com/lc/demo/numpyDemo/numpyDemo.py | UTF-8 | 1,367 | 3.734375 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
numpyDemo
Version: 0.1
Author: LC
DateTime: 2018年6月17日21:41:55
一加壹博客最Top-一起共创1+1>2的力量!~LC
LC博客url: http://oneplusone.top/index.html
"""
import numpy
print ('使用列表生成一维数组')
data = [1,2,3,4,5,6]
x = numpy.array(data)
print (x) #打印数组
print (x.dtype) #打印数组元素的类型
print ('... | true |
319882a52f0c9a9aa2122c17b2c676072606087c | Python | palaciossruben/acerto | /testing_webpage/basic_common.py | UTF-8 | 1,095 | 2.875 | 3 | [] | no_license | """
This a base file, that cannot import any models.
As it will refactor code among models. Its is used to solve the
circular dependency problem of having "common.py" import models and also refactor model code.
"""
import re
ADMIN_USER_EMAIL = 'admin@peaku.co'
def change_to_international_phone_number(phone, calling_c... | true |
dc9c7ae9dfba0ddf683f27aab5ed985a18734bc3 | Python | youhusky/Facebook_Prepare | /285. Inorder Successor in BST.py | UTF-8 | 561 | 3.59375 | 4 | [
"MIT"
] | permissive | # Given a binary search tree and a node in it, find the in-order successor of that node in the BST.
# Note: If the given node has no in-order successor in the tree, return null.
class Solution(object):
def inorderSuccessor(self, root,p):
succ = None
while root:
if p.val < root.val:
succ = root
root = ... | true |
29492745c9bed224bad11640ad9263a1e634238c | Python | krishauser/reem | /reem/accessors.py | UTF-8 | 10,519 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | from __future__ import print_function
from threading import Thread, Lock
import redis
from .utilities import *
_ROOT_VALUE_READ_NAME = "{}ROOT{}".format(ROOT_VALUE_SEQUENCE, ROOT_VALUE_SEQUENCE)
_TYPEMAP = {
'object':dict,
'array':list,
'integer':int,
'number':float,
'boolean':bool
}
class Metada... | true |
cda6e95660df620b50c37ef4611032d72abe8804 | Python | hillbs/Trigonometry-Programlets | /stdutils.py | UTF-8 | 3,516 | 3.4375 | 3 | [
"Apache-2.0"
] | permissive | # A module for various math-related functions
import sys
import math
from fractions import Fraction
# Special Unicode characters
specials = {'pi': 'π', 'degree': '°', 'theta': 'θ', 'approx': '≈', 'root': '√'}
cTheta = 'θ'
cPi = 'π'
cDegree = '°'
cRoot = '√'
cApprox = '≈'
# Constants for a user to convert values in in... | true |
a8a677e3570024195332d61034fc2d4632aba8d3 | Python | Ronan-H/advent-of-code-2020 | /day-4/part-2.py | UTF-8 | 1,383 | 2.875 | 3 | [] | no_license | import re
def hgt_validator(hgt):
unit = hgt[-2:]
num = hgt[:-2]
if unit == 'cm':
return 150 <= int(num) <= 193
elif unit == 'in':
return 59 <= int(num) <= 76
else:
return False
hcl_pattern = re.compile(r'^#[0-9a-f]{6}$')
pid_pattern = re.compile(r'^[0-9]{9}$')
eye_colou... | true |
6dd8fe1a35a8133bcd87f90ab587085eeec3951f | Python | hyh2010/ECE1548-project | /Queuesim/testTrafficSource.py | UTF-8 | 2,007 | 2.796875 | 3 | [] | no_license | import unittest
import simpy
import numpy as np
from TrafficSource import TrafficSourceConstInterarrival
from Server import ServerConstServiceTime
class testTrafficSource(unittest.TestCase):
def setUp(self):
service_time = 5
env = simpy.Environment()
self.__server = ServerConstServiceTime... | true |
8739c5a460633d1327e22f20c21ca596a45eb682 | Python | pucekdts12/Python2020 | /Zestaw04/main.py | UTF-8 | 2,238 | 3.4375 | 3 | [] | no_license | import argparse,ast,itertools as it,re
def zadanie3(args):
nested_lists = ast.literal_eval(args.list)
output = [ sum(l) for l in nested_lists ]
print(output)
def zadanie4(args):
if not re.findall('^(M{0,3})(CM|CD|D{0,1}C{0,3})(XC|XL|L{0,1}X{0,3})(IX|IV|V{0,1}I{0,3})$',args.roman):
print(f"{args.roman} nie... | true |
d911d72ca965641517a9217285ca4435eceb58fa | Python | 42Swampy/testdateien | /test_rss.py | UTF-8 | 534 | 2.9375 | 3 | [] | no_license | #! /usr/bin/python
# -*- coding: utf-8 -*-
#
# Test von feedparser
import os
import feedparser
import time
# Deklarieren der Variabeln
ganzer_feed = ""
# Feed herunterladen
print ("Lade RSS-Feed")
d=feedparser.parse("http://rss.kicker.de/news/2bundesliga")
print ("RSS-Feed geladen")
# Titel als erstes
ganzer_feed ... | true |
fe6b399d7b89ec5df3f31a1383067b31e83ae62a | Python | rizquadnan/codeForces | /14_stonesOnATable.py | UTF-8 | 413 | 3.234375 | 3 | [] | no_license | num_raw = int(input())
stones = list(input())
count = 0
if stones.count("R") > 1 or stones.count("B") > 1 or stones.count("G") > 1:
for idx, stone in enumerate(stones):
if idx == 0:
if stone == stones[idx + 1]:
count += 1
elif idx == len(stones) - 1:
pass
... | true |
38ed7a5f5c9d4b8373ba519bd0109172f2dcee67 | Python | BenMusch/social-chess | /social-chess/chessnouns/tournament.py | UTF-8 | 7,513 | 3.34375 | 3 | [
"Apache-2.0"
] | permissive | """
This class will keep track of an individual tournament
"""
import chessnouns
from . import slot
from . import player
from . import game
from datetime import date
from chessutilities import tiebreakers
import logging
import logging.config
logging.config.fileConfig('logging.conf')
logger = logging.getLogger('tournam... | true |
b6253d791848d2c0769e120db480265aa03c646f | Python | profnssorg/capm | /CAPM - Versão final (sem unittest)/Unit tests/data_collect.py | UTF-8 | 1,025 | 2.703125 | 3 | [] | no_license | # Packages importation
import pandas as pd
from yahoofinancials import YahooFinancials
from sgs import SGS
# Defining Tickers, Market Return and Risk-Free Rate for usage
Tickers = ['USIM5.SA']
MarketReturn = ['^BVSP']
RiskFree = SGS()
# Collecting Tickers Historical Data
Period = 'daily'
Start_Date = '2019-02-15'
... | true |
dc3f14819cbc3fe98b91bb64d9228b11e0b064ac | Python | realayo/mentorship-py | /week-1/checksum.py | UTF-8 | 262 | 3.796875 | 4 | [] | no_license | def CheckNums(num1, num2):
if num1 == num2:
return - 1
elif num2 > num1:
return True
else:
return False
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
print (CheckNums(num1, num2)) | true |
21572c35e9ceaf06dea5ebf46ea2383108c5068b | Python | dizid2539/embadded_software | /run.py | UTF-8 | 2,517 | 3.0625 | 3 | [] | no_license | #!/usr/bin/env python3
from ev3dev.ev3 import *
from time import sleep
#임시 설정
temp_left_wheel = LargeMotor('outA')
temp_right_wheel = LargeMotor('outD')
temp_led = Leds()
temp_led.all_off()
sleep(1)
temp_left_wheel.run_forever(speed_sp = 100)
temp_right_wheel.run_forever(speed_sp = 100)
sleep(5.5)
temp_left_wheel.stop... | true |
73fd361478de7a553f27256cc706725d61e9ecd6 | Python | aRToLoMiay/Special-Course | /Первые шаги/area_and_circumference.py | WINDOWS-1251 | 305 | 3.5 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# 3.
from math import pi
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
r = 2
A = pi*r**2
C = 2*pi*r
print " = %f \n = %f" % (A, C) | true |
fed60295f19343edd2d06c2a9c3fd5538410010e | Python | tm-26/Enhancing-stock-price-prediction-models-by-using-concept-drift-detectors | /src/experiments/experiment7.py | UTF-8 | 2,784 | 3.3125 | 3 | [] | no_license | # Experiment 7 evaluates method 3
import csv
import matplotlib.pyplot
import os
import pandas
import sys
sys.path.append("..")
from main import main
if __name__ == "__main__":
"""
Parameters:
args[0] --> splitDays parameter
Controls how many days the model waits before starting to train... | true |
acc740793e9528d3885c10bce9bb2a775f07d9d0 | Python | Aasthaengg/IBMdataset | /Python_codes/p03855/s915979030.py | UTF-8 | 3,020 | 2.9375 | 3 | [] | no_license | from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import permutations,combinations
from collections import defaultdict,Counter
from pprint import pprint
def myinput():
return map(int,input().split())
def mycol(data,col):
return [... | true |
7fe820cee2066161071adaac4b7fbb53b61ca523 | Python | Tommo2365/pythonMiscCode | /CSVWrite.py | UTF-8 | 399 | 3 | 3 | [] | no_license | import numpy
import numpy as np
import matplotlib.pyplot as plt
import csv
def CSVWrite(fileName, numpyArray):
print('WritingFile File: ' + fileName)
with open(fileName,'w', newline = '') as csv_file:
csv_writer= csv.writer(csv_file, delimiter = ',')
# line_count = ... | true |
cc702e154322159bbc03e4b42cb9c0294dff0385 | Python | JKodner/gofish | /gofish.py | UTF-8 | 3,194 | 3.171875 | 3 | [] | no_license | import random
import sys
deck = []
ud = []
udt = []
cd = []
cdt = []
COUNT = " "
count = 1
card_count = 0
first = ["user", "com"]
choices = ["", "deck", "draw", "exit", "com", "decks"]
def sep(s, n):
print s * n
NUM = " "
sep(" ", 1)
sep("-*-", 1)
while type(NUM) != int:
try:
NUM = int(raw_input("To What Range do Y... | true |
5a880150e2f5e807f5d8f7e30aa14848fdbce069 | Python | Superbeet/LeetCode | /Minimum_Height_Trees.py | UTF-8 | 1,800 | 3.359375 | 3 | [] | no_license | # 116, remove outdegree 0 nodes one by one until every node only has one adjcent node
class Solution(object):
def findMinHeightTrees(self, n, edges):
"""
:type n: int
:type edges: List[List[int]]
:rtype: List[int]
"""
adj_list = [set() for j in range(n)]
... | true |
301747c7e6513e4c6b58dd4ed9681765d93414cb | Python | CatOfTheCannals/programming-language-paradigms | /practicas/resolucion_logica/Charly/ex2.py | UTF-8 | 1,633 | 3.375 | 3 | [] | no_license | I.
i)
FNC: p v (¬p)
FC: {p, ¬p}
negamos
{¬p}, {p}
el resolvente es []
la formula original es tutologia
ii)
FNC: ¬p v ¬q v p
FC: {¬p, ¬q, p}
negamos
{p}, {q}, {¬p}
resolvente de p y ¬p es []
es tautologia
iii)
FNC: (¬p v p) ^ (¬q v p)
FC: {¬p, p}, {¬q, p}
negamos
(p ^ ¬p) v (q ^ ¬p)
distribuimos
((p v (q ^ ¬p)) ^... | true |
8b30945ddac420b2a86ae254dcc970f77bee936b | Python | Ghostkeeper/Luna | /plugins/configuration/configurationtype/configuration_error.py | UTF-8 | 1,294 | 2.984375 | 3 | [
"CC0-1.0"
] | permissive | #!/usr/bin/env python
#-*- coding: utf-8 -*-
#This software is distributed under the Creative Commons license (CC0) version 1.0. A copy of this license should have been distributed with this software.
#The license can also be read online: <https://creativecommons.org/publicdomain/zero/1.0/>. If this online license dif... | true |
4fd30e2067ab752c9590d2289b25043f357463ec | Python | VeritasCurat/Synja | /project/dialog/simpleNLU_EN.py | UTF-8 | 1,295 | 2.84375 | 3 | [] | no_license | '''
Created on 17.05.2019
@author: Johannes
Problem: RASA NLU kann teilweise sogar nicht trainingsdaten zu intents parsen (>40%)
Beispiel: 'intent': {'name': 'gruss', 'confidence': 0.344466498747804}, 'entities': [], 'text': 'hi'}
Bildet die trainingsdaten auf intents ab. Als sicherung das einfachste Eingaben... | true |
fe5e7b215a96d58b90f31da24d5804ce2a699575 | Python | trucktrav/MATE_HELPER | /DB_Helper/select_attrs.py | UTF-8 | 670 | 2.578125 | 3 | [] | no_license | import tkinter as tk
import sqlite3
from sqlite3 import Error
import os
import pandas as pd
import pySelector
def get_header():
sql_headers = 'SELECT header FROM tbl_header;'
pwd = os.path.abspath(os.path.dirname(__file__))
database = pwd + '\\metrics_database.db'
db = sqlite3.connect(database)
he... | true |
b2721795d9d15dd2adf364db3f36427de3bb78a4 | Python | DevinKlepp/barnsley-fern | /barnsleyfern.py | UTF-8 | 1,137 | 3.8125 | 4 | [] | no_license | # Program that produces barnsley fern image
# Devin Klepp July 21st 2018
import time
import graphics as g
import random as r
# Calculating time to see which program is faster
start_time = time.time()
xold = 0 # Initial points are at the origin
yold = 0
width = 700
height = 700
# Plotting surface
win = g.GraphWin("B... | true |
db71bcd3022acd85dc5f06673c2e29fda63fc70e | Python | narang99/nbtex | /nbtex/core/operators/Operator.py | UTF-8 | 1,276 | 2.515625 | 3 | [
"MIT"
] | permissive | from nbtex.LatexInterface.LatexFormatters import LatexBasicFormatter
from functools import partial
class BasicOperator:
def __init__(self, precedence, combine):
self._precedence, self._combine = precedence, combine
def __call__(self, *args):
return self._combine(*args)
@property
def ... | true |
9b5f1c1e2d2c09754e7c0a6c5075c685dec2a4c7 | Python | kapoor-rakshit/Miscellaneous | /Rotate array.py | UTF-8 | 846 | 3.859375 | 4 | [] | no_license | def leftrotate():
reverse(0,op-1) #reverse first op elements
reverse(op,n-1) #reverse remaining elements
reverse(0,n-1) #revese entire list
def rightrotate():
reverse(n-op,n-1) #reverse last op elements
reverse(0,n-op-1) #reverse remaining elements
reve... | true |
bc18ee74f7efd828fa1834c30ff5e94df86bd336 | Python | sgametrio/hockey-stick-monitor | /server/lab.py | UTF-8 | 312 | 2.640625 | 3 | [] | no_license | import numpy as np
import pandas as pd
from scipy import integrate
gen = np.random.RandomState(0)
x = gen.randn(100, 10)
names = [chr(97 + i) for i in range(10)]
df = pd.DataFrame(x, columns=names)
print(df.head())
df = df.apply(lambda x: np.insert(integrate.cumtrapz(x.values), 0, 0, axis=0))
print(df.head())
| true |
36ceae0a1d02d2cb76877650f817a4c9e6320a51 | Python | lllchen/python100daysscript | /08/08practice1.py | UTF-8 | 657 | 3.265625 | 3 | [] | no_license | #!/usr/bin/env python3
#-*- coding=utf-8 -*-
'''
定义一个类描述数字时钟
'''
__auther__ = 'BrilliantDawn'
import time
class numClock(object):
def __init__(self) -> None:
self.__hours = 0
self.__minutes = 0
self.__seconds = 0
def run(self):
while True:
self.__hours = time.lo... | true |
282578da6d2ab198b66b411ecbb3d39227593ee2 | Python | slickFix/Python_algos | /DS_ALGO/GFG_practise/Doubly_ll_merge_sort.py | UTF-8 | 4,642 | 3.6875 | 4 | [] | no_license | import random
class Node:
def __init__(self,data):
self.data = data
self.next_node = None
self.prev_node = None
class Doubly_ll:
def __init__(self):
self.head = None
def insert_l(self,data):
new_node = Node(data)
curr = self.head
if curr is No... | true |
b7be81be771d87da097a7fac8bf8f8c240a63931 | Python | julie-ngu/Unit0-04 | /hello_world_international.py | UTF-8 | 615 | 2.921875 | 3 | [] | no_license | # Created by: Julie Nguyen
# Created on: Sept 2017
# Created for: ICS3U
# Daily Assignment - Unit0-04
# This program is the Hello, World! program, but as a GUI with 3 buttons
import ui
def english_touch_up_inside(sender):
# displays the English version
view['hello_world_label'].text = ('Hello, World!')
def f... | true |
94b4edcce45a58fbd1ca21776c521f66bc15c8b1 | Python | baxpr/sct-singularity | /fmri_pipeline/make_gm_rois.py | UTF-8 | 3,453 | 2.8125 | 3 | [] | no_license | #!/opt/sct/python/envs/venv_sct/bin/python
#
# Load fmri space masks and create dorsal and ventral ROIs
import sys
import nibabel
import numpy
import scipy.ndimage
gm_file = sys.argv[1]
label_file = sys.argv[2]
# Load images
gm = nibabel.load(gm_file)
label = nibabel.load(label_file)
# Verify that geometry matches
... | true |
7f529d9518c6c3602b509eaba1d05e7501ef4cae | Python | est22/PS_algorithm | /스택,큐,덱/10828.py | UTF-8 | 575 | 3.359375 | 3 | [] | no_license | import sys
input = sys.stdin.readline
stack = []
for i in range(int(input())):
func = input().split()
if func[0] == 'push':
stack.append(func[1])
elif func[0] == 'pop':
if len(stack) == 0:
print(-1)
else:
print(stack.pop())
elif func[0] == 'size':
... | true |
a0fc186f1a97fabdecde3288f79c0f74d42d9eb3 | Python | dhanin/Hangman | /Problems/Prime number/main.py | UTF-8 | 271 | 3.625 | 4 | [] | no_license | number = int(input())
if number > 1:
i = 2
while i * i <= number:
if number % i == 0:
print("This number is not prime")
exit()
i += 1
print("This number is prime")
elif number == 1:
print('This number is not prime') | true |
6ec8176571e52e9899413e7febc5220c7162e2a2 | Python | Tulip4attoo/tetris_python | /game_objects.py | UTF-8 | 4,413 | 3.09375 | 3 | [] | no_license | import numpy as np
import utils
import bricks
import cfg
import random
class Field():
"""
the field contains a numpy array that represents the field.
"""
def __init__(self):
"""
"""
self.padding_size = cfg.PADDING
self.field_render = np.zeros(cfg.FIELD_SHAPE)
s... | true |
a70a1f0f1c0789e8b9271c5028a7d5847a9fc6b3 | Python | anabcm/Social_Network_Analysis | /code/Social_network_analysis.py | UTF-8 | 20,467 | 2.765625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#Contruyendo la estructura de la red
#Este codigo explora la estructura y directorio de los datos de transparencia que se encuentran en el POT
#publicados por INAI en abril del 2016
#El código interactua con una base de datos en postgres, las consultas son basicas en SQL
#a... | true |
774138d7482fb4c8889559eebf09e208759f589b | Python | IanMendozaJaimes/SuperTT | /MexpTokenizer/convertExpressions.py | UTF-8 | 610 | 2.609375 | 3 | [] | no_license | from NSequenceToLatex import Converter
import os
csv_file = '/Users/ianMJ/Downloads/CROHME_dataset_v5/tokenized.csv'
BEGIN = 1000
END = 1001
c = Converter()
file = open(csv_file, 'r')
info = file.read().split('\n')
tokens = open('expressions.txt', 'w')
for moreInfo in info:
temp = moreInfo.split(',')
sequen... | true |
d4a8c872c42d460c85830e6ae0ae891f1241791f | Python | shizzard/veon-test-task | /opt/03_movie_reserve_test.py | UTF-8 | 2,048 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
from common import *
import unittest
class ReservationAddTestCase(unittest.TestCase):
def setUp(self):
self.imdb_id = generate_random_string(16)
self.screen_id = generate_random_string(16)
self.available_seats = 1
self.conn = get_connection()
data = mov... | true |
f0d595da8e91774785874dc02091d23a5bda6065 | Python | farjadfazli/code-challenges | /binary-search.py | UTF-8 | 480 | 4 | 4 | [] | no_license | def binary_search(arr, target):
min_idx = 0
max_idx = len(arr) - 1
while min_idx < max_idx:
mid_idx = (min_idx + max_idx) // 2
if target == arr[mid_idx]:
return mid_idx
elif arr[mid_idx] < target:
min_idx = mid_idx + 1
else:
... | true |
dec9ba9788986a0a595aecb3e402e8b90515decf | Python | HugoCotton/TKintwer-Converter | /conversion.py | UTF-8 | 9,944 | 2.796875 | 3 | [] | no_license | import tkinter
from tkinter import ttk
from tkinter import *
root = tkinter.Tk()
root.title('Conversion')
root.config(bg = 'gray15')
weightans = 'Please enter an answer'
tabControl = ttk.Notebook(root)
mainframe = Frame(tabControl)
mainframe.configure(bg = '#040000')
mainframe.pack(pady = 125, padx = 225)
mainframe.... | true |
4dd3f0c40c78ddb9780e146698314e52435d4137 | Python | codio-content/Python_Maze-Logical_thinking_decompositions_and_algorithms_-functions | /.guides/tests/ch-3.py | UTF-8 | 779 | 2.65625 | 3 | [
"MIT"
] | permissive |
energy = 0
score = 0
steps = 1
def getEnergy():
global energy
return energy
def setEnergy(val):
global energy
energy = val
def setScore(val):
global score
score = val
def getSteps():
global steps
return steps
try:
execfile('/home/codio/workspace/public/py/ch-3.py')
hitEnergyEvent()
if... | true |
6b8143ee3eb834496fd93eca8f6a0a1f3d5332f5 | Python | amundmr/FYS2210-Report | /Plotters/Curren-Vg_10um.py | UTF-8 | 1,164 | 2.9375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import sys
#Reading file
#f = open(sys.argv[1],"r")
f1 = open("../Data/10um/w2_vg_1v_10um_50x50","r")
f2 = open("../Data/10um/w2_vg_2v_10um_50x50","r")
f3 = open("../Data/10um/w2_vg_3v_10um_50x50","r")
f4 = open("../Data/10um/w2_vg_4v_10um_50x50","r")
f5 = open("../Da... | true |
45fae260f3ae471347747792610a79d46e3ea460 | Python | hbcbh1999/pydp | /tests/cluster_test.py | UTF-8 | 2,040 | 2.53125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import sklearn.datasets as dss
from scipy.spatial.distance import euclidean
import src.cluster as cluster
import time
from mpl_toolkits.mplot3d import Axes3D
from __non_private_cluster__ import find_cluster
sample_number, dimension = 10000, 2
blobs = dss.make_blobs(s... | true |
4e419dd7be38adc40546bebea74f03146e71b403 | Python | anderslatif/alg | /util/commit_handling/commit_or_tag_parser.py | UTF-8 | 1,195 | 3.25 | 3 | [
"MIT"
] | permissive | import collections
def commit_or_tag_parser(raw, start=0, dictionary=None):
if not dictionary:
# This is set to None as a parameter to avoid recursive calls
dictionary = collections.OrderedDict()
space = raw.find(b' ', start)
newline = raw.find(b'\n', start)
# Base case
if (spac... | true |
230a589e6a1fb902c77ed2c6e6b47e3088c1b31b | Python | zmahoor/TPR-1.0 | /analysis/group_mind.py | UTF-8 | 5,861 | 2.734375 | 3 | [] | no_license | '''
Author: Zahra Mahoor
My attempt in studying social influence in TPR, group mind.
'''
import sys
import matplotlib.pyplot as plt
sys.path.append('../bots')
from database import DATABASE
import numpy as np
from random import shuffle, choice
from copy import deepcopy
def find_repeats(mylist):
count = 0
for i... | true |
6fe9930cb53d7e905bab099b646f25483a3face3 | Python | FengZhang-git/EJSC | /code/data_process/data_loader.py | UTF-8 | 4,911 | 2.578125 | 3 | [] | no_license | from data_process.sampling import EpisodeDescriptionSampler
from data_process.dataset_spec import DatasetSpecification
from data_process.config import EpisodeDescriptionConfig
from collections import defaultdict
import gin
import json
from data_process.learning_spec import Split
import numpy as np
def get_data(path):
... | true |
039bcbe0adafa6b1788d17b527aa3f38dfaa7455 | Python | Viktor32-sours/Eiler | /26/26.py | UTF-8 | 1,354 | 3.921875 | 4 | [] | no_license | """
Взаимные циклы
Задача 26
Дробная единица содержит 1 в числителе. Десятичное представление дробных единиц с знаменателями от 2 до 10 дано:
1/2 = 0.5
1/3 = 0.(3)
1/4 = 0.25
1/5 = 0.2
1/6 = 0.1(6)
1/7 = 0.(142857)
1/8 = 0.125
1/9 = 0.(1)
1/10 = 0.1
Где 0,1 (6) означает 0,166666 ... и имеет по... | true |
5a5e0f0e236bf22291e193afa17d9dccac67591d | Python | lemcke/md_extraction_analysis | /analysis/eos/eos.py | UTF-8 | 3,625 | 3.5 | 4 | [] | no_license | import numpy as np
from scipy.optimize import curve_fit
from scipy.misc import derivative
class EnergyVolumeEOS:
"""
Energy-volume equation of state (EOS).
Attributes
----------
volumes: <numpy.ndarray> of volumes
energies: <numpy.ndarray> of energies
fit_func: <callable> function to use as EOS
fit_guess:... | true |
2cb3cad2afff7ef1839f06d8139207e0fc490cd0 | Python | jdudley390/automation-and-practive | /Practice Projects/tax calculator.py | UTF-8 | 286 | 4 | 4 | [] | no_license | price = float(input("Enter the price of the item: $"))
while price != 0:
tax = price * .08
total = tax + price
print("The full price of the item with tax is: $", format(total, '.2f'), "\n")
price = float(input("Enter proce of another item orS press 0 to exit: $")) | true |
8b69f1da2d6b9595fd507d5d5fc12a2cd11f4773 | Python | koleon03/SKSoftware | /luefterOn.py | UTF-8 | 2,197 | 2.796875 | 3 | [] | no_license | import gpiozero
import time
import adafruit_bme280
import board
import busio
#Globale Variablen
isOpen = False
is2Open = False
luefterOn = False
aufP = "BOARD36"
aufM = "BOARD32"
zuP = "BOARD31"
zuM = "BOARD33"
lPin = "BOARD37"
delay = 5
#Initialisieren der Relais und Sensoren
relayAP = gpiozero.OutputDevice(pin=a... | true |
97ea0abfdec33da9d35b82a76806fd0c52acbd0f | Python | ryfeus/lambda-packs | /Tensorflow/source/tensorflow/contrib/kernel_methods/python/mappers/random_fourier_features.py | UTF-8 | 6,609 | 2.625 | 3 | [
"MIT"
] | permissive | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# 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 applica... | true |
e2226e13c3e425d51d099c914c72e63cf63d73c1 | Python | andb0t/legofy | /legofy.py | UTF-8 | 3,624 | 3.09375 | 3 | [] | no_license | import numpy as np
import pandas as pd
import requests
from bs4 import BeautifulSoup
from PIL import Image, ImageFilter
from sklearn.neighbors import NearestNeighbors
import src.utils as utils
def load_colors():
black_and_white = False
print('Getting available colors ...')
# download the color table webs... | true |
c1cc3037694976b41a04e573b3a534a1f33d4411 | Python | ratakas/pythonAcademy | /appMusic/appv1/convertir.py | UTF-8 | 186 | 2.703125 | 3 | [] | no_license | import re
texto='Afaz Natural - "Quizás" LETRA (Video Lyric)'
removeSpecialChars = texto.translate ({ord(c): "" for c in "!@#$%^&*()\"[]{};:,./<>?\|`~-=_+"})
print(removeSpecialChars) | true |
dae13781a32056075e2db8fff99eff3651a11dc7 | Python | s-tefan/pygletgrejer | /pygletgrejer/tredeplotter.py | UTF-8 | 2,437 | 2.859375 | 3 | [] | no_license | import math
import numpy as np
import pyglet
from pyglet.gl import *
class PlotWindow(pyglet.window.Window):
def __init__(self):
super(PlotWindow, self).__init__()
self.drawn = False
batch = None
def on_draw(self):
# clear the screen
#glClear(GL_COLOR_BUFFER_BIT)
... | true |
ede58ca6861e6946fa361c7e118436e56c430aec | Python | heidariank/PodiumScraper | /python/test.py | UTF-8 | 931 | 3.390625 | 3 | [] | no_license | import unittest
from sentiment import get_positivity_scores
import types
class SentimentTestCase(unittest.TestCase):
def get_reviews(self):
return [
[["I love everything!", "user1", "Title1"], ["I hate everything!", "user2", "Title2"]],
[["I neither love nor hate everything.", "user3", "Title3"], ["I love every... | true |
75b1167ee008f2c06e6b9ff5068c827e39a538fc | Python | bwargo/python-scripts | /brandNameCompAttrJsonOutputterOnlyBaseSku.py | UTF-8 | 1,303 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import json
from pyexcel_xls import get_data
import csv
import itertools as it
data = get_data("ProductSelectorFeatures_RJM_010317.xls")
rows = data["brandname Comparison Attributes"]
rows.pop(0) #removing first row of category names for now
#have to do this because rows may have different le... | true |
69f2a55e16399cb95d03617762e25cca7b0cb9e1 | Python | foobar999/Suchmaschine | /src/vector/cos_score_calculator.py | UTF-8 | 2,293 | 2.75 | 3 | [
"BSD-2-Clause"
] | permissive | import logging
from scipy.sparse import coo_matrix
from src.term import Term
from src.ranked_posting import RankedPosting
class CosScoreCalculator(object):
def fast_document_cosinus_scores(self, index, numdocs):
logging.debug('creating matrix from index, {} terms, {} docs'.format(len(index), numdocs))... | true |
2a8a1976fb041b73d4cfad5e3496ed9f05c24b8d | Python | kran9910/OBSoft-Internship | /jasonplaceholder's API.py | UTF-8 | 3,507 | 3.5625 | 4 | [] | no_license | import requests
import json
# Getters to fetch data from jsonplaceholder's API
#Fetch all posts in the API
def get_all_posts():
request = requests.get(
str('https://jsonplaceholder.typicode.com/posts'),
)
posts = request.json()
return posts
#Fecth a post from the API using its id... | true |
a2921282226c1cbe775b978060f33735c2c73580 | Python | Santiago2693/Calendario-2020 | /src/ejercicio24.py | UTF-8 | 6,052 | 3.296875 | 3 | [
"MIT"
] | permissive | PATH='puzzle_input/ejercicio24.txt'
PATH2 = 'puzzle_input/ejercicio24M.txt'
def procesarDatos(ruta):
"la funcion devuelve una lista con los movimientos separados por comas"
movimientos = list()
with open(ruta) as archivo:
for line in archivo:
auxiliar=line.strip()
i=0
... | true |
ace347c132f925125e90a05cc3f733df4173d384 | Python | stharrold/demo | /tests/test_utils/ARCHIVED/archived_test_utils.py | UTF-8 | 1,708 | 2.921875 | 3 | [
"MIT"
] | permissive | # #!/usr/bin/env python
# # -*- coding: utf-8 -*-
# r"""Archived pytests for demo/archived_utils.py
# """
# # Import standard packages.
# # Import __future__ for Python 2x backward compatibility.
# from __future__ import absolute_import, division, print_function
# import sys
# sys.path.insert(0, '.') # Test the ... | true |
1ed9fb5123f8cd0bcac0d3028d46690e5a7212eb | Python | juarezpaulino/coderemite | /problemsets/Codeforces/Python/A994.py | UTF-8 | 150 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | """
*
* Author: Juarez Paulino(coderemite)
* Email: juarez.paulino@gmail.com
*
"""
i=lambda:input().split()
n,m=map(int,i())
a,b=i(),i()
print(*[x for x in a if x in b]) | true |
77fac98d215cf446b8b4a8b4910e0fbbd4b4ef4c | Python | SolDavidCloud/sre-bootcamp | /auth_api/python/methods.py | UTF-8 | 1,588 | 2.78125 | 3 | [] | no_license | import hashlib
import jwt
import mysql.connector
# Constants
JWT_SECRET = "my2w7wjd7yXF64FIADfJxNs1oupTGAuW"
class Token:
def generate_token(self, received_username, received_password):
# Get record from the database
database = mysql.connector.connect(
host="bootcamp-tht.sre.wize.mx",... | true |
31e284bb6105b1ba35340643f5b6376bea2359cb | Python | Arturok/TEC | /Intrucción y Taller de Programación/Progras en Clase/Fibonacci_Ver1.0.py | UTF-8 | 224 | 3.609375 | 4 | [
"MIT"
] | permissive | def fib(n):
if isinstance(n, int) and n>=0:
return fib_aux(n)
else:
return "ERROR"
def fib_aux(n):
if n==0 or n==1:
return 1
else:
return fib_aux(n-1)+fib_aux(n-2)
| true |
642d75b64c7fb155508466b4a524a80a607e60ad | Python | Aasthaengg/IBMdataset | /Python_codes/p02948/s293551604.py | UTF-8 | 291 | 2.609375 | 3 | [] | no_license | from heapq import heappop,heappush
n,m=map(int,input().split())
L=[[] for _ in range(m)]
for _ in range(n):
a,b=map(int,input().split())
if a<=m:
L[m-a].append(b)
s=0
h=[]
for i in range(m-1,-1,-1):
for l in L[i][::-1]:
heappush(h,-l)
if len(h)>0:
s-=heappop(h)
print(s)
| true |
82379bad53f71da051eb4e8b981525c1dc0df24d | Python | Lagom92/algorithm | /0326/cart.py | UTF-8 | 781 | 2.953125 | 3 | [] | no_license | # 전기 카트
T = int(input())
def perm(n, k): # 순열 만들기
if k == n:
res.append([1] + p + [1]) # 순열 앞뒤로 사무실 추가
else:
for i in range(k, n):
p[i], p[k] = p[k], p[i]
perm(n, k+1)
p[i], p[k] = p[k], p[i]
for tc in range(1, T+1):
N = int(input())
arr = [list(... | true |
5d181cc2d44672b47237da6cea9d91a6de8ba307 | Python | JianFengY/alien_invasion | /chapter14_scoring/alien_invasion.py | UTF-8 | 2,699 | 3.328125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
'''
Created on 2018年1月21日
@author: Jeff Yang
'''
import pygame
from pygame.sprite import Group
from chapter14_scoring.settings import Settings
from chapter14_scoring.ship import Ship
from chapter14_scoring import game_functions as gf
from chapter14_scoring.game_stats import GameSta... | true |
0a7adaf1b5b7a3248a54d1d0997ebea28acb6a5c | Python | hjimce/tensorflow-nlp | /2_word_segment/segment.py | UTF-8 | 371 | 2.625 | 3 | [] | no_license |
import jieba
import codecs
def fenci(filename,outname) :
out=codecs.open(outname,'wb',"utf-8")
with codecs.open(filename,'rb',"utf-8") as f:
for l in f.readlines():
seg_list = jieba.cut(l,cut_all=False)
out.writelines(" ".join(seg_list))
#print
out.close()
... | true |
42ebe075c1c87d920954d82682c5b77814626b0d | Python | emreozb/HackerRank_Exercises | /breakingRecords.py | UTF-8 | 430 | 3.125 | 3 | [] | no_license | def breakingRecords(scores):
s_min = 0
s_max = 0
s_min = scores[0]
s_max = scores[0]
count_min = 0
count_max = 0
for score in scores[1:]:
if score > s_max:
s_max = score
count_max += 1
if score < s_min:
s_min = score
count_min... | true |
0432e7fecfdce14635f48a1baee4799bbaa446cb | Python | nocLyt/CIS700 | /P1/P0/ex.py | UTF-8 | 1,349 | 3 | 3 | [] | no_license | """
r.txt is init file
Non-anonymized dataset: edge.txt
Mapping: mapping.txt
Anonymized dataset: edge_id.txt
"""
class DirectedUnweightedGraph:
def __init__(self):
self.dc = dict()
self.n = 0
self.m = 0
def add_node(self, u):
pass
def get_node_id(self, u):
... | true |