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 |
|---|---|---|---|---|---|---|---|---|---|---|
1510dafa084a605731d560d84285299109a2c903 | u1273400/rpynotes | /pytorch/trl/tictactoeGame.py | UTF-8 | 3,034 | 3.296875 | 3 | [] | no_license | import random
class TicTacGame():
def __init__(self):
self.winstates = [
[0, 1, 2],
[3, 4, 5],
[6, 7, 8],
[0, 3, 6],
[1, 4, 7],
[2, 5, 8],
[0, 4, 8],
[2, 4, 6],
]
self.gameState = ["-", "-", "-",... | true |
91ae903abdb0f06c76667e78b3b72182473c6581 | b-janus/BD | /tp4/main.py | UTF-8 | 1,327 | 2.921875 | 3 | [] | no_license |
import sys
import parser
import dependencies as deps
def main():
try:
thefile = sys.argv[1]
except IndexError:
print("Use: python3 main.py 'filename'")
exit(1)
with open(thefile, mode='r') as f:
contents = f.read()
test = parser.Parser(contents)
parsed = test.parse(... | true |
c89619823bfb96603f20b5a0ddbf1504438b25a0 | politecnicomodelopoo2018/Tp1-Ocampo | /Sistema.py | UTF-8 | 1,414 | 2.71875 | 3 | [] | no_license | from Persona import *
from Vuelos import *
from datetime import *
class Sistema(object):
def __init__(self):
self.listPersona = []
self.listVuelos = []
self.listAviones = []
def SetListPerson (self, listPersona):
self.listPersona = listPersona
def SetListVuelos (self, l... | true |
101e615457910c59432a1eb3350d1db009c106a4 | annahiller1992/CompPhylo17 | /Assignment4.py | UTF-8 | 10,100 | 3.53125 | 4 | [] | no_license | #!/usr/bin/env python3
#Anna E. Hiller
#Assignment 4, Week of March 04 2017
"""
Part 1: Define a Markov chain class
- Start with a discrete-state, discrete-time chain
- Be able to run multiple replicates
- Be able to summarize frequencies of states across replicates for particular iterations
- Be able to calculat... | true |
7748500aada1206ffd2ecbfa8b817ada63f4d106 | barton-wa/machine_learning | /linear_regression/data_generate_and_train.py | UTF-8 | 423 | 3.125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from linear_regression import LinearRegression
# np.random.seed(272)
data_size = 3000
x= np.random.uniform(low=1.0,high=10.0,size=data_size)
y = 2.6*x+3.7+np.random.normal(0,1,3000)
# print(x)
# print(y)
# plt.scatter(x,y)
# plt.show()
model = LinearRegression(5000)
w... | true |
f51d581aa014e0c037477817c2005e393d7c18b9 | raymondsums/SI507-Project5 | /SI507project5_tests.py | UTF-8 | 1,654 | 2.75 | 3 | [] | no_license | import unittest
from SI507project5_code import *
class CodeTests(unittest.TestCase):
def setUp(self):
self.photo_dict = tumblr_photo_result
self.p_id = photo_id_list
self.p_timestamp = photo_timestamp_list
self.p_tags = photo_tags_list
self.p_url = photo_url_list
self.p_dims = photo_dimensions_list
self... | true |
7387239a1af53192fb93c6e9229e32df9334c493 | ceashby/url-shortener | /tests/test_encoding.py | UTF-8 | 838 | 3.046875 | 3 | [] | no_license | import unittest
from utils.base_62_encoding import encode, decode
class EncodingTests(unittest.TestCase):
tests = [
(0, '000000'),
(1, '000001'),
(62, '000010'),
(63, '000011'),
(34441886726, 'base62')
]
def test_encode(self):
for num, expected_encoded in E... | true |
fbfa9ed94dde934c0b15fa27a147b234b3abc544 | hilcharge/fattybugs | /scripts/fbdb_build_bug_db | UTF-8 | 1,260 | 2.703125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""Build a new database
"""
import fattybugs
import os
import sys
import getopt
def usage():
usage_str="""USAGE:
Build a database and write the config file
build_db.py [-c CONFIGFILE] DB_FILE
*NOTE* Default CONFIGFILE is "$HOME/.fattybugs
Build a database and don't write the co... | true |
33b183a7c0a20bd49c1a35a28a30080e4ed5e88a | rainpasttime/ExerciseOfPython | /ReverseList/ReverseList.py | UTF-8 | 543 | 3.328125 | 3 | [] | no_license | # -*- coding:utf-8 -*-
#反转链表并输出链表的元素
class Solution:
# 返回ListNode
def ReverseList(self, pHead):
# write code here
iterator_pre = pHead
iterator_mid = pHead.next
iterator_next = pHead.next.next
pHead.next = None
while iterator_mid!=None:
iterator_mid.next ... | true |
c4016ca2f0371826510d3dd36aa1123fe27a0c82 | MTPrime/street_art_classifier | /src/art_collecting.py | UTF-8 | 5,519 | 3.125 | 3 | [] | no_license | """
This script scrapes the Fat Cap website for street art images and saved the images and their meta data.
"""
from bs4 import BeautifulSoup
import requests
import pandas as pd
pd.set_option('display.max_columns', None)
pd.set_option('display.max_colwidth', 1000)
import boto3
import os
from datetime import datetime
... | true |
712d2300a8691927a7a3508cfde5b8036099bb98 | Zezephyrphyr/Location-based-demand-prediction-for-the-NYC-ride-sharing-and-taxi-market | /_FINAL/CODE/1_processing/scrape.py | UTF-8 | 1,162 | 2.859375 | 3 | [] | no_license | import requests
import calendar
from datetime import datetime
import pytz
import csv
YEAR = 2014
API_KEY = '6532d6454b8aa370768e63d6ba5a832e'
for month in range(1,13):
month_range = calendar.monthrange(YEAR, month)
start_date = str(YEAR) + str(month).zfill(2) + '01'
end_date = str(YEAR) + str(month).zfill... | true |
58e4bcf3a6d59b67fb8af7ee3afb9dbe2eb8c5e4 | jasonelhaderi/pypsqueak | /examples/ex_deutsch_jozsa.py | UTF-8 | 3,090 | 3.171875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import context # Remove this import if running with pip installed version.
from pypsqueak.api import qReg, qOracle, qOp
from pypsqueak.gates import X, Z, H
import numpy as np
import sys
# Number of bits in the input bitstring.
if len(sys.argv) > 2 and int(sys.argv[2]) > 0:
n = int(sys.argv[2])
else:
n = 4
o... | true |
a61cf7d91df083f1a102e41964470bac2818f162 | rajeshkbathula/s3_connect_search_get_events | /ConnectGetFilterXML_S3.py | UTF-8 | 4,919 | 2.578125 | 3 | [] | no_license | # Python3 Script will get files from s3 and filters and gets the XML's in specific prefix given
# Rajesh Bathula - 25-06-2020
# copy this module to your path where you want to run and cd module and run
# please make sure you provide right bucket name , prifix and transaction values
import concurrent.futures
import bo... | true |
742181c9be7bacee93276234e00fd77d3cfe20e5 | Textualize/textual | /tests/snapshot_tests/snapshot_apps/notification_through_modes.py | UTF-8 | 560 | 2.828125 | 3 | [
"MIT"
] | permissive | from textual.app import App, ComposeResult
from textual.screen import Screen
from textual.widgets import Label
class Mode(Screen):
def compose(self) -> ComposeResult:
yield Label("This is a mode screen")
class NotifyThroughModesApp(App[None]):
MODES = {
"test": Mode()
}
def compose... | true |
a26f9c3c8ee8d02f68896eb7f58e8db988457ed5 | fairlyoddparents/Python-Tutorials-My-Answers-and-First-Game | /6kyu. sequence_sum.py | UTF-8 | 522 | 3.515625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Jul 16 12:16:00 2018
@author: fairly_oddparents
"""
def sequence_sum(begin_number, end_number, step):
n = 1 + (end_number-begin_number)//step
addition = 0.5*n*(begin_number+end_number)
return addition
print(sequence_sum(2, 6, 2))
#1... | true |
5ea2088d1388dbdd3a1854443ca0269a42b0832d | karthi12ck/caiaptyhon | /exception.py | UTF-8 | 1,873 | 3.328125 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Fri May 31 12:08:41 2019
@author: Training23
"""
#syntax
try:
print("")
except Exception as err:
print(err)
finally:
print("final")
#2
def exception(n,m):
try:
c=n/m
print(c)
except ... | true |
37482677ee9be8c67ae25c8cdc8cbff27e6dc659 | kmmcgarry/SecretSanta | /SecretSanta.py | UTF-8 | 1,532 | 4.0625 | 4 | [
"MIT"
] | permissive | # SECRET SANTA ALGORITHM
import random
def SecretSantaGenerator(file):
# Take in a text file with an array of names with delimiter "|"
inFile = open(file,"r")
people = ""
# Append the names to a list, a list of strings
for line in inFile:
people += line
people = people.split("|")
# W... | true |
1071fb73f6c593c103b433fbf5376d548e21d510 | atotala/Programs | /non_repeatinf_char.py | UTF-8 | 262 | 3.171875 | 3 | [] | no_license | x = input()
char = {}
for i in x:
val = char.get(i)
if val is None:
val = 0
val = val + 1
char[i] = val
for key, values in char.items():
if values == 1:
non_repeat = key
break
print(non_repeat)
| true |
5f25a25248e11f62e18643591665e9cd9c753c6c | hemmelig/2021JB022655 | /figures/figure7/quadtree_phi_measurements.py | UTF-8 | 2,673 | 2.890625 | 3 | [
"CC0-1.0"
] | permissive | # -*- coding: utf-8 -*-
"""
Gridding measurements of fast direction
We grid the measurements of fast direction by sub-gridding where there is an
excess of data. The measurements are assigned to the midpoint between the
station and event.
This script will create a file containing gridded phi values for this study in
a ... | true |
bceca8f3f4d7d44b86e637e444d278525aec57fa | small-cat/myPython | /practise_pycharm/cmsz_python/pro1_markedToken/util.py | UTF-8 | 824 | 3.375 | 3 | [] | no_license | # -*- encoding:utf-8 -*-
def lines(mfile):
"""
iterator
"""
for line in mfile:
yield line
yield '\n'
def blocks(mfile):
"""
yiled return a generator, not a list
but we want a list
"""
block = []
for line in lines(mfile):
if line.strip():
block.... | true |
7ee4e891ec8a688db684ef4d374f2a80f9e0232a | DandanHan91054/batchglm-1 | /batchglm/models/base_glm/simulator.py | UTF-8 | 6,196 | 2.5625 | 3 | [
"BSD-3-Clause"
] | permissive | import abc
import math
import numpy as np
import pandas
import patsy
from typing import Union, Tuple
from .model import _ModelGLM
from .external import _SimulatorBase
def generate_sample_description(
num_observations,
num_conditions: int = 2,
num_batches: int = 4,
shuffle_assignments=... | true |
028c79080dce7ff768094f27035928a2c118ec2d | ZhouyangXie/detectabc | /detectabc/modules/contrib/cspdarknet53.py | UTF-8 | 4,254 | 2.578125 | 3 | [] | no_license | '''
CSPDarkNet
adapted from:
https://github.com/bubbliiiing/yolov4-pytorch/blob/master/nets/CSPdarknet.py
produces 3 tensors and use Mish as activation func
fits input size of (416, 416)
'''
import torch
import torch.nn as nn
from detectabc.modules.functional import Mish
class Ba... | true |
bbff299e90c2dd4a6a591506688d0f2317ca4070 | lordgrenville/cis194 | /wk3/histogram.py | UTF-8 | 595 | 3.84375 | 4 | [] | no_license | # warming up by doing it imperatively. pretty ugly!
bars = []
li = [1, 1, 1, 5]
# each pass through the list counts one of each unique number and then removes
# them, until list is empty
while li != []:
arr = ' '
done = []
for idx, x in enumerate(li):
if arr[x] == ' ':
arr = a... | true |
eb73421363adfb11f429051759aef0b6e39420c7 | andrijr/pythonPWN | /d2_3_loops/d2_loops.py | UTF-8 | 4,729 | 3.6875 | 4 | [] | no_license | # WHILE ELSE
import time
from random import randint, sample, choice
services = ["GitHub", "Google", "Facebook"]
servicesEmpty = []
i = 0
while i < len(services):
print(services[i])
i += 1
else:
print("...services")
i = 0
while i < len(servicesEmpty): # fragment kody wykonywany warunkowo
print(services... | true |
90c383cea4f878ecf7947ec302f4956b31ff52b4 | mpkato/pyNTCIREVAL | /tests/test_usage.py | UTF-8 | 1,906 | 3.109375 | 3 | [
"MIT"
] | permissive | # -*- coding:utf-8 -*-
import pytest
class TestUsage(object):
def test_precision(self):
from pyNTCIREVAL import Labeler
from pyNTCIREVAL.metrics import Precision
# dict of { document ID: relevance level }
qrels = {0: 1, 1: 0, 2: 0, 3: 0, 4: 1, 5: 0, 6: 0, 7: 1, 8: 0, 9: 0}
... | true |
1a6551197a23a4f97c01bfbef9b6deaee5891012 | AlexisEnriquez/PythonProgrammer-Datacamp | /Data Types for Data Science in Python/DataTypesforDataScience.py | UTF-8 | 14,512 | 4.125 | 4 | [] | no_license | # Course 2
# Data Types for Data Science in Python
# Create a list containing the names: baby_names
baby_names = ['Ximena','Aliza','Ayden','Calvin']
# Extend baby_names with 'Rowen' and 'Sandeep'
baby_names.extend(['Rowen','Sandeep'])
# Print baby_names
print(baby_names)
# Find the position of 'Aliza': ... | true |
0873dcce4f99dba264849cf7a1bfc16893a2da50 | Miguel-Caringal/CHCIProgrammingClub | /Challenge of the Week/week 3/hard/Victor Wei.py | UTF-8 | 382 | 3.53125 | 4 | [] | no_license | n = int(input())
a1 = str(input())
a1 = a1.split(" ")
a2 = str(input())
a2 = a2.split(" ")
pairs = []
for i in range(0, n):
pairs.append({a1[i], a2[i]})
good = True
for i in range(0, len(pairs)):
counter = 0
for j in range(0, len(pairs)):
if pairs[i] == pairs[j]:
counter += 1
if counter != 2:
... | true |
a0e8bd7e6f3c40fbd2e22d26677b08a7a196b1e4 | Sakshi1504/Python | /largest and smallest int, long, float.py | UTF-8 | 108 | 2.75 | 3 | [] | no_license | import sys
print("Float: ", sys.float_info)
print("Int: ", sys.int_info)
print("Maxm int: ", sys.maxsize) | true |
31af0866c2d19aba9dcb50da8056a62015387a36 | TalAmuyal/py_gaming | /pyxel_games/ping_pong/src/grid_drawer.py | UTF-8 | 2,303 | 3.203125 | 3 | [] | no_license | import pyxel
WINDOW_WIDTH = 255
WINDOW_HEIGHT = 255
AXIS_ROOT_X = WINDOW_WIDTH / 2
AXIS_ROOT_Y = WINDOW_HEIGHT / 2
def clear_screen():
pyxel.cls(7)
def draw_point(x, y, color=8):
true_x = AXIS_ROOT_X + x
true_y = AXIS_ROOT_Y - y
pyxel.circ(
true_x,
true_y,
r=1,
col... | true |
eab64984ac906d469d1fc35c04ee1e03d308a0dc | Perverseq/test_web | /lib/pages/base_page.py | UTF-8 | 1,744 | 2.59375 | 3 | [] | no_license | from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import *
import traceback
class BasePage(object):
locators_dictionary = {
"ru.investing.com": "https://ru.investing.com/"}
def __init__(self, contex... | true |
d4c25f363d328eb5ecf734052eae12c0ead8be23 | jwayne/mol455 | /codemlp/subsampleFasta.py | UTF-8 | 1,242 | 2.546875 | 3 | [
"MIT"
] | permissive | import os, sys, random
from Bio import SeqIO
if __name__ == '__main__':
#check for legal number of args
# if len(sys.argv) != 5:
# sys.exit("expect cmd args: python %s <seq.dna.fasta> <seq.aa.fasta> num_seqs output_name" % sys.argv[0])
if len(sys.argv) != 6:
sys.exit("expect cmd args: python %s <... | true |
e4e2aab763bbc7ab65399d440c174c1e25573088 | s724959099/py_pattern_note | /StructuralPattern/decorator.py | UTF-8 | 281 | 3.25 | 3 | [] | no_license | def try_catch(fn):
def wrapper(*args, **kwargs):
try:
return fn(*args, **kwargs)
except Exception as e:
print(str(e))
return wrapper
@try_catch
def error_func():
print("error")
raise Exception("i am error")
error_func()
| true |
63eda6694bb6cdeede4975c571fa9b5ba6ede634 | ThanhNguyen93/medical_device_recall | /1_data_collection/web_extraction/maude_data_cleaning.py | UTF-8 | 3,852 | 2.703125 | 3 | [] | no_license | def COMBINED_CSV():
'''combine all csv files within a folder'''
extension = 'csv'
all_filenames = [i for i in glob.glob('*.{}'.format(extension))]
print('check file names: ', all_filenames)
#combine all data
combined_csv = pd.concat([pd.read_csv(f) for f in all_filenames ]).reset_index(drop=True)
return combine... | true |
6979ca979bf76022e0eebe2f8a4136ba25c85317 | Arabicsource/mdb2kirtass | /mdb2kirtass/add_item.py | UTF-8 | 269 | 2.65625 | 3 | [] | no_license | from lxml import etree
def add_item(tree, root_id, item_name, item_id):
tree = etree.parse(tree)
root = tree.find(".//root[@id='{}']".format(root_id))
etree.SubElement(root, 'Item', {'Name': item_name,
'id': item_id})
return tree
| true |
4111adcb06134d32e87809ddee010a1f0b763dd6 | ClockworkNet/OpScripts | /opscripts/logging/v2.py | UTF-8 | 2,778 | 2.59375 | 3 | [
"MIT"
] | permissive | # vim: set fileencoding=utf-8 :
"""OpScripts logging library
"""
# Standard Library
from __future__ import absolute_import, division, print_function
import logging
import logging.handlers
import sys
class OpScriptsLogging(object):
"""OpScripts logging wrapper.
"""
def __init__(self, program_name, log_l... | true |
c81d43b00a0577a46c2153dfbbcf0cd0132b89af | jvineis/my_sequence_utilities | /mu-unique_table.py | UTF-8 | 338 | 2.859375 | 3 | [] | no_license | #!/bin/usr/env python
import sys
infile = open(sys.argv[1], 'rU')
dict_out = {}
for line in infile:
x = line.strip().split("\t")
dict_out[x[0]] = x[0:len(x)]
outfile = open(sys.argv[2], 'w')
for key in dict_out.keys():
outfile.write(dict_out[key][0]+"\t"+dict_out[key][1]+"\t"+dict_out[key][2]+"\t"+dict_... | true |
df77732d5dce0000ea66708a4dc96a1b92f1ae54 | awesumrit/CS663-Assignment | /assignment-1-transformations/2/codes/myHM.py | UTF-8 | 3,075 | 2.8125 | 3 | [] | no_license | import numpy as np
from matplotlib import pyplot as plt
from PIL import Image
def get_cdf(img):
img = img.reshape(-1)
img = img[np.where(img>=0)]
pdf = np.histogram(img, 256, (0, 256))[0] / (len(img))
cdf = pdf.cumsum()
cdf = 255 * (cdf - cdf.min())/(cdf.max() - cdf.min())
cdf = cdf.astype(np.... | true |
1fb56bde3b75436c6c477e6d1ca2cc63e3fd6cf7 | robotics-4-all/tektrain-robot-sw | /pidevices/mcp23017.py | UTF-8 | 6,633 | 2.84375 | 3 | [
"MIT"
] | permissive | """mcp23017.py"""
from .mcp23x17 import MCP23x17
from sys import maxsize
import sys
import atexit
import time
import threading
class MCP23017(MCP23x17):
"""Class representing mcp23017 chip
Args:
bus (int): The i2c bus
address (int): The hardware defined address of the module.
"""
... | true |
120590a8ce1faed45b689fa393407b588dedc902 | sponrad/projecteuler | /42 done.py | UTF-8 | 1,335 | 4.09375 | 4 | [] | no_license | '''
The nth term of the sequence of triangle numbers is given by, tn = ½n(n+1); so the first ten triangle numbers are:
1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...
By converting each letter in a word to a number corresponding to its alphabetical position and adding these values we form a word value. For example, th... | true |
26cca05db424b23ba3836c0a7f59890f20241d10 | nicholsonjb/PythonforEverybodyExercises | /Data 620 Assignments/Assignment8.2-score.py | UTF-8 | 1,409 | 4.46875 | 4 | [] | no_license | #Data 620 Asssingment 8.2 Python Score
#Severance Chapter 3 - Exercise 3 – ASSIGNMENT
# Written by James Nicholson
# Last Updated March 27, 2019
# Write a program to prompt for a score between 0.0 and
#1.0. If the score is out of range, print an error message. If the score is
#between 0.0 and 1.0, print a grade using t... | true |
31b6c21e66dc92a8842b127d0d213f12f279362c | crbanala/solarflaredetection | /main.py | UTF-8 | 5,325 | 2.734375 | 3 | [] | no_license | import numpy as np
#function declarations
def sigmoid(s):
return 1/(1+np.exp(-float(s)));
#function to print the accuracy
def print_accuracy(weights,X,Y,candidate_weights):
#for val in weights:
#print val;
for o in range(0,len(weights)):
sum = 0.00;
for i in range(0,len(X)):
arr = [];
for j in ran... | true |
47734ff2be53036db065302eda1ac2858f9cff09 | wonbeomjang/kaggle | /diabetic-retinopathy-detection/models.py | UTF-8 | 2,519 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | import torch
import torch.nn as nn
from torchvision.models.resnet import resnet50
from tqdm import tqdm
from utils import AverageMeter
class Model(nn.Module):
def __init__(self):
super(Model, self).__init__()
self.net = resnet50(pretrained=True)
num_features = self.net.fc.in_features
... | true |
0333f5ef88f62a7167d4e3c9b336bb2d077bffae | SirojiddinSaidmurodov/CyberSecurityBasics | /RSA/Additional/prime.py | UTF-8 | 909 | 2.8125 | 3 | [] | no_license | import random
import RSA.Additional.quick_exp as exp
def is_prime_trial_division(n: int) -> bool:
if n == 2:
return True
if n % 2 == 0:
return False
for i in range(3, int(pow(n, 0.5)), 2):
if n % i == 0:
return False
return True
def is_prime_mr(n: int, rounds: in... | true |
10c5e54e3eb661272a6693f9a94ec72b58c18556 | xiang-fan/OthelloGame | /gui.py | UTF-8 | 12,503 | 3.3125 | 3 | [] | no_license | from tkinter import *
from math import *
from time import *
from random import *
from copy import deepcopy
from moves import *
from game_canvas import *
SIZE = 8
WHITE = 0
BLACK = 1
nodes = 0
depth = 5
GRID_ROW = 450
GRID_COLUMN = 50
class GameBoard:
def __init__(self):
self.player = WHITE
se... | true |
6cc44e72bbf78a96f10affeb0ba2c0992a920b52 | s10th24b/DNN_study | /practice/6_NumpyPractice1.py | UTF-8 | 471 | 3.640625 | 4 | [] | no_license | import numpy as np
b = np.array([[1,2,3,4],[5,6,7,8],[9,10,11,12]])
#array([ 1, 2, 3, 4],
# 5, 6, 7, 8],
# 9, 10, 11, 12] ] )
print(b[:1])
# all row, index 1 column
print(b[0])
# all row, index 1 column
print(b[-1])
# the last row
print(b[-1,:])
# same with above
print(b[-1, ...]) # :(colon) instanc... | true |
ac26e261070273fece1eac255da7638b86bc1960 | fyangss/questions | /python/hr/algorithms/emas_supercomputer_medium.py | UTF-8 | 1,541 | 3.03125 | 3 | [] | no_license | #!/bin/python3
import math
import os
import random
import re
import sys
def make_largest_cross(x, y, n, m, grid, grids):
if grid[x][y] != 'G':
return
cur_largest = [(x,y)]
grids.append(cur_largest.copy())
l,r,u,d = (x,y), (x,y), (x,y), (x,y)
while True:
l = (l[0]-1, l[1])
r = (r[0]+1, r[1])
... | true |
66f8fa77e7440480efa0aaac2235eb338fee043b | ebbitten/ScratchEtc | /Challenges/HutchesSepList.py | UTF-8 | 1,867 | 3.515625 | 4 | [] | no_license | import bisect
def answer(heights):
totalWater=0
#Populate walls list by checking to see if each hutch would trap water
numHutches=len(heights)
#really might want to switch to dicts, or even a list of dicts
lWallH=[-1] #populating so that max can be evaluated
lWallP=[-1]
rWallH=[-1] #populat... | true |
9425795c423710e0a05015261cbf8193c8ff0ba7 | eliobartos/BlogAPI | /models/comment.py | UTF-8 | 670 | 2.71875 | 3 | [] | no_license | from db import db
class CommentModel(db.Model):
__tablename__ = 'comments'
id = db.Column(db.Integer, primary_key=True)
text = db.Column(db.String(256))
article_id = db.Column(db.Integer, db.ForeignKey('articles.id'))
def __init__(self, text, article_id):
self.text = text
sel... | true |
e913ea3930f13c6880939284d0c7edcccd8aa120 | kisk0419/udemy_python_learning | /sec_03/lesson_13.py | UTF-8 | 629 | 4.34375 | 4 | [] | no_license | s = 'My name is Mike. Hi Mike.'
print(s)
# 指定文字列で開始してるかチェック
is_start = s.startswith('My')
print(is_start)
is_start = s.startswith('X')
print(is_start)
print('#########')
# 先頭から検索
print(s.find('Mike'))
# 最後から検索
print(s.rfind('Mike'))
# 存在数をカウント
print(s.count('Mike'))
# 文字列の先頭だけを大文字に変換
print(s.capitalize())
# 単語の先頭文字... | true |
73c7d069cc613fc3cb08e678769341687dc26ea7 | dvberkel/udacity | /cs262/unit-01/code/test/fsminterpretation.py | UTF-8 | 704 | 2.65625 | 3 | [] | no_license | import unittest
from code.fsm import fsmsim
class testInterpretation(unittest.TestCase):
def setUp(self):
self.edges = {(1,'q'): 1}
self.accepting = [1]
self.current = 1
def testPositive(self):
self.assertTrue(fsmsim('', self.current, self.edges, self.accepting))
self.... | true |
4f4657aeb496ffb3ac9495b8f7cae14a2daa58d2 | bayuwira/Document-Ranking-algorithms | /NLP.py | UTF-8 | 17,097 | 2.609375 | 3 | [] | no_license | from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.screenmanager import Screen
from kivy.properties import ObjectProperty
from kivy.uix.popup import Popup
from kivy.core.window import Window
import os
import string
import re
import math
from Sastrawi.Stemmer.StemmerFactory import Stemme... | true |
2b96c334e25c1cc627b85c7d4bafc5053deabf7a | kriswojtas/testing | /jedziemzpythonem.py | UTF-8 | 37 | 2.90625 | 3 | [] | no_license | x = 3
y = 4 + x
z = x + y
print(z)
| true |
df58b339720e4776fecd587a90daa7761038a1a3 | donfelicio/saleskit | /reservation/dicts.py | UTF-8 | 2,318 | 3.109375 | 3 | [] | no_license | #all dicts and lists you'll use in the views
def salestip(sales_status):
if sales_status == '1':
message = "A new request showed up in your S2M reservations, give the client a call and get to know them and find a great collaboration. If they are happy as is and don't need a tour, offer or any other help, j... | true |
44ba645cc0f3621912846a890c373a95a4c1c9e2 | nors230/machine_learning | /HW Assignments/HW2/pipeline.py | UTF-8 | 4,751 | 2.921875 | 3 | [] | no_license | '''
CAPP30254-ML: HW 2 - Machine Learning Pipeline
Code for Machine Learning Pipeline Version 1
Nora Hajjar
'''
import numpy as np
import pandas as pd
import matplotlib
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier
from sklearn import metrics
from sklearn.metric... | true |
1d7838e21f48022392e21b03c478e806ef7c2969 | maolintuntun/AI-Robotic-arm- | /python practice/T3-开根号取整数.py | UTF-8 | 196 | 3.390625 | 3 | [] | no_license | import math
for i in range(10000):
#转化为整型值
x = math.sqrt(i + 100)
y = math.sqrt(i + 268)
if(x==int(x)) and (y == int(y)):
print(i)
break
| true |
5c16c59ce06cab4f271f6ebddba745aebf2153db | shrobinson/python-problems-and-solutions | /lost_card (2,15).py | UTF-8 | 617 | 3.890625 | 4 | [] | no_license | #There was a set of cards with numbers from 1 to N. One of the card is now lost. Determine the number on that lost card given the numbers for the remaining cards.
#Given a number N, followed by N − 1 integers - representing the numbers on the remaining cards (distinct integers in the range from 1 to N). Find and print ... | true |
e2b26c67784a4c95b4437886845920d39662ab03 | alkk94/sixteen | /area.py | UTF-8 | 1,059 | 3.1875 | 3 | [] | no_license | from parameters import *
import pygame
class Area:
# Area parameters
AREA_WIDTH, AREA_HEIGHT = ELEMENT_SIZE, ELEMENT_SIZE
AREA_DIMENSIONS = AREA_WIDTH, AREA_HEIGHT
# Font sizes
FONT_SIZE = ELEMENT_SIZE
pygame.font.init()
font = pygame.font.SysFont("comicsans", FONT_SIZE)
def __init_... | true |
567b4f4e5f0b00694a1b73890e521fb2e5bbf3c8 | JulyKikuAkita/PythonPrac | /cs15211/CountofRangeSum.py | UTF-8 | 9,819 | 3.765625 | 4 | [
"Apache-2.0"
] | permissive | __source__ = 'https://leetcode.com/problems/count-of-range-sum/#/description'
# https://github.com/kamyu104/LeetCode/blob/master/Python/count-of-range-sum.py
# Time: O(nlogn)
# Space: O(n)
#
# Description: Leetcode # 327. Count of Range Sum
#
# Given an integer array nums, return the number of range
# sums that lie in... | true |
9095310274a53271238838aacf037c161b7e9436 | Y0ungMay/GraduationProject | /January/January31.py | UTF-8 | 2,316 | 3.109375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2020/1/31 下午 06:30
# @Author : Young May
import nltk
'''
理解文本句法和结构
'''
'''
使用nltk获得POS标签
'''
sentence='the brown fox is quick and he is jumping over the lazy dog'
tokens=nltk.word_tokenize(sentence)
tagged_sent=nltk.pos_tag(tokens,tagset='universal')
print(tagged_sent)
'''
#使... | true |
416e33ad3813ccfa6aa3c29c7c1a9c98a726d66b | kiin/advent-of-code-2020 | /day07/day7.py | UTF-8 | 620 | 3.359375 | 3 | [] | no_license | file1 = open('day7.txt', 'r')
Lines = file1.readlines()
def part1():
count = 0
par = ["shiny gold"]
search = True
while(search):
mark = True
for bag in par:
for line in Lines:
if bag in line:
toIn = line[0:line.find("bags")-1];
... | true |
820840dad7e5d90f6fe279bf925e7c50f1df3ef5 | noahratliff/workinprogress | /stackLines.py | UTF-8 | 693 | 3.359375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
def fnx(): return np.random.randint(3, 10, 10)
y = np.row_stack((fnx(), fnx(), fnx()))
# this call to 'cumsum' (cumulative sum), passing in your y data,
# is necessary to avoid having to manually order the datasets
x = np.arange(10)
... | true |
d53d1e926ddaa52456d5f75ebd0af3c0a0a81f27 | jdumm/llh-combiner | /merge.py | UTF-8 | 14,609 | 3.125 | 3 | [] | no_license | #!/usr/bin/env python
r"""
Merge two or more sets of files representing log-likelihood vs flux. Each trial's original flux, joint best-fit flux, and max TS are written to std output with line break. Assumes input files will have a header of 3 numbers: minimum flux, maximum flux, number of sample points. If the header... | true |
f0686106fe19bace66455228ad19d972b75ec37f | CovidWA/scrapers-oss | /python/KitsapCommunityClinic.py | UTF-8 | 4,306 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
import requests
from bs4 import BeautifulSoup
from ScraperBase import ScraperBase
from Common import Status, SaveHtmlToTable
import logging
from typing import Tuple, List
import datetime
class KitsapCommunityClinic(ScraperBase):
def __init__(self):
# The main page url
self.U... | true |
f1c21ea3329ff2fb6a90f9511214c3e9130af178 | njzhangyifei/keyframe | /cvutils/cvvideocapture.py | UTF-8 | 2,244 | 2.5625 | 3 | [
"MIT"
] | permissive | import cv2
from cvutils import CVFrame
class CVVideoCapture:
def __init__(self, file_handle, is_camera=False):
self.is_camera = is_camera
self.file_handle = file_handle
self.frame_count = None
self.capture = cv2.VideoCapture(self.file_handle)
self.update_frame_count()
... | true |
94c7bbad7da65dfb7df6f249a255688e4bdcfafe | vpjuguilon/AppPhysics155 | /chapter 7 exercises/exercise 7.1.py | UTF-8 | 1,025 | 3.078125 | 3 | [] | no_license | from numpy import linspace, zeros, sin
from cmath import exp, pi
from matplotlib.pyplot import plot, xlabel, ylabel, show, xlim
from random import random
def square(t):
error = 1e-10
output = []
for i in t:
if i - 5 < error:
output.append(0)
else:
outpu... | true |
217f634c288b5ea03c035ed70da79abebec2ceb2 | isabella232/youtube-export | /aggressively_compress_topic.py | UTF-8 | 3,825 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python2
# TODO(colin): fix these lint errors (http://pep8.readthedocs.io/en/release-1.7.x/intro.html#error-codes)
# pep8-disable:E128
"""Encode all videos under a single topic with aggressive compression settings.
This is for testing out and tweaking compression settings. This can also be
used to run a ... | true |
9a4a22bf4d7f9a4291d453959403d165a377fdc9 | peter-wangxu/python_play | /test/mock_test/MockChild.py | UTF-8 | 160 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | import mock
class MockTest(mock.Mock):
def test_fun1(self, p1, p2):
pass
m = MockTest()
m.test_fun1(1, 2)
m.test_fun1.assert_called_with(1, 2) | true |
9ce9c4ecb0d09e47527e5a053f3d5930ebcdb948 | shichao-ma/tools-for-data-challenge | /tools.py | UTF-8 | 9,754 | 3.21875 | 3 | [
"MIT"
] | permissive | """
A collection of useful tools for data analysis.
Initially created on Apr 26 2019
This version: Jun 3 2019
@author: Shichao Ma
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from datetime import datetime
from sklearn.decomposition import PCA
from sklearn.metrics im... | true |
b7d0a2229716541f3dd4cb8aa4dfa66f6ee74009 | InfoR3aper/domain2ip | /domain2ip3.py | UTF-8 | 794 | 3.296875 | 3 | [] | no_license | #!/usr/bin/python
# Name: domain2ip.py (With Socket Method & Colored Module)
# Purpose: Get IP from domain name
# By: Chetan Soni
# Date: 06 Oct 2017
# ------------------------------------------------------------------
# Downloaded from GitHub page: https://github.com/yeahhub/domain2ip
# Author Website:... | true |
6b161fd9c80ed790c5aebcd91bbfbe1b369060e7 | Phoebe0126/machineLearningInActionCode | /logistic_regression/horseLogReg.py | UTF-8 | 778 | 2.71875 | 3 | [] | no_license | from logRegression import LogRegression
import numpy as np
import util
class HorseLogReg(LogRegression):
def __init__(self, alpha, maxCycles):
super().__init__(alpha, maxCycles)
def fit(self, x, y):
m, n = np.shape(x)
thetas = np.ones((n, 1))
for j in range(self.maxCycles):
... | true |
3294703130510616c3b08a0c5aaa47a708804b93 | siralomarahmed/100DaysOfCode | /SourceCode/Python/day026.py | UTF-8 | 580 | 3.828125 | 4 | [] | no_license | # ------------------------------------ #
# Author: Ahmed A. M. ALOMAR
# Date: May 6 - 2020
#
# Description:
# * Example of Dictionary modification
# ------------------------------------ #
speed = {
"slow": 40,
"fast": 60,
"very fast": 100
}
print(speed)
more_speed = {
"very fast" : 200,
"average": 50,
"n... | true |
f2bb7c8559b6f3ff1b9a32ca00be6c3af49b0403 | theparadoxer02/Python-Practice | /21_march_2016/rangeofalist.py | UTF-8 | 146 | 3.21875 | 3 | [] | no_license | def set_range(a,b,c):
# Your code here
largest = max(a,b,c)
smallest = min(a,b,c)
print(largest-smallest)
set_range(1,4,4)
| true |
104983bf71b1d913f5197d8866365826bd1a27f6 | xgstriker/Smartninja-homework | /#6 Homework/7.3.py | UTF-8 | 351 | 4.25 | 4 | [] | no_license | x = int(input("Iveskite pirma skaiciu: "))
y = int(input("Iveskite antra skaiciu: "))
operation = input("Iveskite matematine operacija (+, -, *, /): ")
if operation == "+":
print(x + y)
elif operation == "-":
print(x - y)
elif operation == "*":
print(x * y)
elif operation == "/":
print(x / y)
else:
... | true |
fe72222bc4cd940e0f4f66b2669d934f9522bd39 | hanrick2000/LeetcodePy | /leetcode/math/integer_replacement_bit.py | UTF-8 | 655 | 3.515625 | 4 | [] | no_license | class Solution(object):
def integerReplacement(self, n):
"""
:type n: int
:rtype: int
"""
# https://leetcode.com/problems/integer-replacement/discuss/87920/A-couple-of-Java-solutions-with-explanations
# we just need to remove as many 1's as possible, doing +1 in case ... | true |
9e43610be3ca82179865dc0f6aa8648b99af328f | ddland/TIS-TN-python-code | /voorbeelden/plotten/simpele_grafiek.py | UTF-8 | 555 | 2.609375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import matplotlib.pyplot as plt
import numpy as np
# TN_code version > 1.1
from TN_code import TISTNplot as TN
x = np.arange(100)
y = 3 * x + 4
formatterX = TN.TNFormatter(4)
formatterY = TN.TNFormatter(2)
fig, ax = plt.subplots() # 1 figuur
ax.yaxis.set_major_formatter(formatterY)
ax.xaxis... | true |
36681279cd691d89386d671fdb1d8929ff4171c4 | stachenov/PyLeetCode | /problems/valid_sudoku.py | UTF-8 | 625 | 3.09375 | 3 | [
"Unlicense"
] | permissive | from itertools import product
class Solution(object):
def isValidSudoku(self, board):
"""
:type board: List[List[str]]
:rtype: bool
"""
rows, cols, cells = [0] * 9, [0] * 9, [[0] * 3 for __ in xrange(3)]
for i, j in product(xrange(9), xrange(9)):
if boar... | true |
3e3e64e06c38cd15eb4283b5cf5fd0cd2b5aab2a | rajatthosar/leetcode | /513_leftmost_value.py | UTF-8 | 972 | 3.5625 | 4 | [] | no_license | from collections import deque
# Definition for a binary tree node.
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def findBottomLeftValue(self, root: TreeNode) -> int:
if not root:
... | true |
4e26e7b3b0ef7806d6da905c1e214d12e38f8f0c | metanoia1989/PythonStudy | /MockData/Faker-test.py | UTF-8 | 8,398 | 3.15625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from faker import Faker, Factory
from faker.providers import internet
fake = Faker('zh_CN')
print('## Faker 实例化对象生成虚拟数据 ##')
print('随机姓名 %s' % fake.name())
print('随机地址 %s' % fake.address())
print('随机文本 %s' % fake.text())
print('\n')
print('## Faker 工厂函数,使用providers #... | true |
e31fa1dcb72d4304813dc3e2aa0b876494af7ea3 | pedromxavier/EEL816 | /babel/synth/main.py | UTF-8 | 1,884 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python3
def main(argc: int, argv: list):
from pathlib import Path
import argparse
from .compiler import Compiler
from .parser import parser
from .synth import Synth
from .instructions import instructions
argparser = argparse.ArgumentParser(description="Sound Compiler & Synth... | true |
36993cae165ecfd150ffdda68ca27494b4d77209 | dtgoitia/advent_of_code_2020 | /puzzles/puzzle_12/logic.py | UTF-8 | 1,530 | 2.78125 | 3 | [] | no_license | from pathlib import Path
from typing import Any, Dict, Iterator, List
PersonAnswers = str
def get_forms(path: Path) -> Iterator[List[PersonAnswers]]:
form_lines: List[PersonAnswers] = []
with path.open("r") as f:
for line in f:
if line == "\n":
yield form_lines
... | true |
7bcfc7fe6341804149b08f1eefc25a0c8735e10a | neuroph12/Mindblocks2.0 | /Mindblocks/model/value_type/soft_tensor/soft_tensor_value_model.py | UTF-8 | 6,554 | 2.8125 | 3 | [
"MIT"
] | permissive | import numpy as np
import tensorflow as tf
from Mindblocks.helpers.soft_tensors.soft_tensor_helper import SoftTensorHelper
class SoftTensorValueModel:
"""
Class representing a "soft" tensor with specified lengths along one or several axes.
"""
dimensions = None # Original dimensions as given by typ... | true |
220fd1fe7ca12efc65615657b57450dafefe3936 | vividwang/python-start | /5-6.py | UTF-8 | 324 | 3.90625 | 4 | [] | no_license | age = 100
if age < 2:
print('He was a baby!')
elif age >=2 and age < 4:
print('He was learning how to walk!')
elif age >= 4 and age < 13:
print('He was a children!')
elif age >= 13 and age < 20:
print('He was a young!')
elif age >= 20 and age < 65:
print('He was a man!')
else:print('He was a old ma... | true |
be45dd60a631ee6c0297ad5b3d3b855e775f6e43 | watsonwei/DNA_Alignment | /newfasta.py | UTF-8 | 389 | 2.546875 | 3 | [] | no_license | from Bio import SeqIO
import sys
f_input=open(sys.argv[1],"r")
f_output=open("new.fasta","wb")
cut_length=int(sys.argv[2])
seqs=SeqIO.parse(f_input,"fasta")
for item in seqs:
f_output.write("> " + item.id + "\n")
if cut_length==0:
f_output.write(str(item.seq)+"\n")
else:
f_output.write(str(item.se... | true |
488b12a62f5ae38fe232188501c6d73b179cc144 | Anass-ELGHAOUI/machine-learning-for-terrorist-detection | /data.py | UTF-8 | 1,359 | 3.21875 | 3 | [] | no_license | # the return is X and Y
from nltk.stem import PorterStemmer
from nltk.tokenize import word_tokenize
from sklearn.feature_extraction.text import TfidfVectorizer #on peux utliser countVectorizer()
from nltk.corpus import stopwords
def load():
print("------------------------------------------data loaded successefil... | true |
7c93e81665aeaa0c4bb33845b4c43131263fac1e | zarawang85/HW_Week12 | /scrape_mars.py | UTF-8 | 3,262 | 2.703125 | 3 | [] | no_license | from splinter import Browser
from bs4 import BeautifulSoup as bs
import pandas as pd
import requests
import time
def scrape():
# 1_news
url = 'https://mars.nasa.gov/news/?page=0&per_page=40&order=publish_date+desc%2Ccreated_at+desc&search=&category=19%2C165%2C184%2C204&blank_scope=Latest'
resp... | true |
5fc2303b371933bff5dafaa1556fc91fa33bbb38 | Infinidrix/worksheet-answers | /image.py | UTF-8 | 1,039 | 2.921875 | 3 | [] | no_license | from PIL import Image
img = Image.open('Capture1.jpg')
image = Image.open('Capture3.jpg')
listed = list(img.getdata())
listed2 = list(image.getdata())
img2 = Image.new('RGB', (img.width, img.height))
img3 = Image.new('RGB', (img.width*2, img.height))
new_image = []
# Merging images 1
for i in range(0, img.width*img.h... | true |
817c45d69e935520c0404192f09b5bcbbefc3d55 | guipw2/python_exercicios | /ex083.py | UTF-8 | 1,520 | 3.71875 | 4 | [] | no_license | expressao = input('Digite a expressão: ').strip()
validade = True
tipo_error = ''
quant_parenteses_abrir = expressao.count('(')
quant_parenteses_fechar = expressao.count(')')
parenteses_para_fechar = 0
if quant_parenteses_abrir == quant_parenteses_fechar:
for v in expressao:
if v == ')' and parenteses_para_... | true |
01299cc321093395fe4bd57649001d1e1c9ab129 | softmaterialslab/np-shape-lab | /python/dump.py | UTF-8 | 54,779 | 2.671875 | 3 | [] | permissive | # Pizza.py toolkit, www.cs.sandia.gov/~sjplimp/pizza.html
# Steve Plimpton, sjplimp@sandia.gov, Sandia National Laboratories
#
# Copyright (2005) Sandia Corporation. Under the terms of Contract
# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
# certain rights in this software. This softwa... | true |
e71c41af25a11e8fa9957af1bb22dc5983624b5c | KShaz/prml_python | /test_keras/image_recognition/image_recognition.py | UTF-8 | 1,873 | 2.71875 | 3 | [] | no_license | from tensorflow.keras.models import load_model
import cv2
import numpy as np
import matplotlib.pyplot as plt
# input data
read_img = cv2.imread("./image_data/my_data/test_image.png")
# get the center position
height,width,channel = read_img.shape[:3]
w_center = width//2
h_center = height//2
# trimming
trim_img = rea... | true |
4fe0762da74a24c3415e0317dc41a1e3e234e698 | Gailpig/computationalphysics_N2013301020123 | /untitled10.py | UTF-8 | 1,054 | 3.09375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 20 16:53:03 2016
@author: dell1
"""
import matplotlib.pyplot as plt
import numpy as np
import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D
sigma=10
b=8.0/3.0
dt=0.001
class Lorenz:
def __init__(self,x,y,z,r):
self.x=[x]
self.y=[y]... | true |
7990c7fe32d15b89cd20a31aeda37141b41ad308 | sankarshan-bhat/DS_Algo_Practice | /LeetcodeProblems/Longest Substring Without Repeating Characters.py | UTF-8 | 740 | 2.703125 | 3 | [] | no_license | class Solution(object):
def lengthOfLongestSubstring(self, s):
"""
:type s: str
:rtype: int
"""
charDict = {}
rLen = 0
maxlen = 0
subStr = ""
for i in range(0,len(s)):
cChar = s[i]
if cChar in subStr:
... | true |
f10cf445ea7497d8797f5f9a44f34c8c5a15f6df | learnables/learn2learn | /learn2learn/gym/envs/mujoco/halfcheetah_forward_backward.py | UTF-8 | 4,286 | 2.625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import gym
import numpy as np
from gym.error import DependencyNotInstalled
try:
from gym.envs.mujoco.mujoco_env import MujocoEnv
except DependencyNotInstalled:
from learn2learn.gym.envs.mujoco.dummy_mujoco_env import MujocoEnv
from learn2learn.gym.envs.meta_env import MetaEnv
class H... | true |
f13f4afef7cd1c87379456865dee38040c4f3f62 | kareemcoding/workos-python | /workos/portal.py | UTF-8 | 3,301 | 2.671875 | 3 | [
"MIT"
] | permissive | import workos
from workos.utils.request import RequestHelper, REQUEST_METHOD_GET, REQUEST_METHOD_POST
from workos.utils.validation import PORTAL_MODULE, validate_settings
ORGANIZATIONS_PATH = "organizations"
PORTAL_GENERATE_PATH = "portal/generate_link"
RESPONSE_LIMIT = 10
class Portal(object):
@validate_setting... | true |
98172b1999cf28ed3e2d36c6e6222e81970eba65 | aryanpatil/Client-Server-Socket-Program-Calculator- | /client.py | UTF-8 | 1,370 | 3.703125 | 4 | [] | no_license | # Importing required modules
import socket
import sys
import ipaddress
# Extracting host_ip and port_num
try:
host_ip = str(sys.argv[1])
try:
port_num = int(sys.argv[2])
except: # Exit if port number is not entered
print("Please enter Port Nu... | true |
f31d8b224e92c77ba9c01179e86a6869b1f15909 | AINIJOS/leetCodeSolutions | /algorithms/771.py | UTF-8 | 98 | 3.125 | 3 | [] | no_license | jewels = "aA"
stones = "aAAbbbb"
count=0
for i in jewels:
count+=stones.count(i)
print(count)
| true |
ec10076204ee52cc695497deba86ae727d9f1c24 | Lancher/coding-challenge | /*interview/petuum/design.py | UTF-8 | 455 | 2.59375 | 3 | [] | no_license |
# 如题, 想问一道petuum的面经题, 一台机器向另一台机器传100G的文件, 硬盘,内存,网络速度均为1GB/s, 内存是10个G,
# 问最短需要多少时间? 说一下我自己的想法: 虽然内存有10g,但是传输受到1g传输速度的限制, 100g 分成100个包,
# 第一个包到达的时间是4s,剩下99个包每隔一秒到达,所以总时间是99+4 s, 但是看地理一些人说是无限接近100s,不太明白为什么. | true |
07b850950b61d0fa6984fd4c167f5dad88ca3cf1 | fdima/GB-algAndStructData | /HW2/task4.py | UTF-8 | 421 | 3.84375 | 4 | [] | no_license | # Найти сумму n элементов следующего ряда чисел: 1 -0.5 0.25 -0.125 ...
# Количество элементов (n) вводится с клавиатуры.
def rec_sum(counter: int, nmb: float = 1, sum: float = 0) -> float:
if(counter > 0):
next_nmb = -nmb / 2
return rec_sum(counter - 1, next_nmb, sum+nmb)
else:
return... | true |
ccf6096e3e0ecde279640f8f7d6eeeb33e8e63dc | GeorgyZhou/Leetcode-Problem | /lc48.py | UTF-8 | 1,172 | 3.25 | 3 | [] | no_license | class Solution(object):
def rotate(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: void Do not return anything, modify matrix in-place instead.
"""
n = len(matrix)
if n <= 1:
return
r = n / 2
for i in xrange(r):
tmp = [... | true |
0d26ab1a8a538eed97b09644b9039ac318e976c0 | rafaelperazzo/programacao-web | /moodledata/vpl_data/116/usersdata/209/26774/submittedfiles/al1.py | UTF-8 | 140 | 3.4375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
r=float(input('digite um valor r:'))
h=float(input('digite um valor h:'))
v=3.14159*(r**2)*h
print('o volume é %f') | true |
d90fae13addf589616cbb3c8dea7acb06a8e8c29 | markovianlabs/collaborative-learning | /keras/mnist.py | UTF-8 | 2,377 | 2.703125 | 3 | [
"MIT"
] | permissive | from __future__ import print_function
import numpy as np
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.layers import Convolution2D, MaxPooling2D
from keras.utils import np_utils
from keras import backend as K
# Set the s... | true |