blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
07f48a42c674a6aa99bab3ffcb1d2d8ad7e83658 | forhomme/CURD-MVC | /mvc.py | UTF-8 | 7,016 | 2.953125 | 3 | [] | no_license | import backend
import mvc_exception as mvc_exc
import time
import shelve
import datetime
class Model(object):
def __init__(self, application_book):
self._book_type= 'product'
self.create_books(application_book)
@property
def book_type(self):
return self._book_type
@book_type.setter
def... | true |
8221a5084720ac0315ac54c7babf4ba4632d8dd5 | gajdosech2/AoC-2020 | /Day16/Day16.py | UTF-8 | 2,914 | 3.21875 | 3 | [] | no_license | import copy
class Rule:
def __init__(self, r1, r2, name):
rule1 = r1.split("-")
self.r1 = (int(rule1[0]), int(rule1[1]))
rule2 = r2.split("-")
self.r2 = (int(rule2[0]), int(rule2[1]))
self.name = name
def isFrom(self, value):
return (value >= self.r1[0] and val... | true |
06dc08d11797ff32c0b87a2fc5667ab3e7627ebe | acabaniss/py-households | /code/examples/example_outofdate.py | UTF-8 | 4,874 | 2.859375 | 3 | [
"MIT"
] | permissive | # #Life tables are Coale and Demeny: Male, west 4, female west 2, .2% annual increase. See Bagnall and frier
# maledeath = pd.read_csv('../data/demo/West4Male.csv')
# ages = list(maledeath.Age1) + [list(maledeath.Age2)[-1]]
# malerates = list(maledeath[maledeath.columns[2]])
# femaledeath = pd.read_... | true |
17a53a48612ded920d3019eee3ce5ec9200f1b26 | charan813/Learning-python-programming | /demo.py | UTF-8 | 116 | 2.875 | 3 | [] | no_license | cash = 19867324678987.99 # DON'T CHANGE THE CASH VARIABLE
# ADD YOUR CODE BELOW:
cash1 = cash/5
print(cash1)
| true |
8edc21d6c09e39feecff1ed53213aa431b63a03e | 2dam-spopov/di | /CURSO PYTHON-PÍLDORAS/generador2.py | UTF-8 | 225 | 3.140625 | 3 | [] | no_license | def devuelveCiudades(*ciudades):
for elemento in ciudades:
#for subElemento in elemento:
yield from elemento
ciudadesDevueltas=devuelveCiudades("Madrid","Barcelona","Valencia","Castellon")
print(next(ciudadesDevueltas)) | true |
ad541d5d10cc1e33549a2ad7e75f52864b00b1f9 | dimpusagar91/python_tutorials | /9_Errors_exceptions/exception.py | UTF-8 | 1,976 | 4.0625 | 4 | [] | no_license | '''
#But what about division by zero?
a = int(input('First number, please: '))
b = int(input('Second number: '))
print('Your result is ', a/b)
'''
'''
#Let's do a simple try-except block.
try:
a = int(input('First number, please: '))
b = int(input('Second number: '))
print('Your result is ', a/... | true |
9452c1775084512acade538132e94f42b1cfc874 | ZYB-J/algorithm | /flatten.py | UTF-8 | 630 | 3.671875 | 4 | [] | no_license | """
输入一颗树,把树变成一条链表结构
"""
from tree import Tree
def flatten(root:Tree.Node):
if root is None:
return
flatten(root.left)
flatten(root.right)
left = root.left
right = root.right
root.left = None
root.right = left
p = root
while p.right:
p = p.right
p.right = right... | true |
c56632b7a690aef61e11f0a413a2c75eb5310381 | alexander-minchin/google-calendar-simple-api | /gcsa/serializers/base_serializer.py | UTF-8 | 2,424 | 3.3125 | 3 | [
"MIT"
] | permissive | import re
from abc import ABC, abstractmethod
import json
def _type_to_snake_case(type_):
return re.sub(r'(?<!^)(?=[A-Z])', '_', type_.__name__).lower()
class BaseSerializer(ABC):
type_ = None
def __init__(self, obj):
if isinstance(obj, self.type_):
self.obj = obj
elif isins... | true |
eed3c1c5d00cf4b28fc299483928352bd5ee8023 | KongsonPark/Algorithm_Playground | /BOJ/boj_2902.py | UTF-8 | 72 | 3.28125 | 3 | [] | no_license | s = input().split('-')
for i in range(len(s)):
print(s[i][0],end='') | true |
8d7c9ed469854bf942cfacb8bd16d8b77d5f7679 | KVessey/AdvancedWaterControlWebApp | /db_setup.py | UTF-8 | 1,814 | 2.75 | 3 | [
"MIT"
] | permissive | # db_setup.py
import sys
# for creating the mapper code
from sqlalchemy import Column, ForeignKey, Integer, String
# for configuration and class code
from sqlalchemy.ext.declarative import declarative_base
# for creating foreign key relationship between the tables
from sqlalchemy.orm import relationship, backref
... | true |
fdee3f78269c8c2803291b908c8da6a6467f174e | rushiagr/basic-algos | /interview/020-nested-list-weight-sum.py | UTF-8 | 415 | 3.734375 | 4 | [] | no_license | # http://www.programcreek.com/2014/05/leetcode-nested-list-weight-sum-java/
def nested_weight(l):
return helper(l, 1)
def helper(l, weight):
ans = 0
for i in l:
if type(i) == int:
ans += i*weight
elif type(i) == list:
ans += helper(i, weight+1)
return ans
print(... | true |
1bf019c7d463830bdaa800e6ff6115c51c17e7a9 | sckobeleva/Bot_dictionary | /bot.py | UTF-8 | 10,329 | 2.609375 | 3 | [] | no_license | import telebot
import json
import requests
from telebot import types
token = '1466443653:AAGkax4-pi_MQJZhgPObHgyR9C2WcL3KwAo'
bot = telebot.TeleBot(token)
token_ya = 'dict.1.1.20201210T104723Z.308567fc9aedf8f7.9a02e5033bb6b2e7b497a2624c7aae86a37a5de5'
base_url = 'https://dictionary.yandex.net/api/v1/dicservice.json/lo... | true |
708181563e009702c1a89f7a4dce59216c3fd855 | mart-r/hw-burgers | /exactcache/burgers_exact_cacher.py | UTF-8 | 4,311 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python3
import numpy as np
from scipy.io import savemat, loadmat
from scipy.interpolate import interp2d
import sys, os
import mpmath as mp
# integration
if sys.version_info[0] < 3:
raise Exception("Must be using Python 3")
# my "package"
sys.path.append('/home/mart/Documents/KybI/2019/python/hw-bu... | true |
c52bd02e3e48382c9c62c10f60371a23ef7a60e0 | elahe-dastan/hands-on-ML | /housing-price/main.py | UTF-8 | 11,153 | 2.65625 | 3 | [] | no_license | import os
import tarfile
from six.moves import urllib
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from zlib import crc32
from sklearn.model_selection import train_test_split
from sklearn.model_selection import StratifiedShuffleSplit
from pandas.plotting import scatter_matrix
from sklearn.impu... | true |
d13f15b781c32d1f37abb440b977feb6b9005885 | rajatmw1999/Docker-Python-Bash-Env-Variables | /code/readcsv.py | UTF-8 | 1,516 | 3 | 3 | [] | no_license | from pandas import read_csv
import re
import boto3
import os
regex = '^[a-z0-9]+[\._]?[a-z0-9]+[@]\w+[.]\w{2,3}$'
def download(bucket_name, object_name):
localfilename='file.csv'
# print(os.environ.get('ACCESS_KEY_ID'))
s3 = boto3.client('s3',aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID'),
... | true |
0bc00c93c82832ef5eaeda75cec5a0f4be01c7a4 | ofion/MyProject | /pca.py | UTF-8 | 601 | 3.03125 | 3 | [] | no_license | import numpy as np
#obs matrix,
obs = np.matrix('-7,-7,-9,-10 ; -7.3,-7.3,-9.4,-10.1 ; -10,-10,-10,-3')
dim = obs.shape[1]
wier = obs.shape[0]
# _______1_______
#means vector
means = np.zeros((dim, 1), dtype=np.float64)
for i in range(0,dim):
means[i] = np.mean(obs.T[i])
#________2__________
#Compute the S... | true |
f4fbf9731a3906ab881533ef0a5306319829be61 | euresa/statistics | /Duke Coding Assignments/Python/Random Implementations/permutation_test.py | UTF-8 | 869 | 3.46875 | 3 | [] | no_license | """perumutation_test.py
This script simulates a permulation test for two hardcoded lists of numbers.
Author: Sam Eure, Jan 13, 2021.
Requires a Random and NumPy modules."""
from random import shuffle
A = [230, -1350, -1580, -400, -760]
B = [970, 110, -50, -190, -200]
N = 1000 #The number of permutation samples. ... | true |
a93e1ccd77b36e33f1915fb4e175814a58812d4b | Junlings/pyworking | /footfall/footfall.py | UTF-8 | 4,932 | 2.75 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
class FootFall:
def __init__(self, fs):
self.set_fs(fs)
self.cal_force_para()
def set_fs(self, fs):
self.fs = fs # walking frequency
self.vel = 1.67 * fs ** 2-4.83 * fs+4.5 ... | true |
5a9b62a2ce62ffd17231b5b528596b0e8acc8826 | HippolyteMaes/wmd | /test.py | UTF-8 | 3,108 | 3.0625 | 3 | [] | no_license | import time
import wmd
def test_distances(computer, pairs):
for doc1, doc2 in pairs:
start = time.time()
wmd = computer.wmd(doc1, doc2)
wmd_t = time.time()
wcd = computer.wcd(doc1, doc2)
wcd_t = time.time()
rwmd = computer.rwmd(doc1, doc2)
rwmd_t = time.tim... | true |
a6b9d5b1fb047762cbb30a96e366fbd60c064c25 | waynecanfly/spiderItemV2 | /common/origin_info_update.py | UTF-8 | 3,642 | 2.609375 | 3 | [] | no_license | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import os
import threading
import time
import pymysql
from common.compare_values import CompanyValues
from common.utils import read_file, alter_file, get_file_path, \
get_hongkong_spider_path, get_table_name, get_table_date, get_china_sse_spider_path,... | true |
db7455efe80723da814860acd79ba7ea1e03f2e4 | Amorant655/Summer2020 | /task1/imitator.py | UTF-8 | 729 | 3.09375 | 3 | [] | no_license | import random
class MyVar:
def __init__(self):
self.imitate = True
self.value: float = 0
class VarImitator:
def __init__(self):
self._var = {}
def add_var(self, name, val, imitate=True):
self._var[name] = MyVar()
self._var[name].value = val
self._var[name... | true |
1b4fa29d70e8793432f0620bfc2ef1ae55390e21 | lpradop/proyecto_interdiciplinar | /client_app/add_classroom_interface.py | UTF-8 | 2,611 | 2.921875 | 3 | [] | no_license | import tkinter as tk
from tkinter import ttk
from tkinter import messagebox
import requests
import os.path as path
def createAddClassroomInterface(self) -> None:
pabellon_entry = ttk.Entry(self.main_window, font="Verdana 14")
number_entry = ttk.Entry(self.main_window, font="Verdana 14")
def ... | true |
1e8648c9fc3f45c527f328d35f49271cc5a5c6a8 | renannere/GLU | /src/Interface/Main_GUI.py | UTF-8 | 3,757 | 3.09375 | 3 | [] | no_license | from tkinter import *
from Interface.GUI_Funcionario.GUI_Atualiza import Atualiza_func
from Interface.GUI_Funcionario.GUI_Deleta import Deleta_func
from Interface.GUI_Funcionario.GUI_Lista import Lista_func
from Interface.GUI_Funcionario.GUI_Buscar import Busca_func
from Interface.GUI_Cliente.GUI_Cliente import Crud_Cl... | true |
1888d382138356944141f51a1e32cf09bdd474a8 | russau/AppTetris | /PyClient/PyClient.py | UTF-8 | 2,882 | 2.859375 | 3 | [] | no_license | import random
import cgi
import logging
import copy
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
BOARD_WIDTH = 10
class PyClient(webapp.RequestHandler):
def get(self):
self.response.out.write("try POSTing")
def post(self):
... | true |
7cb258e8a453c28adbaec7b6decc0227002add56 | proballstar/mathly | /mathly/linalg/types.py | UTF-8 | 871 | 2.90625 | 3 | [
"MIT"
] | permissive | from .error import MatrixError
__all__ = []
class Matrix:
"""
Implementation of matrices.
"""
def __init__(self):
super().__init__()
self.matrix = [[1, 2, 3], [4, 5, 6]]
self.used = []
self.shape = self.get_shape()
self.__all__ = []
self.__all__.extend("... | true |
4eec10147a3479745aab51f36e046cd0dd878edf | slobzheninov/Glyphs-Scripts | /G2 Harmonize.py | UTF-8 | 2,021 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | #MenuTitle: G2 Harmonize
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
# https://gist.github.com/simoncozens/3c5d304ae2c14894393c6284df91be5b source
Glyphs.clearLog()
from math import sqrt
font = Glyphs.font
layer = font.selectedLayers[0]
def getIntersection( x1,y1, x... | true |
ba6346b6a38c147be60bfea79a52b5ffeaa8c16e | anwofi/Project_Euler | /1-50/025.py | UTF-8 | 299 | 3.46875 | 3 | [] | no_license | #! /usr/bin/python
# -*- coding: utf-8 -*-
def fib_digits(xx):
f1 = ll = 0
f0 = 1
fibs = []
while ll < xx :
tmp = f0
f0 += f1
f1 = tmp
fibs += [f0]
ll = max(ll, len(str(f0)))
return len(fibs) + 1
print fib_digits(1000)
| true |
f83cbc5d9f0ced66a21d8723c760d0c9b9e68de7 | pranv/spatial_memory | /utils/generator.py | UTF-8 | 8,445 | 3.296875 | 3 | [] | no_license | import numpy as np
import itertools
def ngram_table(bits):
'''
Generate a table that contains the probability of seeing a 1
after having seen a context of length bits-1.
'''
assert(bits >= 2)
prod = itertools.product([0,1], repeat=bits-1)
table = {}
for p in prod:
table[p] = np.random.beta(0.5,0.5)
ret... | true |
a9f52dcb6edc6b244a707fed2f392706c5509ba5 | riki20151/Python | /1.py | UTF-8 | 814 | 3.640625 | 4 | [] | no_license | def Count ( desk ):
random.shuffle(desk)
count = 0
while True:
current = desk.pop()
print('Вам попалась карта достоинством %d' %current)
count += current
if count > 21:
print('Результат %d' %count)
return count
if count == 21:
print... | true |
c459ebf3270140dccc84761143fe1a763e929f72 | niross/spark-playground | /spark-apps/most-popular-superhero-dataframe.py | UTF-8 | 1,235 | 2.75 | 3 | [] | no_license | from pyspark.sql import functions as func
from pyspark.sql.types import StructType, StructField, IntegerType, StringType
from utils import SPARK_DATA_PATH, get_spark_session
spark = get_spark_session('MostPopularSuperhero')
schema = StructType([
StructField("id", IntegerType(), True),
StructField("name", Str... | true |
dc9cc1e12d3796524e6d5f0a24e234ad721db28f | LorinChen/lagom | /test/sanity_env.py | UTF-8 | 903 | 2.515625 | 3 | [
"MIT"
] | permissive | import numpy as np
import gym
from gym.spaces import Box
class SanityEnv(gym.Env):
def __init__(self):
self.T = np.random.randint(4, 6+1)
self.reward_range = (0.1, float('inf'))
self.observation_space = Box(10, 60, shape=(), dtype=np.float32)
self.action_space = Box(1, 6,... | true |
b893b179e9c8cdc555c6e4fd25c8d9662495b87b | kiffihagen/Code | /Evolving Neural Networks/EvolutionaryAlgorithms/main.py | UTF-8 | 7,558 | 3.046875 | 3 | [] | no_license | '''
The program starts here. This is based on user interaction. To simulate several runs, use simulate.py
'''
from one_max import OneMaxHandler # Needed to start one-max
from surprising_sequences import SurprisingSequencesHandler # Needed to start surpri... | true |
ae17299d7ada3eaaf3f2f906a76fe2e682e0610d | rperezmendoza/CS471A3 | /helper_funcs.py | UTF-8 | 2,291 | 3.46875 | 3 | [] | no_license | import sys
'''
Given a complete command, return the function portion of the command
e.g if command = "get data.txt" return "get"
'''
def get_cmd_type(input):
return input.split()[0]
'''
Determine if the given command is defined
'''
def invalid_cmd(input):
all_cmds = ['get', 'put', 'ls', 'lls', 'quit']
ret... | true |
f01b6c3692b6108fabb72ba70ab7770c7bd6d177 | annapetrone/dojo-py1-form-test | /server.py | UTF-8 | 742 | 2.71875 | 3 | [] | no_license | from flask import Flask, render_template, request, redirect, session # learning a new thing
app = Flask(__name__)
secret_key = open('secret-key.txt', 'r').read().strip()
app.secret_key = secret_key
@app.route('/')
def index():
# print('youre on the index')
return render_template('index.html')
@app.route('/users',... | true |
d533f0b1d394e9d64fae8320f480171d80f107c6 | shahpriyesh/PracticeCode | /BinaryTreeQuestions/AverageOfLevels.py | UTF-8 | 1,316 | 3.671875 | 4 | [] | no_license | class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class AverageOfLevels:
def __init__(self):
pass
def averageOfLevels(self, root: TreeNode):
response = []
queue = []
total = 0
count = 0
prev_l... | true |
15d1b1b5fbacd3afce1be6ba1af9e74a2ce1db35 | HELL-TO-HEAVEN/pythreshold | /pythreshold/local_th/feng.py | UTF-8 | 4,031 | 3.078125 | 3 | [
"MIT"
] | permissive | # -*- coding:utf-8 -*-
import numpy as np
from skimage.util.shape import view_as_windows
__copyright__ = 'Copyright 2017'
__author__ = u'BSc. Manuel Aguado Martínez'
def feng_threshold(img, w_size1=15, w_size2=30,
k1=0.15, k2=0.01, alpha1=0.1):
""" Runs the Feng's thresholding algorithm.
... | true |
fbe454ed574f7f0023f545796a58e86393316c6e | the-fridge/miscellaneous | /Remixer.py | UTF-8 | 2,401 | 3.09375 | 3 | [] | no_license | # this programm takes a source file of which you have to provide the path to
# it finds all the words in the file strips the file of them and puts them back in
# but in a completly random order
# braces stay in their places also everything which isn't a word
# it returns the result in a .txt file, that has otherwis... | true |
62e6b5cd82fdf2cde50bea5c4a7c85bf6843ee75 | ajw2329/multi_species_as_events | /cross_events_same_transcripts.py | UTF-8 | 10,427 | 2.671875 | 3 | [] | no_license | '''
Program to compare pairwise events generated from a single annotation that has been mapped to two species (the original, and a closely related species)
Primary use case as of 10/27/2017: Compare events generated from gencode v24 (GRCh38) and gencode v24 mapped to RheMac8 by Ian Fiddes (Haussler Lab) and
generate a... | true |
920c94bb8e579ef36fe74381c53182c3fd5f5552 | Sharkhacks21/ikea-the-game | /highScore.py | UTF-8 | 5,066 | 3.078125 | 3 | [] | no_license | ### the high score UI
import math
import pandas as pd
import pygame
# display window size
display_width = 700
display_height = 600
score_width = 120
# set colour values arrays
black = (0, 0, 0)
dark_gray = (50, 50, 50)
gray = (130, 130, 130)
light_gray = (180, 180, 180)
white = (255, 255, 255)
red = (240, 91, 74)
gr... | true |
e2fb89b4281291f136e6b77917f6e81f59ce471e | silvewheat/biocal-cli | /cal_allele_freq_from_vcf.py | UTF-8 | 1,736 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Oct 7 16:59:53 2020
@author: YudongCai
@Email: yudongcai216@gmail.com
"""
import click
import allel
import pandas as pd
from collections import defaultdict
@click.command()
@click.option('--vcffile')
@click.option('--groupfile', help='sampleID\tgroupID... | true |
b22d95c9f9b03e3bf226c9bb85c2fb4414df033e | anand2597/guvi | /wip.py | UTF-8 | 67 | 3.171875 | 3 | [] | no_license | a=int(input())
if a>0:
print("positive")
if a<0:
print("negative")
| true |
c858ee830e371957ea15554dc5365dad5f23488d | ibz/liberatio | /gowalla_parse.py | UTF-8 | 947 | 2.78125 | 3 | [] | no_license | #!/usr/bin/python
# USAGE:
# 1. run fetch_gowalla.py first, to save your checkins to JSON
# 2. run this script, passing the JSON file as an argument
# * it will display all checkins in the JSON file in an easy to read format
# * it will fetch all photos associated to checkins and save them
import simplejson
import sy... | true |
30cdc1994e32c7a4db2b0d158635401d48398d57 | agioio/Codewars | /8 kyu/Strings/do_i_get_bonus.py | UTF-8 | 1,263 | 4.375 | 4 | [] | no_license | """It's bonus time in the big city! The fatcats are rubbing their paws in anticipation... but who is going to make the most money?
Build a function that takes in two arguments (salary, bonus). Salary will be an integer, and bonus a boolean.
If bonus is true, the salary should be multiplied by 10. If bonus is false, t... | true |
32988e75e448ba7fb1d4c7a9d49f4830d1073813 | sdhunt/jdvue | /scripts/gen-java-src-db.py | UTF-8 | 4,128 | 3.15625 | 3 | [] | no_license | """
gen-java-src-db.py
Generates a Java package/import database, suitable as input for JDVue.
Also generates Number of Lines of Code statistics, while we're at it.
Usage:
python gen-java-src-db.py <srcroot> <outfilebase>
where:
<srcroot> is the directory at the top of the Java Project source tree.
... | true |
a5c25963d4109a670747b8b3760e8dc10b316d07 | majurami/moje-repo | /forfunQUIRKI.py | UTF-8 | 161 | 3.109375 | 3 | [] | no_license | #PIERWSZY = [9,2,3]
#a = [1,2,3]
#b = a
#a[0] = 9
#print(b)
#DRUGI = error (powinno sie uzywac global)
a = 1
def suma():
a = a + 1
print(a)
suma()
| true |
2f4c56e09fb7950350a1b71cf49c6c1ac3db5611 | stereo720712/2021_Learn_Fork_jieba-code-reading-notes-zh | /jieba/posseg/viterbi.py | UTF-8 | 4,843 | 3 | 3 | [
"MIT"
] | permissive | import sys
import operator
MIN_FLOAT = -3.14e100
MIN_INF = float("-inf")
# 處理Python2/3相容的問題
# 為何不復用_compat.py?
if sys.version_info[0] > 2:
xrange = range
# 沒有被用到
def get_top_states(t_state_v, K=4):
return sorted(t_state_v, key=t_state_v.__getitem__, reverse=True)[:K]
def viterbi(obs, states, start_p, trans_... | true |
63d1bd7284aa7ab8af8533c2f15c2cc7c5b026ad | juliagolder/unit-5 | /warmup13.py | UTF-8 | 185 | 3.03125 | 3 | [] | no_license | #julia golder
#4/26/18
#warmup13.py
from random import randint
number = []
for i in range(20):
number.append(randint(1,100))
print(sum(number))
print(min(number))
print(max(number))
| true |
bfa7a18411b9bec08af35912799941a5d9eea451 | shuchaoG/pc | /tool.py | UTF-8 | 951 | 2.84375 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import re
#标签工具类
class Tool:
#去除img标签,1-7位空格,
removeImg = re.compile('<img.*?>| {1,7}| ')
#删除超连接标签
removeAddr = re.compile('<a.*?>|</a>')
#把换行符换成\n
replaceLine = re.compile('<tr>|<div>|</div>|</p>')
#制表符<td>换成\t
replaceTD= re.compile('<td>')
#换行符或者... | true |
1af878c5b8bb6f2cebb0fedc335817062d249c99 | shreeyaa98/Python | /Python/nptel3.py | UTF-8 | 456 | 2.96875 | 3 | [] | no_license | def countX(l,x):
return l.count(x)
def getKey(item):
return item[1]
def histogram(l):
lst=[]
for i in l:
for t in lst:
if i==t[0]:
break
else:
lst.append((i,countX(l,i)))
list=sorted(lst,key=getKey)
for i in range(0,len(list)):
for j in range(0,len(list)-1):
if list[j][1]==list[j+1][1]:
if... | true |
1f08ebeeebfb01e473653059fbf2ba385a3dd9a9 | susami-jpg/atcoder_solved_probrem | /Magic_For_Balls.py | UTF-8 | 609 | 3.09375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Jun 24 22:43:23 2021
@author: kazuk
"""
from math import sqrt, ceil
from sys import exit
n = int(input())
ans = []
nroof = int(sqrt(n))
now = n
if n % 2 == 0:
while now % 2 == 0:
ans.append(2)
now /= 2
for i in range(3, nroof + 1):
i... | true |
999d5cae3167906df99b7591aa98918d74db828c | tobymao/sqlglot | /sqlglot/diff.py | UTF-8 | 14,036 | 2.859375 | 3 | [
"MIT"
] | permissive | """
.. include:: ../posts/sql_diff.md
----
"""
from __future__ import annotations
import typing as t
from collections import defaultdict
from dataclasses import dataclass
from heapq import heappop, heappush
from sqlglot import Dialect, expressions as exp
from sqlglot.helper import ensure_list
@dataclass(frozen=Tr... | true |
db509bc5c514d48ea0dfcfd2b0445bd8879e87a3 | PacktPublishing/-Python-By-Example | /Section 1/Section1/Video2_Nesting_Python_dicts_2_vehicles.py | UTF-8 | 784 | 3.5625 | 4 | [
"MIT"
] | permissive | '''
Created on Mar 30, 2018
@author: Burkhard A. Meier
'''
from pprint import pprint
cars = {}
car_1 = {'make': 'BMW', 'speed': 'fast'}
car_2 = {'make': 'Mercedes', 'speed': 'good'}
car_3 = {'make': 'Porsche', 'speed': 'very fast'}
cars['car 1'] = car_1
cars['car 2'] = ca... | true |
6a37743b1d7dcc359a7737ba94db9615d572ed5e | od210291jpv/django | /django/studentsdb/students/models.py | UTF-8 | 1,809 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from django.db import models
# Create your models here.
# Student model
class Student(models.Model):
class Meta(object):
verbose_name = u"Student"
verbose_name_plural = u"Students"
first_name = models.CharField(
max_length=256,
blank=False,
... | true |
5306b800ebf6a2af6408ca1b9ac1b7b859b9b2b4 | calixo888/var-changer | /var-changer.py | UTF-8 | 732 | 2.75 | 3 | [] | no_license | from pathlib import Path
import os
import sys
target = sys.argv[1]
replacement = sys.argv[2]
path = sys.argv[3]
extension = sys.argv[4]
def replace_var(target, replacement, path, extension):
result = list(Path(path).rglob("*." + extension))
for i in result:
read_file = open(i, 'r')
lines = rea... | true |
1e8244cfd8874519869529e6122b1f5c0e5c480c | AngelsProjects/DataCamp | /Introduction-to-Data-Science-in-Python/02-Loading-Data-in-pandas/05-More-column-selection-mistakes.py | UTF-8 | 1,147 | 4.09375 | 4 | [] | no_license | '''
More column selection mistakes
Another junior detective is examining a DataFrame of Missing Puppy Reports. He's made some mistakes that cause the code to fail.
The pandas module has been loaded under the alias pd, and the DataFrame is called mpr.
Instructions 1/3
35 XP
Inspect the DataFrame mpr using info().
In... | true |
7ef580261919d68bdcad6efa5a92adb5cb2ebcb7 | daguiam/texture_vibration_generator | /texture_vibration_generator.py | UTF-8 | 20,733 | 2.6875 | 3 | [] | no_license | import simpleaudio as sa
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
from scipy import interpolate
import wave
import pyaudio
import time
import win32gui
import win32api
import math
def round_up_to_even(f):
return math.ceil(f / 2.) * 2
class Cursor():
def __init__(self,dpi=... | true |
22668bb407f23574c3bfdce7dd1eb608272e0ee2 | eronekogin/leetcode | /2019/triangle.py | UTF-8 | 894 | 3.8125 | 4 | [] | no_license | """
https://leetcode.com/problems/triangle/
"""
from typing import List
class Solution:
def minimumTotal(self, triangle: List[List[int]]) -> int:
n = len(triangle)
if not n: # Empty triangle.
return 0
currRow = [0] * n
currRow[0] = triangle[0][0]
for row in ... | true |
3193e7bd17f4e306ed290b8d7431ee30bb7bec27 | smileff/Intro2Algo | /m040103_MaximumSubarray.py | UTF-8 | 4,233 | 3.578125 | 4 | [] | no_license | from m000000_Test import PrintPerformance, GetRandomIntegers
def BruteForceFindMaximumSubarray(nums, b, e):
if e - b < 1:
return (-1, -1, 0)
if e - b == 1:
return (0, 1, nums[b])
# Setup an scan array for fast subarray summing.
scan = [0]
sum = 0
for n in range(b, e):
s... | true |
4bd6988dc561be49e6225ab81a915f2e1709f8be | cherylkw/beamwallet | /bank/views.py | UTF-8 | 2,674 | 2.5625 | 3 | [
"MIT"
] | permissive | from django.shortcuts import render
from django.http import JsonResponse
from .models import WalletAccount
from tinyec import registry
import uuid
import requests
from decimal import Decimal
# --------------------------------------------------------------------------
# bank_api:
#
# A simple bank app to demo interacti... | true |
bdefb693d530755e0ed10b2913913ce3bf63287a | intel/caffe | /scripts/obtain_optimal_batch_size.py | UTF-8 | 7,666 | 2.59375 | 3 | [
"LicenseRef-scancode-generic-cla",
"BSD-2-Clause",
"BSD-3-Clause",
"LicenseRef-scancode-public-domain"
] | permissive | import subprocess
import argparse
import re
import os
import time
import logging
class OptimalBS(object):
'''Search for optimal batch size on a specified model file'''
def __init__(self, main_args):
'''init func'''
self.model_file = main_args.model_file
self.min_bs = main_args.min_bs
... | true |
0fefb781463a1c54513744e9b20bd9d821646d2f | jihunroh/ProjectEuler-Python | /ProjectEuler.Problem.016.py | UTF-8 | 297 | 2.71875 | 3 | [
"MIT"
] | permissive | from ProjectEulerCommons.Base import *
Answer(
sum(int(digit) for digit in str(2**1000))
)
"""
------------------------------------------------
ProjectEuler.Problem.016.py
The Answer is: 1366
Time Elasped: 0.005948066711425781sec
-----------------------------------------------
"""
| true |
1c10f1a3da8b2667ad1369e30cef0c0cdee18576 | Sakkadas/leetcode | /Easy tasks/subtract-the-product-and-sum-of-digits-of-an-integer.py | UTF-8 | 688 | 3.84375 | 4 | [] | no_license | """
Given an integer number n, return the difference between the product of its digits and the sum of its digits.
Example 1:
Input: n = 234
Output: 15
Explanation:
Product of digits = 2 * 3 * 4 = 24
Sum of digits = 2 + 3 + 4 = 9
Result = 24 - 9 = 15
Example 2:
Input: n = 4421
Output: 21
Explanation:
Product of digits... | true |
b360ea76fca6c047b1e0b236d0587f9d9b96c9cb | ucookie/basic-python | /11/03_魔法函数举例.py | UTF-8 | 267 | 3.375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
class Student(object):
school = '实验小学'
def __init__(self, name):
self.name = name
# def __str__(self):
# return self.school + ':' + self.name
s1 = Student('小明')
print(str(s1)) | true |
8376c6ef14bf3940e2d94d1be289f357b02d09fe | acc-cosc-1336/cosc-1336-spring-2018-zachdiamond000 | /src/assignments/assignment6.py | UTF-8 | 844 | 3.9375 | 4 | [
"MIT"
] | permissive | def get_count_A_C_G_and_T_in_string(dna_string):
'''
Create a function named get_count_A_C_G_and_T_in_string with a parameter named dna_string.
:param dna_string: a DNA string
:return: the count of As, Cs, Gs, and Ts in the dna_string
'''
count_a = 0
count_c = 0
count_g = 0
count_t ... | true |
f373516fe1f17eaf726bcf1c683340eb5f8b5acd | tradic478/Two-Dimensional-Inverted-Pendulum | /serial_test/serial_python.py | UTF-8 | 710 | 3.15625 | 3 | [] | no_license | import serial
import matplotlib.pyplot as plt
plt.ion()
ser = serial.Serial('/dev/ttyUSB0', 9600)
counter = 0
data_list = []
for i in range(8):
data_list.append([])
fig1 = plt.figure()
while 1:
fun = ser.readline()
counter += 1
for i, word in enumerate(fun.split()):
try:
print i, w... | true |
a9f60d581ea3832b38e2f57100bb50aac2e2954f | mateuszpieniak/codility | /binarygap.py | UTF-8 | 381 | 3.28125 | 3 | [] | no_license | def solution(N):
max_gap = 0
counter_value = 0
counter_status = False
while N > 0:
remainder = N % 2
if remainder == 1:
counter_status = True
max_gap = max(max_gap, counter_value)
counter_value = 0
if counter_status and remainder == 0:
... | true |
dc9f82a2a23226cbd540e59056e19a2e6cc4cba3 | pookie9/224wproj | /Graph.py | UTF-8 | 7,292 | 2.8125 | 3 | [] | no_license | import mlbgame
import nflgame
import random
import numpy as np
from sklearn.linear_model import LogisticRegression
from collections import defaultdict
#Adds the values in dict1 to dict2 and returns it
def add(dict1, dict2):
out=defaultdict(int)
for key in dict1:
if key not in dict2:
out[key... | true |
1563d849a7f88d195b6770692b11c150bf8fd03b | SENC/CSChangeDetect | /ChangeDetection_Python.py | UTF-8 | 3,452 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Spyder Editor
Date: 9-Dec-2015
Developer: Senthil Chidambaram
Ref:Geo Spatial Analysis, Joel
Scope:
Change detection using co-registered satellite images - 2 img on same location
Simple image difference techique
Logic:
[1] Check dimension,extent, projection for 2 images are same
[2] Con... | true |
3435d74130ab7e284326e030c56683d0a6af64e3 | supriyanivi/priya1 | /power of number.py | UTF-8 | 227 | 3.234375 | 3 | [] | no_license | number = (int(input("Enter any integer:"))
exponent = int(input('Enter the exponent integer:"))
power=1
for i in range(1,exponent +1):
power = power + number
print("result of{0} power {1} ={2}":format(number, exponent, power))
| true |
3611e0fc33148171ad5c4f50555a068a4150739a | lapd-c/curveball | /src/python/cb/util/cblogging.py | UTF-8 | 6,147 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
#
# This material is based upon work supported by the Defense Advanced
# Research Projects Agency under Contract No. N66001-11-C-4017.
#
# Copyright 2014 - Raytheon BBN Technologies Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in comp... | true |
382c125923a4f7670a3d3a622db56d98f4e8db50 | dtakahas/tator-py | /tator/transcode/determine_transcode.py | UTF-8 | 3,970 | 2.515625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import subprocess
import json
import argparse
import logging
import os
from ..openapi.tator_openapi.models import MediaType
from ..util.get_api import get_api
from ..util.get_parser import get_parser
STREAMING_RESOLUTIONS=[144, 360, 480, 720, 1080]
MAX_RESOLUTION=max(STREAMING_RESOLUTIONS)
log... | true |
353f6533de0fae210541b7dedb929d477134768f | vishal2098govind/ComViz_2.0 | /compiler/Compiler/lexical_analyzer/constants.py | UTF-8 | 667 | 2.671875 | 3 | [] | no_license | import string
TT_INT = 'int'
TT_FLOAT = 'float'
TT_PLUS = '+'
TT_MINUS = '-'
TT_MUL = '*'
TT_DIV = '/'
TT_LPAREN = '('
TT_RPAREN = ')'
TT_POWER = '^'
TT_KEYWORD = 'KEYWORD'
TT_IDENTIFIER = 'id'
TT_EQ = ' EQ '
TT_EE = 'EE'
TT_NE = 'NE'
TT_LT = 'LT'
TT_LTE = 'LTE'
TT_GT = 'GT'
TT_GTE = 'GTE'
TT_EOF = 'EOF'
OPERATORS = ... | true |
d2b0e3af3781cb14e7c02e611d1195512dc15961 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_213/92.py | UTF-8 | 2,582 | 2.796875 | 3 | [] | no_license | import sys
def seat_proirity(tiks):
ret = list(range(len(tiks)))
sort_key = lambda index: (-1 * min(tiks[index]), index)
ret.sort(key = sort_key)
return ret
def try_remove(tiks, cust, ex_seat, seat_order):
for seat in seat_order:
if seat == ex_seat:
continue
... | true |
52c7a6205df2e31ed565145dbcc2b2652b40946a | sneharnair/Binary-Search-4 | /Problem-2_intersection_of_two_arrays_ii.py | UTF-8 | 4,452 | 3.890625 | 4 | [] | no_license | # APPROACH 1: HASHMAP
# Time Complexity : O(n1 + n2), n: len(nums1), n2: len(nums2)
# Space Complexity : O(min(n1, n2)) - space of hashmap
# Did this code successfully run on Leetcode : Yes
# Any problem you faced while coding this : None
#
#
# Your code here along with comments explaining your approach
# 1. Always ens... | true |
ae834a250879dd0bea437a5fbb3170ea9badd201 | duanluyun/SolutionsOfLeetCode | /73. Set Matrix Zeroes(1).py | UTF-8 | 835 | 2.921875 | 3 | [] | no_license | class Solution:
def setZeroes(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: void Do not return anything, modify matrix in-place instead.
"""
req=[]
for y in range(len(matrix)):
for x in range(len(matrix[0])):
if matrix[y][x]==0:
... | true |
f51c545461d883bed337eba68a775d999fe5ed4c | nchow24/UGSoloSubmissions | /CS3340 - Algorithm Analysis/Edit Distance and Optimal Alignment/editDist.py | UTF-8 | 3,319 | 3.40625 | 3 | [] | no_license | # 3340 Assignment 3 Q7
# Nicole Chow (nchow24 250725575)
# Mar 13, 2018
import sys
# get and parse files
f1 = open(sys.argv[1],"r")
f2 = open(sys.argv[2],"r")
string1 = []
string2 = []
for line in f1:
line = line.replace("\n", " ")
string1.extend(line)
for line in f2:
line = line.replace("\n", " ")
s... | true |
35ee611491b75a81a17411ccfd1db3061be10e86 | lxtxl/aws_cli | /fms_write_2/resource_tag.py | UTF-8 | 1,814 | 2.796875 | 3 | [] | no_license | #!/usr/bin/python
# -*- codding: utf-8 -*-
import os
import sys
sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
from common.execute_command import write_two_parameter
# url : https://awscli.amazonaws.com/v2/documentation/api/latest/reference/fms/tag-resource.html
if __name__ == '__main__':... | true |
861f58cc81f2027ca3c61d1d7bfc51f6e9b3e27d | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_199/3120.py | UTF-8 | 623 | 2.921875 | 3 | [] | no_license | def flip(p, i, k):
for j in range(i, i+k):
p[j] = not p[j]
file = open('A-large.in', 'r') # r for read
out = open('a.out', 'w') # w for write
#
n = int(file.readline().strip())
for c in range(n):
l = file.readline().strip().split(' ')
p = [True if e == '+' else False for e in l[0]]
... | true |
7ae234c4b5c5e80f6b59f8b276fe7a7e2b45ad52 | zembrzuski/deeplearning-course | /004_shallow_nn_backpropagation.py | UTF-8 | 1,332 | 3.265625 | 3 | [] | no_license | import general_functions as funcs
import numpy as np
# minha rede neural vai ter uma única layer, por enquanto.
# se minha input layer tem shape==(2,3) pois possui duas features
# e tem 3 elementos, entao minha layer do meio vai ter shape==(4,3)
# pois minha layer do meio tem 4 neuronios, que equivalem a features
# ... | true |
985173ffd76fae5d22db2eb97c8ba352d9c49562 | tade147/note_function | /make_album.py | UTF-8 | 200 | 3.046875 | 3 | [] | no_license | def make_album(singer, album_name):
"""存储歌手及专辑名"""
album = {'singer': singer, 'album': album_name}
return album
m_album = make_album('黄龄', '痒')
print(m_album)
| true |
0c9fb87068fe73d08bcc724b3ba408115e171532 | 112517249/test_requests_unittest | /demo_url_params.py | UTF-8 | 467 | 2.953125 | 3 | [] | no_license | #导包
import requests
#查询参数在url中
response=requests.get("http://www.baidu.com/S?ie=UTF-8&wd=python")
#参数为params字符串
response_params_string=requests.get("http://www.baidu.com/S",params="wd=淮上")
#参数为字典
response_params_dict=requests.get("http://www.baidu.com/S",params={"wd":"priest"})
#打印结果
# print(response.text)
# print("... | true |
10cd7245edc1a71df30715e4de8acbd08c936e6c | nursnaaz/ML-Deployement | /cars-price-predictor/data/data_scrapper.py | UTF-8 | 1,748 | 3.234375 | 3 | [
"CC0-1.0"
] | permissive | from bs4 import BeautifulSoup
import requests
import pandas as pd
import csv
def get_ads_urls():
urls_list = []
# define the basic url to crawl on
basic_url = "https://www.avito.ma/fr/maroc/voitures-à_vendre?sp=1&o="
# loop over the paginated urls
for i in range(1,100):
# get the page url
url = basic_url+str... | true |
02499bafb2c2f42d69d5306b5017e111d784bbf6 | MysteriousSonOfGod/Python-2 | /Lyceum/lyc2/web_except_defaultList.py | UTF-8 | 421 | 3.328125 | 3 | [] | no_license | class DefaultList(list):
def __init__(self, def_num):
self.def_num = def_num
self.data = []
def __getitem__(self, ind):
try:
item = super(DefaultList, self).__getitem__(ind)
except IndexError:
item = self.def_num
return item
# s = DefaultList(51... | true |
6cdda74f6b9942ccc13996c667ee4aae0d353911 | CWu7657/My-Python-Design-Project | /exp.py | UTF-8 | 413 | 3 | 3 | [] | no_license | import turtle
from myFunctionfile import *
bob = turtle.Turtle()
turtle.colormode(255)
bob.speed(0)
for n in range(200):
bob.pensize(3)
bob.color(n,n,n)
bob.circle(n)
bob.right(135)
for times in range(200):
bob.pensize(6)
bob.color(255,255,255)
... | true |
e0b445f59cb8c28725872bbc10f9e098b3f4ac0b | Krugger1982/Algoritmes_SD | /Less_11_Tests.py | UTF-8 | 7,647 | 3.640625 | 4 | [] | no_license | import unittest
import random
class MyTestCase(unittest.TestCase):
def test_1_put_and_size (self):
# создаем тестовое множество из нескольких тысяч последовательных (неповторяющихся) чисел
Set1 = PowerSet()
N = 100000
for i in range(N):
Set1.put(i)
self.assertEq... | true |
924f4a154838beb7756c6d892c79da5965ab1994 | Aasthaengg/IBMdataset | /Python_codes/p03660/s915761804.py | UTF-8 | 744 | 3.25 | 3 | [] | no_license | from collections import deque
N = int(input())
E = {}
for i in range(N):
E[i] = []
for i in range(N-1):
a,b = list(map(int, input().split()))
a,b = a-1, b-1
E[a].append(b)
E[b].append(a)
# DFS for tree
def dfs(startp, depth):
visited = [False for i in range(N)]
d = deque()
d.append(startp)
while... | true |
fb65971a149bf7144cc38e0b2e5bf3107c2afdc6 | MatixAI/Speech_to_text | /mytext.py | UTF-8 | 1,568 | 2.640625 | 3 | [] | no_license | # NeMo's "core" package
import nemo
# NeMo's ASR collection - this collections contains complete ASR models and
# building blocks (modules) for ASR
import nemo.collections.asr as nemo_asr
import deepspeech
import wave
import numpy as np
print("Kindly Select the model you want to use for translation\n 1. \tQuartzNet\n 2... | true |
aa24bdc1156729f5f3dbc2ce78da6234e4b94bc0 | Amankumar17/Fractional-Calculus | /Library/Fd_Successive_Differentiation.py | UTF-8 | 631 | 3.421875 | 3 | [] | no_license | import math
import matplotlib.pyplot as plt
def successive_differentiation(mu,alpha):
i=0
f=[]
t=[]
dio=[]
dfo=[]
print(math.gamma((mu+1)/math.gamma(mu-alpha+1)),end="")
print("t^"+str(mu-alpha))
while(i<10):
t.append(i)
f.append(pow(t[-1],mu))
dio.append(mu*pow(... | true |
bb275a30c92f4ea955dd5c333d3e0b98058f2c46 | yrkumar/which-course | /Scrapy/viewRatings.py | UTF-8 | 186 | 3.03125 | 3 | [] | no_license | import pickle
file_handler = open('ratings', 'r')
ratings = pickle.load(file_handler)
file_handler.close()
for course in ratings:
print repr(course)
print ratings[course]
print "\n"
| true |
52f9a2a015320c6d030803e81fb77d3431f78a57 | michal-franc/CodingKatas | /leetcode/30days/single_number.py | UTF-8 | 965 | 3.859375 | 4 | [] | no_license | # solutions
# super brute force - for each element search rest of list
# but this is O(n^2) as we repeat the list search for each element
# brute force - go through each item and count them to dict then go through dict and find items with 1 element
# this would give O(n) as this would be
# pass through array O(n) + p... | true |
dffe1ef7814251205001664770f793d277e32ead | FredAmouzgar/python_Exercise | /PyTorch Exercises/My_CNN_Sample.py | UTF-8 | 1,425 | 2.828125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import torch
from torch import nn
import torch.nn.functional as F
class ConvNet(nn.Module):
def __init__(self, input_shape=(1,3,28,28)):
super(ConvNet, self).__init__()
self.cnn = nn.Sequential(nn.Conv2d(in_channels=3,... | true |
ede3b922fb1e94a84dad40002e70edbab05ecfe1 | qustoo/AttractionMaps_testing | /handlers/users/pay_for_maps.py | UTF-8 | 4,485 | 2.625 | 3 | [] | no_license | from random import randint
from aiogram import types
from aiogram.dispatcher import FSMContext
from aiogram.dispatcher.filters import Command
from aiogram.dispatcher.filters.state import StatesGroup, State
from aiogram.types import CallbackQuery, ReplyKeyboardRemove
from aiogram.utils.markdown import hlink, hcode
fro... | true |
4f6f7846ac1530fa13383dd955eb10fee55121c4 | HugoSenetaire/Parallax-Free-Stitching-Experiments | /stolenMrf.py | UTF-8 | 7,670 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python3
"""
An implementation of Loopy Belief Propagation
"""
__author__ = "Joshua Wong"
__version__ = "1.0"
from os.path import abspath
import argparse
import numpy as np
import time
class Timer:
""" Timer """
def __enter__(self):
self.start = time.clock() # start
return ... | true |
c04b0ac7d64566c0e45a75bec057c51482d15e1d | surajkota/deep-learning-benchmark-mirror | /sagemaker_testing/chainer/util/trigger.py | UTF-8 | 3,510 | 2.609375 | 3 | [] | no_license | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... | true |
6dc78592a7af57e648f5547d3b53af430d70b81c | AdamLassiter/solo-calc | /src/calculus/graph.py | UTF-8 | 1,040 | 3.09375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #! /usr/bin/env python3
from collections.abc import Hashable
class graph(dict):
def insert_node(self, node: Hashable) -> None:
self[node] = frozenset()
def insert_edge(self, *nodes: Hashable):
nodes = frozenset(nodes)
for node in nodes:
if node not in self.keys():
... | true |
18be4e99e83e2dab32b62aa7a8d11eef00b56f93 | AlenaLu/PythonPY100_fall-2021-9_3 | /Занятие1/Лабораторные задания/task2_1/main.py | UTF-8 | 409 | 3.390625 | 3 | [] | no_license | tuple_ = (8, 9, -5, -3, 1, -10, 8, -10, -5, 0, 5, -4, 0, 10, -8, 1, 6, -6, 6, -9)
# TODO Каждое из значений печатать на отдельной строке
list_ = list(tuple_)
a1 = sum(list_)
print((a1)) #сумма_числе _в_кортеже
a2 = (len(tuple_))
print(a2) #кол-во чисел
a3 = a1 / a2
print (a3)
a4 = min(list_)
print (a4)
a5 = m... | true |
dfdaba0a88951b6b0d575c3b7de438ac37518232 | number09/nlp100 | /nlp28.py | UTF-8 | 1,480 | 2.765625 | 3 | [] | no_license | import json
import re
def main():
reg = re.compile(r'\'{2,}')
reg_link1 = re.compile(r'\[\[(?:[^\[\]:]+)\#(?:[^\[\]:]+)\|([^\[\]:]+)\]\]') #not match
reg_link2 = re.compile(r'\[\[(?:[^\[\]:]+)\|([^\[\]:]+)\]\]')
reg_link3 = re.compile(r'\[\[([^\[\]:]+)\]\]')
reg_file = re.compile(r'\[\[ファイル:[^... | true |
bb9337630981591523928b90934afcf43ce7dc79 | mls-itoc/boiled-pork | /scraping/developer.nrel.gov/01_YellowSandDataNormalization.py | UTF-8 | 4,295 | 3.203125 | 3 | [] | no_license | # 風邪データから黄砂への学習予測に使えそうなデータを作成する
# auther:Mitsuaki Ihara
## 風力 風速と被ってる
### power (MW)
## 気温
### air temperature at 2m (K)
## 方角 ☆
### wind direction at 100m (deg)
## 日時 ☆
### Year,Month,Day,Hour,Minute
## 風速 ☆
### wind speed at 100m (m/s)
## 気圧
### surface air pressure (Pa)
# ある研究[誰によって?]によれば、タクラマカン・ゴビ・黄土高原ともに上空... | true |
4ef431c4a0d598d8e48fae9575c1260aa74375d6 | aioworkers/aioworkers | /tests/test_nested.py | UTF-8 | 561 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | import pytest
from aioworkers.core.base import AbstractNestedEntity
from aioworkers.queue.base import PriorityQueue, Queue
@pytest.fixture
def config_yaml():
return """
p:
cls: aioworkers.core.base.AbstractNestedEntity
p:
cls:
x:
cls: aioworkers.queue.base.Queue
child:... | true |
29189a97955362842bf1e4a83c584e0d5a19fbbd | siconos/siconos-tutorials | /examples/mechanics/GeometricPrimitives/cube_simulation.py | UTF-8 | 937 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
from siconos.io.mechanics_run import MechanicsHdf5Runner
import os.path
import os
from pathlib import Path
if not os.path.isfile('cube_scene.hdf5'):
cube_scene_path = Path(__file__).absolute().parent
cube_scene = Path(cube_scene_path, 'cube_scene.py')
print('The scene cube_scene.hdf... | true |