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 |
|---|---|---|---|---|---|---|---|---|---|---|
abf6783ccd8f06966a719a3b84b984b04d612e3b | goktugokce/DesignPatterns | /proj3/IpApi.py | UTF-8 | 920 | 2.96875 | 3 | [] | no_license | from ApiProxy import *
from Log import *
class IpApi(ApiProxy):
def __init__(self):
self.request = requests.get('https://ipapi.co/json/')
self.ip = None
self.city = None
self.country = None
self.latitude = None
self.longitude = None
self.status = self.reques... | true |
ed9c94e68dac1973dae4ffcfde139867b02bef4a | JavClaude/ConvNet | /src/Tests/test_train.py | UTF-8 | 1,334 | 2.59375 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import Dataset, DataLoader
from src.Model.baseline import ConvNet
from src.Training.train_eval import train_model, eval_model
device = "cpu"
class FakeDataSet(Dataset):
def __init__(self, n_samples: int, in_channels: int, input... | true |
6a5d9064850c2c813383916ff1f8a792d52a0b51 | woythadc194/eulerPython | /Euler038.py | UTF-8 | 1,203 | 4.21875 | 4 | [] | no_license | """
Take the number 192 and multiply it by each of 1, 2, and 3:
192 1 = 192
192 2 = 384
192 3 = 576
By concatenating each product we get the 1 to 9 pandigital, 192384576. We will call 192384576 the concatenated product of 192 and (1,2,3)
The same can be achieved by starting with 9 and multiplying by 1, 2, 3, 4, an... | true |
26fb27e7732c074eefeb2883bc13ee234aeb0a16 | 54fire/myfile | /python/spider.py | UTF-8 | 1,184 | 2.859375 | 3 | [] | no_license | import requests
from lxml import etree
url = "http://www.39gmgm.com" #程序入口
response = requests.get(url)
headers = {"User-Agent":"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36"}
#print(response.content.decode("gbk"))
print(response.content.decod... | true |
23527d643cdffb39a7b6bb72b03d96d0cb326ede | alan0415/AI_ML-project | /practice_16.py | UTF-8 | 208 | 2.671875 | 3 | [] | no_license | #巴斯卡三角形
output[]
while
def f(a):
if a == 1:
return ['1',]
elif a == 2:
return [('1 1'),]
else:
while a > 0:
return
| true |
4825536363edc5dda7448446a584b4c55ec0dbff | DeshErBojhaa/sports_programming | /leetcode/329 Longest Increasing Path in a Matrix.py | UTF-8 | 800 | 3.171875 | 3 | [] | no_license | # 329. Longest Increasing Path in a Matrix
class Solution:
def longestIncreasingPath(self, matrix: List[List[int]]) -> int:
ans = 0
longest_path = {}
def search(i, j):
if (i,j) in longest_path:
return longest_path[i,j]
ans = 1
... | true |
e85988b9aa7ee002bf8675cc165987c116f64a9a | davidc9320sg/rsom-dermatitis-cnn | /cnn/DataPreprocessing/Crop_Maximum_Height/PrepareData.py | UTF-8 | 3,589 | 2.875 | 3 | [] | no_license | import csv
class PrepareData:
def __init__(self, filepath):
self.study, self.labels, self.dirs, self.lower, self.upper, self.diff, self.feedback = self.readMyFile(filepath)
self.n_mild, self.n_moderate, self.n_severe, self.n_healthy = self.c_num(self.labels)
self.mild, self.moderate, se... | true |
6fcd1b3a7a460b0d39830e7927c1ce4d1da32419 | ikamensh/pydolons | /tests/battlefield/visibility/test_blind_backstab.py | UTF-8 | 647 | 2.578125 | 3 | [
"Unlicense"
] | permissive | from mechanics.events import AttackEvent
from battlefield.Cell import Cell
from battlefield.Facing import Facing
def test_backstab(empty_game, hero, pirate):
empty_game.add_unit(hero, Cell(1,1))
empty_game.add_unit(pirate, Cell(1,2))
hero.facing = Facing.SOUTH
pirate.facing = Facing.SOUTH
ae = ... | true |
63fd9cdd818daf39833690735a721dbd31286070 | Spandyandy/paper_keyboard | /paper_keyboard.py | UTF-8 | 3,318 | 2.734375 | 3 | [] | no_license | from detection import Detection
from threading import Thread
import cv2
import time
class CaptureCam:
def __init__(self):
self.video_capture = cv2.VideoCapture(0)
self.current_frame = self.video_capture.read()[1]
# create thread for capturing images
def start(self):
Thread(target... | true |
17c62bcf029b9fe0e3b306b4e2092b7d15285ea2 | m0zjo-code/signaldoctor-zmqserver | /MATLAB/fft_analysis/fft_timer.py | UTF-8 | 1,306 | 2.640625 | 3 | [] | no_license | import timeit
from scipy.fftpack import fft, ifft
import pyfftw
import numpy as np
pyfftw.interfaces.cache.enable()
def fft_wrap(iq_buffer, mode = 'pyfftw'):
"""
Compute FFT - either using pyfftw (default) or scipy
"""
if mode == 'pyfftw':
return pyfftw.interfaces.numpy_fft.fft(iq_buffer, threa... | true |
8f521fbfadc0064bfe89aaf41b3c28e36e02f655 | hblanks/talks | /2011/optparse.20111108/optparse_demo.py | UTF-8 | 1,218 | 3.734375 | 4 | [] | no_license | #!/usr/bin/env python
"""
Usage: %prog [options] word [word2 ...]
Echo's one or more words, optionally truncating or changing their case.
"""
from optparse import OptionParser
import sys
################################ Options ###############################
parser = OptionParser(usage=__doc__.strip())
parser.add... | true |
cee64abfccc704407aadd9287a67dae4ae6a3ba6 | sagarkamthane/Code-with-harry | /OOP/Inheritance/otherdundermethods.py | UTF-8 | 200 | 3.703125 | 4 | [] | no_license | class Number:
def __init__(self,num):
self.num = num
def __str__(self):
return f'Decimal Number = {self.num}'
def __len__(self):
return 1
n = Number(9)
print(n)
| true |
36727a8e472861def7b3a8636ad7bdd9f9b23d4a | utakatano/docker-python-template | /app/src/c2/bool.py | UTF-8 | 338 | 3.875 | 4 | [] | no_license | print(True and True)
print(True and False)
print(False and False)
a = 40
print((30 <= a) and (a < 50))
print(True or False)
print(False or False)
print(True or False)
print(False or False)
age = 25
print((age < 14) or (age > 70))
b = 30
print((b % 10 == 0) or (c % 4 == 0))
print(not True)
print(not False)
p... | true |
0a8968fbb651ec9d3be9d0ab3e023e8c816be31d | zhanbao2000/mokabot2 | /plugins/mb2pkg_vndb/data_model.py | UTF-8 | 7,754 | 2.9375 | 3 | [] | no_license | from datetime import date
from typing import Optional, Union
from pydantic import BaseModel
class SearchResult(BaseModel):
more: bool
items: list
num: int
class VNItemsBasic(BaseModel):
id: int # Visual novel ID
title: str # Main title
original: Optional[str] # Original/official title.
... | true |
157f18bc878691565f6e34bdb97269a6200bc721 | sweety-sg/webscrap | /test_scrap.py | UTF-8 | 743 | 2.6875 | 3 | [] | no_license | import unittest
import scrapping
# , “ritvik.jain.52206 “”, “”, “”
class test_scrap(unittest.TestCase) :
def test_1(self) :
uname = 'rishi.ranjan.54966'
self.assertEqual(scrapping.srch_name(uname), "Rishi Ranjan")
self.assertEqual(scrapping.srch_city(uname), "Patna, India")
self.asse... | true |
75853ca4109c6a20980e9459f7769174db472673 | cstavrou/Priors-and-Algorithms-for-Bayesian-Neural-Networks | /Chapter 5/mnist_small/code/mnist_bp.py | UTF-8 | 7,736 | 2.578125 | 3 | [] | no_license | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import tensorflow as tf
import pandas as pd
import sys
import random
import os
import timeit
import cv2
from sklearn.metric... | true |
edc3db67c2455495bcede46fa01c7c7fb23d779d | JCharlieDev/Python | /Python Programs/TransicionesTerapeutas/Lego.py | UTF-8 | 24,950 | 2.75 | 3 | [
"MIT"
] | permissive | import tkinter as tk
from tkinter import messagebox
from tkinter import *
def validar():
if entrada4.get()=="kodigo":
abrirventana2()
else:
messagebox.showwarning("Cuidado", "Contraseña incorrecta")
def borrar():
ventana5=tk.Tk()
ventana5.title("Ventana 2.3")
ventana5.iconbitmap("I... | true |
666cfbce58eab9ef4ff04c2e1d2bb9cf15382769 | NikitaBagramov/- | /2.py | UTF-8 | 231 | 3.21875 | 3 | [] | no_license | def F(start,end):
if end <start:
return 0
if start==end:
return 1
k=F(start,end-2)
k+=F(start,end-5)
if end%3==0:
k+=F(start,end//3)
return k
print(F(2,34))#Ответ 493
| true |
b6f999940f47ff86bb7d43f4d11fb7c509af3b88 | Whoismeidk/CompCamps2018 | /Python/item.py | UTF-8 | 359 | 3.375 | 3 | [] | no_license | import random
class Item:
def __init__(self, name, damage, healing):
self.name = name
self.damage = damage
self.healing = healing
items = [
Item("Potion", 0, 10),
Item("Knife", 10, 0),
Item("Crowbar", 4, 0),
Item("Lamp", 0, 5),
Item("Flashlight", 0, 2)
]
def getRandomI... | true |
2d425772f3560adf130a9a02506dfcd37aa7abc9 | atfoc/matf-timetable | /bin/database_to_html/database_to_html.py | UTF-8 | 5,848 | 2.609375 | 3 | [] | no_license | import os
from sqlalchemy import create_engine, MetaData, Table, and_
from sqlalchemy.engine import ResultProxy
from sqlalchemy.sql import select
from bs4 import BeautifulSoup as bs
from bs4 import Tag
import argparse as argp
import sys
def sqlite_connection_str(path: str)->str:
""" :param path - absolute path to ... | true |
210bc66cc5adc40c19420b03989ca1b5a6d6e138 | vinupooji/poojishiva | /file.py | UTF-8 | 76 | 3.359375 | 3 | [] | no_license | a=int(input ("enter a value"))
b=int(input ("enter b value"))
c=a+b
print(c) | true |
b6dfe82f7fd4a3e59ccdb629e0fc0cb6ae276a2f | dairantzis/BBK_Introduction-to-Computer-Systems_2021 | /Optional Python exercises/Optional33-If-else-Sign-function.py | UTF-8 | 310 | 4.25 | 4 | [] | no_license | #
# For the given integer X print `1` if it's positive,
# `-1` if it's negative, or `0` if it's equal to zero.
# Try to use the cascade `if-elif-else` for it.
#
number = int(input('Please, enter a number:'))
if number > 0:
print('1')
elif number < 0:
print('-1')
else:
print('0')
| true |
0248ebbb50c34e7773c19561d5d26173e077a91e | MadsEyv/INFO216-Project | /python/recipe_queries.py | UTF-8 | 2,892 | 3.3125 | 3 | [] | no_license | from query_functions import createIngredientQuery, getRecipeTitle, getTitleAndInstructions
prefixRecipe = "PREFIX recipe: <http://schema.org/Recipe/>"
#In Blazegraph:
# prefix recipe: <http://schema.org/Recipe/>
# SELECT DISTINCT * WHERE {
# ?x recipe:recipeIngredient ?ingredient
# FILTER re... | true |
9651305d91a3c0c55d187414b1f2f64ec9f0c1e4 | Fasgarinejad/ECE143_project | /Analysis/Codes/Country's_unique_genres.py | UTF-8 | 3,421 | 2.9375 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import matplotlib.animation as animation
import csv
from pandas import DataFrame
import seaborn as sns
from IPython.display import HTML
import collections
'''
Plot each countries' unique genres
Read from final_dat... | true |
d20d7eef18c053e581a3c703fe67ca5324cd4685 | qiu1234567/matrpo | /examples/learning_curves.py | UTF-8 | 2,659 | 2.6875 | 3 | [
"MIT"
] | permissive | import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from baselines.bench.monitor import load_results
def get_training_curve(env, model, num_agents):
env_id = '{}_{}'.format(env, num_agents)
agents = ['r{}'.format(i) for i in range(num_agents)]
seeds = [1,2,3,4,5]
results = []
f... | true |
ad303c1e4d72819ee3d7534e7a303260fe0357f2 | Naxesss/Aiess | /bot/formatter.py | UTF-8 | 20,740 | 2.578125 | 3 | [] | no_license | import sys
sys.path.append('..')
from enum import Enum
from datetime import datetime, timedelta, timezone
from functools import total_ordering
from typing import Union, Tuple
from discord import Embed, Colour
from aiess import Event, Beatmapset
from aiess import event_types as types
from aiess.database import SCRAP... | true |
94e722b02e54b422597e422c9790371230469f34 | lbermillo/cassie-curriculum-learning | /cassie/utils/dynamics_randomization.py | UTF-8 | 1,863 | 3.03125 | 3 | [] | no_license | import numpy as np
def randomize_mass(mass, low, high):
pelvis_mass_range = [[low * mass[1], high * mass[1]]] # 1
hip_mass_range = [[low * mass[2], high * mass[2]], # 2->4 and 14->16
[low * mass[3], high * mass[3]],
[low * mass[4], high * mass[4]]]
a... | true |
e758e61f130c797b11f51521bdb465e22741eb55 | AlexisNathavong/Intro-Python-I | /src/13_file_io.py | UTF-8 | 948 | 4.34375 | 4 | [] | no_license | """
Python makes performing file I/O simple. Take a look
at how to read and write to files here:
https://docs.python.org/3/tutorial/inputoutput.html#reading-and-writing-files
"""
# Open up the "foo.txt" file (which already exists) for reading
# Print all the contents of the file, then close the file
# YOUR CODE HERE... | true |
1580600327d59bc54594a74df486854e32e105d5 | cgsunkel/data-hub-api | /datahub/investment/validate.py | UTF-8 | 1,068 | 2.96875 | 3 | [
"MIT"
] | permissive | from datetime import date
from dateutil.relativedelta import relativedelta
def field_incomplete(combiner, field):
"""Checks whether a field has been filled in."""
if combiner.is_field_to_many(field):
return not combiner.get_value_to_many(field)
return combiner.get_value(field) in (None, '')
def... | true |
564c489636357f622b2e8c30aaf682cb11b6cda8 | varsha-shewale/github_python_problems | /2_factorial.py | UTF-8 | 617 | 4.625 | 5 | [] | no_license | '''
Question 2
Level 1
Question:
Write a program which can compute the factorial of a given numbers.
The results should be printed in a comma-separated sequence on a single line.
Suppose the following input is supplied to the program:
8
Then, the output should be:
40320
'''
'''
num = int(raw_input('Enter ... | true |
424e966346026e6a20900560426469507c8045fd | rtaboadam/proceso-digital-imagenes | /include/transforms/linear.py | UTF-8 | 435 | 2.84375 | 3 | [] | no_license | class LinearTransform:
def linear_transform(self, image, func=lambda: (0, 0, 0),
before=lambda i, x: 0,
after=lambda i, x: 0):
load = image.load()
WIDTH, HEIGHT = image.size
for x in range(WIDTH):
before(image, x)
for ... | true |
54e4cfcf96d3000a5c223c423d9c0239387e1103 | willemt/sqlhild | /sqlhild/ast_transformer.py | UTF-8 | 574 | 2.5625 | 3 | [] | no_license | from ast import (
Call,
Load,
Name,
NodeTransformer,
)
class FindAndReplaceNames(NodeTransformer):
"""
Searches this AST and replaces names.
"""
def __init__(self, replacements):
# TODO: raise exception if replacement not done
self.replacements = replacements
su... | true |
469e25a80fb3c639885b76976b17fcbf1c7a62d7 | uktechreviews/gpiozero | /reaction_time.py | UTF-8 | 482 | 3.171875 | 3 | [] | no_license | from gpiozero import Button
from gpiozero import LED
from time import *
import time
import random
button = Button(21)
green =LED(2)
yellow=LED(3)
green.on()
yellow.off()
wait = random.randint(2,7)
sleep(wait)
start_time = time.time()
while True:
if button.is_pressed:
yellow.off()
end_time = time.time()
el... | true |
446d0006d9ca01f84849a0538772cec868863d01 | informancer/genetic-soylent | /soylent/models.py | UTF-8 | 11,353 | 2.625 | 3 | [
"BSD-2-Clause"
] | permissive | from sqlalchemy import Column, Boolean, Integer, Float, String, ForeignKey
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, backref
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.orm.collections import attribute_mapped_collection
from sqlalc... | true |
d95d32b5b7e7c2ab80366f74092b866cbd2a5bd3 | mrslow/yandex-s3 | /s3/_utils.py | UTF-8 | 1,473 | 2.84375 | 3 | [
"MIT"
] | permissive | import asyncio
from datetime import datetime, timezone
from typing import (
TYPE_CHECKING,
Any,
Awaitable,
Iterable,
List,
Optional
)
__all__ = 'get_config_attr', 'to_unix_s', 'utcnow', 'ManyTasks'
if TYPE_CHECKING:
from ._types import BaseConfigProtocol
EPOCH = datetime(1970, 1, 1)
EPOC... | true |
3181eb0c433e86d6dd02a2768ac8ef7f695f3ec1 | erinrrobinson/Nodes-SimpleThingsFest2019 | /Python/Haiku.py | UTF-8 | 4,990 | 2.890625 | 3 | [] | no_license | import tweepy
import re
from datetime import datetime, timedelta
import markovify
import sylco
from re import search
class Haiku:
ACCESS_TOKEN = "ACCESS_TOKEN"
ACCESS_TOKEN_SECRET = "ACCESS_TOKEN_SECRET"
CONSUMER_KEY = "CONSUMER_KEY"
CONSUMER_SECRET = "CONSUMER_SECRET"
Twitter_Search_Timeout = 10... | true |
68014da1968794ebe42791d3dbc5912cd1b4443a | YimingShao/100DaysChallenge | /day7-9/my_app.py | UTF-8 | 3,073 | 3.203125 | 3 | [] | no_license | from data import us_state_abbrev, states_list
from collections import OrderedDict
import sys
import subprocess
def main():
menu()
ordereddict = OrderedDict(us_state_abbrev)
key = rec_input()
while(key is not '6'):
if key =='1':
print_nth_item(states_list, ordereddict)
if ... | true |
59ac1b6f1a100aae6aadc96b3b91b8606c11c23e | AlexBaly/numverify | /numverify/sorter/local_files/local_files.py | UTF-8 | 1,422 | 2.6875 | 3 | [] | no_license | import os
import shutil
from numverify.sorter.api.api import API
from numverify.sorter.api.constants import NOT_COUNTRY
class LocalFiles:
def __init__(self, in_dir, out_dir):
if not os.path.isdir(in_dir) or not os.path.isdir(out_dir):
raise ValueError("Paths must be directories")
... | true |
b6b80f588666204daa1c1cee4dccd3fdd4184551 | xuejieshougeji0826/leetcode_top100 | /347.py | UTF-8 | 586 | 3.125 | 3 | [] | no_license | class Solution(object):
def topKFrequent(self, nums, k):
final=[]
dic={}
for j in range(len(nums)):
dic[nums[j]]=0
if len(nums)==0:
return None
elif len(nums)==1:
return nums
else:
for i in range(len(nums)):
... | true |
0b5231360bf00b0df12af3ba8ec96cd1fe1e3736 | TianMyy/3day-machine-learning-starting | /day1_demos/1-sklearn_dataset.py | UTF-8 | 746 | 3.171875 | 3 | [] | no_license | from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
def datasets_demo():
"""
sklearn dataset usage
:return:
"""
#get the dataset
iris = load_iris()
print("iris dataset:\n", iris)
print("view description of dataset\n", iris["DESCR"])
print("vie... | true |
5830af5bb1327032bd4f3cd03614cf115db03746 | adamrichman1/GraphSearchPuzzleSolver | /puzzles/jugs.py | UTF-8 | 5,811 | 2.96875 | 3 | [] | no_license | import math
from graph import State
from game import Game
from ast import literal_eval
from copy import deepcopy
class JugsState(State):
num_states = 0
def __init__(self, capacities):
self.capacities = list(capacities)
self.heuristic = JugsGame.calculate_heuristic(capacities)
JugsSta... | true |
9503c988bcae7f536b4d641bb21014b5890432a0 | chriswaudby/pp | /od/old/analyse_results.py | UTF-8 | 3,048 | 2.703125 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | #!/home/nmrsu/anaconda2/bin/python
"""Read in the current experimental results, update the parameter estimates and
select the optimal point for the next observation.
The working directory should be specified as a command line argument. This
directory must contain the following input files:
adapt_ccr_integrals: ex... | true |
93db0bd88559244c95f2aef4539162e2190b784c | TomaszSzyborski/DataQuest-CoursesCode | /recursion-and-tree-structures/Overview of Recursion-277.py | UTF-8 | 1,704 | 4.34375 | 4 | [] | no_license | ## 2. Recursion is thinking in Recursion ##
search_list = ['apple', 'orange', 'pear', 'fig', 'passionfruit']
def search(strings, term, index=0):
if strings[0] == term:
return index
if len(strings) <= 1:
return -1
return search(strings[1:], term, index=index+1)
apple_index = search(search... | true |
9ed458ba71d0c574127d4f8cda1941546757dd56 | 1572903465/PythonProjects | /pythonbase/面向对象基础/python程序设计基础/7.2.3_用函数表示类的行为特征.py | UTF-8 | 265 | 3.328125 | 3 | [] | no_license | class animals:
def breath(self):
print('呼吸')
class mammals(animals):
def move(self):
print('奔跑')
class dog(mammals):
def eat(self):
print('吃')
if __name__ == '__main__':
Bob = dog()
Bob.move()
Bob.eat()
| true |
86b68ff80f76b02a7a7be4237cd5b9ef56d45bfa | Anych/pytest_project | /my_pytest/companies/tests/test_pytest_api.py | UTF-8 | 3,213 | 2.65625 | 3 | [
"MIT"
] | permissive | import json
from typing import List
import pytest
from django.urls import reverse
from companies.models import Company
companies_url = reverse("companies-list")
pytestmark = pytest.mark.django_db
@pytest.fixture
def amazon() -> Company:
return Company.objects.create(name="Amazon")
def test_zero_companies_sho... | true |
ad076fb5153adb7a7ae61da3802eedf30c62f9a7 | robintibor/braindecode-1 | /braindecode/models/tcn.py | UTF-8 | 5,117 | 2.703125 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | # Authors: Patryk Chrabaszcz
# Lukas Gemein <l.gemein@gmail.com>
#
# License: BSD-3
from torch import nn
from torch.nn import init
from torch.nn.utils import weight_norm
from .modules import Ensure4d, Expression
from .functions import squeeze_final_output
class TCN(nn.Module):
"""Temporal Convolutional... | true |
6c668fe7e4b82f364cee26e5bf7a9aa34f5215bc | eguilg/yc_car_sale | /feature/mini_class.py | UTF-8 | 1,944 | 2.890625 | 3 | [] | no_license | import pandas as pd
import numpy as np
from preprocess.preprocess import load_preprocessed_data
import os
# 生成配置完全不同的车辆类型细分
def _gen_mini_class(train_data):
except_columns = ['sale_date','price','sale_quantity','year','month','time_index']
key_columns =[name for name in train_data.columns if not name in exce... | true |
43afcc593064d1a4eb6e26b05d995186244d10ab | david-cons/multithreaded_kahoot_bot | /sprawl.py | UTF-8 | 1,386 | 3.140625 | 3 | [] | no_license | from kahoot_bot import kahootBotInstance
from sys import exit
lookup_table = {
"r":0,
"b":1,
"y":2,
"g":3
}
def main():
code = int(input("code? : "))
nr_of_bots = int(input("how many bots ? : "))
bots = []
if nr_of_bots<1:
print("cannot have 0 or negative bots")
exit(1... | true |
8010acb5ec148fe3b3449f476f375f6142754928 | rafaelperazzo/programacao-web | /moodledata/vpl_data/303/usersdata/277/97497/submittedfiles/testes.py | UTF-8 | 653 | 4.3125 | 4 | [] | no_license | """
EE2: Escreva um programa em Python que cria uma matriz m x n
preenchida com zeros e mostra a matriz na tela
"""
# Funcao de criar a matriz
def cria_matriz(m,n,valor_inicial) :
matriz = []
for i in range(m):
linha = []
for j in range(n):
linha.append(valor_inicial)
matriz.append(linha)
... | true |
e983794f304f9f4ec073700952bf292526b50668 | DmY39/Course-2-continue | /mad_checker.py | UTF-8 | 433 | 3.984375 | 4 | [] | no_license | def mod_checker(x, mod = 0):
''' Генерирует лямбда функции от аргумента у, которая возвращает
True, если остаток от деления у на х равен mod, а иначе False
'''
return lambda y: y % x == mod
# пример
mod_3 = mod_checker(3)
print(mod_3(3)) # True
print(mod_3(4)) # False
mod_3_1 = mod_checker(3, 1)
prin... | true |
4584805ec9ce5ad3d5175d572bc461756b7092b0 | antuniooh/bank-in-python | /main.py | UTF-8 | 1,964 | 3.5 | 4 | [
"MIT"
] | permissive | #importar a biblioteca "os" para poder apagar o arquivo e manipular outras funções
import os
#importar a biblioteca para manipular as linhas dentro do arquvio
from io import StringIO
from modules import defNewClient
from modules import defDeleteClient
from modules import defDebitClient
from modules import defD... | true |
f7ade34b845f6923aaf6eb3ddd217169ff315362 | zyg11/mnist_load_data_preprocessing_and_CNN | /minist_CNN.py | UTF-8 | 3,989 | 2.546875 | 3 | [] | no_license | from __future__ import absolute_import
from __future__ import print_function
import os
from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
from keras.datasets import mnist
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers import Dense,Dro... | true |
e4366a33e3d3c450c6d6b2b42768efe96af59ae7 | MuhmdRaouf/DependencyFetcher | /Tests.py | UTF-8 | 6,574 | 2.515625 | 3 | [] | no_license | import unittest
import os
from DependencyFetcher import Fetcher
class TestFetcherScript(unittest.TestCase):
def testFindingAllDependencyFromPom(self):
pomFile = './pom.xml'
elements = Fetcher.parseAllDependencyFromPom(pomFile)
self.assertEqual(4, len(elements))
self.assertEqua... | true |
0da3642abf822c7aa901aca8c47a09860d75064a | prakharmaurya/NASEFetchEngine | /utils/fetcher_dir/get_cookies.py | UTF-8 | 879 | 2.640625 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import json
def get_session_cookies():
try:
cookie_dict = json.loads(open('./cookies.txt').read())
except Exception as e:
print('Error in cookie reading')
chrome_options = Options()
chrome_opti... | true |
7f38f46d9474f4d64cc23b6e24dc0aa1d5fc0dd9 | diraven/adventofcode | /year2018/day03/pt2.py | UTF-8 | 2,135 | 3.890625 | 4 | [] | no_license | """
https://adventofcode.com/2018/day/3
--- Part Two ---
Amidst the chaos, you notice that exactly one claim doesn't overlap by even a single square inch of fabric with any other claim. If you can somehow draw attention to it, maybe the Elves will be able to make Santa's suit after all!
For example, in the claims ab... | true |
9831119143c0668cabf73dec8e4c49426cca3cfa | HeroProject/2020-colettewib | /aSyncDance.py | UTF-8 | 9,387 | 2.515625 | 3 | [] | no_license | from social_interaction_cloud.abstract_connector import RobotType
from social_interaction_cloud.action import ActionRunner
from social_interaction_cloud.basic_connector import BasicSICConnector, BasicNaoPosture
from time import sleep
import random
class Main:
def __init__(self, server_ip, robot, dialogflow_key_f... | true |
7eb5c36748aab81a631eecc9a2451b6576222dd0 | xshi0001/base_function | /xls_function.py | UTF-8 | 181 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | __author__ = 'rocchen'
import xlrd
filename = "Book1.xls"
data = xlrd.open_workbook(filename)
table = data.sheets()[0]
stock_id = table.col_values(0)
for i in stock_id:
print i | true |
7790abec5160907ea20a377bcc7d602d748d2550 | felixSchober/Defect-Prediction | /Defect_Prediction/Defect_Prediction/data_io/test_data.py | UTF-8 | 22,290 | 2.921875 | 3 | [
"MIT"
] | permissive | from os import walk, remove
import os.path as osPath
import pickle
import logging
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelBinarizer
import javalang
from data_io.csv_data import get_csv_row_generator
from misc import utils
logger = logging.getLogge... | true |
1f32802c5cb888b9d2fe308f2ac491d92237e438 | BDNYC/Miscellaneous- | /find_rv.py | UTF-8 | 9,078 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
"""
find_rv.py
Created by Vivienne Baldassare on 2012-03-30.
Copyright (c) 2012 __MyCompanyName__. All rights reserved.
Description:
This code finds the radial velocity of a target when supplied with data for the target and data for a standard object
whose radial velocity is... | true |
8ba5c07bfdf6cbdf771ce927df85fdf19a815c6c | norbit8/Logic | /ex12/code/predicates/completeness.py | UTF-8 | 26,449 | 2.875 | 3 | [] | no_license | # (c) This file is part of the course
# Mathematical Logic through Programming
# by Gonczarowski and Nisan.
# File name: predicates/completeness.py
from typing import AbstractSet, Container, Set, Union
from logic_utils import fresh_constant_name_generator
from predicates.syntax import *
from predicates.sem... | true |
39ddae7d5177cd927817db79d4ae5be12aba5125 | barsuk2/python_algos_gb | /Урок 4. Практическое задание timit profilir/Урок 4. Коды примеров/task_6.py | UTF-8 | 423 | 3.359375 | 3 | [] | no_license | """Профилировка времени выполнения функций"""
import cProfile
import time
def fast():
print("Я быстрая функция")
def slow():
time.sleep(3)
print("Я очень медленная функция")
def medium():
time.sleep(0.5)
print("Я средняя функция...")
def main():
fast()
slow()
medium()
cProfile... | true |
ca54a74cd7e2850b07b547662648e93032255b5a | sly92/NLP_project | /ner/test/document/test_interval.py | UTF-8 | 541 | 2.796875 | 3 | [] | no_license | import logging
import unittest
from ner.document import Interval
LOGGER = logging.getLogger(__name__)
class test_token(unittest.TestCase):
def setUp(self):
self.object = Interval(0,5)
self.object2 = Interval(0,5)
#Configurer les tests unitaires (si nécessaire)
def test__len__(self):
... | true |
0a7329a3faefdb2628f77841198c960567a010db | Aasthaengg/IBMdataset | /Python_codes/p03088/s108105743.py | UTF-8 | 472 | 2.828125 | 3 | [] | no_license | n=int(input())
mod=10**9+7
memo=[{} for i in range(n+1)]
def ok(last4):
for i in range(4):
t=list(last4)
if i>=1:
t[i-1],t[i]=t[i],t[i-1]
if "".join(t).count("AGC")>=1:
return False
return True
def dfs(cur,last3):
if last3 in memo[cur]:
return memo[cur][last3]
if cur==n:
return... | true |
756b1485989249a26d3dbf9713a3236d573cc972 | itsumarfarooq/Fiverr | /Final/username.py | UTF-8 | 785 | 2.578125 | 3 | [] | no_license | import urllib2
from bs4 import BeautifulSoup
import json
username = raw_input('Enter username: ')
url = 'http://fiverr.com/'+username
hdr = {'User-Agent': 'Mozilla/5.0'}
req = urllib2.Request(url, headers=hdr)
page = urllib2.urlopen(req)
soup = BeautifulSoup(page)
div = soup.find_all('div', 'gig-carousel loading cf '... | true |
cac49bbded93ffc4e84431834b53ede8def788fa | JiapengZhang/boto3 | /boto3/utils/mangle.py | UTF-8 | 663 | 2.59375 | 3 | [
"MIT"
] | permissive | from botocore import xform_name
def to_snake_case(camel_case_name):
# FIXME: Revisit this to make sure we're safe with the above import
# and that we'd really prefer that behavior.
# bits = []
#
# for char in camel_case_name:
# if char.isupper():
# bits.append('_')
#... | true |
2bbe628cb0a0c7eecdc2876b751e3bfaa7d7223a | thornydre/superpipe | /XMLParser.py | UTF-8 | 959 | 3 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #!/usr/bin/python
import xml.etree.ElementTree
from pathlib import Path
from os import makedirs
class XMLParser:
def __init__(self, xml_file):
self.xml_file = xml_file
self.tags = {}
def parseXML(self, root_folder):
root = xml.etree.ElementTree.parse(self.xml_file).getroot()
self.recursiveParser(root, r... | true |
668492f41d7b9ca81ae7f7ac12415076c4bf1b53 | foxtreme/automate_boring_stuff | /web_scrapping/college_scrapping/college_scrapping.py | UTF-8 | 2,396 | 2.8125 | 3 | [
"MIT"
] | permissive | import pandas as pd
import os
import shutil
import time
from wikipedia import wikipedia
start_time = time.time()
CSV_FOLDER = os.path.join("sources", "csv")
MAP_FOLDER = "map_csv"
QC_INSTITUTIONS = "quebec_institutions.csv"
BC_INSTITUTIONS = "british_columbia_institutions.csv"
AB_INSTITUTIONS = "alberta_institutions.c... | true |
6c97393e559c6b4704f553976931a4fcb5856af9 | thiagob/aoc-2018 | /04_repose_record/10/main.py | UTF-8 | 1,476 | 3.015625 | 3 | [] | no_license | import re
from datetime import datetime
def execute(data):
guard = 0
guards = {}
for l in data:
line = l.strip()
info = re.findall(r'\d+', line)
date = info[1] + '-' + info[2]
minutes = int(info[4])
if line.endswith('begins shift'):
guard = info[5]
... | true |
5b350ee24a552f85bf173d12f184ffeb4ae8300c | divyankpatel02/Optical-character-recognition | /CharacterRecognition.py | UTF-8 | 12,186 | 3.28125 | 3 | [] | no_license | #########################################
# George Saman #
# Character Recognition using ANN #
# with backpropagation algorithm #
# Email: georgesaman@csu.fullerton.edu #
#########################################
from PIL import Image as im
import numpy as np
import matp... | true |
72e2880d2f68ba8ab98e3f9cdbfac8255379de6d | fjufirefox/1st-PyCrawlerMarathon | /Day007_HW.py | UTF-8 | 724 | 2.6875 | 3 | [] | no_license | # # 1. (簡答題)請問目前提到的這種基於 HTTP 一來一回的網頁傳輸方式,有哪些缺點及問題?
# 1.通訊使用明文,未加密,並且TCP/IP 協議是可能會被竊聽的網絡,所以通訊內容可能會被竊聽
# 2.沒有驗證通訊方的身份,因此可能會遭遇偽裝
# 3.沒有辦法驗證報文的完整性,所以可能會被篡改
# 4.傳輸較慢
# # 2. (簡答題)第 16 頁所使用的 JavaScipt 程式語言,跟我們一般使用的 Python 在執行上有什麼不同。
# 1.JS主要用於網頁與瀏覽器中,可以用來為網頁增加動態功能
# 2.Python 為一物件導向、直譯式的高階程式語言,可以用於網站以及所有作業系統 | true |
bf0d13fd8e796aa1cd13d73990554d4b9ff96c04 | sd2020spring/GeneFinder-toluooshy | /gene_finder.py | UTF-8 | 5,765 | 3.375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
GENE FINDER MINI PROJECT ONE
@author: Tolulope Oshinowo
"""
import random
from amino_acids import aa, codons, aa_table # you may find these useful
from load import load_seq
def shuffle_string(s):
return ''.join(random.sample(s, len(s)))
def get_complement(nucleotide):
#Makin... | true |
0e6e5bd23a2c413956a33267d62cb7ed1bd4380e | mpd18/projects | /Code/ProgrammingProblems/2017MyCode/editor.py | UTF-8 | 89 | 2.765625 | 3 | [] | no_license |
def breadthFirstSearch(list,start):
queue = []
queue.append(start)
while queue:
| true |
96ec016c8dc24b0970acc2ecddbd6186b180de50 | uestcwm/-ML- | /main.py | UTF-8 | 3,331 | 3.8125 | 4 | [] | no_license | import pandas as pd
import numpy as np
import seaborn as sns#可以看做matplotlib一样的功能
sns.set(context="notebook",style="whitegrid",palette="dark")
import matplotlib.pyplot as plt
data=pd.read_csv('ex1data1.txt',names=['population','profit'])#读取数据并赋给每列名字
#print(df.describe())#一些属性的显示
#print(df.info())#info:查看属性索引数据类... | true |
909010948459b71dbe98669bbe17e3132b7b0535 | Jonwalk30/eurovision | /judge.py | UTF-8 | 4,033 | 3.046875 | 3 | [] | no_license | import random
import json
import mp3
class Judge:
name = None
votes = []
def __init__(self, name):
self.name = name
def create_judge_list(judge_names: [], r):
judge_names_shuffled = judge_names.copy()
r.shuffle(judge_names_shuffled)
judges = []
for judge_name in judge_names_shu... | true |
6174d5bfe55a393b89e3fceaf6d7c8f7aa7538e2 | sunyuebo1998218/bowen | /python/mr/config/cnnfig_2.py | UTF-8 | 1,019 | 2.875 | 3 | [] | no_license | from HTMLTestReportCN import HTMLTestRunner
import unittest
def report(test_name, report_path):
"""盘,
:param test_name: 测试用例的名字
:param report_path: 测试报告html的路径+名字
:return:
"""
# 第一步:创一个测试套件,理解成玩具枪的弹夹
suite = unittest.TestSuite()
# 第二步:向测试套件里面添加测试用例,理解成玩具枪弹夹添加bb弹【子弹】
suite.addTest(t... | true |
c042dcb714ddc9f051faa3a126d6afe401f7b46e | dndudals/dndjd | /app.py | UTF-8 | 848 | 2.84375 | 3 | [] | no_license | from flask import Flask,render_template
app = Flask(__name__)
#메인
@app.route('/')
def hello():
return render_template("main.html", data =hello)
#야구
@app.route('/Baseball')
def baseball():
return render_template("Baseball.html", data = baseball)
#검색
@app.route('/action')
def action():
return "??을 검색한 결과 입니... | true |
308432e493494cd8acee727c5bd969bc1c34af37 | Great-designer/BUAA-OJ-Project | /python/2191 题目D似曾相识.py | UTF-8 | 163 | 3.1875 | 3 | [] | no_license | n, m = map(int, input().split())
lis = []
for i in range(n):
a = input()
if a in lis:
print("NO")
else:
print("YES")
lis.append(a)
| true |
820e95f0942cddb99b5eb2ef54d0f18572b70fe8 | AdriaGS/HAR-Using-Samartphone-Sensors | /DNN-Approach/HAR_LSTM_UCI.py | UTF-8 | 3,517 | 2.859375 | 3 | [] | no_license | import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import time
from keras.models import Sequential
from keras.layers import Dense,LSTM,Dropout
from keras.layers.embeddings import Embedding
from keras.preprocessing import sequence
start_time = time.time() #To keep track of time to run... | true |
e844c0529b107cf30140eb31941b9a08b5822f80 | ThomasLiu/python_study | /dome/lesson3/func.py | UTF-8 | 4,164 | 3.96875 | 4 | [] | no_license | import math
n1 = 255
n2 = 1000
print('hex(255):', hex(255))
print('hex(1000):', hex(1000))
def my_abs(x):
if not isinstance(x, (int, float)):
raise TypeError('bad operand type')
if x > 0:
return x
else:
return -x
print('my_abs(11):', my_abs(11))
print('my_abs(-11):', my_abs(-11))
... | true |
767714e86c9624295d955c164afde3fb76c740cc | hirachan/audax-cue-converter | /src/audax_cue_converter/cli_cue_convert.py | UTF-8 | 841 | 2.515625 | 3 | [] | no_license | #!/bin/env python3
import sys
import argparse
from .rwgps import RideWithGPS
from .nihonbashi import Nihonbashi
def get_opt() -> argparse.Namespace:
parser = argparse.ArgumentParser(description='Convert RWGPS to AR Nihonbashi Cue Sheet')
parser.add_argument("route_id", action="store", metavar="ROUTE_ID")
... | true |
e888fddb6d9cf35c08050187c682e265e026692c | Aasthaengg/IBMdataset | /Python_codes/p02949/s875172904.py | UTF-8 | 744 | 2.578125 | 3 | [] | no_license | N, M, P = list(map(int, input().split()))
ABC = [list(map(int, input().split())) for _ in range(M)]
class edge:
f, t, c = 0, 0, 0
inf = 10 ** 5 * (M + 1)
D = [inf] * N
D[0] = 0
E = [edge() for _ in range(M)]
for i in range(M):
f, t, c = ABC[i]
E[i].f = f - 1
E[i].t = t - 1
E[i].c = P - c
L = [False] * N... | true |
2bfe9ea06d6df9f89fc334e3165403dec8ec09c9 | ashishlonari/Python_Tutorial | /regularexpression.py | UTF-8 | 4,369 | 3.703125 | 4 | [] | no_license | # Why we use Regular Expression?
# For example if we want to remove a letter from a string it would be tedious task to remove the letter as we have to manipilate the string and apply for loops but with regular expression it is very easy.
import re
mystr = ''' TCS is the second largest Indian company by market capital... | true |
b8251daab02401e1c7f1dfa0fa96ca0d1d9f1aff | pohmelie/spoj | /BEADS.py | UTF-8 | 439 | 2.921875 | 3 | [] | no_license | from functools import partial, reduce
def mins(s, inds, shift):
ret = (inds[0],)
for i in range(1, len(inds)):
a, b = s[ret[0] + shift], s[inds[i] + shift]
if a > b:
ret = (inds[i],)
elif a == b:
ret += (inds[i],)
return ret
for _ in range(int(input())):
... | true |
16b54b90d655a15f6f98058912a741b092e05f63 | hbilar/libusurp | /test-connect.py | UTF-8 | 352 | 3.15625 | 3 | [] | no_license | # Connect to a socket / port
import socket
import sys
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((sys.argv[1], int(sys.argv[2])))
try:
while True:
data = s.recv(1024)
if len(data) > 0:
print("received " + data)
else:
break
finally:
# Clean ... | true |
4ed698dac5c2497124ddf7587786cefc4abc2286 | B-Tech-AI-Python/Class-assignments | /sem-3/Lab/Lab2/24_July_Lab2-list-tuple-dictionary.py | UTF-8 | 661 | 4.8125 | 5 | [] | no_license | # Create a list
my_list = [1, 2, 3]
print(my_list)
# %%
# Create a tuple
my_tuple = (12, 13, 14)
print(my_tuple)
# %%
# Create a dictionary
my_dictionary = {"Name": "Ishani", "Age": 19, "Height": 160}
print(my_dictionary)
# %%
# Addition with list and tuple
l1 = [1, 2, 3]
l2 = [4, 5, 6]
print(l1+l2)
t1 = (12, 13, ... | true |
cda99917e003ec71f69960964e0717c7230e9a15 | zeeshan93/pythonbasics | /MyPackage/DictionaryMultipleKeySort.py | UTF-8 | 540 | 3.203125 | 3 | [] | no_license | from operator import itemgetter
stocks = [
{'fname':'Bucky','lname':'Roberts'},
{'fname':'Tommy','lname':'Williams'},
{'fname':'Tommy','lname':'Roberts'},
{'fname':'Nick','lname':'Sandey'},
{'fname':'Tommy','lname':'Vincent'},
{'fname':'Bucky','lname':'Sandey... | true |
f0be08ae9bc13f2c70339229c206bf0b670b0db5 | sreekeshiyer/IT-Sem4 | /Python/Experiment_01/Codes/QuadraticEquation.py | UTF-8 | 475 | 3.921875 | 4 | [] | no_license | import math
a = int(input("Enter value of coefficient a: "))
b = int(input("Enter value of coefficient b: "))
c = int(input("Enter value of coefficient c: "))
if a==0:
print("Invalid Quadratic Equation!")
else:
dis = b * b - 4 * a * c
sqrt_val = math.sqrt(abs(dis))
if dis >= 0:
print("Re... | true |
3268d5e951fc064eaafd3b5832a70e374f5c352e | Saevon/spacebattle | /menu/mediators.py | UTF-8 | 5,529 | 2.703125 | 3 | [
"MIT"
] | permissive | from abstract import mediator
from abstract import event_manager
from pygame import locals as const
import pygame
class PygameClock(object):
'''
A clock using the pygame clock
'''
def __init__(self, fps=None):
self.fps = fps
self._clock = pygame.time.Clock()
self.reset()
... | true |
436eee5e032f7e7aba4f43c7a3b1349bdc42bb0f | daynight-feifanwang/DrebinGAN | /model.py | UTF-8 | 2,269 | 2.546875 | 3 | [] | no_license | import torch
from torch import nn
class ResBlock(nn.Module):
def __init__(self, dim):
super(ResBlock, self).__init__()
self.res_block = nn.Sequential(
nn.ReLU(True),
nn.Conv1d(dim, dim, 5, padding=2), # nn.Linear(DIM, DIM),
nn.ReLU(True),
nn.Conv1d(d... | true |
094fb3a02166f70d62f6f27cfe828641a6b2bf04 | rafhaelom/Python | /Medidor_de_pressao/back-end/medidor.py | UTF-8 | 2,891 | 3.328125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Sat Apr 3 23:37:21 2021
@author: Rafhael de Oliveira Martins
"""
#%% Importando Bibliotecas
import psycopg2
from datetime import datetime
#%% Desenvolvimento
print("---------------------------------------")
print("\t \t Medidor de pressão \t \t")
print("---------... | true |
9ed34544f3fab19cf2ca5e8aba49cad816bb01d9 | AHKerrigan/Knightroko | /source/plugins/Knightrocards/kc_utils.py | UTF-8 | 618 | 2.6875 | 3 | [] | no_license | from pymongo import MongoClient
import discord
def create_card(char_id):
client = MongoClient()
db = client['Knightrocards']
character = db['Characters'].find({"ID" : char_id})[0]
card = discord.Embed(title="Series Placeholder", colour=discord.Colour(0xffc904), url="https://discordapp.com", descript... | true |
42ac14a4e7c86ee0ee76dd318a24e5e1044f844f | Noiredd/Flammable | /flammable/snapshot.py | UTF-8 | 7,616 | 3.15625 | 3 | [] | no_license | import json
import os
class Snapshot():
"""Data and metadata of a single version of an experiment.
Each Snapshot corresponds to a specific point in the code history (commit).
Each Snapshot stores at most a single trained version of an experiment (but
multiple intermediate model files).
Each Snapshot lives ... | true |
e8e183a85131488af7361c9ea6a9b9f4670cdcaa | douradodev/Uri | /Uri/2484.py | UTF-8 | 500 | 3.671875 | 4 | [] | no_license | not_fisrt_loop = False
while True:
try:
if not_fisrt_loop:
print()
string = input()
new_string = ''
for char in string[:len(string)-1]:
new_string += char + ' '
else:
new_string += string[-1]
for i in range(len(string)):... | true |
c1405fc3d89189ce99a7a82e171112fb4fc02fee | carmelsa/cimacell_project | /app.py | UTF-8 | 961 | 2.96875 | 3 | [] | no_license | """
The application routing handler
"""
from flask import Flask, jsonify, request
from db_handler import DBHandler
app = Flask(__name__)
@app.route('/')
def hello_world():
return "Welcome to carmel weather searcher"
@app.route('/weather/data')
def get_weather_by_location():
try:
lon = request.args... | true |
ce4fac9c7ca07c67b34c58378d0a16fb6ba3a715 | julessanglier/TIPE2 | /simulation/misc.py | UTF-8 | 1,055 | 3.125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 12 15:45:00 2020
@author: Jules
"""
def average_velocity_dim2(v_x, v_y, particle_count, eps, delta_t):
sum_x = 0
sum_y = 0
len_v_x = len(v_x)
for i in range(len_v_x):
sum_x += v_x[i]
sum_y += v_y[i]
sum_x *= eps/((delta_t)... | true |
b650a3ac43c92bc0bf5246d7bdf6663407ef0e4f | alex-ren/teaching | /source/cs320_concept_programming_language_2014_fall/sec8/check_sol.py | UTF-8 | 4,699 | 3.25 | 3 | [] | no_license | Node = dict
Leaf = str
def isStringType(ty):
if ty == None:
return False
if ty == "Void":
return False
for label in ty:
if label == "String":
return True
else: # Arrow
return False
def tyExpr(env, e):
if type(e) == Node:
for label in e:
... | true |
af4a8ad69d2fe5b64b4db15d8404c3f1e6f51e48 | wgfi110/autokws2021 | /scoring/score.py | UTF-8 | 11,103 | 2.53125 | 3 | [] | no_license | # pylint: disable=logging-fstring-interpolation
"""scoring function for autograph"""
import argparse
import datetime
import os
from os.path import join
import logging
import sys
import time
import yaml
import pandas as pd
from filelock import FileLock
# Verbosity level of logging.
# Can be: NOTSET, DEBUG, INFO, WAR... | true |
a7a06ca9bed3569c4cca2b249cd22f6b583e88c1 | radosz/Programming101-3 | /week8/1-The-Last-HR/the_last_hr.py | UTF-8 | 4,256 | 2.921875 | 3 | [] | no_license | import requests
import sqlite3
create_table_students = """CREATE TABLE IF NOT EXISTS students(
student_id INTEGER PRIMARY KEY,
name TEXT,
github TEXT)
"""
create_table_course = """CREATE TABLE IF NOT EXISTS courses(
course_id INTEGER PRIMARY KEY, name TEXT)
"""
create_realatino_table = """CREATE TABLE IF NOT EXISTS ... | true |
fed3bb3ccd270fb0665905213ecbb474cf7397b7 | zhouliuling/Leetcode_Task | /881.py | UTF-8 | 719 | 3.5 | 4 | [] | no_license | ## 救生艇
"""
1. 按体重降序排列
2. 双指针l和r计算两个人体重和,若<=限制,船数res+1
3. 不满足,l右移,(因为体重大的优先单人坐船)
"""
class Solution(object):
def numRescueBoats(self, people, limit):
"""
:type people: List[int]
:type limit: int
:rtype: int
"""
people.sort(reverse = True)
l, r, res = 0, len(pe... | true |
ba04caae1c2c96d8ffe6cdf03eec60e1b39b8ea1 | mayaralima22/hive_game | /player.py | UTF-8 | 328 | 3.0625 | 3 | [] | no_license | class Player:
def __init__(self, name, queen, spider, beetle, grasshopper, ant):
self.hand = {
queen: 1,
spider: 2,
beetle: 2,
ant: 3,
grasshopper: 3,
}
self.name = name
def __repr__(self):
return f"Player('{self.name}... | true |