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 |
|---|---|---|---|---|---|---|---|---|---|---|
d17101b0f082359919c91c178c0e58b7e6cabba2 | Yoo-an/Algorithm | /Dynamic Programming/11726 - 2xn 타일링.py | UTF-8 | 666 | 3.9375 | 4 | [] | no_license | # 문제
# 2×n 크기의 직사각형을 1×2, 2×1 타일로 채우는 방법의 수를 구하는 프로그램을 작성하시오.
#
# 아래 그림은 2×5 크기의 직사각형을 채운 한 가지 방법의 예이다.
#
#
#
# 입력
# 첫째 줄에 n이 주어진다. (1 ≤ n ≤ 1,000)
#
# 출력
# 첫째 줄에 2×n 크기의 직사각형을 채우는 방법의 수를 10,007로 나눈 나머지를 출력한다.
#점화식: D(n) = D(n-2) + D(n-1)
def cal(n):
answer[1] = 1
if n>=2:
answer[2] = 2
for i in r... | true |
91e81e45b330a1f1beba23190a0a352f7cda63bd | carlsfg/semestrei | /sums.py | UTF-8 | 698 | 3.828125 | 4 | [] | no_license | def sum2():
print x + y
def sum3():
print x + y + z
def sum4():
print x + y + z + a
def sum5():
print x + y + z + a + b
def sum6():
print x + y + z + a + b + c
def sum7():
print x + y + z + a + b + c + d
def sum8():
print x + y + z + a + b + c + d + e
def sum9():
print x + y + z + a + b ... | true |
3fce3c7f2b3d96c32215e4f4e19d2e1ba6f8ad0c | chloelikescats/beautifulsoup-link-text-ex | /beautifulsoup.py | UTF-8 | 591 | 3.078125 | 3 | [] | no_license | #Import BeautifulSoup
from bs4 import BeautifulSoup
#import requests
import requests
#Url as variable so it can easily be changed
url = "https://sfbay.craigslist.org/search/zip"
#Get page content
page = requests.get(url)
#covert to text
data = page.text
#Parse page text using html.parser (another parser could also ... | true |
454841aee19c6f013c9900c4351792f5bee5957f | syurskyi/Python_Topics | /070_oop/001_classes/_exercises/_templates/Learning Python/026_005_The Worlds Simplest Python Class.py | UTF-8 | 1,617 | 3.84375 | 4 | [] | no_license | class rec: pass # Empty namespace object
rec.name = 'Bob' # Just objects with attributes
rec.age = 40
print('#' * 22 + ' Like a C struct or a record')
print(rec.name) # Like a C struct or a record
x = rec() # Instances inherit class names
y = rec()
print('#' ... | true |
f36850bd85e73122965a059308316be46fd20c38 | mucheniski/python-for-data-science | /module1/Strings.py | UTF-8 | 832 | 4.15625 | 4 | [] | no_license | name = str("Diego Mucheniski")
print(name[0])
print(name[4])
# Last element is index -1
print(name[-1])
print(name[-2])
# Combine string
print(name[1:4])
# Only second variables
print(name[::2])
print(len(name))
print(name + " it's me")
print(3*name)
print("Test \n new line")
print("Test \... | true |
16d9b33f3f18a0ff305a582ccb39a52b7bc2e44a | kwangaroo/softdevhw | /misc/dec3.py | UTF-8 | 3,230 | 2.953125 | 3 | [] | no_license | gov '16
2/9 how well do the values held by society + gov't reflect mine as an individual?
our value rankings represent my views. tweitsj?
more or less. i think tolerance of others should trump freedom of speech, and i feel very strongly and for no particular reason that.
2/10 why is the rule of law not men so im... | true |
bbcb5d333674e28590f33dacacdd033e3d7ce354 | meprogrammerguy/pyBlitz | /pyBlitz.py | UTF-8 | 10,292 | 2.75 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import os.path
import json
from urllib.request import urlopen
from bs4 import BeautifulSoup
import html5lib
import pdb
from collections import OrderedDict
import re
import settings
def findTeams(first, second, dict_stats, verbose = True):
teama = {}
teamb = {}
for item in dict_stat... | true |
684117e37c1b54fdab318f1a022f2436d9846dc9 | aviturm/python | /מטלה 2/312556491Ch03Qu02.py | UTF-8 | 1,371 | 3.609375 | 4 | [] | no_license | #note - Idan Roth (PhD) authorised usage of functions that were not in class yet, such as lists
# Ohad Ezer - 207439043
# Aviad Turm - 312556491
import turtle
OFFSET = 500
BOARD_WIDTH = 7
BOARD_HIGHT = 6
RADIUS = 50
turtle.speed(0)
turtle.hideturtle()
#sub-function convert the grid number (1-8 col and 1-7... | true |
e0da3d260cb0e36097a241f923b7489b62b237be | Asingjr2/djangs_deli | /backendDeli/store/models.py | UTF-8 | 1,778 | 2.625 | 3 | [] | no_license | from django.db import models
from django.core.validators import MaxValueValidator, MinValueValidator
from django.contrib.auth.models import User
from base.models import BaseModel
SPICE_LEVEL = (
("BLAND", "BLAND"),
("MILD", "MILD"),
("HOT", "HOT"),
("INFERNO", "INFERNO" ),
)
class Dish(BaseModel):
... | true |
b9edcfbfcf20d36932559279bfa50e784f372b16 | wheejinv/python_tutorial | /src/ch02_02_variable.py | UTF-8 | 278 | 3.875 | 4 | [] | no_license | # 파이썬
# 기본 선언
m = n = 700
print(n) # 700
print(type(n)) # <class 'int'>
# Object References
# 타입에 맞는 오브젝트 생성
print(id(n)) # 4347363792
print(id(m)) # 4347363792
m = 300
print(id(m)) # 4564092032 (따로 대입을 해야 id가 갈림)
| true |
f21c39db26ac6f9eab3fd13253d3eac4188bd6f9 | warbear0129/Bollinger-Bot | /algorithms.py | UTF-8 | 1,772 | 2.90625 | 3 | [] | no_license | import pandas as pd
from utils import *
class Bollinger(object):
def __init__(self, config):
self._long_margin = config["longmargin"]
self._short_margin = config["shortmargin"]
self._bb_length = config["bb_length"]
self._bb_std = config["bb_std"]
def _get_bb(self, chart_Data):... | true |
61bee3844bf8fee236a02c976b9266900087dd8d | XavierCarty95/python- | /loops.py | UTF-8 | 91 | 2.984375 | 3 | [] | no_license |
count = 0
while count < 10:
print count
count += 1
if count > 3:
print "how" | true |
307b974dabfe55e90c951b478c932958c2f2f1dc | angOneServe/MyPython100days | /day07/验证码.py | UTF-8 | 959 | 2.96875 | 3 | [] | no_license | from PIL import Image,ImageDraw,ImageFont
import random
def GetChar():
return chr(random.randint(48,90))
def GetColor(Bg=False):
if Bg==True:
return (random.randint(30,255),random.randint(30,255),random.randint(30,255))
else:
return (random.randint(0,250),random.randint(0,250),random.randint... | true |
07d588a9155f9ac3bcb6ef9e115c5a5abbdff093 | SabinaZolnowska/JezykPython | /zestawyZadan/zestaw3/zd3.10.py | UTF-8 | 3,874 | 3.203125 | 3 | [] | no_license | #-*- coding: utf-8 -*-
#Stworzyć słownik tłumaczący liczby zapisane w systemie rzymskim (z literami I, V, X, L, C, D, M) na liczby arabskie
#(podać kilka sposobów tworzenia takiego słownika). Mile widziany kod tłumaczący całą liczbę [funkcja roman2int()].
D1={"I":1,"V":5,"X":10,"L":50,"C":100,"D":500,"M":1000}
D2=d... | true |
1d9d49d8ba5895a022f3a80ff48a6ae3d16f2a0e | Sean-Griffith/discord-bot | /cogs/base/runescape_base.py | UTF-8 | 6,226 | 2.734375 | 3 | [
"MIT"
] | permissive | import discord
import datetime
import os
def lookup_item_name(item_name):
match = None
with open("cogs/base/data/tms_names.txt") as valid_names_file:
valid_names = valid_names_file.readlines()
for valid_name in valid_names:
if(valid_name[:-1].low... | true |
0866a1c55b9d4bee836ea432f0db1a2a97aea4a0 | ExoJulia/SysSimExClusters | /plotting/ExoplanetsSysSim_functions.py | UTF-8 | 105,566 | 2.75 | 3 | [] | no_license | # To import required modules:
import numpy as np
import time
import sys
import matplotlib
import matplotlib.cm as cm #for color maps
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec #for specifying plot attributes
from matplotlib import ticker #for setting contour plots to log scale
import scipy... | true |
bf95d8566eedb878603dd334d6e8a0d1a58fc5db | ojhaanshu87/data_structures | /LinkList_Archive/reverse_element.py | UTF-8 | 520 | 3.875 | 4 | [] | no_license | class Node:
def __init__(self, data):
self.val = data
self.next = None
class LinkedList:
def __init__(self):
self.head = None
def push_elem (self, new_data):
new_val = Node(new_data)
new_val.next = self.head
self.head = new_val
def print_elem (self):
temp = self.head
while (temp):
print temp.v... | true |
a464d858cab512b826a123520c746436c6d3d3c0 | yefei/jiango | /jiango/serializers/yaml.py | UTF-8 | 1,237 | 2.53125 | 3 | [] | no_license | """
YAML serializer.
Requires PyYaml (http://pyyaml.org/), but that's checked for in __init__.
"""
from __future__ import absolute_import
import yaml
from cStringIO import StringIO
from django.db.models import Model
from django.db.models.query import QuerySet, ValuesQuerySet
from django.core.serializers.pyyaml import ... | true |
77f74d135e821bcdca56d475cb46d85d3d79bb57 | bharatreddy/thelogs | /scripts/listedStocks.py | UTF-8 | 3,517 | 3.125 | 3 | [] | no_license | class GetListedStocks(object):
"""
A class to get all the listed stocks in NSE and BSE.
Right now I'm getting data from rediff.
"""
def __init__(self):
import string
import mysql.connector
# set up connections to the DB
self.conn = mysql.connector.Connect(host='local... | true |
81e796aa1022bc9a564e815dded9c61a20e46f01 | vishaalgc/codes | /Strings/str-str.py | UTF-8 | 1,365 | 3.21875 | 3 | [] | no_license | def strStr(haystack, needle):
"""
:type haystack: str
:type needle: str
:rtype: int
"""
def lpsArr(A):
lps = [0]
n = len(A)
i = 1
leng = 0
while i < n:
if A[i] == A[leng]:
leng+=1
lps.append(leng)
... | true |
9acfd7b625e742bfcb7b86545c4d3888349826ff | AdamZhouSE/pythonHomework | /Code/CodeRecords/2435/60846/248971.py | UTF-8 | 315 | 2.765625 | 3 | [] | no_license | line=[int(x) for x in input().split()]
wordNO=line[0]
queryNO=line[1]
words=[]
for i in range(wordNO):
words.append(input())
for i in range(queryNO):
line=[int(x) for x in input().split()]
start=line[0]
end=line[1]
wordsSubset=words[start-1:end]
wordsSubset.sort()
print(wordsSubset[-1]) | true |
7e5146b28e3c46705e26e96ba9fad519d531370f | Sage-Bionetworks/schematic | /schematic/configuration/configuration.py | UTF-8 | 6,996 | 2.9375 | 3 | [
"MIT"
] | permissive | """Configuration singleton for the Schematic Package"""
from typing import Optional, Any
import os
import yaml
from schematic.utils.general import normalize_path
from .dataclasses import (
SynapseConfig,
ManifestConfig,
ModelConfig,
GoogleSheetsConfig,
)
class ConfigNonAllowedFieldError(Exception):
... | true |
1ee8539bb2f404133719ce8c970e0d579acfbb85 | Playfloor/Educational | /Python/HackerRank_Algorithms_Mini_Max_Sum.py | UTF-8 | 919 | 4.0625 | 4 | [] | no_license | # Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers. Then print the respective minimum and maximum values as a single line of two space-separated long integers.
# Input Format
# A single line of five space-separated integers.
# Const... | true |
43a4141dc9211040b01a6d556d8f39516ea2a10d | Pangpang2/Python | /learnpy/tool/lookup.py | UTF-8 | 1,283 | 3.015625 | 3 | [] | no_license | import re
import optparse
import os
def Main():
parser = optparse.OptionParser("usage %prog -w <word> -f <file>")
parser.add_option('-w', dest='word', type='string', help='specify a world to search for')
parser.add_option('-f', dest='fname', type='string', help='specify a file to search')
options, args... | true |
65ea3eb1b3f5e24affbf878d5eb6d544f0e7b8da | jforbis/make-that-bread | /.history/app_20210418234030.py | UTF-8 | 1,845 | 2.640625 | 3 | [] | no_license | from flask import Flask, render_template, redirect, jsonify, request
from StockData import get_tickers
from MachineLearning import predict_price
from test import test
from predict_2 import make_prediction
from pprint import pprint
import json
import ast
import yfinance as yf
import datetime as dt
from datetime import d... | true |
293bc9c3609c4b5b7f1c496438e1283d7c004e0c | sunoru/mm2015 | /src/vehicle/convert_data.py | UTF-8 | 1,624 | 2.609375 | 3 | [] | no_license | # coding=utf-8
import codecs
import os
from vehicle.bases import cities, data_dir
from vehicle.data_process import init_geo_data, init_path_data, save_data
import numpy as np
def export_data(area):
data_file = os.path.join(data_dir, "%s.CSV" % area)
geo_data = init_geo_data(area)
path_data = in... | true |
e16d6d7780063220e34c2bfe924ea4c9314f2639 | iryabuhin/proictis_bot_v2 | /content/schedule.py | UTF-8 | 2,314 | 2.875 | 3 | [] | no_license | import ujson
from exceptions import ScheduleResponseFormatException,\
ScheduleNoEntriesFoundException, \
ScheduleUnknownErrorException, \
ScheduleMultipleChoicesException
from typing import List, Dict, Tuple, AnyStr, Union
class ScheduleResponseBuilder:
def __init__(self, data: Dict):
self.dat... | true |
5058275002cb5231edbab8d07927839ae6a9a5af | KaappoRaivio/wordamentcrack | /netmaker.py | UTF-8 | 1,252 | 3.375 | 3 | [] | no_license |
from collections import defaultdict
import pprint
_input = [
["A", "B", "C", "D"],
["E", "F", "G", "H"],
["I", "J", "K", "L"],
["M", "N", "O", "P"],
]
graph = {}
neighbors = {(1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1)}
# print(_input)
for i_y, y in enumerate(_input):
f... | true |
ea1372acd61bb6fa8e1d6ba530134d90e48ad50c | jcate6/Bitcoin-fdac17 | /Transaction_graph/main.py | UTF-8 | 814 | 3.0625 | 3 | [] | no_license | # Using python 2.7
import data_tools as dt
import graph_tools as gt
# initial block hash
block_hash = "0000000000000000002ba18935b6e5e2945a1558b24633ff520045995c736f92"
# generate CSV data for three blocks up to the above hash
dt.build_entire_csv(block_hash, "data.csv", num_blocks=3)
# initialize transaction graph o... | true |
e83905f1f91adcb9aad73eb70b8c464a6d5ffce2 | panholt/sparkpy | /sparkpy/models/role.py | UTF-8 | 670 | 2.5625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from .base import SparkBase, SparkProperty
class SparkRole(SparkBase):
''' Cisco Spark Role Model
:param \**kwargs: All standard Spark API properties for a Message
'''
API_BASE = 'https://api.ciscospark.com/v1/roles/'
PROPERTIES = {'id': SparkProperty('id'),
... | true |
312a643abc585288f8675b63273f1657ae824cdc | sweet123dream/python | /13.py | UTF-8 | 199 | 3.296875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed May 8 15:19:25 2019
@author: Dell
"""
for i in range(1,10):
for j in range(1,i+1):
print("{}*{}={}\t".format(i,j,i*j),end='')
print("\n") | true |
34e4c40bc292e902cacd943768b71f545e4d8c17 | jacobyam/NHL-Stats-Scraper | /NHLStatsScraper/NHLScraper/Scraper.py | UTF-8 | 4,382 | 2.578125 | 3 | [] | no_license | '''
Created on Oct 13, 2019
@author: Elite-Intel
'''
import csv
import datetime
import os
import time
from bs4 import BeautifulSoup
import requests
import Constants
from random import randint
DFO = Constants.DFO()
NST = Constants.NST()
NHL = Constants.NHL()
def getRequestWithSleep(URL,PARAMS=[],m... | true |
b492cef2cd8e96d9b1e53612b62c06a9befa0f63 | SR2k/leetcode | /4/253.会议室-ii.py | UTF-8 | 2,690 | 3.421875 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=253 lang=python3
#
# [253] 会议室 II
#
# https://leetcode-cn.com/problems/meeting-rooms-ii/description/
#
# algorithms
# Medium (51.23%)
# Likes: 427
# Dislikes: 0
# Total Accepted: 45K
# Total Submissions: 87.8K
# Testcase Example: '[[0,30],[5,10],[15,20]]'
#
# 给你一个会议时间安排的数组 intervals ,每... | true |
6e0a97fb6d2f29e6fea075141520a3692cc811a4 | AsgerG/Project22 | /midi_data_loader_test.py | UTF-8 | 1,543 | 2.515625 | 3 | [] | no_license | import numpy as np
import mido
import midi_conversion
import os
from time import time, sleep
import numpy as np
import matplotlib.pyplot as plt
from random import randint
from midi_plotter import plot_midi
# lists for saving data
all_midi_2017_np = []
timings = []
path = "/Users/oas/Documents/Deep_learning/Project22/... | true |
003b6fd35000de45d5d9d76c37f7125c72c541df | ZigengFU/INFO6105-Projects | /pro2_lending_club_interest_rate_prediction/Python Codes/Manual 3 ML Models/linear_regression.py | UTF-8 | 3,718 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | from __future__ import division
from sklearn import linear_model as LR
from sklearn.ensemble import RandomForestClassifier
import random
import numpy as np
import pandas as pd
from sklearn import metrics
from sklearn.ensemble import GradientBoostingRegressor
from sklearn.neural_network import MLPClassifier
fro... | true |
c6a172c1a4e1f55fe501095e206e6a299d270cb3 | manasacharyya25/DSA | /Trees/03. Height of Tree.py | UTF-8 | 412 | 3.40625 | 3 | [] | no_license | class Node:
def __init__(self, key):
self.data = key
self.left = None
self.right = None
def height_of_tree(root):
end = "x"
queue = [root, end]
size = -1
while queue:
top = queue.pop(0)
if top == end:
size += 1
if queue:
queue.append(end)
continue
... | true |
bb8ecae84c70beaf13f8ae9c526a2d9366fbe047 | gracewes/DangerRoute | /getDirections.py | UTF-8 | 2,670 | 2.9375 | 3 | [] | no_license | from flask import Flask, jsonify
import requests, json, random
import pandas as pd
from geopy import distance
app = Flask(__name__)
num_months = 47 # number of months in the dataset
secondsThreshold = 120
US_Accidents_Dec19 = pd.read_csv("US_Accidents_Dec19.csv")
data = US_Accidents_Dec19[['Start_Time', 'End_Time', ... | true |
9797a0e7f6e1c72e37390efb965092812e46193f | KornbergFresnel/garage | /src/garage/sampler/utils.py | UTF-8 | 3,440 | 2.5625 | 3 | [
"MIT"
] | permissive | import signal
import time
import numpy as np
from garage.misc import tensor_utils
def rollout(env,
agent,
max_path_length=np.inf,
animated=False,
speedup=1,
always_return_paths=False):
observations = []
actions = []
rewards = []
agent_infos... | true |
7a35164ebd9c7fc574cb4c14d6fa8b2cbe7c9e5e | JamesSilman/python-external-unit-tests | /src/sub_folder/my_class.py | UTF-8 | 122 | 2.984375 | 3 | [] | no_license |
class MyClass:
def __init__(self):
pass
def exampleMethod(self):
print("Running my example method")
return True | true |
5c89c72b2c52a61d6c168c25ca2b33fb3e3ff9a5 | carmenalab/brain-python-interface | /tests/ibmi/ismore/armassist_sim.py | UTF-8 | 4,465 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | '''Test script for ArmAssist and ArmAssistPIController.'''
import time
import numpy as np
from math import sin, cos
import armassist
import matplotlib.pyplot as plt
# constants
pi = np.pi
L1 = armassist.L1
L2 = armassist.L2
cm_to_m = 0.01
m_to_cm = 100.
real_time_plot = True
ftime = 20 # final time of simulation... | true |
76a977c11fe43644c2dc441a3b3e08a63d010485 | hophamtenquang/RecSys | /env/lib/python2.7/site-packages/graphlab/toolkits/classifier/__init__.py | UTF-8 | 1,381 | 3.140625 | 3 | [] | no_license | """
The GraphLab Create classifier toolkit contains models for classification
problems. Currently, we support binary classification using support vector
machines (SVM), logistic regression, boosted trees, neural networks, and nearest
neighbors. In addition to these models, we provide a smart interface that
selects the ... | true |
2348685d846925208c65a92ae8bd791eb3a0cbda | MadSkittles/leetcode | /781.py | UTF-8 | 380 | 3.109375 | 3 | [] | no_license | class Solution:
def numRabbits(self, answers):
from collections import Counter
res, c = 0, Counter(answers)
for k in c:
res += (c[k] // (k + 1) + (c[k] % (k + 1) != 0)) * (k + 1)
return res
if __name__ == '__main__':
solution = Solution()
print(solution.numRabbi... | true |
416b291877ef452f16c54a28cac4f112fd8f7e86 | Helios-Protocol/py-helios-node | /old_tests/core/env-utils/test_get.py | UTF-8 | 751 | 2.640625 | 3 | [
"MIT"
] | permissive | import pytest
from hvm.utils.env import (
get,
)
@pytest.mark.parametrize(
'type,expected',
(
('int', 42),
(int, 42),
('bool', False),
(bool, True),
('string', 'ozymandias'),
(str, 'hannibal'),
('float', 42.0),
(float, 42.0),
)
)
def ... | true |
0b3dcd6d089305b1543a9c00792a761e4c8f66ef | Dimi727/python-api-test | /args_kwargs.py | UTF-8 | 236 | 2.8125 | 3 | [] | no_license | def m_method(arg1,arg2):
return arg1+arg2
def ultra_method(*args): ## args Anna
return sum(args)
def kwargs(*args,**kwargs): #keyword args location="UK"
print(args)
print(kwargs)
kwargs(name="Test", location="UK") | true |
e139f55e0abd9cab7d6765aa73481e85ab9a7c5b | baylagas/py-parcial-q3-2020-final | /clave_C/clave_c_modif.py | UTF-8 | 4,373 | 3.71875 | 4 | [] | no_license | import math
"""
***************************************************************
@@ ejercicio 1 @@
un metodo python que haga la multiplicacion de 2 numeros
2*4 = 8
"""
# start-->
def multiplicar(num1, num2):
return num1 * num2
"""
***************************************************************
@@ ejercicio 2 @@... | true |
40a4f0962184bd52ea925b85af2dc6943743af53 | 00-ab/willows | /stories/ds_2p.py | UTF-8 | 1,761 | 3.125 | 3 | [
"Unlicense"
] | permissive | from __future__ import print_function # something in dd_console requires this, so I use it throughout
import json # packing and unpacking tasks throughout
import rules.dr_default as rules # This module contains the rules
import display.dd_console as display # This module prints the game in a python console
# MODULE SE... | true |
e119b9c6e130d39642e83e5238a6a700c5aeeff6 | mdegregori1/Graphs | /lecture/day_3.py | UTF-8 | 235 | 2.546875 | 3 | [] | no_license | print('test day_3')
# print the connected components?
# ref number?
islands = [[0,1,0,1,0],
[1,1,0,1,1],
[0,0,1,0,0],
[1,0,1,0,0],
[1,1,0,0,0]]
Counter = 3
def island_counter(matrix):
| true |
e23da1370488985e1914c3f8ef0c54575d1bbee0 | antonylu/leetcode2 | /Python/350_intersection-of-two-arrays-ii.py | UTF-8 | 2,168 | 3.84375 | 4 | [] | no_license | """
https://leetcode.com/problems/intersection-of-two-arrays-ii/description/
Given two arrays, write a function to compute their intersection.
Example:
Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2].
Note:
Each element in the result should appear as many times as it shows in both arrays.
The result can be... | true |
816482999dd68429898d05a8b58652c1e93f15ee | trojanosall/Python_Practice | /Daily Coding Problem/Problem#13.py | UTF-8 | 1,767 | 4.28125 | 4 | [] | no_license | # Good morning! Here's your coding interview problem for today.
# This problem was asked by Amazon.
# Given an integer k and a string s, find the length of the longest substring that contains at most k distinct characters.
# For example, given s = "abcba" and k = 2, the longest substring with k distinct characters is "... | true |
84447bf32fd63b94463db8f1115348a022b500cd | sanjeevbanmala/ETL | /Day2/src/pipeline/extrac_using_pandas.py | UTF-8 | 355 | 2.578125 | 3 | [] | no_license | import pandas as pd
from sqlalchemy import create_engine
df=pd.read_json("../../data/employee_2021_08_01.json")
engine = create_engine('postgresql://postgres:password@localhost:5432/car_dealership')
df.to_sql('raw_employee', engine)
#Similarly we can use read_csv and read_xml to directly read the data and insert into ... | true |
294b6ec4735779adc43206f0e600c5b2cb0f0f38 | lokendra1704/LeetCode | /14_LongestCommonPrefix.py | UTF-8 | 581 | 3.234375 | 3 | [] | no_license | class Solution:
def longestCommonPrefix(self, strs):
prefix = -1
if not strs: return ""
minlength = float("inf")
for i in strs:
if len(i) < minlength:
minlength = len(i)
while prefix < minlength - 1:
letter = strs[0][prefix + 1]
... | true |
6b5b192503ddf2a65b7c06e6b85b41ea598d1212 | ValeraSarapas/diving-in-python | /week4/file.py | UTF-8 | 1,375 | 3.34375 | 3 | [] | no_license | import tempfile
import os
import sys
class File:
def __init__(self, path):
self.path=path
os.makedirs(os.path.dirname(path), exist_ok=True)
self.current_line = 0
self.temp_dir = tempfile.gettempdir()
def write(self, string):
with open(self.path, "w+") as f:
... | true |
942bb37ffb00034b6d5e28523b8b57d9663a0a9d | temach/hasher-test | /main.py | UTF-8 | 539 | 3.0625 | 3 | [] | no_license | #!/usr/bin/env python3
import argparse
from pathlib import Path
from pprint import pprint
from hasher import Hasher
parser = argparse.ArgumentParser(
description="Hashes data"
)
parser.add_argument(
'wordfile',
type=Path,
help="path to file with english words"
)
parser.add_argument(
'input',
... | true |
32d1d95d8ba3dde39061d63f4a09c6aa3a0b5a54 | noammansur/GeneticDominoStretch | /breeders.py | UTF-8 | 1,348 | 3.015625 | 3 | [] | no_license | from objects import DominoStretch
from random import randint
import copy
def breed_naive(parent1, parent2, engine):
number_of_tiles = len(parent1.domino_tiles)
gene_a = randint(0, number_of_tiles - 1)
gene_b = randint(0, number_of_tiles - 1)
start_gene, end_gene = sorted([gene_a, gene_b])
first_p... | true |
69d1439057cb0b479020d86b1d7e68f414b52d0f | srz2/ItsSatineBot | /bot.py | UTF-8 | 3,883 | 2.546875 | 3 | [] | no_license | import time
import configparser
from datetime import datetime, timedelta
import praw
import praw.exceptions
boo_SendReply = True
# subreddits_to_monitor = 'Test'
subreddits_to_monitor = 'all'
bot_username = ''
def create_satine_reply_message():
output = ''
output += 'Hey, just want to let you know, '
output +=... | true |
3fa90c317383114b047b3a6cd84f6983c826d87e | naman-gupta99/geektrust-tame-of-thrones | /project/tests/models/test_kingdom.py | UTF-8 | 2,516 | 3 | 3 | [] | no_license | import unittest
from unittest.mock import patch
from main.models.kingdom import Kingdom
from main.utils.ciphers.seasar_cipher_util import SeasarCipherUtil
class KingdomTests(unittest.TestCase):
def test_should_create_correct_object(self):
"""
Should convert to string correctly
"""
... | true |
9ce73abb8423bfd9efeac5453206a5a35a5f0a48 | Suor/sublime-reform | /viewtools.py | UTF-8 | 9,226 | 3.046875 | 3 | [] | no_license | """
A collection of tools to deal with scopes and text in sublime view.
"""
import sublime
ST3 = sublime.version() >= '3000'
try:
from .funcy import *
except ValueError: # HACK: for ST2 compatability
from funcy import *
### Cursor and selection
def cursor_pos(view):
return view.sel()[0].b
def list_curs... | true |
22f6309cd70f20f426ddd7b98bbe80c65118b98d | AristideArnulf/InteractiveVisualizationHierarchicalData | /cpt.py | UTF-8 | 4,322 | 2.59375 | 3 | [] | no_license |
# coding: utf-8
# In[1]:
import numpy as np
import math
from Bio import Phylo
from plotly.offline import download_plotlyjs, init_notebook_mode, iplot
init_notebook_mode(connected=True)
import plotly
p = Phylo.read('Data/long.tre', 'newick')
def yCoordinate(p):
'Sourced from Bio.Phylo._utils'
ter... | true |
cd00fec21bf62d14e987c36539385c102034d82f | Bhaktibj/Python_Programs | /DataStructure/CalenderStack.py | UTF-8 | 704 | 2.859375 | 3 | [] | no_license | from Week2.Utility_ds.utilitis import Cal_Methods
def calender_stack_runner():
"""
THIS METHOD IS USED TO RUN THE CALENDAR
"""
logic_obj = Cal_Methods() # creating object of the method class
try:
month = int(input('Enter Month')) # enter the month number
except... | true |
6e7c5affc0d90803a05addc122d0d75fd26a1fb9 | madokast/pythonLearn | /trasnportCOSY/cosy2trans.py | UTF-8 | 401 | 2.96875 | 3 | [] | no_license |
print('--------COSY2TRANS-----------')
def CD(ang,r,G):
pi = 3.1415926535#pi
BR = 2.43212829958520#magnetic rigidity
halfGap = 0.03
length = ang/180.0*pi
n = G*r/(BR/r)#G*R1/(2.432128299585206/R1)
print('4. '+str(length)+' '+str(ang)+' '+str(n))
CD(9.375,1.0,0.0)
CD(45.0-9.375*2.0,1.0,0.0)... | true |
96207af32583ac1ba8cb01247f5352749f4a298b | sharijamusthafa/luminarpython | /LUMINARPYTHONPRO/PYTHONNETWORKING/clientnew.py | UTF-8 | 2,216 | 2.953125 | 3 | [] | no_license | import socket
client = socket.socket()
client.connect(("localhost",9001))
opt = 0
while opt!=5 :
print("MENU")
opt = int(input("1> LIST DIRECTORY, 2> CHANGE DIRECTORY, 3> DOWNLOAD FILE, 4>DOWNLOAD DIRECTORY 4> EXIT "))
if opt==1:
client.send('listdir:all'.encode('ascii'))
msg = client.rec... | true |
936fe6412ff401c28271b3156661771a50c01d11 | hippke/wotan | /wotan/gp.py | UTF-8 | 4,809 | 2.625 | 3 | [
"MIT"
] | permissive | from __future__ import print_function, division
import numpy
import wotan.constants as constants
from scipy.signal import lombscargle
from wotan.helpers import cleaned_array
def make_gp(time, flux, mask, kernel, kernel_size, kernel_period, robust):
try:
from sklearn.gaussian_process import Gaussi... | true |
632d487c6ebf39de5919d14680e6abbc82879f1d | jaikumarch33git/python_excercise | /algorithms/sorting/insertion_sort.py | UTF-8 | 885 | 4.3125 | 4 | [] | no_license | # Insertion Sort
# This is an in-place comparison-based sorting algorithm. Here, a sub-list is maintained which is always sorted.
# For example, the lower part of an array is maintained to be sorted. An element which is to be 'insert'ed in
# this sorted sub-list, has to find its appropriate place and then it has to be ... | true |
4c75eb110559f17719b6ec7c2f607070e9a567f5 | rodrigorf/filmes-cartaz-json | /sample_docs/beautifulSoup_samples/basicTagAtt.py | UTF-8 | 206 | 3.0625 | 3 | [] | no_license | #1
from bs4 import BeautifulSoup
#2
import urllib.request
#3
soup = BeautifulSoup('<b id="bTag1" class="boldest">Extremely bold</b>',"html.parser")
#4
tag = soup.b
#5
print(tag['class'])
| true |
2507397edbe0fc437c4de07f9a42b226cac78c7a | Frank12350/repl | /1_class-3 .py | UTF-8 | 297 | 3.640625 | 4 | [] | no_license | class Person:
def __init__(self, n, h, w):
self.name = n
self.height = h
self.weight = w
def bmi(self):
b = self.weight / (self.height / 100) ** 2
return b
p1 = Person("Elwing", 175, 75)
print(p1.bmi())
p2 = Person("Bob", 180, 80)
print(p2.bmi()) | true |
45de75359c7593f2fa8a65d5f9ad96f9758d190f | dragona/News-At-Command-Line | /News/helper/TextToSpeech.py | UTF-8 | 3,035 | 2.859375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Permission is hereby granted, free of charge,
to any person obtaining a copy of this software
and associated documentation files (the "Software"),
to deal in the Software without restriction,
including without limitation the rights to use,
copy, modify, merge, publish, distribute, subli... | true |
919681c7ffa536a6365f447b882d0f2a3fc9d8e9 | PriyanGoel/Manthan_Project_Showcase | /guessing_game_computer.py | UTF-8 | 979 | 4.59375 | 5 | [] | no_license | low = 1
high = 1000
print("""Let's play a game!
So, in this game you have to think of a number between {} and {} and I will try to guess your number taking least amount of chances.""".format(low, high))
print("So, now please think of a number between {} and {}".format(low, high))
input("Press enter when you are ready t... | true |
11b133f2953ec9b1dd48a1bc46505c9513aa2dd5 | rheehot/codingtest-2 | /elice-algorithm/행성 조사.py | UTF-8 | 3,065 | 3.59375 | 4 | [] | no_license | def solution(m,n,maps,a,b,c,d):
info = {'S' : 0, 'O' : 0, 'R' : 0}
for i in range((a-1), (c)):
for j in range((b-1), (d)):
info[maps[i][j]] += 1
return list(info.values())
if __name__ == '__main__':
m,n = map(int,input().split())
k = int(input())
maps = [input() ... | true |
a71529b49dfea18e7af99e44ff65625879f47549 | montallban/MountainCart | /ElgibilityTraces.py | UTF-8 | 2,050 | 2.84375 | 3 | [] | no_license | import gym
import random
import numpy as np
from q_learning import QLearning
from pprint import pprint
class ElgibilityTraces(QLearning):
"""
Attempts to solve the mountain cart problem using SARSA.
"""
def __init__(self, environment):
super().__init__(environment)
self.alpha =... | true |
67fab047836129c3f48dd23ff448875ba4316805 | LiShuai1225/aioworkers | /aioworkers/core/interact.py | UTF-8 | 1,052 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | import asyncio
import concurrent.futures
from functools import partial
from threading import Thread
from IPython.terminal.embed import InteractiveShellEmbed
_shell = InteractiveShellEmbed.instance()
def _await(coro, context):
f = concurrent.futures.Future()
async def wrap(coro):
try:
re... | true |
4f5eb53fe54b9035de293be81e8aff41f0a19a03 | dys27/Python_programs | /valid_parentheses.py | UTF-8 | 376 | 3.625 | 4 | [] | no_license | #Check for valid parenthesis
def isValid(s):
dictionary = {'(':')','[':']','{':'}'}
temp=[]
for i in s:
if i in dictionary.keys():
temp.append(i)
elif len(temp)!=0 and (dictionary[temp[-1]]==i):
temp.pop(i)
else:
... | true |
1bda5ba4627b3c0c159c3b00ac036d4af1c70d6d | anilece/Data_Structures | /BINARY_SEARCH_ALG.py | UTF-8 | 677 | 3.9375 | 4 | [] | no_license | import random
def find_it(num,element_list):
#l=low h=high m=middle
l=0
h=len(element_list)
c=0
for i in range(l,h):
m=(l+h)//2
print(m,l,h)
c+=1
if m==num:
break
elif m>num:
h=m-1
l=l
elif m<num:
l=m+1
... | true |
6b2b17f3ff6b07472d7f8ddf300083291f2a2641 | gwtale/onebox-scripts | /mining_user_intent/bin/mining_user_intent_mapper.py | UTF-8 | 10,901 | 2.515625 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding:utf-8 -*-
#
# mining user intent
# @ericyue
#
import time
import sys
import os
import urllib
import urllib2
import re
regx=r"[0-9]{1,4}-[0-9]{1,11}|[0-9]{11}|www|com|net|cn|org|http|\b[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"
skip=re.compile(regx)
all_chinese_str=ur"[\u4e00-\u... | true |
866ad312a90828bc2697b3ee4269c0020a9f208b | geediegram/parsel_tongue | /Olatoye/new_specials/main.py | UTF-8 | 989 | 3.578125 | 4 | [] | no_license | # from Olatoye.new_specials import chatbot, calculator
from Olatoye.functions import exercise
def function_caller():
number = input("Enter your question number: ")
func_dict = {
"1": exercise.max_of_three_numbers(),
"2": exercise.sum_of_numbers(),
"3": exercise.multiple_of_numbers(),
... | true |
ed2208e760793f87824cc2a887ef2e8cdbf86fd9 | Vaetan/pythonEncryption | /PublicKeyCryptography/PublicKeyRead.py | UTF-8 | 489 | 2.671875 | 3 | [] | no_license | from Crypto.PublicKey import RSA
fileName = raw_input("Please enter the file name for the key: ")
print("Reading Key...")
f = open(fileName + '.pem', 'r')
lines = f.read().splitlines()
for line in lines:
# print line
if "Proc-Type" in line:
print("Password required...")
# userPass = raw_input(... | true |
410e4884d5f02cf2346813a19ac56575d200eb48 | mimikrija/AdventOfCode2016 | /python/09.py | UTF-8 | 1,064 | 3.0625 | 3 | [] | no_license | # Day 9: Explosives in Cyberspace
import santas_little_helpers as helpers
import re
compressed_string = helpers.get_input('inputs/09','\n')[0]
def decompress(in_string, is_part_2=False):
first_marker = re.search(r'(\d+)x(\d+)', in_string)
if first_marker:
count, multiply = map(int, first_marker.group... | true |
e058d394b77c7812f18c1c4cb51deb4256c83ac4 | Youngermaster/Learning-Programming-Languages | /Python/randomCodes/09-06-2021-homework/point_9.py | UTF-8 | 73 | 3.328125 | 3 | [
"MIT"
] | permissive | def f(x):
return (x * 5) + 3
for i in range(0, 4):
print(f(i))
| true |
f465f12199b514bfd202e35d9a613dcdab1eaf95 | alexandraback/datacollection | /solutions_5690574640250880_1/Python/mlarocca/minesweeper.py | UTF-8 | 6,252 | 2.8125 | 3 | [] | no_license | '''
Created on 12/apr/2014
@author: mlarocca
'''
from sys import argv
from math import sqrt
from copy import deepcopy
CLICK_MARK = "c"
def read_input(f):
lines = open(f, 'r')
n = int(lines.readline().strip())
for i in xrange(n):
r, c, m = map(int, lines.readline().strip().split(" "))
... | true |
a0a7985c759907c298ab7e3f5aeb778a9757ae13 | colinpollock/project-euler | /util.py | UTF-8 | 301 | 3.046875 | 3 | [] | no_license |
def memoized(func):
memory = {}
def wrapped(*args):
if args in memory:
return memory[args]
ret = func(*args)
memory[args] = ret
return ret
return wrapped
def product(ns):
total = 1
for n in ns:
total *= n
return total
| true |
13997b0e109b26011d80962d043384cf9cee0c44 | JustifiableChaos/user-signup | /main.py | UTF-8 | 3,355 | 2.671875 | 3 | [] | no_license | from flask import Flask, request, redirect, render_template
import cgi
app = Flask(__name__)
app.config['DEBUG'] = True
error_dict = {'user': {'space': 'No spaces allowed!', 'empty': 'Please fill out all required boxes.', 'len': 'This box must be between 2 and 20 characters.',}, 'password': {'space': 'No spaces a... | true |
ec0f56fb93c49d00a0d6448b538438064493b6bf | sidd91/Ublox-Sam-m8q-library- | /verifyAndMap.py | UTF-8 | 2,427 | 2.96875 | 3 | [] | no_license | #Author: Siddharth Chawla
#Revision: v0.0
#About: Python script to verify the location embed in the .jpg file(website.jpg here)
import piexif
import geocoder
from decimal import *
from mapbox import StaticStyle
import sys
import os
map_quest_API_KEY= '<Add token>' #Enter Mapquest API key
map_box_access_token = "<... | true |
1d612afebe03bdf9007a52e5d55e34d0616a3b7a | TomiMan7/PTI | /3000py.py | UTF-8 | 835 | 3.578125 | 4 | [] | no_license | import datetime
def zero():
return "Vasarnap"
def one():
return "Hetfo"
def two():
return "Kedd"
def three():
return "Szerda"
def four():
return "Csutortok"
def five():
return "Pentek"
def six():
return "Szombat"
def number_to_day(argument):
switcher = {
0:zero,
1:one,
2:two,
3:three,
4:four,
5:fi... | true |
929fc1261adf6f4ef42a2b50fd0c16e7df7a7454 | sdLDesigns/Favorite-Movies | /entertainment_center.py | UTF-8 | 1,387 | 3.1875 | 3 | [] | no_license | import fresh_tomatoes
import media
do_the_right_thing = media.Movie("Do The Right Thing",
"Racial tension during on of the hottest days of summer",
"https://upload.wikimedia.org/wikipedia/en/2/22/DO_THE_RIGHT_THING.jpg",
"https://youtu.be/6xXnQwLZzB0")
star_wars = media.Movie("Star Wars",
"The Rebel Alliance works to... | true |
b36a1dc80660ae9c01c9a3578dc792e58a2cbf5e | leepengcheng/lpc-funning | /ansys/post_processing/dataparser.py | UTF-8 | 2,912 | 2.53125 | 3 | [] | no_license | #coding:utf-8
from xml.etree.ElementTree import ElementTree
from collections import defaultdict
from domain import *
from config import *
import numpy as np
class DataParser(object):
"""数据类"""
def __init__(self, fcdb, fxml):
super(DataParser, self).__init__()
self.fcdb = fcdb
self.load... | true |
844e32054aa3d8d35ca77b30372f09db812fd437 | yukai-chiu/CodingPractice | /LeetCode/Explore/Queue & Stack/Keys and Rooms.py | UTF-8 | 495 | 2.875 | 3 | [] | no_license | class Solution:
def canVisitAllRooms(self, rooms: List[List[int]]) -> bool:
if not rooms:
return False
visited = [0 for _ in rooms]
queue = [rooms[0]]
visited[0] = 1
#dfs
while queue:
keys = queue.pop(0)
for k in k... | true |
ddf32430d337a2e402aec55a35a54d9fa19cc22a | fmngg/ping-pong-online | /ball.py | UTF-8 | 1,753 | 3.46875 | 3 | [] | no_license | import pygame
import random
screen_width = 1280
screen_height = 720
win = pygame.display.set_mode((screen_width, screen_height))
class Ball:
def __init__(self, x, y, width, height, color): # ball settings
self.x = x
self.y = y
self.width = width
self.height = height
... | true |
33ef4085d55ba755c342d47d3139635516e9db5f | wh-acmer/minixalpha-acm | /LeetCode/Python/flatten_binary_tree_to_linked_list.py | UTF-8 | 1,236 | 3.390625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
#coding: utf-8
# Definition for a binary tree node
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def _flatten(self, root, parent):
if not root: return []
x = self._flatten(root.left, root)
... | true |
69196b1e8f171179a3ace465cd66a1de407d4f75 | elda27/prepnet | /prepnet/core/astype_converter.py | UTF-8 | 462 | 2.515625 | 3 | [
"MIT"
] | permissive | import pandas as pd
from prepnet.core.column_converter_base import ColumnConverterBase
class AsTypeConverter(ColumnConverterBase):
def __init__(self, dtype):
"""As type converter
"""
self.dtype = None
self.original_dtype = None
def encode(self, xs:pd.Series):
self.orig... | true |
990b006d74e1cd73c5172276d79e500509d2c93d | tmk1363/SpringBoard | /main.py | UTF-8 | 4,474 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[17]:
# text preprocessing modules
from string import punctuation
# text preprocessing modules
from nltk.tokenize import word_tokenize
import nltk
from nltk.corpus import stopwords
from nltk.stem import WordNetLemmatizer
import re # regular expression
import os
from os.path i... | true |
ea62b4dcbfd70e5d60af12378adcfa41cdfc36a7 | abhicse32/8th-Semester | /DataMining/Assignment2/Q1/plot_1_b_ii.py | UTF-8 | 450 | 2.59375 | 3 | [] | no_license | import matplotlib.pyplot as plt
# lpot for 1b_i
lst=[[10 ,21.605417],
[25 ,17.538208],
[75,19.691659],
[100 ,20.952556]]
lst2=[[10, 0.333225],
[25, 1.444862],
[75, 22.277402],
[100, 45.840727]
]
plt.figure()
plt.plot([x[0] for x in lst],[x[1] for x in lst],label="apriori")
plt.plot([x[0] for x in lst2], [x[1] for x i... | true |
fd66beb91326ee4747f62f047a0b42be6f715cf1 | Maninder-mike/100DaysWithPython | /basic/operators.py | UTF-8 | 1,371 | 4.5625 | 5 | [] | no_license | print('Arithmetic Operators')
print('Addition', 1 + 2)
print('Subtraction', 1 - 2)
print('Multiplication ', 2 * 2)
print('Division', 7 / 2)
print('Modulus', 7 % 2)
print('Exponentiation', 2 ** 2)
print('Floor division', 7 // 2)
print('Assignment Operators')
x = 2
print('x=2 =', x)
x += 3
print('x+=3 =', x)
x -= 2
pri... | true |
bae7a638029588d07b164de32590ef33d95fdd38 | tarun-hacker/libhevc-fuzz-exp | /cleaner.py | UTF-8 | 445 | 2.609375 | 3 | [] | no_license | import time
import os
CORPUS_DIR = "corpus"
SEED = "out.h265"
def delete():
base_path = os.path.join(os.getcwd(),CORPUS_DIR)
files = os.listdir(base_path)
for file in files:
file_path = os.path.join(base_path,file)
stat = os.stat(file_path)
if file!=SEED and (time.time()-stat.st_mti... | true |
4de151a8297cc54842c2859dcc6579b607a43e94 | uoayop/study.algorithm | /baekjoon/11053.py | UTF-8 | 451 | 3.28125 | 3 | [] | no_license | # 가장 긴 증가하는 부분 순열
# https://www.acmicpc.net/problem/11053
# dp
import sys
input = sys.stdin.readline
n = int(input())
nums = list(map(int,input().rsplit()))
dp = [1] * n
# dp[i] = 수열의 i번째 요소까지 만들 수 있는 가장 긴 배열의 길이
# i = 0, j=0 / i = 1, j=0,1 / i=2, j=0,1,2 ...
for i in range(n):
for j in range(i):
if num... | true |
4214080befd740bd66448f8b3468e109cfd6182c | SenFuerte/dt211-3-cloud | /Euler/Sol_nr2.py | UTF-8 | 395 | 3.96875 | 4 | [
"MIT"
] | permissive | def fibbo(x): #define a method
if (x == 0): # catch number 0
return 0
elif x == 1: # catch number 1
return 1
else:
return (fibbo(x-1) + fibbo(x-2)) # use the method recursive sothat it calls himself
for z in range(1,1000): #for loop to find the number which is greater then 4kk
if fibbo(z) >= 4000000:
pr... | true |
47f17b69904b37bd23b4e4298433edb8379f4d45 | nypl-spacetime/oldnyc | /ocr/tess/evaluate_ocr.py | UTF-8 | 1,268 | 3.609375 | 4 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
"""Evaluates the performance of an OCR program.
Requires two sets of text files: golden files and run files.
The files are paired up and normalized for whitespace.
The score for each pair is the Levenshtein distance between them divided by the
length of the golden file. These scores are averaged... | true |
046b5a0bcd36d9aace715b5ced0bd9489066868e | YuTian8328/NER-Multilingual-Product | /test_example.py | UTF-8 | 3,193 | 2.59375 | 3 | [] | no_license | import re
import numpy as np
from nltk.tokenize import word_tokenize
from preprocess import prepare_text
from tensorflow.keras.models import load_model
from config import VolumeVec, WeightVec,w2vModel,NUM_TO_TAG
def size_extract_via_regex(text):
'''extract size information from a given text by using regex
'''
... | true |
29b62e83ea96b051d71e7db304fe93b23b13eb74 | rcr095/WarehouseRobot | /yoanna.py | UTF-8 | 19,397 | 3.421875 | 3 | [] | no_license | if robotcolor == 'yellow': #use to detect if it is the first robot then do the rest
if callcolor=='blue': #if the callcolor variable is equal to blue then do the rest
for i in range(543):
for x in range(50): #move robot for 543 x 50 times
x1,y... | true |
f74ecd31dd09180e407dd5cd379e4d9d3195c39d | aravindsagarpa100/API | /red_ttp/unusual_process_path.py | UTF-8 | 1,100 | 2.609375 | 3 | [] | no_license | # Name: Processes in Unusual Paths
# rta: unusual_process_path.py
# ATT&CK: T1158
# Description: Executes processes from the WBEM directory
import os
import common
import sys
def run_from_directory(target_program, directory):
common.log("Running %s out of %s" % (target_program, directory))
temp... | true |
fd9fecec7ce50515305966c91233be1581253b7a | gferragu/cascadia_locking_deformation | /read_model.py | UTF-8 | 2,914 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed May 22 11:24:39 2019
@author: aklimase
"""
import numpy as np
from pyproj import Proj
class path_obj(object):
patchnum = 0
lon= 0
lat = 0
utmx = 0
utmy = 0
z = 0
strike = 0
dip = 0
rise = 0
dur = 0
ss_slip ... | true |
2dd3fbdce1ccc9b5dfaf9f305fb8e5981df190d4 | shy2336155/learn | /information1/config.py | UTF-8 | 1,746 | 2.546875 | 3 | [] | no_license | import logging
from redis import StrictRedis
# 0.自定义项目配置类
class Config(object):
"""项目配置基类"""
# 开启debug模式
DEBUG = True
# mysql数据库配置信息
# mysql数据库链接配置
SQLALCHEMY_DATABASE_URI = "mysql://root:xiaoxiaozi@127.0.0.1:3306/information21"
# 开启数据库跟踪操作
SQLALCHEMY_TRACK_MODIFICATIONS = True
... | true |