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
8c233bf0cd332653df17468533c4ff53f3a84650
gskielian/mindwave
/mindwave_datalogging.py
UTF-8
1,085
2.8125
3
[]
no_license
#!/usr/bin/python import mindwave import time import datetime #create a tsv file_name of YMD of today's date time_stamp = time.time() file_name = datetime.datetime.fromtimestamp(time_stamp).strftime('%Y-%m-%d') + '.tsv' f = open(file_name,'a') #connect the mindwave headset = mindwave.Headset('/dev/tty.MindWaveMobile...
true
49b6ce46cec27ab1aa7aaa1807a6566200681322
sunnyrockstar98/Titanicdataset
/svmNNNE.py
UTF-8
4,410
2.90625
3
[]
no_license
# Multiple Linear Regression # Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the dataset dataset = pd.read_csv('train.csv') testset = pd.read_csv('test.csv') dataset['Family_Size'] = dataset['Parch'] + dataset['SibSp'] testset['Family_Size'] = ...
true
66b0ce0e2e9ee7a9859f1e87b8135a3fd84a2286
hcmMichaelTu/python
/lesson10/func_cls.py
UTF-8
452
3.453125
3
[]
no_license
import turtle as t import string def write(char): def _write(): t.clear() t.write(char, align="center", font=f"Arial {s}") t.update() return _write s = 300 t.hideturtle(); t.tracer(False); t.color("red") t.up(); t.right(90); t.forward(2*s//3); t.down() chars = string.asc...
true
7536cbb33e4d6d648d687ca2ba1905420b640df8
mbuchwald/7516LenguajesProgramacion2015
/Compilador/AnalizadorSintactico.py
UTF-8
16,936
2.90625
3
[]
no_license
import AnalizadorLexico import AnalizadorSemantico CONST = "const" VAR = "var" PROCEDURE = "procedure" CALL = "call" IF = "if" WHILE = "while" BEGIN = "begin" THEN = "then" DO = "do" ODD = "odd" END = "end" WRITE = "write" WRITELN = "writeln" READLN = "readln" class AnalizadorSintactico(object): def __init__(self,...
true
099e69f25d3f231846e024c53a31d86ffa184655
orbidlo/AdventOfCode
/2021/12/passage.py
UTF-8
3,881
3.40625
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
# https://adventofcode.com/2021/day/12 from __future__ import annotations from timeit import default_timer as timer from dataclasses import dataclass, field from collections import defaultdict, Counter import sys import os import logging INPUT_FILE = 'input.txt' INPUT_TEST = 'input_test.txt' START_NODE = 'start' E...
true
07e2190c6eda4f1a675fd3aac9f784aa57f8f05f
PedroL7/hello-world
/Week4Ex5.py
UTF-8
87
3.0625
3
[]
no_license
x = 19.93 y = 20.00 z = y - x print ("%.2f" % z) print (type(y)) print (type(z))
true
c2cfbb96464eae7717611f2122d6062a08b05ea5
saribalarakeshreddy/Python-3.9.0
/Packages/Patterns_Package/alp/sml_alp/o.py
UTF-8
852
4.21875
4
[ "MIT" ]
permissive
def for_o(): """ Pattern of Small Alphabet: 'o' using for loop""" for i in range(4): for j in range(4): if i in (0,3) and j not in(0,3) or j in(0,3) and i not in(0,3): print('*',end=' ') else: ...
true
ea82770ae75c0697bf91ce4d4b82806ad4a96758
xcjthu/cv_predict_pay
/reader/formatter/cv.py
UTF-8
4,207
2.5625
3
[]
no_license
import json import torch import numpy as np import re class CV_formatter: def __init__(self, config): super(CV_formatter, self).__init__() path = config.get('data', 'skill_list') f = open(path, 'r') self.th = config.getint('data', 'skills_th') self.word2id...
true
5e3ec24d255cf1c8c15e09135c8d04f3958891bb
everydaytimmy/data-structures-and-algorithms
/python/code_challenges/tree/tree.py
UTF-8
2,119
3.734375
4
[ "MIT" ]
permissive
class Node: def __init__(self, value): self.value = value self.left = None self.right = None class BinaryTree: def __init__(self): self.root = None class BinarySearchTree(BinaryTree): def add(self, value): node = Node(value) def walk(root, new_node): ...
true
cc4337207a26d7801554631447a2796f3dd995a0
slawektestowy/selenium
/python/samochod.py
UTF-8
663
3.453125
3
[]
no_license
class auto: marka = "Skoda" def __init__(self, model, kolor, rok): self.model = model self.kolor = kolor self.rok = rok def silnik(self): return "wrrrr" def prezentuj_auto(self): print("Model ktory tu widzimy to " + self.model + "\n" "Kolor natom...
true
6ee13f9957ca709ca5bef26fc88c2331eb969dc5
hanbinggary/optiontrade
/com/swordfall/core/StockTrend.py
UTF-8
23,945
2.671875
3
[]
no_license
from com.swordfall.service.hk.HKStockService import HKStockService from com.swordfall.service.us.UStockService import UStockService from com.swordfall.core.BaseTrend import BaseTrend class StockTrend(BaseTrend): def __init__(self): super().__init__() self.hk_stock_service = HKStockService() ...
true
d3aaa04c0a89c741517b1110dbb9eac05ff8dc74
sasankyadavalli/leetcode
/findAndReplacePattern.py
UTF-8
305
2.546875
3
[]
no_license
class Solution: def findAndReplacePattern(self, words: List[str], pattern: str) -> List[str]: return [word for word in words if len(word) == len(pattern) and len(set(word)) == len(set(pattern)) and len(set(zip(word, pattern))) == len(set(word))]
true
2b8451271bd85370b75fe182508f57c742427204
ashish-rane/Hadoop
/Spark/Pyspark/globalRanking_demo.py
UTF-8
1,685
3.28125
3
[]
no_license
from pyspark import SparkConf, SparkContext conf = SparkConf() conf.setAppName("Sort Product By Price Pyspark") sc = SparkContext(conf = conf) # Sort the products by Price Descending path = "hdfs://ip-172-31-53-48.ec2.internal:8020/apps/hive/warehouse/retail_db.db/products" def parseProduct(rec): parts = rec.sp...
true
02f5543df0dc097595d2d34a61a56b00dc0eb59b
LaurencePeanuts/Censai
/iterative_inference_learning/scripts/iterative_lensmodel.py
UTF-8
3,845
2.78125
3
[]
no_license
''' A Convolutional Network implementation example using TensorFlow library. This example is using the MNIST database of handwritten digits (http://yann.lecun.com/exdb/mnist/) Author: Aymeric Damien Project: https://github.com/aymericdamien/TensorFlow-Examples/ ''' import tensorflow as tf import iterative_inference_le...
true
80cb466ef8320dbe48fc7118383c793f2a775fb9
hkxIron/hkx_tf_practice
/test_numpy/nn_scratch/rnn/rnn-from-scratch-master/output.py
UTF-8
334
2.65625
3
[]
no_license
import numpy as np class Softmax: def predict(self, x): exp_scores = np.exp(x) return exp_scores / np.sum(exp_scores) def loss(self, x, y): probs = self.predict(x) return -np.log(probs[y]) def diff(self, x, y): probs = self.predict(x) probs[y] -= 1.0 ...
true
4334439e3c0d7133c7d1f424fcd3912b366276a3
YwJiang/Simple-calcualtor
/Stringvar练习2.py
UTF-8
183
2.828125
3
[]
no_license
from tkinter import* root=Tk() var=StringVar() for i in range(2): rad= Radiobutton(root,text=str(i),variable=var) rad.pack(side=LEFT) var.set('happy') root.mainloop()
true
8e9c2a5f41fbb2f1444cae7abcb2ec2cbf46ae9a
mkelley33/katello-reports-engine
/devel_env/ec2/launch_instance.py
UTF-8
9,330
2.578125
3
[]
no_license
#!/usr/bin/env python # # Assumes that the following environment variables have been set # AWS_ACCESS_KEY_ID # AWS_SECRET_ACCESS_KEY # import os import stat import subprocess import sys import time from optparse import OptionParser try: from boto.ec2.connection import EC2Connection from boto.ec2.blockdevic...
true
12a627d7803220e11ca74079da1daddb291e8e55
nray001/SeniorDesign
/SeniorDesign/real_coord.py
UTF-8
992
2.90625
3
[]
no_license
import numpy as np import cv2 #Load important camera data and calibrated vectors for transformation R_mtx = np.load('./coord_data/R_mtx.npy') tvec1 = np.load('./coord_data/tvec1.npy') inverse_newcam_mtx = np.load('./coord_data/inverse_newcam_mtx.npy') s_arr = np.load('./coord_data/s_arr.npy') # Ask for cx and cy (u,v)...
true
23828a4976659e7f9ec40f453da4f7f8963d90e0
velssudar/IDcard_identification
/check_IDcard/area_dict.py
UTF-8
135,777
2.65625
3
[ "MIT" ]
permissive
#!/bin/env python # -*- coding: utf-8 -*- ''' 生成用于身份证查询地址的数据文件area_data.pkl ''' import pickle area_dict = { '110000':'北京市', '110100':'北京市市辖区', '110101':'北京市东城区', '110102':'北京市西城区', '110103':'北京市崇文区', '110104':'北京市宣武区', '110105':'北京市朝阳区', '110106':'北京市丰台区', '110107':'北京市石景山区', ...
true
1359a265b9f33eef41516d3d76bb4fe294321286
Andimeo/leetcode
/src/p446/solution.py
UTF-8
790
2.734375
3
[]
no_license
class Solution(object): def numberOfArithmeticSlices(self, A): """ :type A: List[int] :rtype: int """ import collections d = [collections.defaultdict(int) for _ in range(len(A))] result = 0 for i in range(len(A)): for j in range(i): ...
true
58b41d5e20cc04b6ba8fe8c13802a21967e0955b
NVIDIA/tensorflow
/tensorflow/python/ops/linalg/linear_operator_kronecker.py
UTF-8
22,557
2.734375
3
[ "Apache-2.0" ]
permissive
# Copyright 2018 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
3e7fe6900d79fef41aa004f5a2b666344ef7ad64
GeneSlow/Hello_python
/7 标志的探锁.py
UTF-8
410
2.859375
3
[]
no_license
''' #关于标志和break# prompt=('nishiyizhizhu') prompt+=('\nnihsaihsiyizhizhu') active=True while active: mess=input(prompt) # if mess ==quit: ...1 ....× if mess =='quit': ...2 ....√ active=False # beak ...3 ....√ else: print(mess+'\n') #反复失败 和书上的对比发...
true
5b3804e35e4e2ae741a85eb766941be9a8b6d958
davdjn/Crypto
/metrics.py
UTF-8
1,759
3.359375
3
[]
no_license
import numpy as np from itertools import combinations import coin_tools def il(pa0, pa1, pb0, pb1): ''' Compute impermanent loss of providing liquidity given the prices of two assets at two points in time. ''' ratio = (pa0 * pb1) / (pa1 * pb0) return (2 * np.sqrt(ratio) / (ratio + 1)) - 1 ...
true
9a60829a52c6c5db927e6ef0beadc643cea10955
BrandoZhang/STAr
/develop/Detector/lk_track.py
UTF-8
7,292
2.5625
3
[]
no_license
#!/usr/bin/env python ''' Lucas-Kanade tracker ==================== Lucas-Kanade sparse optical flow demo. Uses goodFeaturesToTrack for track initialization and back-tracking for match verification between frames. Usage ----- lk_track.py [<video_source>] Keys ---- ESC - exit ''' # Python 2/3 compatibility from __...
true
9c4e0a38aae7eff1093f81562bfcd3ec05c11d4a
Rjlmota/Memoria
/ram3.py
UTF-8
361
3.390625
3
[]
no_license
def write(): adress = input("Indique um endereço de 4 bits: ") value = input("Indique o valor de 8 bits: ") slots[adress.zfill(4)] = value.zfill(8) def read(): adress = input("Indique um endereco de 4 bits: ") print(slots[adress.zfill(4)]) slots = {} for i in range(0, 16): s...
true
90cbfb4bd4fd053befbd46701ea2a72439547562
robsws/aoc
/2017/21.py
UTF-8
4,547
3.34375
3
[]
no_license
import sys import re import time from math import sqrt input_filename = sys.argv[1] iterations = int(sys.argv[2]) file = open(input_filename,'r') lines = file.read().splitlines() def flip_horizontal(grid): flipped = list() for row in grid: flipped.append(tuple(reversed(row))) return tuple(flipped)...
true
3574ae8c4a649876b0f1747a3154bc1630021114
SiegeEngineers/aoc-reference-data
/scripts/ci.py
UTF-8
2,137
2.65625
3
[]
no_license
"""CI for aoc-reference-data""" import logging import sys from util.players import PlayerList from util.teams import Team, TeamList from util.data_processor import DataProcessor from util.error import LintError, unpack_error_list, print_error_summary_header # DEBUGGING FLAGS DEBUG = False CI = True LOGGER = l...
true
ea788f889d3c8a8885c80f707c24129ee2c6c0c2
mesodiar/get-slack-chat
/chat.py
UTF-8
984
2.53125
3
[]
no_license
import requests url = 'https://slack.com/api/conversations.history' params = { 'token': '<your_token>', # get it from https://api.slack.com/custom-integrations/legacy-tokens 'channel': '<channel_id>', # use this repo to get those id https://github.com/zach-snell/slack-export 'inclusive': True } next_pag...
true
e044c09281b9839d20070bae25c96b350529ecbb
max-kalganov/CalcGeom
/prepLab/isometric_projection.py
UTF-8
5,409
2.921875
3
[]
no_license
import numpy as np from time import sleep from visualizer import SimpleVisualizer from ct import CANVAS_WIDTH, CANVAS_HEIGHT, DEFAULT_NUM_OF_POINTS, TURNING_PERIOD, SLEEP_PERIOD, TURN_ANGLE class IsometricProjection: def __init__(self): """ Получение пар индексов для отрисовки параллелепипеда, ...
true
7813e7107ad775990a7e6a2569c13483bb492bd6
justisGipson/google_cert
/python_interacting_with_os/week_five/validations_test.py
UTF-8
524
2.65625
3
[]
no_license
#!/usr/bin/env python3 import unittest from validations import validate_users class TestValidateUsers(unittest.TestCase): def test_valid(self): self.assertEqual(validate_users("validuser", 3), True) def test_too_short(self): self.assertEqual(validate_users("inv", 5), False) def test_inv...
true
08d8e4c8fd6f9e80a9e87337f4a42ad2a6da8631
yanyongyong/machineLearn
/decisionTree/TreeTest.py
UTF-8
1,431
2.828125
3
[]
no_license
from sklearn.feature_extraction import DictVectorizer import csv from sklearn import preprocessing from sklearn import tree from sklearn.externals.six import StringIO # Read in the csv File and put feature in a list of class label allElectronicsData = open("C:\\Users\\hxjd009\\Desktop\\decisionTree.csv",'rb') reader =...
true
b5c20880db06f31dca64049b39f195df168a6188
a6361117/code
/Day1-15/Day12/02.py
UTF-8
741
4.34375
4
[]
no_license
#可变参数 ''' 1、*param(一个星号),将多个参数收集到一个“元组”对象中 2、**param(两个星号),将多个参数收集到一个“字典”对象中 ''' def test01(a,b,*c): #元组 print(a,b,c) test01(2,3,5,6,7) def test02(c,d,**f): #字典 print(c,d,f) test02(4,5,neme='小明',age=18) def test03(e,m,*n,**k): print(e,m,n,k) test03(3,4,5,6,name='小明',age=18) #强制命名参数 de...
true
148e87174982555a29c7598a5769ad6009d7d13e
Charleess/Vampires-Werewolves
/Player/V0/player.py
UTF-8
3,100
3.078125
3
[]
no_license
""" Contains the Player class """ from threading import Thread import socket import struct from Common.grid import Grid from Common.gamerules import GameRules class Player(Thread): """ A player """ def __init__(self, port, parameters, player_name): Thread.__init__(self) self.__parameters = para...
true
e446a864f9b94987990b9314eabf7aaa06608967
Keesiu/meta-kaggle
/data/external/repositories_2to3/136086/kaggle-master/hierarchical-text/statistics/normalization_func/popular_label_hit_rate.py
UTF-8
1,156
2.8125
3
[ "MIT" ]
permissive
N_OF_TAGS = 5 popular_labels = [24177, 285613, 98808, 264962, 167593, 242532, 52954, 300558, 444502, 78249] popular_labels_count = dict(list(zip(popular_labels, [0]*10))) count = 0 #f = open("pred_statistics_slope05_approach602.csv", 'r') #f = open("pred_statistics_slope03_approach602.csv", 'r') #f = open...
true
59bf86378c461b2fec5c57b12f6ea048630cde7a
nyanp/kaggle-PLASTiCC
/model/lgbm.py
UTF-8
7,412
2.59375
3
[]
no_license
import gc import pandas as pd import numpy as np from lightgbm import LGBMClassifier from sklearn.model_selection import StratifiedKFold from .loss import lgb_multi_weighted_logloss, multi_weighted_logloss from .model import Model from .problem import class_weight class LGBMModel(Model): def __init__(self, para...
true
1b46e2f925ff80b93139b6c768d181bb63b1d842
aimagelab/aidlda_tutorial
/drills/autograd_functions/main.py
UTF-8
4,638
3.09375
3
[]
no_license
""" Main file for training a Convolutional Neural Network for image classification. Training is performed on CIFAR-10 """ from __future__ import print_function import torch import torch.optim as optim import torchvision import torchvision.transforms as transforms from models import ConvNet from models import myConvN...
true
c444a4ee61f79636c4ac2d865115b6b132fbf8e4
Vrganj/advent-of-code
/10/2.py
UTF-8
484
2.984375
3
[]
no_license
with open('input.txt') as file: adapters = list(map(int, file.read().strip().split('\n'))) adapters.append(0) adapters.sort() adapters.append(adapters[-1] + 3) cache = dict() cache[len(adapters) - 1] = 1 def d(n): if n in cache: return cache[n] result = 0 for i in (1, 2, 3): if n + i >= len(...
true
698215ee336ff8e303fe070c5cb764b5fcfcdc6b
vipsinha/Python
/Youtube/8_Functions.py
UTF-8
1,348
4.25
4
[]
no_license
# Functions 1 print('####Functions_1#####') def hello_func_1(): pass print(hello_func_1()) # Functions 2 print('####Functions_2#####') def hello_func_2(): pass print(hello_func_2) # Functions 3 print('####Functions_3#####') def hello_func_3(): print('Hello Function!') hello_func_3() # Functions 4 pri...
true
669609453892cd6691a6a8eca846980862318d16
rgoncales/CPS707
/utils/users.py
UTF-8
432
2.578125
3
[]
no_license
from decimal import Decimal import utils.parser # returns string for entry into accounts file def getUserFromJSON(userInfo): userName = utils.parser.appendSpaces(userInfo['username'], 15, False) userType = utils.parser.appendSpaces(userInfo['type'], 2, False) userCredit = utils.parser.appendSpaces(str('%.2...
true
d3ed81b65325a0eba3e8a9f06989758d839b304b
savfod/d16
/eshuvaeva/dynamics/fibonacci.py
UTF-8
209
3.171875
3
[]
no_license
n = int(input()) a = [] for i in range(n): a.append(1) def fib(n): if n == 2 or n == 1: return 1 elif a[n-1] != 1: return a[n-1] else: a[n-1] = fib(n -1)+fib(n-2) return a[n -1] k = fib(n) print(k)
true
0f84d0a6508724cf2bdea7ba28703398a19f073c
xerprobe/LeetCodeAnswer
/31. 下一个排列/pythonCode.py
UTF-8
1,276
3.9375
4
[]
no_license
from typing import List class Solution: def nextPermutation(self, nums: List[int]) -> None: if len(nums) < 2: return for i in range(2,len(nums)+1): if(nums[-i] < nums[-i+1]): break if i == len(nums) and nums[-i] > nums[-i+1]: for i in range...
true
916beae2c0e5a005cf00db7225234b740230d635
Artem7898/Python_Lesson_2
/task 7.py
UTF-8
693
4.125
4
[]
no_license
""" 7. Напишите программу, доказывающую или проверяющую, что для множества натуральных чисел выполняется равенство: 1+2+...+n = n(n+1)/2, где n - любое натуральное число. Решите через рекурсию. Решение через цикл не принимается. Для оценки Отлично в этом блоке необходимо выполнить 5 заданий из 7 """ # 7 Решения: n...
true
eece9a026e4ac2ade9f7a9712b31e6ca15e7385b
suriasarath/spyder
/kmean.py
UTF-8
638
2.90625
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt from matplotlib import style from sklearn.cluster import KMeans style.use('ggplot') x = [1,1.5,3.7,4,5,6,7,8] y = [1,2,3,7,8,7,7,8] array = np.array([x,y]) array_t = np.transpose(array) kmeans = KMeans(n_clusters=2) kmeans.fit(array_t) l = kmeans.predict([[5,6]]) ...
true
945640c8378d9a8bc9274b1e40993e1699f96a34
phitoduck/hackerrank
/missing_numbers.py
UTF-8
734
3.046875
3
[]
no_license
# get both arrays as input input() astring = input().strip().split() adict = dict() for x in astring: x = int(x) if x in adict.keys(): adict[x] += 1 else: adict[x] = 1 input() bstring = input().strip().split() bdict = dict() for x in bstring: x = int(x) if x in bdict.keys(): ...
true
8cd274a92a2f2a5b5a269243fb0cd90077be55ab
aishwary013/Packages
/Regex/regex 2.py
UTF-8
658
3.078125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon May 4 12:19:06 2020 @author: aishwary """ from os import chdir chdir('G:/My Drive/2020/Coding/Regex') import re pattern=re.compile(r'\d\d\d.\d\d\d.\d\d\d\d') with open('data.txt','r',encoding='utf-8') as f: contents=f.read() matches=pattern.finditer(contents) ...
true
b89bc08e3735414ec187c942d3efc1e574e4a275
mihirmk/idealised_exo_runs
/lfric_util.py
UTF-8
2,395
2.84375
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """Utilities for LFRic output.""" import iris.exceptions import iris.coords import iris.util import numpy as np def fix_time_coord(cube, field, filename): """ Callback function for `iris.load` specifically for UGRID data. All field variables should have time as a coord, and mesh ...
true
a1844df81cab8b01ddf6a8185c387a64e7fb8fd1
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_95/1669.py
UTF-8
462
2.859375
3
[]
no_license
from sys import stdin as input import string trans = string.maketrans('ejp mysljylc kd kxveddknmc re jsicpdrysi rbcpc ypc rtcsra dkh wyfrepkym veddknkmkrkcd de kr kd eoya kw aej tysr re ujdr lkgc jv q z','our language is impossible to understand there are twenty six factorial possibilities so it is okay if you want t...
true
2695af9424ba0805241d4d4115d0a80c5a301a63
slavi010/polyhash-2020
/tests/test_model.py
UTF-8
5,917
3.125
3
[ "MIT" ]
permissive
"""Toutes les fonctions de tests de l'application""" from src.model.Bras import Bras from src.model.Etape import Etape from src.model.Grille import Grille from src.model.ItemCase import ItemCase from src.model.Mouvement import Mouvement from src.model.PointMontage import PointMontage from src.model.Robot import Robot ...
true
41b0578c12ce96cc389b52ac328de144b0241500
0rengo/nuclearmodels
/modeloCamadasOOv2.py
UTF-8
5,323
3.390625
3
[]
no_license
# coding: UTF-8 # Programa que calcula as predições do Modelo de Camadas # Física Nuclear - Gilberto Orengo (g.orengo@gmail.com) # Centro Universitário Franciscano - Curso: Física Médica import os # from os import system from sairOOv1 import Sair ## Construcao das funcoes ##------------------------------------------...
true
275b4591b4a680e208ede1f98a36587bc810c560
wesleyfr/boxpython
/boxpython/auth.py
UTF-8
2,278
2.96875
3
[ "MIT" ]
permissive
from .request import BoxRestRequest from .exceptions import BoxError, BoxHttpResponseError class BoxAuthenticateFlow(object): """From the Client ID and Client Secret from Box, get the Access Token and the Refresh Token. Usage: >>> flow = BoxAuthenticateFlow('my_id', 'my_secret') >>> url = flo...
true
1f12c9029bba1fc9b413d6f539f5a11a926786c1
r007-1/m5Nph2Ef
/utilities/utilities.py
UTF-8
2,479
2.734375
3
[]
no_license
import json import pandas import io def find_between(s, first, last): try: start = s.index(first) + len(first) end = s.index(last, start) return s[start:end] except ValueError: return "" def find_all(a_str, sub): start = 0 while True: start = a_str.find(sub, st...
true
e05251a30a6aef205278ca80c6ab6c13b3d81b71
kurilovms/infa_2020_kurilov
/2 лабораторная/5.py
UTF-8
355
3.640625
4
[]
no_license
import turtle def kvadrat(a,d1): turtle.pendown() for i in range(4): turtle.forward(a) turtle.left(90) turtle.left(180) turtle.penup() turtle.forward(d1) turtle.left(90) turtle.forward(d1) turtle.left(90) turtle.shape('turtle') b=10 d=5 for i in range(1...
true
7c7583c64b7be71804eb101bd2b9d872d9dc4bd4
txtbits/daw-python
/control_flujo/Estrategias El mayor de tres/Estrategia 1 Compara con el resto.py
ISO-8859-1
398
3.3125
3
[ "MIT" ]
permissive
# -*- coding: cp1252 -*- from easygui import * x1 = enterbox('Introduce un numero: ') x2 = enterbox('Introduce un numero: ') x3 = enterbox('Introduce un numero: ') # Convierte los nmeros x1 = int(x1) x2 = int(x2) x3 = int(x3) if x1 >= x2 and x1 >= x3: mayor = x1 elif x2 >= x1 and x2 >= x3: mayor = x2 elif x3...
true
bb6a56c6c60c6faa265efdfad760a78c06996af4
poilpy/cse143
/as1/models.py
UTF-8
4,079
3.3125
3
[]
no_license
import numpy as np start = "START" stop = "STOP" #loop through the text and get the word frequencies class unigram: def __init__(self, text): self.freq = dict() self.total = 0 for word in text: self.freq[word] = self.freq.get(word, 0) + 1 if word != stop or word != ...
true
e2fe5d11fa02f42348f5b92e58296480cd34e6f8
nebulasquared/PHYS200
/Chapter5_4_2.py
UTF-8
539
3.96875
4
[]
no_license
#Chapter 5 Exercise 5.4 #Create a function snowflake that draws three Koch curves to create a snowflake using TurtleWorld from TurtleWorld import * import math world = TurtleWorld() bob = Turtle() bob.delay = .00001 def koch(t, x): if x<3: fd(t, x) else: koch(t, x/3.0) #should it be x/3.0 or x/3? lt(t, 60.0)...
true
b9422afc51e620fce6ac839e0160547d743d2c5e
mveselov/CodeWars
/katas/kyu_7/some_circles.py
UTF-8
170
3.265625
3
[ "MIT" ]
permissive
from math import pi OUTPUT = 'We have this much circle: {:.0f}'.format def sum_circles(*args): return OUTPUT(sum(pi * (diameter / 2.0) ** 2 for diameter in args))
true
e304e48c3d0568165dd07641104c972f9c9ae61d
hadisiswanto62/FYP-WifiHeatmap
/process_router_data.py
UTF-8
2,477
2.921875
3
[]
no_license
# Same as main.py but for data under router. Too lazy to combinethem >_> from pathlib import Path import pandas as pd import seaborn as sns import matplotlib.pyplot as plt def save_output(df: pd.DataFrame, method: str) -> None: df = df.pivot(index="mac_addr", columns="location", values="signal_str") sns.heat...
true
1053e2304dedb6a915f9f0ce901be46f7090ec95
cwang360/branch-prediction-visualization
/predictor_components.py
UTF-8
2,159
2.90625
3
[]
no_license
class nBitPredictor: def __init__(self, bits, start_state): self.bits = bits self.state = start_state self.mispredicted = 0 self.total_predicted = 0 def update(self, actual_direction): self.total_predicted += 1 if actual_direction != self.prediction_bit(): ...
true
53e7d4bc82fef52ff10dc97effa799fd298bb88d
arif2ianto/Arif-Alya
/1.3.2.1. Elementwise operations.py
UTF-8
1,034
3.609375
4
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[2]: import numpy as np a = np.array([1, 2, 3, 4]) a + 1 # In[3]: 2**a # In[4]: b = np.ones(4) + 1 a - b # In[5]: a*b # In[7]: j = np.arange(5) 2**(j + 1) - j # In[8]: a = np.arange(10000) get_ipython().run_line_magic('timeit', 'a + 1') # In[9]: l = r...
true
500de43dbc3957dc4f2156ddd6548ffd23380b76
odakan/gmpack
/gmpack/Flatten_Record.py
UTF-8
2,816
3.15625
3
[ "MIT" ]
permissive
import numpy as np class FlattenRecord(object): def __init__(self, name, skip=0, output='acc', dt=1.0, unit='g'): # initialize internal variables self.name = name self.step = dt self.output = output self.skip_lines = int(skip) self.new_name = '' self.convert...
true
15b6cea79bac19e40fd8bd1774209260cf56f3f9
redice44/Traffic-Simulator-2.0
/Code/server/algo/graph/Graph.py
UTF-8
5,570
2.890625
3
[]
no_license
import networkx as nx import numpy as np import json import sys from util import * from array import array # Custom Exceptions # class EmptyMatrixProvided(Exception): # pass # class NonSquareMatrix(Exception): # pass class Graph(nx.DiGraph): def __init__(self, matrix, needSetup): if needSetup: if ma...
true
d8447e3c5a73875fe4eb650dd01497439481e304
mitsuo0114/competitive_programming
/python/atcoder/Beginner113/C.py
UTF-8
418
2.953125
3
[]
no_license
def solve(N, M, PYs): Ys = {i + 1: 1 for i in range(N)} ret = {} for p, y in sorted(PYs, key=lambda x: x[1]): ret[(p, y)] = "{:06d}{:06d}".format(p, Ys[p]) Ys[p] += 1 return [ret[(p, y)] for (p, y) in PYs] if __name__ == "__main__": N, M = tuple(map(int, input().split(" "))) PYs...
true
fc86743921cea3b58673515c1c421df45742d6d3
hamling-ling/ShaRinGan
/src/app/graceful_killer.py
UTF-8
287
2.796875
3
[ "MIT" ]
permissive
import signal class GracefulKiller: kill_now = False def __init__(self): signal.signal(signal.SIGINT, self.exit_gracefully) signal.signal(signal.SIGTERM, self.exit_gracefully) def exit_gracefully(self,signum, frame): print("signal received") self.kill_now = True
true
a5cb7a7271c1c49607b31acd0c4451b8673aed9d
BinaryAura/parsepy
/parsepy/parser/ll1.py
UTF-8
6,104
2.609375
3
[]
no_license
from typing import Dict, Callable, Iterable, Optional, Hashable, Any, Iterator, Union from os import PathLike from parsepy.lexer import Lexer from parsepy.lexer import Token from parsepy.parser import AST from parsepy.parser import error from parsepy.parser import CFG, Parser class LL1(Parser): """ """ ...
true
7070f6b76f0b7feeab3f5575d7034ca9202f5c15
stbnps/Aleph
/src/Characters/Nazist.py
UTF-8
584
2.640625
3
[]
no_license
# -*- coding: utf-8 -*- ''' Created on 16/03/2014 @author: DaGal ''' from Enemy import Enemy from RangeController import RangeController from Weapons.WpnRifle import WpnRifle class Nazist(Enemy): """ Contains logic for Nazist enemy. """ def __init__(self, x, y, player, director): Enemy.__init__(self, x, y, "...
true
656b546541133233b91bf529091a0dfd718cae69
navneet-ag/DMG-Assignments
/Assignment3/A3_Runner.py
UTF-8
1,421
2.671875
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[1]: import numpy as np import pandas as pd from tqdm import tqdm import pickle # In[5]: def give_results(RulesFile,TestFile): file=open(RulesFile,'rb') Rules=pickle.load(file) file.close() b= pd.read_csv(TestFile) df_test=pd.DataFrame(b) mapping ...
true
069317a5110c8b78d13899b5bc7a022a9ecc77aa
Jerry-FaGe/Bluetooth_select
/spider/spider1.py
UTF-8
2,133
2.84375
3
[]
no_license
import requests from lxml import etree from lib import pysqlite url = "https://www.bluetooth.com/specifications/gatt/characteristics/" headers = { 'user-agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3573.0 ' 'Safari/537.36', } # 定义请求函数 def ...
true
c33fb2485d7747658c3dd2cf8e4c50cfbb395ce8
wrobelcarter1/CS-126
/Chapter 10/11:30_example.py
UTF-8
172
3.421875
3
[]
no_license
def check_odd(n): ''' if n % 2 == 0: return False else: return True ''' return n%2 == 1 # One line of code print(check_odd(4))
true
cf7afbb13fcbcef15f32b482fdd0a136c51cd9a4
Y-B-C/Study_python
/面向对象/6.综合应用.py
UTF-8
1,221
4.625
5
[]
no_license
#1.定义类:初始化属性、被烤和添加调料的方法、显示对象信息的str class SweetPotato(): def __init__(self): # 被烤的时间 self.cook_time = 0 # 烤的状态 self.cook_state = '生的' # 调料列表 self.condiments = [] def cook(self,time): """烤地瓜方法""" self.cook_time +=time if 0<=self.c...
true
cccf7dad2b11f7dee2233f0acc25aaee0fc0b9f0
vxrnxk/python-brasil-exercicios-estrutura-sequencial
/L01-E12.py
UTF-8
328
4.34375
4
[]
no_license
# Lista 01 - Exercício 12 # Tendo como dados de entrada a altura de uma pessoa, construa um algoritmo que calcule seu peso ideal, usando a seguinte fórmula: (72.7*altura) - 58 altura = float(input("Digite a altura da pessoa: ")) peso_ideal = (72.7 * altura) - 58 print("A altura ideal é: {}".format(round(peso_ideal, ...
true
7a6190cef27fafada23602867b56e0f3648b30fd
Ferus/WhergBot2.0
/Plugins/Slap/Main.py
UTF-8
1,683
2.609375
3
[]
no_license
#!/usr/bin/env python import random from .Settings import Settings class Main(object): def __init__(self, Name, Parser): ''' The provided Fish.txt file was obtained from https://github.com/jamer/Rubot/blob/master/plugins/Slap.rb Some of these 'fish' only exist because of a huge slap battle between myself an...
true
356ba905e58a41a79cc9efd1dbaf69aa6acc314b
yannickkiki/programming-training
/Leetcode/python3/1228_missing_number.py
UTF-8
277
2.96875
3
[]
no_license
def missingNumber(arr): n = len(arr) gap = (arr[n-1]-arr[0])//n if gap==0: return 0 for i in range(n-1): diff = arr[i+1]-arr[i] if diff!=gap: return arr[i]+gap if __name__=='__main__': result = missingNumber([15,13,12])
true
27aa23ae1bdbed9b35e02f8e08fdf353159201ad
MeteoSwiss-APN/ecrad
/practical/plot_input.py
UTF-8
958
2.734375
3
[ "Apache-2.0", "BSD-3-Clause" ]
permissive
#!/usr/bin/env python3 def warn(*args, **kwargs): pass import os, warnings warnings.warn = warn from ecradplot import plot as eplt def main(input_srcfile, dstdir): """ Plot input files """ if not os.path.isdir(dstdir): os.makedirs(dstdir) #Get input file name name_stri...
true
bd983c6cecea3c8849b16b3f069dd44e22e89878
Bamgm14/CrossRoadsCTF
/Background/1/pickle_rick.py
UTF-8
1,299
2.859375
3
[ "MIT" ]
permissive
import pickle import base64 as b64 menu = "" userDict = {"userName": 'guest',"info":"guest","admin": 0,"points":0} print( """ Options: info: Get user info flag: Get flag and win this. register: Set your details save: Save your details for later use load: Load your save data points: Check points \n""") wh...
true
16ba53808ad91a040932e14e6ba005a12d3cf8c4
snbloch/advent2016
/day20/part2.py
UTF-8
902
3.03125
3
[]
no_license
import io from operator import itemgetter min_int = 0 max_int = 4294967295 num_ports = max_int + 1 max_removed = 0 removals = [] file = open('input.txt', 'r') for line in file: min_to_remove = int(line.split('-')[0]) max_to_remove = int(line.split('-')[1]) removals.append((min_to_remove, max_to_remove)) ...
true
184cc0862f01c670b0b4d438bd5633a454b1a535
snah/yak-server
/yakserver/events.py
UTF-8
841
2.640625
3
[]
no_license
"""Define the event classes.""" import datetime import ezvalue class Event(ezvalue.Value): """Baseclass for all events.""" timestamp = 'The time the event was created.' def __init__(self, *args, **kwargs): """Initialize the event. All fields are required except for timestamp, which wi...
true
c0183706bef2d41d887357106935532fb41da2fd
alex-ten/MSC
/utilities/make_table.py
UTF-8
248
2.6875
3
[]
no_license
from tabulate import tabulate def make_table(a, rkeys=None, ckeys=None): tab_list = [] for i,k in enumerate(rkeys): tab_list.append([k] + list(a[i])) table = tabulate(tab_list,floatfmt='.2f', headers = ckeys) return table
true
8d6c8e07caa00963e003cf2d415b2b4afc08cc41
masakichi/doubanista_slack
/app/translate.py
UTF-8
1,774
3.15625
3
[]
no_license
# coding: utf-8 import random import hashlib import requests import html.parser as htmlparser parser = htmlparser.HTMLParser() __all__ = ['translate'] # Imports the Google Cloud client library from google.cloud import translate from config import YOUDAO_APP_KEY, YOUDAO_SECRET_KEY # Instantiates a client google_clie...
true
c8eb875338b97c34072153b1f47ebc4b0c8bdb21
DariaKutkanych/py-homeworks
/comprehensions/task1.py
UTF-8
417
3.65625
4
[]
no_license
# Write a function using list comprehensions that takes a list of strings # and removes those that contain 4 characters or less def remove_shorts(strings: list) -> list: pass assert remove_shorts(['telegram', 'sport', 'call', 'football', 'jet']) \ == ['telegram', 'sport', 'football'] assert remove_shorts...
true
11cd0488968ae9cd042c0b6a9c90a58505967e60
ndtatbristol/arim
/tests/_probes/test_probes.py
UTF-8
650
2.734375
3
[ "MIT" ]
permissive
import arim probes = arim.probes def test_probes(): probes.keys() repr(probes) str(probes) assert len(probes) > 0 for (probe_key, probe) in probes.items(): assert isinstance(probe, arim.Probe) assert probe_key == probe.metadata["short_name"] key = tuple(probes.keys())[0] ...
true
8e6a9f4ffb5d58bf653ecaaba0b73a3e53642a8c
ScottSko/Python---Pearson---Third-Edition---Chapter-9
/Chapter 9 - Programming Exercises #9 - Blackjack Simulator.py
UTF-8
3,751
3.9375
4
[]
no_license
import random def create_deck(): deck = {"Ace of Spades": 1, "2 of Spades" : 2, "3 of Spades": 3, "4 of Spades": 4, "5 of Spades" : 5, "6 of Spades" : 6, "7 of Spades" : 7, "8 of Spades": 8, "9 of Spades": 9, "10 of Spades": 10, "Jack of Spades": 10, "Queen of Spades": 10, "King of S...
true
769d44068850d52151a47e30b3e46e9b4278ac6a
OcaenEyes/MachineLearning
/spider/somepic/getpic.py
UTF-8
4,719
2.71875
3
[]
no_license
import requests from bs4 import BeautifulSoup import time import os class GetPic(): def __init__(self): self.BASE_URL = "https://www.meitulu.com" def create_person_url(self): person_name = "王语纯" person_url = self.BASE_URL + "/search/" + person_name return person_url, person_na...
true
6362b8e6c7d46fd9af20d6da8a695f929fda18af
DreamLose/python-
/day07/DictFunction.py
UTF-8
721
3.875
4
[ "MIT" ]
permissive
# 字典 keys() values() items() get() update() dict info = {"k1":"v1","k2":"v2"} print(info) info.keys() info.values() del info["k1"] print(info) # 获取key,value for k,y in info.items(): print(k,y) #根据序列创建字典,指定统一值 v = dict.fromkeys(['ke','323','999'],[123,"ewe"]) print(v) # 根据key 获取值,key不存在时可以指定默认值 s = v.get("ke",23232)...
true
00ee77a4e7de77ac453042c2b56a4d57d21cb3a4
camptocamp/terraverge
/terraverge/db.py
UTF-8
1,156
2.640625
3
[]
no_license
import psycopg2 import click from flask import current_app, g from flask.cli import with_appcontext def get_db(): if 'db' not in g: g.db = psycopg2.connect(current_app.config['PG_CONFIG']) return g.db def close_db(e=None): db = g.pop('db', None) if db is not None: db.close() def ini...
true
50dffbf6164d2d0cdb46a31d4918f0c107c132d6
FelixOngati/dhis2-indicators-dictionary
/indicators.py
UTF-8
2,928
3.03125
3
[]
no_license
import os import requests import re import csv class Indicators: username = os.environ.get('DHIS2_USER') password = os.environ.get('DHIS2_PASS') auth = requests.auth.HTTPBasicAuth(username, password) filename = '' def indicator_group_metadata(self, uid): request = requests.get( ...
true
8b827d8499fac2cd22f9c1368cb3111f9346b91e
UKHomeOffice/aws-budget-alerting
/src/lambda_bucket.py
UTF-8
2,342
2.921875
3
[ "MIT" ]
permissive
"""Script generating a CloudFormation template to create an S3 bucket accessible from the AWS Lambda service """ from troposphere import Template, Parameter, Ref, Join from troposphere import s3 def get_cf_template(): """Generates CloudFormation code for creating an S3 bucket accessible from the Lambda service, ...
true
005ecc56d96fc3c69a48e821bf5a26f7e34ffbb9
suhassrivats/Data-Structures-And-Algorithms-Implementation
/Problems/Leetcode/404_SumOfLeftLeaves.py
UTF-8
997
3.78125
4
[]
no_license
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right # Iterative - Preorder traversal class Solution: def sumOfLeftLeaves(self, root: TreeNode) -> int: stack, total = ...
true
83b2e62a2dd8d690074952d541bf27a422dbe734
barsgroup/barsup-core
/src/pynch/util.py
UTF-8
2,680
2.796875
3
[ "MIT" ]
permissive
# coding: utf-8 """Набор вспомогательных конструкций.""" import os import json from types import GeneratorType from yadic.util import merge def serialize_to_json(obj): """ Функция серриализации объектов. Передается в параметр default вызова json.dumps :param obj: Объект, который необходимо серриализ...
true
39a393c00bb507308a412a6c350a4df2e3fe53c7
ITT-21SS-UR/assignment_introduction_linux_python-KayBrinkmann
/stats.py
UTF-8
1,461
4.15625
4
[]
no_license
import math import sys # calculates mean from list of numbers def get_mean(lst): mean = sum(lst) / len(lst) return mean # calculates median from list of numbers def get_median(lst): sortedlst = sorted(lst) print(sortedlst) length = len(lst) if length % 2 == 0: median = (sortedlst[int...
true
8f6f2678cfab1b275128a154480af40eac23f83f
GabrielDeml/deeplab-v3-plus
/findBlobs.py
UTF-8
1,225
2.734375
3
[]
no_license
import cv2 import numpy as np imgReal = cv2.imread("8c519ece-0000000_mask.png", 1) kernel = np.ones((5,5), np.uint8) imgReal = cv2.dilate(imgReal, kernel, iterations=3) # lower = np.array(lower, dtype = "uint8") maskG = cv2.inRange(imgReal, np.array([0, 128, 0]), np.array([0, 128, 0])) maskR = cv2.inRange(imgReal, ...
true
f18ad3db992bfd5c0ad1b1b610a48c95f728ffe1
awoopa/imgfilter
/server/tag.py
UTF-8
1,929
2.90625
3
[ "MIT" ]
permissive
from collections import defaultdict from IPython import display from PIL import Image from torch import nn from torch.autograd import Variable from torchvision import models, transforms import json import numpy as np import torch # Define a global transformer to appropriately scale images and subsequently convert the...
true
bf0c0a12e02a1f39cf7d14259884f4782e829282
wenbinDong/dong
/work/python_pycharm/lesson6/demo1_oop.py
UTF-8
1,686
4.03125
4
[]
no_license
''' 构造方法 私有变量 私有方法 ''' class Dog: def __init__(self,gender,variety,name,age): #print("我是构造方法,在创建对象时自动调用") self.gender = gender self.variety = variety self.name = name self.__age = age # 获取对象属性,并打印出来 def get_pro(self): print("gender:{},variety:{},name:{},age:{}...
true
6855fc02884b563bd2a5acbe7fe66542b9d673c8
dmitry-radzevich/mkdocs-plugin-tags
/tags/plugin.py
UTF-8
6,848
2.65625
3
[ "MIT" ]
permissive
# -------------------------------------------- # Main part of the plugin # # JL Diaz (c) 2019 # MIT License # -------------------------------------------- from collections import defaultdict from pathlib import Path import os import yaml import jinja2 from mkdocs.structure.files import File from mkdocs.structure.nav i...
true
cb31b51dbbda4f847e01d4b6a35ef080cd6128d0
carlware/pyclean
/tests/clean/entities/test_token.py
UTF-8
930
2.796875
3
[ "MIT" ]
permissive
from clean.entities.token import UserToken def test_user_token_obj(): ut = UserToken(username='crl', email='admin@admin.com', avatar='', metadata={}) assert ut.username == 'crl' assert ut.email == 'admin@admin.com' assert ut.avatar == '' assert ut.metadata == {} def test_user_token_repr(): ...
true
3a6956bea419e278a3f8b692639f1a16715bedd3
gargutkarsh/hacktoberfest
/armstrong.py
UTF-8
312
3.546875
4
[]
no_license
n=int(input("enter any 3 digit no.")) temp=n sum=0 if(n<=999): while (n>0): dig=n%10 sum=sum+dig**3 n=n//10 if(temp==sum): print("entered number is armstrong no.") else: print("no. is not armstrong") else: print("enter number less than 999")
true
e00e97495974cb6dfacc5af4467bbdf74eff92f4
wAikAp/Intelligent-Energy-Management-System-for-Buildings-INB
/raspberryPi_source_code/FYP_py/camera-python-opencv-master/camera-opencv/02-image_process/canny_edge_detect.py
UTF-8
1,351
2.859375
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/python #+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ #|R|a|s|p|b|e|r|r|y|P|i|.|c|o|m|.|t|w| #+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ # Copyright (c) 2017, raspberrypi.com.tw # All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # # canny_edge_dete...
true
07be9a593368f11b64d499f56ac73b9a37bb77db
1034776739/scikit-pr-open
/skpr/simulation/probe.py
UTF-8
8,587
2.65625
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ Created on Wed Aug 31 09:34:48 2016 @author: philipp """ import numpy as np from matplotlib import pyplot as plt from mpl_toolkits.axes_grid1 import make_axes_locatable from numpy.fft import ifft2, fftshift from pyE17 import utils as u #from pyE17.io.h5rw import h5read, h5write def sect...
true
0763a2f6b9f3e14012e6df198d3a5c1e391d5f1b
virati/autoLie
/src/lie_lib.py
UTF-8
2,034
2.734375
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Dec 11 10:47:58 2018 @author: virati Vineet Tiruvadi virati@gmail.com Lie Derivatives on predefined operators """ from __future__ import division import autograd.numpy as np import autograd.numpy.random as npr from autograd.test_util import check_gra...
true
d29cc42998b215735036f0207f71ddd5d38be6e8
biggod-ck/python
/循环.py
UTF-8
1,002
4.1875
4
[]
no_license
# 在Python中构造循环结构有两种做法,一种是for-in循环,一种是while循环 sum = 0 for x in range(101): sum += x print(sum) print(range(3)) # range 包含开始 不包含结束 # range(101) 0 - 100 # range(10,101) 10 - 100 # range(1,101,2) 1 - 100 步长为2 1 3 5 # range(100, 0, -2):可以用来产生100到1的偶数,其中-2是步长,即每次数字递减的 sum2 = 0 for y in range(0,101,2): sum2 += y print(s...
true
185f09317e2e21b7036e1576b9e5d0e0f20ce0e8
Mark1988huang/ppQuanTrade
/neuronquant/ai/managers.py
UTF-8
6,272
2.609375
3
[ "Apache-2.0" ]
permissive
# # Copyright 2012 Xavier Bruhiere # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
true