text
stringlengths
0
1.05M
meta
dict
7#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Feb 15 13:38:48 2018 @author: BallBlueMeercat """ import numpy as np from scipy.integrate import odeint import firstderivs #import lnprior # Standard cosmological parameters. H0 = 1 # Hubble parameter at t=now tH = 1.0/H0 # Hubble time c_ove...
{ "repo_name": "lefthandedroo/Cosmo-models", "path": "zprev versions/odesolve.py", "copies": "1", "size": "2767", "license": "mit", "hash": -2100113527404365000, "line_mean": 26.67, "line_max": 106, "alpha_frac": 0.5663173112, "autogenerated": false, "ratio": 2.8034447821681865, "config_test": f...
7#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Feb 15 13:38:48 2018 @author: BallBlueMeercat """ import numpy as np from scipy.integrate import odeint import firstderivs import lnprior # Standard cosmological parameters. H0 = 1 # Hubble parameter at t=now tH = 1.0/H0 # Hubble time c_over...
{ "repo_name": "lefthandedroo/Cosmo-models", "path": "zprev versions/odesolve copy.py", "copies": "1", "size": "3488", "license": "mit", "hash": -1939725985427761000, "line_mean": 28.811965812, "line_max": 106, "alpha_frac": 0.5401376147, "autogenerated": false, "ratio": 2.943459915611814, "conf...
7#!/usr/bin/env python import inspect import json from dataclasses import dataclass from typing import List, Optional, Iterable, Union, Dict, Any from dbt.dataclass_schema import dbtClassMixin from dbt.context.base import BaseContext from dbt.context.target import TargetContext from dbt.context.providers import Mode...
{ "repo_name": "analyst-collective/dbt", "path": "scripts/collect-dbt-contexts.py", "copies": "1", "size": "2950", "license": "apache-2.0", "hash": 988235076767605200, "line_mean": 23.5833333333, "line_max": 69, "alpha_frac": 0.6322033898, "autogenerated": false, "ratio": 3.938584779706275, "con...
7#!/usr/bin/env python import inspect import json from dataclasses import dataclass from typing import List, Optional, Iterable, Union, Dict, Any from hologram import JsonSchemaMixin from dbt.context.base import BaseContext from dbt.context.target import TargetContext from dbt.context.providers import ModelContext, ...
{ "repo_name": "fishtown-analytics/dbt", "path": "scripts/collect-dbt-contexts.py", "copies": "1", "size": "2950", "license": "apache-2.0", "hash": 2804997544126462500, "line_mean": 23.5833333333, "line_max": 69, "alpha_frac": 0.6328813559, "autogenerated": false, "ratio": 3.9918809201623815, "c...
7# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2014 IBM Corporation # Copyright 2015-2019 Lenovo # # 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/licen...
{ "repo_name": "whowutwut/confluent", "path": "confluent_server/confluent/config/configmanager.py", "copies": "1", "size": "95783", "license": "apache-2.0", "hash": 1321130713339152000, "line_mean": 39.9504061565, "line_max": 129, "alpha_frac": 0.5543676853, "autogenerated": false, "ratio": 4.4286...
"""802.1x implementation for FAUCET.""" # Copyright (C) 2013 Nippon Telegraph and Telephone Corporation. # Copyright (C) 2015 Brad Cowie, Christopher Lorier and Joe Stringer. # Copyright (C) 2015 Research and Education Advanced Network New Zealand Ltd. # Copyright (C) 2015--2017 The Contributors # # Licensed under the...
{ "repo_name": "gizmoguy/faucet", "path": "faucet/faucet_dot1x.py", "copies": "1", "size": "15708", "license": "apache-2.0", "hash": -202668157598071100, "line_mean": 37.312195122, "line_max": 100, "alpha_frac": 0.5881079705, "autogenerated": false, "ratio": 3.2779632721202003, "config_test": fa...
# 8031_v1.py # Shuai Jack Zhao # hdfs file system # in_port=int(inport), eth_dst=dst_mac, eth_src=src_mac, eth_type=0x0800, ipv4_src=src_ip, # ipv4_dst=dst_ip, ip_proto=6, tcp_dst=dst_port, tcp_src=src_port # # tcp_src=54310 # updated instal...
{ "repo_name": "umkcdcrg01/ryu_openflow", "path": "ryu/app/8031_v1.py", "copies": "1", "size": "10373", "license": "apache-2.0", "hash": -4237235051510313500, "line_mean": 46.3652968037, "line_max": 161, "alpha_frac": 0.5693627687, "autogenerated": false, "ratio": 3.4680708793045802, "config_tes...
# 803. Bricks Falling When Hit # Applies the hit backwards and merges connected components on the go. # O(M*N + M*N + M*N*4*log(M*N) + len(hits)*4*log(M*N)) class Solution: def hitBricks(self, grid: List[List[int]], hits: List[List[int]]) -> List[int]: BRICK, SPACE = 1, 0 CELLING = (-1, -1) ...
{ "repo_name": "digiter/Arena", "path": "803-bricks-falling-when-hit.py", "copies": "1", "size": "2751", "license": "mit", "hash": -1914627596297139700, "line_mean": 32.1445783133, "line_max": 85, "alpha_frac": 0.4063976736, "autogenerated": false, "ratio": 3.577373211963589, "config_test": fals...
"""807. Max Increase to Keep City Skyline https://leetcode.com/problems/max-increase-to-keep-city-skyline/ In a 2 dimensional array grid, each value grid[i][j] represents the height of a building located there. We are allowed to increase the height of any number of buildings, by any amount (the amounts can be differe...
{ "repo_name": "isudox/leetcode-solution", "path": "python-algorithm/leetcode/max_increase_to_keep_city_skyline.py", "copies": "1", "size": "2215", "license": "mit", "hash": -4207374421860167000, "line_mean": 28.6351351351, "line_max": 77, "alpha_frac": 0.6165070679, "autogenerated": false, "ratio...
#80############################################################################# class Game: def __init__(self,p1,p2,g_id): self.p1 = p1 self.p2 = p2 self.g_id = g_id self.open_cells = [] for cg in cell_groups: for c in cg: self.open_cells.append(...
{ "repo_name": "eli173/star", "path": "game.py", "copies": "1", "size": "9697", "license": "mit", "hash": -6871080945560442000, "line_mean": 34.134057971, "line_max": 80, "alpha_frac": 0.4665360421, "autogenerated": false, "ratio": 3.4168428470754053, "config_test": false, "has_no_keywords": f...
#80############################################################################# import sqlite3 import json from flask import Flask, request, session, g, redirect, \ url_for, abort, render_template, flash from contextlib import closing import bcrypt import game #cfg DATABASE = 'db.db' # DEBUG = True app = Fla...
{ "repo_name": "eli173/star", "path": "star.py", "copies": "1", "size": "8368", "license": "mit", "hash": -7590449738419306000, "line_mean": 33.2950819672, "line_max": 112, "alpha_frac": 0.5611854685, "autogenerated": false, "ratio": 3.337854008775429, "config_test": false, "has_no_keywords": ...
# 8.1 fruit = "banana" letter = fruit[1] print(letter) letter = fruit[0] print(letter) print() # 8.2 fruit = "banana" print(len(fruit)) length = len(fruit) last = fruit[length - 1] print(last) print() print(fruit[-1]) print(fruit[-2]) print() print(fruit[:1]) print(fruit[0]) print() # 8.3 index = 0 while index < l...
{ "repo_name": "UWPCE-PythonCert/IntroPython2016", "path": "students/sheree/session_02/homework/TP2-Ch8-Scratch.py", "copies": "3", "size": "4493", "license": "unlicense", "hash": -7309770340004775000, "line_mean": 18.6069868996, "line_max": 119, "alpha_frac": 0.631403118, "autogenerated": false, ...
#81. 题目:809*??=800*??+9*??+1 其中??代表的两位数,8*??的结果为两位数,9*??的结果为3位数。求??代表的两位数,及809*??后的结果。 # #82 题目:八进制转换为十进制 def convert8to10(n): lenN = len(str(n)) sumN = 0 for i in range(lenN): sumN += 8 ** i * int(str(n)[lenN-1-i]) print('this is the 8 to 10 : %d' % sumN) convert8to10(122) #83. 题目:求0—7...
{ "repo_name": "cwenao/python_web_learn", "path": "base100/base100/base_81-90.py", "copies": "1", "size": "2604", "license": "apache-2.0", "hash": -3839624689703383600, "line_mean": 14.0217391304, "line_max": 86, "alpha_frac": 0.542953668, "autogenerated": false, "ratio": 1.8956999085086916, "co...
# 832 SLoC v = FormValidator( firstname=Unicode(), surname=Unicode(required="Please enter your surname"), age=Int(greaterthan(18, "You must be at least 18 to proceed"), required=False), ) input_data = { 'firstname': u'Fred', 'surname': u'Jones', 'age': u'21', } v.process(input_data) == {'age': 21, 'firstn...
{ "repo_name": "marrow/schema", "path": "example/thirdparty/formalize.py", "copies": "1", "size": "1141", "license": "mit", "hash": 364993844450605800, "line_mean": 20.9423076923, "line_max": 108, "alpha_frac": 0.6958808063, "autogenerated": false, "ratio": 3.1005434782608696, "config_test": fal...
''' 83. Remove Duplicates from Sorted List - LeetCode https://leetcode.com/problems/remove-duplicates-from-sorted-list/description/''' # Definition for singly-linked list. class ListNode(object): def __init__(self, x): self.val = x self.next = None def traversal(node): while True : pri...
{ "repo_name": "heyf/cloaked-octo-adventure", "path": "leetcode/083_remove-duplicates-from-sorted-list.py", "copies": "1", "size": "1053", "license": "mit", "hash": 6660080637553384000, "line_mean": 23.511627907, "line_max": 80, "alpha_frac": 0.5688509022, "autogenerated": false, "ratio": 3.668989...
__author__ = 'Libao Jin' __date__ = 'December 15, 2015' # Definition for singly-linked list. class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def deleteDuplicates(self, head): """ :type head: ListNode :rtype: ListNode...
{ "repo_name": "jinlibao/LeetCode-Solutions", "path": "solutions/083_Remove_Duplicates_from_Sorted_List.py", "copies": "2", "size": "1796", "license": "mit", "hash": -804682146169030900, "line_mean": 23.9444444444, "line_max": 57, "alpha_frac": 0.4838530067, "autogenerated": false, "ratio": 3.4671...
# 840. Magic Squares In Grid # Difficulty: Easy # A 3 x 3 magic square is a 3 x 3 grid filled with distinct numbers from 1 to # 9 such that each row, column, and both diagonals all have the same sum. # Given an grid of integers, how many 3 x 3 "magic square" subgrids are # there? (Each subgrid is contiguous). # # Ex...
{ "repo_name": "kingdaa/LC-python", "path": "lc/840_Magic_Squares_In_Grid.py", "copies": "1", "size": "3843", "license": "mit", "hash": -5501377790172970000, "line_mean": 29.0234375, "line_max": 77, "alpha_frac": 0.4496487119, "autogenerated": false, "ratio": 2.9538816295157573, "config_test": f...
# 841. Keys and Rooms # Difficulty: Medium # There are N rooms and you start in room 0. Each room has a distinct number # in 0, 1, 2, ..., N-1, and each room may have some keys to access the next # room. # # Formally, each room i has a list of keys rooms[i], and each key rooms[i][j] # is an integer in [0, 1, ..., N-...
{ "repo_name": "kingdaa/LC-python", "path": "lc/841_Keys_and_Rooms.py", "copies": "1", "size": "2263", "license": "mit", "hash": -6255693191801790000, "line_mean": 26.9382716049, "line_max": 80, "alpha_frac": 0.5771100309, "autogenerated": false, "ratio": 3.1213793103448277, "config_test": false...
# 842. Split Array into Fibonacci Sequence # Difficulty: Medium # Given a string S of digits, such as S = "123456579", we can split it into a # Fibonacci-like sequence [123, 456, 579]. # # Formally, a Fibonacci-like sequence is a list F of non-negative integers # such that: # # 0 <= F[i] <= 2^31 - 1, (that is, each in...
{ "repo_name": "kingdaa/LC-python", "path": "lc/842_Split_Array_into_Fibonacci_Sequence.py", "copies": "1", "size": "2475", "license": "mit", "hash": 6509765307642917000, "line_mean": 25.902173913, "line_max": 78, "alpha_frac": 0.5329292929, "autogenerated": false, "ratio": 3.0517879161528976, "...
# 845. Longest Mountain in Array # Difficulty: Medium # Let's call any (contiguous) subarray B (of A) a mountain if the following # properties hold: # # B.length >= 3 # There exists some 0 < i < B.length - 1 such that B[0] < B[1] < ... B[i-1] < # B[i] > B[i+1] > ... > B[B.length - 1] # (Note that B could be any subarr...
{ "repo_name": "kingdaa/LC-python", "path": "lc/845_Longest_Mountain_in_Array.py", "copies": "1", "size": "2235", "license": "mit", "hash": -7922733793334629000, "line_mean": 24.6896551724, "line_max": 77, "alpha_frac": 0.4286353468, "autogenerated": false, "ratio": 2.98, "config_test": false, ...
# 846. Hand of Straights # Difficulty:Medium # Alice has a hand of cards, given as an array of integers. # # Now she wants to rearrange the cards into groups so that each group is size # W, and consists of W consecutive cards. # # Return true if and only if she can. # # # # Example 1: # # Input: hand = [1,2,3,6,2,3,4,...
{ "repo_name": "kingdaa/LC-python", "path": "lc/846_Hand_of_Straights.py", "copies": "1", "size": "1587", "license": "mit", "hash": -1677375679698364000, "line_mean": 25.8983050847, "line_max": 77, "alpha_frac": 0.5671077505, "autogenerated": false, "ratio": 2.88021778584392, "config_test": fals...
# 849. Basic Calculator III class Solution: """ @param s: the expression string @return: the answer """ def calculate(self, s): tokens = [] x = 0 while True: while x < len(s) and s[x] == " ": x += 1 if x == len(s): bre...
{ "repo_name": "digiter/Arena", "path": "lintcode/849.py", "copies": "1", "size": "2008", "license": "mit", "hash": 8040945692250128000, "line_mean": 27.6857142857, "line_max": 68, "alpha_frac": 0.3451195219, "autogenerated": false, "ratio": 4.532731376975169, "config_test": false, "has_no_key...
"""84. Largest Rectangle in Histogram https://leetcode.com/problems/largest-rectangle-in-histogram/ Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram. _ |^ _| | | | | | | | | | _ | ...
{ "repo_name": "isudox/leetcode-solution", "path": "python-algorithm/leetcode/largest_rectangle_in_histogram.py", "copies": "1", "size": "2700", "license": "mit", "hash": 601026996907734500, "line_mean": 29, "line_max": 77, "alpha_frac": 0.492962963, "autogenerated": false, "ratio": 3.400503778337...
#8.4 Open the file romeo.txt and read it line by line. For each line, split the line into a #list of words using the split() function. #The program should build a list of words. #For each word on each line check to see if the word is already in the list and if not append it to the list. # When the program completes, so...
{ "repo_name": "missulmer/Pythonstudy", "path": "coursera_python_specialization/8_4.py", "copies": "1", "size": "1047", "license": "cc0-1.0", "hash": -2358535765805576700, "line_mean": 19.96, "line_max": 109, "alpha_frac": 0.6867239733, "autogenerated": false, "ratio": 3.2215384615384615, "confi...
# 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 writing, software # distribut...
{ "repo_name": "BKPrecisionCorp/BK-8500-Electronic-Load", "path": "python/8500CR_Transient_BusTrig.py", "copies": "1", "size": "3306", "license": "apache-2.0", "hash": 4228848545652204500, "line_mean": 18.3333333333, "line_max": 76, "alpha_frac": 0.7398669087, "autogenerated": false, "ratio": 2.28...
# 854. K-Similar Strings # Difficulty:Hard # Strings A and B are K-similar (for some non-negative integer K) if we can # swap the positions of two letters in A exactly K times so that the # resulting string equals B. # # Given two anagrams A and B, return the smallest K for which A and B are # K-similar. # # Example 1...
{ "repo_name": "kingdaa/LC-python", "path": "lc/854_K-Similar_Strings.py", "copies": "1", "size": "1762", "license": "mit", "hash": 5316921240372352000, "line_mean": 23.4722222222, "line_max": 75, "alpha_frac": 0.4472190692, "autogenerated": false, "ratio": 3.3058161350844277, "config_test": fal...
# 859. Buddy Strings # Difficulty:Easy # Given two strings A and B of lowercase letters, return true if and only if # we can swap two letters in A so that the result equals B. # # Example 1: # # Input: A = "ab", B = "ba" # Output: true # Example 2: # # Input: A = "ab", B = "ab" # Output: false # Example 3: # # Input: A...
{ "repo_name": "kingdaa/LC-python", "path": "lc/859_Buddy_Strings.py", "copies": "1", "size": "1060", "license": "mit", "hash": -5872625245243433000, "line_mean": 19.7843137255, "line_max": 76, "alpha_frac": 0.5047169811, "autogenerated": false, "ratio": 3.0113636363636362, "config_test": false,...
# 85% accuracy import numpy as np import glob import os import re import h5py import scipy.misc np.random.seed(777) from keras.models import Sequential from keras.layers import Dense, Dropout, Activation, Flatten, Conv2D, pooling, BatchNormalization from keras.utils import np_utils from sklearn.model_selection impor...
{ "repo_name": "thkim107/sim", "path": "CNN_cover_song_NEW.py", "copies": "1", "size": "3128", "license": "mit", "hash": 1836655132479682000, "line_mean": 30.9183673469, "line_max": 138, "alpha_frac": 0.7036445013, "autogenerated": false, "ratio": 2.6088407005838197, "config_test": false, "has...
# 85. Maximal Rectangle class Solution: def maximalRectangle(self, matrix: List[List[str]]) -> int: Elem = collections.namedtuple("Elem", ["position", "height"]) if (not matrix) or (not matrix[0]): return 0 heights = [0] * len(matrix[0]) ans = 0 for row in matrix...
{ "repo_name": "digiter/Arena", "path": "85-maximal-rectangle.py", "copies": "1", "size": "1205", "license": "mit", "hash": 6435183265621438000, "line_mean": 34.4411764706, "line_max": 80, "alpha_frac": 0.465560166, "autogenerated": false, "ratio": 3.7538940809968846, "config_test": false, "ha...
"""85. Maximal Rectangle https://leetcode.com/problems/maximal-rectangle/ Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area. Example: Input: [ ⁠ ["1","0","1","0","0"], ⁠ ["1","0","1","1","1"], ⁠ ["1","1","1","1","1"], ⁠ ["1","0","0","1","0"] ] Outp...
{ "repo_name": "isudox/leetcode-solution", "path": "python-algorithm/leetcode/maximal_rectangle.py", "copies": "1", "size": "1300", "license": "mit", "hash": 6248749042626007000, "line_mean": 25.9166666667, "line_max": 76, "alpha_frac": 0.4821981424, "autogenerated": false, "ratio": 3.530054644808...
# 8.5 # Liu Li # 18 Nov, 2015 ''' Open the file mbox-short.txt and read it line by line. When you find a line that starts with 'From ' like the following line: From stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 2008 You will parse the From line using split() and print out the second word in the line (i.e. the entire ...
{ "repo_name": "ll0816/PythonForEverybody", "path": "Python-Data-Structure/Ass8.5.py", "copies": "1", "size": "1668", "license": "mit", "hash": 7285127201538093000, "line_mean": 29.3272727273, "line_max": 181, "alpha_frac": 0.6636690647, "autogenerated": false, "ratio": 2.7986577181208054, "conf...
"""8.5 Open the file mbox-short.txt and read it line by line. When you find a line that starts with 'From ' like the following line: From stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 2008 You will parse the From line using split() and print out the second word in the line (i.e. the entire address of the person who s...
{ "repo_name": "missulmer/Pythonstudy", "path": "coursera_python_specialization/8_5.py", "copies": "1", "size": "1043", "license": "cc0-1.0", "hash": 5516316851001657000, "line_mean": 26.4473684211, "line_max": 132, "alpha_frac": 0.6615532119, "autogenerated": false, "ratio": 3.5719178082191783, ...
# 86 fps 10/27/2012 #106 fps 3/1/2013 # 39 fps 10/3/2017 - no psyco support in Python3 from toast.scene_graph import Component, Scene from toast.sprite import Sprite from toast.animation import Animation from toast.image_sheet import ImageSheet from toast.resource_loader import ResourceLoader from toast.emitter import...
{ "repo_name": "JoshuaSkelly/Toast", "path": "examples/emitter/emitter_performance_test.py", "copies": "2", "size": "2893", "license": "mit", "hash": -6150066314620411000, "line_mean": 35.1625, "line_max": 125, "alpha_frac": 0.6066367093, "autogenerated": false, "ratio": 3.571604938271605, "conf...
# 882. Reachable Nodes In Subdivided Graph class Solution: def reachableNodes(self, edges: List[List[int]], maxMoves: int, n: int) -> int: graph = [[] for _ in range(n)] cnt = [[] for _ in range(n)] for e in edges: graph[e[0]].append(e[1]) graph[e[1]].append(e[0]) ...
{ "repo_name": "digiter/Arena", "path": "882.py", "copies": "1", "size": "1427", "license": "mit", "hash": 3177672949798333000, "line_mean": 32.1395348837, "line_max": 93, "alpha_frac": 0.4435087719, "autogenerated": false, "ratio": 3.607594936708861, "config_test": false, "has_no_keywords": f...
"""8-bit string definitions for Python 2/3 compatibility Defines the following which allow for dealing with Python 3 breakages: STR_IS_BYTES STR_IS_UNICODE Easily checked booleans for type identities _NULL_8_BYTE An 8-bit byte with NULL (0) value as_8_bit( x, encod...
{ "repo_name": "frederica07/Dragon_Programming_Process", "path": "PyOpenGL-3.0.2/OpenGL/_bytes.py", "copies": "1", "size": "1239", "license": "bsd-2-clause", "hash": 2610254569464124000, "line_mean": 24.8125, "line_max": 70, "alpha_frac": 0.602905569, "autogenerated": false, "ratio": 3.54, "conf...
#8CH GPIO TOGGLE import RPi.GPIO as GPIO PIN_A = 3 PIN_B = 5 PIN_C = 7 PIN_D = 11 PIN_E = 13 PIN_F = 15 PIN_G = 19 PIN_H = 21 PIN_I = 23 CH_MAX = 9 class SlGpio : try: #while True : def __init__ (self) : print("init") self.CH_MAX = CH_MAX self.GPIO = GPIO ...
{ "repo_name": "DiamondOhana/jphacks", "path": "python_main/sonilab/sl_gpio.py", "copies": "2", "size": "1266", "license": "mit", "hash": 7365615152756967000, "line_mean": 24.8367346939, "line_max": 82, "alpha_frac": 0.4960505529, "autogenerated": false, "ratio": 3.028708133971292, "config_test"...
#8CH GPIO TOGGLE # import RPi.GPIO as GPIO PIN_A = 3 PIN_B = 5 PIN_C = 7 PIN_D = 11 PIN_E = 13 PIN_F = 15 PIN_G = 19 PIN_H = 21 PIN_I = 23 CH_MAX = 9 class SlGpio : try: #while True : def __init__ (self) : print("init") self.CH_MAX = CH_MAX # self.GPIO = GPIO ...
{ "repo_name": "DiamondOhana/jphacks", "path": "rpi_main/sonilab/sl_gpio2.py", "copies": "2", "size": "1455", "license": "mit", "hash": -6377689930922320000, "line_mean": 24.9821428571, "line_max": 89, "alpha_frac": 0.4666666667, "autogenerated": false, "ratio": 3.1357758620689653, "config_test"...
# -8- coding: utf-8 -*- import re from urlparse import urljoin import util _titleptn = re.compile(ur''' (?P<dat>\d+\.(?:dat|cgi)) # datファイル名 (?:(?:<>)|,) # 区切り文字(<>または,) (?P<title>.+) # タイトル \((?P<num>\d{1,4})\) # レス数 ''', re.VERBOSE | re.UNICODE) class Board(object...
{ "repo_name": "ymotongpoo/restroom", "path": "python/py2ch/py2ch/bbsboard.py", "copies": "1", "size": "2109", "license": "apache-2.0", "hash": 6866934287043119000, "line_mean": 24.5479452055, "line_max": 76, "alpha_frac": 0.4975871314, "autogenerated": false, "ratio": 2.8516819571865444, "confi...
# *-8 coding: utf-8 -*- """ Parse requirements file, and work out whether there are any updates. """ import requests from semantic_version import Version def package_url(package): """Return fully-qualified URL to package on PyPI (JSON endpoint).""" return u"http://pypi.python.org/pypi/%s/json" % package def...
{ "repo_name": "yunojuno/pypi-alerts", "path": "pypi_alerts/__init__.py", "copies": "1", "size": "1911", "license": "mit", "hash": -7940523014197847000, "line_mean": 29.3333333333, "line_max": 76, "alpha_frac": 0.6352694924, "autogenerated": false, "ratio": 4.1274298056155505, "config_test": fal...
''' 8-compare_max_fluxes.py ============================== AIM: Plots the comparison of maximal fluxes. INPUT: files: - <orbit_id>_misc/error_evolution.dat variables: see section PARAMETERS (below) OUTPUT: in all_figures/ : comparison for every orbit_iditude CMD: python 8-compare_max_fluxes.py ISSUES: <none known...
{ "repo_name": "kuntzer/SALSA-public", "path": "8_compare_max_fluxes.py", "copies": "1", "size": "5439", "license": "bsd-3-clause", "hash": -8122013035511458000, "line_mean": 30.08, "line_max": 114, "alpha_frac": 0.6390880677, "autogenerated": false, "ratio": 2.7195, "config_test": false, "has...
# 8 (continued). si/eol/images # images is for POST, get_images is for GET # The output is weird. # "species": [{"images": [{"mediaURL": ...}, {"mediaURL": ...}, ...]}] # How do we know which image goes with which species? import sys, unittest, json sys.path.append('./') sys.path.append('../') import webapp import ...
{ "repo_name": "jar398/tryphy", "path": "tests/test_si_eol_images.py", "copies": "1", "size": "1343", "license": "bsd-2-clause", "hash": 7508067493960265000, "line_mean": 28.8444444444, "line_max": 99, "alpha_frac": 0.6582278481, "autogenerated": false, "ratio": 3.3828715365239295, "config_test"...
8# Copyright 2016 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 accomp...
{ "repo_name": "pralexa/awsebcli", "path": "ebcli/controllers/appversion.py", "copies": "3", "size": "2295", "license": "apache-2.0", "hash": 4313240134265184000, "line_mean": 41.5, "line_max": 116, "alpha_frac": 0.7032679739, "autogenerated": false, "ratio": 4.061946902654867, "config_test": fa...
#-8- encoding: utf-8 -*- import sys import os import socket import argparse import logging class FileSender(object): logger = None def __init__(self, host, port, logger=None): self.host = host self.port = port self.logger = logger or self.getDefaultLogger() @classmethod def g...
{ "repo_name": "dlutxx/memo", "path": "python/fileclient.py", "copies": "1", "size": "2374", "license": "mit", "hash": 8794118064522743000, "line_mean": 26.2873563218, "line_max": 77, "alpha_frac": 0.5261162595, "autogenerated": false, "ratio": 3.9698996655518393, "config_test": false, "has_no...
# 8 schools model #https://docs.pymc.io/notebooks/Diagnosing_biased_Inference_with_Divergences.html import pymc3 as pm import numpy as np import pandas as pd import matplotlib.pyplot as plt plt.style.use('seaborn-darkgrid') from collections import defaultdict import arviz as az print('Runing on PyMC3 v{}'.format(p...
{ "repo_name": "probml/pyprobml", "path": "scripts/schools8_pymc3_old.py", "copies": "1", "size": "3556", "license": "mit", "hash": -1064286880298471000, "line_mean": 31.045045045, "line_max": 129, "alpha_frac": 0.6808211474, "autogenerated": false, "ratio": 2.835725677830941, "config_test": fal...
# 8 schools model #https://docs.pymc.io/notebooks/Diagnosing_biased_Inference_with_Divergences.html import pymc3 as pm import numpy as np import pandas as pd import matplotlib.pyplot as plt #plt.style.use('seaborn-darkgrid') from collections import defaultdict import arviz as az print('Runing on PyMC3 v{}'.format(...
{ "repo_name": "probml/pyprobml", "path": "scripts/schools8_pymc3.py", "copies": "1", "size": "4019", "license": "mit", "hash": 6834202812326901000, "line_mean": 31.16, "line_max": 129, "alpha_frac": 0.6730529983, "autogenerated": false, "ratio": 2.739604635310157, "config_test": false, "has_n...
# 8. si/eol/get_images # TBD: reuse the eol/images tests for this method (similarly to other # similar situations) import sys, unittest, json sys.path.append('./') sys.path.append('../') import webapp service = webapp.get_service(5004, 'si/eol/get_images') class SiEolImagesTester(webapp.WebappTestCase): def tes...
{ "repo_name": "jar398/tryphy", "path": "tests/test_si_eol_get_images.py", "copies": "1", "size": "3732", "license": "bsd-2-clause", "hash": -2137508478097817900, "line_mean": 35.5882352941, "line_max": 100, "alpha_frac": 0.6146838156, "autogenerated": false, "ratio": 3.465181058495822, "config_...
"""8th update, removes some NOT NULL constraints to allow SqlAlchemy to handle cascading deletes Revision ID: 3659056767c5 Revises: 563495edabd3 Create Date: 2015-11-23 12:26:17.370260 """ # revision identifiers, used by Alembic. revision = '3659056767c5' down_revision = '563495edabd3' from alembic import op import...
{ "repo_name": "Rdbaker/GameCenter", "path": "migrations/versions/3659056767c5_.py", "copies": "2", "size": "1030", "license": "mit", "hash": -4058641323637509600, "line_mean": 27.6111111111, "line_max": 96, "alpha_frac": 0.6262135922, "autogenerated": false, "ratio": 3.759124087591241, "config_...
# 8 异常 # --------- 8.1 认识 Traceback --------- # a = 1/0 # print(a) # ZeroDivisionError: division by zero # --------- 8.2 按自己的方式出错 --------- # raise 语句 # raise Exception # Exception,引发一个没有任何错误信息的普通异常 # raise Exception('hyperdrive overload') # Exception: hyperdrive overload,自定义错误信息 # raise ArithmeticErr...
{ "repo_name": "xiezipei/beginning-python-demo", "path": "demo/except.py", "copies": "1", "size": "6548", "license": "mit", "hash": 2291597297727654100, "line_mean": 22.6769911504, "line_max": 86, "alpha_frac": 0.5751401869, "autogenerated": false, "ratio": 2.104642014162077, "config_test": fals...
''' 8x4grid-unicornphat.py Animation and single frame creation append for Pimoroni UnicornPHat 8x8 LED matrix''' import pygame import sys import math from pygame.locals import * from led import LED from buttons import Button import png # pypng import unicornhat as uh import copy, time uh.set_layout(uh.PHAT) saved = Tru...
{ "repo_name": "topshed/RPi_8x8GridDraw", "path": "8x8grid-unicornphat.py", "copies": "1", "size": "15582", "license": "mit", "hash": 8078726868055155000, "line_mean": 27.9628252788, "line_max": 126, "alpha_frac": 0.575664228, "autogenerated": false, "ratio": 3.1677170156535883, "config_test": f...
''' 8x8grid-sense.py Animation and single frame creation append for SenseHAT 8x8 LED matrix''' import pygame import sys import math from pygame.locals import * from led import LED from buttons import Button import png # pypng from sense_hat import SenseHat import copy, time saved = True warning = False pygame.init() p...
{ "repo_name": "topshed/RPi_8x8GridDraw", "path": "8x8grid-sense.py", "copies": "1", "size": "14715", "license": "mit", "hash": 711211136831649300, "line_mean": 27.3526011561, "line_max": 119, "alpha_frac": 0.5858647638, "autogenerated": false, "ratio": 3.185754492314354, "config_test": false, ...
''' 8x8grid-unicorn.py Animation and single frame creation append for Pimoroni UnicornHat 8x8 LED matrix''' import pygame import sys import math from pygame.locals import * from led import LED from buttons import Button import png # pypng #from astro_pi import AstroPi import unicornhat as uh import copy, time saved = ...
{ "repo_name": "topshed/RPi_8x8GridDraw", "path": "8x8grid-unicorn.py", "copies": "1", "size": "15251", "license": "mit", "hash": -1442927982785858800, "line_mean": 27.8298676749, "line_max": 126, "alpha_frac": 0.5808799423, "autogenerated": false, "ratio": 3.1588649544324774, "config_test": fal...
# 8x8 LED arrangements for various images from PIL import Image from PIL import ImageDraw def smiley(rotation=0): """ 8x8 LED Matrix smiley face LED arrangement """ smiley = [[0, 0, 1, 1, 1, 1, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0], [1, 0, 1, 0, 0, 1, 0, 1], [1, 0, 0, 0, 0,...
{ "repo_name": "kbsezginel/raspberry-pi", "path": "scripts/rpi/8x8-led-lmatrix/images8x8.py", "copies": "1", "size": "1869", "license": "bsd-3-clause", "hash": -2554022521650018000, "line_mean": 30.6779661017, "line_max": 98, "alpha_frac": 0.5157838416, "autogenerated": false, "ratio": 2.947949526...
"""90. Subsets II https://leetcode.com/problems/subsets-ii/ Given a collection of integers that might contain duplicates, nums, return all possible subsets (the power set). Note: The solution set must not contain duplicate subsets. Example: Input: [1,2,2] Output: [ [2], [1], [1,2,2], [2,2], [1,2], [] ] ...
{ "repo_name": "isudox/leetcode-solution", "path": "python-algorithm/leetcode/subsets_ii.py", "copies": "1", "size": "1207", "license": "mit", "hash": -6310278320942938000, "line_mean": 23.14, "line_max": 79, "alpha_frac": 0.5401822701, "autogenerated": false, "ratio": 3.6465256797583083, "confi...
# 913. Cat and Mouse from typing import List MOUSE, CAT, DRAW = 1, 2, 0 # O(2 * n^3) states and O(n) ways of transition -> O(n^4) class Solution: def catMouseGame(self, graph: List[List[int]]) -> int: memo = dict() def dfs(mouse: int, cat: int, level: int): if level == len(graph) * 2...
{ "repo_name": "digiter/Arena", "path": "913-cat-and-mouse.py", "copies": "1", "size": "1456", "license": "mit", "hash": 4492257581581473000, "line_mean": 33.6666666667, "line_max": 76, "alpha_frac": 0.5034340659, "autogenerated": false, "ratio": 4.183908045977011, "config_test": false, "has_n...
# 913. Cat and Mouse # O(2 * N^3) from typing import List from collections import defaultdict from queue import SimpleQueue MOUSE, CAT, DRAW = 1, 2, 0 class Solution: def catMouseGame(self, graph: List[List[int]]) -> int: state = dict() # mouse, cat, turn -> result que = SimpleQueue() ...
{ "repo_name": "digiter/Arena", "path": "913-cat-and-mouse_2.py", "copies": "1", "size": "2532", "license": "mit", "hash": 560435874847510660, "line_mean": 31.8831168831, "line_max": 78, "alpha_frac": 0.5031595577, "autogenerated": false, "ratio": 3.7961019490254873, "config_test": false, "has...
"""9-1. store two attributes: restaurant_name and cousine_type make a method called describe_restaurant() that prints this two pieces of information, and a method called open_restaurant() this prints a message indicating that the restaurant is open Make an instance called restaurant from your class. Print the tw...
{ "repo_name": "AnhellO/DAS_Sistemas", "path": "Ene-Jun-2018/Juan Sleiman/Tarea 2(PyCrashCourse.9-6,9-9)/Restaurant.py", "copies": "1", "size": "1743", "license": "mit", "hash": -3666402149774623000, "line_mean": 43.6923076923, "line_max": 101, "alpha_frac": 0.7234652897, "autogenerated": false, "...
# 91.题目:时间函数举例1。 import time print(time.ctime(time.time())) print(time.asctime(time.localtime(time.time()))) print(time.asctime(time.gmtime(time.time()))) print(time.time()) # 92 题目:时间函数举例2。 start = time.time() for i in range(10000): i += 1 end = time.time() print(start-end) # 93.题目:时间函数举例2。 start = time...
{ "repo_name": "cwenao/python_web_learn", "path": "base100/base100/base_91-100.py", "copies": "1", "size": "2172", "license": "apache-2.0", "hash": -8833718215388849000, "line_mean": 14.4054054054, "line_max": 64, "alpha_frac": 0.6029239766, "autogenerated": false, "ratio": 1.930022573363431, "c...
# 9.2.1 重新一般方法和特殊的构造方法 class A: def hello(self): print('Hello, I\'m A.') class B(A): pass a = A() b = B() a.hello() # Hello, I'm A. b.hello() # Hello, I'm A. # 重写 A 的 hello 方法 class B(A): def hello(self): print('Hello, I\'m B.') b = B() b.hello() # Hello, I'm B. # 如果一个类的构造方法被重...
{ "repo_name": "xiezipei/beginning-python-demo", "path": "demo/construct.py", "copies": "1", "size": "2509", "license": "mit", "hash": -6855357652077139000, "line_mean": 17.6057692308, "line_max": 74, "alpha_frac": 0.5586563307, "autogenerated": false, "ratio": 1.7703568161024703, "config_test":...
# 9/23/2013 # Alethea Butler import socket import threading class Client: def __init__(self, dest_addr=("127.0.0.1", 5280), listen_addr=("127.0.0.1", 5281)): self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.bsock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.des...
{ "repo_name": "alethea/udp-chat", "path": "tinychat/client.py", "copies": "1", "size": "1579", "license": "apache-2.0", "hash": -8255308047783005000, "line_mean": 27.1964285714, "line_max": 87, "alpha_frac": 0.5281823939, "autogenerated": false, "ratio": 3.9475, "config_test": false, "has_no_...
# 9/23/2013 # Charles O. Goddard import socket import sys class Server: def __init__(self, bind_addr=("0.0.0.0", 5280), client_port=5281): self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.bind_addr = bind_addr self.client_port = client_port self.running = False ...
{ "repo_name": "alethea/udp-chat", "path": "tinychat/server.py", "copies": "1", "size": "1470", "license": "apache-2.0", "hash": -404008474993909060, "line_mean": 28.4, "line_max": 70, "alpha_frac": 0.4918367347, "autogenerated": false, "ratio": 4.060773480662983, "config_test": false, "has_no...
"""938. Range Sum of BST https://leetcode.com/problems/range-sum-of-bst/ Given the root node of a binary search tree, return the sum of values of all nodes with value between L and R (inclusive). The binary search tree is guaranteed to have unique values. Example 1: Input: root = [10,5,15,3,7,null,18], L = 7, R...
{ "repo_name": "isudox/leetcode-solution", "path": "python-algorithm/leetcode/range_sum_of_bst.py", "copies": "1", "size": "1522", "license": "mit", "hash": 914627529621628200, "line_mean": 21.0579710145, "line_max": 76, "alpha_frac": 0.5551905388, "autogenerated": false, "ratio": 3.08722109533468...
"""9-3. Users: Make a class called User. Create two attributes called first_name and last_name, and then create several other attributes that are typically stored in a user profile. Make a method called describe_user() that prints a summary of the user’s information. Make another method called greet_user() that prints ...
{ "repo_name": "AnhellO/DAS_Sistemas", "path": "Ene-Jun-2018/Juan Sleiman/Tarea 2(PyCrashCourse.9-6,9-9)/UserAdmin.py", "copies": "1", "size": "2815", "license": "mit", "hash": 1341132050950069200, "line_mean": 36.972972973, "line_max": 118, "alpha_frac": 0.6647686833, "autogenerated": false, "rat...
"""94. Binary Tree Inorder Traversal https://leetcode.com/problems/binary-tree-inorder-traversal/ Given a binary tree, return the in-order traversal of its nodes' values. Example: Input: [1,null,2,3] 1 \ 2 / 3 Output: [1,3,2] Follow up: Recursive solution is trivial, could you do it iteratively...
{ "repo_name": "isudox/leetcode-solution", "path": "python-algorithm/leetcode/binary_tree_inorder_traversal.py", "copies": "1", "size": "1306", "license": "mit", "hash": -681623068723062500, "line_mean": 21.9122807018, "line_max": 76, "alpha_frac": 0.5574272588, "autogenerated": false, "ratio": 3....
# 9.4 # Liu Li # 18 Nov, 2015 ''' Write a program to read through the mbox-short.txt and figure out who has the sent the greatest number of mail messages. The program looks for 'From ' lines and takes the second word of those lines as the person who sent the mail. The program creates a Python dictionary that maps the ...
{ "repo_name": "ll0816/PythonForEverybody", "path": "Python-Data-Structure/Ass9.4.py", "copies": "1", "size": "1044", "license": "mit", "hash": 1909214826778944800, "line_mean": 40.76, "line_max": 498, "alpha_frac": 0.6360153257, "autogenerated": false, "ratio": 3.5631399317406145, "config_test"...
#9.4 Write a program to read through the mbox-short.txt and figure out who has the sent the greatest number of mail messages. The program looks for 'From ' lines and takes the second word of those lines as the person who sent the mail. The program creates a Python dictionary that maps the sender's mail address to a cou...
{ "repo_name": "joeyb182/pynet_ansible", "path": "Coursera-UMich/9_4-mbox-short-count.py", "copies": "1", "size": "1139", "license": "apache-2.0", "hash": 1151198781344117000, "line_mean": 34.625, "line_max": 503, "alpha_frac": 0.7199297629, "autogenerated": false, "ratio": 3.4831804281345566, "...
""" 9.4 Write a program to read through the mbox-short.txt and figure out who has the sent the greatest number of mail messages. The program looks for 'From ' lines and takes the second word of those lines as the person who sent the mail. The program creates a Python dictionary that maps the sender's mail address to a ...
{ "repo_name": "missulmer/Pythonstudy", "path": "coursera_python_specialization/9_4.py", "copies": "1", "size": "1246", "license": "cc0-1.0", "hash": -6944992554957157000, "line_mean": 30.9487179487, "line_max": 134, "alpha_frac": 0.6894060995, "autogenerated": false, "ratio": 3.9182389937106916, ...
#-9.5 --> 30.5/40 #Part 1: Terminology (15 points) -3.5 --> 11.5/15 #1 1pt) What is the symbol "=" used for? #That symbol is called a assignment operator, it creates new variables, and gives the variables values. #1pt # #2 3pts) Write a technical definition for 'function' #A function is a named set of code that peform...
{ "repo_name": "deedee1886-cmis/deedee1886-cmis-cs2", "path": "cs2quiz1.py", "copies": "1", "size": "2885", "license": "cc0-1.0", "hash": -4936192264473424000, "line_mean": 28.7422680412, "line_max": 150, "alpha_frac": 0.6842287695, "autogenerated": false, "ratio": 2.9378818737270875, "config_te...
# 9.5 属性 # 访问器是一个简单的方法,它能够使用getHeight、setHeight # 这样的名字来得到或者重新绑定一些特性。 class Rectangle: def __init__(self): self.width = 0 self.height = 0 def setsize(self, size): self.width, self.height = size def getsize(self): return self.width, self.height def getarea(self): ...
{ "repo_name": "xiezipei/beginning-python-demo", "path": "demo/attr.py", "copies": "1", "size": "6128", "license": "mit", "hash": -1260554104339724800, "line_mean": 18.7867298578, "line_max": 78, "alpha_frac": 0.6238620029, "autogenerated": false, "ratio": 1.5913076629813192, "config_test": fals...
"""95. Unique Binary Search Trees II https://leetcode.com/problems/unique-binary-search-trees-ii/description/ Given an integer n, generate all structurally unique BST's (binary search trees) that store values 1 ... n. Example: Input: 3 Output: [ [1,null,3,2], [3,2,null,1], [3,1,null,null,2], [2,1,3], [1,null,2,null...
{ "repo_name": "isudox/leetcode-solution", "path": "python-algorithm/leetcode/unique_binary_search_trees_ii.py", "copies": "1", "size": "2584", "license": "mit", "hash": -8724293836029515000, "line_mean": 26.6666666667, "line_max": 73, "alpha_frac": 0.4535561601, "autogenerated": false, "ratio": 3...
#9600, 8, none, stop1, noflow from __future__ import print_function import serial import time import struct import datetime import sys import os.path # Init def initOPC(ser): print("Init:") time.sleep(1) ser.write(bytearray([0x5A,0x01])) nl = ser.read(3) print(nl) time.sleep(.1) ser.write(bytearray([0x5A,0x03]...
{ "repo_name": "ozjimbob/alphasense-opc", "path": "opc.py", "copies": "1", "size": "4239", "license": "mit", "hash": -7466551465594394000, "line_mean": 26.3483870968, "line_max": 583, "alpha_frac": 0.6013210663, "autogenerated": false, "ratio": 2.265633351149118, "config_test": false, "has_no_...
# 964. Least Operators to Express Number # # This solution is wrong becuase choice2 assumes the cost of an extra x^(i+1) is # `1+cost[i+1]`. But the minimum cost of x^(i+1) could be using substract # instead of addtion. from functools import cache class Solution: def leastOpsExpressTarget(self, x: int, target: i...
{ "repo_name": "digiter/Arena", "path": "964-least-operators-to-express-number_2_WA.py", "copies": "1", "size": "1314", "license": "mit", "hash": 4346068954914455600, "line_mean": 32.6923076923, "line_max": 80, "alpha_frac": 0.5213089802, "autogenerated": false, "ratio": 3.2768079800498753, "con...
# 964. Least Operators to Express Number # O(log(target)^2) from functools import cache class Solution: def leastOpsExpressTarget(self, x: int, target: int) -> int: @cache def solve(goal): if goal == 0: return 0 if x > goal: # x/x + x/x + ....
{ "repo_name": "digiter/Arena", "path": "964-least-operators-to-express-number_3.py", "copies": "1", "size": "1685", "license": "mit", "hash": 1115351946143768400, "line_mean": 32.7, "line_max": 82, "alpha_frac": 0.4462908012, "autogenerated": false, "ratio": 4.002375296912114, "config_test": fa...
# 97 through 122 import time f = open('/Users/kevin/Computer Science/project_euler/p59_text.txt', 'r') #print cipher def translate(a,b,c): length = len(cipher) temp = cipher place = 1 for i in xrange(0, length): if place == 3: temp[i] = chr(int(cipher[i]) ^ c) place = ...
{ "repo_name": "kbrose/project_euler", "path": "p50-59/p59.py", "copies": "1", "size": "1153", "license": "unlicense", "hash": -5469053161861186000, "line_mean": 22.5306122449, "line_max": 73, "alpha_frac": 0.4640069384, "autogenerated": false, "ratio": 3.5476923076923077, "config_test": false, ...
"""981. Time Based Key-Value Store https://leetcode.com/problems/time-based-key-value-store/ Create a timebased key-value store class TimeMap, that supports two operations. 1. set(string key, string value, int timestamp) Stores the key and value, along with the given timestamp. 2. get(string key, int timestamp) Ret...
{ "repo_name": "isudox/leetcode-solution", "path": "python-algorithm/leetcode/time_based_key_value_store.py", "copies": "1", "size": "2561", "license": "mit", "hash": 3392176462893833000, "line_mean": 34.0821917808, "line_max": 180, "alpha_frac": 0.6149941429, "autogenerated": false, "ratio": 3.27...
"""984. String Without AAA or BBB https://leetcode.com/problems/string-without-aaa-or-bbb/ Given two integers A and B, return any string S such that: S has length A + B and contains exactly A 'a' letters, and exactly B 'b' letters; The substring 'aaa' does not occur in S; The substring 'bbb' does not occur in S. ...
{ "repo_name": "isudox/leetcode-solution", "path": "python-algorithm/leetcode/string_without_3a3b.py", "copies": "1", "size": "1190", "license": "mit", "hash": -1916451612155437300, "line_mean": 19.5172413793, "line_max": 60, "alpha_frac": 0.4605042017, "autogenerated": false, "ratio": 3.305555555...
"""98. Validate Binary Search Tree https://leetcode.com/problems/validate-binary-search-tree/description/ Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: - The left subtree of a node contains only nodes with keys less than the node's key. - The right subt...
{ "repo_name": "isudox/leetcode-solution", "path": "python-algorithm/leetcode/validate_binary_search_tree.py", "copies": "1", "size": "1931", "license": "mit", "hash": 2847565672476987400, "line_mean": 24.2368421053, "line_max": 79, "alpha_frac": 0.5531803962, "autogenerated": false, "ratio": 3.68...
"""9-9. Battery Upgrade: Use the final version of electric_car.py from this section. Add a method to the Battery class called upgrade_battery(). This method should check the battery size and set the capacity to 85 if it isn’t already. Make an electric car with a default battery size, call get_range() once, and then cal...
{ "repo_name": "AnhellO/DAS_Sistemas", "path": "Ene-Jun-2019/Angelica Rodriguez/Practica 1/battery_upgrade_9_9.py", "copies": "1", "size": "3206", "license": "mit", "hash": 8683257964822964000, "line_mean": 36.2325581395, "line_max": 79, "alpha_frac": 0.6252342286, "autogenerated": false, "ratio":...
# 9. print_log('\n9. Build the SCHEMA request to add new schema to the ledger as a Steward\n') seq_no = 1 schema = { 'seqNo': seq_no, 'dest': steward_did, 'data': { 'id': '1', 'name': 'gvt', 'version': '1...
{ "repo_name": "srottem/indy-sdk", "path": "docs/how-tos/save-schema-and-cred-def/python/step3.py", "copies": "4", "size": "1087", "license": "apache-2.0", "hash": -4292125829809776000, "line_mean": 37.8214285714, "line_max": 119, "alpha_frac": 0.5243790248, "autogenerated": false, "ratio": 3.7226...
''' 9-plot_flux.py ========================= AIM: Plot maps of the stray light flux or equivalent magnitude given a particular date INPUT: files: - <orbit_id>_misc/orbits.dat - <orbit_id>_flux/flux_*.dat - resources/moon_*.dat, sun_*.dat, orbits_*.dat variables: see section PARAMETERS (below) OUTPUT: in <orbit_...
{ "repo_name": "kuntzer/SALSA-public", "path": "9_plot_flux.py", "copies": "1", "size": "16932", "license": "bsd-3-clause", "hash": 8266739750742710000, "line_mean": 32.2652259332, "line_max": 225, "alpha_frac": 0.6182967163, "autogenerated": false, "ratio": 2.844758064516129, "config_test": fal...
9#!/usr/bin/env python import argparse import sys import os import subprocess as sp DEFAULT_SUB_FILE = '''#!/bin/csh #$ -M {}@nd.edu #$ -m ae #$ -N {} #$ -q {} #$ -r n {} module load schrodinger/2015u3 module load gaussian/09D01 module load tinker setenv SCHRODINGER_TEMP_PROJECT "~/.schrodtmp" setenv SCHRODINGER_TMP...
{ "repo_name": "arosale4/q2mm", "path": "tools/submit.py", "copies": "3", "size": "3435", "license": "mit", "hash": -8008412664737023000, "line_mean": 29.9459459459, "line_max": 79, "alpha_frac": 0.6154294032, "autogenerated": false, "ratio": 3.544891640866873, "config_test": false, "has_no_ke...
# # a="00014#" # # print(a.isdigit()) # # print(a.isnumeric()) # # print(a.isalnum()) # # a = {"name":"a","count":3} # print(type(a)) # b = a.keys() # c = a.values() # print(b) # print(c) # for i in b: # print(i) # for i in c: # print(i) # print(type(b)) # print(type(c)) # d = set(b) # print(type(d)) # print(d)...
{ "repo_name": "dianshen/python_day", "path": "day3/test.py", "copies": "1", "size": "2216", "license": "apache-2.0", "hash": -7510194399769710000, "line_mean": 15.1804511278, "line_max": 64, "alpha_frac": 0.5269516729, "autogenerated": false, "ratio": 2.1370407149950346, "config_test": false, ...
A =[0,2,0,2,0,0,3,0,0,4] B =[0,0,0,0,5,0,2,0,0,8] def dot_product_unsorted(A,B): # T O(mn) # without order resA = {} resB = {} for i in range(len(A)): if A[i] != 0: resA[i] = A[i] for j in range(len(B)): if B[j] != 0: resB[j] = B[j] res = 0 for ea...
{ "repo_name": "youhusky/Facebook_Prepare", "path": "dot_product.py", "copies": "1", "size": "1995", "license": "mit", "hash": -288516040476354800, "line_mean": 20.6847826087, "line_max": 56, "alpha_frac": 0.4426065163, "autogenerated": false, "ratio": 2.755524861878453, "config_test": false, ...
a = "{0[ ]:X>+10d}" a = "{0[ ]!s:X>+10d}" a = "{0[ ]:Xd>+10d}" #invalid a : source.python : source.python = : keyword.operator.assignment.python, source.python : source.python " : punctuation.definition.string.begin.python, source.python, string.quoted....
{ "repo_name": "MagicStack/MagicPython", "path": "test/strings/format1.py", "copies": "1", "size": "2832", "license": "mit", "hash": 9073153414131596000, "line_mean": 75.5405405405, "line_max": 164, "alpha_frac": 0.6938559322, "autogenerated": false, "ratio": 3.791164658634538, "config_test": fa...
a = 100 b = 200 print(a) # 100 print(b) # 200 a, b = 100, 200 print(a) # 100 print(b) # 200 a, b, c = 0.1, 100, 'string' print(a) # 0.1 print(b) # 100 print(c) # string a = 100, 200 print(a) print(type(a)) # (100, 200) # <class 'tuple'> # a, b = 100, 200, 300 # ValueError: too many values to unpack (expecte...
{ "repo_name": "nkmk/python-snippets", "path": "notebook/multi_variables_values.py", "copies": "1", "size": "1135", "license": "mit", "hash": -4459949238109588000, "line_mean": 7.7984496124, "line_max": 61, "alpha_frac": 0.5339207048, "autogenerated": false, "ratio": 1.9269949066213923, "config_...
a = 100 if a >= 0: print(a) else: print(-a) print(True and True) print(10 / 3) classmates = ['Michael', 'Bod', 'Tracy'] print(len(classmates)) classmates.insert(1, 'Jack') if a >= 3: print('adult') elif a >= 5: print('child') else: pass for name in classmates: print(name) # dict d = {'Miche...
{ "repo_name": "zhayangtao/HelloPython", "path": "python01/PythonBasic.py", "copies": "1", "size": "4166", "license": "apache-2.0", "hash": 7217849806142647000, "line_mean": 14.3307086614, "line_max": 98, "alpha_frac": 0.520287622, "autogenerated": false, "ratio": 2.267909143855562, "config_test...
#a10-ipython-inventory.py import sys import yaml import json import os import sys import socket from requests.adapters import HTTPAdapter from urllib3.poolmanager import PoolManager import ssl import requests from xml.dom.minidom import parse, parseString __author__ = 'ACMEsEngTeam' hostname = socket.getfqdn() file = ...
{ "repo_name": "otsuarez/starmeup", "path": "release/scripts/inventory-a10-python.py", "copies": "1", "size": "3325", "license": "mit", "hash": -757005643157798700, "line_mean": 31.9207920792, "line_max": 126, "alpha_frac": 0.6565413534, "autogenerated": false, "ratio": 3.095903165735568, "confi...
# a = [[1,2],[1,2,3]] # print(a) # # b = (1,2,3) # print(b) # print(a[0]) # print(b[0]) # b[0]=4 # d = {"key":{"key2":"bob"}} # d['key3'] = 4 # print(d.get("key4",0)) # x=4 # if x>3: # print(x) # elif x == 3: # print(x+1) # else: # print(x-1) # x=0 # while x<4: # print(x) # x+=1 def add(x,y): ...
{ "repo_name": "CSUChico-CINS465/CINS465-Fall2017-Lecture-Examples", "path": "day2python.py", "copies": "1", "size": "1028", "license": "mit", "hash": 7501667041130019000, "line_mean": 17.6909090909, "line_max": 92, "alpha_frac": 0.5262645914, "autogenerated": false, "ratio": 2.3962703962703964, ...
a=[[1,2,3,4,5],[1,2,3,4,5],[1,2,3,4,5]] b=[[1,2,3,4],[3,4,5,5]] def convMatrix(a, b, mode='full'): if mode == 'full': row=len(a)+len(b) - 1 col=len(a[0])+len(b[0]) - 1 c= [[0 for i in range(col)] for i in range(row)] for i in range(len(a)): for j in range(len(a[0])): ...
{ "repo_name": "Dengjianping/AlgorithmsPractice", "path": "Misc/convm.py", "copies": "1", "size": "2496", "license": "mit", "hash": -1117267013272603100, "line_mean": 34.1690140845, "line_max": 84, "alpha_frac": 0.405849359, "autogenerated": false, "ratio": 2.8428246013667424, "config_test": fal...
a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] # pprint (a) # # a2d = [a, a, a, a] # pprint(a2d) # [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], # [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], # [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], # [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]] # # #indexing 2d lists # N =122 # a2d = [ list(range(i*N, i...
{ "repo_name": "JosephJamesDoyle87/software", "path": "tests/test5.py", "copies": "1", "size": "1742", "license": "mit", "hash": -8672902668140046000, "line_mean": 23.2753623188, "line_max": 125, "alpha_frac": 0.543053961, "autogenerated": false, "ratio": 2.422809457579972, "config_test": false,...
a={'1': 2,'3': 4} print(a.get('3')) b = [1, 2] b.extend('hey') b.extend([]) print(b) ada_family = { 'Judith Blunt-Lytton': ['Anne Isabella Blunt', 'Wilfrid Scawen Blunt'], 'Ada King-Milbanke': ['Ralph King-Milbanke', 'Fanny Heriot'], 'Ralph King-Milbanke': ['Augusta Ada King', 'William Ki...
{ "repo_name": "coodoing/udacity-searchengine", "path": "course6_Star1.py", "copies": "1", "size": "2019", "license": "apache-2.0", "hash": -341841668800345340, "line_mean": 42.8913043478, "line_max": 133, "alpha_frac": 0.6087171867, "autogenerated": false, "ratio": 2.827731092436975, "config_te...
a = [1,2,3,4] while a: print(a.pop()) # 4 3 2 1 if []: print("True") else: print("False") # False if [1,2]: print("True") else: print("False") # True # all type of value for example integer, it is also object. print(type(3)) # <class 'int'> a = 3 b = 3 print(a is b) # True. Com...
{ "repo_name": "novemberde/lang-practice", "path": "python3/dataTypeFeature.py", "copies": "1", "size": "1145", "license": "mit", "hash": 60967998261459720, "line_mean": 13.6923076923, "line_max": 59, "alpha_frac": 0.5589519651, "autogenerated": false, "ratio": 2.3559670781893005, "config_test":...
a=[1,2,3] a.append(230) print(a) def explode_list(p,n): result=[] if n==0: return [] else: if p!=[]: for entry in p: k = n # after each loop, just restore the k to n while k>0: result.append(entry) k-=1 ...
{ "repo_name": "coodoing/udacity-searchengine", "path": "course7Ex.py", "copies": "1", "size": "2084", "license": "apache-2.0", "hash": 7702970810344630000, "line_mean": 25.7179487179, "line_max": 78, "alpha_frac": 0.5081573896, "autogenerated": false, "ratio": 2.906555090655509, "config_test": ...
a = 123 b = 'abc' print('{} and {}'.format(a, b)) # 123 and abc print('{first} and {second}'.format(first=a, second=b)) # 123 and abc print(f'{a} and {b}') # 123 and abc print(F'{a} and {b}') # 123 and abc print(f"{a} and {b}") # 123 and abc print(f'''{a} and {b}''') # 123 and abc print(f"""{a} and {b}""") # 12...
{ "repo_name": "nkmk/python-snippets", "path": "notebook/f_strings.py", "copies": "1", "size": "2486", "license": "mit", "hash": 974334587496819100, "line_mean": 13.0451977401, "line_max": 66, "alpha_frac": 0.4951729686, "autogenerated": false, "ratio": 1.9792993630573248, "config_test": false, ...
""" a1emp11.py -- Example of simple update transaction Simple Update of Record given by ISN in File with fields AX, AY, C1 DBID and FNR $Date: 2008-08-22 13:32:56 +0200 (Fri, 22 Aug 2008) $ $Rev: 57 $ """ # Copyright 2004-2008 Software AG # # Licensed under the Apache License, Version 2.0 (the "License"); # you ...
{ "repo_name": "flavio-casacurta/Nat2Py", "path": "Adabas/demo/a1emp11.py", "copies": "1", "size": "1447", "license": "mit", "hash": 6744283283382787000, "line_mean": 20.9242424242, "line_max": 75, "alpha_frac": 0.7083621285, "autogenerated": false, "ratio": 2.977366255144033, "config_test": fal...
a = 1 b = 2 c = 3 nf1 = 1.99 nf2 = 2.87 print nf1 + nf2 class novaClasse(): x = 10 y = 10 def func1(self): return 1 + 1 def func2(self): return self.x + self.y if a > 0: if b > 0: print "hello world" else: print "hello" ' ' 'world' '\"escape\"' c = ...
{ "repo_name": "brenolf/python-to-c", "path": "teste/ok/big-code.py", "copies": "1", "size": "1289", "license": "mit", "hash": -1116310325815253900, "line_mean": 13.988372093, "line_max": 86, "alpha_frac": 0.3840186191, "autogenerated": false, "ratio": 2.851769911504425, "config_test": false, ...
a = 1 if a: print("True") else: print("False") # True if 0: print("True") else: print("False") if "": print("True") else: print("False") if []: print("True") else: print("False") if (): print("True") else: print("False") if {}: print("True") else: print("False") # False False ...
{ "repo_name": "novemberde/lang-practice", "path": "python3/controlStatement.py", "copies": "1", "size": "1153", "license": "mit", "hash": -2362008325936123400, "line_mean": 13.425, "line_max": 47, "alpha_frac": 0.5238508239, "autogenerated": false, "ratio": 2.5452538631346577, "config_test": fa...
a = 1 result = 'even' if a % 2 == 0 else 'odd' print(result) # odd a = 2 result = 'even' if a % 2 == 0 else 'odd' print(result) # even a = 1 result = a * 2 if a % 2 == 0 else a * 3 print(result) # 3 a = 2 result = a * 2 if a % 2 == 0 else a * 3 print(result) # 4 a = 1 print('even') if a % 2 == 0 else print('odd') #...
{ "repo_name": "nkmk/python-snippets", "path": "notebook/conditional_expressions.py", "copies": "1", "size": "1444", "license": "mit", "hash": -7078073800931998000, "line_mean": 17.05, "line_max": 75, "alpha_frac": 0.5789473684, "autogenerated": false, "ratio": 2.5069444444444446, "config_test":...
A = 20.0 def __calculate_extrs(alist): tgS = [ (0, 0.0) ] for i in range(1, len(alist)-1): m_l = alist[i-1].m m = alist[i].m m_r = alist[i+1].m g_l = alist[i-1].g g = alist[i].g g_r = alist[i+1].g dM_l = float(m - m_l) dG_l = float(g - g_l) ...
{ "repo_name": "victor-yacovlev/parca", "path": "python/parca/_util.py", "copies": "1", "size": "5371", "license": "mit", "hash": 7624221201117107000, "line_mean": 29.1741573034, "line_max": 75, "alpha_frac": 0.4075591138, "autogenerated": false, "ratio": 3.323638613861386, "config_test": false,...
a = [2,1,-4,3,0,6] a.sort() print a b = "rksdubtheynjmpwqzlfiovxgac" print sorted(b,None,lambda x: ord(x)) c = [2,1,-4,3,0,6] print sorted(c) print sorted(c, lambda x, y: y - x); class Test: def __init__(self, id, value): self.id = id self.value = value def __repr__(self): return "id: "...
{ "repo_name": "ArcherSys/ArcherSys", "path": "skulpt/test/run/t488.py", "copies": "1", "size": "1161", "license": "mit", "hash": -134992657396039360, "line_mean": 20.1272727273, "line_max": 125, "alpha_frac": 0.5857019811, "autogenerated": false, "ratio": 2.3313253012048194, "config_test": true...
# a**2 + b**2 = c**2 # a + b + c = 1000 # a < b < c import time class BreakOut(Exception):pass start = time.time() try: for a in xrange(1,1000): for b in xrange(1, 1000): for c in xrange(1,1000): if (a+b+c==1000): if (a**2+b**2==c**2): ...
{ "repo_name": "jamtot/PyProjectEuler", "path": "9 - Special Pythagorean triplet/tripthag.py", "copies": "1", "size": "1961", "license": "mit", "hash": 7943153303065229000, "line_mean": 22.3452380952, "line_max": 65, "alpha_frac": 0.4375318715, "autogenerated": false, "ratio": 2.8420289855072465, ...