max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
Week2/3 - Min Stack/Solution.py | SaiLikhith7/Leetcode-30-Day-Challenge-April | 0 | 52500 | #
# Created on Fri Apr 10 2020
#
# Title: Leetcode - Min Stack
#
# Author: <NAME>
# Web: mistryvatsal.github.io
#
class MinStack:
def __init__(self):
# Creating 2 stacks, stack : original data; currMinimum : to hold current minimum upon each push
self.stack = list()
self.currMinimum = list(... | 3.71875 | 4 |
app/__main__.py | LostLuma/repo-import-test | 0 | 52501 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
MIT License
Copyright (c) 2018 <NAME>
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,... | 1.195313 | 1 |
paperman/__main__.py | zaphB/paperman | 0 | 52502 | # PYTHON_ARGCOMPLETE_OK
import argcomplete
import argparse
from . import io
from . import cfg
from . import utils
@utils.logExceptionsAndRaise
def main():
# show startup message
io.startup()
# options used by multiple subparsers
def addVerboseArg(parser):
parser.add_argument('-v', '--verbose', action='... | 2.328125 | 2 |
machlearn/naive_bayes/__init__.py | daniel-yj-yang/pyml | 2 | 52503 | # -*- coding: utf-8 -*-
# Author: <NAME> <<EMAIL>>
#
# License: BSD 3 clause
from ._naive_bayes import Bernoulli_NB_classifier, Multinomial_NB_classifier, Gaussian_NB_classifier, demo
from ._naive_bayes import Multinomial_NB_classifier_from_scratch, demo_from_scratch
# this is for "from <package_name>.naive_bayes im... | 1.101563 | 1 |
undaqTools/tests/test_element.py | rogerlew/undaqTools | 0 | 52504 | <filename>undaqTools/tests/test_element.py
from __future__ import print_function
# Copyright (c) 2013, <NAME>
# All rights reserved.
import os
import unittest
import numpy as np
from scipy.signal import detrend
from numpy.testing import assert_array_equal
from undaqTools import Daq, Element, fslice, findex
test_fi... | 2.390625 | 2 |
Attendance/get/all_students.py | MishaVernik/StudentAttendance | 0 | 52505 | <reponame>MishaVernik/StudentAttendance<filename>Attendance/get/all_students.py<gh_stars>0
import psycopg2
from Attendance.context.sql_connection import get_sql_connection
# Gets all students by subject and group
def all_students_s(groups):
global connection, cursor
'''
@:param students
- ar... | 3.046875 | 3 |
Insertion Sort.py | MichaelWiciak/SortingAlgorithms | 0 | 52506 | <reponame>MichaelWiciak/SortingAlgorithms
def insertionSort(aList):
first = 0
last = len(aList)-1
for CurrentPointer in range(first+1, last+1):
CurrentValue = aList[CurrentPointer]
Pointer = CurrentPointer - 1
while aList[Pointer] > CurrentValue and Pointer >= 0:
a... | 3.84375 | 4 |
Recursion_DynamicP/paint_fill.py | Randyjp/python_algorithms | 0 | 52507 | # 8.10) Implement a function to fill a matrix with a new color given a point and the matrix
def paint_fill(matrix, y, x, new_color):
# print(x, y)
len_x = len(matrix[0]) - 1
len_y = len(matrix[0][0]) - 1
if y < 0 or y > len_y or x < 0 or x > len_x:
return
if matrix[y][x] == new_color:
... | 4.34375 | 4 |
eylang/eylangparser.py | bxtkezhan/eylang | 4 | 52508 | from eylanglexer import reserved
from eylanglexer import rules as lex_rules
from eylanginterpreter import *
from rply import ParserGenerator
EYLANG_VARS = EylangVars()
pg = ParserGenerator(
list(reserved.values()) + [name for name, _ in lex_rules],
precedence=[
('left', ['AND', 'OR', 'NOT']),
... | 2.40625 | 2 |
meiduo_mall/meiduo_mall/apps/meiduo_admin/views/order.py | ZHD165/Django_- | 0 | 52509 | from rest_framework.viewsets import ModelViewSet
from orders.models import OrderInfo
from meiduo_admin.utils import PageNum
from meiduo_admin.serializers.order import OrderSeriazlier
from rest_framework.decorators import action
from rest_framework.response import Response
class OrdersView(ModelViewSet):
serializer... | 2.0625 | 2 |
scripts/save_spec_cyclegan_train.py | jiegev5/pytorch-CycleGAN-for-audio | 0 | 52510 | <reponame>jiegev5/pytorch-CycleGAN-for-audio
#!/usr/bin/env python
# coding: utf-8
import librosa
import numpy as np
import os
import sys
import time
from glob import glob
def compute_mfcc(y):
n_fft = 320
win_length = n_fft
hop_length = int(n_fft/2)
window = 'hamming'
D = librosa.stft(y, n_fft=n_... | 2.3125 | 2 |
Test/test_ImportCertificate.py | raghavendramanandi/SSLAutoPilot | 0 | 52511 | import unittest
from unittest import TestCase
from importCertificate import getCommandForImport
class TestImportCertificate(TestCase):
def test_getKeyStoreCommand(self):
command = getCommandForImport("certbotlocation", "location", "password")
self.assertEqual(command, "keytool -import -trustcacer... | 2.828125 | 3 |
CAAPR/CAAPR_AstroMagic/PTS/pts/magic/tools/statistics.py | wdobbels/CAAPR | 7 | 52512 | #!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
##... | 2.125 | 2 |
chapter_5/5.1.py | frbaroni/ctci | 0 | 52513 | import unittest
b32 = 0xFFFFFFFF
def bitInsertionFor(N, M, i, j):
clearmask = 0
for b in range(i, j):
clearmask |= 1 << b
clearmask = ~clearmask
r = N & clearmask
return r | (M << i)
def bitInsertionBit(N, M, i, j):
clearmask = (~1 & b32) << j
clearmask |= (1 << i) - 1
R = N &... | 3.078125 | 3 |
analysis_tools/PYTHON_RICARDO/rpl/tools/voxelization/test_intersection.py | lefevre-fraser/openmeta-mms | 0 | 52514 | """ Represent a triangulated surface using a 3D boolean grid"""
import numpy as np
from scipy import ndimage
import matplotlib.pyplot as plt
import matplotlib.cm as cm
voxel_size = 0.05
#stl_file = "50_standing"
#stl_file = "50p_hunch8"
stl_file = "volume_w_seats"
file_name = "voxels_temp_" + stl_file ... | 2.890625 | 3 |
ficheros/CSV/ejercicio altos cargos/numeurotonumdollar.py | txtbits/daw-python | 0 | 52515 | <reponame>txtbits/daw-python
dato = '21.999,32'
dato = float(dato.replace('.', '').replace(',', '.'))
print dato | 2.828125 | 3 |
scripts/import-ig-siis.py | firebird631/siis | 0 | 52516 | #!/usr/bin/python3
import sys
import subprocess
import pathlib
BROKER = "ig.com"
BASE_PATH = "/mnt/storage/Data/market/ig.com/dumps"
PREFIX = "full"
MARKETS = {
"CS.D.AUDNZD.MINI.IP": "AUDNZD",
"CS.D.AUDUSD.MINI.IP": "AUDUSD",
"CS.D.EURCAD.MINI.IP": "EURCAD",
"CS.D.EURCHF.MINI.IP": "EURCHF",
"CS.D... | 1.71875 | 2 |
manga_py/providers/mangareader_xyz.py | paulolimac/manga-py | 1 | 52517 | from manga_py.provider import Provider
from .helpers.std import Std
class MangaReaderXyz(Provider, Std):
def get_chapter_index(self) -> str:
re = self.re.compile(r'/chapter-(\d+(?:\.\d+)?)')
return re.search(self.chapter).group(1).replace('.', '-')
def get_main_content(self):
return ... | 2.578125 | 3 |
website/auth.py | MarcelKolodziej/Flask-Blog | 0 | 52518 | from flask import Blueprint, render_template, redirect, url_for,request, flash
from . import db
from .models import User
from flask_login import login_user, logout_user, login_required
auth = Blueprint("auth", __name__)
@auth.route("/login", methods=['GET', 'POST'])
def login():
email = request.form.get("email")
... | 2.9375 | 3 |
refparse/LRGParser.py | MattWellie/refparse | 0 | 52519 | <reponame>MattWellie/refparse
from xml.etree.ElementTree import parse
import logging
__author__ = "mwelland"
__version__ = 2.0
__version_date__ = "06/08/2020"
class LRGParser:
"""
Parses the input file to find all the useful values
"""
def __init__(self, cli_args, app_settings):
padding = i... | 2.640625 | 3 |
loggers.py | nikodeb/SUE-PBR | 0 | 52520 | <filename>loggers.py
import os
from abc import ABCMeta, abstractmethod
import random
import numpy as np
import torch
def save_state_dict(state_dict, path, filename):
torch.save(state_dict, os.path.join(path, filename))
def save_embeddings_disk(embedding, path, filename):
np.save(os.path.join(path, filename)... | 2.453125 | 2 |
Cursoemvideo/desafios/desafio021.py | gentildf/Python | 1 | 52521 | <reponame>gentildf/Python
#Faça um programa em Python que abra e reproduza o áudio de um arquivo MP3.
import pygame
print('\033[1mPlayer de música')
pygame.mixer.init()
pygame.mixer.music.load("desafio023.mp3")
pygame.mixer.music.play()
while(pygame.mixer.music.get_busy()):pass
| 3.453125 | 3 |
plots/shot_lengths_histogram.py | patrickhallen/therion-plotting-tools | 1 | 52522 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from os import path
def plot(args, conn):
df = pd.read_sql_query("select * from SHOT;", conn)
plt.hist(df["LENGTH"], bins=args.bins)
plt.xlabel("Shot length / m")
plt.ylabel("Count")
if args.log:
plt.yscale("log")
... | 2.9375 | 3 |
app/core/migrations/0011_auto_20200903_2018.py | ig0r45ure/recipe-app-api | 0 | 52523 | <filename>app/core/migrations/0011_auto_20200903_2018.py
# Generated by Django 3.0.10 on 2020-09-03 20:18
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0010_orgunit_is_hqunit'),
]
operations = [
... | 1.65625 | 2 |
buildpack/databroker/config_generator/scripts/generators/stream.py | jobvs/cf-mendix-buildpack | 36 | 52524 | <filename>buildpack/databroker/config_generator/scripts/generators/stream.py
import json
from buildpack.databroker.config_generator.scripts.utils import (
template_engine_instance,
)
def generate_config(config):
topologies = {"topologies": []}
env = template_engine_instance()
template = env.get_templa... | 2.234375 | 2 |
test/test_evaluator.py | naparuba/opsbro | 32 | 52525 | <reponame>naparuba/opsbro
#!/usr/bin/env python
# Copyright (C) 2014:
# <NAME>, <EMAIL>
import traceback
from opsbro_test import *
from opsbro.evaluater import evaluater
class TestEvaluater(OpsBroTest):
def setUp(self):
pass
def test_evaluator(self):
rules = [
{'rule... | 2.8125 | 3 |
greattunes/custom_models/simple_matern_model.py | svedel/greattunes | 0 | 52526 | from botorch.models.gpytorch import GPyTorchModel
from gpytorch.distributions import MultivariateNormal
from gpytorch.kernels import MaternKernel, ScaleKernel
from gpytorch.likelihoods import GaussianLikelihood
from gpytorch.means import ConstantMean
from gpytorch.models import ExactGP
from greattunes.transformed_kern... | 2.515625 | 3 |
projects/cookie/page/hupun_login_sso_one.py | kingking888/crawler-pyspider | 1 | 52527 | <gh_stars>1-10
from cookie.config import *
from cookie.page.hupun_login_sso_two import HupunLoginSsoTwo
from pyspider.libs.base_crawl import *
class HupunLoginSsoOne(BaseCrawl):
"""
hupun 的 cookie 获取的入口地址的第 3 个链接
已失效 - 20200809
"""
URL = 'https://account.hupun.com/service/sso/cookie/init?token={}... | 2.5 | 2 |
demisto_sdk/commands/common/configuration.py | sturmianseq/demisto-sdk | 42 | 52528 | <reponame>sturmianseq/demisto-sdk
import logging
from pathlib import Path
class Configuration:
"""Configuration was designed to make sure we have the necessary configuration to run SDK commands.
Attributes:
log_verbose (bool): whether the log should be verbose or not. default is False.
sdk_en... | 2.28125 | 2 |
easy/977_squares_of_sorted_array.py | Sukhrobjon/leetcode | 0 | 52529 | class Solution(object):
def sortedSquares(self, nums):
"""
:type A: List[int]
:rtype: List[int]
"""
squares = [0 for i in range(len(nums))]
# index iterator for squares array
i = len(squares) - 1
left = 0
right = len(nums) - 1
... | 3.796875 | 4 |
3rdparty/pytorch/tools/cwrap/plugins/BeforeAfterCall.py | WoodoLee/TorchCraft | 1 | 52530 | <reponame>WoodoLee/TorchCraft<filename>3rdparty/pytorch/tools/cwrap/plugins/BeforeAfterCall.py
from . import CWrapPlugin
from string import Template
class BeforeAfterCall(CWrapPlugin):
def initialize(self, cwrap):
self.cwrap = cwrap
def insert_snippet(self, template, option, offset, name):
p... | 2.390625 | 2 |
pyspark-pivot.py | myli5/PySpark-Examples | 0 | 52531 | <filename>pyspark-pivot.py<gh_stars>0
# -*- coding: utf-8 -*-
import pyspark
from pyspark.sql import SparkSession
from pyspark.sql.functions import expr
spark = SparkSession.builder.appName('pivot').getOrCreate()
data = [("Banana",1000,"USA"), ("Carrots",1500,"USA"), ("Beans",1600,"USA"), \
("Orange",2000,"USA"... | 3.328125 | 3 |
solutions/206.reverseList.py | lim1202/LeetCodeProblems | 0 | 52532 | """
206. Reverse Linked List
Given the head of a singly linked list, reverse the list, and return the reversed list.
Example 1:
Input: head = [1,2,3,4,5]
Output: [5,4,3,2,1]
Example 2:
Input: head = [1,2]
Output: [2,1]
Example 3:
Input: head = []
Output: []
Constraints:
The number of nodes in the list is the r... | 4.1875 | 4 |
read_write_using_with_as.py | snalahi/Python-Functions-Files-and-Dictionaries | 1 | 52533 | <reponame>snalahi/Python-Functions-Files-and-Dictionaries<gh_stars>1-10
fname = 'mydata.txt'
with open(fname, 'r') as md:
for line in md:
print(line)
# continue on with other code
fname = 'mydata2.txt'
with open(fname, 'w') as wr:
for i in range (20):
wr.write(str(i) + '\n')
| 3.578125 | 4 |
demo/testpermission_path/views.py | LaEmma/sparrow_cloud | 15 | 52534 | <gh_stars>10-100
from rest_framework.response import Response
from rest_framework.permissions import IsAuthenticated
from rest_framework.decorators import api_view, permission_classes
@api_view(("GET", "POST", "DELETE", "PUT"))
# @permission_classes([IsAuthenticated])
def test_path_params_1(request):
# import pdb... | 2.078125 | 2 |
phelma_calendar/phelma_calendar.py | rjullien/edt_to_gcal_sync_grenoble_inp | 0 | 52535 |
# ---
# Module to read grenoble.inp agenda (edt) and filter keep only the groups I belong to
# Configuration is done into configPhelma.py
#
# example of configPhelma.py (not commited for security raison)
#
# ICAL_FEED = 'https://loggin:passwd@edt.grenoble-inp.fr/directCal/2020-2021/etudiant/phelma?resources=20868,557... | 2.546875 | 3 |
aldryn_video/migrations/0002_auto_20201028_1115.py | okfn/website | 74 | 52536 | <reponame>okfn/website<filename>aldryn_video/migrations/0002_auto_20201028_1115.py
# Generated by Django 2.2.16 on 2020-10-28 11:15
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('aldryn_video', '0001_initial'),
]
... | 1.375 | 1 |
adventofcode/2016/01.py | hacktoolkit/code_challenges | 10 | 52537 | # Python Standard Library Imports
import re
from utils import (
InputConfig,
ingest,
)
INPUT_FILE = '01.in'
EXPECTED_ANSWERS = (271, 153, )
# INPUT_FILE = '01.test.in'
# EXPECTED_ANSWERS = (8, 4, )
def main():
solution = Solution()
answers = (solution.solve1(), solution.solve2(), )
print(answe... | 3.484375 | 3 |
onesignalapi/utils/device_switcher.py | alexromer0/onesignal-api | 1 | 52538 | <filename>onesignalapi/utils/device_switcher.py
class DeviceSwitch(object):
def __init__(self, device_data):
self.__device_data = device_data
def switch(self, key, value):
switcher = {
"identifier": self.__identifier,
"language": self.__language,
"timezone": ... | 2.78125 | 3 |
ServidorConexao/ServidorConexao.py | Exterminus/myftp | 2 | 52539 | # -*- coding: utf-8 -*-
#!/usr/bin/env python3
"""
Servidor de Conexao
<NAME>
UFSJ
"""
import sys
import socket
import _thread as thread
import getpass
import xmlrpc.client
import pickle
from Usuario import Usuario
import ssl
import socket
class ServidorConexao(object):
"""docstring for ServidorConexao."""
def ... | 2.6875 | 3 |
spotiserver/party.py | chrisbaudouinjr/spotiserver | 1 | 52540 | <reponame>chrisbaudouinjr/spotiserver<gh_stars>1-10
#!/usr/bin/env false
import datetime
import logging
import spotipy
import threading
import time
import random
import heapq
logger = logging.getLogger(__name__)
class PartyFoul(Exception):
pass
class Track:
def __init__(self, spotify_id):
self.spoti... | 2.765625 | 3 |
djangopypi2/apps/pypi_frontend/models.py | MediaMath/djangopypi2 | 12 | 52541 | <gh_stars>10-100
from django.db import models
from django.utils.translation import ugettext_lazy as _
class MirrorSite(models.Model):
enabled = models.BooleanField(default=False)
name = models.CharField(max_length=64)
url = models.CharField(max_length=255, unique=True)
def __unicode__(self):
r... | 2.140625 | 2 |
acl_resource.py | Atlas200dk/sample_bodypose | 0 | 52542 | <filename>acl_resource.py<gh_stars>0
import acl
from atlas_utils.utils import *
class AclResource(object):
def __init__(self, device_id=0):
self.device_id = device_id
self.context = None
self.stream = None
self.run_mode = None
def init(self):
print("init resource stage... | 2.296875 | 2 |
faim_robocopy/file_logger.py | fmi-basel/python-scripts | 2 | 52543 | <reponame>fmi-basel/python-scripts
import os
import datetime
import logging
LOGFILENAME_FMT = 'Robocopy_Logfile_{}.html'
def _get_logfilename():
'''constructs the logfile name.
'''
return LOGFILENAME_FMT.format(
datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S"))
def _create_logfolder_if_ne... | 2.5 | 2 |
tests/tests.py | vinicelms/resize_pictures | 0 | 52544 | import unittest
from core.picture import Picture
from PIL import Image
from shutil import copyfile, rmtree
import os
class PictureTestCase(unittest.TestCase):
def setUp(self):
self.current_dir = os.path.dirname(os.path.abspath(__file__))
self.test_dir = "{}{}test_dir".format(self.current_dir, os.p... | 2.8125 | 3 |
connectomics/data/utils/data_label.py | donglaiw/pytorch_connectomics | 1 | 52545 | import sys
import numpy as np
from skimage.measure import label
def getSegType(mid):
m_type = np.uint64
if mid<2**8:
m_type = np.uint8
elif mid<2**16:
m_type = np.uint16
elif mid<2**32:
m_type = np.uint32
return m_type
def seg2Count(seg,do_sort=True,rm_zero=False):
sm =... | 2.15625 | 2 |
src/pid.py | TamasSzepessy/DJITelloOpticalControl | 21 | 52546 | class PID(object):
def __init__(self, kp, ki, kd):
self.kp = kp
self.ki = ki
self.kd = kd
self.error_int = 0
self.error_prev = None
def control(self, error):
self.error_int += error
if self.error_prev is None:
self.error_prev = error
e... | 3 | 3 |
muda/deformers/colorednoise.py | yeliuyChuy/muda | 0 | 52547 | <gh_stars>0
#path:../site-packages/muda/deformers/colorednoise.py
'''Additive colored noise'''
import numpy as np
import librosa
from numpy.fft import irfft
from ..base import BaseTransformer
noise_type = ['white',
'pink',
'brown']
def noise_generator(y, sr, color):
'''generating no... | 2.65625 | 3 |
networks.py | ntubiolin/InsightFace_Pytorch | 0 | 52548 | import torch
import torch.nn as nn
import torch.nn.functional as F
class AttentionXCosNet(nn.Module):
def __init__(self, conf):
super(AttentionXCosNet, self).__init__()
self.embedding_net = nn.Sequential(
nn.Conv2d(32, 16, 3, padding=1),
nn.BatchNorm2d(16),
... | 2.65625 | 3 |
src/account/forms.py | opnfv/laas | 2 | 52549 | <gh_stars>1-10
##############################################################################
# Copyright (c) 2016 <NAME> and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is... | 2.03125 | 2 |
setup.py | rebeccaframework/rebecca.odata | 0 | 52550 | <reponame>rebeccaframework/rebecca.odata
from setuptools import setup
import os
__version__ = "0.1"
__author__ = "<NAME>"
__email__ = '<EMAIL>'
requires = [
"pyramid",
]
tests_require = [
"pytest",
"pytest-cov",
"testfixtures",
]
def read(name):
with open(os.path.join(os.path.dirname(__file__),... | 1.609375 | 2 |
cybox/bindings/network_socket_object.py | Mattlk13/python-cybox | 40 | 52551 | <filename>cybox/bindings/network_socket_object.py
# Copyright (c) 2017, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
import sys
from mixbox.binding_utils import *
from . import cybox_common
from . import socket_address_object
class SocketOptionsType(GeneratedsSuper):
"""The ... | 1.765625 | 2 |
latex/slides/resources/01_getting_started/present_concat.py | AntonObersteiner/python-lessons | 0 | 52552 | <reponame>AntonObersteiner/python-lessons
def present(name, alter, ort):
return name + ", " + str(alter) + " aus " + ort
| 3.25 | 3 |
Leetcode/1000-2000/1865. Finding Pairs With a Certain Sum/1865.py | Next-Gen-UI/Code-Dynamics | 0 | 52553 | <reponame>Next-Gen-UI/Code-Dynamics<filename>Leetcode/1000-2000/1865. Finding Pairs With a Certain Sum/1865.py
class FindSumPairs:
def __init__(self, nums1: List[int], nums2: List[int]):
self.nums1 = nums1
self.nums2 = nums2
self.count2 = Counter(nums2)
def add(self, index: int, val: int) -> None:
... | 3.3125 | 3 |
backup_files.py | vesaru/simple-python-file-backup | 0 | 52554 | <gh_stars>0
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Simple python file backup
License: MIT
"""
__author__ = '<NAME>'
__copyright__ = 'Copyright 2018, Simple python file backup'
__credits__ = ['<NAME>']
__license__ = 'MIT'
__version__ = '0.1'
__maintainer__ = '<NAME>'
__email__ = '<EMAIL>'
__s... | 2.03125 | 2 |
Enemy/enemies.py | henryboisdequin/Tower-Defense-Game | 0 | 52555 | <reponame>henryboisdequin/Tower-Defense-Game<gh_stars>0
import pygame
import math
class Enemy(object):
def __init__(self):
self.alive = True
self.height = 64
self.width = 64
self.vel = 0
self.full_health = 0
self.curr_health = self.full_health
self.enemies =... | 3.3125 | 3 |
tests/integration/test_map_failure.py | elin1231/htmap | 21 | 52556 | # Copyright 2018 HTCondor Team, Computer Sciences Department,
# University of Wisconsin-Madison, WI.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICE... | 2.125 | 2 |
s7_scalable_applications/exercise_files/lfw_dataset.py | fimselamse/dtu_mlops | 0 | 52557 | """
LFW dataloading
"""
import argparse
import time
import numpy as np
import torch
from PIL import Image
from torch.utils.data import DataLoader, Dataset
from torchvision import transforms
import os
import glob
import matplotlib.pyplot as plt
class LFWDataset(Dataset):
def __init__(self, path_to_folder: str, tr... | 2.515625 | 3 |
huoguoml/util/json.py | huoguoml/huoguoml | 5 | 52558 | <filename>huoguoml/util/json.py
"""
The huoguoml.util.string module contains some utility functions for json operations.
"""
import json
from typing import Any
def read_json(json_path: str) -> Any:
"""Read a json file and return the content. Returns None if not exist
"""
with open(json_path) as json_file:... | 3 | 3 |
day06/7-requests_proxy.py | Mhh123/spider | 0 | 52559 | import requests
lis = [
{'http': '172.16.17.32:8888'},
{'http': '192.168.3.11:3129'},
{'http': '172.16.58.3:8181'},
{'http': '172.16.31.10:8010'},
{'http': '172.16.31.10:80'},
{'http': '192.168.3.11:31773'},
]
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) Ap... | 2.609375 | 3 |
bites/bite014.py | ChidinmaKO/Chobe-bitesofpy | 0 | 52560 | <reponame>ChidinmaKO/Chobe-bitesofpy
import random
names = '<NAME> <NAME>'.split()
aliases = 'Pythonista Nerd Coder'.split() * 2
points = random.sample(range(81, 101), 6)
awake = [True, False] * 3
SEPARATOR = ' | '
def generate_table(*args):
zipped = zip(*args)
for item in zipped:
table = [str(i... | 2.671875 | 3 |
hermes/factory.py | scottfrazer/hermes | 14 | 52561 | <filename>hermes/factory.py
import re
from copy import deepcopy
from collections import OrderedDict
from hermes.grammar import *
from hermes.hermes_parser import Terminal as HermesTerminal
from hermes.hermes_parser import Ast, AstList
from hermes.hermes_parser import lex as hermes_lex
from hermes.hermes_parser import ... | 2.390625 | 2 |
caada/opensky/web.py | joshua-laughner/CAADA | 0 | 52562 | import os
from pandas import Timedelta
import requests
import time
from . import get_airport_code_source
from ..caada_errors import HTMLRequestError
from ..caada_typing import pathlike
from ..caada_logging import logger
def _download_airport_codes(source='openflights', update='never'):
"""Download geographic dat... | 2.859375 | 3 |
tests/test_extended_cache.py | javfg/flask-multipass-cern | 0 | 52563 | <filename>tests/test_extended_cache.py
from datetime import datetime, timedelta
import pytest
from flask_multipass_cern import ExtendedCache
from tests.conftest import MemoryCache
@pytest.fixture
def cache():
cache = MemoryCache()
return ExtendedCache(cache)
def test_no_cache():
cache = ExtendedCache(... | 2.359375 | 2 |
protocols/ddg_monomer_16/run_preminimization.py | Kortemme-Lab/ddg | 11 | 52564 | #!/usr/bin/env python2
# The MIT License (MIT)
#
# Copyright (c) 2015 <NAME>, <NAME>
#
# 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 r... | 1.59375 | 2 |
core/admin.py | mchlzhao/prophetic | 0 | 52565 | from django.contrib import admin
from .models import Group, Event, Market, Order, MarketPosition, Trade, Account
admin.site.register(Group)
admin.site.register(Event)
admin.site.register(Market)
admin.site.register(Order)
admin.site.register(MarketPosition)
admin.site.register(Trade)
admin.site.register(Account) | 1.382813 | 1 |
lambda.py | diegonat/smsantispam | 0 | 52566 | import ctypes
import os
from six.moves import urllib
import zipfile
import stat
import logging
import json
logging.basicConfig(level=logging.DEBUG)
print "logging"
def response(status_code, response_body):
return {
'statusCode': status_code,
'body': json.dumps(response_body) if res... | 2.171875 | 2 |
mallenom/reports/urls.py | crowmurk/mallenom | 0 | 52567 | from django.urls import path
from . import views
app_name = 'reports'
urlpatterns = [
path('', views.ReportDownload.as_view(), name='report'),
]
| 1.507813 | 2 |
noxfile.py | arnavdas88/QuTIpy | 0 | 52568 | # This file is part of the QuTIpy package.
# https://github.com/sumeetkhatri/QuTIpy
#
# Copyright (c) 2022 <NAME>.
# --.- ..- - .. .--. -.--
#
#
# SPDX-License-Identifier: AGPL-3.0
#
# This program is free software: you can redistribute it and/or mod... | 1.84375 | 2 |
py3.6+/DetectHotspots/GenSensitiveWord.py | InspAlgo/WEIBO_Project | 13 | 52569 | <reponame>InspAlgo/WEIBO_Project<filename>py3.6+/DetectHotspots/GenSensitiveWord.py<gh_stars>10-100
################################################################################
##
## 新浪微博热点事件发现与脉络生成系统
##
## @Filename ./DetectHotspots/GenSensitiveWord.py
## @Author 李林峰, 刘臻, 徐润邦, 马伯乐, 朱杰, 瞿凤业... | 1.882813 | 2 |
tests/test_expect.py | eerimoq/xpect | 0 | 52570 | import logging
import sys
import unittest
sys.path.insert(0, '..')
import expect
import time
# python 2 & 3 compatibility
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
class StringIo(object):
INDATA = None
def __init__(self):
self.in_stream = StringIO(self.I... | 2.4375 | 2 |
api_blog/serializers.py | poya-kob/BiaBegard | 0 | 52571 | from rest_framework.serializers import HyperlinkedModelSerializer, ModelSerializer
from rest_framework import serializers
from .models import Blog, BlogCategory, Comments
class CategorySerializer(ModelSerializer):
class Meta:
model = BlogCategory
exclude = ['id']
class BlogListSerializer(Hyperl... | 2.140625 | 2 |
output.py | prashantbarca/tvastr | 0 | 52572 | import hammer as h
signals = h.choice(
h.token("hmi.signal1"),
h.token("hmi.signal2"),
h.token("hmi.signal3"))
| 1.4375 | 1 |
experiments/flow.py | Shazambom/pi_led | 0 | 52573 | <reponame>Shazambom/pi_led
import board
import neopixel
import time
import colorsys
import random
import atexit
num_lights = 50
num_colors = 100
pixels = neopixel.NeoPixel(board.D18, num_lights)
def on_exit():
pixels.deinit()
atexit.register(on_exit)
def SetColors(buff, pixels):
for i in range(len(pixels)):
pi... | 3.109375 | 3 |
project-3/tracer/__main__.py | ejrbuss/csc460 | 1 | 52574 | <filename>project-3/tracer/__main__.py
from argparse import ArgumentParser
from .tracer import main
# Program entry point for module
if __name__ == "__main__":
parser = ArgumentParser(prog='tracer', description='RTOS live tracer provides debug information from a serial connection to your AVR board.')
parser.a... | 2.6875 | 3 |
scraper.py | musflood/job-scraper | 0 | 52575 | """Scrape the first ten pages of stackoverflow jobs for python jobs.
- The job title
- The company name
- The location
- The date posted (in whatever date format makes the most sense to you)
- The link to the actual job posting
"""
from bs4 import BeautifulSoup as bs
from datetime import datetime
import os
import requ... | 3.421875 | 3 |
python/face.py | ericlin94/face-auth | 0 | 52576 | <reponame>ericlin94/face-auth<filename>python/face.py
#!/usr/bin/python3
import cognitive_face as CF
import sys
def main():
KEY = '8d23038c098e458ba0b04e7528b2c949' # Replace with a valid Subscription Key here.
CF.Key.set(KEY)
BASE_URL = 'https://westcentralus.api.cognitive.microsoft.com/face/v1.0/' # Replace w... | 2.28125 | 2 |
task_manager/api/views.py | deorz/SC_TaskManager | 0 | 52577 | from django.contrib.auth import get_user_model
from django.contrib.auth.hashers import check_password
from django.shortcuts import get_object_or_404
from rest_framework import viewsets, mixins, status
from rest_framework.decorators import action
from rest_framework.permissions import IsAdminUser, AllowAny
from rest_fra... | 1.945313 | 2 |
worklets/resources/set-cookie.py | servo-wpt-sync/web-platform-tests | 0 | 52578 | def main(request, response):
name = request.GET.first("name")
source_origin = request.headers.get("origin", None);
response.headers.set("Set-Cookie", name + "=value")
response.headers.set("Access-Control-Allow-Origin", source_origin)
response.headers.set("Access-Control-Allow-Credentials", "true")
| 1.914063 | 2 |
{{cookiecutter.project_pypi_name}}/setup.py | dalthviz/spyder5-plugin-cookiecutter | 0 | 52579 | <filename>{{cookiecutter.project_pypi_name}}/setup.py
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------
# Copyright © {% now "local", "%Y" %}, {{ cookiecutter.full_name }}
#
# Licensed under the terms of the {{ cookiecutter.open_source_license }}
# ------------------... | 1.4375 | 1 |
pygithub3/requests/repos/hooks.py | teamorchard/python-github3 | 107 | 52580 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
from . import Request
from pygithub3.resources.repos import Hook
class List(Request):
uri = 'repos/{user}/{repo}/hooks'
resource = Hook
class Get(Request):
uri = 'repos/{user}/{repo}/hooks/{id}'
resource = Hook
class Create(Request):
uri = 'r... | 2.09375 | 2 |
web3_input_decoder/exceptions.py | kigawas/web3-input-decoder | 13 | 52581 | __all__ = ("InputDataError",)
class InputDataError(ValueError):
pass
| 1.203125 | 1 |
mysuper/users/migrations/0004_assets_employee.py | oreon/mysuper | 0 | 52582 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-01-28 23:51
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('users', '0003_department'),
]
operations = [
... | 1.726563 | 2 |
map_generator/transform_db.py | just1ce415/map_generator | 0 | 52583 | <gh_stars>0
"""
Laboratory 2.2
Transformation DB module (adding coordinates)
One-use module
"""
from geopy.geocoders import Nominatim
from geopy.extra.rate_limiter import RateLimiter
PATH = './../data/'
def trasform_db():
'''
Transform db (adding coordinates).
'''
# CONVERT TO LIST
buffer_lst = []... | 2.484375 | 2 |
rsgeo-py/tests/test_geometry.py | YuRiTan/geofunc | 3 | 52584 | import numpy as np
import pytest
from rsgeo.geometry import Polygon # noqa
class TestPolygon:
def setup_method(self):
self.p = Polygon([(0, 0), (1, 1), (1, 0), (0, 0)])
def test_repr(self):
str_repr = str(self.p)
exp = "Polygon([(0, 0), (1, 1), (1, 0), (0, 0)])"
assert str_r... | 2.734375 | 3 |
eqbtest/util/data/regen.py | cryptotechguru/tesseract | 0 | 52585 | import os
import json
raw_data = open("bitcoin-util-test.json").read()
input_data = json.loads(raw_data)
for testObj in input_data:
inp = ""
out = ""
args = " ".join(testObj['args'])
if 'input' in testObj:
inp = testObj['input']
if 'output_cmp' in testObj:
out = testObj['output_... | 2.859375 | 3 |
scale/job/messages/process_job_input.py | stevevarner/scale | 0 | 52586 | """Defines a command message that processes the input for a job"""
from __future__ import unicode_literals
import logging
from django.db import transaction
from data.data.exceptions import InvalidData
from job.models import Job
from messaging.messages.message import CommandMessage
logger = logging.getLogger(__name... | 3.03125 | 3 |
tests/test_resize_image.py | AndrewLorente/catsnap | 5 | 52587 | from __future__ import unicode_literals
import os.path
from wand.image import Image as ImageHandler
from mock import patch, Mock, call
from nose.tools import eq_, nottest
from tests import TestCase
from tests.image_helper import SMALL_JPG, SOME_GIF, SOME_PNG
from catsnap import Client
from catsnap.image_truck import ... | 2.234375 | 2 |
mfg_ais.py | taiwenko/python | 0 | 52588 | <reponame>taiwenko/python<filename>mfg_ais.py
#!/usr/bin/env python
# rffe functional test
# Author: <NAME>
import xpf6020
import bk8500
import math
import os
from time import sleep
from blessings import Terminal
t = Terminal()
print "Accessing the Power Supply"
ps_path = '/dev/serial/by-id/usb-FTDI_FT232R_USB_UAR... | 2.71875 | 3 |
Unit_06/Dicts_04.py | icerovski/SoftUni_Python_Fundamentals | 0 | 52589 | <gh_stars>0
# 04. Forum Topics
line = input()
forum_dict = {}
# def unique(sequence):
# seen = set()
# return [x for x in sequence if not(x in seen or seen.add(x))]
while not line == "filter":
words = line.split(" -> ")
topic = words[0]
hashtags = words[1].split(", ")
if topic not in forum_di... | 3.578125 | 4 |
src/pyats/atom.py | CDonnerer/PyATS | 0 | 52590 | <reponame>CDonnerer/PyATS
import os
import io
import numpy as np
class Atom(object):
def __init__(self, element, wpos, rpos):
"""
:param element: Periodic symbol
:param wpos: Wyckoff position
:param rpos: Symmetry-equivalent positions
"""
self.element = element... | 2.546875 | 3 |
config.py | dunossauro/Aul-o_de_flask | 3 | 52591 | from os import path
dirname = path.dirname(__file__)
class Config:
# SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_DATABASE_URI = f'sqlite:///{dirname}/db.sqlite3'
BATATINHAS = 3
class development(Config):
DEBUG = True
SQLALCHEMY_ECHO = True
class production(Config):
DEBUG = False
| 2.109375 | 2 |
L2/type_var.py | thebestday/python | 0 | 52592 | <reponame>thebestday/python
# Типы переменных
# Марка
name = 'ford'
print(name, type(name)) # class string
# Age
age = 3
print(age, type(age)) # class int
# Обьем двигателя
engine_volume = 1.6
print(engine_volume, type(engine_volume)) # class float
# Есть ли люк
see_sky = False
print(see_sky, type(see_sky)) # class boo... | 3.78125 | 4 |
dbmanage/myapp/templates/include/pagejump/bak/function.py | bopopescu/sbdb_new | 3 | 52593 | #!/bin/env python
#-*-coding:utf-8-*-
import MySQLdb,sys,string,time,datetime,uuid
from django.contrib.auth.models import User,Permission,ContentType,Group
from myapp.models import Db_name,Db_account,Db_instance,Oper_log,Login_log,Db_group
from dbmanage.myapp.form import LoginForm,Captcha
reload(sys)
sys.setdefaultenc... | 2.03125 | 2 |
enthought/developer/view/file_browser_view.py | enthought/etsproxy | 3 | 52594 | # proxy module
from __future__ import absolute_import
from etsdevtools.developer.view.file_browser_view import *
| 1.132813 | 1 |
inference_ff_minimal.py | dsikar/efficient-compact-fire-detection-cnn | 1 | 52595 | <gh_stars>1-10
##########################################################################
# Example : perform live fire detection in image/video/webcam using
# NasNet-A-OnFire, ShuffleNetV2-OnFire CNN models.
# Copyright (c) 2020/21 - <NAME> / <NAME> / Toby
# Breckon, Durham University, UK
# License :
# https://gith... | 2.125 | 2 |
venmo-sim/metis/metis_verify.py | akatsarakis/tx_benchmarking | 3 | 52596 | # Generate some graph to verify the quality of Metis' partitioning
# A graph with 300 vertices, vertices 0~99, 100~199, 200~299 form
# a complete graph respectively
# and add some random disturbing edges
import random
import os
os.environ["METIS_DLL"] = "/usr/local/lib/libmetis.so"
import metis
import networkx as nx
... | 2.765625 | 3 |
lesleyloraine/settings/prod.py | ninapavlich/lesleyloraine | 0 | 52597 | <reponame>ninapavlich/lesleyloraine
from lesleyloraine.settings.base import *
#==============================================================================
# Generic Django project settings
#==============================================================================
ALLOWED_HOSTS = ['*']
| 1.179688 | 1 |
oands/forms.py | PARAVPREET17/OCR_WEB_APP | 0 | 52598 | from django import forms
from .models import Ocr,Contact
class ImageUpload(forms.ModelForm):
class Meta:
model = Ocr
fields = ['image']
class ContactForm(forms.ModelForm):
class Meta:
model=Contact
fields=['name', 'email', 'message']
| 2.0625 | 2 |
backend/api/forms/CreateMiembroSprintForm.py | kukiamarilla/polijira | 1 | 52599 | <reponame>kukiamarilla/polijira<gh_stars>1-10
from django.core.exceptions import ValidationError
from backend.api.models import Miembro
from django import forms
class CreateMiembroSprintForm(forms.Form):
"""
CreateMiembroSprintForm Valida los datos del request.data al crear un miembro del sprint
Args:
... | 2.75 | 3 |