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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
2f0d4746253a10b6d0a78641b8e078182cf3108a | Python | jdavid54/rubik_cube | /rubik_solver01.py | UTF-8 | 745 | 2.5625 | 3 | [] | no_license | #-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: Jean
#
# Created: 24/04/2019
# Copyright: (c) Jean 2019
# Licence: <your licence>
#-------------------------------------------------------------------------------
from ... | true |
a48173b392db6988c73c86eba45da18e27805f70 | Python | SGpp/SGpp | /datadriven/tests/uq/operations/test_eval.py | UTF-8 | 1,643 | 2.625 | 3 | [
"LicenseRef-scancode-generic-exception",
"BSD-3-Clause"
] | permissive | # Copyright (C) 2008-today The SG++ project
# This file is part of the SG++ project. For conditions of distribution and
# use, please see the copyright notice provided with SG++ or at
# sgpp.sparsegrids.org
from pysgpp.extensions.datadriven.uq.operations import (hierarchize,
... | true |
90bd2622a18eba087df8b6af7abc4abcc2a03dba | Python | RobsonAssis/automacaoCalculadora | /steps/calc.py | UTF-8 | 53 | 2.65625 | 3 | [] | no_license | valor = '909'
print(int(valor))
print(type(valor))
# | true |
5c35a98d1a5719de9e64f67a551c37ddaf16e262 | Python | smolenkov/probe | /Lesson 5/Painting_Pack/snowfall.py | UTF-8 | 4,081 | 3.140625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from random import randint
import simple_draw as sd
sd.resolution = (1200,800)
# На основе кода из практической части реализовать снегопад:
# - создать списки данных для отрисовки N снежинок
# - нарисовать падение этих N снежинок
# - создать список рандомных длинн лучей снежинок (от 10 до 100... | true |
5deac48701557777ca2d0e8ff3f53641d4495466 | Python | leerix/THULAC-Python | /thulac/base/WordWithTag.py | UTF-8 | 137 | 2.578125 | 3 | [
"MIT"
] | permissive | class WordWithTag:
word = ""
tag = ""
separator = ''
def __init__(self, separator):
self.separator = separator
| true |
8914e65da3f68ebc78d7d6a8a7e39e529930bebd | Python | perok/tdt4287 | /tests/SuffixTreeTest.py | UTF-8 | 789 | 3.171875 | 3 | [] | no_license | def test_empty_string(self):
st = SuffixTree('')
assert st.find_substring('not there') is -1
assert st.find_substring(''), -1)
assert not st.has_substring('not there')
assert not st.has_substring('')
def test_repeated_string(self):
st = SuffixTree("aaa")
... | true |
bbe24aee87b0d8e8bae22320a47eaa407854c54a | Python | gurjot1996/FULL-STACK-NANODEGREE-1 | /Day 19-26dec/valid year in python/valid year.py | UTF-8 | 161 | 3.34375 | 3 | [] | no_license | def valid_year(year):
if year and year.isdigit():
year=int(year)
if year>0 and year<=2050:
return year
print(valid_year('2000'))
| true |
2ee4ce7b57928d96b2ba71df23a305c48db9222d | Python | luix30182/DataScience | /suicide.py | UTF-8 | 2,917 | 3.109375 | 3 | [] | no_license | import sys
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# python suicide.py "..\..\..\Downloads\suicides1985-2016.csv"
# tendencias por país, rango de edad
def getCountryName(name, names):
name = name.lower()
for x in dataGroupByCountry.iteritems():
if(x[0].lower() == name):
ret... | true |
efba38f45265d266530590fd18335037c365ebe7 | Python | juniorkiobr/POO | /Exercicio5.py | UTF-8 | 5,481 | 3.015625 | 3 | [] | no_license | from datetime import date as dt
class Data():
def __init__(self,dia = None,mes = None,ano = None,diaA = None, mesA = None, anoA = None):
self.dia = None
self.mes = None
self.ano = None
self.diaA = None
self.mesA = None
self.anoA = None
if dia != ... | true |
a0d183fb48400c3a1c1ce4ba2c2d9f5294c7fe96 | Python | vkryukov/advent2020 | /day19.py | UTF-8 | 4,195 | 2.90625 | 3 | [] | no_license | from utils import *
from itertools import product, count as iter_count
import sys
import pickle
lines = all_lines(19)
rules_end = lines.index('')
rules = lines[:rules_end]
strings = lines[rules_end+1:]
MAX_LEN = max(len(s) for s in strings) # 96
class Rule:
def __init__(self, s):
id, rest = s.split(':... | true |
7edc8771ed190606e03e0b97b52961c947c41330 | Python | shelldream/Maze | /src/FeatureGenerate/GBDTFeatureExtractor.py | UTF-8 | 4,196 | 2.75 | 3 | [] | no_license | # -*- coding:utf-8 -*-
"""
Description:
解析GBDT原始text文件,将GBDT的叶子节点作为特征,生成对应的xml文件
Author: shelldream
Date:
"""
import sys
reload(sys).setdefaultencoding("utf-8")
sys.path.append("../")
sys.path.append("./")
import utils.xgboost_utils
class GBDTFeatureExtractor(object):
def __init__(self, mode... | true |
7dec80e0bc6a960582ea3cf82c5ce190f602b93b | Python | calopez19/gg-gente | /game_window.py | UTF-8 | 9,134 | 2.875 | 3 | [] | no_license | from os import path
from PyQt5.QtWidgets import QWidget, QLabel
from PyQt5.QtGui import QPixmap
from PyQt5.QtCore import pyqtSignal, Qt, QRect
from character2 import Character
from nueva import Tienda
from intento_crear_lista_mapa import Mapa
mapa=[]
with open(path.join("mapas", "mapa_2.txt"), encoding="utf-8") as fi... | true |
6e14643882753017aa8b6e8cbfec5529a60683ae | Python | santidrj/C | /Lab03/src/parte_2.py | UTF-8 | 6,515 | 2.65625 | 3 | [] | no_license | import os
import subprocess
from glob import glob
from math import gcd, ceil, log2
import Crypto.PublicKey.RSA as rsa
import numpy as np
from Crypto.Util import number
from sqrt_long_division import sqrt_long_division
output_path = '../outputs'
rw_input_path = '../RSA_RW'
pseudo_input_path = '../RSA_pseudo'
student ... | true |
25642485f800b36be82936ec3a5b68272bd56a8b | Python | codesavory/blendsoy_plugin | /face_surface_generate.py | UTF-8 | 1,312 | 2.71875 | 3 | [] | no_license | import bpy
f=open("mesh_face_details.txt",'w')
for mesh in bpy.data.meshes:
print(mesh.name)
print(len(mesh.polygons))
f.write(mesh.name)
f.write('\n')
for face in mesh.polygons:
if(len(face.vertices)==3):
for vert in face.vertices:
f.write(str(... | true |
cd9c916edc4500e96393eba7e41c50400087fed1 | Python | hemae/neural_networks | /ex1_simple_network.py | UTF-8 | 1,011 | 3.6875 | 4 | [] | no_license | import numpy as np
def act(x):
return 0 if x < 0.5 else 1
def go(vect):
x = np.array(vect)
w11 = [0.3, 0.3, 0]
w12 = [0.4, -0.5, 1]
weight1 = np.array([w11, w12]) # матрица 2х3
weight2 = np.array([-1, 1]) # вектор 1х2
sum_hidden = np.dot(weight1, x) # вычисляем сумму на нейронах срытого ... | true |
294c60b82afe8aa78c20750f844b70f776cc06f6 | Python | liyanhe95/ApiTestCashRateValue | /common/utils.py | UTF-8 | 2,896 | 2.71875 | 3 | [] | no_license | import datetime
import requests
from common import contants
import json
import jsonpath
#
# a = 'year=-18&day='
# b = 'year=-41&day=1'
# years_delta_str, days_delta_str = b.replace('year=', '').replace('day=', '').split('&')
# if years_delta_str == '':
# years_delta = 0
# else:
# years_delta = int(years_delta_... | true |
f642b0baf136a27f4bdc316683379c970ce54f96 | Python | guofei9987/leetcode_python | /solved/[167][Two Sum II - Input array is sorted][Easy].py | UTF-8 | 1,371 | 3.5 | 4 | [] | no_license | # https://leetcode.com/problems/two-sum-ii-input-array-is-sorted
class Solution:
def twoSum(self, numbers, target):
"""
:type numbers: List[int]
:type target: int
:rtype: List[int]
"""
len_num=len(numbers)
numbers_set=set(numbers)
for i in numbers_set... | true |
a646f863a38e22bf352d0b5b8064448179ae7d1f | Python | ReethP/Algolympics-2021-Solutions | /ProblemJ.py | UTF-8 | 227 | 3.1875 | 3 | [] | no_license | cases = int(input())
for i in range(cases):
stars = int(input())
initial = list(map(int,input().split()))
final = list(map(int,input().split()))
last = initial[len(initial)-1]
print(initial.index(last) - final.index(last)) | true |
9b643db4833aa0d199862a62dad8bd656a60f333 | Python | donyu/euler_project | /p11.py | UTF-8 | 1,566 | 3.578125 | 4 | [] | no_license | import sys
class ProductGrid():
def __init__(self, file):
self.grid = []
for line in file:
row = []
nums = line.strip().split()
for num in nums:
row.append(int(num))
self.grid.append(row)
def max_prod(self):
max_prod = 0
# loop through all possible 4x4 boxes
f... | true |
f0b15c329a5b1481ae2a1d1181ee4e15fe5d88ad | Python | toologicbv/dcnn_mri_seg | /losses/dice_metric.py | UTF-8 | 2,928 | 2.6875 | 3 | [] | no_license | import torch.nn as nn
import torch.nn.functional as F
import torch
import numpy as np
from torch.autograd import Variable
from sklearn.metrics import precision_recall_curve, f1_score
from sklearn.metrics.classification import UndefinedMetricWarning
# https://github.com/EKami/carvana-challenge/blob/master/src/nn/losse... | true |
9dafefb779421eac96054a8cdad756b995a72bd6 | Python | anderson-br-ti/python | /Projetos/print elementos da lista.py | UTF-8 | 147 | 3.40625 | 3 | [
"MIT"
] | permissive | list = [1, 2, 3, 4, 5]
print (':2')
print (list[:2])
print (':-2')
print (list[:-2])
print ('-2:')
print (list[-2:])
print ('2:')
print (list[2:])
| true |
68b1a8251c4623ad5b1b085a9daf9aac156c1aea | Python | masud99r/Insulting-Comment-Detection | /src/kMeans.py | UTF-8 | 1,016 | 2.703125 | 3 | [] | no_license | __author__ = 'Wasi Uddin Ahmad, Md Masudur Rahman'
import numpy as np
from sklearn.cluster import KMeans
def generateBOW(comment, vocabulary):
tokenList = comment.getTokensList()
BOW = []
for i in range(len(vocabulary)):
if vocabulary[i] in tokenList:
BOW += [tokenList[vocabulary[i]]]
else:
BOW += [0]
r... | true |
6816662af18e82de6e6bd9c7606fba9e58ed727a | Python | HEXA0991/labs_bio_knowlage_graph_word_list_auxiliary_code | /acronym.py | UTF-8 | 3,748 | 2.96875 | 3 | [] | no_license | import codecs as cs
#path_r = r'C:\Users\dell\Desktop\huop\审过\Organization_no_space_end.txt' #工作文件
#path_w = r'C:\Users\dell\Desktop\huop\审过\Organization_new.txt' #结果文件
#path_log = r'C:\Users\dell\Desktop\huop\审过\Organization_log.txt' #日志文件
path_r = r'C:\Users\dell\Desktop\huop\审过\Pathogen_no_space_end.txt'... | true |
7012204517eeaf74d923fa84b953e77dfba12ee8 | Python | ellinx/LC-python | /FindTheDifference.py | UTF-8 | 632 | 3.90625 | 4 | [] | no_license | """
Given two strings s and t which consist of only lowercase letters.
String t is generated by random shuffling string s and then add one more letter at a random position.
Find the letter that was added in t.
Example:
Input:
s = "abcd"
t = "abcde"
Output:
e
Explanation:
'e' is the letter that was added.
"""
clas... | true |
3dad3aca579eab00f1eec0e0a235585652489042 | Python | ruppmatt/AEDeveloper | /create_user.py | UTF-8 | 665 | 2.6875 | 3 | [] | no_license | import AEDeveloper.db as db
from AEDeveloper.developer_identity import create_user
import sys
import argparse
def generate_parser():
parser = argparse.ArgumentParser()
parser.add_argument('username', help='User\'s login.')
parser.add_argument('password', help='User\'s login password.')
parser.add_argu... | true |
f718ed100af04463eb159bd23c2b9c874d776759 | Python | triedal/delphi-core | /delphi_core/config.py | UTF-8 | 357 | 2.71875 | 3 | [] | no_license | """
This module builds the globally accessed config object.
"""
from os.path import dirname, join
import yaml
def replace_template_vals(mycfg):
"""Replaces the template variables in config.yml"""
return mycfg
cwd = dirname(__file__)
fpath = join(cwd, "config/config.yml")
with open(fpath, "r") as f:
cfg =... | true |
cf6a199a1faa4438e1889cbdb59748e8669a0bf5 | Python | influxdata/influxdb-client-python | /examples/nanosecond_precision.py | UTF-8 | 1,287 | 2.59375 | 3 | [
"MIT"
] | permissive | from influxdb_client import Point, InfluxDBClient
from influxdb_client.client.util.date_utils_pandas import PandasDateTimeHelper
from influxdb_client.client.write_api import SYNCHRONOUS
"""
Set PandasDate helper which supports nanoseconds.
"""
import influxdb_client.client.util.date_utils as date_utils
date_utils.dat... | true |
ff5bc2b8c1dfe6cfd68ae8d135a56b8bfe7e957b | Python | venkatsvpr/Problems_Solved | /LC_Letter_Combination_of_a_Phone_Number2.py | UTF-8 | 843 | 3.953125 | 4 | [] | no_license | # Letter Combination of a Phone Number
# https://leetcode.com/problems/letter-combinations-of-a-phone-number/description/
# Iterative Solution
class Solution(object):
def letterCombinations(self, digits):
"""
:type digits: str
:rtype: List[str]
"""
Ans =[]
... | true |
e9116cff2876974002acc19387843428d1594c6c | Python | mikee1897/MLPY | /svm.py | UTF-8 | 457 | 2.5625 | 3 | [] | no_license | import sklearn
from sklearn import datasets
from sklearn import svm
from sklearn import metrics
frin sklearn.neighbors import KNeighborsClassifier
cancer = datasets.load_breast_cancer()
print(cancer.feature_names)
print(cancer.target_names)
x = cancer.data
y = cancer.target
x_train, x_test, y_train, ... | true |
040d5f92531f4e90f5457a1372493e5d29a34ba9 | Python | xieruishen/Atari_with_RL | /src/rl/rl_play_mancala_antagonistic.py | UTF-8 | 4,335 | 3.15625 | 3 | [] | no_license | import reinforcement_learning_model as avm
import mancala as mancala
import matplotlib.pyplot as plt
if __name__ == "__main__":
manc = mancala.Mancala()
#create an instance of our rl agent without any discounting factor (we don't care if we win in 5 steps or 10)
rl_agent_top = avm.ActionValueModel(epsilon... | true |
86cf39d3c2a595154db169f4a4e29133b4033fa3 | Python | ikkeshr/postter_python_api | /test.py | UTF-8 | 966 | 2.5625 | 3 | [] | no_license | from db_connect import Db
from werkzeug.security import generate_password_hash, check_password_hash
from api import Postter
# _password = "ikkesh"
# _hashed_password = generate_password_hash(_password)
# print("pwhash: ", _hashed_password)
# input_password = input("Enter your password: ")
# if check_password_hash(_ha... | true |
6dd6fa75c342a567c6d2e9d393a3b54a9411b678 | Python | zhengxin2016/nlp_code | /corpus/update_data/db_vector.py | UTF-8 | 1,921 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
import os, sys
import shutil
from pymongo import MongoClient
class DB_vectors():
def __init__(self, ip, port, db_name):
self.db_name = db_name
self.data_db = MongoClient(ip, port)[db_name]
self.vector_db = MongoClient(ip, port)['data_vectors']
self.common_db ... | true |
2954e6ee81fed40c84a0142345f6d2c17a193c9e | Python | sferro/excercises | /python/control_flujo_while.py | UTF-8 | 529 | 3.90625 | 4 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
print("Escribe 0 para salir")
while True:
numero = input("> ")
print("numero ingresado = " + str(numero))
if int(numero) < 0:
print("Numero negativo")
elif int(numero) > 0:
print("Numero positivo")
else:
print("cero")
var = "pa... | true |
a6561b7ce4d7e04a2ba557c5176caff7d02ee7e3 | Python | Bedrock02/General-Coding | /Math/euler1.py | UTF-8 | 152 | 3.46875 | 3 | [
"MIT"
] | permissive | #Multiples of 3,5
#Find the sum of all multiples below 1000
answer = 0
for i in xrange(3,1000):
if i%3 is 0 or i%5 is 0:
answer += i
print answer | true |
e1748a82b6280773297ceaa3dcce60f0bbf904d5 | Python | nehatomar12/Data-structures-and-Algorithms | /Graph/graph_basic.py | UTF-8 | 1,140 | 3.53125 | 4 | [] | no_license | class graph:
def __init__(self,g_dict=None):
if g_dict is None:
g_dict = {}
self.g_dict = g_dict
def get_vertices(self):
# return self.g_dict.keys() ---> dict_keys(['a', 'b', 'c', 'd', 'e'])
# to return ---> ['a', 'b', 'c', 'd', 'e']
return list(self.g_dict.k... | true |
f0a2fed3676e2b43ca44bb27515b7f53c29beed3 | Python | NiteshBharadwaj/pytorch-unsup-pc | /dpc/nets/trunc_normal.py | UTF-8 | 842 | 2.984375 | 3 | [
"MIT"
] | permissive | import numpy as np
import torch
def parameterized_truncated_normal(uniform, mu, sigma, a, b):
normal = torch.distributions.normal.Normal(0, 1)
alpha = (a - mu) / sigma
beta = (b - mu) / sigma
alpha_normal_cdf = normal.cdf(alpha)
p = alpha_normal_cdf + (normal.cdf(beta) - alpha_normal_cdf) * unif... | true |
df97f8a3bc4fca2bfeb02df6745bb1a195474d4e | Python | go-bears/Intro_Exercises | /super_shuffle.py | UTF-8 | 2,411 | 3.828125 | 4 | [] | no_license | #broken code homework: fixing variables, running python code
#import python's random model
import random
students = ["drew", "meg", "olivia", "piril", "luisa", " jaya", "monique" ,
"jen", "shanae", "theresa", "kelsey", "brittany", "samantha", "sammy",
"mandy", "angela", "catherine", "thais", "dori"]
#there aren't... | true |
460b07b5b5eb2384f24ac42ce7cd636b084d1ee0 | Python | arcturus611/sdp-codes | /sdp-rank-reduction.py | UTF-8 | 10,315 | 3.265625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 6 15:45:03 2019
@author: arcturus
"""
# We implement Algorithm 2.1 described in "Low Rank SDPs: Theory and Applications"
# by Lemon, Man-Cho So, and Ye.
#%% Rank reduction alg
import numpy as np
import scipy as sp
import cvxpy as cp
#%% Generate ... | true |
308068338a19ed07d565703596471ca49ebe016c | Python | GabrielVSMachado/42AI_Learning | /00/even_odd_zero/whois.py | UTF-8 | 433 | 4.0625 | 4 | [] | no_license | def the_odd_even_or_zero(*args: int) -> str:
'''Check if the number is Odd, Even or Zero and return a string
which describe the case'''
if (len(args) > 0):
try:
number = int(*args)
if number & 0b1:
return "I\'m Odd."
elif not number:
... | true |
49306fb7cf18e0c478a2b969e1fd8b54e28d3657 | Python | kim-byoungkwan/Coding_Test_1 | /백준_6603_완전탐색_금융_S2.py | UTF-8 | 544 | 2.890625 | 3 | [] | no_license | import itertools
def lotto_func(box_K_S):
box = []
K = box_K_S[0]
S = [box_K_S[j] for j in range(len(box_K_S)) if j>0]
combi_K = list(itertools.combinations(S,6))
for m in combi_K:
m = list(map(str,m))
result = " ".join(m)
box.append(result)
... | true |
0065be7cba36d6ce9e170149c7e666c191c93aee | Python | nsuman/857-project | /compute_score.py | UTF-8 | 927 | 2.71875 | 3 | [] | no_license | import collections
import numpy as np
import re
import io
path = "samples.txt"
def tokenize_string(sample):
return tuple(sample.lower().split(' '))
def load_dataset(path, max_length=10, tokenize=False, max_vocab_size=2048):
lines = {}
with io.open(path, 'r', encoding="ISO-8859-1") as f:... | true |
4edfde482b796298b92cb7434ff6f08ce6778eec | Python | skipper8/Weather | /Weather/uw_scraper.py | UTF-8 | 497 | 2.828125 | 3 | [] | no_license | #UW SCRAPER
#GOAL:
#Scrapes from UW weather data every 24 hours
#IMPORTS___________________________________________________
from bs4 import BeautifulSoup
import requests
class uw_scraper():
def __init__(self):
self.URL= 'https://a.atmos.washington.edu/cgi-bin/list_uw.cgi'
self.soup = BeautifulSo... | true |
7073cc3c19189b161f3bbd4efbf3188efae68897 | Python | ogami1tto/Exos_Kevin | /classes.py | UTF-8 | 2,901 | 4.5 | 4 | [] | no_license |
class Carre:
"""Classe 'carré' caractérisée par son côté en centimètres"""
count = 0 # compteur de carrés créés
def __init__(self, cote):
""""constructeur de classe"""
Carre.count = count
print("Création d'un carré de", cote, "cm de côté...")
self.side = cote
self.... | true |
28c88b5f418a6093dc56882e45d890fe59af09b0 | Python | sarahrustan/Exploratory_Data_Analysis_Project | /Exploratory_Data_Analysis.py | UTF-8 | 5,844 | 3.75 | 4 | [] | no_license |
# coding: utf-8
# # Exploratory Data Analysis: World Development Indicators
# ## Explore renewable energy consumption and its relationship with gross domestic income in the US
# EXISTING VARIABLES:
# Renewable energy consumption (% of total final energy consumption): EG.FEC.RNEW.ZS (1990-2012);
# Gross domestic inc... | true |
11ca1206fdebc4d609c47f650833cf1f103de69c | Python | ahuber950/Euler | /pe013/pe013.py | UTF-8 | 404 | 3.765625 | 4 | [] | no_license | # Work out the first ten digits of the sum of the following one-hundred 50-digit numbers.
# Values are in the associated text file
import numpy as np
def mod13(filename):
if type(filename) != str or filename[-4:] != ".txt":
raise ValueError("You must call a valid .txt file")
vals = np.lo... | true |
7fc6434a9d27e931c621e7141d18efa681c3b786 | Python | OnionIoT/iot-smart-fan | /iotSmartFan.py | UTF-8 | 1,929 | 2.90625 | 3 | [] | no_license | import os
import sys
import json
import oneWire
from temperatureSensor import TemperatureSensor
from omegaMotors import OmegaPwm, hBridgeMotor
# PWM channels for case fan, plus additional channels for H-bridge operation
H_BRIDGE_1A_CHANNEL = 1
H_BRIDGE_2A_CHANNEL = 2
FAN_PWM_CHANNEL = 0
oneWireGpio = 3 # mark the sen... | true |
1d018fe33ac24439b2b060579bdf90bb883aaf7a | Python | berkayinan/Leetcode | /014.py | UTF-8 | 466 | 2.875 | 3 | [] | no_license | class Solution:
def longestCommonPrefix(self, strs):
"""
:type strs: List[str]
:rtype: str
"""
i=0
if len(strs)==0:
return ""
res=[]
minLen = min([len(s) for s in strs])
for i in range(minLen):
c = strs[0][i]
... | true |
68991b4040548136e99a9f717b1b863e205943d2 | Python | hanrick2000/algorithm-6 | /03 - Binary Search/M428pow.py | UTF-8 | 457 | 3.296875 | 3 | [] | no_license | class Solution:
"""
@param x: the base number
@param n: the power number
@return: the result
"""
def myPow(self, x, n):
# write your code here
result, base = 1, x
# negative n become positive n
if n < 0:
base = 1 / base
n *= -1
wh... | true |
506d555ad4b4d2380fe9a06badf5a60a7c63b694 | Python | YannDubs/Mini_Decodable_Information_Bottleneck | /viz.py | UTF-8 | 2,267 | 2.640625 | 3 | [
"MIT",
"Python-2.0"
] | permissive | import os
from glob import glob
import sys
try:
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
except ModuleNotFoundError:
raise ModuleNotFoundError(
"For plotting you need `pip install seaborn, pandas, matplotlib`"
)
def plot_results(name):
"""Plot the resu... | true |
77c63e3f0ca018158a5c4d07c3680ee20b54047e | Python | Alva-2020/SpeechRecognition | /deep_speech2/data_utils/segments.py | UTF-8 | 26,366 | 3.46875 | 3 | [] | no_license |
"""Contains the several segment class"""
import numpy as np
import resampy
import random
import copy
from scipy.io import wavfile
from scipy import signal
from typing import Optional
class AudioSegment(object):
"""
Monaural audio segment abstraction.
:param samples: Audio samples [num_samples x num_chan... | true |
28f2c6df4ed515844f0e8a09f46a3be99ec490da | Python | DomNomNom/CSpline-experiment | /cspline.py | UTF-8 | 7,001 | 3.265625 | 3 | [
"MIT"
] | permissive | import bisect
import pyqtgraph as pg
from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
import itertools
Vec = np.array
def Vec2(x, y):
return np.array([x,y], dtype=float)
def Vec3(x, y, z):
return np.array([x,y,z], dtype=float)
def lerp(a,b,t):
""" Linear interpolation between from @a to @b as @t ... | true |
73488db5133bd8040cd91063bab6349330dc232d | Python | LMunday98/3CB101-Data-Analysis | /src/controllers/graphHandler.py | UTF-8 | 1,266 | 2.703125 | 3 | [] | no_license | import config
# import matplotlib.pyplot as plt
from models.graph import Graph
from util.timer import Timer
from util.dir import Dir
from datetime import datetime
class GraphHandler:
def __init__(self, rowers):
self.rowers = rowers
self.graphMeasurements = config.graphedMeasurements
self.... | true |
9314858592d9bfc38ba19d8cca25fa7d8cef3e7e | Python | jkimblad/np-schedulability-analysis-preprocessor | /run_experiments.py | UTF-8 | 4,573 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python3
import subprocess
import random
import json
settings = {
# Set what ratio of the execution time should be taken by the A-phase and R-phase
'a_ratio' : 0.1,
'r_ratio' : 0.1,
# Amount of tasks in each task set
'task_amount' : 15,
# Total utilizat... | true |
61815840e8ca3b8c13a0e2a129bba9b665ebe740 | Python | DrakeSeifert/Software-Engineering-I | /assignment1/redo/additionaltests.py | UTF-8 | 320 | 3.15625 | 3 | [] | no_license | import kwic
#This version verifies that the listPairs parameter works
#mystr="hello there.\nhello THERE, buddy.\nhello ANd goodbye buddy.\nhello IS like buddy goodbye!"
#assert len(kwic.kwic(mystr, listPairs=True)[1]) == 4
mystr = "Design is hard\nLet's just implement"
print kwic.kwic(mystr, ignoreWords=["hard."])
| true |
4a7e66b17eb978bfdeba0d2fde3aed7be51b25f9 | Python | ljwon0312/academy_python | /day_1/031.py | UTF-8 | 40 | 2.5625 | 3 | [] | no_license | s = 'AA,AC,AG,AT'
print(s.split(','))
| true |
1210feea792e88795a56bc3b7d2d05bde5afb0f3 | Python | ender8848/the_fluent_python | /chapter_2/demo_2_12.py | UTF-8 | 747 | 4.5625 | 5 | [] | no_license | # 一个包含 3 个列表的列表,嵌套的 3 个列表各自有 3 个元素来代表井字游戏的一行方块
# 建立一个包含 3 个列表的列表,被包含的 3 个列表各自有 3 个元素。
board = [['_'] * 3 for i in range(3)]
print(board)
# 把第 1 行第 2 列的元素标记为 X
board[1][2] = 'X'
print(board)
# 含有 3 个指向同一对象的引用的列表是毫无用处的
# 外面的列表其实包含 3 个指向同一个列表的引用
# 当我们不做修改的时候,看起来都还好
weird_board = [['_'] * 3] * 3
print(weird_board)
# 一旦我们... | true |
2e2b1928ea49a7afadc7f5871c47cabf64375e87 | Python | mdmitr/upworkStat | /create_db.py | UTF-8 | 2,369 | 2.515625 | 3 | [] | no_license | import sqlite3
def create_job_tables(cur):
#
# JOBS
#
cur.execute('DROP TABLE IF EXISTS JOBS')
cur.execute('''CREATE TABLE JOBS (id VARCHAR(50) PRIMARY KEY,
title VARCHAR(500), category2 VARCHAR(50), subcategory2 VARCHAR(50),
job_status VARCHAR(50), job_type VARCHAR(50),
snippet ... | true |
b776d4bd723f14ab66496461565fccc9847e8564 | Python | noviomagus-lky/OCR-for-PDFtable | /code/image_processor.py | UTF-8 | 11,892 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Dec 11 22:21:46 2020
@author: Administrator
"""
# -*- coding: utf-8 -*-
"""
Created on Tue May 28 19:23:19 2019
将图片按照表格框线交叉点分割成子图片(传入图片路径)
@author: hx
"""
import cv2
import numpy as np
import pytesseract
import os
from PIL import Image
import csv
from image_to_string impor... | true |
5d7ca512e1af1975f0515d5701b94fdb445ffb78 | Python | tkhunlertkit/Sketches | /python/Python Test/delete_google_music_duplicate.py | UTF-8 | 876 | 2.734375 | 3 | [] | no_license | from gmusicapi import Mobileclient
def delete_dup_from_playlist(playlist):
track_ids = set()
deleted_count = 0
for song in playlist:
track_id = song['trackId']
entry_id = song['id']
if track_id in track_ids:
print 'found duplicate, removing', entry_id
api.re... | true |
d459899fac704f1eaacb11720ef94545c587be80 | Python | rupeshnehra/Minhash | /xxhash-minhash.py | UTF-8 | 665 | 2.734375 | 3 | [] | no_license | import xxhash
maxint = 4611686018427387904
def MinHash(signature, n_hash=100, ix=0):
minhash_value = maxint
for el in signature:
minhash_temp = xxhash.xxh32(el, ix).intdigest()
if minhash_value > minhash_temp:
minhash_value = minhash_temp
return minhash... | true |
dd4449a2ca00ea6d9ee8e0e4ec35484c7015172c | Python | JRsFly/sklearn-MNIST | /preceptron/demo.py | UTF-8 | 277 | 2.765625 | 3 | [] | no_license | import numpy as np
#label =[0 for i in range(10)]
#print(label
"""a = np.arange(9).reshape((3, 3))
b = a[1,:]
print(b)
b = b /2
print(b)
print(a)
b[2] = b[2] /2
print(b)
print(a)"""
a = np.arange(9).reshape((3, 3))
print(a)
a = np.sum(a, axis=0)
print(a)
| true |
f988a2b61b371cb4fc6bd88839e88e0615add3f6 | Python | dev10110/deep_learnt_controls | /Simple_Spacecraft/rocket.py | UTF-8 | 6,286 | 3.09375 | 3 | [
"MIT"
] | permissive |
#x range: +- 200
#z range: 500, 2000
#vx range: +- 10
#vz range: -30, 10
#m range: 8000, 12000
import pandas as pd
import numpy as np
import scipy as sp
from scipy import integrate as spint
import matplotlib.pyplot as plt
from numpy import sin, cos, arcsin, arctan2
import random
class Rocket:
def __init__(sel... | true |
a1fc4673372e199947c2a71bea870a093b54e0a6 | Python | Yatish-Chandra/Python | /Check a number is Palindrome or Not.py | UTF-8 | 306 | 4.28125 | 4 | [] | no_license | # Python Program to check a number is palindrome or not
num= int(input( "Enter a number:" ) )
temp=num
rev = 0
while( num>0):
dig=num%10
rev=rev*10+dig
num=num//10
if (temp==rev):
print( "The number is palindrome! " )
else:
print( "Not a palindrome! " )
| true |
b44b70cba4290b8dcd00e0b369a67d827b525034 | Python | WLLSIM020/nidmd | /nidmd/plotting/timeplot.py | UTF-8 | 2,034 | 2.671875 | 3 | [
"MIT"
] | permissive | # This Python file uses the following encoding: utf-8
import numpy as np
from plotly.subplots import make_subplots
import plotly.graph_objects as go
import pandas as pd
from .colors import colorlist
class TimePlot:
def __init__(self, df1, df2=None):
"""
Constructor
:param df1: [pd.DataF... | true |
6a8e4d4e488715bcab3355dd13648cf57c99f99b | Python | 835702882/11 | /openJson.py | UTF-8 | 480 | 2.875 | 3 | [] | no_license | import json
temp = []
# 读取json文件内容,返回字典格式
with open('E:\\shujuji\\Data_ICRA18\\test_data.json', 'r', encoding='utf8')as fp:
json_data = json.load(fp)
for key in json_data.keys():
temp.append(json_data[key]['cloth_index'])
temp.sort()
print(temp)
t1 = [11, 11, 11, 11, 11, 11, 11, 11, 1... | true |
03f1da69ed964c2e984dab2b56e70b5f073e9700 | Python | Aasthaengg/IBMdataset | /Python_codes/p02958/s523468647.py | UTF-8 | 256 | 3.078125 | 3 | [] | no_license | n = int(input())
p = list(map(int,input().split()))
count = 0
sort_p = sorted(p)
for i in range(n):
if p[i] != sort_p[i]:
count += 1
if count == 2:
print("YES")
exit()
elif count == 0:
print("YES")
exit()
else:
print("NO")
exit()
| true |
441ba6cfe166c599b9d4255139b99fae5dddef79 | Python | mlangford29/scratchwork | /config.py | UTF-8 | 19,469 | 2.71875 | 3 | [] | no_license | # this is where you're going to put all of the config everythings!
import numpy as np
# a config for the run itself
config = {
# number of 'hidden' layers. Probably not the right term
# but these are the layers that are in between the base and the meta-learner
'num_hidden_layers':(5, 5),
# number of models in t... | true |
bcdc463341c5c2b6b00e23eb851e399ffea3d85c | Python | fumieval/Curtana | /Prelude/Control/MonadIO.py | UTF-8 | 4,325 | 2.78125 | 3 | [] | no_license | """
Monadic actions
"""
from curtana.lib.mixin import SingleMix, InfixMix
import functools
__all__ = ["IOZero", "IOException", "IOOne", "IO", "Return", "IOWrapper", "Satisfy", "IOFunction", "wrapIO", "funcIO", "joinIO", "sequence"]
class IOZeroType:
def __repr__(self):
return "IOZero"
def __nonzero__(... | true |
86a7b7c434ed8eb8d4d00f962bee9869e13acc1c | Python | Sugarsugarzz/Pytorch-Learn | /Morvan-Pytorch/10_CNN/code.py | UTF-8 | 3,288 | 3.140625 | 3 | [] | no_license | """
CNN 卷积神经网络
手写数字识别
"""
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.utils.data as Data
import torchvision
import matplotlib.pyplot as plt
# Hyper Parameters
EPOCH = 1
BATCH_SIZE = 50
LR = 0.001
DOWNLOAD_MNIST = True
train_data = torchvision.datasets.MNIST(
root='./m... | true |
95aaf2723a0bb153d84d52ee76460ab0ae8299e0 | Python | razseg/SOAR | /demo.py | UTF-8 | 4,215 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Sep 20 10:07:41 2021
@author: Segal Raz
"""
import argparse
import SOAR_alg as soar
import networkx as nx
from networkx.drawing.nx_agraph import graphviz_layout
def Add_InNetwork_Capacity(g):
for node in g.nodes:
att={node:{'Jobs':{'number':0,'list':[]}}}
... | true |
a9d091fa7a085a76a887157f2de730a951f0365d | Python | bunderhi/truck | /tests/get_intrinsics.py | UTF-8 | 1,481 | 2.59375 | 3 | [] | no_license | import pyrealsense2 as rs
import numpy as np
import cv2
import os
from math import tan, pi
import datetime as dt
import time
"""
Returns a camera matrix K from librealsense intrinsics
"""
def camera_matrix(intrinsics):
return np.array([[intrinsics.fx, 0, intrinsics.ppx],
[ ... | true |
6c88152f908b2af7ba637f4f4086d91f6f9c8a1f | Python | NairaX/pyblockchain | /blockchain/services/block_services.py | UTF-8 | 612 | 2.765625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# encoding: utf-8
import json
from hashlib import sha256
class Hasher(object):
@staticmethod
def hash(index, timestamp, previous_hash, nonce, difficulty, data):
params = {
'index': index,
'timestamp': timestamp,
'previous_hash': previous_has... | true |
bcffcd1fd35f352616308ae26c1860ef81330335 | Python | Tempuss/crawler | /crawler.py | UTF-8 | 861 | 2.546875 | 3 | [] | no_license | import urllib.request
import json
import time
import datetime
import os
directory = "./url.json"
url = ""
with open(directory) as data_file:
data = json.load(data_file)
now = datetime.datetime.now()
nowDatetime = now.strftime('%Y-%m-%d %H:%M:%S')
for url_data in data:
with open("./craw.log", "a") as m... | true |
aae0a4867cb20cacb4e34658ac6eb7e0cb6e6593 | Python | Crone1/College-Python | /Year One - Semester One/Week Ten/count-unique-words.py | UTF-8 | 186 | 2.765625 | 3 | [] | no_license |
#!usr/bin/env python
import sys
d = {}
s = sys.stdin.readline().strip()
while s and s not in d:
d[s] = True
s = sys.stdin.readline().strip()
if not s:
print "snap:", s
| true |
bcaff91be30b8edb5a0c0c11f806486c12cf40c3 | Python | Tanmay53/cohort_3 | /submissions/sm_012_gaurav/week_23/day_5/evaluation/backend/helpers.py | UTF-8 | 749 | 2.625 | 3 | [] | no_license | import jwt
import hashlib
import secrets
def generate_salt():
return secrets.token_urlsafe(16)
def generate_hash(password, salt):
md5 = hashlib.md5()
hash_string = password + salt
for _ in range(50):
md5.update(hash_string.encode('UTF-8'))
hash_string = md5.hexdigest()
return hash_... | true |
156a703bed0f22c2369f217df7fa6d395ced4a0a | Python | RotorHazard/RotorHazard | /src/server/util/rhBinInfo.py | UTF-8 | 2,045 | 2.53125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | # Utility to display version and build-timestamp strings in RotorHazard node firmware '.bin' file
#
# Example Usage:
#
# cd ~/RotorHazard/server
# python util/rhBinInfo.py http://www.rotorhazard.com/fw/rel/current/RH_S32_BPill_node.bin
#
import sys
sys.path.append('../server')
sys.path.append('../interface')
sys.path... | true |
4b68bddd98277fd87f90c9b0054365e7f9e31636 | Python | allenkim/acm-cheat-sheet | /test/341/dij.py | UTF-8 | 1,574 | 3 | 3 | [] | no_license | from heapq import heappush, heappop, heapify
if 0 == 0:
region = 0
while True:
region += 1
try:
nvert = int(input())
except:
break
if (nvert == 0):
break
nodes = {}
try:
for i in range(nvert):
nodes[i] = []
for j in range(nvert):
inp = [int(x) for x in input().split()]
n = inp[... | true |
58253c38d0d61b8b816a414e2e2a0a659b6f8f76 | Python | songting77/pabug | /day03/1深度爬.py | UTF-8 | 1,234 | 2.96875 | 3 | [] | no_license | import requests
import re
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36'
}
#获取网页源码,返回html源码
def getHtml(url):
res = requests.get(url, headers=headers)
return res.content.decode('utf-8','ignore')
#筛选出HTML中的 URL(... | true |
dd9294a5cfb2b341f636ca0de3aae8af4d06157a | Python | KevinMichaelCamp/Python-HardWay | /Algorithms/Chapter1_Fundamentals1/Page20/07_Fit_the_First_Value.py | UTF-8 | 478 | 4.875 | 5 | [] | no_license | # Create a function that accepts an array. If value at [0] is greater
# than array's length, print "Too big!"; if value at [0] is less than
# array's length, print "Too small!"; otherwise print "Just right!".
def fitFirstValue(arr):
if arr[0] > len(arr):
print("Too big!")
elif arr[0] < len(arr):
... | true |
573f184e028230c4b92a3647076685b6733e8eae | Python | qixiangyang/DSA | /Leetcode/251-300/00263_ugly_number.py | UTF-8 | 572 | 3.546875 | 4 | [] | no_license | """
Description:
Author:qxy
Date: 2019-06-11 20:10
File: 00263_ugly_number
"""
"""
编写一个程序判断给定的数是否为丑数。
丑数就是只包含质因数 2, 3, 5 的正整数。
示例 1:
输入: 6
输出: true
解释: 6 = 2 × 3
示例 2:
输入: 8
输出: true
解释: 8 = 2 × 2 × 2
示例 3:
输入: 14
输出: false
解释: 14 不是丑数,因为它包含了另外一个质因数 7。
说明:
1 是丑数。
输入不会超过 32 位有符号整数的范围: [−231, 231 − 1]。
"""
de... | true |
4aba02029ba12ea3270e1685b066b40675d7cd6c | Python | rickstaa/LAC-TF2-TORCH-translation | /sandbox/speed_comparison/network_speed_test/profile_forward_full_pass.py | UTF-8 | 1,767 | 2.96875 | 3 | [] | no_license | """Small test script that profile the speed of a forward pass through the networks.
"""
import time
import torch
from gaussian_actor_torch import SquashedGaussianMLPActor
from lyapunov_critic_torch import MLPLyapunovCritic
# Script settings
N_SAMPLE = int(1e4) # How many times we sample
############################... | true |
7c9b888c419b2df4d0cd34e8b6857ea237838f1c | Python | RandyHodges/Self-Study | /Python/numbers/Shopping.py | UTF-8 | 1,131 | 4.90625 | 5 | [] | no_license | # ================= Compulsory Exercise 2 ==================
# Create a new Python file in this folder called “Shopping.py.”
# Once this is done ask the user to enter the name of three products
# The price of each product. Each product must have two decimal values.
# Calculate the total of all three products.
# C... | true |
80b8aa89ecd6a3b75e63c2f02bb86c89a9fef2ed | Python | ghrushma/LetsupGrade-Python_Batch6 | /python Day 3/question1.py | UTF-8 | 565 | 4.5625 | 5 | [] | no_license | print(" Program to check weather,the number is Prime or Not ?? \n")
number = int(input("Enter a number : \n"))
temp = number
if number > 1:
for i in range(2,number):# Search range is from 2 to number - 1
if(number % i) == 0:
var = number//i
print(f"The entered number : {te... | true |
8fb857671a718623317d652568430e6b892ff7d8 | Python | ishimko/continuous-queuing-system | /simulator/deivce.py | UTF-8 | 1,330 | 3 | 3 | [
"MIT"
] | permissive | from math import log
from random import random
class Device:
def __init__(self, erlang_shape, break_intensity, repair_intensity):
self._break_intensity = break_intensity
self._repair_intensity = repair_intensity
self._need_time = self._get_working_time()
self._erlang_shape = erlang... | true |
45c0bbc5a47ed2d509ff9dbd116c4ac5d28accc4 | Python | lishulongVI/leetcode | /python/449.Serialize and Deserialize BST(序列化和反序列化二叉搜索树).py | UTF-8 | 2,911 | 3.96875 | 4 | [
"MIT"
] | permissive | """
<p>Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connection link to be reconstructed later in the same or another computer environment. </p>
<p>Design an algorithm to serialize and d... | true |
de772136928b4363f9088c177bbfdda066eb0886 | Python | nandu7180/Python | /List.py | UTF-8 | 816 | 3.40625 | 3 | [] | no_license | """lis1 = [1, 22, 2, 15, 3, 4, 5]
lis1.append(6)
print lis1
lis1.extend([7])
lis1.extend([8, 9])
print lis1
lis1.insert(6, 22)
print lis1
lis1.remove(22)
print lis1
lis1.pop(2)
lis1.pop()
print lis1
print lis1.count(5)
lis1.sort()
print lis1
lis1.reverse()
print lis1"""
"""print repr("hai")
print... | true |
f12ab9528e1a974a05c13aa6d57afd120aa7931b | Python | BenjaminSchubert/mtgcollector | /lib/__init__.py | UTF-8 | 617 | 2.84375 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Utilities for mtgcollector's application
"""
import inspect
__author__ = "Benjamin Schubert, <ben.c.schubert@gmail.com>"
def get_subclasses(base_class: callable) -> list:
"""
Gets all non abstract subclasses for a given base class
:param base_class: the ... | true |
8612d5a18c000be924572f6d512bff6354f66076 | Python | jferguson47/Inverted-Pendulum | /Question3.py | UTF-8 | 6,379 | 3.1875 | 3 | [] | no_license | import sympy as sym
# LINERESIATION
# phi(F, x3,x4) -phi(F0, x30, x40) +(dphi/dF)((F0, x30, x40)
# define phi
# define psi
# define all involved symbolic functions
#constants
M, m, g, ell = sym.symbols('M, m, g, ell', real=True, postive=True)
# System variables
x1, x2, x3, x4, F = sym.symbols('x1, x2, x3, x4, F')... | true |
3ca14768de4322b5db34bcd45410182b3675aca1 | Python | JiaoyuGuo/Big-Data-Basic-Recommender-System-and-Extensions | /evaluations.py | UTF-8 | 6,557 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''Evaluate MAP for ALS model in 2 ways
Parameters
----------
train_data: parquet file that turns into spark DF with columns ['user_id', 'book_id', 'rating']
validation_data: parquet file that turns into spark DF with columns ['user_id', 'book_id'... | true |
ecb9ecfc98f961b6def5cc3f2ca0909fdf7d85da | Python | wsilveirasouza/Python_Completo | /aula20/forelse.py | UTF-8 | 245 | 4.25 | 4 | [] | no_license | '''
FOR ELSE
'''
variavel = ['wellington','matheus','lucas']
for valor in variavel:
if valor.lower().startswith('j'):
pass
# continue
print(valor)
else:
print('nao existe uma palavra que começa com a letra j.')
| true |
8fe90486ec61e17ae42e44c0386dee3363eb882b | Python | aliyamullina/inno_hw_onyx_taxi | /db.py | UTF-8 | 1,495 | 2.59375 | 3 | [] | no_license | from sqlalchemy import (
Column,
Integer,
String,
Boolean,
DateTime,
create_engine,
ForeignKey,
)
from sqlalchemy.ext.declarative import declarative_base
engine = create_engine("sqlite:///app.db")
Base = declarative_base()
class Driver(Base):
"""Описание БД с данными о водителях."""
... | true |
afe3ad0bf43ac11ebe96fd261d88b198f3ae4a98 | Python | ColonolNuttyFork/WickedWhims-lol-update | /My Script Mods/WickedWhims_Scripts/Scripts/turbolib/math_util.py | UTF-8 | 5,825 | 2.578125 | 3 | [] | no_license | import math
import math as nmath
import services
import sims4.geometry
import sims4.math as smath
import terrain
from objects.components.line_of_sight_component import LineOfSight
from routing import SurfaceIdentifier, SurfaceType
class TurboMathUtil:
__qualname__ = 'TurboMathUtil'
class Terrain:
__qu... | true |
5e8889b2ea304d1f9d59b071653df29431298054 | Python | scikit-hep/pyhf | /src/pyhf/tensor/tensorflow_backend.py | UTF-8 | 25,568 | 3.109375 | 3 | [
"Apache-2.0"
] | permissive | """Tensorflow Tensor Library Module."""
import logging
import tensorflow as tf
import tensorflow_probability as tfp
log = logging.getLogger(__name__)
class tensorflow_backend:
"""TensorFlow backend for pyhf"""
__slots__ = ['name', 'precision', 'dtypemap', 'default_do_grad']
#: The array type for tensor... | true |
c13ddfb7e858741362c81a0fbde1f96638b9fd86 | Python | AhmedSakrr/CS6490_NetworkSecurity_FinalProject | /iot23/test/iot23_analysis.py | UTF-8 | 2,063 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python3
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.metrics.pairwise import euclidean_distances
botnet_list = []
with open("botnet_name_list.txt") as file:
for line in file:
botnet_list.append(line[:-1]) #storing everything in m... | true |
6770d46a1de6502051d2cfdd26a36d08b3f86d32 | Python | pwgraham91/Python-Exercises | /graphing/gen_graph.py | UTF-8 | 2,793 | 3.90625 | 4 | [] | no_license | # generate an undirected graph (as JSON) with N nodes and of degree M.
# do this by starting with a fully-connected graph and then removing nodes until you reach degree M.
# A note on notation:
# this is a "digraph": {1:set([2,3]), 2:set(1,3), 3:set(1,2)}
# this is a "flat digraph": [[1,[2,3]],[2,[1,3]],[3,[1,2]]]
# t... | true |
835477caf314009864df58765a5eb6d7267d7c3a | Python | bagdatzhumagazieva/Web-Development | /Week10/Informatics/2936.py | UTF-8 | 82 | 3.3125 | 3 | [] | no_license | a=int(input())
b=int(input())
c = (a*a) + (b*b);
# c = c**(0.5)
print (c**(0.5)); | true |
b024d1ed0405dd73ebcecd6bf61f80b5aa3a983e | Python | Ronnapon/python-example | /d-datastructures9.py | UTF-8 | 255 | 3.515625 | 4 | [] | no_license | # Unpacking
a = [1, 2, 3]
print(*a)
value = [*range(5), *'Hello']
print(value)
first = [1, 2]
second = [3, 4]
value = [*first, 'b', *second]
print(value)
first = dict(a=1, b=2)
second = dict(c=3, d=4)
value = {**first, **second, "e": 50}
print(value)
| true |
f6967eae8b4a8a57ef640cf90207e6b655dc27b6 | Python | reslp/genomics | /genome_viz.py | UTF-8 | 1,439 | 3.125 | 3 | [] | no_license | #!/usr/bin/env python
# written by Philipp Resl
import numpy as np
from scipy import misc
import sys
Info = """
Creates a visual image from a genome assembly in PNG format.
Due to constraints in the image creating process assemblies >100MB will be split up in multiple files.
usage: $ genome_vix.py assembly.fasta ou... | true |
6daa080c6dc2ce903fc05d477ac2a7ebc8d10ac7 | Python | coudertlab/amof | /amof/atom.py | UTF-8 | 2,599 | 3.0625 | 3 | [
"MIT"
] | permissive | """
Module containing everything related to ase atom objects:
- wrapper for ase atom module
"""
import ase
import ase.atoms
import ase.neighborlist
import numpy as np
def get_density(atom):
"""
return density from an ase atom object
"""
conversion_factor = 1.66053906660 # convert from uma per angstro... | true |
1f7b9609d279ed0ab72b3e20d608b02ef4c07f8c | Python | ravitejarmkv/Work-with-files | /Basic operations/check_if_the_file_exists.py | UTF-8 | 94 | 2.515625 | 3 | [] | no_license | import os.path
file_name = 'python.py'
exists = os.path.exists(file_name)
print(exists)
| true |